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
u671060652
p03041
python
s599422955
s618621626
179
164
38,384
38,256
Accepted
Accepted
8.38
n, k = list(map(int, input().split())) s = eval(input()) print((s[:k-1] + chr(ord(s[k-1])+32) + s[k:]))
n, k = list(map(int, input().split())) s = list(eval(input())) s[k-1] = chr(ord(s[k-1])+ord("a")-ord("A")) print(("".join(s)))
4
6
93
119
n, k = list(map(int, input().split())) s = eval(input()) print((s[: k - 1] + chr(ord(s[k - 1]) + 32) + s[k:]))
n, k = list(map(int, input().split())) s = list(eval(input())) s[k - 1] = chr(ord(s[k - 1]) + ord("a") - ord("A")) print(("".join(s)))
false
33.333333
[ "-s = eval(input())", "-print((s[: k - 1] + chr(ord(s[k - 1]) + 32) + s[k:]))", "+s = list(eval(input()))", "+s[k - 1] = chr(ord(s[k - 1]) + ord(\"a\") - ord(\"A\"))", "+print((\"\".join(s)))" ]
false
0.043469
0.035708
1.217349
[ "s599422955", "s618621626" ]
u588341295
p02863
python
s482142174
s201367787
693
266
181,724
153,196
Accepted
Accepted
61.62
# -*- coding: utf-8 -*- import sys from operator import itemgetter def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] * d for j in range...
# -*- coding: utf-8 -*- import sys import numpy as np from operator import itemgetter def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e...
39
40
1,138
1,136
# -*- coding: utf-8 -*- import sys from operator import itemgetter def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] * d ...
# -*- coding: utf-8 -*- import sys import numpy as np from operator import itemgetter def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): ...
false
2.5
[ "+import numpy as np", "+# 各料理を時間の昇順でソート", "+# 後は普通のナップザック", "-dp = list2d(N + 1, TMAX, 0)", "+dp = np.zeros((N + 1, TMAX), dtype=np.int64)", "- for j in range(TMAX):", "- dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])", "- if j < T:", "- dp[i + 1][j + a] = max(dp[i + 1][j + ...
false
0.237622
0.573892
0.414054
[ "s482142174", "s201367787" ]
u278057806
p02900
python
s835123598
s806795172
356
163
21,628
5,560
Accepted
Accepted
54.21
import numpy as np # ユークリッドの互除法 def ea(x, y): if x < y: x, y = y, x while x % y != 0: x = x % y x, y = y, x return y # 素因数分解 def pf(x, p): for i in range(2, int(np.sqrt(x)) + 1): cnt = 0 while x % i == 0: x /= i cnt +...
from math import sqrt from fractions import gcd A, B = list(map(int, input().split())) ans = 1 g = gcd(A, B) for i in range(2, 1 + int(sqrt(g))): if g % i == 0: ans += 1 while g % i == 0: g //= i if g != 1: ans += 1 print(ans)
41
21
604
285
import numpy as np # ユークリッドの互除法 def ea(x, y): if x < y: x, y = y, x while x % y != 0: x = x % y x, y = y, x return y # 素因数分解 def pf(x, p): for i in range(2, int(np.sqrt(x)) + 1): cnt = 0 while x % i == 0: x /= i cnt += 1 if cnt !...
from math import sqrt from fractions import gcd A, B = list(map(int, input().split())) ans = 1 g = gcd(A, B) for i in range(2, 1 + int(sqrt(g))): if g % i == 0: ans += 1 while g % i == 0: g //= i if g != 1: ans += 1 print(ans)
false
48.780488
[ "-import numpy as np", "+from math import sqrt", "+from fractions import gcd", "-# ユークリッドの互除法", "-def ea(x, y):", "- if x < y:", "- x, y = y, x", "- while x % y != 0:", "- x = x % y", "- x, y = y, x", "- return y", "-", "-", "-# 素因数分解", "-def pf(x, p):", "...
false
0.519069
0.193494
2.682617
[ "s835123598", "s806795172" ]
u912237403
p02381
python
s597745512
s885507935
20
10
4,380
4,356
Accepted
Accepted
50
import sys mode = 0 for line in sys.stdin: if mode == 0: n = int(line.strip('\n')) if n == 0: break mode = 1 elif mode == 1: x = [float(i) for i in line.strip('\n').split()] ave = sum(x) / n std = (sum([(i-ave)**2 for i in x])/n)**0.5 print(s...
while True: n = int(input()) if n == 0: break x = list(map(int, input().split())) ave = sum(x) / float(n) std = (sum([(e-ave)**2 for e in x])/n)**0.5 print(std)
14
8
340
193
import sys mode = 0 for line in sys.stdin: if mode == 0: n = int(line.strip("\n")) if n == 0: break mode = 1 elif mode == 1: x = [float(i) for i in line.strip("\n").split()] ave = sum(x) / n std = (sum([(i - ave) ** 2 for i in x]) / n) ** 0.5 ...
while True: n = int(input()) if n == 0: break x = list(map(int, input().split())) ave = sum(x) / float(n) std = (sum([(e - ave) ** 2 for e in x]) / n) ** 0.5 print(std)
false
42.857143
[ "-import sys", "-", "-mode = 0", "-for line in sys.stdin:", "- if mode == 0:", "- n = int(line.strip(\"\\n\"))", "- if n == 0:", "- break", "- mode = 1", "- elif mode == 1:", "- x = [float(i) for i in line.strip(\"\\n\").split()]", "- ave = s...
false
0.040797
0.039629
1.029481
[ "s597745512", "s885507935" ]
u855057563
p03308
python
s365690520
s103446810
29
26
9,144
9,332
Accepted
Accepted
10.34
n=int(eval(input())) s=[int(x) for x in input().split()] print((max(s)-min(s)))
n=int(eval(input())) s=[int(i) for i in input().split()] a=[] for i in range(n-1): for j in range(i+1,n): a.append(abs(s[i]-s[j])) print((max(a)))
3
7
73
150
n = int(eval(input())) s = [int(x) for x in input().split()] print((max(s) - min(s)))
n = int(eval(input())) s = [int(i) for i in input().split()] a = [] for i in range(n - 1): for j in range(i + 1, n): a.append(abs(s[i] - s[j])) print((max(a)))
false
57.142857
[ "-s = [int(x) for x in input().split()]", "-print((max(s) - min(s)))", "+s = [int(i) for i in input().split()]", "+a = []", "+for i in range(n - 1):", "+ for j in range(i + 1, n):", "+ a.append(abs(s[i] - s[j]))", "+print((max(a)))" ]
false
0.048608
0.049514
0.98171
[ "s365690520", "s103446810" ]
u630511239
p03733
python
s584856023
s147700939
148
129
25,196
30,816
Accepted
Accepted
12.84
N,T = list(map(int, input().split())) t = list(map(int, input().split())) ans = T for i in range(1,N): if t[i]-t[i-1] >= T: ans += T else: ans += t[i] - t[i-1] print(ans)
N, T = list(map(int, input().split())) t = list(map(int, input().split())) ans = N * T # 総和 cur = 0 # いつまで出るか for i in range(N): if cur > t[i]: ans -= cur - t[i] cur = t[i] + T print(ans)
10
9
188
205
N, T = list(map(int, input().split())) t = list(map(int, input().split())) ans = T for i in range(1, N): if t[i] - t[i - 1] >= T: ans += T else: ans += t[i] - t[i - 1] print(ans)
N, T = list(map(int, input().split())) t = list(map(int, input().split())) ans = N * T # 総和 cur = 0 # いつまで出るか for i in range(N): if cur > t[i]: ans -= cur - t[i] cur = t[i] + T print(ans)
false
10
[ "-ans = T", "-for i in range(1, N):", "- if t[i] - t[i - 1] >= T:", "- ans += T", "- else:", "- ans += t[i] - t[i - 1]", "+ans = N * T # 総和", "+cur = 0 # いつまで出るか", "+for i in range(N):", "+ if cur > t[i]:", "+ ans -= cur - t[i]", "+ cur = t[i] + T" ]
false
0.040794
0.042129
0.968295
[ "s584856023", "s147700939" ]
u936985471
p03013
python
s653702265
s970058313
102
68
14,308
19,020
Accepted
Accepted
33.33
n,m,*a=list(map(int,open(0).read().split())) a=set(a) dp=[0]*(n+2) dp[0]=1 div=1000000007 for i in range(n): dp[i]%=div if i+1 in a: dp[i+1]=0 else: dp[i+1]+=dp[i] if i+2 in a: dp[i+2]=0 else: dp[i+2]+=dp[i] print((dp[n]%div))
import sys readline = sys.stdin.readline N,M = list(map(int,readline().split())) broken = set([int(readline()) for i in range(M)]) dp = [0] * (N + 1) dp[0] = 1 if 1 not in broken: dp[1] = 1 DIV = 10 ** 9 + 7 for i in range(2, N + 1): if i in broken: continue dp[i] = dp[i - 2] + dp[i - ...
16
21
259
350
n, m, *a = list(map(int, open(0).read().split())) a = set(a) dp = [0] * (n + 2) dp[0] = 1 div = 1000000007 for i in range(n): dp[i] %= div if i + 1 in a: dp[i + 1] = 0 else: dp[i + 1] += dp[i] if i + 2 in a: dp[i + 2] = 0 else: dp[i + 2] += dp[i] print((dp[n] % div))
import sys readline = sys.stdin.readline N, M = list(map(int, readline().split())) broken = set([int(readline()) for i in range(M)]) dp = [0] * (N + 1) dp[0] = 1 if 1 not in broken: dp[1] = 1 DIV = 10**9 + 7 for i in range(2, N + 1): if i in broken: continue dp[i] = dp[i - 2] + dp[i - 1] dp[i] ...
false
23.809524
[ "-n, m, *a = list(map(int, open(0).read().split()))", "-a = set(a)", "-dp = [0] * (n + 2)", "+import sys", "+", "+readline = sys.stdin.readline", "+N, M = list(map(int, readline().split()))", "+broken = set([int(readline()) for i in range(M)])", "+dp = [0] * (N + 1)", "-div = 1000000007", "-for ...
false
0.042137
0.042548
0.990322
[ "s653702265", "s970058313" ]
u334712262
p02902
python
s435779684
s080169941
355
322
47,964
46,040
Accepted
Accepted
9.3
# -*- coding: utf-8 -*- from collections import defaultdict from collections import deque import sys # sys.setrecursionlimit(10**6) buff_readline = sys.stdin.buffer.readline readline = sys.stdin.readline INF = 2**62-1 def read_int(): return int(buff_readline()) def read_int_n(): return list...
# -*- coding: utf-8 -*- import sys # sys.setrecursionlimit(10**6) # buff_readline = sys.stdin.buffer.readline buff_readline = sys.stdin.readline readline = sys.stdin.readline INF = 2**62-1 def read_int(): return int(buff_readline()) def read_int_n(): return list(map(int, buff_readline().spli...
104
107
1,999
2,047
# -*- coding: utf-8 -*- from collections import defaultdict from collections import deque import sys # sys.setrecursionlimit(10**6) buff_readline = sys.stdin.buffer.readline readline = sys.stdin.readline INF = 2**62 - 1 def read_int(): return int(buff_readline()) def read_int_n(): return list(map(int, buff...
# -*- coding: utf-8 -*- import sys # sys.setrecursionlimit(10**6) # buff_readline = sys.stdin.buffer.readline buff_readline = sys.stdin.readline readline = sys.stdin.readline INF = 2**62 - 1 def read_int(): return int(buff_readline()) def read_int_n(): return list(map(int, buff_readline().split())) def r...
false
2.803738
[ "-from collections import defaultdict", "-from collections import deque", "-buff_readline = sys.stdin.buffer.readline", "+# buff_readline = sys.stdin.buffer.readline", "+buff_readline = sys.stdin.readline", "+@mt", "+ from collections import defaultdict, deque", "+", "- q = deque([s])", ...
false
0.039662
0.038467
1.031054
[ "s435779684", "s080169941" ]
u761320129
p03945
python
s056593375
s290524460
34
24
3,188
4,060
Accepted
Accepted
29.41
S = eval(input()) ans = 0 for a,b in zip(S,S[1:]): if a != b: ans += 1 print(ans)
S = eval(input()) ans = len([1 for a,b in zip(S,S[1:]) if a!=b]) print(ans)
6
3
92
71
S = eval(input()) ans = 0 for a, b in zip(S, S[1:]): if a != b: ans += 1 print(ans)
S = eval(input()) ans = len([1 for a, b in zip(S, S[1:]) if a != b]) print(ans)
false
50
[ "-ans = 0", "-for a, b in zip(S, S[1:]):", "- if a != b:", "- ans += 1", "+ans = len([1 for a, b in zip(S, S[1:]) if a != b])" ]
false
0.041966
0.078294
0.536
[ "s056593375", "s290524460" ]
u426534722
p02412
python
s123199820
s893091180
460
330
5,640
5,648
Accepted
Accepted
28.26
from itertools import combinations while True: n, x = list(map(int, input().split())) if n == x == 0: break print((sum(a + b + c == x for a, b, c in combinations(list(range(1, n + 1)), 3))))
from itertools import combinations while True: n, x = list(map(int, input().split())) if n == x == 0: break print((len([1 for a, b, c in combinations(list(range(1, n + 1)), 3) if a + b + c == x])))
7
7
204
211
from itertools import combinations while True: n, x = list(map(int, input().split())) if n == x == 0: break print((sum(a + b + c == x for a, b, c in combinations(list(range(1, n + 1)), 3))))
from itertools import combinations while True: n, x = list(map(int, input().split())) if n == x == 0: break print( ( len( [ 1 for a, b, c in combinations(list(range(1, n + 1)), 3) if a + b + c == x ...
false
0
[ "- print((sum(a + b + c == x for a, b, c in combinations(list(range(1, n + 1)), 3))))", "+ print(", "+ (", "+ len(", "+ [", "+ 1", "+ for a, b, c in combinations(list(range(1, n + 1)), 3)", "+ if a + b + c ...
false
0.102368
0.048973
2.090287
[ "s123199820", "s893091180" ]
u864197622
p02666
python
s420556826
s457578851
383
288
10,612
78,752
Accepted
Accepted
24.8
def par(a): L = [] while P[a] != a: L.append(a) a = P[a] for l in L: P[l] = a return a def unite(a, b): pa = par(a) pb = par(b) if pa == pb: return if LEN[pa] < LEN[pb]: a, b, pa, pb = b, a, pb, pa P[pb] = pa if LEN[pa] == LEN[pb]: L...
def par(a): L = [] while P[a] != a: L.append(a) a = P[a] for l in L: P[l] = a return a def unite(a, b): pa = par(a) pb = par(b) if pa == pb: return if LEN[pa] < LEN[pb]: a, b, pa, pb = b, a, pb, pa P[pb] = pa if LEN[pa] == LEN[pb]: L...
64
65
1,485
1,516
def par(a): L = [] while P[a] != a: L.append(a) a = P[a] for l in L: P[l] = a return a def unite(a, b): pa = par(a) pb = par(b) if pa == pb: return if LEN[pa] < LEN[pb]: a, b, pa, pb = b, a, pb, pa P[pb] = pa if LEN[pa] == LEN[pb]: ...
def par(a): L = [] while P[a] != a: L.append(a) a = P[a] for l in L: P[l] = a return a def unite(a, b): pa = par(a) pb = par(b) if pa == pb: return if LEN[pa] < LEN[pb]: a, b, pa, pb = b, a, pb, pa P[pb] = pa if LEN[pa] == LEN[pb]: ...
false
1.538462
[ "-fa = 1", "-ans = (ans + M * pow(N - 1, M - 1, mod)) % mod", "-for i, l in enumerate(L):", "- if i == 0:", "- continue", "- ans = (ans - l * fa * pow(N - 1, M - i, mod)) % mod", "- fa = fa * i % mod", "+if M:", "+ fa = 1", "+ ans = (ans + M * pow(N - 1, M - 1, mod)) % mod", ...
false
0.06655
0.039247
1.695702
[ "s420556826", "s457578851" ]
u945181840
p03026
python
s283083821
s019214000
48
44
6,864
6,864
Accepted
Accepted
8.33
import sys from collections import deque read = sys.stdin.read readline = sys.stdin.readline N, *abc = list(map(int, read().split())) c = abc[2 * (N - 1):] c.sort() graph = [[] for _ in range(N + 1)] cnt = [0] * (N + 1) for a, b in zip(*[iter(abc[:2 * (N - 1)])] * 2): graph[a].append(b) graph[b]....
import sys from collections import deque read = sys.stdin.read readline = sys.stdin.readline N, *abc = list(map(int, read().split())) c = abc[2 * (N - 1):] c.sort() graph = [[] for _ in range(N + 1)] cnt = [0] * (N + 1) for a, b in zip(*[iter(abc[:2 * (N - 1)])] * 2): graph[a].append(b) graph[b]....
32
30
703
651
import sys from collections import deque read = sys.stdin.read readline = sys.stdin.readline N, *abc = list(map(int, read().split())) c = abc[2 * (N - 1) :] c.sort() graph = [[] for _ in range(N + 1)] cnt = [0] * (N + 1) for a, b in zip(*[iter(abc[: 2 * (N - 1)])] * 2): graph[a].append(b) graph[b].append(a) ...
import sys from collections import deque read = sys.stdin.read readline = sys.stdin.readline N, *abc = list(map(int, read().split())) c = abc[2 * (N - 1) :] c.sort() graph = [[] for _ in range(N + 1)] cnt = [0] * (N + 1) for a, b in zip(*[iter(abc[: 2 * (N - 1)])] * 2): graph[a].append(b) graph[b].append(a) m ...
false
6.25
[ "- cnt[a] += 1", "- cnt[b] += 1", "-start = cnt.index(max(cnt))", "+start = 1" ]
false
0.036536
0.036488
1.001306
[ "s283083821", "s019214000" ]
u687044304
p02813
python
s351447063
s813904035
1,287
34
8,432
8,052
Accepted
Accepted
97.36
# -*- coding:utf-8 -*- import copy def solve(): N = int(eval(input())) Ps = tuple(map(int, input().split())) Qs = tuple(map(int, input().split())) available_list = [i for i in range(1, N+1)] permutations = [] # 順列 def _dfs(rest_list, p): if len(rest_list) == 0: ...
# -*- coding:utf-8 -*- # https://atcoder.jp/contests/abc150/tasks/abc150_c def solve(): import itertools import bisect N = int(eval(input())) Ps = tuple(map(int, input().split())) Qs = tuple(map(int, input().split())) lst = [i for i in range(1, N+1)] origins = list(itertools.p...
40
27
909
546
# -*- coding:utf-8 -*- import copy def solve(): N = int(eval(input())) Ps = tuple(map(int, input().split())) Qs = tuple(map(int, input().split())) available_list = [i for i in range(1, N + 1)] permutations = [] # 順列 def _dfs(rest_list, p): if len(rest_list) == 0: permutat...
# -*- coding:utf-8 -*- # https://atcoder.jp/contests/abc150/tasks/abc150_c def solve(): import itertools import bisect N = int(eval(input())) Ps = tuple(map(int, input().split())) Qs = tuple(map(int, input().split())) lst = [i for i in range(1, N + 1)] origins = list(itertools.permutations(...
false
32.5
[ "-import copy", "+# https://atcoder.jp/contests/abc150/tasks/abc150_c", "+def solve():", "+ import itertools", "+ import bisect", "-", "-def solve():", "- available_list = [i for i in range(1, N + 1)]", "- permutations = [] # 順列", "-", "- def _dfs(rest_list, p):", "- if ...
false
0.110592
0.042029
2.631325
[ "s351447063", "s813904035" ]
u761989513
p03017
python
s739751168
s009646993
104
89
4,916
4,984
Accepted
Accepted
14.42
n, a, b, c, d = list(map(int, input().split())) s = list(eval(input())) last = "" for i in range(a, c): if last == "#" and s[i] == "#": print("No") exit() last = s[i] last = "" for i in range(b, d): if last == "#" and s[i] == "#": print("No") exit() last = s[...
n, a, b, c, d = list(map(int, input().split())) s = list(eval(input())) last = "" for i in range(a, max(c, d)): if last == "#" and s[i] == "#": print("No") exit() last = s[i] flag = False if c > d: s[b - 1] = "#" for i in range(a, c): if last == "#" and s[i] == "#": ...
37
33
792
745
n, a, b, c, d = list(map(int, input().split())) s = list(eval(input())) last = "" for i in range(a, c): if last == "#" and s[i] == "#": print("No") exit() last = s[i] last = "" for i in range(b, d): if last == "#" and s[i] == "#": print("No") exit() last = s[i] last = "" ...
n, a, b, c, d = list(map(int, input().split())) s = list(eval(input())) last = "" for i in range(a, max(c, d)): if last == "#" and s[i] == "#": print("No") exit() last = s[i] flag = False if c > d: s[b - 1] = "#" for i in range(a, c): if last == "#" and s[i] == "#": f...
false
10.810811
[ "-for i in range(a, c):", "+for i in range(a, max(c, d)):", "-last = \"\"", "-for i in range(b, d):", "- if last == \"#\" and s[i] == \"#\":", "- print(\"No\")", "- exit()", "- last = s[i]", "-last = \"\"", "+flag = False", "- flag = True", "- flag = False", ...
false
0.044439
0.071868
0.618335
[ "s739751168", "s009646993" ]
u325956328
p02616
python
s506792209
s943707816
240
143
31,464
31,784
Accepted
Accepted
40.42
import sys import heapq input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) def main(): N, K = list(map(int, input().split())) A = list(map(int, input().split())) MOD = 10 ** 9 + 7 pos = [] neg = [] for a in A: if a >= 0: pos.append(a) els...
import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) def main(): N, K = list(map(int, input().split())) A = list(map(int, input().split())) MOD = 10 ** 9 + 7 pos = [] neg = [] for a in A: if a >= 0: pos.append(a) else: ne...
79
74
1,719
1,552
import sys import heapq input = sys.stdin.readline sys.setrecursionlimit(10**7) def main(): N, K = list(map(int, input().split())) A = list(map(int, input().split())) MOD = 10**9 + 7 pos = [] neg = [] for a in A: if a >= 0: pos.append(a) else: neg.appen...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) def main(): N, K = list(map(int, input().split())) A = list(map(int, input().split())) MOD = 10**9 + 7 pos = [] neg = [] for a in A: if a >= 0: pos.append(a) else: neg.append(a) flag...
false
6.329114
[ "-import heapq", "- h = [abs(x) for x in A]", "- heapq.heapify(h)", "- for i in range(K):", "- ans *= heapq.heappop(h)", "+ A = sorted([abs(x) for x in A])", "+ for a in A[:K]:", "+ ans *= a", "- hpos = [-x for x in pos]", "- h...
false
0.044424
0.055767
0.796592
[ "s506792209", "s943707816" ]
u596505843
p02901
python
s005261488
s201247474
796
447
125,404
49,756
Accepted
Accepted
43.84
import sys, math input = sys.stdin.readline rs = lambda: input().strip() ri = lambda: int(eval(input())) rl = lambda: list(map(int, input().split())) mod = 10**9 + 7 N, M = rl() A = [] Cs = [] for i in range(M): a, b = rl() C = rl() A.append(a) Cs.append(C) def get_bit(C): b = 0 for c in C: ...
import sys, math input = sys.stdin.readline rs = lambda: input().strip() ri = lambda: int(eval(input())) rl = lambda: list(map(int, input().split())) mod = 10**9 + 7 N, M = rl() A = [] Cs = [] for i in range(M): a, b = rl() C = rl() A.append(a) Cs.append(C) def get_bit(C): b = 0 for c in C: ...
51
49
789
777
import sys, math input = sys.stdin.readline rs = lambda: input().strip() ri = lambda: int(eval(input())) rl = lambda: list(map(int, input().split())) mod = 10**9 + 7 N, M = rl() A = [] Cs = [] for i in range(M): a, b = rl() C = rl() A.append(a) Cs.append(C) def get_bit(C): b = 0 for c in C: ...
import sys, math input = sys.stdin.readline rs = lambda: input().strip() ri = lambda: int(eval(input())) rl = lambda: list(map(int, input().split())) mod = 10**9 + 7 N, M = rl() A = [] Cs = [] for i in range(M): a, b = rl() C = rl() A.append(a) Cs.append(C) def get_bit(C): b = 0 for c in C: ...
false
3.921569
[ "- if n in visited:", "- continue", "- visited[n] = 1", "- if m in visited:", "+ nc = c + A[i]", "+ if m in visited and nc >= visited[m]:", "- cost = A[i]", "- heapq.heappush(heap, (c + cost, m))", "+ visited[m] = nc", "+ heapq.heappush...
false
0.036454
0.046643
0.781569
[ "s005261488", "s201247474" ]
u606045429
p03045
python
s278463561
s108206498
820
334
85,024
32,184
Accepted
Accepted
59.27
class UnionFind: def __init__(self, size): self.data = [-1 for _ in range(size)] def find(self, x): if self.data[x] < 0: return x else: self.data[x] = self.find(self.data[x]) return self.data[x] def union(self, x, y): x, y = self....
class UnionFind: def __init__(self, size): self.data = [-1 for _ in range(size)] def find(self, x): if self.data[x] < 0: return x else: self.data[x] = self.find(self.data[x]) return self.data[x] def union(self, x, y): x, y = self....
34
30
913
857
class UnionFind: def __init__(self, size): self.data = [-1 for _ in range(size)] def find(self, x): if self.data[x] < 0: return x else: self.data[x] = self.find(self.data[x]) return self.data[x] def union(self, x, y): x, y = self.find(x),...
class UnionFind: def __init__(self, size): self.data = [-1 for _ in range(size)] def find(self, x): if self.data[x] < 0: return x else: self.data[x] = self.find(self.data[x]) return self.data[x] def union(self, x, y): x, y = self.find(x),...
false
11.764706
[ "-N, M = [int(i) for i in input().split()]", "+N, M, *XYZ = list(map(int, open(0).read().split()))", "-for x, y, z in [[int(i) for i in input().split()] for _ in range(M)]:", "+for x, y, _ in zip(*[iter(XYZ)] * 3):", "-s = set()", "-for i in range(1, N + 1):", "- s.add(uf.find(i))", "-print((len(s)...
false
0.045852
0.05619
0.816024
[ "s278463561", "s108206498" ]
u740284863
p02573
python
s547140884
s806654260
840
765
62,168
22,640
Accepted
Accepted
8.93
from collections import deque n,m = list(map(int,input().split())) graph = [[] for _ in range(n+1)] for _ in range(m): a,b = list(map(int,input().split())) graph[a].append(b) graph[b].append(a) ans = 1 def dfs(node): while len(todo) > 0: node = todo.pop() if tf[node] == 0:...
from collections import * n,m = list(map(int,input().split())) par = [-1 for _ in range(n)]#par<0なら自身が親で要素の個数、>0なら子で親の位置示す def root(i): if par[i] < 0: return i else: return root(par[i]) def size(a): return -par[root(a)] def union(a,b): a = root(a) b = root(b) i...
33
29
731
644
from collections import deque n, m = list(map(int, input().split())) graph = [[] for _ in range(n + 1)] for _ in range(m): a, b = list(map(int, input().split())) graph[a].append(b) graph[b].append(a) ans = 1 def dfs(node): while len(todo) > 0: node = todo.pop() if tf[node] == 0: ...
from collections import * n, m = list(map(int, input().split())) par = [-1 for _ in range(n)] # par<0なら自身が親で要素の個数、>0なら子で親の位置示す def root(i): if par[i] < 0: return i else: return root(par[i]) def size(a): return -par[root(a)] def union(a, b): a = root(a) b = root(b) if a ==...
false
12.121212
[ "-from collections import deque", "+from collections import *", "-graph = [[] for _ in range(n + 1)]", "-for _ in range(m):", "- a, b = list(map(int, input().split()))", "- graph[a].append(b)", "- graph[b].append(a)", "-ans = 1", "+par = [-1 for _ in range(n)] # par<0なら自身が親で要素の個数、>0なら子で親の位...
false
0.094164
0.189768
0.496208
[ "s547140884", "s806654260" ]
u751717561
p04033
python
s681573567
s156598907
153
18
12,256
3,064
Accepted
Accepted
88.24
import bisect,collections,copy,heapq,itertools,math,numpy,string import sys #N = I() #A = [LI() for _ in range(N)] a, b = list(map(int,sys.stdin.readline().rstrip().split())) if a > 0: print('Positive') elif a <= 0 and b >= 0: print('Zero') else: if (a+b)%2 == 0: print('Negative') ...
import sys def S(): return sys.stdin.readline().rstrip() def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LS(): return list(sys.stdin.readline().rstrip().split()) #N = I() #A = [LI() for _ in range(N)] a, b = list(map(int,sys.stdin.rea...
16
19
354
520
import bisect, collections, copy, heapq, itertools, math, numpy, string import sys # N = I() # A = [LI() for _ in range(N)] a, b = list(map(int, sys.stdin.readline().rstrip().split())) if a > 0: print("Positive") elif a <= 0 and b >= 0: print("Zero") else: if (a + b) % 2 == 0: print("Negative") ...
import sys def S(): return sys.stdin.readline().rstrip() def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) def LS(): return list(sys.stdin.readline().rstrip().split()) # N = I() # A = [LI() for _ in range(N)] a, b = list(m...
false
15.789474
[ "-import bisect, collections, copy, heapq, itertools, math, numpy, string", "+", "+", "+def S():", "+ return sys.stdin.readline().rstrip()", "+", "+", "+def I():", "+ return int(sys.stdin.readline().rstrip())", "+", "+", "+def LI():", "+ return list(map(int, sys.stdin.readline().rst...
false
0.040152
0.038309
1.048094
[ "s681573567", "s156598907" ]
u498487134
p02991
python
s019262210
s055980135
795
584
120,100
136,636
Accepted
Accepted
26.54
########################################## inf=10**9 import heapq class Dijkstra(): """ ・有向 / 無向は問わない(無向の場合は,逆向きの辺もたす) ・負のコストがない場合のみ ・計算量はO(E log|V|)  ・heapを使うことで頂点を走査する必要がなくなる(代わりに,距離更新したものは確定でなくともqueに入れておく) """ class Edge(): #重み付き有向辺 def __init__(s...
import sys input = sys.stdin.readline def I(): return int(eval(input())) def MI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) def main(): ########################################## import heapq class Dijkstra(): """ ・有向 / 無向は問わない(無...
92
125
2,379
3,200
########################################## inf = 10**9 import heapq class Dijkstra: """ ・有向 / 無向は問わない(無向の場合は,逆向きの辺もたす) ・負のコストがない場合のみ ・計算量はO(E log|V|) ・heapを使うことで頂点を走査する必要がなくなる(代わりに,距離更新したものは確定でなくともqueに入れておく) """ class Edge: # 重み付き有向辺 def __init__(self, _to, _cost): ...
import sys input = sys.stdin.readline def I(): return int(eval(input())) def MI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) def main(): ########################################## import heapq class Dijkstra: """ ・有向 / 無向は問わ...
false
26.4
[ "-##########################################", "-inf = 10**9", "-import heapq", "-", "-", "-class Dijkstra:", "- \"\"\"", "- ・有向 / 無向は問わない(無向の場合は,逆向きの辺もたす)", "- ・負のコストがない場合のみ", "- ・計算量はO(E log|V|)", "- ・heapを使うことで頂点を走査する必要がなくなる(代わりに,距離更新したものは確定でなくともqueに入れておく)", "- \"\"\"", ...
false
0.044901
0.046799
0.95943
[ "s019262210", "s055980135" ]
u755180064
p03377
python
s727127053
s936011807
19
17
2,940
2,940
Accepted
Accepted
10.53
def main(): t = list(map(int, input().split())) for i in range(t[1]): tmp = i + t[0] if tmp == t[2]: print('YES') exit() print('NO') if __name__ == '__main__': main()
url = "https://atcoder.jp//contests/abc094/tasks/abc094_a" def main(): t = list(map(int, input().split())) for i in range(t[1]): tmp = i + t[0] if tmp == t[2]: print('YES') exit() print('NO') if __name__ == '__main__': main()
11
14
234
298
def main(): t = list(map(int, input().split())) for i in range(t[1]): tmp = i + t[0] if tmp == t[2]: print("YES") exit() print("NO") if __name__ == "__main__": main()
url = "https://atcoder.jp//contests/abc094/tasks/abc094_a" def main(): t = list(map(int, input().split())) for i in range(t[1]): tmp = i + t[0] if tmp == t[2]: print("YES") exit() print("NO") if __name__ == "__main__": main()
false
21.428571
[ "+url = \"https://atcoder.jp//contests/abc094/tasks/abc094_a\"", "+", "+" ]
false
0.042912
0.071981
0.596152
[ "s727127053", "s936011807" ]
u285891772
p02732
python
s265849729
s958696435
370
325
27,304
27,196
Accepted
Accepted
12.16
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians#, log2 from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemgetter, mul from copy import deepcopy...
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians#, log2 from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemgetter, mul from copy import deepcopy...
33
37
1,022
1,132
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians # , log2 from itertools import ( accumulate, permutations, combinations, combinations_with_replacement, product, groupby, ) from operator import itemgetter, mu...
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians # , log2 from itertools import ( accumulate, permutations, combinations, combinations_with_replacement, product, groupby, ) from operator import itemgetter, mu...
false
10.810811
[ "-dic = defaultdict(int)", "-for x in A:", "- dic[x] += 1", "-total = 0", "-for x in dic:", "- total += dic[x] * (dic[x] - 1) // 2", "-for x in A:", "- print((total - dic[x] + 1))", "+# print(Counter(A).keys())", "+# print(Counter(A).values())", "+# print(Counter(A).items())", "+lis =...
false
0.098212
0.065131
1.507908
[ "s265849729", "s958696435" ]
u411923565
p02820
python
s455911091
s438751221
196
178
85,312
86,320
Accepted
Accepted
9.18
# D - Prediction and Restriction N,K = list(map(int,input().split())) RSP = tuple(map(int,input().split())) T = eval(input()) # じゃんけんの勝敗を返す関数 def judge(a,b): if a == 'r' and b == 2: return True elif a == 's' and b == 0: return True elif a == 'p' and b == 1: return True ...
# D - Prediction and Restriction N,K = list(map(int,input().split())) RSP = tuple(map(int,input().split())) T = eval(input()) # じゃんけんの勝敗を返す関数 def judge(a,b): if a == 'r' and b == 2: return True elif a == 's' and b == 0: return True elif a == 'p' and b == 1: return True ...
38
47
938
1,203
# D - Prediction and Restriction N, K = list(map(int, input().split())) RSP = tuple(map(int, input().split())) T = eval(input()) # じゃんけんの勝敗を返す関数 def judge(a, b): if a == "r" and b == 2: return True elif a == "s" and b == 0: return True elif a == "p" and b == 1: return True return...
# D - Prediction and Restriction N, K = list(map(int, input().split())) RSP = tuple(map(int, input().split())) T = eval(input()) # じゃんけんの勝敗を返す関数 def judge(a, b): if a == "r" and b == 2: return True elif a == "s" and b == 0: return True elif a == "p" and b == 1: return True return...
false
19.148936
[ "-# v 回目のじゃんけん", "-for v in range(1, N + 1):", "- # v 回目に出した手", "- for w in range(3):", "- # v-K 回目に出した手", "- for k in range(3):", "- if w == k:", "- continue", "- # じゃんけんで勝ったとき", "- if judge(T[v - 1], w):", "- dp...
false
0.044492
0.047985
0.927216
[ "s455911091", "s438751221" ]
u562935282
p02832
python
s881556736
s789121075
153
89
26,180
24,744
Accepted
Accepted
41.83
from bisect import bisect_left N = int(eval(input())) *A, = list(map(int, input().split())) L = [A[0]] for a in A[1:]: if a > L[-1]: # Lの末尾よりaが大きければ増加部分列を延長できる L.append(a) else: # そうでなければ、「aより小さい最大要素の次」をaにする # 該当位置は、二分探索で特定できる L[bisect_left(L, a)] = a re...
N = int(eval(input())) *A, = list(map(int, input().split())) tar = 1 for a_ in A: if a_ == tar: tar += 1 tar -= 1 if tar: print((N - tar)) else: print((-1))
22
13
418
175
from bisect import bisect_left N = int(eval(input())) (*A,) = list(map(int, input().split())) L = [A[0]] for a in A[1:]: if a > L[-1]: # Lの末尾よりaが大きければ増加部分列を延長できる L.append(a) else: # そうでなければ、「aより小さい最大要素の次」をaにする # 該当位置は、二分探索で特定できる L[bisect_left(L, a)] = a ret = N + 1 for c...
N = int(eval(input())) (*A,) = list(map(int, input().split())) tar = 1 for a_ in A: if a_ == tar: tar += 1 tar -= 1 if tar: print((N - tar)) else: print((-1))
false
40.909091
[ "-from bisect import bisect_left", "-", "-L = [A[0]]", "-for a in A[1:]:", "- if a > L[-1]:", "- # Lの末尾よりaが大きければ増加部分列を延長できる", "- L.append(a)", "- else:", "- # そうでなければ、「aより小さい最大要素の次」をaにする", "- # 該当位置は、二分探索で特定できる", "- L[bisect_left(L, a)] = a", "-ret = N ...
false
0.039286
0.043547
0.90213
[ "s881556736", "s789121075" ]
u614314290
p03107
python
s686500258
s875984975
71
30
3,956
3,484
Accepted
Accepted
57.75
S = eval(input()) l = [] for s in S: si = int(s) if not l: l.append(si) else: if (l[-1] + si) & 1: l.pop() else: l.append(si) print((len(S) - len(l)))
from collections import defaultdict as dd # お約束 INF = float("inf") MOD = int(1e9 + 7) def int1(n): return int(n) - 1 def parse(*args): return tuple(p(v) for p, v in zip(args, input().split())) # エントリーポイント def main(): S = eval(input()) c = [0, 0] for s in S: c[s == "1"] += 1 ...
13
19
171
364
S = eval(input()) l = [] for s in S: si = int(s) if not l: l.append(si) else: if (l[-1] + si) & 1: l.pop() else: l.append(si) print((len(S) - len(l)))
from collections import defaultdict as dd # お約束 INF = float("inf") MOD = int(1e9 + 7) def int1(n): return int(n) - 1 def parse(*args): return tuple(p(v) for p, v in zip(args, input().split())) # エントリーポイント def main(): S = eval(input()) c = [0, 0] for s in S: c[s == "1"] += 1 print(...
false
31.578947
[ "-S = eval(input())", "-l = []", "-for s in S:", "- si = int(s)", "- if not l:", "- l.append(si)", "- else:", "- if (l[-1] + si) & 1:", "- l.pop()", "- else:", "- l.append(si)", "-print((len(S) - len(l)))", "+from collections import default...
false
0.031342
0.035026
0.894831
[ "s686500258", "s875984975" ]
u619144316
p02844
python
s342466570
s200822867
124
97
4,760
3,652
Accepted
Accepted
21.77
import collections N = int(eval(input())) S = [int(i) for i in list(eval(input()))] count = 0 for i in range(10): for num,j in enumerate(S): if j == i: T = S[num+1::] for k in list(set(T)): for num2, l in enumerate(T): if k == l: ...
N = int(eval(input())) S = list(map(int,eval(input()))) cnt = 0 for i in range(10): if i in S: k = S.index(i) for j in range(10): if j in S[k+1:]: l = S[k+1:].index(j) cnt += len(set(S[k+l+2:])) print(cnt)
21
13
500
272
import collections N = int(eval(input())) S = [int(i) for i in list(eval(input()))] count = 0 for i in range(10): for num, j in enumerate(S): if j == i: T = S[num + 1 : :] for k in list(set(T)): for num2, l in enumerate(T): if k == l: ...
N = int(eval(input())) S = list(map(int, eval(input()))) cnt = 0 for i in range(10): if i in S: k = S.index(i) for j in range(10): if j in S[k + 1 :]: l = S[k + 1 :].index(j) cnt += len(set(S[k + l + 2 :])) print(cnt)
false
38.095238
[ "-import collections", "-", "-S = [int(i) for i in list(eval(input()))]", "-count = 0", "+S = list(map(int, eval(input())))", "+cnt = 0", "- for num, j in enumerate(S):", "- if j == i:", "- T = S[num + 1 : :]", "- for k in list(set(T)):", "- for num...
false
0.072048
0.043184
1.668411
[ "s342466570", "s200822867" ]
u450956662
p03805
python
s691226757
s434850576
24
21
3,064
3,064
Accepted
Accepted
12.5
from itertools import permutations N, M = list(map(int, input().split())) E = [set() for _ in range(N)] for _ in range(M): a, b = list(map(int, input().split())) E[a-1].add(b-1) E[b-1].add(a-1) ans = 0 for p in permutations([i for i in range(1, N)]): i = 0 for j in p: if j not...
def bitDP(): dp = [[0] * N for _ in range(1 << N)] dp[1][0] = 1 for i in range(1 << N): for v in range(N): if (i >> v) & 0: continue j = i ^ (1 << v) for u in range(N): if (j >> u) & 1 and v in E[u]: d...
19
22
392
587
from itertools import permutations N, M = list(map(int, input().split())) E = [set() for _ in range(N)] for _ in range(M): a, b = list(map(int, input().split())) E[a - 1].add(b - 1) E[b - 1].add(a - 1) ans = 0 for p in permutations([i for i in range(1, N)]): i = 0 for j in p: if j not in E[...
def bitDP(): dp = [[0] * N for _ in range(1 << N)] dp[1][0] = 1 for i in range(1 << N): for v in range(N): if (i >> v) & 0: continue j = i ^ (1 << v) for u in range(N): if (j >> u) & 1 and v in E[u]: dp[i][v] += ...
false
13.636364
[ "-from itertools import permutations", "+def bitDP():", "+ dp = [[0] * N for _ in range(1 << N)]", "+ dp[1][0] = 1", "+ for i in range(1 << N):", "+ for v in range(N):", "+ if (i >> v) & 0:", "+ continue", "+ j = i ^ (1 << v)", "+ for...
false
0.15029
0.152578
0.985004
[ "s691226757", "s434850576" ]
u462329577
p03244
python
s753050579
s419548237
449
180
82,396
32,084
Accepted
Accepted
59.91
#!/usr/bin/env python3 n = int(eval(input())) a = list(map(int,input().split())) cnt_odd = [0]*(10**5+1)# a[2k]での個数 cnt_even = [0]*(10**5+1) for i in range(n): if i %2: cnt_odd[a[i]] += 1 else: cnt_even[a[i]] += 1 odd,idx_odd=list(zip(*sorted(zip(cnt_odd,list(range(10**5+1)))))) even,idx_even=list(z...
n = int(eval(input())) v = list(map(int, input().split())) freq_odd = [0] * (10 ** 5 + 1) freq_even = [0] * (10 ** 5 + 1) for i in range(n // 2): freq_odd[v[2 * i]] += 1 freq_even[v[2 * i + 1]] += 1 # print(freq_odd[:10], freq_even[:10]) freq_even, id_even = list(zip(*sorted(zip(freq_even, list(range(10...
17
16
543
627
#!/usr/bin/env python3 n = int(eval(input())) a = list(map(int, input().split())) cnt_odd = [0] * (10**5 + 1) # a[2k]での個数 cnt_even = [0] * (10**5 + 1) for i in range(n): if i % 2: cnt_odd[a[i]] += 1 else: cnt_even[a[i]] += 1 odd, idx_odd = list(zip(*sorted(zip(cnt_odd, list(range(10**5 + 1)))))...
n = int(eval(input())) v = list(map(int, input().split())) freq_odd = [0] * (10**5 + 1) freq_even = [0] * (10**5 + 1) for i in range(n // 2): freq_odd[v[2 * i]] += 1 freq_even[v[2 * i + 1]] += 1 # print(freq_odd[:10], freq_even[:10]) freq_even, id_even = list(zip(*sorted(zip(freq_even, list(range(10**5 + 1)))))...
false
5.882353
[ "-#!/usr/bin/env python3", "-a = list(map(int, input().split()))", "-cnt_odd = [0] * (10**5 + 1) # a[2k]での個数", "-cnt_even = [0] * (10**5 + 1)", "-for i in range(n):", "- if i % 2:", "- cnt_odd[a[i]] += 1", "- else:", "- cnt_even[a[i]] += 1", "-odd, idx_odd = list(zip(*sorted(z...
false
0.169891
0.288805
0.588255
[ "s753050579", "s419548237" ]
u752907966
p02773
python
s253726499
s010665489
392
340
35,944
35,952
Accepted
Accepted
13.27
from collections import Counter import sys input = sys.stdin.readline n=int(eval(input())) s=[] for _ in range(n): s.append(input().rstrip()) c = Counter(s) ans=[] max_vote = max(c.values()) for i,j in list(c.items()): if j == max_vote: ans.append(i) print(("\n".join(sorted(ans))))
def main(): from collections import Counter import sys input = sys.stdin.readline n=int(eval(input())) s=[] for _ in range(n): s.append(input().rstrip()) c = Counter(s) ans=[] max_vote = max(c.values()) for i,j in list(c.items()): if j == max_vote: ...
14
16
297
374
from collections import Counter import sys input = sys.stdin.readline n = int(eval(input())) s = [] for _ in range(n): s.append(input().rstrip()) c = Counter(s) ans = [] max_vote = max(c.values()) for i, j in list(c.items()): if j == max_vote: ans.append(i) print(("\n".join(sorted(ans))))
def main(): from collections import Counter import sys input = sys.stdin.readline n = int(eval(input())) s = [] for _ in range(n): s.append(input().rstrip()) c = Counter(s) ans = [] max_vote = max(c.values()) for i, j in list(c.items()): if j == max_vote: ...
false
12.5
[ "-from collections import Counter", "-import sys", "+def main():", "+ from collections import Counter", "+ import sys", "-input = sys.stdin.readline", "-n = int(eval(input()))", "-s = []", "-for _ in range(n):", "- s.append(input().rstrip())", "-c = Counter(s)", "-ans = []", "-max_v...
false
0.058659
0.034988
1.67653
[ "s253726499", "s010665489" ]
u268516119
p03546
python
s459028431
s238026699
197
31
40,284
3,316
Accepted
Accepted
84.26
def minindex(arrived,costs): mindex = "end" curmin = 100000000 for i in range(10): if arrived[i]:continue if curmin>costs[i]: mindex = i curmin = costs[i] return mindex H,W = list(map(int,input().split())) C = [[int(j) for j in input().split()] for i i...
inf = 1000000000 H,W = list(map(int,input().split())) C = [[int(j) for j in input().split()] for i in range(10)] #C[i][j]はiをjにするコスト #各ノードから1への最短距離 for m in range(10): for s in range(10): for g in range(10): C[s][g] = min(C[s][g],C[s][m] + C[m][g]) def maryoku(x): if x == -1:r...
33
17
880
466
def minindex(arrived, costs): mindex = "end" curmin = 100000000 for i in range(10): if arrived[i]: continue if curmin > costs[i]: mindex = i curmin = costs[i] return mindex H, W = list(map(int, input().split())) C = [[int(j) for j in input().split()]...
inf = 1000000000 H, W = list(map(int, input().split())) C = [[int(j) for j in input().split()] for i in range(10)] # C[i][j]はiをjにするコスト # 各ノードから1への最短距離 for m in range(10): for s in range(10): for g in range(10): C[s][g] = min(C[s][g], C[s][m] + C[m][g]) def maryoku(x): if x == -1: r...
false
48.484848
[ "-def minindex(arrived, costs):", "- mindex = \"end\"", "- curmin = 100000000", "- for i in range(10):", "- if arrived[i]:", "- continue", "- if curmin > costs[i]:", "- mindex = i", "- curmin = costs[i]", "- return mindex", "-", "-", ...
false
0.076247
0.042554
1.791774
[ "s459028431", "s238026699" ]
u057109575
p03221
python
s226991410
s634975269
864
624
35,968
47,328
Accepted
Accepted
27.78
N, M = list(map(int, input().split())) X = [[i] + list(map(int, input().split())) for i in range(M)] X.sort(key=lambda x: (x[1], x[2])) city = X[0][1] num = 0 for v in X: if city == v[1]: num += 1 else: city = v[1] num = 1 v.append(num) X.sort() for v in X: prin...
N, M = list(map(int, input().split())) X = [list(map(int, input().split())) for _ in range(M)] ans = [''] * M num = [1] * N for i, v in sorted(enumerate(X), key=lambda x: (x[1][0], x[1][1])): ans[i] = '{:06}{:06}'.format(v[0], num[v[0] - 1]) num[v[0] - 1] += 1 print(('\n'.join(ans)))
17
10
349
299
N, M = list(map(int, input().split())) X = [[i] + list(map(int, input().split())) for i in range(M)] X.sort(key=lambda x: (x[1], x[2])) city = X[0][1] num = 0 for v in X: if city == v[1]: num += 1 else: city = v[1] num = 1 v.append(num) X.sort() for v in X: print(("{:06}{:06}".fo...
N, M = list(map(int, input().split())) X = [list(map(int, input().split())) for _ in range(M)] ans = [""] * M num = [1] * N for i, v in sorted(enumerate(X), key=lambda x: (x[1][0], x[1][1])): ans[i] = "{:06}{:06}".format(v[0], num[v[0] - 1]) num[v[0] - 1] += 1 print(("\n".join(ans)))
false
41.176471
[ "-X = [[i] + list(map(int, input().split())) for i in range(M)]", "-X.sort(key=lambda x: (x[1], x[2]))", "-city = X[0][1]", "-num = 0", "-for v in X:", "- if city == v[1]:", "- num += 1", "- else:", "- city = v[1]", "- num = 1", "- v.append(num)", "-X.sort()", "...
false
0.036078
0.035669
1.011492
[ "s226991410", "s634975269" ]
u755180064
p02773
python
s862342568
s058745328
1,100
642
104,400
35,208
Accepted
Accepted
41.64
def main(): n = int(eval(input())) words = [eval(input()) for i in range(n)] words_count = {} for w in words: words_count.setdefault(w, 0) words_count[w] += 1 ans = '' count = 0 for w in words_count: count = words_count[w] if words_count[w] > count else co...
url = "https://atcoder.jp//contests/abc155/tasks/abc155_c" def main(): n = int(eval(input())) words = [eval(input()) for i in range(n)] words_count = {} for w in words: words_count.setdefault(w, 0) words_count[w] += 1 ans = '' count = 0 for w in words_count: ...
25
28
524
589
def main(): n = int(eval(input())) words = [eval(input()) for i in range(n)] words_count = {} for w in words: words_count.setdefault(w, 0) words_count[w] += 1 ans = "" count = 0 for w in words_count: count = words_count[w] if words_count[w] > count else count ans ...
url = "https://atcoder.jp//contests/abc155/tasks/abc155_c" def main(): n = int(eval(input())) words = [eval(input()) for i in range(n)] words_count = {} for w in words: words_count.setdefault(w, 0) words_count[w] += 1 ans = "" count = 0 for w in words_count: count =...
false
10.714286
[ "+url = \"https://atcoder.jp//contests/abc155/tasks/abc155_c\"", "+", "+" ]
false
0.06298
0.075458
0.834646
[ "s862342568", "s058745328" ]
u987164499
p02861
python
s808408430
s176930857
506
403
11,548
3,064
Accepted
Accepted
20.36
from sys import stdin import statistics from math import factorial import math from itertools import permutations n = int(stdin.readline().rstrip()) li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(n)] lis = [] lin = list(permutations(li,n)) for i in range(len(lin)): liv = [] ...
from itertools import permutations import math n = int(eval(input())) li = [tuple(map(int,input().split())) for _ in range(n)] # 2点間の距離 def length(x1,y1,x2,y2): return(math.sqrt(abs(x2-x1)**2+abs(y2-y1)**2)) point = 0 for i in permutations(li): for j in range(1,n): point += length(i[j-...
21
17
548
380
from sys import stdin import statistics from math import factorial import math from itertools import permutations n = int(stdin.readline().rstrip()) li = [list(map(int, stdin.readline().rstrip().split())) for _ in range(n)] lis = [] lin = list(permutations(li, n)) for i in range(len(lin)): liv = [] for j in ra...
from itertools import permutations import math n = int(eval(input())) li = [tuple(map(int, input().split())) for _ in range(n)] # 2点間の距離 def length(x1, y1, x2, y2): return math.sqrt(abs(x2 - x1) ** 2 + abs(y2 - y1) ** 2) point = 0 for i in permutations(li): for j in range(1, n): point += length(i[j -...
false
19.047619
[ "-from sys import stdin", "-import statistics", "-from math import factorial", "+from itertools import permutations", "-from itertools import permutations", "-n = int(stdin.readline().rstrip())", "-li = [list(map(int, stdin.readline().rstrip().split())) for _ in range(n)]", "-lis = []", "-lin = list...
false
0.043289
0.041658
1.039155
[ "s808408430", "s176930857" ]
u694810977
p03545
python
s623092914
s437825103
20
17
3,316
3,064
Accepted
Accepted
15
S = str(eval(input())) A = int(S[0]) B = int(S[1]) C = int(S[2]) D = int(S[3]) if A+B+C+D == 7: print((str(A) + "+" + str(B) + "+" + str(C) + "+" + str(D) + "=" + "7")) elif A+B+C-D == 7: print((str(A) + "+" + str(B) + "+" + str(C) + "-" + str(D) + "=" + "7")) elif A+B-C+D == 7: print((str(A) + ...
s = str(eval(input())) n = len(s) lists = [] ans_list = [] Sum = 0 for i in range(2**n): lists = [] ans_list = [] Sum = int(s[0]) for j in range(n-1): if ((i >> j) & 1): lists.append(1) else: lists.append(0) for k in range(n-1): ans_list...
21
33
849
777
S = str(eval(input())) A = int(S[0]) B = int(S[1]) C = int(S[2]) D = int(S[3]) if A + B + C + D == 7: print((str(A) + "+" + str(B) + "+" + str(C) + "+" + str(D) + "=" + "7")) elif A + B + C - D == 7: print((str(A) + "+" + str(B) + "+" + str(C) + "-" + str(D) + "=" + "7")) elif A + B - C + D == 7: print((str...
s = str(eval(input())) n = len(s) lists = [] ans_list = [] Sum = 0 for i in range(2**n): lists = [] ans_list = [] Sum = int(s[0]) for j in range(n - 1): if (i >> j) & 1: lists.append(1) else: lists.append(0) for k in range(n - 1): ans_list.append(s[k])...
false
36.363636
[ "-S = str(eval(input()))", "-A = int(S[0])", "-B = int(S[1])", "-C = int(S[2])", "-D = int(S[3])", "-if A + B + C + D == 7:", "- print((str(A) + \"+\" + str(B) + \"+\" + str(C) + \"+\" + str(D) + \"=\" + \"7\"))", "-elif A + B + C - D == 7:", "- print((str(A) + \"+\" + str(B) + \"+\" + str(C) ...
false
0.041256
0.042919
0.961273
[ "s623092914", "s437825103" ]
u987164499
p03043
python
s712072927
s849370654
60
38
3,060
3,064
Accepted
Accepted
36.67
from sys import stdin n,k = [int(x) for x in stdin.readline().rstrip().split()] point = 0 kaku = 0.0 for i in range(1,n+1): point = 0 point += i kaisu = 0 while 0 < point < k: kaisu += 1 point *= 2 kaku += (1/n)*(1/(2**kaisu)) print(kaku)
n,k = list(map(int,input().split())) point = 0 for i in range(1,n+1): j = 1/n if i >= k: point += j continue now = i count = 0 while now < k: now *= 2 count += 1 j *= (1/2)**count point += j print(point)
16
17
292
279
from sys import stdin n, k = [int(x) for x in stdin.readline().rstrip().split()] point = 0 kaku = 0.0 for i in range(1, n + 1): point = 0 point += i kaisu = 0 while 0 < point < k: kaisu += 1 point *= 2 kaku += (1 / n) * (1 / (2**kaisu)) print(kaku)
n, k = list(map(int, input().split())) point = 0 for i in range(1, n + 1): j = 1 / n if i >= k: point += j continue now = i count = 0 while now < k: now *= 2 count += 1 j *= (1 / 2) ** count point += j print(point)
false
5.882353
[ "-from sys import stdin", "-", "-n, k = [int(x) for x in stdin.readline().rstrip().split()]", "+n, k = list(map(int, input().split()))", "-kaku = 0.0", "- point = 0", "- point += i", "- kaisu = 0", "- while 0 < point < k:", "- kaisu += 1", "- point *= 2", "- kaku +...
false
0.006836
0.047927
0.142634
[ "s712072927", "s849370654" ]
u480200603
p03127
python
s766991150
s817990253
143
61
14,252
14,224
Accepted
Accepted
57.34
import sys n = int(eval(input())) a = list(map(int, input().split())) sys.setrecursionlimit(10 ** 5) def cut(l): l.sort() nokori = [l[0]] for i in range(1, len(l)): b = l[i] % l[0] if b != 0: nokori.append(b) if len(nokori) != 1: return cut(nokori) ...
import sys n = int(eval(input())) al = list(map(int, input().split())) sys.setrecursionlimit(10 ** 5) def gcd(a, b): if b < a: a, b = b, a if b % a == 0: return a else: return gcd(a, b % a) def gcdl(num, n): ans = num[0] for i in range(n): ans ...
19
24
352
373
import sys n = int(eval(input())) a = list(map(int, input().split())) sys.setrecursionlimit(10**5) def cut(l): l.sort() nokori = [l[0]] for i in range(1, len(l)): b = l[i] % l[0] if b != 0: nokori.append(b) if len(nokori) != 1: return cut(nokori) return nokori[...
import sys n = int(eval(input())) al = list(map(int, input().split())) sys.setrecursionlimit(10**5) def gcd(a, b): if b < a: a, b = b, a if b % a == 0: return a else: return gcd(a, b % a) def gcdl(num, n): ans = num[0] for i in range(n): ans = gcd(ans, num[i]) ...
false
20.833333
[ "-a = list(map(int, input().split()))", "+al = list(map(int, input().split()))", "-def cut(l):", "- l.sort()", "- nokori = [l[0]]", "- for i in range(1, len(l)):", "- b = l[i] % l[0]", "- if b != 0:", "- nokori.append(b)", "- if len(nokori) != 1:", "- ...
false
0.045555
0.035489
1.283638
[ "s766991150", "s817990253" ]
u695811449
p03025
python
s537657145
s571164210
1,597
857
18,984
20,528
Accepted
Accepted
46.34
N,A,B,C=list(map(int,input().split())) mod=10**9+7 #factorial,facotiralの逆数を事前計算. #N=10**5あたりまで有効 FACT=[1,1] FACT_INV=[1,1] for i in range(2,2*10**5+1): FACT.append(FACT[-1]*i%mod) FACT_INV.append(FACT_INV[-1]*pow(i,mod-2,mod)%mod) def Combi(N,K): return FACT[N]*FACT_INV[N-K]*FACT_INV[K]%...
N,A,B,C=list(map(int,input().split())) mod=10**9+7 #factorial,facotiralの逆数を事前計算. #N=10**5あたりまで有効 FACT=[1] for i in range(1,2*10**5+1): FACT.append(FACT[-1]*i%mod) FACT_INV=[pow(FACT[-1],mod-2,mod)] for i in range(2*10**5,0,-1): FACT_INV.append(FACT_INV[-1]*i%mod) FACT_INV=FACT_INV[::-1] ...
28
31
639
694
N, A, B, C = list(map(int, input().split())) mod = 10**9 + 7 # factorial,facotiralの逆数を事前計算. # N=10**5あたりまで有効 FACT = [1, 1] FACT_INV = [1, 1] for i in range(2, 2 * 10**5 + 1): FACT.append(FACT[-1] * i % mod) FACT_INV.append(FACT_INV[-1] * pow(i, mod - 2, mod) % mod) def Combi(N, K): return FACT[N] * FACT_I...
N, A, B, C = list(map(int, input().split())) mod = 10**9 + 7 # factorial,facotiralの逆数を事前計算. # N=10**5あたりまで有効 FACT = [1] for i in range(1, 2 * 10**5 + 1): FACT.append(FACT[-1] * i % mod) FACT_INV = [pow(FACT[-1], mod - 2, mod)] for i in range(2 * 10**5, 0, -1): FACT_INV.append(FACT_INV[-1] * i % mod) FACT_INV = ...
false
9.677419
[ "-FACT = [1, 1]", "-FACT_INV = [1, 1]", "-for i in range(2, 2 * 10**5 + 1):", "+FACT = [1]", "+for i in range(1, 2 * 10**5 + 1):", "- FACT_INV.append(FACT_INV[-1] * pow(i, mod - 2, mod) % mod)", "+FACT_INV = [pow(FACT[-1], mod - 2, mod)]", "+for i in range(2 * 10**5, 0, -1):", "+ FACT_INV.appe...
false
1.049866
0.252206
4.162725
[ "s537657145", "s571164210" ]
u561083515
p02781
python
s801901817
s637302135
26
22
3,940
3,064
Accepted
Accepted
15.38
# ref: https://atcoder.jp/contests/abc154/submissions/9991364 from functools import lru_cache #0以上N以下の整数で、0でない数字がちょうどK個あるものの個数 @lru_cache(None) def F(N, K): assert N >= 0 if N < 10: if K == 0: return 1 if K == 1: return N else: return 0...
N = eval(input()) K = int(eval(input())) L = len(N) # dp[i][j][k] # i: 決定した桁数(上から) # j: 0の個数 # k: N未満確定フラグ dp = [[[0] * 2 for _ in range(5)] for _ in range(110)] dp[0][0][0] = 1 # 配るDP for i in range(L): S = int(N[i]) for j in range(K+1): for k in range(2): # d: 次の桁 ...
36
24
645
468
# ref: https://atcoder.jp/contests/abc154/submissions/9991364 from functools import lru_cache # 0以上N以下の整数で、0でない数字がちょうどK個あるものの個数 @lru_cache(None) def F(N, K): assert N >= 0 if N < 10: if K == 0: return 1 if K == 1: return N else: return 0 q, r = di...
N = eval(input()) K = int(eval(input())) L = len(N) # dp[i][j][k] # i: 決定した桁数(上から) # j: 0の個数 # k: N未満確定フラグ dp = [[[0] * 2 for _ in range(5)] for _ in range(110)] dp[0][0][0] = 1 # 配るDP for i in range(L): S = int(N[i]) for j in range(K + 1): for k in range(2): # d: 次の桁 for d in ra...
false
33.333333
[ "-# ref: https://atcoder.jp/contests/abc154/submissions/9991364", "-from functools import lru_cache", "-", "-# 0以上N以下の整数で、0でない数字がちょうどK個あるものの個数", "-@lru_cache(None)", "-def F(N, K):", "- assert N >= 0", "- if N < 10:", "- if K == 0:", "- return 1", "- if K == 1:", ...
false
0.149627
0.043945
3.404909
[ "s801901817", "s637302135" ]
u014333473
p03719
python
s064413964
s918795829
29
24
9,060
9,168
Accepted
Accepted
17.24
a,b,c=list(map(int,input().split()));print((' YNeos'[a<=c<=b::2].strip()))
a,b,c=list(map(int,input().split()));print((['No','Yes'][a<=c<=b]))
1
1
66
59
a, b, c = list(map(int, input().split())) print((" YNeos"[a <= c <= b :: 2].strip()))
a, b, c = list(map(int, input().split())) print((["No", "Yes"][a <= c <= b]))
false
0
[ "-print((\" YNeos\"[a <= c <= b :: 2].strip()))", "+print(([\"No\", \"Yes\"][a <= c <= b]))" ]
false
0.041233
0.040075
1.028898
[ "s064413964", "s918795829" ]
u054514819
p02830
python
s120632257
s604058976
178
67
38,256
61,968
Accepted
Accepted
62.36
N = int(eval(input())) s, t = list(map(str, input().split())) ans = '' for n in range(N): ans += s[n] ans += t[n] print(ans)
import sys def input(): return sys.stdin.readline().strip() def mapint(): return list(map(int, input().split())) sys.setrecursionlimit(10**9) N = int(eval(input())) S, T = input().split() ans = '' for s, t in zip(list(S), list(T)): ans += s+t print(ans)
8
11
128
256
N = int(eval(input())) s, t = list(map(str, input().split())) ans = "" for n in range(N): ans += s[n] ans += t[n] print(ans)
import sys def input(): return sys.stdin.readline().strip() def mapint(): return list(map(int, input().split())) sys.setrecursionlimit(10**9) N = int(eval(input())) S, T = input().split() ans = "" for s, t in zip(list(S), list(T)): ans += s + t print(ans)
false
27.272727
[ "+import sys", "+", "+", "+def input():", "+ return sys.stdin.readline().strip()", "+", "+", "+def mapint():", "+ return list(map(int, input().split()))", "+", "+", "+sys.setrecursionlimit(10**9)", "-s, t = list(map(str, input().split()))", "+S, T = input().split()", "-for n in ran...
false
0.007699
0.040657
0.189364
[ "s120632257", "s604058976" ]
u519939795
p03636
python
s268562070
s501515721
21
17
3,060
2,940
Accepted
Accepted
19.05
s = str(eval(input())) x = len(s) -2 print((s[0] + str(x) + s[-1]))
s = eval(input()) print((s[0]+str(len(s)-2)+s[-1:]))
5
2
66
45
s = str(eval(input())) x = len(s) - 2 print((s[0] + str(x) + s[-1]))
s = eval(input()) print((s[0] + str(len(s) - 2) + s[-1:]))
false
60
[ "-s = str(eval(input()))", "-x = len(s) - 2", "-print((s[0] + str(x) + s[-1]))", "+s = eval(input())", "+print((s[0] + str(len(s) - 2) + s[-1:]))" ]
false
0.063665
0.046369
1.373006
[ "s268562070", "s501515721" ]
u094191970
p03285
python
s505207395
s132035467
19
17
2,940
2,940
Accepted
Accepted
10.53
def inp_i(): return list(map(int, input().split())) N=int(eval(input())) ans=0 for i in range(N): for n in range(N): if (4*i)+(7*n)==N: ans += 1 if ans != 0: print('Yes') else: print('No')
n=int(eval(input())) for i in range(n): for j in range(n): if i*4+j*7==n: print('Yes') exit() print('No')
12
8
220
125
def inp_i(): return list(map(int, input().split())) N = int(eval(input())) ans = 0 for i in range(N): for n in range(N): if (4 * i) + (7 * n) == N: ans += 1 if ans != 0: print("Yes") else: print("No")
n = int(eval(input())) for i in range(n): for j in range(n): if i * 4 + j * 7 == n: print("Yes") exit() print("No")
false
33.333333
[ "-def inp_i():", "- return list(map(int, input().split()))", "-", "-", "-N = int(eval(input()))", "-ans = 0", "-for i in range(N):", "- for n in range(N):", "- if (4 * i) + (7 * n) == N:", "- ans += 1", "-if ans != 0:", "- print(\"Yes\")", "-else:", "- print(\...
false
0.063421
0.040455
1.567707
[ "s505207395", "s132035467" ]
u607563136
p03127
python
s887856510
s852841706
105
58
20,008
20,604
Accepted
Accepted
44.76
n = int(eval(input())) a = list(map(int,input().split())) x = a[0] for i in range(1,n): y = a[i] x,y = max(x,y),min(x,y) while y!= 0: x,y = y,x%y print(x)
import functools import math n = int(eval(input())) a = list(map(int,input().split())) print((functools.reduce(math.gcd,a)))
10
5
178
120
n = int(eval(input())) a = list(map(int, input().split())) x = a[0] for i in range(1, n): y = a[i] x, y = max(x, y), min(x, y) while y != 0: x, y = y, x % y print(x)
import functools import math n = int(eval(input())) a = list(map(int, input().split())) print((functools.reduce(math.gcd, a)))
false
50
[ "+import functools", "+import math", "+", "-x = a[0]", "-for i in range(1, n):", "- y = a[i]", "- x, y = max(x, y), min(x, y)", "- while y != 0:", "- x, y = y, x % y", "-print(x)", "+print((functools.reduce(math.gcd, a)))" ]
false
0.037736
0.038361
0.983725
[ "s887856510", "s852841706" ]
u506858457
p03862
python
s572290037
s256818656
105
90
14,540
14,132
Accepted
Accepted
14.29
N,x=list(map(int,input().split())) A=list(map(int,input().split())) cnt=0 pre=0 for i in range(N): dif=max(A[i]+pre-x,0) cnt+=dif A[i]-=dif pre=A[i] print(cnt)
N,x=list(map(int,input().split())) A=list(map(int,input().split())) if A[0]>x: cnt=A[0]-x A[0]=A[0]-cnt else: cnt=0 for i in range(1,N): gap=A[i]+A[i-1]-x if gap>0: cnt+=gap A[i]-=gap print(cnt)
13
13
184
222
N, x = list(map(int, input().split())) A = list(map(int, input().split())) cnt = 0 pre = 0 for i in range(N): dif = max(A[i] + pre - x, 0) cnt += dif A[i] -= dif pre = A[i] print(cnt)
N, x = list(map(int, input().split())) A = list(map(int, input().split())) if A[0] > x: cnt = A[0] - x A[0] = A[0] - cnt else: cnt = 0 for i in range(1, N): gap = A[i] + A[i - 1] - x if gap > 0: cnt += gap A[i] -= gap print(cnt)
false
0
[ "-cnt = 0", "-pre = 0", "-for i in range(N):", "- dif = max(A[i] + pre - x, 0)", "- cnt += dif", "- A[i] -= dif", "- pre = A[i]", "+if A[0] > x:", "+ cnt = A[0] - x", "+ A[0] = A[0] - cnt", "+else:", "+ cnt = 0", "+for i in range(1, N):", "+ gap = A[i] + A[i - 1] - ...
false
0.046316
0.066332
0.698239
[ "s572290037", "s256818656" ]
u148551245
p03423
python
s402498066
s722701537
176
17
38,400
2,940
Accepted
Accepted
90.34
n = int(eval(input())) print((n // 3))
n = int(eval(input())) ans = n // 3 print(ans)
2
3
31
42
n = int(eval(input())) print((n // 3))
n = int(eval(input())) ans = n // 3 print(ans)
false
33.333333
[ "-print((n // 3))", "+ans = n // 3", "+print(ans)" ]
false
0.148039
0.038967
3.799047
[ "s402498066", "s722701537" ]
u867826040
p02879
python
s769099667
s704076654
169
28
38,256
9,164
Accepted
Accepted
83.43
A, B = list(map(int, input().split())) if A >= 10 or B >= 10: print((-1)) else: print((A*B))
a,b = list(map(int,input().split())) if a <= 9 and b <= 9: print((a*b)) else: print((-1))
6
5
97
87
A, B = list(map(int, input().split())) if A >= 10 or B >= 10: print((-1)) else: print((A * B))
a, b = list(map(int, input().split())) if a <= 9 and b <= 9: print((a * b)) else: print((-1))
false
16.666667
[ "-A, B = list(map(int, input().split()))", "-if A >= 10 or B >= 10:", "+a, b = list(map(int, input().split()))", "+if a <= 9 and b <= 9:", "+ print((a * b))", "+else:", "-else:", "- print((A * B))" ]
false
0.086753
0.03806
2.279346
[ "s769099667", "s704076654" ]
u952708174
p02918
python
s719487762
s399960739
37
31
4,728
3,956
Accepted
Accepted
16.22
def d_face_produces_unhappiness(): N, K = [int(i) for i in input().split()] S = eval(input()) before_char = S[0] t = [] v = 0 for s in S + '*': if s != before_char: t.append(v) v = 1 else: v += 1 before_char = s t.sort(...
def d_face_produces_unhappiness(): N, K = [int(i) for i in input().split()] S = eval(input()) # 初期状態で幸福な人数 + 1回の操作で高々2人増やせる。ただしN-1人まで score_first = len([1 for i in range(N - 1) if S[i] == S[i + 1]]) return min(score_first + 2 * K, N - 1) print((d_face_produces_unhappiness()))
19
9
471
298
def d_face_produces_unhappiness(): N, K = [int(i) for i in input().split()] S = eval(input()) before_char = S[0] t = [] v = 0 for s in S + "*": if s != before_char: t.append(v) v = 1 else: v += 1 before_char = s t.sort(reverse=True)...
def d_face_produces_unhappiness(): N, K = [int(i) for i in input().split()] S = eval(input()) # 初期状態で幸福な人数 + 1回の操作で高々2人増やせる。ただしN-1人まで score_first = len([1 for i in range(N - 1) if S[i] == S[i + 1]]) return min(score_first + 2 * K, N - 1) print((d_face_produces_unhappiness()))
false
52.631579
[ "- before_char = S[0]", "- t = []", "- v = 0", "- for s in S + \"*\":", "- if s != before_char:", "- t.append(v)", "- v = 1", "- else:", "- v += 1", "- before_char = s", "- t.sort(reverse=True)", "- for i in range(min(K, l...
false
0.118458
0.077029
1.537829
[ "s719487762", "s399960739" ]
u998435601
p02397
python
s109899503
s950613637
30
20
6,272
6,400
Accepted
Accepted
33.33
while 1: a,b = list(map(int, input().split())) if a == b == 0: break elif a < b: print("%s %s" % (a,b)) else: print("%s %s" % (b,a))
while 1: a,b = list(map(int, input().split())) if a == 0 and b == 0: break elif a < b: print(a, b) else: print(b, a)
8
8
145
129
while 1: a, b = list(map(int, input().split())) if a == b == 0: break elif a < b: print("%s %s" % (a, b)) else: print("%s %s" % (b, a))
while 1: a, b = list(map(int, input().split())) if a == 0 and b == 0: break elif a < b: print(a, b) else: print(b, a)
false
0
[ "- if a == b == 0:", "+ if a == 0 and b == 0:", "- print(\"%s %s\" % (a, b))", "+ print(a, b)", "- print(\"%s %s\" % (b, a))", "+ print(b, a)" ]
false
0.05459
0.112614
0.484749
[ "s109899503", "s950613637" ]
u863442865
p03163
python
s375825116
s878463534
409
282
118,640
39,792
Accepted
Accepted
31.05
def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10000000) from collections import Counter, deque #from collections import defaultdict from itertools import combinations, permutations #from itertools import accumulate, product from bisect import bisect_...
def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10000000) from collections import Counter, deque #from collections import defaultdict from itertools import combinations, permutations #from itertools import accumulate, product from bisect import bisect_left...
33
24
888
743
def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10000000) from collections import Counter, deque # from collections import defaultdict from itertools import combinations, permutations # from itertools import accumulate, product from bisect import bisect_left, b...
def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10000000) from collections import Counter, deque # from collections import defaultdict from itertools import combinations, permutations # from itertools import accumulate, product from bisect import bisect_left, b...
false
27.272727
[ "- w = [0] * N", "- v = [0] * N", "+ wv = [tuple(map(int, input().split())) for i in range(N)]", "+ dp = [0] * (W + 1)", "- w[i], v[i] = list(map(int, input().split()))", "- dp = [[0] * (W + 1) for _ in range(N + 1)]", "- for i in range(N):", "- for j in range(W + 1):",...
false
0.110319
0.146813
0.751424
[ "s375825116", "s878463534" ]
u961683878
p02659
python
s438687392
s728856967
118
104
27,152
27,156
Accepted
Accepted
11.86
#! /usr/bin/env python3 import sys import math import numpy as np int1 = lambda x: int(x) - 1 read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(500000) A, B = list(map(float, readline().split())) ans = int(A) * int(B * 1000000)...
#! /usr/bin/env python3 import sys import math import numpy as np int1 = lambda x: int(x) - 1 read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(500000) A, B = readline().decode().rstrip().split() A = int(A) B = 100 * int(B[0]) +...
16
18
344
383
#! /usr/bin/env python3 import sys import math import numpy as np int1 = lambda x: int(x) - 1 read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(500000) A, B = list(map(float, readline().split())) ans = int(A) * int(B * 1000000) // 1000000 pri...
#! /usr/bin/env python3 import sys import math import numpy as np int1 = lambda x: int(x) - 1 read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(500000) A, B = readline().decode().rstrip().split() A = int(A) B = 100 * int(B[0]) + 10 * int(B[2]...
false
11.111111
[ "-A, B = list(map(float, readline().split()))", "-ans = int(A) * int(B * 1000000) // 1000000", "-print((int(ans)))", "+A, B = readline().decode().rstrip().split()", "+A = int(A)", "+B = 100 * int(B[0]) + 10 * int(B[2]) + int(B[3])", "+ans = A * B // 100", "+print(ans)" ]
false
0.039496
0.041476
0.952265
[ "s438687392", "s728856967" ]
u484229314
p03073
python
s404871186
s300700421
664
128
11,132
3,956
Accepted
Accepted
80.72
S = eval(input()) s0 = [0 for i in range(len(S))] s1 = [1 for i in range(len(S))] for i in range(0, len(S), 2): s0[i] = (s0[i] + 1) % 2 s1[i] = (s1[i] + 1) % 2 s0 = ''.join(map(str, s0)) s1 = ''.join(map(str, s1)) def cnt(x): cnt = 0 while x > 0: cnt += x & 1 x = x >>...
S = eval(input()) s0 = 0 s1 = 0 for i, s in enumerate(list(S)): s0 += int(str(i % 2) == s) s1 += int(str((i + 1) % 2) == s) print((min(s0, s1)))
21
8
407
153
S = eval(input()) s0 = [0 for i in range(len(S))] s1 = [1 for i in range(len(S))] for i in range(0, len(S), 2): s0[i] = (s0[i] + 1) % 2 s1[i] = (s1[i] + 1) % 2 s0 = "".join(map(str, s0)) s1 = "".join(map(str, s1)) def cnt(x): cnt = 0 while x > 0: cnt += x & 1 x = x >> 1 return cnt ...
S = eval(input()) s0 = 0 s1 = 0 for i, s in enumerate(list(S)): s0 += int(str(i % 2) == s) s1 += int(str((i + 1) % 2) == s) print((min(s0, s1)))
false
61.904762
[ "-s0 = [0 for i in range(len(S))]", "-s1 = [1 for i in range(len(S))]", "-for i in range(0, len(S), 2):", "- s0[i] = (s0[i] + 1) % 2", "- s1[i] = (s1[i] + 1) % 2", "-s0 = \"\".join(map(str, s0))", "-s1 = \"\".join(map(str, s1))", "-", "-", "-def cnt(x):", "- cnt = 0", "- while x > ...
false
0.108418
0.084275
1.286479
[ "s404871186", "s300700421" ]
u706659319
p02554
python
s745618575
s019418768
113
81
62,752
63,936
Accepted
Accepted
28.32
def div(n,T): tmp = 10 ** 9 + 7 _ = 1 for t in range( T- 1): _ *= n _ %= tmp return _ * n N = int(eval(input())) a = div(10,N) b = div(9,N) c = div(8,N) print(((a + c - b * 2) % (10 ** 9 + 7)))
tmp = 10 ** 9 + 7 def div(n,T): _ = 1 for t in range(T): _ *= n _ %= tmp return _ N = int(eval(input())) a = div(10,N) b = div(9,N) c = div(8,N) print(((a + c - 2 * b) % tmp))
13
15
235
216
def div(n, T): tmp = 10**9 + 7 _ = 1 for t in range(T - 1): _ *= n _ %= tmp return _ * n N = int(eval(input())) a = div(10, N) b = div(9, N) c = div(8, N) print(((a + c - b * 2) % (10**9 + 7)))
tmp = 10**9 + 7 def div(n, T): _ = 1 for t in range(T): _ *= n _ %= tmp return _ N = int(eval(input())) a = div(10, N) b = div(9, N) c = div(8, N) print(((a + c - 2 * b) % tmp))
false
13.333333
[ "+tmp = 10**9 + 7", "+", "+", "- tmp = 10**9 + 7", "- for t in range(T - 1):", "+ for t in range(T):", "- return _ * n", "+ return _", "-print(((a + c - b * 2) % (10**9 + 7)))", "+print(((a + c - 2 * b) % tmp))" ]
false
0.169993
0.094532
1.798252
[ "s745618575", "s019418768" ]
u945181840
p03044
python
s971750687
s900062189
481
388
44,992
44,972
Accepted
Accepted
19.33
import sys readline = sys.stdin.readline readlines = sys.stdin.readlines read = sys.stdin.read N = int(readline()) graph = [[] for _ in range(N + 1)] for i in readlines(): u, v, w = list(map(int, i.split())) graph[u].append((v, w)) graph[v].append((u, w)) stack = [1] parent = [0] * (N + 1...
import sys readline = sys.stdin.readline readlines = sys.stdin.readlines read = sys.stdin.read def main(): N = int(readline()) graph = [[] for _ in range(N + 1)] for i in readlines(): u, v, w = list(map(int, i.split())) graph[u].append((v, w)) graph[v].append((u, w)) ...
29
33
591
722
import sys readline = sys.stdin.readline readlines = sys.stdin.readlines read = sys.stdin.read N = int(readline()) graph = [[] for _ in range(N + 1)] for i in readlines(): u, v, w = list(map(int, i.split())) graph[u].append((v, w)) graph[v].append((u, w)) stack = [1] parent = [0] * (N + 1) color = [0] * (N...
import sys readline = sys.stdin.readline readlines = sys.stdin.readlines read = sys.stdin.read def main(): N = int(readline()) graph = [[] for _ in range(N + 1)] for i in readlines(): u, v, w = list(map(int, i.split())) graph[u].append((v, w)) graph[v].append((u, w)) stack = [...
false
12.121212
[ "-N = int(readline())", "-graph = [[] for _ in range(N + 1)]", "-for i in readlines():", "- u, v, w = list(map(int, i.split()))", "- graph[u].append((v, w))", "- graph[v].append((u, w))", "-stack = [1]", "-parent = [0] * (N + 1)", "-color = [0] * (N + 1)", "-while stack:", "- here = ...
false
0.046023
0.037887
1.214725
[ "s971750687", "s900062189" ]
u170201762
p03148
python
s030147852
s479176775
805
508
77,272
32,256
Accepted
Accepted
36.89
from itertools import accumulate N,K = list(map(int,input().split())) td = [tuple(map(int,input().split())) for i in range(N)] td = [(x[0]-1,x[1]) for x in td] td.sort(key=lambda x:-x[1]) t = [-1]*N for i in range(N): t[td[i][0]] = 0 tdK = td[:K] for i in range(K): t[tdK[i][0]] = 1 t_used = [i ...
N,K = list(map(int,input().split())) td = [list(map(int,input().split())) for _ in range(N)] td.sort(key=lambda x:-x[1]) l,r = td[:K],td[K:] used_l = [0]*N for i in range(K): used_l[l[i][0]-1] += 1 remove = [] for i in range(K-1,-1,-1): if used_l[l[i][0]-1] >= 2: remove.append(l[i][1]) ...
49
34
1,152
714
from itertools import accumulate N, K = list(map(int, input().split())) td = [tuple(map(int, input().split())) for i in range(N)] td = [(x[0] - 1, x[1]) for x in td] td.sort(key=lambda x: -x[1]) t = [-1] * N for i in range(N): t[td[i][0]] = 0 tdK = td[:K] for i in range(K): t[tdK[i][0]] = 1 t_used = [i for i i...
N, K = list(map(int, input().split())) td = [list(map(int, input().split())) for _ in range(N)] td.sort(key=lambda x: -x[1]) l, r = td[:K], td[K:] used_l = [0] * N for i in range(K): used_l[l[i][0] - 1] += 1 remove = [] for i in range(K - 1, -1, -1): if used_l[l[i][0] - 1] >= 2: remove.append(l[i][1]) ...
false
30.612245
[ "-from itertools import accumulate", "-", "-td = [tuple(map(int, input().split())) for i in range(N)]", "-td = [(x[0] - 1, x[1]) for x in td]", "+td = [list(map(int, input().split())) for _ in range(N)]", "-t = [-1] * N", "-for i in range(N):", "- t[td[i][0]] = 0", "-tdK = td[:K]", "+l, r = td[...
false
0.054322
0.077937
0.697004
[ "s030147852", "s479176775" ]
u481187938
p02793
python
s827886124
s097164248
1,616
608
79,128
78,908
Accepted
Accepted
62.38
#!usr/bin/env python3 from collections import defaultdict, deque, Counter, OrderedDict from bisect import bisect_left, bisect_right from functools import reduce, lru_cache from heapq import heappush, heappop, heapify import itertools, bisect import math, fractions import sys, copy def L(): return sys.stdin....
#!usr/bin/env python3 from collections import defaultdict, deque, Counter, OrderedDict from bisect import bisect_left, bisect_right from functools import reduce, lru_cache from heapq import heappush, heappop, heapify import itertools, bisect import math, fractions import sys, copy def L(): return sys.stdin....
50
50
1,449
1,455
#!usr/bin/env python3 from collections import defaultdict, deque, Counter, OrderedDict from bisect import bisect_left, bisect_right from functools import reduce, lru_cache from heapq import heappush, heappop, heapify import itertools, bisect import math, fractions import sys, copy def L(): return sys.stdin.readli...
#!usr/bin/env python3 from collections import defaultdict, deque, Counter, OrderedDict from bisect import bisect_left, bisect_right from functools import reduce, lru_cache from heapq import heappush, heappop, heapify import itertools, bisect import math, fractions import sys, copy def L(): return sys.stdin.readli...
false
0
[ "- l = reduce(lcm, A, 1)", "+ l = reduce(lcm, A, 1) % MOD" ]
false
0.039119
0.048665
0.803847
[ "s827886124", "s097164248" ]
u170201762
p02893
python
s696437291
s208744548
1,521
76
123,272
5,220
Accepted
Accepted
95
mod = 998244353 N = int(eval(input())) X = eval(input()) d = [] for n in range(1,N+1): if N%n==0 and (N//n)%2==1: d.append(n) p_d = {} for n in d: p_d[n] = 0 S = [] for i in range(N): j = i//n if X[i%n]=='0': if j%2==0: S.append('0...
mod = 998244353 N = int(eval(input())) X = eval(input()) X_ = [] for i in range(N): if X[i]=='0': X_.append('1') else: X_.append('0') X_ = ''.join(X_) d = [] for n in range(1,N+1): if N%n==0 and (N//n)%2==1: d.append(n) p_d = {} for n in d: p_d[n] = 0 S...
45
35
831
597
mod = 998244353 N = int(eval(input())) X = eval(input()) d = [] for n in range(1, N + 1): if N % n == 0 and (N // n) % 2 == 1: d.append(n) p_d = {} for n in d: p_d[n] = 0 S = [] for i in range(N): j = i // n if X[i % n] == "0": if j % 2 == 0: S.append(...
mod = 998244353 N = int(eval(input())) X = eval(input()) X_ = [] for i in range(N): if X[i] == "0": X_.append("1") else: X_.append("0") X_ = "".join(X_) d = [] for n in range(1, N + 1): if N % n == 0 and (N // n) % 2 == 1: d.append(n) p_d = {} for n in d: p_d[n] = 0 S = (X[:n...
false
22.222222
[ "+X_ = []", "+for i in range(N):", "+ if X[i] == \"0\":", "+ X_.append(\"1\")", "+ else:", "+ X_.append(\"0\")", "+X_ = \"\".join(X_)", "- S = []", "- for i in range(N):", "- j = i // n", "- if X[i % n] == \"0\":", "- if j % 2 == 0:", "- ...
false
0.168088
0.037374
4.497398
[ "s696437291", "s208744548" ]
u271430213
p04001
python
s590950951
s608648848
22
18
3,064
3,060
Accepted
Accepted
18.18
import sys S=eval(input()) def allbitCalc(N): allbit = [] for i in range(2**N): bit = [0] * N for j in range(N): if (i >> j) & 1: bit[j] = 1 allbit.append(bit) return allbit def split(S,bit): n=len(S) terms=[] cnt=1;s=int(S[n-...
def dfs(i,s): if i==(n-1): return(sum(map(int,s.split('+')))) return(dfs(i+1,s+S[i+1])+dfs(i+1,s+'+'+S[i+1])) S=eval(input()) n=len(S) ans=dfs(0,S[0]) print(ans)
37
10
715
182
import sys S = eval(input()) def allbitCalc(N): allbit = [] for i in range(2**N): bit = [0] * N for j in range(N): if (i >> j) & 1: bit[j] = 1 allbit.append(bit) return allbit def split(S, bit): n = len(S) terms = [] cnt = 1 s = int(S[...
def dfs(i, s): if i == (n - 1): return sum(map(int, s.split("+"))) return dfs(i + 1, s + S[i + 1]) + dfs(i + 1, s + "+" + S[i + 1]) S = eval(input()) n = len(S) ans = dfs(0, S[0]) print(ans)
false
72.972973
[ "-import sys", "+def dfs(i, s):", "+ if i == (n - 1):", "+ return sum(map(int, s.split(\"+\")))", "+ return dfs(i + 1, s + S[i + 1]) + dfs(i + 1, s + \"+\" + S[i + 1])", "+", "-", "-", "-def allbitCalc(N):", "- allbit = []", "- for i in range(2**N):", "- bit = [0] * N...
false
0.032603
0.033942
0.960559
[ "s590950951", "s608648848" ]
u312025627
p02952
python
s963629704
s594603111
187
171
39,408
38,768
Accepted
Accepted
8.56
n = int(eval(input())) ans = 0 for i in range(1,n+1): digit = 1 while i//10 > 0: digit += 1 i /= 10 if digit%2 == 1: ans += 1 print(ans)
n = int(eval(input())) ans = 0 for i in range(1,n+1): if len(str(i))%2 == 1: ans += 1 print(ans)
11
7
177
109
n = int(eval(input())) ans = 0 for i in range(1, n + 1): digit = 1 while i // 10 > 0: digit += 1 i /= 10 if digit % 2 == 1: ans += 1 print(ans)
n = int(eval(input())) ans = 0 for i in range(1, n + 1): if len(str(i)) % 2 == 1: ans += 1 print(ans)
false
36.363636
[ "- digit = 1", "- while i // 10 > 0:", "- digit += 1", "- i /= 10", "- if digit % 2 == 1:", "+ if len(str(i)) % 2 == 1:" ]
false
0.051367
0.04813
1.067261
[ "s963629704", "s594603111" ]
u936985471
p04031
python
s975543606
s820727396
24
17
3,064
3,060
Accepted
Accepted
29.17
N=int(eval(input())) A=list(map(int,input().split())) st=int(sum(A)/len(A)) go=st+1 ans=10**9+1 for i in range(st,go+1): val=0 for a in A: val+=(a-i)**2 ans=min(ans,val) print(ans)
N=int(eval(input())) A=list(map(int,input().split())) ans=10**9+1 for i in (0,1): val=0 for a in A: val+=(a-int(sum(A)/len(A))-i)**2 ans=min(ans,val) print(ans)
11
9
194
172
N = int(eval(input())) A = list(map(int, input().split())) st = int(sum(A) / len(A)) go = st + 1 ans = 10**9 + 1 for i in range(st, go + 1): val = 0 for a in A: val += (a - i) ** 2 ans = min(ans, val) print(ans)
N = int(eval(input())) A = list(map(int, input().split())) ans = 10**9 + 1 for i in (0, 1): val = 0 for a in A: val += (a - int(sum(A) / len(A)) - i) ** 2 ans = min(ans, val) print(ans)
false
18.181818
[ "-st = int(sum(A) / len(A))", "-go = st + 1", "-for i in range(st, go + 1):", "+for i in (0, 1):", "- val += (a - i) ** 2", "+ val += (a - int(sum(A) / len(A)) - i) ** 2" ]
false
0.041127
0.040241
1.022
[ "s975543606", "s820727396" ]
u707124227
p03147
python
s521740546
s674455599
20
17
3,060
2,940
Accepted
Accepted
15
n=int(eval(input())) h=list(map(int,input().split())) ans=0 while sum(h)>0: i=0 while i < n: if h[i]>0: ans+=1 while i<n and h[i]>0: h[i]-=1 i+=1 i+=1 print(ans)
n=int(eval(input())) h=list(map(int,input().split())) ans=0 pre=0 for hi in h: if hi-pre>0: ans+=hi-pre pre=hi print(ans)
13
9
251
131
n = int(eval(input())) h = list(map(int, input().split())) ans = 0 while sum(h) > 0: i = 0 while i < n: if h[i] > 0: ans += 1 while i < n and h[i] > 0: h[i] -= 1 i += 1 i += 1 print(ans)
n = int(eval(input())) h = list(map(int, input().split())) ans = 0 pre = 0 for hi in h: if hi - pre > 0: ans += hi - pre pre = hi print(ans)
false
30.769231
[ "-while sum(h) > 0:", "- i = 0", "- while i < n:", "- if h[i] > 0:", "- ans += 1", "- while i < n and h[i] > 0:", "- h[i] -= 1", "- i += 1", "- i += 1", "+pre = 0", "+for hi in h:", "+ if hi - pre > 0:", "+ ans...
false
0.049538
0.052106
0.950703
[ "s521740546", "s674455599" ]
u852690916
p02694
python
s644440307
s359759961
65
57
62,940
63,228
Accepted
Accepted
12.31
X=int(eval(input())) n=100 for i in range(10**10): if n>=X: print(i) exit() n+=n//100
X=int(eval(input())) n=100 for i in range(10000): if n>=X: print(i) exit() n+=n//100
7
7
109
108
X = int(eval(input())) n = 100 for i in range(10**10): if n >= X: print(i) exit() n += n // 100
X = int(eval(input())) n = 100 for i in range(10000): if n >= X: print(i) exit() n += n // 100
false
0
[ "-for i in range(10**10):", "+for i in range(10000):" ]
false
0.062293
0.035698
1.744995
[ "s644440307", "s359759961" ]
u347203174
p02706
python
s213048764
s138020332
24
22
9,884
9,980
Accepted
Accepted
8.33
N, M = list(map(int, input().split())) work = [] [work.append(x) for x in map(int, input().split())] s = sum(work) if N >= s: print((N - s)) else: print('-1')
import math ex = [] N, M = map(int, input().split()) ex = [exi for exi in map(int, input().split())] rem = N - sum(ex) print(rem) if rem >= 0 else print('-1')
11
10
172
172
N, M = list(map(int, input().split())) work = [] [work.append(x) for x in map(int, input().split())] s = sum(work) if N >= s: print((N - s)) else: print("-1")
import math ex = [] N, M = map(int, input().split()) ex = [exi for exi in map(int, input().split())] rem = N - sum(ex) print(rem) if rem >= 0 else print("-1")
false
9.090909
[ "-N, M = list(map(int, input().split()))", "-work = []", "-[work.append(x) for x in map(int, input().split())]", "-s = sum(work)", "-if N >= s:", "- print((N - s))", "-else:", "- print(\"-1\")", "+import math", "+", "+ex = []", "+N, M = map(int, input().split())", "+ex = [exi for exi i...
false
0.032514
0.035534
0.915015
[ "s213048764", "s138020332" ]
u729133443
p02661
python
s518351715
s405619237
630
448
110,604
64,544
Accepted
Accepted
28.89
from statistics import* (n,),*t=[list(map(int,t.split()))for t in open(0)] a,b=list(map(median,list(zip(*t)))) print((int((b-a)*(2-n%2))+1))
from numpy import* (n,),*d=[int_(i.split())for i in open(0)] a,b=median(d,0) print((int((b-a)*(2-n%2))+1))
4
4
123
107
from statistics import * (n,), *t = [list(map(int, t.split())) for t in open(0)] a, b = list(map(median, list(zip(*t)))) print((int((b - a) * (2 - n % 2)) + 1))
from numpy import * (n,), *d = [int_(i.split()) for i in open(0)] a, b = median(d, 0) print((int((b - a) * (2 - n % 2)) + 1))
false
0
[ "-from statistics import *", "+from numpy import *", "-(n,), *t = [list(map(int, t.split())) for t in open(0)]", "-a, b = list(map(median, list(zip(*t))))", "+(n,), *d = [int_(i.split()) for i in open(0)]", "+a, b = median(d, 0)" ]
false
0.087364
0.412011
0.212043
[ "s518351715", "s405619237" ]
u914762730
p03310
python
s015073942
s139958237
1,766
986
27,340
26,992
Accepted
Accepted
44.17
INF = 2 * 10**5 * 10**9 n = int(eval(input())) a = list(map(int,input().split())) s = [0] for x in a: s.append(s[-1]+x) ans = INF p1 = 1 p = 2 p2 = 3 def update(): global ans if p1 < p and p2 < n: ans = min(ans , max(s[p1],s[p]-s[p1],s[p2]-s[p],s[n]-s[p2]) - min(s[p1],s[p]-s[p1],s[p2]-...
INF = 2 * 10**5 * 10**9 n = int(eval(input())) a = list(map(int,input().split())) s = [0] for x in a: s.append(s[-1]+x) ans = INF p1 = 1 p = 1 p2 = 3 while True: p += 1 if p + 1 >= n: break while p1 < p and abs(s[p1] - s[p] + s[p1]) > abs(s[p1+1] - s[p] + s[p1 + 1]): p1 +=...
33
20
1,093
550
INF = 2 * 10**5 * 10**9 n = int(eval(input())) a = list(map(int, input().split())) s = [0] for x in a: s.append(s[-1] + x) ans = INF p1 = 1 p = 2 p2 = 3 def update(): global ans if p1 < p and p2 < n: ans = min( ans, max(s[p1], s[p] - s[p1], s[p2] - s[p], s[n] - s[p2]) ...
INF = 2 * 10**5 * 10**9 n = int(eval(input())) a = list(map(int, input().split())) s = [0] for x in a: s.append(s[-1] + x) ans = INF p1 = 1 p = 1 p2 = 3 while True: p += 1 if p + 1 >= n: break while p1 < p and abs(s[p1] - s[p] + s[p1]) > abs(s[p1 + 1] - s[p] + s[p1 + 1]): p1 += 1 whi...
false
39.393939
[ "-p = 2", "+p = 1", "-", "-", "-def update():", "- global ans", "- if p1 < p and p2 < n:", "- ans = min(", "- ans,", "- max(s[p1], s[p] - s[p1], s[p2] - s[p], s[n] - s[p2])", "- - min(s[p1], s[p] - s[p1], s[p2] - s[p], s[n] - s[p2]),", "- )"...
false
0.078445
0.007916
9.909162
[ "s015073942", "s139958237" ]
u699296734
p03292
python
s402134365
s810752463
29
26
9,128
9,096
Accepted
Accepted
10.34
a = sorted(list(map(int, input().split())), reverse=True) res = 0 for i in range(3 - 1): res += a[i] - a[i + 1] print(res)
a = list(map(int, input().split())) a.sort() print((a[-1] - a[0]))
5
3
130
66
a = sorted(list(map(int, input().split())), reverse=True) res = 0 for i in range(3 - 1): res += a[i] - a[i + 1] print(res)
a = list(map(int, input().split())) a.sort() print((a[-1] - a[0]))
false
40
[ "-a = sorted(list(map(int, input().split())), reverse=True)", "-res = 0", "-for i in range(3 - 1):", "- res += a[i] - a[i + 1]", "-print(res)", "+a = list(map(int, input().split()))", "+a.sort()", "+print((a[-1] - a[0]))" ]
false
0.047441
0.049911
0.950498
[ "s402134365", "s810752463" ]
u732061897
p03273
python
s125558632
s132976376
149
40
12,492
9,468
Accepted
Accepted
73.15
H, W = list(map(int, input().split())) a_list = [list(eval(input())) for i in range(H)] result = a_list[:] for i,aa in enumerate(a_list): if aa.count('.') == len(aa): result[i] = 1 result = [r for r in result if r != 1] #print(result) import numpy as np T_result = np.array(result).T result2 = ...
H, W = list(map(int, input().split())) HW_list = [list(eval(input())) for i in range(H)] import copy tmp = copy.deepcopy(HW_list) h_index = 0 for i, HW in enumerate(HW_list): is_all_shiro = True for hw in HW: if hw == '#': is_all_shiro = False h_index += 1 ...
20
29
526
682
H, W = list(map(int, input().split())) a_list = [list(eval(input())) for i in range(H)] result = a_list[:] for i, aa in enumerate(a_list): if aa.count(".") == len(aa): result[i] = 1 result = [r for r in result if r != 1] # print(result) import numpy as np T_result = np.array(result).T result2 = T_result.to...
H, W = list(map(int, input().split())) HW_list = [list(eval(input())) for i in range(H)] import copy tmp = copy.deepcopy(HW_list) h_index = 0 for i, HW in enumerate(HW_list): is_all_shiro = True for hw in HW: if hw == "#": is_all_shiro = False h_index += 1 break ...
false
31.034483
[ "-a_list = [list(eval(input())) for i in range(H)]", "-result = a_list[:]", "-for i, aa in enumerate(a_list):", "- if aa.count(\".\") == len(aa):", "- result[i] = 1", "-result = [r for r in result if r != 1]", "-# print(result)", "-import numpy as np", "+HW_list = [list(eval(input())) for ...
false
0.095815
0.037319
2.567473
[ "s125558632", "s132976376" ]
u644907318
p03464
python
s854601549
s714349511
229
94
63,856
84,464
Accepted
Accepted
58.95
K = int(eval(input())) A = list(map(int,input().split())) B = [2,2] for i in range(K-1,-1,-1): a = A[i] bmin = B[0] bmax = B[1] if bmin%a==0: bmin = bmin else: bmin = (bmin//a+1)*a if bmin>bmax: B = [] break else: if bmax%a==0: ...
import math K = int(eval(input())) A = list(map(int,input().split())) if A[K-1]!=2: print((-1)) elif K==1: print((2,3)) else: nmin = 2 nmax = 2+A[K-1]-1 flag = 0 for i in range(K-2,-1,-1): b = A[i] nmin = math.ceil(nmin/b)*b nmax = math.floor(nmax/b)*b ...
24
23
468
462
K = int(eval(input())) A = list(map(int, input().split())) B = [2, 2] for i in range(K - 1, -1, -1): a = A[i] bmin = B[0] bmax = B[1] if bmin % a == 0: bmin = bmin else: bmin = (bmin // a + 1) * a if bmin > bmax: B = [] break else: if bmax % a == 0: ...
import math K = int(eval(input())) A = list(map(int, input().split())) if A[K - 1] != 2: print((-1)) elif K == 1: print((2, 3)) else: nmin = 2 nmax = 2 + A[K - 1] - 1 flag = 0 for i in range(K - 2, -1, -1): b = A[i] nmin = math.ceil(nmin / b) * b nmax = math.floor(nmax /...
false
4.166667
[ "+import math", "+", "-B = [2, 2]", "-for i in range(K - 1, -1, -1):", "- a = A[i]", "- bmin = B[0]", "- bmax = B[1]", "- if bmin % a == 0:", "- bmin = bmin", "+if A[K - 1] != 2:", "+ print((-1))", "+elif K == 1:", "+ print((2, 3))", "+else:", "+ nmin = 2", ...
false
0.032311
0.041289
0.782551
[ "s854601549", "s714349511" ]
u075012704
p03674
python
s008253665
s744882268
700
305
26,432
31,324
Accepted
Accepted
56.43
from collections import Counter N = int(eval(input())) A = list(map(int, input().split())) mod = 10 **9 + 7 # 階乗 & 逆元計算 factorial = [1] inverse = [1] for i in range(1, N+2): factorial.append(factorial[-1] * i % mod) inverse.append(pow(factorial[-1], mod-2, mod)) # 組み合わせ計算 def nCr(n, r): ...
N = int(eval(input())) A = list(map(int, input().split())) MOD = 10 ** 9 + 7 duplicate_x = None checked = set() for a in A: if a in checked: duplicate_x = a checked.add(a) x_l_index = A.index(duplicate_x) x_r_index = N + 1 - A[::-1].index(duplicate_x) - 1 # 逆元の前計算 factorial = [1,...
35
35
749
818
from collections import Counter N = int(eval(input())) A = list(map(int, input().split())) mod = 10**9 + 7 # 階乗 & 逆元計算 factorial = [1] inverse = [1] for i in range(1, N + 2): factorial.append(factorial[-1] * i % mod) inverse.append(pow(factorial[-1], mod - 2, mod)) # 組み合わせ計算 def nCr(n, r): if n < r or r < ...
N = int(eval(input())) A = list(map(int, input().split())) MOD = 10**9 + 7 duplicate_x = None checked = set() for a in A: if a in checked: duplicate_x = a checked.add(a) x_l_index = A.index(duplicate_x) x_r_index = N + 1 - A[::-1].index(duplicate_x) - 1 # 逆元の前計算 factorial = [1, 1] inverse = [1, 1] inver...
false
0
[ "-from collections import Counter", "-", "-mod = 10**9 + 7", "-# 階乗 & 逆元計算", "-factorial = [1]", "-inverse = [1]", "-for i in range(1, N + 2):", "- factorial.append(factorial[-1] * i % mod)", "- inverse.append(pow(factorial[-1], mod - 2, mod))", "-# 組み合わせ計算", "-def nCr(n, r):", "- if ...
false
0.068856
0.069677
0.988226
[ "s008253665", "s744882268" ]
u625729943
p02594
python
s256582394
s622666546
137
73
65,236
65,096
Accepted
Accepted
46.72
#import numpy as np import sys, math from itertools import permutations, combinations from collections import defaultdict, Counter, deque from math import factorial#, gcd from bisect import bisect_left, bisect_right #bisect_left(list, value) sys.setrecursionlimit(10**7) enu = enumerate MOD = 10**9+7 def input(...
# import numpy as np import sys, math from itertools import permutations, combinations from collections import defaultdict, Counter, deque from math import factorial # , gcd from bisect import bisect_left, bisect_right # bisect_left(list, value) sys.setrecursionlimit(10 ** 7) enu = enumerate MOD = 10 ** 9 +...
18
15
467
461
# import numpy as np import sys, math from itertools import permutations, combinations from collections import defaultdict, Counter, deque from math import factorial # , gcd from bisect import bisect_left, bisect_right # bisect_left(list, value) sys.setrecursionlimit(10**7) enu = enumerate MOD = 10**9 + 7 def inpu...
# import numpy as np import sys, math from itertools import permutations, combinations from collections import defaultdict, Counter, deque from math import factorial # , gcd from bisect import bisect_left, bisect_right # bisect_left(list, value) sys.setrecursionlimit(10**7) enu = enumerate MOD = 10**9 + 7 input = la...
false
16.666667
[ "-", "-", "-def input():", "- return sys.stdin.readline()[:-1]", "-", "-", "+input = lambda: sys.stdin.readline()[:-1]", "-N = int(input())", "-if 30 <= N:", "- print(\"Yes\")", "-else:", "- print(\"No\")", "+X = int(input())", "+print(\"Yes\") if 30 <= X else print(\"No\")" ]
false
0.061631
0.095336
0.646462
[ "s256582394", "s622666546" ]
u104675693
p02953
python
s679991767
s047015401
86
68
14,396
15,020
Accepted
Accepted
20.93
#from:#7967379 N = int(eval(input())) W = list(map(int, input().split())) judge = True for i in range(N-1): if W[i]<W[i+1]: W[i+1]-=1 if W[i]>W[i+1]: judge = False break print(('Yes' if judge else 'No')) ''' in [1]: 4 4 3 5 6 out [1]: No '''
N = int(eval(input())) H = list(map(int, input().split())) Frg = True #True => 'Yes' for i in range(N-1, 1,-1): if H[i-1] > H[i]: H[i-1] -= 1 if H[i-1] > H[i]: Frg = False break print(('Yes' if Frg else 'No'))
20
13
276
238
# from:#7967379 N = int(eval(input())) W = list(map(int, input().split())) judge = True for i in range(N - 1): if W[i] < W[i + 1]: W[i + 1] -= 1 if W[i] > W[i + 1]: judge = False break print(("Yes" if judge else "No")) """ in [1]: 4 4 3 5 6 out [1]: No """
N = int(eval(input())) H = list(map(int, input().split())) Frg = True # True => 'Yes' for i in range(N - 1, 1, -1): if H[i - 1] > H[i]: H[i - 1] -= 1 if H[i - 1] > H[i]: Frg = False break print(("Yes" if Frg else "No"))
false
35
[ "-# from:#7967379", "-W = list(map(int, input().split()))", "-judge = True", "-for i in range(N - 1):", "- if W[i] < W[i + 1]:", "- W[i + 1] -= 1", "- if W[i] > W[i + 1]:", "- judge = False", "- break", "-print((\"Yes\" if judge else \"No\"))", "-\"\"\"", "-in [1]:",...
false
0.036115
0.03678
0.981938
[ "s679991767", "s047015401" ]
u691018832
p03475
python
s188024760
s285612733
102
80
3,188
3,188
Accepted
Accepted
21.57
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) n = int(readline()) cfs = [list(map(int, readline().split())) for i in range(n - 1)] for i in range(n - 1): cnt = 0 for j in range(i, n - 1): if ...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) n = int(readline()) csf = [list(map(int, readline().split())) for _ in range(n - 1)] for i, (c, s, _) in enumerate(csf): s += c for cc, ss, ff in csf[i + ...
20
18
537
465
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10**7) n = int(readline()) cfs = [list(map(int, readline().split())) for i in range(n - 1)] for i in range(n - 1): cnt = 0 for j in range(i, n - 1): if cnt < cfs[j][...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10**7) n = int(readline()) csf = [list(map(int, readline().split())) for _ in range(n - 1)] for i, (c, s, _) in enumerate(csf): s += c for cc, ss, ff in csf[i + 1 :]: ...
false
10
[ "-cfs = [list(map(int, readline().split())) for i in range(n - 1)]", "-for i in range(n - 1):", "- cnt = 0", "- for j in range(i, n - 1):", "- if cnt < cfs[j][1]:", "- cnt = cfs[j][1]", "- elif cnt % cfs[j][2] == 0:", "- pass", "- else:", "- ...
false
0.037217
0.037509
0.992204
[ "s188024760", "s285612733" ]
u509739538
p02787
python
s152645546
s981021194
1,356
360
3,188
3,188
Accepted
Accepted
73.45
h,n = list(map(int,input().split())) ab = [] for i in range(n): a,b = list(map(int,input().split())) ab.append([a,b]) #ab.sort(key=lambda x: x[2], reverse=True) if h==9999 and n==10: print((139815)) exit() #bubble sort for i in range(n-1,-1,-1): for j in range(0,i): if ab[j][0]*ab[j+1]...
h,n = list(map(int,input().split())) ab = [] for i in range(n): a,b = list(map(int,input().split())) ab.append([a,b]) #ab.sort(key=lambda x: x[2], reverse=True) if h==9999 and n==10: print((139815)) exit() #bubble sort for i in range(n-1,-1,-1): for j in range(0,i): if ab[j][0]*ab[j+1]...
49
51
876
937
h, n = list(map(int, input().split())) ab = [] for i in range(n): a, b = list(map(int, input().split())) ab.append([a, b]) # ab.sort(key=lambda x: x[2], reverse=True) if h == 9999 and n == 10: print((139815)) exit() # bubble sort for i in range(n - 1, -1, -1): for j in range(0, i): if ab[j][...
h, n = list(map(int, input().split())) ab = [] for i in range(n): a, b = list(map(int, input().split())) ab.append([a, b]) # ab.sort(key=lambda x: x[2], reverse=True) if h == 9999 and n == 10: print((139815)) exit() # bubble sort for i in range(n - 1, -1, -1): for j in range(0, i): if ab[j][...
false
3.921569
[ "- if max(ab, key=lambda x: x[0])[0] < h:", "- h -= ab[0][0]", "- ans += ab[0][1]", "+ maxa = max(ab, key=lambda x: x[0])[0]", "+ if maxa < h:", "+ x = (h - maxa) // ab[0][0]", "+ h -= ab[0][0] * max(x, 1)", "+ ans += ab[0][1] * max(x, 1)" ]
false
0.040063
0.076899
0.520985
[ "s152645546", "s981021194" ]
u620084012
p03324
python
s478948457
s891720907
166
18
38,384
2,940
Accepted
Accepted
89.16
D, N = list(map(int,input().split())) if N != 100: print((str(N)+"0"*(D*2))) else: print(((N+1)*(100**D)))
D, N = list(map(int,input().split())) if D == 0: if N < 100: print(N) else: print((101)) elif D == 1: if N < 100: print((N*100)) else: print((10100)) else: if N < 100: print((N*10000)) else: print((1010000))
5
16
109
279
D, N = list(map(int, input().split())) if N != 100: print((str(N) + "0" * (D * 2))) else: print(((N + 1) * (100**D)))
D, N = list(map(int, input().split())) if D == 0: if N < 100: print(N) else: print((101)) elif D == 1: if N < 100: print((N * 100)) else: print((10100)) else: if N < 100: print((N * 10000)) else: print((1010000))
false
68.75
[ "-if N != 100:", "- print((str(N) + \"0\" * (D * 2)))", "+if D == 0:", "+ if N < 100:", "+ print(N)", "+ else:", "+ print((101))", "+elif D == 1:", "+ if N < 100:", "+ print((N * 100))", "+ else:", "+ print((10100))", "- print(((N + 1) * (100**D)...
false
0.04001
0.035684
1.121228
[ "s478948457", "s891720907" ]
u729133443
p02983
python
s527483931
s248750117
526
44
2,940
2,940
Accepted
Accepted
91.63
l,r=list(map(int,input().split()));s=list(range(l,r+1));print((+(r-l<2019)and min(i*j%2019for i in s for j in s if i<j)))
l,r=list(map(int,input().split()));s=list(range(l,r+1));print((+(r-l<2e3)and min(i*j%2019for i in s for j in s if i<j)))
1
1
107
106
l, r = list(map(int, input().split())) s = list(range(l, r + 1)) print((+(r - l < 2019) and min(i * j % 2019 for i in s for j in s if i < j)))
l, r = list(map(int, input().split())) s = list(range(l, r + 1)) print((+(r - l < 2e3) and min(i * j % 2019 for i in s for j in s if i < j)))
false
0
[ "-print((+(r - l < 2019) and min(i * j % 2019 for i in s for j in s if i < j)))", "+print((+(r - l < 2e3) and min(i * j % 2019 for i in s for j in s if i < j)))" ]
false
0.041002
0.039247
1.04471
[ "s527483931", "s248750117" ]
u761529120
p03038
python
s388432019
s840739565
955
707
88,240
92,568
Accepted
Accepted
25.97
import sys from collections import defaultdict input = sys.stdin.readline def main(): N, M = list(map(int, input().split())) A = list(map(int, input().split())) d = defaultdict(int) for _ in range(M): B, C = list(map(int, input().split())) d[C] += B for a in A: ...
from collections import defaultdict def main(): N, M = list(map(int, input().split())) A = list(map(int, input().split())) d = defaultdict(int) for i in range(M): B, C = list(map(int, input().split())) d[C] += B for a in A: d[a] += 1 ans = 0 cnt =...
33
30
661
590
import sys from collections import defaultdict input = sys.stdin.readline def main(): N, M = list(map(int, input().split())) A = list(map(int, input().split())) d = defaultdict(int) for _ in range(M): B, C = list(map(int, input().split())) d[C] += B for a in A: d[a] += 1 ...
from collections import defaultdict def main(): N, M = list(map(int, input().split())) A = list(map(int, input().split())) d = defaultdict(int) for i in range(M): B, C = list(map(int, input().split())) d[C] += B for a in A: d[a] += 1 ans = 0 cnt = 0 for i in sor...
false
9.090909
[ "-import sys", "-", "-input = sys.stdin.readline", "- for _ in range(M):", "+ for i in range(M):", "- sort_d = sorted(list(d.items()), reverse=True)", "+ ans = 0", "- ans = 0", "- for i, j in sort_d:", "- if cnt + j < N:", "- ans += i * j", "- cnt...
false
0.047601
0.043642
1.090738
[ "s388432019", "s840739565" ]
u767664985
p02947
python
s782698790
s885584078
378
343
23,436
19,760
Accepted
Accepted
9.26
import collections N = int(eval(input())) s = ["".join(sorted(eval(input()))) for _ in range(N)] c = collections.Counter(s) ans = 0 for si in set(s): n = c[si] ans += n * (n - 1) // 2 print(ans)
from collections import Counter N = int(eval(input())) s = ["".join(sorted(eval(input()))) for _ in range(N)] c = Counter(s) ans = 0 for ci in list(c.values()): ans += ci * (ci - 1) // 2 print(ans)
10
12
201
199
import collections N = int(eval(input())) s = ["".join(sorted(eval(input()))) for _ in range(N)] c = collections.Counter(s) ans = 0 for si in set(s): n = c[si] ans += n * (n - 1) // 2 print(ans)
from collections import Counter N = int(eval(input())) s = ["".join(sorted(eval(input()))) for _ in range(N)] c = Counter(s) ans = 0 for ci in list(c.values()): ans += ci * (ci - 1) // 2 print(ans)
false
16.666667
[ "-import collections", "+from collections import Counter", "-c = collections.Counter(s)", "+c = Counter(s)", "-for si in set(s):", "- n = c[si]", "- ans += n * (n - 1) // 2", "+for ci in list(c.values()):", "+ ans += ci * (ci - 1) // 2" ]
false
0.034928
0.03737
0.934642
[ "s782698790", "s885584078" ]
u451017206
p03213
python
s932274890
s394350764
1,395
18
3,064
3,064
Accepted
Accepted
98.71
N = int(eval(input())) from math import ceil, sqrt, factorial from itertools import permutations def eratosthenes(n): l = [1 for i in range(n+1)] l[0] = l[1] = 0 for i in range(2, ceil(sqrt(n))): if l[i] == 0: continue for j in range(i*2, n+1, i): l[j] = 0 return l ...
N = int(eval(input())) p = [0] * (N+1) def is_prime(n): for i in range(2, n): if not n % i: return False return True def n(m): return sum([True for i in p if i >= m]) l = [i for i in range(2, N+1) if is_prime(i)] for i in range(2, N+1): for j in l: whi...
39
26
772
480
N = int(eval(input())) from math import ceil, sqrt, factorial from itertools import permutations def eratosthenes(n): l = [1 for i in range(n + 1)] l[0] = l[1] = 0 for i in range(2, ceil(sqrt(n))): if l[i] == 0: continue for j in range(i * 2, n + 1, i): l[j] = 0 ...
N = int(eval(input())) p = [0] * (N + 1) def is_prime(n): for i in range(2, n): if not n % i: return False return True def n(m): return sum([True for i in p if i >= m]) l = [i for i in range(2, N + 1) if is_prime(i)] for i in range(2, N + 1): for j in l: while not i % j...
false
33.333333
[ "-from math import ceil, sqrt, factorial", "-from itertools import permutations", "+p = [0] * (N + 1)", "-def eratosthenes(n):", "- l = [1 for i in range(n + 1)]", "- l[0] = l[1] = 0", "- for i in range(2, ceil(sqrt(n))):", "- if l[i] == 0:", "- continue", "- for ...
false
1.982292
0.048888
40.547526
[ "s932274890", "s394350764" ]
u874723578
p03449
python
s760449490
s071901701
20
17
3,060
2,940
Accepted
Accepted
15
n = int(eval(input())) c1 = list(map(int, input().split())) c2 = list(map(int, input().split())) ans = 0 for i in range(n): total = 0 num = i while num >= 0: total += c1[num] num -= 1 for j in range(i,n): total += c2[j] ans = max(ans, total) print(ans)
n = int(eval(input())) c1 = list(map(int, input().split())) c2 = list(map(int, input().split())) ans = 0 for i in range(n): ans = max(ans, sum(c1[:i+1] + c2[i:])) print(ans)
15
9
306
182
n = int(eval(input())) c1 = list(map(int, input().split())) c2 = list(map(int, input().split())) ans = 0 for i in range(n): total = 0 num = i while num >= 0: total += c1[num] num -= 1 for j in range(i, n): total += c2[j] ans = max(ans, total) print(ans)
n = int(eval(input())) c1 = list(map(int, input().split())) c2 = list(map(int, input().split())) ans = 0 for i in range(n): ans = max(ans, sum(c1[: i + 1] + c2[i:])) print(ans)
false
40
[ "- total = 0", "- num = i", "- while num >= 0:", "- total += c1[num]", "- num -= 1", "- for j in range(i, n):", "- total += c2[j]", "- ans = max(ans, total)", "+ ans = max(ans, sum(c1[: i + 1] + c2[i:]))" ]
false
0.140135
0.049085
2.854974
[ "s760449490", "s071901701" ]
u760831084
p03807
python
s642668517
s782067871
57
50
16,992
16,816
Accepted
Accepted
12.28
n = int(eval(input())) A = list(map(int, input().split())) cnt = 0 for a in A: if a % 2 != 0: cnt += 1 if cnt % 2 == 0: print('YES') else: print('NO')
n = int(eval(input())) a = list(map(int, input().split())) print(('YES' if sum(a) % 2 == 0 else 'NO'))
12
3
171
90
n = int(eval(input())) A = list(map(int, input().split())) cnt = 0 for a in A: if a % 2 != 0: cnt += 1 if cnt % 2 == 0: print("YES") else: print("NO")
n = int(eval(input())) a = list(map(int, input().split())) print(("YES" if sum(a) % 2 == 0 else "NO"))
false
75
[ "-A = list(map(int, input().split()))", "-cnt = 0", "-for a in A:", "- if a % 2 != 0:", "- cnt += 1", "-if cnt % 2 == 0:", "- print(\"YES\")", "-else:", "- print(\"NO\")", "+a = list(map(int, input().split()))", "+print((\"YES\" if sum(a) % 2 == 0 else \"NO\"))" ]
false
0.0438
0.12522
0.349784
[ "s642668517", "s782067871" ]
u418149936
p02701
python
s067815438
s289495827
281
257
30,924
31,088
Accepted
Accepted
8.54
N = int(eval(input())) ls = { eval(input()) for i in range(N)} print((len(ls)))
N = int(eval(input())) print((len({ eval(input()) for i in range(N) })))
3
2
67
59
N = int(eval(input())) ls = {eval(input()) for i in range(N)} print((len(ls)))
N = int(eval(input())) print((len({eval(input()) for i in range(N)})))
false
33.333333
[ "-ls = {eval(input()) for i in range(N)}", "-print((len(ls)))", "+print((len({eval(input()) for i in range(N)})))" ]
false
0.033909
0.033786
1.003646
[ "s067815438", "s289495827" ]
u971091945
p02860
python
s853015371
s340698692
19
17
3,060
2,940
Accepted
Accepted
10.53
import math n = int(eval(input())) a = list(eval(input())) even = math.floor(n/2) b=a[:even] c=a[even:] if b==c: print("Yes") else: print("No")
n = int(eval(input())) s = eval(input()) even =n//2 a = s[:even] b = s[even:] if a==b: print("Yes") else: print("No")
14
12
156
127
import math n = int(eval(input())) a = list(eval(input())) even = math.floor(n / 2) b = a[:even] c = a[even:] if b == c: print("Yes") else: print("No")
n = int(eval(input())) s = eval(input()) even = n // 2 a = s[:even] b = s[even:] if a == b: print("Yes") else: print("No")
false
14.285714
[ "-import math", "-", "-a = list(eval(input()))", "-even = math.floor(n / 2)", "-b = a[:even]", "-c = a[even:]", "-if b == c:", "+s = eval(input())", "+even = n // 2", "+a = s[:even]", "+b = s[even:]", "+if a == b:" ]
false
0.044814
0.046302
0.96786
[ "s853015371", "s340698692" ]
u188827677
p03324
python
s705157667
s712574560
29
25
8,992
9,088
Accepted
Accepted
13.79
d,n = list(map(int, input().split())) if n == 100: print((100**d*101)) else: print((100**d*n))
d,n = list(map(int, input().split())) if d == 0: if n == 100: print((101)) else: print(n) elif d == 1: if n == 100: print((n*100+100)) else: print((n*100)) else: if n == 100: print((n*(100**2)+10000)) else: print((n*(100**2)))
4
11
88
233
d, n = list(map(int, input().split())) if n == 100: print((100**d * 101)) else: print((100**d * n))
d, n = list(map(int, input().split())) if d == 0: if n == 100: print((101)) else: print(n) elif d == 1: if n == 100: print((n * 100 + 100)) else: print((n * 100)) else: if n == 100: print((n * (100**2) + 10000)) else: print((n * (100**2)))
false
63.636364
[ "-if n == 100:", "- print((100**d * 101))", "+if d == 0:", "+ if n == 100:", "+ print((101))", "+ else:", "+ print(n)", "+elif d == 1:", "+ if n == 100:", "+ print((n * 100 + 100))", "+ else:", "+ print((n * 100))", "- print((100**d * n))", "+ ...
false
0.082456
0.103909
0.79354
[ "s705157667", "s712574560" ]
u296518383
p02813
python
s046567144
s019403878
218
180
49,264
44,912
Accepted
Accepted
17.43
from itertools import permutations N = int(eval(input())) P = "".join(list(input().split())) Q = "".join(list(input().split())) #print("P:", P) A = "" for i in range(1, N + 1): A += str(i) A = list(permutations(A, N)) A.sort() #print("A:", A) B = [] for i in range(len(A)): B.append("".join(A[i]))...
from itertools import permutations N = int(eval(input())) P = tuple(map(int, input().split())) Q = tuple(map(int, input().split())) A = list(permutations(list(range(1, N + 1)))) #print("A:", A) print((abs((A.index(P) - A.index(Q)))))
25
10
420
231
from itertools import permutations N = int(eval(input())) P = "".join(list(input().split())) Q = "".join(list(input().split())) # print("P:", P) A = "" for i in range(1, N + 1): A += str(i) A = list(permutations(A, N)) A.sort() # print("A:", A) B = [] for i in range(len(A)): B.append("".join(A[i])) for i in ra...
from itertools import permutations N = int(eval(input())) P = tuple(map(int, input().split())) Q = tuple(map(int, input().split())) A = list(permutations(list(range(1, N + 1)))) # print("A:", A) print((abs((A.index(P) - A.index(Q)))))
false
60
[ "-P = \"\".join(list(input().split()))", "-Q = \"\".join(list(input().split()))", "-# print(\"P:\", P)", "-A = \"\"", "-for i in range(1, N + 1):", "- A += str(i)", "-A = list(permutations(A, N))", "-A.sort()", "+P = tuple(map(int, input().split()))", "+Q = tuple(map(int, input().split()))", ...
false
0.04658
0.039269
1.186185
[ "s046567144", "s019403878" ]
u418826171
p02572
python
s627732178
s058462088
185
167
31,760
31,608
Accepted
Accepted
9.73
N = int(eval(input())) A = tuple(map(int,input().split())) mod = 10**9+7 B = [0]*N for i in range(N): B[i] = A[i]**2 s1, s2 = 0, 0 for i in range(N): s1 += A[i] s2 += B[i] s1 = s1**2 ans = (s1 -s2)//2%mod print(ans)
N = int(eval(input())) A = tuple(map(int,input().split())) mod = 10**9+7 ans = 0 s = (sum(A) - A[0])%mod for i in range(N-1): if s < 0: s += mod ans += A[i]*s%mod ans %= mod s -= A[i+1] print(ans)
13
12
234
225
N = int(eval(input())) A = tuple(map(int, input().split())) mod = 10**9 + 7 B = [0] * N for i in range(N): B[i] = A[i] ** 2 s1, s2 = 0, 0 for i in range(N): s1 += A[i] s2 += B[i] s1 = s1**2 ans = (s1 - s2) // 2 % mod print(ans)
N = int(eval(input())) A = tuple(map(int, input().split())) mod = 10**9 + 7 ans = 0 s = (sum(A) - A[0]) % mod for i in range(N - 1): if s < 0: s += mod ans += A[i] * s % mod ans %= mod s -= A[i + 1] print(ans)
false
7.692308
[ "-B = [0] * N", "-for i in range(N):", "- B[i] = A[i] ** 2", "-s1, s2 = 0, 0", "-for i in range(N):", "- s1 += A[i]", "- s2 += B[i]", "-s1 = s1**2", "-ans = (s1 - s2) // 2 % mod", "+ans = 0", "+s = (sum(A) - A[0]) % mod", "+for i in range(N - 1):", "+ if s < 0:", "+ s +=...
false
0.101097
0.034964
2.891495
[ "s627732178", "s058462088" ]
u604522449
p02573
python
s599560784
s834306286
675
473
18,472
19,728
Accepted
Accepted
29.93
N, M = list(map(int, input().split())) par = [i for i in range(N)] def find(x): if par[x] == x: return x else: par[x] = find(par[x]) return par[x] def unite(x, y): x = find(x) y = find(y) if x > y: par[x] = y find(x) else: par[y] = x find(y) if M > ...
import sys,os import math from fractions import Fraction from collections import defaultdict from random import randint # sys.stderr=open('err.txt','w') # sys.stdout=open('output.txt','w') # sys.stdin=open('input.txt','r') def linput(): return list(minput()) def minput(): return list(map(int, ...
40
63
591
1,189
N, M = list(map(int, input().split())) par = [i for i in range(N)] def find(x): if par[x] == x: return x else: par[x] = find(par[x]) return par[x] def unite(x, y): x = find(x) y = find(y) if x > y: par[x] = y find(x) else: par[y] = x fi...
import sys, os import math from fractions import Fraction from collections import defaultdict from random import randint # sys.stderr=open('err.txt','w') # sys.stdout=open('output.txt','w') # sys.stdin=open('input.txt','r') def linput(): return list(minput()) def minput(): return list(map(int, sys.stdin.read...
false
36.507937
[ "-N, M = list(map(int, input().split()))", "-par = [i for i in range(N)]", "+import sys, os", "+import math", "+from fractions import Fraction", "+from collections import defaultdict", "+from random import randint", "+", "+# sys.stderr=open('err.txt','w')", "+# sys.stdout=open('output.txt','w')", ...
false
0.039047
0.040655
0.960454
[ "s599560784", "s834306286" ]
u691896522
p02787
python
s303058568
s225687110
976
619
270,088
125,564
Accepted
Accepted
36.58
h, n = list(map(int, input().split())) inf = 10**12 data = [] for i in range(n): data.append(list(map(int, input().split()))) dp = [[inf for i in range(h+1 + 10**4)] for j in range(n+1)] for i in range(n): dp[i][0] = 0 for i in range(n): a, b = data[i] for j in range(h+1+10**4): if j ...
h, n = list(map(int, input().split())) inf = 10**10 dp = [[inf for i in range(h+1)] for j in range(n+1)] #dp[i][j] := i番目の魔法まで考えたとき、hpをh減らす最小コスト dp[0][0] = 0 for i in range(1,n+1): damage, cost = list(map(int, input().split())) for j in range(h+1): if j - damage < 0: dp[i][j] = min(...
16
13
457
434
h, n = list(map(int, input().split())) inf = 10**12 data = [] for i in range(n): data.append(list(map(int, input().split()))) dp = [[inf for i in range(h + 1 + 10**4)] for j in range(n + 1)] for i in range(n): dp[i][0] = 0 for i in range(n): a, b = data[i] for j in range(h + 1 + 10**4): if j - a...
h, n = list(map(int, input().split())) inf = 10**10 dp = [[inf for i in range(h + 1)] for j in range(n + 1)] # dp[i][j] := i番目の魔法まで考えたとき、hpをh減らす最小コスト dp[0][0] = 0 for i in range(1, n + 1): damage, cost = list(map(int, input().split())) for j in range(h + 1): if j - damage < 0: dp[i][j] = min...
false
18.75
[ "-inf = 10**12", "-data = []", "-for i in range(n):", "- data.append(list(map(int, input().split())))", "-dp = [[inf for i in range(h + 1 + 10**4)] for j in range(n + 1)]", "-for i in range(n):", "- dp[i][0] = 0", "-for i in range(n):", "- a, b = data[i]", "- for j in range(h + 1 + 10*...
false
0.150718
0.078627
1.916866
[ "s303058568", "s225687110" ]
u457601965
p02923
python
s953412088
s046939956
885
83
20,516
20,568
Accepted
Accepted
90.62
n = int(eval(input())) h = list(map(int, input().split())) nm = len(h) ans = 0 for _ in range(nm): cnt = 0 while True: if len(h) == 1: break if h[0] >= h[1]: cnt += 1 h.pop(0) else: h.pop(0) break ans = max(an...
N = int(eval(input())) N_List = list(map(int,input().split())) ans = 0 cans = 0 for i in range(1,N): if N_List[i] <= N_List[i-1]: cans += 1 if cans > ans: ans = cans if N_List[i] > N_List[i-1]: cans = 0 print(ans)
17
13
334
260
n = int(eval(input())) h = list(map(int, input().split())) nm = len(h) ans = 0 for _ in range(nm): cnt = 0 while True: if len(h) == 1: break if h[0] >= h[1]: cnt += 1 h.pop(0) else: h.pop(0) break ans = max(ans, cnt) print(a...
N = int(eval(input())) N_List = list(map(int, input().split())) ans = 0 cans = 0 for i in range(1, N): if N_List[i] <= N_List[i - 1]: cans += 1 if cans > ans: ans = cans if N_List[i] > N_List[i - 1]: cans = 0 print(ans)
false
23.529412
[ "-n = int(eval(input()))", "-h = list(map(int, input().split()))", "-nm = len(h)", "+N = int(eval(input()))", "+N_List = list(map(int, input().split()))", "-for _ in range(nm):", "- cnt = 0", "- while True:", "- if len(h) == 1:", "- break", "- if h[0] >= h[1]:", ...
false
0.034897
0.045117
0.773471
[ "s953412088", "s046939956" ]
u334712262
p02564
python
s966707632
s455572965
2,015
1,725
336,604
332,788
Accepted
Accepted
14.39
from collections import defaultdict import sys sys.setrecursionlimit(10**6) def scc(V, E): g = defaultdict(list) rg = defaultdict(list) for u, v in E: g[u].append(v) rg[v].append(u) o = [] done = set() for u in V: if u in done: continue ...
from collections import defaultdict import sys input = sys.stdin.buffer.readline def scc(V, E): g = defaultdict(list) rg = defaultdict(list) for u, v in E: g[u].append(v) rg[v].append(u) o = [] done = set() for u in V: if u in done: cont...
100
101
1,922
1,929
from collections import defaultdict import sys sys.setrecursionlimit(10**6) def scc(V, E): g = defaultdict(list) rg = defaultdict(list) for u, v in E: g[u].append(v) rg[v].append(u) o = [] done = set() for u in V: if u in done: continue s = [(u, Tru...
from collections import defaultdict import sys input = sys.stdin.buffer.readline def scc(V, E): g = defaultdict(list) rg = defaultdict(list) for u, v in E: g[u].append(v) rg[v].append(u) o = [] done = set() for u in V: if u in done: continue s = [(u...
false
0.990099
[ "-sys.setrecursionlimit(10**6)", "+input = sys.stdin.buffer.readline" ]
false
0.153231
0.04392
3.488873
[ "s966707632", "s455572965" ]
u186838327
p03361
python
s476104440
s019996859
187
19
41,068
3,064
Accepted
Accepted
89.84
h, w = list(map(int, input().split())) l = [0]*(h+2) l[0] = '.'*(w+2) l[-1] = '.'*(w+2) for _ in range(1, h+1): l[_] = '.' + str(eval(input())) + '.' for i in range(1, h+1): for j in range(1, w+1): if l[i][j] == '.': continue else: if all (l[i+i_][j+j_] == '.' for i_, j_ in ([1, 0...
h, w = list(map(int, input().split())) M = [str(eval(input())) for _ in range(h)] M = ['.'*w] + M + ['.'*w] M = ['.'+c+'.' for c in M] #print(M) flag = True for i in range(1, h+1): for j in range(1, w+1): if M[i][j] == '#': for p, q in (-1, 0), (1, 0), (0, 1), (0, -1): ...
20
23
429
515
h, w = list(map(int, input().split())) l = [0] * (h + 2) l[0] = "." * (w + 2) l[-1] = "." * (w + 2) for _ in range(1, h + 1): l[_] = "." + str(eval(input())) + "." for i in range(1, h + 1): for j in range(1, w + 1): if l[i][j] == ".": continue else: if all( ...
h, w = list(map(int, input().split())) M = [str(eval(input())) for _ in range(h)] M = ["." * w] + M + ["." * w] M = ["." + c + "." for c in M] # print(M) flag = True for i in range(1, h + 1): for j in range(1, w + 1): if M[i][j] == "#": for p, q in (-1, 0), (1, 0), (0, 1), (0, -1): ...
false
13.043478
[ "-l = [0] * (h + 2)", "-l[0] = \".\" * (w + 2)", "-l[-1] = \".\" * (w + 2)", "-for _ in range(1, h + 1):", "- l[_] = \".\" + str(eval(input())) + \".\"", "+M = [str(eval(input())) for _ in range(h)]", "+M = [\".\" * w] + M + [\".\" * w]", "+M = [\".\" + c + \".\" for c in M]", "+# print(M)", "+...
false
0.044959
0.091112
0.493448
[ "s476104440", "s019996859" ]
u476604182
p02883
python
s568520716
s689839979
629
565
119,500
43,540
Accepted
Accepted
10.17
N, K = list(map(int, input().split())) A = [int(c) for c in input().split()] F = [int(c) for c in input().split()] A.sort() F.sort(reverse=True) M = 0 for i in range(N): if A[i]*F[i]>M: M = A[i]*F[i] l = -1 r = M+1 while l+1<r: s = (l+r)//2 cnt = 0 for i in range(N): b = s//F[i] cn...
import numpy as np N, K = list(map(int, input().split())) A = [int(c) for c in input().split()] F = [int(c) for c in input().split()] A.sort() F.sort(reverse=True) A = np.array(A) F = np.array(F) Asum = A.sum() M = np.max(A*F) l = -1 r = M+1 while l+1<r: s = (l+r)//2 cnt = Asum - np.minimum(A, s//F)...
24
22
390
376
N, K = list(map(int, input().split())) A = [int(c) for c in input().split()] F = [int(c) for c in input().split()] A.sort() F.sort(reverse=True) M = 0 for i in range(N): if A[i] * F[i] > M: M = A[i] * F[i] l = -1 r = M + 1 while l + 1 < r: s = (l + r) // 2 cnt = 0 for i in range(N): b = ...
import numpy as np N, K = list(map(int, input().split())) A = [int(c) for c in input().split()] F = [int(c) for c in input().split()] A.sort() F.sort(reverse=True) A = np.array(A) F = np.array(F) Asum = A.sum() M = np.max(A * F) l = -1 r = M + 1 while l + 1 < r: s = (l + r) // 2 cnt = Asum - np.minimum(A, s //...
false
8.333333
[ "+import numpy as np", "+", "-M = 0", "-for i in range(N):", "- if A[i] * F[i] > M:", "- M = A[i] * F[i]", "+A = np.array(A)", "+F = np.array(F)", "+Asum = A.sum()", "+M = np.max(A * F)", "- cnt = 0", "- for i in range(N):", "- b = s // F[i]", "- cnt += max(0,...
false
0.007956
0.513522
0.015494
[ "s568520716", "s689839979" ]
u887207211
p03162
python
s367236386
s016996042
430
388
24,308
3,060
Accepted
Accepted
9.77
N = int(eval(input())) A = [[int(i) for i in input().split()] for _ in range(N)] x = y = z = 0 for a, b, c in A: x, y, z = max(y, z)+a, max(x,z)+b, max(x,y)+c print((max(x, y, z)))
N = int(eval(input())) x = y = z = 0 for _ in range(N): a, b, c = list(map(int,input().split())) x, y, z = max(y, z)+a, max(x,z)+b, max(x,y)+c print((max(x, y, z)))
7
7
181
161
N = int(eval(input())) A = [[int(i) for i in input().split()] for _ in range(N)] x = y = z = 0 for a, b, c in A: x, y, z = max(y, z) + a, max(x, z) + b, max(x, y) + c print((max(x, y, z)))
N = int(eval(input())) x = y = z = 0 for _ in range(N): a, b, c = list(map(int, input().split())) x, y, z = max(y, z) + a, max(x, z) + b, max(x, y) + c print((max(x, y, z)))
false
0
[ "-A = [[int(i) for i in input().split()] for _ in range(N)]", "-for a, b, c in A:", "+for _ in range(N):", "+ a, b, c = list(map(int, input().split()))" ]
false
0.114446
0.044484
2.572767
[ "s367236386", "s016996042" ]
u411203878
p02612
python
s499305315
s194732060
76
68
61,536
61,852
Accepted
Accepted
10.53
n=int(eval(input())) if n%1000 == 0: print((0)) else: print((1000-n%1000))
n = int(eval(input())) amari = n%1000 if amari == 0: print((0)) else: print((1000-amari))
6
8
79
97
n = int(eval(input())) if n % 1000 == 0: print((0)) else: print((1000 - n % 1000))
n = int(eval(input())) amari = n % 1000 if amari == 0: print((0)) else: print((1000 - amari))
false
25
[ "-if n % 1000 == 0:", "+amari = n % 1000", "+if amari == 0:", "- print((1000 - n % 1000))", "+ print((1000 - amari))" ]
false
0.051727
0.051141
1.011473
[ "s499305315", "s194732060" ]
u638795007
p03162
python
s162601833
s360792306
636
369
36,172
35,164
Accepted
Accepted
41.98
N = int(eval(input())) a = [0]*N b = [0]*N c = [0]*N for i in range(N): a[i],b[i],c[i] = list(map(int,input().split())) dp = [[int(0) for i in range(3)] for i in range(N)] ans = int(0) dp[0][0] = a[0] dp[0][1] = b[0] dp[0][2] = c[0] for i in range(1,N): dp[i][0] = max(a[i]+dp[i-1][1], a[i]+dp[i-...
def examA(): N = I() H = LI() dp = [inf]*(N) dp[0] = 0 for i in range(N-1): dp[i+1] = min(dp[i+1],dp[i]+abs(H[i+1]-H[i])) if i<N-2: dp[i + 2] = min(dp[i + 2], dp[i]+abs(H[i + 2] - H[i])) ans = dp[-1] print(ans) return def examB(): N, K = LI(...
21
77
458
1,772
N = int(eval(input())) a = [0] * N b = [0] * N c = [0] * N for i in range(N): a[i], b[i], c[i] = list(map(int, input().split())) dp = [[int(0) for i in range(3)] for i in range(N)] ans = int(0) dp[0][0] = a[0] dp[0][1] = b[0] dp[0][2] = c[0] for i in range(1, N): dp[i][0] = max(a[i] + dp[i - 1][1], a[i] + dp[i ...
def examA(): N = I() H = LI() dp = [inf] * (N) dp[0] = 0 for i in range(N - 1): dp[i + 1] = min(dp[i + 1], dp[i] + abs(H[i + 1] - H[i])) if i < N - 2: dp[i + 2] = min(dp[i + 2], dp[i] + abs(H[i + 2] - H[i])) ans = dp[-1] print(ans) return def examB(): N,...
false
72.727273
[ "-N = int(eval(input()))", "-a = [0] * N", "-b = [0] * N", "-c = [0] * N", "-for i in range(N):", "- a[i], b[i], c[i] = list(map(int, input().split()))", "-dp = [[int(0) for i in range(3)] for i in range(N)]", "-ans = int(0)", "-dp[0][0] = a[0]", "-dp[0][1] = b[0]", "-dp[0][2] = c[0]", "-fo...
false
0.066264
0.047494
1.395206
[ "s162601833", "s360792306" ]
u504562455
p03353
python
s271626077
s002461105
49
44
3,188
3,188
Accepted
Accepted
10.2
s = eval(input()) k = int(eval(input())) a = list(s) a = [ord(i) for i in a] b = sorted(set(a)) c = [] INF = 97+26 for m in b: a1 = [i for i in range(len(s)) if a[i] == m] for i in a1: j = 0 for j in range(k): if s[i:i+j+1] not in c: c.append(s[i:i+j+...
s = eval(input()) k = int(eval(input())) a = list(s) a = [ord(i) for i in a] b = sorted(set(a)) c = [] INF = 97+26 for m in b: a1 = [i for i in range(len(s)) if a[i] == m] for i in a1: j = 0 for j in range(k): if i + j >= len(s): break if...
26
26
522
504
s = eval(input()) k = int(eval(input())) a = list(s) a = [ord(i) for i in a] b = sorted(set(a)) c = [] INF = 97 + 26 for m in b: a1 = [i for i in range(len(s)) if a[i] == m] for i in a1: j = 0 for j in range(k): if s[i : i + j + 1] not in c: c.append(s[i : i + j + 1])...
s = eval(input()) k = int(eval(input())) a = list(s) a = [ord(i) for i in a] b = sorted(set(a)) c = [] INF = 97 + 26 for m in b: a1 = [i for i in range(len(s)) if a[i] == m] for i in a1: j = 0 for j in range(k): if i + j >= len(s): break if s[i : i + j + 1...
false
0
[ "+ if i + j >= len(s):", "+ break", "- j += 1", "- if i + j >= len(s):", "- break" ]
false
0.0449
0.140542
0.319479
[ "s271626077", "s002461105" ]
u919633157
p03448
python
s813739686
s568911922
56
19
2,940
3,188
Accepted
Accepted
66.07
a,b,c,x=list(map(int,open(0).read().split())) cnt=0 for i in range(a+1): for j in range(b+1): for k in range(c+1): sum=500*i+100*j+50*k if sum==x : cnt+=1 print(cnt)
a,b,c,x=[int(eval(input())) for _ in range(4)] cnt=0 for i in range(a+1): total=0 for j in range(b+1): k=(x-(500*i+100*j))//50 if k<=c and k>=0 : total=500*i+100*j+50*k if total==x:cnt+=1 print(cnt)
9
10
219
250
a, b, c, x = list(map(int, open(0).read().split())) cnt = 0 for i in range(a + 1): for j in range(b + 1): for k in range(c + 1): sum = 500 * i + 100 * j + 50 * k if sum == x: cnt += 1 print(cnt)
a, b, c, x = [int(eval(input())) for _ in range(4)] cnt = 0 for i in range(a + 1): total = 0 for j in range(b + 1): k = (x - (500 * i + 100 * j)) // 50 if k <= c and k >= 0: total = 500 * i + 100 * j + 50 * k if total == x: cnt += 1 print(cnt)
false
10
[ "-a, b, c, x = list(map(int, open(0).read().split()))", "+a, b, c, x = [int(eval(input())) for _ in range(4)]", "+ total = 0", "- for k in range(c + 1):", "- sum = 500 * i + 100 * j + 50 * k", "- if sum == x:", "+ k = (x - (500 * i + 100 * j)) // 50", "+ i...
false
0.142445
0.041945
3.395972
[ "s813739686", "s568911922" ]
u052332717
p04011
python
s859618710
s241539364
23
18
3,444
2,940
Accepted
Accepted
21.74
days_to_stay = int(eval(input())) special_days = int(eval(input())) normal_price = int(eval(input())) special_price = int(eval(input())) payment = 0 if days_to_stay <= special_days: payment = days_to_stay * normal_price else: payment = (days_to_stay - special_days) * special_price + special_days * no...
n = int(eval(input())) k = int(eval(input())) x = int(eval(input())) y = int(eval(input())) print((min(n,k)*x + max(0,n-k)*y))
12
5
328
104
days_to_stay = int(eval(input())) special_days = int(eval(input())) normal_price = int(eval(input())) special_price = int(eval(input())) payment = 0 if days_to_stay <= special_days: payment = days_to_stay * normal_price else: payment = ( days_to_stay - special_days ) * special_price + special_days *...
n = int(eval(input())) k = int(eval(input())) x = int(eval(input())) y = int(eval(input())) print((min(n, k) * x + max(0, n - k) * y))
false
58.333333
[ "-days_to_stay = int(eval(input()))", "-special_days = int(eval(input()))", "-normal_price = int(eval(input()))", "-special_price = int(eval(input()))", "-payment = 0", "-if days_to_stay <= special_days:", "- payment = days_to_stay * normal_price", "-else:", "- payment = (", "- days_t...
false
0.042262
0.035843
1.179096
[ "s859618710", "s241539364" ]
u134302690
p03147
python
s897108447
s711584927
25
21
3,060
3,060
Accepted
Accepted
16
N = int(eval(input())) h = list(map(int,input().split())) count = 0 i = 0 while sum(h) > 0: if h[i] > 0: j = i count += 1 while j < N and h[j] > 0: h[j] = h[j] - 1 j += 1 else: i += 1 print(count)
N = int(eval(input())) h = list(map(int, input().split())) cnt = 0 i = 0 for _ in range(100 * 100): if h[i] > 0: j = i cnt += 1 while j < N and h[j] > 0: h[j] = h[j] - 1 j += 1 else: i += 1 if i == N: break print(cnt)
14
16
267
310
N = int(eval(input())) h = list(map(int, input().split())) count = 0 i = 0 while sum(h) > 0: if h[i] > 0: j = i count += 1 while j < N and h[j] > 0: h[j] = h[j] - 1 j += 1 else: i += 1 print(count)
N = int(eval(input())) h = list(map(int, input().split())) cnt = 0 i = 0 for _ in range(100 * 100): if h[i] > 0: j = i cnt += 1 while j < N and h[j] > 0: h[j] = h[j] - 1 j += 1 else: i += 1 if i == N: break print(cnt)
false
12.5
[ "-count = 0", "+cnt = 0", "-while sum(h) > 0:", "+for _ in range(100 * 100):", "- count += 1", "+ cnt += 1", "-print(count)", "+ if i == N:", "+ break", "+print(cnt)" ]
false
0.033353
0.079793
0.417994
[ "s897108447", "s711584927" ]
u496148227
p03339
python
s534441784
s630167037
191
171
21,200
15,564
Accepted
Accepted
10.47
N = int(eval(input())) S = [d for d in eval(input())] tot = S[1:].count('E') tot_list = [tot] former_leader = S[0] for l in range(1, N): leader = S[l] if (former_leader, leader) == ('E', 'E'): tot -= 1 if (former_leader, leader) == ('W', 'W'): tot += 1 former_l...
N = int(eval(input())) S = eval(input()) tot = S[1:].count('E') tot_list = [tot] former_leader = S[0] for l in range(1, N): leader = S[l] if (former_leader, leader) == ('E', 'E'): tot -= 1 if (former_leader, leader) == ('W', 'W'): tot += 1 former_leader = leade...
18
18
378
365
N = int(eval(input())) S = [d for d in eval(input())] tot = S[1:].count("E") tot_list = [tot] former_leader = S[0] for l in range(1, N): leader = S[l] if (former_leader, leader) == ("E", "E"): tot -= 1 if (former_leader, leader) == ("W", "W"): tot += 1 former_leader = leader tot_list...
N = int(eval(input())) S = eval(input()) tot = S[1:].count("E") tot_list = [tot] former_leader = S[0] for l in range(1, N): leader = S[l] if (former_leader, leader) == ("E", "E"): tot -= 1 if (former_leader, leader) == ("W", "W"): tot += 1 former_leader = leader tot_list.append(tot) ...
false
0
[ "-S = [d for d in eval(input())]", "+S = eval(input())" ]
false
0.078718
0.048492
1.623329
[ "s534441784", "s630167037" ]
u992910889
p03627
python
s676586696
s958863838
267
243
69,912
64,896
Accepted
Accepted
8.99
# import bisect from collections import Counter, deque # from copy import copy, deepcopy # from fractions import gcd # from functools import reduce # from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product # import math # import numpy as np # from operator i...
from collections import Counter, deque, OrderedDict # from copy import copy, deepcopy # from functools import reduce # from heapq import heapify, heappop, heappush # from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product # import math # import numpy as np # ...
33
35
792
988
# import bisect from collections import Counter, deque # from copy import copy, deepcopy # from fractions import gcd # from functools import reduce # from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product # import math # import numpy as np # from operator import x...
from collections import Counter, deque, OrderedDict # from copy import copy, deepcopy # from functools import reduce # from heapq import heapify, heappop, heappush # from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product # import math # import numpy as np # Pytho...
false
5.714286
[ "-# import bisect", "-from collections import Counter, deque", "+from collections import Counter, deque, OrderedDict", "-# from fractions import gcd", "+# from heapq import heapify, heappop, heappush", "-# import numpy as np", "+# import numpy as np # Pythonのみ!", "+# import re", "+# from scipy.spar...
false
0.084117
0.040097
2.09782
[ "s676586696", "s958863838" ]
u583507988
p03435
python
s279798140
s319959374
33
29
9,220
9,196
Accepted
Accepted
12.12
c = [list(map(int, input().split())) for _ in range(3)] if 2*c[0][2]-c[1][2]-c[2][2]+c[1][0]+c[2][0] == 2*c[0][0]: if 2*c[1][0]-c[2][0]-c[0][0]+c[2][1]+c[0][1] == 2*c[1][1]: if 2*c[2][1]-c[0][1]-c[1][1]+c[0][2]+c[1][2] == 2*c[2][2]: print('Yes') else: print('No') else: print('No') e...
c = [] for i in range(3): c_ = list(map(int, input().split())) c.append(c_) if c[2][2] == c[0][2] + c[2][0] -c[0][0] and c[2][2] == c[1][2] + c[2][1] -c[1][1] and c[1][1] == c[0][1] + c[1][0] -c[0][0]: print('Yes') else: print('No')
11
9
339
251
c = [list(map(int, input().split())) for _ in range(3)] if 2 * c[0][2] - c[1][2] - c[2][2] + c[1][0] + c[2][0] == 2 * c[0][0]: if 2 * c[1][0] - c[2][0] - c[0][0] + c[2][1] + c[0][1] == 2 * c[1][1]: if 2 * c[2][1] - c[0][1] - c[1][1] + c[0][2] + c[1][2] == 2 * c[2][2]: print("Yes") else: ...
c = [] for i in range(3): c_ = list(map(int, input().split())) c.append(c_) if ( c[2][2] == c[0][2] + c[2][0] - c[0][0] and c[2][2] == c[1][2] + c[2][1] - c[1][1] and c[1][1] == c[0][1] + c[1][0] - c[0][0] ): print("Yes") else: print("No")
false
18.181818
[ "-c = [list(map(int, input().split())) for _ in range(3)]", "-if 2 * c[0][2] - c[1][2] - c[2][2] + c[1][0] + c[2][0] == 2 * c[0][0]:", "- if 2 * c[1][0] - c[2][0] - c[0][0] + c[2][1] + c[0][1] == 2 * c[1][1]:", "- if 2 * c[2][1] - c[0][1] - c[1][1] + c[0][2] + c[1][2] == 2 * c[2][2]:", "- ...
false
0.083198
0.041331
2.012968
[ "s279798140", "s319959374" ]