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
u340781749
p02913
python
s840856581
s141859384
122
85
3,904
3,904
Accepted
Accepted
30.33
def solve(n, s, d, MOD): ttt = [ord(c) - 97 for c in s] ttx = [] c = 1 for t in ttt[::-1]: ttx.append(t * c % MOD) c = c * d % MOD ttx.reverse() ttc = [0] for t in ttx: ttc.append((ttc[-1] + t) % MOD) l, r = 0, n while l < r: m = (l + ...
def solve(n, s, d, MOD): ttt = [ord(c) - 97 for c in s] ttx = [] c = 1 for t in ttt[::-1]: ttx.append(t * c % MOD) c = c * d % MOD ttx.reverse() ttc = [0] for t in ttx: ttc.append((ttc[-1] + t) % MOD) l, r = 0, n // 2 + 1 while l < r: ...
46
46
930
935
def solve(n, s, d, MOD): ttt = [ord(c) - 97 for c in s] ttx = [] c = 1 for t in ttt[::-1]: ttx.append(t * c % MOD) c = c * d % MOD ttx.reverse() ttc = [0] for t in ttx: ttc.append((ttc[-1] + t) % MOD) l, r = 0, n while l < r: m = (l + r + 1) // 2 ...
def solve(n, s, d, MOD): ttt = [ord(c) - 97 for c in s] ttx = [] c = 1 for t in ttt[::-1]: ttx.append(t * c % MOD) c = c * d % MOD ttx.reverse() ttc = [0] for t in ttx: ttc.append((ttc[-1] + t) % MOD) l, r = 0, n // 2 + 1 while l < r: m = (l + r + 1) /...
false
0
[ "- l, r = 0, n", "+ l, r = 0, n // 2 + 1", "-print((min(solve(n, s, d, MOD) for d in (26, 29, 31))))", "+print((min(solve(n, s, d, MOD) for d in (29, 31))))" ]
false
0.042787
0.043312
0.987867
[ "s840856581", "s141859384" ]
u569960318
p02386
python
s159754689
s228417404
170
150
7,948
7,796
Accepted
Accepted
11.76
class dice: def __init__(self,label): self.label = {i+1: l for i,l in enumerate(label)} def roll(self,op): l = self.label if op=='N': self.label = {1:l[2], 2:l[6], 3:l[3], 4:l[4], 5:l[1], 6:l[5]} elif op=='E': self.label = {1:l[4], 2:l[2], 3:l[1], 4:l[6], 5:l[5], 6:l[3]} ...
class dice: def __init__(self,label): self.top, self.front, self.right, self.left, self.rear, self.bottom \ = label def roll(self,op): if op=='N': self.top, self.front, self.bottom, self.rear = \ self.front, self.bottom, self.rear , self...
57
43
1,962
1,543
class dice: def __init__(self, label): self.label = {i + 1: l for i, l in enumerate(label)} def roll(self, op): l = self.label if op == "N": self.label = {1: l[2], 2: l[6], 3: l[3], 4: l[4], 5: l[1], 6: l[5]} elif op == "E": self.label = {1: l[4], 2: l[2]...
class dice: def __init__(self, label): self.top, self.front, self.right, self.left, self.rear, self.bottom = label def roll(self, op): if op == "N": self.top, self.front, self.bottom, self.rear = ( self.front, self.bottom, self.rear, ...
false
24.561404
[ "- self.label = {i + 1: l for i, l in enumerate(label)}", "+ self.top, self.front, self.right, self.left, self.rear, self.bottom = label", "- l = self.label", "- self.label = {1: l[2], 2: l[6], 3: l[3], 4: l[4], 5: l[1], 6: l[5]}", "+ self.top, self.front, self.bot...
false
0.06112
0.034173
1.78857
[ "s159754689", "s228417404" ]
u761989513
p02946
python
s297001941
s452185377
19
17
3,064
2,940
Accepted
Accepted
10.53
k, x = list(map(int, input().split())) ans = [] for i in range(max(x - k + 1, -1000000), min(x + k - 1, 1000000) + 1): ans.append(str(i)) print((" ".join(ans)))
k, x = list(map(int, input().split())) print((" ".join(map(str, list(range(x - k + 1, x + k))))))
5
2
160
84
k, x = list(map(int, input().split())) ans = [] for i in range(max(x - k + 1, -1000000), min(x + k - 1, 1000000) + 1): ans.append(str(i)) print((" ".join(ans)))
k, x = list(map(int, input().split())) print((" ".join(map(str, list(range(x - k + 1, x + k))))))
false
60
[ "-ans = []", "-for i in range(max(x - k + 1, -1000000), min(x + k - 1, 1000000) + 1):", "- ans.append(str(i))", "-print((\" \".join(ans)))", "+print((\" \".join(map(str, list(range(x - k + 1, x + k))))))" ]
false
0.047534
0.047392
1.003002
[ "s297001941", "s452185377" ]
u619458041
p03488
python
s113034629
s834976697
1,506
32
359,820
3,316
Accepted
Accepted
97.88
import sys def main(): input = sys.stdin.readline S = [str(c) for c in input().strip()] X, Y = list(map(int, input().split())) F = [] while len(S) > 0: f = 0 while len(S) > 0 and S[0] == 'F': f += 1 S.pop(0) F.append(f) if len(S) ...
import sys def main(): input = sys.stdin.readline S = [str(c) for c in input().strip()] X, Y = list(map(int, input().split())) move = [] S.append('E') while len(S) > 0: f = 0 while len(S) > 0 and S[0] == 'F': f += 1 S.pop(0) move.ap...
49
49
1,034
963
import sys def main(): input = sys.stdin.readline S = [str(c) for c in input().strip()] X, Y = list(map(int, input().split())) F = [] while len(S) > 0: f = 0 while len(S) > 0 and S[0] == "F": f += 1 S.pop(0) F.append(f) if len(S) > 0: ...
import sys def main(): input = sys.stdin.readline S = [str(c) for c in input().strip()] X, Y = list(map(int, input().split())) move = [] S.append("E") while len(S) > 0: f = 0 while len(S) > 0 and S[0] == "F": f += 1 S.pop(0) move.append(f) ...
false
0
[ "- F = []", "+ move = []", "+ S.append(\"E\")", "- F.append(f)", "- if len(S) > 0:", "- S.pop(0)", "- Fx = []", "- Fy = []", "- for i in range(1, len(F)):", "+ move.append(f)", "+ S.pop(0)", "+ X -= move[0]", "+ move_x = []", "...
false
0.087083
0.039338
2.213732
[ "s113034629", "s834976697" ]
u818349438
p03341
python
s973491997
s155634892
307
209
19,616
47,320
Accepted
Accepted
31.92
n = int(eval(input())) s = eval(input()) ecnt = [0]*n wcnt = [0]*n res = 0 for i in range(1,n): #ecnt if s[i-1] == 'E':res +=1 ecnt[i] = res res = 0 for i in range(n-2,-1,-1): if s[i+1] == 'W':res+=1 wcnt[i] = res ans = 0 for i in range(n): ans = max(ans,ecnt[i]+wcnt[i]) ans = n-...
n = int(eval(input())) s = eval(input()) ecnt = [0]*n wcnt = [0]*n for i in range(1,n): if s[i-1] == 'W': wcnt[i] = wcnt[i-1]+1 else: wcnt[i] = wcnt[i-1] for i in range(n-2,-1,-1): if s[i+1] == 'E': ecnt[i] = ecnt[i+1] +1 else: ecnt[i] = ecnt[i+1] ans = 10**...
18
21
325
401
n = int(eval(input())) s = eval(input()) ecnt = [0] * n wcnt = [0] * n res = 0 for i in range(1, n): # ecnt if s[i - 1] == "E": res += 1 ecnt[i] = res res = 0 for i in range(n - 2, -1, -1): if s[i + 1] == "W": res += 1 wcnt[i] = res ans = 0 for i in range(n): ans = max(ans, ecnt[...
n = int(eval(input())) s = eval(input()) ecnt = [0] * n wcnt = [0] * n for i in range(1, n): if s[i - 1] == "W": wcnt[i] = wcnt[i - 1] + 1 else: wcnt[i] = wcnt[i - 1] for i in range(n - 2, -1, -1): if s[i + 1] == "E": ecnt[i] = ecnt[i + 1] + 1 else: ecnt[i] = ecnt[i + 1] ...
false
14.285714
[ "-res = 0", "- # ecnt", "- if s[i - 1] == \"E\":", "- res += 1", "- ecnt[i] = res", "-res = 0", "+ if s[i - 1] == \"W\":", "+ wcnt[i] = wcnt[i - 1] + 1", "+ else:", "+ wcnt[i] = wcnt[i - 1]", "- if s[i + 1] == \"W\":", "- res += 1", "- wcnt[i]...
false
0.161423
0.036589
4.411755
[ "s973491997", "s155634892" ]
u546285759
p00015
python
s920277352
s370436029
30
20
7,712
5,596
Accepted
Accepted
33.33
N = int(eval(input())) for _ in range(N): f, s = [int(eval(input())) for _ in range(2)] print((f+s if len(str(f+s)) <= 80 else "overflow"))
N = int(eval(input())) for _ in range(N): a = int(eval(input())) b = int(eval(input())) c = a + b length = len(str(c)) print(([c, "overflow"][length > 80]))
4
8
136
165
N = int(eval(input())) for _ in range(N): f, s = [int(eval(input())) for _ in range(2)] print((f + s if len(str(f + s)) <= 80 else "overflow"))
N = int(eval(input())) for _ in range(N): a = int(eval(input())) b = int(eval(input())) c = a + b length = len(str(c)) print(([c, "overflow"][length > 80]))
false
50
[ "- f, s = [int(eval(input())) for _ in range(2)]", "- print((f + s if len(str(f + s)) <= 80 else \"overflow\"))", "+ a = int(eval(input()))", "+ b = int(eval(input()))", "+ c = a + b", "+ length = len(str(c))", "+ print(([c, \"overflow\"][length > 80]))" ]
false
0.047489
0.048969
0.969774
[ "s920277352", "s370436029" ]
u190405389
p03090
python
s408131673
s716429403
238
219
45,544
42,864
Accepted
Accepted
7.98
from math import factorial n=int(input()) print(factorial(n)//factorial(n-2)//2-n//2) m = (n//2)*2 for i in range(1,n+1): for j in range(i+1,n+1): if i+j != m+1: print(i,end=' ') print(j)
n = int(eval(input())) print((n*(n-1)//2-n//2)) m = n//2*2+1 for i in range(1,n): for j in range(i+1,n+1): if i+j!=m: print((i,j))
12
8
237
152
from math import factorial n = int(input()) print(factorial(n) // factorial(n - 2) // 2 - n // 2) m = (n // 2) * 2 for i in range(1, n + 1): for j in range(i + 1, n + 1): if i + j != m + 1: print(i, end=" ") print(j)
n = int(eval(input())) print((n * (n - 1) // 2 - n // 2)) m = n // 2 * 2 + 1 for i in range(1, n): for j in range(i + 1, n + 1): if i + j != m: print((i, j))
false
33.333333
[ "-from math import factorial", "-", "-n = int(input())", "-print(factorial(n) // factorial(n - 2) // 2 - n // 2)", "-m = (n // 2) * 2", "-for i in range(1, n + 1):", "+n = int(eval(input()))", "+print((n * (n - 1) // 2 - n // 2))", "+m = n // 2 * 2 + 1", "+for i in range(1, n):", "- if i ...
false
0.074771
0.035494
2.106599
[ "s408131673", "s716429403" ]
u945181840
p02727
python
s241030315
s213702007
290
246
22,720
23,328
Accepted
Accepted
15.17
import sys from heapq import heapify, heappushpop read = sys.stdin.read readline = sys.stdin.readline X, Y, A, B, C = list(map(int, readline().split())) p = list(map(int, readline().split())) q = list(map(int, readline().split())) r = [0] + list(map(int, readline().split())) p.sort() q.sort() r.sort() he...
import sys from heapq import heapify, heappushpop read = sys.stdin.read readline = sys.stdin.readline X, Y, A, B, C = list(map(int, readline().split())) p = list(map(int, readline().split())) q = list(map(int, readline().split())) r = [0] + list(map(int, readline().split())) p.sort() q.sort() r.sort() he...
24
29
580
651
import sys from heapq import heapify, heappushpop read = sys.stdin.read readline = sys.stdin.readline X, Y, A, B, C = list(map(int, readline().split())) p = list(map(int, readline().split())) q = list(map(int, readline().split())) r = [0] + list(map(int, readline().split())) p.sort() q.sort() r.sort() heap_p = p[-X:] ...
import sys from heapq import heapify, heappushpop read = sys.stdin.read readline = sys.stdin.readline X, Y, A, B, C = list(map(int, readline().split())) p = list(map(int, readline().split())) q = list(map(int, readline().split())) r = [0] + list(map(int, readline().split())) p.sort() q.sort() r.sort() heap_p = p[-X:] ...
false
17.241379
[ "+\"\"\"", "-print((sum(heap_p) + sum(heap_q)))", "+print(sum(heap_p) + sum(heap_q))", "+\"\"\"", "+a = heap_p + heap_q + r", "+a.sort()", "+print((sum(a[-(X + Y) :])))" ]
false
0.041479
0.032878
1.261599
[ "s241030315", "s213702007" ]
u844789719
p03062
python
s322198147
s162331053
106
72
14,412
14,252
Accepted
Accepted
32.08
N = int(eval(input())) A = sorted([int(_) for _ in input().split()]) ans = sum(A) for i in range(1, N // 2 + 1): a1 = ans - 2 * (A[2 * i - 2] + A[2 * i - 1]) if a1 < ans: break ans = a1 print(ans)
N = int(eval(input())) A = [int(_) for _ in input().split()] cnt = sum(a < 0 for a in A) sumabs = sum(abs(a) for a in A) if cnt % 2 == 0: print(sumabs) else: print((sumabs - 2 * min(abs(a) for a in A)))
9
8
219
210
N = int(eval(input())) A = sorted([int(_) for _ in input().split()]) ans = sum(A) for i in range(1, N // 2 + 1): a1 = ans - 2 * (A[2 * i - 2] + A[2 * i - 1]) if a1 < ans: break ans = a1 print(ans)
N = int(eval(input())) A = [int(_) for _ in input().split()] cnt = sum(a < 0 for a in A) sumabs = sum(abs(a) for a in A) if cnt % 2 == 0: print(sumabs) else: print((sumabs - 2 * min(abs(a) for a in A)))
false
11.111111
[ "-A = sorted([int(_) for _ in input().split()])", "-ans = sum(A)", "-for i in range(1, N // 2 + 1):", "- a1 = ans - 2 * (A[2 * i - 2] + A[2 * i - 1])", "- if a1 < ans:", "- break", "- ans = a1", "-print(ans)", "+A = [int(_) for _ in input().split()]", "+cnt = sum(a < 0 for a in A)"...
false
0.123183
0.04151
2.967564
[ "s322198147", "s162331053" ]
u905582793
p03087
python
s141989057
s733052094
1,015
391
5,724
6,032
Accepted
Accepted
61.48
import bisect n,q=list(map(int,input().split())) s=eval(input()) ac=[] for i in range(n-1): if s[i]=="A" and s[i+1]=="C": ac.append(i+1) for i in range(q): a,b=list(map(int,input().split())) print((bisect.bisect_right(ac,b-1)-bisect.bisect_left(ac,a)))
import sys import bisect input=sys.stdin.readline n,q=list(map(int,input().split())) s=eval(input()) ac=[] for i in range(n-1): if s[i]=="A" and s[i+1]=="C": ac.append(i+1) for i in range(q): a,b=list(map(int,input().split())) print((bisect.bisect_right(ac,b-1)-bisect.bisect_left(ac,a)))
10
12
251
289
import bisect n, q = list(map(int, input().split())) s = eval(input()) ac = [] for i in range(n - 1): if s[i] == "A" and s[i + 1] == "C": ac.append(i + 1) for i in range(q): a, b = list(map(int, input().split())) print((bisect.bisect_right(ac, b - 1) - bisect.bisect_left(ac, a)))
import sys import bisect input = sys.stdin.readline n, q = list(map(int, input().split())) s = eval(input()) ac = [] for i in range(n - 1): if s[i] == "A" and s[i + 1] == "C": ac.append(i + 1) for i in range(q): a, b = list(map(int, input().split())) print((bisect.bisect_right(ac, b - 1) - bisect.b...
false
16.666667
[ "+import sys", "+input = sys.stdin.readline" ]
false
0.042533
0.08298
0.512564
[ "s141989057", "s733052094" ]
u018679195
p03556
python
s869662346
s807038328
20
17
4,376
2,940
Accepted
Accepted
15
import math n=int(eval(input())) if n==0: print((0)) exit(0) l1=[i*i for i in range(int(math.sqrt(n))+1)] print((l1[-1]))
import math n = int(eval(input())) k = math.floor(math.sqrt(n)) print((k*k))
7
5
125
73
import math n = int(eval(input())) if n == 0: print((0)) exit(0) l1 = [i * i for i in range(int(math.sqrt(n)) + 1)] print((l1[-1]))
import math n = int(eval(input())) k = math.floor(math.sqrt(n)) print((k * k))
false
28.571429
[ "-if n == 0:", "- print((0))", "- exit(0)", "-l1 = [i * i for i in range(int(math.sqrt(n)) + 1)]", "-print((l1[-1]))", "+k = math.floor(math.sqrt(n))", "+print((k * k))" ]
false
0.048091
0.047356
1.015527
[ "s869662346", "s807038328" ]
u729133443
p02975
python
s943014063
s632625266
211
182
56,480
24,780
Accepted
Accepted
13.74
_,a=open(0);a,*b=list(map(int,a.split())) for b in b:a^=b print(('YNeos'[a>0::2]))
from numpy import*;_,a=open(0);print(('YNeos'[bitwise_xor.reduce(int32(a.split()))>0::2]))
3
1
76
88
_, a = open(0) a, *b = list(map(int, a.split())) for b in b: a ^= b print(("YNeos"[a > 0 :: 2]))
from numpy import * _, a = open(0) print(("YNeos"[bitwise_xor.reduce(int32(a.split())) > 0 :: 2]))
false
66.666667
[ "+from numpy import *", "+", "-a, *b = list(map(int, a.split()))", "-for b in b:", "- a ^= b", "-print((\"YNeos\"[a > 0 :: 2]))", "+print((\"YNeos\"[bitwise_xor.reduce(int32(a.split())) > 0 :: 2]))" ]
false
0.104854
0.253822
0.413099
[ "s943014063", "s632625266" ]
u811841526
p02383
python
s094732074
s493975164
30
20
7,776
5,572
Accepted
Accepted
33.33
class Dice(object): def __init__(self, top, south, east, west, north, bottom): self.top = top self.south = south self.east = east self.west = west self.north = north self.bottom = bottom def get_top(self): return self.top def rotate(self,...
class Dice: def __init__(self, top, front, right, left, back, bottom): self.top = top self.front = front self.right = right self.left = left self.back = back self.bottom = bottom def print_top(self): print((self.top)) def roll(self, direc...
42
43
1,429
1,219
class Dice(object): def __init__(self, top, south, east, west, north, bottom): self.top = top self.south = south self.east = east self.west = west self.north = north self.bottom = bottom def get_top(self): return self.top def rotate(self, directions)...
class Dice: def __init__(self, top, front, right, left, back, bottom): self.top = top self.front = front self.right = right self.left = left self.back = back self.bottom = bottom def print_top(self): print((self.top)) def roll(self, direction): ...
false
2.325581
[ "-class Dice(object):", "- def __init__(self, top, south, east, west, north, bottom):", "+class Dice:", "+ def __init__(self, top, front, right, left, back, bottom):", "- self.south = south", "- self.east = east", "- self.west = west", "- self.north = north", "+ ...
false
0.04936
0.066087
0.746894
[ "s094732074", "s493975164" ]
u077291787
p02558
python
s648185666
s031702009
329
281
146,396
144,896
Accepted
Accepted
14.59
from typing import Set class UnionFind: """Union Find (Disjoint Set): O(α(N)) References: https://github.com/atcoder/ac-library/blob/master/atcoder/dsu.hpp https://tumoiyorozu.github.io/single-file-ac-library/document_en/dsu.html """ __slots__ = ["_data_size", "_roots"] ...
class UnionFind: __slots__ = ["_data_size", "_roots"] def __init__(self, N): self._data_size = N self._roots = [-1] * N def find(self, x): while self._roots[x] >= 0: x = self._roots[x] return x def unite(self, x, y): x = self.find(x) ...
66
40
2,078
953
from typing import Set class UnionFind: """Union Find (Disjoint Set): O(α(N)) References: https://github.com/atcoder/ac-library/blob/master/atcoder/dsu.hpp https://tumoiyorozu.github.io/single-file-ac-library/document_en/dsu.html """ __slots__ = ["_data_size", "_roots"] def __ini...
class UnionFind: __slots__ = ["_data_size", "_roots"] def __init__(self, N): self._data_size = N self._roots = [-1] * N def find(self, x): while self._roots[x] >= 0: x = self._roots[x] return x def unite(self, x, y): x = self.find(x) y = sel...
false
39.393939
[ "-from typing import Set", "-", "-", "- \"\"\"Union Find (Disjoint Set): O(α(N))", "- References:", "- https://github.com/atcoder/ac-library/blob/master/atcoder/dsu.hpp", "- https://tumoiyorozu.github.io/single-file-ac-library/document_en/dsu.html", "- \"\"\"", "-", "- de...
false
0.046334
0.03875
1.195732
[ "s648185666", "s031702009" ]
u846877959
p03416
python
s214181296
s706122104
79
60
2,940
3,060
Accepted
Accepted
24.05
a, b = list(map(int, input().split())) count = 0 for i in range(a, b + 1): listed_i = list(str(i)) if listed_i[0] == listed_i[4] and listed_i[1] == listed_i[3]: count += 1 print(count)
a, b = list(map(int, input().split())) count = 0 for i in range(a, b + 1): s = i // 10000 t = (i % 10000) // 1000 u = (i % 100) // 10 v = i % 10 if s == v and t == u: count += 1 print(count)
9
11
205
225
a, b = list(map(int, input().split())) count = 0 for i in range(a, b + 1): listed_i = list(str(i)) if listed_i[0] == listed_i[4] and listed_i[1] == listed_i[3]: count += 1 print(count)
a, b = list(map(int, input().split())) count = 0 for i in range(a, b + 1): s = i // 10000 t = (i % 10000) // 1000 u = (i % 100) // 10 v = i % 10 if s == v and t == u: count += 1 print(count)
false
18.181818
[ "- listed_i = list(str(i))", "- if listed_i[0] == listed_i[4] and listed_i[1] == listed_i[3]:", "+ s = i // 10000", "+ t = (i % 10000) // 1000", "+ u = (i % 100) // 10", "+ v = i % 10", "+ if s == v and t == u:" ]
false
0.065936
0.057906
1.138686
[ "s214181296", "s706122104" ]
u537962130
p02819
python
s104395903
s363957498
180
63
38,840
63,248
Accepted
Accepted
65
def genP(): yield 2 yield 3 c=6 while 1: yield c-1 yield c+1 c+=6 def sosu(n): if n in [2,3,5]: return True l=int(n**0.5)+1 p=genP() for i in p: if i>l: return True break elif n%i==0: return False break def resolve(): x=int(eval(input())) while 1: if sosu...
def sosu(p): if p==2: return True l=int(p**0.5)+1 for i in range(2,l+1): if p%i==0: return False return True x=int(eval(input())) x+=1 if x!=2 and x%2==0 else 0 while sosu(x)==False: x+=2 print(x)
33
13
372
214
def genP(): yield 2 yield 3 c = 6 while 1: yield c - 1 yield c + 1 c += 6 def sosu(n): if n in [2, 3, 5]: return True l = int(n**0.5) + 1 p = genP() for i in p: if i > l: return True break elif n % i == 0: ...
def sosu(p): if p == 2: return True l = int(p**0.5) + 1 for i in range(2, l + 1): if p % i == 0: return False return True x = int(eval(input())) x += 1 if x != 2 and x % 2 == 0 else 0 while sosu(x) == False: x += 2 print(x)
false
60.606061
[ "-def genP():", "- yield 2", "- yield 3", "- c = 6", "- while 1:", "- yield c - 1", "- yield c + 1", "- c += 6", "+def sosu(p):", "+ if p == 2:", "+ return True", "+ l = int(p**0.5) + 1", "+ for i in range(2, l + 1):", "+ if p % i == ...
false
0.045509
0.036444
1.248725
[ "s104395903", "s363957498" ]
u188827677
p04012
python
s234667127
s163482995
34
29
9,348
9,396
Accepted
Accepted
14.71
from collections import Counter w = eval(input()) d = {} for i in w: if i not in d: d[i] = 1 else: d[i] += 1 print(("Yes" if all(i%2 == 0 for i in list(d.values())) else "No"))
from collections import Counter w = list(eval(input())) cnt = Counter(w) for i in list(cnt.values()): if i%2 == 1: print("No") exit() print("Yes")
8
9
174
153
from collections import Counter w = eval(input()) d = {} for i in w: if i not in d: d[i] = 1 else: d[i] += 1 print(("Yes" if all(i % 2 == 0 for i in list(d.values())) else "No"))
from collections import Counter w = list(eval(input())) cnt = Counter(w) for i in list(cnt.values()): if i % 2 == 1: print("No") exit() print("Yes")
false
11.111111
[ "-w = eval(input())", "-d = {}", "-for i in w:", "- if i not in d:", "- d[i] = 1", "- else:", "- d[i] += 1", "-print((\"Yes\" if all(i % 2 == 0 for i in list(d.values())) else \"No\"))", "+w = list(eval(input()))", "+cnt = Counter(w)", "+for i in list(cnt.values()):", "+ ...
false
0.042476
0.046534
0.912793
[ "s234667127", "s163482995" ]
u716530146
p03437
python
s605416967
s471419781
166
31
38,256
3,572
Accepted
Accepted
81.33
x,y = list(map(int,input().split())) if x % y == 0: print((-1)) else: print((x*(y+1)))
#!/usr/bin/env python3 import sys, math, itertools, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') inf = float('inf') ;mod = 10**9+7 mans = inf ;ans = 0 ;count = 0 ;pro = 1 x,y = list(map(int,input().split())) if x%y == 0:print((-1)) else: print(x)
6
9
94
291
x, y = list(map(int, input().split())) if x % y == 0: print((-1)) else: print((x * (y + 1)))
#!/usr/bin/env python3 import sys, math, itertools, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8") inf = float("inf") mod = 10**9 + 7 mans = inf ans = 0 count = 0 pro = 1 x, y = list(map(int, input().split())) if x % y == 0: print((-1)) else: print(x)
false
33.333333
[ "+#!/usr/bin/env python3", "+import sys, math, itertools, collections, bisect", "+", "+input = lambda: sys.stdin.buffer.readline().rstrip().decode(\"utf-8\")", "+inf = float(\"inf\")", "+mod = 10**9 + 7", "+mans = inf", "+ans = 0", "+count = 0", "+pro = 1", "- print((x * (y + 1)))", "+ p...
false
0.063323
0.061825
1.024231
[ "s605416967", "s471419781" ]
u740267532
p02657
python
s196720567
s129221263
24
21
9,096
9,024
Accepted
Accepted
12.5
def mul1(): m,n = list(map(int,input().split())) return m*n if __name__ == "__main__": print((mul1()))
def mul3(): m,n = list(map(float,input().split())) return int(m*n) if __name__ == "__main__": print((mul3()))
6
6
112
119
def mul1(): m, n = list(map(int, input().split())) return m * n if __name__ == "__main__": print((mul1()))
def mul3(): m, n = list(map(float, input().split())) return int(m * n) if __name__ == "__main__": print((mul3()))
false
0
[ "-def mul1():", "- m, n = list(map(int, input().split()))", "- return m * n", "+def mul3():", "+ m, n = list(map(float, input().split()))", "+ return int(m * n)", "- print((mul1()))", "+ print((mul3()))" ]
false
0.048909
0.0473
1.034021
[ "s196720567", "s129221263" ]
u367130284
p03311
python
s973792622
s334332735
367
216
34,172
25,200
Accepted
Accepted
41.14
from numpy import*;n,*a=list(map(int,open(0).read().split()));x=sorted(array(a)-arange(1,n+1));print((sum(abs(x-x[n//2]))))
eval(input());a=sorted(int(x)-i for i,x in enumerate(input().split()));print((sum(abs(i-a[len(a)//2])for i in a)))
1
1
115
106
from numpy import * n, *a = list(map(int, open(0).read().split())) x = sorted(array(a) - arange(1, n + 1)) print((sum(abs(x - x[n // 2]))))
eval(input()) a = sorted(int(x) - i for i, x in enumerate(input().split())) print((sum(abs(i - a[len(a) // 2]) for i in a)))
false
0
[ "-from numpy import *", "-", "-n, *a = list(map(int, open(0).read().split()))", "-x = sorted(array(a) - arange(1, n + 1))", "-print((sum(abs(x - x[n // 2]))))", "+eval(input())", "+a = sorted(int(x) - i for i, x in enumerate(input().split()))", "+print((sum(abs(i - a[len(a) // 2]) for i in a)))" ]
false
0.187852
0.038292
4.905843
[ "s973792622", "s334332735" ]
u186838327
p03319
python
s864827762
s114581917
207
42
52,780
14,008
Accepted
Accepted
79.71
n, k = list(map(int, input().split())) A =list(map(int, input().split())) ans = 0 while n > 0: if ans == 0: n -= k else: n -= (k-1) ans += 1 print(ans)
n, k = list(map(int, input().split())) A =list(map(int, input().split())) import math ans = math.ceil((n-1)/(k-1)) print(ans)
11
6
185
125
n, k = list(map(int, input().split())) A = list(map(int, input().split())) ans = 0 while n > 0: if ans == 0: n -= k else: n -= k - 1 ans += 1 print(ans)
n, k = list(map(int, input().split())) A = list(map(int, input().split())) import math ans = math.ceil((n - 1) / (k - 1)) print(ans)
false
45.454545
[ "-ans = 0", "-while n > 0:", "- if ans == 0:", "- n -= k", "- else:", "- n -= k - 1", "- ans += 1", "+import math", "+", "+ans = math.ceil((n - 1) / (k - 1))" ]
false
0.159728
0.038961
4.099674
[ "s864827762", "s114581917" ]
u254871849
p02712
python
s455658217
s555511882
109
98
9,180
29,944
Accepted
Accepted
10.09
import sys n = int(sys.stdin.readline().rstrip()) def main(): ans = 0 for i in range(1, n + 1): if (i % 3 == 0) or (i % 5 == 0): continue ans += i print(ans) if __name__ == '__main__': main()
import sys n = int(sys.stdin.readline().rstrip()) def main(): ans = sum([x for x in range(1, n + 1) if x % 3 and x % 5]) print(ans) if __name__ == '__main__': main()
14
10
252
190
import sys n = int(sys.stdin.readline().rstrip()) def main(): ans = 0 for i in range(1, n + 1): if (i % 3 == 0) or (i % 5 == 0): continue ans += i print(ans) if __name__ == "__main__": main()
import sys n = int(sys.stdin.readline().rstrip()) def main(): ans = sum([x for x in range(1, n + 1) if x % 3 and x % 5]) print(ans) if __name__ == "__main__": main()
false
28.571429
[ "- ans = 0", "- for i in range(1, n + 1):", "- if (i % 3 == 0) or (i % 5 == 0):", "- continue", "- ans += i", "+ ans = sum([x for x in range(1, n + 1) if x % 3 and x % 5])" ]
false
0.455115
0.113824
3.99841
[ "s455658217", "s555511882" ]
u347640436
p02838
python
s407518846
s905510753
313
288
48,844
44,564
Accepted
Accepted
7.99
import numpy as np N = int(eval(input())) A = np.array(list(map(int, input().split()))) result = 0 for b in range(60): bs = int(((A >> b) & 1).sum()) result = (result + bs * (N - bs) * (1 << b)) % 1000000007 print(result)
import numpy as np N = int(eval(input())) A = np.fromiter(list(map(int, input().split())), np.int64) result = 0 for b in range(60): bs = int(((A >> b) & 1).sum()) result = (result + bs * (N - bs) * (1 << b)) % 1000000007 print(result)
10
10
231
238
import numpy as np N = int(eval(input())) A = np.array(list(map(int, input().split()))) result = 0 for b in range(60): bs = int(((A >> b) & 1).sum()) result = (result + bs * (N - bs) * (1 << b)) % 1000000007 print(result)
import numpy as np N = int(eval(input())) A = np.fromiter(list(map(int, input().split())), np.int64) result = 0 for b in range(60): bs = int(((A >> b) & 1).sum()) result = (result + bs * (N - bs) * (1 << b)) % 1000000007 print(result)
false
0
[ "-A = np.array(list(map(int, input().split())))", "+A = np.fromiter(list(map(int, input().split())), np.int64)" ]
false
0.283212
0.238627
1.186844
[ "s407518846", "s905510753" ]
u556589653
p02578
python
s650603069
s295860888
165
143
32,188
32,188
Accepted
Accepted
13.33
N = int(eval(input())) A = list(map(int,input().split())) ans = 0 for i in range(1,N): if A[i-1] > A[i]: ans += abs(A[i-1]-A[i]) A[i] = A[i-1] else: continue print(ans)
N = int(eval(input())) A = list(map(int,input().split())) ans = 0 for i in range(1,N): if A[i-1] > A[i]: ans += A[i-1]-A[i] A[i] = A[i-1] print(ans)
10
8
203
160
N = int(eval(input())) A = list(map(int, input().split())) ans = 0 for i in range(1, N): if A[i - 1] > A[i]: ans += abs(A[i - 1] - A[i]) A[i] = A[i - 1] else: continue print(ans)
N = int(eval(input())) A = list(map(int, input().split())) ans = 0 for i in range(1, N): if A[i - 1] > A[i]: ans += A[i - 1] - A[i] A[i] = A[i - 1] print(ans)
false
20
[ "- ans += abs(A[i - 1] - A[i])", "+ ans += A[i - 1] - A[i]", "- else:", "- continue" ]
false
0.118695
0.047733
2.486661
[ "s650603069", "s295860888" ]
u869790980
p03612
python
s147287929
s837528071
308
74
88,148
88,068
Accepted
Accepted
75.97
n = int(input()) count = 0 res = 0 ais = list(map(int , input().split())) for i in range(n + 1): if (ais[i] if i < n else -1) != i + 1: #flush the count res += (count + 1)/2# + 1 count = 0 else: count +=1 print(res)
n = int(input()) count,res,ais,i = 0,0, list(map(int , input().split())),0 while(i < n+1): if (ais[i] if i < n else -1) != i + 1: res += (count + 1)/2# + 1 count = 0 else: count +=1 i+=1 print(res)
13
9
239
213
n = int(input()) count = 0 res = 0 ais = list(map(int, input().split())) for i in range(n + 1): if (ais[i] if i < n else -1) != i + 1: # flush the count res += (count + 1) / 2 # + 1 count = 0 else: count += 1 print(res)
n = int(input()) count, res, ais, i = 0, 0, list(map(int, input().split())), 0 while i < n + 1: if (ais[i] if i < n else -1) != i + 1: res += (count + 1) / 2 # + 1 count = 0 else: count += 1 i += 1 print(res)
false
30.769231
[ "-count = 0", "-res = 0", "-ais = list(map(int, input().split()))", "-for i in range(n + 1):", "+count, res, ais, i = 0, 0, list(map(int, input().split())), 0", "+while i < n + 1:", "- # flush the count", "+ i += 1" ]
false
0.086826
0.255001
0.340492
[ "s147287929", "s837528071" ]
u127499732
p02574
python
s460938174
s946790728
1,322
380
121,928
223,260
Accepted
Accepted
71.26
from functools import reduce def main(): from math import gcd from functools import reduce, lru_cache n, *a, = list(map(int, open(0).read().split())) m = max(a) d = [0] * (m + 1) d[1] = 1 for i in range(2, m + 1): for j in range(i, m + 1, i): if d[j] == 0: ...
def main(): from math import gcd n, *a = list(map(int, open(0).read().split())) m = max(a) c = [0] * (m + 1) g = a[0] for i in a: g = gcd(g, i) c[i] = 1 if g > 1: pre = "not" else: for i in range(2, 10 ** 6 + 1): if sum(c[i::i]...
43
26
886
497
from functools import reduce def main(): from math import gcd from functools import reduce, lru_cache ( n, *a, ) = list(map(int, open(0).read().split())) m = max(a) d = [0] * (m + 1) d[1] = 1 for i in range(2, m + 1): for j in range(i, m + 1, i): if...
def main(): from math import gcd n, *a = list(map(int, open(0).read().split())) m = max(a) c = [0] * (m + 1) g = a[0] for i in a: g = gcd(g, i) c[i] = 1 if g > 1: pre = "not" else: for i in range(2, 10**6 + 1): if sum(c[i::i]) > 1: ...
false
39.534884
[ "-from functools import reduce", "-", "-", "- from functools import reduce, lru_cache", "- (", "- n,", "- *a,", "- ) = list(map(int, open(0).read().split()))", "+ n, *a = list(map(int, open(0).read().split()))", "- d = [0] * (m + 1)", "- d[1] = 1", "- for i i...
false
0.043981
0.5591
0.078664
[ "s460938174", "s946790728" ]
u577139181
p02594
python
s017846784
s771787646
32
28
9,080
9,000
Accepted
Accepted
12.5
a = int(eval(input())) if a >= 30: print("Yes") else: print("No")
if int(eval(input())) >= 30: print("Yes") else: print("No")
5
4
66
58
a = int(eval(input())) if a >= 30: print("Yes") else: print("No")
if int(eval(input())) >= 30: print("Yes") else: print("No")
false
20
[ "-a = int(eval(input()))", "-if a >= 30:", "+if int(eval(input())) >= 30:" ]
false
0.101331
0.059812
1.694148
[ "s017846784", "s771787646" ]
u858748695
p02721
python
s769454086
s239280122
451
365
21,092
20,712
Accepted
Accepted
19.07
#!/usr/bin/env python3 n, k, c = list(map(int, input().split())) s = eval(input()) left = [0] * (n + 2) t = 0 while t < n: if s[t] == "o": left[t + 1] = 1 t += c t += 1 for i in range(n + 1): left[i + 1] += left[i] right = [0] * (n + 2) t = n - 1 while t >= 0: if s[t] ...
#!/usr/bin/env python3 def greedy_count(s): global n, c res = [0] * (n + 2) t = 0 while t < n: if s[t] == "o": res[t + 1] = 1 t += c t += 1 for i in range(n + 1): res[i + 1] += res[i] return res n, k, c = list(map(int, input()....
27
26
517
487
#!/usr/bin/env python3 n, k, c = list(map(int, input().split())) s = eval(input()) left = [0] * (n + 2) t = 0 while t < n: if s[t] == "o": left[t + 1] = 1 t += c t += 1 for i in range(n + 1): left[i + 1] += left[i] right = [0] * (n + 2) t = n - 1 while t >= 0: if s[t] == "o": rig...
#!/usr/bin/env python3 def greedy_count(s): global n, c res = [0] * (n + 2) t = 0 while t < n: if s[t] == "o": res[t + 1] = 1 t += c t += 1 for i in range(n + 1): res[i + 1] += res[i] return res n, k, c = list(map(int, input().split())) s = eval(...
false
3.703704
[ "+def greedy_count(s):", "+ global n, c", "+ res = [0] * (n + 2)", "+ t = 0", "+ while t < n:", "+ if s[t] == \"o\":", "+ res[t + 1] = 1", "+ t += c", "+ t += 1", "+ for i in range(n + 1):", "+ res[i + 1] += res[i]", "+ return res", ...
false
0.060301
0.036632
1.646119
[ "s769454086", "s239280122" ]
u347640436
p02725
python
s947822665
s483403062
151
133
25,840
26,420
Accepted
Accepted
11.92
K, N = list(map(int, input().split())) A = list(map(int, input().split())) result = A[0] - A[N - 1] + K for i in range(N - 1): result = max(result, A[i + 1] - A[i]) print((K - result))
K, N = list(map(int, input().split())) A = list(map(int, input().split())) A.append(A[0]+K) maxD = 0 for n in range(N): maxD = max(maxD, A[n+1] - A[n]) print((K-maxD))
7
7
188
167
K, N = list(map(int, input().split())) A = list(map(int, input().split())) result = A[0] - A[N - 1] + K for i in range(N - 1): result = max(result, A[i + 1] - A[i]) print((K - result))
K, N = list(map(int, input().split())) A = list(map(int, input().split())) A.append(A[0] + K) maxD = 0 for n in range(N): maxD = max(maxD, A[n + 1] - A[n]) print((K - maxD))
false
0
[ "-result = A[0] - A[N - 1] + K", "-for i in range(N - 1):", "- result = max(result, A[i + 1] - A[i])", "-print((K - result))", "+A.append(A[0] + K)", "+maxD = 0", "+for n in range(N):", "+ maxD = max(maxD, A[n + 1] - A[n])", "+print((K - maxD))" ]
false
0.035901
0.034721
1.033984
[ "s947822665", "s483403062" ]
u197300773
p03061
python
s868437037
s869327596
49
45
14,488
14,976
Accepted
Accepted
8.16
def gcd(a,b): if b>a: a,b=b,a while b: a,b=b, a%b return a def cul(n,x): l=len(x) b=[x[i] for i in range(l)] b.pop(n) tmp=b[0] for i in range(1,l-1): tmp=gcd(tmp,b[i]) return tmp import sys p=100 N=int(eval(input())) a=list(map(int,input()...
def gcd(a,b): if b>a: a,b=b,a while b: a,b=b, a%b return a def cul(n,x): l=len(x) b=[x[i] for i in range(l)] b.pop(n) tmp=b[0] for i in range(1,l-1): tmp=gcd(tmp,b[i]) return tmp import sys p=50 N=int(eval(input())) a=list(map(int,input()....
35
35
550
550
def gcd(a, b): if b > a: a, b = b, a while b: a, b = b, a % b return a def cul(n, x): l = len(x) b = [x[i] for i in range(l)] b.pop(n) tmp = b[0] for i in range(1, l - 1): tmp = gcd(tmp, b[i]) return tmp import sys p = 100 N = int(eval(input())) a = list(...
def gcd(a, b): if b > a: a, b = b, a while b: a, b = b, a % b return a def cul(n, x): l = len(x) b = [x[i] for i in range(l)] b.pop(n) tmp = b[0] for i in range(1, l - 1): tmp = gcd(tmp, b[i]) return tmp import sys p = 50 N = int(eval(input())) a = list(m...
false
0
[ "-p = 100", "+p = 50" ]
false
0.067603
0.048014
1.407983
[ "s868437037", "s869327596" ]
u179169725
p03095
python
s757586434
s716422240
32
25
3,444
3,444
Accepted
Accepted
21.88
from collections import defaultdict def readln(): return list(map(int, input().split())) N = readln()[0] S = eval(input()) mod = 10**9+7 dic = defaultdict(lambda: 0) for s in S: dic[s] += 1 ans = 1 for count in list(dic.values()): # print(count) ans *= (count + 1) ans %= mod ...
from collections import defaultdict, Counter def readln(): return list(map(int, input().split())) N = readln()[0] S = eval(input()) mod = 10**9+7 dic = Counter(S) ans = 1 for count in list(dic.values()): # print(count) ans *= (count + 1) ans %= mod # print(ans) print((ans-1))
22
21
337
306
from collections import defaultdict def readln(): return list(map(int, input().split())) N = readln()[0] S = eval(input()) mod = 10**9 + 7 dic = defaultdict(lambda: 0) for s in S: dic[s] += 1 ans = 1 for count in list(dic.values()): # print(count) ans *= count + 1 ans %= mod # print(ans) print((...
from collections import defaultdict, Counter def readln(): return list(map(int, input().split())) N = readln()[0] S = eval(input()) mod = 10**9 + 7 dic = Counter(S) ans = 1 for count in list(dic.values()): # print(count) ans *= count + 1 ans %= mod # print(ans) print((ans - 1))
false
4.545455
[ "-from collections import defaultdict", "+from collections import defaultdict, Counter", "-dic = defaultdict(lambda: 0)", "-for s in S:", "- dic[s] += 1", "+dic = Counter(S)" ]
false
0.041059
0.042141
0.974323
[ "s757586434", "s716422240" ]
u780475861
p02832
python
s896785656
s295772455
155
92
13,944
13,932
Accepted
Accepted
40.65
import sys readline = sys.stdin.buffer.readline n = int(readline()) c = 1 r = 0 p = 0 a = True for i, j in enumerate(readline().split()): if c != int(j): continue else: a = False c += 1 r += i - p p = i + 1 if a: print((-1)) else: print((r + n - p))
import sys readline = sys.stdin.buffer.readline n = int(readline()) num = 1 res = 0 for i in readline().split(): if num != int(i): res += 1 else: num += 1 if res == n: print((-1)) else: print(res)
20
15
293
226
import sys readline = sys.stdin.buffer.readline n = int(readline()) c = 1 r = 0 p = 0 a = True for i, j in enumerate(readline().split()): if c != int(j): continue else: a = False c += 1 r += i - p p = i + 1 if a: print((-1)) else: print((r + n - p))
import sys readline = sys.stdin.buffer.readline n = int(readline()) num = 1 res = 0 for i in readline().split(): if num != int(i): res += 1 else: num += 1 if res == n: print((-1)) else: print(res)
false
25
[ "-c = 1", "-r = 0", "-p = 0", "-a = True", "-for i, j in enumerate(readline().split()):", "- if c != int(j):", "- continue", "+num = 1", "+res = 0", "+for i in readline().split():", "+ if num != int(i):", "+ res += 1", "- a = False", "- c += 1", "- ...
false
0.042103
0.03668
1.147851
[ "s896785656", "s295772455" ]
u102461423
p03013
python
s121472431
s422409411
187
73
12,652
11,620
Accepted
Accepted
60.96
MOD = 10**9 + 7 N,M = list(map(int,input().split())) dp = [0]*(N+1) dp[0] = 1 A = set(int(eval(input())) for _ in range(M)) # 禁止地帯 for i in range(1,N+1): if i in A: continue x = dp[i-1] if i > 1: x += dp[i-2] dp[i] = x%MOD answer = dp[N] print(answer)
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N,M,*A = list(map(int,read().split())) MOD = 10**9 + 7 dp = [0] * (N+10) dp[0] = 1 is_broken = [False] * (N+1) for x in A: is_broken[x] = True for n in range(1,N+1): if is_br...
17
26
274
451
MOD = 10**9 + 7 N, M = list(map(int, input().split())) dp = [0] * (N + 1) dp[0] = 1 A = set(int(eval(input())) for _ in range(M)) # 禁止地帯 for i in range(1, N + 1): if i in A: continue x = dp[i - 1] if i > 1: x += dp[i - 2] dp[i] = x % MOD answer = dp[N] print(answer)
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, M, *A = list(map(int, read().split())) MOD = 10**9 + 7 dp = [0] * (N + 10) dp[0] = 1 is_broken = [False] * (N + 1) for x in A: is_broken[x] = True for n in range(1, N + 1): if is_broken[n]: ...
false
34.615385
[ "+import sys", "+", "+read = sys.stdin.buffer.read", "+readline = sys.stdin.buffer.readline", "+readlines = sys.stdin.buffer.readlines", "+N, M, *A = list(map(int, read().split()))", "-N, M = list(map(int, input().split()))", "-dp = [0] * (N + 1)", "+dp = [0] * (N + 10)", "-A = set(int(eval(input(...
false
0.036711
0.036156
1.015344
[ "s121472431", "s422409411" ]
u481550011
p02726
python
s550786117
s007497849
1,990
1,653
3,444
3,444
Accepted
Accepted
16.93
N,X,Y=list(map(int,input().split())) def shortest(x,y,a,b): ans=min(y-x,abs(y-b)+1+abs(a-x),abs(y-a)+1+abs(b-x)) return ans distance=[0]*N for x in range(1,N+1): for y in range(1,N+1): if y<=x: continue else: a=shortest(x,y,X,Y) distance[a-1]+=1...
N,X,Y=list(map(int,input().split())) def shortest(x,y,a,b): ans=min(y-x,abs(y-b)+1+abs(a-x)) return ans distance=[0]*(N-1) for x in range(1,N): for y in range(2,N+1): if y<=x: continue a=shortest(x,y,X,Y) distance[a-1]+=1 for i in distance: print(i)
14
13
360
307
N, X, Y = list(map(int, input().split())) def shortest(x, y, a, b): ans = min(y - x, abs(y - b) + 1 + abs(a - x), abs(y - a) + 1 + abs(b - x)) return ans distance = [0] * N for x in range(1, N + 1): for y in range(1, N + 1): if y <= x: continue else: a = shortest(...
N, X, Y = list(map(int, input().split())) def shortest(x, y, a, b): ans = min(y - x, abs(y - b) + 1 + abs(a - x)) return ans distance = [0] * (N - 1) for x in range(1, N): for y in range(2, N + 1): if y <= x: continue a = shortest(x, y, X, Y) distance[a - 1] += 1 for ...
false
7.142857
[ "- ans = min(y - x, abs(y - b) + 1 + abs(a - x), abs(y - a) + 1 + abs(b - x))", "+ ans = min(y - x, abs(y - b) + 1 + abs(a - x))", "-distance = [0] * N", "-for x in range(1, N + 1):", "- for y in range(1, N + 1):", "+distance = [0] * (N - 1)", "+for x in range(1, N):", "+ for y in range(2,...
false
0.033581
0.037477
0.896037
[ "s550786117", "s007497849" ]
u652057333
p02678
python
s038606789
s488877122
935
509
170,800
95,076
Accepted
Accepted
45.56
from heapq import heappush, heappop, heapify import sys input = lambda: sys.stdin.readline().rstrip() from collections import defaultdict n, m = list(map(int, input().split())) edges = defaultdict(lambda: defaultdict(lambda: float("inf"))) for _ in range(m): a, b = list(map(int, input().split())) edge...
from collections import deque N, M = list(map(int, input().split())) graph = [[] for i in range(N)] for i in range(M): a, b = list(map(int, input().split())) a, b = a-1, b-1 graph[a].append(b) graph[b].append(a) dist = [-1] * N dist[0] = 0 queue = deque([0]) while queue: ...
35
26
927
505
from heapq import heappush, heappop, heapify import sys input = lambda: sys.stdin.readline().rstrip() from collections import defaultdict n, m = list(map(int, input().split())) edges = defaultdict(lambda: defaultdict(lambda: float("inf"))) for _ in range(m): a, b = list(map(int, input().split())) edges[a - 1]...
from collections import deque N, M = list(map(int, input().split())) graph = [[] for i in range(N)] for i in range(M): a, b = list(map(int, input().split())) a, b = a - 1, b - 1 graph[a].append(b) graph[b].append(a) dist = [-1] * N dist[0] = 0 queue = deque([0]) while queue: v = queue.popleft() ...
false
25.714286
[ "-from heapq import heappush, heappop, heapify", "-import sys", "+from collections import deque", "-input = lambda: sys.stdin.readline().rstrip()", "-from collections import defaultdict", "-", "-n, m = list(map(int, input().split()))", "-edges = defaultdict(lambda: defaultdict(lambda: float(\"inf\")))...
false
0.052009
0.036385
1.42941
[ "s038606789", "s488877122" ]
u878654696
p02548
python
s027133623
s679609940
197
154
9,120
9,172
Accepted
Accepted
21.83
n = int(eval(input())) ans = 0 for i in range(1, n): ans += n//i if n%i != 0 else n//i-1 print(ans)
n = int(eval(input())) ans = 0 for i in range(1, n): ans += (n-1)//i print(ans)
7
7
106
85
n = int(eval(input())) ans = 0 for i in range(1, n): ans += n // i if n % i != 0 else n // i - 1 print(ans)
n = int(eval(input())) ans = 0 for i in range(1, n): ans += (n - 1) // i print(ans)
false
0
[ "- ans += n // i if n % i != 0 else n // i - 1", "+ ans += (n - 1) // i" ]
false
0.063567
0.081619
0.778823
[ "s027133623", "s679609940" ]
u699296734
p02897
python
s480181273
s810950685
31
26
9,148
9,096
Accepted
Accepted
16.13
n = int(eval(input())) if n % 2 == 0: print((n / 2 / n)) else: print(((n // 2 + 1) / n))
n = int(eval(input())) odd_counter = 0 for i in range(1, n + 1): if i % 2 == 1: odd_counter += 1 print((odd_counter / n))
5
7
91
132
n = int(eval(input())) if n % 2 == 0: print((n / 2 / n)) else: print(((n // 2 + 1) / n))
n = int(eval(input())) odd_counter = 0 for i in range(1, n + 1): if i % 2 == 1: odd_counter += 1 print((odd_counter / n))
false
28.571429
[ "-if n % 2 == 0:", "- print((n / 2 / n))", "-else:", "- print(((n // 2 + 1) / n))", "+odd_counter = 0", "+for i in range(1, n + 1):", "+ if i % 2 == 1:", "+ odd_counter += 1", "+print((odd_counter / n))" ]
false
0.041481
0.04169
0.995
[ "s480181273", "s810950685" ]
u078214750
p03086
python
s421446725
s647821607
36
30
9,824
8,992
Accepted
Accepted
16.67
import re S = eval(input()) print((len(max(re.findall('[ACTG]+', S), key=len, default=''))))
S = eval(input()) ans = 0 for i in range(len(S)): for j in range(i, len(S)): if all('ACTG'.count(c)==1 for c in S[i:j+1]): ans = max(ans, j+1-i) print(ans)
3
7
86
168
import re S = eval(input()) print((len(max(re.findall("[ACTG]+", S), key=len, default=""))))
S = eval(input()) ans = 0 for i in range(len(S)): for j in range(i, len(S)): if all("ACTG".count(c) == 1 for c in S[i : j + 1]): ans = max(ans, j + 1 - i) print(ans)
false
57.142857
[ "-import re", "-", "-print((len(max(re.findall(\"[ACTG]+\", S), key=len, default=\"\"))))", "+ans = 0", "+for i in range(len(S)):", "+ for j in range(i, len(S)):", "+ if all(\"ACTG\".count(c) == 1 for c in S[i : j + 1]):", "+ ans = max(ans, j + 1 - i)", "+print(ans)" ]
false
0.137973
0.049205
2.804042
[ "s421446725", "s647821607" ]
u997648604
p02580
python
s436196882
s075520585
997
878
192,204
136,988
Accepted
Accepted
11.94
import sys sys.setrecursionlimit(10**9) def mi(): return list(map(int,input().split())) def ii(): return int(eval(input())) def isp(): return input().split() def deb(text): print(("-------\n{}\n-------".format(text))) INF=10**20 def main(): H,W,M=mi() H_count = [0] * (H+1) W_count = [0] * (W...
#! /usr/bin/env python3 import sys sys.setrecursionlimit(10**9) def mi(): return list(map(int,input().split())) def ii(): return int(eval(input())) def isp(): return input().split() def deb(text): print(("-------\n{}\n-------".format(text))) INF=10**20 def solve(H: int, W: int, M: int, _h: "List[int]", ...
93
107
1,900
2,476
import sys sys.setrecursionlimit(10**9) def mi(): return list(map(int, input().split())) def ii(): return int(eval(input())) def isp(): return input().split() def deb(text): print(("-------\n{}\n-------".format(text))) INF = 10**20 def main(): H, W, M = mi() H_count = [0] * (H + 1) ...
#! /usr/bin/env python3 import sys sys.setrecursionlimit(10**9) def mi(): return list(map(int, input().split())) def ii(): return int(eval(input())) def isp(): return input().split() def deb(text): print(("-------\n{}\n-------".format(text))) INF = 10**20 def solve(H: int, W: int, M: int, _...
false
13.084112
[ "+#! /usr/bin/env python3", "-def main():", "- H, W, M = mi()", "+def solve(H: int, W: int, M: int, _h: \"List[int]\", _w: \"List[int]\"):", "- h, w = mi()", "+ h, w = _h[i], _w[i]", "+ return", "+", "+", "+def main():", "+ def iterate_tokens():", "+ for line in s...
false
0.046478
0.084869
0.547647
[ "s436196882", "s075520585" ]
u075012704
p03222
python
s743351773
s144615045
89
20
3,064
3,064
Accepted
Accepted
77.53
from itertools import product H, W, K = list(map(int, input().split())) MOD = 10 ** 9 + 7 dp = [[0] * W for i in range(H + 1)] dp[0][0] = 1 def calc(w): if w <= 0: return 1 ret = 0 for pattern in product([0, 1], repeat=w): pattern = ''.join(list(map(str, pattern))) i...
H, W, K = list(map(int, input().split())) MOD = 10 ** 9 + 7 dp = [[0] * W for i in range(H + 1)] dp[0][0] = 1 fib = [1, 2, 3, 5, 8, 13, 21, 34] def calc(w): if w < 0: return 1 return fib[w] for h in range(H): for w in range(W): dp[h + 1][w] = (dp[h + 1][w] + dp[h][w] * c...
28
23
787
626
from itertools import product H, W, K = list(map(int, input().split())) MOD = 10**9 + 7 dp = [[0] * W for i in range(H + 1)] dp[0][0] = 1 def calc(w): if w <= 0: return 1 ret = 0 for pattern in product([0, 1], repeat=w): pattern = "".join(list(map(str, pattern))) if "11" not in pa...
H, W, K = list(map(int, input().split())) MOD = 10**9 + 7 dp = [[0] * W for i in range(H + 1)] dp[0][0] = 1 fib = [1, 2, 3, 5, 8, 13, 21, 34] def calc(w): if w < 0: return 1 return fib[w] for h in range(H): for w in range(W): dp[h + 1][w] = (dp[h + 1][w] + dp[h][w] * calc(w - 1) * calc(W...
false
17.857143
[ "-from itertools import product", "-", "+fib = [1, 2, 3, 5, 8, 13, 21, 34]", "- if w <= 0:", "+ if w < 0:", "- ret = 0", "- for pattern in product([0, 1], repeat=w):", "- pattern = \"\".join(list(map(str, pattern)))", "- if \"11\" not in pattern:", "- ret += 1"...
false
0.110096
0.036471
3.018735
[ "s743351773", "s144615045" ]
u389530753
p02577
python
s194083793
s506043211
67
57
12,220
12,232
Accepted
Accepted
14.93
N=list(eval(input())) NN=[int(t) for t in N] T=sum(NN) if T%9==0: print("Yes") else : print("No")
N=list(eval(input())) S=[int(t) for t in N] T=sum(S) if T%9==0: print("Yes") else : print("No")
7
7
105
99
N = list(eval(input())) NN = [int(t) for t in N] T = sum(NN) if T % 9 == 0: print("Yes") else: print("No")
N = list(eval(input())) S = [int(t) for t in N] T = sum(S) if T % 9 == 0: print("Yes") else: print("No")
false
0
[ "-NN = [int(t) for t in N]", "-T = sum(NN)", "+S = [int(t) for t in N]", "+T = sum(S)" ]
false
0.04853
0.069004
0.703293
[ "s194083793", "s506043211" ]
u150984829
p02396
python
s331053011
s733916702
60
50
5,668
5,668
Accepted
Accepted
16.67
import sys i=1 for a in sys.stdin: if a=='0\n':break print(f'Case {i}: {a}',end='');i+=1
import sys i=1 for a in sys.stdin: a=a.strip() if'0'==a:break print(f'Case {i}: {a}');i+=1
5
6
95
99
import sys i = 1 for a in sys.stdin: if a == "0\n": break print(f"Case {i}: {a}", end="") i += 1
import sys i = 1 for a in sys.stdin: a = a.strip() if "0" == a: break print(f"Case {i}: {a}") i += 1
false
16.666667
[ "- if a == \"0\\n\":", "+ a = a.strip()", "+ if \"0\" == a:", "- print(f\"Case {i}: {a}\", end=\"\")", "+ print(f\"Case {i}: {a}\")" ]
false
0.045013
0.035875
1.254701
[ "s331053011", "s733916702" ]
u197300773
p03291
python
s968147244
s663408006
401
253
3,188
3,188
Accepted
Accepted
36.91
s=eval(input()) a=[1,0,0,0] for i in range(len(s)): c=s[i] if c=="A": a[1]=(a[1]+a[0])%1000000007 elif c=="B": a[2]=(a[2]+a[1])%1000000007 elif c=="C": a[3]=(a[3]+a[2])%1000000007 elif c=="?": tmp=[a[i] for i in range(4)] a[0]=tmp[0]*3 ...
s=eval(input()) a=[1,0,0,0] for i in range(len(s)): c=s[i] if c=="A": a[1]+=a[0] elif c=="B": a[2]+=a[1] elif c=="C": a[3]+=a[2] elif c=="?": a=[ a[0]*3 ] + [ a[j]*3+a[j-1] for j in range(1,4) ] a=[a[i]%1000000007 for i in range(4)] print(...
21
18
450
319
s = eval(input()) a = [1, 0, 0, 0] for i in range(len(s)): c = s[i] if c == "A": a[1] = (a[1] + a[0]) % 1000000007 elif c == "B": a[2] = (a[2] + a[1]) % 1000000007 elif c == "C": a[3] = (a[3] + a[2]) % 1000000007 elif c == "?": tmp = [a[i] for i in range(4)] a...
s = eval(input()) a = [1, 0, 0, 0] for i in range(len(s)): c = s[i] if c == "A": a[1] += a[0] elif c == "B": a[2] += a[1] elif c == "C": a[3] += a[2] elif c == "?": a = [a[0] * 3] + [a[j] * 3 + a[j - 1] for j in range(1, 4)] a = [a[i] % 1000000007 for i in range(4...
false
14.285714
[ "- a[1] = (a[1] + a[0]) % 1000000007", "+ a[1] += a[0]", "- a[2] = (a[2] + a[1]) % 1000000007", "+ a[2] += a[1]", "- a[3] = (a[3] + a[2]) % 1000000007", "+ a[3] += a[2]", "- tmp = [a[i] for i in range(4)]", "- a[0] = tmp[0] * 3", "- for ...
false
0.0082
0.064738
0.12667
[ "s968147244", "s663408006" ]
u305366205
p03796
python
s346357127
s268856734
46
42
2,940
2,940
Accepted
Accepted
8.7
n = int(eval(input())) ans = 1 for i in range(n): ans *= i + 1 ans %= 10 ** 9 + 7 print(ans)
n = int(eval(input())) ans = 1 for i in range(1, n + 1): ans *= i ans %= 10 ** 9 + 7 print(ans)
6
6
99
103
n = int(eval(input())) ans = 1 for i in range(n): ans *= i + 1 ans %= 10**9 + 7 print(ans)
n = int(eval(input())) ans = 1 for i in range(1, n + 1): ans *= i ans %= 10**9 + 7 print(ans)
false
0
[ "-for i in range(n):", "- ans *= i + 1", "+for i in range(1, n + 1):", "+ ans *= i" ]
false
0.145259
0.172395
0.842591
[ "s346357127", "s268856734" ]
u762540523
p02662
python
s498326731
s697547727
1,979
179
9,320
68,316
Accepted
Accepted
90.96
def resolve(): n, s = list(map(int, input().split())) a = list(map(int, input().split())) mod = 998244353 modinv = pow(2, mod - 2, mod) dp = [0] * (s + 1) dp[0] = pow(2, n, mod) for i in a: for j in range(s - i, -1, -1): dp[j + i] += dp[j] * modinv d...
def resolve(): n, s = list(map(int, input().split())) a = list(map(int, input().split())) mod = 998244353 dp = [0] * (s + 1) dp[0] = 1 for i in a: for j in range(s - i, -1, -1): dp[j + i] = dp[j + i] * 2 + dp[j] dp[j + i] %= mod for j in range(mi...
16
18
396
444
def resolve(): n, s = list(map(int, input().split())) a = list(map(int, input().split())) mod = 998244353 modinv = pow(2, mod - 2, mod) dp = [0] * (s + 1) dp[0] = pow(2, n, mod) for i in a: for j in range(s - i, -1, -1): dp[j + i] += dp[j] * modinv dp[j + i] %...
def resolve(): n, s = list(map(int, input().split())) a = list(map(int, input().split())) mod = 998244353 dp = [0] * (s + 1) dp[0] = 1 for i in a: for j in range(s - i, -1, -1): dp[j + i] = dp[j + i] * 2 + dp[j] dp[j + i] %= mod for j in range(min(i, s + 1...
false
11.111111
[ "- modinv = pow(2, mod - 2, mod)", "- dp[0] = pow(2, n, mod)", "+ dp[0] = 1", "- dp[j + i] += dp[j] * modinv", "+ dp[j + i] = dp[j + i] * 2 + dp[j]", "+ for j in range(min(i, s + 1)):", "+ dp[j] *= 2", "+ dp[j] %= mod" ]
false
0.038471
0.006928
5.552685
[ "s498326731", "s697547727" ]
u262566745
p02265
python
s899361225
s084659482
3,820
2,180
72,052
71,948
Accepted
Accepted
42.93
from collections import deque def main(): queue = deque() for _ in range(int(eval(input()))): commands = input().split(" ") if commands[0] == "insert": queue.appendleft(commands[1]) elif commands[0] == "delete": try: queue.remove(com...
import sys from collections import deque queue = deque() for _ in range(int(sys.stdin.readline())): commands = sys.stdin.readline()[:-1].split(" ") if commands[0] == "insert": queue.appendleft(commands[1]) elif commands[0] == "delete": try: queue.remove(commands[1]) ...
23
20
558
516
from collections import deque def main(): queue = deque() for _ in range(int(eval(input()))): commands = input().split(" ") if commands[0] == "insert": queue.appendleft(commands[1]) elif commands[0] == "delete": try: queue.remove(commands[1]) ...
import sys from collections import deque queue = deque() for _ in range(int(sys.stdin.readline())): commands = sys.stdin.readline()[:-1].split(" ") if commands[0] == "insert": queue.appendleft(commands[1]) elif commands[0] == "delete": try: queue.remove(commands[1]) exce...
false
13.043478
[ "+import sys", "-", "-def main():", "- queue = deque()", "- for _ in range(int(eval(input()))):", "- commands = input().split(\" \")", "- if commands[0] == \"insert\":", "- queue.appendleft(commands[1])", "- elif commands[0] == \"delete\":", "- try:...
false
0.150353
0.11185
1.344232
[ "s899361225", "s084659482" ]
u088552457
p02888
python
s805293662
s005078456
1,472
732
3,188
42,204
Accepted
Accepted
50.27
import bisect N = int(eval(input())) L = list(map(int, input().split())) SL = sorted(L) ans = 0 for i in range(N): if i+1 == N-1: break a = SL[i] for j in range(i+1, N): b = SL[j] c_max = bisect.bisect_left(SL, a+b) ans += c_max - (j+1) print(ans)
import sys input = sys.stdin.readline import collections import bisect def main(): n = int(eval(input())) l = input_list() l.sort() ans = 0 for i in range(n-2): for j in range(i+1, n-1): ind = bisect.bisect_left(l, l[i]+l[j]) num = ind - 1 - j ...
17
28
276
526
import bisect N = int(eval(input())) L = list(map(int, input().split())) SL = sorted(L) ans = 0 for i in range(N): if i + 1 == N - 1: break a = SL[i] for j in range(i + 1, N): b = SL[j] c_max = bisect.bisect_left(SL, a + b) ans += c_max - (j + 1) print(ans)
import sys input = sys.stdin.readline import collections import bisect def main(): n = int(eval(input())) l = input_list() l.sort() ans = 0 for i in range(n - 2): for j in range(i + 1, n - 1): ind = bisect.bisect_left(l, l[i] + l[j]) num = ind - 1 - j a...
false
39.285714
[ "+import sys", "+", "+input = sys.stdin.readline", "+import collections", "-N = int(eval(input()))", "-L = list(map(int, input().split()))", "-SL = sorted(L)", "-ans = 0", "-for i in range(N):", "- if i + 1 == N - 1:", "- break", "- a = SL[i]", "- for j in range(i + 1, N):", ...
false
0.047818
0.033175
1.44137
[ "s805293662", "s005078456" ]
u905203728
p03212
python
s471258155
s979642819
586
428
72,156
60,380
Accepted
Accepted
26.96
def DFS(n): if len(n)>=3 and len(set(list(n))&{"3","5","7"})==3: A.append(int(n)) if len(n)<10: for i in ("3","5","7"): DFS(n+i) n=int(eval(input())) A=[] for i in ("3","5","7"):DFS(i) A.sort() cnt=0 while 1: if A[cnt]<=n:cnt +=1 else:break print(cnt)
def DFS(num): if 3<=len(num)<=m: if len(set(list(num)))==3: A.append(int(num)) if len(num)<=m: for i in ["3","5","7"]: DFS(num+i) n=eval(input()) m=len(n) A=[] for i in ["3","5","7"]: DFS(i) cnt=0 for i in A: if i<=int(n): cnt +=1 pri...
18
20
309
321
def DFS(n): if len(n) >= 3 and len(set(list(n)) & {"3", "5", "7"}) == 3: A.append(int(n)) if len(n) < 10: for i in ("3", "5", "7"): DFS(n + i) n = int(eval(input())) A = [] for i in ("3", "5", "7"): DFS(i) A.sort() cnt = 0 while 1: if A[cnt] <= n: cnt += 1 else:...
def DFS(num): if 3 <= len(num) <= m: if len(set(list(num))) == 3: A.append(int(num)) if len(num) <= m: for i in ["3", "5", "7"]: DFS(num + i) n = eval(input()) m = len(n) A = [] for i in ["3", "5", "7"]: DFS(i) cnt = 0 for i in A: if i <= int(n): cnt += ...
false
10
[ "-def DFS(n):", "- if len(n) >= 3 and len(set(list(n)) & {\"3\", \"5\", \"7\"}) == 3:", "- A.append(int(n))", "- if len(n) < 10:", "- for i in (\"3\", \"5\", \"7\"):", "- DFS(n + i)", "+def DFS(num):", "+ if 3 <= len(num) <= m:", "+ if len(set(list(num))) == ...
false
0.162617
0.03932
4.135774
[ "s471258155", "s979642819" ]
u803848678
p02662
python
s314423142
s813337523
208
153
73,700
73,556
Accepted
Accepted
26.44
mod = 998244353 n,s = list(map(int, input().split())) a = list(map(int, input().split())) table = [0]*(s+1) table[0] = 1 ans = 0 for ai in a: nxt = [0]*(s+1) if ai <= s: for j in range(ai, s+1): nxt[j] = table[j-ai] table = [(2*table[i] + nxt[i])%mod for i in range(s+1)] ...
mod = 998244353 n,s = list(map(int, input().split())) a = list(map(int, input().split())) table = [0]*(s+1) table[0] = 1 for ai in a: nxt = [0]*(s+1) if ai <= s: for j in range(ai, s+1): nxt[j] = table[j-ai] table = [(2*table[i] + nxt[i])%mod for i in range(s+1)] ans = tab...
17
15
355
333
mod = 998244353 n, s = list(map(int, input().split())) a = list(map(int, input().split())) table = [0] * (s + 1) table[0] = 1 ans = 0 for ai in a: nxt = [0] * (s + 1) if ai <= s: for j in range(ai, s + 1): nxt[j] = table[j - ai] table = [(2 * table[i] + nxt[i]) % mod for i in range(s + 1...
mod = 998244353 n, s = list(map(int, input().split())) a = list(map(int, input().split())) table = [0] * (s + 1) table[0] = 1 for ai in a: nxt = [0] * (s + 1) if ai <= s: for j in range(ai, s + 1): nxt[j] = table[j - ai] table = [(2 * table[i] + nxt[i]) % mod for i in range(s + 1)] ans =...
false
11.764706
[ "-ans = 0", "-ans += table[-1]", "-ans %= mod", "+ans = table[-1]" ]
false
0.040698
0.063389
0.642034
[ "s314423142", "s813337523" ]
u847467233
p02444
python
s079177262
s927899341
60
30
6,224
6,208
Accepted
Accepted
50
# AOJ ITP2_4_B: Rotate # Python3 2018.6.24 bal4u from collections import deque n = int(eval(input())) a = list(map(int, input().split())) q = int(eval(input())) for i in range(q): b, m, e = list(map(int, input().split())) s = deque(a[b:e]) s.rotate(e-m) a = a[:b] + list(s) + a[e:] print((*a))
# AOJ ITP2_4_B: Rotate # Python3 2018.6.24 bal4u from collections import deque n = int(eval(input())) a = list(map(int, input().split())) q = int(eval(input())) for i in range(q): b, m, e = list(map(int, input().split())) s = a[b:e] a = a[:b] + s[m-b:] + s[:m-b] + a[e:] print((*a))
13
12
291
278
# AOJ ITP2_4_B: Rotate # Python3 2018.6.24 bal4u from collections import deque n = int(eval(input())) a = list(map(int, input().split())) q = int(eval(input())) for i in range(q): b, m, e = list(map(int, input().split())) s = deque(a[b:e]) s.rotate(e - m) a = a[:b] + list(s) + a[e:] print((*a))
# AOJ ITP2_4_B: Rotate # Python3 2018.6.24 bal4u from collections import deque n = int(eval(input())) a = list(map(int, input().split())) q = int(eval(input())) for i in range(q): b, m, e = list(map(int, input().split())) s = a[b:e] a = a[:b] + s[m - b :] + s[: m - b] + a[e:] print((*a))
false
7.692308
[ "- s = deque(a[b:e])", "- s.rotate(e - m)", "- a = a[:b] + list(s) + a[e:]", "+ s = a[b:e]", "+ a = a[:b] + s[m - b :] + s[: m - b] + a[e:]" ]
false
0.071195
0.068312
1.042204
[ "s079177262", "s927899341" ]
u941753895
p03111
python
s603093422
s910506996
182
71
10,804
10,712
Accepted
Accepted
60.99
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy sys.setrecursionlimit(10**7) inf=10**20 mod=10**9+7 dd=[(-1,0),(0,1),(1,0),(0,-1)] ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return [int(x) for x in sys.stdin.readline().split()] # def LF(): return [float(x) f...
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy sys.setrecursionlimit(10**7) inf=10**20 mod=10**9+7 dd=[(-1,0),(0,1),(1,0),(0,-1)] ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return [int(x) for x in sys.stdin.readline().split()] # def LF(): return [float(x) f...
66
31
1,364
891
import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy sys.setrecursionlimit(10**7) inf = 10**20 mod = 10**9 + 7 dd = [(-1, 0), (0, 1), (1, 0), (0, -1)] ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)] def LI(): return [int(x) for x in sys.stdin.readline().spl...
import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy sys.setrecursionlimit(10**7) inf = 10**20 mod = 10**9 + 7 dd = [(-1, 0), (0, 1), (1, 0), (0, -1)] ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)] def LI(): return [int(x) for x in sys.stdin.readline().spl...
false
53.030303
[ "-# def main():", "-# # main()", "-# print(main())", "-answer = inf", "-def f(lst, ind):", "- global answer", "- if ind == n:", "- ac = lst.count(1)", "- bc = lst.count(2)", "- cc = lst.count(3)", "- if ac == 0 or bc == 0 or cc == 0:", "- return min...
false
0.489668
0.182925
2.676878
[ "s603093422", "s910506996" ]
u176445062
p02898
python
s080334780
s779926155
222
200
49,904
51,696
Accepted
Accepted
9.91
import sys n, k = list(map(int, sys.stdin.readline().split())) a = list(map(int, sys.stdin.readline().split())) print((len(list([x for x in a if x >= k]))))
n, k = list(map(int, input().split())) a = [int(x)>=k for x in input().split()] print((sum(a)))
7
3
159
94
import sys n, k = list(map(int, sys.stdin.readline().split())) a = list(map(int, sys.stdin.readline().split())) print((len(list([x for x in a if x >= k]))))
n, k = list(map(int, input().split())) a = [int(x) >= k for x in input().split()] print((sum(a)))
false
57.142857
[ "-import sys", "-", "-n, k = list(map(int, sys.stdin.readline().split()))", "-a = list(map(int, sys.stdin.readline().split()))", "-print((len(list([x for x in a if x >= k]))))", "+n, k = list(map(int, input().split()))", "+a = [int(x) >= k for x in input().split()]", "+print((sum(a)))" ]
false
0.038691
0.03801
1.017911
[ "s080334780", "s779926155" ]
u218843509
p03305
python
s939242956
s602891495
1,577
1,188
126,828
123,288
Accepted
Accepted
24.67
import heapq, sys n, m, s, t = list(map(int, input().split())) yen_edge = [[] for _ in range(n)] snuke_edge = [[] for _ in range(n)] for _ in range(m): u, v, a, b = list(map(int, input().split())) yen_edge[u - 1].append([v - 1, a]) yen_edge[v - 1].append([u - 1, a]) snuke_edge[u - 1].append([v - 1, b]...
import heapq, sys def input(): return sys.stdin.readline()[:-1] n, m, s, t = list(map(int, input().split())) yen_edge = [[] for _ in range(n)] snuke_edge = [[] for _ in range(n)] for _ in range(m): u, v, a, b = list(map(int, input().split())) yen_edge[u - 1].append([v - 1, a]) yen_edge[v - 1].appe...
74
70
1,967
1,826
import heapq, sys n, m, s, t = list(map(int, input().split())) yen_edge = [[] for _ in range(n)] snuke_edge = [[] for _ in range(n)] for _ in range(m): u, v, a, b = list(map(int, input().split())) yen_edge[u - 1].append([v - 1, a]) yen_edge[v - 1].append([u - 1, a]) snuke_edge[u - 1].append([v - 1, b])...
import heapq, sys def input(): return sys.stdin.readline()[:-1] n, m, s, t = list(map(int, input().split())) yen_edge = [[] for _ in range(n)] snuke_edge = [[] for _ in range(n)] for _ in range(m): u, v, a, b = list(map(int, input().split())) yen_edge[u - 1].append([v - 1, a]) yen_edge[v - 1].append...
false
5.405405
[ "+", "+", "+def input():", "+ return sys.stdin.readline()[:-1]", "+", "- self.dist = [float(\"inf\") for _ in range(self.size)]", "+ self.dist = [10**30 for _ in range(self.size)]", "- self.prev = [-1 for _ in range(self.size)]", "+ # self.prev = [-1 for _ in range(sel...
false
0.043738
0.039925
1.0955
[ "s939242956", "s602891495" ]
u392319141
p03700
python
s688679219
s556735979
1,376
1,058
7,196
7,064
Accepted
Accepted
23.11
N, A, B = list(map(int, input().split())) HP = [] for _ in range(N): HP.append(int(eval(input()))) left = 0 right = max(HP) def canKill(count): ness = 0 for hp in HP: ness += max(-(-(hp - B * count) // (A - B)), 0) if ness <= count: return True return False while...
import sys input = sys.stdin.buffer.readline N, A, B = list(map(int, input().split())) H = [int(eval(input())) for _ in range(N)] ok = 10**18 ng = 0 def isOk(n): cnt = 0 for h in H: h -= B * n if h > 0: cnt += -(-h // (A - B)) return cnt <= n while ok - ng > ...
25
25
466
415
N, A, B = list(map(int, input().split())) HP = [] for _ in range(N): HP.append(int(eval(input()))) left = 0 right = max(HP) def canKill(count): ness = 0 for hp in HP: ness += max(-(-(hp - B * count) // (A - B)), 0) if ness <= count: return True return False while right - left > 1...
import sys input = sys.stdin.buffer.readline N, A, B = list(map(int, input().split())) H = [int(eval(input())) for _ in range(N)] ok = 10**18 ng = 0 def isOk(n): cnt = 0 for h in H: h -= B * n if h > 0: cnt += -(-h // (A - B)) return cnt <= n while ok - ng > 1: mid = (ok...
false
0
[ "+import sys", "+", "+input = sys.stdin.buffer.readline", "-HP = []", "-for _ in range(N):", "- HP.append(int(eval(input())))", "-left = 0", "-right = max(HP)", "+H = [int(eval(input())) for _ in range(N)]", "+ok = 10**18", "+ng = 0", "-def canKill(count):", "- ness = 0", "- for h...
false
0.078823
0.041022
1.921472
[ "s688679219", "s556735979" ]
u562935282
p02898
python
s173133006
s628380637
238
50
51,440
12,040
Accepted
Accepted
78.99
n, k = list(map(int, input().split())) h = tuple(map(int, input().split())) ans = 0 for hh in h: if hh >= k: ans += 1 print(ans)
n, k = list(map(int, input().split())) h = tuple(map(int, input().split())) print((len(tuple([x for x in h if x >= k]))))
8
4
143
121
n, k = list(map(int, input().split())) h = tuple(map(int, input().split())) ans = 0 for hh in h: if hh >= k: ans += 1 print(ans)
n, k = list(map(int, input().split())) h = tuple(map(int, input().split())) print((len(tuple([x for x in h if x >= k]))))
false
50
[ "-ans = 0", "-for hh in h:", "- if hh >= k:", "- ans += 1", "-print(ans)", "+print((len(tuple([x for x in h if x >= k]))))" ]
false
0.03668
0.035117
1.044527
[ "s173133006", "s628380637" ]
u252828980
p02725
python
s445812898
s762777354
172
137
26,436
26,444
Accepted
Accepted
20.35
k,n = list(map(int,input().split())) L = list(map(int,input().split())) li = [] for i in range(n-1): li.append(L[i+1]-L[i]) li.append(k-L[n-1]+L[0]) #print(L,li) min1 =10**10 #min1 = k-L[n-1]+L[0] for i in range(n): min1 = min(min1,(k-li[i])) #print(min1) print(min1)
k,n = list(map(int,input().split())) L = list(map(int,input().split())) li = [] for i in range(n-1): li.append(L[i+1]-L[i]) li.append(k-L[n-1]+L[0]) li.sort() print((k-li[n-1]))
14
9
285
182
k, n = list(map(int, input().split())) L = list(map(int, input().split())) li = [] for i in range(n - 1): li.append(L[i + 1] - L[i]) li.append(k - L[n - 1] + L[0]) # print(L,li) min1 = 10**10 # min1 = k-L[n-1]+L[0] for i in range(n): min1 = min(min1, (k - li[i])) # print(min1) print(min1)
k, n = list(map(int, input().split())) L = list(map(int, input().split())) li = [] for i in range(n - 1): li.append(L[i + 1] - L[i]) li.append(k - L[n - 1] + L[0]) li.sort() print((k - li[n - 1]))
false
35.714286
[ "-# print(L,li)", "-min1 = 10**10", "-# min1 = k-L[n-1]+L[0]", "-for i in range(n):", "- min1 = min(min1, (k - li[i]))", "- # print(min1)", "-print(min1)", "+li.sort()", "+print((k - li[n - 1]))" ]
false
0.047207
0.045375
1.040372
[ "s445812898", "s762777354" ]
u391589398
p03353
python
s797194789
s618119452
1,775
43
4,084
11,092
Accepted
Accepted
97.58
S = eval(input()) k = int(eval(input())) abc = [] for i in range(len(S)): for j in range(1, k+1): if i+j <= len(S): s = S[i:i+j] if not s in abc: abc.append(S[i:i+j]) abc = sorted(abc) print((abc[k-1]))
S = eval(input()) k = int(eval(input())) ss = [] for i in range(len(S)): for j in range(i+1, min(i+k+1, len(S)+1)): ss.append(S[i:j]) ss = sorted(list(set(ss))) print((ss[k-1]))
12
9
257
184
S = eval(input()) k = int(eval(input())) abc = [] for i in range(len(S)): for j in range(1, k + 1): if i + j <= len(S): s = S[i : i + j] if not s in abc: abc.append(S[i : i + j]) abc = sorted(abc) print((abc[k - 1]))
S = eval(input()) k = int(eval(input())) ss = [] for i in range(len(S)): for j in range(i + 1, min(i + k + 1, len(S) + 1)): ss.append(S[i:j]) ss = sorted(list(set(ss))) print((ss[k - 1]))
false
25
[ "-abc = []", "+ss = []", "- for j in range(1, k + 1):", "- if i + j <= len(S):", "- s = S[i : i + j]", "- if not s in abc:", "- abc.append(S[i : i + j])", "-abc = sorted(abc)", "-print((abc[k - 1]))", "+ for j in range(i + 1, min(i + k + 1, len(S) ...
false
0.036368
0.035821
1.015285
[ "s797194789", "s618119452" ]
u353797797
p03287
python
s506903410
s711673063
95
74
13,904
14,188
Accepted
Accepted
22.11
def f(m): aa = [int(ak) % m for ak in input().split()] mod = {} ans = 0 zi = 0 for a in aa: mod.setdefault(zi, 0) mod[zi] += 1 zi = (zi - a) % m ans += mod.get(zi, 0) print(ans) _, m = list(map(int, input().split())) f(m)
from itertools import accumulate from collections import Counter n, m = list(map(int, input().split())) ans = sum(v * (v - 1) // 2 for v in list(Counter([ak % m for ak in accumulate(list(map(int, input().split())))] + [0]).values())) print(ans)
15
6
288
233
def f(m): aa = [int(ak) % m for ak in input().split()] mod = {} ans = 0 zi = 0 for a in aa: mod.setdefault(zi, 0) mod[zi] += 1 zi = (zi - a) % m ans += mod.get(zi, 0) print(ans) _, m = list(map(int, input().split())) f(m)
from itertools import accumulate from collections import Counter n, m = list(map(int, input().split())) ans = sum( v * (v - 1) // 2 for v in list( Counter( [ak % m for ak in accumulate(list(map(int, input().split())))] + [0] ).values() ) ) print(ans)
false
60
[ "-def f(m):", "- aa = [int(ak) % m for ak in input().split()]", "- mod = {}", "- ans = 0", "- zi = 0", "- for a in aa:", "- mod.setdefault(zi, 0)", "- mod[zi] += 1", "- zi = (zi - a) % m", "- ans += mod.get(zi, 0)", "- print(ans)", "+from itertools...
false
0.08722
0.047824
1.823776
[ "s506903410", "s711673063" ]
u217547685
p02832
python
s819392804
s611649178
281
252
77,644
77,516
Accepted
Accepted
10.32
n = int(eval(input())) a = list(map(int, input().split())) num_looking_for = 1 index = 0 cnt = 0 while index < n: if a[index] == num_looking_for: num_looking_for += 1 else: cnt += 1 index += 1 if cnt == n: print((-1)) quit() print(cnt)
n = int(eval(input())) a = list(map(int, input().split())) num_looking_for = 1 cnt = 0 for i in range(n): if a[i] == num_looking_for: num_looking_for += 1 else: cnt += 1 print(("-1" if cnt == n else cnt))
18
11
283
231
n = int(eval(input())) a = list(map(int, input().split())) num_looking_for = 1 index = 0 cnt = 0 while index < n: if a[index] == num_looking_for: num_looking_for += 1 else: cnt += 1 index += 1 if cnt == n: print((-1)) quit() print(cnt)
n = int(eval(input())) a = list(map(int, input().split())) num_looking_for = 1 cnt = 0 for i in range(n): if a[i] == num_looking_for: num_looking_for += 1 else: cnt += 1 print(("-1" if cnt == n else cnt))
false
38.888889
[ "-index = 0", "-while index < n:", "- if a[index] == num_looking_for:", "+for i in range(n):", "+ if a[i] == num_looking_for:", "- index += 1", "-if cnt == n:", "- print((-1))", "- quit()", "-print(cnt)", "+print((\"-1\" if cnt == n else cnt))" ]
false
0.047837
0.04811
0.994335
[ "s819392804", "s611649178" ]
u592248346
p03011
python
s532653244
s456472152
21
17
3,316
2,940
Accepted
Accepted
19.05
a= list(map(int,input().split())) a.sort() print((a[0]+a[1]))
p = list(map(int,input().split())) p.sort() print((p[0]+p[1]))
3
3
62
62
a = list(map(int, input().split())) a.sort() print((a[0] + a[1]))
p = list(map(int, input().split())) p.sort() print((p[0] + p[1]))
false
0
[ "-a = list(map(int, input().split()))", "-a.sort()", "-print((a[0] + a[1]))", "+p = list(map(int, input().split()))", "+p.sort()", "+print((p[0] + p[1]))" ]
false
0.049318
0.037967
1.298992
[ "s532653244", "s456472152" ]
u065137691
p02778
python
s830327344
s716495598
182
65
38,384
61,872
Accepted
Accepted
64.29
S = len(eval(input())) cnt = "" length = 0 a = "x" for i in range(S): cnt = cnt + a print(cnt)
S = eval(input()) leng = len(S) ans = '' for n in range(leng): ans += 'x' print(ans)
7
8
98
91
S = len(eval(input())) cnt = "" length = 0 a = "x" for i in range(S): cnt = cnt + a print(cnt)
S = eval(input()) leng = len(S) ans = "" for n in range(leng): ans += "x" print(ans)
false
12.5
[ "-S = len(eval(input()))", "-cnt = \"\"", "-length = 0", "-a = \"x\"", "-for i in range(S):", "- cnt = cnt + a", "-print(cnt)", "+S = eval(input())", "+leng = len(S)", "+ans = \"\"", "+for n in range(leng):", "+ ans += \"x\"", "+print(ans)" ]
false
0.037143
0.105994
0.350427
[ "s830327344", "s716495598" ]
u844895214
p02642
python
s335542108
s116343526
343
289
32,068
32,116
Accepted
Accepted
15.74
import sys def solve(a,n): m = a[-1]+1 ava = [0]*m for rep in a: ava[rep] += 1 if ava[rep]: for i in range(2*rep,m,rep): ava[i] += 2 return ava.count(1) if __name__=='__main__': n = int(sys.stdin.readline().rstrip()) a = list(map(int,s...
import sys def I(): return int(sys.stdin.readline().rstrip()) def IL(): return list(map(int,sys.stdin.readline().rstrip().split())) def solve(): m = a[-1]+1 ava = [0]*m for rep in a: ava[rep] += 1 if ava[rep]==1: for item in range(2*rep,m,rep): ava[ite...
17
21
395
448
import sys def solve(a, n): m = a[-1] + 1 ava = [0] * m for rep in a: ava[rep] += 1 if ava[rep]: for i in range(2 * rep, m, rep): ava[i] += 2 return ava.count(1) if __name__ == "__main__": n = int(sys.stdin.readline().rstrip()) a = list(map(int, sy...
import sys def I(): return int(sys.stdin.readline().rstrip()) def IL(): return list(map(int, sys.stdin.readline().rstrip().split())) def solve(): m = a[-1] + 1 ava = [0] * m for rep in a: ava[rep] += 1 if ava[rep] == 1: for item in range(2 * rep, m, rep): ...
false
19.047619
[ "-def solve(a, n):", "+def I():", "+ return int(sys.stdin.readline().rstrip())", "+", "+", "+def IL():", "+ return list(map(int, sys.stdin.readline().rstrip().split()))", "+", "+", "+def solve():", "- if ava[rep]:", "- for i in range(2 * rep, m, rep):", "- ...
false
0.041911
0.088245
0.47494
[ "s335542108", "s116343526" ]
u189023301
p03161
python
s355964486
s574006086
1,936
432
13,976
52,448
Accepted
Accepted
77.69
def main(): n, k = list(map(int, input().split())) s = list(map(int, input().split())) inf = 10 ** 8 dp = [inf] * n dp[0] = 0 for j in range(1, n): buf = [dp[i] + abs(s[j]-s[i]) for i in range(max(0, j - k), j)] dp[j] = min(buf) print((dp[-1])) if __name__ == "_...
n, k = list(map(int, input().split())) s = list(map(int, input().split())) inf = 10 ** 8 dp = [inf] * n dp[0] = 0 for j in range(1, n): buf = [dp[i] + abs(s[j]-s[i]) for i in range(max(0, j - k), j)] dp[j] = min(buf) print((dp[-1]))
14
10
334
243
def main(): n, k = list(map(int, input().split())) s = list(map(int, input().split())) inf = 10**8 dp = [inf] * n dp[0] = 0 for j in range(1, n): buf = [dp[i] + abs(s[j] - s[i]) for i in range(max(0, j - k), j)] dp[j] = min(buf) print((dp[-1])) if __name__ == "__main__": ...
n, k = list(map(int, input().split())) s = list(map(int, input().split())) inf = 10**8 dp = [inf] * n dp[0] = 0 for j in range(1, n): buf = [dp[i] + abs(s[j] - s[i]) for i in range(max(0, j - k), j)] dp[j] = min(buf) print((dp[-1]))
false
28.571429
[ "-def main():", "- n, k = list(map(int, input().split()))", "- s = list(map(int, input().split()))", "- inf = 10**8", "- dp = [inf] * n", "- dp[0] = 0", "- for j in range(1, n):", "- buf = [dp[i] + abs(s[j] - s[i]) for i in range(max(0, j - k), j)]", "- dp[j] = min(bu...
false
0.035097
0.034016
1.031788
[ "s355964486", "s574006086" ]
u440180827
p00003
python
s505874643
s326547245
40
30
7,584
7,520
Accepted
Accepted
25
N = int(eval(input())) for i in range(N): sides = list(map(int, input().split())) sides.sort() if sides[0] ** 2 + sides[1] ** 2 == sides[2] ** 2: print('YES') else: print('NO')
N = int(eval(input())) for i in range(N): a, b, c = list(map(int, input().split())) a2 = a ** 2 b2 = b ** 2 c2 = c ** 2 if a2 + b2 == c2 or a2 + c2 == b2 or b2 + c2 == a2: print('YES') else: print('NO')
8
10
209
239
N = int(eval(input())) for i in range(N): sides = list(map(int, input().split())) sides.sort() if sides[0] ** 2 + sides[1] ** 2 == sides[2] ** 2: print("YES") else: print("NO")
N = int(eval(input())) for i in range(N): a, b, c = list(map(int, input().split())) a2 = a**2 b2 = b**2 c2 = c**2 if a2 + b2 == c2 or a2 + c2 == b2 or b2 + c2 == a2: print("YES") else: print("NO")
false
20
[ "- sides = list(map(int, input().split()))", "- sides.sort()", "- if sides[0] ** 2 + sides[1] ** 2 == sides[2] ** 2:", "+ a, b, c = list(map(int, input().split()))", "+ a2 = a**2", "+ b2 = b**2", "+ c2 = c**2", "+ if a2 + b2 == c2 or a2 + c2 == b2 or b2 + c2 == a2:" ]
false
0.122003
0.039869
3.060127
[ "s505874643", "s326547245" ]
u731235119
p01140
python
s118812970
s261518761
9,500
8,150
99,104
99,240
Accepted
Accepted
14.21
while 1 : n, m = list(map(int,input().split(" "))) if (n, m) == (0,0): break Lon = [0 for i in range(1000 * n + 1)] Lat = [0 for i in range(1000 * m + 1)] Lon_sum = [0 for i in range(n)] Lat_sum = [0 for i in range(m)] for i in range(0,n): h = int(input()) for j in range(i+1): Lon_sum[j] += h...
while 1 : n, m = list(map(int,input().split(" "))) if (n, m) == (0,0): break Lon = [0 for i in range(1000 * n + 1)] Lat = [0 for i in range(1000 * m + 1)] Lon_sum = [] Lat_sum = [] for i in range(0,n): h = eval(input()) Lon_sum = [h + j for j in Lon_sum] + [h] for j in Lon_sum: Lon[j] += 1...
21
20
584
531
while 1: n, m = list(map(int, input().split(" "))) if (n, m) == (0, 0): break Lon = [0 for i in range(1000 * n + 1)] Lat = [0 for i in range(1000 * m + 1)] Lon_sum = [0 for i in range(n)] Lat_sum = [0 for i in range(m)] for i in range(0, n): h = int(input()) for j in ...
while 1: n, m = list(map(int, input().split(" "))) if (n, m) == (0, 0): break Lon = [0 for i in range(1000 * n + 1)] Lat = [0 for i in range(1000 * m + 1)] Lon_sum = [] Lat_sum = [] for i in range(0, n): h = eval(input()) Lon_sum = [h + j for j in Lon_sum] + [h] ...
false
4.761905
[ "- Lon_sum = [0 for i in range(n)]", "- Lat_sum = [0 for i in range(m)]", "+ Lon_sum = []", "+ Lat_sum = []", "- h = int(input())", "- for j in range(i + 1):", "- Lon_sum[j] += h", "- Lon[Lon_sum[j]] += 1", "+ h = eval(input())", "+ Lon...
false
0.108928
0.043431
2.508086
[ "s118812970", "s261518761" ]
u366185462
p03699
python
s676706816
s654574640
20
18
3,188
3,064
Accepted
Accepted
10
n = int(eval(input())) sl = [] for i in range(n): s = int(eval(input())) sl.append(s) nmul = [] for i in range(n): if sl[i] % 10 != 0: nmul.append(sl[i]) for i in range(n): ssl = sum(sl) if ssl % 10 == 0: if len(nmul) != 0: subm = ssl - min(nmul) print(subm) else: ...
n = int(eval(input())) sl = [] for i in range(n): s = int(eval(input())) sl.append(s) nmul = [] for i in range(n): if sl[i] % 10 != 0: nmul.append(sl[i]) ssl = sum(sl) if ssl % 10 == 0: if len(nmul) != 0: subm = ssl - min(nmul) print(subm) else: print((0)) else: print((sum(s...
23
18
372
308
n = int(eval(input())) sl = [] for i in range(n): s = int(eval(input())) sl.append(s) nmul = [] for i in range(n): if sl[i] % 10 != 0: nmul.append(sl[i]) for i in range(n): ssl = sum(sl) if ssl % 10 == 0: if len(nmul) != 0: subm = ssl - min(nmul) print(subm) ...
n = int(eval(input())) sl = [] for i in range(n): s = int(eval(input())) sl.append(s) nmul = [] for i in range(n): if sl[i] % 10 != 0: nmul.append(sl[i]) ssl = sum(sl) if ssl % 10 == 0: if len(nmul) != 0: subm = ssl - min(nmul) print(subm) else: print((0)) else: p...
false
21.73913
[ "-for i in range(n):", "- ssl = sum(sl)", "- if ssl % 10 == 0:", "- if len(nmul) != 0:", "- subm = ssl - min(nmul)", "- print(subm)", "- else:", "- print((0))", "- break", "+ssl = sum(sl)", "+if ssl % 10 == 0:", "+ if len(nmul) != ...
false
0.036326
0.041469
0.875967
[ "s676706816", "s654574640" ]
u562935282
p03212
python
s923968304
s416559884
139
81
2,940
3,060
Accepted
Accepted
41.73
def func(var): res = 1 if all(c in str(var) for c in '357') else 0 if var > N: return 0 else: for v in 3, 5, 7: res += func(var * 10 + v) return res N = int(eval(input())) res = 0 for v in 3, 5, 7: res += func(v) print(res)
def rec(s): """引数末尾に753を付け加えてできる753数 753以外の数が現れないように文字を加えているので、 ・すべて一回以上出たら753数に加算 ・Nを超えたらreturn 0 させればよい""" # base case if int(s) > n: return 0 res = 0 if all(c in s for c in '753'): res += 1 # 再帰ステップ for c in '753': res += rec(s + c...
15
22
282
377
def func(var): res = 1 if all(c in str(var) for c in "357") else 0 if var > N: return 0 else: for v in 3, 5, 7: res += func(var * 10 + v) return res N = int(eval(input())) res = 0 for v in 3, 5, 7: res += func(v) print(res)
def rec(s): """引数末尾に753を付け加えてできる753数 753以外の数が現れないように文字を加えているので、 ・すべて一回以上出たら753数に加算 ・Nを超えたらreturn 0 させればよい""" # base case if int(s) > n: return 0 res = 0 if all(c in s for c in "753"): res += 1 # 再帰ステップ for c in "753": res += rec(s + c) return res ...
false
31.818182
[ "-def func(var):", "- res = 1 if all(c in str(var) for c in \"357\") else 0", "- if var > N:", "+def rec(s):", "+ \"\"\"引数末尾に753を付け加えてできる753数", "+ 753以外の数が現れないように文字を加えているので、", "+ ・すべて一回以上出たら753数に加算", "+ ・Nを超えたらreturn 0", "+ させればよい\"\"\"", "+ # base case", "+ if int(s) ...
false
0.133826
0.109842
1.218357
[ "s923968304", "s416559884" ]
u761320129
p02856
python
s330878335
s090954885
614
396
23,696
29,544
Accepted
Accepted
35.5
M = int(eval(input())) DC = [tuple(map(int,input().split())) for i in range(M)] sumd = sumc = 0 for d,c in DC: sumd += d*c sumc += c ans = sumc-1 + (sumd-1)//9 print(ans)
M = int(eval(input())) DC = [tuple(map(int,input().split())) for i in range(M)] s = k = 0 for d,c in DC: k += c s += d*c ans = k-1 + (s-1)//9 print(ans)
10
8
183
161
M = int(eval(input())) DC = [tuple(map(int, input().split())) for i in range(M)] sumd = sumc = 0 for d, c in DC: sumd += d * c sumc += c ans = sumc - 1 + (sumd - 1) // 9 print(ans)
M = int(eval(input())) DC = [tuple(map(int, input().split())) for i in range(M)] s = k = 0 for d, c in DC: k += c s += d * c ans = k - 1 + (s - 1) // 9 print(ans)
false
20
[ "-sumd = sumc = 0", "+s = k = 0", "- sumd += d * c", "- sumc += c", "-ans = sumc - 1 + (sumd - 1) // 9", "+ k += c", "+ s += d * c", "+ans = k - 1 + (s - 1) // 9" ]
false
0.043443
0.043953
0.988407
[ "s330878335", "s090954885" ]
u731368968
p02695
python
s677154684
s014846941
708
284
94,728
90,680
Accepted
Accepted
59.89
n, m, q = list(map(int, input().split())) A, B, C, D = [], [], [], [] for i in range(q): a, b, c, d = list(map(int, input().split())) A.append(a - 1) B.append(b - 1) C.append(c) D.append(d) L = [] def f(l): if len(l) == n: L.append(l) return for i in range(l[...
n, m, q = list(map(int, input().split())) T = [] for i in range(q): a, b, c, d = list(map(int, input().split())) T.append((a - 1, b - 1, c, d)) L = [] def f(l): if len(l) == n + 1: L.append(l[1:]) return for i in range(l[-1], m + 1): f(l + [i]) f([1]) print((max(...
27
16
504
367
n, m, q = list(map(int, input().split())) A, B, C, D = [], [], [], [] for i in range(q): a, b, c, d = list(map(int, input().split())) A.append(a - 1) B.append(b - 1) C.append(c) D.append(d) L = [] def f(l): if len(l) == n: L.append(l) return for i in range(l[-1], m + 1): ...
n, m, q = list(map(int, input().split())) T = [] for i in range(q): a, b, c, d = list(map(int, input().split())) T.append((a - 1, b - 1, c, d)) L = [] def f(l): if len(l) == n + 1: L.append(l[1:]) return for i in range(l[-1], m + 1): f(l + [i]) f([1]) print((max(sum(d for a, ...
false
40.740741
[ "-A, B, C, D = [], [], [], []", "+T = []", "- A.append(a - 1)", "- B.append(b - 1)", "- C.append(c)", "- D.append(d)", "+ T.append((a - 1, b - 1, c, d))", "- if len(l) == n:", "- L.append(l)", "+ if len(l) == n + 1:", "+ L.append(l[1:])", "-for i in range(1, ...
false
0.067419
0.062525
1.078283
[ "s677154684", "s014846941" ]
u815731054
p02887
python
s689172406
s383585339
37
29
3,316
3,316
Accepted
Accepted
21.62
n = int(eval(input())) s = eval(input()) tempchar = s[0] ans = n for i in range(1, n): if(tempchar == s[i]): ans -= 1 else: tempchar = s[i] print(ans)
n = int(eval(input())) s = eval(input()) tempchar = "" ans = n for c in s: if(tempchar == c): ans -= 1 else: tempchar = c print(ans)
12
12
157
139
n = int(eval(input())) s = eval(input()) tempchar = s[0] ans = n for i in range(1, n): if tempchar == s[i]: ans -= 1 else: tempchar = s[i] print(ans)
n = int(eval(input())) s = eval(input()) tempchar = "" ans = n for c in s: if tempchar == c: ans -= 1 else: tempchar = c print(ans)
false
0
[ "-tempchar = s[0]", "+tempchar = \"\"", "-for i in range(1, n):", "- if tempchar == s[i]:", "+for c in s:", "+ if tempchar == c:", "- tempchar = s[i]", "+ tempchar = c" ]
false
0.04249
0.047978
0.885607
[ "s689172406", "s383585339" ]
u608178601
p02819
python
s805085845
s063251156
43
28
2,940
9,324
Accepted
Accepted
34.88
X = int(eval(input())) flag = 0 while flag ==0: if X==2: X+=1 break for i in range(X-2): if X%(i+2)==0: break if i+3==X: flag = 1 break X +=1 print((X-1))
X=int(eval(input())) flag=0 if X==2 or X==3: flag=1 while flag==0: for k in range(2,int(X**0.5)+1): if k==int(X**0.5) and X%k!=0: flag=1 if k>2 and k%2==0: continue elif k>3 and k%3==0: continue elif X%k==0: break if flag==0:X=X+1 print(X)
16
22
183
292
X = int(eval(input())) flag = 0 while flag == 0: if X == 2: X += 1 break for i in range(X - 2): if X % (i + 2) == 0: break if i + 3 == X: flag = 1 break X += 1 print((X - 1))
X = int(eval(input())) flag = 0 if X == 2 or X == 3: flag = 1 while flag == 0: for k in range(2, int(X**0.5) + 1): if k == int(X**0.5) and X % k != 0: flag = 1 if k > 2 and k % 2 == 0: continue elif k > 3 and k % 3 == 0: continue elif X % k == ...
false
27.272727
[ "+if X == 2 or X == 3:", "+ flag = 1", "- if X == 2:", "- X += 1", "- break", "- for i in range(X - 2):", "- if X % (i + 2) == 0:", "+ for k in range(2, int(X**0.5) + 1):", "+ if k == int(X**0.5) and X % k != 0:", "+ flag = 1", "+ if k > ...
false
0.049811
0.043283
1.150833
[ "s805085845", "s063251156" ]
u803617136
p02994
python
s447556960
s120265751
174
18
38,384
3,060
Accepted
Accepted
89.66
N, L = list(map(int, input().split())) diff_min = 100 + 200 - 1 apples = list() remove_apple = 0 for i in range(N): taste = L + i apples.append(taste) if abs(taste) < diff_min: diff_min = abs(taste) remove_apple = taste print((sum(apples) - remove_apple))
n, l = list(map(int, input().split())) diff = 300 ans = [0] * n p = 0 for i in range(n): taste = l + i ans[i] = taste if diff > abs(taste): diff = abs(taste) p = i print((sum(ans) - ans[p]))
13
11
290
220
N, L = list(map(int, input().split())) diff_min = 100 + 200 - 1 apples = list() remove_apple = 0 for i in range(N): taste = L + i apples.append(taste) if abs(taste) < diff_min: diff_min = abs(taste) remove_apple = taste print((sum(apples) - remove_apple))
n, l = list(map(int, input().split())) diff = 300 ans = [0] * n p = 0 for i in range(n): taste = l + i ans[i] = taste if diff > abs(taste): diff = abs(taste) p = i print((sum(ans) - ans[p]))
false
15.384615
[ "-N, L = list(map(int, input().split()))", "-diff_min = 100 + 200 - 1", "-apples = list()", "-remove_apple = 0", "-for i in range(N):", "- taste = L + i", "- apples.append(taste)", "- if abs(taste) < diff_min:", "- diff_min = abs(taste)", "- remove_apple = taste", "-print(...
false
0.071122
0.037465
1.898354
[ "s447556960", "s120265751" ]
u490093499
p03162
python
s842848862
s455878601
1,154
948
32,148
3,064
Accepted
Accepted
17.85
def LIST(): return list(map(int, input().split())) N = int(eval(input())) arr = [LIST() for _ in range(N)] dp = [[arr[0][0],arr[0][1],arr[0][2]],[0,0,0]] l=1 p=0 for i in range(1, N): for j in range(3): for k in range(3): if j == k: continue a1=dp[p][j] a2...
N=int(eval(input())) arr = [int(a) for a in input().split()] dp = [[arr[0],arr[1],arr[2]],[0,0,0]] l=1 p=0 for i in range(1, N): arr = list(map(int, input().split())) for j in range(3): for k in range(3): if j == k: continue dp[l][k] = max(dp[l][k], dp[p][j] + arr[k]) ...
19
15
484
390
def LIST(): return list(map(int, input().split())) N = int(eval(input())) arr = [LIST() for _ in range(N)] dp = [[arr[0][0], arr[0][1], arr[0][2]], [0, 0, 0]] l = 1 p = 0 for i in range(1, N): for j in range(3): for k in range(3): if j == k: continue a1 = dp[p][...
N = int(eval(input())) arr = [int(a) for a in input().split()] dp = [[arr[0], arr[1], arr[2]], [0, 0, 0]] l = 1 p = 0 for i in range(1, N): arr = list(map(int, input().split())) for j in range(3): for k in range(3): if j == k: continue dp[l][k] = max(dp[l][k], dp[...
false
21.052632
[ "-def LIST():", "- return list(map(int, input().split()))", "-", "-", "-arr = [LIST() for _ in range(N)]", "-dp = [[arr[0][0], arr[0][1], arr[0][2]], [0, 0, 0]]", "+arr = [int(a) for a in input().split()]", "+dp = [[arr[0], arr[1], arr[2]], [0, 0, 0]]", "+ arr = list(map(int, input().split()))...
false
0.048249
0.048612
0.992527
[ "s842848862", "s455878601" ]
u494058663
p02726
python
s644249328
s587537496
1,365
1,097
41,536
9,104
Accepted
Accepted
19.63
def main(): n,x,y = list(map(int,input().split())) ans = [0 for i in range(n+1)] Map = [[0 for j in range(n+1)] for i in range(n+1)] for i in range(1,n+1): for j in range(1,n+1): if j>i: dis = min(j-i,abs(x-i)+1+abs(j-y),abs(y-i)+1+abs(j-x)) an...
def main(): n,x,y = list(map(int,input().split())) dis = [0 for i in range(n+1)] for i in range(1,n+1): for j in range(i,n+1): tmp = min(j-i,abs(x-i)+1+abs(j-y),abs(y-i)+1+abs(j-x)) #print(i+1,j+1,tmp) dis[tmp] += 1 for i in range(1,n): print(...
13
13
387
367
def main(): n, x, y = list(map(int, input().split())) ans = [0 for i in range(n + 1)] Map = [[0 for j in range(n + 1)] for i in range(n + 1)] for i in range(1, n + 1): for j in range(1, n + 1): if j > i: dis = min( j - i, abs(x - i) + 1 + abs(j - y...
def main(): n, x, y = list(map(int, input().split())) dis = [0 for i in range(n + 1)] for i in range(1, n + 1): for j in range(i, n + 1): tmp = min(j - i, abs(x - i) + 1 + abs(j - y), abs(y - i) + 1 + abs(j - x)) # print(i+1,j+1,tmp) dis[tmp] += 1 for i in ran...
false
0
[ "- ans = [0 for i in range(n + 1)]", "- Map = [[0 for j in range(n + 1)] for i in range(n + 1)]", "+ dis = [0 for i in range(n + 1)]", "- for j in range(1, n + 1):", "- if j > i:", "- dis = min(", "- j - i, abs(x - i) + 1 + abs(j - y), abs(y -...
false
0.046457
0.046241
1.004663
[ "s644249328", "s587537496" ]
u729133443
p03425
python
s528795603
s967627600
161
52
3,828
10,864
Accepted
Accepted
67.7
from itertools import*;d=[0]*91 for _ in[0]*int(eval(input())):d[ord(input()[0])]+=1 print((sum(p*q*r for p,q,r in combinations([d[ord(t)]for t in'MARCH'],3))))
from itertools import*;d={} for t in open(0).read().split():d[t[0]]=d.get(t[0],0)+1 print((sum(p*q*r for p,q,r in combinations([d.get(t,0)for t in'MARCH'],3))))
3
3
154
160
from itertools import * d = [0] * 91 for _ in [0] * int(eval(input())): d[ord(input()[0])] += 1 print((sum(p * q * r for p, q, r in combinations([d[ord(t)] for t in "MARCH"], 3))))
from itertools import * d = {} for t in open(0).read().split(): d[t[0]] = d.get(t[0], 0) + 1 print((sum(p * q * r for p, q, r in combinations([d.get(t, 0) for t in "MARCH"], 3))))
false
0
[ "-d = [0] * 91", "-for _ in [0] * int(eval(input())):", "- d[ord(input()[0])] += 1", "-print((sum(p * q * r for p, q, r in combinations([d[ord(t)] for t in \"MARCH\"], 3))))", "+d = {}", "+for t in open(0).read().split():", "+ d[t[0]] = d.get(t[0], 0) + 1", "+print((sum(p * q * r for p, q, r in ...
false
0.035084
0.040037
0.87629
[ "s528795603", "s967627600" ]
u150984829
p00008
python
s296709952
s141831825
310
110
5,588
5,608
Accepted
Accepted
64.52
import sys for e in sys.stdin: n=0 for a in range(10): for b in range(10): for c in range(10): for d in range(10): if a+b+c+d==int(e):n+=1 print(n)
import sys for e in sys.stdin: e=int(e);x=list(range(10)) print((sum([1 for a in x for b in x for c in x for d in x if a+b+c+d==e])))
9
4
173
131
import sys for e in sys.stdin: n = 0 for a in range(10): for b in range(10): for c in range(10): for d in range(10): if a + b + c + d == int(e): n += 1 print(n)
import sys for e in sys.stdin: e = int(e) x = list(range(10)) print((sum([1 for a in x for b in x for c in x for d in x if a + b + c + d == e])))
false
55.555556
[ "- n = 0", "- for a in range(10):", "- for b in range(10):", "- for c in range(10):", "- for d in range(10):", "- if a + b + c + d == int(e):", "- n += 1", "- print(n)", "+ e = int(e)", "+ x = list(range(10))...
false
0.071576
0.037864
1.890351
[ "s296709952", "s141831825" ]
u699089116
p02773
python
s318897887
s961245443
1,002
426
115,536
44,028
Accepted
Accepted
57.49
import collections n = int(eval(input())) s = list(eval(input()) for _ in range(n)) c = dict(collections.Counter(s)) m = max(c.values()) ans = [k for k, v in list(c.items()) if v == m] ans.sort() for i in ans: print(i)
from collections import Counter N = int(eval(input())) S = [eval(input()) for _ in range(N)] S = dict(Counter(S)) m = max(S.values()) ans = [] for s, v in list(S.items()): if v == m: ans.append(s) ans.sort() for a in ans: print(a)
12
15
218
247
import collections n = int(eval(input())) s = list(eval(input()) for _ in range(n)) c = dict(collections.Counter(s)) m = max(c.values()) ans = [k for k, v in list(c.items()) if v == m] ans.sort() for i in ans: print(i)
from collections import Counter N = int(eval(input())) S = [eval(input()) for _ in range(N)] S = dict(Counter(S)) m = max(S.values()) ans = [] for s, v in list(S.items()): if v == m: ans.append(s) ans.sort() for a in ans: print(a)
false
20
[ "-import collections", "+from collections import Counter", "-n = int(eval(input()))", "-s = list(eval(input()) for _ in range(n))", "-c = dict(collections.Counter(s))", "-m = max(c.values())", "-ans = [k for k, v in list(c.items()) if v == m]", "+N = int(eval(input()))", "+S = [eval(input()) for _ i...
false
0.034162
0.108264
0.315544
[ "s318897887", "s961245443" ]
u254871849
p02844
python
s482631693
s139798622
212
25
49,652
3,772
Accepted
Accepted
88.21
import sys from string import digits def main(): n, s = sys.stdin.read().split() n = int(n) place = dict((i, list()) for i in digits) for i in range(n): place[s[i]].append(i) l = [None] * n l[0] = set() for i in range(1, n): l[i] = l[i-1] | set([s[i-1]]) ...
import sys from string import digits def main(): n, s = sys.stdin.read().split() cnt = 0 for i in digits: x = s.find(i) if x == -1: continue for j in digits: y = s.find(j, x + 1) if y == -1: continue for...
39
25
896
516
import sys from string import digits def main(): n, s = sys.stdin.read().split() n = int(n) place = dict((i, list()) for i in digits) for i in range(n): place[s[i]].append(i) l = [None] * n l[0] = set() for i in range(1, n): l[i] = l[i - 1] | set([s[i - 1]]) r = [None] ...
import sys from string import digits def main(): n, s = sys.stdin.read().split() cnt = 0 for i in digits: x = s.find(i) if x == -1: continue for j in digits: y = s.find(j, x + 1) if y == -1: continue for k in digits: ...
false
35.897436
[ "- n = int(n)", "- place = dict((i, list()) for i in digits)", "- for i in range(n):", "- place[s[i]].append(i)", "- l = [None] * n", "- l[0] = set()", "- for i in range(1, n):", "- l[i] = l[i - 1] | set([s[i - 1]])", "- r = [None] * n", "- r[n - 1] = set()", ...
false
0.042497
0.054601
0.778322
[ "s482631693", "s139798622" ]
u222207357
p02899
python
s378370086
s500673320
217
104
13,880
13,812
Accepted
Accepted
52.07
N = int(input()) A = list(map(int,input().split())) aa = sorted(range(N), key=lambda k:A[k]) for x in aa: print(x+1,end=" ")
N = int(eval(input())) A = list(map(int,input().split())) aa = [0]*N for i,x in enumerate(A): aa[x-1] = i+1 print((*aa))
7
9
136
131
N = int(input()) A = list(map(int, input().split())) aa = sorted(range(N), key=lambda k: A[k]) for x in aa: print(x + 1, end=" ")
N = int(eval(input())) A = list(map(int, input().split())) aa = [0] * N for i, x in enumerate(A): aa[x - 1] = i + 1 print((*aa))
false
22.222222
[ "-N = int(input())", "+N = int(eval(input()))", "-aa = sorted(range(N), key=lambda k: A[k])", "-for x in aa:", "- print(x + 1, end=\" \")", "+aa = [0] * N", "+for i, x in enumerate(A):", "+ aa[x - 1] = i + 1", "+print((*aa))" ]
false
0.058614
0.05559
1.054405
[ "s378370086", "s500673320" ]
u609061751
p02711
python
s322066491
s592342509
61
56
61,636
61,872
Accepted
Accepted
8.2
import sys input = sys.stdin.readline def linput(): return [int(x) for x in input().split()] n = input().rstrip() if '7' in n: print('Yes') else: print("No")
import sys input = sys.stdin.readline n = input().rstrip() if '7' in n: print("Yes") else: print("No")
12
9
183
120
import sys input = sys.stdin.readline def linput(): return [int(x) for x in input().split()] n = input().rstrip() if "7" in n: print("Yes") else: print("No")
import sys input = sys.stdin.readline n = input().rstrip() if "7" in n: print("Yes") else: print("No")
false
25
[ "-", "-", "-def linput():", "- return [int(x) for x in input().split()]", "-", "-" ]
false
0.048724
0.084994
0.573261
[ "s322066491", "s592342509" ]
u721425712
p02813
python
s368821741
s890456660
38
28
6,040
3,064
Accepted
Accepted
26.32
n = int(eval(input())) p = eval(input()) q = eval(input()) import itertools l = [] for i in range(1, n+1): l.append(str(i)) ans = [] for v in itertools.permutations(l): ans.append(" ".join(v)) a = ans.index(p) b = ans.index(q) print((abs(a-b)))
n = int(eval(input())) P = tuple(map(str, input().split())) Q = tuple(map(str, input().split())) l = [] for i in range(1, n+1): l.append(str(i)) import itertools count = 0 for x in itertools.permutations(l): if x == P: p = count if x == Q: q = count count += 1 print((abs(p-q)))
17
18
252
300
n = int(eval(input())) p = eval(input()) q = eval(input()) import itertools l = [] for i in range(1, n + 1): l.append(str(i)) ans = [] for v in itertools.permutations(l): ans.append(" ".join(v)) a = ans.index(p) b = ans.index(q) print((abs(a - b)))
n = int(eval(input())) P = tuple(map(str, input().split())) Q = tuple(map(str, input().split())) l = [] for i in range(1, n + 1): l.append(str(i)) import itertools count = 0 for x in itertools.permutations(l): if x == P: p = count if x == Q: q = count count += 1 print((abs(p - q)))
false
5.555556
[ "-p = eval(input())", "-q = eval(input())", "-import itertools", "-", "+P = tuple(map(str, input().split()))", "+Q = tuple(map(str, input().split()))", "-ans = []", "-for v in itertools.permutations(l):", "- ans.append(\" \".join(v))", "-a = ans.index(p)", "-b = ans.index(q)", "-print((abs(...
false
0.038078
0.042759
0.890539
[ "s368821741", "s890456660" ]
u934442292
p02948
python
s384210041
s589457749
1,595
168
53,504
22,212
Accepted
Accepted
89.47
import sys from itertools import accumulate input = sys.stdin.readline class SegmentTree: """Segment Tree class. Args: N (int): Number of elements X (list[int]): List for initialization func (callable): Function for interval. init_v (int): Initial value that does...
import sys from heapq import heappop, heappush input = sys.stdin.readline def main(): MAX_A = 10 ** 5 N, M = list(map(int, input().split())) AB = [[] for _ in range(MAX_A + 1)] for i in range(N): A, B = list(map(int, input().split())) AB[A].append(-B) p_queue = [] ...
110
29
2,880
570
import sys from itertools import accumulate input = sys.stdin.readline class SegmentTree: """Segment Tree class. Args: N (int): Number of elements X (list[int]): List for initialization func (callable): Function for interval. init_v (int): Initial value that does not affect `f...
import sys from heapq import heappop, heappush input = sys.stdin.readline def main(): MAX_A = 10**5 N, M = list(map(int, input().split())) AB = [[] for _ in range(MAX_A + 1)] for i in range(N): A, B = list(map(int, input().split())) AB[A].append(-B) p_queue = [] ans = 0 fo...
false
73.636364
[ "-from itertools import accumulate", "+from heapq import heappop, heappush", "-class SegmentTree:", "- \"\"\"Segment Tree class.", "- Args:", "- N (int): Number of elements", "- X (list[int]): List for initialization", "- func (callable): Function for interval.", "- ...
false
0.047293
0.063076
0.74978
[ "s384210041", "s589457749" ]
u707124227
p02726
python
s512515116
s671202426
1,793
342
3,444
50,524
Accepted
Accepted
80.93
""" """ n,x,y=list(map(int,input().split())) ret=[0]*(n-1) for i in range(1,n): for j in range(i+1,n+1): ret[min(j-i,abs(x-i)+1+abs(y-j),abs(x-j)+1+abs(y-i))-1]+=1 for r in ret: print(r)
from collections import defaultdict n,x,y=list(map(int,input().split())) d=defaultdict(lambda:0) for i in range(1,n): for j in range(i+1,n+1): l=min(j-i,abs(j-x)+abs(i-y)+1,abs(i-x)+abs(j-y)+1) d[l]+=1 for i in range(1,n): print((d[i]))
11
9
209
272
""" """ n, x, y = list(map(int, input().split())) ret = [0] * (n - 1) for i in range(1, n): for j in range(i + 1, n + 1): ret[ min(j - i, abs(x - i) + 1 + abs(y - j), abs(x - j) + 1 + abs(y - i)) - 1 ] += 1 for r in ret: print(r)
from collections import defaultdict n, x, y = list(map(int, input().split())) d = defaultdict(lambda: 0) for i in range(1, n): for j in range(i + 1, n + 1): l = min(j - i, abs(j - x) + abs(i - y) + 1, abs(i - x) + abs(j - y) + 1) d[l] += 1 for i in range(1, n): print((d[i]))
false
18.181818
[ "-\"\"\"", "-\"\"\"", "+from collections import defaultdict", "+", "-ret = [0] * (n - 1)", "+d = defaultdict(lambda: 0)", "- ret[", "- min(j - i, abs(x - i) + 1 + abs(y - j), abs(x - j) + 1 + abs(y - i)) - 1", "- ] += 1", "-for r in ret:", "- print(r)", "+ l ...
false
0.111226
0.036015
3.08832
[ "s512515116", "s671202426" ]
u588341295
p03503
python
s301261844
s513477982
313
284
3,188
3,188
Accepted
Accepted
9.27
# -*- coding: utf-8 -*- import itertools N = int(eval(input())) F = [] for i in range(N): F.append(list(map(int, input().split()))) P = [] for i in range(N): P.append(list(map(int, input().split()))) # 重複順列で自分の店の全パターンを出す me_list = list(itertools.product([0, 1], repeat=10)) # 初期値は利益の最小値 me_p ...
# -*- coding: utf-8 -*- import itertools N = int(eval(input())) F = [] for i in range(N): F.append(list(map(int, input().split()))) P = [] for i in range(N): P.append(list(map(int, input().split()))) # 重複順列で自分の店の全パターンを出す me_list = list(itertools.product([0, 1], repeat=10)) # 初期値は利益の最小値 me_p ...
43
43
824
826
# -*- coding: utf-8 -*- import itertools N = int(eval(input())) F = [] for i in range(N): F.append(list(map(int, input().split()))) P = [] for i in range(N): P.append(list(map(int, input().split()))) # 重複順列で自分の店の全パターンを出す me_list = list(itertools.product([0, 1], repeat=10)) # 初期値は利益の最小値 me_p = -1000000000 # 自分の...
# -*- coding: utf-8 -*- import itertools N = int(eval(input())) F = [] for i in range(N): F.append(list(map(int, input().split()))) P = [] for i in range(N): P.append(list(map(int, input().split()))) # 重複順列で自分の店の全パターンを出す me_list = list(itertools.product([0, 1], repeat=10)) # 初期値は利益の最小値 me_p = -float("inf") # 自...
false
0
[ "-me_p = -1000000000", "+me_p = -float(\"inf\")" ]
false
0.05743
0.05131
1.119273
[ "s301261844", "s513477982" ]
u746428948
p03339
python
s486904617
s008621786
207
191
3,672
9,608
Accepted
Accepted
7.73
n = int(eval(input())) s = eval(input()) east = s.count('E') ans = east for i in range(n): if s[i]=='E': east-=1 if i>=1: if s[i-1]=='W': east+=1 ans = min(ans,east) print(ans)
n = int(eval(input())) s = eval(input()) e = s.count('E') w = s.count('W') ans = 1000000 e_counter = 0 w_counter = 0 for i in range(len(s)): if s[i] == 'E': e_counter += 1 else: w_counter += 1 d = w_counter if s[i] == 'W': d -= 1 ans1 = d + (e - e_counter) ...
10
18
183
341
n = int(eval(input())) s = eval(input()) east = s.count("E") ans = east for i in range(n): if s[i] == "E": east -= 1 if i >= 1: if s[i - 1] == "W": east += 1 ans = min(ans, east) print(ans)
n = int(eval(input())) s = eval(input()) e = s.count("E") w = s.count("W") ans = 1000000 e_counter = 0 w_counter = 0 for i in range(len(s)): if s[i] == "E": e_counter += 1 else: w_counter += 1 d = w_counter if s[i] == "W": d -= 1 ans1 = d + (e - e_counter) ans = min(ans1,...
false
44.444444
[ "-east = s.count(\"E\")", "-ans = east", "-for i in range(n):", "+e = s.count(\"E\")", "+w = s.count(\"W\")", "+ans = 1000000", "+e_counter = 0", "+w_counter = 0", "+for i in range(len(s)):", "- east -= 1", "- if i >= 1:", "- if s[i - 1] == \"W\":", "- east += 1",...
false
0.189995
0.068394
2.777971
[ "s486904617", "s008621786" ]
u869919400
p02845
python
s389978616
s093826053
231
120
52,908
20,652
Accepted
Accepted
48.05
N = int(eval(input())) A = list(map(int, input().split())) mod = 1000000007 colors = [0,0,0] ans = 1 for i in range(N): ans = (ans * colors.count(A[i])) % mod for j in range(3): if colors[j] == A[i]: colors[j] += 1 break print(ans)
N = int(eval(input())) A = list(map(int, input().split())) mod = 10**9+7 RGB = [0, 0, 0] ans = 1 for i in range(N): cnt = RGB.count(A[i]) ans = (ans * cnt) % mod for j in range(3): if A[i] == RGB[j]: RGB[j] += 1 break print(ans)
12
16
276
285
N = int(eval(input())) A = list(map(int, input().split())) mod = 1000000007 colors = [0, 0, 0] ans = 1 for i in range(N): ans = (ans * colors.count(A[i])) % mod for j in range(3): if colors[j] == A[i]: colors[j] += 1 break print(ans)
N = int(eval(input())) A = list(map(int, input().split())) mod = 10**9 + 7 RGB = [0, 0, 0] ans = 1 for i in range(N): cnt = RGB.count(A[i]) ans = (ans * cnt) % mod for j in range(3): if A[i] == RGB[j]: RGB[j] += 1 break print(ans)
false
25
[ "-mod = 1000000007", "-colors = [0, 0, 0]", "+mod = 10**9 + 7", "+RGB = [0, 0, 0]", "- ans = (ans * colors.count(A[i])) % mod", "+ cnt = RGB.count(A[i])", "+ ans = (ans * cnt) % mod", "- if colors[j] == A[i]:", "- colors[j] += 1", "+ if A[i] == RGB[j]:", "+ ...
false
0.046114
0.046783
0.985683
[ "s389978616", "s093826053" ]
u021548497
p02567
python
s304630519
s586277086
3,197
768
31,356
114,124
Accepted
Accepted
75.98
import sys input = sys.stdin.readline class SegmentTree: def __init__(self, n, func, e, arrange=None): self.init(n) self.func = func self.e = e self.make_arrange(arrange) def init(self, n): self.inf = pow(2, 32) self.n = n self.N = 1 ...
""" セグメント木 func:二項演算の関数(モノイドである必要あり) e:単位元(モノイドにおける) update, find, bisect, 全てにおいて, 1-indexとなっている。 (大抵の場合、Atcoderの問題文の表記のままの値を、メソッドに代入すれば良い) """ class SegmentTree: def __init__(self, n, func, e, arrange=None): self.init(n) self.func = func self.e = e self.make_arrange(arra...
101
106
2,738
2,740
import sys input = sys.stdin.readline class SegmentTree: def __init__(self, n, func, e, arrange=None): self.init(n) self.func = func self.e = e self.make_arrange(arrange) def init(self, n): self.inf = pow(2, 32) self.n = n self.N = 1 while self...
""" セグメント木 func:二項演算の関数(モノイドである必要あり) e:単位元(モノイドにおける) update, find, bisect, 全てにおいて, 1-indexとなっている。 (大抵の場合、Atcoderの問題文の表記のままの値を、メソッドに代入すれば良い) """ class SegmentTree: def __init__(self, n, func, e, arrange=None): self.init(n) self.func = func self.e = e self.make_arrange(arrange) ...
false
4.716981
[ "-import sys", "-", "-input = sys.stdin.readline", "+\"\"\"", "+セグメント木", "+func:二項演算の関数(モノイドである必要あり)", "+e:単位元(モノイドにおける)", "+update, find, bisect, 全てにおいて, 1-indexとなっている。", "+(大抵の場合、Atcoderの問題文の表記のままの値を、メソッドに代入すれば良い)", "+\"\"\"", "- self.size = self.N * 2 - 1", "- self.N -= 1", ...
false
0.039467
0.039341
1.003199
[ "s304630519", "s586277086" ]
u102461423
p02793
python
s294119671
s943963521
1,445
1,080
5,984
5,984
Accepted
Accepted
25.26
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from fractions import gcd from functools import reduce N,*A = list(map(int,read().split())) MOD = 10 ** 9 + 7 lcm = 1 answer = 0 for x in A: n = x//gcd(lcm,x) lcm *= n answer *=...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from fractions import gcd from functools import reduce N,*A = list(map(int,read().split())) MOD = 10 ** 9 + 7 lcm = 1 answer = 0 for x in A: n = x//gcd(lcm,x) lcm *= n answer *=...
23
22
395
371
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from fractions import gcd from functools import reduce N, *A = list(map(int, read().split())) MOD = 10**9 + 7 lcm = 1 answer = 0 for x in A: n = x // gcd(lcm, x) lcm *= n answer *= n ans...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from fractions import gcd from functools import reduce N, *A = list(map(int, read().split())) MOD = 10**9 + 7 lcm = 1 answer = 0 for x in A: n = x // gcd(lcm, x) lcm *= n answer *= n ans...
false
4.347826
[ "- answer %= MOD", "- answer += lcm // x % MOD", "+ answer += lcm // x" ]
false
0.048132
0.081741
0.588839
[ "s294119671", "s943963521" ]
u285891772
p03331
python
s132109959
s371148599
248
146
5,204
10,492
Accepted
Accepted
41.13
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2 from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemgetter...
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2 from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemgetter,...
30
31
1,078
1,064
import sys, re from collections import deque, defaultdict, Counter from math import ( ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, ) # , log2 from itertools import ( accumulate, permutations, combinations, combi...
import sys, re from collections import deque, defaultdict, Counter from math import ( ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, ) from itertools import ( accumulate, permutations, combinations, combi...
false
3.225806
[ "-) # , log2", "+ log2,", "+)", "+def ketawa(x):", "+ return sum(map(int, list(str(x))))", "+", "+", "-for i in range(1, N // 2 + 1):", "- j = N - i", "- tmp = sum([int(x) for x in list(str(i))]) + sum([int(x) for x in list(str(j))])", "- ans = min(ans, tmp)", "+for a in range(...
false
0.066065
0.092951
0.710745
[ "s132109959", "s371148599" ]
u814663076
p03141
python
s798506710
s827959465
526
374
17,848
17,848
Accepted
Accepted
28.9
import numpy as np N = int(eval(input())) arr = np.empty((N, 3), dtype='int64') for i in range(N): arr[i, 0], arr[i, 1] = input().split() arr[i, 2] = arr[i, 0] + arr[i, 1] arr = arr[np.argsort(arr[:, 2])][::-1] print((np.sum(arr[::2, 0]) - np.sum(arr[1::2, 1])))
import numpy as np import sys input = sys.stdin.readline N = int(eval(input())) arr = np.empty((N, 3), dtype='int64') for i in range(N): arr[i, 0], arr[i, 1] = input().split() arr[i, 2] = arr[i, 0] + arr[i, 1] arr = arr[np.argsort(arr[:, 2])][::-1] print((np.sum(arr[::2, 0]) - np.sum(arr[1::2, ...
12
14
277
317
import numpy as np N = int(eval(input())) arr = np.empty((N, 3), dtype="int64") for i in range(N): arr[i, 0], arr[i, 1] = input().split() arr[i, 2] = arr[i, 0] + arr[i, 1] arr = arr[np.argsort(arr[:, 2])][::-1] print((np.sum(arr[::2, 0]) - np.sum(arr[1::2, 1])))
import numpy as np import sys input = sys.stdin.readline N = int(eval(input())) arr = np.empty((N, 3), dtype="int64") for i in range(N): arr[i, 0], arr[i, 1] = input().split() arr[i, 2] = arr[i, 0] + arr[i, 1] arr = arr[np.argsort(arr[:, 2])][::-1] print((np.sum(arr[::2, 0]) - np.sum(arr[1::2, 1])))
false
14.285714
[ "+import sys", "+input = sys.stdin.readline" ]
false
0.231584
0.229536
1.008923
[ "s798506710", "s827959465" ]
u057109575
p02838
python
s457931152
s005585980
246
219
136,428
117,448
Accepted
Accepted
10.98
N, *A = list(map(int, open(0).read().split())) mod = 10 ** 9 + 7 ans = 0 for bit in range(60): ctr = [0, 0] for i in range(N): ctr[A[i] >> bit & 1] += 1 ans += (1 << bit) * (ctr[0] * ctr[1]) ans %=mod print(ans)
N = int(eval(input())) X = list(map(int, input().split())) MOD = 10 ** 9 + 7 ans = 0 for b in range(61): ctr = [0, 0] for i in range(N): ctr[X[i] >> b & 1] += 1 ans += (1 << b) * ctr[0] * ctr[1] ans %= MOD print(ans)
11
15
241
253
N, *A = list(map(int, open(0).read().split())) mod = 10**9 + 7 ans = 0 for bit in range(60): ctr = [0, 0] for i in range(N): ctr[A[i] >> bit & 1] += 1 ans += (1 << bit) * (ctr[0] * ctr[1]) ans %= mod print(ans)
N = int(eval(input())) X = list(map(int, input().split())) MOD = 10**9 + 7 ans = 0 for b in range(61): ctr = [0, 0] for i in range(N): ctr[X[i] >> b & 1] += 1 ans += (1 << b) * ctr[0] * ctr[1] ans %= MOD print(ans)
false
26.666667
[ "-N, *A = list(map(int, open(0).read().split()))", "-mod = 10**9 + 7", "+N = int(eval(input()))", "+X = list(map(int, input().split()))", "+MOD = 10**9 + 7", "-for bit in range(60):", "+for b in range(61):", "- ctr[A[i] >> bit & 1] += 1", "- ans += (1 << bit) * (ctr[0] * ctr[1])", "- ...
false
0.04555
0.042178
1.079963
[ "s457931152", "s005585980" ]
u166727624
p02718
python
s122149543
s384210583
1,634
154
21,616
12,424
Accepted
Accepted
90.58
#!/usr/bin/env python3 import sys import numpy as np YES = "Yes" # type: str NO = "No" # type: str def solve(N: int, M: int, A: "List[int]"): A = np.array(A) n_sum = np.sum(A)/4/M if (A >= n_sum).sum() >= M: print(YES) else: print(NO) return # Generated by ...
#!/usr/bin/env python3 import sys import numpy as np YES = "Yes" # type: str NO = "No" # type: str def solve(N: int, M: int, A: "List[int]"): A = np.array(A) n_sum = np.sum(A)/4/M if len(set(A)) != N: print("??") if (A >= n_sum).sum() >= M: print(YES) else: ...
33
35
851
905
#!/usr/bin/env python3 import sys import numpy as np YES = "Yes" # type: str NO = "No" # type: str def solve(N: int, M: int, A: "List[int]"): A = np.array(A) n_sum = np.sum(A) / 4 / M if (A >= n_sum).sum() >= M: print(YES) else: print(NO) return # Generated by 1.1.6 https://gi...
#!/usr/bin/env python3 import sys import numpy as np YES = "Yes" # type: str NO = "No" # type: str def solve(N: int, M: int, A: "List[int]"): A = np.array(A) n_sum = np.sum(A) / 4 / M if len(set(A)) != N: print("??") if (A >= n_sum).sum() >= M: print(YES) else: print(NO)...
false
5.714286
[ "+ if len(set(A)) != N:", "+ print(\"??\")" ]
false
0.423025
0.176827
2.392308
[ "s122149543", "s384210583" ]
u467736898
p02728
python
s430140355
s877273292
2,896
2,128
202,908
183,640
Accepted
Accepted
26.52
# https://atcoder.jp/contests/abc160/submissions/15902850 # を配列アクセスが減るように def rerooting(n, edges, identity, merge, add_node): # 全方位木 dp # 参考: https://qiita.com/keymoon/items/2a52f1b0fb7ef67fb89e G = [[] for _ in range(n)] G_idxs = [[] for _ in range(n)] # 自分を指すノードのインデックス for a, b in edges:...
from functools import reduce # 部分木の解を 1 次元で持つように変更 def rerooting(n, edges, identity, merge, add_node): # 全方位木 dp # 参考1: https://qiita.com/keymoon/items/2a52f1b0fb7ef67fb89e # 参考2: https://atcoder.jp/contests/abc160/submissions/15255726 from functools import reduce G = [[] for _ in range(n)] ...
95
99
2,957
2,896
# https://atcoder.jp/contests/abc160/submissions/15902850 # を配列アクセスが減るように def rerooting(n, edges, identity, merge, add_node): # 全方位木 dp # 参考: https://qiita.com/keymoon/items/2a52f1b0fb7ef67fb89e G = [[] for _ in range(n)] G_idxs = [[] for _ in range(n)] # 自分を指すノードのインデックス for a, b in edges: ...
from functools import reduce # 部分木の解を 1 次元で持つように変更 def rerooting(n, edges, identity, merge, add_node): # 全方位木 dp # 参考1: https://qiita.com/keymoon/items/2a52f1b0fb7ef67fb89e # 参考2: https://atcoder.jp/contests/abc160/submissions/15255726 from functools import reduce G = [[] for _ in range(n)] fo...
false
4.040404
[ "-# https://atcoder.jp/contests/abc160/submissions/15902850", "-# を配列アクセスが減るように", "+from functools import reduce", "+", "+# 部分木の解を 1 次元で持つように変更", "- # 参考: https://qiita.com/keymoon/items/2a52f1b0fb7ef67fb89e", "+ # 参考1: https://qiita.com/keymoon/items/2a52f1b0fb7ef67fb89e", "+ # 参考2: https://...
false
0.252601
0.154893
1.630803
[ "s430140355", "s877273292" ]
u511501183
p02695
python
s687396935
s804846250
1,007
687
9,224
9,324
Accepted
Accepted
31.78
import itertools n, m, q = [int(a) for a in input().split()] a = [] b = [] c = [] d = [] for i in range(q): a_,b_,c_,d_ = [int(a) for a in input().split()] a.append(a_-1) b.append(b_-1) c.append(c_) d.append(d_) ans = 0 for A in itertools.combinations_with_replacement(list(range(m)), ...
import copy def dfs(a, b, c, d, A, N, M, Q): ans = 0 if len(A) == 0: s = 1 else: s = A[-1] A.append(0) if len(A) == N: for v in range(s, M+1): A[-1] = v ans_q = 0 for q in range(Q): if (A[b[q]] - A[a[q]]) == c...
23
39
475
833
import itertools n, m, q = [int(a) for a in input().split()] a = [] b = [] c = [] d = [] for i in range(q): a_, b_, c_, d_ = [int(a) for a in input().split()] a.append(a_ - 1) b.append(b_ - 1) c.append(c_) d.append(d_) ans = 0 for A in itertools.combinations_with_replacement(list(range(m)), n): ...
import copy def dfs(a, b, c, d, A, N, M, Q): ans = 0 if len(A) == 0: s = 1 else: s = A[-1] A.append(0) if len(A) == N: for v in range(s, M + 1): A[-1] = v ans_q = 0 for q in range(Q): if (A[b[q]] - A[a[q]]) == c[q]: ...
false
41.025641
[ "-import itertools", "+import copy", "-n, m, q = [int(a) for a in input().split()]", "+", "+def dfs(a, b, c, d, A, N, M, Q):", "+ ans = 0", "+ if len(A) == 0:", "+ s = 1", "+ else:", "+ s = A[-1]", "+ A.append(0)", "+ if len(A) == N:", "+ for v in range(s,...
false
0.132036
0.075676
1.744747
[ "s687396935", "s804846250" ]
u893063840
p02996
python
s313193784
s823764721
1,086
908
55,180
53,600
Accepted
Accepted
16.39
n = int(eval(input())) works = [] for i in range(n): works.append(list(map(int, input().split()))) works = sorted(works, key=lambda x: x[1]) def ans(works): time = 0 for work in works: time += work[0] if time > work[1]: print("No") return print("Ye...
n = int(eval(input())) ab = [list(map(int, input().split())) for _ in range(n)] ab.sort(key=lambda x: x[1]) time = 0 ans = "Yes" for a, b in ab: time += a if time > b: ans = "No" print(ans)
18
12
344
213
n = int(eval(input())) works = [] for i in range(n): works.append(list(map(int, input().split()))) works = sorted(works, key=lambda x: x[1]) def ans(works): time = 0 for work in works: time += work[0] if time > work[1]: print("No") return print("Yes") return...
n = int(eval(input())) ab = [list(map(int, input().split())) for _ in range(n)] ab.sort(key=lambda x: x[1]) time = 0 ans = "Yes" for a, b in ab: time += a if time > b: ans = "No" print(ans)
false
33.333333
[ "-works = []", "-for i in range(n):", "- works.append(list(map(int, input().split())))", "-works = sorted(works, key=lambda x: x[1])", "-", "-", "-def ans(works):", "- time = 0", "- for work in works:", "- time += work[0]", "- if time > work[1]:", "- print(\"N...
false
0.045033
0.045663
0.986196
[ "s313193784", "s823764721" ]
u960171798
p03073
python
s960899312
s942700544
42
19
3,188
3,188
Accepted
Accepted
54.76
S = eval(input()) len_S = len(S) cnt1 = 0 if len_S%2 == 0: ans = "01"*(len_S//2) else: ans = "01"*(len_S//2)+"0" for i in range(len_S): if S[i]!=ans[i]: cnt1 += 1 final_ans = min(len_S-cnt1,cnt1) print(final_ans)
s = eval(input()) a = s[::2].count('0') + s[1::2].count('1') b = s[::2].count('1') + s[1::2].count('0') print((min(a, b)))
13
4
229
118
S = eval(input()) len_S = len(S) cnt1 = 0 if len_S % 2 == 0: ans = "01" * (len_S // 2) else: ans = "01" * (len_S // 2) + "0" for i in range(len_S): if S[i] != ans[i]: cnt1 += 1 final_ans = min(len_S - cnt1, cnt1) print(final_ans)
s = eval(input()) a = s[::2].count("0") + s[1::2].count("1") b = s[::2].count("1") + s[1::2].count("0") print((min(a, b)))
false
69.230769
[ "-S = eval(input())", "-len_S = len(S)", "-cnt1 = 0", "-if len_S % 2 == 0:", "- ans = \"01\" * (len_S // 2)", "-else:", "- ans = \"01\" * (len_S // 2) + \"0\"", "-for i in range(len_S):", "- if S[i] != ans[i]:", "- cnt1 += 1", "-final_ans = min(len_S - cnt1, cnt1)", "-print(fin...
false
0.034501
0.034653
0.995615
[ "s960899312", "s942700544" ]
u583455650
p02772
python
s614950395
s801542161
165
18
38,480
2,940
Accepted
Accepted
89.09
n=int(eval(input())) a=list(map(int,input().split())) ans=True for i in a: if not i%2 and i%3 and i%5: ans=False break print(('APPROVED' if ans else 'DENIED'))
n,*a=list(map(int,open(0).read().split())) print(("DENIED" if sum((i%3)*(i%5) for i in a if i%2==0) else "APPROVED"))
8
2
178
110
n = int(eval(input())) a = list(map(int, input().split())) ans = True for i in a: if not i % 2 and i % 3 and i % 5: ans = False break print(("APPROVED" if ans else "DENIED"))
n, *a = list(map(int, open(0).read().split())) print(("DENIED" if sum((i % 3) * (i % 5) for i in a if i % 2 == 0) else "APPROVED"))
false
75
[ "-n = int(eval(input()))", "-a = list(map(int, input().split()))", "-ans = True", "-for i in a:", "- if not i % 2 and i % 3 and i % 5:", "- ans = False", "- break", "-print((\"APPROVED\" if ans else \"DENIED\"))", "+n, *a = list(map(int, open(0).read().split()))", "+print((\"DENIE...
false
0.078399
0.042348
1.85129
[ "s614950395", "s801542161" ]
u809819902
p03035
python
s439494499
s042176057
29
22
9,084
9,092
Accepted
Accepted
24.14
a,b = list(map(int,input().split())) print((0 if a<=5 else b if a >= 13 else b//2))
a,b=list(map(int,input().split())) if a<=5: print((0)) exit() elif 6<=a<=12: print((b//2)) exit() else: print(b)
2
9
77
130
a, b = list(map(int, input().split())) print((0 if a <= 5 else b if a >= 13 else b // 2))
a, b = list(map(int, input().split())) if a <= 5: print((0)) exit() elif 6 <= a <= 12: print((b // 2)) exit() else: print(b)
false
77.777778
[ "-print((0 if a <= 5 else b if a >= 13 else b // 2))", "+if a <= 5:", "+ print((0))", "+ exit()", "+elif 6 <= a <= 12:", "+ print((b // 2))", "+ exit()", "+else:", "+ print(b)" ]
false
0.035912
0.035681
1.006471
[ "s439494499", "s042176057" ]
u337751290
p02732
python
s863639740
s848795193
1,626
520
121,476
117,960
Accepted
Accepted
68.02
from math import factorial def c(n): if n < 2: return 0 return factorial(n) // (factorial(n-2) * factorial(2)) def main(): N = int(eval(input())) # 文字列または整数(一変数) a = list(map(int, input().split())) # 整数のリスト for i in range(N): a[i] -= 1 nums = [0 for _ in ran...
def main(): N = int(eval(input())) A = list(map(int, input().split())) # print(N) # print(A) d = {i:0 for i in range(1,N+1)} d2 = {} d3 = {} # print(d) # return for i in A: d[i] += 1 # print(d) sum = 0 for i in range(1,N+1): d2[i...
31
36
588
618
from math import factorial def c(n): if n < 2: return 0 return factorial(n) // (factorial(n - 2) * factorial(2)) def main(): N = int(eval(input())) # 文字列または整数(一変数) a = list(map(int, input().split())) # 整数のリスト for i in range(N): a[i] -= 1 nums = [0 for _ in range(N)] for...
def main(): N = int(eval(input())) A = list(map(int, input().split())) # print(N) # print(A) d = {i: 0 for i in range(1, N + 1)} d2 = {} d3 = {} # print(d) # return for i in A: d[i] += 1 # print(d) sum = 0 for i in range(1, N + 1): d2[i] = int(d[i] * (...
false
13.888889
[ "-from math import factorial", "-", "-", "-def c(n):", "- if n < 2:", "- return 0", "- return factorial(n) // (factorial(n - 2) * factorial(2))", "-", "-", "- N = int(eval(input())) # 文字列または整数(一変数)", "- a = list(map(int, input().split())) # 整数のリスト", "- for i in range(N)...
false
0.085782
0.046131
1.859527
[ "s863639740", "s848795193" ]
u997521090
p03209
python
s029630737
s625992587
12
11
2,820
2,692
Accepted
Accepted
8.33
def f(v, i): s = 4 * 2 ** v - 3 n = 2 * 2 ** v - 1 m = (s + 1) / 2 if i < 1 or i > s: return 0 return [0, f(v - 1, i - 1), n / 2 + 1, f(v - 1, i - s / 2 - 1) + n / 2 + 1, n, 1][(i > 1) + (i >= m) + (i > m) + (i >= s) + (v == 0) * 3] print(f(*list(map(int, input().split()))))
def f(v, i): s = 4 * 2 ** v - 3 n = 2 * 2 ** v - 1 m = (s + 1) / 2 return 0 if i < 1 or i > s else [0, f(v - 1, i - 1), n / 2 + 1, f(v - 1, i - s / 2 - 1) + n / 2 + 1, n, 1][(i > 1) + (i >= m) + (i > m) + (i >= s) + (v == 0) * 3] print(f(*list(map(int, input().split()))))
8
7
300
292
def f(v, i): s = 4 * 2**v - 3 n = 2 * 2**v - 1 m = (s + 1) / 2 if i < 1 or i > s: return 0 return [0, f(v - 1, i - 1), n / 2 + 1, f(v - 1, i - s / 2 - 1) + n / 2 + 1, n, 1][ (i > 1) + (i >= m) + (i > m) + (i >= s) + (v == 0) * 3 ] print(f(*list(map(int, input().split()))))
def f(v, i): s = 4 * 2**v - 3 n = 2 * 2**v - 1 m = (s + 1) / 2 return ( 0 if i < 1 or i > s else [0, f(v - 1, i - 1), n / 2 + 1, f(v - 1, i - s / 2 - 1) + n / 2 + 1, n, 1][ (i > 1) + (i >= m) + (i > m) + (i >= s) + (v == 0) * 3 ] ) print(f(*list(map(int,...
false
12.5
[ "- if i < 1 or i > s:", "- return 0", "- return [0, f(v - 1, i - 1), n / 2 + 1, f(v - 1, i - s / 2 - 1) + n / 2 + 1, n, 1][", "- (i > 1) + (i >= m) + (i > m) + (i >= s) + (v == 0) * 3", "- ]", "+ return (", "+ 0", "+ if i < 1 or i > s", "+ else [0, f(v ...
false
0.115133
0.043107
2.6709
[ "s029630737", "s625992587" ]