user_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
1 value
submission_id_v0
stringlengths
10
10
submission_id_v1
stringlengths
10
10
cpu_time_v0
int64
10
38.3k
cpu_time_v1
int64
0
24.7k
memory_v0
int64
2.57k
1.02M
memory_v1
int64
2.57k
869k
status_v0
stringclasses
1 value
status_v1
stringclasses
1 value
improvement_frac
float64
7.51
100
input
stringlengths
20
4.55k
target
stringlengths
17
3.34k
code_v0_loc
int64
1
148
code_v1_loc
int64
1
184
code_v0_num_chars
int64
13
4.55k
code_v1_num_chars
int64
14
3.34k
code_v0_no_empty_lines
stringlengths
21
6.88k
code_v1_no_empty_lines
stringlengths
20
4.93k
code_same
bool
1 class
relative_loc_diff_percent
float64
0
79.8
diff
list
diff_only_import_comment
bool
1 class
measured_runtime_v0
float64
0.01
4.45
measured_runtime_v1
float64
0.01
4.31
runtime_lift
float64
0
359
key
list
u562935282
p02995
python
s131937924
s690803965
175
17
38,384
3,060
Accepted
Accepted
90.29
def gcd(x, y): if y == 0: return x return gcd(y, x % y) def lcm(x, y): return x // gcd(x, y) * y def cnt(u, x, y): return u - (u // x + u // y - u // lcm(x, y)) A, B, C, D = list(map(int, input().split())) ans = 0 # B以下 ans += cnt(B, C, D) # A-1以下 ans -= cnt(A - 1,...
def gcd(a, b): if b == 0: return a return gcd(b, a % b) def lcm(a, b): return a // gcd(a, b) * b def calc(x, a, b): return x - x // a - x // b + x // lcm(a, b) a, b, c, d = list(map(int, input().split())) print((calc(b, c, d) - calc(a - 1, c, d)))
25
15
335
276
def gcd(x, y): if y == 0: return x return gcd(y, x % y) def lcm(x, y): return x // gcd(x, y) * y def cnt(u, x, y): return u - (u // x + u // y - u // lcm(x, y)) A, B, C, D = list(map(int, input().split())) ans = 0 # B以下 ans += cnt(B, C, D) # A-1以下 ans -= cnt(A - 1, C, D) print(ans)
def gcd(a, b): if b == 0: return a return gcd(b, a % b) def lcm(a, b): return a // gcd(a, b) * b def calc(x, a, b): return x - x // a - x // b + x // lcm(a, b) a, b, c, d = list(map(int, input().split())) print((calc(b, c, d) - calc(a - 1, c, d)))
false
40
[ "-def gcd(x, y):", "- if y == 0:", "- return x", "- return gcd(y, x % y)", "+def gcd(a, b):", "+ if b == 0:", "+ return a", "+ return gcd(b, a % b)", "-def lcm(x, y):", "- return x // gcd(x, y) * y", "+def lcm(a, b):", "+ return a // gcd(a, b) * b", "-def cnt(...
false
0.125472
0.046177
2.71718
[ "s131937924", "s690803965" ]
u492447501
p03610
python
s510920191
s645498669
43
17
3,956
3,316
Accepted
Accepted
60.47
S = list(eval(input())) s = "" for i in range(len(S)): if i%2==0: s = s + S[i] print(s)
s = eval(input()) print((s[0::2]))
9
3
104
29
S = list(eval(input())) s = "" for i in range(len(S)): if i % 2 == 0: s = s + S[i] print(s)
s = eval(input()) print((s[0::2]))
false
66.666667
[ "-S = list(eval(input()))", "-s = \"\"", "-for i in range(len(S)):", "- if i % 2 == 0:", "- s = s + S[i]", "-print(s)", "+s = eval(input())", "+print((s[0::2]))" ]
false
0.039211
0.071611
0.547547
[ "s510920191", "s645498669" ]
u531579566
p03031
python
s191644920
s345777008
370
20
21,136
3,064
Accepted
Accepted
94.59
import numpy as np def add1(s, i = -1): if s[i] == 0: s[i] = 1 return s else: s[i] = 0 return add1(s, i-1) n, m = list(map(int, input().split())) k = [] s = [] for i in range(0, m): ki, *si = list(map(int, input().split())) k.append(ki) s.app...
n, m = list(map(int, input().split())) s = [0] * m for i in range(m): k, *li = list(map(int, input().split())) for j in range(k): s[i] += 2**(li[j]-1) p = list(map(int, input().split())) ans = 0 for i in range(2**n): tmp = True for j in range(m): if bin(i & s[j]).c...
43
25
694
422
import numpy as np def add1(s, i=-1): if s[i] == 0: s[i] = 1 return s else: s[i] = 0 return add1(s, i - 1) n, m = list(map(int, input().split())) k = [] s = [] for i in range(0, m): ki, *si = list(map(int, input().split())) k.append(ki) s.append(si) p = list(map(i...
n, m = list(map(int, input().split())) s = [0] * m for i in range(m): k, *li = list(map(int, input().split())) for j in range(k): s[i] += 2 ** (li[j] - 1) p = list(map(int, input().split())) ans = 0 for i in range(2**n): tmp = True for j in range(m): if bin(i & s[j]).count("1") % 2 != p[...
false
41.860465
[ "-import numpy as np", "-", "-", "-def add1(s, i=-1):", "- if s[i] == 0:", "- s[i] = 1", "- return s", "- else:", "- s[i] = 0", "- return add1(s, i - 1)", "-", "-", "-k = []", "-s = []", "-for i in range(0, m):", "- ki, *si = list(map(int, input().s...
false
0.482588
0.036666
13.161746
[ "s191644920", "s345777008" ]
u046187684
p03434
python
s514736817
s403841097
23
17
3,316
2,940
Accepted
Accepted
26.09
#!/usr/bin/env python3 # -*- coding: utf-8 -*- n = int(input().strip()) a = sorted(list(map(int, input().strip().split(" "))), reverse=True) print((sum(a[::2]) - sum(a[1::2])))
def solve(string): n, *a = list(map(int, string.split())) a = sorted(a, reverse=True) return str(sum(a[::2]) - sum(a[1::2])) if __name__ == '__main__': print((solve('\n'.join([eval(input()), eval(input())]))))
6
8
181
215
#!/usr/bin/env python3 # -*- coding: utf-8 -*- n = int(input().strip()) a = sorted(list(map(int, input().strip().split(" "))), reverse=True) print((sum(a[::2]) - sum(a[1::2])))
def solve(string): n, *a = list(map(int, string.split())) a = sorted(a, reverse=True) return str(sum(a[::2]) - sum(a[1::2])) if __name__ == "__main__": print((solve("\n".join([eval(input()), eval(input())]))))
false
25
[ "-#!/usr/bin/env python3", "-# -*- coding: utf-8 -*-", "-n = int(input().strip())", "-a = sorted(list(map(int, input().strip().split(\" \"))), reverse=True)", "-print((sum(a[::2]) - sum(a[1::2])))", "+def solve(string):", "+ n, *a = list(map(int, string.split()))", "+ a = sorted(a, reverse=True)...
false
0.074661
0.065283
1.143649
[ "s514736817", "s403841097" ]
u269623316
p03266
python
s028030927
s364267879
115
78
15,080
15,080
Accepted
Accepted
32.17
from math import * n,k=list(map(int,input().split())) dict1={} flag=0 ans=0 if(k%3==0): flag=1 for i in range(1,n+1): try: dict1[i%k]+=1 except: KeyError dict1[i%k]=1 dict2={} for i in list(dict1.keys()): try: if(dict2[i]==1): a=1 except:...
from math import * n,k=list(map(int,input().split())) dict1={} flag=0 ans=0 if(k%3==0): flag=1 for i in range(1,n+1): try: dict1[i%k]+=1 except: KeyError dict1[i%k]=1 for i in list(dict1.keys()): if((i+i)%k==0): ans+=dict1[i]*dict1[i]*dict1[i] print(ans)
25
18
458
308
from math import * n, k = list(map(int, input().split())) dict1 = {} flag = 0 ans = 0 if k % 3 == 0: flag = 1 for i in range(1, n + 1): try: dict1[i % k] += 1 except: KeyError dict1[i % k] = 1 dict2 = {} for i in list(dict1.keys()): try: if dict2[i] == 1: a =...
from math import * n, k = list(map(int, input().split())) dict1 = {} flag = 0 ans = 0 if k % 3 == 0: flag = 1 for i in range(1, n + 1): try: dict1[i % k] += 1 except: KeyError dict1[i % k] = 1 for i in list(dict1.keys()): if (i + i) % k == 0: ans += dict1[i] * dict1[i] *...
false
28
[ "-dict2 = {}", "- try:", "- if dict2[i] == 1:", "- a = 1", "- except:", "- KeyError", "- if (i + i) % k == 0:", "- ans += dict1[i] * dict1[i] * dict1[i]", "- dict2[i] = 1", "- dict2[k - i] = 1", "+ if (i + i) % k == 0:", ...
false
0.037593
0.047645
0.789013
[ "s028030927", "s364267879" ]
u332385682
p03779
python
s163099622
s343913075
28
24
3,060
2,940
Accepted
Accepted
14.29
import sys def solve(): x = int(input()) t = 1 while calc_sum(t) < x: t += 1 print(t) def calc_sum(t): return t * (t + 1) // 2 def debug(x, table): for name, val in table.items(): if x is val: print('DEBUG:{} -> {}'.format(name, val), file=sys....
import sys def solve(): x = int(eval(input())) k = 0 while k * (k + 1) // 2 < x: k += 1 print(k) if __name__ == '__main__': solve()
23
14
395
175
import sys def solve(): x = int(input()) t = 1 while calc_sum(t) < x: t += 1 print(t) def calc_sum(t): return t * (t + 1) // 2 def debug(x, table): for name, val in table.items(): if x is val: print("DEBUG:{} -> {}".format(name, val), file=sys.stderr) ...
import sys def solve(): x = int(eval(input())) k = 0 while k * (k + 1) // 2 < x: k += 1 print(k) if __name__ == "__main__": solve()
false
39.130435
[ "- x = int(input())", "- t = 1", "- while calc_sum(t) < x:", "- t += 1", "- print(t)", "-", "-", "-def calc_sum(t):", "- return t * (t + 1) // 2", "-", "-", "-def debug(x, table):", "- for name, val in table.items():", "- if x is val:", "- print...
false
0.032617
0.039142
0.833317
[ "s163099622", "s343913075" ]
u426764965
p02623
python
s760784425
s382316689
482
332
47,372
47,224
Accepted
Accepted
31.12
n, m, k = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) cuma = [0] cumb = [0] for a in A: cuma.append(cuma[-1] + a) for b in B: cumb.append(cumb[-1] + b) from bisect import bisect_left ans = 0 for i in range(n+1): if k < cuma[i]: continu...
n, m, k = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) cuma = [0] cumb = [0] for a in A: cuma.append(cuma[-1] + a) for b in B: cumb.append(cumb[-1] + b) from bisect import bisect_left ans = 0 for i in range(n+1): if k < cuma[i]: break ...
20
16
537
403
n, m, k = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) cuma = [0] cumb = [0] for a in A: cuma.append(cuma[-1] + a) for b in B: cumb.append(cumb[-1] + b) from bisect import bisect_left ans = 0 for i in range(n + 1): if k < cuma[i]: continue ...
n, m, k = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) cuma = [0] cumb = [0] for a in A: cuma.append(cuma[-1] + a) for b in B: cumb.append(cumb[-1] + b) from bisect import bisect_left ans = 0 for i in range(n + 1): if k < cuma[i]: break ...
false
20
[ "- continue", "+ break", "-for j in range(m + 1):", "- if k < cumb[j]:", "- continue", "- idx = bisect_left(cuma, k - cumb[j] + 1)", "- ans = max(ans, j + idx - 1)" ]
false
0.038902
0.039053
0.996121
[ "s760784425", "s382316689" ]
u629246993
p03078
python
s720166687
s367828647
1,797
121
185,656
9,536
Accepted
Accepted
93.27
x,y,z,k = list(map(int, input().split())) a = sorted(list(map(int, input().split())),reverse=True) b = sorted(list(map(int, input().split())),reverse=True) c = sorted(list(map(int, input().split())),reverse=True) sumAB = sorted([ai + bi for ai in a for bi in b],reverse=True)[:k] sumABC = sorted([ci + abi for ci ...
x,y,z,k = list(map(int, input().split())) a = sorted(list(map(int, input().split())),reverse=True) b = sorted(list(map(int, input().split())),reverse=True) c = sorted(list(map(int, input().split())),reverse=True) ans = [] for i in range (len(a)): for j in range (len(b)): if (i+1)*(j+1)>k: break ...
10
15
400
508
x, y, z, k = list(map(int, input().split())) a = sorted(list(map(int, input().split())), reverse=True) b = sorted(list(map(int, input().split())), reverse=True) c = sorted(list(map(int, input().split())), reverse=True) sumAB = sorted([ai + bi for ai in a for bi in b], reverse=True)[:k] sumABC = sorted([ci + abi for ci ...
x, y, z, k = list(map(int, input().split())) a = sorted(list(map(int, input().split())), reverse=True) b = sorted(list(map(int, input().split())), reverse=True) c = sorted(list(map(int, input().split())), reverse=True) ans = [] for i in range(len(a)): for j in range(len(b)): if (i + 1) * (j + 1) > k: ...
false
33.333333
[ "-sumAB = sorted([ai + bi for ai in a for bi in b], reverse=True)[:k]", "-sumABC = sorted([ci + abi for ci in c for abi in sumAB], reverse=True)[:k]", "+ans = []", "+for i in range(len(a)):", "+ for j in range(len(b)):", "+ if (i + 1) * (j + 1) > k:", "+ break", "+ for u in...
false
0.11041
0.03706
2.979197
[ "s720166687", "s367828647" ]
u497596438
p03837
python
s150411456
s007759497
917
729
3,824
59,100
Accepted
Accepted
20.5
import heapq N,M=list(map(int,input().split())) R=[] G=[[] for i in range(N)] for i in range(M): a,b,c=list(map(int,input().split())) a,b=a-1,b-1 G[a].append((b,c)) G[b].append((a,c)) R.append((a,b,c)) Q=[[0]*N for i in range(N)] INF=10**9 for i in range(N): stack=[] g=[INF for...
import heapq N,M=list(map(int,input().split())) R=[] G=[[] for i in range(N)] for i in range(M): a,b,c=list(map(int,input().split())) a,b=a-1,b-1 G[a].append((b,c)) G[b].append((a,c)) R.append((a,b,c)) Q=[[0]*N for i in range(N)] INF=10**9 for i in range(N): stack=[] g=[INF for...
40
43
911
975
import heapq N, M = list(map(int, input().split())) R = [] G = [[] for i in range(N)] for i in range(M): a, b, c = list(map(int, input().split())) a, b = a - 1, b - 1 G[a].append((b, c)) G[b].append((a, c)) R.append((a, b, c)) Q = [[0] * N for i in range(N)] INF = 10**9 for i in range(N): stack...
import heapq N, M = list(map(int, input().split())) R = [] G = [[] for i in range(N)] for i in range(M): a, b, c = list(map(int, input().split())) a, b = a - 1, b - 1 G[a].append((b, c)) G[b].append((a, c)) R.append((a, b, c)) Q = [[0] * N for i in range(N)] INF = 10**9 for i in range(N): stack...
false
6.976744
[ "+ if g[j[0]] <= g[b] + j[1]:", "+ continue" ]
false
0.039077
0.039382
0.992259
[ "s150411456", "s007759497" ]
u150984829
p02277
python
s041872233
s344263185
1,400
1,220
20,200
20,172
Accepted
Accepted
12.86
def t(A,p,r): x=A[r][1];i=p-1 for j in range(p,r): if A[j][1]<=x:i+=1;A[i],A[j]=A[j],A[i] A[i+1],A[r]=A[r],A[i+1] return i+1 def k(A,p,r): if p<r:q=t(A,p,r);k(A,p,q-1);k(A,q+1,r) def m(L,R): T=[] for l in L[::-1]: while R and R[-1][1]>=l[1]:T+=[R.pop()] T+=[l] return R+T[::-1] def d(A):l=len...
import sys def t(A,p,r): x=A[r][1];i=p-1 for j in range(p,r): if A[j][1]<=x:i+=1;A[i],A[j]=A[j],A[i] A[i+1],A[r]=A[r],A[i+1] return i+1 def k(A,p,r): if p<r:q=t(A,p,r);k(A,p,q-1);k(A,q+1,r) def m(L,R): T=[] for l in L[::-1]: while R and R[-1][1]>=l[1]:T+=[R.pop()] T+=[l] return R+T[::-1] de...
22
23
532
543
def t(A, p, r): x = A[r][1] i = p - 1 for j in range(p, r): if A[j][1] <= x: i += 1 A[i], A[j] = A[j], A[i] A[i + 1], A[r] = A[r], A[i + 1] return i + 1 def k(A, p, r): if p < r: q = t(A, p, r) k(A, p, q - 1) k(A, q + 1, r) def m(L, R):...
import sys def t(A, p, r): x = A[r][1] i = p - 1 for j in range(p, r): if A[j][1] <= x: i += 1 A[i], A[j] = A[j], A[i] A[i + 1], A[r] = A[r], A[i + 1] return i + 1 def k(A, p, r): if p < r: q = t(A, p, r) k(A, p, q - 1) k(A, q + 1, r) ...
false
4.347826
[ "+import sys", "+", "+", "-A = [f(*input().split()) for _ in [0] * n]", "+A = [f(*e.split()) for e in sys.stdin]" ]
false
0.044844
0.045128
0.993712
[ "s041872233", "s344263185" ]
u360116509
p02837
python
s022938975
s279914356
834
264
3,064
3,064
Accepted
Accepted
68.35
N = int(eval(input())) t = [] for _ in range(N): A = int(eval(input())) tt = [] for _ in range(A): tt.append(list(map(int, input().split()))) t.append(tt) ans = 0 for b in range(1 << N): f = True for i, tt in enumerate(t): for x, y in tt: if b & 1 << i: ...
N = int(eval(input())) t = [] for _ in range(N): A = int(eval(input())) tt = [] for _ in range(A): tt.append(list(map(int, input().split()))) t.append(tt) ans = 0 for b in range(1 << N): f = True c = 0 for i, tt in enumerate(t): if b >> i & 1: c += 1...
21
23
489
491
N = int(eval(input())) t = [] for _ in range(N): A = int(eval(input())) tt = [] for _ in range(A): tt.append(list(map(int, input().split()))) t.append(tt) ans = 0 for b in range(1 << N): f = True for i, tt in enumerate(t): for x, y in tt: if b & 1 << i: ...
N = int(eval(input())) t = [] for _ in range(N): A = int(eval(input())) tt = [] for _ in range(A): tt.append(list(map(int, input().split()))) t.append(tt) ans = 0 for b in range(1 << N): f = True c = 0 for i, tt in enumerate(t): if b >> i & 1: c += 1 f...
false
8.695652
[ "+ c = 0", "- for x, y in tt:", "- if b & 1 << i:", "- if (b & 1 << (x - 1)) >> (x - 1) != y:", "+ if b >> i & 1:", "+ c += 1", "+ for x, y in tt:", "+ if b >> (x - 1) & 1 != y:", "- ans = max(ans, bin(b).count(\"...
false
0.037462
0.107811
0.347479
[ "s022938975", "s279914356" ]
u623814058
p02910
python
s540882031
s397413187
39
26
9,868
8,792
Accepted
Accepted
33.33
import re S=eval(input()) print(("NYoe s"[len(re.sub("[RUD]",'',S[0::2]))==0==len(re.sub("[LUD]",'',S[1::2]))::2]))
S=eval(input()) print(("YNeos"["L" in S[0::2] or "R" in S[1::2]::2]))
3
2
109
62
import re S = eval(input()) print( ( "NYoe s"[ len(re.sub("[RUD]", "", S[0::2])) == 0 == len(re.sub("[LUD]", "", S[1::2])) :: 2 ] ) )
S = eval(input()) print(("YNeos"["L" in S[0::2] or "R" in S[1::2] :: 2]))
false
33.333333
[ "-import re", "-", "-print(", "- (", "- \"NYoe s\"[", "- len(re.sub(\"[RUD]\", \"\", S[0::2]))", "- == 0", "- == len(re.sub(\"[LUD]\", \"\", S[1::2])) :: 2", "- ]", "- )", "-)", "+print((\"YNeos\"[\"L\" in S[0::2] or \"R\" in S[1::2] :: 2]))...
false
0.072233
0.062565
1.154541
[ "s540882031", "s397413187" ]
u150984829
p02265
python
s521799381
s678201412
840
770
69,732
69,736
Accepted
Accepted
8.33
import collections,sys def s(): d=collections.deque() eval(input()) for e in sys.stdin: if'i'==e[0]:d.appendleft(e[7:-1]) else: if' '==e[6]: m=e[7:-1] if m in d:d.remove(m) elif len(e)&1:d.pop() else:d.popleft() print((*d)) if'__main__'==__name__:s()
import collections,sys def s(): d=collections.deque() eval(input()) for e in sys.stdin: if'i'==e[0]:d.appendleft(e[7:-1]) else: if' '==e[6]: m=e[7:-1] if m in d:d.remove(m) elif'i'==e[7]:d.popleft() else:d.pop() print((*d)) if'__main__'==__name__:s()
14
14
281
281
import collections, sys def s(): d = collections.deque() eval(input()) for e in sys.stdin: if "i" == e[0]: d.appendleft(e[7:-1]) else: if " " == e[6]: m = e[7:-1] if m in d: d.remove(m) elif len(e) & 1:...
import collections, sys def s(): d = collections.deque() eval(input()) for e in sys.stdin: if "i" == e[0]: d.appendleft(e[7:-1]) else: if " " == e[6]: m = e[7:-1] if m in d: d.remove(m) elif "i" == e[7]...
false
0
[ "- elif len(e) & 1:", "+ elif \"i\" == e[7]:", "+ d.popleft()", "+ else:", "- else:", "- d.popleft()" ]
false
0.037035
0.042375
0.87399
[ "s521799381", "s678201412" ]
u026155812
p02768
python
s177265479
s905544056
159
144
3,572
9,588
Accepted
Accepted
9.43
from functools import reduce n, a, b = list(map(int, input().split())) mod = 10**9 + 7 def f(A): bunsi = reduce(lambda x, y: x*y%mod, list(range(n, n-A, -1))) bunbo = reduce(lambda x, y: x*y%mod, list(range(1, A+1))) return bunsi * pow(bunbo, mod-2, mod) % mod ans = pow(2, n, mod) - f(a) -f(b) - ...
from functools import reduce n, a, b = list(map(int, input().split())) mod = 10**9 + 7 def comb(N, A, MOD): num = reduce(lambda x, y: x * y % MOD, list(range(N, N - A, -1))) den = reduce(lambda x, y: x * y % MOD, list(range(1, A + 1))) return num * pow(den, MOD - 2, MOD) % MOD print(((pow(2, n, m...
12
10
327
350
from functools import reduce n, a, b = list(map(int, input().split())) mod = 10**9 + 7 def f(A): bunsi = reduce(lambda x, y: x * y % mod, list(range(n, n - A, -1))) bunbo = reduce(lambda x, y: x * y % mod, list(range(1, A + 1))) return bunsi * pow(bunbo, mod - 2, mod) % mod ans = pow(2, n, mod) - f(a) ...
from functools import reduce n, a, b = list(map(int, input().split())) mod = 10**9 + 7 def comb(N, A, MOD): num = reduce(lambda x, y: x * y % MOD, list(range(N, N - A, -1))) den = reduce(lambda x, y: x * y % MOD, list(range(1, A + 1))) return num * pow(den, MOD - 2, MOD) % MOD print(((pow(2, n, mod) - ...
false
16.666667
[ "-def f(A):", "- bunsi = reduce(lambda x, y: x * y % mod, list(range(n, n - A, -1)))", "- bunbo = reduce(lambda x, y: x * y % mod, list(range(1, A + 1)))", "- return bunsi * pow(bunbo, mod - 2, mod) % mod", "+def comb(N, A, MOD):", "+ num = reduce(lambda x, y: x * y % MOD, list(range(N, N - A,...
false
0.135627
0.136625
0.992696
[ "s177265479", "s905544056" ]
u911135089
p02909
python
s111226429
s855636508
19
17
2,940
2,940
Accepted
Accepted
10.53
st = [ "Sunny" , "Cloudy" , "Rainy" ] x = eval(input()) s = st.index(x) + 1 if s <= 2 : print((st[s])) else : print((st[0]))
x = eval(input()) st = [ 'Sunny' , 'Cloudy' , 'Rainy' ] print((st[(st.index(x) + 1) % 3]))
7
3
128
84
st = ["Sunny", "Cloudy", "Rainy"] x = eval(input()) s = st.index(x) + 1 if s <= 2: print((st[s])) else: print((st[0]))
x = eval(input()) st = ["Sunny", "Cloudy", "Rainy"] print((st[(st.index(x) + 1) % 3]))
false
57.142857
[ "+x = eval(input())", "-x = eval(input())", "-s = st.index(x) + 1", "-if s <= 2:", "- print((st[s]))", "-else:", "- print((st[0]))", "+print((st[(st.index(x) + 1) % 3]))" ]
false
0.04944
0.077812
0.635376
[ "s111226429", "s855636508" ]
u368249389
p02659
python
s091119300
s868811891
24
19
9,168
9,160
Accepted
Accepted
20.83
# Problem C - Multiplication 3 import math # input A, B = input().split() A = int(A) # initialization b_1 = int(B[0]) b_2 = int(B[2]) b_3 = int(B[3]) tmp_1 = A * b_1 * 100 tmp_2 = A * b_2 * 10 tmp_3 = A * b_3 ans = math.floor((tmp_1 + tmp_2 + tmp_3) // 100) # output print(ans)
# Problem C - Multiplication 3 import math # input A, B = input().split() A = int(A) B = int(float(B) * 1000) # initialization ans = (A * B)//1000 # output print(ans)
19
14
300
184
# Problem C - Multiplication 3 import math # input A, B = input().split() A = int(A) # initialization b_1 = int(B[0]) b_2 = int(B[2]) b_3 = int(B[3]) tmp_1 = A * b_1 * 100 tmp_2 = A * b_2 * 10 tmp_3 = A * b_3 ans = math.floor((tmp_1 + tmp_2 + tmp_3) // 100) # output print(ans)
# Problem C - Multiplication 3 import math # input A, B = input().split() A = int(A) B = int(float(B) * 1000) # initialization ans = (A * B) // 1000 # output print(ans)
false
26.315789
[ "+B = int(float(B) * 1000)", "-b_1 = int(B[0])", "-b_2 = int(B[2])", "-b_3 = int(B[3])", "-tmp_1 = A * b_1 * 100", "-tmp_2 = A * b_2 * 10", "-tmp_3 = A * b_3", "-ans = math.floor((tmp_1 + tmp_2 + tmp_3) // 100)", "+ans = (A * B) // 1000" ]
false
0.082049
0.036923
2.222176
[ "s091119300", "s868811891" ]
u729133443
p02847
python
s569684052
s311041002
165
17
38,256
2,940
Accepted
Accepted
89.7
print((' SAFRTHWETUMOSU'.find(input()[:2])//2))
print((sum(map(ord,eval(input())+'\n'))**698%6329%8))
1
1
46
45
print((" SAFRTHWETUMOSU".find(input()[:2]) // 2))
print((sum(map(ord, eval(input()) + "\n")) ** 698 % 6329 % 8))
false
0
[ "-print((\" SAFRTHWETUMOSU\".find(input()[:2]) // 2))", "+print((sum(map(ord, eval(input()) + \"\\n\")) ** 698 % 6329 % 8))" ]
false
0.122719
0.120432
1.018994
[ "s569684052", "s311041002" ]
u852690916
p03436
python
s100302611
s590186336
177
92
39,536
3,952
Accepted
Accepted
48.02
from collections import deque H,W=list(map(int,input().split())) white=0 s=[] for y in range(H): line=eval(input()) white+=line.count('.') s.append(list(line)) q = deque([(0,0,1)]) q_append=q.append q_popleft=q.popleft while q: x,y,l=q_popleft() if s[y][x]!='.': continue ...
from queue import Queue H,W=list(map(int,input().split())) s=[list(eval(input())) for _ in range(H)] white=sum([1 if s[y][x]=='.' else 0 for x in range(W) for y in range(H)]) used=[[False for x in range(W)] for y in range(H)] q=Queue() q.put((0,0,1)) while True: if q.empty(): print((-1)) ...
27
26
558
659
from collections import deque H, W = list(map(int, input().split())) white = 0 s = [] for y in range(H): line = eval(input()) white += line.count(".") s.append(list(line)) q = deque([(0, 0, 1)]) q_append = q.append q_popleft = q.popleft while q: x, y, l = q_popleft() if s[y][x] != ".": cont...
from queue import Queue H, W = list(map(int, input().split())) s = [list(eval(input())) for _ in range(H)] white = sum([1 if s[y][x] == "." else 0 for x in range(W) for y in range(H)]) used = [[False for x in range(W)] for y in range(H)] q = Queue() q.put((0, 0, 1)) while True: if q.empty(): print((-1)) ...
false
3.703704
[ "-from collections import deque", "+from queue import Queue", "-white = 0", "-s = []", "-for y in range(H):", "- line = eval(input())", "- white += line.count(\".\")", "- s.append(list(line))", "-q = deque([(0, 0, 1)])", "-q_append = q.append", "-q_popleft = q.popleft", "-while q:", ...
false
0.072418
0.051494
1.406337
[ "s100302611", "s590186336" ]
u921178362
p02971
python
s465223648
s304506254
902
402
70,360
60,368
Accepted
Accepted
55.43
N = int(eval(input())) A = [] for i in range(N): A.append(int(eval(input()))) B = sorted(A, reverse = True) for i in range(N): if A[i] == B[0]: print((B[1])) else: print((B[0]))
import sys input = sys.stdin.readline N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] B = sorted(A, reverse = True) for i in range(N): if A[i] == B[0]: print((B[1])) else: print((B[0]))
11
11
201
223
N = int(eval(input())) A = [] for i in range(N): A.append(int(eval(input()))) B = sorted(A, reverse=True) for i in range(N): if A[i] == B[0]: print((B[1])) else: print((B[0]))
import sys input = sys.stdin.readline N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] B = sorted(A, reverse=True) for i in range(N): if A[i] == B[0]: print((B[1])) else: print((B[0]))
false
0
[ "+import sys", "+", "+input = sys.stdin.readline", "-A = []", "-for i in range(N):", "- A.append(int(eval(input())))", "+A = [int(eval(input())) for _ in range(N)]" ]
false
0.043232
0.038353
1.127222
[ "s465223648", "s304506254" ]
u814986259
p03341
python
s148917978
s684434020
371
310
29,260
17,484
Accepted
Accepted
16.44
N = int(eval(input())) S = list(eval(input())) s = [0]*(N+1) e = [0]*(N+1) for i in range(1, N+1): k = 0 if S[i-1] == "W": k = 1 s[i] = s[i-1] + k for i in reversed(list(range(0, N))): k = 0 if S[i] == "E": k = 1 e[i] = e[i+1] + k ans = N for i in range(1, N+...
N = int(eval(input())) S = list(eval(input())) s = [0]*(N+1) for i in range(1, N+1): k = 0 if S[i-1] == "W": k = 1 s[i] = s[i-1] + k ans = N for i in range(1, N+1): k = (N - i) - (s[N] - s[i]) ans = min(ans, k + s[i-1]) print(ans)
23
18
355
269
N = int(eval(input())) S = list(eval(input())) s = [0] * (N + 1) e = [0] * (N + 1) for i in range(1, N + 1): k = 0 if S[i - 1] == "W": k = 1 s[i] = s[i - 1] + k for i in reversed(list(range(0, N))): k = 0 if S[i] == "E": k = 1 e[i] = e[i + 1] + k ans = N for i in range(1, N + 1):...
N = int(eval(input())) S = list(eval(input())) s = [0] * (N + 1) for i in range(1, N + 1): k = 0 if S[i - 1] == "W": k = 1 s[i] = s[i - 1] + k ans = N for i in range(1, N + 1): k = (N - i) - (s[N] - s[i]) ans = min(ans, k + s[i - 1]) print(ans)
false
21.73913
[ "-e = [0] * (N + 1)", "-for i in reversed(list(range(0, N))):", "- k = 0", "- if S[i] == \"E\":", "- k = 1", "- e[i] = e[i + 1] + k", "- ans = min(ans, s[i - 1] + e[i])", "+ k = (N - i) - (s[N] - s[i])", "+ ans = min(ans, k + s[i - 1])" ]
false
0.038236
0.045777
0.835268
[ "s148917978", "s684434020" ]
u098012509
p03353
python
s445333485
s906895910
1,747
35
3,956
4,592
Accepted
Accepted
98
import sys input = sys.stdin.readline def main(): S = input().strip() K = int(eval(input())) dic = [] for i in range(len(S)): j = 0 tmp = "" while i + j < len(S) and j < 5: tmp += S[i + j] if tmp not in dic: dic.append(t...
import sys input = sys.stdin.readline def main(): S = input().strip() K = int(eval(input())) dic = [] dic_set = set() for i in range(len(S)): j = 0 tmp = "" while i + j < len(S) and j < 5: tmp += S[i + j] if tmp not in dic_set: ...
31
27
447
482
import sys input = sys.stdin.readline def main(): S = input().strip() K = int(eval(input())) dic = [] for i in range(len(S)): j = 0 tmp = "" while i + j < len(S) and j < 5: tmp += S[i + j] if tmp not in dic: dic.append(tmp) j...
import sys input = sys.stdin.readline def main(): S = input().strip() K = int(eval(input())) dic = [] dic_set = set() for i in range(len(S)): j = 0 tmp = "" while i + j < len(S) and j < 5: tmp += S[i + j] if tmp not in dic_set: dic.a...
false
12.903226
[ "+ dic_set = set()", "- if tmp not in dic:", "+ if tmp not in dic_set:", "+ dic_set.add(tmp)" ]
false
0.075035
0.042096
1.78245
[ "s445333485", "s906895910" ]
u222668979
p02675
python
s445689817
s286219196
23
20
9,116
9,156
Accepted
Accepted
13.04
n = int(input()[-1]) if n == 2 or n == 4 or n == 5 or n == 7 or n == 9: print('hon') elif n == 0 or n==1 or n==6 or n==8: print('pon') else: print('bon')
n = int(input()[-1]) if n == 3: print('bon') elif n in set([0, 1, 6, 8]): print('pon') else: print('hon')
7
7
174
124
n = int(input()[-1]) if n == 2 or n == 4 or n == 5 or n == 7 or n == 9: print("hon") elif n == 0 or n == 1 or n == 6 or n == 8: print("pon") else: print("bon")
n = int(input()[-1]) if n == 3: print("bon") elif n in set([0, 1, 6, 8]): print("pon") else: print("hon")
false
0
[ "-if n == 2 or n == 4 or n == 5 or n == 7 or n == 9:", "- print(\"hon\")", "-elif n == 0 or n == 1 or n == 6 or n == 8:", "+if n == 3:", "+ print(\"bon\")", "+elif n in set([0, 1, 6, 8]):", "- print(\"bon\")", "+ print(\"hon\")" ]
false
0.038951
0.046839
0.831602
[ "s445689817", "s286219196" ]
u094191970
p02642
python
s845870075
s106701288
1,008
297
47,508
47,568
Accepted
Accepted
70.54
from sys import stdin nii=lambda:list(map(int,stdin.readline().split())) lnii=lambda:list(map(int,stdin.readline().split())) from collections import Counter n=int(eval(input())) l=lnii() def eratosthenes(lim): num=[1 for i in range(lim)] for i in set(l): for j in range(i+i,lim,i): num[j]=0 ...
from sys import stdin nii=lambda:list(map(int,stdin.readline().split())) lnii=lambda:list(map(int,stdin.readline().split())) from collections import Counter n=int(eval(input())) l=lnii() def eratosthenes(lim): num=[1 for i in range(lim)] for i in set(l): if num[i]: for j in range(i+i,lim,i):...
26
27
459
479
from sys import stdin nii = lambda: list(map(int, stdin.readline().split())) lnii = lambda: list(map(int, stdin.readline().split())) from collections import Counter n = int(eval(input())) l = lnii() def eratosthenes(lim): num = [1 for i in range(lim)] for i in set(l): for j in range(i + i, lim, i): ...
from sys import stdin nii = lambda: list(map(int, stdin.readline().split())) lnii = lambda: list(map(int, stdin.readline().split())) from collections import Counter n = int(eval(input())) l = lnii() def eratosthenes(lim): num = [1 for i in range(lim)] for i in set(l): if num[i]: for j in...
false
3.703704
[ "- for j in range(i + i, lim, i):", "- num[j] = 0", "+ if num[i]:", "+ for j in range(i + i, lim, i):", "+ num[j] = 0" ]
false
0.210368
0.124764
1.686128
[ "s845870075", "s106701288" ]
u223133214
p03645
python
s607005287
s250964360
733
402
58,896
86,396
Accepted
Accepted
45.16
N, M = list(map(int, input().split())) AB = [list(map(int, input().split())) for _ in range(M)] s, e = set(), set() for ab in AB: a, b = ab if a == 1: s.add(b) elif b == N: e.add(a) if len(s & e) >= 1: print('POSSIBLE') else: print('IMPOSSIBLE')
import sys input = sys.stdin.readline N, M = list(map(int, input().split())) AB = [list(map(int, input().split())) for _ in range(M)] s, e = set(), set() for ab in AB: a, b = ab if a == 1: s.add(b) elif b == N: e.add(a) if len(s & e) >= 1: print('POSSIBLE') else: prin...
14
16
290
330
N, M = list(map(int, input().split())) AB = [list(map(int, input().split())) for _ in range(M)] s, e = set(), set() for ab in AB: a, b = ab if a == 1: s.add(b) elif b == N: e.add(a) if len(s & e) >= 1: print("POSSIBLE") else: print("IMPOSSIBLE")
import sys input = sys.stdin.readline N, M = list(map(int, input().split())) AB = [list(map(int, input().split())) for _ in range(M)] s, e = set(), set() for ab in AB: a, b = ab if a == 1: s.add(b) elif b == N: e.add(a) if len(s & e) >= 1: print("POSSIBLE") else: print("IMPOSSIBLE")...
false
12.5
[ "+import sys", "+", "+input = sys.stdin.readline" ]
false
0.05363
0.112542
0.476532
[ "s607005287", "s250964360" ]
u588341295
p03409
python
s876584697
s879213699
59
35
3,316
3,444
Accepted
Accepted
40.68
# -*- coding: utf-8 -*- # 青い点を探して処理する関数 def search_bluedot(end_x, end_y): # 更新する値をグローバル宣言 global ans global field # Y軸向きには値の大きい方から優先して取るために、逆順でループ回す for y in range(end_y-1, -1, -1): for x in range(end_x): # 赤い点を見つけたら、答えを+1して赤い点を消す if field[y][x] == 1: ans += 1 field[y][x] = 0 ret...
# -*- coding: utf-8 -*- """ 参考:https://www.hamayanhamayan.com/entry/2018/03/18/085108    http://vartkw.hatenablog.com/entry/2016/12/02/002703    https://ikatakos.com/pot/programming_algorithm/graph_theory/maximum_flow ・二部最大マッチング ・最大流アルゴリズム(Dinic法) ・まだ理解不十分な点はあると思うけど、初めて見た時よりは見慣れた。 """ from collections impo...
37
97
822
2,343
# -*- coding: utf-8 -*- # 青い点を探して処理する関数 def search_bluedot(end_x, end_y): # 更新する値をグローバル宣言 global ans global field # Y軸向きには値の大きい方から優先して取るために、逆順でループ回す for y in range(end_y - 1, -1, -1): for x in range(end_x): # 赤い点を見つけたら、答えを+1して赤い点を消す if field[y][x] == 1: ...
# -*- coding: utf-8 -*- """ 参考:https://www.hamayanhamayan.com/entry/2018/03/18/085108    http://vartkw.hatenablog.com/entry/2016/12/02/002703    https://ikatakos.com/pot/programming_algorithm/graph_theory/maximum_flow ・二部最大マッチング ・最大流アルゴリズム(Dinic法) ・まだ理解不十分な点はあると思うけど、初めて見た時よりは見慣れた。 """ from collections import deque cl...
false
61.85567
[ "-# 青い点を探して処理する関数", "-def search_bluedot(end_x, end_y):", "- # 更新する値をグローバル宣言", "- global ans", "- global field", "- # Y軸向きには値の大きい方から優先して取るために、逆順でループ回す", "- for y in range(end_y - 1, -1, -1):", "- for x in range(end_x):", "- # 赤い点を見つけたら、答えを+1して赤い点を消す", "- ...
false
0.037476
0.075327
0.497511
[ "s876584697", "s879213699" ]
u076917070
p03634
python
s374768579
s009816872
1,056
823
57,112
137,932
Accepted
Accepted
22.06
import sys input=sys.stdin.readline # 頂点 s からの最短距離を求める (存在しないときはinf) # n: 頂点数, edge[i]: 頂点 i からの [cost, dst] の list (heapq のため cost が先) # O(|E|log|V|) import heapq def dijkstra(s,n,edge): d = [float("inf")] * n # s からの距離 d[s] = 0 q = [] # 頂点への距離を管理する。ヒープにする for e in edge[s]: heapq.h...
import sys input=sys.stdin.readline sys.setrecursionlimit(3*10**5) # 大丈夫か? N = int(eval(input())) edge = [[] for i in range(N)] # edge[i] : 頂点 i から出る経路の [距離,行先] の隣接リスト for _ in range(N-1): a,b,c = list(map(int, input().split())) edge[a-1].append([c,b-1]) edge[b-1].append([c,a-1]) D = [-1]*N # ...
43
31
1,066
728
import sys input = sys.stdin.readline # 頂点 s からの最短距離を求める (存在しないときはinf) # n: 頂点数, edge[i]: 頂点 i からの [cost, dst] の list (heapq のため cost が先) # O(|E|log|V|) import heapq def dijkstra(s, n, edge): d = [float("inf")] * n # s からの距離 d[s] = 0 q = [] # 頂点への距離を管理する。ヒープにする for e in edge[s]: heapq.heapp...
import sys input = sys.stdin.readline sys.setrecursionlimit(3 * 10**5) # 大丈夫か? N = int(eval(input())) edge = [[] for i in range(N)] # edge[i] : 頂点 i から出る経路の [距離,行先] の隣接リスト for _ in range(N - 1): a, b, c = list(map(int, input().split())) edge[a - 1].append([c, b - 1]) edge[b - 1].append([c, a - 1]) D = [-1...
false
27.906977
[ "-# 頂点 s からの最短距離を求める (存在しないときはinf)", "-# n: 頂点数, edge[i]: 頂点 i からの [cost, dst] の list (heapq のため cost が先)", "-# O(|E|log|V|)", "-import heapq", "-", "-", "-def dijkstra(s, n, edge):", "- d = [float(\"inf\")] * n # s からの距離", "- d[s] = 0", "- q = [] # 頂点への距離を管理する。ヒープにする", "- for e in...
false
0.048351
0.047277
1.022733
[ "s374768579", "s009816872" ]
u332385682
p03805
python
s674773450
s138823673
41
29
3,188
3,188
Accepted
Accepted
29.27
import sys from itertools import permutations def debug(x, table): for name, val in table.items(): if x is val: print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr) return None cnt = 0 def dfs(N, Adj, p, pos, mask): global cnt if pos == N: for...
import sys from itertools import permutations def debug(x, table): for name, val in table.items(): if x is val: print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr) return None def do_dp(N, Adj): univ = 2**N - 1 dp = [[0]*N for i in range(univ + 1)] dp...
51
43
1,013
981
import sys from itertools import permutations def debug(x, table): for name, val in table.items(): if x is val: print("DEBUG:{} -> {}".format(name, val), file=sys.stderr) return None cnt = 0 def dfs(N, Adj, p, pos, mask): global cnt if pos == N: for i in range(N...
import sys from itertools import permutations def debug(x, table): for name, val in table.items(): if x is val: print("DEBUG:{} -> {}".format(name, val), file=sys.stderr) return None def do_dp(N, Adj): univ = 2**N - 1 dp = [[0] * N for i in range(univ + 1)] dp[1][0] =...
false
15.686275
[ "-cnt = 0", "-", "-", "-def dfs(N, Adj, p, pos, mask):", "- global cnt", "- if pos == N:", "- for i in range(N - 1):", "- if not Adj[p[i]][p[i + 1]]:", "- break", "- else:", "- cnt += 1", "- return None", "- for i in range(N)...
false
0.049315
0.04319
1.141814
[ "s674773450", "s138823673" ]
u673173160
p02767
python
s661713920
s591113287
25
21
3,060
2,940
Accepted
Accepted
16
n = int(eval(input())) X = list(map(int, input().split())) for p in range(max(X)+100): sum = 0 for x in X: sum += ((x - p)**2) if p == 0: ans = sum if ans > sum: ans = sum print(ans)
n = int(eval(input())) X = list(map(int, input().split())) for p in range(max(X)+1): sum = 0 for x in X: sum += ((x - p)**2) if p == 0: ans = sum if ans > sum: ans = sum print(ans)
11
11
226
225
n = int(eval(input())) X = list(map(int, input().split())) for p in range(max(X) + 100): sum = 0 for x in X: sum += (x - p) ** 2 if p == 0: ans = sum if ans > sum: ans = sum print(ans)
n = int(eval(input())) X = list(map(int, input().split())) for p in range(max(X) + 1): sum = 0 for x in X: sum += (x - p) ** 2 if p == 0: ans = sum if ans > sum: ans = sum print(ans)
false
0
[ "-for p in range(max(X) + 100):", "+for p in range(max(X) + 1):" ]
false
0.039422
0.040923
0.963321
[ "s661713920", "s591113287" ]
u429029348
p02576
python
s363201063
s498623602
30
27
9,092
9,152
Accepted
Accepted
10
import math n, x, t = list(map(int, input().split())) ans = math.ceil(n/x)*t print(ans)
n, x, t = list(map(int, input().split())) times = (n + x - 1) // x ans = times * t print(ans)
4
4
84
90
import math n, x, t = list(map(int, input().split())) ans = math.ceil(n / x) * t print(ans)
n, x, t = list(map(int, input().split())) times = (n + x - 1) // x ans = times * t print(ans)
false
0
[ "-import math", "-", "-ans = math.ceil(n / x) * t", "+times = (n + x - 1) // x", "+ans = times * t" ]
false
0.036876
0.037832
0.974712
[ "s363201063", "s498623602" ]
u761320129
p02697
python
s989375421
s183393059
104
79
21,848
9,152
Accepted
Accepted
24.04
N,M = list(map(int,input().split())) ans = [] if N%2: for i in range(N//2): ans.append((i+1, N-1-i)) else: m = N//2 for i in range(m//2): ans.append((i+1, m-i)) for i in range((m-1)//2): ans.append((m+i+1, N-1-i)) for a,b in ans[:M]: print((a,b))
N,M = list(map(int,input().split())) if N%2: for i in range(M): print((i+1, M*2-i)) else: b = M//2 a = M - b for i in range(a): print((i+1, a*2-i)) for i in range(b): print((a*2+1+i, M*2+1-i))
13
11
294
234
N, M = list(map(int, input().split())) ans = [] if N % 2: for i in range(N // 2): ans.append((i + 1, N - 1 - i)) else: m = N // 2 for i in range(m // 2): ans.append((i + 1, m - i)) for i in range((m - 1) // 2): ans.append((m + i + 1, N - 1 - i)) for a, b in ans[:M]: print((a,...
N, M = list(map(int, input().split())) if N % 2: for i in range(M): print((i + 1, M * 2 - i)) else: b = M // 2 a = M - b for i in range(a): print((i + 1, a * 2 - i)) for i in range(b): print((a * 2 + 1 + i, M * 2 + 1 - i))
false
15.384615
[ "-ans = []", "- for i in range(N // 2):", "- ans.append((i + 1, N - 1 - i))", "+ for i in range(M):", "+ print((i + 1, M * 2 - i))", "- m = N // 2", "- for i in range(m // 2):", "- ans.append((i + 1, m - i))", "- for i in range((m - 1) // 2):", "- ans.app...
false
0.045734
0.037681
1.2137
[ "s989375421", "s183393059" ]
u774160580
p03999
python
s184685950
s590380201
201
22
42,348
3,060
Accepted
Accepted
89.05
import itertools as it S = eval(input()) ans = 0 for config in it.product(list(range(2)), repeat=len(S) - 1): eq = "" for i in range(len(S) - 1): eq += S[i] + "+" if config[i] == 1 else S[i] eq += S[-1] ans += sum([int(i) for i in eq.split("+")]) print(ans)
import itertools as it S = eval(input()) ans = 0 for config in it.product(["+", ""], repeat=len(S) - 1): num = [] for i in range(len(S)): num.append(S[i]) if i < len(S) - 1: num.append(config[i]) ans += sum([int(i) for i in "".join(num).split("+")]) print(ans)
11
12
281
307
import itertools as it S = eval(input()) ans = 0 for config in it.product(list(range(2)), repeat=len(S) - 1): eq = "" for i in range(len(S) - 1): eq += S[i] + "+" if config[i] == 1 else S[i] eq += S[-1] ans += sum([int(i) for i in eq.split("+")]) print(ans)
import itertools as it S = eval(input()) ans = 0 for config in it.product(["+", ""], repeat=len(S) - 1): num = [] for i in range(len(S)): num.append(S[i]) if i < len(S) - 1: num.append(config[i]) ans += sum([int(i) for i in "".join(num).split("+")]) print(ans)
false
8.333333
[ "-for config in it.product(list(range(2)), repeat=len(S) - 1):", "- eq = \"\"", "- for i in range(len(S) - 1):", "- eq += S[i] + \"+\" if config[i] == 1 else S[i]", "- eq += S[-1]", "- ans += sum([int(i) for i in eq.split(\"+\")])", "+for config in it.product([\"+\", \"\"], repeat=len...
false
0.085381
0.007626
11.195785
[ "s184685950", "s590380201" ]
u535171899
p03038
python
s096011846
s545215465
352
201
111,244
35,500
Accepted
Accepted
42.9
def main(): #import sys #input = sys.stdin.readline n,m = list(map(int,input().split())) A = list(map(int,input().split())) BC = [list(map(int,input().split())) for _ in range(m)] BC = sorted(BC,key=lambda x:(x[1]),reverse=True) append_list = [] for b,c in BC: if len(a...
def main(): import sys input = sys.stdin.readline n,m = list(map(int,input().split())) A = list(map(int,input().split())) BC = [list(map(int,input().split())) for _ in range(m)] BC = sorted(BC,key=lambda x:(x[1]),reverse=True) append_list = [] for b,c in BC: if len(app...
19
19
485
483
def main(): # import sys # input = sys.stdin.readline n, m = list(map(int, input().split())) A = list(map(int, input().split())) BC = [list(map(int, input().split())) for _ in range(m)] BC = sorted(BC, key=lambda x: (x[1]), reverse=True) append_list = [] for b, c in BC: if len(ap...
def main(): import sys input = sys.stdin.readline n, m = list(map(int, input().split())) A = list(map(int, input().split())) BC = [list(map(int, input().split())) for _ in range(m)] BC = sorted(BC, key=lambda x: (x[1]), reverse=True) append_list = [] for b, c in BC: if len(appen...
false
0
[ "- # import sys", "- # input = sys.stdin.readline", "+ import sys", "+", "+ input = sys.stdin.readline" ]
false
0.062299
0.042661
1.460324
[ "s096011846", "s545215465" ]
u057109575
p02882
python
s001567754
s013280753
182
166
38,256
38,384
Accepted
Accepted
8.79
from math import atan, pi a, b, x = list(map(int, input().split())) if x > (a ** 2 * b / 2): print((atan(2 * (a ** 2 * b - x) / a ** 3) * 180 / pi)) else: print((atan((a * b ** 2) / (2 * x)) * 180 / pi))
import math a, b, x = list(map(int, input().split())) if a ** 2 * b == x: print((0.0)) elif a ** 2 * b * 0.5 < x: d = a ** 3 / (2 * (a ** 2 * b - x)) print((90 - math.atan(d) * 180 / math.pi)) else: d = 2 * x / (a * b ** 2) print((90 - math.atan(d) * 180 / math.pi))
7
12
208
288
from math import atan, pi a, b, x = list(map(int, input().split())) if x > (a**2 * b / 2): print((atan(2 * (a**2 * b - x) / a**3) * 180 / pi)) else: print((atan((a * b**2) / (2 * x)) * 180 / pi))
import math a, b, x = list(map(int, input().split())) if a**2 * b == x: print((0.0)) elif a**2 * b * 0.5 < x: d = a**3 / (2 * (a**2 * b - x)) print((90 - math.atan(d) * 180 / math.pi)) else: d = 2 * x / (a * b**2) print((90 - math.atan(d) * 180 / math.pi))
false
41.666667
[ "-from math import atan, pi", "+import math", "-if x > (a**2 * b / 2):", "- print((atan(2 * (a**2 * b - x) / a**3) * 180 / pi))", "+if a**2 * b == x:", "+ print((0.0))", "+elif a**2 * b * 0.5 < x:", "+ d = a**3 / (2 * (a**2 * b - x))", "+ print((90 - math.atan(d) * 180 / math.pi))", "-...
false
0.170955
0.047874
3.570941
[ "s001567754", "s013280753" ]
u419963262
p02861
python
s367627707
s280143375
508
115
8,052
80,420
Accepted
Accepted
77.36
import itertools n = int(eval(input())) lis = [] keep = [0, 1, 2, 3, 4, 5, 6, 7, 8] keep = list(itertools.permutations(keep[:n])) for i in range(n): s = list(map(int, input().split())) lis.append(s) ans = 0 re_ans = 0 for j in range(len(keep)): for k in range(n - 1): ans = ((lis[keep[j...
import itertools n = int(eval(input())) lis = [] for i in range(n): x, y = list(map(int, input().split())) lis.append((x, y)) LIS = [i for i in range(n)] big_lis = list(itertools.permutations(LIS)) L = len(big_lis) def sai(i, j): return (lis[A[i + 1]][j] - lis[A[i]][j]) ** 2 keep = ...
17
27
478
492
import itertools n = int(eval(input())) lis = [] keep = [0, 1, 2, 3, 4, 5, 6, 7, 8] keep = list(itertools.permutations(keep[:n])) for i in range(n): s = list(map(int, input().split())) lis.append(s) ans = 0 re_ans = 0 for j in range(len(keep)): for k in range(n - 1): ans = ( (lis[keep[j...
import itertools n = int(eval(input())) lis = [] for i in range(n): x, y = list(map(int, input().split())) lis.append((x, y)) LIS = [i for i in range(n)] big_lis = list(itertools.permutations(LIS)) L = len(big_lis) def sai(i, j): return (lis[A[i + 1]][j] - lis[A[i]][j]) ** 2 keep = 0 ANS = 0 for i in r...
false
37.037037
[ "-keep = [0, 1, 2, 3, 4, 5, 6, 7, 8]", "-keep = list(itertools.permutations(keep[:n]))", "- s = list(map(int, input().split()))", "- lis.append(s)", "-ans = 0", "-re_ans = 0", "-for j in range(len(keep)):", "- for k in range(n - 1):", "- ans = (", "- (lis[keep[j][k]][0] ...
false
0.113803
0.040778
2.790813
[ "s367627707", "s280143375" ]
u969850098
p03450
python
s886984838
s241859743
745
380
15,736
84,068
Accepted
Accepted
48.99
import sys readline = sys.stdin.readline class WeightedUnionFind: def __init__(self, n): self.parents = [i for i in range(n)] self.rank = [0] * n # 根への距離を管理 self.weight = [0] * n def find(self, x): if self.parents[x] == x: return x else:...
import sys readline = sys.stdin.readline class WeightedUnionFind: def __init__(self, n): self.parents = [i for i in range(n)] self.rank = [0] * n self.weight = [0] * n # 根への距離を管理 def find(self, x): if self.parents[x] == x: return x else: ...
61
60
1,625
1,617
import sys readline = sys.stdin.readline class WeightedUnionFind: def __init__(self, n): self.parents = [i for i in range(n)] self.rank = [0] * n # 根への距離を管理 self.weight = [0] * n def find(self, x): if self.parents[x] == x: return x else: ...
import sys readline = sys.stdin.readline class WeightedUnionFind: def __init__(self, n): self.parents = [i for i in range(n)] self.rank = [0] * n self.weight = [0] * n # 根への距離を管理 def find(self, x): if self.parents[x] == x: return x else: y = s...
false
1.639344
[ "- # 根への距離を管理", "- self.weight = [0] * n", "+ self.weight = [0] * n # 根への距離を管理" ]
false
0.006982
0.074355
0.093899
[ "s886984838", "s241859743" ]
u596536048
p02898
python
s952673787
s776342156
60
53
18,392
16,932
Accepted
Accepted
11.67
N, K = list(map(int, input().split())) h = list(map(int, input().split())) print((sum(h[i] >= K for i in range(N))))
N, K = list(map(int, input().split())) print((sum([h >= K for h in map(int, input().split())])))
3
2
110
89
N, K = list(map(int, input().split())) h = list(map(int, input().split())) print((sum(h[i] >= K for i in range(N))))
N, K = list(map(int, input().split())) print((sum([h >= K for h in map(int, input().split())])))
false
33.333333
[ "-h = list(map(int, input().split()))", "-print((sum(h[i] >= K for i in range(N))))", "+print((sum([h >= K for h in map(int, input().split())])))" ]
false
0.034572
0.041432
0.83443
[ "s952673787", "s776342156" ]
u362347649
p03160
python
s997436542
s264412813
279
127
22,732
13,980
Accepted
Accepted
54.48
import numpy as np N = int(eval(input())) h = list(map(int, input().split())) dp = [float("inf")] * N dp[0] = 0 dp[1] = abs(h[0] - h[1]) for i in range(2, N): dp[i] = min( dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]) ) print((dp[-1]))
N = int(eval(input())) h = list(map(int, input().split())) dp = [float("inf")] * N dp[0] = 0 dp[1] = abs(h[0] - h[1]) h_2 = h[0] h_1 = h[1] for i in range(2, N): x = h[i] dp[i] = min( dp[i - 1] + abs(x - h_1), dp[i - 2] + abs(x - h_2) ) h_2 = h_1 h_1 = x print((dp[-1...
14
17
287
316
import numpy as np N = int(eval(input())) h = list(map(int, input().split())) dp = [float("inf")] * N dp[0] = 0 dp[1] = abs(h[0] - h[1]) for i in range(2, N): dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2])) print((dp[-1]))
N = int(eval(input())) h = list(map(int, input().split())) dp = [float("inf")] * N dp[0] = 0 dp[1] = abs(h[0] - h[1]) h_2 = h[0] h_1 = h[1] for i in range(2, N): x = h[i] dp[i] = min(dp[i - 1] + abs(x - h_1), dp[i - 2] + abs(x - h_2)) h_2 = h_1 h_1 = x print((dp[-1]))
false
17.647059
[ "-import numpy as np", "-", "+h_2 = h[0]", "+h_1 = h[1]", "- dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))", "+ x = h[i]", "+ dp[i] = min(dp[i - 1] + abs(x - h_1), dp[i - 2] + abs(x - h_2))", "+ h_2 = h_1", "+ h_1 = x" ]
false
0.037104
0.036387
1.019695
[ "s997436542", "s264412813" ]
u761989513
p02756
python
s011580417
s581547921
447
388
6,508
6,256
Accepted
Accepted
13.2
from collections import deque s = eval(input()) q = int(eval(input())) reverse = False count = 0 mae = deque() ushiro = deque() for i in range(q): qu = eval(input()) if qu[0] == "1": count += 1 if reverse: reverse = False else: reverse = True ...
s = eval(input()) q = int(eval(input())) reverse = False count = 0 mae = [] ushiro = [] for i in range(q): qu = eval(input()) if qu[0] == "1": count += 1 if reverse: reverse = False else: reverse = True else: _, f, c = qu.split() ...
36
34
704
659
from collections import deque s = eval(input()) q = int(eval(input())) reverse = False count = 0 mae = deque() ushiro = deque() for i in range(q): qu = eval(input()) if qu[0] == "1": count += 1 if reverse: reverse = False else: reverse = True else: _,...
s = eval(input()) q = int(eval(input())) reverse = False count = 0 mae = [] ushiro = [] for i in range(q): qu = eval(input()) if qu[0] == "1": count += 1 if reverse: reverse = False else: reverse = True else: _, f, c = qu.split() if reverse: ...
false
5.555556
[ "-from collections import deque", "-", "-mae = deque()", "-ushiro = deque()", "+mae = []", "+ushiro = []", "- mae.appendleft(c)", "+ mae.append(c)", "- mae.appendleft(c)", "+ mae.append(c)", "-s = \"\".join(mae) + s + \"\".join(ushiro)"...
false
0.041595
0.007195
5.781047
[ "s011580417", "s581547921" ]
u655110382
p02996
python
s090876203
s812465617
1,100
849
41,540
33,356
Accepted
Accepted
22.82
N = int(eval(input())) d = {} total = 0 for _ in range(N): a, b = list(map(int, input().split())) d[b] = d.get(b, 0) + a for t, c in sorted(d.items()): total += c if total > t: print("No") exit() print("Yes")
n = int(eval(input())) w = sorted([tuple(map(int, input().split())) for _ in range(n)], key=lambda x: x[1]) agg = 0 for c, t in w: agg += c if t < agg: print("No") exit() print("Yes")
12
10
240
212
N = int(eval(input())) d = {} total = 0 for _ in range(N): a, b = list(map(int, input().split())) d[b] = d.get(b, 0) + a for t, c in sorted(d.items()): total += c if total > t: print("No") exit() print("Yes")
n = int(eval(input())) w = sorted([tuple(map(int, input().split())) for _ in range(n)], key=lambda x: x[1]) agg = 0 for c, t in w: agg += c if t < agg: print("No") exit() print("Yes")
false
16.666667
[ "-N = int(eval(input()))", "-d = {}", "-total = 0", "-for _ in range(N):", "- a, b = list(map(int, input().split()))", "- d[b] = d.get(b, 0) + a", "-for t, c in sorted(d.items()):", "- total += c", "- if total > t:", "+n = int(eval(input()))", "+w = sorted([tuple(map(int, input().spl...
false
0.134791
0.041007
3.287014
[ "s090876203", "s812465617" ]
u391731808
p03436
python
s209304628
s473038380
24
22
3,316
3,192
Accepted
Accepted
8.33
H,W = list(map(int,input().split())) s = [["#"]*(W+2)] + [["#"] + [c for c in eval(input())] + ["#"] for _ in [0]*H] + [["#"]*(W+2)] ans = sum([sum([int(c == ".") for c in row]) for row in s]) s[1][1] = 1 ij = [[1,1]] d = [[0,1],[0,-1],[1,0],[-1,0]] cnt = 0 while ij[cnt:]: i,j = ij[cnt] for di,dj in d:...
H,W = list(map(int,input().split())) s = [[c=="." for c in eval(input())] for _ in [0]*H] def bsf_dist_grid(grid,start): H = len(grid) W = len(grid[0]) d = [[-1]*W for _ in [0]*H] d[start[0]][start[1]] = 0 q = [start] while q: qq = [] for xy in q: x,y = x...
21
25
570
755
H, W = list(map(int, input().split())) s = ( [["#"] * (W + 2)] + [["#"] + [c for c in eval(input())] + ["#"] for _ in [0] * H] + [["#"] * (W + 2)] ) ans = sum([sum([int(c == ".") for c in row]) for row in s]) s[1][1] = 1 ij = [[1, 1]] d = [[0, 1], [0, -1], [1, 0], [-1, 0]] cnt = 0 while ij[cnt:]: i, j =...
H, W = list(map(int, input().split())) s = [[c == "." for c in eval(input())] for _ in [0] * H] def bsf_dist_grid(grid, start): H = len(grid) W = len(grid[0]) d = [[-1] * W for _ in [0] * H] d[start[0]][start[1]] = 0 q = [start] while q: qq = [] for xy in q: x, y = ...
false
16
[ "-s = (", "- [[\"#\"] * (W + 2)]", "- + [[\"#\"] + [c for c in eval(input())] + [\"#\"] for _ in [0] * H]", "- + [[\"#\"] * (W + 2)]", "-)", "-ans = sum([sum([int(c == \".\") for c in row]) for row in s])", "-s[1][1] = 1", "-ij = [[1, 1]]", "-d = [[0, 1], [0, -1], [1, 0], [-1, 0]]", "-cnt...
false
0.039177
0.038567
1.015799
[ "s209304628", "s473038380" ]
u192154323
p03160
python
s265420566
s984894049
197
102
13,980
85,724
Accepted
Accepted
48.22
n = int(eval(input())) h_ls = list(map(int, input().split())) dp = [float('inf') for _ in range(n)] dp[0] = 0 for i in range(n-1): dp[i+1] = min(dp[i+1], dp[i] + abs(h_ls[i+1] - h_ls[i])) if i < n - 2: dp[i+2] = min(dp[i+2], dp[i] + abs(h_ls[i+2] - h_ls[i])) print((dp[-1]))
n = int(eval(input())) h_ls = list(map(int, input().split())) mincost_ls = [float('inf')] * n mincost_ls[0] = 0 for i in range(n-1): mincost_ls[i+1] = min(mincost_ls[i+1], mincost_ls[i]+abs(h_ls[i+1]-h_ls[i])) if i+2 < n: mincost_ls[i+2] = min(mincost_ls[i+2], mincost_ls[i]+abs(h_ls[i+2]-h_ls[i])...
9
9
291
338
n = int(eval(input())) h_ls = list(map(int, input().split())) dp = [float("inf") for _ in range(n)] dp[0] = 0 for i in range(n - 1): dp[i + 1] = min(dp[i + 1], dp[i] + abs(h_ls[i + 1] - h_ls[i])) if i < n - 2: dp[i + 2] = min(dp[i + 2], dp[i] + abs(h_ls[i + 2] - h_ls[i])) print((dp[-1]))
n = int(eval(input())) h_ls = list(map(int, input().split())) mincost_ls = [float("inf")] * n mincost_ls[0] = 0 for i in range(n - 1): mincost_ls[i + 1] = min( mincost_ls[i + 1], mincost_ls[i] + abs(h_ls[i + 1] - h_ls[i]) ) if i + 2 < n: mincost_ls[i + 2] = min( mincost_ls[i + 2]...
false
0
[ "-dp = [float(\"inf\") for _ in range(n)]", "-dp[0] = 0", "+mincost_ls = [float(\"inf\")] * n", "+mincost_ls[0] = 0", "- dp[i + 1] = min(dp[i + 1], dp[i] + abs(h_ls[i + 1] - h_ls[i]))", "- if i < n - 2:", "- dp[i + 2] = min(dp[i + 2], dp[i] + abs(h_ls[i + 2] - h_ls[i]))", "-print((dp[-1])...
false
0.086208
0.061839
1.394066
[ "s265420566", "s984894049" ]
u347640436
p03854
python
s688102427
s984617091
697
78
3,992
3,236
Accepted
Accepted
88.81
from sys import exit s = eval(input()) ts = [''] while True: nts= [] for t in ts: for w in ['dreamer', 'eraser', 'dream', 'erase']: tw = t + w if s == tw: print('YES') exit() if s.startswith(tw): nts.append(tw) if len(nts) == 0: print('NO') exit...
from sys import exit s = input()[::-1] while True: if s == '': print('YES') exit() for w in ['maerd', 'remaerd', 'esare', 'resare']: if s.startswith(w): s = s[len(w):] break else: print('NO') exit()
17
13
329
249
from sys import exit s = eval(input()) ts = [""] while True: nts = [] for t in ts: for w in ["dreamer", "eraser", "dream", "erase"]: tw = t + w if s == tw: print("YES") exit() if s.startswith(tw): nts.append(tw) if ...
from sys import exit s = input()[::-1] while True: if s == "": print("YES") exit() for w in ["maerd", "remaerd", "esare", "resare"]: if s.startswith(w): s = s[len(w) :] break else: print("NO") exit()
false
23.529412
[ "-s = eval(input())", "-ts = [\"\"]", "+s = input()[::-1]", "- nts = []", "- for t in ts:", "- for w in [\"dreamer\", \"eraser\", \"dream\", \"erase\"]:", "- tw = t + w", "- if s == tw:", "- print(\"YES\")", "- exit()", "- ...
false
0.075194
0.036566
2.056417
[ "s688102427", "s984617091" ]
u437351386
p02714
python
s809979152
s669871559
166
150
73,660
67,948
Accepted
Accepted
9.64
n=int(eval(input())) s=list(eval(input())) a=s.count("R") b=s.count("G") c=s.count("B") ans=0 for i in range(n-2): for j in range(i+1,n-1): k=2*j-i if n-1>=k and (s[i]!=s[j] and s[i]!=s[k] and s[j]!=s[k]): ans=ans+1 print((a*b*c-ans))
n=int(eval(input())) s=eval(input()) a=s.count("R") b=s.count("G") c=s.count("B") sum=0 for i in range(n-2): for j in range(i+1,n-1): if 2*j-i<=n-1 and s[i]!=s[j] and s[j]!=s[2*j-i] and s[2*j-i]!=s[i]: sum=sum+1 print((a*b*c-sum))
12
12
248
246
n = int(eval(input())) s = list(eval(input())) a = s.count("R") b = s.count("G") c = s.count("B") ans = 0 for i in range(n - 2): for j in range(i + 1, n - 1): k = 2 * j - i if n - 1 >= k and (s[i] != s[j] and s[i] != s[k] and s[j] != s[k]): ans = ans + 1 print((a * b * c - ans))
n = int(eval(input())) s = eval(input()) a = s.count("R") b = s.count("G") c = s.count("B") sum = 0 for i in range(n - 2): for j in range(i + 1, n - 1): if ( 2 * j - i <= n - 1 and s[i] != s[j] and s[j] != s[2 * j - i] and s[2 * j - i] != s[i] ): ...
false
0
[ "-s = list(eval(input()))", "+s = eval(input())", "-ans = 0", "+sum = 0", "- k = 2 * j - i", "- if n - 1 >= k and (s[i] != s[j] and s[i] != s[k] and s[j] != s[k]):", "- ans = ans + 1", "-print((a * b * c - ans))", "+ if (", "+ 2 * j - i <= n - 1", "+ ...
false
0.048125
0.051237
0.939271
[ "s809979152", "s669871559" ]
u811733736
p00221
python
s608349833
s400096468
290
250
8,512
8,604
Accepted
Accepted
13.79
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0221 """ import sys from sys import stdin from collections import deque input = stdin.readline def fb_gen(count=1): while True: if count % 15 == 0: ans = 'FizzBuzz' elif count % 5 == 0:...
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0221 """ import sys from sys import stdin from collections import deque input = stdin.readline def fb_gen(count=1): while True: if count % 15 == 0: ans = 'FizzBuzz' elif count % 5 == 0:...
47
50
1,045
1,142
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0221 """ import sys from sys import stdin from collections import deque input = stdin.readline def fb_gen(count=1): while True: if count % 15 == 0: ans = "FizzBuzz" elif count % 5 == 0: an...
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0221 """ import sys from sys import stdin from collections import deque input = stdin.readline def fb_gen(count=1): while True: if count % 15 == 0: ans = "FizzBuzz" elif count % 5 == 0: an...
false
6
[ "+ ok_count = 0", "+ players.rotate(ok_count)", "+ ok_count = 0", "- players.rotate(-1)", "+ ok_count -= 1" ]
false
0.036179
0.097481
0.371145
[ "s608349833", "s400096468" ]
u703950586
p02763
python
s070690341
s363680673
819
511
83,524
64,580
Accepted
Accepted
37.61
import sys,queue,math,copy,itertools,bisect,collections,heapq def main(): sys.setrecursionlimit(10**7) INF = 10**18 MOD = 10**9 + 7 LI = lambda : [int(x) for x in sys.stdin.readline().split()] NI = lambda : int(sys.stdin.readline()) N = NI() R = 2**(N.bit_length()) st = [0...
import sys,queue,math,copy,itertools,bisect,collections,heapq def main(): sys.setrecursionlimit(10**7) INF = 10**18 MOD = 10**9 + 7 LI = lambda : [int(x) for x in sys.stdin.readline().split()] NI = lambda : int(sys.stdin.readline()) N = NI() R = 2**(N.bit_length()) st = [0...
50
61
1,265
1,412
import sys, queue, math, copy, itertools, bisect, collections, heapq def main(): sys.setrecursionlimit(10**7) INF = 10**18 MOD = 10**9 + 7 LI = lambda: [int(x) for x in sys.stdin.readline().split()] NI = lambda: int(sys.stdin.readline()) N = NI() R = 2 ** (N.bit_length()) st = [0] * (R...
import sys, queue, math, copy, itertools, bisect, collections, heapq def main(): sys.setrecursionlimit(10**7) INF = 10**18 MOD = 10**9 + 7 LI = lambda: [int(x) for x in sys.stdin.readline().split()] NI = lambda: int(sys.stdin.readline()) N = NI() R = 2 ** (N.bit_length()) st = [0] * (R...
false
18.032787
[ "- def query(a, b, n, l, r):", "+ def query(l, r):", "+ l += R - 1", "+ r += R - 2", "- if a <= l and r <= b:", "- return st[n]", "- if a < r and b > l:", "- vl = query(a, b, n * 2 + 1, l, (l + r) // 2)", "- vr = query(a, b, n * 2 + ...
false
0.040019
0.045206
0.88525
[ "s070690341", "s363680673" ]
u483896240
p03073
python
s336253304
s942472218
85
69
5,628
5,620
Accepted
Accepted
18.82
# -*- coding: utf-8 -*- ss = eval(input()) #print(ss) s = [] for i in range(len(ss)): s.append(int(ss[i])) #print(s) if len(s)%2 == 0: s0 = [0,1] *(len(s)//2) s1 = [1,0] *(len(s)//2) else: s0 = [0,1] *(len(s)//2) s0.append(0) s1 = [1,0] *(len(s)//2) s1.append(1) #print...
# -*- coding: utf-8 -*- ss = eval(input()) *s, = list(map(int,ss)) if len(s)%2 == 0: s0 = [0,1] *(len(s)//2) s1 = [1,0] *(len(s)//2) else: s0 = [0,1] *(len(s)//2) s0.append(0) s1 = [1,0] *(len(s)//2) s1.append(1) sum0 = 0 sum1 = 0 for i in range(len(s)): if s0[i] != s[i]...
36
23
577
417
# -*- coding: utf-8 -*- ss = eval(input()) # print(ss) s = [] for i in range(len(ss)): s.append(int(ss[i])) # print(s) if len(s) % 2 == 0: s0 = [0, 1] * (len(s) // 2) s1 = [1, 0] * (len(s) // 2) else: s0 = [0, 1] * (len(s) // 2) s0.append(0) s1 = [1, 0] * (len(s) // 2) s1.append(1) # print(s...
# -*- coding: utf-8 -*- ss = eval(input()) (*s,) = list(map(int, ss)) if len(s) % 2 == 0: s0 = [0, 1] * (len(s) // 2) s1 = [1, 0] * (len(s) // 2) else: s0 = [0, 1] * (len(s) // 2) s0.append(0) s1 = [1, 0] * (len(s) // 2) s1.append(1) sum0 = 0 sum1 = 0 for i in range(len(s)): if s0[i] != s[i]...
false
36.111111
[ "-# print(ss)", "-s = []", "-for i in range(len(ss)):", "- s.append(int(ss[i]))", "-# print(s)", "+(*s,) = list(map(int, ss))", "-# print(s0)", "-# print(s1)", "- # print(s0[i] , s[i])", "- # print(s1[i] , s[i])" ]
false
0.040136
0.040472
0.991697
[ "s336253304", "s942472218" ]
u994988729
p03575
python
s531456048
s496930898
264
237
17,764
16,952
Accepted
Accepted
10.23
import numpy as np from scipy.sparse.csgraph import floyd_warshall inf=10**9 n, m=list(map(int,input().split())) g1=np.ones((n,n),dtype=int) * inf bridge=[] for _ in range(m): a,b=list(map(int,input().split())) bridge.append((a-1, b-1)) g1[a-1][b-1]=1 g1[b-1][a-1]=1 ans=0 for a,b in br...
from scipy.sparse.csgraph import floyd_warshall import numpy as np import sys input = sys.stdin.readline N, M = list(map(int, input().split())) AB = [] edge = np.zeros((N, N), dtype=int) for _ in range(M): a, b = list(map(int, input().split())) a -= 1 b -= 1 AB.append((a, b)) edge[a]...
24
28
463
544
import numpy as np from scipy.sparse.csgraph import floyd_warshall inf = 10**9 n, m = list(map(int, input().split())) g1 = np.ones((n, n), dtype=int) * inf bridge = [] for _ in range(m): a, b = list(map(int, input().split())) bridge.append((a - 1, b - 1)) g1[a - 1][b - 1] = 1 g1[b - 1][a - 1] = 1 ans =...
from scipy.sparse.csgraph import floyd_warshall import numpy as np import sys input = sys.stdin.readline N, M = list(map(int, input().split())) AB = [] edge = np.zeros((N, N), dtype=int) for _ in range(M): a, b = list(map(int, input().split())) a -= 1 b -= 1 AB.append((a, b)) edge[a][b] = 1 edg...
false
14.285714
[ "+from scipy.sparse.csgraph import floyd_warshall", "-from scipy.sparse.csgraph import floyd_warshall", "+import sys", "-inf = 10**9", "-n, m = list(map(int, input().split()))", "-g1 = np.ones((n, n), dtype=int) * inf", "-bridge = []", "-for _ in range(m):", "+input = sys.stdin.readline", "+N, M =...
false
0.338816
0.287917
1.176783
[ "s531456048", "s496930898" ]
u945181840
p03645
python
s269680997
s182479350
582
299
19,024
18,892
Accepted
Accepted
48.63
N, M = list(map(int, input().split())) ship1 = set([]) ship2 = set([]) for i in range(M): a, b = list(map(int, input().split())) if a == 1: ship1.add(b) elif b == N: ship2.add(a) if len(ship1 & ship2) == 0: print('IMPOSSIBLE') else: print('POSSIBLE')
import sys input = sys.stdin.readline N, M = list(map(int, input().split())) ship1 = set([]) ship2 = set([]) for i in range(M): a, b = list(map(int, input().split())) if a == 1: ship1.add(b) elif b == N: ship2.add(a) if ship1 & ship2: print('POSSIBLE') else: print('...
14
17
288
320
N, M = list(map(int, input().split())) ship1 = set([]) ship2 = set([]) for i in range(M): a, b = list(map(int, input().split())) if a == 1: ship1.add(b) elif b == N: ship2.add(a) if len(ship1 & ship2) == 0: print("IMPOSSIBLE") else: print("POSSIBLE")
import sys input = sys.stdin.readline N, M = list(map(int, input().split())) ship1 = set([]) ship2 = set([]) for i in range(M): a, b = list(map(int, input().split())) if a == 1: ship1.add(b) elif b == N: ship2.add(a) if ship1 & ship2: print("POSSIBLE") else: print("IMPOSSIBLE")
false
17.647059
[ "+import sys", "+", "+input = sys.stdin.readline", "-if len(ship1 & ship2) == 0:", "+if ship1 & ship2:", "+ print(\"POSSIBLE\")", "+else:", "-else:", "- print(\"POSSIBLE\")" ]
false
0.047389
0.092692
0.511255
[ "s269680997", "s182479350" ]
u707124227
p02873
python
s500618301
s452870246
490
237
23,336
51,016
Accepted
Accepted
51.63
s=eval(input()) a=[0]*(len(s)+1) r=0 l=0 for i in range(len(a)): j=i if r==0: while j < len(s) and s[j] == '>': r+=1 j+=1 else: r-=1 if i !=0 and s[i-1] == '<': l+=1 else: l=0 a[i]=max(l,r) print((sum(a)))
s=eval(input()) # ai=max(左にある<の連続数,右にある>の連続数) n=len(s)+1 dr,dl=[0]*n,[0]*n # dl[i]:区切りiの左にある<の連続数。dl[0]=0 # dr[i]:区切りiの右にある>の連続数。dl[-1]=0 # ともにlen=n p='' cl,cr=0,0 for i in range(n-1): if s[i]=='<': cl+=1 else: cl=0 dl[i+1]=cl if s[-(i+1)]=='>': ...
18
24
254
442
s = eval(input()) a = [0] * (len(s) + 1) r = 0 l = 0 for i in range(len(a)): j = i if r == 0: while j < len(s) and s[j] == ">": r += 1 j += 1 else: r -= 1 if i != 0 and s[i - 1] == "<": l += 1 else: l = 0 a[i] = max(l, r) print((sum(a)))
s = eval(input()) # ai=max(左にある<の連続数,右にある>の連続数) n = len(s) + 1 dr, dl = [0] * n, [0] * n # dl[i]:区切りiの左にある<の連続数。dl[0]=0 # dr[i]:区切りiの右にある>の連続数。dl[-1]=0 # ともにlen=n p = "" cl, cr = 0, 0 for i in range(n - 1): if s[i] == "<": cl += 1 else: cl = 0 dl[i + 1] = cl if s[-(i + 1)] == ">": ...
false
25
[ "-a = [0] * (len(s) + 1)", "-r = 0", "-l = 0", "-for i in range(len(a)):", "- j = i", "- if r == 0:", "- while j < len(s) and s[j] == \">\":", "- r += 1", "- j += 1", "+# ai=max(左にある<の連続数,右にある>の連続数)", "+n = len(s) + 1", "+dr, dl = [0] * n, [0] * n", "+# dl[...
false
0.035096
0.056502
0.621142
[ "s500618301", "s452870246" ]
u368780724
p03081
python
s784405880
s453259445
1,778
545
26,832
81,444
Accepted
Accepted
69.35
N, Q = list(map(int, input().split())) S = eval(input()) TX = [list(input().split()) for _ in range(Q)] def checkl(i): for t, x in TX: if S[i] == t: i += 1 if x == 'R' else -1 if i < 0: return False if i == N: i = N - 1 return True def chec...
import sys N, Q = list(map(int, input().split())) s = eval(input()) TD = [sys.stdin.readline().split() for _ in range(Q)] def checkl(k): np = k for t, d in TD: if s[np] == t: if d == 'L': np -= 1 else: np += 1 if np < 0: ...
41
52
817
940
N, Q = list(map(int, input().split())) S = eval(input()) TX = [list(input().split()) for _ in range(Q)] def checkl(i): for t, x in TX: if S[i] == t: i += 1 if x == "R" else -1 if i < 0: return False if i == N: i = N - 1 return True def checkr(i): ...
import sys N, Q = list(map(int, input().split())) s = eval(input()) TD = [sys.stdin.readline().split() for _ in range(Q)] def checkl(k): np = k for t, d in TD: if s[np] == t: if d == "L": np -= 1 else: np += 1 if np < 0: retu...
false
21.153846
[ "+import sys", "+", "-S = eval(input())", "-TX = [list(input().split()) for _ in range(Q)]", "+s = eval(input())", "+TD = [sys.stdin.readline().split() for _ in range(Q)]", "-def checkl(i):", "- for t, x in TX:", "- if S[i] == t:", "- i += 1 if x == \"R\" else -1", "- ...
false
0.061783
0.045558
1.356145
[ "s784405880", "s453259445" ]
u935984175
p04006
python
s470409789
s511726339
1,710
1,217
55,680
70,188
Accepted
Accepted
28.83
import sys rl = sys.stdin.readline class SegmentTree: def __init__(self, init_value: list, segfunc, ide_ele): n = len(init_value) self.N0 = 1 << (n - 1).bit_length() self.ide_ele = ide_ele self.data = [ide_ele] * (2 * self.N0) self.segfunc = segfunc ...
import sys sys.setrecursionlimit(10 ** 7) rl = sys.stdin.readline class SegmentTree: def __init__(self, init_value: list, segfunc, ide_ele): n = len(init_value) self.N0 = 1 << (n - 1).bit_length() self.ide_ele = ide_ele self.data = [ide_ele] * (2 * self.N0) sel...
62
63
1,725
1,766
import sys rl = sys.stdin.readline class SegmentTree: def __init__(self, init_value: list, segfunc, ide_ele): n = len(init_value) self.N0 = 1 << (n - 1).bit_length() self.ide_ele = ide_ele self.data = [ide_ele] * (2 * self.N0) self.segfunc = segfunc for i, x in enu...
import sys sys.setrecursionlimit(10**7) rl = sys.stdin.readline class SegmentTree: def __init__(self, init_value: list, segfunc, ide_ele): n = len(init_value) self.N0 = 1 << (n - 1).bit_length() self.ide_ele = ide_ele self.data = [ide_ele] * (2 * self.N0) self.segfunc = se...
false
1.587302
[ "+sys.setrecursionlimit(10**7)", "- k >>= 1", "+ k = (k - 1) // 2" ]
false
0.056581
0.054171
1.044487
[ "s470409789", "s511726339" ]
u863370423
p03160
python
s090371842
s830327515
140
117
13,928
20,572
Accepted
Accepted
16.43
n=int(eval(input())) numbers = [int(n) for n in input().split()] cost = [] for i in range(0,n): cost.append(0) #cost[0]=0 cost[1]=abs(numbers[1]-numbers[0]) for i in range(2,n): cost[i]=min((cost[i-2]+abs(numbers[i]-numbers[i-2])),(cost[i-1]+abs(numbers[i]-numbers[i-1]))) #print(cost) print((cos...
n=int(eval(input())) h=list(map(int,input().split())) dp=[0]*(n+1) dp[0]=0 dp[1]=abs(h[1]-h[0]) for i in range(2,n): dp[i]=min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1])) # print(dp) print((dp[-2]))
12
9
320
210
n = int(eval(input())) numbers = [int(n) for n in input().split()] cost = [] for i in range(0, n): cost.append(0) # cost[0]=0 cost[1] = abs(numbers[1] - numbers[0]) for i in range(2, n): cost[i] = min( (cost[i - 2] + abs(numbers[i] - numbers[i - 2])), (cost[i - 1] + abs(numbers[i] - numbers[i - ...
n = int(eval(input())) h = list(map(int, input().split())) dp = [0] * (n + 1) dp[0] = 0 dp[1] = abs(h[1] - h[0]) for i in range(2, n): dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]), dp[i - 1] + abs(h[i] - h[i - 1])) # print(dp) print((dp[-2]))
false
25
[ "-numbers = [int(n) for n in input().split()]", "-cost = []", "-for i in range(0, n):", "- cost.append(0)", "-# cost[0]=0", "-cost[1] = abs(numbers[1] - numbers[0])", "+h = list(map(int, input().split()))", "+dp = [0] * (n + 1)", "+dp[0] = 0", "+dp[1] = abs(h[1] - h[0])", "- cost[i] = min(...
false
0.036977
0.04262
0.8676
[ "s090371842", "s830327515" ]
u043844098
p03805
python
s848906620
s200588084
54
44
10,256
10,252
Accepted
Accepted
18.52
from typing import List, Tuple def main(): n, m = list(map(int, input().split())) g = [] for _ in range(m): a, b = list(map(int, input().split())) g.append((a, b)) print((osp(n, g))) def osp(n: int, g: List[Tuple[int, int]]) -> int: v = [False] * n return dfs(...
from typing import List, Tuple def main(): n, m = list(map(int, input().split())) g = [] for _ in range(m): a, b = list(map(int, input().split())) g.append((a, b)) print((osp(n, g))) def osp(n: int, g: List[Tuple[int, int]]) -> int: v = [False] * n g = set(g) ...
38
39
692
708
from typing import List, Tuple def main(): n, m = list(map(int, input().split())) g = [] for _ in range(m): a, b = list(map(int, input().split())) g.append((a, b)) print((osp(n, g))) def osp(n: int, g: List[Tuple[int, int]]) -> int: v = [False] * n return dfs(0, v, n, g) de...
from typing import List, Tuple def main(): n, m = list(map(int, input().split())) g = [] for _ in range(m): a, b = list(map(int, input().split())) g.append((a, b)) print((osp(n, g))) def osp(n: int, g: List[Tuple[int, int]]) -> int: v = [False] * n g = set(g) return dfs(0...
false
2.564103
[ "+ g = set(g)" ]
false
0.043999
0.067129
0.655434
[ "s848906620", "s200588084" ]
u103341055
p04045
python
s994781977
s028788964
74
49
2,940
3,064
Accepted
Accepted
33.78
Num = [int(n) for n in input().rstrip().split()] D = [int(n) for n in input().rstrip().split()] # numbers = [ n for n in range(10) if not n in D] flag = 0 for i in range(Num[0],10*Num[0]+1): for j in str(i): if int(j) in D: flag = 1 break if flag == 0: ...
N ,K = list(map(int,input().split())) D = [int(n) for n in input().split()] flag = False for i in range(N,100000): N = i while i > 0: flag = True if i%10 in D: flag = False break else: i //=10 if flag == True: print(N) ...
20
18
383
327
Num = [int(n) for n in input().rstrip().split()] D = [int(n) for n in input().rstrip().split()] # numbers = [ n for n in range(10) if not n in D] flag = 0 for i in range(Num[0], 10 * Num[0] + 1): for j in str(i): if int(j) in D: flag = 1 break if flag == 0: print(i) ...
N, K = list(map(int, input().split())) D = [int(n) for n in input().split()] flag = False for i in range(N, 100000): N = i while i > 0: flag = True if i % 10 in D: flag = False break else: i //= 10 if flag == True: print(N) break
false
10
[ "-Num = [int(n) for n in input().rstrip().split()]", "-D = [int(n) for n in input().rstrip().split()]", "-# numbers = [ n for n in range(10) if not n in D]", "-flag = 0", "-for i in range(Num[0], 10 * Num[0] + 1):", "- for j in str(i):", "- if int(j) in D:", "- flag = 1", "+N, K...
false
0.047049
0.041213
1.141592
[ "s994781977", "s028788964" ]
u388370899
p02713
python
s030804550
s814603022
1,170
269
11,452
11,316
Accepted
Accepted
77.01
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import math from functools import lru_cache @lru_cache(maxsize=None) def get_gcd(a, b): return math.gcd(a, b) def main(): k = int(input().strip()) sum = 0 for a in range(1, k + 1): for b in range(1, k + 1): a_, b_ =...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import math from functools import lru_cache # prime_200 = { # 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, # 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, # 179, 181, 191...
26
53
559
1,385
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import math from functools import lru_cache @lru_cache(maxsize=None) def get_gcd(a, b): return math.gcd(a, b) def main(): k = int(input().strip()) sum = 0 for a in range(1, k + 1): for b in range(1, k + 1): a_, b_ = (a, b) if a < b e...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import math from functools import lru_cache # prime_200 = { # 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, # 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, # 179, 181, 191, 193, 197...
false
50.943396
[ "-", "+# prime_200 = {", "+# 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71,", "+# 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173,", "+# 179, 181, 191, 193, 197, 199", "+# }", "+ # すべて同じ(a, a, a)", "+ sum += k...
false
0.224868
0.046892
4.795469
[ "s030804550", "s814603022" ]
u151005508
p02881
python
s839676276
s347527961
462
155
3,060
3,060
Accepted
Accepted
66.45
import math n=int(eval(input())) lst=[] down=math.floor(math.sqrt(n)) for i in range(1,down+1): if i**2>n: break if n%i==0: lst.append(i+n//i) print((min(lst)-2))
import math n=int(eval(input())) lst=[] down=math.floor(math.sqrt(n)) for i in range(1,down+1): #if i**2>n: # break if n%i==0: lst.append(i+n//i) print((min(lst)-2))
10
10
187
190
import math n = int(eval(input())) lst = [] down = math.floor(math.sqrt(n)) for i in range(1, down + 1): if i**2 > n: break if n % i == 0: lst.append(i + n // i) print((min(lst) - 2))
import math n = int(eval(input())) lst = [] down = math.floor(math.sqrt(n)) for i in range(1, down + 1): # if i**2>n: # break if n % i == 0: lst.append(i + n // i) print((min(lst) - 2))
false
0
[ "- if i**2 > n:", "- break", "+ # if i**2>n:", "+ # break" ]
false
0.050509
0.040127
1.25872
[ "s839676276", "s347527961" ]
u641929438
p02727
python
s126175161
s528432428
273
251
24,840
22,720
Accepted
Accepted
8.06
import numpy as np x, y, a, b, c = list(map(int, input().split())) p = np.array(list(map(int, input().split()))) q = np.array(list(map(int, input().split()))) r = np.array(list(map(int, input().split()))) p = np.sort(p)[::-1][:x] q = np.sort(q)[::-1][:y] a = np.hstack((p, q, r)) a = np.sort(a)[::-1][:(x+y)]...
# npを使わずにリストの破壊的ソートを利用する場合 x, y, a, b, c = list(map(int, input().split())) p = list(map(int, input().split())) q = list(map(int, input().split())) r = list(map(int, input().split())) p.sort() q.sort() p = p[::-1][:x] q = q[::-1][:y] a = p + q + r a.sort(reverse=True) print((sum(a[:x+y])))
13
16
334
300
import numpy as np x, y, a, b, c = list(map(int, input().split())) p = np.array(list(map(int, input().split()))) q = np.array(list(map(int, input().split()))) r = np.array(list(map(int, input().split()))) p = np.sort(p)[::-1][:x] q = np.sort(q)[::-1][:y] a = np.hstack((p, q, r)) a = np.sort(a)[::-1][: (x + y)] print((...
# npを使わずにリストの破壊的ソートを利用する場合 x, y, a, b, c = list(map(int, input().split())) p = list(map(int, input().split())) q = list(map(int, input().split())) r = list(map(int, input().split())) p.sort() q.sort() p = p[::-1][:x] q = q[::-1][:y] a = p + q + r a.sort(reverse=True) print((sum(a[: x + y])))
false
18.75
[ "-import numpy as np", "-", "+# npを使わずにリストの破壊的ソートを利用する場合", "-p = np.array(list(map(int, input().split())))", "-q = np.array(list(map(int, input().split())))", "-r = np.array(list(map(int, input().split())))", "-p = np.sort(p)[::-1][:x]", "-q = np.sort(q)[::-1][:y]", "-a = np.hstack((p, q, r))", "-...
false
0.419127
0.036654
11.434651
[ "s126175161", "s528432428" ]
u747602774
p03244
python
s298176190
s064363706
129
90
19,040
20,956
Accepted
Accepted
30.23
import collections N = int(eval(input())) V = list(map(int,input().split())) V_even = V[::2] V_odd = V[1::2] V_even_counter = collections.Counter(V_even) V_odd_counter = collections.Counter(V_odd) if V_even_counter.most_common()[0][0] != V_odd_counter.most_common()[0][0]: ans = N - V_even_counter.most_commo...
n = int(eval(input())) v = list(map(int,input().split())) v1 = v[::2] v2 = v[1::2] from collections import Counter cv1 = Counter(v1).most_common() cv2 = Counter(v2).most_common() cv1.append((0,0)) cv2.append((0,0)) if cv1[0][0] == cv2[0][0]: ans = n - max(cv1[0][1] + cv2[1][1], cv1[1][1] + cv2[0][1]) e...
20
15
957
368
import collections N = int(eval(input())) V = list(map(int, input().split())) V_even = V[::2] V_odd = V[1::2] V_even_counter = collections.Counter(V_even) V_odd_counter = collections.Counter(V_odd) if V_even_counter.most_common()[0][0] != V_odd_counter.most_common()[0][0]: ans = N - V_even_counter.most_common()[0]...
n = int(eval(input())) v = list(map(int, input().split())) v1 = v[::2] v2 = v[1::2] from collections import Counter cv1 = Counter(v1).most_common() cv2 = Counter(v2).most_common() cv1.append((0, 0)) cv2.append((0, 0)) if cv1[0][0] == cv2[0][0]: ans = n - max(cv1[0][1] + cv2[1][1], cv1[1][1] + cv2[0][1]) else: ...
false
25
[ "-import collections", "+n = int(eval(input()))", "+v = list(map(int, input().split()))", "+v1 = v[::2]", "+v2 = v[1::2]", "+from collections import Counter", "-N = int(eval(input()))", "-V = list(map(int, input().split()))", "-V_even = V[::2]", "-V_odd = V[1::2]", "-V_even_counter = collections...
false
0.040844
0.042265
0.966376
[ "s298176190", "s064363706" ]
u576917603
p02911
python
s314983367
s642824929
569
257
50,520
14,752
Accepted
Accepted
54.83
n,k,q=list(map(int, input().split())) p=[-q+k]*n for i in range(0,q): p[int(eval(input()))-1]+=1 for i in range(0,n): print(("Yes" if p[i]>0 else "No"))
n,k,q=list(map(int,input().split())) a=[] for i in range(q): a.append(int(eval(input()))) import collections c=collections.Counter(a) c=list(c.items()) p=[0]*n for i in c: p[i[0]-1]=i[1] line=1-(k-q) for i in p: if i>=line: print('Yes') else: print('No')
6
16
151
289
n, k, q = list(map(int, input().split())) p = [-q + k] * n for i in range(0, q): p[int(eval(input())) - 1] += 1 for i in range(0, n): print(("Yes" if p[i] > 0 else "No"))
n, k, q = list(map(int, input().split())) a = [] for i in range(q): a.append(int(eval(input()))) import collections c = collections.Counter(a) c = list(c.items()) p = [0] * n for i in c: p[i[0] - 1] = i[1] line = 1 - (k - q) for i in p: if i >= line: print("Yes") else: print("No")
false
62.5
[ "-p = [-q + k] * n", "-for i in range(0, q):", "- p[int(eval(input())) - 1] += 1", "-for i in range(0, n):", "- print((\"Yes\" if p[i] > 0 else \"No\"))", "+a = []", "+for i in range(q):", "+ a.append(int(eval(input())))", "+import collections", "+", "+c = collections.Counter(a)", "+c...
false
0.034599
0.032858
1.052989
[ "s314983367", "s642824929" ]
u843032026
p03285
python
s685254270
s039347810
30
25
9,192
9,164
Accepted
Accepted
16.67
N=int(eval(input())) if N in [1,2,3,5,6,9,10,13,17]: print("No") else: print("Yes")
N=int(eval(input())) for i in range(0,4): if N-7*i>=0 and (N-7*i)%4==0: print("Yes") break else: print("No")
5
7
85
120
N = int(eval(input())) if N in [1, 2, 3, 5, 6, 9, 10, 13, 17]: print("No") else: print("Yes")
N = int(eval(input())) for i in range(0, 4): if N - 7 * i >= 0 and (N - 7 * i) % 4 == 0: print("Yes") break else: print("No")
false
28.571429
[ "-if N in [1, 2, 3, 5, 6, 9, 10, 13, 17]:", "+for i in range(0, 4):", "+ if N - 7 * i >= 0 and (N - 7 * i) % 4 == 0:", "+ print(\"Yes\")", "+ break", "+else:", "-else:", "- print(\"Yes\")" ]
false
0.045692
0.045453
1.005246
[ "s685254270", "s039347810" ]
u644907318
p03062
python
s634521920
s151232300
228
108
64,752
92,476
Accepted
Accepted
52.63
N = int(eval(input())) A = list(map(int,input().split())) cnt = 0 amin = 10**9+7 tot = 0 for i in range(N): if A[i]<0: cnt += 1 amin = min(amin,abs(A[i])) tot += abs(A[i]) if cnt%2==0: print(tot) else: print((tot-2*amin))
N = int(eval(input())) A = list(map(int,input().split())) m = 0 z = 0 for i in range(N): if A[i]<0: m += 1 elif A[i]==0: z += 1 m = m%2 B = sorted([abs(A[i]) for i in range(N)]) p = m-z if p>0: for i in range(z,z+p): B[i] = -B[i] print((sum(B))) else: print((...
14
18
254
318
N = int(eval(input())) A = list(map(int, input().split())) cnt = 0 amin = 10**9 + 7 tot = 0 for i in range(N): if A[i] < 0: cnt += 1 amin = min(amin, abs(A[i])) tot += abs(A[i]) if cnt % 2 == 0: print(tot) else: print((tot - 2 * amin))
N = int(eval(input())) A = list(map(int, input().split())) m = 0 z = 0 for i in range(N): if A[i] < 0: m += 1 elif A[i] == 0: z += 1 m = m % 2 B = sorted([abs(A[i]) for i in range(N)]) p = m - z if p > 0: for i in range(z, z + p): B[i] = -B[i] print((sum(B))) else: print((sum...
false
22.222222
[ "-cnt = 0", "-amin = 10**9 + 7", "-tot = 0", "+m = 0", "+z = 0", "- cnt += 1", "- amin = min(amin, abs(A[i]))", "- tot += abs(A[i])", "-if cnt % 2 == 0:", "- print(tot)", "+ m += 1", "+ elif A[i] == 0:", "+ z += 1", "+m = m % 2", "+B = sorted([abs(A[i]) f...
false
0.044476
0.046412
0.958295
[ "s634521920", "s151232300" ]
u981332890
p02995
python
s231166386
s808252088
35
17
5,052
3,064
Accepted
Accepted
51.43
import fractions def euclid(x, y): return (x * y) // fractions.gcd(x, y) def dif(x, C, D): return x - (x//C) - (x//D) + (x//(euclid(C, D))) def main(): A, B, C, D = list(map(int, input().split())) return dif(B, C, D) - dif((A-1), C, D) if __name__ == '__main__': print((main()))
# 最小公倍数を返す def euclid(x, y): x_1 = x y_1 = y a = x_1%y_1 while a != 0: x_1 = y_1 y_1 = a a = x_1%y_1 return (x * y) // y_1 # x以下のCとDで割り切れる数を返す def dif(x, C, D): return x - (x//C) - (x//D) + (x//(euclid(C, D))) def main(): A, B, C, D = list(map(int, i...
14
21
307
428
import fractions def euclid(x, y): return (x * y) // fractions.gcd(x, y) def dif(x, C, D): return x - (x // C) - (x // D) + (x // (euclid(C, D))) def main(): A, B, C, D = list(map(int, input().split())) return dif(B, C, D) - dif((A - 1), C, D) if __name__ == "__main__": print((main()))
# 最小公倍数を返す def euclid(x, y): x_1 = x y_1 = y a = x_1 % y_1 while a != 0: x_1 = y_1 y_1 = a a = x_1 % y_1 return (x * y) // y_1 # x以下のCとDで割り切れる数を返す def dif(x, C, D): return x - (x // C) - (x // D) + (x // (euclid(C, D))) def main(): A, B, C, D = list(map(int, input...
false
33.333333
[ "-import fractions", "+# 最小公倍数を返す", "+def euclid(x, y):", "+ x_1 = x", "+ y_1 = y", "+ a = x_1 % y_1", "+ while a != 0:", "+ x_1 = y_1", "+ y_1 = a", "+ a = x_1 % y_1", "+ return (x * y) // y_1", "-def euclid(x, y):", "- return (x * y) // fractions.gcd(...
false
0.049631
0.036581
1.35673
[ "s231166386", "s808252088" ]
u073852194
p03053
python
s368457437
s655939429
881
485
180,220
110,828
Accepted
Accepted
44.95
from collections import deque h,w = list(map(int,input().split())) A = [] for i in range(h): A += list(eval(input())) queue = deque([]) Distance = [-1]*(h*w) for i in range(h): for j in range(w): if A[i*w+j]=='#': queue.append([i,j]) Distance[i*w+j] = 0 ans = ...
from collections import deque import sys input = sys.stdin.readline dx = [1, 0, -1, 0] dy = [0, 1, 0, -1] H, W = list(map(int, input().split())) A = [eval(input()) for _ in range(H)] dist = [-1 for _ in range(H * W)] queue = deque() for x in range(H): for y in range(W): if A[x][y] == '#...
35
36
883
752
from collections import deque h, w = list(map(int, input().split())) A = [] for i in range(h): A += list(eval(input())) queue = deque([]) Distance = [-1] * (h * w) for i in range(h): for j in range(w): if A[i * w + j] == "#": queue.append([i, j]) Distance[i * w + j] = 0 ans = 0 ...
from collections import deque import sys input = sys.stdin.readline dx = [1, 0, -1, 0] dy = [0, 1, 0, -1] H, W = list(map(int, input().split())) A = [eval(input()) for _ in range(H)] dist = [-1 for _ in range(H * W)] queue = deque() for x in range(H): for y in range(W): if A[x][y] == "#": z = x...
false
2.777778
[ "+import sys", "-h, w = list(map(int, input().split()))", "-A = []", "-for i in range(h):", "- A += list(eval(input()))", "-queue = deque([])", "-Distance = [-1] * (h * w)", "-for i in range(h):", "- for j in range(w):", "- if A[i * w + j] == \"#\":", "- queue.append([i, ...
false
0.081675
0.037973
2.150868
[ "s368457437", "s655939429" ]
u195054737
p03087
python
s865113816
s442405312
870
440
7,748
11,876
Accepted
Accepted
49.43
N, Q = list(map(int, input().split())) S = eval(input()) sum_table = [0] * (N+1) for i in range(N): sum_table[i+1] = sum_table[i] + (1 if S[i:i+2] == "AC" else 0) for i in range(Q): left, right = list(map(int, input().split())) print((sum_table[right-1] - sum_table[left-1]))
N, Q = list(map(int, input().split())) S = eval(input()) sum_table = [0] * (N+1) for i in range(N): sum_table[i+1] = sum_table[i] + (1 if S[i:i+2] == "AC" else 0) ans_table = [] for i in range(Q): left, right = list(map(int, input().split())) ans_table.append(sum_table[right-1] - sum_table[lef...
11
15
281
368
N, Q = list(map(int, input().split())) S = eval(input()) sum_table = [0] * (N + 1) for i in range(N): sum_table[i + 1] = sum_table[i] + (1 if S[i : i + 2] == "AC" else 0) for i in range(Q): left, right = list(map(int, input().split())) print((sum_table[right - 1] - sum_table[left - 1]))
N, Q = list(map(int, input().split())) S = eval(input()) sum_table = [0] * (N + 1) for i in range(N): sum_table[i + 1] = sum_table[i] + (1 if S[i : i + 2] == "AC" else 0) ans_table = [] for i in range(Q): left, right = list(map(int, input().split())) ans_table.append(sum_table[right - 1] - sum_table[left - ...
false
26.666667
[ "+ans_table = []", "- print((sum_table[right - 1] - sum_table[left - 1]))", "+ ans_table.append(sum_table[right - 1] - sum_table[left - 1])", "+for i in range(len(ans_table)):", "+ print((ans_table[i]))" ]
false
0.035611
0.054914
0.648491
[ "s865113816", "s442405312" ]
u638456847
p02762
python
s933914307
s112024857
1,089
532
52,256
51,728
Accepted
Accepted
51.15
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines class UnionFind_size: def __init__(self, n): # 初期状態は全要素が根なので、親は自分自身 self.par = [i for i in range(n+1)] # 集団の要素数(size)を格納する(初期は全て1) self.size = [1] * (n+1) # 根を検索する関数 ...
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines def main(): N,M,K = list(map(int, readline().split())) F = [[] for _ in range(N+1)] for _ in range(M): a,b = list(map(int, readline().split())) F[a].append(b) F[b].append(a)...
88
62
2,122
1,359
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines class UnionFind_size: def __init__(self, n): # 初期状態は全要素が根なので、親は自分自身 self.par = [i for i in range(n + 1)] # 集団の要素数(size)を格納する(初期は全て1) self.size = [1] * (n + 1) # 根を検索する関数 def fin...
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines def main(): N, M, K = list(map(int, readline().split())) F = [[] for _ in range(N + 1)] for _ in range(M): a, b = list(map(int, readline().split())) F[a].append(b) F[b].append(a) B =...
false
29.545455
[ "-class UnionFind_size:", "- def __init__(self, n):", "- # 初期状態は全要素が根なので、親は自分自身", "- self.par = [i for i in range(n + 1)]", "- # 集団の要素数(size)を格納する(初期は全て1)", "- self.size = [1] * (n + 1)", "-", "- # 根を検索する関数", "- def find(self, x):", "- # 根までたどったらその番号を返す"...
false
0.046726
0.093732
0.498501
[ "s933914307", "s112024857" ]
u385644001
p03274
python
s372257676
s125183892
103
84
14,252
14,224
Accepted
Accepted
18.45
N, K = list(map(int, input().split())) x = list(map(int, input().split())) ret = 10 ** 9 for i in range(N-K+1): init = abs(x[i]) dist = abs(x[i]-x[i+K-1]) l = init + dist init = abs(x[i+K-1]) r = init + dist ret = min(ret, l, r) print(ret)
n,k = list(map(int,input().split())) lista = [int(i) for i in input().split()] minv = 10**9 for i in range(n-k+1): head = lista[i] tail = lista[i+k-1] if head*tail <0: if abs(head)>abs(tail): temp = abs(head) + 2*abs(tail) else: temp = 2*abs(head) + abs(...
11
21
267
490
N, K = list(map(int, input().split())) x = list(map(int, input().split())) ret = 10**9 for i in range(N - K + 1): init = abs(x[i]) dist = abs(x[i] - x[i + K - 1]) l = init + dist init = abs(x[i + K - 1]) r = init + dist ret = min(ret, l, r) print(ret)
n, k = list(map(int, input().split())) lista = [int(i) for i in input().split()] minv = 10**9 for i in range(n - k + 1): head = lista[i] tail = lista[i + k - 1] if head * tail < 0: if abs(head) > abs(tail): temp = abs(head) + 2 * abs(tail) else: temp = 2 * abs(head) +...
false
47.619048
[ "-N, K = list(map(int, input().split()))", "-x = list(map(int, input().split()))", "-ret = 10**9", "-for i in range(N - K + 1):", "- init = abs(x[i])", "- dist = abs(x[i] - x[i + K - 1])", "- l = init + dist", "- init = abs(x[i + K - 1])", "- r = init + dist", "- ret = min(ret, l...
false
0.096129
0.042871
2.242255
[ "s372257676", "s125183892" ]
u260980560
p00295
python
s594555327
s634725612
3,250
710
4,424
4,424
Accepted
Accepted
78.15
def rotate(p, comm): if comm==0: p[0],p[1],p[2], p[27],p[28],p[29] = p[27],p[28],p[29], p[0],p[1],p[2] p[14], p[15] = p[15], p[14] p[18], p[20] = p[20], p[18] elif comm==1: p[2],p[5],p[8], p[21],p[24],p[27] = p[21],p[24],p[27], p[2],p[5],p[8] p[11], p[18] = p[18], ...
def rotate(p, comm): if comm==0: p[0],p[1],p[2], p[27],p[28],p[29] = p[27],p[28],p[29], p[0],p[1],p[2] p[14], p[15] = p[15], p[14] p[18], p[20] = p[20], p[18] elif comm==1: p[2],p[5],p[8], p[21],p[24],p[27] = p[21],p[24],p[27], p[2],p[5],p[8] p[11], p[18] = p[18], ...
39
42
1,326
1,342
def rotate(p, comm): if comm == 0: p[0], p[1], p[2], p[27], p[28], p[29] = p[27], p[28], p[29], p[0], p[1], p[2] p[14], p[15] = p[15], p[14] p[18], p[20] = p[20], p[18] elif comm == 1: p[2], p[5], p[8], p[21], p[24], p[27] = p[21], p[24], p[27], p[2], p[5], p[8] p[11], p[...
def rotate(p, comm): if comm == 0: p[0], p[1], p[2], p[27], p[28], p[29] = p[27], p[28], p[29], p[0], p[1], p[2] p[14], p[15] = p[15], p[14] p[18], p[20] = p[20], p[18] elif comm == 1: p[2], p[5], p[8], p[21], p[24], p[27] = p[21], p[24], p[27], p[2], p[5], p[8] p[11], p[...
false
7.142857
[ "+ans = 8", "+", "+", "- ret = 9", "- if cnt == 9:", "- return 9", "+ global ans", "+ if cnt > ans:", "+ return", "- return cnt", "+ ans = cnt", "+ return", "- ret = min(ret, dfs(p, cnt + 1, k))", "+ dfs(p, cnt + 1, k)", "- ...
false
0.255985
0.108772
2.353401
[ "s594555327", "s634725612" ]
u315078622
p03064
python
s764266470
s870860785
1,337
1,185
119,668
43,772
Accepted
Accepted
11.37
N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] sum_A = sum(A) MOD = 998244353 dp1 = [0] * (sum_A + 1) dp2 = [0] * (sum_A + 1) dp1[0] = dp2[0] = 1 for a in A: dp1_ = [0] * (sum_A + 1) dp2_ = [0] * (sum_A + 1) for i in range(sum_A + 1): if i - a >= 0: ...
N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] sum_A = sum(A) MOD = 998244353 dp1 = [0] * (sum_A + 1) dp2 = [0] * (sum_A + 1) dp1[0] = dp2[0] = 1 for a in A: for i in reversed(list(range(sum_A + 1))): if i - a >= 0: # R に塗れる場合 dp1[i] = (dp1[i - a...
32
29
744
663
N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] sum_A = sum(A) MOD = 998244353 dp1 = [0] * (sum_A + 1) dp2 = [0] * (sum_A + 1) dp1[0] = dp2[0] = 1 for a in A: dp1_ = [0] * (sum_A + 1) dp2_ = [0] * (sum_A + 1) for i in range(sum_A + 1): if i - a >= 0: # R に塗れる場合 ...
N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] sum_A = sum(A) MOD = 998244353 dp1 = [0] * (sum_A + 1) dp2 = [0] * (sum_A + 1) dp1[0] = dp2[0] = 1 for a in A: for i in reversed(list(range(sum_A + 1))): if i - a >= 0: # R に塗れる場合 dp1[i] = (dp1[i - a] + dp1[i] * 2) % M...
false
9.375
[ "- dp1_ = [0] * (sum_A + 1)", "- dp2_ = [0] * (sum_A + 1)", "- for i in range(sum_A + 1):", "+ for i in reversed(list(range(sum_A + 1))):", "- dp1_[i] = (dp1[i - a] + dp1[i] * 2) % MOD", "- dp2_[i] = (dp2[i - a] + dp2[i]) % MOD", "+ dp1[i] = (dp1[i - a] + dp1...
false
0.040053
0.038365
1.044006
[ "s764266470", "s870860785" ]
u735069283
p03086
python
s088794322
s528461753
20
18
3,060
2,940
Accepted
Accepted
10
s = eval(input()) m =0 count =0 for i in s: if i in 'A': count += 1 elif i in'C': count += 1 elif i in 'G': count += 1 elif i in 'T': count += 1 else: count = 0 m =max(m,count) print(m)
s=eval(input()) r=0 count=0 for i in range(len(s)): if s[i]=='A' or s[i]=='C' or s[i]=='G' or s[i]=='T': count +=1 r=max(r,count) else: count=0 print(r)
16
10
258
171
s = eval(input()) m = 0 count = 0 for i in s: if i in "A": count += 1 elif i in "C": count += 1 elif i in "G": count += 1 elif i in "T": count += 1 else: count = 0 m = max(m, count) print(m)
s = eval(input()) r = 0 count = 0 for i in range(len(s)): if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T": count += 1 r = max(r, count) else: count = 0 print(r)
false
37.5
[ "-m = 0", "+r = 0", "-for i in s:", "- if i in \"A\":", "+for i in range(len(s)):", "+ if s[i] == \"A\" or s[i] == \"C\" or s[i] == \"G\" or s[i] == \"T\":", "- elif i in \"C\":", "- count += 1", "- elif i in \"G\":", "- count += 1", "- elif i in \"T\":", "- ...
false
0.045541
0.048879
0.931693
[ "s088794322", "s528461753" ]
u547608423
p03107
python
s587671069
s386129130
36
31
3,188
3,188
Accepted
Accepted
13.89
S=eval(input()) red=0 blue=0 for i in range(len(S)): if S[i]=="0": red+=1 else: blue+=1 print((min(red,blue)*2))
S=eval(input()) count_1=0 count_0=0 for s in S: if s=="0": count_0+=1 else: count_1+=1 print((min(count_0,count_1)*2))
12
12
142
148
S = eval(input()) red = 0 blue = 0 for i in range(len(S)): if S[i] == "0": red += 1 else: blue += 1 print((min(red, blue) * 2))
S = eval(input()) count_1 = 0 count_0 = 0 for s in S: if s == "0": count_0 += 1 else: count_1 += 1 print((min(count_0, count_1) * 2))
false
0
[ "-red = 0", "-blue = 0", "-for i in range(len(S)):", "- if S[i] == \"0\":", "- red += 1", "+count_1 = 0", "+count_0 = 0", "+for s in S:", "+ if s == \"0\":", "+ count_0 += 1", "- blue += 1", "-print((min(red, blue) * 2))", "+ count_1 += 1", "+print((min(co...
false
0.046712
0.093715
0.498452
[ "s587671069", "s386129130" ]
u522140891
p02899
python
s689349069
s404396618
236
197
94,536
90,652
Accepted
Accepted
16.53
from sys import stdin input = stdin.readline def main(): N = int(input()) A = list(map(int, input().split())) order = [] for i in range(N): order.append((i+1, A[i])) order = sorted(order, key=lambda x: x[1]) for i in range(N-1): print(order[i][0], end=' ') print(order[N-1][0]) ...
from sys import stdin input = stdin.readline def main(): N = int(input()) A = list(map(int, input().split())) order = sorted(range(1, N+1), key=lambda i: A[i-1]) print(*order, sep=' ') if(__name__ == '__main__'): main()
19
15
360
250
from sys import stdin input = stdin.readline def main(): N = int(input()) A = list(map(int, input().split())) order = [] for i in range(N): order.append((i + 1, A[i])) order = sorted(order, key=lambda x: x[1]) for i in range(N - 1): print(order[i][0], end=" ") print(order[...
from sys import stdin input = stdin.readline def main(): N = int(input()) A = list(map(int, input().split())) order = sorted(range(1, N + 1), key=lambda i: A[i - 1]) print(*order, sep=" ") if __name__ == "__main__": main()
false
21.052632
[ "- order = []", "- for i in range(N):", "- order.append((i + 1, A[i]))", "- order = sorted(order, key=lambda x: x[1])", "- for i in range(N - 1):", "- print(order[i][0], end=\" \")", "- print(order[N - 1][0])", "+ order = sorted(range(1, N + 1), key=lambda i: A[i - 1])"...
false
0.217548
0.047885
4.543144
[ "s689349069", "s404396618" ]
u127499732
p02832
python
s704725125
s209725182
90
75
24,900
25,116
Accepted
Accepted
16.67
def main(): from collections import deque n, *a = list(map(int, open(0).read().split())) a = deque(a) tar = 1 gab = 0 while a: i = a.popleft() if i != tar: gab += 1 else: tar += 1 if gab == n: print((-1)) else: ...
def main(): n, *a = list(map(int, open(0).read().split())) g = 0 t = 1 for x in a: if x == t: t += 1 else: g += 1 print((g if g != n else -1)) if __name__ == '__main__': main()
22
16
373
256
def main(): from collections import deque n, *a = list(map(int, open(0).read().split())) a = deque(a) tar = 1 gab = 0 while a: i = a.popleft() if i != tar: gab += 1 else: tar += 1 if gab == n: print((-1)) else: print(gab) ...
def main(): n, *a = list(map(int, open(0).read().split())) g = 0 t = 1 for x in a: if x == t: t += 1 else: g += 1 print((g if g != n else -1)) if __name__ == "__main__": main()
false
27.272727
[ "- from collections import deque", "-", "- a = deque(a)", "- tar = 1", "- gab = 0", "- while a:", "- i = a.popleft()", "- if i != tar:", "- gab += 1", "+ g = 0", "+ t = 1", "+ for x in a:", "+ if x == t:", "+ t += 1", "- ...
false
0.04153
0.075697
0.54863
[ "s704725125", "s209725182" ]
u016881126
p02695
python
s364498959
s888570496
955
735
9,268
9,308
Accepted
Accepted
23.04
import sys readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines read = sys.stdin.buffer.read sys.setrecursionlimit(10 ** 7) N, M, Q = list(map(int, readline().split())) q_kumi = [] for _ in range(Q): q_kumi.append(list(map(int, readline().split()))) import itertools AL = itertoo...
import sys readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines read = sys.stdin.buffer.read sys.setrecursionlimit(10 ** 7) INF = float('inf') N, M, Q = list(map(int, readline().split())) kumi = [] for _ in range(Q): tmp = list(map(int, readline().split())) kumi.append(tmp...
24
34
560
712
import sys readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines read = sys.stdin.buffer.read sys.setrecursionlimit(10**7) N, M, Q = list(map(int, readline().split())) q_kumi = [] for _ in range(Q): q_kumi.append(list(map(int, readline().split()))) import itertools AL = itertools.combination...
import sys readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines read = sys.stdin.buffer.read sys.setrecursionlimit(10**7) INF = float("inf") N, M, Q = list(map(int, readline().split())) kumi = [] for _ in range(Q): tmp = list(map(int, readline().split())) kumi.append(tmp) ans = 0 res = [...
false
29.411765
[ "+INF = float(\"inf\")", "-q_kumi = []", "+kumi = []", "- q_kumi.append(list(map(int, readline().split())))", "-import itertools", "+ tmp = list(map(int, readline().split()))", "+ kumi.append(tmp)", "+ans = 0", "+res = []", "-AL = itertools.combinations_with_replacement(list(range(1, M + ...
false
0.176748
0.066788
2.646418
[ "s364498959", "s888570496" ]
u853728588
p03494
python
s196112638
s275031218
311
28
9,092
9,152
Accepted
Accepted
91
n = int(eval(input())) a = list(map(int,input().split())) count = 0 for _ in range(10**6): for i in range(n): if a[i] % 2 == 0: a[i] = a[i]//2 count += 1 else: break print((count//n))
N = int(eval(input())) A = list(map(int, input().split())) ans = 0 while True: if all([x % 2 == 0 for x in A]): ans += 1 A = list([x/2 for x in A]) else: break print(ans)
11
10
213
214
n = int(eval(input())) a = list(map(int, input().split())) count = 0 for _ in range(10**6): for i in range(n): if a[i] % 2 == 0: a[i] = a[i] // 2 count += 1 else: break print((count // n))
N = int(eval(input())) A = list(map(int, input().split())) ans = 0 while True: if all([x % 2 == 0 for x in A]): ans += 1 A = list([x / 2 for x in A]) else: break print(ans)
false
9.090909
[ "-n = int(eval(input()))", "-a = list(map(int, input().split()))", "-count = 0", "-for _ in range(10**6):", "- for i in range(n):", "- if a[i] % 2 == 0:", "- a[i] = a[i] // 2", "- count += 1", "- else:", "- break", "-print((count // n))", "+N =...
false
1.442398
0.096238
14.987799
[ "s196112638", "s275031218" ]
u597374218
p02887
python
s866215032
s868926040
41
37
3,316
3,316
Accepted
Accepted
9.76
N=int(eval(input())) S=eval(input()) count=1 for n in range(1,N): if S[n]!=S[n-1]: count+=1 print(count)
N=int(eval(input())) S=eval(input()) print((sum(S[n]!=S[n-1] for n in range(1,N))+1))
7
3
110
73
N = int(eval(input())) S = eval(input()) count = 1 for n in range(1, N): if S[n] != S[n - 1]: count += 1 print(count)
N = int(eval(input())) S = eval(input()) print((sum(S[n] != S[n - 1] for n in range(1, N)) + 1))
false
57.142857
[ "-count = 1", "-for n in range(1, N):", "- if S[n] != S[n - 1]:", "- count += 1", "-print(count)", "+print((sum(S[n] != S[n - 1] for n in range(1, N)) + 1))" ]
false
0.042847
0.103137
0.415437
[ "s866215032", "s868926040" ]
u873482706
p00180
python
s388941994
s978771474
40
30
4,760
4,496
Accepted
Accepted
25
def f(n): for k, c in list(dic.items()): a, b = k if a == n: if not b in cost or c < cost[b]: cost[b] = c elif b == n: if not a in cost or c < cost[a]: cost[a] = c for k, c in sorted(list(cost.items()), key=lambda x: x[1]):...
def f(n, ans): for k, c in list(dic.items()): a, b = k if a == n: if not b in cost or c < cost[b]: cost[b] = c elif b == n: if not a in cost or c < cost[a]: cost[a] = c for k, c in sorted(list(cost.items()), key=lambda x: x...
28
29
742
784
def f(n): for k, c in list(dic.items()): a, b = k if a == n: if not b in cost or c < cost[b]: cost[b] = c elif b == n: if not a in cost or c < cost[a]: cost[a] = c for k, c in sorted(list(cost.items()), key=lambda x: x[1]): ...
def f(n, ans): for k, c in list(dic.items()): a, b = k if a == n: if not b in cost or c < cost[b]: cost[b] = c elif b == n: if not a in cost or c < cost[a]: cost[a] = c for k, c in sorted(list(cost.items()), key=lambda x: x[1]): ...
false
3.448276
[ "-def f(n):", "+def f(n, ans):", "- ans.append(c)", "- f(k)", "+ ans += c", "+ del cost[k]", "+ return f(k, ans)", "+ return ans", "- ans = []", "- f(s)", "- print(sum(ans))", "+ print(f(s, 0))" ]
false
0.042169
0.03618
1.165535
[ "s388941994", "s978771474" ]
u810288681
p02748
python
s999195474
s161572253
494
415
38,488
18,736
Accepted
Accepted
15.99
a,b,m = list(map(int, input().split())) al = list(map(int, input().split())) bl = list(map(int, input().split())) xyc = [list(map(int, input().split())) for i in range(m)] ans = min(al)+min(bl) for l in xyc: p = al[l[0]-1] + bl[l[1]-1] -l[2] ans = min(ans,p) print(ans)
a,b,m = list(map(int, input().split())) al = list(map(int, input().split())) bl = list(map(int, input().split())) ans = min(al)+min(bl) for i in range(m): x,y,c = list(map(int, input().split())) ans = min(ans, al[x-1]+bl[y-1]-c) print(ans)
9
8
279
242
a, b, m = list(map(int, input().split())) al = list(map(int, input().split())) bl = list(map(int, input().split())) xyc = [list(map(int, input().split())) for i in range(m)] ans = min(al) + min(bl) for l in xyc: p = al[l[0] - 1] + bl[l[1] - 1] - l[2] ans = min(ans, p) print(ans)
a, b, m = list(map(int, input().split())) al = list(map(int, input().split())) bl = list(map(int, input().split())) ans = min(al) + min(bl) for i in range(m): x, y, c = list(map(int, input().split())) ans = min(ans, al[x - 1] + bl[y - 1] - c) print(ans)
false
11.111111
[ "-xyc = [list(map(int, input().split())) for i in range(m)]", "-for l in xyc:", "- p = al[l[0] - 1] + bl[l[1] - 1] - l[2]", "- ans = min(ans, p)", "+for i in range(m):", "+ x, y, c = list(map(int, input().split()))", "+ ans = min(ans, al[x - 1] + bl[y - 1] - c)" ]
false
0.037032
0.046243
0.800814
[ "s999195474", "s161572253" ]
u047796752
p02629
python
s159826418
s699779553
69
63
65,128
61,940
Accepted
Accepted
8.7
import sys input = sys.stdin.readline from collections import * N = int(eval(input())) l = [0, 26] for i in range(30): l.append(l[-1]*26) for i in range(len(l)): if N-l[i]>0: N -= l[i] else: keta = i break ans = [] alpha = 'abcdefghijklmnopqrstuvwxyz' for i i...
N = int(eval(input())) for i in range(1, 100): if N<=26**i: ans = '' N -= 1 for j in range(i): ans += chr(ord('a')+N%26) N //= 26 break else: N -= 26**i print((ans[::-1]))
34
16
566
274
import sys input = sys.stdin.readline from collections import * N = int(eval(input())) l = [0, 26] for i in range(30): l.append(l[-1] * 26) for i in range(len(l)): if N - l[i] > 0: N -= l[i] else: keta = i break ans = [] alpha = "abcdefghijklmnopqrstuvwxyz" for i in range(keta): ...
N = int(eval(input())) for i in range(1, 100): if N <= 26**i: ans = "" N -= 1 for j in range(i): ans += chr(ord("a") + N % 26) N //= 26 break else: N -= 26**i print((ans[::-1]))
false
52.941176
[ "-import sys", "-", "-input = sys.stdin.readline", "-from collections import *", "-", "-l = [0, 26]", "-for i in range(30):", "- l.append(l[-1] * 26)", "-for i in range(len(l)):", "- if N - l[i] > 0:", "- N -= l[i]", "+for i in range(1, 100):", "+ if N <= 26**i:", "+ ...
false
0.046919
0.037892
1.238238
[ "s159826418", "s699779553" ]
u729133443
p04020
python
s200868367
s317783673
527
243
44,776
3,828
Accepted
Accepted
53.89
t=c=0 for _ in[0]*int(eval(input())):i=int(eval(input()));c+=(i+t)//2;t=(i+t)%2&(i>0) print(c)
s=t=0 for _ in[0]*int(eval(input())):a=int(eval(input()));s+=(a+t)//2;t=(a+t)%2&(a>0) print(s)
3
3
84
84
t = c = 0 for _ in [0] * int(eval(input())): i = int(eval(input())) c += (i + t) // 2 t = (i + t) % 2 & (i > 0) print(c)
s = t = 0 for _ in [0] * int(eval(input())): a = int(eval(input())) s += (a + t) // 2 t = (a + t) % 2 & (a > 0) print(s)
false
0
[ "-t = c = 0", "+s = t = 0", "- i = int(eval(input()))", "- c += (i + t) // 2", "- t = (i + t) % 2 & (i > 0)", "-print(c)", "+ a = int(eval(input()))", "+ s += (a + t) // 2", "+ t = (a + t) % 2 & (a > 0)", "+print(s)" ]
false
0.036571
0.038822
0.94201
[ "s200868367", "s317783673" ]
u714878632
p03733
python
s527719164
s106794223
185
156
25,196
25,196
Accepted
Accepted
15.68
N,T = [int(i) for i in input().split()] ts = [int(i) for i in input().split()] ret = 0 ind = 1 while ind < len(ts): ret += min(T,ts[ind]-ts[ind-1]) ind += 1 print((ret+T))
N,T = [int(i) for i in input().split()] ts = [int(i) for i in input().split()] ret = 0 for ind in range (1, N): ret += min(T,ts[ind]-ts[ind-1]) print((ret+T))
8
6
185
166
N, T = [int(i) for i in input().split()] ts = [int(i) for i in input().split()] ret = 0 ind = 1 while ind < len(ts): ret += min(T, ts[ind] - ts[ind - 1]) ind += 1 print((ret + T))
N, T = [int(i) for i in input().split()] ts = [int(i) for i in input().split()] ret = 0 for ind in range(1, N): ret += min(T, ts[ind] - ts[ind - 1]) print((ret + T))
false
25
[ "-ind = 1", "-while ind < len(ts):", "+for ind in range(1, N):", "- ind += 1" ]
false
0.039817
0.101103
0.393823
[ "s527719164", "s106794223" ]
u736443076
p02779
python
s464406804
s196126340
85
66
25,172
31,156
Accepted
Accepted
22.35
n=int(eval(input())) a=list(map(int,input().split())) if len(a)==len(set(a)): print('YES') else: print('NO')
def solve(): N = int(eval(input())) A = set(input().split()) a = len(A) if a == N: print("YES") elif a != N: print("NO") if __name__ == '__main__': solve()
6
13
112
209
n = int(eval(input())) a = list(map(int, input().split())) if len(a) == len(set(a)): print("YES") else: print("NO")
def solve(): N = int(eval(input())) A = set(input().split()) a = len(A) if a == N: print("YES") elif a != N: print("NO") if __name__ == "__main__": solve()
false
53.846154
[ "-n = int(eval(input()))", "-a = list(map(int, input().split()))", "-if len(a) == len(set(a)):", "- print(\"YES\")", "-else:", "- print(\"NO\")", "+def solve():", "+ N = int(eval(input()))", "+ A = set(input().split())", "+ a = len(A)", "+ if a == N:", "+ print(\"YES\"...
false
0.041473
0.036786
1.127403
[ "s464406804", "s196126340" ]
u019685451
p02556
python
s220760781
s049470251
352
322
127,280
126,788
Accepted
Accepted
8.52
N = int(eval(input())) xs, ys = [], [] for _ in range(N): x, y = list(map(int, input().split())) xs.append(x) ys.append(y) A = [x + y for x, y in zip(xs, ys)] B = [x - y for x, y in zip(xs, ys)] ans = max([max(A) - min(A), max(B) - min(B)]) print(ans)
N = int(eval(input())) xs, ys = [], [] for _ in range(N): x, y = list(map(int, input().split())) xs.append(x) ys.append(y) U = [x + y for x, y in zip(xs, ys)] V = [x - y for x, y in zip(xs, ys)] ans = max([max(U) - min(U), max(V) - min(V)]) print(ans)
10
10
260
260
N = int(eval(input())) xs, ys = [], [] for _ in range(N): x, y = list(map(int, input().split())) xs.append(x) ys.append(y) A = [x + y for x, y in zip(xs, ys)] B = [x - y for x, y in zip(xs, ys)] ans = max([max(A) - min(A), max(B) - min(B)]) print(ans)
N = int(eval(input())) xs, ys = [], [] for _ in range(N): x, y = list(map(int, input().split())) xs.append(x) ys.append(y) U = [x + y for x, y in zip(xs, ys)] V = [x - y for x, y in zip(xs, ys)] ans = max([max(U) - min(U), max(V) - min(V)]) print(ans)
false
0
[ "-A = [x + y for x, y in zip(xs, ys)]", "-B = [x - y for x, y in zip(xs, ys)]", "-ans = max([max(A) - min(A), max(B) - min(B)])", "+U = [x + y for x, y in zip(xs, ys)]", "+V = [x - y for x, y in zip(xs, ys)]", "+ans = max([max(U) - min(U), max(V) - min(V)])" ]
false
0.04802
0.041333
1.161773
[ "s220760781", "s049470251" ]
u360980679
p03838
python
s361683578
s957327973
148
17
12,396
3,064
Accepted
Accepted
88.51
import numpy as np if __name__ == '__main__': x, y = list(map(int, input().split())) res = 1000000000000 ax, ay = (abs(x), abs(y)) if x <= y: res = min(res, y-x) if x * y <= 0: res = min(res, abs(ax-ay)+1) else: res = min(res, abs(ax-ay)+2) print(res)
x,y = [int(it) for it in input().split()] s = 1000000001 ds = y-x if (ds>=0): s = min(s,ds) ds = y+x if (ds>=0): s = min(s,1+ds) ds = -y-x if (ds>=0): s = min(s,1+ds) ds = -y+x if (ds>=0): s = min(s,2+ds) print (s)
14
18
313
245
import numpy as np if __name__ == "__main__": x, y = list(map(int, input().split())) res = 1000000000000 ax, ay = (abs(x), abs(y)) if x <= y: res = min(res, y - x) if x * y <= 0: res = min(res, abs(ax - ay) + 1) else: res = min(res, abs(ax - ay) + 2) print(res)
x, y = [int(it) for it in input().split()] s = 1000000001 ds = y - x if ds >= 0: s = min(s, ds) ds = y + x if ds >= 0: s = min(s, 1 + ds) ds = -y - x if ds >= 0: s = min(s, 1 + ds) ds = -y + x if ds >= 0: s = min(s, 2 + ds) print(s)
false
22.222222
[ "-import numpy as np", "-", "-if __name__ == \"__main__\":", "- x, y = list(map(int, input().split()))", "- res = 1000000000000", "- ax, ay = (abs(x), abs(y))", "- if x <= y:", "- res = min(res, y - x)", "- if x * y <= 0:", "- res = min(res, abs(ax - ay) + 1)", "- ...
false
0.041613
0.059842
0.695383
[ "s361683578", "s957327973" ]
u477062848
p02719
python
s109496631
s863674978
19
17
2,940
2,940
Accepted
Accepted
10.53
N,K=list(map(int,input().split())) m=N%K a=abs(m-K) print((a if m>a else m))
N,K=list(map(int,input().split())) m=N%K print((min(abs(m-K),m)))
4
3
72
59
N, K = list(map(int, input().split())) m = N % K a = abs(m - K) print((a if m > a else m))
N, K = list(map(int, input().split())) m = N % K print((min(abs(m - K), m)))
false
25
[ "-a = abs(m - K)", "-print((a if m > a else m))", "+print((min(abs(m - K), m)))" ]
false
0.073872
0.077569
0.952333
[ "s109496631", "s863674978" ]
u373047809
p03393
python
s547069598
s452107651
27
24
3,772
3,772
Accepted
Accepted
11.11
from string import*;from itertools import*;b=ascii_lowercase;s=r=eval(input());t=s[::-1];d=0 if len(s)>25:d=-[p*len(list(k))for p,k in groupby([i<j for i,j in zip(t,t[1:])])][0]-2;u=s*2;s,b,r=s[:d],s[d+1:],b[:ord(u[d])-97] print((-(d<-26)or s+sorted(set(b)-set(r))[0]))
from string import*;from itertools import*;b=ascii_lowercase;s=r=eval(input());t=s[::-1];d=0 if len(s)>25:d=-[p*len(list(k))for p,k in groupby([i<j for i,j in zip(t,t[1:])])][0]-2;s,b,r=s[:d],s[d+1:],b[:ord((s*2)[d])-97] print((-(d<-26)or s+sorted(set(b)-set(r))[0]))
3
3
263
261
from string import * from itertools import * b = ascii_lowercase s = r = eval(input()) t = s[::-1] d = 0 if len(s) > 25: d = ( -[p * len(list(k)) for p, k in groupby([i < j for i, j in zip(t, t[1:])])][0] - 2 ) u = s * 2 s, b, r = s[:d], s[d + 1 :], b[: ord(u[d]) - 97] print((-(d < -26)...
from string import * from itertools import * b = ascii_lowercase s = r = eval(input()) t = s[::-1] d = 0 if len(s) > 25: d = ( -[p * len(list(k)) for p, k in groupby([i < j for i, j in zip(t, t[1:])])][0] - 2 ) s, b, r = s[:d], s[d + 1 :], b[: ord((s * 2)[d]) - 97] print((-(d < -26) or s + ...
false
0
[ "- u = s * 2", "- s, b, r = s[:d], s[d + 1 :], b[: ord(u[d]) - 97]", "+ s, b, r = s[:d], s[d + 1 :], b[: ord((s * 2)[d]) - 97]" ]
false
0.047811
0.04747
1.0072
[ "s547069598", "s452107651" ]
u281303342
p03145
python
s936812662
s417982178
19
17
3,316
2,940
Accepted
Accepted
10.53
X = list(map(int,input().split())) X.sort() print((X[0]*X[1]//2))
AB,BC,CA = list(map(int,input().split())) print((AB*BC//2))
3
2
66
52
X = list(map(int, input().split())) X.sort() print((X[0] * X[1] // 2))
AB, BC, CA = list(map(int, input().split())) print((AB * BC // 2))
false
33.333333
[ "-X = list(map(int, input().split()))", "-X.sort()", "-print((X[0] * X[1] // 2))", "+AB, BC, CA = list(map(int, input().split()))", "+print((AB * BC // 2))" ]
false
0.041014
0.041306
0.992919
[ "s936812662", "s417982178" ]
u057109575
p03476
python
s872910154
s982707324
1,021
709
54,148
71,640
Accepted
Accepted
30.56
from itertools import accumulate Q = int(eval(input())) def sieve(n): if n == 0: return [False] is_prime = [True] * (n + 1) is_prime[0] = False is_prime[1] = False for i in range(2, n + 1): for j in range(2 * i, n + 1, i): is_prime[j] = False ...
Q = int(eval(input())) X = [list(map(int, input().split())) for _ in range(Q)] n = 10 ** 5 + 2 is_prime = [True] * (n + 1) is_prime[0] = False is_prime[1] = False for i in range(2, n + 1): if not is_prime[i]: continue for j in range(2 * i, n + 1, i): is_prime[j] = False like =...
28
25
622
550
from itertools import accumulate Q = int(eval(input())) def sieve(n): if n == 0: return [False] is_prime = [True] * (n + 1) is_prime[0] = False is_prime[1] = False for i in range(2, n + 1): for j in range(2 * i, n + 1, i): is_prime[j] = False return is_prime MAX ...
Q = int(eval(input())) X = [list(map(int, input().split())) for _ in range(Q)] n = 10**5 + 2 is_prime = [True] * (n + 1) is_prime[0] = False is_prime[1] = False for i in range(2, n + 1): if not is_prime[i]: continue for j in range(2 * i, n + 1, i): is_prime[j] = False like = [False] * (n + 1) fo...
false
10.714286
[ "-from itertools import accumulate", "-", "-", "-", "-def sieve(n):", "- if n == 0:", "- return [False]", "- is_prime = [True] * (n + 1)", "- is_prime[0] = False", "- is_prime[1] = False", "- for i in range(2, n + 1):", "- for j in range(2 * i, n + 1, i):", "- ...
false
0.271242
0.185086
1.465495
[ "s872910154", "s982707324" ]
u588341295
p03298
python
s921723994
s918392932
1,560
1,356
177,652
174,460
Accepted
Accepted
13.08
# -*- coding: utf-8 -*- import sys from collections import Counter def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] * d for j in range...
# -*- coding: utf-8 -*- import sys from collections import Counter def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] * d for j in range...
50
50
1,369
1,313
# -*- coding: utf-8 -*- import sys from collections import Counter def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] * d ...
# -*- coding: utf-8 -*- import sys from collections import Counter def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] * d ...
false
0
[ "-S1 = list(S[:N])", "+S1 = S[:N]", "-S2 = list(S[N:])[::-1]", "+S2 = S[N:][::-1]", "- s1_1, s1_2 = [], []", "- s2_1, s2_2 = [], []", "+ s1_1, s1_2 = \"\", \"\"", "+ s2_1, s2_2 = \"\", \"\"", "- s1_1 += [S1[j]]", "- s2_1 += [S2[j]]", "+ s1_1 += S1[j]"...
false
0.036985
0.037493
0.986453
[ "s921723994", "s918392932" ]
u977389981
p03494
python
s314235423
s885716449
20
18
3,060
3,060
Accepted
Accepted
10
n = int(eval(input())) A = [int(i) for i in input().split()] cnt = 0 flag = 1 while flag: for i in range(n): a = A.pop(0) if a % 2 != 0: flag = 0 break else: A.append(a // 2) else: cnt += 1 print(cnt)
n = int(eval(input())) A = [int(i) for i in input().split()] cnt = 0 flag = 1 while flag: for i in range(n): a = A[i] if a % 2 != 0: flag = 0 break else: A[i] = a // 2 else: cnt += 1 print(cnt)
17
17
292
285
n = int(eval(input())) A = [int(i) for i in input().split()] cnt = 0 flag = 1 while flag: for i in range(n): a = A.pop(0) if a % 2 != 0: flag = 0 break else: A.append(a // 2) else: cnt += 1 print(cnt)
n = int(eval(input())) A = [int(i) for i in input().split()] cnt = 0 flag = 1 while flag: for i in range(n): a = A[i] if a % 2 != 0: flag = 0 break else: A[i] = a // 2 else: cnt += 1 print(cnt)
false
0
[ "- a = A.pop(0)", "+ a = A[i]", "- A.append(a // 2)", "+ A[i] = a // 2" ]
false
0.040849
0.097707
0.418078
[ "s314235423", "s885716449" ]
u535803878
p03450
python
s949178420
s372032139
661
498
138,968
134,944
Accepted
Accepted
24.66
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x+"\n") from collections import defaultdict n,m = list(map(int, input().split())) ns = defaultdict(set) for _ in range(m): u,v,c = list(map(int, input().split())) u -...
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x+"\n") from collections import defaultdict n,m = list(map(int, input().split())) ns = defaultdict(set) for _ in range(m): u,v,c = list(map(int, input().split())) u -...
41
40
979
916
import sys input = lambda: sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x + "\n") from collections import defaultdict n, m = list(map(int, input().split())) ns = defaultdict(set) for _ in range(m): u, v, c = list(map(int, input().split())) u -= 1 ...
import sys input = lambda: sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x + "\n") from collections import defaultdict n, m = list(map(int, input().split())) ns = defaultdict(set) for _ in range(m): u, v, c = list(map(int, input().split())) u -= 1 ...
false
2.439024
[ "- import heapq", "-", "- h = [(0, start)] # (距離, ノード番号)", "+ h = [start]", "- val, u = heapq.heappop(h)", "+ u = h.pop()", "- vals[v] = val + d", "- heapq.heappush(h, (vals[v], v))", "+ vals[v] = vals[u] + d", "+ ...
false
0.084234
0.048399
1.740405
[ "s949178420", "s372032139" ]
u166621202
p03370
python
s673006737
s904185757
38
17
2,940
3,060
Accepted
Accepted
55.26
N,X = list(map(int,input().split())) M = [int(eval(input())) for i in range(N)] X -= sum(M) M.sort() ans = -1 while X >= 0: X -= M[0] ans += 1 print((ans+N))
N, X = list(map(int,input().split())) m = [] cnt = 0 for j in range(N): m.append(int(eval(input()))) a = X - sum(m) cnt = a // min(m) + N print(cnt)
9
8
156
145
N, X = list(map(int, input().split())) M = [int(eval(input())) for i in range(N)] X -= sum(M) M.sort() ans = -1 while X >= 0: X -= M[0] ans += 1 print((ans + N))
N, X = list(map(int, input().split())) m = [] cnt = 0 for j in range(N): m.append(int(eval(input()))) a = X - sum(m) cnt = a // min(m) + N print(cnt)
false
11.111111
[ "-M = [int(eval(input())) for i in range(N)]", "-X -= sum(M)", "-M.sort()", "-ans = -1", "-while X >= 0:", "- X -= M[0]", "- ans += 1", "-print((ans + N))", "+m = []", "+cnt = 0", "+for j in range(N):", "+ m.append(int(eval(input())))", "+a = X - sum(m)", "+cnt = a // min(m) + N",...
false
0.03796
0.034751
1.092343
[ "s673006737", "s904185757" ]
u367130284
p03767
python
s178847051
s199808255
233
204
36,164
36,164
Accepted
Accepted
12.45
n,*a=list(map(int,open(0).read().split()));print((sum(v for k,v in enumerate(sorted(a)[n:])if k%2<1)))
n,*a=list(map(int,open(0).read().split()));print((sum(sorted(a)[n:][::2])))
1
1
94
67
n, *a = list(map(int, open(0).read().split())) print((sum(v for k, v in enumerate(sorted(a)[n:]) if k % 2 < 1)))
n, *a = list(map(int, open(0).read().split())) print((sum(sorted(a)[n:][::2])))
false
0
[ "-print((sum(v for k, v in enumerate(sorted(a)[n:]) if k % 2 < 1)))", "+print((sum(sorted(a)[n:][::2])))" ]
false
0.054748
0.039131
1.399092
[ "s178847051", "s199808255" ]
u525065967
p02548
python
s165038371
s443557028
112
29
16,788
9,280
Accepted
Accepted
74.11
n = int(eval(input())) print((sum([(n-1)//a for a in range(1, n)])))
n = int(eval(input())) - 1 # n=n-1 print((sum([(n//x - x)*2 + 1 for x in range(1, int(n**0.5) + 1)])))
2
2
62
96
n = int(eval(input())) print((sum([(n - 1) // a for a in range(1, n)])))
n = int(eval(input())) - 1 # n=n-1 print((sum([(n // x - x) * 2 + 1 for x in range(1, int(n**0.5) + 1)])))
false
0
[ "-n = int(eval(input()))", "-print((sum([(n - 1) // a for a in range(1, n)])))", "+n = int(eval(input())) - 1 # n=n-1", "+print((sum([(n // x - x) * 2 + 1 for x in range(1, int(n**0.5) + 1)])))" ]
false
0.113254
0.036827
3.075336
[ "s165038371", "s443557028" ]
u535803878
p03172
python
s178058618
s466261887
285
231
219,160
150,484
Accepted
Accepted
18.95
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x+"\n") n,k = list(map(int, input().split())) a = list(map(int, input().split())) dp = [[0]*(k+1) for _ in range(n+1)] cum = [1]*(k+2) M = 10**9+7 for i in range(n+1): ...
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x+"\n") n,k = list(map(int, input().split())) a = list(map(int, input().split())) dp = [0]*(k+1) cum = [1]*(k+2) M = 10**9+7 dp[0] = 1 cum[0] = 0 for i in range(1,n+1): ...
23
21
595
506
import sys input = lambda: sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x + "\n") n, k = list(map(int, input().split())) a = list(map(int, input().split())) dp = [[0] * (k + 1) for _ in range(n + 1)] cum = [1] * (k + 2) M = 10**9 + 7 for i in range(n + 1): ...
import sys input = lambda: sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x + "\n") n, k = list(map(int, input().split())) a = list(map(int, input().split())) dp = [0] * (k + 1) cum = [1] * (k + 2) M = 10**9 + 7 dp[0] = 1 cum[0] = 0 for i in range(1, n + 1): ...
false
8.695652
[ "-dp = [[0] * (k + 1) for _ in range(n + 1)]", "+dp = [0] * (k + 1)", "-for i in range(n + 1):", "- dp[i][0] = 1", "+dp[0] = 1", "- # print(i,j,k,a[i])", "- dp[i][j] = (cum[j + 1] - cum[max(0, j - min(k, a[i - 1]))]) % M", "- current[j + 1] = (current[j] + dp[i][j]) % M...
false
0.807036
1.068024
0.755635
[ "s178058618", "s466261887" ]
u211160392
p03835
python
s586556153
s712427476
1,682
259
2,940
42,092
Accepted
Accepted
84.6
K,S = list(map(int,input().split())) ans = 0 for x in range(K+1): for y in range(K+1): if x+y<=S and x+y+K >= S: ans += 1 print(ans)
K, S = list(map(int,input().split())) ans = 0 for i in range(K+1): for j in range(K+1): if S-K <= i+j <= S: ans += 1 print(ans)
7
7
156
151
K, S = list(map(int, input().split())) ans = 0 for x in range(K + 1): for y in range(K + 1): if x + y <= S and x + y + K >= S: ans += 1 print(ans)
K, S = list(map(int, input().split())) ans = 0 for i in range(K + 1): for j in range(K + 1): if S - K <= i + j <= S: ans += 1 print(ans)
false
0
[ "-for x in range(K + 1):", "- for y in range(K + 1):", "- if x + y <= S and x + y + K >= S:", "+for i in range(K + 1):", "+ for j in range(K + 1):", "+ if S - K <= i + j <= S:" ]
false
0.042353
0.101535
0.417132
[ "s586556153", "s712427476" ]
u189806337
p03624
python
s483996483
s384601598
37
28
9,628
9,088
Accepted
Accepted
24.32
s = list(eval(input())) c = 0 for i in range(97,97 + 26): if chr(i) not in s: print((chr(i))) break c += 1 if c == 26: print('None')
s = eval(input()) for i in range(97,97 + 26): if chr(i) not in s: print((chr(i))) exit() print('None')
9
6
141
105
s = list(eval(input())) c = 0 for i in range(97, 97 + 26): if chr(i) not in s: print((chr(i))) break c += 1 if c == 26: print("None")
s = eval(input()) for i in range(97, 97 + 26): if chr(i) not in s: print((chr(i))) exit() print("None")
false
33.333333
[ "-s = list(eval(input()))", "-c = 0", "+s = eval(input())", "- break", "- c += 1", "-if c == 26:", "- print(\"None\")", "+ exit()", "+print(\"None\")" ]
false
0.038442
0.074952
0.51289
[ "s483996483", "s384601598" ]
u780962115
p02792
python
s310564411
s549478660
217
191
44,380
3,060
Accepted
Accepted
11.98
n=int(eval(input())) lists=[[ [] for j in range(10)]for i in range(10)] for i in range(1,n+1): a=str(i) lists[int(str(a[0]))][int(str(a[-1]))].append(i) c=0 for i in range(1,10): for j in range(1,10): c+=len(lists[i][j])*len(lists[j][i]) print(c)
n=int(eval(input())) lists=[[ 0 for j in range(10)]for i in range(10)] for i in range(1,n+1): a=str(i) lists[int(a[0])][int(a[-1])]+=1 c=0 for i in range(1,10): for j in range(1,10): c+=lists[i][j]*lists[j][i] print(c)
10
12
278
261
n = int(eval(input())) lists = [[[] for j in range(10)] for i in range(10)] for i in range(1, n + 1): a = str(i) lists[int(str(a[0]))][int(str(a[-1]))].append(i) c = 0 for i in range(1, 10): for j in range(1, 10): c += len(lists[i][j]) * len(lists[j][i]) print(c)
n = int(eval(input())) lists = [[0 for j in range(10)] for i in range(10)] for i in range(1, n + 1): a = str(i) lists[int(a[0])][int(a[-1])] += 1 c = 0 for i in range(1, 10): for j in range(1, 10): c += lists[i][j] * lists[j][i] print(c)
false
16.666667
[ "-lists = [[[] for j in range(10)] for i in range(10)]", "+lists = [[0 for j in range(10)] for i in range(10)]", "- lists[int(str(a[0]))][int(str(a[-1]))].append(i)", "+ lists[int(a[0])][int(a[-1])] += 1", "- c += len(lists[i][j]) * len(lists[j][i])", "+ c += lists[i][j] * lists[j][i]"...
false
0.07411
0.048717
1.521239
[ "s310564411", "s549478660" ]
u562016607
p03286
python
s943722433
s854491821
20
17
2,940
2,940
Accepted
Accepted
15
def m(K):return "1" if K==1 else "0" if K==0 else m(-(K-K%2)//2)+str(K%2) print((m(int(eval(input())))))
def m(K):return str(K) if K*K==K else m(-(K-K%2)//2)+str(K%2) print((m(int(eval(input())))))
2
2
98
85
def m(K): return "1" if K == 1 else "0" if K == 0 else m(-(K - K % 2) // 2) + str(K % 2) print((m(int(eval(input())))))
def m(K): return str(K) if K * K == K else m(-(K - K % 2) // 2) + str(K % 2) print((m(int(eval(input())))))
false
0
[ "- return \"1\" if K == 1 else \"0\" if K == 0 else m(-(K - K % 2) // 2) + str(K % 2)", "+ return str(K) if K * K == K else m(-(K - K % 2) // 2) + str(K % 2)" ]
false
0.058231
0.058995
0.987061
[ "s943722433", "s854491821" ]
u197300260
p03944
python
s356806526
s359085394
219
27
27,004
9,288
Accepted
Accepted
87.67
# Problem: https://atcoder.jp/contests/abc047/tasks/abc047_b # Python 1st Try import sys import numpy # import pprint # from collections import defaultdict # import heapq,copy # from collections import deque def II(): return int(sys.stdin.readline()) def MI(): return list(map(int, sys.stdin.readline().split(...
# Problem: https://atcoder.jp/contests/abc047/tasks/abc047_b # Python 2nd Try import sys # from collections import defaultdict # import heapq,copy # from collections import deque def II(): return int(sys.stdin.readline()) def MI(): return list(map(int, sys.stdin.readline().split())) def LI(): return list(map(...
58
50
2,044
1,579
# Problem: https://atcoder.jp/contests/abc047/tasks/abc047_b # Python 1st Try import sys import numpy # import pprint # from collections import defaultdict # import heapq,copy # from collections import deque def II(): return int(sys.stdin.readline()) def MI(): return list(map(int, sys.stdin.readline().split(...
# Problem: https://atcoder.jp/contests/abc047/tasks/abc047_b # Python 2nd Try import sys # from collections import defaultdict # import heapq,copy # from collections import deque def II(): return int(sys.stdin.readline()) def MI(): return list(map(int, sys.stdin.readline().split())) def LI(): return li...
false
13.793103
[ "-# Python 1st Try", "+# Python 2nd Try", "-import numpy", "-# import pprint", "-def solver(Width, Height, Point, x_position, y_position, control_id):", "+def solver(Width, Height, op_count, x_list, y_list, op_list):", "- # surface = [[0] * (Width+1) for _ in range(0, Height+1, +1)]", "- surface...
false
0.463063
0.067153
6.895637
[ "s356806526", "s359085394" ]
u669819350
p02900
python
s202163931
s959039999
194
129
5,348
5,304
Accepted
Accepted
33.51
import math import fractions gcd = math.gcd if hasattr(math, "gcd") else fractions.gcd A, B = list(map(int, input().split())) def factorize(n): b = 2 fct = [] while b * b <= n: while n % b == 0: n //= b fct.append(b) b = b + 1 if n > 1: fc...
import math from fractions import gcd def factorization(n): arr = [] tmp = n for div in range(2, int(math.sqrt(n)) + 2): if tmp % div == 0: cnt = 0 while tmp % div == 0: cnt += 1 tmp //= div arr.append([div, cnt]) ...
21
30
394
629
import math import fractions gcd = math.gcd if hasattr(math, "gcd") else fractions.gcd A, B = list(map(int, input().split())) def factorize(n): b = 2 fct = [] while b * b <= n: while n % b == 0: n //= b fct.append(b) b = b + 1 if n > 1: fct.append(n) ...
import math from fractions import gcd def factorization(n): arr = [] tmp = n for div in range(2, int(math.sqrt(n)) + 2): if tmp % div == 0: cnt = 0 while tmp % div == 0: cnt += 1 tmp //= div arr.append([div, cnt]) if tmp != 1:...
false
30
[ "-import fractions", "-", "-gcd = math.gcd if hasattr(math, \"gcd\") else fractions.gcd", "-A, B = list(map(int, input().split()))", "+from fractions import gcd", "-def factorize(n):", "- b = 2", "- fct = []", "- while b * b <= n:", "- while n % b == 0:", "- n //= b", ...
false
0.042979
0.069085
0.62211
[ "s202163931", "s959039999" ]