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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u994988729 | p03807 | python | s480036236 | s957941419 | 57 | 42 | 14,108 | 14,112 | Accepted | Accepted | 26.32 | n=int(input())
a=list(map(int,input().split()))
even,odd=0,0
for i in a:
if i%2==0:
even+=1
else:
odd+=1
if odd==0:
print("YES")
elif even==0:
print("YES") if odd%2==0 else print("NO")
else:
if odd==1 and even==1:
print("NO")
else:
print("YES") if ... | n=int(eval(input()))
a=sum(list(map(int,input().split())))
if a%2==0:
print("YES")
else:
print("NO") | 20 | 6 | 360 | 103 | n = int(input())
a = list(map(int, input().split()))
even, odd = 0, 0
for i in a:
if i % 2 == 0:
even += 1
else:
odd += 1
if odd == 0:
print("YES")
elif even == 0:
print("YES") if odd % 2 == 0 else print("NO")
else:
if odd == 1 and even == 1:
print("NO")
else:
pri... | n = int(eval(input()))
a = sum(list(map(int, input().split())))
if a % 2 == 0:
print("YES")
else:
print("NO")
| false | 70 | [
"-n = int(input())",
"-a = list(map(int, input().split()))",
"-even, odd = 0, 0",
"-for i in a:",
"- if i % 2 == 0:",
"- even += 1",
"- else:",
"- odd += 1",
"-if odd == 0:",
"+n = int(eval(input()))",
"+a = sum(list(map(int, input().split())))",
"+if a % 2 == 0:",
"-elif... | false | 0.105052 | 0.063293 | 1.659782 | [
"s480036236",
"s957941419"
] |
u780475861 | p02786 | python | s067381349 | s140296565 | 22 | 18 | 3,572 | 3,188 | Accepted | Accepted | 18.18 | import sys
from functools import lru_cache
sys.setrecursionlimit(1000000)
@lru_cache(maxsize=None)
def a(n):
if n == 1:
return 1
return 1 + 2 * a(n // 2)
print((a(int(eval(input())))))
| from math import log
h=int(eval(input()))
a=int(log(h,2))
print((pow(2,a+1)-1))
| 13 | 5 | 209 | 77 | import sys
from functools import lru_cache
sys.setrecursionlimit(1000000)
@lru_cache(maxsize=None)
def a(n):
if n == 1:
return 1
return 1 + 2 * a(n // 2)
print((a(int(eval(input())))))
| from math import log
h = int(eval(input()))
a = int(log(h, 2))
print((pow(2, a + 1) - 1))
| false | 61.538462 | [
"-import sys",
"-from functools import lru_cache",
"+from math import log",
"-sys.setrecursionlimit(1000000)",
"-",
"-",
"-@lru_cache(maxsize=None)",
"-def a(n):",
"- if n == 1:",
"- return 1",
"- return 1 + 2 * a(n // 2)",
"-",
"-",
"-print((a(int(eval(input())))))",
"+h = ... | false | 0.141098 | 0.113513 | 1.243009 | [
"s067381349",
"s140296565"
] |
u017810624 | p02804 | python | s898696425 | s837555341 | 879 | 363 | 98,088 | 20,056 | Accepted | Accepted | 58.7 | def cmb(n,r,mod):
if r<0 or r>n:
return 0
r=min(r,n-r)
return g1[n]*g2[r]*g2[n-r]%mod
n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
l=[]
l2=[]
for i in range(n):
l.append([a[i],i])
l.sort()
for i in range(n):
l2.append([l[i][1],i])
l2.sort()
mod=10**9+7
g1=[1,1]
... | def cmb(n,r,mod):
if r<0 or r>n:
return 0
r=min(r,n-r)
return g1[n]*g2[r]*g2[n-r]%mod
n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
a.sort()
mod=10**9+7
g1=[1,1]
g2=[1,1]
inverse=[0,1]
for i in range(2,n+1):
g1.append((g1[-1]*i)%mod)
inverse.append((-inverse[mo... | 36 | 29 | 654 | 530 | def cmb(n, r, mod):
if r < 0 or r > n:
return 0
r = min(r, n - r)
return g1[n] * g2[r] * g2[n - r] % mod
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
l = []
l2 = []
for i in range(n):
l.append([a[i], i])
l.sort()
for i in range(n):
l2.append([l[i][1], i])
l2.s... | def cmb(n, r, mod):
if r < 0 or r > n:
return 0
r = min(r, n - r)
return g1[n] * g2[r] * g2[n - r] % mod
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
mod = 10**9 + 7
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
for i in range(2, n + 1):
g1.append((g1[-1] * i)... | false | 19.444444 | [
"-l = []",
"-l2 = []",
"-for i in range(n):",
"- l.append([a[i], i])",
"-l.sort()",
"-for i in range(n):",
"- l2.append([l[i][1], i])",
"-l2.sort()",
"+a.sort()",
"- ans += a[i] * cmb(l2[i][1], k - 1, mod)",
"+ ans += a[i] * cmb(i, k - 1, mod)",
"- ans -= a[i] * cmb(n - l2[i][1]... | false | 0.036928 | 0.054275 | 0.680388 | [
"s898696425",
"s837555341"
] |
u347640436 | p02762 | python | s603437069 | s940959741 | 1,438 | 999 | 101,264 | 98,436 | Accepted | Accepted | 30.53 | from sys import setrecursionlimit
def find(parent, i):
t = parent[i]
if t < 0:
return i
t = find(parent, t)
parent[i] = t
return t
def unite(parent, i, j):
i = find(parent, i)
j = find(parent, j)
if i == j:
return
parent[j] += parent[i]
paren... | # Union Find 木
from sys import setrecursionlimit
def find(parent, i):
t = parent[i]
if t < 0:
return i
t = find(parent, t)
parent[i] = t
return t
def unite(parent, i, j):
i = find(parent, i)
j = find(parent, j)
if i == j:
return
parent[j] += pare... | 49 | 50 | 1,018 | 1,034 | from sys import setrecursionlimit
def find(parent, i):
t = parent[i]
if t < 0:
return i
t = find(parent, t)
parent[i] = t
return t
def unite(parent, i, j):
i = find(parent, i)
j = find(parent, j)
if i == j:
return
parent[j] += parent[i]
parent[i] = j
setrecu... | # Union Find 木
from sys import setrecursionlimit
def find(parent, i):
t = parent[i]
if t < 0:
return i
t = find(parent, t)
parent[i] = t
return t
def unite(parent, i, j):
i = find(parent, i)
j = find(parent, j)
if i == j:
return
parent[j] += parent[i]
parent[i... | false | 2 | [
"+# Union Find 木",
"-setrecursionlimit(10**5)",
"+setrecursionlimit(10**6)"
] | false | 0.057526 | 0.058689 | 0.980187 | [
"s603437069",
"s940959741"
] |
u125505541 | p03286 | python | s412898993 | s617304118 | 455 | 17 | 5,948 | 3,060 | Accepted | Accepted | 96.26 | import bisect
n = int(eval(input()))
ps = [0] * (1 << 16)
for i in range(1 << 16):
temp = 0
x = 1
for j in range(16):
if (i >> j) & 1:
# temp += (-2) ** (2 *j)
temp += x
x *= 4
ps[i] = temp
pattern1 = None
pattern2 = None
for i in range(1 ... | n = int(eval(input()))
n2 = n
ans = ""
for i in range(100):
while n != 0:
r = (n % 2)
n = (n - r) // (-2)
ans = str(r) + ans
if n2==0:
print("0")
else:
print(ans) | 49 | 12 | 1,025 | 203 | import bisect
n = int(eval(input()))
ps = [0] * (1 << 16)
for i in range(1 << 16):
temp = 0
x = 1
for j in range(16):
if (i >> j) & 1:
# temp += (-2) ** (2 *j)
temp += x
x *= 4
ps[i] = temp
pattern1 = None
pattern2 = None
for i in range(1 << 16):
... | n = int(eval(input()))
n2 = n
ans = ""
for i in range(100):
while n != 0:
r = n % 2
n = (n - r) // (-2)
ans = str(r) + ans
if n2 == 0:
print("0")
else:
print(ans)
| false | 75.510204 | [
"-import bisect",
"-",
"-ps = [0] * (1 << 16)",
"-for i in range(1 << 16):",
"- temp = 0",
"- x = 1",
"- for j in range(16):",
"- if (i >> j) & 1:",
"- # temp += (-2) ** (2 *j)",
"- temp += x",
"- x *= 4",
"- ps[i] = temp",
"-pat... | false | 1.545929 | 0.039412 | 39.224447 | [
"s412898993",
"s617304118"
] |
u906428167 | p02758 | python | s077294460 | s746089240 | 1,971 | 1,459 | 131,032 | 127,540 | Accepted | Accepted | 25.98 | from bisect import bisect_left
MOD = 998244353
n = int(eval(input()))
robot = []
pos = []
for i in range(n):
x, d = list(map(int, input().split()))
robot.append([x, x+d])
pos.append(x)
robot = sorted(robot, key=lambda y: y[0])
pos = sorted(pos)
def init(init_val):
for i in range(n)... | from bisect import bisect_left
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
MOD = 998244353
n = int(eval(input()))
robot = []
pos = []
for i in range(n):
x, d = list(map(int, input().split()))
robot.append([x, x+d])
pos.append(x)
robot = sorted(robot, key=lambda y... | 103 | 86 | 1,962 | 1,603 | from bisect import bisect_left
MOD = 998244353
n = int(eval(input()))
robot = []
pos = []
for i in range(n):
x, d = list(map(int, input().split()))
robot.append([x, x + d])
pos.append(x)
robot = sorted(robot, key=lambda y: y[0])
pos = sorted(pos)
def init(init_val):
for i in range(n):
MI[i + ... | from bisect import bisect_left
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
MOD = 998244353
n = int(eval(input()))
robot = []
pos = []
for i in range(n):
x, d = list(map(int, input().split()))
robot.append([x, x + d])
pos.append(x)
robot = sorted(robot, key=lambda y: y[0])
pos = sorte... | false | 16.504854 | [
"+import sys",
"+sys.setrecursionlimit(10**7)",
"+input = sys.stdin.readline",
"-",
"-",
"-def rangemin(p, q):",
"- if q <= p:",
"- return 1 << 100",
"- p += num - 1",
"- q += num - 2",
"- res = 1 << 100",
"- while q - p > 1:",
"- if p & 1 == 0:",
"- ... | false | 0.046903 | 0.046383 | 1.011223 | [
"s077294460",
"s746089240"
] |
u254871849 | p03286 | python | s103482862 | s150621759 | 20 | 17 | 3,064 | 3,060 | Accepted | Accepted | 15 | import sys
n = int(sys.stdin.readline().rstrip())
def base_convert(n, base):
res = []
b = abs(base)
while n:
q, r = divmod(n, b)
res.append(r)
n = b * q // base
try:
return int(''.join(list(map(str, res)))[::-1])
except:
return 0
def main():... | import sys
n = int(sys.stdin.readline().rstrip())
def base_convert(n, b):
res = ''
while n:
r = abs(n % b)
res = str(r) + res
n = (n - r) // b
return int(res) if res else 0
def main():
return base_convert(n, -2)
if __name__ == '__main__':
ans = main()
... | 22 | 19 | 416 | 333 | import sys
n = int(sys.stdin.readline().rstrip())
def base_convert(n, base):
res = []
b = abs(base)
while n:
q, r = divmod(n, b)
res.append(r)
n = b * q // base
try:
return int("".join(list(map(str, res)))[::-1])
except:
return 0
def main():
return ba... | import sys
n = int(sys.stdin.readline().rstrip())
def base_convert(n, b):
res = ""
while n:
r = abs(n % b)
res = str(r) + res
n = (n - r) // b
return int(res) if res else 0
def main():
return base_convert(n, -2)
if __name__ == "__main__":
ans = main()
print(ans)
| false | 13.636364 | [
"-def base_convert(n, base):",
"- res = []",
"- b = abs(base)",
"+def base_convert(n, b):",
"+ res = \"\"",
"- q, r = divmod(n, b)",
"- res.append(r)",
"- n = b * q // base",
"- try:",
"- return int(\"\".join(list(map(str, res)))[::-1])",
"- except:",
... | false | 0.008039 | 0.043366 | 0.185371 | [
"s103482862",
"s150621759"
] |
u975039852 | p02862 | python | s585666413 | s647303075 | 791 | 223 | 82,276 | 3,064 | Accepted | Accepted | 71.81 | x, y = list(map(int, input().split()))
mod = 1000000007
class Combination:
"""
O(n)の前計算を1回行うことで,O(1)でnCr mod mを求められる
n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
使用例:
comb = Combination(1000000)
print(comb(5, 3)) # 10
"""
def __init__(self, n_max, mod=10**9+7):
... | x, y = list(map(int, input().split()))
mod = 10**9+7
def inv(x):
return pow(x, mod-2, mod)
def fact(x):
f = 1
for i in range(1, x + 1):
f *= i
f %= mod
return f
def comb(n, r):
return (fact(n) * inv(fact(n-r)) * inv(fact(r))) % mo... | 45 | 22 | 1,356 | 466 | x, y = list(map(int, input().split()))
mod = 1000000007
class Combination:
"""
O(n)の前計算を1回行うことで,O(1)でnCr mod mを求められる
n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
使用例:
comb = Combination(1000000)
print(comb(5, 3)) # 10
"""
def __init__(self, n_max, mod=10**9 + 7):
... | x, y = list(map(int, input().split()))
mod = 10**9 + 7
def inv(x):
return pow(x, mod - 2, mod)
def fact(x):
f = 1
for i in range(1, x + 1):
f *= i
f %= mod
return f
def comb(n, r):
return (fact(n) * inv(fact(n - r)) * inv(fact(r))) % mod
if (x + y) % 3 != 0:
print((0))
el... | false | 51.111111 | [
"-mod = 1000000007",
"+mod = 10**9 + 7",
"-class Combination:",
"- \"\"\"",
"- O(n)の前計算を1回行うことで,O(1)でnCr mod mを求められる",
"- n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)",
"- 使用例:",
"- comb = Combination(1000000)",
"- print(comb(5, 3)) # 10",
"- \"\"\"",
"+def inv(... | false | 0.317897 | 0.071598 | 4.440028 | [
"s585666413",
"s647303075"
] |
u151005508 | p03721 | python | s037809465 | s118763179 | 724 | 613 | 68,184 | 61,016 | Accepted | Accepted | 15.33 | N, K = list(map(int, input().split()))
ab=[]
for _ in range(N):
ab.append(tuple(map(int, input().split())))
ab=sorted(ab, key=lambda x:x[0])
#print(ab)
accum=[0]
for i in range(len(ab)):
accum.append(accum[i]+ab[i][1])
#print(accum)
for i in range(len(ab)):
#print(accum[i], accum[i+1])
if ac... | N, K = list(map(int, input().split()))
ab=[]
for _ in range(N):
ab.append(tuple(map(int, input().split())))
num=[0]*(10**5+1)
for el in ab:
num[el[0]]+=el[1]
#print(num)
count=0
for i in range(10**5+1):
count+=num[i]
if count>=K:
print(i)
break
| 15 | 15 | 379 | 286 | N, K = list(map(int, input().split()))
ab = []
for _ in range(N):
ab.append(tuple(map(int, input().split())))
ab = sorted(ab, key=lambda x: x[0])
# print(ab)
accum = [0]
for i in range(len(ab)):
accum.append(accum[i] + ab[i][1])
# print(accum)
for i in range(len(ab)):
# print(accum[i], accum[i+1])
if ac... | N, K = list(map(int, input().split()))
ab = []
for _ in range(N):
ab.append(tuple(map(int, input().split())))
num = [0] * (10**5 + 1)
for el in ab:
num[el[0]] += el[1]
# print(num)
count = 0
for i in range(10**5 + 1):
count += num[i]
if count >= K:
print(i)
break
| false | 0 | [
"-ab = sorted(ab, key=lambda x: x[0])",
"-# print(ab)",
"-accum = [0]",
"-for i in range(len(ab)):",
"- accum.append(accum[i] + ab[i][1])",
"-# print(accum)",
"-for i in range(len(ab)):",
"- # print(accum[i], accum[i+1])",
"- if accum[i] < K <= accum[i + 1]:",
"- print((ab[i][0]))"... | false | 0.068391 | 0.051158 | 1.336859 | [
"s037809465",
"s118763179"
] |
u729133443 | p03045 | python | s549034673 | s586570792 | 1,461 | 376 | 144,380 | 32,180 | Accepted | Accepted | 74.26 | r=lambda x:x if u[x]<0else r(u[x])
n,m,*t=list(map(int,open(0).read().split()))
u=[-1]*-~n
for x,y in zip(t[::3],t[1::3]):
x,y=sorted((r(x),r(y)))
if x!=y:u[x]+=u[y];u[y]=x
print((sum(i<0for i in u)-1)) | r=lambda x:x*(u[x]<0)or r(u[x])
n,m,*t=list(map(int,open(0).read().split()))
u=[-1]*-~n
for x,y in zip(t[::3],t[1::3]):
x,y=sorted((r(x),r(y)))
if x!=y:u[x]+=u[y];u[y]=x
print((sum(i<0for i in u)-1)) | 7 | 7 | 202 | 199 | r = lambda x: x if u[x] < 0 else r(u[x])
n, m, *t = list(map(int, open(0).read().split()))
u = [-1] * -~n
for x, y in zip(t[::3], t[1::3]):
x, y = sorted((r(x), r(y)))
if x != y:
u[x] += u[y]
u[y] = x
print((sum(i < 0 for i in u) - 1))
| r = lambda x: x * (u[x] < 0) or r(u[x])
n, m, *t = list(map(int, open(0).read().split()))
u = [-1] * -~n
for x, y in zip(t[::3], t[1::3]):
x, y = sorted((r(x), r(y)))
if x != y:
u[x] += u[y]
u[y] = x
print((sum(i < 0 for i in u) - 1))
| false | 0 | [
"-r = lambda x: x if u[x] < 0 else r(u[x])",
"+r = lambda x: x * (u[x] < 0) or r(u[x])"
] | false | 0.092271 | 0.047902 | 1.926254 | [
"s549034673",
"s586570792"
] |
u222668979 | p03608 | python | s334873173 | s849172838 | 228 | 204 | 78,436 | 73,492 | Accepted | Accepted | 10.53 | from copy import deepcopy
from itertools import permutations
def warshallfloyd(N, LIST): # ワーシャルフロイド法:全頂点対最短経路 O(n**3)
DIST = deepcopy(LIST)
for k in range(N):
for i in range(N):
for j in range(N):
DIST[i][j] = min(DIST[i][j], DIST[i][k] + DIST[k][j])
return ... | from copy import deepcopy
from itertools import permutations
def warshallfloyd(N): # ワーシャルフロイド法:全頂点対最短経路 O(n**3)
DIST = deepcopy(mat)
for k in range(N):
for i in range(N):
for j in range(N):
DIST[i][j] = min(DIST[i][j], DIST[i][k] + DIST[k][j])
return DIST
... | 33 | 33 | 856 | 844 | from copy import deepcopy
from itertools import permutations
def warshallfloyd(N, LIST): # ワーシャルフロイド法:全頂点対最短経路 O(n**3)
DIST = deepcopy(LIST)
for k in range(N):
for i in range(N):
for j in range(N):
DIST[i][j] = min(DIST[i][j], DIST[i][k] + DIST[k][j])
return DIST
n, ... | from copy import deepcopy
from itertools import permutations
def warshallfloyd(N): # ワーシャルフロイド法:全頂点対最短経路 O(n**3)
DIST = deepcopy(mat)
for k in range(N):
for i in range(N):
for j in range(N):
DIST[i][j] = min(DIST[i][j], DIST[i][k] + DIST[k][j])
return DIST
n, m, r = ... | false | 0 | [
"-def warshallfloyd(N, LIST): # ワーシャルフロイド法:全頂点対最短経路 O(n**3)",
"- DIST = deepcopy(LIST)",
"+def warshallfloyd(N): # ワーシャルフロイド法:全頂点対最短経路 O(n**3)",
"+ DIST = deepcopy(mat)",
"-dist = warshallfloyd(n, mat)",
"+dist = warshallfloyd(n)"
] | false | 0.040842 | 0.040484 | 1.008855 | [
"s334873173",
"s849172838"
] |
u281303342 | p03408 | python | s214202316 | s328345698 | 22 | 20 | 3,316 | 3,316 | Accepted | Accepted | 9.09 | N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
M = int(eval(input()))
T = [eval(input()) for _ in range(M)]
from collections import Counter
CS = Counter(S).most_common()
CT = Counter(T)
ans = 0
for cs in CS:
k,v = cs
ans = max(ans, v-CT[k])
print(ans)
| # Python3 (3.4.3)
import sys
input = sys.stdin.readline
# -------------------------------------------------------------
# function
# -------------------------------------------------------------
# -------------------------------------------------------------
# main
# --------------------------------------... | 15 | 30 | 267 | 660 | N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
M = int(eval(input()))
T = [eval(input()) for _ in range(M)]
from collections import Counter
CS = Counter(S).most_common()
CT = Counter(T)
ans = 0
for cs in CS:
k, v = cs
ans = max(ans, v - CT[k])
print(ans)
| # Python3 (3.4.3)
import sys
input = sys.stdin.readline
# -------------------------------------------------------------
# function
# -------------------------------------------------------------
# -------------------------------------------------------------
# main
# ---------------------------------------------------... | false | 50 | [
"+# Python3 (3.4.3)",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+# function",
"+# main",
"-S = [eval(input()) for _ in range(N)]",
"+S = [input().rstrip() for _ in range(N)]",
"-T = [eval(input()) for _ in range(M)]",
"-from collections import Counter",
"+T = [input().rstrip() for _ in... | false | 0.040108 | 0.050065 | 0.801126 | [
"s214202316",
"s328345698"
] |
u607563136 | p03805 | python | s320684624 | s181850759 | 44 | 36 | 9,220 | 9,108 | Accepted | Accepted | 18.18 | N,M = list(map(int,input().split()))
path = [[0]*(N+1) for _ in range(N+1)]
for i in range(M):
a,b = list(map(int,input().split()))
path[a][b] = 1
path[b][a] = 1
visited = [0]*(N+1)
def dfs(now,depth):
if visited[now]:
return 0
if depth == N:
return 1 # 最後まで探索したらはじ... | def dfs(g,v,depth):
if seen[v]==True:return 0
if depth==n:return 1
seen[v] = True
paths = 0
for next_v in g[v]:
paths += dfs(g,next_v,depth+1)
seen[v] = False
return paths
n,m = list(map(int,input().split()))
g = [[]*(n+1) for _ in range(n+1)]
for _ in range(... | 30 | 22 | 558 | 442 | N, M = list(map(int, input().split()))
path = [[0] * (N + 1) for _ in range(N + 1)]
for i in range(M):
a, b = list(map(int, input().split()))
path[a][b] = 1
path[b][a] = 1
visited = [0] * (N + 1)
def dfs(now, depth):
if visited[now]:
return 0
if depth == N:
return 1 # 最後まで探索したらはじめ... | def dfs(g, v, depth):
if seen[v] == True:
return 0
if depth == n:
return 1
seen[v] = True
paths = 0
for next_v in g[v]:
paths += dfs(g, next_v, depth + 1)
seen[v] = False
return paths
n, m = list(map(int, input().split()))
g = [[] * (n + 1) for _ in range(n + 1)]
fo... | false | 26.666667 | [
"-N, M = list(map(int, input().split()))",
"-path = [[0] * (N + 1) for _ in range(N + 1)]",
"-for i in range(M):",
"- a, b = list(map(int, input().split()))",
"- path[a][b] = 1",
"- path[b][a] = 1",
"-visited = [0] * (N + 1)",
"+def dfs(g, v, depth):",
"+ if seen[v] == True:",
"+ ... | false | 0.031656 | 0.036175 | 0.875094 | [
"s320684624",
"s181850759"
] |
u580697892 | p03262 | python | s567076175 | s003465201 | 109 | 92 | 14,748 | 16,304 | Accepted | Accepted | 15.6 | #coding: utf-8
from functools import reduce
def gcd(a, b):
if b == 0:
return max(a, b)
else:
return gcd(b, a%b)
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
x = [abs(X - x[i]) for i in range(N)]
print((reduce(gcd, x))) | #coding: utf-8
from functools import reduce
from fractions import gcd #py<=3.4
#from math import gcd # py >= 3.5
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
res = [abs(x[i] - X) for i in range(N)]
print((reduce(gcd, res))) | 12 | 8 | 276 | 258 | # coding: utf-8
from functools import reduce
def gcd(a, b):
if b == 0:
return max(a, b)
else:
return gcd(b, a % b)
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
x = [abs(X - x[i]) for i in range(N)]
print((reduce(gcd, x)))
| # coding: utf-8
from functools import reduce
from fractions import gcd # py<=3.4
# from math import gcd # py >= 3.5
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
res = [abs(x[i] - X) for i in range(N)]
print((reduce(gcd, res)))
| false | 33.333333 | [
"+from fractions import gcd # py<=3.4",
"-",
"-def gcd(a, b):",
"- if b == 0:",
"- return max(a, b)",
"- else:",
"- return gcd(b, a % b)",
"-",
"-",
"+# from math import gcd # py >= 3.5",
"-x = [abs(X - x[i]) for i in range(N)]",
"-print((reduce(gcd, x)))",
"+res = [a... | false | 0.03749 | 0.046963 | 0.798296 | [
"s567076175",
"s003465201"
] |
u350248178 | p03816 | python | s237723949 | s686575776 | 53 | 48 | 14,396 | 14,396 | Accepted | Accepted | 9.43 | n=int(eval(input()))
a=[int(j) for j in input().split()]
tmp=len(set(a))
while n>tmp:
n-=2
print(n) | n=int(eval(input()))
a=[int(j) for j in input().split()]
ans=len(set(a))
if (n-ans)%2==0:
print(ans)
else:
print((ans-1))
| 6 | 7 | 102 | 128 | n = int(eval(input()))
a = [int(j) for j in input().split()]
tmp = len(set(a))
while n > tmp:
n -= 2
print(n)
| n = int(eval(input()))
a = [int(j) for j in input().split()]
ans = len(set(a))
if (n - ans) % 2 == 0:
print(ans)
else:
print((ans - 1))
| false | 14.285714 | [
"-tmp = len(set(a))",
"-while n > tmp:",
"- n -= 2",
"-print(n)",
"+ans = len(set(a))",
"+if (n - ans) % 2 == 0:",
"+ print(ans)",
"+else:",
"+ print((ans - 1))"
] | false | 0.049133 | 0.048238 | 1.018557 | [
"s237723949",
"s686575776"
] |
u078042885 | p00728 | python | s954172329 | s162972366 | 30 | 20 | 7,692 | 7,568 | Accepted | Accepted | 33.33 | while 1:
n=int(eval(input()))
if n==0:break
print(((sum(sorted([int(eval(input())) for _ in range(n)])[1:-1]))//(n-2))) | while 1:
n=int(eval(input()))
if n<3:break
print(((sum(sorted([int(eval(input())) for _ in [0]*n])[1:-1]))//(n-2))) | 4 | 4 | 120 | 116 | while 1:
n = int(eval(input()))
if n == 0:
break
print(((sum(sorted([int(eval(input())) for _ in range(n)])[1:-1])) // (n - 2)))
| while 1:
n = int(eval(input()))
if n < 3:
break
print(((sum(sorted([int(eval(input())) for _ in [0] * n])[1:-1])) // (n - 2)))
| false | 0 | [
"- if n == 0:",
"+ if n < 3:",
"- print(((sum(sorted([int(eval(input())) for _ in range(n)])[1:-1])) // (n - 2)))",
"+ print(((sum(sorted([int(eval(input())) for _ in [0] * n])[1:-1])) // (n - 2)))"
] | false | 0.039911 | 0.044473 | 0.897407 | [
"s954172329",
"s162972366"
] |
u912237403 | p00040 | python | s231996323 | s708195413 | 30 | 20 | 4,424 | 4,276 | Accepted | Accepted | 33.33 | import string
A2Z="abcdefghijklmnopqrstuvwxyz"
R=list(range(26))
def decode(msg,L):
x=""
for c in msg: x+=(L[A2Z.index(c)] if "a"<=c<="z" else c)
return x
def affine(msg, a, b):
L="".join([A2Z[(i*a+b)%26]for i in R])
s = decode(msg,L)
return s
def rot(msg, a):
a = a % 26
... | A2Z="abcdefghijklmnopqrstuvwxyz"
def affine(msg, a, b):
s=""
for c in msg: s+=(A2Z[(A2Z.index(c)*a+b)%26] if "a"<=c<="z" else c)
return s
def rot(msg, a):
a = a % 26
L = A2Z[a:]+A2Z[:a]
s=""
for c in msg: s+=(L[A2Z.index(c)] if "a"<=c<="z" else c)
return s
def checkkey(s... | 40 | 35 | 814 | 753 | import string
A2Z = "abcdefghijklmnopqrstuvwxyz"
R = list(range(26))
def decode(msg, L):
x = ""
for c in msg:
x += L[A2Z.index(c)] if "a" <= c <= "z" else c
return x
def affine(msg, a, b):
L = "".join([A2Z[(i * a + b) % 26] for i in R])
s = decode(msg, L)
return s
def rot(msg, a):... | A2Z = "abcdefghijklmnopqrstuvwxyz"
def affine(msg, a, b):
s = ""
for c in msg:
s += A2Z[(A2Z.index(c) * a + b) % 26] if "a" <= c <= "z" else c
return s
def rot(msg, a):
a = a % 26
L = A2Z[a:] + A2Z[:a]
s = ""
for c in msg:
s += L[A2Z.index(c)] if "a" <= c <= "z" else c
... | false | 12.5 | [
"-import string",
"-",
"-R = list(range(26))",
"-",
"-",
"-def decode(msg, L):",
"- x = \"\"",
"- for c in msg:",
"- x += L[A2Z.index(c)] if \"a\" <= c <= \"z\" else c",
"- return x",
"- L = \"\".join([A2Z[(i * a + b) % 26] for i in R])",
"- s = decode(msg, L)",
"+ s... | false | 0.051603 | 0.048916 | 1.054939 | [
"s231996323",
"s708195413"
] |
u654470292 | p02900 | python | s763474931 | s520852937 | 292 | 126 | 65,132 | 9,972 | Accepted | Accepted | 56.85 | import sys
from fractions import gcd
def input():
return sys.stdin.readline()[:-1]
a,b=list(map(int,input().split()))
tmp=gcd(a,b)
# print(tmp)
def factorization(n):
arr = []
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
if temp%i==0:
cnt=0
while temp%i==... | import bisect, copy, heapq, math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
sys.setrecursionlimit(5000000)
mo... | 32 | 37 | 613 | 899 | import sys
from fractions import gcd
def input():
return sys.stdin.readline()[:-1]
a, b = list(map(int, input().split()))
tmp = gcd(a, b)
# print(tmp)
def factorization(n):
arr = []
temp = n
for i in range(2, int(-(-(n**0.5) // 1)) + 1):
if temp % i == 0:
cnt = 0
whil... | import bisect, copy, heapq, math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0] + list(accumulate(lst))
sys.setrecursionlimit(5000000)
mod ... | false | 13.513514 | [
"+import bisect, copy, heapq, math",
"-from fractions import gcd",
"+from collections import *",
"+from functools import lru_cache",
"+from itertools import accumulate, combinations, permutations, product",
"+def ruiseki(lst):",
"+ return [0] + list(accumulate(lst))",
"+",
"+",
"+sys.setrecursi... | false | 0.04546 | 0.038376 | 1.184615 | [
"s763474931",
"s520852937"
] |
u959519702 | p03078 | python | s143073841 | s030321131 | 180 | 87 | 35,816 | 40,092 | Accepted | Accepted | 51.67 | def get_input():
X, Y, Z, K = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]
B = [int(_) for _ in input().split()]
C = [int(_) for _ in input().split()]
return X, Y, Z, K, A, B, C
def AddToQueue(_ele, _queue, _ijk_set, K):
if len(_queue) == 0:
_queue.ap... | def get_input():
X, Y, Z, K = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]
B = [int(_) for _ in input().split()]
C = [int(_) for _ in input().split()]
return X, Y, Z, K, A, B, C
def solve2():
X, Y, Z, K, A, B, C = get_input()
A.sort(reverse = True)
B... | 40 | 27 | 1,304 | 805 | def get_input():
X, Y, Z, K = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]
B = [int(_) for _ in input().split()]
C = [int(_) for _ in input().split()]
return X, Y, Z, K, A, B, C
def AddToQueue(_ele, _queue, _ijk_set, K):
if len(_queue) == 0:
_queue.append(_el... | def get_input():
X, Y, Z, K = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]
B = [int(_) for _ in input().split()]
C = [int(_) for _ in input().split()]
return X, Y, Z, K, A, B, C
def solve2():
X, Y, Z, K, A, B, C = get_input()
A.sort(reverse=True)
B.sort(rever... | false | 32.5 | [
"-def AddToQueue(_ele, _queue, _ijk_set, K):",
"- if len(_queue) == 0:",
"- _queue.append(_ele)",
"- else:",
"- cnt = 0",
"- while cnt < len(_queue) and _queue[cnt][0] >= _ele[0]:",
"- cnt += 1",
"- ijk = (_ele[1], _ele[2], _ele[3])",
"- if not (ij... | false | 0.037859 | 0.037858 | 1.000026 | [
"s143073841",
"s030321131"
] |
u585482323 | p02913 | python | s544593169 | s960712664 | 999 | 693 | 52,316 | 49,116 | Accepted | Accepted | 30.63 | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline()... | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline()... | 62 | 58 | 1,468 | 1,394 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
return [list(x) for x in sys.stdin... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
return [list(x) for x in sys.stdin... | false | 6.451613 | [
"- j = 0",
"+ c = 1",
"- while i + j < n and s[j] == s[i + j]:",
"- j += 1",
"- z[i] = j",
"- if j == 0:",
"- i += 1",
"- continue",
"- k = 1",
"- while i + k < n and k + z[k] < j:",
... | false | 0.143409 | 0.036632 | 3.914907 | [
"s544593169",
"s960712664"
] |
u019584841 | p03777 | python | s923202705 | s104666289 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | val = input().split()
print(("H" if val[0] == val[1] else "D"))
| a,b=input().split()
if a==b=="H" or a==b=="D":
print("H")
else:
print("D")
| 2 | 5 | 63 | 83 | val = input().split()
print(("H" if val[0] == val[1] else "D"))
| a, b = input().split()
if a == b == "H" or a == b == "D":
print("H")
else:
print("D")
| false | 60 | [
"-val = input().split()",
"-print((\"H\" if val[0] == val[1] else \"D\"))",
"+a, b = input().split()",
"+if a == b == \"H\" or a == b == \"D\":",
"+ print(\"H\")",
"+else:",
"+ print(\"D\")"
] | false | 0.045712 | 0.044874 | 1.018676 | [
"s923202705",
"s104666289"
] |
u620084012 | p03228 | python | s038713785 | s288306385 | 162 | 17 | 40,024 | 2,940 | Accepted | Accepted | 89.51 | A, B, K = list(map(int,input().split()))
for k in range(K):
if k%2 == 0:
if A%2 == 0:
A //= 2
B += A
else:
A -= 1
A //= 2
B += A
else:
if B%2 == 0:
B //= 2
A += B
else:
... | A, B, K = list(map(int,input().split()))
for k in range(K):
if k%2 == 0:
A, B = A//2, B+A//2
else:
A, B = A+B//2, B//2
print((A,B))
| 20 | 7 | 375 | 154 | A, B, K = list(map(int, input().split()))
for k in range(K):
if k % 2 == 0:
if A % 2 == 0:
A //= 2
B += A
else:
A -= 1
A //= 2
B += A
else:
if B % 2 == 0:
B //= 2
A += B
else:
B -= 1
... | A, B, K = list(map(int, input().split()))
for k in range(K):
if k % 2 == 0:
A, B = A // 2, B + A // 2
else:
A, B = A + B // 2, B // 2
print((A, B))
| false | 65 | [
"- if A % 2 == 0:",
"- A //= 2",
"- B += A",
"- else:",
"- A -= 1",
"- A //= 2",
"- B += A",
"+ A, B = A // 2, B + A // 2",
"- if B % 2 == 0:",
"- B //= 2",
"- A += B",
"- else:",
... | false | 0.09993 | 0.084532 | 1.182152 | [
"s038713785",
"s288306385"
] |
u208133431 | p02584 | python | s262990954 | s239992867 | 33 | 26 | 9,136 | 9,128 | Accepted | Accepted | 21.21 | X,K,D=list(map(int,input().split()))
kai = 0
xy = abs(X)
if xy >= K*D:
kotae = abs(xy-(K*D))
if xy < K*D:
kai, mod = divmod(xy, D)
ds = kai*D
if (K-kai)%2==0:
kotae = abs(xy-ds)
if (K-kai)%2!=0:
kotae = abs(xy-ds-D)
print(kotae) | X,K,D=list(map(int,input().split()))
zettaitix = abs(X)
if zettaitix >= K*D:
kotae = abs(zettaitix-(K*D))
elif zettaitix < K*D:
kai, mod = divmod(zettaitix, D)
ds = kai*D
if (K-kai)%2==0:
kotae = abs(zettaitix-ds)
elif (K-kai)%2!=0:
kotae = abs(zettaitix-ds-D)
print(kotae) | 13 | 12 | 270 | 314 | X, K, D = list(map(int, input().split()))
kai = 0
xy = abs(X)
if xy >= K * D:
kotae = abs(xy - (K * D))
if xy < K * D:
kai, mod = divmod(xy, D)
ds = kai * D
if (K - kai) % 2 == 0:
kotae = abs(xy - ds)
if (K - kai) % 2 != 0:
kotae = abs(xy - ds - D)
print(kotae)
| X, K, D = list(map(int, input().split()))
zettaitix = abs(X)
if zettaitix >= K * D:
kotae = abs(zettaitix - (K * D))
elif zettaitix < K * D:
kai, mod = divmod(zettaitix, D)
ds = kai * D
if (K - kai) % 2 == 0:
kotae = abs(zettaitix - ds)
elif (K - kai) % 2 != 0:
kotae = abs(zettaitix ... | false | 7.692308 | [
"-kai = 0",
"-xy = abs(X)",
"-if xy >= K * D:",
"- kotae = abs(xy - (K * D))",
"-if xy < K * D:",
"- kai, mod = divmod(xy, D)",
"+zettaitix = abs(X)",
"+if zettaitix >= K * D:",
"+ kotae = abs(zettaitix - (K * D))",
"+elif zettaitix < K * D:",
"+ kai, mod = divmod(zettaitix, D)",
"... | false | 0.042605 | 0.007602 | 5.60482 | [
"s262990954",
"s239992867"
] |
u274005011 | p02657 | python | s391480777 | s812859891 | 31 | 27 | 9,144 | 8,888 | Accepted | Accepted | 12.9 | X, Y = list(map(int, input().split()))
print(("{}".format(X*Y))) | a, b = input().split()
print((int(a)*int(b))) | 3 | 3 | 59 | 46 | X, Y = list(map(int, input().split()))
print(("{}".format(X * Y)))
| a, b = input().split()
print((int(a) * int(b)))
| false | 0 | [
"-X, Y = list(map(int, input().split()))",
"-print((\"{}\".format(X * Y)))",
"+a, b = input().split()",
"+print((int(a) * int(b)))"
] | false | 0.097979 | 0.064112 | 1.528247 | [
"s391480777",
"s812859891"
] |
u332385682 | p04013 | python | s312546045 | s698438862 | 814 | 537 | 62,960 | 4,084 | Accepted | Accepted | 34.03 | def solve():
N, A = list(map(int, input().split()))
x = [int(i) for i in input().split()]
# 3d DP
max_x = max(x)
dp = [[[0] * (max_x * N + 1) for j in range(N + 1)]
for i in range(N + 1)]
dp[0][0][0] = 1
for i in range(0, N):
for ... | def solve():
N, A = list(map(int, input().split()))
x = [int(i) for i in input().split()]
lim = sum(x)
dp = [[0]*(lim + 1) for i in range(N + 1)]
dp[0][0] = 1
for i in range(N):
for k in range(i + 1, 0, -1):
for v in range(lim, x[i] - 1, -1):
... | 29 | 25 | 779 | 552 | def solve():
N, A = list(map(int, input().split()))
x = [int(i) for i in input().split()]
# 3d DP
max_x = max(x)
dp = [[[0] * (max_x * N + 1) for j in range(N + 1)] for i in range(N + 1)]
dp[0][0][0] = 1
for i in range(0, N):
for k in range(0, N + 1):
for y in range(max_x... | def solve():
N, A = list(map(int, input().split()))
x = [int(i) for i in input().split()]
lim = sum(x)
dp = [[0] * (lim + 1) for i in range(N + 1)]
dp[0][0] = 1
for i in range(N):
for k in range(i + 1, 0, -1):
for v in range(lim, x[i] - 1, -1):
dp[k][v] += dp[... | false | 13.793103 | [
"- # 3d DP",
"- max_x = max(x)",
"- dp = [[[0] * (max_x * N + 1) for j in range(N + 1)] for i in range(N + 1)]",
"- dp[0][0][0] = 1",
"- for i in range(0, N):",
"- for k in range(0, N + 1):",
"- for y in range(max_x * N + 1):",
"- if dp[i][k][y]:",
"- ... | false | 0.048604 | 0.050114 | 0.969856 | [
"s312546045",
"s698438862"
] |
u176796545 | p03448 | python | s265113218 | s383915368 | 45 | 39 | 3,064 | 3,064 | Accepted | Accepted | 13.33 | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
count=0
for a in [a*500 for a in range(A + 1)]:
for j in range(B + 1):
for k in range(C + 1):
if a + 100*j + 50*k == X:
count += 1
print(count) | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
count=0
for a in [a*500 for a in range(A + 1)]:
for b in [b*100 for b in range(B + 1)]:
for k in range(C + 1):
if a + b + 50*k == X:
count += 1
print(count) | 11 | 11 | 261 | 274 | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
count = 0
for a in [a * 500 for a in range(A + 1)]:
for j in range(B + 1):
for k in range(C + 1):
if a + 100 * j + 50 * k == X:
count += 1
print(count)
| A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
count = 0
for a in [a * 500 for a in range(A + 1)]:
for b in [b * 100 for b in range(B + 1)]:
for k in range(C + 1):
if a + b + 50 * k == X:
count += 1
print(count)
| false | 0 | [
"- for j in range(B + 1):",
"+ for b in [b * 100 for b in range(B + 1)]:",
"- if a + 100 * j + 50 * k == X:",
"+ if a + b + 50 * k == X:"
] | false | 0.089398 | 0.098173 | 0.910626 | [
"s265113218",
"s383915368"
] |
u083960235 | p03136 | python | s238556839 | s031253790 | 40 | 26 | 5,396 | 3,896 | Accepted | Accepted | 35 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | 34 | 28 | 996 | 849 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | false | 17.647059 | [
"-from fractions import gcd",
"+from heapq import heapify, heappop, heappush",
"-m = max(L)",
"-for i in range(N):",
"- a = L[i]",
"- # b = L[:i-1] + L[i:]",
"- # print(L[:i-1] + L[i:])",
"- if a == m:",
"- if sum(L) - a > a:",
"- print(\"Yes\")",
"- brea... | false | 0.036904 | 0.035631 | 1.035731 | [
"s238556839",
"s031253790"
] |
u641357568 | p02397 | python | s884053698 | s259033329 | 60 | 50 | 5,608 | 5,608 | Accepted | Accepted | 16.67 | while(True):
i,j=input().split()
if i != '0' or j != '0':
if int(i) <= int(j):
print(('{} {}'.format(i,j)))
else:
print(('{} {}'.format(j,i)))
else:
break
| while(True):
i,j=input().split()
if i != '0' or j != '0':
if int(i) <= int(j):
print((i+' '+j))
else:
print((j+' '+i))
else:
break
| 10 | 10 | 225 | 201 | while True:
i, j = input().split()
if i != "0" or j != "0":
if int(i) <= int(j):
print(("{} {}".format(i, j)))
else:
print(("{} {}".format(j, i)))
else:
break
| while True:
i, j = input().split()
if i != "0" or j != "0":
if int(i) <= int(j):
print((i + " " + j))
else:
print((j + " " + i))
else:
break
| false | 0 | [
"- print((\"{} {}\".format(i, j)))",
"+ print((i + \" \" + j))",
"- print((\"{} {}\".format(j, i)))",
"+ print((j + \" \" + i))"
] | false | 0.170907 | 0.046313 | 3.690292 | [
"s884053698",
"s259033329"
] |
u912237403 | p00068 | python | s782930907 | s432451246 | 20 | 10 | 4,264 | 4,268 | Accepted | Accepted | 50 | import sys
def side(p1,p2):
global D
y1,x1=p1
y2,x2=p2
dy=y2-y1
dx=x2-x1
for p3 in D:
if p1!=p3 and p2!=p3 and (p3[1]-x1)*dy-dx*(p3[0]-y1)<0:return 0
else:return 1
while 1:
n=eval(input())
if n==0:break
D=sorted([list(eval(input())) for i in range(n)])
p=p1=D[0]
while 1:
... | import sys
def side(p1,p2):
global D
y1,x1=p1
y2,x2=p2
dy=y2-y1
dx=x2-x1
for p3 in D:
if p1==p3 or p2==p3:continue
if (p3[1]-x1)*dy-dx*(p3[0]-y1)<0:return 0
else:return 1
while 1:
n=eval(input())
if n==0:break
D=sorted([list(eval(input())) for i in range(n)])
p=p1=D[0]
... | 23 | 24 | 427 | 439 | import sys
def side(p1, p2):
global D
y1, x1 = p1
y2, x2 = p2
dy = y2 - y1
dx = x2 - x1
for p3 in D:
if p1 != p3 and p2 != p3 and (p3[1] - x1) * dy - dx * (p3[0] - y1) < 0:
return 0
else:
return 1
while 1:
n = eval(input())
if n == 0:
break
... | import sys
def side(p1, p2):
global D
y1, x1 = p1
y2, x2 = p2
dy = y2 - y1
dx = x2 - x1
for p3 in D:
if p1 == p3 or p2 == p3:
continue
if (p3[1] - x1) * dy - dx * (p3[0] - y1) < 0:
return 0
else:
return 1
while 1:
n = eval(input())
... | false | 4.166667 | [
"- if p1 != p3 and p2 != p3 and (p3[1] - x1) * dy - dx * (p3[0] - y1) < 0:",
"+ if p1 == p3 or p2 == p3:",
"+ continue",
"+ if (p3[1] - x1) * dy - dx * (p3[0] - y1) < 0:"
] | false | 0.061723 | 0.044241 | 1.395147 | [
"s782930907",
"s432451246"
] |
u305366205 | p02972 | python | s531536788 | s577623248 | 677 | 308 | 7,148 | 8,380 | Accepted | Accepted | 54.51 | n = int(input())
a = list(map(int, input().split()))
b = [0] * n
# 後ろからボールの有無を決定
for i in range(n - 1, -1, -1):
cnt = 0
for j in range(2 * (i + 1), n + 1, i + 1):
cnt += b[j - 1]
# 条件と異なるならボールを投入
if cnt % 2 != a[i]:
b[i] = 1
m = b.count(1)
print(m)
for i in range(n):
if... | n = int(input())
a = list(map(int, input().split()))
b = [0] * (n + 1)
# 後ろからボールの有無を決定
for i in range(n, 0, -1):
cnt = sum(b[::i])
# 条件と異なるならボールを投入
if cnt % 2 != a[i - 1]:
b[i] = 1
m = sum(b)
print(m)
for i in range(1, n + 1):
if b[i]:
print(i, end=' ')
| 16 | 14 | 358 | 299 | n = int(input())
a = list(map(int, input().split()))
b = [0] * n
# 後ろからボールの有無を決定
for i in range(n - 1, -1, -1):
cnt = 0
for j in range(2 * (i + 1), n + 1, i + 1):
cnt += b[j - 1]
# 条件と異なるならボールを投入
if cnt % 2 != a[i]:
b[i] = 1
m = b.count(1)
print(m)
for i in range(n):
if b[i]:
... | n = int(input())
a = list(map(int, input().split()))
b = [0] * (n + 1)
# 後ろからボールの有無を決定
for i in range(n, 0, -1):
cnt = sum(b[::i])
# 条件と異なるならボールを投入
if cnt % 2 != a[i - 1]:
b[i] = 1
m = sum(b)
print(m)
for i in range(1, n + 1):
if b[i]:
print(i, end=" ")
| false | 12.5 | [
"-b = [0] * n",
"+b = [0] * (n + 1)",
"-for i in range(n - 1, -1, -1):",
"- cnt = 0",
"- for j in range(2 * (i + 1), n + 1, i + 1):",
"- cnt += b[j - 1]",
"+for i in range(n, 0, -1):",
"+ cnt = sum(b[::i])",
"- if cnt % 2 != a[i]:",
"+ if cnt % 2 != a[i - 1]:",
"-m = b.coun... | false | 0.113825 | 0.047627 | 2.389945 | [
"s531536788",
"s577623248"
] |
u785989355 | p03640 | python | s418944291 | s938950481 | 30 | 26 | 3,700 | 3,700 | Accepted | Accepted | 13.33 | h,w=list(map(int,input().split()))
n=int(eval(input()))
a=list(map(int,input().split()))
ret=[["0" for i in range(w)]for j in range(h)]
x=0
y=0
for i in range(n):
for j in range(a[i]):
ret[y][x]=str(i+1)
if y&1:
if x==0:
y+=1
else:
... |
H,W = list(map(int,input().split()))
N = int(eval(input()))
a = list(map(int,input().split()))
ans = []
current_a=a[0]
current_id = 1
for i in range(H):
w_ans = []
for j in range(W):
if current_a == 0:
current_a = a[current_id]
current_id += 1
... | 21 | 24 | 464 | 487 | h, w = list(map(int, input().split()))
n = int(eval(input()))
a = list(map(int, input().split()))
ret = [["0" for i in range(w)] for j in range(h)]
x = 0
y = 0
for i in range(n):
for j in range(a[i]):
ret[y][x] = str(i + 1)
if y & 1:
if x == 0:
y += 1
else:
... | H, W = list(map(int, input().split()))
N = int(eval(input()))
a = list(map(int, input().split()))
ans = []
current_a = a[0]
current_id = 1
for i in range(H):
w_ans = []
for j in range(W):
if current_a == 0:
current_a = a[current_id]
current_id += 1
current_a -= 1
... | false | 12.5 | [
"-h, w = list(map(int, input().split()))",
"-n = int(eval(input()))",
"+H, W = list(map(int, input().split()))",
"+N = int(eval(input()))",
"-ret = [[\"0\" for i in range(w)] for j in range(h)]",
"-x = 0",
"-y = 0",
"-for i in range(n):",
"- for j in range(a[i]):",
"- ret[y][x] = str(i +... | false | 0.145395 | 0.107406 | 1.353693 | [
"s418944291",
"s938950481"
] |
u864197622 | p02803 | python | s035957147 | s781336231 | 326 | 141 | 3,948 | 3,316 | Accepted | Accepted | 56.75 | from collections import deque
H, W = list(map(int, input().split()))
X = [[1 if a == "#" else 0 for a in eval(input())] for _ in range(H)]
def BFS(i0=0):
Q = deque([i0])
D = [-1] * (H * W)
D[i0] = 0
while Q:
x = Q.popleft()
i, j = x // W, x % W
for di, dj in ((0, 1), ... | from collections import deque
H, W = list(map(int, input().split()))
X = [1] * (W + 2)
for _ in range(H):
X += [1] + [1 if a == "#" else 0 for a in eval(input())] + [1]
X += [1] * (W + 2)
H, W = H+2, W+2
def BFS(i0=0):
Q = deque([i0])
D = [-1] * (H * W)
D[i0] = 0
while Q:
x = Q... | 27 | 27 | 751 | 636 | from collections import deque
H, W = list(map(int, input().split()))
X = [[1 if a == "#" else 0 for a in eval(input())] for _ in range(H)]
def BFS(i0=0):
Q = deque([i0])
D = [-1] * (H * W)
D[i0] = 0
while Q:
x = Q.popleft()
i, j = x // W, x % W
for di, dj in ((0, 1), (0, -1), ... | from collections import deque
H, W = list(map(int, input().split()))
X = [1] * (W + 2)
for _ in range(H):
X += [1] + [1 if a == "#" else 0 for a in eval(input())] + [1]
X += [1] * (W + 2)
H, W = H + 2, W + 2
def BFS(i0=0):
Q = deque([i0])
D = [-1] * (H * W)
D[i0] = 0
while Q:
x = Q.poplef... | false | 0 | [
"-X = [[1 if a == \"#\" else 0 for a in eval(input())] for _ in range(H)]",
"+X = [1] * (W + 2)",
"+for _ in range(H):",
"+ X += [1] + [1 if a == \"#\" else 0 for a in eval(input())] + [1]",
"+X += [1] * (W + 2)",
"+H, W = H + 2, W + 2",
"- i, j = x // W, x % W",
"- for di, dj in ((0,... | false | 0.033816 | 0.094052 | 0.359548 | [
"s035957147",
"s781336231"
] |
u941438707 | p02659 | python | s977830697 | s807691198 | 24 | 22 | 9,172 | 8,948 | Accepted | Accepted | 8.33 | a,b=list(map(str,input().split(" ")))
b,c=list(map(str,b.split(".")))
a=int(a)
b=int(b)
c=int(c)
print((a*b+a*c//100)) | a,b=list(map(int,input().replace(".","").split()))
print((a*b//100)) | 6 | 2 | 109 | 61 | a, b = list(map(str, input().split(" ")))
b, c = list(map(str, b.split(".")))
a = int(a)
b = int(b)
c = int(c)
print((a * b + a * c // 100))
| a, b = list(map(int, input().replace(".", "").split()))
print((a * b // 100))
| false | 66.666667 | [
"-a, b = list(map(str, input().split(\" \")))",
"-b, c = list(map(str, b.split(\".\")))",
"-a = int(a)",
"-b = int(b)",
"-c = int(c)",
"-print((a * b + a * c // 100))",
"+a, b = list(map(int, input().replace(\".\", \"\").split()))",
"+print((a * b // 100))"
] | false | 0.036004 | 0.036169 | 0.995437 | [
"s977830697",
"s807691198"
] |
u272028993 | p03702 | python | s499170806 | s825735083 | 158 | 124 | 34,332 | 35,688 | Accepted | Accepted | 21.52 | n,a,b=list(map(int,input().split()))
h=[int(input()) for _ in range(n)]
l=0
r=10**12
while r-l>1:
m=(r+l)/2
c=a-b
cnt=0
for i in range(n):
if h[i]-b*m<0:continue
if (h[i]-b*m)%c==0:
cnt+=(h[i]-b*m)/c
else:
cnt+=(h[i]-b*m)/c+1
if cnt<=m:
... | def min_bs(l,r):
l-=1
while r-l>1:
m=(r+l)/2
if check(m):
r=m
else:
l=m
return r
def check(m):
cnt=0
for i in range(n):
if h[i]-b*m<=0:continue
cnt+=(h[i]-b*m-1)/(a-b)+1
return True if m>=cnt else False
n,a,b=list... | 19 | 20 | 369 | 409 | n, a, b = list(map(int, input().split()))
h = [int(input()) for _ in range(n)]
l = 0
r = 10**12
while r - l > 1:
m = (r + l) / 2
c = a - b
cnt = 0
for i in range(n):
if h[i] - b * m < 0:
continue
if (h[i] - b * m) % c == 0:
cnt += (h[i] - b * m) / c
else:
... | def min_bs(l, r):
l -= 1
while r - l > 1:
m = (r + l) / 2
if check(m):
r = m
else:
l = m
return r
def check(m):
cnt = 0
for i in range(n):
if h[i] - b * m <= 0:
continue
cnt += (h[i] - b * m - 1) / (a - b) + 1
return T... | false | 5 | [
"+def min_bs(l, r):",
"+ l -= 1",
"+ while r - l > 1:",
"+ m = (r + l) / 2",
"+ if check(m):",
"+ r = m",
"+ else:",
"+ l = m",
"+ return r",
"+",
"+",
"+def check(m):",
"+ cnt = 0",
"+ for i in range(n):",
"+ if h[i] - b *... | false | 0.099105 | 0.103179 | 0.960519 | [
"s499170806",
"s825735083"
] |
u163703551 | p03732 | python | s870049372 | s046578848 | 1,450 | 317 | 3,188 | 3,188 | Accepted | Accepted | 78.14 | import sys
# sys.stdin = open('d1.in')
n, W = list(map(int, input().split()))
g = {}
w1 = 0
for i in range(n):
w, v = list(map(int, input().split()))
if i == 0:
w1 = w
for x in range(w, w + 4):
g[x] = []
g[w].append(v)
for w, values in list(g.items()):
values... | import sys
# sys.stdin = open('d1.in')
n, W = list(map(int, input().split()))
g = {}
w1 = 0
for i in range(n):
w, v = list(map(int, input().split()))
if i == 0:
w1 = w
for x in range(w, w + 4):
g[x] = []
g[w].append(v)
for w, values in list(g.items()):
values... | 38 | 44 | 1,076 | 1,183 | import sys
# sys.stdin = open('d1.in')
n, W = list(map(int, input().split()))
g = {}
w1 = 0
for i in range(n):
w, v = list(map(int, input().split()))
if i == 0:
w1 = w
for x in range(w, w + 4):
g[x] = []
g[w].append(v)
for w, values in list(g.items()):
values.sort(reverse=Tr... | import sys
# sys.stdin = open('d1.in')
n, W = list(map(int, input().split()))
g = {}
w1 = 0
for i in range(n):
w, v = list(map(int, input().split()))
if i == 0:
w1 = w
for x in range(w, w + 4):
g[x] = []
g[w].append(v)
for w, values in list(g.items()):
values.sort(reverse=Tr... | false | 13.636364 | [
"+sg = {}",
"+sg[w1] = {}",
"+sg[w1 + 1] = {}",
"+sg[w1 + 2] = {}",
"+sg[w1 + 3] = {}",
"+for a in range(len(g[w1]) + 1):",
"+ sg[w1][a] = sum(g[w1][:a])",
"+for b in range(len(g[w1 + 1]) + 1):",
"+ sg[w1 + 1][b] = sum(g[w1 + 1][:b])",
"+for c in range(len(g[w1 + 2]) + 1):",
"+ sg[w1 + ... | false | 0.038318 | 0.049985 | 0.766577 | [
"s870049372",
"s046578848"
] |
u597374218 | p02843 | python | s905881614 | s364172464 | 123 | 28 | 3,700 | 9,116 | Accepted | Accepted | 77.24 | X=int(eval(input()))
dp=[0]*(X+105)
dp[0]=1
for x in range(X):
if dp[x]==1:
for price in range(100,106):
dp[x+price]=1
print((dp[X])) | X=int(eval(input()))
div=X//100
mod=X%100
print((1 if 5*div>=mod else 0)) | 8 | 4 | 156 | 68 | X = int(eval(input()))
dp = [0] * (X + 105)
dp[0] = 1
for x in range(X):
if dp[x] == 1:
for price in range(100, 106):
dp[x + price] = 1
print((dp[X]))
| X = int(eval(input()))
div = X // 100
mod = X % 100
print((1 if 5 * div >= mod else 0))
| false | 50 | [
"-dp = [0] * (X + 105)",
"-dp[0] = 1",
"-for x in range(X):",
"- if dp[x] == 1:",
"- for price in range(100, 106):",
"- dp[x + price] = 1",
"-print((dp[X]))",
"+div = X // 100",
"+mod = X % 100",
"+print((1 if 5 * div >= mod else 0))"
] | false | 0.036322 | 0.036947 | 0.983098 | [
"s905881614",
"s364172464"
] |
u014333473 | p03836 | python | s195476739 | s519785820 | 29 | 26 | 9,196 | 9,172 | Accepted | Accepted | 10.34 | sx,sy,tx,ty=list(map(int,input().split()))
dx = tx - sx
dy = ty - sy
direction1 = 'U'*dy + 'R'*dx
direction2 = 'D'*dy + 'L'*dx
direction3 = 'L' + 'U'*(dy+1) + 'R'*(dx+1) + 'D'
direction4 = 'R' + 'D'*(dy+1) + 'L'*(dx+1) + 'U'
print((direction1+direction2+direction3+direction4)) | sx,sy,tx,ty=list(map(int,input().split()))
dx,dy=tx-sx,ty-sy
print((dy*'U'+dx*'R'+dy*'D'+(dx+1)*'L'+(dy+1)*'U'+(dx+1)*'R'+'D'+'R'+(dy+1)*'D'+(dx+1)*'L'+'U')) | 8 | 3 | 277 | 151 | sx, sy, tx, ty = list(map(int, input().split()))
dx = tx - sx
dy = ty - sy
direction1 = "U" * dy + "R" * dx
direction2 = "D" * dy + "L" * dx
direction3 = "L" + "U" * (dy + 1) + "R" * (dx + 1) + "D"
direction4 = "R" + "D" * (dy + 1) + "L" * (dx + 1) + "U"
print((direction1 + direction2 + direction3 + direction4))
| sx, sy, tx, ty = list(map(int, input().split()))
dx, dy = tx - sx, ty - sy
print(
(
dy * "U"
+ dx * "R"
+ dy * "D"
+ (dx + 1) * "L"
+ (dy + 1) * "U"
+ (dx + 1) * "R"
+ "D"
+ "R"
+ (dy + 1) * "D"
+ (dx + 1) * "L"
+ "U"
)
)
| false | 62.5 | [
"-dx = tx - sx",
"-dy = ty - sy",
"-direction1 = \"U\" * dy + \"R\" * dx",
"-direction2 = \"D\" * dy + \"L\" * dx",
"-direction3 = \"L\" + \"U\" * (dy + 1) + \"R\" * (dx + 1) + \"D\"",
"-direction4 = \"R\" + \"D\" * (dy + 1) + \"L\" * (dx + 1) + \"U\"",
"-print((direction1 + direction2 + direction3 + di... | false | 0.047299 | 0.049505 | 0.955445 | [
"s195476739",
"s519785820"
] |
u075012704 | p03806 | python | s641279108 | s861538213 | 700 | 348 | 133,212 | 143,412 | Accepted | Accepted | 50.29 | N, Ma, Mb = list(map(int, input().split()))
Drug = [list(map(int, input().split())) for i in range(N)]
dp = [[[float('inf')] * 401 for j in range(401)] for i in range(N + 1)]
dp[0][0][0] = 0
for i, (a, b, c) in enumerate(Drug):
for ma in range(401):
for mb in range(401):
if (ma + a < ... | N, Ma, Mb = list(map(int, input().split()))
Items = [list(map(int, input().split())) for _ in range(N)]
# dp[i][a][b] := i番目の薬品までみて、タイプA: xグラム, タイプB: yグラム を手に入れるために必要な最小費用
dp = [[[float('inf')] * 401 for j in range(401)] for i in range(N + 1)]
dp[0][0][0] = 0
for i, (a, b, c) in enumerate(Items):
for x in r... | 21 | 20 | 714 | 743 | N, Ma, Mb = list(map(int, input().split()))
Drug = [list(map(int, input().split())) for i in range(N)]
dp = [[[float("inf")] * 401 for j in range(401)] for i in range(N + 1)]
dp[0][0][0] = 0
for i, (a, b, c) in enumerate(Drug):
for ma in range(401):
for mb in range(401):
if (ma + a < 401) and (m... | N, Ma, Mb = list(map(int, input().split()))
Items = [list(map(int, input().split())) for _ in range(N)]
# dp[i][a][b] := i番目の薬品までみて、タイプA: xグラム, タイプB: yグラム を手に入れるために必要な最小費用
dp = [[[float("inf")] * 401 for j in range(401)] for i in range(N + 1)]
dp[0][0][0] = 0
for i, (a, b, c) in enumerate(Items):
for x in range(401... | false | 4.761905 | [
"-Drug = [list(map(int, input().split())) for i in range(N)]",
"+Items = [list(map(int, input().split())) for _ in range(N)]",
"+# dp[i][a][b] := i番目の薬品までみて、タイプA: xグラム, タイプB: yグラム を手に入れるために必要な最小費用",
"-for i, (a, b, c) in enumerate(Drug):",
"- for ma in range(401):",
"- for mb in range(401):",
... | false | 1.150327 | 1.158937 | 0.99257 | [
"s641279108",
"s861538213"
] |
u864197622 | p03128 | python | s700148003 | s883256769 | 154 | 83 | 3,192 | 3,188 | Accepted | Accepted | 46.1 | def intlog10(n):
if n <= 0:
return -1
i = 0
while 10**i <= n:
i += 1
return i-1
N, M = list(map(int, input().split()))
A = [int(a) for a in input().split()]
L = [2, 5, 5, 4, 5, 6, 3, 7, 6]
B = [[A[i], L[A[i]-1]] for i in range(M)]
best = sorted(B, key = lambda x:... | def intlog10(n):
if n <= 0:
return -1
i = 0
while 10**i <= n:
i += 1
return i-1
N, M = list(map(int, input().split()))
A = [int(a) for a in input().split()]
L = [2, 5, 5, 4, 5, 6, 3, 7, 6]
B = [[A[i], L[A[i]-1]] for i in range(M)]
best = sorted(B, key = lambda x: x[1... | 53 | 38 | 1,345 | 892 | def intlog10(n):
if n <= 0:
return -1
i = 0
while 10**i <= n:
i += 1
return i - 1
N, M = list(map(int, input().split()))
A = [int(a) for a in input().split()]
L = [2, 5, 5, 4, 5, 6, 3, 7, 6]
B = [[A[i], L[A[i] - 1]] for i in range(M)]
best = sorted(B, key=lambda x: x[1] * 10 - x[0])[0]... | def intlog10(n):
if n <= 0:
return -1
i = 0
while 10**i <= n:
i += 1
return i - 1
N, M = list(map(int, input().split()))
A = [int(a) for a in input().split()]
L = [2, 5, 5, 4, 5, 6, 3, 7, 6]
B = [[A[i], L[A[i] - 1]] for i in range(M)]
best = sorted(B, key=lambda x: x[1] * 10 - x[0])[0]... | false | 28.301887 | [
"-bpre = -1",
"-ll = 1",
"- if b[0] > X[i]:",
"- X[i] = b[0]",
"- bpre = b",
"- ll = 0",
"+ X[i] = max(X[i], b[0])",
"- if X[i - b[1]] * 10 + b[0] < X[i - b[1]] + b[0] * (",
... | false | 0.035415 | 0.035138 | 1.007879 | [
"s700148003",
"s883256769"
] |
u312025627 | p03993 | python | s999827239 | s143647909 | 256 | 206 | 74,604 | 52,908 | Accepted | Accepted | 19.53 | def main():
N = int(eval(input()))
A = [int(i)-1 for i in input().split()]
edge = [set() for _ in range(N)]
for i, a in enumerate(A):
edge[i].add(a)
ans = 0
for i, a in enumerate(A):
if i in edge[a]:
ans += 1
print((ans//2))
if __name__ == '__... | def main():
N = int(eval(input()))
A = [int(i)-1 for i in input().split()]
ans = 0
for i, a in enumerate(A):
if A[a] == i:
ans += 1
print((ans//2))
if __name__ == '__main__':
main()
| 18 | 13 | 333 | 233 | def main():
N = int(eval(input()))
A = [int(i) - 1 for i in input().split()]
edge = [set() for _ in range(N)]
for i, a in enumerate(A):
edge[i].add(a)
ans = 0
for i, a in enumerate(A):
if i in edge[a]:
ans += 1
print((ans // 2))
if __name__ == "__main__":
ma... | def main():
N = int(eval(input()))
A = [int(i) - 1 for i in input().split()]
ans = 0
for i, a in enumerate(A):
if A[a] == i:
ans += 1
print((ans // 2))
if __name__ == "__main__":
main()
| false | 27.777778 | [
"- edge = [set() for _ in range(N)]",
"- for i, a in enumerate(A):",
"- edge[i].add(a)",
"- if i in edge[a]:",
"+ if A[a] == i:"
] | false | 0.057983 | 0.056453 | 1.027098 | [
"s999827239",
"s143647909"
] |
u094191970 | p02623 | python | s062900448 | s143000306 | 341 | 283 | 47,512 | 49,332 | Accepted | Accepted | 17.01 | from bisect import *
n,m,k=list(map(int,input().split()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
a_b=[0]
for i in range(1,n+1):
a_b.append(a_b[i-1]+a[i-1])
b_b=[0]
for i in range(1,m+1):
b_b.append(b_b[i-1]+b[i-1])
ans=0
for i in range(n+1):
t_ans=i
if a_b[i]>k:
... | from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
lnii=lambda:list(map(int,stdin.readline().split()))
from bisect import bisect_right
from itertools import accumulate
n,m,k=nii()
a=lnii()
b=lnii()
ar=[0]+list(accumulate(a))
br=list(accumulate(b))
ans=0
for i in range(n+1):
time=... | 23 | 22 | 398 | 434 | from bisect import *
n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a_b = [0]
for i in range(1, n + 1):
a_b.append(a_b[i - 1] + a[i - 1])
b_b = [0]
for i in range(1, m + 1):
b_b.append(b_b[i - 1] + b[i - 1])
ans = 0
for i in range(n + 1):
t... | from sys import stdin
nii = lambda: list(map(int, stdin.readline().split()))
lnii = lambda: list(map(int, stdin.readline().split()))
from bisect import bisect_right
from itertools import accumulate
n, m, k = nii()
a = lnii()
b = lnii()
ar = [0] + list(accumulate(a))
br = list(accumulate(b))
ans = 0
for i in range(n +... | false | 4.347826 | [
"-from bisect import *",
"+from sys import stdin",
"-n, m, k = list(map(int, input().split()))",
"-a = list(map(int, input().split()))",
"-b = list(map(int, input().split()))",
"-a_b = [0]",
"-for i in range(1, n + 1):",
"- a_b.append(a_b[i - 1] + a[i - 1])",
"-b_b = [0]",
"-for i in range(1, m... | false | 0.039099 | 0.044327 | 0.882066 | [
"s062900448",
"s143000306"
] |
u774160580 | p02971 | python | s606894777 | s095687560 | 920 | 557 | 70,488 | 14,112 | Accepted | Accepted | 39.46 | def main():
N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
A_sort = sorted(A)
if (A_sort[-1] == A_sort[-2]):
for i in range(N):
print((A_sort[-1]))
else:
for i in range(N):
if(A[i]==A_sort[-1]):
print((A_sort[-2]))
... | N = int(eval(input()))
x = [int(eval(input())) for i in range(N)]
x_sort = sorted(x, reverse=True)
for i in range(N):
if x[i] == x_sort[0]:
print((x_sort[1]))
else:
print((x_sort[0]))
| 15 | 8 | 368 | 199 | def main():
N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
A_sort = sorted(A)
if A_sort[-1] == A_sort[-2]:
for i in range(N):
print((A_sort[-1]))
else:
for i in range(N):
if A[i] == A_sort[-1]:
print((A_sort[-2]))
... | N = int(eval(input()))
x = [int(eval(input())) for i in range(N)]
x_sort = sorted(x, reverse=True)
for i in range(N):
if x[i] == x_sort[0]:
print((x_sort[1]))
else:
print((x_sort[0]))
| false | 46.666667 | [
"-def main():",
"- N = int(eval(input()))",
"- A = [int(eval(input())) for i in range(N)]",
"- A_sort = sorted(A)",
"- if A_sort[-1] == A_sort[-2]:",
"- for i in range(N):",
"- print((A_sort[-1]))",
"+N = int(eval(input()))",
"+x = [int(eval(input())) for i in range(N)]... | false | 0.044806 | 0.044285 | 1.011764 | [
"s606894777",
"s095687560"
] |
u991567869 | p02859 | python | s177401789 | s125817808 | 25 | 17 | 2,940 | 2,940 | Accepted | Accepted | 32 | r = int(eval(input()))
r = r**2
print(r) | r = int(eval(input()))
r = r*r
print(r) | 3 | 3 | 36 | 35 | r = int(eval(input()))
r = r**2
print(r)
| r = int(eval(input()))
r = r * r
print(r)
| false | 0 | [
"-r = r**2",
"+r = r * r"
] | false | 0.039932 | 0.046101 | 0.86618 | [
"s177401789",
"s125817808"
] |
u156163787 | p03633 | python | s106165066 | s330064177 | 282 | 172 | 66,028 | 38,384 | Accepted | Accepted | 39.01 | #from math import gcd
from fractions import gcd
n=int(eval(input()))
res=1
for _ in range(n):
x=int(eval(input()))
res=res//gcd(res,x)*x
print(res)
| from functools import reduce
def gcd(a,b):
while b:
a,b=b,a%b
return a
def lcm(a,b):
return a//gcd(a,b)*b
n=int(eval(input()))
a=[int(eval(input())) for _ in range(n)]
print((reduce(lcm,a)))
| 10 | 14 | 155 | 214 | # from math import gcd
from fractions import gcd
n = int(eval(input()))
res = 1
for _ in range(n):
x = int(eval(input()))
res = res // gcd(res, x) * x
print(res)
| from functools import reduce
def gcd(a, b):
while b:
a, b = b, a % b
return a
def lcm(a, b):
return a // gcd(a, b) * b
n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
print((reduce(lcm, a)))
| false | 28.571429 | [
"-# from math import gcd",
"-from fractions import gcd",
"+from functools import reduce",
"+",
"+",
"+def gcd(a, b):",
"+ while b:",
"+ a, b = b, a % b",
"+ return a",
"+",
"+",
"+def lcm(a, b):",
"+ return a // gcd(a, b) * b",
"+",
"-res = 1",
"-for _ in range(n):",
... | false | 0.05313 | 0.036098 | 1.471834 | [
"s106165066",
"s330064177"
] |
u102461423 | p03185 | python | s883828840 | s388254572 | 549 | 506 | 41,540 | 41,540 | Accepted | Accepted | 7.83 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque
N,C,*H = list(map(int,read().split()))
class CHT:
"""
f_i = a_ix + b_i とする。f_i の追加および、min_i f(x) の取得ができるデータ構造。
ただし、傾き a_i は昇順に追加されなければならない。
また... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque
N,C,*H = list(map(int,read().split()))
class CHT:
"""
f_i = a_ix + b_i とする。f_i の追加および、min_i f(x) の取得ができるデータ構造。
ただし、傾き a_i は昇順に追加されなければならない。
また... | 53 | 56 | 1,187 | 1,212 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque
N, C, *H = list(map(int, read().split()))
class CHT:
"""
f_i = a_ix + b_i とする。f_i の追加および、min_i f(x) の取得ができるデータ構造。
ただし、傾き a_i は昇順に追加されなければならない。
また、クエリ x も昇... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque
N, C, *H = list(map(int, read().split()))
class CHT:
"""
f_i = a_ix + b_i とする。f_i の追加および、min_i f(x) の取得ができるデータ構造。
ただし、傾き a_i は昇順に追加されなければならない。
また、クエリ x も昇... | false | 5.357143 | [
"-cht.add(-2 * h, h * h)",
"+add = cht.add",
"+query = cht.query",
"+add(-2 * h, h * h)",
"- x = cht.query(h) + h * h + C",
"+ x = query(h) + h * h + C",
"- cht.add(-2 * h, h * h + x)",
"+ add(-2 * h, h * h + x)"
] | false | 0.0386 | 0.045879 | 0.841336 | [
"s883828840",
"s388254572"
] |
u760527120 | p03370 | python | s690838776 | s100146174 | 37 | 18 | 3,060 | 2,940 | Accepted | Accepted | 51.35 | N, X = list(map(int, input().split()))
M = [int(eval(input())) for _ in range(N)]
X -= sum(M)
m = min(M)
ans = len(M)
while X >= m:
X -= m
ans += 1
print(ans) | N, X = list(map(int, input().split()))
M = [int(eval(input())) for _ in range(N)]
print((len(M) + (X - sum(M)) // min(M))) | 9 | 3 | 164 | 116 | N, X = list(map(int, input().split()))
M = [int(eval(input())) for _ in range(N)]
X -= sum(M)
m = min(M)
ans = len(M)
while X >= m:
X -= m
ans += 1
print(ans)
| N, X = list(map(int, input().split()))
M = [int(eval(input())) for _ in range(N)]
print((len(M) + (X - sum(M)) // min(M)))
| false | 66.666667 | [
"-X -= sum(M)",
"-m = min(M)",
"-ans = len(M)",
"-while X >= m:",
"- X -= m",
"- ans += 1",
"-print(ans)",
"+print((len(M) + (X - sum(M)) // min(M)))"
] | false | 0.03342 | 0.039371 | 0.848849 | [
"s690838776",
"s100146174"
] |
u745087332 | p03209 | python | s536736604 | s321525215 | 22 | 20 | 3,316 | 3,064 | Accepted | Accepted | 9.09 | # coding:utf-8
import sys
input = sys.stdin.readline
INF = float('inf')
MOD = 10 ** 9 + 7
def inpl(): return list(map(int, input().split()))
N, X = inpl()
ALL, P = [1], [1]
for _ in range(N):
ALL.append(ALL[-1] * 2 + 3)
P.append(P[-1] * 2 + 1)
# | B (X = ALL[N])
# |
# | N - 1バーガ... | # coding:utf-8
import sys
input = sys.stdin.readline
INF = float('inf')
MOD = 10 ** 9 + 7
def inpl(): return list(map(int, input().split()))
N, X = inpl()
ALL, P = [1], [1]
for _ in range(N):
ALL.append(ALL[-1] * 2 + 3)
P.append(P[-1] * 2 + 1)
# | B (X = ALL[N])
# |
# | N - 1バーガ... | 47 | 47 | 813 | 846 | # coding:utf-8
import sys
input = sys.stdin.readline
INF = float("inf")
MOD = 10**9 + 7
def inpl():
return list(map(int, input().split()))
N, X = inpl()
ALL, P = [1], [1]
for _ in range(N):
ALL.append(ALL[-1] * 2 + 3)
P.append(P[-1] * 2 + 1)
# | B (X = ALL[N])
# |
# | N - 1バーガー(上)
# |
# | P (X = ALL[N]... | # coding:utf-8
import sys
input = sys.stdin.readline
INF = float("inf")
MOD = 10**9 + 7
def inpl():
return list(map(int, input().split()))
N, X = inpl()
ALL, P = [1], [1]
for _ in range(N):
ALL.append(ALL[-1] * 2 + 3)
P.append(P[-1] * 2 + 1)
# | B (X = ALL[N])
# |
# | N - 1バーガー(上)
# |
# | P (X = ALL[N]... | false | 0 | [
"- if N == 0:",
"+ if N == 0: # レベル0バーガー",
"- if X == 1:",
"+ if X == 1: # 下のB",
"- elif X == ALL[N]:",
"+ elif X == ALL[N]: # 上のB",
"- elif X == ALL[N] // 2 + 1:",
"- return P[N] // 2 + 1",
"+ elif X == ALL[N] // 2 + 1: # 真ん中のP",
"+ return P[N - 1] + 1",
... | false | 0.035717 | 0.040742 | 0.876682 | [
"s536736604",
"s321525215"
] |
u761320129 | p03588 | python | s287763108 | s470707338 | 391 | 208 | 18,776 | 22,504 | Accepted | Accepted | 46.8 | N = int(eval(input()))
src = [tuple(map(int,input().split())) for i in range(N)]
src.sort()
print((src[-1][0] + src[-1][1])) | N = int(eval(input()))
AB = [tuple(map(int,input().split())) for i in range(N)]
a,b = max(AB)
print((a+b)) | 5 | 4 | 121 | 101 | N = int(eval(input()))
src = [tuple(map(int, input().split())) for i in range(N)]
src.sort()
print((src[-1][0] + src[-1][1]))
| N = int(eval(input()))
AB = [tuple(map(int, input().split())) for i in range(N)]
a, b = max(AB)
print((a + b))
| false | 20 | [
"-src = [tuple(map(int, input().split())) for i in range(N)]",
"-src.sort()",
"-print((src[-1][0] + src[-1][1]))",
"+AB = [tuple(map(int, input().split())) for i in range(N)]",
"+a, b = max(AB)",
"+print((a + b))"
] | false | 0.038982 | 0.038691 | 1.007513 | [
"s287763108",
"s470707338"
] |
u894258749 | p02850 | python | s021777341 | s865528433 | 685 | 585 | 90,004 | 85,152 | Accepted | Accepted | 14.6 | import sys
sys.setrecursionlimit(10**9)
input = lambda: sys.stdin.readline().rstrip()
inpl = lambda: list(map(int,input().split()))
N = int(eval(input()))
edge = [set() for _ in range(N)]
ab = []
for i in range(N-1):
a, b = inpl()
a -= 1
b -= 1
ab.append((a,b))
edge[a].add(i)
edge[b... | import sys
input = lambda: sys.stdin.readline().rstrip()
inpl = lambda: list(map(int,input().split()))
N = int(eval(input()))
edge = [set() for _ in range(N)]
ab = []
for i in range(N-1):
a, b = inpl()
a -= 1
b -= 1
ab.append((a,b))
edge[a].add(i)
edge[b].add(i)
K = 0
ans = [0]*(... | 39 | 38 | 739 | 730 | import sys
sys.setrecursionlimit(10**9)
input = lambda: sys.stdin.readline().rstrip()
inpl = lambda: list(map(int, input().split()))
N = int(eval(input()))
edge = [set() for _ in range(N)]
ab = []
for i in range(N - 1):
a, b = inpl()
a -= 1
b -= 1
ab.append((a, b))
edge[a].add(i)
edge[b].add(i)... | import sys
input = lambda: sys.stdin.readline().rstrip()
inpl = lambda: list(map(int, input().split()))
N = int(eval(input()))
edge = [set() for _ in range(N)]
ab = []
for i in range(N - 1):
a, b = inpl()
a -= 1
b -= 1
ab.append((a, b))
edge[a].add(i)
edge[b].add(i)
K = 0
ans = [0] * (N - 1)
po... | false | 2.564103 | [
"-sys.setrecursionlimit(10**9)",
"-",
"-",
"-def dfs(node, prev=0):",
"- global K",
"+pool = [(0, 0)]",
"+while pool:",
"+ node, prev = pool.pop()",
"- dfs(x, c)",
"+ pool.append((x, c))",
"-",
"-",
"-dfs(0)"
] | false | 0.048068 | 0.047678 | 1.008178 | [
"s021777341",
"s865528433"
] |
u075595666 | p02794 | python | s682048381 | s833697304 | 1,445 | 164 | 74,648 | 74,244 | Accepted | Accepted | 88.65 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque
n = int(readline())
g = [[] * n for i in range(n)]
for i in range(n-1):
u, v = list(map(int,readline().split()))
u -= 1
v -= 1
g[u].append(v)
g[v].app... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque,defaultdict
def all_bit_count(n):
c = (n & 0x5555555555555555) + ((n>>1) & 0x5555555555555555)
c = (c & 0x3333333333333333) + ((c>>2) & 0x3333333333333333)
... | 49 | 64 | 1,036 | 1,615 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque
n = int(readline())
g = [[] * n for i in range(n)]
for i in range(n - 1):
u, v = list(map(int, readline().split()))
u -= 1
v -= 1
g[u].append(v)
g[v].ap... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque, defaultdict
def all_bit_count(n):
c = (n & 0x5555555555555555) + ((n >> 1) & 0x5555555555555555)
c = (c & 0x3333333333333333) + ((c >> 2) & 0x3333333333333333)
... | false | 23.4375 | [
"-from collections import deque",
"+from collections import deque, defaultdict",
"+",
"+",
"+def all_bit_count(n):",
"+ c = (n & 0x5555555555555555) + ((n >> 1) & 0x5555555555555555)",
"+ c = (c & 0x3333333333333333) + ((c >> 2) & 0x3333333333333333)",
"+ c = (c & 0x0F0F0F0F0F0F0F0F) + ((c >>... | false | 0.079165 | 0.037178 | 2.129376 | [
"s682048381",
"s833697304"
] |
u863370423 | p02836 | python | s513554409 | s774420241 | 165 | 18 | 38,256 | 3,060 | Accepted | Accepted | 89.09 | s = eval(input())
res = 0
for i in range(len(s)//2):
res += int(s[i] != s[len(s)-i-1])
print(res)
| s = eval(input())
l1 = []
for x in s:
l1.append(x)
l2 = l1[:]
l2.reverse()
hugs = 0
for count in range(int(len(l1)/2)):
if l1[count] == l2[count]:
continue
else:
hugs += 1
print(hugs) | 5 | 13 | 100 | 217 | s = eval(input())
res = 0
for i in range(len(s) // 2):
res += int(s[i] != s[len(s) - i - 1])
print(res)
| s = eval(input())
l1 = []
for x in s:
l1.append(x)
l2 = l1[:]
l2.reverse()
hugs = 0
for count in range(int(len(l1) / 2)):
if l1[count] == l2[count]:
continue
else:
hugs += 1
print(hugs)
| false | 61.538462 | [
"-res = 0",
"-for i in range(len(s) // 2):",
"- res += int(s[i] != s[len(s) - i - 1])",
"-print(res)",
"+l1 = []",
"+for x in s:",
"+ l1.append(x)",
"+l2 = l1[:]",
"+l2.reverse()",
"+hugs = 0",
"+for count in range(int(len(l1) / 2)):",
"+ if l1[count] == l2[count]:",
"+ conti... | false | 0.035445 | 0.03661 | 0.968176 | [
"s513554409",
"s774420241"
] |
u670180528 | p03660 | python | s515344254 | s630902576 | 1,369 | 493 | 36,980 | 37,208 | Accepted | Accepted | 63.99 | n,*L=list(map(int,open(0).read().split()))
G=[[]for _ in range(n)]
db=[-1]*n;db[0]=0
dw=[-1]*n;dw[-1]=0
for a,b in zip(*[iter(L)]*2):
G[a-1]+=[b-1]
G[b-1]+=[a-1]
q=[0]
while q:
cur=q.pop(0)
for nxt in G[cur]:
if db[nxt]<0:
q.append(nxt)
db[nxt]=db[cur]+1
q=[n-1]
while q:
cur=q.pop(0)
for ... | from collections import deque
n,*L=list(map(int,open(0).read().split()))
G=[[]for _ in range(n)]
db=[-1]*n
dw=[-1]*n
for a,b in zip(*[iter(L)]*2):
G[a-1]+=[b-1]
G[b-1]+=[a-1]
q=deque([(0,0)])
while q:
cur,d=q.popleft()
db[cur]=d
for nxt in G[cur]:
if db[nxt]<0:
q.append((nxt,d+1))
q=deque([(n-1... | 27 | 30 | 489 | 533 | n, *L = list(map(int, open(0).read().split()))
G = [[] for _ in range(n)]
db = [-1] * n
db[0] = 0
dw = [-1] * n
dw[-1] = 0
for a, b in zip(*[iter(L)] * 2):
G[a - 1] += [b - 1]
G[b - 1] += [a - 1]
q = [0]
while q:
cur = q.pop(0)
for nxt in G[cur]:
if db[nxt] < 0:
q.append(nxt)
... | from collections import deque
n, *L = list(map(int, open(0).read().split()))
G = [[] for _ in range(n)]
db = [-1] * n
dw = [-1] * n
for a, b in zip(*[iter(L)] * 2):
G[a - 1] += [b - 1]
G[b - 1] += [a - 1]
q = deque([(0, 0)])
while q:
cur, d = q.popleft()
db[cur] = d
for nxt in G[cur]:
if db... | false | 10 | [
"+from collections import deque",
"+",
"-db[0] = 0",
"-dw[-1] = 0",
"-q = [0]",
"+q = deque([(0, 0)])",
"- cur = q.pop(0)",
"+ cur, d = q.popleft()",
"+ db[cur] = d",
"- q.append(nxt)",
"- db[nxt] = db[cur] + 1",
"-q = [n - 1]",
"+ q.append((nxt, d +... | false | 0.044903 | 0.043873 | 1.023487 | [
"s515344254",
"s630902576"
] |
u513081876 | p03862 | python | s080346551 | s872393888 | 135 | 115 | 14,052 | 14,052 | Accepted | Accepted | 14.81 | N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = 0
for i in range(N-1):
if (a[i]+a[i+1]) > x and x < a[i] :
ans += a[i+1]+a[i]-x
a[i] = a[i]-(x-a[i+1])
a[i+1] = 0
elif (a[i]+a[i+1]) > x:
ans += a[i+1]+a[i]-x
... | N, x = list(map(int, input().split()))
A = [int(i) for i in input().split()]
A.insert(0, 0)
ans = 0
for i in range(N):
if A[i] + A[i+1] > x:
ans += abs(A[i+1]-(x-A[i]))
A[i+1] = x - A[i]
print(ans) | 16 | 10 | 359 | 221 | N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = 0
for i in range(N - 1):
if (a[i] + a[i + 1]) > x and x < a[i]:
ans += a[i + 1] + a[i] - x
a[i] = a[i] - (x - a[i + 1])
a[i + 1] = 0
elif (a[i] + a[i + 1]) > x:
ans += a[i + 1] + a[i] - x
a[i... | N, x = list(map(int, input().split()))
A = [int(i) for i in input().split()]
A.insert(0, 0)
ans = 0
for i in range(N):
if A[i] + A[i + 1] > x:
ans += abs(A[i + 1] - (x - A[i]))
A[i + 1] = x - A[i]
print(ans)
| false | 37.5 | [
"-a = list(map(int, input().split()))",
"+A = [int(i) for i in input().split()]",
"+A.insert(0, 0)",
"-for i in range(N - 1):",
"- if (a[i] + a[i + 1]) > x and x < a[i]:",
"- ans += a[i + 1] + a[i] - x",
"- a[i] = a[i] - (x - a[i + 1])",
"- a[i + 1] = 0",
"- elif (a[i] + a... | false | 0.079244 | 0.078023 | 1.015643 | [
"s080346551",
"s872393888"
] |
u692746605 | p03074 | python | s407291957 | s830066985 | 82 | 59 | 7,164 | 7,108 | Accepted | Accepted | 28.05 | n, k = list(map(int, input().split()))
s = eval(input())
c = 1
l = []
l += [0,0] if (s[0] == '0') else [0]
for i in range(1, n):
if s[i-1] != s[i]:
l += [c+l[-1]]; c = 1;
else:
c +=1
l += [c+l[-1]]
if s[-1] == '0':
l += [l[-1]]
ll = len(l)
pl = 2 * k + 1
if ll <= pl:
... | n, k = list(map(int, input().split()))
s = eval(input())
l = [0,0] if (s[0] == '0') else [0]
for i in range(1, n):
if s[i-1] != s[i]:
l += [i];
l += [n] if (s[-1] == '1') else [n,n]
ll = len(l)
pl = 2 * k + 1
if ll <= pl:
print(n)
else:
print((max(l[pl+i]-l[i] for i in range(0, ll-pl+1,... | 27 | 13 | 442 | 313 | n, k = list(map(int, input().split()))
s = eval(input())
c = 1
l = []
l += [0, 0] if (s[0] == "0") else [0]
for i in range(1, n):
if s[i - 1] != s[i]:
l += [c + l[-1]]
c = 1
else:
c += 1
l += [c + l[-1]]
if s[-1] == "0":
l += [l[-1]]
ll = len(l)
pl = 2 * k + 1
if ll <= pl:
print(... | n, k = list(map(int, input().split()))
s = eval(input())
l = [0, 0] if (s[0] == "0") else [0]
for i in range(1, n):
if s[i - 1] != s[i]:
l += [i]
l += [n] if (s[-1] == "1") else [n, n]
ll = len(l)
pl = 2 * k + 1
if ll <= pl:
print(n)
else:
print((max(l[pl + i] - l[i] for i in range(0, ll - pl + 1, 2... | false | 51.851852 | [
"-c = 1",
"-l = []",
"-l += [0, 0] if (s[0] == \"0\") else [0]",
"+l = [0, 0] if (s[0] == \"0\") else [0]",
"- l += [c + l[-1]]",
"- c = 1",
"- else:",
"- c += 1",
"-l += [c + l[-1]]",
"-if s[-1] == \"0\":",
"- l += [l[-1]]",
"+ l += [i]",
"+l += [n] if (s[-... | false | 0.042465 | 0.039636 | 1.071353 | [
"s407291957",
"s830066985"
] |
u813098295 | p03631 | python | s342232994 | s308517825 | 30 | 10 | 2,568 | 2,568 | Accepted | Accepted | 66.67 | N = input()
if N == N[::-1]:
print("Yes")
else:
print("No") | N = input()
print("Yes" if N == N[::-1] else "No") | 6 | 2 | 75 | 54 | N = input()
if N == N[::-1]:
print("Yes")
else:
print("No")
| N = input()
print("Yes" if N == N[::-1] else "No")
| false | 66.666667 | [
"-if N == N[::-1]:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+print(\"Yes\" if N == N[::-1] else \"No\")"
] | false | 0.132744 | 0.077857 | 1.704978 | [
"s342232994",
"s308517825"
] |
u599114793 | p02844 | python | s423538868 | s366336300 | 30 | 20 | 4,328 | 3,064 | Accepted | Accepted | 33.33 | import bisect
n = int(eval(input()))
s = eval(input())
count = 0
num_ind_list = []
for i in range(10):
num_ind_list.append([0])
for i in range(n):
num_ind_list[int(s[i])].append(i)
for i in range(10):
num_ind_list[i].append(30000)
for i in range(10):
if len(num_ind_list[i]) != 2:
fo... | n = int(eval(input()))
s = eval(input())
num_list = [str(i).zfill(3) for i in range(1000)]
ans = 0
for i in range(1000):
i100 = num_list[i][0]
i10 = num_list[i][1]
i1 = num_list[i][2]
count = 0
a = s.find(i100)
if a != -1:
count += 1
a += 1
b = s.find(i10, a)
... | 20 | 23 | 642 | 468 | import bisect
n = int(eval(input()))
s = eval(input())
count = 0
num_ind_list = []
for i in range(10):
num_ind_list.append([0])
for i in range(n):
num_ind_list[int(s[i])].append(i)
for i in range(10):
num_ind_list[i].append(30000)
for i in range(10):
if len(num_ind_list[i]) != 2:
for j in range... | n = int(eval(input()))
s = eval(input())
num_list = [str(i).zfill(3) for i in range(1000)]
ans = 0
for i in range(1000):
i100 = num_list[i][0]
i10 = num_list[i][1]
i1 = num_list[i][2]
count = 0
a = s.find(i100)
if a != -1:
count += 1
a += 1
b = s.find(i10, a)
if b != -1:
... | false | 13.043478 | [
"-import bisect",
"-",
"-count = 0",
"-num_ind_list = []",
"-for i in range(10):",
"- num_ind_list.append([0])",
"-for i in range(n):",
"- num_ind_list[int(s[i])].append(i)",
"-for i in range(10):",
"- num_ind_list[i].append(30000)",
"-for i in range(10):",
"- if len(num_ind_list[i... | false | 0.04748 | 0.047143 | 1.007148 | [
"s423538868",
"s366336300"
] |
u073852194 | p03044 | python | s996146753 | s341831520 | 994 | 776 | 59,288 | 62,608 | Accepted | Accepted | 21.93 | n = int(eval(input()))
Edges = [list(map(int,input().split())) for i in range(n-1)]
for edge in Edges:
edge[0] -= 1
edge[1] -= 1
edge[2] %= 2
Graph = [[] for i in range(n)]
for edge in Edges:
Graph[edge[0]].append([edge[1],edge[2]])
Graph[edge[1]].append([edge[0],edge[2]])
Color = [-1 ... | class Tree(): #weighted
def __init__(self, n, edge, indexed=1):
self.n = n
self.tree = [[] for _ in range(n)]
for e in edge:
self.tree[e[0] - indexed].append((e[1] - indexed, e[2]))
self.tree[e[1] - indexed].append((e[0] - indexed, e[2]))
def setroot(self... | 31 | 50 | 738 | 1,702 | n = int(eval(input()))
Edges = [list(map(int, input().split())) for i in range(n - 1)]
for edge in Edges:
edge[0] -= 1
edge[1] -= 1
edge[2] %= 2
Graph = [[] for i in range(n)]
for edge in Edges:
Graph[edge[0]].append([edge[1], edge[2]])
Graph[edge[1]].append([edge[0], edge[2]])
Color = [-1 for i in ... | class Tree: # weighted
def __init__(self, n, edge, indexed=1):
self.n = n
self.tree = [[] for _ in range(n)]
for e in edge:
self.tree[e[0] - indexed].append((e[1] - indexed, e[2]))
self.tree[e[1] - indexed].append((e[0] - indexed, e[2]))
def setroot(self, root):... | false | 38 | [
"-n = int(eval(input()))",
"-Edges = [list(map(int, input().split())) for i in range(n - 1)]",
"-for edge in Edges:",
"- edge[0] -= 1",
"- edge[1] -= 1",
"- edge[2] %= 2",
"-Graph = [[] for i in range(n)]",
"-for edge in Edges:",
"- Graph[edge[0]].append([edge[1], edge[2]])",
"- Gra... | false | 0.037284 | 0.04327 | 0.861652 | [
"s996146753",
"s341831520"
] |
u513434790 | p02912 | python | s864870220 | s516350900 | 2,000 | 164 | 14,100 | 14,180 | Accepted | Accepted | 91.8 | N, M= list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
l = -1
r = A[-1] + 1
while r - l > 1:
m = (r + l) // 2
mc = 0
a = 0
for i in range(N):
s = A[i]
while m < s:
s //= 2
mc += 1
a += s
if mc <= M:
... | import heapq
N, M= list(map(int, input().split()))
A = list(map(int, input().split()))
for i in range(N):
A[i] *= -1
heapq.heapify(A)
for i in range(M):
b = heapq.heappop(A) * (-1)
heapq.heappush(A, (b // 2) * (-1))
print((sum(A) * -1)) | 25 | 16 | 426 | 265 | N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
l = -1
r = A[-1] + 1
while r - l > 1:
m = (r + l) // 2
mc = 0
a = 0
for i in range(N):
s = A[i]
while m < s:
s //= 2
mc += 1
a += s
if mc <= M:
r = m
an... | import heapq
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
for i in range(N):
A[i] *= -1
heapq.heapify(A)
for i in range(M):
b = heapq.heappop(A) * (-1)
heapq.heappush(A, (b // 2) * (-1))
print((sum(A) * -1))
| false | 36 | [
"+import heapq",
"+",
"-A.sort()",
"-l = -1",
"-r = A[-1] + 1",
"-while r - l > 1:",
"- m = (r + l) // 2",
"- mc = 0",
"- a = 0",
"- for i in range(N):",
"- s = A[i]",
"- while m < s:",
"- s //= 2",
"- mc += 1",
"- a += s",
"- i... | false | 0.22485 | 0.038379 | 5.858707 | [
"s864870220",
"s516350900"
] |
u888092736 | p03229 | python | s056177722 | s250364764 | 138 | 90 | 20,196 | 20,184 | Accepted | Accepted | 34.78 | def calc_score(li):
prev = li[0]
ret = 0
for el in li:
ret += abs(el - prev)
prev = el
return ret
N, *A = list(map(int, open(0).read().split()))
A = sorted(A)
if N % 2:
ans = 0
li = [0] * N
li[0] = A[N // 2]
for i in range(N // 2):
li[i * 2 + 1] ... | N, *A = list(map(int, open(0).read().split()))
M = N // 2
A.sort()
ans = 0
if N % 2:
for i in range(1, M):
ans += A[i + M + 1] - A[i - 1]
ans += A[i + M + 1] - A[i]
ans += A[M + 1] - A[0]
ans = max(A[M + 1] - A[M] + ans, ans + A[M] - A[M - 1])
else:
ans += A[M] - A[0]
for... | 30 | 16 | 698 | 413 | def calc_score(li):
prev = li[0]
ret = 0
for el in li:
ret += abs(el - prev)
prev = el
return ret
N, *A = list(map(int, open(0).read().split()))
A = sorted(A)
if N % 2:
ans = 0
li = [0] * N
li[0] = A[N // 2]
for i in range(N // 2):
li[i * 2 + 1] = A[i + N // 2 +... | N, *A = list(map(int, open(0).read().split()))
M = N // 2
A.sort()
ans = 0
if N % 2:
for i in range(1, M):
ans += A[i + M + 1] - A[i - 1]
ans += A[i + M + 1] - A[i]
ans += A[M + 1] - A[0]
ans = max(A[M + 1] - A[M] + ans, ans + A[M] - A[M - 1])
else:
ans += A[M] - A[0]
for i in range(... | false | 46.666667 | [
"-def calc_score(li):",
"- prev = li[0]",
"- ret = 0",
"- for el in li:",
"- ret += abs(el - prev)",
"- prev = el",
"- return ret",
"-",
"-",
"-A = sorted(A)",
"+M = N // 2",
"+A.sort()",
"+ans = 0",
"- ans = 0",
"- li = [0] * N",
"- li[0] = A[N // 2]... | false | 0.03627 | 0.037421 | 0.969232 | [
"s056177722",
"s250364764"
] |
u282228874 | p03295 | python | s368056883 | s943152617 | 490 | 422 | 27,876 | 29,848 | Accepted | Accepted | 13.88 | N,M = list(map(int,input().split()))
L = [list(map(int,input().split())) for i in range(M)]
L.sort()
ans = 0
l,r = 0,0
for a,b in L:
l = a
if r <= a:
ans += 1
r = b
else:
r = min(r,b)
print(ans)
| N,M = list(map(int,input().split()))
L = sorted([list(map(int,input().split())) for i in range(M)],key = lambda x:x[1])
p,res = 0,0
for a,b in L:
if a > p:
p = b-1
res += 1
print(res)
| 13 | 8 | 237 | 205 | N, M = list(map(int, input().split()))
L = [list(map(int, input().split())) for i in range(M)]
L.sort()
ans = 0
l, r = 0, 0
for a, b in L:
l = a
if r <= a:
ans += 1
r = b
else:
r = min(r, b)
print(ans)
| N, M = list(map(int, input().split()))
L = sorted([list(map(int, input().split())) for i in range(M)], key=lambda x: x[1])
p, res = 0, 0
for a, b in L:
if a > p:
p = b - 1
res += 1
print(res)
| false | 38.461538 | [
"-L = [list(map(int, input().split())) for i in range(M)]",
"-L.sort()",
"-ans = 0",
"-l, r = 0, 0",
"+L = sorted([list(map(int, input().split())) for i in range(M)], key=lambda x: x[1])",
"+p, res = 0, 0",
"- l = a",
"- if r <= a:",
"- ans += 1",
"- r = b",
"- else:",
"... | false | 0.076745 | 0.08582 | 0.894252 | [
"s368056883",
"s943152617"
] |
u497596438 | p03605 | python | s919356051 | s189920586 | 171 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.06 | N=int(eval(input()))
if N//10==9 or N%10==9:
print("Yes")
else:
print("No") | N=eval(input())
if N[0]=="9" or N[1]=="9":
print("Yes")
else:
print("No")
| 5 | 5 | 81 | 80 | N = int(eval(input()))
if N // 10 == 9 or N % 10 == 9:
print("Yes")
else:
print("No")
| N = eval(input())
if N[0] == "9" or N[1] == "9":
print("Yes")
else:
print("No")
| false | 0 | [
"-N = int(eval(input()))",
"-if N // 10 == 9 or N % 10 == 9:",
"+N = eval(input())",
"+if N[0] == \"9\" or N[1] == \"9\":"
] | false | 0.03769 | 0.101381 | 0.371769 | [
"s919356051",
"s189920586"
] |
u163320134 | p02614 | python | s521633695 | s716837542 | 81 | 64 | 68,144 | 9,188 | Accepted | Accepted | 20.99 | h,w,k=list(map(int,input().split()))
board=[list(eval(input())) for _ in range(h)]
ans=0
for paint_h in range(2**h):
for paint_w in range(2**w):
cnt=0
for i in range(h):
for j in range(w):
if (paint_h>>i)&1==0 and (paint_w>>j)&1==0 and board[i][j]=='#':
cnt+=1
if cnt==k:
... | h,w,k=list(map(int,input().split()))
board=[list(eval(input())) for _ in range(h)]
ans=0
for paint_h in range(2**h):
for paint_w in range(2**w):
cnt=0
for i in range(h):
for j in range(w):
if (paint_h>>i)&1==0 and (paint_w>>j)&1==0:
if board[i][j]=='#':
cnt+=1
... | 13 | 14 | 333 | 346 | h, w, k = list(map(int, input().split()))
board = [list(eval(input())) for _ in range(h)]
ans = 0
for paint_h in range(2**h):
for paint_w in range(2**w):
cnt = 0
for i in range(h):
for j in range(w):
if (
(paint_h >> i) & 1 == 0
and... | h, w, k = list(map(int, input().split()))
board = [list(eval(input())) for _ in range(h)]
ans = 0
for paint_h in range(2**h):
for paint_w in range(2**w):
cnt = 0
for i in range(h):
for j in range(w):
if (paint_h >> i) & 1 == 0 and (paint_w >> j) & 1 == 0:
... | false | 7.142857 | [
"- if (",
"- (paint_h >> i) & 1 == 0",
"- and (paint_w >> j) & 1 == 0",
"- and board[i][j] == \"#\"",
"- ):",
"- cnt += 1",
"+ if (paint_h >> i) & 1 == 0 and (paint_w >> j) & 1 == 0:"... | false | 0.036225 | 0.067015 | 0.540555 | [
"s521633695",
"s716837542"
] |
u113971909 | p02713 | python | s835270568 | s120713343 | 1,664 | 1,017 | 9,148 | 9,392 | Accepted | Accepted | 38.88 | #!/usr/bin python3
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline
from math import gcd
def main():
K=int(eval(input()))
ret = 0
for a in range(K):
for b in range(K):
for c in range(K):
ret += gcd(gcd(a+1,b+1),c+1)
print(ret)
if __name... | #!/usr/bin python3
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline
from math import gcd
def main():
K=int(eval(input()))
ret = 0
gc=[[-1]*K for _ in range(K)]
for a in range(K):
for b in range(K):
if gc[a][b]==-1:
gc[a][b]=gcd(a+1,b+1)
... | 18 | 27 | 343 | 619 | #!/usr/bin python3
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline
from math import gcd
def main():
K = int(eval(input()))
ret = 0
for a in range(K):
for b in range(K):
for c in range(K):
ret += gcd(gcd(a + 1, b + 1), c + 1)
print(ret)
if __name__ =... | #!/usr/bin python3
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline
from math import gcd
def main():
K = int(eval(input()))
ret = 0
gc = [[-1] * K for _ in range(K)]
for a in range(K):
for b in range(K):
if gc[a][b] == -1:
gc[a][b] = gcd(a + 1, b + 1)
... | false | 33.333333 | [
"+ gc = [[-1] * K for _ in range(K)]",
"+ if gc[a][b] == -1:",
"+ gc[a][b] = gcd(a + 1, b + 1)",
"+ gc[b][a] = gc[a][b]",
"+ x = gc[a][b]",
"- ret += gcd(gcd(a + 1, b + 1), c + 1)",
"+ if gc[x - 1][c] == -1:",
"+ ... | false | 0.050151 | 0.19594 | 0.255951 | [
"s835270568",
"s120713343"
] |
u238940874 | p03680 | python | s155683241 | s277842456 | 211 | 194 | 7,084 | 7,084 | Accepted | Accepted | 8.06 | n=int(eval(input()))
a=[]
for _ in range(n):
a.append(int(eval(input())))
t=0
for i in range(1,n+1):
t=a[t]-1
if t==1:
print(i)
break
else:
print((-1)) | n=int(eval(input()))
a=[int(eval(input()))for _ in range(n)]
b=0
for i in range(1,n+1):
b=a[b]-1
if b==1:
print(i)
exit()
else:
print((-1)) | 13 | 10 | 182 | 162 | n = int(eval(input()))
a = []
for _ in range(n):
a.append(int(eval(input())))
t = 0
for i in range(1, n + 1):
t = a[t] - 1
if t == 1:
print(i)
break
else:
print((-1))
| n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
b = 0
for i in range(1, n + 1):
b = a[b] - 1
if b == 1:
print(i)
exit()
else:
print((-1))
| false | 23.076923 | [
"-a = []",
"-for _ in range(n):",
"- a.append(int(eval(input())))",
"-t = 0",
"+a = [int(eval(input())) for _ in range(n)]",
"+b = 0",
"- t = a[t] - 1",
"- if t == 1:",
"+ b = a[b] - 1",
"+ if b == 1:",
"- break",
"+ exit()"
] | false | 0.036459 | 0.037008 | 0.985173 | [
"s155683241",
"s277842456"
] |
u215341636 | p02707 | python | s005850542 | s133001462 | 166 | 137 | 32,244 | 33,064 | Accepted | Accepted | 17.47 | n = int(eval(input()))
a = list(map(int, input().split()))
ans = [0] * n
for i in range(n - 1):
j = a[i]
ans[j - 1] += 1
for i in range(n):
print((ans[i])) | n = int(eval(input()))
a = list(map(int, input().split()))
ans = [0] * n
for i in range(n - 1):
j = a[i]
ans[j - 1] += 1
print(("\n".join( map( str, ans)))) | 10 | 9 | 164 | 162 | n = int(eval(input()))
a = list(map(int, input().split()))
ans = [0] * n
for i in range(n - 1):
j = a[i]
ans[j - 1] += 1
for i in range(n):
print((ans[i]))
| n = int(eval(input()))
a = list(map(int, input().split()))
ans = [0] * n
for i in range(n - 1):
j = a[i]
ans[j - 1] += 1
print(("\n".join(map(str, ans))))
| false | 10 | [
"-for i in range(n):",
"- print((ans[i]))",
"+print((\"\\n\".join(map(str, ans))))"
] | false | 0.082549 | 0.048237 | 1.711328 | [
"s005850542",
"s133001462"
] |
u703950586 | p03666 | python | s167669953 | s100358369 | 195 | 173 | 38,636 | 38,384 | Accepted | Accepted | 11.28 | import sys,queue,math,copy,itertools,bisect,collections,heapq
def main():
sys.setrecursionlimit(10**7)
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
n,a,b,c,d = LI()
x = int((b-a+d*(n-1))/(c+d))
if x < 0 or x > n-1:
print('NO')
return
z = c * x - d *... | n,a,b,c,d = list(map(int,input().split()))
x = int((b-a+d*(n-1))/(c+d))
if x < 0 or x > n-1: s='NO'
else:
z = c * x - d * (n-1-x)
if z<=b-a<=z+(d-c)*(n-1):s='YES'
else:s='NO'
print(s) | 20 | 8 | 465 | 187 | import sys, queue, math, copy, itertools, bisect, collections, heapq
def main():
sys.setrecursionlimit(10**7)
LI = lambda: [int(x) for x in sys.stdin.readline().split()]
n, a, b, c, d = LI()
x = int((b - a + d * (n - 1)) / (c + d))
if x < 0 or x > n - 1:
print("NO")
return
z = ... | n, a, b, c, d = list(map(int, input().split()))
x = int((b - a + d * (n - 1)) / (c + d))
if x < 0 or x > n - 1:
s = "NO"
else:
z = c * x - d * (n - 1 - x)
if z <= b - a <= z + (d - c) * (n - 1):
s = "YES"
else:
s = "NO"
print(s)
| false | 60 | [
"-import sys, queue, math, copy, itertools, bisect, collections, heapq",
"-",
"-",
"-def main():",
"- sys.setrecursionlimit(10**7)",
"- LI = lambda: [int(x) for x in sys.stdin.readline().split()]",
"- n, a, b, c, d = LI()",
"- x = int((b - a + d * (n - 1)) / (c + d))",
"- if x < 0 or ... | false | 0.038606 | 0.039639 | 0.973943 | [
"s167669953",
"s100358369"
] |
u429029348 | p02713 | python | s856240015 | s077816619 | 1,317 | 1,082 | 9,112 | 74,708 | Accepted | Accepted | 17.84 | import math
k=int(eval(input()))
ans=0
for i in range(1,k+1):
for j in range(1,k+1):
aa=math.gcd(i,j)
for l in range(1,k+1):
ans+=math.gcd(aa,l)
print(ans) | import math
from functools import reduce
k=int(eval(input()))
def gcd(*numbers):
return reduce(math.gcd,numbers)
ans=0
for i in range(1,k+1):
for j in range(1,k+1):
for l in range(1,k+1):
ans+=gcd(i,j,l)
print(ans) | 11 | 15 | 177 | 244 | import math
k = int(eval(input()))
ans = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
aa = math.gcd(i, j)
for l in range(1, k + 1):
ans += math.gcd(aa, l)
print(ans)
| import math
from functools import reduce
k = int(eval(input()))
def gcd(*numbers):
return reduce(math.gcd, numbers)
ans = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
for l in range(1, k + 1):
ans += gcd(i, j, l)
print(ans)
| false | 26.666667 | [
"+from functools import reduce",
"+",
"+",
"+def gcd(*numbers):",
"+ return reduce(math.gcd, numbers)",
"+",
"+",
"- aa = math.gcd(i, j)",
"- ans += math.gcd(aa, l)",
"+ ans += gcd(i, j, l)"
] | false | 0.132525 | 0.039635 | 3.343644 | [
"s856240015",
"s077816619"
] |
u359358631 | p02577 | python | s280436515 | s719960885 | 66 | 54 | 9,268 | 9,232 | Accepted | Accepted | 18.18 | def main():
N = eval(input())
ans = 0
for ch in N:
ans += int(ch)
if ans % 9 == 0:
print("Yes")
else:
print("No")
if __name__ == "__main__":
main()
| def main():
N = eval(input())
sum_all_digits = 0
for ch in N:
sum_all_digits += int(ch)
if sum_all_digits % 9 == 0:
ans = "Yes"
else:
ans = "No"
print(ans)
if __name__ == "__main__":
main()
| 14 | 17 | 206 | 257 | def main():
N = eval(input())
ans = 0
for ch in N:
ans += int(ch)
if ans % 9 == 0:
print("Yes")
else:
print("No")
if __name__ == "__main__":
main()
| def main():
N = eval(input())
sum_all_digits = 0
for ch in N:
sum_all_digits += int(ch)
if sum_all_digits % 9 == 0:
ans = "Yes"
else:
ans = "No"
print(ans)
if __name__ == "__main__":
main()
| false | 17.647059 | [
"- ans = 0",
"+ sum_all_digits = 0",
"- ans += int(ch)",
"- if ans % 9 == 0:",
"- print(\"Yes\")",
"+ sum_all_digits += int(ch)",
"+ if sum_all_digits % 9 == 0:",
"+ ans = \"Yes\"",
"- print(\"No\")",
"+ ans = \"No\"",
"+ print(ans)"
] | false | 0.048315 | 0.048767 | 0.990732 | [
"s280436515",
"s719960885"
] |
u804800128 | p02580 | python | s338195774 | s724355061 | 649 | 574 | 83,360 | 83,528 | Accepted | Accepted | 11.56 | import sys
input = sys.stdin.readline
h,w,m = list(map(int,input().split()))
h_array = [ 0 for i in range(h) ]
w_array = [ 0 for i in range(w) ]
ps = set()
for i in range(m):
hi,wi = [int(x) - 1 for x in input().split()]
h_array[hi] += 1
w_array[wi] += 1
ps.add( (hi,wi) )
h_great = max(... | import sys
input = sys.stdin.readline
def main():
h,w,m = list(map(int,input().split()))
h_array = [ 0 for _ in range(h) ]
w_array = [ 0 for _ in range(w) ]
ps = set()
for i in range(m):
hi,wi = [int(x) - 1 for x in input().split()]
h_array[hi] += 1
w_array[wi] ... | 36 | 40 | 743 | 906 | import sys
input = sys.stdin.readline
h, w, m = list(map(int, input().split()))
h_array = [0 for i in range(h)]
w_array = [0 for i in range(w)]
ps = set()
for i in range(m):
hi, wi = [int(x) - 1 for x in input().split()]
h_array[hi] += 1
w_array[wi] += 1
ps.add((hi, wi))
h_great = max(h_array)
w_great ... | import sys
input = sys.stdin.readline
def main():
h, w, m = list(map(int, input().split()))
h_array = [0 for _ in range(h)]
w_array = [0 for _ in range(w)]
ps = set()
for i in range(m):
hi, wi = [int(x) - 1 for x in input().split()]
h_array[hi] += 1
w_array[wi] += 1
... | false | 10 | [
"-h, w, m = list(map(int, input().split()))",
"-h_array = [0 for i in range(h)]",
"-w_array = [0 for i in range(w)]",
"-ps = set()",
"-for i in range(m):",
"- hi, wi = [int(x) - 1 for x in input().split()]",
"- h_array[hi] += 1",
"- w_array[wi] += 1",
"- ps.add((hi, wi))",
"-h_great = ... | false | 0.037439 | 0.057451 | 0.651668 | [
"s338195774",
"s724355061"
] |
u126232616 | p03607 | python | s514449642 | s738705965 | 221 | 203 | 15,068 | 11,884 | Accepted | Accepted | 8.14 | n = int(eval(input()))
d = {}
for i in range(n):
a = int(eval(input()))
if a in d:
d[a] = not d[a]
else:
d[a] = True
ans = 0
for i in d:
if d[i]: ans += 1
print(ans) | n = int(eval(input()))
d = set()
for i in range(n):
a = int(eval(input()))
if a in d:
d.remove(a)
else:
d.add(a)
print((len(d))) | 12 | 9 | 196 | 150 | n = int(eval(input()))
d = {}
for i in range(n):
a = int(eval(input()))
if a in d:
d[a] = not d[a]
else:
d[a] = True
ans = 0
for i in d:
if d[i]:
ans += 1
print(ans)
| n = int(eval(input()))
d = set()
for i in range(n):
a = int(eval(input()))
if a in d:
d.remove(a)
else:
d.add(a)
print((len(d)))
| false | 25 | [
"-d = {}",
"+d = set()",
"- d[a] = not d[a]",
"+ d.remove(a)",
"- d[a] = True",
"-ans = 0",
"-for i in d:",
"- if d[i]:",
"- ans += 1",
"-print(ans)",
"+ d.add(a)",
"+print((len(d)))"
] | false | 0.008508 | 0.092838 | 0.091641 | [
"s514449642",
"s738705965"
] |
u887207211 | p03449 | python | s110303544 | s464564368 | 26 | 17 | 3,060 | 3,060 | Accepted | Accepted | 34.62 | N = int(eval(input()))
A = [list(map(int,input().split())) for _ in range(2)]
ma = 0
for i in range(N):
ma = max(ma, sum(A[0][0:i+1])+sum(A[1][i:]))
print(ma) | N = int(eval(input()))
A = [list(map(int,input().split())) for _ in range(2)]
candie = 0
for i in range(N):
candie = max(candie, sum(A[0][0:i+1]) + sum(A[1][i:]))
print(candie) | 7 | 6 | 161 | 177 | N = int(eval(input()))
A = [list(map(int, input().split())) for _ in range(2)]
ma = 0
for i in range(N):
ma = max(ma, sum(A[0][0 : i + 1]) + sum(A[1][i:]))
print(ma)
| N = int(eval(input()))
A = [list(map(int, input().split())) for _ in range(2)]
candie = 0
for i in range(N):
candie = max(candie, sum(A[0][0 : i + 1]) + sum(A[1][i:]))
print(candie)
| false | 14.285714 | [
"-ma = 0",
"+candie = 0",
"- ma = max(ma, sum(A[0][0 : i + 1]) + sum(A[1][i:]))",
"-print(ma)",
"+ candie = max(candie, sum(A[0][0 : i + 1]) + sum(A[1][i:]))",
"+print(candie)"
] | false | 0.040013 | 0.037896 | 1.055857 | [
"s110303544",
"s464564368"
] |
u585482323 | p02713 | python | s985809176 | s506752654 | 987 | 314 | 78,048 | 71,004 | Accepted | Accepted | 68.19 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS... | 50 | 45 | 1,292 | 1,105 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI():
return [int(x) for x in sys.stdin.buffer.readline().split()]
def I():
return int(sys.stdin.buffer.readline())
d... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI():
return [int(x) for x in sys.stdin.buffer.readline().split()]
def I():
return int(sys.stdin.buffer.readline())
d... | false | 10 | [
"- mem = defaultdict(lambda: None)",
"-",
"- if mem[(a, b)] != None:",
"- return mem[(a, b)]",
"- mem[(a, b)] = mem[(b, a)] = b",
"- mem[(a, b)] = mem[(b, a)] = gcd(b % a, a)",
"- return mem[(a, b)]",
"+ return gcd(b % a, a)"
] | false | 0.045853 | 0.045961 | 0.997638 | [
"s985809176",
"s506752654"
] |
u250734103 | p02683 | python | s677875154 | s944257713 | 95 | 84 | 11,920 | 9,216 | Accepted | Accepted | 11.58 | N, M, X = list(map(int, input().split()))
CA = [list(map(int, input().split())) for i in range(N)]
set_list = []
for i in range(2 ** N):
select = []
for j in range(N):
if ((i >> j) & 1):
select.append(j)
if len(select) != 0:
set_list.append(select)
cost = []
fo... | from itertools import combinations
N, M, X = list(map(int, input().split()))
C, A = [], []
for i in range(N):
c, *a = list(map(int, input().split()))
C.append(c)
A.append(a)
ans = float('INF')
for i in range(1,N+1):
for li in combinations(list(range(N)), i):
cost = 0
skill... | 38 | 24 | 839 | 574 | N, M, X = list(map(int, input().split()))
CA = [list(map(int, input().split())) for i in range(N)]
set_list = []
for i in range(2**N):
select = []
for j in range(N):
if (i >> j) & 1:
select.append(j)
if len(select) != 0:
set_list.append(select)
cost = []
for i in range(2**N - 1):... | from itertools import combinations
N, M, X = list(map(int, input().split()))
C, A = [], []
for i in range(N):
c, *a = list(map(int, input().split()))
C.append(c)
A.append(a)
ans = float("INF")
for i in range(1, N + 1):
for li in combinations(list(range(N)), i):
cost = 0
skill = [0] * M
... | false | 36.842105 | [
"+from itertools import combinations",
"+",
"-CA = [list(map(int, input().split())) for i in range(N)]",
"-set_list = []",
"-for i in range(2**N):",
"- select = []",
"- for j in range(N):",
"- if (i >> j) & 1:",
"- select.append(j)",
"- if len(select) != 0:",
"- ... | false | 0.038933 | 0.03805 | 1.023224 | [
"s677875154",
"s944257713"
] |
u968166680 | p03853 | python | s458181657 | s955555033 | 28 | 25 | 9,184 | 9,104 | Accepted | Accepted | 10.71 | 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():
H, W = map(int, readline().split())
C = [readline().strip() for _ in range(H)]
ans = [0] * (2 * H)
for i in range(2 ... | 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():
H, W = list(map(int, readline().split()))
C = [readline().strip() for _ in range(H)]
for i in range(2 * H):
prin... | 25 | 22 | 441 | 385 | 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():
H, W = map(int, readline().split())
C = [readline().strip() for _ in range(H)]
ans = [0] * (2 * H)
for i in range(2 * H):
ans[... | 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():
H, W = list(map(int, readline().split()))
C = [readline().strip() for _ in range(H)]
for i in range(2 * H):
print((C[i // 2]))
... | false | 12 | [
"- H, W = map(int, readline().split())",
"+ H, W = list(map(int, readline().split()))",
"- ans = [0] * (2 * H)",
"- ans[i] = C[i // 2]",
"- print(*ans, sep=\"\\n\")",
"+ print((C[i // 2]))"
] | false | 0.081706 | 0.073196 | 1.116274 | [
"s458181657",
"s955555033"
] |
u440180827 | p02382 | python | s642233865 | s354233224 | 30 | 20 | 7,804 | 7,868 | Accepted | Accepted | 33.33 | n = int(eval(input()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
tmp = [[0 for i in range(6)] for j in range(n+1)]
absDiff = abs(x[0]-y[0])
tmp[0][3] = tmp[0][0] = absDiff
tmp[0][4] = tmp[0][1] = absDiff ** 2
tmp[0][5] = tmp[0][2] = absDiff ** 3
max = absDiff
for i in range(1, n, ... | n = int(eval(input()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
tmp = [[0 for i in range(6)] for j in range(n+1)]
absDiff = abs(x[0]-y[0])
tmp[0][3] = tmp[0][0] = absDiff
tmp[0][4] = tmp[0][1] = absDiff ** 2
tmp[0][5] = tmp[0][2] = absDiff ** 3
max = absDiff
for i in range(1, n, ... | 23 | 23 | 691 | 698 | n = int(eval(input()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
tmp = [[0 for i in range(6)] for j in range(n + 1)]
absDiff = abs(x[0] - y[0])
tmp[0][3] = tmp[0][0] = absDiff
tmp[0][4] = tmp[0][1] = absDiff**2
tmp[0][5] = tmp[0][2] = absDiff**3
max = absDiff
for i in range(1, n, 1):
a... | n = int(eval(input()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
tmp = [[0 for i in range(6)] for j in range(n + 1)]
absDiff = abs(x[0] - y[0])
tmp[0][3] = tmp[0][0] = absDiff
tmp[0][4] = tmp[0][1] = absDiff**2
tmp[0][5] = tmp[0][2] = absDiff**3
max = absDiff
for i in range(1, n, 1):
a... | false | 0 | [
"- tmp[i][2] = absDiff**3",
"+ tmp[i][2] = tmp[i][1] * absDiff"
] | false | 0.034785 | 0.037857 | 0.918863 | [
"s642233865",
"s354233224"
] |
u644907318 | p03497 | python | s499205478 | s756419459 | 345 | 186 | 103,112 | 129,316 | Accepted | Accepted | 46.09 | N,K = list(map(int,input().split()))
A = list(map(int,input().split()))
C = {}
for i in range(N):
if A[i] not in C:
C[A[i]] = 0
C[A[i]] += 1
C = sorted(list(C.items()),key=lambda x:x[1],reverse=True)
n = len(C)
if n<=K:
cnt = 0
else:
cnt = 0
for i in range(K,n):
cnt += ... | N,K = list(map(int,input().split()))
A = list(map(int,input().split()))
C = {}
for i in range(N):
a = A[i]
if a not in C:
C[a] = 0
C[a] += 1
C = sorted(list(C.items()),key=lambda x:x[1],reverse=True)
if len(C)<=K:
print((0))
else:
cnt = 0
for i in range(K,len(C)):
c... | 16 | 16 | 333 | 341 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
C = {}
for i in range(N):
if A[i] not in C:
C[A[i]] = 0
C[A[i]] += 1
C = sorted(list(C.items()), key=lambda x: x[1], reverse=True)
n = len(C)
if n <= K:
cnt = 0
else:
cnt = 0
for i in range(K, n):
cnt += C[i][... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
C = {}
for i in range(N):
a = A[i]
if a not in C:
C[a] = 0
C[a] += 1
C = sorted(list(C.items()), key=lambda x: x[1], reverse=True)
if len(C) <= K:
print((0))
else:
cnt = 0
for i in range(K, len(C)):
cnt +=... | false | 0 | [
"- if A[i] not in C:",
"- C[A[i]] = 0",
"- C[A[i]] += 1",
"+ a = A[i]",
"+ if a not in C:",
"+ C[a] = 0",
"+ C[a] += 1",
"-n = len(C)",
"-if n <= K:",
"- cnt = 0",
"+if len(C) <= K:",
"+ print((0))",
"- for i in range(K, n):",
"+ for i in range(K, l... | false | 0.036777 | 0.036208 | 1.015707 | [
"s499205478",
"s756419459"
] |
u888092736 | p03103 | python | s694982566 | s440438106 | 408 | 287 | 17,000 | 16,976 | Accepted | Accepted | 29.66 | N, M = list(map(int, input().split()))
drinks = sorted(tuple(map(int, input().split())) for _ in range(N))
ans = 0
for A, B in drinks:
if M > B:
ans += A * B
M -= B
else:
ans += A * M
break
print(ans)
| import sys
def input():
return sys.stdin.readline().strip()
N, M = list(map(int, input().split()))
drinks = sorted(tuple(map(int, input().split())) for _ in range(N))
ans = 0
for A, B in drinks:
if M > B:
ans += A * B
M -= B
else:
ans += A * M
break
print... | 11 | 18 | 245 | 320 | N, M = list(map(int, input().split()))
drinks = sorted(tuple(map(int, input().split())) for _ in range(N))
ans = 0
for A, B in drinks:
if M > B:
ans += A * B
M -= B
else:
ans += A * M
break
print(ans)
| import sys
def input():
return sys.stdin.readline().strip()
N, M = list(map(int, input().split()))
drinks = sorted(tuple(map(int, input().split())) for _ in range(N))
ans = 0
for A, B in drinks:
if M > B:
ans += A * B
M -= B
else:
ans += A * M
break
print(ans)
| false | 38.888889 | [
"+import sys",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline().strip()",
"+",
"+"
] | false | 0.038267 | 0.035638 | 1.073772 | [
"s694982566",
"s440438106"
] |
u923668099 | p00711 | python | s701824914 | s117743483 | 120 | 90 | 8,024 | 7,784 | Accepted | Accepted | 25 | import sys
from collections import deque
def solve():
while 1:
w, h = list(map(int, sys.stdin.readline().split()))
if w == h == 0:
return
room = [[False]*w for i in range(h)]
si = sj = -1
for i in range(h):
line = eval(input())
... | import sys
cnt = 0
def solve():
while 1:
w, h = list(map(int, sys.stdin.readline().split()))
if w == h == 0:
return
room = [list(sys.stdin.readline().rstrip()) for i in range(h)]
for i in range(h):
if '@' in room[i]:
si = i
... | 54 | 39 | 1,189 | 805 | import sys
from collections import deque
def solve():
while 1:
w, h = list(map(int, sys.stdin.readline().split()))
if w == h == 0:
return
room = [[False] * w for i in range(h)]
si = sj = -1
for i in range(h):
line = eval(input())
for j, c... | import sys
cnt = 0
def solve():
while 1:
w, h = list(map(int, sys.stdin.readline().split()))
if w == h == 0:
return
room = [list(sys.stdin.readline().rstrip()) for i in range(h)]
for i in range(h):
if "@" in room[i]:
si = i
s... | false | 27.777778 | [
"-from collections import deque",
"+",
"+cnt = 0",
"- room = [[False] * w for i in range(h)]",
"- si = sj = -1",
"+ room = [list(sys.stdin.readline().rstrip()) for i in range(h)]",
"- line = eval(input())",
"- for j, ch in enumerate(line):",
"- ... | false | 0.039284 | 0.0431 | 0.911457 | [
"s701824914",
"s117743483"
] |
u424209323 | p02234 | python | s304038934 | s466992438 | 80 | 60 | 6,480 | 6,472 | Accepted | Accepted | 25 | def mcm(M):
n = len(M)
m = [[0 for i in range(n)] for j in range(n)]
for l in range(2, n+1):
for i in range(0, n-l+1):
j = i + l - 1
def cost(i, k ,j):
return m[i][k] + m[k+1][j] + M[i][0]*M[k][1]*M[j][1]
m[i][j] = min(cost(i, k, j) for k in range(i, j))
return m... | def matrix(n):
x = [[0 for i in range(len(n))] for j in range(len(n))]
for l in range(2, len(n)+1):
for i in range(0, len(n)-l+1):
j = i + l - 1
x[i][j] = min(x[i][k] + x[k+1][j] + X[i][0]*X[k][1]*X[j][1] for k in range(i, j))
print(x[0][len(n)-1])
n = eval(input()... | 19 | 16 | 432 | 402 | def mcm(M):
n = len(M)
m = [[0 for i in range(n)] for j in range(n)]
for l in range(2, n + 1):
for i in range(0, n - l + 1):
j = i + l - 1
def cost(i, k, j):
return m[i][k] + m[k + 1][j] + M[i][0] * M[k][1] * M[j][1]
m[i][j] = min(cost(i, k, j) f... | def matrix(n):
x = [[0 for i in range(len(n))] for j in range(len(n))]
for l in range(2, len(n) + 1):
for i in range(0, len(n) - l + 1):
j = i + l - 1
x[i][j] = min(
x[i][k] + x[k + 1][j] + X[i][0] * X[k][1] * X[j][1] for k in range(i, j)
)
print(x... | false | 15.789474 | [
"-def mcm(M):",
"- n = len(M)",
"- m = [[0 for i in range(n)] for j in range(n)]",
"- for l in range(2, n + 1):",
"- for i in range(0, n - l + 1):",
"+def matrix(n):",
"+ x = [[0 for i in range(len(n))] for j in range(len(n))]",
"+ for l in range(2, len(n) + 1):",
"+ for... | false | 0.035834 | 0.038938 | 0.92028 | [
"s304038934",
"s466992438"
] |
u532966492 | p03111 | python | s022044881 | s577463136 | 699 | 70 | 3,064 | 3,064 | Accepted | Accepted | 89.99 | N,A,B,C=list(map(int,input().split()))
l=[int(eval(input())) for _ in range(N)]
ABC=[A,B,C]
def base2n(Num,n):
if Num<n:
return str(Num)
else:
return base2n(Num//n,n)+str(Num%n)
ans=10**6
for i in range(4**N):
i_4=("0"*N+base2n(i,4))[-N:]
Group=[[] for i in range(4)]... | N,A,B,C=list(map(int,input().split()))
l=[int(eval(input())) for _ in range(N)]
inf=10**6
def dfs(cur,a,b,c):
if cur==N:
if min(a,b,c)>0:
return abs(A-a)+abs(B-b)+abs(C-c)-30
else:
return inf
else:
ret0=dfs(cur+1,a,b,c)
ret1=dfs(cur+1,a+... | 21 | 18 | 549 | 462 | N, A, B, C = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(N)]
ABC = [A, B, C]
def base2n(Num, n):
if Num < n:
return str(Num)
else:
return base2n(Num // n, n) + str(Num % n)
ans = 10**6
for i in range(4**N):
i_4 = ("0" * N + base2n(i, 4))[-N:]
Group = [[] fo... | N, A, B, C = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(N)]
inf = 10**6
def dfs(cur, a, b, c):
if cur == N:
if min(a, b, c) > 0:
return abs(A - a) + abs(B - b) + abs(C - c) - 30
else:
return inf
else:
ret0 = dfs(cur + 1, a, b, c)
... | false | 14.285714 | [
"-ABC = [A, B, C]",
"+inf = 10**6",
"-def base2n(Num, n):",
"- if Num < n:",
"- return str(Num)",
"+def dfs(cur, a, b, c):",
"+ if cur == N:",
"+ if min(a, b, c) > 0:",
"+ return abs(A - a) + abs(B - b) + abs(C - c) - 30",
"+ else:",
"+ return inf... | false | 1.659315 | 0.085183 | 19.479518 | [
"s022044881",
"s577463136"
] |
u389910364 | p02949 | python | s816426869 | s431521500 | 1,032 | 679 | 56,284 | 48,604 | Accepted | Accepted | 34.21 | import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
N, M, P = list(map(int, sys.stdin.readline().split()))
ABC = [list(map(int, sys.stdin.readline().split())) for _ in range(M)]
graph = ... | import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
N, M, P = list(map(int, sys.stdin.readline().split()))
ABC = [list(map(int, sys.stdin.readline().split())) for _ in range(M)]
graph = ... | 78 | 76 | 1,681 | 1,999 | import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10**18
MOD = 10**9 + 7
N, M, P = list(map(int, sys.stdin.readline().split()))
ABC = [list(map(int, sys.stdin.readline().split())) for _ in range(M)]
graph = [[] for _ in range(N)... | import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10**18
MOD = 10**9 + 7
N, M, P = list(map(int, sys.stdin.readline().split()))
ABC = [list(map(int, sys.stdin.readline().split())) for _ in range(M)]
graph = [[] for _ in range(N)... | false | 2.564103 | [
"-def can_go_from_0():",
"- # 1 からのパスがある",
"- ret = [False] * N",
"- stack = [0]",
"- while stack:",
"- v = stack.pop()",
"- ret[v] = True",
"- for u, _ in graph[v]:",
"- if not ret[u]:",
"- ret[u] = True",
"- stack.append... | false | 0.069622 | 0.042749 | 1.628628 | [
"s816426869",
"s431521500"
] |
u787456042 | p02888 | python | s162996499 | s788714324 | 1,261 | 959 | 3,188 | 3,188 | Accepted | Accepted | 23.95 | from bisect import*;N,*L=list(map(int,open(0).read().split()));L.sort();print((sum(bisect_left(L,L[i]+L[j],j+1)-j-1for i in range(N)for j in range(i+1,N)))) | from bisect import*;N,*L=list(map(int,open(0).read().split()));L.sort();print((sum(j-bisect(L,L[i]-L[j],0,j)for i in range(N)for j in range(i)))) | 1 | 1 | 148 | 137 | from bisect import *
N, *L = list(map(int, open(0).read().split()))
L.sort()
print(
(
sum(
bisect_left(L, L[i] + L[j], j + 1) - j - 1
for i in range(N)
for j in range(i + 1, N)
)
)
)
| from bisect import *
N, *L = list(map(int, open(0).read().split()))
L.sort()
print((sum(j - bisect(L, L[i] - L[j], 0, j) for i in range(N) for j in range(i))))
| false | 0 | [
"-print(",
"- (",
"- sum(",
"- bisect_left(L, L[i] + L[j], j + 1) - j - 1",
"- for i in range(N)",
"- for j in range(i + 1, N)",
"- )",
"- )",
"-)",
"+print((sum(j - bisect(L, L[i] - L[j], 0, j) for i in range(N) for j in range(i))))"
] | false | 0.07013 | 0.071786 | 0.976929 | [
"s162996499",
"s788714324"
] |
u731235119 | p01140 | python | s276936887 | s852677823 | 10,420 | 7,890 | 99,216 | 98,528 | Accepted | Accepted | 24.28 | while 1 :
n, m = list(map(int,input().split(" ")))
if (n, m) == (0,0):
break
Lon = [0 for i in range(1000 * n + 1)]
Lat = [0 for i in range(1000 * m + 1)]
Lon_sum = [0]
Lat_sum = [0]
for i in range(0,n):
tmp_Lon_sum = [0]
h = int(input())
for j in Lon_sum:
Lon[j+h] += 1
tmp_Lon_sum += ... | while 1 :
n, m = list(map(int,input().split(" ")))
if (n, m) == (0,0):
break
Lon = [0 for i in range(1000 * n + 1)]
Lat = [0 for i in range(1000 * m + 1)]
Lon_sum = [0]
Lat_sum = [0]
for i in range(0,n):
h = int(input())
Lon_sum = [0] + [h + j for j in Lon_sum]
for j in Lon_sum:
Lon[j] += ... | 28 | 21 | 673 | 578 | while 1:
n, m = list(map(int, input().split(" ")))
if (n, m) == (0, 0):
break
Lon = [0 for i in range(1000 * n + 1)]
Lat = [0 for i in range(1000 * m + 1)]
Lon_sum = [0]
Lat_sum = [0]
for i in range(0, n):
tmp_Lon_sum = [0]
h = int(input())
for j in Lon_sum:
... | while 1:
n, m = list(map(int, input().split(" ")))
if (n, m) == (0, 0):
break
Lon = [0 for i in range(1000 * n + 1)]
Lat = [0 for i in range(1000 * m + 1)]
Lon_sum = [0]
Lat_sum = [0]
for i in range(0, n):
h = int(input())
Lon_sum = [0] + [h + j for j in Lon_sum]
... | false | 25 | [
"- tmp_Lon_sum = [0]",
"+ Lon_sum = [0] + [h + j for j in Lon_sum]",
"- Lon[j + h] += 1",
"- tmp_Lon_sum += [j + h]",
"- Lon_sum = tmp_Lon_sum",
"- else:",
"- Lon_max = Lon_sum[-1]",
"+ Lon[j] += 1",
"- tmp_Lat_sum = [0]",
"+ ... | false | 0.037438 | 0.036574 | 1.023629 | [
"s276936887",
"s852677823"
] |
u562935282 | p03958 | python | s720481037 | s606455020 | 24 | 17 | 3,060 | 2,940 | Accepted | Accepted | 29.17 | from heapq import heapify, heappush, heappop
k, t = list(map(int, input().split()))
*a, = (-int(x) for x in input().split())
heapify(a)
eaten = 0
while a:
to_eat = heappop(a)
to_eat += 1
if eaten:
heappush(a, eaten)
eaten = 0
if to_eat == 0:
continue
elif t... | # 解説を見た
k, t = list(map(int, input().split()))
*a, = (int(x) for x in input().split())
ma = max(a)
rest = k - ma
print((max(0, ma - rest - 1)))
# 最大の個数のケーキを並べる
# 間にほかのケーキを挟んでいく
# aaaaaa bbbb ccc d
# a[bc]a[bc]a[bc]a[b]a[d]a
# 間に1個ずつ入れたときの、aが連続する回数-1が答え
# 間に複数入ることはあるが、同じケーキが入ることはない(最大のケーキの間の数は、ほかのどのケーキの... | 20 | 15 | 366 | 323 | from heapq import heapify, heappush, heappop
k, t = list(map(int, input().split()))
(*a,) = (-int(x) for x in input().split())
heapify(a)
eaten = 0
while a:
to_eat = heappop(a)
to_eat += 1
if eaten:
heappush(a, eaten)
eaten = 0
if to_eat == 0:
continue
elif to_eat < 0:
... | # 解説を見た
k, t = list(map(int, input().split()))
(*a,) = (int(x) for x in input().split())
ma = max(a)
rest = k - ma
print((max(0, ma - rest - 1)))
# 最大の個数のケーキを並べる
# 間にほかのケーキを挟んでいく
# aaaaaa bbbb ccc d
# a[bc]a[bc]a[bc]a[b]a[d]a
# 間に1個ずつ入れたときの、aが連続する回数-1が答え
# 間に複数入ることはあるが、同じケーキが入ることはない(最大のケーキの間の数は、ほかのどのケーキの個数よりも多いから)
| false | 25 | [
"-from heapq import heapify, heappush, heappop",
"-",
"+# 解説を見た",
"-(*a,) = (-int(x) for x in input().split())",
"-heapify(a)",
"-eaten = 0",
"-while a:",
"- to_eat = heappop(a)",
"- to_eat += 1",
"- if eaten:",
"- heappush(a, eaten)",
"- eaten = 0",
"- if to_eat ==... | false | 0.037154 | 0.05998 | 0.619444 | [
"s720481037",
"s606455020"
] |
u912237403 | p00008 | python | s562213812 | s226509603 | 60 | 30 | 4,208 | 4,212 | Accepted | Accepted | 50 | import sys
def f(a,b):
A=list(range(10))
if b==1:x=1 if a in A else 0
else:x=sum([f(a-e,b-1)for e in A])
return x
for n in map(int,sys.stdin):
print(f(n,4)) | import sys
def f(a,b):
A=list(range(10))
if b==1:x=1 if a in A else 0
elif a<0 or a>b*9:x=0
else:x=sum([f(a-e,b-1)for e in A])
return x
for n in map(int,sys.stdin):
print(f(n,4)) | 8 | 9 | 166 | 191 | import sys
def f(a, b):
A = list(range(10))
if b == 1:
x = 1 if a in A else 0
else:
x = sum([f(a - e, b - 1) for e in A])
return x
for n in map(int, sys.stdin):
print(f(n, 4))
| import sys
def f(a, b):
A = list(range(10))
if b == 1:
x = 1 if a in A else 0
elif a < 0 or a > b * 9:
x = 0
else:
x = sum([f(a - e, b - 1) for e in A])
return x
for n in map(int, sys.stdin):
print(f(n, 4))
| false | 11.111111 | [
"+ elif a < 0 or a > b * 9:",
"+ x = 0"
] | false | 0.04013 | 0.115902 | 0.346243 | [
"s562213812",
"s226509603"
] |
u620084012 | p03665 | python | s063757760 | s623378073 | 176 | 18 | 38,256 | 3,064 | Accepted | Accepted | 89.77 | N, P = list(map(int,input().split()))
A = list(map(int,input().split()))
B = [A[k]%2 for k in range(N)]
dp = [[0,0] for k in range(N+1)]
dp[0][0] = 1
for k in range(N):
if B[k] == 0:
dp[k+1][0] = dp[k][0]*2
dp[k+1][1] = dp[k][1]*2
else:
dp[k+1][0] = dp[k][0] + dp[k][1]
... | import math
N, P = list(map(int,input().split()))
A = list(map(int,input().split()))
B = [e%2 for e in A]
ans = pow(2,B.count(0))
def nCr(n,r):
return (math.factorial(n)//(math.factorial(r)*math.factorial(n-r)))
t = 0
for k in range(B.count(1)+1):
if k%2 == 0:
t += nCr(B.count(1),k)
print((an... | 15 | 12 | 369 | 348 | N, P = list(map(int, input().split()))
A = list(map(int, input().split()))
B = [A[k] % 2 for k in range(N)]
dp = [[0, 0] for k in range(N + 1)]
dp[0][0] = 1
for k in range(N):
if B[k] == 0:
dp[k + 1][0] = dp[k][0] * 2
dp[k + 1][1] = dp[k][1] * 2
else:
dp[k + 1][0] = dp[k][0] + dp[k][1]
... | import math
N, P = list(map(int, input().split()))
A = list(map(int, input().split()))
B = [e % 2 for e in A]
ans = pow(2, B.count(0))
def nCr(n, r):
return math.factorial(n) // (math.factorial(r) * math.factorial(n - r))
t = 0
for k in range(B.count(1) + 1):
if k % 2 == 0:
t += nCr(B.count(1), k)
... | false | 20 | [
"+import math",
"+",
"-B = [A[k] % 2 for k in range(N)]",
"-dp = [[0, 0] for k in range(N + 1)]",
"-dp[0][0] = 1",
"-for k in range(N):",
"- if B[k] == 0:",
"- dp[k + 1][0] = dp[k][0] * 2",
"- dp[k + 1][1] = dp[k][1] * 2",
"- else:",
"- dp[k + 1][0] = dp[k][0] + dp[k][... | false | 0.127021 | 0.039523 | 3.213811 | [
"s063757760",
"s623378073"
] |
u762420987 | p03470 | python | s528917651 | s966764461 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | from collections import Counter
N = int(eval(input()))
dlist = Counter([int(eval(input())) for _ in range(N)])
print((len(list(dlist.items()))))
| print((len(set([int(eval(input())) for _ in range(int(eval(input())))]))))
| 4 | 1 | 128 | 61 | from collections import Counter
N = int(eval(input()))
dlist = Counter([int(eval(input())) for _ in range(N)])
print((len(list(dlist.items()))))
| print((len(set([int(eval(input())) for _ in range(int(eval(input())))]))))
| false | 75 | [
"-from collections import Counter",
"-",
"-N = int(eval(input()))",
"-dlist = Counter([int(eval(input())) for _ in range(N)])",
"-print((len(list(dlist.items()))))",
"+print((len(set([int(eval(input())) for _ in range(int(eval(input())))]))))"
] | false | 0.042469 | 0.040223 | 1.055853 | [
"s528917651",
"s966764461"
] |
u021019433 | p03053 | python | s214364473 | s393878086 | 579 | 524 | 132,432 | 132,432 | Accepted | Accepted | 9.5 | h, w = list(map(int, input().split()))
a = [list(eval(input())) for _ in range(h)]
d = (-1, 0), (1, 0), (0, -1), (0, 1)
p = [(i, j) for i in range(h) for j in range(w) if a[i][j] == '#']
n = h * w - len(p)
r = 0
while n:
r += 1
s = []
for i, j in p:
for di, dj in d:
di += i
... | h, w = list(map(int, input().split()))
a = [list(eval(input())) for _ in range(h)]
d = (-1, 0), (1, 0), (0, -1), (0, 1)
p = [(i, j) for i in range(h) for j in range(w) if a[i][j] == '#']
def f():
s = []
for i, j in p:
for di, dj in d:
di += i
dj += j
if 0 ... | 19 | 23 | 500 | 530 | h, w = list(map(int, input().split()))
a = [list(eval(input())) for _ in range(h)]
d = (-1, 0), (1, 0), (0, -1), (0, 1)
p = [(i, j) for i in range(h) for j in range(w) if a[i][j] == "#"]
n = h * w - len(p)
r = 0
while n:
r += 1
s = []
for i, j in p:
for di, dj in d:
di += i
d... | h, w = list(map(int, input().split()))
a = [list(eval(input())) for _ in range(h)]
d = (-1, 0), (1, 0), (0, -1), (0, 1)
p = [(i, j) for i in range(h) for j in range(w) if a[i][j] == "#"]
def f():
s = []
for i, j in p:
for di, dj in d:
di += i
dj += j
if 0 <= di < h ... | false | 17.391304 | [
"-n = h * w - len(p)",
"-r = 0",
"-while n:",
"- r += 1",
"+",
"+",
"+def f():",
"- p = s",
"+ return s",
"+",
"+",
"+n = h * w - len(p)",
"+r = 0",
"+while n:",
"+ r += 1",
"+ p = f()"
] | false | 0.038087 | 0.037131 | 1.025737 | [
"s214364473",
"s393878086"
] |
u156815136 | p03379 | python | s096139841 | s170650192 | 294 | 185 | 26,540 | 33,348 | Accepted | Accepted | 37.07 | #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... | #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdi... | 37 | 48 | 795 | 1,082 | # 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[... | # from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations, permutations, accumulate, product # (string,3) 3回
# from collections import deque
from collections import deque, defaul... | false | 22.916667 | [
"-# from fractions import gcd",
"-# from itertools import combinations # (string,3) 3回",
"+from fractions import gcd",
"+from itertools import combinations, permutations, accumulate, product # (string,3) 3回",
"+",
"-from collections import defaultdict",
"+from collections import deque, defaultdict, Cou... | false | 0.061179 | 0.205934 | 0.297083 | [
"s096139841",
"s170650192"
] |
u994988729 | p03862 | python | s285476582 | s556429037 | 201 | 132 | 14,672 | 14,540 | Accepted | Accepted | 34.33 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = 0
for i in range(1, N):
candy = A[i] + A[i - 1]
# Kより少ないならそのまま
if candy < K:
continue
# 右にあるやつをたべる
r = min(A[i], candy - K)
candy -= r
A[i] -= r
ans += r
if candy < K:
... | N, x = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = 0
for i in range(N - 1):
L = A[i]
R = A[i + 1]
eat = max(0, L + R - x)
ans += eat
A[i + 1] = max(0, R - eat)
print(ans) | 28 | 12 | 478 | 227 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = 0
for i in range(1, N):
candy = A[i] + A[i - 1]
# Kより少ないならそのまま
if candy < K:
continue
# 右にあるやつをたべる
r = min(A[i], candy - K)
candy -= r
A[i] -= r
ans += r
if candy < K:
continue
# 左にある... | N, x = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = 0
for i in range(N - 1):
L = A[i]
R = A[i + 1]
eat = max(0, L + R - x)
ans += eat
A[i + 1] = max(0, R - eat)
print(ans)
| false | 57.142857 | [
"-N, K = list(map(int, input().split()))",
"+N, x = list(map(int, input().split()))",
"-for i in range(1, N):",
"- candy = A[i] + A[i - 1]",
"- # Kより少ないならそのまま",
"- if candy < K:",
"- continue",
"- # 右にあるやつをたべる",
"- r = min(A[i], candy - K)",
"- candy -= r",
"- A[i] -=... | false | 0.079618 | 0.099995 | 0.796219 | [
"s285476582",
"s556429037"
] |
u952708174 | p03363 | python | s889394912 | s200942537 | 219 | 156 | 41,504 | 40,468 | Accepted | Accepted | 28.77 | import collections
N = int(eval(input()))
A = [int(i) for i in input().split()]
S = [0] * (N+1)
for k in range(1,N+1):
S[k] = S[k-1] + A[k-1]
count = collections.Counter(S)
ans = 0
for k,v in list(count.items()):
ans += v * (v-1) // 2
print(ans) | def a_zero_sum_ranges(N, A):
import collections
import itertools
# s[l]==s[r] のとき、A[l+1]+...+A[r] == 0 となる
s = itertools.accumulate([0] + A)
count = collections.Counter(s)
ans = 0
for k, v in list(count.items()):
ans += v * (v - 1) // 2
return ans
N = int(eval(input()... | 13 | 14 | 251 | 381 | import collections
N = int(eval(input()))
A = [int(i) for i in input().split()]
S = [0] * (N + 1)
for k in range(1, N + 1):
S[k] = S[k - 1] + A[k - 1]
count = collections.Counter(S)
ans = 0
for k, v in list(count.items()):
ans += v * (v - 1) // 2
print(ans)
| def a_zero_sum_ranges(N, A):
import collections
import itertools
# s[l]==s[r] のとき、A[l+1]+...+A[r] == 0 となる
s = itertools.accumulate([0] + A)
count = collections.Counter(s)
ans = 0
for k, v in list(count.items()):
ans += v * (v - 1) // 2
return ans
N = int(eval(input()))
A = [i... | false | 7.142857 | [
"-import collections",
"+def a_zero_sum_ranges(N, A):",
"+ import collections",
"+ import itertools",
"+",
"+ # s[l]==s[r] のとき、A[l+1]+...+A[r] == 0 となる",
"+ s = itertools.accumulate([0] + A)",
"+ count = collections.Counter(s)",
"+ ans = 0",
"+ for k, v in list(count.items()):... | false | 0.047894 | 0.048664 | 0.984173 | [
"s889394912",
"s200942537"
] |
u633068244 | p01322 | python | s096392039 | s814494115 | 960 | 790 | 4,304 | 4,308 | Accepted | Accepted | 17.71 | import re
while 1:
n,m = list(map(int,input().split()))
if n ==0: break
prize = []
for i in range(n):
num,money = input().replace("*","[0-9]").split()
prize.append([re.compile(num),int(money)])
ans = 0
for i in range(m):
lot = input()
for num,money in prize:
if num.search(lot):
ans += ... | import re
while 1:
n,m = list(map(int,input().split()))
if n ==0: break
prize = []
for i in range(n):
num,money = input().replace("*","[0-9]").split()
prize.append([re.compile(num),int(money)])
ans = 0
for i in range(m):
lot = input()
for num,money in prize:
if num.search(lot):
ans += ... | 15 | 16 | 343 | 354 | import re
while 1:
n, m = list(map(int, input().split()))
if n == 0:
break
prize = []
for i in range(n):
num, money = input().replace("*", "[0-9]").split()
prize.append([re.compile(num), int(money)])
ans = 0
for i in range(m):
lot = input()
for num, money... | import re
while 1:
n, m = list(map(int, input().split()))
if n == 0:
break
prize = []
for i in range(n):
num, money = input().replace("*", "[0-9]").split()
prize.append([re.compile(num), int(money)])
ans = 0
for i in range(m):
lot = input()
for num, money... | false | 6.25 | [
"+ break"
] | false | 0.054155 | 0.05669 | 0.955285 | [
"s096392039",
"s814494115"
] |
u083960235 | p02732 | python | s641231496 | s665686164 | 534 | 339 | 27,152 | 35,024 | Accepted | Accepted | 36.52 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | 37 | 43 | 1,052 | 1,141 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | false | 13.953488 | [
"-from heapq import heapify, heappop, heappush",
"+from fractions import gcd",
"+from bisect import bisect, bisect_left, bisect_right",
"-# print(C)",
"-# combinations()",
"-al = 0",
"-for ball, num in list(C.items()):",
"- al += num * (num - 1) // 2",
"-# print(al)",
"-for a in A:",
"- ba... | false | 0.064099 | 0.034667 | 1.849023 | [
"s641231496",
"s665686164"
] |
u729133443 | p02665 | python | s681441161 | s530658381 | 529 | 433 | 87,440 | 20,292 | Accepted | Accepted | 18.15 | *a,=list(map(int,[*open(0)][1].split()))
c=sum(a)
s=b=1
for a in a:c-=a;b=min(c,b-a<<1);s+=b
print((max(-1,s))) | c=sum(a:=[*list(map(int,[*open(0)][1].split()))])
b=1
print((max(-1,sum((b:=min(c:=c-a,b-a<<1))for a in a)+1))) | 5 | 3 | 107 | 105 | (*a,) = list(map(int, [*open(0)][1].split()))
c = sum(a)
s = b = 1
for a in a:
c -= a
b = min(c, b - a << 1)
s += b
print((max(-1, s)))
| c = sum(a := [*list(map(int, [*open(0)][1].split()))])
b = 1
print((max(-1, sum((b := min(c := c - a, b - a << 1)) for a in a) + 1)))
| false | 40 | [
"-(*a,) = list(map(int, [*open(0)][1].split()))",
"-c = sum(a)",
"-s = b = 1",
"-for a in a:",
"- c -= a",
"- b = min(c, b - a << 1)",
"- s += b",
"-print((max(-1, s)))",
"+c = sum(a := [*list(map(int, [*open(0)][1].split()))])",
"+b = 1",
"+print((max(-1, sum((b := min(c := c - a, b - ... | false | 0.040688 | 0.048982 | 0.830683 | [
"s681441161",
"s530658381"
] |
u119148115 | p02596 | python | s163963347 | s325432769 | 117 | 69 | 141,320 | 63,376 | Accepted | Accepted | 41.03 | import sys
def I(): return int(sys.stdin.readline().rstrip())
K = I()
if K % 2 == 0 or K % 5 == 0:
print((-1))
exit()
if K % 7 == 0:
K //= 7
A = [1] # A[i] = 10**i mod K
for i in range(K):
A.append((A[-1]*10) % K)
s = 1
for i in range(1,K+1):
if s % K == 0:
print(i)
... | import sys
def I(): return int(sys.stdin.readline().rstrip())
K = I()
if K % 2 == 0 or K % 5 == 0:
print((-1))
exit()
if K % 7 == 0:
K //= 7
s = 1
for i in range(1,K+1):
if s % K == 0:
print(i)
exit()
else:
s *= 10
s += 1
s %= K
| 22 | 19 | 376 | 307 | import sys
def I():
return int(sys.stdin.readline().rstrip())
K = I()
if K % 2 == 0 or K % 5 == 0:
print((-1))
exit()
if K % 7 == 0:
K //= 7
A = [1] # A[i] = 10**i mod K
for i in range(K):
A.append((A[-1] * 10) % K)
s = 1
for i in range(1, K + 1):
if s % K == 0:
print(i)
exi... | import sys
def I():
return int(sys.stdin.readline().rstrip())
K = I()
if K % 2 == 0 or K % 5 == 0:
print((-1))
exit()
if K % 7 == 0:
K //= 7
s = 1
for i in range(1, K + 1):
if s % K == 0:
print(i)
exit()
else:
s *= 10
s += 1
s %= K
| false | 13.636364 | [
"-A = [1] # A[i] = 10**i mod K",
"-for i in range(K):",
"- A.append((A[-1] * 10) % K)",
"- s += A[i]",
"+ s *= 10",
"+ s += 1"
] | false | 0.178417 | 0.149699 | 1.191842 | [
"s163963347",
"s325432769"
] |
u537782349 | p03632 | python | s591133579 | s250541670 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | a, b, c, d = list(map(int, input().split()))
if max(a, c) > min(b, d):
print((0))
else:
print((-max(a, c)+min(b, d)))
| a, b, c, d = list(map(int, input().split()))
e = max(a, c)
f = min(b, d)
if e >= f:
print((0))
else:
print((abs(e-f)))
| 5 | 7 | 120 | 123 | a, b, c, d = list(map(int, input().split()))
if max(a, c) > min(b, d):
print((0))
else:
print((-max(a, c) + min(b, d)))
| a, b, c, d = list(map(int, input().split()))
e = max(a, c)
f = min(b, d)
if e >= f:
print((0))
else:
print((abs(e - f)))
| false | 28.571429 | [
"-if max(a, c) > min(b, d):",
"+e = max(a, c)",
"+f = min(b, d)",
"+if e >= f:",
"- print((-max(a, c) + min(b, d)))",
"+ print((abs(e - f)))"
] | false | 0.040841 | 0.044015 | 0.927891 | [
"s591133579",
"s250541670"
] |
u891635666 | p02888 | python | s899216032 | s106171919 | 1,805 | 1,326 | 62,652 | 3,188 | Accepted | Accepted | 26.54 | import bisect
import sys
input = sys.stdin.readline
def read_i():
return list(map(int, input().split()))
n = int(eval(input()))
ls = sorted(read_i())
ls2 = ls[::-1]
res = 0
for i, x in enumerate(ls2):
for j, y in enumerate(ls2[i + 1:], i + 1):
res += n - j - 1 - bisect.bisect(ls[:-(... | import bisect
import sys
input = sys.stdin.readline
def read_i():
return list(map(int, input().split()))
n = int(eval(input()))
ls = sorted(read_i())
res = 0
for i in range(n - 2):
x = ls[i]
for j in range(i + 1, n - 1):
y = ls[j]
res += bisect.bisect_left(ls, x + y) - ... | 18 | 19 | 341 | 331 | import bisect
import sys
input = sys.stdin.readline
def read_i():
return list(map(int, input().split()))
n = int(eval(input()))
ls = sorted(read_i())
ls2 = ls[::-1]
res = 0
for i, x in enumerate(ls2):
for j, y in enumerate(ls2[i + 1 :], i + 1):
res += n - j - 1 - bisect.bisect(ls[: -(j + 1)], x - y... | import bisect
import sys
input = sys.stdin.readline
def read_i():
return list(map(int, input().split()))
n = int(eval(input()))
ls = sorted(read_i())
res = 0
for i in range(n - 2):
x = ls[i]
for j in range(i + 1, n - 1):
y = ls[j]
res += bisect.bisect_left(ls, x + y) - j - 1
print(res)
| false | 5.263158 | [
"-ls2 = ls[::-1]",
"-for i, x in enumerate(ls2):",
"- for j, y in enumerate(ls2[i + 1 :], i + 1):",
"- res += n - j - 1 - bisect.bisect(ls[: -(j + 1)], x - y)",
"+for i in range(n - 2):",
"+ x = ls[i]",
"+ for j in range(i + 1, n - 1):",
"+ y = ls[j]",
"+ res += bisect.... | false | 0.064411 | 0.056923 | 1.131538 | [
"s899216032",
"s106171919"
] |
u730769327 | p03470 | python | s621455489 | s038575725 | 171 | 61 | 38,512 | 61,968 | Accepted | Accepted | 64.33 | n=int(eval(input()))
a=[]
a.append(int(eval(input())))
for i in range(1,n):
dumy=int(eval(input()))
for j in a:
if j==dumy:
break
else:
a.append(dumy)
print((len(a)))
| n=int(eval(input()))
ans=set([])
for _ in range(n):
ans.add(int(eval(input())))
print((len(ans))) | 13 | 5 | 186 | 89 | n = int(eval(input()))
a = []
a.append(int(eval(input())))
for i in range(1, n):
dumy = int(eval(input()))
for j in a:
if j == dumy:
break
else:
a.append(dumy)
print((len(a)))
| n = int(eval(input()))
ans = set([])
for _ in range(n):
ans.add(int(eval(input())))
print((len(ans)))
| false | 61.538462 | [
"-a = []",
"-a.append(int(eval(input())))",
"-for i in range(1, n):",
"- dumy = int(eval(input()))",
"- for j in a:",
"- if j == dumy:",
"- break",
"- else:",
"- a.append(dumy)",
"-print((len(a)))",
"+ans = set([])",
"+for _ in range(n):",
"+ ans.add(int(... | false | 0.035342 | 0.094253 | 0.374972 | [
"s621455489",
"s038575725"
] |
u030879708 | p02836 | python | s855696640 | s677165357 | 31 | 26 | 8,936 | 8,936 | Accepted | Accepted | 16.13 | S=eval(input())
cnt = 0
for i in range(len(S)//2):
if S[i] != S[len(S) - i - 1]:
cnt += 1
print(cnt) | S=eval(input())
a=len(S)
print((sum(S[i]!=S[a-i-1]for i in range(a//2)))) | 6 | 3 | 111 | 67 | S = eval(input())
cnt = 0
for i in range(len(S) // 2):
if S[i] != S[len(S) - i - 1]:
cnt += 1
print(cnt)
| S = eval(input())
a = len(S)
print((sum(S[i] != S[a - i - 1] for i in range(a // 2))))
| false | 50 | [
"-cnt = 0",
"-for i in range(len(S) // 2):",
"- if S[i] != S[len(S) - i - 1]:",
"- cnt += 1",
"-print(cnt)",
"+a = len(S)",
"+print((sum(S[i] != S[a - i - 1] for i in range(a // 2))))"
] | false | 0.040258 | 0.070319 | 0.572507 | [
"s855696640",
"s677165357"
] |
u923279197 | p03061 | python | s262247331 | s445239084 | 363 | 205 | 92,256 | 16,144 | Accepted | Accepted | 43.53 | from fractions import gcd
n = int(eval(input()))
a = list(map(int,input().split()))
mae = [a[0]]
for i in range(n-1):
mae.append(gcd(mae[i],a[i+1]))
ushiro = [a[n-1]]
for i in range(n-1):
ushiro.append(gcd(ushiro[i],a[n-i-2]))
ans = ushiro[n-2]
for i in range(n-1):
if i != n-2:
ans =... | from fractions import gcd
n = int(eval(input()))
a = list(map(int,input().split()))
s = [a[0]]
for i in range(1,n):
s.append(gcd(s[-1],a[i]))
u = [a[n-1]]
for i in range(n-2,-1,-1):
u.append(gcd(u[-1],a[i]))
#print(s,u)
ans = max(u[-2],s[-2])
for i in range(1,n-1):
#print(s[i-1],u[-2-i])... | 19 | 20 | 408 | 381 | from fractions import gcd
n = int(eval(input()))
a = list(map(int, input().split()))
mae = [a[0]]
for i in range(n - 1):
mae.append(gcd(mae[i], a[i + 1]))
ushiro = [a[n - 1]]
for i in range(n - 1):
ushiro.append(gcd(ushiro[i], a[n - i - 2]))
ans = ushiro[n - 2]
for i in range(n - 1):
if i != n - 2:
... | from fractions import gcd
n = int(eval(input()))
a = list(map(int, input().split()))
s = [a[0]]
for i in range(1, n):
s.append(gcd(s[-1], a[i]))
u = [a[n - 1]]
for i in range(n - 2, -1, -1):
u.append(gcd(u[-1], a[i]))
# print(s,u)
ans = max(u[-2], s[-2])
for i in range(1, n - 1):
# print(s[i-1],u[-2-i])
... | false | 5 | [
"-mae = [a[0]]",
"-for i in range(n - 1):",
"- mae.append(gcd(mae[i], a[i + 1]))",
"-ushiro = [a[n - 1]]",
"-for i in range(n - 1):",
"- ushiro.append(gcd(ushiro[i], a[n - i - 2]))",
"-ans = ushiro[n - 2]",
"-for i in range(n - 1):",
"- if i != n - 2:",
"- ans = max(ans, gcd(mae[i]... | false | 0.11566 | 0.047914 | 2.413912 | [
"s262247331",
"s445239084"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.