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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u254871849 | p02844 | python | s666786500 | s482631693 | 327 | 212 | 50,672 | 49,652 | Accepted | Accepted | 35.17 | import sys
from string import digits
def main():
n, s = sys.stdin.read().split()
n = int(n)
place = dict((i, set()) for i in digits)
for i in range(n):
place[s[i]].add(i)
l = [None] * n
l[0] = set()
for i in range(1, n):
l[i] = l[i-1] | set([s[i-1]])
... | import sys
from string import digits
def main():
n, s = sys.stdin.read().split()
n = int(n)
place = dict((i, list()) for i in digits)
for i in range(n):
place[s[i]].append(i)
l = [None] * n
l[0] = set()
for i in range(1, n):
l[i] = l[i-1] | set([s[i-1]])
... | 37 | 39 | 841 | 896 | import sys
from string import digits
def main():
n, s = sys.stdin.read().split()
n = int(n)
place = dict((i, set()) for i in digits)
for i in range(n):
place[s[i]].add(i)
l = [None] * n
l[0] = set()
for i in range(1, n):
l[i] = l[i - 1] | set([s[i - 1]])
r = [None] * n
... | import sys
from string import digits
def main():
n, s = sys.stdin.read().split()
n = int(n)
place = dict((i, list()) for i in digits)
for i in range(n):
place[s[i]].append(i)
l = [None] * n
l[0] = set()
for i in range(1, n):
l[i] = l[i - 1] | set([s[i - 1]])
r = [None] ... | false | 5.128205 | [
"- place = dict((i, set()) for i in digits)",
"+ place = dict((i, list()) for i in digits)",
"- place[s[i]].add(i)",
"+ place[s[i]].append(i)",
"+ p = place[j]",
"+ if not p:",
"+ continue",
"- for c in place[j]:",
"+ for c i... | false | 0.041363 | 0.042497 | 0.973326 | [
"s666786500",
"s482631693"
] |
u814387366 | p02388 | python | s247540129 | s814445341 | 20 | 10 | 4,176 | 4,176 | Accepted | Accepted | 50 | x=eval(input())
print(x*x*x) | print(input()**3) | 2 | 1 | 22 | 16 | x = eval(input())
print(x * x * x)
| print(input() ** 3)
| false | 50 | [
"-x = eval(input())",
"-print(x * x * x)",
"+print(input() ** 3)"
] | false | 0.032076 | 0.03739 | 0.857884 | [
"s247540129",
"s814445341"
] |
u945181840 | p02851 | python | s855812793 | s631257162 | 332 | 245 | 42,124 | 41,760 | Accepted | Accepted | 26.2 | import sys
from collections import Counter
from itertools import accumulate
read = sys.stdin.read
N, K, *A = list(map(int, read().split()))
a = list(accumulate([0] + A))
a = [(a[i] - i) % K for i in range(N + 1)]
def cmb(x):
return x * (x - 1) // 2
answer = 0
if N < K:
for i in list(Counter... | import sys
from collections import defaultdict
from itertools import accumulate
read = sys.stdin.read
N, K, *A = list(map(int, read().split()))
a = list(accumulate([0] + A))
a = [(a[i] - i) % K for i in range(N + 1)]
answer = 0
dic = defaultdict(int)
for i, x in enumerate(a):
answer += dic[x]
d... | 29 | 19 | 572 | 393 | import sys
from collections import Counter
from itertools import accumulate
read = sys.stdin.read
N, K, *A = list(map(int, read().split()))
a = list(accumulate([0] + A))
a = [(a[i] - i) % K for i in range(N + 1)]
def cmb(x):
return x * (x - 1) // 2
answer = 0
if N < K:
for i in list(Counter(a).values()):
... | import sys
from collections import defaultdict
from itertools import accumulate
read = sys.stdin.read
N, K, *A = list(map(int, read().split()))
a = list(accumulate([0] + A))
a = [(a[i] - i) % K for i in range(N + 1)]
answer = 0
dic = defaultdict(int)
for i, x in enumerate(a):
answer += dic[x]
dic[x] += 1
i... | false | 34.482759 | [
"-from collections import Counter",
"+from collections import defaultdict",
"-",
"-",
"-def cmb(x):",
"- return x * (x - 1) // 2",
"-",
"-",
"-if N < K:",
"- for i in list(Counter(a).values()):",
"- answer += cmb(i)",
"-else:",
"- dic = Counter(a[:K])",
"- for i in list(... | false | 0.040716 | 0.040872 | 0.996193 | [
"s855812793",
"s631257162"
] |
u077291787 | p03438 | python | s817350588 | s085592894 | 26 | 24 | 4,596 | 5,236 | Accepted | Accepted | 7.69 | # APC001B - Two Arrays
import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
A = tuple(map(int, input().split()))
B = tuple(map(int, input().split()))
cnt = 0
for a, b in zip(A, B):
if a > b:
cnt += a - b
else:
cnt -= (b - ... | # APC001B - Two Arrays
def main():
N, *AB = list(map(int, open(0).read().split()))
A, B = AB[:N], AB[N:]
cnt = 0
for a, b in zip(A, B):
if a > b:
cnt += a - b
else:
cnt -= (b - a) // 2
print(("Yes" if cnt <= 0 else "No"))
if __name__ == "__main_... | 21 | 15 | 405 | 327 | # APC001B - Two Arrays
import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
A = tuple(map(int, input().split()))
B = tuple(map(int, input().split()))
cnt = 0
for a, b in zip(A, B):
if a > b:
cnt += a - b
else:
cnt -= (b - a) // 2
pri... | # APC001B - Two Arrays
def main():
N, *AB = list(map(int, open(0).read().split()))
A, B = AB[:N], AB[N:]
cnt = 0
for a, b in zip(A, B):
if a > b:
cnt += a - b
else:
cnt -= (b - a) // 2
print(("Yes" if cnt <= 0 else "No"))
if __name__ == "__main__":
main(... | false | 28.571429 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-",
"-",
"- n = int(eval(input()))",
"- A = tuple(map(int, input().split()))",
"- B = tuple(map(int, input().split()))",
"+ N, *AB = list(map(int, open(0).read().split()))",
"+ A, B = AB[:N], AB[N:]"
] | false | 0.067063 | 0.058001 | 1.156238 | [
"s817350588",
"s085592894"
] |
u046187684 | p03339 | python | s801148484 | s124842656 | 281 | 162 | 21,572 | 21,572 | Accepted | Accepted | 42.35 | def solve(string):
n, s = string.split()
n = int(n)
es = {i for i, _s in enumerate(s) if _s == "E"}
num_e = len(es)
num_w = n - num_e
count_e = 0
count_w = 0
ans = n
for i, _s in enumerate(s):
tmp = [count_e, count_w]
if i in es:
count_e += 1... | def solve(string):
n, s = string.split()
n = int(n)
es = {i for i, _s in enumerate(s) if _s == "E"}
num_e = len(es)
count_e = 0
count_w = 0
ans = n
for i, _s in enumerate(s):
tmp = count_w
if i in es:
count_e += 1
else:
count... | 23 | 22 | 556 | 491 | def solve(string):
n, s = string.split()
n = int(n)
es = {i for i, _s in enumerate(s) if _s == "E"}
num_e = len(es)
num_w = n - num_e
count_e = 0
count_w = 0
ans = n
for i, _s in enumerate(s):
tmp = [count_e, count_w]
if i in es:
count_e += 1
else:... | def solve(string):
n, s = string.split()
n = int(n)
es = {i for i, _s in enumerate(s) if _s == "E"}
num_e = len(es)
count_e = 0
count_w = 0
ans = n
for i, _s in enumerate(s):
tmp = count_w
if i in es:
count_e += 1
else:
count_w += 1
... | false | 4.347826 | [
"- num_w = n - num_e",
"- tmp = [count_e, count_w]",
"+ tmp = count_w",
"- tmp += [num_e - count_e, num_w - count_w]",
"- ans = min(ans, tmp[1] + tmp[2])",
"+ tmp += num_e - count_e",
"+ ans = min(ans, tmp)"
] | false | 0.038238 | 0.060991 | 0.626945 | [
"s801148484",
"s124842656"
] |
u685263709 | p03108 | python | s407126723 | s605197934 | 1,665 | 879 | 148,088 | 38,116 | Accepted | Accepted | 47.21 | import collections
N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(M)]
class UnitDict(dict):
def __init__(self, iterable=None, wrapper=lambda x: x):
super().__init__(self)
self.wrapper = wrapper
if iterable is not None:
... | N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(M)]
class UnionFind():
def __init__(self, N):
self.rank = [0] * N
self.par = [i for i in range(N)]
self.counter = [1] * N
def find(self, x):
if self.par[x] == x:
... | 80 | 52 | 2,308 | 1,352 | import collections
N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(M)]
class UnitDict(dict):
def __init__(self, iterable=None, wrapper=lambda x: x):
super().__init__(self)
self.wrapper = wrapper
if iterable is not None:
self.update(i... | N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(M)]
class UnionFind:
def __init__(self, N):
self.rank = [0] * N
self.par = [i for i in range(N)]
self.counter = [1] * N
def find(self, x):
if self.par[x] == x:
return x
... | false | 35 | [
"-import collections",
"-",
"-class UnitDict(dict):",
"- def __init__(self, iterable=None, wrapper=lambda x: x):",
"- super().__init__(self)",
"- self.wrapper = wrapper",
"- if iterable is not None:",
"- self.update(iterable)",
"+class UnionFind:",
"+ def __in... | false | 0.041477 | 0.036481 | 1.136929 | [
"s407126723",
"s605197934"
] |
u066455063 | p02570 | python | s680931969 | s142275991 | 28 | 25 | 9,132 | 9,084 | Accepted | Accepted | 10.71 | d, t, s = list(map(int, input().split()))
print(("Yes" if d / s <= t else "No"))
| d, t, s = list(map(int, input().split()))
print(("Yes" if t * s >= d else "No")) | 3 | 3 | 76 | 75 | d, t, s = list(map(int, input().split()))
print(("Yes" if d / s <= t else "No"))
| d, t, s = list(map(int, input().split()))
print(("Yes" if t * s >= d else "No"))
| false | 0 | [
"-print((\"Yes\" if d / s <= t else \"No\"))",
"+print((\"Yes\" if t * s >= d else \"No\"))"
] | false | 0.033919 | 0.059313 | 0.571859 | [
"s680931969",
"s142275991"
] |
u579015878 | p02624 | python | s906853797 | s667772923 | 2,997 | 2,352 | 9,152 | 9,080 | Accepted | Accepted | 21.52 | n=int(eval(input()))
ans=0
for i in range(1,n+1):
key=n//i
ans+=int(key*(key+1)*i/2)
print(ans) | n=int(eval(input()))
ans=0
for i in range(1,n+1):
key=n//i
ans+=(key*(key+1)*i//2)
print(ans) | 6 | 6 | 98 | 96 | n = int(eval(input()))
ans = 0
for i in range(1, n + 1):
key = n // i
ans += int(key * (key + 1) * i / 2)
print(ans)
| n = int(eval(input()))
ans = 0
for i in range(1, n + 1):
key = n // i
ans += key * (key + 1) * i // 2
print(ans)
| false | 0 | [
"- ans += int(key * (key + 1) * i / 2)",
"+ ans += key * (key + 1) * i // 2"
] | false | 1.039537 | 0.777972 | 1.336214 | [
"s906853797",
"s667772923"
] |
u987170100 | p03147 | python | s618230754 | s630719661 | 328 | 19 | 21,540 | 3,064 | Accepted | Accepted | 94.21 | import numpy as np
N = int(eval(input()))
lst = [int(x) for x in input().split()]
lst2 = np.zeros((max(lst), N))
for idx, n in enumerate(lst):
lst2[:n,idx] = 1
ret = 0
for x in lst2:
flg = True
for y in x:
if flg and y == 1:
ret += 1
flg = False
elif ... | N = int(eval(input()))
lst = [int(x) for x in input().split()]
n = max(lst)
h = 1
ret = 0
while n >= h:
flg = True
for x in lst:
if x >= h and flg:
ret += 1
flg = False
elif h > x:
flg = True
h += 1
print(ret) | 18 | 16 | 357 | 283 | import numpy as np
N = int(eval(input()))
lst = [int(x) for x in input().split()]
lst2 = np.zeros((max(lst), N))
for idx, n in enumerate(lst):
lst2[:n, idx] = 1
ret = 0
for x in lst2:
flg = True
for y in x:
if flg and y == 1:
ret += 1
flg = False
elif y == 0:
... | N = int(eval(input()))
lst = [int(x) for x in input().split()]
n = max(lst)
h = 1
ret = 0
while n >= h:
flg = True
for x in lst:
if x >= h and flg:
ret += 1
flg = False
elif h > x:
flg = True
h += 1
print(ret)
| false | 11.111111 | [
"-import numpy as np",
"-",
"-lst2 = np.zeros((max(lst), N))",
"-for idx, n in enumerate(lst):",
"- lst2[:n, idx] = 1",
"+n = max(lst)",
"+h = 1",
"-for x in lst2:",
"+while n >= h:",
"- for y in x:",
"- if flg and y == 1:",
"+ for x in lst:",
"+ if x >= h and flg:",
... | false | 0.644213 | 0.03577 | 18.010005 | [
"s618230754",
"s630719661"
] |
u806976856 | p02678 | python | s001167152 | s003188993 | 435 | 370 | 113,404 | 113,200 | Accepted | Accepted | 14.94 | from collections import deque
import sys
input = sys.stdin.readline
n,m=list(map(int,input().split()))
r=[[] for i in range(n+1)]
R=[[] for i in range(n+1)]
for i in range(m):
a,b=list(map(int,input().split()))
r[a].append(b)
r[b].append(a)
R[a].append(b)
R[b].append(a)
dep=[-1]*(n+1)
d... | from collections import deque
import sys
input = sys.stdin.readline
n,m=list(map(int,input().split()))
k=[0]*(n+1)
r=[[] for i in range(n+1)]
R=[[] for i in range(n+1)]
for i in range(m):
a,b=list(map(int,input().split()))
r[a].append(b)
r[b].append(a)
R[a].append(b)
R[b].append(a)
dep=... | 34 | 32 | 727 | 672 | from collections import deque
import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
r = [[] for i in range(n + 1)]
R = [[] for i in range(n + 1)]
for i in range(m):
a, b = list(map(int, input().split()))
r[a].append(b)
r[b].append(a)
R[a].append(b)
R[b].append(a)
dep = [-1] *... | from collections import deque
import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
k = [0] * (n + 1)
r = [[] for i in range(n + 1)]
R = [[] for i in range(n + 1)]
for i in range(m):
a, b = list(map(int, input().split()))
r[a].append(b)
r[b].append(a)
R[a].append(b)
R[b].appe... | false | 5.882353 | [
"+k = [0] * (n + 1)",
"+ k[i] = p",
"- for j in R[i]:",
"- if dep[j] == dep[i] - 1:",
"- print(j)",
"- break",
"+ print((k[i]))"
] | false | 0.044765 | 0.044301 | 1.010481 | [
"s001167152",
"s003188993"
] |
u112629957 | p02642 | python | s510123166 | s773830699 | 1,071 | 434 | 32,208 | 94,136 | Accepted | Accepted | 59.48 | N=int(eval(input()))
ls=list(map(int,input().split()))
ls.sort()
#定数倍のやつに+1する
M=max(ls)
A=[0]*(M+1)
for i in range(len(ls)):
a=1
while ls[i]*a<=M:
b=ls[i]*a
if A[b]<=1:
A[b]+=1
a+=1
ans=0
for i in range(len(ls)):
if A[ls[i]]==1:
ans+=1
print(ans)
| N=int(eval(input()))
ls=list(map(int,input().split()))
ls.sort()
#定数倍のやつに+1する
M=max(ls)
A=[0]*(M+1)
for i in range(N):
a=M//ls[i]
for j in range(1,a+1):
A[j*ls[i]]+=1
ans=0
for i in range(len(ls)):
if A[ls[i]]==1:
ans+=1
print(ans) | 20 | 17 | 299 | 266 | N = int(eval(input()))
ls = list(map(int, input().split()))
ls.sort()
# 定数倍のやつに+1する
M = max(ls)
A = [0] * (M + 1)
for i in range(len(ls)):
a = 1
while ls[i] * a <= M:
b = ls[i] * a
if A[b] <= 1:
A[b] += 1
a += 1
ans = 0
for i in range(len(ls)):
if A[ls[i]] == 1:
a... | N = int(eval(input()))
ls = list(map(int, input().split()))
ls.sort()
# 定数倍のやつに+1する
M = max(ls)
A = [0] * (M + 1)
for i in range(N):
a = M // ls[i]
for j in range(1, a + 1):
A[j * ls[i]] += 1
ans = 0
for i in range(len(ls)):
if A[ls[i]] == 1:
ans += 1
print(ans)
| false | 15 | [
"-for i in range(len(ls)):",
"- a = 1",
"- while ls[i] * a <= M:",
"- b = ls[i] * a",
"- if A[b] <= 1:",
"- A[b] += 1",
"- a += 1",
"+for i in range(N):",
"+ a = M // ls[i]",
"+ for j in range(1, a + 1):",
"+ A[j * ls[i]] += 1"
] | false | 0.037117 | 0.08591 | 0.432042 | [
"s510123166",
"s773830699"
] |
u186838327 | p02838 | python | s511200843 | s888961329 | 1,416 | 685 | 125,624 | 124,628 | Accepted | Accepted | 51.62 | n = int(eval(input()))
l = list(map(int, input().split()))
l.sort(reverse=True)
kmax = len(format(l[0], 'b'))
l0 = [0]*kmax
l1 = [0]*kmax
for i in range(n):
a = format(l[i], 'b')
a = ''.join(list(reversed(a)))
for j in range(kmax):
if j > len(a)-1:
l0[j] += 1
elif a[j] == '0':
... | n = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9+7
X = [0]*62
for i in range(n):
a = A[i]
b = format(a, 'b')
b = list(b)
b.reverse()
for j in range(len(b)):
if b[j] == '1':
X[j] += 1
ans = 0
for i in range(62):
x = X[i]
y = n-X[i]
... | 25 | 21 | 449 | 388 | n = int(eval(input()))
l = list(map(int, input().split()))
l.sort(reverse=True)
kmax = len(format(l[0], "b"))
l0 = [0] * kmax
l1 = [0] * kmax
for i in range(n):
a = format(l[i], "b")
a = "".join(list(reversed(a)))
for j in range(kmax):
if j > len(a) - 1:
l0[j] += 1
elif a[j] == "... | n = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7
X = [0] * 62
for i in range(n):
a = A[i]
b = format(a, "b")
b = list(b)
b.reverse()
for j in range(len(b)):
if b[j] == "1":
X[j] += 1
ans = 0
for i in range(62):
x = X[i]
y = n - X[i]
# print(i... | false | 16 | [
"-l = list(map(int, input().split()))",
"-l.sort(reverse=True)",
"-kmax = len(format(l[0], \"b\"))",
"-l0 = [0] * kmax",
"-l1 = [0] * kmax",
"+A = list(map(int, input().split()))",
"+mod = 10**9 + 7",
"+X = [0] * 62",
"- a = format(l[i], \"b\")",
"- a = \"\".join(list(reversed(a)))",
"- ... | false | 0.062438 | 0.038852 | 1.607072 | [
"s511200843",
"s888961329"
] |
u712822150 | p03017 | python | s853040261 | s080853850 | 493 | 180 | 15,740 | 18,476 | Accepted | Accepted | 63.49 | import sys
import numpy as np
def main():
n, a, b, c, d = [int(x) for x in input().split()]
a -= 1
b -= 1
c -= 1
d -= 1
nv = np.insert(np.array([1 if char == '#' else 0 for char in eval(input())]).cumsum(), 0, 0)
for i in range(a, max(c, d)):
if nv[i + 2] - nv[i] == 2:
... | import sys
import numpy as np
def main():
n, a, b, c, d = [int(x) for x in input().split()]
nv = np.insert(np.array([1 if char == '#' else 0 for char in eval(input())]), 0, 0)
nv1 = nv[1:] + nv[:-1]
nv2 = nv[2:] + nv[1:-1] + nv[:-2]
if np.any(nv1[a:max(c, d)] == 2):
print("No")
... | 26 | 20 | 570 | 453 | import sys
import numpy as np
def main():
n, a, b, c, d = [int(x) for x in input().split()]
a -= 1
b -= 1
c -= 1
d -= 1
nv = np.insert(
np.array([1 if char == "#" else 0 for char in eval(input())]).cumsum(), 0, 0
)
for i in range(a, max(c, d)):
if nv[i + 2] - nv[i] == 2... | import sys
import numpy as np
def main():
n, a, b, c, d = [int(x) for x in input().split()]
nv = np.insert(np.array([1 if char == "#" else 0 for char in eval(input())]), 0, 0)
nv1 = nv[1:] + nv[:-1]
nv2 = nv[2:] + nv[1:-1] + nv[:-2]
if np.any(nv1[a : max(c, d)] == 2):
print("No")
elif ... | false | 23.076923 | [
"- a -= 1",
"- b -= 1",
"- c -= 1",
"- d -= 1",
"- nv = np.insert(",
"- np.array([1 if char == \"#\" else 0 for char in eval(input())]).cumsum(), 0, 0",
"- )",
"- for i in range(a, max(c, d)):",
"- if nv[i + 2] - nv[i] == 2:",
"- print(\"No\")",
"- ... | false | 0.247807 | 0.382456 | 0.647935 | [
"s853040261",
"s080853850"
] |
u729133443 | p03294 | python | s010420463 | s786848962 | 180 | 18 | 43,120 | 3,188 | Accepted | Accepted | 90 | eval(input());print((eval(input().replace(' ','-1+'))-1)) | n,a=open(0);print((sum(map(int,a.split()))-int(n))) | 1 | 1 | 49 | 49 | eval(input())
print((eval(input().replace(" ", "-1+")) - 1))
| n, a = open(0)
print((sum(map(int, a.split())) - int(n)))
| false | 0 | [
"-eval(input())",
"-print((eval(input().replace(\" \", \"-1+\")) - 1))",
"+n, a = open(0)",
"+print((sum(map(int, a.split())) - int(n)))"
] | false | 0.070706 | 0.037072 | 1.907291 | [
"s010420463",
"s786848962"
] |
u141610915 | p03600 | python | s513052893 | s248104815 | 1,139 | 636 | 56,924 | 76,516 | Accepted | Accepted | 44.16 | import sys
from copy import deepcopy as dc
input = sys.stdin.buffer.readline
N = int(eval(input()))
d = [list(map(int, input().split())) for _ in range(N)]
d2 = dc(d)
for k in range(N):
for i in range(N):
for j in range(N):
d2[i][j] = min(d2[i][k] + d2[k][j], d2[i][j])
f = 0
for i in range(N):
... | N = int(eval(input()))
a = [list(map(int, input().split())) for _ in range(N)]
b = [a[i][: ] for i in range(N)]
for k in range(N):
for i in range(N):
for j in range(N):
b[i][j] = min(b[i][j], b[i][k] + b[k][j])
inf = 10 ** 10
if a == b:
dp = [[inf] * N for _ in range(N)]
for i in range(N):
for j in... | 28 | 28 | 636 | 722 | import sys
from copy import deepcopy as dc
input = sys.stdin.buffer.readline
N = int(eval(input()))
d = [list(map(int, input().split())) for _ in range(N)]
d2 = dc(d)
for k in range(N):
for i in range(N):
for j in range(N):
d2[i][j] = min(d2[i][k] + d2[k][j], d2[i][j])
f = 0
for i in range(N):
... | N = int(eval(input()))
a = [list(map(int, input().split())) for _ in range(N)]
b = [a[i][:] for i in range(N)]
for k in range(N):
for i in range(N):
for j in range(N):
b[i][j] = min(b[i][j], b[i][k] + b[k][j])
inf = 10**10
if a == b:
dp = [[inf] * N for _ in range(N)]
for i in range(N):
... | false | 0 | [
"-import sys",
"-from copy import deepcopy as dc",
"-",
"-input = sys.stdin.buffer.readline",
"-d = [list(map(int, input().split())) for _ in range(N)]",
"-d2 = dc(d)",
"+a = [list(map(int, input().split())) for _ in range(N)]",
"+b = [a[i][:] for i in range(N)]",
"- d2[i][j] = min(d2[i][... | false | 0.035742 | 0.061658 | 0.579682 | [
"s513052893",
"s248104815"
] |
u780962115 | p02862 | python | s309667629 | s858896090 | 645 | 319 | 82,228 | 112,176 | Accepted | Accepted | 50.54 | mod=10**9+7
##mod,nについての制約は自分でいかに記入する
def pow_cal(x,n,mod):
if n==0:
return 1
elif n==1:
return x%mod
elif n>=2:
if n%2==0:
return (pow_cal(x,n//2,mod)**2)%mod
else:
return (x*pow_cal(x,n//2,mod)**2)%mod
def find_power(n,mod):
# 0!から... | def find_power(n):
# 0!からn!までのびっくりを出してくれる関数
powlist=[0]*(n+1)
powlist[0]=1
powlist[1]=1
for i in range(2,n+1):
powlist[i]=powlist[i-1]*i%(10**9+7)
return powlist
def find_inv_power(n):
#0!からn!までの逆元を10**9+7で割ったあまりリストを作る関数
powlist=find_power(n)
check=powlist[-1]
... | 53 | 46 | 1,190 | 1,191 | mod = 10**9 + 7
##mod,nについての制約は自分でいかに記入する
def pow_cal(x, n, mod):
if n == 0:
return 1
elif n == 1:
return x % mod
elif n >= 2:
if n % 2 == 0:
return (pow_cal(x, n // 2, mod) ** 2) % mod
else:
return (x * pow_cal(x, n // 2, mod) ** 2) % mod
def find_p... | def find_power(n):
# 0!からn!までのびっくりを出してくれる関数
powlist = [0] * (n + 1)
powlist[0] = 1
powlist[1] = 1
for i in range(2, n + 1):
powlist[i] = powlist[i - 1] * i % (10**9 + 7)
return powlist
def find_inv_power(n):
# 0!からn!までの逆元を10**9+7で割ったあまりリストを作る関数
powlist = find_power(n)
check... | false | 13.207547 | [
"-mod = 10**9 + 7",
"-##mod,nについての制約は自分でいかに記入する",
"-def pow_cal(x, n, mod):",
"- if n == 0:",
"- return 1",
"- elif n == 1:",
"- return x % mod",
"- elif n >= 2:",
"- if n % 2 == 0:",
"- return (pow_cal(x, n // 2, mod) ** 2) % mod",
"- else:",
"-... | false | 1.506988 | 1.709866 | 0.881348 | [
"s309667629",
"s858896090"
] |
u011621222 | p00481 | python | s063866022 | s580699179 | 14,580 | 10,680 | 87,232 | 33,656 | Accepted | Accepted | 26.75 | from collections import deque
h, w, n = list(map(int, input().split()))
g = ['0'] * h
sx, sy = -1, -1
pos = -1
for i in range(h):
g[i] = eval(input())
if pos == -1:
pos = g[i].find('S')
if pos != -1:
sx = i
sy = pos
book = set()
queue = deque()
ans =... | from collections import deque, defaultdict
d = [[1, 0], [-1, 0], [0, 1], [0, -1]]
H, W, N = list(map(int, input().split()))
G = []
sx = sy = 0
for i in range(H):
G.append(eval(input()))
for j, c in enumerate(G[i]):
if c == 'S':
sx, sy = i, j
Q = deque()
Q.append((sx, s... | 50 | 38 | 1,022 | 873 | from collections import deque
h, w, n = list(map(int, input().split()))
g = ["0"] * h
sx, sy = -1, -1
pos = -1
for i in range(h):
g[i] = eval(input())
if pos == -1:
pos = g[i].find("S")
if pos != -1:
sx = i
sy = pos
book = set()
queue = deque()
ans = 0
Next = [[-1, 0], [... | from collections import deque, defaultdict
d = [[1, 0], [-1, 0], [0, 1], [0, -1]]
H, W, N = list(map(int, input().split()))
G = []
sx = sy = 0
for i in range(H):
G.append(eval(input()))
for j, c in enumerate(G[i]):
if c == "S":
sx, sy = i, j
Q = deque()
Q.append((sx, sy, 0))
visited = defau... | false | 24 | [
"-from collections import deque",
"+from collections import deque, defaultdict",
"-h, w, n = list(map(int, input().split()))",
"-g = [\"0\"] * h",
"-sx, sy = -1, -1",
"-pos = -1",
"-for i in range(h):",
"- g[i] = eval(input())",
"- if pos == -1:",
"- pos = g[i].find(\"S\")",
"- ... | false | 0.034937 | 0.035342 | 0.988551 | [
"s063866022",
"s580699179"
] |
u696444274 | p03030 | python | s791443045 | s356112998 | 36 | 18 | 5,148 | 3,060 | Accepted | Accepted | 50 |
import math
import itertools
import statistics
#import collections
#n = list(map(int, input().split()))
n = int(eval(input()))
data = []
for i in range(n):
s, p = input().split()
data.append((i+1, s, int(p)))
data.sort(key=lambda x:(x[1], -x[2]))
for i in range(n):
print((data[i][0]))
| n = int(eval(input()))
s = []
for i in range(n):
x, y = list(input().split())
s.append([x, int(y), i+1])
ans = sorted(s, key=lambda x: (x[0], -x[1]))
for x, y, a in ans:
print(a)
| 17 | 9 | 311 | 194 | import math
import itertools
import statistics
# import collections
# n = list(map(int, input().split()))
n = int(eval(input()))
data = []
for i in range(n):
s, p = input().split()
data.append((i + 1, s, int(p)))
data.sort(key=lambda x: (x[1], -x[2]))
for i in range(n):
print((data[i][0]))
| n = int(eval(input()))
s = []
for i in range(n):
x, y = list(input().split())
s.append([x, int(y), i + 1])
ans = sorted(s, key=lambda x: (x[0], -x[1]))
for x, y, a in ans:
print(a)
| false | 47.058824 | [
"-import math",
"-import itertools",
"-import statistics",
"-",
"-# import collections",
"-# n = list(map(int, input().split()))",
"-data = []",
"+s = []",
"- s, p = input().split()",
"- data.append((i + 1, s, int(p)))",
"-data.sort(key=lambda x: (x[1], -x[2]))",
"-for i in range(n):",
... | false | 0.036334 | 0.036866 | 0.985563 | [
"s791443045",
"s356112998"
] |
u576917603 | p03262 | python | s927840889 | s055730527 | 197 | 154 | 14,252 | 14,224 | Accepted | Accepted | 21.83 | n,x=list(map(int,input().split()))
a=list(map(int,input().split()))
a.append(x)
a.sort(reverse=True)
b=[]
for i in range(n):
b.append(a[i]-a[i+1])
import fractions as f
maxi=float('inf')
if len(b)==1:
print((b[0]))
exit()
for i in range(n-1):
tmp=f.gcd(b[i],b[i+1])
maxi=min(maxi,tmp)
... | n,x=list(map(int,input().split()))
a=list(map(int,input().split()))
a.append(x)
a=sorted(a)
distance=[0]*n
for i in range(n):
distance[i]=a[i+1]-a[i]
tmp=0
import fractions
for i in range(n):
tmp=fractions.gcd(distance[i],tmp)
print(tmp)
| 16 | 13 | 324 | 256 | n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
a.append(x)
a.sort(reverse=True)
b = []
for i in range(n):
b.append(a[i] - a[i + 1])
import fractions as f
maxi = float("inf")
if len(b) == 1:
print((b[0]))
exit()
for i in range(n - 1):
tmp = f.gcd(b[i], b[i + 1])
maxi = mi... | n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
a.append(x)
a = sorted(a)
distance = [0] * n
for i in range(n):
distance[i] = a[i + 1] - a[i]
tmp = 0
import fractions
for i in range(n):
tmp = fractions.gcd(distance[i], tmp)
print(tmp)
| false | 18.75 | [
"-a.sort(reverse=True)",
"-b = []",
"+a = sorted(a)",
"+distance = [0] * n",
"- b.append(a[i] - a[i + 1])",
"-import fractions as f",
"+ distance[i] = a[i + 1] - a[i]",
"+tmp = 0",
"+import fractions",
"-maxi = float(\"inf\")",
"-if len(b) == 1:",
"- print((b[0]))",
"- exit()",
... | false | 0.160179 | 0.059356 | 2.698609 | [
"s927840889",
"s055730527"
] |
u393253137 | p02658 | python | s913875712 | s768107671 | 69 | 60 | 22,464 | 21,456 | Accepted | Accepted | 13.04 | import math
n = int(eval(input()))
A = list(map(int, input().split()))
lg = 0
for a in A:
if a == 0:
print((0))
exit()
lg += math.log10(a)
if lg > 18:
print((-1))
else:
ans = 1
for a in A:
ans *= a
if ans > 10**18:
print((-1))
else:
p... | n = int(eval(input()))
A = list(map(int, input().split()))
ans = 1
if 0 in set(A):
print((0))
exit()
for a in A:
ans *= a
if ans > 10**18:
print((-1))
exit()
print(ans) | 19 | 12 | 317 | 201 | import math
n = int(eval(input()))
A = list(map(int, input().split()))
lg = 0
for a in A:
if a == 0:
print((0))
exit()
lg += math.log10(a)
if lg > 18:
print((-1))
else:
ans = 1
for a in A:
ans *= a
if ans > 10**18:
print((-1))
else:
print(ans)
| n = int(eval(input()))
A = list(map(int, input().split()))
ans = 1
if 0 in set(A):
print((0))
exit()
for a in A:
ans *= a
if ans > 10**18:
print((-1))
exit()
print(ans)
| false | 36.842105 | [
"-import math",
"-",
"-lg = 0",
"+ans = 1",
"+if 0 in set(A):",
"+ print((0))",
"+ exit()",
"- if a == 0:",
"- print((0))",
"- exit()",
"- lg += math.log10(a)",
"-if lg > 18:",
"- print((-1))",
"-else:",
"- ans = 1",
"- for a in A:",
"- ans *... | false | 0.096519 | 0.039329 | 2.454135 | [
"s913875712",
"s768107671"
] |
u353797797 | p02850 | python | s478041424 | s049927023 | 862 | 767 | 96,572 | 93,148 | Accepted | Accepted | 11.02 | import sys
from collections import defaultdict
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(r... | from collections import *
import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number... | 37 | 32 | 968 | 793 | import sys
from collections import defaultdict
sys.setrecursionlimit(10**6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI():
return map(int, sys.stdin.readline().split())
def LI():
return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number):
return [LI() for _ in... | from collections import *
import sys
sys.setrecursionlimit(10**6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI():
return map(int, sys.stdin.readline().split())
def LI():
return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number):
return [LI() for _ in range(row... | false | 13.513514 | [
"+from collections import *",
"-from collections import defaultdict",
"- def dfs(u, pu=-1, pc=-1):",
"- c = 0",
"- for cu in to[u]:",
"+ def dfs(u=0, pu=-1, pc=-1):",
"+ c = 1",
"+ for i, cu in to[u]:",
"- c += 1",
"- ei = etoi[(u, cu)]",
"... | false | 0.044269 | 0.103962 | 0.425814 | [
"s478041424",
"s049927023"
] |
u480138356 | p03835 | python | s974182548 | s657442640 | 1,601 | 535 | 2,940 | 3,060 | Accepted | Accepted | 66.58 | k, s = list(map(int, input().split()))
count = 0
for x in range(k+1):
for y in range(min(s-x+1, k+1)):
z = s - x - y
if 0 <= z and z <=k:
count += 1
print(count)
| import sys
input = sys.stdin.readline
def main():
K, S = list(map(int, input().split()))
ans = 0
for x in range(min(S, K), -1, -1):
for y in range(min(S - x, K), -1, -1):
if S - x - y <= K:
# print(x, y, S-x-y)
ans += 1
else:
... | 9 | 20 | 197 | 394 | k, s = list(map(int, input().split()))
count = 0
for x in range(k + 1):
for y in range(min(s - x + 1, k + 1)):
z = s - x - y
if 0 <= z and z <= k:
count += 1
print(count)
| import sys
input = sys.stdin.readline
def main():
K, S = list(map(int, input().split()))
ans = 0
for x in range(min(S, K), -1, -1):
for y in range(min(S - x, K), -1, -1):
if S - x - y <= K:
# print(x, y, S-x-y)
ans += 1
else:
... | false | 55 | [
"-k, s = list(map(int, input().split()))",
"-count = 0",
"-for x in range(k + 1):",
"- for y in range(min(s - x + 1, k + 1)):",
"- z = s - x - y",
"- if 0 <= z and z <= k:",
"- count += 1",
"-print(count)",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"... | false | 0.034311 | 0.034492 | 0.994755 | [
"s974182548",
"s657442640"
] |
u260980560 | p02299 | python | s196276761 | s051002298 | 120 | 70 | 6,808 | 5,620 | Accepted | Accepted | 41.67 | from math import atan2
n = eval(input())
p = [list(map(int, input().split())) for i in range(n)]
for t in range(eval(input())):
x, y = list(map(int, input().split()))
inline = 0
theta = 0.
for i in range(n):
x0 = p[i-1][0] - x
y0 = p[i-1][1] - y
x1 = p[i][0] - x
... | def inside_polygon(p0, qs):
cnt = 0
L = len(qs)
x, y = p0
for i in range(L):
x0, y0 = qs[i-1]; x1, y1 = qs[i]
x0 -= x; y0 -= y
x1 -= x; y1 -= y
cv = x0*x1 + y0*y1
sv = x0*y1 - x1*y0
if sv == 0 and cv <= 0:
return 1
if no... | 24 | 31 | 570 | 746 | from math import atan2
n = eval(input())
p = [list(map(int, input().split())) for i in range(n)]
for t in range(eval(input())):
x, y = list(map(int, input().split()))
inline = 0
theta = 0.0
for i in range(n):
x0 = p[i - 1][0] - x
y0 = p[i - 1][1] - y
x1 = p[i][0] - x
y1 ... | def inside_polygon(p0, qs):
cnt = 0
L = len(qs)
x, y = p0
for i in range(L):
x0, y0 = qs[i - 1]
x1, y1 = qs[i]
x0 -= x
y0 -= y
x1 -= x
y1 -= y
cv = x0 * x1 + y0 * y1
sv = x0 * y1 - x1 * y0
if sv == 0 and cv <= 0:
return ... | false | 22.580645 | [
"-from math import atan2",
"+def inside_polygon(p0, qs):",
"+ cnt = 0",
"+ L = len(qs)",
"+ x, y = p0",
"+ for i in range(L):",
"+ x0, y0 = qs[i - 1]",
"+ x1, y1 = qs[i]",
"+ x0 -= x",
"+ y0 -= y",
"+ x1 -= x",
"+ y1 -= y",
"+ cv =... | false | 0.043786 | 0.044083 | 0.993264 | [
"s196276761",
"s051002298"
] |
u707187541 | p02621 | python | s345911778 | s279812060 | 33 | 27 | 9,148 | 9,060 | Accepted | Accepted | 18.18 | a=int(eval(input()))
b=a+a**2+a**3
print((int(b))) | a=int(eval(input()))
b=a+a**2+a**3
print(b) | 3 | 3 | 44 | 39 | a = int(eval(input()))
b = a + a**2 + a**3
print((int(b)))
| a = int(eval(input()))
b = a + a**2 + a**3
print(b)
| false | 0 | [
"-print((int(b)))",
"+print(b)"
] | false | 0.047977 | 0.04595 | 1.044098 | [
"s345911778",
"s279812060"
] |
u489959379 | p03659 | python | s713942645 | s340604845 | 197 | 162 | 24,832 | 23,800 | Accepted | Accepted | 17.77 | n = int(eval(input()))
A = list(map(int, input().split()))
sunuke = sum(A)
arai = 0
f_inf = float("inf")
res = f_inf
for i in range(n - 1):
arai += A[i]
sunuke -= A[i]
res = min(res, abs(sunuke - arai))
print(res)
| import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))[::-1]
snuke = sum(A)
arai = 0
res = f_inf
for i in range(n - 1):
snuke -= A[i]
... | 12 | 26 | 232 | 439 | n = int(eval(input()))
A = list(map(int, input().split()))
sunuke = sum(A)
arai = 0
f_inf = float("inf")
res = f_inf
for i in range(n - 1):
arai += A[i]
sunuke -= A[i]
res = min(res, abs(sunuke - arai))
print(res)
| import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))[::-1]
snuke = sum(A)
arai = 0
res = f_inf
for i in range(n - 1):
snuke -= A[i]
arai += A[i]
... | false | 53.846154 | [
"-n = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-sunuke = sum(A)",
"-arai = 0",
"+import sys",
"+",
"+sys.setrecursionlimit(10**7)",
"+input = sys.stdin.readline",
"-res = f_inf",
"-for i in range(n - 1):",
"- arai += A[i]",
"- sunuke -= A[i]",
"- res = min(res, ... | false | 0.064425 | 0.068134 | 0.945569 | [
"s713942645",
"s340604845"
] |
u790812284 | p03478 | python | s630999668 | s144052978 | 60 | 46 | 3,404 | 3,060 | Accepted | Accepted | 23.33 | n,a,b=list(map(int,input().split()))
l=[]
for i in range(1,n+1):
tmp=0
tmp_l=[]
for j in range(len(str(i))):#各桁の和を算出
tmp_l.append(int(str(i)[j]))
tmp=sum(tmp_l)
if a<= tmp <=b:
l.append(i)
ans=sum(l)
print(ans) | n,a,b=list(map(int, input().split()))
ans = 0
for i in range(1,n+1):
wa = 0
for j in range(len(str(i))):
wa += int(str(i)[j])
if wa>= a and wa<=b:
ans+=i
print(ans) | 13 | 9 | 265 | 194 | n, a, b = list(map(int, input().split()))
l = []
for i in range(1, n + 1):
tmp = 0
tmp_l = []
for j in range(len(str(i))): # 各桁の和を算出
tmp_l.append(int(str(i)[j]))
tmp = sum(tmp_l)
if a <= tmp <= b:
l.append(i)
ans = sum(l)
print(ans)
| n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
wa = 0
for j in range(len(str(i))):
wa += int(str(i)[j])
if wa >= a and wa <= b:
ans += i
print(ans)
| false | 30.769231 | [
"-l = []",
"+ans = 0",
"- tmp = 0",
"- tmp_l = []",
"- for j in range(len(str(i))): # 各桁の和を算出",
"- tmp_l.append(int(str(i)[j]))",
"- tmp = sum(tmp_l)",
"- if a <= tmp <= b:",
"- l.append(i)",
"-ans = sum(l)",
"+ wa = 0",
"+ for j in range(len(str(i))):",... | false | 0.090832 | 0.036728 | 2.473098 | [
"s630999668",
"s144052978"
] |
u476604182 | p02781 | python | s448332281 | s491011279 | 28 | 18 | 3,936 | 3,064 | Accepted | Accepted | 35.71 | from functools import lru_cache
N = int(eval(input()))
K = int(eval(input()))
@lru_cache(None)
def f(n,k):
if k<0:
return 0
if n<10:
if k>1:
return 0
elif k==1:
return n
elif k==0:
return 1
a, b = divmod(n,10)
m = 9*f(a-1,k-1)+f(a,k)+b*(f(a,k-1)-f(a-1,k-1))
re... | N = eval(input())
K = int(eval(input()))
L = len(N)
dp0 = [[0]*(K+1) for i in range(L+1)]
dp1 = [[0]*(K+1) for i in range(L+1)]
dp0[0][0] = 1
for i in range(1,L+1):
c = int(N[i-1])
for j in range(K+1):
if j==0:
if c>0:
dp1[i][j] = dp1[i-1][j]+dp0[i-1][j]
dp0[i][j] = 0
el... | 18 | 24 | 329 | 646 | from functools import lru_cache
N = int(eval(input()))
K = int(eval(input()))
@lru_cache(None)
def f(n, k):
if k < 0:
return 0
if n < 10:
if k > 1:
return 0
elif k == 1:
return n
elif k == 0:
return 1
a, b = divmod(n, 10)
m = 9 * f(a... | N = eval(input())
K = int(eval(input()))
L = len(N)
dp0 = [[0] * (K + 1) for i in range(L + 1)]
dp1 = [[0] * (K + 1) for i in range(L + 1)]
dp0[0][0] = 1
for i in range(1, L + 1):
c = int(N[i - 1])
for j in range(K + 1):
if j == 0:
if c > 0:
dp1[i][j] = dp1[i - 1][j] + dp0[i ... | false | 25 | [
"-from functools import lru_cache",
"-",
"-N = int(eval(input()))",
"+N = eval(input())",
"-",
"-",
"-@lru_cache(None)",
"-def f(n, k):",
"- if k < 0:",
"- return 0",
"- if n < 10:",
"- if k > 1:",
"- return 0",
"- elif k == 1:",
"- return... | false | 0.06012 | 0.062623 | 0.960031 | [
"s448332281",
"s491011279"
] |
u604839890 | p02659 | python | s758774572 | s616825592 | 102 | 33 | 61,488 | 9,180 | Accepted | Accepted | 67.65 | a, b = input().split()
a = int(a)
b = 100*int(b[0])+10*int(b[2])+int(b[3])
print((a*b//100))
| a, b = input().split()
a = int(a)
b = int(b[0])*100 + int(b[2])*10 + int(b[3])
print((a*b//100)) | 4 | 4 | 94 | 97 | a, b = input().split()
a = int(a)
b = 100 * int(b[0]) + 10 * int(b[2]) + int(b[3])
print((a * b // 100))
| a, b = input().split()
a = int(a)
b = int(b[0]) * 100 + int(b[2]) * 10 + int(b[3])
print((a * b // 100))
| false | 0 | [
"-b = 100 * int(b[0]) + 10 * int(b[2]) + int(b[3])",
"+b = int(b[0]) * 100 + int(b[2]) * 10 + int(b[3])"
] | false | 0.03539 | 0.093667 | 0.377826 | [
"s758774572",
"s616825592"
] |
u392319141 | p03111 | python | s601662751 | s352498423 | 1,087 | 406 | 3,188 | 3,064 | Accepted | Accepted | 62.65 | N, A, B, C = list(map(int, input().split()))
L = []
for _ in range(N):
L.append(int(eval(input())))
ans = float('inf')
for mask in range(pow(4, N)):
cost = 0
for i, l in enumerate([A, B, C]):
grp = []
for digit in range(N):
if mask // pow(4, digit) % 4 == i:
... | from itertools import product
N, A, B, C = list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
ans = 10**18
for state in product(list(range(4)), repeat=N):
K = [[] for _ in range(4)]
for i, l in enumerate(L):
K[state[i]].append(l)
cost = 0
for d, D in zip((A... | 22 | 20 | 506 | 476 | N, A, B, C = list(map(int, input().split()))
L = []
for _ in range(N):
L.append(int(eval(input())))
ans = float("inf")
for mask in range(pow(4, N)):
cost = 0
for i, l in enumerate([A, B, C]):
grp = []
for digit in range(N):
if mask // pow(4, digit) % 4 == i:
grp.a... | from itertools import product
N, A, B, C = list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
ans = 10**18
for state in product(list(range(4)), repeat=N):
K = [[] for _ in range(4)]
for i, l in enumerate(L):
K[state[i]].append(l)
cost = 0
for d, D in zip((A, B, C), K):
... | false | 9.090909 | [
"+from itertools import product",
"+",
"-L = []",
"-for _ in range(N):",
"- L.append(int(eval(input())))",
"-ans = float(\"inf\")",
"-for mask in range(pow(4, N)):",
"+L = [int(eval(input())) for _ in range(N)]",
"+ans = 10**18",
"+for state in product(list(range(4)), repeat=N):",
"+ K = [... | false | 1.80809 | 0.364875 | 4.955374 | [
"s601662751",
"s352498423"
] |
u334712262 | p03008 | python | s423780932 | s885867161 | 1,165 | 844 | 823,160 | 432,412 | Accepted | Accepted | 27.55 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, produc... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, produc... | 87 | 90 | 1,797 | 1,814 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permut... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permut... | false | 3.333333 | [
"+import copy",
"- dp = [[0] * (N + 1) for _ in range(4)]",
"+ dp0 = [0] * (N + 1)",
"+ dp1 = [0] * (N + 1)",
"- dp[i + 1][w] = dp[i][w]",
"- dp[i + 1][w] = max(dp[i][w], dp[i + 1][w - a] + v)",
"+ dp1[w] = max(dp0[w],... | false | 0.040103 | 0.087678 | 0.457387 | [
"s423780932",
"s885867161"
] |
u779455925 | p03734 | python | s928448293 | s249905006 | 77 | 59 | 5,240 | 3,700 | Accepted | Accepted | 23.38 | from collections import *
from heapq import *
from itertools import *
from fractions import gcd
import sys
from decimal import *
import copy
from bisect import *
input=lambda :sys.stdin.readline().rstrip()
N,W=list(map(int,input().split()))
WV=[list(map(int,input().split())) for i in range(N)]
lst=deque([]... | import sys
from collections import *
import copy
input=lambda :sys.stdin.readline().rstrip()
N,W=list(map(int,input().split()))
WV=[list(map(int,input().split())) for i in range(N)]
lst=deque([])
for w,v in WV:
nlst=deque([[w,v]])
for i in range(len(lst)):
w1,v1=lst[i]
if w1+w<=W:
... | 83 | 78 | 2,170 | 2,052 | from collections import *
from heapq import *
from itertools import *
from fractions import gcd
import sys
from decimal import *
import copy
from bisect import *
input = lambda: sys.stdin.readline().rstrip()
N, W = list(map(int, input().split()))
WV = [list(map(int, input().split())) for i in range(N)]
lst = deque([])... | import sys
from collections import *
import copy
input = lambda: sys.stdin.readline().rstrip()
N, W = list(map(int, input().split()))
WV = [list(map(int, input().split())) for i in range(N)]
lst = deque([])
for w, v in WV:
nlst = deque([[w, v]])
for i in range(len(lst)):
w1, v1 = lst[i]
if w1 +... | false | 6.024096 | [
"+import sys",
"-from heapq import *",
"-from itertools import *",
"-from fractions import gcd",
"-import sys",
"-from decimal import *",
"-from bisect import *"
] | false | 0.160445 | 0.039261 | 4.086628 | [
"s928448293",
"s249905006"
] |
u580093517 | p03447 | python | s387923770 | s366789550 | 20 | 17 | 3,060 | 2,940 | Accepted | Accepted | 15 | x,a,b = [int(eval(input())) for i in range(3)]
print(((x-a)%b)) | print(((int(eval(input()))-int(eval(input())))%int(eval(input())))) | 2 | 1 | 56 | 47 | x, a, b = [int(eval(input())) for i in range(3)]
print(((x - a) % b))
| print(((int(eval(input())) - int(eval(input()))) % int(eval(input()))))
| false | 50 | [
"-x, a, b = [int(eval(input())) for i in range(3)]",
"-print(((x - a) % b))",
"+print(((int(eval(input())) - int(eval(input()))) % int(eval(input()))))"
] | false | 0.039303 | 0.038226 | 1.028157 | [
"s387923770",
"s366789550"
] |
u272525952 | p02819 | python | s210310288 | s588700658 | 182 | 29 | 38,896 | 9,428 | Accepted | Accepted | 84.07 | x=int(eval(input()))
if x==2 or x==3:
print(x)
else:
i=x
flag=True
while i<=100003 and flag==True:
flag=False
for j in range(2,int(i**(1/2)//1+1)):
if i%j==0:
flag=True
break
i+=1
print((i-1)) | x=int(eval(input()))
flag=True
while flag:
i=2
fla=True
while i<=x**0.5:
if x%i==0:
fla=False
break
else:
if i==2:
i+=1
else:
i+=2
if fla==False:
x+=1
else:
print(x)
... | 16 | 19 | 289 | 328 | x = int(eval(input()))
if x == 2 or x == 3:
print(x)
else:
i = x
flag = True
while i <= 100003 and flag == True:
flag = False
for j in range(2, int(i ** (1 / 2) // 1 + 1)):
if i % j == 0:
flag = True
break
i += 1
print((i - 1))
| x = int(eval(input()))
flag = True
while flag:
i = 2
fla = True
while i <= x**0.5:
if x % i == 0:
fla = False
break
else:
if i == 2:
i += 1
else:
i += 2
if fla == False:
x += 1
else:
print... | false | 15.789474 | [
"-if x == 2 or x == 3:",
"- print(x)",
"-else:",
"- i = x",
"- flag = True",
"- while i <= 100003 and flag == True:",
"+flag = True",
"+while flag:",
"+ i = 2",
"+ fla = True",
"+ while i <= x**0.5:",
"+ if x % i == 0:",
"+ fla = False",
"+ ... | false | 0.038633 | 0.046897 | 0.823784 | [
"s210310288",
"s588700658"
] |
u191874006 | p02834 | python | s505247967 | s229060861 | 499 | 446 | 65,312 | 65,312 | Accepted | Accepted | 10.62 | #!/usr/bin/env python3
import sys
import math
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 Counter
from 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(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from co... | 61 | 72 | 1,423 | 1,629 | #!/usr/bin/env python3
import sys
import math
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 Counter
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(1000000)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections ... | false | 15.277778 | [
"+\"\"\"",
"+[考察]",
"+ 高橋君が最も遠くに逃げる場合",
"+ := (高橋君が先に行ける頂点)Λ(青木君から最も遠い頂点)",
"+⇒高橋君が先に行ける頂点",
"+ 高橋君からの各頂点の距離(高橋君を根としたときの木の深さ),",
"+ 青木君からの各頂点の距離(青木君を根としたときの木の深さ)を求めて、",
"+ 高橋君からの距離と青木君からの距離を比較",
"+⇒青木君から最も遠い頂点",
"+ 青木君からの各頂点の距離の最大値",
"+\"\"\""
] | false | 0.087779 | 0.041226 | 2.129217 | [
"s505247967",
"s229060861"
] |
u268210555 | p03147 | python | s627769737 | s240381969 | 325 | 18 | 21,532 | 2,940 | Accepted | Accepted | 94.46 | import numpy as np
n = int(eval(input()))
h = np.array([0] + list(map(int, input().split())))
r = 0
while np.any(h>0):
r += np.sum(np.logical_and(h[1:]>0, h[:-1]<=0))
h -= 1
print(r) | n = int(eval(input()))
h = list(map(int, input().split()))
print((sum(max(0, h[i-1]-h[i]) for i in range(1, n)) + h[-1])) | 8 | 3 | 191 | 115 | import numpy as np
n = int(eval(input()))
h = np.array([0] + list(map(int, input().split())))
r = 0
while np.any(h > 0):
r += np.sum(np.logical_and(h[1:] > 0, h[:-1] <= 0))
h -= 1
print(r)
| n = int(eval(input()))
h = list(map(int, input().split()))
print((sum(max(0, h[i - 1] - h[i]) for i in range(1, n)) + h[-1]))
| false | 62.5 | [
"-import numpy as np",
"-",
"-h = np.array([0] + list(map(int, input().split())))",
"-r = 0",
"-while np.any(h > 0):",
"- r += np.sum(np.logical_and(h[1:] > 0, h[:-1] <= 0))",
"- h -= 1",
"-print(r)",
"+h = list(map(int, input().split()))",
"+print((sum(max(0, h[i - 1] - h[i]) for i in range... | false | 0.369619 | 0.036101 | 10.238361 | [
"s627769737",
"s240381969"
] |
u019685451 | p02584 | python | s805161560 | s368297586 | 63 | 31 | 61,964 | 9,184 | Accepted | Accepted | 50.79 | def solve(X, D, lb, ub):
# min abs(X + t * D) (lb <= t <= ub)
t = round(-X / D)
ans = abs(X)
for i in [-2, -1, 0, +1, +2]:
tt = t + i
tt = min(tt, ub)
tt = max(tt, lb)
y = X + tt * D
ans = min(ans, abs(y))
return ans
X, K, D = list(map(int, input(... | from math import floor
def solve(X, D, lb, ub):
# min abs(X + t * D) (lb <= t <= ub) (lb, ub, t are int)
ts = [
lb,
ub,
max(min(floor(-X / D), ub), lb),
max(min(floor(-X / D) + 1, ub), lb),
]
return min([abs(X + t * D) for t in ts])
X, K, D = list(map(int... | 27 | 27 | 734 | 742 | def solve(X, D, lb, ub):
# min abs(X + t * D) (lb <= t <= ub)
t = round(-X / D)
ans = abs(X)
for i in [-2, -1, 0, +1, +2]:
tt = t + i
tt = min(tt, ub)
tt = max(tt, lb)
y = X + tt * D
ans = min(ans, abs(y))
return ans
X, K, D = list(map(int, input().split()))... | from math import floor
def solve(X, D, lb, ub):
# min abs(X + t * D) (lb <= t <= ub) (lb, ub, t are int)
ts = [
lb,
ub,
max(min(floor(-X / D), ub), lb),
max(min(floor(-X / D) + 1, ub), lb),
]
return min([abs(X + t * D) for t in ts])
X, K, D = list(map(int, input().spl... | false | 0 | [
"+from math import floor",
"+",
"+",
"- # min abs(X + t * D) (lb <= t <= ub)",
"- t = round(-X / D)",
"- ans = abs(X)",
"- for i in [-2, -1, 0, +1, +2]:",
"- tt = t + i",
"- tt = min(tt, ub)",
"- tt = max(tt, lb)",
"- y = X + tt * D",
"- ans = min... | false | 0.045355 | 0.037632 | 1.205247 | [
"s805161560",
"s368297586"
] |
u046592970 | p02773 | python | s522072258 | s435617994 | 980 | 649 | 101,968 | 35,572 | Accepted | Accepted | 33.78 | from collections import Counter
n = int(eval(input()))
s = Counter([eval(input()) for _ in range(n)])
mx = max(s.values())
ans = []
for k,v in list(s.items()):
if v==mx:
ans.append(k)
for i in sorted(ans):
print(i) | from collections import defaultdict
n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
dd = defaultdict(int)
for x in s:
dd[x] += 1
mx = max(dd.values())
for k in sorted(j for j,y in list(dd.items()) if y == mx):
print(k) | 11 | 11 | 223 | 233 | from collections import Counter
n = int(eval(input()))
s = Counter([eval(input()) for _ in range(n)])
mx = max(s.values())
ans = []
for k, v in list(s.items()):
if v == mx:
ans.append(k)
for i in sorted(ans):
print(i)
| from collections import defaultdict
n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
dd = defaultdict(int)
for x in s:
dd[x] += 1
mx = max(dd.values())
for k in sorted(j for j, y in list(dd.items()) if y == mx):
print(k)
| false | 0 | [
"-from collections import Counter",
"+from collections import defaultdict",
"-s = Counter([eval(input()) for _ in range(n)])",
"-mx = max(s.values())",
"-ans = []",
"-for k, v in list(s.items()):",
"- if v == mx:",
"- ans.append(k)",
"-for i in sorted(ans):",
"- print(i)",
"+s = [ev... | false | 0.176817 | 0.042845 | 4.126909 | [
"s522072258",
"s435617994"
] |
u394721319 | p03068 | python | s761695050 | s677376027 | 170 | 28 | 38,384 | 9,052 | Accepted | Accepted | 83.53 | N = int(eval(input()))
S = eval(input())
K = int(eval(input()))
k = S[K-1]
ans = ''
for i in S:
if i != k:
ans += '*'
else:
ans += i
print(ans)
| N = int(eval(input()))
S = list(eval(input()))
K = int(eval(input()))-1
ans = ''
p = S[K]
for i in range(N):
if p == S[i]:
ans += S[i]
else:
ans += '*'
print(ans)
| 14 | 13 | 166 | 183 | N = int(eval(input()))
S = eval(input())
K = int(eval(input()))
k = S[K - 1]
ans = ""
for i in S:
if i != k:
ans += "*"
else:
ans += i
print(ans)
| N = int(eval(input()))
S = list(eval(input()))
K = int(eval(input())) - 1
ans = ""
p = S[K]
for i in range(N):
if p == S[i]:
ans += S[i]
else:
ans += "*"
print(ans)
| false | 7.142857 | [
"-S = eval(input())",
"-K = int(eval(input()))",
"-k = S[K - 1]",
"+S = list(eval(input()))",
"+K = int(eval(input())) - 1",
"-for i in S:",
"- if i != k:",
"+p = S[K]",
"+for i in range(N):",
"+ if p == S[i]:",
"+ ans += S[i]",
"+ else:",
"- else:",
"- ans += i"
... | false | 0.040243 | 0.037786 | 1.065025 | [
"s761695050",
"s677376027"
] |
u348805958 | p02632 | python | s881046031 | s119657705 | 1,784 | 916 | 106,824 | 106,176 | Accepted | Accepted | 48.65 | #!python3
import sys
iim = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
def _cmb(N, mod):
N1 = N + 1
fact = [0] * N1
inv = [0] * N1
fact[0] = fact[1] = inv[0] = inv[1] = 1
for i in range(2, N1):
fact[i] = fact[i-1] * i % mod
inv[i] = pow(fact[i], mod-... | #!python3
import sys
iim = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
def _cmb(N, mod):
N1 = N + 1
fact = [1] * N1
inv = [1] * N1
for i in range(2, N1):
fact[i] = fact[i-1] * i % mod
inv[N] = pow(fact[N], mod-2, mod)
for i in range(N-1, 1, -1):
... | 35 | 37 | 728 | 753 | #!python3
import sys
iim = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
def _cmb(N, mod):
N1 = N + 1
fact = [0] * N1
inv = [0] * N1
fact[0] = fact[1] = inv[0] = inv[1] = 1
for i in range(2, N1):
fact[i] = fact[i - 1] * i % mod
inv[i] = pow(fact[i], mod - 2, mod)
... | #!python3
import sys
iim = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
def _cmb(N, mod):
N1 = N + 1
fact = [1] * N1
inv = [1] * N1
for i in range(2, N1):
fact[i] = fact[i - 1] * i % mod
inv[N] = pow(fact[N], mod - 2, mod)
for i in range(N - 1, 1, -1):
inv[i] ... | false | 5.405405 | [
"- fact = [0] * N1",
"- inv = [0] * N1",
"- fact[0] = fact[1] = inv[0] = inv[1] = 1",
"+ fact = [1] * N1",
"+ inv = [1] * N1",
"- inv[i] = pow(fact[i], mod - 2, mod)",
"+ inv[N] = pow(fact[N], mod - 2, mod)",
"+ for i in range(N - 1, 1, -1):",
"+ inv[i] = inv[i + 1... | false | 0.046916 | 0.134479 | 0.348872 | [
"s881046031",
"s119657705"
] |
u894258749 | p03061 | python | s567957233 | s413321233 | 1,506 | 839 | 97,640 | 16,140 | Accepted | Accepted | 44.29 | from fractions import gcd
inpl = lambda: list(map(int,input().split()))
class SegAccumCalc:
def __init__(self, value, N=0, calc=lambda x,y: x+y):
M = max(len(value),N)
N = 2**(len(bin(M))-3)
if N < M: N *= 2
self.N = N
self.node = [None] * (2*N-1)
for i, v ... | from fractions import gcd
inpl = lambda: list(map(int,input().split()))
class SegAccumCalc:
def __init__(self, value, N=0, calc=lambda x,y: x+y):
M = max(len(value),N)
N = 2**(len(bin(M))-3)
if N < M: N *= 2
self.N = N
self.node = [None] * (2*N-1)
for i, v ... | 59 | 59 | 1,689 | 1,729 | from fractions import gcd
inpl = lambda: list(map(int, input().split()))
class SegAccumCalc:
def __init__(self, value, N=0, calc=lambda x, y: x + y):
M = max(len(value), N)
N = 2 ** (len(bin(M)) - 3)
if N < M:
N *= 2
self.N = N
self.node = [None] * (2 * N - 1)
... | from fractions import gcd
inpl = lambda: list(map(int, input().split()))
class SegAccumCalc:
def __init__(self, value, N=0, calc=lambda x, y: x + y):
M = max(len(value), N)
N = 2 ** (len(bin(M)) - 3)
if N < M:
N *= 2
self.N = N
self.node = [None] * (2 * N - 1)
... | false | 0 | [
"- def set_value(self, n, v):",
"+ def set_input(self, n, v):",
"- def get(self, a=0, b=-1, k=0, l=0, r=-1):",
"+ def get_input(self, n):",
"+ return self.node[(self.N - 1) + n]",
"+",
"+ def get_output(self, a=0, b=-1, k=0, l=0, r=-1):",
"- left = self.get(a, b, 2 * k... | false | 0.053805 | 0.110957 | 0.484922 | [
"s567957233",
"s413321233"
] |
u520276780 | p02642 | python | s100082008 | s911731049 | 1,829 | 162 | 133,924 | 135,972 | Accepted | Accepted | 91.14 | from collections import Counter
n=int(eval(input()))
*a,=list(map(int, input().split()))
sa=Counter(a)
if 1 in sa:
if sa[1]>1:
print((0))
else:
print((1))
exit()
# def fct(x):
# f1=[1]
# f2=[]
# for i in range(2,min(int(x**(1/2)+7),x)):
# if x%i==0:
# ... | ##想定解
n=int(eval(input()))
*a,=list(map(int, input().split( )))
from collections import Counter
ca=Counter(a)
nn=[0]*(10**6+1)
for ai in ca:
nn[ai]=ca[ai]
ans=0
for i in range(10**6+1):
if nn[i]==1:
ans+=1
if nn[i]:
for j in range(2*i,10**6+1,i):
nn[j]... | 39 | 23 | 858 | 323 | from collections import Counter
n = int(eval(input()))
(*a,) = list(map(int, input().split()))
sa = Counter(a)
if 1 in sa:
if sa[1] > 1:
print((0))
else:
print((1))
exit()
# def fct(x):
# f1=[1]
# f2=[]
# for i in range(2,min(int(x**(1/2)+7),x)):
# if x%i==0:
# ... | ##想定解
n = int(eval(input()))
(*a,) = list(map(int, input().split()))
from collections import Counter
ca = Counter(a)
nn = [0] * (10**6 + 1)
for ai in ca:
nn[ai] = ca[ai]
ans = 0
for i in range(10**6 + 1):
if nn[i] == 1:
ans += 1
if nn[i]:
for j in range(2 * i, 10**6 + 1, i):
nn[... | false | 41.025641 | [
"+##想定解",
"+n = int(eval(input()))",
"+(*a,) = list(map(int, input().split()))",
"-n = int(eval(input()))",
"-(*a,) = list(map(int, input().split()))",
"-sa = Counter(a)",
"-if 1 in sa:",
"- if sa[1] > 1:",
"- print((0))",
"- else:",
"- print((1))",
"- exit()",
"-# def... | false | 0.095006 | 0.558762 | 0.170029 | [
"s100082008",
"s911731049"
] |
u697559326 | p02613 | python | s523467464 | s617468769 | 186 | 171 | 70,012 | 69,960 | Accepted | Accepted | 8.06 | N = int(input())
out = ["AC","WA","TLE","RE"]
output = [0]*4
for _ in range(N):
S = input()
if S == out[0]:
output[0] += 1
elif S == out[1]:
output[1] += 1
elif S == out[2]:
output[2] += 1
else:
output[3] += 1
print(out[0],"x",output[0])
print(out[1]... | N = int(eval(input()))
out = ["AC","WA","TLE","RE"]
output = [0]*4
for _ in range(N):
S = eval(input())
if S == out[0]:
output[0] += 1
elif S == out[1]:
output[1] += 1
elif S == out[2]:
output[2] += 1
else:
output[3] += 1
for i in range(4):
print... | 19 | 17 | 400 | 330 | N = int(input())
out = ["AC", "WA", "TLE", "RE"]
output = [0] * 4
for _ in range(N):
S = input()
if S == out[0]:
output[0] += 1
elif S == out[1]:
output[1] += 1
elif S == out[2]:
output[2] += 1
else:
output[3] += 1
print(out[0], "x", output[0])
print(out[1], "x", outp... | N = int(eval(input()))
out = ["AC", "WA", "TLE", "RE"]
output = [0] * 4
for _ in range(N):
S = eval(input())
if S == out[0]:
output[0] += 1
elif S == out[1]:
output[1] += 1
elif S == out[2]:
output[2] += 1
else:
output[3] += 1
for i in range(4):
print((out[i], "x"... | false | 10.526316 | [
"-N = int(input())",
"+N = int(eval(input()))",
"- S = input()",
"+ S = eval(input())",
"-print(out[0], \"x\", output[0])",
"-print(out[1], \"x\", output[1])",
"-print(out[2], \"x\", output[2])",
"-print(out[3], \"x\", output[3], end=\"\")",
"+for i in range(4):",
"+ print((out[i], \"x\",... | false | 0.039891 | 0.034016 | 1.172738 | [
"s523467464",
"s617468769"
] |
u981931040 | p02802 | python | s126835937 | s749465722 | 266 | 202 | 4,596 | 10,360 | Accepted | Accepted | 24.06 | N , M = list(map(int,input().split()))
lst = []
AC_list = [False] * N
WA_cnt_list = [0] * N
for _ in range(M):
r , judge = input().split()
question_num = int(r) - 1
if AC_list[question_num]:
continue
elif judge == "WA":
WA_cnt_list[question_num] += 1
elif judge == "AC":
... | N, M = list(map(int, input().split()))
AC_flags = [False] * N
WA_counter = [0] * N
for _ in range(M):
p, s = input().split()
p = int(p) - 1
if AC_flags[p]:
continue
elif s == 'WA':
WA_counter[p] += 1
else:
AC_flags[p] = True
penalty = 0
for i in range(N):
pe... | 18 | 17 | 466 | 384 | N, M = list(map(int, input().split()))
lst = []
AC_list = [False] * N
WA_cnt_list = [0] * N
for _ in range(M):
r, judge = input().split()
question_num = int(r) - 1
if AC_list[question_num]:
continue
elif judge == "WA":
WA_cnt_list[question_num] += 1
elif judge == "AC":
AC_lis... | N, M = list(map(int, input().split()))
AC_flags = [False] * N
WA_counter = [0] * N
for _ in range(M):
p, s = input().split()
p = int(p) - 1
if AC_flags[p]:
continue
elif s == "WA":
WA_counter[p] += 1
else:
AC_flags[p] = True
penalty = 0
for i in range(N):
penalty += AC_fl... | false | 5.555556 | [
"-lst = []",
"-AC_list = [False] * N",
"-WA_cnt_list = [0] * N",
"+AC_flags = [False] * N",
"+WA_counter = [0] * N",
"- r, judge = input().split()",
"- question_num = int(r) - 1",
"- if AC_list[question_num]:",
"+ p, s = input().split()",
"+ p = int(p) - 1",
"+ if AC_flags[p]:"... | false | 0.059205 | 0.037613 | 1.574081 | [
"s126835937",
"s749465722"
] |
u367701763 | p02560 | python | s400257601 | s155930657 | 218 | 195 | 70,716 | 74,432 | Accepted | Accepted | 10.55 | def floor_sum(n, m, a, b):
res = 0
if b >= m:
res += n * (b // m)
b %= m
while True:
if a >= m:
res += (n - 1) * n * (a // m) // 2
a %= m
y_max = (a * n + b) // m
if y_max == 0: break
x_max = b - y_max * m
res += (n ... | # 一番早いのを写経したものを弄ってアルゴリズム勉強のための試し打ち中
def floor_sum(n, m, a, b):
res = 0
if b >= m:
res += n * (b // m)
b %= m
while True:
if a >= m:
res += (n - 1) * n * (a // m) // 2
a %= m
y_max = (a * n + b) // m
if y_max == 0: break
x_... | 23 | 30 | 557 | 661 | def floor_sum(n, m, a, b):
res = 0
if b >= m:
res += n * (b // m)
b %= m
while True:
if a >= m:
res += (n - 1) * n * (a // m) // 2
a %= m
y_max = (a * n + b) // m
if y_max == 0:
break
x_max = b - y_max * m
res += (n ... | # 一番早いのを写経したものを弄ってアルゴリズム勉強のための試し打ち中
def floor_sum(n, m, a, b):
res = 0
if b >= m:
res += n * (b // m)
b %= m
while True:
if a >= m:
res += (n - 1) * n * (a // m) // 2
a %= m
y_max = (a * n + b) // m
if y_max == 0:
break
x_ma... | false | 23.333333 | [
"+# 一番早いのを写経したものを弄ってアルゴリズム勉強のための試し打ち中",
"-input = sys.stdin.readline",
"-for i in range(int(eval(input()))):",
"+input = sys.stdin.buffer.readline",
"+T = int(eval(input()))",
"+res = [\"\"] * T",
"+for i in range(T):",
"- print((floor_sum(n, m, a, b)))",
"+ res[i] = str(floor_sum(n, m, a, b))... | false | 0.045535 | 0.040791 | 1.116294 | [
"s400257601",
"s155930657"
] |
u764215612 | p02690 | python | s878178313 | s579099712 | 25 | 23 | 9,424 | 9,476 | Accepted | Accepted | 8 | import math
x=int(eval(input()))
for i in range(120):
for j in range(-54,i):
if math.pow(i,5)-math.pow(j,5)==x:print((i,j));exit() | import math
X = int(eval(input()))
a1 = math.ceil(X**(1/5))
N = int(1e10)
c = 0
b = 0
while c <= N:
if b**5 < -X:
b2 = b + 1
break
b -= 1
c = 0
while c <= N:
c += 1
b1 = math.floor((a1**5-X)**(1/5))
a2 = math.floor((X+b2**5)**(1/5))
if a1**5 - b1**5 == X:
... | 5 | 24 | 129 | 437 | import math
x = int(eval(input()))
for i in range(120):
for j in range(-54, i):
if math.pow(i, 5) - math.pow(j, 5) == x:
print((i, j))
exit()
| import math
X = int(eval(input()))
a1 = math.ceil(X ** (1 / 5))
N = int(1e10)
c = 0
b = 0
while c <= N:
if b**5 < -X:
b2 = b + 1
break
b -= 1
c = 0
while c <= N:
c += 1
b1 = math.floor((a1**5 - X) ** (1 / 5))
a2 = math.floor((X + b2**5) ** (1 / 5))
if a1**5 - b1**5 == X:
... | false | 79.166667 | [
"-x = int(eval(input()))",
"-for i in range(120):",
"- for j in range(-54, i):",
"- if math.pow(i, 5) - math.pow(j, 5) == x:",
"- print((i, j))",
"- exit()",
"+X = int(eval(input()))",
"+a1 = math.ceil(X ** (1 / 5))",
"+N = int(1e10)",
"+c = 0",
"+b = 0",
"+whil... | false | 0.114631 | 0.074389 | 1.540969 | [
"s878178313",
"s579099712"
] |
u069868839 | p03478 | python | s508754372 | s760734984 | 1,077 | 34 | 3,060 | 3,064 | Accepted | Accepted | 96.84 | def FindSumOfDigits(n):
Sum=0
while(n>0):
Sum+=(int(n%10))
n=n/10
return Sum
N,A,B=list(map(int,input().split()))
ans=0
#ans_list=[]
#sumlist=[]
for i in range(1,N+1):
#sumlist.append(FindSumOfDigits(i))
if A<=FindSumOfDigits(i)<=B:
ans+=i
#ans_list.ap... | N,A,B=list(map(int,input().split()))
cnt=0
for n in range(1,N+1):
total=0
total+=n%10
total+=int(n/10)%10
total+=int((n/10)/10)%10
total+=int(((n/10)/10)/10)%10
total+=int((((n/10)/10)/10)/10)%10
if A<=total<=B:
cnt+=n
print(cnt) | 19 | 12 | 369 | 270 | def FindSumOfDigits(n):
Sum = 0
while n > 0:
Sum += int(n % 10)
n = n / 10
return Sum
N, A, B = list(map(int, input().split()))
ans = 0
# ans_list=[]
# sumlist=[]
for i in range(1, N + 1):
# sumlist.append(FindSumOfDigits(i))
if A <= FindSumOfDigits(i) <= B:
ans += i
... | N, A, B = list(map(int, input().split()))
cnt = 0
for n in range(1, N + 1):
total = 0
total += n % 10
total += int(n / 10) % 10
total += int((n / 10) / 10) % 10
total += int(((n / 10) / 10) / 10) % 10
total += int((((n / 10) / 10) / 10) / 10) % 10
if A <= total <= B:
cnt += n
print(c... | false | 36.842105 | [
"-def FindSumOfDigits(n):",
"- Sum = 0",
"- while n > 0:",
"- Sum += int(n % 10)",
"- n = n / 10",
"- return Sum",
"-",
"-",
"-ans = 0",
"-# ans_list=[]",
"-# sumlist=[]",
"-for i in range(1, N + 1):",
"- # sumlist.append(FindSumOfDigits(i))",
"- if A <= FindSu... | false | 0.083601 | 0.036035 | 2.319976 | [
"s508754372",
"s760734984"
] |
u426534722 | p02238 | python | s383372197 | s245896837 | 30 | 20 | 7,840 | 5,628 | Accepted | Accepted | 33.33 | from sys import stdin
n = int(stdin.readline())
M = [list(map(int, stdin.readline().split()[2:])) for i in range(n)]
sndf = [[False, i] for i in range(1, n + 1)]
tt = 0
def dfs(u):
global tt
sndf[u][0] = True
tt += 1
sndf[u].append(tt)
for v in M[u]:
v -= 1
if not sndf[v]... | def MAIN():
n = int(eval(input()))
ans = [[i, 0, 0] for i in range((n + 1))]
G = [[] for _ in range((n + 1))]
for _ in range(n):
u, k, *v = list(map(int, input().split()))
G[u] = v
cnt = 1
def dfs(u):
nonlocal ans
if ans[u][1] != 0:
return
... | 20 | 26 | 469 | 622 | from sys import stdin
n = int(stdin.readline())
M = [list(map(int, stdin.readline().split()[2:])) for i in range(n)]
sndf = [[False, i] for i in range(1, n + 1)]
tt = 0
def dfs(u):
global tt
sndf[u][0] = True
tt += 1
sndf[u].append(tt)
for v in M[u]:
v -= 1
if not sndf[v][0]:
... | def MAIN():
n = int(eval(input()))
ans = [[i, 0, 0] for i in range((n + 1))]
G = [[] for _ in range((n + 1))]
for _ in range(n):
u, k, *v = list(map(int, input().split()))
G[u] = v
cnt = 1
def dfs(u):
nonlocal ans
if ans[u][1] != 0:
return
non... | false | 23.076923 | [
"-from sys import stdin",
"+def MAIN():",
"+ n = int(eval(input()))",
"+ ans = [[i, 0, 0] for i in range((n + 1))]",
"+ G = [[] for _ in range((n + 1))]",
"+ for _ in range(n):",
"+ u, k, *v = list(map(int, input().split()))",
"+ G[u] = v",
"+ cnt = 1",
"-n = int(stdin... | false | 0.033273 | 0.034086 | 0.976147 | [
"s383372197",
"s245896837"
] |
u126232616 | p03495 | python | s827974299 | s085235066 | 190 | 127 | 39,348 | 32,540 | Accepted | Accepted | 33.16 | from collections import Counter
n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
cnt = Counter(a)
mo = cnt.most_common()[::-1]
#print(mo)
ans = 0
for i in range(max(0,len(mo)-k)):
ans += mo[i][1]
print(ans)
| from collections import Counter
n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
cnt = Counter(a)
mo = sorted(cnt.values())
#print(mo)
ans = 0
for i in range(max(0,len(mo)-k)):
ans += mo[i]
print(ans)
| 10 | 10 | 237 | 231 | from collections import Counter
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
cnt = Counter(a)
mo = cnt.most_common()[::-1]
# print(mo)
ans = 0
for i in range(max(0, len(mo) - k)):
ans += mo[i][1]
print(ans)
| from collections import Counter
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
cnt = Counter(a)
mo = sorted(cnt.values())
# print(mo)
ans = 0
for i in range(max(0, len(mo) - k)):
ans += mo[i]
print(ans)
| false | 0 | [
"-mo = cnt.most_common()[::-1]",
"+mo = sorted(cnt.values())",
"- ans += mo[i][1]",
"+ ans += mo[i]"
] | false | 0.046696 | 0.049655 | 0.940409 | [
"s827974299",
"s085235066"
] |
u919633157 | p03761 | python | s037700638 | s442874171 | 75 | 20 | 3,064 | 3,064 | Accepted | Accepted | 73.33 | # 2019/07/19
# LCSっぽい?
n=int(eval(input()))
s=[sorted(eval(input())) for _ in range(n)]
def lcs(s1,s2):
dp=[[0]*(len(s2)+1) for _ in range(len(s1)+1)]
for i in range(len(s1)):
for j in range(len(s2)):
if s1[i]==s2[j]:
dp[i+1][j+1]=dp[i][j]+1
... | # https://atcoder.jp/contests/abc058/tasks/arc071_a
n=int(input())
s=[sorted(input()) for _ in range(n)]
alfa=[float('inf')]*26
for e in s:
for i in range(26):
cnt=e.count(chr(97+i))
alfa[i]=min(alfa[i],cnt)
ans=[]
for i in range(26):
ans.append(chr(97+i)*alfa[i])
print(*ans,sep='... | 35 | 14 | 706 | 322 | # 2019/07/19
# LCSっぽい?
n = int(eval(input()))
s = [sorted(eval(input())) for _ in range(n)]
def lcs(s1, s2):
dp = [[0] * (len(s2) + 1) for _ in range(len(s1) + 1)]
for i in range(len(s1)):
for j in range(len(s2)):
if s1[i] == s2[j]:
dp[i + 1][j + 1] = dp[i][j] + 1
... | # https://atcoder.jp/contests/abc058/tasks/arc071_a
n = int(input())
s = [sorted(input()) for _ in range(n)]
alfa = [float("inf")] * 26
for e in s:
for i in range(26):
cnt = e.count(chr(97 + i))
alfa[i] = min(alfa[i], cnt)
ans = []
for i in range(26):
ans.append(chr(97 + i) * alfa[i])
print(*ans... | false | 60 | [
"-# 2019/07/19",
"-# LCSっぽい?",
"-n = int(eval(input()))",
"-s = [sorted(eval(input())) for _ in range(n)]",
"-",
"-",
"-def lcs(s1, s2):",
"- dp = [[0] * (len(s2) + 1) for _ in range(len(s1) + 1)]",
"- for i in range(len(s1)):",
"- for j in range(len(s2)):",
"- if s1[i] =... | false | 0.040033 | 0.037676 | 1.062564 | [
"s037700638",
"s442874171"
] |
u260980560 | p00097 | python | s108458329 | s059878684 | 1,490 | 220 | 6,576 | 6,516 | Accepted | Accepted | 85.23 | while 1:
n, s = list(map(int, input().split()))
if n==0:
exit(0)
dp = [[0]*(s+1) for _ in range(n+1)]
dp[0][0] = 1
for i in range(min(s+1, 101)):
si1 = s-i+1
for k in range(n, 0, -1):
dp_k = dp[k]; dp_k1 = dp[k-1]
for j in range(si1):
... | dp = [[0]*(1001) for _ in range(10)]
dp[0][0] = 1
for i in range(101):
si1 = 1001-i
for k in range(9, 0, -1):
dp_k = dp[k]; dp_k1 = dp[k-1]
for j in range(si1):
dp_k[i+j] += dp_k1[j]
while 1:
n, s = list(map(int, input().split()))
if n==0:
exit(0)
prin... | 13 | 13 | 373 | 332 | while 1:
n, s = list(map(int, input().split()))
if n == 0:
exit(0)
dp = [[0] * (s + 1) for _ in range(n + 1)]
dp[0][0] = 1
for i in range(min(s + 1, 101)):
si1 = s - i + 1
for k in range(n, 0, -1):
dp_k = dp[k]
dp_k1 = dp[k - 1]
for j in ra... | dp = [[0] * (1001) for _ in range(10)]
dp[0][0] = 1
for i in range(101):
si1 = 1001 - i
for k in range(9, 0, -1):
dp_k = dp[k]
dp_k1 = dp[k - 1]
for j in range(si1):
dp_k[i + j] += dp_k1[j]
while 1:
n, s = list(map(int, input().split()))
if n == 0:
exit(0)
... | false | 0 | [
"+dp = [[0] * (1001) for _ in range(10)]",
"+dp[0][0] = 1",
"+for i in range(101):",
"+ si1 = 1001 - i",
"+ for k in range(9, 0, -1):",
"+ dp_k = dp[k]",
"+ dp_k1 = dp[k - 1]",
"+ for j in range(si1):",
"+ dp_k[i + j] += dp_k1[j]",
"- dp = [[0] * (s + 1) fo... | false | 0.090702 | 0.356415 | 0.254484 | [
"s108458329",
"s059878684"
] |
u111365362 | p02900 | python | s444348913 | s954160853 | 434 | 136 | 3,064 | 3,064 | Accepted | Accepted | 68.66 | a,b = list(map(int,input().split()))
while b != 0:
a,b = b,a%b
pr = set()
i = 2
while i ** 2 <= a:
while a % i == 0:
a //= i
pr.add(i)
i += 1
pr.add(a)
pr.add(1)
print((len(pr))) | #16:44
a,b = list(map(int,input().split()))
while b > 0:
a,b = b,a%b
prime = []
for i in range(2,int(a**.5)+1):
if a % i == 0:
p,q = i,0
while a % i == 0:
a //= i
q += 1
prime.append([p,q])
if a != 1:
prime.append([a,1])
print((len(prime)+1)) | 13 | 15 | 196 | 278 | a, b = list(map(int, input().split()))
while b != 0:
a, b = b, a % b
pr = set()
i = 2
while i**2 <= a:
while a % i == 0:
a //= i
pr.add(i)
i += 1
pr.add(a)
pr.add(1)
print((len(pr)))
| # 16:44
a, b = list(map(int, input().split()))
while b > 0:
a, b = b, a % b
prime = []
for i in range(2, int(a**0.5) + 1):
if a % i == 0:
p, q = i, 0
while a % i == 0:
a //= i
q += 1
prime.append([p, q])
if a != 1:
prime.append([a, 1])
print((len(prime) + 1))
| false | 13.333333 | [
"+# 16:44",
"-while b != 0:",
"+while b > 0:",
"-pr = set()",
"-i = 2",
"-while i**2 <= a:",
"- while a % i == 0:",
"- a //= i",
"- pr.add(i)",
"- i += 1",
"-pr.add(a)",
"-pr.add(1)",
"-print((len(pr)))",
"+prime = []",
"+for i in range(2, int(a**0.5) + 1):",
"+ ... | false | 0.0408 | 0.040096 | 1.017554 | [
"s444348913",
"s954160853"
] |
u047796752 | p02820 | python | s588182472 | s861829933 | 200 | 177 | 49,264 | 90,164 | Accepted | Accepted | 11.5 | import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
R, S, P = list(map(int, input().split()))
T = list(eval(input()))
score = {'r': P, 's': R, 'p': S}
ans = 0
for i in range(N):
if i<K:
ans += score[T[i]]
else:
if T[i]!=T[i-K]:
ans += score[T[... | import sys
input = sys.stdin.readline
from collections import *
def calc(l):
dp = [[0]*3 for _ in range(len(l)+1)]
for i in range(len(l)):
dp[i+1][0] = max(dp[i][1], dp[i][2])+(R if l[i]=='s' else 0)
dp[i+1][1] = max(dp[i][2], dp[i][0])+(S if l[i]=='p' else 0)
dp[i+1][2] ... | 19 | 28 | 370 | 630 | import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
R, S, P = list(map(int, input().split()))
T = list(eval(input()))
score = {"r": P, "s": R, "p": S}
ans = 0
for i in range(N):
if i < K:
ans += score[T[i]]
else:
if T[i] != T[i - K]:
ans += score[T[i]]
... | import sys
input = sys.stdin.readline
from collections import *
def calc(l):
dp = [[0] * 3 for _ in range(len(l) + 1)]
for i in range(len(l)):
dp[i + 1][0] = max(dp[i][1], dp[i][2]) + (R if l[i] == "s" else 0)
dp[i + 1][1] = max(dp[i][2], dp[i][0]) + (S if l[i] == "p" else 0)
dp[i + 1... | false | 32.142857 | [
"+from collections import *",
"+",
"+",
"+def calc(l):",
"+ dp = [[0] * 3 for _ in range(len(l) + 1)]",
"+ for i in range(len(l)):",
"+ dp[i + 1][0] = max(dp[i][1], dp[i][2]) + (R if l[i] == \"s\" else 0)",
"+ dp[i + 1][1] = max(dp[i][2], dp[i][0]) + (S if l[i] == \"p\" else 0)",
... | false | 0.092844 | 0.046291 | 2.005666 | [
"s588182472",
"s861829933"
] |
u125545880 | p03559 | python | s326360222 | s288350843 | 1,554 | 352 | 22,720 | 22,720 | Accepted | Accepted | 77.35 | import sys
import bisect
readline = sys.stdin.readline
bileft = bisect.bisect_left
biright = bisect.bisect_right
def main():
N = int(readline())
A = list(map(int, readline().split()))
B = list(map(int, readline().split()))
C = list(map(int, readline().split()))
A.sort(); C.sort()
... | import sys
import bisect
readline = sys.stdin.readline
def main():
N = int(readline())
A = list(map(int, readline().split()))
B = list(map(int, readline().split()))
C = list(map(int, readline().split()))
A.sort()
C.sort()
ans = 0
for b in B:
tmpa = bisect.bise... | 54 | 24 | 1,322 | 466 | import sys
import bisect
readline = sys.stdin.readline
bileft = bisect.bisect_left
biright = bisect.bisect_right
def main():
N = int(readline())
A = list(map(int, readline().split()))
B = list(map(int, readline().split()))
C = list(map(int, readline().split()))
A.sort()
C.sort()
minA = mi... | import sys
import bisect
readline = sys.stdin.readline
def main():
N = int(readline())
A = list(map(int, readline().split()))
B = list(map(int, readline().split()))
C = list(map(int, readline().split()))
A.sort()
C.sort()
ans = 0
for b in B:
tmpa = bisect.bisect_left(A, b)
... | false | 55.555556 | [
"-bileft = bisect.bisect_left",
"-biright = bisect.bisect_right",
"- minA = min(A)",
"- maxA = max(A)",
"- minC = min(C)",
"- maxC = max(C)",
"- L = minA",
"- R = maxA + 1",
"- mid = (L + R) // 2",
"- if b >= R:",
"- L = R",
"- else:",
... | false | 0.060464 | 0.056451 | 1.071078 | [
"s326360222",
"s288350843"
] |
u759412327 | p02897 | python | s920307736 | s940586473 | 29 | 26 | 8,920 | 9,092 | Accepted | Accepted | 10.34 | N = int(eval(input()))
print(((N-N//2)/N)) | N = int(eval(input()))
print((1-N//2/N)) | 2 | 2 | 35 | 33 | N = int(eval(input()))
print(((N - N // 2) / N))
| N = int(eval(input()))
print((1 - N // 2 / N))
| false | 0 | [
"-print(((N - N // 2) / N))",
"+print((1 - N // 2 / N))"
] | false | 0.040658 | 0.116576 | 0.348771 | [
"s920307736",
"s940586473"
] |
u163703551 | p03816 | python | s950007025 | s978444432 | 67 | 46 | 14,248 | 14,564 | Accepted | Accepted | 31.34 | n = eval(input())
n = int(n)
a = input().split()
a = [int(x) for x in a]
b = set(a)
res = len(b)
if n % 2 != res % 2:
res -= 1
print(res) | import sys
# sys.stdin = open('d1.in')
def read_int_list():
return list(map(int, input().split()))
def read_str_list():
return input().split()
def read_int():
return int(eval(input()))
def read_str():
return eval(input())
n = read_int()
a = read_int_list()
b = set(a)
r... | 10 | 28 | 145 | 364 | n = eval(input())
n = int(n)
a = input().split()
a = [int(x) for x in a]
b = set(a)
res = len(b)
if n % 2 != res % 2:
res -= 1
print(res)
| import sys
# sys.stdin = open('d1.in')
def read_int_list():
return list(map(int, input().split()))
def read_str_list():
return input().split()
def read_int():
return int(eval(input()))
def read_str():
return eval(input())
n = read_int()
a = read_int_list()
b = set(a)
res = len(b)
if res % 2 != ... | false | 64.285714 | [
"-n = eval(input())",
"-n = int(n)",
"-a = input().split()",
"-a = [int(x) for x in a]",
"+import sys",
"+",
"+# sys.stdin = open('d1.in')",
"+def read_int_list():",
"+ return list(map(int, input().split()))",
"+",
"+",
"+def read_str_list():",
"+ return input().split()",
"+",
"+",... | false | 0.054249 | 0.037294 | 1.454626 | [
"s950007025",
"s978444432"
] |
u185424824 | p03592 | python | s276364736 | s167365329 | 74 | 67 | 64,904 | 61,988 | Accepted | Accepted | 9.46 | N,M,K = list(map(int,input().split()))
ans = "No"
for k in range(N+1):
for l in range(M+1):
if k*(M-l) + l*(N-k) == K:
ans = "Yes"
print(ans) | N,M,K = list(map(int,input().split()))
ans = "No"
for a in range(N+1):
if N - 2*a != 0:
if (K - a*M) % (N - 2*a) == 0:
if M >= (K - a*M) / (N - 2*a) >= 0:
ans = "Yes"
print(ans) | 8 | 9 | 155 | 200 | N, M, K = list(map(int, input().split()))
ans = "No"
for k in range(N + 1):
for l in range(M + 1):
if k * (M - l) + l * (N - k) == K:
ans = "Yes"
print(ans)
| N, M, K = list(map(int, input().split()))
ans = "No"
for a in range(N + 1):
if N - 2 * a != 0:
if (K - a * M) % (N - 2 * a) == 0:
if M >= (K - a * M) / (N - 2 * a) >= 0:
ans = "Yes"
print(ans)
| false | 11.111111 | [
"-for k in range(N + 1):",
"- for l in range(M + 1):",
"- if k * (M - l) + l * (N - k) == K:",
"- ans = \"Yes\"",
"+for a in range(N + 1):",
"+ if N - 2 * a != 0:",
"+ if (K - a * M) % (N - 2 * a) == 0:",
"+ if M >= (K - a * M) / (N - 2 * a) >= 0:",
"+ ... | false | 0.047327 | 0.049486 | 0.956357 | [
"s276364736",
"s167365329"
] |
u790905630 | p03241 | python | s052128101 | s090512268 | 25 | 20 | 3,316 | 3,060 | Accepted | Accepted | 20 | from math import *
def main():
N, M = list(map(int, input().split()))
special_value = M//N
divisor_set = set(i for i in range(1, (int(sqrt(M)) + 1)) if (M % i == 0))
divisor_set = divisor_set.union(M//j for j in divisor_set)
print((int(max([i for i in divisor_set if special_value >= i]))))
... | from math import *
def main():
N, M = list(map(int, input().split()))
special_value = M//N
divisor_set = set(i for i in range(1, (int(sqrt(M)) + 1)) if (M % i == 0))
divisor_set = divisor_set.union(M//j for j in divisor_set)
print((int(max(divisor_set, key=lambda x: x if special_value >= x e... | 11 | 12 | 332 | 347 | from math import *
def main():
N, M = list(map(int, input().split()))
special_value = M // N
divisor_set = set(i for i in range(1, (int(sqrt(M)) + 1)) if (M % i == 0))
divisor_set = divisor_set.union(M // j for j in divisor_set)
print((int(max([i for i in divisor_set if special_value >= i]))))
... | from math import *
def main():
N, M = list(map(int, input().split()))
special_value = M // N
divisor_set = set(i for i in range(1, (int(sqrt(M)) + 1)) if (M % i == 0))
divisor_set = divisor_set.union(M // j for j in divisor_set)
print((int(max(divisor_set, key=lambda x: x if special_value >= x els... | false | 8.333333 | [
"- print((int(max([i for i in divisor_set if special_value >= i]))))",
"+ print((int(max(divisor_set, key=lambda x: x if special_value >= x else -1))))"
] | false | 0.046151 | 0.046459 | 0.993363 | [
"s052128101",
"s090512268"
] |
u353919145 | p02724 | python | s353154509 | s739967207 | 167 | 17 | 38,512 | 2,940 | Accepted | Accepted | 89.82 | def resolve():
x=int(eval(input()))
ans=0
while x>=500:
x-=500
ans+=1000
while x>=5:
x-=5
ans+=5
print(ans)
resolve() | n=int(eval(input()))
gg=0
gg+=(n//500)*1000
n=n-(n//500)*500
gg+=(n//5)*5
print(gg)
| 11 | 6 | 173 | 83 | def resolve():
x = int(eval(input()))
ans = 0
while x >= 500:
x -= 500
ans += 1000
while x >= 5:
x -= 5
ans += 5
print(ans)
resolve()
| n = int(eval(input()))
gg = 0
gg += (n // 500) * 1000
n = n - (n // 500) * 500
gg += (n // 5) * 5
print(gg)
| false | 45.454545 | [
"-def resolve():",
"- x = int(eval(input()))",
"- ans = 0",
"- while x >= 500:",
"- x -= 500",
"- ans += 1000",
"- while x >= 5:",
"- x -= 5",
"- ans += 5",
"- print(ans)",
"-",
"-",
"-resolve()",
"+n = int(eval(input()))",
"+gg = 0",
"+gg += ... | false | 0.219124 | 0.03597 | 6.091903 | [
"s353154509",
"s739967207"
] |
u312025627 | p03625 | python | s694310199 | s818457734 | 333 | 98 | 68,760 | 18,216 | Accepted | Accepted | 70.57 | def main():
N = int(input())
A = [int(i) for i in input().split()]
from collections import Counter
c = Counter(A)
li = [(k, v) for k, v in c.items() if v >= 2]
li.sort(reverse=True)
if li and li[0][1] >= 4:
return print(li[0][0] * li[0][0])
elif len(li) <= 1:
re... | def main():
_ = int(eval(input()))
A = [int(i) for i in input().split()]
from collections import Counter
c = Counter(A)
li = [(k, v) for k, v in list(c.items()) if v >= 2]
li.sort(reverse=True)
if li and li[0][1] >= 4:
print((li[0][0] * li[0][0]))
elif len(li) <= 1:
... | 17 | 17 | 432 | 411 | def main():
N = int(input())
A = [int(i) for i in input().split()]
from collections import Counter
c = Counter(A)
li = [(k, v) for k, v in c.items() if v >= 2]
li.sort(reverse=True)
if li and li[0][1] >= 4:
return print(li[0][0] * li[0][0])
elif len(li) <= 1:
return prin... | def main():
_ = int(eval(input()))
A = [int(i) for i in input().split()]
from collections import Counter
c = Counter(A)
li = [(k, v) for k, v in list(c.items()) if v >= 2]
li.sort(reverse=True)
if li and li[0][1] >= 4:
print((li[0][0] * li[0][0]))
elif len(li) <= 1:
prin... | false | 0 | [
"- N = int(input())",
"+ _ = int(eval(input()))",
"- li = [(k, v) for k, v in c.items() if v >= 2]",
"+ li = [(k, v) for k, v in list(c.items()) if v >= 2]",
"- return print(li[0][0] * li[0][0])",
"+ print((li[0][0] * li[0][0]))",
"- return print(0)",
"+ print((... | false | 0.039596 | 0.040466 | 0.978493 | [
"s694310199",
"s818457734"
] |
u809819902 | p02993 | python | s410109565 | s754786251 | 35 | 28 | 9,040 | 9,088 | Accepted | Accepted | 20 | s = eval(input())
res = "Good"
for i in range(3):
if s[i]==s[i+1]:
res = "Bad"
print(res) | s=eval(input())
ans="Good"
for i in range(3):
if s[i]==s[i+1]:
ans="Bad"
print(ans) | 6 | 6 | 100 | 94 | s = eval(input())
res = "Good"
for i in range(3):
if s[i] == s[i + 1]:
res = "Bad"
print(res)
| s = eval(input())
ans = "Good"
for i in range(3):
if s[i] == s[i + 1]:
ans = "Bad"
print(ans)
| false | 0 | [
"-res = \"Good\"",
"+ans = \"Good\"",
"- res = \"Bad\"",
"-print(res)",
"+ ans = \"Bad\"",
"+print(ans)"
] | false | 0.035206 | 0.07719 | 0.456088 | [
"s410109565",
"s754786251"
] |
u294922877 | p02394 | python | s820723639 | s128883124 | 30 | 20 | 5,600 | 5,596 | Accepted | Accepted | 33.33 | def judge(w, h, x, y, r):
within_range = (0 <= x - r and x + r <= w) and (0 <= y - r and y + r <= h)
return 'Yes' if within_range else 'No'
if __name__ == '__main__':
w, h, x, y, r = list(map(int, input().split(' ')))
print((judge(w, h, x, y, r)))
| w,h,x,y,r=list(map(int, input().split()))
if 0 <= x-r and x+r <= w and 0 <= y-r and y+r <= h:
print("Yes")
else:
print("No")
| 8 | 5 | 265 | 131 | def judge(w, h, x, y, r):
within_range = (0 <= x - r and x + r <= w) and (0 <= y - r and y + r <= h)
return "Yes" if within_range else "No"
if __name__ == "__main__":
w, h, x, y, r = list(map(int, input().split(" ")))
print((judge(w, h, x, y, r)))
| w, h, x, y, r = list(map(int, input().split()))
if 0 <= x - r and x + r <= w and 0 <= y - r and y + r <= h:
print("Yes")
else:
print("No")
| false | 37.5 | [
"-def judge(w, h, x, y, r):",
"- within_range = (0 <= x - r and x + r <= w) and (0 <= y - r and y + r <= h)",
"- return \"Yes\" if within_range else \"No\"",
"-",
"-",
"-if __name__ == \"__main__\":",
"- w, h, x, y, r = list(map(int, input().split(\" \")))",
"- print((judge(w, h, x, y, r))... | false | 0.077512 | 0.112398 | 0.689624 | [
"s820723639",
"s128883124"
] |
u675844759 | p02396 | python | s759823705 | s466411945 | 140 | 50 | 7,620 | 7,436 | Accepted | Accepted | 64.29 | cnt = 0
num = int(eval(input()))
while num != 0:
cnt+=1
print(('Case {0}: {1}'.format(cnt, num)))
num = int(eval(input())) | import sys
cnt = 1
num = sys.stdin.readline().strip()
while num != "0":
print(("Case "+ str(cnt) + ": " + num))
cnt+=1
num = sys.stdin.readline().strip() | 6 | 7 | 119 | 170 | cnt = 0
num = int(eval(input()))
while num != 0:
cnt += 1
print(("Case {0}: {1}".format(cnt, num)))
num = int(eval(input()))
| import sys
cnt = 1
num = sys.stdin.readline().strip()
while num != "0":
print(("Case " + str(cnt) + ": " + num))
cnt += 1
num = sys.stdin.readline().strip()
| false | 14.285714 | [
"-cnt = 0",
"-num = int(eval(input()))",
"-while num != 0:",
"+import sys",
"+",
"+cnt = 1",
"+num = sys.stdin.readline().strip()",
"+while num != \"0\":",
"+ print((\"Case \" + str(cnt) + \": \" + num))",
"- print((\"Case {0}: {1}\".format(cnt, num)))",
"- num = int(eval(input()))",
... | false | 0.064525 | 0.035437 | 1.820833 | [
"s759823705",
"s466411945"
] |
u467736898 | p02710 | python | s402951359 | s239073893 | 887 | 816 | 155,500 | 167,280 | Accepted | Accepted | 8 | def numba_compile(numba_config):
import os, sys
if sys.argv[-1] == "ONLINE_JUDGE":
from numba import njit
from numba.pycc import CC
cc = CC("my_module")
for func, signature in numba_config:
globals()[func.__name__] = njit(signature)(func)
cc.export... | # オイラーツアーのテスト
def numba_compile(numba_config):
import os, sys
if sys.argv[-1] == "ONLINE_JUDGE":
from numba import njit
from numba.pycc import CC
cc = CC("my_module")
for func, signature in numba_config:
globals()[func.__name__] = njit(signature)(func)
... | 73 | 104 | 2,190 | 3,047 | def numba_compile(numba_config):
import os, sys
if sys.argv[-1] == "ONLINE_JUDGE":
from numba import njit
from numba.pycc import CC
cc = CC("my_module")
for func, signature in numba_config:
globals()[func.__name__] = njit(signature)(func)
cc.export(func.... | # オイラーツアーのテスト
def numba_compile(numba_config):
import os, sys
if sys.argv[-1] == "ONLINE_JUDGE":
from numba import njit
from numba.pycc import CC
cc = CC("my_module")
for func, signature in numba_config:
globals()[func.__name__] = njit(signature)(func)
c... | false | 29.807692 | [
"+# オイラーツアーのテスト",
"-def dfs1(v, G, Siz):",
"- siz = 1",
"- for u in G[v]:",
"- G[u].remove(v)",
"- siz += dfs1(u, G, Siz)",
"- Siz[v] = siz",
"- return siz",
"+def eular_tour(G, root):",
"+ # G は破壊的に有向木にされる",
"+ # グラフは 1-indexed が良い",
"+ n = len(G)",
"+ ... | false | 0.531069 | 0.366963 | 1.447199 | [
"s402951359",
"s239073893"
] |
u075012704 | p02702 | python | s068922756 | s074730092 | 365 | 325 | 9,756 | 20,224 | Accepted | Accepted | 10.96 | from collections import Counter
S = eval(input())
C = Counter()
MOD = 2019
n = 0
for i, s in enumerate(S[::-1]):
s = int(s)
n += pow(10, i, MOD) * s % MOD
C[n % MOD] += 1
C[0] += 1
ans = 0
for v in list(C.values()):
ans += v * (v - 1) // 2
print(ans)
| from collections import Counter
S = list(map(int, list(eval(input()))))
A = [0]
for i, s in enumerate(S[::-1]):
A.append((A[-1] + s * pow(10, i, 2019)) % 2019)
print((sum([v * (v - 1) // 2 for v in list(Counter(A).values())])))
| 16 | 6 | 272 | 223 | from collections import Counter
S = eval(input())
C = Counter()
MOD = 2019
n = 0
for i, s in enumerate(S[::-1]):
s = int(s)
n += pow(10, i, MOD) * s % MOD
C[n % MOD] += 1
C[0] += 1
ans = 0
for v in list(C.values()):
ans += v * (v - 1) // 2
print(ans)
| from collections import Counter
S = list(map(int, list(eval(input()))))
A = [0]
for i, s in enumerate(S[::-1]):
A.append((A[-1] + s * pow(10, i, 2019)) % 2019)
print((sum([v * (v - 1) // 2 for v in list(Counter(A).values())])))
| false | 62.5 | [
"-S = eval(input())",
"-C = Counter()",
"-MOD = 2019",
"-n = 0",
"+S = list(map(int, list(eval(input()))))",
"+A = [0]",
"- s = int(s)",
"- n += pow(10, i, MOD) * s % MOD",
"- C[n % MOD] += 1",
"-C[0] += 1",
"-ans = 0",
"-for v in list(C.values()):",
"- ans += v * (v - 1) // 2",
... | false | 0.034076 | 0.043935 | 0.775599 | [
"s068922756",
"s074730092"
] |
u652057333 | p02756 | python | s849514100 | s803498063 | 996 | 435 | 73,832 | 8,676 | Accepted | Accepted | 56.33 | from collections import deque
s = str(input().rstrip())
ans = deque(list(s))
f = True
q = int(eval(input()))
for i in range(q):
q = list(map(str, input().split()))
if int(q[0]) == 1:
if f:
f = False
else:
f = True
else:
f_i = int(q[1])
... | from collections import deque
import sys
input = sys.stdin.readline
s = str(input().rstrip())
ans = deque(list(s))
f = True
q = int(eval(input()))
for i in range(q):
q = list(map(str, input().split()))
if int(q[0]) == 1:
f = not f
else:
f_i = int(q[1])
if (f_i == 1) ^ ... | 32 | 22 | 653 | 466 | from collections import deque
s = str(input().rstrip())
ans = deque(list(s))
f = True
q = int(eval(input()))
for i in range(q):
q = list(map(str, input().split()))
if int(q[0]) == 1:
if f:
f = False
else:
f = True
else:
f_i = int(q[1])
if f_i == 1:
... | from collections import deque
import sys
input = sys.stdin.readline
s = str(input().rstrip())
ans = deque(list(s))
f = True
q = int(eval(input()))
for i in range(q):
q = list(map(str, input().split()))
if int(q[0]) == 1:
f = not f
else:
f_i = int(q[1])
if (f_i == 1) ^ f:
... | false | 31.25 | [
"+import sys",
"+input = sys.stdin.readline",
"- if f:",
"- f = False",
"- else:",
"- f = True",
"+ f = not f",
"- if f_i == 1:",
"- if f:",
"- ans.appendleft(q[2])",
"- else:",
"- ans.append(... | false | 0.051486 | 0.070792 | 0.727295 | [
"s849514100",
"s803498063"
] |
u936985471 | p02850 | python | s500950914 | s640048034 | 651 | 465 | 46,760 | 48,980 | Accepted | Accepted | 28.57 | # ある頂点で、子供に対して順に1,2,3...と辺の色を渡していく
# 親から来た色を持っておき、親から来た色と同色になったときはスキップして次の色を渡す
# グラフ構築の際に、辺の番号を持っておく
import sys
readline = sys.stdin.readline
N = int(readline())
G = [[] for i in range(N)]
for i in range(N - 1):
a,b = list(map(int,readline().split()))
G[a-1].append([b-1,i])
G[b-1].append([a-1,i])
... | import sys
readline = sys.stdin.readline
N = int(readline())
G = [[] for i in range(N)]
from collections import defaultdict
E = defaultdict(int)
for i in range(N - 1):
a,b = list(map(int,readline().split()))
G[a - 1].append(b - 1)
G[b - 1].append(a - 1)
E[(a - 1, b - 1)] = i
from collections ... | 33 | 41 | 691 | 833 | # ある頂点で、子供に対して順に1,2,3...と辺の色を渡していく
# 親から来た色を持っておき、親から来た色と同色になったときはスキップして次の色を渡す
# グラフ構築の際に、辺の番号を持っておく
import sys
readline = sys.stdin.readline
N = int(readline())
G = [[] for i in range(N)]
for i in range(N - 1):
a, b = list(map(int, readline().split()))
G[a - 1].append([b - 1, i])
G[b - 1].append([a - 1, i... | import sys
readline = sys.stdin.readline
N = int(readline())
G = [[] for i in range(N)]
from collections import defaultdict
E = defaultdict(int)
for i in range(N - 1):
a, b = list(map(int, readline().split()))
G[a - 1].append(b - 1)
G[b - 1].append(a - 1)
E[(a - 1, b - 1)] = i
from collections import ... | false | 19.512195 | [
"-# ある頂点で、子供に対して順に1,2,3...と辺の色を渡していく",
"-# 親から来た色を持っておき、親から来た色と同色になったときはスキップして次の色を渡す",
"-# グラフ構築の際に、辺の番号を持っておく",
"+from collections import defaultdict",
"+",
"+E = defaultdict(int)",
"- G[a - 1].append([b - 1, i])",
"- G[b - 1].append([a - 1, i])",
"-ans = [0 for i in range(N - 1)]",
"+ G... | false | 0.043166 | 0.08829 | 0.488917 | [
"s500950914",
"s640048034"
] |
u844789719 | p03785 | python | s449995727 | s178371621 | 1,734 | 260 | 8,280 | 8,280 | Accepted | Accepted | 85.01 | N, C, K = [int(_) for _ in input().split()]
times = sorted([int(eval(input())) for _ in range(N)])
count = 0
while times:
t = times.pop(0)
count += 1
num = 1
while times:
if times[0] <= t + K and num < C:
times.pop(0)
num += 1
else:
break
... | N, C, K = [int(_) for _ in input().split()]
times = sorted([int(eval(input())) for _ in range(N)], reverse=True)
count = 0
while times:
t = times.pop()
count += 1
num = 1
while times:
if times[-1] <= t + K and num < C:
times.pop()
num += 1
else:
... | 14 | 14 | 327 | 340 | N, C, K = [int(_) for _ in input().split()]
times = sorted([int(eval(input())) for _ in range(N)])
count = 0
while times:
t = times.pop(0)
count += 1
num = 1
while times:
if times[0] <= t + K and num < C:
times.pop(0)
num += 1
else:
break
print(count)
| N, C, K = [int(_) for _ in input().split()]
times = sorted([int(eval(input())) for _ in range(N)], reverse=True)
count = 0
while times:
t = times.pop()
count += 1
num = 1
while times:
if times[-1] <= t + K and num < C:
times.pop()
num += 1
else:
break
... | false | 0 | [
"-times = sorted([int(eval(input())) for _ in range(N)])",
"+times = sorted([int(eval(input())) for _ in range(N)], reverse=True)",
"- t = times.pop(0)",
"+ t = times.pop()",
"- if times[0] <= t + K and num < C:",
"- times.pop(0)",
"+ if times[-1] <= t + K and num < C:",
... | false | 0.086508 | 0.061382 | 1.409327 | [
"s449995727",
"s178371621"
] |
u219015402 | p03112 | python | s448725060 | s227519515 | 1,179 | 1,040 | 17,808 | 16,144 | Accepted | Accepted | 11.79 | import bisect
A, B, Q = list(map(int,input().split()))
INF = 10**18
s_list = [-INF] + [int(eval(input())) for i in range(A)] + [INF]
t_list = [-INF] + [int(eval(input())) for i in range(B)] + [INF]
x_list = [int(eval(input())) for i in range(Q)]
for x in x_list:
b, d = bisect.bisect_right(s_list, ... | import bisect
A, B, Q = list(map(int,input().split()))
INF = 10**18
s = [-INF] + [int(eval(input())) for i in range(A)] + [INF]
t = [-INF] + [int(eval(input())) for i in range(B)] + [INF]
x_list = [int(eval(input())) for i in range(Q)]
for x in x_list:
b, d = bisect.bisect_right(s, x), bisect.bise... | 20 | 24 | 596 | 837 | import bisect
A, B, Q = list(map(int, input().split()))
INF = 10**18
s_list = [-INF] + [int(eval(input())) for i in range(A)] + [INF]
t_list = [-INF] + [int(eval(input())) for i in range(B)] + [INF]
x_list = [int(eval(input())) for i in range(Q)]
for x in x_list:
b, d = bisect.bisect_right(s_list, x), bisect.bisec... | import bisect
A, B, Q = list(map(int, input().split()))
INF = 10**18
s = [-INF] + [int(eval(input())) for i in range(A)] + [INF]
t = [-INF] + [int(eval(input())) for i in range(B)] + [INF]
x_list = [int(eval(input())) for i in range(Q)]
for x in x_list:
b, d = bisect.bisect_right(s, x), bisect.bisect_right(t, x)
... | false | 16.666667 | [
"-s_list = [-INF] + [int(eval(input())) for i in range(A)] + [INF]",
"-t_list = [-INF] + [int(eval(input())) for i in range(B)] + [INF]",
"+s = [-INF] + [int(eval(input())) for i in range(A)] + [INF]",
"+t = [-INF] + [int(eval(input())) for i in range(B)] + [INF]",
"- b, d = bisect.bisect_right(s_list, x... | false | 0.151146 | 0.203254 | 0.743629 | [
"s448725060",
"s227519515"
] |
u562935282 | p03837 | python | s461259603 | s216743736 | 363 | 215 | 6,256 | 3,444 | Accepted | Accepted | 40.77 | def main():
from itertools import combinations
import sys
input = sys.stdin.readline
inf = 1000 * 100 + 10
N, M = list(map(int, input().split()))
dist = [[[inf, 0] for _ in range(N)] for _ in range(N)]
for j in range(N):
dist[j][j] = [0, 0]
for idx in range(M):
... | # https://atcoder.jp/contests/abc051/submissions/1055446
def main():
import sys
input = sys.stdin.readline
inf = 1000 * 100 + 10
N, M = list(map(int, input().split()))
dist = [[inf for _ in range(N)] for _ in range(N)]
for j in range(N):
dist[j][j] = 0
es = []
... | 39 | 38 | 1,095 | 836 | def main():
from itertools import combinations
import sys
input = sys.stdin.readline
inf = 1000 * 100 + 10
N, M = list(map(int, input().split()))
dist = [[[inf, 0] for _ in range(N)] for _ in range(N)]
for j in range(N):
dist[j][j] = [0, 0]
for idx in range(M):
a, b, c =... | # https://atcoder.jp/contests/abc051/submissions/1055446
def main():
import sys
input = sys.stdin.readline
inf = 1000 * 100 + 10
N, M = list(map(int, input().split()))
dist = [[inf for _ in range(N)] for _ in range(N)]
for j in range(N):
dist[j][j] = 0
es = []
for _ in range(M):... | false | 2.564103 | [
"+# https://atcoder.jp/contests/abc051/submissions/1055446",
"- from itertools import combinations",
"- dist = [[[inf, 0] for _ in range(N)] for _ in range(N)]",
"+ dist = [[inf for _ in range(N)] for _ in range(N)]",
"- dist[j][j] = [0, 0]",
"- for idx in range(M):",
"+ dist[j... | false | 0.036645 | 0.056481 | 0.648812 | [
"s461259603",
"s216743736"
] |
u836939578 | p03042 | python | s386297318 | s057426098 | 74 | 65 | 62,008 | 61,508 | Accepted | Accepted | 12.16 | import sys
input = lambda: sys.stdin.readline().rstrip()
S = eval(input())
f = int(S[:2])
s = int(S[2:])
if (f <= 0 and s > 12) or (f > 12 and s <= 0) or (f <= 0 and s <= 0) or (f > 12 and s > 12):
print("NA")
elif (f > 12 and 0 < s <= 12) or (f <= 0 and 0 < s <= 12):
print("YYMM")
elif (0 < f ... | S = eval(input())
front = int(S[:2])
rear = int(S[2:])
if (front > 12 and rear > 12) or (front > 12 and rear == 0) or (rear > 12 and front == 0) or (front == 0 and rear == 0):
print("NA")
exit()
elif 0 < rear <= 12 and (front > 12 or front == 0):
print("YYMM")
exit()
elif 0 < front <= 12 an... | 16 | 15 | 439 | 427 | import sys
input = lambda: sys.stdin.readline().rstrip()
S = eval(input())
f = int(S[:2])
s = int(S[2:])
if (
(f <= 0 and s > 12)
or (f > 12 and s <= 0)
or (f <= 0 and s <= 0)
or (f > 12 and s > 12)
):
print("NA")
elif (f > 12 and 0 < s <= 12) or (f <= 0 and 0 < s <= 12):
print("YYMM")
elif (0 ... | S = eval(input())
front = int(S[:2])
rear = int(S[2:])
if (
(front > 12 and rear > 12)
or (front > 12 and rear == 0)
or (rear > 12 and front == 0)
or (front == 0 and rear == 0)
):
print("NA")
exit()
elif 0 < rear <= 12 and (front > 12 or front == 0):
print("YYMM")
exit()
elif 0 < front <... | false | 6.25 | [
"-import sys",
"-",
"-input = lambda: sys.stdin.readline().rstrip()",
"-f = int(S[:2])",
"-s = int(S[2:])",
"+front = int(S[:2])",
"+rear = int(S[2:])",
"- (f <= 0 and s > 12)",
"- or (f > 12 and s <= 0)",
"- or (f <= 0 and s <= 0)",
"- or (f > 12 and s > 12)",
"+ (front > 12 an... | false | 0.067635 | 0.068485 | 0.987583 | [
"s386297318",
"s057426098"
] |
u759412327 | p04045 | python | s261093003 | s936786148 | 125 | 86 | 2,940 | 2,940 | Accepted | Accepted | 31.2 | N,K = list(map(int,input().split()))
D = list(input().split())
while True:
f = True
for s in str(N):
if s in D:
f = False
if f:
print((str(N)))
break
else:
N+=1 | N,K = list(map(int,input().split()))
D = set(input().split())
while len(set(str(N))&D)>0:
N+=1
print(N) | 13 | 7 | 195 | 107 | N, K = list(map(int, input().split()))
D = list(input().split())
while True:
f = True
for s in str(N):
if s in D:
f = False
if f:
print((str(N)))
break
else:
N += 1
| N, K = list(map(int, input().split()))
D = set(input().split())
while len(set(str(N)) & D) > 0:
N += 1
print(N)
| false | 46.153846 | [
"-D = list(input().split())",
"-while True:",
"- f = True",
"- for s in str(N):",
"- if s in D:",
"- f = False",
"- if f:",
"- print((str(N)))",
"- break",
"- else:",
"- N += 1",
"+D = set(input().split())",
"+while len(set(str(N)) & D) > 0:... | false | 0.077507 | 0.036015 | 2.152043 | [
"s261093003",
"s936786148"
] |
u377989038 | p02720 | python | s514868440 | s370945622 | 1,644 | 556 | 31,956 | 12,856 | Accepted | Accepted | 66.18 | def dfs(d, r):
global l
if d == 11:
return
l.append(int(r))
for i in range(-1, 2):
tmp = int(r[-1]) + i
if 0 <= tmp <= 9:
dfs(d + 1, r + str(tmp))
k = int(eval(input()))
l = []
for i in range(1, 10):
dfs(0, str(i))
print((sorted(l)[k - 1])) | def dfs(d, r):
global l
if d == 11:
return
l.append(int(r))
for i in range(-1, 2):
tmp = int(r[-1]) + i
if 0 <= tmp <= 9:
dfs(d + 1, r + str(tmp))
k = int(eval(input()))
l = []
for i in range(1, 10):
dfs(1, str(i))
print((sorted(l)[k - 1])) | 16 | 16 | 305 | 305 | def dfs(d, r):
global l
if d == 11:
return
l.append(int(r))
for i in range(-1, 2):
tmp = int(r[-1]) + i
if 0 <= tmp <= 9:
dfs(d + 1, r + str(tmp))
k = int(eval(input()))
l = []
for i in range(1, 10):
dfs(0, str(i))
print((sorted(l)[k - 1]))
| def dfs(d, r):
global l
if d == 11:
return
l.append(int(r))
for i in range(-1, 2):
tmp = int(r[-1]) + i
if 0 <= tmp <= 9:
dfs(d + 1, r + str(tmp))
k = int(eval(input()))
l = []
for i in range(1, 10):
dfs(1, str(i))
print((sorted(l)[k - 1]))
| false | 0 | [
"- dfs(0, str(i))",
"+ dfs(1, str(i))"
] | false | 2.695545 | 1.126183 | 2.393522 | [
"s514868440",
"s370945622"
] |
u079022693 | p03387 | python | s050132688 | s039488581 | 20 | 17 | 3,188 | 3,064 | Accepted | Accepted | 15 | from sys import stdin
def main():
#入力
readline=stdin.readline
a,b,c=list(map(int,readline().split()))
count=0
li=[a,b,c]
li.sort()
count+=li[2]-li[1]
li[0]+=li[2]-li[1]
li[1]+=li[2]-li[1]
count+=(li[2]-li[0])//2
li[0]+=((li[2]-li[0])//2)*2
if li[0]==l... | from sys import stdin
def main():
#入力
readline=stdin.readline
a,b,c=list(map(int,readline().split()))
li=[a,b,c]
li.sort()
x=li[0]
y=li[1]
z=li[2]
cnt=0
cnt+=z-y
x+=z-y
y+=z-y
if (z-x)%2==0:
cnt+=(z-x)//2
else:
cnt+=(z-x+1)//2+... | 24 | 24 | 424 | 371 | from sys import stdin
def main():
# 入力
readline = stdin.readline
a, b, c = list(map(int, readline().split()))
count = 0
li = [a, b, c]
li.sort()
count += li[2] - li[1]
li[0] += li[2] - li[1]
li[1] += li[2] - li[1]
count += (li[2] - li[0]) // 2
li[0] += ((li[2] - li[0]) // 2... | from sys import stdin
def main():
# 入力
readline = stdin.readline
a, b, c = list(map(int, readline().split()))
li = [a, b, c]
li.sort()
x = li[0]
y = li[1]
z = li[2]
cnt = 0
cnt += z - y
x += z - y
y += z - y
if (z - x) % 2 == 0:
cnt += (z - x) // 2
else:... | false | 0 | [
"- count = 0",
"- count += li[2] - li[1]",
"- li[0] += li[2] - li[1]",
"- li[1] += li[2] - li[1]",
"- count += (li[2] - li[0]) // 2",
"- li[0] += ((li[2] - li[0]) // 2) * 2",
"- if li[0] == li[2]:",
"- print(count)",
"+ x = li[0]",
"+ y = li[1]",
"+ z = li[2]... | false | 0.047638 | 0.08701 | 0.547496 | [
"s050132688",
"s039488581"
] |
u075012704 | p04020 | python | s990966061 | s933344310 | 550 | 217 | 51,420 | 7,072 | Accepted | Accepted | 60.55 | from collections import OrderedDict, deque
N = int(eval(input()))
A = OrderedDict({i: int(eval(input())) for i in range(1, N+1)})
ans = 0
for key in range(1, N):
ans += A[key] // 2
A[key] %= 2
if (A[key] == 1) & (A[key+1] > 0):
ans += 1
A[key+1] -= 1
print((ans + A[N]//2)) | N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
ans = 0
for i in range(N-1):
ans += A[i] // 2
if A[i] % 2 and A[i+1]:
ans += 1
A[i+1] -= 1
print((ans + A[-1]//2)) | 14 | 11 | 303 | 202 | from collections import OrderedDict, deque
N = int(eval(input()))
A = OrderedDict({i: int(eval(input())) for i in range(1, N + 1)})
ans = 0
for key in range(1, N):
ans += A[key] // 2
A[key] %= 2
if (A[key] == 1) & (A[key + 1] > 0):
ans += 1
A[key + 1] -= 1
print((ans + A[N] // 2))
| N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
ans = 0
for i in range(N - 1):
ans += A[i] // 2
if A[i] % 2 and A[i + 1]:
ans += 1
A[i + 1] -= 1
print((ans + A[-1] // 2))
| false | 21.428571 | [
"-from collections import OrderedDict, deque",
"-",
"-A = OrderedDict({i: int(eval(input())) for i in range(1, N + 1)})",
"+A = [int(eval(input())) for i in range(N)]",
"-for key in range(1, N):",
"- ans += A[key] // 2",
"- A[key] %= 2",
"- if (A[key] == 1) & (A[key + 1] > 0):",
"+for i in ... | false | 0.034286 | 0.035913 | 0.954687 | [
"s990966061",
"s933344310"
] |
u619458041 | p02991 | python | s810206659 | s149862990 | 735 | 461 | 19,160 | 50,628 | Accepted | Accepted | 37.28 | import sys
from collections import deque
sys.setrecursionlimit(10**6)
def main():
input = sys.stdin.readline
N, M = list(map(int, input().split()))
G = [[] for _ in range(N)]
for _ in range(M):
u, v = list(map(int, input().split()))
G[u-1].append(v-1)
S, T = list(map(int,... | import sys
from collections import deque
def main():
input = sys.stdin.readline
N, M = list(map(int, input().split()))
G = [[] for _ in range(3*N)]
for _ in range(M):
u, v = list(map(int, input().split()))
u, v = u-1, v-1
G[3*u].append(3*v+1)
G[3*u+1].append... | 48 | 45 | 1,030 | 943 | import sys
from collections import deque
sys.setrecursionlimit(10**6)
def main():
input = sys.stdin.readline
N, M = list(map(int, input().split()))
G = [[] for _ in range(N)]
for _ in range(M):
u, v = list(map(int, input().split()))
G[u - 1].append(v - 1)
S, T = list(map(int, inpu... | import sys
from collections import deque
def main():
input = sys.stdin.readline
N, M = list(map(int, input().split()))
G = [[] for _ in range(3 * N)]
for _ in range(M):
u, v = list(map(int, input().split()))
u, v = u - 1, v - 1
G[3 * u].append(3 * v + 1)
G[3 * u + 1].ap... | false | 6.25 | [
"-",
"-sys.setrecursionlimit(10**6)",
"- G = [[] for _ in range(N)]",
"+ G = [[] for _ in range(3 * N)]",
"- G[u - 1].append(v - 1)",
"+ u, v = u - 1, v - 1",
"+ G[3 * u].append(3 * v + 1)",
"+ G[3 * u + 1].append(3 * v + 2)",
"+ G[3 * u + 2].append(3 * v)",
... | false | 0.042119 | 0.12633 | 0.333404 | [
"s810206659",
"s149862990"
] |
u816631826 | p02676 | python | s220595753 | s632657470 | 31 | 28 | 9,028 | 9,200 | Accepted | Accepted | 9.68 | K=int(eval(input()))
S=eval(input())
if len(S)<K or len(S)==K:
print (S)
elif len(S)>K:
print((S[0:K]+"...")) | k=int(eval(input()))
s=eval(input())
characters=len(s)
empty=""
if characters<=k:
print(s)
else:
i=0
while i<=k-1:
empty+=s[i]
i=i+1
print(f"{empty}...") | 6 | 12 | 109 | 179 | K = int(eval(input()))
S = eval(input())
if len(S) < K or len(S) == K:
print(S)
elif len(S) > K:
print((S[0:K] + "..."))
| k = int(eval(input()))
s = eval(input())
characters = len(s)
empty = ""
if characters <= k:
print(s)
else:
i = 0
while i <= k - 1:
empty += s[i]
i = i + 1
print(f"{empty}...")
| false | 50 | [
"-K = int(eval(input()))",
"-S = eval(input())",
"-if len(S) < K or len(S) == K:",
"- print(S)",
"-elif len(S) > K:",
"- print((S[0:K] + \"...\"))",
"+k = int(eval(input()))",
"+s = eval(input())",
"+characters = len(s)",
"+empty = \"\"",
"+if characters <= k:",
"+ print(s)",
"+else... | false | 0.038954 | 0.035899 | 1.08508 | [
"s220595753",
"s632657470"
] |
u360116509 | p03163 | python | s601120954 | s329282968 | 403 | 368 | 118,512 | 118,512 | Accepted | Accepted | 8.68 | def main():
N, W = list(map(int, input().split()))
WV = []
for _ in range(N):
w, v = list(map(int, input().split()))
WV.append((w, v))
dp = [[0] * (W + 1) for _ in range(N + 1)]
for i in range(N):
for j in range(W + 1):
if j >= WV[i][0]:
... | def main():
N, W = list(map(int, input().split()))
dp = [[0] * (W + 1) for _ in range(N + 1)]
for i in range(N):
w, v = list(map(int, input().split()))
for j in range(W + 1):
if j >= w:
dp[i + 1][j] = max(
dp[i][j],
... | 20 | 17 | 525 | 440 | def main():
N, W = list(map(int, input().split()))
WV = []
for _ in range(N):
w, v = list(map(int, input().split()))
WV.append((w, v))
dp = [[0] * (W + 1) for _ in range(N + 1)]
for i in range(N):
for j in range(W + 1):
if j >= WV[i][0]:
dp[i + 1][... | def main():
N, W = list(map(int, input().split()))
dp = [[0] * (W + 1) for _ in range(N + 1)]
for i in range(N):
w, v = list(map(int, input().split()))
for j in range(W + 1):
if j >= w:
dp[i + 1][j] = max(dp[i][j], dp[i][j - w] + v)
else:
... | false | 15 | [
"- WV = []",
"- for _ in range(N):",
"- w, v = list(map(int, input().split()))",
"- WV.append((w, v))",
"+ w, v = list(map(int, input().split()))",
"- if j >= WV[i][0]:",
"- dp[i + 1][j] = max(dp[i][j], dp[i][j - WV[i][0]] + WV[i][1])",
"+ ... | false | 0.04737 | 0.044474 | 1.065113 | [
"s601120954",
"s329282968"
] |
u901582103 | p02707 | python | s751148265 | s708683633 | 192 | 158 | 33,992 | 32,372 | Accepted | Accepted | 17.71 | from collections import Counter
n=int(eval(input()))
A=list(map(int,input().split()))
AC=Counter(A)
for i in range(n):
if (i+1) in list(AC.keys()):
print((AC[i+1]))
else:
print((0)) | n=int(eval(input()))
A=list(map(int,input().split()))
L=[0]*n
for i in range(n-1):
L[A[i]-1]+=1
for i in range(n):
print((L[i])) | 9 | 7 | 197 | 134 | from collections import Counter
n = int(eval(input()))
A = list(map(int, input().split()))
AC = Counter(A)
for i in range(n):
if (i + 1) in list(AC.keys()):
print((AC[i + 1]))
else:
print((0))
| n = int(eval(input()))
A = list(map(int, input().split()))
L = [0] * n
for i in range(n - 1):
L[A[i] - 1] += 1
for i in range(n):
print((L[i]))
| false | 22.222222 | [
"-from collections import Counter",
"-",
"-AC = Counter(A)",
"+L = [0] * n",
"+for i in range(n - 1):",
"+ L[A[i] - 1] += 1",
"- if (i + 1) in list(AC.keys()):",
"- print((AC[i + 1]))",
"- else:",
"- print((0))",
"+ print((L[i]))"
] | false | 0.049107 | 0.04882 | 1.005871 | [
"s751148265",
"s708683633"
] |
u633068244 | p00068 | python | s875293937 | s053234145 | 20 | 10 | 4,308 | 4,300 | Accepted | Accepted | 50 | def a(v1,v2):
if v1[0] != v2[0]:
return (v2[1]-v1[1])/(v2[0]-v1[0])
else:
return (v2[1]-v1[1])*(10**10)
def convex(v,n):
k = 0
d = []
u = []
for i in range(n):
d.append(i)
u.append(i)
while len(d) > 2:
if a(v[d[-3]],v[d[-2]]) < a(v[d[-2]],v[d[-1]]):
del d[-2]
else:
brea... | def a(v1,v2):
if v1[0] != v2[0]:
return (v2[1]-v1[1])/(v2[0]-v1[0])
else:
return (v2[1]-v1[1])*(10**10)
def dlt(p,v,sign):
while len(p) > 2:
if sign*(a(v[p[-3]],v[p[-2]]) - a(v[p[-2]],v[p[-1]])) < 0:
del p[-2]
else:
break
return p
def convex(v,n):
d,u = [],[]
for i in range(n):
d = ... | 31 | 24 | 628 | 552 | def a(v1, v2):
if v1[0] != v2[0]:
return (v2[1] - v1[1]) / (v2[0] - v1[0])
else:
return (v2[1] - v1[1]) * (10**10)
def convex(v, n):
k = 0
d = []
u = []
for i in range(n):
d.append(i)
u.append(i)
while len(d) > 2:
if a(v[d[-3]], v[d[-2]]) < a... | def a(v1, v2):
if v1[0] != v2[0]:
return (v2[1] - v1[1]) / (v2[0] - v1[0])
else:
return (v2[1] - v1[1]) * (10**10)
def dlt(p, v, sign):
while len(p) > 2:
if sign * (a(v[p[-3]], v[p[-2]]) - a(v[p[-2]], v[p[-1]])) < 0:
del p[-2]
else:
break
return ... | false | 22.580645 | [
"+def dlt(p, v, sign):",
"+ while len(p) > 2:",
"+ if sign * (a(v[p[-3]], v[p[-2]]) - a(v[p[-2]], v[p[-1]])) < 0:",
"+ del p[-2]",
"+ else:",
"+ break",
"+ return p",
"+",
"+",
"- k = 0",
"- d = []",
"- u = []",
"+ d, u = [], []",
"- ... | false | 0.043562 | 0.044433 | 0.980401 | [
"s875293937",
"s053234145"
] |
u549056918 | p02412 | python | s491020087 | s314033777 | 440 | 70 | 5,644 | 5,644 | Accepted | Accepted | 84.09 | from itertools import combinations as comb
def get_ans(m, n):
ans = sum(1 for nums in comb(list(range(1, min(m+1,n-2))), 3) if sum(nums)==n)
return ans
while True:
m, n = (int(x) for x in input().split())
if m==0 and n==0:
quit()
ans = get_ans(m, n)
print(ans)
| from itertools import combinations as comb
def get_ans(m, n):
ans = sum(1 for nums in comb(list(range(1, min(m+1,n-2))), 2) if ((n-sum(nums)>0) and (n-sum(nums) > max(nums)) and (n-sum(nums)<=m)))
return ans
while True:
m, n = (int(x) for x in input().split())
if m==0 and n==0:
qu... | 11 | 11 | 304 | 360 | from itertools import combinations as comb
def get_ans(m, n):
ans = sum(
1 for nums in comb(list(range(1, min(m + 1, n - 2))), 3) if sum(nums) == n
)
return ans
while True:
m, n = (int(x) for x in input().split())
if m == 0 and n == 0:
quit()
ans = get_ans(m, n)
print(ans... | from itertools import combinations as comb
def get_ans(m, n):
ans = sum(
1
for nums in comb(list(range(1, min(m + 1, n - 2))), 2)
if (
(n - sum(nums) > 0) and (n - sum(nums) > max(nums)) and (n - sum(nums) <= m)
)
)
return ans
while True:
m, n = (int(x) fo... | false | 0 | [
"- 1 for nums in comb(list(range(1, min(m + 1, n - 2))), 3) if sum(nums) == n",
"+ 1",
"+ for nums in comb(list(range(1, min(m + 1, n - 2))), 2)",
"+ if (",
"+ (n - sum(nums) > 0) and (n - sum(nums) > max(nums)) and (n - sum(nums) <= m)",
"+ )"
] | false | 0.034747 | 0.052813 | 0.657932 | [
"s491020087",
"s314033777"
] |
u652583512 | p03078 | python | s419229986 | s506898448 | 257 | 40 | 47,220 | 4,832 | Accepted | Accepted | 84.44 | X, Y, Z, K = list(map(int, input().split()))
A = sorted([int(i) for i in input().split()], reverse=True)
B = sorted([int(i) for i in input().split()], reverse=True)
C = sorted([int(i) for i in input().split()], reverse=True)
D = []
for i in range(min(K, X)):
for j in range(min(K, Y)):
if (i + 1) * (j... | import heapq
X, Y, Z, K = list(map(int, input().split()))
A = sorted([int(i) for i in input().split()], reverse=True)
B = sorted([int(i) for i in input().split()], reverse=True)
C = sorted([int(i) for i in input().split()], reverse=True)
Q = []
dic = {}
heapq.heappush(Q, (-(A[0] + B[0] + C[0]), 0, 0, 0))
i = ... | 19 | 25 | 579 | 1,003 | X, Y, Z, K = list(map(int, input().split()))
A = sorted([int(i) for i in input().split()], reverse=True)
B = sorted([int(i) for i in input().split()], reverse=True)
C = sorted([int(i) for i in input().split()], reverse=True)
D = []
for i in range(min(K, X)):
for j in range(min(K, Y)):
if (i + 1) * (j + 1) >... | import heapq
X, Y, Z, K = list(map(int, input().split()))
A = sorted([int(i) for i in input().split()], reverse=True)
B = sorted([int(i) for i in input().split()], reverse=True)
C = sorted([int(i) for i in input().split()], reverse=True)
Q = []
dic = {}
heapq.heappush(Q, (-(A[0] + B[0] + C[0]), 0, 0, 0))
i = 0
while i... | false | 24 | [
"+import heapq",
"+",
"-D = []",
"-for i in range(min(K, X)):",
"- for j in range(min(K, Y)):",
"- if (i + 1) * (j + 1) > K:",
"- break",
"- for k in range(min(K, Z)):",
"- if (i + 1) * (j + 1) * (k + 1) > K:",
"- break",
"- else:"... | false | 0.088665 | 0.03728 | 2.378374 | [
"s419229986",
"s506898448"
] |
u325264482 | p03127 | python | s026675157 | s363675483 | 140 | 98 | 14,484 | 16,244 | Accepted | Accepted | 30 | N = int(eval(input()))
A = list(map(int, input().split()))
As = sorted(A)
As = [a%As[0] if a%As[0] != 0 else As[0] for a in As]
As = sorted(As)
def judge(tmp_one, tmp_two):
flg = 1
while flg:
if tmp_two%tmp_one == 0:
tmp_two = tmp_one
else:
tmp_two = tmp_... | import fractions
N = int(eval(input()))
A = list(map(int, input().split()))
ans = fractions.gcd(A[0], A[1])
for i in range(2, N):
ans = fractions.gcd(ans, A[i])
print(ans)
| 35 | 13 | 720 | 189 | N = int(eval(input()))
A = list(map(int, input().split()))
As = sorted(A)
As = [a % As[0] if a % As[0] != 0 else As[0] for a in As]
As = sorted(As)
def judge(tmp_one, tmp_two):
flg = 1
while flg:
if tmp_two % tmp_one == 0:
tmp_two = tmp_one
else:
tmp_two = tmp_two % tmp... | import fractions
N = int(eval(input()))
A = list(map(int, input().split()))
ans = fractions.gcd(A[0], A[1])
for i in range(2, N):
ans = fractions.gcd(ans, A[i])
print(ans)
| false | 62.857143 | [
"+import fractions",
"+",
"-As = sorted(A)",
"-As = [a % As[0] if a % As[0] != 0 else As[0] for a in As]",
"-As = sorted(As)",
"-",
"-",
"-def judge(tmp_one, tmp_two):",
"- flg = 1",
"- while flg:",
"- if tmp_two % tmp_one == 0:",
"- tmp_two = tmp_one",
"- else... | false | 0.036617 | 0.007188 | 5.093824 | [
"s026675157",
"s363675483"
] |
u869919400 | p02861 | python | s881167082 | s949978579 | 209 | 95 | 43,756 | 74,428 | Accepted | Accepted | 54.55 | from math import sqrt
from itertools import permutations as per
N = int(eval(input()))
xy = [list(map(int, input().split())) for i in range(N)]
kumi = per(list(range(N)))
ans = []
leng = 0
for p in kumi:
cnt = 0
for i in range(1, len(p)):
cnt += sqrt((xy[p[i-1]][0] - xy[p[i]][0])**2 + (xy[p[i-... | N = int(eval(input()))
xy = [list(map(int, input().split())) for i in range(N)]
from itertools import permutations
from math import sqrt
paths = list(permutations(list(range(N)), N))
l = len(paths)
total = 0
for path in paths:
tmp = 0
x, y = xy[path[0]][0], xy[path[0]][1]
for p in path[1:]:
... | 14 | 17 | 393 | 422 | from math import sqrt
from itertools import permutations as per
N = int(eval(input()))
xy = [list(map(int, input().split())) for i in range(N)]
kumi = per(list(range(N)))
ans = []
leng = 0
for p in kumi:
cnt = 0
for i in range(1, len(p)):
cnt += sqrt(
(xy[p[i - 1]][0] - xy[p[i]][0]) ** 2 + ... | N = int(eval(input()))
xy = [list(map(int, input().split())) for i in range(N)]
from itertools import permutations
from math import sqrt
paths = list(permutations(list(range(N)), N))
l = len(paths)
total = 0
for path in paths:
tmp = 0
x, y = xy[path[0]][0], xy[path[0]][1]
for p in path[1:]:
px, py ... | false | 17.647059 | [
"-from math import sqrt",
"-from itertools import permutations as per",
"-",
"-kumi = per(list(range(N)))",
"-ans = []",
"-leng = 0",
"-for p in kumi:",
"- cnt = 0",
"- for i in range(1, len(p)):",
"- cnt += sqrt(",
"- (xy[p[i - 1]][0] - xy[p[i]][0]) ** 2 + (xy[p[i - 1]][... | false | 0.167306 | 0.046771 | 3.577139 | [
"s881167082",
"s949978579"
] |
u327466606 | p03634 | python | s039570302 | s014565117 | 1,760 | 1,425 | 61,260 | 43,312 | Accepted | Accepted | 19.03 | from collections import defaultdict
N = int(eval(input()))
E = defaultdict(list)
W = dict()
for i in range(N-1):
a,b,c = list(map(int,input().split()))
E[a].append(b)
E[b].append(a)
W[(a,b)] = c
W[(b,a)] = c
Q,K = list(map(int,input().split()))
costs = [float('inf')]*(N+1)
costs[K] = 0
... |
N = int(eval(input()))
E = [[] for _ in range(N)]
for i in range(N-1):
a,b,c = list(map(int,input().split()))
a -= 1
b -= 1
E[a].append((b,c))
E[b].append((a,c))
Q,K = list(map(int,input().split()))
K -= 1
costs = [None]*N
costs[K] = 0
stack = [K]
while stack:
s = stack.pop()
c = ... | 30 | 29 | 551 | 491 | from collections import defaultdict
N = int(eval(input()))
E = defaultdict(list)
W = dict()
for i in range(N - 1):
a, b, c = list(map(int, input().split()))
E[a].append(b)
E[b].append(a)
W[(a, b)] = c
W[(b, a)] = c
Q, K = list(map(int, input().split()))
costs = [float("inf")] * (N + 1)
costs[K] = 0... | N = int(eval(input()))
E = [[] for _ in range(N)]
for i in range(N - 1):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
E[a].append((b, c))
E[b].append((a, c))
Q, K = list(map(int, input().split()))
K -= 1
costs = [None] * N
costs[K] = 0
stack = [K]
while stack:
s = stack.pop()
c = ... | false | 3.333333 | [
"-from collections import defaultdict",
"-",
"-E = defaultdict(list)",
"-W = dict()",
"+E = [[] for _ in range(N)]",
"- E[a].append(b)",
"- E[b].append(a)",
"- W[(a, b)] = c",
"- W[(b, a)] = c",
"+ a -= 1",
"+ b -= 1",
"+ E[a].append((b, c))",
"+ E[b].append((a, c))",... | false | 0.152311 | 0.045264 | 3.364971 | [
"s039570302",
"s014565117"
] |
u391589398 | p02761 | python | s831902977 | s490358104 | 32 | 28 | 9,184 | 9,180 | Accepted | Accepted | 12.5 | n, m = list(map(int, input().split()))
digits = [-1]*n
for _ in range(m):
s, c = list(map(int, input().split()))
s -= 1
if digits[s] == -1 or digits[s] == c:
digits[s] = c
else:
print((-1))
break
else:
if n == 1:
print((0 if digits[0] == -1 else digits[0])... | n, m = list(map(int, input().split()))
sc = []
for _ in range(m):
s, c = list(map(int, input().split()))
s -= 1
sc.append((s, c))
for nn in range(10**n):
sn = str(nn)
if len(sn) != n:
continue
for s, c in sc:
if int(sn[s]) != c:
break
else:
... | 26 | 19 | 676 | 355 | n, m = list(map(int, input().split()))
digits = [-1] * n
for _ in range(m):
s, c = list(map(int, input().split()))
s -= 1
if digits[s] == -1 or digits[s] == c:
digits[s] = c
else:
print((-1))
break
else:
if n == 1:
print((0 if digits[0] == -1 else digits[0]))
else... | n, m = list(map(int, input().split()))
sc = []
for _ in range(m):
s, c = list(map(int, input().split()))
s -= 1
sc.append((s, c))
for nn in range(10**n):
sn = str(nn)
if len(sn) != n:
continue
for s, c in sc:
if int(sn[s]) != c:
break
else:
print(nn)
... | false | 26.923077 | [
"-digits = [-1] * n",
"+sc = []",
"- if digits[s] == -1 or digits[s] == c:",
"- digits[s] = c",
"+ sc.append((s, c))",
"+for nn in range(10**n):",
"+ sn = str(nn)",
"+ if len(sn) != n:",
"+ continue",
"+ for s, c in sc:",
"+ if int(sn[s]) != c:",
"+ ... | false | 0.084935 | 0.135034 | 0.628988 | [
"s831902977",
"s490358104"
] |
u674588203 | p02582 | python | s990559266 | s743810805 | 36 | 31 | 9,032 | 8,948 | Accepted | Accepted | 13.89 | # AtCoder Beginner Contest 175
S=eval(input())
if S=="SSS":
print((0))
exit()
if S=="SRR" or S=="RRS":
print((2))
exit()
if S=="RRR":
print((3))
exit()
else:
print((1)) | # AtCoder Beginner Contest 175
# A - Rainy Season
S=eval(input())
if S=="RRR":
print((3))
exit()
if S=="SRR" or S=="RRS":
print((2))
exit()
if S=="SSS":
print((0))
exit()
else:
print((1)) | 14 | 15 | 196 | 216 | # AtCoder Beginner Contest 175
S = eval(input())
if S == "SSS":
print((0))
exit()
if S == "SRR" or S == "RRS":
print((2))
exit()
if S == "RRR":
print((3))
exit()
else:
print((1))
| # AtCoder Beginner Contest 175
# A - Rainy Season
S = eval(input())
if S == "RRR":
print((3))
exit()
if S == "SRR" or S == "RRS":
print((2))
exit()
if S == "SSS":
print((0))
exit()
else:
print((1))
| false | 6.666667 | [
"+# A - Rainy Season",
"-if S == \"SSS\":",
"- print((0))",
"+if S == \"RRR\":",
"+ print((3))",
"-if S == \"RRR\":",
"- print((3))",
"+if S == \"SSS\":",
"+ print((0))"
] | false | 0.085977 | 0.102831 | 0.836102 | [
"s990559266",
"s743810805"
] |
u197300773 | p03221 | python | s287833850 | s909038602 | 1,111 | 993 | 81,240 | 81,056 | Accepted | Accepted | 10.62 | _,m=list(map(int,input().split()))
ta=[list(map(int,input().split()))+[i] for i in range(m)]
a=sorted(ta)
ans=[-1]*m
j=0
for i in range(m):
if j!=a[i][0]:
j=a[i][0]
k=1
p=str(a[i][0]).zfill(6)+str(k).zfill(6)
ans[a[i][2]]=p
k+=1
a.sort()
for i in range(m):
print((ans[... | n,m=list(map(int,input().split()))
x=[[] for _ in range(n+1)]
ans=[-1]*m
for i in range(m):
p,y=list(map(int,input().split()))
x[p].append([y,i])
for p in range(1,n+1):
x[p].sort()
for j in range(len(x[p])):
ans[x[p][j][1]]=str(p).zfill(6)+str(j+1).zfill(6)
for i in range(m):
... | 16 | 14 | 317 | 321 | _, m = list(map(int, input().split()))
ta = [list(map(int, input().split())) + [i] for i in range(m)]
a = sorted(ta)
ans = [-1] * m
j = 0
for i in range(m):
if j != a[i][0]:
j = a[i][0]
k = 1
p = str(a[i][0]).zfill(6) + str(k).zfill(6)
ans[a[i][2]] = p
k += 1
a.sort()
for i in range(m):
... | n, m = list(map(int, input().split()))
x = [[] for _ in range(n + 1)]
ans = [-1] * m
for i in range(m):
p, y = list(map(int, input().split()))
x[p].append([y, i])
for p in range(1, n + 1):
x[p].sort()
for j in range(len(x[p])):
ans[x[p][j][1]] = str(p).zfill(6) + str(j + 1).zfill(6)
for i in ran... | false | 12.5 | [
"-_, m = list(map(int, input().split()))",
"-ta = [list(map(int, input().split())) + [i] for i in range(m)]",
"-a = sorted(ta)",
"+n, m = list(map(int, input().split()))",
"+x = [[] for _ in range(n + 1)]",
"-j = 0",
"- if j != a[i][0]:",
"- j = a[i][0]",
"- k = 1",
"- p = str(... | false | 0.047027 | 0.038524 | 1.220707 | [
"s287833850",
"s909038602"
] |
u057109575 | p02820 | python | s602329668 | s717722311 | 223 | 79 | 41,200 | 73,476 | Accepted | Accepted | 64.57 | N, K = list(map(int, input().split()))
R, S, P = list(map(int, input().split()))
T = eval(input())
dp = [False] * N
for i in range(N):
if i >= K and dp[i - K] and T[i] == T[i - K]:
continue
dp[i] = True
ans = 0
for i in range(N):
if not dp[i]:
continue
if ... | N, K = list(map(int, input().split()))
R, S, P = list(map(int, input().split()))
T = eval(input())
ok = [True] * N
d = {"r": P, "s": R, "p": S}
ans = 0
for i in range(N):
if i >= K and T[i - K] == T[i] and ok[i - K]:
ok[i] = False
if ok[i]:
ans += d[T[i]]
print(ans)
| 24 | 14 | 425 | 288 | N, K = list(map(int, input().split()))
R, S, P = list(map(int, input().split()))
T = eval(input())
dp = [False] * N
for i in range(N):
if i >= K and dp[i - K] and T[i] == T[i - K]:
continue
dp[i] = True
ans = 0
for i in range(N):
if not dp[i]:
continue
if T[i] == "r":
ans += P
... | N, K = list(map(int, input().split()))
R, S, P = list(map(int, input().split()))
T = eval(input())
ok = [True] * N
d = {"r": P, "s": R, "p": S}
ans = 0
for i in range(N):
if i >= K and T[i - K] == T[i] and ok[i - K]:
ok[i] = False
if ok[i]:
ans += d[T[i]]
print(ans)
| false | 41.666667 | [
"-dp = [False] * N",
"-for i in range(N):",
"- if i >= K and dp[i - K] and T[i] == T[i - K]:",
"- continue",
"- dp[i] = True",
"+ok = [True] * N",
"+d = {\"r\": P, \"s\": R, \"p\": S}",
"- if not dp[i]:",
"- continue",
"- if T[i] == \"r\":",
"- ans += P",
"- ... | false | 0.044646 | 0.036592 | 1.220123 | [
"s602329668",
"s717722311"
] |
u078349616 | p02720 | python | s568840547 | s580228731 | 295 | 131 | 10,584 | 6,096 | Accepted | Accepted | 55.59 | from collections import deque
K = int(eval(input()))
q = deque([0])
cnt = 0
ans = []
while q:
a = q.popleft()
r = a % 10
a *= 10
for i in range(10):
if abs(r - i) <= 1 or a == 0:
if cnt < K and a + i != 0:
q.append(a + i)
ans.append(a + i)
cnt += 1
print((ans... | from collections import deque
K = int(eval(input()))
q = deque([0])
cnt = 0
while q:
n = q.popleft()
r = n % 10; n *= 10;
for i in range(10):
if abs(r - i) <= 1 or n == 0:
if n + i != 0:
q.append(n + i)
cnt += 1
if cnt == K:
print((n+i))
exit() | 18 | 16 | 318 | 312 | from collections import deque
K = int(eval(input()))
q = deque([0])
cnt = 0
ans = []
while q:
a = q.popleft()
r = a % 10
a *= 10
for i in range(10):
if abs(r - i) <= 1 or a == 0:
if cnt < K and a + i != 0:
q.append(a + i)
ans.append(a + i)
... | from collections import deque
K = int(eval(input()))
q = deque([0])
cnt = 0
while q:
n = q.popleft()
r = n % 10
n *= 10
for i in range(10):
if abs(r - i) <= 1 or n == 0:
if n + i != 0:
q.append(n + i)
cnt += 1
if cnt == K:
... | false | 11.111111 | [
"-ans = []",
"- a = q.popleft()",
"- r = a % 10",
"- a *= 10",
"+ n = q.popleft()",
"+ r = n % 10",
"+ n *= 10",
"- if abs(r - i) <= 1 or a == 0:",
"- if cnt < K and a + i != 0:",
"- q.append(a + i)",
"- ans.append(a + i)",
"+ ... | false | 0.102338 | 0.048962 | 2.090152 | [
"s568840547",
"s580228731"
] |
u523130469 | p02813 | python | s051695383 | s346848636 | 262 | 193 | 46,448 | 38,896 | Accepted | Accepted | 26.34 | import itertools
n = int(input().strip())
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
p_cnt = 0
q_cnt = 0
for i, e in enumerate(sorted(list(itertools.permutations(p)))):
if p == e:
p_cnt = i
if q == e:
q_cnt = i
print((abs(p_cnt - q_cnt)))
| from itertools import permutations as perms
n = int(input().strip())
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
lis = [(i + 1) for i in range(n)]
a = -1
b = -1
cnt = 0
for elem in perms(lis, n):
cnt += 1
if elem == p:
a = cnt
if elem == q:
b = cn... | 13 | 18 | 305 | 385 | import itertools
n = int(input().strip())
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
p_cnt = 0
q_cnt = 0
for i, e in enumerate(sorted(list(itertools.permutations(p)))):
if p == e:
p_cnt = i
if q == e:
q_cnt = i
print((abs(p_cnt - q_cnt)))
| from itertools import permutations as perms
n = int(input().strip())
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
lis = [(i + 1) for i in range(n)]
a = -1
b = -1
cnt = 0
for elem in perms(lis, n):
cnt += 1
if elem == p:
a = cnt
if elem == q:
b = cnt
if a != ... | false | 27.777778 | [
"-import itertools",
"+from itertools import permutations as perms",
"-p_cnt = 0",
"-q_cnt = 0",
"-for i, e in enumerate(sorted(list(itertools.permutations(p)))):",
"- if p == e:",
"- p_cnt = i",
"- if q == e:",
"- q_cnt = i",
"-print((abs(p_cnt - q_cnt)))",
"+lis = [(i + 1) ... | false | 0.045584 | 0.251798 | 0.181036 | [
"s051695383",
"s346848636"
] |
u340781749 | p03033 | python | s804087666 | s988694759 | 1,409 | 1,168 | 131,248 | 99,400 | Accepted | Accepted | 17.1 | import sys
from heapq import heappop, heappush
n, q = list(map(int, input().split()))
lines = sys.stdin.readlines()
events = []
kkk = []
for line in lines[:n]:
s, t, x = list(map(int, line.split()))
events.append((s - x, 2, x))
events.append((t - x, 1, x))
for line in lines[n:]:
events.appe... | import sys
from bisect import bisect_left
n, q = list(map(int, input().split()))
lines = sys.stdin.readlines()
kkk = []
for line in lines[:n]:
s, t, x = list(map(int, line.split()))
kkk.append((x, s, t))
kkk.sort()
ddd = list(map(int, lines[n:]))
ans = [-1] * q
skip = [-1] * q
for x, s, t in kkk... | 32 | 27 | 802 | 621 | import sys
from heapq import heappop, heappush
n, q = list(map(int, input().split()))
lines = sys.stdin.readlines()
events = []
kkk = []
for line in lines[:n]:
s, t, x = list(map(int, line.split()))
events.append((s - x, 2, x))
events.append((t - x, 1, x))
for line in lines[n:]:
events.append((int(line... | import sys
from bisect import bisect_left
n, q = list(map(int, input().split()))
lines = sys.stdin.readlines()
kkk = []
for line in lines[:n]:
s, t, x = list(map(int, line.split()))
kkk.append((x, s, t))
kkk.sort()
ddd = list(map(int, lines[n:]))
ans = [-1] * q
skip = [-1] * q
for x, s, t in kkk:
ss = bise... | false | 15.625 | [
"-from heapq import heappop, heappush",
"+from bisect import bisect_left",
"-events = []",
"- events.append((s - x, 2, x))",
"- events.append((t - x, 1, x))",
"-for line in lines[n:]:",
"- events.append((int(line), 3))",
"-events.sort()",
"-constructing = []",
"-available = set()",
"-bu... | false | 0.039291 | 0.101053 | 0.388817 | [
"s804087666",
"s988694759"
] |
u684241248 | p02265 | python | s074255160 | s668756960 | 2,190 | 1,770 | 69,812 | 69,812 | Accepted | Accepted | 19.18 | import sys
from collections import deque
n = int(eval(input()))
ary = deque([])
for line in sys.stdin:
op = line.strip().split()
cmd = op[0]
if cmd[0] == 'i':
x = op[1]
ary.appendleft(x)
elif len(cmd) == 6:
x = op[1]
if x in ary:
ary.remov... | import sys
from collections import deque
n = int(eval(input()))
ary = deque([])
for line in sys.stdin:
op = line.strip().split()
cmd = op[0]
if cmd == 'insert':
x = op[1]
ary.appendleft(x)
elif cmd == 'delete':
x = op[1]
if x in ary:
ary.r... | 27 | 27 | 419 | 428 | import sys
from collections import deque
n = int(eval(input()))
ary = deque([])
for line in sys.stdin:
op = line.strip().split()
cmd = op[0]
if cmd[0] == "i":
x = op[1]
ary.appendleft(x)
elif len(cmd) == 6:
x = op[1]
if x in ary:
ary.remove(x)
elif len(cm... | import sys
from collections import deque
n = int(eval(input()))
ary = deque([])
for line in sys.stdin:
op = line.strip().split()
cmd = op[0]
if cmd == "insert":
x = op[1]
ary.appendleft(x)
elif cmd == "delete":
x = op[1]
if x in ary:
ary.remove(x)
elif cm... | false | 0 | [
"- if cmd[0] == \"i\":",
"+ if cmd == \"insert\":",
"- elif len(cmd) == 6:",
"+ elif cmd == \"delete\":",
"- elif len(cmd) == 10:",
"+ elif cmd == \"deleteLast\":"
] | false | 0.035533 | 0.037236 | 0.954274 | [
"s074255160",
"s668756960"
] |
u943057856 | p02813 | python | s405807485 | s080935370 | 49 | 30 | 8,308 | 8,308 | Accepted | Accepted | 38.78 | import itertools
N = int(eval(input()))
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
n_list = [i for i in range(1,N+1)]
n_perm = sorted(list(itertools.permutations(n_list, N)))
a = 0
b = 0
for i in range(len(n_perm)):
if list(n_perm[i]) == P:
a = i
break
for ... | import itertools
n=int(eval(input()))
p=tuple(map(int,input().split()))
q=tuple(map(int,input().split()))
l=sorted(list(itertools.permutations(list(range(1,n+1)))))
print((abs(l.index(p)-l.index(q))))
| 20 | 6 | 429 | 192 | import itertools
N = int(eval(input()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
n_list = [i for i in range(1, N + 1)]
n_perm = sorted(list(itertools.permutations(n_list, N)))
a = 0
b = 0
for i in range(len(n_perm)):
if list(n_perm[i]) == P:
a = i
break
for k in range... | import itertools
n = int(eval(input()))
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
l = sorted(list(itertools.permutations(list(range(1, n + 1)))))
print((abs(l.index(p) - l.index(q))))
| false | 70 | [
"-N = int(eval(input()))",
"-P = list(map(int, input().split()))",
"-Q = list(map(int, input().split()))",
"-n_list = [i for i in range(1, N + 1)]",
"-n_perm = sorted(list(itertools.permutations(n_list, N)))",
"-a = 0",
"-b = 0",
"-for i in range(len(n_perm)):",
"- if list(n_perm[i]) == P:",
"-... | false | 0.04854 | 0.039243 | 1.2369 | [
"s405807485",
"s080935370"
] |
u439396449 | p03488 | python | s417722837 | s170505553 | 1,957 | 384 | 3,936 | 48,860 | Accepted | Accepted | 80.38 | from collections import defaultdict
s = eval(input())
x, y = list(map(int, input().split()))
d = [len(x) for x in s.split('T')]
dx = d[0::2]
n_dx = len(dx)
dp = {0}
for i in range(n_dx):
tmp = set()
for j in dp:
if i == 0:
tmp.add(j + dx[i])
else:
tmp.a... | from collections import defaultdict
s = eval(input())
x, y = list(map(int, input().split()))
d = [len(x) for x in s.split('T')]
dx = d[2::2]
n_dx = len(dx)
dp = {d[0]}
for i in range(n_dx):
tmp = set()
for j in dp:
tmp.add(j - dx[i])
tmp.add(j + dx[i])
dp = tmp
x_flag = x ... | 36 | 33 | 640 | 569 | from collections import defaultdict
s = eval(input())
x, y = list(map(int, input().split()))
d = [len(x) for x in s.split("T")]
dx = d[0::2]
n_dx = len(dx)
dp = {0}
for i in range(n_dx):
tmp = set()
for j in dp:
if i == 0:
tmp.add(j + dx[i])
else:
tmp.add(j - dx[i])
... | from collections import defaultdict
s = eval(input())
x, y = list(map(int, input().split()))
d = [len(x) for x in s.split("T")]
dx = d[2::2]
n_dx = len(dx)
dp = {d[0]}
for i in range(n_dx):
tmp = set()
for j in dp:
tmp.add(j - dx[i])
tmp.add(j + dx[i])
dp = tmp
x_flag = x in dp
dy = d[1::2]... | false | 8.333333 | [
"-dx = d[0::2]",
"+dx = d[2::2]",
"-dp = {0}",
"+dp = {d[0]}",
"- if i == 0:",
"- tmp.add(j + dx[i])",
"- else:",
"- tmp.add(j - dx[i])",
"- tmp.add(j + dx[i])",
"+ tmp.add(j - dx[i])",
"+ tmp.add(j + dx[i])"
] | false | 0.082683 | 0.08702 | 0.950158 | [
"s417722837",
"s170505553"
] |
u489959379 | p02588 | python | s136274637 | s936679389 | 1,172 | 170 | 9,172 | 95,404 | Accepted | Accepted | 85.49 | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
MAX = 50
def resolve():
n = int(eval(input()))
D = [[0] * MAX for _ in range(MAX)]
for _ in range(n):
a = int(round(float(eval(input())) * 10 ** 9))
t = a
x... | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 998244353
def resolve():
n = int(eval(input()))
A = []
for _ in range(n):
a = float(eval(input()))
a = round(a * 10 ** 9 + 0.1)
A.append(a)
L = [[0] * 25 for _ in r... | 41 | 52 | 938 | 1,249 | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
MAX = 50
def resolve():
n = int(eval(input()))
D = [[0] * MAX for _ in range(MAX)]
for _ in range(n):
a = int(round(float(eval(input())) * 10**9))
t = a
x = 0
while t % ... | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 998244353
def resolve():
n = int(eval(input()))
A = []
for _ in range(n):
a = float(eval(input()))
a = round(a * 10**9 + 0.1)
A.append(a)
L = [[0] * 25 for _ in range(45)]
D = []
... | false | 21.153846 | [
"-mod = 10**9 + 7",
"-MAX = 50",
"+mod = 998244353",
"- D = [[0] * MAX for _ in range(MAX)]",
"+ A = []",
"- a = int(round(float(eval(input())) * 10**9))",
"- t = a",
"- x = 0",
"- while t % 2 == 0:",
"- t //= 2",
"- x += 1",
"- t ... | false | 0.999847 | 0.091032 | 10.9835 | [
"s136274637",
"s936679389"
] |
u244416763 | p03592 | python | s953247326 | s350822920 | 286 | 255 | 17,908 | 9,188 | Accepted | Accepted | 10.84 | n, m, k = list(map(int, input().split()))
s = [[0 for i in range(n)]for j in range(m)]
for i in range(n+1):
for j in range(m+1):
if (i*m + j*n - 2*i*j) == k:
print("Yes")
exit()
print("No") | n, m, k = list(map(int, input().split()))
for i in range(n+1):
for j in range(m+1):
if (i*m + j*n - 2*i*j) == k:
print("Yes")
exit()
print("No") | 8 | 7 | 226 | 180 | n, m, k = list(map(int, input().split()))
s = [[0 for i in range(n)] for j in range(m)]
for i in range(n + 1):
for j in range(m + 1):
if (i * m + j * n - 2 * i * j) == k:
print("Yes")
exit()
print("No")
| n, m, k = list(map(int, input().split()))
for i in range(n + 1):
for j in range(m + 1):
if (i * m + j * n - 2 * i * j) == k:
print("Yes")
exit()
print("No")
| false | 12.5 | [
"-s = [[0 for i in range(n)] for j in range(m)]"
] | false | 0.045273 | 0.044343 | 1.020958 | [
"s953247326",
"s350822920"
] |
u780698286 | p02658 | python | s287067586 | s454652369 | 805 | 59 | 21,648 | 21,476 | Accepted | Accepted | 92.67 | # coding: utf-8
a = int(eval(input()))
b = list(map(int, input().split()))
c = 1
if 0 in b:
print((0))
else:
while c < 10 ** 18 and len(b) != 0:
c = c * b[0]
del b[0]
if c > 10 ** 18:
print((-1))
else:
print(c) | import sys
num = int(eval(input()))
a = list(map(int, input().split()))
b = 1
if 0 in a:
print((0))
sys.exit()
for i in a:
if b * i > 10 ** 18:
print((-1))
sys.exit()
else:
b *= i
print(b) | 14 | 15 | 239 | 217 | # coding: utf-8
a = int(eval(input()))
b = list(map(int, input().split()))
c = 1
if 0 in b:
print((0))
else:
while c < 10**18 and len(b) != 0:
c = c * b[0]
del b[0]
if c > 10**18:
print((-1))
else:
print(c)
| import sys
num = int(eval(input()))
a = list(map(int, input().split()))
b = 1
if 0 in a:
print((0))
sys.exit()
for i in a:
if b * i > 10**18:
print((-1))
sys.exit()
else:
b *= i
print(b)
| false | 6.666667 | [
"-# coding: utf-8",
"-a = int(eval(input()))",
"-b = list(map(int, input().split()))",
"-c = 1",
"-if 0 in b:",
"+import sys",
"+",
"+num = int(eval(input()))",
"+a = list(map(int, input().split()))",
"+b = 1",
"+if 0 in a:",
"-else:",
"- while c < 10**18 and len(b) != 0:",
"- c ... | false | 0.108255 | 0.036748 | 2.945864 | [
"s287067586",
"s454652369"
] |
u614181788 | p02657 | python | s534974797 | s293195683 | 23 | 20 | 9,156 | 8,944 | Accepted | Accepted | 13.04 | a,b = list(map(int,input().split()))
print((a*b)) | a,b = list(map(float,input().split()))
b = 100*b + 0.0000001
print((round((a*b)/100))) | 2 | 3 | 42 | 80 | a, b = list(map(int, input().split()))
print((a * b))
| a, b = list(map(float, input().split()))
b = 100 * b + 0.0000001
print((round((a * b) / 100)))
| false | 33.333333 | [
"-a, b = list(map(int, input().split()))",
"-print((a * b))",
"+a, b = list(map(float, input().split()))",
"+b = 100 * b + 0.0000001",
"+print((round((a * b) / 100)))"
] | false | 0.08097 | 0.038083 | 2.126137 | [
"s534974797",
"s293195683"
] |
u261260430 | p02955 | python | s197221708 | s833103055 | 271 | 146 | 3,188 | 3,188 | Accepted | Accepted | 46.13 | import sys
import math
n, k = map(int, input().split())
a = list(map(int, input().split()))
def ok(x):
b = []
for an in a:
b.append(an % x)
b.sort(reverse=True)
print(x, a, b, file=sys.stderr)
t = int(sum(b) / x)
print(t, sum(b[t:]), file=sys.stderr)
if t == 0:
... | import sys
import math
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
def ok(x):
b = [i % x for i in a]
b.sort(reverse=True)
t = int(sum(b) / x)
if t == 0:
return True
return True if sum(b[t:]) <= k else False
s = sum(a)
sqs = int(math.sqrt(s... | 34 | 28 | 630 | 509 | import sys
import math
n, k = map(int, input().split())
a = list(map(int, input().split()))
def ok(x):
b = []
for an in a:
b.append(an % x)
b.sort(reverse=True)
print(x, a, b, file=sys.stderr)
t = int(sum(b) / x)
print(t, sum(b[t:]), file=sys.stderr)
if t == 0:
return True... | import sys
import math
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
def ok(x):
b = [i % x for i in a]
b.sort(reverse=True)
t = int(sum(b) / x)
if t == 0:
return True
return True if sum(b[t:]) <= k else False
s = sum(a)
sqs = int(math.sqrt(s))
ans = 1
for x ... | false | 17.647059 | [
"-n, k = map(int, input().split())",
"+n, k = list(map(int, input().split()))",
"- b = []",
"- for an in a:",
"- b.append(an % x)",
"+ b = [i % x for i in a]",
"- print(x, a, b, file=sys.stderr)",
"- print(t, sum(b[t:]), file=sys.stderr)",
"-s = 0",
"-for an in a:",
"- s... | false | 0.041282 | 0.040748 | 1.013115 | [
"s197221708",
"s833103055"
] |
u241159583 | p03319 | python | s364103173 | s309101166 | 44 | 40 | 13,880 | 13,812 | Accepted | Accepted | 9.09 | N, K = list(map(int, input().split()))
A = [int(x) for x in input().split()]
n = N - K
if n % (K - 1) == 0:
ans = 1 + n // (K - 1)
else:
ans = 2 + n // (K - 1)
print(ans) | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
n = N - K
if n % (K - 1) == 0:
ans = 1 + n // (K - 1)
else:
ans = 2 + n // (K - 1)
print(ans) | 9 | 8 | 177 | 173 | N, K = list(map(int, input().split()))
A = [int(x) for x in input().split()]
n = N - K
if n % (K - 1) == 0:
ans = 1 + n // (K - 1)
else:
ans = 2 + n // (K - 1)
print(ans)
| N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
n = N - K
if n % (K - 1) == 0:
ans = 1 + n // (K - 1)
else:
ans = 2 + n // (K - 1)
print(ans)
| false | 11.111111 | [
"-A = [int(x) for x in input().split()]",
"+A = list(map(int, input().split()))"
] | false | 0.104277 | 0.031969 | 3.261793 | [
"s364103173",
"s309101166"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.