diff --git a/December-01/d1.py b/December-01/d1.py
new file mode 100644
index 0000000..9c88538
--- /dev/null
+++ b/December-01/d1.py
@@ -0,0 +1,18 @@
+def sevenis(n):
+ arr = []
+ i = 0
+ while(n > len(arr)):
+ tmp = pow(7,i)
+ arr.append(tmp)
+ for j in range(len(arr)-1):
+ arr.append(arr[j]+tmp)
+ if(len(arr) > n):
+ break
+ i += 1
+ return arr[n-1]
+
+n = int(input())
+
+print(sevenis(n))
+
+
diff --git a/December-02/d2.py b/December-02/d2.py
new file mode 100644
index 0000000..96b2497
--- /dev/null
+++ b/December-02/d2.py
@@ -0,0 +1,21 @@
+def check(num):
+ s1 = 0
+ s2 = 0
+ for i in range(len(num)):
+ if(i%2 == 0):
+ s1 += int(num[i])
+ else:
+ tmp = int(num[i]) * 2
+ while (tmp > 9):
+ tmp -= 9
+ s2 += tmp
+ tot = s1 + s2
+ if( tot % 10 == 0):
+ print(num + " passes the test")
+ else:
+ print(num + " failed the test")
+
+
+inp = input()
+
+check(inp)
diff --git a/December-03/d3.py b/December-03/d3.py
new file mode 100644
index 0000000..71e27e8
--- /dev/null
+++ b/December-03/d3.py
@@ -0,0 +1,24 @@
+import math
+def snap(arr,n):
+ if(len(arr) == 1):
+ return arr
+ elif(sorted(arr) == arr):
+ return arr
+ flag = count = 1
+ limit = math.ceil(n/2)
+ tmp = [arr[0]]
+ for i in range(1,len(arr)):
+ if(tmp[-1] < arr[i]):
+ tmp.append(arr[i])
+ count += 1
+ if(count == limit):
+ return tmp
+ flag = 0
+ if(flag == 1):
+ return arr[0:1]
+ else:
+ snap(arr[0:limit],limit)
+
+n = int(input('Enter the size:'))
+arr = [int(i) for i in input().split()]
+print(snap(arr,n))
\ No newline at end of file
diff --git a/December-04/d4.py b/December-04/d4.py
new file mode 100644
index 0000000..5a60da3
--- /dev/null
+++ b/December-04/d4.py
@@ -0,0 +1,15 @@
+def h_index(n,arr):
+ arr.sort()
+ max = -1
+ for i in range(len(arr)):
+ if(len(arr) - i == arr[i]):
+ if(arr[i] > max):
+ max = arr[i]
+ return max
+
+
+
+n = int(input('Enter # of papers:'))
+arr = [int(e) for e in input().split()]
+
+print(h_index(n,arr))
\ No newline at end of file
diff --git a/December-05/d5.py b/December-05/d5.py
new file mode 100644
index 0000000..61dcc73
--- /dev/null
+++ b/December-05/d5.py
@@ -0,0 +1,29 @@
+file1 = open('../src/res/csv_to_html_res.csv','r')
+file2 = open('example.html','a')
+open('example.html', 'w').close()
+openTag = "\n^
\n^^\n^^\n\n"
+result = ""
+result += openTag
+flag = 0
+for line in file1:
+ values = line.split(',')
+ tmp = ""
+ if(flag == 0):
+ for e in values:
+ e = e.replace('\n','')
+ tmp += "{} | ".format(e)
+ flag = 1
+ else:
+ for e in values:
+ e = e.replace('\n','')
+ tmp += "{} | ".format(e)
+ tr = "^^^^{}
\n".format(tmp)
+ result += tr
+result += closeTag
+file2.write(result.replace('^',' '))
+file1.close()
+file2.close()
+
+
+
\ No newline at end of file
diff --git a/December-06/d6.py b/December-06/d6.py
new file mode 100644
index 0000000..6689635
--- /dev/null
+++ b/December-06/d6.py
@@ -0,0 +1,43 @@
+import math
+
+def isSquare(n):
+ rt = int(math.sqrt(n))
+ return rt*rt == n
+
+def isFib(n):
+ return isSquare(5*n*n + 4) or isSquare(5*n*n - 4)
+
+def generate(m):
+ if(m>9):
+ print('This leads to memory error')
+ return
+ primes = [True for i in range(10**7)]
+ primes[0] = primes[1] = False
+ n = len(primes)
+ count = 0
+ for i in range(2,n):
+ if(primes[i]):
+ if(isFib(i)):
+ print(i)
+ count += 1
+ if(count == m):
+ return
+ ind = 2
+ tmp = i*ind
+ while(tmp < n):
+ primes[tmp] = False
+ ind += 1
+ tmp = i*ind
+
+
+
+
+
+n = int(input("Enter a number between 1-9:"))
+generate(n)
+
+
+
+
+
+
diff --git a/December-07/d7.cpp b/December-07/d7.cpp
new file mode 100644
index 0000000..68f7488
--- /dev/null
+++ b/December-07/d7.cpp
@@ -0,0 +1,50 @@
+#include
+#include
+
+using namespace std;
+
+class Person {
+ public:
+ int no;
+ char id;
+ void get() {
+ cout<<"\nEnter the token number & id:"<>no>>id;
+ }
+ void print() {
+ cout<<"\n("<>n;
+ queue ppl,tmp;
+ for(int i = 0; i < n; i++) {
+ Person tmp;
+ tmp.get();
+ ppl.push(tmp);
+ }
+ char k;
+ cout<<"\nEnter the id of k:";
+ cin>>k;
+ while(!ppl.empty()) {
+ Person top = ppl.front();
+ if(top.id == k) {
+ ppl.pop();
+ top.print();
+ while(!tmp.empty()) {
+ tmp.front().print();
+ tmp.pop();
+ }
+ } else {
+ tmp.push(top);
+ ppl.pop();
+ }
+ }
+ while(!tmp.empty()) {
+ tmp.front().print();
+ tmp.pop();
+ }
+}
\ No newline at end of file
diff --git a/December-08/d8.py b/December-08/d8.py
new file mode 100644
index 0000000..9d14eab
--- /dev/null
+++ b/December-08/d8.py
@@ -0,0 +1,59 @@
+def hasFront(arr,r,c,i,j):
+ if(i-1 >= 0):
+ return arr[i-1][j] == arr[i][j]
+ return False
+
+def hasBack(arr,r,c,i,j):
+ if(i+1 < r):
+ return arr[i+1][j] == arr[i][j]
+ return False
+
+def hasLR(arr,r,c,i,j):
+ if(j+1 < c):
+ if(arr[i][j+1] == arr[i][j]):
+ return True
+ if(j-1 >= 0):
+ if(arr[i][j-1] == arr[i][j]):
+ return True
+ return False
+
+def hasDiagonal(arr,r,c,i,j):
+ if(i-1 >=0 and j-1 >=0):
+ if(arr[i-1][j-1] == arr[i][j]):
+ return True
+ if(i+1 < r and j+1 < c):
+ if(arr[i+1][j+1] == arr[i][j]):
+ return True
+ if(i-1 >=0 and j+1 < c):
+ if(arr[i-1][j+1] == arr[i][j]):
+ return True
+ if(i+1 < r and j-1 >= 0):
+ if(arr[i+1][j-1] == arr[i][j]):
+ return True
+ return False
+
+
+r = int(input('Enter # of rows:'))
+c = int(input('Enter # of columns:'))
+print('-Enter the student arrangement-')
+arr = []
+for _ in range(r):
+ arr.append([e for e in input().split()])
+
+result = []
+for _ in range(r):
+ result.append([0.0 for i in range(c)])
+
+for i in range(r):
+ for j in range(c):
+ if(hasFront(arr,r,c,i,j)):
+ result[i][j] += 0.3
+ if(hasBack(arr,r,c,i,j)):
+ result[i][j] += 0.2
+ if(hasLR(arr,r,c,i,j)):
+ result[i][j] += 0.2
+ if(hasDiagonal(arr,r,c,i,j)):
+ result[i][j] += 0.025
+
+for e in result:
+ print(e)
\ No newline at end of file
diff --git a/December-09/d9.py b/December-09/d9.py
new file mode 100644
index 0000000..de8d4f5
--- /dev/null
+++ b/December-09/d9.py
@@ -0,0 +1,21 @@
+def get(setn,no):
+ print('Enter the elements in set {}'.format(no))
+ setn.update([int(e) for e in input().split()])
+
+def check(set1,set2,function):
+ set3 = set()
+ func = function.replace('x','{}')
+ func = func.replace('^','**')
+ for e in set1:
+ set3.add(int(eval(func.format(e))))
+ if(len(set1) == len(set3) and set3.issubset(set2)):
+ print('It is one-to-one function')
+ else:
+ print('It is not one-to-one function')
+
+set1 = set()
+set2 = set()
+get(set1,1)
+get(set2,2)
+function = input('Enter the function use \'x\' as placeholder:')
+check(set1,set2,function)
diff --git a/December-10/d10.cpp b/December-10/d10.cpp
new file mode 100644
index 0000000..1bb94d9
--- /dev/null
+++ b/December-10/d10.cpp
@@ -0,0 +1,29 @@
+#include
+using namespace std;
+
+int cookie_count(int n,int p,int c) {
+ int cookies = 0,freeCookies = 0,remaining = 0;
+ cookies += n/p;
+ freeCookies = cookies/c;
+ remaining = cookies%c;
+ do {
+ cookies += freeCookies;
+ int tmp = freeCookies;
+ freeCookies /= c;
+ remaining += tmp%c;
+ } while(freeCookies > 0);
+ cookies += remaining / c;
+ return cookies;
+}
+
+int main() {
+ int n,p,c;
+ cout<<"\nEnter the total cost:";
+ cin>>n;
+ cout<<"\nEnter the cost of a cookie:";
+ cin>>p;
+ cout<<"\nEnter # of jar required for a cookie:";
+ cin>>c;
+ cout< 1):
+ print('@ is used more than once')
+ return
+ else:
+ alpha = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ number = "1234567890"
+ chars = "._-"
+ parts = email.split('@')
+ name = parts[0]
+ domain = parts[1]
+ for e in name:
+ if(e not in alpha and e not in number and e not in chars):
+ print('Invalid characters')
+ return
+ for e in domain:
+ if(e not in alpha and e != '.'):
+ print('Invalid domain')
+ return
+ if(domain[-1:-5:-1] != "moc."):
+ print('.com is required')
+ return
+ if(len(domain) < 5):
+ print('domain is required')
+ return
+ print('Email is valid')
+
+email = input('Enter the email:')
+check(email)
\ No newline at end of file
diff --git a/December-12/d12.py b/December-12/d12.py
new file mode 100644
index 0000000..12cdecf
--- /dev/null
+++ b/December-12/d12.py
@@ -0,0 +1,39 @@
+import json
+import math
+
+def degreesToRadians(degrees):
+ return degrees * math.pi / 180
+
+def distance(lat1, lon1, lat2, lon2):
+ earthRadiusKm = 6371
+ dLat = degreesToRadians(lat2-lat1)
+ dLon = degreesToRadians(lon2-lon1)
+ lat1 = degreesToRadians(lat1)
+ lat2 = degreesToRadians(lat2)
+ a = math.sin(dLat/2) * math.sin(dLat/2) + math.sin(dLon/2) * math.sin(dLon/2) * math.cos(lat1) * math.cos(lat2);
+ c = 2 * math.atan2(math.sqrt(a), math.sqrt(1-a));
+ return earthRadiusKm * c
+
+JaSON = open('./src/res/JaSON.json','r')
+parsed = json.loads(JaSON.read())
+
+result = {
+ 'directions':[
+ {
+ 'message':'',
+ 'distance':0,
+ 'direction':'N'
+ }
+ ]
+}
+markers = parsed['markers']
+start = markers[0]['location']
+destination = markers[1]['location']
+
+result['directions'][0]['distance'] = distance(start[0],start[1],destination[0],destination[1])
+result['directions'][0]['message'] = input('Enter some message:')
+result['directions'][0]['direction'] = input('Enter the direction(N,S,W,E):')
+
+print( json.dumps(result,indent = 4) )
+
+JaSON.close()
\ No newline at end of file
diff --git a/December-13/d13.py b/December-13/d13.py
new file mode 100644
index 0000000..67b7801
--- /dev/null
+++ b/December-13/d13.py
@@ -0,0 +1,7 @@
+n = int(input('Enter no of switches:'))
+res = [False for _ in range(n+1)]
+for i in range(1,n+1):
+ for j in range(1,n+1):
+ if(j%i == 0):
+ res[j] = not res[j]
+print('No of switches in the \'on\' state at the end:',res[1:n+1].count(True))
\ No newline at end of file
diff --git a/December-14/d14.py b/December-14/d14.py
new file mode 100644
index 0000000..26e662f
--- /dev/null
+++ b/December-14/d14.py
@@ -0,0 +1,16 @@
+def count(s,pat):
+ c = 0
+ for i in range(len(s)):
+ if(s[i] in pat):
+ c += len(s) - i
+ return c
+
+s = input('Enter the string:')
+
+A = count(s,'aeiou')
+B = count(s,'bcdfghjklmnqrstvwxyz')
+
+if(A >B):
+ print('The winner is A with {} points'.format(A))
+else:
+ print('The winner is B with {} points'.format(B))
\ No newline at end of file
diff --git a/December-15/d15.py b/December-15/d15.py
new file mode 100644
index 0000000..f0cfcce
--- /dev/null
+++ b/December-15/d15.py
@@ -0,0 +1,10 @@
+def comb(n,s="",a=0,b=0):
+ if(a == b and a == n):
+ print(s)
+ if(a <= n):
+ comb(n, s+"A", a+1, b)
+ if(b < a):
+ comb(n, s+"B", a, b+1)
+
+n = int(input('Quantity of A(in grams):'))
+comb(n)
\ No newline at end of file
diff --git a/December-16/d16.py b/December-16/d16.py
new file mode 100644
index 0000000..c496913
--- /dev/null
+++ b/December-16/d16.py
@@ -0,0 +1,70 @@
+def order(inp):
+ ord = {'a':0,'2':1,'3':2,'4':3,'5':4,'6':5,'7':6,'8':7,'9':8,'10':9,'j':10,'q':11,'k':12}
+ return ord[inp[0:-1]]
+
+def sort(inp):
+ for i in range(len(inp)-1):
+ for j in range(len(inp)-i-1):
+ if(order(inp[j]) > order(inp[j+1])):
+ inp[j],inp[j+1] = inp[j+1],inp[j]
+
+def straight_flush(inp):
+ flag1 = True
+ flag2 = True
+ for i in range(len(inp)-1):
+ if( inp[i][-1] != inp[i+1][-1] ):
+ flag1 = False
+ break
+ for i in range(len(inp)-1):
+ if( order(inp[i+1]) - order(inp[i]) != 1 and (order(inp[i+1]) == 10 and order(inp[i]) == 0)):
+ flag2 = False
+ break
+ if(flag1 and flag2):
+ print('straight-flush')
+ elif(flag1):
+ print('flush')
+ elif(flag2):
+ print('straight')
+ if(flag1 or flag2):
+ return True
+ else:
+ return False
+
+
+def x_of_kind(inp):
+ count = 1
+ result = []
+ for i in range(len(inp)-1):
+ if(inp[i][0:-1] == inp[i+1][0:-1]):
+ count += 1
+ else:
+ result.append(count)
+ count = 1
+ result.append(count)
+ return result
+
+def poker(inp):
+ sort(inp)
+ if(straight_flush(inp)):
+ return
+ elif(1):
+ res = sorted(x_of_kind(inp))
+ if(res == [5]):
+ print('five-of-kind')
+ elif(res == [1,4]):
+ print('four-of-kind')
+ elif(res == [1,1,3]):
+ print('three-of-kind')
+ elif(res == [2,3]):
+ print('full-house')
+ elif(res == [1,2,2]):
+ print('two-pair')
+ elif(res == [1,1,1,2]):
+ print('one-pair')
+ elif(res == [1,1,1,1,1]):
+ print('high-card')
+ else:
+ print('invalid')
+
+inp = [e for e in input('Enter the cards:').split()]
+poker(inp)
diff --git a/December-17/d17.py b/December-17/d17.py
new file mode 100644
index 0000000..45177d4
--- /dev/null
+++ b/December-17/d17.py
@@ -0,0 +1,62 @@
+def path1(r,start,end):
+ try:
+ return abs(r.index(start) - r.index(end))
+ except ValueError:
+ return 10000
+
+def path2(r1,r2,inter,start,end):
+ try:
+ d1 = abs(r1.index(start) - r1.index(inter))
+ d2 = abs(r2.index(inter) - r2.index(end))
+ return d1 + d2
+ except ValueError:
+ return 10000
+
+def intersection(r1,r2):
+ inter = []
+ for e in r1:
+ if(e in r2):
+ inter.append(e)
+ return inter
+
+def print1(r,start,end):
+ for i in range(r.index(start),r.index(end)+1):
+ print(r[i],end=" -> ")
+
+def print2(r1,r2,inter,start,end):
+ print1(r1,start,inter)
+ print1(r2,r2[r2.index(inter)+1],end)
+
+def path(r1,r2,start,end):
+ d1 = path1(r1,start,end) # start & end in r1
+ d2 = path1(r2,start,end) # start & end in r2
+ d3 = d4 = 10000 # start & end in r1 & r2
+ mini = None
+ inter = intersection(r1,r2)
+ for e in inter:
+ md3 = path2(r1,r2,e,start,end)
+ md4 = path2(r2,r1,e,start,end)
+ if(md3 < d3):
+ d3 = md3
+ mini = e
+ if(md4 < d4):
+ d4 = md4
+ mini = e
+ short = min(d1,d2,d3,d4)
+ print('Shortest path:')
+ if(short == d1):
+ print1(r1,start,end)
+ elif(short == d2):
+ print1(r2,start,end)
+ elif(short == d3):
+ print2(r1,r2,mini,start,end)
+ elif(short == d4):
+ print2(r2,r1,mini,start,end)
+
+r1 = [s for s in input('Line 1: ').split(',')]
+r2 = [s for s in input('Line 2: ').split(',')]
+start = input('Start: ')
+end = input('End: ')
+
+path(r1,r2,start,end)
+
diff --git a/December-18/pwcracker/pwcracker.java b/December-18/pwcracker/pwcracker.java
new file mode 100644
index 0000000..2804fee
--- /dev/null
+++ b/December-18/pwcracker/pwcracker.java
@@ -0,0 +1,107 @@
+package pwcracker;
+
+import java.time.Instant;
+import java.time.Duration;
+import java.util.Iterator;
+import java.util.Scanner;
+
+public class pwcracker {
+
+ public static void main(String[] args) {
+ Scanner scan = new Scanner(System.in);
+ String pw;
+ int length;
+
+ System.out.println("Enter a password that is up to 5 chars: ");
+ pw = "" + scan.nextLine();
+ length = pw.length();
+ Instant start = Instant.now();
+ SequentialPatternGenerator generator = new SequentialPatternGenerator(length);
+
+ generator.forEachRemaining(test -> {if(pw.equals(test)) {
+ System.out.println("Your password: " + test );
+ Instant end = Instant.now();
+ long timeelap = Duration.between(start, end).getSeconds();
+ System.out.println("Time elapsed: " + timeelap + " s");
+ //System.out.print(timeelap);
+ }});
+
+ }
+}
+
+class SequentialPatternGenerator implements Iterator {
+
+ private static final char[] CHOICES = new char[]{'a', 'b', 'c', 'd', 'e', 'f',
+ 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','1','2','3','4','5','6','7','8','9','0','!','~','`','@','#','$','%','^','&','*','(',')','-','=','_','+','[',']','{','}',';','\'',':','\"',',','.','<','>','/','?','|','\\',' '};
+ // for(int i =32;i<=126;i++) {
+ // CHOICES[i] = (char)i;
+ // }
+ private static final int MAX_INDEX = CHOICES.length - 1;
+ private boolean keepProducing = true;
+ private final int[] indexes;
+
+ public SequentialPatternGenerator(final int length) {
+ indexes = new int[length];
+ initIndexes();
+ }
+
+ private void initIndexes() {
+ for (int i = 0; i < indexes.length; i++) {
+ indexes[i] = 0;
+ }
+ }
+
+ @Override
+ public boolean hasNext() {
+ if (!keepProducing) {
+ return false;
+ }
+
+ for (int i = 0; i < indexes.length; i++) {
+ if (indexes[i] < MAX_INDEX) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public String next() {
+ if (!keepProducing || !hasNext()) {
+ return null;
+ }
+
+ String next = produceString();
+ adjustIndexes();
+
+ return next;
+ }
+
+ public void stop() {
+ keepProducing = false;
+ }
+
+ private String produceString() {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < indexes.length; i++) {
+ sb.append(CHOICES[indexes[i]]);
+ }
+
+ return sb.toString();
+ }
+
+ private void adjustIndexes() {
+ int i;
+ for(i = 0 ; i < indexes.length ; i++) {
+ if(indexes[i] < MAX_INDEX) {
+ indexes[i] = indexes[i] + 1;
+ break;
+ }
+ }
+
+ for(int j=0; j < i; j++) {
+ indexes[j] = 0;
+ }
+ }
+}
\ No newline at end of file
diff --git a/December-19/d19.py b/December-19/d19.py
new file mode 100644
index 0000000..2f538a3
--- /dev/null
+++ b/December-19/d19.py
@@ -0,0 +1,48 @@
+def left_ind(P):
+ M = 0
+ for i in range(1,len(P)):
+ if P[i][0] < P[M][0]:
+ M = i
+ elif P[i][0] == P[M][0]:
+ if P[i][1] > P[M][1]:
+ M = i
+ return M
+
+def pos(p, q, r):
+ val = (q[1] - p[1]) * (r[0] - q[0]) - (q[0] - p[0]) * (r[1] - q[1])
+ if val == 0:
+ return 0
+ elif val > 0:
+ return 1
+ else:
+ return 2
+
+def covex(P, n):
+ if n < 3:
+ return
+ l = left_ind(P)
+ hull = []
+ p = l
+ q = 0
+ while(True):
+ hull.append(p)
+ q = (p + 1) % n
+ for i in range(n):
+ if(pos(P[p],
+ P[i], P[q]) == 2):
+ q = i
+ p = q
+ if(p == l):
+ break
+ for each in hull:
+ print(P[each][0], P[each][1])
+
+n = int(input('Enter # of points:'))
+P = []
+for _ in range(n):
+ print('Enter x & y co-orinates:')
+ P.append([int(e) for e in input().split()][0:2])
+
+print('The covering points are:')
+covex(P, len(P))
+
diff --git a/December-20/d20.py b/December-20/d20.py
new file mode 100644
index 0000000..4e6e168
--- /dev/null
+++ b/December-20/d20.py
@@ -0,0 +1,46 @@
+def TSP(graph, s, V):
+ vertex = []
+ for i in range(V):
+ if i != s:
+ vertex.append(i)
+ minp = 1000000000
+ while True:
+ curp = 0
+ k = s
+ for i in range(len(vertex)):
+ curp += graph[k][vertex[i]]
+ k = vertex[i]
+ curp += graph[k][s]
+ minp = min(minp, curp)
+ if not next(vertex):
+ break
+ return minp
+def next(L):
+ n = len(L)
+ i = n - 2
+ while i >= 0 and L[i] >= L[i + 1]:
+ i -= 1
+ if i == -1:
+ return False
+ j = i + 1
+ while j < n and L[j] > L[i]:
+ j += 1
+ j -= 1
+ L[i], L[j] = L[j], L[i]
+ left = i + 1
+ right = n - 1
+ while left < right:
+ L[left], L[right] = L[right], L[left]
+ left += 1
+ right -= 1
+ return True
+
+V = int(input('Enter no of vertex:'))
+graph = []
+print('Enter the distance between each city in matrix form')
+for _ in range(V):
+ row = [int(e) for e in input().split()][0:V]
+ graph.append(row)
+
+print('Shortest distance: ',TSP(graph,0,V),'km')
+
diff --git a/December-21/d21.py b/December-21/d21.py
new file mode 100644
index 0000000..ab95094
--- /dev/null
+++ b/December-21/d21.py
@@ -0,0 +1,17 @@
+def marching_partners(n,stu,d):
+ stu.sort()
+ count = i = 0
+ while(i < n-1):
+ if(abs(stu[i] - stu[i+1]) <= d):
+ count += 1
+ i += 2
+ else:
+ i += 1
+ return count
+
+n = int(input('Enter # of students:'))
+print('Enter height of each student')
+stu = [int(e) for e in input().split()][0:n]
+d = int(input('Enter the threshold:'))
+
+print('No of pairs: ',marching_partners(n,stu,d))
\ No newline at end of file
diff --git a/December-22/d22.py b/December-22/d22.py
new file mode 100644
index 0000000..01fa2ea
--- /dev/null
+++ b/December-22/d22.py
@@ -0,0 +1,19 @@
+def alt_balls(n,arr):
+ count = 1
+ ind = 0
+ while(ind < n):
+ for i in range(ind, n - 1):
+ if(arr[i] != arr[i+1]):
+ count += 1
+ else:
+ break
+ ind += count
+ while(count >= 1):
+ print(count,end=" ")
+ count -= 1
+ count = 1
+
+n = int(input('Enter # of balls ;) :'))
+arr = [e for e in input().split()][0:n]
+
+alt_balls(n,arr)
\ No newline at end of file
diff --git a/December-23/d23.py b/December-23/d23.py
new file mode 100644
index 0000000..e69de29
diff --git a/December-24/d24.py b/December-24/d24.py
new file mode 100644
index 0000000..79240dd
--- /dev/null
+++ b/December-24/d24.py
@@ -0,0 +1,12 @@
+n = int(input('Length of the output:'))
+output = [int(e) for e in input().split()][0:n]
+print()
+count = 0
+for i in range(0,n,3):
+ try:
+ count += 1
+ print(output[i],end=" ")
+ except(e):
+ break
+print()
+print("Length:",count)
\ No newline at end of file
diff --git a/December-25/d25.py b/December-25/d25.py
new file mode 100644
index 0000000..714fda9
--- /dev/null
+++ b/December-25/d25.py
@@ -0,0 +1,21 @@
+def restore(arr):
+ print("D1| D2| D3| D4| D5")
+ for e1 in arr:
+ count = 0
+ for e2 in e1:
+ if(e2[0] == '1'):
+ count += 1
+ if(count % 2 == 0):
+ e1[e1.index('*')] = '0'
+ else:
+ e1[e1.index('*')] = '1'
+ for e2 in e1:
+ print(e2,end=" ")
+ print()
+n = int(input("Enter # of data:"))
+arr = []
+print("D1| D2| D3| D4| D5")
+for _ in range(n):
+ arr.append([e for e in input().split()])
+print()
+restore(arr)
diff --git a/December-26/d26.py b/December-26/d26.py
new file mode 100644
index 0000000..2139ff1
--- /dev/null
+++ b/December-26/d26.py
@@ -0,0 +1,23 @@
+def buildTower(n,arr):
+ count = 0
+ for i in range(len(arr)-1):
+ diff = abs(arr[i] - arr[i+1])
+ if(diff == 1):
+ continue
+ elif(diff == 0):
+ count += 1
+ mid = int(len(arr)/2)
+ if( i < mid):
+ arr[i] -= 1
+ else:
+ arr[i+1] -= 1
+ else:
+ count += diff-1
+ arr[i+1] -= diff-1
+ print("Minimum operation:",count)
+ print("After operation:",arr)
+
+n = int(input('Enter # of compartments: '))
+arr = [int(e) for e in input().split()][0:n]
+
+buildTower(n,arr)
\ No newline at end of file
diff --git a/December-27/d27.cpp b/December-27/d27.cpp
new file mode 100644
index 0000000..ebc5c5a
--- /dev/null
+++ b/December-27/d27.cpp
@@ -0,0 +1,39 @@
+#include
+#define ROW 1000
+#define COL 1000
+using namespace std;
+
+void spiral(int m, int n, int a[ROW][COL])
+{
+ int i, k = 0, l = 0;
+ while (k < m && l < n) {
+ for (i = l; i < n; ++i)
+ cout << a[k][i] << " ";
+ k++;
+ for (i = k; i < m; ++i)
+ cout << a[i][n - 1] << " ";
+ n--;
+ if (k < m) {
+ for (i = n - 1; i >= l; --i)
+ cout << a[m - 1][i] << " ";
+ m--;
+ }
+ if (l < n) {
+ for (i = m - 1; i >= k; --i)
+ cout << a[i][l] << " ";
+ l++;
+ }
+ }
+}
+int main()
+{
+ int a[ROW][COL],r,c;
+ cout<<"\nEnter # of row & col:";
+ cin>>r>>c;
+ cout<<"\n--Enter the matrix--\n";
+ for(int i=0;i>a[i][j];
+ spiral(r,c,a);
+ return 0;
+}
\ No newline at end of file
diff --git a/December-28/d28.py b/December-28/d28.py
new file mode 100644
index 0000000..242d5e7
--- /dev/null
+++ b/December-28/d28.py
@@ -0,0 +1,30 @@
+def assasin(arr,n):
+ group = flag = 0
+ result = [set() for _ in range(n)]
+ for i in range(n):
+ for j in range(n):
+ if(arr[i][j] == 1):
+ result[i].add(j)
+ for i in range(n):
+ for j in range(i+1,n):
+ if(result[j].issubset(result[i])):
+ result[j] = set({})
+ for e in result:
+ if(len(e) > 0):
+ group += 1
+ if(len(e) == 1):
+ flag = 1
+ print('No of groups: ',group)
+ if(flag == 1):
+ print('An Assassin is present')
+ else:
+ print('No Assassins')
+
+n = int(input('Enter no of people:'))
+arr = []
+print('Enter the relation matrix:')
+for _ in range(n):
+ row = [int(e) for e in input().split()][0:n]
+ arr.append(row)
+
+assasin(arr,n)
\ No newline at end of file
diff --git a/December-29/d29.py b/December-29/d29.py
new file mode 100644
index 0000000..19e7d09
--- /dev/null
+++ b/December-29/d29.py
@@ -0,0 +1,21 @@
+def rotate(array,n = 26):
+ arr = array[0:26]
+ temp = arr[0]
+ for i in range(n-1):
+ arr[i] = arr[i+1]
+ arr[n-1] = temp
+ return arr
+table = [ 'A B C D E F G H I J K L M N O P Q R S T U V W X Y Z'.split()]
+for i in range(25):
+ table.append(rotate(table[-1]))
+
+cipher = input('Enter the ciphered text:').upper()
+keyword = input('Enter the keyword:').upper()
+keystream = (keyword*(int(len(cipher)/len(keyword))+1))[0:len(cipher)]
+
+for i in range(len(keystream)):
+ col = ord(keystream[i]) - 65
+ for j in range(26):
+ if(table[j][col] == cipher[i]):
+ print(chr(j+65),end="")
+ break
\ No newline at end of file
diff --git a/December-30/d30.py b/December-30/d30.py
new file mode 100644
index 0000000..763751c
--- /dev/null
+++ b/December-30/d30.py
@@ -0,0 +1,49 @@
+def minDistance(dist, sptSet, n):
+ mini = 10000
+ min_index = -1
+ for v in range(n):
+ if(dist[v] < mini and sptSet[v] == False):
+ mini = dist[v]
+ min_index = v
+ return min_index
+
+def minimize_cost(src,graph,n):
+ tot = 0
+ dist = [10000] * n
+ dist[src] = 0
+ sptSet = [False] * n
+ parent = [-1] * n
+ for cout in range(n):
+ u = minDistance(dist, sptSet,n)
+ sptSet[u] = True
+ for v in range(n):
+ if (graph[u][v] > 0 and sptSet[v] == False and dist[v] > dist[u] + graph[u][v]):
+ dist[v] = dist[u] + graph[u][v]
+ parent[v] = u
+ for i in range(len(parent)):
+ if(parent[i] >= 0):
+ tot += graph[parent[i]][i]
+ return tot
+
+n = int(input('How many edges:'))
+edge = []
+vertex = set()
+for i in range(n):
+ edge.append(input('Edge {}:'.format(i+1)).split())
+ edge[i][2] = int(edge[i][2])
+ vertex.add(edge[i][0])
+ vertex.add(edge[i][1])
+V = dict()
+i = s = 0
+for e in vertex:
+ if(e == 'S' or e == 's'):
+ s = i
+ V[e] = i
+ i += 1
+graph = []
+for _ in range(n):
+ graph.append([0 for _ in range(n)])
+for e in edge:
+ graph[V[e[0]]][V[e[1]]] = e[2]
+
+print('Minimum cost: ',minimize_cost(s,graph,n))
\ No newline at end of file
diff --git a/December-31/d31.py b/December-31/d31.py
new file mode 100644
index 0000000..5fae666
--- /dev/null
+++ b/December-31/d31.py
@@ -0,0 +1,27 @@
+import numpy as np
+import matplotlib.pyplot as plt
+from sklearn.cluster import KMeans
+
+data = open('../src/res/build_city_csv.csv', 'r')
+x = []
+y = []
+for d in data:
+ tmp = d.split(',')
+ x.append(float(tmp[0]))
+ y.append(float(tmp[1]))
+X = np.array(list(zip(x,y)))
+kmeans = KMeans(n_clusters=3)
+kmeans = kmeans.fit(X)
+labels = kmeans.predict(X)
+centroids = kmeans.cluster_centers_
+cx = []
+cy = []
+i = 0
+for e in centroids.tolist():
+ print('Store {} : '.format(i),e)
+ cx.append(e[0])
+ cy.append(e[1])
+ i += 1
+plt.scatter(x,y,c='blue')
+plt.scatter(cx,cy,c='red')
+plt.show()
\ No newline at end of file