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
u705202612
p02718
python
s931413307
s269164530
199
173
38,512
38,384
Accepted
Accepted
13.07
N,M=list(map(int,input().split())) List=list(map(int,input().split())) Lists=list() for i in List: if i/sum(List)>=1/(4*M): Lists.append(i) print(("Yes" if len(Lists)>=M else "No"))
N,M=list(map(int,input().split())) A=list(map(int,input().split())) S=sum(A) B=sorted(A)[::-1] if B[M-1]>=S/(4*M): print("Yes") else: print("No")
9
8
196
154
N, M = list(map(int, input().split())) List = list(map(int, input().split())) Lists = list() for i in List: if i / sum(List) >= 1 / (4 * M): Lists.append(i) print(("Yes" if len(Lists) >= M else "No"))
N, M = list(map(int, input().split())) A = list(map(int, input().split())) S = sum(A) B = sorted(A)[::-1] if B[M - 1] >= S / (4 * M): print("Yes") else: print("No")
false
11.111111
[ "-List = list(map(int, input().split()))", "-Lists = list()", "-for i in List:", "- if i / sum(List) >= 1 / (4 * M):", "- Lists.append(i)", "-print((\"Yes\" if len(Lists) >= M else \"No\"))", "+A = list(map(int, input().split()))", "+S = sum(A)", "+B = sorted(A)[::-1]", "+if B[M - 1] >= ...
false
0.036918
0.034095
1.082815
[ "s931413307", "s269164530" ]
u147628962
p03614
python
s653822185
s275024945
78
68
14,324
13,880
Accepted
Accepted
12.82
import copy as c n=int(eval(input())) lis=[int(a) for a in input().split()] count=0 alis=c.copy(lis) alis=sorted(alis) prev=False for i in range(n): if lis[i]==alis[i]: if not prev: count+=1 prev=True continue prev=False print(count) #wrong solutiuon
#import copy as c n=int(eval(input())) lis=[int(a) for a in input().split()] count=0 prev=False for i in range(n): if lis[i]==i+1: if not prev: count+=1 prev=True continue prev=False print(count) #wrong solutiuon
17
15
274
234
import copy as c n = int(eval(input())) lis = [int(a) for a in input().split()] count = 0 alis = c.copy(lis) alis = sorted(alis) prev = False for i in range(n): if lis[i] == alis[i]: if not prev: count += 1 prev = True continue prev = False print(count) # wrong solut...
# import copy as c n = int(eval(input())) lis = [int(a) for a in input().split()] count = 0 prev = False for i in range(n): if lis[i] == i + 1: if not prev: count += 1 prev = True continue prev = False print(count) # wrong solutiuon
false
11.764706
[ "-import copy as c", "-", "+# import copy as c", "-alis = c.copy(lis)", "-alis = sorted(alis)", "- if lis[i] == alis[i]:", "+ if lis[i] == i + 1:" ]
false
0.045831
0.043134
1.062522
[ "s653822185", "s275024945" ]
u588341295
p03775
python
s559530791
s250961081
50
29
3,188
3,316
Accepted
Accepted
42
# -*- coding: utf-8 -*- N = int(eval(input())) aN = [] i = 1 # かけ合わせる数の左右逆はやる意味ない while i <= N//i: if N % i == 0: aN.append([i, N//i]) i += 1 # 末尾に格納されたペアの右側の数値 print((len(str(aN[-1][1]))))
# -*- coding: utf-8 -*- import sys def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ...
14
44
213
1,179
# -*- coding: utf-8 -*- N = int(eval(input())) aN = [] i = 1 # かけ合わせる数の左右逆はやる意味ない while i <= N // i: if N % i == 0: aN.append([i, N // i]) i += 1 # 末尾に格納されたペアの右側の数値 print((len(str(aN[-1][1]))))
# -*- coding: utf-8 -*- import sys def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in rang...
false
68.181818
[ "-N = int(eval(input()))", "-aN = []", "-i = 1", "-# かけ合わせる数の左右逆はやる意味ない", "-while i <= N // i:", "- if N % i == 0:", "- aN.append([i, N // i])", "- i += 1", "-# 末尾に格納されたペアの右側の数値", "-print((len(str(aN[-1][1]))))", "+import sys", "+", "+", "+def input():", "+ return sys.std...
false
0.045446
0.041276
1.101018
[ "s559530791", "s250961081" ]
u519939795
p03243
python
s222536297
s297946990
19
17
3,064
2,940
Accepted
Accepted
10.53
n=int(eval(input())) if 100<=n<=111: print((111)) elif 112<=n<=222: print((222)) elif 223<=n<=333: print((333)) elif 334<=n<=444: print((444)) elif 445<=n<=555: print((555)) elif 556<=n<=666: print((666)) elif 667<=n<=777: print((777)) elif 778<=n<=888: print((888)) elif...
n=int(eval(input())) L=[111,222,333,444,555,666,777,888,999] for i in L: if n<=i: print(i) break
19
6
327
115
n = int(eval(input())) if 100 <= n <= 111: print((111)) elif 112 <= n <= 222: print((222)) elif 223 <= n <= 333: print((333)) elif 334 <= n <= 444: print((444)) elif 445 <= n <= 555: print((555)) elif 556 <= n <= 666: print((666)) elif 667 <= n <= 777: print((777)) elif 778 <= n <= 888: ...
n = int(eval(input())) L = [111, 222, 333, 444, 555, 666, 777, 888, 999] for i in L: if n <= i: print(i) break
false
68.421053
[ "-if 100 <= n <= 111:", "- print((111))", "-elif 112 <= n <= 222:", "- print((222))", "-elif 223 <= n <= 333:", "- print((333))", "-elif 334 <= n <= 444:", "- print((444))", "-elif 445 <= n <= 555:", "- print((555))", "-elif 556 <= n <= 666:", "- print((666))", "-elif 667 <...
false
0.042236
0.043787
0.964587
[ "s222536297", "s297946990" ]
u189023301
p02683
python
s858322255
s326240140
88
78
68,708
9,524
Accepted
Accepted
11.36
n, m, x = list(map(int, input().split())) C = [] M = [] for _ in range(n): c, *mi = list(map(int, input().split())) C.append(c) M.append(mi) res = 10**10 for i in range(1 << n): tmp = 0 cnt = [0] * m for j in range(n): if (i >> j) & 1 == 1: tmp += C[j] ...
from itertools import product n, m, x = list(map(int, input().split())) C = [] M = [] for _ in range(n): c, *mi = list(map(int, input().split())) C.append(c) M.append(mi) sta = list(product((0, 1), repeat=n)) res = 10**10 for k in sta: tmp = 0 cnt = [0] * m for j in range(n)...
26
29
482
536
n, m, x = list(map(int, input().split())) C = [] M = [] for _ in range(n): c, *mi = list(map(int, input().split())) C.append(c) M.append(mi) res = 10**10 for i in range(1 << n): tmp = 0 cnt = [0] * m for j in range(n): if (i >> j) & 1 == 1: tmp += C[j] for k in ra...
from itertools import product n, m, x = list(map(int, input().split())) C = [] M = [] for _ in range(n): c, *mi = list(map(int, input().split())) C.append(c) M.append(mi) sta = list(product((0, 1), repeat=n)) res = 10**10 for k in sta: tmp = 0 cnt = [0] * m for j in range(n): if k[j] ==...
false
10.344828
[ "+from itertools import product", "+", "+sta = list(product((0, 1), repeat=n))", "-for i in range(1 << n):", "+for k in sta:", "- if (i >> j) & 1 == 1:", "+ if k[j] == 1:", "- for k in range(m):", "- cnt[k] += M[j][k]", "+ for l in range(m):", "...
false
0.038534
0.042869
0.898876
[ "s858322255", "s326240140" ]
u073852194
p02771
python
s596737161
s832335304
184
17
38,256
2,940
Accepted
Accepted
90.76
A,B,C = list(map(int,input().split())) if A==B and A!=C: print('Yes') elif B==C and C!=A: print('Yes') elif C==A and A!=B: print('Yes') else: print('No')
#!/usr/bin/env python3 #import sys; sys.stdin=open('input_file.txt') #------------------------------------------ S = set(map(int,input().split())) print(('Yes' if len(S)==2 else 'No'))
9
5
171
187
A, B, C = list(map(int, input().split())) if A == B and A != C: print("Yes") elif B == C and C != A: print("Yes") elif C == A and A != B: print("Yes") else: print("No")
#!/usr/bin/env python3 # import sys; sys.stdin=open('input_file.txt') # ------------------------------------------ S = set(map(int, input().split())) print(("Yes" if len(S) == 2 else "No"))
false
44.444444
[ "-A, B, C = list(map(int, input().split()))", "-if A == B and A != C:", "- print(\"Yes\")", "-elif B == C and C != A:", "- print(\"Yes\")", "-elif C == A and A != B:", "- print(\"Yes\")", "-else:", "- print(\"No\")", "+#!/usr/bin/env python3", "+# import sys; sys.stdin=open('input_fi...
false
0.087733
0.046366
1.892191
[ "s596737161", "s832335304" ]
u631277801
p03625
python
s281031715
s094671341
213
153
21,540
18,728
Accepted
Accepted
28.17
import sys stdin = sys.stdin def li(): return list(map(int, stdin.readline().split())) def li_(): return [int(x)-1 for x in stdin.readline().split()] def lf(): return list(map(float, stdin.readline().split())) def ls(): return stdin.readline().split() def ns(): return stdin.readline().rstrip() def lc(): return...
import sys stdin = sys.stdin sys.setrecursionlimit(10**5) def li(): return list(map(int, stdin.readline().split())) def li_(): return [int(x)-1 for x in stdin.readline().split()] def lf(): return list(map(float, stdin.readline().split())) def ls(): return stdin.readline().split() def ns(): return stdin.re...
46
42
915
920
import sys stdin = sys.stdin def li(): return list(map(int, stdin.readline().split())) def li_(): return [int(x) - 1 for x in stdin.readline().split()] def lf(): return list(map(float, stdin.readline().split())) def ls(): return stdin.readline().split() def ns(): return stdin.readline().r...
import sys stdin = sys.stdin sys.setrecursionlimit(10**5) def li(): return list(map(int, stdin.readline().split())) def li_(): return [int(x) - 1 for x in stdin.readline().split()] def lf(): return list(map(float, stdin.readline().split())) def ls(): return stdin.readline().split() def ns(): ...
false
8.695652
[ "+sys.setrecursionlimit(10**5)", "-lst = []", "-for k, v in list(cnt.items()):", "- lst.append((k, v))", "-lst.sort(reverse=True)", "-for k, v in lst:", "- if v >= 4 and first == 0:", "+keys = list(cnt.keys())", "+keys.sort(reverse=True)", "+for k in keys:", "+ if first != 0 and second ...
false
0.037931
0.0381
0.995551
[ "s281031715", "s094671341" ]
u562935282
p03038
python
s691402485
s099372082
1,159
836
48,452
93,464
Accepted
Accepted
27.87
from collections import Counter from heapq import heapify, heappop, heappush class Data: def __init__(self, value, count): self.value = value self.count = count def __lt__(self, other): return self.value > other.value # 降順に取り出す N, M = list(map(int, input().split())...
from heapq import heapify, heappush, heappop N, M = list(map(int, input().split())) a = list(map(int, input().split())) hq = list([(-x, 1) for x in a]) heapify(hq) for _ in range(M): b, c = list(map(int, input().split())) heappush(hq, (-c, b)) rest = N ans = 0 while rest > 0 and hq: mv, b...
36
21
706
410
from collections import Counter from heapq import heapify, heappop, heappush class Data: def __init__(self, value, count): self.value = value self.count = count def __lt__(self, other): return self.value > other.value # 降順に取り出す N, M = list(map(int, input().split())) a = list(ma...
from heapq import heapify, heappush, heappop N, M = list(map(int, input().split())) a = list(map(int, input().split())) hq = list([(-x, 1) for x in a]) heapify(hq) for _ in range(M): b, c = list(map(int, input().split())) heappush(hq, (-c, b)) rest = N ans = 0 while rest > 0 and hq: mv, b = heappop(hq) ...
false
41.666667
[ "-from collections import Counter", "-from heapq import heapify, heappop, heappush", "-", "-", "-class Data:", "- def __init__(self, value, count):", "- self.value = value", "- self.count = count", "-", "- def __lt__(self, other):", "- return self.value > other.value",...
false
0.03587
0.03918
0.915519
[ "s691402485", "s099372082" ]
u606033239
p03448
python
s462103446
s419400695
52
21
3,060
3,316
Accepted
Accepted
59.62
a = int(eval(input())) b = int(eval(input())) c = int(eval(input())) x = int(eval(input())) s = 0 for i in range(a+1): for j in range(b+1): for l in range(c+1): if 500*i+100*j+50*l == x: s += 1 print(s)
t = list(int(eval(input())) for _ in range(3)) x = int(eval(input())) c = 0 for i in range(min(x//500,t[0])+1): a = t[:] d = x-500*i if d <= 100*a[1]+50*a[2]: for j in range(a[1]+1): if d >= 100*j: r = d-100*j if r <= 50*a[2]: ...
12
15
231
368
a = int(eval(input())) b = int(eval(input())) c = int(eval(input())) x = int(eval(input())) s = 0 for i in range(a + 1): for j in range(b + 1): for l in range(c + 1): if 500 * i + 100 * j + 50 * l == x: s += 1 print(s)
t = list(int(eval(input())) for _ in range(3)) x = int(eval(input())) c = 0 for i in range(min(x // 500, t[0]) + 1): a = t[:] d = x - 500 * i if d <= 100 * a[1] + 50 * a[2]: for j in range(a[1] + 1): if d >= 100 * j: r = d - 100 * j if r <= 50 * a[2]: ...
false
20
[ "-a = int(eval(input()))", "-b = int(eval(input()))", "-c = int(eval(input()))", "+t = list(int(eval(input())) for _ in range(3))", "-s = 0", "-for i in range(a + 1):", "- for j in range(b + 1):", "- for l in range(c + 1):", "- if 500 * i + 100 * j + 50 * l == x:", "- ...
false
0.093601
0.03915
2.390847
[ "s462103446", "s419400695" ]
u456353530
p03030
python
s685035523
s832673425
166
65
38,512
62,844
Accepted
Accepted
60.84
N = int(eval(input())) SP = [input().split() for _ in range(N)] L = [] for i in range(N): L.append([SP[i][0], int(SP[i][1]), i + 1]) L.sort(key = lambda x: x[1], reverse = True) L.sort(key = lambda x: x[0]) for i in L: print((i[2]))
N = int(eval(input())) SP = [list(input().split()) + [i + 1] for i in range(N)] for i in range(N): SP[i][1] = -int(SP[i][1]) SP.sort() for i in range(N): print((SP[i][2]))
12
10
242
179
N = int(eval(input())) SP = [input().split() for _ in range(N)] L = [] for i in range(N): L.append([SP[i][0], int(SP[i][1]), i + 1]) L.sort(key=lambda x: x[1], reverse=True) L.sort(key=lambda x: x[0]) for i in L: print((i[2]))
N = int(eval(input())) SP = [list(input().split()) + [i + 1] for i in range(N)] for i in range(N): SP[i][1] = -int(SP[i][1]) SP.sort() for i in range(N): print((SP[i][2]))
false
16.666667
[ "-SP = [input().split() for _ in range(N)]", "-L = []", "+SP = [list(input().split()) + [i + 1] for i in range(N)]", "- L.append([SP[i][0], int(SP[i][1]), i + 1])", "-L.sort(key=lambda x: x[1], reverse=True)", "-L.sort(key=lambda x: x[0])", "-for i in L:", "- print((i[2]))", "+ SP[i][1] = -...
false
0.035356
0.034632
1.020902
[ "s685035523", "s832673425" ]
u764600134
p03078
python
s201243148
s068444880
879
283
9,564
46,620
Accepted
Accepted
67.8
# -*- coding: utf-8 -*- """ D - Cake 123 https://atcoder.jp/contests/abc123/tasks/abc123_d AC """ import sys from itertools import product def solve(X, Y, Z, K, A, B, C): # 解説の解法#2 A.sort(reverse=True) B.sort(reverse=True) C.sort(reverse=True) res = [] for i, a in enumerate(A...
# -*- coding: utf-8 -*- """ D - Cake 123 https://atcoder.jp/contests/abc123/tasks/abc123_d AC """ import sys def solve(X, Y, Z, K, A, B, C): # 解説の解法#2 A.sort(reverse=True) B.sort(reverse=True) C.sort(reverse=True) res = [] for i, a in enumerate(A, start=1): for j, b in en...
37
34
874
839
# -*- coding: utf-8 -*- """ D - Cake 123 https://atcoder.jp/contests/abc123/tasks/abc123_d AC """ import sys from itertools import product def solve(X, Y, Z, K, A, B, C): # 解説の解法#2 A.sort(reverse=True) B.sort(reverse=True) C.sort(reverse=True) res = [] for i, a in enumerate(A, start=1): ...
# -*- coding: utf-8 -*- """ D - Cake 123 https://atcoder.jp/contests/abc123/tasks/abc123_d AC """ import sys def solve(X, Y, Z, K, A, B, C): # 解説の解法#2 A.sort(reverse=True) B.sort(reverse=True) C.sort(reverse=True) res = [] for i, a in enumerate(A, start=1): for j, b in enumerate(B, sta...
false
8.108108
[ "-from itertools import product" ]
false
0.052688
0.041682
1.264056
[ "s201243148", "s068444880" ]
u912237403
p00024
python
s570068364
s298189259
20
10
4,368
4,352
Accepted
Accepted
50
import math while True: try: v = eval(input()) t = v/9.8 y = v/2*t n = math.ceil(y/5.0)+1 print(int(n)) except: break
import math,sys for e in sys.stdin: v=float(e[:-1]) t=v/9.8 y=v/2*t n=int(math.ceil(y/5))+1 print(n)
11
7
177
125
import math while True: try: v = eval(input()) t = v / 9.8 y = v / 2 * t n = math.ceil(y / 5.0) + 1 print(int(n)) except: break
import math, sys for e in sys.stdin: v = float(e[:-1]) t = v / 9.8 y = v / 2 * t n = int(math.ceil(y / 5)) + 1 print(n)
false
36.363636
[ "-import math", "+import math, sys", "-while True:", "- try:", "- v = eval(input())", "- t = v / 9.8", "- y = v / 2 * t", "- n = math.ceil(y / 5.0) + 1", "- print(int(n))", "- except:", "- break", "+for e in sys.stdin:", "+ v = float(e[:-1])...
false
0.045343
0.044251
1.024675
[ "s570068364", "s298189259" ]
u610192658
p03324
python
s787869788
s144788974
19
17
2,940
2,940
Accepted
Accepted
10.53
D, N = list(map(int, input().split(" "))) if N != 100: print(((100**D)*N)) else: print(((100**D)*(N+1)))
D, N = list(map(int, input().split(" "))) print(((100**D)*(N+(N//100))))
6
3
107
70
D, N = list(map(int, input().split(" "))) if N != 100: print(((100**D) * N)) else: print(((100**D) * (N + 1)))
D, N = list(map(int, input().split(" "))) print(((100**D) * (N + (N // 100))))
false
50
[ "-if N != 100:", "- print(((100**D) * N))", "-else:", "- print(((100**D) * (N + 1)))", "+print(((100**D) * (N + (N // 100))))" ]
false
0.0425
0.043695
0.972647
[ "s787869788", "s144788974" ]
u077291787
p03137
python
s417891896
s535925610
83
76
18,960
14,972
Accepted
Accepted
8.43
# ABC117C - Streamline def main(): n, m = list(map(int, input().split())) lst = sorted(set(map(int, input().split()))) dis = [] for i, j in zip(lst, lst[1:]): dis += [j - i] print((sum(sorted(dis, reverse=True)[n - 1 :]))) if __name__ == "__main__": main()
# ABC117C - Streamline def main(): N, M, *X = list(map(int, open(0).read().split())) X = sorted(set(X)) dist = [] for i, j in zip(X, X[1:]): dist.append(j - i) dist.sort(reverse=1) ans = sum(dist[N - 1 :]) print(ans) if __name__ == "__main__": main()
12
14
294
299
# ABC117C - Streamline def main(): n, m = list(map(int, input().split())) lst = sorted(set(map(int, input().split()))) dis = [] for i, j in zip(lst, lst[1:]): dis += [j - i] print((sum(sorted(dis, reverse=True)[n - 1 :]))) if __name__ == "__main__": main()
# ABC117C - Streamline def main(): N, M, *X = list(map(int, open(0).read().split())) X = sorted(set(X)) dist = [] for i, j in zip(X, X[1:]): dist.append(j - i) dist.sort(reverse=1) ans = sum(dist[N - 1 :]) print(ans) if __name__ == "__main__": main()
false
14.285714
[ "- n, m = list(map(int, input().split()))", "- lst = sorted(set(map(int, input().split())))", "- dis = []", "- for i, j in zip(lst, lst[1:]):", "- dis += [j - i]", "- print((sum(sorted(dis, reverse=True)[n - 1 :])))", "+ N, M, *X = list(map(int, open(0).read().split()))", "+ ...
false
0.034767
0.036207
0.960232
[ "s417891896", "s535925610" ]
u896588506
p02882
python
s281494252
s870822200
98
90
74,896
75,184
Accepted
Accepted
8.16
import bisect,collections,copy,itertools,math,string import sys def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def main(): a,b,x...
import bisect,collections,copy,itertools,math,string import sys def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def main(): a,b,x...
17
27
520
771
import bisect, collections, copy, itertools, math, string import sys def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()...
import bisect, collections, copy, itertools, math, string import sys def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()...
false
37.037037
[ "- ans = 0", "- if x >= a**2 * b / 2:", "- ans = math.degrees(math.atan((a**2 * b - x) * 2 / a**3))", "- else:", "- ans = math.degrees(math.atan(a * b**2 / (2 * x)))", "+ ok = 0", "+ ng = 90", "+ while ng - ok >= 10 ** (-8):", "+ middle = (ng + ok) / 2", "+ ...
false
0.098826
0.113152
0.873393
[ "s281494252", "s870822200" ]
u346194435
p03069
python
s913691522
s907417602
98
79
3,628
3,500
Accepted
Accepted
19.39
N = int(eval(input())) S = eval(input()) w = S.count('.') ans = 10**9 cost = 0 for s in S: w -= s == '.' ans = w + cost if w + cost< ans else ans cost += s == '#' print(ans)
_ = int(eval(input())) S = eval(input()) ans = 10**9 cost = S.count('.') for s in S: cost -= s == '.' ans = cost if cost< ans else ans cost += s == '#' print(ans)
11
9
184
170
N = int(eval(input())) S = eval(input()) w = S.count(".") ans = 10**9 cost = 0 for s in S: w -= s == "." ans = w + cost if w + cost < ans else ans cost += s == "#" print(ans)
_ = int(eval(input())) S = eval(input()) ans = 10**9 cost = S.count(".") for s in S: cost -= s == "." ans = cost if cost < ans else ans cost += s == "#" print(ans)
false
18.181818
[ "-N = int(eval(input()))", "+_ = int(eval(input()))", "-w = S.count(\".\")", "-cost = 0", "+cost = S.count(\".\")", "- w -= s == \".\"", "- ans = w + cost if w + cost < ans else ans", "+ cost -= s == \".\"", "+ ans = cost if cost < ans else ans" ]
false
0.0365
0.036893
0.989331
[ "s913691522", "s907417602" ]
u729133443
p02787
python
s200678532
s213475263
1,858
374
3,572
44,524
Accepted
Accepted
79.87
def main(): h,n,*t=list(map(int,open(0).read().split())) d=[0]+[10**18]*h for a,b in zip(*[iter(t)]*2): for j in range(h+1): k=j-a if k<0:k=0 c=d[k]+b if c<d[j]:d[j]=c print((d[h])) main()
intLine=lambda:list(map(int,input().split())) h,n=intLine() dp=[10**9]*(h+1) dp[0]=0 for _ in range(n): a,b=intLine() for j in range(h+1): dp[j]=min(dp[j],dp[max(0,j-a)]+b) print((dp[h]))
11
9
262
195
def main(): h, n, *t = list(map(int, open(0).read().split())) d = [0] + [10**18] * h for a, b in zip(*[iter(t)] * 2): for j in range(h + 1): k = j - a if k < 0: k = 0 c = d[k] + b if c < d[j]: d[j] = c print((d[h])) ...
intLine = lambda: list(map(int, input().split())) h, n = intLine() dp = [10**9] * (h + 1) dp[0] = 0 for _ in range(n): a, b = intLine() for j in range(h + 1): dp[j] = min(dp[j], dp[max(0, j - a)] + b) print((dp[h]))
false
18.181818
[ "-def main():", "- h, n, *t = list(map(int, open(0).read().split()))", "- d = [0] + [10**18] * h", "- for a, b in zip(*[iter(t)] * 2):", "- for j in range(h + 1):", "- k = j - a", "- if k < 0:", "- k = 0", "- c = d[k] + b", "- ...
false
0.33822
0.130575
2.590246
[ "s200678532", "s213475263" ]
u790710233
p03732
python
s216585450
s457870943
304
42
3,316
3,316
Accepted
Accepted
86.18
from collections import defaultdict n, W = list(map(int, input().split())) dd = defaultdict(list) for i in range(n): weight, value = list(map(int, input().split())) dd[weight].append(value) a = min(dd.keys()) b, c, d = a+1, a+2, a+3 Vcum = defaultdict(lambda: [0]) for k in [a, b, c, d]: s = 0 ...
from collections import defaultdict n, W = list(map(int, input().split())) dd = defaultdict(list) for i in range(n): weight, value = list(map(int, input().split())) dd[weight].append(value) a = min(dd.keys()) b, c, d = a+1, a+2, a+3 Vcum = defaultdict(lambda: [0]) for k in [a, b, c, d]: s = 0 ...
27
27
750
737
from collections import defaultdict n, W = list(map(int, input().split())) dd = defaultdict(list) for i in range(n): weight, value = list(map(int, input().split())) dd[weight].append(value) a = min(dd.keys()) b, c, d = a + 1, a + 2, a + 3 Vcum = defaultdict(lambda: [0]) for k in [a, b, c, d]: s = 0 dd[...
from collections import defaultdict n, W = list(map(int, input().split())) dd = defaultdict(list) for i in range(n): weight, value = list(map(int, input().split())) dd[weight].append(value) a = min(dd.keys()) b, c, d = a + 1, a + 2, a + 3 Vcum = defaultdict(lambda: [0]) for k in [a, b, c, d]: s = 0 dd[...
false
0
[ "- for z in range(len(dd[d]) + 1):", "- if W < a * w + b * x + c * y + d * z:", "- continue", "- val = Vcum[a][w] + Vcum[b][x] + Vcum[c][y] + Vcum[d][z]", "- ans = max(ans, val)", "+ if W < a * w + b * x + c * y:", "+ ...
false
0.039559
0.072173
0.548114
[ "s216585450", "s457870943" ]
u332385682
p03734
python
s954288086
s233341660
340
44
68,060
3,188
Accepted
Accepted
87.06
import sys inf = 1 << 32 def solve(): N, W = list(map(int, input().split())) ws = [] vs = [] for i in range(N): wi, vi = list(map(int, input().split())) ws.append(wi) vs.append(vi) dp = [[[-inf]*(3*N + 1) for j in range(N + 1)] ...
import sys def solve(): N, W = list(map(int, input().split())) v = [[] for i in range(4)] for i in range(N): wi, vi = list(map(int, input().split())) if i == 0: base = wi v[0].append(vi) else: v[wi - base].append(vi) for i in...
38
39
882
845
import sys inf = 1 << 32 def solve(): N, W = list(map(int, input().split())) ws = [] vs = [] for i in range(N): wi, vi = list(map(int, input().split())) ws.append(wi) vs.append(vi) dp = [[[-inf] * (3 * N + 1) for j in range(N + 1)] for i in range(N + 1)] dp[0][0][0] = ...
import sys def solve(): N, W = list(map(int, input().split())) v = [[] for i in range(4)] for i in range(N): wi, vi = list(map(int, input().split())) if i == 0: base = wi v[0].append(vi) else: v[wi - base].append(vi) for i in range(4): ...
false
2.564103
[ "-", "-inf = 1 << 32", "- ws = []", "- vs = []", "+ v = [[] for i in range(4)]", "- ws.append(wi)", "- vs.append(vi)", "- dp = [[[-inf] * (3 * N + 1) for j in range(N + 1)] for i in range(N + 1)]", "- dp[0][0][0] = 0", "- for i in range(N):", "- for j in ra...
false
0.057562
0.037737
1.525335
[ "s954288086", "s233341660" ]
u094191970
p03721
python
s724842366
s782982786
364
324
10,856
10,592
Accepted
Accepted
10.99
from collections import defaultdict n,k=list(map(int,input().split())) d=defaultdict(int) for i in range(n): a,b=list(map(int,input().split())) d[a]+=b l=sorted(d.keys()) cnt=0 for i in l: cnt+=d[i] if cnt>=k: print(i) exit()
n,k=list(map(int,input().split())) d={} for i in range(n): a,b=list(map(int,input().split())) if a in d: d[a]+=b else: d[a]=b d_keys=sorted(d.keys()) cnt=0 for i in d_keys: cnt+=d[i] if cnt>=k: print(i) exit()
14
17
259
241
from collections import defaultdict n, k = list(map(int, input().split())) d = defaultdict(int) for i in range(n): a, b = list(map(int, input().split())) d[a] += b l = sorted(d.keys()) cnt = 0 for i in l: cnt += d[i] if cnt >= k: print(i) exit()
n, k = list(map(int, input().split())) d = {} for i in range(n): a, b = list(map(int, input().split())) if a in d: d[a] += b else: d[a] = b d_keys = sorted(d.keys()) cnt = 0 for i in d_keys: cnt += d[i] if cnt >= k: print(i) exit()
false
17.647059
[ "-from collections import defaultdict", "-", "-d = defaultdict(int)", "+d = {}", "- d[a] += b", "-l = sorted(d.keys())", "+ if a in d:", "+ d[a] += b", "+ else:", "+ d[a] = b", "+d_keys = sorted(d.keys())", "-for i in l:", "+for i in d_keys:" ]
false
0.0365
0.077357
0.471834
[ "s724842366", "s782982786" ]
u197457087
p02615
python
s423152010
s170563531
334
207
106,992
31,524
Accepted
Accepted
38.02
from heapq import heapify, heappop, heappush N = int(eval(input())) A = list(map(int,input().split())) A.sort(reverse = True) #print(A) ans = A[0] Q = [(-A[1],-A[0]),(-A[1],-A[0])] #一つ目が大きいほうへ入れる heapify(Q) for i in range(2,N): nxt = A[i] s,t = heappop(Q) s *= -1; t*= -1 #正に戻す #print(s,ans) ans +...
N = int(eval(input())) A = list(map(int,input().split())) A.sort(reverse=True) B = [A[0]] for i in range(N-1): B.append(A[i+1]) B.append(A[i+1]) #print(B) ans = 0 for i in range(N-1): ans += B[i] print(ans)
22
12
418
217
from heapq import heapify, heappop, heappush N = int(eval(input())) A = list(map(int, input().split())) A.sort(reverse=True) # print(A) ans = A[0] Q = [(-A[1], -A[0]), (-A[1], -A[0])] # 一つ目が大きいほうへ入れる heapify(Q) for i in range(2, N): nxt = A[i] s, t = heappop(Q) s *= -1 t *= -1 # 正に戻す # print(s,an...
N = int(eval(input())) A = list(map(int, input().split())) A.sort(reverse=True) B = [A[0]] for i in range(N - 1): B.append(A[i + 1]) B.append(A[i + 1]) # print(B) ans = 0 for i in range(N - 1): ans += B[i] print(ans)
false
45.454545
[ "-from heapq import heapify, heappop, heappush", "-", "-# print(A)", "-ans = A[0]", "-Q = [(-A[1], -A[0]), (-A[1], -A[0])] # 一つ目が大きいほうへ入れる", "-heapify(Q)", "-for i in range(2, N):", "- nxt = A[i]", "- s, t = heappop(Q)", "- s *= -1", "- t *= -1 # 正に戻す", "- # print(s,ans)", "...
false
0.046595
0.084528
0.551239
[ "s423152010", "s170563531" ]
u780698286
p02909
python
s903303185
s303904132
25
21
8,872
8,928
Accepted
Accepted
16
s = eval(input()) wether = ["Sunny", "Cloudy", "Rainy", "Sunny"] print((wether[wether.index(s) + 1]))
l = ["Sunny", "Cloudy", "Rainy", "Sunny"] s = eval(input()) print((l[l.index(s) + 1]))
3
3
95
81
s = eval(input()) wether = ["Sunny", "Cloudy", "Rainy", "Sunny"] print((wether[wether.index(s) + 1]))
l = ["Sunny", "Cloudy", "Rainy", "Sunny"] s = eval(input()) print((l[l.index(s) + 1]))
false
0
[ "+l = [\"Sunny\", \"Cloudy\", \"Rainy\", \"Sunny\"]", "-wether = [\"Sunny\", \"Cloudy\", \"Rainy\", \"Sunny\"]", "-print((wether[wether.index(s) + 1]))", "+print((l[l.index(s) + 1]))" ]
false
0.036749
0.038694
0.949721
[ "s903303185", "s303904132" ]
u054871430
p03470
python
s790256018
s388947378
173
63
38,384
62,388
Accepted
Accepted
63.58
n, *d = list(map(int, open(0).read().split())) d.sort() ans = 0 scale = 0 for i in d: if scale < i: ans += 1 scale = i print(ans)
import sys sys.setrecursionlimit(10**9) def main(): n = int(eval(input())) d = [int(eval(input())) for i in range(n)] d = set(d) print((len(d))) return if __name__ == "__main__": main() sys.exit(0)
12
15
153
229
n, *d = list(map(int, open(0).read().split())) d.sort() ans = 0 scale = 0 for i in d: if scale < i: ans += 1 scale = i print(ans)
import sys sys.setrecursionlimit(10**9) def main(): n = int(eval(input())) d = [int(eval(input())) for i in range(n)] d = set(d) print((len(d))) return if __name__ == "__main__": main() sys.exit(0)
false
20
[ "-n, *d = list(map(int, open(0).read().split()))", "-d.sort()", "-ans = 0", "-scale = 0", "-for i in d:", "- if scale < i:", "- ans += 1", "- scale = i", "-print(ans)", "+import sys", "+", "+sys.setrecursionlimit(10**9)", "+", "+", "+def main():", "+ n = int(eval(input(...
false
0.035939
0.04176
0.860603
[ "s790256018", "s388947378" ]
u934442292
p03355
python
s138000175
s860652539
38
33
3,772
4,464
Accepted
Accepted
13.16
import sys from string import ascii_lowercase as AL input = sys.stdin.readline def main(): S = input().rstrip() K = int(eval(input())) N = len(S) sub = set() for al in AL: for i in range(N): if S[i] == al: for j in range(1, 6): ...
import sys input = sys.stdin.readline def main(): S = input().rstrip() K = int(eval(input())) N = len(S) sub = set() for i in range(N): for j in range(1, K + 1): sub.add(S[i:i + j]) sub = sorted(sub) ans = sub[K - 1] print(ans) if __name__...
28
23
493
342
import sys from string import ascii_lowercase as AL input = sys.stdin.readline def main(): S = input().rstrip() K = int(eval(input())) N = len(S) sub = set() for al in AL: for i in range(N): if S[i] == al: for j in range(1, 6): sub.add(S[i :...
import sys input = sys.stdin.readline def main(): S = input().rstrip() K = int(eval(input())) N = len(S) sub = set() for i in range(N): for j in range(1, K + 1): sub.add(S[i : i + j]) sub = sorted(sub) ans = sub[K - 1] print(ans) if __name__ == "__main__": ma...
false
17.857143
[ "-from string import ascii_lowercase as AL", "- for al in AL:", "- for i in range(N):", "- if S[i] == al:", "- for j in range(1, 6):", "- sub.add(S[i : i + j])", "- if len(sub) >= K:", "- break", "+ for i in range(N):", "+...
false
0.048719
0.051812
0.940313
[ "s138000175", "s860652539" ]
u460737328
p02971
python
s083075008
s733485749
534
440
14,152
27,572
Accepted
Accepted
17.6
N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] if N == 2: print(("\n".join(map(str, A[::-1])))) else: a = sorted(A) maxv1 = a[-1] maxi1 = A.index(maxv1) maxv2 = a[-2] for i in range(N): if i == maxi1: print(maxv2) else: ...
N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] if N == 2: print(("\n".join(map(str, A[::-1])))) else: a = sorted(A) maxv1 = a[-1] maxi1 = A.index(maxv1) maxv2 = a[-2] print(("\n".join(map(str, [maxv1 if i != maxi1 else maxv2 for i in range(N)]))))
16
12
327
288
N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] if N == 2: print(("\n".join(map(str, A[::-1])))) else: a = sorted(A) maxv1 = a[-1] maxi1 = A.index(maxv1) maxv2 = a[-2] for i in range(N): if i == maxi1: print(maxv2) else: print(maxv1)
N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] if N == 2: print(("\n".join(map(str, A[::-1])))) else: a = sorted(A) maxv1 = a[-1] maxi1 = A.index(maxv1) maxv2 = a[-2] print(("\n".join(map(str, [maxv1 if i != maxi1 else maxv2 for i in range(N)]))))
false
25
[ "- for i in range(N):", "- if i == maxi1:", "- print(maxv2)", "- else:", "- print(maxv1)", "+ print((\"\\n\".join(map(str, [maxv1 if i != maxi1 else maxv2 for i in range(N)]))))" ]
false
0.046365
0.041144
1.126888
[ "s083075008", "s733485749" ]
u544587633
p02572
python
s257492409
s001504825
150
128
108,560
113,188
Accepted
Accepted
14.67
#!/usr/bin/env python3 import sys MOD = 1000000007 # type: int def solve(N: int, A: "List[int]"): ans = 0 B = [sum(A[1:])] for i, a in enumerate(A[1:-1]): B.append(B[i] - a) for i, ai in enumerate(A[:-1]): ans += (ai * B[i]) % MOD print((ans % MOD)) re...
#!/usr/bin/env python3 import sys MOD = 1000000007 # type: int def solve(N: int, A: "List[int]"): ans = 0 B = [sum(A[1:])] for i, a in enumerate(A[1:-1]): B.append(B[i] - a) for i, ai in enumerate(A[:-1]): ans += (ai * B[i]) print((ans % MOD)) return ...
33
33
833
827
#!/usr/bin/env python3 import sys MOD = 1000000007 # type: int def solve(N: int, A: "List[int]"): ans = 0 B = [sum(A[1:])] for i, a in enumerate(A[1:-1]): B.append(B[i] - a) for i, ai in enumerate(A[:-1]): ans += (ai * B[i]) % MOD print((ans % MOD)) return # Generated by 1....
#!/usr/bin/env python3 import sys MOD = 1000000007 # type: int def solve(N: int, A: "List[int]"): ans = 0 B = [sum(A[1:])] for i, a in enumerate(A[1:-1]): B.append(B[i] - a) for i, ai in enumerate(A[:-1]): ans += ai * B[i] print((ans % MOD)) return # Generated by 1.1.7.1 ht...
false
0
[ "- ans += (ai * B[i]) % MOD", "+ ans += ai * B[i]" ]
false
0.037866
0.038088
0.994177
[ "s257492409", "s001504825" ]
u724687935
p03283
python
s476077668
s222095950
2,789
1,686
53,744
57,816
Accepted
Accepted
39.55
N, M, Q = list(map(int, input().split())) dp1 = [[0] * N for _ in range(N)] for _ in range(M): L, R = list(map(int, input().split())) L -= 1; R -= 1 dp1[L][R] += 1 for i in range(N): for j in range(N - 1): dp1[i][j + 1] += dp1[i][j] for k in range(Q): p, q = list(map(int, input...
N, M, Q = list(map(int, input().split())) dp = [[0] * (N + 1) for _ in range(N + 1)] for _ in range(M): L, R = list(map(int, input().split())) dp[L][R] += 1 for i in range(N + 1): for j in range(N): dp[i][j + 1] += dp[i][j] for j in range(N + 1): for i in range(N): dp[i + 1][...
17
15
417
417
N, M, Q = list(map(int, input().split())) dp1 = [[0] * N for _ in range(N)] for _ in range(M): L, R = list(map(int, input().split())) L -= 1 R -= 1 dp1[L][R] += 1 for i in range(N): for j in range(N - 1): dp1[i][j + 1] += dp1[i][j] for k in range(Q): p, q = list(map(int, input().split())...
N, M, Q = list(map(int, input().split())) dp = [[0] * (N + 1) for _ in range(N + 1)] for _ in range(M): L, R = list(map(int, input().split())) dp[L][R] += 1 for i in range(N + 1): for j in range(N): dp[i][j + 1] += dp[i][j] for j in range(N + 1): for i in range(N): dp[i + 1][j] += dp[i][...
false
11.764706
[ "-dp1 = [[0] * N for _ in range(N)]", "+dp = [[0] * (N + 1) for _ in range(N + 1)]", "- L -= 1", "- R -= 1", "- dp1[L][R] += 1", "-for i in range(N):", "- for j in range(N - 1):", "- dp1[i][j + 1] += dp1[i][j]", "+ dp[L][R] += 1", "+for i in range(N + 1):", "+ for j in r...
false
0.067452
0.110856
0.608461
[ "s476077668", "s222095950" ]
u348805958
p02726
python
s859428961
s805859426
654
436
3,444
3,444
Accepted
Accepted
33.33
#!python3 iim = lambda: map(int, input().rstrip().split()) def resolve(): N, X, Y = iim() ans = [N-i-1 for i in range(N-1)] X1, Y1 = X-1, Y -1 xy2 = (X+Y) // 2 for i in range(N): x1 = X1 - i if x1 < 0: x1 = -x1 for j in range(i+1, N): d1 = j - i ...
#!python3 iim = lambda: map(int, input().rstrip().split()) def resolve(): N, X, Y = iim() ans = [N-i-1 for i in range(N-1)] X1, Y1 = X-1, Y -1 xy2 = (X+Y) // 2 for i in range(0, xy2+1): x1 = X1 - i if x1 < 0: x1 = -x1 for j in range(xy2, N): d1 =...
27
27
621
628
#!python3 iim = lambda: map(int, input().rstrip().split()) def resolve(): N, X, Y = iim() ans = [N - i - 1 for i in range(N - 1)] X1, Y1 = X - 1, Y - 1 xy2 = (X + Y) // 2 for i in range(N): x1 = X1 - i if x1 < 0: x1 = -x1 for j in range(i + 1, N): d1...
#!python3 iim = lambda: map(int, input().rstrip().split()) def resolve(): N, X, Y = iim() ans = [N - i - 1 for i in range(N - 1)] X1, Y1 = X - 1, Y - 1 xy2 = (X + Y) // 2 for i in range(0, xy2 + 1): x1 = X1 - i if x1 < 0: x1 = -x1 for j in range(xy2, N): ...
false
0
[ "- for i in range(N):", "+ for i in range(0, xy2 + 1):", "- for j in range(i + 1, N):", "+ for j in range(xy2, N):" ]
false
0.040516
0.039246
1.032375
[ "s859428961", "s805859426" ]
u470369730
p02706
python
s147583258
s016434765
24
20
9,904
10,056
Accepted
Accepted
16.67
n, m = input().split() a = [int(i) for i in input().split()] if int(n) >= sum(a): print((int(n)-sum(a))) else: print((-1))
n, m = list(map(int, input().split())) a = list(map(int, input().split())) print((n-sum(a) if n >= sum(a) else -1))
6
3
127
110
n, m = input().split() a = [int(i) for i in input().split()] if int(n) >= sum(a): print((int(n) - sum(a))) else: print((-1))
n, m = list(map(int, input().split())) a = list(map(int, input().split())) print((n - sum(a) if n >= sum(a) else -1))
false
50
[ "-n, m = input().split()", "-a = [int(i) for i in input().split()]", "-if int(n) >= sum(a):", "- print((int(n) - sum(a)))", "-else:", "- print((-1))", "+n, m = list(map(int, input().split()))", "+a = list(map(int, input().split()))", "+print((n - sum(a) if n >= sum(a) else -1))" ]
false
0.047365
0.047226
1.002945
[ "s147583258", "s016434765" ]
u039355749
p02801
python
s296760477
s290549726
34
24
3,960
3,768
Accepted
Accepted
29.41
import string # print(type(string.ascii_lowercase)) input = eval(input()) alphabets = string.ascii_lowercase # print(alphabets.index(input)) i = alphabets.index(input) ans = alphabets[i + 1] print(ans)
from string import ascii_lowercase as alphabets input = eval(input()) print((alphabets[alphabets.index(input) + 1]))
11
4
210
112
import string # print(type(string.ascii_lowercase)) input = eval(input()) alphabets = string.ascii_lowercase # print(alphabets.index(input)) i = alphabets.index(input) ans = alphabets[i + 1] print(ans)
from string import ascii_lowercase as alphabets input = eval(input()) print((alphabets[alphabets.index(input) + 1]))
false
63.636364
[ "-import string", "+from string import ascii_lowercase as alphabets", "-# print(type(string.ascii_lowercase))", "-alphabets = string.ascii_lowercase", "-# print(alphabets.index(input))", "-i = alphabets.index(input)", "-ans = alphabets[i + 1]", "-print(ans)", "+print((alphabets[alphabets.index(input...
false
0.100857
0.062764
1.606931
[ "s296760477", "s290549726" ]
u340781749
p03330
python
s497131016
s072213406
1,419
163
5,620
3,436
Accepted
Accepted
88.51
from heapq import nsmallest from itertools import product def calc(start, color): _n, _tbl, _grids = n, tbl[color], grids ret = 0 for i in range(start, _n - 1, 3): j = 0 while i >= 0: # print('calc', start, c, i, j, ret) ret += _tbl[_grids[i][j]] ...
from collections import defaultdict from heapq import nsmallest from itertools import product n, c = list(map(int, input().split())) tbl = [list(map(int, input().split())) for _ in range(c)] grid_count = [defaultdict(int) for _ in range(3)] for i in range(n): for j, k in enumerate(map(int, input().split(...
43
21
1,168
729
from heapq import nsmallest from itertools import product def calc(start, color): _n, _tbl, _grids = n, tbl[color], grids ret = 0 for i in range(start, _n - 1, 3): j = 0 while i >= 0: # print('calc', start, c, i, j, ret) ret += _tbl[_grids[i][j]] i -= 1 ...
from collections import defaultdict from heapq import nsmallest from itertools import product n, c = list(map(int, input().split())) tbl = [list(map(int, input().split())) for _ in range(c)] grid_count = [defaultdict(int) for _ in range(3)] for i in range(n): for j, k in enumerate(map(int, input().split())): ...
false
51.162791
[ "+from collections import defaultdict", "-", "-def calc(start, color):", "- _n, _tbl, _grids = n, tbl[color], grids", "- ret = 0", "- for i in range(start, _n - 1, 3):", "- j = 0", "- while i >= 0:", "- # print('calc', start, c, i, j, ret)", "- ret += _...
false
0.037409
0.133782
0.27963
[ "s497131016", "s072213406" ]
u852690916
p03054
python
s856884979
s716882834
249
103
45,648
74,584
Accepted
Accepted
58.63
import sys def main(): input = sys.stdin.readline H,W,N = list(map(int, input().split())) start = tuple(map(int, input().split())) S = input().rstrip() T = input().rstrip() D = { 'R': (0,1), 'L': (0,-1), 'U': (-1,0), 'D': (1,0) } Dc = ['R', 'L...
H, W, N = list(map(int, input().split())) *s, = [int(x) - 1 for x in input().split()] S = eval(input()) T = eval(input()) l = t = 0 b = H r = W if S[-1] == 'L': l += 1 elif S[-1] == 'R': r -= 1 elif S[-1] == 'U': t += 1 else: b -= 1 for i in range(N - 2, -1, -1): a = T[i] if a...
36
44
937
794
import sys def main(): input = sys.stdin.readline H, W, N = list(map(int, input().split())) start = tuple(map(int, input().split())) S = input().rstrip() T = input().rstrip() D = {"R": (0, 1), "L": (0, -1), "U": (-1, 0), "D": (1, 0)} Dc = ["R", "L", "U", "D"] def move(current, directi...
H, W, N = list(map(int, input().split())) (*s,) = [int(x) - 1 for x in input().split()] S = eval(input()) T = eval(input()) l = t = 0 b = H r = W if S[-1] == "L": l += 1 elif S[-1] == "R": r -= 1 elif S[-1] == "U": t += 1 else: b -= 1 for i in range(N - 2, -1, -1): a = T[i] if a == "L": ...
false
18.181818
[ "-import sys", "-", "-", "-def main():", "- input = sys.stdin.readline", "- H, W, N = list(map(int, input().split()))", "- start = tuple(map(int, input().split()))", "- S = input().rstrip()", "- T = input().rstrip()", "- D = {\"R\": (0, 1), \"L\": (0, -1), \"U\": (-1, 0), \"D\": ...
false
0.109524
0.131249
0.834476
[ "s856884979", "s716882834" ]
u848647227
p03675
python
s069567857
s084019183
356
168
25,748
30,984
Accepted
Accepted
52.81
a = int(input()) ar = list(map(int,input().split(" "))) br = [] if a % 2 == 0: for i in range(len(ar)-1,0,-2): br.append(ar[i]) for i in range(0,len(ar)-1,+2): br.append(ar[i]) else: for i in range(len(ar)-1,-1,-2): br.append(ar[i]) for i in range(1,len(ar)-1,+2): ...
a = int(input()) ar = list(map(int,input().split(" "))) br = [] for i in range(a-1,-1,-2): br.append(ar[i]) if a % 2 == 0: n = 0 else: n = 1 for i in range(n,a-1,2): br.append(ar[i]) for i in range(a-1): print(br[i],end=" ") print(br[a-1])
16
14
417
272
a = int(input()) ar = list(map(int, input().split(" "))) br = [] if a % 2 == 0: for i in range(len(ar) - 1, 0, -2): br.append(ar[i]) for i in range(0, len(ar) - 1, +2): br.append(ar[i]) else: for i in range(len(ar) - 1, -1, -2): br.append(ar[i]) for i in range(1, len(ar) - 1, +2)...
a = int(input()) ar = list(map(int, input().split(" "))) br = [] for i in range(a - 1, -1, -2): br.append(ar[i]) if a % 2 == 0: n = 0 else: n = 1 for i in range(n, a - 1, 2): br.append(ar[i]) for i in range(a - 1): print(br[i], end=" ") print(br[a - 1])
false
12.5
[ "+for i in range(a - 1, -1, -2):", "+ br.append(ar[i])", "- for i in range(len(ar) - 1, 0, -2):", "- br.append(ar[i])", "- for i in range(0, len(ar) - 1, +2):", "- br.append(ar[i])", "+ n = 0", "- for i in range(len(ar) - 1, -1, -2):", "- br.append(ar[i])", "- ...
false
0.036926
0.037027
0.997272
[ "s069567857", "s084019183" ]
u075595666
p02709
python
s370685126
s917029410
1,582
141
136,220
106,268
Accepted
Accepted
91.09
def main(): import sys input = sys.stdin.readline n = int(eval(input())) a = [int(i) for i in input().split()] b = [int(i) for i in range(n)] ab = [(x,y) for x,y in zip(a,b)] from operator import itemgetter ab = sorted(ab,key=itemgetter(0),reverse=True) dp = [[-10**14]*(n+1) for i in range(...
import sys input = sys.stdin.readline n = int(eval(input())) a = [int(i) for i in input().split()] b = [int(i) for i in range(n)] ab = [(x,y) for x,y in zip(a,b)] from operator import itemgetter ab = tuple(sorted(ab,key=itemgetter(0),reverse=True)) dp = [[-10**14]*(n+1) for i in range(n+1)] dp[0][0] = 0 for i...
20
14
653
475
def main(): import sys input = sys.stdin.readline n = int(eval(input())) a = [int(i) for i in input().split()] b = [int(i) for i in range(n)] ab = [(x, y) for x, y in zip(a, b)] from operator import itemgetter ab = sorted(ab, key=itemgetter(0), reverse=True) dp = [[-(10**14)] * (n ...
import sys input = sys.stdin.readline n = int(eval(input())) a = [int(i) for i in input().split()] b = [int(i) for i in range(n)] ab = [(x, y) for x, y in zip(a, b)] from operator import itemgetter ab = tuple(sorted(ab, key=itemgetter(0), reverse=True)) dp = [[-(10**14)] * (n + 1) for i in range(n + 1)] dp[0][0] = 0 ...
false
30
[ "-def main():", "- import sys", "+import sys", "- input = sys.stdin.readline", "- n = int(eval(input()))", "- a = [int(i) for i in input().split()]", "- b = [int(i) for i in range(n)]", "- ab = [(x, y) for x, y in zip(a, b)]", "- from operator import itemgetter", "+input = sys...
false
0.106143
0.045393
2.338307
[ "s370685126", "s917029410" ]
u077291787
p02803
python
s820212113
s394200426
306
143
3,316
3,436
Accepted
Accepted
53.27
# D - Maze Master from collections import deque MOD = 10 ** 9 + 7 dxy = [(-1, 0), (0, -1), (0, 1), (1, 0)] def bfs(sx: int, sy: int): queue = deque([(sx, sy)]) dist = {sx * MOD + sy: 0} while queue: x, y = queue.popleft() for dx, dy in dxy: nx, ny = x + dx, y + dy...
# D - Maze Master from collections import deque def bfs(start: int): queue = deque([start]) dist = {start: 0} while queue: x = queue.popleft() for nx in (x + 1, x - 1, x + W, x - W): if maze[nx] and nx not in dist: dist[nx] = dist[x] + 1 ...
32
30
872
742
# D - Maze Master from collections import deque MOD = 10**9 + 7 dxy = [(-1, 0), (0, -1), (0, 1), (1, 0)] def bfs(sx: int, sy: int): queue = deque([(sx, sy)]) dist = {sx * MOD + sy: 0} while queue: x, y = queue.popleft() for dx, dy in dxy: nx, ny = x + dx, y + dy if...
# D - Maze Master from collections import deque def bfs(start: int): queue = deque([start]) dist = {start: 0} while queue: x = queue.popleft() for nx in (x + 1, x - 1, x + W, x - W): if maze[nx] and nx not in dist: dist[nx] = dist[x] + 1 queue.ap...
false
6.25
[ "-MOD = 10**9 + 7", "-dxy = [(-1, 0), (0, -1), (0, 1), (1, 0)]", "-", "-def bfs(sx: int, sy: int):", "- queue = deque([(sx, sy)])", "- dist = {sx * MOD + sy: 0}", "+def bfs(start: int):", "+ queue = deque([start])", "+ dist = {start: 0}", "- x, y = queue.popleft()", "- ...
false
0.041435
0.03627
1.142418
[ "s820212113", "s394200426" ]
u941407962
p03684
python
s742514736
s112034700
1,788
1,639
130,136
130,264
Accepted
Accepted
8.33
class UnionFindNode: def __init__(self, group_id, parent=None, value=None): self.group_id_ = group_id self.parent_ = parent self.value = value self.rank_ = 1 self.member_num_ = 1 def is_root(self): return not self.parent_ def root(self): ...
class UnionFindNode: def __init__(self, group_id, parent=None, value=None): self.group_id_ = group_id self.parent_ = parent self.value = value self.rank_ = 1 self.member_num_ = 1 def is_root(self): return not self.parent_ def root(self): ...
68
60
2,054
1,775
class UnionFindNode: def __init__(self, group_id, parent=None, value=None): self.group_id_ = group_id self.parent_ = parent self.value = value self.rank_ = 1 self.member_num_ = 1 def is_root(self): return not self.parent_ def root(self): parent = sel...
class UnionFindNode: def __init__(self, group_id, parent=None, value=None): self.group_id_ = group_id self.parent_ = parent self.value = value self.rank_ = 1 self.member_num_ = 1 def is_root(self): return not self.parent_ def root(self): parent = sel...
false
11.764706
[ "- unite_root.parent_ = root", "- root.rank_ = max(root.rank_, unite_root.rank_ + 1)", "- root.member_num_ = root.member_num_ + unite_root.member_num_", "+ n_root, child = root, unite_root", "- root.parent_ = unite_root", "- ...
false
0.178315
0.080731
2.208753
[ "s742514736", "s112034700" ]
u597455618
p02844
python
s874946894
s309163543
107
18
3,064
3,064
Accepted
Accepted
83.18
n= int(eval(input())) s = eval(input()) ans = 0 h = set() for i in range(n-2): ten = set() if s[i] not in h: h.add(s[i]) for j in range(i+1,n-1): if s[j] not in ten: ten.add(s[j]) ans += len(set(s[j+1:])) print(ans)
n= int(eval(input())) s = eval(input()) ans = 0 for i in range(10): ii = s.find(str(i)) if -1 == ii: continue for j in range(10): ij = s.find(str(j), ii+1) if -1 == ij: continue for k in range(10): ik = s.find(str(k), ij+1) if ik != -1: ans += 1 pri...
13
17
249
315
n = int(eval(input())) s = eval(input()) ans = 0 h = set() for i in range(n - 2): ten = set() if s[i] not in h: h.add(s[i]) for j in range(i + 1, n - 1): if s[j] not in ten: ten.add(s[j]) ans += len(set(s[j + 1 :])) print(ans)
n = int(eval(input())) s = eval(input()) ans = 0 for i in range(10): ii = s.find(str(i)) if -1 == ii: continue for j in range(10): ij = s.find(str(j), ii + 1) if -1 == ij: continue for k in range(10): ik = s.find(str(k), ij + 1) if ik != -1...
false
23.529412
[ "-h = set()", "-for i in range(n - 2):", "- ten = set()", "- if s[i] not in h:", "- h.add(s[i])", "- for j in range(i + 1, n - 1):", "- if s[j] not in ten:", "- ten.add(s[j])", "- ans += len(set(s[j + 1 :]))", "+for i in range(10):", "...
false
0.06243
0.062088
1.005499
[ "s874946894", "s309163543" ]
u744920373
p03111
python
s627868227
s295036209
197
93
3,064
3,064
Accepted
Accepted
52.79
import sys sys.setrecursionlimit(10**8) def ii(): return int(sys.stdin.readline()) def mi(): return list(map(int, sys.stdin.readline().split())) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] def dp2(ini, i, j): ret...
import sys sys.setrecursionlimit(10**8) def ii(): return int(sys.stdin.readline()) def mi(): return list(map(int, sys.stdin.readline().split())) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] def dp2(ini, i, j): ret...
37
39
1,111
1,195
import sys sys.setrecursionlimit(10**8) def ii(): return int(sys.stdin.readline()) def mi(): return list(map(int, sys.stdin.readline().split())) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] de...
import sys sys.setrecursionlimit(10**8) def ii(): return int(sys.stdin.readline()) def mi(): return list(map(int, sys.stdin.readline().split())) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] de...
false
5.128205
[ "-A = sorted(A)", "+# A = sorted(A)", "- abc = sorted([a, b, c])", "- ans = min(ans, (use - 3) * 10 + sum([abs(abc[i] - A[i]) for i in range(3)]))", "+ # abc = sorted([a, b, c])", "+ # ans = min(ans, (use-3)*10 + sum([abs(abc[i]-A[i]) for i in range(3)]))", "+ ans = mi...
false
0.162134
0.092023
1.761876
[ "s627868227", "s295036209" ]
u686036872
p02837
python
s713938666
s209098664
1,287
266
3,064
3,064
Accepted
Accepted
79.33
N = int(eval(input())) X = [[-1]*N for i in range(N)] for i in range(N): a = int(eval(input())) for j in range(a): b, c = list(map(int, input().split())) X[i][b-1] = c ans = 0 for i in range(2**N): Y = [0]*(N) for j in range(N): if ((i >> j) & 1): Y[j] =...
import itertools N = int(eval(input())) A=[[] for _ in range(N)] for i in range(N): a = int(eval(input())) for j in range(a): x, y = list(map(int, input().split())) A[i].append([x-1, y]) saidai = 0 for i in itertools.product(list(range(2)), repeat=N): ans = list(i) Flag ...
26
27
596
642
N = int(eval(input())) X = [[-1] * N for i in range(N)] for i in range(N): a = int(eval(input())) for j in range(a): b, c = list(map(int, input().split())) X[i][b - 1] = c ans = 0 for i in range(2**N): Y = [0] * (N) for j in range(N): if (i >> j) & 1: Y[j] = 1 fla...
import itertools N = int(eval(input())) A = [[] for _ in range(N)] for i in range(N): a = int(eval(input())) for j in range(a): x, y = list(map(int, input().split())) A[i].append([x - 1, y]) saidai = 0 for i in itertools.product(list(range(2)), repeat=N): ans = list(i) Flag = True f...
false
3.703704
[ "+import itertools", "+", "-X = [[-1] * N for i in range(N)]", "+A = [[] for _ in range(N)]", "- b, c = list(map(int, input().split()))", "- X[i][b - 1] = c", "-ans = 0", "-for i in range(2**N):", "- Y = [0] * (N)", "+ x, y = list(map(int, input().split()))", "+ A[...
false
0.075081
0.035684
2.104071
[ "s713938666", "s209098664" ]
u072053884
p02299
python
s594754629
s162740219
100
90
7,944
7,844
Accepted
Accepted
10
def dot(c1, c2): return c1.real * c2.real + c1.imag * c2.imag def cross(c1, c2): return c1.real * c2.imag - c1.imag * c2.real def string_to_complex(s): x, y = list(map(int, s.split())) return x + y * 1j def contains(polygon, point): up = False down = False start_point = polyg...
def dot(c1, c2): return c1.real * c2.real + c1.imag * c2.imag def cross(c1, c2): return c1.real * c2.imag - c1.imag * c2.real def string_to_complex(s): x, y = list(map(int, s.split())) return x + y * 1j def contains(polygon, point): flag = False for v1, v2 in zip(polygon[0:], poly...
58
41
1,507
975
def dot(c1, c2): return c1.real * c2.real + c1.imag * c2.imag def cross(c1, c2): return c1.real * c2.imag - c1.imag * c2.real def string_to_complex(s): x, y = list(map(int, s.split())) return x + y * 1j def contains(polygon, point): up = False down = False start_point = polygon[0] ...
def dot(c1, c2): return c1.real * c2.real + c1.imag * c2.imag def cross(c1, c2): return c1.real * c2.imag - c1.imag * c2.real def string_to_complex(s): x, y = list(map(int, s.split())) return x + y * 1j def contains(polygon, point): flag = False for v1, v2 in zip(polygon[0:], polygon[1:]):...
false
29.310345
[ "- up = False", "- down = False", "- start_point = polygon[0]", "- for p in polygon[::-1]:", "- if start_point.imag > p.imag:", "- up = True", "- break", "- elif start_point.imag < p.imag:", "- down = True", "- break", "- ...
false
0.048217
0.063487
0.759475
[ "s594754629", "s162740219" ]
u790710233
p03221
python
s450022108
s421163174
850
670
49,168
29,604
Accepted
Accepted
21.18
n, m = list(map(int, input().split())) py = [list(map(int, input().split())) for _ in range(m)] spy = sorted(py) signate = {} cnt = 0 last_p = 0 for p, y in spy: pref = "{:06}".format(p) if last_p == p: cnt += 1 else: last_p = p cnt = 1 year = "{:06}".format(cnt)...
import bisect n, m = list(map(int, input().split())) Ps = [[]for _ in range(n)] PY = [] for _ in range(m): p, y = list(map(int, input().split())) Ps[p-1].append(y) PY.append((p, y)) for ls in Ps: ls.sort() for p, y in PY: pid = "{:06}".format(p) cid = "{:06}".format(bisect.bisect...
20
16
423
348
n, m = list(map(int, input().split())) py = [list(map(int, input().split())) for _ in range(m)] spy = sorted(py) signate = {} cnt = 0 last_p = 0 for p, y in spy: pref = "{:06}".format(p) if last_p == p: cnt += 1 else: last_p = p cnt = 1 year = "{:06}".format(cnt) signate["{}-...
import bisect n, m = list(map(int, input().split())) Ps = [[] for _ in range(n)] PY = [] for _ in range(m): p, y = list(map(int, input().split())) Ps[p - 1].append(y) PY.append((p, y)) for ls in Ps: ls.sort() for p, y in PY: pid = "{:06}".format(p) cid = "{:06}".format(bisect.bisect_right(Ps[p ...
false
20
[ "+import bisect", "+", "-py = [list(map(int, input().split())) for _ in range(m)]", "-spy = sorted(py)", "-signate = {}", "-cnt = 0", "-last_p = 0", "-for p, y in spy:", "- pref = \"{:06}\".format(p)", "- if last_p == p:", "- cnt += 1", "- else:", "- last_p = p", "- ...
false
0.042512
0.039112
1.086928
[ "s450022108", "s421163174" ]
u144913062
p02972
python
s098958873
s249959581
619
476
10,036
12,644
Accepted
Accepted
23.1
N = int(eval(input())) a = list(map(int, input().split())) b = [0] * N for i in range(N, 0, -1): sum = 0 for j in range(i*2, N+1, i): sum += b[j-1] if sum % 2 == 0: b[i-1] = a[i-1] else: b[i-1] = 1 - a[i-1] count = b.count(1) print((b.count(1))) if count > 0: an...
N = int(eval(input())) a = [0] + list(map(int, input().split())) b = [] for i in range(1, N+1)[::-1]: s = sum(a[j] for j in range(i*2, N+1, i)) if s % 2 == 1: a[i] = 1 - a[i] if a[i]: b.append(i) print((len(b))) if len(b) > 0: print((*b))
19
12
427
272
N = int(eval(input())) a = list(map(int, input().split())) b = [0] * N for i in range(N, 0, -1): sum = 0 for j in range(i * 2, N + 1, i): sum += b[j - 1] if sum % 2 == 0: b[i - 1] = a[i - 1] else: b[i - 1] = 1 - a[i - 1] count = b.count(1) print((b.count(1))) if count > 0: an...
N = int(eval(input())) a = [0] + list(map(int, input().split())) b = [] for i in range(1, N + 1)[::-1]: s = sum(a[j] for j in range(i * 2, N + 1, i)) if s % 2 == 1: a[i] = 1 - a[i] if a[i]: b.append(i) print((len(b))) if len(b) > 0: print((*b))
false
36.842105
[ "-a = list(map(int, input().split()))", "-b = [0] * N", "-for i in range(N, 0, -1):", "- sum = 0", "- for j in range(i * 2, N + 1, i):", "- sum += b[j - 1]", "- if sum % 2 == 0:", "- b[i - 1] = a[i - 1]", "- else:", "- b[i - 1] = 1 - a[i - 1]", "-count = b.count(...
false
0.044628
0.04406
1.012894
[ "s098958873", "s249959581" ]
u533679935
p03563
python
s628580854
s401145582
320
19
21,000
2,940
Accepted
Accepted
94.06
import numpy as np lst = [] R = int(eval(input())) G = int(eval(input())) ans = G - R + G print(ans)
lst = [] R = int(eval(input())) G = int(eval(input())) ans = G - R + G print(ans)
9
8
99
79
import numpy as np lst = [] R = int(eval(input())) G = int(eval(input())) ans = G - R + G print(ans)
lst = [] R = int(eval(input())) G = int(eval(input())) ans = G - R + G print(ans)
false
11.111111
[ "-import numpy as np", "-" ]
false
0.075007
0.035634
2.104933
[ "s628580854", "s401145582" ]
u740284863
p03031
python
s674916577
s204797223
48
43
3,064
9,112
Accepted
Accepted
10.42
n,m = list(map(int,input().split())) l = [] for i in range(1 << n): tmp = str(bin(i))[2:] l.append(tmp.zfill(n)) K = [list(map(int,input().split())) for _ in range(m)] P = list(map(int,input().split())) #print(P) ans = 0 #print("----") for i in range(len(l)): #スイッチの状態l[i] #付いている電球のリストO ...
n,m = list(map(int,input().split())) a = [list(map(int,input().split())) for _ in range(m)] p = list(map(int,input().split())) ans = 0 for i in range(2**n): onoffs = [int(j) for j in list(bin(i)[2:].zfill(n))] Flag = True for lamp in range(m): k = a[lamp][0] info = [l - 1 for l in ...
29
20
675
549
n, m = list(map(int, input().split())) l = [] for i in range(1 << n): tmp = str(bin(i))[2:] l.append(tmp.zfill(n)) K = [list(map(int, input().split())) for _ in range(m)] P = list(map(int, input().split())) # print(P) ans = 0 # print("----") for i in range(len(l)): # スイッチの状態l[i] # 付いている電球のリストO O = [...
n, m = list(map(int, input().split())) a = [list(map(int, input().split())) for _ in range(m)] p = list(map(int, input().split())) ans = 0 for i in range(2**n): onoffs = [int(j) for j in list(bin(i)[2:].zfill(n))] Flag = True for lamp in range(m): k = a[lamp][0] info = [l - 1 for l in a[lamp...
false
31.034483
[ "-l = []", "-for i in range(1 << n):", "- tmp = str(bin(i))[2:]", "- l.append(tmp.zfill(n))", "-K = [list(map(int, input().split())) for _ in range(m)]", "-P = list(map(int, input().split()))", "-# print(P)", "+a = [list(map(int, input().split())) for _ in range(m)]", "+p = list(map(int, input...
false
0.045146
0.046442
0.972105
[ "s674916577", "s204797223" ]
u440566786
p02913
python
s397245158
s792351806
566
357
48,092
54,232
Accepted
Accepted
36.93
import sys sys.setrecursionlimit(2147483647) INF=float("inf") MOD=10**9+7 input=lambda :sys.stdin.readline().rstrip() def Z(s): """ s: str return list of int with length len(s) """ # initialization n=len(s) z=[0]*n z[0]=n # construct L,R=0,0 for i in range(1,n...
import sys sys.setrecursionlimit(2147483647) INF=float("inf") MOD=10**9+7 input=lambda :sys.stdin.readline().rstrip() def bisection(l,r,f,left=True,discrete=True): eps=1 if discrete else 10**-12 if((not left)^f(r)): return r if left else r+1 elif(left^f(l)): return l-1 if left else l while(r-l>...
39
64
862
1,830
import sys sys.setrecursionlimit(2147483647) INF = float("inf") MOD = 10**9 + 7 input = lambda: sys.stdin.readline().rstrip() def Z(s): """ s: str return list of int with length len(s) """ # initialization n = len(s) z = [0] * n z[0] = n # construct L, R = 0, 0 for i in ra...
import sys sys.setrecursionlimit(2147483647) INF = float("inf") MOD = 10**9 + 7 input = lambda: sys.stdin.readline().rstrip() def bisection(l, r, f, left=True, discrete=True): eps = 1 if discrete else 10**-12 if (not left) ^ f(r): return r if left else r + 1 elif left ^ f(l): return l - 1...
false
39.0625
[ "-def Z(s):", "- \"\"\"", "- s: str", "- return list of int with length len(s)", "- \"\"\"", "- # initialization", "- n = len(s)", "- z = [0] * n", "- z[0] = n", "- # construct", "- L, R = 0, 0", "- for i in range(1, n):", "- if i >= R: # 過去の結果が全く使えない...
false
0.041647
0.050929
0.817736
[ "s397245158", "s792351806" ]
u017415492
p03361
python
s486312566
s778306848
21
19
3,064
3,064
Accepted
Accepted
9.52
h,w=list(map(int,input().split())) s=[list(eval(input())) for i in range(h)] flag=True count=0 for i in range(h): if flag==False: break for j in range(w): if flag==False: break flag2=False if s[i][j]=="#": if i>0 and s[i-1][j]!="#": flag=False elif i>0 and s[i...
h,w=list(map(int,input().split())) s=[list(eval(input())) for i in range(h)] flag=False count=0 for i in range(h): if flag==True: break for j in range(w): if s[i][j]=="#": count=0 if i+1<=h-1 and s[i+1][j]==".": count+=1 if 0<=i-1 and s[i-1][j]==".": count+=1 ...
47
27
931
532
h, w = list(map(int, input().split())) s = [list(eval(input())) for i in range(h)] flag = True count = 0 for i in range(h): if flag == False: break for j in range(w): if flag == False: break flag2 = False if s[i][j] == "#": if i > 0 and s[i - 1][j] != "#":...
h, w = list(map(int, input().split())) s = [list(eval(input())) for i in range(h)] flag = False count = 0 for i in range(h): if flag == True: break for j in range(w): if s[i][j] == "#": count = 0 if i + 1 <= h - 1 and s[i + 1][j] == ".": count += 1 ...
false
42.553191
[ "-flag = True", "+flag = False", "- if flag == False:", "+ if flag == True:", "- if flag == False:", "+ if s[i][j] == \"#\":", "+ count = 0", "+ if i + 1 <= h - 1 and s[i + 1][j] == \".\":", "+ count += 1", "+ if 0 <= i - 1 and s[...
false
0.043991
0.044333
0.99228
[ "s486312566", "s778306848" ]
u532966492
p03273
python
s126845492
s579649757
22
19
3,316
3,064
Accepted
Accepted
13.64
H,W=list(map(int,input().split())) A=[eval(input()) for i in range(H)] B=[] D=[] for i in range(H): if A[i]!="."*W: B.append(list(A[i])) C=[["0" for j in range(len(B))] for i in range(W)] for i in range(len(B)): for j in range(W): C[j][i]=B[i][j] for i in range(W): if C[i]!=["."]...
H,W=list(map(int,input().split())) A=[list(eval(input())) for i in range(H)] for i in reversed(list(range(H))): if A[i]==["."]*W: A.pop(i) for j in reversed(list(range(W))): flag=0 for i in range(len(A)): if A[i][j]=="#": flag=1 if flag==0: for i in range(len(A)): A[i...
29
18
531
354
H, W = list(map(int, input().split())) A = [eval(input()) for i in range(H)] B = [] D = [] for i in range(H): if A[i] != "." * W: B.append(list(A[i])) C = [["0" for j in range(len(B))] for i in range(W)] for i in range(len(B)): for j in range(W): C[j][i] = B[i][j] for i in range(W): if C[i] ...
H, W = list(map(int, input().split())) A = [list(eval(input())) for i in range(H)] for i in reversed(list(range(H))): if A[i] == ["."] * W: A.pop(i) for j in reversed(list(range(W))): flag = 0 for i in range(len(A)): if A[i][j] == "#": flag = 1 if flag == 0: for i in ...
false
37.931034
[ "-A = [eval(input()) for i in range(H)]", "-B = []", "-D = []", "-for i in range(H):", "- if A[i] != \".\" * W:", "- B.append(list(A[i]))", "-C = [[\"0\" for j in range(len(B))] for i in range(W)]", "-for i in range(len(B)):", "- for j in range(W):", "- C[j][i] = B[i][j]", "-...
false
0.04454
0.040877
1.089622
[ "s126845492", "s579649757" ]
u995004106
p02882
python
s473947975
s550596493
257
167
59,500
38,384
Accepted
Accepted
35.02
from decimal import * import math a,b,x=list(map(int,input().split())) height=Decimal(x)/Decimal(a*a) y1=Decimal(2*a*height)/Decimal(b) #これってbを固定した時の高さじゃ if y1>a:#a*height=(b+y)*a/2<=>y=2height-b y1=b-(2*height-b) print((math.degrees(math.atan(y1/a)))) else:#a*height=b*y/2なるy<=>y=2*a*height/b p...
import math a,b,x=list(map(int,input().split())) height=x/(a*a) y1=(2*a*height)/b #これってbを固定した時の高さじゃ if y1>a:#a*height=(b+y)*a/2<=>y=2height-b y1=b-(2*height-b) print((math.degrees(math.atan(y1/a)))) else:#a*height=b*y/2なるy<=>y=2*a*height/b print((math.degrees(math.atan(b/y1))))
11
10
347
292
from decimal import * import math a, b, x = list(map(int, input().split())) height = Decimal(x) / Decimal(a * a) y1 = Decimal(2 * a * height) / Decimal(b) # これってbを固定した時の高さじゃ if y1 > a: # a*height=(b+y)*a/2<=>y=2height-b y1 = b - (2 * height - b) print((math.degrees(math.atan(y1 / a)))) else: # a*height=b*y/...
import math a, b, x = list(map(int, input().split())) height = x / (a * a) y1 = (2 * a * height) / b # これってbを固定した時の高さじゃ if y1 > a: # a*height=(b+y)*a/2<=>y=2height-b y1 = b - (2 * height - b) print((math.degrees(math.atan(y1 / a)))) else: # a*height=b*y/2なるy<=>y=2*a*height/b print((math.degrees(math.ata...
false
9.090909
[ "-from decimal import *", "-height = Decimal(x) / Decimal(a * a)", "-y1 = Decimal(2 * a * height) / Decimal(b) # これってbを固定した時の高さじゃ", "+height = x / (a * a)", "+y1 = (2 * a * height) / b # これってbを固定した時の高さじゃ" ]
false
0.087738
0.09626
0.911465
[ "s473947975", "s550596493" ]
u888092736
p03403
python
s004957740
s273150294
211
161
14,044
20,468
Accepted
Accepted
23.7
N = int(eval(input())) A = [0] + list(map(int, input().split())) + [0] total = 0 for i in range(N + 1): total += abs(A[i + 1] - A[i]) for i in range(N): print((total + abs(A[i + 2] - A[i]) - (abs(A[i + 1] - A[i] ) + abs(A[i + 2] - A[i + 1]))))
N, *A = list(map(int, open(0).read().split())) A = [0] + A + [0] acc = [0] * (N + 2) for i in range(N + 1): acc[i + 1] = acc[i] + abs(A[i + 1] - A[i]) for i in range(N): left = acc[i] - acc[0] right = acc[N + 1] - acc[i + 2] print((left + abs(A[i + 2] - A[i]) + right))
8
13
252
294
N = int(eval(input())) A = [0] + list(map(int, input().split())) + [0] total = 0 for i in range(N + 1): total += abs(A[i + 1] - A[i]) for i in range(N): print( ( total + abs(A[i + 2] - A[i]) - (abs(A[i + 1] - A[i]) + abs(A[i + 2] - A[i + 1])) ) )
N, *A = list(map(int, open(0).read().split())) A = [0] + A + [0] acc = [0] * (N + 2) for i in range(N + 1): acc[i + 1] = acc[i] + abs(A[i + 1] - A[i]) for i in range(N): left = acc[i] - acc[0] right = acc[N + 1] - acc[i + 2] print((left + abs(A[i + 2] - A[i]) + right))
false
38.461538
[ "-N = int(eval(input()))", "-A = [0] + list(map(int, input().split())) + [0]", "-total = 0", "+N, *A = list(map(int, open(0).read().split()))", "+A = [0] + A + [0]", "+acc = [0] * (N + 2)", "- total += abs(A[i + 1] - A[i])", "+ acc[i + 1] = acc[i] + abs(A[i + 1] - A[i])", "- print(", "- ...
false
0.0353
0.037671
0.937082
[ "s004957740", "s273150294" ]
u566529875
p03045
python
s184565110
s025312341
1,382
1,113
93,852
83,356
Accepted
Accepted
19.46
n,m=list(map(int,input().split())) g = [[] for _ in range(n)] for i in range(m): x,y,z=list(map(int,input().split())) g[x-1].append(y-1) g[y-1].append(x-1) check = [False]*n cnt=0 import queue for i in range(n): if check[i]: continue cnt+=1 check[i]=True q=queue.Queue() q.put(i) while...
n,m=list(map(int,input().split())) g = [[] for _ in range(n)] for i in range(m): x,y,z=list(map(int,input().split())) g[x-1].append(y-1) g[y-1].append(x-1) check = [False]*n cnt=0 import queue q=queue.Queue() for i in range(n): if check[i]: continue cnt+=1 check[i]=True q.put(i) while ...
29
29
438
437
n, m = list(map(int, input().split())) g = [[] for _ in range(n)] for i in range(m): x, y, z = list(map(int, input().split())) g[x - 1].append(y - 1) g[y - 1].append(x - 1) check = [False] * n cnt = 0 import queue for i in range(n): if check[i]: continue cnt += 1 check[i] = True q =...
n, m = list(map(int, input().split())) g = [[] for _ in range(n)] for i in range(m): x, y, z = list(map(int, input().split())) g[x - 1].append(y - 1) g[y - 1].append(x - 1) check = [False] * n cnt = 0 import queue q = queue.Queue() for i in range(n): if check[i]: continue cnt += 1 check...
false
0
[ "+q = queue.Queue()", "- q = queue.Queue()" ]
false
0.219764
0.208899
1.052012
[ "s184565110", "s025312341" ]
u816488327
p02804
python
s363952125
s785159500
269
198
14,044
25,996
Accepted
Accepted
26.39
def solve(): from sys import stdin f_i = stdin mod = 10 ** 9 + 7 N, K = list(map(int, f_i.readline().split())) A = sorted(map(int, f_i.readline().split())) comb = 1 ans = A[K-1] - A[N-K] for i, j in zip(list(range(K, N)), list(range(1, N))): comb = comb...
def solve(): from sys import stdin f_i = stdin N, K = list(map(int, f_i.readline().split())) # combination mod = 10 ** 9 + 7 fact = [1, 1] factinv = [1, 1] inv = [0, 1] for i in range(2, N): fact.append((fact[-1] * i) % mod) inv.append((-i...
19
30
429
729
def solve(): from sys import stdin f_i = stdin mod = 10**9 + 7 N, K = list(map(int, f_i.readline().split())) A = sorted(map(int, f_i.readline().split())) comb = 1 ans = A[K - 1] - A[N - K] for i, j in zip(list(range(K, N)), list(range(1, N))): comb = comb * i * pow(j, mod - 2, m...
def solve(): from sys import stdin f_i = stdin N, K = list(map(int, f_i.readline().split())) # combination mod = 10**9 + 7 fact = [1, 1] factinv = [1, 1] inv = [0, 1] for i in range(2, N): fact.append((fact[-1] * i) % mod) inv.append((-inv[mod % i] * (mod // i)) % mo...
false
36.666667
[ "+ N, K = list(map(int, f_i.readline().split()))", "+ # combination", "- N, K = list(map(int, f_i.readline().split()))", "+ fact = [1, 1]", "+ factinv = [1, 1]", "+ inv = [0, 1]", "+ for i in range(2, N):", "+ fact.append((fact[-1] * i) % mod)", "+ inv.append((-inv...
false
0.044546
0.040255
1.10661
[ "s363952125", "s785159500" ]
u565711859
p02572
python
s803302584
s731692346
125
112
93,976
105,248
Accepted
Accepted
10.4
M = 10**9 + 7 N = int(eval(input())) A = list(map(int, input().split())) table = [0] * (N) for i in range(N-1): table[i+1] = table[i] + A[N-i-1] table = table[::-1] ans = 0 for i in range(N-1): ans = (ans + table[i]*A[i]) % M print(ans)
M = 10**9 + 7 N = int(eval(input())) A = list(map(int, input().split())) print(((((sum(A)**2) - sum([x*x for x in A])) // 2) % M))
14
5
255
132
M = 10**9 + 7 N = int(eval(input())) A = list(map(int, input().split())) table = [0] * (N) for i in range(N - 1): table[i + 1] = table[i] + A[N - i - 1] table = table[::-1] ans = 0 for i in range(N - 1): ans = (ans + table[i] * A[i]) % M print(ans)
M = 10**9 + 7 N = int(eval(input())) A = list(map(int, input().split())) print(((((sum(A) ** 2) - sum([x * x for x in A])) // 2) % M))
false
64.285714
[ "-table = [0] * (N)", "-for i in range(N - 1):", "- table[i + 1] = table[i] + A[N - i - 1]", "-table = table[::-1]", "-ans = 0", "-for i in range(N - 1):", "- ans = (ans + table[i] * A[i]) % M", "-print(ans)", "+print(((((sum(A) ** 2) - sum([x * x for x in A])) // 2) % M))" ]
false
0.045588
0.049402
0.922805
[ "s803302584", "s731692346" ]
u887207211
p03043
python
s568066804
s712814773
67
50
5,588
2,940
Accepted
Accepted
25.37
N, K = list(map(int,input().split())) def check(n): cnt = 0 while n < K: n *= 2 cnt += 1 return cnt import decimal dec = decimal.Decimal ind = 1 point = 0 x = 1 / N y = 1 / 2 for i in range(ind, N+1): res = check(i) point += x * (y**res) print(point)
N, K = list(map(int,input().split())) p = 0 for i in range(1,N+1): cnt = 0 n = i while n < K: n *= 2 cnt += 1 p += 1/N * (1/2)**cnt print(p)
21
11
286
161
N, K = list(map(int, input().split())) def check(n): cnt = 0 while n < K: n *= 2 cnt += 1 return cnt import decimal dec = decimal.Decimal ind = 1 point = 0 x = 1 / N y = 1 / 2 for i in range(ind, N + 1): res = check(i) point += x * (y**res) print(point)
N, K = list(map(int, input().split())) p = 0 for i in range(1, N + 1): cnt = 0 n = i while n < K: n *= 2 cnt += 1 p += 1 / N * (1 / 2) ** cnt print(p)
false
47.619048
[ "-", "-", "-def check(n):", "+p = 0", "+for i in range(1, N + 1):", "+ n = i", "- return cnt", "-", "-", "-import decimal", "-", "-dec = decimal.Decimal", "-ind = 1", "-point = 0", "-x = 1 / N", "-y = 1 / 2", "-for i in range(ind, N + 1):", "- res = check(i)", "- poin...
false
0.095083
0.085381
1.113641
[ "s568066804", "s712814773" ]
u241159583
p02995
python
s348787298
s285215540
36
32
5,176
9,020
Accepted
Accepted
11.11
from fractions import gcd a,b,c,d = list(map(int, input().split())) e = c*d//gcd(c,d) a -= 1 A = b - (b//c + b//d - b//e) B = a - (a//c + a//d - a//e) print((A-B))
import math a,b,c,d = list(map(int, input().split())) C = b//c - (a-1)//c D = b//d - (a-1)//d x = c*d//math.gcd(c,d) CD = b//x - (a-1)//x print(((b-a+1) - (C+D-CD)))
8
7
164
163
from fractions import gcd a, b, c, d = list(map(int, input().split())) e = c * d // gcd(c, d) a -= 1 A = b - (b // c + b // d - b // e) B = a - (a // c + a // d - a // e) print((A - B))
import math a, b, c, d = list(map(int, input().split())) C = b // c - (a - 1) // c D = b // d - (a - 1) // d x = c * d // math.gcd(c, d) CD = b // x - (a - 1) // x print(((b - a + 1) - (C + D - CD)))
false
12.5
[ "-from fractions import gcd", "+import math", "-e = c * d // gcd(c, d)", "-a -= 1", "-A = b - (b // c + b // d - b // e)", "-B = a - (a // c + a // d - a // e)", "-print((A - B))", "+C = b // c - (a - 1) // c", "+D = b // d - (a - 1) // d", "+x = c * d // math.gcd(c, d)", "+CD = b // x - (a - 1)...
false
0.058913
0.047124
1.250178
[ "s348787298", "s285215540" ]
u566428756
p02773
python
s141423790
s563985395
865
532
59,460
35,572
Accepted
Accepted
38.5
N=int(eval(input())) S=[eval(input()) for _ in range(N)] S_=list(set(S)) ans_d={s:0 for s in S_} for s in S: ans_d[s]+=1 M=max(set(ans_d.values())) for k,v in sorted(ans_d.items()): if v==M: print(k)
from collections import Counter N=int(eval(input())) S=[eval(input()) for _ in range(N)] S_Counter=Counter(S) Max=max(S_Counter.values()) print(('\n'.join(sorted(s for s,v in list(S_Counter.items()) if v==Max))))
12
10
216
206
N = int(eval(input())) S = [eval(input()) for _ in range(N)] S_ = list(set(S)) ans_d = {s: 0 for s in S_} for s in S: ans_d[s] += 1 M = max(set(ans_d.values())) for k, v in sorted(ans_d.items()): if v == M: print(k)
from collections import Counter N = int(eval(input())) S = [eval(input()) for _ in range(N)] S_Counter = Counter(S) Max = max(S_Counter.values()) print(("\n".join(sorted(s for s, v in list(S_Counter.items()) if v == Max))))
false
16.666667
[ "+from collections import Counter", "+", "-S_ = list(set(S))", "-ans_d = {s: 0 for s in S_}", "-for s in S:", "- ans_d[s] += 1", "-M = max(set(ans_d.values()))", "-for k, v in sorted(ans_d.items()):", "- if v == M:", "- print(k)", "+S_Counter = Counter(S)", "+Max = max(S_Counter.v...
false
0.051874
0.036282
1.429724
[ "s141423790", "s563985395" ]
u624475441
p03633
python
s049415945
s503330571
35
17
5,048
2,940
Accepted
Accepted
51.43
from fractions import gcd l=1 for _ in[0]*int(eval(input())): t=int(eval(input())) l=l*t//gcd(l,t) print(l)
l=1 for _ in[0]*int(eval(input())): t=int(eval(input())) a,b=l,t while b: a,b=b,a%b l*=t//a print(l)
6
8
108
119
from fractions import gcd l = 1 for _ in [0] * int(eval(input())): t = int(eval(input())) l = l * t // gcd(l, t) print(l)
l = 1 for _ in [0] * int(eval(input())): t = int(eval(input())) a, b = l, t while b: a, b = b, a % b l *= t // a print(l)
false
25
[ "-from fractions import gcd", "-", "- l = l * t // gcd(l, t)", "+ a, b = l, t", "+ while b:", "+ a, b = b, a % b", "+ l *= t // a" ]
false
0.171873
0.047152
3.645038
[ "s049415945", "s503330571" ]
u844646164
p03211
python
s371122011
s585139176
38
17
3,060
2,940
Accepted
Accepted
55.26
S = list(map(int, list(eval(input())))) l = len(S) list = [] for i in range(l-2): a = 100 * S[i] b = 10 * S[i+1] c = S[i+2] n = a + b + c list.append(abs(n-753)) print((min(list)))
S = list(eval(input())) ans = float('inf') for i in range(len(S)-2): s = int("".join(S[i:i+3])) ans = min(ans, abs(753-s)) print(ans)
11
6
203
140
S = list(map(int, list(eval(input())))) l = len(S) list = [] for i in range(l - 2): a = 100 * S[i] b = 10 * S[i + 1] c = S[i + 2] n = a + b + c list.append(abs(n - 753)) print((min(list)))
S = list(eval(input())) ans = float("inf") for i in range(len(S) - 2): s = int("".join(S[i : i + 3])) ans = min(ans, abs(753 - s)) print(ans)
false
45.454545
[ "-S = list(map(int, list(eval(input()))))", "-l = len(S)", "-list = []", "-for i in range(l - 2):", "- a = 100 * S[i]", "- b = 10 * S[i + 1]", "- c = S[i + 2]", "- n = a + b + c", "- list.append(abs(n - 753))", "-print((min(list)))", "+S = list(eval(input()))", "+ans = float(\"i...
false
0.037019
0.036554
1.012696
[ "s371122011", "s585139176" ]
u973840923
p03290
python
s244851365
s182146430
21
19
3,064
3,064
Accepted
Accepted
9.52
from math import ceil D, G = [int(t) for t in input().split()] p = [] c = [] for i in range(D): p_, c_ = [int(t) for t in input().split()] p.append(p_) c.append(c_) def solve(G, i): """100i点以下の問題だけでGを達成する最小問題数""" if i <= 0: return float('inf') #最も配転が高い問題で総合点を超えることができるか確認 ...
from math import ceil D,G = list(map(int,input().split())) list = [list(map(int,input().split())) for _ in range(D)] def dfs(G,i): if i <= 0: return float('inf') n = min(ceil(G/(100*i)),list[i-1][0]) s = 100*i*n if n == list[i-1][0]: s += list[i-1][1] if G > s: n...
25
16
580
379
from math import ceil D, G = [int(t) for t in input().split()] p = [] c = [] for i in range(D): p_, c_ = [int(t) for t in input().split()] p.append(p_) c.append(c_) def solve(G, i): """100i点以下の問題だけでGを達成する最小問題数""" if i <= 0: return float("inf") # 最も配転が高い問題で総合点を超えることができるか確認 n = min(...
from math import ceil D, G = list(map(int, input().split())) list = [list(map(int, input().split())) for _ in range(D)] def dfs(G, i): if i <= 0: return float("inf") n = min(ceil(G / (100 * i)), list[i - 1][0]) s = 100 * i * n if n == list[i - 1][0]: s += list[i - 1][1] if G > s: ...
false
36
[ "-D, G = [int(t) for t in input().split()]", "-p = []", "-c = []", "-for i in range(D):", "- p_, c_ = [int(t) for t in input().split()]", "- p.append(p_)", "- c.append(c_)", "+D, G = list(map(int, input().split()))", "+list = [list(map(int, input().split())) for _ in range(D)]", "-def sol...
false
0.050665
0.049219
1.029398
[ "s244851365", "s182146430" ]
u197457087
p04000
python
s197520836
s490220403
1,987
877
174,180
89,944
Accepted
Accepted
55.86
H,W,N = map(int,input().split()) A = {} for i in range(N): a,b = map(int,input().split()) a-=1;b-=1 for t in range(3): for s in range(3): if 0<=a-t<H-2 and 0<=b-s<W-2: if (a-t,b-s) not in A: A[(a-t,b-s)] = 1 else: A[(a-t,b-s)] += 1 #print(A) ans = [-1...
H,W,N = list(map(int,input().split())) B = set([]) for i in range(N): a,b = list(map(int,input().split())) a-=1;b-=1 B.add((a,b)) #print(B) BB = list(B) ans = [0 for _ in range(10)] for i in range(N): cnt = 0; temp = 0 x,y = BB[i] #print(x,y) for sx in range(max(0,x-2),min(x,H-3)+1): for...
25
28
489
636
H, W, N = map(int, input().split()) A = {} for i in range(N): a, b = map(int, input().split()) a -= 1 b -= 1 for t in range(3): for s in range(3): if 0 <= a - t < H - 2 and 0 <= b - s < W - 2: if (a - t, b - s) not in A: A[(a - t, b - s)] = 1 ...
H, W, N = list(map(int, input().split())) B = set([]) for i in range(N): a, b = list(map(int, input().split())) a -= 1 b -= 1 B.add((a, b)) # print(B) BB = list(B) ans = [0 for _ in range(10)] for i in range(N): cnt = 0 temp = 0 x, y = BB[i] # print(x,y) for sx in range(max(0, x - 2)...
false
10.714286
[ "-H, W, N = map(int, input().split())", "-A = {}", "+H, W, N = list(map(int, input().split()))", "+B = set([])", "- a, b = map(int, input().split())", "+ a, b = list(map(int, input().split()))", "- for t in range(3):", "- for s in range(3):", "- if 0 <= a - t < H - 2 and 0...
false
0.046898
0.040457
1.159196
[ "s197520836", "s490220403" ]
u345966487
p03786
python
s705004850
s158664163
302
104
63,856
14,428
Accepted
Accepted
65.56
import bisect N = int(eval(input())) A = list(map(int,input().split())) assert len(A) == N A.sort() largest = A[-1] acum = [0] * N acum[0] = A[0] for i in range(1, N): acum[i] = A[i] + acum[i-1] def solve(): unreachable = None for i in range(N-2,-1,-1): bi = bisect.bisect(A, 2*A...
import itertools N = int(eval(input())) A = list(map(int,input().split())) A.sort() acum = list(itertools.accumulate(A)) def solve(): unreachable = None for i in range(N-2,-1,-1): if 2*acum[i] < A[i+1]: unreachable = i break if unreachable is None: retur...
27
17
500
367
import bisect N = int(eval(input())) A = list(map(int, input().split())) assert len(A) == N A.sort() largest = A[-1] acum = [0] * N acum[0] = A[0] for i in range(1, N): acum[i] = A[i] + acum[i - 1] def solve(): unreachable = None for i in range(N - 2, -1, -1): bi = bisect.bisect(A, 2 * A[i]) ...
import itertools N = int(eval(input())) A = list(map(int, input().split())) A.sort() acum = list(itertools.accumulate(A)) def solve(): unreachable = None for i in range(N - 2, -1, -1): if 2 * acum[i] < A[i + 1]: unreachable = i break if unreachable is None: return ...
false
37.037037
[ "-import bisect", "+import itertools", "-assert len(A) == N", "-largest = A[-1]", "-acum = [0] * N", "-acum[0] = A[0]", "-for i in range(1, N):", "- acum[i] = A[i] + acum[i - 1]", "+acum = list(itertools.accumulate(A))", "- bi = bisect.bisect(A, 2 * A[i])", "- if 2 * acum[bi - 1...
false
0.038844
0.03701
1.049562
[ "s705004850", "s158664163" ]
u119148115
p03817
python
s973350857
s236799410
309
63
78,816
61,864
Accepted
Accepted
79.61
import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし def ...
import sys def I(): return int(sys.stdin.readline().rstrip()) x = I()-1 print((x//11*2+1+(x%11)//6))
19
5
600
104
import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return list(map(int, sys.stdin.readline().rstrip().split())) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり def LI2(): return list(map(int, sys.stdin.readline().r...
import sys def I(): return int(sys.stdin.readline().rstrip()) x = I() - 1 print((x // 11 * 2 + 1 + (x % 11) // 6))
false
73.684211
[ "-", "-sys.setrecursionlimit(10**7)", "-def MI():", "- return list(map(int, sys.stdin.readline().rstrip().split()))", "-", "-", "-def LI():", "- return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり", "-", "-", "-def LI2():", "- return list(map(int, sys.stdin.readline()...
false
0.0431
0.038966
1.106097
[ "s973350857", "s236799410" ]
u677121387
p02743
python
s380214973
s703526496
35
17
5,076
2,940
Accepted
Accepted
51.43
from decimal import * a,b,c = list(map(int,input().split())) getcontext().prec = 50 if Decimal(a)**Decimal(0.5) + Decimal(b)**Decimal(0.5) < Decimal(c)**Decimal(0.5): ans = "Yes" else: ans = "No" print(ans)
a,b,c = list(map(int,input().split())) if c-a-b > 0 and (c-a-b)**2 > 4*a*b: ans = "Yes" else: ans = "No" print(ans)
8
6
215
122
from decimal import * a, b, c = list(map(int, input().split())) getcontext().prec = 50 if Decimal(a) ** Decimal(0.5) + Decimal(b) ** Decimal(0.5) < Decimal(c) ** Decimal(0.5): ans = "Yes" else: ans = "No" print(ans)
a, b, c = list(map(int, input().split())) if c - a - b > 0 and (c - a - b) ** 2 > 4 * a * b: ans = "Yes" else: ans = "No" print(ans)
false
25
[ "-from decimal import *", "-", "-getcontext().prec = 50", "-if Decimal(a) ** Decimal(0.5) + Decimal(b) ** Decimal(0.5) < Decimal(c) ** Decimal(0.5):", "+if c - a - b > 0 and (c - a - b) ** 2 > 4 * a * b:" ]
false
0.037869
0.035728
1.059921
[ "s380214973", "s703526496" ]
u747602774
p03425
python
s372577238
s883248795
242
164
3,188
3,064
Accepted
Accepted
32.23
N=int(input()) name_dict={'M':0,'A':0,'R':0,'C':0,'H':0} for n in range(N): S=list(input()) if S[0] in name_dict: name_dict[S[0]]+=1 ans=name_dict['M']*name_dict['A']*name_dict['R']\ +name_dict['M']*name_dict['A']*name_dict['C']\ +name_dict['M']*name_dict['A']*name_dict['H']\ +nam...
n = int(eval(input())) c = [0 for i in range(5)] for i in range(n): s = eval(input()) if s[0] == 'M': c[0] += 1 elif s[0] == 'A': c[1] += 1 elif s[0] == 'R': c[2] += 1 elif s[0] == 'C': c[3] += 1 elif s[0] == 'H': c[4] += 1 from itertools imp...
18
19
686
421
N = int(input()) name_dict = {"M": 0, "A": 0, "R": 0, "C": 0, "H": 0} for n in range(N): S = list(input()) if S[0] in name_dict: name_dict[S[0]] += 1 ans = ( name_dict["M"] * name_dict["A"] * name_dict["R"] + name_dict["M"] * name_dict["A"] * name_dict["C"] + name_dict["M"] * name_dict["A"] ...
n = int(eval(input())) c = [0 for i in range(5)] for i in range(n): s = eval(input()) if s[0] == "M": c[0] += 1 elif s[0] == "A": c[1] += 1 elif s[0] == "R": c[2] += 1 elif s[0] == "C": c[3] += 1 elif s[0] == "H": c[4] += 1 from itertools import combinatio...
false
5.263158
[ "-N = int(input())", "-name_dict = {\"M\": 0, \"A\": 0, \"R\": 0, \"C\": 0, \"H\": 0}", "-for n in range(N):", "- S = list(input())", "- if S[0] in name_dict:", "- name_dict[S[0]] += 1", "-ans = (", "- name_dict[\"M\"] * name_dict[\"A\"] * name_dict[\"R\"]", "- + name_dict[\"M\"] ...
false
0.035948
0.038873
0.924757
[ "s372577238", "s883248795" ]
u562935282
p03785
python
s255960492
s844404027
598
242
8,280
8,280
Accepted
Accepted
59.53
n, c, k = list(map(int, input().split())) t = [int(eval(input())) for _ in range(n)] t = sorted(t) cnt_bus = 0 i = 0 while i < n: cnt_rider = 0 l, r = i, min(i + c - 1, n - 1) while l <= r:#適当なmidを求める mid = (l + r) // 2 if t[mid] > t[i] + k: r = mid - 1 else...
n, c, k = list(map(int, input().split())) ts = [int(eval(input())) for _ in range(n)] ts = sorted(ts) cnt = 0 rider = 0 limit = -1 for t in ts: if (rider == c) or not(t <= limit <= (t + k)): cnt += 1 limit = (t + k) rider = 1 else: rider += 1 print(cnt)
23
16
512
298
n, c, k = list(map(int, input().split())) t = [int(eval(input())) for _ in range(n)] t = sorted(t) cnt_bus = 0 i = 0 while i < n: cnt_rider = 0 l, r = i, min(i + c - 1, n - 1) while l <= r: # 適当なmidを求める mid = (l + r) // 2 if t[mid] > t[i] + k: r = mid - 1 else: ...
n, c, k = list(map(int, input().split())) ts = [int(eval(input())) for _ in range(n)] ts = sorted(ts) cnt = 0 rider = 0 limit = -1 for t in ts: if (rider == c) or not (t <= limit <= (t + k)): cnt += 1 limit = t + k rider = 1 else: rider += 1 print(cnt)
false
30.434783
[ "-t = [int(eval(input())) for _ in range(n)]", "-t = sorted(t)", "-cnt_bus = 0", "-i = 0", "-while i < n:", "- cnt_rider = 0", "- l, r = i, min(i + c - 1, n - 1)", "- while l <= r: # 適当なmidを求める", "- mid = (l + r) // 2", "- if t[mid] > t[i] + k:", "- r = mid - 1...
false
0.131527
0.048308
2.722644
[ "s255960492", "s844404027" ]
u020390084
p03273
python
s635731874
s848512315
158
30
12,536
4,468
Accepted
Accepted
81.01
#!/usr/bin/env python3 import numpy as np def main(): H,W = list(map(int,input().split())) a = [list(eval(input())) for _ in range(H)] ok_i = [] ok_j = [] for i in range(H): for j in range(W): if a[i][j] == '#': ok_i.append(i) break ...
#!/usr/bin/env python3 h, w = map(int, input().split()) a = [''] * h for i in range(h): a[i] = input() row = [False] * h col = [False] * w for i in range(h): for j in range(w): if a[i][j] == '#': row[i] = True col[j] = True for i in range(h): if row[i]: for j in range(w): if col[j]: ...
41
21
824
362
#!/usr/bin/env python3 import numpy as np def main(): H, W = list(map(int, input().split())) a = [list(eval(input())) for _ in range(H)] ok_i = [] ok_j = [] for i in range(H): for j in range(W): if a[i][j] == "#": ok_i.append(i) break for i i...
#!/usr/bin/env python3 h, w = map(int, input().split()) a = [""] * h for i in range(h): a[i] = input() row = [False] * h col = [False] * w for i in range(h): for j in range(w): if a[i][j] == "#": row[i] = True col[j] = True for i in range(h): if row[i]: for j in range...
false
48.780488
[ "-import numpy as np", "-", "-", "-def main():", "- H, W = list(map(int, input().split()))", "- a = [list(eval(input())) for _ in range(H)]", "- ok_i = []", "- ok_j = []", "- for i in range(H):", "- for j in range(W):", "- if a[i][j] == \"#\":", "- ...
false
0.077995
0.038468
2.027518
[ "s635731874", "s848512315" ]
u101350975
p02706
python
s440859924
s585884600
25
21
9,848
10,064
Accepted
Accepted
16
N, M = list(map(int, input().split())) A = list(map(int, input().split())) B = sum(A) if B > N: ans = -1 else: ans = N - B print(ans)
N, M = list(map(int, input().split())) A = list(map(int, input().split())) sum = sum(A) if sum > N: ans = -1 else: ans = N - sum print(ans)
8
8
143
149
N, M = list(map(int, input().split())) A = list(map(int, input().split())) B = sum(A) if B > N: ans = -1 else: ans = N - B print(ans)
N, M = list(map(int, input().split())) A = list(map(int, input().split())) sum = sum(A) if sum > N: ans = -1 else: ans = N - sum print(ans)
false
0
[ "-B = sum(A)", "-if B > N:", "+sum = sum(A)", "+if sum > N:", "- ans = N - B", "+ ans = N - sum" ]
false
0.035214
0.035843
0.982444
[ "s440859924", "s585884600" ]
u573754721
p02971
python
s039649908
s434929596
606
550
14,112
14,080
Accepted
Accepted
9.24
n=int(eval(input())) L=[] for i in range(n): L.append(int(eval(input()))) L2=sorted(L) for i in range(n): if L[i]==L2[-1]: print((L2[-2])) else: print((L2[-1]))
n=int(eval(input())) a=[int(eval(input())) for _ in range(n)] b=sorted(a) m1=b[-1] m2=b[-2] for i in range(n): if a[i]==m1: print(m2) else: print(m1)
11
11
197
173
n = int(eval(input())) L = [] for i in range(n): L.append(int(eval(input()))) L2 = sorted(L) for i in range(n): if L[i] == L2[-1]: print((L2[-2])) else: print((L2[-1]))
n = int(eval(input())) a = [int(eval(input())) for _ in range(n)] b = sorted(a) m1 = b[-1] m2 = b[-2] for i in range(n): if a[i] == m1: print(m2) else: print(m1)
false
0
[ "-L = []", "+a = [int(eval(input())) for _ in range(n)]", "+b = sorted(a)", "+m1 = b[-1]", "+m2 = b[-2]", "- L.append(int(eval(input())))", "-L2 = sorted(L)", "-for i in range(n):", "- if L[i] == L2[-1]:", "- print((L2[-2]))", "+ if a[i] == m1:", "+ print(m2)", "- ...
false
0.040778
0.100212
0.406914
[ "s039649908", "s434929596" ]
u285891772
p03273
python
s114751808
s648690286
53
41
6,484
5,204
Accepted
Accepted
22.64
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2 from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemgetter, mul from copy import deepcopy,...
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians#, log2 from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemgetter, mul from copy import deepcopy...
44
46
1,187
1,241
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2 from itertools import ( accumulate, permutations, combinations, combinations_with_replacement, product, groupby, ) from operator import itemgetter, mul fr...
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians # , log2 from itertools import ( accumulate, permutations, combinations, combinations_with_replacement, product, groupby, ) from operator import itemgetter, mu...
false
4.347826
[ "-from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2", "+from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians # , log2", "-from bisect import bisect, bisect_left", "+from bisect import bisect, bisect_left, insort, insort_left", "+# import numpy as np", "+# from dec...
false
0.139432
0.112382
1.240702
[ "s114751808", "s648690286" ]
u633068244
p00506
python
s889886056
s778155325
180
30
7,100
8,860
Accepted
Accepted
83.33
def gcd(a,b): return a if b==0 else gcd(b,a%b) n=eval(input()) if n==2: a,b=list(map(int,input().split())) g=gcd(a,b) else: a,b,c=list(map(int,input().split())) g=gcd(gcd(a,b),c) for i in range(1,g+1): if gcd(i,g)==i:print(i)
from fractions import gcd from functools import reduce n=eval(input()) L=list(map(int,input().split())) g=reduce(gcd,L) for i in range(1,g+1): if g%i==0:print(i)
12
6
233
132
def gcd(a, b): return a if b == 0 else gcd(b, a % b) n = eval(input()) if n == 2: a, b = list(map(int, input().split())) g = gcd(a, b) else: a, b, c = list(map(int, input().split())) g = gcd(gcd(a, b), c) for i in range(1, g + 1): if gcd(i, g) == i: print(i)
from fractions import gcd from functools import reduce n = eval(input()) L = list(map(int, input().split())) g = reduce(gcd, L) for i in range(1, g + 1): if g % i == 0: print(i)
false
50
[ "-def gcd(a, b):", "- return a if b == 0 else gcd(b, a % b)", "-", "+from fractions import gcd", "+from functools import reduce", "-if n == 2:", "- a, b = list(map(int, input().split()))", "- g = gcd(a, b)", "-else:", "- a, b, c = list(map(int, input().split()))", "- g = gcd(gcd(a...
false
0.040958
0.049198
0.832515
[ "s889886056", "s778155325" ]
u440180827
p02386
python
s273290370
s437906845
60
50
7,832
7,816
Accepted
Accepted
16.67
def check(x, y): z = [0, 1, 2] for i in range(6): order = [0, 0, 0] for j in range(3): if {x[j], x[-j-1]} != {y[z[j]], y[-z[j]-1]}: break if x[j] == y[z[j]]: order[j] = 1 if x[j] == x[-j-1]: o...
def check(x, y): for i in range(6): order = [0, 0, 0] for j in range(3): if {x[j], x[-j-1]} != {y[z[i][j]], y[-z[i][j]-1]}: break if x[j] == y[z[i][j]]: order[j] = 1 if x[j] == x[-j-1]: order[j] = 2 ...
33
31
820
842
def check(x, y): z = [0, 1, 2] for i in range(6): order = [0, 0, 0] for j in range(3): if {x[j], x[-j - 1]} != {y[z[j]], y[-z[j] - 1]}: break if x[j] == y[z[j]]: order[j] = 1 if x[j] == x[-j - 1]: order[j...
def check(x, y): for i in range(6): order = [0, 0, 0] for j in range(3): if {x[j], x[-j - 1]} != {y[z[i][j]], y[-z[i][j] - 1]}: break if x[j] == y[z[i][j]]: order[j] = 1 if x[j] == x[-j - 1]: order[j] = 2 ...
false
6.060606
[ "- z = [0, 1, 2]", "- if {x[j], x[-j - 1]} != {y[z[j]], y[-z[j] - 1]}:", "+ if {x[j], x[-j - 1]} != {y[z[i][j]], y[-z[i][j] - 1]}:", "- if x[j] == y[z[j]]:", "+ if x[j] == y[z[i][j]]:", "- if 2 in order or (i < 3) == sum(order) % 2:", "+ ...
false
0.0432
0.043122
1.001813
[ "s273290370", "s437906845" ]
u151005508
p03829
python
s949518471
s210852244
275
228
71,320
62,704
Accepted
Accepted
17.09
N, A, B = list(map(int, input().split())) X = list(map(int, input().split())) X.sort() group=[[X[0]]] for i in range(N-1): if (X[i+1] - X[i]) * A > B: group.append([X[i+1]]) else: group[-1].append(X[i+1]) #print(group) ans = (len(group) - 1) * B for g in group: ans += (max(...
N, A, B = list(map(int, input().split())) X = list(map(int, input().split())) X.sort() ans = 0 for i in range(N-1): ans += min((X[i+1] - X[i]) * A, B) print(ans)
17
8
342
167
N, A, B = list(map(int, input().split())) X = list(map(int, input().split())) X.sort() group = [[X[0]]] for i in range(N - 1): if (X[i + 1] - X[i]) * A > B: group.append([X[i + 1]]) else: group[-1].append(X[i + 1]) # print(group) ans = (len(group) - 1) * B for g in group: ans += (max(g) - mi...
N, A, B = list(map(int, input().split())) X = list(map(int, input().split())) X.sort() ans = 0 for i in range(N - 1): ans += min((X[i + 1] - X[i]) * A, B) print(ans)
false
52.941176
[ "-group = [[X[0]]]", "+ans = 0", "- if (X[i + 1] - X[i]) * A > B:", "- group.append([X[i + 1]])", "- else:", "- group[-1].append(X[i + 1])", "-# print(group)", "-ans = (len(group) - 1) * B", "-for g in group:", "- ans += (max(g) - min(g)) * A", "+ ans += min((X[i + 1] -...
false
0.03974
0.040211
0.98828
[ "s949518471", "s210852244" ]
u426534722
p02328
python
s681453266
s067435339
190
160
23,000
22,920
Accepted
Accepted
15.79
import sys from collections import deque readline = sys.stdin.readline n = int(readline()) li = list(map(int, readline().split())) def square(P): G = [] L = deque() for i, v in enumerate(P): if not L: L.append((i, v)) continue if v > L[-1][1]: ...
import sys from collections import deque readline = sys.stdin.readline n = int(readline()) li = list(map(int, readline().split())) def square(P): G = [] L = deque() for i, v in enumerate(P): if not L: L.append((i, v)) continue if v > L[-1][1]: ...
25
25
653
648
import sys from collections import deque readline = sys.stdin.readline n = int(readline()) li = list(map(int, readline().split())) def square(P): G = [] L = deque() for i, v in enumerate(P): if not L: L.append((i, v)) continue if v > L[-1][1]: L.append(...
import sys from collections import deque readline = sys.stdin.readline n = int(readline()) li = list(map(int, readline().split())) def square(P): G = [] L = deque() for i, v in enumerate(P): if not L: L.append((i, v)) continue if v > L[-1][1]: L.append(...
false
0
[ "- G.append((len(P) - a[0]) * a[1])", "+ G.append((n - a[0]) * a[1])" ]
false
0.085691
0.106944
0.801273
[ "s681453266", "s067435339" ]
u312025627
p03435
python
s541676773
s235837299
557
206
19,188
39,880
Accepted
Accepted
63.02
def main(): import numpy as np A = np.array([[1, 0, 0, 1, 0, 0], [1, 0, 0, 0, 1, 0], [1, 0, 0, 0, 0, 1], [0, 1, 0, 1, 0, 0], [0, 1, 0, 0, 1, 0], [0, 1, 0, 0, 0, 1], [0, 0, 1, 1, 0, 0], ...
def main(): A = [[int(i) for i in input().split()] for j in range(3)] from itertools import product for a1, a2, a3 in product(range(101), repeat=3): c1 = A[0][0] - a1 == A[1][0] - a2 == A[2][0] - a3 c2 = A[0][1] - a1 == A[1][1] - a2 == A[2][1] - a3 c3 = A[0][2] - a1 == A[1][2] ...
26
14
793
465
def main(): import numpy as np A = np.array( [ [1, 0, 0, 1, 0, 0], [1, 0, 0, 0, 1, 0], [1, 0, 0, 0, 0, 1], [0, 1, 0, 1, 0, 0], [0, 1, 0, 0, 1, 0], [0, 1, 0, 0, 0, 1], [0, 0, 1, 1, 0, 0], [0, 0, 1, 0, 1, 0], ...
def main(): A = [[int(i) for i in input().split()] for j in range(3)] from itertools import product for a1, a2, a3 in product(range(101), repeat=3): c1 = A[0][0] - a1 == A[1][0] - a2 == A[2][0] - a3 c2 = A[0][1] - a1 == A[1][1] - a2 == A[2][1] - a3 c3 = A[0][2] - a1 == A[1][2] - a2 ...
false
46.153846
[ "- import numpy as np", "+ A = [[int(i) for i in input().split()] for j in range(3)]", "+ from itertools import product", "- A = np.array(", "- [", "- [1, 0, 0, 1, 0, 0],", "- [1, 0, 0, 0, 1, 0],", "- [1, 0, 0, 0, 0, 1],", "- [0, 1, 0, 1...
false
0.491319
0.691521
0.71049
[ "s541676773", "s235837299" ]
u968166680
p03222
python
s996113063
s055647189
51
44
9,156
9,136
Accepted
Accepted
13.73
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def main(): H, W, K = list(map(int, readline().split())) dp = [0] * W dp[0] = 1 for _ in range(H): dp, dp_prev = [0] ...
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def main(): H, W, K = list(map(int, readline().split())) dp = [0] * W dp[0] = 1 for _ in range(H): dp, dp_prev = [0] ...
40
41
995
1,022
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10**9) INF = 1 << 60 MOD = 1000000007 def main(): H, W, K = list(map(int, readline().split())) dp = [0] * W dp[0] = 1 for _ in range(H): dp, dp_prev = [0] * W, dp for m...
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10**9) INF = 1 << 60 MOD = 1000000007 def main(): H, W, K = list(map(int, readline().split())) dp = [0] * W dp[0] = 1 for _ in range(H): dp, dp_prev = [0] * W, dp for m...
false
2.439024
[ "+ break" ]
false
0.042779
0.038806
1.102366
[ "s996113063", "s055647189" ]
u281303342
p03826
python
s009779871
s791163065
20
17
3,060
2,940
Accepted
Accepted
15
A,B,C,D = list(map(int,input().split())) print((max(A*B,C*D)))
# python3 (3.4.3) import sys input = sys.stdin.readline # main A,B,C,D = list(map(int,input().split())) print((max(A*B,C*D)))
2
8
55
126
A, B, C, D = list(map(int, input().split())) print((max(A * B, C * D)))
# python3 (3.4.3) import sys input = sys.stdin.readline # main A, B, C, D = list(map(int, input().split())) print((max(A * B, C * D)))
false
75
[ "+# python3 (3.4.3)", "+import sys", "+", "+input = sys.stdin.readline", "+# main" ]
false
0.082525
0.049535
1.665986
[ "s009779871", "s791163065" ]
u814986259
p03599
python
s253270446
s336204572
143
23
3,316
3,064
Accepted
Accepted
83.92
A, B, C, D, E, F = list(map(int, input().split())) water = set() for i in range(F//(100*A) + 1): for j in range(F // (100*B) + 1): if 100*A * i + 100*j*B <= F: water |= {100*A * i + 100*j*B} else: break sugar = set() for i in range(F//C + 1): for j in range(...
A, B, C, D, E, F = list(map(int, input().split())) A *= 100 B *= 100 dp = [-1]*(F+1) if A <= F: dp[A] = 0 if B <= F: dp[B] = 0 for i in range(A, F + 1): if A <= i: dp[i] = max(dp[i - A], dp[i]) if B <= i: dp[i] = max(dp[i - B], dp[i]) if C <= i and dp[i-C] >= 0: ...
27
29
660
677
A, B, C, D, E, F = list(map(int, input().split())) water = set() for i in range(F // (100 * A) + 1): for j in range(F // (100 * B) + 1): if 100 * A * i + 100 * j * B <= F: water |= {100 * A * i + 100 * j * B} else: break sugar = set() for i in range(F // C + 1): for j in ...
A, B, C, D, E, F = list(map(int, input().split())) A *= 100 B *= 100 dp = [-1] * (F + 1) if A <= F: dp[A] = 0 if B <= F: dp[B] = 0 for i in range(A, F + 1): if A <= i: dp[i] = max(dp[i - A], dp[i]) if B <= i: dp[i] = max(dp[i - B], dp[i]) if C <= i and dp[i - C] >= 0: if dp[i...
false
6.896552
[ "-water = set()", "-for i in range(F // (100 * A) + 1):", "- for j in range(F // (100 * B) + 1):", "- if 100 * A * i + 100 * j * B <= F:", "- water |= {100 * A * i + 100 * j * B}", "- else:", "- break", "-sugar = set()", "-for i in range(F // C + 1):", "- ...
false
0.168074
0.052585
3.196256
[ "s253270446", "s336204572" ]
u928784113
p03574
python
s470806590
s104738032
34
31
3,188
3,188
Accepted
Accepted
8.82
H,W = list(map(int,input().split())) S = [eval(input()) for i in range(H)] dx = [1,1,1,0,0,-1,-1,-1] dy = [1,0,-1,1,-1,1,0,-1] A = [[] for i in range(H)] for i in range(H): for j in range(W): count = 0 for k in range(8): ny = i + dy[k] nx = j + dx[k] ...
H,W = list(map(int,input().split())) S = [list(eval(input())) for i in range(H)] dx = [1,1,1,0,0,-1,-1,-1] dy = [1,0,-1,1,-1,1,0,-1] for j in range(H): for i in range(W): cnt = 0 for k in range(8): if 0<=i+dx[k]<W and 0<=j+dy[k]<H: if S[j+dy[k]][i+dx[k]]=="#": ...
25
23
627
555
H, W = list(map(int, input().split())) S = [eval(input()) for i in range(H)] dx = [1, 1, 1, 0, 0, -1, -1, -1] dy = [1, 0, -1, 1, -1, 1, 0, -1] A = [[] for i in range(H)] for i in range(H): for j in range(W): count = 0 for k in range(8): ny = i + dy[k] nx = j + dx[k] ...
H, W = list(map(int, input().split())) S = [list(eval(input())) for i in range(H)] dx = [1, 1, 1, 0, 0, -1, -1, -1] dy = [1, 0, -1, 1, -1, 1, 0, -1] for j in range(H): for i in range(W): cnt = 0 for k in range(8): if 0 <= i + dx[k] < W and 0 <= j + dy[k] < H: if S[j + dy[...
false
8
[ "-S = [eval(input()) for i in range(H)]", "+S = [list(eval(input())) for i in range(H)]", "-A = [[] for i in range(H)]", "+for j in range(H):", "+ for i in range(W):", "+ cnt = 0", "+ for k in range(8):", "+ if 0 <= i + dx[k] < W and 0 <= j + dy[k] < H:", "+ ...
false
0.062683
0.061791
1.014433
[ "s470806590", "s104738032" ]
u847467233
p00150
python
s293565645
s095138945
210
150
5,688
5,716
Accepted
Accepted
28.57
# AOJ 0150 Twin Prime # Python3 2018.6.17 bal4u MAX = 10000 SQRT = 100 # sqrt(MAX) prime = [True for i in range(MAX)] def sieve(): for i in range(4, MAX, 2): prime[i] = False for i in range(3, SQRT, 2): if prime[i] is True: for j in range(i*i, MAX, i): prime[j] = False sieve() while Tr...
# AOJ 0150 Twin Prime # Python3 2018.6.17 bal4u MAX = 10001 SQRT = 100 # sqrt(MAX) prime = [True for i in range(MAX)] def sieve(): for i in range(4, MAX, 2): prime[i] = False for i in range(3, SQRT, 2): if prime[i] is True: for j in range(i*i, MAX, i): prime[j] = False sieve() tbl = [0...
21
26
453
522
# AOJ 0150 Twin Prime # Python3 2018.6.17 bal4u MAX = 10000 SQRT = 100 # sqrt(MAX) prime = [True for i in range(MAX)] def sieve(): for i in range(4, MAX, 2): prime[i] = False for i in range(3, SQRT, 2): if prime[i] is True: for j in range(i * i, MAX, i): prime[j] =...
# AOJ 0150 Twin Prime # Python3 2018.6.17 bal4u MAX = 10001 SQRT = 100 # sqrt(MAX) prime = [True for i in range(MAX)] def sieve(): for i in range(4, MAX, 2): prime[i] = False for i in range(3, SQRT, 2): if prime[i] is True: for j in range(i * i, MAX, i): prime[j] =...
false
19.230769
[ "-MAX = 10000", "+MAX = 10001", "+tbl = [0] * MAX", "+ans = 0", "+for i in range(5, MAX, 2):", "+ if prime[i] and prime[i - 2]:", "+ ans = i", "+ tbl[i] = ans", "- while not prime[n] or not prime[n - 2]:", "- n -= 2", "- print((n - 2, n))", "+ print((tbl[n] - 2, tb...
false
0.042947
0.053525
0.802362
[ "s293565645", "s095138945" ]
u690536347
p03141
python
s493476292
s386224939
559
482
30,192
20,992
Accepted
Accepted
13.77
n=int(eval(input())) l=[[i]+list(map(int,input().split())) for i in range(n)] l.sort(key=lambda x:-(x[1]+x[2])) pa,pb=0,0 used=set() v=0 while pa<n and pb<n: while pa<n and l[pa][0] in used: pa+=1 if pa<n: used.add(l[pa][0]) v+=l[pa][1] while pb<n and l[pb][0] in used: pb+=1 if...
N = int(eval(input())) l = [] for _ in range(N): A, B = list(map(int, input().split())) l.append((-abs(A+B), -A, -B)) l.sort() a, b = 0, 0 for i in range(N): if i%2: b -= l[i][2] else: a -= l[i][1] print((a-b))
21
14
373
243
n = int(eval(input())) l = [[i] + list(map(int, input().split())) for i in range(n)] l.sort(key=lambda x: -(x[1] + x[2])) pa, pb = 0, 0 used = set() v = 0 while pa < n and pb < n: while pa < n and l[pa][0] in used: pa += 1 if pa < n: used.add(l[pa][0]) v += l[pa][1] while pb < n and ...
N = int(eval(input())) l = [] for _ in range(N): A, B = list(map(int, input().split())) l.append((-abs(A + B), -A, -B)) l.sort() a, b = 0, 0 for i in range(N): if i % 2: b -= l[i][2] else: a -= l[i][1] print((a - b))
false
33.333333
[ "-n = int(eval(input()))", "-l = [[i] + list(map(int, input().split())) for i in range(n)]", "-l.sort(key=lambda x: -(x[1] + x[2]))", "-pa, pb = 0, 0", "-used = set()", "-v = 0", "-while pa < n and pb < n:", "- while pa < n and l[pa][0] in used:", "- pa += 1", "- if pa < n:", "- ...
false
0.082742
0.036575
2.262269
[ "s493476292", "s386224939" ]
u077291787
p02771
python
s126798260
s244212911
24
17
2,940
2,940
Accepted
Accepted
29.17
# A - Poor def main(): *ABC, = list(map(int, input().split())) is_poor = len(set(ABC)) == 2 print(("Yes" if is_poor else "No")) if __name__ == "__main__": main()
# A - Poor def is_poor(x: int, y: int, z: int) -> bool: for _ in range(3): x, y, z = y, z, x if x == y != z: return True return False def main(): A, B, C = list(map(int, input().split())) print(("Yes" if is_poor(A, B, C) else "No")) if __name__ == "__main__"...
9
16
180
326
# A - Poor def main(): (*ABC,) = list(map(int, input().split())) is_poor = len(set(ABC)) == 2 print(("Yes" if is_poor else "No")) if __name__ == "__main__": main()
# A - Poor def is_poor(x: int, y: int, z: int) -> bool: for _ in range(3): x, y, z = y, z, x if x == y != z: return True return False def main(): A, B, C = list(map(int, input().split())) print(("Yes" if is_poor(A, B, C) else "No")) if __name__ == "__main__": main()
false
43.75
[ "+def is_poor(x: int, y: int, z: int) -> bool:", "+ for _ in range(3):", "+ x, y, z = y, z, x", "+ if x == y != z:", "+ return True", "+ return False", "+", "+", "- (*ABC,) = list(map(int, input().split()))", "- is_poor = len(set(ABC)) == 2", "- print((\"Y...
false
0.036121
0.105396
0.342713
[ "s126798260", "s244212911" ]
u426534722
p02257
python
s982787274
s820941558
290
40
7,796
7,664
Accepted
Accepted
86.21
from sys import stdin import math def isPrime(x): if x == 2 or x == 3: return True elif (x < 2 or x % 2 == 0 or x % 3 == 0): return False s = int(math.sqrt(x) + 1) for i in range(5, s + 1, 2): if x % i == 0: return False return True n = int(stdin.readline()) cnt = 0 for i in range...
from sys import stdin def isPrime(x): if x == 2: return 1 elif x % 2 == 0: return 0 return pow(2, x - 1, x) == 1 n = int(stdin.readline()) cnt = 0 for i in range(0, n): cnt += isPrime(int(stdin.readline())) print(cnt)
14
10
388
242
from sys import stdin import math def isPrime(x): if x == 2 or x == 3: return True elif x < 2 or x % 2 == 0 or x % 3 == 0: return False s = int(math.sqrt(x) + 1) for i in range(5, s + 1, 2): if x % i == 0: return False return True n = int(stdin.readline()) cnt...
from sys import stdin def isPrime(x): if x == 2: return 1 elif x % 2 == 0: return 0 return pow(2, x - 1, x) == 1 n = int(stdin.readline()) cnt = 0 for i in range(0, n): cnt += isPrime(int(stdin.readline())) print(cnt)
false
28.571429
[ "-import math", "- if x == 2 or x == 3:", "- return True", "- elif x < 2 or x % 2 == 0 or x % 3 == 0:", "- return False", "- s = int(math.sqrt(x) + 1)", "- for i in range(5, s + 1, 2):", "- if x % i == 0:", "- return False", "- return True", "+ i...
false
0.099038
0.035964
2.753783
[ "s982787274", "s820941558" ]
u968166680
p02720
python
s032403594
s908225535
76
67
86,684
72,824
Accepted
Accepted
11.84
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def main(): K = int(readline()) vec = list(range(1, 10)) for i in range(K): tail = vec[i] % 10 if tail == 0: ...
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def main(): K = int(readline()) vec = list(range(1, 10)) for i in range(K): tail = vec[i] % 10 n10 = vec[i] * 10 ...
36
37
807
778
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10**9) INF = 1 << 60 MOD = 1000000007 def main(): K = int(readline()) vec = list(range(1, 10)) for i in range(K): tail = vec[i] % 10 if tail == 0: vec.append(ve...
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10**9) INF = 1 << 60 MOD = 1000000007 def main(): K = int(readline()) vec = list(range(1, 10)) for i in range(K): tail = vec[i] % 10 n10 = vec[i] * 10 if tail == 0:...
false
2.702703
[ "+ n10 = vec[i] * 10", "- vec.append(vec[i] * 10 + tail)", "- vec.append(vec[i] * 10 + tail + 1)", "+ vec.append(n10 + tail)", "+ vec.append(n10 + tail + 1)", "- vec.append(vec[i] * 10 + tail - 1)", "- vec.append(vec[i] * 10 + tail...
false
0.074463
0.124486
0.598158
[ "s032403594", "s908225535" ]
u806976856
p03645
python
s198437345
s800193777
695
498
43,232
108,924
Accepted
Accepted
28.35
from _collections import deque n,m=list(map(int,input().split())) edg=[[] for i in range(n+1)] for i in range(m): a,b=list(map(int,input().split())) edg[a].append(b) edg[b].append(a) dep=[-1]*(n+1) dep[1]=0 data=deque([1]) while len(data)>0: p=data.popleft() for i in edg[p]: if ...
n,m=list(map(int,input().split())) edg=[[] for i in range(n+1)] for i in range(m): a,b=list(map(int,input().split())) edg[a].append(b) edg[b].append(a) f=1 for i in range(2,n+1): if 1 in edg[i] and n in edg[i]: f=0 print(("POSSIBLE" if f==0 else "IMPOSSIBLE"))
18
11
429
281
from _collections import deque n, m = list(map(int, input().split())) edg = [[] for i in range(n + 1)] for i in range(m): a, b = list(map(int, input().split())) edg[a].append(b) edg[b].append(a) dep = [-1] * (n + 1) dep[1] = 0 data = deque([1]) while len(data) > 0: p = data.popleft() for i in edg[p...
n, m = list(map(int, input().split())) edg = [[] for i in range(n + 1)] for i in range(m): a, b = list(map(int, input().split())) edg[a].append(b) edg[b].append(a) f = 1 for i in range(2, n + 1): if 1 in edg[i] and n in edg[i]: f = 0 print(("POSSIBLE" if f == 0 else "IMPOSSIBLE"))
false
38.888889
[ "-from _collections import deque", "-", "-dep = [-1] * (n + 1)", "-dep[1] = 0", "-data = deque([1])", "-while len(data) > 0:", "- p = data.popleft()", "- for i in edg[p]:", "- if dep[i] == -1:", "- dep[i] = dep[p] + 1", "- data.append(i)", "-print((\"POSSIBLE...
false
0.039889
0.007908
5.044272
[ "s198437345", "s800193777" ]
u895515293
p03420
python
s999010914
s806145514
91
79
2,940
2,940
Accepted
Accepted
13.19
N,K=list(map(int,input().split())) b,s=K+1,0 while b <= N: c=N%b s+=(N//b)*(b-K)+max(0,c-K+1) b+=1 print((s if K!=0 else N*N))
N,K=list(map(int,input().split())) s=0 for b in range(K+1,N+1):s+=(N//b)*(b-K)+max(0,N%b-K+1) print((s if K!=0 else N*N))
7
4
127
116
N, K = list(map(int, input().split())) b, s = K + 1, 0 while b <= N: c = N % b s += (N // b) * (b - K) + max(0, c - K + 1) b += 1 print((s if K != 0 else N * N))
N, K = list(map(int, input().split())) s = 0 for b in range(K + 1, N + 1): s += (N // b) * (b - K) + max(0, N % b - K + 1) print((s if K != 0 else N * N))
false
42.857143
[ "-b, s = K + 1, 0", "-while b <= N:", "- c = N % b", "- s += (N // b) * (b - K) + max(0, c - K + 1)", "- b += 1", "+s = 0", "+for b in range(K + 1, N + 1):", "+ s += (N // b) * (b - K) + max(0, N % b - K + 1)" ]
false
0.034034
0.034545
0.985202
[ "s999010914", "s806145514" ]
u282228874
p03112
python
s161372625
s433573108
1,416
1,016
94,300
75,868
Accepted
Accepted
28.25
import bisect,sys input = sys.stdin.readline a,b,q = list(map(int,input().split())) INF = float('inf') S = [-INF]+[int(eval(input())) for i in range(a)]+[INF] T = [-INF]+[int(eval(input())) for i in range(b)]+[INF] def f(S,T): res = INF s = bisect.bisect_left(S,x) for i in range(2): for j i...
from bisect import bisect_left import sys input = sys.stdin.readline a,b,q = list(map(int,input().split())) inf = float('inf') S = [-inf]+[int(eval(input())) for i in range(a)]+[inf] T = [-inf]+[int(eval(input())) for i in range(b)]+[inf] def f(S,T): res = 10**30 s = bisect_left(S,x) ans = 0 ...
21
30
556
682
import bisect, sys input = sys.stdin.readline a, b, q = list(map(int, input().split())) INF = float("inf") S = [-INF] + [int(eval(input())) for i in range(a)] + [INF] T = [-INF] + [int(eval(input())) for i in range(b)] + [INF] def f(S, T): res = INF s = bisect.bisect_left(S, x) for i in range(2): ...
from bisect import bisect_left import sys input = sys.stdin.readline a, b, q = list(map(int, input().split())) inf = float("inf") S = [-inf] + [int(eval(input())) for i in range(a)] + [inf] T = [-inf] + [int(eval(input())) for i in range(b)] + [inf] def f(S, T): res = 10**30 s = bisect_left(S, x) ans = 0...
false
30
[ "-import bisect, sys", "+from bisect import bisect_left", "+import sys", "-INF = float(\"inf\")", "-S = [-INF] + [int(eval(input())) for i in range(a)] + [INF]", "-T = [-INF] + [int(eval(input())) for i in range(b)] + [INF]", "+inf = float(\"inf\")", "+S = [-inf] + [int(eval(input())) for i in range(a...
false
0.074427
0.066483
1.119485
[ "s161372625", "s433573108" ]
u780475861
p02814
python
s940963101
s264241383
129
118
14,532
14,536
Accepted
Accepted
8.53
import sys read = sys.stdin.buffer.read from fractions import gcd from functools import reduce n,m,*alst = list(map(int,read().split())) mm=2*m def lcm(x,y): g=gcd(x,y) if x//g %2==0 or y//g%2==0: return 0 g=x*y//g if g>mm: return 0 return g f=lambda x,y:0 if x==0 else lcm(x,y) g=redu...
import sys read = sys.stdin.buffer.read from fractions import gcd from functools import reduce n, m, *alst = list(map(int, read().split())) mm = 2 * m def lcm(x, y): g = gcd(x, y) if x // g % 2 == 0 or y // g % 2 == 0: print((0)) quit() g = x * y // g if g > mm: ...
23
24
408
429
import sys read = sys.stdin.buffer.read from fractions import gcd from functools import reduce n, m, *alst = list(map(int, read().split())) mm = 2 * m def lcm(x, y): g = gcd(x, y) if x // g % 2 == 0 or y // g % 2 == 0: return 0 g = x * y // g if g > mm: return 0 return g f = la...
import sys read = sys.stdin.buffer.read from fractions import gcd from functools import reduce n, m, *alst = list(map(int, read().split())) mm = 2 * m def lcm(x, y): g = gcd(x, y) if x // g % 2 == 0 or y // g % 2 == 0: print((0)) quit() g = x * y // g if g > mm: print((0)) ...
false
4.166667
[ "- return 0", "+ print((0))", "+ quit()", "- return 0", "+ print((0))", "+ quit()", "-f = lambda x, y: 0 if x == 0 else lcm(x, y)", "-g = reduce(f, alst)", "-if g == 0:", "- print((0))", "- quit()", "-else:", "- res = mm // g", "- print...
false
0.045157
0.069922
0.645824
[ "s940963101", "s264241383" ]
u496280557
p03423
python
s482545267
s557621615
28
23
9,088
9,148
Accepted
Accepted
17.86
N = int(eval(input())) # 生徒数N人を入力 group_N = (N // 3) # Nを3で割り、余りは切り捨て print(group_N)
N = int(eval(input())) print((N // 3))
3
2
81
34
N = int(eval(input())) # 生徒数N人を入力 group_N = N // 3 # Nを3で割り、余りは切り捨て print(group_N)
N = int(eval(input())) print((N // 3))
false
33.333333
[ "-N = int(eval(input())) # 生徒数N人を入力", "-group_N = N // 3 # Nを3で割り、余りは切り捨て", "-print(group_N)", "+N = int(eval(input()))", "+print((N // 3))" ]
false
0.11638
0.041654
2.793937
[ "s482545267", "s557621615" ]
u344065503
p02813
python
s187926773
s432012911
216
73
44,996
72,916
Accepted
Accepted
66.2
import itertools N=int(eval(input())) P,Q=[tuple(map(int,input().split())) for i in range(2)] dictionary=sorted(itertools.permutations(P,N)) print((abs(dictionary.index(P)-dictionary.index(Q))))
import itertools n=int(eval(input())) p=tuple(map(int,input().split())) q=tuple(map(int,input().split())) count=0 a=0 b=0 for i in itertools.permutations(list(range(1,n+1))): count+=1 if i == p: a=count if i==q: b=count print((abs((count-a)-(count-b))))
5
18
190
275
import itertools N = int(eval(input())) P, Q = [tuple(map(int, input().split())) for i in range(2)] dictionary = sorted(itertools.permutations(P, N)) print((abs(dictionary.index(P) - dictionary.index(Q))))
import itertools n = int(eval(input())) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) count = 0 a = 0 b = 0 for i in itertools.permutations(list(range(1, n + 1))): count += 1 if i == p: a = count if i == q: b = count print((abs((count - a) - (count - b))))
false
72.222222
[ "-N = int(eval(input()))", "-P, Q = [tuple(map(int, input().split())) for i in range(2)]", "-dictionary = sorted(itertools.permutations(P, N))", "-print((abs(dictionary.index(P) - dictionary.index(Q))))", "+n = int(eval(input()))", "+p = tuple(map(int, input().split()))", "+q = tuple(map(int, input().sp...
false
0.03888
0.057912
0.671357
[ "s187926773", "s432012911" ]
u075012704
p03475
python
s797047691
s568586257
114
104
3,188
3,064
Accepted
Accepted
8.77
N = int(eval(input())) CSF = [list(map(int, input().split())) for i in range(N-1)] # 鉄道種類ループ for i in range(N): T = 0 # 鉄道乗り継ぎループ for j in range(i, N-1): if T < CSF[j][1]: T = CSF[j][1] else: if T % CSF[j][2] != 0: T += (CSF[j][2] - T % CS...
N = int(eval(input())) C, S, F = [], [], [] for i in range(N-1): ci, si, fi = list(map(int, input().split())) C.append(ci) S.append(si) F.append(fi) for i in range(N): T = 0 for j in range(i, N-1): if S[j] > T: T = S[j] if T % F[j] != 0: T...
16
20
363
363
N = int(eval(input())) CSF = [list(map(int, input().split())) for i in range(N - 1)] # 鉄道種類ループ for i in range(N): T = 0 # 鉄道乗り継ぎループ for j in range(i, N - 1): if T < CSF[j][1]: T = CSF[j][1] else: if T % CSF[j][2] != 0: T += CSF[j][2] - T % CSF[j][2] ...
N = int(eval(input())) C, S, F = [], [], [] for i in range(N - 1): ci, si, fi = list(map(int, input().split())) C.append(ci) S.append(si) F.append(fi) for i in range(N): T = 0 for j in range(i, N - 1): if S[j] > T: T = S[j] if T % F[j] != 0: T += F[j] - T ...
false
20
[ "-CSF = [list(map(int, input().split())) for i in range(N - 1)]", "-# 鉄道種類ループ", "+C, S, F = [], [], []", "+for i in range(N - 1):", "+ ci, si, fi = list(map(int, input().split()))", "+ C.append(ci)", "+ S.append(si)", "+ F.append(fi)", "- # 鉄道乗り継ぎループ", "- if T < CSF[j][1]:", ...
false
0.044751
0.045581
0.981792
[ "s797047691", "s568586257" ]
u110278902
p00423
python
s447263953
s225506879
70
60
6,256
6,340
Accepted
Accepted
14.29
import sys def solve(): while(1): n = int(input()) if n == 0: break score_a, score_b = 0, 0 while(n > 0): a, b = list(map(int, input().split())) if a > b: score_a += a + b elif b > a: score_b += a + b else: score_a += a sco...
def solve(): while(1): n = int(input()) if n == 0: break score_a, score_b = 0, 0 while(n > 0): a, b = list(map(int, input().split())) if a > b: score_a += a + b elif b > a: score_b += a + b else: score_a += a score_b += b ...
22
21
414
402
import sys def solve(): while 1: n = int(input()) if n == 0: break score_a, score_b = 0, 0 while n > 0: a, b = list(map(int, input().split())) if a > b: score_a += a + b elif b > a: score_b += a + b ...
def solve(): while 1: n = int(input()) if n == 0: break score_a, score_b = 0, 0 while n > 0: a, b = list(map(int, input().split())) if a > b: score_a += a + b elif b > a: score_b += a + b else...
false
4.545455
[ "-import sys", "-", "-" ]
false
0.043606
0.102946
0.423584
[ "s447263953", "s225506879" ]
u028973125
p02844
python
s047434891
s125743591
1,378
371
44,320
41,180
Accepted
Accepted
73.08
from pprint import pprint import sys n = int(sys.stdin.readline().strip()) s = sys.stdin.readline().strip() count = 0 for i in range(1000): pin = str(i).zfill(3) start = 0 flags = [False] * 3 for i, pin_i in enumerate(pin): flag = False for j, s_j in enumerate(s): ...
import sys N = int(sys.stdin.readline()) S = sys.stdin.readline() ans = 0 for i in range(1000): password = str(i).zfill(3) p_i = 0 s_i = 0 while s_i < len(S) and p_i < 3: # print(p_i, s_i) if S[s_i] == password[p_i]: p_i += 1 s_i += 1 if p_i == 3:...
26
18
604
350
from pprint import pprint import sys n = int(sys.stdin.readline().strip()) s = sys.stdin.readline().strip() count = 0 for i in range(1000): pin = str(i).zfill(3) start = 0 flags = [False] * 3 for i, pin_i in enumerate(pin): flag = False for j, s_j in enumerate(s): if j < sta...
import sys N = int(sys.stdin.readline()) S = sys.stdin.readline() ans = 0 for i in range(1000): password = str(i).zfill(3) p_i = 0 s_i = 0 while s_i < len(S) and p_i < 3: # print(p_i, s_i) if S[s_i] == password[p_i]: p_i += 1 s_i += 1 if p_i == 3: ans += ...
false
30.769231
[ "-from pprint import pprint", "-n = int(sys.stdin.readline().strip())", "-s = sys.stdin.readline().strip()", "-count = 0", "+N = int(sys.stdin.readline())", "+S = sys.stdin.readline()", "+ans = 0", "- pin = str(i).zfill(3)", "- start = 0", "- flags = [False] * 3", "- for i, pin_i in ...
false
0.052969
0.104175
0.508462
[ "s047434891", "s125743591" ]
u281303342
p03372
python
s468825555
s307751661
691
500
26,172
26,188
Accepted
Accepted
27.64
N,C = list(map(int,input().split())) XV = [tuple(map(int,input().split())) for _ in range(N)] # 順方向,逆方向の累積和 VF,VB = [0]*(N+1),[0]*(N+1) for i in range(N): VF[i+1] += VF[i]+XV[i][1] for i in range(N): VB[N-i-1] += VB[N-i]+XV[N-1-i][1] # 移動距離を減算 for i in range(N): VF[i+1] -= XV[i][0] for i in r...
# Python3 (3.4.3) import sys input = sys.stdin.readline # ------------------------------------------------------------- # function # ------------------------------------------------------------- # ------------------------------------------------------------- # main # --------------------------------------...
36
47
793
1,140
N, C = list(map(int, input().split())) XV = [tuple(map(int, input().split())) for _ in range(N)] # 順方向,逆方向の累積和 VF, VB = [0] * (N + 1), [0] * (N + 1) for i in range(N): VF[i + 1] += VF[i] + XV[i][1] for i in range(N): VB[N - i - 1] += VB[N - i] + XV[N - 1 - i][1] # 移動距離を減算 for i in range(N): VF[i + 1] -= XV[...
# Python3 (3.4.3) import sys input = sys.stdin.readline # ------------------------------------------------------------- # function # ------------------------------------------------------------- # ------------------------------------------------------------- # main # ---------------------------------------------------...
false
23.404255
[ "+# Python3 (3.4.3)", "+import sys", "+", "+input = sys.stdin.readline", "+# function", "+# main" ]
false
0.035044
0.08421
0.416149
[ "s468825555", "s307751661" ]
u057964173
p02959
python
s531028081
s047369842
155
143
18,476
18,476
Accepted
Accepted
7.74
import sys def input(): return sys.stdin.readline().strip() def resolve(): n=int(eval(input())) la=list(map(int,input().split())) lb=list(map(int,input().split())) cnt=0 for i in range(n): if la[i]>=lb[i]: cnt+=lb[i] la[i]-=lb[i] else: ...
import sys def input(): return sys.stdin.readline().strip() def resolve(): n=int(eval(input())) la=list(map(int,input().split())) lb=list(map(int,input().split())) cnt=0 for i in range(n): x=min(la[i],lb[i]) cnt+=x lb[i]-=x la[i]-=x y=min(lb[i],l...
19
18
457
385
import sys def input(): return sys.stdin.readline().strip() def resolve(): n = int(eval(input())) la = list(map(int, input().split())) lb = list(map(int, input().split())) cnt = 0 for i in range(n): if la[i] >= lb[i]: cnt += lb[i] la[i] -= lb[i] else: ...
import sys def input(): return sys.stdin.readline().strip() def resolve(): n = int(eval(input())) la = list(map(int, input().split())) lb = list(map(int, input().split())) cnt = 0 for i in range(n): x = min(la[i], lb[i]) cnt += x lb[i] -= x la[i] -= x ...
false
5.263158
[ "- if la[i] >= lb[i]:", "- cnt += lb[i]", "- la[i] -= lb[i]", "- else:", "- cnt += la[i]", "- lb[i] -= la[i]", "- cnt += min(lb[i], la[i + 1])", "- la[i + 1] -= min(lb[i], la[i + 1])", "+ x = min(la[i], lb[i])", ...
false
0.036593
0.038279
0.955967
[ "s531028081", "s047369842" ]
u876438858
p02548
python
s361998482
s190777899
1,819
660
128,296
122,232
Accepted
Accepted
63.72
#!/usr/bin/env python3 import sys import numpy as np import numba input = sys.stdin.readline def I(): return int(eval(input())) # @njit((i8[:],), cache=True) @numba.jit def main(n): table = np.zeros(n, np.int64) for i in range(1, n): table[::i] += 1 ans = 0 for n ...
#!/usr/bin/env python3 import sys import numpy as np import numba from numba import njit, b1, i4, i8, f8 input = sys.stdin.readline def I(): return int(eval(input())) @njit((i8,), cache=True) def main(n): table = np.zeros(n, np.int64) for i in range(1, n): table[::i] += 1 ...
31
31
441
464
#!/usr/bin/env python3 import sys import numpy as np import numba input = sys.stdin.readline def I(): return int(eval(input())) # @njit((i8[:],), cache=True) @numba.jit def main(n): table = np.zeros(n, np.int64) for i in range(1, n): table[::i] += 1 ans = 0 for n in table[1:]: q...
#!/usr/bin/env python3 import sys import numpy as np import numba from numba import njit, b1, i4, i8, f8 input = sys.stdin.readline def I(): return int(eval(input())) @njit((i8,), cache=True) def main(n): table = np.zeros(n, np.int64) for i in range(1, n): table[::i] += 1 ans = 0 for n ...
false
0
[ "+from numba import njit, b1, i4, i8, f8", "-# @njit((i8[:],), cache=True)", "-@numba.jit", "+@njit((i8,), cache=True)" ]
false
0.289126
0.24016
1.20389
[ "s361998482", "s190777899" ]
u790710233
p03006
python
s237395642
s126269792
665
23
3,188
3,828
Accepted
Accepted
96.54
n = int(eval(input())) xy = [list(map(int, input().split())) for _ in range(n)] xy.sort() vectors = set() for i in range(n-1): for j in range(i+1, n): xi, yi = xy[i] xj, yj = xy[j] if xj-xi == 0 and yj-yi == 0: continue unit_vector = (xj-xi, yj-yi) vect...
import itertools from collections import defaultdict n = int(eval(input())) xy = [list(map(int, input().split())) for _ in range(n)] dd = defaultdict(int) for xy1, xy2 in itertools.combinations(xy, 2): x1, y1 = xy1 x2, y2 = xy2 unit_vect = (x1-x2, y1-y2) dd[unit_vect] += 1 unit_vect = (x2-...
23
18
603
424
n = int(eval(input())) xy = [list(map(int, input().split())) for _ in range(n)] xy.sort() vectors = set() for i in range(n - 1): for j in range(i + 1, n): xi, yi = xy[i] xj, yj = xy[j] if xj - xi == 0 and yj - yi == 0: continue unit_vector = (xj - xi, yj - yi) vec...
import itertools from collections import defaultdict n = int(eval(input())) xy = [list(map(int, input().split())) for _ in range(n)] dd = defaultdict(int) for xy1, xy2 in itertools.combinations(xy, 2): x1, y1 = xy1 x2, y2 = xy2 unit_vect = (x1 - x2, y1 - y2) dd[unit_vect] += 1 unit_vect = (x2 - x1,...
false
21.73913
[ "+import itertools", "+from collections import defaultdict", "+", "-xy.sort()", "-vectors = set()", "-for i in range(n - 1):", "- for j in range(i + 1, n):", "- xi, yi = xy[i]", "- xj, yj = xy[j]", "- if xj - xi == 0 and yj - yi == 0:", "- continue", "- ...
false
0.045246
0.034281
1.319839
[ "s237395642", "s126269792" ]
u356232173
p03012
python
s973056172
s614946231
19
17
3,060
2,940
Accepted
Accepted
10.53
N=int(eval(input())) W=list(map(int,input().split(' '))) T=0 S1=0 S2=0 list=[] for j in range(N-1): for i in range(N): if i<=T : S1=S1+W[i] else : S2=S2+W[i] T+=1 list.append(abs(S1-S2)) S1=0 S2=0 print((min(list)))
N = int(eval(input())) W = list(map(int,input().split())) temp = 0 list=[] for i in range(N-1): list.append(abs(sum(W[:i+1]) - sum(W[i+1:]))) print((min(list)))
17
9
284
167
N = int(eval(input())) W = list(map(int, input().split(" "))) T = 0 S1 = 0 S2 = 0 list = [] for j in range(N - 1): for i in range(N): if i <= T: S1 = S1 + W[i] else: S2 = S2 + W[i] T += 1 list.append(abs(S1 - S2)) S1 = 0 S2 = 0 print((min(list)))
N = int(eval(input())) W = list(map(int, input().split())) temp = 0 list = [] for i in range(N - 1): list.append(abs(sum(W[: i + 1]) - sum(W[i + 1 :]))) print((min(list)))
false
47.058824
[ "-W = list(map(int, input().split(\" \")))", "-T = 0", "-S1 = 0", "-S2 = 0", "+W = list(map(int, input().split()))", "+temp = 0", "-for j in range(N - 1):", "- for i in range(N):", "- if i <= T:", "- S1 = S1 + W[i]", "- else:", "- S2 = S2 + W[i]", "- ...
false
0.03831
0.038943
0.983747
[ "s973056172", "s614946231" ]
u941407962
p02837
python
s688509174
s026822502
588
353
44,496
44,524
Accepted
Accepted
39.97
import sys input = sys.stdin.readline N, = list(map(int, input().split())) rs = [] for _ in range(N): A, = list(map(int, input().split())) ts, fs = set(), set() for _ in range(A): x, y = list(map(int, input().split())) if y: ts.add(x-1) else: fs.ad...
import sys input = sys.stdin.readline N, = list(map(int, input().split())) rs = [] for _ in range(N): A, = list(map(int, input().split())) ts, fs = set(), set() for _ in range(A): x, y = list(map(int, input().split())) if y: ts.add(x-1) else: fs.ad...
30
30
717
699
import sys input = sys.stdin.readline (N,) = list(map(int, input().split())) rs = [] for _ in range(N): (A,) = list(map(int, input().split())) ts, fs = set(), set() for _ in range(A): x, y = list(map(int, input().split())) if y: ts.add(x - 1) else: fs.add(x -...
import sys input = sys.stdin.readline (N,) = list(map(int, input().split())) rs = [] for _ in range(N): (A,) = list(map(int, input().split())) ts, fs = set(), set() for _ in range(A): x, y = list(map(int, input().split())) if y: ts.add(x - 1) else: fs.add(x -...
false
0
[ "- i = i + 2**N", "- bi = bin(i)[3:]", "+ c = 0", "- if int(bi[j]):", "+ if (i >> j) % 2:", "- if not int(bi[t]):", "+ if not (i >> t) % 2:", "- if int(bi[t]):", "+ if (i >> t) % 2:", "+ c += 1", "- ...
false
0.036462
0.036613
0.995869
[ "s688509174", "s026822502" ]
u667024514
p03494
python
s469142193
s694797116
22
19
3,188
3,060
Accepted
Accepted
13.64
n = int(eval(input())) lis = list(map(int,input().split())) ans = [] for i in range(n): count = 0 while 1: if lis[i] %2 == 0: lis[i] = lis[i]/2 count +=1 else: ans.append(count) break print((min(ans)))
n = int(eval(input())) m = list(map(int,input().split())) ans = [] cou = 0 for i in range(n): while m[i] % 2 == 0: m[i] = m[i] / 2 cou += 1 ans.append(cou) cou = 0 print((min(ans)))
13
12
241
199
n = int(eval(input())) lis = list(map(int, input().split())) ans = [] for i in range(n): count = 0 while 1: if lis[i] % 2 == 0: lis[i] = lis[i] / 2 count += 1 else: ans.append(count) break print((min(ans)))
n = int(eval(input())) m = list(map(int, input().split())) ans = [] cou = 0 for i in range(n): while m[i] % 2 == 0: m[i] = m[i] / 2 cou += 1 ans.append(cou) cou = 0 print((min(ans)))
false
7.692308
[ "-lis = list(map(int, input().split()))", "+m = list(map(int, input().split()))", "+cou = 0", "- count = 0", "- while 1:", "- if lis[i] % 2 == 0:", "- lis[i] = lis[i] / 2", "- count += 1", "- else:", "- ans.append(count)", "- break"...
false
0.059226
0.034116
1.736032
[ "s469142193", "s694797116" ]
u268793453
p03295
python
s638001266
s612967074
440
395
22,916
22,832
Accepted
Accepted
10.23
n, m = [int(i) for i in input().split()] A = [[int(i) for i in input().split()] for j in range(m)] A.sort(key=lambda a:a[1]) ans = 0 i = 0 while i < m: b = A[i][1] ans += 1 i += 1 while i < m: if A[i][0] >= b: break i += 1 print(ans)
n, m = [int(i) for i in input().split()] A = [[int(i) for i in input().split()] for j in range(m)] A.sort(key=lambda a:a[1]) ans = 0 last = 0 for a, b in A: if a >= last: ans += 1 last = b print(ans)
17
13
296
234
n, m = [int(i) for i in input().split()] A = [[int(i) for i in input().split()] for j in range(m)] A.sort(key=lambda a: a[1]) ans = 0 i = 0 while i < m: b = A[i][1] ans += 1 i += 1 while i < m: if A[i][0] >= b: break i += 1 print(ans)
n, m = [int(i) for i in input().split()] A = [[int(i) for i in input().split()] for j in range(m)] A.sort(key=lambda a: a[1]) ans = 0 last = 0 for a, b in A: if a >= last: ans += 1 last = b print(ans)
false
23.529412
[ "-i = 0", "-while i < m:", "- b = A[i][1]", "- ans += 1", "- i += 1", "- while i < m:", "- if A[i][0] >= b:", "- break", "- i += 1", "+last = 0", "+for a, b in A:", "+ if a >= last:", "+ ans += 1", "+ last = b" ]
false
0.048889
0.07458
0.655524
[ "s638001266", "s612967074" ]
u186838327
p03005
python
s116495108
s087590943
173
65
38,256
61,796
Accepted
Accepted
62.43
n, k = list(map(int, input().split())) if k == 1: print((0)) else: print((n-k))
n , k = list(map(int, input().split())) if k != 1: print((n-k)) else: print((0))
5
5
77
83
n, k = list(map(int, input().split())) if k == 1: print((0)) else: print((n - k))
n, k = list(map(int, input().split())) if k != 1: print((n - k)) else: print((0))
false
0
[ "-if k == 1:", "+if k != 1:", "+ print((n - k))", "+else:", "-else:", "- print((n - k))" ]
false
0.071173
0.047461
1.499611
[ "s116495108", "s087590943" ]