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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u869790980 | p03563 | python | s657369044 | s343307717 | 118 | 56 | 64,072 | 64,248 | Accepted | Accepted | 52.54 | a,av = int(input()), int(input())
print(2*av - a)
| print(-int(input()) + (int(input()) << 1)) | 2 | 1 | 59 | 49 | a, av = int(input()), int(input())
print(2 * av - a)
| print(-int(input()) + (int(input()) << 1))
| false | 50 | [
"-a, av = int(input()), int(input())",
"-print(2 * av - a)",
"+print(-int(input()) + (int(input()) << 1))"
] | false | 0.035038 | 0.073275 | 0.478168 | [
"s657369044",
"s343307717"
] |
u814781830 | p03286 | python | s917193163 | s590407525 | 170 | 64 | 38,384 | 61,800 | Accepted | Accepted | 62.35 | N = int(eval(input()))
digits = []
i = 1
while N != 0:
if N % pow(2,i) == 0:
digits.append('0')
else:
digits.append('1')
N -= pow(-2,i-1)
i += 1
if digits:
print(("".join(reversed(digits))))
else:
print("0")
| N = int(input())
ans = []
N = -N
while N != 0:
ans.append(N%2)
N //= -2
if ans:
ans.reverse()
print(*ans, sep="")
else:
print(0)
| 15 | 13 | 259 | 163 | N = int(eval(input()))
digits = []
i = 1
while N != 0:
if N % pow(2, i) == 0:
digits.append("0")
else:
digits.append("1")
N -= pow(-2, i - 1)
i += 1
if digits:
print(("".join(reversed(digits))))
else:
print("0")
| N = int(input())
ans = []
N = -N
while N != 0:
ans.append(N % 2)
N //= -2
if ans:
ans.reverse()
print(*ans, sep="")
else:
print(0)
| false | 13.333333 | [
"-N = int(eval(input()))",
"-digits = []",
"-i = 1",
"+N = int(input())",
"+ans = []",
"+N = -N",
"- if N % pow(2, i) == 0:",
"- digits.append(\"0\")",
"- else:",
"- digits.append(\"1\")",
"- N -= pow(-2, i - 1)",
"- i += 1",
"-if digits:",
"- print((\"\".j... | false | 0.037211 | 0.03566 | 1.043479 | [
"s917193163",
"s590407525"
] |
u867848444 | p02921 | python | s895267729 | s423951108 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | s,t=eval(input()),eval(input())
n=0
for x,y in zip(s,t):
if x==y:
n+=1
print(n) | s,t=eval(input()),eval(input())
count=0
for i in range(3):
if s[i]==t[i]:
count+=1
print(count) | 6 | 7 | 84 | 102 | s, t = eval(input()), eval(input())
n = 0
for x, y in zip(s, t):
if x == y:
n += 1
print(n)
| s, t = eval(input()), eval(input())
count = 0
for i in range(3):
if s[i] == t[i]:
count += 1
print(count)
| false | 14.285714 | [
"-n = 0",
"-for x, y in zip(s, t):",
"- if x == y:",
"- n += 1",
"-print(n)",
"+count = 0",
"+for i in range(3):",
"+ if s[i] == t[i]:",
"+ count += 1",
"+print(count)"
] | false | 0.068029 | 0.064805 | 1.049742 | [
"s895267729",
"s423951108"
] |
u749321340 | p02726 | python | s154525743 | s039693382 | 307 | 270 | 76,124 | 47,196 | Accepted | Accepted | 12.05 | n, x, y = list(map(int, input().split()))
x -= 1
y -= 1
cnt = [0] * n
dist = []
for i in range(n):
dist.append([-1] * n)
for i in range(n):
dist[i][x] = abs(i-x)
dist[i][y] = abs(i-y)
dist[x][i] = abs(i-x)
dist[y][i] = abs(i-y)
for i in range(n):
for j in range(n):
if... | n, x, y = list(map(int, input().split()))
x -= 1
y -= 1
cnt = [0] * n
for i in range(n):
for j in range(i+1, n):
cnt[min(j - i, abs(i-x) + 1 + abs(y-j))] += 1
for i in range(1, n):
print((cnt[i]))
| 23 | 9 | 471 | 219 | n, x, y = list(map(int, input().split()))
x -= 1
y -= 1
cnt = [0] * n
dist = []
for i in range(n):
dist.append([-1] * n)
for i in range(n):
dist[i][x] = abs(i - x)
dist[i][y] = abs(i - y)
dist[x][i] = abs(i - x)
dist[y][i] = abs(i - y)
for i in range(n):
for j in range(n):
if i >= j:
... | n, x, y = list(map(int, input().split()))
x -= 1
y -= 1
cnt = [0] * n
for i in range(n):
for j in range(i + 1, n):
cnt[min(j - i, abs(i - x) + 1 + abs(y - j))] += 1
for i in range(1, n):
print((cnt[i]))
| false | 60.869565 | [
"-dist = []",
"- dist.append([-1] * n)",
"-for i in range(n):",
"- dist[i][x] = abs(i - x)",
"- dist[i][y] = abs(i - y)",
"- dist[x][i] = abs(i - x)",
"- dist[y][i] = abs(i - y)",
"-for i in range(n):",
"- for j in range(n):",
"- if i >= j:",
"- continue",
"... | false | 0.033417 | 0.046694 | 0.715668 | [
"s154525743",
"s039693382"
] |
u543954314 | p02901 | python | s414353619 | s083351561 | 1,982 | 980 | 3,188 | 3,188 | Accepted | Accepted | 50.55 | n,m = list(map(int,input().split()))
dp = [10**9]*(2**n)
dp[0] = 0
for _ in range(m):
a,_ = list(map(int,input().split()))
c = list(map(int,input().split()))
t = 0
for x in c:
t |= 1<<(x-1)
for b in range(2**n):
dp[b|t] = min(dp[b|t],dp[b]+a)
if dp[-1] > 10**8:
print((-1))
else:
prin... | n,m = list(map(int,input().split()))
dp = [10**9]*(2**n)
dp[0] = 0
for _ in range(m):
a,_ = list(map(int,input().split()))
c = list(map(int,input().split()))
t = 0
for x in c:
t |= 1<<(x-1)
for b in range(2**n):
if dp[b|t] > dp[b]+a:
dp[b|t] = dp[b] + a
if dp[-1] > 10**8:
print((-... | 15 | 16 | 316 | 334 | n, m = list(map(int, input().split()))
dp = [10**9] * (2**n)
dp[0] = 0
for _ in range(m):
a, _ = list(map(int, input().split()))
c = list(map(int, input().split()))
t = 0
for x in c:
t |= 1 << (x - 1)
for b in range(2**n):
dp[b | t] = min(dp[b | t], dp[b] + a)
if dp[-1] > 10**8:
... | n, m = list(map(int, input().split()))
dp = [10**9] * (2**n)
dp[0] = 0
for _ in range(m):
a, _ = list(map(int, input().split()))
c = list(map(int, input().split()))
t = 0
for x in c:
t |= 1 << (x - 1)
for b in range(2**n):
if dp[b | t] > dp[b] + a:
dp[b | t] = dp[b] + a
i... | false | 6.25 | [
"- dp[b | t] = min(dp[b | t], dp[b] + a)",
"+ if dp[b | t] > dp[b] + a:",
"+ dp[b | t] = dp[b] + a"
] | false | 0.037279 | 0.038986 | 0.956207 | [
"s414353619",
"s083351561"
] |
u238940874 | p03448 | python | s102338787 | s152973741 | 56 | 49 | 3,060 | 3,060 | Accepted | Accepted | 12.5 | a=int(eval(input()))
b=int(eval(input()))
c=int(eval(input()))
x=int(eval(input()))
cnt=0
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
total = 500*i+100*j+k*50
if total == x:
cnt+=1
print(cnt) | a=int(eval(input()))
b=int(eval(input()))
c=int(eval(input()))
x=int(eval(input()))
ans=0
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
if i*500+j*100+k*50==x:
ans+=1
print(ans)
| 12 | 11 | 249 | 221 | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
cnt = 0
for i in range(a + 1):
for j in range(b + 1):
for k in range(c + 1):
total = 500 * i + 100 * j + k * 50
if total == x:
cnt += 1
print(cnt)
| a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
ans = 0
for i in range(a + 1):
for j in range(b + 1):
for k in range(c + 1):
if i * 500 + j * 100 + k * 50 == x:
ans += 1
print(ans)
| false | 8.333333 | [
"-cnt = 0",
"+ans = 0",
"- total = 500 * i + 100 * j + k * 50",
"- if total == x:",
"- cnt += 1",
"-print(cnt)",
"+ if i * 500 + j * 100 + k * 50 == x:",
"+ ans += 1",
"+print(ans)"
] | false | 0.125156 | 0.109859 | 1.139245 | [
"s102338787",
"s152973741"
] |
u620084012 | p02787 | python | s859514519 | s791286682 | 800 | 133 | 75,724 | 74,484 | Accepted | Accepted | 83.38 | H, N = list(map(int,input().split()))
M = [list(map(int,input().split())) for k in range(N)]
dp = [10**10]*(10**5)
dp[0] = 0
for e in M:
for k in range(e[0],10**5):
dp[k] = min(dp[k],dp[k-e[0]]+e[1])
print((min(dp[H:])))
| H, N = list(map(int,input().split()))
M = []
for k in range(N):
M.append(list(map(int,input().split())))
dp = [10**9]*(10**5)
dp[0] = 0
for A, B in M:
for k in range(A+1):
dp[k] = min(dp[k],B)
for k in range(A+1,H+1):
dp[k] = min(dp[k],dp[k-A]+B)
print((dp[H]))
| 8 | 12 | 232 | 293 | H, N = list(map(int, input().split()))
M = [list(map(int, input().split())) for k in range(N)]
dp = [10**10] * (10**5)
dp[0] = 0
for e in M:
for k in range(e[0], 10**5):
dp[k] = min(dp[k], dp[k - e[0]] + e[1])
print((min(dp[H:])))
| H, N = list(map(int, input().split()))
M = []
for k in range(N):
M.append(list(map(int, input().split())))
dp = [10**9] * (10**5)
dp[0] = 0
for A, B in M:
for k in range(A + 1):
dp[k] = min(dp[k], B)
for k in range(A + 1, H + 1):
dp[k] = min(dp[k], dp[k - A] + B)
print((dp[H]))
| false | 33.333333 | [
"-M = [list(map(int, input().split())) for k in range(N)]",
"-dp = [10**10] * (10**5)",
"+M = []",
"+for k in range(N):",
"+ M.append(list(map(int, input().split())))",
"+dp = [10**9] * (10**5)",
"-for e in M:",
"- for k in range(e[0], 10**5):",
"- dp[k] = min(dp[k], dp[k - e[0]] + e[1]... | false | 0.654008 | 0.070001 | 9.342897 | [
"s859514519",
"s791286682"
] |
u535423069 | p03031 | python | s052460141 | s716988862 | 51 | 46 | 3,064 | 3,192 | Accepted | Accepted | 9.8 | import sys
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range... | import sys
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range... | 42 | 38 | 1,076 | 985 | import sys
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdi... | import sys
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdi... | false | 9.52381 | [
"- on = dict()",
"- for j in range(n):",
"- if (i >> j) & 1:",
"- on[j + 1] = True",
"- l = 0",
"+ ok = True",
"- if on.get(s[a], False):",
"+ if (i >> (s[a] - 1)) & 1:",
"- if sum_on % 2 == p[j]:",
"- l += 1",
"- if l == m... | false | 0.080152 | 0.041199 | 1.945488 | [
"s052460141",
"s716988862"
] |
u852210959 | p03162 | python | s392028304 | s601243024 | 838 | 682 | 40,176 | 20,540 | Accepted | Accepted | 18.62 | # -*- coding: utf-8 -*-
def main():
n = int(eval(input()))
work_list = [tuple(map(int, input().split())) for i in range(n)]
dp = [[0] * 3 for i in range(n + 1)]
for i, work in enumerate(work_list):
for i_now in range(3):
for i_pre in range(3):
if i_now =... | # -*- coding: utf-8 -*-
def main():
n = int(eval(input()))
work_list = [tuple(map(int, input().split())) for i in range(n)]
# dp = [[0] * 3 for i in range(n + 1)]
# for i, work in enumerate(work_list):
# for i_now in range(3):
# for i_pre in range(3):
# ... | 21 | 34 | 511 | 928 | # -*- coding: utf-8 -*-
def main():
n = int(eval(input()))
work_list = [tuple(map(int, input().split())) for i in range(n)]
dp = [[0] * 3 for i in range(n + 1)]
for i, work in enumerate(work_list):
for i_now in range(3):
for i_pre in range(3):
if i_now == i_pre:
... | # -*- coding: utf-8 -*-
def main():
n = int(eval(input()))
work_list = [tuple(map(int, input().split())) for i in range(n)]
# dp = [[0] * 3 for i in range(n + 1)]
# for i, work in enumerate(work_list):
# for i_now in range(3):
# for i_pre in range(3):
# if i_now == i_... | false | 38.235294 | [
"- dp = [[0] * 3 for i in range(n + 1)]",
"+ # dp = [[0] * 3 for i in range(n + 1)]",
"+ # for i, work in enumerate(work_list):",
"+ # for i_now in range(3):",
"+ # for i_pre in range(3):",
"+ # if i_now == i_pre:",
"+ # continue",
"+ #",... | false | 0.048147 | 0.03858 | 1.247978 | [
"s392028304",
"s601243024"
] |
u707498674 | p02744 | python | s559841693 | s931646641 | 161 | 148 | 12,684 | 12,684 | Accepted | Accepted | 8.07 | import sys
sys.setrecursionlimit(10**8)
alpha = "abcdefghij"
ans = []
N = int(eval(input()))
def get_right(S):
alpha_idx = 0
for i in range(len(S)):
flag = S.find(alpha[i])
if flag > 0:
alpha_idx = i
return alpha_idx + 2
def dfs(S, num):
if len(S) == N:
... | import sys
sys.setrecursionlimit(10**8)
alpha = "abcdefghij"
ans = []
N = int(eval(input()))
def dfs(S, num):
if len(S) == N:
ans.append(S)
else:
right = num + 2
seq = alpha[:right]
for i, c in enumerate(seq):
dfs(S+c, max(i, num))
dfs("a", 0)
ans = ... | 28 | 19 | 533 | 354 | import sys
sys.setrecursionlimit(10**8)
alpha = "abcdefghij"
ans = []
N = int(eval(input()))
def get_right(S):
alpha_idx = 0
for i in range(len(S)):
flag = S.find(alpha[i])
if flag > 0:
alpha_idx = i
return alpha_idx + 2
def dfs(S, num):
if len(S) == N:
ans.appen... | import sys
sys.setrecursionlimit(10**8)
alpha = "abcdefghij"
ans = []
N = int(eval(input()))
def dfs(S, num):
if len(S) == N:
ans.append(S)
else:
right = num + 2
seq = alpha[:right]
for i, c in enumerate(seq):
dfs(S + c, max(i, num))
dfs("a", 0)
ans = sorted(ans)... | false | 32.142857 | [
"-",
"-",
"-def get_right(S):",
"- alpha_idx = 0",
"- for i in range(len(S)):",
"- flag = S.find(alpha[i])",
"- if flag > 0:",
"- alpha_idx = i",
"- return alpha_idx + 2"
] | false | 0.050132 | 0.042511 | 1.17926 | [
"s559841693",
"s931646641"
] |
u729133443 | p02888 | python | s675222922 | s173640720 | 1,049 | 842 | 3,188 | 3,188 | Accepted | Accepted | 19.73 | from bisect import*
n,*l=list(map(int,open(0).read().split()))
l.sort()
print((sum(~j+bisect_left(l,l[i]+l[j],j+1)for i in range(n)for j in range(i+1,n)))) | from bisect import*
_,l=open(0)
l=sorted(map(int,l.split()))
e=enumerate
print((sum(j-bisect(l,a-b,0,j)for i,a in e(l)for j,b in e(l[:i])))) | 4 | 5 | 150 | 142 | from bisect import *
n, *l = list(map(int, open(0).read().split()))
l.sort()
print(
(
sum(
~j + bisect_left(l, l[i] + l[j], j + 1)
for i in range(n)
for j in range(i + 1, n)
)
)
)
| from bisect import *
_, l = open(0)
l = sorted(map(int, l.split()))
e = enumerate
print((sum(j - bisect(l, a - b, 0, j) for i, a in e(l) for j, b in e(l[:i]))))
| false | 20 | [
"-n, *l = list(map(int, open(0).read().split()))",
"-l.sort()",
"-print(",
"- (",
"- sum(",
"- ~j + bisect_left(l, l[i] + l[j], j + 1)",
"- for i in range(n)",
"- for j in range(i + 1, n)",
"- )",
"- )",
"-)",
"+_, l = open(0)",
"+l = sort... | false | 0.04233 | 0.037452 | 1.13024 | [
"s675222922",
"s173640720"
] |
u753803401 | p02836 | python | s819603243 | s770005401 | 182 | 165 | 38,256 | 38,384 | Accepted | Accepted | 9.34 | import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
s = str(readline().rstrip().decode('utf-8'))
cnt = 0
for i in range(len(s)):
if s[i] != s[-i-1]:
cnt += 1
print((cnt // 2))
if __name__ == '__main__':
solve()
| import sys
def solve():
input = sys.stdin.readline
mod = 10 ** 9 + 7
s = str(input().rstrip('\n'))
cnt = 0
for i in range(len(s)):
if s[i] != s[-i-1]:
cnt += 1
print((cnt // 2))
if __name__ == '__main__':
solve()
| 16 | 16 | 303 | 278 | import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10**9 + 7
s = str(readline().rstrip().decode("utf-8"))
cnt = 0
for i in range(len(s)):
if s[i] != s[-i - 1]:
cnt += 1
print((cnt // 2))
if __name__ == "__main__":
solve()
| import sys
def solve():
input = sys.stdin.readline
mod = 10**9 + 7
s = str(input().rstrip("\n"))
cnt = 0
for i in range(len(s)):
if s[i] != s[-i - 1]:
cnt += 1
print((cnt // 2))
if __name__ == "__main__":
solve()
| false | 0 | [
"- readline = sys.stdin.buffer.readline",
"+ input = sys.stdin.readline",
"- s = str(readline().rstrip().decode(\"utf-8\"))",
"+ s = str(input().rstrip(\"\\n\"))"
] | false | 0.047397 | 0.073426 | 0.645513 | [
"s819603243",
"s770005401"
] |
u028939600 | p00481 | python | s222411353 | s162888369 | 10,340 | 6,030 | 34,252 | 32,944 | Accepted | Accepted | 41.68 |
def getStart(field):
search_field = field[1:]
for y in range(len(search_field)):
for x in range(len(search_field[0])):
if search_field[y][x] == "S":
return x,y+1
def bfs(field,start_x,start_y,goal_N):
direction = [[-1,0],[1,0],[0,-1],[0,1]]
gotten_chee... | import sys
sys.setrecursionlimit(100000000)
moves = [(0, -1), (0, 1), (-1, 0), (1, 0)]
def search(dataset):
min_time = 0
mouse = 1
gx, gy = get_start(dataset)
for i in range(N):
gx, gy, min_time_tmp = bfs(dataset, (gx, gy), mouse)
mouse += 1
min_time += min_tim... | 61 | 65 | 1,982 | 1,726 | def getStart(field):
search_field = field[1:]
for y in range(len(search_field)):
for x in range(len(search_field[0])):
if search_field[y][x] == "S":
return x, y + 1
def bfs(field, start_x, start_y, goal_N):
direction = [[-1, 0], [1, 0], [0, -1], [0, 1]]
gotten_chees... | import sys
sys.setrecursionlimit(100000000)
moves = [(0, -1), (0, 1), (-1, 0), (1, 0)]
def search(dataset):
min_time = 0
mouse = 1
gx, gy = get_start(dataset)
for i in range(N):
gx, gy, min_time_tmp = bfs(dataset, (gx, gy), mouse)
mouse += 1
min_time += min_time_tmp
print(... | false | 6.153846 | [
"-def getStart(field):",
"- search_field = field[1:]",
"- for y in range(len(search_field)):",
"- for x in range(len(search_field[0])):",
"- if search_field[y][x] == \"S\":",
"- return x, y + 1",
"+import sys",
"+",
"+sys.setrecursionlimit(100000000)",
"+move... | false | 0.040886 | 0.041087 | 0.995112 | [
"s222411353",
"s162888369"
] |
u522140891 | p02850 | python | s923446849 | s408555821 | 384 | 347 | 130,620 | 129,816 | Accepted | Accepted | 9.64 | from collections import defaultdict
from collections import deque
from collections import OrderedDict
import itertools
from sys import stdin
input = stdin.readline
def main():
N = int(input())
G = [[] for _ in range(N)]
dic = {}
for i in range(N-1):
a, b = map(lambda x: int(x)-1, input().spli... | from collections import deque
from sys import stdin
input = stdin.readline
def main():
N = int(input())
G = [[] for _ in range(N)]
dic = {}
for i in range(N-1):
a, b = map(lambda x: int(x)-1, input().split())
G[a].append(b)
G[b].append(a)
dic[(a, b)] = i
dic[(b, a)] = i
... | 52 | 49 | 1,046 | 846 | from collections import defaultdict
from collections import deque
from collections import OrderedDict
import itertools
from sys import stdin
input = stdin.readline
def main():
N = int(input())
G = [[] for _ in range(N)]
dic = {}
for i in range(N - 1):
a, b = map(lambda x: int(x) - 1, input().... | from collections import deque
from sys import stdin
input = stdin.readline
def main():
N = int(input())
G = [[] for _ in range(N)]
dic = {}
for i in range(N - 1):
a, b = map(lambda x: int(x) - 1, input().split())
G[a].append(b)
G[b].append(a)
dic[(a, b)] = i
di... | false | 5.769231 | [
"-from collections import defaultdict",
"-from collections import OrderedDict",
"-import itertools",
"- if next_ not in visited:",
"+ if next_ in visited:",
"+ continue",
"+ c += 1",
"+ if upcol[now] == c:",
"- if upcol[now] i... | false | 0.123181 | 0.048842 | 2.521998 | [
"s923446849",
"s408555821"
] |
u190405389 | p02579 | python | s074150696 | s381246915 | 519 | 391 | 89,088 | 89,128 | Accepted | Accepted | 24.66 | import sys
readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readints():return list(map(int,readline().split()))
from collections import deque
h,w = readints()
start = readints()
start = (start[0]-1)*w + start[1]-1
goal = readints()
goal = (goal[0]-1)*w + goal[1... | import sys
readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readints():return list(map(int,readline().split()))
from collections import deque
h,w = readints()
start = readints()
start = (start[0]-1)*w + start[1]-1
goal = readints()
goal = (goal[0]-1)*w + goal[1... | 44 | 45 | 1,082 | 1,143 | import sys
readline = sys.stdin.buffer.readline
def readstr():
return readline().rstrip().decode()
def readints():
return list(map(int, readline().split()))
from collections import deque
h, w = readints()
start = readints()
start = (start[0] - 1) * w + start[1] - 1
goal = readints()
goal = (goal[0] - 1)... | import sys
readline = sys.stdin.buffer.readline
def readstr():
return readline().rstrip().decode()
def readints():
return list(map(int, readline().split()))
from collections import deque
h, w = readints()
start = readints()
start = (start[0] - 1) * w + start[1] - 1
goal = readints()
goal = (goal[0] - 1)... | false | 2.222222 | [
"-dq.append(start)",
"+dq.append((start, 0))",
"- p = dq.popleft()",
"+ p, d = dq.popleft()",
"+ if d > dist[p]:",
"+ continue",
"- dq.appendleft(q)",
"+ dq.appendleft((q, dist[q]))",
"- dq.append(q)",
"+ ... | false | 0.077984 | 0.04011 | 1.944285 | [
"s074150696",
"s381246915"
] |
u263830634 | p03681 | python | s655699693 | s460547551 | 703 | 77 | 5,176 | 11,052 | Accepted | Accepted | 89.05 | from math import factorial
N, M = list(map(int, input().split()))
if abs(N-M) >= 2:
print((0))
elif N == M:
print(((factorial(N)*factorial(M)*2)%(10**9 + 7)))
else:
print(((factorial(N)*factorial(M))%(10**9 + 7))) | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7
N, M = list(map(int, input().split()))
if abs(N - M) >= 2:
print((0))
exit()
class Factorial:
def __init__(self, n, mod):
self.f = [1]
self.mod = mod
for j in range(1, n + 1):
... | 9 | 41 | 225 | 926 | from math import factorial
N, M = list(map(int, input().split()))
if abs(N - M) >= 2:
print((0))
elif N == M:
print(((factorial(N) * factorial(M) * 2) % (10**9 + 7)))
else:
print(((factorial(N) * factorial(M)) % (10**9 + 7)))
| import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)
MOD = 10**9 + 7
N, M = list(map(int, input().split()))
if abs(N - M) >= 2:
print((0))
exit()
class Factorial:
def __init__(self, n, mod):
self.f = [1]
self.mod = mod
for j in range(1, n + 1):
self.f.app... | false | 78.04878 | [
"-from math import factorial",
"+import sys",
"+input = sys.stdin.readline",
"+sys.setrecursionlimit(10**9)",
"+MOD = 10**9 + 7",
"-elif N == M:",
"- print(((factorial(N) * factorial(M) * 2) % (10**9 + 7)))",
"+ exit()",
"+",
"+",
"+class Factorial:",
"+ def __init__(self, n, mod):",
... | false | 0.037802 | 0.040463 | 0.934253 | [
"s655699693",
"s460547551"
] |
u586857375 | p02713 | python | s322158257 | s385404230 | 1,165 | 552 | 9,020 | 9,184 | Accepted | Accepted | 52.62 | from math import gcd #or import math
K = int(eval(input()))#or K = int(input())+1
plus = 0
for i in range(1,K+1):# range(1,K)
for a in range(1,K+1):# range(1,K)
x = gcd(i,a) #or math.gcd(i,a)
for j in range(1,K+1):# range(1,K)
plus += gcd(x,j) #or math.gcd(x,j)
pr... | from math import gcd
K = int(eval(input()))
plus = 0
for a in range(1, K+1):
for b in range(1, K+1):
temp = gcd(a, b)
if temp != 1:
for c in range(1, K+1):
plus += gcd(temp, c)
else:
plus += K
print(plus) | 11 | 12 | 323 | 277 | from math import gcd # or import math
K = int(eval(input())) # or K = int(input())+1
plus = 0
for i in range(1, K + 1): # range(1,K)
for a in range(1, K + 1): # range(1,K)
x = gcd(i, a) # or math.gcd(i,a)
for j in range(1, K + 1): # range(1,K)
plus += gcd(x, j) # or math.gcd(x,j)... | from math import gcd
K = int(eval(input()))
plus = 0
for a in range(1, K + 1):
for b in range(1, K + 1):
temp = gcd(a, b)
if temp != 1:
for c in range(1, K + 1):
plus += gcd(temp, c)
else:
plus += K
print(plus)
| false | 8.333333 | [
"-from math import gcd # or import math",
"+from math import gcd",
"-K = int(eval(input())) # or K = int(input())+1",
"+K = int(eval(input()))",
"-for i in range(1, K + 1): # range(1,K)",
"- for a in range(1, K + 1): # range(1,K)",
"- x = gcd(i, a) # or math.gcd(i,a)",
"- for j i... | false | 0.13859 | 0.068579 | 2.020874 | [
"s322158257",
"s385404230"
] |
u691896522 | p03013 | python | s828750343 | s444218347 | 477 | 223 | 45,088 | 12,832 | Accepted | Accepted | 53.25 | n, m = list(map(int, input().split()))
mod = 10**9 + 7
dp = [0 for i in range(n+1)]
for i in range(m):
dp[int(eval(input()))] = -1
dp[0] = 1
for i in range(n):
if dp[i] != -1:
if dp[i+1] != -1:
dp[i+1] += dp[i]
dp[i+1] %= mod
if i+2 <= n and dp[i+2] != -1:
... | n, m = list(map(int, input().split()))
dp = [0 for i in range(n + 1)]
mod = 10 ** 9 + 7
broke = set()
for i in range(m):
broke.add(int(eval(input())))
dp[0] = 1
for i in range(n):
if i + 1 <= n and i + 1 not in broke:
dp[i + 1] += dp[i]
dp[i + 1] %= mod
if i + 2 <= n and i + 2 not... | 15 | 15 | 375 | 393 | n, m = list(map(int, input().split()))
mod = 10**9 + 7
dp = [0 for i in range(n + 1)]
for i in range(m):
dp[int(eval(input()))] = -1
dp[0] = 1
for i in range(n):
if dp[i] != -1:
if dp[i + 1] != -1:
dp[i + 1] += dp[i]
dp[i + 1] %= mod
if i + 2 <= n and dp[i + 2] != -1:
... | n, m = list(map(int, input().split()))
dp = [0 for i in range(n + 1)]
mod = 10**9 + 7
broke = set()
for i in range(m):
broke.add(int(eval(input())))
dp[0] = 1
for i in range(n):
if i + 1 <= n and i + 1 not in broke:
dp[i + 1] += dp[i]
dp[i + 1] %= mod
if i + 2 <= n and i + 2 not in broke:
... | false | 0 | [
"+dp = [0 for i in range(n + 1)]",
"-dp = [0 for i in range(n + 1)]",
"+broke = set()",
"- dp[int(eval(input()))] = -1",
"+ broke.add(int(eval(input())))",
"- if dp[i] != -1:",
"- if dp[i + 1] != -1:",
"- dp[i + 1] += dp[i]",
"- dp[i + 1] %= mod",
"- if... | false | 0.11174 | 0.057856 | 1.931365 | [
"s828750343",
"s444218347"
] |
u763963344 | p02712 | python | s438226398 | s811065158 | 214 | 154 | 9,024 | 9,148 | Accepted | Accepted | 28.04 | N=int(eval(input()))
s=0
for i in range(1,N+1):
if i%15==0:
s=s
elif i%3==0:
s=s
elif i%5==0:
s=s
else:
s=s+i
print(s) | n = int(eval(input()))
answer = 0
for i in range(1, n + 1): # range内を出力(i)していく
if i % 3 != 0 and i % 5 != 0:
answer += i # iを足していったものがanswer
print(answer) # 実際に見えるように出力
| 12 | 7 | 171 | 218 | N = int(eval(input()))
s = 0
for i in range(1, N + 1):
if i % 15 == 0:
s = s
elif i % 3 == 0:
s = s
elif i % 5 == 0:
s = s
else:
s = s + i
print(s)
| n = int(eval(input()))
answer = 0
for i in range(1, n + 1): # range内を出力(i)していく
if i % 3 != 0 and i % 5 != 0:
answer += i # iを足していったものがanswer
print(answer) # 実際に見えるように出力
| false | 41.666667 | [
"-N = int(eval(input()))",
"-s = 0",
"-for i in range(1, N + 1):",
"- if i % 15 == 0:",
"- s = s",
"- elif i % 3 == 0:",
"- s = s",
"- elif i % 5 == 0:",
"- s = s",
"- else:",
"- s = s + i",
"-print(s)",
"+n = int(eval(input()))",
"+answer = 0",
"+... | false | 0.454625 | 0.398124 | 1.141918 | [
"s438226398",
"s811065158"
] |
u970197315 | p03283 | python | s532581408 | s967669144 | 1,659 | 626 | 13,584 | 78,380 | Accepted | Accepted | 62.27 | n,m,q=list(map(int,input().split()))
mat=[[0]*(n+1) for i in range(n+1)]
for i in range(m):
l,r=list(map(int,input().split()))
mat[l][r]+=1
for i in range(n+1):
for j in range(n+1):
mat[i][j]+=mat[i-1][j]
mat[i][j]+=mat[i][j-1]
mat[i][j]-=mat[i-1][j-1]
for i in range(... | n,m,Q=list(map(int,input().split()))
mat=[[0]*(n+1) for i in range(n+1)]
for i in range(m):
l,r=list(map(int,input().split()))
mat[l][r]+=1
for i in range(n+1):
for j in range(n+1):
mat[i][j]+=mat[i-1][j]
mat[i][j]+=mat[i][j-1]
mat[i][j]-=mat[i-1][j-1]
for i in range(Q):
p,q=list(map(... | 17 | 16 | 419 | 389 | n, m, q = list(map(int, input().split()))
mat = [[0] * (n + 1) for i in range(n + 1)]
for i in range(m):
l, r = list(map(int, input().split()))
mat[l][r] += 1
for i in range(n + 1):
for j in range(n + 1):
mat[i][j] += mat[i - 1][j]
mat[i][j] += mat[i][j - 1]
mat[i][j] -= mat[i - 1][j... | n, m, Q = list(map(int, input().split()))
mat = [[0] * (n + 1) for i in range(n + 1)]
for i in range(m):
l, r = list(map(int, input().split()))
mat[l][r] += 1
for i in range(n + 1):
for j in range(n + 1):
mat[i][j] += mat[i - 1][j]
mat[i][j] += mat[i][j - 1]
mat[i][j] -= mat[i - 1][j... | false | 5.882353 | [
"-n, m, q = list(map(int, input().split()))",
"+n, m, Q = list(map(int, input().split()))",
"-for i in range(q):",
"- l, r = list(map(int, input().split()))",
"- ans = mat[r][r] + mat[l - 1][l - 1] - mat[l - 1][r] - mat[r][l - 1]",
"- print(ans)",
"+for i in range(Q):",
"+ p, q = list(map(... | false | 0.079393 | 0.037256 | 2.131035 | [
"s532581408",
"s967669144"
] |
u426649993 | p02996 | python | s646017822 | s621992506 | 1,730 | 1,100 | 88,164 | 49,000 | Accepted | Accepted | 36.42 | N = int(eval(input()))
job_list = list()
for i in range(N):
job_list.append(tuple(map(int, str(eval(input())).split())))
job_list = sorted(job_list, key=lambda x: (x[1], x[0]))
time = 0
for i in range(N):
time += job_list[i][0]
if time > job_list[i][1]:
print('No')
exit()
pr... | from collections import OrderedDict
if __name__ == "__main__":
n = int(eval(input()))
job = dict()
for i in range(n):
tmp = list(map(int, input().split()))
if tmp[1] in job:
job[tmp[1]].append(tmp[0])
else:
job[tmp[1]] = [tmp[0]]
sch = sorted(j... | 15 | 23 | 319 | 507 | N = int(eval(input()))
job_list = list()
for i in range(N):
job_list.append(tuple(map(int, str(eval(input())).split())))
job_list = sorted(job_list, key=lambda x: (x[1], x[0]))
time = 0
for i in range(N):
time += job_list[i][0]
if time > job_list[i][1]:
print("No")
exit()
print("Yes")
| from collections import OrderedDict
if __name__ == "__main__":
n = int(eval(input()))
job = dict()
for i in range(n):
tmp = list(map(int, input().split()))
if tmp[1] in job:
job[tmp[1]].append(tmp[0])
else:
job[tmp[1]] = [tmp[0]]
sch = sorted(job)
tim... | false | 34.782609 | [
"-N = int(eval(input()))",
"-job_list = list()",
"-for i in range(N):",
"- job_list.append(tuple(map(int, str(eval(input())).split())))",
"-job_list = sorted(job_list, key=lambda x: (x[1], x[0]))",
"-time = 0",
"-for i in range(N):",
"- time += job_list[i][0]",
"- if time > job_list[i][1]:"... | false | 0.107824 | 0.036859 | 2.925305 | [
"s646017822",
"s621992506"
] |
u800058906 | p02935 | python | s727997140 | s293299417 | 32 | 26 | 9,100 | 9,040 | Accepted | Accepted | 18.75 | n=int(eval(input()))
v=list(map(int,input().split()))
v.sort()
cnt=(v[0]+v[1])/2
for i in range(2,n):
a=(v[i]+cnt)/2
cnt=a
print(cnt) | n=int(eval(input()))
v=list(map(int,input().split()))
v.sort()
for i in range(1,n):
v[i]=(v[i]+v[i-1])/2
print((v[-1])) | 12 | 9 | 148 | 126 | n = int(eval(input()))
v = list(map(int, input().split()))
v.sort()
cnt = (v[0] + v[1]) / 2
for i in range(2, n):
a = (v[i] + cnt) / 2
cnt = a
print(cnt)
| n = int(eval(input()))
v = list(map(int, input().split()))
v.sort()
for i in range(1, n):
v[i] = (v[i] + v[i - 1]) / 2
print((v[-1]))
| false | 25 | [
"-cnt = (v[0] + v[1]) / 2",
"-for i in range(2, n):",
"- a = (v[i] + cnt) / 2",
"- cnt = a",
"-print(cnt)",
"+for i in range(1, n):",
"+ v[i] = (v[i] + v[i - 1]) / 2",
"+print((v[-1]))"
] | false | 0.046397 | 0.042177 | 1.100063 | [
"s727997140",
"s293299417"
] |
u008357982 | p02780 | python | s296422075 | s614837140 | 242 | 197 | 25,060 | 24,556 | Accepted | Accepted | 18.6 | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
for i in range(n):
p[i] = (p[i] * -~p[i]) / 2 / p[i]
ans = v = sum(p[:k])
for i in range(n - k):
v = v - p[i] + p[k + i]
ans = max(ans, v)
print(ans)
| n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
for i in range(n):
p[i] = -~p[i] / 2
ans = v = sum(p[:k])
for i in range(n - k):
v = v - p[i] + p[k + i]
ans = max(ans, v)
print(ans)
| 9 | 9 | 239 | 223 | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
for i in range(n):
p[i] = (p[i] * -~p[i]) / 2 / p[i]
ans = v = sum(p[:k])
for i in range(n - k):
v = v - p[i] + p[k + i]
ans = max(ans, v)
print(ans)
| n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
for i in range(n):
p[i] = -~p[i] / 2
ans = v = sum(p[:k])
for i in range(n - k):
v = v - p[i] + p[k + i]
ans = max(ans, v)
print(ans)
| false | 0 | [
"- p[i] = (p[i] * -~p[i]) / 2 / p[i]",
"+ p[i] = -~p[i] / 2"
] | false | 0.040665 | 0.040657 | 1.000195 | [
"s296422075",
"s614837140"
] |
u528470578 | p03290 | python | s467127221 | s395549443 | 222 | 24 | 43,740 | 3,064 | Accepted | Accepted | 89.19 | D, G = list(map(int, input().split()))
pc = []
for n in range(D):
p, c = list(map(int, input().split()))
pc.append([p, c, p * (n + 1)*100 + c])
ans = sum(pc[:][0])
for i in range(2 ** D):
temp = 0
numberProb = 0
box = ["-"] * D
for j in range(D):
if ((i >> j) & 1):
... | D, G = list(map(int, input().split()))
pc = [list(map(int, input().split())) for _ in range(D)]
# 大問D問中のn問といてG点以上をとる最低の問題数n
ans = int(1e10)
for i in range(2 ** D):
zen = []
atemp = 0
ktemp = 0
for j in range(D):
if (i >> j) & 1:
zen.append(True)
else:
... | 31 | 32 | 811 | 896 | D, G = list(map(int, input().split()))
pc = []
for n in range(D):
p, c = list(map(int, input().split()))
pc.append([p, c, p * (n + 1) * 100 + c])
ans = sum(pc[:][0])
for i in range(2**D):
temp = 0
numberProb = 0
box = ["-"] * D
for j in range(D):
if (i >> j) & 1:
box[D - j - ... | D, G = list(map(int, input().split()))
pc = [list(map(int, input().split())) for _ in range(D)]
# 大問D問中のn問といてG点以上をとる最低の問題数n
ans = int(1e10)
for i in range(2**D):
zen = []
atemp = 0
ktemp = 0
for j in range(D):
if (i >> j) & 1:
zen.append(True)
else:
zen.append(Fal... | false | 3.125 | [
"-pc = []",
"-for n in range(D):",
"- p, c = list(map(int, input().split()))",
"- pc.append([p, c, p * (n + 1) * 100 + c])",
"-ans = sum(pc[:][0])",
"+pc = [list(map(int, input().split())) for _ in range(D)]",
"+# 大問D問中のn問といてG点以上をとる最低の問題数n",
"+ans = int(1e10)",
"- temp = 0",
"- numberP... | false | 0.03332 | 0.045866 | 0.726457 | [
"s467127221",
"s395549443"
] |
u273201018 | p03241 | python | s007489850 | s557579006 | 45 | 29 | 3,188 | 3,064 | Accepted | Accepted | 35.56 | # Thanks for http://nihaoshijie.hatenadiary.jp/entry/2018/02/03/115759
N, M = list(map(int, input().split()))
def factorize(n):
fct = []
b, e = 2, 0
while b * b <= n:
while n % b == 0:
n = n // b
e = e + 1
if e > 0:
fct.append((b, e))
... | def get_prime_factorized(N):
R = []
b, e = 2, 0
while b ** 2 <= N:
while N % b == 0:
N = N // b
e += 1
if e > 0:
R.append([b, e])
b, e = b + 1, 0
if N > 1:
R.append([N, 1])
return R
def get_list_divisor(N, reverse=Tr... | 47 | 49 | 945 | 1,117 | # Thanks for http://nihaoshijie.hatenadiary.jp/entry/2018/02/03/115759
N, M = list(map(int, input().split()))
def factorize(n):
fct = []
b, e = 2, 0
while b * b <= n:
while n % b == 0:
n = n // b
e = e + 1
if e > 0:
fct.append((b, e))
b, e = b + ... | def get_prime_factorized(N):
R = []
b, e = 2, 0
while b**2 <= N:
while N % b == 0:
N = N // b
e += 1
if e > 0:
R.append([b, e])
b, e = b + 1, 0
if N > 1:
R.append([N, 1])
return R
def get_list_divisor(N, reverse=True):
try:
... | false | 4.081633 | [
"-# Thanks for http://nihaoshijie.hatenadiary.jp/entry/2018/02/03/115759",
"-N, M = list(map(int, input().split()))",
"+def get_prime_factorized(N):",
"+ R = []",
"+ b, e = 2, 0",
"+ while b**2 <= N:",
"+ while N % b == 0:",
"+ N = N // b",
"+ e += 1",
"+ ... | false | 0.037225 | 0.066791 | 0.557338 | [
"s007489850",
"s557579006"
] |
u624475441 | p03633 | python | s018326637 | s258351567 | 148 | 17 | 5,600 | 2,940 | Accepted | Accepted | 88.51 | from fractions import gcd
from functools import reduce
def lcm(x, y): return x * y // gcd(x, y)
N, *T = list(map(int, open(0).read().split()))
print((reduce(lcm, T))) | def gcd(a, b):
while b:
a, b = b, a % b
return a
ans = 1
for _ in range(int(eval(input()))):
t = int(eval(input()))
ans = ans * t // gcd(ans, t)
print(ans) | 5 | 10 | 162 | 177 | from fractions import gcd
from functools import reduce
def lcm(x, y):
return x * y // gcd(x, y)
N, *T = list(map(int, open(0).read().split()))
print((reduce(lcm, T)))
| def gcd(a, b):
while b:
a, b = b, a % b
return a
ans = 1
for _ in range(int(eval(input()))):
t = int(eval(input()))
ans = ans * t // gcd(ans, t)
print(ans)
| false | 50 | [
"-from fractions import gcd",
"-from functools import reduce",
"+def gcd(a, b):",
"+ while b:",
"+ a, b = b, a % b",
"+ return a",
"-def lcm(x, y):",
"- return x * y // gcd(x, y)",
"-",
"-",
"-N, *T = list(map(int, open(0).read().split()))",
"-print((reduce(lcm, T)))",
"+ans ... | false | 0.096274 | 0.036448 | 2.641375 | [
"s018326637",
"s258351567"
] |
u729133443 | p03448 | python | s032241396 | s340229594 | 50 | 18 | 3,060 | 2,940 | Accepted | Accepted | 64 | R=range;a,b,c,x=[int(eval(input()))+1for _ in[0]*4];print((sum(x-1==(10*s+2*t+r)*50for s in R(a)for t in R(b)for r in R(c)))) | a,b,c,x=[int(eval(input()))+1for _ in[0]*4];print((sum(c>x/50-s*10-t*2>0for s in range(a)for t in range(b)))) | 1 | 1 | 117 | 101 | R = range
a, b, c, x = [int(eval(input())) + 1 for _ in [0] * 4]
print(
(sum(x - 1 == (10 * s + 2 * t + r) * 50 for s in R(a) for t in R(b) for r in R(c)))
)
| a, b, c, x = [int(eval(input())) + 1 for _ in [0] * 4]
print((sum(c > x / 50 - s * 10 - t * 2 > 0 for s in range(a) for t in range(b))))
| false | 0 | [
"-R = range",
"-print(",
"- (sum(x - 1 == (10 * s + 2 * t + r) * 50 for s in R(a) for t in R(b) for r in R(c)))",
"-)",
"+print((sum(c > x / 50 - s * 10 - t * 2 > 0 for s in range(a) for t in range(b))))"
] | false | 0.055655 | 0.081623 | 0.681853 | [
"s032241396",
"s340229594"
] |
u602702913 | p02394 | python | s446491968 | s430576533 | 40 | 20 | 7,708 | 5,596 | Accepted | Accepted | 50 | W,H,x,y,r=list(map(int,input().split()))
if r<=x<=W-r and r<=y<=H-r:
print("Yes")
else:
print("No") | W,H,x,y,r=list(map(int,input().split()))
if y-r<0 or y+r>H:
print("No")
elif x-r<0 or x+r>W:
print("No")
elif y-r>=0 and y+r<=H:
print("Yes")
elif x-r>=0 and x+r<=W:
print("Yes")
| 7 | 21 | 105 | 224 | W, H, x, y, r = list(map(int, input().split()))
if r <= x <= W - r and r <= y <= H - r:
print("Yes")
else:
print("No")
| W, H, x, y, r = list(map(int, input().split()))
if y - r < 0 or y + r > H:
print("No")
elif x - r < 0 or x + r > W:
print("No")
elif y - r >= 0 and y + r <= H:
print("Yes")
elif x - r >= 0 and x + r <= W:
print("Yes")
| false | 66.666667 | [
"-if r <= x <= W - r and r <= y <= H - r:",
"+if y - r < 0 or y + r > H:",
"+ print(\"No\")",
"+elif x - r < 0 or x + r > W:",
"+ print(\"No\")",
"+elif y - r >= 0 and y + r <= H:",
"-else:",
"- print(\"No\")",
"+elif x - r >= 0 and x + r <= W:",
"+ print(\"Yes\")"
] | false | 0.141154 | 0.093791 | 1.504984 | [
"s446491968",
"s430576533"
] |
u721316601 | p03208 | python | s031354003 | s441006952 | 247 | 119 | 8,280 | 8,280 | Accepted | Accepted | 51.82 | ans = 10**10
N, K = list(map(int, input().split()))
h = sorted([int(eval(input())) for i in range(N)])
for i in range(N-K+1):
ans = min(ans, h[i+K-1] - h[i])
print(ans) | import sys
input = sys.stdin.readline
def main():
N, K = list(map(int, input().split()))
h = sorted([int(eval(input())) for i in range(N)])
ans = float('inf')
for i in range(N-K+1):
ans = min(ans, h[i+K-1] - h[i])
print(ans)
if __name__ == '__main__':
... | 7 | 17 | 167 | 316 | ans = 10**10
N, K = list(map(int, input().split()))
h = sorted([int(eval(input())) for i in range(N)])
for i in range(N - K + 1):
ans = min(ans, h[i + K - 1] - h[i])
print(ans)
| import sys
input = sys.stdin.readline
def main():
N, K = list(map(int, input().split()))
h = sorted([int(eval(input())) for i in range(N)])
ans = float("inf")
for i in range(N - K + 1):
ans = min(ans, h[i + K - 1] - h[i])
print(ans)
if __name__ == "__main__":
main()
| false | 58.823529 | [
"-ans = 10**10",
"-N, K = list(map(int, input().split()))",
"-h = sorted([int(eval(input())) for i in range(N)])",
"-for i in range(N - K + 1):",
"- ans = min(ans, h[i + K - 1] - h[i])",
"-print(ans)",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+",
"+def main():",
"+ N, K... | false | 0.077661 | 0.036405 | 2.133246 | [
"s031354003",
"s441006952"
] |
u493813116 | p03401 | python | s325551236 | s664929452 | 241 | 188 | 14,048 | 14,048 | Accepted | Accepted | 21.99 | N = int(eval(input()))
A = [0] + list(map(int, input().split())) + [0]
s = 0
for i in range(1, N+2):
x = abs(A[i-1] - A[i])
s += x
for i in range(1, N+1):
x = abs(A[i-1] - A[i])
y = abs(A[i] - A[i+1])
z = abs(A[i-1] - A[i+1])
print((s - x - y + z))
| N = int(eval(input()))
A = [0] + list(map(int, input().split())) + [0]
C = [abs(A[i-1] - A[i]) for i in range(1, N+2)]
S = sum(C)
for i in range(1, N+1):
x = C[i-1]
y = C[i]
z = abs(A[i-1] - A[i+1])
print((S - x - y + z))
| 14 | 11 | 281 | 242 | N = int(eval(input()))
A = [0] + list(map(int, input().split())) + [0]
s = 0
for i in range(1, N + 2):
x = abs(A[i - 1] - A[i])
s += x
for i in range(1, N + 1):
x = abs(A[i - 1] - A[i])
y = abs(A[i] - A[i + 1])
z = abs(A[i - 1] - A[i + 1])
print((s - x - y + z))
| N = int(eval(input()))
A = [0] + list(map(int, input().split())) + [0]
C = [abs(A[i - 1] - A[i]) for i in range(1, N + 2)]
S = sum(C)
for i in range(1, N + 1):
x = C[i - 1]
y = C[i]
z = abs(A[i - 1] - A[i + 1])
print((S - x - y + z))
| false | 21.428571 | [
"-s = 0",
"-for i in range(1, N + 2):",
"- x = abs(A[i - 1] - A[i])",
"- s += x",
"+C = [abs(A[i - 1] - A[i]) for i in range(1, N + 2)]",
"+S = sum(C)",
"- x = abs(A[i - 1] - A[i])",
"- y = abs(A[i] - A[i + 1])",
"+ x = C[i - 1]",
"+ y = C[i]",
"- print((s - x - y + z))",
... | false | 0.043947 | 0.045496 | 0.965934 | [
"s325551236",
"s664929452"
] |
u127499732 | p03379 | python | s141771610 | s525874276 | 321 | 210 | 34,064 | 25,052 | Accepted | Accepted | 34.58 | def main():
n, *x = list(map(int, open(0).read().split()))
y = sorted(x)
a, b = y[n // 2 - 1], y[n // 2]
d = dict()
for i, j in enumerate(y, 1):
if i <= n // 2:
d[j] = b
else:
d[j] = a
for i in x:
print((d[i]))
if __name__ == '__m... | def main():
n, *x = list(map(int, open(0).read().split()))
y = sorted(x)
a, b = y[n // 2 - 1], y[n // 2]
ans = ""
for i in x:
if i <= a:
ans += str(b) + "\n"
else:
ans += str(a) + "\n"
print(ans)
if __name__ == '__main__':
main()
| 17 | 16 | 332 | 310 | def main():
n, *x = list(map(int, open(0).read().split()))
y = sorted(x)
a, b = y[n // 2 - 1], y[n // 2]
d = dict()
for i, j in enumerate(y, 1):
if i <= n // 2:
d[j] = b
else:
d[j] = a
for i in x:
print((d[i]))
if __name__ == "__main__":
main... | def main():
n, *x = list(map(int, open(0).read().split()))
y = sorted(x)
a, b = y[n // 2 - 1], y[n // 2]
ans = ""
for i in x:
if i <= a:
ans += str(b) + "\n"
else:
ans += str(a) + "\n"
print(ans)
if __name__ == "__main__":
main()
| false | 5.882353 | [
"- d = dict()",
"- for i, j in enumerate(y, 1):",
"- if i <= n // 2:",
"- d[j] = b",
"+ ans = \"\"",
"+ for i in x:",
"+ if i <= a:",
"+ ans += str(b) + \"\\n\"",
"- d[j] = a",
"- for i in x:",
"- print((d[i]))",
"+ ... | false | 0.062583 | 0.085015 | 0.736142 | [
"s141771610",
"s525874276"
] |
u877470159 | p03634 | python | s769415023 | s617027962 | 1,537 | 582 | 79,776 | 72,128 | Accepted | Accepted | 62.13 | n=int(eval(input()))
G=[[] for i in range(n)]
for i in range(n-1):
a,b,c=list(map(int,input().split()))
G[a-1].append((b-1,c))
G[b-1].append((a-1,c))
q,k=list(map(int,input().split()))
k=k-1
stack=[k]
dis=[-1]*n
dis[k]=0
while stack!=[]:
new=[]
for j in stack:
d=dis[j]
... | import sys
input = sys.stdin.readline
n = int(eval(input()))
connect_list = [[] for i in range(n)]
for i in range(n-1):
a, b, c = [ int(v)-1 for v in input().split() ]
c += 1
connect_list[a].append((b,c))
connect_list[b].append((a,c))
q, k = [ int(v) for v in input().split() ]
k -= 1
... | 26 | 35 | 536 | 845 | n = int(eval(input()))
G = [[] for i in range(n)]
for i in range(n - 1):
a, b, c = list(map(int, input().split()))
G[a - 1].append((b - 1, c))
G[b - 1].append((a - 1, c))
q, k = list(map(int, input().split()))
k = k - 1
stack = [k]
dis = [-1] * n
dis[k] = 0
while stack != []:
new = []
for j in stack... | import sys
input = sys.stdin.readline
n = int(eval(input()))
connect_list = [[] for i in range(n)]
for i in range(n - 1):
a, b, c = [int(v) - 1 for v in input().split()]
c += 1
connect_list[a].append((b, c))
connect_list[b].append((a, c))
q, k = [int(v) for v in input().split()]
k -= 1
shortest_list = ... | false | 25.714286 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"-G = [[] for i in range(n)]",
"+connect_list = [[] for i in range(n)]",
"- a, b, c = list(map(int, input().split()))",
"- G[a - 1].append((b - 1, c))",
"- G[b - 1].append((a - 1, c))",
"-q, k = list(map(int, input().split()))",
"-k = k -... | false | 0.068175 | 0.047442 | 1.437007 | [
"s769415023",
"s617027962"
] |
u368249389 | p02761 | python | s704110461 | s791189029 | 183 | 20 | 40,524 | 3,064 | Accepted | Accepted | 89.07 | # Problem C - Guess The Number
# input
N, M = list(map(int, input().split()))
# initialization
input_ok = True
num_list = [-1]*N
for i in range(M):
s, c = list(map(int, input().split()))
if N>=2 and s==1:
if c==0:
input_ok = False
break
if num_list[s-1]==-1:... | # Problem C - Guess The Number
# input
N, M = list(map(int, input().split()))
# initialization
keta = 0
if N==0:
keta = 1
else:
keta = N
keta_list = [-1]*keta
input_ok = True
for i in range(M):
s, c = list(map(int, input().split()))
if not keta_list[s-1]==-1:
if not keta_list[s... | 41 | 48 | 916 | 1,153 | # Problem C - Guess The Number
# input
N, M = list(map(int, input().split()))
# initialization
input_ok = True
num_list = [-1] * N
for i in range(M):
s, c = list(map(int, input().split()))
if N >= 2 and s == 1:
if c == 0:
input_ok = False
break
if num_list[s - 1] == -1:
... | # Problem C - Guess The Number
# input
N, M = list(map(int, input().split()))
# initialization
keta = 0
if N == 0:
keta = 1
else:
keta = N
keta_list = [-1] * keta
input_ok = True
for i in range(M):
s, c = list(map(int, input().split()))
if not keta_list[s - 1] == -1:
if not keta_list[s - 1] == c... | false | 14.583333 | [
"+keta = 0",
"+if N == 0:",
"+ keta = 1",
"+else:",
"+ keta = N",
"+keta_list = [-1] * keta",
"-num_list = [-1] * N",
"- if N >= 2 and s == 1:",
"- if c == 0:",
"+ if not keta_list[s - 1] == -1:",
"+ if not keta_list[s - 1] == c:",
"- if num_list[s - 1] == -1:",
... | false | 0.120175 | 0.039473 | 3.044488 | [
"s704110461",
"s791189029"
] |
u150984829 | p02278 | python | s401860508 | s599270207 | 30 | 20 | 5,620 | 5,868 | Accepted | Accepted | 33.33 | n = int(eval(input()))
l = list(map(int, input().split()))
s = sorted(l)
cost = 0
for i in range(n):
a = l.index(s[i])
j = 0
while a > i:
j += 1
b = l.index(s[a])
cost += l[b]
l[a], l[b] = l[b], l[a]
a = b
cost += min(s[i] * j, s[i] * 2 + s[0] * (j + ... | import itertools
WAIT, PRESORT, SORTED = 0, 1, 2
cost = 0
def swap(w1, w2):
global cost
cost += w1[WAIT] + w2[WAIT]
w1[PRESORT], w2[PRESORT] = w2[PRESORT], w1[PRESORT]
n = eval(input())
w = [[wi, i, None] for i, wi in enumerate(map(int, input().split()))]
s = sorted(w)
minw = s[... | 15 | 36 | 331 | 782 | n = int(eval(input()))
l = list(map(int, input().split()))
s = sorted(l)
cost = 0
for i in range(n):
a = l.index(s[i])
j = 0
while a > i:
j += 1
b = l.index(s[a])
cost += l[b]
l[a], l[b] = l[b], l[a]
a = b
cost += min(s[i] * j, s[i] * 2 + s[0] * (j + 2))
print(cos... | import itertools
WAIT, PRESORT, SORTED = 0, 1, 2
cost = 0
def swap(w1, w2):
global cost
cost += w1[WAIT] + w2[WAIT]
w1[PRESORT], w2[PRESORT] = w2[PRESORT], w1[PRESORT]
n = eval(input())
w = [[wi, i, None] for i, wi in enumerate(map(int, input().split()))]
s = sorted(w)
minw = s[0]
for i, wi in enumerat... | false | 58.333333 | [
"-n = int(eval(input()))",
"-l = list(map(int, input().split()))",
"-s = sorted(l)",
"+import itertools",
"+",
"+WAIT, PRESORT, SORTED = 0, 1, 2",
"-for i in range(n):",
"- a = l.index(s[i])",
"- j = 0",
"- while a > i:",
"- j += 1",
"- b = l.index(s[a])",
"- co... | false | 0.042189 | 0.041109 | 1.026271 | [
"s401860508",
"s599270207"
] |
u852690916 | p02762 | python | s314213526 | s079873561 | 1,550 | 1,297 | 68,692 | 18,152 | Accepted | Accepted | 16.32 | N, M, K=list(map(int, input().split()))
class UnionFindTree:
def __init__(self, n):
self.parent = [-1 for _ in range(n)]
def root(self, x):
p, seq = self.parent[x], list()
while p >= 0:
seq.append(x)
x, p = p, self.parent[p]
for c in seq: self... | N, M, K=list(map(int, input().split()))
class UnionFindTree:
def __init__(self, n):
self.parent = [-1 for _ in range(n)]
def root(self, x):
p, seq = self.parent[x], list()
while p >= 0:
seq.append(x)
x, p = p, self.parent[p]
for c in seq: self... | 43 | 43 | 1,249 | 1,232 | N, M, K = list(map(int, input().split()))
class UnionFindTree:
def __init__(self, n):
self.parent = [-1 for _ in range(n)]
def root(self, x):
p, seq = self.parent[x], list()
while p >= 0:
seq.append(x)
x, p = p, self.parent[p]
for c in seq:
... | N, M, K = list(map(int, input().split()))
class UnionFindTree:
def __init__(self, n):
self.parent = [-1 for _ in range(n)]
def root(self, x):
p, seq = self.parent[x], list()
while p >= 0:
seq.append(x)
x, p = p, self.parent[p]
for c in seq:
... | false | 0 | [
"-friend_or_block = [set() for _ in range(N)]",
"+friend_or_block = [0 for _ in range(N)]",
"- friend_or_block[a].add(b)",
"- friend_or_block[b].add(a)",
"+ friend_or_block[a] += 1",
"+ friend_or_block[b] += 1",
"- friend_or_block[c].add(d)",
"- friend_or_block[d].add(c)",
... | false | 0.088604 | 0.121413 | 0.729772 | [
"s314213526",
"s079873561"
] |
u788137651 | p03862 | python | s884635043 | s527619707 | 235 | 159 | 59,792 | 17,420 | Accepted | Accepted | 32.34 | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import ... | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import... | 52 | 64 | 1,460 | 1,796 | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
from math import floor, ceil, sqrt, factorial, log # log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import Counter, defau... | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
from math import floor, sqrt, factorial, hypot, log # log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import Counter, defa... | false | 18.75 | [
"-from math import floor, ceil, sqrt, factorial, log # log2ないyp",
"+from math import floor, sqrt, factorial, hypot, log # log2ないyp",
"+from fractions import gcd",
"+from random import randint",
"+",
"+",
"+def ceil(a, b):",
"+ return (a + b - 1) // b",
"+",
"- N, x = MI()",
"+ N, X = ... | false | 0.038111 | 0.037446 | 1.017755 | [
"s884635043",
"s527619707"
] |
u693953100 | p03666 | python | s266561283 | s880161741 | 239 | 171 | 3,060 | 3,064 | Accepted | Accepted | 28.45 | n,a,b,c,d = list(map(int,input().split()))
mx = n-1
for i in range(n):
if a-d*i+c*(mx-i) <= b<=a-c*i+d*(mx-i):
print('YES')
exit()
print('NO') | def solve():
n,a,b,c,d = list(map(int,input().split()))
mx = n-1
for i in range(n):
if a-d*i+c*(mx-i) <= b<=a-c*i+d*(mx-i):
print('YES')
return
print('NO')
if __name__=='__main__':
solve() | 7 | 10 | 162 | 243 | n, a, b, c, d = list(map(int, input().split()))
mx = n - 1
for i in range(n):
if a - d * i + c * (mx - i) <= b <= a - c * i + d * (mx - i):
print("YES")
exit()
print("NO")
| def solve():
n, a, b, c, d = list(map(int, input().split()))
mx = n - 1
for i in range(n):
if a - d * i + c * (mx - i) <= b <= a - c * i + d * (mx - i):
print("YES")
return
print("NO")
if __name__ == "__main__":
solve()
| false | 30 | [
"-n, a, b, c, d = list(map(int, input().split()))",
"-mx = n - 1",
"-for i in range(n):",
"- if a - d * i + c * (mx - i) <= b <= a - c * i + d * (mx - i):",
"- print(\"YES\")",
"- exit()",
"-print(\"NO\")",
"+def solve():",
"+ n, a, b, c, d = list(map(int, input().split()))",
"... | false | 0.11293 | 0.080965 | 1.394808 | [
"s266561283",
"s880161741"
] |
u054514819 | p03283 | python | s121350953 | s069100258 | 1,612 | 225 | 26,180 | 81,076 | Accepted | Accepted | 86.04 | N, M, Q = list(map(int, input().split()))
wa = [[0]*(N+1) for _ in range(N+1)]
import numpy as np
for _ in range(M):
l, r = list(map(int, input().split()))
wa[l][r] += 1
cwa = np.cumsum(np.cumsum(wa, axis=0), axis=1).tolist()
for i in range(Q):
p, q = list(map(int, input().split()))
ans = c... | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
N, M, Q = mapint()
query = [[0]*(N+1) for _ in range(N+1)]
for _ in range(M):
l, r = mapint()
query[l][r] += 1
from itertools import accumulate
for i in ran... | 13 | 21 | 339 | 535 | N, M, Q = list(map(int, input().split()))
wa = [[0] * (N + 1) for _ in range(N + 1)]
import numpy as np
for _ in range(M):
l, r = list(map(int, input().split()))
wa[l][r] += 1
cwa = np.cumsum(np.cumsum(wa, axis=0), axis=1).tolist()
for i in range(Q):
p, q = list(map(int, input().split()))
ans = cwa[N][... | import sys
def input():
return sys.stdin.readline().strip()
def mapint():
return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
N, M, Q = mapint()
query = [[0] * (N + 1) for _ in range(N + 1)]
for _ in range(M):
l, r = mapint()
query[l][r] += 1
from itertools import accumulate
for i... | false | 38.095238 | [
"-N, M, Q = list(map(int, input().split()))",
"-wa = [[0] * (N + 1) for _ in range(N + 1)]",
"-import numpy as np",
"+import sys",
"+",
"+def input():",
"+ return sys.stdin.readline().strip()",
"+",
"+",
"+def mapint():",
"+ return list(map(int, input().split()))",
"+",
"+",
"+sys.se... | false | 0.250357 | 0.036904 | 6.784005 | [
"s121350953",
"s069100258"
] |
u341543478 | p03285 | python | s907229699 | s443944422 | 23 | 21 | 9,172 | 9,188 | Accepted | Accepted | 8.7 | n = int(eval(input()))
for i in range(100//4):
for j in range(100//7):
if n == i * 4 + j * 7:
print('Yes')
exit()
print('No') | n = int(eval(input()))
for i in range(100 // 4 + 1):
for j in range(100 // 7 + 1):
if n == i * 4 + j * 7:
print('Yes')
exit()
print('No')
| 7 | 7 | 161 | 174 | n = int(eval(input()))
for i in range(100 // 4):
for j in range(100 // 7):
if n == i * 4 + j * 7:
print("Yes")
exit()
print("No")
| n = int(eval(input()))
for i in range(100 // 4 + 1):
for j in range(100 // 7 + 1):
if n == i * 4 + j * 7:
print("Yes")
exit()
print("No")
| false | 0 | [
"-for i in range(100 // 4):",
"- for j in range(100 // 7):",
"+for i in range(100 // 4 + 1):",
"+ for j in range(100 // 7 + 1):"
] | false | 0.035496 | 0.05047 | 0.703305 | [
"s907229699",
"s443944422"
] |
u674588203 | p02584 | python | s692816735 | s828251066 | 36 | 29 | 9,104 | 9,180 | Accepted | Accepted | 19.44 | # AtCoder Beginner Contest 175
# C - Walking Takahashi
X,K,D =list(map(int,input().split()))
KOE=K%2
A=abs(X)//D
M=abs(X)%D
# print(A)
if K<=A:
print((abs(X)-K*D))
exit()
else :
if A%2==KOE:
print(M)
else :
print((min(abs(M+D),abs(M-D)))) | # AtCoder Beginner Contest 175
# C - Walking Takahashi
X,K,D =list(map(int,input().split()))
X=abs(X)
A=X//D
M=X%D
if K<=A:
print((X-K*D))
exit()
else :
if A%2==K%2:
print(M)
else :
print((min(abs(M+D),abs(M-D)))) | 21 | 19 | 286 | 258 | # AtCoder Beginner Contest 175
# C - Walking Takahashi
X, K, D = list(map(int, input().split()))
KOE = K % 2
A = abs(X) // D
M = abs(X) % D
# print(A)
if K <= A:
print((abs(X) - K * D))
exit()
else:
if A % 2 == KOE:
print(M)
else:
print((min(abs(M + D), abs(M - D))))
| # AtCoder Beginner Contest 175
# C - Walking Takahashi
X, K, D = list(map(int, input().split()))
X = abs(X)
A = X // D
M = X % D
if K <= A:
print((X - K * D))
exit()
else:
if A % 2 == K % 2:
print(M)
else:
print((min(abs(M + D), abs(M - D))))
| false | 9.52381 | [
"-KOE = K % 2",
"-A = abs(X) // D",
"-M = abs(X) % D",
"-# print(A)",
"+X = abs(X)",
"+A = X // D",
"+M = X % D",
"- print((abs(X) - K * D))",
"+ print((X - K * D))",
"- if A % 2 == KOE:",
"+ if A % 2 == K % 2:"
] | false | 0.03559 | 0.083056 | 0.428504 | [
"s692816735",
"s828251066"
] |
u623819879 | p03814 | python | s913104206 | s168795056 | 188 | 173 | 41,756 | 41,456 | Accepted | Accepted | 7.98 | x=1e9
for j,i in enumerate(eval(input())):
if i=='A':x=min(x,j)
if i=='Z':y=j
print((y-x+1)) | s=eval(input())
print((len(s)-s[::-1].find('Z')-s.find('A'))) | 5 | 2 | 90 | 54 | x = 1e9
for j, i in enumerate(eval(input())):
if i == "A":
x = min(x, j)
if i == "Z":
y = j
print((y - x + 1))
| s = eval(input())
print((len(s) - s[::-1].find("Z") - s.find("A")))
| false | 60 | [
"-x = 1e9",
"-for j, i in enumerate(eval(input())):",
"- if i == \"A\":",
"- x = min(x, j)",
"- if i == \"Z\":",
"- y = j",
"-print((y - x + 1))",
"+s = eval(input())",
"+print((len(s) - s[::-1].find(\"Z\") - s.find(\"A\")))"
] | false | 0.04547 | 0.048649 | 0.934658 | [
"s913104206",
"s168795056"
] |
u060793972 | p02911 | python | s217274285 | s641989545 | 221 | 73 | 5,028 | 14,068 | Accepted | Accepted | 66.97 | n,k,q=list(map(int,input().split()))
l=[0]*n
for i in range(q):
l[int(eval(input()))-1]+=1
print(('\n'.join('Yes' if l[i]-q+k>0 else 'No' for i in range(n)))) | n, k, q, *a = list(map(int, open(0).read().split()))
#n,k,q=map(int,input().split())
l=[0]*n
for i in a:
l[i-1]+=1
print(('\n'.join('Yes' if l[i]-q+k>0 else 'No' for i in range(n)))) | 5 | 6 | 152 | 183 | n, k, q = list(map(int, input().split()))
l = [0] * n
for i in range(q):
l[int(eval(input())) - 1] += 1
print(("\n".join("Yes" if l[i] - q + k > 0 else "No" for i in range(n))))
| n, k, q, *a = list(map(int, open(0).read().split()))
# n,k,q=map(int,input().split())
l = [0] * n
for i in a:
l[i - 1] += 1
print(("\n".join("Yes" if l[i] - q + k > 0 else "No" for i in range(n))))
| false | 16.666667 | [
"-n, k, q = list(map(int, input().split()))",
"+n, k, q, *a = list(map(int, open(0).read().split()))",
"+# n,k,q=map(int,input().split())",
"-for i in range(q):",
"- l[int(eval(input())) - 1] += 1",
"+for i in a:",
"+ l[i - 1] += 1"
] | false | 0.036819 | 0.035827 | 1.027696 | [
"s217274285",
"s641989545"
] |
u143278390 | p03845 | python | s196140871 | s910988707 | 30 | 18 | 3,444 | 3,060 | Accepted | Accepted | 40 | import copy
n=int(eval(input()))
t=[int(i) for i in input().split()]
m=int(eval(input()))
for i in range(m):
cur=copy.deepcopy(t)
drink=[int(i) for i in input().split()]
cur[drink[0]-1]=drink[1]
print((sum(cur))) | n=int(eval(input()))
t=[int(i) for i in input().split()]
s=sum(t)
m=int(eval(input()))
for i in range(m):
p,m=[int(i) for i in input().split()]
print((s-(t[p-1]-m))) | 9 | 7 | 222 | 165 | import copy
n = int(eval(input()))
t = [int(i) for i in input().split()]
m = int(eval(input()))
for i in range(m):
cur = copy.deepcopy(t)
drink = [int(i) for i in input().split()]
cur[drink[0] - 1] = drink[1]
print((sum(cur)))
| n = int(eval(input()))
t = [int(i) for i in input().split()]
s = sum(t)
m = int(eval(input()))
for i in range(m):
p, m = [int(i) for i in input().split()]
print((s - (t[p - 1] - m)))
| false | 22.222222 | [
"-import copy",
"-",
"+s = sum(t)",
"- cur = copy.deepcopy(t)",
"- drink = [int(i) for i in input().split()]",
"- cur[drink[0] - 1] = drink[1]",
"- print((sum(cur)))",
"+ p, m = [int(i) for i in input().split()]",
"+ print((s - (t[p - 1] - m)))"
] | false | 0.046717 | 0.044534 | 1.04902 | [
"s196140871",
"s910988707"
] |
u179169725 | p04030 | python | s309066160 | s312520680 | 190 | 163 | 38,384 | 38,580 | Accepted | Accepted | 14.21 | import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate
def read_ints():
return list(map(int, read().split()))
def read_a_int():
return int(read())
def read_tuple(H):
'''
H is number of rows
'''
ret = []
for _ in range(H):
... | import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate
def mina(*argv, sub=1): return list([x - sub for x in argv])
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと
def read_a_int(): return int(read())
def read_ints(): return list(map(int, read().split()))
def r... | 66 | 64 | 1,416 | 1,495 | import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate
def read_ints():
return list(map(int, read().split()))
def read_a_int():
return int(read())
def read_tuple(H):
"""
H is number of rows
"""
ret = []
for _ in range(H):
ret.append(tupl... | import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate
def mina(*argv, sub=1):
return list([x - sub for x in argv])
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと
def read_a_int():
return int(read())
def read_ints():
return list(map(int, read().split()))
def read_... | false | 3.030303 | [
"+def mina(*argv, sub=1):",
"+ return list([x - sub for x in argv])",
"+",
"+",
"+# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと",
"+def read_a_int():",
"+ return int(read())",
"+",
"+",
"-def read_a_int():",
"- return int(read())",
"+def read_col(H):",
"+ \"\"\"H is number of rows",
... | false | 0.045974 | 0.047161 | 0.974836 | [
"s309066160",
"s312520680"
] |
u648212584 | p04006 | python | s689911948 | s184965847 | 1,698 | 307 | 3,316 | 42,608 | Accepted | Accepted | 81.92 | import sys
input = sys.stdin.buffer.readline
def main():
N,x = list(map(int,input().split()))
a = list(map(int,input().split()))
b = a.copy()
ans = 10**15
for i in range(N):
time = i*x+sum(b)
ans = min(ans,time)
for now in range(N):
b[now] = min... | import sys
input = sys.stdin.buffer.readline
import copy
def main():
N,x = list(map(int,input().split()))
a = list(map(int,input().split()))
b = copy.deepcopy(a)
ans = 10**15
for i in range(N):
time = i*x+sum(b)
ans = min(ans,time)
for now in range(N):
... | 20 | 21 | 406 | 427 | import sys
input = sys.stdin.buffer.readline
def main():
N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
b = a.copy()
ans = 10**15
for i in range(N):
time = i * x + sum(b)
ans = min(ans, time)
for now in range(N):
b[now] = min(b[now],... | import sys
input = sys.stdin.buffer.readline
import copy
def main():
N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
b = copy.deepcopy(a)
ans = 10**15
for i in range(N):
time = i * x + sum(b)
ans = min(ans, time)
for now in range(N):
... | false | 4.761905 | [
"+import copy",
"- b = a.copy()",
"+ b = copy.deepcopy(a)"
] | false | 0.069511 | 0.036108 | 1.925101 | [
"s689911948",
"s184965847"
] |
u530606147 | p03814 | python | s795649019 | s761415043 | 43 | 24 | 3,516 | 6,376 | Accepted | Accepted | 44.19 | s = eval(input())
for i in range(len(s)):
if s[i] == 'A':
f = i
break
for i in range(len(s)):
if s[i] == 'Z':
e = i
print((e-f+1))
| s = eval(input())
print((len(s) - list(reversed(list(s))).index('Z') - s.index('A')))
| 11 | 3 | 155 | 81 | s = eval(input())
for i in range(len(s)):
if s[i] == "A":
f = i
break
for i in range(len(s)):
if s[i] == "Z":
e = i
print((e - f + 1))
| s = eval(input())
print((len(s) - list(reversed(list(s))).index("Z") - s.index("A")))
| false | 72.727273 | [
"-for i in range(len(s)):",
"- if s[i] == \"A\":",
"- f = i",
"- break",
"-for i in range(len(s)):",
"- if s[i] == \"Z\":",
"- e = i",
"-print((e - f + 1))",
"+print((len(s) - list(reversed(list(s))).index(\"Z\") - s.index(\"A\")))"
] | false | 0.07889 | 0.079124 | 0.997044 | [
"s795649019",
"s761415043"
] |
u180528413 | p03545 | python | s363335982 | s628022788 | 20 | 18 | 3,064 | 3,064 | Accepted | Accepted | 10 | n = eval(input())
op_cnt = len(n) - 1
for i in range(2 ** op_cnt):
op = ['-'] * op_cnt
for j in range(op_cnt):
if ((i >> j) & 1):
op[op_cnt - 1 - j] = '+'
formula = ''
for p_n, p_o in zip(n, op + ['']):
formula += p_n + p_o
result = eval(formula)
if r... | import sys
readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split(''))
nl = lambda: list(map(int, readline().split()))
prl = lambda x: print(*x ,sep='\n')
a = ns()
for i in range(2**3):
ans = ... | 15 | 21 | 371 | 553 | n = eval(input())
op_cnt = len(n) - 1
for i in range(2**op_cnt):
op = ["-"] * op_cnt
for j in range(op_cnt):
if (i >> j) & 1:
op[op_cnt - 1 - j] = "+"
formula = ""
for p_n, p_o in zip(n, op + [""]):
formula += p_n + p_o
result = eval(formula)
if result == 7:
p... | import sys
readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split(""))
nl = lambda: list(map(int, readline().split()))
prl = lambda x: print(*x, sep="\n")
a = ns()
for i in range(2**3):
ans = "{}".format(a... | false | 28.571429 | [
"-n = eval(input())",
"-op_cnt = len(n) - 1",
"-for i in range(2**op_cnt):",
"- op = [\"-\"] * op_cnt",
"- for j in range(op_cnt):",
"+import sys",
"+",
"+readline = sys.stdin.readline",
"+readall = sys.stdin.read",
"+ns = lambda: readline().rstrip()",
"+ni = lambda: int(readline().rstrip(... | false | 0.03475 | 0.036192 | 0.96016 | [
"s363335982",
"s628022788"
] |
u571281863 | p02647 | python | s522405544 | s626699327 | 310 | 276 | 169,500 | 162,276 | Accepted | Accepted | 10.97 | N,K=list(map(int,input().split()))
A=list(map(int,input().split()))
for _ in range(K):
B=[0]*(N+1)
for i in range(N):
B[max(0,i-A[i])]+=1
B[min(N,i+A[i]+1)]-=1
for i in range(1,N):
B[i]+=B[i-1]
if A==B:
break
A=B[:]
print((*A[:-1])) | N,K,*A=list(map(int,open(0).read().split()))
for _ in range(K):
B=[0]*(N+1)
for i in range(N):
B[max(0,i-A[i])]+=1
B[min(N,i+A[i]+1)]-=1
for i in range(N):B[i+1]+=B[i]
if A==B:break
A=B
print((*A[:-1])) | 13 | 10 | 262 | 221 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
for _ in range(K):
B = [0] * (N + 1)
for i in range(N):
B[max(0, i - A[i])] += 1
B[min(N, i + A[i] + 1)] -= 1
for i in range(1, N):
B[i] += B[i - 1]
if A == B:
break
A = B[:]
print((*A[:-1]))
| N, K, *A = list(map(int, open(0).read().split()))
for _ in range(K):
B = [0] * (N + 1)
for i in range(N):
B[max(0, i - A[i])] += 1
B[min(N, i + A[i] + 1)] -= 1
for i in range(N):
B[i + 1] += B[i]
if A == B:
break
A = B
print((*A[:-1]))
| false | 23.076923 | [
"-N, K = list(map(int, input().split()))",
"-A = list(map(int, input().split()))",
"+N, K, *A = list(map(int, open(0).read().split()))",
"- for i in range(1, N):",
"- B[i] += B[i - 1]",
"+ for i in range(N):",
"+ B[i + 1] += B[i]",
"- A = B[:]",
"+ A = B"
] | false | 0.046485 | 0.037323 | 1.2455 | [
"s522405544",
"s626699327"
] |
u163783894 | p03329 | python | s147502508 | s837452029 | 1,266 | 1,081 | 63,184 | 13,812 | Accepted | Accepted | 14.61 | # import math
# import itertools
# from collections import deque
# from collections import defaultdict
# import heapq
import sys
# import numpy as np
# from scipy.special import comb
sys.setrecursionlimit(100000)
INF = float('inf')
N = int(eval(input()))
memo = [INF] * (N + 1)
memo[0] = 0
def f(n):... | # import math
# import itertools
# from collections import deque
# from collections import defaultdict
# import heapq
import sys
# import numpy as np
# from scipy.special import comb
sys.setrecursionlimit(100000)
INF = 100100100
N = int(eval(input()))
memo = [-1] * (N + 1)
memo[0] = 0
def f(n):
... | 55 | 56 | 866 | 863 | # import math
# import itertools
# from collections import deque
# from collections import defaultdict
# import heapq
import sys
# import numpy as np
# from scipy.special import comb
sys.setrecursionlimit(100000)
INF = float("inf")
N = int(eval(input()))
memo = [INF] * (N + 1)
memo[0] = 0
def f(n):
# 0なら終了
i... | # import math
# import itertools
# from collections import deque
# from collections import defaultdict
# import heapq
import sys
# import numpy as np
# from scipy.special import comb
sys.setrecursionlimit(100000)
INF = 100100100
N = int(eval(input()))
memo = [-1] * (N + 1)
memo[0] = 0
def f(n):
# 0なら終了
if n ... | false | 1.785714 | [
"-INF = float(\"inf\")",
"+INF = 100100100",
"-memo = [INF] * (N + 1)",
"+memo = [-1] * (N + 1)",
"- if not memo[n] == INF:",
"+ if not memo[n] == -1:"
] | false | 0.229321 | 0.162323 | 1.412742 | [
"s147502508",
"s837452029"
] |
u952708174 | p03986 | python | s599077902 | s576471567 | 67 | 58 | 5,096 | 5,096 | Accepted | Accepted | 13.43 | X = input().strip()
stack = []
for c in X:
if c == 'S':
stack.append(c)
else:
if len(stack) == 0 or stack[-1] == 'T':
stack.append(c)
else:
stack.pop()
print((len(stack))) | def a_st_ring():
X = eval(input())
stack = []
for c in X:
if len(stack) > 0 and stack[-1] == 'S' and c == 'T':
stack.pop()
else:
stack.append(c)
return len(stack)
print((a_st_ring())) | 12 | 11 | 237 | 242 | X = input().strip()
stack = []
for c in X:
if c == "S":
stack.append(c)
else:
if len(stack) == 0 or stack[-1] == "T":
stack.append(c)
else:
stack.pop()
print((len(stack)))
| def a_st_ring():
X = eval(input())
stack = []
for c in X:
if len(stack) > 0 and stack[-1] == "S" and c == "T":
stack.pop()
else:
stack.append(c)
return len(stack)
print((a_st_ring()))
| false | 8.333333 | [
"-X = input().strip()",
"-stack = []",
"-for c in X:",
"- if c == \"S\":",
"- stack.append(c)",
"- else:",
"- if len(stack) == 0 or stack[-1] == \"T\":",
"+def a_st_ring():",
"+ X = eval(input())",
"+ stack = []",
"+ for c in X:",
"+ if len(stack) > 0 and st... | false | 0.072651 | 0.073786 | 0.984624 | [
"s599077902",
"s576471567"
] |
u747602774 | p03777 | python | s996053210 | s411544776 | 164 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.63 | s=input().split()
if s[0]==s[1]:
print('H')
else:
print('D') | a,b = input().split()
print(('H' if a == b else 'D')) | 6 | 2 | 70 | 52 | s = input().split()
if s[0] == s[1]:
print("H")
else:
print("D")
| a, b = input().split()
print(("H" if a == b else "D"))
| false | 66.666667 | [
"-s = input().split()",
"-if s[0] == s[1]:",
"- print(\"H\")",
"-else:",
"- print(\"D\")",
"+a, b = input().split()",
"+print((\"H\" if a == b else \"D\"))"
] | false | 0.040995 | 0.038071 | 1.076803 | [
"s996053210",
"s411544776"
] |
u411353821 | p03011 | python | s426937542 | s306683051 | 82 | 27 | 61,616 | 9,156 | Accepted | Accepted | 67.07 | def main():
A = sorted(list(map(int, input().split())))
print((A[0] + A[1]))
if __name__ == '__main__':
main() | def main():
A = sorted(list(map(int, input().split())))
print((sum(A[:2])))
if __name__ == '__main__':
main()
| 7 | 7 | 128 | 128 | def main():
A = sorted(list(map(int, input().split())))
print((A[0] + A[1]))
if __name__ == "__main__":
main()
| def main():
A = sorted(list(map(int, input().split())))
print((sum(A[:2])))
if __name__ == "__main__":
main()
| false | 0 | [
"- print((A[0] + A[1]))",
"+ print((sum(A[:2])))"
] | false | 0.036595 | 0.0424 | 0.86309 | [
"s426937542",
"s306683051"
] |
u461118660 | p02983 | python | s919566616 | s144797929 | 1,048 | 941 | 220,964 | 148,516 | Accepted | Accepted | 10.21 | import itertools
l, r = list(map(int, input().split()))
if(r - l) > 2019:
ans = 0
else:
a = []
combs = list(itertools.combinations_with_replacement(list(range(l, r + 1)), 2))
for comb in combs:
if comb[0] != comb[1]:
a.append((comb[0]*comb[1]%2019))
ans = min(a)
... | import itertools
l, r = list(map(int, input().split()))
if(r - l) > 2019:
ans = 0
else:
ans = 2018
combs = list(itertools.combinations_with_replacement(list(range(l, r + 1)), 2))
for comb in combs:
if comb[0] != comb[1]:
a = (comb[0] * comb[1]) % 2019
if ans >... | 15 | 15 | 318 | 350 | import itertools
l, r = list(map(int, input().split()))
if (r - l) > 2019:
ans = 0
else:
a = []
combs = list(itertools.combinations_with_replacement(list(range(l, r + 1)), 2))
for comb in combs:
if comb[0] != comb[1]:
a.append((comb[0] * comb[1] % 2019))
ans = min(a)
print(ans)
| import itertools
l, r = list(map(int, input().split()))
if (r - l) > 2019:
ans = 0
else:
ans = 2018
combs = list(itertools.combinations_with_replacement(list(range(l, r + 1)), 2))
for comb in combs:
if comb[0] != comb[1]:
a = (comb[0] * comb[1]) % 2019
if ans > a:
... | false | 0 | [
"- a = []",
"+ ans = 2018",
"- a.append((comb[0] * comb[1] % 2019))",
"- ans = min(a)",
"+ a = (comb[0] * comb[1]) % 2019",
"+ if ans > a:",
"+ ans = a"
] | false | 0.046865 | 0.053842 | 0.870418 | [
"s919566616",
"s144797929"
] |
u608355135 | p03160 | python | s203914791 | s896394687 | 201 | 130 | 61,748 | 13,800 | Accepted | Accepted | 35.32 | import sys
sys.setrecursionlimit(20000000)
n=int(eval(input()))
h=list(map(int,input().split()))
memory={}
def cost(place):
if place in memory:
return memory[place]
if place==n-1:
return 0
if place==n-2:
return abs(h[n-2]-h[n-1])
if place<=n-3:
a=abs(h[place]... | n=int(eval(input()))
h=[int(i) for i in input().split()]
p0=0
p1=abs(h[1]-h[0])
for i in range(2,n):
p2=min(abs(h[i]-h[i-2])+p0,abs(h[i]-h[i-1])+p1)
p0,p1=p1,p2
print(p1) | 19 | 8 | 470 | 179 | import sys
sys.setrecursionlimit(20000000)
n = int(eval(input()))
h = list(map(int, input().split()))
memory = {}
def cost(place):
if place in memory:
return memory[place]
if place == n - 1:
return 0
if place == n - 2:
return abs(h[n - 2] - h[n - 1])
if place <= n - 3:
... | n = int(eval(input()))
h = [int(i) for i in input().split()]
p0 = 0
p1 = abs(h[1] - h[0])
for i in range(2, n):
p2 = min(abs(h[i] - h[i - 2]) + p0, abs(h[i] - h[i - 1]) + p1)
p0, p1 = p1, p2
print(p1)
| false | 57.894737 | [
"-import sys",
"-",
"-sys.setrecursionlimit(20000000)",
"-h = list(map(int, input().split()))",
"-memory = {}",
"-",
"-",
"-def cost(place):",
"- if place in memory:",
"- return memory[place]",
"- if place == n - 1:",
"- return 0",
"- if place == n - 2:",
"- r... | false | 0.082082 | 0.090484 | 0.907143 | [
"s203914791",
"s896394687"
] |
u094191970 | p02850 | python | s029355649 | s364822476 | 976 | 710 | 83,844 | 83,408 | Accepted | Accepted | 27.25 | from collections import deque
n=int(eval(input()))
l=[list(map(int,input().split())) for i in range(n-1)]
tree=[[]for _ in range(n)]
for a,b in l:
a-=1
b-=1
tree[a].append(b)
tree[b].append(b)
ans_num=0
for i in tree:
ans_num=max(ans_num,len(i))
dq=deque()
dq.append((0,0))
seen=set()
... | from collections import deque
from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
n=int(eval(input()))
l=[list(nii()) for i in range(n-1)]
tree=[[]for _ in range(n)]
for a,b in l:
a-=1
b-=1
tree[a].append(b)
tree[b].append(b)
ans_num=0
for i in tree:
ans_num=max(ans_num... | 43 | 45 | 640 | 686 | from collections import deque
n = int(eval(input()))
l = [list(map(int, input().split())) for i in range(n - 1)]
tree = [[] for _ in range(n)]
for a, b in l:
a -= 1
b -= 1
tree[a].append(b)
tree[b].append(b)
ans_num = 0
for i in tree:
ans_num = max(ans_num, len(i))
dq = deque()
dq.append((0, 0))
se... | from collections import deque
from sys import stdin
nii = lambda: list(map(int, stdin.readline().split()))
n = int(eval(input()))
l = [list(nii()) for i in range(n - 1)]
tree = [[] for _ in range(n)]
for a, b in l:
a -= 1
b -= 1
tree[a].append(b)
tree[b].append(b)
ans_num = 0
for i in tree:
ans_num... | false | 4.444444 | [
"+from sys import stdin",
"+nii = lambda: list(map(int, stdin.readline().split()))",
"-l = [list(map(int, input().split())) for i in range(n - 1)]",
"+l = [list(nii()) for i in range(n - 1)]",
"- x, color = dq.popleft()",
"+ x, color = dq.pop()"
] | false | 0.034879 | 0.035413 | 0.984929 | [
"s029355649",
"s364822476"
] |
u625046108 | p03800 | python | s283061264 | s078678695 | 1,778 | 130 | 168,500 | 82,928 | Accepted | Accepted | 92.69 | N = int(eval(input()))
S = eval(input())
dic = {('S','S','o'):'S', ('S','S','x'):'W', ('S','W','o'):'W', ('S','W','x'):'S', \
('W','S','o'):'W', ('W','S','x'):'S', ('W','W','o'):'S', ('W','W','x'):'W'}
cnd = ['SS', 'SW', 'WS', 'WW']
for h in cnd:
rlt = h
l = dic[(h[0],h[1],S[0])]
for i in ran... | N = int(eval(input()))
S = eval(input())
dic = {('S','S','o'):'S', ('S','S','x'):'W', ('S','W','o'):'W', ('S','W','x'):'S', \
('W','S','o'):'W', ('W','S','x'):'S', ('W','W','o'):'S', ('W','W','x'):'W'}
cnd = [['S','S'], ['S','W'], ['W','S'], ['W','W']]
for h in cnd:
rlt = h
l = dic[(h[0],h[1],S[... | 18 | 18 | 466 | 500 | N = int(eval(input()))
S = eval(input())
dic = {
("S", "S", "o"): "S",
("S", "S", "x"): "W",
("S", "W", "o"): "W",
("S", "W", "x"): "S",
("W", "S", "o"): "W",
("W", "S", "x"): "S",
("W", "W", "o"): "S",
("W", "W", "x"): "W",
}
cnd = ["SS", "SW", "WS", "WW"]
for h in cnd:
rlt = h
... | N = int(eval(input()))
S = eval(input())
dic = {
("S", "S", "o"): "S",
("S", "S", "x"): "W",
("S", "W", "o"): "W",
("S", "W", "x"): "S",
("W", "S", "o"): "W",
("W", "S", "x"): "S",
("W", "W", "o"): "S",
("W", "W", "x"): "W",
}
cnd = [["S", "S"], ["S", "W"], ["W", "S"], ["W", "W"]]
for h ... | false | 0 | [
"-cnd = [\"SS\", \"SW\", \"WS\", \"WW\"]",
"+cnd = [[\"S\", \"S\"], [\"S\", \"W\"], [\"W\", \"S\"], [\"W\", \"W\"]]",
"- rlt += dic[(rlt[i], rlt[i - 1], S[i])]",
"+ rlt.append(dic[(rlt[i], rlt[i - 1], S[i])])",
"- print(rlt)",
"+ print((\"\".join(rlt)))"
] | false | 0.109751 | 0.036436 | 3.012199 | [
"s283061264",
"s078678695"
] |
u993435350 | p03252 | python | s766045705 | s368573437 | 798 | 87 | 3,760 | 3,632 | Accepted | Accepted | 89.1 | S = eval(input())
T = eval(input())
ans = "Yes"
for i in range(0,len(S)):
for j in range(0,i):
if S[j] == S[i]:
if T[i] != T[j]:
ans = "No"
break
break
if T[j] == T[i]:
if S[j] != S[i]:
ans = "No"
break
break
print(ans) | S = eval(input())
T = eval(input())
convert = dict()
answer = 'Yes'
for s, t in zip(S, T):
#同じsに違うt
if s in convert and convert[s] != t:
answer = 'No'
break
#同じsに同じt
else:
convert[s] = t
after = list(convert.values())
#tの要素の総数とtの要素の種類を比べて、相違がある
#=sが全て相違する... | 18 | 23 | 293 | 406 | S = eval(input())
T = eval(input())
ans = "Yes"
for i in range(0, len(S)):
for j in range(0, i):
if S[j] == S[i]:
if T[i] != T[j]:
ans = "No"
break
break
if T[j] == T[i]:
if S[j] != S[i]:
ans = "No"
b... | S = eval(input())
T = eval(input())
convert = dict()
answer = "Yes"
for s, t in zip(S, T):
# 同じsに違うt
if s in convert and convert[s] != t:
answer = "No"
break
# 同じsに同じt
else:
convert[s] = t
after = list(convert.values())
# tの要素の総数とtの要素の種類を比べて、相違がある
# =sが全て相違するのに対しtの値が等しいペアがある=同じtに... | false | 21.73913 | [
"-ans = \"Yes\"",
"-for i in range(0, len(S)):",
"- for j in range(0, i):",
"- if S[j] == S[i]:",
"- if T[i] != T[j]:",
"- ans = \"No\"",
"- break",
"- break",
"- if T[j] == T[i]:",
"- if S[j] != S[i]:",
"- ... | false | 0.082429 | 0.0438 | 1.881936 | [
"s766045705",
"s368573437"
] |
u562935282 | p03027 | python | s605404503 | s236561641 | 1,383 | 1,197 | 45,500 | 44,052 | Accepted | Accepted | 13.45 | # https://atcoder.jp/contests/m-solutions2019/submissions/5741430
from operator import mul
import sys
input = sys.stdin.readline
MOD = 10 ** 6 + 3
def inv(n):
return pow(n, MOD - 2, MOD)
def mod_mul(x, y):
return mul(x, y) % MOD
fact = [1]
for n in range(1, MOD):
fact.append(mod_m... | # https://atcoder.jp/contests/m-solutions2019/submissions/5741430
from functools import reduce
from operator import mul
import sys
input = sys.stdin.readline
MOD = 10 ** 6 + 3
def inv(n):
return pow(n, MOD - 2, MOD)
def mod_mul(x, y):
return mul(x, y) % MOD
fact = [1]
for n in range(1... | 44 | 45 | 865 | 896 | # https://atcoder.jp/contests/m-solutions2019/submissions/5741430
from operator import mul
import sys
input = sys.stdin.readline
MOD = 10**6 + 3
def inv(n):
return pow(n, MOD - 2, MOD)
def mod_mul(x, y):
return mul(x, y) % MOD
fact = [1]
for n in range(1, MOD):
fact.append(mod_mul(fact[-1], n))
#... | # https://atcoder.jp/contests/m-solutions2019/submissions/5741430
from functools import reduce
from operator import mul
import sys
input = sys.stdin.readline
MOD = 10**6 + 3
def inv(n):
return pow(n, MOD - 2, MOD)
def mod_mul(x, y):
return mul(x, y) % MOD
fact = [1]
for n in range(1, MOD):
fact.appen... | false | 2.222222 | [
"+from functools import reduce",
"- fact.append(mod_mul(fact[-1], n))",
"+ fact.append((fact[-1] * n) % MOD)",
"- xd = mod_mul(x, inv(d))",
"+ xd = (x * inv(d)) % MOD",
"- print((mod_mul(mod_mul(fact[xd + n - 1], inv(fact[xd - 1])), dn)))",
"+ print((reduce(mod_mul, (fact[xd + n - 1], ... | false | 1.721803 | 1.483224 | 1.160851 | [
"s605404503",
"s236561641"
] |
u892487306 | p02727 | python | s537124786 | s948255935 | 318 | 226 | 23,216 | 23,328 | Accepted | Accepted | 28.93 | import heapq
def main():
X, Y, A, B, C = list(map(int, input().split(' ')))
P = list(map(int, input().split(' ')))
Q = list(map(int, input().split(' ')))
R = list(map(int, input().split(' ')))
P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)
que = []
for p... | def main():
X, Y, A, B, C = list(map(int, input().split(' ')))
P = list(map(int, input().split(' ')))
Q = list(map(int, input().split(' ')))
R = list(map(int, input().split(' ')))
P.sort(reverse=True)
Q.sort(reverse=True)
R = R + P[:X] + Q[:Y]
R.sort(reverse=True)
print((sum... | 28 | 14 | 674 | 376 | import heapq
def main():
X, Y, A, B, C = list(map(int, input().split(" ")))
P = list(map(int, input().split(" ")))
Q = list(map(int, input().split(" ")))
R = list(map(int, input().split(" ")))
P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)
que = []
for p in P[:X]:
... | def main():
X, Y, A, B, C = list(map(int, input().split(" ")))
P = list(map(int, input().split(" ")))
Q = list(map(int, input().split(" ")))
R = list(map(int, input().split(" ")))
P.sort(reverse=True)
Q.sort(reverse=True)
R = R + P[:X] + Q[:Y]
R.sort(reverse=True)
print((sum(R[: (X +... | false | 50 | [
"-import heapq",
"-",
"-",
"+ R = R + P[:X] + Q[:Y]",
"- que = []",
"- for p in P[:X]:",
"- heapq.heappush(que, p)",
"- for q in Q[:Y]:",
"- heapq.heappush(que, q)",
"- for r in R:",
"- min_que = heapq.heappop(que)",
"- if min_que >= r:",
"- ... | false | 0.036864 | 0.043319 | 0.851 | [
"s537124786",
"s948255935"
] |
u505830998 | p04044 | python | s719932910 | s688623985 | 173 | 18 | 38,256 | 3,064 | Accepted | Accepted | 89.6 | import sys
input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]
IN=lambda : list(map(int, input().split()))
mod=1000000007
#+++++
def main():
a, c = IN()
ss = [eval(input()) for _ in range(a)]
ss.sort()
ret = ''.join(ss)
print(ret)
#+++++
isTe... | import sys
input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]
IN=lambda : list(map(int, input().split()))
mod=1000000007
#+++++
def main():
#a = int(input())
n,l = IN()
ss=[]
for _ in range(n):
s = eval(input())
ss.append(s)
ss.sort()
return... | 50 | 54 | 863 | 898 | import sys
input_methods = ["clipboard", "file", "key"]
using_method = 0
input_method = input_methods[using_method]
IN = lambda: list(map(int, input().split()))
mod = 1000000007
# +++++
def main():
a, c = IN()
ss = [eval(input()) for _ in range(a)]
ss.sort()
ret = "".join(ss)
print(ret)
# +++++
i... | import sys
input_methods = ["clipboard", "file", "key"]
using_method = 0
input_method = input_methods[using_method]
IN = lambda: list(map(int, input().split()))
mod = 1000000007
# +++++
def main():
# a = int(input())
n, l = IN()
ss = []
for _ in range(n):
s = eval(input())
ss.append(s)
... | false | 7.407407 | [
"- a, c = IN()",
"- ss = [eval(input()) for _ in range(a)]",
"+ # a = int(input())",
"+ n, l = IN()",
"+ ss = []",
"+ for _ in range(n):",
"+ s = eval(input())",
"+ ss.append(s)",
"- ret = \"\".join(ss)",
"- print(ret)",
"+ return \"\".join(ss)"
] | false | 0.042704 | 0.037328 | 1.14404 | [
"s719932910",
"s688623985"
] |
u562016607 | p03356 | python | s078043302 | s183190406 | 1,288 | 598 | 58,592 | 15,412 | Accepted | Accepted | 53.57 | import queue
N,M=list(map(int,input().split()))
p=[int(i)-1 for i in input().split()]
x=[0 for i in range(M)]
y=[0 for i in range(M)]
edge=[set() for i in range(N)]
for i in range(M):
x[i],y[i]=list(map(int,input().split()))
x[i]-=1;y[i]-=1
edge[x[i]].add(y[i])
edge[y[i]].add(x[i])
k=0
L=[0 ... | N,M=list(map(int,input().split()))
par=[0 for i in range(N)]
rnk=[0 for i in range(N)]
def init(n):
for i in range(N):
par[i]=i
rnk[i]=0
def find(x):
if par[x]==x:
return x
else:
par[x]=find(par[x])
return par[x]
def unite(x,y):
x=find(x)
y=find... | 34 | 37 | 756 | 718 | import queue
N, M = list(map(int, input().split()))
p = [int(i) - 1 for i in input().split()]
x = [0 for i in range(M)]
y = [0 for i in range(M)]
edge = [set() for i in range(N)]
for i in range(M):
x[i], y[i] = list(map(int, input().split()))
x[i] -= 1
y[i] -= 1
edge[x[i]].add(y[i])
edge[y[i]].add(... | N, M = list(map(int, input().split()))
par = [0 for i in range(N)]
rnk = [0 for i in range(N)]
def init(n):
for i in range(N):
par[i] = i
rnk[i] = 0
def find(x):
if par[x] == x:
return x
else:
par[x] = find(par[x])
return par[x]
def unite(x, y):
x = find(x)
... | false | 8.108108 | [
"-import queue",
"+N, M = list(map(int, input().split()))",
"+par = [0 for i in range(N)]",
"+rnk = [0 for i in range(N)]",
"-N, M = list(map(int, input().split()))",
"+",
"+def init(n):",
"+ for i in range(N):",
"+ par[i] = i",
"+ rnk[i] = 0",
"+",
"+",
"+def find(x):",
"... | false | 0.034519 | 0.043445 | 0.794536 | [
"s078043302",
"s183190406"
] |
u279493135 | p02937 | python | s724708659 | s271965760 | 338 | 245 | 23,824 | 18,032 | Accepted | Accepted | 27.51 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, atan, degrees
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lower... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, atan, degrees
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lower... | 50 | 47 | 1,352 | 1,300 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, atan, degrees
from itertools import permutations, combinations, product, accumulate
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, atan, degrees
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ... | false | 6 | [
"- if len(dic[t[i]]) == 0:",
"- print((-1))",
"- exit()"
] | false | 0.035923 | 0.037229 | 0.964916 | [
"s724708659",
"s271965760"
] |
u234052535 | p00005 | python | s892984511 | s919354997 | 30 | 20 | 7,660 | 7,644 | Accepted | Accepted | 33.33 | # This program computes GCD and LCM
# -*- coding: utf-8
import sys
def gcd(a, b):
while b:
a, b = b, a % b
return a
def lcm(a, b):
for i in range(max([a, b]), a*b + 1):
if(i % a == 0 and i % b == 0):
return i
return a*b
for i in sys.stdin:
try:
... | # This program computes GCD and LCM
# -*- coding: utf-8
import sys
def gcd(a, b):
while b != 0:
a, b = b, a % b
return a
for i in sys.stdin:
try:
line = [int(k) for k in i.split(" ")]
g = gcd(min(line), max(line))
print((str(g) + " " + str(line[0]*line[1]//... | 24 | 18 | 517 | 351 | # This program computes GCD and LCM
# -*- coding: utf-8
import sys
def gcd(a, b):
while b:
a, b = b, a % b
return a
def lcm(a, b):
for i in range(max([a, b]), a * b + 1):
if i % a == 0 and i % b == 0:
return i
return a * b
for i in sys.stdin:
try:
line = [in... | # This program computes GCD and LCM
# -*- coding: utf-8
import sys
def gcd(a, b):
while b != 0:
a, b = b, a % b
return a
for i in sys.stdin:
try:
line = [int(k) for k in i.split(" ")]
g = gcd(min(line), max(line))
print((str(g) + " " + str(line[0] * line[1] // g)))
ex... | false | 25 | [
"- while b:",
"+ while b != 0:",
"-",
"-",
"-def lcm(a, b):",
"- for i in range(max([a, b]), a * b + 1):",
"- if i % a == 0 and i % b == 0:",
"- return i",
"- return a * b",
"- print(",
"- (str(g) + \" \" + str(line[0] * line[1] // g))",
"- ... | false | 0.04966 | 0.050172 | 0.989792 | [
"s892984511",
"s919354997"
] |
u864197622 | p03131 | python | s162031265 | s976669833 | 169 | 17 | 38,384 | 2,940 | Accepted | Accepted | 89.94 | K, A, B = list(map(int, input().split()))
k = K
ans = A
k -= A - 1
if k % 2 == 1:
k -= 1
ans += 1
if B-A >= 2:
ans += (k//2) * (B-A)
else:
ans += k
print(ans) | K,A,B=list(map(int,input().split()))
s=A
K-=A-1
if K>=2 and B-A>=2:
t=K//2
s+=t*(B-A)
K-=t*2
s+=K
print(s) | 16 | 11 | 195 | 120 | K, A, B = list(map(int, input().split()))
k = K
ans = A
k -= A - 1
if k % 2 == 1:
k -= 1
ans += 1
if B - A >= 2:
ans += (k // 2) * (B - A)
else:
ans += k
print(ans)
| K, A, B = list(map(int, input().split()))
s = A
K -= A - 1
if K >= 2 and B - A >= 2:
t = K // 2
s += t * (B - A)
K -= t * 2
s += K
print(s)
| false | 31.25 | [
"-k = K",
"-ans = A",
"-k -= A - 1",
"-if k % 2 == 1:",
"- k -= 1",
"- ans += 1",
"-if B - A >= 2:",
"- ans += (k // 2) * (B - A)",
"-else:",
"- ans += k",
"-print(ans)",
"+s = A",
"+K -= A - 1",
"+if K >= 2 and B - A >= 2:",
"+ t = K // 2",
"+ s += t * (B - A)",
"+... | false | 0.041022 | 0.036972 | 1.109548 | [
"s162031265",
"s976669833"
] |
u127499732 | p03160 | python | s230261861 | s791758969 | 133 | 113 | 13,924 | 14,132 | Accepted | Accepted | 15.04 | n=int(eval(input()))
h=[10**6]+list(map(int,input().split()))
c=[0]*(n+1)
for i in range(2,n+1):
a=c[i-1]+abs(h[i]-h[i-1])
b=c[i-2]+abs(h[i]-h[i-2])
c[i]=min(a,b)
print((c[n])) | # AtCoder Educational DP Contest
# A - Frog 1
def main():
n, *h = list(map(int, open(0).read().split()))
DP = [0 for _ in range(n)]
DP[1] = abs(h[1] - h[0])
for i in range(2, n):
c1, h1 = DP[i - 1], h[i - 1]
c2, h2 = DP[i - 2], h[i - 2]
h_now = h[i]
a = c1... | 8 | 23 | 181 | 474 | n = int(eval(input()))
h = [10**6] + list(map(int, input().split()))
c = [0] * (n + 1)
for i in range(2, n + 1):
a = c[i - 1] + abs(h[i] - h[i - 1])
b = c[i - 2] + abs(h[i] - h[i - 2])
c[i] = min(a, b)
print((c[n]))
| # AtCoder Educational DP Contest
# A - Frog 1
def main():
n, *h = list(map(int, open(0).read().split()))
DP = [0 for _ in range(n)]
DP[1] = abs(h[1] - h[0])
for i in range(2, n):
c1, h1 = DP[i - 1], h[i - 1]
c2, h2 = DP[i - 2], h[i - 2]
h_now = h[i]
a = c1 + abs(h1 - h_no... | false | 65.217391 | [
"-n = int(eval(input()))",
"-h = [10**6] + list(map(int, input().split()))",
"-c = [0] * (n + 1)",
"-for i in range(2, n + 1):",
"- a = c[i - 1] + abs(h[i] - h[i - 1])",
"- b = c[i - 2] + abs(h[i] - h[i - 2])",
"- c[i] = min(a, b)",
"-print((c[n]))",
"+# AtCoder Educational DP Contest",
"... | false | 0.039411 | 0.039289 | 1.003115 | [
"s230261861",
"s791758969"
] |
u095021077 | p02959 | python | s710061415 | s652231249 | 266 | 148 | 82,020 | 19,116 | Accepted | Accepted | 44.36 | N=int(eval(input()))
A=list(map(int, input().split()))
B=list(map(int, input().split()))
counter=0
for i in range(N):
if B[i]>=A[i]:
counter+=A[i]
B[i]-=A[i]
if B[i]>=A[i+1]:
counter+=A[i+1]
A[i+1]=0
else:
counter+=B[i]
A[i+1]-=B[i]
else:
co... | N=int(eval(input()))
A=list(map(int, input().split()))
B=list(map(int, input().split()))
counter=0
for i in range(N):
if A[i]>B[i]:
counter+=B[i]
else:
counter+=A[i]
B[i]-=A[i]
if A[i+1]>B[i]:
counter+=B[i]
A[i+1]-=B[i]
else:
counter+=A[i+1]
A[i+1]=0
... | 21 | 19 | 347 | 338 | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
counter = 0
for i in range(N):
if B[i] >= A[i]:
counter += A[i]
B[i] -= A[i]
if B[i] >= A[i + 1]:
counter += A[i + 1]
A[i + 1] = 0
else:
counter += B[i]
... | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
counter = 0
for i in range(N):
if A[i] > B[i]:
counter += B[i]
else:
counter += A[i]
B[i] -= A[i]
if A[i + 1] > B[i]:
counter += B[i]
A[i + 1] -= B[i]
el... | false | 9.52381 | [
"- if B[i] >= A[i]:",
"+ if A[i] > B[i]:",
"+ counter += B[i]",
"+ else:",
"- if B[i] >= A[i + 1]:",
"+ if A[i + 1] > B[i]:",
"+ counter += B[i]",
"+ A[i + 1] -= B[i]",
"+ else:",
"- else:",
"- counter += B[i]",
"- ... | false | 0.082094 | 0.079277 | 1.035526 | [
"s710061415",
"s652231249"
] |
u284854859 | p02577 | python | s250660234 | s899404193 | 330 | 181 | 79,952 | 68,628 | Accepted | Accepted | 45.15 | import sys
input = sys.stdin.readline
n = list(eval(input()))
m = len(n)
t = 0
for i in range(m-1):
t = (t+int(n[i]))%9
if t == 0:
print("Yes")
else:
print("No")
| if int(eval(input()))%9 == 0:
print("Yes")
else:
print("No")
| 13 | 4 | 182 | 66 | import sys
input = sys.stdin.readline
n = list(eval(input()))
m = len(n)
t = 0
for i in range(m - 1):
t = (t + int(n[i])) % 9
if t == 0:
print("Yes")
else:
print("No")
| if int(eval(input())) % 9 == 0:
print("Yes")
else:
print("No")
| false | 69.230769 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-n = list(eval(input()))",
"-m = len(n)",
"-t = 0",
"-for i in range(m - 1):",
"- t = (t + int(n[i])) % 9",
"-if t == 0:",
"+if int(eval(input())) % 9 == 0:"
] | false | 0.036719 | 0.036392 | 1.008971 | [
"s250660234",
"s899404193"
] |
u054556734 | p02708 | python | s357838788 | s740442432 | 317 | 61 | 79,760 | 63,868 | Accepted | Accepted | 80.76 | MOD = 10 ** 9 + 7
n,k = list(map(int,input().split()))
ans = 0
for i in range(k,n+2):
i %= MOD
add = -i**2 + i*(n+1) + 1
add %= MOD
ans += add
ans %= MOD
print(ans)
| MOD = 10 ** 9 + 7
n,k = list(map(int,input().split()))
ans = 0
for i in range(k,n+2):
add = -i**2 + i*(n+1) + 1
add %= MOD
ans += add
ans %= MOD
print(ans)
| 14 | 13 | 192 | 178 | MOD = 10**9 + 7
n, k = list(map(int, input().split()))
ans = 0
for i in range(k, n + 2):
i %= MOD
add = -(i**2) + i * (n + 1) + 1
add %= MOD
ans += add
ans %= MOD
print(ans)
| MOD = 10**9 + 7
n, k = list(map(int, input().split()))
ans = 0
for i in range(k, n + 2):
add = -(i**2) + i * (n + 1) + 1
add %= MOD
ans += add
ans %= MOD
print(ans)
| false | 7.142857 | [
"- i %= MOD"
] | false | 0.048293 | 0.046706 | 1.033981 | [
"s357838788",
"s740442432"
] |
u707124227 | p02756 | python | s132657075 | s520814754 | 752 | 298 | 96,344 | 12,012 | Accepted | Accepted | 60.37 | s=eval(input())
q_=int(eval(input()))
q=[eval(input()) for _ in range(q_)]
reverse=False
pre=[]
fin=[]
for qi in q:
if qi[0]=='1':
reverse=not reverse
elif qi[2]=='1' and reverse==False:
pre.append(qi[4])
elif qi[2]=='1' and reverse==True:
fin.append(qi[4])
elif qi[2... | s=list(eval(input()))
q=int(eval(input()))
rv=False
right=[]
left=[]
for _ in range(q):
query=eval(input())
if query[0]=='1':
rv=not rv
else:
_,f,c=query.split()
if f=='1' and rv==False:
left.append(c)
elif f=='1' and rv==True:
right.append(c)
elif f=='2' and rv==Fal... | 21 | 26 | 603 | 553 | s = eval(input())
q_ = int(eval(input()))
q = [eval(input()) for _ in range(q_)]
reverse = False
pre = []
fin = []
for qi in q:
if qi[0] == "1":
reverse = not reverse
elif qi[2] == "1" and reverse == False:
pre.append(qi[4])
elif qi[2] == "1" and reverse == True:
fin.append(qi[4])
... | s = list(eval(input()))
q = int(eval(input()))
rv = False
right = []
left = []
for _ in range(q):
query = eval(input())
if query[0] == "1":
rv = not rv
else:
_, f, c = query.split()
if f == "1" and rv == False:
left.append(c)
elif f == "1" and rv == True:
... | false | 19.230769 | [
"-s = eval(input())",
"-q_ = int(eval(input()))",
"-q = [eval(input()) for _ in range(q_)]",
"-reverse = False",
"-pre = []",
"-fin = []",
"-for qi in q:",
"- if qi[0] == \"1\":",
"- reverse = not reverse",
"- elif qi[2] == \"1\" and reverse == False:",
"- pre.append(qi[4])",... | false | 0.063404 | 0.12736 | 0.497837 | [
"s132657075",
"s520814754"
] |
u595289165 | p03038 | python | s863729496 | s999578150 | 548 | 355 | 24,008 | 99,156 | Accepted | Accepted | 35.22 | n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
cards = []
for _ in range(m):
b, c = list(map(int, input().split()))
cards.append([c, b])
cards.sort()
ans = 0
for i, num in enumerate(a):
if not cards:
break
c, b = cards.pop()
if c > num:
... | n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort(reverse=True)
x = []
for _ in range(m):
b, c = list(map(int, input().split()))
x.append([b, c])
x.sort(key=lambda p: p[1], reverse=True)
ret = 0
for b, c in x:
if not a:
break
if c > a[-1]:
... | 26 | 28 | 429 | 533 | n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
cards = []
for _ in range(m):
b, c = list(map(int, input().split()))
cards.append([c, b])
cards.sort()
ans = 0
for i, num in enumerate(a):
if not cards:
break
c, b = cards.pop()
if c > num:
a[i] = c
... | n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort(reverse=True)
x = []
for _ in range(m):
b, c = list(map(int, input().split()))
x.append([b, c])
x.sort(key=lambda p: p[1], reverse=True)
ret = 0
for b, c in x:
if not a:
break
if c > a[-1]:
while c > a[-1]:... | false | 7.142857 | [
"-a.sort()",
"-cards = []",
"+a.sort(reverse=True)",
"+x = []",
"- cards.append([c, b])",
"-cards.sort()",
"-ans = 0",
"-for i, num in enumerate(a):",
"- if not cards:",
"+ x.append([b, c])",
"+x.sort(key=lambda p: p[1], reverse=True)",
"+ret = 0",
"+for b, c in x:",
"+ if not ... | false | 0.037744 | 0.036744 | 1.027221 | [
"s863729496",
"s999578150"
] |
u156815136 | p02954 | python | s465055565 | s421285484 | 124 | 96 | 6,400 | 12,180 | Accepted | Accepted | 22.58 | S = eval(input())
n = len(S)
maze = [1] * n
# 前から見る
for i in range(0,n-1):
if S[i] == S[i+1] == 'R':
#print('before',maze)
maze[i+2] += maze[i]
maze[i] = 0
#print('after',maze)
# 後ろから見る
for i in range(n-1,0,-1):
if S[i] == S[i-1] == 'L':
maze[i-2] += maze[i]
... | #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdi... | 17 | 41 | 355 | 1,006 | S = eval(input())
n = len(S)
maze = [1] * n
# 前から見る
for i in range(0, n - 1):
if S[i] == S[i + 1] == "R":
# print('before',maze)
maze[i + 2] += maze[i]
maze[i] = 0
# print('after',maze)
# 後ろから見る
for i in range(n - 1, 0, -1):
if S[i] == S[i - 1] == "L":
maze[i - 2] += maze... | # from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations, permutations, accumulate, product # (string,3) 3回
# from collections import deque
from collections import deque, defaul... | false | 58.536585 | [
"-S = eval(input())",
"-n = len(S)",
"-maze = [1] * n",
"-# 前から見る",
"-for i in range(0, n - 1):",
"- if S[i] == S[i + 1] == \"R\":",
"- # print('before',maze)",
"- maze[i + 2] += maze[i]",
"- maze[i] = 0",
"- # print('after',maze)",
"-# 後ろから見る",
"-for i in range(... | false | 0.097216 | 0.09423 | 1.031697 | [
"s465055565",
"s421285484"
] |
u540912766 | p02712 | python | s199810415 | s106189950 | 204 | 172 | 9,168 | 9,160 | Accepted | Accepted | 15.69 | N = int(eval(input()))
sum = 0
for i in range(N):
if (i + 1) % 3 != 0 and (i + 1) % 5 != 0:
sum += (i + 1)
print(sum) | N = int(eval(input()))
def isnot_fizzbuzz(number: int) -> bool:
if (number) % 3 != 0 and (number) % 5 != 0:
return True
return False
def main():
sum = 0
for number in range(1, N + 1):
if isnot_fizzbuzz(number) == True:
sum += number
print(sum)
if __name__... | 8 | 16 | 132 | 341 | N = int(eval(input()))
sum = 0
for i in range(N):
if (i + 1) % 3 != 0 and (i + 1) % 5 != 0:
sum += i + 1
print(sum)
| N = int(eval(input()))
def isnot_fizzbuzz(number: int) -> bool:
if (number) % 3 != 0 and (number) % 5 != 0:
return True
return False
def main():
sum = 0
for number in range(1, N + 1):
if isnot_fizzbuzz(number) == True:
sum += number
print(sum)
if __name__ == "__main... | false | 50 | [
"-sum = 0",
"-for i in range(N):",
"- if (i + 1) % 3 != 0 and (i + 1) % 5 != 0:",
"- sum += i + 1",
"-print(sum)",
"+",
"+",
"+def isnot_fizzbuzz(number: int) -> bool:",
"+ if (number) % 3 != 0 and (number) % 5 != 0:",
"+ return True",
"+ return False",
"+",
"+",
"+d... | false | 0.14839 | 0.125711 | 1.180409 | [
"s199810415",
"s106189950"
] |
u785989355 | p03346 | python | s465688826 | s377474685 | 371 | 318 | 21,736 | 54,364 | Accepted | Accepted | 14.29 | N = int(input())
P = []
for i in range(N):
P.append(int(input()))
Q = list(range(N))
for i in range(N):
Q[P[i]-1] = i+1
count = 0
max = 0
for i in range(N-1):
if Q[i]<Q[i+1]:
count+=1
else:
count=0
if max < count:
max = count
print(N-max-1) | import sys
def input():
return sys.stdin.readline()[:-1]
N = int(eval(input()))
P = [int(eval(input())) for i in range(N)]
T = [0]*(N-1)
E = [0]*N
for i in range(N):
E[P[i]-1] = 1
if P[i]<N:
if E[P[i]]==1:
T[P[i]-1] = 1
max_score = 0
prev = -1
for i in range(N... | 22 | 29 | 279 | 449 | N = int(input())
P = []
for i in range(N):
P.append(int(input()))
Q = list(range(N))
for i in range(N):
Q[P[i] - 1] = i + 1
count = 0
max = 0
for i in range(N - 1):
if Q[i] < Q[i + 1]:
count += 1
else:
count = 0
if max < count:
max = count
print(N - max - 1)
| import sys
def input():
return sys.stdin.readline()[:-1]
N = int(eval(input()))
P = [int(eval(input())) for i in range(N)]
T = [0] * (N - 1)
E = [0] * N
for i in range(N):
E[P[i] - 1] = 1
if P[i] < N:
if E[P[i]] == 1:
T[P[i] - 1] = 1
max_score = 0
prev = -1
for i in range(N - 1):
... | false | 24.137931 | [
"-N = int(input())",
"-P = []",
"+import sys",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline()[:-1]",
"+",
"+",
"+N = int(eval(input()))",
"+P = [int(eval(input())) for i in range(N)]",
"+T = [0] * (N - 1)",
"+E = [0] * N",
"- P.append(int(input()))",
"-Q = list(range(N))... | false | 0.047569 | 0.048739 | 0.975984 | [
"s465688826",
"s377474685"
] |
u260980560 | p00053 | python | s866395789 | s974011818 | 400 | 50 | 59,680 | 9,992 | Accepted | Accepted | 87.5 | s = [0]
M = 10**6
p = [1]*M
S = 0
for i in range(2,M):
if p[i]:
for j in range(i*i,M,i):
p[j] = 0
S += i; s.append(S)
while 1:
n = eval(input())
if n==0: break
print(s[n]) | s = [0]
M = 104850
p = [1]*M
S = 0
for i in range(2,M):
if p[i]:
for j in range(i*i,M,i):
p[j] = 0
S += i; s.append(S)
while 1:
n = eval(input())
if n==0: break
print(s[n]) | 13 | 13 | 220 | 221 | s = [0]
M = 10**6
p = [1] * M
S = 0
for i in range(2, M):
if p[i]:
for j in range(i * i, M, i):
p[j] = 0
S += i
s.append(S)
while 1:
n = eval(input())
if n == 0:
break
print(s[n])
| s = [0]
M = 104850
p = [1] * M
S = 0
for i in range(2, M):
if p[i]:
for j in range(i * i, M, i):
p[j] = 0
S += i
s.append(S)
while 1:
n = eval(input())
if n == 0:
break
print(s[n])
| false | 0 | [
"-M = 10**6",
"+M = 104850"
] | false | 0.723187 | 0.074943 | 9.649843 | [
"s866395789",
"s974011818"
] |
u716530146 | p03033 | python | s508912036 | s110011043 | 1,773 | 1,618 | 120,636 | 120,636 | Accepted | Accepted | 8.74 | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect, heapq
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
n,q=map(int,input().split())
STX=[tuple(map(int,input().split())) for i in range(n)]
D=[i... | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect, heapq
input = lambda: sys.stdin.buffer.readline()
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
n,q=map(int,input().split())
STX=[tuple(map(int,input().split())) for i in range(n)]
D=[int(input()) for i in rang... | 34 | 34 | 839 | 814 | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect, heapq
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
inf = float("inf")
mod = 10**9 + 7
mans = inf
ans = 0
count = 0
pro = 1
n, q = map(int, input().split())
STX = [tuple(map(int, input().split())) for i in range(n)]
D = [in... | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect, heapq
input = lambda: sys.stdin.buffer.readline()
inf = float("inf")
mod = 10**9 + 7
mans = inf
ans = 0
count = 0
pro = 1
n, q = map(int, input().split())
STX = [tuple(map(int, input().split())) for i in range(n)]
D = [int(input()) for i in range... | false | 0 | [
"-input = lambda: sys.stdin.buffer.readline().rstrip().decode(\"utf-8\")",
"+input = lambda: sys.stdin.buffer.readline()"
] | false | 0.100527 | 0.072306 | 1.390308 | [
"s508912036",
"s110011043"
] |
u186838327 | p02850 | python | s768468563 | s229552043 | 826 | 399 | 89,332 | 76,704 | Accepted | Accepted | 51.69 | import sys
sys.setrecursionlimit(1000000)
n = int(eval(input()))
g = [[] for _ in range(n)]
for i in range(n-1):
a, b = list(map(int, input().split()))
a, b = a-1, b-1
g[a].append([b, i])
g[b].append([a, i])
ans = [0]*(n-1)
def dfs(v, c=-1, p=-1):
k = 1
for u, ei in g[v]:
if u ==... | import sys
input = sys.stdin.readline
n = int(eval(input()))
g = [[] for _ in range(n)]
e = []
for i in range(n-1):
a, b = list(map(int, input().split()))
a, b = a-1, b-1
g[a].append(b)
g[b].append(a)
e.append((a, b))
# topological順序の計算
s = []
s.append(0)
parent = [-1]*n
order = [... | 28 | 48 | 477 | 867 | import sys
sys.setrecursionlimit(1000000)
n = int(eval(input()))
g = [[] for _ in range(n)]
for i in range(n - 1):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
g[a].append([b, i])
g[b].append([a, i])
ans = [0] * (n - 1)
def dfs(v, c=-1, p=-1):
k = 1
for u, ei in g[v]:
if... | import sys
input = sys.stdin.readline
n = int(eval(input()))
g = [[] for _ in range(n)]
e = []
for i in range(n - 1):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
g[a].append(b)
g[b].append(a)
e.append((a, b))
# topological順序の計算
s = []
s.append(0)
parent = [-1] * n
order = []
while s:... | false | 41.666667 | [
"-sys.setrecursionlimit(1000000)",
"+input = sys.stdin.readline",
"+e = []",
"- g[a].append([b, i])",
"- g[b].append([a, i])",
"-ans = [0] * (n - 1)",
"-",
"-",
"-def dfs(v, c=-1, p=-1):",
"- k = 1",
"- for u, ei in g[v]:",
"- if u == p:",
"+ g[a].append(b)",
"+ g[... | false | 0.035465 | 0.042806 | 0.828501 | [
"s768468563",
"s229552043"
] |
u392319141 | p03112 | python | s575762891 | s843647483 | 1,175 | 963 | 16,708 | 17,968 | Accepted | Accepted | 18.04 | from bisect import bisect_right
A , B , Q = list(map(int,input().split()))
INF = 10**20
s = [0] * A
t = [0] * B
x = [0] * Q
for i in range(A) :
s[i] = int(eval(input()))
for i in range(B) :
t[i] = int(eval(input()))
for i in range(Q) :
x[i] = int(eval(input()))
s = [-INF] + s + [INF]
t ... | from bisect import bisect_left, bisect_right
A, B, Q = map(int, input().split())
S = [int(input()) for _ in range(A)] + [float('inf'), -float('inf')]
T = [int(input()) for _ in range(B)] + [float('inf'), -float('inf')]
S.sort()
T.sort()
ans = []
for _ in range(Q):
x = int(input())
midS = bisect... | 32 | 31 | 668 | 661 | from bisect import bisect_right
A, B, Q = list(map(int, input().split()))
INF = 10**20
s = [0] * A
t = [0] * B
x = [0] * Q
for i in range(A):
s[i] = int(eval(input()))
for i in range(B):
t[i] = int(eval(input()))
for i in range(Q):
x[i] = int(eval(input()))
s = [-INF] + s + [INF]
t = [-INF] + t + [INF]
for... | from bisect import bisect_left, bisect_right
A, B, Q = map(int, input().split())
S = [int(input()) for _ in range(A)] + [float("inf"), -float("inf")]
T = [int(input()) for _ in range(B)] + [float("inf"), -float("inf")]
S.sort()
T.sort()
ans = []
for _ in range(Q):
x = int(input())
midS = bisect_right(S, x)
... | false | 3.125 | [
"-from bisect import bisect_right",
"+from bisect import bisect_left, bisect_right",
"-A, B, Q = list(map(int, input().split()))",
"-INF = 10**20",
"-s = [0] * A",
"-t = [0] * B",
"-x = [0] * Q",
"-for i in range(A):",
"- s[i] = int(eval(input()))",
"-for i in range(B):",
"- t[i] = int(eva... | false | 0.049799 | 0.050246 | 0.991104 | [
"s575762891",
"s843647483"
] |
u499381410 | p02762 | python | s225383512 | s689871241 | 1,282 | 729 | 127,392 | 91,228 | Accepted | Accepted | 43.14 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, ... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, ... | 106 | 89 | 2,696 | 2,413 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
fro... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
fro... | false | 16.037736 | [
"-G = [set() for _ in range(n)]",
"-G2 = [set() for _ in range(n)]",
"-for _ in range(m):",
"- a, b = LI()",
"+AB = LIR(m)",
"+for a, b in AB:",
"- G2[a - 1].add(b - 1)",
"- G2[b - 1].add(a - 1)",
"+ans = [U.get_size(U.root(i)) - 1 for i in range(n)]",
"+for a, b in AB:",
"+ ans[a - ... | false | 0.087758 | 0.046647 | 1.88131 | [
"s225383512",
"s689871241"
] |
u736443076 | p02699 | python | s054536004 | s428528753 | 24 | 20 | 9,148 | 9,140 | Accepted | Accepted | 16.67 | import sys
sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline
def solve():
s, w = list(map(int, rl().split()))
if s > w:
print('safe')
else:
print('unsafe')
if __name__ == '__main__':
solve()
| def solve():
S, W = list(map(int,input().split()))
if S > W:
print("safe")
else:
print("unsafe")
if __name__ == '__main__':
solve()
| 16 | 10 | 244 | 173 | import sys
sys.setrecursionlimit(10**7)
rl = sys.stdin.readline
def solve():
s, w = list(map(int, rl().split()))
if s > w:
print("safe")
else:
print("unsafe")
if __name__ == "__main__":
solve()
| def solve():
S, W = list(map(int, input().split()))
if S > W:
print("safe")
else:
print("unsafe")
if __name__ == "__main__":
solve()
| false | 37.5 | [
"-import sys",
"-",
"-sys.setrecursionlimit(10**7)",
"-rl = sys.stdin.readline",
"-",
"-",
"- s, w = list(map(int, rl().split()))",
"- if s > w:",
"+ S, W = list(map(int, input().split()))",
"+ if S > W:"
] | false | 0.051051 | 0.050564 | 1.009629 | [
"s054536004",
"s428528753"
] |
u761989513 | p03109 | python | s560862982 | s461854069 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | s = eval(input())
s = list(map(int, s.split("/")))
if s[0] <= 2019 and s[1] <= 4 and s[2] <= 30:
print("Heisei")
else:
print("TBD") | s = list(map(int, input().split("/")))
if s[1] <= 4:
print("Heisei")
else:
print("TBD") | 6 | 5 | 138 | 99 | s = eval(input())
s = list(map(int, s.split("/")))
if s[0] <= 2019 and s[1] <= 4 and s[2] <= 30:
print("Heisei")
else:
print("TBD")
| s = list(map(int, input().split("/")))
if s[1] <= 4:
print("Heisei")
else:
print("TBD")
| false | 16.666667 | [
"-s = eval(input())",
"-s = list(map(int, s.split(\"/\")))",
"-if s[0] <= 2019 and s[1] <= 4 and s[2] <= 30:",
"+s = list(map(int, input().split(\"/\")))",
"+if s[1] <= 4:"
] | false | 0.05092 | 0.049013 | 1.03892 | [
"s560862982",
"s461854069"
] |
u699944218 | p02731 | python | s544309430 | s580492475 | 18 | 16 | 2,940 | 2,940 | Accepted | Accepted | 11.11 | L = int(eval(input()))
V = (L/3)**3
print(V) | print(((int(eval(input()))/3)**3)) | 3 | 1 | 40 | 26 | L = int(eval(input()))
V = (L / 3) ** 3
print(V)
| print(((int(eval(input())) / 3) ** 3))
| false | 66.666667 | [
"-L = int(eval(input()))",
"-V = (L / 3) ** 3",
"-print(V)",
"+print(((int(eval(input())) / 3) ** 3))"
] | false | 0.042468 | 0.043527 | 0.975674 | [
"s544309430",
"s580492475"
] |
u775681539 | p02678 | python | s297941913 | s754165406 | 362 | 282 | 96,892 | 92,060 | Accepted | Accepted | 22.1 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque
def main():
N, M = list(map(int, readline().split()))
to = [[] for _ in range(N)]
for _ in range(M):
a, b = list(map(int, readline().split())... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque
def main():
n, m = list(map(int, readline().split()))
to = [[] for _ in range(n)]
for _ in range(m):
a, b = list(map(int, readline().split()))... | 32 | 33 | 799 | 772 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque
def main():
N, M = list(map(int, readline().split()))
to = [[] for _ in range(N)]
for _ in range(M):
a, b = list(map(int, readline().split()))
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque
def main():
n, m = list(map(int, readline().split()))
to = [[] for _ in range(n)]
for _ in range(m):
a, b = list(map(int, readline().split()))
... | false | 3.030303 | [
"- N, M = list(map(int, readline().split()))",
"- to = [[] for _ in range(N)]",
"- for _ in range(M):",
"+ n, m = list(map(int, readline().split()))",
"+ to = [[] for _ in range(n)]",
"+ for _ in range(m):",
"- to[a - 1].append(b - 1)",
"- to[b - 1].append(a - 1)",
"+... | false | 0.048621 | 0.08312 | 0.584951 | [
"s297941913",
"s754165406"
] |
u964299793 | p04013 | python | s833469262 | s648317635 | 1,196 | 50 | 65,520 | 3,572 | Accepted | Accepted | 95.82 | import sys
input=sys.stdin.readline
n,a=list(map(int,input().split()))
x=[0]+list(map(int,input().split()))
su=sum(x)
maxi=max(x)
dp=[[[0 for k in range(maxi*n+1)] for j in range(51)] for i in range(51)]
dp[0][0][0]=1
for i in range(1,n+1):
for j in range(i+1):
for k in range(maxi*j+1):
... | from collections import Counter
n,a=list(map(int,input().split()))
X=sorted(list([int(x)-a for x in input().split()]))
ans=Counter([0])
for x in X:
tmp=Counter()
for i,j in list(ans.items()):
tmp[i+x]+=j
ans+=tmp
print((ans[0]-1))
| 22 | 11 | 583 | 251 | import sys
input = sys.stdin.readline
n, a = list(map(int, input().split()))
x = [0] + list(map(int, input().split()))
su = sum(x)
maxi = max(x)
dp = [[[0 for k in range(maxi * n + 1)] for j in range(51)] for i in range(51)]
dp[0][0][0] = 1
for i in range(1, n + 1):
for j in range(i + 1):
for k in range(ma... | from collections import Counter
n, a = list(map(int, input().split()))
X = sorted(list([int(x) - a for x in input().split()]))
ans = Counter([0])
for x in X:
tmp = Counter()
for i, j in list(ans.items()):
tmp[i + x] += j
ans += tmp
print((ans[0] - 1))
| false | 50 | [
"-import sys",
"+from collections import Counter",
"-input = sys.stdin.readline",
"-x = [0] + list(map(int, input().split()))",
"-su = sum(x)",
"-maxi = max(x)",
"-dp = [[[0 for k in range(maxi * n + 1)] for j in range(51)] for i in range(51)]",
"-dp[0][0][0] = 1",
"-for i in range(1, n + 1):",
"-... | false | 0.083894 | 0.041454 | 2.023803 | [
"s833469262",
"s648317635"
] |
u263830634 | p03436 | python | s652847425 | s057632693 | 57 | 26 | 3,952 | 3,316 | Accepted | Accepted | 54.39 | from queue import Queue
#入力
H, W = list(map(int, input().split()))
#lst = [['a']*W for _ in range(H)]
count = 0 #白色のマスの総数
lst = []
row = []
for i in range(H):
row = list(eval(input()))
count += row.count('.')
lst += [row]
#for i in range(H):
# for j in range(W):
# if lst[i][j] ... | from collections import deque
H, W = list(map(int, input().split()))
count = 0
g = []
g.append(['#'] * (W + 2))
for _ in range(H):
lst = ['#'] + list(eval(input())) + ['#']
count += lst.count('.')
g.append(lst)
g.append(['#'] * (W + 2))
check = [[-1] * (W + 2) for _ in range(H + 2)]
move ... | 58 | 49 | 1,225 | 944 | from queue import Queue
# 入力
H, W = list(map(int, input().split()))
# lst = [['a']*W for _ in range(H)]
count = 0 # 白色のマスの総数
lst = []
row = []
for i in range(H):
row = list(eval(input()))
count += row.count(".")
lst += [row]
# for i in range(H):
# for j in range(W):
# if lst[i][j] == '.':
# ... | from collections import deque
H, W = list(map(int, input().split()))
count = 0
g = []
g.append(["#"] * (W + 2))
for _ in range(H):
lst = ["#"] + list(eval(input())) + ["#"]
count += lst.count(".")
g.append(lst)
g.append(["#"] * (W + 2))
check = [[-1] * (W + 2) for _ in range(H + 2)]
move = [[1, 0], [-1, 0]... | false | 15.517241 | [
"-from queue import Queue",
"+from collections import deque",
"-# 入力",
"-# lst = [['a']*W for _ in range(H)]",
"-count = 0 # 白色のマスの総数",
"-lst = []",
"-row = []",
"-for i in range(H):",
"- row = list(eval(input()))",
"- count += row.count(\".\")",
"- lst += [row]",
"-# for i in range(... | false | 0.039307 | 0.042835 | 0.917632 | [
"s652847425",
"s057632693"
] |
u227379863 | p03048 | python | s897292554 | s873694298 | 1,598 | 370 | 2,940 | 40,556 | Accepted | Accepted | 76.85 | r,g,b,n=list(map(int,input().split()))
ans=0
for i in range((n//r)+1):
for j in range(((n-r*i)//g+1)):
if (n-i*r-j*g)%b==0:
ans+=1
print(ans)
| r,g,b,n=list(map(int,input().split()))
ans=0
for i in range(n//r+1):
for j in range(n//g+1):
if (n-(i*r+j*g))%b==0:
if 0<=n-i*r-j*g:
ans+=1
print(ans)
| 7 | 8 | 166 | 192 | r, g, b, n = list(map(int, input().split()))
ans = 0
for i in range((n // r) + 1):
for j in range(((n - r * i) // g + 1)):
if (n - i * r - j * g) % b == 0:
ans += 1
print(ans)
| r, g, b, n = list(map(int, input().split()))
ans = 0
for i in range(n // r + 1):
for j in range(n // g + 1):
if (n - (i * r + j * g)) % b == 0:
if 0 <= n - i * r - j * g:
ans += 1
print(ans)
| false | 12.5 | [
"-for i in range((n // r) + 1):",
"- for j in range(((n - r * i) // g + 1)):",
"- if (n - i * r - j * g) % b == 0:",
"- ans += 1",
"+for i in range(n // r + 1):",
"+ for j in range(n // g + 1):",
"+ if (n - (i * r + j * g)) % b == 0:",
"+ if 0 <= n - i * r - j... | false | 0.292968 | 0.140062 | 2.091706 | [
"s897292554",
"s873694298"
] |
u537976628 | p03807 | python | s916020065 | s667093670 | 58 | 52 | 20,044 | 20,132 | Accepted | Accepted | 10.34 | n = int(eval(input()))
A = list(map(int, input().split()))
EO = [i % 2 for i in A]
print(('YES' if EO.count(1) % 2 == 0 else 'NO')) | n = int(eval(input()))
A = list(map(int, input().split()))
print(('YES' if sum(A) % 2 == 0 else 'NO')) | 4 | 3 | 126 | 96 | n = int(eval(input()))
A = list(map(int, input().split()))
EO = [i % 2 for i in A]
print(("YES" if EO.count(1) % 2 == 0 else "NO"))
| n = int(eval(input()))
A = list(map(int, input().split()))
print(("YES" if sum(A) % 2 == 0 else "NO"))
| false | 25 | [
"-EO = [i % 2 for i in A]",
"-print((\"YES\" if EO.count(1) % 2 == 0 else \"NO\"))",
"+print((\"YES\" if sum(A) % 2 == 0 else \"NO\"))"
] | false | 0.037855 | 0.042021 | 0.900871 | [
"s916020065",
"s667093670"
] |
u067299340 | p00008 | python | s866357438 | s662200702 | 140 | 20 | 4,200 | 4,192 | Accepted | Accepted | 85.71 | import sys
def f(s,d,g,c):
if d>3:return c
for n in range(10):
if s+n==g:return c+1
elif s+n>g:return c
else:c=f(s+n,d+1,g,c)
return c
for l in sys.stdin:
print(f(0,0,int(l),0)) | import sys
r=list(range(10))
x=[0]*51
for a in r:
for b in r:
for c in r:
for d in r:
x[a+b+c+d]+=1
for l in sys.stdin:
print(x[int(l)]) | 10 | 10 | 196 | 149 | import sys
def f(s, d, g, c):
if d > 3:
return c
for n in range(10):
if s + n == g:
return c + 1
elif s + n > g:
return c
else:
c = f(s + n, d + 1, g, c)
return c
for l in sys.stdin:
print(f(0, 0, int(l), 0))
| import sys
r = list(range(10))
x = [0] * 51
for a in r:
for b in r:
for c in r:
for d in r:
x[a + b + c + d] += 1
for l in sys.stdin:
print(x[int(l)])
| false | 0 | [
"-",
"-def f(s, d, g, c):",
"- if d > 3:",
"- return c",
"- for n in range(10):",
"- if s + n == g:",
"- return c + 1",
"- elif s + n > g:",
"- return c",
"- else:",
"- c = f(s + n, d + 1, g, c)",
"- return c",
"-",
"-",... | false | 0.051628 | 0.040507 | 1.274535 | [
"s866357438",
"s662200702"
] |
u227082700 | p02856 | python | s590712317 | s123520682 | 930 | 594 | 71,768 | 3,060 | Accepted | Accepted | 36.13 | m=int(eval(input()))
d,c=[],[]
ans=-1
for i in range(m):
dd,cc=list(map(int,input().split()))
d.append(dd)
c.append(cc)
ans+=cc
a=0
for i in range(m):
a+=d[i]*c[i]
dd=(a-1)//9
ans+=dd
a-=dd*9
print(ans) | m=int(eval(input()))
d=c=-1
for _ in range(m):
dd,cc=list(map(int,input().split()))
d+=dd*cc
c+=cc
print((c+d//9)) | 15 | 7 | 220 | 112 | m = int(eval(input()))
d, c = [], []
ans = -1
for i in range(m):
dd, cc = list(map(int, input().split()))
d.append(dd)
c.append(cc)
ans += cc
a = 0
for i in range(m):
a += d[i] * c[i]
dd = (a - 1) // 9
ans += dd
a -= dd * 9
print(ans)
| m = int(eval(input()))
d = c = -1
for _ in range(m):
dd, cc = list(map(int, input().split()))
d += dd * cc
c += cc
print((c + d // 9))
| false | 53.333333 | [
"-d, c = [], []",
"-ans = -1",
"-for i in range(m):",
"+d = c = -1",
"+for _ in range(m):",
"- d.append(dd)",
"- c.append(cc)",
"- ans += cc",
"-a = 0",
"-for i in range(m):",
"- a += d[i] * c[i]",
"- dd = (a - 1) // 9",
"- ans += dd",
"- a -= dd * 9",
"-print(ans)",... | false | 0.042766 | 0.037365 | 1.144542 | [
"s590712317",
"s123520682"
] |
u460386402 | p02725 | python | s994975662 | s324006773 | 167 | 118 | 25,836 | 32,176 | Accepted | Accepted | 29.34 | k,n=list(map(int,input().split()))
a=list(map(int,input().split()))
s=0
b=[0]*(n-1)
for i in range(n-1):
b[i]=a[i+1]-a[i]
b.append(k+a[0]-a[n-1])
c=sorted(b,reverse=True)
for i in range(1,n):
s+=c[i]
print(s) | k,n=list(map(int,input().split()))
a=list(map(int,input().split()))
b=[]
for i in range(len(a)-1):
b.append(a[i+1]-a[i])
b.append(abs(a[-1]-a[0]-k))
b.sort()
b[-1]=0
print((sum(b))) | 13 | 11 | 222 | 189 | k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
s = 0
b = [0] * (n - 1)
for i in range(n - 1):
b[i] = a[i + 1] - a[i]
b.append(k + a[0] - a[n - 1])
c = sorted(b, reverse=True)
for i in range(1, n):
s += c[i]
print(s)
| k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
b = []
for i in range(len(a) - 1):
b.append(a[i + 1] - a[i])
b.append(abs(a[-1] - a[0] - k))
b.sort()
b[-1] = 0
print((sum(b)))
| false | 15.384615 | [
"-s = 0",
"-b = [0] * (n - 1)",
"-for i in range(n - 1):",
"- b[i] = a[i + 1] - a[i]",
"-b.append(k + a[0] - a[n - 1])",
"-c = sorted(b, reverse=True)",
"-for i in range(1, n):",
"- s += c[i]",
"-print(s)",
"+b = []",
"+for i in range(len(a) - 1):",
"+ b.append(a[i + 1] - a[i])",
"+... | false | 0.035492 | 0.034686 | 1.023249 | [
"s994975662",
"s324006773"
] |
u133936772 | p03262 | python | s122639603 | s391380769 | 97 | 84 | 14,100 | 20,008 | Accepted | Accepted | 13.4 | f=lambda:list(map(int,input().split()))
_,x=f()
m=[abs(i-x) for i in f()]
from fractions import *
a=m.pop()
for i in m: a=gcd(a,i)
print(a) | f=lambda:[*list(map(int,input().split()))]
n,x=f()
l=f()
d=[x-l[0]]
for i in range(n-1):
d+=[l[i+1]-l[i]]
a=d[0]
from math import *
for i in d:
a=gcd(a,i)
print(a) | 7 | 11 | 139 | 171 | f = lambda: list(map(int, input().split()))
_, x = f()
m = [abs(i - x) for i in f()]
from fractions import *
a = m.pop()
for i in m:
a = gcd(a, i)
print(a)
| f = lambda: [*list(map(int, input().split()))]
n, x = f()
l = f()
d = [x - l[0]]
for i in range(n - 1):
d += [l[i + 1] - l[i]]
a = d[0]
from math import *
for i in d:
a = gcd(a, i)
print(a)
| false | 36.363636 | [
"-f = lambda: list(map(int, input().split()))",
"-_, x = f()",
"-m = [abs(i - x) for i in f()]",
"-from fractions import *",
"+f = lambda: [*list(map(int, input().split()))]",
"+n, x = f()",
"+l = f()",
"+d = [x - l[0]]",
"+for i in range(n - 1):",
"+ d += [l[i + 1] - l[i]]",
"+a = d[0]",
"... | false | 0.148133 | 0.046949 | 3.155174 | [
"s122639603",
"s391380769"
] |
u273010357 | p03470 | python | s627573716 | s388026501 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | n = int(eval(input()))
d = list({int(eval(input())) for _ in range(n)})
d.sort()
print((len(d))) | nums = [int(eval(input())) for _ in range(int(eval(input())))]
num_dict = dict()
for i in nums:
num_dict[i] = True
#print(num_dict)
print((len(list(num_dict.keys())))) | 4 | 6 | 85 | 156 | n = int(eval(input()))
d = list({int(eval(input())) for _ in range(n)})
d.sort()
print((len(d)))
| nums = [int(eval(input())) for _ in range(int(eval(input())))]
num_dict = dict()
for i in nums:
num_dict[i] = True
# print(num_dict)
print((len(list(num_dict.keys()))))
| false | 33.333333 | [
"-n = int(eval(input()))",
"-d = list({int(eval(input())) for _ in range(n)})",
"-d.sort()",
"-print((len(d)))",
"+nums = [int(eval(input())) for _ in range(int(eval(input())))]",
"+num_dict = dict()",
"+for i in nums:",
"+ num_dict[i] = True",
"+# print(num_dict)",
"+print((len(list(num_dict.k... | false | 0.049261 | 0.049652 | 0.992113 | [
"s627573716",
"s388026501"
] |
u094191970 | p03698 | python | s540615571 | s959670093 | 21 | 17 | 3,060 | 2,940 | Accepted | Accepted | 19.05 | s=list(eval(input()))
ss=set(s)
print(('yes' if len(s)==len(ss) else 'no')) | s=eval(input())
st=set(s)
print(('yes' if len(st)==len(s) else 'no')) | 3 | 3 | 69 | 63 | s = list(eval(input()))
ss = set(s)
print(("yes" if len(s) == len(ss) else "no"))
| s = eval(input())
st = set(s)
print(("yes" if len(st) == len(s) else "no"))
| false | 0 | [
"-s = list(eval(input()))",
"-ss = set(s)",
"-print((\"yes\" if len(s) == len(ss) else \"no\"))",
"+s = eval(input())",
"+st = set(s)",
"+print((\"yes\" if len(st) == len(s) else \"no\"))"
] | false | 0.037068 | 0.03639 | 1.018623 | [
"s540615571",
"s959670093"
] |
u070201429 | p03608 | python | s270082259 | s030633020 | 231 | 137 | 74,644 | 74,552 | Accepted | Accepted | 40.69 | def main():
from sys import stdin
input = stdin.readline
n, m, r = list(map(int, input().split()))
l = list(map(int, input().split()))
for i in range(r):
l[i] -= 1
d = [[float('inf')] * n for _ in range(n)]
for _ in range(m):
i, j, k = list(map(int, input().split()... | def main():
from sys import stdin
input = stdin.readline
n, m, r = list(map(int, input().split()))
l = list(map(int, input().split()))
for i in range(r):
l[i] -= 1
d = [[10**8] * n for _ in range(n)]
for _ in range(m):
i, j, k = list(map(int, input().split()))
... | 36 | 36 | 881 | 868 | def main():
from sys import stdin
input = stdin.readline
n, m, r = list(map(int, input().split()))
l = list(map(int, input().split()))
for i in range(r):
l[i] -= 1
d = [[float("inf")] * n for _ in range(n)]
for _ in range(m):
i, j, k = list(map(int, input().split()))
... | def main():
from sys import stdin
input = stdin.readline
n, m, r = list(map(int, input().split()))
l = list(map(int, input().split()))
for i in range(r):
l[i] -= 1
d = [[10**8] * n for _ in range(n)]
for _ in range(m):
i, j, k = list(map(int, input().split()))
d[i - ... | false | 0 | [
"- d = [[float(\"inf\")] * n for _ in range(n)]",
"+ d = [[10**8] * n for _ in range(n)]",
"- answer = float(\"inf\")",
"+ answer = 10**8"
] | false | 0.043294 | 0.036885 | 1.173741 | [
"s270082259",
"s030633020"
] |
u254871849 | p03031 | python | s867120000 | s221563422 | 24 | 22 | 3,064 | 3,188 | Accepted | Accepted | 8.33 | # 2019-11-13 21:06:16(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# ... | import sys
n, m = list(map(int, sys.stdin.readline().split()))
s = [set(map(int, sys.stdin.readline().split()[1:])) for _ in range(m)]
*p, = list(map(int, sys.stdin.readline().split()))
def main():
combs = 0
for i in range(2 ** n):
t = set([j + 1 for j in range(n) if i >> j & 1])
for... | 43 | 21 | 1,240 | 516 | # 2019-11-13 21:06:16(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import n... | import sys
n, m = list(map(int, sys.stdin.readline().split()))
s = [set(map(int, sys.stdin.readline().split()[1:])) for _ in range(m)]
(*p,) = list(map(int, sys.stdin.readline().split()))
def main():
combs = 0
for i in range(2**n):
t = set([j + 1 for j in range(n) if i >> j & 1])
for k in ran... | false | 51.162791 | [
"-# 2019-11-13 21:06:16(JST)",
"-# import collections",
"-# import math",
"-# from string import ascii_lowercase, ascii_uppercase, digits",
"-# from bisect import bisect_left as bi_l, bisect_right as bi_r",
"-import itertools",
"+n, m = list(map(int, sys.stdin.readline().split()))",
"+s = [set(map(int... | false | 0.092915 | 0.04793 | 1.938552 | [
"s867120000",
"s221563422"
] |
u707124227 | p02714 | python | s460052919 | s519197096 | 1,372 | 293 | 9,192 | 78,208 | Accepted | Accepted | 78.64 | n=int(eval(input()))
s=eval(input())
nr=s.count('R')
ng=s.count('G')
nb=s.count('B')
ans=nr*ng*nb
for i in range(1,1+(n-1)//2):
for j in range(n-2*i):
if s[j]!=s[j+i] and s[j]!=s[2*i+j] and s[j+i]!=s[j+2*i]:
ans-=1
print(ans) | n=int(eval(input()))
s=eval(input())
r=s.count('R')
g=s.count('G')
b=s.count('B')
ans=r*b*g
for i in range(1,(n-1)//2+1):
for j in range(n):
if j+i+i>n-1:
break
if s[j]!=s[j+i] and s[j+i]!=s[j+i+i] and s[j]!=s[j+i+i]:
ans-=1
print(ans) | 11 | 13 | 259 | 279 | n = int(eval(input()))
s = eval(input())
nr = s.count("R")
ng = s.count("G")
nb = s.count("B")
ans = nr * ng * nb
for i in range(1, 1 + (n - 1) // 2):
for j in range(n - 2 * i):
if s[j] != s[j + i] and s[j] != s[2 * i + j] and s[j + i] != s[j + 2 * i]:
ans -= 1
print(ans)
| n = int(eval(input()))
s = eval(input())
r = s.count("R")
g = s.count("G")
b = s.count("B")
ans = r * b * g
for i in range(1, (n - 1) // 2 + 1):
for j in range(n):
if j + i + i > n - 1:
break
if s[j] != s[j + i] and s[j + i] != s[j + i + i] and s[j] != s[j + i + i]:
ans -= 1
... | false | 15.384615 | [
"-nr = s.count(\"R\")",
"-ng = s.count(\"G\")",
"-nb = s.count(\"B\")",
"-ans = nr * ng * nb",
"-for i in range(1, 1 + (n - 1) // 2):",
"- for j in range(n - 2 * i):",
"- if s[j] != s[j + i] and s[j] != s[2 * i + j] and s[j + i] != s[j + 2 * i]:",
"+r = s.count(\"R\")",
"+g = s.count(\"G\"... | false | 0.037843 | 0.037816 | 1.000715 | [
"s460052919",
"s519197096"
] |
u297574184 | p02728 | python | s309107461 | s223217242 | 2,741 | 2,083 | 134,812 | 85,988 | Accepted | Accepted | 24.01 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)
def solve():
MOD = 10**9 + 7
N = int(eval(input()))
adjL = [[] for _ in range(N)]
for _ in range(N-1):
a, b = list(map(int, input().split()))
a, b = a-1, b-1
adjL[a].append(b)
adjL[b].append... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)
def solve():
MOD = 10**9 + 7
N = int(eval(input()))
adjL = [[] for _ in range(N)]
for _ in range(N-1):
a, b = list(map(int, input().split()))
a, b = a-1, b-1
adjL[a].append(b)
adjL[b].append... | 77 | 63 | 1,986 | 1,674 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)
def solve():
MOD = 10**9 + 7
N = int(eval(input()))
adjL = [[] for _ in range(N)]
for _ in range(N - 1):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
adjL[a].append(b)
adjL[b].append(a)
... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)
def solve():
MOD = 10**9 + 7
N = int(eval(input()))
adjL = [[] for _ in range(N)]
for _ in range(N - 1):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
adjL[a].append(b)
adjL[b].append(a)
... | false | 18.181818 | [
"- def getInvs(n, MOD):",
"- invs = [1] * (n + 1)",
"+ def getFacts(n, MOD):",
"+ facts = [1] * (n + 1)",
"- invs[x] = (-(MOD // x) * invs[MOD % x]) % MOD",
"- return invs",
"+ facts[x] = (facts[x - 1] * x) % MOD",
"+ return facts",
"- invs ... | false | 0.041981 | 0.041561 | 1.010104 | [
"s309107461",
"s223217242"
] |
u022871813 | p03073 | python | s818716556 | s962774166 | 79 | 64 | 3,188 | 3,188 | Accepted | Accepted | 18.99 | S = eval(input())
out1, out2 = 0, 0
for i, j in enumerate(S):
xor = int(j) ^ (i % 2)
out1 += xor
out2 += (1 - xor)
print((min(out1, out2))) | S = eval(input())
out1 = out2 = 0
for i, j in enumerate(S):
xor = (j == '1') ^ (i % 2)
out1 += xor
out2 += (1 - xor)
print((out1 if out1 < out2 else out2)) | 9 | 9 | 149 | 163 | S = eval(input())
out1, out2 = 0, 0
for i, j in enumerate(S):
xor = int(j) ^ (i % 2)
out1 += xor
out2 += 1 - xor
print((min(out1, out2)))
| S = eval(input())
out1 = out2 = 0
for i, j in enumerate(S):
xor = (j == "1") ^ (i % 2)
out1 += xor
out2 += 1 - xor
print((out1 if out1 < out2 else out2))
| false | 0 | [
"-out1, out2 = 0, 0",
"+out1 = out2 = 0",
"- xor = int(j) ^ (i % 2)",
"+ xor = (j == \"1\") ^ (i % 2)",
"-print((min(out1, out2)))",
"+print((out1 if out1 < out2 else out2))"
] | false | 0.045885 | 0.007854 | 5.842006 | [
"s818716556",
"s962774166"
] |
u380524497 | p02889 | python | s930673858 | s094438524 | 1,731 | 931 | 28,612 | 20,720 | Accepted | Accepted | 46.22 | from scipy.sparse.csgraph import csgraph_from_dense
from scipy.sparse.csgraph import floyd_warshall
n, m, energy = list(map(int, input().split()))
edges = [[float('INF')]*n for _ in range(n)]
for i in range(m):
a, b, c = list(map(int, input().split()))
edges[a-1][b-1] = c
edges[b-1][a-1] = c
G... | import sys
from scipy.sparse.csgraph import csgraph_from_dense
from scipy.sparse.csgraph import floyd_warshall
input = sys.stdin.readline
n, m, energy = list(map(int, input().split()))
edges = [[float('INF')]*n for _ in range(n)]
for i in range(m):
a, b, c = list(map(int, input().split()))
edges[a... | 31 | 37 | 850 | 1,017 | from scipy.sparse.csgraph import csgraph_from_dense
from scipy.sparse.csgraph import floyd_warshall
n, m, energy = list(map(int, input().split()))
edges = [[float("INF")] * n for _ in range(n)]
for i in range(m):
a, b, c = list(map(int, input().split()))
edges[a - 1][b - 1] = c
edges[b - 1][a - 1] = c
G = ... | import sys
from scipy.sparse.csgraph import csgraph_from_dense
from scipy.sparse.csgraph import floyd_warshall
input = sys.stdin.readline
n, m, energy = list(map(int, input().split()))
edges = [[float("INF")] * n for _ in range(n)]
for i in range(m):
a, b, c = list(map(int, input().split()))
edges[a - 1][b - 1... | false | 16.216216 | [
"+import sys",
"+input = sys.stdin.readline",
"-dist = floyd_warshall(G)",
"-L_edges = [[float(\"INF\")] * n for _ in range(n)]",
"+dist = floyd_warshall(G) # dist[i][j] = min_distance between i and j",
"+L_edges = [[0] * n for _ in range(n)]",
"-G = csgraph_from_dense(L_edges, null_value=float(\"INF\"... | false | 0.232688 | 0.23118 | 1.00652 | [
"s930673858",
"s094438524"
] |
u592248346 | p03325 | python | s877249666 | s027622919 | 103 | 84 | 4,148 | 10,064 | Accepted | Accepted | 18.45 | n = int(eval(input()))
a = list(map(int,input().split()))
g = 0
for i in a:
while i%2==0:
g+=1
i/=2
print(g) | n = int(eval(input()))
a = list(map(int,input().split()))
ans = 0
for i in range(n):
while a[i]%2==0:
a[i] = a[i]//2
ans+=1
print(ans) | 8 | 8 | 129 | 155 | n = int(eval(input()))
a = list(map(int, input().split()))
g = 0
for i in a:
while i % 2 == 0:
g += 1
i /= 2
print(g)
| n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in range(n):
while a[i] % 2 == 0:
a[i] = a[i] // 2
ans += 1
print(ans)
| false | 0 | [
"-g = 0",
"-for i in a:",
"- while i % 2 == 0:",
"- g += 1",
"- i /= 2",
"-print(g)",
"+ans = 0",
"+for i in range(n):",
"+ while a[i] % 2 == 0:",
"+ a[i] = a[i] // 2",
"+ ans += 1",
"+print(ans)"
] | false | 0.008073 | 0.038878 | 0.207647 | [
"s877249666",
"s027622919"
] |
u029021990 | p02781 | python | s086362203 | s837462269 | 931 | 195 | 3,188 | 41,072 | Accepted | Accepted | 79.05 | N = int(eval(input()))
K = int(eval(input()))
res = 0
if K == 1:
for i in range(1,10):
for j in range(len(str(N))):
if i*10**j <= N:
res += 1
if K == 2:
for i1 in range(1,10):
for i2 in range(1,10):
for j1 in range(len(str(N))-1):
... | N = int(eval(input()))
K = int(eval(input()))
Nstr = str(N)
Nlen = len(Nstr)
'''------dp設定-------
dp[i][j][k]
dp[][][]
i:桁数
j:非0の数を使った回数
k: 0:それまでの桁数は、Nと同じ
1:それまでの桁数で、Nより小さいが確定
配るdpで更新
'''
#初期化
dp = [[[0 for i3 in range(2)] for i2 in range(K+1)] for i1 in range(Nlen+1)]
dp[0][0][0] = 1
#今の桁... | 35 | 41 | 1,060 | 891 | N = int(eval(input()))
K = int(eval(input()))
res = 0
if K == 1:
for i in range(1, 10):
for j in range(len(str(N))):
if i * 10**j <= N:
res += 1
if K == 2:
for i1 in range(1, 10):
for i2 in range(1, 10):
for j1 in range(len(str(N)) - 1):
fo... | N = int(eval(input()))
K = int(eval(input()))
Nstr = str(N)
Nlen = len(Nstr)
"""------dp設定-------
dp[i][j][k]
dp[][][]
i:桁数
j:非0の数を使った回数
k: 0:それまでの桁数は、Nと同じ
1:それまでの桁数で、Nより小さいが確定
配るdpで更新
"""
# 初期化
dp = [[[0 for i3 in range(2)] for i2 in range(K + 1)] for i1 in range(Nlen + 1)]
dp[0][0][0] = 1
# 今の桁から次の桁に配るループ
for i ... | false | 14.634146 | [
"-res = 0",
"-if K == 1:",
"- for i in range(1, 10):",
"- for j in range(len(str(N))):",
"- if i * 10**j <= N:",
"- res += 1",
"-if K == 2:",
"- for i1 in range(1, 10):",
"- for i2 in range(1, 10):",
"- for j1 in range(len(str(N)) - 1):",
... | false | 0.117984 | 0.090128 | 1.309076 | [
"s086362203",
"s837462269"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.