Dataset Viewer
Auto-converted to Parquet Duplicate
question
stringlengths
0
30.2k
answer
stringlengths
55
2.44k
<line-1>for _ in range(int(input())):</line-1> <line-3> mass = []</line-3> <line-4> zo = 0</line-4> <line-5> oz = 0</line-5> <line-6> zz = 0</line-6> <line-7> oo = 0</line-7> <line-8> ozs = []</line-8> <line-9> zos = []</line-9> <line-10> ozss = set()</line-10> <line-11> zoss = set()</line-11...
{"code": "<line-2> n = int(input())</line-2>\n<line-53> i += 1</line-53>", "lines": [2, 53]} #### 0
<line-1>q=int(input())</line-1> <line-2></line-2> <line-4> x,y,k=list(map(int,input().split()))</line-4> <line-5> x,y=abs(x),abs(y)</line-5> <line-6> x,y=max(x,y),min(x,y)</line-6> <line-7> </line-7> <line-8> if(x%2!=k%2):</line-8> <line-9> k-=1</line-9> <line-10> y-=1</line-10> <line-11> ...
{"code": "<line-3>for e in range(q):</line-3>\n<line-18> x-=1</line-18>", "lines": [3, 18]} #### 0
<line-1>import sys</line-1> <line-3>from fractions import Fraction</line-3> <line-4>from math import *</line-4> <line-5> </line-5> <line-6>def input():</line-6> <line-7> return sys.stdin.readline().strip()</line-7> <line-8> </line-8> <line-9>def iinput():</line-9> <line-10> return int(input())</line-10> <line-11>...
{"code": "<line-2>import random</line-2>\n<line-87>for i in range(iinput()):</line-87>", "lines": [2, 87]} #### 0
<line-1>def solve():</line-1> <line-3> lst = list(map(int,input().split()))</line-3> <line-4> lst.sort()</line-4> <line-5> ans = 0</line-5> <line-6> for i in range(n - k - 1, n):</line-6> <line-7> ans += lst[i]</line-7> <line-8> print(ans)</line-8> <line-10> solve()</line-10>
{"code": "<line-2> n, k = map(int,input().split())</line-2>\n<line-9>for i in range(int(input())):</line-9>", "lines": [2, 9]} #### 0
<line-1>for _ in range(int(input())):</line-1> <line-3> nums = [int(x) for x in input().split()]</line-3> <line-4> new_ar = list(zip(nums,[i for i in range(len(nums))]))</line-4> <line-5> new_ar.sort()</line-5> <line-6> </line-6> <line-7> maxx = new_ar[0][1]</line-7> <line-8> minn = new_ar[0][1]</line...
{"code": "<line-2> input()</line-2>\n<line-18> s+=\"0\"</line-18>", "lines": [2, 18]} #### 0
<line-1>def possible(a):</line-1> <line-3> s = set()</line-3> <line-4> lmax = 0</line-4> <line-5> for i in range(len(a)):</line-5> <line-6> lmax = max(lmax, a[i])</line-6> <line-7> s.add(a[i])</line-7> <line-8> if lmax == i + 1 and len(s) == i + 1:</line-8> <line-9> ans.add(i + ...
{"code": "<line-2> ans = set()</line-2>\n<line-25> for l in ans:</line-25>", "lines": [2, 25]} #### 0
<line-1>import sys</line-1> <line-3>for f in range(int(input())):</line-3> <line-4> n,m=list(map(int,input().split()))</line-4> <line-5> neig=[0]*n</line-5> <line-6> for i in range(n):</line-6> <line-7> neig[i]=[0]</line-7> <line-8> </line-8> <line-9> for i in range(m):</line-9> <line-10> a...
{"code": "<line-2>input = sys.stdin.readline</line-2>\n<line-28> print(sol)</line-28>", "lines": [2, 28]} #### 0
<line-1>import sys</line-1> <line-3> return sys.stdin.readline().rstrip()</line-3> <line-4></line-4> <line-5>class Heap:</line-5> <line-6> def __init__( self ):</line-6> <line-7> self.l = [ -1 ]</line-7> <line-8> self.n = 0</line-8> <line-9> def n( self ):</line-9> <line-10> return self.n<...
{"code": "<line-2>def I():</line-2>\n<line-74> ans += h.pop()</line-74>", "lines": [2, 74]} #### 0
<line-1>import sys</line-1> <line-3></line-3> <line-4>def main():</line-4> <line-5> n, k = map(int, input().split())</line-5> <line-6> string = input().strip()</line-6> <line-7> if "W" not in string:</line-7> <line-8> ans = min(n, k) * 2 - 1</line-8> <line-9> print(max(ans, 0))</line-9> <line-10>...
{"code": "<line-2>input = sys.stdin.readline</line-2>\n<line-47>for _ in range(int(input())):</line-47>", "lines": [2, 47]} #### 0
<line-1>for _ in range(int(input())):</line-1> <line-3> p = [i for i in s.split("0") if i!=""]</line-3> <line-4> p.sort(reverse=True)</line-4> <line-5> ans = 0</line-5> <line-6> for i in range(0,len(p),2):</line-6> <line-8> print(ans)</line-8> <line-9></line-9>
{"code": "<line-2> s = input()</line-2>\n<line-7> ans+=len(p[i])</line-7>", "lines": [2, 7]} #### 0
<line-1>for _ in range(int(input())):</line-1> <line-3> n = int(input())</line-3> <line-4> arr = list(map(int, input().split()))</line-4> <line-5> ans = [arr[0]]</line-5> <line-6> for i in range(1, n - 1):</line-6> <line-7> if arr[i - 1] < arr[i] and arr[i] > arr[i + 1]:</line-7> <line-8> ...
{"code": "<line-2> # n, x = map(int, input().split())</line-2>\n<line-12> print(len(ans))</line-12>", "lines": [2, 12]} #### 0
<line-1>n = int(input())</line-1> <line-2></line-2> <line-4> return (width+1) * (height+1)</line-4> <line-5></line-5> <line-6>def calcul(s1, c, s2) :</line-6> <line-7> maxx, maxy, minx, miny = 0, 0, 0, 0</line-7> <line-8> x, y = 0, 0</line-8> <line-9> for k in range(len(s1)) :</line-9> <line-10> if s...
{"code": "<line-3>def area(width, height) :</line-3>\n<line-179> tmp = min(tmp, calcul2(s, 'D', moment, precalcul))</line-179>", "lines": [3, 179]} #### 0
<line-1>from math import *</line-1> <line-2></line-2> <line-4></line-4> <line-5>for zz in range(int(input())):</line-5> <line-6> n = int(input())</line-6> <line-7> a = [ int(i) for i in input().split()]</line-7> <line-8> b = [int(i) for i in input().split()]</line-8> <line-9> ha = True</line-9> <line-10> ...
{"code": "<line-3>mod = 1000000007</line-3>\n<line-33> else:</line-33>", "lines": [3, 33]} #### 0
<line-2> n,g,b=map(int,input().split())</line-2> <line-3> nn=(n+1)//2</line-3> <line-4> print(max(nn+(nn-1)//g*b,n))</line-4>
{"code": "<line-1>for i in range(int(input())):</line-1>", "lines": [1]} #### 0
<line-1>for _ in range(int(input())):</line-1> <line-3> a2, b2 = list(map(int, input().split()))</line-3> <line-4> if a1 > b1:</line-4> <line-5> a1, b1 = b1, a1</line-5> <line-6> if a2 > b2:</line-6> <line-7> a2, b2 = b2, a2</line-7> <line-8> flag = False</line-8> <line-9> if a1 == a2 and a...
{"code": "<line-2> a1, b1 = list(map(int, input().split()))</line-2>\n<line-12> flag = True</line-12>", "lines": [2, 12]} #### 0
<line-1>from math import *</line-1> <line-2></line-2> <line-4>for zz in range(zzz):</line-4> <line-6> print(max(x*b, (a-x-1)*b, y*a, (b - y - 1)*a))</line-6>
{"code": "<line-3>zzz = int(input())</line-3>\n<line-5> a, b, x, y = list(map(int, input().split()))</line-5>", "lines": [3, 5]} #### 0
<line-1>from math import sqrt</line-1> <line-3> def __init__(self,dif,sc):</line-3> <line-4> self.dif=dif</line-4> <line-5> self.sc=sc</line-5> <line-6></line-6> <line-7> def __lt__(self,other):</line-7> <line-8> return self.dif>other.dif</line-8> <line-9></line-9> <line-10>T=int(input())</li...
{"code": "<line-2>class pro(object):</line-2>\n<line-42> if flag==True:</line-42>", "lines": [2, 42]} #### 0
<line-1>class BIT():</line-1> <line-3> self.BIT=[0]*(n+1)</line-3> <line-4> self.num=n</line-4> <line-5></line-5> <line-6> def query(self,idx):</line-6> <line-7> res_sum = 0</line-7> <line-8> while idx > 0:</line-8> <line-9> res_sum += self.BIT[idx]</line-9> <line-10> ...
{"code": "<line-2> def __init__(self,n):</line-2>\n<line-40> bit.update(r,1)</line-40>", "lines": [2, 40]} #### 0
<line-1>import math</line-1> <line-2></line-2> <line-4>for _ in range(T):</line-4> <line-6> print(1/math.tan(math.pi/2/n))</line-6>
{"code": "<line-3>T = int(input())</line-3>\n<line-5> n = int(input())</line-5>", "lines": [3, 5]} #### 0
<line-1>for _ in range(int(input())):</line-1> <line-3> a = list(map(int, input().split()))</line-3> <line-4> s = {}</line-4> <line-5> for q in range(d):</line-5> <line-6> s[a[q]] = s.get(a[q], 0)+1</line-6> <line-7> ans = len(s)</line-7> <line-8> for q in range(d, n):</line-8> <line-9> if ...
{"code": "<line-2> n, k, d = list(map(int, input().split()))</line-2>\n<line-14> ans = min(ans, len(s))</line-14>", "lines": [2, 14]} #### 0
<line-1>q = int(input())</line-1> <line-3> n, m = list(map(int, input().split()))</line-3> <line-4> info = [list(map(int, input().split())) for i in range(n)]</line-4> <line-5> info = sorted(info)</line-5> <line-6> now =(m, m)</line-6> <line-7> time = 0</line-7> <line-8> flag = True</line-8> <line-9> ...
{"code": "<line-2>for _ in range(q):</line-2>\n<line-22> else:</line-22>", "lines": [2, 22]} #### 0
<line-1>t = int(input())</line-1> <line-2></line-2> <line-4> n = list(input().strip())</line-4> <line-5> s = list(map(int, input().strip().split()))</line-5> <line-6></line-6> <line-7> check = set(s)</line-7> <line-8> found = False</line-8> <line-9> for i in range(1, 1025):</line-9> <line-10> news...
{"code": "<line-3>for _ in range(t):</line-3>\n<line-15> if not found:</line-15>", "lines": [3, 15]} #### 0
<line-1>import sys</line-1> <line-2></line-2> <line-4></line-4> <line-5>for _ in range(int(input())):</line-5> <line-6> a, k = list(map(int, input().split()))</line-6> <line-7> for _ in range(k - 1):</line-7> <line-8> if '0' in str(a):</line-8> <line-9> break</line-9> <line-11> print(a)</line-11>
{"code": "<line-3>input = sys.stdin.readline</line-3>\n<line-10>\t\ta += int(min(list(str(a)))) * int(max(list(str(a))))</line-10>", "lines": [3, 10]} #### 0
<line-1>import heapq</line-1> <line-2></line-2> <line-4> n = int(input())</line-4> <line-5> voters = []</line-5> <line-6> for i in range(n):</line-6> <line-7> m,p = list(map(int, input().split()))</line-7> <line-8> voters.append((m, -p))</line-8> <line-9> voters.sort()</line-9> <line-10> fo...
{"code": "<line-3>for _ in range(int(input())):</line-3>\n<line-23> buysNeeded -= 1</line-23>", "lines": [3, 23]} #### 0
<line-1>for _ in range(int(input())):</line-1> <line-3> anws=False</line-3> <line-4> if d**2>=4*d:</line-4> <line-5> root=(d**2-4*d)**0.5</line-5> <line-6> a=(d+root)/2</line-6> <line-7> b=(d-root)/2</line-7> <line-8> anws=True</line-8> <line-9> if anws:</line-9> <line-10> pr...
{"code": "<line-2> d=int(input())</line-2>\n<line-11> else:</line-11>", "lines": [2, 11]} #### 0
<line-1>import os</line-1> <line-3>import sys</line-3> <line-4>import threading</line-4> <line-5></line-5> <line-6></line-6> <line-7>sys.setrecursionlimit(10 ** 9)</line-7> <line-8>threading.stack_size(67108864)</line-8> <line-9></line-9> <line-10></line-10> <line-11>def main():</line-11> <line-12></line-12> <line-13> ...
{"code": "<line-2>from io import BytesIO</line-2>\n<line-75>tt = threading.Thread(target = main)</line-75>", "lines": [2, 75]} #### 0
<line-1>for _ in range(int(input())):</line-1> <line-3> if n < m:</line-3> <line-4> n, m = m, n # n > m</line-4> <line-5></line-5> <line-6> if m == 1:</line-6> <line-7> print("YES")</line-7> <line-8> continue</line-8> <line-9></line-9> <line-10> if m == 2 and n == 2:</line-10> <line-11> ...
{"code": "<line-2> n, m = list(map(int, input().split()))</line-2>\n<line-12> continue</line-12>", "lines": [2, 12]} #### 0
<line-1>tests = int(input())</line-1> <line-3> n = int(input())</line-3> <line-4> a = [int(i) for i in input().split()]</line-4> <line-5> d = {}</line-5> <line-6> for i in range(n):</line-6> <line-7> s = 0</line-7> <line-8> while a[i] % 2 == 0:</line-8> <line-9> a[i] //= 2</line-9> ...
{"code": "<line-2>for test in range(tests):</line-2>\n<line-17> s += d[i]</line-17>", "lines": [2, 17]} #### 0
<line-1>import sys</line-1> <line-3>MOD = 10**9 + 7</line-3> <line-4>I = lambda:list(map(int,input().split()))</line-4> <line-5>from math import gcd</line-5> <line-6>from math import ceil</line-6> <line-7>from collections import defaultdict as dd, Counter</line-7> <line-8>from bisect import bisect_left as bl, bisect_ri...
{"code": "<line-2>INF = 10**20</line-2>\n<line-64> t -= 1</line-64>", "lines": [2, 64]} #### 0
<line-1>input=__import__('sys').stdin.readline</line-1> <line-3> n=int(input())</line-3> <line-4> s=list(map(int,input().split()))</line-4> <line-5> g=[[-1]for _ in range(n+1)]</line-5> <line-6> for i in range(n):</line-6> <line-7> g[s[i]].append(i)</line-7> <line-8> inf=10**10</line-8> <line-9> ans=[-1]*n</line-9> <l...
{"code": "<line-2>for _ in range(int(input())):</line-2>\n<line-18>\t\tlstunused=min(lstunused,mx)</line-18>", "lines": [2, 18]} #### 0
<line-1>t = int(input())</line-1> <line-3> n = int(input())</line-3> <line-4> s = input()</line-4> <line-5> ans = 0</line-5> <line-6> for y in range(1, n):</line-6> <line-7> if s[y] == s[y-1]:</line-7> <line-9> print((ans + ans % 2) // 2)</line-9> <line-10> </line-10>
{"code": "<line-2>for i in range(t):</line-2>\n<line-8> ans += 1</line-8>", "lines": [2, 8]} #### 0
<line-1>DIR = {"N": (0, 1), "S": (0, -1), "W": (-1, 0), "E": (1, 0)}</line-1> <line-2></line-2> <line-4> path = input()</line-4> <line-5> tracks = set()</line-5> <line-6> x, y = 0, 0</line-6> <line-7> time = 0</line-7> <line-8> for char in path:</line-8> <line-9> x1 = x + DIR[char][0]</line-9> <line-10> ...
{"code": "<line-3>for t in range(int(input())):</line-3>\n<line-16> x, y = x1, y1</line-16>", "lines": [3, 16]} #### 0
<line-1>from sys import stdin, stdout</line-1> <line-3>input = stdin.readline</line-3> <line-4>for _ in range(int(input())):</line-4> <line-5> n = int(input())</line-5> <line-6> chanek = 0</line-6> <line-7> flag = 1</line-7> <line-8> while n>0:</line-8> <line-9> if n%4==0 and n!=4:</line-9> <line-10> if flag:</line-...
{"code": "<line-2>from collections import defaultdict</line-2>\n<line-32>\t\t\t\tflag = 1</line-32>", "lines": [2, 32]} #### 0
<line-1>t=int(input())</line-1> <line-3> n=int(input())</line-3> <line-4> print(2)</line-4> <line-5> print(n-1,n)</line-5> <line-7> print(i,i+2)</line-7>
{"code": "<line-2>for i in range(t):</line-2>\n<line-6> for i in range(n-2,0,-1):</line-6>", "lines": [2, 6]} #### 0
<line-1>for _ in range(int(input())):</line-1> <line-3> if(n%2):</line-3> <line-4> print("7"+"1"*((n-3)//2))</line-4> <line-6> print("1"*(n//2)) </line-6>
{"code": "<line-2>\tn = int(input())</line-2>\n<line-5>\telse:</line-5>", "lines": [2, 5]} #### 0
<line-1>import sys</line-1> <line-2></line-2> <line-4></line-4> <line-5>for _ in range(int(input())):</line-5> <line-6> N=int(input())</line-6> <line-7> e=list(map(int,input().split()))</line-7> <line-8> e.sort()</line-8> <line-9> ans=0</line-9> <line-10> val=0</line-10> <line-11> g=0</line-11> <line-...
{"code": "<line-3>input=sys.stdin.readline</line-3>\n<line-18> val=0</line-18>", "lines": [3, 18]} #### 0
<line-1>n=int(input())</line-1> <line-3>k=[]</line-3> <line-4>for i in range(n):</line-4> <line-5> for j in range(a[i]):</line-5> <line-6> k.append(i+1)</line-6> <line-7>m=int(input())</line-7> <line-8>b=list(map(int,input().split()))</line-8> <line-10> print(k[i-1])</line-10>
{"code": "<line-2>a=list(map(int,input().split()))</line-2>\n<line-9>for i in b:</line-9>", "lines": [2, 9]} #### 0
<line-1>3</line-1> <line-2></line-2> <line-4></line-4> <line-5>N = 55</line-5> <line-6>c = [1]</line-6> <line-7>for i in range(N):</line-7> <line-8> c.append(fact(i))</line-8> <line-9>dp = [0] * N</line-9> <line-10>dp[0] = 1</line-10> <line-11>for i in range(1, N):</line-11> <line-12> for j in range(i):</line-12> <line...
{"code": "<line-3>from math import factorial as fact</line-3>\n<line-68>\t\tsolve()</line-68>", "lines": [3, 68]} #### 0
<line-1>q = int(input())</line-1> <line-3> n, k1, k2 = map(int, input().split())</line-3> <line-4> arr1 = list(map(int, input().split()))</line-4> <line-5> arr2 = list(map(int, input().split()))</line-5> <line-6> if max(arr1) > max(arr2):</line-6> <line-7> print('YES')</line-7> <line-9> print(...
{"code": "<line-2>for z in range(q):</line-2>\n<line-8> else:</line-8>", "lines": [2, 8]} #### 0
<line-1>t=int(input())</line-1> <line-2></line-2> <line-4> a,b,p=map(int,input().split())</line-4> <line-5> s=input()</line-5> <line-6> n=len(s)</line-6> <line-7> cost = [0]*n</line-7> <line-8> cost[-1] = 0</line-8> <line-9> typ = ''</line-9> <line-10> i=n-2</line-10> <line-11> while i>=0:</line...
{"code": "<line-3>for tt in range(t):</line-3>\n<line-20> i+=1</line-20>", "lines": [3, 20]} #### 0
<line-1>def main():</line-1> <line-3> for _ in range(int(stdin.readline())):</line-3> <line-4> n = int(stdin.readline())</line-4> <line-5> inp1 = [-1] * (n + 1)</line-5> <line-6> inp2 = [-1] * (n + 1)</line-6> <line-7> for i, ai in enumerate(map(int, stdin.readline().split())):</line-7> <...
{"code": "<line-2> from sys import stdin, stdout</line-2>\n<line-22> stdout.write(f'{n - ans}\\n')</line-22>", "lines": [2, 22]} #### 0
<line-1>t = int(input())</line-1> <line-3> n,k=list(map(int,input().split()))</line-3> <line-4> s = input()</line-4> <line-5> ans = []</line-5> <line-6> if s[0] == ')':</line-6> <line-7> for i in range(n):</line-7> <line-8> if s[i] == '(':</line-8> <line-9> ans.append([1,i+1...
{"code": "<line-2>for tt in range(t):</line-2>\n<line-35> for i in ans:</line-35>", "lines": [2, 35]} #### 0
<line-1>LOG = 20</line-1> <line-2></line-2> <line-4> n = len(s)</line-4> <line-5> res = 0</line-5> <line-6> z = 0</line-6> <line-7> for t in range(0, n):</line-7> <line-8> if s[t] == '0':</line-8> <line-9> z += 1</line-9> <line-10> continue</line-10> <line-11> for l in range(1, min(LOG, n - t + 1)):</line-11> <li...
{"code": "<line-3>def solve(s):</line-3>\n<line-25>\ts = input()</line-25>", "lines": [3, 25]} #### 0
<line-1>def check(M):</line-1> <line-3> for i in range(n):</line-3> <line-4> if a[i] > M:</line-4> <line-5> sm += b[i]</line-5> <line-6> return sm <= M</line-6> <line-7></line-7> <line-8></line-8> <line-9>gans = []</line-9> <line-10>for _ in range(int(input())):</line-10> <line-11> n = int(in...
{"code": "<line-2> sm = 0</line-2>\n<line-22> gans.append(R)</line-22>", "lines": [2, 22]} #### 0
<line-1>t=int(input())</line-1> <line-3> n=int(input())</line-3> <line-4> for i in range(n):</line-4> <line-6> print()</line-6>
{"code": "<line-2>for you in range(t):</line-2>\n<line-5> print(4*n-2*i,end=\" \")</line-5>", "lines": [2, 5]} #### 0
<line-1>import sys</line-1> <line-3>from fractions import Fraction</line-3> <line-4>from math import *</line-4> <line-5> </line-5> <line-6>def input():</line-6> <line-7> return sys.stdin.readline().strip()</line-7> <line-8> </line-8> <line-9>def iinput():</line-9> <line-10> return int(input())</line-10> <line-11>...
{"code": "<line-2>import random</line-2>\n<line-80>for i in range(iinput()):</line-80>", "lines": [2, 80]} #### 0
<line-1>#</line-1> <line-3># ____ _ Generatered using</line-3> <line-4># / ___| | |</line-4> <line-5># | | __ _ __| | ___ _ __ ______ _</line-5> <line-6># | | / _` |/ _` |/ _ \ '_ \|_ / _` |</line-6> <line-7># | |__| (_| | (_| | __/ | | |/ / (_| |<...
{"code": "<line-2># ------------------------------------------------</line-2>\n<line-112># >>>>>>>>>>>>>>>> END OF SOLUTION <<<<<<<<<<<<<<<</line-112>", "lines": [2, 112]} #### 0
<line-1>import sys</line-1> <line-3>from bisect import bisect_right</line-3> <line-4></line-4> <line-5>bin_s = [1]</line-5> <line-6>while bin_s[-1] <= 10 ** 9:</line-6> <line-7> bin_s.append(bin_s[-1] * 2)</line-7> <line-8></line-8> <line-9></line-9> <line-10>def main():</line-10> <line-11> n, q = map(int, input(...
{"code": "<line-2>input = sys.stdin.readline</line-2>\n<line-21>for _ in range(int(input())):</line-21>", "lines": [2, 21]} #### 0
<line-2> x,y,k = list(map(int,input().split()))</line-2> <line-3> print(k + (y * k + k - 1 +x-2) // (x - 1))</line-3>
{"code": "<line-1>for haaghfj in range(int(input())):</line-1>", "lines": [1]} #### 0
<line-1></line-1> <line-2>import sys</line-2> <line-4>input=sys.stdin.readline</line-4> <line-5></line-5> <line-6># this math tutorial is boring</line-6> <line-7></line-7> <line-8>classy=set()</line-8> <line-9></line-9> <line-10>for i in range(19):</line-10> <line-11> for j in range(i):</line-11> <line-12> fo...
{"code": "<line-3>#sys.stdin=open(\"data.txt\")</line-3>\n<line-34> a,b=map(int,input().split())</line-34>", "lines": [3, 34]} #### 0
<line-1>for tcase in range(int(input())):</line-1> <line-3> ls = list(map(int, input().split()))</line-3> <line-4> oneneed = 2*(n - ls.count(1))</line-4> <line-5> ldct = {0:0}</line-5> <line-6> ctr = 0</line-6> <line-7> eaten = 0</line-7> <line-8> for i in range(n-1,-1,-1):</line-8> <line-9> ea...
{"code": "<line-2> n=int(input())</line-2>\n<line-28> best = min(best, rdct[k]+ldct[otk])</line-28>", "lines": [2, 28]} #### 0
<line-1>def main():</line-1> <line-3> for z in range(t):</line-3> <line-4> n, k, d1, d2 = map(int, input().split())</line-4> <line-5> if n % 3 != 0:</line-5> <line-6> print('no')</line-6> <line-7> continue</line-7> <line-8> f = 0</line-8> <line-9> for i in [-1, +1]:<...
{"code": "<line-2> t = int(input())</line-2>\n<line-16> print('no')</line-16>", "lines": [2, 16]} #### 0
<line-2>a=sorted(int(input()) for _ in range(n))</line-2> <line-3>print(sum(a[i]*a[-i-1] for i in range(n))%10007)</line-3>
{"code": "<line-1>n=int(input())</line-1>", "lines": [1]} #### 0
<line-1>import sys</line-1> <line-3></line-3> <line-4></line-4> <line-5>def compress(array):</line-5> <line-6> array2 = sorted(set(array))</line-6> <line-7> memo = {value : index for index, value in enumerate(array2)}</line-7> <line-8> for i in range(len(array)):</line-8> <line-9> array[i] = memo[array[...
{"code": "<line-2>input = sys.stdin.readline</line-2>\n<line-39> ans[i + 1] = now</line-39>", "lines": [2, 39]} #### 0
<line-1>for i in range(int(input())):</line-1> <line-3> s=list(map(int,input().split()))</line-3> <line-4> a=0</line-4> <line-5> for i in s:</line-5> <line-6> if i<2049:a+=i</line-6> <line-8> else:print("YES")</line-8>
{"code": "<line-2> n=int(input())</line-2>\n<line-7> if a<2048:print(\"NO\")</line-7>", "lines": [2, 7]} #### 0
<line-2> n = int(input())</line-2> <line-3> print((n + 1) // 2)</line-3>
{"code": "<line-1>for __ in range(int(input())):</line-1>", "lines": [1]} #### 0
<line-1>for _ in range(int(input())):</line-1> <line-3> mat = [[0] * n for _ in range(n)]</line-3> <line-4> for i in range(n):</line-4> <line-5> b = False</line-5> <line-6> for j in range(n):</line-6> <line-7> if i*n+j == k:</line-7> <line-8> b = True</line-8> <line-9> ...
{"code": "<line-2> n, k = map(int, input().split())</line-2>\n<line-19> print(mat[i][j], end=\"\")</line-19>", "lines": [2, 19]} #### 0
<line-1>t = int(input())</line-1> <line-3> n = int(input())</line-3> <line-4> arr = list(map(int, input().split()))</line-4> <line-5> if arr[-1] > arr[0]:</line-5> <line-6> print("YES")</line-6> <line-8> print("NO")</line-8>
{"code": "<line-2>for case in range(t):</line-2>\n<line-7> else:</line-7>", "lines": [2, 7]} #### 0
<line-1>mem = [[[0 for i in range(51)] for j in range(31)] for k in range(31)]</line-1> <line-2></line-2> <line-3></line-3> <line-5> if mem[n][m][k]:</line-5> <line-6> return mem[n][m][k]</line-6> <line-7> if (n*m == k) or (k == 0):</line-7> <line-8> return 0</line-8> <line-9> cost = 10**9</line-...
{"code": "<line-4>def f(n, m, k):</line-4>\n<line-22> n, m, k = list(map(int, input().split()))</line-22>", "lines": [4, 22]} #### 0
<line-1>for _ in range(int(input())):</line-1> <line-3> a=list(map(int,input().split()))</line-3> <line-4> ans,small,big=0,2*10**9,-1</line-4> <line-5> for i in range(len(a)-1):</line-5> <line-6> if a[i]==-1 and a[i+1]!=-1:</line-6> <line-7> small=min(small, a[i+1])</line-7> <line-8> ...
{"code": "<line-2> n=int(input())</line-2>\n<line-18> ans=max(ans, abs(x-small))</line-18>", "lines": [2, 18]} #### 0
<line-2>for _ in range(n):</line-2> <line-3> a, b = list(map(int, input().split()))</line-3> <line-4> print(a ^ b)</line-4>
{"code": "<line-1>n = int(input())</line-1>", "lines": [1]} #### 0
<line-1>import sys</line-1> <line-3>#from queue import *</line-3> <line-4>import random</line-4> <line-5>#sys.setrecursionlimit(int(1e6))</line-5> <line-6>input = sys.stdin.readline</line-6> <line-7> </line-7> <line-8>############ ---- USER DEFINED INPUT FUNCTIONS ---- ############</line-8> <line-9>def inp():</line-9> ...
{"code": "<line-2>import math</line-2>\n<line-39>\t\tprint(\"YES\")</line-39>", "lines": [2, 39]} #### 0
<line-1>T = int(input())</line-1> <line-2></line-2> <line-3></line-3> <line-4></line-4> <line-6> res = [S[0]]</line-6> <line-7> pos = 0 # think...</line-7> <line-8> for s in S[1:]:</line-8> <line-9> # can we change?</line-9> <line-10> if 0 <= pos-1 < len(res) and res[pos-1] == s:</line-10> <line-...
{"code": "<line-5>def solve(S):</line-5>\n<line-32> print('YES')</line-32>", "lines": [5, 32]} #### 0
<line-1>def solve():</line-1> <line-3> lst1 = list(map(int,input().split()))</line-3> <line-4> lst1.sort(reverse=True)</line-4> <line-5> ind = 0</line-5> <line-6> ans = 0</line-6> <line-7> lst2 = list(map(int,input().split()))</line-7> <line-8> lst2.sort()</line-8> <line-9> for i in range(k):</line...
{"code": "<line-2> n, k = map(int,input().split())</line-2>\n<line-21>for i in range(int(input())):</line-21>", "lines": [2, 21]} #### 0
<line-1>import sys</line-1> <line-3>from fractions import Fraction</line-3> <line-4>from math import *</line-4> <line-5> </line-5> <line-6>def input():</line-6> <line-7> return sys.stdin.readline().strip()</line-7> <line-8> </line-8> <line-9>def iinput():</line-9> <line-10> return int(input())</line-10> <line-11>...
{"code": "<line-2>import random</line-2>\n<line-93>for i in range(iinput()):</line-93>", "lines": [2, 93]} #### 0
<line-1>import math</line-1> <line-3>from sys import stdin, stdout</line-3> <line-4>from string import ascii_letters</line-4> <line-5>import sys</line-5> <line-6>letters = ascii_letters</line-6> <line-7>input = stdin.readline</line-7> <line-8>#print = stdout.write</line-8> <line-9></line-9> <line-10>for _ in range(int(...
{"code": "<line-2>from collections import deque</line-2>\n<line-33> ans[i + 3] = min(ans[i + 3], ans[i])</line-33>", "lines": [2, 33]} #### 0
<line-1>#list(map(int,input().split()))</line-1> <line-3>for _ in range(t):</line-3> <line-4> n=int(input())</line-4> <line-5> aa=list(map(int,input().split()))</line-5> <line-6> bb=list(map(int,input().split()))</line-6> <line-7> aa.sort()</line-7> <line-8> bb.sort()</line-8> <line-10> print(*bb)</li...
{"code": "<line-2>t=int(input())</line-2>\n<line-9> print(*aa)</line-9>", "lines": [2, 9]} #### 0
<line-1>for _ in range(int(input())):</line-1> <line-3> s = input()</line-3> <line-4> t = input()</line-4> <line-5></line-5> <line-6> d = {}</line-6> <line-7> for i in range(ord('a'), ord('z') + 1):</line-7> <line-8> d[chr(i)] = 0</line-8> <line-9></line-9> <line-10> for cs in s:</line-10> <line-1...
{"code": "<line-2> n = int(input())</line-2>\n<line-49> x, y = change</line-49>", "lines": [2, 49]} #### 0
<line-1>from itertools import groupby</line-1> <line-3> N = int(input())</line-3> <line-4> S = input()</line-4> <line-5> </line-5> <line-6> C = [len(list(x[1])) for x in groupby(S)]</line-6> <line-7> M = len(C)</line-7> <line-8> dup_idx = []</line-8> <line-9> for i, c in enumerate(C):</line-9> <lin...
{"code": "<line-2>def main():</line-2>\n<line-35> main()</line-35>", "lines": [2, 35]} #### 0
<line-1>t = int(input())</line-1> <line-2></line-2> <line-4> a, b = list(map(int, input().split()))</line-4> <line-5> s = input()</line-5> <line-6></line-6> <line-7> z = 10000</line-7> <line-8> total = 0</line-8> <line-9> act = False</line-9> <line-10></line-10> <line-11> for i in range(len(s)):</line...
{"code": "<line-3>for case in range(t):</line-3>\n<line-20> z = 0</line-20>", "lines": [3, 20]} #### 0
<line-1>import sys</line-1> <line-3>from collections import defaultdict</line-3> <line-4></line-4> <line-5>class Unionfind:</line-5> <line-6> def __init__(self, n):</line-6> <line-7> self.par = [-1]*n</line-7> <line-8> self.rank = [1]*n</line-8> <line-9> </line-9> <line-10> def root(self, x):</li...
{"code": "<line-2>input = sys.stdin.readline</line-2>\n<line-73> ans += uf.count(r)-max(list(d[r].values()))</line-73>", "lines": [2, 73]} #### 0
<line-1>t=int(input())</line-1> <line-3> n=int(input())</line-3> <line-4> a=list(map(int,input().split()))</line-4> <line-5> an=0</line-5> <line-6> s=0</line-6> <line-7> for i in a :</line-7> <line-8> if s+i>=0 :</line-8> <line-9> s+=i </line-9> <line-10> else :</line-10> <line-1...
{"code": "<line-2>while t>0 :</line-2>\n<line-14> print(an)</line-14>", "lines": [2, 14]} #### 0
<line-1>t = int(input())</line-1> <line-2></line-2> <line-4> n, k = [int(x) for x in input().split()]</line-4> <line-5> a = [int(x) for x in input().split()]</line-5> <line-6> if len(set(a)) > k:</line-6> <line-7> print(-1)</line-7> <line-8> continue</line-8> <line-9> l = list(set(a))</line-9>...
{"code": "<line-3>for _ in range(t):</line-3>\n<line-14> print(*l, end=\" \")</line-14>", "lines": [3, 14]} #### 0
<line-1>def solve():</line-1> <line-3> a = list(map(int, input().split()))</line-3> <line-4> c = [0] * (n + 1)</line-4> <line-5> def inc():</line-5> <line-6> for i in range(n - 1):</line-6> <line-7> if a[i] > a[i + 1]:</line-7> <line-8> return False</line-8> <line-9> ret...
{"code": "<line-2> n = int(input())</line-2>\n<line-35>for _ in range(t):</line-35>", "lines": [2, 35]} #### 0
<line-1>def read_int():</line-1> <line-3></line-3> <line-4></line-4> <line-5>def read_ints():</line-5> <line-6> return list(map(int, input().split(' ')))</line-6> <line-7></line-7> <line-8></line-8> <line-9>t = read_int()</line-9> <line-10>for case_num in range(t):</line-10> <line-11> n, k = read_ints()</line-11>...
{"code": "<line-2> return int(input())</line-2>\n<line-42> print(len(seq))</line-42>", "lines": [2, 42]} #### 0
<line-1>import math</line-1> <line-2></line-2> <line-4>for _ in range(T):</line-4> <line-5> n = int(input())</line-5> <line-7> print(diags * math.cos(math.pi/4/n))</line-7>
{"code": "<line-3>T = int(input())</line-3>\n<line-6> diags = 1/math.sin(math.pi/2/n)</line-6>", "lines": [3, 6]} #### 0
<line-1>t = int(input())</line-1> <line-2></line-2> <line-4> n = int(input())</line-4> <line-5> if n%4 == 0:</line-5> <line-6> print("YES")</line-6> <line-8> print("NO")</line-8>
{"code": "<line-3>for _ in range(t):</line-3>\n<line-7> else:</line-7>", "lines": [3, 7]} #### 0
<line-1>3</line-1> <line-2></line-2> <line-4>import os</line-4> <line-5>import sys</line-5> <line-6></line-6> <line-7></line-7> <line-8>DEBUG = 'DEBUG' in os.environ</line-8> <line-9></line-9> <line-10></line-10> <line-11>def inp():</line-11> <line-12> return sys.stdin.readline().rstrip()</line-12> <line-13></line-1...
{"code": "<line-3>import math</line-3>\n<line-57> main()</line-57>", "lines": [3, 57]} #### 0
<line-1>import sys</line-1> <line-2></line-2> <line-4>for t in range(0, q):</line-4> <line-5> n, m = list(map(int, sys.stdin.readline().strip().split()))</line-5> <line-6> L = []</line-6> <line-7> R = [0] * n</line-7> <line-8> C = [0] * m</line-8> <line-9> for i in range (0, n):</line-9> <line-10> ...
{"code": "<line-3>q = int(sys.stdin.readline().strip())</line-3>\n<line-21> ans = min([ans, R[i]+C[j]+x])</line-21>", "lines": [3, 21]} #### 0
<line-1>from math import ceil</line-1> <line-2></line-2> <line-4>for _ in range(t):</line-4> <line-5> n = int(input())</line-5> <line-6> pf = []</line-6> <line-7> for i in range(2, ceil(n**0.5)+1):</line-7> <line-8> while n % i == 0:</line-8> <line-9> pf.append(i)</line-9> <line-10> n //= i</line-10> <l...
{"code": "<line-3>t = int(input())</line-3>\n<line-52> print(\" \".join([str(i) for i in fac]))</line-52>", "lines": [3, 52]} #### 0
<line-1>def solve(L, R):</line-1> <line-3> for i in range(32):</line-3> <line-4> for j in range(32):</line-4> <line-5> l = (L >> i) << i</line-5> <line-6> r = (R >> j) << j</line-6> <line-7> #print(l, r)</line-7> <line-8> if l>>i&1==0 or r>>j&1==0:</line-8> <line-9>...
{"code": "<line-2> res = 0</line-2>\n<line-26> l, r = list(map(int, input().split()))</line-26>", "lines": [2, 26]} #### 0
<line-1>for _ in range(int(input())):</line-1> <line-3> n = len(a)</line-3> <line-4></line-4> <line-5> ok = True</line-5> <line-6> for i in range(n):</line-6> <line-7> if c[i] not in [a[i], b[i]]:</line-7> <line-9></line-9> <line-10> print('YES' if ok else 'NO')</line-10>
{"code": "<line-2>\ta, b, c = input(), input(), input()</line-2>\n<line-8>\t\t\tok = False</line-8>", "lines": [2, 8]} #### 0
<line-1>for __ in range(int(input())):</line-1> <line-3> ar = list(map(int, input().split()))</line-3> <line-5> print(*ar)</line-5>
{"code": "<line-2> n = int(input())</line-2>\n<line-4> ar.reverse()</line-4>", "lines": [2, 4]} #### 0
<line-1>def one():</line-1> <line-3></line-3> <line-4></line-4> <line-5>def two():</line-5> <line-6> return list(map(int, input().split()))</line-6> <line-7></line-7> <line-8></line-8> <line-9>def lis():</line-9> <line-10> return list(map(int, input().split()))</line-10> <line-11></line-11> <line-12></line-12> <l...
{"code": "<line-2> return int(input())</line-2>\n<line-22> else:</line-22>", "lines": [2, 22]} #### 0
<line-1># encoding: utf-8</line-1> <line-3></line-3> <line-4>def solve(a):</line-4> <line-5></line-5> <line-6> # root node of tries denotes empty stack</line-6> <line-7> stack = [None]</line-7> <line-8> node_stack = [[1, {}]]</line-8> <line-9> trie = node_stack[-1]</line-9> <line-10></line-10> <line-11> ...
{"code": "<line-2>from sys import stdin</line-2>\n<line-42> a = [int(i) for i in stdin.readline().strip().split()]</line-42>", "lines": [2, 42]} #### 0
<line-1>import sys</line-1> <line-2></line-2> <line-4></line-4> <line-5>for _ in range(int(input())):</line-5> <line-6> s=input().rstrip()</line-6> <line-7> x=int(input())</line-7> <line-8> n=len(s)</line-8> <line-9> ans=["1" for i in range(n)]</line-9> <line-10> for i in range(n):</line-10> <line-11> ...
{"code": "<line-3>input=sys.stdin.readline</line-3>\n<line-26> else:</line-26>", "lines": [3, 26]} #### 0
<line-1>def solve():</line-1> <line-3> lst = list(map(int,input().split()))</line-3> <line-4> if sum(lst) <= n // 2:</line-4> <line-5> print(n//2)</line-5> <line-6> print("0 " * (n // 2))</line-6> <line-7> else:</line-7> <line-8> print(n//2 + (n // 2) % 2)</line-8> <line-9> print("1...
{"code": "<line-2> n = int(input())</line-2>\n<line-10>for i in range(int(input())):</line-10>", "lines": [2, 10]} #### 0
<line-1>import sys</line-1> <line-2></line-2> <line-4>readlines = sys.stdin.readlines</line-4> <line-5>ns = lambda: readline().rstrip()</line-5> <line-6>ni = lambda: int(readline().rstrip())</line-6> <line-7>nm = lambda: map(int, readline().split())</line-7> <line-8>nl = lambda: list(map(int, readline().split()))</line...
{"code": "<line-3>readline = sys.stdin.readline</line-3>\n<line-30>for _ in range(T):</line-30>", "lines": [3, 30]} #### 0
<line-1>n = input()</line-1> <line-3>for i in a:</line-3> <line-4> if i % 7 == 0 or (i // 7) % 2 == 1 or i <= 14:</line-4> <line-5> print('NO')</line-5> <line-7> print('YES')</line-7>
{"code": "<line-2>a = list(map(int, input().split()))</line-2>\n<line-6>\telse:</line-6>", "lines": [2, 6]} #### 0
<line-1>from sys import stdin</line-1> <line-2></line-2> <line-4></line-4> <line-5>for loop in range(tt):</line-5> <line-6></line-6> <line-7> n = int(stdin.readline())</line-7> <line-8> a = list(map(int,stdin.readline().split()))</line-8> <line-9></line-9> <line-10> lis = [ [1] ]</line-10> <line-11></line-11> ...
{"code": "<line-3>tt = int(stdin.readline())</line-3>\n<line-33> #print (lis)</line-33>", "lines": [3, 33]} #### 0
<line-1>import math</line-1> <line-3>from sys import stdin, stdout</line-3> <line-4>from string import ascii_letters</line-4> <line-5>import sys</line-5> <line-6>letters = ascii_letters</line-6> <line-7>input = stdin.readline</line-7> <line-8>#print = stdout.write</line-8> <line-9></line-9> <line-10>for _ in range(int(...
{"code": "<line-2>from collections import deque</line-2>\n<line-22> last += 1</line-22>", "lines": [2, 22]} #### 0
<line-1>t = int(input())</line-1> <line-3> n = int(input())</line-3> <line-4> a = [0] + list(map(int,input().split()))</line-4> <line-5> nun = []</line-5> <line-6> ans = []</line-6> <line-7> f = True</line-7> <line-8> for i in range(1, n + 1):</line-8> <line-9> if a[i] == a[i-1]:</line-9> <line...
{"code": "<line-2>for faw in range(t):</line-2>\n<line-21> else:</line-21>", "lines": [2, 21]} #### 0
<line-2> print("YES" if set(input()).intersection(input()) else "NO")</line-2>
{"code": "<line-1>for _ in range(int(input())):</line-1>", "lines": [1]} #### 0
<line-1>for tc in range(int(input())):</line-1> <line-3> al = list(map(int, input().split()))</line-3> <line-4> bl = list(map(int, input().split()))</line-4> <line-5> aidx = {}</line-5> <line-6> for i,e in enumerate(al):</line-6> <line-7> aidx[e]=i</line-7> <line-8> midx = -1</line-8> <line-9> ...
{"code": "<line-2> n,m = list(map(int, input().split()))</line-2>\n<line-16> midx = max(midx, idx)</line-16>", "lines": [2, 16]} #### 0
<line-1>T = int(input())</line-1> <line-3> n,t = list(map(int,input().split()))</line-3> <line-4> a = list(map(int,input().split()))</line-4> <line-5> res = []</line-5> <line-6> j=0</line-6> <line-7> for i in a:</line-7> <line-8> if(i*2<t):</line-8> <line-9> res+=["0"]</line-9> <line-10...
{"code": "<line-2>for test in range(T):</line-2>\n<line-14> j = 1-j</line-14>", "lines": [2, 14]} #### 0
<line-1>#JMD</line-1> <line-3></line-3> <line-4> </line-4> <line-5>import sys</line-5> <line-6>import math</line-6> <line-7></line-7> <line-8>#import fractions</line-8> <line-9>#import numpy</line-9> <line-10> </line-10> <line-11>###File Operations###</line-11> <line-12>fileoperation=0</line-12> <line-13>if(fileoperati...
{"code": "<line-2>#Nagendra Jha-4096</line-2>\n<line-51> inputfile.close()</line-51>", "lines": [2, 51]} #### 0
<line-1>import sys</line-1> <line-3></line-3> <line-4>def count(a, b, num_a, num_b, cur_time):</line-4> <line-5> current_result = 0</line-5> <line-6> #print('count time = ', cur_time, "num_a =", num_a, 'num_b = ', num_b)</line-6> <line-7> if num_a * a + num_b * b <= cur_time and cur_time >= 0:</line-7> <line-8> cur_ti...
{"code": "<line-2>from operator import itemgetter</line-2>\n<line-73>\ttasks = list(zip(t, types))</line-73>", "lines": [2, 73]} #### 0
<line-1>import sys</line-1> <line-3>input = reader.__next__</line-3> <line-4></line-4> <line-5>def solve():</line-5> <line-6> s,c = input().split()</line-6> <line-7> # i,jでjが複数あるとき</line-7> <line-8> n = len(s)</line-8> <line-9> for i in range(n-1):</line-9> <line-10> prev = s[i]</line-10> <line-11> ...
{"code": "<line-2>reader = (s.rstrip() for s in sys.stdin)</line-2>\n<line-30>for i in range(t):</line-30>", "lines": [2, 30]} #### 0
<line-2>for _ in range(q):</line-2> <line-3> c, m, x = list(map(int, input().split()))</line-3> <line-4> print(min([c, m, (c + m + x) // 3]))</line-4>
{"code": "<line-1>q = int(input())</line-1>", "lines": [1]} #### 0
<line-1>for _ in range(int(input())):</line-1> <line-3> n = int(input())</line-3> <line-4> # arr = list(map(int, input().split()))</line-4> <line-5> s = input()</line-5> <line-6> l = 0</line-6> <line-7> r = n - 1</line-7> <line-8> if s.count('0') == n:</line-8> <line-9> print(s)</line-9> <line-...
{"code": "<line-2> # a, b = map(int, input().split())</line-2>\n<line-20> continue</line-20>", "lines": [2, 20]} #### 0
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
4