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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u705617253 | p03493 | python | s603880638 | s265760104 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | s = eval(input())
result = 0
if s[0] == "1":
result += 1
if s[1] == "1":
result += 1
if s[2] == "1":
result += 1
print(result)
| s = eval(input())
result = 0
for _s in s:
if _s == '1':
result += 1
print(result)
| 10 | 8 | 143 | 97 | s = eval(input())
result = 0
if s[0] == "1":
result += 1
if s[1] == "1":
result += 1
if s[2] == "1":
result += 1
print(result)
| s = eval(input())
result = 0
for _s in s:
if _s == "1":
result += 1
print(result)
| false | 20 | [
"-if s[0] == \"1\":",
"- result += 1",
"-if s[1] == \"1\":",
"- result += 1",
"-if s[2] == \"1\":",
"- result += 1",
"+for _s in s:",
"+ if _s == \"1\":",
"+ result += 1"
] | false | 0.084198 | 0.048189 | 1.747246 | [
"s603880638",
"s265760104"
] |
u050763225 | p03455 | python | s878572623 | s047106962 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | a,b = list(map(int, input().split()))
if (a * b) % 2 == 0:
print('Even')
else:
print('Odd') | data = eval(input())
data_list = data.split(" ")
if ((int(data_list[0])*int(data_list[1]))%2 == 0):
print("Even")
else:
print("Odd") | 5 | 6 | 93 | 135 | a, b = list(map(int, input().split()))
if (a * b) % 2 == 0:
print("Even")
else:
print("Odd")
| data = eval(input())
data_list = data.split(" ")
if (int(data_list[0]) * int(data_list[1])) % 2 == 0:
print("Even")
else:
print("Odd")
| false | 16.666667 | [
"-a, b = list(map(int, input().split()))",
"-if (a * b) % 2 == 0:",
"+data = eval(input())",
"+data_list = data.split(\" \")",
"+if (int(data_list[0]) * int(data_list[1])) % 2 == 0:"
] | false | 0.042629 | 0.04134 | 1.031201 | [
"s878572623",
"s047106962"
] |
u597455618 | p03855 | python | s324503180 | s606181546 | 876 | 782 | 55,688 | 52,524 | Accepted | Accepted | 10.73 | from collections import *;M=lambda:list(map(int,input().split()));r=range;n,k,l=M()
def f(m):
*a,=r(n)
def g(i):
if a[i]==i:return i
a[i]=g(a[i]);return a[i]
for _ in r(m):p,q=M();a[g(q-1)]=g(p-1)
return g
x,y=f(k),f(l);c=Counter((x(i),y(i))for i in r(n));print((*(c[x(i),y(i)]for i in r(n)))) | from collections import *;M=lambda:list(map(int,input().split()));r=range;n,k,l=M()
def f(m):
*a,=r(n)
def g(i):
if a[i]==i:return i
a[i]=g(a[i]);return a[i]
for _ in r(m):p,q=M();a[g(q-1)]=g(p-1)
return [g(i) for i in r(n)]
z=[*list(zip(f(k),f(l)))];c=Counter(z);print((*(c[x]for x in z))) | 9 | 9 | 301 | 292 | from collections import *
M = lambda: list(map(int, input().split()))
r = range
n, k, l = M()
def f(m):
(*a,) = r(n)
def g(i):
if a[i] == i:
return i
a[i] = g(a[i])
return a[i]
for _ in r(m):
p, q = M()
a[g(q - 1)] = g(p - 1)
return g
x, y = f(k... | from collections import *
M = lambda: list(map(int, input().split()))
r = range
n, k, l = M()
def f(m):
(*a,) = r(n)
def g(i):
if a[i] == i:
return i
a[i] = g(a[i])
return a[i]
for _ in r(m):
p, q = M()
a[g(q - 1)] = g(p - 1)
return [g(i) for i in... | false | 0 | [
"- return g",
"+ return [g(i) for i in r(n)]",
"-x, y = f(k), f(l)",
"-c = Counter((x(i), y(i)) for i in r(n))",
"-print((*(c[x(i), y(i)] for i in r(n))))",
"+z = [*list(zip(f(k), f(l)))]",
"+c = Counter(z)",
"+print((*(c[x] for x in z)))"
] | false | 0.040614 | 0.047182 | 0.860785 | [
"s324503180",
"s606181546"
] |
u283220417 | p03160 | python | s109797837 | s319847634 | 247 | 218 | 93,664 | 94,100 | Accepted | Accepted | 11.74 | import sys
sys.setrecursionlimit(500*500)
N =int(eval(input()))
H = list(map(int, input().split()))
H.append(0)
#総数Nで、N番目の添字はN-1
#メモ化再帰
#今の場所からゴールまでの最小コストを出す
now = 0
memo = [-1]*N
def func(n,memo):
if n >= N:
return 99999999
if n == N-1:
memo[N-1] = 0
return 0
else:
if memo[n]... | import sys
sys.setrecursionlimit(500*500)
N =int(eval(input()))
H = list(map(int, input().split()))
memo = [-1]*N
def func(n,memo):
if n == 0:
memo[0] = 0
return memo[n]
elif n == 1:
memo[1] = abs(H[1]-H[0])
return memo[n]
else:
if memo[n] != -1:
return me... | 27 | 23 | 517 | 489 | import sys
sys.setrecursionlimit(500 * 500)
N = int(eval(input()))
H = list(map(int, input().split()))
H.append(0)
# 総数Nで、N番目の添字はN-1
# メモ化再帰
# 今の場所からゴールまでの最小コストを出す
now = 0
memo = [-1] * N
def func(n, memo):
if n >= N:
return 99999999
if n == N - 1:
memo[N - 1] = 0
return 0
else:
... | import sys
sys.setrecursionlimit(500 * 500)
N = int(eval(input()))
H = list(map(int, input().split()))
memo = [-1] * N
def func(n, memo):
if n == 0:
memo[0] = 0
return memo[n]
elif n == 1:
memo[1] = abs(H[1] - H[0])
return memo[n]
else:
if memo[n] != -1:
... | false | 14.814815 | [
"-H.append(0)",
"-# 総数Nで、N番目の添字はN-1",
"-# メモ化再帰",
"-# 今の場所からゴールまでの最小コストを出す",
"-now = 0",
"- if n >= N:",
"- return 99999999",
"- if n == N - 1:",
"- memo[N - 1] = 0",
"- return 0",
"+ if n == 0:",
"+ memo[0] = 0",
"+ return memo[n]",
"+ elif n... | false | 0.035461 | 0.039356 | 0.901042 | [
"s109797837",
"s319847634"
] |
u157232135 | p02573 | python | s351532293 | s550134633 | 1,103 | 620 | 126,464 | 18,420 | Accepted | Accepted | 43.79 | def main():
n,m=list(map(int,input().split()))
ab=[[int(x)-1 for x in input().split()] for _ in range(m)]
uf=UnionFind(n)
for a,b in ab:
uf.union(a,b)
ans = 0
for s in uf.roots():
ans = max(uf.size(s),ans)
print(ans)
class UnionFind():
'''Union-Find'''
... | def main():
n,m=list(map(int,input().split()))
uf=UnionFind(n)
for a,b in ([int(x)-1 for x in input().split()] for _ in range(m)):
uf.union(a,b)
print((max((uf.size(x) for x in uf.roots()))))
class UnionFind():
'''Union-Find'''
def __init__(self, n):
self.n = n
... | 62 | 57 | 1,546 | 1,490 | def main():
n, m = list(map(int, input().split()))
ab = [[int(x) - 1 for x in input().split()] for _ in range(m)]
uf = UnionFind(n)
for a, b in ab:
uf.union(a, b)
ans = 0
for s in uf.roots():
ans = max(uf.size(s), ans)
print(ans)
class UnionFind:
"""Union-Find"""
d... | def main():
n, m = list(map(int, input().split()))
uf = UnionFind(n)
for a, b in ([int(x) - 1 for x in input().split()] for _ in range(m)):
uf.union(a, b)
print((max((uf.size(x) for x in uf.roots()))))
class UnionFind:
"""Union-Find"""
def __init__(self, n):
self.n = n
... | false | 8.064516 | [
"- ab = [[int(x) - 1 for x in input().split()] for _ in range(m)]",
"- for a, b in ab:",
"+ for a, b in ([int(x) - 1 for x in input().split()] for _ in range(m)):",
"- ans = 0",
"- for s in uf.roots():",
"- ans = max(uf.size(s), ans)",
"- print(ans)",
"+ print((max((uf.size... | false | 0.068788 | 0.11639 | 0.59101 | [
"s351532293",
"s550134633"
] |
u924845460 | p04043 | python | s989940117 | s794105453 | 170 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90 | a,b,c=list(map(int, input().split()))
if a==5 and b==5 and c==7:
print('YES')
elif a==5 and b==7 and c==5:
print('YES')
elif a==7 and b==5 and c==5:
print('YES')
else:
print('NO') | myList = list(map(int, input().split()))
if myList.count(5)==2 and myList.count(7)==1:
print('YES')
else:
print('NO') | 9 | 5 | 189 | 125 | a, b, c = list(map(int, input().split()))
if a == 5 and b == 5 and c == 7:
print("YES")
elif a == 5 and b == 7 and c == 5:
print("YES")
elif a == 7 and b == 5 and c == 5:
print("YES")
else:
print("NO")
| myList = list(map(int, input().split()))
if myList.count(5) == 2 and myList.count(7) == 1:
print("YES")
else:
print("NO")
| false | 44.444444 | [
"-a, b, c = list(map(int, input().split()))",
"-if a == 5 and b == 5 and c == 7:",
"- print(\"YES\")",
"-elif a == 5 and b == 7 and c == 5:",
"- print(\"YES\")",
"-elif a == 7 and b == 5 and c == 5:",
"+myList = list(map(int, input().split()))",
"+if myList.count(5) == 2 and myList.count(7) == 1... | false | 0.05457 | 0.043249 | 1.261766 | [
"s989940117",
"s794105453"
] |
u631277801 | p02912 | python | s672147410 | s143688361 | 347 | 158 | 60,952 | 14,380 | Accepted | Accepted | 54.47 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x) - 1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.r... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x) - 1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.r... | 31 | 29 | 701 | 665 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**7)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**7)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | false | 6.451613 | [
"-from heapq import heappush, heappop",
"+from heapq import heappop, heappush",
"- cur = -heappop(heap)",
"- heappush(heap, -(cur // 2))",
"-ans = 0",
"-for hi in heap:",
"- ans += -hi",
"-print(ans)",
"+ bi = -heappop(heap)",
"+ heappush(heap, -(bi // 2))",
"+print((-sum(heap)))"... | false | 0.076956 | 0.047905 | 1.606408 | [
"s672147410",
"s143688361"
] |
u332906195 | p03633 | python | s799080182 | s584323922 | 39 | 36 | 5,128 | 5,172 | Accepted | Accepted | 7.69 | from functools import reduce
from fractions import gcd
def lcm(x, y):
return (x * y) // gcd(x, y)
N = int(eval(input()))
T = [int(eval(input())) for _ in range(N)]
print((reduce(lcm, T, 1)))
| def lcm(x, y):
import fractions
return (x * y) // fractions.gcd(x, y)
N, ans = int(eval(input())), 1
for _ in range(N):
ans = lcm(ans, int(eval(input())))
print(ans)
| 11 | 9 | 195 | 176 | from functools import reduce
from fractions import gcd
def lcm(x, y):
return (x * y) // gcd(x, y)
N = int(eval(input()))
T = [int(eval(input())) for _ in range(N)]
print((reduce(lcm, T, 1)))
| def lcm(x, y):
import fractions
return (x * y) // fractions.gcd(x, y)
N, ans = int(eval(input())), 1
for _ in range(N):
ans = lcm(ans, int(eval(input())))
print(ans)
| false | 18.181818 | [
"-from functools import reduce",
"-from fractions import gcd",
"+def lcm(x, y):",
"+ import fractions",
"+",
"+ return (x * y) // fractions.gcd(x, y)",
"-def lcm(x, y):",
"- return (x * y) // gcd(x, y)",
"-",
"-",
"-N = int(eval(input()))",
"-T = [int(eval(input())) for _ in range(N)]... | false | 0.044762 | 0.047039 | 0.9516 | [
"s799080182",
"s584323922"
] |
u888092736 | p03352 | python | s343099335 | s885361614 | 29 | 25 | 9,080 | 9,164 | Accepted | Accepted | 13.79 | from bisect import bisect_right
cands = []
for i in range(2, 400):
cur = i
while cur * i <= 1000:
cands.append(cur * i)
cur *= i
cands.sort()
X = int(eval(input()))
if X == 1:
print((1))
else:
print((cands[bisect_right(cands, X) - 1]))
| X = int(eval(input()))
ans = 1
for i in range(2, 32):
for j in range(2, 10):
if i ** j > X:
continue
ans = max(ans, i ** j)
print(ans)
| 16 | 8 | 276 | 168 | from bisect import bisect_right
cands = []
for i in range(2, 400):
cur = i
while cur * i <= 1000:
cands.append(cur * i)
cur *= i
cands.sort()
X = int(eval(input()))
if X == 1:
print((1))
else:
print((cands[bisect_right(cands, X) - 1]))
| X = int(eval(input()))
ans = 1
for i in range(2, 32):
for j in range(2, 10):
if i**j > X:
continue
ans = max(ans, i**j)
print(ans)
| false | 50 | [
"-from bisect import bisect_right",
"-",
"-cands = []",
"-for i in range(2, 400):",
"- cur = i",
"- while cur * i <= 1000:",
"- cands.append(cur * i)",
"- cur *= i",
"-cands.sort()",
"-if X == 1:",
"- print((1))",
"-else:",
"- print((cands[bisect_right(cands, X) - 1... | false | 0.048015 | 0.046484 | 1.032933 | [
"s343099335",
"s885361614"
] |
u994521204 | p02781 | python | s335756448 | s227267206 | 27 | 23 | 3,940 | 3,064 | Accepted | Accepted | 14.81 | from functools import lru_cache
n=int(eval(input()))
k=int(eval(input()))
@lru_cache(None)
def F(x,y): #xという数字に対して0出ない数字がyこのモノの個数
if x<10:
if y==1:
return x
elif y==0:
return 1
else:
return 0
else:
res=0
q,r=divmod(x,10)
... | n=eval(input())
keta=len(n)
k=int(eval(input()))
#上からi桁、0以外の数がk個、smallerはless flag
dp=[[[0]*2 for _ in range(4)] for _ in range(keta +1 )]
dp[0][0][0]=1
for i in range(keta):
for j in range(4):
for smaller in range(2):
nd = int(n[i]) #見ている桁の数字
for d in range(10):
... | 21 | 33 | 476 | 989 | from functools import lru_cache
n = int(eval(input()))
k = int(eval(input()))
@lru_cache(None)
def F(x, y): # xという数字に対して0出ない数字がyこのモノの個数
if x < 10:
if y == 1:
return x
elif y == 0:
return 1
else:
return 0
else:
res = 0
q, r = divmod(... | n = eval(input())
keta = len(n)
k = int(eval(input()))
# 上からi桁、0以外の数がk個、smallerはless flag
dp = [[[0] * 2 for _ in range(4)] for _ in range(keta + 1)]
dp[0][0][0] = 1
for i in range(keta):
for j in range(4):
for smaller in range(2):
nd = int(n[i]) # 見ている桁の数字
for d in range(10):
... | false | 36.363636 | [
"-from functools import lru_cache",
"-",
"-n = int(eval(input()))",
"+n = eval(input())",
"+keta = len(n)",
"-",
"-",
"-@lru_cache(None)",
"-def F(x, y): # xという数字に対して0出ない数字がyこのモノの個数",
"- if x < 10:",
"- if y == 1:",
"- return x",
"- elif y == 0:",
"- ... | false | 0.03667 | 0.035213 | 1.041387 | [
"s335756448",
"s227267206"
] |
u631277801 | p03569 | python | s162707900 | s382808590 | 125 | 62 | 4,916 | 4,144 | Accepted | Accepted | 50.4 | import sys
stdin = sys.stdin
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x) - 1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.r... | 43 | 82 | 905 | 1,547 | import sys
stdin = sys.stdin
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
return stdin.readline().r... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**7)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | false | 47.560976 | [
"+sys.setrecursionlimit(10**7)",
"-from collections import deque",
"+# 回文判定",
"+def judge(s):",
"+ news = \"\"",
"+ for si in s:",
"+ if si != \"x\":",
"+ news += si",
"+ if news == news[::-1]:",
"+ return True",
"+ else:",
"+ return False",
"-s = ... | false | 0.037451 | 0.071763 | 0.521875 | [
"s162707900",
"s382808590"
] |
u673361376 | p03775 | python | s615282045 | s927945586 | 185 | 30 | 39,792 | 3,060 | Accepted | Accepted | 83.78 | def sol(n):
ans = float('inf')
for i in range(1, int(n**0.5)+1):
if n % i == 0:
ans = min(ans, max(len(str(i)),len(str(n//i))))
return ans
print((sol(int(eval(input())))))
| N = int(eval(input()))
ans = len(str(N))
for a in range(1, int(N ** .5) + 1):
if N % a == 0:
ans = min(ans, max(len(str(a)), len(str(N // a))))
print(ans) | 9 | 6 | 202 | 165 | def sol(n):
ans = float("inf")
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
ans = min(ans, max(len(str(i)), len(str(n // i))))
return ans
print((sol(int(eval(input())))))
| N = int(eval(input()))
ans = len(str(N))
for a in range(1, int(N**0.5) + 1):
if N % a == 0:
ans = min(ans, max(len(str(a)), len(str(N // a))))
print(ans)
| false | 33.333333 | [
"-def sol(n):",
"- ans = float(\"inf\")",
"- for i in range(1, int(n**0.5) + 1):",
"- if n % i == 0:",
"- ans = min(ans, max(len(str(i)), len(str(n // i))))",
"- return ans",
"-",
"-",
"-print((sol(int(eval(input())))))",
"+N = int(eval(input()))",
"+ans = len(str(N))"... | false | 0.058107 | 0.052464 | 1.107551 | [
"s615282045",
"s927945586"
] |
u941753895 | p03037 | python | s000153506 | s878513555 | 648 | 227 | 37,736 | 10,180 | Accepted | Accepted | 64.97 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
def LI(): return list(map(int,input().split()))
def I(): return int(eval(input()))
def LS(): return input().split()
def S(): return eval(input())
def main():
n,m=... | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
de... | 34 | 34 | 632 | 746 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI():
return list(map(int, input().split()))
def I():
return int(eval(input()))
def LS():
return input().split()
def S():
return eval... | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI():
return [int(x) ... | false | 0 | [
"-import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time",
"+import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy",
"+dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]",
"+ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1... | false | 0.044586 | 0.120131 | 0.371142 | [
"s000153506",
"s878513555"
] |
u541055501 | p02977 | python | s318486888 | s756606253 | 157 | 123 | 9,236 | 9,200 | Accepted | Accepted | 21.66 | n=int(input())
p,r=print,range
if n&-n==n:p("No");exit(0)
p("Yes")
if n==3:p(1,2);p(2,3);p(3,4);p(4,5);p(5,6);exit(0)
k=1
while k*2<n:k*=2
for i in r(k-2):p(i+1,i+2)
p(k-1,n+1)
for i in r(k-2):p(n+i+1,n+i+2)
p(n+k,n+1);p(n+k+1,k)
for i in r(n-k):p(n+i+1,n+k+i+1);p(n+k+i,k+i+1)
| n,k=int(input()),1
while k*2<=n:k*=2
p=print
if n==k:p("No");exit()
p("Yes",v:=n+1,3)
for i in range(2,n,2):p(1,i,i,i+1,1,v+i,v+i,n+i)
if~n&1:p(n,n+k+1,n+n,n^k)
| 12 | 7 | 288 | 166 | n = int(input())
p, r = print, range
if n & -n == n:
p("No")
exit(0)
p("Yes")
if n == 3:
p(1, 2)
p(2, 3)
p(3, 4)
p(4, 5)
p(5, 6)
exit(0)
k = 1
while k * 2 < n:
k *= 2
for i in r(k - 2):
p(i + 1, i + 2)
p(k - 1, n + 1)
for i in r(k - 2):
p(n + i + 1, n + i + 2)
p(n + k, n + 1)... | n, k = int(input()), 1
while k * 2 <= n:
k *= 2
p = print
if n == k:
p("No")
exit()
p("Yes", v := n + 1, 3)
for i in range(2, n, 2):
p(1, i, i, i + 1, 1, v + i, v + i, n + i)
if ~n & 1:
p(n, n + k + 1, n + n, n ^ k)
| false | 41.666667 | [
"-n = int(input())",
"-p, r = print, range",
"-if n & -n == n:",
"+n, k = int(input()), 1",
"+while k * 2 <= n:",
"+ k *= 2",
"+p = print",
"+if n == k:",
"- exit(0)",
"-p(\"Yes\")",
"-if n == 3:",
"- p(1, 2)",
"- p(2, 3)",
"- p(3, 4)",
"- p(4, 5)",
"- p(5, 6)",
... | false | 0.075376 | 0.035621 | 2.116053 | [
"s318486888",
"s756606253"
] |
u198062737 | p03831 | python | s680262441 | s561432754 | 216 | 76 | 63,656 | 14,052 | Accepted | Accepted | 64.81 | N,A,B=list(map(int,input().split(" ")));X=list(map(int,input().split(" ")));print((sum([min(A*(X[i+1]-X[i]),B)for i in range(N-1)]))) | N,A,B,*X=list(map(int,open(0).read().split()));print((sum(min(A*(X[i+1]-X[i]),B)for i in range(N-1)))) | 1 | 1 | 125 | 94 | N, A, B = list(map(int, input().split(" ")))
X = list(map(int, input().split(" ")))
print((sum([min(A * (X[i + 1] - X[i]), B) for i in range(N - 1)])))
| N, A, B, *X = list(map(int, open(0).read().split()))
print((sum(min(A * (X[i + 1] - X[i]), B) for i in range(N - 1))))
| false | 0 | [
"-N, A, B = list(map(int, input().split(\" \")))",
"-X = list(map(int, input().split(\" \")))",
"-print((sum([min(A * (X[i + 1] - X[i]), B) for i in range(N - 1)])))",
"+N, A, B, *X = list(map(int, open(0).read().split()))",
"+print((sum(min(A * (X[i + 1] - X[i]), B) for i in range(N - 1))))"
] | false | 0.042312 | 0.042069 | 1.005776 | [
"s680262441",
"s561432754"
] |
u761320129 | p02868 | python | s842338695 | s267519953 | 972 | 607 | 57,500 | 61,108 | Accepted | Accepted | 37.55 | import heapq
N,M = list(map(int,input().split()))
LRC = [tuple(map(int,input().split())) for i in range(M)]
es = [[] for i in range(N)]
for l,r,c in LRC:
l,r = l-1,r-1
es[l].append((r,c))
for i in range(N-1):
es[i+1].append((i,0))
INF = float('inf')
dist = [INF]*N
dist[0] = 0
hq = [(0,0)]
h... | import sys
input = sys.stdin.readline
N,M = list(map(int,input().split()))
LRC = [tuple(map(int,input().split())) for i in range(M)]
es = [[] for _ in range(N)]
for l,r,c in LRC:
l,r = l-1,r-1
es[l].append((r,c))
for i in range(1,N):
es[i].append((i-1,0))
import heapq
hq = [(0,0)]
INF = floa... | 27 | 25 | 559 | 561 | import heapq
N, M = list(map(int, input().split()))
LRC = [tuple(map(int, input().split())) for i in range(M)]
es = [[] for i in range(N)]
for l, r, c in LRC:
l, r = l - 1, r - 1
es[l].append((r, c))
for i in range(N - 1):
es[i + 1].append((i, 0))
INF = float("inf")
dist = [INF] * N
dist[0] = 0
hq = [(0, 0... | import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
LRC = [tuple(map(int, input().split())) for i in range(M)]
es = [[] for _ in range(N)]
for l, r, c in LRC:
l, r = l - 1, r - 1
es[l].append((r, c))
for i in range(1, N):
es[i].append((i - 1, 0))
import heapq
hq = [(0, 0)]
INF = f... | false | 7.407407 | [
"-import heapq",
"+import sys",
"+input = sys.stdin.readline",
"-es = [[] for i in range(N)]",
"+es = [[] for _ in range(N)]",
"-for i in range(N - 1):",
"- es[i + 1].append((i, 0))",
"+for i in range(1, N):",
"+ es[i].append((i - 1, 0))",
"+import heapq",
"+",
"+hq = [(0, 0)]",
"-dist... | false | 0.047951 | 0.121119 | 0.395897 | [
"s842338695",
"s267519953"
] |
u934246119 | p03243 | python | s950519484 | s413941408 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | n = eval(input())
if n[0] == n[1] and n[1] == n[2] and n[2] == n[0]:
print(n)
else:
n1 = int(n)
n_tmp = int(n[0])
n2 = n_tmp*100 + n_tmp*10 + n_tmp
n3 = (n_tmp+1)*100 + (n_tmp+1)*10 + n_tmp+1
if n2 >= n1:
print(n2)
else:
print(n3)
| n = int(eval(input()))
for i in range(111, 1000, 111):
if i >= n:
print(i)
exit()
else:
continue
| 12 | 7 | 280 | 129 | n = eval(input())
if n[0] == n[1] and n[1] == n[2] and n[2] == n[0]:
print(n)
else:
n1 = int(n)
n_tmp = int(n[0])
n2 = n_tmp * 100 + n_tmp * 10 + n_tmp
n3 = (n_tmp + 1) * 100 + (n_tmp + 1) * 10 + n_tmp + 1
if n2 >= n1:
print(n2)
else:
print(n3)
| n = int(eval(input()))
for i in range(111, 1000, 111):
if i >= n:
print(i)
exit()
else:
continue
| false | 41.666667 | [
"-n = eval(input())",
"-if n[0] == n[1] and n[1] == n[2] and n[2] == n[0]:",
"- print(n)",
"-else:",
"- n1 = int(n)",
"- n_tmp = int(n[0])",
"- n2 = n_tmp * 100 + n_tmp * 10 + n_tmp",
"- n3 = (n_tmp + 1) * 100 + (n_tmp + 1) * 10 + n_tmp + 1",
"- if n2 >= n1:",
"- print(n2)... | false | 0.039737 | 0.040166 | 0.989324 | [
"s950519484",
"s413941408"
] |
u163783894 | p03087 | python | s197489407 | s356162536 | 366 | 200 | 19,476 | 19,540 | Accepted | Accepted | 45.36 | import sys
def main():
N, Q = list(map(int, input().split()))
S = list(eval(input()))
ac_check = [0] * (N)
tsum = [0] * (N + 1)
for i in range(N - 1):
if S[i] == 'A' and S[i + 1] == 'C':
tsum[i + 2] += 1
ac_check[i] = 1
ac_check[i + 1] = 2
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main():
N, Q = list(map(int, readline().split()))
S = list(readline().rstrip().decode())
ac_check = [0] * (N)
tsum = [0] * (N + 1)
for i in range(N - 1):
... | 31 | 35 | 655 | 792 | import sys
def main():
N, Q = list(map(int, input().split()))
S = list(eval(input()))
ac_check = [0] * (N)
tsum = [0] * (N + 1)
for i in range(N - 1):
if S[i] == "A" and S[i + 1] == "C":
tsum[i + 2] += 1
ac_check[i] = 1
ac_check[i + 1] = 2
for i in r... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main():
N, Q = list(map(int, readline().split()))
S = list(readline().rstrip().decode())
ac_check = [0] * (N)
tsum = [0] * (N + 1)
for i in range(N - 1):
if S[i] == "A" ... | false | 11.428571 | [
"+",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"- N, Q = list(map(int, input().split()))",
"- S = list(eval(input()))",
"+ N, Q = list(map(int, readline().split()))",
"+ S = list(readline().rstrip().decode())",
"-... | false | 0.036583 | 0.035858 | 1.020234 | [
"s197489407",
"s356162536"
] |
u863442865 | p02691 | python | s316524017 | s457259320 | 227 | 143 | 61,472 | 40,548 | Accepted | Accepted | 37 | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
fro... | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
fro... | 26 | 30 | 694 | 784 | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left, bisect_right
from heap... | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left, bisect_right
from heap... | false | 13.333333 | [
"- d = defaultdict(int)",
"+ d = {}",
"- res += d[i + a[i]]",
"- d[i - a[i]] += 1",
"+ if i + a[i] in d:",
"+ res += d[i + a[i]]",
"+ if i - a[i] not in d:",
"+ d[i - a[i]] = 1",
"+ else:",
"+ d[i - a[i]] += 1"
] | false | 0.037222 | 0.041154 | 0.904451 | [
"s316524017",
"s457259320"
] |
u320567105 | p03148 | python | s964642699 | s367631334 | 508 | 436 | 30,920 | 12,968 | Accepted | Accepted | 14.17 | ri = lambda: int(eval(input()))
rl = lambda: list(map(int,input().split()))
N,K=rl()
td = [rl() for _ in range(N)]
from operator import itemgetter
key0 = itemgetter(0)
key1 = itemgetter(1)
td.sort(key=key1,reverse=True)
netas = set()
dup = []
for t,d in td[:K]:
if t in netas:
dup.append(... | n,k = list(map(int,input().split()))
top = [0]*n
sub = []
for i in range(n):
t,d = list(map(int,input().split()))
t -=1
if top[t]==0:
top[t]=d
else:
if top[t]>=d:
sub.append(d)
else:
sub.append(top[t])
top[t]=d
top.sort()
top ... | 29 | 35 | 605 | 667 | ri = lambda: int(eval(input()))
rl = lambda: list(map(int, input().split()))
N, K = rl()
td = [rl() for _ in range(N)]
from operator import itemgetter
key0 = itemgetter(0)
key1 = itemgetter(1)
td.sort(key=key1, reverse=True)
netas = set()
dup = []
for t, d in td[:K]:
if t in netas:
dup.append(d)
else:
... | n, k = list(map(int, input().split()))
top = [0] * n
sub = []
for i in range(n):
t, d = list(map(int, input().split()))
t -= 1
if top[t] == 0:
top[t] = d
else:
if top[t] >= d:
sub.append(d)
else:
sub.append(top[t])
top[t] = d
top.sort()
top = t... | false | 17.142857 | [
"-ri = lambda: int(eval(input()))",
"-rl = lambda: list(map(int, input().split()))",
"-N, K = rl()",
"-td = [rl() for _ in range(N)]",
"-from operator import itemgetter",
"-",
"-key0 = itemgetter(0)",
"-key1 = itemgetter(1)",
"-td.sort(key=key1, reverse=True)",
"-netas = set()",
"-dup = []",
"... | false | 0.074123 | 0.040224 | 1.84275 | [
"s964642699",
"s367631334"
] |
u075595666 | p03420 | python | s624958949 | s076161918 | 188 | 91 | 39,152 | 3,060 | Accepted | Accepted | 51.6 | n,k = [int(i) for i in input().split()]
ans = 0
if k != 0:
for i in range(k+1,n+1):
m = (n+1)//i
ans += (i-k)*m
if m*i+k <= n:
ans += n+1
ans -= m*i
ans -= k
else:
ans = n**2
print(ans) | n,k = [int(i) for i in input().split()]
ans = 0
for i in range(k+1,n+1):
m = (n+1)//i
ans += (i-k)*m
if m*i+k <= n:
ans += (n+1-m*i-k)
if k == 0:
ans -= n
print(ans) | 13 | 10 | 231 | 186 | n, k = [int(i) for i in input().split()]
ans = 0
if k != 0:
for i in range(k + 1, n + 1):
m = (n + 1) // i
ans += (i - k) * m
if m * i + k <= n:
ans += n + 1
ans -= m * i
ans -= k
else:
ans = n**2
print(ans)
| n, k = [int(i) for i in input().split()]
ans = 0
for i in range(k + 1, n + 1):
m = (n + 1) // i
ans += (i - k) * m
if m * i + k <= n:
ans += n + 1 - m * i - k
if k == 0:
ans -= n
print(ans)
| false | 23.076923 | [
"-if k != 0:",
"- for i in range(k + 1, n + 1):",
"- m = (n + 1) // i",
"- ans += (i - k) * m",
"- if m * i + k <= n:",
"- ans += n + 1",
"- ans -= m * i",
"- ans -= k",
"-else:",
"- ans = n**2",
"+for i in range(k + 1, n + 1):",
"+ ... | false | 0.037929 | 0.052831 | 0.71793 | [
"s624958949",
"s076161918"
] |
u057993957 | p03497 | python | s819144035 | s029123481 | 182 | 102 | 39,336 | 32,572 | Accepted | Accepted | 43.96 | from collections import Counter
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
cnt = Counter(a).most_common()[::-1]
ans = 0
if k < len(cnt):
for k, v in cnt[:len(cnt) - k]:
ans += v
print(ans) | from collections import Counter
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
cnt = Counter(a)
div = max(0, len(cnt) - k)
if div != 0:
l = sorted(cnt.values())
print((sum(l[:div])))
else:
print((0))
| 12 | 13 | 240 | 247 | from collections import Counter
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
cnt = Counter(a).most_common()[::-1]
ans = 0
if k < len(cnt):
for k, v in cnt[: len(cnt) - k]:
ans += v
print(ans)
| from collections import Counter
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
cnt = Counter(a)
div = max(0, len(cnt) - k)
if div != 0:
l = sorted(cnt.values())
print((sum(l[:div])))
else:
print((0))
| false | 7.692308 | [
"-cnt = Counter(a).most_common()[::-1]",
"-ans = 0",
"-if k < len(cnt):",
"- for k, v in cnt[: len(cnt) - k]:",
"- ans += v",
"-print(ans)",
"+cnt = Counter(a)",
"+div = max(0, len(cnt) - k)",
"+if div != 0:",
"+ l = sorted(cnt.values())",
"+ print((sum(l[:div])))",
"+else:",
... | false | 0.097593 | 0.062076 | 1.572149 | [
"s819144035",
"s029123481"
] |
u047796752 | p02744 | python | s905163939 | s002178141 | 391 | 175 | 55,384 | 79,212 | Accepted | Accepted | 55.24 | from collections import *
def dfs(now):
if len(now)==N:
print((''.join(now)))
return
for i in range(ord(max(now))-ord('a')+2):
now.append(alpha[i])
dfs(now)
now.pop()
N = int(eval(input()))
alpha = 'abcdefghijklmnopqrstuvwxyz'
dfs(deque(['a'])) | from collections import *
def dfs(l):
if len(l)==N:
print((''.join(l)))
return
for a in range(ord('a'), ord(max(l))+2):
l.append(chr(a))
dfs(l)
l.pop()
N = int(eval(input()))
dfs(deque(['a'])) | 15 | 14 | 301 | 256 | from collections import *
def dfs(now):
if len(now) == N:
print(("".join(now)))
return
for i in range(ord(max(now)) - ord("a") + 2):
now.append(alpha[i])
dfs(now)
now.pop()
N = int(eval(input()))
alpha = "abcdefghijklmnopqrstuvwxyz"
dfs(deque(["a"]))
| from collections import *
def dfs(l):
if len(l) == N:
print(("".join(l)))
return
for a in range(ord("a"), ord(max(l)) + 2):
l.append(chr(a))
dfs(l)
l.pop()
N = int(eval(input()))
dfs(deque(["a"]))
| false | 6.666667 | [
"-def dfs(now):",
"- if len(now) == N:",
"- print((\"\".join(now)))",
"+def dfs(l):",
"+ if len(l) == N:",
"+ print((\"\".join(l)))",
"- for i in range(ord(max(now)) - ord(\"a\") + 2):",
"- now.append(alpha[i])",
"- dfs(now)",
"- now.pop()",
"+ for ... | false | 0.047476 | 0.04584 | 1.035686 | [
"s905163939",
"s002178141"
] |
u883621917 | p02579 | python | s706885916 | s178654315 | 1,076 | 697 | 170,124 | 98,864 | Accepted | Accepted | 35.22 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
h, w = list(map(int, input().split()))
ch, cw = list(map(int, input().split()))
dh, dw = list(map(int, input().split()))
graph = [0] + [0] * h
dist = [0] + [0] * h
for i in range(h):
graph[i + 1] = [0] + list(input().strip())
dist[... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
h, w = list(map(int, input().split()))
ch, cw = list(map(int, input().split()))
dh, dw = list(map(int, input().split()))
graph = [0] + [0] * h
for i in range(h):
graph[i + 1] = '0' + input().strip()
from collections import deque
... | 55 | 50 | 1,863 | 1,658 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
h, w = list(map(int, input().split()))
ch, cw = list(map(int, input().split()))
dh, dw = list(map(int, input().split()))
graph = [0] + [0] * h
dist = [0] + [0] * h
for i in range(h):
graph[i + 1] = [0] + list(input().strip())
dist[i + 1] = [0] ... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
h, w = list(map(int, input().split()))
ch, cw = list(map(int, input().split()))
dh, dw = list(map(int, input().split()))
graph = [0] + [0] * h
for i in range(h):
graph[i + 1] = "0" + input().strip()
from collections import deque
def bfs(graph, qu... | false | 9.090909 | [
"-dist = [0] + [0] * h",
"- graph[i + 1] = [0] + list(input().strip())",
"- dist[i + 1] = [0] + [-1] * w",
"+ graph[i + 1] = \"0\" + input().strip()",
"-def can_move(graph, dist, next_h, next_w):",
"- if not ((1 <= next_h <= h) and (1 <= next_w <= w)):",
"- return False",
"- if g... | false | 0.044747 | 0.037849 | 1.182247 | [
"s706885916",
"s178654315"
] |
u993622994 | p03687 | python | s992834385 | s113734894 | 73 | 18 | 3,064 | 2,940 | Accepted | Accepted | 75.34 | s = list(eval(input()))
t = []
ans = 10**9 + 10
if s.count(s[0]) == len(s):
print((0))
exit()
for i in set(s):
c = i
j = 0
n = s
t = []
while j >= 0:
for k in range(1, len(n)):
if c == n[k-1] and c != n[k]:
t.append(c)
elif c... | s = eval(input())
ans = []
for ws in s:
ws = s.split(ws)
ans.append(max(list(map(len, ws))))
print((min(ans))) | 34 | 8 | 706 | 113 | s = list(eval(input()))
t = []
ans = 10**9 + 10
if s.count(s[0]) == len(s):
print((0))
exit()
for i in set(s):
c = i
j = 0
n = s
t = []
while j >= 0:
for k in range(1, len(n)):
if c == n[k - 1] and c != n[k]:
t.append(c)
elif c != n[k - 1] and ... | s = eval(input())
ans = []
for ws in s:
ws = s.split(ws)
ans.append(max(list(map(len, ws))))
print((min(ans)))
| false | 76.470588 | [
"-s = list(eval(input()))",
"-t = []",
"-ans = 10**9 + 10",
"-if s.count(s[0]) == len(s):",
"- print((0))",
"- exit()",
"-for i in set(s):",
"- c = i",
"- j = 0",
"- n = s",
"- t = []",
"- while j >= 0:",
"- for k in range(1, len(n)):",
"- if c == n[k... | false | 0.037046 | 0.037773 | 0.980731 | [
"s992834385",
"s113734894"
] |
u762420987 | p03804 | python | s643827450 | s858433665 | 32 | 18 | 3,064 | 3,060 | Accepted | Accepted | 43.75 | N, M = list(map(int, input().split()))
Alist = [list(eval(input())) for _ in range(N)]
Blist = [list(eval(input())) for _ in range(M)]
def check_in(add_tate, add_yoko):
for A, B in zip(Alist[add_tate:add_tate + M], Blist):
try:
assert A[add_yoko:add_yoko + M] == B
except Asser... | N, M = list(map(int, input().split()))
Alist = [list(eval(input())) for _ in range(N)]
Blist = [list(eval(input())) for _ in range(M)]
from sys import exit
for i in range(N - M + 1):
for j in range(N - M + 1):
for A, B in zip(Alist[i:i + M], Blist):
if A[j:j + M] != B:
br... | 24 | 13 | 599 | 380 | N, M = list(map(int, input().split()))
Alist = [list(eval(input())) for _ in range(N)]
Blist = [list(eval(input())) for _ in range(M)]
def check_in(add_tate, add_yoko):
for A, B in zip(Alist[add_tate : add_tate + M], Blist):
try:
assert A[add_yoko : add_yoko + M] == B
except AssertionE... | N, M = list(map(int, input().split()))
Alist = [list(eval(input())) for _ in range(N)]
Blist = [list(eval(input())) for _ in range(M)]
from sys import exit
for i in range(N - M + 1):
for j in range(N - M + 1):
for A, B in zip(Alist[i : i + M], Blist):
if A[j : j + M] != B:
break... | false | 45.833333 | [
"-",
"-",
"-def check_in(add_tate, add_yoko):",
"- for A, B in zip(Alist[add_tate : add_tate + M], Blist):",
"- try:",
"- assert A[add_yoko : add_yoko + M] == B",
"- except AssertionError:",
"- return False",
"- return True",
"-",
"-",
"-if Alist == Bl... | false | 0.104039 | 0.114423 | 0.909248 | [
"s643827450",
"s858433665"
] |
u057109575 | p02846 | python | s328344318 | s660685831 | 172 | 64 | 38,384 | 62,000 | Accepted | Accepted | 62.79 | T1, T2 = list(map(int, input().split()))
A1, A2 = list(map(int, input().split()))
B1, B2 = list(map(int, input().split()))
P = (A1 - B1) * T1
Q = (A2 - B2) * T2
if P > 0:
P *= -1
Q *= -1
if P + Q < 0:
print((0))
elif P + Q == 0:
print("infinity")
else:
S = -P // (P + Q)
T... |
t1, t2 = list(map(int, input().split()))
a1, a2 = list(map(int, input().split()))
b1, b2 = list(map(int, input().split()))
d1 = t1 * (a1 - b1)
d2 = t2 * (a2 - b2)
if d1 > 0:
d1 *= -1
d2 *= -1
if d1 + d2 == 0:
print("infinity")
elif d1 + d2 < 0:
print((0))
else:
cnt = -d1 // (d1 ... | 23 | 21 | 393 | 380 | T1, T2 = list(map(int, input().split()))
A1, A2 = list(map(int, input().split()))
B1, B2 = list(map(int, input().split()))
P = (A1 - B1) * T1
Q = (A2 - B2) * T2
if P > 0:
P *= -1
Q *= -1
if P + Q < 0:
print((0))
elif P + Q == 0:
print("infinity")
else:
S = -P // (P + Q)
T = -P % (P + Q)
if T... | t1, t2 = list(map(int, input().split()))
a1, a2 = list(map(int, input().split()))
b1, b2 = list(map(int, input().split()))
d1 = t1 * (a1 - b1)
d2 = t2 * (a2 - b2)
if d1 > 0:
d1 *= -1
d2 *= -1
if d1 + d2 == 0:
print("infinity")
elif d1 + d2 < 0:
print((0))
else:
cnt = -d1 // (d1 + d2)
t = -d1 % (... | false | 8.695652 | [
"-T1, T2 = list(map(int, input().split()))",
"-A1, A2 = list(map(int, input().split()))",
"-B1, B2 = list(map(int, input().split()))",
"-P = (A1 - B1) * T1",
"-Q = (A2 - B2) * T2",
"-if P > 0:",
"- P *= -1",
"- Q *= -1",
"-if P + Q < 0:",
"+t1, t2 = list(map(int, input().split()))",
"+a1, ... | false | 0.036474 | 0.036845 | 0.989939 | [
"s328344318",
"s660685831"
] |
u893063840 | p03600 | python | s923176188 | s422393946 | 1,267 | 772 | 20,868 | 20,292 | Accepted | Accepted | 39.07 | from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix
import numpy as np
n = int(eval(input()))
a = np.array([list(map(int, input().split())) for _ in range(n)])
g = csr_matrix(a)
dist = floyd_warshall(g)
if (dist == a).all():
sm = a.sum()
INF = 10 ** 18 + 1
... | from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix
import numpy as np
n = int(eval(input()))
a = np.array([list(map(int, input().split())) for _ in range(n)])
g = csr_matrix(a)
dist = floyd_warshall(g)
if (dist == a).all():
sm = a.sum()
sm //= 2
INF = 10 ... | 32 | 29 | 624 | 573 | from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix
import numpy as np
n = int(eval(input()))
a = np.array([list(map(int, input().split())) for _ in range(n)])
g = csr_matrix(a)
dist = floyd_warshall(g)
if (dist == a).all():
sm = a.sum()
INF = 10**18 + 1
for i in range(n):
... | from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix
import numpy as np
n = int(eval(input()))
a = np.array([list(map(int, input().split())) for _ in range(n)])
g = csr_matrix(a)
dist = floyd_warshall(g)
if (dist == a).all():
sm = a.sum()
sm //= 2
INF = 10**18 + 1
for i i... | false | 9.375 | [
"+ sm //= 2",
"- for v in range(n):",
"- if u == v:",
"- continue",
"+ for v in range(u + 1, n):",
"- ans = sm // 2",
"- print(ans)",
"+ print(sm)"
] | false | 0.359891 | 0.2798 | 1.286242 | [
"s923176188",
"s422393946"
] |
u223646582 | p02901 | python | s475073049 | s807237086 | 414 | 294 | 82,524 | 48,344 | Accepted | Accepted | 28.99 | N, M = list(map(int, input().split()))
dp = [[10**10 for B in range(1 << N)] for i in range(M+1)]
dp[0][0] = 0
for i in range(M):
a, b = list(map(int, input().split()))
c = [int(j) for j in input().split()]
C = sum([1 << (x-1) for x in c])
for B in range(1 << N):
dp[i+1][B] = min(d... | N, M = list(map(int, input().split()))
dp = [10**10 for B in range(1 << N)]
dp[0] = 0
for i in range(M):
a, b = list(map(int, input().split()))
c = [int(j) for j in input().split()]
C = sum([1 << (x-1) for x in c])
for B in range(1 << N):
dp[B | C] = min(dp[B | C], dp[B]+a)
if d... | 18 | 17 | 474 | 382 | N, M = list(map(int, input().split()))
dp = [[10**10 for B in range(1 << N)] for i in range(M + 1)]
dp[0][0] = 0
for i in range(M):
a, b = list(map(int, input().split()))
c = [int(j) for j in input().split()]
C = sum([1 << (x - 1) for x in c])
for B in range(1 << N):
dp[i + 1][B] = min(dp[i][B],... | N, M = list(map(int, input().split()))
dp = [10**10 for B in range(1 << N)]
dp[0] = 0
for i in range(M):
a, b = list(map(int, input().split()))
c = [int(j) for j in input().split()]
C = sum([1 << (x - 1) for x in c])
for B in range(1 << N):
dp[B | C] = min(dp[B | C], dp[B] + a)
if dp[(1 << N) - ... | false | 5.555556 | [
"-dp = [[10**10 for B in range(1 << N)] for i in range(M + 1)]",
"-dp[0][0] = 0",
"+dp = [10**10 for B in range(1 << N)]",
"+dp[0] = 0",
"- dp[i + 1][B] = min(dp[i][B], dp[i + 1][B])",
"- dp[i + 1][B | C] = min(dp[i + 1][B | C], dp[i][B] + a)",
"-if dp[M][(1 << N) - 1] == 10**10:",
"+ ... | false | 0.11784 | 0.074741 | 1.576657 | [
"s475073049",
"s807237086"
] |
u777299405 | p02270 | python | s168684203 | s692013248 | 1,050 | 830 | 11,144 | 11,140 | Accepted | Accepted | 20.95 | n, k = list(map(int, input().split()))
w = [int(eval(input())) for i in range(n)]
l = max(w)
r = sum(w)
while l < r:
m = (l + r) // 2
stack = car = 0
for i in w:
stack += i
if stack > m:
stack = i
car += 1
if car < k:
r = m
else:
... | import sys
n, k = list(map(int, input().split()))
w = [int(sys.stdin.readline()[:-1]) for i in range(n)]
l = max(w)
r = sum(w)
while l < r:
m = (l + r) // 2
stack = car = 0
for i in w:
stack += i
if stack > m:
stack = i
car += 1
if car < k:
... | 18 | 20 | 330 | 362 | n, k = list(map(int, input().split()))
w = [int(eval(input())) for i in range(n)]
l = max(w)
r = sum(w)
while l < r:
m = (l + r) // 2
stack = car = 0
for i in w:
stack += i
if stack > m:
stack = i
car += 1
if car < k:
r = m
else:
l = m + 1
prin... | import sys
n, k = list(map(int, input().split()))
w = [int(sys.stdin.readline()[:-1]) for i in range(n)]
l = max(w)
r = sum(w)
while l < r:
m = (l + r) // 2
stack = car = 0
for i in w:
stack += i
if stack > m:
stack = i
car += 1
if car < k:
r = m
else... | false | 10 | [
"+import sys",
"+",
"-w = [int(eval(input())) for i in range(n)]",
"+w = [int(sys.stdin.readline()[:-1]) for i in range(n)]"
] | false | 0.058455 | 0.092942 | 0.62894 | [
"s168684203",
"s692013248"
] |
u497046426 | p03647 | python | s751755735 | s312034292 | 1,340 | 579 | 63,888 | 6,132 | Accepted | Accepted | 56.79 | from collections import defaultdict, deque
INF = 10**12
N, M = list(map(int, input().split()))
E = defaultdict(list)
for _ in range(M):
a, b = list(map(int, input().split()))
E[a-1].append(b-1)
E[b-1].append(a-1)
dist = [INF]*N
q = deque([(0, 0)])
while q:
v, d = q.popleft()
dist[v] = ... | N, M = list(map(int, input().split()))
from_1 = [False]*N
to_N = [False]*N
for _ in range(M):
a, b = list(map(int, input().split()))
if a == 1:
from_1[b-1] = True
elif b == N:
to_N[a-1] = True
for i in range(1, N):
if from_1[i] and to_N[i]:
print('POSSIBLE')
b... | 18 | 15 | 444 | 344 | from collections import defaultdict, deque
INF = 10**12
N, M = list(map(int, input().split()))
E = defaultdict(list)
for _ in range(M):
a, b = list(map(int, input().split()))
E[a - 1].append(b - 1)
E[b - 1].append(a - 1)
dist = [INF] * N
q = deque([(0, 0)])
while q:
v, d = q.popleft()
dist[v] = d
... | N, M = list(map(int, input().split()))
from_1 = [False] * N
to_N = [False] * N
for _ in range(M):
a, b = list(map(int, input().split()))
if a == 1:
from_1[b - 1] = True
elif b == N:
to_N[a - 1] = True
for i in range(1, N):
if from_1[i] and to_N[i]:
print("POSSIBLE")
break... | false | 16.666667 | [
"-from collections import defaultdict, deque",
"-",
"-INF = 10**12",
"-E = defaultdict(list)",
"+from_1 = [False] * N",
"+to_N = [False] * N",
"- E[a - 1].append(b - 1)",
"- E[b - 1].append(a - 1)",
"-dist = [INF] * N",
"-q = deque([(0, 0)])",
"-while q:",
"- v, d = q.popleft()",
"-... | false | 0.047147 | 0.04448 | 1.059957 | [
"s751755735",
"s312034292"
] |
u355371431 | p03698 | python | s974386198 | s638553038 | 173 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.17 | S = eval(input())
dic = {}
ans = True
for i in S:
if((i in dic) == False):
dic[i] = 1
else:
ans = False
break
if(ans):
print("yes")
else:
print("no") | s = list(eval(input()))
X = len(s)
s = set(s)
Y = len(s)
if X == Y:
print("yes")
else:
print("no") | 13 | 8 | 195 | 107 | S = eval(input())
dic = {}
ans = True
for i in S:
if (i in dic) == False:
dic[i] = 1
else:
ans = False
break
if ans:
print("yes")
else:
print("no")
| s = list(eval(input()))
X = len(s)
s = set(s)
Y = len(s)
if X == Y:
print("yes")
else:
print("no")
| false | 38.461538 | [
"-S = eval(input())",
"-dic = {}",
"-ans = True",
"-for i in S:",
"- if (i in dic) == False:",
"- dic[i] = 1",
"- else:",
"- ans = False",
"- break",
"-if ans:",
"+s = list(eval(input()))",
"+X = len(s)",
"+s = set(s)",
"+Y = len(s)",
"+if X == Y:"
] | false | 0.047366 | 0.042711 | 1.108986 | [
"s974386198",
"s638553038"
] |
u864197622 | p03585 | python | s658893862 | s056669198 | 3,365 | 2,553 | 132,628 | 131,832 | Accepted | Accepted | 24.13 | def addbit(i):
i += 1
while i <= N:
BIT[i] += 1
i += i & (-i)
def getsum(i):
ret = 0
i += 1
while i != 0:
ret += BIT[i]
i -= i&(-i)
return ret
def bit(L):
global BIT
BIT=[0] * (N+1)
re = 0
for l in L:
re += getsum(l)
... | def addbit(i):
i += 1
while i <= N:
BIT[i] += 1
i += i & (-i)
def getsum(i):
ret = 0
i += 1
while i != 0:
ret += BIT[i]
i -= i&(-i)
return ret
def bit(L):
global BIT
BIT=[0] * (N+1)
re = 0
for l in L:
re += getsum(l)
... | 43 | 45 | 916 | 1,074 | def addbit(i):
i += 1
while i <= N:
BIT[i] += 1
i += i & (-i)
def getsum(i):
ret = 0
i += 1
while i != 0:
ret += BIT[i]
i -= i & (-i)
return ret
def bit(L):
global BIT
BIT = [0] * (N + 1)
re = 0
for l in L:
re += getsum(l)
addbi... | def addbit(i):
i += 1
while i <= N:
BIT[i] += 1
i += i & (-i)
def getsum(i):
ret = 0
i += 1
while i != 0:
ret += BIT[i]
i -= i & (-i)
return ret
def bit(L):
global BIT
BIT = [0] * (N + 1)
re = 0
for l in L:
re += getsum(l)
addbi... | false | 4.444444 | [
"- l, r = -1 << 28, 1 << 28",
"+ l, r, lc, rc = -1 << 28, 1 << 28, N * (N - 1) // 4 + 1, N * (N - 1) // 4 + 1",
"- m = (l + r) / 2",
"+ m = (l * rc + r * lc) / (lc + rc)",
"+ lc = ((c - N * (N - 1) // 4) * 2) ** 0.8",
"+ rc = ((N * (N - 1) // 4 - c) * 2 + 1) ** 0.... | false | 0.05017 | 0.082923 | 0.605022 | [
"s658893862",
"s056669198"
] |
u060938295 | p03031 | python | s402038318 | s754921467 | 45 | 23 | 3,064 | 3,064 | Accepted | Accepted | 48.89 | # -*- coding: utf-8 -*-
"""
Created on Sun May 26 20:56:00 2019
@author: Yamazaki Kenichi
"""
N,M = list(map(int,input().split()))
ks = [list(map(int,input().split())) for i in range(M)]
p = list(map(int,input().split()))
ans = 0
for i in range(2**N):
t = '{:010b}'.format(i)
flg = True
for... | # -*- coding: utf-8 -*-
"""
Created on Mon May 27 21:28:42 2019
@author: Yamazaki Kenichi
"""
N, M = list(map(int,input().split()))
ks = [list(map(int,input().split())) for i in range(M)]
p = list(map(int,input().split()))
S = [0 for i in range(M)]
for i in range(M):
for j in range(1,ks[i][0]+1):
... | 31 | 28 | 650 | 605 | # -*- coding: utf-8 -*-
"""
Created on Sun May 26 20:56:00 2019
@author: Yamazaki Kenichi
"""
N, M = list(map(int, input().split()))
ks = [list(map(int, input().split())) for i in range(M)]
p = list(map(int, input().split()))
ans = 0
for i in range(2**N):
t = "{:010b}".format(i)
flg = True
for j in range(M)... | # -*- coding: utf-8 -*-
"""
Created on Mon May 27 21:28:42 2019
@author: Yamazaki Kenichi
"""
N, M = list(map(int, input().split()))
ks = [list(map(int, input().split())) for i in range(M)]
p = list(map(int, input().split()))
S = [0 for i in range(M)]
for i in range(M):
for j in range(1, ks[i][0] + 1):
S[i]... | false | 9.677419 | [
"-Created on Sun May 26 20:56:00 2019",
"+Created on Mon May 27 21:28:42 2019",
"+S = [0 for i in range(M)]",
"+for i in range(M):",
"+ for j in range(1, ks[i][0] + 1):",
"+ S[i] += 2 ** (ks[i][j] - 1)",
"- t = \"{:010b}\".format(i)",
"- tmp = 0",
"- for k in range(ks[j][0... | false | 0.035785 | 0.055228 | 0.647955 | [
"s402038318",
"s754921467"
] |
u309120194 | p02571 | python | s062180627 | s010681725 | 94 | 60 | 8,988 | 9,064 | Accepted | Accepted | 36.17 | S = eval(input())
T = eval(input())
N = len(S)
M = len(T)
l = []
# Sから順にM文字切り出し、切り出した文字列とTのハミング距離における最小値を求める
for i in range(N+1-M):
dis = M
for j in range(M):
if S[i:i+M][j] == T[j]:
dis -= 1
l.append(dis)
print((min(l))) | S = eval(input())
T = eval(input())
N = len(S)
M = len(T)
ans = 1001
# Sから順にM文字切り出し、切り出した文字列とTのハミング距離における最小値を求める
for i in range(N+1-M):
dis = 0
for j in range(M):
if S[i+j] != T[j]:
dis += 1
ans = min(ans, dis)
print(ans) | 15 | 16 | 242 | 246 | S = eval(input())
T = eval(input())
N = len(S)
M = len(T)
l = []
# Sから順にM文字切り出し、切り出した文字列とTのハミング距離における最小値を求める
for i in range(N + 1 - M):
dis = M
for j in range(M):
if S[i : i + M][j] == T[j]:
dis -= 1
l.append(dis)
print((min(l)))
| S = eval(input())
T = eval(input())
N = len(S)
M = len(T)
ans = 1001
# Sから順にM文字切り出し、切り出した文字列とTのハミング距離における最小値を求める
for i in range(N + 1 - M):
dis = 0
for j in range(M):
if S[i + j] != T[j]:
dis += 1
ans = min(ans, dis)
print(ans)
| false | 6.25 | [
"-l = []",
"+ans = 1001",
"- dis = M",
"+ dis = 0",
"- if S[i : i + M][j] == T[j]:",
"- dis -= 1",
"- l.append(dis)",
"-print((min(l)))",
"+ if S[i + j] != T[j]:",
"+ dis += 1",
"+ ans = min(ans, dis)",
"+print(ans)"
] | false | 0.089183 | 0.042485 | 2.099162 | [
"s062180627",
"s010681725"
] |
u625495026 | p03624 | python | s778843052 | s419134890 | 24 | 19 | 3,832 | 3,188 | Accepted | Accepted | 20.83 | import string
s = eval(input())
for a in string.ascii_lowercase:
if a not in s:
print(a)
break
if a =="z":
print("None")
break | a = sorted(set('abcdefghijklmnopqrstuvwxyz')-set(eval(input())))
print((a[0] if a else "None")) | 9 | 2 | 168 | 88 | import string
s = eval(input())
for a in string.ascii_lowercase:
if a not in s:
print(a)
break
if a == "z":
print("None")
break
| a = sorted(set("abcdefghijklmnopqrstuvwxyz") - set(eval(input())))
print((a[0] if a else "None"))
| false | 77.777778 | [
"-import string",
"-",
"-s = eval(input())",
"-for a in string.ascii_lowercase:",
"- if a not in s:",
"- print(a)",
"- break",
"- if a == \"z\":",
"- print(\"None\")",
"- break",
"+a = sorted(set(\"abcdefghijklmnopqrstuvwxyz\") - set(eval(input())))",
"+print(... | false | 0.095845 | 0.037815 | 2.534596 | [
"s778843052",
"s419134890"
] |
u729939940 | p02780 | python | s066971500 | s700786567 | 142 | 93 | 32,072 | 31,616 | Accepted | Accepted | 34.51 | from itertools import accumulate
N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
acc = [0] + list(accumulate(P))
ans = 0
for a, b in zip(acc, acc[K:]):
exp = (b - a + K) / 2
ans = max(exp, ans)
print(ans) | from itertools import accumulate
N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
acc = [0] + list(accumulate(P))
print(((max(b - a for a, b in zip(acc, acc[K:])) + K) / 2)) | 9 | 5 | 237 | 195 | from itertools import accumulate
N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
acc = [0] + list(accumulate(P))
ans = 0
for a, b in zip(acc, acc[K:]):
exp = (b - a + K) / 2
ans = max(exp, ans)
print(ans)
| from itertools import accumulate
N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
acc = [0] + list(accumulate(P))
print(((max(b - a for a, b in zip(acc, acc[K:])) + K) / 2))
| false | 44.444444 | [
"-ans = 0",
"-for a, b in zip(acc, acc[K:]):",
"- exp = (b - a + K) / 2",
"- ans = max(exp, ans)",
"-print(ans)",
"+print(((max(b - a for a, b in zip(acc, acc[K:])) + K) / 2))"
] | false | 0.037888 | 0.038349 | 0.987983 | [
"s066971500",
"s700786567"
] |
u773265208 | p03106 | python | s922769325 | s366897380 | 184 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.76 | a,b,k = list(map(int,input().split()))
count = 0
for i in reversed(list(range(1,min(a,b)+1))):
if a % i == 0 and b % i == 0:
count += 1
if count == k:
break
print(i)
| a,b,k = list(map(int,input().split()))
def cf(x1,x2):
cf=[]
for i in range(1,min(x1,x2)+1):
if x1 % i == 0 and x2 % i == 0:
cf.append(i)
return cf
l = cf(a,b)
l.sort(reverse=True)
print((l[k-1]))
| 9 | 14 | 169 | 237 | a, b, k = list(map(int, input().split()))
count = 0
for i in reversed(list(range(1, min(a, b) + 1))):
if a % i == 0 and b % i == 0:
count += 1
if count == k:
break
print(i)
| a, b, k = list(map(int, input().split()))
def cf(x1, x2):
cf = []
for i in range(1, min(x1, x2) + 1):
if x1 % i == 0 and x2 % i == 0:
cf.append(i)
return cf
l = cf(a, b)
l.sort(reverse=True)
print((l[k - 1]))
| false | 35.714286 | [
"-count = 0",
"-for i in reversed(list(range(1, min(a, b) + 1))):",
"- if a % i == 0 and b % i == 0:",
"- count += 1",
"- if count == k:",
"- break",
"-print(i)",
"+",
"+",
"+def cf(x1, x2):",
"+ cf = []",
"+ for i in range(1, min(x1, x2) + 1):",
"+ if x1 % i... | false | 0.043697 | 0.046255 | 0.944694 | [
"s922769325",
"s366897380"
] |
u606045429 | p04000 | python | s541511165 | s909589518 | 1,982 | 1,508 | 178,292 | 178,260 | Accepted | Accepted | 23.92 | from collections import Counter
H, W, N, *AB = list(map(int, open(0).read().split()))
move = [
(-1, -1), (-1, 0), (-1, 1),
(0, -1), (0, 0), (0, 1),
(1, -1), (1, 0), (1, 1),
]
C = Counter()
for a, b in zip(*[iter(AB)] * 2):
for i, j in move:
if 2 <= a - i <= H - 1 and 2 <= b -... | from collections import Counter
H, W, N, *AB = list(map(int, open(0).read().split()))
move = [
(-1, -1), (-1, 0), (-1, 1),
(0, -1), (0, 0), (0, 1),
(1, -1), (1, 0), (1, 1),
]
C = Counter()
for a, b in zip(*[iter(AB)] * 2):
C.update(
(a - i, b - j)
for i, j in move
... | 21 | 23 | 490 | 493 | from collections import Counter
H, W, N, *AB = list(map(int, open(0).read().split()))
move = [
(-1, -1),
(-1, 0),
(-1, 1),
(0, -1),
(0, 0),
(0, 1),
(1, -1),
(1, 0),
(1, 1),
]
C = Counter()
for a, b in zip(*[iter(AB)] * 2):
for i, j in move:
if 2 <= a - i <= H - 1 and 2 <... | from collections import Counter
H, W, N, *AB = list(map(int, open(0).read().split()))
move = [
(-1, -1),
(-1, 0),
(-1, 1),
(0, -1),
(0, 0),
(0, 1),
(1, -1),
(1, 0),
(1, 1),
]
C = Counter()
for a, b in zip(*[iter(AB)] * 2):
C.update(
(a - i, b - j) for i, j in move if 2 <... | false | 8.695652 | [
"- for i, j in move:",
"- if 2 <= a - i <= H - 1 and 2 <= b - j <= W - 1:",
"- C[(a - i, b - j)] += 1",
"+ C.update(",
"+ (a - i, b - j) for i, j in move if 2 <= a - i <= H - 1 and 2 <= b - j <= W - 1",
"+ )",
"-print(((H - 2) * (W - 2) - sum(D.values())))",
"+print((... | false | 0.035438 | 0.034407 | 1.029988 | [
"s541511165",
"s909589518"
] |
u627803856 | p02659 | python | s971256519 | s370586147 | 90 | 64 | 71,312 | 61,808 | Accepted | Accepted | 28.89 | a, b = list(map(float, input().split()))
from decimal import Decimal, getcontext
from math import floor
getcontext().prec = 30
a = Decimal(str(a))
b = Decimal(str(b))
print((floor(a * b))) | a, b = input().split()
b = b.replace('.', '')
a, b = int(a), int(b)
print((a * b // 100)) | 8 | 4 | 188 | 90 | a, b = list(map(float, input().split()))
from decimal import Decimal, getcontext
from math import floor
getcontext().prec = 30
a = Decimal(str(a))
b = Decimal(str(b))
print((floor(a * b)))
| a, b = input().split()
b = b.replace(".", "")
a, b = int(a), int(b)
print((a * b // 100))
| false | 50 | [
"-a, b = list(map(float, input().split()))",
"-from decimal import Decimal, getcontext",
"-from math import floor",
"-",
"-getcontext().prec = 30",
"-a = Decimal(str(a))",
"-b = Decimal(str(b))",
"-print((floor(a * b)))",
"+a, b = input().split()",
"+b = b.replace(\".\", \"\")",
"+a, b = int(a),... | false | 0.069702 | 0.064022 | 1.088713 | [
"s971256519",
"s370586147"
] |
u992910889 | p04045 | python | s542072134 | s174077094 | 210 | 86 | 41,052 | 3,064 | Accepted | Accepted | 59.05 | import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()
def resolve():
N,K=list(map(int,input().split()))
N= str(N)
S={i for i in range(10)}
D=set(map(int,input().split()))
D=S-D
def search(N):
for i in range(len(N)):
... | import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()
def resolve():
def main():
N,K=list(map(int,input().split()))
D=set(map(int,input().split()))
L={i for i in range(10)}
U=L-D
while True:
sn ... | 36 | 29 | 590 | 579 | import sys
sys.setrecursionlimit(10**5 + 10)
def input():
return sys.stdin.readline().strip()
def resolve():
N, K = list(map(int, input().split()))
N = str(N)
S = {i for i in range(10)}
D = set(map(int, input().split()))
D = S - D
def search(N):
for i in range(len(N)):
... | import sys
sys.setrecursionlimit(10**5 + 10)
def input():
return sys.stdin.readline().strip()
def resolve():
def main():
N, K = list(map(int, input().split()))
D = set(map(int, input().split()))
L = {i for i in range(10)}
U = L - D
while True:
sn = str(N)... | false | 19.444444 | [
"- N, K = list(map(int, input().split()))",
"- N = str(N)",
"- S = {i for i in range(10)}",
"- D = set(map(int, input().split()))",
"- D = S - D",
"+ def main():",
"+ N, K = list(map(int, input().split()))",
"+ D = set(map(int, input().split()))",
"+ L = {i for... | false | 0.039058 | 0.036134 | 1.080924 | [
"s542072134",
"s174077094"
] |
u380524497 | p03290 | python | s788343926 | s691494308 | 53 | 46 | 3,064 | 3,064 | Accepted | Accepted | 13.21 | d, g = list(map(int, input().split()))
q_list = [list(map(int, input().split())) for x in range(d)]
count_list = []
for j in range(2**d):
total = 0
count = 0
for i in range(d):
if (j >> i) & 1:
total += 100*(i+1)*q_list[i][0] + q_list[i][1]
count += q_list[i][0]
... | d, g = list(map(int, input().split()))
dic = {}
ans = 9999999
for i in range(1, d+1):
dic[i] = list(map(int, input().split()))
for i in range(2**d):
total = 0
count = 0
select_list = list(range(1, d+1))
for j in range(d):
if (i >> j) & 1:
num = dic[j+1][0]
... | 30 | 39 | 806 | 922 | d, g = list(map(int, input().split()))
q_list = [list(map(int, input().split())) for x in range(d)]
count_list = []
for j in range(2**d):
total = 0
count = 0
for i in range(d):
if (j >> i) & 1:
total += 100 * (i + 1) * q_list[i][0] + q_list[i][1]
count += q_list[i][0]
if ... | d, g = list(map(int, input().split()))
dic = {}
ans = 9999999
for i in range(1, d + 1):
dic[i] = list(map(int, input().split()))
for i in range(2**d):
total = 0
count = 0
select_list = list(range(1, d + 1))
for j in range(d):
if (i >> j) & 1:
num = dic[j + 1][0]
total... | false | 23.076923 | [
"-q_list = [list(map(int, input().split())) for x in range(d)]",
"-count_list = []",
"-for j in range(2**d):",
"+dic = {}",
"+ans = 9999999",
"+for i in range(1, d + 1):",
"+ dic[i] = list(map(int, input().split()))",
"+for i in range(2**d):",
"- for i in range(d):",
"- if (j >> i) & ... | false | 0.038908 | 0.042423 | 0.917136 | [
"s788343926",
"s691494308"
] |
u075012704 | p03157 | python | s766875614 | s117542810 | 1,690 | 734 | 205,212 | 151,000 | Accepted | Accepted | 56.57 | def main():
from collections import defaultdict
import sys
sys.setrecursionlimit(10 ** 9)
H, W = list(map(int, input().split()))
G = [list(input()) for i in range(H)]
Visited = [[0] * W for i in range(H)]
direction = [[0, 1], [0, -1], [1, 0], [-1, 0]]
def ... | from collections import defaultdict
import sys
sys.setrecursionlimit(10 ** 9)
H, W = list(map(int, input().split()))
G = [list(eval(input())) for i in range(H)]
Visited = [[0] * W for i in range(H)]
direction = [[0, 1], [0, -1], [1, 0], [-1, 0]]
def dfs(ny, nx, color):
for dy, dx in direction:
... | 58 | 53 | 1,484 | 1,212 | def main():
from collections import defaultdict
import sys
sys.setrecursionlimit(10**9)
H, W = list(map(int, input().split()))
G = [list(input()) for i in range(H)]
Visited = [[0] * W for i in range(H)]
direction = [[0, 1], [0, -1], [1, 0], [-1, 0]]
def dfs(ny, nx, color):
for ... | from collections import defaultdict
import sys
sys.setrecursionlimit(10**9)
H, W = list(map(int, input().split()))
G = [list(eval(input())) for i in range(H)]
Visited = [[0] * W for i in range(H)]
direction = [[0, 1], [0, -1], [1, 0], [-1, 0]]
def dfs(ny, nx, color):
for dy, dx in direction:
if not ((0 <... | false | 8.62069 | [
"-def main():",
"- from collections import defaultdict",
"- import sys",
"+from collections import defaultdict",
"+import sys",
"- sys.setrecursionlimit(10**9)",
"- H, W = list(map(int, input().split()))",
"- G = [list(input()) for i in range(H)]",
"- Visited = [[0] * W for i in ra... | false | 0.045429 | 0.036201 | 1.254902 | [
"s766875614",
"s117542810"
] |
u498487134 | p02791 | python | s186912113 | s542572730 | 253 | 101 | 76,496 | 91,016 | Accepted | Accepted | 60.08 | N=int(eval(input()))
P=list(map(int,input().split()))
m=10**9
ans=0
for i in range(N):
if P[i]<m:
m=P[i]
ans+=1
print(ans) | import sys
input = sys.stdin.readline
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
N=I()
P=LI()
m=P[0]
cnt=1
for i in range(1,N):
if P[i]<m:
cnt+=1... | 11 | 21 | 156 | 369 | N = int(eval(input()))
P = list(map(int, input().split()))
m = 10**9
ans = 0
for i in range(N):
if P[i] < m:
m = P[i]
ans += 1
print(ans)
| import sys
input = sys.stdin.readline
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
mod = 10**9 + 7
N = I()
P = LI()
m = P[0]
cnt = 1
for i in range(1, N):
if P[i] < m:... | false | 47.619048 | [
"-N = int(eval(input()))",
"-P = list(map(int, input().split()))",
"-m = 10**9",
"-ans = 0",
"-for i in range(N):",
"- if P[i] < m:",
"- m = P[i]",
"- ans += 1",
"-print(ans)",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+",
"+def I():",
"+ return int(e... | false | 0.043508 | 0.062248 | 0.69894 | [
"s186912113",
"s542572730"
] |
u545368057 | p03243 | python | s794876060 | s024803381 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | N = int(eval(input()))
print((min([111*i-N for i in range(1,10) if 111*i>=N])+N))
| N = int(eval(input()))
for i in range(N,1000):
if len(set(str(i))) == 1:
print(i)
exit() | 2 | 5 | 75 | 106 | N = int(eval(input()))
print((min([111 * i - N for i in range(1, 10) if 111 * i >= N]) + N))
| N = int(eval(input()))
for i in range(N, 1000):
if len(set(str(i))) == 1:
print(i)
exit()
| false | 60 | [
"-print((min([111 * i - N for i in range(1, 10) if 111 * i >= N]) + N))",
"+for i in range(N, 1000):",
"+ if len(set(str(i))) == 1:",
"+ print(i)",
"+ exit()"
] | false | 0.042057 | 0.00785 | 5.357581 | [
"s794876060",
"s024803381"
] |
u077291787 | p02558 | python | s407656900 | s039723048 | 344 | 289 | 19,060 | 53,624 | Accepted | Accepted | 15.99 | class UnionFind:
__slots__ = ["_data_size", "_roots"]
def __init__(self, data_size: int) -> None:
self._data_size = data_size
self._roots = [-1] * data_size
def __getitem__(self, x: int) -> int:
while self._roots[x] >= 0:
x = self._roots[x]
return x
... | from typing import List
class UnionFind:
"""Union Find (Disjoint Set): O(α(N))
References:
https://github.com/atcoder/ac-library/blob/master/atcoder/dsu.hpp
https://tumoiyorozu.github.io/single-file-ac-library/document_en/dsu.html
"""
__slots__ = ["_data_size", "_roots"]
... | 39 | 80 | 990 | 2,398 | class UnionFind:
__slots__ = ["_data_size", "_roots"]
def __init__(self, data_size: int) -> None:
self._data_size = data_size
self._roots = [-1] * data_size
def __getitem__(self, x: int) -> int:
while self._roots[x] >= 0:
x = self._roots[x]
return x
def is_... | from typing import List
class UnionFind:
"""Union Find (Disjoint Set): O(α(N))
References:
https://github.com/atcoder/ac-library/blob/master/atcoder/dsu.hpp
https://tumoiyorozu.github.io/single-file-ac-library/document_en/dsu.html
"""
__slots__ = ["_data_size", "_roots"]
def __in... | false | 51.25 | [
"+from typing import List",
"+",
"+",
"+ \"\"\"Union Find (Disjoint Set): O(α(N))",
"+ References:",
"+ https://github.com/atcoder/ac-library/blob/master/atcoder/dsu.hpp",
"+ https://tumoiyorozu.github.io/single-file-ac-library/document_en/dsu.html",
"+ \"\"\"",
"+",
"+ ... | false | 0.036093 | 0.049746 | 0.725545 | [
"s407656900",
"s039723048"
] |
u456353530 | p03660 | python | s226459982 | s695208620 | 1,566 | 1,060 | 45,468 | 128,680 | Accepted | Accepted | 32.31 | import queue
N = int(eval(input()))
ab = [list(map(int, input().split())) for _ in range(N - 1)]
T = {}
for a, b in ab:
if a not in T:
T[a] = [b]
else:
T[a].append(b)
if b not in T:
T[b] = [a]
else:
T[b].append(a)
R = [-1] * (N + 1)
q = queue.Queue()
put = q.put
get = q.get... | import bisect
from operator import itemgetter
import math
import copy
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def... | 54 | 65 | 814 | 1,281 | import queue
N = int(eval(input()))
ab = [list(map(int, input().split())) for _ in range(N - 1)]
T = {}
for a, b in ab:
if a not in T:
T[a] = [b]
else:
T[a].append(b)
if b not in T:
T[b] = [a]
else:
T[b].append(a)
R = [-1] * (N + 1)
q = queue.Queue()
put = q.put
get = q.... | import bisect
from operator import itemgetter
import math
import copy
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL():
return list(map(int, input().split()))
def SL():
return input().split()
d... | false | 16.923077 | [
"-import queue",
"+import bisect",
"+from operator import itemgetter",
"+import math",
"+import copy",
"+import functools",
"+import itertools",
"+import numpy as np",
"+import sys",
"-N = int(eval(input()))",
"-ab = [list(map(int, input().split())) for _ in range(N - 1)]",
"-T = {}",
"+MAX_... | false | 0.048396 | 0.181845 | 0.266137 | [
"s226459982",
"s695208620"
] |
u729133443 | p03879 | python | s912735268 | s394885515 | 170 | 18 | 38,768 | 3,064 | Accepted | Accepted | 89.41 | a,b,c,d,e,f=list(map(int,open(0).read().split()))
a,b,c=sorted((s*s+t*t)**.5for s,t in((a-c,b-d),(c-e,d-f),(e-a,f-b)))
d=a+b+c
s=d/2
s=(s*(s-a)*(s-b)*(s-c))**.5
r=2*s/d
l,h=0,1e5
while h-l>1e-9:
m=(h+l)/2
if c*(r-m)/r<2*m:h=m
else:l=m
print(l) | a,b,c,d,e,f=list(map(int,open(0).read().split()))
a,b,c=sorted((s*s+t*t)**.5for s,t in((a-c,b-d),(c-e,d-f),(e-a,f-b)))
d=a+b+c
s=d/2
s=(s*(s-a)*(s-b)*(s-c))**.5
print((c/(2+c/2/s*d))) | 12 | 6 | 254 | 180 | a, b, c, d, e, f = list(map(int, open(0).read().split()))
a, b, c = sorted(
(s * s + t * t) ** 0.5 for s, t in ((a - c, b - d), (c - e, d - f), (e - a, f - b))
)
d = a + b + c
s = d / 2
s = (s * (s - a) * (s - b) * (s - c)) ** 0.5
r = 2 * s / d
l, h = 0, 1e5
while h - l > 1e-9:
m = (h + l) / 2
if c * (r - m... | a, b, c, d, e, f = list(map(int, open(0).read().split()))
a, b, c = sorted(
(s * s + t * t) ** 0.5 for s, t in ((a - c, b - d), (c - e, d - f), (e - a, f - b))
)
d = a + b + c
s = d / 2
s = (s * (s - a) * (s - b) * (s - c)) ** 0.5
print((c / (2 + c / 2 / s * d)))
| false | 50 | [
"-r = 2 * s / d",
"-l, h = 0, 1e5",
"-while h - l > 1e-9:",
"- m = (h + l) / 2",
"- if c * (r - m) / r < 2 * m:",
"- h = m",
"- else:",
"- l = m",
"-print(l)",
"+print((c / (2 + c / 2 / s * d)))"
] | false | 0.133158 | 0.007874 | 16.911021 | [
"s912735268",
"s394885515"
] |
u591295155 | p03163 | python | s062134235 | s331280495 | 1,890 | 1,477 | 7,668 | 7,668 | Accepted | Accepted | 21.85 | import sys
input=sys.stdin.readline
n,w=list(map(int,input().split()))
dp=[0]*(w+1)
def ans(n,w):
for _ in range(n):
c,p=list(map(int,input().split()))
for j in range(w,c-1,-1):
tmp=dp[j-c]+p
if dp[j]<tmp:
dp[j]=tmp
return dp[-1]
print((ans(n,w))) | N,W=list(map(int,input().split()))
def solve_knapsack(capacity):
# basic checks
dp = [0]*(capacity + 1)
# populate the capacity = 0 columns, with '0' capacity we have '0' profit
for i in range(0, N):
weights,profits = list(map(int,input().split()))
for c in range(capacity, ... | 15 | 24 | 283 | 600 | import sys
input = sys.stdin.readline
n, w = list(map(int, input().split()))
dp = [0] * (w + 1)
def ans(n, w):
for _ in range(n):
c, p = list(map(int, input().split()))
for j in range(w, c - 1, -1):
tmp = dp[j - c] + p
if dp[j] < tmp:
dp[j] = tmp
return... | N, W = list(map(int, input().split()))
def solve_knapsack(capacity):
# basic checks
dp = [0] * (capacity + 1)
# populate the capacity = 0 columns, with '0' capacity we have '0' profit
for i in range(0, N):
weights, profits = list(map(int, input().split()))
for c in range(capacity, weig... | false | 37.5 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-n, w = list(map(int, input().split()))",
"-dp = [0] * (w + 1)",
"+N, W = list(map(int, input().split()))",
"-def ans(n, w):",
"- for _ in range(n):",
"- c, p = list(map(int, input().split()))",
"- for j in range(w, c - 1, -1):",... | false | 0.038883 | 0.057126 | 0.680656 | [
"s062134235",
"s331280495"
] |
u747602774 | p03221 | python | s834047217 | s491993201 | 651 | 467 | 34,500 | 40,948 | Accepted | Accepted | 28.26 | N,M = list(map(int,input().split()))
PY = [list(map(int,input().split())) + [i] for i in range(M)]
PY.sort()
pnow = PY[0][0]
c = 1
ans = [-1 for i in range(M)]
for i in range(M):
if pnow != PY[i][0]:
c = 1
pnow = PY[i][0]
ans[PY[i][2]] = str(PY[i][0]).zfill(6) + str(c).zfill(6)... | import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7
N,M = list(map(int,readline().split()))
PY = [list(map(int,readline().split())) + [i] for i in range(M)]
PY.sort(key=lambda x: (x[0],x[1]))
ans = [None]*M
nowp = 1
cnt = 1
... | 18 | 26 | 352 | 531 | N, M = list(map(int, input().split()))
PY = [list(map(int, input().split())) + [i] for i in range(M)]
PY.sort()
pnow = PY[0][0]
c = 1
ans = [-1 for i in range(M)]
for i in range(M):
if pnow != PY[i][0]:
c = 1
pnow = PY[i][0]
ans[PY[i][2]] = str(PY[i][0]).zfill(6) + str(c).zfill(6)
c += 1
pri... | import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
# mod = 998244353
INF = 10**18
eps = 10**-7
N, M = list(map(int, readline().split()))
PY = [list(map(int, readline().split())) + [i] for i in range(M)]
PY.sort(key=lambda x: (x[0], x[1]))
ans = [None] * M
nowp = 1
cnt = 1
for i in ra... | false | 30.769231 | [
"-N, M = list(map(int, input().split()))",
"-PY = [list(map(int, input().split())) + [i] for i in range(M)]",
"-PY.sort()",
"-pnow = PY[0][0]",
"-c = 1",
"-ans = [-1 for i in range(M)]",
"+import sys",
"+",
"+readline = sys.stdin.readline",
"+sys.setrecursionlimit(10**8)",
"+mod = 10**9 + 7",
... | false | 0.074223 | 0.075781 | 0.979436 | [
"s834047217",
"s491993201"
] |
u075304271 | p03796 | python | s825766255 | s473447120 | 163 | 144 | 38,512 | 77,324 | Accepted | Accepted | 11.66 | n = int(eval(input()))
p = 1
for i in range(1,n+1):
p *= i
p = p % (10**9+7)
print(p) | import math
import collections
import fractions
import itertools
import functools
import operator
def solve():
n = int(eval(input()))
p = 1
mod = 10**9+7
for i in range(1,n+1):
p *= i
p %= mod
print(p)
return 0
if __name__ == "__main__":
solve()
| 6 | 19 | 86 | 305 | n = int(eval(input()))
p = 1
for i in range(1, n + 1):
p *= i
p = p % (10**9 + 7)
print(p)
| import math
import collections
import fractions
import itertools
import functools
import operator
def solve():
n = int(eval(input()))
p = 1
mod = 10**9 + 7
for i in range(1, n + 1):
p *= i
p %= mod
print(p)
return 0
if __name__ == "__main__":
solve()
| false | 68.421053 | [
"-n = int(eval(input()))",
"-p = 1",
"-for i in range(1, n + 1):",
"- p *= i",
"- p = p % (10**9 + 7)",
"-print(p)",
"+import math",
"+import collections",
"+import fractions",
"+import itertools",
"+import functools",
"+import operator",
"+",
"+",
"+def solve():",
"+ n = int(... | false | 0.111514 | 0.118846 | 0.938307 | [
"s825766255",
"s473447120"
] |
u103539599 | p03423 | python | s982187982 | s958147824 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | N=int(eval(input()))
print((N//3))
| print((int(eval(input()))//3))
| 2 | 1 | 28 | 23 | N = int(eval(input()))
print((N // 3))
| print((int(eval(input())) // 3))
| false | 50 | [
"-N = int(eval(input()))",
"-print((N // 3))",
"+print((int(eval(input())) // 3))"
] | false | 0.040572 | 0.041825 | 0.970059 | [
"s982187982",
"s958147824"
] |
u089230684 | p03574 | python | s459157539 | s206437706 | 30 | 26 | 3,188 | 3,188 | Accepted | Accepted | 13.33 | q=list(map(int,input().split()))
grid=[]
def k1(x,y):
z=[]
if y[0]+1<x[0]:
z.append([y[0]+1,y[1]])
if y[1]+1<x[1]:#
z.append([y[0]+1,y[1]+1])
if y[1]-1>=0:
z.append([y[0]+1,y[1]-1])
if y[0]-1>=0:
z.append([y[0]-1,y[1]])
if y[1]+1<x[1]:#
z.append([y[0]-1,y[1]+1])
... | a,b = list(map(int,input().split()))
bo = []
bo.append("."*(b+2))
for i in range(a):
s = eval(input())
s = "." + s + "."
s = list(s)
bo.append(s)
bo.append("."*(b+2))
dx = [-1,-1,-1,1,1,1,0,0]
dy = [-1,0,1,-1,0,1,1,-1]
for i in range(1,a+1):
for j in range(1,b+1):
cnt = 0
... | 48 | 26 | 1,062 | 565 | q = list(map(int, input().split()))
grid = []
def k1(x, y):
z = []
if y[0] + 1 < x[0]:
z.append([y[0] + 1, y[1]])
if y[1] + 1 < x[1]: #
z.append([y[0] + 1, y[1] + 1])
if y[1] - 1 >= 0:
z.append([y[0] + 1, y[1] - 1])
if y[0] - 1 >= 0:
z.append([y[0] ... | a, b = list(map(int, input().split()))
bo = []
bo.append("." * (b + 2))
for i in range(a):
s = eval(input())
s = "." + s + "."
s = list(s)
bo.append(s)
bo.append("." * (b + 2))
dx = [-1, -1, -1, 1, 1, 1, 0, 0]
dy = [-1, 0, 1, -1, 0, 1, 1, -1]
for i in range(1, a + 1):
for j in range(1, b + 1):
... | false | 45.833333 | [
"-q = list(map(int, input().split()))",
"-grid = []",
"-",
"-",
"-def k1(x, y):",
"- z = []",
"- if y[0] + 1 < x[0]:",
"- z.append([y[0] + 1, y[1]])",
"- if y[1] + 1 < x[1]: #",
"- z.append([y[0] + 1, y[1] + 1])",
"- if y[1] - 1 >= 0:",
"- z.ap... | false | 0.03488 | 0.035071 | 0.994565 | [
"s459157539",
"s206437706"
] |
u285891772 | p02787 | python | s288916342 | s789537974 | 1,025 | 450 | 286,940 | 65,496 | Accepted | Accepted | 56.1 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter... | 48 | 44 | 1,310 | 1,213 | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
) # , log2
from itertools import (
accumulate,
permutations,
combinations,
combi... | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
) # , log2
from itertools import (
accumulate,
permutations,
combinations,
combi... | false | 8.333333 | [
"- dp = [[INF] * (H + 1) for _ in range(N + 1)]",
"- dp[0][0] = 0",
"+ dp = [INF] * (H + 1)",
"+ dp[0] = 0",
"- dp[i + 1][j] = min(dp[i][j], B[i])",
"+ dp[j] = min(dp[j], B[i])",
"- dp[i + 1][j] = min(dp[i][j], dp[i + 1][j - A[i]] + B[i])",
"- ... | false | 0.073312 | 0.067047 | 1.093439 | [
"s288916342",
"s789537974"
] |
u759412327 | p03479 | python | s430436300 | s169811416 | 28 | 25 | 9,020 | 9,028 | Accepted | Accepted | 10.71 | X,Y = list(map(int,input().split()))
print((len(bin(Y//X))-2)) | X,Y = list(map(int,input().split()))
ans = 0
while X<=Y:
ans+=1
X*=2
print(ans) | 2 | 8 | 55 | 86 | X, Y = list(map(int, input().split()))
print((len(bin(Y // X)) - 2))
| X, Y = list(map(int, input().split()))
ans = 0
while X <= Y:
ans += 1
X *= 2
print(ans)
| false | 75 | [
"-print((len(bin(Y // X)) - 2))",
"+ans = 0",
"+while X <= Y:",
"+ ans += 1",
"+ X *= 2",
"+print(ans)"
] | false | 0.034337 | 0.081131 | 0.423232 | [
"s430436300",
"s169811416"
] |
u305388378 | p02714 | python | s995830842 | s831900998 | 180 | 140 | 67,908 | 68,068 | Accepted | Accepted | 22.22 | def solution():
n = int(eval(input()))
s = eval(input())
ans = s.count('R') * s.count('G') * s.count('B')
for i in range(n):
for j in range(i+1, n+1):
k = (j - i) + j
if k < 1 or k >= n:
continue
if s[i] != s[j] and s[j] != s[k] and ... | def solution():
n = int(eval(input()))
s = eval(input())
ans = s.count('R') * s.count('G') * s.count('B')
for i in range(n):
for j in range(i+1, n+1):
k = (j - i) + j
if k >= n:
break
if s[i] != s[j] and s[j] != s[k] and s[i] != s[k]... | 15 | 15 | 392 | 380 | def solution():
n = int(eval(input()))
s = eval(input())
ans = s.count("R") * s.count("G") * s.count("B")
for i in range(n):
for j in range(i + 1, n + 1):
k = (j - i) + j
if k < 1 or k >= n:
continue
if s[i] != s[j] and s[j] != s[k] and s[i] !=... | def solution():
n = int(eval(input()))
s = eval(input())
ans = s.count("R") * s.count("G") * s.count("B")
for i in range(n):
for j in range(i + 1, n + 1):
k = (j - i) + j
if k >= n:
break
if s[i] != s[j] and s[j] != s[k] and s[i] != s[k]:
... | false | 0 | [
"- if k < 1 or k >= n:",
"- continue",
"+ if k >= n:",
"+ break"
] | false | 0.057813 | 0.077142 | 0.749432 | [
"s995830842",
"s831900998"
] |
u191874006 | p02864 | python | s580717733 | s005345385 | 715 | 661 | 47,068 | 47,068 | Accepted | Accepted | 7.55 | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | 33 | 43 | 872 | 1,192 | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | false | 23.255814 | [
"+\"\"\"",
"+[解説AC]",
"+塗っていくときにかかるコストはΣmax(0,h[i]-h[i-1])",
"+k回まで高さを変えられる⇒k列は考えなくてよい(k列をその左と同じ高さにする)",
"+残るのはn-k列のブロック",
"+ある一列を残すと決めたとき、それにかかるコストはそれより前で残すと決めた列の高さに依存するため",
"+dp[i][j] := i列目を残すとしたとき、i列目まででj列残す場合のコストの最小値とする",
"+dp[i][j] = min(dp[i][j],dp[l][j-1] + max(0,h[i] - h[l])) (1<=l<i) (前回l列目を... | false | 0.046027 | 0.044556 | 1.033033 | [
"s580717733",
"s005345385"
] |
u315078622 | p02889 | python | s198929021 | s152805405 | 1,999 | 1,685 | 24,688 | 18,652 | Accepted | Accepted | 15.71 | from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
import numpy as np
def create_graph(N, edge_pairs, is_bi_dir=False):
in_vs, out_vs, weights = [], [], []
for s, t, w in edge_pairs:
in_vs.append(s)
out_vs.append(t)
weights.append(w)
... | from scipy.sparse.csgraph import floyd_warshall
N, M, L = list(map(int, input().split()))
graph = [[0] * N for _ in range(N)]
for _ in range(M):
s, t, w = list(map(int, input().split()))
graph[s-1][t-1] = graph[t-1][s-1] = w
dist = floyd_warshall(graph, directed=False)
graph = [[0] * N for _ in range... | 41 | 24 | 1,163 | 672 | from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
import numpy as np
def create_graph(N, edge_pairs, is_bi_dir=False):
in_vs, out_vs, weights = [], [], []
for s, t, w in edge_pairs:
in_vs.append(s)
out_vs.append(t)
weights.append(w)
if is_bi_di... | from scipy.sparse.csgraph import floyd_warshall
N, M, L = list(map(int, input().split()))
graph = [[0] * N for _ in range(N)]
for _ in range(M):
s, t, w = list(map(int, input().split()))
graph[s - 1][t - 1] = graph[t - 1][s - 1] = w
dist = floyd_warshall(graph, directed=False)
graph = [[0] * N for _ in range(N... | false | 41.463415 | [
"-from scipy.sparse import csr_matrix",
"-import numpy as np",
"-",
"-",
"-def create_graph(N, edge_pairs, is_bi_dir=False):",
"- in_vs, out_vs, weights = [], [], []",
"- for s, t, w in edge_pairs:",
"- in_vs.append(s)",
"- out_vs.append(t)",
"- weights.append(w)",
"- ... | false | 1.072368 | 0.229562 | 4.671373 | [
"s198929021",
"s152805405"
] |
u057109575 | p02689 | python | s726598081 | s470033872 | 306 | 250 | 112,472 | 97,088 | Accepted | Accepted | 18.3 |
from collections import deque
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(M)]
graph = [[] for _ in range(N + 1)]
for a, b in X:
graph[a].append(b)
graph[b].append(a)
ans = 0
for i in range(N):
ans += all(H... |
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(M)]
ok = [True] * (N + 1)
for a, b in X:
ok[a] &= H[a - 1] > H[b - 1]
ok[b] &= H[a - 1] < H[b - 1]
print((sum(ok[1:])))
| 18 | 11 | 366 | 260 | from collections import deque
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(M)]
graph = [[] for _ in range(N + 1)]
for a, b in X:
graph[a].append(b)
graph[b].append(a)
ans = 0
for i in range(N):
ans += all(H[i] > H[j - 1] for ... | N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(M)]
ok = [True] * (N + 1)
for a, b in X:
ok[a] &= H[a - 1] > H[b - 1]
ok[b] &= H[a - 1] < H[b - 1]
print((sum(ok[1:])))
| false | 38.888889 | [
"-from collections import deque",
"-",
"-graph = [[] for _ in range(N + 1)]",
"+ok = [True] * (N + 1)",
"- graph[a].append(b)",
"- graph[b].append(a)",
"-ans = 0",
"-for i in range(N):",
"- ans += all(H[i] > H[j - 1] for j in graph[i + 1])",
"-print(ans)",
"+ ok[a] &= H[a - 1] > H[b ... | false | 0.096628 | 0.144084 | 0.670638 | [
"s726598081",
"s470033872"
] |
u760760982 | p03211 | python | s203415230 | s251795433 | 30 | 27 | 9,144 | 9,084 | Accepted | Accepted | 10 | n = list(eval(input()))
m = []
ans = []
for i in range(len(n) - 2):
s = n[i] + n[i+1] + n[i+2]
m.append(int(s))
for j in m:
ans.append(abs(753 - j))
print((min(ans))) | n = eval(input())
m = [int(n[i:i+3]) for i in range(len(n)-2)]
ans = [abs(753 - j) for j in m]
print((min(ans))) | 11 | 4 | 190 | 107 | n = list(eval(input()))
m = []
ans = []
for i in range(len(n) - 2):
s = n[i] + n[i + 1] + n[i + 2]
m.append(int(s))
for j in m:
ans.append(abs(753 - j))
print((min(ans)))
| n = eval(input())
m = [int(n[i : i + 3]) for i in range(len(n) - 2)]
ans = [abs(753 - j) for j in m]
print((min(ans)))
| false | 63.636364 | [
"-n = list(eval(input()))",
"-m = []",
"-ans = []",
"-for i in range(len(n) - 2):",
"- s = n[i] + n[i + 1] + n[i + 2]",
"- m.append(int(s))",
"-for j in m:",
"- ans.append(abs(753 - j))",
"+n = eval(input())",
"+m = [int(n[i : i + 3]) for i in range(len(n) - 2)]",
"+ans = [abs(753 - j) ... | false | 0.044685 | 0.045759 | 0.976514 | [
"s203415230",
"s251795433"
] |
u706695185 | p03262 | python | s037053533 | s271466457 | 139 | 88 | 14,748 | 16,304 | Accepted | Accepted | 36.69 | from functools import reduce
def gcd(a, b):
if a < b:
a, b = b, a
if b == 0:
return a
c = a % b
return gcd(b, c)
def gcd_list(nums):
return reduce(gcd, nums)
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
x_sorted = x
x_sorted.append(X... | from functools import reduce
from fractions import gcd
def gcd(a, b):
while b:
a, b = b, a%b
return a
def gcd_list(nums):
return reduce(gcd, nums)
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
diff = [abs(xi - X) for xi in x]
print((gcd_list(diff)))
| 30 | 15 | 502 | 314 | from functools import reduce
def gcd(a, b):
if a < b:
a, b = b, a
if b == 0:
return a
c = a % b
return gcd(b, c)
def gcd_list(nums):
return reduce(gcd, nums)
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
x_sorted = x
x_sorted.append(X)
x_sorted.sort... | from functools import reduce
from fractions import gcd
def gcd(a, b):
while b:
a, b = b, a % b
return a
def gcd_list(nums):
return reduce(gcd, nums)
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
diff = [abs(xi - X) for xi in x]
print((gcd_list(diff)))
| false | 50 | [
"+from fractions import gcd",
"- if a < b:",
"- a, b = b, a",
"- if b == 0:",
"- return a",
"- c = a % b",
"- return gcd(b, c)",
"+ while b:",
"+ a, b = b, a % b",
"+ return a",
"-x_sorted = x",
"-x_sorted.append(X)",
"-x_sorted.sort()",
"-diff = []",... | false | 0.035462 | 0.056719 | 0.62523 | [
"s037053533",
"s271466457"
] |
u226108478 | p03363 | python | s184224456 | s316998947 | 182 | 139 | 40,824 | 41,620 | Accepted | Accepted | 23.63 | # -*- coding: utf-8 -*-
# AtCoder Grand Contest
# Problem A
if __name__ == '__main__':
from collections import Counter
n = int(eval(input()))
a = [0] + list(map(int, input().split()))
s = [0] * len(a)
for i in range(1, n + 1):
s[i] += s[i - 1] + a[i]
print((sum([si ... | # -*- coding: utf-8 -*-
# AtCoder Grand Contest
# Problem A
if __name__ == '__main__':
from itertools import accumulate
from collections import Counter
n = int(eval(input()))
a = [0] + list(map(int, input().split()))
# See:
# https://www.youtube.com/watch?v=8BHBFMrZ8VM
# ... | 17 | 19 | 362 | 473 | # -*- coding: utf-8 -*-
# AtCoder Grand Contest
# Problem A
if __name__ == "__main__":
from collections import Counter
n = int(eval(input()))
a = [0] + list(map(int, input().split()))
s = [0] * len(a)
for i in range(1, n + 1):
s[i] += s[i - 1] + a[i]
print((sum([si * (si - 1) // 2 for s... | # -*- coding: utf-8 -*-
# AtCoder Grand Contest
# Problem A
if __name__ == "__main__":
from itertools import accumulate
from collections import Counter
n = int(eval(input()))
a = [0] + list(map(int, input().split()))
# See:
# https://www.youtube.com/watch?v=8BHBFMrZ8VM
# https://beta.atcode... | false | 10.526316 | [
"+ from itertools import accumulate",
"- s = [0] * len(a)",
"- for i in range(1, n + 1):",
"- s[i] += s[i - 1] + a[i]",
"+ # See:",
"+ # https://www.youtube.com/watch?v=8BHBFMrZ8VM",
"+ # https://beta.atcoder.jp/contests/agc023/submissions/2431021",
"+ s = list(accumulate(a... | false | 0.077382 | 0.203407 | 0.380429 | [
"s184224456",
"s316998947"
] |
u312025627 | p03721 | python | s191270866 | s625837122 | 893 | 541 | 68,312 | 55,244 | Accepted | Accepted | 39.42 | def main():
N, K = (int(i) for i in input().split())
A = []
B = []
from bisect import bisect_left
AB = [[int(i) for i in input().split()] for j in range(N)]
AB.sort()
A = [a[0] for a in AB]
B = [a[1] for a in AB]
from itertools import accumulate
B = list(accumulate(B))
... | def main():
import sys
input = sys.stdin.buffer.readline
N, K = (int(i) for i in input().split())
AB = [[int(i) for i in input().split()] for j in range(N)]
AB.sort()
cur = 0
for a, b in AB:
if cur+b < K:
cur += b
continue
else:
... | 18 | 17 | 436 | 381 | def main():
N, K = (int(i) for i in input().split())
A = []
B = []
from bisect import bisect_left
AB = [[int(i) for i in input().split()] for j in range(N)]
AB.sort()
A = [a[0] for a in AB]
B = [a[1] for a in AB]
from itertools import accumulate
B = list(accumulate(B))
idx ... | def main():
import sys
input = sys.stdin.buffer.readline
N, K = (int(i) for i in input().split())
AB = [[int(i) for i in input().split()] for j in range(N)]
AB.sort()
cur = 0
for a, b in AB:
if cur + b < K:
cur += b
continue
else:
return p... | false | 5.555556 | [
"+ import sys",
"+",
"+ input = sys.stdin.buffer.readline",
"- A = []",
"- B = []",
"- from bisect import bisect_left",
"-",
"- A = [a[0] for a in AB]",
"- B = [a[1] for a in AB]",
"- from itertools import accumulate",
"-",
"- B = list(accumulate(B))",
"- idx = ... | false | 0.007659 | 0.06694 | 0.114411 | [
"s191270866",
"s625837122"
] |
u790710233 | p03163 | python | s107079925 | s786876941 | 591 | 359 | 120,940 | 42,220 | Accepted | Accepted | 39.26 | N, W = list(map(int, input().split()))
wv = [tuple(map(int, input().split()))for _ in range(N)]
dp = [[0]*(W+1) for _ in range(N+1)]
for i in range(1, N+1):
for j in range(1, W+1):
if 0 <= j-wv[i-1][0]:
dp[i][j] = max(dp[i-1][j], dp[i-1][j-wv[i-1][0]]+wv[i-1][1])
dp[i][j] = max(dp... | n, w = list(map(int, input().split()))
weights, values = list(zip(*[tuple(map(int, input().split()))for _ in range(n)]))
dp = [0]*(w+1)
for i in range(1, n+1):
for j in reversed(list(range(1, w+1))):
if j-weights[i-1] < 0:
continue
dp[j] = max(dp[j], dp[j-weights[i-1]]+values[i-1]... | 10 | 9 | 354 | 318 | N, W = list(map(int, input().split()))
wv = [tuple(map(int, input().split())) for _ in range(N)]
dp = [[0] * (W + 1) for _ in range(N + 1)]
for i in range(1, N + 1):
for j in range(1, W + 1):
if 0 <= j - wv[i - 1][0]:
dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - wv[i - 1][0]] + wv[i - 1][1])
... | n, w = list(map(int, input().split()))
weights, values = list(zip(*[tuple(map(int, input().split())) for _ in range(n)]))
dp = [0] * (w + 1)
for i in range(1, n + 1):
for j in reversed(list(range(1, w + 1))):
if j - weights[i - 1] < 0:
continue
dp[j] = max(dp[j], dp[j - weights[i - 1]] +... | false | 10 | [
"-N, W = list(map(int, input().split()))",
"-wv = [tuple(map(int, input().split())) for _ in range(N)]",
"-dp = [[0] * (W + 1) for _ in range(N + 1)]",
"-for i in range(1, N + 1):",
"- for j in range(1, W + 1):",
"- if 0 <= j - wv[i - 1][0]:",
"- dp[i][j] = max(dp[i - 1][j], dp[i - ... | false | 0.080069 | 0.072526 | 1.104004 | [
"s107079925",
"s786876941"
] |
u677312543 | p03240 | python | s154184260 | s502003868 | 870 | 37 | 3,064 | 3,064 | Accepted | Accepted | 95.75 | import sys
N = int(eval(input()))
list = []
for i in range(0, N):
x, y, h = [int(x) for x in input().split()]
list.append((x, y, h))
for X in range(0, 101):
for Y in range(0, 101):
b = True
H = 0
for Cx, Cy, Ch in list:
if Ch != 0:
H = Ch... | n = int(eval(input()))
c = [list(map(int, input().split())) for _ in range(n)]
for i in c:
if i[2] > 0:
o = i
break
for cx in range(101):
for cy in range(101):
H = o[2] + abs(o[0] - cx) + abs(o[1] - cy)
f = True
for i in c:
x, y, h = i[0], i[1],... | 23 | 20 | 559 | 494 | import sys
N = int(eval(input()))
list = []
for i in range(0, N):
x, y, h = [int(x) for x in input().split()]
list.append((x, y, h))
for X in range(0, 101):
for Y in range(0, 101):
b = True
H = 0
for Cx, Cy, Ch in list:
if Ch != 0:
H = Ch + abs(X - Cx) + ... | n = int(eval(input()))
c = [list(map(int, input().split())) for _ in range(n)]
for i in c:
if i[2] > 0:
o = i
break
for cx in range(101):
for cy in range(101):
H = o[2] + abs(o[0] - cx) + abs(o[1] - cy)
f = True
for i in c:
x, y, h = i[0], i[1], i[2]
... | false | 13.043478 | [
"-import sys",
"-",
"-N = int(eval(input()))",
"-list = []",
"-for i in range(0, N):",
"- x, y, h = [int(x) for x in input().split()]",
"- list.append((x, y, h))",
"-for X in range(0, 101):",
"- for Y in range(0, 101):",
"- b = True",
"- H = 0",
"- for Cx, Cy, Ch ... | false | 0.16253 | 0.04736 | 3.431796 | [
"s154184260",
"s502003868"
] |
u077291787 | p03457 | python | s461351980 | s643361994 | 380 | 199 | 3,060 | 17,440 | Accepted | Accepted | 47.63 | # ABC086C - Traveling
n = int(eval(input()))
for _ in range(n):
t, x, y = list(map(int, input().split()))
if x + y > t or (t + x + y) % 2 != 0:
print("No")
break
else:
print("Yes") | # ABC086C - Traveling (ARC089C)
import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))
for t, x, y in A:
if x + y > t or (t + x + y) % 2 != 0:
print("No")
break
else:
... | 9 | 17 | 210 | 375 | # ABC086C - Traveling
n = int(eval(input()))
for _ in range(n):
t, x, y = list(map(int, input().split()))
if x + y > t or (t + x + y) % 2 != 0:
print("No")
break
else:
print("Yes")
| # ABC086C - Traveling (ARC089C)
import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))
for t, x, y in A:
if x + y > t or (t + x + y) % 2 != 0:
print("No")
break
else:
print... | false | 47.058824 | [
"-# ABC086C - Traveling",
"-n = int(eval(input()))",
"-for _ in range(n):",
"- t, x, y = list(map(int, input().split()))",
"- if x + y > t or (t + x + y) % 2 != 0:",
"- print(\"No\")",
"- break",
"-else:",
"- print(\"Yes\")",
"+# ABC086C - Traveling (ARC089C)",
"+import sy... | false | 0.056783 | 0.041713 | 1.361277 | [
"s461351980",
"s643361994"
] |
u717762991 | p03545 | python | s035319145 | s555756631 | 169 | 66 | 38,256 | 61,792 | Accepted | Accepted | 60.95 | import sys
a,b,c,d = eval(input())
for i in ["+","-"]:
for j in ["+","-"]:
for k in ["+","-"]:
if eval(a+i+b+j+c+k+d) == 7:
print((a+i+b+j+c+k+d+"=7"))
sys.exit() | a,b,c,d = eval(input())
for i in range(2**3):
ku = ["+", "+", "+"]
for j in range(len(ku)):
if(i>>j)&1:
ku[j]= "-"
if eval(a+ku[0]+b+ku[1]+c+ku[2]+d) == 7:
print((a+ku[0]+b+ku[1]+c+ku[2]+d+"=7"))
break | 8 | 9 | 189 | 242 | import sys
a, b, c, d = eval(input())
for i in ["+", "-"]:
for j in ["+", "-"]:
for k in ["+", "-"]:
if eval(a + i + b + j + c + k + d) == 7:
print((a + i + b + j + c + k + d + "=7"))
sys.exit()
| a, b, c, d = eval(input())
for i in range(2**3):
ku = ["+", "+", "+"]
for j in range(len(ku)):
if (i >> j) & 1:
ku[j] = "-"
if eval(a + ku[0] + b + ku[1] + c + ku[2] + d) == 7:
print((a + ku[0] + b + ku[1] + c + ku[2] + d + "=7"))
break
| false | 11.111111 | [
"-import sys",
"-",
"-for i in [\"+\", \"-\"]:",
"- for j in [\"+\", \"-\"]:",
"- for k in [\"+\", \"-\"]:",
"- if eval(a + i + b + j + c + k + d) == 7:",
"- print((a + i + b + j + c + k + d + \"=7\"))",
"- sys.exit()",
"+for i in range(2**3):",
"... | false | 0.036702 | 0.036666 | 1.000986 | [
"s035319145",
"s555756631"
] |
u113694671 | p02612 | python | s930387225 | s215166916 | 30 | 27 | 9,152 | 9,112 | Accepted | Accepted | 10 | N = int(eval(input()))
if N % 1000 == 0:
print((0))
else:
print((1000 - (N % 1000))) | n = int(eval(input()))
if n % 1000 == 0:
print((0))
else:
print((1000 - n % 1000)) | 5 | 5 | 82 | 80 | N = int(eval(input()))
if N % 1000 == 0:
print((0))
else:
print((1000 - (N % 1000)))
| n = int(eval(input()))
if n % 1000 == 0:
print((0))
else:
print((1000 - n % 1000))
| false | 0 | [
"-N = int(eval(input()))",
"-if N % 1000 == 0:",
"+n = int(eval(input()))",
"+if n % 1000 == 0:",
"- print((1000 - (N % 1000)))",
"+ print((1000 - n % 1000))"
] | false | 0.076558 | 0.055855 | 1.370666 | [
"s930387225",
"s215166916"
] |
u562935282 | p02879 | python | s953339466 | s494966515 | 199 | 28 | 38,256 | 9,032 | Accepted | Accepted | 85.93 | # import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()
# int(input())
# map(int, input().split())
a, b = list(map(int, input().split()))
if 1 <= a <= 9 and 1 <= b <= 9:
print((a * b))
else:
print((-1))
| def main():
A, B = list(map(int, input().split()))
print((A * B if 1 <= A <= 9 and 1 <= B <= 9 else -1))
if __name__ == '__main__':
main()
| 16 | 7 | 253 | 151 | # import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()
# int(input())
# map(int, input().split())
a, b = list(map(int, input().split()))
if 1 <= a <= 9 and 1 <= b <= 9:
print((a * b))
else:
print((-1))
| def main():
A, B = list(map(int, input().split()))
print((A * B if 1 <= A <= 9 and 1 <= B <= 9 else -1))
if __name__ == "__main__":
main()
| false | 56.25 | [
"-# import sys",
"-#",
"-# sys.setrecursionlimit(10 ** 7)",
"-#",
"-# input = sys.stdin.readline",
"-# rstrip()",
"-# int(input())",
"-# map(int, input().split())",
"-a, b = list(map(int, input().split()))",
"-if 1 <= a <= 9 and 1 <= b <= 9:",
"- print((a * b))",
"-else:",
"- print((-1... | false | 0.034668 | 0.073483 | 0.471781 | [
"s953339466",
"s494966515"
] |
u607155447 | p02577 | python | s305448363 | s577182580 | 215 | 74 | 9,168 | 9,236 | Accepted | Accepted | 65.58 | N = int(eval(input()))
if N%9:
print('No')
else:
print('Yes') | N = eval(input())
k = 0
for i in N:
k += int(i)
if k%9:
print('No')
else:
print('Yes') | 5 | 8 | 67 | 99 | N = int(eval(input()))
if N % 9:
print("No")
else:
print("Yes")
| N = eval(input())
k = 0
for i in N:
k += int(i)
if k % 9:
print("No")
else:
print("Yes")
| false | 37.5 | [
"-N = int(eval(input()))",
"-if N % 9:",
"+N = eval(input())",
"+k = 0",
"+for i in N:",
"+ k += int(i)",
"+if k % 9:"
] | false | 0.099019 | 0.112486 | 0.880274 | [
"s305448363",
"s577182580"
] |
u843175622 | p02580 | python | s996237432 | s705925240 | 1,503 | 1,213 | 217,632 | 72,372 | Accepted | Accepted | 19.29 | from collections import defaultdict
h, w, m = list(map(int, input().split()))
row = [[0, 0] for _ in range(h + 1)]
col = [[0, 0] for _ in range(w + 1)]
ex = defaultdict(bool)
for i in range(m):
r, c = list(map(int, input().split()))
row[r][0] += 1
col[c][0] += 1
row[r][1] = r
col[c][1] =... | import numpy as np
h, w, m = list(map(int, input().split()))
xy = [tuple([int(x) - 1 for x in input().split()]) for _ in range(m)]
row = np.zeros(h, np.int)
col = np.zeros(w, np.int)
for y, x in xy:
row[y] += 1
col[x] += 1
max_cnt_y = max(row)
max_cnt_x = max(col)
max_pair = np.sum(row == max_cnt_y) * np.... | 24 | 17 | 645 | 474 | from collections import defaultdict
h, w, m = list(map(int, input().split()))
row = [[0, 0] for _ in range(h + 1)]
col = [[0, 0] for _ in range(w + 1)]
ex = defaultdict(bool)
for i in range(m):
r, c = list(map(int, input().split()))
row[r][0] += 1
col[c][0] += 1
row[r][1] = r
col[c][1] = c
ex[(... | import numpy as np
h, w, m = list(map(int, input().split()))
xy = [tuple([int(x) - 1 for x in input().split()]) for _ in range(m)]
row = np.zeros(h, np.int)
col = np.zeros(w, np.int)
for y, x in xy:
row[y] += 1
col[x] += 1
max_cnt_y = max(row)
max_cnt_x = max(col)
max_pair = np.sum(row == max_cnt_y) * np.sum(c... | false | 29.166667 | [
"-from collections import defaultdict",
"+import numpy as np",
"-row = [[0, 0] for _ in range(h + 1)]",
"-col = [[0, 0] for _ in range(w + 1)]",
"-ex = defaultdict(bool)",
"-for i in range(m):",
"- r, c = list(map(int, input().split()))",
"- row[r][0] += 1",
"- col[c][0] += 1",
"- row[... | false | 0.044578 | 0.277535 | 0.16062 | [
"s996237432",
"s705925240"
] |
u414458988 | p03609 | python | s164131569 | s192829523 | 178 | 160 | 38,256 | 38,384 | Accepted | Accepted | 10.11 | a,b = list(map(int,input().split()))
print((max(a-b,0))) | def main():
x,t = list(map(int,input().split()))
print((max(0,x-t)))
if __name__ == '__main__':
main()
| 2 | 6 | 49 | 113 | a, b = list(map(int, input().split()))
print((max(a - b, 0)))
| def main():
x, t = list(map(int, input().split()))
print((max(0, x - t)))
if __name__ == "__main__":
main()
| false | 66.666667 | [
"-a, b = list(map(int, input().split()))",
"-print((max(a - b, 0)))",
"+def main():",
"+ x, t = list(map(int, input().split()))",
"+ print((max(0, x - t)))",
"+",
"+",
"+if __name__ == \"__main__\":",
"+ main()"
] | false | 0.086779 | 0.077529 | 1.119315 | [
"s164131569",
"s192829523"
] |
u390727364 | p02689 | python | s755135745 | s072325312 | 533 | 418 | 63,404 | 45,432 | Accepted | Accepted | 21.58 | import numpy as np
n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
ab = []
g = []
for _ in range(n):
g.append([])
for _ in range(m):
a, b = list(map(int, input().split()))
ab.append([a, b])
g[a - 1].append(b - 1)
g[b - 1].append(a - 1)
ans = 0
for i in range... | def main():
n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
ab = []
g = []
for _ in range(n):
g.append([])
for _ in range(m):
a, b = list(map(int, input().split()))
ab.append([a, b])
g[a - 1].append(b - 1)
g[b - 1].app... | 23 | 26 | 451 | 566 | import numpy as np
n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
ab = []
g = []
for _ in range(n):
g.append([])
for _ in range(m):
a, b = list(map(int, input().split()))
ab.append([a, b])
g[a - 1].append(b - 1)
g[b - 1].append(a - 1)
ans = 0
for i in range(n):
check... | def main():
n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
ab = []
g = []
for _ in range(n):
g.append([])
for _ in range(m):
a, b = list(map(int, input().split()))
ab.append([a, b])
g[a - 1].append(b - 1)
g[b - 1].append(a - 1)
... | false | 11.538462 | [
"-import numpy as np",
"+def main():",
"+ n, m = list(map(int, input().split()))",
"+ h = list(map(int, input().split()))",
"+ ab = []",
"+ g = []",
"+ for _ in range(n):",
"+ g.append([])",
"+ for _ in range(m):",
"+ a, b = list(map(int, input().split()))",
"+ ... | false | 0.044439 | 0.067407 | 0.659263 | [
"s755135745",
"s072325312"
] |
u638456847 | p02660 | python | s181975074 | s016275284 | 162 | 141 | 9,300 | 9,224 | Accepted | Accepted | 12.96 | from heapq import heappop, heappush
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def prime_factorization(n):
d = {}
i = 2
while i * i <= n:
if n % i == 0:
d[i] = 1
n //= i
while n % i == 0:
... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def prime_factorization(n):
d = {}
i = 2
while i * i <= n:
if n % i == 0:
d[i] = 1
n //= i
while n % i == 0:
n //= i
d[i] ... | 49 | 39 | 995 | 707 | from heapq import heappop, heappush
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def prime_factorization(n):
d = {}
i = 2
while i * i <= n:
if n % i == 0:
d[i] = 1
n //= i
while n % i == 0:
n //=... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def prime_factorization(n):
d = {}
i = 2
while i * i <= n:
if n % i == 0:
d[i] = 1
n //= i
while n % i == 0:
n //= i
d[i] += 1
... | false | 20.408163 | [
"-from heapq import heappop, heappush",
"- queue = []",
"+ ans = 0",
"+ e = 0",
"- heappush(queue, (pow(k, i), k, i))",
"- cnt = dict()",
"- ans = 0",
"- while queue:",
"- z, p, e = heappop(queue)",
"- if p in cnt:",
"- if cnt[p] + e <= d... | false | 0.038662 | 0.03798 | 1.017941 | [
"s181975074",
"s016275284"
] |
u925782032 | p03163 | python | s985192539 | s774211012 | 1,261 | 223 | 5,764 | 39,536 | Accepted | Accepted | 82.32 | #!/usr/bin/env python3
import sys, os
range = xrange
def main():
inp = [int(x) for x in os.read(0, os.fstat(0).st_size).split()]
n, m = inp[0],inp[1]
wi, vi = inp[2], inp[3]
dp = [0] * (m + 1)
for j in range(wi, m + 1):
dp[j] = vi
for i in range(n - 1):
w... | #!/usr/bin/env python3
import sys, os
def main():
inp = [int(x) for x in os.read(0, os.fstat(0).st_size).split()]
n, m = inp[0],inp[1]
wi, vi = inp[2], inp[3]
dp = [0] * (m + 1)
for j in range(wi, m + 1):
dp[j] = vi
for i in range(n - 1):
wi = inp[2*i + 4]
... | 24 | 23 | 513 | 492 | #!/usr/bin/env python3
import sys, os
range = xrange
def main():
inp = [int(x) for x in os.read(0, os.fstat(0).st_size).split()]
n, m = inp[0], inp[1]
wi, vi = inp[2], inp[3]
dp = [0] * (m + 1)
for j in range(wi, m + 1):
dp[j] = vi
for i in range(n - 1):
wi = inp[2 * i + 4]
... | #!/usr/bin/env python3
import sys, os
def main():
inp = [int(x) for x in os.read(0, os.fstat(0).st_size).split()]
n, m = inp[0], inp[1]
wi, vi = inp[2], inp[3]
dp = [0] * (m + 1)
for j in range(wi, m + 1):
dp[j] = vi
for i in range(n - 1):
wi = inp[2 * i + 4]
vi = inp[2... | false | 4.166667 | [
"-",
"-range = xrange"
] | false | 0.039907 | 0.037269 | 1.070783 | [
"s985192539",
"s774211012"
] |
u506132575 | p00072 | python | s755304970 | s922432657 | 230 | 150 | 4,904 | 4,884 | Accepted | Accepted | 34.78 | # http://ja.wikipedia.org/wiki/%E3%83%97%E3%83%AA%E3%83%A0%E6%B3%95
class vertex:
def __init__(self):
self.is_in_V = False
def is_single_in_V(v,p):
a = v[p[0]].is_in_V
b = v[p[1]].is_in_V
return ( a and not b ) or ( not a and b )
def all_in_V(v):
for e in v:
if not e.... | def solve(nu,mu,du):
E = []
vs = [False]*nu
vs[0] = True
while True:
min_dist,ind = float("inf"),float("inf")
for i in range(len(du)):
p_from = du[i][0]
p_to = du[i][1]
if ( vs[p_from] and not vs[p_to] ) or ( not vs[p_from] and vs[p_to]):
... | 57 | 36 | 1,415 | 954 | # http://ja.wikipedia.org/wiki/%E3%83%97%E3%83%AA%E3%83%A0%E6%B3%95
class vertex:
def __init__(self):
self.is_in_V = False
def is_single_in_V(v, p):
a = v[p[0]].is_in_V
b = v[p[1]].is_in_V
return (a and not b) or (not a and b)
def all_in_V(v):
for e in v:
if not e.is_in_V:
... | def solve(nu, mu, du):
E = []
vs = [False] * nu
vs[0] = True
while True:
min_dist, ind = float("inf"), float("inf")
for i in range(len(du)):
p_from = du[i][0]
p_to = du[i][1]
if (vs[p_from] and not vs[p_to]) or (not vs[p_from] and vs[p_to]):
... | false | 36.842105 | [
"-# http://ja.wikipedia.org/wiki/%E3%83%97%E3%83%AA%E3%83%A0%E6%B3%95",
"-class vertex:",
"- def __init__(self):",
"- self.is_in_V = False",
"-",
"-",
"-def is_single_in_V(v, p):",
"- a = v[p[0]].is_in_V",
"- b = v[p[1]].is_in_V",
"- return (a and not b) or (not a and b)",
"-"... | false | 0.038746 | 0.064402 | 0.601629 | [
"s755304970",
"s922432657"
] |
u273345915 | p02712 | python | s597249365 | s443246569 | 171 | 21 | 9,168 | 9,144 | Accepted | Accepted | 87.72 | N=int(eval(input()))
sum=0
for i in range(1, N+1):
if (not i%3==0) and (not i%5==0):
sum+=i
print(sum) | def sum(n):
return n*(n+1)//2
N=int(eval(input()))
print((sum(N)-sum(N//3)*3-sum(N//5)*5+sum(N//15)*15)) | 6 | 4 | 113 | 105 | N = int(eval(input()))
sum = 0
for i in range(1, N + 1):
if (not i % 3 == 0) and (not i % 5 == 0):
sum += i
print(sum)
| def sum(n):
return n * (n + 1) // 2
N = int(eval(input()))
print((sum(N) - sum(N // 3) * 3 - sum(N // 5) * 5 + sum(N // 15) * 15))
| false | 33.333333 | [
"+def sum(n):",
"+ return n * (n + 1) // 2",
"+",
"+",
"-sum = 0",
"-for i in range(1, N + 1):",
"- if (not i % 3 == 0) and (not i % 5 == 0):",
"- sum += i",
"-print(sum)",
"+print((sum(N) - sum(N // 3) * 3 - sum(N // 5) * 5 + sum(N // 15) * 15))"
] | false | 0.487066 | 0.036433 | 13.368661 | [
"s597249365",
"s443246569"
] |
u738898077 | p03146 | python | s206048499 | s138306689 | 32 | 19 | 10,868 | 3,828 | Accepted | Accepted | 40.62 | a = int(eval(input()))
als = [0]*(10**6+2)
for i in range(0,10**6+2):
als[a] = 1
if a%2 == 0:
a = a//2
else:
a = 3*a+1
if als[a] == 1:
print((i+2))
exit()
| a = int(eval(input()))
als = [0]*(100000)
for i in range(0,10**6+2):
als[a] = 1
if a%2 == 0:
a = a//2
else:
a = 3*a+1
if als[a] == 1:
print((i+2))
exit() | 11 | 11 | 205 | 203 | a = int(eval(input()))
als = [0] * (10**6 + 2)
for i in range(0, 10**6 + 2):
als[a] = 1
if a % 2 == 0:
a = a // 2
else:
a = 3 * a + 1
if als[a] == 1:
print((i + 2))
exit()
| a = int(eval(input()))
als = [0] * (100000)
for i in range(0, 10**6 + 2):
als[a] = 1
if a % 2 == 0:
a = a // 2
else:
a = 3 * a + 1
if als[a] == 1:
print((i + 2))
exit()
| false | 0 | [
"-als = [0] * (10**6 + 2)",
"+als = [0] * (100000)"
] | false | 0.081704 | 0.058874 | 1.387772 | [
"s206048499",
"s138306689"
] |
u799428010 | p03545 | python | s827253667 | s730953083 | 31 | 27 | 9,100 | 9,196 | Accepted | Accepted | 12.9 | def dfs(i, f, sum):
if i == 3:
if sum == 7:
# 答えは1つ出力すれば良いので =7 になれば終了
print((f + "=7"))
exit()
else:
# 式 f の末尾に符号と次の数字を追加し、その分 sum に加減する
dfs(i + 1, f + "-" + s[i + 1], sum - int(s[i + 1]))
dfs(i + 1, f + "+" + s[i + 1], sum + int(s[... | s=eval(input())
def dfs(i, f, sum):
if i == 3:
if sum == 7:
# 答えは1つ出力すれば良いので =7 になれば終了
print((f + "=7"))
exit()
else:
# 式 f の末尾に符号と次の数字を追加し、その分 sum に加減する
dfs(i+1,f+"-"+s[i+1], sum-int(s[i+1]))
dfs(i+1,f+"+"+s[i+1], sum+int(s[i+1]))
d... | 16 | 12 | 370 | 334 | def dfs(i, f, sum):
if i == 3:
if sum == 7:
# 答えは1つ出力すれば良いので =7 になれば終了
print((f + "=7"))
exit()
else:
# 式 f の末尾に符号と次の数字を追加し、その分 sum に加減する
dfs(i + 1, f + "-" + s[i + 1], sum - int(s[i + 1]))
dfs(i + 1, f + "+" + s[i + 1], sum + int(s[i + 1]))
... | s = eval(input())
def dfs(i, f, sum):
if i == 3:
if sum == 7:
# 答えは1つ出力すれば良いので =7 になれば終了
print((f + "=7"))
exit()
else:
# 式 f の末尾に符号と次の数字を追加し、その分 sum に加減する
dfs(i + 1, f + "-" + s[i + 1], sum - int(s[i + 1]))
dfs(i + 1, f + "+" + s[i + 1], sum... | false | 25 | [
"+s = eval(input())",
"+",
"+",
"-s = eval(input())"
] | false | 0.033548 | 0.035602 | 0.942313 | [
"s827253667",
"s730953083"
] |
u761320129 | p03633 | python | s035232599 | s736406031 | 55 | 36 | 5,816 | 5,048 | Accepted | Accepted | 34.55 | import fractions
N = int(eval(input()))
T = [int(eval(input())) for i in range(N)]
lcm = 1
for t in T:
lcm = lcm * t // fractions.gcd(lcm,t)
print(lcm) | from fractions import gcd
N = int(eval(input()))
T = [int(eval(input())) for i in range(N)]
lcm = T[0]
for t in T[1:]:
lcm *= t // gcd(lcm,t)
print(lcm) | 8 | 7 | 151 | 150 | import fractions
N = int(eval(input()))
T = [int(eval(input())) for i in range(N)]
lcm = 1
for t in T:
lcm = lcm * t // fractions.gcd(lcm, t)
print(lcm)
| from fractions import gcd
N = int(eval(input()))
T = [int(eval(input())) for i in range(N)]
lcm = T[0]
for t in T[1:]:
lcm *= t // gcd(lcm, t)
print(lcm)
| false | 12.5 | [
"-import fractions",
"+from fractions import gcd",
"-lcm = 1",
"-for t in T:",
"- lcm = lcm * t // fractions.gcd(lcm, t)",
"+lcm = T[0]",
"+for t in T[1:]:",
"+ lcm *= t // gcd(lcm, t)"
] | false | 0.055247 | 0.130676 | 0.422782 | [
"s035232599",
"s736406031"
] |
u485319545 | p02631 | python | s493839186 | s984575621 | 213 | 190 | 31,416 | 31,544 | Accepted | Accepted | 10.8 | n=int(eval(input()))
a=list(map(int,input().split()))
tmp=[]
for i in range(n):
if i%2==1:
continue
x=a[i]^a[i+1]
tmp.append(x)
S=0
for j in range(len(tmp)):
S = S^tmp[j]
ans=[]
for k in range(n):
p = a[k]^S
ans.append(p)
print((*ans)) | n=int(eval(input()))
a=list(map(int,input().split()))
s=0
for i in range(n):
s=s^a[i]
ans=[]
for j in range(n):
tmp = s^a[j]
ans.append(tmp)
print((*ans)) | 23 | 13 | 288 | 173 | n = int(eval(input()))
a = list(map(int, input().split()))
tmp = []
for i in range(n):
if i % 2 == 1:
continue
x = a[i] ^ a[i + 1]
tmp.append(x)
S = 0
for j in range(len(tmp)):
S = S ^ tmp[j]
ans = []
for k in range(n):
p = a[k] ^ S
ans.append(p)
print((*ans))
| n = int(eval(input()))
a = list(map(int, input().split()))
s = 0
for i in range(n):
s = s ^ a[i]
ans = []
for j in range(n):
tmp = s ^ a[j]
ans.append(tmp)
print((*ans))
| false | 43.478261 | [
"-tmp = []",
"+s = 0",
"- if i % 2 == 1:",
"- continue",
"- x = a[i] ^ a[i + 1]",
"- tmp.append(x)",
"-S = 0",
"-for j in range(len(tmp)):",
"- S = S ^ tmp[j]",
"+ s = s ^ a[i]",
"-for k in range(n):",
"- p = a[k] ^ S",
"- ans.append(p)",
"+for j in range(n):",
... | false | 0.043029 | 0.043222 | 0.995524 | [
"s493839186",
"s984575621"
] |
u172147273 | p02700 | python | s895422051 | s995344931 | 60 | 25 | 61,732 | 9,100 | Accepted | Accepted | 58.33 | a,b,c,d=list(map(int,input().split()))
for _ in range(a//d):
c=c-b
if c<=0:
print("Yes")
exit()
a=a-d
if a<=0:
print("No")
exit()
if c-b<=0:print("Yes")
else:print("No")
| a,b,c,d=list(map(int,input().split()))
if (a+d-1)//d>=(c+b-1)//b:
print("Yes")
else:print("No") | 12 | 4 | 223 | 96 | a, b, c, d = list(map(int, input().split()))
for _ in range(a // d):
c = c - b
if c <= 0:
print("Yes")
exit()
a = a - d
if a <= 0:
print("No")
exit()
if c - b <= 0:
print("Yes")
else:
print("No")
| a, b, c, d = list(map(int, input().split()))
if (a + d - 1) // d >= (c + b - 1) // b:
print("Yes")
else:
print("No")
| false | 66.666667 | [
"-for _ in range(a // d):",
"- c = c - b",
"- if c <= 0:",
"- print(\"Yes\")",
"- exit()",
"- a = a - d",
"- if a <= 0:",
"- print(\"No\")",
"- exit()",
"-if c - b <= 0:",
"+if (a + d - 1) // d >= (c + b - 1) // b:"
] | false | 0.037192 | 0.034677 | 1.072516 | [
"s895422051",
"s995344931"
] |
u211747108 | p03633 | python | s693674951 | s667528637 | 257 | 35 | 64,044 | 5,076 | Accepted | Accepted | 86.38 | import fractions
from functools import reduce
N = int(eval(input()))
T = list(int(eval(input())) for _ in range(N))
def lcm_base(x, y):
return (x * y) // fractions.gcd(x, y)
def lcm(*numbers):
return reduce(lcm_base, numbers, 1)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
... | import fractions
from functools import reduce
N = int(eval(input()))
T = list(int(eval(input())) for _ in range(N))
def lcm_base(x, y):
return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
print((lcm_list(T)))
| 17 | 13 | 329 | 264 | import fractions
from functools import reduce
N = int(eval(input()))
T = list(int(eval(input())) for _ in range(N))
def lcm_base(x, y):
return (x * y) // fractions.gcd(x, y)
def lcm(*numbers):
return reduce(lcm_base, numbers, 1)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
print((lcm_... | import fractions
from functools import reduce
N = int(eval(input()))
T = list(int(eval(input())) for _ in range(N))
def lcm_base(x, y):
return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
print((lcm_list(T)))
| false | 23.529412 | [
"-def lcm(*numbers):",
"- return reduce(lcm_base, numbers, 1)",
"-",
"-"
] | false | 0.147141 | 0.169764 | 0.866741 | [
"s693674951",
"s667528637"
] |
u374551537 | p02700 | python | s135992502 | s210187507 | 25 | 21 | 9,184 | 9,180 | Accepted | Accepted | 16 | nums = [int(e) for e in input().split()]
T = nums[0]
t = nums[1]
A = nums[2]
a = nums[3]
while T > 0 and A > 0:
A = A - t
T = T - a
if A <= 0:
print('Yes')
else:
print('No') | nums = [int(e) for e in input().split()]
if nums[2]%nums[1] == 0:
A = nums[2]//nums[1]
else:
A = nums[2]//nums[1] + 1
if nums[0]%nums[3] == 0:
T = nums[0]//nums[3]
else:
T = nums[0]//nums[3] + 1
if A <= T:
print('Yes')
else:
print('No') | 14 | 16 | 204 | 279 | nums = [int(e) for e in input().split()]
T = nums[0]
t = nums[1]
A = nums[2]
a = nums[3]
while T > 0 and A > 0:
A = A - t
T = T - a
if A <= 0:
print("Yes")
else:
print("No")
| nums = [int(e) for e in input().split()]
if nums[2] % nums[1] == 0:
A = nums[2] // nums[1]
else:
A = nums[2] // nums[1] + 1
if nums[0] % nums[3] == 0:
T = nums[0] // nums[3]
else:
T = nums[0] // nums[3] + 1
if A <= T:
print("Yes")
else:
print("No")
| false | 12.5 | [
"-T = nums[0]",
"-t = nums[1]",
"-A = nums[2]",
"-a = nums[3]",
"-while T > 0 and A > 0:",
"- A = A - t",
"- T = T - a",
"-if A <= 0:",
"+if nums[2] % nums[1] == 0:",
"+ A = nums[2] // nums[1]",
"+else:",
"+ A = nums[2] // nums[1] + 1",
"+if nums[0] % nums[3] == 0:",
"+ T = ... | false | 0.048481 | 0.007033 | 6.893088 | [
"s135992502",
"s210187507"
] |
u141610915 | p03420 | python | s449120388 | s856572220 | 192 | 177 | 39,920 | 38,896 | Accepted | Accepted | 7.81 | import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
res = 0
for i in range(1, N + 1):
u = max(i - K, 0)
v = N // i
x = max(N % i - K + 1, 0)
res += u * v + x - (K == 0)
#print(i, u, v, x)
#print(res)
print(res) | import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
res = 0
for x in range(K + 1, N + 1):
res += (N // x) * (x - K) + max(0, N % x - K + (K > 0))
#print(x, res)
print(res) | 12 | 8 | 252 | 201 | import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
res = 0
for i in range(1, N + 1):
u = max(i - K, 0)
v = N // i
x = max(N % i - K + 1, 0)
res += u * v + x - (K == 0)
# print(i, u, v, x)
# print(res)
print(res)
| import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
res = 0
for x in range(K + 1, N + 1):
res += (N // x) * (x - K) + max(0, N % x - K + (K > 0))
# print(x, res)
print(res)
| false | 33.333333 | [
"-for i in range(1, N + 1):",
"- u = max(i - K, 0)",
"- v = N // i",
"- x = max(N % i - K + 1, 0)",
"- res += u * v + x - (K == 0)",
"- # print(i, u, v, x)",
"- # print(res)",
"+for x in range(K + 1, N + 1):",
"+ res += (N // x) * (x - K) + max(0, N % x - K + (K > 0))",
"+ ... | false | 0.075701 | 0.03968 | 1.907767 | [
"s449120388",
"s856572220"
] |
u124498235 | p02791 | python | s228020972 | s482360781 | 131 | 92 | 24,744 | 24,744 | Accepted | Accepted | 29.77 | n = int(eval(input()))
p = list(map(int, input().split()))
a = n
cnt = 0
for i in p:
if i <= a:
cnt += 1
a = min(a,i)
print (cnt)
| n = int(eval(input()))
p = list(map(int, input().split()))
x = 2*(10**5)+1
c = 0
for i in p:
if i < x:
x = i
c += 1
print (c)
| 9 | 9 | 136 | 133 | n = int(eval(input()))
p = list(map(int, input().split()))
a = n
cnt = 0
for i in p:
if i <= a:
cnt += 1
a = min(a, i)
print(cnt)
| n = int(eval(input()))
p = list(map(int, input().split()))
x = 2 * (10**5) + 1
c = 0
for i in p:
if i < x:
x = i
c += 1
print(c)
| false | 0 | [
"-a = n",
"-cnt = 0",
"+x = 2 * (10**5) + 1",
"+c = 0",
"- if i <= a:",
"- cnt += 1",
"- a = min(a, i)",
"-print(cnt)",
"+ if i < x:",
"+ x = i",
"+ c += 1",
"+print(c)"
] | false | 0.044348 | 0.044672 | 0.99276 | [
"s228020972",
"s482360781"
] |
u254871849 | p03424 | python | s547557761 | s314930262 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | import sys
n, *s = sys.stdin.read().split()
def main():
return 'Four' if len(set(s)) == 4 else 'Three'
if __name__ == '__main__':
ans = main()
print(ans) | import sys
n, *s = sys.stdin.read().split()
def main():
print(('Four' if len(set(s)) == 4 else 'Three'))
if __name__ == '__main__':
main() | 10 | 8 | 177 | 151 | import sys
n, *s = sys.stdin.read().split()
def main():
return "Four" if len(set(s)) == 4 else "Three"
if __name__ == "__main__":
ans = main()
print(ans)
| import sys
n, *s = sys.stdin.read().split()
def main():
print(("Four" if len(set(s)) == 4 else "Three"))
if __name__ == "__main__":
main()
| false | 20 | [
"- return \"Four\" if len(set(s)) == 4 else \"Three\"",
"+ print((\"Four\" if len(set(s)) == 4 else \"Three\"))",
"- ans = main()",
"- print(ans)",
"+ main()"
] | false | 0.0594 | 0.064903 | 0.915216 | [
"s547557761",
"s314930262"
] |
u169350228 | p02573 | python | s669472025 | s778874767 | 398 | 264 | 94,044 | 80,724 | Accepted | Accepted | 33.67 | '''
自宅用PCでの解答
'''
import math
#import numpy as np
import itertools
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecurs... | '''
自宅用PCでの解答
'''
import math
#import numpy as np
import itertools
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecurs... | 70 | 70 | 2,003 | 2,001 | """
自宅用PCでの解答
"""
import math
# import numpy as np
import itertools
import queue
import bisect
from collections import deque, defaultdict
import heapq as hpq
from sys import stdin, setrecursionlimit
# from scipy.sparse.csgraph import dijkstra
# from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimi... | """
自宅用PCでの解答
"""
import math
# import numpy as np
import itertools
import queue
import bisect
from collections import deque, defaultdict
import heapq as hpq
from sys import stdin, setrecursionlimit
# from scipy.sparse.csgraph import dijkstra
# from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimi... | false | 0 | [
"- uf = UnionFind(n)",
"+ uf = UnionFind(n + 1)",
"- uf.union(a - 1, b - 1)",
"+ uf.union(a, b)"
] | false | 0.044931 | 0.038244 | 1.174869 | [
"s669472025",
"s778874767"
] |
u905203728 | p03682 | python | s598099972 | s324164195 | 1,995 | 1,352 | 124,252 | 130,804 | Accepted | Accepted | 32.23 | class UnionFind():
def __init__(self,n):
self.n=n
self.root=[-1]*n
self.rank=[-1]*n
def Find_Root(self,x):
if self.root[x]<0:return x
else:
self.root[x]=self.Find_Root(self.root[x])
return self.root[x]
def Unite(self,x,y):
... | class UnionFind():
def __init__(self,n):
self.n=n
self.root=[-1]*n
self.rank=[-1]*n
def Find_Root(self,x):
if self.root[x]<0:return x
else:
self.root[x]=self.Find_Root(self.root[x])
return self.root[x]
def Unite(self,x,y):
... | 70 | 67 | 1,817 | 1,719 | class UnionFind:
def __init__(self, n):
self.n = n
self.root = [-1] * n
self.rank = [-1] * n
def Find_Root(self, x):
if self.root[x] < 0:
return x
else:
self.root[x] = self.Find_Root(self.root[x])
return self.root[x]
def Unite(sel... | class UnionFind:
def __init__(self, n):
self.n = n
self.root = [-1] * n
self.rank = [-1] * n
def Find_Root(self, x):
if self.root[x] < 0:
return x
else:
self.root[x] = self.Find_Root(self.root[x])
return self.root[x]
def Unite(sel... | false | 4.285714 | [
"- M.append(",
"- [",
"- min(abs(A[i][0] - A[i + 1][0]), abs(A[i][1] - A[i + 1][1])),",
"- A[i][2],",
"- A[i + 1][2],",
"- ]",
"- )",
"- M.append(",
"- [",
"- min(abs(B[i][0] - B[i + 1... | false | 0.039994 | 0.040262 | 0.993339 | [
"s598099972",
"s324164195"
] |
u752907966 | p02756 | python | s267983546 | s602782055 | 647 | 345 | 10,072 | 10,328 | Accepted | Accepted | 46.68 | def main():
from collections import deque
s=eval(input())
q=int(eval(input()))
turn = 2
d=deque(s)
for _ in [0]*q:
query = eval(input())
if query[0] == "1":
t = int(query)
turn = 3 - turn
else:
t,f,c = list(map(str,query.split()))
if (... | def main():
from collections import deque
import sys
input = sys.stdin.readline
s=input().rstrip()
q=int(input().rstrip())
turn = 2
d=deque(s)
for _ in [0]*q:
query = input().rstrip()
if query[0] == "1":
t = int(query)
turn = 3 - turn
else:
... | 23 | 25 | 492 | 563 | def main():
from collections import deque
s = eval(input())
q = int(eval(input()))
turn = 2
d = deque(s)
for _ in [0] * q:
query = eval(input())
if query[0] == "1":
t = int(query)
turn = 3 - turn
else:
t, f, c = list(map(str, query.spl... | def main():
from collections import deque
import sys
input = sys.stdin.readline
s = input().rstrip()
q = int(input().rstrip())
turn = 2
d = deque(s)
for _ in [0] * q:
query = input().rstrip()
if query[0] == "1":
t = int(query)
turn = 3 - turn
... | false | 8 | [
"+ import sys",
"- s = eval(input())",
"- q = int(eval(input()))",
"+ input = sys.stdin.readline",
"+ s = input().rstrip()",
"+ q = int(input().rstrip())",
"- query = eval(input())",
"+ query = input().rstrip()"
] | false | 0.037287 | 0.037506 | 0.994162 | [
"s267983546",
"s602782055"
] |
u754022296 | p02802 | python | s577183798 | s586826897 | 272 | 191 | 33,700 | 10,396 | Accepted | Accepted | 29.78 | n, m = list(map(int, input().split()))
ps = [input().split() for _ in range(m)]
ac = [0]*n
pe = [0]*n
for p, s in ps:
k = int(p) - 1
if s == "AC":
ac[k] = 1
else:
if ac[k]:
continue
else:
pe[k] += 1
v, w = 0, 0
for i in range(n):
if ac[i]:
v += 1
w += pe[i]
prin... | n, m = list(map(int, input().split()))
cnt = 0
pena = 0
L = [-1]*(n+1)
C = [0]*(n+1)
for _ in range(m):
p, s = input().split()
p = int(p)
if s == "WA":
if L[p] == -1:
C[p] += 1
else:
if L[p] == -1:
L[p] = 1
cnt += 1
pena += C[p]
print((cnt, pena)) | 19 | 17 | 321 | 295 | n, m = list(map(int, input().split()))
ps = [input().split() for _ in range(m)]
ac = [0] * n
pe = [0] * n
for p, s in ps:
k = int(p) - 1
if s == "AC":
ac[k] = 1
else:
if ac[k]:
continue
else:
pe[k] += 1
v, w = 0, 0
for i in range(n):
if ac[i]:
v +=... | n, m = list(map(int, input().split()))
cnt = 0
pena = 0
L = [-1] * (n + 1)
C = [0] * (n + 1)
for _ in range(m):
p, s = input().split()
p = int(p)
if s == "WA":
if L[p] == -1:
C[p] += 1
else:
if L[p] == -1:
L[p] = 1
cnt += 1
pena += C[p]
pri... | false | 10.526316 | [
"-ps = [input().split() for _ in range(m)]",
"-ac = [0] * n",
"-pe = [0] * n",
"-for p, s in ps:",
"- k = int(p) - 1",
"- if s == \"AC\":",
"- ac[k] = 1",
"+cnt = 0",
"+pena = 0",
"+L = [-1] * (n + 1)",
"+C = [0] * (n + 1)",
"+for _ in range(m):",
"+ p, s = input().split()",
... | false | 0.039375 | 0.038127 | 1.032728 | [
"s577183798",
"s586826897"
] |
u533039576 | p02960 | python | s101152361 | s766639072 | 1,105 | 312 | 44,856 | 88,044 | Accepted | Accepted | 71.76 | s = eval(input())
MOD = 10**9 + 7
dp = [[0 for i in range(13)] for j in range(2)]
if s[0] == '?':
for i in range(10):
dp[0][i] = 1
else:
dp[0][int(s[0])] = 1
for i in range(1, len(s)):
for j in range(13):
dp[i%2][j] = 0
if s[i] == '?':
for j in range(13):
... | MOD = 10**9 + 7
s = eval(input())
n = len(s)
# dp[i][r] = (最初のi桁を見て、余りがrとなるような個数)
dp = [[0] * 13 for _ in range(n + 1)]
dp[0][0] = 1
for i in range(n):
if s[i] == '?':
for r in range(13):
for d in range(10):
r1 = (r * 10 + d) % 13
dp[i + 1][r1] += d... | 29 | 24 | 669 | 571 | s = eval(input())
MOD = 10**9 + 7
dp = [[0 for i in range(13)] for j in range(2)]
if s[0] == "?":
for i in range(10):
dp[0][i] = 1
else:
dp[0][int(s[0])] = 1
for i in range(1, len(s)):
for j in range(13):
dp[i % 2][j] = 0
if s[i] == "?":
for j in range(13):
for k in r... | MOD = 10**9 + 7
s = eval(input())
n = len(s)
# dp[i][r] = (最初のi桁を見て、余りがrとなるような個数)
dp = [[0] * 13 for _ in range(n + 1)]
dp[0][0] = 1
for i in range(n):
if s[i] == "?":
for r in range(13):
for d in range(10):
r1 = (r * 10 + d) % 13
dp[i + 1][r1] += dp[i][r]
... | false | 17.241379 | [
"+MOD = 10**9 + 7",
"-MOD = 10**9 + 7",
"-dp = [[0 for i in range(13)] for j in range(2)]",
"-if s[0] == \"?\":",
"- for i in range(10):",
"- dp[0][i] = 1",
"-else:",
"- dp[0][int(s[0])] = 1",
"-for i in range(1, len(s)):",
"- for j in range(13):",
"- dp[i % 2][j] = 0",
... | false | 0.06366 | 0.03743 | 1.700794 | [
"s101152361",
"s766639072"
] |
u298520807 | p03775 | python | s316018166 | s146695420 | 57 | 49 | 3,060 | 2,940 | Accepted | Accepted | 14.04 | def F(a, b):
def _(n):
c = 0
while n:
n //= 10
c += 1
return c
return _(max(a, b))
N = int(eval(input()))
ans = float('inf')
for a in range(1, N + 1):
b = N // a
if a > b:
break
if b != N / a:
continue
ans = mi... | def F(a, b):
# def _(n):
# c = 0
# while n:
# n //= 10
# c += 1
# return c
# return _(max(a, b))
return len(str(max(a, b)))
N = int(eval(input()))
ans = float('inf')
n = int(N**0.5) + 1
for a in range(1, n):
b = N // a
if b != N / a... | 21 | 21 | 342 | 375 | def F(a, b):
def _(n):
c = 0
while n:
n //= 10
c += 1
return c
return _(max(a, b))
N = int(eval(input()))
ans = float("inf")
for a in range(1, N + 1):
b = N // a
if a > b:
break
if b != N / a:
continue
ans = min(ans, F(a, b))
pri... | def F(a, b):
# def _(n):
# c = 0
# while n:
# n //= 10
# c += 1
# return c
# return _(max(a, b))
return len(str(max(a, b)))
N = int(eval(input()))
ans = float("inf")
n = int(N**0.5) + 1
for a in range(1, n):
b = N // a
if b != N / a:
continue... | false | 0 | [
"- def _(n):",
"- c = 0",
"- while n:",
"- n //= 10",
"- c += 1",
"- return c",
"-",
"- return _(max(a, b))",
"+ # def _(n):",
"+ # c = 0",
"+ # while n:",
"+ # n //= 10",
"+ # c += 1",
"+ # retu... | false | 0.063592 | 0.060802 | 1.045893 | [
"s316018166",
"s146695420"
] |
u261103969 | p02725 | python | s779282906 | s063398620 | 282 | 251 | 73,164 | 71,976 | Accepted | Accepted | 10.99 | import sys
# import bisect
# from collections import Counter, deque, defaultdict
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter
import math
# import numpy as np
readline = sys.stdin.readline
MOD =... | import sys
# import bisect
# from collections import Counter, deque, defaultdict
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter
# import math
# import numpy as np
readline = sys.stdin.readline
M... | 43 | 35 | 909 | 687 | import sys
# import bisect
# from collections import Counter, deque, defaultdict
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter
import math
# import numpy as np
readline = sys.stdin.readline
MOD = 10**9 + 7
INF ... | import sys
# import bisect
# from collections import Counter, deque, defaultdict
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter
# import math
# import numpy as np
readline = sys.stdin.readline
MOD = 10**9 + 7
INF... | false | 18.604651 | [
"-import math",
"-",
"+# import math",
"- ans = INF",
"- temp1 = a[-1] - a[0]",
"- temp2 = k - (a[1] - a[0])",
"- ans = min(ans, temp1, temp2)",
"+ d = [0] * (n - 1)",
"+ d[0] = (k - a[-1]) + a[0]",
"- temp1 = k - (a[i + 1] - a[i])",
"- temp2 = k - (a[i] - a[i - 1... | false | 0.077575 | 0.037524 | 2.067351 | [
"s779282906",
"s063398620"
] |
u519968172 | p03221 | python | s160915711 | s096882088 | 1,311 | 443 | 34,264 | 34,200 | Accepted | Accepted | 66.21 | n,m=list(map(int,input().split()))
import bisect
l=[[] for _ in range(n)]
l2=[]
for i in range(m):
p,y=list(map(int,input().split()))
bisect.insort_left(l[p-1],y)
l2.append([p,y])
for m in l2:
print(("{:06d}".format(m[0]) +"{:06d}".format(bisect.bisect_left(l[m[0]-1],m[1])+1)))
| n,m=list(map(int,input().split()))
import bisect
l=[[] for _ in range(n)]
l2=[]
for i in range(m):
p,y=list(map(int,input().split()))
l[p-1].append(y)
l2.append([p,y])
for m in l:
m.sort()
for m in l2:
print(("{:06d}".format(m[0]) +"{:06d}".format(bisect.bisect_left(l[m[0]-1],m[1])+1)))
| 12 | 14 | 286 | 299 | n, m = list(map(int, input().split()))
import bisect
l = [[] for _ in range(n)]
l2 = []
for i in range(m):
p, y = list(map(int, input().split()))
bisect.insort_left(l[p - 1], y)
l2.append([p, y])
for m in l2:
print(
(
"{:06d}".format(m[0])
+ "{:06d}".format(bisect.bisect... | n, m = list(map(int, input().split()))
import bisect
l = [[] for _ in range(n)]
l2 = []
for i in range(m):
p, y = list(map(int, input().split()))
l[p - 1].append(y)
l2.append([p, y])
for m in l:
m.sort()
for m in l2:
print(
(
"{:06d}".format(m[0])
+ "{:06d}".format(b... | false | 14.285714 | [
"- bisect.insort_left(l[p - 1], y)",
"+ l[p - 1].append(y)",
"+for m in l:",
"+ m.sort()"
] | false | 0.056879 | 0.039482 | 1.440629 | [
"s160915711",
"s096882088"
] |
u047796752 | p02814 | python | s232291990 | s371810033 | 432 | 328 | 60,900 | 60,900 | Accepted | Accepted | 24.07 | import sys
input = sys.stdin.readline
def gcd(a, b):
while b:
a, b = b, a%b
return a
def lcm(a, b):
return a*b//gcd(a, b)
N, M = list(map(int, input().split()))
a = list(map(int, input().split()))
b = [ai//2 for ai in a]
cnt = [0]*N
for i in range(N):
tmp = b[i]
w... | import sys
input = sys.stdin.readline
def gcd(a, b):
while b:
a, b = b, a%b
return a
def lcm(a, b):
return a//gcd(a, b)*b
N, M = list(map(int, input().split()))
a = list(map(int, input().split()))
b = [ai//2 for ai in a]
cnt = [0]*N
for i in range(N):
t = b[i]
whi... | 41 | 36 | 567 | 519 | import sys
input = sys.stdin.readline
def gcd(a, b):
while b:
a, b = b, a % b
return a
def lcm(a, b):
return a * b // gcd(a, b)
N, M = list(map(int, input().split()))
a = list(map(int, input().split()))
b = [ai // 2 for ai in a]
cnt = [0] * N
for i in range(N):
tmp = b[i]
while tmp % ... | import sys
input = sys.stdin.readline
def gcd(a, b):
while b:
a, b = b, a % b
return a
def lcm(a, b):
return a // gcd(a, b) * b
N, M = list(map(int, input().split()))
a = list(map(int, input().split()))
b = [ai // 2 for ai in a]
cnt = [0] * N
for i in range(N):
t = b[i]
while t % 2 ==... | false | 12.195122 | [
"- return a * b // gcd(a, b)",
"+ return a // gcd(a, b) * b",
"- tmp = b[i]",
"- while tmp % 2 == 0:",
"- tmp //= 2",
"+ t = b[i]",
"+ while t % 2 == 0:",
"-if len(set(cnt)) != 1:",
"+ t //= 2",
"+if cnt != [cnt[0]] * N:",
"-L2 = 1",
"-for ai in a:",
"- L2 ... | false | 0.108996 | 0.05784 | 1.884436 | [
"s232291990",
"s371810033"
] |
u141610915 | p03634 | python | s716013504 | s534265621 | 813 | 284 | 102,488 | 104,716 | Accepted | Accepted | 65.07 | import sys
from collections import defaultdict as dd
input = sys.stdin.readline
N = int(eval(input()))
e = dd(list)
for _ in range(N - 1):
u, v, c = list(map(int, input().split()))
e[u].append((v, c))
e[v].append((u, c))
Q, K = list(map(int, input().split()))
import heapq
class dijkstra:
def __init_... | import sys
from collections import defaultdict as dd
input = sys.stdin.readline
N = int(eval(input()))
e = dd(list)
for _ in range(N - 1):
u, v, c = list(map(int, input().split()))
e[u].append((v, c))
e[v].append((u, c))
Q, K = list(map(int, input().split()))
dp = [10 ** 15] * (N + 1)
dp[K] = 0
s = ... | 37 | 24 | 921 | 509 | import sys
from collections import defaultdict as dd
input = sys.stdin.readline
N = int(eval(input()))
e = dd(list)
for _ in range(N - 1):
u, v, c = list(map(int, input().split()))
e[u].append((v, c))
e[v].append((u, c))
Q, K = list(map(int, input().split()))
import heapq
class dijkstra:
def __init__... | import sys
from collections import defaultdict as dd
input = sys.stdin.readline
N = int(eval(input()))
e = dd(list)
for _ in range(N - 1):
u, v, c = list(map(int, input().split()))
e[u].append((v, c))
e[v].append((u, c))
Q, K = list(map(int, input().split()))
dp = [10**15] * (N + 1)
dp[K] = 0
s = [K]
while... | false | 35.135135 | [
"-import heapq",
"-",
"-",
"-class dijkstra:",
"- def __init__(self, n, e):",
"- self.e = e",
"- self.n = n",
"-",
"- def path(self, s, t):",
"- d = [float(\"inf\")] * (self.n + 1)",
"- vis = set()",
"- d[s] = 0",
"- h = [s]",
"- while... | false | 0.047226 | 0.047034 | 1.004087 | [
"s716013504",
"s534265621"
] |
u631277801 | p03476 | python | s806296835 | s706217165 | 311 | 280 | 18,372 | 8,660 | Accepted | Accepted | 9.97 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.rea... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.re... | 61 | 65 | 1,521 | 1,529 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | false | 6.153846 | [
"-from math import sqrt",
"-from bisect import bisect_left, bisect_right",
"-",
"-# 半開区間[lower, upper)の素数のリストを作成する",
"- # 素数リストの初期化",
"- isPrime = [True] * upper",
"- primeList = []",
"- # 区間内の数字が0,1のみならここで終了",
"- return primeList",
"- # 区間内の数字に2以上のものがあるとき",
"- isPrime[0... | false | 0.096943 | 0.179076 | 0.541354 | [
"s806296835",
"s706217165"
] |
u951601135 | p03416 | python | s241230073 | s974315424 | 55 | 45 | 3,060 | 3,060 | Accepted | Accepted | 18.18 | A,B=list(map(int,input().split()))
S=0
for I in range(A,B+1):
Q=str(I)
R=Q[::-1]
if R==Q:
S+=1
print(S) | a,b=list(map(int,input().split()))
print((len([i for i in map(str,list(range(a,b+1))) if i==i[::-1]])))#条件を満たすとき、リストの長さを1増やす。リストの長さが回文数の数。 | 8 | 2 | 109 | 125 | A, B = list(map(int, input().split()))
S = 0
for I in range(A, B + 1):
Q = str(I)
R = Q[::-1]
if R == Q:
S += 1
print(S)
| a, b = list(map(int, input().split()))
print(
(len([i for i in map(str, list(range(a, b + 1))) if i == i[::-1]]))
) # 条件を満たすとき、リストの長さを1増やす。リストの長さが回文数の数。
| false | 75 | [
"-A, B = list(map(int, input().split()))",
"-S = 0",
"-for I in range(A, B + 1):",
"- Q = str(I)",
"- R = Q[::-1]",
"- if R == Q:",
"- S += 1",
"-print(S)",
"+a, b = list(map(int, input().split()))",
"+print(",
"+ (len([i for i in map(str, list(range(a, b + 1))) if i == i[::-1... | false | 0.047335 | 0.212401 | 0.222858 | [
"s241230073",
"s974315424"
] |
u600402037 | p02918 | python | s500595544 | s135411879 | 286 | 46 | 15,820 | 4,028 | Accepted | Accepted | 83.92 | N, K = list(map(int, input().split()))
import numpy as np
S = np.array(list(eval(input())))
count = 0
if len(S) >= 2:
if S[0] == 'R' and S[1] == 'R':
count += 1
if S[-1] == 'L' and S[-2] == 'L':
count += 1
for i in range(1, N-1):
if S[i] == 'R' and S[i+1] == 'R':
count += ... | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, K = lr()
S = list(sr())
start = 0
for i in range(1, N):
if S[i] == S[i-1]:
start += 1
answer = min(start + 2 * K, N-1)
print(answer)
# 45 | 16 | 16 | 408 | 289 | N, K = list(map(int, input().split()))
import numpy as np
S = np.array(list(eval(input())))
count = 0
if len(S) >= 2:
if S[0] == "R" and S[1] == "R":
count += 1
if S[-1] == "L" and S[-2] == "L":
count += 1
for i in range(1, N - 1):
if S[i] == "R" and S[i + 1] == "R":
count += 1
... | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, K = lr()
S = list(sr())
start = 0
for i in range(1, N):
if S[i] == S[i - 1]:
start += 1
answer = min(start + 2 * K, N - 1)
print(answer)
# 45
| false | 0 | [
"-N, K = list(map(int, input().split()))",
"-import numpy as np",
"+import sys",
"-S = np.array(list(eval(input())))",
"-count = 0",
"-if len(S) >= 2:",
"- if S[0] == \"R\" and S[1] == \"R\":",
"- count += 1",
"- if S[-1] == \"L\" and S[-2] == \"L\":",
"- count += 1",
"-for i... | false | 0.27262 | 0.046297 | 5.888567 | [
"s500595544",
"s135411879"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.