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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u814986259 | p03151 | python | s046596589 | s917227750 | 356 | 121 | 32,148 | 18,356 | Accepted | Accepted | 66.01 | N=int(eval(input()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
diff=[[A[i]-B[i],i] for i in range(N)]
diff=sorted(diff,key=lambda x:x[0])
idx=-1
for i in range(N):
while(diff[i][0]<0):
if diff[idx][0]< 0:
print("-1")
exit(0)
if abs(diff[i][0]) >= diff[idx][0]... | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
diff = [A[i] - B[i] for i in range(N)]
if sum(diff) < 0:
print((-1))
exit(0)
minus = [diff[i] for i in range(N) if diff[i] < 0]
plus = [diff[i] for i in range(N) if diff[i] > 0]
plus.sort(reverse=True)
a... | 27 | 19 | 592 | 437 | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
diff = [[A[i] - B[i], i] for i in range(N)]
diff = sorted(diff, key=lambda x: x[0])
idx = -1
for i in range(N):
while diff[i][0] < 0:
if diff[idx][0] < 0:
print("-1")
exit(0)
if abs... | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
diff = [A[i] - B[i] for i in range(N)]
if sum(diff) < 0:
print((-1))
exit(0)
minus = [diff[i] for i in range(N) if diff[i] < 0]
plus = [diff[i] for i in range(N) if diff[i] > 0]
plus.sort(reverse=True)
ans = len(minus... | false | 29.62963 | [
"-diff = [[A[i] - B[i], i] for i in range(N)]",
"-diff = sorted(diff, key=lambda x: x[0])",
"-idx = -1",
"-for i in range(N):",
"- while diff[i][0] < 0:",
"- if diff[idx][0] < 0:",
"- print(\"-1\")",
"- exit(0)",
"- if abs(diff[i][0]) >= diff[idx][0]:",
"- ... | false | 0.067728 | 0.042857 | 1.580351 | [
"s046596589",
"s917227750"
] |
u197457087 | p03831 | python | s846794378 | s825277572 | 225 | 90 | 62,704 | 20,132 | Accepted | Accepted | 60 | N,A,B = list(map(int,input().split()))
X = list(map(int,input().split()))
ans = 0
for i in range(1,N):
step = min(A*(X[i]-X[i-1]),B)
ans += step
print(ans)
| N,A,B = list(map(int,input().split()))
X = list(map(int,input().split()))
ans = 0
now = X[0]
for i in range(1,N):
nxt = X[i]
step = min(A*(nxt-now),B)
ans += step
now = nxt
print(ans) | 8 | 11 | 162 | 196 | N, A, B = list(map(int, input().split()))
X = list(map(int, input().split()))
ans = 0
for i in range(1, N):
step = min(A * (X[i] - X[i - 1]), B)
ans += step
print(ans)
| N, A, B = list(map(int, input().split()))
X = list(map(int, input().split()))
ans = 0
now = X[0]
for i in range(1, N):
nxt = X[i]
step = min(A * (nxt - now), B)
ans += step
now = nxt
print(ans)
| false | 27.272727 | [
"+now = X[0]",
"- step = min(A * (X[i] - X[i - 1]), B)",
"+ nxt = X[i]",
"+ step = min(A * (nxt - now), B)",
"+ now = nxt"
] | false | 0.040615 | 0.040423 | 1.00475 | [
"s846794378",
"s825277572"
] |
u378157957 | p03745 | python | s982484076 | s590484236 | 90 | 65 | 15,020 | 14,252 | Accepted | Accepted | 27.78 | __DEUBG__ = 0
import math
import sys
num = int(eval(input()))
seq = list(map(int, input().split()))
prev = None
tmp = []
increase = None
count = 0
def dump(x):
from pprint import pprint
pprint(x)
#breakpoint()
for x in seq:
if __DEUBG__:
print(x)
print(tmp)
i... | num = int(eval(input()))
seq = list(map(int, input().split()))
prev = None
increase = None
count = 0
prev = seq[0]
for x in seq[1:]:
if increase is True:
if x >= prev:
pass
else:
increase = None
count += 1
elif increase is False:
if x... | 58 | 32 | 1,072 | 619 | __DEUBG__ = 0
import math
import sys
num = int(eval(input()))
seq = list(map(int, input().split()))
prev = None
tmp = []
increase = None
count = 0
def dump(x):
from pprint import pprint
pprint(x)
# breakpoint()
for x in seq:
if __DEUBG__:
print(x)
print(tmp)
if prev is None:
... | num = int(eval(input()))
seq = list(map(int, input().split()))
prev = None
increase = None
count = 0
prev = seq[0]
for x in seq[1:]:
if increase is True:
if x >= prev:
pass
else:
increase = None
count += 1
elif increase is False:
if x <= prev:
... | false | 44.827586 | [
"-__DEUBG__ = 0",
"-import math",
"-import sys",
"-",
"-tmp = []",
"-",
"-",
"-def dump(x):",
"- from pprint import pprint",
"-",
"- pprint(x)",
"-",
"-",
"-# breakpoint()",
"-for x in seq:",
"- if __DEUBG__:",
"- print(x)",
"- print(tmp)",
"- if prev is... | false | 0.042426 | 0.03855 | 1.100545 | [
"s982484076",
"s590484236"
] |
u272522520 | p03845 | python | s383354739 | s707576904 | 22 | 18 | 3,060 | 3,060 | Accepted | Accepted | 18.18 | N = int(eval(input()))
T = list(map(int, input().split()))
M = int(eval(input()))
for i in range(M):
SUM = 0
P,X= list(map(int, input().split()))
for i in range(N):
Z = T[P-1]
T[P-1] = X
SUM = SUM + T[i]
T[P-1] = Z
print(SUM) | N = int(eval(input()))
T = list(map(int, input().split()))
M = int(eval(input()))
SUM = 0
for i in range(N):
SUM = SUM + T[i]
for i in range(M):
P,X = list(map(int, input().split()))
print((SUM-(T[P-1]-X))) | 15 | 10 | 272 | 208 | N = int(eval(input()))
T = list(map(int, input().split()))
M = int(eval(input()))
for i in range(M):
SUM = 0
P, X = list(map(int, input().split()))
for i in range(N):
Z = T[P - 1]
T[P - 1] = X
SUM = SUM + T[i]
T[P - 1] = Z
print(SUM)
| N = int(eval(input()))
T = list(map(int, input().split()))
M = int(eval(input()))
SUM = 0
for i in range(N):
SUM = SUM + T[i]
for i in range(M):
P, X = list(map(int, input().split()))
print((SUM - (T[P - 1] - X)))
| false | 33.333333 | [
"+SUM = 0",
"+for i in range(N):",
"+ SUM = SUM + T[i]",
"- SUM = 0",
"- for i in range(N):",
"- Z = T[P - 1]",
"- T[P - 1] = X",
"- SUM = SUM + T[i]",
"- T[P - 1] = Z",
"- print(SUM)",
"+ print((SUM - (T[P - 1] - X)))"
] | false | 0.048433 | 0.04743 | 1.02114 | [
"s383354739",
"s707576904"
] |
u111365362 | p02844 | python | s228922017 | s138261787 | 1,563 | 212 | 3,188 | 42,092 | Accepted | Accepted | 86.44 | n = int(eval(input()))
s = eval(input())
z1000 = [0 for _ in range(1000)]
l = [-1 for _ in range(10)]
r = [-1 for _ in range(10)]
for i in range(n):
d = int(s[i])
if l[d] == -1:
l[d] = i
for i in range(n)[::-1]:
d = int(s[i])
if r[d] == -1:
r[d] = i
for i in range(n):
d = int(s[i])
fo... | n = int(eval(input()))
s = eval(input())
z10 = [0 for _ in range(10)]
z100 = [0 for _ in range(100)]
z1000 = [0 for _ in range(1000)]
for i in range(n):
x = int(s[i])
for k in range(100):
z1000[10*k+x] = z100[k]
for j in range(10):
z100[10*j+x] = z10[j]
z10[x] = 1
print((sum(z1000)))
#for i... | 26 | 16 | 561 | 359 | n = int(eval(input()))
s = eval(input())
z1000 = [0 for _ in range(1000)]
l = [-1 for _ in range(10)]
r = [-1 for _ in range(10)]
for i in range(n):
d = int(s[i])
if l[d] == -1:
l[d] = i
for i in range(n)[::-1]:
d = int(s[i])
if r[d] == -1:
r[d] = i
for i in range(n):
d = int(s[i])
... | n = int(eval(input()))
s = eval(input())
z10 = [0 for _ in range(10)]
z100 = [0 for _ in range(100)]
z1000 = [0 for _ in range(1000)]
for i in range(n):
x = int(s[i])
for k in range(100):
z1000[10 * k + x] = z100[k]
for j in range(10):
z100[10 * j + x] = z10[j]
z10[x] = 1
print((sum(z100... | false | 38.461538 | [
"+z10 = [0 for _ in range(10)]",
"+z100 = [0 for _ in range(100)]",
"-l = [-1 for _ in range(10)]",
"-r = [-1 for _ in range(10)]",
"- d = int(s[i])",
"- if l[d] == -1:",
"- l[d] = i",
"-for i in range(n)[::-1]:",
"- d = int(s[i])",
"- if r[d] == -1:",
"- r[d] = i",
"... | false | 0.081903 | 0.038619 | 2.120818 | [
"s228922017",
"s138261787"
] |
u191874006 | p02863 | python | s475788800 | s218232459 | 462 | 369 | 46,172 | 216,580 | Accepted | Accepted | 20.13 | #!/usr/bin/env python3
#ABC145 E
import sys
import math
import copy
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | 35 | 35 | 939 | 949 | #!/usr/bin/env python3
# ABC145 E
import sys
import math
import copy
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Co... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | false | 0 | [
"-# ABC145 E",
"-import copy",
"-sys.setrecursionlimit(1000000)",
"+sys.setrecursionlimit(2147483647)",
"-dp1 = [0] * t",
"-dp2 = [0] * t",
"-for i in range(n):",
"- a, b = ab[i]",
"- for j in range(t)[::-1]:",
"- if j - a < 0:",
"- dp2[j] = max(dp2[j], dp1[j] + b)",
"-... | false | 0.043955 | 0.041168 | 1.067695 | [
"s475788800",
"s218232459"
] |
u188827677 | p03338 | python | s518123702 | s957797056 | 30 | 27 | 9,124 | 9,160 | Accepted | Accepted | 10 | n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(1,n):
t = len(set(s[:i]) & set(s[i:]))
if ans < t: ans = t
print(ans) | n = int(eval(input()))
s = list(eval(input()))
ans = 0
for i in range(1,n-1):
t = len(set(s[:i]) & set(s[i:]))
if ans < t: ans = t
print(ans) | 8 | 8 | 133 | 141 | n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(1, n):
t = len(set(s[:i]) & set(s[i:]))
if ans < t:
ans = t
print(ans)
| n = int(eval(input()))
s = list(eval(input()))
ans = 0
for i in range(1, n - 1):
t = len(set(s[:i]) & set(s[i:]))
if ans < t:
ans = t
print(ans)
| false | 0 | [
"-s = eval(input())",
"+s = list(eval(input()))",
"-for i in range(1, n):",
"+for i in range(1, n - 1):"
] | false | 0.086905 | 0.047582 | 1.826431 | [
"s518123702",
"s957797056"
] |
u417365712 | p02803 | python | s744620339 | s553586055 | 1,028 | 657 | 12,532 | 27,040 | Accepted | Accepted | 36.09 | from copy import deepcopy
from collections import deque
from itertools import product
import numpy as np
inputs = open(0).readlines()
class Grid():
def __init__(self, grid, w=0, h=0, function=lambda x: x):
self.w = w = w if w else len(grid[0])
self.h = h = h if h else len(grid)
dtyp... | from copy import deepcopy
from collections import deque
from itertools import product
import numpy as np
class Grid:
def __init__(self, grid, w=0, h=0, function=lambda x: x):
self.w = w = w if w else len(grid[0])
self.h = h = h if h else len(grid)
dtype = type(function(grid[0][0]))
... | 52 | 60 | 1,700 | 1,924 | from copy import deepcopy
from collections import deque
from itertools import product
import numpy as np
inputs = open(0).readlines()
class Grid:
def __init__(self, grid, w=0, h=0, function=lambda x: x):
self.w = w = w if w else len(grid[0])
self.h = h = h if h else len(grid)
dtype = type... | from copy import deepcopy
from collections import deque
from itertools import product
import numpy as np
class Grid:
def __init__(self, grid, w=0, h=0, function=lambda x: x):
self.w = w = w if w else len(grid[0])
self.h = h = h if h else len(grid)
dtype = type(function(grid[0][0]))
... | false | 13.333333 | [
"-",
"-inputs = open(0).readlines()",
"- return \"\\n\".join([\" \".join(map(str, row)) for row in self.grid])",
"+ return \"\\n\".join([\" \".join(map(str, row)) for row in self.grid]) + \"\\n\"",
"-h, w = list(map(int, inputs[0].split()))",
"-grid_origin = Grid(inputs[1:], function=lambda ... | false | 0.284177 | 0.2119 | 1.34109 | [
"s744620339",
"s553586055"
] |
u222668979 | p02616 | python | s148414133 | s611365714 | 274 | 252 | 31,680 | 31,728 | Accepted | Accepted | 8.03 | #with open('random_pm00.txt') as f:
#n, k = map(int, f.readline().split())
#a = list(map(int, f.readline().split()))
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
mia, pla = [], []
for ai in a:
if ai < 0:
mia.append(ai)
elif ai >= 0:
... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
mia, pla = [], []
for ai in a:
if ai < 0:
mia.append(ai)
elif ai >= 0:
pla.append(ai)
mia.sort(reverse=True)
pla.sort()
cnt = 1
if len(pla) == 0 and k % 2 == 1:
for i in mia[:k]:
... | 43 | 36 | 1,253 | 999 | # with open('random_pm00.txt') as f:
# n, k = map(int, f.readline().split())
# a = list(map(int, f.readline().split()))
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 10**9 + 7
mia, pla = [], []
for ai in a:
if ai < 0:
mia.append(ai)
elif ai >= 0:
pla.append(ai)... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 10**9 + 7
mia, pla = [], []
for ai in a:
if ai < 0:
mia.append(ai)
elif ai >= 0:
pla.append(ai)
mia.sort(reverse=True)
pla.sort()
cnt = 1
if len(pla) == 0 and k % 2 == 1:
for i in mia[:k]:
cnt = cnt * i ... | false | 16.27907 | [
"-# with open('random_pm00.txt') as f:",
"-# n, k = map(int, f.readline().split())",
"-# a = list(map(int, f.readline().split()))",
"- if k == 1:",
"- cnt = cnt * pla.pop() % mod",
"- k -= 1",
"- elif k > 1:",
"- cnt = cnt * mia.pop() ... | false | 0.036989 | 0.05634 | 0.656534 | [
"s148414133",
"s611365714"
] |
u124864167 | p02584 | python | s356470615 | s068324877 | 882 | 60 | 62,984 | 61,784 | Accepted | Accepted | 93.2 | X, K, D = list(map(int, input().rstrip().split()))
before = X
if abs(X)//D>=K:
print((abs(X)-D*K))
else:
for i in range(K):
buf = X
if X<0:
X += D
else:
X -= D
if X == before:
if (K-i)%2 == 0:
if X<0:
X += D
else:
X -= D
... | x,k,d = list(map(int,input().split()))
x = abs(x)
if x//d > k:
print((x-k*d))
elif (k-x//d)%2 == 0:
print((x%d))
else:
print((d-x%d)) | 23 | 8 | 383 | 134 | X, K, D = list(map(int, input().rstrip().split()))
before = X
if abs(X) // D >= K:
print((abs(X) - D * K))
else:
for i in range(K):
buf = X
if X < 0:
X += D
else:
X -= D
if X == before:
if (K - i) % 2 == 0:
if X < 0:
... | x, k, d = list(map(int, input().split()))
x = abs(x)
if x // d > k:
print((x - k * d))
elif (k - x // d) % 2 == 0:
print((x % d))
else:
print((d - x % d))
| false | 65.217391 | [
"-X, K, D = list(map(int, input().rstrip().split()))",
"-before = X",
"-if abs(X) // D >= K:",
"- print((abs(X) - D * K))",
"+x, k, d = list(map(int, input().split()))",
"+x = abs(x)",
"+if x // d > k:",
"+ print((x - k * d))",
"+elif (k - x // d) % 2 == 0:",
"+ print((x % d))",
"- f... | false | 0.114024 | 0.035943 | 3.172321 | [
"s356470615",
"s068324877"
] |
u586857375 | p02712 | python | s138800018 | s938210618 | 316 | 112 | 48,672 | 30,020 | Accepted | Accepted | 64.56 | N = int(eval(input()))
FizzBuzz = []
Fizz = []
Buzz = []
ano = []
plus = 0
for i in range(N+1):
if i % 3 == 0 and i % 5 == 0:
FizzBuzz.append(i)
elif i % 3 == 0:
Fizz.append(i)
elif i % 5 == 0:
Buzz.append(i)
else:
ano.append(i)
for a in ano:
plus += a... | N = int(eval(input()))
none_num = [i for i in range(1, N+1) if i%3 != 0 and i%5 != 0]
none = sum(none_num)
print(none) | 19 | 4 | 329 | 115 | N = int(eval(input()))
FizzBuzz = []
Fizz = []
Buzz = []
ano = []
plus = 0
for i in range(N + 1):
if i % 3 == 0 and i % 5 == 0:
FizzBuzz.append(i)
elif i % 3 == 0:
Fizz.append(i)
elif i % 5 == 0:
Buzz.append(i)
else:
ano.append(i)
for a in ano:
plus += a
print(plus)
| N = int(eval(input()))
none_num = [i for i in range(1, N + 1) if i % 3 != 0 and i % 5 != 0]
none = sum(none_num)
print(none)
| false | 78.947368 | [
"-FizzBuzz = []",
"-Fizz = []",
"-Buzz = []",
"-ano = []",
"-plus = 0",
"-for i in range(N + 1):",
"- if i % 3 == 0 and i % 5 == 0:",
"- FizzBuzz.append(i)",
"- elif i % 3 == 0:",
"- Fizz.append(i)",
"- elif i % 5 == 0:",
"- Buzz.append(i)",
"- else:",
"- ... | false | 0.345071 | 0.239678 | 1.439727 | [
"s138800018",
"s938210618"
] |
u850516963 | p03469 | python | s705047753 | s513646994 | 30 | 27 | 8,900 | 9,020 | Accepted | Accepted | 10 | s = input()
s = list(s)
s[3] = '8'
print(*s, sep="")
| s = eval(input())
print(("2018/01/"+s[-2:])) | 4 | 2 | 55 | 37 | s = input()
s = list(s)
s[3] = "8"
print(*s, sep="")
| s = eval(input())
print(("2018/01/" + s[-2:]))
| false | 50 | [
"-s = input()",
"-s = list(s)",
"-s[3] = \"8\"",
"-print(*s, sep=\"\")",
"+s = eval(input())",
"+print((\"2018/01/\" + s[-2:]))"
] | false | 0.036947 | 0.038483 | 0.960094 | [
"s705047753",
"s513646994"
] |
u968166680 | p02913 | python | s500974903 | s104646162 | 411 | 234 | 270,136 | 73,240 | Accepted | Accepted | 43.07 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N = int(readline())
S = readline().strip()
dp = [[0] * (N + 1) for _ in range(N + 1)]
ans = 0
for i in range(... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N = int(readline())
S = readline().strip()
dp = [0] * (N + 1)
ans = 0
for i in range(N - 1, -1, -1):
... | 30 | 29 | 612 | 561 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N = int(readline())
S = readline().strip()
dp = [[0] * (N + 1) for _ in range(N + 1)]
ans = 0
for i in range(N - 1, -1, -1):
... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N = int(readline())
S = readline().strip()
dp = [0] * (N + 1)
ans = 0
for i in range(N - 1, -1, -1):
for j in range(i + 1,... | false | 3.333333 | [
"- dp = [[0] * (N + 1) for _ in range(N + 1)]",
"+ dp = [0] * (N + 1)",
"- if S[i] == S[j]:",
"- dp[i][j] = dp[i + 1][j + 1] + 1",
"- if ans < min(dp[i][j], j - i):",
"- ans = min(dp[i][j], j - i)",
"+ dp[j] = dp[j + 1] + 1 if S[i] == ... | false | 0.046311 | 0.153369 | 0.30196 | [
"s500974903",
"s104646162"
] |
u150984829 | p00447 | python | s725867474 | s545461242 | 960 | 90 | 5,896 | 6,052 | Accepted | Accepted | 90.62 | for e in iter(input,'0'):
a=[list(map(int,input().split())) for _ in range(int(e))]
s,t=a[0]
b=[list(map(int,input().split())) for _ in range(int(eval(input())))]
for x,y in b:
flag = True
for u,v in a[1:]:
if [x + u - s, y + v - t] not in b:
flag = False
break
if flag == True:
print(... | for e in iter(input,'0'):
a=list(tuple(map(int,input().split())) for _ in range(int(e)))
s,t=a[0]
b={tuple(map(int,input().split())) for _ in range(int(eval(input())))}
for x,y in b:
flag = True
for u,v in a[1:]:
if(x+u-s,y+v-t)not in b:
flag = False
break
if flag == True:
print((x - ... | 13 | 13 | 338 | 333 | for e in iter(input, "0"):
a = [list(map(int, input().split())) for _ in range(int(e))]
s, t = a[0]
b = [list(map(int, input().split())) for _ in range(int(eval(input())))]
for x, y in b:
flag = True
for u, v in a[1:]:
if [x + u - s, y + v - t] not in b:
flag ... | for e in iter(input, "0"):
a = list(tuple(map(int, input().split())) for _ in range(int(e)))
s, t = a[0]
b = {tuple(map(int, input().split())) for _ in range(int(eval(input())))}
for x, y in b:
flag = True
for u, v in a[1:]:
if (x + u - s, y + v - t) not in b:
... | false | 0 | [
"- a = [list(map(int, input().split())) for _ in range(int(e))]",
"+ a = list(tuple(map(int, input().split())) for _ in range(int(e)))",
"- b = [list(map(int, input().split())) for _ in range(int(eval(input())))]",
"+ b = {tuple(map(int, input().split())) for _ in range(int(eval(input())))}",
"-... | false | 0.044055 | 0.06565 | 0.671065 | [
"s725867474",
"s545461242"
] |
u285022453 | p03752 | python | s698826070 | s283308275 | 254 | 166 | 3,064 | 9,088 | Accepted | Accepted | 34.65 | n, k = list(map(int, input().split()))
buildings = list(map(int, input().split()))
ans = float('inf')
for i in range(2 ** n):
res = 0
cnt = 0
prev_build = buildings[0]
for j in range(n):
if (i >> j) & 1 == 1:
cnt += 1
if prev_build >= buildings[j] and not j ==... | n, k = list(map(int, input().split()))
buildings = list(map(int, input().split()))
ans = float('inf')
for i in range(2 ** n):
res = 0
cnt = 1
prev_build = buildings[0]
# 高くするビルをbitで管理
for j in range(1, n):
if (i >> j) & 1:
cnt += 1
if prev_build >= buildi... | 24 | 26 | 646 | 661 | n, k = list(map(int, input().split()))
buildings = list(map(int, input().split()))
ans = float("inf")
for i in range(2**n):
res = 0
cnt = 0
prev_build = buildings[0]
for j in range(n):
if (i >> j) & 1 == 1:
cnt += 1
if prev_build >= buildings[j] and not j == 0:
... | n, k = list(map(int, input().split()))
buildings = list(map(int, input().split()))
ans = float("inf")
for i in range(2**n):
res = 0
cnt = 1
prev_build = buildings[0]
# 高くするビルをbitで管理
for j in range(1, n):
if (i >> j) & 1:
cnt += 1
if prev_build >= buildings[j]:
... | false | 7.692308 | [
"- cnt = 0",
"+ cnt = 1",
"- for j in range(n):",
"- if (i >> j) & 1 == 1:",
"+ # 高くするビルをbitで管理",
"+ for j in range(1, n):",
"+ if (i >> j) & 1:",
"- if prev_build >= buildings[j] and not j == 0:",
"- res += (prev_build + 1) - buildings[j]",
"... | false | 0.169177 | 0.059155 | 2.859921 | [
"s698826070",
"s283308275"
] |
u844646164 | p03722 | python | s116657948 | s355509390 | 465 | 325 | 3,316 | 45,800 | Accepted | Accepted | 30.11 |
n, m = list(map(int, input().split()))
abc = []
for _ in range(m):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
c *= -1
abc += [[a,b,c]]
def bellman_ford(s):
# std = [[s0, t0, d0], [s1, t1, d1], ... , [sm, tm, dm]]
# (si, ti, di): si, ti間に重さdiの辺がある
dist = [float('inf')]*n
d... | n, m = list(map(int, input().split()))
std = []
for _ in range(m):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
std += [[a, b, -c]]
def bellman_ford(s):
# std = [[s0, t0, d0], [s1, t1, d1], ... , [sm, tm, dm]]
# (si, ti, di): si, ti間に重さdiの辺がある
dist = [float('inf')]*n
dist[s] = 0... | 29 | 26 | 591 | 576 | n, m = list(map(int, input().split()))
abc = []
for _ in range(m):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
c *= -1
abc += [[a, b, c]]
def bellman_ford(s):
# std = [[s0, t0, d0], [s1, t1, d1], ... , [sm, tm, dm]]
# (si, ti, di): si, ti間に重さdiの辺がある
dist = [float("inf")] * ... | n, m = list(map(int, input().split()))
std = []
for _ in range(m):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
std += [[a, b, -c]]
def bellman_ford(s):
# std = [[s0, t0, d0], [s1, t1, d1], ... , [sm, tm, dm]]
# (si, ti, di): si, ti間に重さdiの辺がある
dist = [float("inf")] * n
dist[... | false | 10.344828 | [
"-abc = []",
"+std = []",
"- c *= -1",
"- abc += [[a, b, c]]",
"+ std += [[a, b, -c]]",
"- for s, t, d in abc:",
"+ for s, t, d in std:",
"-if dist == -1:",
"+if dist != -1:",
"+ print((-dist[n - 1]))",
"+else:",
"-else:",
"- print((-1 * dist[n - 1]))"
] | false | 0.0442 | 0.068673 | 0.64364 | [
"s116657948",
"s355509390"
] |
u699296734 | p02994 | python | s664803895 | s260321704 | 31 | 24 | 9,208 | 9,192 | Accepted | Accepted | 22.58 | n ,l = list(map(int, input().split()))
apple = []
for i in range(n):
apple.append(l + i)
min_num = 10 ** 5
sum_num = sum(apple)
for i in range(n):
tmp = abs(sum_num - (sum_num - apple[i]))
if tmp < min_num:
min_num = min(tmp, min_num)
flag = apple[i]
if flag >= 0:
print((... | n ,l = list(map(int, input().split()))
apple = []
for i in range(n):
apple.append(l + i)
min_num = 10 ** 5
sum_num = sum(apple)
ans = 0
for i in range(n):
tmp = abs(sum_num - (sum_num - apple[i]))
if tmp < min_num:
min_num = min(tmp, min_num)
flag = apple[i]
ans = sum_n... | 17 | 16 | 374 | 341 | n, l = list(map(int, input().split()))
apple = []
for i in range(n):
apple.append(l + i)
min_num = 10**5
sum_num = sum(apple)
for i in range(n):
tmp = abs(sum_num - (sum_num - apple[i]))
if tmp < min_num:
min_num = min(tmp, min_num)
flag = apple[i]
if flag >= 0:
print((sum(apple) - min_n... | n, l = list(map(int, input().split()))
apple = []
for i in range(n):
apple.append(l + i)
min_num = 10**5
sum_num = sum(apple)
ans = 0
for i in range(n):
tmp = abs(sum_num - (sum_num - apple[i]))
if tmp < min_num:
min_num = min(tmp, min_num)
flag = apple[i]
ans = sum_num - apple[i]
pr... | false | 5.882353 | [
"+ans = 0",
"-if flag >= 0:",
"- print((sum(apple) - min_num))",
"-else:",
"- print((sum(apple) + min_num))",
"+ ans = sum_num - apple[i]",
"+print(ans)"
] | false | 0.065434 | 0.034972 | 1.871053 | [
"s664803895",
"s260321704"
] |
u677121387 | p03645 | python | s321762151 | s340633484 | 687 | 611 | 45,456 | 24,176 | Accepted | Accepted | 11.06 | n,m = list(map(int,input().split()))
s = [[int(i) for i in input().split()] for i in range(m)]
d = {}
for i in range(m):
if s[i][0] == 1:
d[s[i][1]] = 1
for i in range(m):
if s[i][1] == n and s[i][0] in d:
print("POSSIBLE")
exit()
print("IMPOSSIBLE") | n,m = list(map(int,input().split()))
d1 = {}
d2 = {}
for i in range(m):
a,b = list(map(int,input().split()))
if a == 1: d1[b] = 1
if b == n: d2[a] = 1
for k in d1:
if k in d2:
ans = "POSSIBLE"
break
else:
ans = "IMPOSSIBLE"
print(ans) | 14 | 16 | 296 | 276 | n, m = list(map(int, input().split()))
s = [[int(i) for i in input().split()] for i in range(m)]
d = {}
for i in range(m):
if s[i][0] == 1:
d[s[i][1]] = 1
for i in range(m):
if s[i][1] == n and s[i][0] in d:
print("POSSIBLE")
exit()
print("IMPOSSIBLE")
| n, m = list(map(int, input().split()))
d1 = {}
d2 = {}
for i in range(m):
a, b = list(map(int, input().split()))
if a == 1:
d1[b] = 1
if b == n:
d2[a] = 1
for k in d1:
if k in d2:
ans = "POSSIBLE"
break
else:
ans = "IMPOSSIBLE"
print(ans)
| false | 12.5 | [
"-s = [[int(i) for i in input().split()] for i in range(m)]",
"-d = {}",
"+d1 = {}",
"+d2 = {}",
"- if s[i][0] == 1:",
"- d[s[i][1]] = 1",
"-for i in range(m):",
"- if s[i][1] == n and s[i][0] in d:",
"- print(\"POSSIBLE\")",
"- exit()",
"-print(\"IMPOSSIBLE\")",
"+ ... | false | 0.038876 | 0.03985 | 0.975554 | [
"s321762151",
"s340633484"
] |
u254871849 | p04045 | python | s445441797 | s973325174 | 33 | 25 | 3,956 | 3,772 | Accepted | Accepted | 24.24 | import sys
from string import digits
n, k, *d = sys.stdin.read().split()
d = set(digits) - set(d)
l = len(n)
def main(d):
res = ''
flag = True
for i in range(l):
if flag:
if n[i] in d:
res += n[i]
else:
flag = False
... | import sys
from string import digits
n, k, *d = sys.stdin.read().split()
d = set(digits) - set(d)
l = len(n)
def main(d):
res = ''
flag = True
for i in range(l):
if flag:
if n[i] in d:
res += n[i]
else:
flag = False
... | 33 | 34 | 742 | 764 | import sys
from string import digits
n, k, *d = sys.stdin.read().split()
d = set(digits) - set(d)
l = len(n)
def main(d):
res = ""
flag = True
for i in range(l):
if flag:
if n[i] in d:
res += n[i]
else:
flag = False
for j in ... | import sys
from string import digits
n, k, *d = sys.stdin.read().split()
d = set(digits) - set(d)
l = len(n)
def main(d):
res = ""
flag = True
for i in range(l):
if flag:
if n[i] in d:
res += n[i]
else:
flag = False
for j in ... | false | 2.941176 | [
"- if str(j) in d:",
"- res += str(j)",
"+ j = str(j)",
"+ if j in d:",
"+ res += j"
] | false | 0.04583 | 0.042759 | 1.071818 | [
"s445441797",
"s973325174"
] |
u388927326 | p03476 | python | s846619695 | s216173822 | 807 | 254 | 7,960 | 8,412 | Accepted | Accepted | 68.53 | #!/usr/bin/env python3
def main():
is_prime = sieve(10 ** 5 + 1)
is_like2017 = [(is_prime[i] and is_prime[(i + 1) // 2]) for i in range(10 ** 5 + 1)]
counter = [0]
for i in range(1, 10 ** 5 + 1):
counter.append(counter[-1] + (1 if is_like2017[i] else 0))
q = int(eval(input()))
... | #!/usr/bin/env python3
import sys
def main():
is_prime = sieve(10 ** 5 + 1)
is_like2017 = [(is_prime[i] and is_prime[(i + 1) // 2]) for i in range(10 ** 5 + 1)]
counter = [0]
for i in range(1, 10 ** 5 + 1):
counter.append(counter[-1] + (1 if is_like2017[i] else 0))
q = int(eval... | 27 | 29 | 734 | 761 | #!/usr/bin/env python3
def main():
is_prime = sieve(10**5 + 1)
is_like2017 = [(is_prime[i] and is_prime[(i + 1) // 2]) for i in range(10**5 + 1)]
counter = [0]
for i in range(1, 10**5 + 1):
counter.append(counter[-1] + (1 if is_like2017[i] else 0))
q = int(eval(input()))
for i in range(q... | #!/usr/bin/env python3
import sys
def main():
is_prime = sieve(10**5 + 1)
is_like2017 = [(is_prime[i] and is_prime[(i + 1) // 2]) for i in range(10**5 + 1)]
counter = [0]
for i in range(1, 10**5 + 1):
counter.append(counter[-1] + (1 if is_like2017[i] else 0))
q = int(eval(input()))
for... | false | 6.896552 | [
"+import sys",
"+",
"+",
"- l, r = list(map(int, input().split()))",
"+ l, r = list(map(int, sys.stdin.readline().split()))"
] | false | 0.071568 | 0.096391 | 0.74247 | [
"s846619695",
"s216173822"
] |
u908763441 | p02579 | python | s154332973 | s242830262 | 908 | 730 | 171,628 | 132,984 | Accepted | Accepted | 19.6 | from collections import deque
h, w = list(map(int, input().split()))
Ch, Cw = list(map(int, input().split()))
Dh, Dw = list(map(int, input().split()))
Ch -= 1
Cw -= 1
Dh -= 1
Dw -= 1
t = [[i for i in range(w)] for j in range(h)]
visited = [[0 for i in range(w)] for j in range(h)] # いったところ
ans = 0
for i in ... | from collections import deque
h, w = list(map(int, input().split()))
Ch, Cw = list(map(int, input().split()))
Dh, Dw = list(map(int, input().split()))
Ch -= 1
Cw -= 1
Dh -= 1
Dw -= 1
visited = [[0 for i in range(w)] for j in range(h)] # いったところ
t = [list(eval(input())) for _ in range(h)]
d = deque([(Ch, Cw)]... | 50 | 45 | 1,197 | 1,092 | from collections import deque
h, w = list(map(int, input().split()))
Ch, Cw = list(map(int, input().split()))
Dh, Dw = list(map(int, input().split()))
Ch -= 1
Cw -= 1
Dh -= 1
Dw -= 1
t = [[i for i in range(w)] for j in range(h)]
visited = [[0 for i in range(w)] for j in range(h)] # いったところ
ans = 0
for i in range(h):
... | from collections import deque
h, w = list(map(int, input().split()))
Ch, Cw = list(map(int, input().split()))
Dh, Dw = list(map(int, input().split()))
Ch -= 1
Cw -= 1
Dh -= 1
Dw -= 1
visited = [[0 for i in range(w)] for j in range(h)] # いったところ
t = [list(eval(input())) for _ in range(h)]
d = deque([(Ch, Cw)])
d2 = deq... | false | 10 | [
"-t = [[i for i in range(w)] for j in range(h)]",
"-ans = 0",
"-for i in range(h):",
"- temp = eval(input())",
"- for j in range(w):",
"- t[i][j] = temp[j]",
"+t = [list(eval(input())) for _ in range(h)]",
"+d2 = deque()",
"+b = list(range(-2, 3))",
"- stemp = set()",
"- #... | false | 0.046868 | 0.043174 | 1.085554 | [
"s154332973",
"s242830262"
] |
u912237403 | p00029 | python | s775829446 | s884934121 | 20 | 10 | 4,212 | 4,204 | Accepted | Accepted | 50 | def f(A):
x = list(A.values())
c = x.index(max(x))
return list(A.keys())[c]
s = input().lower().split()
A={}
B={}
for w in s:
if w in A: A[w] += 1
else:
A[w] = 1
B[w] = len(w)
w1 = f(A)
w2 = f(B)
print(w1, w2) | s = input().split()
c1 = 0
c2 = 0
for w in set(s):
c=s.count(w)
if c>c1: c1,w1 = c,w
c=len(w)
if c>c2: c2,w2 = c,w
print(w1, w2) | 16 | 9 | 258 | 155 | def f(A):
x = list(A.values())
c = x.index(max(x))
return list(A.keys())[c]
s = input().lower().split()
A = {}
B = {}
for w in s:
if w in A:
A[w] += 1
else:
A[w] = 1
B[w] = len(w)
w1 = f(A)
w2 = f(B)
print(w1, w2)
| s = input().split()
c1 = 0
c2 = 0
for w in set(s):
c = s.count(w)
if c > c1:
c1, w1 = c, w
c = len(w)
if c > c2:
c2, w2 = c, w
print(w1, w2)
| false | 43.75 | [
"-def f(A):",
"- x = list(A.values())",
"- c = x.index(max(x))",
"- return list(A.keys())[c]",
"-",
"-",
"-s = input().lower().split()",
"-A = {}",
"-B = {}",
"-for w in s:",
"- if w in A:",
"- A[w] += 1",
"- else:",
"- A[w] = 1",
"- B[w] = len(w)",
... | false | 0.049106 | 0.117983 | 0.416215 | [
"s775829446",
"s884934121"
] |
u242031676 | p03324 | python | s987716975 | s625423391 | 20 | 17 | 2,940 | 3,064 | Accepted | Accepted | 15 | d, n = list(map(int, input().split()))
n+=(n>99)
print((n*100**d)) | d,n=list(map(int,input().split()));print((100**d*n if n!=100 else 100**d*101)) | 3 | 1 | 60 | 70 | d, n = list(map(int, input().split()))
n += n > 99
print((n * 100**d))
| d, n = list(map(int, input().split()))
print((100**d * n if n != 100 else 100**d * 101))
| false | 66.666667 | [
"-n += n > 99",
"-print((n * 100**d))",
"+print((100**d * n if n != 100 else 100**d * 101))"
] | false | 0.044274 | 0.045487 | 0.973319 | [
"s987716975",
"s625423391"
] |
u571345655 | p02258 | python | s262846760 | s804934325 | 1,530 | 150 | 4,200 | 21,560 | Accepted | Accepted | 90.2 | n = eval(input())
maxv = - 1 * pow(10, 9)
minv = eval(input())
for _ in range(1, n):
Rj = eval(input())
maxv = max(maxv, Rj - minv)
minv = min(minv, Rj)
print(maxv) | import sys
n = eval(input())
minv = eval(input())
maxv = - 1000000000
nums = list(map(int, sys.stdin.readlines()))
for num in nums:
maxv = num - minv if num - minv > maxv else maxv
minv = num if num < minv else minv
print(maxv) | 9 | 11 | 167 | 228 | n = eval(input())
maxv = -1 * pow(10, 9)
minv = eval(input())
for _ in range(1, n):
Rj = eval(input())
maxv = max(maxv, Rj - minv)
minv = min(minv, Rj)
print(maxv)
| import sys
n = eval(input())
minv = eval(input())
maxv = -1000000000
nums = list(map(int, sys.stdin.readlines()))
for num in nums:
maxv = num - minv if num - minv > maxv else maxv
minv = num if num < minv else minv
print(maxv)
| false | 18.181818 | [
"+import sys",
"+",
"-maxv = -1 * pow(10, 9)",
"-for _ in range(1, n):",
"- Rj = eval(input())",
"- maxv = max(maxv, Rj - minv)",
"- minv = min(minv, Rj)",
"+maxv = -1000000000",
"+nums = list(map(int, sys.stdin.readlines()))",
"+for num in nums:",
"+ maxv = num - minv if num - minv ... | false | 0.040199 | 0.039865 | 1.008387 | [
"s262846760",
"s804934325"
] |
u426649993 | p03038 | python | s250415477 | s898540123 | 706 | 608 | 64,556 | 54,088 | Accepted | Accepted | 13.88 | from collections import defaultdict
if __name__ == "__main__":
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
bc = [list(map(int, input().split())) for _ in range(m)]
card = defaultdict(int)
for aa in a:
card[aa] += 1
for c in bc:
card[c... | from collections import defaultdict
if __name__ == "__main__":
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
bc = [list(map(int, input().split())) for _ in range(m)]
card = defaultdict(int)
for aa in a:
card[aa] += 1
for task in bc:
car... | 27 | 27 | 619 | 598 | from collections import defaultdict
if __name__ == "__main__":
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
bc = [list(map(int, input().split())) for _ in range(m)]
card = defaultdict(int)
for aa in a:
card[aa] += 1
for c in bc:
card[c[1]] += c[0]
... | from collections import defaultdict
if __name__ == "__main__":
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
bc = [list(map(int, input().split())) for _ in range(m)]
card = defaultdict(int)
for aa in a:
card[aa] += 1
for task in bc:
card[task[1]] += ... | false | 0 | [
"- for c in bc:",
"- card[c[1]] += c[0]",
"- card_sort = sorted(list(card.items()), key=lambda x: x[0], reverse=True)",
"+ for task in bc:",
"+ card[task[1]] += task[0]",
"+ key = sorted(list(card.keys()), reverse=True)",
"+ res = n",
"- res = n",
"- for c in card_... | false | 0.121679 | 0.124962 | 0.973727 | [
"s250415477",
"s898540123"
] |
u809819902 | p02817 | python | s418057596 | s734768503 | 29 | 25 | 9,012 | 9,016 | Accepted | Accepted | 13.79 | s, t = input().split()
print((t + s))
| s=list(map(str, input().split()))
s.reverse()
print(("".join(s))) | 2 | 3 | 37 | 65 | s, t = input().split()
print((t + s))
| s = list(map(str, input().split()))
s.reverse()
print(("".join(s)))
| false | 33.333333 | [
"-s, t = input().split()",
"-print((t + s))",
"+s = list(map(str, input().split()))",
"+s.reverse()",
"+print((\"\".join(s)))"
] | false | 0.042291 | 0.071092 | 0.594875 | [
"s418057596",
"s734768503"
] |
u988402778 | p03504 | python | s054934209 | s045015288 | 1,638 | 833 | 123,388 | 178,424 | Accepted | Accepted | 49.15 | import sys
from itertools import accumulate
# functions used
r = lambda: sys.stdin.readline().strip() #single: int(r()), line: map(int, r().split())
R = lambda: list(map(int, r().split())) # line: R(), lines: [R() for _ in range(n)]
Rmap = lambda: list(map(int, r().split()))
# set inputs
N, C = R()
STC = [R()... | import sys
from itertools import accumulate
# functions used
r = lambda: sys.stdin.readline().strip() #single: int(r()), line: map(int, r().split())
R = lambda: list(map(int, r().split())) # line: R(), lines: [R() for _ in range(n)]
Rmap = lambda: list(map(int, r().split()))
# set inputs
N, C = R()
STC = [R()... | 41 | 47 | 1,056 | 1,206 | import sys
from itertools import accumulate
# functions used
r = (
lambda: sys.stdin.readline().strip()
) # single: int(r()), line: map(int, r().split())
R = lambda: list(map(int, r().split())) # line: R(), lines: [R() for _ in range(n)]
Rmap = lambda: list(map(int, r().split()))
# set inputs
N, C = R()
STC = [R... | import sys
from itertools import accumulate
# functions used
r = (
lambda: sys.stdin.readline().strip()
) # single: int(r()), line: map(int, r().split())
R = lambda: list(map(int, r().split())) # line: R(), lines: [R() for _ in range(n)]
Rmap = lambda: list(map(int, r().split()))
# set inputs
N, C = R()
STC = [R... | false | 12.765957 | [
"-# ans = max([sum(x) for x in zip(*tbl2)])",
"-# print(ans)",
"-res = 0",
"- cc = 0",
"- if tbl2[j][i] == 1:",
"- cc += 1",
"- res = max(res, cc)",
"-print(res)",
"+ if tbl2[j][i] == 2:",
"+ tbl2[j][i] = 1",
"+ans = max([sum(x) for x in zip(*tbl2)])",
... | false | 1.672017 | 0.634339 | 2.635841 | [
"s054934209",
"s045015288"
] |
u028973125 | p02922 | python | s616197298 | s047051697 | 175 | 28 | 38,256 | 9,180 | Accepted | Accepted | 84 | import sys
from pprint import pprint
def solve(a, b):
ans = 0
emp = 1
while emp < b:
emp += a - 1
ans += 1
print(ans)
if __name__ == '__main__':
a, b = list(map(int, sys.stdin.readline().strip().split(" ")))
solve(a, b)
| import sys
A, B = list(map(int, sys.stdin.readline().split()))
print(((B - A - 1) // (A-1) + 2)) | 14 | 4 | 265 | 92 | import sys
from pprint import pprint
def solve(a, b):
ans = 0
emp = 1
while emp < b:
emp += a - 1
ans += 1
print(ans)
if __name__ == "__main__":
a, b = list(map(int, sys.stdin.readline().strip().split(" ")))
solve(a, b)
| import sys
A, B = list(map(int, sys.stdin.readline().split()))
print(((B - A - 1) // (A - 1) + 2))
| false | 71.428571 | [
"-from pprint import pprint",
"-",
"-def solve(a, b):",
"- ans = 0",
"- emp = 1",
"- while emp < b:",
"- emp += a - 1",
"- ans += 1",
"- print(ans)",
"-",
"-",
"-if __name__ == \"__main__\":",
"- a, b = list(map(int, sys.stdin.readline().strip().split(\" \")))",
... | false | 0.040995 | 0.037219 | 1.101442 | [
"s616197298",
"s047051697"
] |
u790710233 | p03599 | python | s911459343 | s196370778 | 731 | 367 | 4,212 | 3,316 | Accepted | Accepted | 49.79 | A, B, C, D, E, F = list(map(int, input().split()))
items = []
for w in range(16):
for x in range(16):
if w == x == 0:
continue
for y in range(1501):
a = 100*A*w
b = 100*B*x
c = C*y
i = (F-(a+b+c))//D
for z in revers... | A, B, C, D, E, F = list(map(int, input().split()))
items = []
water = list(set([100*(A*w+B*x) for w in range(16)
for x in range(16) if A*w+B*x <= 30]))
water.sort()
for w in water:
for x in range(1501):
c = C*x
i = (F-w-c)//D
for y in reversed(list(range(i+1))):
... | 21 | 18 | 583 | 528 | A, B, C, D, E, F = list(map(int, input().split()))
items = []
for w in range(16):
for x in range(16):
if w == x == 0:
continue
for y in range(1501):
a = 100 * A * w
b = 100 * B * x
c = C * y
i = (F - (a + b + c)) // D
for z in r... | A, B, C, D, E, F = list(map(int, input().split()))
items = []
water = list(
set(
[
100 * (A * w + B * x)
for w in range(16)
for x in range(16)
if A * w + B * x <= 30
]
)
)
water.sort()
for w in water:
for x in range(1501):
c = C * x
... | false | 14.285714 | [
"-for w in range(16):",
"- for x in range(16):",
"- if w == x == 0:",
"- continue",
"- for y in range(1501):",
"- a = 100 * A * w",
"- b = 100 * B * x",
"- c = C * y",
"- i = (F - (a + b + c)) // D",
"- for z in rev... | false | 1.163435 | 0.499346 | 2.329917 | [
"s911459343",
"s196370778"
] |
u867848444 | p02787 | python | s633367695 | s049982906 | 1,533 | 219 | 46,300 | 73,824 | Accepted | Accepted | 85.71 | h, n = list(map(int,input().split()))
ab = [list(map(int,input().split())) for i in range(n)]
#(a,b):=(ダメージ,消費魔力)
dp = [float('inf')] * (h + 1)
dp[0] = 0
for i in range(h + 1):
for j in range(n):
if dp[i] == float('inf'):continue
temp_a = i + ab[j][0] if i + ab[j][0] < h else h
... | h,n=list(map(int,input().split()))
a,b=[],[]
for i in range(n):
A,B=list(map(int,input().split()))
a.append(A)#ダメージ量
b.append(B)#消費魔力
dp=[float('inf')]*(h+1)
dp[0]=0
for i in range(h):
for j in range(n):
next=i+a[j] if i+a[j]<=h else h
dp[next]=min(dp[next],dp[i]+b[j])
pr... | 17 | 15 | 416 | 320 | h, n = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(n)]
# (a,b):=(ダメージ,消費魔力)
dp = [float("inf")] * (h + 1)
dp[0] = 0
for i in range(h + 1):
for j in range(n):
if dp[i] == float("inf"):
continue
temp_a = i + ab[j][0] if i + ab[j][0] < h else h
... | h, n = list(map(int, input().split()))
a, b = [], []
for i in range(n):
A, B = list(map(int, input().split()))
a.append(A) # ダメージ量
b.append(B) # 消費魔力
dp = [float("inf")] * (h + 1)
dp[0] = 0
for i in range(h):
for j in range(n):
next = i + a[j] if i + a[j] <= h else h
dp[next] = min(dp[... | false | 11.764706 | [
"-ab = [list(map(int, input().split())) for i in range(n)]",
"-# (a,b):=(ダメージ,消費魔力)",
"+a, b = [], []",
"+for i in range(n):",
"+ A, B = list(map(int, input().split()))",
"+ a.append(A) # ダメージ量",
"+ b.append(B) # 消費魔力",
"-for i in range(h + 1):",
"+for i in range(h):",
"- if dp[i... | false | 0.130483 | 0.370811 | 0.351887 | [
"s633367695",
"s049982906"
] |
u575431498 | p02861 | python | s091455210 | s239088703 | 445 | 401 | 8,052 | 9,332 | Accepted | Accepted | 9.89 | import itertools
N = int(eval(input()))
x, y = [], []
for _ in range(N):
_x, _y = list(map(int, input().split()))
x.append(_x)
y.append(_y)
ans = 0
paths = list(itertools.permutations(list(range(N))))
for p in paths:
for i in range(N-1):
s = p[i]
d = p[i+1]
ans +... | from itertools import permutations
N = int(eval(input()))
x, y = [], []
for _ in range(N):
_x, _y = list(map(int, input().split()))
x.append(_x)
y.append(_y)
al = list(permutations(list(range(N))))
ttmp = []
for a in al:
tmp = 0
h = a[0]
for i in a[1:]:
tmp += ((x[h] - x... | 18 | 19 | 383 | 405 | import itertools
N = int(eval(input()))
x, y = [], []
for _ in range(N):
_x, _y = list(map(int, input().split()))
x.append(_x)
y.append(_y)
ans = 0
paths = list(itertools.permutations(list(range(N))))
for p in paths:
for i in range(N - 1):
s = p[i]
d = p[i + 1]
ans += ((x[s] - x... | from itertools import permutations
N = int(eval(input()))
x, y = [], []
for _ in range(N):
_x, _y = list(map(int, input().split()))
x.append(_x)
y.append(_y)
al = list(permutations(list(range(N))))
ttmp = []
for a in al:
tmp = 0
h = a[0]
for i in a[1:]:
tmp += ((x[h] - x[i]) ** 2 + (y[h... | false | 5.263158 | [
"-import itertools",
"+from itertools import permutations",
"-ans = 0",
"-paths = list(itertools.permutations(list(range(N))))",
"-for p in paths:",
"- for i in range(N - 1):",
"- s = p[i]",
"- d = p[i + 1]",
"- ans += ((x[s] - x[d]) ** 2 + (y[s] - y[d]) ** 2) ** 0.5",
"-an... | false | 0.044258 | 0.076921 | 0.575374 | [
"s091455210",
"s239088703"
] |
u317508154 | p03434 | python | s088526807 | s912905632 | 31 | 28 | 9,144 | 8,856 | Accepted | Accepted | 9.68 | n = int(eval(input()))
c = list(map(int,input().split()))
c.sort(reverse = True)
a = 0
b = 0
if n % 2 == 0:
for i in range(n // 2 ):
a += c[i * 2]
b += c[i * 2 + 1]
else:
for i in range(n // 2 ):
a += c[i * 2]
b += c[i * 2 + 1]
a += c[n - 1]
print((a - b)) | n = int(eval(input()))
data = list(map(int,input().split()))
data.sort(reverse = True)
print((sum(data[::2]) - sum(data[1::2]))) | 16 | 4 | 308 | 123 | n = int(eval(input()))
c = list(map(int, input().split()))
c.sort(reverse=True)
a = 0
b = 0
if n % 2 == 0:
for i in range(n // 2):
a += c[i * 2]
b += c[i * 2 + 1]
else:
for i in range(n // 2):
a += c[i * 2]
b += c[i * 2 + 1]
a += c[n - 1]
print((a - b))
| n = int(eval(input()))
data = list(map(int, input().split()))
data.sort(reverse=True)
print((sum(data[::2]) - sum(data[1::2])))
| false | 75 | [
"-c = list(map(int, input().split()))",
"-c.sort(reverse=True)",
"-a = 0",
"-b = 0",
"-if n % 2 == 0:",
"- for i in range(n // 2):",
"- a += c[i * 2]",
"- b += c[i * 2 + 1]",
"-else:",
"- for i in range(n // 2):",
"- a += c[i * 2]",
"- b += c[i * 2 + 1]",
"-... | false | 0.042708 | 0.03571 | 1.195955 | [
"s088526807",
"s912905632"
] |
u353895424 | p03325 | python | s577352815 | s954474488 | 194 | 81 | 40,688 | 4,148 | Accepted | Accepted | 58.25 | n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
"""
一番大きい偶数を2で割る
それ以外は3倍
を繰り返す
奇数だけになったら終了
↓
各項が2で何回われるか の合計
"""
for i in range(n):
cnt = 0
tmp = a[i]
while tmp % 2 == 0:
tmp = tmp // 2
cnt += 1
ans += cnt
print(ans) | from math import log2
n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for _a in a:
if _a%2 == 0:
cnt =0
while _a%2 == 0:
_a //= 2
cnt += 1
ans += cnt
print((int(ans))) | 19 | 14 | 279 | 245 | n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
"""
一番大きい偶数を2で割る
それ以外は3倍
を繰り返す
奇数だけになったら終了
↓
各項が2で何回われるか の合計
"""
for i in range(n):
cnt = 0
tmp = a[i]
while tmp % 2 == 0:
tmp = tmp // 2
cnt += 1
ans += cnt
print(ans)
| from math import log2
n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for _a in a:
if _a % 2 == 0:
cnt = 0
while _a % 2 == 0:
_a //= 2
cnt += 1
ans += cnt
print((int(ans)))
| false | 26.315789 | [
"+from math import log2",
"+",
"-\"\"\"",
"-一番大きい偶数を2で割る",
"-それ以外は3倍",
"-を繰り返す",
"-奇数だけになったら終了",
"-↓",
"-各項が2で何回われるか の合計",
"-\"\"\"",
"-for i in range(n):",
"- cnt = 0",
"- tmp = a[i]",
"- while tmp % 2 == 0:",
"- tmp = tmp // 2",
"- cnt += 1",
"- ans += cnt... | false | 0.035314 | 0.03527 | 1.001238 | [
"s577352815",
"s954474488"
] |
u268793453 | p03049 | python | s662937567 | s942856059 | 857 | 49 | 47,784 | 3,700 | Accepted | Accepted | 94.28 | n = int(eval(input()))
S = [eval(input()) for i in range(n)]
ans = 0
start_b = 0
end_a = 0
ab = 0
for i in range(n):
for j in range(len(S) - 1):
if S[i][j:j+2] == 'AB':
ans += 1
if S[i][0] == 'B' and S[i][-1] == 'A':
ab += 1
continue
if S[i][0] == 'B':... | n = int(eval(input()))
S = [eval(input()) for i in range(n)]
ans = 0
start_b = 0
end_a = 0
ab = 0
for i in range(n):
for j in range(len(S[i]) - 1):
if S[i][j:j+2] == 'AB':
ans += 1
if S[i][0] == 'B' and S[i][-1] == 'A':
ab += 1
continue
if S[i][0] == '... | 34 | 34 | 584 | 587 | n = int(eval(input()))
S = [eval(input()) for i in range(n)]
ans = 0
start_b = 0
end_a = 0
ab = 0
for i in range(n):
for j in range(len(S) - 1):
if S[i][j : j + 2] == "AB":
ans += 1
if S[i][0] == "B" and S[i][-1] == "A":
ab += 1
continue
if S[i][0] == "B":
start_b... | n = int(eval(input()))
S = [eval(input()) for i in range(n)]
ans = 0
start_b = 0
end_a = 0
ab = 0
for i in range(n):
for j in range(len(S[i]) - 1):
if S[i][j : j + 2] == "AB":
ans += 1
if S[i][0] == "B" and S[i][-1] == "A":
ab += 1
continue
if S[i][0] == "B":
star... | false | 0 | [
"- for j in range(len(S) - 1):",
"+ for j in range(len(S[i]) - 1):"
] | false | 0.065358 | 0.036018 | 1.814576 | [
"s662937567",
"s942856059"
] |
u744034042 | p02713 | python | s765363648 | s822158743 | 1,970 | 1,298 | 9,180 | 9,196 | Accepted | Accepted | 34.11 | from math import gcd
ans = 0
n = int(eval(input()))
for i in range(1,n+1):
for j in range(1,n+1):
for k in range(1,n+1):
l = gcd(i,j)
ans += gcd(k,l)
print(ans) | import math
ans = 0
n = int(eval(input()))
for i in range(1,n+1):
for j in range(1,n+1):
l = math.gcd(i,j)
for k in range(1,n+1):
ans += math.gcd(k,l)
print(ans) | 10 | 10 | 200 | 197 | from math import gcd
ans = 0
n = int(eval(input()))
for i in range(1, n + 1):
for j in range(1, n + 1):
for k in range(1, n + 1):
l = gcd(i, j)
ans += gcd(k, l)
print(ans)
| import math
ans = 0
n = int(eval(input()))
for i in range(1, n + 1):
for j in range(1, n + 1):
l = math.gcd(i, j)
for k in range(1, n + 1):
ans += math.gcd(k, l)
print(ans)
| false | 0 | [
"-from math import gcd",
"+import math",
"+ l = math.gcd(i, j)",
"- l = gcd(i, j)",
"- ans += gcd(k, l)",
"+ ans += math.gcd(k, l)"
] | false | 0.207986 | 0.161823 | 1.285272 | [
"s765363648",
"s822158743"
] |
u150749188 | p02713 | python | s330526716 | s554505086 | 744 | 669 | 111,332 | 110,144 | Accepted | Accepted | 10.08 | import math
from numba import jit
k = int(eval(input()))
@jit
def ans():
sum = 0
for l in range(1,k+1):
for m in range(1,k+1):
for n in range(1,k+1):
sum += math.gcd(math.gcd(l,m),n)
return(sum)
print((ans())) | import math
from numba import jit
k = int(eval(input()))
@jit
def ans():
sum = 0
temp = 0
for l in range(1,k+1):
for m in range(1,k+1):
temp = math.gcd(l,m)
for n in range(1,k+1):
sum += math.gcd(temp,n)
return(sum)
print((ans())) | 14 | 16 | 264 | 303 | import math
from numba import jit
k = int(eval(input()))
@jit
def ans():
sum = 0
for l in range(1, k + 1):
for m in range(1, k + 1):
for n in range(1, k + 1):
sum += math.gcd(math.gcd(l, m), n)
return sum
print((ans()))
| import math
from numba import jit
k = int(eval(input()))
@jit
def ans():
sum = 0
temp = 0
for l in range(1, k + 1):
for m in range(1, k + 1):
temp = math.gcd(l, m)
for n in range(1, k + 1):
sum += math.gcd(temp, n)
return sum
print((ans()))
| false | 12.5 | [
"+ temp = 0",
"+ temp = math.gcd(l, m)",
"- sum += math.gcd(math.gcd(l, m), n)",
"+ sum += math.gcd(temp, n)"
] | false | 0.07065 | 0.05549 | 1.273221 | [
"s330526716",
"s554505086"
] |
u673361376 | p03087 | python | s779715713 | s673801528 | 1,069 | 920 | 51,104 | 6,304 | Accepted | Accepted | 13.94 | N,Q = list(map(int,input().split()))
S = eval(input())
S_nums = [0 for _ in range(N+2)]
for idx in range(N):
if S[idx-1:idx+1] == 'AC': S_nums[idx+1] = S_nums[idx] + 1
else: S_nums[idx+1] = S_nums[idx]
for _ in range(Q):
l,r = list(map(int, input().split()))
print((S_nums[r]-S_nums[l])) | N, Q = list(map(int, input().split()))
S = '0' + eval(input())
acm_cntAC = [0 for _ in range(N+1)]
for i in range(1, N+1):
if S[i-1:i+1] == 'AC':
acm_cntAC[i] = acm_cntAC[i-1] + 1
else:
acm_cntAC[i] = acm_cntAC[i - 1]
for _ in range(Q):
l, r = list(map(int, input().split()))
... | 10 | 15 | 285 | 434 | N, Q = list(map(int, input().split()))
S = eval(input())
S_nums = [0 for _ in range(N + 2)]
for idx in range(N):
if S[idx - 1 : idx + 1] == "AC":
S_nums[idx + 1] = S_nums[idx] + 1
else:
S_nums[idx + 1] = S_nums[idx]
for _ in range(Q):
l, r = list(map(int, input().split()))
print((S_nums[... | N, Q = list(map(int, input().split()))
S = "0" + eval(input())
acm_cntAC = [0 for _ in range(N + 1)]
for i in range(1, N + 1):
if S[i - 1 : i + 1] == "AC":
acm_cntAC[i] = acm_cntAC[i - 1] + 1
else:
acm_cntAC[i] = acm_cntAC[i - 1]
for _ in range(Q):
l, r = list(map(int, input().split()))
... | false | 33.333333 | [
"-S = eval(input())",
"-S_nums = [0 for _ in range(N + 2)]",
"-for idx in range(N):",
"- if S[idx - 1 : idx + 1] == \"AC\":",
"- S_nums[idx + 1] = S_nums[idx] + 1",
"+S = \"0\" + eval(input())",
"+acm_cntAC = [0 for _ in range(N + 1)]",
"+for i in range(1, N + 1):",
"+ if S[i - 1 : i + ... | false | 0.078051 | 0.064783 | 1.204811 | [
"s779715713",
"s673801528"
] |
u597374218 | p02987 | python | s924957498 | s224896693 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | from collections import Counter
S=Counter(eval(input()))
print(("Yes" if len(S)==2 and len(set(list(S.values())))==1 else "No")) | S=eval(input())
s=list(set(S))
print(("Yes" if len(s)==2 and S.count(s[0])==S.count(s[1])==2 else "No")) | 3 | 3 | 122 | 98 | from collections import Counter
S = Counter(eval(input()))
print(("Yes" if len(S) == 2 and len(set(list(S.values()))) == 1 else "No"))
| S = eval(input())
s = list(set(S))
print(("Yes" if len(s) == 2 and S.count(s[0]) == S.count(s[1]) == 2 else "No"))
| false | 0 | [
"-from collections import Counter",
"-",
"-S = Counter(eval(input()))",
"-print((\"Yes\" if len(S) == 2 and len(set(list(S.values()))) == 1 else \"No\"))",
"+S = eval(input())",
"+s = list(set(S))",
"+print((\"Yes\" if len(s) == 2 and S.count(s[0]) == S.count(s[1]) == 2 else \"No\"))"
] | false | 0.066214 | 0.053839 | 1.22986 | [
"s924957498",
"s224896693"
] |
u002459665 | p02802 | python | s752219119 | s351995639 | 449 | 343 | 32,636 | 32,160 | Accepted | Accepted | 23.61 | N, M = list(map(int, input().split()))
PM = []
for i in range(M):
p, s = input().split()
PM.append([int(p), s])
PM.sort(key=lambda x:x[0])
# print(PM)
aw = []
for i in range(N+10):
aw.append([0,0])
a_cnt = 0
w_cnt = 0
for p, m in PM:
if aw[p][0] == 1:
pass
elif m == 'W... | N, M = list(map(int, input().split()))
PS = []
for i in range(M):
p, s = input().split()
PS.append([int(p), s])
a_w = []
for i in range(N+1):
a_w.append([False, 0])
for p, s in PS:
if s == 'AC':
a_w[p][0] = True
else:
if not a_w[p][0]:
a_w[p][1] += 1
a... | 29 | 24 | 485 | 423 | N, M = list(map(int, input().split()))
PM = []
for i in range(M):
p, s = input().split()
PM.append([int(p), s])
PM.sort(key=lambda x: x[0])
# print(PM)
aw = []
for i in range(N + 10):
aw.append([0, 0])
a_cnt = 0
w_cnt = 0
for p, m in PM:
if aw[p][0] == 1:
pass
elif m == "WA":
aw[p][1... | N, M = list(map(int, input().split()))
PS = []
for i in range(M):
p, s = input().split()
PS.append([int(p), s])
a_w = []
for i in range(N + 1):
a_w.append([False, 0])
for p, s in PS:
if s == "AC":
a_w[p][0] = True
else:
if not a_w[p][0]:
a_w[p][1] += 1
a_cnt = 0
w_cnt = 0... | false | 17.241379 | [
"-PM = []",
"+PS = []",
"- PM.append([int(p), s])",
"-PM.sort(key=lambda x: x[0])",
"-# print(PM)",
"-aw = []",
"-for i in range(N + 10):",
"- aw.append([0, 0])",
"+ PS.append([int(p), s])",
"+a_w = []",
"+for i in range(N + 1):",
"+ a_w.append([False, 0])",
"+for p, s in PS:",
... | false | 0.045393 | 0.045962 | 0.98762 | [
"s752219119",
"s351995639"
] |
u241159583 | p02953 | python | s786310197 | s318914043 | 84 | 77 | 14,252 | 14,396 | Accepted | Accepted | 8.33 | N = int(eval(input()))
H = [int(x) for x in input().split()]
ans = "Yes"
for i in range(1, N):
if H[-(i + 1)] <= H[-i]:
continue
elif H[-(i + 1)] - 1 <= H[-i]:
H[-(i + 1)] -= 1
else:
ans = "No"
break
print(ans) | n = int(eval(input()))
h = list(map(int, input().split()))[::-1]
for i in range(1, n):
if h[i-1] >= h[i]: continue
if h[i-1] == h[i]-1:h[i] -= 1
else:
print("No")
exit()
print("Yes") | 13 | 9 | 239 | 198 | N = int(eval(input()))
H = [int(x) for x in input().split()]
ans = "Yes"
for i in range(1, N):
if H[-(i + 1)] <= H[-i]:
continue
elif H[-(i + 1)] - 1 <= H[-i]:
H[-(i + 1)] -= 1
else:
ans = "No"
break
print(ans)
| n = int(eval(input()))
h = list(map(int, input().split()))[::-1]
for i in range(1, n):
if h[i - 1] >= h[i]:
continue
if h[i - 1] == h[i] - 1:
h[i] -= 1
else:
print("No")
exit()
print("Yes")
| false | 30.769231 | [
"-N = int(eval(input()))",
"-H = [int(x) for x in input().split()]",
"-ans = \"Yes\"",
"-for i in range(1, N):",
"- if H[-(i + 1)] <= H[-i]:",
"+n = int(eval(input()))",
"+h = list(map(int, input().split()))[::-1]",
"+for i in range(1, n):",
"+ if h[i - 1] >= h[i]:",
"- elif H[-(i + 1)] -... | false | 0.042948 | 0.179699 | 0.239002 | [
"s786310197",
"s318914043"
] |
u112364985 | p03720 | python | s776450823 | s288999809 | 217 | 200 | 42,096 | 41,712 | Accepted | Accepted | 7.83 | n,m=list(map(int,input().split()))
List=[]
for i in range(m):
road=list(map(int,input().split()))
List.append(road)
road=[road[1],road[0]]
List.append(road)
ans=0
for i in range(1,n+1):
for j in range(len(List)):
if i==List[j][0]:
ans+=1
print(ans)
ans=0
| n,m=list(map(int,input().split()))
List=[]
for i in range(m):
a,b=list(map(int,input().split()))
List.append([a,b])
List.append([b,a])
ans=0
for i in range(1,n+1):
for j in range(len(List)):
if i==List[j][0]:
ans+=1
print(ans)
ans=0 | 14 | 13 | 310 | 276 | n, m = list(map(int, input().split()))
List = []
for i in range(m):
road = list(map(int, input().split()))
List.append(road)
road = [road[1], road[0]]
List.append(road)
ans = 0
for i in range(1, n + 1):
for j in range(len(List)):
if i == List[j][0]:
ans += 1
print(ans)
an... | n, m = list(map(int, input().split()))
List = []
for i in range(m):
a, b = list(map(int, input().split()))
List.append([a, b])
List.append([b, a])
ans = 0
for i in range(1, n + 1):
for j in range(len(List)):
if i == List[j][0]:
ans += 1
print(ans)
ans = 0
| false | 7.142857 | [
"- road = list(map(int, input().split()))",
"- List.append(road)",
"- road = [road[1], road[0]]",
"- List.append(road)",
"+ a, b = list(map(int, input().split()))",
"+ List.append([a, b])",
"+ List.append([b, a])"
] | false | 0.044292 | 0.046817 | 0.94605 | [
"s776450823",
"s288999809"
] |
u861141787 | p02720 | python | s672189268 | s664561902 | 132 | 109 | 11,028 | 11,956 | Accepted | Accepted | 17.42 | # 解説放送
k = int(eval(input()))
a = [i+1 for i in range(9)]
while 1:
if k <= len(a):
print((a[k-1]))
exit()
k -= len(a)
old = []
a, old = old, a
for x in old:
for i in range(-1, 2):
d = x % 10 + i
if d < 0 or d > 9: continue
... | # 解説PDF
from collections import deque
k = int(eval(input()))
que = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])
for i in range(k-1):
x = que.popleft()
y = x % 10
if y != 0:
que.append(10*x+y-1)
que.append(10*x+y)
if y != 9:
que.append(10*x+y+1)
ans = que.popleft()
print(... | 18 | 18 | 352 | 318 | # 解説放送
k = int(eval(input()))
a = [i + 1 for i in range(9)]
while 1:
if k <= len(a):
print((a[k - 1]))
exit()
k -= len(a)
old = []
a, old = old, a
for x in old:
for i in range(-1, 2):
d = x % 10 + i
if d < 0 or d > 9:
continue
... | # 解説PDF
from collections import deque
k = int(eval(input()))
que = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])
for i in range(k - 1):
x = que.popleft()
y = x % 10
if y != 0:
que.append(10 * x + y - 1)
que.append(10 * x + y)
if y != 9:
que.append(10 * x + y + 1)
ans = que.popleft()
print(ans)... | false | 0 | [
"-# 解説放送",
"+# 解説PDF",
"+from collections import deque",
"+",
"-a = [i + 1 for i in range(9)]",
"-while 1:",
"- if k <= len(a):",
"- print((a[k - 1]))",
"- exit()",
"- k -= len(a)",
"- old = []",
"- a, old = old, a",
"- for x in old:",
"- for i in range(... | false | 0.052844 | 0.051294 | 1.030234 | [
"s672189268",
"s664561902"
] |
u572561929 | p03673 | python | s069522500 | s556534505 | 275 | 163 | 26,180 | 26,180 | Accepted | Accepted | 40.73 | n = int(eval(input()))
a = list(map(int, input().split()))
ans = [0 for _ in range(n)]
for i in range(n):
if n % 2 == 1:
x = (n - 1) // 2
if i % 2 == 0:
ans[x - (i // 2)] = a[i]
else:
ans[x + ((i + 1) // 2)] = a[i]
else:
x = n // 2
if i... | n = int(eval(input()))
a = list(map(int, input().split()))
if n % 2 == 0:
ans = a[-1::-2] + a[0::2]
else:
ans = a[-1::-2] + a[1::2]
print((*ans))
| 17 | 7 | 435 | 152 | n = int(eval(input()))
a = list(map(int, input().split()))
ans = [0 for _ in range(n)]
for i in range(n):
if n % 2 == 1:
x = (n - 1) // 2
if i % 2 == 0:
ans[x - (i // 2)] = a[i]
else:
ans[x + ((i + 1) // 2)] = a[i]
else:
x = n // 2
if i % 2 == 0:
... | n = int(eval(input()))
a = list(map(int, input().split()))
if n % 2 == 0:
ans = a[-1::-2] + a[0::2]
else:
ans = a[-1::-2] + a[1::2]
print((*ans))
| false | 58.823529 | [
"-ans = [0 for _ in range(n)]",
"-for i in range(n):",
"- if n % 2 == 1:",
"- x = (n - 1) // 2",
"- if i % 2 == 0:",
"- ans[x - (i // 2)] = a[i]",
"- else:",
"- ans[x + ((i + 1) // 2)] = a[i]",
"- else:",
"- x = n // 2",
"- if i % 2 ... | false | 0.070071 | 0.03912 | 1.791198 | [
"s069522500",
"s556534505"
] |
u046187684 | p03401 | python | s971446899 | s709882803 | 147 | 120 | 17,468 | 20,104 | Accepted | Accepted | 18.37 | def solve(string):
n, *a = list(map(int, string.split()))
a = [0] + a + [0]
base = sum([abs(j - i) for i, j in zip(a, a[1:])])
ans = []
for a0, a1, a2 in zip(a, a[1:], a[2:]):
if min(a0, a1, a2) == a1:
ans.append(str(base - 2 * abs(a1 - min(a0, a2))))
elif max(a0,... | def solve(string):
n, *a = list(map(int, string.split()))
a = [0] + a + [0]
diff = [abs(j - i) for i, j in zip(a, a[1:])]
base = sum(diff)
ans = [str(base - diff[i] - diff[i + 1] + abs(a[i + 2] - a[i])) for i in range(n)]
return "\n".join(ans)
if __name__ == '__main__':
print((so... | 17 | 11 | 551 | 349 | def solve(string):
n, *a = list(map(int, string.split()))
a = [0] + a + [0]
base = sum([abs(j - i) for i, j in zip(a, a[1:])])
ans = []
for a0, a1, a2 in zip(a, a[1:], a[2:]):
if min(a0, a1, a2) == a1:
ans.append(str(base - 2 * abs(a1 - min(a0, a2))))
elif max(a0, a1, a2)... | def solve(string):
n, *a = list(map(int, string.split()))
a = [0] + a + [0]
diff = [abs(j - i) for i, j in zip(a, a[1:])]
base = sum(diff)
ans = [str(base - diff[i] - diff[i + 1] + abs(a[i + 2] - a[i])) for i in range(n)]
return "\n".join(ans)
if __name__ == "__main__":
print((solve("\n".j... | false | 35.294118 | [
"- base = sum([abs(j - i) for i, j in zip(a, a[1:])])",
"- ans = []",
"- for a0, a1, a2 in zip(a, a[1:], a[2:]):",
"- if min(a0, a1, a2) == a1:",
"- ans.append(str(base - 2 * abs(a1 - min(a0, a2))))",
"- elif max(a0, a1, a2) == a1:",
"- ans.append(str(base - ... | false | 0.042063 | 0.039893 | 1.054376 | [
"s971446899",
"s709882803"
] |
u361381049 | p03213 | python | s652982523 | s969554178 | 70 | 64 | 66,252 | 62,000 | Accepted | Accepted | 8.57 | def prime_factorize(N,lis):
a = []
n = N
while n % 2 == 0:
lis[2] += 1
n //= 2
f = 3
while f * f <= N:
if n % f == 0:
lis[f] += 1
n //= f
else:
f += 2
if n != 1:
lis[n] += 1
N = int(eval(input()))
lis =... | def prime_factorize(N,lis):
a = []
n = N
while n % 2 == 0:
lis[2] += 1
n //= 2
f = 3
while f * f <= N:
if n % f == 0:
lis[f] += 1
n //= f
else:
f += 2
if n != 1:
lis[n] += 1
N = int(eval(input()))
lis =... | 44 | 27 | 989 | 569 | def prime_factorize(N, lis):
a = []
n = N
while n % 2 == 0:
lis[2] += 1
n //= 2
f = 3
while f * f <= N:
if n % f == 0:
lis[f] += 1
n //= f
else:
f += 2
if n != 1:
lis[n] += 1
N = int(eval(input()))
lis = [0] * 101
for ... | def prime_factorize(N, lis):
a = []
n = N
while n % 2 == 0:
lis[2] += 1
n //= 2
f = 3
while f * f <= N:
if n % f == 0:
lis[f] += 1
n //= f
else:
f += 2
if n != 1:
lis[n] += 1
N = int(eval(input()))
lis = [0] * 101
for ... | false | 38.636364 | [
"-# print(lis)",
"-lis.sort()",
"-ans = 0",
"-for i in range(101):",
"- for j in range(i + 1, 101):",
"- for k in range(j + 1, 101):",
"- if lis[i] >= 2 and lis[j] >= 4:",
"- ans += 1",
"- if lis[i] >= 4:",
"- ans += 2",
"-for i in ra... | false | 0.125091 | 0.077427 | 1.615603 | [
"s652982523",
"s969554178"
] |
u022407960 | p02281 | python | s611496313 | s791907518 | 40 | 30 | 7,884 | 7,888 | Accepted | Accepted | 25 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
9
0 1 4
1 2 3
2 -1 -1
3 -1 -1
4 5 8
5 6 7
6 -1 -1
7 -1 -1
8 -1 -1
output:
Preorder
0 1 2 3 4 5 6 7 8
Inorder
2 1 3 0 6 5 7 4 8
Postorder
2 3 1 6 7 5 8 4 0
"""
import sys
class Node(object):
def __init__(self):
# i... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
9
0 1 4
1 2 3
2 -1 -1
3 -1 -1
4 5 8
5 6 7
6 -1 -1
7 -1 -1
8 -1 -1
output:
Preorder
0 1 2 3 4 5 6 7 8
Inorder
2 1 3 0 6 5 7 4 8
Postorder
2 3 1 6 7 5 8 4 0
"""
import sys
class Node(object):
def __init__(self):
# i... | 119 | 119 | 2,495 | 2,504 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
9
0 1 4
1 2 3
2 -1 -1
3 -1 -1
4 5 8
5 6 7
6 -1 -1
7 -1 -1
8 -1 -1
output:
Preorder
0 1 2 3 4 5 6 7 8
Inorder
2 1 3 0 6 5 7 4 8
Postorder
2 3 1 6 7 5 8 4 0
"""
import sys
class Node(object):
def __init__(self):
# init node as a single leaf node.
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
9
0 1 4
1 2 3
2 -1 -1
3 -1 -1
4 5 8
5 6 7
6 -1 -1
7 -1 -1
8 -1 -1
output:
Preorder
0 1 2 3 4 5 6 7 8
Inorder
2 1 3 0 6 5 7 4 8
Postorder
2 3 1 6 7 5 8 4 0
"""
import sys
class Node(object):
def __init__(self):
# init node as a single leaf node.
... | false | 0 | [
"- return None",
"+ return v.index",
"- return None",
"+ return v.index",
"- return None",
"+ return v.index"
] | false | 0.042246 | 0.043596 | 0.96903 | [
"s611496313",
"s791907518"
] |
u131984977 | p02400 | python | s520498911 | s976279625 | 70 | 30 | 14,736 | 6,812 | Accepted | Accepted | 57.14 | import sys
import math
from decimal import Decimal
r = Decimal(sys.stdin.readline())
area = r ** Decimal(2) * Decimal(math.pi)
circumference = r * Decimal(2) * Decimal(math.pi)
print((round(area, 5), round(circumference, 5))) | import math
r = float(eval(input()))
s = r * r * math.pi
l = r * 2 * math.pi
print((s, l)) | 9 | 8 | 233 | 92 | import sys
import math
from decimal import Decimal
r = Decimal(sys.stdin.readline())
area = r ** Decimal(2) * Decimal(math.pi)
circumference = r * Decimal(2) * Decimal(math.pi)
print((round(area, 5), round(circumference, 5)))
| import math
r = float(eval(input()))
s = r * r * math.pi
l = r * 2 * math.pi
print((s, l))
| false | 11.111111 | [
"-import sys",
"-from decimal import Decimal",
"-r = Decimal(sys.stdin.readline())",
"-area = r ** Decimal(2) * Decimal(math.pi)",
"-circumference = r * Decimal(2) * Decimal(math.pi)",
"-print((round(area, 5), round(circumference, 5)))",
"+r = float(eval(input()))",
"+s = r * r * math.pi",
"+l = r *... | false | 0.13657 | 0.07226 | 1.889979 | [
"s520498911",
"s976279625"
] |
u377989038 | p03601 | python | s651592910 | s842549774 | 1,300 | 103 | 3,064 | 3,188 | Accepted | Accepted | 92.08 | a, b, c, d, e, f = list(map(int, input().split()))
a, b = 100 * a, 100 * b
limit = 100 * e / (100 + e)
mx = -1
for i in range(f // a + 1):
for j in range((f - i * a) // b + 1):
for k in range((f - i * a - j * b) // c + 1):
for l in range((f - i * a - j * b - k * c) // d + 1):
... | a, b, c, d, e, f = list(map(int, input().split()))
limit = 100 * e / (100 + e)
mx = -1
waters = set()
for i in range(0, f + 1, 100 * a):
for j in range(0, f + 1, 100 * b):
if i + j <= f:
waters.add(i + j)
sugars = set()
for i in range(0, f + 1, c):
for j in range(0, f + 1, d):
... | 18 | 25 | 683 | 634 | a, b, c, d, e, f = list(map(int, input().split()))
a, b = 100 * a, 100 * b
limit = 100 * e / (100 + e)
mx = -1
for i in range(f // a + 1):
for j in range((f - i * a) // b + 1):
for k in range((f - i * a - j * b) // c + 1):
for l in range((f - i * a - j * b - k * c) // d + 1):
wat... | a, b, c, d, e, f = list(map(int, input().split()))
limit = 100 * e / (100 + e)
mx = -1
waters = set()
for i in range(0, f + 1, 100 * a):
for j in range(0, f + 1, 100 * b):
if i + j <= f:
waters.add(i + j)
sugars = set()
for i in range(0, f + 1, c):
for j in range(0, f + 1, d):
if i +... | false | 28 | [
"-a, b = 100 * a, 100 * b",
"-for i in range(f // a + 1):",
"- for j in range((f - i * a) // b + 1):",
"- for k in range((f - i * a - j * b) // c + 1):",
"- for l in range((f - i * a - j * b - k * c) // d + 1):",
"- water = i * a + j * b + k * c + l * d",
"- ... | false | 0.042237 | 0.040285 | 1.048451 | [
"s651592910",
"s842549774"
] |
u873190923 | p02918 | python | s891280597 | s967610138 | 184 | 106 | 39,536 | 77,568 | Accepted | Accepted | 42.39 | inf = 10**15
mod = 10**9+7
n, k = list(map(int, input().split()))
s = eval(input())
count = 0
flag = False
for c in s:
if c == 'R':
if flag == False:
flag=True
else:
if flag == True:
count+=1
flag=False
if s[-1]=='R' and count > 0:
count+=1
... | # input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
# list(map(int, list(input()))) # スペースがない数字リストを読み込み
import math
import fractions
import sys
import bisect
import heapq # 優先度付きキュー(最小値取り出し)
import collections
from collections import Counter
from collections import deque
... | 33 | 156 | 733 | 3,211 | inf = 10**15
mod = 10**9 + 7
n, k = list(map(int, input().split()))
s = eval(input())
count = 0
flag = False
for c in s:
if c == "R":
if flag == False:
flag = True
else:
if flag == True:
count += 1
flag = False
if s[-1] == "R" and count > 0:
count += 1
if ... | # input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
# list(map(int, list(input()))) # スペースがない数字リストを読み込み
import math
import fractions
import sys
import bisect
import heapq # 優先度付きキュー(最小値取り出し)
import collections
from collections import Counter
from collections import deque
import pprin... | false | 78.846154 | [
"-inf = 10**15",
"+# input()",
"+# int(input())",
"+# map(int, input().split())",
"+# list(map(int, input().split()))",
"+# list(map(int, list(input()))) # スペースがない数字リストを読み込み",
"+import math",
"+import fractions",
"+import sys",
"+import bisect",
"+import heapq # 優先度付きキュー(最小値取り出し)",
"+import c... | false | 0.076356 | 0.037774 | 2.021373 | [
"s891280597",
"s967610138"
] |
u077291787 | p03607 | python | s677798248 | s416882007 | 86 | 57 | 11,884 | 14,308 | Accepted | Accepted | 33.72 | # ABC073C - Write and Erase
import sys
input = sys.stdin.readline
n = int(eval(input()))
arr = set()
for _ in range(n):
m = int(eval(input()))
if m in arr:
arr.remove(m)
else:
arr.add(m)
print((len(arr))) | # ABC073C - Write and Erase
def main():
N, *A = list(map(int, open(0).read().split()))
store = set()
for a in A:
if a in store:
store.remove(a)
else:
store.add(a)
ans = len(store)
print(ans)
if __name__ == "__main__":
main() | 13 | 15 | 231 | 298 | # ABC073C - Write and Erase
import sys
input = sys.stdin.readline
n = int(eval(input()))
arr = set()
for _ in range(n):
m = int(eval(input()))
if m in arr:
arr.remove(m)
else:
arr.add(m)
print((len(arr)))
| # ABC073C - Write and Erase
def main():
N, *A = list(map(int, open(0).read().split()))
store = set()
for a in A:
if a in store:
store.remove(a)
else:
store.add(a)
ans = len(store)
print(ans)
if __name__ == "__main__":
main()
| false | 13.333333 | [
"-import sys",
"+def main():",
"+ N, *A = list(map(int, open(0).read().split()))",
"+ store = set()",
"+ for a in A:",
"+ if a in store:",
"+ store.remove(a)",
"+ else:",
"+ store.add(a)",
"+ ans = len(store)",
"+ print(ans)",
"-input = sys.st... | false | 0.044169 | 0.044234 | 0.998525 | [
"s677798248",
"s416882007"
] |
u766684188 | p02821 | python | s283463453 | s201622963 | 1,054 | 302 | 60,104 | 26,476 | Accepted | Accepted | 71.35 | from itertools import accumulate
from bisect import bisect_left
def main():
n,m=list(map(int,input().split()))
A=list(map(int,input().split()))
A.sort()
def count(k):
cnt=0
for a in A:
cnt+=bisect_left(A,k-a)
return cnt
ok=0
ng=2*10**5+... | import numpy as np
from numpy.fft import rfft,irfft
def main():
n,m=list(map(int,input().split()))
A=np.array(list(map(int,input().split())))
F=np.bincount(A)
fft_len=2*10**5+1
Ff=rfft(F,fft_len)
G=np.rint(irfft(Ff*Ff,fft_len)).astype(np.int64)
G_acc=G.cumsum()
remove_cnt=n**... | 35 | 20 | 725 | 543 | from itertools import accumulate
from bisect import bisect_left
def main():
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
def count(k):
cnt = 0
for a in A:
cnt += bisect_left(A, k - a)
return cnt
ok = 0
ng = 2 * 10**5 ... | import numpy as np
from numpy.fft import rfft, irfft
def main():
n, m = list(map(int, input().split()))
A = np.array(list(map(int, input().split())))
F = np.bincount(A)
fft_len = 2 * 10**5 + 1
Ff = rfft(F, fft_len)
G = np.rint(irfft(Ff * Ff, fft_len)).astype(np.int64)
G_acc = G.cumsum()
... | false | 42.857143 | [
"-from itertools import accumulate",
"-from bisect import bisect_left",
"+import numpy as np",
"+from numpy.fft import rfft, irfft",
"- A = list(map(int, input().split()))",
"- A.sort()",
"-",
"- def count(k):",
"- cnt = 0",
"- for a in A:",
"- cnt += bisect_lef... | false | 0.087084 | 0.278241 | 0.312979 | [
"s283463453",
"s201622963"
] |
u537782349 | p03835 | python | s963154327 | s450492149 | 1,465 | 1,231 | 2,940 | 2,940 | Accepted | Accepted | 15.97 | a, b = list(map(int, input().split()))
c = 0
for i in range(a+1):
for j in range(a+1):
d = b - i - j
if 0 <= d <= a:
c += 1
print(c)
| a, b = list(map(int, input().split()))
c = 0
for i in range(a+1):
for j in range(a+1):
if 0 <= b - i - j <= a:
c += 1
print(c)
| 8 | 7 | 166 | 151 | a, b = list(map(int, input().split()))
c = 0
for i in range(a + 1):
for j in range(a + 1):
d = b - i - j
if 0 <= d <= a:
c += 1
print(c)
| a, b = list(map(int, input().split()))
c = 0
for i in range(a + 1):
for j in range(a + 1):
if 0 <= b - i - j <= a:
c += 1
print(c)
| false | 12.5 | [
"- d = b - i - j",
"- if 0 <= d <= a:",
"+ if 0 <= b - i - j <= a:"
] | false | 0.11947 | 0.03558 | 3.357757 | [
"s963154327",
"s450492149"
] |
u888092736 | p03032 | python | s923238416 | s109874948 | 544 | 320 | 9,148 | 9,132 | Accepted | Accepted | 41.18 | from heapq import heappop, heapify
N, K, *V = list(map(int, open(0).read().split()))
# i: 操作回数
# j: 取り出す個数
# k: 左から取り出す範囲 [0, k)
ans = 0
for i in range(K + 1):
for j in range(min(N + 1, i + 1)):
for k in range(j + 1):
right = N - j + k
tmp = V[:k] + V[right:]
... | N, K, *V = list(map(int, open(0).read().split()))
# i: 操作回数
# j: 取り出す個数
# k: 左から取り出す範囲 [0, k)
ans = 0
for i in range(K + 1):
for j in range(min(N + 1, i + 1)):
for k in range(j + 1):
right = N - j + k
tmp = V[:k] + V[right:]
tmp.sort()
ans = max(a... | 22 | 14 | 525 | 382 | from heapq import heappop, heapify
N, K, *V = list(map(int, open(0).read().split()))
# i: 操作回数
# j: 取り出す個数
# k: 左から取り出す範囲 [0, k)
ans = 0
for i in range(K + 1):
for j in range(min(N + 1, i + 1)):
for k in range(j + 1):
right = N - j + k
tmp = V[:k] + V[right:]
put_out_cnt... | N, K, *V = list(map(int, open(0).read().split()))
# i: 操作回数
# j: 取り出す個数
# k: 左から取り出す範囲 [0, k)
ans = 0
for i in range(K + 1):
for j in range(min(N + 1, i + 1)):
for k in range(j + 1):
right = N - j + k
tmp = V[:k] + V[right:]
tmp.sort()
ans = max(ans, sum(tmp) ... | false | 36.363636 | [
"-from heapq import heappop, heapify",
"-",
"- put_out_cnt = i - j",
"- heapify(tmp)",
"- while tmp and put_out_cnt > 0:",
"- heappop(tmp)",
"- put_out_cnt -= 1",
"- ans = max(ans, sum(tmp))",
"+ tmp.sort()",
"+ ... | false | 0.037803 | 0.042929 | 0.880585 | [
"s923238416",
"s109874948"
] |
u652656291 | p03221 | python | s588270492 | s076561681 | 704 | 583 | 41,012 | 38,376 | Accepted | Accepted | 17.19 | import collections
import bisect
n,m = list(map(int,input().split()))
p = [[int(j) for j in input().split()] for i in range(m)]
a = collections.defaultdict(list)
for x,y in sorted(p):
a[x] += [y]
for x,y in p:
z = bisect.bisect(a[x],y)
print(("%06d%06d"%(x,z)))
| n, m = list(map(int, input().split()))
cnt = [[] for _ in range(n + 1)]
for i in range(m):
p, y = list(map(int, input().split()))
cnt[p].append((y, i))
buf = [None] * m
for p, l in enumerate(cnt):
if not l:
continue
l.sort()
for j, (y, i) in enumerate(l):
buf[i] = '{:06d}{... | 10 | 13 | 269 | 354 | import collections
import bisect
n, m = list(map(int, input().split()))
p = [[int(j) for j in input().split()] for i in range(m)]
a = collections.defaultdict(list)
for x, y in sorted(p):
a[x] += [y]
for x, y in p:
z = bisect.bisect(a[x], y)
print(("%06d%06d" % (x, z)))
| n, m = list(map(int, input().split()))
cnt = [[] for _ in range(n + 1)]
for i in range(m):
p, y = list(map(int, input().split()))
cnt[p].append((y, i))
buf = [None] * m
for p, l in enumerate(cnt):
if not l:
continue
l.sort()
for j, (y, i) in enumerate(l):
buf[i] = "{:06d}{:06d}".form... | false | 23.076923 | [
"-import collections",
"-import bisect",
"-",
"-p = [[int(j) for j in input().split()] for i in range(m)]",
"-a = collections.defaultdict(list)",
"-for x, y in sorted(p):",
"- a[x] += [y]",
"-for x, y in p:",
"- z = bisect.bisect(a[x], y)",
"- print((\"%06d%06d\" % (x, z)))",
"+cnt = [[... | false | 0.045428 | 0.043916 | 1.034419 | [
"s588270492",
"s076561681"
] |
u606878291 | p03945 | python | s913961973 | s229431767 | 31 | 26 | 9,812 | 9,680 | Accepted | Accepted | 16.13 | S = eval(input())
print((len([0 for index, c in enumerate(S[1:], 1) if c != S[index - 1]])))
| S = eval(input())
print((len([0 for c1, c2 in zip(S[:-1], S[1:]) if c1 != c2])))
| 3 | 3 | 88 | 76 | S = eval(input())
print((len([0 for index, c in enumerate(S[1:], 1) if c != S[index - 1]])))
| S = eval(input())
print((len([0 for c1, c2 in zip(S[:-1], S[1:]) if c1 != c2])))
| false | 0 | [
"-print((len([0 for index, c in enumerate(S[1:], 1) if c != S[index - 1]])))",
"+print((len([0 for c1, c2 in zip(S[:-1], S[1:]) if c1 != c2])))"
] | false | 0.035531 | 0.03604 | 0.985863 | [
"s913961973",
"s229431767"
] |
u784022244 | p03329 | python | s737841593 | s739639862 | 1,968 | 460 | 88,740 | 3,828 | Accepted | Accepted | 76.63 | import numpy as np
N=int(eval(input()))
six=[1]
nine=[]
for i in range(1,N):
six.append(6**i)
nine.append(9**i)
if 6**i>N:
break
six=np.array(six)
nine=np.array(nine)
L=np.concatenate([six,nine])
now=N
count=0
dp=np.ones(N+L.max()+1)*10**5
dp[1]=1
dp[0]=0
#dp[i+1] iをちょうど引き出すのに必要な最小回数
for... | from math import log
N=int(eval(input()))
L=[1]
for i in range(1,N):
if 6**i<=N:
L.append(6**i)
else:
break
for i in range(1,N):
if 9**i<=N:
L.append(9**i)
else:
break
dp=[100000]*(N+1)
dp[0]=0
dp[1]=1
for i in range(2,N+1):
sub=100000
for l ... | 25 | 26 | 406 | 406 | import numpy as np
N = int(eval(input()))
six = [1]
nine = []
for i in range(1, N):
six.append(6**i)
nine.append(9**i)
if 6**i > N:
break
six = np.array(six)
nine = np.array(nine)
L = np.concatenate([six, nine])
now = N
count = 0
dp = np.ones(N + L.max() + 1) * 10**5
dp[1] = 1
dp[0] = 0
# dp[i+1] i... | from math import log
N = int(eval(input()))
L = [1]
for i in range(1, N):
if 6**i <= N:
L.append(6**i)
else:
break
for i in range(1, N):
if 9**i <= N:
L.append(9**i)
else:
break
dp = [100000] * (N + 1)
dp[0] = 0
dp[1] = 1
for i in range(2, N + 1):
sub = 100000
fo... | false | 3.846154 | [
"-import numpy as np",
"+from math import log",
"-six = [1]",
"-nine = []",
"+L = [1]",
"- six.append(6**i)",
"- nine.append(9**i)",
"- if 6**i > N:",
"+ if 6**i <= N:",
"+ L.append(6**i)",
"+ else:",
"-six = np.array(six)",
"-nine = np.array(nine)",
"-L = np.concaten... | false | 1.298673 | 0.194633 | 6.672429 | [
"s737841593",
"s739639862"
] |
u761320129 | p02661 | python | s523811994 | s468343284 | 497 | 295 | 25,416 | 39,676 | Accepted | Accepted | 40.64 | N = int(eval(input()))
A = []
B = []
for i in range(N):
a,b = list(map(int,input().split()))
A.append(a)
B.append(b)
A.sort()
B.sort()
if N%2:
ma = A[N//2]
mb = B[N//2]
print((max(0, mb - ma + 1)))
else:
ma = A[N//2] + A[N//2-1]
mb = B[N//2] + B[N//2-1]
print((max(0... | import sys
input = sys.stdin.readline
N = int(eval(input()))
AB = [tuple(map(int,input().split())) for i in range(N)]
A = []
B = []
for a,b in AB:
A.append(a)
B.append(b)
A.sort()
B.sort()
if N%2==0:
m = N//2
b = B[m] + B[m-1]
a = A[m] + A[m-1]
print((b - a + 1))
else:
m =... | 18 | 20 | 320 | 345 | N = int(eval(input()))
A = []
B = []
for i in range(N):
a, b = list(map(int, input().split()))
A.append(a)
B.append(b)
A.sort()
B.sort()
if N % 2:
ma = A[N // 2]
mb = B[N // 2]
print((max(0, mb - ma + 1)))
else:
ma = A[N // 2] + A[N // 2 - 1]
mb = B[N // 2] + B[N // 2 - 1]
print((max... | import sys
input = sys.stdin.readline
N = int(eval(input()))
AB = [tuple(map(int, input().split())) for i in range(N)]
A = []
B = []
for a, b in AB:
A.append(a)
B.append(b)
A.sort()
B.sort()
if N % 2 == 0:
m = N // 2
b = B[m] + B[m - 1]
a = A[m] + A[m - 1]
print((b - a + 1))
else:
m = N // ... | false | 10 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"+AB = [tuple(map(int, input().split())) for i in range(N)]",
"-for i in range(N):",
"- a, b = list(map(int, input().split()))",
"+for a, b in AB:",
"-if N % 2:",
"- ma = A[N // 2]",
"- mb = B[N // 2]",
"- print((max(0, mb - ma + 1))... | false | 0.042132 | 0.078923 | 0.533838 | [
"s523811994",
"s468343284"
] |
u620084012 | p02843 | python | s066454311 | s600349067 | 200 | 164 | 38,384 | 38,384 | Accepted | Accepted | 18 | X = int(eval(input()))
t = X%100
k = X//100
if k*5 >= t:
print((1))
else:
print((0))
| X = int(eval(input()))
t = X//100
if 0 <= X%100 <= t*5:
print((1))
else:
print((0))
| 8 | 6 | 91 | 87 | X = int(eval(input()))
t = X % 100
k = X // 100
if k * 5 >= t:
print((1))
else:
print((0))
| X = int(eval(input()))
t = X // 100
if 0 <= X % 100 <= t * 5:
print((1))
else:
print((0))
| false | 25 | [
"-t = X % 100",
"-k = X // 100",
"-if k * 5 >= t:",
"+t = X // 100",
"+if 0 <= X % 100 <= t * 5:"
] | false | 0.049342 | 0.042282 | 1.166963 | [
"s066454311",
"s600349067"
] |
u923668099 | p02257 | python | s737820778 | s734085193 | 530 | 410 | 7,700 | 7,608 | Accepted | Accepted | 22.64 | import sys
def solve():
n = int(sys.stdin.readline())
ans = sum(is_prime(int(sys.stdin.readline())) for i in range(n))
print(ans)
def is_prime(n):
if n < 2 or (n > 2 and n & 1 == 0):
return False
p = 3
while p*p <= n:
if n % p == 0:
return False... | import sys
def solve():
n = int(sys.stdin.readline())
ans = sum(is_prime(int(sys.stdin.readline())) for i in range(n))
print(ans)
def is_prime(n):
if n < 2 or (n > 2 and not(n & 1)):
return False
for p in range(3, n, 2):
if p*p > n:
break
if n... | 25 | 23 | 400 | 418 | import sys
def solve():
n = int(sys.stdin.readline())
ans = sum(is_prime(int(sys.stdin.readline())) for i in range(n))
print(ans)
def is_prime(n):
if n < 2 or (n > 2 and n & 1 == 0):
return False
p = 3
while p * p <= n:
if n % p == 0:
return False
p += 2
... | import sys
def solve():
n = int(sys.stdin.readline())
ans = sum(is_prime(int(sys.stdin.readline())) for i in range(n))
print(ans)
def is_prime(n):
if n < 2 or (n > 2 and not (n & 1)):
return False
for p in range(3, n, 2):
if p * p > n:
break
if not (n % p):
... | false | 8 | [
"- if n < 2 or (n > 2 and n & 1 == 0):",
"+ if n < 2 or (n > 2 and not (n & 1)):",
"- p = 3",
"- while p * p <= n:",
"- if n % p == 0:",
"+ for p in range(3, n, 2):",
"+ if p * p > n:",
"+ break",
"+ if not (n % p):",
"- p += 2"
] | false | 0.046237 | 0.047175 | 0.980117 | [
"s737820778",
"s734085193"
] |
u434630332 | p03573 | python | s305486149 | s676680409 | 30 | 26 | 9,172 | 9,164 | Accepted | Accepted | 13.33 | a, b, c =list(map(int,input().split()))
if int(a) == int(b):
print(c)
elif int(a) == int(c):
print(b)
elif int(b) == int(c):
print(a) | a, b, c = list(map(int,input().split()))
if int(a) == int(b):
print(c)
if int(a) == int(c):
print(b)
if int(b) == int(c):
print(a) | 8 | 8 | 141 | 138 | a, b, c = list(map(int, input().split()))
if int(a) == int(b):
print(c)
elif int(a) == int(c):
print(b)
elif int(b) == int(c):
print(a)
| a, b, c = list(map(int, input().split()))
if int(a) == int(b):
print(c)
if int(a) == int(c):
print(b)
if int(b) == int(c):
print(a)
| false | 0 | [
"-elif int(a) == int(c):",
"+if int(a) == int(c):",
"-elif int(b) == int(c):",
"+if int(b) == int(c):"
] | false | 0.045487 | 0.045525 | 0.999159 | [
"s305486149",
"s676680409"
] |
u936985471 | p03201 | python | s784656784 | s465076630 | 779 | 583 | 56,488 | 55,072 | Accepted | Accepted | 25.16 | import sys
readline = sys.stdin.readline
# 残った数の中で最大の数とペアになれる(可能性のある)数は一意に決まる。
# 15に15以下の数を足して作れる2べきは16だけ、32は作れない。
# 8 * 2 < 15 * 2 < 16 * 2だから。
# 大きいほうから見ていって、ペアになれる数を特定出来たらペアにする。
# 以下を別々で持つ
# ・大きい順の管理
# ・探している数へのO(1)での到達と、残数管理(同じ数が複数回出てくる可能性があるため)
N = int(readline())
A = list(map(int,readline().split())... | import sys
readline = sys.stdin.readline
# 残った数の中で最大の数とペアになれる(可能性のある)数は一意に決まる。
# 15に15以下の数を足して作れる2べきは16だけ、32は作れない。
# 8 * 2 < 15 * 2 < 16 * 2だから。
# 大きいほうから見ていって、ペアになれる数を特定出来たらペアにする。
# 以下を別々で持つ
# ・大きい順の管理
# ・探している数へのO(1)での到達と、残数管理(同じ数が複数回出てくる可能性があるため)
N = int(readline())
A = list(map(int,readline().split())... | 48 | 44 | 1,020 | 907 | import sys
readline = sys.stdin.readline
# 残った数の中で最大の数とペアになれる(可能性のある)数は一意に決まる。
# 15に15以下の数を足して作れる2べきは16だけ、32は作れない。
# 8 * 2 < 15 * 2 < 16 * 2だから。
# 大きいほうから見ていって、ペアになれる数を特定出来たらペアにする。
# 以下を別々で持つ
# ・大きい順の管理
# ・探している数へのO(1)での到達と、残数管理(同じ数が複数回出てくる可能性があるため)
N = int(readline())
A = list(map(int, readline().split()))
from colle... | import sys
readline = sys.stdin.readline
# 残った数の中で最大の数とペアになれる(可能性のある)数は一意に決まる。
# 15に15以下の数を足して作れる2べきは16だけ、32は作れない。
# 8 * 2 < 15 * 2 < 16 * 2だから。
# 大きいほうから見ていって、ペアになれる数を特定出来たらペアにする。
# 以下を別々で持つ
# ・大きい順の管理
# ・探している数へのO(1)での到達と、残数管理(同じ数が複数回出てくる可能性があるため)
N = int(readline())
A = list(map(int, readline().split()))
from colle... | false | 8.333333 | [
"-import heapq as hq",
"-",
"-balls_q = [] # ボールを大きい順に入れていく",
"- hq.heappush(balls_q, -a)",
"+A = sorted(A, reverse=True)",
"-while balls_q:",
"- ball = -(hq.heappop(balls_q))",
"+for ball in A:",
"- # pushしないからheapqでなくてよかったな・・・"
] | false | 0.038028 | 0.036629 | 1.038175 | [
"s784656784",
"s465076630"
] |
u968166680 | p03295 | python | s772751424 | s568182667 | 147 | 131 | 30,176 | 32,324 | Accepted | Accepted | 10.88 | import sys
read = sys.stdin.buffer.read
INF = 1 << 60
def main():
N, M, *AB = list(map(int, read().split()))
Q = [[] for _ in range(N - 1)]
for a, b in zip(*[iter(AB)] * 2):
Q[a - 1].append(b - 2)
min_y = INF
ans = 0
for i, ys in enumerate(Q):
if ys:
... | import sys
from operator import itemgetter
read = sys.stdin.buffer.read
INF = 1 << 60
def main():
N, M, *AB = list(map(int, read().split()))
Q = [0] * M
for i, (a, b) in enumerate(zip(*[iter(AB)] * 2)):
Q[i] = (a - 1, b - 1)
Q.sort(key=itemgetter(1))
ans = 0
last =... | 28 | 29 | 492 | 482 | import sys
read = sys.stdin.buffer.read
INF = 1 << 60
def main():
N, M, *AB = list(map(int, read().split()))
Q = [[] for _ in range(N - 1)]
for a, b in zip(*[iter(AB)] * 2):
Q[a - 1].append(b - 2)
min_y = INF
ans = 0
for i, ys in enumerate(Q):
if ys:
min_y = min(mi... | import sys
from operator import itemgetter
read = sys.stdin.buffer.read
INF = 1 << 60
def main():
N, M, *AB = list(map(int, read().split()))
Q = [0] * M
for i, (a, b) in enumerate(zip(*[iter(AB)] * 2)):
Q[i] = (a - 1, b - 1)
Q.sort(key=itemgetter(1))
ans = 0
last = -1
for a, b in ... | false | 3.448276 | [
"+from operator import itemgetter",
"- Q = [[] for _ in range(N - 1)]",
"- for a, b in zip(*[iter(AB)] * 2):",
"- Q[a - 1].append(b - 2)",
"- min_y = INF",
"+ Q = [0] * M",
"+ for i, (a, b) in enumerate(zip(*[iter(AB)] * 2)):",
"+ Q[i] = (a - 1, b - 1)",
"+ Q.sort(key... | false | 0.121478 | 0.048804 | 2.489124 | [
"s772751424",
"s568182667"
] |
u073852194 | p02567 | python | s000256264 | s404776909 | 736 | 389 | 124,692 | 117,784 | Accepted | Accepted | 47.15 | class SegmentTree():
def __init__(self, arr, func=min, ie=2**63):
self.h = (len(arr) - 1).bit_length()
self.n = 2**self.h
self.ie = ie
self.func = func
self.tree = [ie for _ in range(2 * self.n)]
for i in range(len(arr)):
self.tree[self.n + i] = ar... | class SegmentTree():
def __init__(self, n, op, e):
self.n = n
self.op = op
self.e = e
self.log = (n - 1).bit_length()
self.size = 1 << self.log
self.d = [e] * (2 * self.size)
def update(self, k):
self.d[k] = self.op(self.d[2 * k], self.d[2 * k +... | 61 | 109 | 1,676 | 3,047 | class SegmentTree:
def __init__(self, arr, func=min, ie=2**63):
self.h = (len(arr) - 1).bit_length()
self.n = 2**self.h
self.ie = ie
self.func = func
self.tree = [ie for _ in range(2 * self.n)]
for i in range(len(arr)):
self.tree[self.n + i] = arr[i]
... | class SegmentTree:
def __init__(self, n, op, e):
self.n = n
self.op = op
self.e = e
self.log = (n - 1).bit_length()
self.size = 1 << self.log
self.d = [e] * (2 * self.size)
def update(self, k):
self.d[k] = self.op(self.d[2 * k], self.d[2 * k + 1])
de... | false | 44.036697 | [
"- def __init__(self, arr, func=min, ie=2**63):",
"- self.h = (len(arr) - 1).bit_length()",
"- self.n = 2**self.h",
"- self.ie = ie",
"- self.func = func",
"- self.tree = [ie for _ in range(2 * self.n)]",
"- for i in range(len(arr)):",
"- self.tr... | false | 0.037952 | 0.079271 | 0.478767 | [
"s000256264",
"s404776909"
] |
u994988729 | p03557 | python | s400266707 | s962247206 | 367 | 266 | 23,136 | 26,476 | Accepted | Accepted | 27.52 | import bisect
n=int(eval(input()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
c.sort()
ans=0
for i in b:
up=bisect.bisect_left(a, i)
dn=n-bisect.bisect_right(c, i)
ans+=up*dn
print(ans)
| import numpy as np
N = int(eval(input()))
A = np.array(input().split(), dtype=int)
B = np.array(input().split(), dtype=int)
C = np.array(input().split(), dtype=int)
A.sort()
B.sort()
C.sort()
CB = np.searchsorted(B, C, side="left")
BA = np.searchsorted(A, B, side="left")
tmp = [0]+BA.cumsum().tolist()
tmp ... | 15 | 16 | 273 | 365 | import bisect
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
c.sort()
ans = 0
for i in b:
up = bisect.bisect_left(a, i)
dn = n - bisect.bisect_right(c, i)
ans += up * dn
print(ans)
| import numpy as np
N = int(eval(input()))
A = np.array(input().split(), dtype=int)
B = np.array(input().split(), dtype=int)
C = np.array(input().split(), dtype=int)
A.sort()
B.sort()
C.sort()
CB = np.searchsorted(B, C, side="left")
BA = np.searchsorted(A, B, side="left")
tmp = [0] + BA.cumsum().tolist()
tmp = np.array... | false | 6.25 | [
"-import bisect",
"+import numpy as np",
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-b = list(map(int, input().split()))",
"-c = list(map(int, input().split()))",
"-a.sort()",
"-c.sort()",
"-ans = 0",
"-for i in b:",
"- up = bisect.bisect_left(a, i)",
"- dn = n -... | false | 0.043697 | 0.180289 | 0.242373 | [
"s400266707",
"s962247206"
] |
u761529120 | p02972 | python | s101316616 | s952986875 | 336 | 302 | 71,260 | 71,260 | Accepted | Accepted | 10.12 | def main():
N = int(eval(input()))
A = [0] + list(map(int, input().split()))
B = [0] * (N+1)
for i in range(N,0,-1):
tmp = 0
for j in range(i,N+1,i):
tmp ^= B[j]
B[i] = tmp ^ A[i]
cnt = 0
ans = []
for i in range(1,N+1):
if B[i] ==... | def main():
N = int(eval(input()))
A = [0] + list(map(int, input().split()))
B = [0] * (N+1)
for i in range(N,0,-1):
tmp = 0
for j in range(i,N+1,i):
tmp += B[j]
B[i] = (tmp % 2) ^ A[i]
ans = []
for i in range(N+1):
if B[i] != 0:
... | 23 | 22 | 411 | 417 | def main():
N = int(eval(input()))
A = [0] + list(map(int, input().split()))
B = [0] * (N + 1)
for i in range(N, 0, -1):
tmp = 0
for j in range(i, N + 1, i):
tmp ^= B[j]
B[i] = tmp ^ A[i]
cnt = 0
ans = []
for i in range(1, N + 1):
if B[i] == 1:
... | def main():
N = int(eval(input()))
A = [0] + list(map(int, input().split()))
B = [0] * (N + 1)
for i in range(N, 0, -1):
tmp = 0
for j in range(i, N + 1, i):
tmp += B[j]
B[i] = (tmp % 2) ^ A[i]
ans = []
for i in range(N + 1):
if B[i] != 0:
... | false | 4.347826 | [
"- tmp ^= B[j]",
"- B[i] = tmp ^ A[i]",
"- cnt = 0",
"+ tmp += B[j]",
"+ B[i] = (tmp % 2) ^ A[i]",
"- for i in range(1, N + 1):",
"- if B[i] == 1:",
"- cnt += 1",
"+ for i in range(N + 1):",
"+ if B[i] != 0:",
"- print(cnt)... | false | 0.041425 | 0.076343 | 0.54262 | [
"s101316616",
"s952986875"
] |
u590211278 | p03583 | python | s655654159 | s084622600 | 1,032 | 270 | 3,060 | 40,812 | Accepted | Accepted | 73.84 | import math
const=3500+1
N = int(eval(input()))
ans=4/N
flg=False
for h in range(int(N/4),const):
for n in range(h,const):
tmp=4*h*n-N*n-N*h
if tmp != 0:
w = N*h*n/tmp
if w == int(w) and w>0:
print((h,n,int(w) ))
flg=True
... | import math
const=3500+1
N = int(eval(input()))
ans=4/N
flg=False
for h in range(1,const):
for n in range(h,const):
tmp=4*h*n-N*n-N*h
if tmp != 0:
w = N*h*n/tmp
if w == int(w) and w>0:
print((h,n,int(w) ))
flg=True
... | 17 | 17 | 361 | 354 | import math
const = 3500 + 1
N = int(eval(input()))
ans = 4 / N
flg = False
for h in range(int(N / 4), const):
for n in range(h, const):
tmp = 4 * h * n - N * n - N * h
if tmp != 0:
w = N * h * n / tmp
if w == int(w) and w > 0:
print((h, n, int(w)))
... | import math
const = 3500 + 1
N = int(eval(input()))
ans = 4 / N
flg = False
for h in range(1, const):
for n in range(h, const):
tmp = 4 * h * n - N * n - N * h
if tmp != 0:
w = N * h * n / tmp
if w == int(w) and w > 0:
print((h, n, int(w)))
fl... | false | 0 | [
"-for h in range(int(N / 4), const):",
"+for h in range(1, const):"
] | false | 0.271478 | 1.967487 | 0.137982 | [
"s655654159",
"s084622600"
] |
u893063840 | p03343 | python | s393674871 | s474711598 | 1,898 | 1,613 | 3,188 | 3,188 | Accepted | Accepted | 15.02 | n, k, q = list(map(int, input().split()))
a = list(map(int, input().split()))
if q == 1:
print((0))
exit()
ans = 10 ** 10
for i, y in enumerate(a):
li = []
l = 0
cnd = []
for j, x in enumerate(a + [-1]):
if i == j:
continue
if x < y:
if l... | n, k, q = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = 10 ** 10
for i, y in enumerate(a):
li = []
l = 0
cnd = []
l_cnd = 0
for j, x in enumerate(a + [-1]):
if x < y:
if l - k + 1 >= 0:
li.sort()
cnd += li[... | 31 | 27 | 610 | 572 | n, k, q = list(map(int, input().split()))
a = list(map(int, input().split()))
if q == 1:
print((0))
exit()
ans = 10**10
for i, y in enumerate(a):
li = []
l = 0
cnd = []
for j, x in enumerate(a + [-1]):
if i == j:
continue
if x < y:
if l - k + 1 >= 0:
... | n, k, q = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = 10**10
for i, y in enumerate(a):
li = []
l = 0
cnd = []
l_cnd = 0
for j, x in enumerate(a + [-1]):
if x < y:
if l - k + 1 >= 0:
li.sort()
cnd += li[: l - k + 1]
... | false | 12.903226 | [
"-if q == 1:",
"- print((0))",
"- exit()",
"+ l_cnd = 0",
"- if i == j:",
"- continue",
"+ l_cnd += l - k + 1",
"- if len(cnd) >= q - 1:",
"+ if l_cnd >= q:",
"- sub = cnd[q - 2] - y",
"+ sub = cnd[q - 1] - y"
] | false | 0.08059 | 0.039023 | 2.065199 | [
"s393674871",
"s474711598"
] |
u912237403 | p00015 | python | s916767947 | s182092113 | 20 | 10 | 4,248 | 4,236 | Accepted | Accepted | 50 | s="overflow"
n=eval(input())
for i in range(n):
a=input()
b=input()
if len(a)>80 or len(b)>80: print(s)
else:
tmp=int(a)+int(b)
if len(str(tmp))>80: print(s)
else: print(tmp) | m=10**80
n=eval(input())
for i in range(n):
s="overflow"
a=eval(input())
b=eval(input())
if a<m and b<m:
tmp=a+b
if tmp<m: s=tmp
print(s) | 10 | 10 | 202 | 145 | s = "overflow"
n = eval(input())
for i in range(n):
a = input()
b = input()
if len(a) > 80 or len(b) > 80:
print(s)
else:
tmp = int(a) + int(b)
if len(str(tmp)) > 80:
print(s)
else:
print(tmp)
| m = 10**80
n = eval(input())
for i in range(n):
s = "overflow"
a = eval(input())
b = eval(input())
if a < m and b < m:
tmp = a + b
if tmp < m:
s = tmp
print(s)
| false | 0 | [
"-s = \"overflow\"",
"+m = 10**80",
"- a = input()",
"- b = input()",
"- if len(a) > 80 or len(b) > 80:",
"- print(s)",
"- else:",
"- tmp = int(a) + int(b)",
"- if len(str(tmp)) > 80:",
"- print(s)",
"- else:",
"- print(tmp)",
"+ ... | false | 0.110332 | 0.162556 | 0.678729 | [
"s916767947",
"s182092113"
] |
u221766194 | p02657 | python | s045096743 | s519388532 | 22 | 20 | 9,156 | 9,004 | Accepted | Accepted | 9.09 | A,B = list(map(int,input().split()))
print((A * B)) | A,B = list(map(float,input().split()))
A = int(A)
print((int(A * B))) | 2 | 3 | 44 | 63 | A, B = list(map(int, input().split()))
print((A * B))
| A, B = list(map(float, input().split()))
A = int(A)
print((int(A * B)))
| false | 33.333333 | [
"-A, B = list(map(int, input().split()))",
"-print((A * B))",
"+A, B = list(map(float, input().split()))",
"+A = int(A)",
"+print((int(A * B)))"
] | false | 0.035794 | 0.035551 | 1.006824 | [
"s045096743",
"s519388532"
] |
u364555831 | p02694 | python | s096960348 | s651449566 | 39 | 32 | 9,940 | 9,952 | Accepted | Accepted | 17.95 | import math
from decimal import Decimal
X = int(eval(input()))
now = 100
year = 0
while True:
if now >= X:
break
#now = int(now * Decimal("1.01"))
now = int(now * round(Decimal(1.01), 2))
year += 1
print(year)
| import math
from decimal import Decimal
X = int(eval(input()))
now = 100
year = 0
while True:
if now >= X:
break
#now = int(now * Decimal("1.01"))
#now = int(now * round(Decimal(1.01), 2))
now += now // 100
year += 1
print(year)
| 14 | 16 | 243 | 269 | import math
from decimal import Decimal
X = int(eval(input()))
now = 100
year = 0
while True:
if now >= X:
break
# now = int(now * Decimal("1.01"))
now = int(now * round(Decimal(1.01), 2))
year += 1
print(year)
| import math
from decimal import Decimal
X = int(eval(input()))
now = 100
year = 0
while True:
if now >= X:
break
# now = int(now * Decimal("1.01"))
# now = int(now * round(Decimal(1.01), 2))
now += now // 100
year += 1
print(year)
| false | 12.5 | [
"- now = int(now * round(Decimal(1.01), 2))",
"+ # now = int(now * round(Decimal(1.01), 2))",
"+ now += now // 100"
] | false | 0.125881 | 0.04638 | 2.714086 | [
"s096960348",
"s651449566"
] |
u606045429 | p03959 | python | s858950150 | s507789248 | 171 | 153 | 18,624 | 19,648 | Accepted | Accepted | 10.53 | mod = 10 ** 9 + 7
N = int(eval(input()))
T = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
HT = [False] * N
for i in range(1, N):
if T[i - 1] < T[i]:
HT[i] = True
HT[0] = True
HA = [False] * N
for i in range(N - 1):
if A[i] > A[i + 1]:
HA[i] = True
HA... | mod = 10 ** 9 + 7
N = int(eval(input()))
T = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
HT = [False] * N
for i in range(1, N):
if T[i - 1] < T[i]:
HT[i] = True
HT[0] = True
HA = [False] * N
for i in range(N - 1):
if A[i] > A[i + 1]:
HA[i] = True
HA... | 31 | 29 | 640 | 591 | mod = 10**9 + 7
N = int(eval(input()))
T = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
HT = [False] * N
for i in range(1, N):
if T[i - 1] < T[i]:
HT[i] = True
HT[0] = True
HA = [False] * N
for i in range(N - 1):
if A[i] > A[i + 1]:
HA[i] = True
HA[-1] = True
ans = 1
f... | mod = 10**9 + 7
N = int(eval(input()))
T = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
HT = [False] * N
for i in range(1, N):
if T[i - 1] < T[i]:
HT[i] = True
HT[0] = True
HA = [False] * N
for i in range(N - 1):
if A[i] > A[i + 1]:
HA[i] = True
HA[-1] = True
ans = 1
f... | false | 6.451613 | [
"-for i in range(N):",
"- if HT[i] and HA[i]:",
"- ans *= 1 if T[i] == A[i] else 0",
"- elif HT[i]:",
"- ans *= 1 if T[i] <= A[i] else 0",
"- elif HA[i]:",
"- ans *= 1 if T[i] >= A[i] else 0",
"+for ht, ha, t, a in zip(HT, HA, T, A):",
"+ if ht and ha:",
"+ ... | false | 0.048374 | 0.050678 | 0.954532 | [
"s858950150",
"s507789248"
] |
u698064859 | p03244 | python | s793084770 | s963000172 | 120 | 91 | 18,652 | 18,652 | Accepted | Accepted | 24.17 | from collections import Counter
n = int(eval(input()))
v = list(map(int, input().split()))
"""数字が1種類の場合は半分を書き換える必要が確定"""
if len(set(v)) == 1:
print((len(v) // 2))
exit()
"""要素出現数を集計"""
odd_count = Counter(v[1::2])
even_count = Counter(v[::2])
"""一番多く出現する2つの数字を探す"""
max_hit = 0
odd = None
ev... | from collections import Counter
n = int(eval(input()))
v = list(map(int, input().split()))
"""数字が1種類の場合は半分を書き換える必要が確定"""
if len(set(v)) == 1:
print((len(v) // 2))
exit()
"""要素出現数を集計"""
odd_count = Counter(v[1::2])
even_count = Counter(v[::2])
"""一番多く出現する2つの数字を探す"""
max_hit = 0
odd = None
ev... | 33 | 29 | 839 | 697 | from collections import Counter
n = int(eval(input()))
v = list(map(int, input().split()))
"""数字が1種類の場合は半分を書き換える必要が確定"""
if len(set(v)) == 1:
print((len(v) // 2))
exit()
"""要素出現数を集計"""
odd_count = Counter(v[1::2])
even_count = Counter(v[::2])
"""一番多く出現する2つの数字を探す"""
max_hit = 0
odd = None
even = None
for odd_va... | from collections import Counter
n = int(eval(input()))
v = list(map(int, input().split()))
"""数字が1種類の場合は半分を書き換える必要が確定"""
if len(set(v)) == 1:
print((len(v) // 2))
exit()
"""要素出現数を集計"""
odd_count = Counter(v[1::2])
even_count = Counter(v[::2])
"""一番多く出現する2つの数字を探す"""
max_hit = 0
odd = None
even = None
for odd_va... | false | 12.121212 | [
"-for odd_val, odd_hit in odd_count.most_common(5):",
"- # if max_hit > odd_hit:",
"- # break # もう最大値は更新されないので打ち止め",
"- for even_val, even_hit in even_count.most_common(5):",
"- # if max_hit > even_hit:",
"- # break # もう最大値は更新されないので打ち止め",
"+for odd_val, odd_hit in odd_co... | false | 0.03771 | 0.036218 | 1.041195 | [
"s793084770",
"s963000172"
] |
u703950586 | p04006 | python | s224679655 | s711184248 | 1,532 | 111 | 72,672 | 75,460 | Accepted | Accepted | 92.75 | import sys,queue,math,copy,itertools,bisect,collections,heapq
def main():
INF = float('inf')
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
N,x = LI()
a = LI()
N0 = 2**(N.bit_length())
st = [INF] * (2*N0)
def update(i,x):
i += N0-1
st[i] = x
... | import sys,queue,math,copy,itertools,bisect,collections,heapq
def main():
INF = float('inf')
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
N,x = LI()
a = LI()
# N0 = 2**(N.bit_length())
# st = [INF] * (2*N0)
def update(i,x):
i += N0-1
st[i] = x
... | 53 | 51 | 1,141 | 1,087 | import sys, queue, math, copy, itertools, bisect, collections, heapq
def main():
INF = float("inf")
LI = lambda: [int(x) for x in sys.stdin.readline().split()]
N, x = LI()
a = LI()
N0 = 2 ** (N.bit_length())
st = [INF] * (2 * N0)
def update(i, x):
i += N0 - 1
st[i] = x
... | import sys, queue, math, copy, itertools, bisect, collections, heapq
def main():
INF = float("inf")
LI = lambda: [int(x) for x in sys.stdin.readline().split()]
N, x = LI()
a = LI()
# N0 = 2**(N.bit_length())
# st = [INF] * (2*N0)
def update(i, x):
i += N0 - 1
st[i] = ... | false | 3.773585 | [
"- N0 = 2 ** (N.bit_length())",
"- st = [INF] * (2 * N0)",
"-",
"+ # N0 = 2**(N.bit_length())",
"+ # st = [INF] * (2*N0)",
"- for i, j in enumerate(a):",
"- update(i, j)",
"+ # for i,j in enumerate(a):",
"+ # update(i,j)",
"+ min_a = copy.copy(a)",
... | false | 0.09409 | 0.037326 | 2.52074 | [
"s224679655",
"s711184248"
] |
u648315264 | p02831 | python | s684426143 | s817018399 | 83 | 74 | 65,908 | 64,876 | Accepted | Accepted | 10.84 | import math
from math import gcd
INF = float("inf")
import sys
input=sys.stdin.readline
import itertools
from collections import Counter
def main():
a,b = list(map(int, input().split()))
ans = max(a,b)
first = ans
m = min(a,b)
while True:
if ans%m == 0:
print(an... | import math
from math import gcd
INF = float("inf")
import sys
input=sys.stdin.readline
import itertools
from collections import Counter
def main():
a,b = list(map(int, input().split()))
print((int(a*b/gcd(a,b))))
if __name__=="__main__":
main()
| 22 | 15 | 399 | 267 | import math
from math import gcd
INF = float("inf")
import sys
input = sys.stdin.readline
import itertools
from collections import Counter
def main():
a, b = list(map(int, input().split()))
ans = max(a, b)
first = ans
m = min(a, b)
while True:
if ans % m == 0:
print(ans)
... | import math
from math import gcd
INF = float("inf")
import sys
input = sys.stdin.readline
import itertools
from collections import Counter
def main():
a, b = list(map(int, input().split()))
print((int(a * b / gcd(a, b))))
if __name__ == "__main__":
main()
| false | 31.818182 | [
"- ans = max(a, b)",
"- first = ans",
"- m = min(a, b)",
"- while True:",
"- if ans % m == 0:",
"- print(ans)",
"- exit()",
"- ans += first",
"+ print((int(a * b / gcd(a, b))))"
] | false | 0.050546 | 0.043434 | 1.163748 | [
"s684426143",
"s817018399"
] |
u764956288 | p02678 | python | s661336816 | s394522803 | 1,287 | 1,088 | 74,136 | 68,204 | Accepted | Accepted | 15.46 | # import sys
# readline = sys.stdin.readline
# generator = (readline().strip() for _ in range(N))
# import numpy as np
# from itertools import permutations
# from itertools import combinations
# from itertools import combinations_with_replacement
import queue
# import heapq
# N, M = map(int, input().split(... | import queue
import sys
readline = sys.stdin.readline
def main():
n_rooms, n_passages = list(map(int, input().split()))
passages = (list(map(int, readline().strip().split())) for _ in range(n_passages))
connections = [set() for _ in range(n_rooms+1)] # type: list
for a, b in passages:
... | 65 | 39 | 1,349 | 866 | # import sys
# readline = sys.stdin.readline
# generator = (readline().strip() for _ in range(N))
# import numpy as np
# from itertools import permutations
# from itertools import combinations
# from itertools import combinations_with_replacement
import queue
# import heapq
# N, M = map(int, input().split())
# As = li... | import queue
import sys
readline = sys.stdin.readline
def main():
n_rooms, n_passages = list(map(int, input().split()))
passages = (list(map(int, readline().strip().split())) for _ in range(n_passages))
connections = [set() for _ in range(n_rooms + 1)] # type: list
for a, b in passages:
conn... | false | 40 | [
"-# import sys",
"-# readline = sys.stdin.readline",
"-# generator = (readline().strip() for _ in range(N))",
"-# import numpy as np",
"-# from itertools import permutations",
"-# from itertools import combinations",
"-# from itertools import combinations_with_replacement",
"+import sys",
"-# import... | false | 0.048713 | 0.051782 | 0.940738 | [
"s661336816",
"s394522803"
] |
u977349332 | p03447 | python | s458367352 | s698961315 | 171 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.06 | X = int(eval(input()))
A = int(eval(input()))
B = int(eval(input()))
X -= A
n = int(X / B)
print((X - n*B))
| X = int(eval(input()))
A = int(eval(input()))
B = int(eval(input()))
print(((X - A) % B))
| 7 | 5 | 95 | 75 | X = int(eval(input()))
A = int(eval(input()))
B = int(eval(input()))
X -= A
n = int(X / B)
print((X - n * B))
| X = int(eval(input()))
A = int(eval(input()))
B = int(eval(input()))
print(((X - A) % B))
| false | 28.571429 | [
"-X -= A",
"-n = int(X / B)",
"-print((X - n * B))",
"+print(((X - A) % B))"
] | false | 0.101565 | 0.042949 | 2.364777 | [
"s458367352",
"s698961315"
] |
u298297089 | p03556 | python | s056735572 | s904327438 | 36 | 17 | 2,940 | 2,940 | Accepted | Accepted | 52.78 | N = int(eval(input()))
ans = 1
for i in range(1,N+1):
if i**2 > N:
break
ans = i**2
print(ans) | n = int(eval(input()))
print((int(n**0.5)**2))
| 7 | 2 | 102 | 40 | N = int(eval(input()))
ans = 1
for i in range(1, N + 1):
if i**2 > N:
break
ans = i**2
print(ans)
| n = int(eval(input()))
print((int(n**0.5) ** 2))
| false | 71.428571 | [
"-N = int(eval(input()))",
"-ans = 1",
"-for i in range(1, N + 1):",
"- if i**2 > N:",
"- break",
"- ans = i**2",
"-print(ans)",
"+n = int(eval(input()))",
"+print((int(n**0.5) ** 2))"
] | false | 0.046992 | 0.035872 | 1.309975 | [
"s056735572",
"s904327438"
] |
u156383602 | p02898 | python | s393558095 | s286789116 | 53 | 49 | 11,912 | 11,912 | Accepted | Accepted | 7.55 | c=0
a = list(map(int,input().split()))
b=list(map(int,input().split()))
for n in range(a[0]):
if b[n]>=a[1]:
c+=1
print(c) | n,k=list(map(int,input().split()))
h=[int(i) for i in input().split()]
h=[i for i in h if i>=k]
print((len(h))) | 8 | 4 | 142 | 106 | c = 0
a = list(map(int, input().split()))
b = list(map(int, input().split()))
for n in range(a[0]):
if b[n] >= a[1]:
c += 1
print(c)
| n, k = list(map(int, input().split()))
h = [int(i) for i in input().split()]
h = [i for i in h if i >= k]
print((len(h)))
| false | 50 | [
"-c = 0",
"-a = list(map(int, input().split()))",
"-b = list(map(int, input().split()))",
"-for n in range(a[0]):",
"- if b[n] >= a[1]:",
"- c += 1",
"-print(c)",
"+n, k = list(map(int, input().split()))",
"+h = [int(i) for i in input().split()]",
"+h = [i for i in h if i >= k]",
"+pri... | false | 0.131149 | 0.157833 | 0.830933 | [
"s393558095",
"s286789116"
] |
u870164956 | p02936 | python | s546887620 | s205237078 | 1,945 | 1,110 | 169,800 | 159,096 | Accepted | Accepted | 42.93 | n, m= list(map(int, input().split()))
links = [[] for x in range(n + 1)]
sums = [0 for x in range(n + 1)]
adds = [0 for x in range(n + 1)]
links[0].append(1)
buf = [list(map(int, input().split())) for _ in range(n - 1)]
for link in buf:
a, b= link
links[a].append(b)
links[b].append(a)
buf = ... | import sys
input = sys.stdin.readline
n, m= list(map(int, input().split()))
links = [[] for x in range(n + 1)]
sums = [0 for x in range(n + 1)]
adds = [0 for x in range(n + 1)]
links[0].append(1)
buf = [list(map(int, input().split())) for _ in range(n - 1)]
for link in buf:
a, b= link
links[a]... | 39 | 43 | 733 | 777 | n, m = list(map(int, input().split()))
links = [[] for x in range(n + 1)]
sums = [0 for x in range(n + 1)]
adds = [0 for x in range(n + 1)]
links[0].append(1)
buf = [list(map(int, input().split())) for _ in range(n - 1)]
for link in buf:
a, b = link
links[a].append(b)
links[b].append(a)
buf = [list(map(int,... | import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
links = [[] for x in range(n + 1)]
sums = [0 for x in range(n + 1)]
adds = [0 for x in range(n + 1)]
links[0].append(1)
buf = [list(map(int, input().split())) for _ in range(n - 1)]
for link in buf:
a, b = link
links[a].append(b)
... | false | 9.302326 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.038539 | 0.047099 | 0.818267 | [
"s546887620",
"s205237078"
] |
u562935282 | p03341 | python | s426775867 | s132627796 | 258 | 173 | 15,392 | 17,616 | Accepted | Accepted | 32.95 | n = int(eval(input()))
s = eval(input())
c_e = [0]
t = 0
for c in s:
if c == 'E':
t += 1
c_e.append(t)
ans = n
for leader in range(n):
ans = min(ans, (leader - c_e[leader]) + (c_e[n] - c_e[leader + 1]))
print(ans)
# 累積和のリストは、1-indexed
| def main():
n = int(eval(input()))
a = [c == 'E' for c in eval(input())]
def accumulate(a):
s = 0
yield s
for x in a:
s += x
yield s
*acc_e, = accumulate(a)
ans = 1 << 30
for i in range(n):
ans = min(ans, (i - acc_e[i]) + ... | 15 | 22 | 259 | 397 | n = int(eval(input()))
s = eval(input())
c_e = [0]
t = 0
for c in s:
if c == "E":
t += 1
c_e.append(t)
ans = n
for leader in range(n):
ans = min(ans, (leader - c_e[leader]) + (c_e[n] - c_e[leader + 1]))
print(ans)
# 累積和のリストは、1-indexed
| def main():
n = int(eval(input()))
a = [c == "E" for c in eval(input())]
def accumulate(a):
s = 0
yield s
for x in a:
s += x
yield s
(*acc_e,) = accumulate(a)
ans = 1 << 30
for i in range(n):
ans = min(ans, (i - acc_e[i]) + (acc_e[n] - ac... | false | 31.818182 | [
"-n = int(eval(input()))",
"-s = eval(input())",
"-c_e = [0]",
"-t = 0",
"-for c in s:",
"- if c == \"E\":",
"- t += 1",
"- c_e.append(t)",
"-ans = n",
"-for leader in range(n):",
"- ans = min(ans, (leader - c_e[leader]) + (c_e[n] - c_e[leader + 1]))",
"-print(ans)",
"-# 累積和の... | false | 0.040521 | 0.041349 | 0.979976 | [
"s426775867",
"s132627796"
] |
u977389981 | p03545 | python | s321115066 | s954181730 | 20 | 18 | 3,060 | 3,060 | Accepted | Accepted | 10 | N = eval(input())
for i in range(2 ** (len(N) - 1)):
s = ''
for n in N:
s += n
if len(s) != len(N) + 3:
if i % 2 != 0:
s += '+'
else:
s += '-'
else:
break
i //= 2
if eval(s) == 7:
print(... | S = eval(input())
op = ['+', '-']
for i in range(2 ** 3):
T = S[0]
for j in range(3):
if i % 2 == 0:
T += op[0]
else:
T += op[1]
i //= 2
T += S[j + 1]
if eval(T) == 7:
print((T + '=7'))
break | 16 | 14 | 338 | 280 | N = eval(input())
for i in range(2 ** (len(N) - 1)):
s = ""
for n in N:
s += n
if len(s) != len(N) + 3:
if i % 2 != 0:
s += "+"
else:
s += "-"
else:
break
i //= 2
if eval(s) == 7:
print((s + "=7"))
... | S = eval(input())
op = ["+", "-"]
for i in range(2**3):
T = S[0]
for j in range(3):
if i % 2 == 0:
T += op[0]
else:
T += op[1]
i //= 2
T += S[j + 1]
if eval(T) == 7:
print((T + "=7"))
break
| false | 12.5 | [
"-N = eval(input())",
"-for i in range(2 ** (len(N) - 1)):",
"- s = \"\"",
"- for n in N:",
"- s += n",
"- if len(s) != len(N) + 3:",
"- if i % 2 != 0:",
"- s += \"+\"",
"- else:",
"- s += \"-\"",
"+S = eval(input())",
"+o... | false | 0.036384 | 0.037042 | 0.982236 | [
"s321115066",
"s954181730"
] |
u263830634 | p03645 | python | s916397983 | s513306251 | 938 | 427 | 51,928 | 33,480 | Accepted | Accepted | 54.48 | N, M = list(map(int,input().split()))
#訪れることができるかのリスト
lst = [0] * N
flag = False #フラグを立てる
for i in range(M): #M種の定期船について確認
a, b = list(map(int,input().split()))
if a == 1: #スタートが1の時
if lst[b-1] == 1: #Nから1回で来る船があるならOK
flag = True
else:
lst[b-1] = 1 #Nから1回で来る... | import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
G = [tuple(map(int, input().split())) for _ in range(M)]
G.sort(key = lambda x: x[0])
check = [False] * (N + 1)
for a, b in G:
if a == 1:
check[b] = True
else:
if check[a] and b == N:
prin... | 26 | 19 | 575 | 372 | N, M = list(map(int, input().split()))
# 訪れることができるかのリスト
lst = [0] * N
flag = False # フラグを立てる
for i in range(M): # M種の定期船について確認
a, b = list(map(int, input().split()))
if a == 1: # スタートが1の時
if lst[b - 1] == 1: # Nから1回で来る船があるならOK
flag = True
else:
lst[b - 1] = 1 # Nから1回... | import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
G = [tuple(map(int, input().split())) for _ in range(M)]
G.sort(key=lambda x: x[0])
check = [False] * (N + 1)
for a, b in G:
if a == 1:
check[b] = True
else:
if check[a] and b == N:
print("POSSIBLE")
... | false | 26.923077 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"-# 訪れることができるかのリスト",
"-lst = [0] * N",
"-flag = False # フラグを立てる",
"-for i in range(M): # M種の定期船について確認",
"- a, b = list(map(int, input().split()))",
"- if a == 1: # スタートが1の時",
"- if lst[b - 1] == 1: # Nから1回で来る船があるならOK",
"- ... | false | 0.043909 | 0.119197 | 0.368374 | [
"s916397983",
"s513306251"
] |
u077291787 | p03589 | python | s719602239 | s611271276 | 192 | 18 | 38,896 | 3,060 | Accepted | Accepted | 90.62 | # tenka1-2017-beginnerC - 4/N
# exhaustive search
def main():
N = int(eval(input()))
for h in range(1, 3501):
for n in range(1, 3501):
numerator = N * h * n
denominator = 4 * h * n - N * n - N * h
if denominator > 0 and numerator % denominator == 0:
... | # tenka1-2017-beginnerC - 4/N
# exhaustive search
def main():
N = int(eval(input()))
for h in range(N // 4 + 1, 3501):
for n in range(N * h // (4 * h - N) + 1, 3501):
numerator = N * h * n
denominator = 4 * h * n - N * n - N * h
if denominator > 0 and numerato... | 16 | 16 | 449 | 481 | # tenka1-2017-beginnerC - 4/N
# exhaustive search
def main():
N = int(eval(input()))
for h in range(1, 3501):
for n in range(1, 3501):
numerator = N * h * n
denominator = 4 * h * n - N * n - N * h
if denominator > 0 and numerator % denominator == 0:
w ... | # tenka1-2017-beginnerC - 4/N
# exhaustive search
def main():
N = int(eval(input()))
for h in range(N // 4 + 1, 3501):
for n in range(N * h // (4 * h - N) + 1, 3501):
numerator = N * h * n
denominator = 4 * h * n - N * n - N * h
if denominator > 0 and numerator % deno... | false | 0 | [
"- for h in range(1, 3501):",
"- for n in range(1, 3501):",
"+ for h in range(N // 4 + 1, 3501):",
"+ for n in range(N * h // (4 * h - N) + 1, 3501):"
] | false | 0.056178 | 0.049054 | 1.145227 | [
"s719602239",
"s611271276"
] |
u347600233 | p02803 | python | s805756277 | s531426871 | 420 | 301 | 3,316 | 3,316 | Accepted | Accepted | 28.33 | from collections import deque
h, w = list(map(int, input().split()))
square = [list(eval(input())) for i in range(h)]
def bfs(si, sj):
que = deque()
que.append((si, sj))
d = [[float('inf')] * w for i in range(h)]
d[si][sj] = 0
move = [(-1, 0), (0, 1), (1, 0), (0, -1)]
while que:
... | from collections import deque
h, w = list(map(int, input().split()))
square = [list(eval(input())) for i in range(h)]
def bfs(si, sj):
INF = 100
que = deque([(si, sj)])
d = [[INF] * w for i in range(h)]
d[si][sj] = 0
move = [(-1, 0), (0, 1), (1, 0), (0, -1)]
while que:
i, j = q... | 25 | 25 | 780 | 761 | from collections import deque
h, w = list(map(int, input().split()))
square = [list(eval(input())) for i in range(h)]
def bfs(si, sj):
que = deque()
que.append((si, sj))
d = [[float("inf")] * w for i in range(h)]
d[si][sj] = 0
move = [(-1, 0), (0, 1), (1, 0), (0, -1)]
while que:
i, j ... | from collections import deque
h, w = list(map(int, input().split()))
square = [list(eval(input())) for i in range(h)]
def bfs(si, sj):
INF = 100
que = deque([(si, sj)])
d = [[INF] * w for i in range(h)]
d[si][sj] = 0
move = [(-1, 0), (0, 1), (1, 0), (0, -1)]
while que:
i, j = que.popl... | false | 0 | [
"- que = deque()",
"- que.append((si, sj))",
"- d = [[float(\"inf\")] * w for i in range(h)]",
"+ INF = 100",
"+ que = deque([(si, sj)])",
"+ d = [[INF] * w for i in range(h)]",
"- and square[ni][nj] != \"#\"",
"- and d[ni][nj] == float(\"inf\")",
"+ ... | false | 0.063935 | 0.07281 | 0.878119 | [
"s805756277",
"s531426871"
] |
u926393759 | p03855 | python | s768029716 | s752319105 | 1,214 | 916 | 56,300 | 46,436 | Accepted | Accepted | 24.55 | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 11 11:26:39 2019
D - 連結 / Connectivity
実行時間制限: 2 sec / メモリ制限: 256 MB
配点 :
400 点
@author: justwah
"""
from collections import Counter
import sys
input = sys.stdin.readline
class UnionFind:
def __init__(self, N):
self.rank = [0]*N
... | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 11 11:26:39 2019
D - 連結 / Connectivity
実行時間制限: 2 sec / メモリ制限: 256 MB
配点 :
400 点
@author: justwah
"""
import sys
input = sys.stdin.readline # use this runtime 1523 ms> 1214ms
class UnionFind:
def __init__(self, n):
self.rank = [0]*n
... | 69 | 69 | 1,676 | 1,489 | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 11 11:26:39 2019
D - 連結 / Connectivity
実行時間制限: 2 sec / メモリ制限: 256 MB
配点 :
400 点
@author: justwah
"""
from collections import Counter
import sys
input = sys.stdin.readline
class UnionFind:
def __init__(self, N):
self.rank = [0] * N
self.parent = [i f... | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 11 11:26:39 2019
D - 連結 / Connectivity
実行時間制限: 2 sec / メモリ制限: 256 MB
配点 :
400 点
@author: justwah
"""
import sys
input = sys.stdin.readline # use this runtime 1523 ms> 1214ms
class UnionFind:
def __init__(self, n):
self.rank = [0] * n
self.parent = ... | false | 0 | [
"-from collections import Counter",
"-input = sys.stdin.readline",
"+input = sys.stdin.readline # use this runtime 1523 ms> 1214ms",
"- def __init__(self, N):",
"- self.rank = [0] * N",
"- self.parent = [i for i in range(N)]",
"- self.n = N",
"+ def __init__(self, n):",
"... | false | 0.039155 | 0.072188 | 0.542406 | [
"s768029716",
"s752319105"
] |
u684241248 | p02259 | python | s783057123 | s898799070 | 30 | 20 | 5,608 | 5,608 | Accepted | Accepted | 33.33 | N = int(eval(input()))
ary = [int(_) for _ in input().split()]
def bubble_sort(ary, verbose=True):
flag = True
count = 0
while flag:
flag = False
i = 0
for j in range(N - 1, i, -1):
if ary[j] < ary[j - 1]:
ary[j], ary[j - 1] = ary[j - 1... | N = int(eval(input()))
ary = [int(_) for _ in input().split()]
def bubble_sort(ary, verbose=True):
flag = True
count = 0
i = 0
while flag:
flag = False
for j in range(N - 1, i, -1):
if ary[j] < ary[j - 1]:
ary[j], ary[j - 1] = ary[j - 1], ary[j]
... | 30 | 25 | 512 | 498 | N = int(eval(input()))
ary = [int(_) for _ in input().split()]
def bubble_sort(ary, verbose=True):
flag = True
count = 0
while flag:
flag = False
i = 0
for j in range(N - 1, i, -1):
if ary[j] < ary[j - 1]:
ary[j], ary[j - 1] = ary[j - 1], ary[j]
... | N = int(eval(input()))
ary = [int(_) for _ in input().split()]
def bubble_sort(ary, verbose=True):
flag = True
count = 0
i = 0
while flag:
flag = False
for j in range(N - 1, i, -1):
if ary[j] < ary[j - 1]:
ary[j], ary[j - 1] = ary[j - 1], ary[j]
... | false | 16.666667 | [
"+ i = 0",
"- i = 0"
] | false | 0.04762 | 0.045765 | 1.04054 | [
"s783057123",
"s898799070"
] |
u600402037 | p02793 | python | s286269446 | s490480500 | 1,737 | 330 | 272,092 | 21,648 | Accepted | Accepted | 81 | # coding: utf-8
import sys
from fractions import gcd
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
MOD = 10 ** 9 + 7
N = ir()
A = lr()
lcm = 1
for a in A:
lcm *= a // gcd(lcm, a)
A = np.array(A)
answer = (lcm // A... | # coding: utf-8
import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# lcm、逆元
MOD = 10 ** 9 + 7
N = ir()
A = np.array(lr())
U = 10 ** 6 + 10
is_prime = np.zeros(U, np.bool)
is_prime[2] = 1
is_prime[3::2] = 1
for p... | 21 | 46 | 378 | 845 | # coding: utf-8
import sys
from fractions import gcd
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
MOD = 10**9 + 7
N = ir()
A = lr()
lcm = 1
for a in A:
lcm *= a // gcd(lcm, a)
A = np.array(A)
answer = (lcm // A).sum() % MOD
print((an... | # coding: utf-8
import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# lcm、逆元
MOD = 10**9 + 7
N = ir()
A = np.array(lr())
U = 10**6 + 10
is_prime = np.zeros(U, np.bool)
is_prime[2] = 1
is_prime[3::2] = 1
for p in range(3, U, 2):
i... | false | 54.347826 | [
"-from fractions import gcd",
"+# lcm、逆元",
"-A = lr()",
"+A = np.array(lr())",
"+U = 10**6 + 10",
"+is_prime = np.zeros(U, np.bool)",
"+is_prime[2] = 1",
"+is_prime[3::2] = 1",
"+for p in range(3, U, 2):",
"+ if p * p > U:",
"+ break",
"+ if is_prime[p]:",
"+ is_prime[p *... | false | 0.633851 | 0.767577 | 0.825782 | [
"s286269446",
"s490480500"
] |
u562935282 | p03032 | python | s626892958 | s110320905 | 220 | 27 | 3,188 | 3,064 | Accepted | Accepted | 87.73 | inf = float('inf')
N, K = list(map(int, input().split()))
v = list(map(int, input().split()))
volume = max(N, K)
take_max = min(N, K)
dpl = [[-inf] * (volume + 1) for _ in range(N + 1)]
dpr = [[-inf] * (volume + 1) for _ in range(N + 1)]
dpl[0][0] = dpr[0][0] = 0
for i, vv in enumerate(v, 1):
for t... | N, K = list(map(int, input().split()))
v = list(map(int, input().split()))
max_pick = min(K, N)
ans = 0
# 左右から取る量を決め打ち
for left in range(max_pick + 1):
for right in range(max_pick - left + 1):
t = v[:left] + v[N - right:]
m = sorted([x for x in t if x < 0])[:K - left - right]
... | 38 | 14 | 1,471 | 361 | inf = float("inf")
N, K = list(map(int, input().split()))
v = list(map(int, input().split()))
volume = max(N, K)
take_max = min(N, K)
dpl = [[-inf] * (volume + 1) for _ in range(N + 1)]
dpr = [[-inf] * (volume + 1) for _ in range(N + 1)]
dpl[0][0] = dpr[0][0] = 0
for i, vv in enumerate(v, 1):
for take in range(i + ... | N, K = list(map(int, input().split()))
v = list(map(int, input().split()))
max_pick = min(K, N)
ans = 0
# 左右から取る量を決め打ち
for left in range(max_pick + 1):
for right in range(max_pick - left + 1):
t = v[:left] + v[N - right :]
m = sorted([x for x in t if x < 0])[: K - left - right]
ans = max(ans... | false | 63.157895 | [
"-inf = float(\"inf\")",
"-volume = max(N, K)",
"-take_max = min(N, K)",
"-dpl = [[-inf] * (volume + 1) for _ in range(N + 1)]",
"-dpr = [[-inf] * (volume + 1) for _ in range(N + 1)]",
"-dpl[0][0] = dpr[0][0] = 0",
"-for i, vv in enumerate(v, 1):",
"- for take in range(i + 1):",
"- dpl[i][... | false | 0.062518 | 0.037673 | 1.659495 | [
"s626892958",
"s110320905"
] |
u906501980 | p02696 | python | s533841933 | s200022707 | 60 | 27 | 61,836 | 9,088 | Accepted | Accepted | 55 | def main():
a, b, n = list(map(int, input().split()))
x = min(b-1, n)
print(((a*x)//b-a*(x//b)))
if __name__ == "__main__":
main() | def main():
a, b, n = list(map(int, input().split()))
x = min(b-1, n)
print((a*x//b - a*(x//b)))
if __name__ == "__main__":
main() | 7 | 7 | 145 | 145 | def main():
a, b, n = list(map(int, input().split()))
x = min(b - 1, n)
print(((a * x) // b - a * (x // b)))
if __name__ == "__main__":
main()
| def main():
a, b, n = list(map(int, input().split()))
x = min(b - 1, n)
print((a * x // b - a * (x // b)))
if __name__ == "__main__":
main()
| false | 0 | [
"- print(((a * x) // b - a * (x // b)))",
"+ print((a * x // b - a * (x // b)))"
] | false | 0.04276 | 0.084739 | 0.504607 | [
"s533841933",
"s200022707"
] |
u682672120 | p02596 | python | s153603378 | s447436386 | 202 | 66 | 156,556 | 63,444 | Accepted | Accepted | 67.33 | k = int(eval(input()))
x, i = 0, 0
r = set()
while True:
x = (x * 10 + 7) % k
i += 1
if x == 0:
break
if x in r:
print((-1))
quit()
r.add(x)
print(i) | def power(x, n, mod):
ans = 1
while n > 0:
if n % 2 == 1:
ans = ans * x % mod
n //= 2
x = x * x % mod
return ans
def eular(n):
ans = 1
if n % 2 == 0:
x = 1
while n % 2 == 0:
n //= 2
x *= 2
ans *= x -... | 13 | 56 | 197 | 1,033 | k = int(eval(input()))
x, i = 0, 0
r = set()
while True:
x = (x * 10 + 7) % k
i += 1
if x == 0:
break
if x in r:
print((-1))
quit()
r.add(x)
print(i)
| def power(x, n, mod):
ans = 1
while n > 0:
if n % 2 == 1:
ans = ans * x % mod
n //= 2
x = x * x % mod
return ans
def eular(n):
ans = 1
if n % 2 == 0:
x = 1
while n % 2 == 0:
n //= 2
x *= 2
ans *= x - x // 2
i =... | false | 76.785714 | [
"+def power(x, n, mod):",
"+ ans = 1",
"+ while n > 0:",
"+ if n % 2 == 1:",
"+ ans = ans * x % mod",
"+ n //= 2",
"+ x = x * x % mod",
"+ return ans",
"+",
"+",
"+def eular(n):",
"+ ans = 1",
"+ if n % 2 == 0:",
"+ x = 1",
"+ ... | false | 0.227743 | 0.045596 | 4.994798 | [
"s153603378",
"s447436386"
] |
u918601425 | p02972 | python | s449908657 | s392440652 | 757 | 196 | 20,548 | 21,320 | Accepted | Accepted | 74.11 | N=int(eval(input()))
lst = [int(s) for s in input().split()]
ans=[0]*N
result=[]
def now(num):
res=0
k=1
while(k*num<=N):
res=res+ans[k*num-1]
k=k+1
return res%2
for i in range(N):
n=N-i
x=lst[n-1]
y=now(n)
if(x!=y):
ans[n-1]=1
result.append(n)
result.sort()
print((len... | N=int(eval(input()))
binaly=[int(s) for s in input().split()]
boxes=[0 for _ in range(N)]
ans=set()
for i in range(N-1,-1,-1):
if sum(boxes[i::i+1])%2!=binaly[i]:
boxes[i]=1
ans.add(i+1)
print((len(ans)))
print((*ans)) | 22 | 12 | 381 | 231 | N = int(eval(input()))
lst = [int(s) for s in input().split()]
ans = [0] * N
result = []
def now(num):
res = 0
k = 1
while k * num <= N:
res = res + ans[k * num - 1]
k = k + 1
return res % 2
for i in range(N):
n = N - i
x = lst[n - 1]
y = now(n)
if x != y:
ans... | N = int(eval(input()))
binaly = [int(s) for s in input().split()]
boxes = [0 for _ in range(N)]
ans = set()
for i in range(N - 1, -1, -1):
if sum(boxes[i :: i + 1]) % 2 != binaly[i]:
boxes[i] = 1
ans.add(i + 1)
print((len(ans)))
print((*ans))
| false | 45.454545 | [
"-lst = [int(s) for s in input().split()]",
"-ans = [0] * N",
"-result = []",
"-",
"-",
"-def now(num):",
"- res = 0",
"- k = 1",
"- while k * num <= N:",
"- res = res + ans[k * num - 1]",
"- k = k + 1",
"- return res % 2",
"-",
"-",
"-for i in range(N):",
"- ... | false | 0.090091 | 0.045275 | 1.989847 | [
"s449908657",
"s392440652"
] |
u535423069 | p03147 | python | s187885288 | s504720112 | 50 | 20 | 3,064 | 3,064 | Accepted | Accepted | 60 | import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()
n = ni()
a = na()
res = 0
while sum(a):
res += 1
f = False
for i in range(n):
if a[i] > 0:
... | import sys
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range... | 24 | 37 | 420 | 910 | import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()
n = ni()
a = na()
res = 0
while sum(a):
res += 1
f = False
for i in range(n):
if a[i] > 0:
a[i] -= 1
... | import sys
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdi... | false | 35.135135 | [
"+inf = 1 << 60",
"+mod = 1000000007",
"+nin = lambda y: [ni() for _ in range(y)]",
"+nan = lambda y: [na() for _ in range(y)]",
"+nf = lambda: float(ns())",
"+nfn = lambda y: [nf() for _ in range(y)]",
"+nfa = lambda: list(map(float, stdin.readline().split()))",
"+nfan = lambda y: [nfa() for _ in ran... | false | 0.036956 | 0.073055 | 0.505862 | [
"s187885288",
"s504720112"
] |
u390193191 | p02662 | python | s253424452 | s652102381 | 297 | 124 | 147,764 | 68,760 | Accepted | Accepted | 58.25 | N, S = list(map(int,input().split()))
A = list(map(int,input().split()))
mod = 998244353
dp = [[0 for j in range(S + 1)] for i in range(N + 1)]
dp[0][0] = 1
for i in range(N) :
for j in range(S + 1) :
dp[i + 1][j] += 2 * dp[i][j]
dp[i + 1][j] %= mod
if j + A[i] <= S :
... | N, S = list(map(int, input().split()))
A = list(map(int, input().split()))
mod = 998244353
dp = [0 for j in range(S + 1)]
dp[0] = 1
for i in range(N):
for j in reversed(list(range(S + 1))):
dp[j] = (2*dp[j])%mod if j < A[i] else (2*dp[j] + dp[j-A[i]])%mod
print((dp[S])) | 13 | 9 | 405 | 276 | N, S = list(map(int, input().split()))
A = list(map(int, input().split()))
mod = 998244353
dp = [[0 for j in range(S + 1)] for i in range(N + 1)]
dp[0][0] = 1
for i in range(N):
for j in range(S + 1):
dp[i + 1][j] += 2 * dp[i][j]
dp[i + 1][j] %= mod
if j + A[i] <= S:
dp[i + 1][j ... | N, S = list(map(int, input().split()))
A = list(map(int, input().split()))
mod = 998244353
dp = [0 for j in range(S + 1)]
dp[0] = 1
for i in range(N):
for j in reversed(list(range(S + 1))):
dp[j] = (2 * dp[j]) % mod if j < A[i] else (2 * dp[j] + dp[j - A[i]]) % mod
print((dp[S]))
| false | 30.769231 | [
"-dp = [[0 for j in range(S + 1)] for i in range(N + 1)]",
"-dp[0][0] = 1",
"+dp = [0 for j in range(S + 1)]",
"+dp[0] = 1",
"- for j in range(S + 1):",
"- dp[i + 1][j] += 2 * dp[i][j]",
"- dp[i + 1][j] %= mod",
"- if j + A[i] <= S:",
"- dp[i + 1][j + A[i]] += dp[i... | false | 0.035843 | 0.040988 | 0.874463 | [
"s253424452",
"s652102381"
] |
u260216890 | p02588 | python | s672096615 | s351955595 | 1,394 | 499 | 80,372 | 76,780 | Accepted | Accepted | 64.2 | def decomp(m):
p2=0
p5=0
while m%2==0:
m//=2
p2+=1
while m%5==0:
m//=5
p5+=1
return p2,p5
n=int(eval(input()))
table=[[0]*50 for _ in range(50)]
ans=0
for i in range(n):
a=input().split('.')
if len(a)==1:
ax=int(a[0]+'0'*9)
else:... | def decomp(m):
p2=0
p5=0
while m%2==0:
m//=2
p2+=1
if p2>18:
break
while m%5==0:
m//=5
p5+=1
if p5>18:
break
return p2,p5
n=int(eval(input()))
table=[[0]*20 for _ in range(20)]
ans=0
for i in range(n):
a=... | 27 | 28 | 506 | 518 | def decomp(m):
p2 = 0
p5 = 0
while m % 2 == 0:
m //= 2
p2 += 1
while m % 5 == 0:
m //= 5
p5 += 1
return p2, p5
n = int(eval(input()))
table = [[0] * 50 for _ in range(50)]
ans = 0
for i in range(n):
a = input().split(".")
if len(a) == 1:
ax = int(a[0... | def decomp(m):
p2 = 0
p5 = 0
while m % 2 == 0:
m //= 2
p2 += 1
if p2 > 18:
break
while m % 5 == 0:
m //= 5
p5 += 1
if p5 > 18:
break
return p2, p5
n = int(eval(input()))
table = [[0] * 20 for _ in range(20)]
ans = 0
for i in r... | false | 3.571429 | [
"+ if p2 > 18:",
"+ break",
"+ if p5 > 18:",
"+ break",
"-table = [[0] * 50 for _ in range(50)]",
"+table = [[0] * 20 for _ in range(20)]",
"- a = input().split(\".\")",
"- if len(a) == 1:",
"- ax = int(a[0] + \"0\" * 9)",
"- else:",
"- ... | false | 0.10799 | 0.035901 | 3.008014 | [
"s672096615",
"s351955595"
] |
u724548524 | p02283 | python | s917363724 | s055673446 | 7,600 | 6,250 | 126,224 | 125,576 | Accepted | Accepted | 17.76 | import copy
class Node():
def __init__(self, parent = -1, left = -1, right = -1):
self.parent = parent
self.left = left
self.right = right
def __eq__(self, other):
if self.num == other.num:
return True
else:
return False
def ... | import sys
class Node():
def __init__(self, parent = -1, left = -1, right = -1):
self.parent = parent
self.left = left
self.right = right
def __eq__(self, other):
if self.num == other.num:
return True
else:
return False
def... | 62 | 61 | 1,376 | 1,329 | import copy
class Node:
def __init__(self, parent=-1, left=-1, right=-1):
self.parent = parent
self.left = left
self.right = right
def __eq__(self, other):
if self.num == other.num:
return True
else:
return False
def insert(node, z):
globa... | import sys
class Node:
def __init__(self, parent=-1, left=-1, right=-1):
self.parent = parent
self.left = left
self.right = right
def __eq__(self, other):
if self.num == other.num:
return True
else:
return False
def insert(node, z):
global... | false | 1.612903 | [
"-import copy",
"+import sys",
"-n = int(input())",
"+input()",
"-for i in range(n):",
"- s = input()",
"- if s == \"print\":",
"+for s in sys.stdin:",
"+ if s[0] == \"p\":",
"- s = s.split()",
"- insert(node, int(s[1]))",
"+ insert(node, int(s[7:]))"
] | false | 0.039095 | 0.039285 | 0.995162 | [
"s917363724",
"s055673446"
] |
u941047297 | p03363 | python | s923835198 | s254160271 | 161 | 128 | 53,560 | 44,472 | Accepted | Accepted | 20.5 | from collections import Counter
from operator import mul
from functools import reduce
def main():
def combinations_count(n, r):
r = min(r, n - r)
numer = reduce(mul, list(range(n, n - r, -1)), 1)
denom = reduce(mul, list(range(1, r + 1)), 1)
return numer // denom
n = int... | from itertools import accumulate
from collections import Counter
def main():
n = int(eval(input()))
A = list(map(int, input().split()))
B = [0, ] + list(accumulate(A))
c = Counter(B)
ans = 0
for k, v in list(c.items()):
ans += v * (v - 1) // 2
print(ans)
if __name__ ... | 27 | 14 | 676 | 335 | from collections import Counter
from operator import mul
from functools import reduce
def main():
def combinations_count(n, r):
r = min(r, n - r)
numer = reduce(mul, list(range(n, n - r, -1)), 1)
denom = reduce(mul, list(range(1, r + 1)), 1)
return numer // denom
n = int(eval(... | from itertools import accumulate
from collections import Counter
def main():
n = int(eval(input()))
A = list(map(int, input().split()))
B = [
0,
] + list(accumulate(A))
c = Counter(B)
ans = 0
for k, v in list(c.items()):
ans += v * (v - 1) // 2
print(ans)
if __name__ ... | false | 48.148148 | [
"+from itertools import accumulate",
"-from operator import mul",
"-from functools import reduce",
"- def combinations_count(n, r):",
"- r = min(r, n - r)",
"- numer = reduce(mul, list(range(n, n - r, -1)), 1)",
"- denom = reduce(mul, list(range(1, r + 1)), 1)",
"- retur... | false | 0.038242 | 0.056795 | 0.673323 | [
"s923835198",
"s254160271"
] |
u188827677 | p03282 | python | s601022446 | s804551713 | 28 | 25 | 8,992 | 9,168 | Accepted | Accepted | 10.71 | s = eval(input())
k = int(eval(input()))
n = len(s)
if n == 1 or k == 1: print((s[0]))
else:
for i in range(n):
if s[i] == "1":
k -= 1
if k == 0:
print((s[i]))
break
else:
print((s[i]))
break | s = eval(input())
k = int(eval(input()))
ans = 1
for i in range(len(s)):
if s[i] == "1":
k -= 1
if k == 0: break
else:
ans = s[i]
break
print(ans) | 15 | 12 | 239 | 166 | s = eval(input())
k = int(eval(input()))
n = len(s)
if n == 1 or k == 1:
print((s[0]))
else:
for i in range(n):
if s[i] == "1":
k -= 1
if k == 0:
print((s[i]))
break
else:
print((s[i]))
break
| s = eval(input())
k = int(eval(input()))
ans = 1
for i in range(len(s)):
if s[i] == "1":
k -= 1
if k == 0:
break
else:
ans = s[i]
break
print(ans)
| false | 20 | [
"-n = len(s)",
"-if n == 1 or k == 1:",
"- print((s[0]))",
"-else:",
"- for i in range(n):",
"- if s[i] == \"1\":",
"- k -= 1",
"- if k == 0:",
"- print((s[i]))",
"- break",
"- else:",
"- print((s[i]))",
"+ans... | false | 0.078756 | 0.077247 | 1.019524 | [
"s601022446",
"s804551713"
] |
u894258749 | p02863 | python | s149939824 | s451652460 | 665 | 486 | 177,160 | 48,464 | Accepted | Accepted | 26.92 | import sys
sys.setrecursionlimit(10**9)
input = lambda: sys.stdin.readline().rstrip()
inpl = lambda: list(map(int,input().split()))
N, T = inpl()
A = [None]*N
B = [None]*N
for i in range(N):
A[i], B[i] = inpl()
dp_intime = [[0]*T for _ in range(N+1)]
dp_total = [[0]*T for _ in range(N+1)]
for n in rang... | import sys
input = lambda: sys.stdin.readline().rstrip()
inpl = lambda: list(map(int,input().split()))
N, T = inpl()
A = [None]*N
B = [None]*N
for i in range(N):
A[i], B[i] = inpl()
dp_intime = [0]*T
dp_total = [0]*T
for n in range(N):
dp_intime_prev, dp_intime = dp_intime, [0]*T
dp_total_prev... | 23 | 24 | 809 | 792 | import sys
sys.setrecursionlimit(10**9)
input = lambda: sys.stdin.readline().rstrip()
inpl = lambda: list(map(int, input().split()))
N, T = inpl()
A = [None] * N
B = [None] * N
for i in range(N):
A[i], B[i] = inpl()
dp_intime = [[0] * T for _ in range(N + 1)]
dp_total = [[0] * T for _ in range(N + 1)]
for n in ran... | import sys
input = lambda: sys.stdin.readline().rstrip()
inpl = lambda: list(map(int, input().split()))
N, T = inpl()
A = [None] * N
B = [None] * N
for i in range(N):
A[i], B[i] = inpl()
dp_intime = [0] * T
dp_total = [0] * T
for n in range(N):
dp_intime_prev, dp_intime = dp_intime, [0] * T
dp_total_prev, ... | false | 4.166667 | [
"-sys.setrecursionlimit(10**9)",
"-dp_intime = [[0] * T for _ in range(N + 1)]",
"-dp_total = [[0] * T for _ in range(N + 1)]",
"-for n in range(1, N + 1):",
"+dp_intime = [0] * T",
"+dp_total = [0] * T",
"+for n in range(N):",
"+ dp_intime_prev, dp_intime = dp_intime, [0] * T",
"+ dp_total_pr... | false | 0.037315 | 0.036494 | 1.022498 | [
"s149939824",
"s451652460"
] |
u027685417 | p02947 | python | s794603270 | s952345998 | 443 | 306 | 11,252 | 10,640 | Accepted | Accepted | 30.93 | n = int(eval(input()))
S = []
for _ in range(n):
s = list(eval(input()))
s.sort()
S.append("".join(s))
S.sort()
C = []
c = 1
for i in range(n - 1):
if S[i] == S[i + 1]:
c += 1
else:
C.append(c)
c = 1
C.append(c)
ans = 0
for c in C:
ans += c * (c - ... | import sys
input = sys.stdin.readline
n = int(eval(input()))
S = []
for _ in range(n):
s = "".join(sorted(input().strip()))
S.append(s)
S.sort()
answer = 0
count = 1
for i in range(n - 1):
if S[i] == S[i + 1]:
count += 1
else:
answer += count * (count - 1) // 2
... | 24 | 25 | 330 | 386 | n = int(eval(input()))
S = []
for _ in range(n):
s = list(eval(input()))
s.sort()
S.append("".join(s))
S.sort()
C = []
c = 1
for i in range(n - 1):
if S[i] == S[i + 1]:
c += 1
else:
C.append(c)
c = 1
C.append(c)
ans = 0
for c in C:
ans += c * (c - 1) // 2
print(ans)
| import sys
input = sys.stdin.readline
n = int(eval(input()))
S = []
for _ in range(n):
s = "".join(sorted(input().strip()))
S.append(s)
S.sort()
answer = 0
count = 1
for i in range(n - 1):
if S[i] == S[i + 1]:
count += 1
else:
answer += count * (count - 1) // 2
count = 1
answer ... | false | 4 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"- s = list(eval(input()))",
"- s.sort()",
"- S.append(\"\".join(s))",
"+ s = \"\".join(sorted(input().strip()))",
"+ S.append(s)",
"-C = []",
"-c = 1",
"+answer = 0",
"+count = 1",
"- c += 1",
"+ count += 1",
... | false | 0.036431 | 0.040673 | 0.895718 | [
"s794603270",
"s952345998"
] |
u250583425 | p02700 | python | s782470941 | s833372991 | 26 | 20 | 9,196 | 9,176 | Accepted | Accepted | 23.08 | import sys
def input(): return sys.stdin.readline().rstrip()
def main():
A, B, C, D = list(map(int, input().split()))
while True:
C -= B
if C <= 0:
print('Yes')
exit()
A -= D
if A <= 0:
print('No')
exit()
if __name_... | import sys
def input(): return sys.stdin.readline().rstrip()
def main():
A, B, C, D = list(map(int, input().split()))
A_dead = (A + D - 1) // D
C_dead = (C + B - 1) // B
if A_dead >= C_dead:
print('Yes')
else:
print('No')
if __name__ == '__main__':
main()
| 17 | 14 | 343 | 305 | import sys
def input():
return sys.stdin.readline().rstrip()
def main():
A, B, C, D = list(map(int, input().split()))
while True:
C -= B
if C <= 0:
print("Yes")
exit()
A -= D
if A <= 0:
print("No")
exit()
if __name__ == "_... | import sys
def input():
return sys.stdin.readline().rstrip()
def main():
A, B, C, D = list(map(int, input().split()))
A_dead = (A + D - 1) // D
C_dead = (C + B - 1) // B
if A_dead >= C_dead:
print("Yes")
else:
print("No")
if __name__ == "__main__":
main()
| false | 17.647059 | [
"- while True:",
"- C -= B",
"- if C <= 0:",
"- print(\"Yes\")",
"- exit()",
"- A -= D",
"- if A <= 0:",
"- print(\"No\")",
"- exit()",
"+ A_dead = (A + D - 1) // D",
"+ C_dead = (C + B - 1) // B",
"+ if A_dead... | false | 0.107807 | 0.039562 | 2.725029 | [
"s782470941",
"s833372991"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.