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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u597374218 | p03457 | python | s908733300 | s126833504 | 395 | 336 | 27,380 | 3,060 | Accepted | Accepted | 14.94 | N=int(eval(input()))
txy=[list(map(int,input().split())) for i in range(N)]
ans=0
for i in range(N):
t,x,y=txy[i][0],txy[i][1],txy[i][2]
if x+y<=t and t%2==(x+y)%2:ans+=1
print(("Yes" if ans==N else "No")) | N=int(eval(input()))
count=0
for i in range(N):
t,x,y=list(map(int,input().split()))
if x+y<=t and t%2==(x+y)%2:count+=1
print(("Yes" if count==N else "No")) | 7 | 6 | 211 | 156 | N = int(eval(input()))
txy = [list(map(int, input().split())) for i in range(N)]
ans = 0
for i in range(N):
t, x, y = txy[i][0], txy[i][1], txy[i][2]
if x + y <= t and t % 2 == (x + y) % 2:
ans += 1
print(("Yes" if ans == N else "No"))
| N = int(eval(input()))
count = 0
for i in range(N):
t, x, y = list(map(int, input().split()))
if x + y <= t and t % 2 == (x + y) % 2:
count += 1
print(("Yes" if count == N else "No"))
| false | 14.285714 | [
"-txy = [list(map(int, input().split())) for i in range(N)]",
"-ans = 0",
"+count = 0",
"- t, x, y = txy[i][0], txy[i][1], txy[i][2]",
"+ t, x, y = list(map(int, input().split()))",
"- ans += 1",
"-print((\"Yes\" if ans == N else \"No\"))",
"+ count += 1",
"+print((\"Yes\" if cou... | false | 0.066396 | 0.067813 | 0.979098 | [
"s908733300",
"s126833504"
] |
u905203728 | p03786 | python | s031750834 | s496017514 | 227 | 115 | 14,956 | 14,432 | Accepted | Accepted | 49.34 | import copy
n=int(eval(input()))
A=sorted(list(map(int,input().split())))
B=copy.deepcopy(A)
for i in range(1,n):
B[i]=B[i]+B[i-1]
cnt=1
for i in reversed(list(range(n-1))):
if B[i]*2>=A[i+1]:
cnt +=1
else:break
print(cnt) | n=int(eval(input()))
A=sorted(list(map(int,input().split())))
sum_A=sum(A)
cnt=1
for i in reversed(list(range(n))):
sum_A -=A[i]
if sum_A*2>=A[i]:
cnt +=1
else:break
print(cnt) | 13 | 10 | 243 | 193 | import copy
n = int(eval(input()))
A = sorted(list(map(int, input().split())))
B = copy.deepcopy(A)
for i in range(1, n):
B[i] = B[i] + B[i - 1]
cnt = 1
for i in reversed(list(range(n - 1))):
if B[i] * 2 >= A[i + 1]:
cnt += 1
else:
break
print(cnt)
| n = int(eval(input()))
A = sorted(list(map(int, input().split())))
sum_A = sum(A)
cnt = 1
for i in reversed(list(range(n))):
sum_A -= A[i]
if sum_A * 2 >= A[i]:
cnt += 1
else:
break
print(cnt)
| false | 23.076923 | [
"-import copy",
"-",
"-B = copy.deepcopy(A)",
"-for i in range(1, n):",
"- B[i] = B[i] + B[i - 1]",
"+sum_A = sum(A)",
"-for i in reversed(list(range(n - 1))):",
"- if B[i] * 2 >= A[i + 1]:",
"+for i in reversed(list(range(n))):",
"+ sum_A -= A[i]",
"+ if sum_A * 2 >= A[i]:"
] | false | 0.04369 | 0.034514 | 1.26589 | [
"s031750834",
"s496017514"
] |
u945181840 | p02802 | python | s708302105 | s684814523 | 133 | 123 | 4,596 | 4,596 | Accepted | Accepted | 7.52 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
N, M = list(map(int, readline().split()))
WA = [0] * (N + 1)
AC = [False] * (N + 1)
for _ in range(M):
p, S = readline().split()
p = int(p)
if AC[p]:
continue
if S == 'AC':
AC[p] = True
else:
... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
N, M = list(map(int, readline().split()))
WA = [0] * (N + 1)
wa = 0
AC = [False] * (N + 1)
for _ in range(M):
p, S = readline().split()
p = int(p)
if AC[p]:
continue
if S == 'AC':
AC[p] = True
wa... | 25 | 23 | 420 | 377 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
N, M = list(map(int, readline().split()))
WA = [0] * (N + 1)
AC = [False] * (N + 1)
for _ in range(M):
p, S = readline().split()
p = int(p)
if AC[p]:
continue
if S == "AC":
AC[p] = True
else:
WA[p] += 1
for i in ... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
N, M = list(map(int, readline().split()))
WA = [0] * (N + 1)
wa = 0
AC = [False] * (N + 1)
for _ in range(M):
p, S = readline().split()
p = int(p)
if AC[p]:
continue
if S == "AC":
AC[p] = True
wa += WA[p]
else:
... | false | 8 | [
"+wa = 0",
"+ wa += WA[p]",
"-for i in range(1, N + 1):",
"- if not AC[i]:",
"- WA[i] = 0",
"-print((sum(AC), sum(WA)))",
"+print((sum(AC), wa))"
] | false | 0.076828 | 0.044804 | 1.714756 | [
"s708302105",
"s684814523"
] |
u232852711 | p03312 | python | s827304890 | s473959021 | 969 | 720 | 25,676 | 24,684 | Accepted | Accepted | 25.7 | n = int(eval(input()))
a = list(map(int, input().split()))
cumsum = [a[0]]
for i in range(1, n):
cumsum.append(cumsum[i-1] + a[i])
i, k = 0, 2
ans = 10**18
for j in range(1, n-2):
while i < j:
p = cumsum[i]
q = cumsum[j] - cumsum[i]
p_new = cumsum[i+1]
q_new = cum... | n = int(eval(input()))
a = list(map(int, input().split()))
i, k = 0, 2
p, q, r, s = 0, a[0], a[1], sum(a[2:])
ans = sum(a)
for j in range(1, n-2):
q += a[j]
while abs((q-a[i]) - (p+a[i])) < abs(q - p):
p += a[i]
q -= a[i]
i += 1
r -= a[j]
while abs((s-a[k]) - (r... | 35 | 24 | 837 | 516 | n = int(eval(input()))
a = list(map(int, input().split()))
cumsum = [a[0]]
for i in range(1, n):
cumsum.append(cumsum[i - 1] + a[i])
i, k = 0, 2
ans = 10**18
for j in range(1, n - 2):
while i < j:
p = cumsum[i]
q = cumsum[j] - cumsum[i]
p_new = cumsum[i + 1]
q_new = cumsum[j] - c... | n = int(eval(input()))
a = list(map(int, input().split()))
i, k = 0, 2
p, q, r, s = 0, a[0], a[1], sum(a[2:])
ans = sum(a)
for j in range(1, n - 2):
q += a[j]
while abs((q - a[i]) - (p + a[i])) < abs(q - p):
p += a[i]
q -= a[i]
i += 1
r -= a[j]
while abs((s - a[k]) - (r + a[k])) ... | false | 31.428571 | [
"-cumsum = [a[0]]",
"-for i in range(1, n):",
"- cumsum.append(cumsum[i - 1] + a[i])",
"-ans = 10**18",
"+p, q, r, s = 0, a[0], a[1], sum(a[2:])",
"+ans = sum(a)",
"- while i < j:",
"- p = cumsum[i]",
"- q = cumsum[j] - cumsum[i]",
"- p_new = cumsum[i + 1]",
"- ... | false | 0.065776 | 0.037422 | 1.75766 | [
"s827304890",
"s473959021"
] |
u588341295 | p03550 | python | s404901944 | s048181368 | 1,022 | 832 | 50,140 | 46,852 | Accepted | Accepted | 18.59 | # -*- coding: utf-8 -*-
"""
参考:https://kimiyuki.net/writeup/algo/atcoder/arc-085-d/
・ミニマックス法
・メモ化再帰
・先手と後手にそれぞれのメモを作る
"""
import sys
from collections import defaultdict
# 再帰呼び出しの回数制限(デフォルト1000)
sys.setrecursionlimit(10 ** 9)
N, Z, W = list(map(int, input().split()))
aN = list(map(int, input().split... | # -*- coding: utf-8 -*-
"""
参考:https://kimiyuki.net/writeup/algo/atcoder/arc-085-d/
https://atcoder.jp/contests/abc078/submissions/3854338
・ミニマックス法
・メモ化再帰
・メモの持ち方をシンプルにした版
"""
import sys
from collections import defaultdict
# 再帰呼び出しの回数制限(デフォルト1000)
sys.setrecursionlimit(10 ** 9)
N, Z, W = list(ma... | 52 | 51 | 1,250 | 1,204 | # -*- coding: utf-8 -*-
"""
参考:https://kimiyuki.net/writeup/algo/atcoder/arc-085-d/
・ミニマックス法
・メモ化再帰
・先手と後手にそれぞれのメモを作る
"""
import sys
from collections import defaultdict
# 再帰呼び出しの回数制限(デフォルト1000)
sys.setrecursionlimit(10**9)
N, Z, W = list(map(int, input().split()))
aN = list(map(int, input().split()))
# 先手番用メモ[残り山札数][相... | # -*- coding: utf-8 -*-
"""
参考:https://kimiyuki.net/writeup/algo/atcoder/arc-085-d/
https://atcoder.jp/contests/abc078/submissions/3854338
・ミニマックス法
・メモ化再帰
・メモの持ち方をシンプルにした版
"""
import sys
from collections import defaultdict
# 再帰呼び出しの回数制限(デフォルト1000)
sys.setrecursionlimit(10**9)
N, Z, W = list(map(int, input().split()... | false | 1.923077 | [
"+ https://atcoder.jp/contests/abc078/submissions/3854338",
"-・先手と後手にそれぞれのメモを作る",
"+・メモの持ち方をシンプルにした版",
"-# 先手番用メモ[残り山札数][相手のスコア] = このルートでのmax",
"-# 後手番用メモ[残り山札数][相手のスコア] = このルートでのmin",
"-memo1 = [defaultdict(int) for _ in range(N + 1)]",
"-memo2 = [defaultdict(int) for _ in range(N + 1)]",
"+# メモ[手番... | false | 0.046477 | 0.129895 | 0.357806 | [
"s404901944",
"s048181368"
] |
u150984829 | p00447 | python | s311786368 | s675475771 | 940 | 90 | 5,896 | 6,052 | Accepted | Accepted | 90.43 | for e in iter(input,'0'):
a=list(tuple(map(int,input().split())) for _ in range(int(e)))
s,t=a[0]
b=[tuple(map(int,input().split())) for _ in range(int(eval(input())))]
for x,y in b:
flag = True
for u,v in a[1:]:
if(x+u-s,y+v-t)not in b:
flag = False
break
if flag == True:
print((x - ... | for e in iter(input,'0'):
a=list(tuple(map(int,input().split())) for _ in range(int(e)))
s,t=a[0]
b={tuple(map(int,input().split())) for _ in range(int(eval(input())))}
for x,y in b:
f=1
for u,v in a[1:]:
if(x+u-s,y+v-t)not in b:f=0;break
if f:print((x-s,y-t));break
| 13 | 9 | 333 | 280 | for e in iter(input, "0"):
a = list(tuple(map(int, input().split())) for _ in range(int(e)))
s, t = a[0]
b = [tuple(map(int, input().split())) for _ in range(int(eval(input())))]
for x, y in b:
flag = True
for u, v in a[1:]:
if (x + u - s, y + v - t) not in b:
... | for e in iter(input, "0"):
a = list(tuple(map(int, input().split())) for _ in range(int(e)))
s, t = a[0]
b = {tuple(map(int, input().split())) for _ in range(int(eval(input())))}
for x, y in b:
f = 1
for u, v in a[1:]:
if (x + u - s, y + v - t) not in b:
f = 0... | false | 30.769231 | [
"- b = [tuple(map(int, input().split())) for _ in range(int(eval(input())))]",
"+ b = {tuple(map(int, input().split())) for _ in range(int(eval(input())))}",
"- flag = True",
"+ f = 1",
"- flag = False",
"+ f = 0",
"- if flag == True:",
"+ ... | false | 0.04736 | 0.043494 | 1.088896 | [
"s311786368",
"s675475771"
] |
u547608423 | p03944 | python | s299687444 | s574482216 | 20 | 18 | 3,064 | 3,064 | Accepted | Accepted | 10 | W,H,N=list(map(int,input().split()))
xya=[list(map(int,input().split())) for _ in range(N)]
x_l=0
x_h=W
y_l=0
y_h=H
for i in xya:
if i[2]==1 and x_l<i[0]:
x_l=i[0]
elif i[2]==2 and x_h>i[0]:
x_h=i[0]
elif i[2]==3 and y_l<i[1]:
y_l=i[1]
elif i[2]==4 and y_h>i[1]:
... | W,H,N=list(map(int,input().split()))
x_l=0
x_r=W
y_h=H
y_l=0
for i in range(N):
x,y,a=list(map(int,input().split()))
if a==1:
x_l=max(x_l,x)
elif a==2:
x_r=min(x_r,x)
elif a==3:
y_l=max(y_l,y)
else:
y_h=min(y_h,y)
#print(x_l,x_r,y_h,y_l)
print((m... | 19 | 20 | 371 | 336 | W, H, N = list(map(int, input().split()))
xya = [list(map(int, input().split())) for _ in range(N)]
x_l = 0
x_h = W
y_l = 0
y_h = H
for i in xya:
if i[2] == 1 and x_l < i[0]:
x_l = i[0]
elif i[2] == 2 and x_h > i[0]:
x_h = i[0]
elif i[2] == 3 and y_l < i[1]:
y_l = i[1]
elif i[2] ... | W, H, N = list(map(int, input().split()))
x_l = 0
x_r = W
y_h = H
y_l = 0
for i in range(N):
x, y, a = list(map(int, input().split()))
if a == 1:
x_l = max(x_l, x)
elif a == 2:
x_r = min(x_r, x)
elif a == 3:
y_l = max(y_l, y)
else:
y_h = min(y_h, y)
# print(x_l,x_r,y_... | false | 5 | [
"-xya = [list(map(int, input().split())) for _ in range(N)]",
"-x_h = W",
"+x_r = W",
"+y_h = H",
"-y_h = H",
"-for i in xya:",
"- if i[2] == 1 and x_l < i[0]:",
"- x_l = i[0]",
"- elif i[2] == 2 and x_h > i[0]:",
"- x_h = i[0]",
"- elif i[2] == 3 and y_l < i[1]:",
"- ... | false | 0.033491 | 0.033508 | 0.999494 | [
"s299687444",
"s574482216"
] |
u094999522 | p02688 | python | s139499145 | s867744484 | 24 | 22 | 9,208 | 9,184 | Accepted | Accepted | 8.33 | (n,k),*p = [[*list(map(int, i.split()))] for i in open(0)]
a = sum([p[2*i+1] for i in range(k)],[])
print((n - len(set(a)))) | n,k = list(map(int, input().split()))
a = set()
for i in [0]*k:
_ = eval(input())
a = a | set([*list(map(int, input().split()))])
print((n - len(a))) | 3 | 6 | 118 | 142 | (n, k), *p = [[*list(map(int, i.split()))] for i in open(0)]
a = sum([p[2 * i + 1] for i in range(k)], [])
print((n - len(set(a))))
| n, k = list(map(int, input().split()))
a = set()
for i in [0] * k:
_ = eval(input())
a = a | set([*list(map(int, input().split()))])
print((n - len(a)))
| false | 50 | [
"-(n, k), *p = [[*list(map(int, i.split()))] for i in open(0)]",
"-a = sum([p[2 * i + 1] for i in range(k)], [])",
"-print((n - len(set(a))))",
"+n, k = list(map(int, input().split()))",
"+a = set()",
"+for i in [0] * k:",
"+ _ = eval(input())",
"+ a = a | set([*list(map(int, input().split()))])... | false | 0.050651 | 0.047193 | 1.073273 | [
"s139499145",
"s867744484"
] |
u710921979 | p03495 | python | s135219787 | s393128412 | 120 | 102 | 35,892 | 35,996 | Accepted | Accepted | 15 | import collections
from collections import OrderedDict
count=0
N,K=list(map(int,input().split()))
ball=list(map(str,input().split()))
c=sorted(collections.Counter(ball).values())
n=len(c)-K
if n==0:
print(count)
else:
for i in range(n):
count+=c[i]
print(count) | import collections
N,K=list(map(int,input().split()))
c=sorted(collections.Counter(list(map(str,input().split()))).values())
print((sum(c[:-K]))) | 13 | 4 | 287 | 140 | import collections
from collections import OrderedDict
count = 0
N, K = list(map(int, input().split()))
ball = list(map(str, input().split()))
c = sorted(collections.Counter(ball).values())
n = len(c) - K
if n == 0:
print(count)
else:
for i in range(n):
count += c[i]
print(count)
| import collections
N, K = list(map(int, input().split()))
c = sorted(collections.Counter(list(map(str, input().split()))).values())
print((sum(c[:-K])))
| false | 69.230769 | [
"-from collections import OrderedDict",
"-count = 0",
"-ball = list(map(str, input().split()))",
"-c = sorted(collections.Counter(ball).values())",
"-n = len(c) - K",
"-if n == 0:",
"- print(count)",
"-else:",
"- for i in range(n):",
"- count += c[i]",
"- print(count)",
"+c = s... | false | 0.091859 | 0.04722 | 1.945364 | [
"s135219787",
"s393128412"
] |
u546285759 | p00638 | python | s581246171 | s930198359 | 60 | 40 | 7,680 | 7,836 | Accepted | Accepted | 33.33 | while True:
n = int(eval(input()))
if n == 0:
break
z = sorted([tuple(map(int, input().split())) for _ in range(n)], key=lambda x: x[1])
cnt = total = 0
for a, b in z:
total += a
if total > b:
break
cnt += 1
print(("Yes" if cnt == n else "N... | while True:
n = int(eval(input()))
if n == 0:
break
z = sorted([tuple(map(int, input().split())) for _ in range(n)], key=lambda x: x[1])
cnt = total = 0
for a, b in z:
total += a
if total > b:
cnt = 1
break
print(("No" if cnt else "Yes"... | 12 | 12 | 316 | 314 | while True:
n = int(eval(input()))
if n == 0:
break
z = sorted([tuple(map(int, input().split())) for _ in range(n)], key=lambda x: x[1])
cnt = total = 0
for a, b in z:
total += a
if total > b:
break
cnt += 1
print(("Yes" if cnt == n else "No"))
| while True:
n = int(eval(input()))
if n == 0:
break
z = sorted([tuple(map(int, input().split())) for _ in range(n)], key=lambda x: x[1])
cnt = total = 0
for a, b in z:
total += a
if total > b:
cnt = 1
break
print(("No" if cnt else "Yes"))
| false | 0 | [
"+ cnt = 1",
"- cnt += 1",
"- print((\"Yes\" if cnt == n else \"No\"))",
"+ print((\"No\" if cnt else \"Yes\"))"
] | false | 0.07352 | 0.036027 | 2.040668 | [
"s581246171",
"s930198359"
] |
u309141201 | p03160 | python | s049233007 | s321454441 | 157 | 132 | 13,904 | 13,980 | Accepted | Accepted | 15.92 | N = int(eval(input()))
h = list(map(int, input().split()))
# print(N, h)
# dpの最小値を変更する関数
def chmin(a, b):
if a > b:
return b
else:
return a
# 無限大の値
f_inf = float('inf')
# DP テーブルを初期化 (最小化問題なので INF に初期化)
dp = [f_inf] * (10 ** 5 + 10)
# 初期条件
dp[0] = 0
# 足場 i-1 から足場 i へ移動する... | N = int(eval(input()))
h = list(map(int, input().split()))
dp = [float('inf')]*N
dp[0] = 0
for i in range(1, N):
if i == 1:
dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
else:
dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]))
print((dp[N-1]))
| 29 | 11 | 584 | 295 | N = int(eval(input()))
h = list(map(int, input().split()))
# print(N, h)
# dpの最小値を変更する関数
def chmin(a, b):
if a > b:
return b
else:
return a
# 無限大の値
f_inf = float("inf")
# DP テーブルを初期化 (最小化問題なので INF に初期化)
dp = [f_inf] * (10**5 + 10)
# 初期条件
dp[0] = 0
# 足場 i-1 から足場 i へ移動する。コストは|h[i]−h[i-1]|
# 足場 i... | N = int(eval(input()))
h = list(map(int, input().split()))
dp = [float("inf")] * N
dp[0] = 0
for i in range(1, N):
if i == 1:
dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))
else:
dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[N - 1]))
| false | 62.068966 | [
"-# print(N, h)",
"-# dpの最小値を変更する関数",
"-def chmin(a, b):",
"- if a > b:",
"- return b",
"+dp = [float(\"inf\")] * N",
"+dp[0] = 0",
"+for i in range(1, N):",
"+ if i == 1:",
"+ dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))",
"- return a",
"-",
"-",
"-# 無限大... | false | 0.043701 | 0.036094 | 1.210737 | [
"s049233007",
"s321454441"
] |
u631914718 | p03283 | python | s722326073 | s794812125 | 1,675 | 499 | 11,508 | 32,888 | Accepted | Accepted | 70.21 | from itertools import accumulate as acc
def LI(): return list(map(int, input().split()))
def LI_(): return list([int(x) - 1 for x in input().split()])
if __name__ == "__main__":
N, M, Q = LI()
LR = [[0]*N for _ in range(N)]
for i in range(M):
l, r = LI_()
LR[l][r] += 1
#... | from itertools import accumulate as acc
import sys
if __name__ == "__main__":
s = sys.stdin.readlines()
N, M, Q = list(map(int, s[0].split()))
LR = [[0]*N for _ in range(N)]
for l, r in (list(map(int, e.split())) for e in s[1:M + 1]):
LR[l - 1][r - 1] += 1
S = [tuple(acc(reversed... | 19 | 13 | 498 | 436 | from itertools import accumulate as acc
def LI():
return list(map(int, input().split()))
def LI_():
return list([int(x) - 1 for x in input().split()])
if __name__ == "__main__":
N, M, Q = LI()
LR = [[0] * N for _ in range(N)]
for i in range(M):
l, r = LI_()
LR[l][r] += 1
# ... | from itertools import accumulate as acc
import sys
if __name__ == "__main__":
s = sys.stdin.readlines()
N, M, Q = list(map(int, s[0].split()))
LR = [[0] * N for _ in range(N)]
for l, r in (list(map(int, e.split())) for e in s[1 : M + 1]):
LR[l - 1][r - 1] += 1
S = [tuple(acc(reversed(s))) f... | false | 31.578947 | [
"-",
"-",
"-def LI():",
"- return list(map(int, input().split()))",
"-",
"-",
"-def LI_():",
"- return list([int(x) - 1 for x in input().split()])",
"-",
"+import sys",
"- N, M, Q = LI()",
"+ s = sys.stdin.readlines()",
"+ N, M, Q = list(map(int, s[0].split()))",
"- for i... | false | 0.035597 | 0.057558 | 0.618454 | [
"s722326073",
"s794812125"
] |
u983918956 | p02937 | python | s082312298 | s377603238 | 173 | 139 | 7,668 | 7,616 | Accepted | Accepted | 19.65 | from bisect import bisect
s = eval(input())
t = eval(input())
d = dict()
for i in range(26):
d[chr(i+97)] = []
for i, si in enumerate(s):
d[si].append(i)
ans = 0
res = -1
for i in range(len(t)):
if d[t[i]] == []:
print((-1))
exit()
index = bisect(d[t[i]], res)
... | from bisect import bisect
s = eval(input())
t = eval(input())
if len(set(t) & set(s)) != len(set(t)):
print((-1))
exit()
d = dict()
for i, si in enumerate(s):
if si in d:
d[si].append(i)
else:
d[si] = [i]
ans = 0
res = d[t[0]][0]
for i in range(1, len(t)):
... | 29 | 31 | 495 | 487 | from bisect import bisect
s = eval(input())
t = eval(input())
d = dict()
for i in range(26):
d[chr(i + 97)] = []
for i, si in enumerate(s):
d[si].append(i)
ans = 0
res = -1
for i in range(len(t)):
if d[t[i]] == []:
print((-1))
exit()
index = bisect(d[t[i]], res)
if index == len(d[t[... | from bisect import bisect
s = eval(input())
t = eval(input())
if len(set(t) & set(s)) != len(set(t)):
print((-1))
exit()
d = dict()
for i, si in enumerate(s):
if si in d:
d[si].append(i)
else:
d[si] = [i]
ans = 0
res = d[t[0]][0]
for i in range(1, len(t)):
index = bisect(d[t[i]], re... | false | 6.451613 | [
"+if len(set(t) & set(s)) != len(set(t)):",
"+ print((-1))",
"+ exit()",
"-for i in range(26):",
"- d[chr(i + 97)] = []",
"- d[si].append(i)",
"+ if si in d:",
"+ d[si].append(i)",
"+ else:",
"+ d[si] = [i]",
"-res = -1",
"-for i in range(len(t)):",
"- if d... | false | 0.089106 | 0.041345 | 2.15521 | [
"s082312298",
"s377603238"
] |
u126232616 | p03564 | python | s294922552 | s855437778 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | n = int(eval(input()))
k = int(eval(input()))
ans = 10**10
for i in range(2**n):
m = 1
for j in range(n):
if (i>>j)&1 == 1:
m *= 2
else:
m += k
ans = min(m,ans)
print(ans) | n = int(eval(input()))
k = int(eval(input()))
ans = 1
for i in range(n):
ans = min(2*ans,ans+k)
print(ans) | 12 | 6 | 222 | 103 | n = int(eval(input()))
k = int(eval(input()))
ans = 10**10
for i in range(2**n):
m = 1
for j in range(n):
if (i >> j) & 1 == 1:
m *= 2
else:
m += k
ans = min(m, ans)
print(ans)
| n = int(eval(input()))
k = int(eval(input()))
ans = 1
for i in range(n):
ans = min(2 * ans, ans + k)
print(ans)
| false | 50 | [
"-ans = 10**10",
"-for i in range(2**n):",
"- m = 1",
"- for j in range(n):",
"- if (i >> j) & 1 == 1:",
"- m *= 2",
"- else:",
"- m += k",
"- ans = min(m, ans)",
"+ans = 1",
"+for i in range(n):",
"+ ans = min(2 * ans, ans + k)"
] | false | 0.085741 | 0.075542 | 1.135016 | [
"s294922552",
"s855437778"
] |
u078349616 | p03546 | python | s973492008 | s634989810 | 535 | 208 | 25,808 | 14,084 | Accepted | Accepted | 61.12 | from scipy.sparse.csgraph import floyd_warshall
from itertools import permutations
H, W = list(map(int, input().split()))
C = [[0]*10 for _ in range(10)]
A = [[0]*W for _ in range(H)]
for i in range(10):
C[i] = list(map(int, input().split()))
C = floyd_warshall(C)
cost = 0
for i in range(H):
A[i... | # ABC79 D - Wall
from scipy.sparse.csgraph import floyd_warshall
from itertools import permutations
H, W = list(map(int, input().split()))
C = [list(map(int, input().split())) for _ in range(10)]
A = [list(map(int, input().split())) for _ in range(H)]
C = floyd_warshall(C)
cost = 0
for i in range(H):
... | 20 | 17 | 427 | 401 | from scipy.sparse.csgraph import floyd_warshall
from itertools import permutations
H, W = list(map(int, input().split()))
C = [[0] * 10 for _ in range(10)]
A = [[0] * W for _ in range(H)]
for i in range(10):
C[i] = list(map(int, input().split()))
C = floyd_warshall(C)
cost = 0
for i in range(H):
A[i] = list(ma... | # ABC79 D - Wall
from scipy.sparse.csgraph import floyd_warshall
from itertools import permutations
H, W = list(map(int, input().split()))
C = [list(map(int, input().split())) for _ in range(10)]
A = [list(map(int, input().split())) for _ in range(H)]
C = floyd_warshall(C)
cost = 0
for i in range(H):
for a in A[i]... | false | 15 | [
"+# ABC79 D - Wall",
"-C = [[0] * 10 for _ in range(10)]",
"-A = [[0] * W for _ in range(H)]",
"-for i in range(10):",
"- C[i] = list(map(int, input().split()))",
"+C = [list(map(int, input().split())) for _ in range(10)]",
"+A = [list(map(int, input().split())) for _ in range(H)]",
"- A[i] = li... | false | 0.417645 | 0.274032 | 1.524072 | [
"s973492008",
"s634989810"
] |
u989345508 | p03816 | python | s958962434 | s189785327 | 120 | 104 | 17,304 | 17,704 | Accepted | Accepted | 13.33 | n=int(eval(input()))
a=sorted([int(i) for i in input().split()])
def groupby(a):
a2=[[a[0],1]]
for i in range(1,len(a)):
if a2[-1][0]==a[i]:
a2[-1][1]+=1
else:
a2.append([a[i],1])
return a2
a=groupby(a)
#print(a)
l=len(a)
for i in range(l):
if a[i]... | n=int(eval(input()))
def groupby(a):
a2=[[a[0],1]]
for i in range(1,len(a)):
if a2[-1][0]==a[i]:
a2[-1][1]+=1
else:
a2.append([a[i],1])
return a2
b=groupby(sorted([int(i) for i in input().split()]))
l=len(b)
co=0
for i in range(l):
co+=(b[i][1]-1)
... | 27 | 19 | 481 | 363 | n = int(eval(input()))
a = sorted([int(i) for i in input().split()])
def groupby(a):
a2 = [[a[0], 1]]
for i in range(1, len(a)):
if a2[-1][0] == a[i]:
a2[-1][1] += 1
else:
a2.append([a[i], 1])
return a2
a = groupby(a)
# print(a)
l = len(a)
for i in range(l):
i... | n = int(eval(input()))
def groupby(a):
a2 = [[a[0], 1]]
for i in range(1, len(a)):
if a2[-1][0] == a[i]:
a2[-1][1] += 1
else:
a2.append([a[i], 1])
return a2
b = groupby(sorted([int(i) for i in input().split()]))
l = len(b)
co = 0
for i in range(l):
co += b[i][... | false | 29.62963 | [
"-a = sorted([int(i) for i in input().split()])",
"-a = groupby(a)",
"-# print(a)",
"-l = len(a)",
"+b = groupby(sorted([int(i) for i in input().split()]))",
"+l = len(b)",
"+co = 0",
"- if a[i][1] % 2 == 0:",
"- a[i][1] = 2",
"- else:",
"- a[i][1] = 1",
"-c = 0",
"-for i... | false | 0.034843 | 0.058723 | 0.593345 | [
"s958962434",
"s189785327"
] |
u312025627 | p02863 | python | s722704326 | s830489041 | 902 | 356 | 179,332 | 146,044 | Accepted | Accepted | 60.53 | def main():
N, T = (int(i) for i in input().split())
AB = [[int(i) for i in input().split()] for j in range(N)]
A = [a[0] for a in AB]
B = [b[1] for b in AB]
dp1 = [[0]*(T+1) for i in range(N+2)]
for i in range(1, N+1):
for j in range(T):
dp1[i][j] = max(dp1[i][j], dp... | def main():
N, T = (int(i) for i in input().split())
AB = [[int(i) for i in input().split()] for j in range(N)]
AB.sort()
A = [a[0] for a in AB]
B = [b[1] for b in AB]
dp1 = [[0]*(T+1) for _ in range(N+1)]
for i in range(N):
for j in range(T):
dp1[i+1][j] = max... | 30 | 23 | 970 | 604 | def main():
N, T = (int(i) for i in input().split())
AB = [[int(i) for i in input().split()] for j in range(N)]
A = [a[0] for a in AB]
B = [b[1] for b in AB]
dp1 = [[0] * (T + 1) for i in range(N + 2)]
for i in range(1, N + 1):
for j in range(T):
dp1[i][j] = max(dp1[i][j], dp... | def main():
N, T = (int(i) for i in input().split())
AB = [[int(i) for i in input().split()] for j in range(N)]
AB.sort()
A = [a[0] for a in AB]
B = [b[1] for b in AB]
dp1 = [[0] * (T + 1) for _ in range(N + 1)]
for i in range(N):
for j in range(T):
dp1[i + 1][j] = max(dp... | false | 23.333333 | [
"+ AB.sort()",
"- dp1 = [[0] * (T + 1) for i in range(N + 2)]",
"- for i in range(1, N + 1):",
"+ dp1 = [[0] * (T + 1) for _ in range(N + 1)]",
"+ for i in range(N):",
"- dp1[i][j] = max(dp1[i][j], dp1[i - 1][j])",
"- if j + A[i - 1] < T:",
"- dp1[i]... | false | 0.034397 | 0.060137 | 0.571972 | [
"s722704326",
"s830489041"
] |
u013408661 | p03309 | python | s983473585 | s341179958 | 701 | 219 | 49,772 | 26,836 | Accepted | Accepted | 68.76 | n=int(eval(input()))
a=list(map(int,input().split()))
b=[0]
c=[0]
d=[0]
e=[0]
count=0
count2=0
count3=0
count4=0
for i in range(n):
a[i]-=i
a.sort()
for i in range(n-1):
count+=a[i+1]-a[i]
count3+=a[n-i-1]-a[n-i-2]
b.append(count)
d.append(count3)
for i in range(n-1):
count2+=b[i+1]
co... | n=int(eval(input()))
a=list(map(int,input().split()))
for i in range(n):
a[i]-=i
a.sort()
x=a[n//2]
ans=0
for i in range(n):
ans+=abs(a[i]-x)
print(ans) | 27 | 10 | 476 | 159 | n = int(eval(input()))
a = list(map(int, input().split()))
b = [0]
c = [0]
d = [0]
e = [0]
count = 0
count2 = 0
count3 = 0
count4 = 0
for i in range(n):
a[i] -= i
a.sort()
for i in range(n - 1):
count += a[i + 1] - a[i]
count3 += a[n - i - 1] - a[n - i - 2]
b.append(count)
d.append(count3)
for i in ... | n = int(eval(input()))
a = list(map(int, input().split()))
for i in range(n):
a[i] -= i
a.sort()
x = a[n // 2]
ans = 0
for i in range(n):
ans += abs(a[i] - x)
print(ans)
| false | 62.962963 | [
"-b = [0]",
"-c = [0]",
"-d = [0]",
"-e = [0]",
"-count = 0",
"-count2 = 0",
"-count3 = 0",
"-count4 = 0",
"-for i in range(n - 1):",
"- count += a[i + 1] - a[i]",
"- count3 += a[n - i - 1] - a[n - i - 2]",
"- b.append(count)",
"- d.append(count3)",
"-for i in range(n - 1):",
... | false | 0.082079 | 0.035722 | 2.297701 | [
"s983473585",
"s341179958"
] |
u368249389 | p03361 | python | s637672601 | s119110212 | 183 | 18 | 39,152 | 3,064 | Accepted | Accepted | 90.16 | # Problem C - Grid Repainting
# input process
H, W = list(map(int, input().split()))
s_list = [[0]*W for i in range(H)]
for i in range(H):
tmp = eval(input())
for j in range(W):
s_list[i][j] = tmp[j]
# search process
is_ok = True
for i in range(H):
for j in range(W):
if s_lis... | # Problem C - Grid Repainting 2
# input
H, W = list(map(int, input().split()))
board = [[0]*W for i in range(H)]
for i in range(H):
s_list = list(eval(input()))
for j in range(W):
board[i][j] = s_list[j]
# initialization
is_ok = True
# check
for i in range(H):
for j in range(W):
... | 40 | 48 | 886 | 919 | # Problem C - Grid Repainting
# input process
H, W = list(map(int, input().split()))
s_list = [[0] * W for i in range(H)]
for i in range(H):
tmp = eval(input())
for j in range(W):
s_list[i][j] = tmp[j]
# search process
is_ok = True
for i in range(H):
for j in range(W):
if s_list[i][j] == "."... | # Problem C - Grid Repainting 2
# input
H, W = list(map(int, input().split()))
board = [[0] * W for i in range(H)]
for i in range(H):
s_list = list(eval(input()))
for j in range(W):
board[i][j] = s_list[j]
# initialization
is_ok = True
# check
for i in range(H):
for j in range(W):
s = board[... | false | 16.666667 | [
"-# Problem C - Grid Repainting",
"-# input process",
"+# Problem C - Grid Repainting 2",
"+# input",
"-s_list = [[0] * W for i in range(H)]",
"+board = [[0] * W for i in range(H)]",
"- tmp = eval(input())",
"+ s_list = list(eval(input()))",
"- s_list[i][j] = tmp[j]",
"-# search proce... | false | 0.034748 | 0.032408 | 1.072214 | [
"s637672601",
"s119110212"
] |
u941753895 | p03574 | python | s206649122 | s148619080 | 53 | 47 | 6,304 | 5,544 | Accepted | Accepted | 11.32 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
def LI(): return list(map(int,input().split()))
def I(): return int(eval(input()))
def LS(): return input().split()
def S(): return eval(input())
def main():
h,w=... | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
def LI(): return list(map(int,input().split()))
def I(): return int(eval(input()))
def LS(): return input().split()
def S(): return eval(input())
def main():
h,w=... | 35 | 37 | 742 | 750 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI():
return list(map(int, input().split()))
def I():
return int(eval(input()))
def LS():
return input().split()
def S():
return eval... | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI():
return list(map(int, input().split()))
def I():
return int(eval(input()))
def LS():
return input().split()
def S():
return eval... | false | 5.405405 | [
"- if l[i][j] != \"#\":",
"- c = 0",
"- for x in a:",
"- if (",
"- i + x[0] >= 0",
"- and i + x[0] < h",
"- and j + x[1] >= 0",
"- and j + x[1] < w",
... | false | 0.041044 | 0.072792 | 0.563846 | [
"s206649122",
"s148619080"
] |
u623231048 | p02761 | python | s617667541 | s876724090 | 19 | 17 | 3,064 | 3,064 | Accepted | Accepted | 10.53 | n,m = list(map(int,input().split()))
sc = [list(map(int,input().split())) for _ in range(m)]
for i in range(1000):
li = []
j = str(i)
for k in range(len(j)):
li.append(int(j[k]))
if len(li) != n:
continue
else:
flag = True
for s,c in sc:
if... | n,m = list(map(int,input().split()))
sc = [list(map(int,input().split())) for _ in range(m)]
li = [-1] * n
for s,c in sc:
if li[s-1] == -1 or li[s-1] == c:
li[s-1] = c
else:
print((-1))
exit()
if n != 1 and s == 1 and c == 0:
print((-1))
exit()
for i... | 21 | 27 | 432 | 501 | n, m = list(map(int, input().split()))
sc = [list(map(int, input().split())) for _ in range(m)]
for i in range(1000):
li = []
j = str(i)
for k in range(len(j)):
li.append(int(j[k]))
if len(li) != n:
continue
else:
flag = True
for s, c in sc:
if li[s - 1] !... | n, m = list(map(int, input().split()))
sc = [list(map(int, input().split())) for _ in range(m)]
li = [-1] * n
for s, c in sc:
if li[s - 1] == -1 or li[s - 1] == c:
li[s - 1] = c
else:
print((-1))
exit()
if n != 1 and s == 1 and c == 0:
print((-1))
exit()
for i in rang... | false | 22.222222 | [
"-for i in range(1000):",
"- li = []",
"- j = str(i)",
"- for k in range(len(j)):",
"- li.append(int(j[k]))",
"- if len(li) != n:",
"- continue",
"+li = [-1] * n",
"+for s, c in sc:",
"+ if li[s - 1] == -1 or li[s - 1] == c:",
"+ li[s - 1] = c",
"- fl... | false | 0.044164 | 0.10848 | 0.407117 | [
"s617667541",
"s876724090"
] |
u330039499 | p03610 | python | s954321373 | s725253127 | 105 | 24 | 7,168 | 3,140 | Accepted | Accepted | 77.14 | s = input()
print("".join([c for i, c in enumerate(s) if (i + 1) % 2 == 1]))
| print("".join([c for i, c in enumerate(input()) if (i + 1) % 2 == 1]))
| 2 | 1 | 81 | 74 | s = input()
print("".join([c for i, c in enumerate(s) if (i + 1) % 2 == 1]))
| print("".join([c for i, c in enumerate(input()) if (i + 1) % 2 == 1]))
| false | 50 | [
"-s = input()",
"-print(\"\".join([c for i, c in enumerate(s) if (i + 1) % 2 == 1]))",
"+print(\"\".join([c for i, c in enumerate(input()) if (i + 1) % 2 == 1]))"
] | false | 0.120069 | 0.063145 | 1.901465 | [
"s954321373",
"s725253127"
] |
u644907318 | p03352 | python | s604219930 | s837667824 | 209 | 66 | 62,088 | 62,124 | Accepted | Accepted | 68.42 | X = int(eval(input()))
cmax = 1
for i in range(2,int(X**0.5)+1):
k = 2
while i**k<=X:
cmax = max(cmax,i**k)
k += 1
print(cmax) | X = int(eval(input()))
if X==1:
print((1))
else:
cmax = 1
for i in range(2,int(X**0.5)+1):
k = 2
while i**k<=X:
cmax = max(cmax,i**k)
k += 1
print(cmax) | 8 | 11 | 151 | 210 | X = int(eval(input()))
cmax = 1
for i in range(2, int(X**0.5) + 1):
k = 2
while i**k <= X:
cmax = max(cmax, i**k)
k += 1
print(cmax)
| X = int(eval(input()))
if X == 1:
print((1))
else:
cmax = 1
for i in range(2, int(X**0.5) + 1):
k = 2
while i**k <= X:
cmax = max(cmax, i**k)
k += 1
print(cmax)
| false | 27.272727 | [
"-cmax = 1",
"-for i in range(2, int(X**0.5) + 1):",
"- k = 2",
"- while i**k <= X:",
"- cmax = max(cmax, i**k)",
"- k += 1",
"-print(cmax)",
"+if X == 1:",
"+ print((1))",
"+else:",
"+ cmax = 1",
"+ for i in range(2, int(X**0.5) + 1):",
"+ k = 2",
"+ ... | false | 0.045906 | 0.046669 | 0.983653 | [
"s604219930",
"s837667824"
] |
u670180528 | p02735 | python | s469349716 | s322030510 | 558 | 53 | 3,572 | 3,444 | Accepted | Accepted | 90.5 | from collections import deque
t,*g=open(0)
h,w=list(map(int,t.split()))
vis=[[1e9]*w for _ in range(h)]
vis[0][0]=int(g[0][0]=="#")
q=deque([(0,0,vis[0][0])])
while q:
cy,cx,c=q.popleft()
for ny,nx in ((cy+1,cx),(cy,cx+1)):
cc=c
if not (0<=ny<h and 0<=nx<w):
continue
if g[cy][cx]=="." and g[ny][n... | from collections import deque
t,*g=open(0)
h,w=list(map(int,t.split()))
vis=[[1e9]*w for _ in range(h)]
vis[0][0]=int(g[0][0]=="#")
q=deque([(0,0)])
while q:
cy,cx=q.popleft()
for ny,nx in ((cy+1,cx),(cy,cx+1)):
if not not (0<=ny<h and 0<=nx<w) and vis[cy][cx]+(g[cy][cx]!=g[ny][nx]=="#")<vis[ny][nx]:
v... | 19 | 13 | 431 | 406 | from collections import deque
t, *g = open(0)
h, w = list(map(int, t.split()))
vis = [[1e9] * w for _ in range(h)]
vis[0][0] = int(g[0][0] == "#")
q = deque([(0, 0, vis[0][0])])
while q:
cy, cx, c = q.popleft()
for ny, nx in ((cy + 1, cx), (cy, cx + 1)):
cc = c
if not (0 <= ny < h and 0 <= nx <... | from collections import deque
t, *g = open(0)
h, w = list(map(int, t.split()))
vis = [[1e9] * w for _ in range(h)]
vis[0][0] = int(g[0][0] == "#")
q = deque([(0, 0)])
while q:
cy, cx = q.popleft()
for ny, nx in ((cy + 1, cx), (cy, cx + 1)):
if (
not not (0 <= ny < h and 0 <= nx < w)
... | false | 31.578947 | [
"-q = deque([(0, 0, vis[0][0])])",
"+q = deque([(0, 0)])",
"- cy, cx, c = q.popleft()",
"+ cy, cx = q.popleft()",
"- cc = c",
"- if not (0 <= ny < h and 0 <= nx < w):",
"- continue",
"- if g[cy][cx] == \".\" and g[ny][nx] == \"#\":",
"- cc += 1",
"-... | false | 0.059963 | 0.037345 | 1.605626 | [
"s469349716",
"s322030510"
] |
u078042885 | p01751 | python | s332960341 | s057463794 | 30 | 20 | 7,684 | 7,676 | Accepted | Accepted | 33.33 | a,b,c=list(map(int, input().split()))
d=0
for _ in range(60):
if c<=d+a:
print(c)
break
d+=a+b
while c<=d:c+=60
else: print((-1)) | a,b,c=list(map(int, input().split()))
d,e=0,60
for _ in range(e):
if c<=d+a:
print(c)
break
d+=a+b
c+=(d+e-c)//e*e
else: print((-1)) | 9 | 9 | 157 | 160 | a, b, c = list(map(int, input().split()))
d = 0
for _ in range(60):
if c <= d + a:
print(c)
break
d += a + b
while c <= d:
c += 60
else:
print((-1))
| a, b, c = list(map(int, input().split()))
d, e = 0, 60
for _ in range(e):
if c <= d + a:
print(c)
break
d += a + b
c += (d + e - c) // e * e
else:
print((-1))
| false | 0 | [
"-d = 0",
"-for _ in range(60):",
"+d, e = 0, 60",
"+for _ in range(e):",
"- while c <= d:",
"- c += 60",
"+ c += (d + e - c) // e * e"
] | false | 0.049788 | 0.049051 | 1.015014 | [
"s332960341",
"s057463794"
] |
u354246246 | p02598 | python | s446073104 | s487204905 | 1,011 | 635 | 31,156 | 31,108 | Accepted | Accepted | 37.19 | import math
def possible(l, a, k):
for x in a:
k -= math.ceil(x/l)-1
return k>=0
n, k = list(map(int, input().split()))
a = [int(x) for x in input().split()]
mini = 1
maxi = 10**9+7
while(mini!=maxi):
mid = (mini+maxi)//2
if possible(mid, a, k):
maxi = mid
else:
... | import math
def possible(l, a, k):
for x in a:
k -= x//l
if x%l==0:
k += 1
return k>=0
n, k = list(map(int, input().split()))
a = [int(x) for x in input().split()]
mini = 1
maxi = 10**9+7
while(mini!=maxi):
mid = (mini+maxi)//2
if possible(mid, a, k):
... | 17 | 19 | 345 | 373 | import math
def possible(l, a, k):
for x in a:
k -= math.ceil(x / l) - 1
return k >= 0
n, k = list(map(int, input().split()))
a = [int(x) for x in input().split()]
mini = 1
maxi = 10**9 + 7
while mini != maxi:
mid = (mini + maxi) // 2
if possible(mid, a, k):
maxi = mid
else:
... | import math
def possible(l, a, k):
for x in a:
k -= x // l
if x % l == 0:
k += 1
return k >= 0
n, k = list(map(int, input().split()))
a = [int(x) for x in input().split()]
mini = 1
maxi = 10**9 + 7
while mini != maxi:
mid = (mini + maxi) // 2
if possible(mid, a, k):
... | false | 10.526316 | [
"- k -= math.ceil(x / l) - 1",
"+ k -= x // l",
"+ if x % l == 0:",
"+ k += 1"
] | false | 0.046588 | 0.007647 | 6.092335 | [
"s446073104",
"s487204905"
] |
u922172470 | p02748 | python | s974388568 | s352464370 | 447 | 178 | 38,556 | 35,124 | Accepted | Accepted | 60.18 | def resolve():
A, B, M = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
grid=[list(map(int,input().split())) for i in range(M)]
res = min(a) + min(b)
for x, y, c in grid:
res = min(res, a[x-1]+b[y-1]-c)
print(res)... | import sys
A, B, M = list(map(int, sys.stdin.readline().split()))
*a, = list(map(int, sys.stdin.readline().split()))
*b, = list(map(int, sys.stdin.readline().split()))
xyc = list(zip(*[list(map(int, sys.stdin.read().split()))] * 3))
def main():
res = min(a) + min(b)
for x, y, c in xyc:
... | 14 | 17 | 331 | 409 | def resolve():
A, B, M = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
grid = [list(map(int, input().split())) for i in range(M)]
res = min(a) + min(b)
for x, y, c in grid:
res = min(res, a[x - 1] + b[y - 1] - c)
print(res)
... | import sys
A, B, M = list(map(int, sys.stdin.readline().split()))
(*a,) = list(map(int, sys.stdin.readline().split()))
(*b,) = list(map(int, sys.stdin.readline().split()))
xyc = list(zip(*[list(map(int, sys.stdin.read().split()))] * 3))
def main():
res = min(a) + min(b)
for x, y, c in xyc:
res = min(... | false | 17.647059 | [
"-def resolve():",
"- A, B, M = list(map(int, input().split()))",
"- a = list(map(int, input().split()))",
"- b = list(map(int, input().split()))",
"- grid = [list(map(int, input().split())) for i in range(M)]",
"- res = min(a) + min(b)",
"- for x, y, c in grid:",
"- res = min... | false | 0.108714 | 0.036841 | 2.950902 | [
"s974388568",
"s352464370"
] |
u729133443 | p03238 | python | s700551485 | s410390200 | 39 | 10 | 27,500 | 2,568 | Accepted | Accepted | 74.36 | print(eval(input())+eval(input())if eval(input())-1else'Hello World') | print(eval(input())+eval(input())if~-eval(input())else'Hello World') | 1 | 1 | 50 | 49 | print(eval(input()) + eval(input()) if eval(input()) - 1 else "Hello World")
| print(eval(input()) + eval(input()) if ~-eval(input()) else "Hello World")
| false | 0 | [
"-print(eval(input()) + eval(input()) if eval(input()) - 1 else \"Hello World\")",
"+print(eval(input()) + eval(input()) if ~-eval(input()) else \"Hello World\")"
] | false | 0.084606 | 0.064612 | 1.309443 | [
"s700551485",
"s410390200"
] |
u074220993 | p03455 | python | s376526564 | s780964770 | 29 | 26 | 9,024 | 9,012 | Accepted | Accepted | 10.34 | a, b = list(map(int, input().split()))
print(('Odd' if a & 1 and b & 1 else 'Even')) | a, b = list(map(int, input().split()))
print(('Odd' if a*b % 2 == 1 else 'Even')) | 2 | 2 | 77 | 74 | a, b = list(map(int, input().split()))
print(("Odd" if a & 1 and b & 1 else "Even"))
| a, b = list(map(int, input().split()))
print(("Odd" if a * b % 2 == 1 else "Even"))
| false | 0 | [
"-print((\"Odd\" if a & 1 and b & 1 else \"Even\"))",
"+print((\"Odd\" if a * b % 2 == 1 else \"Even\"))"
] | false | 0.055255 | 0.054713 | 1.009914 | [
"s376526564",
"s780964770"
] |
u156815136 | p02843 | python | s244082293 | s422419953 | 203 | 183 | 5,916 | 41,324 | Accepted | Accepted | 9.85 | 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 # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
# d = m - k[i] -... | X = int(eval(input()))
Food = [100,101,102,103,104,105]
dp = [False] * (X+1)
dp[0] = True
for i in range(X+1):
for f in Food:
if i - f >= 0:
#print(i,i-f)
dp[i] = dp[i - f] | dp[i]
print(('1' if dp[X] else '0'))
| 40 | 10 | 956 | 249 | 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 # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
# d = m - k[i] - k[j... | X = int(eval(input()))
Food = [100, 101, 102, 103, 104, 105]
dp = [False] * (X + 1)
dp[0] = True
for i in range(X + 1):
for f in Food:
if i - f >= 0:
# print(i,i-f)
dp[i] = dp[i - f] | dp[i]
print(("1" if dp[X] else "0"))
| false | 75 | [
"-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 # (string,3) 3回",
"-from collections import deque",
"-from collections import defa... | false | 0.039318 | 0.06807 | 0.57761 | [
"s244082293",
"s422419953"
] |
u750651325 | p02694 | python | s375251442 | s581461190 | 25 | 22 | 9,180 | 9,172 | Accepted | Accepted | 12 | X = int(eval(input()))
count = 0
sum = 100
while sum < X:
sum += sum // 100
count += 1
print(count)
| X = int(eval(input()))
sum = 100
count = 0
while sum < X:
sum += int(sum * 0.01)
count += 1
print(count)
| 12 | 9 | 118 | 117 | X = int(eval(input()))
count = 0
sum = 100
while sum < X:
sum += sum // 100
count += 1
print(count)
| X = int(eval(input()))
sum = 100
count = 0
while sum < X:
sum += int(sum * 0.01)
count += 1
print(count)
| false | 25 | [
"+sum = 100",
"-sum = 100",
"- sum += sum // 100",
"+ sum += int(sum * 0.01)"
] | false | 0.048792 | 0.047988 | 1.016763 | [
"s375251442",
"s581461190"
] |
u116002573 | p03290 | python | s966874416 | s485686318 | 40 | 23 | 3,316 | 3,444 | Accepted | Accepted | 42.5 | def main():
D, G = list(map(int, input().split()))
pc = []
min_ct = 0
for i in range(D):
p, c = list(map(int, input().split()))
pc.append([p, c])
min_ct += p
bonus = [set()]
for i in range(D):
temp = []
for st in bonus:
temp.appen... | def main():
D, G = list(map(int, input().split()))
A = []
for i in range(D):
p, c = list(map(int, input().split()))
A.append([i, p, c])
A = A[::-1]
cur = [[0, 0]]
used = [set()]
for i, p, c in A:
temp = []
temp_used = []
for j in rang... | 36 | 48 | 909 | 1,367 | def main():
D, G = list(map(int, input().split()))
pc = []
min_ct = 0
for i in range(D):
p, c = list(map(int, input().split()))
pc.append([p, c])
min_ct += p
bonus = [set()]
for i in range(D):
temp = []
for st in bonus:
temp.append(st | {i})
... | def main():
D, G = list(map(int, input().split()))
A = []
for i in range(D):
p, c = list(map(int, input().split()))
A.append([i, p, c])
A = A[::-1]
cur = [[0, 0]]
used = [set()]
for i, p, c in A:
temp = []
temp_used = []
for j in range(len(cur)):
... | false | 25 | [
"- pc = []",
"- min_ct = 0",
"+ A = []",
"- pc.append([p, c])",
"- min_ct += p",
"- bonus = [set()]",
"- for i in range(D):",
"+ A.append([i, p, c])",
"+ A = A[::-1]",
"+ cur = [[0, 0]]",
"+ used = [set()]",
"+ for i, p, c in A:",
"- for... | false | 0.044576 | 0.065526 | 0.680278 | [
"s966874416",
"s485686318"
] |
u225388820 | p02612 | python | s690387417 | s053589970 | 64 | 28 | 61,712 | 9,120 | Accepted | Accepted | 56.25 | n = int(eval(input()))%1000
print((1000 - n if n else 0)) | print(((1000 - int(eval(input())) % 1000) % 1000)) | 2 | 1 | 50 | 42 | n = int(eval(input())) % 1000
print((1000 - n if n else 0))
| print(((1000 - int(eval(input())) % 1000) % 1000))
| false | 50 | [
"-n = int(eval(input())) % 1000",
"-print((1000 - n if n else 0))",
"+print(((1000 - int(eval(input())) % 1000) % 1000))"
] | false | 0.088515 | 0.036844 | 2.402409 | [
"s690387417",
"s053589970"
] |
u998435601 | p02396 | python | s673294606 | s623374330 | 50 | 40 | 6,632 | 6,576 | Accepted | Accepted | 20 | lis = []
a = int(input())
while a != 0:
lis.append(a)
a = int(input())
for i,v in enumerate(lis):
print("Case %d: %d" % (i+1,v)) | lis = []
a = input()
while a != '0':
lis.append(a)
a = input()
for i,v in enumerate(lis):
print("Case %d: %s" % (i+1,v)) | 8 | 8 | 146 | 138 | lis = []
a = int(input())
while a != 0:
lis.append(a)
a = int(input())
for i, v in enumerate(lis):
print("Case %d: %d" % (i + 1, v))
| lis = []
a = input()
while a != "0":
lis.append(a)
a = input()
for i, v in enumerate(lis):
print("Case %d: %s" % (i + 1, v))
| false | 0 | [
"-a = int(input())",
"-while a != 0:",
"+a = input()",
"+while a != \"0\":",
"- a = int(input())",
"+ a = input()",
"- print(\"Case %d: %d\" % (i + 1, v))",
"+ print(\"Case %d: %s\" % (i + 1, v))"
] | false | 0.040255 | 0.042934 | 0.937596 | [
"s673294606",
"s623374330"
] |
u006880673 | p02579 | python | s675386827 | s249740018 | 763 | 704 | 159,780 | 136,584 | Accepted | Accepted | 7.73 | from itertools import product
from collections import deque
INF = 1e7
def main():
H, W = list(map(int, input().split()))
ch, cw = [int(x)+1 for x in input().split()]
dh, dw = [int(x)+1 for x in input().split()]
S = [["#"]*(W+4) for _ in range(H+4)]
whites = [] # 道であるindex
for i in range... | from itertools import product
from collections import deque
INF = 1e7
def main():
H, W = list(map(int, input().split()))
ch, cw = [int(x)+1 for x in input().split()]
dh, dw = [int(x)+1 for x in input().split()]
S = [["#"]*(W+4) for _ in range(H+4)]
# whites = [] # 道であるindex
for i in ran... | 79 | 79 | 2,518 | 2,524 | from itertools import product
from collections import deque
INF = 1e7
def main():
H, W = list(map(int, input().split()))
ch, cw = [int(x) + 1 for x in input().split()]
dh, dw = [int(x) + 1 for x in input().split()]
S = [["#"] * (W + 4) for _ in range(H + 4)]
whites = [] # 道であるindex
for i in... | from itertools import product
from collections import deque
INF = 1e7
def main():
H, W = list(map(int, input().split()))
ch, cw = [int(x) + 1 for x in input().split()]
dh, dw = [int(x) + 1 for x in input().split()]
S = [["#"] * (W + 4) for _ in range(H + 4)]
# whites = [] # 道であるindex
for i in... | false | 0 | [
"- whites = [] # 道であるindex",
"+ # whites = [] # 道であるindex",
"- if S[i][j] == \".\":",
"- whites.append((i, j))",
"+ # if S[i][j] == \".\":",
"+ # whites.append((i,j))"
] | false | 0.121488 | 0.106823 | 1.137286 | [
"s675386827",
"s249740018"
] |
u216015528 | p03086 | python | s465123928 | s657151505 | 63 | 28 | 61,892 | 8,872 | Accepted | Accepted | 55.56 | #!/usr/bin/env python3
def main():
S = eval(input())
lst = set(['A', 'C', 'G', 'T'])
cnt = 0
ans = 0
for s in S:
if s in lst:
cnt += 1
else:
ans = max(ans, cnt)
cnt = 0
ans = max(ans, cnt)
print(ans)
if __name__ == '__ma... | def resolve():
S = eval(input())
ans, cnt = 0, 0
for s in S:
if s == 'A' or s == 'C'or s == 'G' or s == 'T':
cnt += 1
else:
ans = max(ans, cnt)
cnt = 0
ans = max(ans, cnt)
print(ans)
resolve()
| 19 | 13 | 333 | 272 | #!/usr/bin/env python3
def main():
S = eval(input())
lst = set(["A", "C", "G", "T"])
cnt = 0
ans = 0
for s in S:
if s in lst:
cnt += 1
else:
ans = max(ans, cnt)
cnt = 0
ans = max(ans, cnt)
print(ans)
if __name__ == "__main__":
main()
| def resolve():
S = eval(input())
ans, cnt = 0, 0
for s in S:
if s == "A" or s == "C" or s == "G" or s == "T":
cnt += 1
else:
ans = max(ans, cnt)
cnt = 0
ans = max(ans, cnt)
print(ans)
resolve()
| false | 31.578947 | [
"-#!/usr/bin/env python3",
"-def main():",
"+def resolve():",
"- lst = set([\"A\", \"C\", \"G\", \"T\"])",
"- cnt = 0",
"- ans = 0",
"+ ans, cnt = 0, 0",
"- if s in lst:",
"+ if s == \"A\" or s == \"C\" or s == \"G\" or s == \"T\":",
"-if __name__ == \"__main__\":",
"- ... | false | 0.045577 | 0.094605 | 0.481767 | [
"s465123928",
"s657151505"
] |
u385167811 | p03127 | python | s167652063 | s847488370 | 813 | 582 | 14,308 | 14,252 | Accepted | Accepted | 28.41 | N = int(eval(input()))
A = input().split(" ")
A = [int(i) for i in A]
list = [min(A)]
A = sorted(A)
iii = 0
while True:
iii += 1
if A[N-1] % A[N-2] != 0:
A[N-1] = A[N-1] % A[N-2]
elif N >= 3 and A[N-1] % A[N-3] != 0:
A[N-1] = A[N-1] % A[N-3]
elif N >= 4 and A[N-1] % A[N-4] !=... | N = int(eval(input()))
A = input().split(" ")
A = [int(i) for i in A]
list = [min(A)]
A = sorted(A)
iii = 0
while True:
iii += 1
if A[N-1] % A[N-2] != 0:
A[N-1] = A[N-1] % A[N-2]
elif N >= 3 and A[N-1] % A[N-3] != 0:
A[N-1] = A[N-1] % A[N-3]
elif N >= 4 and A[N-1] % A[N-4] !=... | 37 | 27 | 1,029 | 641 | N = int(eval(input()))
A = input().split(" ")
A = [int(i) for i in A]
list = [min(A)]
A = sorted(A)
iii = 0
while True:
iii += 1
if A[N - 1] % A[N - 2] != 0:
A[N - 1] = A[N - 1] % A[N - 2]
elif N >= 3 and A[N - 1] % A[N - 3] != 0:
A[N - 1] = A[N - 1] % A[N - 3]
elif N >= 4 and A[N - 1] %... | N = int(eval(input()))
A = input().split(" ")
A = [int(i) for i in A]
list = [min(A)]
A = sorted(A)
iii = 0
while True:
iii += 1
if A[N - 1] % A[N - 2] != 0:
A[N - 1] = A[N - 1] % A[N - 2]
elif N >= 3 and A[N - 1] % A[N - 3] != 0:
A[N - 1] = A[N - 1] % A[N - 3]
elif N >= 4 and A[N - 1] %... | false | 27.027027 | [
"- elif N >= 6 and A[N - 1] % A[N - 6] != 0:",
"- A[N - 1] = A[N - 1] % A[N - 6]",
"- elif N >= 7 and A[N - 1] % A[N - 7] != 0:",
"- A[N - 1] = A[N - 1] % A[N - 7]",
"- elif N >= 8 and A[N - 1] % A[N - 8] != 0:",
"- A[N - 1] = A[N - 1] % A[N - 8]",
"- elif N >= 9 and A[N... | false | 0.044127 | 0.043669 | 1.010501 | [
"s167652063",
"s847488370"
] |
u014333473 | p03408 | python | s319553334 | s961883276 | 29 | 25 | 9,068 | 9,084 | Accepted | Accepted | 13.79 | r1=[eval(input()) for _ in range(int(eval(input())))];r2=[eval(input()) for _ in range(int(eval(input())))];ans=0
for i in set(r1): ans=max(ans,r1.count(i)-r2.count(i))
print(ans) | r1,r2=[eval(input()) for _ in range(int(eval(input())))],[eval(input()) for _ in range(int(eval(input())))];ans=0
ans=[r1.count(i)-r2.count(i) for i in set(r1)];print((max(0,max(ans)))) | 3 | 2 | 157 | 160 | r1 = [eval(input()) for _ in range(int(eval(input())))]
r2 = [eval(input()) for _ in range(int(eval(input())))]
ans = 0
for i in set(r1):
ans = max(ans, r1.count(i) - r2.count(i))
print(ans)
| r1, r2 = [eval(input()) for _ in range(int(eval(input())))], [
eval(input()) for _ in range(int(eval(input())))
]
ans = 0
ans = [r1.count(i) - r2.count(i) for i in set(r1)]
print((max(0, max(ans))))
| false | 33.333333 | [
"-r1 = [eval(input()) for _ in range(int(eval(input())))]",
"-r2 = [eval(input()) for _ in range(int(eval(input())))]",
"+r1, r2 = [eval(input()) for _ in range(int(eval(input())))], [",
"+ eval(input()) for _ in range(int(eval(input())))",
"+]",
"-for i in set(r1):",
"- ans = max(ans, r1.count(i)... | false | 0.038334 | 0.036124 | 1.061179 | [
"s319553334",
"s961883276"
] |
u724687935 | p03147 | python | s700736334 | s550218238 | 23 | 17 | 3,188 | 2,940 | Accepted | Accepted | 26.09 | N = int(eval(input()))
H = list(map(int, input().split()))
H.append(0)
t = 1
ans = 0
while t > 0:
p = H[-1]
t = 0
for i in range(N):
if H[i] > 0 and p <= 0:
ans += 1
p = H[i]
H[i] -= 1
t = max(H[i], t)
#print(ans, H[i], t)
print(ans)
| N = int(eval(input()))
H = list(map(int, input().split()))
ans = 0
pre = 0
for h in H:
if pre < h:
ans += h - pre
pre = h
print(ans)
| 18 | 12 | 311 | 157 | N = int(eval(input()))
H = list(map(int, input().split()))
H.append(0)
t = 1
ans = 0
while t > 0:
p = H[-1]
t = 0
for i in range(N):
if H[i] > 0 and p <= 0:
ans += 1
p = H[i]
H[i] -= 1
t = max(H[i], t)
# print(ans, H[i], t)
print(ans)
| N = int(eval(input()))
H = list(map(int, input().split()))
ans = 0
pre = 0
for h in H:
if pre < h:
ans += h - pre
pre = h
print(ans)
| false | 33.333333 | [
"-H.append(0)",
"-t = 1",
"-while t > 0:",
"- p = H[-1]",
"- t = 0",
"- for i in range(N):",
"- if H[i] > 0 and p <= 0:",
"- ans += 1",
"- p = H[i]",
"- H[i] -= 1",
"- t = max(H[i], t)",
"- # print(ans, H[i], t)",
"+pre = 0",
"+for h i... | false | 0.038837 | 0.075958 | 0.511291 | [
"s700736334",
"s550218238"
] |
u021548497 | p02788 | python | s385460761 | s815402649 | 1,679 | 1,287 | 70,308 | 53,448 | Accepted | Accepted | 23.35 | import bisect
n, d, a = list(map(int, input().split()))
fox = [None]*n
for i in range(n):
x, h = list(map(int, input().split()))
fox[i] = (x, h)
fox.sort()
x = [int(fox[i][0]) for i in range(n)]
h = [int(fox[i][1]) for i in range(n)]
ans = 0
bit = [0]*n
for i in range(n):
if i != 0:
bit[i] +=... | import sys
input = sys.stdin.readline
n, d, a = list(map(int, input().split()))
fox = [list(map(int, input().split())) for _ in range(n)]
fox.sort()
sub = [0]*(n+1)
def bisect(x):
l, r = 0, n
while r-l > 1:
k = (r+l)//2
if fox[k][0] <= x:
l = k
else:
... | 26 | 42 | 527 | 762 | import bisect
n, d, a = list(map(int, input().split()))
fox = [None] * n
for i in range(n):
x, h = list(map(int, input().split()))
fox[i] = (x, h)
fox.sort()
x = [int(fox[i][0]) for i in range(n)]
h = [int(fox[i][1]) for i in range(n)]
ans = 0
bit = [0] * n
for i in range(n):
if i != 0:
bit[i] += b... | import sys
input = sys.stdin.readline
n, d, a = list(map(int, input().split()))
fox = [list(map(int, input().split())) for _ in range(n)]
fox.sort()
sub = [0] * (n + 1)
def bisect(x):
l, r = 0, n
while r - l > 1:
k = (r + l) // 2
if fox[k][0] <= x:
l = k
else:
... | false | 38.095238 | [
"-import bisect",
"+import sys",
"+input = sys.stdin.readline",
"-fox = [None] * n",
"-for i in range(n):",
"- x, h = list(map(int, input().split()))",
"- fox[i] = (x, h)",
"+fox = [list(map(int, input().split())) for _ in range(n)]",
"-x = [int(fox[i][0]) for i in range(n)]",
"-h = [int(fox... | false | 0.08599 | 0.080002 | 1.074848 | [
"s385460761",
"s815402649"
] |
u746419473 | p02812 | python | s636683771 | s978647131 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(n-2):
if s[i:i+3] == "ABC":
ans += 1
print(ans)
| n = int(eval(input()))
*s, = eval(input())
ans = 0
for i in range(n-2):
if "".join(s[i:i+3]) == "ABC":
ans += 1
print(ans)
| 9 | 9 | 122 | 133 | n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(n - 2):
if s[i : i + 3] == "ABC":
ans += 1
print(ans)
| n = int(eval(input()))
(*s,) = eval(input())
ans = 0
for i in range(n - 2):
if "".join(s[i : i + 3]) == "ABC":
ans += 1
print(ans)
| false | 0 | [
"-s = eval(input())",
"+(*s,) = eval(input())",
"- if s[i : i + 3] == \"ABC\":",
"+ if \"\".join(s[i : i + 3]) == \"ABC\":"
] | false | 0.047116 | 0.039409 | 1.195575 | [
"s636683771",
"s978647131"
] |
u692746605 | p02726 | python | s480536267 | s887338803 | 1,812 | 902 | 3,572 | 3,444 | Accepted | Accepted | 50.22 | N,X,Y=list(map(int,input().split()))
C=[0]*N
for i in range(1,N):
for j in range(i+1,N+1):
C[min(j-i,abs(X-i)+1+abs(j-Y),abs(Y-i)+1+abs(j-X))]+=1
for i in range(1,N):
print((C[i]))
| def main():
N,X,Y=list(map(int,input().split()))
C=[0]*N
for i in range(1,N):
for j in range(i+1,N+1):
C[min(j-i,abs(X-i)+1+abs(j-Y))]+=1
for i in range(1,N):
print((C[i]))
main()
| 9 | 11 | 191 | 206 | N, X, Y = list(map(int, input().split()))
C = [0] * N
for i in range(1, N):
for j in range(i + 1, N + 1):
C[min(j - i, abs(X - i) + 1 + abs(j - Y), abs(Y - i) + 1 + abs(j - X))] += 1
for i in range(1, N):
print((C[i]))
| def main():
N, X, Y = list(map(int, input().split()))
C = [0] * N
for i in range(1, N):
for j in range(i + 1, N + 1):
C[min(j - i, abs(X - i) + 1 + abs(j - Y))] += 1
for i in range(1, N):
print((C[i]))
main()
| false | 18.181818 | [
"-N, X, Y = list(map(int, input().split()))",
"-C = [0] * N",
"-for i in range(1, N):",
"- for j in range(i + 1, N + 1):",
"- C[min(j - i, abs(X - i) + 1 + abs(j - Y), abs(Y - i) + 1 + abs(j - X))] += 1",
"-for i in range(1, N):",
"- print((C[i]))",
"+def main():",
"+ N, X, Y = list(... | false | 0.126337 | 0.131014 | 0.964301 | [
"s480536267",
"s887338803"
] |
u620084012 | p02724 | python | s591974023 | s985323375 | 173 | 26 | 38,384 | 9,168 | Accepted | Accepted | 84.97 | X = int(eval(input()))
print((1000*(X//500) + 5*((X-500*(X//500))//5)))
| X = int(eval(input()))
ans = 1000*(X//500)
X -= 500*(X//500)
ans += 5*(X//5)
print(ans) | 2 | 5 | 65 | 85 | X = int(eval(input()))
print((1000 * (X // 500) + 5 * ((X - 500 * (X // 500)) // 5)))
| X = int(eval(input()))
ans = 1000 * (X // 500)
X -= 500 * (X // 500)
ans += 5 * (X // 5)
print(ans)
| false | 60 | [
"-print((1000 * (X // 500) + 5 * ((X - 500 * (X // 500)) // 5)))",
"+ans = 1000 * (X // 500)",
"+X -= 500 * (X // 500)",
"+ans += 5 * (X // 5)",
"+print(ans)"
] | false | 0.079014 | 0.040732 | 1.939841 | [
"s591974023",
"s985323375"
] |
u888092736 | p02768 | python | s855022653 | s604300188 | 144 | 122 | 3,064 | 9,156 | Accepted | Accepted | 15.28 | def cmb(n, r, p):
# nume/deno === nume * pow(deno, p - 2, p) (mod p)
nume, deno = 1, 1
for i in range(r):
nume = nume * (n - i) % p
deno = deno * (i + 1) % p
return nume * pow(deno, p - 2, p) % p
if __name__ == "__main__":
n, a, b = list(map(int, input().split()))
p ... | def comb(n, r, p):
num, den = 1, 1
r = min(r, n - r)
for i in range(1, r + 1):
num = num * (n - i + 1) % p
den = den * i % p
return num * pow(den, p - 2, p) % p
n, a, b = list(map(int, input().split()))
MOD = 1_000_000_007
ans = pow(2, n, MOD)
ans %= MOD
ans -= comb(n, a, ... | 14 | 20 | 395 | 401 | def cmb(n, r, p):
# nume/deno === nume * pow(deno, p - 2, p) (mod p)
nume, deno = 1, 1
for i in range(r):
nume = nume * (n - i) % p
deno = deno * (i + 1) % p
return nume * pow(deno, p - 2, p) % p
if __name__ == "__main__":
n, a, b = list(map(int, input().split()))
p = 10**9 + 7... | def comb(n, r, p):
num, den = 1, 1
r = min(r, n - r)
for i in range(1, r + 1):
num = num * (n - i + 1) % p
den = den * i % p
return num * pow(den, p - 2, p) % p
n, a, b = list(map(int, input().split()))
MOD = 1_000_000_007
ans = pow(2, n, MOD)
ans %= MOD
ans -= comb(n, a, MOD)
ans %= M... | false | 30 | [
"-def cmb(n, r, p):",
"- # nume/deno === nume * pow(deno, p - 2, p) (mod p)",
"- nume, deno = 1, 1",
"- for i in range(r):",
"- nume = nume * (n - i) % p",
"- deno = deno * (i + 1) % p",
"- return nume * pow(deno, p - 2, p) % p",
"+def comb(n, r, p):",
"+ num, den = 1, 1... | false | 0.083548 | 0.083761 | 0.997458 | [
"s855022653",
"s604300188"
] |
u620084012 | p03287 | python | s681647002 | s537819370 | 121 | 91 | 17,624 | 16,552 | Accepted | Accepted | 24.79 | from collections import Counter
N, M = list(map(int,input().split()))
A = list(map(int, input().split()))
ans = 0
S = [0 for k in range(N)]
S[0] = A[0]
for k in range(1,N):
S[k] = S[k-1] + A[k]
S = [0] + S
for k in range(N+1):
S[k] %= M
C = Counter(S)
for a in C:
if C[a] >= 2:
ans ... | import sys
from collections import Counter
def input():
return sys.stdin.readline()[:-1]
def main():
N, M = list(map(int,input().split()))
A = list(map(int,input().split()))
S = [0]*N
S[0] = A[0]%M
for k in range(1,N):
S[k] = (S[k-1] + A[k])%M
C = Counter(S)
C[0] += 1... | 18 | 19 | 347 | 436 | from collections import Counter
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = 0
S = [0 for k in range(N)]
S[0] = A[0]
for k in range(1, N):
S[k] = S[k - 1] + A[k]
S = [0] + S
for k in range(N + 1):
S[k] %= M
C = Counter(S)
for a in C:
if C[a] >= 2:
ans += (C[a] * ... | import sys
from collections import Counter
def input():
return sys.stdin.readline()[:-1]
def main():
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
S = [0] * N
S[0] = A[0] % M
for k in range(1, N):
S[k] = (S[k - 1] + A[k]) % M
C = Counter(S)
C[0] +... | false | 5.263158 | [
"+import sys",
"-N, M = list(map(int, input().split()))",
"-A = list(map(int, input().split()))",
"-ans = 0",
"-S = [0 for k in range(N)]",
"-S[0] = A[0]",
"-for k in range(1, N):",
"- S[k] = S[k - 1] + A[k]",
"-S = [0] + S",
"-for k in range(N + 1):",
"- S[k] %= M",
"-C = Counter(S)",
... | false | 0.061955 | 0.038405 | 1.613191 | [
"s681647002",
"s537819370"
] |
u057109575 | p02803 | python | s959536821 | s693002903 | 244 | 122 | 44,508 | 75,120 | Accepted | Accepted | 50 | from collections import deque
H, W = list(map(int, input().split()))
S = [eval(input()) for _ in range(H)]
def solve(x, y):
offset = [(1, 0), (-1, 0), (0, 1), (0, -1)]
visited = [[-1] * W for _ in range(H)]
visited[y][x] = 0
q = deque()
q.append((x, y))
while q:
x, ... | from collections import deque
H, W = list(map(int, input().split()))
X = [eval(input()) for _ in range(H)]
def solve_maze(s):
bias = [(0, 1), (0, -1), (1, 0), (-1, 0)]
inf = 10 ** 9
d = [[inf] * W for _ in range(H)]
d[s[0]][s[1]] = 0
q = deque()
q.append(s)
while q:
... | 35 | 40 | 839 | 923 | from collections import deque
H, W = list(map(int, input().split()))
S = [eval(input()) for _ in range(H)]
def solve(x, y):
offset = [(1, 0), (-1, 0), (0, 1), (0, -1)]
visited = [[-1] * W for _ in range(H)]
visited[y][x] = 0
q = deque()
q.append((x, y))
while q:
x, y = q.popleft()
... | from collections import deque
H, W = list(map(int, input().split()))
X = [eval(input()) for _ in range(H)]
def solve_maze(s):
bias = [(0, 1), (0, -1), (1, 0), (-1, 0)]
inf = 10**9
d = [[inf] * W for _ in range(H)]
d[s[0]][s[1]] = 0
q = deque()
q.append(s)
while q:
u, v = q.popleft... | false | 12.5 | [
"-S = [eval(input()) for _ in range(H)]",
"+X = [eval(input()) for _ in range(H)]",
"-def solve(x, y):",
"- offset = [(1, 0), (-1, 0), (0, 1), (0, -1)]",
"- visited = [[-1] * W for _ in range(H)]",
"- visited[y][x] = 0",
"+def solve_maze(s):",
"+ bias = [(0, 1), (0, -1), (1, 0), (-1, 0)]",... | false | 0.039114 | 0.039107 | 1.000181 | [
"s959536821",
"s693002903"
] |
u022979415 | p03408 | python | s669143914 | s035232635 | 20 | 18 | 3,064 | 3,064 | Accepted | Accepted | 10 | def get_info(diff):
length = int(eval(input()))
strings = {}
for _ in range(length):
tmp = eval(input())
if tmp in strings:
strings[tmp] += diff
else:
strings[tmp] = diff
return length, strings
def main():
blue_card, blue_card_str = get_... | def main():
n = int(eval(input()))
card = {}
for _ in range(n):
s = eval(input())
if s in card:
card[s] += 1
else:
card[s] = 1
m = int(eval(input()))
for _ in range(m):
t = eval(input())
if t in card:
card[t] -=... | 28 | 23 | 741 | 484 | def get_info(diff):
length = int(eval(input()))
strings = {}
for _ in range(length):
tmp = eval(input())
if tmp in strings:
strings[tmp] += diff
else:
strings[tmp] = diff
return length, strings
def main():
blue_card, blue_card_str = get_info(1)
r... | def main():
n = int(eval(input()))
card = {}
for _ in range(n):
s = eval(input())
if s in card:
card[s] += 1
else:
card[s] = 1
m = int(eval(input()))
for _ in range(m):
t = eval(input())
if t in card:
card[t] -= 1
el... | false | 17.857143 | [
"-def get_info(diff):",
"- length = int(eval(input()))",
"- strings = {}",
"- for _ in range(length):",
"- tmp = eval(input())",
"- if tmp in strings:",
"- strings[tmp] += diff",
"+def main():",
"+ n = int(eval(input()))",
"+ card = {}",
"+ for _ in ran... | false | 0.04692 | 0.046517 | 1.008653 | [
"s669143914",
"s035232635"
] |
u623819879 | p02744 | python | s085511273 | s300658245 | 400 | 358 | 83,420 | 82,524 | Accepted | Accepted | 10.5 | # coding: utf-8
# Your code here!
def solv1():
n=int(eval(input()))
a=[[]for i in range(n)]
a[0]=[[0]]
for i in range(n-1):
b=[]
for pa in a[i]:
# print(pa)
el=[j for j in set(pa)]
# print(el)
el.append(max(pa)+1)
... | # coding: utf-8
# Your code here!
def solv1():
n=int(eval(input()))
a=[[]for i in range(n)]
a[0]=[[0]]
for i in range(n-1):
b=[]
for pa in a[i]:
# print(pa)
el=[j for j in set(pa)]
# print(el)
el.append(max(pa)+1)
... | 26 | 26 | 551 | 552 | # coding: utf-8
# Your code here!
def solv1():
n = int(eval(input()))
a = [[] for i in range(n)]
a[0] = [[0]]
for i in range(n - 1):
b = []
for pa in a[i]:
# print(pa)
el = [j for j in set(pa)]
# print(el)
el.append(max(pa) + ... | # coding: utf-8
# Your code here!
def solv1():
n = int(eval(input()))
a = [[] for i in range(n)]
a[0] = [[0]]
for i in range(n - 1):
b = []
for pa in a[i]:
# print(pa)
el = [j for j in set(pa)]
# print(el)
el.append(max(pa) + ... | false | 0 | [
"- ans = sorted(ans)",
"+ # ans=sorted(ans)"
] | false | 0.15621 | 0.058153 | 2.686191 | [
"s085511273",
"s300658245"
] |
u243572357 | p02811 | python | s809834014 | s662509651 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | k, x = list(map(int, input().split()))
print(('Yes' if k*500 >= x else 'No')) | a, b = list(map(int, input().split()))
print(('Yes' if a*500 >= b else 'No')) | 2 | 2 | 70 | 70 | k, x = list(map(int, input().split()))
print(("Yes" if k * 500 >= x else "No"))
| a, b = list(map(int, input().split()))
print(("Yes" if a * 500 >= b else "No"))
| false | 0 | [
"-k, x = list(map(int, input().split()))",
"-print((\"Yes\" if k * 500 >= x else \"No\"))",
"+a, b = list(map(int, input().split()))",
"+print((\"Yes\" if a * 500 >= b else \"No\"))"
] | false | 0.048068 | 0.051621 | 0.93118 | [
"s809834014",
"s662509651"
] |
u156815136 | p02720 | python | s845199493 | s333644226 | 433 | 104 | 76,380 | 20,128 | Accepted | Accepted | 75.98 | import sys
sys.setrecursionlimit(10**7)
k = int(eval(input()))
from collections import deque
d = deque()
for i in range(9):
d.append(str(i+1)) # 初期
def dfs():
global cnt
a = d.popleft()
#print(cnt)
for i in range(-1,2,1):
nya = a
last_string = int(a[-1]) + 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 # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
# d = m - k[i] -... | 32 | 45 | 624 | 955 | import sys
sys.setrecursionlimit(10**7)
k = int(eval(input()))
from collections import deque
d = deque()
for i in range(9):
d.append(str(i + 1)) # 初期
def dfs():
global cnt
a = d.popleft()
# print(cnt)
for i in range(-1, 2, 1):
nya = a
last_string = int(a[-1]) + i
if last... | 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 # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
# d = m - k[i] - k[j... | false | 28.888889 | [
"+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 # (string,3) 3回",
"+from collections import deque",
"+from collections import defa... | false | 0.079095 | 0.06289 | 1.257686 | [
"s845199493",
"s333644226"
] |
u761320129 | p04020 | python | s859036855 | s858236339 | 211 | 189 | 7,328 | 7,072 | Accepted | Accepted | 10.43 | N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
rem = 0
ans = 0
for a in A:
ans += (rem+a)//2
rem = 0 if a==0 else (rem+a)%2
print(ans) | N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
c = ans = 0
for a in A:
if a==0:
ans += c//2
c = 0
else:
c += a
ans += c//2
print(ans) | 8 | 12 | 156 | 184 | N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
rem = 0
ans = 0
for a in A:
ans += (rem + a) // 2
rem = 0 if a == 0 else (rem + a) % 2
print(ans)
| N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
c = ans = 0
for a in A:
if a == 0:
ans += c // 2
c = 0
else:
c += a
ans += c // 2
print(ans)
| false | 33.333333 | [
"-rem = 0",
"-ans = 0",
"+c = ans = 0",
"- ans += (rem + a) // 2",
"- rem = 0 if a == 0 else (rem + a) % 2",
"+ if a == 0:",
"+ ans += c // 2",
"+ c = 0",
"+ else:",
"+ c += a",
"+ans += c // 2"
] | false | 0.044624 | 0.066047 | 0.67565 | [
"s859036855",
"s858236339"
] |
u726615467 | p02988 | python | s860188454 | s161361394 | 21 | 18 | 3,316 | 3,060 | Accepted | Accepted | 14.29 | # encoding: utf-8
import sys
# input = sys.stdin.readline
N = int(eval(input()))
p = list(map(int, input().split()))
ans = 0
for i in range(N - 2):
pool = [p[i], p[i + 1], p[i + 2]]
if min(pool) == p[i + 1]:
continue
if max(pool) == p[i + 1]:
continue
#
ans += 1
p... | n = int(eval(input()))
p = list(map(int, input().split()))
ans = 0
for i in range(n - 2):
if p[i] <= p[i + 1] < p[i + 2]:
ans += 1
elif p[i + 2] <= p[i + 1] < p[i]:
ans += 1
else:
continue
print(ans)
| 18 | 13 | 323 | 244 | # encoding: utf-8
import sys
# input = sys.stdin.readline
N = int(eval(input()))
p = list(map(int, input().split()))
ans = 0
for i in range(N - 2):
pool = [p[i], p[i + 1], p[i + 2]]
if min(pool) == p[i + 1]:
continue
if max(pool) == p[i + 1]:
continue
#
ans += 1
print(ans)
| n = int(eval(input()))
p = list(map(int, input().split()))
ans = 0
for i in range(n - 2):
if p[i] <= p[i + 1] < p[i + 2]:
ans += 1
elif p[i + 2] <= p[i + 1] < p[i]:
ans += 1
else:
continue
print(ans)
| false | 27.777778 | [
"-# encoding: utf-8",
"-import sys",
"-",
"-# input = sys.stdin.readline",
"-N = int(eval(input()))",
"+n = int(eval(input()))",
"-for i in range(N - 2):",
"- pool = [p[i], p[i + 1], p[i + 2]]",
"- if min(pool) == p[i + 1]:",
"+for i in range(n - 2):",
"+ if p[i] <= p[i + 1] < p[i + 2]:... | false | 0.037166 | 0.036384 | 1.021508 | [
"s860188454",
"s161361394"
] |
u525065967 | p02598 | python | s424345253 | s757844374 | 567 | 502 | 30,796 | 31,000 | Accepted | Accepted | 11.46 | _, k = list(map(int, input().split()))
A = [*list(map(int, input().split()))]
ng, ok = 0, 1<<30
while ok - ng > 1:
m = (ng + ok) // 2
if k < sum([(a-1)//m for a in A]): ng = m
else: ok = m
print(ok)
| _, k = list(map(int, input().split()))
A = [*list(map(int, input().split()))]
ng, ok = 0, 1<<30
while ok - ng > 1:
m = (ng + ok) // 2
if k < sum((a-1)//m for a in A): ng = m
else: ok = m
print(ok)
| 8 | 8 | 211 | 204 | _, k = list(map(int, input().split()))
A = [*list(map(int, input().split()))]
ng, ok = 0, 1 << 30
while ok - ng > 1:
m = (ng + ok) // 2
if k < sum([(a - 1) // m for a in A]):
ng = m
else:
ok = m
print(ok)
| _, k = list(map(int, input().split()))
A = [*list(map(int, input().split()))]
ng, ok = 0, 1 << 30
while ok - ng > 1:
m = (ng + ok) // 2
if k < sum((a - 1) // m for a in A):
ng = m
else:
ok = m
print(ok)
| false | 0 | [
"- if k < sum([(a - 1) // m for a in A]):",
"+ if k < sum((a - 1) // m for a in A):"
] | false | 0.046684 | 0.040071 | 1.165028 | [
"s424345253",
"s757844374"
] |
u312025627 | p02863 | python | s619201480 | s541124956 | 521 | 289 | 211,940 | 145,672 | Accepted | Accepted | 44.53 | def main():
N, T = (int(i) for i in input().split())
AB = [[int(i) for i in input().split()] for j in range(N)]
A = [a[0] for a in AB]
B = [b[1] for b in AB]
dp1 = [[0]*(T+1) for _ in range(N+1)]
for i in range(N):
for j in range(T):
t = j - A[i]
if 0 <... | def main():
N, T = (int(i) for i in input().split())
AB = [[int(i) for i in input().split()] for j in range(N)]
AB.sort()
ans = 0
dp1 = [[0]*(T+1) for _ in range(N+1)]
for i in range(N):
for j in range(T):
t = j - AB[i][0]
if 0 <= t:
dp... | 31 | 20 | 928 | 537 | def main():
N, T = (int(i) for i in input().split())
AB = [[int(i) for i in input().split()] for j in range(N)]
A = [a[0] for a in AB]
B = [b[1] for b in AB]
dp1 = [[0] * (T + 1) for _ in range(N + 1)]
for i in range(N):
for j in range(T):
t = j - A[i]
if 0 <= t:
... | def main():
N, T = (int(i) for i in input().split())
AB = [[int(i) for i in input().split()] for j in range(N)]
AB.sort()
ans = 0
dp1 = [[0] * (T + 1) for _ in range(N + 1)]
for i in range(N):
for j in range(T):
t = j - AB[i][0]
if 0 <= t:
dp1[i + ... | false | 35.483871 | [
"- A = [a[0] for a in AB]",
"- B = [b[1] for b in AB]",
"+ AB.sort()",
"+ ans = 0",
"- t = j - A[i]",
"+ t = j - AB[i][0]",
"- dp1[i + 1][j] = max(dp1[i][j], dp1[i][t] + B[i])",
"+ dp1[i + 1][j] = max(dp1[i][j], dp1[i][t] + AB[i][1])",
... | false | 0.052521 | 0.074484 | 0.705141 | [
"s619201480",
"s541124956"
] |
u597455618 | p02572 | python | s230972757 | s679227055 | 165 | 149 | 29,316 | 29,124 | Accepted | Accepted | 9.7 | import sys
from itertools import accumulate
n = int(sys.stdin.buffer.readline())
a = list(map(int, sys.stdin.buffer.readline().split()))
aa = list(accumulate(a))
MOD = 10**9+7
ans = 0
for i in range(n):
ans += a[i]*(aa[n-1] - aa[i]) % MOD
ans %= MOD
print(ans)
| import sys
from itertools import accumulate
n = int(sys.stdin.buffer.readline())
a = list(map(int, sys.stdin.buffer.readline().split()))
aa = list(accumulate(a))
MOD = 10**9+7
ans = 0
for i in range(n):
ans += a[i]*(aa[n-1] - aa[i]) % MOD
print((ans%MOD))
| 11 | 10 | 279 | 267 | import sys
from itertools import accumulate
n = int(sys.stdin.buffer.readline())
a = list(map(int, sys.stdin.buffer.readline().split()))
aa = list(accumulate(a))
MOD = 10**9 + 7
ans = 0
for i in range(n):
ans += a[i] * (aa[n - 1] - aa[i]) % MOD
ans %= MOD
print(ans)
| import sys
from itertools import accumulate
n = int(sys.stdin.buffer.readline())
a = list(map(int, sys.stdin.buffer.readline().split()))
aa = list(accumulate(a))
MOD = 10**9 + 7
ans = 0
for i in range(n):
ans += a[i] * (aa[n - 1] - aa[i]) % MOD
print((ans % MOD))
| false | 9.090909 | [
"- ans %= MOD",
"-print(ans)",
"+print((ans % MOD))"
] | false | 0.038999 | 0.036135 | 1.07926 | [
"s230972757",
"s679227055"
] |
u562935282 | p02972 | python | s028489706 | s921825339 | 268 | 165 | 13,224 | 12,724 | Accepted | Accepted | 38.43 | # https://atcoder.jp/contests/abc134/submissions/7469219
def main():
from functools import reduce
from operator import xor
N = int(input())
a = [0]
a += map(int, input().split())
for x in reversed(range(1, N // 2 + 1)):
a[x] = reduce(xor, a[x::x])
ans = [i for i, x... | # https://atcoder.jp/contests/abc134/submissions/7469219
def main():
N = int(input())
a = [0]
a += map(int, input().split())
for x in reversed(range(1, N // 2 + 1)):
a[x] = sum(a[x::x]) & 1
ans = [i for i, x in enumerate(a) if x]
print(len(ans))
print(*ans, sep='\n')... | 38 | 35 | 784 | 714 | # https://atcoder.jp/contests/abc134/submissions/7469219
def main():
from functools import reduce
from operator import xor
N = int(input())
a = [0]
a += map(int, input().split())
for x in reversed(range(1, N // 2 + 1)):
a[x] = reduce(xor, a[x::x])
ans = [i for i, x in enumerate(a) i... | # https://atcoder.jp/contests/abc134/submissions/7469219
def main():
N = int(input())
a = [0]
a += map(int, input().split())
for x in reversed(range(1, N // 2 + 1)):
a[x] = sum(a[x::x]) & 1
ans = [i for i, x in enumerate(a) if x]
print(len(ans))
print(*ans, sep="\n")
if __name__ ==... | false | 7.894737 | [
"- from functools import reduce",
"- from operator import xor",
"-",
"- a[x] = reduce(xor, a[x::x])",
"+ a[x] = sum(a[x::x]) & 1"
] | false | 0.042441 | 0.045645 | 0.9298 | [
"s028489706",
"s921825339"
] |
u392319141 | p03262 | python | s527150309 | s265397275 | 151 | 95 | 14,252 | 14,252 | Accepted | Accepted | 37.09 | N, X = list(map(int, input().split()))
axis = list(map(int, input().split()))
ans = abs(axis[0] - X)
def gcd(n, m) :
n, m = max(n, m), min(n, m)
if m == 0 :
return n
return gcd(m, n % m)
for a in axis :
ans = gcd(ans, abs(a - X))
print(ans) | N, X = list(map(int, input().split()))
A = [X] + list(map(int, input().split()))
def gcd(n, m):
if m == 0:
return n
return gcd(m, n % m)
B = [abs(a - A[0]) for a in A]
ans = 0
for d in B:
ans = gcd(ans, d)
print(ans)
| 15 | 13 | 276 | 245 | N, X = list(map(int, input().split()))
axis = list(map(int, input().split()))
ans = abs(axis[0] - X)
def gcd(n, m):
n, m = max(n, m), min(n, m)
if m == 0:
return n
return gcd(m, n % m)
for a in axis:
ans = gcd(ans, abs(a - X))
print(ans)
| N, X = list(map(int, input().split()))
A = [X] + list(map(int, input().split()))
def gcd(n, m):
if m == 0:
return n
return gcd(m, n % m)
B = [abs(a - A[0]) for a in A]
ans = 0
for d in B:
ans = gcd(ans, d)
print(ans)
| false | 13.333333 | [
"-axis = list(map(int, input().split()))",
"-ans = abs(axis[0] - X)",
"+A = [X] + list(map(int, input().split()))",
"- n, m = max(n, m), min(n, m)",
"-for a in axis:",
"- ans = gcd(ans, abs(a - X))",
"+B = [abs(a - A[0]) for a in A]",
"+ans = 0",
"+for d in B:",
"+ ans = gcd(ans, d)"
] | false | 0.0435 | 0.042535 | 1.022697 | [
"s527150309",
"s265397275"
] |
u648868410 | p02599 | python | s097532746 | s852197286 | 1,822 | 1,358 | 160,236 | 85,824 | Accepted | Accepted | 25.47 | import sys
import numpy as np
from numba import njit#,i8
def input(): return sys.stdin.readline()
N,Q = list(map(int,input().split()))
C=np.array(input().split(), int)
# Query取得-rightでソート
# dtypeQuery = [("index", int), ("start", int), ("end", int)]
queries=np.empty((Q,2),int)
# #rights=[[] for _ in ... | import sys
import numpy as np
# from numba import njit#,i8
#@njit(cache=True)
# @jit(返り値の型(引数1の型,引数2の型,...,引数nの型))
#@jit(i8[:](i8,i8,i8[:],i8[:,:],i8[:],i8[:],i8[:]))
def main(N,Q,C,queries,orderByR,mostRightColorIndex,bitArray):
def add(itemCount, items, i, value):
while i <= itemCount:
items[i] += ... | 90 | 99 | 2,212 | 2,435 | import sys
import numpy as np
from numba import njit # ,i8
def input():
return sys.stdin.readline()
N, Q = list(map(int, input().split()))
C = np.array(input().split(), int)
# Query取得-rightでソート
# dtypeQuery = [("index", int), ("start", int), ("end", int)]
queries = np.empty((Q, 2), int)
# #rights=[[] for _ in ... | import sys
import numpy as np
# from numba import njit#,i8
# @njit(cache=True)
# @jit(返り値の型(引数1の型,引数2の型,...,引数nの型))
# @jit(i8[:](i8,i8,i8[:],i8[:,:],i8[:],i8[:],i8[:]))
def main(N, Q, C, queries, orderByR, mostRightColorIndex, bitArray):
def add(itemCount, items, i, value):
while i <= itemCount:
... | false | 9.090909 | [
"-from numba import njit # ,i8",
"-",
"-def input():",
"- return sys.stdin.readline()",
"-",
"-",
"-N, Q = list(map(int, input().split()))",
"-C = np.array(input().split(), int)",
"-# Query取得-rightでソート",
"-# dtypeQuery = [(\"index\", int), (\"start\", int), (\"end\", int)]",
"-queries = np.e... | false | 0.006946 | 0.684677 | 0.010145 | [
"s097532746",
"s852197286"
] |
u753803401 | p03005 | python | s532517073 | s023828473 | 189 | 164 | 38,256 | 38,256 | Accepted | Accepted | 13.23 | def slove():
import sys
input = sys.stdin.readline
n, k = list(map(int, input().rstrip('\n').split()))
if k == 1:
print((0))
else:
print((n - k))
if __name__ == '__main__':
slove()
| import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
n, k = list(map(int, readline().split()))
if k == 1:
print((0))
elif n < k:
print((1))
else:
print((n - k))
if __name__ == '__main__':
solve()
| 12 | 17 | 230 | 288 | def slove():
import sys
input = sys.stdin.readline
n, k = list(map(int, input().rstrip("\n").split()))
if k == 1:
print((0))
else:
print((n - k))
if __name__ == "__main__":
slove()
| import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10**9 + 7
n, k = list(map(int, readline().split()))
if k == 1:
print((0))
elif n < k:
print((1))
else:
print((n - k))
if __name__ == "__main__":
solve()
| false | 29.411765 | [
"-def slove():",
"- import sys",
"+import sys",
"- input = sys.stdin.readline",
"- n, k = list(map(int, input().rstrip(\"\\n\").split()))",
"+",
"+def solve():",
"+ readline = sys.stdin.buffer.readline",
"+ mod = 10**9 + 7",
"+ n, k = list(map(int, readline().split()))",
"+ ... | false | 0.042886 | 0.084097 | 0.509958 | [
"s532517073",
"s023828473"
] |
u075595666 | p03476 | python | s067141505 | s764896079 | 526 | 483 | 5,520 | 5,536 | Accepted | Accepted | 8.17 | def is_prime(q):
if q == 2: return True
if q < 2 or q&1 == 0: return False
return pow(5, q-1, q)*pow(7, q-1, q) == 1
s = [561, 11041, 29341, 38081, 46657, 50737, 75361, 79381, 88831]
b = [5,7]
for i in range(2,10**5):
if i in s:
continue
if is_prime(i):
b.append(i)
a = set([2*... | def is_prime(q):
if q == 2: return True
if q < 2 or q&1 == 0: return False
return pow(5, q-1, q)*pow(7, q-1, q) == 1
def main():
s = set([561, 11041, 29341, 38081, 46657, 50737, 75361, 79381, 88831])
b = [5,7]
for i in range(2,10**5):
if i in s:
continue
if is_prime(i):
... | 25 | 29 | 573 | 668 | def is_prime(q):
if q == 2:
return True
if q < 2 or q & 1 == 0:
return False
return pow(5, q - 1, q) * pow(7, q - 1, q) == 1
s = [561, 11041, 29341, 38081, 46657, 50737, 75361, 79381, 88831]
b = [5, 7]
for i in range(2, 10**5):
if i in s:
continue
if is_prime(i):
b.... | def is_prime(q):
if q == 2:
return True
if q < 2 or q & 1 == 0:
return False
return pow(5, q - 1, q) * pow(7, q - 1, q) == 1
def main():
s = set([561, 11041, 29341, 38081, 46657, 50737, 75361, 79381, 88831])
b = [5, 7]
for i in range(2, 10**5):
if i in s:
co... | false | 13.793103 | [
"-s = [561, 11041, 29341, 38081, 46657, 50737, 75361, 79381, 88831]",
"-b = [5, 7]",
"-for i in range(2, 10**5):",
"- if i in s:",
"- continue",
"- if is_prime(i):",
"- b.append(i)",
"-a = set([2 * i - 1 for i in b])",
"-b = set(b)",
"-chk = sorted(list(a & b))",
"-from bisec... | false | 0.7379 | 0.331648 | 2.224948 | [
"s067141505",
"s764896079"
] |
u077291787 | p03618 | python | s574322837 | s849996787 | 31 | 22 | 3,872 | 3,500 | Accepted | Accepted | 29.03 | # AGC019B - Reverse and Compare
from collections import Counter
def main():
S = input().rstrip()
C, N = list(Counter(S).values()), len(S)
ans = N * (N - 1) // 2 + 1 # all possible patterns
ans -= sum(i * (i - 1) // 2 for i in C) # duplicates
print(ans)
if __name__ == "__main__":
... | # AGC019B - Reverse and Compare
def main():
S = input().rstrip()
N = len(S)
ans = N * (N - 1) // 2 + 1 # all possible patterns
abc = "abcdefghijklmnopqrstuvwxyz"
for a in abc:
x = S.count(a)
ans -= x * (x - 1) // 2 # exclude duplicates
print(ans)
if __name__ == "_... | 14 | 14 | 323 | 341 | # AGC019B - Reverse and Compare
from collections import Counter
def main():
S = input().rstrip()
C, N = list(Counter(S).values()), len(S)
ans = N * (N - 1) // 2 + 1 # all possible patterns
ans -= sum(i * (i - 1) // 2 for i in C) # duplicates
print(ans)
if __name__ == "__main__":
main()
| # AGC019B - Reverse and Compare
def main():
S = input().rstrip()
N = len(S)
ans = N * (N - 1) // 2 + 1 # all possible patterns
abc = "abcdefghijklmnopqrstuvwxyz"
for a in abc:
x = S.count(a)
ans -= x * (x - 1) // 2 # exclude duplicates
print(ans)
if __name__ == "__main__":
... | false | 0 | [
"-from collections import Counter",
"-",
"-",
"- C, N = list(Counter(S).values()), len(S)",
"+ N = len(S)",
"- ans -= sum(i * (i - 1) // 2 for i in C) # duplicates",
"+ abc = \"abcdefghijklmnopqrstuvwxyz\"",
"+ for a in abc:",
"+ x = S.count(a)",
"+ ans -= x * (x - 1)... | false | 0.059774 | 0.035839 | 1.66785 | [
"s574322837",
"s849996787"
] |
u539367121 | p02695 | python | s478201918 | s117245922 | 1,140 | 942 | 9,160 | 9,176 | Accepted | Accepted | 17.37 | import itertools
N, M, Q = list(map(int, input().split()))
ABCD = [[int(x) for x in input().split()] for i in range(Q)]
ans=0
for A in itertools.combinations_with_replacement([m for m in range(1,M+1)], N):
ans2=0
for (a,b,c,d) in ABCD:
if A[b-1]-A[a-1]==c:
ans2+=d
ans=max(ans, ans2)
print(... | import itertools
N, M, Q = list(map(int, input().split()))
ABCD = [[int(x) for x in input().split()] for i in range(Q)]
ans=0
t=[m for m in range(1,M+1)]
for A in itertools.combinations_with_replacement(t, N):
ans2=0
for (a,b,c,d) in ABCD:
if A[b-1]-A[a-1]==c:
ans2+=d
ans=max(ans, ans2)
p... | 13 | 14 | 319 | 324 | import itertools
N, M, Q = list(map(int, input().split()))
ABCD = [[int(x) for x in input().split()] for i in range(Q)]
ans = 0
for A in itertools.combinations_with_replacement([m for m in range(1, M + 1)], N):
ans2 = 0
for (a, b, c, d) in ABCD:
if A[b - 1] - A[a - 1] == c:
ans2 += d
an... | import itertools
N, M, Q = list(map(int, input().split()))
ABCD = [[int(x) for x in input().split()] for i in range(Q)]
ans = 0
t = [m for m in range(1, M + 1)]
for A in itertools.combinations_with_replacement(t, N):
ans2 = 0
for (a, b, c, d) in ABCD:
if A[b - 1] - A[a - 1] == c:
ans2 += d
... | false | 7.142857 | [
"-for A in itertools.combinations_with_replacement([m for m in range(1, M + 1)], N):",
"+t = [m for m in range(1, M + 1)]",
"+for A in itertools.combinations_with_replacement(t, N):"
] | false | 0.058362 | 0.208683 | 0.27967 | [
"s478201918",
"s117245922"
] |
u694665829 | p03476 | python | s463526636 | s944238063 | 528 | 480 | 13,516 | 13,564 | Accepted | Accepted | 9.09 | dp = [1]*(10**5+1) #エラトステネスの篩
dp[0],dp[1] = 0, 0
for i in range(2, 10**5+1):
if dp[i] == 0:
continue
j = i
while j + i <= 10**5:
j += i
if dp[j] == 1:
dp[j] = 0
ni = [0]*(10**5+1) #2012_like check
for i in range(2, 10**5+1):
if dp[i] == 1 and dp[(i+1)//2... | def f():
dp = [1]*(10**5+1) #エラトステネスの篩
dp[0],dp[1] = 0, 0
for i in range(2, 10**5+1):
if dp[i] == 0:
continue
j = i
while j + i <= 10**5:
j += i
if dp[j] == 1:
dp[j] = 0
ni = [0]*(10**5+1) #2012_like check
... | 24 | 28 | 531 | 680 | dp = [1] * (10**5 + 1) # エラトステネスの篩
dp[0], dp[1] = 0, 0
for i in range(2, 10**5 + 1):
if dp[i] == 0:
continue
j = i
while j + i <= 10**5:
j += i
if dp[j] == 1:
dp[j] = 0
ni = [0] * (10**5 + 1) # 2012_like check
for i in range(2, 10**5 + 1):
if dp[i] == 1 and dp[(i + ... | def f():
dp = [1] * (10**5 + 1) # エラトステネスの篩
dp[0], dp[1] = 0, 0
for i in range(2, 10**5 + 1):
if dp[i] == 0:
continue
j = i
while j + i <= 10**5:
j += i
if dp[j] == 1:
dp[j] = 0
ni = [0] * (10**5 + 1) # 2012_like check
for... | false | 14.285714 | [
"-dp = [1] * (10**5 + 1) # エラトステネスの篩",
"-dp[0], dp[1] = 0, 0",
"-for i in range(2, 10**5 + 1):",
"- if dp[i] == 0:",
"- continue",
"- j = i",
"- while j + i <= 10**5:",
"- j += i",
"- if dp[j] == 1:",
"- dp[j] = 0",
"-ni = [0] * (10**5 + 1) # 2012_like ... | false | 0.289886 | 0.283588 | 1.02221 | [
"s463526636",
"s944238063"
] |
u921632705 | p03485 | python | s249988539 | s835311259 | 31 | 28 | 9,156 | 9,100 | Accepted | Accepted | 9.68 | x,y = list(map(int, input().split()))
z =x+y
import math
print((math.ceil(z/2))) | x,y = list(map(int, input().split()))
import math
print((math.ceil((x+y)/2))) | 4 | 3 | 75 | 71 | x, y = list(map(int, input().split()))
z = x + y
import math
print((math.ceil(z / 2)))
| x, y = list(map(int, input().split()))
import math
print((math.ceil((x + y) / 2)))
| false | 25 | [
"-z = x + y",
"-print((math.ceil(z / 2)))",
"+print((math.ceil((x + y) / 2)))"
] | false | 0.039043 | 0.039374 | 0.991598 | [
"s249988539",
"s835311259"
] |
u627803856 | p03212 | python | s615456870 | s335458012 | 226 | 117 | 43,228 | 76,128 | Accepted | Accepted | 48.23 | n = int(eval(input()))
def dfs(val, A):
if val > n:
return
A.append(val)
dfs(10 * val + 3, A)
dfs(10 * val + 5, A)
dfs(10 * val + 7, A)
A = []
dfs(3, A)
dfs(5, A)
dfs(7, A)
cnt = 0
for v in A:
if len(set(list(str(v)))) == 3:
cnt += 1
print(cnt) | # 7/3
# n 以下の「753数」の個数
n = int(eval(input()))
def dfs(val):
# 終了条件
if val > n:
return
A.append(val)
for v in [3, 5, 7]:
val = A.pop()
dfs(10 * val + v)
A.append(val)
A = []
for v in [3, 5, 7]:
dfs(v)
res = 0
for v in A:
s = str(v)
... | 20 | 29 | 300 | 387 | n = int(eval(input()))
def dfs(val, A):
if val > n:
return
A.append(val)
dfs(10 * val + 3, A)
dfs(10 * val + 5, A)
dfs(10 * val + 7, A)
A = []
dfs(3, A)
dfs(5, A)
dfs(7, A)
cnt = 0
for v in A:
if len(set(list(str(v)))) == 3:
cnt += 1
print(cnt)
| # 7/3
# n 以下の「753数」の個数
n = int(eval(input()))
def dfs(val):
# 終了条件
if val > n:
return
A.append(val)
for v in [3, 5, 7]:
val = A.pop()
dfs(10 * val + v)
A.append(val)
A = []
for v in [3, 5, 7]:
dfs(v)
res = 0
for v in A:
s = str(v)
if "3" in s and "5" in s ... | false | 31.034483 | [
"+# 7/3",
"+# n 以下の「753数」の個数",
"-def dfs(val, A):",
"+def dfs(val):",
"+ # 終了条件",
"- dfs(10 * val + 3, A)",
"- dfs(10 * val + 5, A)",
"- dfs(10 * val + 7, A)",
"+ for v in [3, 5, 7]:",
"+ val = A.pop()",
"+ dfs(10 * val + v)",
"+ A.append(val)",
"-dfs(3, A... | false | 0.056524 | 0.057246 | 0.987387 | [
"s615456870",
"s335458012"
] |
u313111801 | p03243 | python | s203716441 | s775875294 | 30 | 25 | 9,028 | 9,096 | Accepted | Accepted | 16.67 | def ok(n):
v=n%10
ret=True
while n>0:
ret&=n%10==v
n//=10
return ret
N=int(eval(input()))
while not(ok(N)):
N+=1
print(N) | n=int(eval(input()))
ans=0
while ans<n:
ans+=111
print(ans) | 12 | 5 | 163 | 61 | def ok(n):
v = n % 10
ret = True
while n > 0:
ret &= n % 10 == v
n //= 10
return ret
N = int(eval(input()))
while not (ok(N)):
N += 1
print(N)
| n = int(eval(input()))
ans = 0
while ans < n:
ans += 111
print(ans)
| false | 58.333333 | [
"-def ok(n):",
"- v = n % 10",
"- ret = True",
"- while n > 0:",
"- ret &= n % 10 == v",
"- n //= 10",
"- return ret",
"-",
"-",
"-N = int(eval(input()))",
"-while not (ok(N)):",
"- N += 1",
"-print(N)",
"+n = int(eval(input()))",
"+ans = 0",
"+while ans < ... | false | 0.044413 | 0.043435 | 1.022517 | [
"s203716441",
"s775875294"
] |
u676247559 | p02639 | python | s399223100 | s483358542 | 30 | 26 | 8,924 | 9,024 | Accepted | Accepted | 13.33 | l = list(map(int,input().split()))
xr = 0
for i in range(1,6):
xr ^= i
for i in l:
xr ^= i
print(xr) | l = list(map(int,input().split()))
xr = 0
for i in range(5):
xr ^= (i+1)
xr ^= l[i]
print(xr)
| 7 | 6 | 110 | 103 | l = list(map(int, input().split()))
xr = 0
for i in range(1, 6):
xr ^= i
for i in l:
xr ^= i
print(xr)
| l = list(map(int, input().split()))
xr = 0
for i in range(5):
xr ^= i + 1
xr ^= l[i]
print(xr)
| false | 14.285714 | [
"-for i in range(1, 6):",
"- xr ^= i",
"-for i in l:",
"- xr ^= i",
"+for i in range(5):",
"+ xr ^= i + 1",
"+ xr ^= l[i]"
] | false | 0.048047 | 0.049422 | 0.972191 | [
"s399223100",
"s483358542"
] |
u729133443 | p02990 | python | s159783611 | s182582947 | 76 | 20 | 27,760 | 3,316 | Accepted | Accepted | 73.68 | n,k=list(map(int,input().split()));p=n-k+1;i=0;exec('print(p%(10**9+7));i+=1;p=p*(k-i)*(n-k+1-i)//i//-~i;'*k) | n,k=list(map(int,input().split()))
p=n-k+1
i=0
while i<k:print((p%(10**9+7)));i+=1;p=p*(k-i)*(n-k+1-i)//i//-~i | 1 | 4 | 103 | 105 | n, k = list(map(int, input().split()))
p = n - k + 1
i = 0
exec("print(p%(10**9+7));i+=1;p=p*(k-i)*(n-k+1-i)//i//-~i;" * k)
| n, k = list(map(int, input().split()))
p = n - k + 1
i = 0
while i < k:
print((p % (10**9 + 7)))
i += 1
p = p * (k - i) * (n - k + 1 - i) // i // -~i
| false | 75 | [
"-exec(\"print(p%(10**9+7));i+=1;p=p*(k-i)*(n-k+1-i)//i//-~i;\" * k)",
"+while i < k:",
"+ print((p % (10**9 + 7)))",
"+ i += 1",
"+ p = p * (k - i) * (n - k + 1 - i) // i // -~i"
] | false | 0.034824 | 0.04103 | 0.848744 | [
"s159783611",
"s182582947"
] |
u094999522 | p02642 | python | s990881595 | s549056351 | 298 | 173 | 33,344 | 121,656 | Accepted | Accepted | 41.95 | _,*a = list(map(int, open(0).read().split()))
a.sort()
m = -~a[-1]
c = [0]*m
for i in a:
c[i] += 1
if c[i] > 1:
continue
for j in range(i * 2, m, i):
c[j] = 2
print((sum(c[i]==1for i in a))) | #!/usr/bin/env python3
_, *a = list(map(int, open(0).read().split()))
a.sort()
p = [0] * a[-1]
for i in a:
for j in range(1, a[-1] // i + 1):
p[j * i - 1] += j
print((sum(i == 1 for i in p)))
| 11 | 8 | 220 | 203 | _, *a = list(map(int, open(0).read().split()))
a.sort()
m = -~a[-1]
c = [0] * m
for i in a:
c[i] += 1
if c[i] > 1:
continue
for j in range(i * 2, m, i):
c[j] = 2
print((sum(c[i] == 1 for i in a)))
| #!/usr/bin/env python3
_, *a = list(map(int, open(0).read().split()))
a.sort()
p = [0] * a[-1]
for i in a:
for j in range(1, a[-1] // i + 1):
p[j * i - 1] += j
print((sum(i == 1 for i in p)))
| false | 27.272727 | [
"+#!/usr/bin/env python3",
"-m = -~a[-1]",
"-c = [0] * m",
"+p = [0] * a[-1]",
"- c[i] += 1",
"- if c[i] > 1:",
"- continue",
"- for j in range(i * 2, m, i):",
"- c[j] = 2",
"-print((sum(c[i] == 1 for i in a)))",
"+ for j in range(1, a[-1] // i + 1):",
"+ p[j *... | false | 0.043466 | 0.043396 | 1.001617 | [
"s990881595",
"s549056351"
] |
u987164499 | p02971 | python | s052262854 | s339167206 | 572 | 373 | 12,528 | 14,120 | Accepted | Accepted | 34.79 | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
a_m = max(a)
a_i = a.index(a_m)
a.sort()
for i in range(len(a)):
if i == a_i:
print((a[-2]))
else:
print(a_m) | from sys import stdin
n = int(stdin.readline().rstrip())
li = list(int(stdin.readline().rstrip()) for _ in range(n))
li_to = sorted(li)
one = li_to[-1]
two = li_to[-2]
for i in range(n):
if one == li[i]:
print(two)
else:
print(one) | 10 | 11 | 182 | 265 | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
a_m = max(a)
a_i = a.index(a_m)
a.sort()
for i in range(len(a)):
if i == a_i:
print((a[-2]))
else:
print(a_m)
| from sys import stdin
n = int(stdin.readline().rstrip())
li = list(int(stdin.readline().rstrip()) for _ in range(n))
li_to = sorted(li)
one = li_to[-1]
two = li_to[-2]
for i in range(n):
if one == li[i]:
print(two)
else:
print(one)
| false | 9.090909 | [
"-n = int(eval(input()))",
"-a = [int(eval(input())) for _ in range(n)]",
"-a_m = max(a)",
"-a_i = a.index(a_m)",
"-a.sort()",
"-for i in range(len(a)):",
"- if i == a_i:",
"- print((a[-2]))",
"+from sys import stdin",
"+",
"+n = int(stdin.readline().rstrip())",
"+li = list(int(stdin... | false | 0.04213 | 0.036502 | 1.154176 | [
"s052262854",
"s339167206"
] |
u793868662 | p03672 | python | s120207821 | s806351063 | 191 | 175 | 38,256 | 38,384 | Accepted | Accepted | 8.38 | def resolve():
s = eval(input())
l = len(s)
for i in range(2, l, 2):
test = s[0:(l-i)]
t = len(test)
if test[0:(t//2)] == test[(t//2):t]:
print((len(test)))
exit()
resolve() | def resolve():
s = eval(input())
for i in range(2, len(s), 2):
test = s[:len(s)-i]
if test[:len(test)//2] == test[len(test)//2:]:
print((len(test)))
exit()
resolve() | 10 | 9 | 234 | 214 | def resolve():
s = eval(input())
l = len(s)
for i in range(2, l, 2):
test = s[0 : (l - i)]
t = len(test)
if test[0 : (t // 2)] == test[(t // 2) : t]:
print((len(test)))
exit()
resolve()
| def resolve():
s = eval(input())
for i in range(2, len(s), 2):
test = s[: len(s) - i]
if test[: len(test) // 2] == test[len(test) // 2 :]:
print((len(test)))
exit()
resolve()
| false | 10 | [
"- l = len(s)",
"- for i in range(2, l, 2):",
"- test = s[0 : (l - i)]",
"- t = len(test)",
"- if test[0 : (t // 2)] == test[(t // 2) : t]:",
"+ for i in range(2, len(s), 2):",
"+ test = s[: len(s) - i]",
"+ if test[: len(test) // 2] == test[len(test) // 2 :... | false | 0.035993 | 0.03638 | 0.989372 | [
"s120207821",
"s806351063"
] |
u860002137 | p03050 | python | s940708770 | s703032183 | 186 | 166 | 3,528 | 9,292 | Accepted | Accepted | 10.75 | n = int(eval(input()))
def make_divisors(n):
lower_divisors, upper_divisors = [], []
i = 1
while i*i <= n:
if n % i == 0:
lower_divisors.append(i)
if i != n // i:
upper_divisors.append(n//i)
i += 1
return lower_divisors + upper_diviso... | n = int(eval(input()))
def make_divisors(n):
lower_divisors, upper_divisors = [], []
i = 1
while i*i <= n:
if n % i == 0:
lower_divisors.append(i)
if i != n // i:
upper_divisors.append(n//i)
i += 1
return lower_divisors + upper_diviso... | 32 | 27 | 570 | 527 | n = int(eval(input()))
def make_divisors(n):
lower_divisors, upper_divisors = [], []
i = 1
while i * i <= n:
if n % i == 0:
lower_divisors.append(i)
if i != n // i:
upper_divisors.append(n // i)
i += 1
return lower_divisors + upper_divisors[::-1]... | n = int(eval(input()))
def make_divisors(n):
lower_divisors, upper_divisors = [], []
i = 1
while i * i <= n:
if n % i == 0:
lower_divisors.append(i)
if i != n // i:
upper_divisors.append(n // i)
i += 1
return lower_divisors + upper_divisors[::-1]... | false | 15.625 | [
"-def is_favorite(n, m):",
"- if x == 0:",
"- return False",
"- else:",
"- return n // m == n % m",
"-",
"-",
"-li = make_divisors(n)",
"-li = [x - 1 for x in li]",
"+# 約数から1引いたものが候補",
"+arr = make_divisors(n)",
"+arr = [x - 1 for x in arr if x >= 2]",
"+# 商と剰余が不一致ならbrea... | false | 0.300972 | 0.296402 | 1.01542 | [
"s940708770",
"s703032183"
] |
u860657719 | p02727 | python | s775215802 | s422587025 | 283 | 249 | 23,340 | 22,592 | Accepted | Accepted | 12.01 | X,Y,A,B,C = list(map(int, input().split()))
p = [int(x) for x in input().split()]
q = [int(x) for x in input().split()]
r = [int(x) for x in input().split()]
p.sort(reverse = True)
q.sort(reverse = True)
r.sort(reverse = True)
newp = p[:X]
newq = q[:Y]
lis = newp + newq
lis.sort(reverse = True)
s = sum(lis)
... | #X,Y,A,B,C = map(int, input().split())
#p = [int(x) for x in input().split()]
#q = [int(x) for x in input().split()]
#r = [int(x) for x in input().split()]
#p.sort(reverse = True)
#q.sort(reverse = True)
#r.sort(reverse = True)
#newp = p[:X]
#newq = q[:Y]
#lis = newp + newq
#lis.sort(reverse = True)
#s = sum... | 18 | 30 | 435 | 743 | X, Y, A, B, C = list(map(int, input().split()))
p = [int(x) for x in input().split()]
q = [int(x) for x in input().split()]
r = [int(x) for x in input().split()]
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
newp = p[:X]
newq = q[:Y]
lis = newp + newq
lis.sort(reverse=True)
s = sum(lis)
for i in range(... | # X,Y,A,B,C = map(int, input().split())
# p = [int(x) for x in input().split()]
# q = [int(x) for x in input().split()]
# r = [int(x) for x in input().split()]
# p.sort(reverse = True)
# q.sort(reverse = True)
# r.sort(reverse = True)
# newp = p[:X]
# newq = q[:Y]
# lis = newp + newq
# lis.sort(reverse = True)
# s = su... | false | 40 | [
"+# X,Y,A,B,C = map(int, input().split())",
"+# p = [int(x) for x in input().split()]",
"+# q = [int(x) for x in input().split()]",
"+# r = [int(x) for x in input().split()]",
"+# p.sort(reverse = True)",
"+# q.sort(reverse = True)",
"+# r.sort(reverse = True)",
"+# newp = p[:X]",
"+# newq = q[:Y]",... | false | 0.038025 | 0.083133 | 0.4574 | [
"s775215802",
"s422587025"
] |
u684120680 | p02936 | python | s230172850 | s848130262 | 1,978 | 1,103 | 123,180 | 92,156 | Accepted | Accepted | 44.24 | from collections import deque
n, q = [int(i) for i in input().split()]
ab = [[int(i) for i in input().split()] for _ in range(n-1)]
px = [[int(i) for i in input().split()] for _ in range(q)]
tree = [[] for _ in range(n+1)]
for a, b in ab:
tree[a].append(b)
tree[b].append(a)
counter = [0] * (n+1)
... | from collections import deque
import sys
s = sys.stdin.readlines()
n, q = list(map(int, s[0].split()))
tree = [[] for _ in range(n+1)]
for ab in s[1:n]:
a, b = list(map(int, ab.split()))
tree[a].append(b)
tree[b].append(a)
counter = [0] * (n+1)
for px in s[n:]:
p, x = list(map(int, px.s... | 26 | 28 | 647 | 622 | from collections import deque
n, q = [int(i) for i in input().split()]
ab = [[int(i) for i in input().split()] for _ in range(n - 1)]
px = [[int(i) for i in input().split()] for _ in range(q)]
tree = [[] for _ in range(n + 1)]
for a, b in ab:
tree[a].append(b)
tree[b].append(a)
counter = [0] * (n + 1)
for p, x... | from collections import deque
import sys
s = sys.stdin.readlines()
n, q = list(map(int, s[0].split()))
tree = [[] for _ in range(n + 1)]
for ab in s[1:n]:
a, b = list(map(int, ab.split()))
tree[a].append(b)
tree[b].append(a)
counter = [0] * (n + 1)
for px in s[n:]:
p, x = list(map(int, px.split()))
... | false | 7.142857 | [
"+import sys",
"-n, q = [int(i) for i in input().split()]",
"-ab = [[int(i) for i in input().split()] for _ in range(n - 1)]",
"-px = [[int(i) for i in input().split()] for _ in range(q)]",
"+s = sys.stdin.readlines()",
"+n, q = list(map(int, s[0].split()))",
"-for a, b in ab:",
"+for ab in s[1:n]:",
... | false | 0.06654 | 0.044893 | 1.482193 | [
"s230172850",
"s848130262"
] |
u625554679 | p03240 | python | s655079975 | s323201700 | 35 | 32 | 3,064 | 3,064 | Accepted | Accepted | 8.57 | N = int(eval(input()))
#def height(x, y, h, cx, cz):
def city_dist(x1, y1, x2, y2):
return(abs(x1-x2)+abs(y1-y2))
def height(x1, y1, cx, cy, H):
return max(H-city_dist(x1, y1, cx, cy), 0)
x = []
y = []
h = []
non_zero_index = -1
for i in range(N):
line = [int(a) for a in input().split()... | N = int(eval(input()))
x = []
y = []
h = []
nonzero_x = 0
nonzero_y = 0
nonzero_h = 0
for _ in range(N):
xx, yy, hh = [int(x) for x in input().split()]
x.append(xx)
y.append(yy)
h.append(hh)
if nonzero_h == 0 and hh != 0:
nonzero_x = xx
nonzero_y = yy
nonzero... | 38 | 35 | 953 | 810 | N = int(eval(input()))
# def height(x, y, h, cx, cz):
def city_dist(x1, y1, x2, y2):
return abs(x1 - x2) + abs(y1 - y2)
def height(x1, y1, cx, cy, H):
return max(H - city_dist(x1, y1, cx, cy), 0)
x = []
y = []
h = []
non_zero_index = -1
for i in range(N):
line = [int(a) for a in input().split()]
x.a... | N = int(eval(input()))
x = []
y = []
h = []
nonzero_x = 0
nonzero_y = 0
nonzero_h = 0
for _ in range(N):
xx, yy, hh = [int(x) for x in input().split()]
x.append(xx)
y.append(yy)
h.append(hh)
if nonzero_h == 0 and hh != 0:
nonzero_x = xx
nonzero_y = yy
nonzero_h = hh
def sol... | false | 7.894737 | [
"-# def height(x, y, h, cx, cz):",
"-def city_dist(x1, y1, x2, y2):",
"- return abs(x1 - x2) + abs(y1 - y2)",
"-",
"-",
"-def height(x1, y1, cx, cy, H):",
"- return max(H - city_dist(x1, y1, cx, cy), 0)",
"-",
"-",
"-non_zero_index = -1",
"-for i in range(N):",
"- line = [int(a) for a... | false | 0.04175 | 0.052807 | 0.79061 | [
"s655079975",
"s323201700"
] |
u968166680 | p02781 | python | s313932033 | s111594092 | 94 | 67 | 62,180 | 61,784 | Accepted | Accepted | 28.72 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, K = list(map(int, read().split()))
X = list(map(int, str(N)))
L = len(X)
dp1 = [[0] * (K + 1) for _ in range(L ... | import sys
read = sys.stdin.read
def main():
N, K = list(map(int, read().split()))
dp1 = [0] * (K + 1)
dp2 = [0] * (K + 1)
dp1[0] = 1
for x in map(int, str(N)):
dp1, dp1_prev = [0] * (K + 1), dp1
dp2, dp2_prev = [0] * (K + 1), dp2
for j in range(K, -1, -1)... | 41 | 36 | 981 | 826 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, K = list(map(int, read().split()))
X = list(map(int, str(N)))
L = len(X)
dp1 = [[0] * (K + 1) for _ in range(L + 1)]
dp2 = [[0]... | import sys
read = sys.stdin.read
def main():
N, K = list(map(int, read().split()))
dp1 = [0] * (K + 1)
dp2 = [0] * (K + 1)
dp1[0] = 1
for x in map(int, str(N)):
dp1, dp1_prev = [0] * (K + 1), dp1
dp2, dp2_prev = [0] * (K + 1), dp2
for j in range(K, -1, -1):
if ... | false | 12.195122 | [
"-readline = sys.stdin.readline",
"-readlines = sys.stdin.readlines",
"-sys.setrecursionlimit(10**9)",
"-INF = 1 << 60",
"-MOD = 1000000007",
"- X = list(map(int, str(N)))",
"- L = len(X)",
"- dp1 = [[0] * (K + 1) for _ in range(L + 1)]",
"- dp2 = [[0] * (K + 1) for _ in range(L + 1)]",
... | false | 0.038583 | 0.038026 | 1.014647 | [
"s313932033",
"s111594092"
] |
u533039576 | p03017 | python | s843558638 | s742549083 | 56 | 19 | 3,636 | 3,572 | Accepted | Accepted | 66.07 | n, a, b, c, d = list(map(int, input().split()))
s = '#' + eval(input())
def check(l, r):
for i in range(l, r):
if s[i] == '#' and s[i+1] == '#':
return False
return True
if c < d:
if check(a, c) and check(b, d):
print("Yes")
else:
print("No")
else: #... | n, a, b, c, d = list(map(int, input().split()))
s = '#' + eval(input())
def check(l, r):
return "##" not in s[l:r]
if c < d:
if check(a, c) and check(b, d):
print("Yes")
else:
print("No")
else: # c > d
space = "..." in s[b-1:d+2]
if space and check(a, c) and check(b, d... | 27 | 17 | 573 | 365 | n, a, b, c, d = list(map(int, input().split()))
s = "#" + eval(input())
def check(l, r):
for i in range(l, r):
if s[i] == "#" and s[i + 1] == "#":
return False
return True
if c < d:
if check(a, c) and check(b, d):
print("Yes")
else:
print("No")
else: # c > d
... | n, a, b, c, d = list(map(int, input().split()))
s = "#" + eval(input())
def check(l, r):
return "##" not in s[l:r]
if c < d:
if check(a, c) and check(b, d):
print("Yes")
else:
print("No")
else: # c > d
space = "..." in s[b - 1 : d + 2]
if space and check(a, c) and check(b, d):
... | false | 37.037037 | [
"- for i in range(l, r):",
"- if s[i] == \"#\" and s[i + 1] == \"#\":",
"- return False",
"- return True",
"+ return \"##\" not in s[l:r]",
"- space = False",
"- for i in range(b, d + 1):",
"- if s[i - 1] == \".\" and s[i] == \".\" and s[i + 1] == \".\":",
"- ... | false | 0.037991 | 0.038763 | 0.980088 | [
"s843558638",
"s742549083"
] |
u412035967 | p02789 | python | s743331986 | s683836773 | 167 | 26 | 38,256 | 3,952 | Accepted | Accepted | 84.43 | N, M = list(map(int, input().split()))
if N > M:
print('No')
else:
print('Yes') | import queue as Q
N, M = list(map(int, input().split()))
if N > M:
print('No')
else:
print('Yes') | 6 | 8 | 83 | 104 | N, M = list(map(int, input().split()))
if N > M:
print("No")
else:
print("Yes")
| import queue as Q
N, M = list(map(int, input().split()))
if N > M:
print("No")
else:
print("Yes")
| false | 25 | [
"+import queue as Q",
"+"
] | false | 0.049873 | 0.033724 | 1.478852 | [
"s743331986",
"s683836773"
] |
u595856802 | p03031 | python | s120550715 | s171220381 | 216 | 195 | 41,712 | 41,324 | Accepted | Accepted | 9.72 | N, M = list(map(int, input().split()))
kss = [list(map(int, input().split())) for _ in range(M)]
ps = list(map(int, input().split()))
answer = 0
for i in range(1 << N):
for (_, *ss), p in zip(kss, ps):
okay = True
if sum([(i >> s-1) & 1 for s in ss]) % 2 != p:
okay = False
... | from itertools import product
N, M = list(map(int, input().split()))
kss = [list(map(int, input().split())) for _ in range(M)]
ps = list(map(int, input().split()))
answer = 0
for switches in product(list(range(2)), repeat=N):
for (_, *ss), p in zip(kss, ps):
okay = True
if sum([switches[... | 15 | 17 | 381 | 434 | N, M = list(map(int, input().split()))
kss = [list(map(int, input().split())) for _ in range(M)]
ps = list(map(int, input().split()))
answer = 0
for i in range(1 << N):
for (_, *ss), p in zip(kss, ps):
okay = True
if sum([(i >> s - 1) & 1 for s in ss]) % 2 != p:
okay = False
... | from itertools import product
N, M = list(map(int, input().split()))
kss = [list(map(int, input().split())) for _ in range(M)]
ps = list(map(int, input().split()))
answer = 0
for switches in product(list(range(2)), repeat=N):
for (_, *ss), p in zip(kss, ps):
okay = True
if sum([switches[s - 1] for ... | false | 11.764706 | [
"+from itertools import product",
"+",
"-for i in range(1 << N):",
"+for switches in product(list(range(2)), repeat=N):",
"- if sum([(i >> s - 1) & 1 for s in ss]) % 2 != p:",
"+ if sum([switches[s - 1] for s in ss]) % 2 != p:"
] | false | 0.071811 | 0.062662 | 1.146008 | [
"s120550715",
"s171220381"
] |
u077291787 | p03741 | python | s598227320 | s550833629 | 103 | 74 | 14,468 | 14,084 | Accepted | Accepted | 28.16 | # ARC072C - Sequence (ABC059C)
def main():
n = int(eval(input()))
lst = list(map(int, input().rstrip().split()))
cnt = [0] * 2
# start with positive number
cur = 0
for i, j in enumerate(lst):
cur += j
if i % 2 == 0 and cur <= 0:
cnt[0] += abs(cur) + 1
... | # ARC072C - Sequence (ABC059C)
def modify_seq(seq: list, is_positive: bool) -> int:
cur, cnt = 0, 0
for i in seq:
cur += i
if is_positive and cur <= 0:
cnt += abs(cur) + 1
cur = 1
elif not is_positive and cur >= 0:
cnt += abs(cur) + 1
... | 33 | 22 | 789 | 555 | # ARC072C - Sequence (ABC059C)
def main():
n = int(eval(input()))
lst = list(map(int, input().rstrip().split()))
cnt = [0] * 2
# start with positive number
cur = 0
for i, j in enumerate(lst):
cur += j
if i % 2 == 0 and cur <= 0:
cnt[0] += abs(cur) + 1
cur ... | # ARC072C - Sequence (ABC059C)
def modify_seq(seq: list, is_positive: bool) -> int:
cur, cnt = 0, 0
for i in seq:
cur += i
if is_positive and cur <= 0:
cnt += abs(cur) + 1
cur = 1
elif not is_positive and cur >= 0:
cnt += abs(cur) + 1
cur =... | false | 33.333333 | [
"+def modify_seq(seq: list, is_positive: bool) -> int:",
"+ cur, cnt = 0, 0",
"+ for i in seq:",
"+ cur += i",
"+ if is_positive and cur <= 0:",
"+ cnt += abs(cur) + 1",
"+ cur = 1",
"+ elif not is_positive and cur >= 0:",
"+ cnt += abs(cur... | false | 0.042794 | 0.04578 | 0.934785 | [
"s598227320",
"s550833629"
] |
u440566786 | p03163 | python | s315040167 | s497825852 | 434 | 356 | 118,896 | 117,744 | Accepted | Accepted | 17.97 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.buffer.readline().rstrip()
def resolve():
n,w=list(map(int,input().split()))
W=[0]*n
V=[0]*n
for i in range(n):
W[i],V[i]=list(map(int,input().split()))
dp=[[0]*(w+1) for _ in range(n... | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
n,W=list(map(int,input().split()))
w=[0]*(n+1)
v=[0]*(n+1)
for i in range(1,n+1):
w[i],v[i]=list(map(int,input().split()))
dp=[0]*(W+1)
for i i... | 19 | 20 | 543 | 520 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.buffer.readline().rstrip()
def resolve():
n, w = list(map(int, input().split()))
W = [0] * n
V = [0] * n
for i in range(n):
W[i], V[i] = list(map(int, input().split()))
dp = [[0] * (w... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def resolve():
n, W = list(map(int, input().split()))
w = [0] * (n + 1)
v = [0] * (n + 1)
for i in range(1, n + 1):
w[i], v[i] = list(map(int, input().split()))
dp... | false | 5 | [
"-input = lambda: sys.stdin.buffer.readline().rstrip()",
"+input = lambda: sys.stdin.readline().rstrip()",
"- n, w = list(map(int, input().split()))",
"- W = [0] * n",
"- V = [0] * n",
"- for i in range(n):",
"- W[i], V[i] = list(map(int, input().split()))",
"- dp = [[0] * (w + 1... | false | 0.039341 | 0.033131 | 1.18742 | [
"s315040167",
"s497825852"
] |
u808757777 | p02879 | python | s319630416 | s940752035 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | a,b=list(map(int,input().split(' ')))
if a<10 and b<10:
print((a*b))
else:
print((-1)) | a, b = list(map(int, input().split(' ')))
if 1<=a<=9 and 1<=b<=9:
print((a*b))
else:
print((-1))
| 6 | 6 | 86 | 97 | a, b = list(map(int, input().split(" ")))
if a < 10 and b < 10:
print((a * b))
else:
print((-1))
| a, b = list(map(int, input().split(" ")))
if 1 <= a <= 9 and 1 <= b <= 9:
print((a * b))
else:
print((-1))
| false | 0 | [
"-if a < 10 and b < 10:",
"+if 1 <= a <= 9 and 1 <= b <= 9:"
] | false | 0.079402 | 0.072203 | 1.099712 | [
"s319630416",
"s940752035"
] |
u653041271 | p02701 | python | s036944362 | s356971432 | 336 | 276 | 23,920 | 45,876 | Accepted | Accepted | 17.86 | n=int(eval(input()))
s = [eval(input()) for i in range(n)]
s.sort()
ans=n
for i in range(1,n):
if s[i]==s[i-1]:
ans-=1
print(ans) | import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod =... | 9 | 30 | 132 | 975 | n = int(eval(input()))
s = [eval(input()) for i in range(n)]
s.sort()
ans = n
for i in range(1, n):
if s[i] == s[i - 1]:
ans -= 1
print(ans)
| import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter, defaultdict, deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9... | false | 70 | [
"-n = int(eval(input()))",
"-s = [eval(input()) for i in range(n)]",
"+import sys, bisect, math, itertools, string, queue, copy",
"+import numpy as np",
"+import scipy",
"+from collections import Counter, defaultdict, deque",
"+from itertools import permutations, combinations",
"+from heapq import hea... | false | 0.038045 | 0.04114 | 0.92477 | [
"s036944362",
"s356971432"
] |
u312025627 | p02579 | python | s687278855 | s495149244 | 918 | 770 | 97,160 | 97,860 | Accepted | Accepted | 16.12 | INF = 10**9 + 7
def main():
from heapq import heappop, heappush
H, W = (int(i) for i in input().split())
Ch, Cw = (int(i)-1 for i in input().split())
Dh, Dw = (int(i)-1 for i in input().split())
A = [eval(input()) for i in range(H)]
dist = [[INF]*W for _ in range(H)]
dist[Ch][C... | # 01BFS
INF = 10**9 + 7
def main():
from collections import deque
H, W = (int(i) for i in input().split())
Ch, Cw = (int(i)-1 for i in input().split())
Dh, Dw = (int(i)-1 for i in input().split())
A = [eval(input()) for i in range(H)]
def bfs_2d(c, sy, sx, gh, gw, H, W):
q... | 42 | 42 | 1,195 | 1,377 | INF = 10**9 + 7
def main():
from heapq import heappop, heappush
H, W = (int(i) for i in input().split())
Ch, Cw = (int(i) - 1 for i in input().split())
Dh, Dw = (int(i) - 1 for i in input().split())
A = [eval(input()) for i in range(H)]
dist = [[INF] * W for _ in range(H)]
dist[Ch][Cw] = ... | # 01BFS
INF = 10**9 + 7
def main():
from collections import deque
H, W = (int(i) for i in input().split())
Ch, Cw = (int(i) - 1 for i in input().split())
Dh, Dw = (int(i) - 1 for i in input().split())
A = [eval(input()) for i in range(H)]
def bfs_2d(c, sy, sx, gh, gw, H, W):
que = de... | false | 0 | [
"+# 01BFS",
"- from heapq import heappop, heappush",
"+ from collections import deque",
"- dist = [[INF] * W for _ in range(H)]",
"- dist[Ch][Cw] = 0",
"- que = [(0, Ch * W + Cw)]",
"- while que:",
"- u_dist, u = heappop(que)",
"- uh, uw = u // W, u % W",
"- ... | false | 0.040412 | 0.040968 | 0.986437 | [
"s687278855",
"s495149244"
] |
u392029857 | p03796 | python | s950593851 | s884822078 | 46 | 41 | 2,940 | 2,940 | Accepted | Accepted | 10.87 | N = int(eval(input()))
ans = 1
for i in range(1, N+1):
ans *= i
if ans >= (10**9 + 7):
ans %= (10**9+7)
print(ans) | N = int(eval(input()))
ans = 1
for i in range(1,N+1):
ans *= i
ans %= (1000000000+7)
print(ans) | 7 | 6 | 130 | 102 | N = int(eval(input()))
ans = 1
for i in range(1, N + 1):
ans *= i
if ans >= (10**9 + 7):
ans %= 10**9 + 7
print(ans)
| N = int(eval(input()))
ans = 1
for i in range(1, N + 1):
ans *= i
ans %= 1000000000 + 7
print(ans)
| false | 14.285714 | [
"- if ans >= (10**9 + 7):",
"- ans %= 10**9 + 7",
"+ ans %= 1000000000 + 7"
] | false | 0.060089 | 0.043862 | 1.369944 | [
"s950593851",
"s884822078"
] |
u312025627 | p02689 | python | s760612086 | s447515153 | 248 | 132 | 106,836 | 85,560 | Accepted | Accepted | 46.77 | def main():
import sys
input = sys.stdin.buffer.readline
N, M = (int(i) for i in input().split())
H = [int(i) for i in input().split()]
G = [set() for _ in range(N)]
for i in range(M):
a, b = (int(i) for i in input().split())
G[a-1].add(b-1)
G[b-1].add(a-1)
... | def main():
import sys
input = sys.stdin.buffer.readline
N, M = (int(i) for i in input().split())
H = [int(i) for i in input().split()]
ans = [1]*N
for _ in range(M):
a, b = (int(i)-1 for i in input().split())
if H[a] < H[b]:
ans[a] = 0
elif H[b] < H... | 19 | 21 | 478 | 479 | def main():
import sys
input = sys.stdin.buffer.readline
N, M = (int(i) for i in input().split())
H = [int(i) for i in input().split()]
G = [set() for _ in range(N)]
for i in range(M):
a, b = (int(i) for i in input().split())
G[a - 1].add(b - 1)
G[b - 1].add(a - 1)
a... | def main():
import sys
input = sys.stdin.buffer.readline
N, M = (int(i) for i in input().split())
H = [int(i) for i in input().split()]
ans = [1] * N
for _ in range(M):
a, b = (int(i) - 1 for i in input().split())
if H[a] < H[b]:
ans[a] = 0
elif H[b] < H[a]:
... | false | 9.52381 | [
"- G = [set() for _ in range(N)]",
"- for i in range(M):",
"- a, b = (int(i) for i in input().split())",
"- G[a - 1].add(b - 1)",
"- G[b - 1].add(a - 1)",
"- ans = 0",
"- for a in range(N):",
"- if all(H[b] < H[a] for b in G[a]):",
"- ans += 1",
"... | false | 0.042343 | 0.060477 | 0.700154 | [
"s760612086",
"s447515153"
] |
u367713721 | p04030 | python | s522578709 | s271664256 | 180 | 17 | 12,760 | 3,060 | Accepted | Accepted | 90.56 |
# -*- coding:utf-8 -*-
import numpy as np
import scipy as sp
s = eval(input())
n = len(s)
s_list = []
for i in range(0, n):
if s[i] == 'B':
if len(s_list) == 0:
continue
else:
... | # -*- coding:utf-8 -*-
s = eval(input())
n = len(s)
s_list = []
for i in range(0, n):
if s[i] == 'B':
if len(s_list) == 0:
continue
else:
s_list.pop(-1)
else:
s_lis... | 24 | 21 | 451 | 409 | # -*- coding:utf-8 -*-
import numpy as np
import scipy as sp
s = eval(input())
n = len(s)
s_list = []
for i in range(0, n):
if s[i] == "B":
if len(s_list) == 0:
continue
else:
s_list.pop(-1)
else:
s_list.append(s[i])
S = ""
for i in range(0, len(s_list)):
S =... | # -*- coding:utf-8 -*-
s = eval(input())
n = len(s)
s_list = []
for i in range(0, n):
if s[i] == "B":
if len(s_list) == 0:
continue
else:
s_list.pop(-1)
else:
s_list.append(s[i])
S = ""
for i in range(0, len(s_list)):
S = S + s_list[i]
print(S)
| false | 12.5 | [
"-import numpy as np",
"-import scipy as sp",
"-"
] | false | 0.047991 | 0.083096 | 0.577528 | [
"s522578709",
"s271664256"
] |
u588341295 | p03673 | python | s833553104 | s145062137 | 202 | 172 | 31,940 | 32,964 | Accepted | Accepted | 14.85 | # -*- coding: utf-8 -*-
N = int(eval(input()))
aN = list(map(int, input().split()))
bN = [0] * N
if N % 2 == 0:
for i in range(N):
if i % 2 == 0:
bN[(N//2) + i//2] = str(aN[i])
else:
bN[(N//2) - (i+1)//2] = str(aN[i])
else:
for i in range(N):
if i ... | # -*- coding: utf-8 -*-
# 普通のリストじゃなくてこれ使えば、左への挿入も速いとのこと
from collections import deque
N = int(eval(input()))
aN = list(map(int, input().split()))
bN = deque()
if N % 2 == 0:
for i in range(N):
if i % 2 == 0:
bN.append(str(aN[i]))
else:
bN.appendleft(str(aN[i]... | 20 | 23 | 453 | 483 | # -*- coding: utf-8 -*-
N = int(eval(input()))
aN = list(map(int, input().split()))
bN = [0] * N
if N % 2 == 0:
for i in range(N):
if i % 2 == 0:
bN[(N // 2) + i // 2] = str(aN[i])
else:
bN[(N // 2) - (i + 1) // 2] = str(aN[i])
else:
for i in range(N):
if i % 2 ==... | # -*- coding: utf-8 -*-
# 普通のリストじゃなくてこれ使えば、左への挿入も速いとのこと
from collections import deque
N = int(eval(input()))
aN = list(map(int, input().split()))
bN = deque()
if N % 2 == 0:
for i in range(N):
if i % 2 == 0:
bN.append(str(aN[i]))
else:
bN.appendleft(str(aN[i]))
else:
for... | false | 13.043478 | [
"+# 普通のリストじゃなくてこれ使えば、左への挿入も速いとのこと",
"+from collections import deque",
"+",
"-bN = [0] * N",
"+bN = deque()",
"- bN[(N // 2) + i // 2] = str(aN[i])",
"+ bN.append(str(aN[i]))",
"- bN[(N // 2) - (i + 1) // 2] = str(aN[i])",
"+ bN.appendleft(str(aN[i]))",
"... | false | 0.086261 | 0.049912 | 1.728245 | [
"s833553104",
"s145062137"
] |
u852690916 | p02763 | python | s256583261 | s726522465 | 1,919 | 527 | 453,840 | 112,336 | Accepted | Accepted | 72.54 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main():
N,S,Q,*q = read().decode().split()
N = int(N)
S = list(S)
c = lambda x: ord(x) - ord('a')
tree = [SegmentTree(N, lambda x,y:x|y) for _ in range(26)]
for i, ... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main():
N,S,Q,*q = read().split()
S = S.decode()
tree = SegmentTree(initial_values=S, f=lambda x,y:x|y, converter=lambda c: 1 << (ord(c)-ord('a')))
for t, a, b in zip(*[iter(... | 68 | 53 | 2,562 | 2,230 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main():
N, S, Q, *q = read().decode().split()
N = int(N)
S = list(S)
c = lambda x: ord(x) - ord("a")
tree = [SegmentTree(N, lambda x, y: x | y) for _ in range(26)]
for i, l ... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main():
N, S, Q, *q = read().split()
S = S.decode()
tree = SegmentTree(
initial_values=S,
f=lambda x, y: x | y,
converter=lambda c: 1 << (ord(c) - ord("a")),
... | false | 22.058824 | [
"- N, S, Q, *q = read().decode().split()",
"- N = int(N)",
"- S = list(S)",
"- c = lambda x: ord(x) - ord(\"a\")",
"- tree = [SegmentTree(N, lambda x, y: x | y) for _ in range(26)]",
"- for i, l in enumerate(S):",
"- tree[c(l)].update(i, 1)",
"+ N, S, Q, *q = read().split()... | false | 0.038869 | 0.090979 | 0.427233 | [
"s256583261",
"s726522465"
] |
u072717685 | p03637 | python | s685539404 | s204427927 | 208 | 61 | 14,764 | 14,252 | Accepted | Accepted | 70.67 | from copy import deepcopy
def main():
n = int(eval(input()))
a = list(map(int, input().split()))
div2 = [0] * n
div4 = deepcopy(div2)
notdiv4 = deepcopy(div2)
for i in range(n):
if a[i] % 4 == 0:
div4[i] = 1
elif a[i] % 2 == 0:
div2[i] = 1
... |
def main():
n = int(eval(input()))
a = list(map(int, input().split()))
div2 = 0
div4 = 0
notdiv4 = 0
for ea in a:
if ea % 4 == 0:
div4 += 1
elif ea % 2 == 0:
div2 += 1
else:
notdiv4 += 1
notdiv4 += div2 % 2
if ... | 24 | 23 | 553 | 429 | from copy import deepcopy
def main():
n = int(eval(input()))
a = list(map(int, input().split()))
div2 = [0] * n
div4 = deepcopy(div2)
notdiv4 = deepcopy(div2)
for i in range(n):
if a[i] % 4 == 0:
div4[i] = 1
elif a[i] % 2 == 0:
div2[i] = 1
else:
... | def main():
n = int(eval(input()))
a = list(map(int, input().split()))
div2 = 0
div4 = 0
notdiv4 = 0
for ea in a:
if ea % 4 == 0:
div4 += 1
elif ea % 2 == 0:
div2 += 1
else:
notdiv4 += 1
notdiv4 += div2 % 2
if notdiv4 - 1 > div4... | false | 4.166667 | [
"-from copy import deepcopy",
"-",
"-",
"- div2 = [0] * n",
"- div4 = deepcopy(div2)",
"- notdiv4 = deepcopy(div2)",
"- for i in range(n):",
"- if a[i] % 4 == 0:",
"- div4[i] = 1",
"- elif a[i] % 2 == 0:",
"- div2[i] = 1",
"+ div2 = 0",
"+ ... | false | 0.1986 | 0.035729 | 5.558481 | [
"s685539404",
"s204427927"
] |
u844646164 | p03722 | python | s221948996 | s116657948 | 732 | 465 | 3,572 | 3,316 | Accepted | Accepted | 36.48 | def bellman_ford(V, E, s, std):
dist = [float('inf') for _ in range(V)]
dist[s] = 0
for i in range(V):
for s, t, d in std:
s -=1
t -= 1
d = -d
if dist[t] > dist[s] + d:
dist[t] = dist[s] + d
if i == V-1 and t+1 == V:
return -1
return dist
de... |
n, m = list(map(int, input().split()))
abc = []
for _ in range(m):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
c *= -1
abc += [[a,b,c]]
def bellman_ford(s):
# std = [[s0, t0, d0], [s1, t1, d1], ... , [sm, tm, dm]]
# (si, ti, di): si, ti間に重さdiの辺がある
dist = [float('inf')]*n
d... | 26 | 29 | 583 | 591 | def bellman_ford(V, E, s, std):
dist = [float("inf") for _ in range(V)]
dist[s] = 0
for i in range(V):
for s, t, d in std:
s -= 1
t -= 1
d = -d
if dist[t] > dist[s] + d:
dist[t] = dist[s] + d
if i == V - 1 and t + 1 == V... | n, m = list(map(int, input().split()))
abc = []
for _ in range(m):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
c *= -1
abc += [[a, b, c]]
def bellman_ford(s):
# std = [[s0, t0, d0], [s1, t1, d1], ... , [sm, tm, dm]]
# (si, ti, di): si, ti間に重さdiの辺がある
dist = [float("inf")] * ... | false | 10.344828 | [
"-def bellman_ford(V, E, s, std):",
"- dist = [float(\"inf\") for _ in range(V)]",
"+n, m = list(map(int, input().split()))",
"+abc = []",
"+for _ in range(m):",
"+ a, b, c = list(map(int, input().split()))",
"+ a -= 1",
"+ b -= 1",
"+ c *= -1",
"+ abc += [[a, b, c]]",
"+",
"... | false | 0.083653 | 0.0442 | 1.892575 | [
"s221948996",
"s116657948"
] |
u477977638 | p02901 | python | s578361767 | s412878079 | 314 | 256 | 45,800 | 42,604 | Accepted | Accepted | 18.47 | inf=10**8
n,m=list(map(int,input().split()))
A=[]
C=[]
dp=[inf]*(1<<n)
dp[0]=0
for _ in range(m):
a,_=list(map(int,input().split()))
c=list(map(int,input().split()))
A.append(a)
tmp=0
for i in c:
tmp+=1<<(i-1)
C.append(tmp)
for i in range(1<<n):
for index,j in enumerate(C):
... | import sys
input = sys.stdin.readline
inf=10**8
n,m=list(map(int,input().split()))
A=[]
C=[]
dp=[inf]*(1<<n)
dp[0]=0
for _ in range(m):
a,_=list(map(int,input().split()))
c=list(map(int,input().split()))
A.append(a)
tmp=0
for i in c:
tmp+=1<<(i-1)
C.append(tmp)
for i in range(1... | 24 | 27 | 388 | 430 | inf = 10**8
n, m = list(map(int, input().split()))
A = []
C = []
dp = [inf] * (1 << n)
dp[0] = 0
for _ in range(m):
a, _ = list(map(int, input().split()))
c = list(map(int, input().split()))
A.append(a)
tmp = 0
for i in c:
tmp += 1 << (i - 1)
C.append(tmp)
for i in range(1 << n):
for... | import sys
input = sys.stdin.readline
inf = 10**8
n, m = list(map(int, input().split()))
A = []
C = []
dp = [inf] * (1 << n)
dp[0] = 0
for _ in range(m):
a, _ = list(map(int, input().split()))
c = list(map(int, input().split()))
A.append(a)
tmp = 0
for i in c:
tmp += 1 << (i - 1)
C.appe... | false | 11.111111 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.094809 | 0.096213 | 0.985409 | [
"s578361767",
"s412878079"
] |
u677523557 | p03132 | python | s008843730 | s702534253 | 669 | 180 | 37,464 | 112,888 | Accepted | Accepted | 73.09 | import sys
input = sys.stdin.readline
import numpy as np
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
p1 = 0
p2 = 0
P1 = [0]
P2 = [0]
for a in A:
if a == 0:
p1 -= 2
p2 += 1
elif a % 2 == 0:
p2 -= 1
elif a % 2 == 1:
p1 -= 1
p2 ... | import sys
input = sys.stdin.readline
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
dp = [[0]*5 for _ in range(N+1)]
for i, a in enumerate(A):
b = a%2 if a > 0 else 2
dp[i+1][0] = dp[i][0] + a
dp[i+1][1] = min(dp[i][1], dp[i][0]) + b
dp[i+1][2] = min([dp[i][2], dp[i][1... | 33 | 18 | 601 | 489 | import sys
input = sys.stdin.readline
import numpy as np
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
p1 = 0
p2 = 0
P1 = [0]
P2 = [0]
for a in A:
if a == 0:
p1 -= 2
p2 += 1
elif a % 2 == 0:
p2 -= 1
elif a % 2 == 1:
p1 -= 1
p2 += 1
p1 += a
... | import sys
input = sys.stdin.readline
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
dp = [[0] * 5 for _ in range(N + 1)]
for i, a in enumerate(A):
b = a % 2 if a > 0 else 2
dp[i + 1][0] = dp[i][0] + a
dp[i + 1][1] = min(dp[i][1], dp[i][0]) + b
dp[i + 1][2] = min([dp[i][2], dp[i][1],... | false | 45.454545 | [
"-import numpy as np",
"-",
"-p1 = 0",
"-p2 = 0",
"-P1 = [0]",
"-P2 = [0]",
"-for a in A:",
"- if a == 0:",
"- p1 -= 2",
"- p2 += 1",
"- elif a % 2 == 0:",
"- p2 -= 1",
"- elif a % 2 == 1:",
"- p1 -= 1",
"- p2 += 1",
"- p1 += a",
"- P... | false | 0.104592 | 0.037553 | 2.785167 | [
"s008843730",
"s702534253"
] |
u729133443 | p03110 | python | s982249829 | s701269544 | 163 | 17 | 38,384 | 2,940 | Accepted | Accepted | 89.57 | print((sum(float(s[:-4])*[380000,1][s[-4]>'C']for s in open(0).readlines()[1:]))) | print((sum(float(s[:-4])*(s[-4]>'C'or 380000)for s in open(0).readlines()[1:]))) | 1 | 1 | 79 | 78 | print((sum(float(s[:-4]) * [380000, 1][s[-4] > "C"] for s in open(0).readlines()[1:])))
| print((sum(float(s[:-4]) * (s[-4] > "C" or 380000) for s in open(0).readlines()[1:])))
| false | 0 | [
"-print((sum(float(s[:-4]) * [380000, 1][s[-4] > \"C\"] for s in open(0).readlines()[1:])))",
"+print((sum(float(s[:-4]) * (s[-4] > \"C\" or 380000) for s in open(0).readlines()[1:])))"
] | false | 0.042712 | 0.047104 | 0.906767 | [
"s982249829",
"s701269544"
] |
u525065967 | p02579 | python | s700342377 | s893889535 | 1,575 | 1,406 | 263,936 | 264,444 | Accepted | Accepted | 10.73 | dhw = [(1,0),(0,-1),(0,1),(-1,0),
( 2,-2),( 2,-1),( 2, 0),( 2, 1),( 2, 2),
( 1,-2),( 1,-1), ( 1, 1),( 1, 2),
( 0,-2), ( 0, 2),
(-1,-2),(-1,-1), (-1, 1),(-1, 2),
(-2,-2),(-2,-1),(-2, 0),(-2, 1),(-2, 2)]
H, W = list(map(int, input().split()))
sh, sw = [int(x)-1 for x in input... | dhw = [(1,0),(0,-1),(0,1),(-1,0),
( 2,-2),( 2,-1),( 2, 0),( 2, 1),( 2, 2),
( 1,-2),( 1,-1), ( 1, 1),( 1, 2),
( 0,-2), ( 0, 2),
(-1,-2),(-1,-1), (-1, 1),(-1, 2),
(-2,-2),(-2,-1),(-2, 0),(-2, 1),(-2, 2)]
H, W = list(map(int, input().split()))
sh, sw = [int(x)-1 for x in input... | 24 | 27 | 821 | 888 | dhw = [
(1, 0),
(0, -1),
(0, 1),
(-1, 0),
(2, -2),
(2, -1),
(2, 0),
(2, 1),
(2, 2),
(1, -2),
(1, -1),
(1, 1),
(1, 2),
(0, -2),
(0, 2),
(-1, -2),
(-1, -1),
(-1, 1),
(-1, 2),
(-2, -2),
(-2, -1),
(-2, 0),
(-2, 1),
(-2, 2),
]
H,... | dhw = [
(1, 0),
(0, -1),
(0, 1),
(-1, 0),
(2, -2),
(2, -1),
(2, 0),
(2, 1),
(2, 2),
(1, -2),
(1, -1),
(1, 1),
(1, 2),
(0, -2),
(0, 2),
(-1, -2),
(-1, -1),
(-1, 1),
(-1, 2),
(-2, -2),
(-2, -1),
(-2, 0),
(-2, 1),
(-2, 2),
]
H,... | false | 11.111111 | [
"+ if h == eh and w == ew:",
"+ dst[h][w] = d",
"+ break"
] | false | 0.037629 | 0.034216 | 1.09973 | [
"s700342377",
"s893889535"
] |
u945839160 | p03495 | python | s289534047 | s421824829 | 370 | 330 | 119,488 | 109,384 | Accepted | Accepted | 10.81 | def resolve():
# 整数 1 つ
# n = int(input())
# 整数複数個
n, k = list(map(int, input().split()))
# 整数 N 個 (改行区切り)
# N = [int(input()) for i in range(N)]
# 整数 N 個 (スペース区切り)
A = list(map(int, input().split()))
# 整数 (縦 H 横 W の行列)
# A = [list(map(int, input().split())) for i in ra... | def resolve():
# 整数 1 つ
# n = int(input())
# 整数複数個
n, k = list(map(int, input().split()))
# 整数 N 個 (改行区切り)
# N = [int(input()) for i in range(N)]
# 整数 N 個 (スペース区切り)
A = list(map(int, input().split()))
# 整数 (縦 H 横 W の行列)
# A = [list(map(int, input().split())) for i in ra... | 27 | 26 | 671 | 638 | def resolve():
# 整数 1 つ
# n = int(input())
# 整数複数個
n, k = list(map(int, input().split()))
# 整数 N 個 (改行区切り)
# N = [int(input()) for i in range(N)]
# 整数 N 個 (スペース区切り)
A = list(map(int, input().split()))
# 整数 (縦 H 横 W の行列)
# A = [list(map(int, input().split())) for i in range(H)]
... | def resolve():
# 整数 1 つ
# n = int(input())
# 整数複数個
n, k = list(map(int, input().split()))
# 整数 N 個 (改行区切り)
# N = [int(input()) for i in range(N)]
# 整数 N 個 (スペース区切り)
A = list(map(int, input().split()))
# 整数 (縦 H 横 W の行列)
# A = [list(map(int, input().split())) for i in range(H)]
... | false | 3.703704 | [
"- Unique = list(set(A))",
"- if len(set(A)) <= k:",
"+ if len(Dic) <= k:",
"- for x in A:",
"- Dic[x] += 1",
"+ for i in A:",
"+ Dic[i] += 1",
"- for i in range(len(set(A)) - k):",
"- cnt += Dicsort[i][1]",
"+ for j in range(le... | false | 0.04679 | 0.048855 | 0.957724 | [
"s289534047",
"s421824829"
] |
u964299793 | p04002 | python | s330952465 | s043110193 | 2,749 | 2,503 | 166,924 | 166,896 | Accepted | Accepted | 8.95 | from collections import Counter
h,w,n=map(int,input().split())
cc=Counter()
for _ in range(n):
b,a=map(int,input().split())
for i in range(3):
for j in range(3):
x=a+i
y=b-j #brute forcing valid bottom right corners
if x>=1 and x<=w and y>=1 and y<=h:
... | from collections import Counter
import sys
input=sys.stdin.buffer.readline
h,w,n=map(int,input().split())
cc=Counter()
for _ in range(n):
b,a=map(int,input().split())
for i in range(3):
for j in range(3):
x=a+i
y=b-j #brute forcing valid bottom right corners
... | 19 | 20 | 590 | 633 | from collections import Counter
h, w, n = map(int, input().split())
cc = Counter()
for _ in range(n):
b, a = map(int, input().split())
for i in range(3):
for j in range(3):
x = a + i
y = b - j # brute forcing valid bottom right corners
if x >= 1 and x <= w and y >= ... | from collections import Counter
import sys
input = sys.stdin.buffer.readline
h, w, n = map(int, input().split())
cc = Counter()
for _ in range(n):
b, a = map(int, input().split())
for i in range(3):
for j in range(3):
x = a + i
y = b - j # brute forcing valid bottom right corne... | false | 5 | [
"+import sys",
"+input = sys.stdin.buffer.readline"
] | false | 0.042418 | 0.043848 | 0.967392 | [
"s330952465",
"s043110193"
] |
u620084012 | p03721 | python | s088236534 | s316453100 | 479 | 394 | 28,640 | 91,152 | Accepted | Accepted | 17.75 | N, K = list(map(int,input().split()))
L = sorted([list(map(int,input().split())) for _ in range(N)])
for e in L:
K -= e[1]
if K <= 0:
print((e[0]))
exit(0)
| N, K = list(map(int,input().split()))
L = []
for k in range(N):
L.append(list(map(int,input().split())))
L = sorted(L)
for e in L:
K -= e[1]
if K <= 0:
print((e[0]))
exit(0)
| 7 | 10 | 178 | 203 | N, K = list(map(int, input().split()))
L = sorted([list(map(int, input().split())) for _ in range(N)])
for e in L:
K -= e[1]
if K <= 0:
print((e[0]))
exit(0)
| N, K = list(map(int, input().split()))
L = []
for k in range(N):
L.append(list(map(int, input().split())))
L = sorted(L)
for e in L:
K -= e[1]
if K <= 0:
print((e[0]))
exit(0)
| false | 30 | [
"-L = sorted([list(map(int, input().split())) for _ in range(N)])",
"+L = []",
"+for k in range(N):",
"+ L.append(list(map(int, input().split())))",
"+L = sorted(L)"
] | false | 0.047839 | 0.04737 | 1.0099 | [
"s088236534",
"s316453100"
] |
u767664985 | p02959 | python | s599022520 | s774338704 | 147 | 135 | 19,156 | 18,624 | Accepted | Accepted | 8.16 | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans, surplus = 0, 0
for i in range(N):
tmp = min(A[i], surplus)
ans += tmp
A[i] -= tmp
if B[i] > A[i]:
ans += A[i]
surplus = B[i] - A[i]
else:
ans += B[i]
sur... | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans, mod = 0, 0
for i in range(N):
if mod > A[i]:
ans += A[i]
A[i] = 0
else:
ans += mod
A[i] -= mod
mod = 0
if B[i] > A[i]:
ans += A[i]
... | 18 | 26 | 373 | 421 | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans, surplus = 0, 0
for i in range(N):
tmp = min(A[i], surplus)
ans += tmp
A[i] -= tmp
if B[i] > A[i]:
ans += A[i]
surplus = B[i] - A[i]
else:
ans += B[i]
surplus = 0
tmp = ... | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans, mod = 0, 0
for i in range(N):
if mod > A[i]:
ans += A[i]
A[i] = 0
else:
ans += mod
A[i] -= mod
mod = 0
if B[i] > A[i]:
ans += A[i]
mod = B[i] - A[i]
... | false | 30.769231 | [
"-ans, surplus = 0, 0",
"+ans, mod = 0, 0",
"- tmp = min(A[i], surplus)",
"- ans += tmp",
"- A[i] -= tmp",
"+ if mod > A[i]:",
"+ ans += A[i]",
"+ A[i] = 0",
"+ else:",
"+ ans += mod",
"+ A[i] -= mod",
"+ mod = 0",
"- surplus = B[i] - ... | false | 0.038867 | 0.046749 | 0.831404 | [
"s599022520",
"s774338704"
] |
u997641430 | p02996 | python | s423299003 | s314940244 | 1,339 | 845 | 63,296 | 31,860 | Accepted | Accepted | 36.89 | N=int(eval(input()))
works=[]
for i in range(N):
[a,b]=[int(_) for _ in input().split()]
works.append([b,a])
works.sort()
works2=works[:1]
for work in works[1:]:
if work[0]==works2[-1][0]:
works2[-1][1]+=work[1]
else:
works2.append([work[0],works2[-1][1]])
works2[-1][... | n = int(eval(input()))
W = []
for i in range(n):
a, b = list(map(int, input().split()))
W.append((a, b))
W.sort(key=lambda x: x[1])
x = 0
for i in range(n):
a, b = W[i]
x += a
if x > b:
print('No')
exit()
print('Yes')
| 18 | 14 | 417 | 255 | N = int(eval(input()))
works = []
for i in range(N):
[a, b] = [int(_) for _ in input().split()]
works.append([b, a])
works.sort()
works2 = works[:1]
for work in works[1:]:
if work[0] == works2[-1][0]:
works2[-1][1] += work[1]
else:
works2.append([work[0], works2[-1][1]])
works2[-... | n = int(eval(input()))
W = []
for i in range(n):
a, b = list(map(int, input().split()))
W.append((a, b))
W.sort(key=lambda x: x[1])
x = 0
for i in range(n):
a, b = W[i]
x += a
if x > b:
print("No")
exit()
print("Yes")
| false | 22.222222 | [
"-N = int(eval(input()))",
"-works = []",
"-for i in range(N):",
"- [a, b] = [int(_) for _ in input().split()]",
"- works.append([b, a])",
"-works.sort()",
"-works2 = works[:1]",
"-for work in works[1:]:",
"- if work[0] == works2[-1][0]:",
"- works2[-1][1] += work[1]",
"- else... | false | 0.03519 | 0.053585 | 0.656714 | [
"s423299003",
"s314940244"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.