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
u573754721
p02833
python
s047621871
s324197148
188
166
38,384
38,384
Accepted
Accepted
11.7
n=int(eval(input())) if n%2: print((0)) exit() n//=2 ans=0 i=1 while n>=(5**i): ans+=n//(5**i) i+=1 print(ans)
n=int(eval(input())) if n%2: print((0)) exit() else: n//=2 ans=0 while n>=5: ans+=n//5 n=n//5 print(ans)
13
13
131
143
n = int(eval(input())) if n % 2: print((0)) exit() n //= 2 ans = 0 i = 1 while n >= (5**i): ans += n // (5**i) i += 1 print(ans)
n = int(eval(input())) if n % 2: print((0)) exit() else: n //= 2 ans = 0 while n >= 5: ans += n // 5 n = n // 5 print(ans)
false
0
[ "-n //= 2", "-ans = 0", "-i = 1", "-while n >= (5**i):", "- ans += n // (5**i)", "- i += 1", "+else:", "+ n //= 2", "+ ans = 0", "+ while n >= 5:", "+ ans += n // 5", "+ n = n // 5" ]
false
0.048213
0.04764
1.01204
[ "s047621871", "s324197148" ]
u823885866
p03288
python
s005379935
s540291382
29
25
9,160
9,068
Accepted
Accepted
13.79
import sys ri = lambda: int(sys.stdin.readline()) a = ri() if a < 1200: print('ABC') elif a < 2800: print('ARC') else: print('AGC')
import sys ri = lambda: int(sys.stdin.readline()) a = ri() if a < 1200: print('ABC') else: print(('ARC' if a < 2800 else 'AGC'))
9
8
145
138
import sys ri = lambda: int(sys.stdin.readline()) a = ri() if a < 1200: print("ABC") elif a < 2800: print("ARC") else: print("AGC")
import sys ri = lambda: int(sys.stdin.readline()) a = ri() if a < 1200: print("ABC") else: print(("ARC" if a < 2800 else "AGC"))
false
11.111111
[ "-elif a < 2800:", "- print(\"ARC\")", "- print(\"AGC\")", "+ print((\"ARC\" if a < 2800 else \"AGC\"))" ]
false
0.04047
0.041685
0.970847
[ "s005379935", "s540291382" ]
u307622233
p02660
python
s774788232
s316174926
1,157
152
15,520
9,468
Accepted
Accepted
86.86
from collections import defaultdict import decimal import sys input = sys.stdin.readline def prime_factor_count(n): def count(n, i): cnt = 0 while n % i == 0: cnt += 1 n //= i return n, cnt d = {} if n == 1: return d n, cnt = ...
import sys input = sys.stdin.readline def prime_factor_count(n): def count(n, p): cnt = 0 while n % p == 0: n //= p cnt += 1 np_cnt = 1 while (cnt := cnt - np_cnt) >= 0: np_cnt += 1 return n, np_cnt - 1 n, cnt = count(...
65
39
1,322
688
from collections import defaultdict import decimal import sys input = sys.stdin.readline def prime_factor_count(n): def count(n, i): cnt = 0 while n % i == 0: cnt += 1 n //= i return n, cnt d = {} if n == 1: return d n, cnt = count(n, 2) d[...
import sys input = sys.stdin.readline def prime_factor_count(n): def count(n, p): cnt = 0 while n % p == 0: n //= p cnt += 1 np_cnt = 1 while (cnt := cnt - np_cnt) >= 0: np_cnt += 1 return n, np_cnt - 1 n, cnt = count(n, 2) if n...
false
40
[ "-from collections import defaultdict", "-import decimal", "- def count(n, i):", "+ def count(n, p):", "- while n % i == 0:", "+ while n % p == 0:", "+ n //= p", "- n //= i", "- return n, cnt", "+ np_cnt = 1", "+ while (cnt := cnt - ...
false
0.300119
0.043511
6.897509
[ "s774788232", "s316174926" ]
u212831449
p03945
python
s689291252
s850999727
56
44
3,956
3,956
Accepted
Accepted
21.43
s = list(eval(input())) if len(set(s)) == 1: print((0)) exit() ans = 0 tmp = s[0] state = False for i in range(1,len(s)): if tmp == "B" and s[i] == "W": state = True elif tmp == "B" and s[i] == "B": if state: ans += 2 state = False tm...
s = list(eval(input())) ans = 0 tmp = s[0] for i in range(1,len(s)): if tmp != s[i]: tmp = s[i] ans += 1 print(ans)
30
15
550
151
s = list(eval(input())) if len(set(s)) == 1: print((0)) exit() ans = 0 tmp = s[0] state = False for i in range(1, len(s)): if tmp == "B" and s[i] == "W": state = True elif tmp == "B" and s[i] == "B": if state: ans += 2 state = False tmp = "B" if tm...
s = list(eval(input())) ans = 0 tmp = s[0] for i in range(1, len(s)): if tmp != s[i]: tmp = s[i] ans += 1 print(ans)
false
50
[ "-if len(set(s)) == 1:", "- print((0))", "- exit()", "-state = False", "- if tmp == \"B\" and s[i] == \"W\":", "- state = True", "- elif tmp == \"B\" and s[i] == \"B\":", "- if state:", "- ans += 2", "- state = False", "- tmp = \"B\"", ...
false
0.069762
0.036563
1.907988
[ "s689291252", "s850999727" ]
u644907318
p02984
python
s460242356
s916243099
276
115
70,884
89,076
Accepted
Accepted
58.33
N = int(eval(input())) A = list(map(int,input().split())) a = A[0] for i in range(1,N): if i%2==0: a += A[i] else: a -= A[i] X = [0 for _ in range(N)] X[0] = a//2 for i in range(1,N): X[i] = A[i-1]-X[i-1] X = [2*X[i] for i in range(N)] print((*X))
N = int(eval(input())) A = list(map(int,input().split())) A.insert(0,0) X = [0 for _ in range(N+1)] x = A[1]-A[2] for i in range(3,N+1): if i%2==0: x -= A[i] else: x += A[i] X[1] = x//2 for i in range(2,N+1): X[i] = A[i-1]-X[i-1] for i in range(1,N+1): X[i] = 2*X[i] print(...
14
16
280
321
N = int(eval(input())) A = list(map(int, input().split())) a = A[0] for i in range(1, N): if i % 2 == 0: a += A[i] else: a -= A[i] X = [0 for _ in range(N)] X[0] = a // 2 for i in range(1, N): X[i] = A[i - 1] - X[i - 1] X = [2 * X[i] for i in range(N)] print((*X))
N = int(eval(input())) A = list(map(int, input().split())) A.insert(0, 0) X = [0 for _ in range(N + 1)] x = A[1] - A[2] for i in range(3, N + 1): if i % 2 == 0: x -= A[i] else: x += A[i] X[1] = x // 2 for i in range(2, N + 1): X[i] = A[i - 1] - X[i - 1] for i in range(1, N + 1): X[i] = 2...
false
12.5
[ "-a = A[0]", "-for i in range(1, N):", "+A.insert(0, 0)", "+X = [0 for _ in range(N + 1)]", "+x = A[1] - A[2]", "+for i in range(3, N + 1):", "- a += A[i]", "+ x -= A[i]", "- a -= A[i]", "-X = [0 for _ in range(N)]", "-X[0] = a // 2", "-for i in range(1, N):", "+ ...
false
0.039657
0.039877
0.994493
[ "s460242356", "s916243099" ]
u145950990
p03680
python
s454820673
s569515860
513
195
49,240
7,852
Accepted
Accepted
61.99
n = int(eval(input())) a = [int(eval(input())) for _ in range(n)] i = a[0] cnt = 1 while cnt<=n and i!=2: i = a[i-1] cnt += 1 if cnt==n+1:print((-1)) else:print(cnt)
n = int(eval(input())) a = [int(eval(input())) for i in range(n)] used = [False]*n f = True cur = 0 cnt = 0 while f: cnt += 1 cur = a[cur]-1 if cur == 1: break if used[cur]: f = False cnt = -1 else: used[cur] = True print(cnt)
9
17
168
282
n = int(eval(input())) a = [int(eval(input())) for _ in range(n)] i = a[0] cnt = 1 while cnt <= n and i != 2: i = a[i - 1] cnt += 1 if cnt == n + 1: print((-1)) else: print(cnt)
n = int(eval(input())) a = [int(eval(input())) for i in range(n)] used = [False] * n f = True cur = 0 cnt = 0 while f: cnt += 1 cur = a[cur] - 1 if cur == 1: break if used[cur]: f = False cnt = -1 else: used[cur] = True print(cnt)
false
47.058824
[ "-a = [int(eval(input())) for _ in range(n)]", "-i = a[0]", "-cnt = 1", "-while cnt <= n and i != 2:", "- i = a[i - 1]", "+a = [int(eval(input())) for i in range(n)]", "+used = [False] * n", "+f = True", "+cur = 0", "+cnt = 0", "+while f:", "-if cnt == n + 1:", "- print((-1))", "-els...
false
0.040672
0.045591
0.892101
[ "s454820673", "s569515860" ]
u785989355
p02559
python
s501544918
s221027037
1,894
709
70,052
50,520
Accepted
Accepted
62.57
code = """ # distutils: language=c++ # distutils: include_dirs=[/home/contestant/.local/lib/python3.8/site-packages/numpy/core/include, /opt/atcoder-stl] # cython: boundscheck=False # cython: wraparound=False cdef extern from "<atcoder/fenwicktree>" namespace "atcoder" nogil: cdef cppclass fenwick_tre...
code = """ # distutils: language=c++ # distutils: include_dirs=[/home/USERNAME/.local/lib/python3.8/site-packages/numpy/core/include, /opt/atcoder-stl] # cython: boundscheck=False # cython: wraparound=False cdef extern from "<atcoder/fenwicktree>" namespace "atcoder" nogil: cdef cppclass fenwick_tree[...
46
49
1,207
1,328
code = """ # distutils: language=c++ # distutils: include_dirs=[/home/contestant/.local/lib/python3.8/site-packages/numpy/core/include, /opt/atcoder-stl] # cython: boundscheck=False # cython: wraparound=False cdef extern from "<atcoder/fenwicktree>" namespace "atcoder" nogil: cdef cppclass fenwick_tree[T]: ...
code = """ # distutils: language=c++ # distutils: include_dirs=[/home/USERNAME/.local/lib/python3.8/site-packages/numpy/core/include, /opt/atcoder-stl] # cython: boundscheck=False # cython: wraparound=False cdef extern from "<atcoder/fenwicktree>" namespace "atcoder" nogil: cdef cppclass fenwick_tree[T]: fe...
false
6.122449
[ "-# distutils: include_dirs=[/home/contestant/.local/lib/python3.8/site-packages/numpy/core/include, /opt/atcoder-stl]", "+# distutils: include_dirs=[/home/USERNAME/.local/lib/python3.8/site-packages/numpy/core/include, /opt/atcoder-stl]", "-import os, sys", "+import os, sys, getpass", "+ code.replace(\"...
false
0.035074
0.035663
0.983504
[ "s501544918", "s221027037" ]
u779455925
p03862
python
s565279115
s227747705
152
129
14,468
14,252
Accepted
Accepted
15.13
N,x=list(map(int,input().split())) A=list(map(int,input().split())) sumA=[A[i]+A[i+1] for i in range(N-1)] count=0 for i in range(N-1): if A[i]+A[i+1]>x: count+=A[i]+A[i+1]-x A[i+1]-=A[i]+A[i+1]-x if A[i+1]<0: A[i]+=A[i+1] A[i+1]=0 print(count)
N,x=list(map(int,input().split())) A=list(map(int,input().split())) count=0 for i in range(N-1): if A[i]+A[i+1]>x: count+=A[i]+A[i+1]-x A[i+1]-=A[i]+A[i+1]-x if A[i+1]<0: A[i]+=A[i+1] A[i+1]=0 print(count)
14
11
306
262
N, x = list(map(int, input().split())) A = list(map(int, input().split())) sumA = [A[i] + A[i + 1] for i in range(N - 1)] count = 0 for i in range(N - 1): if A[i] + A[i + 1] > x: count += A[i] + A[i + 1] - x A[i + 1] -= A[i] + A[i + 1] - x if A[i + 1] < 0: A[i] += A[i + 1] ...
N, x = list(map(int, input().split())) A = list(map(int, input().split())) count = 0 for i in range(N - 1): if A[i] + A[i + 1] > x: count += A[i] + A[i + 1] - x A[i + 1] -= A[i] + A[i + 1] - x if A[i + 1] < 0: A[i] += A[i + 1] A[i + 1] = 0 print(count)
false
21.428571
[ "-sumA = [A[i] + A[i + 1] for i in range(N - 1)]" ]
false
0.064533
0.035144
1.836277
[ "s565279115", "s227747705" ]
u671060652
p03146
python
s247992154
s297881228
259
64
63,980
61,836
Accepted
Accepted
75.29
import itertools import math import fractions import functools import copy s = int(eval(input())) a = set() index = 0 a.add(s) for i in range(1,1000000): if s % 2 == 0: s = s / 2 else: s = 3*s + 1 if s in a: index = i break a.add(s) print((index+1)...
def main(): s = int(eval(input())) # a, b, c = map(int, input().split()) # h = list(map(int, input().split())) # s = input() amount = [s] i = 1 while True: if s % 2 == 0: s = s // 2 else: s = 3*s + 1 i += 1 if s in amount...
20
22
313
427
import itertools import math import fractions import functools import copy s = int(eval(input())) a = set() index = 0 a.add(s) for i in range(1, 1000000): if s % 2 == 0: s = s / 2 else: s = 3 * s + 1 if s in a: index = i break a.add(s) print((index + 1))
def main(): s = int(eval(input())) # a, b, c = map(int, input().split()) # h = list(map(int, input().split())) # s = input() amount = [s] i = 1 while True: if s % 2 == 0: s = s // 2 else: s = 3 * s + 1 i += 1 if s in amount: ...
false
9.090909
[ "-import itertools", "-import math", "-import fractions", "-import functools", "-import copy", "+def main():", "+ s = int(eval(input()))", "+ # a, b, c = map(int, input().split())", "+ # h = list(map(int, input().split()))", "+ # s = input()", "+ amount = [s]", "+ i = 1", "...
false
0.038747
0.046097
0.840568
[ "s247992154", "s297881228" ]
u076917070
p02937
python
s229452058
s377227929
437
395
8,180
8,184
Accepted
Accepted
9.61
import sys input=sys.stdin.readline import string import bisect def main(): s = input().strip() t = input().strip() if not all(s.find(c) >= 0 for c in t): print((-1)) exit() sa = [[] for _ in string.ascii_lowercase] ai = ord('a') for i,c in enumerate(s): ...
import sys input=sys.stdin.readline import string import bisect def main(): S = input().strip() T = input().strip() if any(S.find(c) < 0 for c in T): print((-1)) return dS = {c:[] for c in string.ascii_lowercase} for i, s in enumerate(S): dS[s].append(i) ...
36
31
790
594
import sys input = sys.stdin.readline import string import bisect def main(): s = input().strip() t = input().strip() if not all(s.find(c) >= 0 for c in t): print((-1)) exit() sa = [[] for _ in string.ascii_lowercase] ai = ord("a") for i, c in enumerate(s): sa[ord(c) -...
import sys input = sys.stdin.readline import string import bisect def main(): S = input().strip() T = input().strip() if any(S.find(c) < 0 for c in T): print((-1)) return dS = {c: [] for c in string.ascii_lowercase} for i, s in enumerate(S): dS[s].append(i) ans = 0 ...
false
13.888889
[ "- s = input().strip()", "- t = input().strip()", "- if not all(s.find(c) >= 0 for c in t):", "+ S = input().strip()", "+ T = input().strip()", "+ if any(S.find(c) < 0 for c in T):", "- exit()", "- sa = [[] for _ in string.ascii_lowercase]", "- ai = ord(\"a\")", "- ...
false
0.056616
0.122083
0.463753
[ "s229452058", "s377227929" ]
u729133443
p03673
python
s214962265
s449643994
336
125
99,044
23,884
Accepted
Accepted
62.8
n,*a=list(map(int,open(0).read().split())) b=a[1::2][::-1]+a[::2] print((*b[::n%2<1or-1]))
n,a=open(0);a=a.split();print((*a[::-2]+a[int(n)%2::2]))
3
1
84
54
n, *a = list(map(int, open(0).read().split())) b = a[1::2][::-1] + a[::2] print((*b[:: n % 2 < 1 or -1]))
n, a = open(0) a = a.split() print((*a[::-2] + a[int(n) % 2 :: 2]))
false
66.666667
[ "-n, *a = list(map(int, open(0).read().split()))", "-b = a[1::2][::-1] + a[::2]", "-print((*b[:: n % 2 < 1 or -1]))", "+n, a = open(0)", "+a = a.split()", "+print((*a[::-2] + a[int(n) % 2 :: 2]))" ]
false
0.085706
0.088188
0.971847
[ "s214962265", "s449643994" ]
u761320129
p03152
python
s632216716
s247963251
871
547
43,692
9,172
Accepted
Accepted
37.2
import bisect N,M = list(map(int,input().split())) A = sorted(list(map(int,input().split()))) B = sorted(list(map(int,input().split()))) sa = set(A) sb = set(B) MOD = 10**9+7 if len(sa) != N or len(sb) != M: print((0)) exit() ans = 1 for n in range(N*M, 0, -1): if n in sa and n in sb: contin...
N,M = list(map(int,input().split())) A = list(map(int,input().split())) B = list(map(int,input().split())) A.sort() B.sort() sa = set(A) sb = set(B) if len(sa)!=N or len(sb)!=M: print((0)) exit() MOD = 10**9+7 ans = 1 w = h = 0 for v in range(N*M,0,-1): if v in sa and v in sb: w += ...
30
34
663
636
import bisect N, M = list(map(int, input().split())) A = sorted(list(map(int, input().split()))) B = sorted(list(map(int, input().split()))) sa = set(A) sb = set(B) MOD = 10**9 + 7 if len(sa) != N or len(sb) != M: print((0)) exit() ans = 1 for n in range(N * M, 0, -1): if n in sa and n in sb: conti...
N, M = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) A.sort() B.sort() sa = set(A) sb = set(B) if len(sa) != N or len(sb) != M: print((0)) exit() MOD = 10**9 + 7 ans = 1 w = h = 0 for v in range(N * M, 0, -1): if v in sa and v in sb: w += 1 ...
false
11.764706
[ "-import bisect", "-", "-A = sorted(list(map(int, input().split())))", "-B = sorted(list(map(int, input().split())))", "+A = list(map(int, input().split()))", "+B = list(map(int, input().split()))", "+A.sort()", "+B.sort()", "-MOD = 10**9 + 7", "+MOD = 10**9 + 7", "-for n in range(N * M, 0, -1):...
false
0.164279
0.0369
4.452008
[ "s632216716", "s247963251" ]
u821624310
p02255
python
s868263445
s929905230
40
30
7,960
8,056
Accepted
Accepted
25
N = int(input()) A = list(map(int, input().split())) for k in range(N): if k == N - 1: print(str(A[k])) else: print(str(A[k]) + " ", end="") for i in range(1, N): v = A[i] j = i - 1 while j >= 0 and A[j] > v: A[j + 1] = A[j] j -= 1 A[j+1] = v ...
N = int(input()) A = [int(A) for A in input().split()] for k in range(N): if k == N -1: print("{}".format(A[k])) else: print("{}".format(A[k]), end = " ") for i in range(1, N): j = i -1 v = A[i] while j >= 0 and A[j] > v: A[j+1] = A[j] j -= 1 A[j+1] =...
22
19
474
471
N = int(input()) A = list(map(int, input().split())) for k in range(N): if k == N - 1: print(str(A[k])) else: print(str(A[k]) + " ", end="") for i in range(1, N): v = A[i] j = i - 1 while j >= 0 and A[j] > v: A[j + 1] = A[j] j -= 1 A[j + 1] = v for k in range(...
N = int(input()) A = [int(A) for A in input().split()] for k in range(N): if k == N - 1: print("{}".format(A[k])) else: print("{}".format(A[k]), end=" ") for i in range(1, N): j = i - 1 v = A[i] while j >= 0 and A[j] > v: A[j + 1] = A[j] j -= 1 A[j + 1] = v fo...
false
13.636364
[ "-A = list(map(int, input().split()))", "+A = [int(A) for A in input().split()]", "- print(str(A[k]))", "+ print(\"{}\".format(A[k]))", "- print(str(A[k]) + \" \", end=\"\")", "+ print(\"{}\".format(A[k]), end=\" \")", "+ j = i - 1", "- j = i - 1", "- pri...
false
0.03714
0.037193
0.998585
[ "s868263445", "s929905230" ]
u426534722
p02265
python
s492123735
s519753224
4,890
2,170
45,944
45,944
Accepted
Accepted
55.62
from collections import deque dq = deque() for _ in range(int(eval(input()))): ss = eval(input()) if ss == "deleteFirst": del dq[0] elif ss == "deleteLast": del dq[-1] else: c, s = ss.split() s = int(s) if c == "insert": dq.appendleft(s) ...
import sys from collections import deque readline = sys.stdin.readline dq = deque() for _ in range(int(eval(input()))): ss = readline().strip() if ss == "deleteFirst": del dq[0] elif ss == "deleteLast": del dq[-1] else: c, s = ss.split() s = int(s) if...
18
20
404
458
from collections import deque dq = deque() for _ in range(int(eval(input()))): ss = eval(input()) if ss == "deleteFirst": del dq[0] elif ss == "deleteLast": del dq[-1] else: c, s = ss.split() s = int(s) if c == "insert": dq.appendleft(s) elif ...
import sys from collections import deque readline = sys.stdin.readline dq = deque() for _ in range(int(eval(input()))): ss = readline().strip() if ss == "deleteFirst": del dq[0] elif ss == "deleteLast": del dq[-1] else: c, s = ss.split() s = int(s) if c == "inser...
false
10
[ "+import sys", "+readline = sys.stdin.readline", "- ss = eval(input())", "+ ss = readline().strip()" ]
false
0.040791
0.041613
0.98024
[ "s492123735", "s519753224" ]
u983918956
p03837
python
s897907013
s100308117
1,628
264
3,436
3,436
Accepted
Accepted
83.78
import sys input = sys.stdin.readline inf = float('inf') # dist[i][j]: iからjへのコスト, n:頂点数 def warshall_floyd(dist,n): for k in range(n): for i in range(n): for j in range(n): if i == j: dist[i][j] = 0 elif dist[i][j] > dist[i][k] +...
import sys input = sys.stdin.readline inf = float('inf') # dist[i][j]: iからjへのコスト, n:頂点数 def warshall_floyd(dist,n): for k in range(n): for i in range(n): for j in range(n): if i == j: dist[i][j] = 0 elif dist[i][j] > dist[i][k] +...
41
35
926
785
import sys input = sys.stdin.readline inf = float("inf") # dist[i][j]: iからjへのコスト, n:頂点数 def warshall_floyd(dist, n): for k in range(n): for i in range(n): for j in range(n): if i == j: dist[i][j] = 0 elif dist[i][j] > dist[i][k] + dist[k][j]:...
import sys input = sys.stdin.readline inf = float("inf") # dist[i][j]: iからjへのコスト, n:頂点数 def warshall_floyd(dist, n): for k in range(n): for i in range(n): for j in range(n): if i == j: dist[i][j] = 0 elif dist[i][j] > dist[i][k] + dist[k][j]:...
false
14.634146
[ "- if a > b:", "- a, b = b, a", "- for e in range(s + 1, N):", "- if ad[s][a] + c + ad[b][e] == ad[s][e]:", "- ans -= 1", "- break", "- else:", "- continue", "- break", "+ if ad[s][a] + c == ad[s][b]:", "+ ...
false
0.086709
0.078495
1.104648
[ "s897907013", "s100308117" ]
u691018832
p02925
python
s602360537
s786201675
1,792
1,578
35,060
35,060
Accepted
Accepted
11.94
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) n = int(readline()) a = [list([int(x) - 1 for x in readline().split()]) for _ in range(n)] q = list(range(n)) cnt = 0 while q: cnt += 1 qq = set() ...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) n = int(readline()) a = [list([int(x) - 1 for x in readline().split()]) for _ in range(n)] q = list(range(n)) for cnt in range(1, n ** 2): qq = set() for...
27
27
607
639
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10**7) n = int(readline()) a = [list([int(x) - 1 for x in readline().split()]) for _ in range(n)] q = list(range(n)) cnt = 0 while q: cnt += 1 qq = set() while q: ...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10**7) n = int(readline()) a = [list([int(x) - 1 for x in readline().split()]) for _ in range(n)] q = list(range(n)) for cnt in range(1, n**2): qq = set() for x in q: ...
false
0
[ "-cnt = 0", "-while q:", "- cnt += 1", "+for cnt in range(1, n**2):", "- while q:", "- x = q.pop()", "+ for x in q:", "+ q = []", "- exit()", "-print(cnt)", "+ break", "+ if not q:", "+ print(cnt)", "+ break" ]
false
0.043919
0.040095
1.09538
[ "s602360537", "s786201675" ]
u118642796
p04015
python
s561802122
s010686712
38
27
3,316
3,188
Accepted
Accepted
28.95
N,A = list(map(int,input().split())) X = [int(x)-A for x in input().split()] z = 0 dic = {} for x in X: if x==0: z += 1 else: dic[x] = dic.get(x,0) + 1 line = {} line[0] = 1 for k in dic: line_k = {} for i in range(dic[k]+1): line_k[k*i] = 1...
N,A = list(map(int,input().split())) X = [int(x)-A for x in input().split()] d = {0:1} for x in X: d_tmp = d.copy() for k in d_tmp: d[k+x] = d.get(k+x,0)+d_tmp[k] print((d[0]-1))
30
10
678
208
N, A = list(map(int, input().split())) X = [int(x) - A for x in input().split()] z = 0 dic = {} for x in X: if x == 0: z += 1 else: dic[x] = dic.get(x, 0) + 1 line = {} line[0] = 1 for k in dic: line_k = {} for i in range(dic[k] + 1): line_k[k * i] = 1 for j in range(dic[...
N, A = list(map(int, input().split())) X = [int(x) - A for x in input().split()] d = {0: 1} for x in X: d_tmp = d.copy() for k in d_tmp: d[k + x] = d.get(k + x, 0) + d_tmp[k] print((d[0] - 1))
false
66.666667
[ "-z = 0", "-dic = {}", "+d = {0: 1}", "- if x == 0:", "- z += 1", "- else:", "- dic[x] = dic.get(x, 0) + 1", "-line = {}", "-line[0] = 1", "-for k in dic:", "- line_k = {}", "- for i in range(dic[k] + 1):", "- line_k[k * i] = 1", "- for j in range(di...
false
0.086012
0.065299
1.317207
[ "s561802122", "s010686712" ]
u903005414
p02773
python
s136919436
s387085266
527
421
37,488
38,880
Accepted
Accepted
20.11
from collections import Counter N = int(eval(input())) S = [eval(input()) for _ in range(N)] c = Counter(S) max_times = max(c.values()) keys = [key for key, value in list(c.items()) if value == max_times] # print('keys', keys) keys = sorted(keys) print(('\n'.join(keys)))
from collections import Counter N = int(eval(input())) C = Counter([eval(input()) for _ in range(N)]) # print(f'{list(C)=}') max_value = max([value for value in list(C.values())]) # print(f'{max_value=}') S = [key for key, value in zip(list(C.keys()), list(C.values())) if value == max_value] # print(f'{S=}')...
9
13
260
328
from collections import Counter N = int(eval(input())) S = [eval(input()) for _ in range(N)] c = Counter(S) max_times = max(c.values()) keys = [key for key, value in list(c.items()) if value == max_times] # print('keys', keys) keys = sorted(keys) print(("\n".join(keys)))
from collections import Counter N = int(eval(input())) C = Counter([eval(input()) for _ in range(N)]) # print(f'{list(C)=}') max_value = max([value for value in list(C.values())]) # print(f'{max_value=}') S = [key for key, value in zip(list(C.keys()), list(C.values())) if value == max_value] # print(f'{S=}') for s in ...
false
30.769231
[ "-S = [eval(input()) for _ in range(N)]", "-c = Counter(S)", "-max_times = max(c.values())", "-keys = [key for key, value in list(c.items()) if value == max_times]", "-# print('keys', keys)", "-keys = sorted(keys)", "-print((\"\\n\".join(keys)))", "+C = Counter([eval(input()) for _ in range(N)])", "...
false
0.038791
0.043096
0.900111
[ "s136919436", "s387085266" ]
u525065967
p02553
python
s442208676
s614053939
37
27
9,164
9,104
Accepted
Accepted
27.03
a,b,c,d = list(map(int, input().split())) ans = b*d ans = max(ans, a*c) ans = max(ans, b*d) ans = max(ans, a*d) ans = max(ans, b*c) print(ans)
a, b, c, d = list(map(int, input().split())) print((max(a*c, a*d, b*c, b*d)))
8
2
145
71
a, b, c, d = list(map(int, input().split())) ans = b * d ans = max(ans, a * c) ans = max(ans, b * d) ans = max(ans, a * d) ans = max(ans, b * c) print(ans)
a, b, c, d = list(map(int, input().split())) print((max(a * c, a * d, b * c, b * d)))
false
75
[ "-ans = b * d", "-ans = max(ans, a * c)", "-ans = max(ans, b * d)", "-ans = max(ans, a * d)", "-ans = max(ans, b * c)", "-print(ans)", "+print((max(a * c, a * d, b * c, b * d)))" ]
false
0.03573
0.035015
1.020415
[ "s442208676", "s614053939" ]
u077291787
p02989
python
s328197184
s957241794
102
76
16,028
14,428
Accepted
Accepted
25.49
# ABC132C - Divide the Problems from statistics import median_high, median_low def main(): n = int(eval(input())) D = sorted(map(int, input().rstrip().split())) h, l = median_high(D), median_low(D) print((h - l)) if __name__ == "__main__": main()
# ABC132C - Divide the Problems def main(): n = int(eval(input())) D = sorted(map(int, input().rstrip().split())) h, l = D[n // 2], D[n // 2 - 1] print((h - l)) if __name__ == "__main__": main()
13
10
274
217
# ABC132C - Divide the Problems from statistics import median_high, median_low def main(): n = int(eval(input())) D = sorted(map(int, input().rstrip().split())) h, l = median_high(D), median_low(D) print((h - l)) if __name__ == "__main__": main()
# ABC132C - Divide the Problems def main(): n = int(eval(input())) D = sorted(map(int, input().rstrip().split())) h, l = D[n // 2], D[n // 2 - 1] print((h - l)) if __name__ == "__main__": main()
false
23.076923
[ "-from statistics import median_high, median_low", "-", "-", "- h, l = median_high(D), median_low(D)", "+ h, l = D[n // 2], D[n // 2 - 1]" ]
false
0.049152
0.06568
0.748361
[ "s328197184", "s957241794" ]
u063052907
p03448
python
s705029031
s248856861
42
24
3,064
3,060
Accepted
Accepted
42.86
# coding: utf-8 # Your code here! import sys input = sys.stdin.readline A, B, C, X = [int(eval(input())) for _ in range(4)] cnt = 0 for i in range(A+1): X1 = X - 500 * i if X1 == 0: cnt += 1 continue for j in range(B+1): X2 = X1 - 100 * j if X2 == 0: ...
# coding: utf-8 # Your code here! import sys input = sys.stdin.readline A, B, C, X = [int(eval(input())) for _ in range(4)] cnt = 0 for i in range(A+1): X1 = X - 500 * i if X1 >= 0: for j in range(B+1): X2 = X1 - 100 * j if X2 >= 0 and X2 <= 50 * C: ...
23
17
472
338
# coding: utf-8 # Your code here! import sys input = sys.stdin.readline A, B, C, X = [int(eval(input())) for _ in range(4)] cnt = 0 for i in range(A + 1): X1 = X - 500 * i if X1 == 0: cnt += 1 continue for j in range(B + 1): X2 = X1 - 100 * j if X2 == 0: cnt += 1...
# coding: utf-8 # Your code here! import sys input = sys.stdin.readline A, B, C, X = [int(eval(input())) for _ in range(4)] cnt = 0 for i in range(A + 1): X1 = X - 500 * i if X1 >= 0: for j in range(B + 1): X2 = X1 - 100 * j if X2 >= 0 and X2 <= 50 * C: cnt += 1 ...
false
26.086957
[ "- if X1 == 0:", "- cnt += 1", "- continue", "- for j in range(B + 1):", "- X2 = X1 - 100 * j", "- if X2 == 0:", "- cnt += 1", "- continue", "- for k in range(C + 1):", "- X3 = X2 - 50 * k", "- if X3 == 0:", "...
false
0.156711
0.092056
1.702335
[ "s705029031", "s248856861" ]
u357751375
p03316
python
s713958286
s057747334
29
26
9,108
9,164
Accepted
Accepted
10.34
n = int(eval(input())) i = n m = 0 while i > 0: m += i % 10 i = i // 10 if n % m != 0: print('No') else: print('Yes')
n = eval(input()) m = list(n) m = list(map(int,m)) m = sum(m) if int(n) % m == 0: print('Yes') else: print('No')
11
8
138
121
n = int(eval(input())) i = n m = 0 while i > 0: m += i % 10 i = i // 10 if n % m != 0: print("No") else: print("Yes")
n = eval(input()) m = list(n) m = list(map(int, m)) m = sum(m) if int(n) % m == 0: print("Yes") else: print("No")
false
27.272727
[ "-n = int(eval(input()))", "-i = n", "-m = 0", "-while i > 0:", "- m += i % 10", "- i = i // 10", "-if n % m != 0:", "+n = eval(input())", "+m = list(n)", "+m = list(map(int, m))", "+m = sum(m)", "+if int(n) % m == 0:", "+ print(\"Yes\")", "+else:", "-else:", "- print(\"Yes...
false
0.078752
0.08765
0.898477
[ "s713958286", "s057747334" ]
u796942881
p03087
python
s639103729
s082082048
272
178
14,232
23,648
Accepted
Accepted
34.56
from sys import stdin def main(): readline = stdin.readline N, Q = list(map(int, readline().split())) S = readline().strip() L = [] R = [] for i in range(Q): *LR, = list(map(int, readline().split())) L.append(LR[0] - 1) R.append(LR[1] - 1) AC = [] ...
from sys import stdin def main(): readline = stdin.readline read = stdin.read N, Q = list(map(int, readline().split())) S = readline().strip() * LR, = [int(x) - 1 for x in read().split()] AC = [] pre = None cnt = 0 for c in S: if c == "A": pre = "A...
31
27
635
573
from sys import stdin def main(): readline = stdin.readline N, Q = list(map(int, readline().split())) S = readline().strip() L = [] R = [] for i in range(Q): (*LR,) = list(map(int, readline().split())) L.append(LR[0] - 1) R.append(LR[1] - 1) AC = [] pre = None ...
from sys import stdin def main(): readline = stdin.readline read = stdin.read N, Q = list(map(int, readline().split())) S = readline().strip() (*LR,) = [int(x) - 1 for x in read().split()] AC = [] pre = None cnt = 0 for c in S: if c == "A": pre = "A" eli...
false
12.903226
[ "+ read = stdin.read", "- L = []", "- R = []", "- for i in range(Q):", "- (*LR,) = list(map(int, readline().split()))", "- L.append(LR[0] - 1)", "- R.append(LR[1] - 1)", "+ (*LR,) = [int(x) - 1 for x in read().split()]", "- for l, r in zip(L, R):", "+ for ...
false
0.037742
0.086857
0.434531
[ "s639103729", "s082082048" ]
u145231176
p03364
python
s510037825
s825665652
879
538
82,792
82,508
Accepted
Accepted
38.79
def getN(): return int(eval(input())) def getNM(): return list(map(int, input().split())) def getList(): return list(map(int, input().split())) def getArray(intn): return [int(eval(input())) for i in range(intn)] def input(): return sys.stdin.readline().rstrip() def rand_N(ran1, ran2): ...
def getN(): return int(eval(input())) def getNM(): return list(map(int, input().split())) def getList(): return list(map(int, input().split())) def getArray(intn): return [int(eval(input())) for i in range(intn)] def input(): return sys.stdin.readline().rstrip() def rand_N(ran1, ran2): ...
111
111
2,510
2,513
def getN(): return int(eval(input())) def getNM(): return list(map(int, input().split())) def getList(): return list(map(int, input().split())) def getArray(intn): return [int(eval(input())) for i in range(intn)] def input(): return sys.stdin.readline().rstrip() def rand_N(ran1, ran2): ...
def getN(): return int(eval(input())) def getNM(): return list(map(int, input().split())) def getList(): return list(map(int, input().split())) def getArray(intn): return [int(eval(input())) for i in range(intn)] def input(): return sys.stdin.readline().rstrip() def rand_N(ran1, ran2): ...
false
0
[ "- for j in range(N):", "+ for j in range(i, N):" ]
false
0.037622
0.037582
1.001085
[ "s510037825", "s825665652" ]
u875131962
p00102
python
s165164924
s709132889
40
30
8,120
7,628
Accepted
Accepted
25
import functools n = int(eval(input())) while(n): bottom_record = [0]*(n+1) for i in range(0, n): l = list(map(int, input().split())) l.append(functools.reduce(lambda x, y: x + y, l)) bottom_record = [x + y for(x,y) in zip(bottom_record, l)] print((''.join(map('{0:5d}...
n = int(eval(input())) while(n): bottom_record = [0]*(n+1) for i in range(0, n): l = list(map(int, input().split())) l.append(sum(l)) bottom_record = [x + y for(x,y) in zip(bottom_record, l)] print((''.join(map('{0:5d}'.format, l)))) print((''.join(map('{0:5d}'.for...
13
11
407
354
import functools n = int(eval(input())) while n: bottom_record = [0] * (n + 1) for i in range(0, n): l = list(map(int, input().split())) l.append(functools.reduce(lambda x, y: x + y, l)) bottom_record = [x + y for (x, y) in zip(bottom_record, l)] print(("".join(map("{0:5d}".form...
n = int(eval(input())) while n: bottom_record = [0] * (n + 1) for i in range(0, n): l = list(map(int, input().split())) l.append(sum(l)) bottom_record = [x + y for (x, y) in zip(bottom_record, l)] print(("".join(map("{0:5d}".format, l)))) print(("".join(map("{0:5d}".format, b...
false
15.384615
[ "-import functools", "-", "- l.append(functools.reduce(lambda x, y: x + y, l))", "+ l.append(sum(l))" ]
false
0.041448
0.041693
0.994128
[ "s165164924", "s709132889" ]
u691018832
p02954
python
s550083412
s504996249
266
132
4,976
6,632
Accepted
Accepted
50.38
import math s = input() ans = [0]*len(s) cnt = 0 for i in range(len(s)-1): if "R" in s[i]: cnt += 1 if "L" in s[i+1]: ans[i+1] += math.ceil(cnt/2) ans[i] += math.ceil(cnt/2) if cnt%2 == 0: ans[i+1] += 1 cnt = 0 for i in r...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) s = read().rstrip().decode() cnt = 0 ans = [0] * len(s) for i, ss in enumerate(s): if ss == 'L': ans[i] += cnt // 2 ans[i - 1] += cnt // 2 ...
27
29
665
670
import math s = input() ans = [0] * len(s) cnt = 0 for i in range(len(s) - 1): if "R" in s[i]: cnt += 1 if "L" in s[i + 1]: ans[i + 1] += math.ceil(cnt / 2) ans[i] += math.ceil(cnt / 2) if cnt % 2 == 0: ans[i + 1] += 1 cnt = 0 for i in...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10**7) s = read().rstrip().decode() cnt = 0 ans = [0] * len(s) for i, ss in enumerate(s): if ss == "L": ans[i] += cnt // 2 ans[i - 1] += cnt // 2 if cnt ...
false
6.896552
[ "-import math", "+import sys", "-s = input()", "+read = sys.stdin.buffer.read", "+readline = sys.stdin.buffer.readline", "+readlines = sys.stdin.buffer.readlines", "+sys.setrecursionlimit(10**7)", "+s = read().rstrip().decode()", "+cnt = 0", "-cnt = 0", "-for i in range(len(s) - 1):", "- if...
false
0.046534
0.109615
0.424517
[ "s550083412", "s504996249" ]
u934442292
p02702
python
s284189508
s862469805
309
82
9,248
9,196
Accepted
Accepted
73.46
import sys input = sys.stdin.readline P = 2019 def main(): S = input().rstrip() N = len(S) count = [0] * P count[0] += 1 T = 0 for i in range(N): T = (T + int(S[(N - 1) - i]) * pow(10, i, mod=P)) % P count[T] += 1 ans = 0 for k in count: an...
import sys input = sys.stdin.readline P = 2019 def main(): S = input().rstrip() count = [0] * P count[0] += 1 T = 0 d = 1 for s in reversed(S): T = (T + int(s) * d) % P count[T] += 1 d = (d * 10) % P ans = 0 for k in count: ans += ...
25
26
409
397
import sys input = sys.stdin.readline P = 2019 def main(): S = input().rstrip() N = len(S) count = [0] * P count[0] += 1 T = 0 for i in range(N): T = (T + int(S[(N - 1) - i]) * pow(10, i, mod=P)) % P count[T] += 1 ans = 0 for k in count: ans = ans + k * (k - 1)...
import sys input = sys.stdin.readline P = 2019 def main(): S = input().rstrip() count = [0] * P count[0] += 1 T = 0 d = 1 for s in reversed(S): T = (T + int(s) * d) % P count[T] += 1 d = (d * 10) % P ans = 0 for k in count: ans += k * (k - 1) // 2 p...
false
3.846154
[ "- N = len(S)", "- for i in range(N):", "- T = (T + int(S[(N - 1) - i]) * pow(10, i, mod=P)) % P", "+ d = 1", "+ for s in reversed(S):", "+ T = (T + int(s) * d) % P", "+ d = (d * 10) % P", "- ans = ans + k * (k - 1) // 2", "+ ans += k * (k - 1) // 2" ]
false
0.00803
0.040285
0.199329
[ "s284189508", "s862469805" ]
u057109575
p02787
python
s419457085
s629992525
474
396
152,268
152,952
Accepted
Accepted
16.46
H, N = list(map(int, input().split())) X = [list(map(int, input().split())) for _ in range(N)] inf = 10 ** 9 + 7 dp = [[inf] * (H + 1) for _ in range(N + 1)] dp[0][0] = 0 for i in range(N): for j in range(H + 1): dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]) dp[i + 1][min(j + X[i][0], H)] =...
H, N = list(map(int, input().split())) X = [list(map(int, input().split())) for _ in range(N)] INF = 10 ** 9 + 7 dp = [[INF] * (H + 1) for _ in range(N + 1)] dp[0][0] = 0 for i in range(N): for j in range(H + 1): dp[i + 1][j] = min(dp[i][j], dp[i + 1][j]) dp[i + 1][min(j + X[i][0], H...
15
16
516
446
H, N = list(map(int, input().split())) X = [list(map(int, input().split())) for _ in range(N)] inf = 10**9 + 7 dp = [[inf] * (H + 1) for _ in range(N + 1)] dp[0][0] = 0 for i in range(N): for j in range(H + 1): dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]) dp[i + 1][min(j + X[i][0], H)] = min( ...
H, N = list(map(int, input().split())) X = [list(map(int, input().split())) for _ in range(N)] INF = 10**9 + 7 dp = [[INF] * (H + 1) for _ in range(N + 1)] dp[0][0] = 0 for i in range(N): for j in range(H + 1): dp[i + 1][j] = min(dp[i][j], dp[i + 1][j]) dp[i + 1][min(j + X[i][0], H)] = min( ...
false
6.25
[ "-inf = 10**9 + 7", "-dp = [[inf] * (H + 1) for _ in range(N + 1)]", "+INF = 10**9 + 7", "+dp = [[INF] * (H + 1) for _ in range(N + 1)]", "- dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])", "+ dp[i + 1][j] = min(dp[i][j], dp[i + 1][j])", "- dp[i + 1][min(j + X[i][0], H)], dp[i][j] +...
false
0.425157
0.241156
1.762997
[ "s419457085", "s629992525" ]
u185297444
p02755
python
s625223932
s772004018
38
29
9,080
9,068
Accepted
Accepted
23.68
import math a,b = [float(i) for i in input().split()] ans = 1000000000 flag = False for i in range(1,10000): ans8 = int(math.floor(i*0.08)) ans10 = int(math.floor(i*0.1)) # print(ans8,ans10) if ans8 == a and ans10 == b: ans = min(ans, i) flag = True if flag is True: p...
import math a,b = [float(i) for i in input().split()] ans = 1000000000 flag = False for i in range(1,1005): ans8 = int(math.floor(i*0.08)) ans10 = int(math.floor(i*0.1)) # print(ans8,ans10) if ans8 == a and ans10 == b: ans = min(ans, i) # 更新する必要がある. flag = True if flag is ...
17
17
351
363
import math a, b = [float(i) for i in input().split()] ans = 1000000000 flag = False for i in range(1, 10000): ans8 = int(math.floor(i * 0.08)) ans10 = int(math.floor(i * 0.1)) # print(ans8,ans10) if ans8 == a and ans10 == b: ans = min(ans, i) flag = True if flag is True: print(...
import math a, b = [float(i) for i in input().split()] ans = 1000000000 flag = False for i in range(1, 1005): ans8 = int(math.floor(i * 0.08)) ans10 = int(math.floor(i * 0.1)) # print(ans8,ans10) if ans8 == a and ans10 == b: ans = min(ans, i) # 更新する必要がある. flag = True if flag is Tru...
false
0
[ "-for i in range(1, 10000):", "+for i in range(1, 1005):", "- ans = min(ans, i)", "+ ans = min(ans, i) # 更新する必要がある." ]
false
0.04511
0.035474
1.271643
[ "s625223932", "s772004018" ]
u497596438
p03107
python
s884421778
s671616858
188
170
39,408
39,412
Accepted
Accepted
9.57
S=eval(input()) #N=int(input()) #H,W=map(int,input().split()) a=0 b=0 for i in range(len(S)): if S[i]=="0": a+=1 else: b+=1 print((min([a,b])*2))
S=eval(input()) a=0 b=0 for i in range(len(S)): if S[i]=="0": a+=1 else: b+=1 print((min(a,b)*2))
11
9
171
122
S = eval(input()) # N=int(input()) # H,W=map(int,input().split()) a = 0 b = 0 for i in range(len(S)): if S[i] == "0": a += 1 else: b += 1 print((min([a, b]) * 2))
S = eval(input()) a = 0 b = 0 for i in range(len(S)): if S[i] == "0": a += 1 else: b += 1 print((min(a, b) * 2))
false
18.181818
[ "-# N=int(input())", "-# H,W=map(int,input().split())", "-print((min([a, b]) * 2))", "+print((min(a, b) * 2))" ]
false
0.049686
0.049675
1.000228
[ "s884421778", "s671616858" ]
u054514819
p03281
python
s552423759
s438277344
20
17
3,060
3,060
Accepted
Accepted
15
from math import sqrt N = int(eval(input())) ans = 0 for i in range(7, N+1): if i%2==0: continue c = 0 for j in range(1, int(sqrt(i))+1): if i%j==0: if i//j==j: c+=1 else: c+=2 if c==8: ans += 1 print(ans)
from math import sqrt N = int(eval(input())) ans = 0 for i in range(7, N+1): if i%2==0: continue c = 0 for j in range(1, int(sqrt(i))+1): if i%j==0: c+=2 if c==8: ans += 1 print(ans)
16
13
262
214
from math import sqrt N = int(eval(input())) ans = 0 for i in range(7, N + 1): if i % 2 == 0: continue c = 0 for j in range(1, int(sqrt(i)) + 1): if i % j == 0: if i // j == j: c += 1 else: c += 2 if c == 8: ans += 1 print(...
from math import sqrt N = int(eval(input())) ans = 0 for i in range(7, N + 1): if i % 2 == 0: continue c = 0 for j in range(1, int(sqrt(i)) + 1): if i % j == 0: c += 2 if c == 8: ans += 1 print(ans)
false
18.75
[ "- if i // j == j:", "- c += 1", "- else:", "- c += 2", "+ c += 2" ]
false
0.041169
0.040555
1.015147
[ "s552423759", "s438277344" ]
u052499405
p02794
python
s950718905
s738620759
2,523
2,216
86,008
86,008
Accepted
Accepted
12.17
#!/usr/bin/env python3 import sys input = sys.stdin.readline n = int(eval(input())) edge = [[] for _ in range(n)] edge_dict = dict() for i in range(n - 1): a, b = [int(item) - 1 for item in input().split()] edge[a].append(b) edge[b].append(a) if a > b: edge_dict[(b, a)] = i ...
#!/usr/bin/env python3 import sys input = sys.stdin.readline n = int(eval(input())) edge = [[] for _ in range(n)] edge_dict = dict() for i in range(n - 1): a, b = [int(item) - 1 for item in input().split()] edge[a].append(b) edge[b].append(a) if a > b: edge_dict[(b, a)] = i ...
64
66
1,571
1,608
#!/usr/bin/env python3 import sys input = sys.stdin.readline n = int(eval(input())) edge = [[] for _ in range(n)] edge_dict = dict() for i in range(n - 1): a, b = [int(item) - 1 for item in input().split()] edge[a].append(b) edge[b].append(a) if a > b: edge_dict[(b, a)] = i else: ed...
#!/usr/bin/env python3 import sys input = sys.stdin.readline n = int(eval(input())) edge = [[] for _ in range(n)] edge_dict = dict() for i in range(n - 1): a, b = [int(item) - 1 for item in input().split()] edge[a].append(b) edge[b].append(a) if a > b: edge_dict[(b, a)] = i else: ed...
false
3.030303
[ "+# edge-bitset of each constraint", "-edge_of_state = [0] * 2**m", "+# edge-bitset of each set of constraints", "+edgest = [0] * 2**m", "- edge_of_state[i] = edge_of_state[i ^ lsb] | target_edge[lsb.bit_length() - 1]", "-# dp[fills uv as st]", "+ edgest[i] = edgest[i ^ lsb] | target_edge[lsb.bit_...
false
0.041664
0.042035
0.991171
[ "s950718905", "s738620759" ]
u671060652
p03238
python
s224176265
s679188617
277
61
64,492
61,840
Accepted
Accepted
77.98
import itertools import math import fractions import functools import copy n = int(eval(input())) if n == 1: print("Hello World") else: a = int(eval(input())) b = int(eval(input())) print((a+b))
def main(): n = int(eval(input())) # h, w, k = map(int, input().split()) # a = list(map(int, input().split())) # s = input() if n == 1: print("Hello World") else: a = int(eval(input())) b = int(eval(input())) print((a+b)) if __name__ == '__main__'...
14
16
206
314
import itertools import math import fractions import functools import copy n = int(eval(input())) if n == 1: print("Hello World") else: a = int(eval(input())) b = int(eval(input())) print((a + b))
def main(): n = int(eval(input())) # h, w, k = map(int, input().split()) # a = list(map(int, input().split())) # s = input() if n == 1: print("Hello World") else: a = int(eval(input())) b = int(eval(input())) print((a + b)) if __name__ == "__main__": main()
false
12.5
[ "-import itertools", "-import math", "-import fractions", "-import functools", "-import copy", "+def main():", "+ n = int(eval(input()))", "+ # h, w, k = map(int, input().split())", "+ # a = list(map(int, input().split()))", "+ # s = input()", "+ if n == 1:", "+ print(\"H...
false
0.044221
0.074991
0.589687
[ "s224176265", "s679188617" ]
u203843959
p03722
python
s444554812
s261345192
914
747
4,340
4,340
Accepted
Accepted
18.27
import sys sys.setrecursionlimit(10**9) N,M=list(map(int,input().split())) def find_negative_loop(n,w,es): dist=[float("inf")]*n #この始点はどこでもよい dist[1]=0 for i in range(n): for j in range(w): e=es[j] if dist[e[1]]>dist[e[0]]+e[2]: dist[e[1]]=dist[e[0]]+e[2] if i==...
import sys sys.setrecursionlimit(10**9) N,M=list(map(int,input().split())) def find_negative_loop(n,w,es): dist=[float("inf")]*n #この始点はどこでもよい dist[1]=0 for i in range(n): for j in range(w): e=es[j] if dist[e[1]]>dist[e[0]]+e[2]: dist[e[1]]=dist[e[0]]+e[2] if i==...
76
85
1,540
1,661
import sys sys.setrecursionlimit(10**9) N, M = list(map(int, input().split())) def find_negative_loop(n, w, es): dist = [float("inf")] * n # この始点はどこでもよい dist[1] = 0 for i in range(n): for j in range(w): e = es[j] if dist[e[1]] > dist[e[0]] + e[2]: dist[...
import sys sys.setrecursionlimit(10**9) N, M = list(map(int, input().split())) def find_negative_loop(n, w, es): dist = [float("inf")] * n # この始点はどこでもよい dist[1] = 0 for i in range(n): for j in range(w): e = es[j] if dist[e[1]] > dist[e[0]] + e[2]: dist[...
false
10.588235
[ "-def check_reachable(s, u):", "+def check_reachable(u):", "- reachable_list[s] = True", "+ reachable[u] = True", "+ cnt = 0", "- check_reachable(s, v)", "- return False", "+ ret = check_reachable(v)", "+ if ret:", "+ reachable[u]...
false
0.075945
0.038219
1.987091
[ "s444554812", "s261345192" ]
u116038906
p02548
python
s213187616
s207048520
268
64
65,612
65,828
Accepted
Accepted
76.12
#約数の個数の和(1~N)約数そのものを求めないので「速い」 def yakusu_num(N): ans =0 for i in range(1,N+1): ans +=N//i #項数 return ans # 初期入力 import sys input = sys.stdin.readline #文字列では使わない N = int(eval(input())) ans =yakusu_num(N-1) print(ans)
#約数の個数の和(1~N)約数そのものを求めないので「速い」 def divisor_num(N): ans =0 for i in range(1,N): ans +=(N-1)//i #項数 return ans # 初期入力 import sys input = sys.stdin.readline #文字列では使わない N = int(eval(input())) ans =divisor_num(N) print(ans)
16
16
250
252
# 約数の個数の和(1~N)約数そのものを求めないので「速い」 def yakusu_num(N): ans = 0 for i in range(1, N + 1): ans += N // i # 項数 return ans # 初期入力 import sys input = sys.stdin.readline # 文字列では使わない N = int(eval(input())) ans = yakusu_num(N - 1) print(ans)
# 約数の個数の和(1~N)約数そのものを求めないので「速い」 def divisor_num(N): ans = 0 for i in range(1, N): ans += (N - 1) // i # 項数 return ans # 初期入力 import sys input = sys.stdin.readline # 文字列では使わない N = int(eval(input())) ans = divisor_num(N) print(ans)
false
0
[ "-def yakusu_num(N):", "+def divisor_num(N):", "- for i in range(1, N + 1):", "- ans += N // i # 項数", "+ for i in range(1, N):", "+ ans += (N - 1) // i # 項数", "-ans = yakusu_num(N - 1)", "+ans = divisor_num(N)" ]
false
0.041525
0.157099
0.264325
[ "s213187616", "s207048520" ]
u832039789
p03503
python
s473042904
s050711820
454
216
3,188
3,064
Accepted
Accepted
52.42
n = int(eval(input())) f = [list(map(int,input().split())) for _ in range(n)] p = [list(map(int,input().split())) for _ in range(n)] def calcBit(num): res = [] for _ in range(10): res.append(num%2) num >>= 1 return res ans = -float('inf') for i in range(1,2**10): ans_t = 0...
n = int(eval(input())) f = [list(map(int,input().split())) for i in range(n)] p = [list(map(int,input().split())) for i in range(n)] res = -float('inf') for i in range(1,1<<10): a = [0]*n for j in range(10): for m in range(n): if i&1 and f[m][j]: a[m] += 1 ...
23
17
528
417
n = int(eval(input())) f = [list(map(int, input().split())) for _ in range(n)] p = [list(map(int, input().split())) for _ in range(n)] def calcBit(num): res = [] for _ in range(10): res.append(num % 2) num >>= 1 return res ans = -float("inf") for i in range(1, 2**10): ans_t = 0 f...
n = int(eval(input())) f = [list(map(int, input().split())) for i in range(n)] p = [list(map(int, input().split())) for i in range(n)] res = -float("inf") for i in range(1, 1 << 10): a = [0] * n for j in range(10): for m in range(n): if i & 1 and f[m][j]: a[m] += 1 i ...
false
26.086957
[ "-f = [list(map(int, input().split())) for _ in range(n)]", "-p = [list(map(int, input().split())) for _ in range(n)]", "-", "-", "-def calcBit(num):", "- res = []", "- for _ in range(10):", "- res.append(num % 2)", "- num >>= 1", "- return res", "-", "-", "-ans = -flo...
false
0.103058
0.061804
1.667482
[ "s473042904", "s050711820" ]
u816631826
p02880
python
s172542093
s898178615
72
29
61,684
9,028
Accepted
Accepted
59.72
n = int(eval(input())) for a in range(1, 10): b = n // a if a * b == n and b >= 1 and b < 10: print("Yes") quit() print("No")
N = int(eval(input())) productos = [] def mult(N): for i in range(1,10): for n in range(1,10): calc = n * i productos.append(calc) if N in productos: print("Yes") else: print("No") mult(N)
9
16
136
261
n = int(eval(input())) for a in range(1, 10): b = n // a if a * b == n and b >= 1 and b < 10: print("Yes") quit() print("No")
N = int(eval(input())) productos = [] def mult(N): for i in range(1, 10): for n in range(1, 10): calc = n * i productos.append(calc) if N in productos: print("Yes") else: print("No") mult(N)
false
43.75
[ "-n = int(eval(input()))", "-for a in range(1, 10):", "- b = n // a", "- if a * b == n and b >= 1 and b < 10:", "+N = int(eval(input()))", "+productos = []", "+", "+", "+def mult(N):", "+ for i in range(1, 10):", "+ for n in range(1, 10):", "+ calc = n * i", "+ ...
false
0.041124
0.037379
1.100169
[ "s172542093", "s898178615" ]
u796942881
p03353
python
s983919703
s199650422
33
18
4,464
3,060
Accepted
Accepted
45.45
def main(): s = eval(input()) K = int(eval(input())) print((sorted({s[i:j] for i in range(len(s)) for j in range(i + 1, min(i + K + 1, len(s) + 1))})[K - 1])) return main()
def main(): s = eval(input()) K = int(eval(input())) lst = sorted(set(s)) ans = [] def dfs(c): ans.append(c) if len(ans) < K: for li in lst: if c + li in s: return dfs(c + li) for li in lst: dfs(li) prin...
10
20
222
346
def main(): s = eval(input()) K = int(eval(input())) print( ( sorted( { s[i:j] for i in range(len(s)) for j in range(i + 1, min(i + K + 1, len(s) + 1)) } )[K - 1] ) ) r...
def main(): s = eval(input()) K = int(eval(input())) lst = sorted(set(s)) ans = [] def dfs(c): ans.append(c) if len(ans) < K: for li in lst: if c + li in s: return dfs(c + li) for li in lst: dfs(li) print((ans[K - 1]))...
false
50
[ "- print(", "- (", "- sorted(", "- {", "- s[i:j]", "- for i in range(len(s))", "- for j in range(i + 1, min(i + K + 1, len(s) + 1))", "- }", "- )[K - 1]", "- )", "- )"...
false
0.158632
0.159156
0.996705
[ "s983919703", "s199650422" ]
u325264482
p03476
python
s553631078
s145433720
741
506
15,412
16,792
Accepted
Accepted
31.71
import math from itertools import accumulate def is_prime(n): if n == 1: return 0 for k in range(2, int(math.sqrt(n)) + 1): if n % k == 0: return 0 return 1 Q = int(eval(input())) L = [0]*Q R = [0]*Q for i in range(Q): L[i], R[i] = list(map(int, inp...
from itertools import accumulate # エラトステネスの篩(素数) def sieve(n): is_prime = [True for _ in range(n)] is_prime[0] = False for i in range(2, n+1): if is_prime[i-1]: j = 2 * i while j <= n: is_prime[j-1] = False j += i table = [...
39
40
677
850
import math from itertools import accumulate def is_prime(n): if n == 1: return 0 for k in range(2, int(math.sqrt(n)) + 1): if n % k == 0: return 0 return 1 Q = int(eval(input())) L = [0] * Q R = [0] * Q for i in range(Q): L[i], R[i] = list(map(int, input().split())) min_...
from itertools import accumulate # エラトステネスの篩(素数) def sieve(n): is_prime = [True for _ in range(n)] is_prime[0] = False for i in range(2, n + 1): if is_prime[i - 1]: j = 2 * i while j <= n: is_prime[j - 1] = False j += i table = [i for i in...
false
2.5
[ "-import math", "-", "-def is_prime(n):", "- if n == 1:", "- return 0", "- for k in range(2, int(math.sqrt(n)) + 1):", "- if n % k == 0:", "- return 0", "- return 1", "+# エラトステネスの篩(素数)", "+def sieve(n):", "+ is_prime = [True for _ in range(n)]", "+ is_...
false
0.042879
0.042938
0.998623
[ "s553631078", "s145433720" ]
u594859393
p03329
python
s792760035
s891719057
24
19
3,572
3,064
Accepted
Accepted
20.83
from itertools import count, takewhile from functools import lru_cache @lru_cache(maxsize=None) def dfs(n): if n == 0: return 0 max9 = max(takewhile(lambda x: x<=n, (9**i for i in count()))) max6 = max(takewhile(lambda x: x<=n, (6**i for i in count()))) return min(dfs(n-max9), dfs(n-max6))+1 p...
from itertools import count, takewhile, dropwhile def dfs(n, max9, max6, d={0:0}): if n in d: return d[n] max9 = next(dropwhile(lambda x: x>n, (max9 / 9**i for i in count()))) max6 = next(dropwhile(lambda x: x>n, (max6 / 6**i for i in count()))) d[n] = min(dfs(n-max9, max9, max6), dfs(n-max6, max9, m...
12
16
343
523
from itertools import count, takewhile from functools import lru_cache @lru_cache(maxsize=None) def dfs(n): if n == 0: return 0 max9 = max(takewhile(lambda x: x <= n, (9**i for i in count()))) max6 = max(takewhile(lambda x: x <= n, (6**i for i in count()))) return min(dfs(n - max9), dfs(n - ma...
from itertools import count, takewhile, dropwhile def dfs(n, max9, max6, d={0: 0}): if n in d: return d[n] max9 = next(dropwhile(lambda x: x > n, (max9 / 9**i for i in count()))) max6 = next(dropwhile(lambda x: x > n, (max6 / 6**i for i in count()))) d[n] = min(dfs(n - max9, max9, max6), dfs(n...
false
25
[ "-from itertools import count, takewhile", "-from functools import lru_cache", "+from itertools import count, takewhile, dropwhile", "-@lru_cache(maxsize=None)", "-def dfs(n):", "- if n == 0:", "- return 0", "- max9 = max(takewhile(lambda x: x <= n, (9**i for i in count())))", "- max...
false
0.038224
0.220685
0.173207
[ "s792760035", "s891719057" ]
u777283665
p03745
python
s047164985
s404484381
80
68
14,228
14,252
Accepted
Accepted
15
n = int(eval(input())) a = list(map(int, input().split())) if n <= 2: print((1)) exit() dec, inc = False, False cnt = 1 for i in range(n-1): if a[i+1] - a[i] < 0: dec = True elif a[i+1] - a[i] > 0: inc = True if dec and inc: cnt += 1 dec, inc = F...
n = int(eval(input())) a = list(map(int, input().split())) ans = 1 up = None for x, y in zip(a, a[1:]): if x < y: if up is None: up = True elif not up: ans += 1 up = None elif x > y: if up is None: up = False elif ...
21
20
337
374
n = int(eval(input())) a = list(map(int, input().split())) if n <= 2: print((1)) exit() dec, inc = False, False cnt = 1 for i in range(n - 1): if a[i + 1] - a[i] < 0: dec = True elif a[i + 1] - a[i] > 0: inc = True if dec and inc: cnt += 1 dec, inc = False, False prin...
n = int(eval(input())) a = list(map(int, input().split())) ans = 1 up = None for x, y in zip(a, a[1:]): if x < y: if up is None: up = True elif not up: ans += 1 up = None elif x > y: if up is None: up = False elif up: an...
false
4.761905
[ "-if n <= 2:", "- print((1))", "- exit()", "-dec, inc = False, False", "-cnt = 1", "-for i in range(n - 1):", "- if a[i + 1] - a[i] < 0:", "- dec = True", "- elif a[i + 1] - a[i] > 0:", "- inc = True", "- if dec and inc:", "- cnt += 1", "- dec, inc ...
false
0.057604
0.067778
0.849895
[ "s047164985", "s404484381" ]
u528748570
p02888
python
s543074809
s487435937
1,742
1,226
3,316
3,188
Accepted
Accepted
29.62
from bisect import bisect_left N = int(eval(input())) L = list(map(int, input().split())) L.sort() ans = 0 for i in range(N-2): for j in range(i+1, N-1): ans += max(0, bisect_left(L, L[i]+L[j]) - j - 1) print(ans)
from bisect import bisect_left N = int(eval(input())) L = sorted(list(map(int, input().split()))) ans = 0 for i in range(N-2): for j in range(i+1, N-1): ans += bisect_left(L, L[i]+L[j]) - j - 1 print(ans)
11
10
232
222
from bisect import bisect_left N = int(eval(input())) L = list(map(int, input().split())) L.sort() ans = 0 for i in range(N - 2): for j in range(i + 1, N - 1): ans += max(0, bisect_left(L, L[i] + L[j]) - j - 1) print(ans)
from bisect import bisect_left N = int(eval(input())) L = sorted(list(map(int, input().split()))) ans = 0 for i in range(N - 2): for j in range(i + 1, N - 1): ans += bisect_left(L, L[i] + L[j]) - j - 1 print(ans)
false
9.090909
[ "-L = list(map(int, input().split()))", "-L.sort()", "+L = sorted(list(map(int, input().split())))", "- ans += max(0, bisect_left(L, L[i] + L[j]) - j - 1)", "+ ans += bisect_left(L, L[i] + L[j]) - j - 1" ]
false
0.078318
0.044498
1.760026
[ "s543074809", "s487435937" ]
u347640436
p02683
python
s209140796
s592195523
88
76
9,232
9,228
Accepted
Accepted
13.64
N, M, X = list(map(int, input().split())) C = [] A = [] for i in range(N): t = list(map(int, input().split())) C.append(t[0]) A.append(t[1:]) result = -1 for i in range(1 << N): t = [0] * M c = 0 for j in range(N): if (i >> j) & 1 == 0: continue c +=...
from itertools import product N, M, X = list(map(int, input().split())) C = [] A = [] for i in range(N): t = list(map(int, input().split())) C.append(t[0]) A.append(t[1:]) result = -1 for p in product([True, False], repeat = N): t = [0] * M c = 0 for j in range(N): if ...
26
27
540
571
N, M, X = list(map(int, input().split())) C = [] A = [] for i in range(N): t = list(map(int, input().split())) C.append(t[0]) A.append(t[1:]) result = -1 for i in range(1 << N): t = [0] * M c = 0 for j in range(N): if (i >> j) & 1 == 0: continue c += C[j] a = ...
from itertools import product N, M, X = list(map(int, input().split())) C = [] A = [] for i in range(N): t = list(map(int, input().split())) C.append(t[0]) A.append(t[1:]) result = -1 for p in product([True, False], repeat=N): t = [0] * M c = 0 for j in range(N): if not p[j]: ...
false
3.703704
[ "+from itertools import product", "+", "-for i in range(1 << N):", "+for p in product([True, False], repeat=N):", "- if (i >> j) & 1 == 0:", "+ if not p[j]:", "- a = A[j]", "- t[k] += a[k]", "+ t[k] += A[j][k]" ]
false
0.109883
0.10615
1.035167
[ "s209140796", "s592195523" ]
u312025627
p03724
python
s303472430
s942721683
306
250
55,328
56,028
Accepted
Accepted
18.3
def main(): import sys input = sys.stdin.buffer.readline N, M = (int(i) for i in input().split()) G = [[] for i in range(N)] for i in range(M): x, y = (int(i)-1 for i in input().split()) G[x].append(y) G[y].append(x) for i in range(N): if len(G[i]) % 2...
def main(): import sys input = sys.stdin.buffer.readline N, M = (int(i) for i in input().split()) cnt = [0]*N AB = [[int(i)-1 for i in input().split()] for j in range(M)] for a, b in AB: cnt[a] += 1 cnt[b] += 1 if all(c % 2 == 0 for c in cnt): print("YES") ...
19
17
438
395
def main(): import sys input = sys.stdin.buffer.readline N, M = (int(i) for i in input().split()) G = [[] for i in range(N)] for i in range(M): x, y = (int(i) - 1 for i in input().split()) G[x].append(y) G[y].append(x) for i in range(N): if len(G[i]) % 2: ...
def main(): import sys input = sys.stdin.buffer.readline N, M = (int(i) for i in input().split()) cnt = [0] * N AB = [[int(i) - 1 for i in input().split()] for j in range(M)] for a, b in AB: cnt[a] += 1 cnt[b] += 1 if all(c % 2 == 0 for c in cnt): print("YES") el...
false
10.526316
[ "- G = [[] for i in range(N)]", "- for i in range(M):", "- x, y = (int(i) - 1 for i in input().split())", "- G[x].append(y)", "- G[y].append(x)", "- for i in range(N):", "- if len(G[i]) % 2:", "- return print(\"NO\")", "+ cnt = [0] * N", "+ AB ...
false
0.152253
0.146094
1.042157
[ "s303472430", "s942721683" ]
u745087332
p03806
python
s862778338
s148304592
1,535
733
59,500
25,168
Accepted
Accepted
52.25
# coding:utf-8 import sys # from collections import Counter, defaultdict INF = float('inf') MOD = 10 ** 9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def II(): return int(sys.stdin.readline()) def SI(): return eval(input()) n, ma, ...
# coding:utf-8 import sys INF = float('inf') MOD = 10 ** 9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def II(): return int(sys.stdin.readline()) def SI(): return eval(input()) n, ma, mb = LI() src = [] a_max, b_max = 1, 1 for _ ...
42
46
1,001
1,017
# coding:utf-8 import sys # from collections import Counter, defaultdict INF = float("inf") MOD = 10**9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def II(): return int(sys.stdin.readline()) def SI(): return eval(input()) n...
# coding:utf-8 import sys INF = float("inf") MOD = 10**9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def II(): return int(sys.stdin.readline()) def SI(): return eval(input()) n, ma, mb = LI() src = [] a_max, b_max = 1, 1 fo...
false
8.695652
[ "-# from collections import Counter, defaultdict", "-abc = [tuple(LI()) for _ in range(n)]", "-ab_max = n * 10 + 1", "-dp = [[[INF] * ab_max for _ in range(ab_max)] for _ in range(n + 1)]", "+src = []", "+a_max, b_max = 1, 1", "+for _ in range(n):", "+ a, b, c = LI()", "+ src.append((a, b, c))...
false
0.044332
0.038641
1.14729
[ "s862778338", "s148304592" ]
u642012866
p02684
python
s008349841
s674819180
136
110
32,384
102,276
Accepted
Accepted
19.12
N, K = list(map(int, input().split())) A = list(map(int, ("0 "+eval(input())).split())) c = [0]*(N+1) i = 1 cnt = 0 f = True while cnt < K: if f and (c[A[i]] or A[i]==1): loop = cnt-c[A[i]]+1 cnt += (K-cnt-1)//loop*loop f = False cnt += 1 i = A[i] c[i] = cnt ...
N, K = list(map(int, input().split())) A = [i-1 for i in map(int, input().split())] r = [] f = [-1]*N now = 0 loop = 0 i = 0 while i < K: r.append(now) f[now] = i now = A[now] i += 1 if f[now] >= 0: loop = i-f[now] nokori = K-i print((r[f[now]+nokori%lo...
20
23
319
360
N, K = list(map(int, input().split())) A = list(map(int, ("0 " + eval(input())).split())) c = [0] * (N + 1) i = 1 cnt = 0 f = True while cnt < K: if f and (c[A[i]] or A[i] == 1): loop = cnt - c[A[i]] + 1 cnt += (K - cnt - 1) // loop * loop f = False cnt += 1 i = A[i] c[i] = cnt p...
N, K = list(map(int, input().split())) A = [i - 1 for i in map(int, input().split())] r = [] f = [-1] * N now = 0 loop = 0 i = 0 while i < K: r.append(now) f[now] = i now = A[now] i += 1 if f[now] >= 0: loop = i - f[now] nokori = K - i print((r[f[now] + nokori % loop] + 1)) ...
false
13.043478
[ "-A = list(map(int, (\"0 \" + eval(input())).split()))", "-c = [0] * (N + 1)", "-i = 1", "-cnt = 0", "-f = True", "-while cnt < K:", "- if f and (c[A[i]] or A[i] == 1):", "- loop = cnt - c[A[i]] + 1", "- cnt += (K - cnt - 1) // loop * loop", "- f = False", "- cnt += 1"...
false
0.039091
0.047895
0.816186
[ "s008349841", "s674819180" ]
u256464928
p03659
python
s251142102
s287747202
260
208
28,600
24,936
Accepted
Accepted
20
N = int(eval(input())) A = list(map(int,input().split())) acu = [] acu.append(A[0]) acu_r = [] acu_r.append(A[-1]) for i in range(1,N-1): acu.append(acu[-1] + A[i]) for i in range(N-2,0,-1): acu_r.append(acu_r[-1] + A[i]) #print(acu) #print(acu_r) ans = float("inf") for i in range(N-1): ans = min(an...
N = int(eval(input())) A = list(map(int,input().split())) ans = float("inf") S = sum(A) acu = [] acu.append(A[0]) for i in range(1,N-1): acu.append(acu[-1] + A[i]) for i in range(N-1): ans = min(ans,abs((S - acu[i]) - acu[i])) print(ans)
17
11
364
245
N = int(eval(input())) A = list(map(int, input().split())) acu = [] acu.append(A[0]) acu_r = [] acu_r.append(A[-1]) for i in range(1, N - 1): acu.append(acu[-1] + A[i]) for i in range(N - 2, 0, -1): acu_r.append(acu_r[-1] + A[i]) # print(acu) # print(acu_r) ans = float("inf") for i in range(N - 1): ans = mi...
N = int(eval(input())) A = list(map(int, input().split())) ans = float("inf") S = sum(A) acu = [] acu.append(A[0]) for i in range(1, N - 1): acu.append(acu[-1] + A[i]) for i in range(N - 1): ans = min(ans, abs((S - acu[i]) - acu[i])) print(ans)
false
35.294118
[ "+ans = float(\"inf\")", "+S = sum(A)", "-acu_r = []", "-acu_r.append(A[-1])", "-for i in range(N - 2, 0, -1):", "- acu_r.append(acu_r[-1] + A[i])", "-# print(acu)", "-# print(acu_r)", "-ans = float(\"inf\")", "- ans = min(ans, abs(acu[i] - acu_r[N - (i + 2)]))", "+ ans = min(ans, abs((...
false
0.03712
0.100345
0.369926
[ "s251142102", "s287747202" ]
u644907318
p03252
python
s694474702
s825038298
202
87
41,840
68,472
Accepted
Accepted
56.93
A = {chr(i):0 for i in range(97,123)} S = input().strip() T = input().strip() N = len(S) G = {} for i in range(N): a = S[i] if a not in G: G[a]=[] b = T[i] if b not in G[a]: G[a].append(b) flag = 0 cnt = 0 for a in G: cnt += 1 if len(G[a])>1: flag = 1 ...
S = input().strip() T = input().strip() N = len(S) C = {} D = {} flag = 0 for i in range(N): if S[i] not in C: C[S[i]] = T[i] elif C[S[i]]!=T[i]: flag = 1 break if T[i] not in D: D[T[i]] = S[i] elif D[T[i]] != S[i]: flag = 1 break if flag=...
33
21
564
365
A = {chr(i): 0 for i in range(97, 123)} S = input().strip() T = input().strip() N = len(S) G = {} for i in range(N): a = S[i] if a not in G: G[a] = [] b = T[i] if b not in G[a]: G[a].append(b) flag = 0 cnt = 0 for a in G: cnt += 1 if len(G[a]) > 1: flag = 1 break ...
S = input().strip() T = input().strip() N = len(S) C = {} D = {} flag = 0 for i in range(N): if S[i] not in C: C[S[i]] = T[i] elif C[S[i]] != T[i]: flag = 1 break if T[i] not in D: D[T[i]] = S[i] elif D[T[i]] != S[i]: flag = 1 break if flag == 0: print...
false
36.363636
[ "-A = {chr(i): 0 for i in range(97, 123)}", "-G = {}", "+C = {}", "+D = {}", "+flag = 0", "- a = S[i]", "- if a not in G:", "- G[a] = []", "- b = T[i]", "- if b not in G[a]:", "- G[a].append(b)", "-flag = 0", "-cnt = 0", "-for a in G:", "- cnt += 1", "- ...
false
0.042156
0.044284
0.951934
[ "s694474702", "s825038298" ]
u426534722
p02272
python
s671080542
s726634848
3,870
3,110
61,656
61,652
Accepted
Accepted
19.64
INF = float("inf") cnt = 0 def merge(A, left, mid, right): global cnt n1 = mid - left n2 = right - mid L = A[left: left + n1] + [INF] R = A[mid: mid + n2] + [INF] i = j = 0 for k in range(left, right): cnt += 1 if L[i] <= R[j]: A[k] = L[i] ...
INF = float("inf") cnt = 0 def merge(A, left, mid, right): L = A[left: mid] + [INF] R = A[mid: right] + [INF] i = j = 0 for k in range(left, right): if L[i] <= R[j]: A[k] = L[i] i += 1 else: A[k] = R[j] j += 1 global cnt ...
29
27
684
639
INF = float("inf") cnt = 0 def merge(A, left, mid, right): global cnt n1 = mid - left n2 = right - mid L = A[left : left + n1] + [INF] R = A[mid : mid + n2] + [INF] i = j = 0 for k in range(left, right): cnt += 1 if L[i] <= R[j]: A[k] = L[i] i += 1 ...
INF = float("inf") cnt = 0 def merge(A, left, mid, right): L = A[left:mid] + [INF] R = A[mid:right] + [INF] i = j = 0 for k in range(left, right): if L[i] <= R[j]: A[k] = L[i] i += 1 else: A[k] = R[j] j += 1 global cnt cnt += righ...
false
6.896552
[ "- global cnt", "- n1 = mid - left", "- n2 = right - mid", "- L = A[left : left + n1] + [INF]", "- R = A[mid : mid + n2] + [INF]", "+ L = A[left:mid] + [INF]", "+ R = A[mid:right] + [INF]", "- cnt += 1", "+ global cnt", "+ cnt += right - left" ]
false
0.038911
0.034975
1.112563
[ "s671080542", "s726634848" ]
u740909619
p03730
python
s011354969
s661883451
29
26
9,152
9,172
Accepted
Accepted
10.34
# B - Choose Integers def main(): a, b, c = list(map(int, input().split())) for i in range(1, 1000): if a*i % b == c: print('YES') exit() else: print('NO') if __name__ == "__main__": main()
# B - Choose Integers def main(): a, b, c = list(map(int, input().split())) for i in range(1, a*b+1): if a*i % b == c: print('YES') exit() else: print('NO') if __name__ == "__main__": main()
15
15
258
259
# B - Choose Integers def main(): a, b, c = list(map(int, input().split())) for i in range(1, 1000): if a * i % b == c: print("YES") exit() else: print("NO") if __name__ == "__main__": main()
# B - Choose Integers def main(): a, b, c = list(map(int, input().split())) for i in range(1, a * b + 1): if a * i % b == c: print("YES") exit() else: print("NO") if __name__ == "__main__": main()
false
0
[ "- for i in range(1, 1000):", "+ for i in range(1, a * b + 1):" ]
false
0.037043
0.040947
0.904643
[ "s011354969", "s661883451" ]
u540761833
p02873
python
s157418830
s633650625
443
241
24,096
6,300
Accepted
Accepted
45.6
S = eval(input()) snum = len(S) N = snum +1 Nar = [0 for i in range(N)] for i in range(snum): if S[i] == '<': Nar[i+1] = Nar[i] + 1 for i in reversed(list(range(N-1))): if S[i] == '>': Nar[i] = max(Nar[i],Nar[i+1]+1) sum = 0 for i in Nar: sum += i print(sum)
S = eval(input()) ans = 0 a = [] up = True count = 0 for i in S: if up: if i == '>': a.append(count) count = 1 up = False else: count += 1 else: if i == '<': a.append(count) count = 1 up ...
16
28
291
543
S = eval(input()) snum = len(S) N = snum + 1 Nar = [0 for i in range(N)] for i in range(snum): if S[i] == "<": Nar[i + 1] = Nar[i] + 1 for i in reversed(list(range(N - 1))): if S[i] == ">": Nar[i] = max(Nar[i], Nar[i + 1] + 1) sum = 0 for i in Nar: sum += i print(sum)
S = eval(input()) ans = 0 a = [] up = True count = 0 for i in S: if up: if i == ">": a.append(count) count = 1 up = False else: count += 1 else: if i == "<": a.append(count) count = 1 up = True el...
false
42.857143
[ "-snum = len(S)", "-N = snum + 1", "-Nar = [0 for i in range(N)]", "-for i in range(snum):", "- if S[i] == \"<\":", "- Nar[i + 1] = Nar[i] + 1", "-for i in reversed(list(range(N - 1))):", "- if S[i] == \">\":", "- Nar[i] = max(Nar[i], Nar[i + 1] + 1)", "-sum = 0", "-for i in ...
false
0.050289
0.03666
1.371765
[ "s157418830", "s633650625" ]
u437414880
p02890
python
s550489494
s848419794
555
191
28,664
65,232
Accepted
Accepted
65.59
N=int(input()) AN=list(map(int, input().split())) BN=[0 for i in range(N)] for i in AN: BN[i-1] += 1 BN.sort() LN = [0 for i in range(N)] s = 0 j = 0 try: for X in range(1, N+1): while j<N and BN[j] < X: s += BN[j] j += 1 LN[X-1] = (s + X*(N - j)) / X ...
#!/usr/bin/pypy N=int(input()) AN=list(map(int, input().split())) BN=[0 for i in range(N)] for i in AN: BN[i-1] += 1 BN.sort() LN = [0 for i in range(N)] s = 0 j = 0 try: for X in range(1, N+1): while j<N and BN[j] < X: s += BN[j] j += 1 LN[X-1] = int(...
30
31
554
576
N = int(input()) AN = list(map(int, input().split())) BN = [0 for i in range(N)] for i in AN: BN[i - 1] += 1 BN.sort() LN = [0 for i in range(N)] s = 0 j = 0 try: for X in range(1, N + 1): while j < N and BN[j] < X: s += BN[j] j += 1 LN[X - 1] = (s + X * (N - j)) / X exce...
#!/usr/bin/pypy N = int(input()) AN = list(map(int, input().split())) BN = [0 for i in range(N)] for i in AN: BN[i - 1] += 1 BN.sort() LN = [0 for i in range(N)] s = 0 j = 0 try: for X in range(1, N + 1): while j < N and BN[j] < X: s += BN[j] j += 1 LN[X - 1] = int((s + X...
false
3.225806
[ "+#!/usr/bin/pypy", "- LN[X - 1] = (s + X * (N - j)) / X", "+ LN[X - 1] = int((s + X * (N - j)) / X)" ]
false
0.042776
0.057095
0.749212
[ "s550489494", "s848419794" ]
u229156891
p02791
python
s037409343
s028310179
237
158
75,344
32,388
Accepted
Accepted
33.33
N = int(eval(input())) P = list(map(int, input().split())) cur_min = N+1 count = 0 for i in range(N): if cur_min >= P[i]: cur_min = P[i] count += 1 print(count)
N = int(eval(input())) P = list(map(int, input().split())) Q = [] for i in range(N): if i == 0: Q.append(P[i]) else: Q.append(min(Q[-1], P[i])) cnt = 0 for i in range(N): if P[i] <= Q[i]: cnt += 1 print(cnt)
10
15
184
253
N = int(eval(input())) P = list(map(int, input().split())) cur_min = N + 1 count = 0 for i in range(N): if cur_min >= P[i]: cur_min = P[i] count += 1 print(count)
N = int(eval(input())) P = list(map(int, input().split())) Q = [] for i in range(N): if i == 0: Q.append(P[i]) else: Q.append(min(Q[-1], P[i])) cnt = 0 for i in range(N): if P[i] <= Q[i]: cnt += 1 print(cnt)
false
33.333333
[ "-cur_min = N + 1", "-count = 0", "+Q = []", "- if cur_min >= P[i]:", "- cur_min = P[i]", "- count += 1", "-print(count)", "+ if i == 0:", "+ Q.append(P[i])", "+ else:", "+ Q.append(min(Q[-1], P[i]))", "+cnt = 0", "+for i in range(N):", "+ if P[i] <=...
false
0.048002
0.049215
0.975341
[ "s037409343", "s028310179" ]
u368780724
p03185
python
s305695465
s217922728
1,216
638
124,116
123,572
Accepted
Accepted
47.53
class Lichaotree: #区間は1-indexed #min def __init__(self, X): self.N = len(X) self.N0 = 2**(self.N-1).bit_length() self.comp = {v : k for k, v in enumerate(X)} self.inf = 10**19 self.X = X + [self.inf]*(self.N0 - self.N) self.data = [None]*(2*self.N0) ...
class Lichaotree: #区間は1-indexed #min def __init__(self, X): self.N = len(X) self.N0 = 2**(self.N-1).bit_length() self.comp = {v : k for k, v in enumerate(X)} self.inf = 10**12 self.X = X + [self.inf]*(self.N0 - self.N) self.data = [None]*(2*self.N0) ...
81
100
2,226
2,779
class Lichaotree: # 区間は1-indexed # min def __init__(self, X): self.N = len(X) self.N0 = 2 ** (self.N - 1).bit_length() self.comp = {v: k for k, v in enumerate(X)} self.inf = 10**19 self.X = X + [self.inf] * (self.N0 - self.N) self.data = [None] * (2 * self.N0)...
class Lichaotree: # 区間は1-indexed # min def __init__(self, X): self.N = len(X) self.N0 = 2 ** (self.N - 1).bit_length() self.comp = {v: k for k, v in enumerate(X)} self.inf = 10**12 self.X = X + [self.inf] * (self.N0 - self.N) self.data = [None] * (2 * self.N0)...
false
19
[ "- self.inf = 10**19", "+ self.inf = 10**12", "+ self.start = [0] * (2 * self.N0)", "+ for i in range(1, 2 * self.N0):", "+ if i == i & (-i):", "+ continue", "+ self.start[i] = self.start[i - 1] + self.size[i]", "- l = k - (1 << (...
false
0.036875
0.037765
0.976415
[ "s305695465", "s217922728" ]
u887207211
p03401
python
s848241156
s692349858
225
208
14,048
14,048
Accepted
Accepted
7.56
N = int(eval(input())) A = [0] + list(map(int,input().split())) + [0] dis = 0 for i in range(1, N+2): dis += abs(A[i]-A[i-1]) for i in range(1, N+1): print((dis - abs(A[i] - A[i-1]) - abs(A[i+1] - A[i]) + abs(A[i+1]-A[i-1])))
N = int(eval(input())) A = [0]+list(map(int,input().split()))+[0] maxMoney = sum([abs(A[i+1]-A[i]) for i in range(N+1)]) for i in range(1,N+1): print((maxMoney-abs(A[i-1]-A[i])-abs(A[i+1]-A[i])+abs(A[i+1]-A[i-1])))
7
6
228
214
N = int(eval(input())) A = [0] + list(map(int, input().split())) + [0] dis = 0 for i in range(1, N + 2): dis += abs(A[i] - A[i - 1]) for i in range(1, N + 1): print( (dis - abs(A[i] - A[i - 1]) - abs(A[i + 1] - A[i]) + abs(A[i + 1] - A[i - 1])) )
N = int(eval(input())) A = [0] + list(map(int, input().split())) + [0] maxMoney = sum([abs(A[i + 1] - A[i]) for i in range(N + 1)]) for i in range(1, N + 1): print( ( maxMoney - abs(A[i - 1] - A[i]) - abs(A[i + 1] - A[i]) + abs(A[i + 1] - A[i - 1]) ) ...
false
14.285714
[ "-dis = 0", "-for i in range(1, N + 2):", "- dis += abs(A[i] - A[i - 1])", "+maxMoney = sum([abs(A[i + 1] - A[i]) for i in range(N + 1)])", "- (dis - abs(A[i] - A[i - 1]) - abs(A[i + 1] - A[i]) + abs(A[i + 1] - A[i - 1]))", "+ (", "+ maxMoney", "+ - abs(A[i - 1] ...
false
0.042343
0.042415
0.998307
[ "s848241156", "s692349858" ]
u785989355
p02536
python
s215598392
s241983744
313
93
82,072
27,024
Accepted
Accepted
70.29
class UnionFind(): def __init__(self,size): self.table = [-1 for _ in range(size)] self.member_num = [1 for _ in range(size)] #representative def find(self,x): while self.table[x] >= 0: x = self.table[x] return x def union(self,x,y): s1 ...
code = """ # distutils: language=c++ # distutils: include_dirs=[/home/USERNAME/.local/lib/python3.8/site-packages/numpy/core/include, /opt/ac-library] # cython: boundscheck=False # cython: wraparound=False from libcpp cimport bool from libc.stdio cimport getchar, printf from libcpp.string cimport string fro...
49
91
1,266
2,465
class UnionFind: def __init__(self, size): self.table = [-1 for _ in range(size)] self.member_num = [1 for _ in range(size)] # representative def find(self, x): while self.table[x] >= 0: x = self.table[x] return x def union(self, x, y): s1 = self.fin...
code = """ # distutils: language=c++ # distutils: include_dirs=[/home/USERNAME/.local/lib/python3.8/site-packages/numpy/core/include, /opt/ac-library] # cython: boundscheck=False # cython: wraparound=False from libcpp cimport bool from libc.stdio cimport getchar, printf from libcpp.string cimport string from libcpp.vec...
false
46.153846
[ "-class UnionFind:", "- def __init__(self, size):", "- self.table = [-1 for _ in range(size)]", "- self.member_num = [1 for _ in range(size)]", "+code = \"\"\"", "+# distutils: language=c++", "+# distutils: include_dirs=[/home/USERNAME/.local/lib/python3.8/site-packages/numpy/core/inclu...
false
0.039677
0.120984
0.327948
[ "s215598392", "s241983744" ]
u107077660
p03998
python
s085247690
s235484218
38
24
3,064
3,064
Accepted
Accepted
36.84
sa = eval(input()) sb = eval(input()) sc = eval(input()) card = sa[0] sa = sa[1:] while 1: if card == "a": if not sa: print("A") break else: card = sa[0] sa = sa[1:] elif card == "b": if not sb: print("B") break else: card = sb[0] sb = sb[1:] else: if not sc: ...
sa = eval(input()) sb = eval(input()) sc = eval(input()) players = {"a":sa, "b":sb, "c":sc} if sa[0] == "a": p = "a" sa = sa[1:] elif sb[0] == "b": p = "b" sb = sb[1:] else: p = "c" sc = sc[1:] while players["a"] or players["b"] or players["c"]: if not players[p]: print((p.upper())) exit() ...
28
20
369
362
sa = eval(input()) sb = eval(input()) sc = eval(input()) card = sa[0] sa = sa[1:] while 1: if card == "a": if not sa: print("A") break else: card = sa[0] sa = sa[1:] elif card == "b": if not sb: print("B") break ...
sa = eval(input()) sb = eval(input()) sc = eval(input()) players = {"a": sa, "b": sb, "c": sc} if sa[0] == "a": p = "a" sa = sa[1:] elif sb[0] == "b": p = "b" sb = sb[1:] else: p = "c" sc = sc[1:] while players["a"] or players["b"] or players["c"]: if not players[p]: print((p.upper()...
false
28.571429
[ "-card = sa[0]", "-sa = sa[1:]", "-while 1:", "- if card == \"a\":", "- if not sa:", "- print(\"A\")", "- break", "- else:", "- card = sa[0]", "- sa = sa[1:]", "- elif card == \"b\":", "- if not sb:", "- print(...
false
0.038737
0.037644
1.029032
[ "s085247690", "s235484218" ]
u537782349
p03041
python
s791393814
s021500840
20
17
3,064
2,940
Accepted
Accepted
15
a, b = list(map(int, input().split())) c = eval(input()) d = "" for i in range(len(c)): if i + 1 == b: d += c[i].lower() else: d += c[i] print(d)
a, b = list(map(int, input().split())) c = eval(input()) d = "" for i in range(a): if i == b-1: d += c[i].lower() else: d += c[i] print(d)
9
9
166
159
a, b = list(map(int, input().split())) c = eval(input()) d = "" for i in range(len(c)): if i + 1 == b: d += c[i].lower() else: d += c[i] print(d)
a, b = list(map(int, input().split())) c = eval(input()) d = "" for i in range(a): if i == b - 1: d += c[i].lower() else: d += c[i] print(d)
false
0
[ "-for i in range(len(c)):", "- if i + 1 == b:", "+for i in range(a):", "+ if i == b - 1:" ]
false
0.043275
0.046175
0.937204
[ "s791393814", "s021500840" ]
u450956662
p02923
python
s568984526
s805567277
97
76
14,252
15,020
Accepted
Accepted
21.65
N = int(eval(input())) H = list(map(int, input().split())) inv = 0 max_inv = 0 for n in range(1, N): if H[n] <= H[n-1]: inv += 1 else: inv = 0 max_inv = max(max_inv, inv) print(max_inv)
N = int(eval(input())) H = list(map(int, input().split())) inv = 0 max_inv = 0 for n in range(1, N): if H[n] <= H[n-1]: inv += 1 else: max_inv = max(max_inv, inv) inv = 0 max_inv = max(max_inv, inv) print(max_inv)
15
15
230
257
N = int(eval(input())) H = list(map(int, input().split())) inv = 0 max_inv = 0 for n in range(1, N): if H[n] <= H[n - 1]: inv += 1 else: inv = 0 max_inv = max(max_inv, inv) print(max_inv)
N = int(eval(input())) H = list(map(int, input().split())) inv = 0 max_inv = 0 for n in range(1, N): if H[n] <= H[n - 1]: inv += 1 else: max_inv = max(max_inv, inv) inv = 0 max_inv = max(max_inv, inv) print(max_inv)
false
0
[ "+ max_inv = max(max_inv, inv)", "- max_inv = max(max_inv, inv)", "+max_inv = max(max_inv, inv)" ]
false
0.040238
0.037821
1.063906
[ "s568984526", "s805567277" ]
u072053884
p02418
python
s335260165
s984325909
50
20
7,492
7,472
Accepted
Accepted
60
s = eval(input()) p = eval(input()) p_len = len(p) if p in s: print("Yes") else: for i in range(p_len): if (p[:i] == s[-i:]) and (p[i:] == s[:p_len - i]): print("Yes") break else: print("No")
s = eval(input()) p = eval(input()) if p in (s * 2): print("Yes") else: print("No")
13
7
244
86
s = eval(input()) p = eval(input()) p_len = len(p) if p in s: print("Yes") else: for i in range(p_len): if (p[:i] == s[-i:]) and (p[i:] == s[: p_len - i]): print("Yes") break else: print("No")
s = eval(input()) p = eval(input()) if p in (s * 2): print("Yes") else: print("No")
false
46.153846
[ "-p_len = len(p)", "-if p in s:", "+if p in (s * 2):", "- for i in range(p_len):", "- if (p[:i] == s[-i:]) and (p[i:] == s[: p_len - i]):", "- print(\"Yes\")", "- break", "- else:", "- print(\"No\")", "+ print(\"No\")" ]
false
0.06865
0.040967
1.675726
[ "s335260165", "s984325909" ]
u135346354
p02760
python
s549599987
s954321178
170
18
38,256
3,064
Accepted
Accepted
89.41
card = [list(map(int,input().split())) for i in range(3)] n = int(input()) for i in range(n): num = int(input()) for i in range(3): for j in range(3): if card[i][j] == num: card[i][j] = 0 for i in range(3): if (card[0][i] == 0 and card[1][i] == 0 and card[2][i] ...
import sys table = [list(map(int, input().split())) for _ in range(3)] N = int(input()) for _ in range(N): cmd = int(input()) for i in range(3): for j in range(3): if table[i][j] == cmd: table[i][j] = -1 break for i in range(3): if (table[i][0]=...
18
20
609
657
card = [list(map(int, input().split())) for i in range(3)] n = int(input()) for i in range(n): num = int(input()) for i in range(3): for j in range(3): if card[i][j] == num: card[i][j] = 0 for i in range(3): if (card[0][i] == 0 and card[1][i] == 0 and card[2][i] == 0) or ...
import sys table = [list(map(int, input().split())) for _ in range(3)] N = int(input()) for _ in range(N): cmd = int(input()) for i in range(3): for j in range(3): if table[i][j] == cmd: table[i][j] = -1 break for i in range(3): if (table[i][0] == -1 and ...
false
10
[ "-card = [list(map(int, input().split())) for i in range(3)]", "-n = int(input())", "-for i in range(n):", "- num = int(input())", "+import sys", "+", "+table = [list(map(int, input().split())) for _ in range(3)]", "+N = int(input())", "+for _ in range(N):", "+ cmd = int(input())", "- ...
false
0.040298
0.035465
1.136268
[ "s549599987", "s954321178" ]
u225388820
p02953
python
s719750835
s753036818
85
78
14,224
14,252
Accepted
Accepted
8.24
N = int(eval(input())) A=list(map(int,input().split())) ask=0 #N-1~1までループ for x in range(N-1,0,-1): if A[x]-A[x-1]<0: A[x-1]=A[x-1]-1 for x in range(1,N): if A[x]-A[x-1]<0: ask=1 break if ask==0: print('Yes') else: print('No')
n=int(eval(input())) h=list(map(int,input().split())) for i in range(n-2,-1,-1): if h[i]>h[i+1]: h[i]-=1 for i in range(n-1): if h[i]>h[i+1]: print("No") exit() print("Yes")
15
10
275
208
N = int(eval(input())) A = list(map(int, input().split())) ask = 0 # N-1~1までループ for x in range(N - 1, 0, -1): if A[x] - A[x - 1] < 0: A[x - 1] = A[x - 1] - 1 for x in range(1, N): if A[x] - A[x - 1] < 0: ask = 1 break if ask == 0: print("Yes") else: print("No")
n = int(eval(input())) h = list(map(int, input().split())) for i in range(n - 2, -1, -1): if h[i] > h[i + 1]: h[i] -= 1 for i in range(n - 1): if h[i] > h[i + 1]: print("No") exit() print("Yes")
false
33.333333
[ "-N = int(eval(input()))", "-A = list(map(int, input().split()))", "-ask = 0", "-# N-1~1までループ", "-for x in range(N - 1, 0, -1):", "- if A[x] - A[x - 1] < 0:", "- A[x - 1] = A[x - 1] - 1", "-for x in range(1, N):", "- if A[x] - A[x - 1] < 0:", "- ask = 1", "- break", ...
false
0.03577
0.036808
0.971792
[ "s719750835", "s753036818" ]
u196675341
p02802
python
s008494874
s056810382
347
302
15,320
4,596
Accepted
Accepted
12.97
N, M = list(map(int, input().strip().split(" "))) p = [] s = [] ans = [0]*N c_wa = [0]*N pena = 0 for i in range(M): temp1, temp2 = input().strip().split(" ") p.append(int(temp1)) s.append(str(temp2)) for j in range(M): if s[j] == "WA": if ans[p[j]-1] == 0: ...
N, M = list(map(int,input().split(" "))) ans = [0]*N wc_c = [0]*N pena = 0 for i in range(M): p, s = input().split(" ") p = int(p) - 1 s = str(s) if s == "AC" and ans[p] == 0: ans[p] = 1 pena += wc_c[p] elif s == "WA" and ans[p] == 0: wc_c[p] +...
40
21
687
364
N, M = list(map(int, input().strip().split(" "))) p = [] s = [] ans = [0] * N c_wa = [0] * N pena = 0 for i in range(M): temp1, temp2 = input().strip().split(" ") p.append(int(temp1)) s.append(str(temp2)) for j in range(M): if s[j] == "WA": if ans[p[j] - 1] == 0: c_wa[p[j] - 1] += 1 ...
N, M = list(map(int, input().split(" "))) ans = [0] * N wc_c = [0] * N pena = 0 for i in range(M): p, s = input().split(" ") p = int(p) - 1 s = str(s) if s == "AC" and ans[p] == 0: ans[p] = 1 pena += wc_c[p] elif s == "WA" and ans[p] == 0: wc_c[p] += 1 print((sum(ans), pena))...
false
47.5
[ "-N, M = list(map(int, input().strip().split(\" \")))", "-p = []", "-s = []", "+N, M = list(map(int, input().split(\" \")))", "-c_wa = [0] * N", "+wc_c = [0] * N", "- temp1, temp2 = input().strip().split(\" \")", "- p.append(int(temp1))", "- s.append(str(temp2))", "-for j in range(M):", ...
false
0.051548
0.048039
1.073057
[ "s008494874", "s056810382" ]
u638795007
p04035
python
s381821550
s668418103
292
163
65,424
20,088
Accepted
Accepted
44.18
def examA(): a, b = LI() if a>0: ans = "Positive" print(ans) return if b>=0: ans = "Zero" else: judge = b-a if judge%2==1: ans = "Positive" else: ans = "Negative" print(ans) return def examB(): ...
def examA(): a, b = LI() if b<a: a,b = b,a if a<=0 and 0<=b: print("Zero") elif 0<a: print("Positive") else: judge = b-a+1 if judge%2==0: print("Positive") else: print("Negative") return def examB(): N,...
69
107
1,575
2,148
def examA(): a, b = LI() if a > 0: ans = "Positive" print(ans) return if b >= 0: ans = "Zero" else: judge = b - a if judge % 2 == 1: ans = "Positive" else: ans = "Negative" print(ans) return def examB(): N, M =...
def examA(): a, b = LI() if b < a: a, b = b, a if a <= 0 and 0 <= b: print("Zero") elif 0 < a: print("Positive") else: judge = b - a + 1 if judge % 2 == 0: print("Positive") else: print("Negative") return def examB(): ...
false
35.514019
[ "- if a > 0:", "- ans = \"Positive\"", "- print(ans)", "- return", "- if b >= 0:", "- ans = \"Zero\"", "+ if b < a:", "+ a, b = b, a", "+ if a <= 0 and 0 <= b:", "+ print(\"Zero\")", "+ elif 0 < a:", "+ print(\"Positive\")", "- ...
false
0.048455
0.047489
1.020326
[ "s381821550", "s668418103" ]
u506858457
p02689
python
s668774022
s594577386
390
355
29,440
29,356
Accepted
Accepted
8.97
N,M=list(map(int,input().split())) H=list(map(int,input().split())) L=[[] for i in range(N)] for i in range(M): A,B=list(map(int,input().split())) A-=1 B-=1 L[A].append(B) L[B].append(A) ans=0 for i in range(N): flag=True for j in L[i]: if H[i]<=H[j]: flag=False break if ...
N,M=list(map(int,input().split())) H=list(map(int,input().split())) links=[[] for i in range(N)] for i in range(M): A,B=list(map(int,input().split())) A-=1 B-=1 links[A].append(B) links[B].append(A) ans=0 for i in range(N): flag=True for j in links[i]: if H[i]<=H[j]: flag=False ...
19
19
337
359
N, M = list(map(int, input().split())) H = list(map(int, input().split())) L = [[] for i in range(N)] for i in range(M): A, B = list(map(int, input().split())) A -= 1 B -= 1 L[A].append(B) L[B].append(A) ans = 0 for i in range(N): flag = True for j in L[i]: if H[i] <= H[j]: ...
N, M = list(map(int, input().split())) H = list(map(int, input().split())) links = [[] for i in range(N)] for i in range(M): A, B = list(map(int, input().split())) A -= 1 B -= 1 links[A].append(B) links[B].append(A) ans = 0 for i in range(N): flag = True for j in links[i]: if H[i] <=...
false
0
[ "-L = [[] for i in range(N)]", "+links = [[] for i in range(N)]", "- L[A].append(B)", "- L[B].append(A)", "+ links[A].append(B)", "+ links[B].append(A)", "- for j in L[i]:", "+ for j in links[i]:" ]
false
0.037372
0.04327
0.863705
[ "s668774022", "s594577386" ]
u439396449
p03078
python
s364569792
s265113831
113
43
8,708
4,976
Accepted
Accepted
61.95
X, Y, Z, K = list(map(int, input().split())) A = [int(x) for x in input().split()] B = [int(x) for x in input().split()] C = [int(x) for x in input().split()] A.sort(reverse=True) B.sort(reverse=True) C.sort(reverse=True) D = [] for i in range(X): for j in range(Y): if (i + 1) * (j + 1) > K: ...
import heapq X, Y, Z, K = list(map(int, input().split())) A = [int(x) for x in input().split()] + [float('-inf')] B = [int(x) for x in input().split()] + [float('-inf')] C = [int(x) for x in input().split()] + [float('-inf')] A.sort(reverse=True) B.sort(reverse=True) C.sort(reverse=True) def f(i, j, k):...
22
41
534
857
X, Y, Z, K = list(map(int, input().split())) A = [int(x) for x in input().split()] B = [int(x) for x in input().split()] C = [int(x) for x in input().split()] A.sort(reverse=True) B.sort(reverse=True) C.sort(reverse=True) D = [] for i in range(X): for j in range(Y): if (i + 1) * (j + 1) > K: bre...
import heapq X, Y, Z, K = list(map(int, input().split())) A = [int(x) for x in input().split()] + [float("-inf")] B = [int(x) for x in input().split()] + [float("-inf")] C = [int(x) for x in input().split()] + [float("-inf")] A.sort(reverse=True) B.sort(reverse=True) C.sort(reverse=True) def f(i, j, k): x = A[i]...
false
46.341463
[ "+import heapq", "+", "-A = [int(x) for x in input().split()]", "-B = [int(x) for x in input().split()]", "-C = [int(x) for x in input().split()]", "+A = [int(x) for x in input().split()] + [float(\"-inf\")]", "+B = [int(x) for x in input().split()] + [float(\"-inf\")]", "+C = [int(x) for x in input()...
false
0.036419
0.062988
0.578188
[ "s364569792", "s265113831" ]
u408260374
p00744
python
s557008913
s172063233
22,220
20,120
64,236
107,152
Accepted
Accepted
9.45
import collections import fractions class Dinic: """Dinic Algorithm: find max-flow complexity: O(EV^2) used in GRL6A(AOJ) """ class edge: def __init__(self, to, cap, rev): self.to, self.cap, self.rev = to, cap, rev def __init__(self, V, E, source, sink):...
import collections import fractions range = xrange; input = raw_input class Dinic: """Dinic Algorithm: find max-flow complexity: O(EV^2) used in GRL6A(AOJ) """ class edge: def __init__(self, to, cap, rev): self.to, self.cap, self.rev = to, cap, rev def ...
98
99
3,003
3,038
import collections import fractions class Dinic: """Dinic Algorithm: find max-flow complexity: O(EV^2) used in GRL6A(AOJ) """ class edge: def __init__(self, to, cap, rev): self.to, self.cap, self.rev = to, cap, rev def __init__(self, V, E, source, sink): """V: the...
import collections import fractions range = xrange input = raw_input class Dinic: """Dinic Algorithm: find max-flow complexity: O(EV^2) used in GRL6A(AOJ) """ class edge: def __init__(self, to, cap, rev): self.to, self.cap, self.rev = to, cap, rev def __init__(self, V, E...
false
1.010101
[ "+", "+range = xrange", "+input = raw_input" ]
false
0.138104
0.118909
1.161431
[ "s557008913", "s172063233" ]
u747837595
p03243
python
s932803810
s054731833
325
148
22,448
12,472
Accepted
Accepted
54.46
import sys import numpy as np a=[int(x)for x in list(sys.stdin.readline()[0:3])]+[-1] print((str(a[0]+(1if(np.trim_zeros(np.diff(a))[0]>0)else 0))*3))
import sys import numpy as np a=[int(x)for x in list(sys.stdin.readline()[:3])]+[0] print(((a[0]+(1if(np.trim_zeros(np.diff(a))[0]>0)else 0))*111))
4
4
152
149
import sys import numpy as np a = [int(x) for x in list(sys.stdin.readline()[0:3])] + [-1] print((str(a[0] + (1 if (np.trim_zeros(np.diff(a))[0] > 0) else 0)) * 3))
import sys import numpy as np a = [int(x) for x in list(sys.stdin.readline()[:3])] + [0] print(((a[0] + (1 if (np.trim_zeros(np.diff(a))[0] > 0) else 0)) * 111))
false
0
[ "-a = [int(x) for x in list(sys.stdin.readline()[0:3])] + [-1]", "-print((str(a[0] + (1 if (np.trim_zeros(np.diff(a))[0] > 0) else 0)) * 3))", "+a = [int(x) for x in list(sys.stdin.readline()[:3])] + [0]", "+print(((a[0] + (1 if (np.trim_zeros(np.diff(a))[0] > 0) else 0)) * 111))" ]
false
0.256186
0.374801
0.683524
[ "s932803810", "s054731833" ]
u638456847
p03600
python
s780020672
s432596737
554
380
43,484
43,228
Accepted
Accepted
31.41
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines def main(): N = int(readline()) A = [[int(i) for i in readline().split()] for _ in range(N)] via_min = [[10**15] * N for _ in range(N)] for i in range(N): for j in range(N): ...
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines def main(): N = int(readline()) A = [[int(i) for i in readline().split()] for _ in range(N)] via_min = [[10**15] * N for _ in range(N)] ans = 0 for i in range(N-1): for j in range(i...
34
36
830
849
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines def main(): N = int(readline()) A = [[int(i) for i in readline().split()] for _ in range(N)] via_min = [[10**15] * N for _ in range(N)] for i in range(N): for j in range(N): for k in ran...
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines def main(): N = int(readline()) A = [[int(i) for i in readline().split()] for _ in range(N)] via_min = [[10**15] * N for _ in range(N)] ans = 0 for i in range(N - 1): for j in range(i + 1, N): ...
false
5.555556
[ "- for i in range(N):", "- for j in range(N):", "+ ans = 0", "+ for i in range(N - 1):", "+ for j in range(i + 1, N):", "+ d = A[i][j]", "+ flag = True", "- via_min[i][j] = min(via_min[i][j], A[i][k] + A[k][j])", "- ans = 0", "- for...
false
0.036423
0.036748
0.991148
[ "s780020672", "s432596737" ]
u499381410
p02949
python
s314571217
s315342333
1,146
893
76,504
65,116
Accepted
Accepted
22.08
from collections import deque NegInf = -float('inf') n, m, p = list(map(int, input().split())) graph = [[] for _ in range(n)] for i in range(m): a, b, c = list(map(int, input().split())) graph[a-1].append((b-1, c-p)) def bellman_ford(vst, graph, node_num, NegInf): costs = [NegInf] * node_num...
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, ...
48
68
1,152
1,917
from collections import deque NegInf = -float("inf") n, m, p = list(map(int, input().split())) graph = [[] for _ in range(n)] for i in range(m): a, b, c = list(map(int, input().split())) graph[a - 1].append((b - 1, c - p)) def bellman_ford(vst, graph, node_num, NegInf): costs = [NegInf] * node_num co...
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, floor fro...
false
29.411765
[ "-from collections import deque", "+from collections import defaultdict, deque, Counter", "+from heapq import heappush, heappop, heapify", "+import math", "+import bisect", "+import random", "+from itertools import permutations, accumulate, combinations, product", "+import sys", "+import string", ...
false
0.069358
0.081498
0.85104
[ "s314571217", "s315342333" ]
u547167033
p03762
python
s701397663
s279401334
275
167
83,812
18,624
Accepted
Accepted
39.27
n,m=list(map(int,input().split())) x=[0]+list(map(int,input().split())) y=[0]+list(map(int,input().split())) mod=10**9+7 a1,a2=0,0 for k in range(1,n+1): a1+=(k*2-n-1)*x[k] for k in range(1,m+1): a2+=(k*2-m-1)*y[k] print(((a1*a2)%mod))
n,m=list(map(int,input().split())) x=list(map(int,input().split())) y=list(map(int,input().split())) mod=10**9+7 x.sort() y.sort() sx,sy=0,0 for k in range(1,n+1): sx+=(2*k-n-1)*x[k-1] sx%=mod for k in range(1,m+1): sy+=(2*k-m-1)*y[k-1] sy%=mod print(((sx*sy)%mod))
10
14
240
278
n, m = list(map(int, input().split())) x = [0] + list(map(int, input().split())) y = [0] + list(map(int, input().split())) mod = 10**9 + 7 a1, a2 = 0, 0 for k in range(1, n + 1): a1 += (k * 2 - n - 1) * x[k] for k in range(1, m + 1): a2 += (k * 2 - m - 1) * y[k] print(((a1 * a2) % mod))
n, m = list(map(int, input().split())) x = list(map(int, input().split())) y = list(map(int, input().split())) mod = 10**9 + 7 x.sort() y.sort() sx, sy = 0, 0 for k in range(1, n + 1): sx += (2 * k - n - 1) * x[k - 1] sx %= mod for k in range(1, m + 1): sy += (2 * k - m - 1) * y[k - 1] sy %= mod print((...
false
28.571429
[ "-x = [0] + list(map(int, input().split()))", "-y = [0] + list(map(int, input().split()))", "+x = list(map(int, input().split()))", "+y = list(map(int, input().split()))", "-a1, a2 = 0, 0", "+x.sort()", "+y.sort()", "+sx, sy = 0, 0", "- a1 += (k * 2 - n - 1) * x[k]", "+ sx += (2 * k - n - 1)...
false
0.043011
0.041214
1.043603
[ "s701397663", "s279401334" ]
u472065247
p03108
python
s035004924
s975738046
525
287
25,076
25,332
Accepted
Accepted
45.33
class UnionFind(): def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: self.parents[x] = self.find(self.parents[x]) return self.parents[x] def union(self, x, y): ...
def find(x): if P[x] < 0: return x else: P[x] = find(P[x]) return P[x] N, M, *X = list(map(int,open(0).read().split())) P = [-1] * (N + 1) S = N * (N - 1) // 2 r = [S] while X: b, a = find(X.pop()), find(X.pop()) if a != b: S -= P[a] * P[b] if P[a] > P[b]: a, b = b, ...
47
24
980
397
class UnionFind: def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: self.parents[x] = self.find(self.parents[x]) return self.parents[x] def union(self, x, y): x = se...
def find(x): if P[x] < 0: return x else: P[x] = find(P[x]) return P[x] N, M, *X = list(map(int, open(0).read().split())) P = [-1] * (N + 1) S = N * (N - 1) // 2 r = [S] while X: b, a = find(X.pop()), find(X.pop()) if a != b: S -= P[a] * P[b] if P[a] > P[b]: ...
false
48.93617
[ "-class UnionFind:", "- def __init__(self, n):", "- self.n = n", "- self.parents = [-1] * n", "-", "- def find(self, x):", "- if self.parents[x] < 0:", "- return x", "- else:", "- self.parents[x] = self.find(self.parents[x])", "- ...
false
0.048805
0.143502
0.340097
[ "s035004924", "s975738046" ]
u912237403
p00047
python
s262136389
s604116211
20
10
4,204
4,188
Accepted
Accepted
50
import sys x = [1,0,0] L = "ABC" for s in sys.stdin: a = L.index(s[0]) b = L.index(s[2]) x[a],x[b]=x[b],x[a] print(L[x.index(1)])
import sys p="A" for s in sys.stdin: if p==s[0]: p=s[2] elif p==s[2]: p=s[0] print(p)
9
7
149
100
import sys x = [1, 0, 0] L = "ABC" for s in sys.stdin: a = L.index(s[0]) b = L.index(s[2]) x[a], x[b] = x[b], x[a] print(L[x.index(1)])
import sys p = "A" for s in sys.stdin: if p == s[0]: p = s[2] elif p == s[2]: p = s[0] print(p)
false
22.222222
[ "-x = [1, 0, 0]", "-L = \"ABC\"", "+p = \"A\"", "- a = L.index(s[0])", "- b = L.index(s[2])", "- x[a], x[b] = x[b], x[a]", "-print(L[x.index(1)])", "+ if p == s[0]:", "+ p = s[2]", "+ elif p == s[2]:", "+ p = s[0]", "+print(p)" ]
false
0.037233
0.041259
0.902402
[ "s262136389", "s604116211" ]
u070201429
p02567
python
s371619107
s415781109
2,710
448
27,956
94,232
Accepted
Accepted
83.47
# Reference: https://qiita.com/dn6049949/items/afa12d5d079f518de368 # self.data: 1-indexed # __1__ # _2_ _3_ # 4 5 6 7 # f(f(a, b), c) == f(a, f(b, c)) class SegmentTree: # a = [default] * n def __init__(self, n, f=max, default=-10**18): self.num_leaf = 1 while self.num_lea...
# Reference: https://qiita.com/dn6049949/items/afa12d5d079f518de368 # self.data: 1-indexed # __1__ # _2_ _3_ # 4 5 6 7 # f(f(a, b), c) == f(a, f(b, c)) class SegmentTree: # a = [default] * n # O(n) def __init__(self, n, f=max, default=-10**18): self.num_leaf = 2 ** (n-1).bi...
90
89
2,588
2,424
# Reference: https://qiita.com/dn6049949/items/afa12d5d079f518de368 # self.data: 1-indexed # __1__ # _2_ _3_ # 4 5 6 7 # f(f(a, b), c) == f(a, f(b, c)) class SegmentTree: # a = [default] * n def __init__(self, n, f=max, default=-(10**18)): self.num_leaf = 1 while self.num_leaf < n: ...
# Reference: https://qiita.com/dn6049949/items/afa12d5d079f518de368 # self.data: 1-indexed # __1__ # _2_ _3_ # 4 5 6 7 # f(f(a, b), c) == f(a, f(b, c)) class SegmentTree: # a = [default] * n # O(n) def __init__(self, n, f=max, default=-(10**18)): self.num_leaf = 2 ** (n - 1).bit_length() ...
false
1.111111
[ "+ # O(n)", "- self.num_leaf = 1", "- while self.num_leaf < n:", "- self.num_leaf *= 2", "+ self.num_leaf = 2 ** (n - 1).bit_length()", "+ # O(log(n))", "+ # O(log(n))", "- if l & 1: # l % 2 == 1", "+ if l & 1:", "- if not ...
false
0.040239
0.039462
1.019679
[ "s371619107", "s415781109" ]
u633255271
p02584
python
s592055705
s297517426
70
62
61,920
61,948
Accepted
Accepted
11.43
X, K, D = list(map(int, input().split())) if abs(X) > K*D: print((abs(X) - K*D)) else: X = abs(X) K -= X//D X = X%D if K%2 == 0: print(X) else: print((abs(X-D)))
X, K, D = list(map(int, input().split())) X = abs(X) if X > K*D: print((X-K*D)) else: K -= X//D X %= D if K%2 == 0: print(X) else: print((D-X))
12
11
209
185
X, K, D = list(map(int, input().split())) if abs(X) > K * D: print((abs(X) - K * D)) else: X = abs(X) K -= X // D X = X % D if K % 2 == 0: print(X) else: print((abs(X - D)))
X, K, D = list(map(int, input().split())) X = abs(X) if X > K * D: print((X - K * D)) else: K -= X // D X %= D if K % 2 == 0: print(X) else: print((D - X))
false
8.333333
[ "-if abs(X) > K * D:", "- print((abs(X) - K * D))", "+X = abs(X)", "+if X > K * D:", "+ print((X - K * D))", "- X = abs(X)", "- X = X % D", "+ X %= D", "- print((abs(X - D)))", "+ print((D - X))" ]
false
0.047284
0.087165
0.542462
[ "s592055705", "s297517426" ]
u606045429
p03831
python
s875733846
s062570529
80
71
14,052
14,052
Accepted
Accepted
11.25
def main(): N, A, B, *X = list(map(int, open(0).read().split())) print((sum(min(B, A * (X[i + 1] - X[i])) for i in range(N - 1)))) main()
def main(): N, A, B, *X = list(map(int, open(0).read().split())) print((sum(min(B, A * (X[i + 1] - X[i])) for i in range(N - 1)))) if __name__ == "__main__": main()
5
6
142
174
def main(): N, A, B, *X = list(map(int, open(0).read().split())) print((sum(min(B, A * (X[i + 1] - X[i])) for i in range(N - 1)))) main()
def main(): N, A, B, *X = list(map(int, open(0).read().split())) print((sum(min(B, A * (X[i + 1] - X[i])) for i in range(N - 1)))) if __name__ == "__main__": main()
false
16.666667
[ "-main()", "+if __name__ == \"__main__\":", "+ main()" ]
false
0.038705
0.041006
0.943894
[ "s875733846", "s062570529" ]
u993622994
p03294
python
s273222460
s145399513
172
19
5,344
3,316
Accepted
Accepted
88.95
import fractions from functools import reduce n = int(eval(input())) a = list(map(int, input().split())) ans = 0 def lcm_base(x, y): return (x * y) // fractions.gcd(x, y) def lcm(*numbers): return reduce(lcm_base, numbers, 1) num = lcm(*a) - 1 for i in range(n): ans += num % a[i] pri...
n = int(eval(input())) a = list(map(int, input().split())) ans = sum(a) - n print(ans)
19
5
321
85
import fractions from functools import reduce n = int(eval(input())) a = list(map(int, input().split())) ans = 0 def lcm_base(x, y): return (x * y) // fractions.gcd(x, y) def lcm(*numbers): return reduce(lcm_base, numbers, 1) num = lcm(*a) - 1 for i in range(n): ans += num % a[i] print(ans)
n = int(eval(input())) a = list(map(int, input().split())) ans = sum(a) - n print(ans)
false
73.684211
[ "-import fractions", "-from functools import reduce", "-", "-ans = 0", "-", "-", "-def lcm_base(x, y):", "- return (x * y) // fractions.gcd(x, y)", "-", "-", "-def lcm(*numbers):", "- return reduce(lcm_base, numbers, 1)", "-", "-", "-num = lcm(*a) - 1", "-for i in range(n):", "...
false
0.120418
0.089645
1.343278
[ "s273222460", "s145399513" ]
u811132356
p03146
python
s886330850
s689617319
1,980
26
10,900
3,064
Accepted
Accepted
98.69
s=int(eval(input())) a=[s] for i in range(1000000): if a[i]%2==0: a.append(int(a[i]/2)) else: a.append(int(3*a[i]+1)) a_duplicate=sorted([j for j in set(a) if a.count(j)>1],key=a.index) a[a.index(a_duplicate[0])]=0 print((a.index((a_duplicate[0]))+1))
s=int(eval(input())) a=[s] i=0 while True: if a[i]%2==0: a.append(int(a[i]/2)) i+=1 else: a.append(int(3*a[i]+1)) i+=1 if [j for j in set(a) if a.count(j)>1]: a_duplicate=sorted([j for j in set(a) if a.count(j)>1],key=a.index) break a[a.index(a_du...
13
19
285
377
s = int(eval(input())) a = [s] for i in range(1000000): if a[i] % 2 == 0: a.append(int(a[i] / 2)) else: a.append(int(3 * a[i] + 1)) a_duplicate = sorted([j for j in set(a) if a.count(j) > 1], key=a.index) a[a.index(a_duplicate[0])] = 0 print((a.index((a_duplicate[0])) + 1))
s = int(eval(input())) a = [s] i = 0 while True: if a[i] % 2 == 0: a.append(int(a[i] / 2)) i += 1 else: a.append(int(3 * a[i] + 1)) i += 1 if [j for j in set(a) if a.count(j) > 1]: a_duplicate = sorted([j for j in set(a) if a.count(j) > 1], key=a.index) break ...
false
31.578947
[ "-for i in range(1000000):", "+i = 0", "+while True:", "+ i += 1", "-a_duplicate = sorted([j for j in set(a) if a.count(j) > 1], key=a.index)", "+ i += 1", "+ if [j for j in set(a) if a.count(j) > 1]:", "+ a_duplicate = sorted([j for j in set(a) if a.count(j) > 1], key=a.index)...
false
0.005677
0.064617
0.08785
[ "s886330850", "s689617319" ]
u472065247
p03798
python
s094124967
s023751451
152
136
4,980
5,644
Accepted
Accepted
10.53
N = int(eval(input())) s = eval(input()) l = [1] * N # S: 1, W: 0 for a0, a1 in ((0, 0), (0, 1), (1, 0), (1, 1)): l[0] = a0 l[1] = a1 for i in range(1, N - 1): if s[i] == 'o': if l[i] == 1: l[i + 1] = l[i - 1] else: l[i + 1] = not l[i - 1] else: if l[i] ...
N = int(eval(input())) s = eval(input()) s += s[0] # S: 1, W: 0 for a0, a1 in ((0, 0), (0, 1), (1, 0), (1, 1)): l = [a0, a1] for i in range(1, N + 1): if s[i] == 'o': l.append(not (l[i] ^ l[i - 1])) else: l.append(l[i] ^ l[i - 1]) if (l[0] == l[-2]) and (l[1] == l[-1]): s = ''.join(['S...
49
18
934
385
N = int(eval(input())) s = eval(input()) l = [1] * N # S: 1, W: 0 for a0, a1 in ((0, 0), (0, 1), (1, 0), (1, 1)): l[0] = a0 l[1] = a1 for i in range(1, N - 1): if s[i] == "o": if l[i] == 1: l[i + 1] = l[i - 1] else: l[i + 1] = not l[i - 1] ...
N = int(eval(input())) s = eval(input()) s += s[0] # S: 1, W: 0 for a0, a1 in ((0, 0), (0, 1), (1, 0), (1, 1)): l = [a0, a1] for i in range(1, N + 1): if s[i] == "o": l.append(not (l[i] ^ l[i - 1])) else: l.append(l[i] ^ l[i - 1]) if (l[0] == l[-2]) and (l[1] == l[-1]...
false
63.265306
[ "-l = [1] * N", "+s += s[0]", "- l[0] = a0", "- l[1] = a1", "- for i in range(1, N - 1):", "+ l = [a0, a1]", "+ for i in range(1, N + 1):", "- if l[i] == 1:", "- l[i + 1] = l[i - 1]", "- else:", "- l[i + 1] = not l[i - 1]", "+ ...
false
0.043487
0.044615
0.974713
[ "s094124967", "s023751451" ]
u373047809
p03212
python
s041960665
s062314017
94
67
3,064
3,060
Accepted
Accepted
28.72
#!/usr/bin/env python3 n = int(eval(input())) def dfs(k): # k : str if int(k) > n: return 0 c = 1 if all(k.count(t) for t in "753") else 0 # k judge for t in "753": c += dfs(k + t) return c print((dfs("0")))
#!/usr/bin/env python3 from itertools import* n = int(eval(input())) c = 0 k = "357" for i in range(3, -~len(str(n))): for j in product(k, repeat = i): if all(j.count(h) for h in k): if int("".join(j)) <= n: c += 1 print(c)
10
12
235
269
#!/usr/bin/env python3 n = int(eval(input())) def dfs(k): # k : str if int(k) > n: return 0 c = 1 if all(k.count(t) for t in "753") else 0 # k judge for t in "753": c += dfs(k + t) return c print((dfs("0")))
#!/usr/bin/env python3 from itertools import * n = int(eval(input())) c = 0 k = "357" for i in range(3, -~len(str(n))): for j in product(k, repeat=i): if all(j.count(h) for h in k): if int("".join(j)) <= n: c += 1 print(c)
false
16.666667
[ "+from itertools import *", "+", "-", "-", "-def dfs(k): # k : str", "- if int(k) > n:", "- return 0", "- c = 1 if all(k.count(t) for t in \"753\") else 0 # k judge", "- for t in \"753\":", "- c += dfs(k + t)", "- return c", "-", "-", "-print((dfs(\"0\")))", "...
false
0.090189
0.049617
1.817705
[ "s041960665", "s062314017" ]
u998741086
p03296
python
s819127711
s106224378
31
28
9,052
9,188
Accepted
Accepted
9.68
#!/usr/bin/env python n = int(eval(input())) a = list(map(int, input().split())) s = [] tmp = 1 for i in range(1, n): if a[i] == a[i-1]: tmp += 1 if i == n-1: s.append(tmp) else: if tmp != 1: s.append(tmp) tmp = 1 ans = 0 for i in ...
#!/usr/bin/env python n = int(eval(input())) a = list(map(int, input().split())) s = [] tmp = 1 for i in range(n-1): if a[i] == a[i+1]: tmp += 1 if i == n-2: s.append(tmp) else: if tmp != 1: s.append(tmp) tmp = 1 ans = 0 for i in s:...
22
22
348
346
#!/usr/bin/env python n = int(eval(input())) a = list(map(int, input().split())) s = [] tmp = 1 for i in range(1, n): if a[i] == a[i - 1]: tmp += 1 if i == n - 1: s.append(tmp) else: if tmp != 1: s.append(tmp) tmp = 1 ans = 0 for i in s: ans += i // 2 ...
#!/usr/bin/env python n = int(eval(input())) a = list(map(int, input().split())) s = [] tmp = 1 for i in range(n - 1): if a[i] == a[i + 1]: tmp += 1 if i == n - 2: s.append(tmp) else: if tmp != 1: s.append(tmp) tmp = 1 ans = 0 for i in s: ans += i // 2...
false
0
[ "-for i in range(1, n):", "- if a[i] == a[i - 1]:", "+for i in range(n - 1):", "+ if a[i] == a[i + 1]:", "- if i == n - 1:", "+ if i == n - 2:" ]
false
0.035733
0.041547
0.860069
[ "s819127711", "s106224378" ]
u398846051
p03007
python
s092247024
s197351418
430
353
62,940
63,116
Accepted
Accepted
17.91
n = int(eval(input())) a = list(map(int, input().split())) a.sort() if a[0] >= 0: print((sum(a) - 2 * min(a))) if n == 2: print((a[1], a[0])) else: print((a[0], a[1])) now = a[0] - a[1] for i in range(2, n-1): print((now, a[i])) now = now -...
n = int(eval(input())) a = list(map(int, input().split())) a.sort() print((a[-1] - a[0] + sum(map(abs, a[1:-1])))) pos = [a[-1]] neg = [a[0]] for x in a[1:-1]: if x > 0: pos.append(x) else: neg.append(x) now = neg[0] for p in pos[1:]: print((now, p)) now -= p print((po...
46
22
1,200
392
n = int(eval(input())) a = list(map(int, input().split())) a.sort() if a[0] >= 0: print((sum(a) - 2 * min(a))) if n == 2: print((a[1], a[0])) else: print((a[0], a[1])) now = a[0] - a[1] for i in range(2, n - 1): print((now, a[i])) now = now - a[i] ...
n = int(eval(input())) a = list(map(int, input().split())) a.sort() print((a[-1] - a[0] + sum(map(abs, a[1:-1])))) pos = [a[-1]] neg = [a[0]] for x in a[1:-1]: if x > 0: pos.append(x) else: neg.append(x) now = neg[0] for p in pos[1:]: print((now, p)) now -= p print((pos[0], now)) now = p...
false
52.173913
[ "-if a[0] >= 0:", "- print((sum(a) - 2 * min(a)))", "- if n == 2:", "- print((a[1], a[0]))", "+print((a[-1] - a[0] + sum(map(abs, a[1:-1]))))", "+pos = [a[-1]]", "+neg = [a[0]]", "+for x in a[1:-1]:", "+ if x > 0:", "+ pos.append(x)", "- print((a[0], a[1]))", "- ...
false
0.050355
0.049935
1.008404
[ "s092247024", "s197351418" ]
u347640436
p03147
python
s721613426
s869654691
42
19
3,060
3,064
Accepted
Accepted
54.76
n = int(eval(input())) h = list(map(int, input().split())) result = 0 while True: start = n for i in range(n): if h[i] != 0: start = i break if start == n: break end = n - 1 for i in range(start, n): if h[i] == 0: end = i - 1 break h[i] -= 1 result +=...
n = int(eval(input())) h = list(map(int, input().split())) result = 0 while True: start = n for i in range(n): if h[i] != 0: start = i break if start == n: break end = n - 1 count = 101 for i in range(start, n): if h[i] == 0: end = i - 1 break if h[i]...
20
23
334
432
n = int(eval(input())) h = list(map(int, input().split())) result = 0 while True: start = n for i in range(n): if h[i] != 0: start = i break if start == n: break end = n - 1 for i in range(start, n): if h[i] == 0: end = i - 1 br...
n = int(eval(input())) h = list(map(int, input().split())) result = 0 while True: start = n for i in range(n): if h[i] != 0: start = i break if start == n: break end = n - 1 count = 101 for i in range(start, n): if h[i] == 0: end = i - ...
false
13.043478
[ "+ count = 101", "- h[i] -= 1", "- result += 1", "+ if h[i] < count:", "+ count = h[i]", "+ for i in range(start, end + 1):", "+ h[i] -= count", "+ result += count" ]
false
0.041378
0.040805
1.014038
[ "s721613426", "s869654691" ]
u105608888
p02861
python
s331248662
s161372389
778
122
28,576
27,140
Accepted
Accepted
84.32
N = int(eval(input())) A = [tuple(map(int, input().split())) for _ in range(N)] ans = [] import numpy as np import itertools for zyun in itertools.permutations(list(range(N))): cnt = 0 for k in range(len(zyun)-1): cnt += np.sqrt((A[zyun[k+1]][0]-A[zyun[k]][0])**2+(A[zyun[k+1]][1]-A[zyun[k]][1])*...
N = int(eval(input())) A = [tuple(map(int, input().split())) for _ in range(N)] ans = [] import numpy as np for i in range(len(A)-1): for k in range(i+1,len(A)): ans.append(np.sqrt(((A[i][0]-A[k][0])**2)+(A[i][1]-A[k][1])**2)) print((sum(ans)*2/N))
11
8
361
259
N = int(eval(input())) A = [tuple(map(int, input().split())) for _ in range(N)] ans = [] import numpy as np import itertools for zyun in itertools.permutations(list(range(N))): cnt = 0 for k in range(len(zyun) - 1): cnt += np.sqrt( (A[zyun[k + 1]][0] - A[zyun[k]][0]) ** 2 + (A[z...
N = int(eval(input())) A = [tuple(map(int, input().split())) for _ in range(N)] ans = [] import numpy as np for i in range(len(A) - 1): for k in range(i + 1, len(A)): ans.append(np.sqrt(((A[i][0] - A[k][0]) ** 2) + (A[i][1] - A[k][1]) ** 2)) print((sum(ans) * 2 / N))
false
27.272727
[ "-import itertools", "-for zyun in itertools.permutations(list(range(N))):", "- cnt = 0", "- for k in range(len(zyun) - 1):", "- cnt += np.sqrt(", "- (A[zyun[k + 1]][0] - A[zyun[k]][0]) ** 2", "- + (A[zyun[k + 1]][1] - A[zyun[k]][1]) ** 2", "- )", "- ans....
false
0.189324
1.215711
0.155731
[ "s331248662", "s161372389" ]
u488401358
p03579
python
s434568834
s750328751
1,854
1,369
135,032
128,892
Accepted
Accepted
26.16
class UnionFindVerSize(): def __init__(self, N): """ N個のノードのUnion-Find木を作成する """ # 親の番号を格納する。自分が親だった場合は、自分の番号になり、それがそのグループの番号になる self._parent = [n for n in range(0, N)] # グループのサイズ(個数) self._size = [1] * N self._even = [i%2 for i in range(0,N)] self._od...
class UnionFindVerSize(): def __init__(self, N): """ N個のノードのUnion-Find木を作成する """ # 親の番号を格納する。自分が親だった場合は、自分の番号になり、それがそのグループの番号になる self._parent = [n for n in range(0, N)] # グループのサイズ(個数) self._size = [1] * N self._even = [i%2 for i in range(0,N)] self._od...
76
78
2,134
2,163
class UnionFindVerSize: def __init__(self, N): """N個のノードのUnion-Find木を作成する""" # 親の番号を格納する。自分が親だった場合は、自分の番号になり、それがそのグループの番号になる self._parent = [n for n in range(0, N)] # グループのサイズ(個数) self._size = [1] * N self._even = [i % 2 for i in range(0, N)] self._odd = [(i +...
class UnionFindVerSize: def __init__(self, N): """N個のノードのUnion-Find木を作成する""" # 親の番号を格納する。自分が親だった場合は、自分の番号になり、それがそのグループの番号になる self._parent = [n for n in range(0, N)] # グループのサイズ(個数) self._size = [1] * N self._even = [i % 2 for i in range(0, N)] self._odd = [(i +...
false
2.564103
[ "+input = sys.stdin.readline" ]
false
0.038722
0.03908
0.990827
[ "s434568834", "s750328751" ]
u823585596
p02952
python
s248960253
s524792766
61
30
8,960
8,996
Accepted
Accepted
50.82
N=int(eval(input())) ans=0 for i in range(1,N+1): if len(str(i))%2!=0: ans+=1 print(ans)
N=int(eval(input())) ans=0 l=len(str(N)) for i in range(l+1): if i!=l and i%2!=0: ans+=(10**i)-(10**(i-1)) if i==l and i%2!=0: ans+=(N-(10**(i-1))+1) print(ans)
6
9
99
186
N = int(eval(input())) ans = 0 for i in range(1, N + 1): if len(str(i)) % 2 != 0: ans += 1 print(ans)
N = int(eval(input())) ans = 0 l = len(str(N)) for i in range(l + 1): if i != l and i % 2 != 0: ans += (10**i) - (10 ** (i - 1)) if i == l and i % 2 != 0: ans += N - (10 ** (i - 1)) + 1 print(ans)
false
33.333333
[ "-for i in range(1, N + 1):", "- if len(str(i)) % 2 != 0:", "- ans += 1", "+l = len(str(N))", "+for i in range(l + 1):", "+ if i != l and i % 2 != 0:", "+ ans += (10**i) - (10 ** (i - 1))", "+ if i == l and i % 2 != 0:", "+ ans += N - (10 ** (i - 1)) + 1" ]
false
0.111728
0.038525
2.900134
[ "s248960253", "s524792766" ]
u254871849
p03457
python
s928155481
s785931632
361
169
3,064
26,632
Accepted
Accepted
53.19
n = int(eval(input())) t, x, y = 0, 0, 0 ans = "Yes" for i in range(1, n+1): ti, xi, yi = list(map(int, input().split())) displacements = (xi - x) + (yi - y) dist = abs(displacements) dt = ti - t if dt >= dist and (dt - dist) % 2 == 0: t, x, y = ti, xi, yi else: ans = "No" print(ans)
# author: kagemeka # created: 2019-11-06 12:47:30(JST) import sys # import collections # import math # import string # import bisect # import re # import itertools # import statistics def main(): n, *txy = (int(x) for x in sys.stdin.read().split()) ...
14
35
307
883
n = int(eval(input())) t, x, y = 0, 0, 0 ans = "Yes" for i in range(1, n + 1): ti, xi, yi = list(map(int, input().split())) displacements = (xi - x) + (yi - y) dist = abs(displacements) dt = ti - t if dt >= dist and (dt - dist) % 2 == 0: t, x, y = ti, xi, yi else: ans = "No" prin...
# author: kagemeka # created: 2019-11-06 12:47:30(JST) import sys # import collections # import math # import string # import bisect # import re # import itertools # import statistics def main(): n, *txy = (int(x) for x in sys.stdin.read().split()) t, x, y = [0]...
false
60
[ "-n = int(eval(input()))", "-t, x, y = 0, 0, 0", "-ans = \"Yes\"", "-for i in range(1, n + 1):", "- ti, xi, yi = list(map(int, input().split()))", "- displacements = (xi - x) + (yi - y)", "- dist = abs(displacements)", "- dt = ti - t", "- if dt >= dist and (dt - dist) % 2 == 0:", "-...
false
0.033892
0.040585
0.835097
[ "s928155481", "s785931632" ]
u281303342
p03155
python
s094143714
s462248188
20
18
3,316
3,064
Accepted
Accepted
10
N = int(eval(input())) H = int(eval(input())) W = int(eval(input())) print(((N-H+1)*(N-W+1)))
N = int(eval(input())) H = int(eval(input())) W = int(eval(input())) print(((N-W+1)*(N-H+1)))
4
5
76
78
N = int(eval(input())) H = int(eval(input())) W = int(eval(input())) print(((N - H + 1) * (N - W + 1)))
N = int(eval(input())) H = int(eval(input())) W = int(eval(input())) print(((N - W + 1) * (N - H + 1)))
false
20
[ "-print(((N - H + 1) * (N - W + 1)))", "+print(((N - W + 1) * (N - H + 1)))" ]
false
0.043178
0.042843
1.007823
[ "s094143714", "s462248188" ]
u870793476
p03281
python
s679161857
s219491730
21
19
3,060
3,060
Accepted
Accepted
9.52
N = int(eval(input())) result = 0 for i in range(1, N+1): count = 0 for j in range(1, i+1): if i % j == 0: count += 1 if i%2 == 1 and count == 8: result += 1 print(result)
N = int(eval(input())) result = 0 for i in range(1, N+1): if i%2 == 0: continue count = 0 for j in range(1, i+1): if i % j == 0: count += 1 if count == 8: result += 1 print(result)
12
15
218
259
N = int(eval(input())) result = 0 for i in range(1, N + 1): count = 0 for j in range(1, i + 1): if i % j == 0: count += 1 if i % 2 == 1 and count == 8: result += 1 print(result)
N = int(eval(input())) result = 0 for i in range(1, N + 1): if i % 2 == 0: continue count = 0 for j in range(1, i + 1): if i % j == 0: count += 1 if count == 8: result += 1 print(result)
false
20
[ "+ if i % 2 == 0:", "+ continue", "- if i % 2 == 1 and count == 8:", "+ if count == 8:" ]
false
0.037053
0.036412
1.017587
[ "s679161857", "s219491730" ]
u133936772
p02995
python
s077339265
s758915877
35
30
5,048
9,116
Accepted
Accepted
14.29
a,b,c,d=list(map(int,input().split())) from fractions import * f=lambda x:x-x//c-x//d+x//(c*d//gcd(c,d)) print((f(b)-f(a-1)))
a,b,c,d=list(map(int,input().split())) from math import * f=lambda x:x-x//c-x//d+x//(c*d//gcd(c,d)) print((f(b)-f(a-1)))
4
4
120
115
a, b, c, d = list(map(int, input().split())) from fractions import * f = lambda x: x - x // c - x // d + x // (c * d // gcd(c, d)) print((f(b) - f(a - 1)))
a, b, c, d = list(map(int, input().split())) from math import * f = lambda x: x - x // c - x // d + x // (c * d // gcd(c, d)) print((f(b) - f(a - 1)))
false
0
[ "-from fractions import *", "+from math import *" ]
false
0.143438
0.049338
2.907277
[ "s077339265", "s758915877" ]
u268210555
p03312
python
s735700556
s722285298
1,072
490
56,572
57,964
Accepted
Accepted
54.29
n = int(eval(input())) a = list(map(int, input().split())) l, r = a[:2] m = 1 b = [(l,r)] for i in range(2, n-2): r += a[i] for j in range(m, i): nl, nr = l+a[j], r-a[j] if abs(l-r) < abs(nl-nr): break l, r = nl, nr m += 1 b.append((l,r)) l, r =...
n = int(eval(input())) a = list(map(int, input().split())) def f(a): l, r = a[:2] m = 1 b = [(l,r)] for i in range(2, n-2): r += a[i] while m<i and abs(l-r)>abs(l-r+a[m]*2): l, r = l+a[m], r-a[m] m += 1 b.append((l,r)) return b print((min...
35
15
695
399
n = int(eval(input())) a = list(map(int, input().split())) l, r = a[:2] m = 1 b = [(l, r)] for i in range(2, n - 2): r += a[i] for j in range(m, i): nl, nr = l + a[j], r - a[j] if abs(l - r) < abs(nl - nr): break l, r = nl, nr m += 1 b.append((l, r)) l, r = a[-2:]...
n = int(eval(input())) a = list(map(int, input().split())) def f(a): l, r = a[:2] m = 1 b = [(l, r)] for i in range(2, n - 2): r += a[i] while m < i and abs(l - r) > abs(l - r + a[m] * 2): l, r = l + a[m], r - a[m] m += 1 b.append((l, r)) return b ...
false
57.142857
[ "-l, r = a[:2]", "-m = 1", "-b = [(l, r)]", "-for i in range(2, n - 2):", "- r += a[i]", "- for j in range(m, i):", "- nl, nr = l + a[j], r - a[j]", "- if abs(l - r) < abs(nl - nr):", "- break", "- l, r = nl, nr", "- m += 1", "- b.append((l, r))"...
false
0.046098
0.041637
1.107135
[ "s735700556", "s722285298" ]
u759651152
p03730
python
s319452083
s242359918
155
17
2,940
2,940
Accepted
Accepted
89.03
#-*-coding:utf-8-*- def main(): a, b, c = list(map(int, input().split())) for i in range(10 ** 6): if (a * i - c) % b == 0: print('YES') exit() print('NO') if __name__ == '__main__': main()
#-*-coding:utf-8-*- def main(): a, b, c = list(map(int, input().split())) reminder = [] for i in range(a, b*a+1, a): reminder.append(i % b) if c in reminder: print('YES') else: print('NO') if __name__ == '__main__': main()
13
14
246
279
# -*-coding:utf-8-*- def main(): a, b, c = list(map(int, input().split())) for i in range(10**6): if (a * i - c) % b == 0: print("YES") exit() print("NO") if __name__ == "__main__": main()
# -*-coding:utf-8-*- def main(): a, b, c = list(map(int, input().split())) reminder = [] for i in range(a, b * a + 1, a): reminder.append(i % b) if c in reminder: print("YES") else: print("NO") if __name__ == "__main__": main()
false
7.142857
[ "- for i in range(10**6):", "- if (a * i - c) % b == 0:", "- print(\"YES\")", "- exit()", "- print(\"NO\")", "+ reminder = []", "+ for i in range(a, b * a + 1, a):", "+ reminder.append(i % b)", "+ if c in reminder:", "+ print(\"YES\")", "...
false
0.14449
0.046964
3.076603
[ "s319452083", "s242359918" ]
u366959492
p03074
python
s230883807
s683761885
152
131
4,212
7,788
Accepted
Accepted
13.82
n,k=list(map(int,input().split())) s=eval(input()) wa=[] now=1 cnt=0 for i in range(n): if s[i]==str(0+now): cnt+=1 else: wa.append(cnt) now=1-now cnt=1 if cnt!=0: wa.append(cnt) if len(wa)%2==0: wa.append(0) add=2*k+1 ans=0 left=0 right=0 tmp=0 ...
n,k=list(map(int,input().split())) s=eval(input()) wa=[] now=1 cnt=0 for i in range(n): if s[i]==str(0+now): cnt+=1 else: wa.append(cnt) now=1-now cnt=1 if cnt!=0: wa.append(cnt) if len(wa)%2==0: wa.append(0) add=2*k+1 ans=0 s=[0]*(len(wa)+1) for i ...
37
34
567
494
n, k = list(map(int, input().split())) s = eval(input()) wa = [] now = 1 cnt = 0 for i in range(n): if s[i] == str(0 + now): cnt += 1 else: wa.append(cnt) now = 1 - now cnt = 1 if cnt != 0: wa.append(cnt) if len(wa) % 2 == 0: wa.append(0) add = 2 * k + 1 ans = 0 left = 0 ...
n, k = list(map(int, input().split())) s = eval(input()) wa = [] now = 1 cnt = 0 for i in range(n): if s[i] == str(0 + now): cnt += 1 else: wa.append(cnt) now = 1 - now cnt = 1 if cnt != 0: wa.append(cnt) if len(wa) % 2 == 0: wa.append(0) add = 2 * k + 1 ans = 0 s = [0] *...
false
8.108108
[ "-left = 0", "-right = 0", "-tmp = 0", "+s = [0] * (len(wa) + 1)", "+for i in range(len(s) - 1):", "+ s[i + 1] = s[i] + wa[i]", "- nextleft = i", "- nextright = min(i + add, len(wa))", "- while nextleft > left:", "- tmp -= wa[left]", "- left += 1", "- while nextrig...
false
0.047949
0.039442
1.21569
[ "s230883807", "s683761885" ]
u185249212
p02713
python
s893211058
s762724062
1,018
928
79,284
74,816
Accepted
Accepted
8.84
import sys import re import array import copy import functools import operator import math import string import fractions from fractions import Fraction from math import gcd # fractions.gcd() を用いること # math.log2()はatcoderでは対応していない.留意せよ. import collections import itertools import bisect import...
import sys from math import gcd from functools import reduce input = sys.stdin.readline def find_gcd(list_l): x = reduce(gcd, list_l) return x def main(): k = int(input().strip()) ans=0 for i in range(1,k+1): for j in range(1,k+1): for k in range(1,k+1):...
83
26
1,541
459
import sys import re import array import copy import functools import operator import math import string import fractions from fractions import Fraction from math import gcd # fractions.gcd() を用いること # math.log2()はatcoderでは対応していない.留意せよ. import collections import itertools import bisect import random import time import ...
import sys from math import gcd from functools import reduce input = sys.stdin.readline def find_gcd(list_l): x = reduce(gcd, list_l) return x def main(): k = int(input().strip()) ans = 0 for i in range(1, k + 1): for j in range(1, k + 1): for k in range(1, k + 1): ...
false
68.674699
[ "-import re", "-import array", "-import copy", "-import functools", "-import operator", "-import math", "-import string", "-import fractions", "-from fractions import Fraction", "-", "-# fractions.gcd() を用いること", "-# math.log2()はatcoderでは対応していない.留意せよ.", "-import collections", "-import itert...
false
0.136987
0.07709
1.776973
[ "s893211058", "s762724062" ]
u633068244
p01772
python
s227638422
s174704165
30
10
6,448
6,428
Accepted
Accepted
66.67
S = input() if "A" not in S: print(-1) else: ans = "A" for s in S[S.index("A") + 1:]: if ans[-1] == "A" and s == "Z": ans += s if ans[-1] == "Z" and s == "A": ans += s if ans[-1] == "A": ans = ans[:-1] print(ans if ans else -1)
S = input() A = False c = 0 for s in S: A |= s == "A" if s == "Z" and A: c += 1 A = False print("AZ"*c if c > 0 else -1)
10
9
274
155
S = input() if "A" not in S: print(-1) else: ans = "A" for s in S[S.index("A") + 1 :]: if ans[-1] == "A" and s == "Z": ans += s if ans[-1] == "Z" and s == "A": ans += s if ans[-1] == "A": ans = ans[:-1] print(ans if ans else -1)
S = input() A = False c = 0 for s in S: A |= s == "A" if s == "Z" and A: c += 1 A = False print("AZ" * c if c > 0 else -1)
false
10
[ "-if \"A\" not in S:", "- print(-1)", "-else:", "- ans = \"A\"", "- for s in S[S.index(\"A\") + 1 :]:", "- if ans[-1] == \"A\" and s == \"Z\":", "- ans += s", "- if ans[-1] == \"Z\" and s == \"A\":", "- ans += s", "- if ans[-1] == \"A\":", "- ...
false
0.040045
0.036093
1.109508
[ "s227638422", "s174704165" ]
u626468554
p03999
python
s526295191
s001553322
24
20
3,060
3,060
Accepted
Accepted
16.67
#n = int(input()) #n,k = map(int,input().split()) #x = list(map(int,input().split())) s = list(eval(input())) ans = 0 for i in range(1<<len(s)): ttl = [] memo = s[0] for j in range(1,len(s)): if (i>>j)&1: memo += s[j] else: ttl.append(int(memo)) ...
#n = int(input()) #n,k = map(int,input().split()) #x = list(map(int,input().split())) s = list(eval(input())) ans = 0 for i in range(1<<len(s)-1): ttl = [] memo = s[0] for j in range(0,len(s)-1): if (i>>j)&1: memo += s[j+1] else: ttl.append(int(mem...
26
25
426
425
# n = int(input()) # n,k = map(int,input().split()) # x = list(map(int,input().split())) s = list(eval(input())) ans = 0 for i in range(1 << len(s)): ttl = [] memo = s[0] for j in range(1, len(s)): if (i >> j) & 1: memo += s[j] else: ttl.append(int(memo)) ...
# n = int(input()) # n,k = map(int,input().split()) # x = list(map(int,input().split())) s = list(eval(input())) ans = 0 for i in range(1 << len(s) - 1): ttl = [] memo = s[0] for j in range(0, len(s) - 1): if (i >> j) & 1: memo += s[j + 1] else: ttl.append(int(memo)) ...
false
3.846154
[ "-for i in range(1 << len(s)):", "+for i in range(1 << len(s) - 1):", "- for j in range(1, len(s)):", "+ for j in range(0, len(s) - 1):", "- memo += s[j]", "+ memo += s[j + 1]", "- memo = s[j]", "+ memo = s[j + 1]", "-print((ans // 2))", "+print(an...
false
0.03759
0.036915
1.018284
[ "s526295191", "s001553322" ]
u086716588
p04001
python
s253900619
s735048565
24
17
3,320
3,064
Accepted
Accepted
29.17
def main(): s = eval(input()) num = 2**(len(s)-1) bit_len = len(bin(num)) def func(n): n = bin(n) n_len = len(n) n = "0"*( bit_len - n_len - 1 ) + n[-len(n)+2:] indexes = [i+1 for i, x in enumerate(n) if x == "1"] ans = 0 temp = 0 fo...
S = [int(i) for i in eval(input())] N = len(S) ans = 0 for i in range(N): left = i right = N - i - 1 score = 1 for k in range(0, right + 1): if right - k > 0: ans += S[i] * score * (1 << left) * (1 << (right - k - 1)) else: ans += S[i] * score * (1 <<...
28
16
588
355
def main(): s = eval(input()) num = 2 ** (len(s) - 1) bit_len = len(bin(num)) def func(n): n = bin(n) n_len = len(n) n = "0" * (bit_len - n_len - 1) + n[-len(n) + 2 :] indexes = [i + 1 for i, x in enumerate(n) if x == "1"] ans = 0 temp = 0 for i i...
S = [int(i) for i in eval(input())] N = len(S) ans = 0 for i in range(N): left = i right = N - i - 1 score = 1 for k in range(0, right + 1): if right - k > 0: ans += S[i] * score * (1 << left) * (1 << (right - k - 1)) else: ans += S[i] * score * (1 << left) ...
false
42.857143
[ "-def main():", "- s = eval(input())", "- num = 2 ** (len(s) - 1)", "- bit_len = len(bin(num))", "-", "- def func(n):", "- n = bin(n)", "- n_len = len(n)", "- n = \"0\" * (bit_len - n_len - 1) + n[-len(n) + 2 :]", "- indexes = [i + 1 for i, x in enumerate(n)...
false
0.073545
0.073205
1.004639
[ "s253900619", "s735048565" ]
u054514819
p02599
python
s013558164
s833129042
1,815
758
230,988
165,680
Accepted
Accepted
58.24
import sys def input(): return sys.stdin.readline().strip() def mapint(): return list(map(int, input().split())) sys.setrecursionlimit(10**9) N, Q = mapint() Cs = list(mapint()) LR = [] for i in range(Q): l, r = mapint() LR.append((l, r, i)) LR.sort(key=lambda x:x[1]) A = [0]*N def add(A,a,w):#リ...
import sys def input(): return sys.stdin.readline().strip() def mapint(): return list(map(int, input().split())) sys.setrecursionlimit(10**9) N, Q = mapint() Cs = list(mapint()) LR = [] for i in range(Q): l, r = mapint() k = r*(10**12)+l*(10**6)+i LR.append(k) LR.sort() A = [0]*N def add(A,...
46
50
964
1,033
import sys def input(): return sys.stdin.readline().strip() def mapint(): return list(map(int, input().split())) sys.setrecursionlimit(10**9) N, Q = mapint() Cs = list(mapint()) LR = [] for i in range(Q): l, r = mapint() LR.append((l, r, i)) LR.sort(key=lambda x: x[1]) A = [0] * N def add(A, a, ...
import sys def input(): return sys.stdin.readline().strip() def mapint(): return list(map(int, input().split())) sys.setrecursionlimit(10**9) N, Q = mapint() Cs = list(mapint()) LR = [] for i in range(Q): l, r = mapint() k = r * (10**12) + l * (10**6) + i LR.append(k) LR.sort() A = [0] * N d...
false
8
[ "- LR.append((l, r, i))", "-LR.sort(key=lambda x: x[1])", "+ k = r * (10**12) + l * (10**6) + i", "+ LR.append(k)", "+LR.sort()", "-for l, r, ans_idx in LR:", "+for k in LR:", "+ ans_idx = k % (10**6)", "+ l = k // (10**6) % (10**6)", "+ r = k // (10**12)" ]
false
0.164511
0.037158
4.427303
[ "s013558164", "s833129042" ]
u488178971
p03448
python
s801373723
s325112831
51
47
3,060
3,060
Accepted
Accepted
7.84
#087 B Coins A =int(eval(input())) B =int(eval(input())) C =int(eval(input())) X =int(eval(input())) ans =0 for i in range(A+1): for j in range(B+1): for k in range(C+1): if 500 * i + 100 * j + 50 * k ==X: ans+=1 print(ans)
# B - Coins A=int(eval(input())) B=int(eval(input())) C=int(eval(input())) X=int(eval(input())) cnt = 0 for a in range(0,A+1): for b in range(0,B+1): for c in range(0,C+1): if a * 500 + b * 100 + c * 50 ==X: cnt+=1 print(cnt)
12
12
256
252
# 087 B Coins A = int(eval(input())) B = int(eval(input())) C = int(eval(input())) X = int(eval(input())) ans = 0 for i in range(A + 1): for j in range(B + 1): for k in range(C + 1): if 500 * i + 100 * j + 50 * k == X: ans += 1 print(ans)
# B - Coins A = int(eval(input())) B = int(eval(input())) C = int(eval(input())) X = int(eval(input())) cnt = 0 for a in range(0, A + 1): for b in range(0, B + 1): for c in range(0, C + 1): if a * 500 + b * 100 + c * 50 == X: cnt += 1 print(cnt)
false
0
[ "-# 087 B Coins", "+# B - Coins", "-ans = 0", "-for i in range(A + 1):", "- for j in range(B + 1):", "- for k in range(C + 1):", "- if 500 * i + 100 * j + 50 * k == X:", "- ans += 1", "-print(ans)", "+cnt = 0", "+for a in range(0, A + 1):", "+ for b in ra...
false
0.08787
0.239932
0.36623
[ "s801373723", "s325112831" ]
u688219499
p02724
python
s858403393
s818720950
350
18
3,060
2,940
Accepted
Accepted
94.86
s = int(eval(input())) count1=-1 count2=-1 while s>=0: s=s-500 count1=count1 +1 s=s+500 if s==0: yasashisa=count1*1000 print(yasashisa) else: while s >=0: s=s-5 count2=count2 +1 yasashisa=count1*1000+count2* 5 print(yasashisa)
s=int(eval(input())) a= s//500 b=(s%500)//5 yasashisa=a*1000+b*5 print(yasashisa)
19
5
267
79
s = int(eval(input())) count1 = -1 count2 = -1 while s >= 0: s = s - 500 count1 = count1 + 1 s = s + 500 if s == 0: yasashisa = count1 * 1000 print(yasashisa) else: while s >= 0: s = s - 5 count2 = count2 + 1 yasashisa = count1 * 1000 + count2 * 5 print(yasashisa)
s = int(eval(input())) a = s // 500 b = (s % 500) // 5 yasashisa = a * 1000 + b * 5 print(yasashisa)
false
73.684211
[ "-count1 = -1", "-count2 = -1", "-while s >= 0:", "- s = s - 500", "- count1 = count1 + 1", "-s = s + 500", "-if s == 0:", "- yasashisa = count1 * 1000", "- print(yasashisa)", "-else:", "- while s >= 0:", "- s = s - 5", "- count2 = count2 + 1", "- yasashisa ...
false
0.225355
0.034751
6.484883
[ "s858403393", "s818720950" ]