question stringlengths 0 30.2k | answer stringlengths 55 2.44k |
|---|---|
<line-1>N=100001</line-1>
<line-3>for i in range(1,N):</line-3>
<line-4> for j in range(i,N,i):</line-4>
<line-5> fac[j]+=1</line-5>
<line-6>def gcd(a,b):</line-6>
<line-7> if a<b:</line-7>
<line-8> a,b=b,a</line-8>
<line-9> while b>0:</line-9>
<line-10> a,b=b,a%b</line-10>... | {"code": "<line-2>fac=[0 for i in range(N)]</line-2>\n<line-46> print(ctt(a,b,c))</line-46>", "lines": [2, 46]}
#### 0 |
<line-1>from sys import stdin</line-1>
<line-2></line-2>
<line-4> </line-4>
<line-5> x = a</line-5>
<line-6> while x <= (len(bit)-1):</line-6>
<line-7> bit[x] += w</line-7>
<line-8> x += x & (-1 * x)</line-8>
<line-9> </line-9>
<line-10>def bitsum(a,bit):</line-10>
<line-11> </line-11>
<line-12> ... | {"code": "<line-3>def bitadd(a,w,bit):</line-3>\n<line-97>for i in ans:</line-97>", "lines": [3, 97]}
#### 0 |
<line-1>import random</line-1>
<line-3></line-3>
<line-4>def set_color(game, color):</line-4>
<line-5> color_count[game[0]][game[2]] -= 1</line-5>
<line-6> color_count[game[1]][game[2]] -= 1</line-6>
<line-7> game[2] = color</line-7>
<line-8> color_count[game[0]][game[2]] += 1</line-8>
<line-9> color_cou... | {"code": "<line-2>import math</line-2>\n<line-59>for i in range(m):</line-59>", "lines": [2, 59]}
#### 0 |
<line-1>from collections import deque</line-1>
<line-2></line-2>
<line-4> k = 2 * r + 1</line-4>
<line-5> d = deque()</line-5>
<line-6> lx = len(x)</line-6>
<line-7> for i in range(lx + r):</line-7>
<line-8> if i < lx:</line-8>
<line-9> while d and d[-1][1] <= x[i]:</line-9>
<line-10> ... | {"code": "<line-3>def rollingmax(x, y, r, a):</line-3>\n<line-27> f, g = g, f</line-27>", "lines": [3, 27]}
#### 0 |
<line-1>import sys</line-1>
<line-3></line-3>
<line-4>def main():</line-4>
<line-5> R, C, N = map(int, input().split())</line-5>
<line-6> xyxy = [list(map(int, input().split())) for i in range(N)]</line-6>
<line-7></line-7>
<line-8> r = []</line-8>
<line-9></line-9>
<line-10> for i in range(N):</line-10>
<l... | {"code": "<line-2>input = sys.stdin.readline</line-2>\n<line-54> main()</line-54>", "lines": [2, 54]}
#### 0 |
<line-1>#!/usr/bin/env python3</line-1>
<line-2></line-2>
<line-3></line-3>
<line-5></line-5>
<line-6>def powmod(a, x, m = M):</line-6>
<line-7> y = 1</line-7>
<line-8> while 0 < x:</line-8>
<line-9> if x % 2 == 1:</line-9>
<line-10> y *= a</line-10>
<line-11> y %= m</line-11>
<line-1... | {"code": "<line-4>M = 998244353</line-4>\n<line-65> main()</line-65>", "lines": [4, 65]}
#### 0 |
<line-1># ARC090E</line-1>
<line-2></line-2>
<line-4> M = 10**9 + 7</line-4>
<line-5> import sys</line-5>
<line-6> input = lambda : sys.stdin.readline().rstrip()</line-6>
<line-7></line-7>
<line-8> n, m = map(int, input().split())</line-8>
<line-9> s, t = map(int, input().split())</line-9>
<line-10> s... | {"code": "<line-3>def hoge():</line-3>\n<line-73> print((nums1[t]*nums2[s] - (c1+c2)) % M)</line-73>", "lines": [3, 73]}
#### 0 |
<line-1>import sys</line-1>
<line-2></line-2>
<line-3></line-3>
<line-5> section_start = -1</line-5>
<line-6> moved_left_max = 0</line-6>
<line-7> moved_right_max = 0</line-7>
<line-8> prev = True</line-8>
<line-9></line-9>
<line-10> for i, p in enumerate(ppp, start=1):</line-10>
<line-11> if i ==... | {"code": "<line-4>def solve(ppp):</line-4>\n<line-44>n, *ppp = list(map(int, sys.stdin))</line-44>", "lines": [4, 44]}
#### 0 |
<line-1>import sys</line-1>
<line-2></line-2>
<line-4></line-4>
<line-5>N,M=list(map(int,input().split()))</line-5>
<line-6></line-6>
<line-7># N: 処理する区間の長さ</line-7>
<line-8>INF = 2**31-1</line-8>
<line-9></line-9>
<line-10>LV = (M+2-1).bit_length()</line-10>
<line-11>N0 = 2**LV</line-11>
<line-12>data = [0]*(2*N0)</li... | {"code": "<line-3>input=sys.stdin.readline</line-3>\n<line-85> add=min(m,add)</line-85>", "lines": [3, 85]}
#### 0 |
<line-1>import sys</line-1>
<line-3></line-3>
<line-4>input=sys.stdin.readline</line-4>
<line-5></line-5>
<line-6>N=int(input())</line-6>
<line-7>edge=[[] for i in range(N)]</line-7>
<line-8>for i in range(N-1):</line-8>
<line-9> x,y=list(map(int,input().split()))</line-9>
<line-10> edge[x-1].append(y-1)</line-10... | {"code": "<line-2>from collections import deque</line-2>\n<line-106>#print(base)</line-106>", "lines": [2, 106]}
#### 0 |
<line-1>import sys</line-1>
<line-3>n = int(input())</line-3>
<line-4>p = list(map(int, input().split()))</line-4>
<line-5>c = [[] for _ in range(n)]</line-5>
<line-6>is_leaf = [True for _ in range(n)]</line-6>
<line-7>for i in range(n):</line-7>
<line-8> p[i] -= 1</line-8>
<line-9> c[p[i]].append(i)</line-9>
<line-10>... | {"code": "<line-2>sys.setrecursionlimit(10**6)</line-2>\n<line-85>\t\treturn</line-85>", "lines": [2, 85]}
#### 0 |
<line-1>from collections import deque</line-1>
<line-2></line-2>
<line-4>adj = [[1 for _ in range(N + 1)] for _ in range(N + 1)]</line-4>
<line-5>for _ in range(M):</line-5>
<line-6> a, b = list(map(int, input().split()))</line-6>
<line-7> adj[a][b] = 0</line-7>
<line-8> adj[b][a] = 0</line-8>
<line-9>adj_inv ... | {"code": "<line-3>N, M = list(map(int, input().split()))</line-3>\n<line-62> break</line-62>", "lines": [3, 62]}
#### 0 |
<line-1># coding: utf-8</line-1>
<line-3>import sys</line-3>
<line-4>read = sys.stdin.read</line-4>
<line-5>readline = sys.stdin.readline</line-5>
<line-6></line-6>
<line-7>n,X,Y,Z = list(map(int,read().split()))</line-7>
<line-8></line-8>
<line-9>N = 1<<(X+Y+Z)</line-9>
<line-10>NX = 1<<X</line-10>
<line-11>NY = 1<<(X... | {"code": "<line-2># Your code here!</line-2>\n<line-55>ans = (pow(10,n,MOD)-sum(dp))</line-55>", "lines": [2, 55]}
#### 0 |
<line-1>import sys</line-1>
<line-3></line-3>
<line-4>class UnionFind(object):</line-4>
<line-5> def __init__(self, n):</line-5>
<line-6> self._par = list(range(n))</line-6>
<line-7> self.size = [1]*n</line-7>
<line-8></line-8>
<line-9> def root(self, v):</line-9>
<line-10> if self._par[v] ==... | {"code": "<line-2>readline = sys.stdin.readline</line-2>\n<line-37> ans += 1</line-37>", "lines": [2, 37]}
#### 0 |
<line-1>#!/usr/bin/env python3</line-1>
<line-2></line-2>
<line-4> N = int(input())</line-4>
<line-5> A = list(map(int, input().split()))</line-5>
<line-6> B = list(map(int, input().split()))</line-6>
<line-7> ans = 0</line-7>
<line-8> for k in range(30):</line-8>
<line-9> C = [x & ((1 << (k+1)) -... | {"code": "<line-3>def main():</line-3>\n<line-30> print(ans)</line-30>", "lines": [3, 30]}
#### 0 |
<line-1>t = int(input())</line-1>
<line-2></line-2>
<line-4> n = int(input())</line-4>
<line-5> l = [int(x) for x in input().split()]</line-5>
<line-7> print("YES" if len(set(vals)) == n else "NO")</line-7> | {"code": "<line-3>for _ in range(t):</line-3>\n<line-6> vals = [(x + i) % n for i, x in enumerate(l)]</line-6>", "lines": [3, 6]}
#### 0 |
<line-1>n, r = [int(x) for x in input().split()]</line-1>
<line-2></line-2>
<line-4></line-4>
<line-5>xs = [int(x) for x in input().split()]</line-5>
<line-6></line-6>
<line-7>s = sum(xs)</line-7>
<line-8></line-8>
<line-9>res = [0 for _ in range(r+1)]</line-9>
<line-10>for i in range(r):</line-10>
<line-11> res[i] ... | {"code": "<line-3>n = 2 ** n</line-3>\n<line-15>res[r] = s / n</line-15>", "lines": [3, 15]}
#### 0 |
<line-1>import sys</line-1>
<line-3></line-3>
<line-4>MOD = 10 ** 9 + 7</line-4>
<line-5></line-5>
<line-6>t = int(input())</line-6>
<line-7>for _ in range(t):</line-7>
<line-8> n, p = list(map(int, input().split()))</line-8>
<line-9> l = list(map(int, input().split()))</line-9>
<line-10> if p == 1:</line-10>
... | {"code": "<line-2>input = sys.stdin.readline</line-2>\n<line-35> out *= pow(p, curr, MOD)</line-35>", "lines": [2, 35]}
#### 0 |
<line-1>rnd_mod = 1234567890133</line-1>
<line-3>def rnd():</line-3>
<line-4> nonlocal rnd_x</line-4>
<line-5> rnd_x = rnd_x**2 % rnd_mod</line-5>
<line-6> return (rnd_x>>5) % (1<<20)</line-6>
<line-7>def randrange(a):</line-7>
<line-8> return rnd() % a</line-8>
<line-9></line-9>
<line-10>T = int(input())</... | {"code": "<line-2>rnd_x = 987654321098</line-2>\n<line-22> ma = max(ma, sum([max([Y[i][j] for i in range(M)]) for j in range(N)]))</line-22>", "lines": [2, 22]}
#### 0 |
<line-1>import sys</line-1>
<line-2> </line-2>
<line-4></line-4>
<line-5>n, m, q = inp[0], inp[1], inp[2]</line-5>
<line-6></line-6>
<line-7>p = [inp[idx] for idx in range(3, n + 3)]</line-7>
<line-8></line-8>
<line-9>index_arr = [0] * (n + 1)</line-9>
<line-10>for i in range(n): index_arr[p[i]] = i</line-10>
<line-... | {"code": "<line-3>inp = [int(x) for x in sys.stdin.read().split()]</line-3>\n<line-57>\t\tans.append('0')</line-57>", "lines": [3, 57]}
#### 0 |
<line-1>n = int(input())</line-1>
<line-3>rows = [(int(x),int(y)) for x,y in rows]</line-3>
<line-4>points = {}</line-4>
<line-5>for x,y in rows:</line-5>
<line-6> if x in points:</line-6>
<line-7> points[x] = max(y, points[x])</line-7>
<line-8> else:</line-8>
<line-9> points[x] = y</line-9>
<line-1... | {"code": "<line-2>rows = [input().split() for _ in range(n)]</line-2>\n<line-63>out = len(Us) - 1</line-63>", "lines": [2, 63]}
#### 0 |
<line-1>import os</line-1>
<line-3>from io import BytesIO, IOBase</line-3>
<line-4></line-4>
<line-5></line-5>
<line-6>def main():</line-6>
<line-7> pass</line-7>
<line-8></line-8>
<line-9></line-9>
<line-10># region fastio</line-10>
<line-11></line-11>
<line-12>BUFSIZE = 8192</line-12>
<line-13></line-13>
<line-14>... | {"code": "<line-2>import sys</line-2>\n<line-84> out.append(pref[v])</line-84>", "lines": [2, 84]}
#### 0 |
<line-1>import sys</line-1>
<line-3>from itertools import accumulate</line-3>
<line-4>from collections import Counter</line-4>
<line-5>from bisect import bisect as br, bisect_left as bl</line-5>
<line-6>class PMS:</line-6>
<line-7> #1-indexed</line-7>
<line-8> def __init__(self, A, B, issum = False):</line-8>
<li... | {"code": "<line-2>readline = sys.stdin.readline</line-2>\n<line-169> Ans[qu] = ans</line-169>", "lines": [2, 169]}
#### 0 |
<line-1>class BIT():</line-1>
<line-3> add: 区間[begin, end)にvalを加える</line-3>
<line-4> get_val: i番目(0-indexed)の値を求める</line-4>
<line-5> """</line-5>
<line-6> def __init__(self, n):</line-6>
<line-7> self.n = n</line-7>
<line-8> self.bit = [0] * (n + 1)</line-8>
<line-9></line-9>
<line-10> def ... | {"code": "<line-2> \"\"\"区間加算、一点取得クエリをそれぞれO(logN)で応えるデータ構造を構築する</line-2>\n<line-101> ans = odd_bit.get_val(begin[pos] // 2)</line-101>", "lines": [2, 101]}
#### 0 |
<line-1>n =int(input())</line-1>
<line-3>h=[]</line-3>
<line-4>c=[]</line-4>
<line-5>cntw={}</line-5>
<line-6>cnth={}</line-6>
<line-7>gcdC=0</line-7>
<line-8>cntC=0</line-8>
<line-9>def insert1(a,b,c):</line-9>
<line-10> if not a in b :</line-10>
<line-11> b[a]=c</line-11>
<line-12> else :</line-12>
<line-13> b[a]=b... | {"code": "<line-2>w=[]</line-2>\n<line-46>\ti += 1</line-46>", "lines": [2, 46]}
#### 0 |
<line-1>from sys import stdin</line-1>
<line-3>def NC_Dij(lis,start):</line-3>
<line-4></line-4>
<line-5> ret = [float("inf")] * len(lis)</line-5>
<line-6> ret[start] = 0</line-6>
<line-7> </line-7>
<line-8> q = deque([start])</line-8>
<line-9> plis = [i for i in range(len(lis))]</line-9>
<line-10></line... | {"code": "<line-2>from collections import deque</line-2>\n<line-57> else:</line-57>", "lines": [2, 57]}
#### 0 |
<line-1>import sys</line-1>
<line-3></line-3>
<line-4>S = list([ord(x)-97 for x in readline().strip()])</line-4>
<line-5>N = len(S)</line-5>
<line-6>table = [[0]*26 for _ in range(N)]</line-6>
<line-7>for i in range(N):</line-7>
<line-8> table[i][S[i]] = 1</line-8>
<line-9>for i in range(1, N):</line-9>
<line-10> ... | {"code": "<line-2>readline = sys.stdin.readline</line-2>\n<line-26> Ans[qu] = True</line-26>", "lines": [2, 26]}
#### 0 |
<line-1>for __ in range(int(input())):</line-1>
<line-3> s = list(map(int, input()))</line-3>
<line-4> r = [0] * n</line-4>
<line-5> for i in range(10):</line-5>
<line-6> left_lim = 0</line-6>
<line-7> for j, c in enumerate(s):</line-7>
<line-8> if c < i: left_lim = j + 1</line-8>
<lin... | {"code": "<line-2> n = int(input())</line-2>\n<line-18> if not flg:</line-18>", "lines": [2, 18]}
#### 0 |
<line-1>k,n = map(int,input().split())</line-1>
<line-3> ans = []</line-3>
<line-4> ans.append(k//2)</line-4>
<line-5> for i in range(n-1):</line-5>
<line-6> ans.append(k)</line-6>
<line-7> print(*ans)</line-7>
<line-8>else:</line-8>
<line-9> ans = []</line-9>
<line-10> for i in range(n):</line-10>
<line-11> ... | {"code": "<line-2>if k %2 ==0:</line-2>\n<line-19> ans.append(k)</line-19>", "lines": [2, 19]}
#### 0 |
<line-1>import sys</line-1>
<line-3></line-3>
<line-4>from collections import deque</line-4>
<line-5>N = int(input())</line-5>
<line-6>X = [[] for i in range(N)]</line-6>
<line-7>for i in range(N-1):</line-7>
<line-8> x, y = map(int, input().split())</line-8>
<line-9> X[x-1].append(y-1)</line-9>
<line-10> X[y-... | {"code": "<line-2>input = lambda: sys.stdin.readline().rstrip()</line-2>\n<line-63> print(Y[i][0])</line-63>", "lines": [2, 63]}
#### 0 |
<line-1>import bisect</line-1>
<line-3></line-3>
<line-4>X = int(input())</line-4>
<line-5>K = int(input())</line-5>
<line-6>r = [0] + inpl()</line-6>
<line-7>stu = [()]*(K+1)</line-7>
<line-8>stu[0] = (X, 0, 0)</line-8>
<line-9>for i, v in enumerate(r[1:], 1):</line-9>
<line-10> s, t, u = stu[i-1]</line-10>
<line-1... | {"code": "<line-2>def inpl(): return [int(i) for i in input().split()]</line-2>\n<line-43> else:</line-43>", "lines": [2, 43]}
#### 0 |
<line-1>A = [ord(a)-97 for a in input()]</line-1>
<line-3>X = [0] * 26</line-3>
<line-4>Y = [0] * (N + 2)</line-4>
<line-5>NE = [0] * N</line-5>
<line-6>R = [N] * 26</line-6>
<line-7>s = 0</line-7>
<line-8>t = 1</line-8>
<line-9>for i in range(N)[::-1]:</line-9>
<line-10> a = A[i]</line-10>
<line-11> if X[a] == 0... | {"code": "<line-2>N = len(A)</line-2>\n<line-31> R[a] = NE[i]</line-31>", "lines": [2, 31]}
#### 0 |
<line-1>import sys</line-1>
<line-3> return sys.stdin.readline()[:-1]</line-3>
<line-4></line-4>
<line-5>H, W = map(int, input().split())</line-5>
<line-6>s = [input() for _ in range(H)]</line-6>
<line-7>ans = max(H, W)</line-7>
<line-8></line-8>
<line-9>def max_rect(a):</line-9>
<line-10> res = 0</line-10>
<line-11> s... | {"code": "<line-2>def input():</line-2>\n<line-37>\tans = max(ans, max_rect(dp[i]))</line-37>", "lines": [2, 37]}
#### 0 |
<line-1>from collections import defaultdict</line-1>
<line-3>C = defaultdict(int)</line-3>
<line-4>for i in range(N):</line-4>
<line-5> D = int(input())</line-5>
<line-6> C[D] = i + 1</line-6>
<line-7>E = []</line-7>
<line-8>H = [1] * (N + 1)</line-8>
<line-9>DD = sorted([[k, v] for k, v in C.items()], reverse=True)<... | {"code": "<line-2>N = int(input())</line-2>\n<line-42> else:</line-42>", "lines": [2, 42]}
#### 0 |
<line-1>w=list(input());n=len(w);t=-1</line-1>
<line-3> m=len(s);z=[0]*m;c=0;f=[1]*m;</line-3>
<line-4> for i in range(1,m):</line-4>
<line-5> if i+z[i-c]<c+z[c]:z[i]=z[i-c]</line-5>
<line-6> else:</line-6>
<line-7> j=max(0,c+z[c]-i)</line-7>
<line-8> while i+j<n and s[j]==s[i+... | {"code": "<line-2>def Z(s):</line-2>\n<line-23> if zl[i] and zr[n-2-i]:cnt=cnt+1</line-23>", "lines": [2, 23]}
#### 0 |
<line-2>a=[[0,int(s)]for s in input().split()]</line-2>
<line-3>while j>1:j>>=1;a=[sorted(a[i]+a[i^j]*(i&j>0))[-2:]for i in range(n)]</line-3>
<line-4>for s,f in a[1:]:j=max(j,s+f);print(j)</line-4> | {"code": "<line-1>j=n=1<<int(input())</line-1>", "lines": [1]}
#### 0 |
<line-1>import sys</line-1>
<line-3> return sys.stdin.readline()[:-1]</line-3>
<line-4></line-4>
<line-5>n = int(input())</line-5>
<line-6>d = []</line-6>
<line-7>M, m = 0, 10**30</line-7>
<line-8>M_of_m, m_of_M = 0, 10**30</line-8>
<line-9>for _ in range(n):</line-9>
<line-10> x, y = map(int, input().split())</line-10... | {"code": "<line-2>def input():</line-2>\n<line-33>#print(ans1, ans2)</line-33>", "lines": [2, 33]}
#### 0 |
<line-1>#from collections import deque,defaultdict</line-1>
<line-3>inn = lambda : int(input())</line-3>
<line-4>inl = lambda: list(map(int, input().split()))</line-4>
<line-5>inm = lambda: map(int, input().split())</line-5>
<line-6>ins = lambda : input().strip()</line-6>
<line-7>DBG = True # and False</line-7... | {"code": "<line-2>printn = lambda x: print(x,end='')</line-2>\n<line-28> 3/0</line-28>", "lines": [2, 28]}
#### 0 |
<line-1>import collections</line-1>
<line-2></line-2>
<line-3></line-3>
<line-5> def __init__(self, l):</line-5>
<line-6> self.size = l</line-6>
<line-7> self.bit = [0] * (self.size+1)</line-7>
<line-8></line-8>
<line-9> def sum(self, i):</line-9>
<line-10> s = 0</line-10>
<line-11> wh... | {"code": "<line-4>class Bit():</line-4>\n<line-58> bit.add(b, 1)</line-58>", "lines": [4, 58]}
#### 0 |
<line-1>class dsu:</line-1>
<line-3> self._n = n</line-3>
<line-4> self.parent_or_size = [-1] * n</line-4>
<line-5> </line-5>
<line-6> def merge(self, a: int, b: int) -> int:</line-6>
<line-7> x = self.leader(a)</line-7>
<line-8> y = self.leader(b)</line-8>
<line-9> if x == y:</... | {"code": "<line-2> def __init__(self, n=0):</line-2>\n<line-68>ans = sum(dp[s.leader(0)])</line-68>", "lines": [2, 68]}
#### 0 |
<line-1>N,T = list(map(int,input().split()))</line-1>
<line-3></line-3>
<line-4>cummax = [A[-1]]</line-4>
<line-5>for a in reversed(A[:-1]):</line-5>
<line-6> cummax.append(max(cummax[-1], a))</line-6>
<line-7>cummax.reverse()</line-7>
<line-8></line-8>
<line-9>maxgain = n = 0</line-9>
<line-10>for buy,sell in zip(A... | {"code": "<line-2>A = list(map(int,input().split()))</line-2>\n<line-16> n += 1</line-16>", "lines": [2, 16]}
#### 0 |
<line-1>import sys</line-1>
<line-3>import numpy as np</line-3>
<line-4>from heapq import heappush, heappop</line-4>
<line-5></line-5>
<line-6>N = int(input())</line-6>
<line-7>A = np.array(input().split(), dtype=np.int32)</line-7>
<line-8>a_to_i = {a:i for i,a in enumerate(A)}</line-8>
<line-9></line-9>
<line-10># spa... | {"code": "<line-2>input = sys.stdin.readline</line-2>\n<line-44> heappush(q,F(left,right))</line-44>", "lines": [2, 44]}
#### 0 |
<line-1># coding: utf-8</line-1>
<line-3>import sys</line-3>
<line-4>read = sys.stdin.read</line-4>
<line-5>readline = sys.stdin.readline</line-5>
<line-6></line-6>
<line-7>n, = list(map(int, readline().split()))</line-7>
<line-8>p = [-1] + [*list(map(int, readline().split()))]</line-8>
<line-9></line-9>
<line-10>MOD =... | {"code": "<line-2># Your code here!</line-2>\n<line-54>print((ans%MOD))</line-54>", "lines": [2, 54]}
#### 0 |
<line-1># なんだか釈然としていないが解説の通りに</line-1>
<line-3>import sys</line-3>
<line-4></line-4>
<line-5>def MI(): return list(map(int, sys.stdin.readline().split()))</line-5>
<line-6></line-6>
<line-7>class water:</line-7>
<line-8> def __init__(self, t, v):</line-8>
<line-9> self.v = v</line-9>
<line-10> self.tv ... | {"code": "<line-2>from collections import deque</line-2>\n<line-55> dam[0] += w</line-55>", "lines": [2, 55]}
#### 0 |
<line-1>n, d = list(map(int, input().split()))</line-1>
<line-3>A = [0]*(n+1)</line-3>
<line-4>P = [0]*(n+1)</line-4>
<line-5></line-5>
<line-6>P[0] = pos = d</line-6>
<line-7>for i, x in enumerate(D):</line-7>
<line-8> if x <= 2*pos:</line-8>
<line-9> pos = abs(x-pos)</line-9>
<line-10> P[i+1] = pos</line... | {"code": "<line-2>D = list(map(int, input().split()))</line-2>\n<line-25> else:</line-25>", "lines": [2, 25]}
#### 0 |
<line-1>#!/usr/bin/env python3</line-1>
<line-3>input = sys.stdin.readline</line-3>
<line-4>from collections import deque</line-4>
<line-5>INF = 10**9</line-5>
<line-6></line-6>
<line-7>n, m = map(int, input().split())</line-7>
<line-8>pqc = []</line-8>
<line-9></line-9>
<line-10>seen = set()</line-10>
<line-11>for i i... | {"code": "<line-2>import sys</line-2>\n<line-65>else:</line-65>", "lines": [2, 65]}
#### 0 |
<line-1>N=int(input())</line-1>
<line-3>O=10**9+7</line-3>
<line-4>D=[pow(-~O//2,M,O)]+[0]*N</line-4>
<line-6>print(D[M])</line-6> | {"code": "<line-2>M=len(input())</line-2>\n<line-5>for _ in'_'*N:D=[D[0]+D[1]]+[(i+2*j)%O for i,j in zip(D[2:]+[0],D[:-1])]</line-5>", "lines": [2, 5]}
#### 0 |
<line-1>import sys</line-1>
<line-3></line-3>
<line-4></line-4>
<line-5>def diameter(n, links):</line-5>
<line-6> q = deque([(0, -1)])</line-6>
<line-7> v = 0</line-7>
<line-8> while q:</line-8>
<line-9> v, p = q.popleft()</line-9>
<line-10> q.extend((u, v) for u in links[v] if u != p)</line-10>
... | {"code": "<line-2>from collections import deque</line-2>\n<line-64> links[w].add(v)</line-64>", "lines": [2, 64]}
#### 0 |
<line-1>N, a, b = list(map(int, input().split())); a -= 1; b -= 1</line-1>
<line-3>Q = []</line-3>
<line-4>for i in range(N):</line-4>
<line-5> x, y = list(map(int, input().split()))</line-5>
<line-6> P.append((x-y, x+y, i))</line-6>
<line-7> Q.append((x+y, x-y, i))</line-7>
<line-8></line-8>
<line-9>d = max(a... | {"code": "<line-2>P = []</line-2>\n<line-62> S += C[i]; T += D[i]</line-62>", "lines": [2, 62]}
#### 0 |
<line-1>import sys</line-1>
<line-3></line-3>
<line-4>ip=lambda: int(sp())</line-4>
<line-5>fp=lambda: float(sp())</line-5>
<line-6>lp=lambda:list(map(int,stdin.readline().split()))</line-6>
<line-7>sp=lambda:stdin.readline().rstrip()</line-7>
<line-8>yp=lambda:print('Yes')</line-8>
<line-9>np=lambda:print('No')</line-... | {"code": "<line-2>stdin=sys.stdin</line-2>\n<line-15> ans+=min(b,a*(x[i+1]-x[i]))</line-15>", "lines": [2, 15]}
#### 0 |
<line-1>import sys</line-1>
<line-3>from collections import deque</line-3>
<line-4>def slidemax(X, k):</line-4>
<line-5> q = deque([])</line-5>
<line-6> ret = []</line-6>
<line-7> for i in range(len(X)):</line-7>
<line-8> while q and q[-1][1] <= X[i]:</line-8>
<line-9> q.pop()</line-9>
<line-... | {"code": "<line-2>input = sys.stdin.readline</line-2>\n<line-31> A = [a+c for a, c in zip(A, C)]</line-31>", "lines": [2, 31]}
#### 0 |
<line-1>d = [-1] * 1000001</line-1>
<line-3> n, a = int(input()), list(map(int, input().split()))</line-3>
<line-4> a.sort()</line-4>
<line-5> for i in range(n):</line-5>
<line-6> for j in range(i + 1, n): d[a[j] - a[i]] = t</line-6>
<line-7> i = 1</line-7>
<line-9> print("YES\n" + ' '.join(str(j... | {"code": "<line-2>for t in range(int(input())):</line-2>\n<line-8> while any(d[i * j] == t for j in range(1, n)): i += 1</line-8>", "lines": [2, 8]}
#### 0 |
<line-1>r, c = list(map(int, input().split()))</line-1>
<line-3> print('>vv')</line-3>
<line-4> print('^<.')</line-4>
<line-5> print('^.<')</line-5>
<line-6> print('1 3')</line-6>
<line-7>elif r == 5:</line-7>
<line-8> print('>...v')</line-8>
<line-9> print('v.<..')</line-9>
<line-10> print('..^..'... | {"code": "<line-2>if r == 3:</line-2>\n<line-22> d = []</line-22>", "lines": [2, 22]}
#### 0 |
<line-1>import math</line-1>
<line-3></line-3>
<line-4>input = sys.stdin.readline</line-4>
<line-5></line-5>
<line-6>def main():</line-6>
<line-7></line-7>
<line-8></line-8>
<line-9></line-9>
<line-10> MAX_N = int(1e6) + 1</line-10>
<line-11></line-11>
<line-12> dp = [0 for i in range(MAX_N)]</line-12>
<line-13> ... | {"code": "<line-2>import sys</line-2>\n<line-50> main()</line-50>", "lines": [2, 50]}
#### 0 |
<line-1>from bisect import bisect_left as bl</line-1>
<line-3>from heapq import heappush,heappop,heapify</line-3>
<line-4>import math</line-4>
<line-5>from collections import *</line-5>
<line-6>from functools import reduce,cmp_to_key</line-6>
<line-7>import sys</line-7>
<line-8>input = sys.stdin.readline</line-8>
<line... | {"code": "<line-2>from bisect import bisect_right as br</line-2>\n<line-56> break</line-56>", "lines": [2, 56]}
#### 0 |
<line-1>n = int(input())</line-1>
<line-3>b = list(map(int, input().split()))</line-3>
<line-4>c = [0] * n</line-4>
<line-5>stk = [0]</line-5>
<line-6>for i in range(1, n):</line-6>
<line-7> while len(stk) > 1 and c[stk[1]] - c[stk[0]] <= a[i] * (b[stk[0]] -</line-7>
<line-8> b[stk[1]]):</line-8>
<line-9>... | {"code": "<line-2>a = list(map(int, input().split()))</line-2>\n<line-14> stk.append(i)</line-14>", "lines": [2, 14]}
#### 0 |
<line-1>n = int(input())</line-1>
<line-3>dp = [[0 for i in range(n + 1)] for j in range(n + 1)]</line-3>
<line-4>for i in range(n):</line-4>
<line-5> dp[0][i] = a[i]</line-5>
<line-6>for i in range(1, n):</line-6>
<line-7> for j in range(n - i + 1):</line-7>
<line-8> dp[i][j] = dp[i - 1][j] ^ dp[i - 1][j ... | {"code": "<line-2>*a, = map(int, input().split())</line-2>\n<line-13> l, r = map(int, input().split())</line-13>", "lines": [2, 13]}
#### 0 |
<line-1>import sys</line-1>
<line-3></line-3>
<line-4>T = int(input())</line-4>
<line-5>for _ in range(T):</line-5>
<line-6> n = int(input())</line-6>
<line-7> l = list(map(int, input().split()))</line-7>
<line-8> </line-8>
<line-9> stack = []</line-9>
<line-10> out = [-1] * n</line-10>
<line-11> curr... | {"code": "<line-2>input = sys.stdin.readline</line-2>\n<line-36> else:</line-36>", "lines": [2, 36]}
#### 0 |
<line-1>import sys</line-1>
<line-3>T = int(input())</line-3>
<line-4>for _ in range(T):</line-4>
<line-5> N = int(input())</line-5>
<line-6> A = [int(a) for a in input().split()]</line-6>
<line-7> X = [0] * 30</line-7>
<line-8> for a in A:</line-8>
<line-9> for i in range(30):</line-9>
<line-10> ... | {"code": "<line-2>input = lambda: sys.stdin.readline().rstrip()</line-2>\n<line-23> else:</line-23>", "lines": [2, 23]}
#### 0 |
<line-1>import sys</line-1>
<line-3></line-3>
<line-4></line-4>
<line-5>t = int(input())</line-5>
<line-6>for _ in range(t):</line-6>
<line-7> n = int(input())</line-7>
<line-8> a = list(map(int, input().split()))</line-8>
<line-9> </line-9>
<line-10> ans = 0</line-10>
<line-11> for i in range(n - 1):</l... | {"code": "<line-2>input = sys.stdin.readline</line-2>\n<line-17> a[i + 1] = a[i]</line-17>", "lines": [2, 17]}
#### 0 |
<line-1>n, k = list(map(int, input().split()))</line-1>
<line-3>for e in [int(i) for i in input().split()]:</line-3>
<line-4> d = m - c * (n - c - 1) * e</line-4>
<line-5> r+= 1</line-5>
<line-6> if d < k:</line-6>
<line-7> n -= 1</line-7>
<line-8> l += [r]</line-8>
<line-9> else:</line-9>
<li... | {"code": "<line-2>c, m, l, r = 0, 0, [], 0</line-2>\n<line-12>l.sort()</line-12>", "lines": [2, 12]}
#### 0 |
<line-1>import sys</line-1>
<line-3></line-3>
<line-4>T = int(readline())</line-4>
<line-5>MOD = 998244353</line-5>
<line-6>Ans = [None]*T</line-6>
<line-7>for qu in range(T):</line-7>
<line-8> N, K = map(int, readline().split())</line-8>
<line-9> A = [0] + list(map(int, readline().split())) + [0]</line-9>
<line... | {"code": "<line-2>readline = sys.stdin.readline</line-2>\n<line-24> Ans[qu] = ans</line-24>", "lines": [2, 24]}
#### 0 |
<line-1>"""</line-1>
<line-3> Date : </line-3>
<line-4> Algo : </line-4>
<line-5> Difficulty : </line-5>
<line-6>"""</line-6>
<line-7>from sys import stdin, stdout, setrecursionlimit</line-7>
<line-8>import threading</line-8>
<line-9></line-9>
<line-10></line-10>
<line-11>def main():</line-11>
<... | {"code": "<line-2> Author : Arif Ahmad</line-2>\n<line-41> thread.start()</line-41>", "lines": [2, 41]}
#### 0 |
<line-1>from cmath import rect</line-1>
<line-3>import math</line-3>
<line-4>from functools import reduce</line-4>
<line-5></line-5>
<line-6>class SegmentTree():</line-6>
<line-7> def __init__(self, L, function = lambda x,y: x+y):</line-7>
<line-8> self.function = function</line-8>
<line-9> N = self.si... | {"code": "<line-2>import sys</line-2>\n<line-62> print(query.real, query.imag)</line-62>", "lines": [2, 62]}
#### 0 |
<line-1>import sys</line-1>
<line-3></line-3>
<line-4>n = int(input())</line-4>
<line-5></line-5>
<line-6>x = [0]*n</line-6>
<line-7>y = [0]*n</line-7>
<line-8></line-8>
<line-9>for i in range(n):</line-9>
<line-10> x[i], y[i] = list(map(int, input().split()))</line-10>
<line-11></line-11>
<line-12>sx = sum(x)</line... | {"code": "<line-2>import math</line-2>\n<line-130> solve()</line-130>", "lines": [2, 130]}
#### 0 |
<line-1>def main():</line-1>
<line-3> from array import array</line-3>
<line-4> input = sys.stdin.readline</line-4>
<line-5></line-5>
<line-6> class Bit:</line-6>
<line-7> def __init__(self, n):</line-7>
<line-8> self.size = n</line-8>
<line-9> self.size_bit_length = n.bit_length()... | {"code": "<line-2> import sys</line-2>\n<line-83> main()</line-83>", "lines": [2, 83]}
#### 0 |
<line-1>#!/usr/bin/env python3</line-1>
<line-2></line-2>
<line-4>sys.setrecursionlimit(10 ** 6)</line-4>
<line-5></line-5>
<line-6>def main():</line-6>
<line-7> n = int(input())</line-7>
<line-8> adj_list = [[] for i in range(n)]</line-8>
<line-9> for i in range(n - 1):</line-9>
<line-10> a1, b1 = list... | {"code": "<line-3>import sys</line-3>\n<line-45> main()</line-45>", "lines": [3, 45]}
#### 0 |
<line-1>S = input()</line-1>
<line-3>n = 0</line-3>
<line-4>for c in S:</line-4>
<line-5> if c=='A': n+=1</line-5>
<line-6> SA.append(n)</line-6>
<line-7></line-7>
<line-8>T = input()</line-8>
<line-9>TA = [0]</line-9>
<line-10>n = 0</line-10>
<line-11>for c in T:</line-11>
<line-12> if c=='A': n+=1</line-12>
... | {"code": "<line-2>SA = [0]</line-2>\n<line-23> nTB = d-c+1-nTA</line-23>", "lines": [2, 23]}
#### 0 |
<line-1>from collections import defaultdict</line-1>
<line-2></line-2>
<line-4>a = [int(i) for i in input().split()]</line-4>
<line-5></line-5>
<line-6>b = defaultdict(lambda : [float('inf'), 0])</line-6>
<line-7>for i in range(N) :</line-7>
<line-8> b[a[i]][0] = min(b[a[i]][0], i)</line-8>
<line-9> b[a[i]][1] +=... | {"code": "<line-3>N = int(input())</line-3>\n<line-25>for r in ret :</line-25>", "lines": [3, 25]}
#### 0 |
<line-1>import sys</line-1>
<line-3></line-3>
<line-4>def main():</line-4>
<line-5> n, m = map(int, input().split())</line-5>
<line-6> LR = [list(map(int, input().split())) for _ in range(n)]</line-6>
<line-7> </line-7>
<line-8> BIT = [0]*(m+2)</line-8>
<line-9> def add(i, a):</line-9>
<line-10> while i <= m+1:... | {"code": "<line-2>input = sys.stdin.readline</line-2>\n<line-40> main()</line-40>", "lines": [2, 40]}
#### 0 |
<line-1>def fx(s,n,xsum):</line-1>
<line-3> for i in range(n+1):</line-3>
<line-4> sub[0][i]=True</line-4>
<line-5> for i in range(1,xsum+1):</line-5>
<line-6> sub[i][0]=False</line-6>
<line-7> for i in range(1,xsum+1):</line-7>
<line-8> for j in range(1,n+1):</line-8>
<line-9> sub[i][j]=sub[i][j-1]</line-9>
<line... | {"code": "<line-2>\tsub=[[None for x in range(n+2)]for y in range(xsum+2)]</line-2>\n<line-35>\t\t\tcontinue</line-35>", "lines": [2, 35]}
#### 0 |
<line-1>mod =(10**9)+7</line-1>
<line-3>a = [int(i) for i in input().split()]</line-3>
<line-4>b = [int(i) for i in input().split()]</line-4>
<line-5>dp = []</line-5>
<line-6>for i in range(n):</line-6>
<line-7> dp += [[0]*m]</line-7>
<line-8>dp[-1][-1]=1</line-8>
<line-9>for i in range(n-2,-1,-1):</line-9>
<line-10... | {"code": "<line-2>n,m = list(map(int,input().split()))</line-2>\n<line-20> ans += dp[i][0]</line-20>", "lines": [2, 20]}
#### 0 |
<line-1>s = input()</line-1>
<line-2></line-2>
<line-4> print((-1))</line-4>
<line-5>elif s[:-1] != s[-2::-1]:</line-5>
<line-6> print((-1))</line-6>
<line-7>else:</line-7>
<line-8> half = len(s) // 2</line-8>
<line-9> one_indices = [i+1 for i in range(1, half) if s[i] == '1'] # not including 0 or larger th... | {"code": "<line-3>if s[0] == '0' or s[-2] == '0' or s[-1] == '1': # 's' should be like \"1xx...x0\"</line-3>\n<line-25> continue</line-25>", "lines": [3, 25]}
#### 0 |
<line-1>from sys import stdin</line-1>
<line-3>input = stdin.readline</line-3>
<line-4>def getint(): return int(input())</line-4>
<line-5>def getints(): return list(map(int, input().split()))</line-5>
<line-6>def getint1(): return list([int(x) - 1 for x in input().split()])</line-6>
<line-7>def getstr(): return input()... | {"code": "<line-2>import itertools</line-2>\n<line-152> solve()</line-152>", "lines": [2, 152]}
#### 0 |
<line-1>import sys</line-1>
<line-3></line-3>
<line-4>from collections import deque</line-4>
<line-5></line-5>
<line-6>t=int(input())</line-6>
<line-7>for testcaess in range(t):</line-7>
<line-8> n,m,a,b=list(map(int,input().split()))</line-8>
<line-9> E=[[] for i in range(n+1)]</line-9>
<line-10></line-10>
<line... | {"code": "<line-2>input = sys.stdin.readline</line-2>\n<line-61> ANS2+=1</line-61>", "lines": [2, 61]}
#### 0 |
<line-1>import sys</line-1>
<line-3>out = []</line-3>
<line-4></line-4>
<line-5>t = int(input())</line-5>
<line-6>for _ in range(t):</line-6>
<line-7> n = int(input())</line-7>
<line-8> n -= 1</line-8>
<line-9> rem = n % 3</line-9>
<line-10> n //= 3</line-10>
<line-11> </line-11>
<line-12> s = []</lin... | {"code": "<line-2>input = sys.stdin.readline</line-2>\n<line-24> out.append(int(''.join(s),2))</line-24>", "lines": [2, 24]}
#### 0 |
<line-1>import sys</line-1>
<line-3></line-3>
<line-4>T = int(readline())</line-4>
<line-5>Ans = [None]*T</line-5>
<line-6>for qu in range(T):</line-6>
<line-7> S = [1 if s == 'A' else 0 for s in readline().strip()]</line-7>
<line-8> stack = []</line-8>
<line-9> for s in S:</line-9>
<line-10> if s:</lin... | {"code": "<line-2>readline = sys.stdin.readline</line-2>\n<line-26> Ans[qu] = len(stack2)</line-26>", "lines": [2, 26]}
#### 0 |
<line-1>import sys</line-1>
<line-3>t = int(input())</line-3>
<line-4>out = []</line-4>
<line-5>for _ in range(t):</line-5>
<line-6> n = int(input())</line-6>
<line-7> l = list(map(int,input().split()))</line-7>
<line-8></line-8>
<line-9> smol = l[0]</line-9>
<line-10> works = True</line-10>
<line-11> fo... | {"code": "<line-2>input= sys.stdin.readline</line-2>\n<line-23> out.append('No')</line-23>", "lines": [2, 23]}
#### 0 |
<line-1>n = int(input())</line-1>
<line-3>parity = 0</line-3>
<line-4>explore = set(l)</line-4>
<line-5>while len(explore) > 0:</line-5>
<line-6> x = explore.pop()</line-6>
<line-7> tmp = x</line-7>
<line-8> found = [x]</line-8>
<line-9> while l[tmp] != x:</line-9>
<line-10> tmp = l[tmp]</line-10>
<l... | {"code": "<line-2>l = [int(x) - 1 for x in input().split()]</line-2>\n<line-18>else:</line-18>", "lines": [2, 18]}
#### 0 |
<line-1>import sys</line-1>
<line-3>from collections import Counter</line-3>
<line-4></line-4>
<line-5>t=int(input())</line-5>
<line-6>for testcases in range(t):</line-6>
<line-7> n=int(input())</line-7>
<line-8> P=list(map(int,input().split()))</line-8>
<line-9> C=Counter(P)</line-9>
<line-10> PLIST=sorted... | {"code": "<line-2>input = sys.stdin.readline</line-2>\n<line-40> else:</line-40>", "lines": [2, 40]}
#### 0 |
<line-1>import sys</line-1>
<line-3>from collections import deque</line-3>
<line-4></line-4>
<line-5>t=int(input())</line-5>
<line-6>for tests in range(t):</line-6>
<line-7> n=int(input())</line-7>
<line-8></line-8>
<line-9> a=input().strip()</line-9>
<line-10> b=input().strip()</line-10>
<line-11></line-11>
<... | {"code": "<line-2>input = sys.stdin.readline</line-2>\n<line-31> ANS.append(n-i)</line-31>", "lines": [2, 31]}
#### 0 |
<line-1>import sys</line-1>
<line-3>from collections import deque</line-3>
<line-4></line-4>
<line-5>t=int(input())</line-5>
<line-6>for tests in range(t):</line-6>
<line-7> n=int(input())</line-7>
<line-8></line-8>
<line-9> a=input().strip()</line-9>
<line-10> b=input().strip()</line-10>
<line-11></line-11>
<... | {"code": "<line-2>input = sys.stdin.readline</line-2>\n<line-31> ANS.append(n-i)</line-31>", "lines": [2, 31]}
#### 0 |
<line-1>t = int(input())</line-1>
<line-2></line-2>
<line-4> n = int(input())</line-4>
<line-5> l = [int(x) for x in input().split()]</line-5>
<line-6> cur = l[0]</line-6>
<line-7> cll = 1</line-7>
<line-8> blocks = []</line-8>
<line-9> for x in l[1:]:</line-9>
<line-10> if x > cur:</line-10>
<... | {"code": "<line-3>for _ in range(t):</line-3>\n<line-29> # print(r)</line-29>", "lines": [3, 29]}
#### 0 |
<line-1>import sys</line-1>
<line-3></line-3>
<line-4>class Segtree:</line-4>
<line-5> def __init__(self, A, intv, initialize = True, segf = max):</line-5>
<line-6> self.N = len(A)</line-6>
<line-7> self.N0 = 2**(self.N-1).bit_length()</line-7>
<line-8> self.intv = intv</line-8>
<line-9> ... | {"code": "<line-2>readline = sys.stdin.readline</line-2>\n<line-94> Ans[qu] = ans</line-94>", "lines": [2, 94]}
#### 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> a = list(map(int,input().split()))</line-7>
<line-8> for i in range(n-1,0,-1):</line-8>
<line-9> a[i] -= a[i-1]</line-9>
<line-10></line-10>
<line-11... | {"code": "<line-3>input = sys.stdin.readline</line-3>\n<line-18> else:</line-18>", "lines": [3, 18]}
#### 0 |
<line-1>t = int(input())</line-1>
<line-3> d, m = list(map(int, input().split()))</line-3>
<line-4> d += 1</line-4>
<line-5> out = 1</line-5>
<line-6> curr = 2</line-6>
<line-7> while curr < d:</line-7>
<line-8> out *= (curr // 2) + 1</line-8>
<line-9> out %= m</line-9>
<line-10> cur... | {"code": "<line-2>for _ in range(t):</line-2>\n<line-11> out *= (d - curr // 2 + 1)</line-11>", "lines": [2, 11]}
#### 0 |
<line-1>import sys</line-1>
<line-3></line-3>
<line-4>T = int(input())</line-4>
<line-5>for _ in range(T):</line-5>
<line-6> N, M = list(map(int, input().split()))</line-6>
<line-7> X = [[] for i in range(3*N)]</line-7>
<line-8> for i in range(M):</line-8>
<line-9> x, y = list(map(int, input().split()))... | {"code": "<line-2>input = sys.stdin.readline</line-2>\n<line-31> print(\"IndSet\")</line-31>", "lines": [2, 31]}
#### 0 |
<line-1>mod = 998244353</line-1>
<line-3>f1 = [ [0 for i in range(11)] for j in range(2010) ]</line-3>
<line-4>fac = [0 for i in range(2010)]</line-4>
<line-5>tab = [0 for i in range(11)]</line-5>
<line-6>C = [ [0 for i in range(2010)] for j in range(2010) ]</line-6>
<line-7></line-7>
<line-8>def Init() :</line-8>
<lin... | {"code": "<line-2>f0 = [ [0 for i in range(11)] for j in range(2010) ]</line-2>\n<line-81>T = int(input())</line-81>", "lines": [2, 81]}
#### 0 |
<line-1></line-1>
<line-2>import sys</line-2>
<line-4>input=sys.stdin.readline</line-4>
<line-5>mii=lambda:list(map(int,input().split()))</line-5>
<line-6></line-6>
<line-7>for _ in range(int(input())):</line-7>
<line-8> n,d=mii()</line-8>
<line-9> a=list(mii())</line-9>
<line-10> ans=0</line-10>
<line-11> ... | {"code": "<line-3>#sys.stdin=open(\"data.txt\")</line-3>\n<line-15> d-=i</line-15>", "lines": [3, 15]}
#### 0 |
<line-1>import sys</line-1>
<line-3></line-3>
<line-4>t = int(input())</line-4>
<line-5>for _ in range(t):</line-5>
<line-6> n, k = list(map(int, input().split()))</line-6>
<line-7> s = input()</line-7>
<line-8> l = ['']*k</line-8>
<line-9> works = True</line-9>
<line-10> for i in range(n):</line-10>
<li... | {"code": "<line-2>input = sys.stdin.readline</line-2>\n<line-31> else:</line-31>", "lines": [2, 31]}
#### 0 |
<line-1>N = int(input())</line-1>
<line-3>L = int(input())</line-3>
<line-4></line-4>
<line-5>def one_step(i):</line-5>
<line-6> goal = X[i] + L</line-6>
<line-7> </line-7>
<line-8> # find largest j s.t. X[j] <= X[i] + L</line-8>
<line-9> low = 0</line-9>
<line-10> high = N</line-10>
<line-11> while high - low > ... | {"code": "<line-2>X = list(map(int, input().split()))</line-2>\n<line-47> b -= 1</line-47>", "lines": [2, 47]}
#### 0 |
<line-1>import sys</line-1>
<line-3></line-3>
<line-4>k = float(sys.stdin.readline())</line-4>
<line-5>answer = int(log(2.0, 2.0/k))</line-5>
<line-6>print(2*answer)</line-6>
<line-7></line-7>
<line-8>m = 2 ** (1.0/answer)</line-8>
<line-9># m = 2.0/k</line-9>
<line-10>thesum = 0</line-10>
<line-11>for i in range(answe... | {"code": "<line-2>from math import log</line-2>\n<line-51> loaves[i] -= x</line-51>", "lines": [2, 51]}
#### 0 |
<line-1></line-1>
<line-2>"""</line-2>
<line-4>#it takes about 2 hours.</line-4>
<line-5>class Graph:</line-5>
<line-6> def __init__(self,n):</line-6>
<line-7> self.edge=[[0 for j in xrange(n)] for i in xrange(n)]</line-7>
<line-8> self.n=n</line-8>
<line-9></line-9>
<line-10> def addedge(self,i,j,m=1):</line-1... | {"code": "<line-3>#this code is a precomputation part.</line-3>\n<line-286>#test()</line-286>", "lines": [3, 286]}
#### 0 |
<line-1>import decimal;</line-1>
<line-3></line-3>
<line-4>def solve(a, b, min1, min2, min3, min4, x, y):</line-4>
<line-5> if a > b:</line-5>
<line-6> return [];</line-6>
<line-7> solMin1 = (a/y+b)/(y-1/y);</line-7>
<line-8> solMin2 = (b/y+a)/(y-1/y);</line-8>
<line-9> solMin1 *= (x*y);</line-9>
<line-10> solMin2 *= ... | {"code": "<line-2>from decimal import *;</line-2>\n<line-227>\t\t#print str(solutionh)+\":%.2f\"%(solutionm);</line-227>", "lines": [2, 227]}
#### 0 |
<line-1>s=""</line-1>
<line-3>s=input()</line-3>
<line-4>k=0</line-4>
<line-5>r=0</line-5>
<line-6>c=0</line-6>
<line-7>if s[0]=='h':</line-7>
<line-8> L.append('http://')</line-8>
<line-9> c=4</line-9>
<line-10> s=s[c:]</line-10>
<line-11>elif s[0]=='f':</line-11>
<line-12> L.append('ftp://')</line-12>
<li... | {"code": "<line-2>L=[]</line-2>\n<line-23> L.append(s[k:])</line-23>", "lines": [2, 23]}
#### 0 |
<line-1>n, a = int(input()), [int(i) for i in input().split()]</line-1>
<line-3>b.sort()</line-3>
<line-4>for i in range(len(b) - 1):</line-4>
<line-5> m[b[i]] = b[i + 1]</line-5>
<line-6>m[b[-1]] = b[0]</line-6>
<line-7>for i in range(len(a)):</line-7>
<line-8> a[i] = m[a[i]]</line-8>
<line-9>if len(set(b)) == n... | {"code": "<line-2>b, m = a[:], dict()</line-2>\n<line-11>else:</line-11>", "lines": [2, 11]}
#### 0 |
<line-1>s = input()</line-1>
<line-3>a = [input() for i in range(n)]</line-3>
<line-4>for i in range(n):</line-4>
<line-5> for j in range(n):</line-5>
<line-6> if a[i] == s or a[i][1] + a[j][0] == s:</line-6>
<line-7> print("YES")</line-7>
<line-9>print("NO")</line-9> | {"code": "<line-2>n = int(input())</line-2>\n<line-8> return</line-8>", "lines": [2, 8]}
#### 0 |
<line-1></line-1>
<line-2>import numpy as np</line-2>
<line-4>A=np.array(list(map(int,input().split())))</line-4>
<line-5>mod = 998244353</line-5>
<line-6></line-6>
<line-7>fact = [1]*(K+1)</line-7>
<line-8>for i in range(1,K+1):</line-8>
<line-9> fact[i]=i*fact[i-1]%mod</line-9>
<line-10>inv_fact = [pow(f,mod-2,mod... | {"code": "<line-3>N,K = list(map(int,input().split()))</line-3>\n<line-24> ans-= r[x]*pow(2,x,mod) %mod</line-24>", "lines": [3, 24]}
#### 0 |
<line-1>n,k=map(int,input().split())</line-1>
<line-3>dp=[0]*(n+1)</line-3>
<line-4>dp[0]=1</line-4>
<line-5>for i in range(1,n+1):</line-5>
<line-6> for j in range(i,-1,-1):</line-6>
<line-7> dp[j]=dp[j-1]</line-7>
<line-8> if 2*j<=i:</line-8>
<line-9> dp[j]+=dp[2*j]</line-9>
<line-11>print(dp[k])</line-11... | {"code": "<line-2>mod=998244353</line-2>\n<line-10> dp[j]%=mod</line-10>", "lines": [2, 10]}
#### 0 |
<line-1>from functools import reduce</line-1>
<line-2></line-2>
<line-4> if n == 0:</line-4>
<line-5> return 1</line-5>
<line-6> tmp = modpow(a, n // 2, m)</line-6>
<line-7> if n % 2 == 0:</line-7>
<line-8> return tmp * tmp % m</line-8>
<line-9> else:</line-9>
<line-10> return tmp * tmp... | {"code": "<line-3>def modpow(a, n, m):</line-3>\n<line-19>product = lambda x1, x2: x1 * x2 % M</line-19>", "lines": [3, 19]}
#### 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.