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
u588341295
p02852
python
s404248203
s557608397
224
139
50,800
6,408
Accepted
Accepted
37.95
# -*- 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 ...
# -*- 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 ...
39
43
1,009
1,088
# -*- 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...
# -*- 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.302326
[ "-", "-", "+# ๅœฐ็‚นaใ‹ใ‚‰่กŒใ‘ใ‚‹ๆœ€ๅคงไฝ็ฝฎใ‚’่ฟ”ใ™", "+ # ่กŒใ‘ใ‚‹ใจใ“ใ‚ใพใง่กŒใ", "+ # 1ๆญฉใ‚‚ๅ‹•ใ‘ใชใ‘ใ‚ŒใฐNG", "+# ้€†ใ‹ใ‚‰ใ‚„ใฃใŸใฎใงใ€ใ‚‚ใ†1ๅ›ž้€†้ †ใ—ใฆๅ‡บๅŠ›" ]
false
0.040801
0.04119
0.990536
[ "s404248203", "s557608397" ]
u470286613
p03317
python
s240192181
s954107142
41
18
13,812
4,724
Accepted
Accepted
56.1
import math N, K = list(map(int, input().split())) A_list = list(map(int, input().split())) print((math.ceil((N - 1) / (K - 1))))
N,K=list(map(int,input().split())) _=eval(input()) print(((N-2)//(K-1)+1))
6
3
128
62
import math N, K = list(map(int, input().split())) A_list = list(map(int, input().split())) print((math.ceil((N - 1) / (K - 1))))
N, K = list(map(int, input().split())) _ = eval(input()) print(((N - 2) // (K - 1) + 1))
false
50
[ "-import math", "-", "-A_list = list(map(int, input().split()))", "-print((math.ceil((N - 1) / (K - 1))))", "+_ = eval(input())", "+print(((N - 2) // (K - 1) + 1))" ]
false
0.043294
0.041225
1.050194
[ "s240192181", "s954107142" ]
u793868662
p02570
python
s792555066
s594746381
103
62
61,664
61,844
Accepted
Accepted
39.81
def resolve(): d, t, s = list(map(int, input().split())) if t >= d/s: print("Yes") else: print("No") resolve()
d, t, s = list(map(int, input().split())) if t < d/s: print("No") else: print("Yes")
7
5
138
86
def resolve(): d, t, s = list(map(int, input().split())) if t >= d / s: print("Yes") else: print("No") resolve()
d, t, s = list(map(int, input().split())) if t < d / s: print("No") else: print("Yes")
false
28.571429
[ "-def resolve():", "- d, t, s = list(map(int, input().split()))", "- if t >= d / s:", "- print(\"Yes\")", "- else:", "- print(\"No\")", "-", "-", "-resolve()", "+d, t, s = list(map(int, input().split()))", "+if t < d / s:", "+ print(\"No\")", "+else:", "+ print...
false
0.037115
0.044734
0.829663
[ "s792555066", "s594746381" ]
u638456847
p02727
python
s648300028
s675532960
358
244
23,272
23,200
Accepted
Accepted
31.84
from heapq import heapify, heappop import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines def main(): X,Y,A,B,C = list(map(int, readline().split())) p = [-int(i) for i in readline().split()] q = [-int(i) for i in readline().split()] r = [-int(i) for i i...
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines def main(): X,Y,A,B,C = list(map(int, readline().split())) p = [int(i) for i in readline().split()] q = [int(i) for i in readline().split()] r = [int(i) for i in readline().split()] p.sort() ...
28
24
577
490
from heapq import heapify, heappop import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines def main(): X, Y, A, B, C = list(map(int, readline().split())) p = [-int(i) for i in readline().split()] q = [-int(i) for i in readline().split()] r = [-int(i) for i in re...
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines def main(): X, Y, A, B, C = list(map(int, readline().split())) p = [int(i) for i in readline().split()] q = [int(i) for i in readline().split()] r = [int(i) for i in readline().split()] p.sort() q.s...
false
14.285714
[ "-from heapq import heapify, heappop", "- p = [-int(i) for i in readline().split()]", "- q = [-int(i) for i in readline().split()]", "- r = [-int(i) for i in readline().split()]", "- p = sorted(p)[:X]", "- q = sorted(q)[:Y]", "+ p = [int(i) for i in readline().split()]", "+ q = [i...
false
0.068604
0.007239
9.476517
[ "s648300028", "s675532960" ]
u088552457
p03673
python
s780755834
s696237066
175
114
34,372
26,608
Accepted
Accepted
34.86
n = int(eval(input())) a = list(map(int, input().split())) #b = [] #for ai in a: # b.append(str(ai)) # b = list(reversed(b)) #print(' '.join(b)) if len(a) % 2 == 0: even = [] odd = [] for i, ai in enumerate(a): if (i + 1) % 2 == 0: even.append(str(ai)) else: odd.append(str(ai))...
def main(): n = int(eval(input())) a = list(input_list_str()) index = n - 1 ans = [a[index]] is_add = False for i in range(n-1): if is_add: index += 2 else: index -= 2 if index < 0: index = 0 is_add = True ans.append(a[index]) if i...
30
48
620
879
n = int(eval(input())) a = list(map(int, input().split())) # b = [] # for ai in a: # b.append(str(ai)) # b = list(reversed(b)) # print(' '.join(b)) if len(a) % 2 == 0: even = [] odd = [] for i, ai in enumerate(a): if (i + 1) % 2 == 0: even.append(str(ai)) else: odd....
def main(): n = int(eval(input())) a = list(input_list_str()) index = n - 1 ans = [a[index]] is_add = False for i in range(n - 1): if is_add: index += 2 else: index -= 2 if index < 0: index = 0 is_add = True ans.appe...
false
37.5
[ "-n = int(eval(input()))", "-a = list(map(int, input().split()))", "-# b = []", "-# for ai in a:", "-# b.append(str(ai))", "-# b = list(reversed(b))", "-# print(' '.join(b))", "-if len(a) % 2 == 0:", "- even = []", "- odd = []", "- for i, ai in enumerate(a):", "- if (i + 1) %...
false
0.041816
0.048569
0.860966
[ "s780755834", "s696237066" ]
u025595730
p02898
python
s432096576
s589606469
177
67
20,888
11,908
Accepted
Accepted
62.15
# coding: utf-8 import numpy as np def main(): _, limit = list(map(int, input().split(' '))) heights = np.array(list(map(int, input().split(' ')))) print((np.count_nonzero(heights >= limit))) return 0 if __name__ == '__main__': main()
# coding: utf-8 def main(): n, limit = list(map(int, input().split(' '))) heights = list(map(int, input().split(' '))) heights = sorted(heights, reverse=True) nakama_count = 0 for height in heights: if height >= limit: nakama_count += 1 else: ...
16
23
277
416
# coding: utf-8 import numpy as np def main(): _, limit = list(map(int, input().split(" "))) heights = np.array(list(map(int, input().split(" ")))) print((np.count_nonzero(heights >= limit))) return 0 if __name__ == "__main__": main()
# coding: utf-8 def main(): n, limit = list(map(int, input().split(" "))) heights = list(map(int, input().split(" "))) heights = sorted(heights, reverse=True) nakama_count = 0 for height in heights: if height >= limit: nakama_count += 1 else: break print(n...
false
30.434783
[ "-import numpy as np", "-", "-", "- _, limit = list(map(int, input().split(\" \")))", "- heights = np.array(list(map(int, input().split(\" \"))))", "- print((np.count_nonzero(heights >= limit)))", "+ n, limit = list(map(int, input().split(\" \")))", "+ heights = list(map(int, input().sp...
false
0.211394
0.036886
5.73105
[ "s432096576", "s589606469" ]
u043048943
p03078
python
s547593095
s851383304
1,005
491
147,760
105,176
Accepted
Accepted
51.14
#coding:utf-8 import sys sys.setrecursionlimit(2**31-1) input = sys.stdin.readline write = sys.stdout.write LMIIS = lambda : list(map(int,input().split())) II = lambda : int(input()) dbg = lambda *something : print(*something) if DEBUG is True else 0 DEBUG = True def main(): X,Y,Z,K = LMIIS() A = L...
#coding:utf-8 import sys sys.setrecursionlimit(2**31-1) input = sys.stdin.readline write = sys.stdout.write LMIIS = lambda : list(map(int,input().split())) II = lambda : int(input()) dbg = lambda *something : print(*something) if DEBUG is True else 0 DEBUG = True def main(): X,Y,Z,K = LMIIS() A = L...
35
40
697
862
# coding:utf-8 import sys sys.setrecursionlimit(2**31 - 1) input = sys.stdin.readline write = sys.stdout.write LMIIS = lambda: list(map(int, input().split())) II = lambda: int(input()) dbg = lambda *something: print(*something) if DEBUG is True else 0 DEBUG = True def main(): X, Y, Z, K = LMIIS() A = LMIIS()...
# coding:utf-8 import sys sys.setrecursionlimit(2**31 - 1) input = sys.stdin.readline write = sys.stdout.write LMIIS = lambda: list(map(int, input().split())) II = lambda: int(input()) dbg = lambda *something: print(*something) if DEBUG is True else 0 DEBUG = True def main(): X, Y, Z, K = LMIIS() A = LMIIS()...
false
12.5
[ "- AB = []", "- for a in A:", "- for b in B:", "- AB.append(a + b)", "- AB.sort(reverse=True)", "- ABC = []", "- for ab in AB[:K]:", "- for c in C:", "- ABC.append(ab + c)", "- ABC.sort(reverse=True)", "+ A.sort(reverse=True)", "+ B.s...
false
0.04765
0.061578
0.773822
[ "s547593095", "s851383304" ]
u075012704
p02937
python
s346430775
s315516337
294
124
54,232
8,164
Accepted
Accepted
57.82
from collections import defaultdict from bisect import bisect_right S = eval(input()) T = eval(input()) s_set = set(list(S)) t_set = set(list(T)) if not t_set <= s_set: print((-1)) exit() s_position = defaultdict(list) for i, s in enumerate(S): s_position[s].append(i) now_position ...
from collections import defaultdict from bisect import bisect_right S = eval(input()) T = eval(input()) NS = len(S) # ๆง‹ๆˆไธๅฏ if set(list(T)) - set(list(S)): print((-1)) exit() # ๅ„ๆ–‡ๅญ—ใฎๅ‡บ็พๅ ดๆ‰€ใ‚’่จ˜้Œฒ D = defaultdict(list) for i, s in enumerate(S): D[s].append(i) ans = 0 marker = -1 for t in T: ...
35
33
689
660
from collections import defaultdict from bisect import bisect_right S = eval(input()) T = eval(input()) s_set = set(list(S)) t_set = set(list(T)) if not t_set <= s_set: print((-1)) exit() s_position = defaultdict(list) for i, s in enumerate(S): s_position[s].append(i) now_position = -1 t_position = [-1] * ...
from collections import defaultdict from bisect import bisect_right S = eval(input()) T = eval(input()) NS = len(S) # ๆง‹ๆˆไธๅฏ if set(list(T)) - set(list(S)): print((-1)) exit() # ๅ„ๆ–‡ๅญ—ใฎๅ‡บ็พๅ ดๆ‰€ใ‚’่จ˜้Œฒ D = defaultdict(list) for i, s in enumerate(S): D[s].append(i) ans = 0 marker = -1 for t in T: target_char_appeared...
false
5.714286
[ "-s_set = set(list(S))", "-t_set = set(list(T))", "-if not t_set <= s_set:", "+NS = len(S)", "+# ๆง‹ๆˆไธๅฏ", "+if set(list(T)) - set(list(S)):", "-s_position = defaultdict(list)", "+# ๅ„ๆ–‡ๅญ—ใฎๅ‡บ็พๅ ดๆ‰€ใ‚’่จ˜้Œฒ", "+D = defaultdict(list)", "- s_position[s].append(i)", "-now_position = -1", "-t_position = [-1] *...
false
0.042971
0.035482
1.211059
[ "s346430775", "s315516337" ]
u970449052
p02975
python
s311817807
s813195106
59
51
14,212
14,116
Accepted
Accepted
13.56
n=int(eval(input())) al=list(map(int,input().split())) t=0 for i in range(n): t^=al[i] if t==0: print('Yes') else: print('No')
n=int(eval(input())) al=list(map(int,input().split())) t=0 for a in al: t^=a print(('Yes' if t==0 else 'No'))
9
6
140
110
n = int(eval(input())) al = list(map(int, input().split())) t = 0 for i in range(n): t ^= al[i] if t == 0: print("Yes") else: print("No")
n = int(eval(input())) al = list(map(int, input().split())) t = 0 for a in al: t ^= a print(("Yes" if t == 0 else "No"))
false
33.333333
[ "-for i in range(n):", "- t ^= al[i]", "-if t == 0:", "- print(\"Yes\")", "-else:", "- print(\"No\")", "+for a in al:", "+ t ^= a", "+print((\"Yes\" if t == 0 else \"No\"))" ]
false
0.075089
0.07662
0.980026
[ "s311817807", "s813195106" ]
u144913062
p03546
python
s892537247
s633796510
205
185
41,564
40,284
Accepted
Accepted
9.76
import sys input = sys.stdin.readline def floyd_warshall(dist): v = len(dist) for k in range(v): for i in range(v): for j in range(v): dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]) H, W = list(map(int, input().split())) c = [list(map(int, input().split())...
import sys input = sys.stdin.readline def floyd_warshall(dist): v = len(dist) for k in range(v): for i in range(v): for j in range(v): dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]) H, W = list(map(int, input().split())) c = [list(map(int, input().split())...
20
20
516
537
import sys input = sys.stdin.readline def floyd_warshall(dist): v = len(dist) for k in range(v): for i in range(v): for j in range(v): dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]) H, W = list(map(int, input().split())) c = [list(map(int, input().split())) for _ ...
import sys input = sys.stdin.readline def floyd_warshall(dist): v = len(dist) for k in range(v): for i in range(v): for j in range(v): dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]) H, W = list(map(int, input().split())) c = [list(map(int, input().split())) for _ ...
false
0
[ "-for row in A:", "- for a in row:", "- if a != -1:", "- ans += c[a][1]", "+for i in range(H):", "+ for j in range(W):", "+ if A[i][j] != -1:", "+ ans += c[A[i][j]][1]" ]
false
0.035905
0.037818
0.949415
[ "s892537247", "s633796510" ]
u957167787
p03329
python
s343045321
s381273912
609
563
3,956
3,864
Accepted
Accepted
7.55
# ๅ‹•็š„่จˆ็”ปๆณ•(dp) # dp[N](ๆ•ฐๅˆ—)ใ‚’ๆฑ‚ใ‚ใŸใ„ใ€‚ # dp[0]ใ‹ใ‚‰dp[N-1]ใฏๆ—ข็Ÿฅ(ๆœ€ๅฐใจใชใ‚‹ใฃใฆใ„ใ‚‹)ใจใ™ใ‚‹ใ€‚ # dp[N] = (dp[N-1] + 1) , (dp[N-6] + 1) , ... , (dp[N-6^i] + 1) , (dp[N-9] + 1) , ... , (dp[N-9^j] + 1)ใฎไธญใ‹ใ‚‰ๆœ€ๅฐใฎใ‚‚ใฎใ‚’้ธในใฐ่‰ฏใ„ # ใƒ—ใƒญใ‚ฐใƒฉใƒ ไธŠใงใฏ0ใ‹ใ‚‰Nใพใงๅ›žใ—ใฆ1ใคใšใคๆœ€ๅฐๅŒ–ใ™ใ‚Œใฐ่‰ฏใ„ N = int(eval(input())) INF = 10**7 dp = [INF for _ in range(N+1)] # 0ใ‹ใ‚‰Nใพใง dp[0] = 0 # 0็•ช็›ฎไปฅๅค–ใฏๅคง...
N = int(eval(input())) dp = [10**9 for _ in range(N+1)] # 0ๅ††ใ‹ใ‚‰Nๅ††ใพใงใฎใƒชใ‚นใƒˆ dp[0] = 0 for i in range(1, N+1): # iๅ††ๆ‰•ใ†ๆœ€ๅฐๆ‰‹ๆ•ฐใ‚’ๅ…ฅใ‚Œใ‚‹ dp[i] = min(dp[i], dp[i-1] + 1) power_6 = 6 while i >= power_6: dp[i] = min(dp[i], dp[i-power_6] + 1) power_6 *= 6 power_9 = 9 while i >= power_9:...
50
20
1,104
411
# ๅ‹•็š„่จˆ็”ปๆณ•(dp) # dp[N](ๆ•ฐๅˆ—)ใ‚’ๆฑ‚ใ‚ใŸใ„ใ€‚ # dp[0]ใ‹ใ‚‰dp[N-1]ใฏๆ—ข็Ÿฅ(ๆœ€ๅฐใจใชใ‚‹ใฃใฆใ„ใ‚‹)ใจใ™ใ‚‹ใ€‚ # dp[N] = (dp[N-1] + 1) , (dp[N-6] + 1) , ... , (dp[N-6^i] + 1) , (dp[N-9] + 1) , ... , (dp[N-9^j] + 1)ใฎไธญใ‹ใ‚‰ๆœ€ๅฐใฎใ‚‚ใฎใ‚’้ธในใฐ่‰ฏใ„ # ใƒ—ใƒญใ‚ฐใƒฉใƒ ไธŠใงใฏ0ใ‹ใ‚‰Nใพใงๅ›žใ—ใฆ1ใคใšใคๆœ€ๅฐๅŒ–ใ™ใ‚Œใฐ่‰ฏใ„ N = int(eval(input())) INF = 10**7 dp = [INF for _ in range(N + 1)] # 0ใ‹ใ‚‰Nใพใง dp[0] = 0 # 0็•ช็›ฎไปฅๅค–ใฏๅคงใใ„ๅ€คใซๅˆๆœŸ...
N = int(eval(input())) dp = [10**9 for _ in range(N + 1)] # 0ๅ††ใ‹ใ‚‰Nๅ††ใพใงใฎใƒชใ‚นใƒˆ dp[0] = 0 for i in range(1, N + 1): # iๅ††ๆ‰•ใ†ๆœ€ๅฐๆ‰‹ๆ•ฐใ‚’ๅ…ฅใ‚Œใ‚‹ dp[i] = min(dp[i], dp[i - 1] + 1) power_6 = 6 while i >= power_6: dp[i] = min(dp[i], dp[i - power_6] + 1) power_6 *= 6 power_9 = 9 while i >= power_9: ...
false
60
[ "-# ๅ‹•็š„่จˆ็”ปๆณ•(dp)", "-# dp[N](ๆ•ฐๅˆ—)ใ‚’ๆฑ‚ใ‚ใŸใ„ใ€‚", "-# dp[0]ใ‹ใ‚‰dp[N-1]ใฏๆ—ข็Ÿฅ(ๆœ€ๅฐใจใชใ‚‹ใฃใฆใ„ใ‚‹)ใจใ™ใ‚‹ใ€‚", "-# dp[N] = (dp[N-1] + 1) , (dp[N-6] + 1) , ... , (dp[N-6^i] + 1) , (dp[N-9] + 1) , ... , (dp[N-9^j] + 1)ใฎไธญใ‹ใ‚‰ๆœ€ๅฐใฎใ‚‚ใฎใ‚’้ธในใฐ่‰ฏใ„", "-# ใƒ—ใƒญใ‚ฐใƒฉใƒ ไธŠใงใฏ0ใ‹ใ‚‰Nใพใงๅ›žใ—ใฆ1ใคใšใคๆœ€ๅฐๅŒ–ใ™ใ‚Œใฐ่‰ฏใ„", "-INF = 10**7", "-dp = [INF for _ in range(N + 1)] # 0ใ‹ใ‚‰Nใพใง", "-d...
false
0.101746
0.121674
0.836224
[ "s343045321", "s381273912" ]
u260980560
p02377
python
s967163882
s718903855
80
40
8,024
5,944
Accepted
Accepted
50
class MinCostFlow: def __init__(self, n): self.n = n self.G = [[] for i in range(n)] def addEdge(self, f, t, cap, cost): # [to, cap, cost, rev] self.G[f].append([t, cap, cost, len(self.G[t])]) self.G[t].append([f, 0, -cost, len(self.G[f])-1]) def minCostFl...
from heapq import heappush, heappop class MinCostFlow: INF = 10**18 def __init__(self, N): self.N = N self.G = [[] for i in range(N)] def add_edge(self, fr, to, cap, cost): G = self.G G[fr].append([to, cap, cost, len(G[to])]) G[to].append([fr, 0, -cost,...
56
69
1,714
1,860
class MinCostFlow: def __init__(self, n): self.n = n self.G = [[] for i in range(n)] def addEdge(self, f, t, cap, cost): # [to, cap, cost, rev] self.G[f].append([t, cap, cost, len(self.G[t])]) self.G[t].append([f, 0, -cost, len(self.G[f]) - 1]) def minCostFlow(self,...
from heapq import heappush, heappop class MinCostFlow: INF = 10**18 def __init__(self, N): self.N = N self.G = [[] for i in range(N)] def add_edge(self, fr, to, cap, cost): G = self.G G[fr].append([to, cap, cost, len(G[to])]) G[to].append([fr, 0, -cost, len(G[fr])...
false
18.84058
[ "+from heapq import heappush, heappop", "+", "+", "- def __init__(self, n):", "- self.n = n", "- self.G = [[] for i in range(n)]", "+ INF = 10**18", "- def addEdge(self, f, t, cap, cost):", "- # [to, cap, cost, rev]", "- self.G[f].append([t, cap, cost, len(self...
false
0.06804
0.075426
0.902083
[ "s967163882", "s718903855" ]
u869790980
p03080
python
s265062210
s388918024
363
334
85,668
85,856
Accepted
Accepted
7.99
4 'RRBR' n = input() import collections cc = collections.Counter(input()) print('Yes' if cc['R'] > cc['B'] else 'No')
import collections n,cc = int(input()), collections.Counter(input()) print('Yes' if cc['R'] > cc['B'] else 'No')
7
3
131
121
4 "RRBR" n = input() import collections cc = collections.Counter(input()) print("Yes" if cc["R"] > cc["B"] else "No")
import collections n, cc = int(input()), collections.Counter(input()) print("Yes" if cc["R"] > cc["B"] else "No")
false
57.142857
[ "-4", "-\"RRBR\"", "-n = input()", "-cc = collections.Counter(input())", "+n, cc = int(input()), collections.Counter(input())" ]
false
0.062437
0.037661
1.65787
[ "s265062210", "s388918024" ]
u046187684
p03401
python
s639053303
s052073088
285
193
14,048
16,700
Accepted
Accepted
32.28
n = int(input().strip()) a = list(map(int, input().strip().split(" "))) a.append(0) a.insert(0, 0) s = [abs(j - i) for i, j in zip(a, a[1:])] base = sum(s) for i in range(1, n + 1): if min(a[i - 1], a[i + 1]) <= a[i] <= max(a[i - 1], a[i + 1]): print(base) elif max(a[i - 1], a[i + 1]) < a[i]: ...
def solve(string): n, *a = list(map(int, string.split())) a = [0] + a + [0] base = sum([abs(j - i) for i, j in zip(a, a[1:])]) ans = [] for i in range(1, n + 1): if min(a[i - 1], a[i + 1]) <= a[i] <= max(a[i - 1], a[i + 1]): ans.append(str(base)) elif max(a[i - 1]...
13
17
456
611
n = int(input().strip()) a = list(map(int, input().strip().split(" "))) a.append(0) a.insert(0, 0) s = [abs(j - i) for i, j in zip(a, a[1:])] base = sum(s) for i in range(1, n + 1): if min(a[i - 1], a[i + 1]) <= a[i] <= max(a[i - 1], a[i + 1]): print(base) elif max(a[i - 1], a[i + 1]) < a[i]: pr...
def solve(string): n, *a = list(map(int, string.split())) a = [0] + a + [0] base = sum([abs(j - i) for i, j in zip(a, a[1:])]) ans = [] for i in range(1, n + 1): if min(a[i - 1], a[i + 1]) <= a[i] <= max(a[i - 1], a[i + 1]): ans.append(str(base)) elif max(a[i - 1], a[i + ...
false
23.529412
[ "-n = int(input().strip())", "-a = list(map(int, input().strip().split(\" \")))", "-a.append(0)", "-a.insert(0, 0)", "-s = [abs(j - i) for i, j in zip(a, a[1:])]", "-base = sum(s)", "-for i in range(1, n + 1):", "- if min(a[i - 1], a[i + 1]) <= a[i] <= max(a[i - 1], a[i + 1]):", "- print(b...
false
0.035728
0.124119
0.287856
[ "s639053303", "s052073088" ]
u564589929
p03087
python
s174329852
s428234478
1,007
277
52,708
6,436
Accepted
Accepted
72.49
import sys sys.setrecursionlimit(10 ** 6) # input = sys.stdin.readline #### int1 = lambda x: int(x) - 1 def II(): return int(eval(input())) def MI(): return list(map(int, input().split())) def MI1(): return list(map(int1, input().split())) def LI(): return list(map(int, input().split())) def LI1(): retur...
import sys sys.setrecursionlimit(10 ** 6) input = sys.stdin.readline #### int1 = lambda x: int(x) - 1 def II(): return int(eval(input())) def MI(): return list(map(int, input().split())) def MI1(): return list(map(int1, input().split())) def LI(): return list(map(int, input().split())) def LI1(): return ...
36
36
825
823
import sys sys.setrecursionlimit(10**6) # input = sys.stdin.readline #### int1 = lambda x: int(x) - 1 def II(): return int(eval(input())) def MI(): return list(map(int, input().split())) def MI1(): return list(map(int1, input().split())) def LI(): return list(map(int, input().split())) def...
import sys sys.setrecursionlimit(10**6) input = sys.stdin.readline #### int1 = lambda x: int(x) - 1 def II(): return int(eval(input())) def MI(): return list(map(int, input().split())) def MI1(): return list(map(int1, input().split())) def LI(): return list(map(int, input().split())) def LI1...
false
0
[ "-# input = sys.stdin.readline ####", "+input = sys.stdin.readline ####" ]
false
0.097643
0.083812
1.165023
[ "s174329852", "s428234478" ]
u620480037
p02844
python
s523475551
s592828948
989
409
67,956
98,720
Accepted
Accepted
58.65
N=int(eval(input())) import copy S=list(eval(input())) F=[] E=[] L=[0 for i in range(10)] for i in range(N): L[int(S[i])]=1 F.append(copy.deepcopy(L)) #print(F) RS=S[::-1] L=[0 for i in range(10)] for i in range(N): L[int(RS[i])]=1 E.append(copy.deepcopy(L)) E=E[::-1] D={} for i in rang...
N=int(eval(input())) S=list(eval(input())) #print(S) SETF=[set() for i in range(N)] SETE=[0 for i in range(N)] ANSSET=set() SETF[0]=set() SETF[0].add(S[0]) #print(SETF) #print(type(SETF[1])) import copy for i in range(1,N): SETF[i]=copy.deepcopy(SETF[i-1]) SETF[i].add(S[i]) #print(SETF) SETE[0]...
27
30
553
600
N = int(eval(input())) import copy S = list(eval(input())) F = [] E = [] L = [0 for i in range(10)] for i in range(N): L[int(S[i])] = 1 F.append(copy.deepcopy(L)) # print(F) RS = S[::-1] L = [0 for i in range(10)] for i in range(N): L[int(RS[i])] = 1 E.append(copy.deepcopy(L)) E = E[::-1] D = {} for i ...
N = int(eval(input())) S = list(eval(input())) # print(S) SETF = [set() for i in range(N)] SETE = [0 for i in range(N)] ANSSET = set() SETF[0] = set() SETF[0].add(S[0]) # print(SETF) # print(type(SETF[1])) import copy for i in range(1, N): SETF[i] = copy.deepcopy(SETF[i - 1]) SETF[i].add(S[i]) # print(SETF) SE...
false
10
[ "+S = list(eval(input()))", "+# print(S)", "+SETF = [set() for i in range(N)]", "+SETE = [0 for i in range(N)]", "+ANSSET = set()", "+SETF[0] = set()", "+SETF[0].add(S[0])", "+# print(SETF)", "+# print(type(SETF[1]))", "-S = list(eval(input()))", "-F = []", "-E = []", "-L = [0 for i in range...
false
0.033283
0.055112
0.603916
[ "s523475551", "s592828948" ]
u456353530
p03077
python
s153503667
s792681586
164
17
38,384
3,064
Accepted
Accepted
89.63
import math N = int(eval(input())) d = [int(eval(input())) for i in range(5)] mi = d[0] Ans = math.ceil(N / mi) for i in d[1:]: Ans += 1 if i < mi: x = math.ceil(N / i) - math.ceil(N / mi) Ans += x mi = i print(Ans)
N = int(eval(input())) A = int(eval(input())) B = int(eval(input())) C = int(eval(input())) D = int(eval(input())) E = int(eval(input())) x = min(A, B, C, D, E) ans = 4 + N // x if N % x != 0: ans += 1 print(ans)
15
14
239
194
import math N = int(eval(input())) d = [int(eval(input())) for i in range(5)] mi = d[0] Ans = math.ceil(N / mi) for i in d[1:]: Ans += 1 if i < mi: x = math.ceil(N / i) - math.ceil(N / mi) Ans += x mi = i print(Ans)
N = int(eval(input())) A = int(eval(input())) B = int(eval(input())) C = int(eval(input())) D = int(eval(input())) E = int(eval(input())) x = min(A, B, C, D, E) ans = 4 + N // x if N % x != 0: ans += 1 print(ans)
false
6.666667
[ "-import math", "-", "-d = [int(eval(input())) for i in range(5)]", "-mi = d[0]", "-Ans = math.ceil(N / mi)", "-for i in d[1:]:", "- Ans += 1", "- if i < mi:", "- x = math.ceil(N / i) - math.ceil(N / mi)", "- Ans += x", "- mi = i", "-print(Ans)", "+A = int(eval(inp...
false
0.047954
0.043643
1.098776
[ "s153503667", "s792681586" ]
u933341648
p03380
python
s593283381
s299273108
105
71
14,052
14,056
Accepted
Accepted
32.38
n = int(eval(input())) arr = [int(a) for a in input().split()] i = max(arr) arr.remove(i) j = min(arr, key=lambda a: min(abs(i//2-a), abs((i+1)//2-a))) print((i, j))
n = int(eval(input())) arr = [int(a) for a in input().split()] i = max(arr) arr.remove(i) j = min(arr, key=lambda a: abs(i/2-a)) print((i, j))
8
8
167
144
n = int(eval(input())) arr = [int(a) for a in input().split()] i = max(arr) arr.remove(i) j = min(arr, key=lambda a: min(abs(i // 2 - a), abs((i + 1) // 2 - a))) print((i, j))
n = int(eval(input())) arr = [int(a) for a in input().split()] i = max(arr) arr.remove(i) j = min(arr, key=lambda a: abs(i / 2 - a)) print((i, j))
false
0
[ "-j = min(arr, key=lambda a: min(abs(i // 2 - a), abs((i + 1) // 2 - a)))", "+j = min(arr, key=lambda a: abs(i / 2 - a))" ]
false
0.044166
0.045155
0.978113
[ "s593283381", "s299273108" ]
u832039789
p02897
python
s038081912
s012557637
265
17
64,108
2,940
Accepted
Accepted
93.58
import sys from fractions import gcd from itertools import groupby as gb from itertools import permutations as perm from itertools import combinations as comb from collections import Counter as C from collections import defaultdict as dd sys.setrecursionlimit(10**5) def y(f): if f: print('Yes') ...
n = int(eval(input())) odd = 0 for i in range(1, n + 1): if i % 2 == 1: odd += 1 print((odd / n))
24
6
514
107
import sys from fractions import gcd from itertools import groupby as gb from itertools import permutations as perm from itertools import combinations as comb from collections import Counter as C from collections import defaultdict as dd sys.setrecursionlimit(10**5) def y(f): if f: print("Yes") else:...
n = int(eval(input())) odd = 0 for i in range(1, n + 1): if i % 2 == 1: odd += 1 print((odd / n))
false
75
[ "-import sys", "-from fractions import gcd", "-from itertools import groupby as gb", "-from itertools import permutations as perm", "-from itertools import combinations as comb", "-from collections import Counter as C", "-from collections import defaultdict as dd", "-", "-sys.setrecursionlimit(10**5...
false
0.03942
0.035196
1.119998
[ "s038081912", "s012557637" ]
u391589398
p03476
python
s598211050
s375611017
945
855
8,984
8,900
Accepted
Accepted
9.52
import math Q = int(eval(input())) ps = [] maxfac = math.sqrt(10**5) nums = [i+1 for i in range(1, 10**5)] while True: p = nums[0] if maxfac <= p: break ps.append(p) nums = [num for num in nums if num % p != 0] ps = set(ps + nums) c = [0] * 10**5 for i in range(3, 10**5+1, 2)...
Q = int(eval(input())) maxn = 10**5 is_prime = [True if i%2 == 1 else False for i in range(0, maxn+1) ] is_prime[0] = False is_prime[1] = False is_prime[2] = True for i in range(3, int(maxn**0.5) + 1, 2): if not is_prime[i]: continue for j in range(i*2, maxn+1, i): is_prime[j] = False ...
26
26
519
633
import math Q = int(eval(input())) ps = [] maxfac = math.sqrt(10**5) nums = [i + 1 for i in range(1, 10**5)] while True: p = nums[0] if maxfac <= p: break ps.append(p) nums = [num for num in nums if num % p != 0] ps = set(ps + nums) c = [0] * 10**5 for i in range(3, 10**5 + 1, 2): if i in p...
Q = int(eval(input())) maxn = 10**5 is_prime = [True if i % 2 == 1 else False for i in range(0, maxn + 1)] is_prime[0] = False is_prime[1] = False is_prime[2] = True for i in range(3, int(maxn**0.5) + 1, 2): if not is_prime[i]: continue for j in range(i * 2, maxn + 1, i): is_prime[j] = False ps ...
false
0
[ "-import math", "-", "-ps = []", "-maxfac = math.sqrt(10**5)", "-nums = [i + 1 for i in range(1, 10**5)]", "-while True:", "- p = nums[0]", "- if maxfac <= p:", "- break", "- ps.append(p)", "- nums = [num for num in nums if num % p != 0]", "-ps = set(ps + nums)", "+maxn = ...
false
0.181929
0.09549
1.905221
[ "s598211050", "s375611017" ]
u226108478
p03645
python
s187319584
s865808962
693
172
19,016
27,672
Accepted
Accepted
75.18
# -*- coding: utf-8 -*- # AtCoder Beginner Contest # Problem C if __name__ == '__main__': n, m = list(map(int, input().split())) set_a = set() set_b = set() for i in range(m): a, b = list(map(int, input().split())) if a == 1: set_b.add(b) elif b == ...
# -*- coding: utf-8 -*- def main(): import sys input = sys.stdin.readline n, m = list(map(int, input().split())) first = list() second = list() for i in range(m): ai, bi = list(map(int, input().split())) if ai == 1: first.append(bi) if b...
22
30
441
520
# -*- coding: utf-8 -*- # AtCoder Beginner Contest # Problem C if __name__ == "__main__": n, m = list(map(int, input().split())) set_a = set() set_b = set() for i in range(m): a, b = list(map(int, input().split())) if a == 1: set_b.add(b) elif b == n: set_...
# -*- coding: utf-8 -*- def main(): import sys input = sys.stdin.readline n, m = list(map(int, input().split())) first = list() second = list() for i in range(m): ai, bi = list(map(int, input().split())) if ai == 1: first.append(bi) if bi == n: se...
false
26.666667
[ "-# AtCoder Beginner Contest", "-# Problem C", "-if __name__ == \"__main__\":", "+def main():", "+ import sys", "+", "+ input = sys.stdin.readline", "- set_a = set()", "- set_b = set()", "+ first = list()", "+ second = list()", "- a, b = list(map(int, input().split()))...
false
0.200521
0.068038
2.947175
[ "s187319584", "s865808962" ]
u697696097
p02726
python
s184051440
s132225561
1,971
1,299
16,152
16,124
Accepted
Accepted
34.09
### ---------------- ### ใ“ใ“ใ‹ใ‚‰ ### ---------------- import sys from io import StringIO import unittest def yn(b): print(("Yes" if b==1 else "No")) return def resolve(): readline=sys.stdin.readline n,x,y=list(map(int, readline().rstrip().split())) ans = [0] * (n-1) for i in ra...
### ---------------- ### ใ“ใ“ใ‹ใ‚‰ ### ---------------- import sys from io import StringIO import unittest def yn(b): print(("Yes" if b==1 else "No")) return def resolve(): readline=sys.stdin.readline n,x,y=list(map(int, readline().rstrip().split())) ans = [0] * (n-1) for i in ra...
42
36
895
694
### ---------------- ### ใ“ใ“ใ‹ใ‚‰ ### ---------------- import sys from io import StringIO import unittest def yn(b): print(("Yes" if b == 1 else "No")) return def resolve(): readline = sys.stdin.readline n, x, y = list(map(int, readline().rstrip().split())) ans = [0] * (n - 1) for i in range(1, ...
### ---------------- ### ใ“ใ“ใ‹ใ‚‰ ### ---------------- import sys from io import StringIO import unittest def yn(b): print(("Yes" if b == 1 else "No")) return def resolve(): readline = sys.stdin.readline n, x, y = list(map(int, readline().rstrip().split())) ans = [0] * (n - 1) for i in range(1, ...
false
14.285714
[ "- d1 = abs(i - x) + abs(j - x)", "- d2 = abs(i - y) + abs(j - y)", "- d3 = abs(i - x) + abs(j - y) + 1", "- d4 = abs(i - y) + abs(j - x) + 1", "- d5 = abs(i - j)", "- d = min(d1, d2, d3, d4, d5)", "+ d1 = abs(i - x) + abs(j - ...
false
0.03524
0.036797
0.957675
[ "s184051440", "s132225561" ]
u402629484
p03695
python
s445471462
s441099996
21
17
3,064
3,060
Accepted
Accepted
19.05
N = int(eval(input())) a = list(map(int, input().split())) COLOR = 8 cnt, ov = [0] * COLOR, 0 for i in range(N): if a[i] < 3200: cnt[a[i] // 400] += 1 else: ov += 1 used = 0 for c in cnt: if c > 0: used += 1 unused = N - used print((max(1, used), used + min(unu...
N = int(eval(input())) a = list(map(int, input().split())) COLOR = 8 cnt, ov = [0] * COLOR, 0 for r in a: if r < 3200: cnt[r // 400] = 1 else: ov += 1 used = 0 for c in cnt: if c > 0: used += 1 print((max(1, used), used + ov))
18
17
322
275
N = int(eval(input())) a = list(map(int, input().split())) COLOR = 8 cnt, ov = [0] * COLOR, 0 for i in range(N): if a[i] < 3200: cnt[a[i] // 400] += 1 else: ov += 1 used = 0 for c in cnt: if c > 0: used += 1 unused = N - used print((max(1, used), used + min(unused, ov)))
N = int(eval(input())) a = list(map(int, input().split())) COLOR = 8 cnt, ov = [0] * COLOR, 0 for r in a: if r < 3200: cnt[r // 400] = 1 else: ov += 1 used = 0 for c in cnt: if c > 0: used += 1 print((max(1, used), used + ov))
false
5.555556
[ "-for i in range(N):", "- if a[i] < 3200:", "- cnt[a[i] // 400] += 1", "+for r in a:", "+ if r < 3200:", "+ cnt[r // 400] = 1", "-unused = N - used", "-print((max(1, used), used + min(unused, ov)))", "+print((max(1, used), used + ov))" ]
false
0.048685
0.065796
0.739927
[ "s445471462", "s441099996" ]
u047796752
p02722
python
s000791510
s122825987
208
89
39,024
67,800
Accepted
Accepted
57.21
def make_divs(n): divs = [] for i in range(1, int(n**0.5)+1): if n%i==0: divs.append(i) if i!=n//i: divs.append(n//i) return divs N = int(eval(input())) divs = make_divs(N) ans = 0 for d in divs: if d==1: ...
import sys input = sys.stdin.readline from collections import * def make_divs(n): divs = [] i = 1 while i*i<=n: if n%i==0: divs.append(i) if i!=n//i: divs.append(n//i) i += 1 return divs N = int(...
32
37
488
559
def make_divs(n): divs = [] for i in range(1, int(n**0.5) + 1): if n % i == 0: divs.append(i) if i != n // i: divs.append(n // i) return divs N = int(eval(input())) divs = make_divs(N) ans = 0 for d in divs: if d == 1: continue N2 = N whi...
import sys input = sys.stdin.readline from collections import * def make_divs(n): divs = [] i = 1 while i * i <= n: if n % i == 0: divs.append(i) if i != n // i: divs.append(n // i) i += 1 return divs N = int(eval(input())) ds = make_divs(N) a...
false
13.513514
[ "+import sys", "+", "+input = sys.stdin.readline", "+from collections import *", "+", "+", "- for i in range(1, int(n**0.5) + 1):", "+ i = 1", "+ while i * i <= n:", "+ i += 1", "-divs = make_divs(N)", "+ds = make_divs(N)", "-for d in divs:", "+for d in ds:", "-divs = mak...
false
0.054625
0.070908
0.770363
[ "s000791510", "s122825987" ]
u887207211
p03078
python
s486337264
s830035777
535
37
8,708
5,104
Accepted
Accepted
93.08
def main(): import sys input = sys.stdin.readline 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) res = [] for i ...
def main(): import sys from heapq import heappush as hpush, heappop as hpop input = sys.stdin.readline 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...
25
30
585
919
def main(): import sys input = sys.stdin.readline 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) res = [] ...
def main(): import sys from heapq import heappush as hpush, heappop as hpop input = sys.stdin.readline 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...
false
16.666667
[ "+ from heapq import heappush as hpush, heappop as hpop", "- res = []", "- for i in range(X):", "- for j in range(Y):", "- for k in range(Z):", "- if (i + 1) * (j + 1) * (k + 1) <= K:", "- res.append(A[i] + B[j] + C[k])", "- e...
false
0.042351
0.035991
1.176705
[ "s486337264", "s830035777" ]
u560867850
p02819
python
s191307658
s019818988
169
18
14,764
3,060
Accepted
Accepted
89.35
import sys import math input = sys.stdin.readline def multiples(n): for i in range(3,100003): yield i*n if i*n > 100003: break def sosuu(x): if x == 2 : return 2 d = set() end = math.ceil(math.sqrt(x)) d = d.union(multiples(2)) for i in range(3,end,2)...
import sys import math input = sys.stdin.readline def is_prime(x): if x <= 1: return False for i in range(2,math.ceil(x**0.5)): if x%i==0: return False return True def main(): x = int(eval(input())) p = x while not is_prime(p): p += 1 pr...
31
20
608
362
import sys import math input = sys.stdin.readline def multiples(n): for i in range(3, 100003): yield i * n if i * n > 100003: break def sosuu(x): if x == 2: return 2 d = set() end = math.ceil(math.sqrt(x)) d = d.union(multiples(2)) for i in range(3, end, ...
import sys import math input = sys.stdin.readline def is_prime(x): if x <= 1: return False for i in range(2, math.ceil(x**0.5)): if x % i == 0: return False return True def main(): x = int(eval(input())) p = x while not is_prime(p): p += 1 print(p) ...
false
35.483871
[ "-def multiples(n):", "- for i in range(3, 100003):", "- yield i * n", "- if i * n > 100003:", "- break", "-", "-", "-def sosuu(x):", "- if x == 2:", "- return 2", "- d = set()", "- end = math.ceil(math.sqrt(x))", "- d = d.union(multiples(2))", ...
false
0.288431
0.007552
38.193157
[ "s191307658", "s019818988" ]
u066413086
p02902
python
s582606397
s638203251
368
47
9,736
13,728
Accepted
Accepted
87.23
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from collections import deque def find_shortest_cycle(G, s): dq = deque() N = len(G) INF = float('inf') dist = [INF] * N dist[s] = 0 parent = [-1] * N ans_las...
import sys sys.setrecursionlimit(10 ** 6) n, m = list(map(int, input().split())) e = [[] for _ in range(n)] for _ in range(m): a, b = list(map(int, input().split())) e[a-1].append(b-1) c = [0] * n ans = [] def search_path(p, temp): c[p] = 1 for x in e[p]: if x in temp: ...
92
28
2,460
500
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from collections import deque def find_shortest_cycle(G, s): dq = deque() N = len(G) INF = float("inf") dist = [INF] * N dist[s] = 0 parent = [-1] * N ans_last = None # sใ‹ใ‚‰...
import sys sys.setrecursionlimit(10**6) n, m = list(map(int, input().split())) e = [[] for _ in range(n)] for _ in range(m): a, b = list(map(int, input().split())) e[a - 1].append(b - 1) c = [0] * n ans = [] def search_path(p, temp): c[p] = 1 for x in e[p]: if x in temp: print((-9...
false
69.565217
[ "-read = sys.stdin.buffer.read", "-readline = sys.stdin.buffer.readline", "-readlines = sys.stdin.buffer.readlines", "-from collections import deque", "+sys.setrecursionlimit(10**6)", "+n, m = list(map(int, input().split()))", "+e = [[] for _ in range(n)]", "+for _ in range(m):", "+ a, b = list(m...
false
0.036298
0.036842
0.985231
[ "s582606397", "s638203251" ]
u863370423
p02784
python
s380718548
s786495970
57
40
14,012
13,964
Accepted
Accepted
29.82
import math inputs = input().split(" ") health, moves_num = int(inputs[0]), int(inputs[1]) moves_inp = input().split(" ") moves = [int(move) for move in moves_inp] can_win = False for move in moves: health -= move if health <= 0: can_win = True break print(("Yes" if can_win el...
H,N=list(map(int,input().split())) A=list(map(int,input().split())) x=sum(A) print(("Yes" if x>=H else "No"))
16
4
327
104
import math inputs = input().split(" ") health, moves_num = int(inputs[0]), int(inputs[1]) moves_inp = input().split(" ") moves = [int(move) for move in moves_inp] can_win = False for move in moves: health -= move if health <= 0: can_win = True break print(("Yes" if can_win else "No"))
H, N = list(map(int, input().split())) A = list(map(int, input().split())) x = sum(A) print(("Yes" if x >= H else "No"))
false
75
[ "-import math", "-", "-inputs = input().split(\" \")", "-health, moves_num = int(inputs[0]), int(inputs[1])", "-moves_inp = input().split(\" \")", "-moves = [int(move) for move in moves_inp]", "-can_win = False", "-for move in moves:", "- health -= move", "- if health <= 0:", "- can...
false
0.043518
0.042623
1.021012
[ "s380718548", "s786495970" ]
u595893956
p03062
python
s006319089
s706375658
66
58
14,224
14,412
Accepted
Accepted
12.12
n=eval(input()) a=list(map(int,input().split())) n=sum(x<0 for x in a) a=list([abs(x) for x in a]) s=sum(a) if n%2==0 else sum(a)-min(a)*2 print(s)
n=eval(input()) a=list(map(int,input().split())) n=sum(x<0 for x in a) a=list(map(abs,a)) s=sum(a) if n%2==0 else sum(a)-min(a)*2 print(s)
6
6
151
138
n = eval(input()) a = list(map(int, input().split())) n = sum(x < 0 for x in a) a = list([abs(x) for x in a]) s = sum(a) if n % 2 == 0 else sum(a) - min(a) * 2 print(s)
n = eval(input()) a = list(map(int, input().split())) n = sum(x < 0 for x in a) a = list(map(abs, a)) s = sum(a) if n % 2 == 0 else sum(a) - min(a) * 2 print(s)
false
0
[ "-a = list([abs(x) for x in a])", "+a = list(map(abs, a))" ]
false
0.038357
0.038032
1.008546
[ "s006319089", "s706375658" ]
u493520238
p02726
python
s012924803
s352174575
1,430
127
3,444
74,888
Accepted
Accepted
91.12
def main(): n, x, y = list(map(int, input().split())) ans = [0] * n for i in range(1,n): for j in range(i+1, n+1): r1 = j-i r2 = abs(x-i) + 1 + abs(j-y) r3 = abs(y-i) + 1 + abs(j-x) ans[min(r1,r2,r3)] += 1 for i in range(1,n): ...
n,x,y = list(map(int, input().split())) ans = [0]*n for i in range(1,n): for j in range(i+1,n+1): v1 = j-i v2 = abs(x-i) + 1 + abs(y-j) v3 = abs(y-i) + 1 + abs(x-j) minv = min(v1,v2,v3) ans[minv] += 1 for a in ans[1:]: print(a)
16
13
371
283
def main(): n, x, y = list(map(int, input().split())) ans = [0] * n for i in range(1, n): for j in range(i + 1, n + 1): r1 = j - i r2 = abs(x - i) + 1 + abs(j - y) r3 = abs(y - i) + 1 + abs(j - x) ans[min(r1, r2, r3)] += 1 for i in range(1, n): ...
n, x, y = list(map(int, input().split())) ans = [0] * n for i in range(1, n): for j in range(i + 1, n + 1): v1 = j - i v2 = abs(x - i) + 1 + abs(y - j) v3 = abs(y - i) + 1 + abs(x - j) minv = min(v1, v2, v3) ans[minv] += 1 for a in ans[1:]: print(a)
false
18.75
[ "-def main():", "- n, x, y = list(map(int, input().split()))", "- ans = [0] * n", "- for i in range(1, n):", "- for j in range(i + 1, n + 1):", "- r1 = j - i", "- r2 = abs(x - i) + 1 + abs(j - y)", "- r3 = abs(y - i) + 1 + abs(j - x)", "- a...
false
0.042616
0.04659
0.914708
[ "s012924803", "s352174575" ]
u908984540
p02261
python
s181860525
s043474791
50
30
7,760
8,224
Accepted
Accepted
40
# -*- coding: utf-8 -*- def bubble_sort(c): c = list(c) for i in range(len(c)): for j in range(len(c)-1, i, -1): if int(c[j][1]) < int(c[j-1][1]): c[j], c[j-1] = c[j-1], c[j] return c def selection_sort(c): c = list(c) for i in range(len(c)): ...
# -*- coding:utf-8 -*- import copy def bubble_sort(num_list): for i in range(len(num_list)): for j in range(len(num_list)-1, i , -1): if num_list[j][1] < num_list[j-1][1]: num_list[j], num_list[j-1] = num_list[j-1], num_list[j] return num_list def selection_sort...
41
55
1,073
1,694
# -*- coding: utf-8 -*- def bubble_sort(c): c = list(c) for i in range(len(c)): for j in range(len(c) - 1, i, -1): if int(c[j][1]) < int(c[j - 1][1]): c[j], c[j - 1] = c[j - 1], c[j] return c def selection_sort(c): c = list(c) for i in range(len(c)): min...
# -*- coding:utf-8 -*- import copy def bubble_sort(num_list): for i in range(len(num_list)): for j in range(len(num_list) - 1, i, -1): if num_list[j][1] < num_list[j - 1][1]: num_list[j], num_list[j - 1] = num_list[j - 1], num_list[j] return num_list def selection_sort(nu...
false
25.454545
[ "-# -*- coding: utf-8 -*-", "-def bubble_sort(c):", "- c = list(c)", "- for i in range(len(c)):", "- for j in range(len(c) - 1, i, -1):", "- if int(c[j][1]) < int(c[j - 1][1]):", "- c[j], c[j - 1] = c[j - 1], c[j]", "- return c", "+# -*- coding:utf-8 -*-", ...
false
0.10302
0.040251
2.559436
[ "s181860525", "s043474791" ]
u935558307
p03608
python
s221709169
s814900873
324
298
76,940
80,792
Accepted
Accepted
8.02
N,M,R = list(map(int,input().split())) R = list(map(int,input().split())) dp = [[float("INF")]*(N+1) for _ in range(N+1)] for i in range(N+1): dp[i][i] = 0 for _ in range(M): a,b,c = list(map(int,input().split())) dp[a][b] = min(dp[a][b],c) dp[b][a] = min(dp[b][a],c) for i in range(1,N+1): ...
from itertools import permutations N,M,R = list(map(int,input().split())) RList = list(map(int,input().split())) dp = [[float("INF")]*(N+1) for _ in range(N+1)] for i in range(N+1): dp[i][i] = 0 for _ in range(M): a,b,c = list(map(int,input().split())) dp[a][b] = c dp[b][a] = c for i in rang...
33
26
821
648
N, M, R = list(map(int, input().split())) R = list(map(int, input().split())) dp = [[float("INF")] * (N + 1) for _ in range(N + 1)] for i in range(N + 1): dp[i][i] = 0 for _ in range(M): a, b, c = list(map(int, input().split())) dp[a][b] = min(dp[a][b], c) dp[b][a] = min(dp[b][a], c) for i in range(1, N...
from itertools import permutations N, M, R = list(map(int, input().split())) RList = list(map(int, input().split())) dp = [[float("INF")] * (N + 1) for _ in range(N + 1)] for i in range(N + 1): dp[i][i] = 0 for _ in range(M): a, b, c = list(map(int, input().split())) dp[a][b] = c dp[b][a] = c for i in ...
false
21.212121
[ "+from itertools import permutations", "+", "-R = list(map(int, input().split()))", "+RList = list(map(int, input().split()))", "- dp[a][b] = min(dp[a][b], c)", "- dp[b][a] = min(dp[b][a], c)", "+ dp[a][b] = c", "+ dp[b][a] = c", "- dp[j][k] = min(dp[j][k], dp[j][i] + dp[i][k]...
false
0.038139
0.044089
0.865054
[ "s221709169", "s814900873" ]
u586759271
p02762
python
s630355378
s304976258
1,243
1,117
103,584
103,328
Accepted
Accepted
10.14
#d # import sys # input = sys.stdin.readline n,m,k = list(map(int,input().split())) friends_pair=[] friend=[[] for _ in range(n)] for i in range(m): a,b = list(map(int,input().split())) a-=1 b-=1 friends_pair.append((a,b)) friend[a].append(b) friend[b].append(...
#d # import sys # input = sys.stdin.readline n,m,k = list(map(int,input().split())) friends_pair=[] friend=[[] for _ in range(n)] for i in range(m): a,b = list(map(int,input().split())) a-=1 b-=1 friends_pair.append((a,b)) friend[a].append(b) friend[b].append(...
72
68
1,674
1,556
# d # import sys # input = sys.stdin.readline n, m, k = list(map(int, input().split())) friends_pair = [] friend = [[] for _ in range(n)] for i in range(m): a, b = list(map(int, input().split())) a -= 1 b -= 1 friends_pair.append((a, b)) friend[a].append(b) friend[b].append(a) block = []...
# d # import sys # input = sys.stdin.readline n, m, k = list(map(int, input().split())) friends_pair = [] friend = [[] for _ in range(n)] for i in range(m): a, b = list(map(int, input().split())) a -= 1 b -= 1 friends_pair.append((a, b)) friend[a].append(b) friend[b].append(a) block = []...
false
5.555556
[ "-# while sum(visited)<n:", "-# for i in range(n):", "-# if visited[i]==0:", "-# start=i", "-# break", "- if y == parent: # ่ฆชใƒŽใƒผใƒ‰ใ‚’้ฃ›ใฐใ—", "- continue", "+ # if y == parent:#่ฆชใƒŽใƒผใƒ‰ใ‚’้ฃ›ใฐใ—", "+ # c...
false
0.033574
0.041716
0.804808
[ "s630355378", "s304976258" ]
u227082700
p03854
python
s969165771
s786658952
64
18
3,188
3,188
Accepted
Accepted
71.88
a=("dream","erase");ans="YES" s=eval(input()) while s!="": if s[-7:]=="dreamer":s=s[:-7] elif s[-6:]=="eraser":s=s[:-6] elif s[-5:]in a:s=s[:-5] else:ans="NO";break print(ans)
s=input().replace("eraser","").replace("erase","").replace("dreamer","").replace("dream","") if s=="":print('YES') else:print('NO')
8
3
184
133
a = ("dream", "erase") ans = "YES" s = eval(input()) while s != "": if s[-7:] == "dreamer": s = s[:-7] elif s[-6:] == "eraser": s = s[:-6] elif s[-5:] in a: s = s[:-5] else: ans = "NO" break print(ans)
s = ( input() .replace("eraser", "") .replace("erase", "") .replace("dreamer", "") .replace("dream", "") ) if s == "": print("YES") else: print("NO")
false
62.5
[ "-a = (\"dream\", \"erase\")", "-ans = \"YES\"", "-s = eval(input())", "-while s != \"\":", "- if s[-7:] == \"dreamer\":", "- s = s[:-7]", "- elif s[-6:] == \"eraser\":", "- s = s[:-6]", "- elif s[-5:] in a:", "- s = s[:-5]", "- else:", "- ans = \"NO\"",...
false
0.044252
0.036729
1.204814
[ "s969165771", "s786658952" ]
u796942881
p02959
python
s319134964
s541580765
149
88
20,572
20,800
Accepted
Accepted
40.94
from collections import deque from sys import stdin def main(): lines = stdin.readlines() A = deque(list(map(int, lines[1].split()))) B = deque(list(map(int, lines[2].split()))) cnt = 0 ans = 0 while B: a = A.pop() b = B.pop() tmp = a if a < b else b ...
from sys import stdin def main(): lines = stdin.readlines() A = tuple(map(int, lines[1].split())) B = tuple(map(int, lines[2].split())) pre = A[0] ans = 0 for a, b in zip(A[1:], B): tmp1 = pre if pre < b else b b -= tmp1 tmp2 = a if a < b else b ans...
25
20
478
400
from collections import deque from sys import stdin def main(): lines = stdin.readlines() A = deque(list(map(int, lines[1].split()))) B = deque(list(map(int, lines[2].split()))) cnt = 0 ans = 0 while B: a = A.pop() b = B.pop() tmp = a if a < b else b ans += tmp ...
from sys import stdin def main(): lines = stdin.readlines() A = tuple(map(int, lines[1].split())) B = tuple(map(int, lines[2].split())) pre = A[0] ans = 0 for a, b in zip(A[1:], B): tmp1 = pre if pre < b else b b -= tmp1 tmp2 = a if a < b else b ans += tmp1 + tm...
false
20
[ "-from collections import deque", "- A = deque(list(map(int, lines[1].split())))", "- B = deque(list(map(int, lines[2].split())))", "- cnt = 0", "+ A = tuple(map(int, lines[1].split()))", "+ B = tuple(map(int, lines[2].split()))", "+ pre = A[0]", "- while B:", "- a = A.po...
false
0.066401
0.138902
0.478046
[ "s319134964", "s541580765" ]
u492447501
p03107
python
s781665526
s048069053
39
22
3,188
3,956
Accepted
Accepted
43.59
S = eval(input()) count_1 = 0 count_0 = 0 for i in range(len(S)): if S[i]=="1": count_1 = count_1 + 1 elif S[i]=="0": count_0 = count_0 + 1 if count_1 >= count_0: print((count_0*2)) else: print((count_1*2))
S = list(eval(input())) zero = S.count("0") one = S.count("1") print((int(zero*2) if zero <= one else int(one*2)))
18
6
240
114
S = eval(input()) count_1 = 0 count_0 = 0 for i in range(len(S)): if S[i] == "1": count_1 = count_1 + 1 elif S[i] == "0": count_0 = count_0 + 1 if count_1 >= count_0: print((count_0 * 2)) else: print((count_1 * 2))
S = list(eval(input())) zero = S.count("0") one = S.count("1") print((int(zero * 2) if zero <= one else int(one * 2)))
false
66.666667
[ "-S = eval(input())", "-count_1 = 0", "-count_0 = 0", "-for i in range(len(S)):", "- if S[i] == \"1\":", "- count_1 = count_1 + 1", "- elif S[i] == \"0\":", "- count_0 = count_0 + 1", "-if count_1 >= count_0:", "- print((count_0 * 2))", "-else:", "- print((count_1 * 2...
false
0.037243
0.036314
1.025588
[ "s781665526", "s048069053" ]
u678167152
p03293
python
s225068237
s466075863
162
27
38,384
9,028
Accepted
Accepted
83.33
def check(): S = eval(input()) T = eval(input()) S *= 2 if T in S: return 'Yes' return 'No' print((check()))
def check(): S = eval(input()) T = eval(input()) S *= 2 for i in range(len(T)): if S[i:i+len(T)]==T: return 'Yes' return 'No' print((check()))
8
9
129
156
def check(): S = eval(input()) T = eval(input()) S *= 2 if T in S: return "Yes" return "No" print((check()))
def check(): S = eval(input()) T = eval(input()) S *= 2 for i in range(len(T)): if S[i : i + len(T)] == T: return "Yes" return "No" print((check()))
false
11.111111
[ "- if T in S:", "- return \"Yes\"", "+ for i in range(len(T)):", "+ if S[i : i + len(T)] == T:", "+ return \"Yes\"" ]
false
0.10033
0.036341
2.760801
[ "s225068237", "s466075863" ]
u535171899
p02954
python
s337446045
s139357552
1,625
121
14,068
6,400
Accepted
Accepted
92.55
s = eval(input()) n = len(s) #RRLRL=(R2L),(RL) #ใƒฉใƒณใƒฌใƒณใ‚ฐใ‚นๅœง็ธฎใงRLใ‚’ๅœง็ธฎใ—ใ€ๆ•ฐใฎๅถๅฅ‡ใงๅˆ†้…ใ™ใ‚‹ #n<=10**5ใชใฎใงใ€10**5็งปๅ‹•ใ•ใ›ใŸๅพŒใฎๅ€คใงใ‚‚ๆฑ‚ใ‚ใ‚‰ใ‚Œใ‚‹ v=[] def RLE(s,v): for i in range(len(s)): if len(v)==0 or v[-1][0]!=s[i]: v.append([s[i],1]) else: v[-1][1]+=1 return v rle_li = RLE(s,v) string_...
s = eval(input()) l=len(s) ans=[1]*l for i in range(l-1): if s[i]==s[i+1]=="R": ans[i+2]+=ans[i] ans[i]=0 for i in range(l-1,1,-1): if s[i]==s[i-1]=="L": ans[i-2]+=ans[i] ans[i]=0 print((*ans))
39
12
967
236
s = eval(input()) n = len(s) # RRLRL=(R2L),(RL) # ใƒฉใƒณใƒฌใƒณใ‚ฐใ‚นๅœง็ธฎใงRLใ‚’ๅœง็ธฎใ—ใ€ๆ•ฐใฎๅถๅฅ‡ใงๅˆ†้…ใ™ใ‚‹ # n<=10**5ใชใฎใงใ€10**5็งปๅ‹•ใ•ใ›ใŸๅพŒใฎๅ€คใงใ‚‚ๆฑ‚ใ‚ใ‚‰ใ‚Œใ‚‹ v = [] def RLE(s, v): for i in range(len(s)): if len(v) == 0 or v[-1][0] != s[i]: v.append([s[i], 1]) else: v[-1][1] += 1 return v rle_li = RLE(s, v) string_...
s = eval(input()) l = len(s) ans = [1] * l for i in range(l - 1): if s[i] == s[i + 1] == "R": ans[i + 2] += ans[i] ans[i] = 0 for i in range(l - 1, 1, -1): if s[i] == s[i - 1] == "L": ans[i - 2] += ans[i] ans[i] = 0 print((*ans))
false
69.230769
[ "-n = len(s)", "-# RRLRL=(R2L),(RL)", "-# ใƒฉใƒณใƒฌใƒณใ‚ฐใ‚นๅœง็ธฎใงRLใ‚’ๅœง็ธฎใ—ใ€ๆ•ฐใฎๅถๅฅ‡ใงๅˆ†้…ใ™ใ‚‹", "-# n<=10**5ใชใฎใงใ€10**5็งปๅ‹•ใ•ใ›ใŸๅพŒใฎๅ€คใงใ‚‚ๆฑ‚ใ‚ใ‚‰ใ‚Œใ‚‹", "-v = []", "-", "-", "-def RLE(s, v):", "- for i in range(len(s)):", "- if len(v) == 0 or v[-1][0] != s[i]:", "- v.append([s[i], 1])", "- else:", "- ...
false
0.037136
0.035107
1.057797
[ "s337446045", "s139357552" ]
u513081876
p03645
python
s395685418
s374867947
946
458
39,960
40,644
Accepted
Accepted
51.59
N, M = list(map(int, input().split())) matrix = [[] for i in range(N)] check1 = [0] * N check1[0] = 1 for i in range(M): a, b = list(map(int, input().split())) a, b = a-1, b-1 matrix[a].append(b) matrix[b].append(a) for i in matrix[0]: if (N-1) in matrix[i]: print('POSSIBLE') ...
N, M = list(map(int, input().split())) check = [0] * N check[0] = 1 ab = [] for i in range(M): a, b = list(map(int, input().split())) ab.append([a, b]) if a == 1: check[b-1] = 1 for a, b in ab: if check[a-1] == 1 and b == N: print('POSSIBLE') break else: print...
17
16
354
323
N, M = list(map(int, input().split())) matrix = [[] for i in range(N)] check1 = [0] * N check1[0] = 1 for i in range(M): a, b = list(map(int, input().split())) a, b = a - 1, b - 1 matrix[a].append(b) matrix[b].append(a) for i in matrix[0]: if (N - 1) in matrix[i]: print("POSSIBLE") b...
N, M = list(map(int, input().split())) check = [0] * N check[0] = 1 ab = [] for i in range(M): a, b = list(map(int, input().split())) ab.append([a, b]) if a == 1: check[b - 1] = 1 for a, b in ab: if check[a - 1] == 1 and b == N: print("POSSIBLE") break else: print("IMPOSSIBLE...
false
5.882353
[ "-matrix = [[] for i in range(N)]", "-check1 = [0] * N", "-check1[0] = 1", "+check = [0] * N", "+check[0] = 1", "+ab = []", "- a, b = a - 1, b - 1", "- matrix[a].append(b)", "- matrix[b].append(a)", "-for i in matrix[0]:", "- if (N - 1) in matrix[i]:", "+ ab.append([a, b])", "...
false
0.037998
0.037689
1.008214
[ "s395685418", "s374867947" ]
u841568901
p03659
python
s895635811
s675010744
165
151
30,740
30,712
Accepted
Accepted
8.48
N = int(eval(input())) A = list(map(int, input().split())) P = A[0] Q = sum(A[1:]) m = abs(P-Q) for i in range(1, N-1): P += A[i] Q -= A[i] m = min(m, abs(P-Q)) print(m)
N = int(eval(input())) A = list(map(int,input().split())) S = sum(A) T = [0]*(N+1) for i in range(N): T[i+1] = T[i] + A[i] print((min(abs(S-2*T[i]) for i in range(1, N))))
10
7
178
171
N = int(eval(input())) A = list(map(int, input().split())) P = A[0] Q = sum(A[1:]) m = abs(P - Q) for i in range(1, N - 1): P += A[i] Q -= A[i] m = min(m, abs(P - Q)) print(m)
N = int(eval(input())) A = list(map(int, input().split())) S = sum(A) T = [0] * (N + 1) for i in range(N): T[i + 1] = T[i] + A[i] print((min(abs(S - 2 * T[i]) for i in range(1, N))))
false
30
[ "-P = A[0]", "-Q = sum(A[1:])", "-m = abs(P - Q)", "-for i in range(1, N - 1):", "- P += A[i]", "- Q -= A[i]", "- m = min(m, abs(P - Q))", "-print(m)", "+S = sum(A)", "+T = [0] * (N + 1)", "+for i in range(N):", "+ T[i + 1] = T[i] + A[i]", "+print((min(abs(S - 2 * T[i]) for i in ...
false
0.036643
0.036368
1.007572
[ "s895635811", "s675010744" ]
u476435125
p02948
python
s842844815
s132504131
437
403
31,980
31,980
Accepted
Accepted
7.78
import heapq import sys input=sys.stdin.readline N,M=list(map(int,input().split())) lab=[] for i in range(N): llab=list(map(int,input().split())) lab.append(llab) lab.sort(key=lambda ab:ab[0]) hq=[] ind=0 ans=0 #print(lab) #c=0 for i in range(M): if hq: ans-=heapq.heappop(hq) ...
import heapq import sys input=sys.stdin.readline N,M=list(map(int,input().split())) lab=[] for i in range(N): llab=list(map(int,input().split())) lab.append(llab) lab.sort(key=lambda ab:ab[0]) hq=[] ind=0 ans=0 for i in range(M): for j in range(ind,N): if lab[j][0]==i+1: h...
37
22
738
456
import heapq import sys input = sys.stdin.readline N, M = list(map(int, input().split())) lab = [] for i in range(N): llab = list(map(int, input().split())) lab.append(llab) lab.sort(key=lambda ab: ab[0]) hq = [] ind = 0 ans = 0 # print(lab) # c=0 for i in range(M): if hq: ans -= heapq.heappop(hq) ...
import heapq import sys input = sys.stdin.readline N, M = list(map(int, input().split())) lab = [] for i in range(N): llab = list(map(int, input().split())) lab.append(llab) lab.sort(key=lambda ab: ab[0]) hq = [] ind = 0 ans = 0 for i in range(M): for j in range(ind, N): if lab[j][0] == i + 1: ...
false
40.540541
[ "-# print(lab)", "-# c=0", "+ for j in range(ind, N):", "+ if lab[j][0] == i + 1:", "+ heapq.heappush(hq, -lab[j][1])", "+ else:", "+ ind = j", "+ break", "- for j in range(ind, N):", "- # if f==0:", "- # print(i,j,lab[j][0])", ...
false
0.106299
0.042766
2.485602
[ "s842844815", "s132504131" ]
u396495667
p03693
python
s359041640
s510520780
167
17
38,324
2,940
Accepted
Accepted
89.82
r,g,b=list(map(int, input().split())) a = 100*r + 10*g + b if a%4 ==0: print('YES') else: print('NO')
r,g,b= list(map(int, input().split())) a = r*100+g*10+b print(('YES' if a %4==0 else 'NO'))
7
3
106
85
r, g, b = list(map(int, input().split())) a = 100 * r + 10 * g + b if a % 4 == 0: print("YES") else: print("NO")
r, g, b = list(map(int, input().split())) a = r * 100 + g * 10 + b print(("YES" if a % 4 == 0 else "NO"))
false
57.142857
[ "-a = 100 * r + 10 * g + b", "-if a % 4 == 0:", "- print(\"YES\")", "-else:", "- print(\"NO\")", "+a = r * 100 + g * 10 + b", "+print((\"YES\" if a % 4 == 0 else \"NO\"))" ]
false
0.043243
0.034477
1.254237
[ "s359041640", "s510520780" ]
u814986259
p03761
python
s446670737
s328291410
22
18
3,316
3,060
Accepted
Accepted
18.18
import collections n = int(eval(input())) S = [list(eval(input())) for i in range(n)] S.sort(key=lambda x: len(x)) table = collections.defaultdict(int) len_s = len(S[0]) for i in range(1, n): for x in S[0]: if x in S[i]: S[i].pop(S[i].index(x)) else: S[0].pop(S...
n = int(eval(input())) S = [eval(input()) for i in range(n)] alpha = "abcdefghijklmnopqrstuvwxyz" count = [50]*26 for i, x in enumerate(alpha): for s in S: count[i] = min(count[i], s.count(x)) ans = [] for i, x in zip(count, alpha): ans.append(x*i) print(("".join(ans)))
17
13
359
287
import collections n = int(eval(input())) S = [list(eval(input())) for i in range(n)] S.sort(key=lambda x: len(x)) table = collections.defaultdict(int) len_s = len(S[0]) for i in range(1, n): for x in S[0]: if x in S[i]: S[i].pop(S[i].index(x)) else: S[0].pop(S[0].index(x)) ...
n = int(eval(input())) S = [eval(input()) for i in range(n)] alpha = "abcdefghijklmnopqrstuvwxyz" count = [50] * 26 for i, x in enumerate(alpha): for s in S: count[i] = min(count[i], s.count(x)) ans = [] for i, x in zip(count, alpha): ans.append(x * i) print(("".join(ans)))
false
23.529412
[ "-import collections", "-", "-S = [list(eval(input())) for i in range(n)]", "-S.sort(key=lambda x: len(x))", "-table = collections.defaultdict(int)", "-len_s = len(S[0])", "-for i in range(1, n):", "- for x in S[0]:", "- if x in S[i]:", "- S[i].pop(S[i].index(x))", "- ...
false
0.035691
0.034525
1.033757
[ "s446670737", "s328291410" ]
u821588465
p02613
python
s676186445
s082712161
159
145
16,108
15,936
Accepted
Accepted
8.81
N = int(eval(input())) S = list(str(eval(input())) for _ in range(N)) AC = 0 WA = 0 TLE = 0 RE = 0 for s in S: if s =='AC': AC +=1 elif s == 'WA': WA +=1 elif s == 'TLE': TLE += 1 elif s == 'RE': RE +=1 print(('AC x {}'.format(str(AC)))) print(('WA x ...
from collections import Counter n = int(eval(input())) a = list(eval(input()) for _ in range(n)) c = Counter(a) print(('AC x '+str(c['AC']))) print(('WA x '+str(c['WA']))) print(('TLE x '+str(c['TLE']))) print(('RE x '+str(c['RE'])))
21
9
395
223
N = int(eval(input())) S = list(str(eval(input())) for _ in range(N)) AC = 0 WA = 0 TLE = 0 RE = 0 for s in S: if s == "AC": AC += 1 elif s == "WA": WA += 1 elif s == "TLE": TLE += 1 elif s == "RE": RE += 1 print(("AC x {}".format(str(AC)))) print(("WA x {}".format(str(WA...
from collections import Counter n = int(eval(input())) a = list(eval(input()) for _ in range(n)) c = Counter(a) print(("AC x " + str(c["AC"]))) print(("WA x " + str(c["WA"]))) print(("TLE x " + str(c["TLE"]))) print(("RE x " + str(c["RE"])))
false
57.142857
[ "-N = int(eval(input()))", "-S = list(str(eval(input())) for _ in range(N))", "-AC = 0", "-WA = 0", "-TLE = 0", "-RE = 0", "-for s in S:", "- if s == \"AC\":", "- AC += 1", "- elif s == \"WA\":", "- WA += 1", "- elif s == \"TLE\":", "- TLE += 1", "- elif s ...
false
0.048832
0.122038
0.400134
[ "s676186445", "s082712161" ]
u941047297
p02835
python
s633807286
s699084804
62
29
61,880
9,160
Accepted
Accepted
53.23
a = list(map(int, input().split())) if sum(a) >= 22: print('bust') else: print('win')
def main(): A = list(map(int, input().split())) print(('win' if sum(A) <= 21 else 'bust')) if __name__ == '__main__': main()
5
7
97
143
a = list(map(int, input().split())) if sum(a) >= 22: print("bust") else: print("win")
def main(): A = list(map(int, input().split())) print(("win" if sum(A) <= 21 else "bust")) if __name__ == "__main__": main()
false
28.571429
[ "-a = list(map(int, input().split()))", "-if sum(a) >= 22:", "- print(\"bust\")", "-else:", "- print(\"win\")", "+def main():", "+ A = list(map(int, input().split()))", "+ print((\"win\" if sum(A) <= 21 else \"bust\"))", "+", "+", "+if __name__ == \"__main__\":", "+ main()" ]
false
0.046814
0.046437
1.008124
[ "s633807286", "s699084804" ]
u380524497
p03608
python
s361156355
s831152331
829
692
28,740
22,272
Accepted
Accepted
16.53
import itertools import sys from scipy.sparse.csgraph import csgraph_from_dense from scipy.sparse.csgraph import floyd_warshall input = sys.stdin.readline n, m, r = list(map(int, input().split())) visiting_town = list(map(int, input().split())) edges = [[float('INF')]*n for _ in range(n)] for i in range(m...
import itertools import sys from scipy.sparse.csgraph import csgraph_from_dense from scipy.sparse.csgraph import dijkstra input = sys.stdin.readline n, m, r = list(map(int, input().split())) visiting_town = list(map(int, input().split())) edges = [[float('INF')]*n for _ in range(n)] for i in range(m): ...
27
27
753
741
import itertools import sys from scipy.sparse.csgraph import csgraph_from_dense from scipy.sparse.csgraph import floyd_warshall input = sys.stdin.readline n, m, r = list(map(int, input().split())) visiting_town = list(map(int, input().split())) edges = [[float("INF")] * n for _ in range(n)] for i in range(m): a, b...
import itertools import sys from scipy.sparse.csgraph import csgraph_from_dense from scipy.sparse.csgraph import dijkstra input = sys.stdin.readline n, m, r = list(map(int, input().split())) visiting_town = list(map(int, input().split())) edges = [[float("INF")] * n for _ in range(n)] for i in range(m): a, b, c = ...
false
0
[ "-from scipy.sparse.csgraph import floyd_warshall", "+from scipy.sparse.csgraph import dijkstra", "-comp_dist = floyd_warshall(G, directed=False)", "+comp_dist = dijkstra(G, directed=False)" ]
false
0.521407
0.239188
2.17991
[ "s361156355", "s831152331" ]
u129459452
p02898
python
s813605240
s085664577
48
44
11,912
11,912
Accepted
Accepted
8.33
N, K=list(map(int, input().split())) H = list(map(int, input().split())) c = 0 for h in H: if h >=K: c += 1 print(c)
n,k=list(map(int,input().split())) h=list(map(int,input().split())) print((len([i for i in h if i>=k])))
7
3
128
98
N, K = list(map(int, input().split())) H = list(map(int, input().split())) c = 0 for h in H: if h >= K: c += 1 print(c)
n, k = list(map(int, input().split())) h = list(map(int, input().split())) print((len([i for i in h if i >= k])))
false
57.142857
[ "-N, K = list(map(int, input().split()))", "-H = list(map(int, input().split()))", "-c = 0", "-for h in H:", "- if h >= K:", "- c += 1", "-print(c)", "+n, k = list(map(int, input().split()))", "+h = list(map(int, input().split()))", "+print((len([i for i in h if i >= k])))" ]
false
0.042616
0.049022
0.869332
[ "s813605240", "s085664577" ]
u254871849
p02722
python
s094964684
s149459365
273
210
3,064
3,952
Accepted
Accepted
23.08
import sys from math import sqrt, floor def divisors(n): res = set() for i in range(1, floor(sqrt(n)) + 1): if n % i == 0: res.add(i) res.add(n // i) return res n = int(sys.stdin.readline().rstrip()) def main(): res = divisors(n - 1) cnt = len(res) -...
import sys from math import sqrt, floor def divisors(n): res = set() for i in range(1, floor(sqrt(n)) + 1): if n % i == 0: res.add(i) res.add(n // i) return res - set([1]) n = int(sys.stdin.readline().rstrip()) def main(): res = divisors(n - 1) cnt ...
27
27
583
562
import sys from math import sqrt, floor def divisors(n): res = set() for i in range(1, floor(sqrt(n)) + 1): if n % i == 0: res.add(i) res.add(n // i) return res n = int(sys.stdin.readline().rstrip()) def main(): res = divisors(n - 1) cnt = len(res) - 1 + 1 f...
import sys from math import sqrt, floor def divisors(n): res = set() for i in range(1, floor(sqrt(n)) + 1): if n % i == 0: res.add(i) res.add(n // i) return res - set([1]) n = int(sys.stdin.readline().rstrip()) def main(): res = divisors(n - 1) cnt = len(res) ...
false
0
[ "- return res", "+ return res - set([1])", "- cnt = len(res) - 1 + 1", "- for i in range(2, floor(sqrt(n)) + 1):", "+ cnt = len(res)", "+ for i in divisors(n):", "- if (m - 1) % i == 0:", "- cnt += 1", "+ if (m - 1) % i == 0:", "+ cnt +...
false
0.1989
0.05589
3.558769
[ "s094964684", "s149459365" ]
u945181840
p03816
python
s380915349
s135477683
106
66
14,452
18,648
Accepted
Accepted
37.74
from itertools import groupby N = int(eval(input())) A = list(map(int, input().split())) A.sort() a = [] for i, j in groupby(A): a.append(len(list(j))) def f(x): while x >= 3: x = x // 3 + x % 3 return x a = [f(i) for i in a] one = a.count(1) two = a.count(2) if two % 2 == ...
from collections import Counter N = int(eval(input())) A = list(map(int, input().split())) a = list(Counter(A).values()) def f(x): while x >= 3: x = x // 3 + x % 3 return x a = [f(i) for i in a] one = a.count(1) two = a.count(2) if two % 2 == 0: print((one + two)) else: p...
24
20
371
331
from itertools import groupby N = int(eval(input())) A = list(map(int, input().split())) A.sort() a = [] for i, j in groupby(A): a.append(len(list(j))) def f(x): while x >= 3: x = x // 3 + x % 3 return x a = [f(i) for i in a] one = a.count(1) two = a.count(2) if two % 2 == 0: print((one + t...
from collections import Counter N = int(eval(input())) A = list(map(int, input().split())) a = list(Counter(A).values()) def f(x): while x >= 3: x = x // 3 + x % 3 return x a = [f(i) for i in a] one = a.count(1) two = a.count(2) if two % 2 == 0: print((one + two)) else: print((one + two - 1...
false
16.666667
[ "-from itertools import groupby", "+from collections import Counter", "-A.sort()", "-a = []", "-for i, j in groupby(A):", "- a.append(len(list(j)))", "+a = list(Counter(A).values())" ]
false
0.036665
0.036681
0.999563
[ "s380915349", "s135477683" ]
u133936772
p02695
python
s507393483
s149238792
1,072
547
9,100
9,128
Accepted
Accepted
48.97
f=lambda:list(map(int,input().split())) n,m,q=f() lq=[tuple(f()) for _ in range(q)] ans=0 from itertools import * for t in combinations_with_replacement(list(range(m)),n): s=0 for a,b,c,d in lq: if t[b-1]-t[a-1]==c: s+=d ans=max(ans,s) print(ans)
f=lambda:list(map(int,input().split())) n,m,q=f() Q=[list(f())for _ in range(q)] from itertools import* print((max(sum(d for a,b,c,d in Q if l[b-1]-l[a-1]==c)for l in combinations_with_replacement(list(range(m)),n))))
11
5
254
207
f = lambda: list(map(int, input().split())) n, m, q = f() lq = [tuple(f()) for _ in range(q)] ans = 0 from itertools import * for t in combinations_with_replacement(list(range(m)), n): s = 0 for a, b, c, d in lq: if t[b - 1] - t[a - 1] == c: s += d ans = max(ans, s) print(ans)
f = lambda: list(map(int, input().split())) n, m, q = f() Q = [list(f()) for _ in range(q)] from itertools import * print( ( max( sum(d for a, b, c, d in Q if l[b - 1] - l[a - 1] == c) for l in combinations_with_replacement(list(range(m)), n) ) ) )
false
54.545455
[ "-lq = [tuple(f()) for _ in range(q)]", "-ans = 0", "+Q = [list(f()) for _ in range(q)]", "-for t in combinations_with_replacement(list(range(m)), n):", "- s = 0", "- for a, b, c, d in lq:", "- if t[b - 1] - t[a - 1] == c:", "- s += d", "- ans = max(ans, s)", "-print(ans...
false
0.053641
0.051375
1.044125
[ "s507393483", "s149238792" ]
u327466606
p02560
python
s851134290
s201578295
412
302
70,984
98,892
Accepted
Accepted
26.7
def floor_linear_sum(n,m,a,b): res = 0 while True: if a >= m: res += (n-1)*n*(a//m)//2 a %= m if b >= m: res += n * (b//m) b %= m y_max = (a*n+b)//m if y_max == 0: return res x_max = y_max*m-b ...
def floor_linear_sum(n,m,a,b): """ returns sum((a*i+b)//m for i in range(n)) """ res = 0 while True: if a >= m: res += (n-1)*n*(a//m)//2 a %= m if b >= m: res += n * (b//m) b %= m y_max = (a*n+b)//m if y_m...
20
28
502
653
def floor_linear_sum(n, m, a, b): res = 0 while True: if a >= m: res += (n - 1) * n * (a // m) // 2 a %= m if b >= m: res += n * (b // m) b %= m y_max = (a * n + b) // m if y_max == 0: return res x_max = y_max * ...
def floor_linear_sum(n, m, a, b): """ returns sum((a*i+b)//m for i in range(n)) """ res = 0 while True: if a >= m: res += (n - 1) * n * (a // m) // 2 a %= m if b >= m: res += n * (b // m) b %= m y_max = (a * n + b) // m ...
false
28.571429
[ "+ \"\"\"", "+ returns sum((a*i+b)//m for i in range(n))", "+ \"\"\"", "- x_max = y_max * m - b", "- res += (n - (x_max + a - 1) // a) * y_max", "- n, m, a, b = y_max, a, m, (a - x_max) % a", "+ nx_max = b - y_max * m", "+ res += (n + nx_max // a) * y_max", ...
false
0.037387
0.037254
1.003577
[ "s851134290", "s201578295" ]
u512212329
p02585
python
s445348238
s620877963
901
828
83,356
84,428
Accepted
Accepted
8.1
from itertools import accumulate def main(): cells, moves = [int(x) for x in input().split()] jumps_from = [int(x) - 1 for x in input().split()] score_on = [int(x) for x in input().split()] ans = - 10**10 for start in range(cells): route = [] route_append = route.append...
def main(): cells, can_jump = [int(x) for x in input().split()] jumps_from = [int(x) - 1 for x in input().split()] score_on = [int(x) for x in input().split()] ans = - 10**10 for start in range(cells): route = [] position = start while True: route.appen...
46
32
1,349
929
from itertools import accumulate def main(): cells, moves = [int(x) for x in input().split()] jumps_from = [int(x) - 1 for x in input().split()] score_on = [int(x) for x in input().split()] ans = -(10**10) for start in range(cells): route = [] route_append = route.append po...
def main(): cells, can_jump = [int(x) for x in input().split()] jumps_from = [int(x) - 1 for x in input().split()] score_on = [int(x) for x in input().split()] ans = -(10**10) for start in range(cells): route = [] position = start while True: route.append(score_on...
false
30.434783
[ "-from itertools import accumulate", "-", "-", "- cells, moves = [int(x) for x in input().split()]", "+ cells, can_jump = [int(x) for x in input().split()]", "- route_append = route.append", "- route_append(score_on[position])", "+ route.append(score_on[position])", ...
false
0.042885
0.082136
0.522121
[ "s445348238", "s620877963" ]
u471214054
p02720
python
s584307683
s928266805
239
181
45,404
40,560
Accepted
Accepted
24.27
import sys def is_lunlun(x): x_str = str(x) for i in range(len(x_str)-1): if abs(int(x_str[i]) - int(x_str[i+1])) > 1: return False return True def main(): k = int(eval(input())) lunlun_map = { 0: [0, 1], 1: [0, 1, 2], 2: [1, 2, 3], ...
# Assumed solution from collections import deque def main(): k = int(eval(input())) queue = deque() for i in range(1, 10): queue.append(i) l = 0 for _ in range(k): l = queue.popleft() r = l % 10 if r != 0: queue.append(l * 10 + r - 1)...
48
26
1,092
469
import sys def is_lunlun(x): x_str = str(x) for i in range(len(x_str) - 1): if abs(int(x_str[i]) - int(x_str[i + 1])) > 1: return False return True def main(): k = int(eval(input())) lunlun_map = { 0: [0, 1], 1: [0, 1, 2], 2: [1, 2, 3], 3: [2, ...
# Assumed solution from collections import deque def main(): k = int(eval(input())) queue = deque() for i in range(1, 10): queue.append(i) l = 0 for _ in range(k): l = queue.popleft() r = l % 10 if r != 0: queue.append(l * 10 + r - 1) queue.appen...
false
45.833333
[ "-import sys", "-", "-", "-def is_lunlun(x):", "- x_str = str(x)", "- for i in range(len(x_str) - 1):", "- if abs(int(x_str[i]) - int(x_str[i + 1])) > 1:", "- return False", "- return True", "+# Assumed solution", "+from collections import deque", "- lunlun_map = ...
false
0.062212
0.050325
1.236213
[ "s584307683", "s928266805" ]
u932719058
p03289
python
s584627980
s198470880
22
17
3,444
2,940
Accepted
Accepted
22.73
import copy s = list(eval(input())) Ccnt = 0 if s[0] == 'A' : for i in copy.copy(s[2:-1]) : if i == 'C' : Ccnt += 1 s.remove(i) s.remove(s[0]) if Ccnt == 1 and ''.join(s) == ''.join(s).lower() : print('AC') exit() print('WA')
s = eval(input()) Ccnt = 0 if s[0] == 'A' and s[2:-1].count('C') == 1 and s[1:].replace('C', '').islower(): print('AC') exit() print('WA')
13
6
246
169
import copy s = list(eval(input())) Ccnt = 0 if s[0] == "A": for i in copy.copy(s[2:-1]): if i == "C": Ccnt += 1 s.remove(i) s.remove(s[0]) if Ccnt == 1 and "".join(s) == "".join(s).lower(): print("AC") exit() print("WA")
s = eval(input()) Ccnt = 0 if s[0] == "A" and s[2:-1].count("C") == 1 and s[1:].replace("C", "").islower(): print("AC") exit() print("WA")
false
53.846154
[ "-import copy", "-", "-s = list(eval(input()))", "+s = eval(input())", "-if s[0] == \"A\":", "- for i in copy.copy(s[2:-1]):", "- if i == \"C\":", "- Ccnt += 1", "- s.remove(i)", "- s.remove(s[0])", "- if Ccnt == 1 and \"\".join(s) == \"\".join(s).lower():",...
false
0.046164
0.126985
0.363541
[ "s584627980", "s198470880" ]
u581187895
p03161
python
s814474089
s253337167
1,911
1,718
22,804
21,268
Accepted
Accepted
10.1
import sys input = sys.stdin.readline import numpy as np N, K = list(map(int, input().split())) h = list(map(int, input().split())) dp = np.zeros(N, dtype=int) h = np.array(h) for i in range(1, N): start = max(0, i-K) dp[i] = min(dp[start:i] + np.abs(h[i] - h[start:i])) print((dp[N-1]))
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]))
15
10
305
263
import sys input = sys.stdin.readline import numpy as np N, K = list(map(int, input().split())) h = list(map(int, input().split())) dp = np.zeros(N, dtype=int) h = np.array(h) for i in range(1, N): start = max(0, i - K) dp[i] = min(dp[start:i] + np.abs(h[i] - h[start:i])) print((dp[N - 1]))
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]))
false
33.333333
[ "-import sys", "-", "-input = sys.stdin.readline", "-h = list(map(int, input().split()))", "-dp = np.zeros(N, dtype=int)", "-h = np.array(h)", "+h = np.array(input().split(), dtype=\"int32\")", "+dp = np.zeros(N, dtype=\"int32\")", "- start = max(0, i - K)", "- dp[i] = min(dp[start:i] + np.a...
false
0.203154
0.32916
0.617189
[ "s814474089", "s253337167" ]
u633068244
p01268
python
s286473016
s678766805
240
200
9,024
9,028
Accepted
Accepted
16.67
import itertools r = 110000 s = int(r*0.5) p = [1] * r p[0] = 0 for i in range(1,s): if p[i]: p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] while 1: N,P = list(map(int,input().split())) if N == -1: break i = N + 1 prime = [0]*22 j = 0 while j < 22: if p[i-1] == 1: prime[j] = i j ...
import itertools r = 110000 s = int(r*0.5) p = [1] * r p[0] = 0 for i in range(1,s): if p[i]: p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] while 1: N,P = list(map(int,input().split())) if N == -1: break i = N + 1 prime = [0]*(13 + P/10) j = 0 while j < (13 + P/10): if p[i-1] == 1: p...
22
22
442
460
import itertools r = 110000 s = int(r * 0.5) p = [1] * r p[0] = 0 for i in range(1, s): if p[i]: p[2 * i + 1 :: i + 1] = [0 for x in range(2 * i + 1, r, i + 1)] while 1: N, P = list(map(int, input().split())) if N == -1: break i = N + 1 prime = [0] * 22 j = 0 while j < 22: ...
import itertools r = 110000 s = int(r * 0.5) p = [1] * r p[0] = 0 for i in range(1, s): if p[i]: p[2 * i + 1 :: i + 1] = [0 for x in range(2 * i + 1, r, i + 1)] while 1: N, P = list(map(int, input().split())) if N == -1: break i = N + 1 prime = [0] * (13 + P / 10) j = 0 whil...
false
0
[ "- prime = [0] * 22", "+ prime = [0] * (13 + P / 10)", "- while j < 22:", "+ while j < (13 + P / 10):" ]
false
0.090259
0.088138
1.024064
[ "s286473016", "s678766805" ]
u887207211
p03779
python
s632335997
s048813475
27
22
3,060
3,060
Accepted
Accepted
18.52
import sys stdin = sys.stdin ns = lambda : stdin.readline().rstrip() na = lambda : list(map(int, stdin.readline().split())) ni = lambda : int(ns()) def main(): n = ni() f = lambda x: (x * (x+1)) // 2 for i in range(1, n+1): if (f(i) >= n): print(i) return main()
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() t = 0 for i in range(1, n + 1): t += i if t >= n: print(i) return main()
15
17
294
286
import sys stdin = sys.stdin ns = lambda: stdin.readline().rstrip() na = lambda: list(map(int, stdin.readline().split())) ni = lambda: int(ns()) def main(): n = ni() f = lambda x: (x * (x + 1)) // 2 for i in range(1, n + 1): if f(i) >= n: print(i) return main()
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() t = 0 for i in range(1, n + 1): t += i if t >= n: print(i) return main()
false
11.764706
[ "+ni = lambda: int(ns())", "-ni = lambda: int(ns())", "- f = lambda x: (x * (x + 1)) // 2", "+ t = 0", "- if f(i) >= n:", "+ t += i", "+ if t >= n:" ]
false
0.180077
0.172661
1.04295
[ "s632335997", "s048813475" ]
u252828980
p02623
python
s849690297
s720569804
315
280
40,616
40,444
Accepted
Accepted
11.11
n,m,k = list(map(int,input().split())) a = list(map(int,input().split())) b = list(map(int,input().split())) for i in range(1,n): a[i] += a[i-1] for i in range(1,m): b[i] += b[i-1] a = [0]+a b = [0]+b ans = 0 ALL = 0 from bisect import bisect for i in range(n+1): ALL = a[i] if ALL > k: ...
n,m,k = list(map(int,input().split())) a = list(map(int,input().split())) b = list(map(int,input().split())) for i in range(1,n): a[i] += a[i-1] for i in range(1,m): b[i] += b[i-1] a = [0]+a b = [0]+b ans = 0 ALL = 0 j = m for i in range(n+1): if a[i] > k: continue else: ...
22
22
439
394
n, m, k = list(map(int, input().split())) a = list(map(int, input().split())) b = list(map(int, input().split())) for i in range(1, n): a[i] += a[i - 1] for i in range(1, m): b[i] += b[i - 1] a = [0] + a b = [0] + b ans = 0 ALL = 0 from bisect import bisect for i in range(n + 1): ALL = a[i] if ALL > k:...
n, m, k = list(map(int, input().split())) a = list(map(int, input().split())) b = list(map(int, input().split())) for i in range(1, n): a[i] += a[i - 1] for i in range(1, m): b[i] += b[i - 1] a = [0] + a b = [0] + b ans = 0 ALL = 0 j = m for i in range(n + 1): if a[i] > k: continue else: ...
false
0
[ "-from bisect import bisect", "-", "+j = m", "- ALL = a[i]", "- if ALL > k:", "+ if a[i] > k:", "- idx = bisect(b, k - ALL)", "- # print(i,ALL,idx)", "- ans = max(ans, i + idx - 1)", "+ while k - a[i] < b[j]:", "+ j -= 1", "+ ans = max(ans, i ...
false
0.040271
0.04325
0.931122
[ "s849690297", "s720569804" ]
u305366205
p02779
python
s054400134
s736241603
122
109
26,804
25,324
Accepted
Accepted
10.66
n = int(eval(input())) a = list(map(int, input().split())) now = set([]) for i in a: if i in now: print('NO') exit() now.add(i) print('YES')
n = int(eval(input())) a = list(map(int, input().split())) now = set() for i in a: now.add(i) if len(now) == n: print('YES') else: print('NO')
9
9
166
156
n = int(eval(input())) a = list(map(int, input().split())) now = set([]) for i in a: if i in now: print("NO") exit() now.add(i) print("YES")
n = int(eval(input())) a = list(map(int, input().split())) now = set() for i in a: now.add(i) if len(now) == n: print("YES") else: print("NO")
false
0
[ "-now = set([])", "+now = set()", "- if i in now:", "- print(\"NO\")", "- exit()", "-print(\"YES\")", "+if len(now) == n:", "+ print(\"YES\")", "+else:", "+ print(\"NO\")" ]
false
0.101422
0.100975
1.004429
[ "s054400134", "s736241603" ]
u225388820
p02588
python
s729023651
s230230903
714
617
88,204
94,348
Accepted
Accepted
13.59
class BIT: def __init__(self, n): #A1 ... AnใฎBIT(1-indexed) self.BIT = [0] * (n + 1) self.n = n #A1 ~ Aiใพใงใฎๅ’Œ O(logN) def query(self, idx): res_sum = 0 while idx > 0: res_sum += self.BIT[idx] idx -= idx & (-idx) return res_s...
class BIT: def __init__(self, n): #A1 ... AnใฎBIT(1-indexed) self.BIT = [0] * (n + 1) self.n = n #A1 ~ Aiใพใงใฎๅ’Œ O(logN) def query(self, idx): res_sum = 0 while idx > 0: res_sum += self.BIT[idx] idx -= idx & (-idx) return res_s...
54
54
1,192
1,188
class BIT: def __init__(self, n): # A1 ... AnใฎBIT(1-indexed) self.BIT = [0] * (n + 1) self.n = n # A1 ~ Aiใพใงใฎๅ’Œ O(logN) def query(self, idx): res_sum = 0 while idx > 0: res_sum += self.BIT[idx] idx -= idx & (-idx) return res_sum # ...
class BIT: def __init__(self, n): # A1 ... AnใฎBIT(1-indexed) self.BIT = [0] * (n + 1) self.n = n # A1 ~ Aiใพใงใฎๅ’Œ O(logN) def query(self, idx): res_sum = 0 while idx > 0: res_sum += self.BIT[idx] idx -= idx & (-idx) return res_sum # ...
false
0
[ "-t = BIT(200)", "+t = BIT(50)", "- t.add(-p[j][1] + 100, 1)", "+ t.add(-p[j][1] + 25, 1)", "- t.add(-p[i][1] + 100, -1)", "- ans += max(0, t.query(100 + p[i][1]))", "+ t.add(-p[i][1] + 25, -1)", "+ ans += max(0, t.query(25 + p[i][1]))" ]
false
0.045045
0.041517
1.084966
[ "s729023651", "s230230903" ]
u941438707
p02873
python
s287693768
s927299254
369
333
23,336
23,336
Accepted
Accepted
9.76
s=eval(input()) n=len(s) a=[0]*(n+1) for i in range(n): if s[i]=="<": a[i+1]=a[i]+1 for i in reversed(list(range(n))): if s[i]==">": a[i]=max(a[i+1]+1,a[i]) print((sum(a)))
s=eval(input()) n=len(s) a=[0]*(n+1) for i in range(n): if s[i]=="<": a[i+1]=a[i]+1 for i in range(n)[::-1]: if s[i]==">": a[i]=max(a[i+1]+1,a[i]) print((sum(a)))
10
10
192
187
s = eval(input()) n = len(s) a = [0] * (n + 1) for i in range(n): if s[i] == "<": a[i + 1] = a[i] + 1 for i in reversed(list(range(n))): if s[i] == ">": a[i] = max(a[i + 1] + 1, a[i]) print((sum(a)))
s = eval(input()) n = len(s) a = [0] * (n + 1) for i in range(n): if s[i] == "<": a[i + 1] = a[i] + 1 for i in range(n)[::-1]: if s[i] == ">": a[i] = max(a[i + 1] + 1, a[i]) print((sum(a)))
false
0
[ "-for i in reversed(list(range(n))):", "+for i in range(n)[::-1]:" ]
false
0.035198
0.039202
0.897855
[ "s287693768", "s927299254" ]
u970197315
p02972
python
s732695327
s915325390
737
556
14,032
17,628
Accepted
Accepted
24.56
n=int(eval(input())) a=[0]+list(map(int,input().split())) b=[] c=[0]*(n+1) for i in range(n,0,-1): cnt=0 t=i while t<=n: cnt+=c[t] t+=i if cnt%2!=a[i]: c[i]=1 b.append(i) b.sort() if len(b)>0: print((len(b))) print((*b)) else: print((0))
n=int(eval(input())) a=[0]+list(map(int,input().split())) b=[0]*(n+1) for i in range(n,0,-1): s=0 t=i while t<=n: s+=b[t] t+=i if s%2==a[i]: pass else: b[i]=1 ans=0 c=[] for i,bb in enumerate(b): if bb>0: ans+=bb c.append(i) if ans>0: print(ans) print((*c)) ...
20
24
278
329
n = int(eval(input())) a = [0] + list(map(int, input().split())) b = [] c = [0] * (n + 1) for i in range(n, 0, -1): cnt = 0 t = i while t <= n: cnt += c[t] t += i if cnt % 2 != a[i]: c[i] = 1 b.append(i) b.sort() if len(b) > 0: print((len(b))) print((*b)) else: ...
n = int(eval(input())) a = [0] + list(map(int, input().split())) b = [0] * (n + 1) for i in range(n, 0, -1): s = 0 t = i while t <= n: s += b[t] t += i if s % 2 == a[i]: pass else: b[i] = 1 ans = 0 c = [] for i, bb in enumerate(b): if bb > 0: ans += bb ...
false
16.666667
[ "-b = []", "-c = [0] * (n + 1)", "+b = [0] * (n + 1)", "- cnt = 0", "+ s = 0", "- cnt += c[t]", "+ s += b[t]", "- if cnt % 2 != a[i]:", "- c[i] = 1", "- b.append(i)", "-b.sort()", "-if len(b) > 0:", "- print((len(b)))", "- print((*b))", "+ if...
false
0.046157
0.04632
0.996469
[ "s732695327", "s915325390" ]
u254871849
p03078
python
s518440189
s785699428
1,496
419
162,524
67,256
Accepted
Accepted
71.99
import sys from heapq import heappush, heappop x, y, z, k = map(int ,sys.stdin.readline().split()) a, b, c = (sorted(map(int, sys.stdin.readline().split())) for _ in range(3)) def main(): res = [] for i in range(x): for j in range(y): heappush(res, -(a[i] + b[j])) res2...
import sys import numpy as np x, y, z, k = map(int, sys.stdin.readline().split()) a, b, c = (np.array(sys.stdin.readline().split(), dtype=np.int64) for _ in range(3)) def main(): res = np.sort(np.ravel(a[:, None] + b))[::-1] res = np.sort(np.ravel(c[:, None] + res[:min(k, x*y)]))[::-1] return res...
24
14
594
399
import sys from heapq import heappush, heappop x, y, z, k = map(int, sys.stdin.readline().split()) a, b, c = (sorted(map(int, sys.stdin.readline().split())) for _ in range(3)) def main(): res = [] for i in range(x): for j in range(y): heappush(res, -(a[i] + b[j])) res2 = [] for i ...
import sys import numpy as np x, y, z, k = map(int, sys.stdin.readline().split()) a, b, c = (np.array(sys.stdin.readline().split(), dtype=np.int64) for _ in range(3)) def main(): res = np.sort(np.ravel(a[:, None] + b))[::-1] res = np.sort(np.ravel(c[:, None] + res[: min(k, x * y)]))[::-1] return res[:k] ...
false
41.666667
[ "-from heapq import heappush, heappop", "+import numpy as np", "-a, b, c = (sorted(map(int, sys.stdin.readline().split())) for _ in range(3))", "+a, b, c = (np.array(sys.stdin.readline().split(), dtype=np.int64) for _ in range(3))", "- res = []", "- for i in range(x):", "- for j in range(y)...
false
0.00709
0.221974
0.031941
[ "s518440189", "s785699428" ]
u363610900
p04029
python
s302042253
s887916909
20
17
2,940
2,940
Accepted
Accepted
15
N = int(eval(input())) result = N * (1 + N) // 2 print(result)
N = int(eval(input())) print((N*(1+N)//2))
3
2
58
35
N = int(eval(input())) result = N * (1 + N) // 2 print(result)
N = int(eval(input())) print((N * (1 + N) // 2))
false
33.333333
[ "-result = N * (1 + N) // 2", "-print(result)", "+print((N * (1 + N) // 2))" ]
false
0.038521
0.041094
0.937384
[ "s302042253", "s887916909" ]
u644972721
p02572
python
s712469104
s106137971
127
116
104,236
94,276
Accepted
Accepted
8.66
n = int(eval(input())) a = list(map(int, input().split())) s = sum(a) ans = 0 mod = pow(10, 9) + 7 for i in a: s -= i ans = (ans + s * i) % mod print(ans)
n = int(eval(input())) a = list(map(int, input().split())) mod = pow(10, 9) + 7 s = sum(a) % mod ans = s * s % mod for i in a: ans -= i * i ans %= mod ans = ans * pow(2, mod - 2, mod) % mod print(ans)
9
10
164
211
n = int(eval(input())) a = list(map(int, input().split())) s = sum(a) ans = 0 mod = pow(10, 9) + 7 for i in a: s -= i ans = (ans + s * i) % mod print(ans)
n = int(eval(input())) a = list(map(int, input().split())) mod = pow(10, 9) + 7 s = sum(a) % mod ans = s * s % mod for i in a: ans -= i * i ans %= mod ans = ans * pow(2, mod - 2, mod) % mod print(ans)
false
10
[ "-s = sum(a)", "-ans = 0", "+s = sum(a) % mod", "+ans = s * s % mod", "- s -= i", "- ans = (ans + s * i) % mod", "+ ans -= i * i", "+ ans %= mod", "+ans = ans * pow(2, mod - 2, mod) % mod" ]
false
0.074096
0.036935
2.006135
[ "s712469104", "s106137971" ]
u358254559
p02727
python
s767133961
s025734884
1,448
355
128,100
110,444
Accepted
Accepted
75.48
x,y,a,b,c = list(map(int, input().split())) p = list(map(int, input().split())) q = list(map(int, input().split())) r = list(map(int, input().split())) apples=[] for i in range(a): apples.append([p[i],0]) for i in range(b): apples.append([q[i],1]) for i in range(c): apples.append([r[i],2]) ap...
x,y,a,b,c = list(map(int, input().split())) p = list(map(int, input().split())) q = list(map(int, input().split())) r = list(map(int, input().split())) p.sort(reverse=True) q.sort(reverse=True) apples=[] apples.extend(p[:x]) apples.extend(q[:y]) apples.extend(r) apples.sort(reverse=True) print((sum(a...
29
16
567
326
x, y, a, b, c = list(map(int, input().split())) p = list(map(int, input().split())) q = list(map(int, input().split())) r = list(map(int, input().split())) apples = [] for i in range(a): apples.append([p[i], 0]) for i in range(b): apples.append([q[i], 1]) for i in range(c): apples.append([r[i], 2]) apples.s...
x, y, a, b, c = list(map(int, input().split())) p = list(map(int, input().split())) q = list(map(int, input().split())) r = list(map(int, input().split())) p.sort(reverse=True) q.sort(reverse=True) apples = [] apples.extend(p[:x]) apples.extend(q[:y]) apples.extend(r) apples.sort(reverse=True) print((sum(apples[: x + y...
false
44.827586
[ "+p.sort(reverse=True)", "+q.sort(reverse=True)", "-for i in range(a):", "- apples.append([p[i], 0])", "-for i in range(b):", "- apples.append([q[i], 1])", "-for i in range(c):", "- apples.append([r[i], 2])", "+apples.extend(p[:x])", "+apples.extend(q[:y])", "+apples.extend(r)", "-mx_...
false
0.041015
0.04014
1.021808
[ "s767133961", "s025734884" ]
u156896646
p03478
python
s444523839
s511552364
37
32
3,060
3,060
Accepted
Accepted
13.51
N, A, B = list(map(int, input().split())) tot = 0 for i in range(1, N+1): s = 0 for c in list(str(i)): s += int(c) if A<= s <=B: tot += i print(tot)
N, A, B = list(map(int, input().split())) tot = 0 for i in range(1, N+1): q = i s = 0 while q > 0: q, r = divmod(q, 10) #;print(i, q, r, s) s += r if A<= s <=B: tot += i #;print(i) print(tot)
10
13
180
262
N, A, B = list(map(int, input().split())) tot = 0 for i in range(1, N + 1): s = 0 for c in list(str(i)): s += int(c) if A <= s <= B: tot += i print(tot)
N, A, B = list(map(int, input().split())) tot = 0 for i in range(1, N + 1): q = i s = 0 while q > 0: q, r = divmod(q, 10) # ;print(i, q, r, s) s += r if A <= s <= B: tot += i # ;print(i) print(tot)
false
23.076923
[ "+ q = i", "- for c in list(str(i)):", "- s += int(c)", "+ while q > 0:", "+ q, r = divmod(q, 10) # ;print(i, q, r, s)", "+ s += r", "- tot += i", "+ tot += i # ;print(i)" ]
false
0.080701
0.108504
0.743759
[ "s444523839", "s511552364" ]
u271934630
p03805
python
s614563316
s205951903
180
27
39,920
3,064
Accepted
Accepted
85
import itertools n, m = list(map(int, input().split())) path = [[False] * n for i in range(n)] for i in range(m): a, b = list(map(int, input().split())) a -= 1 b -= 1 path[a][b] = True path[b][a] = True ans = 0 for i in itertools.permutations(list(range(n)), n): # ้ ‚็‚น1ใŒๅง‹็‚น ...
def main(): N, M = list(map(int, input().split())) matrix = [[0] * N for _ in range(N)] for _ in range(M): a, b = list(map(int, input().split())) matrix[a-1][b-1] = 1 matrix[b-1][a-1] = 1 def dfs(v, used): if False not in used: return 1 ...
25
34
504
687
import itertools n, m = list(map(int, input().split())) path = [[False] * n for i in range(n)] for i in range(m): a, b = list(map(int, input().split())) a -= 1 b -= 1 path[a][b] = True path[b][a] = True ans = 0 for i in itertools.permutations(list(range(n)), n): # ้ ‚็‚น1ใŒๅง‹็‚น if i[0] == 0: ...
def main(): N, M = list(map(int, input().split())) matrix = [[0] * N for _ in range(N)] for _ in range(M): a, b = list(map(int, input().split())) matrix[a - 1][b - 1] = 1 matrix[b - 1][a - 1] = 1 def dfs(v, used): if False not in used: return 1 ans = ...
false
26.470588
[ "-import itertools", "+def main():", "+ N, M = list(map(int, input().split()))", "+ matrix = [[0] * N for _ in range(N)]", "+ for _ in range(M):", "+ a, b = list(map(int, input().split()))", "+ matrix[a - 1][b - 1] = 1", "+ matrix[b - 1][a - 1] = 1", "-n, m = list(map(i...
false
0.068618
0.036579
1.875902
[ "s614563316", "s205951903" ]
u171065106
p03612
python
s373697115
s688807068
66
61
20,536
20,584
Accepted
Accepted
7.58
n = int(eval(input())) p = list(map(int, input().split())) cnt = 0 increased = False for i in range(n): if increased: increased = False continue if p[i] == i+1: cnt += 1 i += 1 increased = True print(cnt)
n = int(eval(input())) p = list(map(int, input().split())) cnt = 0 increased = False for i in range(n): if increased: increased = False elif p[i] == i+1: cnt += 1 increased = True print(cnt)
16
15
264
235
n = int(eval(input())) p = list(map(int, input().split())) cnt = 0 increased = False for i in range(n): if increased: increased = False continue if p[i] == i + 1: cnt += 1 i += 1 increased = True print(cnt)
n = int(eval(input())) p = list(map(int, input().split())) cnt = 0 increased = False for i in range(n): if increased: increased = False elif p[i] == i + 1: cnt += 1 increased = True print(cnt)
false
6.25
[ "- continue", "- if p[i] == i + 1:", "+ elif p[i] == i + 1:", "- i += 1" ]
false
0.068979
0.091103
0.757149
[ "s373697115", "s688807068" ]
u698868214
p03031
python
s695081449
s292153437
143
49
73,072
9,056
Accepted
Accepted
65.73
N,M = list(map(int,input().split())) S = [list(map(int,input().split())) for _ in range(M)] P = list(map(int,input().split())) ans = 0 for i in range(2**N): count = 0 on_or_off = [0]*M for j in range(N): if (i>>j)&1: for k in range(M): if j+1 in S[k][1:]: on_or_off[k] += 1 ...
N,M = list(map(int,input().split())) ks = [list(map(int,input().split())) for _ in range(M)] P = list(map(int,input().split())) ans = 0 for i in range(2**N): on_or_off = [0]*M for j in range(N): if (i>>j)&1: for k in range(M): if j+1 in ks[k][1:]: on_or_off[k] += 1 cnt = 0...
18
19
428
426
N, M = list(map(int, input().split())) S = [list(map(int, input().split())) for _ in range(M)] P = list(map(int, input().split())) ans = 0 for i in range(2**N): count = 0 on_or_off = [0] * M for j in range(N): if (i >> j) & 1: for k in range(M): if j + 1 in S[k][1:]: ...
N, M = list(map(int, input().split())) ks = [list(map(int, input().split())) for _ in range(M)] P = list(map(int, input().split())) ans = 0 for i in range(2**N): on_or_off = [0] * M for j in range(N): if (i >> j) & 1: for k in range(M): if j + 1 in ks[k][1:]: ...
false
5.263158
[ "-S = [list(map(int, input().split())) for _ in range(M)]", "+ks = [list(map(int, input().split())) for _ in range(M)]", "- count = 0", "- if j + 1 in S[k][1:]:", "+ if j + 1 in ks[k][1:]:", "+ cnt = 0", "- count += 1", "- if count == M:", "+ ...
false
0.041231
0.039992
1.030985
[ "s695081449", "s292153437" ]
u077291787
p03162
python
s313934139
s813752799
380
211
71,516
35,636
Accepted
Accepted
44.47
# dpC import sys input = sys.stdin.readline def main(): n = int(eval(input())) A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n)) dp = [[0] * 3 for _ in range(n)] dp[0] = A[0] for i in range(1, n): # i-th day for j in range(3): # today for k in r...
# C - Vacation def main(): N, *ABC = list(map(int, open(0).read().split())) prev = ABC[:3] for a, b, c in zip(*[iter(ABC[3:])] * 3): cur = [0] * 3 cur[0] = max(prev[1:]) + a cur[1] = max(prev[0], prev[2]) + b cur[2] = max(prev[:2]) + c prev = cur print((...
19
15
501
368
# dpC import sys input = sys.stdin.readline def main(): n = int(eval(input())) A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n)) dp = [[0] * 3 for _ in range(n)] dp[0] = A[0] for i in range(1, n): # i-th day for j in range(3): # today for k in range(3): ...
# C - Vacation def main(): N, *ABC = list(map(int, open(0).read().split())) prev = ABC[:3] for a, b, c in zip(*[iter(ABC[3:])] * 3): cur = [0] * 3 cur[0] = max(prev[1:]) + a cur[1] = max(prev[0], prev[2]) + b cur[2] = max(prev[:2]) + c prev = cur print((max(prev))...
false
21.052632
[ "-# dpC", "-import sys", "-", "-input = sys.stdin.readline", "-", "-", "+# C - Vacation", "- n = int(eval(input()))", "- A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))", "- dp = [[0] * 3 for _ in range(n)]", "- dp[0] = A[0]", "- for i in range(1, n): # i...
false
0.040925
0.046315
0.883634
[ "s313934139", "s813752799" ]
u227082700
p03618
python
s468329123
s601707906
41
32
3,500
5,096
Accepted
Accepted
21.95
s=eval(input()) l=len(s) t="abcdefghijklmnopqrstuvwxyz" d={} for i in t:d[i]=0 for i in s:d[i]+=1 a=l*(l-1)//2 for i in t:a-=d[i]*(d[i]-1)//2 print((a+1))
a=eval(input()) n=len(a) ans=n*(n-1)//2 from collections import Counter d=Counter(list(a)) for i in d:ans-=d[i]*(d[i]-1)//2 print((ans+1))
9
7
154
136
s = eval(input()) l = len(s) t = "abcdefghijklmnopqrstuvwxyz" d = {} for i in t: d[i] = 0 for i in s: d[i] += 1 a = l * (l - 1) // 2 for i in t: a -= d[i] * (d[i] - 1) // 2 print((a + 1))
a = eval(input()) n = len(a) ans = n * (n - 1) // 2 from collections import Counter d = Counter(list(a)) for i in d: ans -= d[i] * (d[i] - 1) // 2 print((ans + 1))
false
22.222222
[ "-s = eval(input())", "-l = len(s)", "-t = \"abcdefghijklmnopqrstuvwxyz\"", "-d = {}", "-for i in t:", "- d[i] = 0", "-for i in s:", "- d[i] += 1", "-a = l * (l - 1) // 2", "-for i in t:", "- a -= d[i] * (d[i] - 1) // 2", "-print((a + 1))", "+a = eval(input())", "+n = len(a)", "...
false
0.041294
0.099447
0.415233
[ "s468329123", "s601707906" ]
u677121387
p02695
python
s172926483
s018849507
1,195
604
9,200
9,220
Accepted
Accepted
49.46
from itertools import combinations_with_replacement as comb n,m,q = list(map(int,input().split())) ans = 0 query = [[int(i) for i in input().split()] for _ in range(q)] for A in comb(list(range(1,m+1)),n): cnt = 0 for i in range(q): a,b,c,d = query[i] if A[b-1]-A[a-1] == c: cnt += d ...
import sys sys.setrecursionlimit(10**9) n,m,q = list(map(int,input().split())) query = [[int(i) for i in input().split()] for _ in range(q)] def f(A): if len(A) == n+1: # print(A) cnt = 0 for i in range(q): a,b,c,d = query[i] if A[b]-A[a] == c: cnt += d ...
11
19
340
442
from itertools import combinations_with_replacement as comb n, m, q = list(map(int, input().split())) ans = 0 query = [[int(i) for i in input().split()] for _ in range(q)] for A in comb(list(range(1, m + 1)), n): cnt = 0 for i in range(q): a, b, c, d = query[i] if A[b - 1] - A[a - 1] == c: ...
import sys sys.setrecursionlimit(10**9) n, m, q = list(map(int, input().split())) query = [[int(i) for i in input().split()] for _ in range(q)] def f(A): if len(A) == n + 1: # print(A) cnt = 0 for i in range(q): a, b, c, d = query[i] if A[b] - A[a] == c: ...
false
42.105263
[ "-from itertools import combinations_with_replacement as comb", "+import sys", "+sys.setrecursionlimit(10**9)", "-ans = 0", "-for A in comb(list(range(1, m + 1)), n):", "- cnt = 0", "- for i in range(q):", "- a, b, c, d = query[i]", "- if A[b - 1] - A[a - 1] == c:", "- ...
false
0.04753
0.053214
0.893179
[ "s172926483", "s018849507" ]
u836737505
p03457
python
s348024658
s892950450
605
393
46,228
3,064
Accepted
Accepted
35.04
n = int(eval(input())) a0 = [0,0,0] ans = "Yes" for i in range(n): ai = list(map(int,input().split())) t = ai[0] - a0[0] d = abs(ai[1] - a0[1])+ abs(ai[2] - a0[2]) if t < d or t%2 != d%2: ans = "No" a0 = ai print(ans)
n = int(eval(input())) t0,x0,y0 = 0,0,0 for i in range(n): t,x,y = list(map(int, input().split())) if abs(t0-t)%2 != (abs(x0-x)+abs(y0-y))%2 or (abs(x0-x)+abs(y0-y)) > abs(t0-t): print("No") exit() t0,x0,y0, = t,x,y else: print("Yes")
11
10
249
263
n = int(eval(input())) a0 = [0, 0, 0] ans = "Yes" for i in range(n): ai = list(map(int, input().split())) t = ai[0] - a0[0] d = abs(ai[1] - a0[1]) + abs(ai[2] - a0[2]) if t < d or t % 2 != d % 2: ans = "No" a0 = ai print(ans)
n = int(eval(input())) t0, x0, y0 = 0, 0, 0 for i in range(n): t, x, y = list(map(int, input().split())) if abs(t0 - t) % 2 != (abs(x0 - x) + abs(y0 - y)) % 2 or ( abs(x0 - x) + abs(y0 - y) ) > abs(t0 - t): print("No") exit() t0, x0, y0, = ( t, x, y, )...
false
9.090909
[ "-a0 = [0, 0, 0]", "-ans = \"Yes\"", "+t0, x0, y0 = 0, 0, 0", "- ai = list(map(int, input().split()))", "- t = ai[0] - a0[0]", "- d = abs(ai[1] - a0[1]) + abs(ai[2] - a0[2])", "- if t < d or t % 2 != d % 2:", "- ans = \"No\"", "- a0 = ai", "-print(ans)", "+ t, x, y = lis...
false
0.036392
0.038714
0.940038
[ "s348024658", "s892950450" ]
u600402037
p02835
python
s181380279
s360675930
20
17
2,940
2,940
Accepted
Accepted
15
import sys stdin = sys.stdin ri = lambda: int(rs()) rl = lambda: list(map(int, stdin.readline().split())) rs = lambda: stdin.readline().rstrip() # ignore trailing spaces a, b, c = rl() answer = a + b + c print(('bust' if answer >= 22 else 'win'))
import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) total = sum(lr()) print(('bust' if total >= 22 else 'win')) # 44
13
9
264
191
import sys stdin = sys.stdin ri = lambda: int(rs()) rl = lambda: list(map(int, stdin.readline().split())) rs = lambda: stdin.readline().rstrip() # ignore trailing spaces a, b, c = rl() answer = a + b + c print(("bust" if answer >= 22 else "win"))
import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) total = sum(lr()) print(("bust" if total >= 22 else "win")) # 44
false
30.769231
[ "-stdin = sys.stdin", "-ri = lambda: int(rs())", "-rl = lambda: list(map(int, stdin.readline().split()))", "-rs = lambda: stdin.readline().rstrip() # ignore trailing spaces", "-a, b, c = rl()", "-answer = a + b + c", "-print((\"bust\" if answer >= 22 else \"win\"))", "+sr = lambda: sys.stdin.readline...
false
0.038574
0.037723
1.022556
[ "s181380279", "s360675930" ]
u225388820
p02629
python
s452923978
s230142246
77
31
61,872
9,172
Accepted
Accepted
59.74
al = ["Q"] + [chr(ord('a') + i) for i in range(26)] n = int(eval(input())) s = "" while n: if n % 26: a = n % 26 n //= 26 else: a = 26 n //= 26 n -= 1 s += al[a] print((s[::-1]))
al = [chr(ord('a') + i) for i in range(26)] n = int(eval(input())) s = "" while n: s += al[n % 26 - 1] n = (n - 1) // 26 print((s[::-1]))
13
7
234
143
al = ["Q"] + [chr(ord("a") + i) for i in range(26)] n = int(eval(input())) s = "" while n: if n % 26: a = n % 26 n //= 26 else: a = 26 n //= 26 n -= 1 s += al[a] print((s[::-1]))
al = [chr(ord("a") + i) for i in range(26)] n = int(eval(input())) s = "" while n: s += al[n % 26 - 1] n = (n - 1) // 26 print((s[::-1]))
false
46.153846
[ "-al = [\"Q\"] + [chr(ord(\"a\") + i) for i in range(26)]", "+al = [chr(ord(\"a\") + i) for i in range(26)]", "- if n % 26:", "- a = n % 26", "- n //= 26", "- else:", "- a = 26", "- n //= 26", "- n -= 1", "- s += al[a]", "+ s += al[n % 26 - 1]", "...
false
0.058321
0.058385
0.998906
[ "s452923978", "s230142246" ]
u625046108
p03575
python
s897169111
s245929470
269
92
73,824
67,108
Accepted
Accepted
65.8
class UnionFind(): def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: self.parents[x] = self.find(self.parents[x]) return self.parents[x] def union(self, x, y): x = self.find(x) y = self.find...
from collections import deque N, M = list(map(int, input().split())) edges = [list(map(int, input().split())) for _ in range(M)] od = [-1]*(N+1) low = [-1]*(N+1) pa = [0]*(N+1) od[1] = 0 low[1] = 0 pa[1] = 1 ni = {i:[] for i in range(1,N+1)} for i in range(M): ni[edges[i][0]].append(edges[i][1]) n...
64
47
1,380
883
class UnionFind: def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: self.parents[x] = self.find(self.parents[x]) return self.parents[x] def union(self, x, y): x = se...
from collections import deque N, M = list(map(int, input().split())) edges = [list(map(int, input().split())) for _ in range(M)] od = [-1] * (N + 1) low = [-1] * (N + 1) pa = [0] * (N + 1) od[1] = 0 low[1] = 0 pa[1] = 1 ni = {i: [] for i in range(1, N + 1)} for i in range(M): ni[edges[i][0]].append(edges[i][1]) ...
false
26.5625
[ "-class UnionFind:", "- def __init__(self, n):", "- self.n = n", "- self.parents = [-1] * n", "-", "- def find(self, x):", "- if self.parents[x] < 0:", "- return x", "- else:", "- self.parents[x] = self.find(self.parents[x])", "- ...
false
0.090962
0.113898
0.798621
[ "s897169111", "s245929470" ]
u812576525
p03243
python
s665044018
s232661114
21
17
2,940
2,940
Accepted
Accepted
19.05
N= int(eval(input())) A = [111, 222, 333, 444, 555, 666, 777, 888, 999] for i in A: if N==i: print(i) break elif N > i: continue elif N <= i: print(i) break
n=int(eval(input())) for i in range(n,1000): if str(i)[0] == str(i)[1] == str(i)[2]: print(i) exit()
14
5
230
118
N = int(eval(input())) A = [111, 222, 333, 444, 555, 666, 777, 888, 999] for i in A: if N == i: print(i) break elif N > i: continue elif N <= i: print(i) break
n = int(eval(input())) for i in range(n, 1000): if str(i)[0] == str(i)[1] == str(i)[2]: print(i) exit()
false
64.285714
[ "-N = int(eval(input()))", "-A = [111, 222, 333, 444, 555, 666, 777, 888, 999]", "-for i in A:", "- if N == i:", "+n = int(eval(input()))", "+for i in range(n, 1000):", "+ if str(i)[0] == str(i)[1] == str(i)[2]:", "- break", "- elif N > i:", "- continue", "- elif N <= i...
false
0.042238
0.04147
1.018522
[ "s665044018", "s232661114" ]
u624475441
p03680
python
s612449846
s584922747
180
56
7,852
7,068
Accepted
Accepted
68.89
N = int(eval(input())) a = [int(eval(input())) - 1 for _ in [0]*N] cur = 0 cnt = -1 for i in range(N): cur = a[cur] if cur == 1: cnt = i + 1 break print(cnt)
import sys e = list(map(int,sys.stdin)) cur = e[1] for i in range(e[0]): if cur == 2: print((i + 1)) break cur = e[cur] else: print((-1))
10
10
178
170
N = int(eval(input())) a = [int(eval(input())) - 1 for _ in [0] * N] cur = 0 cnt = -1 for i in range(N): cur = a[cur] if cur == 1: cnt = i + 1 break print(cnt)
import sys e = list(map(int, sys.stdin)) cur = e[1] for i in range(e[0]): if cur == 2: print((i + 1)) break cur = e[cur] else: print((-1))
false
0
[ "-N = int(eval(input()))", "-a = [int(eval(input())) - 1 for _ in [0] * N]", "-cur = 0", "-cnt = -1", "-for i in range(N):", "- cur = a[cur]", "- if cur == 1:", "- cnt = i + 1", "+import sys", "+", "+e = list(map(int, sys.stdin))", "+cur = e[1]", "+for i in range(e[0]):", "+ ...
false
0.052569
0.03439
1.528624
[ "s612449846", "s584922747" ]
u285891772
p03821
python
s485302921
s215119867
330
286
31,300
30,228
Accepted
Accepted
13.33
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, log from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemg...
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, log from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemg...
38
32
1,169
1,067
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, log 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, log from itertools import ( accumulate, permutations, combinations, ...
false
15.789474
[ "-A, B = [], []", "-for a, b in AB:", "- A.append(a)", "- B.append(b)", "-for i in range(N - 1, -1, -1):", "- if (A[i] + cnt) % B[i] == 0:", "- continue", "- else:", "- cnt += B[i] - (A[i] + cnt) % B[i]", "+for A, B in AB[::-1]:", "+ if (A + cnt) % B != 0:", "+ ...
false
0.04646
0.04723
0.983692
[ "s485302921", "s215119867" ]
u002539468
p03435
python
s846848593
s016882670
224
18
3,064
3,064
Accepted
Accepted
91.96
c11, c12, c13 = list(map(int, input().split())) c21, c22, c23 = list(map(int, input().split())) c31, c32, c33 = list(map(int, input().split())) def correct(): if a1 + b2 != c12: return False if a1 + b3 != c13: return False if a2 + b1 != c21: return False if a2 + b3 != c23: return Fa...
c11, c12, c13 = list(map(int, input().split())) c21, c22, c23 = list(map(int, input().split())) c31, c32, c33 = list(map(int, input().split())) def correct(a1, a2, a3, b1, b2, b3): if a1 + b1 != c11: return False if a2 + b2 != c22: return False if a3 + b3 != c33: return False if a1 + b2 ...
33
51
664
1,103
c11, c12, c13 = list(map(int, input().split())) c21, c22, c23 = list(map(int, input().split())) c31, c32, c33 = list(map(int, input().split())) def correct(): if a1 + b2 != c12: return False if a1 + b3 != c13: return False if a2 + b1 != c21: return False if a2 + b3 != c23: ...
c11, c12, c13 = list(map(int, input().split())) c21, c22, c23 = list(map(int, input().split())) c31, c32, c33 = list(map(int, input().split())) def correct(a1, a2, a3, b1, b2, b3): if a1 + b1 != c11: return False if a2 + b2 != c22: return False if a3 + b3 != c33: return False i...
false
35.294118
[ "-def correct():", "+def correct(a1, a2, a3, b1, b2, b3):", "+ if a1 + b1 != c11:", "+ return False", "+ if a2 + b2 != c22:", "+ return False", "+ if a3 + b3 != c33:", "+ return False", "- for j in range(c22 + 1):", "- for k in range(c33 + 1):", "- ...
false
0.065607
0.064208
1.021796
[ "s846848593", "s016882670" ]
u952708174
p02639
python
s161497993
s054171099
21
19
9,156
9,160
Accepted
Accepted
9.52
X = [int(i) for i in input().split()] print((X.index(0) + 1))
print((15-sum([int(i) for i in input().split()])))
2
1
60
48
X = [int(i) for i in input().split()] print((X.index(0) + 1))
print((15 - sum([int(i) for i in input().split()])))
false
50
[ "-X = [int(i) for i in input().split()]", "-print((X.index(0) + 1))", "+print((15 - sum([int(i) for i in input().split()])))" ]
false
0.040978
0.04173
0.981971
[ "s161497993", "s054171099" ]
u394731058
p03126
python
s696307609
s035432848
20
18
3,316
3,060
Accepted
Accepted
10
import sys import collections as c input = sys.stdin.readline def main(): ans = 0 N, M = list(map(int, input().split())) a = [] for _ in range(N): a += list(map(int, input().split()))[1:] co = c.Counter(a) for k, v in list(co.items()): if v == N: ans +...
import sys input = sys.stdin.readline def main(): ans = 0 N, M = list(map(int, input().split())) f = set(range(1,M+1)) for _ in range(N): a = set(list(map(int, input().split()))[1:]) f.intersection_update(a) print((len(f))) if __name__ == '__main__': main()
19
15
369
306
import sys import collections as c input = sys.stdin.readline def main(): ans = 0 N, M = list(map(int, input().split())) a = [] for _ in range(N): a += list(map(int, input().split()))[1:] co = c.Counter(a) for k, v in list(co.items()): if v == N: ans += 1 print...
import sys input = sys.stdin.readline def main(): ans = 0 N, M = list(map(int, input().split())) f = set(range(1, M + 1)) for _ in range(N): a = set(list(map(int, input().split()))[1:]) f.intersection_update(a) print((len(f))) if __name__ == "__main__": main()
false
21.052632
[ "-import collections as c", "- a = []", "+ f = set(range(1, M + 1))", "- a += list(map(int, input().split()))[1:]", "- co = c.Counter(a)", "- for k, v in list(co.items()):", "- if v == N:", "- ans += 1", "- print(ans)", "+ a = set(list(map(int, input(...
false
0.03593
0.037207
0.965653
[ "s696307609", "s035432848" ]
u298297089
p03308
python
s942583960
s880315184
177
18
38,768
3,060
Accepted
Accepted
89.83
n = int(eval(input())) a = list(map(int, input().split())) ans = 0 for i in range(n): for j in range(i+1,n): if abs(a[i]- a[j]) > ans: ans = abs(a[i]- a[j]) print(ans)
n = int(eval(input())) a = list(map(int, input().split())) mx = 0 for i in range(n): for j in range(i+1,n): if mx < abs(a[i] - a[j]): mx = abs(a[i] - a[j]) print(mx)
8
8
192
178
n = int(eval(input())) a = list(map(int, input().split())) ans = 0 for i in range(n): for j in range(i + 1, n): if abs(a[i] - a[j]) > ans: ans = abs(a[i] - a[j]) print(ans)
n = int(eval(input())) a = list(map(int, input().split())) mx = 0 for i in range(n): for j in range(i + 1, n): if mx < abs(a[i] - a[j]): mx = abs(a[i] - a[j]) print(mx)
false
0
[ "-ans = 0", "+mx = 0", "- if abs(a[i] - a[j]) > ans:", "- ans = abs(a[i] - a[j])", "-print(ans)", "+ if mx < abs(a[i] - a[j]):", "+ mx = abs(a[i] - a[j])", "+print(mx)" ]
false
0.042701
0.043078
0.991231
[ "s942583960", "s880315184" ]
u486448566
p03160
python
s692484210
s378941153
134
105
13,928
13,588
Accepted
Accepted
21.64
n = int(eval(input())) h = list(map(int, input().split())) dp = [0]*n dp[1] = abs(h[1]-h[0]) for i in range(2, n): # +1 temp1 = abs(h[i]-h[i-1])+dp[i-1] # +2 temp2 = abs(h[i]-h[i-2])+dp[i-2] dp[i] = min(temp1, temp2) print((dp[n-1]))
INF = float("inf") import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline input_int = lambda:int(eval(input())) input_ints = lambda:list(map(int,input().split())) input_ints_list = lambda:list(input_ints()) input_str = lambda:eval(input()) input_strs = lambda:input().split() input_lines = lambda ...
15
59
263
2,257
n = int(eval(input())) h = list(map(int, input().split())) dp = [0] * n dp[1] = abs(h[1] - h[0]) for i in range(2, n): # +1 temp1 = abs(h[i] - h[i - 1]) + dp[i - 1] # +2 temp2 = abs(h[i] - h[i - 2]) + dp[i - 2] dp[i] = min(temp1, temp2) print((dp[n - 1]))
INF = float("inf") import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline input_int = lambda: int(eval(input())) input_ints = lambda: list(map(int, input().split())) input_ints_list = lambda: list(input_ints()) input_str = lambda: eval(input()) input_strs = lambda: input().split() input_lines = lambda n, i...
false
74.576271
[ "-n = int(eval(input()))", "-h = list(map(int, input().split()))", "-dp = [0] * n", "-dp[1] = abs(h[1] - h[0])", "-for i in range(2, n):", "- # +1", "- temp1 = abs(h[i] - h[i - 1]) + dp[i - 1]", "- # +2", "- temp2 = abs(h[i] - h[i - 2]) + dp[i - 2]", "- dp[i] = min(temp1, temp2)", ...
false
0.047803
0.050335
0.949695
[ "s692484210", "s378941153" ]
u947883560
p03212
python
s954790841
s440485449
64
36
3,064
3,572
Accepted
Accepted
43.75
N = int(eval(input())) import math INF = 10**9 def dfs(s): if int(s) > N: return 0 elif s.count('3') == 0 or s.count('5') == 0 or s.count('7') == 0: return 0 + dfs(s + "3") + dfs(s + "5") + dfs(s + "7") else: # print(s) return 1 + dfs(s + "3") + dfs(s + "5") + d...
#!/usr/bin/env python3 import sys import functools import itertools INF = float("inf") @functools.lru_cache(maxsize=None) def pow(b, n): return b**n def f(n): # nๆกใฎ753ๆ•ฐ if n < 3: return 0 return pow(3, n) - 3*pow(2, n) + 3 def solve(N: int): ketamax = len(str(N)) ...
16
53
346
1,000
N = int(eval(input())) import math INF = 10**9 def dfs(s): if int(s) > N: return 0 elif s.count("3") == 0 or s.count("5") == 0 or s.count("7") == 0: return 0 + dfs(s + "3") + dfs(s + "5") + dfs(s + "7") else: # print(s) return 1 + dfs(s + "3") + dfs(s + "5") + dfs(s + "7")...
#!/usr/bin/env python3 import sys import functools import itertools INF = float("inf") @functools.lru_cache(maxsize=None) def pow(b, n): return b**n def f(n): # nๆกใฎ753ๆ•ฐ if n < 3: return 0 return pow(3, n) - 3 * pow(2, n) + 3 def solve(N: int): ketamax = len(str(N)) ans = 0 # ๆก...
false
69.811321
[ "-N = int(eval(input()))", "-import math", "+#!/usr/bin/env python3", "+import sys", "+import functools", "+import itertools", "-INF = 10**9", "+INF = float(\"inf\")", "-def dfs(s):", "- if int(s) > N:", "- return 0", "- elif s.count(\"3\") == 0 or s.count(\"5\") == 0 or s.count(\...
false
0.046019
0.041701
1.103556
[ "s954790841", "s440485449" ]
u391819434
p03328
python
s556008736
s832166733
516
17
38,768
3,060
Accepted
Accepted
96.71
A,B=list(map(int,input().split())) H=[0]*1000 i=1 while i<=999: H[i]=i+H[i-1] i+=1 ans=0 while True: if (A+ans in H)and(B+ans==H[H.index(A+ans)+1] in H): break else: ans+=1 print(ans)
A,B=list(map(int,input().split())) H=[0]*1000 i=1 while i<=999: H[i]=i+H[i-1] i+=1 print((H[B-A]-B))
16
9
231
110
A, B = list(map(int, input().split())) H = [0] * 1000 i = 1 while i <= 999: H[i] = i + H[i - 1] i += 1 ans = 0 while True: if (A + ans in H) and (B + ans == H[H.index(A + ans) + 1] in H): break else: ans += 1 print(ans)
A, B = list(map(int, input().split())) H = [0] * 1000 i = 1 while i <= 999: H[i] = i + H[i - 1] i += 1 print((H[B - A] - B))
false
43.75
[ "-ans = 0", "-while True:", "- if (A + ans in H) and (B + ans == H[H.index(A + ans) + 1] in H):", "- break", "- else:", "- ans += 1", "-print(ans)", "+print((H[B - A] - B))" ]
false
0.120506
0.036196
3.329259
[ "s556008736", "s832166733" ]
u350997995
p03575
python
s229749074
s380061430
409
25
3,064
3,064
Accepted
Accepted
93.89
N,M = list(map(int,input().split())) T = [[0 for i in range(N+1)] for j in range(N+1)] for i in range(M): a,b = list(map(int,input().split())) T[a][b] = 1 T[b][a] = 1 ans = 0 def f(v,x,y): global N,M,T,a a[v] = 1 for i in range(N+1): if (v==x and i==y) or (v==y and i==x): ...
N,M = list(map(int,input().split())) T = [[0]*N for i in range(N)] G = [] for i in range(M): a,b = [int(x)-1 for x in input().split()] T[a][b] = 1 T[b][a] = 1 G.append((a,b)) def check(N,T): A = [0]*N Q = [0] while Q: q = Q.pop() if A[q]:continue A[q] ...
23
31
566
587
N, M = list(map(int, input().split())) T = [[0 for i in range(N + 1)] for j in range(N + 1)] for i in range(M): a, b = list(map(int, input().split())) T[a][b] = 1 T[b][a] = 1 ans = 0 def f(v, x, y): global N, M, T, a a[v] = 1 for i in range(N + 1): if (v == x and i == y) or (v == y and...
N, M = list(map(int, input().split())) T = [[0] * N for i in range(N)] G = [] for i in range(M): a, b = [int(x) - 1 for x in input().split()] T[a][b] = 1 T[b][a] = 1 G.append((a, b)) def check(N, T): A = [0] * N Q = [0] while Q: q = Q.pop() if A[q]: continue ...
false
25.806452
[ "-T = [[0 for i in range(N + 1)] for j in range(N + 1)]", "+T = [[0] * N for i in range(N)]", "+G = []", "- a, b = list(map(int, input().split()))", "+ a, b = [int(x) - 1 for x in input().split()]", "-ans = 0", "+ G.append((a, b))", "-def f(v, x, y):", "- global N, M, T, a", "- a[v]...
false
0.042087
0.037268
1.129303
[ "s229749074", "s380061430" ]
u366963613
p02912
python
s648930695
s983790374
633
310
23,132
53,752
Accepted
Accepted
51.03
# -*- coding: utf-8 -*- import numpy as np from collections import deque import heapq import collections import itertools import bisect mod = 10 ** 9 + 7 N, M = list(map(int, input().split())) A = list(map(int, input().split())) A = list(np.array(A)*-1) heap_tree = heapq.heapify(A) for i in range(M): m...
# -*- coding: utf-8 -*- import numpy as np import sys from collections import deque from collections import defaultdict import heapq import collections import itertools import bisect from scipy.special import comb import copy sys.setrecursionlimit(10**6) def zz(): return list(map(int, sys.stdin.rea...
20
42
468
733
# -*- coding: utf-8 -*- import numpy as np from collections import deque import heapq import collections import itertools import bisect mod = 10**9 + 7 N, M = list(map(int, input().split())) A = list(map(int, input().split())) A = list(np.array(A) * -1) heap_tree = heapq.heapify(A) for i in range(M): max_value = h...
# -*- coding: utf-8 -*- import numpy as np import sys from collections import deque from collections import defaultdict import heapq import collections import itertools import bisect from scipy.special import comb import copy sys.setrecursionlimit(10**6) def zz(): return list(map(int, sys.stdin.readline().split(...
false
52.380952
[ "+import sys", "+from collections import defaultdict", "+from scipy.special import comb", "+import copy", "-mod = 10**9 + 7", "-N, M = list(map(int, input().split()))", "-A = list(map(int, input().split()))", "-A = list(np.array(A) * -1)", "-heap_tree = heapq.heapify(A)", "+sys.setrecursionlimit(1...
false
0.323939
0.046864
6.912346
[ "s648930695", "s983790374" ]
u693566873
p02555
python
s594957914
s968004723
338
188
9,184
63,600
Accepted
Accepted
44.38
s = int(eval(input())) mod = 10**9+7 ans = 0 for n in range(1, s//3 + 1): left = s - n * 3 # left -> n # left + n - 1 choose n-1 count = 1 for i in range(1, n): count *= left + i count %= mod for i in range(1, n): count *= pow(i, -1, mod) count %= mod ans += count ans %= m...
S = int(eval(input())) f = [0] * (S+1) f[0] = 1 cumsum = 1 mod = 10**9+7 for i in range(3, S+1): f[i] = cumsum - f[i-1] - f[i - 2] f[i] %= mod cumsum += f[i] print((f[-1]))
19
10
336
179
s = int(eval(input())) mod = 10**9 + 7 ans = 0 for n in range(1, s // 3 + 1): left = s - n * 3 # left -> n # left + n - 1 choose n-1 count = 1 for i in range(1, n): count *= left + i count %= mod for i in range(1, n): count *= pow(i, -1, mod) count %= mod ans ...
S = int(eval(input())) f = [0] * (S + 1) f[0] = 1 cumsum = 1 mod = 10**9 + 7 for i in range(3, S + 1): f[i] = cumsum - f[i - 1] - f[i - 2] f[i] %= mod cumsum += f[i] print((f[-1]))
false
47.368421
[ "-s = int(eval(input()))", "+S = int(eval(input()))", "+f = [0] * (S + 1)", "+f[0] = 1", "+cumsum = 1", "-ans = 0", "-for n in range(1, s // 3 + 1):", "- left = s - n * 3", "- # left -> n", "- # left + n - 1 choose n-1", "- count = 1", "- for i in range(1, n):", "- coun...
false
0.086433
0.037082
2.330869
[ "s594957914", "s968004723" ]
u531220228
p03109
python
s839701759
s943865109
34
19
4,464
3,060
Accepted
Accepted
44.12
import datetime as dt s = dt.datetime.strptime(eval(input()), '%Y/%m/%d') lastD = dt.datetime.strptime('2019/4/30', '%Y/%m/%d') if s <= lastD: print('Heisei') else: print('TBD')
y,m,d = list(map(int, input().split('/'))) ans = '' if y<2019: ans = 'Heisei' elif y==2019: if m<4 or (m==4 and d<=30): ans = 'Heisei' else: ans = 'TBD' else: ans = 'TBD' print(ans)
8
13
183
204
import datetime as dt s = dt.datetime.strptime(eval(input()), "%Y/%m/%d") lastD = dt.datetime.strptime("2019/4/30", "%Y/%m/%d") if s <= lastD: print("Heisei") else: print("TBD")
y, m, d = list(map(int, input().split("/"))) ans = "" if y < 2019: ans = "Heisei" elif y == 2019: if m < 4 or (m == 4 and d <= 30): ans = "Heisei" else: ans = "TBD" else: ans = "TBD" print(ans)
false
38.461538
[ "-import datetime as dt", "-", "-s = dt.datetime.strptime(eval(input()), \"%Y/%m/%d\")", "-lastD = dt.datetime.strptime(\"2019/4/30\", \"%Y/%m/%d\")", "-if s <= lastD:", "- print(\"Heisei\")", "+y, m, d = list(map(int, input().split(\"/\")))", "+ans = \"\"", "+if y < 2019:", "+ ans = \"Heise...
false
0.039194
0.040156
0.976034
[ "s839701759", "s943865109" ]
u188827677
p03425
python
s892792032
s604858820
160
146
9,240
10,080
Accepted
Accepted
8.75
n = int(eval(input())) march = ("M","A","R","C","H") prefix = [] d = {} for _ in range(n): pre = input()[0] if pre in march: if pre not in prefix: prefix.append(pre) d[pre] = 1 else: d[pre] += 1 t = len(prefix) if t < 3: print((0)) exit() ans = 0 for i in r...
from collections import Counter from itertools import combinations n = int(eval(input())) s = [] for _ in range(n): t = input()[0] if t in {"M","A","R","C","H"}: s.append(t) count = Counter(s) if len(count) < 3: print((0)) exit() nums = [] for i in list(count.values()):nums.append(i) ans...
25
21
444
380
n = int(eval(input())) march = ("M", "A", "R", "C", "H") prefix = [] d = {} for _ in range(n): pre = input()[0] if pre in march: if pre not in prefix: prefix.append(pre) d[pre] = 1 else: d[pre] += 1 t = len(prefix) if t < 3: print((0)) exit() ans = 0 f...
from collections import Counter from itertools import combinations n = int(eval(input())) s = [] for _ in range(n): t = input()[0] if t in {"M", "A", "R", "C", "H"}: s.append(t) count = Counter(s) if len(count) < 3: print((0)) exit() nums = [] for i in list(count.values()): nums.append(i) a...
false
16
[ "+from collections import Counter", "+from itertools import combinations", "+", "-march = (\"M\", \"A\", \"R\", \"C\", \"H\")", "-prefix = []", "-d = {}", "+s = []", "- pre = input()[0]", "- if pre in march:", "- if pre not in prefix:", "- prefix.append(pre)", "- ...
false
0.03836
0.041604
0.92203
[ "s892792032", "s604858820" ]
u057993957
p03361
python
s385795093
s052196718
215
22
12,448
3,064
Accepted
Accepted
89.77
import numpy as np h, w = list(map(int, input().split())) s = np.array([list(eval(input())) for i in range(h)]) infer = [] for i in range(h): for j in range(w): if s[i][j] == "#": pts = set([ (max(0, i-1), j), (i, max(0, j-1)), (min(h-1, i+1), j), (i, min(w-1,...
h, w = list(map(int, input().split())) maps = [list(eval(input())) for i in range(h)] def search(i, j): pts = set([ (max(0, i-1), j), (i, max(0, j-1)), (min(h-1, i+1), j), (i, min(w-1, j+1))]) for dh, dw in list(pts): if maps[dh][dw] == "#": return True return False flag = True...
23
21
521
491
import numpy as np h, w = list(map(int, input().split())) s = np.array([list(eval(input())) for i in range(h)]) infer = [] for i in range(h): for j in range(w): if s[i][j] == "#": pts = set( [ (max(0, i - 1), j), (i, max(0, j - 1)), ...
h, w = list(map(int, input().split())) maps = [list(eval(input())) for i in range(h)] def search(i, j): pts = set( [ (max(0, i - 1), j), (i, max(0, j - 1)), (min(h - 1, i + 1), j), (i, min(w - 1, j + 1)), ] ) for dh, dw in list(pts): ...
false
8.695652
[ "-import numpy as np", "+h, w = list(map(int, input().split()))", "+maps = [list(eval(input())) for i in range(h)]", "-h, w = list(map(int, input().split()))", "-s = np.array([list(eval(input())) for i in range(h)])", "-infer = []", "+", "+def search(i, j):", "+ pts = set(", "+ [", "+ ...
false
0.773575
0.044039
17.565842
[ "s385795093", "s052196718" ]
u883048396
p03252
python
s182467740
s688190942
123
28
6,704
3,632
Accepted
Accepted
77.24
sS = input().rstrip() sT = input().rstrip() def fConv2B(sA): iL = len(sA) dA = {} for s in "abcdefghijklmnopqrstuvwxyz": dA[s] = 0 iCounter = 1 for i in range(iL): s = sA[i] if s in dA: if dA[sA[i]] == 0: dA[sA[i]] = iCounter ...
sS = input().rstrip() sT = input().rstrip() aS = [0] * 26 aT = [0] * 26 sABC = "abcdefghijklmnopqrstuvwxyz" for i in range(26): aS[i]=sS.count(sABC[i]) aT[i]=sT.count(sABC[i]) aS.sort() aT.sort() if aS == aT: print ("Yes") else: print ("No")
33
15
581
273
sS = input().rstrip() sT = input().rstrip() def fConv2B(sA): iL = len(sA) dA = {} for s in "abcdefghijklmnopqrstuvwxyz": dA[s] = 0 iCounter = 1 for i in range(iL): s = sA[i] if s in dA: if dA[sA[i]] == 0: dA[sA[i]] = iCounter iCou...
sS = input().rstrip() sT = input().rstrip() aS = [0] * 26 aT = [0] * 26 sABC = "abcdefghijklmnopqrstuvwxyz" for i in range(26): aS[i] = sS.count(sABC[i]) aT[i] = sT.count(sABC[i]) aS.sort() aT.sort() if aS == aT: print("Yes") else: print("No")
false
54.545455
[ "-", "-", "-def fConv2B(sA):", "- iL = len(sA)", "- dA = {}", "- for s in \"abcdefghijklmnopqrstuvwxyz\":", "- dA[s] = 0", "- iCounter = 1", "- for i in range(iL):", "- s = sA[i]", "- if s in dA:", "- if dA[sA[i]] == 0:", "- dA[sA...
false
0.045496
0.037551
1.211571
[ "s182467740", "s688190942" ]
u827202523
p02845
python
s986339485
s870902994
250
103
57,200
86,584
Accepted
Accepted
58.8
import sys # input = sys.stdin.buffer.readline def getN(): return int(eval(input())) def getNM(): return list(map(int, input().split())) def getlist(): return list(map(int, input().split())) import heapq import bisect import copy # import math def warshall_floyd(d, N): for k in range(N): ...
import sys from collections import defaultdict, deque, Counter import math # import copy from bisect import bisect_left, bisect_right # import heapq # sys.setrecursionlimit(1000000) # input aliases input = sys.stdin.readline getS = lambda: input().strip() getN = lambda: int(eval(input())) getList = l...
53
105
1,117
2,286
import sys # input = sys.stdin.buffer.readline def getN(): return int(eval(input())) def getNM(): return list(map(int, input().split())) def getlist(): return list(map(int, input().split())) import heapq import bisect import copy # import math def warshall_floyd(d, N): for k in range(N): ...
import sys from collections import defaultdict, deque, Counter import math # import copy from bisect import bisect_left, bisect_right # import heapq # sys.setrecursionlimit(1000000) # input aliases input = sys.stdin.readline getS = lambda: input().strip() getN = lambda: int(eval(input())) getList = lambda: list(map(i...
false
49.52381
[ "+from collections import defaultdict, deque, Counter", "+import math", "-# input = sys.stdin.buffer.readline", "-def getN():", "- return int(eval(input()))", "+# import copy", "+from bisect import bisect_left, bisect_right", "+", "+# import heapq", "+# sys.setrecursionlimit(1000000)", "+# in...
false
0.034991
0.035474
0.986377
[ "s986339485", "s870902994" ]
u645250356
p03387
python
s422940188
s467407660
182
48
38,764
5,504
Accepted
Accepted
73.63
from collections import Counter,defaultdict,deque import sys,heapq,bisect,math,itertools,string,queue sys.setrecursionlimit(10**8) mod = 10**9+7 def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) def inpl_str(): return list(sys.stdin.readline().split()) de...
from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify import sys,bisect,math,itertools,fractions,copy sys.setrecursionlimit(10**8) mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) ...
17
18
526
472
from collections import Counter, defaultdict, deque import sys, heapq, bisect, math, itertools, string, queue sys.setrecursionlimit(10**8) mod = 10**9 + 7 def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) def inpl_str(): return list(sys.stdin....
from collections import Counter, defaultdict, deque from heapq import heappop, heappush, heapify import sys, bisect, math, itertools, fractions, copy sys.setrecursionlimit(10**8) mod = 10**9 + 7 INF = float("inf") def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readli...
false
5.555556
[ "-import sys, heapq, bisect, math, itertools, string, queue", "+from heapq import heappop, heappush, heapify", "+import sys, bisect, math, itertools, fractions, copy", "+INF = float(\"inf\")", "-def inpl_str():", "- return list(sys.stdin.readline().split())", "-", "-", "-def inpln(n):", "- r...
false
0.043192
0.0866
0.498746
[ "s422940188", "s467407660" ]
u418149936
p02819
python
s265940766
s929673919
46
42
9,112
9,180
Accepted
Accepted
8.7
import math X = int(eval(input())) if X == 2: print((2)) else: is_find = False while not is_find: for i in range(2, X//2): is_find = True if math.gcd(X, i) != 1: is_find = False X += 1 break rst = X pri...
import math X = int(eval(input())) if X == 2: print((2)) else: is_end = False while not is_end: is_end = True for i in range(1, X // 2): if math.gcd(X, i) != 1: is_end = False X += 1 break print(X)
15
14
319
294
import math X = int(eval(input())) if X == 2: print((2)) else: is_find = False while not is_find: for i in range(2, X // 2): is_find = True if math.gcd(X, i) != 1: is_find = False X += 1 break rst = X print(rst)
import math X = int(eval(input())) if X == 2: print((2)) else: is_end = False while not is_end: is_end = True for i in range(1, X // 2): if math.gcd(X, i) != 1: is_end = False X += 1 break print(X)
false
6.666667
[ "- is_find = False", "- while not is_find:", "- for i in range(2, X // 2):", "- is_find = True", "+ is_end = False", "+ while not is_end:", "+ is_end = True", "+ for i in range(1, X // 2):", "- is_find = False", "+ is_end = ...
false
0.052756
0.040775
1.293845
[ "s265940766", "s929673919" ]
u492910842
p03416
python
s729482166
s448452185
83
74
67,868
67,768
Accepted
Accepted
10.84
a,b = list(map(int,input().split())) n = b - a + 1 count = 0 for i in range(n): x = a + i xx = list(str(x)) xx.reverse() xx = int("".join(xx)) if x == xx: count += 1 print(count)
a,b=input().split() ans=0 for i in range(int(a),int(b)+1): if str(i)==str(i)[::-1]: ans+=1 print(ans)
13
6
204
112
a, b = list(map(int, input().split())) n = b - a + 1 count = 0 for i in range(n): x = a + i xx = list(str(x)) xx.reverse() xx = int("".join(xx)) if x == xx: count += 1 print(count)
a, b = input().split() ans = 0 for i in range(int(a), int(b) + 1): if str(i) == str(i)[::-1]: ans += 1 print(ans)
false
53.846154
[ "-a, b = list(map(int, input().split()))", "-n = b - a + 1", "-count = 0", "-for i in range(n):", "- x = a + i", "- xx = list(str(x))", "- xx.reverse()", "- xx = int(\"\".join(xx))", "- if x == xx:", "- count += 1", "-print(count)", "+a, b = input().split()", "+ans = 0"...
false
0.131003
0.165208
0.792956
[ "s729482166", "s448452185" ]
u498041957
p02416
python
s131568919
s298562129
30
20
7,696
7,652
Accepted
Accepted
33.33
while True: data = eval(input()) if data[0] == '0': break print((sum([int(i) for i in data])))
for str in iter(input, "0"): print((sum(int(c) for c in str)))
6
2
112
63
while True: data = eval(input()) if data[0] == "0": break print((sum([int(i) for i in data])))
for str in iter(input, "0"): print((sum(int(c) for c in str)))
false
66.666667
[ "-while True:", "- data = eval(input())", "- if data[0] == \"0\":", "- break", "- print((sum([int(i) for i in data])))", "+for str in iter(input, \"0\"):", "+ print((sum(int(c) for c in str)))" ]
false
0.049268
0.049507
0.995163
[ "s131568919", "s298562129" ]
u025501820
p03339
python
s370138807
s985185790
219
201
3,700
3,676
Accepted
Accepted
8.22
N = int(eval(input())) S = eval(input()) left = 0 right = S.count("E") ans = False for i in range(N): if i > 0 and S[i - 1] == "W": left += 1 if S[i] == "E": right -= 1 if ans is not False: ans = min(ans, left + right) else: ans = left + right print(ans) ...
N = int(eval(input())) S = eval(input()) num = S[1:].count("E") ans = num for i in range(1, N): if S[i - 1] == "W": num += 1 if S[i] == "E": num -= 1 ans = min(num, ans) print(ans)
16
12
310
212
N = int(eval(input())) S = eval(input()) left = 0 right = S.count("E") ans = False for i in range(N): if i > 0 and S[i - 1] == "W": left += 1 if S[i] == "E": right -= 1 if ans is not False: ans = min(ans, left + right) else: ans = left + right print(ans)
N = int(eval(input())) S = eval(input()) num = S[1:].count("E") ans = num for i in range(1, N): if S[i - 1] == "W": num += 1 if S[i] == "E": num -= 1 ans = min(num, ans) print(ans)
false
25
[ "-left = 0", "-right = S.count(\"E\")", "-ans = False", "-for i in range(N):", "- if i > 0 and S[i - 1] == \"W\":", "- left += 1", "+num = S[1:].count(\"E\")", "+ans = num", "+for i in range(1, N):", "+ if S[i - 1] == \"W\":", "+ num += 1", "- right -= 1", "- if...
false
0.047324
0.050723
0.932984
[ "s370138807", "s985185790" ]