question stringlengths 0 30.2k | answer stringlengths 55 2.44k |
|---|---|
<line-1># cook your dish here</line-1>
<line-3>from math import gcd</line-3>
<line-4>def fac50():</line-4>
<line-5> f = [0]*51</line-5>
<line-6> f[0] ,f[1] = 1,1</line-6>
<line-7> for i in range(1,51):f[i] = (f[i-1]*i)%mod</line-7>
<line-8> return f</line-8>
<line-9>def gcd110():</line-9>
<line-10> gc = ... | {"code": "<line-2>mod = 10**9 + 7</line-2>\n<line-49>def __starting_point():main()</line-49>", "lines": [2, 49]}
#### 0 |
<line-1>#!/usr/bin/env python</line-1>
<line-2></line-2>
<line-4> EXPLORED_NODES.add(v)</line-4>
<line-5> r = False</line-5>
<line-6> for e in [x for x in E if v in x]:</line-6>
<line-7> if e in EXPLORED_EDGES: continue</line-7>
<line-8> if e[0] == v: w = e[1]</line-8>
<line-9> else: w = e[0]</line-9>
<line-... | {"code": "<line-3>def iscycle(E, v, EXPLORED_NODES, EXPLORED_EDGES):</line-3>\n<line-28> print(process(E))</line-28>", "lines": [3, 28]}
#### 0 |
<line-1>t=int(input())</line-1>
<line-3> s=input().split()</line-3>
<line-4> m=int(s[0])</line-4>
<line-5> p=float(s[1])</line-5>
<line-6> if(m%2==0):</line-6>
<line-7> r=(1-p**m)/(p+1)</line-7>
<line-8> else:</line-8>
<line-9> r=(1+p**m)/(p+1)</line-9>
<line-11> t-=1</line-11> | {"code": "<line-2>while(t):</line-2>\n<line-10> print(1000000000*r,1000000000*(1-r))</line-10>", "lines": [2, 10]}
#### 0 |
<line-1>def dfs(node):</line-1>
<line-3> val=0</line-3>
<line-4> flag=0</line-4>
<line-5> for i in adj[node]:</line-5>
<line-6> x= dfs(i)</line-6>
<line-7> val+=x</line-7>
<line-8> if x==0:</line-8>
<line-9> flag=1</line-9>
<line-10> leaf+=val-val%3</line-10>
<line-11> if val%3==0 and flag==0:</line-11>
<line-12> ... | {"code": "<line-2> nonlocal adj,leaf</line-2>\n<line-25> dfs(1)</line-25>", "lines": [2, 25]}
#### 0 |
<line-1># cook your dish here</line-1>
<line-2></line-2>
<line-4></line-4>
<line-5>def shortestSubarray(A, K):</line-5>
<line-6> </line-6>
<line-7> </line-7>
<line-8> N = len(A)</line-8>
<line-9> P = [0]</line-9>
<line-10></line-10>
<line-11> for x in A:</line-11>
<line-12> P.append(P[-1] + x)</line-12>
<line-13... | {"code": "<line-3>import collections</line-3>\n<line-35> A = [int(x) for x in input().split()] </line-35>", "lines": [3, 35]}
#### 0 |
<line-1># cook your dish here</line-1>
<line-3>def isPos(num):</line-3>
<line-4> if num%2==0:</line-4>
<line-5> for i in range(num,2*num,1):</line-5>
<line-6> if ((num**2)-((i/2)**2))**(1/2)==int(((num**2)-((i/2)**2))**(1/2)):</line-6>
<line-7> return 'YES'</line-7>
<line-8> return 'NO'</line-8>
<line-9> else:</... | {"code": "<line-2>import math</line-2>\n<line-17> num=int(input())</line-17>", "lines": [2, 17]}
#### 0 |
<line-1># cook your dish here</line-1>
<line-3>for i in range(t):</line-3>
<line-4> (n,k,e,m)=tuple(map(int,input().split()))</line-4>
<line-5> scores=[]</line-5>
<line-6> for j in range(n-1):</line-6>
<line-7> scores.append(sum(list(map(int,input().split()))))</line-7>
<line-8> scores.sort(reverse=True);</line-8>
<li... | {"code": "<line-2>t=int(input())</line-2>\n<line-16> else:</line-16>", "lines": [2, 16]}
#### 0 |
<line-1># # # # n = int(input())</line-1>
<line-3># # # # for _ in range(int(input())):</line-3>
<line-4># # # # l,r,mod = map(int , input().split())</line-4>
<line-5># # # # pro = 1</line-5>
<line-6># # # # for i in range(l - 1,r):</line-6>
<line-7># # # # pro *= arr[i]</line-7>
<line-8># # # # print(pro % mod) ... | {"code": "<line-2># # # # arr = list(map(int , input().split()))</line-2>\n<line-115> main()</line-115>", "lines": [2, 115]}
#### 0 |
<line-1>t = int(input())</line-1>
<line-3> n = int(input())</line-3>
<line-4> suffixes = {}</line-4>
<line-5> xx = input().split()</line-5>
<line-6> for x in range(n):</line-6>
<line-7> try:</line-7>
<line-8> a = suffixes[xx[x][-3:]]</line-8>
<line-9> except Exception as e:</line-9>
<line-10> a = []</line-10>
<li... | {"code": "<line-2>for i in range(t):</line-2>\n<line-16> for a in sorted(suffixes):</line-16>", "lines": [2, 16]}
#### 0 |
<line-1>n=int(input())</line-1>
<line-3>l=[1]*n</line-3>
<line-4>if sorted(arr)==arr:</line-4>
<line-5> print('0')</line-5>
<line-6>else:</line-6>
<line-7> for i in range(0,len(arr)):</line-7>
<line-8> for j in range(i):</line-8>
<line-9> if arr[i]>=arr[j] and l[i]<l[j]+1:</line-9>
<line-11> ... | {"code": "<line-2>arr=[int(x) for x in input().split()]</line-2>\n<line-10> l[i]=l[j]+1</line-10>", "lines": [2, 10]}
#### 0 |
<line-1>import sys</line-1>
<line-3>n = int(n)</line-3>
<line-4>x = int(x)</line-4>
<line-5>y = int(y)</line-5>
<line-6>contests = {}</line-6>
<line-7></line-7>
<line-8>for i in range(n):</line-8>
<line-9> s, e = input().split(' ')</line-9>
<line-10> s = int(s)</line-10>
<line-11> e = int(e)</line-11>
<line-12> contest... | {"code": "<line-2>n, x, y = input().split(' ')</line-2>\n<line-40> break</line-40>", "lines": [2, 40]}
#### 0 |
<line-1>testcases=int(input())</line-1>
<line-3>for i in range(0,testcases):</line-3>
<line-4> friends=int(input())</line-4>
<line-5> l,b=list(map(int,input().split()))</line-5>
<line-6> over=False</line-6>
<line-7> if b>l:</line-7>
<line-8> temp=b</line-8>
<line-9> b=l</line-9>
<line-10> l=temp</line-10>
<line-11> ... | {"code": "<line-2>results=[]</line-2>\n<line-27>for i in range(0,testcases):</line-27>", "lines": [2, 27]}
#### 0 |
<line-1># cook your dish here</line-1>
<line-3> n = int(input())</line-3>
<line-4> l = list(map(int,input().split()))</line-4>
<line-5> s = 0</line-5>
<line-6> l.sort(reverse = True)</line-6>
<line-7> for i in range(0,n,2):</line-7>
<line-9> print(s)</line-9> | {"code": "<line-2>for i in range(int(input())):</line-2>\n<line-8> s = s+l[i]</line-8>", "lines": [2, 8]}
#### 0 |
<line-1>import sys</line-1>
<line-2></line-2>
<line-4> votes = {}</line-4>
<line-5> for x in range(p):</line-5>
<line-6> str = sys.stdin.readline()</line-6>
<line-7> t = str.split()</line-7>
<line-8> votes[t[0]] = t[1]</line-8>
<line-9></line-9>
<line-10> ans = 0</line-10>
<line-11> for per in votes:</line... | {"code": "<line-3>def f(p):</line-3>\n<line-21> p = sys.stdin.readline()</line-21>", "lines": [3, 21]}
#### 0 |
<line-1># cook your dish here</line-1>
<line-3>Input:</line-3>
<line-4>The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.</line-4>
<line-5>The first line of each test case contains three space-separated integers p, q and r.</line-5>
<line-... | {"code": "<line-2>\"\"\"</line-2>\n<line-35> else:</line-35>", "lines": [2, 35]}
#### 0 |
<line-1>from collections import Counter</line-1>
<line-3>def nc3(n):</line-3>
<line-4> a=factorial(n)</line-4>
<line-5> b=factorial(n-3)</line-5>
<line-6> return ((a)/(b*6))</line-6>
<line-7>def rem(s,k):</line-7>
<line-8> t=-1</line-8>
<line-9> x=-1</line-9>
<line-10> for i in range(len(s)):</line-10... | {"code": "<line-2>from math import factorial</line-2>\n<line-47> re=re+nc3(i[0])</line-47>", "lines": [2, 47]}
#### 0 |
<line-1>for _ in range(int(input())):</line-1>
<line-3> n1=0</line-3>
<line-4> ans=1</line-4>
<line-5> while(n>0):</line-5>
<line-6> d=int(n % 10)</line-6>
<line-7> if(d!=0):</line-7>
<line-8> if(d!=9 and d!=7 and d!=1):</line-8>
<line-9> n1=3</line-9>
<line-10> elif(d==1):</line-10>
<line-11> n1=1</line-11... | {"code": "<line-2> n=int(input())</line-2>\n<line-20> else:</line-20>", "lines": [2, 20]}
#### 0 |
<line-1>import sys</line-1>
<line-3>r=int(input())</line-3>
<line-4>for v in range (0,r):</line-4>
<line-5> n = int(input())</line-5>
<line-6> x=1</line-6>
<line-7> arr=list(map(int,input().strip().split(" ")))</line-7>
<line-8> for i in range (0,n):</line-8>
<line-9> x=x*arr[i]</line-9>
<line-10> </line-10>
<line-11... | {"code": "<line-2>import math</line-2>\n<line-14> break</line-14>", "lines": [2, 14]}
#### 0 |
<line-1># cook your dish here</line-1>
<line-3>MOD=int(1e9+7)</line-3>
<line-4>for t in range(T):</line-4>
<line-5> N,K=[int(a) for a in input().split()]</line-5>
<line-6> M=K//2</line-6>
<line-7> # ans= ((K%2)?( (N+M)*(N+M) + M ):( (N+M)*(N+M) - M) )</line-7>
<line-8> ans=(N+M)*(N+M) -M</line-8>
<line-9> ... | {"code": "<line-2>T=int(input())</line-2>\n<line-12> ans=K*(K-1)</line-12>", "lines": [2, 12]}
#### 0 |
<line-1>for i in range(int(input())):</line-1>
<line-3> c=[int(z) for z in input().split()]</line-3>
<line-4> c.sort()</line-4>
<line-5> c.reverse()</line-5>
<line-6> b1,b2=0,0</line-6>
<line-7> for i in range(n):</line-7>
<line-8> if b1<b2:</line-8>
<line-9> b1+=c[i]</line-9>
<line-10> elif b2<b1:</line-10>
<line-... | {"code": "<line-2> n=int(input())</line-2>\n<line-13> b1+=c[i]</line-13>", "lines": [2, 13]}
#### 0 |
<line-1>'''Well I found the bug, but I don't understand why it was doing that. I mean, as</line-1>
<line-3>Note to self: deleting from (supposedly) local lists through recursion is dangerous!'''</line-3>
<line-4></line-4>
<line-5>class Group(object):</line-5>
<line-6> def __init__(self,size,start,end,value):</line-6... | {"code": "<line-2>far as I can tell, it shouldn't be a bug!</line-2>\n<line-70> groups.sort()</line-70>", "lines": [2, 70]}
#### 0 |
<line-1># cook your dish here</line-1>
<line-3>from math import sqrt,ceil,log10</line-3>
<line-4>def get_sum(a,b,digits):</line-4>
<line-5> sum=((b+a)*(b-a+1))//2</line-5>
<line-6> return sum*digits</line-6>
<line-7></line-7>
<line-8>def solve():</line-8>
<line-9> mod=10**9+7</line-9>
<line-10> thehighlimit... | {"code": "<line-2>from sys import stdin</line-2>\n<line-27> solve()</line-27>", "lines": [2, 27]}
#### 0 |
<line-1>N,M,K=map(int,input().split())</line-1>
<line-3>for i in range(N):</line-3>
<line-4> T=list(map(int,input().split()))</line-4>
<line-5> Q=T[-1]</line-5>
<line-6> T.pop(-1)</line-6>
<line-7> if Q<=10 and sum(T)>=M:</line-7>
<line-9>print(c)</line-9> | {"code": "<line-2>c=0</line-2>\n<line-8> c+=1</line-8>", "lines": [2, 8]}
#### 0 |
<line-1>import math</line-1>
<line-3> n = int(input())</line-3>
<line-4> temp = math.sqrt(n)</line-4>
<line-5> if (temp == int(temp)):</line-5>
<line-6> print("YES")</line-6>
<line-8> print("NO")</line-8> | {"code": "<line-2>for t in range(int(input())):</line-2>\n<line-7> else:</line-7>", "lines": [2, 7]}
#### 0 |
<line-1># cook your dish here</line-1>
<line-3> n=int(input());li=list(map(int,input().split()));dli=dict();modi=0</line-3>
<line-4> for i in li:</line-4>
<line-5> if i not in dli:dli[i]=1</line-5>
<line-6> else:dli[i]+=1</line-6>
<line-7> op=sorted(list(dli))</line-7>
<line-8> if(len(dli)!=0):</lin... | {"code": "<line-2>for _ in range(int(input())):</line-2>\n<line-17> if(l==0):break</line-17>", "lines": [2, 17]}
#### 0 |
<line-1># cook your dish here</line-1>
<line-3> n=int(input())</line-3>
<line-4> a=list(map(int,input().split()))</line-4>
<line-5> even=[]</line-5>
<line-6> odd=[]</line-6>
<line-7> for i in a:</line-7>
<line-8> if(i & 1):</line-8>
<line-9> even.append(i)</line-9>
<line-10> else:</line-10>
<line-12> print(len(even... | {"code": "<line-2>for _ in range(int(input())):</line-2>\n<line-11> odd.append(i)</line-11>", "lines": [2, 11]}
#### 0 |
<line-1># cook your dish here</line-1>
<line-3> n = int(input())</line-3>
<line-4> m = n</line-4>
<line-5> x= 1</line-5>
<line-6> for i in range(n):</line-6>
<line-7> for j in range(m):</line-7>
<line-8> print(x, end = '')</line-8>
<line-9> x += 1</line-9>
<line-11> m -= ... | {"code": "<line-2>for _ in range(int(input())):</line-2>\n<line-10> print()</line-10>", "lines": [2, 10]}
#### 0 |
<line-1>t = input();</line-1>
<line-2></line-2>
<line-4></line-4>
<line-5>i = 0;</line-5>
<line-6></line-6>
<line-7>while i < int(t):</line-7>
<line-8></line-8>
<line-9> n = input();</line-9>
<line-10></line-10>
<line-11> k = input();</line-11>
<line-12></line-12>
<line-13> assert(len(k.split(' ')) == int(n));</line-13... | {"code": "<line-3>a = [0 for i in range(10001)]</line-3>\n<line-34>\ti += 1;</line-34>", "lines": [3, 34]}
#### 0 |
<line-1>T=int(input())</line-1>
<line-3> N=int(input())</line-3>
<line-4> A=list(map(int,input().split()))[:N]</line-4>
<line-5> l=[]</line-5>
<line-6> for j in range(len(A)):</line-6>
<line-7> for k in range(j+1,len(A)):</line-7>
<line-9> print(l.count(max(l))/((N*(N-1))/2))</line-9> | {"code": "<line-2>for i in range(T):</line-2>\n<line-8> l.append(A[j]+A[k])</line-8>", "lines": [2, 8]}
#### 0 |
<line-1>T = int(input())</line-1>
<line-2></line-2>
<line-4></line-4>
<line-5>for _ in range(T):</line-5>
<line-6> N = int(input())</line-6>
<line-7></line-7>
<line-8> A = list(map(int, input().split()))</line-8>
<line-9></line-9>
<line-10> if N == 1:</line-10>
<line-11> print(0)</line-11>
<line-12> continue</line-12... | {"code": "<line-3>M = 10 ** 9 + 7</line-3>\n<line-106> ans %= M</line-106>", "lines": [3, 106]}
#### 0 |
<line-1>from collections import defaultdict </line-1>
<line-3> </line-3>
<line-4> # Dictionary to store number of subarrays </line-4>
<line-5> # starting from index zero having </line-5>
<line-6> # particular value of sum. </line-6>
<line-7> prevSum = defaultdict(lambda : 0) </line-7>
<line-8> </line-8>
<line-9> re... | {"code": "<line-2>def findSubarraySum(arr, n, Sum): </line-2>\n<line-46>else: </line-46>", "lines": [2, 46]}
#### 0 |
<line-1>import numpy as np</line-1>
<line-2></line-2>
<line-4> new_list = []</line-4>
<line-5> for i in range(len(array)):</line-5>
<line-6> start = 0</line-6>
<line-7> value = array[i][0]</line-7>
<line-8> last = len(new_list)</line-8>
<line-9> while start != last:</line-9>
<line-10> ... | {"code": "<line-3>def sort_it(array):</line-3>\n<line-50> print(output[i], end = \" \")</line-50>", "lines": [3, 50]}
#### 0 |
<line-1>'''</line-1>
<line-3>codechef id :mj_13</line-3>
<line-4>Problem : Avenir Strings</line-4>
<line-5>'''</line-5>
<line-6>from sys import stdin,stdout</line-6>
<line-7>test=int(stdin.readline())</line-7>
<line-8>for _ in range(test):</line-8>
<line-9> N=int(stdin.readline())</line-9>
<line-10> seq=list(input())</... | {"code": "<line-2>Name : Jaymeet Mehta</line-2>\n<line-19> fl1=1-fl1</line-19>", "lines": [2, 19]}
#### 0 |
<line-1>#dt = {} for i in x: dt[i] = dt.get(i,0)+1</line-1>
<line-3>inp,ip = lambda :int(input()),lambda :[int(w) for w in input().split()]</line-3>
<line-4></line-4>
<line-5>def kadane(arr, start, finish, n):</line-5>
<line-6> Sum = 0</line-6>
<line-7> maxSum = float('-inf')</line-7>
<line-8> i = None</line-8... | {"code": "<line-2>import sys;input = sys.stdin.readline</line-2>\n<line-62>M = [ip() for i in range(ROW)]</line-62>", "lines": [2, 62]}
#### 0 |
<line-1>#AUTHOR:: AMAN VERMA</line-1>
<line-3> for _ in range(int(input())):</line-3>
<line-4> row,column=list(map(int,input().split(" ")))</line-4>
<line-5> x_x,y_y=list(map(int,input().split(" ")))</line-5>
<line-6> ab=max((x_x-0),(row-x_x-1))</line-6>
<line-7> ba=max((y_y-0),(column-y_y-1))</line-7>
<line-8> pr... | {"code": "<line-2>try:</line-2>\n<line-9>except:</line-9>", "lines": [2, 9]}
#### 0 |
<line-1># cook your dish here</line-1>
<line-3>while t>0:</line-3>
<line-4> a=input().split(":")</line-4>
<line-5> a1=int(a[0])</line-5>
<line-6> a2=int(a[1])</line-6>
<line-7> b1=a1%12 </line-7>
<line-8> if a2%5!=0:</line-8>
<line-9> b2=(a2//5)*5+5</line-9>
<line-10> else:</line-10>
<line-11> b2=a2</line-11>
<line-1... | {"code": "<line-2>t=int(input())</line-2>\n<line-35> print(y)</line-35>", "lines": [2, 35]}
#### 0 |
<line-1># cook your dish here</line-1>
<line-3> try:</line-3>
<line-4> m=int(input())</line-4>
<line-5> </line-5>
<line-6> n=int(m/2)</line-6>
<line-7> </line-7>
<line-8> a=m-n</line-8>
<line-9> </line-9>
<line-10> sum_even= int(2*(2*n*(n+1)*(2*n+1))/3)</line-10>
<line-11> </line-11>
<line-12> sum_odd= int(((4*... | {"code": "<line-2>while True:</line-2>\n<line-20>\texcept:</line-20>", "lines": [2, 20]}
#### 0 |
<line-1># cook your dish here</line-1>
<line-3>from math import ceil</line-3>
<line-4></line-4>
<line-5></line-5>
<line-6>def solve():</line-6>
<line-7> for _ in range(int(input())):</line-7>
<line-8> n, m = map(int, stdin.readline().split())</line-8>
<line-9> par = [i for i in range(n)]</line-9>
<line... | {"code": "<line-2>from sys import stdin, stdout</line-2>\n<line-29> solve()</line-29>", "lines": [2, 29]}
#### 0 |
<line-1># cook your dish here</line-1>
<line-3>t=int(input())</line-3>
<line-4>for _ in range(t):</line-4>
<line-5> n,p,q=list(map(int,input().split(" ")))</line-5>
<line-6> l=list(map(int,input().split(" ")))</line-6>
<line-7> l.sort()</line-7>
<line-8> s=sum(l)</line-8>
<line-9> a=p+2*q</line-9>
<line-10> b=0</line-1... | {"code": "<line-2># cook your dish here</line-2>\n<line-27> p=p-1</line-27>", "lines": [2, 27]}
#### 0 |
<line-2>for _ in range(int(input())):</line-2>
<line-3> n=list(map(int,input().split()))</line-3>
<line-4> print(n[0]*n[1])</line-4> | {"code": "<line-1># cook your dish here</line-1>", "lines": [1]}
#### 0 |
<line-2> n=int(input())</line-2>
<line-3> print((2*(pow(n,2)))-n+1)</line-3>
<line-4></line-4> | {"code": "<line-1>for _ in range(int(input())):</line-1>", "lines": [1]}
#### 0 |
<line-1># cook your dish here</line-1>
<line-3>for i in range(x):</line-3>
<line-4> y = list(map(str, input().split()))</line-4>
<line-5> j= 0</line-5>
<line-6> while j<len(y)-1:</line-6>
<line-7> print((y[j][0]).capitalize()+".", end=' ')</line-7>
<line-9> print(y[len(y)-1].capitalize())</line-9> | {"code": "<line-2>x= int(input())</line-2>\n<line-8> j+= 1</line-8>", "lines": [2, 8]}
#### 0 |
<line-1>import sys</line-1>
<line-2></line-2>
<line-4>for j in range(t):</line-4>
<line-5> n = eval(input())</line-5>
<line-6> a = list(map(int, input().split()))</line-6>
<line-7> ch = 0</line-7>
<line-8> sm = 0 ; x = sum(a)</line-8>
<line-9> s1 = [0] * n ; s2 = [0] * n</line-9>
<line-10> for i in range(n):</line-10>
... | {"code": "<line-3>t = eval(input())</line-3>\n<line-28> else:</line-28>", "lines": [3, 28]}
#### 0 |
<line-1>def fastpow(base, power):</line-1>
<line-3> while power > 0:</line-3>
<line-4> if power % 2 == 0:</line-4>
<line-5> power = power // 2</line-5>
<line-6></line-6>
<line-7> base = base * base</line-7>
<line-8> else:</line-8>
<line-9> power = power - 1</line-9>
<line-10> result = result * base</line-10>
... | {"code": "<line-2> result = 1</line-2>\n<line-19> w=(n*(fastpow(n-1,r)))%((10**9)+7)</line-19>", "lines": [2, 19]}
#### 0 |
<line-1>for _ in range(int(input())):</line-1>
<line-3> arr=list(map(int,input().split()))</line-3>
<line-4> risk=0</line-4>
<line-5> days_risk=0</line-5>
<line-6> days_norm=0</line-6>
<line-7> if d==1:</line-7>
<line-8> print(f)</line-8>
<line-9> else:</line-9>
<line-10> for a in arr:</line-10>
<line-11> if a>=80 ... | {"code": "<line-2> f,d=list(map(int,input().split()))</line-2>\n<line-21> days_norm=(norm//d)+1</line-21>", "lines": [2, 21]}
#### 0 |
<line-1>for _ in range(int(input())):</line-1>
<line-3> a=list(map(int,input().split()))</line-3>
<line-4> dp=[0]*(max(a)+1)</line-4>
<line-5> for _ in range(n):</line-5>
<line-6> dp[a[_]]+=1</line-6>
<line-7> for _ in range(1,len(dp)):</line-7>
<line-8> if dp[_]>k:</line-8>
<line-10> print... | {"code": "<line-2> n,k=[int(x) for x in input().split()]</line-2>\n<line-9> print(_,end=\" \")</line-9>", "lines": [2, 9]}
#### 0 |
<line-1>mod = 1000000007</line-1>
<line-3>maxn = (10**5)+5</line-3>
<line-4>for i in range(2,maxn):</line-4>
<line-5> x = (fac[-1]*i)%mod</line-5>
<line-6> fac.append(x)</line-6>
<line-7></line-7>
<line-8>pre = [1]</line-8>
<line-9>for i in range(2,maxn):</line-9>
<line-10> x = 2*i-1</line-10>
<line-11> x =... | {"code": "<line-2>fac = [1,1]</line-2>\n<line-17> y = pre[n-1]</line-17>", "lines": [2, 17]}
#### 0 |
<line-1>from sys import stdin,stdout</line-1>
<line-3>nmbr=lambda:int(stdin.readline())</line-3>
<line-4>lst=lambda:list(map(int, stdin.readline().split()))</line-4>
<line-5></line-5>
<line-6>for _ in range(nmbr()):</line-6>
<line-7> n=nmbr()</line-7>
<line-8> a=lst()</line-8>
<line-9> g=a[0]</line-9>
<line-10> ans=0</... | {"code": "<line-2>from math import gcd</line-2>\n<line-14> ans+=i//g</line-14>", "lines": [2, 14]}
#### 0 |
<line-1>t=int(input())</line-1>
<line-3> n,m=list(map(int,input().split()))</line-3>
<line-4> a=list(map(int,input().split()))</line-4>
<line-5> army=0</line-5>
<line-6> if n>m:</line-6>
<line-7> </line-7>
<line-8> for i in range(0,m):</line-8>
<line-9> army+=a[i]</line-9>
<line-10> </line-10>
<line-11> </line-... | {"code": "<line-2>for i in range(t):</line-2>\n<line-22> if n<=m:</line-22>", "lines": [2, 22]}
#### 0 |
<line-1># cook your dish here</line-1>
<line-3>while t!=0:</line-3>
<line-4> n,k=map(int,input().split())</line-4>
<line-5> lst=[]</line-5>
<line-6> for i in range(1,n+1):</line-6>
<line-7> lst.append(i)</line-7>
<line-8> lst[k],lst[n-1]=lst[n-1],lst[k]</line-8>
<line-9> for item in lst:</line-9>
<line-11> t-=1</line-... | {"code": "<line-2>t=int(input())</line-2>\n<line-10> print(item,end=' ')</line-10>", "lines": [2, 10]}
#### 0 |
<line-1></line-1>
<line-2>t = int(input())</line-2>
<line-3></line-3>
<line-5> n,m = map(int,input().split())</line-5>
<line-6></line-6>
<line-7> if n==1:</line-7>
<line-8> print(m)</line-8>
<line-9> else:</line-9>
<line-10> </line-10>
<line-11> if n%2==0:</line-11>
<line-12> pr... | {"code": "<line-4>for _ in range(t):</line-4>\n<line-14> else:</line-14>", "lines": [4, 14]}
#### 0 |
<line-1>test = int(input())</line-1>
<line-3>for i in range(test):</line-3>
<line-4> n = int(input())</line-4>
<line-5> items = sorted(list(map(int, input().split())))</line-5>
<line-6> c = 1</line-6>
<line-7> for j in range(len(items)):</line-7>
<line-8> if items[j] < 2000:</line-8>
<line-9> t = 2000 - items[j]</li... | {"code": "<line-2>ANS = list()</line-2>\n<line-20>for ans in ANS:</line-20>", "lines": [2, 20]}
#### 0 |
<line-1>a=eval(input())</line-1>
<line-3></line-3>
<line-4> x=eval(input())</line-4>
<line-5> b=list(map(int,input().split()))</line-5>
<line-6> z=[0]*100</line-6>
<line-7> k=1</line-7>
<line-8> j=0</line-8>
<line-9> c=0</line-9>
<line-10> for i in b:</line-10>
<line-11> </line-11>
<line-12> if i==0:</line-12>
<line-... | {"code": "<line-2>while(a):</line-2>\n<line-36> print(c)</line-36>", "lines": [2, 36]}
#### 0 |
<line-1>t = int(input())</line-1>
<line-3> s = input().strip()</line-3>
<line-4> if not s:</line-4>
<line-5> print('NO')</line-5>
<line-6></line-6>
<line-7> dp = [0 for x in range(len(s) + 1)]</line-7>
<line-8> dp[0] = 1</line-8>
<line-9> dp[1] = 1 if 0 < int(s[0]) <= 9 else 0</line-9>
<line-10></line-10>
<line-11> fo... | {"code": "<line-2>while t>0:</line-2>\n<line-20> print('NO')</line-20>", "lines": [2, 20]}
#### 0 |
<line-1>for _ in range(int(input())):</line-1>
<line-3> b = bin(idx)[2:]</line-3>
<line-5> print(int(b, 2))</line-5> | {"code": "<line-2> p, idx = map(int, input().split())</line-2>\n<line-4> b = ('0' * (p - len(b)) + b)[::-1]</line-4>", "lines": [2, 4]}
#### 0 |
<line-1>try:</line-1>
<line-3> t=int(t)</line-3>
<line-4> m=list(m)</line-4>
<line-5> letters=list("abcdefghijklmnopqrstuvwxyz")</line-5>
<line-6> trans={}</line-6>
<line-7> for i in range(len(letters)):</line-7>
<line-8> trans[letters[i]]=m[i]</line-8>
<line-9> for i in range(t):</line-9>
<line-10> x=list(input())</... | {"code": "<line-2> t,m=input().split()</line-2>\n<line-23> print(y)</line-23>", "lines": [2, 23]}
#### 0 |
<line-1>arr=[]</line-1>
<line-3>for i in range(n):</line-3>
<line-4> a=int(input())</line-4>
<line-5> arr.append(a)</line-5>
<line-6> arr.sort()</line-6>
<line-8> print((i-p)+1)</line-8> | {"code": "<line-2>n=int(input())</line-2>\n<line-7> p=arr.index(a)</line-7>", "lines": [2, 7]}
#### 0 |
<line-1># cook your dish here</line-1>
<line-3> </line-3>
<line-4> # Corner cases </line-4>
<line-5> if (n <= 1) : </line-5>
<line-6> return False</line-6>
<line-7> if (n <= 3) : </line-7>
<line-8> return True</line-8>
<line-9> </line-9>
<line-10> # This is checked so that we can skip </lin... | {"code": "<line-2>def isPrime(n) : </line-2>\n<line-42> min=l</line-42>", "lines": [2, 42]}
#### 0 |
<line-1>T= int(input());</line-1>
<line-2></line-2>
<line-4> n,k = list(map(int,input().split()));</line-4>
<line-5> s=list(map(int,input()));</line-5>
<line-6></line-6>
<line-7> if k==1:</line-7>
<line-8> s_0 ={};</line-8>
<line-9> s_1={};</line-9>
<line-10> c0=0;</line-10>
<line-11> c1=0;</line-11>
<line-12> for... | {"code": "<line-3>for i in range(T):</line-3>\n<line-68> p_s+=str(s[j]);</line-68>", "lines": [3, 68]}
#### 0 |
<line-1>from math import log,pow</line-1>
<line-3>a=[]</line-3>
<line-4>for i in range(n):</line-4>
<line-5> no=int(input())</line-5>
<line-6> if(no%2==0):</line-6>
<line-7> a.append("0")</line-7>
<line-8> elif(no==1):</line-8>
<line-9> a.append("1")</line-9>
<line-10> elif(no==3):</line-10>
<line-11> a.append("3")<... | {"code": "<line-2>n=int(input())</line-2>\n<line-27>for i in a:</line-27>", "lines": [2, 27]}
#### 0 |
<line-1># cook your dish here</line-1>
<line-2></line-2>
<line-4>ls=[]</line-4>
<line-5>for i in range(a):</line-5>
<line-6> ls.append(int(input()))</line-6>
<line-7>ls.sort()</line-7>
<line-8>c=0;i=0</line-8>
<line-9>while i<(a-1):</line-9>
<line-10> if ls[i+1]-ls[i]<=b:</line-10>
<line-11> c=c+1</line-11>
<line-12> ... | {"code": "<line-3>a,b=list(map(int,input().split()))</line-3>\n<line-13> i=i+1</line-13>", "lines": [3, 13]}
#### 0 |
<line-1># cooking dish here</line-1>
<line-2></line-2>
<line-4>from collections import Counter</line-4>
<line-5>read = stdin.readline</line-5>
<line-6></line-6>
<line-7>for testcase in range(int(read())):</line-7>
<line-8> length = int(read())</line-8>
<line-9> string = read().strip()</line-9>
<line-10> </line... | {"code": "<line-3>from sys import stdin</line-3>\n<line-17> odd_counts += count%2</line-17>", "lines": [3, 17]}
#### 0 |
<line-1>def g(x,y):</line-1>
<line-3> e= x[0]>y[0] or x[1]>y[1] or x[2]>y[2]</line-3>
<line-4> return d and e</line-4>
<line-5>t=int(input())</line-5>
<line-6>for _ in range(t):</line-6>
<line-7> a=list(map(int,input().split()))</line-7>
<line-8> b=list(map(int,input().split()))</line-8>
<line-9> c=list(map(int,input()... | {"code": "<line-2> d = x[0]>=y[0] and x[1]>=y[1] and x[2]>=y[2]</line-2>\n<line-23> else:</line-23>", "lines": [2, 23]}
#### 0 |
<line-1># cook your dish here</line-1>
<line-2></line-2>
<line-3> </line-3>
<line-5>for _ in range(t):</line-5>
<line-6> l = input()</line-6>
<line-7> </line-7>
<line-8> n= len(l)</line-8>
<line-9> prod = 1</line-9>
<line-10> for k in range(n//2):</line-10>
<line-11> i = l[k]</line-11>
<line-12> j = l[n-k-1]</line-12... | {"code": "<line-4>t=int(input())</line-4>\n<line-21> prod*=26</line-21>", "lines": [4, 21]}
#### 0 |
<line-1># cook your dish here</line-1>
<line-3>for _ in range(int(input())):</line-3>
<line-4> n=int(input())</line-4>
<line-5> c=0</line-5>
<line-6> while(n>0):</line-6>
<line-7> i=int(math.sqrt(n))</line-7>
<line-8> c+=1</line-8>
<line-10> print(c)</line-10>
<line-11> </line-11> | {"code": "<line-2>import math</line-2>\n<line-9> n=n-i**2</line-9>", "lines": [2, 9]}
#### 0 |
<line-1>from sys import stdin</line-1>
<line-3></line-3>
<line-4># Input data</line-4>
<line-5>#stdin = open("input", "r")</line-5>
<line-6></line-6>
<line-7></line-7>
<line-8>def dfs(src, visit):</line-8>
<line-9> visit[src] = 1</line-9>
<line-10> for nbr in d[src]:</line-10>
<line-11> if visit[nbr] == 0:... | {"code": "<line-2>from math import ceil, gcd</line-2>\n<line-35> dfs(i, visited)</line-35>", "lines": [2, 35]}
#### 0 |
<line-1>nr=int(input())</line-1>
<line-3>for r in range(nr):</line-3>
<line-4> s,v=list(map(str,input().split()))</line-4>
<line-5> d[int(v)]=s</line-5>
<line-6>q=int(input())</line-6>
<line-7>lis=[]</line-7>
<line-8>for i in range(q):</line-8>
<line-9> lis.append(input())</line-9>
<line-10>l=list(d.keys())</line-10>
<... | {"code": "<line-2>d={}</line-2>\n<line-22> break</line-22>", "lines": [2, 22]}
#### 0 |
<line-1>def mod(a,b,c):</line-1>
<line-3> y = a</line-3>
<line-4> while(b>0):</line-4>
<line-5> if(b%2==1):</line-5>
<line-6> x = (x*y)%c</line-6>
<line-7> y = (y*y)%c</line-7>
<line-8> b /=2</line-8>
<line-9> return x%c</line-9>
<line-10>t = int(input())</line-10>
<line-11>num = 10**9+7</line-11>
<line-12>for i i... | {"code": "<line-2> x = 1</line-2>\n<line-22> ans = a1*a5</line-22>", "lines": [2, 22]}
#### 0 |
<line-1>try:</line-1>
<line-3> x=[*list(map(int, input().split()))]</line-3>
<line-4> y=[*list(map(int, input().split()))]</line-4>
<line-5> for i in y:</line-5>
<line-6> d=x.count(i)-y.count(i)</line-6>
<line-7> if d!=0:</line-7>
<line-8> print(i)</line-8>
<line-10>except: pass</line-10> | {"code": "<line-2>\tn=int(input())</line-2>\n<line-9>\t\t\tbreak</line-9>", "lines": [2, 9]}
#### 0 |
{"code": "<line-1>print</line-1>", "lines": [1]}
#### 0 | |
<line-1># cook your dish here</line-1>
<line-3> x=int(input())</line-3>
<line-4> if x<10:</line-4>
<line-5> print("Thanks for helping Chef!")</line-5>
<line-7> print("-1")</line-7> | {"code": "<line-2>for i in range(int(input())):</line-2>\n<line-6> else:</line-6>", "lines": [2, 6]}
#### 0 |
<line-1># cook your dish here</line-1>
<line-3>for i in range(int(input())):</line-3>
<line-4> n,m,k=map(int,input().split())</line-4>
<line-5> l,ans = list(map(int,input().split())),0</line-5>
<line-6> for i in l:</line-6>
<line-7> r=i//m + 1;c=i%m</line-7>
<line-8> if(c==0):c=m;r-=1</line-8>
<l... | {"code": "<line-2># cook your dish here</line-2>\n<line-10> ans/=((n+1)*(m+1)*n*m)//4</line-10>", "lines": [2, 10]}
#### 0 |
<line-1>#!/usr/bin/env python</line-1>
<line-2></line-2>
<line-4> N = int(input())</line-4>
<line-5> C = 0</line-5>
<line-6> for n in range(N):</line-6>
<line-7> S = input().strip()</line-7>
<line-8> Pi = S.split()[-1]</line-8>
<line-9> L = [Pi.count(k) for k in map(str, list(range(10)))]</line-9>
<line-10> if L[8]... | {"code": "<line-3>def main():</line-3>\n<line-15> print(C)</line-15>", "lines": [3, 15]}
#### 0 |
<line-1>t = int(input())</line-1>
<line-2></line-2>
<line-4></line-4>
<line-5> str = input()</line-5>
<line-6></line-6>
<line-7> dict = {}</line-7>
<line-8></line-8>
<line-9> for x in range(len(str)):</line-9>
<line-10> if str[x] in dict:</line-10>
<line-11> dict[str[x]] = -1</line-11>
<line-12> else:</line-12>
<li... | {"code": "<line-3>for e in range(t):</line-3>\n<line-43> else:</line-43>", "lines": [3, 43]}
#### 0 |
<line-1>def get(l,n):</line-1>
<line-3> i = 1</line-3>
<line-4> h1,m1 = l[0]</line-4>
<line-5> while (i < len(l)):</line-5>
<line-6> h2,m2 = l[i]</line-6>
<line-7> if (h1>h2):</line-7>
<line-8> if (m1 >= m2):</line-8>
<line-9> l1 += [(0,10**20)]</line-9>
<line-10> l2 += [(-1,-1)]</line-10>
<line-11> else:</... | {"code": "<line-2> l1,l2 = [],[]</line-2>\n<line-137> print(str(c1) + \" \" +str(c2))</line-137>", "lines": [2, 137]}
#### 0 |
<line-1>for i in range(int(input())):</line-1>
<line-3> c=a.count('m')</line-3>
<line-4> d=a.count('s')</line-4>
<line-5> t=0</line-5>
<line-6> while t<len(a)-1:</line-6>
<line-7> if (a[t]=='m' and a[t+1]=='s') or (a[t]=='s' and a[t+1]=='m'):</line-7>
<line-8> d=d-1</line-8>
<line-9> t=t+2</line-9>
<line-10> else... | {"code": "<line-2> a=input()</line-2>\n<line-16> else:</line-16>", "lines": [2, 16]}
#### 0 |
<line-1>import sys</line-1>
<line-3></line-3>
<line-4>def __starting_point():</line-4>
<line-5> start = 0</line-5>
<line-6> for line in sys.stdin:</line-6>
<line-7> if start == 0:</line-7>
<line-8> start = 1</line-8>
<line-9> continue</line-9>
<line-10> else:</line-10>
<line-11... | {"code": "<line-2>import os</line-2>\n<line-41> break</line-41>", "lines": [2, 41]}
#### 0 |
<line-1>T = int(input())</line-1>
<line-3> line1, line2 = input(), input()</line-3>
<line-4> seq = line2.split()</line-4>
<line-5> current_min = 1000001</line-5>
<line-6> current_max = 0</line-6>
<line-7> max_spread = 0</line-7>
<line-8> for i in range(0,len(seq)):</line-8>
<line-9> current_value = int(seq[i])</line-9... | {"code": "<line-2>for j in range(0,T):</line-2>\n<line-19> else:</line-19>", "lines": [2, 19]}
#### 0 |
<line-1>p,s = [int(i) for i in input().split()]</line-1>
<line-3></line-3>
<line-4>for j in range(1, p + 1):</line-4>
<line-5> sc = [int(i) for i in input().split()]</line-5>
<line-6> ns = [int(i) for i in input().split()]</line-6>
<line-7> nsc = dict(list(zip(sc,ns)))</line-7>
<line-8> ssc = sorted(sc)</line-8>
<line-... | {"code": "<line-2>scores = {}</line-2>\n<line-23>for val in final_list :</line-23>", "lines": [2, 23]}
#### 0 |
<line-1># cook your dish here</line-1>
<line-3> 'april':30,'may':31,'june':30,'july':31,</line-3>
<line-4> 'august':31,'september':30,'october':31,</line-4>
<line-5> 'november':30,'december':31}</line-5>
<line-6> </line-6>
<line-7>#l=[[15,'january'],[31,'august'],[10,'october']]</line-7>
<line-8>l2 = list(d.keys())</li... | {"code": "<line-2>d = {'january':31,'february':29,'march':31,</line-2>\n<line-22> break</line-22>", "lines": [2, 22]}
#### 0 |
<line-1>import sys</line-1>
<line-3></line-3>
<line-4>def main(arr,k):</line-4>
<line-5> </line-5>
<line-6> ans=0</line-6>
<line-7> for i in range(len(arr)):</line-7>
<line-8> curr_min=float('inf')</line-8>
<line-9> for j in range(i,len(arr)):</line-9>
<line-10> curr_min=min(curr_min,a... | {"code": "<line-2>import math</line-2>\n<line-21>for i in range(int(input())):</line-21>", "lines": [2, 21]}
#### 0 |
<line-1>s = input().lower()</line-1>
<line-3>ans = ""</line-3>
<line-4>for ch in s:</line-4>
<line-5> if ch in vow:</line-5>
<line-6> continue</line-6>
<line-7> if ch.isalpha():</line-7>
<line-9>print(ans)</line-9> | {"code": "<line-2>vow = [\"a\", \"e\", \"i\", \"o\", \"u\", \"y\"]</line-2>\n<line-8> ans += \".\" + ch</line-8>", "lines": [2, 8]}
#### 0 |
<line-1>import sys</line-1>
<line-3> d,inp,mp,n,q=set(),list(map(ord,list(sys.stdin.readline().strip()))),[x=='b' for x in list(sys.stdin.readline().strip())],eval(input()),ord('a')</line-3>
<line-4> inps = [inp[i:] for i in range(len(inp))]</line-4>
<line-5> inps.sort()</line-5>
<line-6> op,prev= 0,''</lin... | {"code": "<line-2>for _ in range(0,eval(input())): </line-2>\n<line-21> \tprev = ip</line-21>", "lines": [2, 21]}
#### 0 |
<line-1>import sys</line-1>
<line-2></line-2>
<line-4> if k==0:</line-4>
<line-5> k = 1</line-5>
<line-6> x = 0</line-6>
<line-7> for i in range(2,n+1):</line-7>
<line-8> x = (x+k)%i</line-8>
<line-9> return x</line-9>
<line-10></line-10>
<line-11>FLAMES = ['FRIENDS', 'LOVE', 'ADORE', 'MARRIAGE', 'ENEMIES', 'SISTER']... | {"code": "<line-3>def joseph(k, n=6):</line-3>\n<line-19>\t\tn += abs(a.count(ch)-b.count(ch))</line-19>", "lines": [3, 19]}
#### 0 |
<line-1>t=int(input())</line-1>
<line-3> n,k=map(int,input().split())</line-3>
<line-4> a1,*a=map(int,input().split())</line-4>
<line-5> a.insert(0,a1)</line-5>
<line-6> j=0</line-6>
<line-7> while j<n:</line-7>
<line-8> if a[j]%k==0:</line-8>
<line-9> print(1,end="")</line-9>
<line-10> else:</line-10>
<line-11> ... | {"code": "<line-2>for i in range(0,t):</line-2>\n<line-12> j+=1</line-12>", "lines": [2, 12]}
#### 0 |
<line-1>import numpy as np</line-1>
<line-3>i8 = np.int64</line-3>
<line-4></line-4>
<line-5></line-5>
<line-6>@njit</line-6>
<line-7>def solve(a, b, t, K, N):</line-7>
<line-8> t1 = t // K</line-8>
<line-9> d = t % K * 2</line-9>
<line-10> # b が a から a + d の位置にあれば衝突する</line-10>
<line-11> x = 0</line-11>
<l... | {"code": "<line-2>from numba import njit</line-2>\n<line-47> main()</line-47>", "lines": [2, 47]}
#### 0 |
<line-1>from math import factorial</line-1>
<line-3> if r<0:return 0</line-3>
<line-4> return factorial(n)/(factorial(n-r)*factorial(r))</line-4>
<line-5>def solve(m,n):</line-5>
<line-6> modulo=10**9+7</line-6>
<line-7> if m==n:</line-7>
<line-8> return (Ncr(2*n-1,n-1)+Ncr(2*n-2,n-2))%modulo</line-8... | {"code": "<line-2>def Ncr(n,r):</line-2>\n<line-18> n=inp.count(7)</line-18>", "lines": [2, 18]}
#### 0 |
<line-1>import itertools</line-1>
<line-3>def sumPairs(arr, n):</line-3>
<line-4> s = 0</line-4>
<line-5> for i in range(n-1,-1,-1): </line-5>
<line-6> s += i*arr[i]-(n-1-i)*arr[i]</line-6>
<line-7> return s</line-7>
<line-8></line-8>
<line-9>def subarrayXor(arr, n, m):</line-9>
<line-10> ans = 0</line-10>
<line-11> x... | {"code": "<line-2>from collections import defaultdict as dfd</line-2>\n<line-35> arr = list(map(int,input().split()))</line-35>", "lines": [2, 35]}
#### 0 |
<line-1>from math import *</line-1>
<line-3>for _ in range(t):</line-3>
<line-4> n = int(input())</line-4>
<line-5> a = [int(d) for d in input().split()]</line-5>
<line-6> odd,even = 0,0</line-6>
<line-7> for i in range(n):</line-7>
<line-8> if bin(a[i]).count("1")%2 == 1:</line-8>
<line-9> odd += ... | {"code": "<line-2>t = int(input())</line-2>\n<line-19> total += odd*(even*(even-1))//2</line-19>", "lines": [2, 19]}
#### 0 |
<line-1>import math</line-1>
<line-2></line-2>
<line-4> return (a*b)//gcd(a, b)</line-4>
<line-5></line-5>
<line-6>def gcd(a, b):</line-6>
<line-7> if b == 0:</line-7>
<line-8> return a</line-8>
<line-9> return gcd(b, a%b) </line-9>
<line-10> </line-10>
<line-11>for _ in range(int(input())):</line... | {"code": "<line-3>def lcm(a, b):</line-3>\n<line-27> print(\"YESS(sunglass emo)\")</line-27>", "lines": [3, 27]}
#### 0 |
<line-1>for _ in range(int(input())):</line-1>
<line-3> if len(s)<4:</line-3>
<line-4> print("NO")</line-4>
<line-5> else:</line-5>
<line-6> if s[-4:]=="1000":</line-6>
<line-7> print("YES")</line-7>
<line-9> print("NO")</line-9> | {"code": "<line-2> s=input()</line-2>\n<line-8> else:</line-8>", "lines": [2, 8]}
#### 0 |
<line-1>def nCr(n,k):</line-1>
<line-3> k=min(k,n-k)</line-3>
<line-4> num,den=1,1</line-4>
<line-5> for i in range(k):</line-5>
<line-6> num*=(n-i)</line-6>
<line-7> den*=(i+1)</line-7>
<line-8> return num/den</line-8>
<line-9></line-9>
<line-10>def Main():</line-10>
<line-11> for cases in range(int(input())):</line... | {"code": "<line-2> if(k>n):return 0</line-2>\n<line-13> print(nCr(a,b))</line-13>", "lines": [2, 13]}
#### 0 |
<line-1>test=int(input())</line-1>
<line-3> n=int(input())</line-3>
<line-4> ls=list(map(int,input().split()))</line-4>
<line-5> ls.sort()</line-5>
<line-6> s=0</line-6>
<line-7> for i in range(n):</line-7>
<line-8> if s>=ls[i]:</line-8>
<line-9> s=s+1</line-9>
<line-10> else:</line-10>
<line-12> print(s)</line-12> | {"code": "<line-2>for _ in range(test):</line-2>\n<line-11> break</line-11>", "lines": [2, 11]}
#### 0 |
<line-1># cook your dish here</line-1>
<line-3>for _ in range(int(input())):</line-3>
<line-4> n=int(input())</line-4>
<line-5> sum=(n*(n+1))//2</line-5>
<line-6> #print(sum)</line-6>
<line-7> if(sum%2!=0):</line-7>
<line-8> print(0)</line-8>
<line-9> continue</line-9>
<line-10> m=(int((sqrt(1+4*(sum)))-1)//2)</line-... | {"code": "<line-2>from math import sqrt</line-2>\n<line-13> else:</line-13>", "lines": [2, 13]}
#### 0 |
<line-1># cook your dish here</line-1>
<line-3>for i in range(t):</line-3>
<line-4> a=0</line-4>
<line-5> b=0</line-5>
<line-6> N,K,x,y=map(int,input().split())</line-6>
<line-7> if x==y:</line-7>
<line-8> a=N</line-8>
<line-9> b=N</line-9>
<line-10> elif x>y:</line-10>
<line-11> if K%4==1:</line-11>
<line-12> a=N... | {"code": "<line-2>t=int(input())</line-2>\n<line-35> b=y-x</line-35>", "lines": [2, 35]}
#### 0 |
<line-1>import sys,io,os,math</line-1>
<line-3>from itertools import permutations</line-3>
<line-4>mod=1000000007</line-4>
<line-5>mod1=998244353</line-5>
<line-6>def printlist(n):</line-6>
<line-7> sys.stdout.write(" ".join(map(str,n)) + "\n")</line-7>
<line-8>printf=lambda n:sys.stdout.write(str(n)+"\n")</line-8>
... | {"code": "<line-2>from math import ceil,log,gcd,inf</line-2>\n<line-41> tc-=1\t</line-41>", "lines": [2, 41]}
#### 0 |
<line-1></line-1>
<line-2>def interesting_nums(m):</line-2>
<line-4> for x in range(m + 1, 2 * m + 1):</line-4>
<line-5> if x * m % (x - m) == 0:</line-5>
<line-6> nums.append(x)</line-6>
<line-7></line-7>
<line-8> return nums</line-8>
<line-9></line-9>
<line-10></line-10>
<line-11>def main():</line-11>
<line-12></l... | {"code": "<line-3> nums = []</line-3>\n<line-20> print(num)</line-20>", "lines": [3, 20]}
#### 0 |
<line-1>for __ in range(eval(input())):</line-1>
<line-3> a = list(map(int,input().split()))</line-3>
<line-4> key = eval(input())</line-4>
<line-5> query = eval(input())</line-5>
<line-6> maxvisited = x #maximum visted value</line-6>
<line-7> j = x-1</line-7>
<line-8> ans = []</line-8>
<line-9> va... | {"code": "<line-2> x = eval(input())</line-2>\n<line-25> maxvisited = W</line-25>", "lines": [2, 25]}
#### 0 |
<line-1>from itertools import permutations</line-1>
<line-3>V = list(permutations([3,6,9,12]))</line-3>
<line-4>P = list(permutations([25,50,75,100]))</line-4>
<line-5>R = []</line-5>
<line-6></line-6>
<line-7>def test():</line-7>
<line-8> d = {}</line-8>
<line-9> n = int(input())</line-9>
<line-10> for i in C[0]:</lin... | {"code": "<line-2>C = list(permutations(['A','B','C','D']))</line-2>\n<line-34> print(sum(R))</line-34>", "lines": [2, 34]}
#### 0 |
<line-1>import sys</line-1>
<line-2></line-2>
<line-4>T=int(rl())</line-4>
<line-5>for t in range(T):</line-5>
<line-6> P=int(rl())</line-6>
<line-7> T=(P+1)//2</line-7>
<line-8> F=list(map(int,rl().split()))[1:]</line-8>
<line-9> numtorn=int(rl())</line-9>
<line-10> t=sum(range(1,P+1))-sum(F)</line-10>
<line-12> print... | {"code": "<line-3>rl=sys.stdin.readline</line-3>\n<line-11> K=T-numtorn</line-11>", "lines": [3, 11]}
#### 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.