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
u359358631
p03037
python
s676607939
s977723000
213
190
89,460
85,760
Accepted
Accepted
10.8
def main(): n, m = list(map(int, input().split())) lr_lst = [list(map(int, input().split())) for _ in range(m)] left = 0 right = n + 1 for i in range(m): if left < lr_lst[i][0]: left = lr_lst[i][0] if lr_lst[i][1] < right: right = lr_lst[i][1] ...
def main(): n, m = list(map(int, input().split())) l_lst = [0 for _ in range(m)] r_lst = [0 for _ in range(m)] for i in range(m): l, r = list(map(int, input().split())) l_lst[i] = l r_lst[i] = r left = max(l_lst) right = min(r_lst) if right - left < 0:...
20
21
443
415
def main(): n, m = list(map(int, input().split())) lr_lst = [list(map(int, input().split())) for _ in range(m)] left = 0 right = n + 1 for i in range(m): if left < lr_lst[i][0]: left = lr_lst[i][0] if lr_lst[i][1] < right: right = lr_lst[i][1] if right - l...
def main(): n, m = list(map(int, input().split())) l_lst = [0 for _ in range(m)] r_lst = [0 for _ in range(m)] for i in range(m): l, r = list(map(int, input().split())) l_lst[i] = l r_lst[i] = r left = max(l_lst) right = min(r_lst) if right - left < 0: print((...
false
4.761905
[ "- lr_lst = [list(map(int, input().split())) for _ in range(m)]", "- left = 0", "- right = n + 1", "+ l_lst = [0 for _ in range(m)]", "+ r_lst = [0 for _ in range(m)]", "- if left < lr_lst[i][0]:", "- left = lr_lst[i][0]", "- if lr_lst[i][1] < right:", "- ...
false
0.088991
0.036841
2.415524
[ "s676607939", "s977723000" ]
u814663076
p03161
python
s325014889
s910414997
1,683
518
21,224
81,168
Accepted
Accepted
69.22
import numpy as np N, K = list(map(int, input().split())) h = np.array(input().split(), dtype='int32') dp = np.zeros(N, dtype='int32') for i in range(1, N): start = 0 if i < K else i-K dp[i] = np.min(dp[start:i] + np.abs(h[i]-h[start:i])) print((dp[-1]))
# region header import sys import math from bisect import bisect_left, bisect_right, insort_left, insort_right from collections import defaultdict, deque, Counter from copy import deepcopy from fractions import gcd from functools import lru_cache, reduce from heapq import heappop, heappush from itertools impor...
10
42
261
1,376
import numpy as np N, K = list(map(int, input().split())) h = np.array(input().split(), dtype="int32") dp = np.zeros(N, dtype="int32") for i in range(1, N): start = 0 if i < K else i - K dp[i] = np.min(dp[start:i] + np.abs(h[i] - h[start:i])) print((dp[-1]))
# region header import sys import math from bisect import bisect_left, bisect_right, insort_left, insort_right from collections import defaultdict, deque, Counter from copy import deepcopy from fractions import gcd from functools import lru_cache, reduce from heapq import heappop, heappush from itertools import ( a...
false
76.190476
[ "-import numpy as np", "+# region header", "+import sys", "+import math", "+from bisect import bisect_left, bisect_right, insort_left, insort_right", "+from collections import defaultdict, deque, Counter", "+from copy import deepcopy", "+from fractions import gcd", "+from functools import lru_cache,...
false
0.276535
0.037627
7.349387
[ "s325014889", "s910414997" ]
u644907318
p03799
python
s654362931
s910747153
160
74
38,384
61,752
Accepted
Accepted
53.75
N,M = list(map(int,input().split())) if M<2*N: cnt = M//2 else: cnt = N k = M-2*N cnt += k//4 print(cnt)
N,M = list(map(int,input().split())) if M<=2*N: print((M//2)) else: print((N+(M-2*N)//4))
8
5
121
91
N, M = list(map(int, input().split())) if M < 2 * N: cnt = M // 2 else: cnt = N k = M - 2 * N cnt += k // 4 print(cnt)
N, M = list(map(int, input().split())) if M <= 2 * N: print((M // 2)) else: print((N + (M - 2 * N) // 4))
false
37.5
[ "-if M < 2 * N:", "- cnt = M // 2", "+if M <= 2 * N:", "+ print((M // 2))", "- cnt = N", "- k = M - 2 * N", "- cnt += k // 4", "-print(cnt)", "+ print((N + (M - 2 * N) // 4))" ]
false
0.037756
0.12691
0.297501
[ "s654362931", "s910747153" ]
u616217092
p03337
python
s869125137
s561285940
20
17
3,316
2,940
Accepted
Accepted
15
from sys import stdin def main(): A, B = [int(x) for x in stdin.readline().rstrip().split()] print((max([A + B, A - B, A * B]))) if __name__ == '__main__': main()
from sys import stdin def main(): A, B = [int(x) for x in stdin.readline().rstrip().split()] print((max(A + B, A - B, A * B))) if __name__ == '__main__': main()
10
10
186
184
from sys import stdin def main(): A, B = [int(x) for x in stdin.readline().rstrip().split()] print((max([A + B, A - B, A * B]))) if __name__ == "__main__": main()
from sys import stdin def main(): A, B = [int(x) for x in stdin.readline().rstrip().split()] print((max(A + B, A - B, A * B))) if __name__ == "__main__": main()
false
0
[ "- print((max([A + B, A - B, A * B])))", "+ print((max(A + B, A - B, A * B)))" ]
false
0.046841
0.04478
1.046026
[ "s869125137", "s561285940" ]
u023229441
p02759
python
s220225603
s170394091
19
17
3,316
2,940
Accepted
Accepted
10.53
import math a=int(eval(input())) print((math.ceil(a/2)))
import math n=int(eval(input())) print((math.ceil(n/2)))
3
3
50
50
import math a = int(eval(input())) print((math.ceil(a / 2)))
import math n = int(eval(input())) print((math.ceil(n / 2)))
false
0
[ "-a = int(eval(input()))", "-print((math.ceil(a / 2)))", "+n = int(eval(input()))", "+print((math.ceil(n / 2)))" ]
false
0.047996
0.046922
1.022882
[ "s220225603", "s170394091" ]
u285891772
p02984
python
s717785085
s441084695
154
141
24,572
21,992
Accepted
Accepted
8.44
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemge...
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemge...
43
41
1,262
1,166
import sys, re from collections import deque, defaultdict, Counter from math import ( ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd, ) from itertools import ( accumulate, permutations, combinations, ...
import sys, re from collections import deque, defaultdict, Counter from math import ( ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd, ) from itertools import ( accumulate, permutations, combinations, ...
false
4.651163
[ "- return int(eval(input()))", "+ return int(input())", "- return list(map(int, input().split()))", "+ return map(int, input().split())", "- return list(zip(*(MAP() for _ in range(n))))", "+ return zip(*(MAP() for _ in range(n)))", "-a = [0] + list(accumulate(A[::2]))", "-b = [0] + l...
false
0.035773
0.036735
0.973808
[ "s717785085", "s441084695" ]
u633068244
p00436
python
s130073614
s790463675
60
50
4,248
4,248
Accepted
Accepted
16.67
n = int(input()) deck = [i for i in range(1,2*n+1)] m = int(input()) for i in range(m): k = int(input()) if k == 0: for j in range(n): deck += [deck[j]]+[deck[n+j]] deck = deck[2*n:] else: deck = deck[k:]+deck[:k] for i in deck: print(i)
n = int(input()) d = [i for i in range(1,2*n+1)] m = int(input()) for i in range(m): k = int(input()) if k == 0: for j in range(n): d += [d[j]]+[d[n+j]] d = d[2*n:] else: d = d[k:]+d[:k] for i in d: print(i)
13
13
312
282
n = int(input()) deck = [i for i in range(1, 2 * n + 1)] m = int(input()) for i in range(m): k = int(input()) if k == 0: for j in range(n): deck += [deck[j]] + [deck[n + j]] deck = deck[2 * n :] else: deck = deck[k:] + deck[:k] for i in deck: print(i)
n = int(input()) d = [i for i in range(1, 2 * n + 1)] m = int(input()) for i in range(m): k = int(input()) if k == 0: for j in range(n): d += [d[j]] + [d[n + j]] d = d[2 * n :] else: d = d[k:] + d[:k] for i in d: print(i)
false
0
[ "-deck = [i for i in range(1, 2 * n + 1)]", "+d = [i for i in range(1, 2 * n + 1)]", "- deck += [deck[j]] + [deck[n + j]]", "- deck = deck[2 * n :]", "+ d += [d[j]] + [d[n + j]]", "+ d = d[2 * n :]", "- deck = deck[k:] + deck[:k]", "-for i in deck:", "+ ...
false
0.046556
0.048421
0.961473
[ "s130073614", "s790463675" ]
u952708174
p02820
python
s990966005
s305633761
108
39
4,212
4,376
Accepted
Accepted
63.89
def d_prediction_and_restriction(): from itertools import groupby N, K = [int(i) for i in input().split()] R, S, P = [int(i) for i in input().split()] T = eval(input()) ans = 0 for i in range(K): tmp = groupby(T[i:N:K]) for k, lst in tmp: v = len(list(lst))...
def d_prediction_and_restriction(): import re N, K = [int(i) for i in input().split()] R, S, P = [int(i) for i in input().split()] T = eval(input()) can_win = {'r': 'p', 's': 'r', 'p': 's'} win_hand = [can_win[ch] for ch in T] points = {'r': R, 's': S, 'p': P} for i in range(...
26
17
699
533
def d_prediction_and_restriction(): from itertools import groupby N, K = [int(i) for i in input().split()] R, S, P = [int(i) for i in input().split()] T = eval(input()) ans = 0 for i in range(K): tmp = groupby(T[i:N:K]) for k, lst in tmp: v = len(list(lst)) ...
def d_prediction_and_restriction(): import re N, K = [int(i) for i in input().split()] R, S, P = [int(i) for i in input().split()] T = eval(input()) can_win = {"r": "p", "s": "r", "p": "s"} win_hand = [can_win[ch] for ch in T] points = {"r": R, "s": S, "p": P} for i in range(K, N): ...
false
34.615385
[ "- from itertools import groupby", "+ import re", "- ans = 0", "- for i in range(K):", "- tmp = groupby(T[i:N:K])", "- for k, lst in tmp:", "- v = len(list(lst))", "- if v == 1:", "- t = 1", "- elif v % 2 == 0:", "- ...
false
0.037835
0.036934
1.024408
[ "s990966005", "s305633761" ]
u821588465
p02554
python
s326719681
s516293909
390
32
10,960
9,160
Accepted
Accepted
91.79
N = int(eval(input())) MOD = 10**9+7 print(((10**N-2*9**N+8**N)%MOD))
N = int(eval(input())) mod = 10**9+7 ans = pow(10, N, mod) ans -=pow(9,N,mod)*2 ans += pow(8,N, mod) print((ans%mod))
4
7
65
117
N = int(eval(input())) MOD = 10**9 + 7 print(((10**N - 2 * 9**N + 8**N) % MOD))
N = int(eval(input())) mod = 10**9 + 7 ans = pow(10, N, mod) ans -= pow(9, N, mod) * 2 ans += pow(8, N, mod) print((ans % mod))
false
42.857143
[ "-MOD = 10**9 + 7", "-print(((10**N - 2 * 9**N + 8**N) % MOD))", "+mod = 10**9 + 7", "+ans = pow(10, N, mod)", "+ans -= pow(9, N, mod) * 2", "+ans += pow(8, N, mod)", "+print((ans % mod))" ]
false
0.359953
0.036569
9.843057
[ "s326719681", "s516293909" ]
u281303342
p03962
python
s923959193
s698881098
21
18
3,316
2,940
Accepted
Accepted
14.29
from collections import Counter A,B,C = list(map(int,input().split())) print((len(Counter([A,B,C]).most_common())))
A,B,C = list(map(int,input().split())) print((len(set([A,B,C]))))
3
3
109
60
from collections import Counter A, B, C = list(map(int, input().split())) print((len(Counter([A, B, C]).most_common())))
A, B, C = list(map(int, input().split())) print((len(set([A, B, C]))))
false
0
[ "-from collections import Counter", "-", "-print((len(Counter([A, B, C]).most_common())))", "+print((len(set([A, B, C]))))" ]
false
0.037612
0.063546
0.591881
[ "s923959193", "s698881098" ]
u388698992
p02630
python
s730762825
s921229685
445
340
89,064
93,240
Accepted
Accepted
23.6
from sys import * input = stdin.readline maxn = 10 ** 5 + 5 Sum = [0] * maxn Cnt = [0] * maxn n = int(eval(input())) arr = list(map(int, input().split())) ans = 0 for x in arr: ans += x Sum[x] += x Cnt[x] += 1 q = int(eval(input())) for i in range(q): x, y = list(map(int, input().split())) an...
from sys import * input = stdin.readline maxn = 10 ** 5 + 5 Sum = [0] * maxn Cnt = [0] * maxn n = int(eval(input())) arr = list(map(int, input().split())) ans = 0 for x in arr: ans += x Sum[x] += x Cnt[x] += 1 q = int(eval(input())) result = [] for i in range(q): x, y = list(map(int, input().s...
25
27
415
471
from sys import * input = stdin.readline maxn = 10**5 + 5 Sum = [0] * maxn Cnt = [0] * maxn n = int(eval(input())) arr = list(map(int, input().split())) ans = 0 for x in arr: ans += x Sum[x] += x Cnt[x] += 1 q = int(eval(input())) for i in range(q): x, y = list(map(int, input().split())) ans -= Sum...
from sys import * input = stdin.readline maxn = 10**5 + 5 Sum = [0] * maxn Cnt = [0] * maxn n = int(eval(input())) arr = list(map(int, input().split())) ans = 0 for x in arr: ans += x Sum[x] += x Cnt[x] += 1 q = int(eval(input())) result = [] for i in range(q): x, y = list(map(int, input().split())) ...
false
7.407407
[ "+result = []", "- print(ans)", "+ result.append(ans)", "+print((\"\\n\".join(map(str, result))))" ]
false
0.039956
0.039817
1.003506
[ "s730762825", "s921229685" ]
u983918956
p03241
python
s227882614
s415752468
491
21
40,812
3,060
Accepted
Accepted
95.72
import math as m N,M = list(map(int,input().split())) # N == 1 の処理 if N == 1: print(M) exit() # Mの素数判定 judge = "prime" for i in range(m.floor(pow(M,1/2)),1,-1): if M % i == 0: judge = "conposite" break if judge == "prime": print((1)) exit() for i in range(M // N,0,-1):...
import math as m N,M = list(map(int,input().split())) divisor = [] for i in range(1,m.floor(pow(M,1/2)) + 1): if M % i == 0: divisor.append(i) divisor.append(M // i) ans = 1 for e in divisor: if e > ans and e <= M // N: ans = e print(ans)
19
12
366
259
import math as m N, M = list(map(int, input().split())) # N == 1 の処理 if N == 1: print(M) exit() # Mの素数判定 judge = "prime" for i in range(m.floor(pow(M, 1 / 2)), 1, -1): if M % i == 0: judge = "conposite" break if judge == "prime": print((1)) exit() for i in range(M // N, 0, -1): ...
import math as m N, M = list(map(int, input().split())) divisor = [] for i in range(1, m.floor(pow(M, 1 / 2)) + 1): if M % i == 0: divisor.append(i) divisor.append(M // i) ans = 1 for e in divisor: if e > ans and e <= M // N: ans = e print(ans)
false
36.842105
[ "-# N == 1 の処理", "-if N == 1:", "- print(M)", "- exit()", "-# Mの素数判定", "-judge = \"prime\"", "-for i in range(m.floor(pow(M, 1 / 2)), 1, -1):", "+divisor = []", "+for i in range(1, m.floor(pow(M, 1 / 2)) + 1):", "- judge = \"conposite\"", "- break", "-if judge == \"prime\":...
false
0.062467
0.039884
1.566211
[ "s227882614", "s415752468" ]
u887207211
p02947
python
s893996488
s369120981
331
241
24,980
17,848
Accepted
Accepted
27.19
N = int(eval(input())) S = [eval(input()) for _ in range(N)] d = {} for s in S: s = "".join(sorted(s)) if s in d: d[s] += 1 else: d[s] = 1 ans = 0 for v in list(d.values()): ans += v*(v-1)//2 print(ans)
import sys stdin = sys.stdin ns = lambda : stdin.readline().rstrip() ni = lambda : int(ns()) na = lambda : list(map(int, stdin.readline().split())) def main(): n = ni() d = {} for _ in range(n): s = "".join(sorted(ns())) if s in d: d[s] += 1 else: d[s] = 1 ans = 0...
15
25
216
401
N = int(eval(input())) S = [eval(input()) for _ in range(N)] d = {} for s in S: s = "".join(sorted(s)) if s in d: d[s] += 1 else: d[s] = 1 ans = 0 for v in list(d.values()): ans += v * (v - 1) // 2 print(ans)
import sys stdin = sys.stdin ns = lambda: stdin.readline().rstrip() ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) def main(): n = ni() d = {} for _ in range(n): s = "".join(sorted(ns())) if s in d: d[s] += 1 else: d[s] = 1 ...
false
40
[ "-N = int(eval(input()))", "-S = [eval(input()) for _ in range(N)]", "-d = {}", "-for s in S:", "- s = \"\".join(sorted(s))", "- if s in d:", "- d[s] += 1", "- else:", "- d[s] = 1", "-ans = 0", "-for v in list(d.values()):", "- ans += v * (v - 1) // 2", "-print(ans)...
false
0.127428
0.036655
3.476435
[ "s893996488", "s369120981" ]
u810356688
p03037
python
s910445929
s352349650
356
322
6,980
6,980
Accepted
Accepted
9.55
n,m=list(map(int,input().split())) CARD=[0]*(n+1) for i in range(m): L,R=list(map(int,input().split())) CARD[L-1]+=1 CARD[R]-=1 ans=0 for i in range(n): if CARD[i]==m:ans+=1 CARD[i+1]=CARD[i+1]+CARD[i] print(ans)
def main(): n,m=list(map(int,input().split())) CARD=[0]*(n+1) for i in range(m): L,R=list(map(int,input().split())) CARD[L-1]+=1 CARD[R]-=1 ans=0 for i in range(n): if CARD[i]==m:ans+=1 CARD[i+1]=CARD[i+1]+CARD[i] print(ans) if __name__=='_...
12
16
232
329
n, m = list(map(int, input().split())) CARD = [0] * (n + 1) for i in range(m): L, R = list(map(int, input().split())) CARD[L - 1] += 1 CARD[R] -= 1 ans = 0 for i in range(n): if CARD[i] == m: ans += 1 CARD[i + 1] = CARD[i + 1] + CARD[i] print(ans)
def main(): n, m = list(map(int, input().split())) CARD = [0] * (n + 1) for i in range(m): L, R = list(map(int, input().split())) CARD[L - 1] += 1 CARD[R] -= 1 ans = 0 for i in range(n): if CARD[i] == m: ans += 1 CARD[i + 1] = CARD[i + 1] + CARD[i]...
false
25
[ "-n, m = list(map(int, input().split()))", "-CARD = [0] * (n + 1)", "-for i in range(m):", "- L, R = list(map(int, input().split()))", "- CARD[L - 1] += 1", "- CARD[R] -= 1", "-ans = 0", "-for i in range(n):", "- if CARD[i] == m:", "- ans += 1", "- CARD[i + 1] = CARD[i + 1]...
false
0.065113
0.130741
0.498034
[ "s910445929", "s352349650" ]
u374449234
p02711
python
s706714447
s412304339
62
57
61,804
61,700
Accepted
Accepted
8.06
k = eval(input()) if "7" in k: print("Yes") else: print("No")
if "7" in eval(input()): print("Yes") else: print("No")
6
4
69
60
k = eval(input()) if "7" in k: print("Yes") else: print("No")
if "7" in eval(input()): print("Yes") else: print("No")
false
33.333333
[ "-k = eval(input())", "-if \"7\" in k:", "+if \"7\" in eval(input()):" ]
false
0.042678
0.039665
1.075959
[ "s706714447", "s412304339" ]
u867826040
p02773
python
s399170039
s134606772
632
547
35,568
35,564
Accepted
Accepted
13.45
import collections s = collections.Counter([eval(input()) for s in range(int(eval(input())))]) m = max(s.values()) a = [] for d in list(s.items()): if d[1] == m: a.append(d[0]) for s in sorted(a): print(s)
import collections s = collections.Counter([eval(input()) for s in range(int(eval(input())))]) m = max(s.values()) a = [] for d in list(s.items()): if d[1] == m: a.append(d[0]) print(("\n".join(sorted(a))))
10
9
205
202
import collections s = collections.Counter([eval(input()) for s in range(int(eval(input())))]) m = max(s.values()) a = [] for d in list(s.items()): if d[1] == m: a.append(d[0]) for s in sorted(a): print(s)
import collections s = collections.Counter([eval(input()) for s in range(int(eval(input())))]) m = max(s.values()) a = [] for d in list(s.items()): if d[1] == m: a.append(d[0]) print(("\n".join(sorted(a))))
false
10
[ "-for s in sorted(a):", "- print(s)", "+print((\"\\n\".join(sorted(a))))" ]
false
0.03735
0.059554
0.62716
[ "s399170039", "s134606772" ]
u052499405
p02949
python
s576603032
s997358123
1,465
902
51,928
66,136
Accepted
Accepted
38.43
INF = 10**18 n, m, p = [int(item) for item in input().split()] edge = [[] for _ in range(n)] for i in range(m): a, b, c = [int(item) for item in input().split()] a -= 1; b -= 1; c -= p c *= -1 edge[a].append((b, c)) dist = [INF] * n dist[0] = 0 update = 1 terminal_update = 0 for _ in rang...
import sys sys.setrecursionlimit(10**6) INF = 10**10 def dfs(edge, visited, n): if visited[n]: return visited[n] = True for to, _ in edge[n]: dfs(edge, visited, to) def bellman_ford(edge, mask): dist = [INF] * n dist[0] = 0 for _ in range(n): update = ...
30
53
781
1,454
INF = 10**18 n, m, p = [int(item) for item in input().split()] edge = [[] for _ in range(n)] for i in range(m): a, b, c = [int(item) for item in input().split()] a -= 1 b -= 1 c -= p c *= -1 edge[a].append((b, c)) dist = [INF] * n dist[0] = 0 update = 1 terminal_update = 0 for _ in range(n * 2):...
import sys sys.setrecursionlimit(10**6) INF = 10**10 def dfs(edge, visited, n): if visited[n]: return visited[n] = True for to, _ in edge[n]: dfs(edge, visited, to) def bellman_ford(edge, mask): dist = [INF] * n dist[0] = 0 for _ in range(n): update = False f...
false
43.396226
[ "-INF = 10**18", "-n, m, p = [int(item) for item in input().split()]", "-edge = [[] for _ in range(n)]", "-for i in range(m):", "- a, b, c = [int(item) for item in input().split()]", "- a -= 1", "- b -= 1", "- c -= p", "- c *= -1", "- edge[a].append((b, c))", "-dist = [INF] * n...
false
0.03816
0.082553
0.462243
[ "s576603032", "s997358123" ]
u426764965
p02629
python
s551284962
s965431678
67
27
61,696
9,120
Accepted
Accepted
59.7
N = int(eval(input())) ans = '' while N > 0: N -= 1 ans += chr(ord('a') + N % 26) N //= 26 ans = ans[::-1] print(ans)
N = int(eval(input())) arr = [] while 0 < N: N -= 1 arr.append(N % 26) N //= 26 ans = '' for a in reversed(arr): ans += chr(ord('a')+a) print(ans)
8
10
130
165
N = int(eval(input())) ans = "" while N > 0: N -= 1 ans += chr(ord("a") + N % 26) N //= 26 ans = ans[::-1] print(ans)
N = int(eval(input())) arr = [] while 0 < N: N -= 1 arr.append(N % 26) N //= 26 ans = "" for a in reversed(arr): ans += chr(ord("a") + a) print(ans)
false
20
[ "+arr = []", "+while 0 < N:", "+ N -= 1", "+ arr.append(N % 26)", "+ N //= 26", "-while N > 0:", "- N -= 1", "- ans += chr(ord(\"a\") + N % 26)", "- N //= 26", "-ans = ans[::-1]", "+for a in reversed(arr):", "+ ans += chr(ord(\"a\") + a)" ]
false
0.077315
0.089857
0.860432
[ "s551284962", "s965431678" ]
u185034753
p02720
python
s347903568
s328316709
186
78
3,444
12,140
Accepted
Accepted
58.06
import collections def go_next(digits): if all(x==9 for x in digits): return [0]*len(digits) + [1] digits[0] += 1 maxInc = -1 # print(digits) for i in range(1, len(digits)): if digits[i-1] >= 10 or abs(digits[i]-digits[i-1]) >= 2: digits[i] += 1 ...
def main(): from collections import deque K = int(eval(input())) q = deque(list(range(1, 10))) for _ in range(K): x = q.popleft() lastdigit = x%10 base = x*10 + lastdigit if lastdigit != 0: q.append(base-1) q.append(base) if lastdi...
39
19
748
405
import collections def go_next(digits): if all(x == 9 for x in digits): return [0] * len(digits) + [1] digits[0] += 1 maxInc = -1 # print(digits) for i in range(1, len(digits)): if digits[i - 1] >= 10 or abs(digits[i] - digits[i - 1]) >= 2: digits[i] += 1 ma...
def main(): from collections import deque K = int(eval(input())) q = deque(list(range(1, 10))) for _ in range(K): x = q.popleft() lastdigit = x % 10 base = x * 10 + lastdigit if lastdigit != 0: q.append(base - 1) q.append(base) if lastdigit !=...
false
51.282051
[ "-import collections", "+def main():", "+ from collections import deque", "-", "-def go_next(digits):", "- if all(x == 9 for x in digits):", "- return [0] * len(digits) + [1]", "- digits[0] += 1", "- maxInc = -1", "- # print(digits)", "- for i in range(1, len(digits)):",...
false
0.065509
0.049789
1.315742
[ "s347903568", "s328316709" ]
u408071652
p02623
python
s346577273
s135844350
186
147
115,736
115,484
Accepted
Accepted
20.97
import sys #import numpy as np #from collections import defaultdict import math #from collections import deque #input = sys.stdin.readline #import numpy as n import bisect def main(): N,M,K= list(map(int,input().split())) A = list(map(int,input().split())) B = list(map(int, input().sp...
import sys #import numpy as np #from collections import defaultdict import math #from collections import deque #input = sys.stdin.readline #import numpy as n import bisect def main(): N,M,K= list(map(int,input().split())) A = list(map(int,input().split())) B = list(map(int, input().sp...
43
47
919
1,019
import sys # import numpy as np # from collections import defaultdict import math # from collections import deque # input = sys.stdin.readline # import numpy as n import bisect def main(): N, M, K = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) ...
import sys # import numpy as np # from collections import defaultdict import math # from collections import deque # input = sys.stdin.readline # import numpy as n import bisect def main(): N, M, K = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) ...
false
8.510638
[ "+ j = M", "- b_read = bisect.bisect_right(cumB, res)", "- ans = max(i + b_read, ans)", "+ while cumB[j] + cumA[i] > K:", "+ j -= 1", "+ ans = max(ans, i + j)", "+ # b_read = bisect.bisect_right(cumB,res)", "+ # ans =max( i + b_read,ans)", ...
false
0.076613
0.038161
2.007615
[ "s346577273", "s135844350" ]
u300968187
p03220
python
s053383516
s949192906
76
18
3,060
3,060
Accepted
Accepted
76.32
N = int(eval(input())) T, A = list(map(int, input().split())) dif = list([abs(T - int(x) * 0.006 - A) for x in input().split()]) print((dif.index(min(dif)) + 1))
N = int(eval(input())) T, A = list(map(int, input().split())) x_list = list(map(int, input().split())) min_dif = 10**10 ans = 0 for i in range(N): dif = abs(T - x_list[i] * 0.006 - A) if min_dif > dif: min_dif = dif ans = i + 1 print(ans)
4
11
155
260
N = int(eval(input())) T, A = list(map(int, input().split())) dif = list([abs(T - int(x) * 0.006 - A) for x in input().split()]) print((dif.index(min(dif)) + 1))
N = int(eval(input())) T, A = list(map(int, input().split())) x_list = list(map(int, input().split())) min_dif = 10**10 ans = 0 for i in range(N): dif = abs(T - x_list[i] * 0.006 - A) if min_dif > dif: min_dif = dif ans = i + 1 print(ans)
false
63.636364
[ "-dif = list([abs(T - int(x) * 0.006 - A) for x in input().split()])", "-print((dif.index(min(dif)) + 1))", "+x_list = list(map(int, input().split()))", "+min_dif = 10**10", "+ans = 0", "+for i in range(N):", "+ dif = abs(T - x_list[i] * 0.006 - A)", "+ if min_dif > dif:", "+ min_dif = ...
false
0.037671
0.074909
0.502888
[ "s053383516", "s949192906" ]
u905203728
p03283
python
s059859898
s121683111
1,334
1,205
90,328
44,740
Accepted
Accepted
9.67
n,m,q=list(map(int,input().split())) book=[[0]*(n+1) for _ in range(n+1)] for _ in range(m): r,l=list(map(int,input().split())) book[r][l] +=1 for i in range(n+1): for j in range(n+1): book[i][j] +=book[i][j-1] for i in range(n+1): for j in range(n+1): book[i][j] +=book[i-1...
n,m,q=list(map(int,input().split())) LR=[tuple(map(int,input().split())) for _ in range(m)] PQ=[tuple(map(int,input().split())) for _ in range(q)] MAP=[[0]*(n+1) for _ in range(n+1)] for l,r in LR: MAP[l][r] +=1 for i in range(n+1): for j in range(n+1): MAP[i][j] +=MAP[i][j-1] for i in ra...
16
18
436
462
n, m, q = list(map(int, input().split())) book = [[0] * (n + 1) for _ in range(n + 1)] for _ in range(m): r, l = list(map(int, input().split())) book[r][l] += 1 for i in range(n + 1): for j in range(n + 1): book[i][j] += book[i][j - 1] for i in range(n + 1): for j in range(n + 1): book[i...
n, m, q = list(map(int, input().split())) LR = [tuple(map(int, input().split())) for _ in range(m)] PQ = [tuple(map(int, input().split())) for _ in range(q)] MAP = [[0] * (n + 1) for _ in range(n + 1)] for l, r in LR: MAP[l][r] += 1 for i in range(n + 1): for j in range(n + 1): MAP[i][j] += MAP[i][j - 1...
false
11.111111
[ "-book = [[0] * (n + 1) for _ in range(n + 1)]", "-for _ in range(m):", "- r, l = list(map(int, input().split()))", "- book[r][l] += 1", "+LR = [tuple(map(int, input().split())) for _ in range(m)]", "+PQ = [tuple(map(int, input().split())) for _ in range(q)]", "+MAP = [[0] * (n + 1) for _ in range...
false
0.036977
0.03651
1.012799
[ "s059859898", "s121683111" ]
u660912567
p00001
python
s698813888
s092587821
30
20
7,680
7,564
Accepted
Accepted
33.33
height_list = [int(eval(input())) for i in range(10)] for i in range(1,4): print((sorted(height_list)[-i]))
import sys height_li = [] for i in range(10): height_li.append(int(eval(input()))) for i in range(3): print((sorted(height_li,reverse=True)[i]))
2
6
100
150
height_list = [int(eval(input())) for i in range(10)] for i in range(1, 4): print((sorted(height_list)[-i]))
import sys height_li = [] for i in range(10): height_li.append(int(eval(input()))) for i in range(3): print((sorted(height_li, reverse=True)[i]))
false
66.666667
[ "-height_list = [int(eval(input())) for i in range(10)]", "-for i in range(1, 4):", "- print((sorted(height_list)[-i]))", "+import sys", "+", "+height_li = []", "+for i in range(10):", "+ height_li.append(int(eval(input())))", "+for i in range(3):", "+ print((sorted(height_li, reverse=Tru...
false
0.049814
0.008208
6.068691
[ "s698813888", "s092587821" ]
u774729733
p02954
python
s023705279
s698373926
356
234
77,624
47,676
Accepted
Accepted
34.27
from copy import deepcopy from sys import exit,setrecursionlimit import math from collections import defaultdict,Counter,deque from fractions import Fraction as frac import bisect import sys import logging import heapq logging.basicConfig(level=logging.DEBUG) input = sys.stdin.readline setrecursionlimit(...
import sys input = sys.stdin.readline def main(): S=eval(input()) A=[0]*(len(S)-1) mode="L" s=0 b=0 e=0 l=0 for i in range(len(S)): c=S[i] if mode=="L" and c==mode: mode="R" b=i-1 elif mode=="R" and c==mode: ...
49
37
876
586
from copy import deepcopy from sys import exit, setrecursionlimit import math from collections import defaultdict, Counter, deque from fractions import Fraction as frac import bisect import sys import logging import heapq logging.basicConfig(level=logging.DEBUG) input = sys.stdin.readline setrecursionlimit(1000000) ...
import sys input = sys.stdin.readline def main(): S = eval(input()) A = [0] * (len(S) - 1) mode = "L" s = 0 b = 0 e = 0 l = 0 for i in range(len(S)): c = S[i] if mode == "L" and c == mode: mode = "R" b = i - 1 elif mode == "R" and c == m...
false
24.489796
[ "-from copy import deepcopy", "-from sys import exit, setrecursionlimit", "-import math", "-from collections import defaultdict, Counter, deque", "-from fractions import Fraction as frac", "-import bisect", "-import logging", "-import heapq", "-logging.basicConfig(level=logging.DEBUG)", "-setrecur...
false
0.051753
0.035982
1.438305
[ "s023705279", "s698373926" ]
u436484848
p03959
python
s736789241
s135925519
209
190
27,072
26,304
Accepted
Accepted
9.09
def read(): return [int(i) for i in input().split(" ")] N = int(eval(input())) T = read() A = read() t = [(i != j, i) for i, j in zip(T, [None] + T)] a = [(i != j, i) for i, j in zip(A, (A + [None])[1:])] P = 1 for p, q in zip(t, a): if(p[0]): if(q[0]): if(p[1] != q[1]): print((0)) exit() ...
def read(): return [int(i) for i in input().split(" ")] N = int(eval(input())) T = read() A = read() T = [(i != j, i) for i, j in zip(T, [None] + T)] A = [(i != j, i) for i, j in zip(A, (A + [None])[1:])] P = 1 for p, q in zip(T, A): if(p[0]): if(q[0]): if(p[1] != q[1]): print((0)) exit() ...
24
25
476
485
def read(): return [int(i) for i in input().split(" ")] N = int(eval(input())) T = read() A = read() t = [(i != j, i) for i, j in zip(T, [None] + T)] a = [(i != j, i) for i, j in zip(A, (A + [None])[1:])] P = 1 for p, q in zip(t, a): if p[0]: if q[0]: if p[1] != q[1]: print...
def read(): return [int(i) for i in input().split(" ")] N = int(eval(input())) T = read() A = read() T = [(i != j, i) for i, j in zip(T, [None] + T)] A = [(i != j, i) for i, j in zip(A, (A + [None])[1:])] P = 1 for p, q in zip(T, A): if p[0]: if q[0]: if p[1] != q[1]: print...
false
4
[ "-t = [(i != j, i) for i, j in zip(T, [None] + T)]", "-a = [(i != j, i) for i, j in zip(A, (A + [None])[1:])]", "+T = [(i != j, i) for i, j in zip(T, [None] + T)]", "+A = [(i != j, i) for i, j in zip(A, (A + [None])[1:])]", "-for p, q in zip(t, a):", "+for p, q in zip(T, A):", "- elif q[1] < p[1]...
false
0.048492
0.058279
0.832075
[ "s736789241", "s135925519" ]
u118766929
p01624
python
s291680552
s782028158
12,170
8,160
5,624
5,616
Accepted
Accepted
32.95
# undo が出来るゲームは全て2手だけ見ればよい ops = ["+", "*", "-", "&", "^", "|"] numbers = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] def check(x): # +* op = 0 for c in x: if c in ops: op += 1 if op >= 2: return None else: op = 0 ...
# undo が出来るゲームは全て2手だけ見ればよい ops = ["+", "*", "-", "&", "^", "|"] numbers = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] def check(x): # +* op = 0 for c in x: if c in ops: op += 1 if op >= 2: return None else: op = 0 ...
87
75
2,026
1,688
# undo が出来るゲームは全て2手だけ見ればよい ops = ["+", "*", "-", "&", "^", "|"] numbers = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] def check(x): # +* op = 0 for c in x: if c in ops: op += 1 if op >= 2: return None else: op = 0 # +... fo...
# undo が出来るゲームは全て2手だけ見ればよい ops = ["+", "*", "-", "&", "^", "|"] numbers = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] def check(x): # +* op = 0 for c in x: if c in ops: op += 1 if op >= 2: return None else: op = 0 # +... fo...
false
13.793103
[ "- if n == 1:", "+ if n % 2 == 1:", "- maxval = eval(x)", "- tele = x", "- if maxval < nextss[0][0]:", "- maxval = nextss[0][0]", "- tele = nextss[0][1]", "- if n % 2 == 0:", "- print((max(minvals))) # 999+9999 -> 9&99+9999", "- continue",...
false
0.891201
0.173186
5.145931
[ "s291680552", "s782028158" ]
u855199458
p02314
python
s750133871
s022980525
560
470
9,592
7,520
Accepted
Accepted
16.07
# -*- coding: utf-8 -*- N, M = tuple(map(int, input().split())) coins = sorted(tuple(map(int, input().split()))) counts = [float("inf") for _ in range(N+1)] counts[0] = 0 for m in range(M): coin = coins[m] for n in range(coin, N+1): counts[n] = min(counts[n], counts[n-coin] + 1) print((co...
# -*- coding: utf-8 -*- def inpl(): return list(map(int, input().split())) n, m = inpl() C = sorted(inpl()) DP = list(range(n+1)) for c in C[1:]: for i in range(n-c+1): if DP[i] + 1 < DP[i+c]: DP[i+c] = DP[i] + 1 print((DP[-1]))
13
12
328
276
# -*- coding: utf-8 -*- N, M = tuple(map(int, input().split())) coins = sorted(tuple(map(int, input().split()))) counts = [float("inf") for _ in range(N + 1)] counts[0] = 0 for m in range(M): coin = coins[m] for n in range(coin, N + 1): counts[n] = min(counts[n], counts[n - coin] + 1) print((counts[-1])...
# -*- coding: utf-8 -*- def inpl(): return list(map(int, input().split())) n, m = inpl() C = sorted(inpl()) DP = list(range(n + 1)) for c in C[1:]: for i in range(n - c + 1): if DP[i] + 1 < DP[i + c]: DP[i + c] = DP[i] + 1 print((DP[-1]))
false
7.692308
[ "-N, M = tuple(map(int, input().split()))", "-coins = sorted(tuple(map(int, input().split())))", "-counts = [float(\"inf\") for _ in range(N + 1)]", "-counts[0] = 0", "-for m in range(M):", "- coin = coins[m]", "- for n in range(coin, N + 1):", "- counts[n] = min(counts[n], counts[n - coi...
false
0.151023
0.042551
3.549201
[ "s750133871", "s022980525" ]
u889919275
p02627
python
s149160456
s539005795
34
26
9,088
8,928
Accepted
Accepted
23.53
alpha = eval(input()) if alpha.isupper(): print('A') else: print('a')
N = eval(input()) if N.isupper(): print('A') else: print('a')
6
5
77
67
alpha = eval(input()) if alpha.isupper(): print("A") else: print("a")
N = eval(input()) if N.isupper(): print("A") else: print("a")
false
16.666667
[ "-alpha = eval(input())", "-if alpha.isupper():", "+N = eval(input())", "+if N.isupper():" ]
false
0.007636
0.039595
0.192847
[ "s149160456", "s539005795" ]
u102461423
p03014
python
s897790682
s187669849
599
488
208,088
47,596
Accepted
Accepted
18.53
import numpy as np import sys buf = sys.stdin.buffer H,W = list(map(int,buf.readline().split())) # 周りに壁を、0,1化、壁を0で持つ grid = np.zeros((H+2,W+2),dtype=np.bool) grid[1:-1,1:] = (np.frombuffer(buf.read(H*(W+1)),dtype='S1') == b'.').reshape((H,W+1)) # x軸方向の集計 def F(transpose): x = grid if transpose: x...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np H,W = list(map(int,readline().split())) floor = np.frombuffer(read(),dtype='S1').reshape(H,-1)[:,:W] == b'.' score = np.zeros((H,W),np.int32) x = np.zeros((H,W),np.int32...
30
35
804
700
import numpy as np import sys buf = sys.stdin.buffer H, W = list(map(int, buf.readline().split())) # 周りに壁を、0,1化、壁を0で持つ grid = np.zeros((H + 2, W + 2), dtype=np.bool) grid[1:-1, 1:] = (np.frombuffer(buf.read(H * (W + 1)), dtype="S1") == b".").reshape( (H, W + 1) ) # x軸方向の集計 def F(transpose): x = grid if tra...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np H, W = list(map(int, readline().split())) floor = np.frombuffer(read(), dtype="S1").reshape(H, -1)[:, :W] == b"." score = np.zeros((H, W), np.int32) x = np.zeros((H, W), np.int32) for...
false
14.285714
[ "-import numpy as np", "-buf = sys.stdin.buffer", "-H, W = list(map(int, buf.readline().split()))", "-# 周りに壁を、0,1化、壁を0で持つ", "-grid = np.zeros((H + 2, W + 2), dtype=np.bool)", "-grid[1:-1, 1:] = (np.frombuffer(buf.read(H * (W + 1)), dtype=\"S1\") == b\".\").reshape(", "- (H, W + 1)", "-)", "-# x軸方...
false
0.444288
0.621079
0.715349
[ "s897790682", "s187669849" ]
u150641538
p02983
python
s071927081
s412506846
360
174
40,812
38,896
Accepted
Accepted
51.67
l,r=list(map(int,input().split())) if r>l+4040: r=l+4040 dif=r-l minimum=1000000000 for i in range(l%2019,l%2019 + dif+1): for j in range(i+1,l%2019 +dif +1): minimum=min(minimum,((i*j)%2019)) print(minimum)
l,r=list(map(int,input().split())) minimum=1000000000 for i in range(l, r+1): for j in range(i+1,r+1): minimum=min(minimum,((i*j)%2019)) if minimum==0: break if minimum ==0: break print(minimum)
9
10
225
241
l, r = list(map(int, input().split())) if r > l + 4040: r = l + 4040 dif = r - l minimum = 1000000000 for i in range(l % 2019, l % 2019 + dif + 1): for j in range(i + 1, l % 2019 + dif + 1): minimum = min(minimum, ((i * j) % 2019)) print(minimum)
l, r = list(map(int, input().split())) minimum = 1000000000 for i in range(l, r + 1): for j in range(i + 1, r + 1): minimum = min(minimum, ((i * j) % 2019)) if minimum == 0: break if minimum == 0: break print(minimum)
false
10
[ "-if r > l + 4040:", "- r = l + 4040", "-dif = r - l", "-for i in range(l % 2019, l % 2019 + dif + 1):", "- for j in range(i + 1, l % 2019 + dif + 1):", "+for i in range(l, r + 1):", "+ for j in range(i + 1, r + 1):", "+ if minimum == 0:", "+ break", "+ if minimum == ...
false
0.158864
0.045353
3.502814
[ "s071927081", "s412506846" ]
u546285759
p00468
python
s000566592
s980463381
100
80
9,424
10,948
Accepted
Accepted
20
while True: n, m = int(eval(input())), int(eval(input())) if m == 0: break d = {k+1:[] for k,_ in enumerate(range(m))} for _ in range(m): a, b = list(map(int, input().split())) d[a].append(b) d[b].append(a) ans = d[1].copy() for k in d[1]: ans +...
while True: n = int(eval(input())) m = int(eval(input())) if m == 0: break dataset = [input().split() for _ in range(m)] list_ = {i+1: [] for i in range(n)} for data in dataset: idx_x, idx_y = list(map(int, data)) list_[idx_x].append(idx_y) list_[idx_y]....
13
16
336
421
while True: n, m = int(eval(input())), int(eval(input())) if m == 0: break d = {k + 1: [] for k, _ in enumerate(range(m))} for _ in range(m): a, b = list(map(int, input().split())) d[a].append(b) d[b].append(a) ans = d[1].copy() for k in d[1]: ans += d[k] ...
while True: n = int(eval(input())) m = int(eval(input())) if m == 0: break dataset = [input().split() for _ in range(m)] list_ = {i + 1: [] for i in range(n)} for data in dataset: idx_x, idx_y = list(map(int, data)) list_[idx_x].append(idx_y) list_[idx_y].append(i...
false
18.75
[ "- n, m = int(eval(input())), int(eval(input()))", "+ n = int(eval(input()))", "+ m = int(eval(input()))", "- d = {k + 1: [] for k, _ in enumerate(range(m))}", "- for _ in range(m):", "- a, b = list(map(int, input().split()))", "- d[a].append(b)", "- d[b].append(a)"...
false
0.078969
0.126167
0.625905
[ "s000566592", "s980463381" ]
u644907318
p03319
python
s994017573
s282918519
204
84
52,652
83,280
Accepted
Accepted
58.82
N,K = list(map(int,input().split())) A = list(map(int,input().split())) cnt = 1 n = (N-K)//(K-1) if (N-K)%(K-1)==0: cnt += n else: cnt += n+1 print(cnt)
N,K = list(map(int,input().split())) A = list(map(int,input().split())) ind = A.index(1) n = ind//(K-1) if ind%(K-1): n += 1 m = (N-1-ind)//(K-1) if (N-1-ind)%(K-1): m += 1 cmin = n+m for i in range(max(1,ind+K-N),min(ind,K-1)+1): n = (ind-i)//(K-1) if (ind-i)%(K-1): n += 1 m =...
9
20
162
432
N, K = list(map(int, input().split())) A = list(map(int, input().split())) cnt = 1 n = (N - K) // (K - 1) if (N - K) % (K - 1) == 0: cnt += n else: cnt += n + 1 print(cnt)
N, K = list(map(int, input().split())) A = list(map(int, input().split())) ind = A.index(1) n = ind // (K - 1) if ind % (K - 1): n += 1 m = (N - 1 - ind) // (K - 1) if (N - 1 - ind) % (K - 1): m += 1 cmin = n + m for i in range(max(1, ind + K - N), min(ind, K - 1) + 1): n = (ind - i) // (K - 1) if (ind ...
false
55
[ "-cnt = 1", "-n = (N - K) // (K - 1)", "-if (N - K) % (K - 1) == 0:", "- cnt += n", "-else:", "- cnt += n + 1", "-print(cnt)", "+ind = A.index(1)", "+n = ind // (K - 1)", "+if ind % (K - 1):", "+ n += 1", "+m = (N - 1 - ind) // (K - 1)", "+if (N - 1 - ind) % (K - 1):", "+ m += ...
false
0.037565
0.054031
0.695249
[ "s994017573", "s282918519" ]
u119148115
p02995
python
s152322903
s801150146
311
68
80,076
62,284
Accepted
Accepted
78.14
import sys def S(): return sys.stdin.readline().rstrip() A,B,C,D = list(map(int,S().split())) from math import gcd def f(n): # 1からnまでCでもDでも割り切れない自然数の個数 return n-n//C-n//D+n//(C*D//gcd(C,D)) print((f(B)-f(A-1)))
import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし def ...
12
23
223
617
import sys def S(): return sys.stdin.readline().rstrip() A, B, C, D = list(map(int, S().split())) from math import gcd def f(n): # 1からnまでCでもDでも割り切れない自然数の個数 return n - n // C - n // D + n // (C * D // gcd(C, D)) print((f(B) - f(A - 1)))
import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return list(map(int, sys.stdin.readline().rstrip().split())) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり def LI2(): return list(map(int, sys.stdin.readline().r...
false
47.826087
[ "+", "+sys.setrecursionlimit(10**7)", "+", "+", "+def I():", "+ return int(sys.stdin.readline().rstrip())", "+", "+", "+def MI():", "+ return list(map(int, sys.stdin.readline().rstrip().split()))", "+", "+", "+def LI():", "+ return list(map(int, sys.stdin.readline().rstrip().split...
false
0.042078
0.034893
1.205902
[ "s152322903", "s801150146" ]
u606878291
p02693
python
s346273123
s883908031
24
21
9,156
9,164
Accepted
Accepted
12.5
K = int(eval(input())) l, h = list(map(int, input().split(' '))) for n in range(l, h + 1): if n % K == 0: print('OK') break else: print('NG')
K = int(eval(input())) A, B = list(map(int, input().split(' '))) if B // K * K >= A: print('OK') else: print('NG')
9
7
163
118
K = int(eval(input())) l, h = list(map(int, input().split(" "))) for n in range(l, h + 1): if n % K == 0: print("OK") break else: print("NG")
K = int(eval(input())) A, B = list(map(int, input().split(" "))) if B // K * K >= A: print("OK") else: print("NG")
false
22.222222
[ "-l, h = list(map(int, input().split(\" \")))", "-for n in range(l, h + 1):", "- if n % K == 0:", "- print(\"OK\")", "- break", "+A, B = list(map(int, input().split(\" \")))", "+if B // K * K >= A:", "+ print(\"OK\")" ]
false
0.043688
0.044238
0.987561
[ "s346273123", "s883908031" ]
u119148115
p03837
python
s187703401
s451216560
230
116
74,932
74,376
Accepted
Accepted
49.57
import sys def MI(): return list(map(int,sys.stdin.readline().rstrip().split())) N,M = MI() class WarshallFloyd(): def __init__(self,N): # Nは頂点の個数 self.N = N self.d = [[float('inf')]*N for i in range(N)] # d[i][j] = iからjへの最短距離,0-indexed def add(self,u,v,c,directed = False): ...
import sys def MI(): return list(map(int,sys.stdin.readline().rstrip().split())) N,M = MI() class WarshallFloyd(): def __init__(self,N): # Nは頂点の個数 self.N = N self.d = [[float('inf')]*N for i in range(N)] # d[i][j] = iからjへの最短距離,0-indexed def add(self,u,v,c,directed = False): ...
46
45
1,182
1,134
import sys def MI(): return list(map(int, sys.stdin.readline().rstrip().split())) N, M = MI() class WarshallFloyd: def __init__(self, N): # Nは頂点の個数 self.N = N self.d = [ [float("inf")] * N for i in range(N) ] # d[i][j] = iからjへの最短距離,0-indexed def add(self, u, v, c...
import sys def MI(): return list(map(int, sys.stdin.readline().rstrip().split())) N, M = MI() class WarshallFloyd: def __init__(self, N): # Nは頂点の個数 self.N = N self.d = [ [float("inf")] * N for i in range(N) ] # d[i][j] = iからjへの最短距離,0-indexed def add(self, u, v, c...
false
2.173913
[ "- for k in range(N):", "- if W.d[j][k] == W.d[j][edges[i][0]] + edges[i][2] + W.d[edges[i][1]][k]:", "- a = 1", "+ if W.d[j][edges[i][1]] == W.d[j][edges[i][0]] + edges[i][2]:", "+ a = 1" ]
false
0.111051
0.039141
2.837203
[ "s187703401", "s451216560" ]
u070201429
p03111
python
s701020886
s555956738
448
89
70,048
73,936
Accepted
Accepted
80.13
from itertools import permutations def main(): n, a, b, c = list(map(int, input().split())) l = [int(eval(input())) for _ in range(n)] # full search ans = 10**9 for perm in permutations(l): cost = -30 for i in range(1, n-1): cost1 = cost + 10 * len(perm[:i]) ...
from itertools import product from sys import stdin input = stdin.buffer.readline def main(): n, *abc = list(map(int, input().split())) l = [int(eval(input())) for _ in range(n)] ans = 10**9 for prod in product([0, 1, 2, 3], repeat=n): cost = 10 * (n-3) lengths = [0, 0, 0] ...
22
31
676
713
from itertools import permutations def main(): n, a, b, c = list(map(int, input().split())) l = [int(eval(input())) for _ in range(n)] # full search ans = 10**9 for perm in permutations(l): cost = -30 for i in range(1, n - 1): cost1 = cost + 10 * len(perm[:i]) + abs(a -...
from itertools import product from sys import stdin input = stdin.buffer.readline def main(): n, *abc = list(map(int, input().split())) l = [int(eval(input())) for _ in range(n)] ans = 10**9 for prod in product([0, 1, 2, 3], repeat=n): cost = 10 * (n - 3) lengths = [0, 0, 0] f...
false
29.032258
[ "-from itertools import permutations", "+from itertools import product", "+from sys import stdin", "+", "+input = stdin.buffer.readline", "- n, a, b, c = list(map(int, input().split()))", "+ n, *abc = list(map(int, input().split()))", "- # full search", "- for perm in permutations(l):", ...
false
1.200729
0.287838
4.171538
[ "s701020886", "s555956738" ]
u926678805
p03160
python
s382061997
s362652948
707
255
118,008
93,592
Accepted
Accepted
63.93
import sys sys.setrecursionlimit(100000) input=lambda : sys.stdin.readline().rstrip('\n') n=int(eval(input())) h=list(map(int,input().split())) dp=[10**18 for i in range(n)] def cost(n): if n==0: return 0 if n<0: return 10**18 if dp[n]!=10**18: return dp[n] dp[n]...
import sys sys.setrecursionlimit(2000000000) input=lambda : sys.stdin.readline().rstrip('\n') n=int(eval(input())) h=list(map(int,input().split())) dp=[10**18 for i in range(n)] def cost(n): if n==0: return 0 if n<0: return 10**18 if dp[n]!=10**18: return dp[n] d...
19
19
414
418
import sys sys.setrecursionlimit(100000) input = lambda: sys.stdin.readline().rstrip("\n") n = int(eval(input())) h = list(map(int, input().split())) dp = [10**18 for i in range(n)] def cost(n): if n == 0: return 0 if n < 0: return 10**18 if dp[n] != 10**18: return dp[n] dp[n]...
import sys sys.setrecursionlimit(2000000000) input = lambda: sys.stdin.readline().rstrip("\n") n = int(eval(input())) h = list(map(int, input().split())) dp = [10**18 for i in range(n)] def cost(n): if n == 0: return 0 if n < 0: return 10**18 if dp[n] != 10**18: return dp[n] d...
false
0
[ "-sys.setrecursionlimit(100000)", "+sys.setrecursionlimit(2000000000)" ]
false
0.036359
0.072909
0.498689
[ "s382061997", "s362652948" ]
u745087332
p03150
python
s874167253
s836445306
29
19
3,064
3,064
Accepted
Accepted
34.48
# coding:utf-8 import sys # from collections import Counter, defaultdict INF = float('inf') MOD = 10 ** 9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def I(): return int(sys.stdin.readline()) def SS(): return eval(input()) S = SS()...
# coding:utf-8 import sys # from collections import Counter, defaultdict INF = float('inf') MOD = 10 ** 9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def II(): return int(sys.stdin.readline()) def SI(): return eval(input()) S = SI(...
41
24
878
495
# coding:utf-8 import sys # from collections import Counter, defaultdict INF = float("inf") MOD = 10**9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def I(): return int(sys.stdin.readline()) def SS(): return eval(input()) S ...
# coding:utf-8 import sys # from collections import Counter, defaultdict INF = float("inf") MOD = 10**9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def II(): return int(sys.stdin.readline()) def SI(): return eval(input()) S...
false
41.463415
[ "-def I():", "+def II():", "-def SS():", "+def SI():", "-S = SS()", "-key = \"keyence\"", "-n = 0", "-j = 0", "-for l in range(-1, len(S)):", "+S = SI()", "+for l in range(len(S)):", "- n = 0", "- j = 0", "- # print(l, r)", "- for i in range(len(S)):", "- ...
false
0.065989
0.08079
0.8168
[ "s874167253", "s836445306" ]
u379559362
p03816
python
s716493048
s367683041
157
64
18,656
14,396
Accepted
Accepted
59.24
from collections import Counter n = int(eval(input())) a = list(map(int, input().split())) cnt = Counter() for i in range(n): cnt[a[i]] += 1 for a in cnt: cnt[a] %= 2 z_o = list(cnt.values()) if list(z_o).count(0) % 2 == 0: print((len(cnt))) else: print((len(cnt) - 1))
n = int(eval(input())) a = list(map(int, input().split())) a_set = set(a) if len(a_set) % 2 == 0: print((len(a_set) - 1)) else: print((len(a_set)))
16
8
288
154
from collections import Counter n = int(eval(input())) a = list(map(int, input().split())) cnt = Counter() for i in range(n): cnt[a[i]] += 1 for a in cnt: cnt[a] %= 2 z_o = list(cnt.values()) if list(z_o).count(0) % 2 == 0: print((len(cnt))) else: print((len(cnt) - 1))
n = int(eval(input())) a = list(map(int, input().split())) a_set = set(a) if len(a_set) % 2 == 0: print((len(a_set) - 1)) else: print((len(a_set)))
false
50
[ "-from collections import Counter", "-", "-cnt = Counter()", "-for i in range(n):", "- cnt[a[i]] += 1", "-for a in cnt:", "- cnt[a] %= 2", "-z_o = list(cnt.values())", "-if list(z_o).count(0) % 2 == 0:", "- print((len(cnt)))", "+a_set = set(a)", "+if len(a_set) % 2 == 0:", "+ pri...
false
0.115908
0.047997
2.414893
[ "s716493048", "s367683041" ]
u102461423
p02567
python
s862782934
s563452333
821
716
140,720
140,664
Accepted
Accepted
12.79
import sys import numpy as np import numba from numba import njit, b1, i4, i8, f8 read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines @njit((numba.types.optional(i8), ) * 2, cache=True) def seg_f(x, y): if x is None: return y if y is No...
import sys import numpy as np import numba from numba import njit, b1, i4, i8, f8 read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines @njit((numba.types.optional(i8), ) * 2, cache=True) def seg_f(x, y): if x is None: return y if y is No...
88
109
2,009
2,671
import sys import numpy as np import numba from numba import njit, b1, i4, i8, f8 read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines @njit((numba.types.optional(i8),) * 2, cache=True) def seg_f(x, y): if x is None: return y if y is None: r...
import sys import numpy as np import numba from numba import njit, b1, i4, i8, f8 read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines @njit((numba.types.optional(i8),) * 2, cache=True) def seg_f(x, y): if x is None: return y if y is None: r...
false
19.266055
[ "- \"\"\"とりあえず愚直\"\"\"", "+ \"\"\"[l,r) が ok であるような最大の r を返す\"\"\"", "- def is_ok(v, x):", "- return v >= x", "+ def is_ok(v):", "+ return v < x", "- ng, ok = l, N + 1", "- while ng + 1 < ok:", "- mid = (ok + ng) // 2", "- if is_ok(fold(seg, l, mid), x...
false
0.629253
0.424795
1.481312
[ "s862782934", "s563452333" ]
u153665391
p02260
python
s332606660
s013308705
30
20
7,720
5,600
Accepted
Accepted
33.33
n = int(eval(input())) a = list(map(int, input().split())) count = 0 for i in range( n ): mini = i for j in range( i, n ): if a[j] < a[mini]: mini = j if mini != i: count += 1 t = a[i] a[i] = a[mini] a[mini] = t print(( *a )) print( cou...
N = int(eval(input())) A = list(map(int, input().split())) if __name__ == "__main__": cnt = 0 for i in range(N): tmp_idx = i for j in range(i+1, N): if A[tmp_idx] > A[j]: tmp_idx = j if tmp_idx != i: A[i], A[tmp_idx] = A[tmp_idx], A[i] ...
18
16
316
388
n = int(eval(input())) a = list(map(int, input().split())) count = 0 for i in range(n): mini = i for j in range(i, n): if a[j] < a[mini]: mini = j if mini != i: count += 1 t = a[i] a[i] = a[mini] a[mini] = t print((*a)) print(count)
N = int(eval(input())) A = list(map(int, input().split())) if __name__ == "__main__": cnt = 0 for i in range(N): tmp_idx = i for j in range(i + 1, N): if A[tmp_idx] > A[j]: tmp_idx = j if tmp_idx != i: A[i], A[tmp_idx] = A[tmp_idx], A[i] ...
false
11.111111
[ "-n = int(eval(input()))", "-a = list(map(int, input().split()))", "-count = 0", "-for i in range(n):", "- mini = i", "- for j in range(i, n):", "- if a[j] < a[mini]:", "- mini = j", "- if mini != i:", "- count += 1", "- t = a[i]", "- a[i] = a[mi...
false
0.043006
0.043123
0.997275
[ "s332606660", "s013308705" ]
u395202850
p03415
python
s715215809
s829918077
172
17
38,384
2,940
Accepted
Accepted
90.12
c = [eval(input()) for _ in range(3)] print((c[0][0] + c[1][1] + c[2][2]))
c = [input()[_] for _ in range(3)] print(("".join(c)))
2
2
68
53
c = [eval(input()) for _ in range(3)] print((c[0][0] + c[1][1] + c[2][2]))
c = [input()[_] for _ in range(3)] print(("".join(c)))
false
0
[ "-c = [eval(input()) for _ in range(3)]", "-print((c[0][0] + c[1][1] + c[2][2]))", "+c = [input()[_] for _ in range(3)]", "+print((\"\".join(c)))" ]
false
0.046864
0.038886
1.205147
[ "s715215809", "s829918077" ]
u798803522
p02361
python
s722328742
s211634895
3,800
2,310
140,500
113,976
Accepted
Accepted
39.21
from collections import defaultdict import heapq vertice,edge,source = list(map(int,input().split(" "))) link = defaultdict(dict) weight = defaultdict(dict) answer = [-1] * vertice for e in range(edge): i,j,w = list(map(int,input().split(" "))) link[i] = link.get(i,set()) | {j} weight[i].update({...
import sys from heapq import heappush, heappop readline = sys.stdin.readline from collections import defaultdict vertices, edges, start = list(map(int, readline().split())) connect = defaultdict(list) cost = defaultdict(dict) answer = ["INF" for n in range(vertices)] for _ in range(edges): s, t, w = list(m...
29
30
790
772
from collections import defaultdict import heapq vertice, edge, source = list(map(int, input().split(" "))) link = defaultdict(dict) weight = defaultdict(dict) answer = [-1] * vertice for e in range(edge): i, j, w = list(map(int, input().split(" "))) link[i] = link.get(i, set()) | {j} weight[i].update({j: ...
import sys from heapq import heappush, heappop readline = sys.stdin.readline from collections import defaultdict vertices, edges, start = list(map(int, readline().split())) connect = defaultdict(list) cost = defaultdict(dict) answer = ["INF" for n in range(vertices)] for _ in range(edges): s, t, w = list(map(int,...
false
3.333333
[ "+import sys", "+from heapq import heappush, heappop", "+", "+readline = sys.stdin.readline", "-import heapq", "-vertice, edge, source = list(map(int, input().split(\" \")))", "-link = defaultdict(dict)", "-weight = defaultdict(dict)", "-answer = [-1] * vertice", "-for e in range(edge):", "- ...
false
0.039662
0.040218
0.986178
[ "s722328742", "s211634895" ]
u832039789
p02898
python
s684625304
s085384527
61
50
11,916
11,908
Accepted
Accepted
18.03
n,k = list(map(int,input().split())) a = list(map(int,input().split())) res = 0 for i in a: res += int(i >= k) print(res)
n,k = list(map(int,input().split())) a = list(map(int,input().split())) print((sum(i >= k for i in a)))
6
3
124
98
n, k = list(map(int, input().split())) a = list(map(int, input().split())) res = 0 for i in a: res += int(i >= k) print(res)
n, k = list(map(int, input().split())) a = list(map(int, input().split())) print((sum(i >= k for i in a)))
false
50
[ "-res = 0", "-for i in a:", "- res += int(i >= k)", "-print(res)", "+print((sum(i >= k for i in a)))" ]
false
0.04651
0.041607
1.117836
[ "s684625304", "s085384527" ]
u227082700
p02999
python
s406075005
s852538356
21
17
3,316
2,940
Accepted
Accepted
19.05
x,a=list(map(int,input().split())) print(((x>=a)*10))
x,a=list(map(int,input().split())) if x<a:print((0)) else:print((10))
2
3
47
61
x, a = list(map(int, input().split())) print(((x >= a) * 10))
x, a = list(map(int, input().split())) if x < a: print((0)) else: print((10))
false
33.333333
[ "-print(((x >= a) * 10))", "+if x < a:", "+ print((0))", "+else:", "+ print((10))" ]
false
0.042668
0.036044
1.183781
[ "s406075005", "s852538356" ]
u489959379
p02787
python
s286481790
s552782651
470
390
54,364
46,116
Accepted
Accepted
17.02
h, n = list(map(int, input().split())) f_inf = float("inf") dp = [f_inf] * (h + 1) dp[0] = 0 for i in range(n): a, b = list(map(int, input().split())) for j in range(h): next_j = min(j + a, h) dp[next_j] = min(dp[next_j], dp[j] + b) print((dp[h]))
import sys sys.setrecursionlimit(10 ** 7) f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): h, n = list(map(int, input().split())) AB = [list(map(int, input().split())) for _ in range(n)] dp = [f_inf] * (h + 1) dp[0] = 0 for a, b in AB: for i in range(1, h + 1): ...
12
22
270
429
h, n = list(map(int, input().split())) f_inf = float("inf") dp = [f_inf] * (h + 1) dp[0] = 0 for i in range(n): a, b = list(map(int, input().split())) for j in range(h): next_j = min(j + a, h) dp[next_j] = min(dp[next_j], dp[j] + b) print((dp[h]))
import sys sys.setrecursionlimit(10**7) f_inf = float("inf") mod = 10**9 + 7 def resolve(): h, n = list(map(int, input().split())) AB = [list(map(int, input().split())) for _ in range(n)] dp = [f_inf] * (h + 1) dp[0] = 0 for a, b in AB: for i in range(1, h + 1): dp[i] = min(dp...
false
45.454545
[ "-h, n = list(map(int, input().split()))", "+import sys", "+", "+sys.setrecursionlimit(10**7)", "-dp = [f_inf] * (h + 1)", "-dp[0] = 0", "-for i in range(n):", "- a, b = list(map(int, input().split()))", "- for j in range(h):", "- next_j = min(j + a, h)", "- dp[next_j] = min(...
false
0.428795
0.158546
2.70455
[ "s286481790", "s552782651" ]
u226155577
p03648
python
s874914903
s468818009
16
10
2,692
2,692
Accepted
Accepted
37.5
b=eval(input());a=b/50+49;b%=50;c=50-b;print("50\n"+(repr(a-b)+" ")*c+(repr(a+c)+" ")*b)
b=eval(input());a=b/50+49;b%=50;c=50-b;print(50,(repr(a-b)+" ")*c+(repr(a+c)+" ")*b)
1
1
72
69
b = eval(input()) a = b / 50 + 49 b %= 50 c = 50 - b print("50\n" + (repr(a - b) + " ") * c + (repr(a + c) + " ") * b)
b = eval(input()) a = b / 50 + 49 b %= 50 c = 50 - b print(50, (repr(a - b) + " ") * c + (repr(a + c) + " ") * b)
false
0
[ "-print(\"50\\n\" + (repr(a - b) + \" \") * c + (repr(a + c) + \" \") * b)", "+print(50, (repr(a - b) + \" \") * c + (repr(a + c) + \" \") * b)" ]
false
0.041251
0.042131
0.9791
[ "s874914903", "s468818009" ]
u494058663
p03087
python
s506918535
s591833224
870
482
8,436
12,336
Accepted
Accepted
44.6
N, Q = list(map(int,input().split())) S = list(eval(input())) S.append(0) par = [0]*(N+1)#par[0]は無視 Ans = [] for i in range(N): par [i+1]=par[i]+(1 if (S[i]=='A') & (S[i+1]=='C') else 0) for i in range(Q): x,y = list(map(int,input().split())) print((par[y-1]-par[x-1]))
n,q = list(map(int,input().split())) s = eval(input()) s += ' ' ruiseki = [] i = 0 while i<n: if s[i]+s[i+1]=='AC': ruiseki.append('') ruiseki.append('AC') i= i+1 else: ruiseki.append(s[i]) i+=1 t = [0] * (n+1) for i in range(n): if ruiseki[i] == 'AC': ...
11
22
293
441
N, Q = list(map(int, input().split())) S = list(eval(input())) S.append(0) par = [0] * (N + 1) # par[0]は無視 Ans = [] for i in range(N): par[i + 1] = par[i] + (1 if (S[i] == "A") & (S[i + 1] == "C") else 0) for i in range(Q): x, y = list(map(int, input().split())) print((par[y - 1] - par[x - 1]))
n, q = list(map(int, input().split())) s = eval(input()) s += " " ruiseki = [] i = 0 while i < n: if s[i] + s[i + 1] == "AC": ruiseki.append("") ruiseki.append("AC") i = i + 1 else: ruiseki.append(s[i]) i += 1 t = [0] * (n + 1) for i in range(n): if ruiseki[i] == "AC": ...
false
50
[ "-N, Q = list(map(int, input().split()))", "-S = list(eval(input()))", "-S.append(0)", "-par = [0] * (N + 1) # par[0]は無視", "-Ans = []", "-for i in range(N):", "- par[i + 1] = par[i] + (1 if (S[i] == \"A\") & (S[i + 1] == \"C\") else 0)", "-for i in range(Q):", "- x, y = list(map(int, input()....
false
0.03574
0.035408
1.009366
[ "s506918535", "s591833224" ]
u745087332
p03363
python
s561947177
s004899597
213
149
41,696
41,720
Accepted
Accepted
30.05
# coding:utf-8 import sys from collections import Counter input = sys.stdin.readline INF = float('inf') def inpl(): return list(map(int, input().split())) N = int(eval(input())) A = inpl() S = [0] for i in range(N): S.append(S[-1] + A[i]) cnt_num = Counter(S) ans = 0 for num in list(c...
# coding:utf-8 import sys from collections import Counter, defaultdict INF = float('inf') MOD = 10 ** 9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def II(): return in...
29
32
430
607
# coding:utf-8 import sys from collections import Counter input = sys.stdin.readline INF = float("inf") def inpl(): return list(map(int, input().split())) N = int(eval(input())) A = inpl() S = [0] for i in range(N): S.append(S[-1] + A[i]) cnt_num = Counter(S) ans = 0 for num in list(cnt_num.keys()): cn...
# coding:utf-8 import sys from collections import Counter, defaultdict INF = float("inf") MOD = 10**9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def II(): ...
false
9.375
[ "-from collections import Counter", "+from collections import Counter, defaultdict", "-input = sys.stdin.readline", "+MOD = 10**9 + 7", "-def inpl():", "- return list(map(int, input().split()))", "+def LI():", "+ return [int(x) for x in sys.stdin.readline().split()]", "-N = int(eval(input()))"...
false
0.0363
0.088684
0.409315
[ "s561947177", "s004899597" ]
u894934980
p03163
python
s973519194
s295235644
521
468
120,044
120,684
Accepted
Accepted
10.17
N, W = list(map(int, input().split(' '))) pair = [tuple(map(int, input().split(' '))) for _ in range(N)] dp = [[0]*(W+1) for _ in range(N+1)] for i in range(N): for sum_w in range(W+1): if sum_w >= pair[i][0]: dp[i+1][sum_w] = max(dp[i][sum_w], dp[i][sum_w-pair[i][0]] + pair[i][1]) ...
N, WW = list(map(int, input().split())) W = [0] * N V = [0] * N for i in range(N): w, v = list(map(int, input().split())) W[i] = w V[i] = v dp = [[0]*(WW+1) for _ in range(N+1)] for n in range(1, N+1): w = W[n-1] v = V[n-1] for sum_w in range(WW+1): if sum_w <= WW - w: ...
10
17
383
473
N, W = list(map(int, input().split(" "))) pair = [tuple(map(int, input().split(" "))) for _ in range(N)] dp = [[0] * (W + 1) for _ in range(N + 1)] for i in range(N): for sum_w in range(W + 1): if sum_w >= pair[i][0]: dp[i + 1][sum_w] = max(dp[i][sum_w], dp[i][sum_w - pair[i][0]] + pair[i][1]) ...
N, WW = list(map(int, input().split())) W = [0] * N V = [0] * N for i in range(N): w, v = list(map(int, input().split())) W[i] = w V[i] = v dp = [[0] * (WW + 1) for _ in range(N + 1)] for n in range(1, N + 1): w = W[n - 1] v = V[n - 1] for sum_w in range(WW + 1): if sum_w <= WW - w: ...
false
41.176471
[ "-N, W = list(map(int, input().split(\" \")))", "-pair = [tuple(map(int, input().split(\" \"))) for _ in range(N)]", "-dp = [[0] * (W + 1) for _ in range(N + 1)]", "+N, WW = list(map(int, input().split()))", "+W = [0] * N", "+V = [0] * N", "- for sum_w in range(W + 1):", "- if sum_w >= pair[...
false
0.046549
0.048918
0.951567
[ "s973519194", "s295235644" ]
u714300041
p03545
python
s821625661
s606196564
167
17
38,432
3,064
Accepted
Accepted
89.82
*ABCD, = list(map(int, list(eval(input())))) N = 3 op = [] for bit in range(0, 1<<N): tmp = [] for i in range(N): if (bit>>i) & 1: tmp.append("+") else: tmp.append("-") ans = ABCD[0] for i in range(N): if tmp[i] == "+": ans +...
import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) A, B, C, D = list(map(int, list(input()[:-1]))) n = 3 ops = [] for bit in range(0, 1<<n): op = ["-"]*n for j in range(n): if bit>>j & 1: op[j] = "+" ops.append(op) for op in ops: a, b, c, d = A, B...
26
38
505
670
(*ABCD,) = list(map(int, list(eval(input())))) N = 3 op = [] for bit in range(0, 1 << N): tmp = [] for i in range(N): if (bit >> i) & 1: tmp.append("+") else: tmp.append("-") ans = ABCD[0] for i in range(N): if tmp[i] == "+": ans += ABCD[i + 1]...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) A, B, C, D = list(map(int, list(input()[:-1]))) n = 3 ops = [] for bit in range(0, 1 << n): op = ["-"] * n for j in range(n): if bit >> j & 1: op[j] = "+" ops.append(op) for op in ops: a, b, c, d = A, B, C, D if ...
false
31.578947
[ "-(*ABCD,) = list(map(int, list(eval(input()))))", "-N = 3", "-op = []", "-for bit in range(0, 1 << N):", "- tmp = []", "- for i in range(N):", "- if (bit >> i) & 1:", "- tmp.append(\"+\")", "- else:", "- tmp.append(\"-\")", "- ans = ABCD[0]", "- ...
false
0.044756
0.007606
5.884536
[ "s821625661", "s606196564" ]
u620084012
p03379
python
s637573997
s758153704
701
433
42,272
93,652
Accepted
Accepted
38.23
N = int(eval(input())) X = list(map(int, input().split())) Y = [[X[k],k] for k in range(N)] Y.sort() A = [0 for k in range(N)] for k in range(N): if k >= N//2: A[Y[k][1]] = Y[N//2-1][0] else: A[Y[k][1]] = Y[N//2][0] for x in A: print(x)
N = int(eval(input())) X = list(map(int,input().split())) Y = sorted(X) M = (Y[N//2-1]+Y[N//2])/2 for x in X: if x < M: print((Y[N//2])) else: print((Y[N//2-1]))
14
9
273
183
N = int(eval(input())) X = list(map(int, input().split())) Y = [[X[k], k] for k in range(N)] Y.sort() A = [0 for k in range(N)] for k in range(N): if k >= N // 2: A[Y[k][1]] = Y[N // 2 - 1][0] else: A[Y[k][1]] = Y[N // 2][0] for x in A: print(x)
N = int(eval(input())) X = list(map(int, input().split())) Y = sorted(X) M = (Y[N // 2 - 1] + Y[N // 2]) / 2 for x in X: if x < M: print((Y[N // 2])) else: print((Y[N // 2 - 1]))
false
35.714286
[ "-Y = [[X[k], k] for k in range(N)]", "-Y.sort()", "-A = [0 for k in range(N)]", "-for k in range(N):", "- if k >= N // 2:", "- A[Y[k][1]] = Y[N // 2 - 1][0]", "+Y = sorted(X)", "+M = (Y[N // 2 - 1] + Y[N // 2]) / 2", "+for x in X:", "+ if x < M:", "+ print((Y[N // 2]))", "...
false
0.03894
0.040825
0.953816
[ "s637573997", "s758153704" ]
u924691798
p03148
python
s933923451
s118293592
409
311
19,308
19,748
Accepted
Accepted
23.96
import sys input = sys.stdin.readline N, K = list(map(int, input().split())) nums = [[] for i in range(N)] for i in range(N): t, d = list(map(int, input().split())) t -= 1 nums[t].append(d) maxs = [] rest = [] for i in range(N): if len(nums[i]) == 0: continue nums[i].sort(reverse=True)...
import sys input = sys.stdin.readline N, K = list(map(int, input().split())) nums = [] for i in range(N): t, d = list(map(int, input().split())) nums.append((d, t)) nums.sort(reverse=True) se = set() a1 = [] a2 = [] rest = [] for i, n in enumerate(nums): if i < K: if not n[1] in se: ...
42
37
904
785
import sys input = sys.stdin.readline N, K = list(map(int, input().split())) nums = [[] for i in range(N)] for i in range(N): t, d = list(map(int, input().split())) t -= 1 nums[t].append(d) maxs = [] rest = [] for i in range(N): if len(nums[i]) == 0: continue nums[i].sort(reverse=True) ...
import sys input = sys.stdin.readline N, K = list(map(int, input().split())) nums = [] for i in range(N): t, d = list(map(int, input().split())) nums.append((d, t)) nums.sort(reverse=True) se = set() a1 = [] a2 = [] rest = [] for i, n in enumerate(nums): if i < K: if not n[1] in se: se....
false
11.904762
[ "-nums = [[] for i in range(N)]", "+nums = []", "- t -= 1", "- nums[t].append(d)", "-maxs = []", "+ nums.append((d, t))", "+nums.sort(reverse=True)", "+se = set()", "+a1 = []", "+a2 = []", "-for i in range(N):", "- if len(nums[i]) == 0:", "+for i, n in enumerate(nums):", "+ ...
false
0.042181
0.042525
0.991899
[ "s933923451", "s118293592" ]
u066413086
p02889
python
s731312997
s842456337
1,260
569
95,652
52,376
Accepted
Accepted
54.84
INF = float('inf') def warshall_floyd(G): # ワーシャルフロイド法で移動距離を求める # G[x][y]: xからyへ直接移動するときの距離。直接移動できない場合はINF # cost = [g[:] for g in G] N = len(G) # cost[i][j]: 頂点v_iから頂点v_jへ到達するための辺コストの和 for k in range(N): for i in range(N): for j in range(N): ...
import numpy as np from scipy.sparse.csgraph import shortest_path from scipy.sparse.csgraph import floyd_warshall from scipy.sparse.csgraph import csgraph_from_dense INF = float('inf') def main(): N, M, L = map(int, input().split()) # G[x][y]: xからyへ直接移動するときのコスト。移動できない場合はINF G = [[INF] * (N+1) ...
53
44
1,426
1,271
INF = float("inf") def warshall_floyd(G): # ワーシャルフロイド法で移動距離を求める # G[x][y]: xからyへ直接移動するときの距離。直接移動できない場合はINF # cost = [g[:] for g in G] N = len(G) # cost[i][j]: 頂点v_iから頂点v_jへ到達するための辺コストの和 for k in range(N): for i in range(N): for j in range(N): if cost[i][...
import numpy as np from scipy.sparse.csgraph import shortest_path from scipy.sparse.csgraph import floyd_warshall from scipy.sparse.csgraph import csgraph_from_dense INF = float("inf") def main(): N, M, L = map(int, input().split()) # G[x][y]: xからyへ直接移動するときのコスト。移動できない場合はINF G = [[INF] * (N + 1) for n in ...
false
16.981132
[ "+import numpy as np", "+from scipy.sparse.csgraph import shortest_path", "+from scipy.sparse.csgraph import floyd_warshall", "+from scipy.sparse.csgraph import csgraph_from_dense", "+", "-", "-", "-def warshall_floyd(G):", "- # ワーシャルフロイド法で移動距離を求める", "- # G[x][y]: xからyへ直接移動するときの距離。直接移動できない場合...
false
0.070302
1.076789
0.065288
[ "s731312997", "s842456337" ]
u094191970
p03673
python
s037919572
s643863112
216
149
25,412
32,296
Accepted
Accepted
31.02
from collections import deque n=int(eval(input())) a=list(map(int,input().split())) ans=deque() if n%2==0: for i in range(n): if i%2==0: ans.append(a[i]) else: ans.appendleft(a[i]) else: for i in range(n): if i%2==0: ans.appendleft(a[i]) else: ans.append(a[...
from sys import stdin nii=lambda:list(map(int,stdin.readline().split())) lnii=lambda:list(map(int,stdin.readline().split())) from collections import deque n=int(eval(input())) a=lnii() ans=deque([]) for i in range(n): if i%2==0: ans.appendleft(a[i]) else: ans.append(a[i]) if n%2==0: ans...
20
19
332
337
from collections import deque n = int(eval(input())) a = list(map(int, input().split())) ans = deque() if n % 2 == 0: for i in range(n): if i % 2 == 0: ans.append(a[i]) else: ans.appendleft(a[i]) else: for i in range(n): if i % 2 == 0: ans.appendleft(...
from sys import stdin nii = lambda: list(map(int, stdin.readline().split())) lnii = lambda: list(map(int, stdin.readline().split())) from collections import deque n = int(eval(input())) a = lnii() ans = deque([]) for i in range(n): if i % 2 == 0: ans.appendleft(a[i]) else: ans.append(a[i]) if ...
false
5
[ "+from sys import stdin", "+", "+nii = lambda: list(map(int, stdin.readline().split()))", "+lnii = lambda: list(map(int, stdin.readline().split()))", "-a = list(map(int, input().split()))", "-ans = deque()", "+a = lnii()", "+ans = deque([])", "+for i in range(n):", "+ if i % 2 == 0:", "+ ...
false
0.039056
0.118286
0.330181
[ "s037919572", "s643863112" ]
u790710233
p03166
python
s962586932
s428278604
877
508
137,504
65,200
Accepted
Accepted
42.08
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) n, m = list(map(int, input().split())) edges = [[] for _ in range(n)] for _ in range(m): x, y = list([int(x)-1 for x in input().split()]) edges[x].append(y) def memoize(f): memo = dict() def memoized(*args): if a...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) n, m = list(map(int, input().split())) edges = [[] for _ in range(n)] for _ in range(m): x, y = list([int(x)-1 for x in input().split()]) edges[x].append(y) dist = [-1]*n def longest_path(v): if dist[v] != -1: return...
33
26
697
542
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) n, m = list(map(int, input().split())) edges = [[] for _ in range(n)] for _ in range(m): x, y = list([int(x) - 1 for x in input().split()]) edges[x].append(y) def memoize(f): memo = dict() def memoized(*args): if args in list...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) n, m = list(map(int, input().split())) edges = [[] for _ in range(n)] for _ in range(m): x, y = list([int(x) - 1 for x in input().split()]) edges[x].append(y) dist = [-1] * n def longest_path(v): if dist[v] != -1: return dist[v] ...
false
21.212121
[ "+dist = [-1] * n", "-def memoize(f):", "- memo = dict()", "-", "- def memoized(*args):", "- if args in list(memo.keys()):", "- return memo[args]", "- else:", "- memo[args] = f(*args)", "- return memo[args]", "-", "- return memoized", "...
false
0.044583
0.043186
1.032353
[ "s962586932", "s428278604" ]
u230621983
p04030
python
s201103236
s929536350
30
25
8,996
9,092
Accepted
Accepted
16.67
s = eval(input()) ans = '' for c in s: if c == '0': ans += '0' elif c == '1': ans += '1' else: ans = ans[:-1] print(ans)
s = eval(input()) ans = '' for c in s: if c == '0': ans += '0' elif c == '1': ans += '1' elif c == 'B' and ans: ans = ans[:-1] print(ans)
10
10
159
176
s = eval(input()) ans = "" for c in s: if c == "0": ans += "0" elif c == "1": ans += "1" else: ans = ans[:-1] print(ans)
s = eval(input()) ans = "" for c in s: if c == "0": ans += "0" elif c == "1": ans += "1" elif c == "B" and ans: ans = ans[:-1] print(ans)
false
0
[ "- else:", "+ elif c == \"B\" and ans:" ]
false
0.008074
0.041705
0.193606
[ "s201103236", "s929536350" ]
u628707847
p02718
python
s967789553
s893106837
11
10
2,568
2,568
Accepted
Accepted
9.09
n,m=list(map(int,input().split())) a=sorted(map(int,input().split())) print('No' if (4*m)*a[n-m]<sum(a) else 'Yes')
n,m=list(map(int,input().split())) a=sorted(map(int,input().split())) print('No' if 4*m*a[n-m]<sum(a) else 'Yes')
3
3
118
117
n, m = list(map(int, input().split())) a = sorted(map(int, input().split())) print("No" if (4 * m) * a[n - m] < sum(a) else "Yes")
n, m = list(map(int, input().split())) a = sorted(map(int, input().split())) print("No" if 4 * m * a[n - m] < sum(a) else "Yes")
false
0
[ "-print(\"No\" if (4 * m) * a[n - m] < sum(a) else \"Yes\")", "+print(\"No\" if 4 * m * a[n - m] < sum(a) else \"Yes\")" ]
false
0.040704
0.034655
1.174536
[ "s967789553", "s893106837" ]
u700805562
p03164
python
s014451779
s727270641
975
553
307,832
250,952
Accepted
Accepted
43.28
N, W = list(map(int, input().split())) w, v = [], [] for _ in range(N): w_, v_ = list(map(int, input().split())) w.append(w_) v.append(v_) V = sum(v) dp = [[float("INF")]*(V+1) for _ in range(N+1)] dp[0][0] = 0 for i in range(N): for j in range(V+1): if j >= v[i]: dp[i+1][j] = min(dp[...
N, W = list(map(int, input().split())) w_list, v_list = [], [] for _ in range(N): w, v = list(map(int, input().split())) w_list.append(w) v_list.append(v) sum_v = sum(v_list)+1 dp = [[float('INF')]*(sum_v) for _ in range(N+1)] dp[0][0] = 0 for i in range(N): w, v = w_list[i], v_list[i] ...
17
19
441
517
N, W = list(map(int, input().split())) w, v = [], [] for _ in range(N): w_, v_ = list(map(int, input().split())) w.append(w_) v.append(v_) V = sum(v) dp = [[float("INF")] * (V + 1) for _ in range(N + 1)] dp[0][0] = 0 for i in range(N): for j in range(V + 1): if j >= v[i]: dp[i + 1][j...
N, W = list(map(int, input().split())) w_list, v_list = [], [] for _ in range(N): w, v = list(map(int, input().split())) w_list.append(w) v_list.append(v) sum_v = sum(v_list) + 1 dp = [[float("INF")] * (sum_v) for _ in range(N + 1)] dp[0][0] = 0 for i in range(N): w, v = w_list[i], v_list[i] for j i...
false
10.526316
[ "-w, v = [], []", "+w_list, v_list = [], []", "- w_, v_ = list(map(int, input().split()))", "- w.append(w_)", "- v.append(v_)", "-V = sum(v)", "-dp = [[float(\"INF\")] * (V + 1) for _ in range(N + 1)]", "+ w, v = list(map(int, input().split()))", "+ w_list.append(w)", "+ v_list.a...
false
0.074845
0.047068
1.590131
[ "s014451779", "s727270641" ]
u687044304
p02703
python
s670697279
s570591677
805
714
27,944
27,864
Accepted
Accepted
11.3
# -*- coding:utf-8 -*- def solve(): import sys import heapq MAX_S = 50*50 N, M, S = list(map(int, sys.stdin.readline().split())) graph = [[] for _ in range(N)] for _ in range(M): u, v, a, b = list(map(int, sys.stdin.readline().split())) u, v = u-1, v-1 gra...
# -*- coding:utf-8 -*- def solve(): """解説実装""" import sys import heapq MAX_S = 50*50 N, M, S = list(map(int, sys.stdin.readline().split())) graph = [[] for _ in range(N)] for _ in range(M): u, v, a, b = list(map(int, sys.stdin.readline().split())) u, v = u-1, ...
61
58
1,649
1,462
# -*- coding:utf-8 -*- def solve(): import sys import heapq MAX_S = 50 * 50 N, M, S = list(map(int, sys.stdin.readline().split())) graph = [[] for _ in range(N)] for _ in range(M): u, v, a, b = list(map(int, sys.stdin.readline().split())) u, v = u - 1, v - 1 graph[u].app...
# -*- coding:utf-8 -*- def solve(): """解説実装""" import sys import heapq MAX_S = 50 * 50 N, M, S = list(map(int, sys.stdin.readline().split())) graph = [[] for _ in range(N)] for _ in range(M): u, v, a, b = list(map(int, sys.stdin.readline().split())) u, v = u - 1, v - 1 ...
false
4.918033
[ "+ \"\"\"解説実装\"\"\"", "- # heapq.heappush(que, (0, s, 0)) # (頂点番号v, 所持金s, 時刻t)", "- # v, s, t = heapq.heappop(que)", "- # heapq.heappush(que, (v, ns, t+d))", "- # heapq.heappush(que, (u, s-a, t+b))" ]
false
0.101389
0.177493
0.571227
[ "s670697279", "s570591677" ]
u761320129
p03326
python
s822797775
s810160167
297
31
44,784
3,284
Accepted
Accepted
89.56
N,M = list(map(int,input().split())) src = [tuple(map(int,input().split())) for i in range(N)] if M==0: print((0)) exit() def dp(type): minimize_x = type&1 minimize_y = (type>>1)&1 minimize_z = (type>>2)&1 dp = [0] for i,(x,y,z) in enumerate(src): if minimize_x: x *= -...
import itertools N,M = list(map(int,input().split())) src = [tuple(map(int,input().split())) for i in range(N)] if M==0: print((0)) exit() ans = 0 for ptn in itertools.product([1,-1],repeat=3): results = [] for row in src: results.append(sum([m*a for m,a in zip(ptn,row)])) ans...
26
15
600
362
N, M = list(map(int, input().split())) src = [tuple(map(int, input().split())) for i in range(N)] if M == 0: print((0)) exit() def dp(type): minimize_x = type & 1 minimize_y = (type >> 1) & 1 minimize_z = (type >> 2) & 1 dp = [0] for i, (x, y, z) in enumerate(src): if minimize_x: ...
import itertools N, M = list(map(int, input().split())) src = [tuple(map(int, input().split())) for i in range(N)] if M == 0: print((0)) exit() ans = 0 for ptn in itertools.product([1, -1], repeat=3): results = [] for row in src: results.append(sum([m * a for m, a in zip(ptn, row)])) ans = ...
false
42.307692
[ "+import itertools", "+", "-", "-", "-def dp(type):", "- minimize_x = type & 1", "- minimize_y = (type >> 1) & 1", "- minimize_z = (type >> 2) & 1", "- dp = [0]", "- for i, (x, y, z) in enumerate(src):", "- if minimize_x:", "- x *= -1", "- if minimize_...
false
0.042917
0.041812
1.026429
[ "s822797775", "s810160167" ]
u089230684
p02577
python
s912382981
s979570492
55
50
9,324
10,592
Accepted
Accepted
9.09
def solve(s): suma = 0 for x in s: suma += int(x) if suma % 9 == 0: return True return False s = eval(input()) x = solve(s) if x == True: print("Yes") else: print("No")
x= eval(input()) reslut = sum(list(map(int,x))) if reslut%9 == 0 : print("Yes") else: print('No')
12
6
190
104
def solve(s): suma = 0 for x in s: suma += int(x) if suma % 9 == 0: return True return False s = eval(input()) x = solve(s) if x == True: print("Yes") else: print("No")
x = eval(input()) reslut = sum(list(map(int, x))) if reslut % 9 == 0: print("Yes") else: print("No")
false
50
[ "-def solve(s):", "- suma = 0", "- for x in s:", "- suma += int(x)", "- if suma % 9 == 0:", "- return True", "- return False", "-", "-", "-s = eval(input())", "-x = solve(s)", "-if x == True:", "+x = eval(input())", "+reslut = sum(list(map(int, x)))", "+if reslu...
false
0.047402
0.100508
0.471619
[ "s912382981", "s979570492" ]
u129315407
p03102
python
s007607962
s539518363
24
17
3,064
3,060
Accepted
Accepted
29.17
N, M, C = list(map(int, input().split())) Bi = list(map(int, input().split())) count = 0 for i in range(N): Ai = list(map(int, input().split())) t = C for i in range(M): t += Ai[i] * Bi[i] if t > 0: count += 1 print(count)
N, M, C = list(map(int, input().split())) Bi = list(map(int, input().split())) Ai = [list(map(int, input().split())) for _ in range(N)] count = 0 for a in Ai: s = C for i in range(M): s += a[i] * Bi[i] if s > 0: count += 1 print(count)
11
12
258
269
N, M, C = list(map(int, input().split())) Bi = list(map(int, input().split())) count = 0 for i in range(N): Ai = list(map(int, input().split())) t = C for i in range(M): t += Ai[i] * Bi[i] if t > 0: count += 1 print(count)
N, M, C = list(map(int, input().split())) Bi = list(map(int, input().split())) Ai = [list(map(int, input().split())) for _ in range(N)] count = 0 for a in Ai: s = C for i in range(M): s += a[i] * Bi[i] if s > 0: count += 1 print(count)
false
8.333333
[ "+Ai = [list(map(int, input().split())) for _ in range(N)]", "-for i in range(N):", "- Ai = list(map(int, input().split()))", "- t = C", "+for a in Ai:", "+ s = C", "- t += Ai[i] * Bi[i]", "- if t > 0:", "+ s += a[i] * Bi[i]", "+ if s > 0:" ]
false
0.036175
0.081169
0.445675
[ "s007607962", "s539518363" ]
u600402037
p03379
python
s480069028
s200221538
305
209
25,472
31,764
Accepted
Accepted
31.48
N = int(eval(input())) X = list(map(int, input().split())) X2 = sorted(X) left = X2[(N//2)-1] right = X2[N//2] for i in range(N): print((left if X[i] > left else right))
# coding: utf-8 import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N = ir() A = lr() sorted_A = sorted(A) mid = N // 2 - 1 left = sorted_A[mid] right = sorted_A[mid+1] answer = [left if a > left else right for a in A] print(('\n'.join(m...
7
15
171
337
N = int(eval(input())) X = list(map(int, input().split())) X2 = sorted(X) left = X2[(N // 2) - 1] right = X2[N // 2] for i in range(N): print((left if X[i] > left else right))
# coding: utf-8 import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N = ir() A = lr() sorted_A = sorted(A) mid = N // 2 - 1 left = sorted_A[mid] right = sorted_A[mid + 1] answer = [left if a > left else right for a in A] print(("\n".join(map(str, answe...
false
53.333333
[ "-N = int(eval(input()))", "-X = list(map(int, input().split()))", "-X2 = sorted(X)", "-left = X2[(N // 2) - 1]", "-right = X2[N // 2]", "-for i in range(N):", "- print((left if X[i] > left else right))", "+# coding: utf-8", "+import sys", "+", "+sr = lambda: sys.stdin.readline().rstrip()", ...
false
0.038788
0.047832
0.810931
[ "s480069028", "s200221538" ]
u185896732
p03775
python
s392463233
s088758765
30
27
3,060
3,060
Accepted
Accepted
10
from math import sqrt n=int(eval(input())) ans=[] k=int(sqrt(n)) for i in range(1,k+1): if n%i==0: ans.append(len(str(int(n/i)))) ans.sort() print((ans[0]))
def c(num): cnt=0 while num>0: num//=10 cnt+=1 return cnt def main(): n=int(eval(input())) ans=10**10 for i in range(1,int(n**0.5)+1): if n%i!=0: continue b=n//i ret=max(c(i),c(b)) if ans>ret: ans=ret p...
9
20
168
333
from math import sqrt n = int(eval(input())) ans = [] k = int(sqrt(n)) for i in range(1, k + 1): if n % i == 0: ans.append(len(str(int(n / i)))) ans.sort() print((ans[0]))
def c(num): cnt = 0 while num > 0: num //= 10 cnt += 1 return cnt def main(): n = int(eval(input())) ans = 10**10 for i in range(1, int(n**0.5) + 1): if n % i != 0: continue b = n // i ret = max(c(i), c(b)) if ans > ret: a...
false
55
[ "-from math import sqrt", "+def c(num):", "+ cnt = 0", "+ while num > 0:", "+ num //= 10", "+ cnt += 1", "+ return cnt", "-n = int(eval(input()))", "-ans = []", "-k = int(sqrt(n))", "-for i in range(1, k + 1):", "- if n % i == 0:", "- ans.append(len(str(int(n...
false
0.038777
0.04018
0.965087
[ "s392463233", "s088758765" ]
u888092736
p03208
python
s459540020
s498012324
117
98
14,092
14,092
Accepted
Accepted
16.24
N, K, *h = list(map(int, open(0).read().split())) h = sorted(list(h)) ans = float("inf") for i in range(N - K + 1): ans = min(ans, h[i + K - 1] - h[i]) print(ans)
N, K, *h = list(map(int, open(0).read().split())) h = sorted(list(h)) print((min(h[i + K - 1] - h[i] for i in range(N - K + 1))))
6
3
166
124
N, K, *h = list(map(int, open(0).read().split())) h = sorted(list(h)) ans = float("inf") for i in range(N - K + 1): ans = min(ans, h[i + K - 1] - h[i]) print(ans)
N, K, *h = list(map(int, open(0).read().split())) h = sorted(list(h)) print((min(h[i + K - 1] - h[i] for i in range(N - K + 1))))
false
50
[ "-ans = float(\"inf\")", "-for i in range(N - K + 1):", "- ans = min(ans, h[i + K - 1] - h[i])", "-print(ans)", "+print((min(h[i + K - 1] - h[i] for i in range(N - K + 1))))" ]
false
0.035675
0.042436
0.840679
[ "s459540020", "s498012324" ]
u021548497
p03112
python
s892301432
s012707005
1,403
899
20,140
12,800
Accepted
Accepted
35.92
import sys def main(): input = sys.stdin.readline a, b, q = list(map(int, input().split())) s = [0]*a for i in range(a): s[i] = int(eval(input())) t = [0]*b for i in range(b): t[i] = int(eval(input())) s_near = [0]*a k = 0 for i in range(a): if k == b-1: s_near[...
import sys import bisect def main(): input = sys.stdin.readline inf = pow(10, 18) a, b, q = list(map(int, input().split())) s = [-inf]+[int(eval(input())) for _ in range(a)]+[inf] t = [-inf]+[int(eval(input())) for _ in range(b)]+[inf] for _ in range(q): x = int(eval(input())) i = bi...
86
24
1,749
595
import sys def main(): input = sys.stdin.readline a, b, q = list(map(int, input().split())) s = [0] * a for i in range(a): s[i] = int(eval(input())) t = [0] * b for i in range(b): t[i] = int(eval(input())) s_near = [0] * a k = 0 for i in range(a): if k == b ...
import sys import bisect def main(): input = sys.stdin.readline inf = pow(10, 18) a, b, q = list(map(int, input().split())) s = [-inf] + [int(eval(input())) for _ in range(a)] + [inf] t = [-inf] + [int(eval(input())) for _ in range(b)] + [inf] for _ in range(q): x = int(eval(input())) ...
false
72.093023
[ "+import bisect", "+ inf = pow(10, 18)", "- s = [0] * a", "- for i in range(a):", "- s[i] = int(eval(input()))", "- t = [0] * b", "- for i in range(b):", "- t[i] = int(eval(input()))", "- s_near = [0] * a", "- k = 0", "- for i in range(a):", "- if k...
false
0.084912
0.079137
1.072972
[ "s892301432", "s012707005" ]
u562935282
p03426
python
s215972929
s516378056
355
301
27,352
23,672
Accepted
Accepted
15.21
def main(): import sys input = sys.stdin.readline H, W, D = map(int, input().split()) A = [[int(x) for x in input().split()] for _ in range(H)] B = [[] for _ in range(D)] C = [None] * (H * W) for r, row in enumerate(A): for c, cell in enumerate(row): C[cell...
def main(): import sys input = sys.stdin.readline H, W, D = map(int, input().split()) A = [[int(x) for x in input().split()] for _ in range(H)] B = [0] * (H * W) C = [None] * (H * W) for r, row in enumerate(A): for c, cell in enumerate(row): C[cell - 1] = r...
39
31
877
701
def main(): import sys input = sys.stdin.readline H, W, D = map(int, input().split()) A = [[int(x) for x in input().split()] for _ in range(H)] B = [[] for _ in range(D)] C = [None] * (H * W) for r, row in enumerate(A): for c, cell in enumerate(row): C[cell - 1] = r, c ...
def main(): import sys input = sys.stdin.readline H, W, D = map(int, input().split()) A = [[int(x) for x in input().split()] for _ in range(H)] B = [0] * (H * W) C = [None] * (H * W) for r, row in enumerate(A): for c, cell in enumerate(row): C[cell - 1] = r, c for x ...
false
20.512821
[ "- B = [[] for _ in range(D)]", "+ B = [0] * (H * W)", "- for x in range(H * W):", "- r = x % D", "- if B[r]:", "- cr, cc = C[x]", "- pr, pc = C[x - D]", "- cost = abs(cr - pr) + abs(cc - pc)", "- B[r].append(B[r][-1] + cost)", "- ...
false
0.03669
0.085765
0.4278
[ "s215972929", "s516378056" ]
u188827677
p02730
python
s474401507
s700330375
19
17
3,064
3,064
Accepted
Accepted
10.53
s = eval(input()) if s != s[::-1]: print("No") exit() if s[:(len(s)-1)//2] != s[:(len(s)-1)//2][::-1]: print("No") exit() if s[(len(s)+3)//2-1:] != s[(len(s)+3)//2-1:][::-1]: print("No") exit() print("Yes")
s = eval(input()) if s != s[::-1]: print("No") exit() x = s[:((len(s)-1)//2)] if x != x[::-1]: print("No") exit() y = s[((len(s)+3)//2-1):] if y != y[::-1]: print("No") exit() print("Yes")
13
17
228
218
s = eval(input()) if s != s[::-1]: print("No") exit() if s[: (len(s) - 1) // 2] != s[: (len(s) - 1) // 2][::-1]: print("No") exit() if s[(len(s) + 3) // 2 - 1 :] != s[(len(s) + 3) // 2 - 1 :][::-1]: print("No") exit() print("Yes")
s = eval(input()) if s != s[::-1]: print("No") exit() x = s[: ((len(s) - 1) // 2)] if x != x[::-1]: print("No") exit() y = s[((len(s) + 3) // 2 - 1) :] if y != y[::-1]: print("No") exit() print("Yes")
false
23.529412
[ "-if s[: (len(s) - 1) // 2] != s[: (len(s) - 1) // 2][::-1]:", "+x = s[: ((len(s) - 1) // 2)]", "+if x != x[::-1]:", "-if s[(len(s) + 3) // 2 - 1 :] != s[(len(s) + 3) // 2 - 1 :][::-1]:", "+y = s[((len(s) + 3) // 2 - 1) :]", "+if y != y[::-1]:" ]
false
0.064762
0.037035
1.74864
[ "s474401507", "s700330375" ]
u329706129
p03315
python
s503776707
s909308683
19
17
3,060
2,940
Accepted
Accepted
10.53
print((-4+2*input().count('+')))
print((2*input().count('+')-4))
1
1
31
30
print((-4 + 2 * input().count("+")))
print((2 * input().count("+") - 4))
false
0
[ "-print((-4 + 2 * input().count(\"+\")))", "+print((2 * input().count(\"+\") - 4))" ]
false
0.034992
0.038222
0.91551
[ "s503776707", "s909308683" ]
u186838327
p04034
python
s132742403
s989980357
353
319
4,596
75,888
Accepted
Accepted
9.63
n, m = list(map(int, input().split())) C = [1]*n X = [0]*n X[0] = 1 for i in range(m): x, y = list(map(int, input().split())) x, y = x-1, y-1 if X[x] == 1: C[x] -= 1 C[y] += 1 X[y] = 1 if C[x] == 0: X[x] = 0 else: C[x] -= 1 C[y] ...
n, m = list(map(int, input().split())) X = [0]*n C = [1]*n X[0] = 1 for i in range(m): x, y = list(map(int, input().split())) x, y = x-1, y-1 if X[x] == 1: X[y] = 1 if C[x] == 1: X[x] = 0 C[x] -= 1 C[y] += 1 else: C[x] -= 1 C...
19
21
350
345
n, m = list(map(int, input().split())) C = [1] * n X = [0] * n X[0] = 1 for i in range(m): x, y = list(map(int, input().split())) x, y = x - 1, y - 1 if X[x] == 1: C[x] -= 1 C[y] += 1 X[y] = 1 if C[x] == 0: X[x] = 0 else: C[x] -= 1 C[y] += 1 # ...
n, m = list(map(int, input().split())) X = [0] * n C = [1] * n X[0] = 1 for i in range(m): x, y = list(map(int, input().split())) x, y = x - 1, y - 1 if X[x] == 1: X[y] = 1 if C[x] == 1: X[x] = 0 C[x] -= 1 C[y] += 1 else: C[x] -= 1 C[y] += 1 an...
false
9.52381
[ "+X = [0] * n", "-X = [0] * n", "+ X[y] = 1", "+ if C[x] == 1:", "+ X[x] = 0", "- X[y] = 1", "- if C[x] == 0:", "- X[x] = 0", "-# print(C)", "-# print(X)", "-print((sum(X)))", "+ans = sum(X)", "+print(ans)" ]
false
0.036264
0.065916
0.55016
[ "s132742403", "s989980357" ]
u707500405
p03476
python
s454899565
s787105376
1,322
868
5,108
8,948
Accepted
Accepted
34.34
class BIT(): def __init__(self, N): self.bit = [0] * (N + 1) self.N = N def add(self, a, w): x = a while x <= self.N: self.bit[x] += w x += x & (- x) def sum(self, a): ret = 0 x = a while x > 0: ret += self.bit[x] x -= x & (- x) return ret MAX_N = 10 ** 5 SQRT_MN ...
MAX_N = 10 ** 5 SQRT_MN = 318 isp = [1] * (MAX_N + 1) p_list = [] isp[0] = isp[1] = 0 for i in range(2, SQRT_MN + 1): if isp[i] == 0: continue p_list.append(i) for prod in range(2, MAX_N // i + 1): isp[i * prod] = 0 like_num = [0] * (MAX_N + 1) for p in range(3, MAX_N + 1): if isp[p] and isp[(p +...
41
22
743
497
class BIT: def __init__(self, N): self.bit = [0] * (N + 1) self.N = N def add(self, a, w): x = a while x <= self.N: self.bit[x] += w x += x & (-x) def sum(self, a): ret = 0 x = a while x > 0: ret += self.bit[x] ...
MAX_N = 10**5 SQRT_MN = 318 isp = [1] * (MAX_N + 1) p_list = [] isp[0] = isp[1] = 0 for i in range(2, SQRT_MN + 1): if isp[i] == 0: continue p_list.append(i) for prod in range(2, MAX_N // i + 1): isp[i * prod] = 0 like_num = [0] * (MAX_N + 1) for p in range(3, MAX_N + 1): if isp[p] and i...
false
46.341463
[ "-class BIT:", "- def __init__(self, N):", "- self.bit = [0] * (N + 1)", "- self.N = N", "-", "- def add(self, a, w):", "- x = a", "- while x <= self.N:", "- self.bit[x] += w", "- x += x & (-x)", "-", "- def sum(self, a):", "- ...
false
0.098866
0.333903
0.296091
[ "s454899565", "s787105376" ]
u903005414
p03611
python
s345137084
s578860168
182
118
23,380
14,564
Accepted
Accepted
35.16
import numpy as np N = int(eval(input())) A = np.array(list(map(int, input().split()))) counter = np.append(0, np.bincount(A, minlength=10**5 + 10)) # print(counter) cumsum = counter.cumsum() # print(cumsum) # print((cumsum[3:] - cumsum[:-3])) print(((cumsum[3:] - cumsum[:-3]).max()))
from collections import Counter N = int(eval(input())) A = list(map(int, input().split())) c = Counter(A) # print('C', c) ans = 0 for key in list(c.keys()): v = c[key] v += c.get(key - 1, 0) v += c.get(key + 1, 0) ans = max(ans, v) print(ans)
9
15
286
264
import numpy as np N = int(eval(input())) A = np.array(list(map(int, input().split()))) counter = np.append(0, np.bincount(A, minlength=10**5 + 10)) # print(counter) cumsum = counter.cumsum() # print(cumsum) # print((cumsum[3:] - cumsum[:-3])) print(((cumsum[3:] - cumsum[:-3]).max()))
from collections import Counter N = int(eval(input())) A = list(map(int, input().split())) c = Counter(A) # print('C', c) ans = 0 for key in list(c.keys()): v = c[key] v += c.get(key - 1, 0) v += c.get(key + 1, 0) ans = max(ans, v) print(ans)
false
40
[ "-import numpy as np", "+from collections import Counter", "-A = np.array(list(map(int, input().split())))", "-counter = np.append(0, np.bincount(A, minlength=10**5 + 10))", "-# print(counter)", "-cumsum = counter.cumsum()", "-# print(cumsum)", "-# print((cumsum[3:] - cumsum[:-3]))", "-print(((cumsu...
false
0.185785
0.00693
26.810096
[ "s345137084", "s578860168" ]
u857759499
p03338
python
s537179545
s761352389
21
18
3,060
2,940
Accepted
Accepted
14.29
n = int(eval(input())) s = list(eval(input())) ans = 0 for i in range(1,n): c = 0 for j in set(s[:i]): if j in set(s[i:]): c += 1 ans = max(ans,c) print(ans)
n = int(eval(input())) s = list(eval(input())) print((max([len(set(s[:i])&set(s[i:])) for i in range(1,n)])))
10
3
182
97
n = int(eval(input())) s = list(eval(input())) ans = 0 for i in range(1, n): c = 0 for j in set(s[:i]): if j in set(s[i:]): c += 1 ans = max(ans, c) print(ans)
n = int(eval(input())) s = list(eval(input())) print((max([len(set(s[:i]) & set(s[i:])) for i in range(1, n)])))
false
70
[ "-ans = 0", "-for i in range(1, n):", "- c = 0", "- for j in set(s[:i]):", "- if j in set(s[i:]):", "- c += 1", "- ans = max(ans, c)", "-print(ans)", "+print((max([len(set(s[:i]) & set(s[i:])) for i in range(1, n)])))" ]
false
0.048297
0.03675
1.314221
[ "s537179545", "s761352389" ]
u987164499
p03078
python
s087349514
s604384872
993
575
156,012
3,828
Accepted
Accepted
42.09
x,y,z,k = list(map(int,input().split())) a = list(map(int,input().split())) b = list(map(int,input().split())) c = list(map(int,input().split())) li = [] for i in a: for j in b: li.append(i+j) li.sort(reverse=True) li = li[:k] lin = [] for i in li: for j in c: lin.append(...
import heapq x,y,z,k = list(map(int,input().split())) a = list(map(int,input().split())) b = list(map(int,input().split())) c = list(map(int,input().split())) a.sort(reverse=True) b.sort(reverse=True) c.sort(reverse=True) li = [(-(a[0]+b[0]+c[0]),0,0,0)] heapq.heapify(li) for i in range(k): ans...
24
24
385
907
x, y, z, k = list(map(int, input().split())) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(int, input().split())) li = [] for i in a: for j in b: li.append(i + j) li.sort(reverse=True) li = li[:k] lin = [] for i in li: for j in c: lin.append(i + j) lin.sort...
import heapq x, y, z, k = list(map(int, input().split())) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(int, input().split())) a.sort(reverse=True) b.sort(reverse=True) c.sort(reverse=True) li = [(-(a[0] + b[0] + c[0]), 0, 0, 0)] heapq.heapify(li) for i in range(k): ans = hea...
false
0
[ "+import heapq", "+", "-li = []", "-for i in a:", "- for j in b:", "- li.append(i + j)", "-li.sort(reverse=True)", "-li = li[:k]", "-lin = []", "-for i in li:", "- for j in c:", "- lin.append(i + j)", "-lin.sort(reverse=True)", "+a.sort(reverse=True)", "+b.sort(revers...
false
0.059604
0.103417
0.576343
[ "s087349514", "s604384872" ]
u903629757
p02612
python
s586604424
s756688144
32
24
9,060
9,080
Accepted
Accepted
25
N = int(eval(input())) B = N//1000 if N <= 1000: print((1000-N)) elif N%1000 == 0: print((0)) elif N > 1000: print((((B+1)*1000)-N))
N = int(eval(input())) if 1000 > N: print((1000 - N)) elif (N//1000)*1000 == N: print((0)) elif N > 1000: print(((((N//1000)+1)*1000)-N))
8
7
143
149
N = int(eval(input())) B = N // 1000 if N <= 1000: print((1000 - N)) elif N % 1000 == 0: print((0)) elif N > 1000: print((((B + 1) * 1000) - N))
N = int(eval(input())) if 1000 > N: print((1000 - N)) elif (N // 1000) * 1000 == N: print((0)) elif N > 1000: print(((((N // 1000) + 1) * 1000) - N))
false
12.5
[ "-B = N // 1000", "-if N <= 1000:", "+if 1000 > N:", "-elif N % 1000 == 0:", "+elif (N // 1000) * 1000 == N:", "- print((((B + 1) * 1000) - N))", "+ print(((((N // 1000) + 1) * 1000) - N))" ]
false
0.037894
0.03847
0.985025
[ "s586604424", "s756688144" ]
u906501980
p02901
python
s443560301
s480990456
916
262
3,188
46,168
Accepted
Accepted
71.4
def main(): n, m = list(map(int, input().split())) p = 2**n inf = 10**7 dp = [inf]*p dp[0] = 0 for _ in range(m): a, _ = list(map(int, input().split())) c = sum([1<<(int(i)-1) for i in input().split()]) def k(s): if dp[s|c] > dp[s] + a: ...
def main(): n, m = list(map(int, input().split())) p = 2**n inf = 10**7 dp = [inf]*p dp[0] = 0 for _ in range(m): a, _ = list(map(int, input().split())) c = sum([1<<(int(i)-1) for i in input().split()]) for s in range(p): if dp[s|c] > dp[s] + a: ...
20
19
479
462
def main(): n, m = list(map(int, input().split())) p = 2**n inf = 10**7 dp = [inf] * p dp[0] = 0 for _ in range(m): a, _ = list(map(int, input().split())) c = sum([1 << (int(i) - 1) for i in input().split()]) def k(s): if dp[s | c] > dp[s] + a: ...
def main(): n, m = list(map(int, input().split())) p = 2**n inf = 10**7 dp = [inf] * p dp[0] = 0 for _ in range(m): a, _ = list(map(int, input().split())) c = sum([1 << (int(i) - 1) for i in input().split()]) for s in range(p): if dp[s | c] > dp[s] + a: ...
false
5
[ "-", "- def k(s):", "+ for s in range(p):", "-", "- [k(s) for s in range(p)]" ]
false
0.035789
0.036866
0.970788
[ "s443560301", "s480990456" ]
u172147273
p02576
python
s323738364
s186671861
31
26
9,148
8,820
Accepted
Accepted
16.13
n,x,t=list(map(int,input().split())) print(((n+x-1)//x*t))
n,x,t=list(map(int,input().split())) if n%x==0:print((n//x*t)) else:print(((n//x+1)*t))
2
3
51
79
n, x, t = list(map(int, input().split())) print(((n + x - 1) // x * t))
n, x, t = list(map(int, input().split())) if n % x == 0: print((n // x * t)) else: print(((n // x + 1) * t))
false
33.333333
[ "-print(((n + x - 1) // x * t))", "+if n % x == 0:", "+ print((n // x * t))", "+else:", "+ print(((n // x + 1) * t))" ]
false
0.047285
0.041698
1.133979
[ "s323738364", "s186671861" ]
u388323466
p03221
python
s136064677
s309205389
1,091
822
35,604
42,032
Accepted
Accepted
24.66
n,m = list(map(int,input().split())) arr = [] for i in range(m): ls = list(map(int,input().split()))+[i] arr.append(ls) arr.sort(key=lambda x:x[1]) def st(a): b = list(str(a)) while len(b) <= 5: b.insert(0,'0') c= ''.join(b) return c dic = {} for j in range(m): if arr[j][0] in dic: dic...
n,m = list(map(int,input().split())) arr = [] for i in range(m): arr += [list(map(int,input().split())) + [i]] dic = {} for j in range(n+1): dic[j] = 1 arr.sort(key = lambda x : x[1]) for k in range(m): arr[k] += [dic[arr[k][0]]] dic[arr[k][0]] += 1 arr.sort(key = lambda x : x[2])...
31
22
531
404
n, m = list(map(int, input().split())) arr = [] for i in range(m): ls = list(map(int, input().split())) + [i] arr.append(ls) arr.sort(key=lambda x: x[1]) def st(a): b = list(str(a)) while len(b) <= 5: b.insert(0, "0") c = "".join(b) return c dic = {} for j in range(m): if arr[j][...
n, m = list(map(int, input().split())) arr = [] for i in range(m): arr += [list(map(int, input().split())) + [i]] dic = {} for j in range(n + 1): dic[j] = 1 arr.sort(key=lambda x: x[1]) for k in range(m): arr[k] += [dic[arr[k][0]]] dic[arr[k][0]] += 1 arr.sort(key=lambda x: x[2]) for v in range(m): ...
false
29.032258
[ "- ls = list(map(int, input().split())) + [i]", "- arr.append(ls)", "+ arr += [list(map(int, input().split())) + [i]]", "+dic = {}", "+for j in range(n + 1):", "+ dic[j] = 1", "-", "-", "-def st(a):", "- b = list(str(a))", "- while len(b) <= 5:", "- b.insert(0, \"0\")"...
false
0.047499
0.045191
1.051069
[ "s136064677", "s309205389" ]
u150984829
p00458
python
s943601364
s117873076
260
230
5,724
5,724
Accepted
Accepted
11.54
def s(): def b(M,x,y,n=1): M[x][y]=0;a=n if M[x-1][y]:a=max(a,b(M,x-1,y,n+1)) if M[x][y-1]:a=max(a,b(M,x,y-1,n+1)) if M[x+1][y]:a=max(a,b(M,x+1,y,n+1)) if M[x][y+1]:a=max(a,b(M,x,y+1,n+1)) M[x][y]=1 return a for e in iter(input,'0'): n,m=int(e),int(eval(input())) P=[[0]*(n+2)for _ in[0]*(...
def s(): def b(M,x,y,n=1): M[x][y]=0;a=n if M[x-1][y]: t=b(M,x-1,y,n+1) if a<t:a=t if M[x][y-1]: t=b(M,x,y-1,n+1) if a<t:a=t if M[x+1][y]: t=b(M,x+1,y,n+1) if a<t:a=t if M[x][y+1]: t=b(M,x,y+1,n+1) if a<t:a=t M[x][y]=1 return a for e in iter(input,'0'): n,m=in...
15
23
485
535
def s(): def b(M, x, y, n=1): M[x][y] = 0 a = n if M[x - 1][y]: a = max(a, b(M, x - 1, y, n + 1)) if M[x][y - 1]: a = max(a, b(M, x, y - 1, n + 1)) if M[x + 1][y]: a = max(a, b(M, x + 1, y, n + 1)) if M[x][y + 1]: a = ma...
def s(): def b(M, x, y, n=1): M[x][y] = 0 a = n if M[x - 1][y]: t = b(M, x - 1, y, n + 1) if a < t: a = t if M[x][y - 1]: t = b(M, x, y - 1, n + 1) if a < t: a = t if M[x + 1][y]: t = ...
false
34.782609
[ "- a = max(a, b(M, x - 1, y, n + 1))", "+ t = b(M, x - 1, y, n + 1)", "+ if a < t:", "+ a = t", "- a = max(a, b(M, x, y - 1, n + 1))", "+ t = b(M, x, y - 1, n + 1)", "+ if a < t:", "+ a = t", "- ...
false
0.046189
0.044752
1.03212
[ "s943601364", "s117873076" ]
u298297089
p03722
python
s328614621
s230844833
689
444
3,444
3,316
Accepted
Accepted
35.56
inf = float('INF') class edge: def __init__(self, source, destination, weight): self.from_ = source self.to_ = destination self.weight = weight def values(self): return self.from_, self.to_, self.weight def bellman_ford(edges, start, n): costs = [inf] * n ...
def bellman_ford(edges, start, n): inf = float('INF') costs = [inf] * n predecessors = [-1] * n costs[start]= 0 for _ in range(n-1): for e in edges: u,v,c = e if costs[v] > costs[u] + c: costs[v] = costs[u] + c predecessor...
38
27
956
673
inf = float("INF") class edge: def __init__(self, source, destination, weight): self.from_ = source self.to_ = destination self.weight = weight def values(self): return self.from_, self.to_, self.weight def bellman_ford(edges, start, n): costs = [inf] * n predecessor...
def bellman_ford(edges, start, n): inf = float("INF") costs = [inf] * n predecessors = [-1] * n costs[start] = 0 for _ in range(n - 1): for e in edges: u, v, c = e if costs[v] > costs[u] + c: costs[v] = costs[u] + c predecessors[v] = u ...
false
28.947368
[ "-inf = float(\"INF\")", "-", "-", "-class edge:", "- def __init__(self, source, destination, weight):", "- self.from_ = source", "- self.to_ = destination", "- self.weight = weight", "-", "- def values(self):", "- return self.from_, self.to_, self.weight", "-...
false
0.03737
0.036605
1.020898
[ "s328614621", "s230844833" ]
u794544096
p02860
python
s804676789
s088602067
166
66
38,384
61,840
Accepted
Accepted
60.24
n = int(eval(input())) s = eval(input()) if s[:(n//2)] == s[(n//2):]: print('Yes') else: print('No')
n = int(eval(input())) s = eval(input()) t = "" for i in range(n // 2): t += s[i] if s == (t + t): print('Yes') else: print('No')
8
10
105
143
n = int(eval(input())) s = eval(input()) if s[: (n // 2)] == s[(n // 2) :]: print("Yes") else: print("No")
n = int(eval(input())) s = eval(input()) t = "" for i in range(n // 2): t += s[i] if s == (t + t): print("Yes") else: print("No")
false
20
[ "-if s[: (n // 2)] == s[(n // 2) :]:", "+t = \"\"", "+for i in range(n // 2):", "+ t += s[i]", "+if s == (t + t):" ]
false
0.034347
0.033905
1.013035
[ "s804676789", "s088602067" ]
u312025627
p02727
python
s696076071
s592179643
598
301
87,500
72,016
Accepted
Accepted
49.67
def main(): import sys input = sys.stdin.buffer.readline X, Y, A, B, C = (int(i) for i in input().split()) P = [-int(i) for i in input().split()] Q = [-int(i) for i in input().split()] R = [-int(i) for i in input().split()] from heapq import heapify, heappop heapify(P) heapi...
def main(): import sys input = sys.stdin.buffer.readline X, Y, A, B, C = (int(i) for i in input().split()) P = [int(i) for i in input().split()] Q = [int(i) for i in input().split()] R = [int(i) for i in input().split()] P.sort(reverse=True) Q.sort(reverse=True) R.extend(P[:...
84
17
2,221
440
def main(): import sys input = sys.stdin.buffer.readline X, Y, A, B, C = (int(i) for i in input().split()) P = [-int(i) for i in input().split()] Q = [-int(i) for i in input().split()] R = [-int(i) for i in input().split()] from heapq import heapify, heappop heapify(P) heapify(Q) ...
def main(): import sys input = sys.stdin.buffer.readline X, Y, A, B, C = (int(i) for i in input().split()) P = [int(i) for i in input().split()] Q = [int(i) for i in input().split()] R = [int(i) for i in input().split()] P.sort(reverse=True) Q.sort(reverse=True) R.extend(P[:X]) ...
false
79.761905
[ "- P = [-int(i) for i in input().split()]", "- Q = [-int(i) for i in input().split()]", "- R = [-int(i) for i in input().split()]", "- from heapq import heapify, heappop", "-", "- heapify(P)", "- heapify(Q)", "- heapify(R)", "- eatP = 0", "- eatQ = 0", "- eatR = 0",...
false
0.059515
0.039592
1.503221
[ "s696076071", "s592179643" ]
u808427016
p03142
python
s333723336
s380001803
1,669
956
136,512
122,472
Accepted
Accepted
42.72
N, M = [int(_) for _ in input().split()] AB = [[int(_) for _ in input().split()] for i in range(N - 1 + M)] import sys sys.setrecursionlimit(200000) from collections import defaultdict vs = defaultdict(set) ws = defaultdict(set) for a, b in AB: vs[a].add(b) ws[b].add(a) #print(vs) #print(ws...
N, M = [int(_) for _ in input().split()] AB = [[int(_) for _ in input().split()] for i in range(N - 1 + M)] import sys sys.setrecursionlimit(100010) from collections import defaultdict vs = defaultdict(set) for a, b in AB: vs[b].add(a) cache = {} def calc(n): if n in cache: return...
50
31
815
673
N, M = [int(_) for _ in input().split()] AB = [[int(_) for _ in input().split()] for i in range(N - 1 + M)] import sys sys.setrecursionlimit(200000) from collections import defaultdict vs = defaultdict(set) ws = defaultdict(set) for a, b in AB: vs[a].add(b) ws[b].add(a) # print(vs) # print(ws) L = [] cs = [0]...
N, M = [int(_) for _ in input().split()] AB = [[int(_) for _ in input().split()] for i in range(N - 1 + M)] import sys sys.setrecursionlimit(100010) from collections import defaultdict vs = defaultdict(set) for a, b in AB: vs[b].add(a) cache = {} def calc(n): if n in cache: return cache[n] max_d...
false
38
[ "-sys.setrecursionlimit(200000)", "+sys.setrecursionlimit(100010)", "-ws = defaultdict(set)", "- vs[a].add(b)", "- ws[b].add(a)", "-# print(vs)", "-# print(ws)", "-L = []", "-cs = [0] * (1 + N)", "+ vs[b].add(a)", "+cache = {}", "-def visit(n):", "- if cs[n] == 1:", "- r...
false
0.038505
0.046022
0.836657
[ "s333723336", "s380001803" ]
u282228874
p03329
python
s300672187
s334285503
1,420
597
3,828
3,828
Accepted
Accepted
57.96
n = int(eval(input())) dp = [float("inf")]*(n+1) dp[0] = 0 for i in range(n): j = 0 while i+6**j <= n: dp[i+6**j] = min(dp[i+6**j],dp[i]+1) j += 1 k = 0 while i+9**k <= n: dp[i+9**k] = min(dp[i+9**k],dp[i]+1) k += 1 print((dp[n]))
n = int(eval(input())) dp = [10**9+7]*(n+1) dp[0] = 0 for i in range(1,n+1): dp[i] = dp[i-1] + 1 j = 6 while i-j >= 0: dp[i] = min(dp[i], dp[i-j]+1) j *= 6 k = 9 while i-k >= 0: dp[i] = min(dp[i], dp[i-k]+1) k *= 9 print((dp[n]))
13
14
246
286
n = int(eval(input())) dp = [float("inf")] * (n + 1) dp[0] = 0 for i in range(n): j = 0 while i + 6**j <= n: dp[i + 6**j] = min(dp[i + 6**j], dp[i] + 1) j += 1 k = 0 while i + 9**k <= n: dp[i + 9**k] = min(dp[i + 9**k], dp[i] + 1) k += 1 print((dp[n]))
n = int(eval(input())) dp = [10**9 + 7] * (n + 1) dp[0] = 0 for i in range(1, n + 1): dp[i] = dp[i - 1] + 1 j = 6 while i - j >= 0: dp[i] = min(dp[i], dp[i - j] + 1) j *= 6 k = 9 while i - k >= 0: dp[i] = min(dp[i], dp[i - k] + 1) k *= 9 print((dp[n]))
false
7.142857
[ "-dp = [float(\"inf\")] * (n + 1)", "+dp = [10**9 + 7] * (n + 1)", "-for i in range(n):", "- j = 0", "- while i + 6**j <= n:", "- dp[i + 6**j] = min(dp[i + 6**j], dp[i] + 1)", "- j += 1", "- k = 0", "- while i + 9**k <= n:", "- dp[i + 9**k] = min(dp[i + 9**k], dp[i...
false
0.17848
0.08338
2.140565
[ "s300672187", "s334285503" ]
u506858457
p02762
python
s535527986
s639571164
1,451
704
41,488
66,768
Accepted
Accepted
51.48
class UnionFind: def __init__(self, n): self.n = n self.parent = [i for i in range(n)] # 親 self.rank = [1] * n # 木の高さ self.size = [1] * n # size[i] は i を根とするグループのサイズ def find(self, x): # x の根を返す if self.parent[x] == x: return x else: ...
import sys from math import * from collections import deque, Counter, defaultdict from fractions import gcd input = lambda: sys.stdin.readline().rstrip() def eprint(s): sys.stderr.write('DEBUG: {}'.format(s)) return def main(): n, m, k = list(map(int, input().split())) fgraph = [list() for...
61
57
1,765
1,513
class UnionFind: def __init__(self, n): self.n = n self.parent = [i for i in range(n)] # 親 self.rank = [1] * n # 木の高さ self.size = [1] * n # size[i] は i を根とするグループのサイズ def find(self, x): # x の根を返す if self.parent[x] == x: return x else: s...
import sys from math import * from collections import deque, Counter, defaultdict from fractions import gcd input = lambda: sys.stdin.readline().rstrip() def eprint(s): sys.stderr.write("DEBUG: {}".format(s)) return def main(): n, m, k = list(map(int, input().split())) fgraph = [list() for i in ran...
false
6.557377
[ "-class UnionFind:", "- def __init__(self, n):", "- self.n = n", "- self.parent = [i for i in range(n)] # 親", "- self.rank = [1] * n # 木の高さ", "- self.size = [1] * n # size[i] は i を根とするグループのサイズ", "+import sys", "+from math import *", "+from collections import deque, ...
false
0.035608
0.037541
0.948498
[ "s535527986", "s639571164" ]
u127499732
p03608
python
s452778277
s266235653
320
246
83,324
83,588
Accepted
Accepted
23.12
def main(): from itertools import permutations n, m, r, *x = list(map(int, open(0).read().split())) to = x[:r] dis = [[0 if i == j else float("Inf") for j in range(n + 1)] for i in range(n + 1)] for a, b, c in zip(*[iter(x[r:])] * 3): dis[a][b] = c dis[b][a] = c f...
def main(): from itertools import permutations n, m, r, *x = list(map(int, open(0).read().split())) to = x[:r] dis = [[float("Inf")] * (n + 1) for _ in range(n + 1)] for i in range(1, n + 1): dis[i][i] = 0 for a, b, c in zip(*[iter(x[r:])] * 3): dis[a][b] = c ...
30
34
722
771
def main(): from itertools import permutations n, m, r, *x = list(map(int, open(0).read().split())) to = x[:r] dis = [[0 if i == j else float("Inf") for j in range(n + 1)] for i in range(n + 1)] for a, b, c in zip(*[iter(x[r:])] * 3): dis[a][b] = c dis[b][a] = c for k in range(1...
def main(): from itertools import permutations n, m, r, *x = list(map(int, open(0).read().split())) to = x[:r] dis = [[float("Inf")] * (n + 1) for _ in range(n + 1)] for i in range(1, n + 1): dis[i][i] = 0 for a, b, c in zip(*[iter(x[r:])] * 3): dis[a][b] = c dis[b][a] =...
false
11.764706
[ "- dis = [[0 if i == j else float(\"Inf\") for j in range(n + 1)] for i in range(n + 1)]", "+ dis = [[float(\"Inf\")] * (n + 1) for _ in range(n + 1)]", "+ for i in range(1, n + 1):", "+ dis[i][i] = 0", "- for nw, nx in zip(p, p[1:]):", "+ nw = p[0]", "+ for nx in p[...
false
0.040296
0.084675
0.475893
[ "s452778277", "s266235653" ]
u067105756
p02713
python
s662239468
s696023332
479
76
67,784
67,792
Accepted
Accepted
84.13
import math k = int(eval(input())) total = 0 for a in range(1,k+1): for b in range(1,k+1): for c in range(1,k+1): ab = math.gcd(a,b) total += math.gcd(ab, c) print(total)
from math import gcd k = int(eval(input())) total = 0 for i in range(1,k+1): for j in range(i+1,k+1): tmp = gcd(i,j) total += tmp * 6 for m in range(j+1,k+1): total += gcd(tmp,m) * 6 total += k*(k+1)//2 print(total)
9
14
209
266
import math k = int(eval(input())) total = 0 for a in range(1, k + 1): for b in range(1, k + 1): for c in range(1, k + 1): ab = math.gcd(a, b) total += math.gcd(ab, c) print(total)
from math import gcd k = int(eval(input())) total = 0 for i in range(1, k + 1): for j in range(i + 1, k + 1): tmp = gcd(i, j) total += tmp * 6 for m in range(j + 1, k + 1): total += gcd(tmp, m) * 6 total += k * (k + 1) // 2 print(total)
false
35.714286
[ "-import math", "+from math import gcd", "-for a in range(1, k + 1):", "- for b in range(1, k + 1):", "- for c in range(1, k + 1):", "- ab = math.gcd(a, b)", "- total += math.gcd(ab, c)", "+for i in range(1, k + 1):", "+ for j in range(i + 1, k + 1):", "+ ...
false
0.086178
0.062702
1.374413
[ "s662239468", "s696023332" ]
u941407962
p02807
python
s268624101
s937446562
370
233
140,360
69,672
Accepted
Accepted
37.03
N = int(eval(input())) Xs = list(map(int, input().split())) mod = 10**9 + 7 def mul(a, b): return ((a % mod) * (b % mod)) % mod NNN = (10**6) g1 = [1, 1] inverse = [0, 1] for i in range( 2, NNN + 1 ): g1.append( ( g1[-1] * i ) % mod ) inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod ) mxx...
N,*X=list(map(int,open(0).read().split())) M,g,q,r=10**9+7,1,[1,1],0 for i in range(1,N): r,g=(r+q[-1]*(X[-1]-X[i-1]))%M,g*i%M q+=[M//(-~i)*-q[M%(-~i)]%M] print((r*g%M))
18
6
433
168
N = int(eval(input())) Xs = list(map(int, input().split())) mod = 10**9 + 7 def mul(a, b): return ((a % mod) * (b % mod)) % mod NNN = 10**6 g1 = [1, 1] inverse = [0, 1] for i in range(2, NNN + 1): g1.append((g1[-1] * i) % mod) inverse.append((-inverse[mod % i] * (mod // i)) % mod) mxx = Xs[-1] r = 0 r2 ...
N, *X = list(map(int, open(0).read().split())) M, g, q, r = 10**9 + 7, 1, [1, 1], 0 for i in range(1, N): r, g = (r + q[-1] * (X[-1] - X[i - 1])) % M, g * i % M q += [M // (-~i) * -q[M % (-~i)] % M] print((r * g % M))
false
66.666667
[ "-N = int(eval(input()))", "-Xs = list(map(int, input().split()))", "-mod = 10**9 + 7", "-", "-", "-def mul(a, b):", "- return ((a % mod) * (b % mod)) % mod", "-", "-", "-NNN = 10**6", "-g1 = [1, 1]", "-inverse = [0, 1]", "-for i in range(2, NNN + 1):", "- g1.append((g1[-1] * i) % mo...
false
1.189596
0.038299
31.060685
[ "s268624101", "s937446562" ]
u588341295
p03128
python
s588777464
s087287092
534
177
144,876
30,196
Accepted
Accepted
66.85
# -*- coding: utf-8 -*- import sys, re from collections import deque, defaultdict, Counter from math import sqrt, hypot, factorial, pi, sin, cos, radians, log10 if sys.version_info.minor >= 5: from math import gcd else: from fractions import gcd from heapq import heappop, heappush, heapify, heappushpop from b...
# -*- coding: utf-8 -*- import sys 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(c)] for j in range(b)] for i in ...
50
55
1,810
1,268
# -*- coding: utf-8 -*- import sys, re from collections import deque, defaultdict, Counter from math import sqrt, hypot, factorial, pi, sin, cos, radians, log10 if sys.version_info.minor >= 5: from math import gcd else: from fractions import gcd from heapq import heappop, heappush, heapify, heappushpop from bi...
# -*- coding: utf-8 -*- import sys 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(c)] for j in rang...
false
9.090909
[ "-import sys, re", "-from collections import deque, defaultdict, Counter", "-from math import sqrt, hypot, factorial, pi, sin, cos, radians, log10", "-", "-if sys.version_info.minor >= 5:", "- from math import gcd", "-else:", "- from fractions import gcd", "-from heapq import heappop, heappush...
false
0.046605
0.087922
0.530071
[ "s588777464", "s087287092" ]
u561992253
p03011
python
s023981109
s787158765
338
164
22,160
38,256
Accepted
Accepted
51.48
import numpy as np words = lambda t : list(map(t, input().split())) pqr = words(int) pqr.sort() print((pqr[0] + pqr[1]))
#import numpy as np words = lambda t : list(map(t, input().split())) pqr = words(int) pqr.sort() print((pqr[0] + pqr[1]))
6
6
125
126
import numpy as np words = lambda t: list(map(t, input().split())) pqr = words(int) pqr.sort() print((pqr[0] + pqr[1]))
# import numpy as np words = lambda t: list(map(t, input().split())) pqr = words(int) pqr.sort() print((pqr[0] + pqr[1]))
false
0
[ "-import numpy as np", "-", "+# import numpy as np" ]
false
0.034933
0.04392
0.795371
[ "s023981109", "s787158765" ]
u580258754
p03107
python
s079780131
s170919785
854
45
4,860
3,956
Accepted
Accepted
94.73
from queue import * q = LifoQueue() S=eval(input()) count=0 for s in S: if q.empty(): q.put(s) else: q_1 = q.get() if q_1 != s: count+=2 else: q.put(q_1) q.put(s) print(count)
S = eval(input()) stack = [] ans = 0 for s in S: if not stack: stack.append(s) elif stack[-1] != s: stack.pop() ans += 2 else: stack.append(s) print(ans)
16
13
262
186
from queue import * q = LifoQueue() S = eval(input()) count = 0 for s in S: if q.empty(): q.put(s) else: q_1 = q.get() if q_1 != s: count += 2 else: q.put(q_1) q.put(s) print(count)
S = eval(input()) stack = [] ans = 0 for s in S: if not stack: stack.append(s) elif stack[-1] != s: stack.pop() ans += 2 else: stack.append(s) print(ans)
false
18.75
[ "-from queue import *", "-", "-q = LifoQueue()", "-count = 0", "+stack = []", "+ans = 0", "- if q.empty():", "- q.put(s)", "+ if not stack:", "+ stack.append(s)", "+ elif stack[-1] != s:", "+ stack.pop()", "+ ans += 2", "- q_1 = q.get()", "- ...
false
0.168614
0.036354
4.638115
[ "s079780131", "s170919785" ]
u554781254
p02713
python
s700335715
s646126970
1,270
133
9,580
68,488
Accepted
Accepted
89.53
import sys input = sys.stdin.readline from itertools import * from functools import * from collections import * from heapq import heapify, heappop, heappush, heappushpop from math import gcd INF = float('inf') NIL = - 1 N = int(eval(input())) ans = 0 for i in range(1, N + 1): if i == 1: a...
import sys input = sys.stdin.readline from itertools import * from functools import * from collections import * from heapq import heapify, heappop, heappush, heappushpop from math import gcd INF = float('inf') NIL = - 1 N = int(eval(input())) ans = 0 for i in range(1, N + 1): if i == 1: a...
28
34
548
691
import sys input = sys.stdin.readline from itertools import * from functools import * from collections import * from heapq import heapify, heappop, heappush, heappushpop from math import gcd INF = float("inf") NIL = -1 N = int(eval(input())) ans = 0 for i in range(1, N + 1): if i == 1: ans += N**2 ...
import sys input = sys.stdin.readline from itertools import * from functools import * from collections import * from heapq import heapify, heappop, heappush, heappushpop from math import gcd INF = float("inf") NIL = -1 N = int(eval(input())) ans = 0 for i in range(1, N + 1): if i == 1: ans += N**2 ...
false
17.647059
[ "+ if tmp == 1:", "+ ans += N", "+ continue", "+ if k == 1:", "+ ans += 1", "+ continue" ]
false
0.047595
0.25426
0.187188
[ "s700335715", "s646126970" ]
u312025627
p03546
python
s657361539
s478652314
281
206
17,360
14,092
Accepted
Accepted
26.69
def main(): import sys input = sys.stdin.buffer.readline H, W = (int(i) for i in input().split()) c = [[int(i) for i in input().split()] for j in range(10)] A = [[int(i) for i in input().split()] for j in range(H)] import numpy as np from scipy.sparse import csr_matrix from scipy...
def main(): import sys input = sys.stdin.buffer.readline H, W = (int(i) for i in input().split()) c = [[int(i) for i in input().split()] for j in range(10)] A = [[int(i) for i in input().split()] for j in range(H)] from scipy.sparse.csgraph import dijkstra from scipy.sparse import csr...
23
21
664
601
def main(): import sys input = sys.stdin.buffer.readline H, W = (int(i) for i in input().split()) c = [[int(i) for i in input().split()] for j in range(10)] A = [[int(i) for i in input().split()] for j in range(H)] import numpy as np from scipy.sparse import csr_matrix from scipy.sparse...
def main(): import sys input = sys.stdin.buffer.readline H, W = (int(i) for i in input().split()) c = [[int(i) for i in input().split()] for j in range(10)] A = [[int(i) for i in input().split()] for j in range(H)] from scipy.sparse.csgraph import dijkstra from scipy.sparse import csr_matri...
false
8.695652
[ "- import numpy as np", "+ from scipy.sparse.csgraph import dijkstra", "- from scipy.sparse.csgraph import dijkstra", "- csr = csr_matrix(c, dtype=np.int32)", "- ret = dijkstra(csr)", "+ d = dijkstra(csr_matrix(c))", "- if A[h][w] == -1:", "+ cur = A[h][w]", "...
false
0.622582
0.265792
2.342365
[ "s657361539", "s478652314" ]
u576917603
p03325
python
s720369518
s209476056
114
87
4,148
4,148
Accepted
Accepted
23.68
n=int(eval(input())) a=list(map(int,input().split())) ans=0 for i in a: while i%2==0: i/=2 ans+=1 print(ans)
n=int(eval(input())) a=list(map(int,input().split())) ans=0 for i in a: cnt=0 while i%2==0: i//=2 cnt+=1 ans+=cnt print(ans)
8
10
129
155
n = int(eval(input())) a = list(map(int, input().split())) ans = 0 for i in a: while i % 2 == 0: i /= 2 ans += 1 print(ans)
n = int(eval(input())) a = list(map(int, input().split())) ans = 0 for i in a: cnt = 0 while i % 2 == 0: i //= 2 cnt += 1 ans += cnt print(ans)
false
20
[ "+ cnt = 0", "- i /= 2", "- ans += 1", "+ i //= 2", "+ cnt += 1", "+ ans += cnt" ]
false
0.062229
0.063615
0.978224
[ "s720369518", "s209476056" ]
u141429472
p02836
python
s870471946
s704285066
84
45
6,300
5,920
Accepted
Accepted
46.43
import sys import math def resolve(): S=list(input().rstrip()) c=0 for i in range(math.floor(len(S)/2)): if(S[i]!=S[len(S)-i-1]): c+=1 print(c) from io import StringIO import unittest class TestClass(unittest.TestCase): def assertIO(self, input, output): ...
import sys import math def resolve(): S=input().rstrip() c=0 for i in range((len(S)//2)): if(S[i]!=S[-i-1]): c+=1 print(c) from io import StringIO import unittest class TestClass(unittest.TestCase): def assertIO(self, input, output): stdout, stdin = sys...
39
39
1,024
1,003
import sys import math def resolve(): S = list(input().rstrip()) c = 0 for i in range(math.floor(len(S) / 2)): if S[i] != S[len(S) - i - 1]: c += 1 print(c) from io import StringIO import unittest class TestClass(unittest.TestCase): def assertIO(self, input, output): ...
import sys import math def resolve(): S = input().rstrip() c = 0 for i in range((len(S) // 2)): if S[i] != S[-i - 1]: c += 1 print(c) from io import StringIO import unittest class TestClass(unittest.TestCase): def assertIO(self, input, output): stdout, stdin = sys.s...
false
0
[ "- S = list(input().rstrip())", "+ S = input().rstrip()", "- for i in range(math.floor(len(S) / 2)):", "- if S[i] != S[len(S) - i - 1]:", "+ for i in range((len(S) // 2)):", "+ if S[i] != S[-i - 1]:" ]
false
0.309726
0.557012
0.556049
[ "s870471946", "s704285066" ]
u057109575
p02629
python
s379310946
s449287473
70
63
61,936
61,584
Accepted
Accepted
10
N = int(eval(input())) cnt = [0] + [26 ** i for i in range(1, 11)] for i in range(10): cnt[i + 1] += cnt[i] ans = "" x = N - 1 for i in reversed(list(range(1, 11))): if x >= cnt[i]: v = (x - cnt[i]) // 26 ** i ans += chr(ord("a") + v) x -= (v + 1) * (26 ** i) ans += chr(...
x = int(eval(input())) ans = "" while x > 0: x -= 1 ans += chr(ord("a") + x % 26) x //= 26 print((ans[::-1]))
17
7
344
119
N = int(eval(input())) cnt = [0] + [26**i for i in range(1, 11)] for i in range(10): cnt[i + 1] += cnt[i] ans = "" x = N - 1 for i in reversed(list(range(1, 11))): if x >= cnt[i]: v = (x - cnt[i]) // 26**i ans += chr(ord("a") + v) x -= (v + 1) * (26**i) ans += chr(ord("a") + x % 26) prin...
x = int(eval(input())) ans = "" while x > 0: x -= 1 ans += chr(ord("a") + x % 26) x //= 26 print((ans[::-1]))
false
58.823529
[ "-N = int(eval(input()))", "-cnt = [0] + [26**i for i in range(1, 11)]", "-for i in range(10):", "- cnt[i + 1] += cnt[i]", "+x = int(eval(input()))", "-x = N - 1", "-for i in reversed(list(range(1, 11))):", "- if x >= cnt[i]:", "- v = (x - cnt[i]) // 26**i", "- ans += chr(ord(\...
false
0.036863
0.037561
0.981402
[ "s379310946", "s449287473" ]
u942230032
p03062
python
s330428687
s485347796
158
117
9,784
10,368
Accepted
Accepted
25.95
import math import re n = int(input()) a = input().split() cnt = 0 minus = 0 b = [] for i in a: a[cnt] = int(i) b.append(abs(int(i))) if a[cnt] < 0: minus += 1 cnt += 1 if minus % 2 != 0: mini = min(b) else: mini = 0 total = 0 for i in b: total += abs(i) ...
# coding:utf-8 import math def main(n,a): ...
28
31
366
1,862
import math import re n = int(input()) a = input().split() cnt = 0 minus = 0 b = [] for i in a: a[cnt] = int(i) b.append(abs(int(i))) if a[cnt] < 0: minus += 1 cnt += 1 if minus % 2 != 0: mini = min(b) else: mini = 0 total = 0 for i in b: total += abs(i) total -= 2 * abs(mini) print...
# coding:utf-8 import math def main(n, a): n = int(n) a = a.split() cnt = 0 minus = 0 b = [] for i in a: a[cnt] = int(i) b.append(abs(int(i))) if a[cnt] < 0: minus += 1 cnt += 1 if minus % 2 != 0: mini = min(b) else: mini = 0 ...
false
9.677419
[ "+# coding:utf-8", "-import re", "-n = int(input())", "-a = input().split()", "-cnt = 0", "-minus = 0", "-b = []", "-for i in a:", "- a[cnt] = int(i)", "- b.append(abs(int(i)))", "- if a[cnt] < 0:", "- minus += 1", "- cnt += 1", "-if minus % 2 != 0:", "- mini = min(...
false
0.035257
0.161942
0.217716
[ "s330428687", "s485347796" ]
u450956662
p03805
python
s733111574
s691226757
26
24
3,064
3,064
Accepted
Accepted
7.69
N, M = list(map(int, input().split())) E = [[] for _ in range(N)] for m in range(M): a, b = list(map(int, input().split())) a -= 1 b -= 1 E[a].append(b) E[b].append(a) check = [False] * N check[0] = True def dfs(v): if sum(check) == N: return 1 ans = 0 for u in E[...
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...
23
19
461
392
N, M = list(map(int, input().split())) E = [[] for _ in range(N)] for m in range(M): a, b = list(map(int, input().split())) a -= 1 b -= 1 E[a].append(b) E[b].append(a) check = [False] * N check[0] = True def dfs(v): if sum(check) == N: return 1 ans = 0 for u in E[v]: if...
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[...
false
17.391304
[ "+from itertools import permutations", "+", "-E = [[] for _ in range(N)]", "-for m in range(M):", "+E = [set() for _ in range(N)]", "+for _ in range(M):", "- a -= 1", "- b -= 1", "- E[a].append(b)", "- E[b].append(a)", "-check = [False] * N", "-check[0] = True", "-", "-", "-d...
false
0.072084
0.15029
0.479633
[ "s733111574", "s691226757" ]
u620084012
p03834
python
s795060444
s500790896
165
17
38,256
2,940
Accepted
Accepted
89.7
print((*input().split(",")))
print((input().replace(","," ")))
1
1
26
32
print((*input().split(",")))
print((input().replace(",", " ")))
false
0
[ "-print((*input().split(\",\")))", "+print((input().replace(\",\", \" \")))" ]
false
0.163878
0.045513
3.600688
[ "s795060444", "s500790896" ]