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
u926046014
p02796
python
s404424089
s293434069
318
227
93,260
89,968
Accepted
Accepted
28.62
n=int(eval(input())) lst=[] for i in range(n): a,b=list(map(int,input().split())) lst.append([a-b,a+b]) lst=sorted(lst,key=lambda x:x[1]) ans=0 end=-float("inf") for i in lst: if i[0]>=end: ans+=1 end=i[1] print(ans)
def main(): import sys input=sys.stdin.readline n=int(eval(input())) lst=[] for i in range(n): a,b=list(map(int,input().split())) lst.append([a-b,a+b]) lst=sorted(lst,key=lambda x:x[1]) ans=0 end=-float("inf") for i in lst: if i[0]>=end: ...
13
18
244
393
n = int(eval(input())) lst = [] for i in range(n): a, b = list(map(int, input().split())) lst.append([a - b, a + b]) lst = sorted(lst, key=lambda x: x[1]) ans = 0 end = -float("inf") for i in lst: if i[0] >= end: ans += 1 end = i[1] print(ans)
def main(): import sys input = sys.stdin.readline n = int(eval(input())) lst = [] for i in range(n): a, b = list(map(int, input().split())) lst.append([a - b, a + b]) lst = sorted(lst, key=lambda x: x[1]) ans = 0 end = -float("inf") for i in lst: if i[0] >= e...
false
27.777778
[ "-n = int(eval(input()))", "-lst = []", "-for i in range(n):", "- a, b = list(map(int, input().split()))", "- lst.append([a - b, a + b])", "-lst = sorted(lst, key=lambda x: x[1])", "-ans = 0", "-end = -float(\"inf\")", "-for i in lst:", "- if i[0] >= end:", "- ans += 1", "- ...
false
0.036824
0.039108
0.9416
[ "s404424089", "s293434069" ]
u518042385
p02844
python
s285804513
s355068542
822
542
42,988
44,312
Accepted
Accepted
34.06
n=int(eval(input())) w=eval(input()) d1={} d2={} d3={} for i in range(0,10): d1[str(i)]=0 for j in range(10): d2[str(i)+str(j)]=0 for k in range(10): d3[str(i)+str(j)+str(k)]=0 for i in range(len(w)): for j in range(10): for k in range(10): if d2[str(j)+str(k)]>0: d3...
n=int(eval(input())) l=list(eval(input())) ans=0 for i in range(10): for j in range(10): for k in range(10): now=str(i) count=0 b=True f=1 while count<n and b: if l[count]==now: if f==1: now=str(j) f+=1 elif f==2: ...
25
24
475
448
n = int(eval(input())) w = eval(input()) d1 = {} d2 = {} d3 = {} for i in range(0, 10): d1[str(i)] = 0 for j in range(10): d2[str(i) + str(j)] = 0 for k in range(10): d3[str(i) + str(j) + str(k)] = 0 for i in range(len(w)): for j in range(10): for k in range(10): ...
n = int(eval(input())) l = list(eval(input())) ans = 0 for i in range(10): for j in range(10): for k in range(10): now = str(i) count = 0 b = True f = 1 while count < n and b: if l[count] == now: if f == 1: ...
false
4
[ "-w = eval(input())", "-d1 = {}", "-d2 = {}", "-d3 = {}", "-for i in range(0, 10):", "- d1[str(i)] = 0", "- for j in range(10):", "- d2[str(i) + str(j)] = 0", "- for k in range(10):", "- d3[str(i) + str(j) + str(k)] = 0", "-for i in range(len(w)):", "+l = list(ev...
false
0.05072
0.048462
1.046601
[ "s285804513", "s355068542" ]
u729133443
p03959
python
s255402501
s951508345
283
173
88,932
18,480
Accepted
Accepted
38.87
n=int(eval(input())) t=tuple([0]+list(map(int,input().split()))+[0]) a=tuple([0]+list(map(int,input().split()))+[0]) if n==1 and t[1]!=a[1]: print((0)) exit() c=1 m=10**9+7 for i in range(1,n): if t[i]>t[i-1]: if a[i]>a[i+1]and a[i]!=t[i]or a[i]==a[i+1]and a[i]<t[i]: print((0)...
n=int(eval(input())) t=tuple([0]+list(map(int,input().split()))+[0]) a=tuple([0]+list(map(int,input().split()))+[0]) c=1 m=10**9+7 for i in range(1,n+1): if t[i]>t[i-1]: if a[i]>a[i+1]and a[i]!=t[i]or a[i]==a[i+1]and a[i]<t[i]: print((0)) exit() else: if a[i]>a...
20
17
492
443
n = int(eval(input())) t = tuple([0] + list(map(int, input().split())) + [0]) a = tuple([0] + list(map(int, input().split())) + [0]) if n == 1 and t[1] != a[1]: print((0)) exit() c = 1 m = 10**9 + 7 for i in range(1, n): if t[i] > t[i - 1]: if a[i] > a[i + 1] and a[i] != t[i] or a[i] == a[i + 1] and...
n = int(eval(input())) t = tuple([0] + list(map(int, input().split())) + [0]) a = tuple([0] + list(map(int, input().split())) + [0]) c = 1 m = 10**9 + 7 for i in range(1, n + 1): if t[i] > t[i - 1]: if a[i] > a[i + 1] and a[i] != t[i] or a[i] == a[i + 1] and a[i] < t[i]: print((0)) e...
false
15
[ "-if n == 1 and t[1] != a[1]:", "- print((0))", "- exit()", "-for i in range(1, n):", "+for i in range(1, n + 1):" ]
false
0.037636
0.036778
1.023342
[ "s255402501", "s951508345" ]
u751863169
p03548
python
s560807213
s858236142
25
19
2,940
2,940
Accepted
Accepted
24
#!/usr/bin/env python def main(): X, Y, Z = list(map(int, input().split(" "))) max_num = 0 for i in range(100000): if Y * i + Z * (i + 1) <= X: max_num = i else: break print(max_num) if __name__ == '__main__': main()
#!/usr/bin/env python def main(): X, Y, Z = list(map(int, input().split(" "))) # max_num = 0 # for i in range(100000): # if Y * i + Z * (i + 1) <= X: # max_num = i # else: # break # print(max_num) print((int((X - Z) / (Y + Z)))) if __name__ ...
15
17
288
339
#!/usr/bin/env python def main(): X, Y, Z = list(map(int, input().split(" "))) max_num = 0 for i in range(100000): if Y * i + Z * (i + 1) <= X: max_num = i else: break print(max_num) if __name__ == "__main__": main()
#!/usr/bin/env python def main(): X, Y, Z = list(map(int, input().split(" "))) # max_num = 0 # for i in range(100000): # if Y * i + Z * (i + 1) <= X: # max_num = i # else: # break # print(max_num) print((int((X - Z) / (Y + Z)))) if __name__ == "__main__": ...
false
11.764706
[ "- max_num = 0", "- for i in range(100000):", "- if Y * i + Z * (i + 1) <= X:", "- max_num = i", "- else:", "- break", "- print(max_num)", "+ # max_num = 0", "+ # for i in range(100000):", "+ # if Y * i + Z * (i + 1) <= X:", "+ # ...
false
0.043328
0.132258
0.327603
[ "s560807213", "s858236142" ]
u187233527
p03078
python
s856944391
s639220361
774
36
4,468
4,852
Accepted
Accepted
95.35
import heapq X, Y, Z, K = list(map(int, input().split())) A = sorted([int(i) for i in input().split()], reverse=True) B = sorted([int(i) for i in input().split()], reverse=True) C = sorted([int(i) for i in input().split()], reverse=True) heap = [] heapq.heappush(heap, (-(A[0] + B[0] + C[0]), 0, 0, 0)) added ...
import heapq X, Y, Z, K = list(map(int, input().split())) A = sorted([int(i) for i in input().split()], reverse=True) B = sorted([int(i) for i in input().split()], reverse=True) C = sorted([int(i) for i in input().split()], reverse=True) heap = [] heapq.heappush(heap, (-(A[0] + B[0] + C[0]), 0, 0, 0)) added ...
22
22
868
873
import heapq X, Y, Z, K = list(map(int, input().split())) A = sorted([int(i) for i in input().split()], reverse=True) B = sorted([int(i) for i in input().split()], reverse=True) C = sorted([int(i) for i in input().split()], reverse=True) heap = [] heapq.heappush(heap, (-(A[0] + B[0] + C[0]), 0, 0, 0)) added = [] for _...
import heapq X, Y, Z, K = list(map(int, input().split())) A = sorted([int(i) for i in input().split()], reverse=True) B = sorted([int(i) for i in input().split()], reverse=True) C = sorted([int(i) for i in input().split()], reverse=True) heap = [] heapq.heappush(heap, (-(A[0] + B[0] + C[0]), 0, 0, 0)) added = set([(0,...
false
0
[ "-added = []", "+added = set([(0, 0, 0)])", "- added.append((i + 1, j, k))", "+ added.add((i + 1, j, k))", "- added.append((i, j + 1, k))", "+ added.add((i, j + 1, k))", "- added.append((i, j, k + 1))", "+ added.add((i, j, k + 1))" ]
false
0.035447
0.033468
1.059127
[ "s856944391", "s639220361" ]
u281303342
p03837
python
s908385043
s222343778
647
257
3,432
18,040
Accepted
Accepted
60.28
N,M = list(map(int,input().split())) A = [[9999 for _ in range(N)] for _ in range(N)] B = [] for i in range(M): a,b,c = list(map(int,input().split())) A[a-1][b-1] = c A[b-1][a-1] = c B.append((a-1,b-1,c)) for k in range(N): for i in range(N): for j in range(N): if ...
# python3 (3.4.3) import sys input = sys.stdin.readline # main from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall N,M = list(map(int,input().split())) ABC = [list(map(int,input().split())) for _ in range(M)] g = [[0 for _ in range(N)] for _ in range(N)] for a,b,c in ABC: g[a-1][b-1] ...
28
23
589
477
N, M = list(map(int, input().split())) A = [[9999 for _ in range(N)] for _ in range(N)] B = [] for i in range(M): a, b, c = list(map(int, input().split())) A[a - 1][b - 1] = c A[b - 1][a - 1] = c B.append((a - 1, b - 1, c)) for k in range(N): for i in range(N): for j in range(N): ...
# python3 (3.4.3) import sys input = sys.stdin.readline # main from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall N, M = list(map(int, input().split())) ABC = [list(map(int, input().split())) for _ in range(M)] g = [[0 for _ in range(N)] for _ in range(N)] for a, b, c in ABC: g[a - 1][b - 1] = c ...
false
17.857143
[ "+# python3 (3.4.3)", "+import sys", "+", "+input = sys.stdin.readline", "+# main", "+from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall", "+", "-A = [[9999 for _ in range(N)] for _ in range(N)]", "-B = []", "-for i in range(M):", "- a, b, c = list(map(int, input().split()))"...
false
0.073783
0.403455
0.182877
[ "s908385043", "s222343778" ]
u197300260
p03767
python
s238266394
s893399148
231
205
37,212
37,084
Accepted
Accepted
11.26
# Problem: https://atcoder.jp/contests/agc012/tasks/agc012_a # Python 1st Try import sys # from collections import defaultdict # import heapq,copy # from collections import deque def II(): return int(sys.stdin.readline()) def MI(): return list(map(int, sys.stdin.readline().split())) def LI(): retu...
# Problem:https://atcoder.jp/contests/agc012/tasks/agc012_a # Python 2nd Try import sys # from collections import defaultdict # import heapq,copy # from collections import deque def II(): return int(sys.stdin.readline()) def MI(): return list(map(int, sys.stdin.readline().split())) def LI(): retur...
46
36
1,231
811
# Problem: https://atcoder.jp/contests/agc012/tasks/agc012_a # Python 1st Try import sys # from collections import defaultdict # import heapq,copy # from collections import deque def II(): return int(sys.stdin.readline()) def MI(): return list(map(int, sys.stdin.readline().split())) def LI(): return li...
# Problem:https://atcoder.jp/contests/agc012/tasks/agc012_a # Python 2nd Try import sys # from collections import defaultdict # import heapq,copy # from collections import deque def II(): return int(sys.stdin.readline()) def MI(): return list(map(int, sys.stdin.readline().split())) def LI(): return lis...
false
21.73913
[ "-# Problem: https://atcoder.jp/contests/agc012/tasks/agc012_a", "-# Python 1st Try", "+# Problem:https://atcoder.jp/contests/agc012/tasks/agc012_a", "+# Python 2nd Try", "-def solver(eachPoints):", "- result = 0", "- menbers = len(eachPoints)", "- group = menbers // 3", "- eachPoints.so...
false
0.041758
0.043375
0.962738
[ "s238266394", "s893399148" ]
u816631826
p02879
python
s291762136
s031194321
395
29
84,916
9,176
Accepted
Accepted
92.66
s = input() n1, n2 = s.split() n1 = int(n1) n2 = int(n2) flag = True if n1 < 0 or n1 > 9: flag = False if n2 < 0 or n2 > 9: flag = False if flag: print(n1 * n2) else: print(-1)
N = list(map(int, input().strip().split())) state=-1 if(N[0]>=1 and N[0] <=9 and N[1]>=1 and N[1] <=9): state=N[0]*N[1] print(state)
13
5
195
138
s = input() n1, n2 = s.split() n1 = int(n1) n2 = int(n2) flag = True if n1 < 0 or n1 > 9: flag = False if n2 < 0 or n2 > 9: flag = False if flag: print(n1 * n2) else: print(-1)
N = list(map(int, input().strip().split())) state = -1 if N[0] >= 1 and N[0] <= 9 and N[1] >= 1 and N[1] <= 9: state = N[0] * N[1] print(state)
false
61.538462
[ "-s = input()", "-n1, n2 = s.split()", "-n1 = int(n1)", "-n2 = int(n2)", "-flag = True", "-if n1 < 0 or n1 > 9:", "- flag = False", "-if n2 < 0 or n2 > 9:", "- flag = False", "-if flag:", "- print(n1 * n2)", "-else:", "- print(-1)", "+N = list(map(int, input().strip().split()))...
false
0.039575
0.036639
1.080145
[ "s291762136", "s031194321" ]
u612721349
p03470
python
s312001074
s575115068
191
17
38,256
2,940
Accepted
Accepted
91.1
n = int(eval(input())) al = set([int(eval(input())) for i in range(n)]) print((len(al)))
print((len(set(eval(input())for i in[0]*int(eval(input()))))))
3
1
76
48
n = int(eval(input())) al = set([int(eval(input())) for i in range(n)]) print((len(al)))
print((len(set(eval(input()) for i in [0] * int(eval(input()))))))
false
66.666667
[ "-n = int(eval(input()))", "-al = set([int(eval(input())) for i in range(n)])", "-print((len(al)))", "+print((len(set(eval(input()) for i in [0] * int(eval(input()))))))" ]
false
0.09513
0.038223
2.488803
[ "s312001074", "s575115068" ]
u609738635
p03835
python
s802196693
s067975921
1,662
787
3,060
3,060
Accepted
Accepted
52.65
K, S = list(map(int, input().split())) way = 0 for x in range(0, K+1): for y in range(0, K+1): z = S - x -y if(z>=0 and z<=K): way += 1 print(way)
# -*- coding: utf-8 -*- def solve(K, S): count = 0 for i in range(K+1): for j in range(K+1): if(0<= S-i-j <= K): count += 1 print(count) if __name__ == '__main__': K, S = list(map(int, input().split())) solve(K, S)
8
16
179
309
K, S = list(map(int, input().split())) way = 0 for x in range(0, K + 1): for y in range(0, K + 1): z = S - x - y if z >= 0 and z <= K: way += 1 print(way)
# -*- coding: utf-8 -*- def solve(K, S): count = 0 for i in range(K + 1): for j in range(K + 1): if 0 <= S - i - j <= K: count += 1 print(count) if __name__ == "__main__": K, S = list(map(int, input().split())) solve(K, S)
false
50
[ "-K, S = list(map(int, input().split()))", "-way = 0", "-for x in range(0, K + 1):", "- for y in range(0, K + 1):", "- z = S - x - y", "- if z >= 0 and z <= K:", "- way += 1", "-print(way)", "+# -*- coding: utf-8 -*-", "+def solve(K, S):", "+ count = 0", "+ fo...
false
0.056353
0.036415
1.547532
[ "s802196693", "s067975921" ]
u445624660
p03151
python
s613629778
s362545690
185
155
18,356
24,288
Accepted
Accepted
16.22
# にぶたんが失敗したので両端からしゃくとりするような感じでやってみる # 差分でソートして大きく足りないものは大きく余ってるやつをぶつける N = int(eval(input())) A = list(map(int, input().split())) B = list(map(int, input().split())) if sum(A) < sum(B): print((-1)) exit() D = [] pre_ans = 0 # 確実に変えなくてはいけないやつ for i in range(N): if A[i] != B[i]: D.appen...
# 余剰と不足に分ける 余剰の多いやつから使って不足の多いやつに振る n = int(eval(input())) a = list(map(int, input().split())) b = list(map(int, input().split())) if sum(a) < sum(b): print((-1)) exit() surplus = [] lack = [] for i in range(n): if a[i] > b[i]: surplus.append(a[i] - b[i]) elif a[i] < b[i]: ...
32
42
652
920
# にぶたんが失敗したので両端からしゃくとりするような感じでやってみる # 差分でソートして大きく足りないものは大きく余ってるやつをぶつける N = int(eval(input())) A = list(map(int, input().split())) B = list(map(int, input().split())) if sum(A) < sum(B): print((-1)) exit() D = [] pre_ans = 0 # 確実に変えなくてはいけないやつ for i in range(N): if A[i] != B[i]: D.append(A[i] - B[i])...
# 余剰と不足に分ける 余剰の多いやつから使って不足の多いやつに振る n = int(eval(input())) a = list(map(int, input().split())) b = list(map(int, input().split())) if sum(a) < sum(b): print((-1)) exit() surplus = [] lack = [] for i in range(n): if a[i] > b[i]: surplus.append(a[i] - b[i]) elif a[i] < b[i]: # 同値は含まない ...
false
23.809524
[ "-# にぶたんが失敗したので両端からしゃくとりするような感じでやってみる", "-# 差分でソートして大きく足りないものは大きく余ってるやつをぶつける", "-N = int(eval(input()))", "-A = list(map(int, input().split()))", "-B = list(map(int, input().split()))", "-if sum(A) < sum(B):", "+# 余剰と不足に分ける 余剰の多いやつから使って不足の多いやつに振る", "+n = int(eval(input()))", "+a = list(map(int, inpu...
false
0.041388
0.040547
1.020743
[ "s613629778", "s362545690" ]
u305366205
p03848
python
s460840486
s947936052
186
90
20,028
13,880
Accepted
Accepted
51.61
import collections n = int(eval(input())) a = list(map(int, input().split())) dd = collections.defaultdict(int) correct = [] if n % 2 == 1: correct.append(0) for i in range((n - 1) // 2): correct.append(2 * i + 2) correct.append(2 * i + 2) else: correct.append(1) correct.appe...
n = int(eval(input())) a = list(map(int, input().split())) a = sorted(a) if n % 2 == 1: if a[0] != 0: print((0)) exit() for i in range(1, n, 2): if a[i] != a[i + 1] or a[i] != i + 1: print((0)) exit() else: for i in range(0, n, 2): if a[i]...
30
17
678
420
import collections n = int(eval(input())) a = list(map(int, input().split())) dd = collections.defaultdict(int) correct = [] if n % 2 == 1: correct.append(0) for i in range((n - 1) // 2): correct.append(2 * i + 2) correct.append(2 * i + 2) else: correct.append(1) correct.append(1) f...
n = int(eval(input())) a = list(map(int, input().split())) a = sorted(a) if n % 2 == 1: if a[0] != 0: print((0)) exit() for i in range(1, n, 2): if a[i] != a[i + 1] or a[i] != i + 1: print((0)) exit() else: for i in range(0, n, 2): if a[i] != a[i + 1] ...
false
43.333333
[ "-import collections", "-", "-dd = collections.defaultdict(int)", "-correct = []", "+a = sorted(a)", "- correct.append(0)", "- for i in range((n - 1) // 2):", "- correct.append(2 * i + 2)", "- correct.append(2 * i + 2)", "-else:", "- correct.append(1)", "- correct.app...
false
0.048139
0.082108
0.586292
[ "s460840486", "s947936052" ]
u298633786
p03475
python
s346798816
s312346956
2,354
282
44,120
45,016
Accepted
Accepted
88.02
import sys import math # noqa import bisect # noqa import queue # noqa def input(): return sys.stdin.readline().rstrip() if __name__ == '__main__': N = int(eval(input())) C = [0 for _ in range(N - 1)] S = [0 for _ in range(N - 1)] F = [0 for _ in range(N - 1)] for i in rang...
import sys import math # noqa import bisect # noqa import queue # noqa def input(): return sys.stdin.readline().rstrip() if __name__ == '__main__': N = int(eval(input())) C = [0 for _ in range(N - 1)] S = [0 for _ in range(N - 1)] F = [0 for _ in range(N - 1)] for i in rang...
32
32
726
760
import sys import math # noqa import bisect # noqa import queue # noqa def input(): return sys.stdin.readline().rstrip() if __name__ == "__main__": N = int(eval(input())) C = [0 for _ in range(N - 1)] S = [0 for _ in range(N - 1)] F = [0 for _ in range(N - 1)] for i in range(N - 1): ...
import sys import math # noqa import bisect # noqa import queue # noqa def input(): return sys.stdin.readline().rstrip() if __name__ == "__main__": N = int(eval(input())) C = [0 for _ in range(N - 1)] S = [0 for _ in range(N - 1)] F = [0 for _ in range(N - 1)] for i in range(N - 1): ...
false
0
[ "- while t > next_t:", "- next_t += F[j + 1]", "+ if t > next_t:", "+ next_t += math.ceil((t - next_t) / F[j + 1]) * F[j + 1]" ]
false
0.069754
0.049252
1.416283
[ "s346798816", "s312346956" ]
u346812984
p03354
python
s981463865
s425554973
701
520
14,452
13,812
Accepted
Accepted
25.82
class UnionFind: # 初期化 def __init__(self, n_nodes): # 親要素のノード番号を格納する. # self.parent[x] == x の時,そのノードは根. self.parent = [i for i in range(n_nodes)] # 木の高さを格納する. self.rank = [0] * n_nodes # 検索. 根を返す. def find(self, x): if self.parent[x] == x: ...
import sys sys.setrecursionlimit(10 ** 6) INF = float("inf") MOD = 10 ** 9 + 7 def input(): return sys.stdin.readline().strip() class UnionFind: def __init__(self, n_nodes): self.n_nodes = n_nodes # self.parents[x] < 0 の時,xが根である. # また,xが根の時,(-1) * (同一グループの要素数) が格納され...
59
79
1,312
1,889
class UnionFind: # 初期化 def __init__(self, n_nodes): # 親要素のノード番号を格納する. # self.parent[x] == x の時,そのノードは根. self.parent = [i for i in range(n_nodes)] # 木の高さを格納する. self.rank = [0] * n_nodes # 検索. 根を返す. def find(self, x): if self.parent[x] == x: ret...
import sys sys.setrecursionlimit(10**6) INF = float("inf") MOD = 10**9 + 7 def input(): return sys.stdin.readline().strip() class UnionFind: def __init__(self, n_nodes): self.n_nodes = n_nodes # self.parents[x] < 0 の時,xが根である. # また,xが根の時,(-1) * (同一グループの要素数) が格納されるようになる. self....
false
25.316456
[ "+import sys", "+", "+sys.setrecursionlimit(10**6)", "+INF = float(\"inf\")", "+MOD = 10**9 + 7", "+", "+", "+def input():", "+ return sys.stdin.readline().strip()", "+", "+", "- # 初期化", "- # 親要素のノード番号を格納する.", "- # self.parent[x] == x の時,そのノードは根.", "- self.pare...
false
0.007704
0.165014
0.046687
[ "s981463865", "s425554973" ]
u130900604
p02793
python
s162207635
s035082137
1,083
968
70,620
5,572
Accepted
Accepted
10.62
#??? n=int(eval(input())) a=list(map(int,input().split())) MOD=10**9+7 def gcd(x,y): if x<y:x,y=y,x if y==0:return x return gcd(x%y,y) def lcm(x,y): return x*y//gcd(x,y) def inv(x): return pow(x,MOD-2,MOD) L=1 for i in a: L=lcm(L,i) L=L%MOD ans=0 for i in a: ans=(ans+L*inv(i))%...
n,*a=list(map(int,open(0).read().split())) MOD=10**9+7 from fractions import gcd def lcm(x,y):return x*y//gcd(x,y) def inv(x):return pow(x,MOD-2,MOD) L=1 for i in a:L=lcm(L,i) L=L%MOD ans=0 for i in a:ans=(ans+L*inv(i))%MOD print(ans)
27
14
335
246
# ??? n = int(eval(input())) a = list(map(int, input().split())) MOD = 10**9 + 7 def gcd(x, y): if x < y: x, y = y, x if y == 0: return x return gcd(x % y, y) def lcm(x, y): return x * y // gcd(x, y) def inv(x): return pow(x, MOD - 2, MOD) L = 1 for i in a: L = lcm(L, i) ...
n, *a = list(map(int, open(0).read().split())) MOD = 10**9 + 7 from fractions import gcd def lcm(x, y): return x * y // gcd(x, y) def inv(x): return pow(x, MOD - 2, MOD) L = 1 for i in a: L = lcm(L, i) L = L % MOD ans = 0 for i in a: ans = (ans + L * inv(i)) % MOD print(ans)
false
48.148148
[ "-# ???", "-n = int(eval(input()))", "-a = list(map(int, input().split()))", "+n, *a = list(map(int, open(0).read().split()))", "-", "-", "-def gcd(x, y):", "- if x < y:", "- x, y = y, x", "- if y == 0:", "- return x", "- return gcd(x % y, y)", "+from fractions import ...
false
0.045895
0.124459
0.368753
[ "s162207635", "s035082137" ]
u073549161
p03469
python
s150006877
s936268937
166
17
38,256
2,940
Accepted
Accepted
89.76
s = eval(input()) s = s[0:2] + "18" + s[4:] print(s)
s = eval(input()) print((s.replace("2017", "2018")))
3
2
48
45
s = eval(input()) s = s[0:2] + "18" + s[4:] print(s)
s = eval(input()) print((s.replace("2017", "2018")))
false
33.333333
[ "-s = s[0:2] + \"18\" + s[4:]", "-print(s)", "+print((s.replace(\"2017\", \"2018\")))" ]
false
0.042607
0.036283
1.174296
[ "s150006877", "s936268937" ]
u346812984
p02837
python
s279533447
s742038530
370
138
3,064
3,064
Accepted
Accepted
62.7
def is_nth_bit_set(x, n): if x & (1 << n): return 1 else: return 0 N = int(eval(input())) comment = {} for i in range(N): A = int(eval(input())) comment[i] = [] for _ in range(A): x, y = list(map(int, input().split())) x -= 1 comment[i].append...
import sys sys.setrecursionlimit(10 ** 6) INF = float("inf") MOD = 10 ** 9 + 7 def input(): return sys.stdin.readline().strip() def is_nth_bit_set(x, n): if x & (1 << n): return True else: return False def main(): N = int(eval(input())) comments = [[] for...
43
58
893
1,186
def is_nth_bit_set(x, n): if x & (1 << n): return 1 else: return 0 N = int(eval(input())) comment = {} for i in range(N): A = int(eval(input())) comment[i] = [] for _ in range(A): x, y = list(map(int, input().split())) x -= 1 comment[i].append((x, y)) ans = ...
import sys sys.setrecursionlimit(10**6) INF = float("inf") MOD = 10**9 + 7 def input(): return sys.stdin.readline().strip() def is_nth_bit_set(x, n): if x & (1 << n): return True else: return False def main(): N = int(eval(input())) comments = [[] for _ in range(N)] for i ...
false
25.862069
[ "+import sys", "+", "+sys.setrecursionlimit(10**6)", "+INF = float(\"inf\")", "+MOD = 10**9 + 7", "+", "+", "+def input():", "+ return sys.stdin.readline().strip()", "+", "+", "- return 1", "+ return True", "- return 0", "+ return False", "-N = int(eval(i...
false
0.036775
0.078572
0.468034
[ "s279533447", "s742038530" ]
u346812984
p02899
python
s659535694
s699426867
262
113
29,740
18,532
Accepted
Accepted
56.87
N = int(input()) A = {i + 1: a for i, a in enumerate(input().split())} sort_A = sorted(A.items(), key=lambda x: int(x[1])) for i, a in sort_A: print(i, end=" ")
N = int(eval(input())) A = list(map(int, input().split())) idx = sorted(list(range(1, N + 1)), key=lambda x: A[x - 1]) idx = list(map(str, idx)) print((" ".join(idx)))
6
5
171
158
N = int(input()) A = {i + 1: a for i, a in enumerate(input().split())} sort_A = sorted(A.items(), key=lambda x: int(x[1])) for i, a in sort_A: print(i, end=" ")
N = int(eval(input())) A = list(map(int, input().split())) idx = sorted(list(range(1, N + 1)), key=lambda x: A[x - 1]) idx = list(map(str, idx)) print((" ".join(idx)))
false
16.666667
[ "-N = int(input())", "-A = {i + 1: a for i, a in enumerate(input().split())}", "-sort_A = sorted(A.items(), key=lambda x: int(x[1]))", "-for i, a in sort_A:", "- print(i, end=\" \")", "+N = int(eval(input()))", "+A = list(map(int, input().split()))", "+idx = sorted(list(range(1, N + 1)), key=lambda...
false
0.036462
0.055342
0.658849
[ "s659535694", "s699426867" ]
u036104576
p03286
python
s713185658
s713472222
33
28
9,476
9,172
Accepted
Accepted
15.15
import sys import itertools # import numpy as np import time import math import heapq from collections import defaultdict sys.setrecursionlimit(10 ** 7) INF = 10 ** 18 MOD = 10 ** 9 + 7 read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines # map(int, ...
N = int(eval(input())) if N == 0: print('0') exit() ans = '' while abs(N) > 0: if abs(N) % 2 == 0: ans += '0' N //= 2 else: N -= 1 N //= 2 ans += '1' N *= -1 print((ans[::-1]))
38
16
638
245
import sys import itertools # import numpy as np import time import math import heapq from collections import defaultdict sys.setrecursionlimit(10**7) INF = 10**18 MOD = 10**9 + 7 read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines # map(int, input().split()) N = i...
N = int(eval(input())) if N == 0: print("0") exit() ans = "" while abs(N) > 0: if abs(N) % 2 == 0: ans += "0" N //= 2 else: N -= 1 N //= 2 ans += "1" N *= -1 print((ans[::-1]))
false
57.894737
[ "-import sys", "-import itertools", "-", "-# import numpy as np", "-import time", "-import math", "-import heapq", "-from collections import defaultdict", "-", "-sys.setrecursionlimit(10**7)", "-INF = 10**18", "-MOD = 10**9 + 7", "-read = sys.stdin.buffer.read", "-readline = sys.stdin.buff...
false
0.041249
0.03617
1.140406
[ "s713185658", "s713472222" ]
u562935282
p02837
python
s057153710
s918027483
188
83
3,064
3,064
Accepted
Accepted
55.85
n = int(eval(input())) e = [[] for _ in range(n)] for i in range(n): a = int(eval(input())) for _ in range(a): x, y = list(map(int, input().split())) x -= 1 e[i].append((x, y)) ret = 0 for mask in range(1 << n): t = [(mask >> i) & 1 for i in range(n)] flg = True ...
def main(): from itertools import product N = int(eval(input())) g = [] for _ in range(N): a = int(eval(input())) t = [] for _ in range(a): x, y = list(map(int, input().split())) x -= 1 t.append((x, y)) g.append(t) ...
27
35
572
743
n = int(eval(input())) e = [[] for _ in range(n)] for i in range(n): a = int(eval(input())) for _ in range(a): x, y = list(map(int, input().split())) x -= 1 e[i].append((x, y)) ret = 0 for mask in range(1 << n): t = [(mask >> i) & 1 for i in range(n)] flg = True for i in rang...
def main(): from itertools import product N = int(eval(input())) g = [] for _ in range(N): a = int(eval(input())) t = [] for _ in range(a): x, y = list(map(int, input().split())) x -= 1 t.append((x, y)) g.append(t) def is_ok(prd):...
false
22.857143
[ "-n = int(eval(input()))", "-e = [[] for _ in range(n)]", "-for i in range(n):", "- a = int(eval(input()))", "- for _ in range(a):", "- x, y = list(map(int, input().split()))", "- x -= 1", "- e[i].append((x, y))", "-ret = 0", "-for mask in range(1 << n):", "- t = [(...
false
0.00744
0.043136
0.172471
[ "s057153710", "s918027483" ]
u623231048
p03354
python
s713530992
s442586872
733
607
122,456
119,392
Accepted
Accepted
17.19
import sys input = sys.stdin.readline def main(): n,m = list(map(int,input().split())) p = list(map(int,input().split())) xy = [list(map(int,input().split())) for _ in range(m)] class UnionFind(object): def __init__(self, n=1): self.par = [i for i in range(n)] ...
import sys input = sys.stdin.readline def main(): n,m = list(map(int,input().split())) p = list(map(int,input().split())) xy = [list(map(int,input().split())) for _ in range(m)] class UnionFind(): def __init__(self, n): self.n = n self.parents = [-1] * n ...
52
72
1,462
1,916
import sys input = sys.stdin.readline def main(): n, m = list(map(int, input().split())) p = list(map(int, input().split())) xy = [list(map(int, input().split())) for _ in range(m)] class UnionFind(object): def __init__(self, n=1): self.par = [i for i in range(n)] sel...
import sys input = sys.stdin.readline def main(): n, m = list(map(int, input().split())) p = list(map(int, input().split())) xy = [list(map(int, input().split())) for _ in range(m)] class UnionFind: def __init__(self, n): self.n = n self.parents = [-1] * n de...
false
27.777778
[ "- class UnionFind(object):", "- def __init__(self, n=1):", "- self.par = [i for i in range(n)]", "- self.rank = [0 for _ in range(n)]", "- self.size = [1 for _ in range(n)]", "+ class UnionFind:", "+ def __init__(self, n):", "+ self.n = ...
false
0.04442
0.045335
0.979804
[ "s713530992", "s442586872" ]
u163320134
p02758
python
s615427064
s538508918
1,916
1,757
110,168
109,144
Accepted
Accepted
8.3
class SegmentTreeMax(): def __init__(self,n,init): self.offset=2**((n-1).bit_length()) self.tree=[init]*(2*self.offset) self.init=init def update(self,pos,val): pos+=self.offset self.tree[pos]=val while pos>1: pos=pos//2 self.tree[pos]=max(self.tree[2*pos],self.tree[2*p...
class SegmentTreeMax(): def __init__(self,n,init): self.offset=2**((n-1).bit_length()) self.tree=[init]*(2*self.offset) self.init=init def update(self,pos,val): pos+=self.offset self.tree[pos]=val while pos>1: pos=pos//2 self.tree[pos]=max(self.tree[2*pos],self.tree[2*p...
50
50
1,104
1,110
class SegmentTreeMax: def __init__(self, n, init): self.offset = 2 ** ((n - 1).bit_length()) self.tree = [init] * (2 * self.offset) self.init = init def update(self, pos, val): pos += self.offset self.tree[pos] = val while pos > 1: pos = pos // 2 ...
class SegmentTreeMax: def __init__(self, n, init): self.offset = 2 ** ((n - 1).bit_length()) self.tree = [init] * (2 * self.offset) self.init = init def update(self, pos, val): pos += self.offset self.tree[pos] = val while pos > 1: pos = pos // 2 ...
false
0
[ "- ranges.append(l)", "- st.update(i, r)", "+ ranges.append(r - 1)", "+ st.update(i, r - 1)", "- j = ranges[i]", "+ j = ranges[i] + 1" ]
false
0.049199
0.050227
0.97953
[ "s615427064", "s538508918" ]
u318233626
p02678
python
s610625074
s111543132
900
788
39,852
34,868
Accepted
Accepted
12.44
from collections import deque n, m = list(map(int, input().split())) M = [[] for i in range(n)] for i in range(m): a, b = list(map(int, input().split())) a, b = a - 1, b - 1 M[a].append(b) M[b].append(a) #print(M) R = [-1 for i in range(n)] Q = deque([(0, -2)]) while len(Q) > 0: t = Q[...
from collections import deque n, m = list(map(int, input().split())) TO = [[] for i in range(n)] #隣接リスト adjacency list for i in range(m): a, b = list(map(int, input().split())) a, b = a - 1, b -1 TO[a].append(b) TO[b].append(a) #BFS #変数定義 Q = deque([]) DIST = [-1 for i in range(n)] PRE = [...
43
32
816
674
from collections import deque n, m = list(map(int, input().split())) M = [[] for i in range(n)] for i in range(m): a, b = list(map(int, input().split())) a, b = a - 1, b - 1 M[a].append(b) M[b].append(a) # print(M) R = [-1 for i in range(n)] Q = deque([(0, -2)]) while len(Q) > 0: t = Q[0][0] b ...
from collections import deque n, m = list(map(int, input().split())) TO = [[] for i in range(n)] # 隣接リスト adjacency list for i in range(m): a, b = list(map(int, input().split())) a, b = a - 1, b - 1 TO[a].append(b) TO[b].append(a) # BFS # 変数定義 Q = deque([]) DIST = [-1 for i in range(n)] PRE = [-1 for i...
false
25.581395
[ "-M = [[] for i in range(n)]", "+TO = [[] for i in range(n)] # 隣接リスト adjacency list", "- M[a].append(b)", "- M[b].append(a)", "-# print(M)", "-R = [-1 for i in range(n)]", "-Q = deque([(0, -2)])", "+ TO[a].append(b)", "+ TO[b].append(a)", "+# BFS", "+# 変数定義", "+Q = deque([])", "...
false
0.049223
0.047259
1.04155
[ "s610625074", "s111543132" ]
u718706790
p02778
python
s275998738
s247720865
19
17
3,188
2,940
Accepted
Accepted
10.53
import re s = eval(input()) print((re.sub('[a-z]', 'x', s)))
print(('x' * len(eval(input()))))
4
1
56
25
import re s = eval(input()) print((re.sub("[a-z]", "x", s)))
print(("x" * len(eval(input()))))
false
75
[ "-import re", "-", "-s = eval(input())", "-print((re.sub(\"[a-z]\", \"x\", s)))", "+print((\"x\" * len(eval(input()))))" ]
false
0.074706
0.066991
1.115157
[ "s275998738", "s247720865" ]
u644907318
p03860
python
s174206683
s008725274
168
27
38,384
9,036
Accepted
Accepted
83.93
_,s,_ = input().split() print(("A"+s[0]+"C"))
S = input().split() print(("A"+S[1][0]+"C"))
2
2
45
43
_, s, _ = input().split() print(("A" + s[0] + "C"))
S = input().split() print(("A" + S[1][0] + "C"))
false
0
[ "-_, s, _ = input().split()", "-print((\"A\" + s[0] + \"C\"))", "+S = input().split()", "+print((\"A\" + S[1][0] + \"C\"))" ]
false
0.045837
0.086137
0.532139
[ "s174206683", "s008725274" ]
u750990077
p02660
python
s348082577
s991565045
96
70
9,344
65,764
Accepted
Accepted
27.08
from collections import Counter def get_prime_factors(x): out = [] if x < 1: return out while not x%2: out.append(2) x //= 2 i = 3 while i*i <= x: if not x%i: out.append(i) x //= i else: i += 2 if x != 1...
from collections import Counter def get_prime_factors(x): out = [] if x < 1: return out while not x%2: out.append(2) x //= 2 i = 3 while i*i <= x: if not x%i: out.append(i) x //= i else: i += 2 if x != 1...
35
35
661
663
from collections import Counter def get_prime_factors(x): out = [] if x < 1: return out while not x % 2: out.append(2) x //= 2 i = 3 while i * i <= x: if not x % i: out.append(i) x //= i else: i += 2 if x != 1: ...
from collections import Counter def get_prime_factors(x): out = [] if x < 1: return out while not x % 2: out.append(2) x //= 2 i = 3 while i * i <= x: if not x % i: out.append(i) x //= i else: i += 2 if x != 1: ...
false
0
[ "- for prime, num in list(primes.items()):", "- i = 1", "- while num >= i:", "+ for k, v in list(primes.items()):", "+ num = 1", "+ while v >= num:", "+ v -= num", "- num -= i", "- i += 1", "+ num += 1" ]
false
0.006902
0.042413
0.162725
[ "s348082577", "s991565045" ]
u078349616
p02660
python
s419628713
s621576092
342
270
9,292
9,144
Accepted
Accepted
21.05
N = int(eval(input())) def prime_factorize(n): if n == 1: return [] ans = [] tmp = n i = 2 while pow(i, 2) <= n: if tmp % i == 0: cnt = 0 while tmp % i == 0: cnt += 1 tmp /= i ans.append([i, cnt]) ...
N = int(eval(input())) i = 2 tmp = N ans = 0 while i*i <= N: cnt = 0 while tmp % i == 0: tmp //= i cnt += 1 if cnt > 0: k = 1 while cnt - k >= 0: cnt -= k ans += 1 k += 1 i += 1 if tmp != 1: ans += 1 print(an...
32
22
600
316
N = int(eval(input())) def prime_factorize(n): if n == 1: return [] ans = [] tmp = n i = 2 while pow(i, 2) <= n: if tmp % i == 0: cnt = 0 while tmp % i == 0: cnt += 1 tmp /= i ans.append([i, cnt]) i += 1 ...
N = int(eval(input())) i = 2 tmp = N ans = 0 while i * i <= N: cnt = 0 while tmp % i == 0: tmp //= i cnt += 1 if cnt > 0: k = 1 while cnt - k >= 0: cnt -= k ans += 1 k += 1 i += 1 if tmp != 1: ans += 1 print(ans)
false
31.25
[ "-", "-", "-def prime_factorize(n):", "- if n == 1:", "- return []", "- ans = []", "- tmp = n", "- i = 2", "- while pow(i, 2) <= n:", "- if tmp % i == 0:", "- cnt = 0", "- while tmp % i == 0:", "- cnt += 1", "- ...
false
0.134015
0.422639
0.31709
[ "s419628713", "s621576092" ]
u595289165
p02899
python
s812170671
s319065241
120
108
13,880
13,812
Accepted
Accepted
10
n = int(eval(input())) a = list(map(int, input().split())) ans = [0 for i in range(n)] for i, name in enumerate(a): ans[name-1] = i+1 print((*ans))
n = int(eval(input())) a = list(map(int, input().split())) ans = [0 for i in range(n)] for i in reversed(list(range(1,n+1))): ans[a.pop()-1] = i print((*ans))
7
7
151
160
n = int(eval(input())) a = list(map(int, input().split())) ans = [0 for i in range(n)] for i, name in enumerate(a): ans[name - 1] = i + 1 print((*ans))
n = int(eval(input())) a = list(map(int, input().split())) ans = [0 for i in range(n)] for i in reversed(list(range(1, n + 1))): ans[a.pop() - 1] = i print((*ans))
false
0
[ "-for i, name in enumerate(a):", "- ans[name - 1] = i + 1", "+for i in reversed(list(range(1, n + 1))):", "+ ans[a.pop() - 1] = i" ]
false
0.075182
0.052058
1.444191
[ "s812170671", "s319065241" ]
u506858457
p03617
python
s158144083
s222845804
29
25
9,184
9,072
Accepted
Accepted
13.79
Q,H,S,D=list(map(int,input().split())) N=int(eval(input())) Min1=min(4*Q,2*H,S) Min2=min(2*Min1,D) Even=N//2 Odd=N%2 ans=Even*Min2+Odd*Min1 print(ans)
Q,H,S,D=list(map(int,input().split())) N=int(eval(input())) N2,N1=divmod(N,2) tmp2=min(8*Q,4*H,2*S,D) tmp1=min(4*Q,2*H,S) ans2=N2*tmp2 ans1=N1*tmp1 ans=ans1+ans2 print(ans)
8
9
145
169
Q, H, S, D = list(map(int, input().split())) N = int(eval(input())) Min1 = min(4 * Q, 2 * H, S) Min2 = min(2 * Min1, D) Even = N // 2 Odd = N % 2 ans = Even * Min2 + Odd * Min1 print(ans)
Q, H, S, D = list(map(int, input().split())) N = int(eval(input())) N2, N1 = divmod(N, 2) tmp2 = min(8 * Q, 4 * H, 2 * S, D) tmp1 = min(4 * Q, 2 * H, S) ans2 = N2 * tmp2 ans1 = N1 * tmp1 ans = ans1 + ans2 print(ans)
false
11.111111
[ "-Min1 = min(4 * Q, 2 * H, S)", "-Min2 = min(2 * Min1, D)", "-Even = N // 2", "-Odd = N % 2", "-ans = Even * Min2 + Odd * Min1", "+N2, N1 = divmod(N, 2)", "+tmp2 = min(8 * Q, 4 * H, 2 * S, D)", "+tmp1 = min(4 * Q, 2 * H, S)", "+ans2 = N2 * tmp2", "+ans1 = N1 * tmp1", "+ans = ans1 + ans2" ]
false
0.039254
0.035591
1.102931
[ "s158144083", "s222845804" ]
u648868410
p02599
python
s089171240
s146233050
1,948
1,391
170,688
85,636
Accepted
Accepted
28.59
import sys import numpy as np # from numba import njit#,i8 #@njit(cache=True) # @jit(返り値の型(引数1の型,引数2の型,...,引数nの型)) #@jit(i8[:](i8,i8,i8[:],i8[:,:],i8[:],i8[:],i8[:])) def main(N,Q,C,queries,orderByR,mostRightColorIndex,bitArray): def add(itemCount, items, i, value): while i <= itemCount: items[i] += ...
import sys import numpy as np # from numba import njit#,i8 #@njit(cache=True) # @jit(返り値の型(引数1の型,引数2の型,...,引数nの型)) #@jit(i8[:](i8,i8,i8[:],i8[:,:],i8[:],i8[:],i8[:])) def main(N,Q,C,queries,orderByR,mostRightColorIndex,bitArray): def add(itemCount, items, i, value): while i <= itemCount: items[i] += ...
101
101
2,537
2,538
import sys import numpy as np # from numba import njit#,i8 # @njit(cache=True) # @jit(返り値の型(引数1の型,引数2の型,...,引数nの型)) # @jit(i8[:](i8,i8,i8[:],i8[:,:],i8[:],i8[:],i8[:])) def main(N, Q, C, queries, orderByR, mostRightColorIndex, bitArray): def add(itemCount, items, i, value): while i <= itemCount: ...
import sys import numpy as np # from numba import njit#,i8 # @njit(cache=True) # @jit(返り値の型(引数1の型,引数2の型,...,引数nの型)) # @jit(i8[:](i8,i8,i8[:],i8[:,:],i8[:],i8[:],i8[:])) def main(N, Q, C, queries, orderByR, mostRightColorIndex, bitArray): def add(itemCount, items, i, value): while i <= itemCount: ...
false
0
[ "-# from my_module import main", "-from numba import njit", "+from my_module import main", "-main = njit(\"i8[:](i8,i8,i8[:],i8[:,:],i8[:],i8[:],i8[:])\", cache=True)(main)", "-", "-", "+# from numba import njit", "+# main=njit('i8[:](i8,i8,i8[:],i8[:,:],i8[:],i8[:],i8[:])', cache=True)(main)" ]
false
0.247766
0.235354
1.052735
[ "s089171240", "s146233050" ]
u994988729
p03112
python
s918960526
s726622482
1,177
956
18,536
21,780
Accepted
Accepted
18.78
import bisect a,b,q=map(int,input().split()) tem=[-10**18]+[int(input()) for _ in range(a)]+[10**18] shr=[-10**18]+[int(input()) for _ in range(b)]+[10**18] ans=[] for _ in range(q): x=int(input()) t=bisect.bisect_right(tem, x) s=bisect.bisect_right(shr, x) dt=[tem[t-1], tem[t]] ds=[sh...
import sys import bisect input = sys.stdin.readline A, B, Q = map(int, input().split()) tera = [int(input()) for _ in range(A)] sha = [int(input()) for _ in range(B)] query = [int(input()) for _ in range(Q)] res = [] for x in query: tl = bisect.bisect_left(tera, x) tr = bisect.bisect_right(tera, x...
25
43
550
1,049
import bisect a, b, q = map(int, input().split()) tem = [-(10**18)] + [int(input()) for _ in range(a)] + [10**18] shr = [-(10**18)] + [int(input()) for _ in range(b)] + [10**18] ans = [] for _ in range(q): x = int(input()) t = bisect.bisect_right(tem, x) s = bisect.bisect_right(shr, x) dt = [tem[t - 1]...
import sys import bisect input = sys.stdin.readline A, B, Q = map(int, input().split()) tera = [int(input()) for _ in range(A)] sha = [int(input()) for _ in range(B)] query = [int(input()) for _ in range(Q)] res = [] for x in query: tl = bisect.bisect_left(tera, x) tr = bisect.bisect_right(tera, x) sl = bi...
false
41.860465
[ "+import sys", "-a, b, q = map(int, input().split())", "-tem = [-(10**18)] + [int(input()) for _ in range(a)] + [10**18]", "-shr = [-(10**18)] + [int(input()) for _ in range(b)] + [10**18]", "-ans = []", "-for _ in range(q):", "- x = int(input())", "- t = bisect.bisect_right(tem, x)", "- s ...
false
0.03622
0.092938
0.389719
[ "s918960526", "s726622482" ]
u691018832
p02689
python
s101495408
s192594335
212
136
32,440
90,296
Accepted
Accepted
35.85
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) n, m = list(map(int, readline().split())) h = list(map(int, readline().split())) ab = [list(map(int, readline().split())) for _ in range(m)] memo = [True] * n for...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) n, m = list(map(int, readline().split())) h = [0] + list(map(int, readline().split())) ab = [list(map(int, readline().split())) for _ in range(m)] check = [True] *...
19
19
539
529
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10**7) n, m = list(map(int, readline().split())) h = list(map(int, readline().split())) ab = [list(map(int, readline().split())) for _ in range(m)] memo = [True] * n for a, b in ab:...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10**7) n, m = list(map(int, readline().split())) h = [0] + list(map(int, readline().split())) ab = [list(map(int, readline().split())) for _ in range(m)] check = [True] * (n + 1) fo...
false
0
[ "-h = list(map(int, readline().split()))", "+h = [0] + list(map(int, readline().split()))", "-memo = [True] * n", "+check = [True] * (n + 1)", "- if h[a - 1] > h[b - 1]:", "- memo[b - 1] = False", "- elif h[a - 1] < h[b - 1]:", "- memo[a - 1] = False", "+ if h[a] > h[b]:", "...
false
0.036459
0.071223
0.511891
[ "s101495408", "s192594335" ]
u433380437
p02754
python
s690526563
s212140818
63
31
62,184
9,112
Accepted
Accepted
50.79
# ABC158 B - Count Balls M,A,B = list(map(int,input().split())) import math C = math.floor(M/(A+B)) N = M%(A+B) E = C*A A_A = 0 B_B = 0 for i in range(N): if N >= A: A_A +=A N -=A else: A_A +=N break if N >= B: B_B +=B N -=B else: ...
# ABC158 B - Count Balls M,A,B = list(map(int,input().split())) import math C = math.floor(M/(A+B)) N = M%(A+B) E = C*A if N >= A: E+=A else: E+=N print(E)
24
15
361
192
# ABC158 B - Count Balls M, A, B = list(map(int, input().split())) import math C = math.floor(M / (A + B)) N = M % (A + B) E = C * A A_A = 0 B_B = 0 for i in range(N): if N >= A: A_A += A N -= A else: A_A += N break if N >= B: B_B += B N -= B else: ...
# ABC158 B - Count Balls M, A, B = list(map(int, input().split())) import math C = math.floor(M / (A + B)) N = M % (A + B) E = C * A if N >= A: E += A else: E += N print(E)
false
37.5
[ "-A_A = 0", "-B_B = 0", "-for i in range(N):", "- if N >= A:", "- A_A += A", "- N -= A", "- else:", "- A_A += N", "- break", "- if N >= B:", "- B_B += B", "- N -= B", "- else:", "- B_B += N", "- break", "-print((A_A + ...
false
0.079008
0.056497
1.39845
[ "s690526563", "s212140818" ]
u509674552
p03346
python
s694449017
s656457478
472
244
18,924
18,924
Accepted
Accepted
48.31
n = int(eval(input())) p = [int(eval(input())) for i in range(n)] a = [0] * n for i in range(n): a[p[i]-1] = i prv = -1 mx = 1 nw = 0 for i in range(n): if prv < a[i]: nw += 1 mx = max(mx, nw) else: nw = 1 prv = a[i] print((n-mx))
import sys n = int(sys.stdin.readline()) p = [int(sys.stdin.readline()) for i in range(n)] a = [0] * n for i in range(n): a[p[i]-1] = i prv = -1 mx = 1 nw = 0 for i in range(n): if prv < a[i]: nw += 1 mx = max(mx, nw) else: nw = 1 prv = a[i] print((n-mx))
16
18
272
312
n = int(eval(input())) p = [int(eval(input())) for i in range(n)] a = [0] * n for i in range(n): a[p[i] - 1] = i prv = -1 mx = 1 nw = 0 for i in range(n): if prv < a[i]: nw += 1 mx = max(mx, nw) else: nw = 1 prv = a[i] print((n - mx))
import sys n = int(sys.stdin.readline()) p = [int(sys.stdin.readline()) for i in range(n)] a = [0] * n for i in range(n): a[p[i] - 1] = i prv = -1 mx = 1 nw = 0 for i in range(n): if prv < a[i]: nw += 1 mx = max(mx, nw) else: nw = 1 prv = a[i] print((n - mx))
false
11.111111
[ "-n = int(eval(input()))", "-p = [int(eval(input())) for i in range(n)]", "+import sys", "+", "+n = int(sys.stdin.readline())", "+p = [int(sys.stdin.readline()) for i in range(n)]" ]
false
0.076851
0.074875
1.026394
[ "s694449017", "s656457478" ]
u576917603
p03545
python
s641728512
s907896270
22
17
3,444
3,064
Accepted
Accepted
22.73
a=list(eval(input())) import copy for i in range(2**3): b=[] c=copy.deepcopy(a) for j in range(3): if (i>>j)&1: b.append("+") else: b.append('-') c.insert(1,b[0]) c.insert(3,b[1]) c.insert(5,b[2]) c=''.join(c) if eval(c)==7: ...
a=list(eval(input())) for i in range(2**3): status=[0]*3 s="" for j in range(3): if ((i>>j)&1): status[j]="+" else: status[j]="-" for x,y in zip(a,status): s+=x s+=y s+=a[-1] if eval(s)==7: print((s+"=7")) e...
17
17
343
317
a = list(eval(input())) import copy for i in range(2**3): b = [] c = copy.deepcopy(a) for j in range(3): if (i >> j) & 1: b.append("+") else: b.append("-") c.insert(1, b[0]) c.insert(3, b[1]) c.insert(5, b[2]) c = "".join(c) if eval(c) == 7: ...
a = list(eval(input())) for i in range(2**3): status = [0] * 3 s = "" for j in range(3): if (i >> j) & 1: status[j] = "+" else: status[j] = "-" for x, y in zip(a, status): s += x s += y s += a[-1] if eval(s) == 7: print((s + "=7")) ...
false
0
[ "-import copy", "-", "- b = []", "- c = copy.deepcopy(a)", "+ status = [0] * 3", "+ s = \"\"", "- b.append(\"+\")", "+ status[j] = \"+\"", "- b.append(\"-\")", "- c.insert(1, b[0])", "- c.insert(3, b[1])", "- c.insert(5, b[2])", "- c =...
false
0.048275
0.086507
0.558051
[ "s641728512", "s907896270" ]
u773265208
p02862
python
s953248889
s738933591
1,242
760
44,148
44,048
Accepted
Accepted
38.81
import sys def cmb(n, r): if n - r < r: r = n - r if r == 0: return 1 if r == 1: return n numerator = [n - r + k + 1 for k in range(r)] denominator = [k + 1 for k in range(r)] for p in range(2,r+1): pivot = denominator[p - 1] if pivot > 1: offset = (n ...
import math import sys def cmb(n, r): if n - r < r: r = n - r if r == 0: return 1 if r == 1: return n numerator = [n - r + k + 1 for k in range(r)] denominator = [k + 1 for k in range(r)] for p in range(2,r+1): pivot = denominator[p - 1] if pivot > 1: offset = (n - r) % p for k in rang...
44
54
859
1,022
import sys def cmb(n, r): if n - r < r: r = n - r if r == 0: return 1 if r == 1: return n numerator = [n - r + k + 1 for k in range(r)] denominator = [k + 1 for k in range(r)] for p in range(2, r + 1): pivot = denominator[p - 1] if pivot > 1: ...
import math import sys def cmb(n, r): if n - r < r: r = n - r if r == 0: return 1 if r == 1: return n numerator = [n - r + k + 1 for k in range(r)] denominator = [k + 1 for k in range(r)] for p in range(2, r + 1): pivot = denominator[p - 1] if pivot > 1:...
false
18.518519
[ "+import math", "+ result %= MOD", "+min_xy = min(x, y)", "+max_xy = max(x, y)", "-MAX = max(x, y)", "-MIN = min(x, y)", "-if (2 * MAX - MIN) % 3 != 0 or MAX / MIN > 2:", "+if max_xy / min_xy == 2.0:", "+ print((1))", "+ sys.exit()", "+if max_xy / min_xy > 2.0:", "-c1 = (2 * M...
false
0.245495
0.572093
0.429118
[ "s953248889", "s738933591" ]
u232852711
p03354
python
s663825150
s561962366
618
531
39,044
14,324
Accepted
Accepted
14.08
from collections import deque n, m = list(map(int, input().split())) p = list(map(int, input().split())) paths = {} for _ in range(m): x, y = list(map(int, input().split())) if not x in list(paths.keys()): paths[x] = [y] else: paths[x].append(y) if not y in list(paths.keys()): ...
from collections import deque n, m = list(map(int, input().split())) p = list(map(int, input().split())) par = list(range(n+1)) def find(x): p_ = par[x] if p_ == x: return x a = find(p_) par[x] = a return a for _ in range(m): x, y = list(map(int, input().split())) bx...
43
24
1,024
466
from collections import deque n, m = list(map(int, input().split())) p = list(map(int, input().split())) paths = {} for _ in range(m): x, y = list(map(int, input().split())) if not x in list(paths.keys()): paths[x] = [y] else: paths[x].append(y) if not y in list(paths.keys()): p...
from collections import deque n, m = list(map(int, input().split())) p = list(map(int, input().split())) par = list(range(n + 1)) def find(x): p_ = par[x] if p_ == x: return x a = find(p_) par[x] = a return a for _ in range(m): x, y = list(map(int, input().split())) bx, by = fin...
false
44.186047
[ "-paths = {}", "+par = list(range(n + 1))", "+", "+", "+def find(x):", "+ p_ = par[x]", "+ if p_ == x:", "+ return x", "+ a = find(p_)", "+ par[x] = a", "+ return a", "+", "+", "- if not x in list(paths.keys()):", "- paths[x] = [y]", "- else:", "- ...
false
0.049891
0.049989
0.998042
[ "s663825150", "s561962366" ]
u075532540
p02947
python
s712137740
s500643816
472
372
24,652
10,640
Accepted
Accepted
21.19
def main(): n = int(eval(input())) sl=[] for i in range(n): sl.append(list(eval(input()))) for s in sl: s.sort() sl.sort() b=sl[0] l=1 ans=0 for i in range(1,n): if sl[i]==b: l+=1 if i==n-1 and l >1: ans+=l*(l-1)/2 else: if l>1: ans+=l*(l-1)/2 b=sl[i] l=...
def main(): n = int(eval(input())) sl=[] sl=["".join(sorted(eval(input()))) for _ in range(n)] sl.sort() b=sl[0] l=1 ans=0 for i in range(1,n): if sl[i]==b: l+=1 if i==n-1 and l >1: ans+=l*(l-1)/2 else: if l>1: ans+=l*(l-1)/2 b=sl[i] l=1 print((int(ans))) main()
26
21
339
307
def main(): n = int(eval(input())) sl = [] for i in range(n): sl.append(list(eval(input()))) for s in sl: s.sort() sl.sort() b = sl[0] l = 1 ans = 0 for i in range(1, n): if sl[i] == b: l += 1 if i == n - 1 and l > 1: an...
def main(): n = int(eval(input())) sl = [] sl = ["".join(sorted(eval(input()))) for _ in range(n)] sl.sort() b = sl[0] l = 1 ans = 0 for i in range(1, n): if sl[i] == b: l += 1 if i == n - 1 and l > 1: ans += l * (l - 1) / 2 else: ...
false
19.230769
[ "- for i in range(n):", "- sl.append(list(eval(input())))", "- for s in sl:", "- s.sort()", "+ sl = [\"\".join(sorted(eval(input()))) for _ in range(n)]" ]
false
0.106243
0.145774
0.728821
[ "s712137740", "s500643816" ]
u977389981
p04043
python
s155492575
s411022864
18
16
2,940
2,940
Accepted
Accepted
11.11
A = sorted([int(i) for i in input().split()]) print(('YES' if A == [5, 5, 7] else 'NO'))
A = sorted(input().split()) print(('YES' if A == ['5', '5', '7'] else 'NO'))
2
2
87
75
A = sorted([int(i) for i in input().split()]) print(("YES" if A == [5, 5, 7] else "NO"))
A = sorted(input().split()) print(("YES" if A == ["5", "5", "7"] else "NO"))
false
0
[ "-A = sorted([int(i) for i in input().split()])", "-print((\"YES\" if A == [5, 5, 7] else \"NO\"))", "+A = sorted(input().split())", "+print((\"YES\" if A == [\"5\", \"5\", \"7\"] else \"NO\"))" ]
false
0.045686
0.038177
1.196682
[ "s155492575", "s411022864" ]
u626337957
p02971
python
s995402357
s692324577
729
547
15,636
22,048
Accepted
Accepted
24.97
N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] L = [0] * (N+1) R = [0] * (N+2) A.append(0) for i in range(1, N+1): if i == 1: L[1] = 0 R[N+1] = 0 L[i] = max(L[i-1], A[i-2]) R[N-i+1] = max(R[N-i+2], A[N-i+1]) for i in range(1, N+1): print((max(L[i], R[...
N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] B = A.copy() B.sort(key=lambda x:-x) last = B[0] second = B[1] for num in A: if num != last: print(last) else: print(second)
16
14
311
207
N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] L = [0] * (N + 1) R = [0] * (N + 2) A.append(0) for i in range(1, N + 1): if i == 1: L[1] = 0 R[N + 1] = 0 L[i] = max(L[i - 1], A[i - 2]) R[N - i + 1] = max(R[N - i + 2], A[N - i + 1]) for i in range(1, N + 1): print((max(...
N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] B = A.copy() B.sort(key=lambda x: -x) last = B[0] second = B[1] for num in A: if num != last: print(last) else: print(second)
false
12.5
[ "-L = [0] * (N + 1)", "-R = [0] * (N + 2)", "-A.append(0)", "-for i in range(1, N + 1):", "- if i == 1:", "- L[1] = 0", "- R[N + 1] = 0", "- L[i] = max(L[i - 1], A[i - 2])", "- R[N - i + 1] = max(R[N - i + 2], A[N - i + 1])", "-for i in range(1, N + 1):", "- print((max(...
false
0.068495
0.040225
1.702784
[ "s995402357", "s692324577" ]
u712284046
p02721
python
s944508633
s837579347
380
349
22,688
19,800
Accepted
Accepted
8.16
from collections import deque N, K, C = list(map(int, input().split())) S = eval(input()) fastest = deque([]) latest = deque([]) date = 1 for work_days in range(K): while S[date - 1] == 'x': date += 1 fastest.append(date) date += C + 1 date = 1 for work_days in range(K): ...
from collections import deque N, K, C = list(map(int, input().split())) S = eval(input()) fastest = deque([]) latest = deque([]) date = 1 for work_days in range(K): while S[date - 1] == 'x': date += 1 fastest.append(date) date += C + 1 date = 1 for work_days in range(K): ...
30
29
545
510
from collections import deque N, K, C = list(map(int, input().split())) S = eval(input()) fastest = deque([]) latest = deque([]) date = 1 for work_days in range(K): while S[date - 1] == "x": date += 1 fastest.append(date) date += C + 1 date = 1 for work_days in range(K): while S[-date] == "x": ...
from collections import deque N, K, C = list(map(int, input().split())) S = eval(input()) fastest = deque([]) latest = deque([]) date = 1 for work_days in range(K): while S[date - 1] == "x": date += 1 fastest.append(date) date += C + 1 date = 1 for work_days in range(K): while S[-date] == "x": ...
false
3.333333
[ "-fastest = list(fastest)", "-latest = list(latest)", "- if fastest[i] == latest[-(i + 1)]:", "- print((fastest[i]))", "+ f = fastest.popleft()", "+ l = latest.pop()", "+ if f == l:", "+ print(f)" ]
false
0.037269
0.037647
0.98996
[ "s944508633", "s837579347" ]
u852690916
p02882
python
s136799314
s198789907
182
66
38,384
62,384
Accepted
Accepted
63.74
import sys from math import atan,pi def main(): input = sys.stdin.readline a,b,x =list(map(int, input().split())) x /= a t = 0 if 2*x < a * b: t = atan(b*b/2/x) elif 2*x > a * b: t = atan((2*a*b-2*x)/a/a) else: t = pi/4 ans = t * 180 / pi print(a...
from math import atan, pi a, b, x = list(map(int, input().split())) if a * a * b > 2 * x: ans = atan(a * b * b / 2 / x) else: ans = atan((2 * a * a * b - 2 * x) / a / a / a) ans *= 180 / pi print(ans)
19
10
361
214
import sys from math import atan, pi def main(): input = sys.stdin.readline a, b, x = list(map(int, input().split())) x /= a t = 0 if 2 * x < a * b: t = atan(b * b / 2 / x) elif 2 * x > a * b: t = atan((2 * a * b - 2 * x) / a / a) else: t = pi / 4 ans = t * 180 ...
from math import atan, pi a, b, x = list(map(int, input().split())) if a * a * b > 2 * x: ans = atan(a * b * b / 2 / x) else: ans = atan((2 * a * a * b - 2 * x) / a / a / a) ans *= 180 / pi print(ans)
false
47.368421
[ "-import sys", "-", "-def main():", "- input = sys.stdin.readline", "- a, b, x = list(map(int, input().split()))", "- x /= a", "- t = 0", "- if 2 * x < a * b:", "- t = atan(b * b / 2 / x)", "- elif 2 * x > a * b:", "- t = atan((2 * a * b - 2 * x) / a / a)", "- ...
false
0.03755
0.03739
1.004285
[ "s136799314", "s198789907" ]
u580697892
p03031
python
s729556373
s030036325
53
44
3,064
3,064
Accepted
Accepted
16.98
# coding: utf-8 N, M = list(map(int, input().split())) K, S = [], [] for i in range(M): tmp = list(map(int, input().split())) K.append(tmp[0]) S.append(tmp[1:]) P = list(map(int, input().split())) ans = 0 for bit in range(2**N): lamp = 0 switch = [0] * N # インデックスに対応したランプがついてる(1, 0)...
# coding: utf-8 N, M = list(map(int, input().split())) S = [] for i in range(M): tmp = list(map(int, input().split())) S.append(tmp[1:]) P = list(map(int, input().split())) ans = 0 # print(S) for bit in range(2**N): l = [] for j in range(N): if bit >> j & 1 == 1: l.appen...
29
31
692
707
# coding: utf-8 N, M = list(map(int, input().split())) K, S = [], [] for i in range(M): tmp = list(map(int, input().split())) K.append(tmp[0]) S.append(tmp[1:]) P = list(map(int, input().split())) ans = 0 for bit in range(2**N): lamp = 0 switch = [0] * N # インデックスに対応したランプがついてる(1, 0)ように変換 for ...
# coding: utf-8 N, M = list(map(int, input().split())) S = [] for i in range(M): tmp = list(map(int, input().split())) S.append(tmp[1:]) P = list(map(int, input().split())) ans = 0 # print(S) for bit in range(2**N): l = [] for j in range(N): if bit >> j & 1 == 1: l.append(1) ...
false
6.451613
[ "-K, S = [], []", "+S = []", "- K.append(tmp[0])", "+# print(S)", "- lamp = 0", "- switch = [0] * N", "- # インデックスに対応したランプがついてる(1, 0)ように変換", "+ l = []", "- if (bit >> j) & 1 == 1:", "- switch[j] = 1", "- # 各電球ごとに確認", "- for i in range(M):", "+ if ...
false
0.037518
0.03758
0.998357
[ "s729556373", "s030036325" ]
u063052907
p03456
python
s470438521
s507302067
19
17
2,940
2,940
Accepted
Accepted
10.53
# coding: utf-8 import sys input = sys.stdin.readline N = int(input().replace(" ", "")) print(("Yes" if N**0.5 == int(N**0.5) else "No"))
# coding: utf-8 import sys input = sys.stdin.readline N = int(input().replace(" ", "")) print(("Yes" if (N**0.5).is_integer() else "No"))
6
6
142
142
# coding: utf-8 import sys input = sys.stdin.readline N = int(input().replace(" ", "")) print(("Yes" if N**0.5 == int(N**0.5) else "No"))
# coding: utf-8 import sys input = sys.stdin.readline N = int(input().replace(" ", "")) print(("Yes" if (N**0.5).is_integer() else "No"))
false
0
[ "-print((\"Yes\" if N**0.5 == int(N**0.5) else \"No\"))", "+print((\"Yes\" if (N**0.5).is_integer() else \"No\"))" ]
false
0.059936
0.0456
1.314384
[ "s470438521", "s507302067" ]
u315078622
p02917
python
s312430441
s966911338
170
32
38,256
8,996
Accepted
Accepted
81.18
N = int(eval(input())) B = [int(x) for x in input().split()] A = [10**5] * N for i, b in enumerate(B): A[i] = min(A[i], b) A[i+1] = min(A[i+1], b) print((sum(A)))
def main() -> None: N = int(eval(input())) B = [int(x) for x in input().split()] ans = B[0] + B[-1] for i in range(N - 2): ans += min(B[i], B[i+1]) print(ans) if __name__ == '__main__': main()
7
11
169
231
N = int(eval(input())) B = [int(x) for x in input().split()] A = [10**5] * N for i, b in enumerate(B): A[i] = min(A[i], b) A[i + 1] = min(A[i + 1], b) print((sum(A)))
def main() -> None: N = int(eval(input())) B = [int(x) for x in input().split()] ans = B[0] + B[-1] for i in range(N - 2): ans += min(B[i], B[i + 1]) print(ans) if __name__ == "__main__": main()
false
36.363636
[ "-N = int(eval(input()))", "-B = [int(x) for x in input().split()]", "-A = [10**5] * N", "-for i, b in enumerate(B):", "- A[i] = min(A[i], b)", "- A[i + 1] = min(A[i + 1], b)", "-print((sum(A)))", "+def main() -> None:", "+ N = int(eval(input()))", "+ B = [int(x) for x in input().split...
false
0.041216
0.041936
0.982845
[ "s312430441", "s966911338" ]
u094191970
p02844
python
s461431642
s534143973
467
22
3,648
3,188
Accepted
Accepted
95.29
n=int(eval(input())) #s=[int(x) for x in input()]+[i for i in range(10)]*3 s=[int(x) for x in eval(input())] cnt=0 for i in range(10): for j in range(10): for k in range(10): try: inx1=s.index(i) except: continue try: inx2=s[inx1+1:].index(j) + inx1 +1 except: continue t...
n=int(eval(input())) s=eval(input()) cnt=0 for i in range(1000): num=str(i).zfill(3) if num[0] in s: inx1=s.index(num[0]) s2=s[inx1+1:] if num[1] in s2: inx2=s2.index(num[1]) s3=s2[inx2+1:] if num[2] in s3: cnt+=1 print(cnt)
21
15
407
269
n = int(eval(input())) # s=[int(x) for x in input()]+[i for i in range(10)]*3 s = [int(x) for x in eval(input())] cnt = 0 for i in range(10): for j in range(10): for k in range(10): try: inx1 = s.index(i) except: continue try: ...
n = int(eval(input())) s = eval(input()) cnt = 0 for i in range(1000): num = str(i).zfill(3) if num[0] in s: inx1 = s.index(num[0]) s2 = s[inx1 + 1 :] if num[1] in s2: inx2 = s2.index(num[1]) s3 = s2[inx2 + 1 :] if num[2] in s3: cnt += ...
false
28.571429
[ "-# s=[int(x) for x in input()]+[i for i in range(10)]*3", "-s = [int(x) for x in eval(input())]", "+s = eval(input())", "-for i in range(10):", "- for j in range(10):", "- for k in range(10):", "- try:", "- inx1 = s.index(i)", "- except:", "- ...
false
0.042511
0.036168
1.175373
[ "s461431642", "s534143973" ]
u638282348
p03624
python
s858823013
s944636650
19
17
3,188
3,188
Accepted
Accepted
10.53
diff = set(chr(ord("a") + i) for i in range(26)) - set(input().rstrip("\n")) print(((list(sorted(diff))+["None"])[0]))
[print(un_appearence[0] if un_appearence else "None") for un_appearence in [[chr(i) for i in range(ord('a'), ord('z') + 1) if chr(i) not in string] for string in [input()]]]
3
1
119
174
diff = set(chr(ord("a") + i) for i in range(26)) - set(input().rstrip("\n")) print(((list(sorted(diff)) + ["None"])[0]))
[ print(un_appearence[0] if un_appearence else "None") for un_appearence in [ [chr(i) for i in range(ord("a"), ord("z") + 1) if chr(i) not in string] for string in [input()] ] ]
false
66.666667
[ "-diff = set(chr(ord(\"a\") + i) for i in range(26)) - set(input().rstrip(\"\\n\"))", "-print(((list(sorted(diff)) + [\"None\"])[0]))", "+[", "+ print(un_appearence[0] if un_appearence else \"None\")", "+ for un_appearence in [", "+ [chr(i) for i in range(ord(\"a\"), ord(\"z\") + 1) if chr(i)...
false
0.093764
0.050671
1.850472
[ "s858823013", "s944636650" ]
u145950990
p03044
python
s437144664
s937697881
877
745
82,592
55,304
Accepted
Accepted
15.05
n = int(eval(input())) d = [[] for i in range(n)] for i in range(n-1): u,v,w = list(map(int,input().split())) d[u-1].append([v-1,w]) d[v-1].append([u-1,w]) ans = [-1]*n ans[0]=0 q = [0] cnt = 0 while q: u = q.pop() for v,w in d[u]: if ans[v]==-1: if w%2==0: ...
n = int(eval(input())) d = [[] for i in range(n)] for i in range(n-1): u,v,w = list(map(int,input().split())) d[u-1].append([v-1,w]) d[v-1].append([u-1,w]) ans = [[] for i in range(n)] ans[0].append(0) q = [0] while q: x = q.pop() for u,w in d[x]: if not ans[u]: ...
22
23
442
470
n = int(eval(input())) d = [[] for i in range(n)] for i in range(n - 1): u, v, w = list(map(int, input().split())) d[u - 1].append([v - 1, w]) d[v - 1].append([u - 1, w]) ans = [-1] * n ans[0] = 0 q = [0] cnt = 0 while q: u = q.pop() for v, w in d[u]: if ans[v] == -1: if w % 2 ==...
n = int(eval(input())) d = [[] for i in range(n)] for i in range(n - 1): u, v, w = list(map(int, input().split())) d[u - 1].append([v - 1, w]) d[v - 1].append([u - 1, w]) ans = [[] for i in range(n)] ans[0].append(0) q = [0] while q: x = q.pop() for u, w in d[x]: if not ans[u]: b...
false
4.347826
[ "-ans = [-1] * n", "-ans[0] = 0", "+ans = [[] for i in range(n)]", "+ans[0].append(0)", "-cnt = 0", "- u = q.pop()", "- for v, w in d[u]:", "- if ans[v] == -1:", "- if w % 2 == 0:", "- ans[v] = ans[u]", "- else:", "- ans[v] = (an...
false
0.038277
0.040183
0.952553
[ "s437144664", "s937697881" ]
u133936772
p03037
python
s269215071
s576182465
376
219
57,452
9,180
Accepted
Accepted
41.76
f=lambda:list(map(int,input().split())) _,m=f() l,r=list(zip(*[f() for _ in range(m)])) print((max(0,min(r)-max(l)+1)))
f=lambda:list(map(int,input().split())) n,m=f() L,R=0,n for i in range(m): l,r=f() L=max(L,l) R=min(R,r) print((max(0,R-L+1)))
4
8
108
131
f = lambda: list(map(int, input().split())) _, m = f() l, r = list(zip(*[f() for _ in range(m)])) print((max(0, min(r) - max(l) + 1)))
f = lambda: list(map(int, input().split())) n, m = f() L, R = 0, n for i in range(m): l, r = f() L = max(L, l) R = min(R, r) print((max(0, R - L + 1)))
false
50
[ "-_, m = f()", "-l, r = list(zip(*[f() for _ in range(m)]))", "-print((max(0, min(r) - max(l) + 1)))", "+n, m = f()", "+L, R = 0, n", "+for i in range(m):", "+ l, r = f()", "+ L = max(L, l)", "+ R = min(R, r)", "+print((max(0, R - L + 1)))" ]
false
0.036944
0.057142
0.646529
[ "s269215071", "s576182465" ]
u690536347
p03946
python
s821779331
s225916337
269
165
75,392
94,344
Accepted
Accepted
38.66
from collections import Counter n,t=list(map(int,input().split())) *a,=list(map(int,input().split())) m=[None]*n used=[False]*n for i in range(n)[::-1]: if i==n-1: m[i]=a[i] else: m[i]=max(m[i+1],a[i]) c=Counter([m[i]-a[i] for i in range(n)]) print((c[max(c.keys())]))
from operator import add from collections import defaultdict class SegTree(): def __init__(self, N, e, operator_func=add): self.e = e # 単位元 self.size = N self.node = [self.e] * (2*N) self.operator_func = operator_func # 処理(add or xor max minなど) def set_list(self, l): ...
16
48
298
1,388
from collections import Counter n, t = list(map(int, input().split())) (*a,) = list(map(int, input().split())) m = [None] * n used = [False] * n for i in range(n)[::-1]: if i == n - 1: m[i] = a[i] else: m[i] = max(m[i + 1], a[i]) c = Counter([m[i] - a[i] for i in range(n)]) print((c[max(c.keys(...
from operator import add from collections import defaultdict class SegTree: def __init__(self, N, e, operator_func=add): self.e = e # 単位元 self.size = N self.node = [self.e] * (2 * N) self.operator_func = operator_func # 処理(add or xor max minなど) def set_list(self, l): ...
false
66.666667
[ "-from collections import Counter", "+from operator import add", "+from collections import defaultdict", "-n, t = list(map(int, input().split()))", "-(*a,) = list(map(int, input().split()))", "-m = [None] * n", "-used = [False] * n", "-for i in range(n)[::-1]:", "- if i == n - 1:", "- m[...
false
0.038703
0.043901
0.881608
[ "s821779331", "s225916337" ]
u313111801
p03463
python
s424330312
s749612324
31
27
9,152
9,028
Accepted
Accepted
12.9
n,a,b=list(map(int,input().split())) if abs(a-b)%2==0: ans="Alice" else: ans="Borys" print(ans)
n,a,b=list(map(int,input().split())) if abs(a-b)&1: print("Borys") else: print("Alice")
6
5
103
94
n, a, b = list(map(int, input().split())) if abs(a - b) % 2 == 0: ans = "Alice" else: ans = "Borys" print(ans)
n, a, b = list(map(int, input().split())) if abs(a - b) & 1: print("Borys") else: print("Alice")
false
16.666667
[ "-if abs(a - b) % 2 == 0:", "- ans = \"Alice\"", "+if abs(a - b) & 1:", "+ print(\"Borys\")", "- ans = \"Borys\"", "-print(ans)", "+ print(\"Alice\")" ]
false
0.047843
0.078557
0.609017
[ "s424330312", "s749612324" ]
u858748695
p03546
python
s041320164
s534199339
36
28
3,444
3,836
Accepted
Accepted
22.22
#!/usr/bin/env python3 H, W = list(map(int, input().split())) c = [list(map(int, input().split())) for _ in range(10)] A = [list(map(int, input().split())) for _ in range(H)] for k in range(10): for i in range(10): for j in range(10): c[i][j] = min(c[i][j], c[i][k] + c[k][j]) ans =...
#!/usr/bin/env python3 import itertools H, W = list(map(int, input().split())) c = [list(map(int, input().split())) for _ in range(10)] A = [list(map(int, input().split())) for _ in range(H)] for k in range(10): for i in range(10): for j in range(10): c[i][j] = min(c[i][j], c[i][k] +...
18
14
436
412
#!/usr/bin/env python3 H, W = list(map(int, input().split())) c = [list(map(int, input().split())) for _ in range(10)] A = [list(map(int, input().split())) for _ in range(H)] for k in range(10): for i in range(10): for j in range(10): c[i][j] = min(c[i][j], c[i][k] + c[k][j]) ans = 0 for i in ra...
#!/usr/bin/env python3 import itertools H, W = list(map(int, input().split())) c = [list(map(int, input().split())) for _ in range(10)] A = [list(map(int, input().split())) for _ in range(H)] for k in range(10): for i in range(10): for j in range(10): c[i][j] = min(c[i][j], c[i][k] + c[k][j]) a...
false
22.222222
[ "+import itertools", "+", "-ans = 0", "-for i in range(H):", "- for j in range(W):", "- if A[i][j] != -1:", "- ans += c[A[i][j]][1]", "+ans = sum([c[a][1] for a in itertools.chain.from_iterable(A) if a >= 0])" ]
false
0.049645
0.04847
1.024232
[ "s041320164", "s534199339" ]
u564589929
p02623
python
s383726913
s121724769
1,065
236
41,052
41,004
Accepted
Accepted
77.84
import sys sys.setrecursionlimit(10 ** 9) # input = sys.stdin.readline #### def int1(x): return int(x) - 1 def II(): return int(eval(input())) def MI(): return list(map(int, input().split())) def MI1(): return list(map(int1, input().split())) def LI(): return list(map(int, input().split())) def LI1(): return...
import sys sys.setrecursionlimit(10 ** 9) # input = sys.stdin.readline #### def int1(x): return int(x) - 1 def II(): return int(eval(input())) def MI(): return list(map(int, input().split())) def MI1(): return list(map(int1, input().split())) def LI(): return list(map(int, input().split())) def LI1(): return...
60
44
1,745
1,332
import sys sys.setrecursionlimit(10**9) # input = sys.stdin.readline #### def int1(x): return int(x) - 1 def II(): return int(eval(input())) def MI(): return list(map(int, input().split())) def MI1(): return list(map(int1, input().split())) def LI(): return list(map(int, input().split())...
import sys sys.setrecursionlimit(10**9) # input = sys.stdin.readline #### def int1(x): return int(x) - 1 def II(): return int(eval(input())) def MI(): return list(map(int, input().split())) def MI1(): return list(map(int1, input().split())) def LI(): return list(map(int, input().split())...
false
26.666667
[ "-", "- def is_ok(arg, a):", "- # b <= K - a", "- # print(arg, B[arg], a, K, B[arg] <= K - a)", "- return B[arg] <= K - a", "-", "- def meguru_bisect(ng, ok, a):", "- while abs(ok - ng) > 1:", "- mid = (ok + ng) // 2", "- if is_ok(mid, a):", ...
false
0.055772
0.035818
1.557084
[ "s383726913", "s121724769" ]
u691501673
p03281
python
s852974405
s524530408
21
18
2,940
2,940
Accepted
Accepted
14.29
N = int(eval(input())) count = 0 for i in range(N): divisor_count = 0 for j in range(i + 1): # 偶数は対象外 if (j + 1) % 2 == 0: continue if (i + 1) % (j + 1) == 0: divisor_count += 1 if divisor_count == 8: count += 1 print(count)
N = int(eval(input())) ok_count = 0 for i in range(1, N + 1, 2): # 約数を8個もつものの数 count = 0 for j in range(1, i + 1): # print("{}".format(j)) if i % j == 0: count += 1 if count == 8: ok_count += 1 print(ok_count)
14
13
301
269
N = int(eval(input())) count = 0 for i in range(N): divisor_count = 0 for j in range(i + 1): # 偶数は対象外 if (j + 1) % 2 == 0: continue if (i + 1) % (j + 1) == 0: divisor_count += 1 if divisor_count == 8: count += 1 print(count)
N = int(eval(input())) ok_count = 0 for i in range(1, N + 1, 2): # 約数を8個もつものの数 count = 0 for j in range(1, i + 1): # print("{}".format(j)) if i % j == 0: count += 1 if count == 8: ok_count += 1 print(ok_count)
false
7.142857
[ "-count = 0", "-for i in range(N):", "- divisor_count = 0", "- for j in range(i + 1):", "- # 偶数は対象外", "- if (j + 1) % 2 == 0:", "- continue", "- if (i + 1) % (j + 1) == 0:", "- divisor_count += 1", "- if divisor_count == 8:", "- count +=...
false
0.080071
0.097359
0.822429
[ "s852974405", "s524530408" ]
u133936772
p03607
python
s807938722
s115981175
159
69
19,720
19,728
Accepted
Accepted
56.6
l=[eval(input()) for _ in range(int(eval(input())))] from collections import * c=Counter(l) print((sum(v%2 for v in list(c.values()))))
import sys f=sys.stdin.readline l=[f() for _ in range(int(f()))] from collections import * c=Counter(l) print((sum(v%2 for v in list(c.values()))))
4
6
118
144
l = [eval(input()) for _ in range(int(eval(input())))] from collections import * c = Counter(l) print((sum(v % 2 for v in list(c.values()))))
import sys f = sys.stdin.readline l = [f() for _ in range(int(f()))] from collections import * c = Counter(l) print((sum(v % 2 for v in list(c.values()))))
false
33.333333
[ "-l = [eval(input()) for _ in range(int(eval(input())))]", "+import sys", "+", "+f = sys.stdin.readline", "+l = [f() for _ in range(int(f()))]" ]
false
0.099601
0.105079
0.947873
[ "s807938722", "s115981175" ]
u790012205
p03796
python
s468100683
s747566987
49
44
2,940
9,156
Accepted
Accepted
10.2
N = int(eval(input())) p = 1 for i in range(N): p = p * (i + 1) % (1e9 + 7) print((int(p)))
N = int(eval(input())) MOD = 10 ** 9 + 7 S = 1 for i in range(1, N + 1): S = S * i % MOD print((S % MOD))
5
6
91
106
N = int(eval(input())) p = 1 for i in range(N): p = p * (i + 1) % (1e9 + 7) print((int(p)))
N = int(eval(input())) MOD = 10**9 + 7 S = 1 for i in range(1, N + 1): S = S * i % MOD print((S % MOD))
false
16.666667
[ "-p = 1", "-for i in range(N):", "- p = p * (i + 1) % (1e9 + 7)", "-print((int(p)))", "+MOD = 10**9 + 7", "+S = 1", "+for i in range(1, N + 1):", "+ S = S * i % MOD", "+print((S % MOD))" ]
false
0.056961
0.051586
1.104182
[ "s468100683", "s747566987" ]
u283869437
p03064
python
s111197952
s442022167
2,689
2,347
143,948
157,728
Accepted
Accepted
12.72
M=998244353 N,*A=open(0) d=[1]+[0]*7**6 e=[1]+[0]*7**6 z=1 s=0 for a in A: a=int(a);s+=a;i=s;z*=3 while~i:d[i]+=d[i]+d[i-a]%M;e[i]+=e[i-a]%M;i-=1 i=s while i*2>=s:z=(z-d[i]*3)%M;i-=1 print(((z+~s%2*e[s//2]*3)%M))
M,z,s=998244353,1,0 d=[1]+[0]*7**6 e=[1]+[0]*7**6 for _ in'_'*eval(input()): a=eval(input());s+=a;i=s;z*=3 while~i:d[i]+=d[i]+d[i-a]%M;e[i]+=e[i-a]%M;i-=1 i=s while i*2>=s:z=(z-d[i]*3)%M;i-=1 print((z+~s%2*e[s//2]*3)%M)
12
9
223
215
M = 998244353 N, *A = open(0) d = [1] + [0] * 7**6 e = [1] + [0] * 7**6 z = 1 s = 0 for a in A: a = int(a) s += a i = s z *= 3 while ~i: d[i] += d[i] + d[i - a] % M e[i] += e[i - a] % M i -= 1 i = s while i * 2 >= s: z = (z - d[i] * 3) % M i -= 1 print(((z + ~s % 2 * ...
M, z, s = 998244353, 1, 0 d = [1] + [0] * 7**6 e = [1] + [0] * 7**6 for _ in "_" * eval(input()): a = eval(input()) s += a i = s z *= 3 while ~i: d[i] += d[i] + d[i - a] % M e[i] += e[i - a] % M i -= 1 i = s while i * 2 >= s: z = (z - d[i] * 3) % M i -= 1 print((z + ~...
false
25
[ "-M = 998244353", "-N, *A = open(0)", "+M, z, s = 998244353, 1, 0", "-z = 1", "-s = 0", "-for a in A:", "- a = int(a)", "+for _ in \"_\" * eval(input()):", "+ a = eval(input())", "-print(((z + ~s % 2 * e[s // 2] * 3) % M))", "+print((z + ~s % 2 * e[s // 2] * 3) % M)" ]
false
0.043637
0.078914
0.552973
[ "s111197952", "s442022167" ]
u815763296
p02882
python
s029317533
s470877099
28
24
9,300
9,320
Accepted
Accepted
14.29
import math a, b, x = list(map(int, input().split())) if x == (a**2*b)/2: print((45)) elif x > (a**2*b)/2: print((math.degrees(math.atan((2*(b-x/(a**2)))/a)))) else: print((math.degrees(math.atan(a*b**2/(2*x)))))
import math def LI(): return list(map(int, input().split())) a, b, x = LI() if x == (a**2*b)/2: ans = 45 elif x > (a**2*b)/2: ans = math.degrees(math.atan((2*(b-x/(a**2)))/a)) else: ans = math.degrees(math.atan(a*b**2/(2*x))) print(ans)
8
15
220
271
import math a, b, x = list(map(int, input().split())) if x == (a**2 * b) / 2: print((45)) elif x > (a**2 * b) / 2: print((math.degrees(math.atan((2 * (b - x / (a**2))) / a)))) else: print((math.degrees(math.atan(a * b**2 / (2 * x)))))
import math def LI(): return list(map(int, input().split())) a, b, x = LI() if x == (a**2 * b) / 2: ans = 45 elif x > (a**2 * b) / 2: ans = math.degrees(math.atan((2 * (b - x / (a**2))) / a)) else: ans = math.degrees(math.atan(a * b**2 / (2 * x))) print(ans)
false
46.666667
[ "-a, b, x = list(map(int, input().split()))", "+", "+def LI():", "+ return list(map(int, input().split()))", "+", "+", "+a, b, x = LI()", "- print((45))", "+ ans = 45", "- print((math.degrees(math.atan((2 * (b - x / (a**2))) / a))))", "+ ans = math.degrees(math.atan((2 * (b - x / ...
false
0.035746
0.034136
1.047168
[ "s029317533", "s470877099" ]
u057993957
p03048
python
s000663854
s939506066
1,759
1,597
3,060
2,940
Accepted
Accepted
9.21
a, b, c, n = list(map(int, input().split())) cnt = 0 for i in range(n//a+1): an = n - a * i for j in range(an//b+1): num = an - b * j if num >= 0 and num % c == 0: cnt+=1 print(cnt)
a, b, c, n = list(map(int, input().split())) cnt = 0 for i in range(n//a+1): an = n - a * i if an >= 0: for j in range(an//b+1): num = an - b * j if num >= 0 and num % c == 0: cnt+=1 print(cnt)
11
13
219
248
a, b, c, n = list(map(int, input().split())) cnt = 0 for i in range(n // a + 1): an = n - a * i for j in range(an // b + 1): num = an - b * j if num >= 0 and num % c == 0: cnt += 1 print(cnt)
a, b, c, n = list(map(int, input().split())) cnt = 0 for i in range(n // a + 1): an = n - a * i if an >= 0: for j in range(an // b + 1): num = an - b * j if num >= 0 and num % c == 0: cnt += 1 print(cnt)
false
15.384615
[ "- for j in range(an // b + 1):", "- num = an - b * j", "- if num >= 0 and num % c == 0:", "- cnt += 1", "+ if an >= 0:", "+ for j in range(an // b + 1):", "+ num = an - b * j", "+ if num >= 0 and num % c == 0:", "+ cnt += 1"...
false
0.121031
0.054156
2.234866
[ "s000663854", "s939506066" ]
u188827677
p03578
python
s318366308
s551300053
305
244
57,088
57,300
Accepted
Accepted
20
from collections import Counter n = int(eval(input())) d = list(map(int, input().split())) m = int(eval(input())) t = list(map(int, input().split())) count_d = Counter(d) count_t = Counter(t) for i in list(count_t.items()): if i[0] not in count_d: print("NO") exit() if i[0] in count_d: count_...
from collections import Counter n = int(eval(input())) d = list(map(int, input().split())) m = int(eval(input())) t = list(map(int, input().split())) d_count = Counter(d) t_count = Counter(t) for x,y in list(t_count.items()): if x in d_count: if y > d_count[x]: print("NO") break else: ...
21
17
422
349
from collections import Counter n = int(eval(input())) d = list(map(int, input().split())) m = int(eval(input())) t = list(map(int, input().split())) count_d = Counter(d) count_t = Counter(t) for i in list(count_t.items()): if i[0] not in count_d: print("NO") exit() if i[0] in count_d: ...
from collections import Counter n = int(eval(input())) d = list(map(int, input().split())) m = int(eval(input())) t = list(map(int, input().split())) d_count = Counter(d) t_count = Counter(t) for x, y in list(t_count.items()): if x in d_count: if y > d_count[x]: print("NO") break ...
false
19.047619
[ "-count_d = Counter(d)", "-count_t = Counter(t)", "-for i in list(count_t.items()):", "- if i[0] not in count_d:", "+d_count = Counter(d)", "+t_count = Counter(t)", "+for x, y in list(t_count.items()):", "+ if x in d_count:", "+ if y > d_count[x]:", "+ print(\"NO\")", "+ ...
false
0.04668
0.046232
1.009688
[ "s318366308", "s551300053" ]
u569960318
p02274
python
s912618792
s731808016
3,410
1,550
44,316
30,356
Accepted
Accepted
54.55
def invNum(d,A): if d < 0 or len(A) < 2: return 0 cnt = 0 L = [] R = [] for ai in A: if ai < 2**d: L.append(ai) cnt += len(R) else: R.append(ai-2**d) return cnt + invNum(d-1,L) + invNum(d-1,R) if __name__=='__main__': n = in...
cnt = 0 def merge(L,R): global cnt n = len(L)+len(R) lenL = len(L) A = [] i = j = 0 L.append(-1) R.append(-1) for _ in range(n): if L[i] > R[j]: A.append(L[i]) i += 1 else: A.append(R[j]) j += 1 c...
16
29
385
599
def invNum(d, A): if d < 0 or len(A) < 2: return 0 cnt = 0 L = [] R = [] for ai in A: if ai < 2**d: L.append(ai) cnt += len(R) else: R.append(ai - 2**d) return cnt + invNum(d - 1, L) + invNum(d - 1, R) if __name__ == "__main__": n...
cnt = 0 def merge(L, R): global cnt n = len(L) + len(R) lenL = len(L) A = [] i = j = 0 L.append(-1) R.append(-1) for _ in range(n): if L[i] > R[j]: A.append(L[i]) i += 1 else: A.append(R[j]) j += 1 cnt += lenL ...
false
44.827586
[ "-def invNum(d, A):", "- if d < 0 or len(A) < 2:", "- return 0", "- cnt = 0", "- L = []", "- R = []", "- for ai in A:", "- if ai < 2**d:", "- L.append(ai)", "- cnt += len(R)", "+cnt = 0", "+", "+", "+def merge(L, R):", "+ global cnt",...
false
0.078532
0.036621
2.144442
[ "s912618792", "s731808016" ]
u745097373
p03963
python
s175173082
s825321605
882
17
8,172
3,064
Accepted
Accepted
98.07
import re import doctest class IO_for_Contest(object): @staticmethod def my_input(): # return raw_input() return eval(input()) @staticmethod def read_from_input(): return IO_for_Contest.read_n_int(2) @staticmethod def read_line(): return IO_for...
def solve(): n, k = read() result = think(n, k) write(result) def read(): return read_int(2) 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()...
39
31
815
474
import re import doctest class IO_for_Contest(object): @staticmethod def my_input(): # return raw_input() return eval(input()) @staticmethod def read_from_input(): return IO_for_Contest.read_n_int(2) @staticmethod def read_line(): return IO_for_Contest.my_inpu...
def solve(): n, k = read() result = think(n, k) write(result) def read(): return read_int(2) 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] def think(n...
false
20.512821
[ "-import re", "-import doctest", "+def solve():", "+ n, k = read()", "+ result = think(n, k)", "+ write(result)", "-class IO_for_Contest(object):", "- @staticmethod", "- def my_input():", "- # return raw_input()", "- return eval(input())", "-", "- @staticmetho...
false
0.063302
0.036346
1.741669
[ "s175173082", "s825321605" ]
u729133443
p02959
python
s040055933
s161623127
288
159
102,024
25,180
Accepted
Accepted
44.79
n,*a=list(map(int,open(0).read().split())) c=0 for i in range(1,n+1):c+=min(a[i-1]+a[i],a[n+i]);a[i]-=max(min(a[n+i]-a[i-1],a[i]),0) print(c)
n,x,*a=list(map(int,open(0).read().split())) c=0 for a,b in zip(a,a[n:]):c+=min(x+a,b);x=a-max(min(b-x,a),0) print(c)
4
4
138
114
n, *a = list(map(int, open(0).read().split())) c = 0 for i in range(1, n + 1): c += min(a[i - 1] + a[i], a[n + i]) a[i] -= max(min(a[n + i] - a[i - 1], a[i]), 0) print(c)
n, x, *a = list(map(int, open(0).read().split())) c = 0 for a, b in zip(a, a[n:]): c += min(x + a, b) x = a - max(min(b - x, a), 0) print(c)
false
0
[ "-n, *a = list(map(int, open(0).read().split()))", "+n, x, *a = list(map(int, open(0).read().split()))", "-for i in range(1, n + 1):", "- c += min(a[i - 1] + a[i], a[n + i])", "- a[i] -= max(min(a[n + i] - a[i - 1], a[i]), 0)", "+for a, b in zip(a, a[n:]):", "+ c += min(x + a, b)", "+ x = ...
false
0.065787
0.044494
1.478552
[ "s040055933", "s161623127" ]
u970899068
p03805
python
s639930588
s290411997
1,849
221
53,340
43,228
Accepted
Accepted
88.05
import itertools n,m= list(map(int, input().split())) a= [list(map(int, input().split())) for i in range(m)] # 経路全探索 ans=0 for v in itertools.combinations(a, n-1): b=[[] for i in range(n)] for x,y in v: b[x - 1].append(y - 1) b[y - 1].append(x - 1) import collections from ...
N, M = list(map(int, input().split())) es = [[] for i in range(N)] for i in range(M): a, b = list(map(int, input().split())) es[a-1].append(b-1) es[b-1].append(a-1) def dfs(v, used, cnt): used[v] = 1 if all(used): cnt.append(1) for nv in es[v]: if used[nv]: ...
42
22
886
432
import itertools n, m = list(map(int, input().split())) a = [list(map(int, input().split())) for i in range(m)] # 経路全探索 ans = 0 for v in itertools.combinations(a, n - 1): b = [[] for i in range(n)] for x, y in v: b[x - 1].append(y - 1) b[y - 1].append(x - 1) import collections from coll...
N, M = list(map(int, input().split())) es = [[] for i in range(N)] for i in range(M): a, b = list(map(int, input().split())) es[a - 1].append(b - 1) es[b - 1].append(a - 1) def dfs(v, used, cnt): used[v] = 1 if all(used): cnt.append(1) for nv in es[v]: if used[nv]: ...
false
47.619048
[ "-import itertools", "+N, M = list(map(int, input().split()))", "+es = [[] for i in range(N)]", "+for i in range(M):", "+ a, b = list(map(int, input().split()))", "+ es[a - 1].append(b - 1)", "+ es[b - 1].append(a - 1)", "-n, m = list(map(int, input().split()))", "-a = [list(map(int, input(...
false
0.037507
0.043443
0.863363
[ "s639930588", "s290411997" ]
u610042046
p02707
python
s250109862
s680755521
162
142
33,860
25,744
Accepted
Accepted
12.35
n = int(eval(input())) ls = [0]*n ls1 = list(map(int, input().split())) for i in ls1: ls[i-1] += 1 for j in ls: print(j)
n = int(eval(input())) ls = [0]*n for i in map(int, input().split()): ls[i-1] += 1 for j in ls: print(j)
7
6
128
111
n = int(eval(input())) ls = [0] * n ls1 = list(map(int, input().split())) for i in ls1: ls[i - 1] += 1 for j in ls: print(j)
n = int(eval(input())) ls = [0] * n for i in map(int, input().split()): ls[i - 1] += 1 for j in ls: print(j)
false
14.285714
[ "-ls1 = list(map(int, input().split()))", "-for i in ls1:", "+for i in map(int, input().split()):" ]
false
0.044462
0.044713
0.994376
[ "s250109862", "s680755521" ]
u073852194
p03168
python
s243012334
s225870011
1,293
113
354,696
71,060
Accepted
Accepted
91.26
N = int(eval(input())) P = list(map(float,input().split())) dp = [[0 for j in range(N+1)] for i in range(N)]#i+1枚目までのコインを投げたときにj枚表が出る確率 dp[0][0] = 1-P[0] dp[0][1] = P[0] for i in range(1,N): dp[i][0] = dp[i-1][0]*(1-P[i]) for i in range(1,N): for j in range(1,N+1): dp[i][j] = dp[i-1][j-1]...
N = int(eval(input())) P = list(map(float, input().split())) dp = [0 for _ in range(N + 1)] dp[0] = 1 for i in range(N): p = P[i] for j in range(N)[::-1]: dp[j + 1] += dp[j] * p dp[j] *= 1 - p print((sum(dp[N // 2 + 1:])))
19
13
422
253
N = int(eval(input())) P = list(map(float, input().split())) dp = [[0 for j in range(N + 1)] for i in range(N)] # i+1枚目までのコインを投げたときにj枚表が出る確率 dp[0][0] = 1 - P[0] dp[0][1] = P[0] for i in range(1, N): dp[i][0] = dp[i - 1][0] * (1 - P[i]) for i in range(1, N): for j in range(1, N + 1): dp[i][j] = dp[i - 1...
N = int(eval(input())) P = list(map(float, input().split())) dp = [0 for _ in range(N + 1)] dp[0] = 1 for i in range(N): p = P[i] for j in range(N)[::-1]: dp[j + 1] += dp[j] * p dp[j] *= 1 - p print((sum(dp[N // 2 + 1 :])))
false
31.578947
[ "-dp = [[0 for j in range(N + 1)] for i in range(N)] # i+1枚目までのコインを投げたときにj枚表が出る確率", "-dp[0][0] = 1 - P[0]", "-dp[0][1] = P[0]", "-for i in range(1, N):", "- dp[i][0] = dp[i - 1][0] * (1 - P[i])", "-for i in range(1, N):", "- for j in range(1, N + 1):", "- dp[i][j] = dp[i - 1][j - 1] * P[...
false
0.08381
0.035857
2.337342
[ "s243012334", "s225870011" ]
u242031676
p03352
python
s277806970
s443809773
78
17
2,940
3,060
Accepted
Accepted
78.21
x, mx = int(eval(input())), 1 for i in range(2,x+1): for j in range(2,100): if i**j<=x: mx=max(mx, i**j) print(mx)
beki = [0] * 1010 beki[1] = 1 for i in range(2, 1001): t = i*i while t<1001: beki[t] = 1 t *= i ans = 1 for i in range(int(eval(input()))+1): if beki[i]: ans = i print(ans)
5
11
124
232
x, mx = int(eval(input())), 1 for i in range(2, x + 1): for j in range(2, 100): if i**j <= x: mx = max(mx, i**j) print(mx)
beki = [0] * 1010 beki[1] = 1 for i in range(2, 1001): t = i * i while t < 1001: beki[t] = 1 t *= i ans = 1 for i in range(int(eval(input())) + 1): if beki[i]: ans = i print(ans)
false
54.545455
[ "-x, mx = int(eval(input())), 1", "-for i in range(2, x + 1):", "- for j in range(2, 100):", "- if i**j <= x:", "- mx = max(mx, i**j)", "-print(mx)", "+beki = [0] * 1010", "+beki[1] = 1", "+for i in range(2, 1001):", "+ t = i * i", "+ while t < 1001:", "+ beki...
false
0.053446
0.10355
0.51614
[ "s277806970", "s443809773" ]
u047796752
p02681
python
s093531744
s266335923
79
61
64,648
61,792
Accepted
Accepted
22.78
from collections import * S = eval(input()) T = eval(input()) if S==T[:-1]: print('Yes') else: print('No')
S = eval(input()) T = eval(input()) if S==T[:-1]: print('Yes') else: print('No')
9
7
112
83
from collections import * S = eval(input()) T = eval(input()) if S == T[:-1]: print("Yes") else: print("No")
S = eval(input()) T = eval(input()) if S == T[:-1]: print("Yes") else: print("No")
false
22.222222
[ "-from collections import *", "-" ]
false
0.18997
0.08585
2.212817
[ "s093531744", "s266335923" ]
u047102107
p02844
python
s664205185
s387844981
254
222
40,816
39,920
Accepted
Accepted
12.6
from itertools import combinations N = int(eval(input())) S = eval(input()) count = 0 ans = set({}) for password in range(0, 1000): s = "{:03d}".format(password) s1, s2, s3 = s if s1 not in S: continue i1 = S.index(s1) if s2 not in S[i1+1:]: continue i2 =...
N = int(eval(input())) S = eval(input()) # 3桁の数値の総当り count = 0 for n in range(0, 1000): password = "{:03d}".format(n) p1, p2, p3 = password i1 = S.find(str(p1)) if i1 < 0: continue i2 = S[i1+1:].find(str(p2)) if i2 < 0: continue i3 = S[i1+1:][i2+1:].find(str(...
25
20
518
376
from itertools import combinations N = int(eval(input())) S = eval(input()) count = 0 ans = set({}) for password in range(0, 1000): s = "{:03d}".format(password) s1, s2, s3 = s if s1 not in S: continue i1 = S.index(s1) if s2 not in S[i1 + 1 :]: continue i2 = S[i1 + 1 :].index(s2...
N = int(eval(input())) S = eval(input()) # 3桁の数値の総当り count = 0 for n in range(0, 1000): password = "{:03d}".format(n) p1, p2, p3 = password i1 = S.find(str(p1)) if i1 < 0: continue i2 = S[i1 + 1 :].find(str(p2)) if i2 < 0: continue i3 = S[i1 + 1 :][i2 + 1 :].find(str(p3)) ...
false
20
[ "-from itertools import combinations", "-", "+# 3桁の数値の総当り", "-ans = set({})", "-for password in range(0, 1000):", "- s = \"{:03d}\".format(password)", "- s1, s2, s3 = s", "- if s1 not in S:", "+for n in range(0, 1000):", "+ password = \"{:03d}\".format(n)", "+ p1, p2, p3 = passwor...
false
0.042018
0.039161
1.07294
[ "s664205185", "s387844981" ]
u043048943
p03244
python
s088029292
s346179866
206
111
96,020
97,580
Accepted
Accepted
46.12
def main(): from collections import Counter n = int(eval(input())) V = list(map(int,input().split())) odds = [] evens = [] for i,v in enumerate(V): if i & 1: evens.append(v) else: odds.append(v) odds_counter = list(Counter(odds).items(...
def main(): from collections import Counter n = int(eval(input())) V = list(map(int,input().split())) odds = [] evens = [] for i,v in enumerate(V): if i & 1: evens.append(v) else: odds.append(v) odds_modes= Counter(odds).most_common(2)...
41
30
986
807
def main(): from collections import Counter n = int(eval(input())) V = list(map(int, input().split())) odds = [] evens = [] for i, v in enumerate(V): if i & 1: evens.append(v) else: odds.append(v) odds_counter = list(Counter(odds).items()) eves_co...
def main(): from collections import Counter n = int(eval(input())) V = list(map(int, input().split())) odds = [] evens = [] for i, v in enumerate(V): if i & 1: evens.append(v) else: odds.append(v) odds_modes = Counter(odds).most_common(2) evens_mo...
false
26.829268
[ "- odds_counter = list(Counter(odds).items())", "- eves_counter = list(Counter(evens).items())", "- odds_counter.sort(reverse=True, key=lambda x: x[1])", "- eves_counter.sort(reverse=True, key=lambda x: x[1])", "- if odds_counter[0][0] != eves_counter[0][0]:", "- print((len(odds) - o...
false
0.037262
0.038388
0.970684
[ "s088029292", "s346179866" ]
u792834675
p02401
python
s607764705
s633193385
20
10
4,204
4,188
Accepted
Accepted
50
while 1: a,op,b = input().split() a=int(a) b=int(b) if op=="?": break elif op=="+": print(a+b) elif op=="-": print(a-b) elif op=="*": print(a*b) elif op=="/": print(a/b)
while 1: x = input() i = x.split() if i[1]=="?": break print(eval(x))
14
5
254
92
while 1: a, op, b = input().split() a = int(a) b = int(b) if op == "?": break elif op == "+": print(a + b) elif op == "-": print(a - b) elif op == "*": print(a * b) elif op == "/": print(a / b)
while 1: x = input() i = x.split() if i[1] == "?": break print(eval(x))
false
64.285714
[ "- a, op, b = input().split()", "- a = int(a)", "- b = int(b)", "- if op == \"?\":", "+ x = input()", "+ i = x.split()", "+ if i[1] == \"?\":", "- elif op == \"+\":", "- print(a + b)", "- elif op == \"-\":", "- print(a - b)", "- elif op == \"*\":", ...
false
0.120244
0.131342
0.915502
[ "s607764705", "s633193385" ]
u992465933
p03107
python
s052420447
s770311419
207
169
49,392
39,152
Accepted
Accepted
18.36
def main(): S = list(map(int,list(eval(input())))) count_0 = 0 count_1 = 0 for val in S: if val == 0: count_0 += 1 else: count_1 += 1 print((min(count_0, count_1)*2)) if __name__ == '__main__': main()
def main(): S = eval(input()) zero = S.count('0') one = S.count('1') print((min(zero, one)*2)) if __name__ == '__main__': main()
15
10
274
153
def main(): S = list(map(int, list(eval(input())))) count_0 = 0 count_1 = 0 for val in S: if val == 0: count_0 += 1 else: count_1 += 1 print((min(count_0, count_1) * 2)) if __name__ == "__main__": main()
def main(): S = eval(input()) zero = S.count("0") one = S.count("1") print((min(zero, one) * 2)) if __name__ == "__main__": main()
false
33.333333
[ "- S = list(map(int, list(eval(input()))))", "- count_0 = 0", "- count_1 = 0", "- for val in S:", "- if val == 0:", "- count_0 += 1", "- else:", "- count_1 += 1", "- print((min(count_0, count_1) * 2))", "+ S = eval(input())", "+ zero = S.c...
false
0.037784
0.037725
1.001562
[ "s052420447", "s770311419" ]
u687044304
p04013
python
s370825714
s671612421
451
416
94,940
94,940
Accepted
Accepted
7.76
# -*- coding:utf-8 -*- def solve(): N, A = list(map(int, input().split())) X = list(map(int, input().split())) # dp[i][j] := 左からi+1枚目までにj枚を選んで、選んだカードの総和がkになるカードの選び方 dp = [[[0 for _ in range(50*50+1)] for __ in range(N+1)] for ___ in range(N+1)] dp[0][0][0] = 1 # 何も選んでない初期値 for i in r...
# -*- coding:utf-8 -*- def solve(): N, A = list(map(int, input().split())) X = list(map(int, input().split())) dp = [[[0 for _ in range(50*50+1)] for __ in range(N+1)] for ___ in range(N+1)] dp[0][0][0] = 1 # 何も選んでない初期値 """ dp[i][j][k] := 左からi+1枚目までに、j枚のカードを選んで、選んだカードの総和がkになる選び方の総数...
26
30
776
793
# -*- coding:utf-8 -*- def solve(): N, A = list(map(int, input().split())) X = list(map(int, input().split())) # dp[i][j] := 左からi+1枚目までにj枚を選んで、選んだカードの総和がkになるカードの選び方 dp = [ [[0 for _ in range(50 * 50 + 1)] for __ in range(N + 1)] for ___ in range(N + 1) ] dp[0][0][0] = 1 # 何も選んでない初期値 ...
# -*- coding:utf-8 -*- def solve(): N, A = list(map(int, input().split())) X = list(map(int, input().split())) dp = [ [[0 for _ in range(50 * 50 + 1)] for __ in range(N + 1)] for ___ in range(N + 1) ] dp[0][0][0] = 1 # 何も選んでない初期値 """ dp[i][j][k] := 左からi+1枚目までに、j枚のカードを選んで、選んだカードの総和がk...
false
13.333333
[ "- # dp[i][j] := 左からi+1枚目までにj枚を選んで、選んだカードの総和がkになるカードの選び方", "+ \"\"\"", "+ dp[i][j][k] := 左からi+1枚目までに、j枚のカードを選んで、選んだカードの総和がkになる選び方の総数", "+ i: 左からi+1枚目のカード", "+ j: j枚のカードを選んだ", "+ k: 選んだカードの総和", "+ \"\"\"", "- # if dp[i][j][k] != 0:", "- if 1:", "- ...
false
0.0808
0.072855
1.109055
[ "s370825714", "s671612421" ]
u203669169
p03103
python
s509096265
s115572810
413
273
22,756
27,116
Accepted
Accepted
33.9
N, M=list(map(int, input().split())) #複数数値入力 「A B」みたいなスペース空いた入力のとき AB=[[int(i) for i in input().split()] for j in range(N)] # 二次元配列入力 二次元マップみたいな入力のとき AB.sort(key=lambda x: x[0]) money = 0 ct = M for i in AB: money += min(ct, i[1]) * i[0] ct = ct - min(ct, i[1]) if ct == 0: break pr...
N, M = [int(_) for _ in input().split()] AB = [[int(_) for _ in input().split()] for i in range(N)] AB.sort(key=lambda x:x[0]) ret = 0 money = 0 for a, b in AB: if ret >= M: break while ret < M and b >= 1: b -= 1 ret += 1 money += a print(money)
14
18
325
315
N, M = list(map(int, input().split())) # 複数数値入力 「A B」みたいなスペース空いた入力のとき AB = [[int(i) for i in input().split()] for j in range(N)] # 二次元配列入力 二次元マップみたいな入力のとき AB.sort(key=lambda x: x[0]) money = 0 ct = M for i in AB: money += min(ct, i[1]) * i[0] ct = ct - min(ct, i[1]) if ct == 0: break print(money)
N, M = [int(_) for _ in input().split()] AB = [[int(_) for _ in input().split()] for i in range(N)] AB.sort(key=lambda x: x[0]) ret = 0 money = 0 for a, b in AB: if ret >= M: break while ret < M and b >= 1: b -= 1 ret += 1 money += a print(money)
false
22.222222
[ "-N, M = list(map(int, input().split())) # 複数数値入力 「A B」みたいなスペース空いた入力のとき", "-AB = [[int(i) for i in input().split()] for j in range(N)] # 二次元配列入力 二次元マップみたいな入力のとき", "+N, M = [int(_) for _ in input().split()]", "+AB = [[int(_) for _ in input().split()] for i in range(N)]", "+ret = 0", "-ct = M", "-for i ...
false
0.038928
0.008043
4.839658
[ "s509096265", "s115572810" ]
u947883560
p03295
python
s485555190
s388795224
502
415
17,388
18,176
Accepted
Accepted
17.33
from bisect import bisect_left N, M = list(map(int, input().split())) ab = [0]*M for i in range(M): ab[i] = tuple(map(int, input().split())) ab.sort() used = [False]*M count = 0 for i in range(M): if used[i]: continue head, tail = ab[i] used[i] = True j = i+1 while j ...
from bisect import bisect_left N, M = list(map(int, input().split())) ab = [0]*M for i in range(M): ab[i] = tuple(map(int, input().split())) ab.sort(key=lambda x: x[1]) cutted = [-1] for i in range(M): a, b = ab[i] if a <= cutted[-1]: continue cutted.append(b-1) print((len(cutted...
26
15
482
318
from bisect import bisect_left N, M = list(map(int, input().split())) ab = [0] * M for i in range(M): ab[i] = tuple(map(int, input().split())) ab.sort() used = [False] * M count = 0 for i in range(M): if used[i]: continue head, tail = ab[i] used[i] = True j = i + 1 while j < M: ...
from bisect import bisect_left N, M = list(map(int, input().split())) ab = [0] * M for i in range(M): ab[i] = tuple(map(int, input().split())) ab.sort(key=lambda x: x[1]) cutted = [-1] for i in range(M): a, b = ab[i] if a <= cutted[-1]: continue cutted.append(b - 1) print((len(cutted) - 1))
false
42.307692
[ "-ab.sort()", "-used = [False] * M", "-count = 0", "+ab.sort(key=lambda x: x[1])", "+cutted = [-1]", "- if used[i]:", "+ a, b = ab[i]", "+ if a <= cutted[-1]:", "- head, tail = ab[i]", "- used[i] = True", "- j = i + 1", "- while j < M:", "- h, t = ab[j]", "- ...
false
0.044474
0.045443
0.97867
[ "s485555190", "s388795224" ]
u909643606
p03329
python
s907748182
s602276805
232
191
3,064
3,064
Accepted
Accepted
17.67
n = int(eval(input())) ans = float("inf") for n_nine in range(0, n//9 + 1): s = n - 9 * n_nine n_six = s // 6 n_one = s - 6 * n_six n_nine2 = 0 n_six2 = 0 pow_nine = 5 pow_six = 6 while n_nine >= 9: if n_nine >= 9 ** (pow_nine - 1): n_nine -= 9 ** (p...
def counting(num, power, base): num2 = 0 while num >= base: if num >= base ** (power - 1): num -= base ** (power - 1) num2 += 1 else: power -= 1 return num + num2 def main(): n = int(eval(input())) ans = float("inf") for n_nine in...
28
26
672
616
n = int(eval(input())) ans = float("inf") for n_nine in range(0, n // 9 + 1): s = n - 9 * n_nine n_six = s // 6 n_one = s - 6 * n_six n_nine2 = 0 n_six2 = 0 pow_nine = 5 pow_six = 6 while n_nine >= 9: if n_nine >= 9 ** (pow_nine - 1): n_nine -= 9 ** (pow_nine - 1) ...
def counting(num, power, base): num2 = 0 while num >= base: if num >= base ** (power - 1): num -= base ** (power - 1) num2 += 1 else: power -= 1 return num + num2 def main(): n = int(eval(input())) ans = float("inf") for n_nine in range(0, n ...
false
7.142857
[ "-n = int(eval(input()))", "-ans = float(\"inf\")", "-for n_nine in range(0, n // 9 + 1):", "- s = n - 9 * n_nine", "- n_six = s // 6", "- n_one = s - 6 * n_six", "- n_nine2 = 0", "- n_six2 = 0", "- pow_nine = 5", "- pow_six = 6", "- while n_nine >= 9:", "- if n_...
false
0.058043
0.07039
0.824583
[ "s907748182", "s602276805" ]
u218724761
p03494
python
s108245422
s369500530
20
17
3,060
3,060
Accepted
Accepted
15
import math n = eval(input()) a = list(map(int, input().split())) ans = float("inf") for i in a: ans = min(ans, len(bin(i)) - bin(i).rfind("1") - 1) print((round(ans)))
import math n = eval(input()) a = list(map(int, input().split())) ans = float("inf") for i in a: b = len(bin(i)) - bin(i).rfind("1") - 1 ans = min(ans, b) print((round(ans)))
7
8
170
181
import math n = eval(input()) a = list(map(int, input().split())) ans = float("inf") for i in a: ans = min(ans, len(bin(i)) - bin(i).rfind("1") - 1) print((round(ans)))
import math n = eval(input()) a = list(map(int, input().split())) ans = float("inf") for i in a: b = len(bin(i)) - bin(i).rfind("1") - 1 ans = min(ans, b) print((round(ans)))
false
12.5
[ "- ans = min(ans, len(bin(i)) - bin(i).rfind(\"1\") - 1)", "+ b = len(bin(i)) - bin(i).rfind(\"1\") - 1", "+ ans = min(ans, b)" ]
false
0.044064
0.042429
1.038542
[ "s108245422", "s369500530" ]
u392319141
p02769
python
s436984654
s952973274
692
632
30,388
28,336
Accepted
Accepted
8.67
class Combination: def __init__(self, size, mod=10**9 + 7): self.size = size + 2 self.mod = mod self.fact = [1, 1] + [0] * size self.factInv = [1, 1] + [0] * size self.inv = [0, 1] + [0] * size for i in range(2, self.size): self.fact[i] = self.fa...
MOD = 10**9 + 7 class Combination: def __init__(self, size): self.size = size + 2 self.fact = [1, 1] + [0] * size self.factInv = [1, 1] + [0] * size self.inv = [0, 1] + [0] * size for i in range(2, self.size): self.fact[i] = self.fact[i - 1] * i % MOD ...
42
38
1,217
1,081
class Combination: def __init__(self, size, mod=10**9 + 7): self.size = size + 2 self.mod = mod self.fact = [1, 1] + [0] * size self.factInv = [1, 1] + [0] * size self.inv = [0, 1] + [0] * size for i in range(2, self.size): self.fact[i] = self.fact[i - 1] ...
MOD = 10**9 + 7 class Combination: def __init__(self, size): self.size = size + 2 self.fact = [1, 1] + [0] * size self.factInv = [1, 1] + [0] * size self.inv = [0, 1] + [0] * size for i in range(2, self.size): self.fact[i] = self.fact[i - 1] * i % MOD ...
false
9.52381
[ "+MOD = 10**9 + 7", "+", "+", "- def __init__(self, size, mod=10**9 + 7):", "+ def __init__(self, size):", "- self.mod = mod", "- self.fact[i] = self.fact[i - 1] * i % self.mod", "- self.inv[i] = -self.inv[self.mod % i] * (self.mod // i) % self.mod", "- ...
false
0.244995
0.990498
0.247345
[ "s436984654", "s952973274" ]
u984276646
p03196
python
s778257204
s412534589
949
154
3,188
9,200
Accepted
Accepted
83.77
N, P = list(map(int, input().split())) if N == 1: print(P) else: A, n = [], N while n != 0: A = [n%2] + A[:] n //= 2 M = int(round(P ** (1/N))) g = 1 for i in range(1, M+1): t = 1 for j in range(len(A)): if A[j] == 1: t *= i if j != len(A) - 1: t *...
def factorization(n): a = n p = 2 res = [] while a != 1: cnt = 0 while a % p == 0: cnt += 1 a //= p if cnt: res.append([p, cnt]) p += 1 if a != 1 and p * p > n: res.append([a, 1]) break ...
20
23
362
449
N, P = list(map(int, input().split())) if N == 1: print(P) else: A, n = [], N while n != 0: A = [n % 2] + A[:] n //= 2 M = int(round(P ** (1 / N))) g = 1 for i in range(1, M + 1): t = 1 for j in range(len(A)): if A[j] == 1: t *= i ...
def factorization(n): a = n p = 2 res = [] while a != 1: cnt = 0 while a % p == 0: cnt += 1 a //= p if cnt: res.append([p, cnt]) p += 1 if a != 1 and p * p > n: res.append([a, 1]) break return res N...
false
13.043478
[ "+def factorization(n):", "+ a = n", "+ p = 2", "+ res = []", "+ while a != 1:", "+ cnt = 0", "+ while a % p == 0:", "+ cnt += 1", "+ a //= p", "+ if cnt:", "+ res.append([p, cnt])", "+ p += 1", "+ if a != 1 and ...
false
0.086266
0.048999
1.760576
[ "s778257204", "s412534589" ]
u062147869
p03256
python
s547816728
s748567462
1,476
1,043
112,804
99,804
Accepted
Accepted
29.34
import sys from collections import deque N,M=list(map(int,input().split())) s=eval(input()) table=[] for i in range(M): x,y=list(map(int,input().split())) table.append((x-1,y-1)) edge=[[]for i in range(2*N)] visit=[0]*(2*N) for x,y in table: if x==y: edge[2*x].append(2*x+1) visi...
import sys from collections import deque N,M=list(map(int,input().split())) s=eval(input()) table=[] for i in range(M): x,y=list(map(int,input().split())) table.append((x-1,y-1)) A=[0]*N B=[0]*N edge=[[] for i in range(N)] S=[False]*N L=deque() for x,y in table: if x==y: #edge[x].appe...
43
54
862
983
import sys from collections import deque N, M = list(map(int, input().split())) s = eval(input()) table = [] for i in range(M): x, y = list(map(int, input().split())) table.append((x - 1, y - 1)) edge = [[] for i in range(2 * N)] visit = [0] * (2 * N) for x, y in table: if x == y: edge[2 * x].appen...
import sys from collections import deque N, M = list(map(int, input().split())) s = eval(input()) table = [] for i in range(M): x, y = list(map(int, input().split())) table.append((x - 1, y - 1)) A = [0] * N B = [0] * N edge = [[] for i in range(N)] S = [False] * N L = deque() for x, y in table: if x == y:...
false
20.37037
[ "-edge = [[] for i in range(2 * N)]", "-visit = [0] * (2 * N)", "+A = [0] * N", "+B = [0] * N", "+edge = [[] for i in range(N)]", "+S = [False] * N", "+L = deque()", "- edge[2 * x].append(2 * x + 1)", "- visit[2 * x + 1] += 1", "+ # edge[x].append(y)", "+ if s[x] == \...
false
0.091348
0.037962
2.406311
[ "s547816728", "s748567462" ]
u945181840
p03231
python
s169092883
s376002482
35
17
5,344
3,316
Accepted
Accepted
51.43
from fractions import gcd N, M = list(map(int, input().split())) S = eval(input()) T = eval(input()) s = len(S) t = len(T) st = gcd(s, t) good = s * t // st if S[::s // st] == T[::t // st]: print(good) else: print((-1))
N, M = list(map(int, input().split())) S = eval(input()) T = eval(input()) s = len(S) t = len(T) def gcd(a, b): while b: a, b = b, a % b return a st = gcd(s, t) good = s * t // st if S[::s // st] == T[::t // st]: print(good) else: print((-1))
15
20
224
270
from fractions import gcd N, M = list(map(int, input().split())) S = eval(input()) T = eval(input()) s = len(S) t = len(T) st = gcd(s, t) good = s * t // st if S[:: s // st] == T[:: t // st]: print(good) else: print((-1))
N, M = list(map(int, input().split())) S = eval(input()) T = eval(input()) s = len(S) t = len(T) def gcd(a, b): while b: a, b = b, a % b return a st = gcd(s, t) good = s * t // st if S[:: s // st] == T[:: t // st]: print(good) else: print((-1))
false
25
[ "-from fractions import gcd", "-", "+", "+", "+def gcd(a, b):", "+ while b:", "+ a, b = b, a % b", "+ return a", "+", "+" ]
false
0.051943
0.036833
1.410212
[ "s169092883", "s376002482" ]
u586639900
p03575
python
s765685818
s800907516
37
33
9,352
9,376
Accepted
Accepted
10.81
from collections import Counter class UnionFind: def __init__(self, n): self.root = list(range(n + 1)) self.size = [1] * (n + 1) def __getitem__(self, x): root = self.root while root[x] != x: root[x] = root[root[x]] x = root[x] retu...
from collections import Counter N, M = list(map(int, input().split())) class UnionFind: def __init__(self, N): self.root = list(range(N + 1)) self.size = [1] * (N + 1) def __getitem__(self, x): root = self.root while root[x] != x: root[x] = root[root[x]] ...
53
48
1,083
1,072
from collections import Counter class UnionFind: def __init__(self, n): self.root = list(range(n + 1)) self.size = [1] * (n + 1) def __getitem__(self, x): root = self.root while root[x] != x: root[x] = root[root[x]] x = root[x] return x def...
from collections import Counter N, M = list(map(int, input().split())) class UnionFind: def __init__(self, N): self.root = list(range(N + 1)) self.size = [1] * (N + 1) def __getitem__(self, x): root = self.root while root[x] != x: root[x] = root[root[x]] ...
false
9.433962
[ "+", "+N, M = list(map(int, input().split()))", "- def __init__(self, n):", "- self.root = list(range(n + 1))", "- self.size = [1] * (n + 1)", "+ def __init__(self, N):", "+ self.root = list(range(N + 1))", "+ self.size = [1] * (N + 1)", "-N, M = list(map(int, input...
false
0.038476
0.04539
0.84767
[ "s765685818", "s800907516" ]
u305366205
p02959
python
s213815884
s583113105
181
167
18,624
19,116
Accepted
Accepted
7.73
n = int(eval(input())) a = list(map(int, input().split())) b = list(map(int, input().split())) b.append(0) ans = 0 for i in range(n): beaten = min(a[i], b[i]) b[i] -= beaten beaten2 = min(a[i + 1], b[i]) a[i + 1] -= beaten2 ans += beaten + beaten2 print(ans)
n = int(eval(input())) a = list(map(int, input().split())) b = list(map(int, input().split())) ans = 0 for i in range(n): # 正面の町を救う beaten = min(a[i], b[i]) b[i] -= beaten # 隣町を救う beaten2 = min(a[i + 1], b[i]) a[i + 1] -= beaten2 ans += beaten + beaten2 print(ans)
12
13
284
298
n = int(eval(input())) a = list(map(int, input().split())) b = list(map(int, input().split())) b.append(0) ans = 0 for i in range(n): beaten = min(a[i], b[i]) b[i] -= beaten beaten2 = min(a[i + 1], b[i]) a[i + 1] -= beaten2 ans += beaten + beaten2 print(ans)
n = int(eval(input())) a = list(map(int, input().split())) b = list(map(int, input().split())) ans = 0 for i in range(n): # 正面の町を救う beaten = min(a[i], b[i]) b[i] -= beaten # 隣町を救う beaten2 = min(a[i + 1], b[i]) a[i + 1] -= beaten2 ans += beaten + beaten2 print(ans)
false
7.692308
[ "-b.append(0)", "+ # 正面の町を救う", "+ # 隣町を救う" ]
false
0.045608
0.044052
1.035335
[ "s213815884", "s583113105" ]
u450983668
p02995
python
s257742105
s366931057
35
17
5,088
3,064
Accepted
Accepted
51.43
import fractions a,b,c,d=list(map(int, input().split())) cdlcm= c*d//fractions.gcd(c,d) a-=1 tc = b//c-a//c td = b//d-a//d tlcm = b//cdlcm-a//cdlcm print((b-a-tc-td+tlcm))
# gcd: 最大公約数 def gcd(x,y): while y: x, y = y, x%y return x # lcm: 最小公約数 def lcm(x,y): return x*y//gcd(x,y) a,b,c,d=list(map(int,input().split())) a-=1 e=lcm(c,d) tc=b//c-a//c td=b//d-a//d te=b//e-a//e print((b-a-tc-td+te))
8
15
170
238
import fractions a, b, c, d = list(map(int, input().split())) cdlcm = c * d // fractions.gcd(c, d) a -= 1 tc = b // c - a // c td = b // d - a // d tlcm = b // cdlcm - a // cdlcm print((b - a - tc - td + tlcm))
# gcd: 最大公約数 def gcd(x, y): while y: x, y = y, x % y return x # lcm: 最小公約数 def lcm(x, y): return x * y // gcd(x, y) a, b, c, d = list(map(int, input().split())) a -= 1 e = lcm(c, d) tc = b // c - a // c td = b // d - a // d te = b // e - a // e print((b - a - tc - td + te))
false
46.666667
[ "-import fractions", "+# gcd: 最大公約数", "+def gcd(x, y):", "+ while y:", "+ x, y = y, x % y", "+ return x", "+", "+", "+# lcm: 最小公約数", "+def lcm(x, y):", "+ return x * y // gcd(x, y)", "+", "-cdlcm = c * d // fractions.gcd(c, d)", "+e = lcm(c, d)", "-tlcm = b // cdlcm - a /...
false
0.041768
0.039312
1.062484
[ "s257742105", "s366931057" ]
u576432509
p02990
python
s764431490
s996397577
942
216
9,292
9,612
Accepted
Accepted
77.07
mod=10**9+7 def add(a, b): return (a + b) % mod def sub(a, b): return (a + mod - b) % mod def mul(a, b): return ((a % mod) * (b % mod)) % mod def power(x, y): if y == 0 : return 1 elif y == 1 : return x % mod elif y % 2 == 0 : return power(x, y//2)**2 % mod else ...
mod=10**9+7 def add(a, b): return (a + b) % mod def sub(a, b): return (a + mod - b) % mod def mul(a, b): return ((a % mod) * (b % mod)) % mod def power(x, y): if y == 0 : return 1 elif y == 1 : return x % mod elif y % 2 == 0 : return power(x, y//2)**2 % mod else ...
52
64
1,127
1,418
mod = 10**9 + 7 def add(a, b): return (a + b) % mod def sub(a, b): return (a + mod - b) % mod def mul(a, b): return ((a % mod) * (b % mod)) % mod def power(x, y): if y == 0: return 1 elif y == 1: return x % mod elif y % 2 == 0: return power(x, y // 2) ** 2 % mod ...
mod = 10**9 + 7 def add(a, b): return (a + b) % mod def sub(a, b): return (a + mod - b) % mod def mul(a, b): return ((a % mod) * (b % mod)) % mod def power(x, y): if y == 0: return 1 elif y == 1: return x % mod elif y % 2 == 0: return power(x, y // 2) ** 2 % mod ...
false
18.75
[ "+from functools import reduce", "+", "+", "+def cmb2(n, r):", "+ r = min(n - r, r)", "+ if r == 0:", "+ return 1", "+ if r == 1:", "+ return n", "+ over = reduce(mul, list(range(n, n - r, -1)))", "+ under = reduce(mul, list(range(1, r + 1)))", "+ return div(ove...
false
0.13428
0.069985
1.918693
[ "s764431490", "s996397577" ]
u377989038
p02661
python
s407436231
s344234340
521
480
52,612
28,840
Accepted
Accepted
7.87
from statistics import median n = int(eval(input())) ab = [list(map(int, input().split())) for _ in range(n)] a = [i for i, j in ab] b = [j for i, j in ab] if n % 2 == 1: print((abs(median(b) - median(a)) + 1)) else: print((int(abs(median(b) - median(a)) * 2) + 1))
from statistics import median n = int(eval(input())) a = [] b = [] for i in range(n): A, B = list(map(int, input().split())) a.append(A) b.append(B) if n % 2 == 1: print((abs(median(b) - median(a)) + 1)) else: print((int(abs(median(b) - median(a)) * 2) + 1))
11
14
275
277
from statistics import median n = int(eval(input())) ab = [list(map(int, input().split())) for _ in range(n)] a = [i for i, j in ab] b = [j for i, j in ab] if n % 2 == 1: print((abs(median(b) - median(a)) + 1)) else: print((int(abs(median(b) - median(a)) * 2) + 1))
from statistics import median n = int(eval(input())) a = [] b = [] for i in range(n): A, B = list(map(int, input().split())) a.append(A) b.append(B) if n % 2 == 1: print((abs(median(b) - median(a)) + 1)) else: print((int(abs(median(b) - median(a)) * 2) + 1))
false
21.428571
[ "-ab = [list(map(int, input().split())) for _ in range(n)]", "-a = [i for i, j in ab]", "-b = [j for i, j in ab]", "+a = []", "+b = []", "+for i in range(n):", "+ A, B = list(map(int, input().split()))", "+ a.append(A)", "+ b.append(B)" ]
false
0.054585
0.053877
1.013133
[ "s407436231", "s344234340" ]
u761320129
p03293
python
s722080356
s295571420
19
17
3,060
2,940
Accepted
Accepted
10.53
S = eval(input()) T = eval(input()) for i in range(len(S)): if T == S[i:] + S[:i]: print('Yes') break else: print('No')
S = eval(input()) T = eval(input()) for i in range(len(S)): if S[i:] + S[:i] == T: print('Yes') exit() print('No')
9
8
140
130
S = eval(input()) T = eval(input()) for i in range(len(S)): if T == S[i:] + S[:i]: print("Yes") break else: print("No")
S = eval(input()) T = eval(input()) for i in range(len(S)): if S[i:] + S[:i] == T: print("Yes") exit() print("No")
false
11.111111
[ "- if T == S[i:] + S[:i]:", "+ if S[i:] + S[:i] == T:", "- break", "-else:", "- print(\"No\")", "+ exit()", "+print(\"No\")" ]
false
0.038054
0.037692
1.009627
[ "s722080356", "s295571420" ]
u496766105
p03107
python
s112526883
s111880941
29
18
3,188
3,316
Accepted
Accepted
37.93
def count_0_and_1(S): cnt_0 = 0 cnt_1 = 0 for i in S: if i == '0': cnt_0 += 1 if i == '1': cnt_1 += 1 return cnt_0, cnt_1 S = eval(input()) minRB = min(count_0_and_1(S)) print((2*minRB))
def unification(S): cnt_0 = S.count('0') cnt_1 = S.count('1') return 2 * min(cnt_0, cnt_1) S = eval(input()) print((unification(S)))
15
7
251
143
def count_0_and_1(S): cnt_0 = 0 cnt_1 = 0 for i in S: if i == "0": cnt_0 += 1 if i == "1": cnt_1 += 1 return cnt_0, cnt_1 S = eval(input()) minRB = min(count_0_and_1(S)) print((2 * minRB))
def unification(S): cnt_0 = S.count("0") cnt_1 = S.count("1") return 2 * min(cnt_0, cnt_1) S = eval(input()) print((unification(S)))
false
53.333333
[ "-def count_0_and_1(S):", "- cnt_0 = 0", "- cnt_1 = 0", "- for i in S:", "- if i == \"0\":", "- cnt_0 += 1", "- if i == \"1\":", "- cnt_1 += 1", "- return cnt_0, cnt_1", "+def unification(S):", "+ cnt_0 = S.count(\"0\")", "+ cnt_1 = S.count...
false
0.072431
0.07075
1.023759
[ "s112526883", "s111880941" ]
u089230684
p03163
python
s601195394
s024884040
1,191
169
130,652
70,568
Accepted
Accepted
85.81
def main(): n, w = tuple([int(e) for e in input().split()]) items = [] for i in range(n): items.append(tuple([int(e) for e in input().split()])) t = [[0] * (n + 1) for _ in range(w + 1)] for i in range(1, w + 1): for j in range(1, n + 1): if i - items[j - 1]...
n,W = list(map(int,input().split())) w = [] v = [] for x in range(n): peso,valor = list(map(int,input().split())) w.append(peso) v.append(valor) dp = [0] * (W+1) for i in range(n): for j in range(W,-1,-1): if j + w[i] <= W: dp[j+w[i]] = max(dp[j+w[i]], dp[j] + v[i]...
17
24
559
395
def main(): n, w = tuple([int(e) for e in input().split()]) items = [] for i in range(n): items.append(tuple([int(e) for e in input().split()])) t = [[0] * (n + 1) for _ in range(w + 1)] for i in range(1, w + 1): for j in range(1, n + 1): if i - items[j - 1][0] >= 0: ...
n, W = list(map(int, input().split())) w = [] v = [] for x in range(n): peso, valor = list(map(int, input().split())) w.append(peso) v.append(valor) dp = [0] * (W + 1) for i in range(n): for j in range(W, -1, -1): if j + w[i] <= W: dp[j + w[i]] = max(dp[j + w[i]], dp[j] + v[i]) respo...
false
29.166667
[ "-def main():", "- n, w = tuple([int(e) for e in input().split()])", "- items = []", "- for i in range(n):", "- items.append(tuple([int(e) for e in input().split()]))", "- t = [[0] * (n + 1) for _ in range(w + 1)]", "- for i in range(1, w + 1):", "- for j in range(1, n + 1...
false
0.081484
0.079846
1.020508
[ "s601195394", "s024884040" ]
u644907318
p03077
python
s931681769
s522513301
167
63
38,256
61,740
Accepted
Accepted
62.28
N = int(eval(input())) A = [int(eval(input())) for _ in range(5)] a = min(A) n = N//a k = N%a ans = 0 if n>0: ans = 5+(n-1) if k>0: ans += 1 else: if k>0: ans = 5 print(ans)
N = int(eval(input())) A = [int(eval(input())) for _ in range(5)] a = min(A) n = N//a b = N%a if b==0: print((5+n-1)) else: print((5+n))
14
9
202
136
N = int(eval(input())) A = [int(eval(input())) for _ in range(5)] a = min(A) n = N // a k = N % a ans = 0 if n > 0: ans = 5 + (n - 1) if k > 0: ans += 1 else: if k > 0: ans = 5 print(ans)
N = int(eval(input())) A = [int(eval(input())) for _ in range(5)] a = min(A) n = N // a b = N % a if b == 0: print((5 + n - 1)) else: print((5 + n))
false
35.714286
[ "-k = N % a", "-ans = 0", "-if n > 0:", "- ans = 5 + (n - 1)", "- if k > 0:", "- ans += 1", "+b = N % a", "+if b == 0:", "+ print((5 + n - 1))", "- if k > 0:", "- ans = 5", "-print(ans)", "+ print((5 + n))" ]
false
0.037046
0.034482
1.074361
[ "s931681769", "s522513301" ]
u881378225
p03606
python
s383755734
s787411841
22
20
3,188
3,060
Accepted
Accepted
9.09
N=int(eval(input())) sl=[] for i in range(N): sl.append(list(map(int,input().split()))) sl.sort() sl_table = [True for i in range(len(sl))] for i in range(N): for j in range(min(i+1,N),N): if sl[j][0]-sl[i][1]>0: break sl[i]=[min(min(sl[i]),min(sl[j])),max(max(sl[i]),max(sl[j]))] sl_t...
N=int(eval(input())) answer=0 for i in range(N): l,r = list(map(int,input().split())) answer+=r-l+1 print(answer)
15
6
393
110
N = int(eval(input())) sl = [] for i in range(N): sl.append(list(map(int, input().split()))) sl.sort() sl_table = [True for i in range(len(sl))] for i in range(N): for j in range(min(i + 1, N), N): if sl[j][0] - sl[i][1] > 0: break sl[i] = [min(min(sl[i]), min(sl[j])), max(max(sl[i])...
N = int(eval(input())) answer = 0 for i in range(N): l, r = list(map(int, input().split())) answer += r - l + 1 print(answer)
false
60
[ "-sl = []", "+answer = 0", "- sl.append(list(map(int, input().split())))", "-sl.sort()", "-sl_table = [True for i in range(len(sl))]", "-for i in range(N):", "- for j in range(min(i + 1, N), N):", "- if sl[j][0] - sl[i][1] > 0:", "- break", "- sl[i] = [min(min(sl[i])...
false
0.089015
0.119805
0.743
[ "s383755734", "s787411841" ]
u503227287
p02712
python
s766857737
s727296041
73
59
65,052
61,916
Accepted
Accepted
19.18
import sys def in_ctrl(): _input = [_.rstrip() for _ in sys.stdin.readlines()] # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv N = int(_input[0]) # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ return N def out_ctrl(s): print(s) if __name__ == "__main__": N ...
from sys import stdin def __sum(n): return n*(n+1)//2 if __name__ == "__main__": _in = [_.rstrip() for _ in stdin.readlines()] N = int(_in[0]) # type:int # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv cnt = __sum(N)-3*__sum(N//3)-5*__sum(N//5)+15*__sum(N//15) # ^^^^^^^^^^^...
24
14
558
377
import sys def in_ctrl(): _input = [_.rstrip() for _ in sys.stdin.readlines()] # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv N = int(_input[0]) # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ return N def out_ctrl(s): print(s) if __name__ == "__main__": N = in_ctrl() ...
from sys import stdin def __sum(n): return n * (n + 1) // 2 if __name__ == "__main__": _in = [_.rstrip() for _ in stdin.readlines()] N = int(_in[0]) # type:int # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv cnt = __sum(N) - 3 * __sum(N // 3) - 5 * __sum(N // 5) + 15 * __sum(N // 15) ...
false
41.666667
[ "-import sys", "+from sys import stdin", "-def in_ctrl():", "- _input = [_.rstrip() for _ in sys.stdin.readlines()]", "- # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv", "- N = int(_input[0])", "- # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", "- return N", "-", "-",...
false
0.116158
0.036263
3.203175
[ "s766857737", "s727296041" ]
u924406834
p03145
python
s427253942
s043940471
21
17
3,316
2,940
Accepted
Accepted
19.05
a = list(map(int,input().split())) a.sort() print((a[0]*a[1]//2))
R= list(map(int,input().split())) R.sort() print((R[0] * R[1] // 2))
3
3
65
69
a = list(map(int, input().split())) a.sort() print((a[0] * a[1] // 2))
R = list(map(int, input().split())) R.sort() print((R[0] * R[1] // 2))
false
0
[ "-a = list(map(int, input().split()))", "-a.sort()", "-print((a[0] * a[1] // 2))", "+R = list(map(int, input().split()))", "+R.sort()", "+print((R[0] * R[1] // 2))" ]
false
0.037501
0.037332
1.004522
[ "s427253942", "s043940471" ]
u156815136
p02688
python
s069252666
s686468041
33
23
10,872
9,180
Accepted
Accepted
30.3
from statistics import median #import collections #aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] from fractions import gcd from itertools import combinations # (string,3) 3回 from collections import deque from collections import defaultdict import bisect # # d = m - k[i] -...
n,k = list(map(int,input().split())) hito = set() for i in range(k): d = int(eval(input())) oka = list(map(int,input().split())) for j in range(len(oka)): hito.add(oka[j]) print((n - len(hito)))
39
8
874
208
from statistics import median # import collections # aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] from fractions import gcd from itertools import combinations # (string,3) 3回 from collections import deque from collections import defaultdict import bisect # # d = m - k[i] - k[j...
n, k = list(map(int, input().split())) hito = set() for i in range(k): d = int(eval(input())) oka = list(map(int, input().split())) for j in range(len(oka)): hito.add(oka[j]) print((n - len(hito)))
false
79.487179
[ "-from statistics import median", "-", "-# import collections", "-# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]", "-from fractions import gcd", "-from itertools import combinations # (string,3) 3回", "-from collections import deque", "-from collections import defa...
false
0.035369
0.042793
0.826527
[ "s069252666", "s686468041" ]
u643679148
p02641
python
s424324283
s925019339
32
28
9,044
9,056
Accepted
Accepted
12.5
x, n = list(map(int, input().split())) ps = list(map(int, input().split())) pss = [i for i in range(-1000, 1000)] ps = list([i for i in pss if i not in ps]) ans = x for i, p in enumerate(ps): temp = abs(x-p) if i == 0: mins = temp ans = p else: if mins > temp: ...
# -*- coding: utf-8 -*- x, n = list(map(int, input().split())) ps = list(map(int, input().split())) for i in range(0, x+100): for j in [-1, 1]: temp = x + (i*j) if ps.count(temp) == 0: ans = temp break else: continue break print(ans)
20
16
444
306
x, n = list(map(int, input().split())) ps = list(map(int, input().split())) pss = [i for i in range(-1000, 1000)] ps = list([i for i in pss if i not in ps]) ans = x for i, p in enumerate(ps): temp = abs(x - p) if i == 0: mins = temp ans = p else: if mins > temp: mins = te...
# -*- coding: utf-8 -*- x, n = list(map(int, input().split())) ps = list(map(int, input().split())) for i in range(0, x + 100): for j in [-1, 1]: temp = x + (i * j) if ps.count(temp) == 0: ans = temp break else: continue break print(ans)
false
20
[ "+# -*- coding: utf-8 -*-", "-pss = [i for i in range(-1000, 1000)]", "-ps = list([i for i in pss if i not in ps])", "-ans = x", "-for i, p in enumerate(ps):", "- temp = abs(x - p)", "- if i == 0:", "- mins = temp", "- ans = p", "+for i in range(0, x + 100):", "+ for j in ...
false
0.044137
0.037867
1.165575
[ "s424324283", "s925019339" ]
u545368057
p02947
python
s399074064
s903296834
1,884
568
75,864
22,372
Accepted
Accepted
69.85
N = int(eval(input())) alphabet = "abcdefghijklmnopqrstuvwxyz" from collections import defaultdict d = defaultdict(int) for i in range(N): s = eval(input()) num = 0 sorted(alphabet) for i,a in enumerate(alphabet): if s.count(a) == 10: continue #アナグラムはない num += s....
from collections import defaultdict N = int(eval(input())) d = defaultdict(int) for i in range(N): s = str(sorted(eval(input()))) d[s] += 1 ans = 0 for key in list(d.keys()): ans += d[key]*(d[key]-1)//2 print(ans)
20
12
419
220
N = int(eval(input())) alphabet = "abcdefghijklmnopqrstuvwxyz" from collections import defaultdict d = defaultdict(int) for i in range(N): s = eval(input()) num = 0 sorted(alphabet) for i, a in enumerate(alphabet): if s.count(a) == 10: continue # アナグラムはない num += s.count(a) ...
from collections import defaultdict N = int(eval(input())) d = defaultdict(int) for i in range(N): s = str(sorted(eval(input()))) d[s] += 1 ans = 0 for key in list(d.keys()): ans += d[key] * (d[key] - 1) // 2 print(ans)
false
40
[ "-N = int(eval(input()))", "-alphabet = \"abcdefghijklmnopqrstuvwxyz\"", "+N = int(eval(input()))", "- s = eval(input())", "- num = 0", "- sorted(alphabet)", "- for i, a in enumerate(alphabet):", "- if s.count(a) == 10:", "- continue # アナグラムはない", "- num += s.c...
false
0.074517
0.047298
1.575473
[ "s399074064", "s903296834" ]
u254871849
p03206
python
s878211923
s301054650
19
17
3,060
2,940
Accepted
Accepted
10.53
import sys d = int(sys.stdin.readline().rstrip()) def main(): return 'Christmas' + ' Eve' * (25 - d) if __name__ == '__main__': ans = main() print(ans)
import sys d = int(sys.stdin.readline().rstrip()) def main(): print(('Christmas' + ' Eve' * (25 - d))) if __name__ == '__main__': main()
10
9
175
154
import sys d = int(sys.stdin.readline().rstrip()) def main(): return "Christmas" + " Eve" * (25 - d) if __name__ == "__main__": ans = main() print(ans)
import sys d = int(sys.stdin.readline().rstrip()) def main(): print(("Christmas" + " Eve" * (25 - d))) if __name__ == "__main__": main()
false
10
[ "- return \"Christmas\" + \" Eve\" * (25 - d)", "+ print((\"Christmas\" + \" Eve\" * (25 - d)))", "- ans = main()", "- print(ans)", "+ main()" ]
false
0.041798
0.04134
1.011078
[ "s878211923", "s301054650" ]
u405660020
p03999
python
s134102830
s315508713
150
32
69,292
9,056
Accepted
Accepted
78.67
s=eval(input()) l=len(s) def dfs(i,f): if i==l-1: return eval(f) else: return dfs(i+1, f+s[i+1]) + dfs(i+1,f+'+'+s[i+1]) print((dfs(0,s[0])))
s=eval(input()) l=len(s) from itertools import product bits=list(product([0,1], repeat=l-1)) ans=0 for bit in bits: tmp_s=s cnt=0 for i in range(l-1): if bit[i]==1: tmp_s=tmp_s[:i+1+cnt]+'+'+tmp_s[i+1+cnt:] cnt+=1 ans+=eval(tmp_s) print(ans)
10
17
168
302
s = eval(input()) l = len(s) def dfs(i, f): if i == l - 1: return eval(f) else: return dfs(i + 1, f + s[i + 1]) + dfs(i + 1, f + "+" + s[i + 1]) print((dfs(0, s[0])))
s = eval(input()) l = len(s) from itertools import product bits = list(product([0, 1], repeat=l - 1)) ans = 0 for bit in bits: tmp_s = s cnt = 0 for i in range(l - 1): if bit[i] == 1: tmp_s = tmp_s[: i + 1 + cnt] + "+" + tmp_s[i + 1 + cnt :] cnt += 1 ans += eval(tmp_s) p...
false
41.176471
[ "+from itertools import product", "-", "-def dfs(i, f):", "- if i == l - 1:", "- return eval(f)", "- else:", "- return dfs(i + 1, f + s[i + 1]) + dfs(i + 1, f + \"+\" + s[i + 1])", "-", "-", "-print((dfs(0, s[0])))", "+bits = list(product([0, 1], repeat=l - 1))", "+ans = 0"...
false
0.066979
0.042485
1.576546
[ "s134102830", "s315508713" ]
u777923818
p03127
python
s352732085
s151171884
341
64
88,428
20,112
Accepted
Accepted
81.23
from fractions import gcd def inpl(): return list(map(int, input().split())) N = int(eval(input())) A = inpl() a = A[0] for b in A[1:]: a = gcd(a, b) print(a)
# -*- coding: utf-8 -*- import sys from math import gcd from itertools import product def inpl(): return list(map(int, input().split())) N = int(eval(input())) A = inpl() a = A[0] for b in A[1:]: a = gcd(a, b) print(a)
10
12
168
228
from fractions import gcd def inpl(): return list(map(int, input().split())) N = int(eval(input())) A = inpl() a = A[0] for b in A[1:]: a = gcd(a, b) print(a)
# -*- coding: utf-8 -*- import sys from math import gcd from itertools import product def inpl(): return list(map(int, input().split())) N = int(eval(input())) A = inpl() a = A[0] for b in A[1:]: a = gcd(a, b) print(a)
false
16.666667
[ "-from fractions import gcd", "+# -*- coding: utf-8 -*-", "+import sys", "+from math import gcd", "+from itertools import product" ]
false
0.053686
0.045451
1.18117
[ "s352732085", "s151171884" ]
u113971909
p03910
python
s505975777
s410136666
22
20
3,316
3,572
Accepted
Accepted
9.09
N = int(eval(input())) r=int((2*N+.25)**0.5 - 0.5)+1 for i in range(1,r+1): if i!=r*(r+1)//2-N: print(i)
N=int(input()) r=int((2*N+.25)**0.5 + 0.5) l=r*(r+1)//2-N [print(i) for i in list(range(1,r+1)) if i!=l]
5
4
108
107
N = int(eval(input())) r = int((2 * N + 0.25) ** 0.5 - 0.5) + 1 for i in range(1, r + 1): if i != r * (r + 1) // 2 - N: print(i)
N = int(input()) r = int((2 * N + 0.25) ** 0.5 + 0.5) l = r * (r + 1) // 2 - N [print(i) for i in list(range(1, r + 1)) if i != l]
false
20
[ "-N = int(eval(input()))", "-r = int((2 * N + 0.25) ** 0.5 - 0.5) + 1", "-for i in range(1, r + 1):", "- if i != r * (r + 1) // 2 - N:", "- print(i)", "+N = int(input())", "+r = int((2 * N + 0.25) ** 0.5 + 0.5)", "+l = r * (r + 1) // 2 - N", "+[print(i) for i in list(range(1, r + 1)) if i ...
false
0.045599
0.112593
0.404985
[ "s505975777", "s410136666" ]