diff --git a/CP/ International Coding League (Rated)/p1.py b/CP/ International Coding League (Rated)/p1.py new file mode 100644 index 0000000..7a45b48 --- /dev/null +++ b/CP/ International Coding League (Rated)/p1.py @@ -0,0 +1,82 @@ + # International Coding League (Rated) + +import math +def readInts(): + return list(map(int, raw_input().strip().split())) +def readInt(): + return int(raw_input()) +def readIntsindex0(): + return list(map(lambda x: int(x) - 1, input().split())) +def readStrs(): + return raw_input().split() +def readStr(): + return raw_input() +def numlistTostr(list1): + return ''.join(list1) +def strlistTostr(list1): + return ''.join(str(e) for e in list1) +def strTolist(str): + return str.split() +def strlistTointlist(str): + return map(int, str) +def slicenum(number,x): + return int(str(number)[:x]) +def numTobin(A): + s = str(bin(A))[2:] + s = '0'*(31-len(s)) + s + return s +def precise(num): + return "{0:.10f}".format(num) +def rsorted(a): + return sorted(a,reverse=True) + +for __ in range(readInt()): + n,m = readInts() + arr,a = [],[] + for i in range(n): + arr.append(readInts()) + for i in range(n): + for j in range(m): + a.append(arr[i][j]) + # print(arr) + # print(a) + a= rsorted(a) + # print(a) + sum1,sum2 =0,0 + for i in range(len(a)): + if(i&1): + sum2+=a[i] + else: + sum1+=a[i] + if(sum2==sum1): + print("Draw") + # print(sum1,sum2) + elif(sum2>sum1): + print("Geno") + # print(sum1,sum2) + else: + print("Cyborg") + # print(sum1,sum2) + + + + +''' +3 +1 1 +3 +2 3 +4 4 4 +4 4 4 +2 3 +4 3 4 +4 4 4 + +Sample Output + +Cyborg +Draw +Cyborg + +Geno +''' diff --git a/CP/ International Coding League (Rated)/p2.py b/CP/ International Coding League (Rated)/p2.py new file mode 100644 index 0000000..c90e16a --- /dev/null +++ b/CP/ International Coding League (Rated)/p2.py @@ -0,0 +1,66 @@ + # International Coding League (Rated) +from fractions import gcd +import math +def readInts(): + return list(map(int, raw_input().strip().split())) +def readInt(): + return int(raw_input()) +def readIntsindex0(): + return list(map(lambda x: int(x) - 1, input().split())) +def readStrs(): + return raw_input().split() +def readStr(): + return raw_input() +def numlistTostr(list1): + return ''.join(list1) +def strlistTostr(list1): + return ''.join(str(e) for e in list1) +def strTolist(str): + return str.split() +def strlistTointlist(str): + return map(int, str) +def slicenum(number,x): + return int(str(number)[:x]) +def numTobin(A): + s = str(bin(A))[2:] + s = '0'*(31-len(s)) + s + return s +def precise(num): + return "{0:.10f}".format(num) +def rsorted(a): + return sorted(a,reverse=True) + +for __ in range(readInt()): + n,k = readInts() + string = readStr() + con = 0 + col =n + summ = 0 + for i in string: + if(ord(i)-96>2*k): + con+=1 + col-=1 + summ+=ord(i)-96 + # print(summ) + lolo = k*(col-con)+summ + p = gcd(abs(lolo),k) + lolo/=p + k/=p + print lolo,k + +''' +Sample Input + +2 +10 6 +abcdefghij +10 1 +qwertyuiop + +Sample Output + +10 1 +159 1 + + +''' diff --git a/CP/ International Coding League (Rated)/p3.cpp b/CP/ International Coding League (Rated)/p3.cpp new file mode 100644 index 0000000..b43afdc --- /dev/null +++ b/CP/ International Coding League (Rated)/p3.cpp @@ -0,0 +1,72 @@ +#include +#define ll long long +#define pb push_back +#define endl '\n' +#define pii pair +#define vi vector +#define all(a) (a).begin(),(a).end() +#define F first +#define S second +#define sz(x) (ll int)x.size() +#define hell 1000000007 +#define rep(i,a,b) for(ll int i=a;i>t; + while(t--) + { + ll n,m,a,b,c,d,p ; + cin>>n>>m>>a>>b>>c>>d>>p; + ll A,B,C; + A = a+b; + B = c+d; + C = p+m*b+n*d; + ll g = gcd(A,B); + if(C %g!=0){ + cout<<"-1"<= n + m); + } + cout << ans << "\n"; + + + } + +return 0; +} diff --git a/CP/ International Coding League (Rated)/p4.cpp b/CP/ International Coding League (Rated)/p4.cpp new file mode 100644 index 0000000..a6b536f --- /dev/null +++ b/CP/ International Coding League (Rated)/p4.cpp @@ -0,0 +1,55 @@ +#include +#define ll long long +#define pb push_back +#define endl '\n' +#define pii pair +#define vi vector +#define all(a) (a).begin(),(a).end() +#define F first +#define S second +#define sz(x) (ll int)x.size() +#define hell 1000000007 +#define rep(i,a,b) for(ll int i=a;i>t; + while(t--) + { + ll n,k; + cin>> + + } + +return 0; +} + +/* + +Sample Input + +5 6 +1 3 4 +1 2 1 +1 1 4 +2 4 2 3 +2 4 2 1 +2 3 5 3 + +Sample Output + +4 +1 +3 +-1 +4 +5 + + +*/ diff --git a/CP/ March Challenge 2018/p4.py b/CP/ March Challenge 2018/p4.py index 9042163..532315b 100644 --- a/CP/ March Challenge 2018/p4.py +++ b/CP/ March Challenge 2018/p4.py @@ -9,29 +9,39 @@ def readStr(): return raw_input() -for __ in range(readInt()): - n,h = readInts() - a = readInts() - a = sorted(a) - print(a) - # summ = 0 - # for i in range(n): - # summ+= a[i] - diff = h-n - if(n==h): - print(a[n-1]) - continue - for i in range(diff): - print("yeh waala hai ", a[n+i-1]) - if(a[n+i-1]/2<=1): - break - j = a[n+i-1]/2 - a[n+i-1] -= j - a.append(j) - a = sorted(a) - print(a) - # di = i - print(int(a[n+i])) +for m in range(readInt()): + strings = raw_input().split(" ") + N= int(strings[0]) + H= int(strings[1]) + strings1=raw_input().split(" ") + A= map(int, strings1) + maxi = A[0] + sumi = 0 + for i in range(len(A)): + sumi += A[i] + if(maxi < A[i]): + maxi = A[i] + flag=True + #suitable values of K + avg = sumi/H + low = avg + high = maxi + #######################################3 + hr = 0 + while(low<=high): + mid = (low+high)/2 + hr = 0 + for j in range(len(A)): + if( A[j]%mid != 0): + hr += A[j]/mid + 1 + else: + hr += A[j]/mid + if(hr <= H): + ans = mid + high = mid - 1 + else: + low = mid + 1 + print ans ''' diff --git a/CP/ March Challenge 2018/p41.py b/CP/ March Challenge 2018/p41.py deleted file mode 100644 index 9c8749e..0000000 --- a/CP/ March Challenge 2018/p41.py +++ /dev/null @@ -1,66 +0,0 @@ -import math -def readInts(): - return list(map(int, raw_input().strip().split())) -def readInt(): - return int(raw_input()) -def readIntsindex0(): - return list(map(lambda x: int(x) - 1, input().split())) -def readStr(): - return raw_input() - -for __ in range(readInt()): - n,h = readInts() - a = readInts() - a = sorted(a) - diff = h-n - if(n==h): - print(a[n-1]) - continue - for i in range(diff): - if(a[n+i-1]/2<=1): - break - j = a[n+i-1]/2 - a[n+i-1] -= j - a.append(j) - a = sorted(a) - print(int(a[n+i])) - - -''' - -Input: -1 -4 5 -4 3 2 100 - -1 -4 6 -4 3 2 100 - -1 -7 15 -1 1 1 1 1 1 1 - -1 -5 12 -232 43 213 2431 431 - -1 -4 5 -4 3 2 7 - -3 -3 3 -1 2 3 -3 4 -1 2 3 -4 5 -4 3 2 7 - -2 -6 9 -12 35 45 34 32 213 -4 5 -4 3 2 7 - -''' diff --git a/CP/ March Challenge 2018/p5.py b/CP/ March Challenge 2018/p5.py index f038922..ade45b3 100644 --- a/CP/ March Challenge 2018/p5.py +++ b/CP/ March Challenge 2018/p5.py @@ -1,3 +1,5 @@ + +from fractions import gcd import math def readInts(): return list(map(int, raw_input().strip().split())) @@ -9,15 +11,72 @@ def readStrs(): return raw_input().split() def readStr(): return raw_input() +def numlistTostr(list1): + return ''.join(list1) +def strlistTostr(list1): + return ''.join(str(e) for e in list1) +def strTolist(str): + return str.split() +def strlistTointlist(str): + return map(int, str) +def slicenum(number,x): + return int(str(number)[:x]) +def precise(num): + return "{0:.10f}".format(num) +def rsorted(a): + return sorted(a,reverse=True) +def binar(x): + return '{0:031b}'.format(x) + + +bitln = 31 +n,q = readInts() +ar = readInts() + +# list created here +biar = map(binar,ar) +# print biar + +bits = [] + +for i_ in range(bitln): + bits.append([0,0]) -for __ in range(readInt()): - +# print bits +prfxar = [] +prfxar.append([(0,0)]*bitln) +# print prfxar +for i in range(n): + tmp = [(0,0)]*bitln # 1 d array + # print tmp + for j in range(bitln): + if biar[i][j] == '1': + bits[j][1]+=1 + else: + bits[j][0]+=1 + tmp[j] = bits[j][0],bits[j][1] + prfxar.append(tmp) + # print prfxar + +# for i in range(n): +# print(prfxar[i]) + +for _ in range(q): + l,r = map(int,raw_input().split()) + ans = 0 + for j in range(bitln): + if (prfxar[r][j][1] - prfxar[l-1][j][1]) < (prfxar[r][j][0] - prfxar[l-1][j][0]): + ans += 1<<(bitln-j-1) + # print((bitln-j-1)) + + print ans + +# print(bits) ''' -Input: 5 3 20 11 18 2 13 @@ -25,10 +84,4 @@ def readStr(): 3 5 2 4 -Output: - -2147483629 -2147483645 -2147483645 - ''' diff --git a/CP/ March Challenge 2018/p6.py b/CP/ March Challenge 2018/p6.py new file mode 100644 index 0000000..bb4a1e5 --- /dev/null +++ b/CP/ March Challenge 2018/p6.py @@ -0,0 +1,82 @@ +# Akash Kandpal +# My Domain => http://harrypotter.tech/ +from fractions import gcd +import math +from itertools import permutations + +def readInts(): + return list(map(int, raw_input().strip().split())) +def readInt(): + return int(raw_input()) +def readIntsindex0(): + return list(map(lambda x: int(x) - 1, input().split())) +def readStrs(): + return raw_input().split() +def readStr(): + return raw_input() +def numlistTostr(list1): + return ''.join(list1) +def strlistTostr(list1): + return ''.join(str(e) for e in list1) +def strTolist(str): + return str.split() +def strlistTointlist(str): + return map(int, str) +def slicenum(number,x): + return int(str(number)[:x]) +def precise(num): + return "{0:.10f}".format(num) +def rsorted(a): + return sorted(a,reverse=True) +def binar(x): + return '{0:031b}'.format(x) +def permute(word): + perms = [''.join(p) for p in permutations(word)] + # print perms + return set(perms) + +a = readInt() +while(a): + a-=1 + b=input() + c=readInts() + w=[0]*b + for i in range(b): + s=0 + j=i+1 + while(s<=c[i] and j-1): + if(s<=c[i]): + w[j]+=1 + s+=c[j] + j-=1 + else: + break + for i in range(b): + print w[i], + print + + +''' +Input: + +2 +4 +4 3 2 1 +5 +1 2 2 3 1 + +Output: + +1 2 3 2 +2 3 2 3 1 + +''' diff --git a/CP/ March Challenge 2018/p7.cpp b/CP/ March Challenge 2018/p7.cpp new file mode 100644 index 0000000..9a3e449 --- /dev/null +++ b/CP/ March Challenge 2018/p7.cpp @@ -0,0 +1,31 @@ +#include +#define ll long long +#define pb push_back +#define endl '\n' +#define pii pair +#define vi vector +#define all(a) (a).begin(),(a).end() +#define F first +#define S second +#define sz(x) (ll int)x.size() +#define hell 1000000007 +#define rep(i,a,b) for(ll int i=a;i>t; + while(t--) + { + ll n,k; + cin>> + + } + +return 0; +} diff --git a/CP/Game of Codes/p1.py b/CP/Game of Codes/p1.py new file mode 100644 index 0000000..32741f2 --- /dev/null +++ b/CP/Game of Codes/p1.py @@ -0,0 +1,58 @@ +# Akash Kandpal +# My Domain => http://harrypotter.tech/ +from fractions import gcd +import math +from itertools import permutations + +def readInts(): + return list(map(int, raw_input().strip().split())) +def readInt(): + return int(raw_input()) +def readIntsindex0(): + return list(map(lambda x: int(x) - 1, input().split())) +def readStrs(): + return raw_input().split() +def readStr(): + return raw_input() +def numlistTostr(list1): + return ''.join(list1) +def strlistTostr(list1): + return ''.join(str(e) for e in list1) +def strTolist(str): + return str.split() +def strlistTointlist(str): + return map(int, str) +def slicenum(number,x): + return int(str(number)[:x]) +def precise(num): + return "{0:.10f}".format(num) +def rsorted(a): + return sorted(a,reverse=True) +def binar(x): + return '{0:031b}'.format(x) +def permute(word): + perms = [''.join(p) for p in permutations(word)] + # print perms + return set(perms) + +arr = [] +for __ in range(readInt()): + stri = readStr() + a = [] + for i in stri: + if(ord(i)>96): + a +=chr(27-(ord(i)-96)+96) + else: + # print ord(i) + a +=chr(27-(ord(i)-64)+64) + # print a + print(strlistTostr(a)) + +''' +5 +aaaaaa +axycd +dasafdssfsa +abcdefghijklmnopqrstuvwxyz +ABCas +''' diff --git a/CP/Game of Codes/p2.py b/CP/Game of Codes/p2.py new file mode 100644 index 0000000..fb20332 --- /dev/null +++ b/CP/Game of Codes/p2.py @@ -0,0 +1,64 @@ + +import math +from fractions import gcd +from itertools import permutations +from itertools import combinations + +def readInts(): + return list(map(int, raw_input().strip().split())) +def readInt(): + return int(raw_input()) +def readIntsindex0(): + return list(map(lambda x: int(x) - 1, input().split())) +def readStrs(): + return raw_input().split() +def readStr(): + return raw_input() +def numlistTostr(list1): + return ''.join(list1) +def strlistTostr(list1): + return ''.join(str(e) for e in list1) +def strTolist(str): + return str.split() +def strlistTointlist(str): + return map(int, str) +def slicenum(number,x): + return int(str(number)[:x]) +def precise(num): + return "{0:.10f}".format(num) +def rsorted(a): + return sorted(a,reverse=True) +def binar(x): + return '{0:031b}'.format(x) +def permute(word): + perms = [''.join(p) for p in permutations(word)] + # print perms + return set(perms) + +for __ in range(readInt()): + n,k = readInts() + a = [] + for i in range(n+1): + a.append(i) + # print a + comb = combinations(a, k) + s= 0 + for i in list(comb): + # print i + if(sum(i)==n): + s+=1 + # print(i) + print 2*s + + +''' +Input: +2 +3 2 +5 2 + +Output: +4 +6 + +''' diff --git a/CP/Game of Codes/p3.py b/CP/Game of Codes/p3.py new file mode 100644 index 0000000..7410c09 --- /dev/null +++ b/CP/Game of Codes/p3.py @@ -0,0 +1,55 @@ +# Akash Kandpal +# My Domain => http://harrypotter.tech/ +from fractions import gcd +import math +from itertools import permutations + +def readInts(): + return list(map(int, raw_input().strip().split())) +def readInt(): + return int(raw_input()) +def readIntsindex0(): + return list(map(lambda x: int(x) - 1, input().split())) +def readStrs(): + return raw_input().split() +def readStr(): + return raw_input() +def numlistTostr(list1): + return ''.join(list1) +def strlistTostr(list1): + return ''.join(str(e) for e in list1) +def strTolist(str): + return str.split() +def strlistTointlist(str): + return map(int, str) +def slicenum(number,x): + return int(str(number)[:x]) +def precise(num): + return "{0:.10f}".format(num) +def rsorted(a): + return sorted(a,reverse=True) +def binar(x): + return '{0:031b}'.format(x) +def permute(word): + perms = [''.join(p) for p in permutations(word)] + # print perms + return set(perms) + +n = readInt() +a = [4,6,8] + +for i in range(4,n+1): + c= (i/2-1)*2+i/2 + if(i%2==1): + c+=1 + # print c + a.append(4*i-2*c) +# print a +print a[n-1] + + + + +''' +2 +''' diff --git a/CP/Game of Codes/p4.py b/CP/Game of Codes/p4.py new file mode 100644 index 0000000..f8e09ba --- /dev/null +++ b/CP/Game of Codes/p4.py @@ -0,0 +1,52 @@ +# Akash Kandpal +# My Domain => http://harrypotter.tech/ +from fractions import gcd +import math +from itertools import permutations + +def readInts(): + return list(map(int, raw_input().strip().split())) +def readInt(): + return int(raw_input()) +def readIntsindex0(): + return list(map(lambda x: int(x) - 1, input().split())) +def readStrs(): + return raw_input().split() +def readStr(): + return raw_input() +def numlistTostr(list1): + return ''.join(list1) +def strlistTostr(list1): + return ''.join(str(e) for e in list1) +def strTolist(str): + return str.split() +def strlistTointlist(str): + return map(int, str) +def slicenum(number,x): + return int(str(number)[:x]) +def precise(num): + return "{0:.10f}".format(num) +def rsorted(a): + return sorted(a,reverse=True) +def binar(x): + return '{0:031b}'.format(x) +def permute(word): + perms = [''.join(p) for p in permutations(word)] + # print perms + return set(perms) + +for __ in range(readInt()): + n,k = readInts() + +''' +Input: +2 +2 +1 2 +3 +1 2 3 + +Output: +33 +1332 +''' diff --git a/CP/MNM Online Programming Contest/p1.py b/CP/MNM Online Programming Contest/p1.py new file mode 100644 index 0000000..00f0c45 --- /dev/null +++ b/CP/MNM Online Programming Contest/p1.py @@ -0,0 +1,57 @@ +import math +def readInts(): + return list(map(int, raw_input().strip().split())) +def readInt(): + return int(raw_input()) +def readIntsindex0(): + return list(map(lambda x: int(x) - 1, input().split())) +def readStrs(): + return raw_input().split() +def readStr(): + return raw_input() +def slicenum(number,x): + return int(str(number)[:x]) + +for __ in range(readInt()): + n = readInt() + a,b,c = [],[],[] + for i in range(n): + num = readInt() + a.append(num) + b.append(num%10) + c.append(slicenum(num,1)) + # print(a) + # print(b) + # print(c) + co =0 + for i in range(len(a)): + if(b[i] in c): + co+=1 + # print(co) + if(co==len(a)-1): + print("The door will be opened") + else: + print("The door cannot be opened") +''' + + + +Input: +3 +3 +67 +96 +59 +3 +43 +64 +32 +2 +12 +34 + +Output: +The door will be opened +The door will be opened +The door cannot be opened +''' diff --git a/CP/MNM Online Programming Contest/p2.cpp b/CP/MNM Online Programming Contest/p2.cpp new file mode 100644 index 0000000..f1e6083 --- /dev/null +++ b/CP/MNM Online Programming Contest/p2.cpp @@ -0,0 +1,36 @@ +#include +#define ll long long +#define pb push_back +#define endl '\n' +#define pii pair +#define vi vector +#define all(a) (a).begin(),(a).end() +#define F first +#define S second +#define sz(x) (ll int)x.size() +#define hell 1000000007 +#define rep(i,a,b) for(ll int i=a;i>t; + while(t--) + { + ll n,k; + cin>>n>>k; + if(n==0||n==1||n<0) + {cout<<"0"< 2-> 3->\n +4-> 5-> 6->\n +7-> 8-> 9->\n +3 +3 +10-> 11-> 12->\n +13-> 14-> 15->\n +16-> 17-> 18->\n +2 +3 +1-> 2-> 3->\n +4-> 5-> 6->\n +4 +3 +7-> 8-> 9->\n +10-> 11-> 12->\n +13-> 14-> 15->\n +16-> 17-> 18->\n + +Output: +3 +3 +84-> 90-> 96->\n +201-> 216-> 231->\n +318-> 342-> 366->\n +The Matrix Multiplication is not possible + +Explanation +The matrix will look like +84-> 90-> 96->\n + | | | + v v v +201-> 216-> 231->\n + | | | + v v v +318-> 342-> 366->\n + | | | + v v v +\n \n \n + +''' diff --git a/CP/MNM Online Programming Contest/p4.py b/CP/MNM Online Programming Contest/p4.py new file mode 100644 index 0000000..8933c09 --- /dev/null +++ b/CP/MNM Online Programming Contest/p4.py @@ -0,0 +1,80 @@ +# Akash Kandpal +# My Domain => http://harrypotter.tech/ + +from fractions import gcd +import math +from itertools import permutations +from itertools import combinations + +def readInts(): + return list(map(int, raw_input().strip().split())) +def readInt(): + return int(raw_input()) +def readIntsindex0(): + return list(map(lambda x: int(x) - 1, input().split())) +def readStrs(): + return raw_input().split() +def readStr(): + return raw_input() +def numlistTostr(list1): + return ''.join(list1) +def strlistTostr(list1): + return ''.join(str(e) for e in list1) +def strTolist(str): + return str.split() +def strlistTointlist(str): + return map(int, str) +def slicenum(number,x): + return int(str(number)[:x]) +def numTobin(A): + s = str(bin(A))[2:] + s = '0'*(31-len(s)) + s + return s +def precise(num): + return "{0:.10f}".format(num) +def rsorted(a): + return sorted(a,reverse=True) +def permute(word): + perms = [''.join(p) for p in permutations(word)] + # print perms + return set(perms) +def combinate(word): + perms = [''.join(p) for p in combinations(word)] + # print perms + return set(perms) + + +for __ in range(readInt()): + a = readStr() + b = readStr() + a = a.lower() + n,m = len(a),len(b) + b = b.lower() + per =set() + per = permute(a) + list1 = [] + c = 0 + per =list(per) + for i in per: + if(i in b): + c+=1 + list1.append(i) + print c + list1.sort() + for i in list1: + print i + +''' +Input: +1 +Sam +msatmas +Output: +2 +mas +msa + +1 +fuck +kucfdsnsdcukfsnjaaukcfkskfucjcmfhfcckucf +''' diff --git a/CP/MNM Online Programming Contest/p5.py b/CP/MNM Online Programming Contest/p5.py new file mode 100644 index 0000000..f555358 --- /dev/null +++ b/CP/MNM Online Programming Contest/p5.py @@ -0,0 +1,40 @@ +''' +Input: +1 +16 +8 +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 + + +1 +10 +8 +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +Output: +1 3 5 7 9 11 13 16 +1 2 3 5 6 8 9 10 +''' diff --git a/CP/VK Cup 2018 - Round 1/p1.py b/CP/VK Cup 2018 - Round 1/p1.py new file mode 100644 index 0000000..e69de29 diff --git a/CP/templates/temp.cpp b/CP/templates/temp.cpp index d32b08f..9a3e449 100644 --- a/CP/templates/temp.cpp +++ b/CP/templates/temp.cpp @@ -1,47 +1,31 @@ -#include +#include +#define ll long long +#define pb push_back +#define endl '\n' +#define pii pair +#define vi vector +#define all(a) (a).begin(),(a).end() +#define F first +#define S second +#define sz(x) (ll int)x.size() +#define hell 1000000007 +#define rep(i,a,b) for(ll int i=a;i>t; - forl(t){ - int n; - cin>>n; - int arr[n]; - lli sum = 0; - fori(n){ - cin>>arr[i]; - sum+=arr[i]; - for(int j=i-1; j>-1; j--){ - int mn = min(arr[i],arr[j]); - if(mn<=(arr[i]&arr[j])) - sum+=mn; - } + while(t--) + { + ll n,k; + cin>> + } - cout< http://harrypotter.tech/ +from fractions import gcd import math +from itertools import permutations + def readInts(): return list(map(int, raw_input().strip().split())) def readInt(): @@ -9,7 +14,26 @@ def readStrs(): return raw_input().split() def readStr(): return raw_input() - +def numlistTostr(list1): + return ''.join(list1) +def strlistTostr(list1): + return ''.join(str(e) for e in list1) +def strTolist(str): + return str.split() +def strlistTointlist(str): + return map(int, str) +def slicenum(number,x): + return int(str(number)[:x]) +def precise(num): + return "{0:.10f}".format(num) +def rsorted(a): + return sorted(a,reverse=True) +def binar(x): + return '{0:031b}'.format(x) +def permute(word): + perms = [''.join(p) for p in permutations(word)] + # print perms + return set(perms) for __ in range(readInt()): - arr = readInts() + n,k = readInts()