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
u263830634
p03450
python
s604625696
s911431445
1,185
893
66,288
66,296
Accepted
Accepted
24.64
from collections import deque N, M = list(map(int, input().split())) G = [[] for _ in range(N + 1)] for _ in range(M): l, r, d = list(map(int, input().split())) G[l].append((r, -d)) G[r].append((l, d)) MIN = -10 ** 18 lst = [MIN] * (N + 1) que = deque() for i in range(1, N + 1): ...
from collections import deque import sys input = sys.stdin.readline N, M = list(map(int, input().split())) G = [[] for _ in range(N + 1)] for _ in range(M): l, r, d = list(map(int, input().split())) G[l].append((r, -d)) G[r].append((l, d)) MIN = -10 ** 18 lst = [MIN] * (N + 1) que =...
38
40
765
805
from collections import deque N, M = list(map(int, input().split())) G = [[] for _ in range(N + 1)] for _ in range(M): l, r, d = list(map(int, input().split())) G[l].append((r, -d)) G[r].append((l, d)) MIN = -(10**18) lst = [MIN] * (N + 1) que = deque() for i in range(1, N + 1): if lst[i] == MIN: ...
from collections import deque import sys input = sys.stdin.readline N, M = list(map(int, input().split())) G = [[] for _ in range(N + 1)] for _ in range(M): l, r, d = list(map(int, input().split())) G[l].append((r, -d)) G[r].append((l, d)) MIN = -(10**18) lst = [MIN] * (N + 1) que = deque() for i in range(...
false
5
[ "+import sys", "+input = sys.stdin.readline" ]
false
0.04103
0.04025
1.019372
[ "s604625696", "s911431445" ]
u585482323
p03085
python
s924237825
s728384322
185
169
38,256
38,256
Accepted
Accepted
8.65
n = eval(input());ans="ACGT";k=ans.index(n)^3;print((ans[k]))
n=eval(input());a="ACGT";print((a[a.index(n)^3]))
1
1
53
41
n = eval(input()) ans = "ACGT" k = ans.index(n) ^ 3 print((ans[k]))
n = eval(input()) a = "ACGT" print((a[a.index(n) ^ 3]))
false
0
[ "-ans = \"ACGT\"", "-k = ans.index(n) ^ 3", "-print((ans[k]))", "+a = \"ACGT\"", "+print((a[a.index(n) ^ 3]))" ]
false
0.048257
0.039515
1.221226
[ "s924237825", "s728384322" ]
u183509493
p02678
python
s380926150
s625108554
781
417
34,104
99,140
Accepted
Accepted
46.61
from collections import deque n,m=list(map(int,input().split())) adj=[[] for _ in range(n)] for _ in range(m): x,y=list(map(int,input().split())) adj[x-1].append(y-1) adj[y-1].append(x-1) before=[None] * n before[0] = -1 q=deque([0]) while len(q): node=q.popleft() for nxt in adj[node]: if...
from collections import deque N, M = list(map(int, input().split())) AB = [[] for _ in range(N+1)] for i in range(M): A_tmp , B_tmp = list(map(int, input().split())) AB[A_tmp].append(B_tmp) AB[B_tmp].append(A_tmp) ans = [0]*(N+1) visited = [False] * (N + 1) q = deque() q.append((1, -1)) whi...
24
27
459
597
from collections import deque n, m = list(map(int, input().split())) adj = [[] for _ in range(n)] for _ in range(m): x, y = list(map(int, input().split())) adj[x - 1].append(y - 1) adj[y - 1].append(x - 1) before = [None] * n before[0] = -1 q = deque([0]) while len(q): node = q.popleft() for nxt in...
from collections import deque N, M = list(map(int, input().split())) AB = [[] for _ in range(N + 1)] for i in range(M): A_tmp, B_tmp = list(map(int, input().split())) AB[A_tmp].append(B_tmp) AB[B_tmp].append(A_tmp) ans = [0] * (N + 1) visited = [False] * (N + 1) q = deque() q.append((1, -1)) while len(q) >...
false
11.111111
[ "-n, m = list(map(int, input().split()))", "-adj = [[] for _ in range(n)]", "-for _ in range(m):", "- x, y = list(map(int, input().split()))", "- adj[x - 1].append(y - 1)", "- adj[y - 1].append(x - 1)", "-before = [None] * n", "-before[0] = -1", "-q = deque([0])", "-while len(q):", "- ...
false
0.037139
0.037507
0.990175
[ "s380926150", "s625108554" ]
u631277801
p03593
python
s636475527
s392120029
25
22
3,316
3,316
Accepted
Accepted
12
import sys stdin = sys.stdin def li(): return list(map(int, stdin.readline().split())) def li_(): return [int(x)-1 for x in stdin.readline().split()] def lf(): return list(map(float, stdin.readline().split())) def ls(): return stdin.readline().split() def ns(): return stdin.readline().rstrip() def lc(): return...
import sys stdin = sys.stdin sys.setrecursionlimit(10 ** 7) def li(): return list(map(int, stdin.readline().split())) def li_(): return [int(x) - 1 for x in stdin.readline().split()] def lf(): return list(map(float, stdin.readline().split())) def ls(): return stdin.readline().split() def ns(): return stdin.r...
68
70
1,451
1,719
import sys stdin = sys.stdin def li(): return list(map(int, stdin.readline().split())) def li_(): return [int(x) - 1 for x in stdin.readline().split()] def lf(): return list(map(float, stdin.readline().split())) def ls(): return stdin.readline().split() def ns(): return stdin.readline().r...
import sys stdin = sys.stdin sys.setrecursionlimit(10**7) def li(): return list(map(int, stdin.readline().split())) def li_(): return [int(x) - 1 for x in stdin.readline().split()] def lf(): return list(map(float, stdin.readline().split())) def ls(): return stdin.readline().split() def ns(): ...
false
2.857143
[ "+sys.setrecursionlimit(10**7)", "-from collections import Counter", "+from collections import defaultdict", "+", "+", "+def judge(cnts, h, w):", "+ odd_cnt = 0", "+ mod4_2_cnt = 0", "+ mod4_0_cnt = 0", "+ for key, val in list(cnts.items()):", "+ if val % 2 == 1:", "+ ...
false
0.037243
0.041165
0.904731
[ "s636475527", "s392120029" ]
u199830845
p02732
python
s714754174
s634061243
1,790
439
26,780
26,772
Accepted
Accepted
75.47
import collections import math def combinations_count(n, r): return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)) N = int(eval(input())) A_list = list(map(int, input().split())) counts = collections.Counter(A_list) ans = 0 for _, v in list(counts.items()): # ans += len(list(ite...
import collections # def combinations_count(n, r): # return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)) N = int(eval(input())) A_list = list(map(int, input().split())) counts = collections.Counter(A_list) ans = 0 for _, v in list(counts.items()): ans += v * (v - 1) / 2 for ...
23
20
539
441
import collections import math def combinations_count(n, r): return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)) N = int(eval(input())) A_list = list(map(int, input().split())) counts = collections.Counter(A_list) ans = 0 for _, v in list(counts.items()): # ans += len(list(itertools.comb...
import collections # def combinations_count(n, r): # return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)) N = int(eval(input())) A_list = list(map(int, input().split())) counts = collections.Counter(A_list) ans = 0 for _, v in list(counts.items()): ans += v * (v - 1) / 2 for k in range(1, N ...
false
13.043478
[ "-import math", "-", "-def combinations_count(n, r):", "- return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))", "-", "-", "+# def combinations_count(n, r):", "+# return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))", "- # ans += len(list(itertools.com...
false
0.037065
0.038909
0.952595
[ "s714754174", "s634061243" ]
u729133443
p03077
python
s709476707
s304132111
183
17
38,384
2,940
Accepted
Accepted
90.71
n,*a=eval('int(input()),'*6);print((4--n//min(a)))
n,*a=list(map(int,open(0)));print((4--n//min(a)))
1
1
48
41
n, *a = eval("int(input())," * 6) print((4 - -n // min(a)))
n, *a = list(map(int, open(0))) print((4 - -n // min(a)))
false
0
[ "-n, *a = eval(\"int(input()),\" * 6)", "+n, *a = list(map(int, open(0)))" ]
false
0.047619
0.097663
0.48759
[ "s709476707", "s304132111" ]
u072053884
p02376
python
s348115507
s669951985
50
40
8,168
8,164
Accepted
Accepted
20
# Acceptance of input import sys file_input = sys.stdin V, E = list(map(int, file_input.readline().split())) adj_mat = [[0] * V for i in range(V)] for line in file_input: u, v, c = list(map(int, line.split())) adj_mat[u][v] = c # Ford???Fulkerson algorithm import collections # BFS for ...
# Acceptance of input import sys file_input = sys.stdin V, E = list(map(int, file_input.readline().split())) adj_mat = [[0] * V for i in range(V)] for line in file_input: u, v, c = list(map(int, line.split())) adj_mat[u][v] = c # Ford???Fulkerson algorithm import collections # BFS for ...
53
53
1,331
1,327
# Acceptance of input import sys file_input = sys.stdin V, E = list(map(int, file_input.readline().split())) adj_mat = [[0] * V for i in range(V)] for line in file_input: u, v, c = list(map(int, line.split())) adj_mat[u][v] = c # Ford???Fulkerson algorithm import collections # BFS for residual capacity networ...
# Acceptance of input import sys file_input = sys.stdin V, E = list(map(int, file_input.readline().split())) adj_mat = [[0] * V for i in range(V)] for line in file_input: u, v, c = list(map(int, line.split())) adj_mat[u][v] = c # Ford???Fulkerson algorithm import collections # BFS for residual capacity networ...
false
0
[ "- unvisited = [True] * V", "+ flow = [0] * V", "- unvisited[start] = False", "+ flow[start] = 10000", "- for v, flow in enumerate(adj_mat[u]):", "- if unvisited[v] and (flow > 0):", "+ for v, r_capacity in enumerate(adj_mat[u]):", "+ if not flow[v] and ...
false
0.069522
0.03707
1.875398
[ "s348115507", "s669951985" ]
u392319141
p03695
python
s479478724
s360151884
21
17
3,316
3,060
Accepted
Accepted
19.05
from collections import defaultdict N = int(eval(input())) A = list(map(int, input().split())) colorCount = defaultdict(int) for a in A: if a < 400: colorCount['a'] += 1 elif a < 800: colorCount['b'] += 1 elif a < 1200: colorCount['c'] += 1 elif a < 1600: ...
N = int(eval(input())) A = list(map(int, input().split())) ans = set() cnt = 0 for a in A: if a >= 3200: cnt += 1 else: ans.add(a // 400) mx = len(ans) + cnt mi = max(1, len(ans)) print((mi, mx))
38
15
826
229
from collections import defaultdict N = int(eval(input())) A = list(map(int, input().split())) colorCount = defaultdict(int) for a in A: if a < 400: colorCount["a"] += 1 elif a < 800: colorCount["b"] += 1 elif a < 1200: colorCount["c"] += 1 elif a < 1600: colorCount["d"]...
N = int(eval(input())) A = list(map(int, input().split())) ans = set() cnt = 0 for a in A: if a >= 3200: cnt += 1 else: ans.add(a // 400) mx = len(ans) + cnt mi = max(1, len(ans)) print((mi, mx))
false
60.526316
[ "-from collections import defaultdict", "-", "-colorCount = defaultdict(int)", "+ans = set()", "+cnt = 0", "- if a < 400:", "- colorCount[\"a\"] += 1", "- elif a < 800:", "- colorCount[\"b\"] += 1", "- elif a < 1200:", "- colorCount[\"c\"] += 1", "- elif a < 16...
false
0.046549
0.047202
0.986164
[ "s479478724", "s360151884" ]
u350093546
p02819
python
s816232866
s331682045
182
168
38,512
38,512
Accepted
Accepted
7.69
x=int(eval(input())) while True: cnt=0 for i in range(2,x//2): if x%i==0: cnt+=1 break if cnt==0: print(x) break else: x+=1 continue
x=int(eval(input())) while True: cnt=0 for i in range(2,x//2): if x%i==0: cnt+=1 break if cnt==0: print(x) break elif cnt==1: x+=1 continue
13
13
178
186
x = int(eval(input())) while True: cnt = 0 for i in range(2, x // 2): if x % i == 0: cnt += 1 break if cnt == 0: print(x) break else: x += 1 continue
x = int(eval(input())) while True: cnt = 0 for i in range(2, x // 2): if x % i == 0: cnt += 1 break if cnt == 0: print(x) break elif cnt == 1: x += 1 continue
false
0
[ "- else:", "+ elif cnt == 1:" ]
false
0.039118
0.037362
1.047007
[ "s816232866", "s331682045" ]
u498487134
p02792
python
s709799526
s007141211
225
85
40,428
73,352
Accepted
Accepted
62.22
S=eval(input()) TT=[[0]*10 for _ in range(10)] N=int(S) for i in range(1,N+1): ii=str(i) a=int(ii[0]) b=int(ii[-1]) TT[a][b]+=1 ans=0 for i in range(10): for j in range(10): ans+=TT[i][j]*TT[j][i] print(ans)
import sys input = sys.stdin.readline def I(): return int(eval(input())) def MI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) def main(): mod=10**9+7 N=I() def ht(x): t=x%10 string=str(x) h=int(string[0]) retu...
16
34
259
636
S = eval(input()) TT = [[0] * 10 for _ in range(10)] N = int(S) for i in range(1, N + 1): ii = str(i) a = int(ii[0]) b = int(ii[-1]) TT[a][b] += 1 ans = 0 for i in range(10): for j in range(10): ans += TT[i][j] * TT[j][i] print(ans)
import sys input = sys.stdin.readline def I(): return int(eval(input())) def MI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) def main(): mod = 10**9 + 7 N = I() def ht(x): t = x % 10 string = str(x) h = int(string[0]...
false
52.941176
[ "-S = eval(input())", "-TT = [[0] * 10 for _ in range(10)]", "-N = int(S)", "-for i in range(1, N + 1):", "- ii = str(i)", "- a = int(ii[0])", "- b = int(ii[-1])", "- TT[a][b] += 1", "-ans = 0", "-for i in range(10):", "- for j in range(10):", "- ans += TT[i][j] * TT[j][i...
false
0.073111
0.065808
1.110979
[ "s709799526", "s007141211" ]
u668503853
p03147
python
s318888414
s176544832
25
22
3,060
2,940
Accepted
Accepted
12
N=int(eval(input())) h=list(map(int, input().split())) c=i=0 while sum(h)>0: if h[i]>0: j=i c+=1 while j<N and h[j]>0: h[j]-=1 j+=1 else: i+=1 print(c)
N=int(eval(input())) h=[0]+list(map(int,input().split())) c=0 for i in range(N): c+=max(h[i+1]-h[i],0) print(c)
13
6
189
112
N = int(eval(input())) h = list(map(int, input().split())) c = i = 0 while sum(h) > 0: if h[i] > 0: j = i c += 1 while j < N and h[j] > 0: h[j] -= 1 j += 1 else: i += 1 print(c)
N = int(eval(input())) h = [0] + list(map(int, input().split())) c = 0 for i in range(N): c += max(h[i + 1] - h[i], 0) print(c)
false
53.846154
[ "-h = list(map(int, input().split()))", "-c = i = 0", "-while sum(h) > 0:", "- if h[i] > 0:", "- j = i", "- c += 1", "- while j < N and h[j] > 0:", "- h[j] -= 1", "- j += 1", "- else:", "- i += 1", "+h = [0] + list(map(int, input().split(...
false
0.064208
0.038541
1.665969
[ "s318888414", "s176544832" ]
u600402037
p03329
python
s157221321
s461462547
366
201
3,060
41,584
Accepted
Accepted
45.08
N = int(eval(input())) answer = N for i in range(N+1): count = 0 t = i # i円を6円で払い、残りを9円で払う while t: count += t%6 t //= 6 t = N-i while t: count += t%9 t //= 9 answer = min(answer, count) print(answer)
# coding: utf-8 import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) # dp N = ir() INF = 10 ** 8 dp = [INF] * (N+1) dp[0] = 0 for i in range(5, 0, -1): num = 9 ** i for j in range(N): if j+num <= N: dp[j+num]...
17
30
273
596
N = int(eval(input())) answer = N for i in range(N + 1): count = 0 t = i # i円を6円で払い、残りを9円で払う while t: count += t % 6 t //= 6 t = N - i while t: count += t % 9 t //= 9 answer = min(answer, count) print(answer)
# coding: utf-8 import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) # dp N = ir() INF = 10**8 dp = [INF] * (N + 1) dp[0] = 0 for i in range(5, 0, -1): num = 9**i for j in range(N): if j + num <= N: dp[j + num] = min(dp[j + n...
false
43.333333
[ "-N = int(eval(input()))", "-answer = N", "-for i in range(N + 1):", "- count = 0", "- t = i", "- # i円を6円で払い、残りを9円で払う", "- while t:", "- count += t % 6", "- t //= 6", "- t = N - i", "- while t:", "- count += t % 9", "- t //= 9", "- answer = ...
false
0.088418
0.176152
0.501941
[ "s157221321", "s461462547" ]
u085472528
p02412
python
s187238116
s874636364
990
550
7,648
7,712
Accepted
Accepted
44.44
while True: n, x = [int(i) for i in input().split()] if n == x == 0: break count = 0 for s in range(1, n - 1): for m in range(s + 1, n): for e in range(m + 1, n + 1): if x == sum([s, m, e]): count += 1 print(count)
while True: n, x = [int(i) for i in input().split()] if n == x == 0: break count = 0 for s in range(1, n - 1): for m in range(s + 1, n): for e in range(m + 1, n + 1): if x == s + m + e: count += 1 print(count)
14
14
314
309
while True: n, x = [int(i) for i in input().split()] if n == x == 0: break count = 0 for s in range(1, n - 1): for m in range(s + 1, n): for e in range(m + 1, n + 1): if x == sum([s, m, e]): count += 1 print(count)
while True: n, x = [int(i) for i in input().split()] if n == x == 0: break count = 0 for s in range(1, n - 1): for m in range(s + 1, n): for e in range(m + 1, n + 1): if x == s + m + e: count += 1 print(count)
false
0
[ "- if x == sum([s, m, e]):", "+ if x == s + m + e:" ]
false
0.037674
0.038422
0.980541
[ "s187238116", "s874636364" ]
u941438707
p03497
python
s892517174
s785125759
134
94
33,788
33,556
Accepted
Accepted
29.85
n,k,*a=list(map(int,open(0).read().split())) d={} for i in a: d[i]=d.get(i,0)+1 b=list(d.values()) b.sort() print((sum(b[:-k])))
from collections import * _,k,*a = list(map(int,open(0).read().split())) print((sum(sorted(Counter(a).values())[:-k])))
7
3
130
113
n, k, *a = list(map(int, open(0).read().split())) d = {} for i in a: d[i] = d.get(i, 0) + 1 b = list(d.values()) b.sort() print((sum(b[:-k])))
from collections import * _, k, *a = list(map(int, open(0).read().split())) print((sum(sorted(Counter(a).values())[:-k])))
false
57.142857
[ "-n, k, *a = list(map(int, open(0).read().split()))", "-d = {}", "-for i in a:", "- d[i] = d.get(i, 0) + 1", "-b = list(d.values())", "-b.sort()", "-print((sum(b[:-k])))", "+from collections import *", "+", "+_, k, *a = list(map(int, open(0).read().split()))", "+print((sum(sorted(Counter(a).v...
false
0.044206
0.046824
0.944078
[ "s892517174", "s785125759" ]
u729939940
p02701
python
s332681786
s500523935
92
82
39,132
35,588
Accepted
Accepted
10.87
import sys N = int(eval(input())) S = [str(s) for s in sys.stdin.read().split()] print((len(set(S))))
N, *S = open(0) print((len(set(S))))
4
2
96
35
import sys N = int(eval(input())) S = [str(s) for s in sys.stdin.read().split()] print((len(set(S))))
N, *S = open(0) print((len(set(S))))
false
50
[ "-import sys", "-", "-N = int(eval(input()))", "-S = [str(s) for s in sys.stdin.read().split()]", "+N, *S = open(0)" ]
false
0.050425
0.041499
1.215094
[ "s332681786", "s500523935" ]
u531436689
p02881
python
s574927969
s556613648
372
172
70,124
7,112
Accepted
Accepted
53.76
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools def main(): N = int(eval(input())) ans = 10e+12 max_sq = int(math.sqrt(N)+1) for i in range(1, max_sq): if N % i == 0: j = N // i ans = min(ans, i+j-2) pr...
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools def main(): N = int(eval(input())) ans = N-1 max_sq = int(math.sqrt(N)+1) for i in range(1, max_sq): if N % i != 0: continue j = N // i ans = min(ans, i+j-...
12
13
333
343
import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools def main(): N = int(eval(input())) ans = 10e12 max_sq = int(math.sqrt(N) + 1) for i in range(1, max_sq): if N % i == 0: j = N // i ans = min(ans, i + j -...
import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools def main(): N = int(eval(input())) ans = N - 1 max_sq = int(math.sqrt(N) + 1) for i in range(1, max_sq): if N % i != 0: continue j = N // i ans = min...
false
7.692308
[ "- ans = 10e12", "+ ans = N - 1", "- if N % i == 0:", "- j = N // i", "- ans = min(ans, i + j - 2)", "+ if N % i != 0:", "+ continue", "+ j = N // i", "+ ans = min(ans, i + j - 2)" ]
false
0.126127
0.070706
1.783837
[ "s574927969", "s556613648" ]
u934442292
p02960
python
s251626879
s094408177
883
503
125,812
117,940
Accepted
Accepted
43.04
import sys import numba as nb import numpy as np input = sys.stdin.readline P = 10 ** 9 + 7 Q = 13 @nb.njit("i8(i8[:])", cache=True) def solve(S): N = len(S) dp = [[0] * Q for _ in range(N + 1)] dp[0][0] = 1 for i in range(N): D = S[i] if D == -1: for ...
import sys import numba as nb import numpy as np input = sys.stdin.readline P = 10 ** 9 + 7 Q = 13 @nb.njit("i8(i8[:])", cache=True) def solve(S): N = len(S) dp = np.zeros(shape=(N + 1, Q), dtype=np.int64) dp[0][0] = 1 for i in range(N): D = S[i] if D == -1: ...
43
42
845
832
import sys import numba as nb import numpy as np input = sys.stdin.readline P = 10**9 + 7 Q = 13 @nb.njit("i8(i8[:])", cache=True) def solve(S): N = len(S) dp = [[0] * Q for _ in range(N + 1)] dp[0][0] = 1 for i in range(N): D = S[i] if D == -1: for d in range(10): ...
import sys import numba as nb import numpy as np input = sys.stdin.readline P = 10**9 + 7 Q = 13 @nb.njit("i8(i8[:])", cache=True) def solve(S): N = len(S) dp = np.zeros(shape=(N + 1, Q), dtype=np.int64) dp[0][0] = 1 for i in range(N): D = S[i] if D == -1: for d in range(1...
false
2.325581
[ "- dp = [[0] * Q for _ in range(N + 1)]", "+ dp = np.zeros(shape=(N + 1, Q), dtype=np.int64)", "- d = int(D)", "- dp[i + 1][(10 * j + d) % Q] += dp[i][j]", "+ dp[i + 1][(10 * j + D) % Q] += dp[i][j]" ]
false
0.041089
0.036907
1.113329
[ "s251626879", "s094408177" ]
u839188633
p02669
python
s856806281
s976714557
550
482
86,936
84,272
Accepted
Accepted
12.36
from heapq import heappop, heappush T = int(input()) ans = [] for _ in range(T): N, A, B, C, D = map(int, input().split()) Q = [(0, N)] # already processed S = set() an = D * N while Q: cost, num = heappop(Q) if num in S: continue an = min(an,...
from heapq import heappop, heappush T = int(input()) ans = [] for _ in range(T): N, A, B, C, D = map(int, input().split()) Q = [(0, N)] # already processed S = set() an = D * N while Q: cost, num = heappop(Q) if num in S: continue an = min(an,...
40
40
974
974
from heapq import heappop, heappush T = int(input()) ans = [] for _ in range(T): N, A, B, C, D = map(int, input().split()) Q = [(0, N)] # already processed S = set() an = D * N while Q: cost, num = heappop(Q) if num in S: continue an = min(an, cost + num * D)...
from heapq import heappop, heappush T = int(input()) ans = [] for _ in range(T): N, A, B, C, D = map(int, input().split()) Q = [(0, N)] # already processed S = set() an = D * N while Q: cost, num = heappop(Q) if num in S: continue an = min(an, cost + num * D)...
false
0
[ "- if r > 0:", "+ if r > 1:", "- if r > 0:", "+ if r > 2:" ]
false
0.205985
0.144002
1.430433
[ "s856806281", "s976714557" ]
u922449550
p03305
python
s081920053
s482430209
1,453
1,235
123,900
87,300
Accepted
Accepted
15
from heapq import heappush, heappop money = 10**15 N, M, s, t = map(int, input().split()) s -= 1; t -= 1 graph = [[[] for i in range(N)] for _ in range(2)] for i in range(M): u, v, a, b = map(int, input().split()) u -= 1; v -= 1 graph[0][u].append((v, a)); graph[0][v].append((u, a)) graph[1][u].appen...
from heapq import heappush, heappop import sys input = sys.stdin.readline money = 10**15 N, M, s, t = map(int, input().split()) s -= 1; t -= 1 graph = [[[] for i in range(N)] for _ in range(2)] for i in range(M): u, v, a, b = map(int, input().split()) u -= 1; v -= 1 graph[0][u].append((v, a)); graph[0...
40
42
984
1,024
from heapq import heappush, heappop money = 10**15 N, M, s, t = map(int, input().split()) s -= 1 t -= 1 graph = [[[] for i in range(N)] for _ in range(2)] for i in range(M): u, v, a, b = map(int, input().split()) u -= 1 v -= 1 graph[0][u].append((v, a)) graph[0][v].append((u, a)) graph[1][u].ap...
from heapq import heappush, heappop import sys input = sys.stdin.readline money = 10**15 N, M, s, t = map(int, input().split()) s -= 1 t -= 1 graph = [[[] for i in range(N)] for _ in range(2)] for i in range(M): u, v, a, b = map(int, input().split()) u -= 1 v -= 1 graph[0][u].append((v, a)) graph[0...
false
4.761905
[ "+import sys", "+input = sys.stdin.readline" ]
false
0.038187
0.037758
1.011351
[ "s081920053", "s482430209" ]
u102461423
p02957
python
s142554424
s850468977
304
18
536,644
2,940
Accepted
Accepted
94.08
import numpy as np A = np.arange(1<<27,dtype=np.int32) a,b = list(map(int,input().split())) if (a-b) % 2 == 0: print(((a+b)//2)) else: print('IMPOSSIBLE')
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines A,B = list(map(int,read().split())) q,r = divmod(A+B,2) if r == 1: print('IMPOSSIBLE') else: print(q)
9
13
161
234
import numpy as np A = np.arange(1 << 27, dtype=np.int32) a, b = list(map(int, input().split())) if (a - b) % 2 == 0: print(((a + b) // 2)) else: print("IMPOSSIBLE")
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines A, B = list(map(int, read().split())) q, r = divmod(A + B, 2) if r == 1: print("IMPOSSIBLE") else: print(q)
false
30.769231
[ "-import numpy as np", "+import sys", "-A = np.arange(1 << 27, dtype=np.int32)", "-a, b = list(map(int, input().split()))", "-if (a - b) % 2 == 0:", "- print(((a + b) // 2))", "+read = sys.stdin.buffer.read", "+readline = sys.stdin.buffer.readline", "+readlines = sys.stdin.buffer.readlines", "+...
false
0.338155
0.035829
9.438125
[ "s142554424", "s850468977" ]
u562935282
p02972
python
s928418824
s028489706
479
268
14,132
13,224
Accepted
Accepted
44.05
def main(): N = int(input()) a = [0] a += map(int, input().split()) b = [0] * (N + 1) x = N k = 1 while x > 0: while x * (k + 1) > N: t = 0 for j in range(2, k + 1): t ^= b[x * j] b[x] = a[x] ^ t x -= ...
# https://atcoder.jp/contests/abc134/submissions/7469219 def main(): from functools import reduce from operator import xor N = int(input()) a = [0] a += map(int, input().split()) for x in reversed(range(1, N // 2 + 1)): a[x] = reduce(xor, a[x::x]) ans = [i for i, x...
43
38
833
784
def main(): N = int(input()) a = [0] a += map(int, input().split()) b = [0] * (N + 1) x = N k = 1 while x > 0: while x * (k + 1) > N: t = 0 for j in range(2, k + 1): t ^= b[x * j] b[x] = a[x] ^ t x -= 1 k += 1 ...
# https://atcoder.jp/contests/abc134/submissions/7469219 def main(): from functools import reduce from operator import xor N = int(input()) a = [0] a += map(int, input().split()) for x in reversed(range(1, N // 2 + 1)): a[x] = reduce(xor, a[x::x]) ans = [i for i, x in enumerate(a) i...
false
11.627907
[ "+# https://atcoder.jp/contests/abc134/submissions/7469219", "+ from functools import reduce", "+ from operator import xor", "+", "- b = [0] * (N + 1)", "- x = N", "- k = 1", "- while x > 0:", "- while x * (k + 1) > N:", "- t = 0", "- for j in range...
false
0.036164
0.042441
0.852099
[ "s928418824", "s028489706" ]
u022979415
p02918
python
s386660897
s632379999
61
45
4,084
3,956
Accepted
Accepted
26.23
def main(): length, operation = list(map(int, input().split())) direction = list(eval(input())) before = "" inverse = {"L": "R", "R": "L"} change = 0 section = 0 answer = 0 for i in range(length): if not before == direction[i]: before = direction[i] ...
def main(): n, k = list(map(int, input().split())) s = list("*" + eval(input()) + "*") count = 0 for i in range(1, n + 1): if (s[i] == s[i - 1] == "L") or (s[i] == s[i + 1] == "R"): count += 1 print((min(count + 2 * k, n - 1))) if __name__ == '__main__': main() ...
25
13
656
307
def main(): length, operation = list(map(int, input().split())) direction = list(eval(input())) before = "" inverse = {"L": "R", "R": "L"} change = 0 section = 0 answer = 0 for i in range(length): if not before == direction[i]: before = direction[i] sectio...
def main(): n, k = list(map(int, input().split())) s = list("*" + eval(input()) + "*") count = 0 for i in range(1, n + 1): if (s[i] == s[i - 1] == "L") or (s[i] == s[i + 1] == "R"): count += 1 print((min(count + 2 * k, n - 1))) if __name__ == "__main__": main()
false
48
[ "- length, operation = list(map(int, input().split()))", "- direction = list(eval(input()))", "- before = \"\"", "- inverse = {\"L\": \"R\", \"R\": \"L\"}", "- change = 0", "- section = 0", "- answer = 0", "- for i in range(length):", "- if not before == direction[i]:"...
false
0.007484
0.153119
0.048877
[ "s386660897", "s632379999" ]
u326609687
p02579
python
s522324935
s272156176
512
151
114,476
35,592
Accepted
Accepted
70.51
import numpy as np from numba import njit, int32, int64 i4 = np.int32 i8 = np.int64 INF = 1000000000 @njit((int32[:,:], int64, int64), cache=True) def solve(s, ch, cw): H = s.shape[0] W = s.shape[1] - 1 ah = H + 4 aw = W + 4 a = np.full((ah, aw), -1, i4) for i in range(H): ...
import numpy as np i4 = np.int32 i8 = np.int64 INF = 1000000000 def solve(s, ch, cw): H = s.shape[0] W = s.shape[1] - 1 ah = H + 4 aw = W + 4 a = np.full((ah, aw), -1, i4) for i in range(H): for j in range(W): if s[i, j] == 46: a[i + 2, j ...
83
95
2,149
2,415
import numpy as np from numba import njit, int32, int64 i4 = np.int32 i8 = np.int64 INF = 1000000000 @njit((int32[:, :], int64, int64), cache=True) def solve(s, ch, cw): H = s.shape[0] W = s.shape[1] - 1 ah = H + 4 aw = W + 4 a = np.full((ah, aw), -1, i4) for i in range(H): for j in r...
import numpy as np i4 = np.int32 i8 = np.int64 INF = 1000000000 def solve(s, ch, cw): H = s.shape[0] W = s.shape[1] - 1 ah = H + 4 aw = W + 4 a = np.full((ah, aw), -1, i4) for i in range(H): for j in range(W): if s[i, j] == 46: a[i + 2, j + 2] = INF sh1...
false
12.631579
[ "-from numba import njit, int32, int64", "-@njit((int32[:, :], int64, int64), cache=True)", "-main(\"/dev/stdin\")", "+def cc_export():", "+ from numba.pycc import CC", "+ from numba import int32, int64", "+", "+ cc = CC(\"my_module\")", "+ cc.export(\"solve\", (int32[:, :], int64, int64...
false
0.435398
0.188171
2.313844
[ "s522324935", "s272156176" ]
u203843959
p03219
python
s698549516
s928512667
20
17
2,940
2,940
Accepted
Accepted
15
X,Y=list(map(int,input().split())) print((X+Y//2))
print((sum([int(x)//(i+1) for i,x in enumerate(input().split())])))
2
1
43
65
X, Y = list(map(int, input().split())) print((X + Y // 2))
print((sum([int(x) // (i + 1) for i, x in enumerate(input().split())])))
false
50
[ "-X, Y = list(map(int, input().split()))", "-print((X + Y // 2))", "+print((sum([int(x) // (i + 1) for i, x in enumerate(input().split())])))" ]
false
0.059746
0.04523
1.320939
[ "s698549516", "s928512667" ]
u054514819
p02787
python
s399361378
s693905935
1,680
455
3,572
43,100
Accepted
Accepted
72.92
H, N = list(map(int, input().split())) magics = [] for _ in range(N): a, b = list(map(int, input().split())) magics.append([a, b]) max_a = max(a for a, _ in magics) dp = [0]*(H+max_a) for i in range(1, H+max_a): dp[i] = min(dp[i-a]+b for a, b in magics) print((min(dp[H:])))
H, N = list(map(int, input().split())) magics = [tuple(map(int, input().split())) for _ in range(N)] maxA = max([x for x, y in magics]) dp = [10**18]*(H+maxA+1) dp[0] = 0 for i in range(1, H+maxA+1): for j in range(N): a, b = magics[j] if a<=i: dp[i] = min(dp[i-a]+b, dp[i]) ...
10
14
275
335
H, N = list(map(int, input().split())) magics = [] for _ in range(N): a, b = list(map(int, input().split())) magics.append([a, b]) max_a = max(a for a, _ in magics) dp = [0] * (H + max_a) for i in range(1, H + max_a): dp[i] = min(dp[i - a] + b for a, b in magics) print((min(dp[H:])))
H, N = list(map(int, input().split())) magics = [tuple(map(int, input().split())) for _ in range(N)] maxA = max([x for x, y in magics]) dp = [10**18] * (H + maxA + 1) dp[0] = 0 for i in range(1, H + maxA + 1): for j in range(N): a, b = magics[j] if a <= i: dp[i] = min(dp[i - a] + b, dp[i...
false
28.571429
[ "-magics = []", "-for _ in range(N):", "- a, b = list(map(int, input().split()))", "- magics.append([a, b])", "-max_a = max(a for a, _ in magics)", "-dp = [0] * (H + max_a)", "-for i in range(1, H + max_a):", "- dp[i] = min(dp[i - a] + b for a, b in magics)", "+magics = [tuple(map(int, inpu...
false
0.051242
0.084151
0.608932
[ "s399361378", "s693905935" ]
u525065967
p02612
python
s405012442
s514016174
31
23
8,956
9,028
Accepted
Accepted
25.81
r = 1000 - int(eval(input())) % 1000 print((r if r < 1000 else 0))
print(((1000 - int(eval(input())) % 1000) % 1000))
2
1
60
43
r = 1000 - int(eval(input())) % 1000 print((r if r < 1000 else 0))
print(((1000 - int(eval(input())) % 1000) % 1000))
false
50
[ "-r = 1000 - int(eval(input())) % 1000", "-print((r if r < 1000 else 0))", "+print(((1000 - int(eval(input())) % 1000) % 1000))" ]
false
0.03569
0.034681
1.029092
[ "s405012442", "s514016174" ]
u466116762
p02886
python
s128108561
s453052852
191
169
39,280
38,896
Accepted
Accepted
11.52
import itertools N=int(eval(input())) d_list=[int(i) for i in input().split()] comb = list(itertools.combinations(d_list, 2)) sum_heal = 0 for i,j in comb: sum_heal += i*j print(sum_heal)
N=int(eval(input())) d_list=[int(i) for i in input().split()] sum_heal = 0 for i in range(N): for j in range(i+1, N): sum_heal += d_list[i]*d_list[j] print(sum_heal)
8
7
192
178
import itertools N = int(eval(input())) d_list = [int(i) for i in input().split()] comb = list(itertools.combinations(d_list, 2)) sum_heal = 0 for i, j in comb: sum_heal += i * j print(sum_heal)
N = int(eval(input())) d_list = [int(i) for i in input().split()] sum_heal = 0 for i in range(N): for j in range(i + 1, N): sum_heal += d_list[i] * d_list[j] print(sum_heal)
false
12.5
[ "-import itertools", "-", "-comb = list(itertools.combinations(d_list, 2))", "-for i, j in comb:", "- sum_heal += i * j", "+for i in range(N):", "+ for j in range(i + 1, N):", "+ sum_heal += d_list[i] * d_list[j]" ]
false
0.045452
0.045258
1.004275
[ "s128108561", "s453052852" ]
u334712262
p02803
python
s991312130
s652722329
891
449
63,852
72,408
Accepted
Accepted
49.61
# -*- coding: utf-8 -*- import bisect import heapq import math import random import sys from collections import Counter, defaultdict, deque from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal from functools import lru_cache, reduce from itertools import combinations, combinations_with_replacement, produc...
# -*- coding: utf-8 -*- import bisect import heapq import math import random import sys from collections import Counter, defaultdict, deque from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal from functools import lru_cache, reduce from itertools import combinations, combinations_with_replacement, produc...
113
106
2,345
2,098
# -*- coding: utf-8 -*- import bisect import heapq import math import random import sys from collections import Counter, defaultdict, deque from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal from functools import lru_cache, reduce from itertools import combinations, combinations_with_replacement, product, permut...
# -*- coding: utf-8 -*- import bisect import heapq import math import random import sys from collections import Counter, defaultdict, deque from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal from functools import lru_cache, reduce from itertools import combinations, combinations_with_replacement, product, permut...
false
6.19469
[ "-def warshall_floyd(g, N):", "- d = g", "- for k in range(N):", "- for i in range(N):", "- for j in range(N):", "- if d[i][j] > d[i][k] + d[k][j]:", "- d[i][j] = d[i][k] + d[k][j]", "- return d", "-", "-", "+ def edges(v):", "+ ...
false
0.043738
0.036274
1.205767
[ "s991312130", "s652722329" ]
u581187895
p02911
python
s340970213
s982624467
250
129
8,244
8,228
Accepted
Accepted
48.4
N, K, Q = map(int, input().split()) score = [K-Q]*(N+1) for _ in range(Q): a = int(input()) score[a] += 1 [print("No" if ans < 1 else "Yes") for ans in score[1:]]
import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) N, K, Q = map(int, input().split()) score = [K-Q]*(N+1) for _ in range(Q): a = int(input()) score[a] += 1 [print("No" if ans < 1 else "Yes") for ans in score[1:]]
7
10
173
245
N, K, Q = map(int, input().split()) score = [K - Q] * (N + 1) for _ in range(Q): a = int(input()) score[a] += 1 [print("No" if ans < 1 else "Yes") for ans in score[1:]]
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) N, K, Q = map(int, input().split()) score = [K - Q] * (N + 1) for _ in range(Q): a = int(input()) score[a] += 1 [print("No" if ans < 1 else "Yes") for ans in score[1:]]
false
30
[ "+import sys", "+", "+input = sys.stdin.readline", "+sys.setrecursionlimit(10**7)" ]
false
0.036192
0.074625
0.484988
[ "s340970213", "s982624467" ]
u814663076
p03162
python
s701159055
s231792190
627
482
74,072
82,904
Accepted
Accepted
23.13
N = int(eval(input())) data = [[int(i) for i in input().split()] for _ in range(N)] dp = [[0] * 3 for _ in range(N)] dp[0] = data[0] for i in range(1, N): for j in range(3): dp[i][j] = data[i][j] + max(dp[i-1][(j+1)%3], dp[i-1][(j+2)%3]) print((max(dp[N-1])))
# region header import sys import math from bisect import bisect_left, bisect_right, insort_left, insort_right from collections import defaultdict, deque, Counter from copy import deepcopy from fractions import gcd from functools import lru_cache, reduce from heapq import heappop, heappush from itertools impor...
10
48
274
1,553
N = int(eval(input())) data = [[int(i) for i in input().split()] for _ in range(N)] dp = [[0] * 3 for _ in range(N)] dp[0] = data[0] for i in range(1, N): for j in range(3): dp[i][j] = data[i][j] + max(dp[i - 1][(j + 1) % 3], dp[i - 1][(j + 2) % 3]) print((max(dp[N - 1])))
# region header import sys import math from bisect import bisect_left, bisect_right, insort_left, insort_right from collections import defaultdict, deque, Counter from copy import deepcopy from fractions import gcd from functools import lru_cache, reduce from heapq import heappop, heappush from itertools import ( a...
false
79.166667
[ "-N = int(eval(input()))", "-data = [[int(i) for i in input().split()] for _ in range(N)]", "+# region header", "+import sys", "+import math", "+from bisect import bisect_left, bisect_right, insort_left, insort_right", "+from collections import defaultdict, deque, Counter", "+from copy import deepcopy...
false
0.042701
0.078856
0.541507
[ "s701159055", "s231792190" ]
u408260374
p00723
python
s508638494
s052425122
80
50
6,848
6,848
Accepted
Accepted
37.5
m = int(eval(input())) for i in range(m): d = eval(input()) trains = [d] for j in range(1, len(d)): trains.extend([d[:j][::-1] + d[j:], d[:j] + d[j:][::-1], d[:j][::-1] + d[j:][::-1], d[j:] + d[:j], d[j:][::-1] + d[:j], d[j:] + d[:j][::-1], d[j:][::-1] + d[:j][::-1]]) print((len(set(trains...
m = int(eval(input())) for i in range(m): d = eval(input()) trains = [d] for j in range(1, len(d)): f, b = d[:j], d[j:] rf, rb = f[::-1], b[::-1] trains.extend([rf+b, f+rb, rf+rb, b+f, rb+f, b+rf, rb+rf]) print((len(set(trains))))
7
9
310
264
m = int(eval(input())) for i in range(m): d = eval(input()) trains = [d] for j in range(1, len(d)): trains.extend( [ d[:j][::-1] + d[j:], d[:j] + d[j:][::-1], d[:j][::-1] + d[j:][::-1], d[j:] + d[:j], d[j:][:...
m = int(eval(input())) for i in range(m): d = eval(input()) trains = [d] for j in range(1, len(d)): f, b = d[:j], d[j:] rf, rb = f[::-1], b[::-1] trains.extend([rf + b, f + rb, rf + rb, b + f, rb + f, b + rf, rb + rf]) print((len(set(trains))))
false
22.222222
[ "- trains.extend(", "- [", "- d[:j][::-1] + d[j:],", "- d[:j] + d[j:][::-1],", "- d[:j][::-1] + d[j:][::-1],", "- d[j:] + d[:j],", "- d[j:][::-1] + d[:j],", "- d[j:] + d[:j][::-1],", "- ...
false
0.041732
0.041152
1.014082
[ "s508638494", "s052425122" ]
u112629957
p02727
python
s054613739
s897646338
367
248
106,980
23,328
Accepted
Accepted
32.43
X,Y,A,B,C=list(map(int,input().split())) ls_a=sorted(list(map(int,input().split()))) ls_b=sorted(list(map(int,input().split()))) ls_c=sorted(list(map(int,input().split()))) ls_x=ls_a[A-X:A] ls_y=ls_b[B-Y:B] ls_c.reverse() ans=sum(ls_x)+sum(ls_y) a=b=c=0 for _ in range(min([X+Y,C])): if a==len(ls_x): ...
X,Y,A,B,C=list(map(int,input().split())) ls_a=list(map(int,input().split())) ls_b=list(map(int,input().split())) ls_c=list(map(int,input().split())) ls_a.sort(reverse=True) ls_b.sort(reverse=True) ls_c.sort(reverse=True) ls=sorted(ls_a[:X]+ls_b[:Y]) ans=sum(ls) for i in range(min(X+Y, C)): if ls[i] < ...
40
15
827
366
X, Y, A, B, C = list(map(int, input().split())) ls_a = sorted(list(map(int, input().split()))) ls_b = sorted(list(map(int, input().split()))) ls_c = sorted(list(map(int, input().split()))) ls_x = ls_a[A - X : A] ls_y = ls_b[B - Y : B] ls_c.reverse() ans = sum(ls_x) + sum(ls_y) a = b = c = 0 for _ in range(min([X + Y, C...
X, Y, A, B, C = list(map(int, input().split())) ls_a = list(map(int, input().split())) ls_b = list(map(int, input().split())) ls_c = list(map(int, input().split())) ls_a.sort(reverse=True) ls_b.sort(reverse=True) ls_c.sort(reverse=True) ls = sorted(ls_a[:X] + ls_b[:Y]) ans = sum(ls) for i in range(min(X + Y, C)): i...
false
62.5
[ "-ls_a = sorted(list(map(int, input().split())))", "-ls_b = sorted(list(map(int, input().split())))", "-ls_c = sorted(list(map(int, input().split())))", "-ls_x = ls_a[A - X : A]", "-ls_y = ls_b[B - Y : B]", "-ls_c.reverse()", "-ans = sum(ls_x) + sum(ls_y)", "-a = b = c = 0", "-for _ in range(min([X ...
false
0.037852
0.045044
0.840326
[ "s054613739", "s897646338" ]
u389910364
p02776
python
s176399831
s317703527
1,798
1,404
149,352
129,372
Accepted
Accepted
21.91
import os import sys import numpy as np if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(10 ** 9) INF = float("inf") IINF = 10 ** 18 MOD = 10 ** 9 + 7 # MOD = 998244353 # 解説 N, M = list(map(int, sys.stdin.buffer.readline().split())) AB = [list(map(int, sys.stdin.bu...
import bisect import os import sys if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(10 ** 9) INF = float("inf") IINF = 10 ** 18 MOD = 10 ** 9 + 7 # MOD = 998244353 N, M = list(map(int, sys.stdin.buffer.readline().split())) AB = [list(map(int, sys.stdin.buffer.read...
69
113
1,578
2,566
import os import sys import numpy as np if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(10**9) INF = float("inf") IINF = 10**18 MOD = 10**9 + 7 # MOD = 998244353 # 解説 N, M = list(map(int, sys.stdin.buffer.readline().split())) AB = [list(map(int, sys.stdin.buffer.readline().split())) f...
import bisect import os import sys if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(10**9) INF = float("inf") IINF = 10**18 MOD = 10**9 + 7 # MOD = 998244353 N, M = list(map(int, sys.stdin.buffer.readline().split())) AB = [list(map(int, sys.stdin.buffer.readline().split())) for _ in ra...
false
38.938053
[ "+import bisect", "-import numpy as np", "-# 解説", "-AB = np.array(AB, dtype=int)", "-LR = np.array(LR, dtype=int)", "-AB = AB[np.argsort(AB[:, 0])]", "-A, B = AB[:, 0], AB[:, 1]", "-L, R = LR[:, 0], LR[:, 1]", "-L = np.searchsorted(A, L, side=\"left\").tolist()", "-R = np.searchsorted(A, R, side=\...
false
0.603912
0.07525
8.025456
[ "s176399831", "s317703527" ]
u590825760
p02762
python
s983532220
s398704241
1,571
1,168
48,452
10,268
Accepted
Accepted
25.65
N, M, K = map(int, input().split()) F = [[] for _ in range(N)] B = [[] for _ in range(N)] for _ in range(M): a, b = map(int, input().split()) a, b = a - 1, b - 1 F[a].append(b) F[b].append(a) for _ in range(K): c, d = map(int, input().split()) c, d = c - 1, d - 1 B[c].append(d...
class UnionFind(): def __init__(self,n): self.n = n self.parents = [-1] * (n+1) def FindRoot(self,x): if self.parents[x] < 0: return x else: self.parents[x] = self.FindRoot(self.parents[x]) return self.parents[x] def Union...
73
48
1,646
1,175
N, M, K = map(int, input().split()) F = [[] for _ in range(N)] B = [[] for _ in range(N)] for _ in range(M): a, b = map(int, input().split()) a, b = a - 1, b - 1 F[a].append(b) F[b].append(a) for _ in range(K): c, d = map(int, input().split()) c, d = c - 1, d - 1 B[c].append(d) B[d].appe...
class UnionFind: def __init__(self, n): self.n = n self.parents = [-1] * (n + 1) def FindRoot(self, x): if self.parents[x] < 0: return x else: self.parents[x] = self.FindRoot(self.parents[x]) return self.parents[x] def Union(self, x, y): ...
false
34.246575
[ "-N, M, K = map(int, input().split())", "-F = [[] for _ in range(N)]", "-B = [[] for _ in range(N)]", "-for _ in range(M):", "- a, b = map(int, input().split())", "- a, b = a - 1, b - 1", "- F[a].append(b)", "- F[b].append(a)", "-for _ in range(K):", "- c, d = map(int, input().split...
false
0.038172
0.038361
0.995075
[ "s983532220", "s398704241" ]
u297574184
p02936
python
s911490525
s669732914
1,577
944
284,052
144,092
Accepted
Accepted
40.14
def solve(): import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline N, Q = list(map(int, input().split())) adjL = [[] for _ in range(N)] for _ in range(N-1): A, B = list(map(int, input().split())) A, B = A-1, B-1 adjL[A].append(B) adjL[B].a...
from collections import deque import sys input = sys.stdin.readline N, Q = list(map(int, input().split())) adjL = [[] for _ in range(N)] for _ in range(N-1): a, b = list(map(int, input().split())) a, b = a-1, b-1 adjL[a].append(b) adjL[b].append(a) querys = [tuple(map(int, input().split())) ...
31
33
692
747
def solve(): import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline N, Q = list(map(int, input().split())) adjL = [[] for _ in range(N)] for _ in range(N - 1): A, B = list(map(int, input().split())) A, B = A - 1, B - 1 adjL[A].append(B) adjL[B].append...
from collections import deque import sys input = sys.stdin.readline N, Q = list(map(int, input().split())) adjL = [[] for _ in range(N)] for _ in range(N - 1): a, b = list(map(int, input().split())) a, b = a - 1, b - 1 adjL[a].append(b) adjL[b].append(a) querys = [tuple(map(int, input().split())) for _...
false
6.060606
[ "-def solve():", "- import sys", "+from collections import deque", "+import sys", "- sys.setrecursionlimit(10**9)", "- input = sys.stdin.readline", "- N, Q = list(map(int, input().split()))", "- adjL = [[] for _ in range(N)]", "- for _ in range(N - 1):", "- A, B = list(map...
false
0.036457
0.036143
1.008693
[ "s911490525", "s669732914" ]
u796942881
p03659
python
s059597851
s884405733
148
118
24,216
24,320
Accepted
Accepted
20.27
INF = float('inf') def main(): N, *a = list(map(int, open(0).read().split())) ans = INF tmp = 0 total = sum(a) for i in range(N - 1): tmp += a[i] ans = min(ans, abs(2 * tmp - total)) print(ans) return main()
from itertools import accumulate def main(): N, *a = list(map(int, open(0).read().split())) a = list(accumulate(a)) total = a[-1] print((min(abs(2 * a[i] - total) for i in range(N - 1)))) return main()
16
12
265
229
INF = float("inf") def main(): N, *a = list(map(int, open(0).read().split())) ans = INF tmp = 0 total = sum(a) for i in range(N - 1): tmp += a[i] ans = min(ans, abs(2 * tmp - total)) print(ans) return main()
from itertools import accumulate def main(): N, *a = list(map(int, open(0).read().split())) a = list(accumulate(a)) total = a[-1] print((min(abs(2 * a[i] - total) for i in range(N - 1)))) return main()
false
25
[ "-INF = float(\"inf\")", "+from itertools import accumulate", "- ans = INF", "- tmp = 0", "- total = sum(a)", "- for i in range(N - 1):", "- tmp += a[i]", "- ans = min(ans, abs(2 * tmp - total))", "- print(ans)", "+ a = list(accumulate(a))", "+ total = a[-1]", ...
false
0.046078
0.04503
1.023261
[ "s059597851", "s884405733" ]
u077291787
p03645
python
s064267600
s039034142
266
244
19,004
19,012
Accepted
Accepted
8.27
# ARC079C - Cat Snuke and a Voyage (ABC068C) import sys input = sys.stdin.readline def main(): n, m = list(map(int, input().rstrip().split())) s, d = set(), set() for _ in range(m): a, b = list(map(int, input().rstrip().split())) if a == 1: s.add(b) elif b == ...
# ARC079C - Cat Snuke and a Voyage (ABC068C) import sys input = sys.stdin.readline def main(): n, m = list(map(int, input().split())) s, d = set(), set() for _ in range(m): a, b = list(map(int, input().split())) if a == 1: s.add(b) elif b == n: d....
18
18
426
409
# ARC079C - Cat Snuke and a Voyage (ABC068C) import sys input = sys.stdin.readline def main(): n, m = list(map(int, input().rstrip().split())) s, d = set(), set() for _ in range(m): a, b = list(map(int, input().rstrip().split())) if a == 1: s.add(b) elif b == n: ...
# ARC079C - Cat Snuke and a Voyage (ABC068C) import sys input = sys.stdin.readline def main(): n, m = list(map(int, input().split())) s, d = set(), set() for _ in range(m): a, b = list(map(int, input().split())) if a == 1: s.add(b) elif b == n: d.add(a) ...
false
0
[ "- n, m = list(map(int, input().rstrip().split()))", "+ n, m = list(map(int, input().split()))", "- a, b = list(map(int, input().rstrip().split()))", "+ a, b = list(map(int, input().split()))" ]
false
0.185639
0.047343
3.921179
[ "s064267600", "s039034142" ]
u415905784
p03504
python
s004381313
s871964292
1,355
1,163
27,168
40,804
Accepted
Accepted
14.17
import functools N, C = list(map(int, input().split())) T = [[0 for i in range(10 ** 5 + 1)] for j in range(C)] for i in range(N): s, t, c = list(map(int, input().split())) for j in range(s - 1, t): T[c - 1][j] = 1 ans = 0 for j in range(10 ** 5 + 1): r = 0 for i in range(C): r += T[i][j] ...
import functools N, C = list(map(int, input().split())) P = [[0 for c in range(C)] for i in range(10 ** 5 + 1)] T = 0 for i in range(N): s, t, c = list(map(int, input().split())) T = max(t, T) for j in range(s - 1, t): P[j][c - 1] = 1 ans = 0 for p in P[:T + 1]: ans = max(sum(p), ans) print(ans)
14
13
337
308
import functools N, C = list(map(int, input().split())) T = [[0 for i in range(10**5 + 1)] for j in range(C)] for i in range(N): s, t, c = list(map(int, input().split())) for j in range(s - 1, t): T[c - 1][j] = 1 ans = 0 for j in range(10**5 + 1): r = 0 for i in range(C): r += T[i][j] ...
import functools N, C = list(map(int, input().split())) P = [[0 for c in range(C)] for i in range(10**5 + 1)] T = 0 for i in range(N): s, t, c = list(map(int, input().split())) T = max(t, T) for j in range(s - 1, t): P[j][c - 1] = 1 ans = 0 for p in P[: T + 1]: ans = max(sum(p), ans) print(ans)...
false
7.142857
[ "-T = [[0 for i in range(10**5 + 1)] for j in range(C)]", "+P = [[0 for c in range(C)] for i in range(10**5 + 1)]", "+T = 0", "+ T = max(t, T)", "- T[c - 1][j] = 1", "+ P[j][c - 1] = 1", "-for j in range(10**5 + 1):", "- r = 0", "- for i in range(C):", "- r += T[i][j]...
false
0.307886
0.198727
1.549292
[ "s004381313", "s871964292" ]
u202727309
p03162
python
s207714770
s669213924
1,000
573
47,352
34,616
Accepted
Accepted
42.7
N = int(eval(input())) Y = [] for _ in range(N): Y.append(list(map(int, input().split()))) # Y = [[3, 9, 7], [10, 3, 2]] dp = [[0] * 3 for _ in range(N)] # 初期化 dp[0] = Y[0] # 初期化 # A, B, C の3パターン以外にも対応 for i in range(N-1): for j in range(3): for k in range(3): if j == k: ...
N = int(eval(input())) A = [0] * N B = [0] * N C = [0] * N for i in range(N): A[i], B[i], C[i] = list(map(int, input().split())) dp = [[0] * 3 for _ in range(N)] # 初期化 [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]] for n = 4 dp[0] = [A[0], B[0], C[0]] for i in range(N-1): dp[i+1][0] = max(dp[i][1]+A[i...
15
14
419
462
N = int(eval(input())) Y = [] for _ in range(N): Y.append(list(map(int, input().split()))) # Y = [[3, 9, 7], [10, 3, 2]] dp = [[0] * 3 for _ in range(N)] # 初期化 dp[0] = Y[0] # 初期化 # A, B, C の3パターン以外にも対応 for i in range(N - 1): for j in range(3): for k in range(3): if j == k: ...
N = int(eval(input())) A = [0] * N B = [0] * N C = [0] * N for i in range(N): A[i], B[i], C[i] = list(map(int, input().split())) dp = [ [0] * 3 for _ in range(N) ] # 初期化 [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]] for n = 4 dp[0] = [A[0], B[0], C[0]] for i in range(N - 1): dp[i + 1][0] = max(dp[i][1] + A[...
false
6.666667
[ "-Y = []", "-for _ in range(N):", "- Y.append(list(map(int, input().split()))) # Y = [[3, 9, 7], [10, 3, 2]]", "-dp = [[0] * 3 for _ in range(N)] # 初期化", "-dp[0] = Y[0] # 初期化", "-# A, B, C の3パターン以外にも対応", "+A = [0] * N", "+B = [0] * N", "+C = [0] * N", "+for i in range(N):", "+ A[i], B[i...
false
0.042498
0.036902
1.151646
[ "s207714770", "s669213924" ]
u566529875
p03112
python
s065734394
s052475138
1,655
1,530
12,092
12,072
Accepted
Accepted
7.55
import bisect a,b,q=list(map(int,input().split())) s=[int(eval(input()))for _ in range(a)] s.append(12345678901234) s.insert(0,-12345678901234) t=[int(eval(input()))for _ in range(b)] t.append(12345678901234) t.insert(0,-12345678901234) for query in range(q): ans = 123456789012345 x=int(eval(input()))...
import bisect a,b,q=list(map(int,input().split())) INF = 12345678901234 s=[int(eval(input()))for _ in range(a)] s.append(INF) s.insert(0,-INF) t=[int(eval(input()))for _ in range(b)] t.append(INF) t.insert(0,-INF) for query in range(q): ans = INF x=int(eval(input())) idxs = bisect.bisect_left(s,...
30
25
759
614
import bisect a, b, q = list(map(int, input().split())) s = [int(eval(input())) for _ in range(a)] s.append(12345678901234) s.insert(0, -12345678901234) t = [int(eval(input())) for _ in range(b)] t.append(12345678901234) t.insert(0, -12345678901234) for query in range(q): ans = 123456789012345 x = int(eval(inp...
import bisect a, b, q = list(map(int, input().split())) INF = 12345678901234 s = [int(eval(input())) for _ in range(a)] s.append(INF) s.insert(0, -INF) t = [int(eval(input())) for _ in range(b)] t.append(INF) t.insert(0, -INF) for query in range(q): ans = INF x = int(eval(input())) idxs = bisect.bisect_lef...
false
16.666667
[ "+INF = 12345678901234", "-s.append(12345678901234)", "-s.insert(0, -12345678901234)", "+s.append(INF)", "+s.insert(0, -INF)", "-t.append(12345678901234)", "-t.insert(0, -12345678901234)", "+t.append(INF)", "+t.insert(0, -INF)", "- ans = 123456789012345", "+ ans = INF", "- ls = s[idxs...
false
0.045345
0.045118
1.00505
[ "s065734394", "s052475138" ]
u021019433
p02837
python
s642703666
s766619123
90
52
3,188
3,064
Accepted
Accepted
42.22
from itertools import combinations n = int(eval(input())) l = (1 << n) - 1 r = list(range(n)) a = [[0, 0] for _ in r] for i in r: for _ in range(int(eval(input()))): x, y = list(map(int, input().split())) a[i][y] |= 1 << x - 1 def fail(x): x = sum(1 << i for i in x) return not all(a[i][0] &...
from itertools import combinations, count n = int(eval(input())) r = list(range(n)) a = [(set(), set()) for _ in r] for i in r: for _ in range(int(eval(input()))): x, y = list(map(int, input().split())) a[i][y].add(x - 1) r = next(i for i in count(n, - 1) for x in map(set, combinations(r, i)) ...
18
12
414
368
from itertools import combinations n = int(eval(input())) l = (1 << n) - 1 r = list(range(n)) a = [[0, 0] for _ in r] for i in r: for _ in range(int(eval(input()))): x, y = list(map(int, input().split())) a[i][y] |= 1 << x - 1 def fail(x): x = sum(1 << i for i in x) return not all(a[i][0]...
from itertools import combinations, count n = int(eval(input())) r = list(range(n)) a = [(set(), set()) for _ in r] for i in r: for _ in range(int(eval(input()))): x, y = list(map(int, input().split())) a[i][y].add(x - 1) r = next( i for i in count(n, -1) for x in map(set, combinations(...
false
33.333333
[ "-from itertools import combinations", "+from itertools import combinations, count", "-l = (1 << n) - 1", "-a = [[0, 0] for _ in r]", "+a = [(set(), set()) for _ in r]", "- a[i][y] |= 1 << x - 1", "-", "-", "-def fail(x):", "- x = sum(1 << i for i in x)", "- return not all(a[i][0] &...
false
0.084306
0.101695
0.829006
[ "s642703666", "s766619123" ]
u669382434
p03221
python
s705509512
s735368092
978
739
51,216
34,712
Accepted
Accepted
24.44
from operator import itemgetter N,M=list(map(int,input().split())) PY=[] P=[[] for i in range(N)] ans=[0 for i in range(M)] for i in range(M): PYi=list(map(int,input().split())) PY.append(PYi) P[PYi[0]-1].append([i,PYi[1]]) for i in range(N): P[i]=sorted(P[i], key=itemgetter(1)) for i i...
from operator import itemgetter N,M=list(map(int,input().split())) PY=[] ans=[0 for i in range(M)] cc=[0 for i in range(N)] for i in range(M): PYi=list(map(int,input().split())) PY.append([i,PYi[0],PYi[1]]) PY=sorted(PY, key=itemgetter(2)) for i in range(M): cc[PY[i][1]-1]+=1 ans[P...
22
18
482
415
from operator import itemgetter N, M = list(map(int, input().split())) PY = [] P = [[] for i in range(N)] ans = [0 for i in range(M)] for i in range(M): PYi = list(map(int, input().split())) PY.append(PYi) P[PYi[0] - 1].append([i, PYi[1]]) for i in range(N): P[i] = sorted(P[i], key=itemgetter(1)) for i...
from operator import itemgetter N, M = list(map(int, input().split())) PY = [] ans = [0 for i in range(M)] cc = [0 for i in range(N)] for i in range(M): PYi = list(map(int, input().split())) PY.append([i, PYi[0], PYi[1]]) PY = sorted(PY, key=itemgetter(2)) for i in range(M): cc[PY[i][1] - 1] += 1 ans[P...
false
18.181818
[ "-P = [[] for i in range(N)]", "+cc = [0 for i in range(N)]", "- PY.append(PYi)", "- P[PYi[0] - 1].append([i, PYi[1]])", "-for i in range(N):", "- P[i] = sorted(P[i], key=itemgetter(1))", "-for i in range(N):", "- for j in range(len(P[i])):", "- ans[P[i][j][0]] = j + 1", "+ P...
false
0.040855
0.048059
0.850096
[ "s705509512", "s735368092" ]
u347640436
p03450
python
s059756406
s450779738
1,044
889
39,088
65,888
Accepted
Accepted
14.85
# Union Find 木 from sys import setrecursionlimit, stdin def find(parent, diff_weight, i): t = parent[i] if t < 0: return i t = find(parent, diff_weight, t) diff_weight[i] += diff_weight[parent[i]] parent[i] = t return t def weight(parent, diff_weight, i): find(pare...
# 深さ優先探索 from sys import stdin N, M = list(map(int, stdin.readline().split())) links = [[] for _ in range(N + 1)] for _ in range(M): L, R, D = list(map(int, stdin.readline().split())) links[L].append((R, D)) links[R].append((L, -D)) t = [None] * (N + 1) for i in range(1, N + 1): if t[i] ...
48
28
1,186
656
# Union Find 木 from sys import setrecursionlimit, stdin def find(parent, diff_weight, i): t = parent[i] if t < 0: return i t = find(parent, diff_weight, t) diff_weight[i] += diff_weight[parent[i]] parent[i] = t return t def weight(parent, diff_weight, i): find(parent, diff_weight...
# 深さ優先探索 from sys import stdin N, M = list(map(int, stdin.readline().split())) links = [[] for _ in range(N + 1)] for _ in range(M): L, R, D = list(map(int, stdin.readline().split())) links[L].append((R, D)) links[R].append((L, -D)) t = [None] * (N + 1) for i in range(1, N + 1): if t[i] is not None: ...
false
41.666667
[ "-# Union Find 木", "-from sys import setrecursionlimit, stdin", "+# 深さ優先探索", "+from sys import stdin", "-", "-def find(parent, diff_weight, i):", "- t = parent[i]", "- if t < 0:", "- return i", "- t = find(parent, diff_weight, t)", "- diff_weight[i] += diff_weight[parent[i]]",...
false
0.114508
0.085521
1.338943
[ "s059756406", "s450779738" ]
u025501820
p03108
python
s298718074
s027427882
992
914
123,952
116,184
Accepted
Accepted
7.86
N, M = list(map(int, input().split())) 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...
N, M = list(map(int, input().split())) 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...
74
65
1,812
1,561
N, M = list(map(int, input().split())) 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] ...
N, M = list(map(int, input().split())) 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] ...
false
12.162162
[ "-size = [0] * (N + 1)", "+size = [1] * (N + 1)", "- if x not in roots:", "- roots.add(x)", "- size[x] = 2", "- not_fuben += 1", "- else:", "- if y in roots:", "- not_fuben += size[y] * size[x]", "- size[x] += ...
false
0.0448
0.098011
0.457089
[ "s298718074", "s027427882" ]
u332793228
p02993
python
s488652232
s868003708
22
17
9,052
2,940
Accepted
Accepted
22.73
a,b,c,d=eval(input()) print(("Bad"if a==b or b==c or c==d else"Good"))
s=eval(input()) print(("Good"if s[0]!=s[1]!=s[2]!=s[3] else "Bad"))
2
2
63
60
a, b, c, d = eval(input()) print(("Bad" if a == b or b == c or c == d else "Good"))
s = eval(input()) print(("Good" if s[0] != s[1] != s[2] != s[3] else "Bad"))
false
0
[ "-a, b, c, d = eval(input())", "-print((\"Bad\" if a == b or b == c or c == d else \"Good\"))", "+s = eval(input())", "+print((\"Good\" if s[0] != s[1] != s[2] != s[3] else \"Bad\"))" ]
false
0.036824
0.069179
0.532303
[ "s488652232", "s868003708" ]
u320098990
p03448
python
s368252364
s212332322
54
27
3,060
9,084
Accepted
Accepted
50
# ABC-087_B-Coins A_num = int(eval(input())) B_num = int(eval(input())) C_num = int(eval(input())) X_yen = int(eval(input())) count = 0 for a in range(A_num+1): for b in range(B_num+1): for c in range(C_num+1): total = 500*a + 100*b + 50*c if total == X_yen: ...
in_a = eval(input()) in_b = eval(input()) in_c = eval(input()) in_x = eval(input()) A = int(in_a) B = int(in_b) C = int(in_c) X = int(in_x) count = 0 for i in range(A+1): for j in range(B+1): k = ( X - 500*i - 100*j ) / 50 # print(f'k:{k}') if k < 0: break; ...
16
22
328
411
# ABC-087_B-Coins A_num = int(eval(input())) B_num = int(eval(input())) C_num = int(eval(input())) X_yen = int(eval(input())) count = 0 for a in range(A_num + 1): for b in range(B_num + 1): for c in range(C_num + 1): total = 500 * a + 100 * b + 50 * c if total == X_yen: ...
in_a = eval(input()) in_b = eval(input()) in_c = eval(input()) in_x = eval(input()) A = int(in_a) B = int(in_b) C = int(in_c) X = int(in_x) count = 0 for i in range(A + 1): for j in range(B + 1): k = (X - 500 * i - 100 * j) / 50 # print(f'k:{k}') if k < 0: break elif k.is...
false
27.272727
[ "-# ABC-087_B-Coins", "-A_num = int(eval(input()))", "-B_num = int(eval(input()))", "-C_num = int(eval(input()))", "-X_yen = int(eval(input()))", "+in_a = eval(input())", "+in_b = eval(input())", "+in_c = eval(input())", "+in_x = eval(input())", "+A = int(in_a)", "+B = int(in_b)", "+C = int(in...
false
0.09571
0.036062
2.654051
[ "s368252364", "s212332322" ]
u576917603
p03693
python
s845600983
s995876723
27
19
3,700
2,940
Accepted
Accepted
29.63
a = int(input().replace(" ","")) if a % 4 == 0: print("YES") else: print("NO")
a,b,c=input().split() x=a x+=b x+=c if int(x)%4==0: print('YES') else: print('NO')
7
8
99
97
a = int(input().replace(" ", "")) if a % 4 == 0: print("YES") else: print("NO")
a, b, c = input().split() x = a x += b x += c if int(x) % 4 == 0: print("YES") else: print("NO")
false
12.5
[ "-a = int(input().replace(\" \", \"\"))", "-if a % 4 == 0:", "+a, b, c = input().split()", "+x = a", "+x += b", "+x += c", "+if int(x) % 4 == 0:" ]
false
0.066534
0.037434
1.777366
[ "s845600983", "s995876723" ]
u597455618
p03241
python
s986783637
s065199108
32
28
9,320
9,312
Accepted
Accepted
12.5
def divisor(n): i = 1 res = [] for i in range(1, int(n**.5) + 1): if n%i == 0: res.append(i) if n//i not in res: res.append(n//i) res.sort() return res def main(): n, m = list(map(int, input().split())) md = divisor(m) ans = ...
def divisor(n): i = 1 res = [] for i in range(1, int(n**.5) + 1): if n%i == 0: res.append(i) if n//i not in res: res.append(n//i) res.sort(reverse=True) return res def main(): n, m = list(map(int, input().split())) md = divisor(m)...
24
22
495
451
def divisor(n): i = 1 res = [] for i in range(1, int(n**0.5) + 1): if n % i == 0: res.append(i) if n // i not in res: res.append(n // i) res.sort() return res def main(): n, m = list(map(int, input().split())) md = divisor(m) ans = 0 ...
def divisor(n): i = 1 res = [] for i in range(1, int(n**0.5) + 1): if n % i == 0: res.append(i) if n // i not in res: res.append(n // i) res.sort(reverse=True) return res def main(): n, m = list(map(int, input().split())) md = divisor(m) ...
false
8.333333
[ "- res.sort()", "+ res.sort(reverse=True)", "- if (m - n * i) % i == 0 and (m - n * i) >= 0:", "- ans = i", "- else:", "- break", "- print(ans)", "+ if i * n <= m:", "+ print(i)", "+ exit()" ]
false
0.047578
0.041948
1.13421
[ "s986783637", "s065199108" ]
u541055501
p02577
python
s443074487
s011935464
357
325
84,916
84,940
Accepted
Accepted
8.96
print("YNeos"[int(eval(input()))%9!=0::2])
print("YNeos"[int(eval(input()))%9>0::2])
1
1
34
33
print("YNeos"[int(eval(input())) % 9 != 0 :: 2])
print("YNeos"[int(eval(input())) % 9 > 0 :: 2])
false
0
[ "-print(\"YNeos\"[int(eval(input())) % 9 != 0 :: 2])", "+print(\"YNeos\"[int(eval(input())) % 9 > 0 :: 2])" ]
false
0.075084
0.072577
1.03454
[ "s443074487", "s011935464" ]
u131464432
p03086
python
s780598450
s277425764
31
26
9,024
9,040
Accepted
Accepted
16.13
s = eval(input()) left = 0 ans = 0 for right in range(0,len(s)): if s[right] in ("A","C","G","T"): pass else: left=right+1 ans = max(ans,right-left+1) print(ans)
s = eval(input()) ans = 0 for i in range(len(s)): for j in range(i,len(s)): if all("ATGC".count(c) == 1 for c in s[i:j+1]): ans = max(ans,j-i+1) print(ans)
10
7
178
167
s = eval(input()) left = 0 ans = 0 for right in range(0, len(s)): if s[right] in ("A", "C", "G", "T"): pass else: left = right + 1 ans = max(ans, right - left + 1) print(ans)
s = eval(input()) ans = 0 for i in range(len(s)): for j in range(i, len(s)): if all("ATGC".count(c) == 1 for c in s[i : j + 1]): ans = max(ans, j - i + 1) print(ans)
false
30
[ "-left = 0", "-for right in range(0, len(s)):", "- if s[right] in (\"A\", \"C\", \"G\", \"T\"):", "- pass", "- else:", "- left = right + 1", "- ans = max(ans, right - left + 1)", "+for i in range(len(s)):", "+ for j in range(i, len(s)):", "+ if all(\"ATGC\".count(c...
false
0.034696
0.035534
0.976425
[ "s780598450", "s277425764" ]
u645250356
p03739
python
s122523016
s644311954
159
135
16,392
16,392
Accepted
Accepted
15.09
from collections import Counter,defaultdict import sys,heapq,bisect,math,itertools,string,queue,fractions mod = 10**9+7 def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) def inpln(n): return list(int(sys.stdin.readline()) for i in range(n)) def inpl_str():...
from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify from bisect import bisect_left,bisect_right import sys,math,itertools,fractions,pprint sys.setrecursionlimit(10**8) mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(m...
44
42
1,095
944
from collections import Counter, defaultdict import sys, heapq, bisect, math, itertools, string, queue, fractions mod = 10**9 + 7 def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) def inpln(n): return list(int(sys.stdin.readline()) for i in ra...
from collections import Counter, defaultdict, deque from heapq import heappop, heappush, heapify from bisect import bisect_left, bisect_right import sys, math, itertools, fractions, pprint sys.setrecursionlimit(10**8) mod = 10**9 + 7 INF = float("inf") def inp(): return int(sys.stdin.readline()) def inpl(): ...
false
4.545455
[ "-from collections import Counter, defaultdict", "-import sys, heapq, bisect, math, itertools, string, queue, fractions", "+from collections import Counter, defaultdict, deque", "+from heapq import heappop, heappush, heapify", "+from bisect import bisect_left, bisect_right", "+import sys, math, itertools,...
false
0.050434
0.04258
1.184461
[ "s122523016", "s644311954" ]
u246033265
p00008
python
s566096371
s975739576
20
10
4,232
4,236
Accepted
Accepted
50
memo = [[None for i in range(51)] for j in range(5)] memo[0][0] = 1 for i in range(1, 51): memo[0][i] = 0 def f(n, sm): if memo[n][sm] is not None: return memo[n][sm] memo[n][sm] = 0 for i in range(min(10, sm + 1)): memo[n][sm] += f(n - 1, sm - i) return memo[n][sm] ...
def mlist(n, *args, **keys): if len(args) == 0: return [keys.get('default')] * n else: return [mlist(*args, **keys) for i in range(n)] def f(n, sm): if n == 0: return int(sm == 0) if memo[n][sm] is not None: return memo[n][sm] ...
19
23
398
591
memo = [[None for i in range(51)] for j in range(5)] memo[0][0] = 1 for i in range(1, 51): memo[0][i] = 0 def f(n, sm): if memo[n][sm] is not None: return memo[n][sm] memo[n][sm] = 0 for i in range(min(10, sm + 1)): memo[n][sm] += f(n - 1, sm - i) return memo[n][sm] try: whil...
def mlist(n, *args, **keys): if len(args) == 0: return [keys.get("default")] * n else: return [mlist(*args, **keys) for i in range(n)] def f(n, sm): if n == 0: return int(sm == 0) if memo[n][sm] is not None: return memo[n][sm] memo[n][sm] = 0 for i in range(min(...
false
17.391304
[ "-memo = [[None for i in range(51)] for j in range(5)]", "-memo[0][0] = 1", "-for i in range(1, 51):", "- memo[0][i] = 0", "+def mlist(n, *args, **keys):", "+ if len(args) == 0:", "+ return [keys.get(\"default\")] * n", "+ else:", "+ return [mlist(*args, **keys) for i in range...
false
0.167942
0.110027
1.526369
[ "s566096371", "s975739576" ]
u013629972
p03147
python
s928881524
s749177468
741
166
12,320
12,468
Accepted
Accepted
77.6
import sys import numpy as np # sys.setrecursionlimit(10**7) # inf = 10 ** 20 # eps = 1.0 / 10**10 # mod = 10**9+7 # dd = [(-1, 0), (0, 1), (1, 0), (0, -1)] # ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)] def LI(): return [int(x) for x in sys.stdin.readline().split()...
# import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools import sys import numpy as np # sys.setrecursionlimit(10**7) # inf = 10 ** 20 # eps = 1.0 / 10**10 # mod = 10**9+7 # dd = [(-1, 0), (0, 1), (1, 0), (0, -1)] # ddn = [(-1, 0), (-1, 1...
56
58
1,467
1,668
import sys import numpy as np # sys.setrecursionlimit(10**7) # inf = 10 ** 20 # eps = 1.0 / 10**10 # mod = 10**9+7 # dd = [(-1, 0), (0, 1), (1, 0), (0, -1)] # ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)] def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_...
# import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools import sys import numpy as np # sys.setrecursionlimit(10**7) # inf = 10 ** 20 # eps = 1.0 / 10**10 # mod = 10**9+7 # dd = [(-1, 0), (0, 1), (1, 0), (0, -1)] # ddn = [(-1, 0), (-1, 1), (0, 1), ...
false
3.448276
[ "+# import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools", "- h[first_non_zero_idx:first_zero_idx] -= 1", "- count += 1", "+ min_value = min(h[first_non_zero_idx:first_zero_idx])", "+ h[first_non_zero_idx:first_zer...
false
0.576367
0.33179
1.737143
[ "s928881524", "s749177468" ]
u844646164
p03435
python
s659475710
s543428762
153
73
12,480
61,804
Accepted
Accepted
52.29
import numpy as np C = np.array([list(map(int, input().split())) for _ in range(3)]) c12 = C[1]-C[0] c23 = C[2]-C[1] if len(set(c12)) == 1 and len(set(c23)) == 1: CT = C.T ct12 = CT[1]-CT[0] ct23 = CT[2]-CT[1] if len(set(ct12)) == 1 and len(set(ct23)) == 1: print('Yes') else: ...
c = [list(map(int, input().split())) for _ in range(3)] x1 = c[0][0]-c[1][0] x2 = c[0][1]-c[1][1] x3 = c[0][2]-c[1][2] x4 = c[1][0]-c[2][0] x5 = c[1][1]-c[2][1] x6 = c[1][2]-c[2][2] if x1==x2 and x2==x3: pass else: print('No') exit() if x4==x5 and x5==x6: pass else: print('No'...
14
40
360
625
import numpy as np C = np.array([list(map(int, input().split())) for _ in range(3)]) c12 = C[1] - C[0] c23 = C[2] - C[1] if len(set(c12)) == 1 and len(set(c23)) == 1: CT = C.T ct12 = CT[1] - CT[0] ct23 = CT[2] - CT[1] if len(set(ct12)) == 1 and len(set(ct23)) == 1: print("Yes") else: ...
c = [list(map(int, input().split())) for _ in range(3)] x1 = c[0][0] - c[1][0] x2 = c[0][1] - c[1][1] x3 = c[0][2] - c[1][2] x4 = c[1][0] - c[2][0] x5 = c[1][1] - c[2][1] x6 = c[1][2] - c[2][2] if x1 == x2 and x2 == x3: pass else: print("No") exit() if x4 == x5 and x5 == x6: pass else: print("No") ...
false
65
[ "-import numpy as np", "-", "-C = np.array([list(map(int, input().split())) for _ in range(3)])", "-c12 = C[1] - C[0]", "-c23 = C[2] - C[1]", "-if len(set(c12)) == 1 and len(set(c23)) == 1:", "- CT = C.T", "- ct12 = CT[1] - CT[0]", "- ct23 = CT[2] - CT[1]", "- if len(set(ct12)) == 1 an...
false
0.447106
0.063902
6.996772
[ "s659475710", "s543428762" ]
u645250356
p03945
python
s587226175
s585853589
192
133
40,428
77,116
Accepted
Accepted
30.73
from collections import Counter,defaultdict 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()) def inpl...
from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify from bisect import bisect_left,bisect_right import sys,math,itertools,fractions,pprint sys.setrecursionlimit(10**8) mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(m...
23
18
616
471
from collections import Counter, defaultdict 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.readlin...
from collections import Counter, defaultdict, deque from heapq import heappop, heappush, heapify from bisect import bisect_left, bisect_right import sys, math, itertools, fractions, pprint sys.setrecursionlimit(10**8) mod = 10**9 + 7 INF = float("inf") def inp(): return int(sys.stdin.readline()) def inpl(): ...
false
21.73913
[ "-from collections import Counter, defaultdict", "-import sys, heapq, bisect, math, itertools, string, queue", "+from collections import Counter, defaultdict, deque", "+from heapq import heappop, heappush, heapify", "+from bisect import bisect_left, bisect_right", "+import sys, math, itertools, fractions,...
false
0.037438
0.037702
0.993005
[ "s587226175", "s585853589" ]
u583507988
p03998
python
s710184394
s267653041
28
25
8,940
8,980
Accepted
Accepted
10.71
sa = eval(input()) sb = eval(input()) sc = eval(input()) a = [sa[i] for i in range(len(sa))] b = [sb[i] for i in range(len(sb))] c = [sc[i] for i in range(len(sc))] n = 'a' while True: if n == 'a': if len(a) == 0: print('A') exit() else: n = a.pop(0) elif n == 'b': if ...
sa=eval(input())+'a' sb=eval(input())+'b' sc=eval(input())+'c' st='a' a=0 b=0 c=0 while a<len(sa) and b<len(sb) and c<len(sc): if st=='a': st=sa[a] a+=1 elif st=='b': st=sb[b] b+=1 else: st=sc[c] c+=1 if a==len(sa): print('A') elif b==len(sb): print('B') else: p...
27
23
479
311
sa = eval(input()) sb = eval(input()) sc = eval(input()) a = [sa[i] for i in range(len(sa))] b = [sb[i] for i in range(len(sb))] c = [sc[i] for i in range(len(sc))] n = "a" while True: if n == "a": if len(a) == 0: print("A") exit() else: n = a.pop(0) elif n ==...
sa = eval(input()) + "a" sb = eval(input()) + "b" sc = eval(input()) + "c" st = "a" a = 0 b = 0 c = 0 while a < len(sa) and b < len(sb) and c < len(sc): if st == "a": st = sa[a] a += 1 elif st == "b": st = sb[b] b += 1 else: st = sc[c] c += 1 if a == len(sa): ...
false
14.814815
[ "-sa = eval(input())", "-sb = eval(input())", "-sc = eval(input())", "-a = [sa[i] for i in range(len(sa))]", "-b = [sb[i] for i in range(len(sb))]", "-c = [sc[i] for i in range(len(sc))]", "-n = \"a\"", "-while True:", "- if n == \"a\":", "- if len(a) == 0:", "- print(\"A\")...
false
0.048367
0.04839
0.999535
[ "s710184394", "s267653041" ]
u832409298
p02925
python
s581955389
s025416110
1,405
1,291
177,380
176,872
Accepted
Accepted
8.11
import sys sys.setrecursionlimit(10**7) def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def II(): return int(sys.stdi...
import sys sys.setrecursionlimit(10**7) def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def II(): return int(sys.stdi...
77
76
2,244
2,243
import sys sys.setrecursionlimit(10**7) def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def II()...
import sys sys.setrecursionlimit(10**7) def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def II()...
false
1.298701
[ "-def conv(n, a, b):", "- return a * (2 * n - a - 1) // 2 + b - a - 1", "+def conv(a, b, b_max):", "+ return a * (b_max + 1) + b", "- prev_v = conv(N, prev_v[0] - 1, prev_v[1] - 1)", "- next_v = conv(N, next_v[0] - 1, next_v[1] - 1)", "+ prev_v = conv(prev_v[0] - 1...
false
0.045111
0.048737
0.925597
[ "s581955389", "s025416110" ]
u002459665
p03048
python
s280266592
s555633272
1,812
1,104
2,940
3,060
Accepted
Accepted
39.07
r, g, b, n = list(map(int, input().split())) cnt = 0 for i in range(int(n//r)+1): r_num = r * i for j in range(int((n - r_num)//g)+1): g_num = g * j b_num = (n - r_num - g_num) if b_num >= 0 and b_num % b == 0: cnt += 1 print(cnt)
def main(): r, g, b, n = list(map(int, input().split())) cnt = 0 for i in range(int(n//r)+1): r_num = r * i for j in range(int((n - r_num)//g)+1): g_num = g * j b_num = (n - r_num - g_num) if b_num >= 0 and b_num % b == 0: cnt ...
12
18
282
380
r, g, b, n = list(map(int, input().split())) cnt = 0 for i in range(int(n // r) + 1): r_num = r * i for j in range(int((n - r_num) // g) + 1): g_num = g * j b_num = n - r_num - g_num if b_num >= 0 and b_num % b == 0: cnt += 1 print(cnt)
def main(): r, g, b, n = list(map(int, input().split())) cnt = 0 for i in range(int(n // r) + 1): r_num = r * i for j in range(int((n - r_num) // g) + 1): g_num = g * j b_num = n - r_num - g_num if b_num >= 0 and b_num % b == 0: cnt += 1 ...
false
33.333333
[ "-r, g, b, n = list(map(int, input().split()))", "-cnt = 0", "-for i in range(int(n // r) + 1):", "- r_num = r * i", "- for j in range(int((n - r_num) // g) + 1):", "- g_num = g * j", "- b_num = n - r_num - g_num", "- if b_num >= 0 and b_num % b == 0:", "- cnt +...
false
0.102186
0.049448
2.066559
[ "s280266592", "s555633272" ]
u387774811
p03166
python
s780246114
s218694589
1,609
951
186,956
182,732
Accepted
Accepted
40.89
import sys sys.setrecursionlimit(10**6) input = sys.stdin.readline N,M = list(map(int,input().split())) lst=[{} for f in range(N)] for i in range(M): x,y=list(map(int,input().split())) lst[x-1][y-1]=1 memo = {} def cost(a): ans=0 for i in lst[a]: if i in memo: ans=max(memo[i]+1,ans) else: ...
import sys sys.setrecursionlimit(10**6) input = sys.stdin.readline N,M = list(map(int,input().split())) lst=[{} for f in range(N)] for i in range(M): x,y=list(map(int,input().split())) lst[x-1][y-1]=1 memo = {} def cost(a): ans=0 if a in memo: return memo[a] else: for i in lst[a]: if i in me...
22
25
413
460
import sys sys.setrecursionlimit(10**6) input = sys.stdin.readline N, M = list(map(int, input().split())) lst = [{} for f in range(N)] for i in range(M): x, y = list(map(int, input().split())) lst[x - 1][y - 1] = 1 memo = {} def cost(a): ans = 0 for i in lst[a]: if i in memo: ans ...
import sys sys.setrecursionlimit(10**6) input = sys.stdin.readline N, M = list(map(int, input().split())) lst = [{} for f in range(N)] for i in range(M): x, y = list(map(int, input().split())) lst[x - 1][y - 1] = 1 memo = {} def cost(a): ans = 0 if a in memo: return memo[a] else: ...
false
12
[ "- for i in lst[a]:", "- if i in memo:", "- ans = max(memo[i] + 1, ans)", "- else:", "- ans = max(cost(i) + 1, ans)", "- memo[a] = ans", "- return ans", "+ if a in memo:", "+ return memo[a]", "+ else:", "+ for i in lst[a]:", "+ ...
false
0.041086
0.042287
0.971599
[ "s780246114", "s218694589" ]
u504469481
p03545
python
s262611188
s795095371
19
17
3,188
3,060
Accepted
Accepted
10.53
def dfs(i, sum, n, s, k): # n 個決め終わったら、今までの和 sum が k と等しいかを返す if i == n - 1: # print(sum) if eval(sum) == k: print((sum+"=7")) return eval(sum) == k # + を使う if dfs(i + 1, sum + "-" + s[i+1],n,s,k): return True # - を使う if dfs(i + 1, s...
s = eval(input()) n = len(s) def dfs(i, f): if i == n-1: if eval(f)==7: print((f+"=7")) exit() else: return False else: dfs(i+1,f + "+" + s[i+1]) dfs(i+1,f + "-" + s[i+1]) def main(): if dfs(0,s[0]): exit()...
28
21
570
354
def dfs(i, sum, n, s, k): # n 個決め終わったら、今までの和 sum が k と等しいかを返す if i == n - 1: # print(sum) if eval(sum) == k: print((sum + "=7")) return eval(sum) == k # + を使う if dfs(i + 1, sum + "-" + s[i + 1], n, s, k): return True # - を使う if dfs(i + 1, sum +...
s = eval(input()) n = len(s) def dfs(i, f): if i == n - 1: if eval(f) == 7: print((f + "=7")) exit() else: return False else: dfs(i + 1, f + "+" + s[i + 1]) dfs(i + 1, f + "-" + s[i + 1]) def main(): if dfs(0, s[0]): exit() if...
false
25
[ "-def dfs(i, sum, n, s, k):", "- # n 個決め終わったら、今までの和 sum が k と等しいかを返す", "+s = eval(input())", "+n = len(s)", "+", "+", "+def dfs(i, f):", "- # print(sum)", "- if eval(sum) == k:", "- print((sum + \"=7\"))", "- return eval(sum) == k", "- # + を使う", ...
false
0.042102
0.042087
1.000366
[ "s262611188", "s795095371" ]
u887207211
p03329
python
s508615035
s021971778
23
19
3,572
3,064
Accepted
Accepted
17.39
N = int(eval(input())) sixs = [6**i for i in range(1,7)] nines = [9**i for i in range(1,6)] tmp = {} def dfs(n): if(n < 6): return n if(n in tmp): return tmp[n] m = 10**9+7 if(n >= 9): max_nine = max(nine for nine in nines if nine <= n) if(n%max_nine == 0): m = min(m, ...
N = int(eval(input())) nine = [9**i for i in range(7, 0, -1)] six = [6**i for i in range(8, 0, -1)] tmp = {} def f(n): if(n < 6): return n if(n in tmp): return tmp[n] m = 1e9+7 if(n >= 9): mn = max(x for x in nine if x <= n) if(n%mn == 0): m = min(m, n//mn) else: ...
29
25
562
481
N = int(eval(input())) sixs = [6**i for i in range(1, 7)] nines = [9**i for i in range(1, 6)] tmp = {} def dfs(n): if n < 6: return n if n in tmp: return tmp[n] m = 10**9 + 7 if n >= 9: max_nine = max(nine for nine in nines if nine <= n) if n % max_nine == 0: ...
N = int(eval(input())) nine = [9**i for i in range(7, 0, -1)] six = [6**i for i in range(8, 0, -1)] tmp = {} def f(n): if n < 6: return n if n in tmp: return tmp[n] m = 1e9 + 7 if n >= 9: mn = max(x for x in nine if x <= n) if n % mn == 0: m = min(m, n // mn...
false
13.793103
[ "-sixs = [6**i for i in range(1, 7)]", "-nines = [9**i for i in range(1, 6)]", "+nine = [9**i for i in range(7, 0, -1)]", "+six = [6**i for i in range(8, 0, -1)]", "-def dfs(n):", "+def f(n):", "- m = 10**9 + 7", "+ m = 1e9 + 7", "- max_nine = max(nine for nine in nines if nine <= n)", ...
false
0.037191
0.045774
0.812501
[ "s508615035", "s021971778" ]
u707124227
p03912
python
s178716441
s048136952
164
149
32,308
37,436
Accepted
Accepted
9.15
def main(): n,m=list(map(int,input().split())) x=list(map(int,input().split())) xmod=[y%m for y in x] from collections import Counter cx=Counter(x) cxmod=Counter(xmod) keys=list(cxmod.keys()) ans1,ans2=0,0 # ams1:m倍になるペア、ans2:同数のペア。ans1からもとめる for k in keys: if k==0: ans1+=cxmod[k]...
def main(): n,m=list(map(int,input().split())) x=list(map(int,input().split())) xmod=[y%m for y in x] from collections import Counter cx=dict(Counter(x)) cxmod=dict(Counter(xmod)) keys=list(cxmod.keys()) ans1,ans2=0,0 # ams1:m倍になるペア、ans2:同数のペア。ans1からもとめる for k in keys: if k==0: an...
33
33
764
776
def main(): n, m = list(map(int, input().split())) x = list(map(int, input().split())) xmod = [y % m for y in x] from collections import Counter cx = Counter(x) cxmod = Counter(xmod) keys = list(cxmod.keys()) ans1, ans2 = 0, 0 # ams1:m倍になるペア、ans2:同数のペア。ans1からもとめる for k in keys: ...
def main(): n, m = list(map(int, input().split())) x = list(map(int, input().split())) xmod = [y % m for y in x] from collections import Counter cx = dict(Counter(x)) cxmod = dict(Counter(xmod)) keys = list(cxmod.keys()) ans1, ans2 = 0, 0 # ams1:m倍になるペア、ans2:同数のペア。ans1からもとめる for k ...
false
0
[ "- cx = Counter(x)", "- cxmod = Counter(xmod)", "+ cx = dict(Counter(x))", "+ cxmod = dict(Counter(xmod))" ]
false
0.102941
0.078516
1.311074
[ "s178716441", "s048136952" ]
u809541036
p02783
python
s103669426
s829919548
19
17
2,940
2,940
Accepted
Accepted
10.53
H, A = list(map(int, input().split())) x = 0 while True: if H <= 0: break if H > 0: H -= A x += 1 print(x)
H, A = list(map(int, input().split())) print(((H+A-1)//A))
10
3
126
53
H, A = list(map(int, input().split())) x = 0 while True: if H <= 0: break if H > 0: H -= A x += 1 print(x)
H, A = list(map(int, input().split())) print(((H + A - 1) // A))
false
70
[ "-x = 0", "-while True:", "- if H <= 0:", "- break", "- if H > 0:", "- H -= A", "- x += 1", "-print(x)", "+print(((H + A - 1) // A))" ]
false
0.083595
0.075407
1.108575
[ "s103669426", "s829919548" ]
u347640436
p03732
python
s007714607
s621261946
107
98
9,300
9,272
Accepted
Accepted
8.41
from sys import stdin from itertools import accumulate readline = stdin.readline N, W = list(map(int, input().split())) vs = [[] for _ in range(4)] w, v = list(map(int, input().split())) w1 = w vs[0].append(v) for _ in range(N - 1): w, v = list(map(int, input().split())) vs[w - w1].append(v) for ...
from sys import stdin from itertools import accumulate readline = stdin.readline N, W = list(map(int, input().split())) vs = [[] for _ in range(4)] w, v = list(map(int, input().split())) w1 = w vs[0].append(v) for _ in range(N - 1): w, v = list(map(int, input().split())) vs[w - w1].append(v) for ...
46
37
1,204
949
from sys import stdin from itertools import accumulate readline = stdin.readline N, W = list(map(int, input().split())) vs = [[] for _ in range(4)] w, v = list(map(int, input().split())) w1 = w vs[0].append(v) for _ in range(N - 1): w, v = list(map(int, input().split())) vs[w - w1].append(v) for i in range(4):...
from sys import stdin from itertools import accumulate readline = stdin.readline N, W = list(map(int, input().split())) vs = [[] for _ in range(4)] w, v = list(map(int, input().split())) w1 = w vs[0].append(v) for _ in range(N - 1): w, v = list(map(int, input().split())) vs[w - w1].append(v) for i in range(4):...
false
19.565217
[ "- vs[i] = list(accumulate(vs[i]))", "+ vs[i] = [0] + list(accumulate(vs[i]))", "-for i in range(len(vs[0]) + 1):", "+for i in range(len(vs[0])):", "- for j in range(len(vs[1]) + 1):", "+ for j in range(len(vs[1])):", "- for k in range(len(vs[2]) + 1):", "+ for k in range(len...
false
0.040588
0.038903
1.043312
[ "s007714607", "s621261946" ]
u585482323
p02824
python
s016035616
s213213903
255
231
58,864
58,736
Accepted
Accepted
9.41
#!usr/bin/env python3 from collections import defaultdict, deque from heapq import heappush, heappop from itertools import permutations, accumulate import sys import math import bisect def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS():return [lis...
#!usr/bin/env python3 from collections import defaultdict, deque from heapq import heappush, heappop from itertools import permutations, accumulate import sys import math import bisect def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS():return [lis...
56
60
1,282
1,384
#!usr/bin/env python3 from collections import defaultdict, deque from heapq import heappush, heappop from itertools import permutations, accumulate import sys import math import bisect def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS(): r...
#!usr/bin/env python3 from collections import defaultdict, deque from heapq import heappush, heappop from itertools import permutations, accumulate import sys import math import bisect def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS(): r...
false
6.666667
[ "- s = m * p", "- for j in range(n - p + 1):", "- if i == j:", "- continue", "- s += min(m, A - a[j])", "- if s >= m * v:", "+ li = bisect.bisect_right(a, a[i])", "+ res = v - j - li", "+ if res <= 0:", "+ r ...
false
0.049644
0.042219
1.175867
[ "s016035616", "s213213903" ]
u745097373
p03165
python
s551300360
s767865241
675
571
121,308
124,760
Accepted
Accepted
15.41
def solve(): s, t = read() result = think(s, t) write(result) def read(): return read_line(), read_line() def read_int(n): return list([int(x) for x in read_line().split(' ')])[:n] def read_line(n=0): if n == 0: return input().rstrip() else: return inp...
import unittest class TestF(unittest.TestCase): def test_1(self): self.assertEqual( len(think('axyb', 'abyxb')), 3 ) def test_2(self): self.assertEqual( len(think('aa', 'xayaz')), 2 ) def test_3(self): ...
64
115
1,404
2,339
def solve(): s, t = read() result = think(s, t) write(result) def read(): return read_line(), read_line() def read_int(n): return list([int(x) for x in read_line().split(" ")])[:n] def read_line(n=0): if n == 0: return input().rstrip() else: return input().rstrip()[:n] ...
import unittest class TestF(unittest.TestCase): def test_1(self): self.assertEqual(len(think("axyb", "abyxb")), 3) def test_2(self): self.assertEqual(len(think("aa", "xayaz")), 2) def test_3(self): self.assertEqual(len(think("a", "z")), 0) def test_4(self): self.asse...
false
44.347826
[ "+import unittest", "+", "+", "+class TestF(unittest.TestCase):", "+ def test_1(self):", "+ self.assertEqual(len(think(\"axyb\", \"abyxb\")), 3)", "+", "+ def test_2(self):", "+ self.assertEqual(len(think(\"aa\", \"xayaz\")), 2)", "+", "+ def test_3(self):", "+ se...
false
0.060689
0.184535
0.328873
[ "s551300360", "s767865241" ]
u254456372
p03632
python
s614369550
s482236856
33
18
4,080
2,940
Accepted
Accepted
45.45
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys import re import math import collections import itertools import functools DEBUG = True DEBUG = False def dbg(*args): if DEBUG: print("DBG: ", file=sys.stderr, end="") print(*args, file=sys.stderr) def main(): A...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def main(): A, B, C, D = list(map(int, input().split())) if A <= D and B >= C: print((min(B,D) - max(A,C))) else: print((0)) if __name__ == "__main__": main()
34
14
603
242
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys import re import math import collections import itertools import functools DEBUG = True DEBUG = False def dbg(*args): if DEBUG: print("DBG: ", file=sys.stderr, end="") print(*args, file=sys.stderr) def main(): A, B, C, D = map(int, i...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def main(): A, B, C, D = list(map(int, input().split())) if A <= D and B >= C: print((min(B, D) - max(A, C))) else: print((0)) if __name__ == "__main__": main()
false
58.823529
[ "-import sys", "-import re", "-import math", "-import collections", "-import itertools", "-import functools", "-", "-DEBUG = True", "-DEBUG = False", "-", "-", "-def dbg(*args):", "- if DEBUG:", "- print(\"DBG: \", file=sys.stderr, end=\"\")", "- print(*args, file=sys.st...
false
0.048097
0.047078
1.021649
[ "s614369550", "s482236856" ]
u831244171
p02407
python
s687405202
s699153400
30
20
7,352
7,336
Accepted
Accepted
33.33
n = eval(input()) a = input().split() print((" ".join(a[::-1])))
eval(input()) a = input().split() print((" ".join(a[::-1])))
3
3
58
54
n = eval(input()) a = input().split() print((" ".join(a[::-1])))
eval(input()) a = input().split() print((" ".join(a[::-1])))
false
0
[ "-n = eval(input())", "+eval(input())" ]
false
0.036701
0.08494
0.432087
[ "s687405202", "s699153400" ]
u347600233
p02631
python
s740192519
s965335850
160
145
31,752
31,408
Accepted
Accepted
9.38
n = int(eval(input())) a = [int(i) for i in input().split()] s = 0 for ai in a: s ^= ai b = [a[i] ^ s for i in range(n)] print((*b))
n = int(eval(input())) a = list(map(int, input().split())) s = 0 for ai in a: s ^= ai print((*[s ^ ai for ai in a]))
7
6
134
117
n = int(eval(input())) a = [int(i) for i in input().split()] s = 0 for ai in a: s ^= ai b = [a[i] ^ s for i in range(n)] print((*b))
n = int(eval(input())) a = list(map(int, input().split())) s = 0 for ai in a: s ^= ai print((*[s ^ ai for ai in a]))
false
14.285714
[ "-a = [int(i) for i in input().split()]", "+a = list(map(int, input().split()))", "-b = [a[i] ^ s for i in range(n)]", "-print((*b))", "+print((*[s ^ ai for ai in a]))" ]
false
0.038388
0.037729
1.017484
[ "s740192519", "s965335850" ]
u562935282
p03167
python
s301467557
s960730978
291
228
54,000
51,184
Accepted
Accepted
21.65
mod = 10 ** 9 + 7 h, w = list(map(int, input().split())) a = tuple(eval(input()) for _ in range(h)) dp = [[0] * w for _ in range(h)] dp[0][0] = 1 # 配る for r in range(h): for c in range(w): if a[r][c] == '#': continue if r + 1 < h and a[r + 1][c] == '.': dp[r ...
def main(): import sys readline = sys.stdin.readline mod = 10 ** 9 + 7 h, w = list(map(int, readline().split())) a = [readline().rstrip() for _ in range(h)] dp = [[0] * w for _ in range(h)] dp[0][0] = 1 for r in range(h): for c in range(w): if a[r][c...
18
26
481
567
mod = 10**9 + 7 h, w = list(map(int, input().split())) a = tuple(eval(input()) for _ in range(h)) dp = [[0] * w for _ in range(h)] dp[0][0] = 1 # 配る for r in range(h): for c in range(w): if a[r][c] == "#": continue if r + 1 < h and a[r + 1][c] == ".": dp[r + 1][c] = (dp[r + 1...
def main(): import sys readline = sys.stdin.readline mod = 10**9 + 7 h, w = list(map(int, readline().split())) a = [readline().rstrip() for _ in range(h)] dp = [[0] * w for _ in range(h)] dp[0][0] = 1 for r in range(h): for c in range(w): if a[r][c] == "#": ...
false
30.769231
[ "-mod = 10**9 + 7", "-h, w = list(map(int, input().split()))", "-a = tuple(eval(input()) for _ in range(h))", "-dp = [[0] * w for _ in range(h)]", "-dp[0][0] = 1", "-# 配る", "-for r in range(h):", "- for c in range(w):", "- if a[r][c] == \"#\":", "- continue", "- if r ...
false
0.05617
0.062602
0.897255
[ "s301467557", "s960730978" ]
u906501980
p02762
python
s881912854
s088747207
829
612
33,280
16,392
Accepted
Accepted
26.18
import sys input = sys.stdin.buffer.readline class UnionFind: def __init__(self, n=0): self.data = [-1]*(n+1) def root(self, x): if self.data[x] < 0: return x self.data[x] = self.root(self.data[x]) return self.data[x] def unite(self, x, y):...
import sys input = sys.stdin.buffer.readline class UnionFind: __slots__ = ["data"] def __init__(self, n=0): self.data = [-1]*(n+1) def root(self, x): if self.data[x] < 0: return x self.data[x] = self.root(self.data[x]) return self.data[x] ...
59
57
1,493
1,418
import sys input = sys.stdin.buffer.readline class UnionFind: def __init__(self, n=0): self.data = [-1] * (n + 1) def root(self, x): if self.data[x] < 0: return x self.data[x] = self.root(self.data[x]) return self.data[x] def unite(self, x, y): x = se...
import sys input = sys.stdin.buffer.readline class UnionFind: __slots__ = ["data"] def __init__(self, n=0): self.data = [-1] * (n + 1) def root(self, x): if self.data[x] < 0: return x self.data[x] = self.root(self.data[x]) return self.data[x] def unite(s...
false
3.389831
[ "+ __slots__ = [\"data\"]", "+", "- blocks = [[] for _ in range(n + 1)]", "+ blocks = [0] * (n + 1)", "- blocks[c].append(d)", "- blocks[d].append(c)", "+ if uf.same(c, d):", "+ blocks[c] += 1", "+ blocks[d] += 1", "- nf = friends[i]", "...
false
0.046476
0.036871
1.260496
[ "s881912854", "s088747207" ]
u718706479
p02886
python
s406173274
s700472542
20
17
3,316
2,940
Accepted
Accepted
15
n,*d=list(map(int,open(0).read().split())) s=sum(d)**2 for v in d: s-=v**2 print(("%d"%(s/2)))
n,*d=list(map(int,open(0).read().split())) s=sum(d)**2 for v in d:s-=v**2 print((s//2))
4
4
89
82
n, *d = list(map(int, open(0).read().split())) s = sum(d) ** 2 for v in d: s -= v**2 print(("%d" % (s / 2)))
n, *d = list(map(int, open(0).read().split())) s = sum(d) ** 2 for v in d: s -= v**2 print((s // 2))
false
0
[ "-print((\"%d\" % (s / 2)))", "+print((s // 2))" ]
false
0.049821
0.132441
0.376175
[ "s406173274", "s700472542" ]
u750990077
p02694
python
s982985257
s954320081
172
74
62,776
62,784
Accepted
Accepted
56.98
def main(): x = int(eval(input())) m = 100 for i in range(10**5): if m >= x: print(i) return m += m//100 if __name__ == "__main__": main()
def main(): x = int(eval(input())) money = 100 for i in range(10**5): if money >= x: print(i) return money += money//100 if __name__ == "__main__": main()
11
12
199
218
def main(): x = int(eval(input())) m = 100 for i in range(10**5): if m >= x: print(i) return m += m // 100 if __name__ == "__main__": main()
def main(): x = int(eval(input())) money = 100 for i in range(10**5): if money >= x: print(i) return money += money // 100 if __name__ == "__main__": main()
false
8.333333
[ "- m = 100", "+ money = 100", "- if m >= x:", "+ if money >= x:", "- m += m // 100", "+ money += money // 100" ]
false
0.03775
0.09074
0.416024
[ "s982985257", "s954320081" ]
u192154323
p03266
python
s810713574
s712588507
105
72
4,596
9,044
Accepted
Accepted
31.43
n,k = list(map(int,input().split())) mod_ls = [0] * k for i in range(1,n+1): rest = i % k mod_ls[rest] += 1 ans = 0 for i in range(1,k): first = i second = k - i third = k - second if (first + third) % k == 0: ans += mod_ls[first] * mod_ls[second] * mod_ls[third] ans += m...
n,k = list(map(int,input().split())) n_O = 0 n_E = 0 for i in range(1,n+1): if (2*i) % k == 0: if (2*i//k)%2 == 0: n_E += 1 else: n_O += 1 print((n_E**3+n_O**3))
16
10
340
207
n, k = list(map(int, input().split())) mod_ls = [0] * k for i in range(1, n + 1): rest = i % k mod_ls[rest] += 1 ans = 0 for i in range(1, k): first = i second = k - i third = k - second if (first + third) % k == 0: ans += mod_ls[first] * mod_ls[second] * mod_ls[third] ans += mod_ls[0] *...
n, k = list(map(int, input().split())) n_O = 0 n_E = 0 for i in range(1, n + 1): if (2 * i) % k == 0: if (2 * i // k) % 2 == 0: n_E += 1 else: n_O += 1 print((n_E**3 + n_O**3))
false
37.5
[ "-mod_ls = [0] * k", "+n_O = 0", "+n_E = 0", "- rest = i % k", "- mod_ls[rest] += 1", "-ans = 0", "-for i in range(1, k):", "- first = i", "- second = k - i", "- third = k - second", "- if (first + third) % k == 0:", "- ans += mod_ls[first] * mod_ls[second] * mod_ls[th...
false
0.038854
0.03936
0.987123
[ "s810713574", "s712588507" ]
u761989513
p02959
python
s913254721
s183579067
147
124
18,624
18,624
Accepted
Accepted
15.65
n = int(eval(input())) a = list(map(int, input().split())) b = list(map(int, input().split())) ans = 0 for i in range(n): if a[i] <= b[i]: ans += a[i] b[i] -= a[i] if a[i + 1] <= b[i]: ans += a[i + 1] a[i + 1] = 0 else: ans += b[i] ...
n = int(eval(input())) a = list(map(int, input().split())) b = list(map(int, input().split())) ans = 0 now = a[0] for i in range(n): ato_taoseru = b[i] if ato_taoseru <= now: ans += ato_taoseru now = a[i + 1] else: ans += now ato_taoseru -= now now = a[...
17
23
383
490
n = int(eval(input())) a = list(map(int, input().split())) b = list(map(int, input().split())) ans = 0 for i in range(n): if a[i] <= b[i]: ans += a[i] b[i] -= a[i] if a[i + 1] <= b[i]: ans += a[i + 1] a[i + 1] = 0 else: ans += b[i] a[i ...
n = int(eval(input())) a = list(map(int, input().split())) b = list(map(int, input().split())) ans = 0 now = a[0] for i in range(n): ato_taoseru = b[i] if ato_taoseru <= now: ans += ato_taoseru now = a[i + 1] else: ans += now ato_taoseru -= now now = a[i + 1] ...
false
26.086957
[ "+now = a[0]", "- if a[i] <= b[i]:", "- ans += a[i]", "- b[i] -= a[i]", "- if a[i + 1] <= b[i]:", "- ans += a[i + 1]", "- a[i + 1] = 0", "+ ato_taoseru = b[i]", "+ if ato_taoseru <= now:", "+ ans += ato_taoseru", "+ now = a[i + 1]...
false
0.045697
0.039032
1.170734
[ "s913254721", "s183579067" ]
u607865971
p03152
python
s655834054
s392406882
1,296
578
48,084
3,188
Accepted
Accepted
55.4
N, M = [int(x) for x in input().split()] A = [int(x) for x in input().split()] B = [int(x) for x in input().split()] ret = 1 MOD = 10 ** 9 + 7 from collections import Counter import sys ca = Counter(A) cb = Counter(B) if ca.most_common(1)[0][1] >= 2 or cb.most_common(1)[0][1] >= 2: print((0)) ...
N, M = [int(x) for x in input().split()] A = [int(x) for x in input().split()] B = [int(x) for x in input().split()] ret = 1 MOD = 10 ** 9 + 7 A.sort(reverse=True) B.sort(reverse=True) aidx = bidx = 0 for n in range(N * M, 0, -1): # 両方みつけた if aidx < N and bidx < M and n == A[aidx] and n == B...
55
35
1,024
687
N, M = [int(x) for x in input().split()] A = [int(x) for x in input().split()] B = [int(x) for x in input().split()] ret = 1 MOD = 10**9 + 7 from collections import Counter import sys ca = Counter(A) cb = Counter(B) if ca.most_common(1)[0][1] >= 2 or cb.most_common(1)[0][1] >= 2: print((0)) sys.exit(0) A.sort(...
N, M = [int(x) for x in input().split()] A = [int(x) for x in input().split()] B = [int(x) for x in input().split()] ret = 1 MOD = 10**9 + 7 A.sort(reverse=True) B.sort(reverse=True) aidx = bidx = 0 for n in range(N * M, 0, -1): # 両方みつけた if aidx < N and bidx < M and n == A[aidx] and n == B[bidx] and A[aidx] == ...
false
36.363636
[ "-from collections import Counter", "-import sys", "-", "-ca = Counter(A)", "-cb = Counter(B)", "-if ca.most_common(1)[0][1] >= 2 or cb.most_common(1)[0][1] >= 2:", "- print((0))", "- sys.exit(0)", "-A.sort()", "-B.sort()", "-import bisect", "-", "-", "-def index(a, x):", "- \"L...
false
0.037813
0.047579
0.794748
[ "s655834054", "s392406882" ]
u143492911
p03964
python
s564622602
s886982652
332
55
5,944
5,680
Accepted
Accepted
83.43
n=int(eval(input())) from fractions import Fraction import math t=[[int(i)for i in input().split()]for i in range(n)] dp=[0]*n dp[0]=1 for i in range(1,n): dp[i]=math.ceil((max(Fraction(t[i-1][0],t[i][0]),Fraction(t[i-1][1],t[i][1]))*dp[i-1])) print((dp[-1]*(t[n-1][0]+t[n-1][1])))
n=int(eval(input())) t=[[int(i)for i in input().split()]for i in range(n)] import math from fractions import Fraction dp=[0]*n dp[0]=1 for i in range(1,n): dp[i]=math.ceil(max(Fraction(t[i-1][0],t[i][0]),Fraction(t[i-1][1],t[i][1]))*dp[i-1]) print((dp[-1]*(t[n-1][0]+t[n-1][1])))
9
9
285
283
n = int(eval(input())) from fractions import Fraction import math t = [[int(i) for i in input().split()] for i in range(n)] dp = [0] * n dp[0] = 1 for i in range(1, n): dp[i] = math.ceil( ( max(Fraction(t[i - 1][0], t[i][0]), Fraction(t[i - 1][1], t[i][1])) * dp[i - 1] ) ...
n = int(eval(input())) t = [[int(i) for i in input().split()] for i in range(n)] import math from fractions import Fraction dp = [0] * n dp[0] = 1 for i in range(1, n): dp[i] = math.ceil( max(Fraction(t[i - 1][0], t[i][0]), Fraction(t[i - 1][1], t[i][1])) * dp[i - 1] ) print((dp[-1] * (t[n - 1][0] + t[...
false
0
[ "+t = [[int(i) for i in input().split()] for i in range(n)]", "+import math", "-import math", "-t = [[int(i) for i in input().split()] for i in range(n)]", "- (", "- max(Fraction(t[i - 1][0], t[i][0]), Fraction(t[i - 1][1], t[i][1]))", "- * dp[i - 1]", "- )", "+ ...
false
0.109871
0.044223
2.484485
[ "s564622602", "s886982652" ]
u840247626
p02258
python
s432271596
s105492416
710
290
5,620
5,624
Accepted
Accepted
59.15
f = lambda: int(eval(input())) d = -float('inf') n = f() l = f() for _ in range(n-1): r = f() d = max(d, r-l) l = min(l, r) print(d)
import sys d = -float('inf') n = int(eval(input())) l = int(eval(input())) for s in sys.stdin: r = int(s) d = max(d, r-l) l = min(l, r) print(d)
9
9
138
144
f = lambda: int(eval(input())) d = -float("inf") n = f() l = f() for _ in range(n - 1): r = f() d = max(d, r - l) l = min(l, r) print(d)
import sys d = -float("inf") n = int(eval(input())) l = int(eval(input())) for s in sys.stdin: r = int(s) d = max(d, r - l) l = min(l, r) print(d)
false
0
[ "-f = lambda: int(eval(input()))", "+import sys", "+", "-n = f()", "-l = f()", "-for _ in range(n - 1):", "- r = f()", "+n = int(eval(input()))", "+l = int(eval(input()))", "+for s in sys.stdin:", "+ r = int(s)" ]
false
0.036055
0.034883
1.033589
[ "s432271596", "s105492416" ]
u714587753
p03324
python
s424410907
s113364455
225
194
2,568
40,556
Accepted
Accepted
13.78
s = input() ss = s.split() d = int(ss[0]) n = int(ss[1]) i = 1 while 1: x = i c = 0 while x % 100 == 0: x //= 100 c += 1 if c == d: n -= 1 if n == 0: print(i) break i += 1
s = input().strip() ss = s.split() d = int(ss[0]) n = int(ss[1]) i = 1 while 1: x = i c = 0 while x % 100 == 0: x //= 100 c += 1 if c == d: n -= 1 if n == 0: print(i) break i += 1
17
17
210
215
s = input() ss = s.split() d = int(ss[0]) n = int(ss[1]) i = 1 while 1: x = i c = 0 while x % 100 == 0: x //= 100 c += 1 if c == d: n -= 1 if n == 0: print(i) break i += 1
s = input().strip() ss = s.split() d = int(ss[0]) n = int(ss[1]) i = 1 while 1: x = i c = 0 while x % 100 == 0: x //= 100 c += 1 if c == d: n -= 1 if n == 0: print(i) break i += 1
false
0
[ "-s = input()", "+s = input().strip()" ]
false
0.443506
0.115609
3.836262
[ "s424410907", "s113364455" ]
u017415492
p03240
python
s541298487
s234677404
150
68
9,220
9,240
Accepted
Accepted
54.67
n=int(eval(input())) xyh = [list(map(int,input().split())) for i in range(n)] xyh.sort(key=lambda x:x[2], reverse=True) ansh=-1 ans=[[]] flag=True for cx in range(0,101): if flag==False: break for cy in range(0,101): ansh = 0 for pira in xyh: if ansh==0: ansh=pira[2]+(...
n=int(eval(input())) xyh=[] for i in range(n): x,y,h=list(map(int,input().split())) xyh.append([h,x,y]) xyh.sort(reverse=True) ans=0 for cx in range(101): for cy in range(101): for N in range(n): if abs(xyh[0][1]-cx)+abs(xyh[0][2]-cy)+xyh[0][0]>0: H=abs(xyh[0][1]-cx)+abs(xyh[0][2]-c...
24
20
565
486
n = int(eval(input())) xyh = [list(map(int, input().split())) for i in range(n)] xyh.sort(key=lambda x: x[2], reverse=True) ansh = -1 ans = [[]] flag = True for cx in range(0, 101): if flag == False: break for cy in range(0, 101): ansh = 0 for pira in xyh: if ansh == 0: ...
n = int(eval(input())) xyh = [] for i in range(n): x, y, h = list(map(int, input().split())) xyh.append([h, x, y]) xyh.sort(reverse=True) ans = 0 for cx in range(101): for cy in range(101): for N in range(n): if abs(xyh[0][1] - cx) + abs(xyh[0][2] - cy) + xyh[0][0] > 0: H...
false
16.666667
[ "-xyh = [list(map(int, input().split())) for i in range(n)]", "-xyh.sort(key=lambda x: x[2], reverse=True)", "-ansh = -1", "-ans = [[]]", "-flag = True", "-for cx in range(0, 101):", "- if flag == False:", "- break", "- for cy in range(0, 101):", "- ansh = 0", "- for p...
false
0.149281
0.137068
1.0891
[ "s541298487", "s234677404" ]
u048176319
p03799
python
s432081584
s482098825
71
17
2,940
2,940
Accepted
Accepted
76.06
n,m = list(map(int, input().split())) if n > (m+n)/3: print((m//2)) exit() if m > 10000000000: print((m//4)) exit() while n <= (n+m)/3: n += 1 m -= 2 print((n-1))
n,m = list(map(int, input().split())) if n > (m+n)/3: print((m//2)) exit() ans = n m -= 2*n ans += m//4 print(ans)
14
10
190
125
n, m = list(map(int, input().split())) if n > (m + n) / 3: print((m // 2)) exit() if m > 10000000000: print((m // 4)) exit() while n <= (n + m) / 3: n += 1 m -= 2 print((n - 1))
n, m = list(map(int, input().split())) if n > (m + n) / 3: print((m // 2)) exit() ans = n m -= 2 * n ans += m // 4 print(ans)
false
28.571429
[ "-if m > 10000000000:", "- print((m // 4))", "- exit()", "-while n <= (n + m) / 3:", "- n += 1", "- m -= 2", "-print((n - 1))", "+ans = n", "+m -= 2 * n", "+ans += m // 4", "+print(ans)" ]
false
0.062724
0.043176
1.452733
[ "s432081584", "s482098825" ]
u476604182
p02948
python
s165675934
s644402374
573
520
31,976
20,428
Accepted
Accepted
9.25
from heapq import heappop, heappush N, M = list(map(int, input().split())) X = sorted([list(map(int, input().split())) for _ in range(N)], key = lambda x: x[0]) hq = [] ans, j = 0, 0 for i in range(1, M + 1): # M - i 日後にするバイトを考える while (j < N) and (X[j][0] <= i): heappush(hq, -X[j][1]) # 候補の追加 ...
from heapq import heappush, heappop N, M = list(map(int, input().split())) job = [] for i in range(N): a, b = list(map(int, input().split())) job += [(a,b)] job.sort(key=lambda x:x[0]) ls = [] ans = 0 j = 0 a = -1 for i in range(1,M+1): while a<=i and j<len(job): a, b = job[j] if a>i: ...
15
25
414
432
from heapq import heappop, heappush N, M = list(map(int, input().split())) X = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x: x[0]) hq = [] ans, j = 0, 0 for i in range(1, M + 1): # M - i 日後にするバイトを考える while (j < N) and (X[j][0] <= i): heappush(hq, -X[j][1]) # 候補の追加 j +=...
from heapq import heappush, heappop N, M = list(map(int, input().split())) job = [] for i in range(N): a, b = list(map(int, input().split())) job += [(a, b)] job.sort(key=lambda x: x[0]) ls = [] ans = 0 j = 0 a = -1 for i in range(1, M + 1): while a <= i and j < len(job): a, b = job[j] if a...
false
40
[ "-from heapq import heappop, heappush", "+from heapq import heappush, heappop", "-X = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x: x[0])", "-hq = []", "-ans, j = 0, 0", "-for i in range(1, M + 1): # M - i 日後にするバイトを考える", "- while (j < N) and (X[j][0] <= i):", "- ...
false
0.091479
0.047103
1.942114
[ "s165675934", "s644402374" ]
u078349616
p03160
python
s312438521
s529518466
169
134
13,980
13,980
Accepted
Accepted
20.71
N = int(eval(input())) h = list(map(int,input().split())) dp = [float("INF")]*(N+1) dp[0] = 0 for i in range(1, N): dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1])) if i > 1: dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2])) print((dp[N-1]))
N = int(eval(input())) h = list(map(int,input().split())) dp = [float("INF")]*N dp[0] = 0 dp[1] = abs(h[1] - h[0]) for i in range(2, N): c1 = dp[i-1] + abs(h[i] - h[i-1]) c2 = dp[i-2] + abs(h[i] - h[i-2]) dp[i] = min(c1, c2) print((dp[N-1]))
11
13
252
260
N = int(eval(input())) h = list(map(int, input().split())) dp = [float("INF")] * (N + 1) dp[0] = 0 for i in range(1, N): dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1])) if i > 1: dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2])) print((dp[N - 1]))
N = int(eval(input())) h = list(map(int, input().split())) dp = [float("INF")] * N dp[0] = 0 dp[1] = abs(h[1] - h[0]) for i in range(2, N): c1 = dp[i - 1] + abs(h[i] - h[i - 1]) c2 = dp[i - 2] + abs(h[i] - h[i - 2]) dp[i] = min(c1, c2) print((dp[N - 1]))
false
15.384615
[ "-dp = [float(\"INF\")] * (N + 1)", "+dp = [float(\"INF\")] * N", "-for i in range(1, N):", "- dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))", "- if i > 1:", "- dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]))", "+dp[1] = abs(h[1] - h[0])", "+for i in range(2, N):", "+ c1 ...
false
0.037099
0.038971
0.951965
[ "s312438521", "s529518466" ]
u347600233
p02813
python
s930048633
s540030165
40
35
13,772
14,008
Accepted
Accepted
12.5
from itertools import permutations n = int(eval(input())) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) perm = list(permutations(list(range(1, n + 1)), n)) print((abs(perm.index(p) - perm.index(q))))
from itertools import permutations n = int(eval(input())) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) np = list(permutations(list(range(1, n + 1)), n)) print((abs(np.index(p) - np.index(q))))
6
6
218
212
from itertools import permutations n = int(eval(input())) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) perm = list(permutations(list(range(1, n + 1)), n)) print((abs(perm.index(p) - perm.index(q))))
from itertools import permutations n = int(eval(input())) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) np = list(permutations(list(range(1, n + 1)), n)) print((abs(np.index(p) - np.index(q))))
false
0
[ "-perm = list(permutations(list(range(1, n + 1)), n))", "-print((abs(perm.index(p) - perm.index(q))))", "+np = list(permutations(list(range(1, n + 1)), n))", "+print((abs(np.index(p) - np.index(q))))" ]
false
0.046439
0.048616
0.955218
[ "s930048633", "s540030165" ]
u645354978
p02270
python
s652622842
s423689366
590
540
9,432
9,356
Accepted
Accepted
8.47
import sys N, K = [int(s) for s in input().split()] ws = [int(input()) for _ in range(N)] lo, hi = max(ws), 100000 * 10000 while lo != hi: p = P = (lo + hi) / 2 k = 1 for w in ws: if w > p: p = P k += 1 p -= w if k <= K: hi = P else: ...
N, K = [int(s) for s in input().split()] ws = [int(input()) for _ in range(N)] lo, hi = max(ws) - 1, sum(ws) while hi - lo > 1: p = P = (lo + hi) / 2 k = 1 for w in ws: if w > p: p = P k += 1 p -= w if k <= K: hi = P else: lo = ...
20
18
360
342
import sys N, K = [int(s) for s in input().split()] ws = [int(input()) for _ in range(N)] lo, hi = max(ws), 100000 * 10000 while lo != hi: p = P = (lo + hi) / 2 k = 1 for w in ws: if w > p: p = P k += 1 p -= w if k <= K: hi = P else: lo = P + ...
N, K = [int(s) for s in input().split()] ws = [int(input()) for _ in range(N)] lo, hi = max(ws) - 1, sum(ws) while hi - lo > 1: p = P = (lo + hi) / 2 k = 1 for w in ws: if w > p: p = P k += 1 p -= w if k <= K: hi = P else: lo = P print(hi)
false
10
[ "-import sys", "-", "-lo, hi = max(ws), 100000 * 10000", "-while lo != hi:", "+lo, hi = max(ws) - 1, sum(ws)", "+while hi - lo > 1:", "- lo = P + 1", "-print(lo)", "+ lo = P", "+print(hi)" ]
false
0.036724
0.036798
0.997997
[ "s652622842", "s423689366" ]
u645250356
p03127
python
s172424931
s591775506
331
177
85,352
90,556
Accepted
Accepted
46.53
from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify import sys,bisect,math,itertools,fractions,pprint 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())) ...
from collections import Counter,defaultdict,deque from heapq import heappop,heappush from bisect import bisect_left,bisect_right import sys,math,itertools,fractions,pprint sys.setrecursionlimit(10**8) mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, ...
15
16
428
452
from collections import Counter, defaultdict, deque from heapq import heappop, heappush, heapify import sys, bisect, math, itertools, fractions, pprint 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.read...
from collections import Counter, defaultdict, deque from heapq import heappop, heappush from bisect import bisect_left, bisect_right import sys, math, itertools, fractions, pprint sys.setrecursionlimit(10**8) mod = 10**9 + 7 INF = float("inf") def inp(): return int(sys.stdin.readline()) def inpl(): return ...
false
6.25
[ "-from heapq import heappop, heappush, heapify", "-import sys, bisect, math, itertools, fractions, pprint", "+from heapq import heappop, heappush", "+from bisect import bisect_left, bisect_right", "+import sys, math, itertools, fractions, pprint", "-res = a[0]", "-for i in range(n - 1):", "- res = ...
false
0.046065
0.038838
1.186092
[ "s172424931", "s591775506" ]
u912237403
p00042
python
s628575886
s627737925
490
190
4,332
4,312
Accepted
Accepted
61.22
c =0 while True: W = eval(input()) if W==0: break dt = [0]*1001 c +=1 N = eval(input()) m = 0 n = 0 for i in range(N): p,w = eval(input()) for w0 in range(W+1)[::-1]: p0 = dt[w0] if w0==0 or p0!=0: w1 = w0+w ...
def f(): p,w = eval(input()) for w0 in R[w:]: w1,p1 = w0+w,dt[w0]+p if dt[w1]<p1: dt[w1]=p1 return c = 0 while 1: W = eval(input()) if W==0: break R = list(range(W+1))[::-1] dt = [0]*1001 c += 1 N = eval(input()) for i in range(N): f() m = max...
22
19
465
365
c = 0 while True: W = eval(input()) if W == 0: break dt = [0] * 1001 c += 1 N = eval(input()) m = 0 n = 0 for i in range(N): p, w = eval(input()) for w0 in range(W + 1)[::-1]: p0 = dt[w0] if w0 == 0 or p0 != 0: w1 = w0 + w ...
def f(): p, w = eval(input()) for w0 in R[w:]: w1, p1 = w0 + w, dt[w0] + p if dt[w1] < p1: dt[w1] = p1 return c = 0 while 1: W = eval(input()) if W == 0: break R = list(range(W + 1))[::-1] dt = [0] * 1001 c += 1 N = eval(input()) for i in ran...
false
13.636364
[ "+def f():", "+ p, w = eval(input())", "+ for w0 in R[w:]:", "+ w1, p1 = w0 + w, dt[w0] + p", "+ if dt[w1] < p1:", "+ dt[w1] = p1", "+ return", "+", "+", "-while True:", "+while 1:", "+ R = list(range(W + 1))[::-1]", "- m = 0", "- n = 0", "- ...
false
0.042208
0.079452
0.531236
[ "s628575886", "s627737925" ]
u263830634
p03644
python
s782387821
s884428270
19
17
2,940
2,940
Accepted
Accepted
10.53
N = int(eval(input())) ans = 1 while ans * 2 <= N: ans *= 2 print (ans)
N = int(eval(input())) ans = 0 count = 0 for i in range(1, N + 1): tmp = 0 j = i while j % 2 == 0: j //= 2 tmp += 1 if tmp >= count: count = tmp ans = i print (ans)
7
16
77
232
N = int(eval(input())) ans = 1 while ans * 2 <= N: ans *= 2 print(ans)
N = int(eval(input())) ans = 0 count = 0 for i in range(1, N + 1): tmp = 0 j = i while j % 2 == 0: j //= 2 tmp += 1 if tmp >= count: count = tmp ans = i print(ans)
false
56.25
[ "-ans = 1", "-while ans * 2 <= N:", "- ans *= 2", "+ans = 0", "+count = 0", "+for i in range(1, N + 1):", "+ tmp = 0", "+ j = i", "+ while j % 2 == 0:", "+ j //= 2", "+ tmp += 1", "+ if tmp >= count:", "+ count = tmp", "+ ans = i" ]
false
0.049401
0.048798
1.01235
[ "s782387821", "s884428270" ]
u539281377
p02983
python
s413426105
s409975492
816
405
149,080
75,392
Accepted
Accepted
50.37
L,R=list(map(int,input().split())) if R-L>2019: print((0)) else: ans=[i*j%2019 for i in range(L,R) for j in range(L+1,R+1)] print((min(ans)))
L,R=list(map(int,input().split())) ans=0 if R-L<2019: ans=min([i*j%2019 for i in range(L,R) for j in range(i+1,R+1)]) print(ans)
5
5
145
130
L, R = list(map(int, input().split())) if R - L > 2019: print((0)) else: ans = [i * j % 2019 for i in range(L, R) for j in range(L + 1, R + 1)] print((min(ans)))
L, R = list(map(int, input().split())) ans = 0 if R - L < 2019: ans = min([i * j % 2019 for i in range(L, R) for j in range(i + 1, R + 1)]) print(ans)
false
0
[ "-if R - L > 2019:", "- print((0))", "-else:", "- ans = [i * j % 2019 for i in range(L, R) for j in range(L + 1, R + 1)]", "- print((min(ans)))", "+ans = 0", "+if R - L < 2019:", "+ ans = min([i * j % 2019 for i in range(L, R) for j in range(i + 1, R + 1)])", "+print(ans)" ]
false
0.044335
0.05083
0.872222
[ "s413426105", "s409975492" ]
u301624971
p02755
python
s614042345
s904255373
38
18
5,048
3,064
Accepted
Accepted
52.63
import fractions import sys A,B=list(map(int,input().split())) for i in range(1,1009): if(int(i*0.08) == A and int(i*0.1)==B): print(i) sys.exit() print((-1))
from math import floor def myAnswer(A:int,B:int) -> int: price = 1 while True: if(floor(price*0.08)==A and floor(price*0.1)==B): return price elif(floor(price*0.08)>A or floor(price*0.1)>B): return -1 else: price+=1 def modelAnswer(): tmp=1 def ma...
9
20
179
426
import fractions import sys A, B = list(map(int, input().split())) for i in range(1, 1009): if int(i * 0.08) == A and int(i * 0.1) == B: print(i) sys.exit() print((-1))
from math import floor def myAnswer(A: int, B: int) -> int: price = 1 while True: if floor(price * 0.08) == A and floor(price * 0.1) == B: return price elif floor(price * 0.08) > A or floor(price * 0.1) > B: return -1 else: price += 1 def modelAnsw...
false
55
[ "-import fractions", "-import sys", "+from math import floor", "-A, B = list(map(int, input().split()))", "-for i in range(1, 1009):", "- if int(i * 0.08) == A and int(i * 0.1) == B:", "- print(i)", "- sys.exit()", "-print((-1))", "+", "+def myAnswer(A: int, B: int) -> int:", ...
false
0.037953
0.075573
0.502208
[ "s614042345", "s904255373" ]
u261103969
p02596
python
s450979000
s860752158
201
139
62,876
9,092
Accepted
Accepted
30.85
def calc(k): cur = 0 for i in range(1, 10 ** 7): cur *= 10 cur += 7 cur %= k if cur == 0: return i return -1 k = int(eval(input())) print((calc(k)))
def calc(k): cur = 7 % k for i in range(1, k + 1): if cur == 0: return i else: cur *= 10 cur += 7 cur %= k return -1 k = int(eval(input())) print((calc(k)))
14
14
212
240
def calc(k): cur = 0 for i in range(1, 10**7): cur *= 10 cur += 7 cur %= k if cur == 0: return i return -1 k = int(eval(input())) print((calc(k)))
def calc(k): cur = 7 % k for i in range(1, k + 1): if cur == 0: return i else: cur *= 10 cur += 7 cur %= k return -1 k = int(eval(input())) print((calc(k)))
false
0
[ "- cur = 0", "- for i in range(1, 10**7):", "- cur *= 10", "- cur += 7", "- cur %= k", "+ cur = 7 % k", "+ for i in range(1, k + 1):", "+ else:", "+ cur *= 10", "+ cur += 7", "+ cur %= k" ]
false
0.803408
0.089
9.027085
[ "s450979000", "s860752158" ]
u476604182
p02949
python
s493662087
s226153031
1,637
602
48,868
48,928
Accepted
Accepted
63.23
from collections import deque N,M,P,*L = list(map(int, open(0).read().split())) INF = 10**9 Els = [] dic = [[] for i in range(N+1)] rdic = [[] for i in range(N+1)] for a,b,c in zip(*[iter(L)]*3): dic[a].append((b,c-P)) rdic[b].append((a,c-P)) Els.append((a,b,-c+P)) ok1 = [False]*(N+1) ok1[1] = True q ...
from collections import deque N,M,P,*L = list(map(int, open(0).read().split())) INF = 10**9 Els = [] dic = [[] for i in range(N+1)] rdic = [[] for i in range(N+1)] for a,b,c in zip(*[iter(L)]*3): dic[a].append((b,c-P)) rdic[b].append((a,c-P)) Els.append((a,b,-c+P)) ok1 = [False]*(N+1) ok1[1] = True q ...
48
48
946
944
from collections import deque N, M, P, *L = list(map(int, open(0).read().split())) INF = 10**9 Els = [] dic = [[] for i in range(N + 1)] rdic = [[] for i in range(N + 1)] for a, b, c in zip(*[iter(L)] * 3): dic[a].append((b, c - P)) rdic[b].append((a, c - P)) Els.append((a, b, -c + P)) ok1 = [False] * (N +...
from collections import deque N, M, P, *L = list(map(int, open(0).read().split())) INF = 10**9 Els = [] dic = [[] for i in range(N + 1)] rdic = [[] for i in range(N + 1)] for a, b, c in zip(*[iter(L)] * 3): dic[a].append((b, c - P)) rdic[b].append((a, c - P)) Els.append((a, b, -c + P)) ok1 = [False] * (N +...
false
0
[ "- if cnt > 2 * M:", "+ if cnt > N:" ]
false
0.038277
0.037786
1.012999
[ "s493662087", "s226153031" ]
u434872492
p02984
python
s824797604
s981582358
190
109
14,408
95,384
Accepted
Accepted
42.63
N=int(eval(input())) A=list(map(int,input().split())) ans=[0]*N t=0 for i in range(N): if i%2==0: t+=A[i] else: t-=A[i] t=t/2 ans[0]=t for i in range(1,N): ans[i]=A[i-1]-ans[i-1] for i in range(N): ans[i]=int(2*ans[i]) print((*ans[0:]))
N = int(eval(input())) A = list(map(int,input().split())) ans = [] res = 0 for i in range(N): if i%2==0: res += A[i] else: res -= A[i] ans.append(res) for i in range(1,N): res = 2*A[i-1]-ans[-1] ans.append(res) print((*ans))
17
18
277
269
N = int(eval(input())) A = list(map(int, input().split())) ans = [0] * N t = 0 for i in range(N): if i % 2 == 0: t += A[i] else: t -= A[i] t = t / 2 ans[0] = t for i in range(1, N): ans[i] = A[i - 1] - ans[i - 1] for i in range(N): ans[i] = int(2 * ans[i]) print((*ans[0:]))
N = int(eval(input())) A = list(map(int, input().split())) ans = [] res = 0 for i in range(N): if i % 2 == 0: res += A[i] else: res -= A[i] ans.append(res) for i in range(1, N): res = 2 * A[i - 1] - ans[-1] ans.append(res) print((*ans))
false
5.555556
[ "-ans = [0] * N", "-t = 0", "+ans = []", "+res = 0", "- t += A[i]", "+ res += A[i]", "- t -= A[i]", "-t = t / 2", "-ans[0] = t", "+ res -= A[i]", "+ans.append(res)", "- ans[i] = A[i - 1] - ans[i - 1]", "-for i in range(N):", "- ans[i] = int(2 * ans[i])", ...
false
0.037056
0.035285
1.050177
[ "s824797604", "s981582358" ]
u628070051
p03605
python
s528520526
s246685123
28
25
9,012
8,936
Accepted
Accepted
10.71
N = eval(input()) if '9' in N: print('Yes') else: print('No')
N = str(eval(input())) def answer(N: str) -> str: if '9' in N: return 'Yes' else: return 'No' print((answer(N)))
5
9
67
138
N = eval(input()) if "9" in N: print("Yes") else: print("No")
N = str(eval(input())) def answer(N: str) -> str: if "9" in N: return "Yes" else: return "No" print((answer(N)))
false
44.444444
[ "-N = eval(input())", "-if \"9\" in N:", "- print(\"Yes\")", "-else:", "- print(\"No\")", "+N = str(eval(input()))", "+", "+", "+def answer(N: str) -> str:", "+ if \"9\" in N:", "+ return \"Yes\"", "+ else:", "+ return \"No\"", "+", "+", "+print((answer(N)))" ...
false
0.043486
0.037221
1.168336
[ "s528520526", "s246685123" ]
u462329577
p03606
python
s778083549
s745412202
206
20
39,408
2,940
Accepted
Accepted
90.29
def print_ans(l,r,N): """print(sum(r)-sum(l)+N) Parameters -------------- >>> print_ans([24],[30],1) 7 >>> print_ans([6,3],[8,3],2) 4 """ print((sum(r)-sum(l)+N)) def main(): N = int(eval(input())) l = [] r = [] for i in range(N): s = list(map(int,input().split())...
n = int(eval(input())) ans = 0 for i in range(n): r,l = list(map(int,input().split())) ans = ans + l -r + 1 print(ans)
29
6
420
120
def print_ans(l, r, N): """print(sum(r)-sum(l)+N) Parameters -------------- >>> print_ans([24],[30],1) 7 >>> print_ans([6,3],[8,3],2) 4 """ print((sum(r) - sum(l) + N)) def main(): N = int(eval(input())) l = [] r = [] for i in range(N): s = list(map(int, inp...
n = int(eval(input())) ans = 0 for i in range(n): r, l = list(map(int, input().split())) ans = ans + l - r + 1 print(ans)
false
79.310345
[ "-def print_ans(l, r, N):", "- \"\"\"print(sum(r)-sum(l)+N)", "- Parameters", "- >>> print_ans([24],[30],1)", "- 7", "- >>> print_ans([6,3],[8,3],2)", "- 4", "- \"\"\"", "- print((sum(r) - sum(l) + N))", "-", "-", "-def main():", "- N = int(eval(input()))", "- ...
false
0.067572
0.117818
0.573531
[ "s778083549", "s745412202" ]
u680851063
p02743
python
s123940124
s147865144
36
31
5,076
9,080
Accepted
Accepted
13.89
from decimal import Decimal a, b, c = list(map(int,input().split())) if (Decimal(a).sqrt() + Decimal(b).sqrt()) >= Decimal(c).sqrt(): print('No') else: print('Yes')
a,b,c = list(map(int, input().split())) if 4 * a * b < (c - a - b) ** 2 and c - a - b > 0: print('Yes') else: print('No')
8
6
175
130
from decimal import Decimal a, b, c = list(map(int, input().split())) if (Decimal(a).sqrt() + Decimal(b).sqrt()) >= Decimal(c).sqrt(): print("No") else: print("Yes")
a, b, c = list(map(int, input().split())) if 4 * a * b < (c - a - b) ** 2 and c - a - b > 0: print("Yes") else: print("No")
false
25
[ "-from decimal import Decimal", "-", "-if (Decimal(a).sqrt() + Decimal(b).sqrt()) >= Decimal(c).sqrt():", "+if 4 * a * b < (c - a - b) ** 2 and c - a - b > 0:", "+ print(\"Yes\")", "+else:", "-else:", "- print(\"Yes\")" ]
false
0.062006
0.036031
1.720936
[ "s123940124", "s147865144" ]
u088115428
p02713
python
s318639706
s976315697
1,967
1,347
9,168
9,572
Accepted
Accepted
31.52
from math import gcd n = int(eval(input())) g = 0 for i in range (1, n+1): for j in range (1, n+1): for k in range (1, n+1): g += gcd(gcd(i,j),k) print(g)
import functools from math import gcd n = int(eval(input())) @functools.lru_cache(None) def main(n): g=0 for i in range (1, n+1): for j in range (1, n+1): for k in range (1, n+1): g += gcd(gcd(i,j),k) return (g) print((main(n)))
9
12
171
256
from math import gcd n = int(eval(input())) g = 0 for i in range(1, n + 1): for j in range(1, n + 1): for k in range(1, n + 1): g += gcd(gcd(i, j), k) print(g)
import functools from math import gcd n = int(eval(input())) @functools.lru_cache(None) def main(n): g = 0 for i in range(1, n + 1): for j in range(1, n + 1): for k in range(1, n + 1): g += gcd(gcd(i, j), k) return g print((main(n)))
false
25
[ "+import functools", "-g = 0", "-for i in range(1, n + 1):", "- for j in range(1, n + 1):", "- for k in range(1, n + 1):", "- g += gcd(gcd(i, j), k)", "-print(g)", "+", "+", "+@functools.lru_cache(None)", "+def main(n):", "+ g = 0", "+ for i in range(1, n + 1):", ...
false
0.04283
0.039572
1.082329
[ "s318639706", "s976315697" ]
u670180528
p03448
python
s799069372
s886095012
59
50
2,940
2,940
Accepted
Accepted
15.25
a,b,c,x=list(map(int,open(0)));d=0 for i in range(a+1): for j in range(b+1): for k in range(c+1): d+=i*500+j*100+k*50==x print(d)
a,b,c,x=list(map(int,open(0))) print((sum(500*i+100*j+50*k==x for i in range(a+1)for j in range(b+1)for k in range(c+1))))
6
2
135
115
a, b, c, x = list(map(int, open(0))) d = 0 for i in range(a + 1): for j in range(b + 1): for k in range(c + 1): d += i * 500 + j * 100 + k * 50 == x print(d)
a, b, c, x = list(map(int, open(0))) print( ( sum( 500 * i + 100 * j + 50 * k == x for i in range(a + 1) for j in range(b + 1) for k in range(c + 1) ) ) )
false
66.666667
[ "-d = 0", "-for i in range(a + 1):", "- for j in range(b + 1):", "- for k in range(c + 1):", "- d += i * 500 + j * 100 + k * 50 == x", "-print(d)", "+print(", "+ (", "+ sum(", "+ 500 * i + 100 * j + 50 * k == x", "+ for i in range(a + 1)", "...
false
0.244404
0.074235
3.292306
[ "s799069372", "s886095012" ]
u403301154
p02975
python
s012962791
s567878587
237
74
60,784
14,832
Accepted
Accepted
68.78
n = int(eval(input())) a = list(map(int, input().split())) b = set(a) c = sorted(list(b)) if len(b)==1 and c[0]==0: print("Yes") exit() if c[0]==0: if n%2==0 and a.count(c[0])==n//2 and a.count(c[1])==n//2: print("Yes") exit() if n%2==1 and a.count(c[0])==n//2 and a.count(c[1])==n//2+1: ...
n = int(eval(input())) a = list(map(int, input().split())) b = set(a) c = sorted(list(b)) if len(b)==1 and c[0]==0: print("Yes") exit() elif n%3!=0: print("No") exit() elif len(b)==2: if c[0]==0 and a.count(c[0])==n//3 and a.count(c[1])==(n//3)*2: print("Yes") exit() elif len(b)==3: p...
28
21
690
497
n = int(eval(input())) a = list(map(int, input().split())) b = set(a) c = sorted(list(b)) if len(b) == 1 and c[0] == 0: print("Yes") exit() if c[0] == 0: if n % 2 == 0 and a.count(c[0]) == n // 2 and a.count(c[1]) == n // 2: print("Yes") exit() if n % 2 == 1 and a.count(c[0]) == n // 2 a...
n = int(eval(input())) a = list(map(int, input().split())) b = set(a) c = sorted(list(b)) if len(b) == 1 and c[0] == 0: print("Yes") exit() elif n % 3 != 0: print("No") exit() elif len(b) == 2: if c[0] == 0 and a.count(c[0]) == n // 3 and a.count(c[1]) == (n // 3) * 2: print("Yes") e...
false
25
[ "-if c[0] == 0:", "- if n % 2 == 0 and a.count(c[0]) == n // 2 and a.count(c[1]) == n // 2:", "- print(\"Yes\")", "- exit()", "- if n % 2 == 1 and a.count(c[0]) == n // 2 and a.count(c[1]) == n // 2 + 1:", "- print(\"Yes\")", "- exit()", "-if n % 3 != 0:", "+elif n ...
false
0.065552
0.040341
1.624945
[ "s012962791", "s567878587" ]
u597455618
p02559
python
s073690892
s403209143
2,713
687
160,764
172,544
Accepted
Accepted
74.68
import numpy as np from numba import njit, i8, jitclass import sys spec = [ ("size", i8), ("tree", i8[:]) ] @jitclass(spec) class Bit: def __init__(self, n, arr): self.size = n self.tree = np.array([0] + arr, np.int64) for i in range(1, n+1): x = i + (i...
import sys class Bit: def __init__(self, n, arr): self.size = n self.tree = [0] + arr for i in range(1, n+1): x = i + (i & -i) if x < n + 1: self.tree[x] += self.tree[i] def sum(self, i): s = 0 while i > 0: ...
49
40
1,099
947
import numpy as np from numba import njit, i8, jitclass import sys spec = [("size", i8), ("tree", i8[:])] @jitclass(spec) class Bit: def __init__(self, n, arr): self.size = n self.tree = np.array([0] + arr, np.int64) for i in range(1, n + 1): x = i + (i & -i) if x ...
import sys class Bit: def __init__(self, n, arr): self.size = n self.tree = [0] + arr for i in range(1, n + 1): x = i + (i & -i) if x < n + 1: self.tree[x] += self.tree[i] def sum(self, i): s = 0 while i > 0: s += sel...
false
18.367347
[ "-import numpy as np", "-from numba import njit, i8, jitclass", "-spec = [(\"size\", i8), (\"tree\", i8[:])]", "-", "-@jitclass(spec)", "- self.tree = np.array([0] + arr, np.int64)", "+ self.tree = [0] + arr" ]
false
0.252624
0.046249
5.462284
[ "s073690892", "s403209143" ]