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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u606045429 | p03178 | python | s461021277 | s797183924 | 1,648 | 487 | 3,064 | 44,636 | Accepted | Accepted | 70.45 | def main():
mod = 10 ** 9 + 7
K = list(map(int, eval(input())))
D = int(eval(input()))
s = 0
dp = [0] * D
for k in K:
ndp = [0] * D
for d in range(10):
for i, dpi in enumerate(dp):
ndp[(i + d) % D] += dpi
for d in range(k):
... | mod = 10 ** 9 + 7
K = list(map(int, eval(input())))
D = int(eval(input()))
s = 0
dp = [0] * D
for k in K:
ndp = [0] * D
for d in range(10):
for i, dpi in enumerate(dp):
ndp[(i + d) % D] += dpi
for d in range(k):
ndp[(s + d) % D] += 1
s = (s + k) % D
d... | 23 | 20 | 446 | 363 | def main():
mod = 10**9 + 7
K = list(map(int, eval(input())))
D = int(eval(input()))
s = 0
dp = [0] * D
for k in K:
ndp = [0] * D
for d in range(10):
for i, dpi in enumerate(dp):
ndp[(i + d) % D] += dpi
for d in range(k):
ndp[(s + d... | mod = 10**9 + 7
K = list(map(int, eval(input())))
D = int(eval(input()))
s = 0
dp = [0] * D
for k in K:
ndp = [0] * D
for d in range(10):
for i, dpi in enumerate(dp):
ndp[(i + d) % D] += dpi
for d in range(k):
ndp[(s + d) % D] += 1
s = (s + k) % D
dp = [x % mod for x in n... | false | 13.043478 | [
"-def main():",
"- mod = 10**9 + 7",
"- K = list(map(int, eval(input())))",
"- D = int(eval(input()))",
"- s = 0",
"- dp = [0] * D",
"- for k in K:",
"- ndp = [0] * D",
"- for d in range(10):",
"- for i, dpi in enumerate(dp):",
"- ndp[(i ... | false | 0.03769 | 0.046462 | 0.811202 | [
"s461021277",
"s797183924"
] |
u254871849 | p02725 | python | s474779114 | s733884792 | 126 | 97 | 25,124 | 25,124 | Accepted | Accepted | 23.02 | import sys
n, k, *a = list(map(int, sys.stdin.read().split()))
a.append(n + a[0])
def main():
d = 0
for i in range(k):
d = max(d, a[i+1] - a[i])
res = n - d
print(res)
if __name__ == "__main__":
main() | import sys
k, n, *a = list(map(int, sys.stdin.read().split()))
a += [a[0] + k]
def main():
d = [a[i+1] - a[i] for i in range(n)]
print((k - max(d)))
if __name__ == '__main__':
main() | 14 | 11 | 239 | 200 | import sys
n, k, *a = list(map(int, sys.stdin.read().split()))
a.append(n + a[0])
def main():
d = 0
for i in range(k):
d = max(d, a[i + 1] - a[i])
res = n - d
print(res)
if __name__ == "__main__":
main()
| import sys
k, n, *a = list(map(int, sys.stdin.read().split()))
a += [a[0] + k]
def main():
d = [a[i + 1] - a[i] for i in range(n)]
print((k - max(d)))
if __name__ == "__main__":
main()
| false | 21.428571 | [
"-n, k, *a = list(map(int, sys.stdin.read().split()))",
"-a.append(n + a[0])",
"+k, n, *a = list(map(int, sys.stdin.read().split()))",
"+a += [a[0] + k]",
"- d = 0",
"- for i in range(k):",
"- d = max(d, a[i + 1] - a[i])",
"- res = n - d",
"- print(res)",
"+ d = [a[i + 1] - a... | false | 0.047293 | 0.040615 | 1.164443 | [
"s474779114",
"s733884792"
] |
u063052907 | p03853 | python | s222779755 | s692111974 | 21 | 19 | 3,060 | 3,060 | Accepted | Accepted | 9.52 | # coding: utf-8
H, W = list(map(int, input().split()))
for _ in range(H):
l = eval(input())
print((l + "\n" + l)) | # coding: utf-8
H, W = map(int, input().split())
for _ in range(H):
l = input()
print(l, l, sep="\n")
| 6 | 6 | 113 | 116 | # coding: utf-8
H, W = list(map(int, input().split()))
for _ in range(H):
l = eval(input())
print((l + "\n" + l))
| # coding: utf-8
H, W = map(int, input().split())
for _ in range(H):
l = input()
print(l, l, sep="\n")
| false | 0 | [
"-H, W = list(map(int, input().split()))",
"+H, W = map(int, input().split())",
"- l = eval(input())",
"- print((l + \"\\n\" + l))",
"+ l = input()",
"+ print(l, l, sep=\"\\n\")"
] | false | 0.076175 | 0.043853 | 1.737045 | [
"s222779755",
"s692111974"
] |
u134856634 | p02983 | python | s651744031 | s922753903 | 50 | 45 | 2,940 | 3,060 | Accepted | Accepted | 10 | l, r = list(map(int, input().split()))
def doit(l, r):
# l = l % 2019
# r = r % 2019
# if r <= l:
# r += 2019
res = 2018
for x in range(l, r):
for y in range(x + 1, r + 1):
#print(x, y, file=sys.stderr)
res = min(res, (x * y) % 2019)
if res == 0:
return 0
return re... | l, r = list(map(int, input().split()))
def doit(l, r):
if r - l > 2019:
return 0
l = l % 2019
r = r % 2019
if l == 0:
return 0
if r == 0:
return 0
if r <= l:
r += 2019
res = 2019
for x in range(l, r):
for y in range(x + 1, r + 1):
#print(x, y, file=sys.stderr)
... | 16 | 22 | 344 | 430 | l, r = list(map(int, input().split()))
def doit(l, r):
# l = l % 2019
# r = r % 2019
# if r <= l:
# r += 2019
res = 2018
for x in range(l, r):
for y in range(x + 1, r + 1):
# print(x, y, file=sys.stderr)
res = min(res, (x * y) % 2019)
if res ==... | l, r = list(map(int, input().split()))
def doit(l, r):
if r - l > 2019:
return 0
l = l % 2019
r = r % 2019
if l == 0:
return 0
if r == 0:
return 0
if r <= l:
r += 2019
res = 2019
for x in range(l, r):
for y in range(x + 1, r + 1):
# p... | false | 27.272727 | [
"- # l = l % 2019",
"- # r = r % 2019",
"- # if r <= l:",
"- # r += 2019",
"- res = 2018",
"+ if r - l > 2019:",
"+ return 0",
"+ l = l % 2019",
"+ r = r % 2019",
"+ if l == 0:",
"+ return 0",
"+ if r == 0:",
"+ return 0",
"+ if r... | false | 0.035974 | 0.035894 | 1.002219 | [
"s651744031",
"s922753903"
] |
u777923818 | p03007 | python | s024013460 | s329441153 | 464 | 147 | 99,948 | 21,300 | Accepted | Accepted | 68.32 | from itertools import accumulate
from bisect import bisect, bisect_left
from functools import reduce
from itertools import accumulate, product
from operator import itemgetter, xor, mul
from math import sqrt
from random import randint, random
from heapq import heappop, heappush
from fractions import gcd
from ... | from collections import defaultdict, deque
import sys
#input = sys.stdin.readline
def inpl(): return list(map(int, input().split()))
N = int(eval(input()))
A = sorted(inpl())
if A[-1] < 0:
print((A[-1] - sum(A[:-1])))
for i in range(N-2, -1, -1):
print((A[-1], A[i]))
A[-1] -= A[i]
els... | 47 | 22 | 1,256 | 565 | from itertools import accumulate
from bisect import bisect, bisect_left
from functools import reduce
from itertools import accumulate, product
from operator import itemgetter, xor, mul
from math import sqrt
from random import randint, random
from heapq import heappop, heappush
from fractions import gcd
from collections... | from collections import defaultdict, deque
import sys
# input = sys.stdin.readline
def inpl():
return list(map(int, input().split()))
N = int(eval(input()))
A = sorted(inpl())
if A[-1] < 0:
print((A[-1] - sum(A[:-1])))
for i in range(N - 2, -1, -1):
print((A[-1], A[i]))
A[-1] -= A[i]
else... | false | 53.191489 | [
"-from itertools import accumulate",
"-from bisect import bisect, bisect_left",
"-from functools import reduce",
"-from itertools import accumulate, product",
"-from operator import itemgetter, xor, mul",
"-from math import sqrt",
"-from random import randint, random",
"-from heapq import heappop, hea... | false | 0.056082 | 0.073391 | 0.764157 | [
"s024013460",
"s329441153"
] |
u677121387 | p02813 | python | s623010978 | s467592285 | 44 | 28 | 3,064 | 3,064 | Accepted | Accepted | 36.36 | from itertools import permutations
n = int(eval(input()))
p = [int(i) for i in input().split()]
q = [int(i) for i in input().split()]
a = 0
b = 0
cnt = 0
st = 0
for i in permutations(list(range(1,n+1))):
cnt += 1
if list(i) == p:
a = cnt
st += 1
if list(i) == q:
b = ... | from itertools import permutations
n = int(eval(input()))
p = tuple(int(i) for i in input().split())
q = tuple(int(i) for i in input().split())
a = 0
b = 0
cnt = 0
st = 0
for i in permutations(list(range(1,n+1))):
cnt += 1
if i == p:
a = cnt
st += 1
if i == q:
b = cn... | 21 | 21 | 383 | 381 | from itertools import permutations
n = int(eval(input()))
p = [int(i) for i in input().split()]
q = [int(i) for i in input().split()]
a = 0
b = 0
cnt = 0
st = 0
for i in permutations(list(range(1, n + 1))):
cnt += 1
if list(i) == p:
a = cnt
st += 1
if list(i) == q:
b = cnt
s... | from itertools import permutations
n = int(eval(input()))
p = tuple(int(i) for i in input().split())
q = tuple(int(i) for i in input().split())
a = 0
b = 0
cnt = 0
st = 0
for i in permutations(list(range(1, n + 1))):
cnt += 1
if i == p:
a = cnt
st += 1
if i == q:
b = cnt
st ... | false | 0 | [
"-p = [int(i) for i in input().split()]",
"-q = [int(i) for i in input().split()]",
"+p = tuple(int(i) for i in input().split())",
"+q = tuple(int(i) for i in input().split())",
"- if list(i) == p:",
"+ if i == p:",
"- if list(i) == q:",
"+ if i == q:"
] | false | 0.040456 | 0.040166 | 1.007229 | [
"s623010978",
"s467592285"
] |
u847923740 | p02725 | python | s555988633 | s610891609 | 248 | 144 | 77,500 | 99,756 | Accepted | Accepted | 41.94 | K,N=list(map(int,input().split()))
A=list(map(int,input().split()))
A.sort()
A+=[A[0]+K]
minn=K+1
for i in range(N):
minn=min(minn,K-(A[i+1]-A[i]))
print(minn) | #
import sys
input=sys.stdin.readline
def main():
K,N=list(map(int,input().split()))
A=list(map(int,input().split()))
mind=K-(A[0]-A[-1]+K)
for i in range(1,N):
mind=min(mind,K-(A[i]-A[i-1]))
print(mind)
if __name__=="__main__":
main()
| 8 | 16 | 164 | 289 | K, N = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
A += [A[0] + K]
minn = K + 1
for i in range(N):
minn = min(minn, K - (A[i + 1] - A[i]))
print(minn)
| #
import sys
input = sys.stdin.readline
def main():
K, N = list(map(int, input().split()))
A = list(map(int, input().split()))
mind = K - (A[0] - A[-1] + K)
for i in range(1, N):
mind = min(mind, K - (A[i] - A[i - 1]))
print(mind)
if __name__ == "__main__":
main()
| false | 50 | [
"-K, N = list(map(int, input().split()))",
"-A = list(map(int, input().split()))",
"-A.sort()",
"-A += [A[0] + K]",
"-minn = K + 1",
"-for i in range(N):",
"- minn = min(minn, K - (A[i + 1] - A[i]))",
"-print(minn)",
"+#",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+",
"... | false | 0.007933 | 0.036549 | 0.217051 | [
"s555988633",
"s610891609"
] |
u780342333 | p02398 | python | s741609685 | s627177357 | 30 | 20 | 7,668 | 5,604 | Accepted | Accepted | 33.33 | a, b, c = list(map(int, input().split(" ")))
cnt = 0
for i in range(a, b+1):
if c % i == 0: cnt += 1
print (cnt) | def get_divisors(a, b, c):
#get list of divisors of c
res = [i for i in range(1, c+1) if c % i == 0]
#filter between a and b
res = [i for i in res if a <= i <= b]
# return sum
return len(res)
if __name__ == "__main__":
a, b, c = list(map(int, input().split()))
print(... | 6 | 14 | 116 | 337 | a, b, c = list(map(int, input().split(" ")))
cnt = 0
for i in range(a, b + 1):
if c % i == 0:
cnt += 1
print(cnt)
| def get_divisors(a, b, c):
# get list of divisors of c
res = [i for i in range(1, c + 1) if c % i == 0]
# filter between a and b
res = [i for i in res if a <= i <= b]
# return sum
return len(res)
if __name__ == "__main__":
a, b, c = list(map(int, input().split()))
print((get_divisors(a... | false | 57.142857 | [
"-a, b, c = list(map(int, input().split(\" \")))",
"-cnt = 0",
"-for i in range(a, b + 1):",
"- if c % i == 0:",
"- cnt += 1",
"-print(cnt)",
"+def get_divisors(a, b, c):",
"+ # get list of divisors of c",
"+ res = [i for i in range(1, c + 1) if c % i == 0]",
"+ # filter between... | false | 0.046543 | 0.049765 | 0.935262 | [
"s741609685",
"s627177357"
] |
u091855288 | p04005 | python | s196565794 | s125938028 | 1,134 | 156 | 13,668 | 10,536 | Accepted | Accepted | 86.24 | import numpy as np
a = list(map(int,input().split()))
a = np.array(a)
if len(a[a % 2==0]) > 0:
print(0)
else:
m = max(a)
a = list(a)
a.remove(m)
print(np.prod(np.array(a))) | import numpy as np
import copy
a = list(map(int,input().split()))
def myfunc(a):
a = np.array(a)
if len(a[a % 2==0]) > 0:
print(0)
else:
m = np.max(a)
a = np.delete(a, np.where(a==m)[0][0])
print(np.prod(a))
myfunc(a) | 11 | 15 | 189 | 252 | import numpy as np
a = list(map(int, input().split()))
a = np.array(a)
if len(a[a % 2 == 0]) > 0:
print(0)
else:
m = max(a)
a = list(a)
a.remove(m)
print(np.prod(np.array(a)))
| import numpy as np
import copy
a = list(map(int, input().split()))
def myfunc(a):
a = np.array(a)
if len(a[a % 2 == 0]) > 0:
print(0)
else:
m = np.max(a)
a = np.delete(a, np.where(a == m)[0][0])
print(np.prod(a))
myfunc(a)
| false | 26.666667 | [
"+import copy",
"-a = np.array(a)",
"-if len(a[a % 2 == 0]) > 0:",
"- print(0)",
"-else:",
"- m = max(a)",
"- a = list(a)",
"- a.remove(m)",
"- print(np.prod(np.array(a)))",
"+",
"+",
"+def myfunc(a):",
"+ a = np.array(a)",
"+ if len(a[a % 2 == 0]) > 0:",
"+ p... | false | 0.243143 | 0.181649 | 1.338533 | [
"s196565794",
"s125938028"
] |
u891635666 | p02923 | python | s766619719 | s161013477 | 128 | 74 | 14,252 | 14,168 | Accepted | Accepted | 42.19 | n = int(eval(input()))
nums = list(map(int, input().split()))
left = 0
right = 0
res = 0
while left < n:
prev = nums[left]
right = left
while right < n and prev >= nums[right]:
right += 1
prev = nums[right - 1]
res = max(res, right - left)
left = right
print((res - 1)) | import sys
input = sys.stdin.readline
ri = lambda: int(eval(input()))
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)... | 15 | 27 | 312 | 584 | n = int(eval(input()))
nums = list(map(int, input().split()))
left = 0
right = 0
res = 0
while left < n:
prev = nums[left]
right = left
while right < n and prev >= nums[right]:
right += 1
prev = nums[right - 1]
res = max(res, right - left)
left = right
print((res - 1))
| import sys
input = sys.stdin.readline
ri = lambda: int(eval(input()))
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)]
rsls = la... | false | 44.444444 | [
"-n = int(eval(input()))",
"-nums = list(map(int, input().split()))",
"-left = 0",
"-right = 0",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+ri = lambda: int(eval(input()))",
"+rs = lambda: input().rstrip()",
"+ril = lambda: list(map(int, input().split()))",
"+rsl = lambda: input().rstr... | false | 0.037266 | 0.037373 | 0.997134 | [
"s766619719",
"s161013477"
] |
u905203728 | p03418 | python | s758581876 | s336710956 | 115 | 95 | 3,060 | 2,940 | Accepted | Accepted | 17.39 | n,k=list(map(int,input().split()))
if k==0:
print((n**2));exit()
ans=0
for i in range(k+1,n+1):
p=n//i
q=n%i
ans +=p*max(0,i-k)+max(0,q-k+1)
print(ans) | n,k=list(map(int,input().split()))
if k==0:print((n**2));exit()
ans=0
for i in range(k+1,n+1):
ans +=n//i*max(0,i-k)+max(0,n%i-k+1)
print(ans) | 9 | 6 | 167 | 143 | n, k = list(map(int, input().split()))
if k == 0:
print((n**2))
exit()
ans = 0
for i in range(k + 1, n + 1):
p = n // i
q = n % i
ans += p * max(0, i - k) + max(0, q - k + 1)
print(ans)
| n, k = list(map(int, input().split()))
if k == 0:
print((n**2))
exit()
ans = 0
for i in range(k + 1, n + 1):
ans += n // i * max(0, i - k) + max(0, n % i - k + 1)
print(ans)
| false | 33.333333 | [
"- p = n // i",
"- q = n % i",
"- ans += p * max(0, i - k) + max(0, q - k + 1)",
"+ ans += n // i * max(0, i - k) + max(0, n % i - k + 1)"
] | false | 0.083645 | 0.046796 | 1.787427 | [
"s758581876",
"s336710956"
] |
u131881594 | p03212 | python | s594870542 | s768638100 | 136 | 93 | 10,372 | 10,256 | Accepted | Accepted | 31.62 | from collections import Counter
ls=[]
def rec(n):
if len(str(n))>9: return
ls.append(n)
rec(n*10+3)
rec(n*10+5)
rec(n*10+7)
n=int(eval(input()))
rec(3)
rec(5)
rec(7)
cnt=0
for l in ls:
temp=Counter(str(l))
if l<=n and len(list(temp.keys()))==3:
cnt+=1
print(cnt) | ls=[]
def rec(n):
if len(str(n))>9: return
ls.append(n)
for i in [3,5,7]: rec(10*n+i)
n=int(eval(input()))
rec(0)
cnt=0
for l in ls:
if l<=n and all(str(l).count(i)>0 for i in "357"): cnt+=1
print(cnt) | 18 | 11 | 303 | 221 | from collections import Counter
ls = []
def rec(n):
if len(str(n)) > 9:
return
ls.append(n)
rec(n * 10 + 3)
rec(n * 10 + 5)
rec(n * 10 + 7)
n = int(eval(input()))
rec(3)
rec(5)
rec(7)
cnt = 0
for l in ls:
temp = Counter(str(l))
if l <= n and len(list(temp.keys())) == 3:
... | ls = []
def rec(n):
if len(str(n)) > 9:
return
ls.append(n)
for i in [3, 5, 7]:
rec(10 * n + i)
n = int(eval(input()))
rec(0)
cnt = 0
for l in ls:
if l <= n and all(str(l).count(i) > 0 for i in "357"):
cnt += 1
print(cnt)
| false | 38.888889 | [
"-from collections import Counter",
"-",
"- rec(n * 10 + 3)",
"- rec(n * 10 + 5)",
"- rec(n * 10 + 7)",
"+ for i in [3, 5, 7]:",
"+ rec(10 * n + i)",
"-rec(3)",
"-rec(5)",
"-rec(7)",
"+rec(0)",
"- temp = Counter(str(l))",
"- if l <= n and len(list(temp.keys())) == 3:... | false | 0.152402 | 0.236441 | 0.644566 | [
"s594870542",
"s768638100"
] |
u078042885 | p00718 | python | s319443061 | s527405047 | 90 | 80 | 7,696 | 7,648 | Accepted | Accepted | 11.11 | a={'m':1000,'c':100,'x':10,'i':1}
for _ in range(int(eval(input()))):
b,s,t=eval(input()),0,1
for x in b:
if x==' ':continue
if x in a:s+=a[x]*t;t=1
else:t=int(x)
ans=''
for k in ['m','c','x','i']:
c,s=divmod(s,a[k])
if c:ans+=['',str(c)][c!=1]+k
pr... | a={'m':1000,'c':100,'x':10,'i':1}
for _ in range(int(eval(input()))):
b,s,t=input().replace(' ',''),0,1
for x in b:
if x in a:s+=a[x]*t;t=1
else:t=int(x)
d=''
for k in ['m','c','x','i']:
c,s=divmod(s,a[k])
if c:d+=['',str(c)][c!=1]+k
print(d) | 12 | 11 | 316 | 298 | a = {"m": 1000, "c": 100, "x": 10, "i": 1}
for _ in range(int(eval(input()))):
b, s, t = eval(input()), 0, 1
for x in b:
if x == " ":
continue
if x in a:
s += a[x] * t
t = 1
else:
t = int(x)
ans = ""
for k in ["m", "c", "x", "i"]:
... | a = {"m": 1000, "c": 100, "x": 10, "i": 1}
for _ in range(int(eval(input()))):
b, s, t = input().replace(" ", ""), 0, 1
for x in b:
if x in a:
s += a[x] * t
t = 1
else:
t = int(x)
d = ""
for k in ["m", "c", "x", "i"]:
c, s = divmod(s, a[k])
... | false | 8.333333 | [
"- b, s, t = eval(input()), 0, 1",
"+ b, s, t = input().replace(\" \", \"\"), 0, 1",
"- if x == \" \":",
"- continue",
"- ans = \"\"",
"+ d = \"\"",
"- ans += [\"\", str(c)][c != 1] + k",
"- print(ans)",
"+ d += [\"\", str(c)][c != 1] + k",
"+... | false | 0.102112 | 0.085512 | 1.194115 | [
"s319443061",
"s527405047"
] |
u519939795 | p02819 | python | s889738137 | s334794833 | 251 | 23 | 3,864 | 2,940 | Accepted | Accepted | 90.84 | N = int(eval(input()))
ans = -1
x = N
while(ans == -1):
if all([x % i != 0 for i in range(2, x)]):
ans = x
else:
x += 1
print(ans) | x=int(eval(input()))
f=0
if x == 2:
print((2))
else:
for i in range(x,10**6):
for j in range(2,i//2+2):
if i%j == 0:
break
else:
f=i
break
print(f)
| 10 | 13 | 158 | 172 | N = int(eval(input()))
ans = -1
x = N
while ans == -1:
if all([x % i != 0 for i in range(2, x)]):
ans = x
else:
x += 1
print(ans)
| x = int(eval(input()))
f = 0
if x == 2:
print((2))
else:
for i in range(x, 10**6):
for j in range(2, i // 2 + 2):
if i % j == 0:
break
else:
f = i
break
print(f)
| false | 23.076923 | [
"-N = int(eval(input()))",
"-ans = -1",
"-x = N",
"-while ans == -1:",
"- if all([x % i != 0 for i in range(2, x)]):",
"- ans = x",
"- else:",
"- x += 1",
"-print(ans)",
"+x = int(eval(input()))",
"+f = 0",
"+if x == 2:",
"+ print((2))",
"+else:",
"+ for i in ra... | false | 0.053589 | 0.007269 | 7.372594 | [
"s889738137",
"s334794833"
] |
u367130284 | p03053 | python | s563663197 | s095506497 | 960 | 636 | 163,976 | 130,908 | Accepted | Accepted | 33.75 | def main():
from collections import deque
import sys;input=sys.stdin.readline
h,w=list(map(int,input().split()))
grid=[["#"]*(w+2)]+[list("#"+eval(input())+"#")for x in range(h)]+[["#"]*(w+2)]
stack=deque()
for y in range(1,h+1):
for x in range(1,w+1):
if grid[y][... | def main():
from collections import deque
import sys;input=sys.stdin.readline
h,w=list(map(int,input().split()))
grid=[["#"]*(w+2)]+[list("#"+eval(input())+"#")for x in range(h)]+[["#"]*(w+2)]
stack=deque()
for y in range(1,h+1):
for x in range(1,w+1):
if grid[y][... | 28 | 29 | 789 | 833 | def main():
from collections import deque
import sys
input = sys.stdin.readline
h, w = list(map(int, input().split()))
grid = (
[["#"] * (w + 2)]
+ [list("#" + eval(input()) + "#") for x in range(h)]
+ [["#"] * (w + 2)]
)
stack = deque()
for y in range(1, h + 1):... | def main():
from collections import deque
import sys
input = sys.stdin.readline
h, w = list(map(int, input().split()))
grid = (
[["#"] * (w + 2)]
+ [list("#" + eval(input()) + "#") for x in range(h)]
+ [["#"] * (w + 2)]
)
stack = deque()
for y in range(1, h + 1):... | false | 3.448276 | [
"- grid[y][x] = 0",
"+ # grid[y][x]=0",
"- grid[my + y][mx + x] = i + 1",
"+ # grid[my+y][mx+x]=i+1",
"+ grid[my + y][mx + x] = \"#\""
] | false | 0.036156 | 0.052876 | 0.683785 | [
"s563663197",
"s095506497"
] |
u893063840 | p03993 | python | s841148482 | s369372382 | 156 | 68 | 22,500 | 14,008 | Accepted | Accepted | 56.41 | n = int(eval(input()))
a = list(map(int, input().split()))
st = set()
cnt = 0
for i, e in enumerate(a, 1):
pair = min(i, e), max(i, e)
if pair in st:
cnt += 1
else:
st.add(pair)
print(cnt)
| n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
for i, e in enumerate(a, 1):
if a[e-1] == i:
cnt += 1
cnt //= 2
print(cnt)
| 13 | 10 | 225 | 159 | n = int(eval(input()))
a = list(map(int, input().split()))
st = set()
cnt = 0
for i, e in enumerate(a, 1):
pair = min(i, e), max(i, e)
if pair in st:
cnt += 1
else:
st.add(pair)
print(cnt)
| n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
for i, e in enumerate(a, 1):
if a[e - 1] == i:
cnt += 1
cnt //= 2
print(cnt)
| false | 23.076923 | [
"-st = set()",
"- pair = min(i, e), max(i, e)",
"- if pair in st:",
"+ if a[e - 1] == i:",
"- else:",
"- st.add(pair)",
"+cnt //= 2"
] | false | 0.084907 | 0.03774 | 2.249782 | [
"s841148482",
"s369372382"
] |
u891635666 | p03504 | python | s789249676 | s669486188 | 1,986 | 1,416 | 26,676 | 26,800 | Accepted | Accepted | 28.7 | n, c = list(map(int, input().split()))
MAX_COLS = 10**5
table = [[0 for _ in range(MAX_COLS)] for _ in range(c)]
for _ in range(n):
s, t, i = list(map(int, input().split()))
for j in range(s - 1, t - 1):
table[i - 1][j] = 1
for i in range(c):
for j in range(MAX_COLS - 1):
if tab... | n, c = list(map(int, input().split()))
MAX_COLS = 10**5
table = [[0 for _ in range(MAX_COLS)] for _ in range(c)]
for _ in range(n):
s, t, i = list(map(int, input().split()))
for j in range(max(0, s - 2), t - 1):
table[i - 1][j] = 1
res = 0
for j in range(MAX_COLS):
count = 0
for i ... | 21 | 16 | 528 | 395 | n, c = list(map(int, input().split()))
MAX_COLS = 10**5
table = [[0 for _ in range(MAX_COLS)] for _ in range(c)]
for _ in range(n):
s, t, i = list(map(int, input().split()))
for j in range(s - 1, t - 1):
table[i - 1][j] = 1
for i in range(c):
for j in range(MAX_COLS - 1):
if table[i][j] == 0... | n, c = list(map(int, input().split()))
MAX_COLS = 10**5
table = [[0 for _ in range(MAX_COLS)] for _ in range(c)]
for _ in range(n):
s, t, i = list(map(int, input().split()))
for j in range(max(0, s - 2), t - 1):
table[i - 1][j] = 1
res = 0
for j in range(MAX_COLS):
count = 0
for i in range(c):
... | false | 23.809524 | [
"- for j in range(s - 1, t - 1):",
"+ for j in range(max(0, s - 2), t - 1):",
"-for i in range(c):",
"- for j in range(MAX_COLS - 1):",
"- if table[i][j] == 0 and table[i][j + 1] == 1:",
"- table[i][j] = 1"
] | false | 0.537839 | 0.339608 | 1.583705 | [
"s789249676",
"s669486188"
] |
u617103038 | p02743 | python | s552959260 | s684253932 | 35 | 18 | 5,076 | 2,940 | Accepted | Accepted | 48.57 | from decimal import *
def resolve():
a, b, c = list(map(int, input().split()))
if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
print("Yes")
else:
print("No")
resolve()
| def resolve():
a, b, c = list(map(int, input().split()))
if c-a-b>0 and (c-a-b)**2 > 4*a*b:
print("Yes")
else:
print("No")
resolve() | 9 | 8 | 213 | 162 | from decimal import *
def resolve():
a, b, c = list(map(int, input().split()))
if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
print("Yes")
else:
print("No")
resolve()
| def resolve():
a, b, c = list(map(int, input().split()))
if c - a - b > 0 and (c - a - b) ** 2 > 4 * a * b:
print("Yes")
else:
print("No")
resolve()
| false | 11.111111 | [
"-from decimal import *",
"-",
"-",
"- if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():",
"+ if c - a - b > 0 and (c - a - b) ** 2 > 4 * a * b:"
] | false | 0.161653 | 0.084807 | 1.906129 | [
"s552959260",
"s684253932"
] |
u612721349 | p03633 | python | s568705523 | s052661107 | 407 | 48 | 70,636 | 5,560 | Accepted | Accepted | 88.21 | from fractions import gcd
def lcm(a, b):
if a == 0 or b == 0:
return 0
return int(a * b // gcd(a, b))
def solve():
n = int(eval(input()))
tl = [int(eval(input())) for _ in range(n)]
ans = tl[0]
for elem in tl[1:]:
ans = lcm(ans, elem)
print(ans)
if __name... | import sys
if sys.version_info < (3, 5):
from fractions import gcd
else:
from math import gcd
def lcm(a, b):
if a == 0 or b == 0:
return 0
return int(a * b // gcd(a, b))
def solve():
n = int(eval(input()))
tl = [int(eval(input())) for _ in range(n)]
ans = tl[0]
f... | 17 | 21 | 336 | 414 | from fractions import gcd
def lcm(a, b):
if a == 0 or b == 0:
return 0
return int(a * b // gcd(a, b))
def solve():
n = int(eval(input()))
tl = [int(eval(input())) for _ in range(n)]
ans = tl[0]
for elem in tl[1:]:
ans = lcm(ans, elem)
print(ans)
if __name__ == "__main__... | import sys
if sys.version_info < (3, 5):
from fractions import gcd
else:
from math import gcd
def lcm(a, b):
if a == 0 or b == 0:
return 0
return int(a * b // gcd(a, b))
def solve():
n = int(eval(input()))
tl = [int(eval(input())) for _ in range(n)]
ans = tl[0]
for elem in t... | false | 19.047619 | [
"-from fractions import gcd",
"+import sys",
"+",
"+if sys.version_info < (3, 5):",
"+ from fractions import gcd",
"+else:",
"+ from math import gcd"
] | false | 0.169362 | 0.077204 | 2.193696 | [
"s568705523",
"s052661107"
] |
u708255304 | p02579 | python | s776083640 | s101374005 | 846 | 762 | 89,304 | 115,172 | Accepted | Accepted | 9.93 | from collections import deque
H, W = list(map(int, input().split())) # H行, W列
CY, CX = [int(x)-1 for x in input().split()] # 魔法使いの初期値
DY, DX = [int(x)-1 for x in input().split()] # 目的地
gridgraph = [eval(input()) for _ in range(H)]
# print(gridgraph)
q = deque()
q.append((CY, CX)) # スタート地点
# 各頂点について2*2の幅優先... | from collections import deque
H, W = list(map(int, input().split()))
CY, CX = [int(x)-1 for x in input().split()]
DY, DX = [int(x)-1 for x in input().split()]
gridgraph = [eval(input()) for _ in range(H)]
q = deque()
q.append([CY, CX])
# 更新されるなら追加
adjacent = [[1, 0], [0, 1], [-1, 0], [0, -1]]
INF = float("in... | 43 | 34 | 1,474 | 1,230 | from collections import deque
H, W = list(map(int, input().split())) # H行, W列
CY, CX = [int(x) - 1 for x in input().split()] # 魔法使いの初期値
DY, DX = [int(x) - 1 for x in input().split()] # 目的地
gridgraph = [eval(input()) for _ in range(H)]
# print(gridgraph)
q = deque()
q.append((CY, CX)) # スタート地点
# 各頂点について2*2の幅優先する?
a... | from collections import deque
H, W = list(map(int, input().split()))
CY, CX = [int(x) - 1 for x in input().split()]
DY, DX = [int(x) - 1 for x in input().split()]
gridgraph = [eval(input()) for _ in range(H)]
q = deque()
q.append([CY, CX])
# 更新されるなら追加
adjacent = [[1, 0], [0, 1], [-1, 0], [0, -1]]
INF = float("inf")
di... | false | 20.930233 | [
"-H, W = list(map(int, input().split())) # H行, W列",
"-CY, CX = [int(x) - 1 for x in input().split()] # 魔法使いの初期値",
"-DY, DX = [int(x) - 1 for x in input().split()] # 目的地",
"+H, W = list(map(int, input().split()))",
"+CY, CX = [int(x) - 1 for x in input().split()]",
"+DY, DX = [int(x) - 1 for x in input(... | false | 0.049893 | 0.046452 | 1.074061 | [
"s776083640",
"s101374005"
] |
u645250356 | p03470 | python | s820103667 | s329420997 | 192 | 147 | 38,256 | 77,252 | Accepted | Accepted | 23.44 | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.st... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
n = ... | 12 | 12 | 401 | 376 | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.readline().split()))
def inpln(n):
r... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.readline().s... | false | 0 | [
"-import sys, bisect, math, itertools",
"+import sys, bisect, math, itertools, fractions",
"+INF = float(\"inf\")",
"-def inpln(n):",
"- return list(int(sys.stdin.readline()) for i in range(n))",
"-",
"-",
"-a = inpln(n)",
"+a = [inp() for _ in range(n)]"
] | false | 0.007442 | 0.033828 | 0.219986 | [
"s820103667",
"s329420997"
] |
u026155812 | p02793 | python | s237164493 | s437787474 | 1,564 | 843 | 74,288 | 10,704 | Accepted | Accepted | 46.1 | from math import gcd
from functools import reduce
N = int(eval(input()))
A = [int(i) for i in input().split()]
mod = 10**9 + 7
def lcm_base(x, y):
return (x * y) // gcd(x, y)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
num = lcm_list(A)
ans = 0
for a in A:
ans += (num * po... | from math import gcd
from functools import reduce
N = int(eval(input()))
A = [int(i) for i in input().split()]
mod = 10**9 + 7
def lcm_base(x, y):
return (x * y) // gcd(x, y)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
num = lcm_list(A)%mod
ans = 0
for a in A:
ans += (num ... | 20 | 20 | 362 | 366 | from math import gcd
from functools import reduce
N = int(eval(input()))
A = [int(i) for i in input().split()]
mod = 10**9 + 7
def lcm_base(x, y):
return (x * y) // gcd(x, y)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
num = lcm_list(A)
ans = 0
for a in A:
ans += (num * pow(a, mod - 2,... | from math import gcd
from functools import reduce
N = int(eval(input()))
A = [int(i) for i in input().split()]
mod = 10**9 + 7
def lcm_base(x, y):
return (x * y) // gcd(x, y)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
num = lcm_list(A) % mod
ans = 0
for a in A:
ans += (num * pow(a, mo... | false | 0 | [
"-num = lcm_list(A)",
"+num = lcm_list(A) % mod"
] | false | 0.03786 | 0.03963 | 0.955345 | [
"s237164493",
"s437787474"
] |
u863442865 | p02912 | python | s432754258 | s749728687 | 399 | 150 | 68,460 | 14,636 | Accepted | Accepted | 62.41 | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby
#from itertools import product
from bisect import bisec... | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
fr... | 32 | 30 | 810 | 781 | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
# from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby
# from itertools import product
from bisect import bisect_l... | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
# from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left, bisect_right
from h... | false | 6.25 | [
"- from itertools import combinations, permutations, accumulate, groupby",
"-",
"- # from itertools import product",
"+ from itertools import combinations, permutations, accumulate, groupby, product",
"- a[i] = -a[i]",
"+ a[i] *= -1",
"- for _ in range(m):",
"+ while m:",
... | false | 0.045411 | 0.140288 | 0.323697 | [
"s432754258",
"s749728687"
] |
u156815136 | p02603 | python | s984811033 | s879400801 | 182 | 38 | 76,912 | 10,404 | Accepted | Accepted | 79.12 | #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counte... | #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdi... | 41 | 51 | 966 | 1,174 | # from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations, permutations, accumulate # (string,3) 3回
# from collections import deque
from collections import deque, defaultdict, Co... | # from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations, permutations, accumulate, product # (string,3) 3回
# from collections import deque
from collections import deque, defaul... | false | 19.607843 | [
"-from itertools import combinations, permutations, accumulate # (string,3) 3回",
"+from itertools import combinations, permutations, accumulate, product # (string,3) 3回",
"+import math",
"+import bisect",
"-# import bisect",
"-#",
"-# d = m - k[i] - k[j]",
"-# if kk[bisect.bisect_right(kk,d) -... | false | 0.042129 | 0.04192 | 1.004993 | [
"s984811033",
"s879400801"
] |
u077291787 | p03721 | python | s896786011 | s209946964 | 312 | 196 | 28,640 | 30,172 | Accepted | Accepted | 37.18 | # ABC061C - Big Array
import sys
input = sys.stdin.readline
def main():
n, k = list(map(int, input().rstrip().split()))
arr = sorted([list(map(int, input().rstrip().split())) for _ in range(n)])
cur, cnt, ans = 0, 0, 0
for i, j in arr:
ans = i
cnt += j
if cnt >= k:
... | # ABC061C - Big Array
import sys
input = sys.stdin.readline
def main():
n, k = list(map(int, input().rstrip().split()))
arr = [list(map(int, input().rstrip().split())) for _ in range(n)]
memo = [0] * (10 ** 5 + 1)
for i, j in arr:
memo[i] += j
cnt = 0
for i, j in enumerate(me... | 18 | 20 | 396 | 449 | # ABC061C - Big Array
import sys
input = sys.stdin.readline
def main():
n, k = list(map(int, input().rstrip().split()))
arr = sorted([list(map(int, input().rstrip().split())) for _ in range(n)])
cur, cnt, ans = 0, 0, 0
for i, j in arr:
ans = i
cnt += j
if cnt >= k:
... | # ABC061C - Big Array
import sys
input = sys.stdin.readline
def main():
n, k = list(map(int, input().rstrip().split()))
arr = [list(map(int, input().rstrip().split())) for _ in range(n)]
memo = [0] * (10**5 + 1)
for i, j in arr:
memo[i] += j
cnt = 0
for i, j in enumerate(memo):
... | false | 10 | [
"- arr = sorted([list(map(int, input().rstrip().split())) for _ in range(n)])",
"- cur, cnt, ans = 0, 0, 0",
"+ arr = [list(map(int, input().rstrip().split())) for _ in range(n)]",
"+ memo = [0] * (10**5 + 1)",
"- ans = i",
"+ memo[i] += j",
"+ cnt = 0",
"+ for i, j in ... | false | 0.035775 | 0.055935 | 0.639587 | [
"s896786011",
"s209946964"
] |
u191874006 | p02702 | python | s795824999 | s610406932 | 223 | 154 | 98,732 | 100,404 | Accepted | Accepted | 30.94 | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | #!/usr/bin/env python3
#D
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
... | 34 | 33 | 852 | 837 | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | #!/usr/bin/env python3
# D
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from colle... | false | 2.941176 | [
"+# D",
"- t.append(int(s[i]) * pow(10, n - i - 1, 2019))",
"+ t.append(int(s[i]) * pow(10, (n - i - 1), 2019) % 2019)",
"-u = [i % 2019 for i in t]",
"-u = list(Counter(u).items())",
"+t = [0] + [i % 2019 for i in t]",
"-for i, j in u:",
"- if i == 0:",
"- ans += j",
"- if j >=... | false | 0.048216 | 0.047237 | 1.020734 | [
"s795824999",
"s610406932"
] |
u631277801 | p03839 | python | s287104409 | s383406082 | 225 | 204 | 25,884 | 17,096 | Accepted | Accepted | 9.33 | import sys
stdin = sys.stdin
def li(): return [int(x) for x in stdin.readline().split()]
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return [float(x) for x in stdin.readline().split()]
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): re... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline(... | 38 | 40 | 920 | 1,025 | import sys
stdin = sys.stdin
def li():
return [int(x) for x in stdin.readline().split()]
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return [float(x) for x in stdin.readline().split()]
def ls():
return stdin.readline().split()
def ns():
return stdin.readline... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li():
return map(int, stdin.readline().split())
def li_():
return map(lambda x: int(x) - 1, stdin.readline().split())
def lf():
return map(float, stdin.readline().split())
def ls():
return stdin.readline().split()
def ns():
ret... | false | 5 | [
"+sys.setrecursionlimit(10**5)",
"- return [int(x) for x in stdin.readline().split()]",
"+ return map(int, stdin.readline().split())",
"- return [int(x) - 1 for x in stdin.readline().split()]",
"+ return map(lambda x: int(x) - 1, stdin.readline().split())",
"- return [float(x) for x in stdi... | false | 0.049778 | 0.049536 | 1.004877 | [
"s287104409",
"s383406082"
] |
u638795007 | p03295 | python | s579023174 | s734692898 | 371 | 235 | 18,196 | 17,812 | Accepted | Accepted | 36.66 | sortsecond = lambda val: val[1]
N, M = list(map(int, input().split()))
l=[]
for i in range(M):
t=input().split()
l.append((int(t[0]),int(t[1])))
l.sort(key=sortsecond)
ans = int(0)
count = int(0)
br = int(0)
for i in range(M):
if br<l[i][0]+1:
count +=1
br = l[i][1]
ans =... | def examD():
N, M = LI()
right = defaultdict(int)
for _ in range(M):
a, b = LI()
right[b] = max(right[b],a)
ans = 0; cur = 0
for i in range(1,N+1):
if right[i]>cur:
ans +=1
cur = i-1
print(ans)
import sys,copy,bisect,itertools,heapq,m... | 19 | 25 | 332 | 729 | sortsecond = lambda val: val[1]
N, M = list(map(int, input().split()))
l = []
for i in range(M):
t = input().split()
l.append((int(t[0]), int(t[1])))
l.sort(key=sortsecond)
ans = int(0)
count = int(0)
br = int(0)
for i in range(M):
if br < l[i][0] + 1:
count += 1
br = l[i][1]
ans = count
pri... | def examD():
N, M = LI()
right = defaultdict(int)
for _ in range(M):
a, b = LI()
right[b] = max(right[b], a)
ans = 0
cur = 0
for i in range(1, N + 1):
if right[i] > cur:
ans += 1
cur = i - 1
print(ans)
import sys, copy, bisect, itertools, hea... | false | 24 | [
"-sortsecond = lambda val: val[1]",
"-N, M = list(map(int, input().split()))",
"-l = []",
"-for i in range(M):",
"- t = input().split()",
"- l.append((int(t[0]), int(t[1])))",
"-l.sort(key=sortsecond)",
"-ans = int(0)",
"-count = int(0)",
"-br = int(0)",
"-for i in range(M):",
"- if b... | false | 0.036747 | 0.053721 | 0.684036 | [
"s579023174",
"s734692898"
] |
u318029285 | p03673 | python | s125998874 | s147989155 | 200 | 177 | 29,460 | 29,764 | Accepted | Accepted | 11.5 | n = int(eval(input()))
a = [int(i) for i in input().split()]
length = len(a)
b = [0] * length
center = length // 2
if len(a) % 2 != 0:
before = center
for i in range(len(a)):
if i == 0:
b[center] = a[i]
else:
if i % 2 != 0:
before = before ... | n = int(eval(input()))
a = [int(i) for i in input().split()]
b = [0] * n
center = n // 2
before = center
if n % 2 != 0:
for i in range(len(a)):
if i % 2 != 0:
before = before + i
else:
before = before - i
b[before] = a[i]
else:
for i in range(len(... | 34 | 24 | 733 | 495 | n = int(eval(input()))
a = [int(i) for i in input().split()]
length = len(a)
b = [0] * length
center = length // 2
if len(a) % 2 != 0:
before = center
for i in range(len(a)):
if i == 0:
b[center] = a[i]
else:
if i % 2 != 0:
before = before + i
... | n = int(eval(input()))
a = [int(i) for i in input().split()]
b = [0] * n
center = n // 2
before = center
if n % 2 != 0:
for i in range(len(a)):
if i % 2 != 0:
before = before + i
else:
before = before - i
b[before] = a[i]
else:
for i in range(len(a)):
if i... | false | 29.411765 | [
"-length = len(a)",
"-b = [0] * length",
"-center = length // 2",
"-if len(a) % 2 != 0:",
"- before = center",
"+b = [0] * n",
"+center = n // 2",
"+before = center",
"+if n % 2 != 0:",
"- if i == 0:",
"- b[center] = a[i]",
"+ if i % 2 != 0:",
"+ before... | false | 0.110987 | 0.101656 | 1.091798 | [
"s125998874",
"s147989155"
] |
u186838327 | p03828 | python | s851443948 | s307687814 | 260 | 206 | 41,584 | 41,964 | Accepted | Accepted | 20.77 | import math
n = int(eval(input()))
def div(m):
d = {}
temp = int(math.sqrt(m))+1
for i in range(2, temp):
while m%i== 0:
m //= i
if i in d:
d[i] += 1
else:
d[i] = 1
if d == {}:
d[m] = 1
else:
if m in d:
d[m] += 1
elif m != 1:
d[... | import math
def factorize(n):
d = {}
temp = int(math.sqrt(n))+1
for i in range(2, temp):
while n%i== 0:
n //= i
if i in d:
d[i] += 1
else:
d[i] = 1
if d == {}:
d[n] = 1
else:
if n in d:
... | 34 | 41 | 532 | 714 | import math
n = int(eval(input()))
def div(m):
d = {}
temp = int(math.sqrt(m)) + 1
for i in range(2, temp):
while m % i == 0:
m //= i
if i in d:
d[i] += 1
else:
d[i] = 1
if d == {}:
d[m] = 1
else:
if m in ... | import math
def factorize(n):
d = {}
temp = int(math.sqrt(n)) + 1
for i in range(2, temp):
while n % i == 0:
n //= i
if i in d:
d[i] += 1
else:
d[i] = 1
if d == {}:
d[n] = 1
else:
if n in d:
d[n... | false | 17.073171 | [
"-n = int(eval(input()))",
"-",
"-def div(m):",
"+def factorize(n):",
"- temp = int(math.sqrt(m)) + 1",
"+ temp = int(math.sqrt(n)) + 1",
"- while m % i == 0:",
"- m //= i",
"+ while n % i == 0:",
"+ n //= i",
"- d[m] = 1",
"+ d[n] = 1",
... | false | 0.05614 | 0.126252 | 0.444662 | [
"s851443948",
"s307687814"
] |
u439063038 | p03162 | python | s415746612 | s893472180 | 463 | 240 | 50,284 | 100,184 | Accepted | Accepted | 48.16 | N = int(eval(input()))
abc = [list(map(int, input().split())) for _ in range(N)]
dp = [[0, 0, 0]] * (N+1)
for i in range(1, N+1):
tmp1 = max([dp[i-1][1]+abc[i-1][0], dp[i-1][2]+abc[i-1][0]])
tmp2 = max([dp[i-1][0]+abc[i-1][1], dp[i-1][2]+abc[i-1][1]])
tmp3 = max([dp[i-1][0]+abc[i-1][2], dp[i-1][1]... | N = int(eval(input()))
abc = [list(map(int, input().split())) for _ in range(N)]
dp = [[0, 0, 0]] * N
dp[0] = abc[0]
for i in range(1, N):
tmp1 = max(dp[i-1][1]+abc[i][0], dp[i-1][2]+abc[i][0])
tmp2 = max(dp[i-1][0]+abc[i][1], dp[i-1][2]+abc[i][1])
tmp3 = max(dp[i-1][0]+abc[i][2], dp[i-1][1]+abc[... | 12 | 13 | 385 | 376 | N = int(eval(input()))
abc = [list(map(int, input().split())) for _ in range(N)]
dp = [[0, 0, 0]] * (N + 1)
for i in range(1, N + 1):
tmp1 = max([dp[i - 1][1] + abc[i - 1][0], dp[i - 1][2] + abc[i - 1][0]])
tmp2 = max([dp[i - 1][0] + abc[i - 1][1], dp[i - 1][2] + abc[i - 1][1]])
tmp3 = max([dp[i - 1][0] + a... | N = int(eval(input()))
abc = [list(map(int, input().split())) for _ in range(N)]
dp = [[0, 0, 0]] * N
dp[0] = abc[0]
for i in range(1, N):
tmp1 = max(dp[i - 1][1] + abc[i][0], dp[i - 1][2] + abc[i][0])
tmp2 = max(dp[i - 1][0] + abc[i][1], dp[i - 1][2] + abc[i][1])
tmp3 = max(dp[i - 1][0] + abc[i][2], dp[i -... | false | 7.692308 | [
"-dp = [[0, 0, 0]] * (N + 1)",
"-for i in range(1, N + 1):",
"- tmp1 = max([dp[i - 1][1] + abc[i - 1][0], dp[i - 1][2] + abc[i - 1][0]])",
"- tmp2 = max([dp[i - 1][0] + abc[i - 1][1], dp[i - 1][2] + abc[i - 1][1]])",
"- tmp3 = max([dp[i - 1][0] + abc[i - 1][2], dp[i - 1][1] + abc[i - 1][2]])",
"+... | false | 0.079713 | 0.042152 | 1.89106 | [
"s415746612",
"s893472180"
] |
u291628833 | p02657 | python | s457502693 | s648621756 | 26 | 24 | 9,920 | 9,948 | Accepted | Accepted | 7.69 | from decimal import *
a,b = list(map(Decimal,input().split()))
print((a*b)) | from decimal import *
a,b = list(map(Decimal,input().split()))
print((int(a*b))) | 3 | 3 | 69 | 74 | from decimal import *
a, b = list(map(Decimal, input().split()))
print((a * b))
| from decimal import *
a, b = list(map(Decimal, input().split()))
print((int(a * b)))
| false | 0 | [
"-print((a * b))",
"+print((int(a * b)))"
] | false | 0.041234 | 0.103132 | 0.399822 | [
"s457502693",
"s648621756"
] |
u601393594 | p03795 | python | s909860627 | s593011138 | 27 | 24 | 9,084 | 9,048 | Accepted | Accepted | 11.11 | # AtCoder abc055 a
# 入力
n = int(eval(input()))
# 処理
total_pay = n * 800
total_back = (n // 15) * 200
balance = total_pay - total_back
# 出力
print(balance)
| # AtCoder abc055 a
# 入力
n = int(eval(input()))
# 処理
# total_pay = n * 800
# total_back = (n // 15) * 200
# balance = total_pay - total_back
# 出力
print(((n * 800) - ((n // 15) * 200)))
| 12 | 12 | 170 | 198 | # AtCoder abc055 a
# 入力
n = int(eval(input()))
# 処理
total_pay = n * 800
total_back = (n // 15) * 200
balance = total_pay - total_back
# 出力
print(balance)
| # AtCoder abc055 a
# 入力
n = int(eval(input()))
# 処理
# total_pay = n * 800
# total_back = (n // 15) * 200
# balance = total_pay - total_back
# 出力
print(((n * 800) - ((n // 15) * 200)))
| false | 0 | [
"-total_pay = n * 800",
"-total_back = (n // 15) * 200",
"-balance = total_pay - total_back",
"+# total_pay = n * 800",
"+# total_back = (n // 15) * 200",
"+# balance = total_pay - total_back",
"-print(balance)",
"+print(((n * 800) - ((n // 15) * 200)))"
] | false | 0.12416 | 0.00592 | 20.972639 | [
"s909860627",
"s593011138"
] |
u594803920 | p02660 | python | s391765547 | s479491489 | 853 | 480 | 113,576 | 91,892 | Accepted | Accepted | 43.73 | from numba import jit
N = int(eval(input()))
"""nを素因数分解"""
"""2以上の整数n => [(素因数, 指数), ...]の2次元リスト"""
@jit
def factorization(n):
arr = []
temp = n
for i in range(2, int(n**0.5)+1):
if temp%i == 0:
cnt = 0
while temp%i == 0:
cnt += 1
... | from numba import jit
N = int(eval(input()))
"""nを素因数分解"""
"""2以上の整数n => [(素因数, 指数), ...]の2次元リスト"""
def factorization(n):
arr = []
temp = n
for i in range(2, int(n**0.5)+1):
if temp%i == 0:
cnt = 0
while temp%i == 0:
cnt += 1
te... | 39 | 39 | 735 | 731 | from numba import jit
N = int(eval(input()))
"""nを素因数分解"""
"""2以上の整数n => [(素因数, 指数), ...]の2次元リスト"""
@jit
def factorization(n):
arr = []
temp = n
for i in range(2, int(n**0.5) + 1):
if temp % i == 0:
cnt = 0
while temp % i == 0:
cnt += 1
temp... | from numba import jit
N = int(eval(input()))
"""nを素因数分解"""
"""2以上の整数n => [(素因数, 指数), ...]の2次元リスト"""
def factorization(n):
arr = []
temp = n
for i in range(2, int(n**0.5) + 1):
if temp % i == 0:
cnt = 0
while temp % i == 0:
cnt += 1
temp //= ... | false | 0 | [
"-@jit"
] | false | 0.041195 | 0.062035 | 0.664053 | [
"s391765547",
"s479491489"
] |
u998169143 | p02811 | python | s512244533 | s742467032 | 310 | 17 | 21,672 | 2,940 | Accepted | Accepted | 94.52 | import numpy as np
K, X = [int(i) for i in input().split()]
if 500 * K >= X:
print('Yes')
else:
print('No')
| K, X = [int(i) for i in input().split()]
if 500 * K >= X:
print('Yes')
else:
print('No') | 8 | 6 | 125 | 102 | import numpy as np
K, X = [int(i) for i in input().split()]
if 500 * K >= X:
print("Yes")
else:
print("No")
| K, X = [int(i) for i in input().split()]
if 500 * K >= X:
print("Yes")
else:
print("No")
| false | 25 | [
"-import numpy as np",
"-"
] | false | 0.091028 | 0.036054 | 2.524768 | [
"s512244533",
"s742467032"
] |
u380524497 | p03033 | python | s339205298 | s759124425 | 1,661 | 1,172 | 84,056 | 87,212 | Accepted | Accepted | 29.44 | import sys
input = sys.stdin.readline
n, q = list(map(int, input().split()))
events = []
for _ in range(n):
start, end, pos = list(map(int, input().split()))
events.append([start - pos, 1, pos])
events.append([end - pos, 0, pos])
events.sort()
departures = [int(eval(input())) for _ in range... | import bisect
import sys
input = sys.stdin.readline
n, q = list(map(int, input().split()))
events = [list(map(int, input().split())) for _ in range(n)]
events.sort(key=lambda x: x[2])
departures = [int(eval(input())) for _ in range(q)]
ans = ['-1'] * q
skip = [-1] * q
for start, end, pos in events:... | 44 | 29 | 1,080 | 634 | import sys
input = sys.stdin.readline
n, q = list(map(int, input().split()))
events = []
for _ in range(n):
start, end, pos = list(map(int, input().split()))
events.append([start - pos, 1, pos])
events.append([end - pos, 0, pos])
events.sort()
departures = [int(eval(input())) for _ in range(q)]
idx = 0
min... | import bisect
import sys
input = sys.stdin.readline
n, q = list(map(int, input().split()))
events = [list(map(int, input().split())) for _ in range(n)]
events.sort(key=lambda x: x[2])
departures = [int(eval(input())) for _ in range(q)]
ans = ["-1"] * q
skip = [-1] * q
for start, end, pos in events:
left = bisect.b... | false | 34.090909 | [
"+import bisect",
"-events = []",
"-for _ in range(n):",
"- start, end, pos = list(map(int, input().split()))",
"- events.append([start - pos, 1, pos])",
"- events.append([end - pos, 0, pos])",
"-events.sort()",
"+events = [list(map(int, input().split())) for _ in range(n)]",
"+events.sort(... | false | 0.037976 | 0.038351 | 0.990216 | [
"s339205298",
"s759124425"
] |
u583507988 | p04030 | python | s104032999 | s025029613 | 32 | 29 | 9,040 | 8,996 | Accepted | Accepted | 9.38 | s = str(input())
ans = []
for i in s:
if i == '0':
ans.append('0')
elif i == '1':
ans.append('1')
elif i == 'B':
if ans == []:
continue
else:
ans.pop()
print(*ans, sep='')
| s=input()
data=[]
for i in range(len(s)):
if s[i]=='0':
data.append('0')
elif s[i]=='1':
data.append('1')
else:
if len(data)==0:
continue
else:
data.pop()
print(*data,sep='')
| 14 | 13 | 219 | 220 | s = str(input())
ans = []
for i in s:
if i == "0":
ans.append("0")
elif i == "1":
ans.append("1")
elif i == "B":
if ans == []:
continue
else:
ans.pop()
print(*ans, sep="")
| s = input()
data = []
for i in range(len(s)):
if s[i] == "0":
data.append("0")
elif s[i] == "1":
data.append("1")
else:
if len(data) == 0:
continue
else:
data.pop()
print(*data, sep="")
| false | 7.142857 | [
"-s = str(input())",
"-ans = []",
"-for i in s:",
"- if i == \"0\":",
"- ans.append(\"0\")",
"- elif i == \"1\":",
"- ans.append(\"1\")",
"- elif i == \"B\":",
"- if ans == []:",
"+s = input()",
"+data = []",
"+for i in range(len(s)):",
"+ if s[i] == \"0\":",... | false | 0.047052 | 0.04755 | 0.989516 | [
"s104032999",
"s025029613"
] |
u562935282 | p02703 | python | s421484302 | s996371258 | 1,714 | 548 | 32,492 | 23,960 | Accepted | Accepted | 68.03 | def main():
import dataclasses
from heapq import heappush, heappop
@dataclasses.dataclass(frozen=True)
class Path:
to: int
fare: int
travel_time: int
@dataclasses.dataclass(frozen=True)
class ExchangeRate:
Ag: int
exchange_time: int
@... | def main():
from heapq import heappush, heappop
INF = 1 << 60
MX_AG = 2500
N, M, S = list(map(int, input().split()))
S = min(S, MX_AG) # それ以上のAgは不要
g = tuple(set() for _ in range(N))
for _ in range(M):
u, v, a, b = list(map(int, input().split()))
u -= 1
... | 77 | 53 | 2,180 | 1,337 | def main():
import dataclasses
from heapq import heappush, heappop
@dataclasses.dataclass(frozen=True)
class Path:
to: int
fare: int
travel_time: int
@dataclasses.dataclass(frozen=True)
class ExchangeRate:
Ag: int
exchange_time: int
@dataclasses.dat... | def main():
from heapq import heappush, heappop
INF = 1 << 60
MX_AG = 2500
N, M, S = list(map(int, input().split()))
S = min(S, MX_AG) # それ以上のAgは不要
g = tuple(set() for _ in range(N))
for _ in range(M):
u, v, a, b = list(map(int, input().split()))
u -= 1
v -= 1
... | false | 31.168831 | [
"- import dataclasses",
"-",
"- @dataclasses.dataclass(frozen=True)",
"- class Path:",
"- to: int",
"- fare: int",
"- travel_time: int",
"-",
"- @dataclasses.dataclass(frozen=True)",
"- class ExchangeRate:",
"- Ag: int",
"- exchange_time: int",... | false | 0.488789 | 0.244005 | 2.00319 | [
"s421484302",
"s996371258"
] |
u655110382 | p02683 | python | s327620633 | s352393327 | 207 | 149 | 27,180 | 27,200 | Accepted | Accepted | 28.02 | import numpy as np
from itertools import product
inf = int(1e20)
n, m, x = list(map(int, input().split()))
_ = [[int(x) for x in input().split()] for _ in range(n)]
CA = np.array(_, dtype=int)
ans = inf
for indices in product([0, 1], repeat=n):
tmp = np.zeros(m + 1, dtype=int)
for idx, be_used in enu... | import numpy as np
from itertools import product
inf = int(1e20)
n, m, x = list(map(int, input().split()))
_ = [[int(x) for x in input().split()] for _ in range(n)]
CA = np.array(_, dtype=int)
ans = inf
for indices in product([False, True], repeat=n):
sums = np.sum(CA[np.array(indices)], axis=0)
if m... | 15 | 13 | 460 | 402 | import numpy as np
from itertools import product
inf = int(1e20)
n, m, x = list(map(int, input().split()))
_ = [[int(x) for x in input().split()] for _ in range(n)]
CA = np.array(_, dtype=int)
ans = inf
for indices in product([0, 1], repeat=n):
tmp = np.zeros(m + 1, dtype=int)
for idx, be_used in enumerate(ind... | import numpy as np
from itertools import product
inf = int(1e20)
n, m, x = list(map(int, input().split()))
_ = [[int(x) for x in input().split()] for _ in range(n)]
CA = np.array(_, dtype=int)
ans = inf
for indices in product([False, True], repeat=n):
sums = np.sum(CA[np.array(indices)], axis=0)
if min(sums[1:... | false | 13.333333 | [
"-for indices in product([0, 1], repeat=n):",
"- tmp = np.zeros(m + 1, dtype=int)",
"- for idx, be_used in enumerate(indices):",
"- tmp += be_used * CA[idx]",
"- if min(tmp[1:]) >= x:",
"- ans = min(ans, tmp[0])",
"+for indices in product([False, True], repeat=n):",
"+ sums =... | false | 0.354438 | 0.512164 | 0.69204 | [
"s327620633",
"s352393327"
] |
u404290207 | p03086 | python | s550291092 | s322984179 | 296 | 265 | 64,748 | 63,852 | Accepted | Accepted | 10.47 | import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,... | import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,... | 43 | 44 | 1,408 | 1,320 | import sys
sys.setrecursionlimit(10**6)
from math import floor, ceil, sqrt, factorial, log
from heapq import heappop, heappush, heappushpop
from collections import Counter, defaultdict, deque
from itertools import (
accumulate,
permutations,
combinations,
product,
combinations_with_replacement,
)
f... | import sys
sys.setrecursionlimit(10**6)
from math import floor, ceil, sqrt, factorial, log
from heapq import heappop, heappush, heappushpop
from collections import Counter, defaultdict, deque
from itertools import (
accumulate,
permutations,
combinations,
product,
combinations_with_replacement,
)
f... | false | 2.272727 | [
"-arr = [\"A\", \"C\", \"G\", \"T\"]",
"+temp = 0",
"- for j in range(i + 1, len(s) + 1):",
"- cnt = 0",
"- for k in s[i:j]:",
"- if k in arr:",
"- cnt += 1",
"- if cnt == len(s[i:j]):",
"- ans = max(ans, cnt)",
"+ if s[i] in [\"A\", ... | false | 0.050746 | 0.047487 | 1.068616 | [
"s550291092",
"s322984179"
] |
u741397536 | p03240 | python | s285899470 | s439677312 | 123 | 38 | 3,064 | 3,064 | Accepted | Accepted | 69.11 | n = int(eval(input()))
arr = []
for i in range(n):
x, y, h = list(map(int, input().split()))
arr.append([x, y, h])
for i in range(101):
for j in range(101):
for k in range(n):
if arr[k][2] > 0:
len1 = abs(arr[k][0] - i) + abs(arr[k][1] - j)
... | N = int(eval(input()))
L = []
for i in range(N):
x, y, h = list(map(int, input().split()))
L.append([x, y, h])
if h != 0:
idx = i
for i in range(101):
for j in range(101):
H = L[idx][2] + abs(L[idx][0]-i) + abs(L[idx][1]-j)
for k in range(N):
if L[k][... | 26 | 24 | 715 | 553 | n = int(eval(input()))
arr = []
for i in range(n):
x, y, h = list(map(int, input().split()))
arr.append([x, y, h])
for i in range(101):
for j in range(101):
for k in range(n):
if arr[k][2] > 0:
len1 = abs(arr[k][0] - i) + abs(arr[k][1] - j)
ch = len1 + arr... | N = int(eval(input()))
L = []
for i in range(N):
x, y, h = list(map(int, input().split()))
L.append([x, y, h])
if h != 0:
idx = i
for i in range(101):
for j in range(101):
H = L[idx][2] + abs(L[idx][0] - i) + abs(L[idx][1] - j)
for k in range(N):
if L[k][2] == max(H -... | false | 7.692308 | [
"-n = int(eval(input()))",
"-arr = []",
"-for i in range(n):",
"+N = int(eval(input()))",
"+L = []",
"+for i in range(N):",
"- arr.append([x, y, h])",
"+ L.append([x, y, h])",
"+ if h != 0:",
"+ idx = i",
"- for k in range(n):",
"- if arr[k][2] > 0:",
"- ... | false | 0.269039 | 0.055366 | 4.859295 | [
"s285899470",
"s439677312"
] |
u706414019 | p03986 | python | s185227725 | s089828057 | 72 | 62 | 9,092 | 9,196 | Accepted | Accepted | 13.89 | s = eval(input())
s_cnt =0
t_cnt =0
cnt = 0
for i in range(len(s)):
if s[i] == 'S':
s_cnt += 1
if s[i] == 'T':
t_cnt += 1
if s_cnt >0:
t_cnt -= 1
s_cnt -= 1
print((t_cnt + s_cnt))
| S = eval(input())
s_cnt =0
t_cnt =0
for s in S:
if s == 'S':
s_cnt += 1
if s == 'T':
t_cnt += 1
if s_cnt >0:
t_cnt -= 1
s_cnt -= 1
print((t_cnt + s_cnt))
| 14 | 13 | 242 | 215 | s = eval(input())
s_cnt = 0
t_cnt = 0
cnt = 0
for i in range(len(s)):
if s[i] == "S":
s_cnt += 1
if s[i] == "T":
t_cnt += 1
if s_cnt > 0:
t_cnt -= 1
s_cnt -= 1
print((t_cnt + s_cnt))
| S = eval(input())
s_cnt = 0
t_cnt = 0
for s in S:
if s == "S":
s_cnt += 1
if s == "T":
t_cnt += 1
if s_cnt > 0:
t_cnt -= 1
s_cnt -= 1
print((t_cnt + s_cnt))
| false | 7.142857 | [
"-s = eval(input())",
"+S = eval(input())",
"-cnt = 0",
"-for i in range(len(s)):",
"- if s[i] == \"S\":",
"+for s in S:",
"+ if s == \"S\":",
"- if s[i] == \"T\":",
"+ if s == \"T\":"
] | false | 0.044035 | 0.087601 | 0.502683 | [
"s185227725",
"s089828057"
] |
u699296734 | p02663 | python | s021007550 | s526801581 | 23 | 21 | 9,160 | 9,092 | Accepted | Accepted | 8.7 | h1,m1,h2,m2,k=list(map(int,input().split()))
res=max(h2*60+m2-h1*60-m1-k,0)
print(res) | h1,m1,h2,m2,k=list(map(int,input().split()))
res=h2*60+m2-h1*60-m1-k
print(res) | 3 | 3 | 82 | 75 | h1, m1, h2, m2, k = list(map(int, input().split()))
res = max(h2 * 60 + m2 - h1 * 60 - m1 - k, 0)
print(res)
| h1, m1, h2, m2, k = list(map(int, input().split()))
res = h2 * 60 + m2 - h1 * 60 - m1 - k
print(res)
| false | 0 | [
"-res = max(h2 * 60 + m2 - h1 * 60 - m1 - k, 0)",
"+res = h2 * 60 + m2 - h1 * 60 - m1 - k"
] | false | 0.129298 | 0.041625 | 3.106236 | [
"s021007550",
"s526801581"
] |
u937706062 | p03027 | python | s575692967 | s901614657 | 1,853 | 1,458 | 44,972 | 47,120 | Accepted | Accepted | 21.32 | mod = 10 ** 6 + 3
W = [1]
for i in range(1, mod):
W.append((W[-1] * i) % mod)
def rev(a):
return pow(a, mod - 2, mod)
def f(x, d, n):
if d == 0:
return pow(x, n, mod)
else:
d_r = rev(d)
xdr = d_r * x % mod
if xdr == 0:
return 0
elif (xdr + n - 1) >= mod:
return 0
else:
re... | mod = 10 ** 6 + 3
W = [1] * (mod)
for i in range(mod - 1):
W[i + 1] = ((i + 1) * W[i]) % mod
def rev(a):
return pow(a, mod - 2, mod)
def f(x, d, n):
if d == 0:
return pow(x, n, mod)
else:
d_r = rev(d)
xdr = d_r * x % mod
if xdr == 0:
return 0
elif (xdr + n - 1) >= mod:
return 0
... | 26 | 29 | 487 | 546 | mod = 10**6 + 3
W = [1]
for i in range(1, mod):
W.append((W[-1] * i) % mod)
def rev(a):
return pow(a, mod - 2, mod)
def f(x, d, n):
if d == 0:
return pow(x, n, mod)
else:
d_r = rev(d)
xdr = d_r * x % mod
if xdr == 0:
return 0
elif (xdr + n - 1) >= ... | mod = 10**6 + 3
W = [1] * (mod)
for i in range(mod - 1):
W[i + 1] = ((i + 1) * W[i]) % mod
def rev(a):
return pow(a, mod - 2, mod)
def f(x, d, n):
if d == 0:
return pow(x, n, mod)
else:
d_r = rev(d)
xdr = d_r * x % mod
if xdr == 0:
return 0
elif (x... | false | 10.344828 | [
"-W = [1]",
"-for i in range(1, mod):",
"- W.append((W[-1] * i) % mod)",
"+W = [1] * (mod)",
"+for i in range(mod - 1):",
"+ W[i + 1] = ((i + 1) * W[i]) % mod",
"-Q = int(eval(input()))",
"-for i in range(Q):",
"+ans = []",
"+q = int(eval(input()))",
"+for _ in range(q):",
"- print((f... | false | 0.577302 | 1.455928 | 0.396518 | [
"s575692967",
"s901614657"
] |
u262597910 | p02936 | python | s072257957 | s895813337 | 1,421 | 1,033 | 73,732 | 73,604 | Accepted | Accepted | 27.3 | import sys
input = sys.stdin.readline
n,q = list(map(int, input().split()))
way = [[] for _ in range(n)]
for i in range(n-1):
a,b = list(map(int, input().split()))
way[a-1].append(b-1)
way[b-1].append(a-1)
add = [0]*n
for i in range(q):
a,b = list(map(int, input().split()))
add[a-1] += ... | import sys
input = sys.stdin.readline
def main():
n,q = list(map(int, input().split()))
way = [[] for _ in range(n)]
for i in range(n-1):
a,b = list(map(int, input().split()))
way[a-1].append(b-1)
way[b-1].append(a-1)
add = [0]*n
for i in range(q):
a,b = ... | 25 | 28 | 589 | 720 | import sys
input = sys.stdin.readline
n, q = list(map(int, input().split()))
way = [[] for _ in range(n)]
for i in range(n - 1):
a, b = list(map(int, input().split()))
way[a - 1].append(b - 1)
way[b - 1].append(a - 1)
add = [0] * n
for i in range(q):
a, b = list(map(int, input().split()))
add[a - 1... | import sys
input = sys.stdin.readline
def main():
n, q = list(map(int, input().split()))
way = [[] for _ in range(n)]
for i in range(n - 1):
a, b = list(map(int, input().split()))
way[a - 1].append(b - 1)
way[b - 1].append(a - 1)
add = [0] * n
for i in range(q):
a,... | false | 10.714286 | [
"-n, q = list(map(int, input().split()))",
"-way = [[] for _ in range(n)]",
"-for i in range(n - 1):",
"- a, b = list(map(int, input().split()))",
"- way[a - 1].append(b - 1)",
"- way[b - 1].append(a - 1)",
"-add = [0] * n",
"-for i in range(q):",
"- a, b = list(map(int, input().split())... | false | 0.077302 | 0.04651 | 1.662036 | [
"s072257957",
"s895813337"
] |
u103539599 | p03331 | python | s323975529 | s250955260 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | N = int(eval(input()))
if N % 10 == 0:
# print(str(N)[0])
if str(N)[0] == "1":
print((10))
else:
print((str(N)[0]))
else:
print((sum(list(map(int,list(str(N))))))) | N = int(eval(input()))
if N % 10 == 0 and str(N)[0] == "1":
print((10))
else:
print((sum(list(map(int,list(str(N)))))))
| 10 | 6 | 193 | 124 | N = int(eval(input()))
if N % 10 == 0:
# print(str(N)[0])
if str(N)[0] == "1":
print((10))
else:
print((str(N)[0]))
else:
print((sum(list(map(int, list(str(N)))))))
| N = int(eval(input()))
if N % 10 == 0 and str(N)[0] == "1":
print((10))
else:
print((sum(list(map(int, list(str(N)))))))
| false | 40 | [
"-if N % 10 == 0:",
"- # print(str(N)[0])",
"- if str(N)[0] == \"1\":",
"- print((10))",
"- else:",
"- print((str(N)[0]))",
"+if N % 10 == 0 and str(N)[0] == \"1\":",
"+ print((10))"
] | false | 0.061533 | 0.051175 | 1.202405 | [
"s323975529",
"s250955260"
] |
u422291726 | p03061 | python | s163445213 | s640399946 | 209 | 184 | 16,148 | 16,132 | Accepted | Accepted | 11.96 | import fractions
N = int(eval(input()))
A = list(map(int, input().split()))
L = [0] * N
R = [0] * N
for i in range(0, N - 1):
L[i + 1] = fractions.gcd(L[i], A[i])
for i in range(N - 1, 0, -1):
R[i - 1] = fractions.gcd(R[i], A[i])
ans = 1
for i in range(N):
ans = max(ans, fractions.gcd(L[i], R[i... | import fractions
N = int(eval(input()))
A = list(map(int, input().split()))
L = [0] * N
R = [0] * N
for i in range(0, N - 1):
L[i + 1] = fractions.gcd(L[i], A[i])
for i in range(N - 1, 0, -1):
R[i - 1] = fractions.gcd(R[i], A[i])
print((max([fractions.gcd(L[i], R[i]) for i in range(N)])))
| 14 | 11 | 330 | 301 | import fractions
N = int(eval(input()))
A = list(map(int, input().split()))
L = [0] * N
R = [0] * N
for i in range(0, N - 1):
L[i + 1] = fractions.gcd(L[i], A[i])
for i in range(N - 1, 0, -1):
R[i - 1] = fractions.gcd(R[i], A[i])
ans = 1
for i in range(N):
ans = max(ans, fractions.gcd(L[i], R[i]))
print(an... | import fractions
N = int(eval(input()))
A = list(map(int, input().split()))
L = [0] * N
R = [0] * N
for i in range(0, N - 1):
L[i + 1] = fractions.gcd(L[i], A[i])
for i in range(N - 1, 0, -1):
R[i - 1] = fractions.gcd(R[i], A[i])
print((max([fractions.gcd(L[i], R[i]) for i in range(N)])))
| false | 21.428571 | [
"-ans = 1",
"-for i in range(N):",
"- ans = max(ans, fractions.gcd(L[i], R[i]))",
"-print(ans)",
"+print((max([fractions.gcd(L[i], R[i]) for i in range(N)])))"
] | false | 0.04506 | 0.047638 | 0.945895 | [
"s163445213",
"s640399946"
] |
u644907318 | p03618 | python | s643676933 | s603554740 | 183 | 83 | 40,688 | 83,900 | Accepted | Accepted | 54.64 | A = input().strip()
C = {chr(i):0 for i in range(97,123)}
n = len(A)
for i in range(n):
C[A[i]] += 1
cnt = 0
for a in C:
cnt += (C[a]*(C[a]-1))//2
print((1+(n*(n-1))//2-cnt)) | A = input().strip()
N = len(A)
tot = 1+(N*(N-1))//2
C = {chr(i):[] for i in range(97,123)}
for i in range(N):
C[A[i]].append(i)
cnt = 0
for a in C:
n = len(C[a])
cnt += (n*(n-1))//2
print((tot-cnt)) | 9 | 11 | 188 | 218 | A = input().strip()
C = {chr(i): 0 for i in range(97, 123)}
n = len(A)
for i in range(n):
C[A[i]] += 1
cnt = 0
for a in C:
cnt += (C[a] * (C[a] - 1)) // 2
print((1 + (n * (n - 1)) // 2 - cnt))
| A = input().strip()
N = len(A)
tot = 1 + (N * (N - 1)) // 2
C = {chr(i): [] for i in range(97, 123)}
for i in range(N):
C[A[i]].append(i)
cnt = 0
for a in C:
n = len(C[a])
cnt += (n * (n - 1)) // 2
print((tot - cnt))
| false | 18.181818 | [
"-C = {chr(i): 0 for i in range(97, 123)}",
"-n = len(A)",
"-for i in range(n):",
"- C[A[i]] += 1",
"+N = len(A)",
"+tot = 1 + (N * (N - 1)) // 2",
"+C = {chr(i): [] for i in range(97, 123)}",
"+for i in range(N):",
"+ C[A[i]].append(i)",
"- cnt += (C[a] * (C[a] - 1)) // 2",
"-print((1 ... | false | 0.007484 | 0.035614 | 0.210129 | [
"s643676933",
"s603554740"
] |
u714642969 | p02880 | python | s377326680 | s270842959 | 168 | 17 | 38,384 | 2,940 | Accepted | Accepted | 89.88 | N=int(eval(input()))
for i in range(9):
if N%(i+1)==0 and N//(i+1)<10:
print('Yes')
break
else:
print('No')
| N=int(eval(input()))
print(('YNeos'[not [i for i in range(1,10) if N%i==0 and N//i<10]::2])) | 7 | 2 | 132 | 85 | N = int(eval(input()))
for i in range(9):
if N % (i + 1) == 0 and N // (i + 1) < 10:
print("Yes")
break
else:
print("No")
| N = int(eval(input()))
print(("YNeos"[not [i for i in range(1, 10) if N % i == 0 and N // i < 10] :: 2]))
| false | 71.428571 | [
"-for i in range(9):",
"- if N % (i + 1) == 0 and N // (i + 1) < 10:",
"- print(\"Yes\")",
"- break",
"-else:",
"- print(\"No\")",
"+print((\"YNeos\"[not [i for i in range(1, 10) if N % i == 0 and N // i < 10] :: 2]))"
] | false | 0.110353 | 0.038731 | 2.849225 | [
"s377326680",
"s270842959"
] |
u894934980 | p02796 | python | s433165849 | s118876826 | 456 | 409 | 21,380 | 18,216 | Accepted | Accepted | 10.31 | N = int(eval(input()))
R = [tuple(map(int, input().split())) for _ in range(N)]
# 左端でソート
R.sort(key=lambda x: x[0]-x[1])
prev_L_arm = R[0][0] - R[0][1]
prev_R_arm = R[0][0] + R[0][1]
ans = N
for i in range(1, N):
L_arm = R[i][0] - R[i][1]
R_arm = R[i][0] + R[i][1]
if L_arm < prev_R_arm:
p... | # 解き直し https://atcoder.jp/contests/keyence2020/tasks/keyence2020_b
N = int(eval(input()))
R = [None] * N
for i in range(N):
X, L = list(map(int, input().split()))
R[i] = (X-L, X+L)
# 右端でソート
R.sort(key=lambda x: x[1])
ans = N
max_R = R[0][1]
for i in range(1, N):
if R[i][0] < max_R:
ans -... | 16 | 16 | 417 | 359 | N = int(eval(input()))
R = [tuple(map(int, input().split())) for _ in range(N)]
# 左端でソート
R.sort(key=lambda x: x[0] - x[1])
prev_L_arm = R[0][0] - R[0][1]
prev_R_arm = R[0][0] + R[0][1]
ans = N
for i in range(1, N):
L_arm = R[i][0] - R[i][1]
R_arm = R[i][0] + R[i][1]
if L_arm < prev_R_arm:
prev_R_arm... | # 解き直し https://atcoder.jp/contests/keyence2020/tasks/keyence2020_b
N = int(eval(input()))
R = [None] * N
for i in range(N):
X, L = list(map(int, input().split()))
R[i] = (X - L, X + L)
# 右端でソート
R.sort(key=lambda x: x[1])
ans = N
max_R = R[0][1]
for i in range(1, N):
if R[i][0] < max_R:
ans -= 1
... | false | 0 | [
"+# 解き直し https://atcoder.jp/contests/keyence2020/tasks/keyence2020_b",
"-R = [tuple(map(int, input().split())) for _ in range(N)]",
"-# 左端でソート",
"-R.sort(key=lambda x: x[0] - x[1])",
"-prev_L_arm = R[0][0] - R[0][1]",
"-prev_R_arm = R[0][0] + R[0][1]",
"+R = [None] * N",
"+for i in range(N):",
"+ ... | false | 0.051115 | 0.051025 | 1.00175 | [
"s433165849",
"s118876826"
] |
u924467864 | p03011 | python | s204613449 | s699339717 | 298 | 149 | 21,144 | 12,508 | Accepted | Accepted | 50 | import numpy as np
p, q, r = list(map(int, input().split()))
list = [p, q, r]
max_ = max(list)
sum_ = sum(list) - max_
print(sum_)
| import numpy as np
P,Q,R = (int(x) for x in input().split())
times = []
times.append(P+Q)
times.append(P+R)
times.append(Q+R)
print((min(times))) | 12 | 11 | 142 | 157 | import numpy as np
p, q, r = list(map(int, input().split()))
list = [p, q, r]
max_ = max(list)
sum_ = sum(list) - max_
print(sum_)
| import numpy as np
P, Q, R = (int(x) for x in input().split())
times = []
times.append(P + Q)
times.append(P + R)
times.append(Q + R)
print((min(times)))
| false | 8.333333 | [
"-p, q, r = list(map(int, input().split()))",
"-list = [p, q, r]",
"-max_ = max(list)",
"-sum_ = sum(list) - max_",
"-print(sum_)",
"+P, Q, R = (int(x) for x in input().split())",
"+times = []",
"+times.append(P + Q)",
"+times.append(P + R)",
"+times.append(Q + R)",
"+print((min(times)))"
] | false | 0.046215 | 0.211775 | 0.218226 | [
"s204613449",
"s699339717"
] |
u345966487 | p03329 | python | s474058173 | s417464318 | 503 | 407 | 6,900 | 4,596 | Accepted | Accepted | 19.09 | N = int(eval(input()))
t = list(range(N+1))
for i in range(2, N+1):
x = t[i-1] + 1
p6, p9 = 6, 9
while i-p6 >= 0:
x = min(x, t[i-p6] + 1)
p6 *= 6
while i-p9 >= 0:
x = min(x, t[i-p9] + 1)
p9 *= 9
t[i] = x
print((t[N]))
| N=int(eval(input()));t=[0]+[N]*N
for i in range(1,N+1):
x,a,b=t[i-1],6,9
while a<=i:x=min(x,t[i-a],t[i-b]if b<=i else N);a*=6;b*=9
t[i]=x+1
print((t[N])) | 13 | 6 | 274 | 153 | N = int(eval(input()))
t = list(range(N + 1))
for i in range(2, N + 1):
x = t[i - 1] + 1
p6, p9 = 6, 9
while i - p6 >= 0:
x = min(x, t[i - p6] + 1)
p6 *= 6
while i - p9 >= 0:
x = min(x, t[i - p9] + 1)
p9 *= 9
t[i] = x
print((t[N]))
| N = int(eval(input()))
t = [0] + [N] * N
for i in range(1, N + 1):
x, a, b = t[i - 1], 6, 9
while a <= i:
x = min(x, t[i - a], t[i - b] if b <= i else N)
a *= 6
b *= 9
t[i] = x + 1
print((t[N]))
| false | 53.846154 | [
"-t = list(range(N + 1))",
"-for i in range(2, N + 1):",
"- x = t[i - 1] + 1",
"- p6, p9 = 6, 9",
"- while i - p6 >= 0:",
"- x = min(x, t[i - p6] + 1)",
"- p6 *= 6",
"- while i - p9 >= 0:",
"- x = min(x, t[i - p9] + 1)",
"- p9 *= 9",
"- t[i] = x",
"+t... | false | 0.099137 | 0.215007 | 0.461089 | [
"s474058173",
"s417464318"
] |
u588341295 | p03566 | python | s155851650 | s656418937 | 933 | 421 | 3,064 | 3,188 | Accepted | Accepted | 54.88 | # -*- coding: utf-8 -*-
"""
参考:http://ferin-tech.hatenablog.com/entry/2017/10/28/231616
・愚直に3重ループでシミュレーション
"""
N = int(eval(input()))
tN = list(map(int, input().split()))
vN = list(map(int, input().split()))
# 終点の処理をしやすくするため追加
tN.append(0)
vN.append(0)
dist = 0
speed = 0
for i in range(N):
keep ... | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | 44 | 64 | 1,054 | 1,722 | # -*- coding: utf-8 -*-
"""
参考:http://ferin-tech.hatenablog.com/entry/2017/10/28/231616
・愚直に3重ループでシミュレーション
"""
N = int(eval(input()))
tN = list(map(int, input().split()))
vN = list(map(int, input().split()))
# 終点の処理をしやすくするため追加
tN.append(0)
vN.append(0)
dist = 0
speed = 0
for i in range(N):
keep = True
plus = Tr... | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d for j in range(c)] for j in rang... | false | 31.25 | [
"-\"\"\"",
"-参考:http://ferin-tech.hatenablog.com/entry/2017/10/28/231616",
"-・愚直に3重ループでシミュレーション",
"-\"\"\"",
"-N = int(eval(input()))",
"-tN = list(map(int, input().split()))",
"-vN = list(map(int, input().split()))",
"-# 終点の処理をしやすくするため追加",
"-tN.append(0)",
"-vN.append(0)",
"-dist = 0",
"-spee... | false | 0.079159 | 0.041903 | 1.889116 | [
"s155851650",
"s656418937"
] |
u509739538 | p02780 | python | s999876624 | s324977615 | 1,211 | 251 | 26,624 | 26,624 | Accepted | Accepted | 79.27 | import math
import queue
from collections import defaultdict
def readInt():
return int(eval(input()))
def readInts():
return list(map(int, input().split()))
def readChar():
return eval(input())
def readChars():
return input().split()
def factorization(n):
res = []
if n%2==0:
res.append(2)
for ... | import math
import queue
from collections import defaultdict
def readInt():
return int(eval(input()))
def readInts():
return list(map(int, input().split()))
def readChar():
return eval(input())
def readChars():
return input().split()
def factorization(n):
res = []
if n%2==0:
res.append(2)
for ... | 148 | 146 | 2,699 | 2,631 | import math
import queue
from collections import defaultdict
def readInt():
return int(eval(input()))
def readInts():
return list(map(int, input().split()))
def readChar():
return eval(input())
def readChars():
return input().split()
def factorization(n):
res = []
if n % 2 == 0:
... | import math
import queue
from collections import defaultdict
def readInt():
return int(eval(input()))
def readInts():
return list(map(int, input().split()))
def readChar():
return eval(input())
def readChars():
return input().split()
def factorization(n):
res = []
if n % 2 == 0:
... | false | 1.351351 | [
"-# print(p)",
"-maxValue = sum(p[0:k])",
"-be = maxValue",
"-memo = p[0:k]",
"-ans = 0",
"-for i in range(1, n - k + 1):",
"- be += -p[i - 1] + p[i + k - 1]",
"- if maxValue < be:",
"- maxValue = sum(p[i : i + k])",
"- memo = p[i : i + k]",
"-for i in range(k):",
"- ans... | false | 0.038821 | 0.036986 | 1.049614 | [
"s999876624",
"s324977615"
] |
u753803401 | p03478 | python | s547989509 | s664519875 | 46 | 37 | 2,940 | 3,060 | Accepted | Accepted | 19.57 | n, a, b = list(map(int, input().split()))
total_sum = 0
for i in range(1, n + 1):
total = 0
for j in range(len(str(i))):
total += int(str(i)[j])
if a <= total <= b:
total_sum += i
print(total_sum)
| n, a, b = list(map(int, input().split()))
s = 0
for i in range(1, n + 1):
t = str(i)
total = sum(list(map(int, list(t))))
if a <= total <= b:
s += i
print(s)
| 9 | 8 | 227 | 179 | n, a, b = list(map(int, input().split()))
total_sum = 0
for i in range(1, n + 1):
total = 0
for j in range(len(str(i))):
total += int(str(i)[j])
if a <= total <= b:
total_sum += i
print(total_sum)
| n, a, b = list(map(int, input().split()))
s = 0
for i in range(1, n + 1):
t = str(i)
total = sum(list(map(int, list(t))))
if a <= total <= b:
s += i
print(s)
| false | 11.111111 | [
"-total_sum = 0",
"+s = 0",
"- total = 0",
"- for j in range(len(str(i))):",
"- total += int(str(i)[j])",
"+ t = str(i)",
"+ total = sum(list(map(int, list(t))))",
"- total_sum += i",
"-print(total_sum)",
"+ s += i",
"+print(s)"
] | false | 0.077059 | 0.038242 | 2.015032 | [
"s547989509",
"s664519875"
] |
u811967730 | p03557 | python | s414878773 | s964113485 | 1,399 | 877 | 24,052 | 23,312 | Accepted | Accepted | 37.31 | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
ans = 0
for b in B:
l = -1
r = N
while r - l > 1:
m = (r + l) // 2
if A[m] < b:
l = m
else:
... | import sys
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
def count_a(A, X):
l = -1
r = N
while r - l > 1:
m = (r + l) // 2
if A[m] < b:
l = m
... | 35 | 54 | 578 | 825 | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
ans = 0
for b in B:
l = -1
r = N
while r - l > 1:
m = (r + l) // 2
if A[m] < b:
l = m
else:
r = m
... | import sys
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
def count_a(A, X):
l = -1
r = N
while r - l > 1:
m = (r + l) // 2
if A[m] < b:
l = m
else:
... | false | 35.185185 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"-A.sort()",
"-B.sort()",
"-C.sort()",
"-ans = 0",
"-for b in B:",
"+",
"+",
"+def count_a(A, X):",
"- a_cnt = l + 1 if l != -1 else 0",
"+ return l + 1",
"+",
"+",
"+def count_c(C, X):",
"- c_cnt = N - r",
"+ return N ... | false | 0.041838 | 0.042332 | 0.988331 | [
"s414878773",
"s964113485"
] |
u580697892 | p03212 | python | s315380775 | s538918944 | 1,926 | 782 | 3,436 | 61,784 | Accepted | Accepted | 59.4 | #coding: utf-8
from collections import Counter
N = int(eval(input()))
l = ["0", "3", "5", "7"]
ans = ["0" for _ in range(9)]
cnt = 0
for a in l:
ans[0] = a
for b in l:
ans[1] = b
for c in l:
ans[2] = c
for d in l:
ans[3] = d
f... | #coding: utf-8
from collections import Counter
N = int(eval(input()))
l = ["0", "3", "5", "7"]
ans = ["0"] * 9
cnt = 0
for a in l:
ans[0] = a
for b in l:
ans[1] = b
for c in l:
ans[2] = c
for d in l:
ans[3] = d
for e in l:
... | 29 | 29 | 1,000 | 986 | # coding: utf-8
from collections import Counter
N = int(eval(input()))
l = ["0", "3", "5", "7"]
ans = ["0" for _ in range(9)]
cnt = 0
for a in l:
ans[0] = a
for b in l:
ans[1] = b
for c in l:
ans[2] = c
for d in l:
ans[3] = d
for e in l:
... | # coding: utf-8
from collections import Counter
N = int(eval(input()))
l = ["0", "3", "5", "7"]
ans = ["0"] * 9
cnt = 0
for a in l:
ans[0] = a
for b in l:
ans[1] = b
for c in l:
ans[2] = c
for d in l:
ans[3] = d
for e in l:
... | false | 0 | [
"-ans = [\"0\" for _ in range(9)]",
"+ans = [\"0\"] * 9"
] | false | 2.509825 | 1.628907 | 1.540803 | [
"s315380775",
"s538918944"
] |
u025287757 | p03634 | python | s965004532 | s256693535 | 1,647 | 1,030 | 137,884 | 140,540 | Accepted | Accepted | 37.46 | import sys
sys.setrecursionlimit(10**8)
N = int(eval(input()))
a = [[] for i in range(N)]
for i in range(N-1):
A, B, C = list(map(int, input().split()))
a[A-1].append([B-1, C])
a[B-1].append([A-1, C])
dist = [-1]*N
Q, K = list(map(int, input().split()))
dist[K-1] = 0
def dfs(now):
for i, dis_e in ... | import sys
sys.setrecursionlimit(10**8)
N = int(input())
a = [[] for i in range(N)]
for i in range(N-1):
A, B, C = map(int, input().split())
a[A-1].append([B-1, C])
a[B-1].append([A-1, C])
dist = [-1]*N
Q, K = map(int, input().split())
dist[K-1] = 0
def dfs(now):
for i, dis_e in a[now]:
if di... | 28 | 28 | 580 | 584 | import sys
sys.setrecursionlimit(10**8)
N = int(eval(input()))
a = [[] for i in range(N)]
for i in range(N - 1):
A, B, C = list(map(int, input().split()))
a[A - 1].append([B - 1, C])
a[B - 1].append([A - 1, C])
dist = [-1] * N
Q, K = list(map(int, input().split()))
dist[K - 1] = 0
def dfs(now):
for i... | import sys
sys.setrecursionlimit(10**8)
N = int(input())
a = [[] for i in range(N)]
for i in range(N - 1):
A, B, C = map(int, input().split())
a[A - 1].append([B - 1, C])
a[B - 1].append([A - 1, C])
dist = [-1] * N
Q, K = map(int, input().split())
dist[K - 1] = 0
def dfs(now):
for i, dis_e in a[now]:... | false | 0 | [
"-N = int(eval(input()))",
"+N = int(input())",
"- A, B, C = list(map(int, input().split()))",
"+ A, B, C = map(int, input().split())",
"-Q, K = list(map(int, input().split()))",
"+Q, K = map(int, input().split())",
"- x, y = list(map(int, input().split()))",
"- print((dist[x - 1] ... | false | 0.046912 | 0.045709 | 1.026315 | [
"s965004532",
"s256693535"
] |
u609061751 | p02821 | python | s330758811 | s707458044 | 1,941 | 1,699 | 59,100 | 59,664 | Accepted | Accepted | 12.47 | import sys
input = sys.stdin.readline
import bisect
from itertools import accumulate
N, M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
A.sort()
left = -1
right = 10 ** 6
def shake(x):
cnt = 0
for i in A:
cnt += N - bisect.bisect_left(A, x - i)
if cnt... | import sys
input = sys.stdin.readline
import bisect
from itertools import accumulate
N, M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
A.sort()
left = -1
right = 1 + 2 * 10 ** 5
def shake(x):
cnt = 0
for i in A:
cnt += N - bisect.bisect_left(A, x - i)
... | 52 | 52 | 973 | 981 | import sys
input = sys.stdin.readline
import bisect
from itertools import accumulate
N, M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
A.sort()
left = -1
right = 10**6
def shake(x):
cnt = 0
for i in A:
cnt += N - bisect.bisect_left(A, x - i)
if cnt >= M:
retu... | import sys
input = sys.stdin.readline
import bisect
from itertools import accumulate
N, M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
A.sort()
left = -1
right = 1 + 2 * 10**5
def shake(x):
cnt = 0
for i in A:
cnt += N - bisect.bisect_left(A, x - i)
if cnt >= M:
... | false | 0 | [
"-right = 10**6",
"+right = 1 + 2 * 10**5"
] | false | 0.045289 | 0.046023 | 0.984046 | [
"s330758811",
"s707458044"
] |
u606878291 | p04031 | python | s190531707 | s708502311 | 121 | 33 | 5,332 | 5,076 | Accepted | Accepted | 72.73 | import math
from functools import lru_cache
@lru_cache(maxsize=4096)
def get_cost(x, y):
return int(math.pow((x - y), 2))
def get_costs(target, numbers):
return sum([get_cost(target, n) for n in numbers])
def check(n, numbers):
n_max = max(numbers)
n_min = min(numbers)
costs ... | import math
from decimal import Decimal, ROUND_HALF_UP
def quantize(f):
return int(Decimal(str(f)).quantize(Decimal('0'), rounding=ROUND_HALF_UP))
def check(n, numbers):
average = sum(numbers) / n
average = quantize(average)
costs = [int(math.pow(n - average, 2)) for n in numbers]
... | 32 | 24 | 629 | 508 | import math
from functools import lru_cache
@lru_cache(maxsize=4096)
def get_cost(x, y):
return int(math.pow((x - y), 2))
def get_costs(target, numbers):
return sum([get_cost(target, n) for n in numbers])
def check(n, numbers):
n_max = max(numbers)
n_min = min(numbers)
costs = []
for targe... | import math
from decimal import Decimal, ROUND_HALF_UP
def quantize(f):
return int(Decimal(str(f)).quantize(Decimal("0"), rounding=ROUND_HALF_UP))
def check(n, numbers):
average = sum(numbers) / n
average = quantize(average)
costs = [int(math.pow(n - average, 2)) for n in numbers]
return sum(cos... | false | 25 | [
"-from functools import lru_cache",
"+from decimal import Decimal, ROUND_HALF_UP",
"-@lru_cache(maxsize=4096)",
"-def get_cost(x, y):",
"- return int(math.pow((x - y), 2))",
"-",
"-",
"-def get_costs(target, numbers):",
"- return sum([get_cost(target, n) for n in numbers])",
"+def quantize(f... | false | 0.03793 | 0.093083 | 0.407491 | [
"s190531707",
"s708502311"
] |
u985929170 | p03545 | python | s986305733 | s968413850 | 31 | 26 | 9,028 | 8,956 | Accepted | Accepted | 16.13 | from itertools import product
A,B,C,D = list(eval(input()))
for k in list(product(['+','-'],repeat=3)):
k = A + k[0] + B + k[1] + C + k[2] + D
if eval(k) == 7:
print(('{}=7'.format(k)))
break | num_li = list(eval(input()))
for i in range(2**3):
li = ['+']*3
q = num_li[0]
for j in range(3):
if ((i>>j) & 1):
li[j] = '-'
q += li[j] + num_li[j+1]
if eval(q) == 7:
print(('{}=7'.format(q)))
break | 7 | 11 | 213 | 261 | from itertools import product
A, B, C, D = list(eval(input()))
for k in list(product(["+", "-"], repeat=3)):
k = A + k[0] + B + k[1] + C + k[2] + D
if eval(k) == 7:
print(("{}=7".format(k)))
break
| num_li = list(eval(input()))
for i in range(2**3):
li = ["+"] * 3
q = num_li[0]
for j in range(3):
if (i >> j) & 1:
li[j] = "-"
q += li[j] + num_li[j + 1]
if eval(q) == 7:
print(("{}=7".format(q)))
break
| false | 36.363636 | [
"-from itertools import product",
"-",
"-A, B, C, D = list(eval(input()))",
"-for k in list(product([\"+\", \"-\"], repeat=3)):",
"- k = A + k[0] + B + k[1] + C + k[2] + D",
"- if eval(k) == 7:",
"- print((\"{}=7\".format(k)))",
"+num_li = list(eval(input()))",
"+for i in range(2**3):",... | false | 0.04271 | 0.037912 | 1.126539 | [
"s986305733",
"s968413850"
] |
u729133443 | p03840 | python | s249365196 | s303346202 | 169 | 31 | 38,384 | 9,116 | Accepted | Accepted | 81.66 | i,o,t,j,l,s,z=list(map(int,input().split()))
a=(i//2+j//2+l//2)*2
print(([a,max(a,((i-1)//2+(j-1)//2+(l-1)//2)*2+3)][(i and j and l)>0]+o)) | I,O,T,J,L,S,Z=list(map(int,input().split()))
print((max((~-I//2+~-J//2+~-L//2)*2+O+3*(I>0<L>0<J),(I//2+J//2+L//2)*2+O))) | 3 | 2 | 133 | 113 | i, o, t, j, l, s, z = list(map(int, input().split()))
a = (i // 2 + j // 2 + l // 2) * 2
print(
(
[a, max(a, ((i - 1) // 2 + (j - 1) // 2 + (l - 1) // 2) * 2 + 3)][
(i and j and l) > 0
]
+ o
)
)
| I, O, T, J, L, S, Z = list(map(int, input().split()))
print(
(
max(
(~-I // 2 + ~-J // 2 + ~-L // 2) * 2 + O + 3 * (I > 0 < L > 0 < J),
(I // 2 + J // 2 + L // 2) * 2 + O,
)
)
)
| false | 33.333333 | [
"-i, o, t, j, l, s, z = list(map(int, input().split()))",
"-a = (i // 2 + j // 2 + l // 2) * 2",
"+I, O, T, J, L, S, Z = list(map(int, input().split()))",
"- [a, max(a, ((i - 1) // 2 + (j - 1) // 2 + (l - 1) // 2) * 2 + 3)][",
"- (i and j and l) > 0",
"- ]",
"- + o",
"+... | false | 0.037972 | 0.035022 | 1.084224 | [
"s249365196",
"s303346202"
] |
u485319545 | p02727 | python | s848478840 | s207036849 | 293 | 215 | 29,732 | 29,672 | Accepted | Accepted | 26.62 | x,y,a,b,c=list(map(int,input().split()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p=sorted(p,reverse=True)
q=sorted(q,reverse=True)
r=sorted(r)
p=p[:x]
q=q[:y]
import heapq
from collections import deque
heapq.heapify(p)
heapq.heapify(q)
r=dequ... | x,y,a,b,c=list(map(int,input().split()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p=sorted(p,reverse=True)
q=sorted(q,reverse=True)
r=sorted(r)
box=[]
ans=0
for i in range(x):
box.append(p[i])
for j in range(y):
box.append(q[j])... | 39 | 29 | 749 | 418 | x, y, a, b, c = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p = sorted(p, reverse=True)
q = sorted(q, reverse=True)
r = sorted(r)
p = p[:x]
q = q[:y]
import heapq
from collections import deque
heapq.heapify(p)
heapq.heapify... | x, y, a, b, c = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p = sorted(p, reverse=True)
q = sorted(q, reverse=True)
r = sorted(r)
box = []
ans = 0
for i in range(x):
box.append(p[i])
for j in range(y):
box.append(q[j... | false | 25.641026 | [
"-p = p[:x]",
"-q = q[:y]",
"-import heapq",
"-from collections import deque",
"-",
"-heapq.heapify(p)",
"-heapq.heapify(q)",
"-r = deque(r)",
"-for i in range(c):",
"- v_p = heapq.heappop(p)",
"- v_q = heapq.heappop(q)",
"- v_r = r.pop()",
"- if v_p <= v_q:",
"- heapq.h... | false | 0.082338 | 0.037385 | 2.20243 | [
"s848478840",
"s207036849"
] |
u466335531 | p03295 | python | s086664082 | s868149799 | 565 | 393 | 29,068 | 18,212 | Accepted | Accepted | 30.44 | N,M=list(map(int,input().split()))
request=[]
for _ in range(M):
request.append(list(map(int,input().split())))
request.sort(key=lambda x: x[0])
memory=request[0][1]
head = request[0][0]
index = 0
ans = 0
def equal():
if index == M-1: return False
else: return head == request[index+1][0]
... | N,M=list(map(int,input().split()))
AB=[]
for _ in range(M):
AB.append(tuple(map(int,input().split())))
request_max=0
request_num=0
AB.sort(key=lambda x:x[1])
for (a,b) in AB:
if a>=request_max:
request_num +=1
request_max = b
print(request_num) | 25 | 14 | 522 | 281 | N, M = list(map(int, input().split()))
request = []
for _ in range(M):
request.append(list(map(int, input().split())))
request.sort(key=lambda x: x[0])
memory = request[0][1]
head = request[0][0]
index = 0
ans = 0
def equal():
if index == M - 1:
return False
else:
return head == request[in... | N, M = list(map(int, input().split()))
AB = []
for _ in range(M):
AB.append(tuple(map(int, input().split())))
request_max = 0
request_num = 0
AB.sort(key=lambda x: x[1])
for (a, b) in AB:
if a >= request_max:
request_num += 1
request_max = b
print(request_num)
| false | 44 | [
"-request = []",
"+AB = []",
"- request.append(list(map(int, input().split())))",
"-request.sort(key=lambda x: x[0])",
"-memory = request[0][1]",
"-head = request[0][0]",
"-index = 0",
"-ans = 0",
"-",
"-",
"-def equal():",
"- if index == M - 1:",
"- return False",
"- else:... | false | 0.038647 | 0.038876 | 0.994116 | [
"s086664082",
"s868149799"
] |
u661290476 | p00018 | python | s310492553 | s849028088 | 30 | 20 | 7,652 | 7,624 | Accepted | Accepted | 33.33 | a=sorted([int(i) for i in input().split()],reverse=True)
print((" ".join([str(i) for i in a]))) | a=sorted([int(i) for i in input().split()],reverse=True)
print((*a)) | 2 | 2 | 94 | 67 | a = sorted([int(i) for i in input().split()], reverse=True)
print((" ".join([str(i) for i in a])))
| a = sorted([int(i) for i in input().split()], reverse=True)
print((*a))
| false | 0 | [
"-print((\" \".join([str(i) for i in a])))",
"+print((*a))"
] | false | 0.079936 | 0.079105 | 1.010496 | [
"s310492553",
"s849028088"
] |
u145950990 | p03137 | python | s562402534 | s681726967 | 226 | 113 | 58,408 | 13,960 | Accepted | Accepted | 50 | n,m = list(map(int,input().split()))
x = list(map(int,input().split()))
x = sorted(x)
if m<=n:
print((0))
else:
dif = []
for i in range(m-1):
dif.append(x[i+1]-x[i])
dif = sorted(dif)
print((sum(dif[:m-n]))) | n,m = list(map(int,input().split()))
x = sorted(list(map(int,input().split())))
dif = []
for i in range(m-1):
dif.append(x[i+1]-x[i])
dif.sort()
print((sum(dif[:max(m-n,0)]))) | 11 | 7 | 235 | 177 | n, m = list(map(int, input().split()))
x = list(map(int, input().split()))
x = sorted(x)
if m <= n:
print((0))
else:
dif = []
for i in range(m - 1):
dif.append(x[i + 1] - x[i])
dif = sorted(dif)
print((sum(dif[: m - n])))
| n, m = list(map(int, input().split()))
x = sorted(list(map(int, input().split())))
dif = []
for i in range(m - 1):
dif.append(x[i + 1] - x[i])
dif.sort()
print((sum(dif[: max(m - n, 0)])))
| false | 36.363636 | [
"-x = list(map(int, input().split()))",
"-x = sorted(x)",
"-if m <= n:",
"- print((0))",
"-else:",
"- dif = []",
"- for i in range(m - 1):",
"- dif.append(x[i + 1] - x[i])",
"- dif = sorted(dif)",
"- print((sum(dif[: m - n])))",
"+x = sorted(list(map(int, input().split())))... | false | 0.034926 | 0.035403 | 0.986504 | [
"s562402534",
"s681726967"
] |
u941753895 | p03103 | python | s522764806 | s688740048 | 573 | 456 | 29,052 | 24,932 | Accepted | Accepted | 20.42 | class struct:
def __init__(self,a,b):
self.a=a
self.b=b
n,m=list(map(int,input().split()))
l=[]
for i in range(n):
a,b=list(map(int,input().split()))
l.append(struct(a,b))
l=sorted(l,key=lambda x:x.a)
su=0
for x in l:
if x.b<m:
m-=x.b
su+=(x.a)*(x.b)
else:
su+=(x.a)*m
... | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
def LI(): return list(map(int,input().split()))
def I(): return int(eval(input()))
def LS(): return input().split()
def S(): return eval(input())
def main():
n,m=... | 19 | 31 | 324 | 555 | class struct:
def __init__(self, a, b):
self.a = a
self.b = b
n, m = list(map(int, input().split()))
l = []
for i in range(n):
a, b = list(map(int, input().split()))
l.append(struct(a, b))
l = sorted(l, key=lambda x: x.a)
su = 0
for x in l:
if x.b < m:
m -= x.b
su += (x... | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI():
return list(map(int, input().split()))
def I():
return int(eval(input()))
def LS():
return input().split()
def S():
return eval... | false | 38.709677 | [
"-class struct:",
"- def __init__(self, a, b):",
"- self.a = a",
"- self.b = b",
"+import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time",
"+",
"+sys.setrecursionlimit(10**7)",
"+inf = 10**20",
"+mod = 10**9 + 7",
"-n, m = list(map(int... | false | 0.130554 | 0.069955 | 1.86625 | [
"s522764806",
"s688740048"
] |
u706929073 | p03137 | python | s425475588 | s984831950 | 113 | 103 | 13,968 | 13,968 | Accepted | Accepted | 8.85 | (n, m) = list(map(int, input().split()))
x = list(map(int, input().split()))
x.sort()
diff = []
for i in range(1, len(x)):
diff.append(x[i] - x[i-1])
diff.sort(reverse=True)
sum = 0
for i in range(n - 1, len(diff)):
sum += diff[i]
print(sum) | n, m = list(map(int, input().split()))
if n >= m:
print((0))
exit(0)
x = sorted(list(map(int, input().split())))
gaps = sorted([x[i] - x[i-1] for i in range(1, m)], reverse=True)
print((sum(gaps[n-1:])))
| 11 | 8 | 253 | 210 | (n, m) = list(map(int, input().split()))
x = list(map(int, input().split()))
x.sort()
diff = []
for i in range(1, len(x)):
diff.append(x[i] - x[i - 1])
diff.sort(reverse=True)
sum = 0
for i in range(n - 1, len(diff)):
sum += diff[i]
print(sum)
| n, m = list(map(int, input().split()))
if n >= m:
print((0))
exit(0)
x = sorted(list(map(int, input().split())))
gaps = sorted([x[i] - x[i - 1] for i in range(1, m)], reverse=True)
print((sum(gaps[n - 1 :])))
| false | 27.272727 | [
"-(n, m) = list(map(int, input().split()))",
"-x = list(map(int, input().split()))",
"-x.sort()",
"-diff = []",
"-for i in range(1, len(x)):",
"- diff.append(x[i] - x[i - 1])",
"-diff.sort(reverse=True)",
"-sum = 0",
"-for i in range(n - 1, len(diff)):",
"- sum += diff[i]",
"-print(sum)",
... | false | 0.042867 | 0.043397 | 0.987789 | [
"s425475588",
"s984831950"
] |
u977389981 | p03632 | python | s348416683 | s816477403 | 21 | 18 | 3,316 | 3,060 | Accepted | Accepted | 14.29 | a, b, c, d = list(map(int, input().split()))
print((max(0, (min(b, d) - max(a, c))))) | a, b, c, d = list(map(int, input().split()))
x = len(set(range(a, b + 1)) & set(range(c, d + 1))) - 1
print((x if x >= 0 else 0)) | 2 | 3 | 78 | 123 | a, b, c, d = list(map(int, input().split()))
print((max(0, (min(b, d) - max(a, c)))))
| a, b, c, d = list(map(int, input().split()))
x = len(set(range(a, b + 1)) & set(range(c, d + 1))) - 1
print((x if x >= 0 else 0))
| false | 33.333333 | [
"-print((max(0, (min(b, d) - max(a, c)))))",
"+x = len(set(range(a, b + 1)) & set(range(c, d + 1))) - 1",
"+print((x if x >= 0 else 0))"
] | false | 0.039339 | 0.04306 | 0.913576 | [
"s348416683",
"s816477403"
] |
u136869985 | p04045 | python | s465752526 | s134023085 | 207 | 182 | 3,064 | 39,792 | Accepted | Accepted | 12.08 | def main():
n, k = list(map(int, input().split()))
D = list(map(int, input().split()))
while 1:
f = 0
hoge = str(n)
for i in range(len(hoge)):
for j in range(k):
if(int(hoge[i]) == D[j]):
f = 1
break
... | def main():
N, K = list(map(int, input().split()))
D = list(input().split())
i = 0
while True:
S = str(N)
f = True
for s in S:
if s in D:
f = False
break
if f:
break
N += 1
print(N)
... | 23 | 19 | 530 | 353 | def main():
n, k = list(map(int, input().split()))
D = list(map(int, input().split()))
while 1:
f = 0
hoge = str(n)
for i in range(len(hoge)):
for j in range(k):
if int(hoge[i]) == D[j]:
f = 1
break
i... | def main():
N, K = list(map(int, input().split()))
D = list(input().split())
i = 0
while True:
S = str(N)
f = True
for s in S:
if s in D:
f = False
break
if f:
break
N += 1
print(N)
if __name__ == "__ma... | false | 17.391304 | [
"- n, k = list(map(int, input().split()))",
"- D = list(map(int, input().split()))",
"- while 1:",
"- f = 0",
"- hoge = str(n)",
"- for i in range(len(hoge)):",
"- for j in range(k):",
"- if int(hoge[i]) == D[j]:",
"- f = 1",... | false | 0.050807 | 0.037884 | 1.341109 | [
"s465752526",
"s134023085"
] |
u823044869 | p03814 | python | s143818473 | s967047844 | 22 | 18 | 3,756 | 3,500 | Accepted | Accepted | 18.18 | import re
s = eval(input())
list_s = [len(i) for i in re.findall("A.*Z", s)]
print((max(list_s))) | s = eval(input())
a = s.find('A')
z = s.rfind('Z')
print((z-a+1))
| 5 | 6 | 94 | 65 | import re
s = eval(input())
list_s = [len(i) for i in re.findall("A.*Z", s)]
print((max(list_s)))
| s = eval(input())
a = s.find("A")
z = s.rfind("Z")
print((z - a + 1))
| false | 16.666667 | [
"-import re",
"-",
"-list_s = [len(i) for i in re.findall(\"A.*Z\", s)]",
"-print((max(list_s)))",
"+a = s.find(\"A\")",
"+z = s.rfind(\"Z\")",
"+print((z - a + 1))"
] | false | 0.038353 | 0.033752 | 1.136311 | [
"s143818473",
"s967047844"
] |
u461836414 | p03037 | python | s884586904 | s416492510 | 405 | 321 | 3,188 | 3,060 | Accepted | Accepted | 20.74 | N, M = list(map(int, input().split()))
L1, R1 = list(map(int, input().split()))
flag = 0
def find_key(L1,R1,L2,R2):
if R1 < L2 or R2 < L1:
return(False)
else:
a = [R1,L1,R2,L2]
a.sort()
return(a[1],a[2])
for i in range(M - 1):
L,R = list(map(int, input().split())... | n,m=list(map(int,input().split()))
ml=0
mr=100000
for i in range(m):
l,r=list(map(int,input().split()))
ml=max(ml,l)
mr=min(mr,r)
if ml>mr:
break
if ml<=mr:
print((mr-ml+1))
else:
print((0)) | 21 | 13 | 475 | 202 | N, M = list(map(int, input().split()))
L1, R1 = list(map(int, input().split()))
flag = 0
def find_key(L1, R1, L2, R2):
if R1 < L2 or R2 < L1:
return False
else:
a = [R1, L1, R2, L2]
a.sort()
return (a[1], a[2])
for i in range(M - 1):
L, R = list(map(int, input().split()))... | n, m = list(map(int, input().split()))
ml = 0
mr = 100000
for i in range(m):
l, r = list(map(int, input().split()))
ml = max(ml, l)
mr = min(mr, r)
if ml > mr:
break
if ml <= mr:
print((mr - ml + 1))
else:
print((0))
| false | 38.095238 | [
"-N, M = list(map(int, input().split()))",
"-L1, R1 = list(map(int, input().split()))",
"-flag = 0",
"-",
"-",
"-def find_key(L1, R1, L2, R2):",
"- if R1 < L2 or R2 < L1:",
"- return False",
"- else:",
"- a = [R1, L1, R2, L2]",
"- a.sort()",
"- return (a[1], a... | false | 0.034286 | 0.037825 | 0.906431 | [
"s884586904",
"s416492510"
] |
u796878730 | p02641 | python | s013765719 | s990654097 | 24 | 19 | 9,092 | 9,100 | Accepted | Accepted | 20.83 | X,N = list(map(int,input().split()))
P = list(map(int,input().split()))
P_n = [i for i in range(105) if i not in P]
abs_value = [abs(X-P_n[j]) for j in range(len(P_n))]
min_abs = min(abs_value)
for k in range(len(abs_value)):
if abs_value[k] == min_abs:
print((P_n[k]))
break | X,N = list(map(int,input().split()))
P = list(map(int,input().split()))
P_n = [i for i in range(102) if i not in P]
abs_value = [abs(X-P_n[j]) for j in range(len(P_n))]
min_abs = min(abs_value)
for k in range(len(abs_value)):
if abs_value[k] == min_abs:
print((P_n[k]))
break | 13 | 13 | 303 | 303 | X, N = list(map(int, input().split()))
P = list(map(int, input().split()))
P_n = [i for i in range(105) if i not in P]
abs_value = [abs(X - P_n[j]) for j in range(len(P_n))]
min_abs = min(abs_value)
for k in range(len(abs_value)):
if abs_value[k] == min_abs:
print((P_n[k]))
break
| X, N = list(map(int, input().split()))
P = list(map(int, input().split()))
P_n = [i for i in range(102) if i not in P]
abs_value = [abs(X - P_n[j]) for j in range(len(P_n))]
min_abs = min(abs_value)
for k in range(len(abs_value)):
if abs_value[k] == min_abs:
print((P_n[k]))
break
| false | 0 | [
"-P_n = [i for i in range(105) if i not in P]",
"+P_n = [i for i in range(102) if i not in P]"
] | false | 0.007795 | 0.041423 | 0.18818 | [
"s013765719",
"s990654097"
] |
u638282348 | p03038 | python | s210689701 | s733105342 | 610 | 487 | 22,208 | 22,256 | Accepted | Accepted | 20.16 | from heapq import heapify, heappush, heappop
class HeapQue(object):
def __init__(self, iterable, max_heap=False):
self.sign = -1 if max_heap else 1
sequence = [self.sign * number for number in iterable]
heapify(sequence)
self.heapque = sequence
def push(self, item):
... | from heapq import heapify, heappush, heappop
N, M = list(map(int, input().split()))
q = list(map(int, input().split()))
heapify(q)
pairs = sorted((tuple(map(int, input().split())) for _ in range(M)), key=lambda t: t[1], reverse=True)
for b, c in pairs:
for _ in range(b):
x = heappop(q)
if x ... | 30 | 15 | 947 | 452 | from heapq import heapify, heappush, heappop
class HeapQue(object):
def __init__(self, iterable, max_heap=False):
self.sign = -1 if max_heap else 1
sequence = [self.sign * number for number in iterable]
heapify(sequence)
self.heapque = sequence
def push(self, item):
he... | from heapq import heapify, heappush, heappop
N, M = list(map(int, input().split()))
q = list(map(int, input().split()))
heapify(q)
pairs = sorted(
(tuple(map(int, input().split())) for _ in range(M)),
key=lambda t: t[1],
reverse=True,
)
for b, c in pairs:
for _ in range(b):
x = heappop(q)
... | false | 50 | [
"-",
"-class HeapQue(object):",
"- def __init__(self, iterable, max_heap=False):",
"- self.sign = -1 if max_heap else 1",
"- sequence = [self.sign * number for number in iterable]",
"- heapify(sequence)",
"- self.heapque = sequence",
"-",
"- def push(self, item):",
... | false | 0.034943 | 0.037922 | 0.921443 | [
"s210689701",
"s733105342"
] |
u943004959 | p03589 | python | s019005574 | s243770569 | 1,405 | 272 | 3,064 | 39,152 | Accepted | Accepted | 80.64 | class EndLoop(Exception):
pass
def solve():
N = int(eval(input()))
try:
for h in range(1, 3501):
for n in range(1, 3501):
if 4 * h * n - n * N - h * N > 0:
if (h * n * N) % (4 * h * n - n * N - h * N) == 0:
w = int(... | class EndLoop(Exception):
pass
def solve():
N = int(input())
try:
for h in range(1, 3500):
for n in range(1, 3500):
if 4 * h * n - n * N - h * N == 0:
pass
elif (h * n * N) % (4 * h * n - n * N - h * N) == 0 and\
... | 19 | 22 | 480 | 570 | class EndLoop(Exception):
pass
def solve():
N = int(eval(input()))
try:
for h in range(1, 3501):
for n in range(1, 3501):
if 4 * h * n - n * N - h * N > 0:
if (h * n * N) % (4 * h * n - n * N - h * N) == 0:
w = int((h * n * N)... | class EndLoop(Exception):
pass
def solve():
N = int(input())
try:
for h in range(1, 3500):
for n in range(1, 3500):
if 4 * h * n - n * N - h * N == 0:
pass
elif (h * n * N) % (4 * h * n - n * N - h * N) == 0 and (
... | false | 13.636364 | [
"- N = int(eval(input()))",
"+ N = int(input())",
"- for h in range(1, 3501):",
"- for n in range(1, 3501):",
"- if 4 * h * n - n * N - h * N > 0:",
"- if (h * n * N) % (4 * h * n - n * N - h * N) == 0:",
"- w = int((h * n ... | false | 0.088317 | 0.043439 | 2.033104 | [
"s019005574",
"s243770569"
] |
u908984540 | p02255 | python | s584798574 | s381909707 | 30 | 20 | 5,984 | 5,980 | Accepted | Accepted | 33.33 | def show_list(target):
for i, item in enumerate(target):
if i == len(target) - 1:
print(item)
else:
print(item, end=" ")
def insection_sort(target):
for i in range(1, len(target)):
show_list(target)
j = i - 1
while j >= 0:
... | def insertion_sort(A):
for i in range(1, len(A)):
v = A[i]
j = i - 1
print((*A))
while j >= 0 and A[j] > v:
A[j+1] = A[j]
A[j] = v
j -= 1
return A
n = eval(input())
A = [int(x) for x in input().split()]
print((*insertion_sort(A)))... | 24 | 15 | 642 | 313 | def show_list(target):
for i, item in enumerate(target):
if i == len(target) - 1:
print(item)
else:
print(item, end=" ")
def insection_sort(target):
for i in range(1, len(target)):
show_list(target)
j = i - 1
while j >= 0:
if target[j... | def insertion_sort(A):
for i in range(1, len(A)):
v = A[i]
j = i - 1
print((*A))
while j >= 0 and A[j] > v:
A[j + 1] = A[j]
A[j] = v
j -= 1
return A
n = eval(input())
A = [int(x) for x in input().split()]
print((*insertion_sort(A)))
| false | 37.5 | [
"-def show_list(target):",
"- for i, item in enumerate(target):",
"- if i == len(target) - 1:",
"- print(item)",
"- else:",
"- print(item, end=\" \")",
"+def insertion_sort(A):",
"+ for i in range(1, len(A)):",
"+ v = A[i]",
"+ j = i - 1",
... | false | 0.049846 | 0.048248 | 1.033115 | [
"s584798574",
"s381909707"
] |
u645250356 | p03078 | python | s500242023 | s576977503 | 984 | 845 | 152,296 | 221,976 | Accepted | Accepted | 14.13 | from collections import Counter,defaultdict,deque
from heapq import heapify,heappop,heappush
import sys,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return ... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, ... | 28 | 26 | 749 | 620 | from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush
import sys, bisect, math, itertools, string, queue
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.readline().split()))
def ... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return ... | false | 7.142857 | [
"-from heapq import heapify, heappop, heappush",
"-import sys, bisect, math, itertools, string, queue",
"+from heapq import heappop, heappush",
"+from bisect import bisect_left, bisect_right",
"+import sys, math, itertools, fractions, pprint",
"+INF = float(\"inf\")",
"-def inpl_str():",
"- return ... | false | 0.046274 | 0.046357 | 0.998197 | [
"s500242023",
"s576977503"
] |
u970197315 | p02888 | python | s039426918 | s617239700 | 1,808 | 1,219 | 3,188 | 9,140 | Accepted | Accepted | 32.58 | n=int(eval(input()))
l=list(map(int,input().split()))
l.sort()
ans=0
from bisect import bisect_left
for i in range(n-2):
for j in range(i+1,n-1):
ab=l[i]+l[j]
idx=bisect_left(l,ab)
ans+=max(idx-j-1,0)
print(ans)
| n=int(eval(input()))
l=list(map(int,input().split()))
from bisect import bisect_left
l.sort()
ans=0
for i in range(n-2):
for j in range(i+1,n-1):
t=l[i]+l[j]
idx=bisect_left(l,t)
ans+=max(idx-j-1,0)
print(ans)
| 11 | 11 | 230 | 228 | n = int(eval(input()))
l = list(map(int, input().split()))
l.sort()
ans = 0
from bisect import bisect_left
for i in range(n - 2):
for j in range(i + 1, n - 1):
ab = l[i] + l[j]
idx = bisect_left(l, ab)
ans += max(idx - j - 1, 0)
print(ans)
| n = int(eval(input()))
l = list(map(int, input().split()))
from bisect import bisect_left
l.sort()
ans = 0
for i in range(n - 2):
for j in range(i + 1, n - 1):
t = l[i] + l[j]
idx = bisect_left(l, t)
ans += max(idx - j - 1, 0)
print(ans)
| false | 0 | [
"+from bisect import bisect_left",
"+",
"-from bisect import bisect_left",
"-",
"- ab = l[i] + l[j]",
"- idx = bisect_left(l, ab)",
"+ t = l[i] + l[j]",
"+ idx = bisect_left(l, t)"
] | false | 0.045053 | 0.087255 | 0.516334 | [
"s039426918",
"s617239700"
] |
u761062383 | p02678 | python | s893652737 | s805456192 | 1,223 | 641 | 36,540 | 34,688 | Accepted | Accepted | 47.59 | def resolve():
N, M = [int(i) for i in input().split()]
path = [[] for _ in range(N)]
for _ in range(M):
A, B = [int(i) for i in input().split()]
path[A - 1].append(B - 1)
path[B - 1].append(A - 1)
visited = [-1] * N
que = [0]
visited[0] = 0
while que:
... | def resolve():
N, M = [int(i) for i in input().split()]
AB = [[] for _ in range(N + 1)]
AB[0] = [1]
for _ in range(M):
A, B = [int(i) for i in input().split()]
AB[A].append(B)
AB[B].append(A)
from collections import deque
dq = deque([1])
ans = [-1] * (N + 1)... | 28 | 28 | 652 | 681 | def resolve():
N, M = [int(i) for i in input().split()]
path = [[] for _ in range(N)]
for _ in range(M):
A, B = [int(i) for i in input().split()]
path[A - 1].append(B - 1)
path[B - 1].append(A - 1)
visited = [-1] * N
que = [0]
visited[0] = 0
while que:
v = que... | def resolve():
N, M = [int(i) for i in input().split()]
AB = [[] for _ in range(N + 1)]
AB[0] = [1]
for _ in range(M):
A, B = [int(i) for i in input().split()]
AB[A].append(B)
AB[B].append(A)
from collections import deque
dq = deque([1])
ans = [-1] * (N + 1)
whil... | false | 0 | [
"- path = [[] for _ in range(N)]",
"+ AB = [[] for _ in range(N + 1)]",
"+ AB[0] = [1]",
"- path[A - 1].append(B - 1)",
"- path[B - 1].append(A - 1)",
"- visited = [-1] * N",
"- que = [0]",
"- visited[0] = 0",
"- while que:",
"- v = que.pop(0)",
"- ... | false | 0.03648 | 0.07413 | 0.492115 | [
"s893652737",
"s805456192"
] |
u812576525 | p02755 | python | s449561811 | s769686403 | 91 | 21 | 3,060 | 3,060 | Accepted | Accepted | 76.92 | import math
A, B = list(map(int,input().split()))
cnt = 0
for i in range(1,100000):
X = math.floor(i * 0.08)
Y = math.floor(i * 0.1)
if A == X and B == Y:
print(i)
cnt += 1
break
if cnt == 0:
print((-1)) | A,B = list(map(int,input().split()))
import math
ans = -1
for i in range(10000):
if math.floor(i*0.08) == A and math.floor(i*0.1) == B:
ans=i
break
print(ans) | 15 | 9 | 266 | 187 | import math
A, B = list(map(int, input().split()))
cnt = 0
for i in range(1, 100000):
X = math.floor(i * 0.08)
Y = math.floor(i * 0.1)
if A == X and B == Y:
print(i)
cnt += 1
break
if cnt == 0:
print((-1))
| A, B = list(map(int, input().split()))
import math
ans = -1
for i in range(10000):
if math.floor(i * 0.08) == A and math.floor(i * 0.1) == B:
ans = i
break
print(ans)
| false | 40 | [
"+A, B = list(map(int, input().split()))",
"-A, B = list(map(int, input().split()))",
"-cnt = 0",
"-for i in range(1, 100000):",
"- X = math.floor(i * 0.08)",
"- Y = math.floor(i * 0.1)",
"- if A == X and B == Y:",
"- print(i)",
"- cnt += 1",
"+ans = -1",
"+for i in range(... | false | 0.111755 | 0.03843 | 2.908035 | [
"s449561811",
"s769686403"
] |
u761320129 | p03141 | python | s756868639 | s098138721 | 440 | 402 | 21,384 | 21,364 | Accepted | Accepted | 8.64 | N = int(eval(input()))
src = [tuple(map(int,input().split())) for i in range(N)]
src.sort(key=lambda x:sum(x))
a = b = 0
for i,(x,y) in enumerate(reversed(src)):
if i%2:
b += y
else:
a += x
print((a-b)) | N = int(eval(input()))
AB = [tuple(map(int,input().split())) for i in range(N)]
AB.sort(key=lambda x:x[1]+x[0])
ans = 0
for i,(a,b) in enumerate(AB[::-1]):
if i%2:
ans -= b
else:
ans += a
print(ans) | 11 | 11 | 229 | 227 | N = int(eval(input()))
src = [tuple(map(int, input().split())) for i in range(N)]
src.sort(key=lambda x: sum(x))
a = b = 0
for i, (x, y) in enumerate(reversed(src)):
if i % 2:
b += y
else:
a += x
print((a - b))
| N = int(eval(input()))
AB = [tuple(map(int, input().split())) for i in range(N)]
AB.sort(key=lambda x: x[1] + x[0])
ans = 0
for i, (a, b) in enumerate(AB[::-1]):
if i % 2:
ans -= b
else:
ans += a
print(ans)
| false | 0 | [
"-src = [tuple(map(int, input().split())) for i in range(N)]",
"-src.sort(key=lambda x: sum(x))",
"-a = b = 0",
"-for i, (x, y) in enumerate(reversed(src)):",
"+AB = [tuple(map(int, input().split())) for i in range(N)]",
"+AB.sort(key=lambda x: x[1] + x[0])",
"+ans = 0",
"+for i, (a, b) in enumerate(A... | false | 0.038038 | 0.044276 | 0.8591 | [
"s756868639",
"s098138721"
] |
u800258529 | p04013 | python | s363623194 | s339269087 | 160 | 49 | 4,580 | 3,064 | Accepted | Accepted | 69.38 | n,a=list(map(int,input().split()))
x=list([int(x)-a for x in input().split()])
m=0 if min(x)>0 else min(x)*n
M=1 if max(x)<0 else max(x)*n+1
dp=[[0]*(M-m) for _ in range(n)]
dp[0][x[0]]+=1
dp[0][0]+=1
for i in range(n-1):
for j in range(m,M):
if j+x[i+1] in range(m,M):dp[i+1][j+x[i+1]]+=dp[i][j]
... | n,a=list(map(int,input().split()))
x=list([int(x)-a for x in input().split()])
m=min(0,min(x)*n)
M=max(0,max(x)*n)
dp=[1]+[0]*(M-m)
dp[x[0]]+=1
for i in range(n-1):
l=list(range(m-x[i+1],M+1)) if x[i+1]<0 else list(range(M-x[i+1],m-1,-1))
for j in l:dp[j+x[i+1]]+=dp[j]
print((dp[0]-1)) | 12 | 10 | 365 | 286 | n, a = list(map(int, input().split()))
x = list([int(x) - a for x in input().split()])
m = 0 if min(x) > 0 else min(x) * n
M = 1 if max(x) < 0 else max(x) * n + 1
dp = [[0] * (M - m) for _ in range(n)]
dp[0][x[0]] += 1
dp[0][0] += 1
for i in range(n - 1):
for j in range(m, M):
if j + x[i + 1] in range(m, M)... | n, a = list(map(int, input().split()))
x = list([int(x) - a for x in input().split()])
m = min(0, min(x) * n)
M = max(0, max(x) * n)
dp = [1] + [0] * (M - m)
dp[x[0]] += 1
for i in range(n - 1):
l = (
list(range(m - x[i + 1], M + 1))
if x[i + 1] < 0
else list(range(M - x[i + 1], m - 1, -1))
... | false | 16.666667 | [
"-m = 0 if min(x) > 0 else min(x) * n",
"-M = 1 if max(x) < 0 else max(x) * n + 1",
"-dp = [[0] * (M - m) for _ in range(n)]",
"-dp[0][x[0]] += 1",
"-dp[0][0] += 1",
"+m = min(0, min(x) * n)",
"+M = max(0, max(x) * n)",
"+dp = [1] + [0] * (M - m)",
"+dp[x[0]] += 1",
"- for j in range(m, M):",
... | false | 0.038265 | 0.040496 | 0.944916 | [
"s363623194",
"s339269087"
] |
u708255304 | p02844 | python | s678078886 | s232302952 | 1,738 | 1,281 | 3,064 | 3,064 | Accepted | Accepted | 26.29 | N = int(eval(input()))
S = eval(input())
single_flag = [False]*10
dual_flag = {}
ans = {}
for i in range(10):
for j in range(10):
dual_flag[(i, j)] = False
ans[(i, j)] = set()
for s in S:
for i in range(10):
for j in range(10):
if dual_flag[i, j]:
... | N = int(eval(input()))
S = eval(input())
single_flag = [False]*10
dual_flag = {}
ans = {}
for i in range(10):
for j in range(10):
dual_flag[(i, j)] = False
ans[(i, j)] = set()
for s in S:
for i in range(10):
for j in range(10):
if dual_flag[i, j]:
... | 25 | 25 | 531 | 526 | N = int(eval(input()))
S = eval(input())
single_flag = [False] * 10
dual_flag = {}
ans = {}
for i in range(10):
for j in range(10):
dual_flag[(i, j)] = False
ans[(i, j)] = set()
for s in S:
for i in range(10):
for j in range(10):
if dual_flag[i, j]:
ans[(i, j)... | N = int(eval(input()))
S = eval(input())
single_flag = [False] * 10
dual_flag = {}
ans = {}
for i in range(10):
for j in range(10):
dual_flag[(i, j)] = False
ans[(i, j)] = set()
for s in S:
for i in range(10):
for j in range(10):
if dual_flag[i, j]:
ans[(i, j)... | false | 0 | [
"- ans[(i, j)].add(int(s))",
"+ ans[(i, j)].add(s)"
] | false | 0.043442 | 0.045521 | 0.954328 | [
"s678078886",
"s232302952"
] |
u780342333 | p02386 | python | s136231522 | s504080258 | 400 | 340 | 7,824 | 7,824 | Accepted | Accepted | 15 | class Dice:
def __init__(self):
self.faces=[]
def rotate(self, direction):
tmp = self.faces.copy()
if direction =="N":
self.faces[5-1] = tmp[1-1]
self.faces[1-1] = tmp[2-1]
self.faces[2-1] = tmp[6-1]
self.faces[6-1] = tmp[5-1]
... | class Dice:
def __init__(self):
self.faces=[]
def rotate(self, direction):
tmp = self.faces.copy()
if direction =="N":
self.faces[5-1] = tmp[1-1]
self.faces[1-1] = tmp[2-1]
self.faces[2-1] = tmp[6-1]
self.faces[6-1] = tmp[5-1]
... | 58 | 56 | 1,757 | 1,734 | class Dice:
def __init__(self):
self.faces = []
def rotate(self, direction):
tmp = self.faces.copy()
if direction == "N":
self.faces[5 - 1] = tmp[1 - 1]
self.faces[1 - 1] = tmp[2 - 1]
self.faces[2 - 1] = tmp[6 - 1]
self.faces[6 - 1] = tmp[... | class Dice:
def __init__(self):
self.faces = []
def rotate(self, direction):
tmp = self.faces.copy()
if direction == "N":
self.faces[5 - 1] = tmp[1 - 1]
self.faces[1 - 1] = tmp[2 - 1]
self.faces[2 - 1] = tmp[6 - 1]
self.faces[6 - 1] = tmp[... | false | 3.448276 | [
"-res = \"Yes\"",
"-# set up side",
"- res = \"No\"",
"- break",
"+ print(\"No\")",
"+ exit()",
"-print(res)",
"+print(\"Yes\")"
] | false | 0.046828 | 0.039345 | 1.190182 | [
"s136231522",
"s504080258"
] |
u564902833 | p02945 | python | s411746360 | s585516940 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | A, B = list(map(int, input().split()))
ans = max(A + B, A - B, A * B)
print(ans)
| A, B = list(map(int, input().split()))
x = A+B
y =A-B
z =A*B
if x > y:
if x>z:
ans = x
else:
ans = z
else:
if y>z:
ans = y
else:
ans = z
print(ans)
| 5 | 18 | 81 | 186 | A, B = list(map(int, input().split()))
ans = max(A + B, A - B, A * B)
print(ans)
| A, B = list(map(int, input().split()))
x = A + B
y = A - B
z = A * B
if x > y:
if x > z:
ans = x
else:
ans = z
else:
if y > z:
ans = y
else:
ans = z
print(ans)
| false | 72.222222 | [
"-ans = max(A + B, A - B, A * B)",
"+x = A + B",
"+y = A - B",
"+z = A * B",
"+if x > y:",
"+ if x > z:",
"+ ans = x",
"+ else:",
"+ ans = z",
"+else:",
"+ if y > z:",
"+ ans = y",
"+ else:",
"+ ans = z"
] | false | 0.040694 | 0.039547 | 1.028987 | [
"s411746360",
"s585516940"
] |
u312025627 | p03162 | python | s054754174 | s528286632 | 675 | 243 | 85,208 | 104,948 | Accepted | Accepted | 64 | def main():
N = int(eval(input()))
A = [0]
B = [0]
C = [0]
for i in range(N):
a, b, c = (int(i) for i in input().split())
A.append(a)
B.append(b)
C.append(c)
dp = [[0 for _ in range(N+1)] for _ in range(3)]
dp[0][1] = A[1]
dp[1][1] = B[1]
... | def main():
N = int(eval(input()))
ABC = [[int(i) for i in input().split()] for j in range(N)]
dp = [[0]*3 for _ in range(N+1)]
for i in range(N):
for j in range(3):
dp[i+1][j] = max(dp[i][(j+1) % 3], dp[i][(j+2) % 3]) + ABC[i][j]
print((max(dp[N])))
if __name__ =... | 25 | 14 | 646 | 338 | def main():
N = int(eval(input()))
A = [0]
B = [0]
C = [0]
for i in range(N):
a, b, c = (int(i) for i in input().split())
A.append(a)
B.append(b)
C.append(c)
dp = [[0 for _ in range(N + 1)] for _ in range(3)]
dp[0][1] = A[1]
dp[1][1] = B[1]
dp[2][1] = ... | def main():
N = int(eval(input()))
ABC = [[int(i) for i in input().split()] for j in range(N)]
dp = [[0] * 3 for _ in range(N + 1)]
for i in range(N):
for j in range(3):
dp[i + 1][j] = max(dp[i][(j + 1) % 3], dp[i][(j + 2) % 3]) + ABC[i][j]
print((max(dp[N])))
if __name__ == "_... | false | 44 | [
"- A = [0]",
"- B = [0]",
"- C = [0]",
"+ ABC = [[int(i) for i in input().split()] for j in range(N)]",
"+ dp = [[0] * 3 for _ in range(N + 1)]",
"- a, b, c = (int(i) for i in input().split())",
"- A.append(a)",
"- B.append(b)",
"- C.append(c)",
"- dp ... | false | 0.076296 | 0.053882 | 1.415975 | [
"s054754174",
"s528286632"
] |
u057964173 | p03807 | python | s048795815 | s209009469 | 54 | 43 | 14,108 | 14,104 | Accepted | Accepted | 20.37 | def resolve():
n=int(eval(input()))
l=list(map(int, input().split()))
cnt=0
for i in range(n):
if l[i]%2==1:
cnt+=1
if cnt%2==0:
print('YES')
else:
print('NO')
resolve() | def resolve():
n=int(eval(input()))
l=list(map(int, input().split()))
if sum(l)%2==0:
print('YES')
else:
print('NO')
resolve() | 12 | 8 | 234 | 159 | def resolve():
n = int(eval(input()))
l = list(map(int, input().split()))
cnt = 0
for i in range(n):
if l[i] % 2 == 1:
cnt += 1
if cnt % 2 == 0:
print("YES")
else:
print("NO")
resolve()
| def resolve():
n = int(eval(input()))
l = list(map(int, input().split()))
if sum(l) % 2 == 0:
print("YES")
else:
print("NO")
resolve()
| false | 33.333333 | [
"- cnt = 0",
"- for i in range(n):",
"- if l[i] % 2 == 1:",
"- cnt += 1",
"- if cnt % 2 == 0:",
"+ if sum(l) % 2 == 0:"
] | false | 0.039381 | 0.041516 | 0.948562 | [
"s048795815",
"s209009469"
] |
u796942881 | p03208 | python | s023531731 | s429307914 | 236 | 118 | 7,384 | 14,092 | Accepted | Accepted | 50 | INF = 1000000007
N, K = list(map(int, input().split()))
h = [int(eval(input())) for i in range(N)]
h.sort()
ans = INF
for i in range(N - K + 1):
ans = min(ans, h[i + K - 1] - h[i])
print(ans)
| INF = 1000000007
N, K, *h = list(map(int, open(0).read().split()))
h.sort()
ans = INF
for i in range(N - K + 1):
ans = min(ans, h[i + K - 1] - h[i])
print(ans)
| 13 | 12 | 201 | 174 | INF = 1000000007
N, K = list(map(int, input().split()))
h = [int(eval(input())) for i in range(N)]
h.sort()
ans = INF
for i in range(N - K + 1):
ans = min(ans, h[i + K - 1] - h[i])
print(ans)
| INF = 1000000007
N, K, *h = list(map(int, open(0).read().split()))
h.sort()
ans = INF
for i in range(N - K + 1):
ans = min(ans, h[i + K - 1] - h[i])
print(ans)
| false | 7.692308 | [
"-N, K = list(map(int, input().split()))",
"-h = [int(eval(input())) for i in range(N)]",
"+N, K, *h = list(map(int, open(0).read().split()))"
] | false | 0.054304 | 0.068429 | 0.79359 | [
"s023531731",
"s429307914"
] |
u281303342 | p03330 | python | s158003293 | s922690458 | 1,964 | 189 | 7,696 | 5,620 | Accepted | Accepted | 90.38 | N,C = list(map(int,input().split()))
D = []
for i in range(C):
d = list(map(int,input().split()))
D.append(d)
A = []
for i in range(N):
a = list(map(int,input().split()))
A.append(a)
X0,X1,X2 = [],[],[]
for i in range(N):
for j in range(N):
if (i+j)%3 == 0:
X0.appe... | # Python3 (3.4.3)
import sys
input = sys.stdin.readline
# -------------------------------------------------------------
# function
# -------------------------------------------------------------
# -------------------------------------------------------------
# main
# --------------------------------------... | 42 | 44 | 957 | 1,260 | N, C = list(map(int, input().split()))
D = []
for i in range(C):
d = list(map(int, input().split()))
D.append(d)
A = []
for i in range(N):
a = list(map(int, input().split()))
A.append(a)
X0, X1, X2 = [], [], []
for i in range(N):
for j in range(N):
if (i + j) % 3 == 0:
X0.append(... | # Python3 (3.4.3)
import sys
input = sys.stdin.readline
# -------------------------------------------------------------
# function
# -------------------------------------------------------------
# -------------------------------------------------------------
# main
# ---------------------------------------------------... | false | 4.545455 | [
"-N, C = list(map(int, input().split()))",
"-D = []",
"-for i in range(C):",
"- d = list(map(int, input().split()))",
"- D.append(d)",
"-A = []",
"-for i in range(N):",
"- a = list(map(int, input().split()))",
"- A.append(a)",
"-X0, X1, X2 = [], [], []",
"+# Python3 (3.4.3)",
"+imp... | false | 0.037433 | 0.040137 | 0.932638 | [
"s158003293",
"s922690458"
] |
u504277357 | p03161 | python | s929958135 | s626123788 | 1,921 | 364 | 23,052 | 54,112 | Accepted | Accepted | 81.05 | import sys
import numpy as np
# inputを高速化する。
input = sys.stdin.readline
n, k = list(map(int, input().split()))
h = [int(i) for i in input().split()]
# dpの配列を作る。
dp = np.zeros(n, dtype=int)
# hの配列を作る。
h = np.array(h)
for i in range(1, n):
# start は負になることはない。
start = max(0, i-k)
# 行列として足し算できるのでfo... | import sys
N,K=list(map(int,input().split()))
h=list(map(int,input().split()))+[0]*100000
dp=[sys.maxsize]*(N+K+10)
dp[1]=0
for i in range(1,N):
for k in range(1,K+1):
dp[i+k]=min(dp[i+k],dp[i]+abs(h[i+k-1]-h[i-1]))
print((dp[N])) | 16 | 13 | 400 | 264 | import sys
import numpy as np
# inputを高速化する。
input = sys.stdin.readline
n, k = list(map(int, input().split()))
h = [int(i) for i in input().split()]
# dpの配列を作る。
dp = np.zeros(n, dtype=int)
# hの配列を作る。
h = np.array(h)
for i in range(1, n):
# start は負になることはない。
start = max(0, i - k)
# 行列として足し算できるのでforを使う必要がない。... | import sys
N, K = list(map(int, input().split()))
h = list(map(int, input().split())) + [0] * 100000
dp = [sys.maxsize] * (N + K + 10)
dp[1] = 0
for i in range(1, N):
for k in range(1, K + 1):
dp[i + k] = min(dp[i + k], dp[i] + abs(h[i + k - 1] - h[i - 1]))
print((dp[N]))
| false | 18.75 | [
"-import numpy as np",
"-# inputを高速化する。",
"-input = sys.stdin.readline",
"-n, k = list(map(int, input().split()))",
"-h = [int(i) for i in input().split()]",
"-# dpの配列を作る。",
"-dp = np.zeros(n, dtype=int)",
"-# hの配列を作る。",
"-h = np.array(h)",
"-for i in range(1, n):",
"- # start は負になることはない。",
... | false | 1.357321 | 0.094338 | 14.387903 | [
"s929958135",
"s626123788"
] |
u287500079 | p03212 | python | s677469083 | s436342376 | 278 | 190 | 60,140 | 38,384 | Accepted | Accepted | 31.65 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | def STR(): return eval(input())
def func(a, b):
if a > b:
return 0
else:
return 1
def solve_dp(arr, ii):
dp = [[0, 0] for _ in range(ii)]
lenarr = len(arr)
n0 = int(n[0])
a = lenarr
for j in range(lenarr):
a -= func(n0, arr[j])
dp[0][0] = a
d... | 66 | 39 | 1,922 | 924 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | def STR():
return eval(input())
def func(a, b):
if a > b:
return 0
else:
return 1
def solve_dp(arr, ii):
dp = [[0, 0] for _ in range(ii)]
lenarr = len(arr)
n0 = int(n[0])
a = lenarr
for j in range(lenarr):
a -= func(n0, arr[j])
dp[0][0] = a
dp[0][1] = ... | false | 40.909091 | [
"-import sys, re, os",
"-from collections import deque, defaultdict, Counter",
"-from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians",
"-from itertools import permutations, combinations, product, accumulate",
"-from operator import itemgetter, mul",
"-from copy import deepcopy",
"-from ... | false | 0.071596 | 0.036317 | 1.971432 | [
"s677469083",
"s436342376"
] |
u374103100 | p03242 | python | s378922744 | s951690685 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | ans = [ "9" if s == "1" else "1" for s in list(eval(input()))]
print(("".join(ans))) | print(("".join([ "9" if s == "1" else "1" for s in list(eval(input()))]))) | 2 | 1 | 77 | 66 | ans = ["9" if s == "1" else "1" for s in list(eval(input()))]
print(("".join(ans)))
| print(("".join(["9" if s == "1" else "1" for s in list(eval(input()))])))
| false | 50 | [
"-ans = [\"9\" if s == \"1\" else \"1\" for s in list(eval(input()))]",
"-print((\"\".join(ans)))",
"+print((\"\".join([\"9\" if s == \"1\" else \"1\" for s in list(eval(input()))])))"
] | false | 0.037109 | 0.037013 | 1.002606 | [
"s378922744",
"s951690685"
] |
u562935282 | p03112 | python | s780272149 | s749626586 | 1,992 | 705 | 78,584 | 12,816 | Accepted | Accepted | 64.61 | from bisect import bisect_left
inf = (10 ** 10) * 2 + 10
a, b, q = list(map(int, input().split()))
s = [-inf]
for _ in range(a):
s.append(int(eval(input())))
s.append(inf)
s.sort()
t = [-inf]
for _ in range(b):
t.append(int(eval(input())))
t.append(inf)
t.sort()
for _ in range(q):
x ... | def main():
from bisect import bisect_left
import sys
input = sys.stdin.readline
inf = (10 ** 10) * 2 + 10
a, b, q = list(map(int, input().split()))
s = [-inf] + [int(eval(input())) for _ in range(a)] + [inf]
# s.sort()
t = [-inf] + [int(eval(input())) for _ in range(b)] ... | 29 | 30 | 552 | 685 | from bisect import bisect_left
inf = (10**10) * 2 + 10
a, b, q = list(map(int, input().split()))
s = [-inf]
for _ in range(a):
s.append(int(eval(input())))
s.append(inf)
s.sort()
t = [-inf]
for _ in range(b):
t.append(int(eval(input())))
t.append(inf)
t.sort()
for _ in range(q):
x = int(eval(input()))
... | def main():
from bisect import bisect_left
import sys
input = sys.stdin.readline
inf = (10**10) * 2 + 10
a, b, q = list(map(int, input().split()))
s = [-inf] + [int(eval(input())) for _ in range(a)] + [inf]
# s.sort()
t = [-inf] + [int(eval(input())) for _ in range(b)] + [inf]
# t.s... | false | 3.333333 | [
"-from bisect import bisect_left",
"+def main():",
"+ from bisect import bisect_left",
"+ import sys",
"-inf = (10**10) * 2 + 10",
"-a, b, q = list(map(int, input().split()))",
"-s = [-inf]",
"-for _ in range(a):",
"- s.append(int(eval(input())))",
"-s.append(inf)",
"-s.sort()",
"-t =... | false | 0.037936 | 0.052694 | 0.719941 | [
"s780272149",
"s749626586"
] |
u935984175 | p03044 | python | s705835422 | s835617631 | 876 | 478 | 87,284 | 81,056 | Accepted | Accepted | 45.43 | import sys
sys.setrecursionlimit(10**7)
N = int(eval(input()))
edges = [[] for _ in range(N+1)]
for _ in range(N-1):
u, v, w = list(map(int, input().split()))
edges[u].append([v, w])
edges[v].append([u, w])
ans = [-1 for _ in range(N)]
def dfs(edge, pd):
for child, d in edges[edge]:
... | import sys
from collections import deque
rl = sys.stdin.readline
def solve():
N = int(rl())
graph = [[] for _ in range(N)]
for _ in range(N - 1):
u, v, w = list(map(int, rl().split()))
u -= 1
v -= 1
graph[u].append([v, w])
graph[v].append([u, w])
... | 32 | 35 | 628 | 791 | import sys
sys.setrecursionlimit(10**7)
N = int(eval(input()))
edges = [[] for _ in range(N + 1)]
for _ in range(N - 1):
u, v, w = list(map(int, input().split()))
edges[u].append([v, w])
edges[v].append([u, w])
ans = [-1 for _ in range(N)]
def dfs(edge, pd):
for child, d in edges[edge]:
if an... | import sys
from collections import deque
rl = sys.stdin.readline
def solve():
N = int(rl())
graph = [[] for _ in range(N)]
for _ in range(N - 1):
u, v, w = list(map(int, rl().split()))
u -= 1
v -= 1
graph[u].append([v, w])
graph[v].append([u, w])
ans = [-1] * N... | false | 8.571429 | [
"+from collections import deque",
"-sys.setrecursionlimit(10**7)",
"-N = int(eval(input()))",
"-edges = [[] for _ in range(N + 1)]",
"-for _ in range(N - 1):",
"- u, v, w = list(map(int, input().split()))",
"- edges[u].append([v, w])",
"- edges[v].append([u, w])",
"-ans = [-1 for _ in range... | false | 0.03463 | 0.035298 | 0.981088 | [
"s705835422",
"s835617631"
] |
u767664985 | p03495 | python | s998176560 | s150890659 | 247 | 216 | 37,788 | 37,784 | Accepted | Accepted | 12.55 | from collections import Counter
N, K = list(map(int, input().split()))
A = Counter(list(map(int, input().split()))).most_common()
l = len(A)
ans = 0
while l > K:
ans += A[-1][1]
del A[-1]
l = len(A)
print(ans)
| from collections import Counter
N, K = list(map(int, input().split()))
A = Counter(list(map(int, input().split()))).most_common()
ans = 0
while len(A) > K:
ans += A[-1][1]
del A[-1]
print(ans)
| 10 | 8 | 216 | 196 | from collections import Counter
N, K = list(map(int, input().split()))
A = Counter(list(map(int, input().split()))).most_common()
l = len(A)
ans = 0
while l > K:
ans += A[-1][1]
del A[-1]
l = len(A)
print(ans)
| from collections import Counter
N, K = list(map(int, input().split()))
A = Counter(list(map(int, input().split()))).most_common()
ans = 0
while len(A) > K:
ans += A[-1][1]
del A[-1]
print(ans)
| false | 20 | [
"-l = len(A)",
"-while l > K:",
"+while len(A) > K:",
"- l = len(A)"
] | false | 0.043903 | 0.043881 | 1.00051 | [
"s998176560",
"s150890659"
] |
u263830634 | p03311 | python | s228419203 | s385126713 | 262 | 208 | 25,200 | 25,744 | Accepted | Accepted | 20.61 | #平均値に近づけるという考え方が間違い-->中央値に近づける
N = int(eval(input()))
A = list(map(int, input().split()))
A = [A[i]-(i+1) for i in range(N)]
A.sort()
center1 = A[N//2]
if N == 1:
center2 = 10 ** 9
else:
center2 = A[(N+2)//2]
ans1 = 0
for i in range(N):
ans1 +=abs(A[i]-center1)
ans2 = 0
for j i... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7
N = int(eval(input()))
A_ = list(map(int, input().split()))
A = [A_[i] - i - 1 for i in range(N)]
A.sort()
tmp = A[N // 2]
ans = 0
for a in A:
ans += abs(tmp - a)
print (ans) | 24 | 19 | 387 | 283 | # 平均値に近づけるという考え方が間違い-->中央値に近づける
N = int(eval(input()))
A = list(map(int, input().split()))
A = [A[i] - (i + 1) for i in range(N)]
A.sort()
center1 = A[N // 2]
if N == 1:
center2 = 10**9
else:
center2 = A[(N + 2) // 2]
ans1 = 0
for i in range(N):
ans1 += abs(A[i] - center1)
ans2 = 0
for j in range(N):
an... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)
MOD = 10**9 + 7
N = int(eval(input()))
A_ = list(map(int, input().split()))
A = [A_[i] - i - 1 for i in range(N)]
A.sort()
tmp = A[N // 2]
ans = 0
for a in A:
ans += abs(tmp - a)
print(ans)
| false | 20.833333 | [
"-# 平均値に近づけるという考え方が間違い-->中央値に近づける",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+sys.setrecursionlimit(10**9)",
"+MOD = 10**9 + 7",
"-A = list(map(int, input().split()))",
"-A = [A[i] - (i + 1) for i in range(N)]",
"+A_ = list(map(int, input().split()))",
"+A = [A_[i] - i - 1 for i in rang... | false | 0.039973 | 0.040251 | 0.99311 | [
"s228419203",
"s385126713"
] |
u254871849 | p03722 | python | s359855299 | s155609414 | 1,680 | 1,205 | 3,700 | 3,444 | Accepted | Accepted | 28.27 | import sys
INF = 10 ** 15
n, m = list(map(int, sys.stdin.readline().split()))
abc = list(map(int, sys.stdin.read().split()))
abc = list(zip(*[abc] * 3))
def main():
dist = [INF] * n
dist[0] = 0
for _ in range(n - 1):
for a, b, c in abc:
a -= 1; b -= 1; c = -c
... | import sys
inf = float('inf')
n, m = list(map(int, sys.stdin.readline().split()))
a = []
b = []
c = []
for _ in range(m):
ai, bi, ci = list(map(int, sys.stdin.readline().split()))
a.append(ai - 1)
b.append(bi - 1)
c.append(-ci)
abc = list(zip(a, b, c))
def main():
dist = [inf] * n... | 35 | 36 | 773 | 702 | import sys
INF = 10**15
n, m = list(map(int, sys.stdin.readline().split()))
abc = list(map(int, sys.stdin.read().split()))
abc = list(zip(*[abc] * 3))
def main():
dist = [INF] * n
dist[0] = 0
for _ in range(n - 1):
for a, b, c in abc:
a -= 1
b -= 1
c = -c
... | import sys
inf = float("inf")
n, m = list(map(int, sys.stdin.readline().split()))
a = []
b = []
c = []
for _ in range(m):
ai, bi, ci = list(map(int, sys.stdin.readline().split()))
a.append(ai - 1)
b.append(bi - 1)
c.append(-ci)
abc = list(zip(a, b, c))
def main():
dist = [inf] * n
dist[0] = 0... | false | 2.777778 | [
"-INF = 10**15",
"+inf = float(\"inf\")",
"-abc = list(map(int, sys.stdin.read().split()))",
"-abc = list(zip(*[abc] * 3))",
"+a = []",
"+b = []",
"+c = []",
"+for _ in range(m):",
"+ ai, bi, ci = list(map(int, sys.stdin.readline().split()))",
"+ a.append(ai - 1)",
"+ b.append(bi - 1)",... | false | 0.036091 | 0.064661 | 0.558163 | [
"s359855299",
"s155609414"
] |
u997641430 | p02971 | python | s258320352 | s199614172 | 782 | 634 | 15,628 | 15,660 | Accepted | Accepted | 18.93 | N = int(eval(input()))
A = []
for n in range(N):
A.append(int(eval(input())))
B = [0 for n in range(N)]
B[0] = A[0]
for n in range(N-1):
B[n+1] = max(B[n], A[n + 1])
C = [0 for n in range(N)]
C[-1] = A[-1]
for n in range(N - 1):
C[-n-2] = max(C[-n-1], A[-n - 2])
for n in range(N):
if n == 0... | n = int(eval(input()))
A = [int(eval(input())) for i in range(n)]
l = 0
L = [l]
for a in A:
l = max(l, a)
L.append(l)
r = 0
R = [r]
for a in A[::-1]:
r = max(r, a)
R.append(r)
R.reverse()
for i in range(n):
print((max(L[i], R[i+1])))
| 19 | 18 | 425 | 260 | N = int(eval(input()))
A = []
for n in range(N):
A.append(int(eval(input())))
B = [0 for n in range(N)]
B[0] = A[0]
for n in range(N - 1):
B[n + 1] = max(B[n], A[n + 1])
C = [0 for n in range(N)]
C[-1] = A[-1]
for n in range(N - 1):
C[-n - 2] = max(C[-n - 1], A[-n - 2])
for n in range(N):
if n == 0:
... | n = int(eval(input()))
A = [int(eval(input())) for i in range(n)]
l = 0
L = [l]
for a in A:
l = max(l, a)
L.append(l)
r = 0
R = [r]
for a in A[::-1]:
r = max(r, a)
R.append(r)
R.reverse()
for i in range(n):
print((max(L[i], R[i + 1])))
| false | 5.263158 | [
"-N = int(eval(input()))",
"-A = []",
"-for n in range(N):",
"- A.append(int(eval(input())))",
"-B = [0 for n in range(N)]",
"-B[0] = A[0]",
"-for n in range(N - 1):",
"- B[n + 1] = max(B[n], A[n + 1])",
"-C = [0 for n in range(N)]",
"-C[-1] = A[-1]",
"-for n in range(N - 1):",
"- C[-... | false | 0.068527 | 0.049981 | 1.371077 | [
"s258320352",
"s199614172"
] |
u941407962 | p02803 | python | s871464147 | s038320354 | 467 | 269 | 21,732 | 21,868 | Accepted | Accepted | 42.4 | H, W = list(map(int, input().split()))
s="#"*W+"".join("#"+eval(input()) for _ in range(H))
f=(W+1)*(H+1)
d=[[0]*f for _ in range(f)]
for i in range(W,f-1):
d[i][i-1]=s[i]==s[i-1]=="."
d[i][i-W-1]=s[i]==s[i-W-1]=="."
from scipy.sparse.csgraph import csgraph_from_dense as C,floyd_warshall as F
Q=F(C(d),directe... | H,W=list(map(int,input().split()))
s="#"*W+"".join("#"+eval(input())for _ in range(H))
f=-~W*-~H
d=[[0]*f for _ in range(f)]
for i in range(W,f-1):
d[i][i-1]=s[i]==s[i-1]=="."
d[i][i-W-1]=s[i]==s[i-W-1]=="."
from scipy.sparse.csgraph import csgraph_from_dense as C,floyd_warshall as F
import numpy as p
Q=F(C(... | 15 | 11 | 390 | 356 | H, W = list(map(int, input().split()))
s = "#" * W + "".join("#" + eval(input()) for _ in range(H))
f = (W + 1) * (H + 1)
d = [[0] * f for _ in range(f)]
for i in range(W, f - 1):
d[i][i - 1] = s[i] == s[i - 1] == "."
d[i][i - W - 1] = s[i] == s[i - W - 1] == "."
from scipy.sparse.csgraph import csgraph_from_de... | H, W = list(map(int, input().split()))
s = "#" * W + "".join("#" + eval(input()) for _ in range(H))
f = -~W * -~H
d = [[0] * f for _ in range(f)]
for i in range(W, f - 1):
d[i][i - 1] = s[i] == s[i - 1] == "."
d[i][i - W - 1] = s[i] == s[i - W - 1] == "."
from scipy.sparse.csgraph import csgraph_from_dense as C... | false | 26.666667 | [
"-f = (W + 1) * (H + 1)",
"+f = -~W * -~H",
"+import numpy as p",
"-r = -1",
"-for q in Q:",
"- for x in q:",
"- if f > x:",
"- r = max(r, int(x))",
"-print(r)",
"+print((int(max(Q[Q != p.inf]))))"
] | false | 0.314802 | 0.193797 | 1.624389 | [
"s871464147",
"s038320354"
] |
u651803486 | p02953 | python | s285370746 | s312427569 | 116 | 87 | 14,396 | 15,020 | Accepted | Accepted | 25 | N = int(eval(input()))
H = list(map(int, input().split()))
for i in range(N-1):
if H[i] > H[i+1]:
H[i] -= 1
elif H[i] == H[i+1]:
if H[i]-1 >= H[i-1]:
H[i] -= 1
for i in range(N-1):
if H[i] > H[i+1]:
print('No')
exit()
print('Yes')
| N = int(eval(input()))
H = list(map(int, input().split()))
H[0] -= 1
for i in range(1, N):
if H[i-1] <= H[i] - 1:
H[i] -= 1
if not H[i-1] <= H[i]:
print('No')
exit()
print('Yes') | 16 | 14 | 299 | 225 | N = int(eval(input()))
H = list(map(int, input().split()))
for i in range(N - 1):
if H[i] > H[i + 1]:
H[i] -= 1
elif H[i] == H[i + 1]:
if H[i] - 1 >= H[i - 1]:
H[i] -= 1
for i in range(N - 1):
if H[i] > H[i + 1]:
print("No")
exit()
print("Yes")
| N = int(eval(input()))
H = list(map(int, input().split()))
H[0] -= 1
for i in range(1, N):
if H[i - 1] <= H[i] - 1:
H[i] -= 1
if not H[i - 1] <= H[i]:
print("No")
exit()
print("Yes")
| false | 12.5 | [
"-for i in range(N - 1):",
"- if H[i] > H[i + 1]:",
"+H[0] -= 1",
"+for i in range(1, N):",
"+ if H[i - 1] <= H[i] - 1:",
"- elif H[i] == H[i + 1]:",
"- if H[i] - 1 >= H[i - 1]:",
"- H[i] -= 1",
"-for i in range(N - 1):",
"- if H[i] > H[i + 1]:",
"+ if not H[i - ... | false | 0.036154 | 0.036745 | 0.983917 | [
"s285370746",
"s312427569"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.