problem_id
stringlengths
32
32
name
stringclasses
1 value
problem
stringlengths
200
14k
solutions
stringlengths
12
1.12M
test_cases
stringlengths
37
74M
difficulty
stringclasses
3 values
language
stringclasses
1 value
source
stringclasses
7 values
num_solutions
int64
12
1.12M
starter_code
stringlengths
0
956
2036f85049629d19be6138eaa838b930
UNKNOWN
The chef was busy in solving algebra, he found some interesting results, that there are many numbers which can be formed by sum of some numbers which are prime. Chef wrote those numbers in dairy. Cheffina came and saw what the chef was doing. Cheffina immediately closed chef's dairy and for testing chef's memory, she s...
["from math import sqrt\n\ndef isprime(n):\n if (n % 2 == 0 and n > 2) or n == 1: return 0\n else:\n s = int(sqrt(n)) + 1\n for i in range(3, s, 2):\n if n % i == 0:\n return 0\n return 1\n\ndef find(N, K): \n if (N < 2 * K): \n return 0\n if (K == 1): \...
{"inputs": [["2", "12 2", "11 2"]], "outputs": [["1", "0"]]}
INTERVIEW
PYTHON3
CODECHEF
2,916
84c5b7b27269be2e8797cdc7263d0895
UNKNOWN
In order to win over and get noticed by his favorite streamer Daenerys, Jon decides to donate a significant amount of money . Every donation made to Daenerys is of $at$ $least$ $1$ $beastcoin$ and is displayed on Daenerys's stream alongside any message written and is visible to every viewer. After spotting that Daenery...
["# cook your dish here\nfor _ in range(int(input(''))):\n n=int(input(''))\n x=bin(n)\n x=len(x)-2\n if n==(2**(x-1)):\n print(n)\n else:\n print(2**x)", "# cook your dish here\n\nt = int(input())\ndon = 2\nfor i in range(t):\n x = int(input())\n n = 1\n while(pow(2, n)<x):\n ...
{"inputs": [["2", "3", "7"]], "outputs": [["4", "8"]]}
INTERVIEW
PYTHON3
CODECHEF
5,993
09918fae7afe0c196572a9c245ef7f57
UNKNOWN
Given an array of n$n$ integers : A1,A2,...,An$ A_1, A_2,... , A_n$, find the longest size subsequence which satisfies the following property: The xor of adjacent integers in the subsequence must be non-decreasing. -----Input:----- - First line contains an integer n$n$, denoting the length of the array. - Second line...
["# cook your dish here\nn=int(input())\nl=[int(i) for i in input().split()]\nxors=[]\nfor i in range(n):\n for j in range(i+1,n):\n xors.append([l[i]^l[j],(i,j)])\nxors.sort()\n\n#print(xors)\nupto=[0]*n \nfor i in range(len(xors)):\n #a=xors[i][0]\n b,c=xors[i][1][0],xors[i][1][1]\n upto[c]=max(upto[c...
{"inputs": [["8", "1 200 3 0 400 4 1 7"]], "outputs": [["6"]]}
INTERVIEW
PYTHON3
CODECHEF
2,678
2663e865a1a381194d84264ba940ead8
UNKNOWN
The Siruseri Singing Championship is going to start, and Lavanya wants to figure out the outcome before the tournament even begins! Looking at past tournaments, she realizes that the judges care only about the pitches that the singers can sing in, and so she devises a method through which she can accurately predict the...
["# cook your dish here\nfrom operator import itemgetter\nt=int(input())\nfor _ in range(t):\n n=int(input())\n start=[]\n end=[]\n for i in range(n):\n first, last = map (int, input().split())\n start.append((first, i))\n end.append((last, i))\n score=[0]*n \n start.sort(key=item...
{"inputs": [["2", "3", "10 20", "13 18", "15 19", "3", "10 22", "13 21", "15 20"]], "outputs": [["4 1 1", "4 2 0"]]}
INTERVIEW
PYTHON3
CODECHEF
17,697
36a682c15eae1c92a36a37c31dc22cd3
UNKNOWN
Kira likes to play with strings very much. Moreover he likes the shape of 'W' very much. He takes a string and try to make a 'W' shape out of it such that each angular point is a '#' character and each sides has same characters. He calls them W strings. For example, the W string can be formed from "aaaaa#bb#cc#dddd" su...
["def frequency(s,n):\n f=[[0 for i in range(26)]for j in range(n+1)]\n count=0\n for i in range(n):\n if s[i]!=\"#\":\n f[count][ord(s[i])-97]+=1\n else:\n count+=1\n for j in range(26):\n f[count][j]=f[count-1][j]\n return (f,count)\n \ndef ...
{"inputs": [["3", "aaaaa#bb#cc#dddd", "acb#aab#bab#accba", "abc#dda#bb#bb#aca", "", ""]], "outputs": [["16", "10", "11"]]}
INTERVIEW
PYTHON3
CODECHEF
1,200
b70ff101d149d114488d5fc456fb4dfa
UNKNOWN
Zonal Computing Olympiad 2014, 30 Nov 2013 In IPL 2025, the amount that each player is paid varies from match to match. The match fee depends on the quality of opposition, the venue etc. The match fees for each match in the new season have been announced in advance. Each team has to enforce a mandatory rotation pol...
["# cook your dish here\nn=int(input())\nl=list(map(int,input().split()))\ntemp=[]\nfor item in l:\n temp.append(item)\nif(n<=3):\n print(sum(temp))\nelse:\n for i in range(3,n):\n temp[i]=l[i]+min(temp[i-1],temp[i-2],temp[i-3])\n res=sum(l)-min(temp[n-1],temp[n-2],temp[n-3])\n print(res)", "n=int...
{"inputs": [["5", "10 3 5 7 3"]], "outputs": [["23", "("]]}
INTERVIEW
PYTHON3
CODECHEF
12,784
63725c1014c3303e2f73cb847af89427
UNKNOWN
Zombies zombies everywhere!! In a parallel world of zombies, there are N zombies. There are infinite number of unused cars, each of same model only differentiated by the their colors. The cars are of K colors. A zombie parent can give birth to any number of zombie-children (possibly zero), i.e. each zombie will have ...
["ways=x=0\nval=10**9\nremi=((10**9)+7)\nt=int(input())\nfor i in range(t):\n n,k=list(map(int,input().split()))\n if t<=100 and n>=1 and k<=val:\n x=(k-1)**(n-1)\n ways=k*x\n ways=ways%remi\n print(ways)\n x=ways=0\n else:\n break", "test = int(input())\nfor i in range (1,test+1):\n a = input().split(\" \")\n n ...
{"inputs": [["2", "2 2", "3 3"]], "outputs": [["2", "12"]]}
INTERVIEW
PYTHON3
CODECHEF
5,243
25a94d763db068ff920047c0f847b341
UNKNOWN
The Chef has a huge square napkin of size 2n X 2n. He folds the napkin n-3 times. Each time he folds its bottom side over its top side, and then its right side over its left side. After each fold, the side length of the napkin is reduced by half. The Chef continues folding until there remains a 8x8 sheet, lying flat on...
["import sys\nt = int(sys.stdin.readline())\n\ndef identify(x, y):\n rows[x][y] = '2'\n\n r = 0\n if x == 0:\n r |= 1\n elif rows[x-1][y] == '1':\n r |= identify(x-1, y)\n if x == 7:\n r |= 4\n elif rows[x+1][y] == '1':\n r |= identify(x+1, y)\n if y == 0:\n r |= ...
{"inputs": [["3", "3", "01000010", "11000001", "00000000", "00011000", "00011000", "00010100", "00001000", "00000000", "4", "01000010", "11000001", "00000000", "00011000", "00011000", "00010100", "00001000", "00000000", "1000000000", "11111111", "11111111", "11111111", "11111111", "11111111", "11111111", "11111111", "1...
INTERVIEW
PYTHON3
CODECHEF
1,899
4b1c26b83a2b85ef5abf58a25a6477e0
UNKNOWN
Alice and Bob created $N$ and $M$ recipes, respectively ($N, M \ge 1$), and submitted them to Chef for evaluation. Each recipe is represented by a string containing only lowercase English letters. Let's denote Alice's recipes by $A_1, A_2, \ldots, A_N$ and Bob's recipes by $B_1, B_2, \ldots, B_M$. Accidentally, Chef mi...
["# v = [\"a\",\"e\",\"i\",\"o\",\"u\"]\n# for _ in range(int(input())):\n# n = int(input())\n# a,b = [],[]\n# for i in range(n):\n# s = input()\n# isa = True\n# for j in range(1,len(s) - 1):\n# if(s[j] in v):\n# if(s[j - 1] not in v and s[j + 1] not in v):\n# ...
{"inputs": [["2", "4", "aba", "abc", "bab", "aac", "3", "aba", "baab", "abc"]], "outputs": [["1.1250000", "0.0277778"]]}
INTERVIEW
PYTHON3
CODECHEF
33,211
61cdabf0052749c72364778c7c1b58b2
UNKNOWN
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market. She purchases the string A and tries to convert it to string B by...
["for j in range(int(input())):\n a=input()\n b=input()\n c,d=0,0\n a0=a.count(\"0\")\n a1=a.count(\"1\")\n if(a0==len(a) or a1==len(a)):\n print(\"Unlucky Chef\")\n else:\n print(\"Lucky Chef\")\n for i in range(len(a)):\n if(a[i]!=b[i]):\n if(a[i]==\"0\"):\n c+=1\n else:\n d+=1\n print(max(c,d))",...
{"inputs": [["2", "101", "010", "1111", "1010"]], "outputs": [["Lucky Chef", "2", "Unlucky Chef"]]}
INTERVIEW
PYTHON3
CODECHEF
956
818e3415943b5cad81c8137a408f47c2
UNKNOWN
You are Dastan, the great Prince of Persia! After searching long for the mysterious 'Sands of Time', you have finally arrived at the gates of the city that hosts the ancient temple of the gods. However, the gate is locked and it can only be opened with a secret code, which you need to obtain by solving the following pu...
["t=int(input())\nfor i in range(t):\n n,k=[int(i) for i in input().split()]\n l=input().split()\n for i in range(k):\n if l.pop()=='H':\n for ind,j in enumerate(l):\n if j=='H':\n l[ind]='T'\n else:\n l[ind]='H'\n print(sum([1 for i in l if i=='H']))", "for i in range(int(input())):\n n,k=[int(i) for ...
{"inputs": [["3", "5 3", "H T T H T", "7 4", "H H T T T H H", "6 1", "T H T H T T"]], "outputs": [["1", "2", "2"]]}
INTERVIEW
PYTHON3
CODECHEF
8,355
c5452166adf3de7724a49864048c8150
UNKNOWN
During Quarantine Time Chef is at home and he was quite confused about what to cook so, he went to his son and asked about what would he prefer to have? He replied, cakes. Now, chef cook $N$ number of cake and number of layers for every cake is different. After cakes are baked, Chef arranged them in a particular order ...
["#cook your recipe\nfrom math import factorial\ntest_cases = int(input())\nfor _ in range(test_cases):\n n = int(input())\n sum1 = 0\n final_sum = 0\n num = list(map(int, input().split()))\n rep_time = factorial(n - 1)\n rep_count = dict()\n for i in num:\n if i in rep_count:\n rep_count[i] ...
{"inputs": [["1", "3", "2 3 5"]], "outputs": [["2220"]]}
INTERVIEW
PYTHON3
CODECHEF
12,908
246400b31c5dfd8a2346b0d3ae57b0b7
UNKNOWN
The chef is trying to solve some pattern problems, Chef wants your help to code it. Chef has one number K to form a new pattern. Help the chef to code this pattern problem. -----Input:----- - First-line will contain $T$, the number of test cases. Then the test cases follow. - Each test case contains a single line of ...
["t = int(input())\nfor _ in range(t):\n n = int(input())\n for i in range(n):\n for j in range(n):\n if i>=j:\n print(int((i+1)*(i+2)/2)-j,end='')\n print()\n", "# cook your dish here\nt=int(input())\nfor i in range(0,t):\n n = int(input().strip())\n val=1\n for x...
{"inputs": [["5", "1", "2", "3", "4", "5"]], "outputs": [["1", "1", "32", "1", "32", "654", "1", "32", "654", "10987", "1", "32", "654", "10987", "1514131211"]]}
INTERVIEW
PYTHON3
CODECHEF
6,322
4f01007f5faa4912ee34b18dcfc75e23
UNKNOWN
Bobby has decided to hunt some Parrots. There are n horizontal branch of trees aligned parallel to each other. Branches are numbered 1 to n from top to bottom. On each branch there are some parrots sitting next to each other. Supposed there are a[i]$a[i]$ parrots sitting on the i−th$ i-th$ branch. Sometimes Bobby sho...
["n = int(input())\nx = [int(i) for i in input().split()]\nm = int(input())\nfor i in range(m):\n a,b = map(int,input().split())\n a -= 1\n t = b-1\n t1 = x[a]-b\n if a-1>=0:\n x[a-1] += t\n if a+1<n:\n x[a+1] += t1\n x[a] = 0\nfor i in x:\n print(i)", "# cook your dish here\nN = i...
{"inputs": [["5", "10 10 10 10 10", "5", "2 5", "3 13", "2 12", "1 13", "4 6", "3", "2 4 1", "1", "2 2"]], "outputs": [["0", "12", "5", "0", "16", "3", "0", "3"]]}
INTERVIEW
PYTHON3
CODECHEF
6,393
77df9e8b1c1d6015b2f6d0f822ff932b
UNKNOWN
As you know America’s Presidential Elections are about to take place and the most popular leader of the Republican party Donald Trump is famous for throwing allegations against anyone he meets. He goes to a rally and meets n people which he wants to offend. For each person i he can choose an integer between 1 to max[i...
["for t in range(int(input())):\n n = int(input())\n a = sorted(map(int,input().split()))\n ans = 1\n for i in range(n):\n ans *= (a[i]-i)\n ans %= (10**9+7)\n if (ans == 0):\n break\n print(ans) ", "t = eval(input())\n\nfor i in range(t):\n n=eval(input())\n a = list(map(int, input().split()))\n a.sort()\n \n cnt...
{"inputs": [["3", "1", "4", "2", "10 5", "4", "2 3 1 3"]], "outputs": [["4", "45", "0"]]}
INTERVIEW
PYTHON3
CODECHEF
432
d379234fb081e9fcba116578845e895c
UNKNOWN
You are given a weighted graph with $N$ nodes and $M$ edges. Some of the nodes are marked as special nodes. Your task is to find the shortest pairwise distance between any two different special nodes. -----Input----- - The first line of the input contains three space-separated integers $N$, $M$ and $K$ denoting the nu...
["n,m,lk = list(map(int,input().split()))\nsp = [int(i)-1 for i in input().split()]\ndp = []\nfor i in range(n):\n dp += [[0]*n]\nfor i in range(n):\n for j in range(n):\n if(i!=j):\n dp[i][j]=10**18\nfor _ in range(m):\n x,y,z = list(map(int,input().split()))\n dp[x-1][y-1]=z\n dp[y-1][x-1]=z\nfor k in range(n):\n ...
{"inputs": [["5 5 3", "1 3 5", "1 2 3", "2 3 4", "3 4 1", "4 5 8", "1 5 19"]], "outputs": [["7"]]}
INTERVIEW
PYTHON3
CODECHEF
544
d416c73369528c475cda55e79c7288dd
UNKNOWN
Sereja has two integers — A and B — in 7-ary system. He wants to calculate the number C, such that B * C = A. It is guaranteed that B is a divisor of A. Please, help Sereja calculate the number C modulo 7L. -----Input----- First line of input contains an integer T — the number of test cases. T tests follow. For eac...
["t=int(input())\nwhile t>0 :\n\ta=int(input())\n\tb=int(input())\n\tl=int(input())\n\tx=0\n\ty=0\n\tz=0\n\ta1=0\n\tb1=0\n\tc1=0\n\twhile(a//10!=0 or a%10!=0):\n\t\ta1+=(a%10+((a//10)%10)*7+((a//100)%10)*49+((a//1000)%10)*343+((a//10000)%10)*2401+((a//100000)%10)*16807+((a//1000000)%10)*117649+((a//10000000)%10)*823543...
{"inputs": [["3", "21", "5", "10", "202", "13", "1", "202", "13", "2"]], "outputs": [["3", "3", "13"]]}
INTERVIEW
PYTHON3
CODECHEF
1,047
18ca12f678554ef1cf6988b23cfb65ba
UNKNOWN
There are $N$ villages numbered $1$ to $N$. The villages are connected through bi-directional paths in between them. The whole network is in the form of a tree. Each village has only $1$ fighter but they help each other in times of crisis by sending their fighter to the village in danger through paths along the villag...
["# cook your dish here\ndef solve(edges,ans):\n n = len(edges)\n visited = set()\n parents = [-1]*(n+1)\n dp = [0]*(n+1)\n stack = [1]\n w = float('inf')\n x = -1\n while stack:\n node = stack[-1]\n if node not in visited:\n count = 0\n for kid in edges[node]:\n if parents[kid] == -1:\n if kid != 1:\n ...
{"inputs": [["2", "5", "1 2", "1 3", "2 4", "3 5", "3", "1 2", "2 3"]], "outputs": [["1 2", "2 1"]]}
INTERVIEW
PYTHON3
CODECHEF
1,206
42d3161157a376b336634c6338fecf30
UNKNOWN
Istiak is learning about arithmetic progressions. Today, he wrote an arithmetic sequence on a piece of paper. Istiak was very happy that he managed to write an arithmetic sequence and went out for lunch. Istiak's friend Rafsan likes to irritate him by playing silly pranks on him. This time, he could have chosen one ele...
["# cook your dish here\ntest_cases = int(input())\nfor i in range(test_cases):\n no_of_elements = int(input())\n sequence = list(map(int, input().split()))\n d1 = sequence[1] - sequence[0]\n d2 = sequence[2] - sequence[1]\n d3 = (sequence[3] - sequence[0])/3\n d4 = (sequence[3] - sequence[1])/2\n d5 = (sequence[2] - s...
{"inputs": [["3", "4", "1 3 10 7", "5", "-10 -5 0 5 10", "4", "2 2 2 10"]], "outputs": [["1 3 5 7", "-10 -5 0 5 10", "2 2 2 2"]]}
INTERVIEW
PYTHON3
CODECHEF
9,405
fbea1792cfce7e7351bb0a1b25a25457
UNKNOWN
Prime numbers are arranged in a ordered list U$U$, in increasing order. Let S$S$ be a sublist of U$U$ with a unique property that for every element A$A$ belonging to list S$S$, if i$i$ denotes the index of A$A$ in list U$U$, than i$i$ also belongs to list U$U$. Given N$N$, find sum of first N$N$ elements of list S$S$, ...
["import math\r\ndef prime(aa):\r\n\tf=0\r\n\tfor y in ar:\r\n\t\tif aa%y==0:\r\n\t\t\t\treturn 0\r\n\treturn 1\r\nar=[]\r\nar.append(2)\r\npc=3\r\nte=int(input())\r\nfor _ in range(te):\r\n\ta=int(input())\r\n\tf=0\r\n\tc=0\r\n\tadd=0\r\n\tfor x in ar:\r\n\t\ttry:\r\n\t\t\tadd=add+ar[x-1]\r\n\t\texcept:\r\n\t\t\twhile...
{"inputs": [["2", "1", "2"]], "outputs": [["3", "8"]]}
INTERVIEW
PYTHON3
CODECHEF
84,042
9c269de3866fb4b3ddc5fc4cdbd34d83
UNKNOWN
Two integers A and B are the inputs. Write a program to find GCD and LCM of A and B. -----Input----- The first line contains an integer T, total number of testcases. Then follow T lines, each line contains an integer A and B. -----Output----- Display the GCD and LCM of A and B separated by space respectively. The a...
["# cook your dish here\ndef GCD(x, y): \n while y: \n x, y = y, x % y \n return x \n\ndef LCM(x, y):\n lcm = (x*y)//GCD(x,y)\n return lcm\n\nt = int(input())\nwhile t>0:\n x,y = list(map(int,input().split()))\n print(GCD(x,y),LCM(x,y)) \n t -=1\n", "import math\ntc = int(input())\nfor i in range...
{"inputs": [["3", "120 140", "10213 312", "10 30"]], "outputs": [["20 840", "1 3186456", "10 30"]]}
INTERVIEW
PYTHON3
CODECHEF
3,609
637cf36f95f5ce9d81ffcba390a3af2b
UNKNOWN
Soma is a fashionable girl. She absolutely loves shiny stones that she can put on as jewellery accessories. She has been collecting stones since her childhood - now she has become really good with identifying which ones are fake and which ones are not. Her King requested for her help in mining precious stones, so she ...
["n = int(input())\nfor i in range(n):\n count = 0\n k = input()\n x = list(k)\n kk = input()\n y = list(kk)\n for j in y:\n for jj in x:\n if(j==jj):\n count = count+1\n break\n print(count)", "for _t in range(int(input())):\n J = set(list(input().strip()))\n print(sum(1 for x in input() if x in J))", "T=int(...
{"inputs": [["4", "abc", "abcdef", "aA", "abAZ", "aaa", "a", "what", "none"]], "outputs": [["3", "2", "1", "0"]]}
INTERVIEW
PYTHON3
CODECHEF
5,685
e9c1eec384e8f86df71b9546dee64bbd
UNKNOWN
There are total N friends went to Chef's Pizza shop. There they bought a pizza. Chef divided the pizza into K equal slices. Now you have to check whether these K pizza slices can be distributed equally among the friends. Also given that every person should get at least one slice. If the above conditions are possible th...
["for _ in range(int(input())):\n n = int(input())\n k = int(input())\n if k%n==0:\n print(\"YES\")\n else:\n print(\"NO\")\n", "for i in range(int(input())):\n n=int(input())\n k=int(input())\n if k%n==0 and k>=n:\n print(\"YES\")\n else:\n print(\"NO\")", "# cook yo...
{"inputs": [["2", "10", "20", "12", "5"]], "outputs": [["YES", "NO"]]}
INTERVIEW
PYTHON3
CODECHEF
3,877
3e33c78c28918c5903ef20e51163e69f
UNKNOWN
Tennis is a popular game. Consider a simplified view of a tennis game from directly above. The game will appear to be played on a 2 dimensional rectangle, where each player has his own court, a half of the rectangle. Consider the players and the ball to be points moving on this 2D plane. The ball can be assumed to alwa...
["eps=1e-8\nt=int(input())\nfor ii in range(t):\n n=int(input())\n l=[int(i) for i in input().split() ]\n b=[int(i) for i in input().split() ]\n v=[int(i) for i in input().split() ]\n c=[int(i) for i in input().split() ]\n greatest_time=l[0]/v[0]\n for i in range(1,n):\n if v[i]>0:\n ...
{"inputs": [["2", "2", "3 4", "0 2", "2 -2", "2 2", "3", "10 10 10", "0 0 0", "1 1 1", "5 5 5"]], "outputs": [["2.0000", "0.0000"]]}
INTERVIEW
PYTHON3
CODECHEF
11,065
10f6d17abe6ab53993662bb6f0ad3c9e
UNKNOWN
Every character in the string “IITMANDI” is given a certain number of points. You are given a scrabble board with only one row. The input contains the positions of score modifiers such as: Double Letter, Triple Letter, Double Word and Triple Word. You need to find the best position to place the string “IITMANDI” such t...
["# cook your dish here\ntry:\n \n T = int(input())\n\n for i in range(T):\n n = int(input())\n s = input()\n arr = [int(i) for i in input().strip().split(\" \")]\n res = 1\n result = 0\n\n for j in range(n-7):\n res = 1\n res1= 0\n s1 = s[j:j+8]\n for i in range(8):\n if s1[i] == 'D':\n res = res*...
{"inputs": [["2", "10", "..d.t.D..d", "10 11 12 9 8 10 11 15", "22", "dtDtTD..ddT.TtTdDT..TD", "12297 5077 28888 17998 12125 27400 31219 21536"]], "outputs": [["270", "35629632"]]}
INTERVIEW
PYTHON3
CODECHEF
17,980
7057ca7a6c161f8ccc9f557dd4e05bf7
UNKNOWN
Let X be the set of all integers between 0 and n-1. Suppose we have a collection S1, S2, ..., Sm of subsets of X. Say an atom A is a subset of X such that for each Si we have either A is a subset of Si or A and Si do not have any common elements. Your task is to find a collection A1, ..., Ak of atoms such that every i...
["# cook your dish here\n# cook your dish here\nfor _ in range(int(input())):\n n,m=list(map(int,input().split()))\n atomlist = ['']*n\n for k in range(m):\n s=[]\n s.extend(input().split()[1:])\n #print(s)\n for w in range(n):\n if str(w) in s:\n atomlist[w]+=\"1\"\n else:\n atomlist[w]+=\"0\"\n #print(...
{"inputs": [["2", "5 2", "3 0 1 2", "3 2 3 4", "4 3", "2 0 1", "2 1 2", "2 2 3"]], "outputs": [["3", "4"]]}
INTERVIEW
PYTHON3
CODECHEF
1,060
8229dcfb342dc10213890020ef8cc5bf
UNKNOWN
The chef is trying to solve some pattern problems, Chef wants your help to code it. Chef has one number K to form a new pattern. Help the chef to code this pattern problem. -----Input:----- - First-line will contain $T$, the number of test cases. Then the test cases follow. - Each test case contains a single line of ...
["# cook your dish here\ndef solve():\n n=int(input())\n i=0\n while i<n-1:\n if i==0:\n print(\"*\",end=\"\")\n else:\n print(\"*\",end=\"\")\n for k in range(i-1):\n print(\" \",end=\"\")\n print(\"*\",end=\"\")\n print() \n ...
{"inputs": [["5", "1", "2", "3", "4", "5"]], "outputs": [["*", "*", "**", "*", "**", "***", "*", "**", "* *", "****", "*", "**", "* *", "* *", "*****"]]}
INTERVIEW
PYTHON3
CODECHEF
6,961
b5310be8ff0189c7e1d47d0a6709e52d
UNKNOWN
The Quark Codejam's number QC(n, m) represents the number of ways to partition a set of n things into m nonempty subsets. For example, there are seven ways to split a four-element set into two parts: {1, 2, 3} ∪ {4}, {1, 2, 4} ∪ {3}, {1, 3, 4} ∪ {2}, {2, 3, 4} ∪ {1}, {1, 2} ∪ {3, 4}, {1, 3} ∪ {2, 4}, {1, 4} ∪ {2, 3}....
["for i in range(eval(input())):\n n,k=input().strip().split()\n n=int(n)\n k=int(k)\n print(int( ((n-k)&(int((k-1)/2)))==0))"]
{"inputs": [["1", "4 2"]], "outputs": [["1"]]}
INTERVIEW
PYTHON3
CODECHEF
127
2f1df25d7c2b5441edc1f4436ebbb497
UNKNOWN
Chef loves triangles. But the chef is poor at maths. Given three random lengths Chef wants to find if the three sides form a right-angled triangle or not. Can you help Chef in this endeavour? -----Input:----- - First-line will contain $T$, the number of test cases. Then the test cases follow. - Each test case contain...
["# cook your dish here\ndef check(a,b,c):\n if (a==0) or (b==0) or (c==0):\n return \"NO\"\n else:\n i=3\n while(i>0):\n if (a*a)==(b*b)+(c*c):\n return \"YES\"\n else:\n t=a\n a=b\n b=c\n c=t\n ...
{"inputs": [["2", "3 4 5", "1 3 4"]], "outputs": [["YES", "NO"]]}
INTERVIEW
PYTHON3
CODECHEF
9,479
30d43220824883612b45d9b31a6d5783
UNKNOWN
Increasing COVID cases have created panic amongst the people of Chefland, so the government is starting to push for production of a vaccine. It has to report to the media about the exact date when vaccines will be available. There are two companies which are producing vaccines for COVID. Company A starts producing vacc...
["# cook your dish here\ntry:\n d1,v1,d2,v2,p=map(int, input().split())\n total=0\n while p>0:\n total+=1\n if total>=d1:\n p=p-v1\n if total>=d2:\n p=p-v2\n print(total) \nexcept:\n pass", "d1,v1,d2,v2,p=list(map(int,input().split()))\ncheck=0\nif d1==d2:\n check=1\n start=d1-1\n v0=(v1+v2)\n if p%v0==0:\n pri...
{"inputs": [["1 2 1 3 14"]], "outputs": [["3"]]}
INTERVIEW
PYTHON3
CODECHEF
7,965
41b06164f004e63b4e1fb31736883351
UNKNOWN
“Jesse, you asked me if I was in the meth business, or the money business… Neither. I’m in the empire business.” Walter’s sold his stack in Gray Matter Technologies, a company which he deserved half a credit, for peanuts. Now this company is worth a billion dollar company. Walter wants to get it's shares to have his Em...
["# cook your dish here\nT=int(input())\nfor _ in range(T):\n n=int(input())\n arr=list(map(int,input().split()))\n left=[-1 for i in range(n)]\n right=[-1 for i in range(n)]\n min1=float(\"inf\")\n for i in range(n):\n min1=min(arr[i],min1+1)\n left[i]=min1\n min1=float(\"inf\")\n for i in range(n-1,-1,-1):\n min1=...
{"inputs": [["2", "5", "6 5 5 5 2", "5", "1 2 3 4 5"]], "outputs": [["6 5 4 3 2", "1 2 3 4 5"]]}
INTERVIEW
PYTHON3
CODECHEF
8,299
313a01dcc6fcf4ea9a92213b42749c9c
UNKNOWN
The chef is trying to solve some pattern problems, Chef wants your help to code it. Chef has one number K to form new pattern. Help the chef to code this pattern problem. -----Input:----- - First line will contain $T$, number of testcases. Then the testcases follow. - Each testcase contains of a single line of input,...
["# cook your dish here\nimport copy\nfor _ in range(int(input())):\n k=int(input())\n c=[]\n d=[]\n start=0\n\n while True:\n c=[]\n for i in range(start):\n c.append(\" \")\n for i in range(start,k+1):\n c.append(str(i))\n start+=1\n d.append(c)\...
{"inputs": [["2", "2", "4"]], "outputs": [["2", "12", "012", "12", "2", "4", "34", "234", "1234", "01234", "1234", "234", "34", "4"]]}
INTERVIEW
PYTHON3
CODECHEF
2,324
546ddda11baf23fe3c14eec5ea108741
UNKNOWN
The Fibonacci sequence is defined as F(n) = F(n-1) + F(n-2). You have developed two sequences of numbers. The first sequence that uses the bitwise XOR operation instead of the addition method is called the Xoronacci number. It is described as follows: X(n) = X(n-1) XOR X(n-2) The second sequence that uses the bitwise X...
["# Python3 program to find XNOR\n# of two numbers\nimport math\n\n\ndef swap(a, b):\n temp = a\n a = b\n b = temp\n\n\n# log(n) solution\ndef xnor(a, b):\n # Make sure a is larger\n if (a < b):\n swap(a, b)\n\n if (a == 0 and b == 0):\n return 1;\n\n # for last bit of a\n a_rem = 0\n\n # for last bit of b\n b_rem = ...
{"inputs": [["1", "3 4 2"]], "outputs": [["4"]]}
INTERVIEW
PYTHON3
CODECHEF
19,547
f890432666ed981c078c7cb07b9ebaa4
UNKNOWN
"I don't have any fancy quotes." - vijju123 Chef was reading some quotes by great people. Now, he is interested in classifying all the fancy quotes he knows. He thinks that all fancy quotes which contain the word "not" are Real Fancy; quotes that do not contain it are regularly fancy. You are given some quotes. For eac...
["# cook your dish here\nimport re\nt=int(input())\nwhile(t>0):\n s=list(input().split(' '))\n if(\"not\" in s):\n print(\"Real Fancy\")\n else:\n print(\"regularly fancy\")\n t=t-1", "for _ in range(int(input())):\n s = input()\n l = s.split()\n if \"not\" in l:\n print(\"Real Fancy\")\n else:\n print(\"regularly ...
{"inputs": [["2", "i do not have any fancy quotes", "when nothing goes right go left"]], "outputs": [["Real Fancy", "regularly fancy"]]}
INTERVIEW
PYTHON3
CODECHEF
4,287
df479829b30185f993b32d3741c6a056
UNKNOWN
Chef has two piles of stones with him, one has n1 stones and the other has n2 stones. Fired up by boredom, he invented a game with the two piles. Before the start of the game Chef chooses an integer m. In the j-th move: - He chooses a number xj such that 1 ≤ xj ≤ m, and removes xj stones from both the piles (this ...
["import sys\n\nn = int(sys.stdin.readline())\n\nfor _ in range(n):\n p1, p2, m = list(map(int, sys.stdin.readline().split()))\n\n l = min(p1, p2)\n\n #while(m > 0 and l > 0):\n # k = min(l, m)\n # l -= k\n # m -= 1\n\n q = min(p1, p2)\n d = min((m * (m + 1)) / 2, q)\n\n print(p1 - d + p2 - d)", "import sys\n\...
{"inputs": [["3", "1 1 1", "1 2 1", "4 5 2"]], "outputs": [["0", "1", "3"]]}
INTERVIEW
PYTHON3
CODECHEF
4,841
e120f66b74abff50e1f3113828017066
UNKNOWN
The GoC Timber Mafia is notorious for its deforestation activities in the forests near Siruseri. These activities have increased multifold after the death of the bandit who used to lord over these jungles. Having lost the battle to prevent the Mafia from illegally felling the teak trees in this forest, the government ...
["# cook your dish here\nfrom sys import stdin\nn, m = map(int,stdin.readline().split())\nforest=[]\nmatrix=[]\nfor _ in range(n):\n forest.append(list(map(int,stdin.readline().split())))\n matrix.append([0]*m)\nmatrix[0][0]=forest[0][0]\nfor j in range(1,m):\n matrix[0][j]=matrix[0][j-1]+forest[0][j]\nfor i in range(1...
{"inputs": [["4 4", "3 4 15 23", "14 20 12 9", "3 8 12 15", "12 20 7 5", "2", "2 2 3 4", "4 2 4 2"]], "outputs": [["76", "20"]]}
INTERVIEW
PYTHON3
CODECHEF
7,938
bcc961e438853a11c635128f87771ab1
UNKNOWN
Meliodas and Ban are fighting over chocolates. Meliodas has $X$ chocolates, while Ban has $Y$. Whoever has lesser number of chocolates eats as many chocolates as he has from the other's collection. This eatfest war continues till either they have the same number of chocolates, or atleast one of them is left with no cho...
["from math import *\nt=int(input())\nfor i in range(t):\n m,b=input().split()\n m=int(m)\n b=int(b)\n print(2*gcd(m,b))", "from math import*\nn=int(input())\nfor i in range(n):\n b,m=input().split()\n b=int(b)\n m=int(m)\n print(2*gcd(b,m))", "from math import*\nfor i in range(int(input())):\n m,b=input().split()\n m=...
{"inputs": [["3", "5 3", "10 10", "4 8"]], "outputs": [["2", "20", "8"]]}
INTERVIEW
PYTHON3
CODECHEF
4,065
da1d436a5884a6b7ef7a1cde55ae9e54
UNKNOWN
Chef is interested to solve series problems. Chef wants to solve a series problem but he can't solve it till now.Can you help Chef to solve the series problem? - In series problem, the series goes as follows 1,9,31,73,141 . . . . . . . . Your task is to find the Nth term of series. For larger value of $N$ answer beco...
["# cook your dish here\ntry:\n for t in range(int(input())):\n n=int(input())\n ans=n*n*n+((n-1)**2)\n if ans<=10**9+7:\n print(ans)\n else:\n print(ans)%(10**9+7)\nexcept:\n pass", "t=int(input())\nfor i in range(t):\n n=int(input())\n s=(n**3)+((n-1)**2)\n print(s%1000000007)\n", "# cook your dish here\nseri...
{"inputs": [["2", "8", "10"]], "outputs": [["561", "1081"]]}
INTERVIEW
PYTHON3
CODECHEF
3,914
458b2f38cace3d0ab2bd547bff582ec7
UNKNOWN
The chef is trying to decode some pattern problems, Chef wants your help to code it. Chef has one number K to form a new pattern. Help the chef to code this pattern problem. -----Input:----- - First-line will contain $T$, the number of test cases. Then the test cases follow. - Each test case contains a single line of...
["for _ in range(int(input())):\n\tn = int(input())\n\tnum = \"\"\n\tval = 1\n\tfor i in range(n):\n\t\tnum += str(val)\n\t\tif val == 1:\n\t\t\tval = 0\n\t\telse:\n\t\t\tval = 1\n\tfor i in range(n):\n\t\tprint(num)\n\t\t\n\t\n", "for _ in range(int(input())):\n\tn = int(input())\n\tnum = \"\"\n\tval = 1\n\tfor i in r...
{"inputs": [["4", "1", "2", "3", "4"]], "outputs": [["1", "10", "10", "101", "101", "101", "1010", "1010", "1010", "1010"]]}
INTERVIEW
PYTHON3
CODECHEF
6,604
bc569ff7e072a3a568a28c9ad91cc436
UNKNOWN
Chef usually likes to play cricket, but now, he is bored of playing it too much, so he is trying new games with strings. Chef's friend Dustin gave him binary strings $S$ and $R$, each with length $N$, and told him to make them identical. However, unlike Dustin, Chef does not have any superpower and Dustin lets Chef per...
["for _ in range(int(input())):\n length = int(input())\n S = input()\n R = input()\n if S.count(\"1\") == R.count(\"1\"):\n print(\"YES\")\n else:\n print(\"NO\")", "# cook your dish here\nfor _ in range(int(input())):\n n=int(input())\n s=input()\n r=input()\n c=0\n c1=0\n for j in s:\n if j=='1':\n c+=1\n for k...
{"inputs": [["2", "5", "11000", "01001", "3", "110", "001"]], "outputs": [["YES", "NO"]]}
INTERVIEW
PYTHON3
CODECHEF
5,962
56cb9043f489cf291415c6c1a5be571e
UNKNOWN
Anas is playing an amazing game on a grid with $N$ rows and $M$ columns. The rows are numbered $1$ through $N$ from top to bottom and the columns are numbered $1$ through $M$ from left to right. Anas wants to destroy this grid. To do that, he wants to send two heroes from the top left cell to the bottom right cell: - T...
["\"\"\"\nCode chef problem DESTCELL, Destroy Cells\n\"\"\"\n\n\ndef find_destroyed_cells(cell_advance, n, m, k):\n row = 1\n col = 1\n destroyed_cells = {(1, 1)}\n while True:\n row, col = cell_advance(row, col, n, m, k)\n if row <= n and col <= m:\n destroyed_cells.add((row, col))\n else:\n break\n return dest...
{"inputs": [["1", "2 3"]], "outputs": [["6 4 3 3 2 1"]]}
INTERVIEW
PYTHON3
CODECHEF
10,302
d19b4b7a25cc7b9723ec586f9d8e628e
UNKNOWN
Scheme? - Too loudly said. Just a new idea. Now Chef is expanding his business. He wants to make some new restaurants in the big city of Lviv. To make his business competitive he should interest customers. Now he knows how. But don't tell anyone - it is a secret plan. Chef knows four national Ukrainian dishes - salo, ...
["r = 1000000007\nt = int(input())\nfor i in range(t):\n n = int(input())\n print(pow(3,n,r) + pow(-1,n)*3)\n \n", "import sys\n\nL = 10**9 + 7\n\ndef mat_mult(lst1,lst2,r,c,m):\n res = [[0]*m for i in range(r)]\n for i in range(r):\n for j in range(m):\n res[i][j] = 0\n for k in range(c):\n res[i][j] = (res[i]...
{"inputs": [["3", "2", "3", "5"]], "outputs": [["12", "24", "240"]]}
INTERVIEW
PYTHON3
CODECHEF
4,267
ee46f4f9671c017940001aeb6873a277
UNKNOWN
Chef has an array A consisting of N integers. He also has an intger K. Chef wants you to find out number of different arrays he can obtain from array A by applying the following operation exactly K times. - Pick some element in the array and multiply it by -1 As answer could be quite large, print it modulo 109 + 7. ...
["fact = []\nfact.append(1)\nfor i in range(1,100001):\n fact.append((i*fact[i-1])%1000000007)\n \ndef power(a,b,p):\n x=1\n y=a\n while(b>0):\n if(b%2 == 1):\n x=(x*y)\n if(x>p):\n x=x%p\n y=(y*y)\n if(y>p):\n y=y%p\n b=b/2\n \n return x\n \ndef inverse(N,p):\n return power(N,p-2,p)\n \ndef combination(N,...
{"inputs": [["3", "1 3", "100", "3 1", "1 2 1", "3 2", "1 2 1"]], "outputs": [["1", "3", "4"]]}
INTERVIEW
PYTHON3
CODECHEF
11,054
b800aad7ec9910a761aaeb491c27bc61
UNKNOWN
Chef Tobby asked Bhuvan to brush up his knowledge of statistics for a test. While studying some distributions, Bhuvan learns the fact that for symmetric distributions, the mean and the median are always the same. Chef Tobby asks Bhuvan out for a game and tells him that it will utilize his new found knowledge. He lays o...
["x=int(input())\nfor a in range(x):\n n=int(input())\n L=[str(n)]\n c=1\n while(len(L)!=n):\n L.append(str(n+c))\n if len(L)==n:\n break\n L.append(str(n-c))\n\n c+=1\n\n a=\" \".join(L)\n\n print(a)\n", "t = int(input())\nfor it in range(t):\n n = int(input())\n if n == 1:\n print(1, end=' ')\n elif n%2 == 0:\...
{"inputs": [["3", "1", "2", "3"]], "outputs": [["1", "1 2", "1 2 3"]]}
INTERVIEW
PYTHON3
CODECHEF
1,099
9c623e6d1bb332cce9147d7514b06bf1
UNKNOWN
"I'm a fan of anything that tries to replace actual human contact." - Sheldon. After years of hard work, Sheldon was finally able to develop a formula which would diminish the real human contact. He found k$k$ integers n1,n2...nk$n_1,n_2...n_k$ . Also he found that if he could minimize the value of m$m$ such that ∑k...
["t = int(input())\n\ndef conv(n):\n k = bin(n)\n k = k[2:]\n z = len(k)\n c = '1'*z\n if c == k:\n return False\n\ndef find(n):\n\n x = bin(n)[2:]\n str = ''\n for i in x[::-1]:\n if i == '0':\n str+='1'\n break\n else:\n str+='0'\n\n return int(str[::-1],2)\n\nfor...
{"inputs": [["1", "1", "5"]], "outputs": [["2"]]}
INTERVIEW
PYTHON3
CODECHEF
361
0a564f2b55389fbcb62c9b32bc8eb482
UNKNOWN
A reversed arabic no is one whose digits have been written in the reversed order. However in this any trailing zeroes are omitted. The task at hand here is a simple one. You need to add two numbers which have been written in reversed arabic and return the output back in reversed arabic form, assuming no zeroes were los...
["n = int(input())\nfor index in range(0, n):\n a, b = list(map(str, input().split()))\n a = int(a[::-1])\n b = int(b[::-1])\n a = str(a + b)\n a = int(a[::-1])\n print(a)", "for _ in range(int(input())):\n n,m=input().split()\n n=int(n[::-1])\n m=int(m[::-1])\n ans=str(n+m)[::-1]\n print(int(ans))", "T = int(input())\...
{"inputs": [["1", "24 1"]], "outputs": [["34"]]}
INTERVIEW
PYTHON3
CODECHEF
2,406
73766907e18d2f3a18e073707f326c61
UNKNOWN
Sergey recently learned about country codes - two letter strings, denoting countries. For example, BY stands for Belarus and IN stands for India. Mesmerized by this new discovery, Sergey now looks for country codes everywhere! Sergey has recently found a string S consisting of uppercase Latin letters. He wants to find ...
["#import set\nt = eval(input()) \nwhile(t):\n s = input()\n set1 = set()\n j = 0\n for i in s[:-1]:\n a = s[j:j+2]\n set1.add(a)\n j = j + 1\n print(str(len(set1)) + '\\n')\n t= t-1\n \n", "def bck():\n t=eval(input())\n for i in range(t):\n s=input()\n l=[]\...
{"inputs": [["2", "INBY", "BYBY"]], "outputs": [["3", "2"]]}
INTERVIEW
PYTHON3
CODECHEF
5,198
76c55dfd30cfce4b6e37850e8b1269c3
UNKNOWN
Suppose there is a X x Y x Z 3D matrix A of numbers having coordinates (i, j, k) where 0 ≤ i < X, 0 ≤ j < Y, 0 ≤ k < Z. Now another X x Y x Z matrix B is defined from A such that the (i, j, k) element of B is the sum of all the the numbers in A in the cuboid defined by the (0, 0, 0) and (i, j, k) elements as the diagon...
["# Problem: http://www.codechef.com/JULY09/submit/CUBESUM/ \n# Author: Susam Pal\n\ndef computeA():\n X, Y, Z = [int(x) for x in input().split()]\n B = []\n for x in range(X):\n B.append([])\n for y in range(Y):\n B[-1].append([int(t) for t in input().split()])\n for z in range(Z):\n result = B[x][y][z]\n ...
{"inputs": [["2", "3 1 1", "1", "8", "22", "1 2 3", "0 9 13", "18 45 51"]], "outputs": [["1", "7", "14", "0 9 4", "18 18 2"]]}
INTERVIEW
PYTHON3
CODECHEF
1,524
870f7efc0b566f882127caf129ae71a4
UNKNOWN
A matrix B (consisting of integers) of dimension N × N is said to be good if there exists an array A (consisting of integers) such that B[i][j] = |A[i] - A[j]|, where |x| denotes absolute value of integer x. You are given a partially filled matrix B of dimension N × N. Q of the entries of this matrix are filled by eit...
["import sys\nsys.setrecursionlimit(1000000)\n\nmod = 10**9 + 7\nts = int(input())\nwhile ts > 0:\n n,q = list(map(int,input().split()))\n ncc = n-1\n par = [i for i in range(n)]\n rank = [1]*n\n xor = [0]*n\n flag = 1\n\n def find(a):\n if par[a] == a:\n return a\n else:\n temp = find(par[a])\n xor[a]^=xor[par...
{"inputs": [["4", "2 2", "1 1 0", "1 2 1", "2 3", "1 1 0", "1 2 1", "2 1 0", "3 2", "2 2 0", "2 3 1", "3 3", "1 2 1", "2 3 1", "1 3 1"]], "outputs": [["yes", "no", "yes", "no"]]}
INTERVIEW
PYTHON3
CODECHEF
4,314
d64524e0d3eb3e1534c0adfc844efe51
UNKNOWN
Ashley likes playing with strings. She gives Mojo a fun problem to solve. In her imaginary string world, a string of even length is called as "Doublindrome" if both halves of the string are palindromes (both halves have length equal to half of original string). She gives Mojo a string and asks him if he can form a "D...
["for _ in range(int(input())):\n n=int(input())\n s=input()\n d={}\n for j in s:\n if j not in d:\n d[j]=1\n else:\n d[j]+=1\n f=0\n for j in d:\n if(d[j]%2==1):\n f=f+1\n if((n//2)%2==0 and f==0):\n print(\"YES\")\n continue\n if((n//2)%2==1 and f<=2 and f%2==0):\n print(\"YES\")\n continue\n print(\"NO\...
{"inputs": [["1", "8", "abbacddc"]], "outputs": [["YES"]]}
INTERVIEW
PYTHON3
CODECHEF
2,647
6c449cddafd91391082487836182308a
UNKNOWN
Dhote and Shweta went on a tour by plane for the first time.Dhote was surprised by the conveyor belt at the airport.As Shweta was getting bored Dhote had an idea of playing a game with her.He asked Shweta to count the number of bags whose individual weight is greater than or equal to the half of the total number of ba...
["t=int(input())\r\nfor _ in range(t):\r\n size=int(input())\r\n li=list(map(int,input().split()))\r\n c = 0\r\n for i in li:\r\n if(i >=len(li)/2):\r\n c += 1\r\n print(c)\r\n", "for _ in range(int(input())):\r\n c=0\r\n n = int(input())\r\n w = [int(x) for x in input().split(...
{"inputs": [["1", "4", "1 2 3 4"]], "outputs": [["3"]]}
INTERVIEW
PYTHON3
CODECHEF
5,556
8d890e8e4509a5b13c8411fc5f0c9cd5
UNKNOWN
Dio Brando has set a goal for himself of becoming the richest and the most powerful being on earth.To achieve his goals he will do anything using either manipulation,seduction or plain violence. Only one guy stands between his goal of conquering earth ,named Jotaro Kujo aka JoJo .Now Dio has a stand (visual manifestat...
["# cook your dish here\nimport sys\nimport math\nfrom collections import Counter\nfrom collections import OrderedDict \ndef inputt():\n return sys.stdin.readline().strip()\ndef printt(n):\n sys.stdout.write(str(n)+'\\n')\ndef listt():\n return [int(i) for i in inputt().split()]\ndef gcd(a,b): \n return math...
{"inputs": [["6", "abcdfgh", "urdrdrav", "jojojojoj", "bbbbaaa", "cddfsccs", "tttttttttttt"]], "outputs": [["1234678", "2118418418122", "1015", "21", "46193", "20"]]}
INTERVIEW
PYTHON3
CODECHEF
2,595
9af1708cf9725335dfe958037e9f7708
UNKNOWN
The chef is placing the laddus on the large square plat. The plat has the side of length N. Each laddu takes unit sq.unit area. Cheffina comes and asks the chef one puzzle to the chef as, how many squares can be formed in this pattern with all sides of new square are parallel to the original edges of the plate. -----I...
["# cook your dish here\n \nt = int(input())\n\nwhile t:\n m = int(input())\n print(int(m * (m + 1) * (2 * m + 1) / 6))\n \n \n t -= 1", "#\n# data = {1:1,0:0}\n#\n# for i in range(2,10**7+1):\n#\n# data[i] = i**2 + data[i-1]\n\n\nfor t in range(int(input())):\n\n N = int(input())\n\n print((N*(N+1)*(2*N + 1))//6)\...
{"inputs": [["2", "1", "2"]], "outputs": [["1", "5"]]}
INTERVIEW
PYTHON3
CODECHEF
2,856
029cd49dea37791f4ff219adf4d6c4f3
UNKNOWN
Chef is making polygon cakes in his kitchen today! Since the judge panel is very strict, Chef's cakes must be beautiful and have sharp and precise $internal$ angles in arithmetic progression. Given the number of sides, $N$, of the cake Chef is baking today and also the measure of its first angle(smallest angle), $A$,...
["# cook your dish here\nimport math\nT = int(input())\nfor _ in range(T):\n N, A, K = map(int, input().split(\" \"))\n total = (N-2) * 180\n diffT = total - N*A\n diffN = sum(range(1,N))\n r = (A*diffN+(K-1)*diffT)\n \n d = math.gcd(r, diffN)\n while d > 1:\n r//=d\n diffN//=d\n d = math.gcd(r, diffN)\n print(r, di...
{"inputs": [["1", "3 30 2"]], "outputs": [["60 1"]]}
INTERVIEW
PYTHON3
CODECHEF
7,001
91991a866c27947da576979274b2e2a0
UNKNOWN
Indian National Olympiad in Informatics 2016 Boing Inc, has N employees, numbered 1 ... N. Every employee other than Mr. Hojo (the head of the company) has a manager (P[i] denotes the manager of employee i). Thus an employee may manage any number of other employees but he reports only to one manager, so that the organ...
["import sys\r\nfrom collections import defaultdict\r\ninput = sys.stdin.readline\r\nsys.setrecursionlimit(1000000)\r\n\r\narr=[int(x) for x in input().split()]\r\n\r\nif arr[0]==1:\r\n print(0)\r\n return\r\n\r\np=[None]\r\nfor i in range(1,arr[0]+1):\r\n p.append(arr[i])\r\n \r\na=[None]\r\nfor i in range...
{"inputs": [["4 5 10 6 12 2 -1 4 2"]], "outputs": [["6"]]}
INTERVIEW
PYTHON3
CODECHEF
16,200
710ae354f6a7b9ea3601ff8b8b3280c6
UNKNOWN
A tennis tournament is about to take place with $N$ players participating in it. Every player plays with every other player exactly once and there are no ties. That is, every match has a winner and a loser. With Naman's birthday approaching, he wants to make sure that each player wins the same number of matches so tha...
["# cook your dish here\na = int(input())\nfor i in range(a):\n n = int(input())\n if n%2==0:\n print('NO')\n else:\n print('YES')\n for i1 in range(n):\n li = [0]*n\n b = str()\n for i2 in range((n-1)//2):\n li[(i1+i2+1)%n]+=1\n for i3 in range(len(li)):\n b+=str(li[i3])\n print(b)", "# cook your di...
{"inputs": [["2", "3", "2"]], "outputs": [["YES", "010", "001", "100", "NO"]]}
INTERVIEW
PYTHON3
CODECHEF
10,146
e284659ae7a91aac1fad744d042ab497
UNKNOWN
You like tracking airplane flights a lot. Specifically, you maintain history of an airplane’s flight at several instants and record them in your notebook. Today, you have recorded N such records h1, h2, ..., hN, denoting the heights of some airplane at several instants. These records mean that airplane was first flying...
["def f(n):\n\n s = list(map(int, input().split()))\n low = []\n high = []\n\n for i in range(n - 1):\n low.append(min(s[i], s[i+1]))\n high.append(max(s[i], s[i+1]))\n low.sort()\n high.sort()\n curr = mx = 0\n i = j = 0\n n -= 1\n while i < n and j < n:\n if low[i] < high[j]:\n i += 1\n curr += 1\n else:\n ...
{"inputs": [["5", "1 2 3 2 3"]], "outputs": [["3"]]}
INTERVIEW
PYTHON3
CODECHEF
413
72c58e5f0c3cb701d0c50379754bfd23
UNKNOWN
You must have tried to solve the Rubik’s cube. You might even have succeeded at it. Rubik’s cube is a 3x3x3 cube which has 6 different color for each face.The Rubik’s cube is made from 26 smaller pieces which are called cubies. There are 6 cubies at the centre of each face and these comprise of a single color. There ar...
["for _ in range(int(input())):\n m=int(input())\n n=int(input())\n o=int(input())\n ans=4*(m+n+o)-24\n if(ans <= 0):\n print('0')\n else:\n print(ans)\n", "import sys\n\nfor __ in range(eval(input())) :\n m , n , o = eval(input()) , eval(input()) , eval(input())\n if m==1 and n==1 and o==1 :\n print(0)\n continue\...
{"inputs": [["1", "3", "3", "3"]], "outputs": [["12"]]}
INTERVIEW
PYTHON3
CODECHEF
1,537
adc96bd0e31e41d2654cd9bfabacd124
UNKNOWN
The chef is trying to solve some pattern problems, Chef wants your help to code it. Chef has one number K to form a new pattern. Help the chef to code this pattern problem. -----Input:----- - First-line will contain $T$, the number of test cases. Then the test cases follow. - Each test case contains a single line of ...
["# cook your dish here\nfor a0 in range(int(input())):\n n = int(input())\n l = []\n for i in range(1,n+1):\n l.append(i)\n \n for j in range(n):\n s = \"\"\n for k in l:\n s+=str(k)\n print(s)\n x = l[0]\n l.pop(0)\n l.append(x)\n", "for _ in ...
{"inputs": [["3", "2", "3", "4"]], "outputs": [["12", "21", "123", "231", "312", "1234", "2341", "3412", "4123"]]}
INTERVIEW
PYTHON3
CODECHEF
4,981
b0f14fa9a1e40ab26250573c66524fcc
UNKNOWN
You are given $N$ gears numbered $1$ through $N$. For each valid $i$, gear $i$ has $A_i$ teeth. In the beginning, no gear is connected to any other. Your task is to process $M$ queries and simulate the gears' mechanism. There are three types of queries: - Type 1: Change the number of teeth of gear $X$ to $C$. - Type 2:...
["class Dsu:\n def __init__(self, v, s):\n self.par = s\n self.v = v\n self.dr = [1] * v\n self.zero = [False] * v\n self.speed = []\n for i in range(v):\n self.speed.append([])\n self.speed[i].append(i)\n\n def find(self, i):\n # if parent[i]...
{"inputs": [["4 10", "6 8 10 13", "3 1 2 2", "2 1 2", "3 1 2 3", "2 2 3", "1 1 7", "3 1 3 10", "2 3 1", "3 1 3 2", "2 1 4", "3 1 4 6", ""]], "outputs": [["0", "-9/4", "7/1", "0", "0"]]}
INTERVIEW
PYTHON3
CODECHEF
3,837
74b46ef75845dfcce14e03974fe5ccc4
UNKNOWN
Given an alphanumeric string made up of digits and lower case Latin characters only, find the sum of all the digit characters in the string. -----Input----- - The first line of the input contains an integer T denoting the number of test cases. Then T test cases follow. - Each test case is described with a single line ...
["for _ in range(eval(input())):\n s = input()\n ans = 0\n for i in s:\n if i.isdigit():\n ans += int(i)\n print(ans) ", "t = int(input())\nwhile t:\n string = list(input())\n ans = 0\n for char in string:\n if ord(char) >= 48 and ord(char) <= 57:\n ans += ord(char) - 48 \n print(ans)\n t -= 1 ", "n = int(input()...
{"inputs": [["1", "ab1231da"]], "outputs": [["7"]]}
INTERVIEW
PYTHON3
CODECHEF
3,108
6ac09e9b047462f79ad9d6eb15444b42
UNKNOWN
You are given an integer sequence $A_1, A_2, \ldots, A_N$. For any pair of integers $(l, r)$ such that $1 \le l \le r \le N$, let's define $\mathrm{OR}(l, r)$ as $A_l \lor A_{l+1} \lor \ldots \lor A_r$. Here, $\lor$ is the bitwise OR operator. In total, there are $\frac{N(N+1)}{2}$ possible pairs $(l, r)$, i.e. $\frac{...
["for _ in range(int(input())):\n n = int(input())\n arr = list(map(int,input().split()))\n\n if n<=62:\n st = set()\n\n for i in range(n):\n curr = 0\n for j in range(i,n):\n curr = curr|arr[j]\n\n st.add(curr)\n \n if len(st)==n*(n+1)//2:\n print(\"YES\")\n else:\n print(\"NO\")\n \n else:\n pri...
{"inputs": [["4", "3", "1 2 7", "2", "1 2", "3", "6 5 8", "5", "12 32 45 23 47"]], "outputs": [["NO", "YES", "YES", "NO"]]}
INTERVIEW
PYTHON3
CODECHEF
8,621
ac96f450fa786a8b2d0425d932c848b6
UNKNOWN
In this problem the input will consist of a number of lines of English text consisting of the letters of the English alphabet, the punctuation marks ' (apostrophe), . (full stop), , (comma), ; (semicolon), :(colon) and white space characters (blank, newline). Your task is print the words in the text in lexicographic or...
["import sys\nt=int(input())\nx=sys.stdin.readlines()\nl=[]\nfor s in x:\n s=s.replace(\".\",\"\")\n s=s.replace(\"'\",\"\")\n s=s.replace(\",\",\"\")\n s=s.replace(\":\",\"\")\n s=s.replace(\";\",\"\")\n lst=[str(i) for i in s.split()]\n for j in lst:\n l.append(j)\nm=[]\nfor y in l:\n z...
{"inputs": [["2", "This is a sample piece of text to illustrate this", "problem."]], "outputs": [["10", "a", "illustrate", "is", "of", "piece", "problem", "sample", "text", "this", "to"]]}
INTERVIEW
PYTHON3
CODECHEF
2,053
1c17d857cc24ff7bab061aff07852f8d
UNKNOWN
Kajaria has an empty bag and 2 types of tiles - tiles of type $1$ have the number $X$ written and those of type $2$ have the number $Y$ written on them. He has an infinite supply of both type of tiles. In one move, Kajaria adds exactly $1$ tile to the bag. He adds a tile of type $1$ with probability $p$ and a tile of ...
["# cook your dish here\nt=int(input())\nMOD=1000000007\ndef mod(n, m=MOD):\n n%=m\n while n<0: n+=m\n return n\n\ndef power(n, p):\n res=1\n while p:\n if p%2: res=mod(res*n)\n p//=2\n n=mod(n*n)\n return res\n\nwhile t:\n ma=input().split()\n x=int(ma[0])\n y=int(ma[1])\n s=int(ma[2])\n ma=input().split()\n u=int(...
{"inputs": [["1", "5 3 96", "1 3"]], "outputs": [["48"]]}
INTERVIEW
PYTHON3
CODECHEF
1,616
7d0ff1a579c4b9856afb205b8ff91a62
UNKNOWN
There are n cards of different colours placed in a line, each of them can be either red, green or blue cards. Count the minimum number of cards to withdraw from the line so that no two adjacent cards have the same colour. -----Input----- - The first line of each input contains an integer n— the total number of cards. ...
["# cook your dish here\nn = int(input())\ns = [i for i in input()]\ncount = 0\nfor i in range(1,n):\n if s[i] == s[i-1]:\n count += 1\n else:\n continue\nprint(count)\n", "# cook your dish here\n\nn=int(input())\nstring1=input()\ncount=0\nif(n==1):\n print(0)\nelse:\n for i in range(len(strin...
{"inputs": [["5", "RGGBG", "Sample Input 2:", "5", "RRRRR", "Sample Input 3:", "2", "BB"]], "outputs": [["1", "Sample Output 2:", "4", "Sample Output 3:", "1"]]}
INTERVIEW
PYTHON3
CODECHEF
4,764
baf651d2c6ae9dc9dff0929f8c8b642d
UNKNOWN
Devu loves to play with his dear mouse Jerry. One day they play a game on 2 dimensional grid of dimensions n * n (n ≥ 2). Jerry is currently at coordinates (sx, sy) and wants to move to location (ex, ey) where cheese is placed by Devu. Also Devu is very cunning and has placed a bomb at location (bx, by). All these thr...
["import sys\n\ndef _r(*conv) :\n r = [conv[i](x) for i, x in enumerate(input().strip().split(' '))]\n return r[0] if len(r) == 1 else r\n\ndef _ra(conv) :\n return list(map(conv, input().strip().split(' ')))\n\ndef _rl() :\n return list(input().strip())\n\ndef _rs() :\n return input().strip()\n\ndef _a(k, *v) :\n retu...
{"inputs": [["2", "2 1 1 2 2 1 2", "3 1 1 1 3 1 2"]], "outputs": [["2", "4"]]}
INTERVIEW
PYTHON3
CODECHEF
3,783
5e98a225f72076d9984d819fc9eb9dcb
UNKNOWN
-----Problem Statement----- You all must have played the game candy crush. So here is a bomb which works much the fruit bomb in candy crush. A designer, Anton, designed a very powerful bomb. The bomb, when placed on a location $(x, y)$ in a $R \times C$ grid, wipes out the row $x$ and column $y$ completely. You are giv...
["r,c,n = map(int , input().split());coordinates = [];coordinates_1,coordinates_2 = {},{}\r\nfor _ in range(n):\r\n\tx,y = map(int , input().split())\r\n\tcoordinates.append([x,y])\r\nfor i in coordinates:\r\n if(i[0] in coordinates_1): coordinates_1[i[0]] += 1\r\n else: coordinates_1[i[0]] = 1\r\n if(i[1] in ...
{"inputs": [["2 3 3", "1 1", "0 0", "0 2"]], "outputs": [["3"]]}
INTERVIEW
PYTHON3
CODECHEF
12,367
23981a1425f1aa28ea48e0722fb50cb0
UNKNOWN
Chef is now a corporate person. He has to attend office regularly. But chef does not want to go to office, rather he wants to stay home and discover different recipes and cook them. In the office where chef works, has two guards who count how many times a person enters into the office building. Though the duty of a gu...
["# cook your dish here\nfor _ in range(int(input())):\n x, y= map(int, input().split())\n print(max(x,y), x+y)", "n=int(input())\nfor i in range(n):\n g1,g2=map(int,input().split())\n s=0\n if g1<g2:\n s=g2\n else:\n s=g1\n print(s,g1+g2)", "t=int(input())\nfor x in range(t):\n a,...
{"inputs": [["1", "19 17"]], "outputs": [["19 36"]]}
INTERVIEW
PYTHON3
CODECHEF
3,577
e724cb1e00a8f25b6f17deae265c17cd
UNKNOWN
Indian National Olympiad in Informatics 2012 You are given a table with 2 rows and N columns. Each cell has an integer in it. The score of such a table is defined as follows: for each column, consider the sum of the two numbers in the column; the maximum of the N numbers so obtained is the score. For example, for the t...
["# cook your dish here\ntry:\n n=int(input())\n \n list_n = list(range(1,n+1))\n list_n_flag=[]\n \n fix_arr = list(map(int,input().split()))\n \n \n k=1\n res_list=[]\n fin_list=[]\n list_n_flag = list_n[k:] + list_n[:k]\n res_list = [list_n[i] + fix_arr[i] for i in range(len(fi...
{"inputs": [["and output corresponding to the example above.", "Sample input", "4", "7 1 6 2", "Sample output", "9 10 10 11", "Note: Your program should not print anything other than what is specified in the output format. Please remove all diagnostic print statements before making your final submission. A program wit...
INTERVIEW
PYTHON3
CODECHEF
683
dfe206cb9f991fed69e2815abe482eda
UNKNOWN
Chef likes problems on geometry a lot. Please help him to solve one such problem. Find all possible triangles with integer sides which has the radius of inscribed circle (also known as incircle) equal to R. Two triangles are said to be different if they have at least one different side lengths. Formally, let there be t...
["r=int(input())\nc=0\nL=[]\nfor i in range(2*r+1,2*r**2+2):\n for j in range(i,r**4+2*r**2+2):\n for k in range(j,r**4+3*r**2+2):\n if 4*(i+j+k)*r**2==(i+j-k)*(i+k-j)*(j+k-i):\n L.append([i,j,k])\n c+=1\nprint(c)\nfor i in range(c):\n for j in range(3):\n print(L[i][j], end=' ')\n print()\n \n", "from math i...
{"inputs": [["2"]], "outputs": [["5", "5 12 13", "6 8 10", "6 25 29", "7 15 20", "9 10 17"]]}
INTERVIEW
PYTHON3
CODECHEF
3,132
0ae6212985743fefa2d7dc7441e0d4e9
UNKNOWN
Lucy had recently learned the game, called Natural Numbers. The rules of the game are really simple. There are N players. At the same time, every player says one natural number. Let's call the number said by the i-th player Ai. The person with the smallest unique number (that is, the smallest number that was not said b...
["try:\n t = int(input())\n while t:\n t -= 1\n n = int(input())\n arr = []\n obj = {}\n for i in range(n):\n x,y = input().split()\n y = int(y)\n arr.append([x, y])\n if y in obj: obj[y].append(x)\n else: obj[y] = [x]\n ...
{"inputs": [["2", "5", "Kouta 1", "Yuka 1", "Mayu 3", "Lucy 2", "Nana 5", "2", "Lucy 2", "Nana 2", "", ""]], "outputs": [["Lucy", "Nobody wins."]]}
INTERVIEW
PYTHON3
CODECHEF
10,230
6e16f9b38139a5c3e140d24d0bb5ab4d
UNKNOWN
Write a program that reads numbers until -1 is not given. The program finds how many of the given numbers are more than 30, $N$. It also finds the average weighted sum of even numbers, $A$. The weight of the $i$th number is defined as the position of the number (1 based indexing) times the number. To find the average w...
["for _ in range(int(input())):\r\n a=list(map(int,input().split()))\r\n num=0\r\n den=0\r\n k=1\r\n great=0\r\n for i in a:\r\n if i==-1:break\r\n else:\r\n if i>30:great+=1\r\n if i%2==0:\r\n num+=k*i\r\n den+=k\r\n k+=1\r\...
{"inputs": [["1", "33 100 77 42 12 -1"]], "outputs": [["4 38.91"]]}
INTERVIEW
PYTHON3
CODECHEF
5,315
e8a9f6260592b622073491a3f003e829
UNKNOWN
Mance Rayder, the King-Beyond-the-Wall, has always wanted to lead the largest army the North has ever seen against the NIght’s Watch. For this humungous feat he has banded the waring tribes, the Giants, Thenns and Wildings, together by going to great extents. But the King is facing with an issue he always saw it coming...
["n=int(input())\nfor i in range(n):\n a=list(map(int,input().split()))\n a.sort()\n if a[0]+a[1]>=a[2]-1:\n print(\"Yes\")\n else:\n print(\"No\")\n \n", "for _ in range(int(input())):\n a=list(map(int,input().split()))\n a.sort()\n if(a[0]+a[1]>=a[2]):\n print(\"Yes\")\n else:\n print(\"No\")", "test=int(input())...
{"inputs": [["1", "1 2 1"]], "outputs": [["Yes"]]}
INTERVIEW
PYTHON3
CODECHEF
5,767
6f85ebb321352c7565c9a0c331988b27
UNKNOWN
Master Oogway has forseen that a panda named Po will be the dragon warrior, and the master of Chi. But he did not tell anyone about the spell that would make him the master of Chi, and has left Po confused. Now Po has to defeat Kai, who is the super villian, the strongest of them all. Po needs to master Chi, and he fin...
["arr = []\narr.append(1)\n_ = 1\nwhile _<=100002:\n arr.append(_*arr[_-1]%1589540031)\n _+=1\nfor _ in range(int(input())):\n print(arr[int(input())])", "T=int(input())\na=[]\na.append(1)\nfor j in range(10**5+1):\n a.append(a[j]*(j+1)%1589540031)\nfor i in range(T):\n N=int(input())\n print(a[N])", "a = []\na.append(...
{"inputs": [["4", "1", "2", "3", "4"]], "outputs": [["1", "2", "6", "24"]]}
INTERVIEW
PYTHON3
CODECHEF
796
658568e65f55738f0d2f8f6096c09153
UNKNOWN
Chef is in need of money, so he decided to play a game with Ramsay. In this game, there are $N$ rows of coins (numbered $1$ through $N$). For each valid $i$, the $i$-th row contains $C_i$ coins with values $A_{i, 1}, A_{i, 2}, \ldots, A_{i, C_i}$. Chef and Ramsay alternate turns; Chef plays first. In each turns, the cu...
["for i in range(int(input())):\n n=int(input())\n chef=0\n ans=[]\n for i in range(0,n):\n l=list(map(int,input().split()))\n c=l[0]\n if c%2==0:\n for i in range(1,len(l)//2+1):\n chef=chef+l[i]\n continue;\n for i in range(1,len(l)//2):\n chef=chef+l[i]\n ans.append(l[len(l)//2])\n ans.sort(reverse=Tru...
{"inputs": [["1", "2", "4 5 2 3 4", "2 1 6"]], "outputs": [["8"]]}
INTERVIEW
PYTHON3
CODECHEF
8,776
7fcefaef98c24823945f40c388573871
UNKNOWN
Consider a currency system in which there are notes of six denominations, namely, Rs. 1, Rs. 2, Rs. 5, Rs. 10, Rs. 50, Rs. 100. If the sum of Rs. N is input, write a program to computer smallest number of notes that will combine to give Rs. N. -----Input----- The first line contains an integer T, total number of test...
["# cook your dish here\nt= int(input())\nfor i in range(t):\n cnt=0\n n=int(input())\n while(n>=100):\n n-=100\n cnt+=1\n while(n>=50):\n n-=50\n cnt+=1\n while(n>=10):\n n-=10\n cnt+=1\n while(n>=5):\n n-=5\n cnt+=1\n while(n>=2):\n n...
{"inputs": [["3", "1200", "500", "242"]], "outputs": [["12", "5", "7"]]}
INTERVIEW
PYTHON3
CODECHEF
8,532
81993a3d359c696674c2ac24cc0c2702
UNKNOWN
After fixing the mercury leak, Kim has arrived in the planning room, where he finds a square map of a field, with $N$ rows and $N$ columns. Each cell in the field is either empty, or has a lookout tower on it. Using his notes, he immediately realises that this field is where the JSA will build their new base! Kim knows...
["T = int(input())\r\n\r\nans = []\r\nfor _ in range(T):\r\n\tz = int(input())\r\n\r\n\tfor k in range(z):\r\n\t\ts = input()\r\n\r\n\tans.append((z*(z+1))//2)\r\n\r\nfor ele in ans:\r\n\tprint(ele)", "t = int(input())\nfor i in range(t):\n n = int(input())\n l =[]\n for j in range(n):\n l.append(list(i...
{"inputs": [["2", "2", "10", "01", "4", "1000", "0010", "0100", "0001"]], "outputs": [["3", "8"]]}
INTERVIEW
PYTHON3
CODECHEF
11,371
fc21fdf378f915ed8e5a52b8fdeee372
UNKNOWN
Nobody outside the cooking community knows that Chef is a big fan of Chefgram™ — a social network where chefs and cooks upload their secret kitchen photos. Recently Chef clicked a beautiful photo, which is represented using 10 pixels in a single row. Respecting Chefgram™'s boolean roots, every pixel is either white or ...
["import itertools\nimport numpy as np\nb = np.zeros((100001), dtype=np.int)\ndef power2(a):\n\tb[0] = 1\n\tif b[a] > 0:\n\t\treturn b[a]\n\telse:\n\t\tfor i in range(1,a+1):\n\n\t\t\tb[i] = b[i-1]*2\n\t\t\tif b[i] > (10**9+7):\n\t\t\t\tb[i] = b[i]%(10**9+7)\n\t\treturn b[a]\n\n\ndef __starting_point():\n\tt = eval(inp...
{"inputs": [["3", "wwwwwwwwww", "3", "+-+-+-+-+-", "----------", "+---------", "wbwbwbwbwb", "3", "+-+-+-+-+-", "+-+-------", "----+-+-+-", "bbbbbbbbbb", "2", "----------", "----------", "", ""]], "outputs": [["0", "2", "4"]]}
INTERVIEW
PYTHON3
CODECHEF
36,598
dbbc513e620f417b721350b9d73e4189
UNKNOWN
During quarantine chef’s friend invented a game. In this game there are two players, player 1 and Player 2. In center of garden there is one finish circle and both players are at different distances respectively $X$ and $Y$ from finish circle. Between finish circle and Player 1 there are $X$ number of circles and betwe...
["import math\n\nfor i in range(int(input())):\n p,q=list(map(int,input().split()))\n c=0\n h=0\n \n while(q>=0):\n if(q==0):\n h+=1\n break\n \n d=int(math.log2(q+1))\n if(d==0):\n h+=1\n break\n y=(2**d)-1\n q-=y+1\n if(q==-1):\n h+=1\n break\n h+=1\n \n while(p>=0):\n if(p==0):\n c+=1\n bre...
{"inputs": [["2", "4 5", "3 5"]], "outputs": [["0 0", "1 1"]]}
INTERVIEW
PYTHON3
CODECHEF
10,816
6e9583296251b512e2e4a80f35a6b32b
UNKNOWN
Chef is playing a game with his brother Chefu. He asked Chefu to choose a positive integer $N$, multiply it by a given integer $A$, then choose a divisor of $N$ (possibly $N$ itself) and add it to the product. Let's denote the resulting integer by $M$; more formally, $M = A \cdot N + d$, where $d$ is some divisor of $N...
["import math\ndef divisors(n):\n arr = []\n for i in range(1,1+int(math.ceil(math.sqrt(n)))):\n if n%i == 0:\n arr.append(i)\n arr.append(n//i)\n arr = list(sorted(set(arr)))\n return arr\ntry:\n t = int(input())\n while t:\n t -= 1\n a,m = map(int, input().split())\n divs = divisors(m)\n ans = []\n for d in...
{"inputs": [["3", "3 35", "5 50", "4 65"]], "outputs": [["1", "10", "0", "3", "13 15 16"]]}
INTERVIEW
PYTHON3
CODECHEF
9,676
f7a7ce8bb3ee9f06e5c407eafa67f9e8
UNKNOWN
Mr. Das is a teacher teaching for several years in a school. He is not computer savvy. Due to lockdown, now he has to take classes online. Recently he took an online exam for students of different classes. Now, he will call parents of all the students who scored lower than average marks for the class. He has requested ...
["try:\n # cook your dish here\n t=int(input())\n for j in range(t):\n n=int(input())\n x=[]\n p=[]\n m=[]\n for i in range(n):\n X,P,M=list(map(str,input().split()))\n x.append(X)\n p.append(int(P))\n m.append(int(M))\n avg=sum(m)/n\n for i in m:\n if i<avg:\n z=sorted([k for k in m if k<avg])\n ...
{"inputs": [["2", "3", "Rahul 1345964789 47", "Rupendra 1457856987 58", "Priya 1478569820 45", "2", "Tanuja 4310779415 97", "Akash 3689781245 43"]], "outputs": [["Priya 1478569820 45", "Rahul 1345964789 47", "Akash 3689781245 43"]]}
INTERVIEW
PYTHON3
CODECHEF
9,618
ca69fb07e2616838c786559a3439f449
UNKNOWN
Chef and his mother are going travelling. Chef's world consists of $N$ cities (numbered $1$ through $N$) connected by $N-1$ bidirectional roads such that each city can be reached from any other city using roads. For each city, we know its age — the number of years elapsed since the foundation of the city; let's denote ...
["'''input\n1\n3\n1 2\n1 3\n1 2 3\n'''\nimport sys\nsys.setrecursionlimit(1000000)\nfor _ in range(eval(input())):\n C=[]\n n=eval(input())\n for i in range(n):\n C.append([])\n for i in range(n-1):\n a,b=[int(x)-1 for x in input().split()]\n C[a].append(b)\n C[b].append(a)\n cnt=0\n Co=[bin(int(x)).count(\"1\") fo...
{"inputs": [["1", "3", "1 2", "1 3", "1 2 3"]], "outputs": [["2"]]}
INTERVIEW
PYTHON3
CODECHEF
606
042b4066c956b1c6137b79be6c91c70e
UNKNOWN
Shivam owns a gambling house, which has a special wheel called The Wheel of Fortune. This wheel is meant for giving free coins to people coming in the house. The wheel of fortune is a game of chance. It uses a spinning wheel with exactly N numbered pockets and a coin is placed in between every consecutive pocket. Th...
["t=int(input())\r\nfor _ in range(t):\r\n n=int(input())\r\n arr=list(map(int,input().split()))\r\n d={}\r\n for i in range(n):\r\n if arr[i] in d:\r\n d[arr[i]].append(i)\r\n else:\r\n d[arr[i]]=[i]\r\n q=int(input())\r\n for i in range(q):\r\n m=int(input(...
{"inputs": [["2", "3", "1 2 3", "3", "1", "2", "3", "6", "2 1 5 3 2 1", "4", "1", "2", "3", "5"]], "outputs": [["3", "3", "3", "2", "2", "6", "6"]]}
INTERVIEW
PYTHON3
CODECHEF
800
9f10edbfd2de7b0432dc54fc7ad1f5f4
UNKNOWN
Chef is playing a game with two of his friends. In this game, each player chooses an integer between $1$ and $P$ inclusive. Let's denote the integers chosen by Chef, friend 1 and friend 2 by $i$, $j$ and $k$ respectively; then, Chef's score is (((Nmodi)modj)modk)modN.(((Nmodi)modj)modk)modN.(((N\,\mathrm{mod}\,i)\,\ma...
["for __ in range(int(input())):\n n,p=list(map(int,input().split()))\n d=n%(n//2+1)\n if(d==0):\n t=p*p*p\n else:\n t=(p-d)*(p-d)+(p-d)*(p-n)+(p-n)*(p-n)\n print(t)\n", "t = int(input())\n\nfor _ in range(t):\n n, p = map(int, input().strip().split())\n\n if n <= 2:\n print(p * p * p)\n\n else:\n m = (n - 1) // 2\...
{"inputs": [["2", "4 4", "3 4"]], "outputs": [["9", "13"]]}
INTERVIEW
PYTHON3
CODECHEF
6,224
688ea792235ea82fe52a47fd59166cd9
UNKNOWN
There is a girl named ''Akansha''. She is very fond of eating chocolates but she has a weak immune system due to which she gets cold after eating chocolate during morning, evening and night and can only eat at most $x$ number of chocolate each afternoon. A friend of hers gifted her some $n$ number of chocolates that sh...
["for t in range(int(input().strip())):\n n = int(input().strip())\n x = int(input().strip())\n arr = list(map(int, input().strip().split()))\n arr.sort()\n day = 1\n acc = 0\n isPossible = True\n for a in arr:\n acc += 1\n if acc > x:\n day += 1\n acc = 1\n if day >= a:\n isPossible = False\n break\n\n prin...
{"inputs": [["3", "3", "5", "4 1 2", "5", "2", "4 4 3 2 2", "5", "1", "4 2 3 1 1"]], "outputs": [["Impossible", "Possible", "Impossible"]]}
INTERVIEW
PYTHON3
CODECHEF
8,960
dfef83c3297a4f1f6a0f6333f589ebab
UNKNOWN
You are at the top left cell $(1, 1)$ of an $n \times m$ labyrinth. Your goal is to get to the bottom right cell $(n, m)$. You can only move right or down, one cell per step. Moving right from a cell $(x, y)$ takes you to the cell $(x, y + 1)$, while moving down takes you to the cell $(x + 1, y)$. Some cells of the la...
["def getSum(dp, pos, s, e, type_):\n if e < s:\n return 0\n \n if type_=='D':\n if e==m-1:\n return dp[pos][s]\n return dp[pos][s]-dp[pos][e+1]\n else:\n if e==n-1:\n return dp[s][pos]\n return dp[s][pos]-dp[e+1][pos]\n\nmod = 10**9+7\nn, m =...
{ "inputs": [ "1 1\n.\n", "2 3\n...\n..R\n", "4 4\n...R\n.RR.\n.RR.\nR...\n", "1 3\n.R.\n", "2 2\n.R\nR.\n", "10 10\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n" ], "outputs": [ "1\n", "0\n", "4\n", ...
INTERVIEW
PYTHON3
CODEFORCES
1,833
f2f73d47387025589bfa5d5ccd1971bf
UNKNOWN
Tavak and Seyyed are good friends. Seyyed is very funny and he told Tavak to solve the following problem instead of longest-path. You are given l and r. For all integers from l to r, inclusive, we wrote down all of their integer divisors except 1. Find the integer that we wrote down the maximum number of times. Solve...
["l,r = map(int, input().split(\" \"))\nif l == r:\n print (l)\nelse:\n print (2)", "a, b = list(map(int, input().split()))\nif a != b:\n print(2)\nelse:\n print(a)\n", "l,r=map(int,input().split())\nif abs(l-r)>0:\n print(2)\nelse:\n print(l)", "L, R = [int(i) for i in input().split()]\n\nif L == R:...
{ "inputs": [ "19 29\n", "3 6\n", "39 91\n", "76 134\n", "93 95\n", "17 35\n", "94 95\n", "51 52\n", "47 52\n", "38 98\n", "30 37\n", "56 92\n", "900000000 1000000000\n", "37622224 162971117\n", "760632746 850720703\n", "908580370 968054552\n", "9515...
INTERVIEW
PYTHON3
CODEFORCES
3,903
36668bb32d23a116835d68fc906ca9ac
UNKNOWN
"QAQ" is a word to denote an expression of crying. Imagine "Q" as eyes with tears and "A" as a mouth. Now Diamond has given Bort a string consisting of only uppercase English letters of length n. There is a great number of "QAQ" in the string (Diamond is so cute!). $8$ illustration by 猫屋 https://twitter.com/nekoyaliu ...
["s=input()\nans = 0\nfor i in range(len(s)):\n if s[i] == 'A':\n ans += s[:i].count('Q') * s[i:].count('Q')\nprint(ans)", "from sys import stdin, stdout\nfrom random import randrange\n\ns = stdin.readline().strip()\nn = len(s)\nans = 0\n\nfor i in range(n):\n for j in range(i + 1, n):\n for z in range(j ...
{ "inputs": [ "QAQAQYSYIOIWIN\n", "QAQQQZZYNOIWIN\n", "QA\n", "IAQVAQZLQBQVQFTQQQADAQJA\n", "QQAAQASGAYAAAAKAKAQIQEAQAIAAIAQQQQQ\n", "AMVFNFJIAVNQJWIVONQOAOOQSNQSONOASONAONQINAONAOIQONANOIQOANOQINAONOQINAONOXJCOIAQOAOQAQAQAQAQWWWAQQAQ\n", "AAQQAXBQQBQQXBNQRJAQKQNAQNQVDQASAGGANQQQQTJFFQQQTQ...
INTERVIEW
PYTHON3
CODEFORCES
6,195
da12fd2bd3273a557cd0636217fa1ba9
UNKNOWN
Write a function that accepts a square matrix (`N x N` 2D array) and returns the determinant of the matrix. How to take the determinant of a matrix -- it is simplest to start with the smallest cases: A 1x1 matrix `|a|` has determinant `a`. A 2x2 matrix `[ [a, b], [c, d] ]` or ``` |a b| |c d| ``` has determinant: `...
["def determinant(m):\n a = 0\n if len(m) == 1:\n a = m[0][0]\n else:\n for n in xrange(len(m)):\n if (n + 1) % 2 == 0:\n a -= m[0][n] * determinant([o[:n] + o[n+1:] for o in m[1:]])\n else:\n a += m[0][n] * determinant([o[:n] + o[n+1:] for o in...
{"fn_name": "determinant", "inputs": [[[[5]]]], "outputs": [[5]]}
INTERVIEW
PYTHON3
CODEWARS
2,814
def determinant(matrix):
df17d16a333eab1b9abfcd790e35eee3
UNKNOWN
Write a function called `sumIntervals`/`sum_intervals()` that accepts an array of intervals, and returns the sum of all the interval lengths. Overlapping intervals should only be counted once. ### Intervals Intervals are represented by a pair of integers in the form of an array. The first value of the interval will a...
["def sum_of_intervals(intervals):\n s, top = 0, float(\"-inf\")\n for a,b in sorted(intervals):\n if top < a: top = a\n if top < b: s, top = s+b-top, b\n return s", "def sum_of_intervals(intervals):\n result = set()\n for start, stop in intervals:\n for x in range(start, stop):\n...
{"fn_name": "sum_of_intervals", "inputs": [[[[1, 5]]]], "outputs": [[4]]}
INTERVIEW
PYTHON3
CODEWARS
4,036
def sum_of_intervals(intervals):
81ac9bf45f0e92d99caecf1e3447a1b8
UNKNOWN
# Task You are given integer `n` determining set S = {1, 2, ..., n}. Determine if the number of k-element subsets of S is `ODD` or `EVEN` for given integer k. # Example For `n = 3, k = 2`, the result should be `"ODD"` In this case, we have 3 2-element subsets of {1, 2, 3}: `{1, 2}, {1, 3}, {2, 3}` For `n = ...
["def subsets_parity(n, k):\n return 'EVEN' if ~n & k else 'ODD'", "subsets_parity=lambda n,k:~n&k and\"EVEN\"or\"ODD\"", "subsets_parity=s=lambda n,k:n<k and\"EVEN\"or n<2and\"ODD\"or(lambda b:s(n&~b,k&~b))(1<<n.bit_length()-1)", "#Courtesy of giants :D\ndef subsets_parity(n,k):\n N,K = bin(n)[2:][::-1], bin(k)[...
{"fn_name": "subsets_parity", "inputs": [[3, 2], [2, 1], [1, 1], [20, 10], [48, 12]], "outputs": [["ODD"], ["EVEN"], ["ODD"], ["EVEN"], ["EVEN"]]}
INTERVIEW
PYTHON3
CODEWARS
1,979
def subsets_parity(n,k):
8a21042bf3144d32d8bd7c3caf36feaf
UNKNOWN
# 'Magic' recursion call depth number This Kata was designed as a Fork to the one from donaldsebleung Roboscript series with a reference to: https://www.codewars.com/collections/roboscript It is not more than an extension of Roboscript infinite "single-" mutual recursion handling to a "multiple-" case. One can supp...
["from collections import defaultdict\nfrom itertools import chain\nimport re\n\nPARSE = re.compile(r'[pP]\\d+|q')\n\ndef magic_call_depth_number(prog):\n \n def parse(it, p=''):\n for m in it:\n if m[0].startswith('p'): parse(it, m[0])\n elif m[0]=='q': return\n e...
{"fn_name": "magic_call_depth_number", "inputs": [["p0F2LF2RqP0"], ["p1P2P3qp2P1qp3P1qP3"], ["p1P2qp2P3qP4p3P4qp4P1q"], ["p1P2P4qp2P3qp3P4qP1p4P1q"], ["p1P2P3qP2P1p2P3qp3P4qp4P1q"], ["p1P2qp2P3qp3P4qP6p4P1qp5P7qp6P5qp7P6qP1"], ["P1P2P7p1P2qp2P3qp3P4qp4P1qp5P7qp6P5qp7P5q"], ["P2P7P6p1P2qp2P3qp3P4qp4P1qp5P8qp6P5qp7P5qp8P...
INTERVIEW
PYTHON3
CODEWARS
11,913
def magic_call_depth_number(pattern):
693729f097a8ae2f64c1d5f3cc1d9eb8
UNKNOWN
We are given a certain number ```n``` and we do the product partitions of it. ```[59, 3, 2, 2, 2]``` is a product partition of ```1416``` because: ``` 59 * 3 * 2 * 2 * 2 = 1416 ``` We form a score, ```sc``` for each partition in the following way: - if ```d1, d2, ...., dk``` are the prime factors of ```n```, and ```f1,...
["def primeFactors(n):\n \n factors = []\n \n while n % 2 == 0: \n n /= 2\n factors.append(2)\n \n for i in range(3, int(n**.5) + 1,2): \n while n % i == 0: \n n /= i\n factors.insert(0, i)\n \n if n > 2: factors.insert(0, int(n))\n \...
{"fn_name": "find_spec_prod_part", "inputs": [[1416, "max"], [1416, "min"], [10007, "max"]], "outputs": [[[[708, 2], 1420]], [[[59, 24], 166]], ["It is a prime number"]]}
INTERVIEW
PYTHON3
CODEWARS
15,259
def find_spec_prod_part(n, com):
e4113bf16283f1969cb511d4050c56b9
UNKNOWN
Complete the solution so that it strips all text that follows any of a set of comment markers passed in. Any whitespace at the end of the line should also be stripped out. **Example:** Given an input string of: ``` apples, pears # and bananas grapes bananas !apples ``` The output expected would be: ``` apples, pear...
["def solution(string,markers):\n parts = string.split('\\n')\n for s in markers:\n parts = [v.split(s)[0].rstrip() for v in parts]\n return '\\n'.join(parts)", "def strip_line(line, markers):\n for m in markers:\n if m in line:\n line = line[:line.index(m)]\n return line.rstrip(...
{"fn_name": "solution", "inputs": [["apples, pears # and bananas\ngrapes\nbananas !apples", ["#", "!"]], ["a #b\nc\nd $e f g", ["#", "$"]], ["apples, pears # and bananas\ngrapes\nbananas !#apples", ["#", "!"]], ["apples, pears # and bananas\ngrapes\nbananas #!apples", ["#", "!"]], ["apples, pears # and bananas\ngrapes\...
INTERVIEW
PYTHON3
CODEWARS
2,514
def solution(string,markers):
0d7a3382c3f7954653bbbd45d8f05ce5
UNKNOWN
# Connect Four Take a look at wiki description of Connect Four game: [Wiki Connect Four](https://en.wikipedia.org/wiki/Connect_Four) The grid is 6 row by 7 columns, those being named from A to G. You will receive a list of strings showing the order of the pieces which dropped in columns: ```python pieces_positio...
["COLUMNS, ROWS = 'ABCDEFG', range(6)\nLINES = [{(COLUMNS[i+k], ROWS[j]) for k in range(4)}\n for i in range(len(COLUMNS) - 3) for j in range(len(ROWS))] \\\n + [{(COLUMNS[i], ROWS[j+k]) for k in range(4)}\n for i in range(len(COLUMNS)) for j in range(len(ROWS) - 3)] \\\n + [{(COLUMNS[...
{"fn_name": "who_is_winner", "inputs": [[["C_Yellow", "E_Red", "G_Yellow", "B_Red", "D_Yellow", "B_Red", "B_Yellow", "G_Red", "C_Yellow", "C_Red", "D_Yellow", "F_Red", "E_Yellow", "A_Red", "A_Yellow", "G_Red", "A_Yellow", "F_Red", "F_Yellow", "D_Red", "B_Yellow", "E_Red", "D_Yellow", "A_Red", "G_Yellow", "D_Red", "D_Ye...
INTERVIEW
PYTHON3
CODEWARS
14,160
def who_is_winner(pieces_position_list):
243df11b998ef602aad7268d3043619e
UNKNOWN
### Lyrics... Pyramids are amazing! Both in architectural and mathematical sense. If you have a computer, you can mess with pyramids even if you are not in Egypt at the time. For example, let's consider the following problem. Imagine that you have a pyramid built of numbers, like this one here: ``` /3/ \7\ 4 2...
["def longest_slide_down(p):\n res = p.pop()\n while p:\n tmp = p.pop()\n res = [tmp[i] + max(res[i],res[i+1]) for i in range(len(tmp))] \n return res.pop()", "def longest_slide_down(pyr):\n for row in range(len(pyr)-1, 0, -1):\n for col in range(0, row):\n pyr[row-1][col] +...
{"fn_name": "longest_slide_down", "inputs": [[[[3], [7, 4], [2, 4, 6], [8, 5, 9, 3]]], [[[75], [95, 64], [17, 47, 82], [18, 35, 87, 10], [20, 4, 82, 47, 65], [19, 1, 23, 75, 3, 34], [88, 2, 77, 73, 7, 63, 67], [99, 65, 4, 28, 6, 16, 70, 92], [41, 41, 26, 56, 83, 40, 80, 70, 33], [41, 48, 72, 33, 47, 32, 37, 16, 94, 29]...
INTERVIEW
PYTHON3
CODEWARS
2,916
def longest_slide_down(pyramid):
a1cc0f6ce802cd8bdb2a9da1c7bc139f
UNKNOWN
In this kata we want to convert a string into an integer. The strings simply represent the numbers in words. Examples: * "one" => 1 * "twenty" => 20 * "two hundred forty-six" => 246 * "seven hundred eighty-three thousand nine hundred and nineteen" => 783919 Additional Notes: * The minimum number is "zero" (inclusiv...
["words = {w: n for n, w in enumerate('zero one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen'.split())}\nwords.update({w: 10 * n for n, w in enumerate('twenty thirty forty fifty sixty seventy eighty ninety hundred'.split(), 2)})\nthousands = {w...
{"fn_name": "parse_int", "inputs": [["zero"], ["one"], ["two"], ["three"], ["four"], ["five"], ["six"], ["seven"], ["eight"], ["nine"], ["ten"], ["twenty"], ["twenty-one"], ["thirty-seven"], ["forty-six"], ["fifty-nine"], ["sixty-eight"], ["seventy-two"], ["eighty-three"], ["ninety-four"], ["one hundred"], ["one hundre...
INTERVIEW
PYTHON3
CODEWARS
14,637
def parse_int(string):
e587a3790b1935e2a1cc199558729732
UNKNOWN
Create a function that differentiates a polynomial for a given value of `x`. Your function will receive 2 arguments: a polynomial as a string, and a point to evaluate the equation as an integer. ## Assumptions: * There will be a coefficient near each `x`, unless the coefficient equals `1` or `-1`. * There will be an...
["from collections import defaultdict\nimport re\n\nP = re.compile(r'\\+?(-?\\d*)(x\\^?)?(\\d*)')\n\ndef differentiate(eq, x):\n \n derivate = defaultdict(int)\n for coef,var,exp in P.findall(eq):\n exp = int(exp or var and '1' or '0')\n coef = int(coef!='-' and coef or coef and '-1' or '1')\n ...
{"fn_name": "differentiate", "inputs": [["12x+2", 3], ["x-66", 3], ["x^2-x", 3], ["-5x^2+10x+4", 3], ["x^2+3x+3", 3], ["1000x^2+300x+200", 531], ["21x^2+35x+3", 2071], ["66x^3+3x^2+3", 441], ["21x^4+3x^3", 414], ["-21x^5+3x^3", 12398], ["-x^2+3x-3", 1234567908], ["-7x^5+22x^4-55x^3-94x^2+87x-56", -3], ["-123x^5+3x", 85...
INTERVIEW
PYTHON3
CODEWARS
5,329
def differentiate(equation, point):
4ac245b90ad51d6f6327e17bb0f59a42
UNKNOWN
My little sister came back home from school with the following task: given a squared sheet of paper she has to cut it in pieces which, when assembled, give squares the sides of which form an increasing sequence of numbers. At the beginning it was lot of fun but little by little we were tired of seeing the pile of torn ...
["def decompose(n):\n total = 0\n answer = [n]\n while len(answer):\n temp = answer.pop()\n total += temp ** 2\n for i in range(temp - 1, 0, -1):\n if total - (i ** 2) >= 0:\n total -= i ** 2\n answer.append(i)\n if total == 0:\n ...
{"fn_name": "decompose", "inputs": [[12], [6], [50], [44], [625], [5], [7100], [123456], [1234567], [7654321], [4], [7654322]], "outputs": [[[1, 2, 3, 7, 9]], [null], [[1, 3, 5, 8, 49]], [[2, 3, 5, 7, 43]], [[2, 5, 8, 34, 624]], [[3, 4]], [[2, 3, 5, 119, 7099]], [[1, 2, 7, 29, 496, 123455]], [[2, 8, 32, 1571, 1234566]]...
INTERVIEW
PYTHON3
CODEWARS
3,077
def decompose(n):
84296b28b079466eab2ba5c8b026b510
UNKNOWN
This kata generalizes [Twice Linear](https://www.codewars.com/kata/5672682212c8ecf83e000050). You may want to attempt that kata first. ## Sequence Consider an integer sequence `U(m)` defined as: 1. `m` is a given non-empty set of positive integers. 2. `U(m)[0] = 1`, the first number is always 1. 3. For each `x` in `...
["from heapq import *\n\ndef n_linear(ms, n):\n lst = [1] * (n+1)\n q = [(1+v,v,1) for v in ms]\n heapify(q)\n for i in range(1,n+1):\n v,x,j = heappop(q)\n lst[i] = v\n heappush(q, (lst[j]*x+1, x, j+1) )\n while q[0][0]==lst[i]:\n v,x,j = heappop(q)\n he...
{"fn_name": "n_linear", "inputs": [[[2, 3], 0], [[3, 2, 5], 0], [[2, 3], 1], [[2, 3], 2], [[2, 3], 3], [[2, 3], 4], [[2, 3], 5], [[2, 3], 6], [[2, 3], 7], [[2, 3], 8], [[2, 3], 9], [[2, 3], 10], [[2, 3], 11], [[2, 3], 12], [[2, 3], 13], [[2, 3], 14], [[2, 3], 15], [[2, 3], 16], [[2, 3], 17], [[2, 3], 18], [[2, 3], 19],...
INTERVIEW
PYTHON3
CODEWARS
3,585
def n_linear(m,n):