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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u777283665 | p02820 | python | s720875493 | s687119677 | 80 | 66 | 15,392 | 3,956 | Accepted | Accepted | 17.5 | n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = eval(input())
ans = 0
d = dict()
for i in range(n):
if t[i] == "r" and d.get(i) != "r":
ans += p
d[i+k] = "r"
elif t[i] == "s" and d.get(i) != "s":
ans += r
d[i+k] = "s"
elif t[... | n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
d = {"r": p, "s": r, "p": s}
t = eval(input())
ans = 0
prev = ["#" for _ in range(k)]
for i, move in enumerate(t):
if prev[i%k] != move:
ans += d[move]
prev[i%k] = move
else:
prev[i%k] = "#"
pr... | 18 | 15 | 386 | 320 | n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = eval(input())
ans = 0
d = dict()
for i in range(n):
if t[i] == "r" and d.get(i) != "r":
ans += p
d[i + k] = "r"
elif t[i] == "s" and d.get(i) != "s":
ans += r
d[i + k] = "s"
elif t[i] == "p" ... | n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
d = {"r": p, "s": r, "p": s}
t = eval(input())
ans = 0
prev = ["#" for _ in range(k)]
for i, move in enumerate(t):
if prev[i % k] != move:
ans += d[move]
prev[i % k] = move
else:
prev[i % k] = "#"
print(ans)... | false | 16.666667 | [
"+d = {\"r\": p, \"s\": r, \"p\": s}",
"-d = dict()",
"-for i in range(n):",
"- if t[i] == \"r\" and d.get(i) != \"r\":",
"- ans += p",
"- d[i + k] = \"r\"",
"- elif t[i] == \"s\" and d.get(i) != \"s\":",
"- ans += r",
"- d[i + k] = \"s\"",
"- elif t[i] == \"p\... | false | 0.039435 | 0.04137 | 0.953219 | [
"s720875493",
"s687119677"
] |
u976225138 | p03495 | python | s100392693 | s972220644 | 134 | 101 | 36,708 | 36,588 | Accepted | Accepted | 24.63 | from collections import Counter, deque
_, k = list(map(int, input().split()))
a = [int(i) for i in input().split()]
ans = 0
d = deque(sorted(Counter(a).values()))
while k < len(d):
ans += d.popleft()
else:
print(ans) | from collections import Counter as C
_, k = list(map(int, input().split()))
a = [int(i) for i in input().split()]
c = list(C(a).values())
d = len(c) - k
if 0 < d:
print((sum(sorted(c)[:d])))
else:
print((0)) | 11 | 11 | 230 | 211 | from collections import Counter, deque
_, k = list(map(int, input().split()))
a = [int(i) for i in input().split()]
ans = 0
d = deque(sorted(Counter(a).values()))
while k < len(d):
ans += d.popleft()
else:
print(ans)
| from collections import Counter as C
_, k = list(map(int, input().split()))
a = [int(i) for i in input().split()]
c = list(C(a).values())
d = len(c) - k
if 0 < d:
print((sum(sorted(c)[:d])))
else:
print((0))
| false | 0 | [
"-from collections import Counter, deque",
"+from collections import Counter as C",
"-ans = 0",
"-d = deque(sorted(Counter(a).values()))",
"-while k < len(d):",
"- ans += d.popleft()",
"+c = list(C(a).values())",
"+d = len(c) - k",
"+if 0 < d:",
"+ print((sum(sorted(c)[:d])))",
"- print... | false | 0.044857 | 0.042809 | 1.047837 | [
"s100392693",
"s972220644"
] |
u761529120 | p03608 | python | s544093964 | s725886447 | 501 | 274 | 66,904 | 70,828 | Accepted | Accepted | 45.31 | from itertools import permutations
def main():
N, M, R = list(map(int, input().split()))
r = list(map(int, input().split()))
d = [[float('inf')] * N for _ in range(N)]
for _ in range(M):
A, B, C = list(map(int, input().split()))
A -= 1
B -= 1
d[A][B] = C
... | from itertools import permutations
def main():
N: int
M: int
R: int
A: int
B: int
C: int
ans: int
INF: int
INF = 10 ** 10
N, M, R = list(map(int, input().split()))
r: list = list([x - 1 for x in list(map(int, input().split()))])
dist :list = [[float('in... | 34 | 41 | 732 | 1,011 | from itertools import permutations
def main():
N, M, R = list(map(int, input().split()))
r = list(map(int, input().split()))
d = [[float("inf")] * N for _ in range(N)]
for _ in range(M):
A, B, C = list(map(int, input().split()))
A -= 1
B -= 1
d[A][B] = C
d[B][A]... | from itertools import permutations
def main():
N: int
M: int
R: int
A: int
B: int
C: int
ans: int
INF: int
INF = 10**10
N, M, R = list(map(int, input().split()))
r: list = list([x - 1 for x in list(map(int, input().split()))])
dist: list = [[float("inf")] * N for _ in r... | false | 17.073171 | [
"+ N: int",
"+ M: int",
"+ R: int",
"+ A: int",
"+ B: int",
"+ C: int",
"+ ans: int",
"+ INF: int",
"+ INF = 10**10",
"- r = list(map(int, input().split()))",
"- d = [[float(\"inf\")] * N for _ in range(N)]",
"+ r: list = list([x - 1 for x in list(map(int, i... | false | 0.04571 | 0.044053 | 1.03761 | [
"s544093964",
"s725886447"
] |
u296518383 | p02861 | python | s651930509 | s541286728 | 213 | 18 | 40,940 | 3,188 | Accepted | Accepted | 91.55 | import itertools
N=int(eval(input()))
x=[0]*N
y=[0]*N
for i in range(N):
x[i],y[i]=list(map(int,input().split()))
l=[i for i in range(N)]
dis=0
cnt=0
for v in itertools.permutations(l):
#print(v)
cnt+=1
for i in range(1,N):
dis+=((x[v[i]]-x[v[i-1]])**2+(y[v[i]]-y[v[i-1]])**2)**0.5
print(... | import sys
input = sys.stdin.buffer.readline
N = int(eval(input()))
XY = [list(map(int, input().split())) for _ in range(N)]
def dist(xy1, xy2):
x1, y1 = xy1
x2, y2 = xy2
return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5
tmp = 0
for i in range(N):
for j in range(i + 1, N):
tmp += dist(XY[i], ... | 18 | 17 | 316 | 344 | import itertools
N = int(eval(input()))
x = [0] * N
y = [0] * N
for i in range(N):
x[i], y[i] = list(map(int, input().split()))
l = [i for i in range(N)]
dis = 0
cnt = 0
for v in itertools.permutations(l):
# print(v)
cnt += 1
for i in range(1, N):
dis += ((x[v[i]] - x[v[i - 1]]) ** 2 + (y[v[i]]... | import sys
input = sys.stdin.buffer.readline
N = int(eval(input()))
XY = [list(map(int, input().split())) for _ in range(N)]
def dist(xy1, xy2):
x1, y1 = xy1
x2, y2 = xy2
return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5
tmp = 0
for i in range(N):
for j in range(i + 1, N):
tmp += dist(XY[i], ... | false | 5.555556 | [
"-import itertools",
"+import sys",
"+input = sys.stdin.buffer.readline",
"-x = [0] * N",
"-y = [0] * N",
"+XY = [list(map(int, input().split())) for _ in range(N)]",
"+",
"+",
"+def dist(xy1, xy2):",
"+ x1, y1 = xy1",
"+ x2, y2 = xy2",
"+ return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0... | false | 0.038642 | 0.036173 | 1.068229 | [
"s651930509",
"s541286728"
] |
u254871849 | p02819 | python | s786645324 | s384406176 | 1,593 | 1,110 | 426,528 | 56,112 | Accepted | Accepted | 30.32 | import sys
import numpy as np
def sieve_of_eratosthenes(n=5 * 10 ** 7):
sieve = np.ones(n + 1); sieve[:2] = 0
for i in range(2, int(np.sqrt(n)) + 1):
if sieve[i]: sieve[i*2::i] = 0
return sieve, np.flatnonzero(sieve)
is_prime, prime_numbers = sieve_of_eratosthenes()
def prime_factorize(n):
re... | import sys
from bisect import bisect_left as bi_l
def sieve_of_eratosthenes(n=5 * 10 ** 6):
sieve = [1] * (n + 1); sieve[0] = sieve[1] = 0
for i in range(2, int(n ** 0.5) + 1):
if not sieve[i]: continue
for j in range(i * 2, n + 1, i): sieve[j] = 0
prime_numbers = [i for i in range(2, n + 1) if s... | 36 | 38 | 900 | 1,001 | import sys
import numpy as np
def sieve_of_eratosthenes(n=5 * 10**7):
sieve = np.ones(n + 1)
sieve[:2] = 0
for i in range(2, int(np.sqrt(n)) + 1):
if sieve[i]:
sieve[i * 2 :: i] = 0
return sieve, np.flatnonzero(sieve)
is_prime, prime_numbers = sieve_of_eratosthenes()
def prime_... | import sys
from bisect import bisect_left as bi_l
def sieve_of_eratosthenes(n=5 * 10**6):
sieve = [1] * (n + 1)
sieve[0] = sieve[1] = 0
for i in range(2, int(n**0.5) + 1):
if not sieve[i]:
continue
for j in range(i * 2, n + 1, i):
sieve[j] = 0
prime_numbers = [i... | false | 5.263158 | [
"-import numpy as np",
"+from bisect import bisect_left as bi_l",
"-def sieve_of_eratosthenes(n=5 * 10**7):",
"- sieve = np.ones(n + 1)",
"- sieve[:2] = 0",
"- for i in range(2, int(np.sqrt(n)) + 1):",
"- if sieve[i]:",
"- sieve[i * 2 :: i] = 0",
"- return sieve, np.fla... | false | 0.26524 | 2.27556 | 0.11656 | [
"s786645324",
"s384406176"
] |
u235376569 | p02642 | python | s324192995 | s612636784 | 1,127 | 1,025 | 34,940 | 32,136 | Accepted | Accepted | 9.05 | import sys
n=int(eval(input()))
a=[int(x) for x in input().rstrip().split()]
a.sort()
max_val=max(a)
dp=[True for i in range(max_val)]
done=[0 for i in range(max_val)]
cnt=0
ans=0
for i in a:
if 1<=done[i-1]:
done[i-1]+=1
continue
done[i-1]+=1
cnt=1
while(i*cnt<=max_val):
cnt... | import sys
n=int(eval(input()))
a=[int(x) for x in input().rstrip().split()]
a.sort()
max_val=max(a)
done=[0 for i in range(max_val)]
cnt=0
ans=0
for i in a:
if 1<=done[i-1]:
done[i-1]+=1
continue
done[i-1]+=1
cnt=1
while(i*cnt<=max_val):
cnt+=1
if cnt*i<=max_val:
... | 29 | 29 | 428 | 395 | import sys
n = int(eval(input()))
a = [int(x) for x in input().rstrip().split()]
a.sort()
max_val = max(a)
dp = [True for i in range(max_val)]
done = [0 for i in range(max_val)]
cnt = 0
ans = 0
for i in a:
if 1 <= done[i - 1]:
done[i - 1] += 1
continue
done[i - 1] += 1
cnt = 1
while i *... | import sys
n = int(eval(input()))
a = [int(x) for x in input().rstrip().split()]
a.sort()
max_val = max(a)
done = [0 for i in range(max_val)]
cnt = 0
ans = 0
for i in a:
if 1 <= done[i - 1]:
done[i - 1] += 1
continue
done[i - 1] += 1
cnt = 1
while i * cnt <= max_val:
cnt += 1
... | false | 0 | [
"-dp = [True for i in range(max_val)]"
] | false | 0.037768 | 0.035334 | 1.068905 | [
"s324192995",
"s612636784"
] |
u424768586 | p02632 | python | s359834300 | s452190541 | 1,178 | 1,031 | 122,592 | 122,628 | Accepted | Accepted | 12.48 | import sys
sys.setrecursionlimit(10**7) #ๅๅธฐ้ขๆฐใฎไธ้,10**5ไปฅไธใฎๅ ดๅpython
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2ๅๆข็ดข
#bisect_left(l,x), bisect(l,x)#aใฏใฝใผใๆธใฟใงใใๅฟ
่ฆใใใaใฎไธญใใxๆชๆบใฎ่ฆ็ด ๆฐใ่ฟใใrightใ ใจไปฅไธ
from co... | import sys
sys.setrecursionlimit(10**7) #ๅๅธฐ้ขๆฐใฎไธ้,10**5ไปฅไธใฎๅ ดๅpython
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2ๅๆข็ดข
#bisect_left(l,x), bisect(l,x)#aใฏใฝใผใๆธใฟใงใใๅฟ
่ฆใใใaใฎไธญใใxๆชๆบใฎ่ฆ็ด ๆฐใ่ฟใใrightใ ใจไปฅไธ
from co... | 81 | 86 | 2,675 | 2,894 | import sys
sys.setrecursionlimit(10**7) # ๅๅธฐ้ขๆฐใฎไธ้,10**5ไปฅไธใฎๅ ดๅpython
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right # 2ๅๆข็ดข
# bisect_left(l,x), bisect(l,x)#aใฏใฝใผใๆธใฟใงใใๅฟ
่ฆใใใaใฎไธญใใxๆชๆบใฎ่ฆ็ด ๆฐใ่ฟใใrightใ ใจไปฅไธ
from co... | import sys
sys.setrecursionlimit(10**7) # ๅๅธฐ้ขๆฐใฎไธ้,10**5ไปฅไธใฎๅ ดๅpython
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right # 2ๅๆข็ดข
# bisect_left(l,x), bisect(l,x)#aใฏใฝใผใๆธใฟใงใใๅฟ
่ฆใใใaใฎไธญใใxๆชๆบใฎ่ฆ็ด ๆฐใ่ฟใใrightใ ใจไปฅไธ
from co... | false | 5.813953 | [
"+",
"+ def extgcd1(a0, b0): # ่จ็ฎ้log(b0),ใใงใซใใผใฎๅฐๅฎ็ใใๆฉใ",
"+ u, v, a, b = 1, 0, a0, b0",
"+ while b:",
"+ t = a // b",
"+ a -= t * b",
"+ a, b = b, a",
"+ u, v = v, u - t * v",
"+ if a != 1:",
"+ return -1 # ไบใใซ็ด ใใใชใ"... | false | 0.226078 | 0.19299 | 1.17145 | [
"s359834300",
"s452190541"
] |
u541055501 | p02586 | python | s304209779 | s942681998 | 2,889 | 1,884 | 431,016 | 428,600 | Accepted | Accepted | 34.79 | f,g,h=range,max,input
R,C,K=list(map(int,h().split()))
G=[[0]*-~C for i in f(R+1)]
for i in'_'*K:r,c,v=list(map(int,h().split()));G[r][c]=v
F=[[[0]*-~C for i in f(R+1)]for i in f(4)]
for r in f(1,R+1):
for x in f(1,4):
for c in f(1,C+1):F[x][r][c]=g(F[x-1][r][c],F[x-1][r][c-1]+G[r][c],F[x][r][c-1],(x<2)*(G[r]... | f,g,h=range,max,input
R,C,K=list(map(int,h().split()))
G=[[0]*-~C for i in f(R+1)]
for i in'_'*K:r,c,v=list(map(int,h().split()));G[r][c]=v
F=[[[0]*-~C for i in f(R+1)]for i in f(4)]
for r in f(1,R+1):
for x in f(1,4):
for c in f(1,C+1):F[x][r][c]=g(F[x-1][r][c],F[x-1][r][c-1]+G[r][c],F[x][r][c-1],(x<2)*(G[r]... | 9 | 9 | 374 | 345 | f, g, h = range, max, input
R, C, K = list(map(int, h().split()))
G = [[0] * -~C for i in f(R + 1)]
for i in "_" * K:
r, c, v = list(map(int, h().split()))
G[r][c] = v
F = [[[0] * -~C for i in f(R + 1)] for i in f(4)]
for r in f(1, R + 1):
for x in f(1, 4):
for c in f(1, C + 1):
F[x][r][... | f, g, h = range, max, input
R, C, K = list(map(int, h().split()))
G = [[0] * -~C for i in f(R + 1)]
for i in "_" * K:
r, c, v = list(map(int, h().split()))
G[r][c] = v
F = [[[0] * -~C for i in f(R + 1)] for i in f(4)]
for r in f(1, R + 1):
for x in f(1, 4):
for c in f(1, C + 1):
F[x][r][... | false | 0 | [
"- (x < 2) * (G[r][c] + g(F[1][r - 1][c], F[2][r - 1][c], F[3][r - 1][c])),",
"+ (x < 2) * (G[r][c] + F[3][r - 1][c]),"
] | false | 0.103447 | 0.042796 | 2.417205 | [
"s304209779",
"s942681998"
] |
u074220993 | p03946 | python | s618791407 | s369675870 | 79 | 72 | 19,888 | 20,028 | Accepted | Accepted | 8.86 | N, T = list(map(int, input().split()))
A = [int(x) for x in input().split()]
buy = A[0]
max_profit = 0
ans = 1
for i in range(1,N):
if A[i] > buy:
if A[i] - buy > max_profit:
max_profit = A[i] - buy
ans = 1
elif A[i] - buy == max_profit:
ans += 1
e... | N, T = list(map(int, input().split()))
A = [int(x) for x in input().split()]
cost, buy, mprofit = 1, 10e9, 0
for a in A:
if a < buy:
buy = a
else:
profit = a - buy
if profit == mprofit:
cost += 1
if profit > mprofit:
mprofit = profit
... | 15 | 14 | 351 | 337 | N, T = list(map(int, input().split()))
A = [int(x) for x in input().split()]
buy = A[0]
max_profit = 0
ans = 1
for i in range(1, N):
if A[i] > buy:
if A[i] - buy > max_profit:
max_profit = A[i] - buy
ans = 1
elif A[i] - buy == max_profit:
ans += 1
else:
... | N, T = list(map(int, input().split()))
A = [int(x) for x in input().split()]
cost, buy, mprofit = 1, 10e9, 0
for a in A:
if a < buy:
buy = a
else:
profit = a - buy
if profit == mprofit:
cost += 1
if profit > mprofit:
mprofit = profit
cost = 1
p... | false | 6.666667 | [
"-buy = A[0]",
"-max_profit = 0",
"-ans = 1",
"-for i in range(1, N):",
"- if A[i] > buy:",
"- if A[i] - buy > max_profit:",
"- max_profit = A[i] - buy",
"- ans = 1",
"- elif A[i] - buy == max_profit:",
"- ans += 1",
"+cost, buy, mprofit = 1, 10e... | false | 0.04099 | 0.042336 | 0.968198 | [
"s618791407",
"s369675870"
] |
u226108478 | p03945 | python | s384534130 | s718674791 | 50 | 45 | 3,188 | 3,188 | Accepted | Accepted | 10 | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
if __name__ == '__main__':
s = eval(input())
count = 0
previous = s[0]
for i in range(1, len(s)):
current = s[i]
if previous != current:
count += 1
previous = current
print(coun... | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
if __name__ == '__main__':
s = eval(input())
count = 0
# See:
# https://beta.atcoder.jp/contests/abc047/submissions/1007244
for i in range(len(s) - 1):
if s[i] != s[i + 1]:
count += 1
print(coun... | 19 | 16 | 317 | 317 | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
if __name__ == "__main__":
s = eval(input())
count = 0
previous = s[0]
for i in range(1, len(s)):
current = s[i]
if previous != current:
count += 1
previous = current
print(count)
| # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
if __name__ == "__main__":
s = eval(input())
count = 0
# See:
# https://beta.atcoder.jp/contests/abc047/submissions/1007244
for i in range(len(s) - 1):
if s[i] != s[i + 1]:
count += 1
print(count)
| false | 15.789474 | [
"- previous = s[0]",
"- for i in range(1, len(s)):",
"- current = s[i]",
"- if previous != current:",
"+ # See:",
"+ # https://beta.atcoder.jp/contests/abc047/submissions/1007244",
"+ for i in range(len(s) - 1):",
"+ if s[i] != s[i + 1]:",
"- previous = cur... | false | 0.044109 | 0.037008 | 1.191899 | [
"s384534130",
"s718674791"
] |
u762420987 | p03775 | python | s827651490 | s683647624 | 31 | 28 | 3,060 | 3,060 | Accepted | Accepted | 9.68 | from math import sqrt
N = int(eval(input()))
root_N = int(sqrt(N)) + 1
def F(a, b):
return max(len(str(a)), len(str(b)))
min_F = 10**6
for a in range(1, root_N + 1):
if N % a == 0:
b = N // a
min_F = min(min_F, F(a, b))
print(min_F)
| def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
divisors.sort()
return divisors
def F(a, b):
return max(len(str(a)), len(str(b)))
N =... | 15 | 21 | 269 | 455 | from math import sqrt
N = int(eval(input()))
root_N = int(sqrt(N)) + 1
def F(a, b):
return max(len(str(a)), len(str(b)))
min_F = 10**6
for a in range(1, root_N + 1):
if N % a == 0:
b = N // a
min_F = min(min_F, F(a, b))
print(min_F)
| def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
divisors.sort()
return divisors
def F(a, b):
return max(len(str(a)), len(str(b)))
N = int(eval(input()... | false | 28.571429 | [
"-from math import sqrt",
"-",
"-N = int(eval(input()))",
"-root_N = int(sqrt(N)) + 1",
"+def make_divisors(n):",
"+ divisors = []",
"+ for i in range(1, int(n**0.5) + 1):",
"+ if n % i == 0:",
"+ divisors.append(i)",
"+ if i != n // i:",
"+ divi... | false | 0.056561 | 0.008592 | 6.583125 | [
"s827651490",
"s683647624"
] |
u818349438 | p04025 | python | s856982441 | s099633978 | 26 | 24 | 2,940 | 2,940 | Accepted | Accepted | 7.69 | n = int(eval(input()))
a = list(map(int,input().split()))
ans = 10**9
for x in range(-100,101):
res = 0
for i in range(n):
res += (a[i] - x)**2
ans = min(ans,res)
print(ans)
| n = int(eval(input()))
a = list(map(int,input().split()))
ans = 10**9
for x in range(-100,101):
res = 0
for y in a:
res += (x-y)**2
ans = min(ans,res)
print(ans)
| 10 | 11 | 205 | 195 | n = int(eval(input()))
a = list(map(int, input().split()))
ans = 10**9
for x in range(-100, 101):
res = 0
for i in range(n):
res += (a[i] - x) ** 2
ans = min(ans, res)
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split()))
ans = 10**9
for x in range(-100, 101):
res = 0
for y in a:
res += (x - y) ** 2
ans = min(ans, res)
print(ans)
| false | 9.090909 | [
"- for i in range(n):",
"- res += (a[i] - x) ** 2",
"+ for y in a:",
"+ res += (x - y) ** 2"
] | false | 0.049587 | 0.095502 | 0.519223 | [
"s856982441",
"s099633978"
] |
u197615397 | p02363 | python | s814653324 | s705311742 | 790 | 190 | 8,496 | 6,224 | Accepted | Accepted | 75.95 | import sys
readline = sys.stdin.readline
V, E = list(map(int, readline().split()))
inf = float("inf")
vertices = [[inf if i!=j else 0 for j in range(V)] for i in range(V)]
for _ in [None]*E:
s, t, d = list(map(int, readline().split()))
vertices[s][t] = d
for k in range(V):
for i in range(V):
... | import sys
def warshall_floyd(v_count, matrix):
for i in range(v_count):
for j in range(v_count):
c2 = matrix[j][i]
for k, (c1, c3) in enumerate(zip(matrix[j], matrix[i])):
if c1 > c2+c3:
matrix[j][k] = c2+c3
return matrix
def ha... | 25 | 29 | 682 | 812 | import sys
readline = sys.stdin.readline
V, E = list(map(int, readline().split()))
inf = float("inf")
vertices = [[inf if i != j else 0 for j in range(V)] for i in range(V)]
for _ in [None] * E:
s, t, d = list(map(int, readline().split()))
vertices[s][t] = d
for k in range(V):
for i in range(V):
fo... | import sys
def warshall_floyd(v_count, matrix):
for i in range(v_count):
for j in range(v_count):
c2 = matrix[j][i]
for k, (c1, c3) in enumerate(zip(matrix[j], matrix[i])):
if c1 > c2 + c3:
matrix[j][k] = c2 + c3
return matrix
def has_negat... | false | 13.793103 | [
"-readline = sys.stdin.readline",
"-V, E = list(map(int, readline().split()))",
"+",
"+def warshall_floyd(v_count, matrix):",
"+ for i in range(v_count):",
"+ for j in range(v_count):",
"+ c2 = matrix[j][i]",
"+ for k, (c1, c3) in enumerate(zip(matrix[j], matrix[i])):",... | false | 0.037574 | 0.036604 | 1.026517 | [
"s814653324",
"s705311742"
] |
u864013199 | p03330 | python | s721789269 | s849922829 | 1,623 | 1,057 | 17,620 | 17,868 | Accepted | Accepted | 34.87 | import numpy as np
import itertools
import sys
input = sys.stdin.readline #ๆๅญๅๅ
ฅๅใงใฏๆณจๆ๏ผ
N,C = list(map(int,input().split()))
D = np.array([list(map(int,input().split()))for _ in range(C)], dtype=np.int64)
c = np.array([list(map(int,input().split()))for _ in range(N)], dtype=np.int64)
c0 = np.zeros(C,dtype=np.in... | #ไปไบบใฎใๅ่ใซๆ็ดใ
import numpy as np
import itertools
import sys
input = sys.stdin.readline #ๆๅญๅๅ
ฅๅใงใฏๆณจๆ๏ผ
N,C = list(map(int,input().split()))
D = np.array([list(map(int,input().split()))for _ in range(C)], dtype=np.int64)
c = np.array([list(map(int,input().split()))for _ in range(N)], dtype=np.int64)
c0 = np.zeros(... | 26 | 32 | 800 | 944 | import numpy as np
import itertools
import sys
input = sys.stdin.readline # ๆๅญๅๅ
ฅๅใงใฏๆณจๆ๏ผ
N, C = list(map(int, input().split()))
D = np.array([list(map(int, input().split())) for _ in range(C)], dtype=np.int64)
c = np.array([list(map(int, input().split())) for _ in range(N)], dtype=np.int64)
c0 = np.zeros(C, dtype=np.in... | # ไปไบบใฎใๅ่ใซๆ็ดใ
import numpy as np
import itertools
import sys
input = sys.stdin.readline # ๆๅญๅๅ
ฅๅใงใฏๆณจๆ๏ผ
N, C = list(map(int, input().split()))
D = np.array([list(map(int, input().split())) for _ in range(C)], dtype=np.int64)
c = np.array([list(map(int, input().split())) for _ in range(N)], dtype=np.int64)
c0 = np.zeros(C... | false | 18.75 | [
"+# ไปไบบใฎใๅ่ใซๆ็ดใ",
"+r = np.arange(C) # ๅ
ใซnp.sumใใฆใใ",
"+s0 = np.sum(D[:, r] * c0[:, None], axis=0)",
"+s1 = np.sum(D[:, r] * c1[:, None], axis=0)",
"+s2 = np.sum(D[:, r] * c2[:, None], axis=0)",
"- tmp = np.sum(D[:, l0] * c0 + D[:, l1] * c1 + D[:, l2] * c2)",
"+ tmp = s0[l0] + s1[l1] + s2[l2]"
] | false | 0.216295 | 0.247926 | 0.872419 | [
"s721789269",
"s849922829"
] |
u309120194 | p03494 | python | s882662753 | s989626766 | 30 | 25 | 9,184 | 9,176 | Accepted | Accepted | 16.67 | N = int(eval(input()))
A = list(map(int, input().split()))
count = 0
flag = False
while True:
n = 0
for n in range(N):
if A[n] % 2 == 0: A[n] //= 2
else:
flag = True
break
if flag: break
count += 1
print(count) | N = int(eval(input()))
A = list(map(int, input().split()))
count = 0
flag = False
while True:
for n in range(N):
if A[n] % 2 != 0:
flag = True
break
if flag: break
for n in range(N):
A[n] //= 2
count += 1
print(count) | 16 | 17 | 250 | 261 | N = int(eval(input()))
A = list(map(int, input().split()))
count = 0
flag = False
while True:
n = 0
for n in range(N):
if A[n] % 2 == 0:
A[n] //= 2
else:
flag = True
break
if flag:
break
count += 1
print(count)
| N = int(eval(input()))
A = list(map(int, input().split()))
count = 0
flag = False
while True:
for n in range(N):
if A[n] % 2 != 0:
flag = True
break
if flag:
break
for n in range(N):
A[n] //= 2
count += 1
print(count)
| false | 5.882353 | [
"- n = 0",
"- if A[n] % 2 == 0:",
"- A[n] //= 2",
"- else:",
"+ if A[n] % 2 != 0:",
"+ for n in range(N):",
"+ A[n] //= 2"
] | false | 0.042516 | 0.056903 | 0.747165 | [
"s882662753",
"s989626766"
] |
u077291787 | p03613 | python | s581482509 | s210853293 | 66 | 61 | 13,964 | 13,964 | Accepted | Accepted | 7.58 | # ARC082C - Together (ABC072C)
n = int(eval(input()))
lst = list(map(int, input().rstrip().split()))
ans = [0] * 100001
for i in lst:
ans[i] += 1
print((max(list(map(sum, list(zip(ans, ans[1:], ans[2:]))))))) | # ARC082C - Together (ABC072C)
def main():
n = int(eval(input()))
lst = list(map(int, input().rstrip().split()))
ans = [0] * 100001
for i in lst:
ans[i] += 1
print((max(list(map(sum, list(zip(ans, ans[1:], ans[2:])))))))
if __name__ == "__main__":
main() | 7 | 12 | 198 | 279 | # ARC082C - Together (ABC072C)
n = int(eval(input()))
lst = list(map(int, input().rstrip().split()))
ans = [0] * 100001
for i in lst:
ans[i] += 1
print((max(list(map(sum, list(zip(ans, ans[1:], ans[2:])))))))
| # ARC082C - Together (ABC072C)
def main():
n = int(eval(input()))
lst = list(map(int, input().rstrip().split()))
ans = [0] * 100001
for i in lst:
ans[i] += 1
print((max(list(map(sum, list(zip(ans, ans[1:], ans[2:])))))))
if __name__ == "__main__":
main()
| false | 41.666667 | [
"-n = int(eval(input()))",
"-lst = list(map(int, input().rstrip().split()))",
"-ans = [0] * 100001",
"-for i in lst:",
"- ans[i] += 1",
"-print((max(list(map(sum, list(zip(ans, ans[1:], ans[2:])))))))",
"+def main():",
"+ n = int(eval(input()))",
"+ lst = list(map(int, input().rstrip().spli... | false | 0.073223 | 0.070017 | 1.045796 | [
"s581482509",
"s210853293"
] |
u001024152 | p03805 | python | s723409527 | s022438907 | 34 | 24 | 3,064 | 3,064 | Accepted | Accepted | 29.41 | n, m = list(map(int, input().split()))
e = [set([]) for _ in range(n+1)] # e[0] never used
for _ in range(m):
a, b = list(map(int, input().split()))
e[a].add(b)
e[b].add(a)
ans = 0
visited = [False]*(n+1) # visited[0] never used
visited[0] = True
def dfs(v):
# current pos is v
global vi... | from itertools import permutations
N, M = list(map(int, input().split()))
INF = 10**18
matrix = [[INF]*N for _ in range(N)]
for _ in range(M):
a, b = [int(x)-1 for x in input().split()]
matrix[a][b] = 1
matrix[b][a] = 1
ans = 0
for p in permutations(list(range(1, N))):
ok = True
c... | 27 | 25 | 619 | 479 | n, m = list(map(int, input().split()))
e = [set([]) for _ in range(n + 1)] # e[0] never used
for _ in range(m):
a, b = list(map(int, input().split()))
e[a].add(b)
e[b].add(a)
ans = 0
visited = [False] * (n + 1) # visited[0] never used
visited[0] = True
def dfs(v):
# current pos is v
global visit... | from itertools import permutations
N, M = list(map(int, input().split()))
INF = 10**18
matrix = [[INF] * N for _ in range(N)]
for _ in range(M):
a, b = [int(x) - 1 for x in input().split()]
matrix[a][b] = 1
matrix[b][a] = 1
ans = 0
for p in permutations(list(range(1, N))):
ok = True
cur = 0
for... | false | 7.407407 | [
"-n, m = list(map(int, input().split()))",
"-e = [set([]) for _ in range(n + 1)] # e[0] never used",
"-for _ in range(m):",
"- a, b = list(map(int, input().split()))",
"- e[a].add(b)",
"- e[b].add(a)",
"+from itertools import permutations",
"+",
"+N, M = list(map(int, input().split()))",
... | false | 0.03601 | 0.039218 | 0.918209 | [
"s723409527",
"s022438907"
] |
u052332717 | p03964 | python | s641061760 | s638145064 | 24 | 22 | 3,188 | 3,188 | Accepted | Accepted | 8.33 | n = int(eval(input()))
Ratio = [list(map(int,input().split())) for _ in range(n)]
t,a = 1,1
for i in range(n):
x = max((t+Ratio[i][0]-1)//Ratio[i][0],(a+Ratio[i][1]-1)//Ratio[i][1])
t,a = Ratio[i][0]*x,Ratio[i][1]*x
print((int(t+a))) | n = int(eval(input()))
Ratio = [list(map(int,input().split())) for _ in range(n)]
t,a = Ratio[0][0],Ratio[0][1]
for i in range(1,n):
x = max((t+Ratio[i][0]-1)//Ratio[i][0],(a+Ratio[i][1]-1)//Ratio[i][1])
t,a = Ratio[i][0]*x,Ratio[i][1]*x
print((int(t+a))) | 8 | 8 | 241 | 263 | n = int(eval(input()))
Ratio = [list(map(int, input().split())) for _ in range(n)]
t, a = 1, 1
for i in range(n):
x = max((t + Ratio[i][0] - 1) // Ratio[i][0], (a + Ratio[i][1] - 1) // Ratio[i][1])
t, a = Ratio[i][0] * x, Ratio[i][1] * x
print((int(t + a)))
| n = int(eval(input()))
Ratio = [list(map(int, input().split())) for _ in range(n)]
t, a = Ratio[0][0], Ratio[0][1]
for i in range(1, n):
x = max((t + Ratio[i][0] - 1) // Ratio[i][0], (a + Ratio[i][1] - 1) // Ratio[i][1])
t, a = Ratio[i][0] * x, Ratio[i][1] * x
print((int(t + a)))
| false | 0 | [
"-t, a = 1, 1",
"-for i in range(n):",
"+t, a = Ratio[0][0], Ratio[0][1]",
"+for i in range(1, n):"
] | false | 0.037303 | 0.036263 | 1.028677 | [
"s641061760",
"s638145064"
] |
u813098295 | p03634 | python | s131563745 | s303230326 | 1,651 | 908 | 54,060 | 144,636 | Accepted | Accepted | 45 | import queue
from sys import stdin
input = stdin.readline
N = int(input())
tree = [[] for _ in range(N)]
for i in range(N-1):
a, b, c = list(map(int, input().split()))
a -= 1; b -= 1;
tree[a].append((b, c))
tree[b].append((a, c))
Q, K = list(map(int, input().split()))
K -= 1
d = [f... | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(200000)
N = int(input())
tree = [[] for _ in range(N)]
for i in range(N-1):
a, b, c = list(map(int, input().split()))
a -= 1; b -= 1;
tree[a].append((b, c))
tree[b].append((a, c))
Q, K = list(map(int, in... | 40 | 34 | 813 | 645 | import queue
from sys import stdin
input = stdin.readline
N = int(input())
tree = [[] for _ in range(N)]
for i in range(N - 1):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
tree[a].append((b, c))
tree[b].append((a, c))
Q, K = list(map(int, input().split()))
K -= 1
d = [float("inf") for _... | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(200000)
N = int(input())
tree = [[] for _ in range(N)]
for i in range(N - 1):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
tree[a].append((b, c))
tree[b].append((a, c))
Q, K = list(map(int, input().split()))
... | false | 15 | [
"-import queue",
"-from sys import stdin",
"+#!/usr/bin/env python2",
"+# -*- coding: utf-8 -*-",
"+import sys",
"-input = stdin.readline",
"+sys.setrecursionlimit(200000)",
"-d = [float(\"inf\") for _ in range(N)]",
"+depth = [0 for _ in range(N)]",
"-def dijkstra(s):",
"- que = queue.Priori... | false | 0.120063 | 0.083071 | 1.445302 | [
"s131563745",
"s303230326"
] |
u952708174 | p02987 | python | s275283091 | s310900402 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | from collections import Counter
S = eval(input())
input_counter = Counter(S)
if len(input_counter) == 2:
for v in list(input_counter.values()):
if v != 2:
print('No')
exit()
else:
print('Yes')
else:
print('No') | S = eval(input())
for s in S:
if S.count(s) != 2:
print('No')
exit()
print('Yes') | 13 | 6 | 263 | 90 | from collections import Counter
S = eval(input())
input_counter = Counter(S)
if len(input_counter) == 2:
for v in list(input_counter.values()):
if v != 2:
print("No")
exit()
else:
print("Yes")
else:
print("No")
| S = eval(input())
for s in S:
if S.count(s) != 2:
print("No")
exit()
print("Yes")
| false | 53.846154 | [
"-from collections import Counter",
"-",
"-input_counter = Counter(S)",
"-if len(input_counter) == 2:",
"- for v in list(input_counter.values()):",
"- if v != 2:",
"- print(\"No\")",
"- exit()",
"- else:",
"- print(\"Yes\")",
"-else:",
"- print(\"No... | false | 0.062846 | 0.047005 | 1.336984 | [
"s275283091",
"s310900402"
] |
u945181840 | p03548 | python | s949852906 | s990336161 | 31 | 17 | 2,940 | 3,060 | Accepted | Accepted | 45.16 | x, y, z = list(map(int, input().split()))
ans = 1
for i in range(x // y):
ans += 1
if y * ans + z * (ans + 1) > x:
print((ans - 1))
exit() | x, y, z = list(map(int, input().split()))
ans = 1
q = x // (y + z)
r = x % (y + z)
if r < z:
print((q - 1))
else:
print(q) | 8 | 10 | 162 | 133 | x, y, z = list(map(int, input().split()))
ans = 1
for i in range(x // y):
ans += 1
if y * ans + z * (ans + 1) > x:
print((ans - 1))
exit()
| x, y, z = list(map(int, input().split()))
ans = 1
q = x // (y + z)
r = x % (y + z)
if r < z:
print((q - 1))
else:
print(q)
| false | 20 | [
"-for i in range(x // y):",
"- ans += 1",
"- if y * ans + z * (ans + 1) > x:",
"- print((ans - 1))",
"- exit()",
"+q = x // (y + z)",
"+r = x % (y + z)",
"+if r < z:",
"+ print((q - 1))",
"+else:",
"+ print(q)"
] | false | 0.075458 | 0.098069 | 0.769434 | [
"s949852906",
"s990336161"
] |
u796942881 | p03637 | python | s738046734 | s006272159 | 70 | 54 | 11,100 | 11,100 | Accepted | Accepted | 22.86 | N = int(eval(input()))
an = list(map(int, input().split()))
def main():
ar = [0] * 3
for ai in an:
if ai % 4 == 0:
ar[2] += 1
elif ai % 2 == 0:
ar[1] += 1
else:
ar[0] += 1
if 0 < ar[1]:
ar[0] += 1
print(("Yes" if ar... | N = int(eval(input()))
an = [int(i) % 4 for i in input().split()]
def main():
two = an.count(2)
four = an.count(0)
other = N - two - four
if 0 < two:
other += 1
print(("Yes" if other - 1 <= four else "No"))
return
main()
| 22 | 17 | 359 | 267 | N = int(eval(input()))
an = list(map(int, input().split()))
def main():
ar = [0] * 3
for ai in an:
if ai % 4 == 0:
ar[2] += 1
elif ai % 2 == 0:
ar[1] += 1
else:
ar[0] += 1
if 0 < ar[1]:
ar[0] += 1
print(("Yes" if ar[0] - 1 <= ar[2] el... | N = int(eval(input()))
an = [int(i) % 4 for i in input().split()]
def main():
two = an.count(2)
four = an.count(0)
other = N - two - four
if 0 < two:
other += 1
print(("Yes" if other - 1 <= four else "No"))
return
main()
| false | 22.727273 | [
"-an = list(map(int, input().split()))",
"+an = [int(i) % 4 for i in input().split()]",
"- ar = [0] * 3",
"- for ai in an:",
"- if ai % 4 == 0:",
"- ar[2] += 1",
"- elif ai % 2 == 0:",
"- ar[1] += 1",
"- else:",
"- ar[0] += 1",
"- if... | false | 0.042782 | 0.040567 | 1.054608 | [
"s738046734",
"s006272159"
] |
u285891772 | p03834 | python | s690240550 | s647388961 | 155 | 38 | 13,596 | 5,144 | Accepted | Accepted | 75.48 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lower... | 28 | 25 | 925 | 858 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ... | false | 10.714286 | [
"-from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians",
"+from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2",
"-import numpy as np",
"-",
"-S = input()",
"-print(S[:5], end=\"\")",
"-print(\" \", end=\"\")",
"-print(S[6:13], end=\"\")",
"-print(\" \", end=\"... | false | 0.07826 | 0.042942 | 1.822486 | [
"s690240550",
"s647388961"
] |
u411203878 | p02834 | python | s771061180 | s469386070 | 730 | 373 | 67,308 | 91,644 | Accepted | Accepted | 48.9 | def bfs(p):
stack=[p]
check = [-1]*n
check[p] = 0
while len(stack):
v = stack.pop()
for i in root[v]:
if check[i] == -1:
check[i]=check[v]+1
stack.append(i)
return check
n,u,v = list(map(int,input().split()))
u -= 1
v... | from collections import deque
def bfs(s):
stack=deque([s])
check = [-1]*n
check[s] = 0
while len(stack)>0:
v = stack.popleft()
for i in root[v]:
if check[i] == -1:
check[i]=check[v]+1
stack.append(i)
return check
n,u,v = lis... | 32 | 31 | 651 | 674 | def bfs(p):
stack = [p]
check = [-1] * n
check[p] = 0
while len(stack):
v = stack.pop()
for i in root[v]:
if check[i] == -1:
check[i] = check[v] + 1
stack.append(i)
return check
n, u, v = list(map(int, input().split()))
u -= 1
v -= 1
root... | from collections import deque
def bfs(s):
stack = deque([s])
check = [-1] * n
check[s] = 0
while len(stack) > 0:
v = stack.popleft()
for i in root[v]:
if check[i] == -1:
check[i] = check[v] + 1
stack.append(i)
return check
n, u, v = lis... | false | 3.125 | [
"-def bfs(p):",
"- stack = [p]",
"+from collections import deque",
"+",
"+",
"+def bfs(s):",
"+ stack = deque([s])",
"- check[p] = 0",
"- while len(stack):",
"- v = stack.pop()",
"+ check[s] = 0",
"+ while len(stack) > 0:",
"+ v = stack.popleft()",
"-u -= 1"... | false | 0.036155 | 0.036286 | 0.996388 | [
"s771061180",
"s469386070"
] |
u815763296 | p02924 | python | s463845639 | s008198024 | 27 | 24 | 9,028 | 9,052 | Accepted | Accepted | 11.11 | import math
N = int(eval(input()))
print(((N*(N-1)+2)//2-1))
| N = int(eval(input()))
ans = ((1+N-1)*(N-1))//2
print(ans)
| 3 | 3 | 55 | 55 | import math
N = int(eval(input()))
print(((N * (N - 1) + 2) // 2 - 1))
| N = int(eval(input()))
ans = ((1 + N - 1) * (N - 1)) // 2
print(ans)
| false | 0 | [
"-import math",
"-",
"-print(((N * (N - 1) + 2) // 2 - 1))",
"+ans = ((1 + N - 1) * (N - 1)) // 2",
"+print(ans)"
] | false | 0.096823 | 0.065905 | 1.469131 | [
"s463845639",
"s008198024"
] |
u700805562 | p03476 | python | s673816469 | s442544821 | 1,961 | 869 | 7,816 | 7,364 | Accepted | Accepted | 55.69 | def eratosthenes(limit):
A = [i for i in range(2, limit+1)]
P = []
time = 0
while True:
prime = min(A)
if prime > 316: break
P.append(prime)
i = 0
while i < len(A):
if A[i] % prime == 0:
A.pop(i)
continue
... | def primes(n):
ass = []
is_prime = [True] * (n + 1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(n**0.5) + 1):
if not is_prime[i]: continue
for j in range(i * 2, n + 1, i):
is_prime[j] = False
for i in range(len(is_prime)):
if is_pri... | 26 | 20 | 670 | 633 | def eratosthenes(limit):
A = [i for i in range(2, limit + 1)]
P = []
time = 0
while True:
prime = min(A)
if prime > 316:
break
P.append(prime)
i = 0
while i < len(A):
if A[i] % prime == 0:
A.pop(i)
continue
... | def primes(n):
ass = []
is_prime = [True] * (n + 1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(n**0.5) + 1):
if not is_prime[i]:
continue
for j in range(i * 2, n + 1, i):
is_prime[j] = False
for i in range(len(is_prime)):
if is_p... | false | 23.076923 | [
"-def eratosthenes(limit):",
"- A = [i for i in range(2, limit + 1)]",
"- P = []",
"- time = 0",
"- while True:",
"- prime = min(A)",
"- if prime > 316:",
"- break",
"- P.append(prime)",
"- i = 0",
"- while i < len(A):",
"- i... | false | 1.318482 | 0.411994 | 3.200242 | [
"s673816469",
"s442544821"
] |
u631277801 | p02949 | python | s576213323 | s068885887 | 1,240 | 767 | 49,396 | 49,164 | Accepted | Accepted | 38.15 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x) - 1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.r... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x) - 1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.r... | 95 | 94 | 2,258 | 2,212 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**7)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**7)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | false | 1.052632 | [
"-for _ in range(n):",
"- for ai, bi, ci in edges:",
"- if ai in one2n_path and bi in one2n_path and dist[ai] + ci > dist[bi]:",
"- modified = True",
"-# Nๅๆดๆฐใจ2Nๅๆดๆฐใๆฏ่ผ",
"-# 2Nๅใงๆดๆฐใใใฆใใใฐ-1",
"+for ai, bi, ci in edges:",
"+ if ai in one2n_path and bi in one2n_path and dist[ai] +... | false | 0.038553 | 0.04024 | 0.958066 | [
"s576213323",
"s068885887"
] |
u648881683 | p02787 | python | s485414942 | s581874033 | 1,366 | 452 | 14,688 | 14,692 | Accepted | Accepted | 66.91 | import numpy as np
H, N = list(map(int, input().split()))
AB = np.array([list(map(int, input().split())) for i in range(N)])
A = AB[:, 0]
B = AB[:, 1]
# ใคใณใใใฏในใฏใฉใคใ ๅคใฏใใใไปฅไธใซใใๆๅฐMP
dp = np.array([0]*(H+1))
# dp = np.array([0 for i in range(H+1)])
for i in range(1, H+1):
dp[i] = min(dp[np.maximum(i - A,... | import numpy as np
H, N = list(map(int, input().split()))
AB = np.array([list(map(int, input().split())) for i in range(N)])
A = AB[:, 0]
B = AB[:, 1]
# ใคใณใใใฏในใฏใฉใคใ ๅคใฏใใใไปฅไธใซใใๆๅฐMP
dp = np.array([0 for i in range(H+1)])
for i in range(1, H+1):
dp[i] = np.min(dp[np.maximum(i - A, 0)] + B)
print((dp[-1... | 15 | 14 | 340 | 315 | import numpy as np
H, N = list(map(int, input().split()))
AB = np.array([list(map(int, input().split())) for i in range(N)])
A = AB[:, 0]
B = AB[:, 1]
# ใคใณใใใฏในใฏใฉใคใ ๅคใฏใใใไปฅไธใซใใๆๅฐMP
dp = np.array([0] * (H + 1))
# dp = np.array([0 for i in range(H+1)])
for i in range(1, H + 1):
dp[i] = min(dp[np.maximum(i - A, 0)] + B... | import numpy as np
H, N = list(map(int, input().split()))
AB = np.array([list(map(int, input().split())) for i in range(N)])
A = AB[:, 0]
B = AB[:, 1]
# ใคใณใใใฏในใฏใฉใคใ ๅคใฏใใใไปฅไธใซใใๆๅฐMP
dp = np.array([0 for i in range(H + 1)])
for i in range(1, H + 1):
dp[i] = np.min(dp[np.maximum(i - A, 0)] + B)
print((dp[-1]))
| false | 6.666667 | [
"-dp = np.array([0] * (H + 1))",
"-# dp = np.array([0 for i in range(H+1)])",
"+dp = np.array([0 for i in range(H + 1)])",
"- dp[i] = min(dp[np.maximum(i - A, 0)] + B)",
"+ dp[i] = np.min(dp[np.maximum(i - A, 0)] + B)"
] | false | 0.431251 | 0.866912 | 0.497456 | [
"s485414942",
"s581874033"
] |
u753803401 | p03986 | python | s005579306 | s173769032 | 98 | 76 | 3,500 | 3,500 | Accepted | Accepted | 22.45 | s = eval(input())
tt = 0
cnt = 0
for i in range(len(s)):
if s[-i-1] == "T":
tt += 1
elif s[-i-1] == "S":
t = min(1, tt)
cnt += t
tt -= t
print((len(s) - cnt * 2))
| x = eval(input())
t = 0
c = 0
for i in range(len(x)):
if x[-i-1] == "T":
t += 1
else:
r = 1 if t > 0 else 0
t -= r
c += r
print((len(x) - c * 2))
| 11 | 11 | 205 | 188 | s = eval(input())
tt = 0
cnt = 0
for i in range(len(s)):
if s[-i - 1] == "T":
tt += 1
elif s[-i - 1] == "S":
t = min(1, tt)
cnt += t
tt -= t
print((len(s) - cnt * 2))
| x = eval(input())
t = 0
c = 0
for i in range(len(x)):
if x[-i - 1] == "T":
t += 1
else:
r = 1 if t > 0 else 0
t -= r
c += r
print((len(x) - c * 2))
| false | 0 | [
"-s = eval(input())",
"-tt = 0",
"-cnt = 0",
"-for i in range(len(s)):",
"- if s[-i - 1] == \"T\":",
"- tt += 1",
"- elif s[-i - 1] == \"S\":",
"- t = min(1, tt)",
"- cnt += t",
"- tt -= t",
"-print((len(s) - cnt * 2))",
"+x = eval(input())",
"+t = 0",
"+c... | false | 0.035765 | 0.03669 | 0.974796 | [
"s005579306",
"s173769032"
] |
u738898077 | p02580 | python | s379312891 | s762061986 | 874 | 779 | 82,460 | 82,476 | Accepted | Accepted | 10.87 |
from bisect import bisect_left
import sys
input = sys.stdin.readline
H,W,m = list(map(int,input().split()))
h = [0]*(H+1)
w = [0]*(W+1)
c = [[-1,10**6] for i in range(H+1)]
for i in range(m):
a,b = list(map(int,input().split()))
h[a] += 1
w[b] += 1
c[a].append(b)
mh = max(h)
mw = max(w)
... | from bisect import bisect_left
import sys
input = sys.stdin.readline
H,W,m = list(map(int,input().split()))
h = [0]*(H+1)
w = [0]*(W+1)
c = [[-1,10**6] for i in range(H+1)]
for i in range(m):
a,b = list(map(int,input().split()))
h[a] += 1
w[b] += 1
c[a].append(b)
mh = max(h)
mw = max(w)
hk... | 34 | 29 | 734 | 629 | from bisect import bisect_left
import sys
input = sys.stdin.readline
H, W, m = list(map(int, input().split()))
h = [0] * (H + 1)
w = [0] * (W + 1)
c = [[-1, 10**6] for i in range(H + 1)]
for i in range(m):
a, b = list(map(int, input().split()))
h[a] += 1
w[b] += 1
c[a].append(b)
mh = max(h)
mw = max(w)... | from bisect import bisect_left
import sys
input = sys.stdin.readline
H, W, m = list(map(int, input().split()))
h = [0] * (H + 1)
w = [0] * (W + 1)
c = [[-1, 10**6] for i in range(H + 1)]
for i in range(m):
a, b = list(map(int, input().split()))
h[a] += 1
w[b] += 1
c[a].append(b)
mh = max(h)
mw = max(w)... | false | 14.705882 | [
"-for i in range(H + 1):",
"+for i in hkouho:",
"-# print(hkouho)",
"-# print(wkouho)",
"-for i in hkouho:",
"- # print(c[i],i,j,bisect_left(c[i],j))"
] | false | 0.061778 | 0.037439 | 1.650084 | [
"s379312891",
"s762061986"
] |
u873134970 | p03101 | python | s145289896 | s697955930 | 147 | 17 | 12,484 | 2,940 | Accepted | Accepted | 88.44 | import numpy as np
ipt = list(map(int,input().split()))
cr = list(map(int,input().split()))
print(((ipt[0]-cr[0])*(ipt[1]-cr[1]))) | ipt = list(map(int,input().split()))
cr = list(map(int,input().split()))
print(((ipt[0]-cr[0])*(ipt[1]-cr[1]))) | 5 | 3 | 133 | 111 | import numpy as np
ipt = list(map(int, input().split()))
cr = list(map(int, input().split()))
print(((ipt[0] - cr[0]) * (ipt[1] - cr[1])))
| ipt = list(map(int, input().split()))
cr = list(map(int, input().split()))
print(((ipt[0] - cr[0]) * (ipt[1] - cr[1])))
| false | 40 | [
"-import numpy as np",
"-"
] | false | 0.036749 | 0.03723 | 0.987088 | [
"s145289896",
"s697955930"
] |
u230621983 | p03474 | python | s676545298 | s988677835 | 20 | 17 | 3,060 | 2,940 | Accepted | Accepted | 15 | A, B = list(map(int, input().split()))
S = eval(input())
for i in range(len(S)):
if i != A and S[i] == '-':
print('No')
exit()
if i == A and S[i] != '-':
print('No')
exit()
print('Yes') | A, B = list(map(int, input().split()))
S = eval(input())
for i in range(len(S)):
if (i != A and S[i] == '-') or (i == A and S[i] != '-'):
print('No')
exit()
print('Yes') | 12 | 9 | 206 | 181 | A, B = list(map(int, input().split()))
S = eval(input())
for i in range(len(S)):
if i != A and S[i] == "-":
print("No")
exit()
if i == A and S[i] != "-":
print("No")
exit()
print("Yes")
| A, B = list(map(int, input().split()))
S = eval(input())
for i in range(len(S)):
if (i != A and S[i] == "-") or (i == A and S[i] != "-"):
print("No")
exit()
print("Yes")
| false | 25 | [
"- if i != A and S[i] == \"-\":",
"- print(\"No\")",
"- exit()",
"- if i == A and S[i] != \"-\":",
"+ if (i != A and S[i] == \"-\") or (i == A and S[i] != \"-\"):"
] | false | 0.050302 | 0.049567 | 1.01483 | [
"s676545298",
"s988677835"
] |
u790710233 | p03073 | python | s898153753 | s365385757 | 71 | 18 | 5,404 | 3,188 | Accepted | Accepted | 74.65 | s = list(map(int, list(eval(input()))))
e = [i % 2 for i in range(len(s))]
o = [(i+1) % 2 for i in range(len(s))]
print((min(sum(x != y for x, y in zip(s, e)), sum(x != y for x, y in zip(s, o)))))
| s = eval(input())
n = s[::2].count("0") + s[1::2].count("1")
print((min(n, len(s)-n))) | 4 | 3 | 192 | 80 | s = list(map(int, list(eval(input()))))
e = [i % 2 for i in range(len(s))]
o = [(i + 1) % 2 for i in range(len(s))]
print((min(sum(x != y for x, y in zip(s, e)), sum(x != y for x, y in zip(s, o)))))
| s = eval(input())
n = s[::2].count("0") + s[1::2].count("1")
print((min(n, len(s) - n)))
| false | 25 | [
"-s = list(map(int, list(eval(input()))))",
"-e = [i % 2 for i in range(len(s))]",
"-o = [(i + 1) % 2 for i in range(len(s))]",
"-print((min(sum(x != y for x, y in zip(s, e)), sum(x != y for x, y in zip(s, o)))))",
"+s = eval(input())",
"+n = s[::2].count(\"0\") + s[1::2].count(\"1\")",
"+print((min(n, ... | false | 0.052428 | 0.036149 | 1.450321 | [
"s898153753",
"s365385757"
] |
u785989355 | p02560 | python | s960536180 | s534850628 | 425 | 385 | 70,024 | 9,172 | Accepted | Accepted | 9.41 | def FloorSum(n,m,a,b):
ret = 0
while True:
if a>=m:
ret += (n-1)*n*(a//m)//2
a%=m
if b>=m:
ret += n*(b//m)
b%=m
y = (a*n+b)//m
x = y*m-b
if y==0:
return ret
ret += (n-(x+a-1)//a)*y
... | """
c_r_5ใใใฎ
https://atcoder.jp/contests/practice2/submissions/16626085
ใๅ่ใซ
"""
code = """
# distutils: language=c++
# distutils: include_dirs=[/home/contestant/.local/lib/python3.8/site-packages/numpy/core/include, /opt/atcoder-stl]
# cython: boundscheck=False
# cython: wraparound=False
cdef extern from "... | 27 | 28 | 492 | 864 | def FloorSum(n, m, a, b):
ret = 0
while True:
if a >= m:
ret += (n - 1) * n * (a // m) // 2
a %= m
if b >= m:
ret += n * (b // m)
b %= m
y = (a * n + b) // m
x = y * m - b
if y == 0:
return ret
ret += (n ... | """
c_r_5ใใใฎ
https://atcoder.jp/contests/practice2/submissions/16626085
ใๅ่ใซ
"""
code = """
# distutils: language=c++
# distutils: include_dirs=[/home/contestant/.local/lib/python3.8/site-packages/numpy/core/include, /opt/atcoder-stl]
# cython: boundscheck=False
# cython: wraparound=False
cdef extern from "/opt/atcoder... | false | 3.571429 | [
"-def FloorSum(n, m, a, b):",
"- ret = 0",
"- while True:",
"- if a >= m:",
"- ret += (n - 1) * n * (a // m) // 2",
"- a %= m",
"- if b >= m:",
"- ret += n * (b // m)",
"- b %= m",
"- y = (a * n + b) // m",
"- x = y * ... | false | 0.13746 | 0.091949 | 1.494971 | [
"s960536180",
"s534850628"
] |
u143509139 | p02777 | python | s664188311 | s642661820 | 21 | 18 | 3,316 | 2,940 | Accepted | Accepted | 14.29 | s, t = input().split()
a, b = list(map(int, input().split()))
u = eval(input())
if s == u:
print((a - 1, b))
else:
print((a, b - 1))
| s,t=input().split()
a,b=list(map(int,input().split()))
if s==eval(input()):
print((a-1,b))
else:
print((a,b-1)) | 7 | 6 | 131 | 104 | s, t = input().split()
a, b = list(map(int, input().split()))
u = eval(input())
if s == u:
print((a - 1, b))
else:
print((a, b - 1))
| s, t = input().split()
a, b = list(map(int, input().split()))
if s == eval(input()):
print((a - 1, b))
else:
print((a, b - 1))
| false | 14.285714 | [
"-u = eval(input())",
"-if s == u:",
"+if s == eval(input()):"
] | false | 0.042865 | 0.03918 | 1.094068 | [
"s664188311",
"s642661820"
] |
u179750651 | p02711 | python | s939974305 | s338454597 | 24 | 19 | 9,084 | 8,948 | Accepted | Accepted | 20.83 | n=input()
print('Yes') if (n.count('7')) >= 1 else print('No')
| print('Yes') if (input().count('7')) >= 1 else print('No')
| 2 | 1 | 64 | 59 | n = input()
print("Yes") if (n.count("7")) >= 1 else print("No")
| print("Yes") if (input().count("7")) >= 1 else print("No")
| false | 50 | [
"-n = input()",
"-print(\"Yes\") if (n.count(\"7\")) >= 1 else print(\"No\")",
"+print(\"Yes\") if (input().count(\"7\")) >= 1 else print(\"No\")"
] | false | 0.037627 | 0.034742 | 1.083037 | [
"s939974305",
"s338454597"
] |
u562935282 | p02854 | python | s286134708 | s416885831 | 319 | 208 | 93,516 | 26,764 | Accepted | Accepted | 34.8 | from itertools import accumulate
n = int(eval(input()))
a = list(map(int, input().split()))
acc = tuple(accumulate(a))
ret = min(abs(acc[-1] - x * 2) for x in acc)
print(ret)
| n = int(eval(input()))
*a, = list(map(int, input().split()))
tot = sum(a)
ret = tot
l, r = 0, tot
for i in range(n):
l += a[i]
r -= a[i]
ret = min(ret, abs(l - r))
print(ret)
| 8 | 11 | 172 | 186 | from itertools import accumulate
n = int(eval(input()))
a = list(map(int, input().split()))
acc = tuple(accumulate(a))
ret = min(abs(acc[-1] - x * 2) for x in acc)
print(ret)
| n = int(eval(input()))
(*a,) = list(map(int, input().split()))
tot = sum(a)
ret = tot
l, r = 0, tot
for i in range(n):
l += a[i]
r -= a[i]
ret = min(ret, abs(l - r))
print(ret)
| false | 27.272727 | [
"-from itertools import accumulate",
"-",
"-a = list(map(int, input().split()))",
"-acc = tuple(accumulate(a))",
"-ret = min(abs(acc[-1] - x * 2) for x in acc)",
"+(*a,) = list(map(int, input().split()))",
"+tot = sum(a)",
"+ret = tot",
"+l, r = 0, tot",
"+for i in range(n):",
"+ l += a[i]",
... | false | 0.07643 | 0.041356 | 1.848104 | [
"s286134708",
"s416885831"
] |
u970267139 | p03246 | python | s392045984 | s030185821 | 115 | 94 | 17,656 | 21,184 | Accepted | Accepted | 18.26 | n = int(eval(input()))
v = list(map(int, input().split()))
odd = {}
even = {}
change = 0
for i in range(n):
if i % 2 == 0:
if v[i] in even:
even[v[i]] += 1
else:
even[v[i]] = 1
else:
if v[i] in odd:
odd[v[i]] += 1
else:
... | from collections import Counter
n = int(eval(input()))
v = list(map(int, input().split()))
c1 = Counter(v[::2])
c2 = Counter(v[1::2])
s1 = sorted(list(c1.items()), key=lambda x:x[1], reverse=True)
s2 = sorted(list(c2.items()), key=lambda x:x[1], reverse=True)
if len(s1) == 1 and len(s2) == 1:
if s1[0][0] ... | 49 | 24 | 1,534 | 709 | n = int(eval(input()))
v = list(map(int, input().split()))
odd = {}
even = {}
change = 0
for i in range(n):
if i % 2 == 0:
if v[i] in even:
even[v[i]] += 1
else:
even[v[i]] = 1
else:
if v[i] in odd:
odd[v[i]] += 1
else:
odd[v[i]] = ... | from collections import Counter
n = int(eval(input()))
v = list(map(int, input().split()))
c1 = Counter(v[::2])
c2 = Counter(v[1::2])
s1 = sorted(list(c1.items()), key=lambda x: x[1], reverse=True)
s2 = sorted(list(c2.items()), key=lambda x: x[1], reverse=True)
if len(s1) == 1 and len(s2) == 1:
if s1[0][0] == s2[0... | false | 51.020408 | [
"+from collections import Counter",
"+",
"-odd = {}",
"-even = {}",
"-change = 0",
"-for i in range(n):",
"- if i % 2 == 0:",
"- if v[i] in even:",
"- even[v[i]] += 1",
"+c1 = Counter(v[::2])",
"+c2 = Counter(v[1::2])",
"+s1 = sorted(list(c1.items()), key=lambda x: x[1], r... | false | 0.046776 | 0.047595 | 0.982789 | [
"s392045984",
"s030185821"
] |
u105210954 | p02951 | python | s336233869 | s576126602 | 177 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.4 | a, b, c = list(map(int, input().split()))
if c-(a-b) < 0:
print('0')
else:
print((c-(a-b)))
| a,b,c = list(map(int, input().split()))
print((max(c-(a-b), 0))) | 6 | 2 | 94 | 57 | a, b, c = list(map(int, input().split()))
if c - (a - b) < 0:
print("0")
else:
print((c - (a - b)))
| a, b, c = list(map(int, input().split()))
print((max(c - (a - b), 0)))
| false | 66.666667 | [
"-if c - (a - b) < 0:",
"- print(\"0\")",
"-else:",
"- print((c - (a - b)))",
"+print((max(c - (a - b), 0)))"
] | false | 0.146753 | 0.051372 | 2.856676 | [
"s336233869",
"s576126602"
] |
u562935282 | p03287 | python | s640395276 | s451544907 | 104 | 71 | 15,048 | 20,768 | Accepted | Accepted | 31.73 | from collections import defaultdict
N, M = list(map(int, input().split()))
a = tuple(map(int, input().split()))
ans = 0
d = defaultdict(int)
d[0] = 1
t = 0
for aa in a:
t += aa
ans += d[t % M]
d[t % M] += 1
print(ans)
| def main():
N, M = list(map(int, input().split()))
*A, = list(map(int, input().split()))
d = {0: 1}
ans = 0
t = 0
for x in A:
t = (t + x) % M
ans += (cnt := d.get(t, 0))
d[t] = cnt + 1
print(ans)
if __name__ == '__main__':
main()
| 15 | 18 | 241 | 296 | from collections import defaultdict
N, M = list(map(int, input().split()))
a = tuple(map(int, input().split()))
ans = 0
d = defaultdict(int)
d[0] = 1
t = 0
for aa in a:
t += aa
ans += d[t % M]
d[t % M] += 1
print(ans)
| def main():
N, M = list(map(int, input().split()))
(*A,) = list(map(int, input().split()))
d = {0: 1}
ans = 0
t = 0
for x in A:
t = (t + x) % M
ans += (cnt := d.get(t, 0))
d[t] = cnt + 1
print(ans)
if __name__ == "__main__":
main()
| false | 16.666667 | [
"-from collections import defaultdict",
"+def main():",
"+ N, M = list(map(int, input().split()))",
"+ (*A,) = list(map(int, input().split()))",
"+ d = {0: 1}",
"+ ans = 0",
"+ t = 0",
"+ for x in A:",
"+ t = (t + x) % M",
"+ ans += (cnt := d.get(t, 0))",
"+ ... | false | 0.033921 | 0.035594 | 0.952998 | [
"s640395276",
"s451544907"
] |
u261082314 | p03031 | python | s678143691 | s488025628 | 51 | 43 | 9,084 | 9,060 | Accepted | Accepted | 15.69 | N, M = list(map(int,input().split()))
state = []
for _ in range(M):
lst = list(map(int, input().split()))
state.append(lst[1:])#switch numbers each denkyu
p = list(map(int, input().split()))#numbers switches on %2 == pi
ans = 0
for i in range(2**N):
total = 0
for j in range(M):
cnt = 0
for s... | N, M = list(map(int,input().split()))
state = []
for _ in range(M):
lst = list(map(int, input().split()))
state.append(lst[1:])#switch numbers each denkyu
p = list(map(int, input().split()))#numbers switches on %2 == pi
ans = 0
for i in range(2**N):
total = 0
for j in range(M):
cnt = 0
for s... | 21 | 23 | 519 | 543 | N, M = list(map(int, input().split()))
state = []
for _ in range(M):
lst = list(map(int, input().split()))
state.append(lst[1:]) # switch numbers each denkyu
p = list(map(int, input().split())) # numbers switches on %2 == pi
ans = 0
for i in range(2**N):
total = 0
for j in range(M):
cnt = 0
... | N, M = list(map(int, input().split()))
state = []
for _ in range(M):
lst = list(map(int, input().split()))
state.append(lst[1:]) # switch numbers each denkyu
p = list(map(int, input().split())) # numbers switches on %2 == pi
ans = 0
for i in range(2**N):
total = 0
for j in range(M):
cnt = 0
... | false | 8.695652 | [
"+ else:",
"+ break"
] | false | 0.053705 | 0.035587 | 1.509106 | [
"s678143691",
"s488025628"
] |
u092387689 | p03805 | python | s739751046 | s701074488 | 35 | 32 | 3,064 | 3,064 | Accepted | Accepted | 8.57 | import sys
sys.setrecursionlimit(10000)
n,m = list(map(int,input().split()))
rel = [[False for i in range(n+1)] for i in range(n+1)]
for i in range(m):
a,b = list(map(int,input().split()))
rel[a][b] = True
rel[b][a] = True
ans=0
def rec(l):
global ans
if(len(l)==n):
ans+=1
... | from itertools import permutations
n,m = list(map(int,input().split()))
rel_t = [[False for i in range(n)] for j in range(n)]
for i in range(m):
a,b = list(map(int,input().split()))
rel_t[a-1][b-1]=True
rel_t[b-1][a-1]=True
cnt=0
n_list = [i for i in range(n)]
for l in permutations(n_list,len... | 23 | 20 | 461 | 457 | import sys
sys.setrecursionlimit(10000)
n, m = list(map(int, input().split()))
rel = [[False for i in range(n + 1)] for i in range(n + 1)]
for i in range(m):
a, b = list(map(int, input().split()))
rel[a][b] = True
rel[b][a] = True
ans = 0
def rec(l):
global ans
if len(l) == n:
ans += 1
... | from itertools import permutations
n, m = list(map(int, input().split()))
rel_t = [[False for i in range(n)] for j in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
rel_t[a - 1][b - 1] = True
rel_t[b - 1][a - 1] = True
cnt = 0
n_list = [i for i in range(n)]
for l in permutations(n_list... | false | 13.043478 | [
"-import sys",
"+from itertools import permutations",
"-sys.setrecursionlimit(10000)",
"-rel = [[False for i in range(n + 1)] for i in range(n + 1)]",
"+rel_t = [[False for i in range(n)] for j in range(n)]",
"- rel[a][b] = True",
"- rel[b][a] = True",
"-ans = 0",
"-",
"-",
"-def rec(l):",... | false | 0.035756 | 0.074454 | 0.480238 | [
"s739751046",
"s701074488"
] |
u075012704 | p03575 | python | s658665645 | s616201908 | 58 | 24 | 3,064 | 3,064 | Accepted | Accepted | 58.62 | N , M = list(map(int, input().split()))
AB = [list(map(int,input().split())) for i in range(M)]
def DFS(table):
visited = [1]
que = [1]
while que != []:
now = que[0]
del que[0]
for index, e in enumerate(table[now]):
if (e == 1) & (index not in... | N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(M)]
class UnionFind:
def __init__(self, n):
self.par = [i for i in range(n+1)]
self.rank = [0] * (n+1)
self.size = [1] * (n+1)
# ๆค็ดข
def find(self, x):
if self.par[x] == ... | 36 | 56 | 723 | 1,281 | N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(M)]
def DFS(table):
visited = [1]
que = [1]
while que != []:
now = que[0]
del que[0]
for index, e in enumerate(table[now]):
if (e == 1) & (index not in visited):
... | N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(M)]
class UnionFind:
def __init__(self, n):
self.par = [i for i in range(n + 1)]
self.rank = [0] * (n + 1)
self.size = [1] * (n + 1)
# ๆค็ดข
def find(self, x):
if self.par[x] == x:
... | false | 35.714286 | [
"-def DFS(table):",
"- visited = [1]",
"- que = [1]",
"- while que != []:",
"- now = que[0]",
"- del que[0]",
"- for index, e in enumerate(table[now]):",
"- if (e == 1) & (index not in visited):",
"- visited.append(index)",
"- ... | false | 0.040717 | 0.046312 | 0.879203 | [
"s658665645",
"s616201908"
] |
u832039789 | p02753 | python | s491775745 | s750120993 | 43 | 36 | 5,332 | 5,040 | Accepted | Accepted | 16.28 | import sys
from fractions import gcd
from itertools import groupby as gb
from itertools import permutations as perm
from itertools import combinations as comb
from collections import Counter as C
from collections import defaultdict as dd
sys.setrecursionlimit(10**5)
def y(f):
if f:
print('Yes')
... | import sys
from fractions import gcd
from itertools import groupby as gb
from itertools import permutations as perm
from itertools import combinations as comb
from collections import Counter as C
from collections import defaultdict as dd
sys.setrecursionlimit(10**5)
def y(f):
if f:
print('Yes')
... | 29 | 31 | 616 | 618 | import sys
from fractions import gcd
from itertools import groupby as gb
from itertools import permutations as perm
from itertools import combinations as comb
from collections import Counter as C
from collections import defaultdict as dd
sys.setrecursionlimit(10**5)
def y(f):
if f:
print("Yes")
else:... | import sys
from fractions import gcd
from itertools import groupby as gb
from itertools import permutations as perm
from itertools import combinations as comb
from collections import Counter as C
from collections import defaultdict as dd
sys.setrecursionlimit(10**5)
def y(f):
if f:
print("Yes")
else:... | false | 6.451613 | [
"-y(len(set(list(eval(input())))) == 2)",
"+s = eval(input())",
"+y(s != s[0] * 3)"
] | false | 0.14001 | 0.035565 | 3.936696 | [
"s491775745",
"s750120993"
] |
u797673668 | p02241 | python | s193094446 | s514279895 | 90 | 30 | 8,704 | 8,704 | Accepted | Accepted | 66.67 | import heapq
n = int(eval(input()))
edges = [set((w, j) for j, w in enumerate(map(int, input().split())) if w > -1) for _ in range(n)]
visited = [False] * n
visited[0] = True
queue = list(edges[0])
heapq.heapify(queue)
total_cost, remains = 0, n - 1
while True:
cost, vertex = heapq.heappop(queue)
... | import heapq
n = int(eval(input()))
edges = [set((w, j) for j, w in enumerate(map(int, input().split())) if w > -1) for _ in range(n)]
visited = [False] * n
visited[0] = True
queue = list(edges[0])
heapq.heapify(queue)
total_cost, remains = 0, n - 1
while True:
cost, vertex = heapq.heappop(queue)
... | 23 | 24 | 537 | 576 | import heapq
n = int(eval(input()))
edges = [
set((w, j) for j, w in enumerate(map(int, input().split())) if w > -1)
for _ in range(n)
]
visited = [False] * n
visited[0] = True
queue = list(edges[0])
heapq.heapify(queue)
total_cost, remains = 0, n - 1
while True:
cost, vertex = heapq.heappop(queue)
if ... | import heapq
n = int(eval(input()))
edges = [
set((w, j) for j, w in enumerate(map(int, input().split())) if w > -1)
for _ in range(n)
]
visited = [False] * n
visited[0] = True
queue = list(edges[0])
heapq.heapify(queue)
total_cost, remains = 0, n - 1
while True:
cost, vertex = heapq.heappop(queue)
if ... | false | 4.166667 | [
"- queue.extend(edges[vertex])",
"- heapq.heapify(queue)",
"+ for t in edges[vertex]:",
"+ if not visited[t[1]]:",
"+ heapq.heappush(queue, t)"
] | false | 0.038817 | 0.037084 | 1.046733 | [
"s193094446",
"s514279895"
] |
u983918956 | p03195 | python | s775277460 | s154381359 | 224 | 200 | 7,024 | 3,060 | Accepted | Accepted | 10.71 | N = int(eval(input()))
A = []
Even_count = 0
for i in range(N):
a = int(eval(input()))
if a % 2 == 0:
Even_count += 1
A.append(a)
if Even_count == N:
print("second")
else:
print("first") | N = int(eval(input()))
for i in range(N):
a = int(eval(input()))
if a % 2 == 1:
print("first")
exit()
print("second") | 12 | 7 | 213 | 135 | N = int(eval(input()))
A = []
Even_count = 0
for i in range(N):
a = int(eval(input()))
if a % 2 == 0:
Even_count += 1
A.append(a)
if Even_count == N:
print("second")
else:
print("first")
| N = int(eval(input()))
for i in range(N):
a = int(eval(input()))
if a % 2 == 1:
print("first")
exit()
print("second")
| false | 41.666667 | [
"-A = []",
"-Even_count = 0",
"- if a % 2 == 0:",
"- Even_count += 1",
"- A.append(a)",
"-if Even_count == N:",
"- print(\"second\")",
"-else:",
"- print(\"first\")",
"+ if a % 2 == 1:",
"+ print(\"first\")",
"+ exit()",
"+print(\"second\")"
] | false | 0.039435 | 0.13639 | 0.289134 | [
"s775277460",
"s154381359"
] |
u094999522 | p03723 | python | s034524428 | s168785555 | 20 | 17 | 3,060 | 3,060 | Accepted | Accepted | 15 | *a,=list(map(int,input().split()))
b=[bin(abs(a[i+1]-a[i]))[::-1].find('1') for i in range(2)]
print(((max(b) if b[0]*b[1]<0 else min(b))*(1-sum(a)%2))) | *a,=list(map(int,input().split()))
b=[bin(a[i+1]-a[i])[::-1].find('1')for i in (0,1)]
print(((max(b) if b[0]*b[1]<0 else min(b))*(1-sum(a)%2))) | 3 | 3 | 146 | 137 | (*a,) = list(map(int, input().split()))
b = [bin(abs(a[i + 1] - a[i]))[::-1].find("1") for i in range(2)]
print(((max(b) if b[0] * b[1] < 0 else min(b)) * (1 - sum(a) % 2)))
| (*a,) = list(map(int, input().split()))
b = [bin(a[i + 1] - a[i])[::-1].find("1") for i in (0, 1)]
print(((max(b) if b[0] * b[1] < 0 else min(b)) * (1 - sum(a) % 2)))
| false | 0 | [
"-b = [bin(abs(a[i + 1] - a[i]))[::-1].find(\"1\") for i in range(2)]",
"+b = [bin(a[i + 1] - a[i])[::-1].find(\"1\") for i in (0, 1)]"
] | false | 0.040565 | 0.039855 | 1.017799 | [
"s034524428",
"s168785555"
] |
u787456042 | p04020 | python | s730471833 | s412346621 | 90 | 79 | 7,072 | 7,072 | Accepted | Accepted | 12.22 | N,*A=list(map(int,open(0)));p=f=0
for a in A:d,m=divmod(a+f,2);p+=d;f=m&(a>0)
print(p) | N,*A=list(map(int,open(0)));p=f=0
for a in A:p+=(a+f)//2;f=(a+f)%2&(a>0)
print(p) | 3 | 3 | 82 | 77 | N, *A = list(map(int, open(0)))
p = f = 0
for a in A:
d, m = divmod(a + f, 2)
p += d
f = m & (a > 0)
print(p)
| N, *A = list(map(int, open(0)))
p = f = 0
for a in A:
p += (a + f) // 2
f = (a + f) % 2 & (a > 0)
print(p)
| false | 0 | [
"- d, m = divmod(a + f, 2)",
"- p += d",
"- f = m & (a > 0)",
"+ p += (a + f) // 2",
"+ f = (a + f) % 2 & (a > 0)"
] | false | 0.038155 | 0.047469 | 0.803777 | [
"s730471833",
"s412346621"
] |
u429649677 | p03168 | python | s100485382 | s212254409 | 215 | 103 | 204,564 | 74,092 | Accepted | Accepted | 52.09 |
INF = float('inf')
def tc():
n = int(eval(input()))
p = list(map(float, input().split()))
dp = [[0] * (n + 1) for _ in range(n + 1)]
dp[0][0] = 1
# dp[i][j]: probability that out of the first
# i coins, j of them are heads
for i in range(1, n + 1):
dp[i][0] = dp[i ... |
INF = float('inf')
def tc():
n = int(eval(input()))
p = list(map(float, input().split()))
# dp = [[0] * (n + 1) for _ in range(n + 1)]
# dp[0][0] = 1
# # dp[i][j]: probability that out of the first
# # i coins, j of them are heads
# for i in range(1, n + 1):
# dp[i... | 23 | 34 | 521 | 857 | INF = float("inf")
def tc():
n = int(eval(input()))
p = list(map(float, input().split()))
dp = [[0] * (n + 1) for _ in range(n + 1)]
dp[0][0] = 1
# dp[i][j]: probability that out of the first
# i coins, j of them are heads
for i in range(1, n + 1):
dp[i][0] = dp[i - 1][0] * (1 - p[... | INF = float("inf")
def tc():
n = int(eval(input()))
p = list(map(float, input().split()))
# dp = [[0] * (n + 1) for _ in range(n + 1)]
# dp[0][0] = 1
# # dp[i][j]: probability that out of the first
# # i coins, j of them are heads
# for i in range(1, n + 1):
# dp[i][0] = dp[i - 1][... | false | 32.352941 | [
"- dp = [[0] * (n + 1) for _ in range(n + 1)]",
"- dp[0][0] = 1",
"- # dp[i][j]: probability that out of the first",
"- # i coins, j of them are heads",
"- for i in range(1, n + 1):",
"- dp[i][0] = dp[i - 1][0] * (1 - p[i - 1])",
"- for j in range(1, i + 1):",
"- ... | false | 0.04023 | 0.041468 | 0.970148 | [
"s100485382",
"s212254409"
] |
u909643606 | p03380 | python | s268740672 | s964920657 | 82 | 71 | 14,052 | 14,060 | Accepted | Accepted | 13.41 | import bisect
n=int(eval(input()))
a=[int(i) for i in input().split()]
a.sort()
nnn=a[n-1]
k=bisect.bisect_left(a[:n-1], nnn/2)
if k==n-1:
rrr=a[n-2]
else:
if abs(a[k-1]-nnn/2) < abs(a[k]-nnn/2):
rrr=a[k-1]
else:
rrr=a[k]
print((nnn, rrr))
| n=int(eval(input()))
a=[int(i) for i in input().split()]
enu=max(a)
a.remove(enu)
k=(enu)/2
sa=float("inf")
for i in range(n-1):
if abs(k-a[i])<sa:
sa=abs(k-a[i])
aru=a[i]
print((enu,aru)) | 18 | 15 | 269 | 221 | import bisect
n = int(eval(input()))
a = [int(i) for i in input().split()]
a.sort()
nnn = a[n - 1]
k = bisect.bisect_left(a[: n - 1], nnn / 2)
if k == n - 1:
rrr = a[n - 2]
else:
if abs(a[k - 1] - nnn / 2) < abs(a[k] - nnn / 2):
rrr = a[k - 1]
else:
rrr = a[k]
print((nnn, rrr))
| n = int(eval(input()))
a = [int(i) for i in input().split()]
enu = max(a)
a.remove(enu)
k = (enu) / 2
sa = float("inf")
for i in range(n - 1):
if abs(k - a[i]) < sa:
sa = abs(k - a[i])
aru = a[i]
print((enu, aru))
| false | 16.666667 | [
"-import bisect",
"-",
"-a.sort()",
"-nnn = a[n - 1]",
"-k = bisect.bisect_left(a[: n - 1], nnn / 2)",
"-if k == n - 1:",
"- rrr = a[n - 2]",
"-else:",
"- if abs(a[k - 1] - nnn / 2) < abs(a[k] - nnn / 2):",
"- rrr = a[k - 1]",
"- else:",
"- rrr = a[k]",
"-print((nnn, r... | false | 0.03957 | 0.062467 | 0.633465 | [
"s268740672",
"s964920657"
] |
u332906195 | p02762 | python | s257054962 | s019240571 | 1,646 | 1,462 | 66,464 | 77,160 | Accepted | Accepted | 11.18 | class UnionFind:
def __init__(self, n):
self.p, self.d = [-1] * n, [0] * n
def find(self, x):
if self.p[x] < 0:
return x
else:
self.p[x] = self.find(self.p[x])
return self.p[x]
def isSame(self, x, y):
return self.find(x) == ... | class UnionFind:
def __init__(self, n):
self.p, self.d = [-1] * n, [0] * n
def find(self, x):
if self.p[x] < 0:
return x
else:
self.p[x] = self.find(self.p[x])
return self.p[x]
def isSame(self, x, y):
return self.find(x) == ... | 52 | 47 | 1,335 | 1,218 | class UnionFind:
def __init__(self, n):
self.p, self.d = [-1] * n, [0] * n
def find(self, x):
if self.p[x] < 0:
return x
else:
self.p[x] = self.find(self.p[x])
return self.p[x]
def isSame(self, x, y):
return self.find(x) == self.find(y)
... | class UnionFind:
def __init__(self, n):
self.p, self.d = [-1] * n, [0] * n
def find(self, x):
if self.p[x] < 0:
return x
else:
self.p[x] = self.find(self.p[x])
return self.p[x]
def isSame(self, x, y):
return self.find(x) == self.find(y)
... | false | 9.615385 | [
"-Frd, Blk = {i: [] for i in range(N)}, {i: [] for i in range(N)}",
"-uni = UnionFind(N)",
"+n, u = {i: set() for i in range(N)}, UnionFind(N)",
"- uni.unite(A - 1, B - 1)",
"- Frd[A - 1].append(B - 1)",
"- Frd[B - 1].append(A - 1)",
"+ u.unite(A - 1, B - 1)",
"+ n[A - 1].add(B - 1)",
... | false | 0.048816 | 0.052946 | 0.921988 | [
"s257054962",
"s019240571"
] |
u699296734 | p03264 | python | s607310611 | s996597206 | 29 | 24 | 9,136 | 9,060 | Accepted | Accepted | 17.24 | k = int(eval(input()))
if k % 2 == 0:
res = (k // 2) ** 2
else:
res = (k // 2) * (k // 2 + 1)
print(res) | k = int(eval(input()))
res = int(k / 2) * int((k + 1) / 2)
print(res) | 7 | 3 | 113 | 65 | k = int(eval(input()))
if k % 2 == 0:
res = (k // 2) ** 2
else:
res = (k // 2) * (k // 2 + 1)
print(res)
| k = int(eval(input()))
res = int(k / 2) * int((k + 1) / 2)
print(res)
| false | 57.142857 | [
"-if k % 2 == 0:",
"- res = (k // 2) ** 2",
"-else:",
"- res = (k // 2) * (k // 2 + 1)",
"+res = int(k / 2) * int((k + 1) / 2)"
] | false | 0.041663 | 0.04059 | 1.026439 | [
"s607310611",
"s996597206"
] |
u729133443 | p03207 | python | s124486849 | s880460405 | 184 | 17 | 39,736 | 2,940 | Accepted | Accepted | 90.76 | n,*p=list(map(int,open(0).read().split()));print((sum(p)-max(p)//2)) | _,*p=list(map(int,open(0).readlines()));print((sum(p)-max(p)//2)) | 1 | 1 | 60 | 57 | n, *p = list(map(int, open(0).read().split()))
print((sum(p) - max(p) // 2))
| _, *p = list(map(int, open(0).readlines()))
print((sum(p) - max(p) // 2))
| false | 0 | [
"-n, *p = list(map(int, open(0).read().split()))",
"+_, *p = list(map(int, open(0).readlines()))"
] | false | 0.076846 | 0.03595 | 2.137593 | [
"s124486849",
"s880460405"
] |
u740767776 | p03308 | python | s843653274 | s728831417 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | n = int(eval(input()))
array = list(map(int,input().split()))
ma = 0
for i in range(n):
for j in range(i+1,n):
ma = max(ma,abs(array[i]-array[j]))
print(ma) | n = int(eval(input()))
array = list(map(int,input().split()))
print((abs(max(array)-min(array)))) | 8 | 3 | 169 | 91 | n = int(eval(input()))
array = list(map(int, input().split()))
ma = 0
for i in range(n):
for j in range(i + 1, n):
ma = max(ma, abs(array[i] - array[j]))
print(ma)
| n = int(eval(input()))
array = list(map(int, input().split()))
print((abs(max(array) - min(array))))
| false | 62.5 | [
"-ma = 0",
"-for i in range(n):",
"- for j in range(i + 1, n):",
"- ma = max(ma, abs(array[i] - array[j]))",
"-print(ma)",
"+print((abs(max(array) - min(array))))"
] | false | 0.040876 | 0.043481 | 0.940097 | [
"s843653274",
"s728831417"
] |
u926412290 | p02684 | python | s977737786 | s938818658 | 330 | 126 | 133,192 | 121,664 | Accepted | Accepted | 61.82 | N, K = list(map(int, input().split()))
A = [0] + list(map(int, input().split()))
now = 1
visited = []
visited_set = set()
for i in range(1, N+1):
visited.append(now)
visited_set.add(now)
now = A[now]
if now in visited_set:
loop_start = visited.index(now)
loop_length = i - ... | N, K = list(map(int, input().split()))
A = [0] + list(map(int, input().split()))
now = 1
visited = []
visited_set = set()
flag = False
for i in range(1, K+1):
visited.append(now)
visited_set.add(now)
now = A[now]
if now in visited_set:
loop_start = visited.index(now)
loop... | 20 | 22 | 458 | 475 | N, K = list(map(int, input().split()))
A = [0] + list(map(int, input().split()))
now = 1
visited = []
visited_set = set()
for i in range(1, N + 1):
visited.append(now)
visited_set.add(now)
now = A[now]
if now in visited_set:
loop_start = visited.index(now)
loop_length = i - loop_start
... | N, K = list(map(int, input().split()))
A = [0] + list(map(int, input().split()))
now = 1
visited = []
visited_set = set()
flag = False
for i in range(1, K + 1):
visited.append(now)
visited_set.add(now)
now = A[now]
if now in visited_set:
loop_start = visited.index(now)
loop_length = i - ... | false | 9.090909 | [
"-for i in range(1, N + 1):",
"+flag = False",
"+for i in range(1, K + 1):",
"+ flag = True",
"-if K >= loop_start:",
"+else:",
"+ print(now)",
"+if flag:",
"-else:",
"- print((visited[K]))"
] | false | 0.036821 | 0.036501 | 1.008758 | [
"s977737786",
"s938818658"
] |
u151005508 | p02936 | python | s141634917 | s521356993 | 1,939 | 1,690 | 268,648 | 276,160 | Accepted | Accepted | 12.84 | import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline
N, Q = list(map(int, input().split()))
ab=[]
for _ in range(N-1):
ab.append(tuple(map(int, input().split())))
px=[]
for _ in range(Q):
px.append(tuple(map(int, input().split())))
cnt=[0]*(N+1)
for el in px:
cnt[el[0]] += el... | import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline
N, Q = list(map(int, input().split()))
ab=[]
for _ in range(N-1):
ab.append(tuple(map(int, input().split())))
px=[]
for _ in range(Q):
px.append(tuple(map(int, input().split())))
cnt=[0]*(N+1)
for el in px:
cnt[el[0]] += ... | 35 | 35 | 694 | 682 | import sys
sys.setrecursionlimit(5 * 10**5)
input = sys.stdin.readline
N, Q = list(map(int, input().split()))
ab = []
for _ in range(N - 1):
ab.append(tuple(map(int, input().split())))
px = []
for _ in range(Q):
px.append(tuple(map(int, input().split())))
cnt = [0] * (N + 1)
for el in px:
cnt[el[0]] += el[... | import sys
sys.setrecursionlimit(5 * 10**5)
input = sys.stdin.readline
N, Q = list(map(int, input().split()))
ab = []
for _ in range(N - 1):
ab.append(tuple(map(int, input().split())))
px = []
for _ in range(Q):
px.append(tuple(map(int, input().split())))
cnt = [0] * (N + 1)
for el in px:
cnt[el[0]] += el[... | false | 0 | [
"-seen = [False] * (N + 1)",
"+seen = set()",
"- seen[n] = True",
"+ seen.add(n)",
"- if seen[child] == False:",
"+ if child not in seen:"
] | false | 0.074692 | 0.067564 | 1.105508 | [
"s141634917",
"s521356993"
] |
u910632349 | p02659 | python | s075583678 | s981764510 | 30 | 27 | 8,988 | 9,048 | Accepted | Accepted | 10 | A,B=input().split()
a=int(A)
b=B[0]+B[2]+B[3]
print((a*int(b)//100)) | from math import floor
a,b=input().split()
a,b=int(a),int(b[0]+b[2]+b[3])
print((a*b//100)) | 4 | 4 | 69 | 92 | A, B = input().split()
a = int(A)
b = B[0] + B[2] + B[3]
print((a * int(b) // 100))
| from math import floor
a, b = input().split()
a, b = int(a), int(b[0] + b[2] + b[3])
print((a * b // 100))
| false | 0 | [
"-A, B = input().split()",
"-a = int(A)",
"-b = B[0] + B[2] + B[3]",
"-print((a * int(b) // 100))",
"+from math import floor",
"+",
"+a, b = input().split()",
"+a, b = int(a), int(b[0] + b[2] + b[3])",
"+print((a * b // 100))"
] | false | 0.039033 | 0.040246 | 0.969876 | [
"s075583678",
"s981764510"
] |
u562935282 | p03147 | python | s208197530 | s787625896 | 20 | 17 | 3,064 | 2,940 | Accepted | Accepted | 15 | def solve_range(h, frm, to):
"""[frm, to)"""
# print(frm, to, h)
if frm >= to:
return 0
res = 0
start = frm
for i in range(frm, to):
h[i] -= 1
if h[i] < 0:
if start < i:
res += solve_range(h, start, i) + 1
start = i + 1
... | def main():
N = int(eval(input()))
H = list(map(int, input().split()))
cnt = 0
p = 0
for h in H:
cnt += max(0, h - p)
p = h
print(cnt)
if __name__ == '__main__':
main()
| 26 | 14 | 542 | 217 | def solve_range(h, frm, to):
"""[frm, to)"""
# print(frm, to, h)
if frm >= to:
return 0
res = 0
start = frm
for i in range(frm, to):
h[i] -= 1
if h[i] < 0:
if start < i:
res += solve_range(h, start, i) + 1
start = i + 1
elif... | def main():
N = int(eval(input()))
H = list(map(int, input().split()))
cnt = 0
p = 0
for h in H:
cnt += max(0, h - p)
p = h
print(cnt)
if __name__ == "__main__":
main()
| false | 46.153846 | [
"-def solve_range(h, frm, to):",
"- \"\"\"[frm, to)\"\"\"",
"- # print(frm, to, h)",
"- if frm >= to:",
"- return 0",
"- res = 0",
"- start = frm",
"- for i in range(frm, to):",
"- h[i] -= 1",
"- if h[i] < 0:",
"- if start < i:",
"- ... | false | 0.051121 | 0.045381 | 1.126493 | [
"s208197530",
"s787625896"
] |
u156815136 | p03457 | python | s213042109 | s151820976 | 373 | 300 | 11,800 | 18,896 | Accepted | Accepted | 19.57 | #
# NoKnowledgeGG @YlePhan
# ('ฯ')
#
#import collections
#aa = collections.Counter(a) # list to list
def readInts():
return list(map(int,input().split()))
mod = 10**9 + 7
def main():
n = int(eval(input()))
T = []
X = []
Y = []
for i in range(n):
t,x,y = readInts()
T... | #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... | 38 | 52 | 789 | 1,131 | #
# NoKnowledgeGG @YlePhan
# ('ฯ')
#
# import collections
# aa = collections.Counter(a) # list to list
def readInts():
return list(map(int, input().split()))
mod = 10**9 + 7
def main():
n = int(eval(input()))
T = []
X = []
Y = []
for i in range(n):
t, x, y = readInts()
T.appe... | # 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... | false | 26.923077 | [
"+# 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",
... | false | 0.007141 | 0.035173 | 0.203024 | [
"s213042109",
"s151820976"
] |
u987164499 | p02793 | python | s159996449 | s251577517 | 1,985 | 878 | 6,584 | 6,588 | Accepted | Accepted | 55.77 | from functools import reduce
from fractions import gcd
from collections import defaultdict,Counter
import copy
n = int(eval(input()))
a = list(map(int,input().split()))
mod = 10**9+7
dic = defaultdict(int)
def prime_factorize(n):
a = []
while n % 2 == 0:
a.append(2)
n //= 2
... | from functools import reduce
from fractions import gcd
from collections import defaultdict,Counter
import copy
n = int(eval(input()))
a = list(map(int,input().split()))
mod = 10**9+7
dic = defaultdict(int)
def prime_factorize(n):
a = []
while n % 2 == 0:
a.append(2)
n //= 2
... | 45 | 46 | 785 | 799 | from functools import reduce
from fractions import gcd
from collections import defaultdict, Counter
import copy
n = int(eval(input()))
a = list(map(int, input().split()))
mod = 10**9 + 7
dic = defaultdict(int)
def prime_factorize(n):
a = []
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
... | from functools import reduce
from fractions import gcd
from collections import defaultdict, Counter
import copy
n = int(eval(input()))
a = list(map(int, input().split()))
mod = 10**9 + 7
dic = defaultdict(int)
def prime_factorize(n):
a = []
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
... | false | 2.173913 | [
"+ l %= mod"
] | false | 0.078619 | 0.03787 | 2.076036 | [
"s159996449",
"s251577517"
] |
u438662618 | p03807 | python | s193613846 | s754436866 | 54 | 42 | 14,108 | 14,108 | Accepted | Accepted | 22.22 | N = int(eval(input()))
list = list(map(int, input().split()))
count = 0
for a in list :
if a % 2 != 0 :
count += 1
if count % 2 == 0 :
print('YES')
else :
print('NO')
| N = int(eval(input()))
list = list(map(int, input().split()))
if sum(list) % 2 == 0 :
print('YES')
else :
print('NO')
| 12 | 7 | 194 | 127 | N = int(eval(input()))
list = list(map(int, input().split()))
count = 0
for a in list:
if a % 2 != 0:
count += 1
if count % 2 == 0:
print("YES")
else:
print("NO")
| N = int(eval(input()))
list = list(map(int, input().split()))
if sum(list) % 2 == 0:
print("YES")
else:
print("NO")
| false | 41.666667 | [
"-count = 0",
"-for a in list:",
"- if a % 2 != 0:",
"- count += 1",
"-if count % 2 == 0:",
"+if sum(list) % 2 == 0:"
] | false | 0.033227 | 0.084258 | 0.394347 | [
"s193613846",
"s754436866"
] |
u046187684 | p03458 | python | s615463477 | s123194098 | 1,778 | 1,072 | 75,996 | 150,480 | Accepted | Accepted | 39.71 | import numpy as np
N, K = list(map(int, input().split()))
ub = K * 2
b = [[0 for j in range(ub + 1)] for i in range(ub + 1)]
ADD = {"B": 0, "W": K}
def create_bound(p, K, ub):
if p - K + 1 >= 0:
return [(p - K + 1, p + 1)]
else:
return [(0, p + 1), ((p - K + 1) % ub, ub)]
for i... | #!/usr/bin/env python3
# coding=utf-8
import sys
import numpy as np
n, k = list(map(int, sys.stdin.readline().strip().split(" ")))
xyc = [l.strip().split(" ") for l in sys.stdin.readlines()]
xy = [(int(_x) % (2 * k), int(_y) % (2 * k) if _c == "W" else (int(_y) + k) % (2 * k))
for (_x, _y, _c) in xyc... | 32 | 39 | 861 | 1,116 | import numpy as np
N, K = list(map(int, input().split()))
ub = K * 2
b = [[0 for j in range(ub + 1)] for i in range(ub + 1)]
ADD = {"B": 0, "W": K}
def create_bound(p, K, ub):
if p - K + 1 >= 0:
return [(p - K + 1, p + 1)]
else:
return [(0, p + 1), ((p - K + 1) % ub, ub)]
for i in range(N):... | #!/usr/bin/env python3
# coding=utf-8
import sys
import numpy as np
n, k = list(map(int, sys.stdin.readline().strip().split(" ")))
xyc = [l.strip().split(" ") for l in sys.stdin.readlines()]
xy = [
(int(_x) % (2 * k), int(_y) % (2 * k) if _c == "W" else (int(_y) + k) % (2 * k))
for (_x, _y, _c) in xyc
]
# ans ... | false | 17.948718 | [
"+#!/usr/bin/env python3",
"+# coding=utf-8",
"+import sys",
"-N, K = list(map(int, input().split()))",
"-ub = K * 2",
"-b = [[0 for j in range(ub + 1)] for i in range(ub + 1)]",
"-ADD = {\"B\": 0, \"W\": K}",
"-",
"-",
"-def create_bound(p, K, ub):",
"- if p - K + 1 >= 0:",
"- retur... | false | 0.494589 | 0.479011 | 1.03252 | [
"s615463477",
"s123194098"
] |
u714538557 | p02659 | python | s924381924 | s149482846 | 23 | 21 | 9,104 | 9,144 | Accepted | Accepted | 8.7 | ab = input().split()
A = int(ab[0])
B = int(float(ab[1]) * 100 + .5)
A *= B
print((A // 100)) | ab = input().split()
A = int(ab[0])
B = int(ab[1].split(".")[0])
C = int(ab[1].split(".")[1])
print((A * B + (A * C) // 100)) | 7 | 6 | 99 | 129 | ab = input().split()
A = int(ab[0])
B = int(float(ab[1]) * 100 + 0.5)
A *= B
print((A // 100))
| ab = input().split()
A = int(ab[0])
B = int(ab[1].split(".")[0])
C = int(ab[1].split(".")[1])
print((A * B + (A * C) // 100))
| false | 14.285714 | [
"-B = int(float(ab[1]) * 100 + 0.5)",
"-A *= B",
"-print((A // 100))",
"+B = int(ab[1].split(\".\")[0])",
"+C = int(ab[1].split(\".\")[1])",
"+print((A * B + (A * C) // 100))"
] | false | 0.038725 | 0.041061 | 0.943088 | [
"s924381924",
"s149482846"
] |
u437632122 | p03478 | python | s236180689 | s678490765 | 206 | 182 | 42,460 | 39,408 | Accepted | Accepted | 11.65 | n, a, b = list(map(int, input().split()))
ans = 0
for i in range(0, n + 1):
if a <= sum([int(j) for j in str(i)]) <= b:
ans += i
print(ans) | n, a, b = list(map(int, input().split()))
ans = 0
def sum_(m):
res = 0
while m > 0:
res += m % 10
m //= 10
return res
for i in range(0, n + 1):
# if a <= sum([int(j) for j in str(i)]) <= b:
if a <= sum_(i) <= b:
ans += i
print(ans)
| 6 | 17 | 150 | 294 | n, a, b = list(map(int, input().split()))
ans = 0
for i in range(0, n + 1):
if a <= sum([int(j) for j in str(i)]) <= b:
ans += i
print(ans)
| n, a, b = list(map(int, input().split()))
ans = 0
def sum_(m):
res = 0
while m > 0:
res += m % 10
m //= 10
return res
for i in range(0, n + 1):
# if a <= sum([int(j) for j in str(i)]) <= b:
if a <= sum_(i) <= b:
ans += i
print(ans)
| false | 64.705882 | [
"+",
"+",
"+def sum_(m):",
"+ res = 0",
"+ while m > 0:",
"+ res += m % 10",
"+ m //= 10",
"+ return res",
"+",
"+",
"- if a <= sum([int(j) for j in str(i)]) <= b:",
"+ # if a <= sum([int(j) for j in str(i)]) <= b:",
"+ if a <= sum_(i) <= b:"
] | false | 0.040457 | 0.035003 | 1.15581 | [
"s236180689",
"s678490765"
] |
u462329577 | p02767 | python | s511361327 | s650900168 | 21 | 17 | 3,060 | 2,940 | Accepted | Accepted | 19.05 | #!/usr/bin/env python3
n = int(eval(input()))
x = list(map(int,input().split()))
ans = 10**6
for i in range(1,101):
k = 0
for j in range(n):
k += (x[j]-i) **2
ans = min(ans,k)
print(ans) | #!/usr/bin/env python3
n = int(eval(input()))
x = list(map(int,input().split()))
print((sum((i-round(sum(x)/n))**2 for i in x)))
#x**2 - 2*x + p**2 ใp ใงๅพฎๅใใใจp ไฝ็ฝฎใๅใใใใจใใฎๅขๅ ้ใใใใ
# ๏ผๆฌกๆน็จๅผใซใชใฃใฆใใฆ minใฏ้ๅฟใฎใจใ round ใใใฐ่ฏใ | 10 | 6 | 199 | 209 | #!/usr/bin/env python3
n = int(eval(input()))
x = list(map(int, input().split()))
ans = 10**6
for i in range(1, 101):
k = 0
for j in range(n):
k += (x[j] - i) ** 2
ans = min(ans, k)
print(ans)
| #!/usr/bin/env python3
n = int(eval(input()))
x = list(map(int, input().split()))
print((sum((i - round(sum(x) / n)) ** 2 for i in x)))
# x**2 - 2*x + p**2 ใp ใงๅพฎๅใใใจp ไฝ็ฝฎใๅใใใใจใใฎๅขๅ ้ใใใใ
# ๏ผๆฌกๆน็จๅผใซใชใฃใฆใใฆ minใฏ้ๅฟใฎใจใ round ใใใฐ่ฏใ
| false | 40 | [
"-ans = 10**6",
"-for i in range(1, 101):",
"- k = 0",
"- for j in range(n):",
"- k += (x[j] - i) ** 2",
"- ans = min(ans, k)",
"-print(ans)",
"+print((sum((i - round(sum(x) / n)) ** 2 for i in x)))",
"+# x**2 - 2*x + p**2 ใp ใงๅพฎๅใใใจp ไฝ็ฝฎใๅใใใใจใใฎๅขๅ ้ใใใใ",
"+# ๏ผๆฌกๆน็จๅผใซใชใฃใฆใใฆ minใฏ้ๅฟใฎใจใ ro... | false | 0.036802 | 0.042362 | 0.868743 | [
"s511361327",
"s650900168"
] |
u969850098 | p03127 | python | s718842864 | s392265964 | 131 | 71 | 14,180 | 14,252 | Accepted | Accepted | 45.8 | from heapq import heapify, heappush, heappop
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
heapify(A)
while len(A) > 1:
m = heappop(A)
A = [a % m for a in A if a % m != 0]
A.append((m))
print(m)
if __name__ == "__main__":
main() | def main():
N = int(eval(input()))
A = list(map(int, input().split()))
while len(A) > 1:
m = min(A)
A = [a % m for a in A if a % m != 0]
A.append((m))
print(m)
if __name__ == "__main__":
main() | 16 | 13 | 314 | 246 | from heapq import heapify, heappush, heappop
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
heapify(A)
while len(A) > 1:
m = heappop(A)
A = [a % m for a in A if a % m != 0]
A.append((m))
print(m)
if __name__ == "__main__":
main()
| def main():
N = int(eval(input()))
A = list(map(int, input().split()))
while len(A) > 1:
m = min(A)
A = [a % m for a in A if a % m != 0]
A.append((m))
print(m)
if __name__ == "__main__":
main()
| false | 18.75 | [
"-from heapq import heapify, heappush, heappop",
"-",
"-",
"- heapify(A)",
"- m = heappop(A)",
"+ m = min(A)"
] | false | 0.099856 | 0.052001 | 1.920267 | [
"s718842864",
"s392265964"
] |
u672220554 | p02948 | python | s243414949 | s968519154 | 435 | 378 | 18,360 | 18,464 | Accepted | Accepted | 13.1 | import heapq
n,m = list(map(int,input().split()))
lb = [[] for _ in range(10**5+5)]
for _ in range(n):
a,b = list(map(int,input().split()))
lb[a].append(b)
res = 0
q = []
heapq.heapify(q)
for i in range(1,m+1):
for b in lb[i]:
heapq.heappush(q,b * (-1))
if q:
res += heapq.... | import heapq
def main():
n,m = list(map(int,input().split()))
lb = [[] for _ in range(10**5+5)]
for _ in range(n):
a,b = list(map(int,input().split()))
lb[a].append(b)
res = 0
q = []
heapq.heapify(q)
for i in range(1,m+1):
for b in lb[i]:
heapq... | 17 | 19 | 339 | 416 | import heapq
n, m = list(map(int, input().split()))
lb = [[] for _ in range(10**5 + 5)]
for _ in range(n):
a, b = list(map(int, input().split()))
lb[a].append(b)
res = 0
q = []
heapq.heapify(q)
for i in range(1, m + 1):
for b in lb[i]:
heapq.heappush(q, b * (-1))
if q:
res += heapq.heap... | import heapq
def main():
n, m = list(map(int, input().split()))
lb = [[] for _ in range(10**5 + 5)]
for _ in range(n):
a, b = list(map(int, input().split()))
lb[a].append(b)
res = 0
q = []
heapq.heapify(q)
for i in range(1, m + 1):
for b in lb[i]:
heapq.... | false | 10.526316 | [
"-n, m = list(map(int, input().split()))",
"-lb = [[] for _ in range(10**5 + 5)]",
"-for _ in range(n):",
"- a, b = list(map(int, input().split()))",
"- lb[a].append(b)",
"-res = 0",
"-q = []",
"-heapq.heapify(q)",
"-for i in range(1, m + 1):",
"- for b in lb[i]:",
"- heapq.heapp... | false | 0.073875 | 0.059444 | 1.242769 | [
"s243414949",
"s968519154"
] |
u555962250 | p03163 | python | s042161970 | s448389735 | 608 | 348 | 87,652 | 41,836 | Accepted | Accepted | 42.76 | N, W = list(map(int, input().split()))
dp = {}
for i in range(W + 1):
dp[i] = 0
for i in range(N):
w, v = list(map(int, input().split()))
for j in range(W - w, -1, -1):
dp[j + w] = max(dp[j + w], dp[j] + v)
print((dp[W])) | N, W = list(map(int, input().split()))
dp = [[0] * (W + 1)] * (N + 1)
for i in range(N):
w, v = list(map(int, input().split()))
for j in range(W - w, -1, -1):
dp[i+1][j + w] = max(dp[i][j + w], dp[i][j] + v)
print((dp[N][W])) | 9 | 7 | 235 | 233 | N, W = list(map(int, input().split()))
dp = {}
for i in range(W + 1):
dp[i] = 0
for i in range(N):
w, v = list(map(int, input().split()))
for j in range(W - w, -1, -1):
dp[j + w] = max(dp[j + w], dp[j] + v)
print((dp[W]))
| N, W = list(map(int, input().split()))
dp = [[0] * (W + 1)] * (N + 1)
for i in range(N):
w, v = list(map(int, input().split()))
for j in range(W - w, -1, -1):
dp[i + 1][j + w] = max(dp[i][j + w], dp[i][j] + v)
print((dp[N][W]))
| false | 22.222222 | [
"-dp = {}",
"-for i in range(W + 1):",
"- dp[i] = 0",
"+dp = [[0] * (W + 1)] * (N + 1)",
"- dp[j + w] = max(dp[j + w], dp[j] + v)",
"-print((dp[W]))",
"+ dp[i + 1][j + w] = max(dp[i][j + w], dp[i][j] + v)",
"+print((dp[N][W]))"
] | false | 0.032277 | 0.032064 | 1.006656 | [
"s042161970",
"s448389735"
] |
u785578220 | p02866 | python | s460333698 | s242916026 | 213 | 69 | 53,300 | 13,908 | Accepted | Accepted | 67.61 | a = int(eval(input()))
l = list(map(int,input().split()))
MOD = 998244353
dp = [0]*a
for i in l:
dp[i]+=1
res = 1
# print(dp)
if l[0]!=0:
print((0))
exit()
for i in l[1:]:
# print(i)
res*=dp[i-1]
res%=MOD
print((res%MOD)) | a = int(eval(input()))
l = list(map(int,input().split()))
d = [0]*a
for i in l:
d[i]+=1
r =1
if l[0]!=0:
print((0))
exit()
for i in l[1:]:
r=r*d[i-1]%998244353
print(r) | 18 | 12 | 255 | 188 | a = int(eval(input()))
l = list(map(int, input().split()))
MOD = 998244353
dp = [0] * a
for i in l:
dp[i] += 1
res = 1
# print(dp)
if l[0] != 0:
print((0))
exit()
for i in l[1:]:
# print(i)
res *= dp[i - 1]
res %= MOD
print((res % MOD))
| a = int(eval(input()))
l = list(map(int, input().split()))
d = [0] * a
for i in l:
d[i] += 1
r = 1
if l[0] != 0:
print((0))
exit()
for i in l[1:]:
r = r * d[i - 1] % 998244353
print(r)
| false | 33.333333 | [
"-MOD = 998244353",
"-dp = [0] * a",
"+d = [0] * a",
"- dp[i] += 1",
"-res = 1",
"-# print(dp)",
"+ d[i] += 1",
"+r = 1",
"- # print(i)",
"- res *= dp[i - 1]",
"- res %= MOD",
"-print((res % MOD))",
"+ r = r * d[i - 1] % 998244353",
"+print(r)"
] | false | 0.084046 | 0.045857 | 1.832783 | [
"s460333698",
"s242916026"
] |
u506858457 | p02837 | python | s327659586 | s500551357 | 151 | 115 | 3,188 | 3,064 | Accepted | Accepted | 23.84 | '''
Nไบบใฎใๆญฃ็ด่
ใใใไธ่ฆชๅใชไบบใใฎใในใฆใฎ็ตใฟๅใใใ็ๆใใ
ๆญฃ็ด่
ใฎ่จผ่จใ็ตใฟๅใใใซ็็พใใฆใใชใใ็ขบ่ชใใ.
็็พใใฆใใชใ็ตใฟๅใใใฎๆญฃ็ด่
ใฎๆๅคงๆฐใ่งฃ็ญ.
็ตใฟๅใใใฏ bit ใง่กจ็พใใฆใใ. Nใใใ็จๆใใ
1ใ็ซใฃใฆใใใจๆญฃ็ด่
ใ0ใ ใจไธ่ฆชๅใชไบบ.
ใใฎ็ตใฟๅใใ็ถๆณใจๆญฃ็ด่
ใฎ่จผ่จใ็็พใใชใใ็ขบ่ชใใ.
'''
N = int(eval(input()))
evidences = [[] for _ in range(N)]
for i in range(N):
A = int(eval(input()))
for _ in range(A):
... | import itertools
N = int(eval(input()))
evidence_dit = {}
for i in range(N):
A = int(eval(input()))
x_y = []
if A == 0:
evidence_dit[i] = []
for j in range(A):
x_y.append(list(map(int,input().split())))
evidence_dit[i] = x_y
ans = 0
attribute = [0,1]
for ... | 32 | 49 | 791 | 1,330 | """
Nไบบใฎใๆญฃ็ด่
ใใใไธ่ฆชๅใชไบบใใฎใในใฆใฎ็ตใฟๅใใใ็ๆใใ
ๆญฃ็ด่
ใฎ่จผ่จใ็ตใฟๅใใใซ็็พใใฆใใชใใ็ขบ่ชใใ.
็็พใใฆใใชใ็ตใฟๅใใใฎๆญฃ็ด่
ใฎๆๅคงๆฐใ่งฃ็ญ.
็ตใฟๅใใใฏ bit ใง่กจ็พใใฆใใ. Nใใใ็จๆใใ
1ใ็ซใฃใฆใใใจๆญฃ็ด่
ใ0ใ ใจไธ่ฆชๅใชไบบ.
ใใฎ็ตใฟๅใใ็ถๆณใจๆญฃ็ด่
ใฎ่จผ่จใ็็พใใชใใ็ขบ่ชใใ.
"""
N = int(eval(input()))
evidences = [[] for _ in range(N)]
for i in range(N):
A = int(eval(input()))
for _ in range(A):
x, y = list... | import itertools
N = int(eval(input()))
evidence_dit = {}
for i in range(N):
A = int(eval(input()))
x_y = []
if A == 0:
evidence_dit[i] = []
for j in range(A):
x_y.append(list(map(int, input().split())))
evidence_dit[i] = x_y
ans = 0
attribute = [0, 1]
for i in itertools.product... | false | 34.693878 | [
"-\"\"\"",
"-Nไบบใฎใๆญฃ็ด่
ใใใไธ่ฆชๅใชไบบใใฎใในใฆใฎ็ตใฟๅใใใ็ๆใใ",
"-ๆญฃ็ด่
ใฎ่จผ่จใ็ตใฟๅใใใซ็็พใใฆใใชใใ็ขบ่ชใใ.",
"-็็พใใฆใใชใ็ตใฟๅใใใฎๆญฃ็ด่
ใฎๆๅคงๆฐใ่งฃ็ญ.",
"-็ตใฟๅใใใฏ bit ใง่กจ็พใใฆใใ. Nใใใ็จๆใใ",
"-1ใ็ซใฃใฆใใใจๆญฃ็ด่
ใ0ใ ใจไธ่ฆชๅใชไบบ.",
"-ใใฎ็ตใฟๅใใ็ถๆณใจๆญฃ็ด่
ใฎ่จผ่จใ็็พใใชใใ็ขบ่ชใใ.",
"-\"\"\"",
"+import itertools",
"+",
"-evidences = [[] for _ in range(N)]",
"+evidence_dit = {}... | false | 0.054328 | 0.076681 | 0.708492 | [
"s327659586",
"s500551357"
] |
u367701763 | p02973 | python | s461650113 | s860951005 | 262 | 134 | 8,828 | 79,404 | Accepted | Accepted | 48.85 | # https://atcoder.jp/contests/abc134/tasks/abc134_eใ
from bisect import bisect_left
from collections import *
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
LIS = deque([A[0]])
cnt = 0
for a in A[1:]:
if a <= LIS[0]:
LIS.appendleft(a)
else:
ind = bisect_le... | def LIS(A):
dp = deque([A[0]])
for a in A[1:]:
if a <= dp[0]:
dp.appendleft(a)
else:
dp[bisect_left(dp, a)-1] = a
return len(dp)
##################################################################################################################
import sys
... | 20 | 21 | 362 | 487 | # https://atcoder.jp/contests/abc134/tasks/abc134_e
from bisect import bisect_left
from collections import *
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
LIS = deque([A[0]])
cnt = 0
for a in A[1:]:
if a <= LIS[0]:
LIS.appendleft(a)
else:
ind = bisect_left(LIS, a) - 1
... | def LIS(A):
dp = deque([A[0]])
for a in A[1:]:
if a <= dp[0]:
dp.appendleft(a)
else:
dp[bisect_left(dp, a) - 1] = a
return len(dp)
##################################################################################################################
import sys
input = ... | false | 4.761905 | [
"-# https://atcoder.jp/contests/abc134/tasks/abc134_e",
"+def LIS(A):",
"+ dp = deque([A[0]])",
"+ for a in A[1:]:",
"+ if a <= dp[0]:",
"+ dp.appendleft(a)",
"+ else:",
"+ dp[bisect_left(dp, a) - 1] = a",
"+ return len(dp)",
"+",
"+",
"+###########... | false | 0.039629 | 0.036541 | 1.084521 | [
"s461650113",
"s860951005"
] |
u537782349 | p03778 | python | s955276829 | s658105305 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | w, a, b = list(map(int, input().split()))
aw = a + w
bw = b + w
if a < aw < b < bw:
print((b-aw))
elif b < bw < a < aw:
print((a-bw))
else:
print((0))
| w, a, b = list(map(int, input().split()))
if a <= a + w <= b <= b + w:
print((b - a - w))
elif a <= b <= a + w <= b + w:
print((0))
elif b <= a <= a + w <= b + w:
print((0))
elif b <= b + w <= a <= a + w:
print((a - b - w))
| 9 | 10 | 159 | 236 | w, a, b = list(map(int, input().split()))
aw = a + w
bw = b + w
if a < aw < b < bw:
print((b - aw))
elif b < bw < a < aw:
print((a - bw))
else:
print((0))
| w, a, b = list(map(int, input().split()))
if a <= a + w <= b <= b + w:
print((b - a - w))
elif a <= b <= a + w <= b + w:
print((0))
elif b <= a <= a + w <= b + w:
print((0))
elif b <= b + w <= a <= a + w:
print((a - b - w))
| false | 10 | [
"-aw = a + w",
"-bw = b + w",
"-if a < aw < b < bw:",
"- print((b - aw))",
"-elif b < bw < a < aw:",
"- print((a - bw))",
"-else:",
"+if a <= a + w <= b <= b + w:",
"+ print((b - a - w))",
"+elif a <= b <= a + w <= b + w:",
"+elif b <= a <= a + w <= b + w:",
"+ print((0))",
"+eli... | false | 0.053222 | 0.054614 | 0.974503 | [
"s955276829",
"s658105305"
] |
u903005414 | p02971 | python | s094538444 | s817207572 | 562 | 303 | 14,132 | 14,112 | Accepted | Accepted | 46.09 | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
b = sorted(a)
for i in range(n):
if a[i] == b[-1]:
print((b[-2]))
else:
print((b[-1]))
| import sys
input = sys.stdin.buffer.readline
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
max_A = max(A)
sorted_A = sorted(A, reverse=True)
if sorted_A[1] == max_A:
for _ in range(N):
print(max_A)
exit()
for a in A:
if a == max_A:
print((sorted_A[1]))
... | 10 | 16 | 160 | 334 | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
b = sorted(a)
for i in range(n):
if a[i] == b[-1]:
print((b[-2]))
else:
print((b[-1]))
| import sys
input = sys.stdin.buffer.readline
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
max_A = max(A)
sorted_A = sorted(A, reverse=True)
if sorted_A[1] == max_A:
for _ in range(N):
print(max_A)
exit()
for a in A:
if a == max_A:
print((sorted_A[1]))
else:
... | false | 37.5 | [
"-n = int(eval(input()))",
"-a = [int(eval(input())) for _ in range(n)]",
"-b = sorted(a)",
"-for i in range(n):",
"- if a[i] == b[-1]:",
"- print((b[-2]))",
"+import sys",
"+",
"+input = sys.stdin.buffer.readline",
"+N = int(eval(input()))",
"+A = [int(eval(input())) for _ in range(N)... | false | 0.034144 | 0.03664 | 0.931883 | [
"s094538444",
"s817207572"
] |
u548545174 | p02695 | python | s140116357 | s643345846 | 1,252 | 228 | 21,484 | 46,812 | Accepted | Accepted | 81.79 | import itertools
N, M, Q = list(map(int, input().split()))
G = [list(map(int, input().split())) for i in range(Q)]
A_cands = list(itertools.combinations_with_replacement(list(range(1, M+1)), N))
ans = 0
for cand in A_cands:
cand_score = 0
for i in range(Q):
a, b, c, d = G[i]
... | import itertools
import numpy as np
N, M, Q = list(map(int, input().split()))
G = [list(map(int, input().split())) for i in range(Q)]
A_cands = np.array(list(itertools.combinations_with_replacement(list(range(1, M+1)), N)))
scores = np.zeros(len(A_cands), dtype=np.int64)
for i in range(Q):
a, b... | 17 | 15 | 433 | 427 | import itertools
N, M, Q = list(map(int, input().split()))
G = [list(map(int, input().split())) for i in range(Q)]
A_cands = list(itertools.combinations_with_replacement(list(range(1, M + 1)), N))
ans = 0
for cand in A_cands:
cand_score = 0
for i in range(Q):
a, b, c, d = G[i]
if cand[b - 1] - ... | import itertools
import numpy as np
N, M, Q = list(map(int, input().split()))
G = [list(map(int, input().split())) for i in range(Q)]
A_cands = np.array(
list(itertools.combinations_with_replacement(list(range(1, M + 1)), N))
)
scores = np.zeros(len(A_cands), dtype=np.int64)
for i in range(Q):
a, b, c, d = G[i... | false | 11.764706 | [
"+import numpy as np",
"-A_cands = list(itertools.combinations_with_replacement(list(range(1, M + 1)), N))",
"-ans = 0",
"-for cand in A_cands:",
"- cand_score = 0",
"- for i in range(Q):",
"- a, b, c, d = G[i]",
"- if cand[b - 1] - cand[a - 1] == c:",
"- cand_score +=... | false | 0.298573 | 0.442059 | 0.675414 | [
"s140116357",
"s643345846"
] |
u302789073 | p03435 | python | s616844909 | s524233134 | 30 | 25 | 9,224 | 9,196 | Accepted | Accepted | 16.67 | c11, c12,c13=[int(i) for i in input().split()]
c21, c22,c23=[int(i) for i in input().split()]
c31, c32,c33=[int(i) for i in input().split()]
ans=0
for a1 in range(c11+1):
b1=c11-a1
b2=c12-a1
b3=c13-a1
a2=c21-b1
a3=c31-b1
if c22==a2+b2 and c23==a2+b3 and c32==a3+b2 and c33==a3+b... | c11,c12,c13=list(map(int, input().split()))
c21,c22,c23=list(map(int, input().split()))
c31,c32,c33=list(map(int, input().split()))
ans="No"
for a1 in range(c11+1):
b1=c11-a1
b2=c12-a1
b3=c13-a1
a2=c21-b1
a3=c31-b1
if c22==a2+b2 and c23==a2+b3 and c32==a3+b2 and c33==a3+b3:
... | 19 | 19 | 405 | 354 | c11, c12, c13 = [int(i) for i in input().split()]
c21, c22, c23 = [int(i) for i in input().split()]
c31, c32, c33 = [int(i) for i in input().split()]
ans = 0
for a1 in range(c11 + 1):
b1 = c11 - a1
b2 = c12 - a1
b3 = c13 - a1
a2 = c21 - b1
a3 = c31 - b1
if c22 == a2 + b2 and c23 == a2 + b3 and c... | c11, c12, c13 = list(map(int, input().split()))
c21, c22, c23 = list(map(int, input().split()))
c31, c32, c33 = list(map(int, input().split()))
ans = "No"
for a1 in range(c11 + 1):
b1 = c11 - a1
b2 = c12 - a1
b3 = c13 - a1
a2 = c21 - b1
a3 = c31 - b1
if c22 == a2 + b2 and c23 == a2 + b3 and c32 ... | false | 0 | [
"-c11, c12, c13 = [int(i) for i in input().split()]",
"-c21, c22, c23 = [int(i) for i in input().split()]",
"-c31, c32, c33 = [int(i) for i in input().split()]",
"-ans = 0",
"+c11, c12, c13 = list(map(int, input().split()))",
"+c21, c22, c23 = list(map(int, input().split()))",
"+c31, c32, c33 = list(map... | false | 0.043866 | 0.043576 | 1.006663 | [
"s616844909",
"s524233134"
] |
u833436666 | p03578 | python | s113450949 | s083216861 | 479 | 267 | 60,376 | 57,016 | Accepted | Accepted | 44.26 | import math
import sys
import collections
N=int(eval(input()))
D = list(map(int, input().split()))
M=int(eval(input()))
T = list(map(int, input().split()))
new_D=sorted(D)
new_T=sorted(T)
a=collections.Counter(new_D)
b=collections.Counter(new_T)
#print(a[10])
#print(new_D[0])
for i in new_T:
if a[i]<... | import collections
import sys
N=int(eval(input()))
D = list(map(int, input().split()))
M=int(eval(input()))
T = list(map(int, input().split()))
D_count=collections.Counter(D)
T_count=collections.Counter(T)
for i in T:
if D_count[i]<T_count[i]:
print("NO")
sys.exit()
print("YES") | 20 | 13 | 380 | 301 | import math
import sys
import collections
N = int(eval(input()))
D = list(map(int, input().split()))
M = int(eval(input()))
T = list(map(int, input().split()))
new_D = sorted(D)
new_T = sorted(T)
a = collections.Counter(new_D)
b = collections.Counter(new_T)
# print(a[10])
# print(new_D[0])
for i in new_T:
if a[i] ... | import collections
import sys
N = int(eval(input()))
D = list(map(int, input().split()))
M = int(eval(input()))
T = list(map(int, input().split()))
D_count = collections.Counter(D)
T_count = collections.Counter(T)
for i in T:
if D_count[i] < T_count[i]:
print("NO")
sys.exit()
print("YES")
| false | 35 | [
"-import math",
"+import collections",
"-import collections",
"-new_D = sorted(D)",
"-new_T = sorted(T)",
"-a = collections.Counter(new_D)",
"-b = collections.Counter(new_T)",
"-# print(a[10])",
"-# print(new_D[0])",
"-for i in new_T:",
"- if a[i] < b[i]:",
"+D_count = collections.Counter(D... | false | 0.038307 | 0.037303 | 1.026917 | [
"s113450949",
"s083216861"
] |
u540698208 | p02887 | python | s354336312 | s475567152 | 43 | 39 | 4,724 | 3,956 | Accepted | Accepted | 9.3 | from sys import stdin
from itertools import groupby
n = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()
l = [x for x in s]
new = []
for key, value in groupby(l):
new.append(key)
print((len(new)))
| from sys import stdin
from itertools import groupby
n = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()
new = []
for key, value in groupby(s):
new.append(key)
print((len(new))) | 12 | 11 | 225 | 204 | from sys import stdin
from itertools import groupby
n = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()
l = [x for x in s]
new = []
for key, value in groupby(l):
new.append(key)
print((len(new)))
| from sys import stdin
from itertools import groupby
n = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()
new = []
for key, value in groupby(s):
new.append(key)
print((len(new)))
| false | 8.333333 | [
"-l = [x for x in s]",
"-for key, value in groupby(l):",
"+for key, value in groupby(s):"
] | false | 0.03667 | 0.136473 | 0.268699 | [
"s354336312",
"s475567152"
] |
u129978636 | p03337 | python | s327262315 | s478780284 | 19 | 17 | 3,316 | 2,940 | Accepted | Accepted | 10.53 | A, B = list(map( int, input().split()))
C1 = A + B
C2 = A - B
C3 = A * B
C = [ C1, C2, C3]
C = sorted(C)
print((C[2]))
| A, B = list(map( int, input().split()))
C1 = A + B
C2 = A - B
C3 = A * B
C = [ C1, C2, C3]
print((max(C))) | 13 | 11 | 129 | 113 | A, B = list(map(int, input().split()))
C1 = A + B
C2 = A - B
C3 = A * B
C = [C1, C2, C3]
C = sorted(C)
print((C[2]))
| A, B = list(map(int, input().split()))
C1 = A + B
C2 = A - B
C3 = A * B
C = [C1, C2, C3]
print((max(C)))
| false | 15.384615 | [
"-C = sorted(C)",
"-print((C[2]))",
"+print((max(C)))"
] | false | 0.145108 | 0.066876 | 2.169799 | [
"s327262315",
"s478780284"
] |
u729133443 | p03219 | python | s729086992 | s803011494 | 166 | 24 | 38,256 | 9,096 | Accepted | Accepted | 85.54 | print((eval(input().replace(' ','+')+'//2'))) | a,b=list(map(int,input().split()))
print((a+b//2)) | 1 | 2 | 43 | 43 | print((eval(input().replace(" ", "+") + "//2")))
| a, b = list(map(int, input().split()))
print((a + b // 2))
| false | 50 | [
"-print((eval(input().replace(\" \", \"+\") + \"//2\")))",
"+a, b = list(map(int, input().split()))",
"+print((a + b // 2))"
] | false | 0.040663 | 0.040941 | 0.993215 | [
"s729086992",
"s803011494"
] |
u969850098 | p02990 | python | s364412705 | s253483946 | 203 | 100 | 3,316 | 3,316 | Accepted | Accepted | 50.74 | from math import factorial
N, K = list(map(int, input().split()))
n_blue, n_red = K, N-K
for k in range(1, K+1):
if k-1 > n_red:
print((0))
continue
retval = (factorial(n_red+1) // (factorial(n_red-k+1) * factorial(k))) * (factorial(n_blue-1) // (factorial(n_blue-k) * factorial(k-1)))... | import sys
readline = sys.stdin.readline
from math import factorial
MOD = 10 ** 9 + 7
def main():
N, K = list(map(int, readline().rstrip().split()))
f1 = factorial(N-K+1)
f2 = factorial(K-1)
f3 = 1
for i in range(1, K+1):
if N - K + 1 - i < 0:
print((0))
... | 11 | 22 | 345 | 499 | from math import factorial
N, K = list(map(int, input().split()))
n_blue, n_red = K, N - K
for k in range(1, K + 1):
if k - 1 > n_red:
print((0))
continue
retval = (factorial(n_red + 1) // (factorial(n_red - k + 1) * factorial(k))) * (
factorial(n_blue - 1) // (factorial(n_blue - k) * f... | import sys
readline = sys.stdin.readline
from math import factorial
MOD = 10**9 + 7
def main():
N, K = list(map(int, readline().rstrip().split()))
f1 = factorial(N - K + 1)
f2 = factorial(K - 1)
f3 = 1
for i in range(1, K + 1):
if N - K + 1 - i < 0:
print((0))
con... | false | 50 | [
"+import sys",
"+",
"+readline = sys.stdin.readline",
"-N, K = list(map(int, input().split()))",
"-n_blue, n_red = K, N - K",
"-for k in range(1, K + 1):",
"- if k - 1 > n_red:",
"- print((0))",
"- continue",
"- retval = (factorial(n_red + 1) // (factorial(n_red - k + 1) * fact... | false | 0.047412 | 0.038932 | 1.217833 | [
"s364412705",
"s253483946"
] |
u831244171 | p02421 | python | s259885529 | s051961279 | 40 | 20 | 7,632 | 7,624 | Accepted | Accepted | 50 | n = int(eval(input()))
Taro = 0
Hanako = 0
for i in range(n):
x = 0
t,h = input().split()
for j in range(min(len(t),len(h))):
if t == h:
Hanako += 1
Taro += 1
x = 1
break
if ord(t[j:j+1]) > ord(h[j:j+1]):
Taro += 3
... | n = int(eval(input()))
Taro = 0
Hanako = 0
for i in range(n):
t,h = input().split()
if t == h:
Hanako += 1
Taro += 1
elif t> h:
Taro += 3
else:
Hanako += 3
print(("{} {}".format(Taro,Hanako))) | 29 | 14 | 621 | 247 | n = int(eval(input()))
Taro = 0
Hanako = 0
for i in range(n):
x = 0
t, h = input().split()
for j in range(min(len(t), len(h))):
if t == h:
Hanako += 1
Taro += 1
x = 1
break
if ord(t[j : j + 1]) > ord(h[j : j + 1]):
Taro += 3
... | n = int(eval(input()))
Taro = 0
Hanako = 0
for i in range(n):
t, h = input().split()
if t == h:
Hanako += 1
Taro += 1
elif t > h:
Taro += 3
else:
Hanako += 3
print(("{} {}".format(Taro, Hanako)))
| false | 51.724138 | [
"- x = 0",
"- for j in range(min(len(t), len(h))):",
"- if t == h:",
"- Hanako += 1",
"- Taro += 1",
"- x = 1",
"- break",
"- if ord(t[j : j + 1]) > ord(h[j : j + 1]):",
"- Taro += 3",
"- x = 1",
"- ... | false | 0.14164 | 0.04892 | 2.895324 | [
"s259885529",
"s051961279"
] |
u058781705 | p03282 | python | s564483352 | s272778854 | 186 | 170 | 38,256 | 39,664 | Accepted | Accepted | 8.6 |
import collections
def solve():
S = list(eval(input()))
K = int(eval(input()))
for i in range(K):
if S[i] != "1":
print((S[i]))
break
else:
print((1))
if __name__ == "__main__":
solve()
|
import collections
def solve():
S = list(eval(input()))
K = int(eval(input()))
for i in range(K):
if S[i] != "1":
print((S[i]))
exit()
print((1))
if __name__ == "__main__":
solve()
| 20 | 19 | 257 | 243 | import collections
def solve():
S = list(eval(input()))
K = int(eval(input()))
for i in range(K):
if S[i] != "1":
print((S[i]))
break
else:
print((1))
if __name__ == "__main__":
solve()
| import collections
def solve():
S = list(eval(input()))
K = int(eval(input()))
for i in range(K):
if S[i] != "1":
print((S[i]))
exit()
print((1))
if __name__ == "__main__":
solve()
| false | 5 | [
"- break",
"- else:",
"- print((1))",
"+ exit()",
"+ print((1))"
] | false | 0.039588 | 0.06976 | 0.567489 | [
"s564483352",
"s272778854"
] |
u309977459 | p03283 | python | s125350376 | s327235254 | 953 | 630 | 25,048 | 18,292 | Accepted | Accepted | 33.89 | from sys import stdin
#from pprint import pprint
input = stdin.readline
N, M, Q = map(int, input().split())
count = [[0]*(N+1) for _ in range(N+1)]
for i in range(M):
l, r = map(int, input().split())
count[l][r] += 1
# pprint(count)
accum = [[0]*(N+1) for _ in range(N+1)]
for i in range(N+1):
... | from sys import stdin
from itertools import accumulate
from pprint import pprint
input = stdin.readline
N, M, Q = list(map(int, input().split()))
count = [[0]*(N+1) for _ in range(N+1)]
for i in range(M):
l, r = list(map(int, input().split()))
count[l][r] += 1
# pprint(count)
#accum = [[0]*(N+1)... | 34 | 38 | 910 | 1,076 | from sys import stdin
# from pprint import pprint
input = stdin.readline
N, M, Q = map(int, input().split())
count = [[0] * (N + 1) for _ in range(N + 1)]
for i in range(M):
l, r = map(int, input().split())
count[l][r] += 1
# pprint(count)
accum = [[0] * (N + 1) for _ in range(N + 1)]
for i in range(N + 1):
... | from sys import stdin
from itertools import accumulate
from pprint import pprint
input = stdin.readline
N, M, Q = list(map(int, input().split()))
count = [[0] * (N + 1) for _ in range(N + 1)]
for i in range(M):
l, r = list(map(int, input().split()))
count[l][r] += 1
# pprint(count)
# accum = [[0]*(N+1) for _ i... | false | 10.526316 | [
"+from itertools import accumulate",
"+from pprint import pprint",
"-# from pprint import pprint",
"-N, M, Q = map(int, input().split())",
"+N, M, Q = list(map(int, input().split()))",
"- l, r = map(int, input().split())",
"+ l, r = list(map(int, input().split()))",
"-accum = [[0] * (N + 1) for ... | false | 0.076948 | 0.036849 | 2.088209 | [
"s125350376",
"s327235254"
] |
u186838327 | p02891 | python | s893755085 | s668888171 | 170 | 68 | 38,256 | 61,992 | Accepted | Accepted | 60 | s = list(str(eval(input())))
k = int(eval(input()))
n = len(s)
cur = s[0]
L = []
cnt = 0
for i in range(n):
if cur == s[i]:
cnt += 1
else:
L.append(cnt)
cur = s[i]
cnt = 1
else:
L.append(cnt)
#print(L)
if s[0] != s[-1]:
C = 0
for i in range(len... | s = str(eval(input()))
k = int(eval(input()))
n = len(s)
s_ = list(s)
if len(set(s_)) == 1:
print(((n*k)//2))
exit()
cur = s[0]
X = []
cnt = 0
for i in range(n):
if s[i] != cur:
X.append(cnt)
cur = s[i]
cnt = 1
else:
cnt += 1
else:
X.append(cnt... | 36 | 38 | 642 | 621 | s = list(str(eval(input())))
k = int(eval(input()))
n = len(s)
cur = s[0]
L = []
cnt = 0
for i in range(n):
if cur == s[i]:
cnt += 1
else:
L.append(cnt)
cur = s[i]
cnt = 1
else:
L.append(cnt)
# print(L)
if s[0] != s[-1]:
C = 0
for i in range(len(L)):
if L[i] >... | s = str(eval(input()))
k = int(eval(input()))
n = len(s)
s_ = list(s)
if len(set(s_)) == 1:
print(((n * k) // 2))
exit()
cur = s[0]
X = []
cnt = 0
for i in range(n):
if s[i] != cur:
X.append(cnt)
cur = s[i]
cnt = 1
else:
cnt += 1
else:
X.append(cnt)
# print(X)
ans = 0... | false | 5.263158 | [
"-s = list(str(eval(input())))",
"+s = str(eval(input()))",
"+s_ = list(s)",
"+if len(set(s_)) == 1:",
"+ print(((n * k) // 2))",
"+ exit()",
"-L = []",
"+X = []",
"- if cur == s[i]:",
"- cnt += 1",
"- else:",
"- L.append(cnt)",
"+ if s[i] != cur:",
"+ X... | false | 0.041279 | 0.035396 | 1.166218 | [
"s893755085",
"s668888171"
] |
u912237403 | p00071 | python | s012756919 | s753407047 | 20 | 10 | 4,288 | 4,284 | Accepted | Accepted | 50 | def bomb(x,y):
s=M[y]
if s[x]=="0":return
M[y]=s[:x]+"0"+s[x+1:]
R=[-3,-2,-1,1,2,3]
for e in R:
bomb(x+e,y)
bomb(x,y+e)
return
A=list(range(3,11))
M=["00000000000000" for i in range(14)]
z="000"
n=eval(input())
for i in range(n):
s=input()
for j in A:
... | def bomb(x,y):
s=M[y]
if s[x]=="0":return
M[y]=s[:x]+"0"+s[x+1:]
R=[-3,-2,-1,1,2,3]
for e in R:
bomb(x+e,y)
bomb(x,y+e)
return
A=list(range(14))
B=list(range(3,11))
M=["0"*14 for i in A]
z="000"
n=eval(input())
for i in range(n):
s=input()
for j in B:
... | 24 | 25 | 459 | 454 | def bomb(x, y):
s = M[y]
if s[x] == "0":
return
M[y] = s[:x] + "0" + s[x + 1 :]
R = [-3, -2, -1, 1, 2, 3]
for e in R:
bomb(x + e, y)
bomb(x, y + e)
return
A = list(range(3, 11))
M = ["00000000000000" for i in range(14)]
z = "000"
n = eval(input())
for i in range(n):
... | def bomb(x, y):
s = M[y]
if s[x] == "0":
return
M[y] = s[:x] + "0" + s[x + 1 :]
R = [-3, -2, -1, 1, 2, 3]
for e in R:
bomb(x + e, y)
bomb(x, y + e)
return
A = list(range(14))
B = list(range(3, 11))
M = ["0" * 14 for i in A]
z = "000"
n = eval(input())
for i in range(n):... | false | 4 | [
"-A = list(range(3, 11))",
"-M = [\"00000000000000\" for i in range(14)]",
"+A = list(range(14))",
"+B = list(range(3, 11))",
"+M = [\"0\" * 14 for i in A]",
"- for j in A:",
"+ for j in B:",
"- for j in A:",
"+ for j in B:"
] | false | 0.035869 | 0.041195 | 0.870723 | [
"s012756919",
"s753407047"
] |
u073549161 | p02910 | python | s710469388 | s463458162 | 189 | 166 | 38,256 | 38,384 | Accepted | Accepted | 12.17 | s = eval(input())
d = {}
d[0] = ["R", "U", "D"]
d[1] = ["L", "U", "D"]
res = True
for i in range(len(s)):
if s[i] not in d[i%2]:
res = False
print(("Yes" if res else "No")) | a = ["R", "U", "D"]
b = ["L", "U", "D"]
s = eval(input())
iscan = True
for i in range(len(s)):
if i%2 == 0:
if s[i] not in a:
iscan = False
else:
if s[i] not in b:
iscan = False
print(("Yes" if iscan else "No"))
| 10 | 12 | 187 | 263 | s = eval(input())
d = {}
d[0] = ["R", "U", "D"]
d[1] = ["L", "U", "D"]
res = True
for i in range(len(s)):
if s[i] not in d[i % 2]:
res = False
print(("Yes" if res else "No"))
| a = ["R", "U", "D"]
b = ["L", "U", "D"]
s = eval(input())
iscan = True
for i in range(len(s)):
if i % 2 == 0:
if s[i] not in a:
iscan = False
else:
if s[i] not in b:
iscan = False
print(("Yes" if iscan else "No"))
| false | 16.666667 | [
"+a = [\"R\", \"U\", \"D\"]",
"+b = [\"L\", \"U\", \"D\"]",
"-d = {}",
"-d[0] = [\"R\", \"U\", \"D\"]",
"-d[1] = [\"L\", \"U\", \"D\"]",
"-res = True",
"+iscan = True",
"- if s[i] not in d[i % 2]:",
"- res = False",
"-print((\"Yes\" if res else \"No\"))",
"+ if i % 2 == 0:",
"+ ... | false | 0.045767 | 0.045597 | 1.00372 | [
"s710469388",
"s463458162"
] |
u453055089 | p02550 | python | s198421851 | s069820489 | 72 | 66 | 68,436 | 68,388 | Accepted | Accepted | 8.33 | n, x, m = list(map(int, input().split()))
ans = 0
if x == 0:
print((0))
exit()
elif x == 1:
print(n)
exit()
flag = [False]*m
a = []
while not flag[x]:
flag[x] = True
a.append(x)
x = pow(x, 2, m)
loop_start_idx = a.index(x)
loop_len = len(a) - loop_start_idx
loop_count = (n ... | n, x, m = list(map(int, input().split()))
flag = [False]*m
a = []
while not flag[x]:
flag[x] = True
a.append(x)
x = pow(x, 2, m)
loop_start_idx = a.index(x)
loop_len = len(a) - loop_start_idx
loop_count = (n - loop_start_idx)//loop_len
loop_amari = (n-loop_start_idx)%loop_len
ans = sum(a[:loop_... | 23 | 16 | 528 | 441 | n, x, m = list(map(int, input().split()))
ans = 0
if x == 0:
print((0))
exit()
elif x == 1:
print(n)
exit()
flag = [False] * m
a = []
while not flag[x]:
flag[x] = True
a.append(x)
x = pow(x, 2, m)
loop_start_idx = a.index(x)
loop_len = len(a) - loop_start_idx
loop_count = (n - loop_start_idx... | n, x, m = list(map(int, input().split()))
flag = [False] * m
a = []
while not flag[x]:
flag[x] = True
a.append(x)
x = pow(x, 2, m)
loop_start_idx = a.index(x)
loop_len = len(a) - loop_start_idx
loop_count = (n - loop_start_idx) // loop_len
loop_amari = (n - loop_start_idx) % loop_len
ans = sum(a[:loop_start... | false | 30.434783 | [
"-ans = 0",
"-if x == 0:",
"- print((0))",
"- exit()",
"-elif x == 1:",
"- print(n)",
"- exit()"
] | false | 0.047479 | 0.041865 | 1.134106 | [
"s198421851",
"s069820489"
] |
u133936772 | p02831 | python | s832584821 | s227186069 | 39 | 30 | 5,304 | 9,156 | Accepted | Accepted | 23.08 | a,b=list(map(int,input().split()))
import fractions as f
print((a*b//f.gcd(a,b))) | a,b=list(map(int,input().split()))
from math import *
print((a*b//gcd(a,b))) | 3 | 3 | 75 | 70 | a, b = list(map(int, input().split()))
import fractions as f
print((a * b // f.gcd(a, b)))
| a, b = list(map(int, input().split()))
from math import *
print((a * b // gcd(a, b)))
| false | 0 | [
"-import fractions as f",
"+from math import *",
"-print((a * b // f.gcd(a, b)))",
"+print((a * b // gcd(a, b)))"
] | false | 0.056573 | 0.007716 | 7.332271 | [
"s832584821",
"s227186069"
] |
u163320134 | p03161 | python | s342770105 | s487017514 | 1,978 | 426 | 13,976 | 52,576 | Accepted | Accepted | 78.46 | def solve():
n,k=[int(i) for i in input().split()]
step=[int(i) for i in input().split()]
dp=[0]*n
for i in range(1,n):
dp[i]=min([dp[j] + abs(step[i]-step[j]) for j in range(max(i-k,0),i)])
return dp[n-1]
print((solve()))
| n,k=[int(i) for i in input().split()]
h=[int(i) for i in input().split()]
d=[0]*n
for i in range(1,n):
d[i]=min([d[j] + abs(h[i]-h[j]) for j in range(max(i-k,0),i)])
print((d[n-1])) | 8 | 6 | 242 | 186 | def solve():
n, k = [int(i) for i in input().split()]
step = [int(i) for i in input().split()]
dp = [0] * n
for i in range(1, n):
dp[i] = min([dp[j] + abs(step[i] - step[j]) for j in range(max(i - k, 0), i)])
return dp[n - 1]
print((solve()))
| n, k = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]
d = [0] * n
for i in range(1, n):
d[i] = min([d[j] + abs(h[i] - h[j]) for j in range(max(i - k, 0), i)])
print((d[n - 1]))
| false | 25 | [
"-def solve():",
"- n, k = [int(i) for i in input().split()]",
"- step = [int(i) for i in input().split()]",
"- dp = [0] * n",
"- for i in range(1, n):",
"- dp[i] = min([dp[j] + abs(step[i] - step[j]) for j in range(max(i - k, 0), i)])",
"- return dp[n - 1]",
"-",
"-",
"-prin... | false | 0.037465 | 0.082196 | 0.455795 | [
"s342770105",
"s487017514"
] |
u324314500 | p03283 | python | s478888455 | s229959796 | 732 | 593 | 58,488 | 119,632 | Accepted | Accepted | 18.99 | # D - AtCoder Express 2
# https://atcoder.jp/contests/abc106/tasks/abc106_d
import sys
s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lam... | import sys
from collections import deque # ๅๆนๅใญใฅใผ
from collections import defaultdict # ๅๆๅๆธใฟ่พๆธ
from heapq import heapify, heappush, heappop, heappushpop # ใใฉใคใชใชใใฃใญใฅใผ
from bisect import bisect_left, bisect_right # ไบๅๆข็ดข
#import numpy as np # 1.8.2
#import scipy # 0.13.3
#sys.setrecursionlimit(int(1e+6))
s2... | 70 | 33 | 1,942 | 1,053 | # D - AtCoder Express 2
# https://atcoder.jp/contests/abc106/tasks/abc106_d
import sys
s2nn = lambda s: [int(c) for c in s.split(" ")]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i... | import sys
from collections import deque # ๅๆนๅใญใฅใผ
from collections import defaultdict # ๅๆๅๆธใฟ่พๆธ
from heapq import heapify, heappush, heappop, heappushpop # ใใฉใคใชใชใใฃใญใฅใผ
from bisect import bisect_left, bisect_right # ไบๅๆข็ดข
# import numpy as np # 1.8.2
# import scipy # 0.13.3
# sys.setrecursionlimit(int(1e+6))
s2nn =... | false | 52.857143 | [
"-# D - AtCoder Express 2",
"-# https://atcoder.jp/contests/abc106/tasks/abc106_d",
"+from collections import deque # ๅๆนๅใญใฅใผ",
"+from collections import defaultdict # ๅๆๅๆธใฟ่พๆธ",
"+from heapq import heapify, heappush, heappop, heappushpop # ใใฉใคใชใชใใฃใญใฅใผ",
"+from bisect import bisect_left, bisect_right # ไบ... | false | 0.060996 | 0.095678 | 0.637517 | [
"s478888455",
"s229959796"
] |
u676496404 | p03293 | python | s002792081 | s193287448 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | import sys
s = eval(input())
t = eval(input())
a = int(len(s))
for i in range(0,a) :
s = s[a-1::]+s[:a-1:]
if s == t :
print("Yes")
sys.exit()
print("No") | s = eval(input())
t = eval(input())
if t in (s+s) :
print("Yes")
else :
print("No") | 14 | 7 | 183 | 86 | import sys
s = eval(input())
t = eval(input())
a = int(len(s))
for i in range(0, a):
s = s[a - 1 : :] + s[: a - 1 :]
if s == t:
print("Yes")
sys.exit()
print("No")
| s = eval(input())
t = eval(input())
if t in (s + s):
print("Yes")
else:
print("No")
| false | 50 | [
"-import sys",
"-",
"-a = int(len(s))",
"-for i in range(0, a):",
"- s = s[a - 1 : :] + s[: a - 1 :]",
"- if s == t:",
"- print(\"Yes\")",
"- sys.exit()",
"-print(\"No\")",
"+if t in (s + s):",
"+ print(\"Yes\")",
"+else:",
"+ print(\"No\")"
] | false | 0.041595 | 0.044045 | 0.944386 | [
"s002792081",
"s193287448"
] |
u562935282 | p02669 | python | s566224718 | s078493762 | 1,186 | 131 | 16,516 | 10,924 | Accepted | Accepted | 88.95 | # heapq -> deque
def main():
from collections import defaultdict, deque
inf = 10 ** 27
T = int(eval(input()))
for _ in range(T):
N, A, B, C, D = list(map(int, input().split()))
dq = deque()
dq.append((0, N)) # cost,value
checked = defaultdict(lambda: inf... | # heapq -> deque
def main():
from collections import defaultdict, deque
T = int(eval(input()))
for _ in range(T):
N, A, B, C, D = list(map(int, input().split()))
inf = N * D + 1
dq = deque()
dq.append((0, N)) # cost,value
checked = defaultdict(lamb... | 42 | 44 | 1,122 | 1,118 | # heapq -> deque
def main():
from collections import defaultdict, deque
inf = 10**27
T = int(eval(input()))
for _ in range(T):
N, A, B, C, D = list(map(int, input().split()))
dq = deque()
dq.append((0, N)) # cost,value
checked = defaultdict(lambda: inf)
ans = N ... | # heapq -> deque
def main():
from collections import defaultdict, deque
T = int(eval(input()))
for _ in range(T):
N, A, B, C, D = list(map(int, input().split()))
inf = N * D + 1
dq = deque()
dq.append((0, N)) # cost,value
checked = defaultdict(lambda: inf)
c... | false | 4.545455 | [
"- inf = 10**27",
"+ inf = N * D + 1",
"- ans = N * D + 1",
"+ checked[N] = 0",
"+ ans = inf",
"- if cost >= checked[x]:",
"+ if cost > checked[x]:",
"- checked[x] = cost",
"- # ใใงใซheapqใใnxใpopใใฆใใใฐ",
"- ... | false | 0.644318 | 0.093447 | 6.895035 | [
"s566224718",
"s078493762"
] |
u729133443 | p03659 | python | s837062562 | s661390916 | 185 | 170 | 24,064 | 24,064 | Accepted | Accepted | 8.11 | n,x,*a=list(map(int,open(0).read().split()))
y=sum(a)
z=abs(x-y)
for i in a[:-1]:x+=i;y-=i;z=min(z,abs(x-y))
print(z) | n,x,*a,b=list(map(int,open(0).read().split()))
y=sum(a)+b
z=abs(x-y)
for i in a:x+=i;y-=i;z=min(z,abs(x-y))
print(z) | 5 | 5 | 115 | 114 | n, x, *a = list(map(int, open(0).read().split()))
y = sum(a)
z = abs(x - y)
for i in a[:-1]:
x += i
y -= i
z = min(z, abs(x - y))
print(z)
| n, x, *a, b = list(map(int, open(0).read().split()))
y = sum(a) + b
z = abs(x - y)
for i in a:
x += i
y -= i
z = min(z, abs(x - y))
print(z)
| false | 0 | [
"-n, x, *a = list(map(int, open(0).read().split()))",
"-y = sum(a)",
"+n, x, *a, b = list(map(int, open(0).read().split()))",
"+y = sum(a) + b",
"-for i in a[:-1]:",
"+for i in a:"
] | false | 0.043585 | 0.055982 | 0.778545 | [
"s837062562",
"s661390916"
] |
u581603131 | p03624 | python | s565208227 | s033635762 | 34 | 19 | 3,956 | 3,188 | Accepted | Accepted | 44.12 | S = eval(input())
list = []
for i in range(len(S)):
list.append(S[i])
list = set(list)
lists = set([chr(i) for i in range(ord('a'), ord('z')+1)])
ans = lists-list
print(('None' if len(ans)==0 else min(ans))) | S = set(eval(input()))
lists = set([chr(i) for i in range(ord('a'), ord('z')+1)])
ans = lists-S
print((min(ans) if len(list(ans)) != 0 else 'None')) | 8 | 4 | 210 | 143 | S = eval(input())
list = []
for i in range(len(S)):
list.append(S[i])
list = set(list)
lists = set([chr(i) for i in range(ord("a"), ord("z") + 1)])
ans = lists - list
print(("None" if len(ans) == 0 else min(ans)))
| S = set(eval(input()))
lists = set([chr(i) for i in range(ord("a"), ord("z") + 1)])
ans = lists - S
print((min(ans) if len(list(ans)) != 0 else "None"))
| false | 50 | [
"-S = eval(input())",
"-list = []",
"-for i in range(len(S)):",
"- list.append(S[i])",
"-list = set(list)",
"+S = set(eval(input()))",
"-ans = lists - list",
"-print((\"None\" if len(ans) == 0 else min(ans)))",
"+ans = lists - S",
"+print((min(ans) if len(list(ans)) != 0 else \"None\"))"
] | false | 0.040472 | 0.040507 | 0.999135 | [
"s565208227",
"s033635762"
] |
u970114913 | p02578 | python | s657893314 | s865972972 | 158 | 115 | 32,172 | 32,144 | Accepted | Accepted | 27.22 | n=int(eval(input()))
a=[int(x) for x in input().split()]
b=0
for i in range(1,n):
if a[i-1]>a[i]:
b+=a[i-1]-a[i]
a[i]=a[i-1]
print(b) | n=int(eval(input()))
a=[int(x) for x in input().split()]
b=a[0]
c=0
for i in range(1,n):
if a[i]<b:
c+=b-a[i]
else:
b=a[i]
print(c) | 8 | 10 | 148 | 146 | n = int(eval(input()))
a = [int(x) for x in input().split()]
b = 0
for i in range(1, n):
if a[i - 1] > a[i]:
b += a[i - 1] - a[i]
a[i] = a[i - 1]
print(b)
| n = int(eval(input()))
a = [int(x) for x in input().split()]
b = a[0]
c = 0
for i in range(1, n):
if a[i] < b:
c += b - a[i]
else:
b = a[i]
print(c)
| false | 20 | [
"-b = 0",
"+b = a[0]",
"+c = 0",
"- if a[i - 1] > a[i]:",
"- b += a[i - 1] - a[i]",
"- a[i] = a[i - 1]",
"-print(b)",
"+ if a[i] < b:",
"+ c += b - a[i]",
"+ else:",
"+ b = a[i]",
"+print(c)"
] | false | 0.037957 | 0.037228 | 1.019596 | [
"s657893314",
"s865972972"
] |
u227082700 | p03274 | python | s879432702 | s351744032 | 98 | 83 | 14,384 | 14,252 | Accepted | Accepted | 15.31 | n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
ans=abs(a[0])*2+abs(a[-1])*2#ใจใใใใๆๅคง
for i in range(n-k+1):
x,y=a[i],a[i+k-1]
if x*y<0:m=min(abs(x),y)*2+max(abs(x),y)
else:m=max(abs(x),abs(y))
ans=min(ans,m)
print(ans) | n,k=list(map(int,input().split()))
k-=1
x=list(map(int,input().split()))
print((min(min(abs(x[i])+abs(x[i+k]-x[i]),abs(x[i+k])+abs(x[i+k]-x[i])) for i in range(n-k)))) | 9 | 4 | 248 | 162 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = abs(a[0]) * 2 + abs(a[-1]) * 2 # ใจใใใใๆๅคง
for i in range(n - k + 1):
x, y = a[i], a[i + k - 1]
if x * y < 0:
m = min(abs(x), y) * 2 + max(abs(x), y)
else:
m = max(abs(x), abs(y))
ans = min(ans, m)
print(ans)... | n, k = list(map(int, input().split()))
k -= 1
x = list(map(int, input().split()))
print(
(
min(
min(abs(x[i]) + abs(x[i + k] - x[i]), abs(x[i + k]) + abs(x[i + k] - x[i]))
for i in range(n - k)
)
)
)
| false | 55.555556 | [
"-a = list(map(int, input().split()))",
"-ans = abs(a[0]) * 2 + abs(a[-1]) * 2 # ใจใใใใๆๅคง",
"-for i in range(n - k + 1):",
"- x, y = a[i], a[i + k - 1]",
"- if x * y < 0:",
"- m = min(abs(x), y) * 2 + max(abs(x), y)",
"- else:",
"- m = max(abs(x), abs(y))",
"- ans = min(ans... | false | 0.080447 | 0.033722 | 2.385609 | [
"s879432702",
"s351744032"
] |
u969850098 | p02850 | python | s347490840 | s447742325 | 627 | 548 | 51,164 | 45,640 | Accepted | Accepted | 12.6 | from collections import deque
def main():
N = int(eval(input()))
path = [[] for _ in range(N)]
ab = []
ans = {}
visited = [False] * N
visited[0] = True
for _ in range(N-1):
a, b = list(map(int, input().split()))
path[a-1].append(b-1)
path[b-1].append(a-1)... | from collections import deque
def main():
N = int(eval(input()))
path = [[] for _ in range(N)]
ab = []
ans = {}
visited = [False] * N
visited[0] = True
for _ in range(N-1):
a, b = list(map(int, input().split()))
path[a-1].append(b-1)
# path[b-1].append(a-... | 38 | 37 | 884 | 869 | from collections import deque
def main():
N = int(eval(input()))
path = [[] for _ in range(N)]
ab = []
ans = {}
visited = [False] * N
visited[0] = True
for _ in range(N - 1):
a, b = list(map(int, input().split()))
path[a - 1].append(b - 1)
path[b - 1].append(a - 1)
... | from collections import deque
def main():
N = int(eval(input()))
path = [[] for _ in range(N)]
ab = []
ans = {}
visited = [False] * N
visited[0] = True
for _ in range(N - 1):
a, b = list(map(int, input().split()))
path[a - 1].append(b - 1)
# path[b-1].append(a-1)
... | false | 2.631579 | [
"- path[b - 1].append(a - 1)",
"+ # path[b-1].append(a-1)",
"- # k = 0"
] | false | 0.07966 | 0.13841 | 0.575534 | [
"s347490840",
"s447742325"
] |
u001687078 | p03457 | python | s692632924 | s275065809 | 361 | 195 | 3,060 | 3,064 | Accepted | Accepted | 45.98 | n = int(eval(input()))
t0, x0, y0 = 0, 0, 0
for i in range(n):
ti, xi, yi = list(map(int, input().split()))
test = (ti - t0) - (xi + yi - x0 - y0)
if test >= 0 and test % 2 == 0:
t0, x0, y0 = ti, xi, yi
if i == n-1:
print("Yes")
else:
print("No")
break | #้ซ้ๅ
import sys
input_ = sys.stdin.readline
n = int(input_())
t0, x0, y0 = 0, 0, 0
for i in range(n):
ti, xi, yi = list(map(int, input_().split()))
test = (ti - t0) - (xi + yi - x0 - y0)
if test >= 0 and test % 2 == 0:
t0, x0, y0 = ti, xi, yi
if i == n-1:
print("Yes")
else:
... | 14 | 18 | 287 | 338 | n = int(eval(input()))
t0, x0, y0 = 0, 0, 0
for i in range(n):
ti, xi, yi = list(map(int, input().split()))
test = (ti - t0) - (xi + yi - x0 - y0)
if test >= 0 and test % 2 == 0:
t0, x0, y0 = ti, xi, yi
if i == n - 1:
print("Yes")
else:
print("No")
break
| # ้ซ้ๅ
import sys
input_ = sys.stdin.readline
n = int(input_())
t0, x0, y0 = 0, 0, 0
for i in range(n):
ti, xi, yi = list(map(int, input_().split()))
test = (ti - t0) - (xi + yi - x0 - y0)
if test >= 0 and test % 2 == 0:
t0, x0, y0 = ti, xi, yi
if i == n - 1:
print("Yes")
els... | false | 22.222222 | [
"-n = int(eval(input()))",
"+# ้ซ้ๅ",
"+import sys",
"+",
"+input_ = sys.stdin.readline",
"+n = int(input_())",
"- ti, xi, yi = list(map(int, input().split()))",
"+ ti, xi, yi = list(map(int, input_().split()))"
] | false | 0.043916 | 0.119345 | 0.367972 | [
"s692632924",
"s275065809"
] |
u352394527 | p00458 | python | s872386482 | s040742374 | 290 | 210 | 5,676 | 5,812 | Accepted | Accepted | 27.59 | def solve():
while True:
m, n = int(eval(input())), int(eval(input()))
if not m:
break
ices = [[0] + list(map(int,input().split())) + [0] for _ in range(n)]
ices.insert(0, [0] * (m + 2),)
ices.append([0] * (m + 2))
# score = [[0] * (m + 2) for _ in range(n + 2)]
#
# for ... | def solve():
while True:
m, n = int(eval(input())), int(eval(input()))
if not m:
break
ices = [[0] + list(map(int,input().split())) + [0] for _ in range(n)]
ices.insert(0, [0] * (m + 2),)
ices.append([0] * (m + 2))
score = [[0] * (m + 2) for _ in range(n + 2)]
for x i... | 42 | 41 | 1,166 | 1,120 | def solve():
while True:
m, n = int(eval(input())), int(eval(input()))
if not m:
break
ices = [[0] + list(map(int, input().split())) + [0] for _ in range(n)]
ices.insert(
0,
[0] * (m + 2),
)
ices.append([0] * (m + 2))
# s... | def solve():
while True:
m, n = int(eval(input())), int(eval(input()))
if not m:
break
ices = [[0] + list(map(int, input().split())) + [0] for _ in range(n)]
ices.insert(
0,
[0] * (m + 2),
)
ices.append([0] * (m + 2))
score ... | false | 2.380952 | [
"- # score = [[0] * (m + 2) for _ in range(n + 2)]",
"- #",
"- # for x in range(1, n + 1):",
"- # for y in range(1, m + 1):",
"- # if ices[x][y]:",
"- # score[x][y] += (ices[x - 1][y] + ices[x + 1][y] + ices[x][y - 1] + ices[x][y + 1])",... | false | 0.039461 | 0.041455 | 0.951892 | [
"s872386482",
"s040742374"
] |
u077291787 | p03162 | python | s334067111 | s878590467 | 757 | 413 | 40,228 | 21,308 | Accepted | Accepted | 45.44 | # dpC - Vacation
# ้
ใDP
import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))
dp = [[0] * 3 for _ in range(n)]
dp[0] = A[0]
for i in range(n - 1): # i-th day
for j in range(3): # yesterday... | # dpC - Vacation
# 3 variables
def main():
n = int(eval(input()))
A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))
a, b, c = A[0]
for x, y, z in A[1:]:
a, b, c = x + max(b, c), y + max(a, c), z + max(a, b)
print((max(a, b, c)))
if __name__ == "__main__":
... | 20 | 13 | 529 | 321 | # dpC - Vacation
# ้
ใDP
import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))
dp = [[0] * 3 for _ in range(n)]
dp[0] = A[0]
for i in range(n - 1): # i-th day
for j in range(3): # yesterday
... | # dpC - Vacation
# 3 variables
def main():
n = int(eval(input()))
A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))
a, b, c = A[0]
for x, y, z in A[1:]:
a, b, c = x + max(b, c), y + max(a, c), z + max(a, b)
print((max(a, b, c)))
if __name__ == "__main__":
main()
| false | 35 | [
"-# ้
ใDP",
"-import sys",
"-",
"-input = sys.stdin.readline",
"-",
"-",
"+# 3 variables",
"- dp = [[0] * 3 for _ in range(n)]",
"- dp[0] = A[0]",
"- for i in range(n - 1): # i-th day",
"- for j in range(3): # yesterday",
"- for k in range(3): # today",
"- ... | false | 0.080425 | 0.035085 | 2.292284 | [
"s334067111",
"s878590467"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.