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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u354916249 | p04030 | python | s756032508 | s102359409 | 24 | 18 | 3,316 | 2,940 | Accepted | Accepted | 25 | from collections import deque
s = eval(input())
ans = deque()
for i in s:
if i == 'B':
if ans != deque([]):
ans.pop()
else:
ans.append(i)
ans = "".join(list(ans))
print(ans) | s = []
for i in eval(input()):
if i == 'B':
s = s[:-1]
else:
s += i
print(("".join(s))) | 16 | 9 | 223 | 113 | from collections import deque
s = eval(input())
ans = deque()
for i in s:
if i == "B":
if ans != deque([]):
ans.pop()
else:
ans.append(i)
ans = "".join(list(ans))
print(ans)
| s = []
for i in eval(input()):
if i == "B":
s = s[:-1]
else:
s += i
print(("".join(s)))
| false | 43.75 | [
"-from collections import deque",
"-",
"-s = eval(input())",
"-ans = deque()",
"-for i in s:",
"+s = []",
"+for i in eval(input()):",
"- if ans != deque([]):",
"- ans.pop()",
"+ s = s[:-1]",
"- ans.append(i)",
"-ans = \"\".join(list(ans))",
"-print(ans)",
"+... | false | 0.048282 | 0.044855 | 1.076407 | [
"s756032508",
"s102359409"
] |
u543954314 | p03077 | python | s394572090 | s188445606 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | n=int(eval(input()))
a=int(eval(input()))
b=int(eval(input()))
c=int(eval(input()))
d=int(eval(input()))
e=int(eval(input()))
m = min(a,b,c,d,e)
cnt = (n-1)//m + 1
print((cnt+4)) | n = int(eval(input()))
m = min([int(eval(input())) for _ in range(5)])
cnt = (n-1)//m + 1
print((cnt + 4))
| 9 | 4 | 148 | 96 | n = int(eval(input()))
a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
d = int(eval(input()))
e = int(eval(input()))
m = min(a, b, c, d, e)
cnt = (n - 1) // m + 1
print((cnt + 4))
| n = int(eval(input()))
m = min([int(eval(input())) for _ in range(5)])
cnt = (n - 1) // m + 1
print((cnt + 4))
| false | 55.555556 | [
"-a = int(eval(input()))",
"-b = int(eval(input()))",
"-c = int(eval(input()))",
"-d = int(eval(input()))",
"-e = int(eval(input()))",
"-m = min(a, b, c, d, e)",
"+m = min([int(eval(input())) for _ in range(5)])"
] | false | 0.046668 | 0.043788 | 1.065764 | [
"s394572090",
"s188445606"
] |
u791838908 | p03730 | python | s583391144 | s602926358 | 20 | 17 | 3,060 | 2,940 | Accepted | Accepted | 15 | a, b, c = list(map(int, input().split()))
result = "NO"
for i in range(1, 1000):
if a * i % b == c:
result = "YES"
break
print(result)
| a, b, c = list(map(int, input().split()))
result = "NO"
for i in range(1, 100):
if a * i % b == c:
result = "YES"
print(result)
| 8 | 7 | 157 | 141 | a, b, c = list(map(int, input().split()))
result = "NO"
for i in range(1, 1000):
if a * i % b == c:
result = "YES"
break
print(result)
| a, b, c = list(map(int, input().split()))
result = "NO"
for i in range(1, 100):
if a * i % b == c:
result = "YES"
print(result)
| false | 12.5 | [
"-for i in range(1, 1000):",
"+for i in range(1, 100):",
"- break"
] | false | 0.074435 | 0.036553 | 2.036337 | [
"s583391144",
"s602926358"
] |
u476604182 | p03297 | python | s467640155 | s864149604 | 144 | 46 | 6,012 | 5,432 | Accepted | Accepted | 68.06 | from fractions import gcd
T, *L = list(map(int, open(0).read().split()))
for a,b,c,d in zip(*[iter(L)]*4):
if b>d:
print('No')
elif b>a:
print('No')
elif c>=b:
print('Yes')
elif b==d:
if a%b<c:
print('Yes')
else:
print('No')
else:
m = d%b
n = a%b
g ... | from fractions import gcd
T,*L = list(map(int, open(0).read().split()))
for a,b,c,d in zip(*[iter(L)]*4):
if b>d:
print('No')
continue
if a<b:
print('No')
continue
if c>b:
print('Yes')
continue
g = gcd(b,d)
x = a-b
M = ((c-x)//g+1)*g+x
if M>=b:
print('Yes')
e... | 22 | 19 | 395 | 336 | from fractions import gcd
T, *L = list(map(int, open(0).read().split()))
for a, b, c, d in zip(*[iter(L)] * 4):
if b > d:
print("No")
elif b > a:
print("No")
elif c >= b:
print("Yes")
elif b == d:
if a % b < c:
print("Yes")
else:
print("No... | from fractions import gcd
T, *L = list(map(int, open(0).read().split()))
for a, b, c, d in zip(*[iter(L)] * 4):
if b > d:
print("No")
continue
if a < b:
print("No")
continue
if c > b:
print("Yes")
continue
g = gcd(b, d)
x = a - b
M = ((c - x) // g... | false | 13.636364 | [
"- elif b > a:",
"+ continue",
"+ if a < b:",
"- elif c >= b:",
"+ continue",
"+ if c > b:",
"- elif b == d:",
"- if a % b < c:",
"- print(\"Yes\")",
"- else:",
"- print(\"No\")",
"+ continue",
"+ g = gcd(b, d)",
"+... | false | 0.04629 | 0.079827 | 0.579882 | [
"s467640155",
"s864149604"
] |
u945080461 | p04006 | python | s451542240 | s843390053 | 1,326 | 844 | 2,820 | 2,796 | Accepted | Accepted | 36.35 | n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
b = a[:]
a = a + a
ans = 10 ** 18
for i in range(n):
for j in range(n):
if b[j] > a[j+n-i]:
b[j] = a[j+n-i]
t = sum(b) + x * i
if ans > t:
ans = t
print(ans)
| n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = 10 ** 18
for i in range(n):
t = sum(a) + x * i
if ans > t:
ans = t
t = a[-1]
for j in range(n - 1, 0, -1):
if a[j] > a[j-1]:
a[j] = a[j-1]
if a[0] > t:
a[0] = t
print(ans... | 13 | 14 | 282 | 319 | n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
b = a[:]
a = a + a
ans = 10**18
for i in range(n):
for j in range(n):
if b[j] > a[j + n - i]:
b[j] = a[j + n - i]
t = sum(b) + x * i
if ans > t:
ans = t
print(ans)
| n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = 10**18
for i in range(n):
t = sum(a) + x * i
if ans > t:
ans = t
t = a[-1]
for j in range(n - 1, 0, -1):
if a[j] > a[j - 1]:
a[j] = a[j - 1]
if a[0] > t:
a[0] = t
print(ans)
| false | 7.142857 | [
"-b = a[:]",
"-a = a + a",
"- for j in range(n):",
"- if b[j] > a[j + n - i]:",
"- b[j] = a[j + n - i]",
"- t = sum(b) + x * i",
"+ t = sum(a) + x * i",
"+ t = a[-1]",
"+ for j in range(n - 1, 0, -1):",
"+ if a[j] > a[j - 1]:",
"+ a[j] = a[j - 1... | false | 0.039544 | 0.040513 | 0.976069 | [
"s451542240",
"s843390053"
] |
u838644735 | p02713 | python | s111522692 | s936766014 | 1,878 | 802 | 9,328 | 9,484 | Accepted | Accepted | 57.29 | def gcd(a, b):
if a < b:
return gcd(b, a)
d = a % b
if d == 0:
return b
return gcd(b, d)
def main():
K = int(eval(input()))
table = [[0]*K for i in range(K)]
for i in range(K):
for j in range(K):
table[i][j] = gcd(i + 1, j + 1)
ans = 0
... | def gcd(a, b):
if a < b:
return gcd(b, a)
d = a % b
if d == 0:
return b
return gcd(b, d)
def main():
K = int(eval(input()))
table = [[0]*K for i in range(K)]
for i in range(K):
for j in range(K):
table[i][j] = gcd(i + 1, j + 1)
ans = 0
... | 23 | 23 | 503 | 503 | def gcd(a, b):
if a < b:
return gcd(b, a)
d = a % b
if d == 0:
return b
return gcd(b, d)
def main():
K = int(eval(input()))
table = [[0] * K for i in range(K)]
for i in range(K):
for j in range(K):
table[i][j] = gcd(i + 1, j + 1)
ans = 0
for i in... | def gcd(a, b):
if a < b:
return gcd(b, a)
d = a % b
if d == 0:
return b
return gcd(b, d)
def main():
K = int(eval(input()))
table = [[0] * K for i in range(K)]
for i in range(K):
for j in range(K):
table[i][j] = gcd(i + 1, j + 1)
ans = 0
for i in... | false | 0 | [
"- ans += gcd(i + 1, table[j][k])",
"+ ans += table[i][table[j][k] - 1]"
] | false | 0.040641 | 0.171583 | 0.236859 | [
"s111522692",
"s936766014"
] |
u189479417 | p03304 | python | s936838033 | s956102694 | 32 | 25 | 9,164 | 9,108 | Accepted | Accepted | 21.88 | n, m, d = list(map(int,input().split()))
ans = 2 * (n - d) * (m - 1) / (n ** 2)
if d == 0:
ans /= 2
print(ans) | n, m, d = list(map(int,input().split()))
ans = 2 * (m - 1) * (n - d) / n ** 2
if d == 0:
ans /= 2
print(ans) | 7 | 5 | 116 | 110 | n, m, d = list(map(int, input().split()))
ans = 2 * (n - d) * (m - 1) / (n**2)
if d == 0:
ans /= 2
print(ans)
| n, m, d = list(map(int, input().split()))
ans = 2 * (m - 1) * (n - d) / n**2
if d == 0:
ans /= 2
print(ans)
| false | 28.571429 | [
"-ans = 2 * (n - d) * (m - 1) / (n**2)",
"+ans = 2 * (m - 1) * (n - d) / n**2"
] | false | 0.036115 | 0.058545 | 0.616872 | [
"s936838033",
"s956102694"
] |
u496619173 | p02971 | python | s188005909 | s958597226 | 575 | 518 | 14,120 | 14,688 | Accepted | Accepted | 9.91 | N = int(eval(input()))
A = []
B = []
for _ in range(N):
temp = int(eval(input()))
A.append(temp)
B.append(temp)
B.sort(reverse=True)
max_first = B[0]
max_second = B[1]
for i in range(N):
if A[i] == max_first:
print(max_second)
else:
print(max_first) | import copy
N=int(eval(input()))
A=[]
for _ in range(N):
A.append(int(eval(input())))
A_max=max(A)
#ind_max=A.index(A_max)
B=copy.copy(A)
B.remove(A_max)
B_max=max(B)
for i in range(N):
if A[i]!=A_max:
print(A_max)
else:
print(B_max) | 17 | 18 | 291 | 272 | N = int(eval(input()))
A = []
B = []
for _ in range(N):
temp = int(eval(input()))
A.append(temp)
B.append(temp)
B.sort(reverse=True)
max_first = B[0]
max_second = B[1]
for i in range(N):
if A[i] == max_first:
print(max_second)
else:
print(max_first)
| import copy
N = int(eval(input()))
A = []
for _ in range(N):
A.append(int(eval(input())))
A_max = max(A)
# ind_max=A.index(A_max)
B = copy.copy(A)
B.remove(A_max)
B_max = max(B)
for i in range(N):
if A[i] != A_max:
print(A_max)
else:
print(B_max)
| false | 5.555556 | [
"+import copy",
"+",
"-B = []",
"- temp = int(eval(input()))",
"- A.append(temp)",
"- B.append(temp)",
"-B.sort(reverse=True)",
"-max_first = B[0]",
"-max_second = B[1]",
"+ A.append(int(eval(input())))",
"+A_max = max(A)",
"+# ind_max=A.index(A_max)",
"+B = copy.copy(A)",
"+B.... | false | 0.084862 | 0.048231 | 1.759505 | [
"s188005909",
"s958597226"
] |
u891635666 | p03379 | python | s542196973 | s223880948 | 320 | 280 | 25,556 | 25,620 | Accepted | Accepted | 12.5 | n = int(eval(input()))
ls = list(map(int, input().split()))
ls2 = ls.copy()
ls2.sort()
m = ls2[n // 2]
for i in range(n):
if ls[i] < m:
print(m)
else:
print((ls2[n // 2 - 1])) | n = int(eval(input()))
ls = list(map(int, input().split()))
ls2 = sorted(ls)
m0 = ls2[n // 2 - 1]
m1 = ls2[n // 2]
for x in ls:
if x < m1:
print(m1)
else:
print(m0) | 10 | 10 | 200 | 191 | n = int(eval(input()))
ls = list(map(int, input().split()))
ls2 = ls.copy()
ls2.sort()
m = ls2[n // 2]
for i in range(n):
if ls[i] < m:
print(m)
else:
print((ls2[n // 2 - 1]))
| n = int(eval(input()))
ls = list(map(int, input().split()))
ls2 = sorted(ls)
m0 = ls2[n // 2 - 1]
m1 = ls2[n // 2]
for x in ls:
if x < m1:
print(m1)
else:
print(m0)
| false | 0 | [
"-ls2 = ls.copy()",
"-ls2.sort()",
"-m = ls2[n // 2]",
"-for i in range(n):",
"- if ls[i] < m:",
"- print(m)",
"+ls2 = sorted(ls)",
"+m0 = ls2[n // 2 - 1]",
"+m1 = ls2[n // 2]",
"+for x in ls:",
"+ if x < m1:",
"+ print(m1)",
"- print((ls2[n // 2 - 1]))",
"+ ... | false | 0.057437 | 0.076028 | 0.755472 | [
"s542196973",
"s223880948"
] |
u860002137 | p03472 | python | s169296112 | s320453551 | 365 | 248 | 8,144 | 13,544 | Accepted | Accepted | 32.05 | import sys
import math
n, h = list(map(int, input().split()))
a = 0
b = []
for i in range(n):
x, y = list(map(int, input().split()))
a = max(a, x)
b.append(y)
b.sort(reverse=True)
b = [x for x in b if x > a]
for i, x in enumerate(b):
h -= x
if h <= 0:
print((i + 1))
... | import sys
n, h = list(map(int, input().split()))
max_a = 0
b = []
for i in range(n):
x, y = list(map(int, input().split()))
max_a = max(max_a, x)
b.append(y)
# 投げる価値がある刀を抜粋する
b = [x for x in b if x > max_a]
# 強い順に投げていく
b.sort(reverse=True)
i = 0
if len(b) > 0:
for i, x in enumer... | 28 | 28 | 403 | 474 | import sys
import math
n, h = list(map(int, input().split()))
a = 0
b = []
for i in range(n):
x, y = list(map(int, input().split()))
a = max(a, x)
b.append(y)
b.sort(reverse=True)
b = [x for x in b if x > a]
for i, x in enumerate(b):
h -= x
if h <= 0:
print((i + 1))
sys.exit()
if le... | import sys
n, h = list(map(int, input().split()))
max_a = 0
b = []
for i in range(n):
x, y = list(map(int, input().split()))
max_a = max(max_a, x)
b.append(y)
# 投げる価値がある刀を抜粋する
b = [x for x in b if x > max_a]
# 強い順に投げていく
b.sort(reverse=True)
i = 0
if len(b) > 0:
for i, x in enumerate(b):
i += 1
... | false | 0 | [
"-import math",
"-a = 0",
"+max_a = 0",
"- a = max(a, x)",
"+ max_a = max(max_a, x)",
"+# 投げる価値がある刀を抜粋する",
"+b = [x for x in b if x > max_a]",
"+# 強い順に投げていく",
"-b = [x for x in b if x > a]",
"-for i, x in enumerate(b):",
"- h -= x",
"- if h <= 0:",
"- print((i + 1))",
"-... | false | 0.036286 | 0.007025 | 5.164937 | [
"s169296112",
"s320453551"
] |
u644907318 | p03651 | python | s270871796 | s890305153 | 260 | 96 | 62,576 | 85,380 | Accepted | Accepted | 63.08 | def gcd(x,y):
while y>0:
x,y = y,x%y
return x
N,K = list(map(int,input().split()))
A = sorted(list(map(int,input().split())))
a = A[0]
for i in range(1,N):
a = gcd(a,A[i])
if K<=A[-1] and K%a==0:
print("POSSIBLE")
else:
print("IMPOSSIBLE") | def gcd(x,y):
while y>0:
x,y = y,x%y
return x
N,K = list(map(int,input().split()))
A = list(map(int,input().split()))
a = A[0]
for i in range(1,N):
a = gcd(a,A[i])
flag = 0
for i in range(N):
if A[i]>=K:
b = A[i]-K
if b%a==0:
flag = 1
break
... | 13 | 20 | 273 | 381 | def gcd(x, y):
while y > 0:
x, y = y, x % y
return x
N, K = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
a = A[0]
for i in range(1, N):
a = gcd(a, A[i])
if K <= A[-1] and K % a == 0:
print("POSSIBLE")
else:
print("IMPOSSIBLE")
| def gcd(x, y):
while y > 0:
x, y = y, x % y
return x
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
a = A[0]
for i in range(1, N):
a = gcd(a, A[i])
flag = 0
for i in range(N):
if A[i] >= K:
b = A[i] - K
if b % a == 0:
flag = 1
... | false | 35 | [
"-A = sorted(list(map(int, input().split())))",
"+A = list(map(int, input().split()))",
"-if K <= A[-1] and K % a == 0:",
"+flag = 0",
"+for i in range(N):",
"+ if A[i] >= K:",
"+ b = A[i] - K",
"+ if b % a == 0:",
"+ flag = 1",
"+ break",
"+if flag == 1:"
... | false | 0.042647 | 0.035801 | 1.191246 | [
"s270871796",
"s890305153"
] |
u668503853 | p02918 | python | s366380109 | s865860874 | 50 | 44 | 3,316 | 3,316 | Accepted | Accepted | 12 | N,K=list(map(int,input().split()))
S=eval(input())
h=0
for i in range(N-1):
if i==0 and S[i]=="L":
pass
if S[i]==S[i+1]:
h+=1
print((min(h+2*K,N-1))) | N,K=list(map(int,input().split()))
S=eval(input())
h=0
for i in range(N-1):
if S[i]==S[i+1]:
h+=1
print((min(h+2*K,N-1))) | 9 | 7 | 155 | 119 | N, K = list(map(int, input().split()))
S = eval(input())
h = 0
for i in range(N - 1):
if i == 0 and S[i] == "L":
pass
if S[i] == S[i + 1]:
h += 1
print((min(h + 2 * K, N - 1)))
| N, K = list(map(int, input().split()))
S = eval(input())
h = 0
for i in range(N - 1):
if S[i] == S[i + 1]:
h += 1
print((min(h + 2 * K, N - 1)))
| false | 22.222222 | [
"- if i == 0 and S[i] == \"L\":",
"- pass"
] | false | 0.048841 | 0.049099 | 0.994737 | [
"s366380109",
"s865860874"
] |
u744920373 | p02832 | python | s737176885 | s070976104 | 181 | 91 | 26,524 | 26,268 | Accepted | Accepted | 49.72 | N = int(eval(input()))
A = list(map(int, input().split()))
l = len(A)
f = [0] * l
f[0] = 0
flag=0
if A[0] == 1:
flag = 1
for i in range(1, l):
if A[0] == 1 and f[i-1]==0:
if A[i] == i+1:
f[i] = 0
else:
f[i] = 1
elif f[i-1] != 0:
if A[i] ... | N = int(eval(input()))
A = list(map(int, input().split()))
cnt = 1
for a in A:
if a==cnt:
cnt+=1
if cnt==1:
print((-1))
else:
print((N-cnt+1)) | 34 | 12 | 578 | 165 | N = int(eval(input()))
A = list(map(int, input().split()))
l = len(A)
f = [0] * l
f[0] = 0
flag = 0
if A[0] == 1:
flag = 1
for i in range(1, l):
if A[0] == 1 and f[i - 1] == 0:
if A[i] == i + 1:
f[i] = 0
else:
f[i] = 1
elif f[i - 1] != 0:
if A[i] == i - f[i - ... | N = int(eval(input()))
A = list(map(int, input().split()))
cnt = 1
for a in A:
if a == cnt:
cnt += 1
if cnt == 1:
print((-1))
else:
print((N - cnt + 1))
| false | 64.705882 | [
"-l = len(A)",
"-f = [0] * l",
"-f[0] = 0",
"-flag = 0",
"-if A[0] == 1:",
"- flag = 1",
"-for i in range(1, l):",
"- if A[0] == 1 and f[i - 1] == 0:",
"- if A[i] == i + 1:",
"- f[i] = 0",
"- else:",
"- f[i] = 1",
"- elif f[i - 1] != 0:",
"- ... | false | 0.044454 | 0.104155 | 0.426804 | [
"s737176885",
"s070976104"
] |
u116002573 | p02939 | python | s625544635 | s024815979 | 82 | 68 | 11,400 | 3,500 | Accepted | Accepted | 17.07 | def main():
S = eval(input())
n = len(S)
dp = [0 for _ in range(n+1)]
dp[0] = 0
dp[1] = 1
for i in range(1, n):
if i == 1:
if S[i-1] == S[i]: dp[i+1] = 1
else: dp[i+1] = 2
else:
if S[i] != S[i-1]:
dp[i+1] = dp[i] + 1... | def main():
S = eval(input())
ref = S[0]
i = 1
ans = 1
while i < len(S):
if S[i] == ref:
if i < len(S)-1:
ref = S[i:i+2]
ans += 1
i += 2
else:
i += 1
else:
ref = S[i]
... | 19 | 23 | 439 | 422 | def main():
S = eval(input())
n = len(S)
dp = [0 for _ in range(n + 1)]
dp[0] = 0
dp[1] = 1
for i in range(1, n):
if i == 1:
if S[i - 1] == S[i]:
dp[i + 1] = 1
else:
dp[i + 1] = 2
else:
if S[i] != S[i - 1]:
... | def main():
S = eval(input())
ref = S[0]
i = 1
ans = 1
while i < len(S):
if S[i] == ref:
if i < len(S) - 1:
ref = S[i : i + 2]
ans += 1
i += 2
else:
i += 1
else:
ref = S[i]
... | false | 17.391304 | [
"- n = len(S)",
"- dp = [0 for _ in range(n + 1)]",
"- dp[0] = 0",
"- dp[1] = 1",
"- for i in range(1, n):",
"- if i == 1:",
"- if S[i - 1] == S[i]:",
"- dp[i + 1] = 1",
"+ ref = S[0]",
"+ i = 1",
"+ ans = 1",
"+ while i < len(S):",
... | false | 0.038792 | 0.039639 | 0.978642 | [
"s625544635",
"s024815979"
] |
u106797249 | p02850 | python | s129382287 | s220914982 | 652 | 398 | 165,784 | 107,416 | Accepted | Accepted | 38.96 | def resolve():
N = int(eval(input()))
g = {}
edges_to_idx = {}
edges = []
for i in range(N-1):
a, b = list(map(int, input().split()))
g.setdefault(a-1, [])
g[a-1].append(b-1)
g.setdefault(b-1, [])
g[b-1].append(a-1)
edges_to_idx.setdefault("... | def resolve():
N = int(eval(input()))
g = {}
for i in range(N-1):
a, b = list(map(int, input().split()))
g.setdefault(a-1, [])
g[a-1].append((b-1, i))
g.setdefault(b-1, [])
g[b-1].append((a-1, i))
nodes = [(None, 0)]
colors = [None for _ in... | 51 | 32 | 1,402 | 830 | def resolve():
N = int(eval(input()))
g = {}
edges_to_idx = {}
edges = []
for i in range(N - 1):
a, b = list(map(int, input().split()))
g.setdefault(a - 1, [])
g[a - 1].append(b - 1)
g.setdefault(b - 1, [])
g[b - 1].append(a - 1)
edges_to_idx.setdefaul... | def resolve():
N = int(eval(input()))
g = {}
for i in range(N - 1):
a, b = list(map(int, input().split()))
g.setdefault(a - 1, [])
g[a - 1].append((b - 1, i))
g.setdefault(b - 1, [])
g[b - 1].append((a - 1, i))
nodes = [(None, 0)]
colors = [None for _ in range... | false | 37.254902 | [
"- edges_to_idx = {}",
"- edges = []",
"- g[a - 1].append(b - 1)",
"+ g[a - 1].append((b - 1, i))",
"- g[b - 1].append(a - 1)",
"- edges_to_idx.setdefault(\"{}-{}\".format(a - 1, b - 1), i)",
"- edges_to_idx.setdefault(\"{}-{}\".format(b - 1, a - 1), i)",
"- ... | false | 0.048137 | 0.036054 | 1.335152 | [
"s129382287",
"s220914982"
] |
u764215612 | p02702 | python | s799147750 | s571422428 | 90 | 78 | 9,340 | 9,212 | Accepted | Accepted | 13.33 | def main():
n, mods = 0, [1]+[0]*2019
d = 1
for j in map(int, input()[::-1]):
n = (n+int(j)*d)%2019
d = d*10%2019
mods[n] += 1
print((sum([i*(i-1)//2 for i in mods])))
main() | def main():
n, mods = 0, [1]+[0]*2019
d = 1
for i in reversed(eval(input())):
n = (n+int(i)*d)%2019
d = d*10%2019
mods[n] += 1
print((sum([i*(i-1)//2 for i in mods])))
main() | 9 | 9 | 200 | 194 | def main():
n, mods = 0, [1] + [0] * 2019
d = 1
for j in map(int, input()[::-1]):
n = (n + int(j) * d) % 2019
d = d * 10 % 2019
mods[n] += 1
print((sum([i * (i - 1) // 2 for i in mods])))
main()
| def main():
n, mods = 0, [1] + [0] * 2019
d = 1
for i in reversed(eval(input())):
n = (n + int(i) * d) % 2019
d = d * 10 % 2019
mods[n] += 1
print((sum([i * (i - 1) // 2 for i in mods])))
main()
| false | 0 | [
"- for j in map(int, input()[::-1]):",
"- n = (n + int(j) * d) % 2019",
"+ for i in reversed(eval(input())):",
"+ n = (n + int(i) * d) % 2019"
] | false | 0.035486 | 0.042845 | 0.828241 | [
"s799147750",
"s571422428"
] |
u644907318 | p03006 | python | s039940822 | s361115757 | 676 | 69 | 43,356 | 67,748 | Accepted | Accepted | 89.79 | import itertools
N = int(eval(input()))
X = [list(map(int,input().split())) for _ in range(N)]
if N==1:
cmin = 1
else:
cmin = 100
for y in itertools.combinations(X,2):
x1,y1 = y[0]
x2,y2 = y[1]
p = x2-x1
q = y2-y1
cnt0 = 0
cnt1 = 0
for i ... | from itertools import combinations
N = int(eval(input()))
X = [list(map(int,input().split())) for _ in range(N)]
if N==1:
print((1))
else:
C = {}
for z in combinations(X,2):
x1,x2 = z
a = x1[0]-x2[0]
b = x1[1]-x2[1]
if a>=0 and b>=0:
if (a,b) not in C:... | 24 | 38 | 560 | 1,066 | import itertools
N = int(eval(input()))
X = [list(map(int, input().split())) for _ in range(N)]
if N == 1:
cmin = 1
else:
cmin = 100
for y in itertools.combinations(X, 2):
x1, y1 = y[0]
x2, y2 = y[1]
p = x2 - x1
q = y2 - y1
cnt0 = 0
cnt1 = 0
for i in ... | from itertools import combinations
N = int(eval(input()))
X = [list(map(int, input().split())) for _ in range(N)]
if N == 1:
print((1))
else:
C = {}
for z in combinations(X, 2):
x1, x2 = z
a = x1[0] - x2[0]
b = x1[1] - x2[1]
if a >= 0 and b >= 0:
if (a, b) not in... | false | 36.842105 | [
"-import itertools",
"+from itertools import combinations",
"- cmin = 1",
"+ print((1))",
"- cmin = 100",
"- for y in itertools.combinations(X, 2):",
"- x1, y1 = y[0]",
"- x2, y2 = y[1]",
"- p = x2 - x1",
"- q = y2 - y1",
"- cnt0 = 0",
"- c... | false | 0.043683 | 0.006617 | 6.601659 | [
"s039940822",
"s361115757"
] |
u347640436 | p02837 | python | s868097722 | s605093424 | 152 | 108 | 3,064 | 8,924 | Accepted | Accepted | 28.95 | N = int(eval(input()))
evidences = [[] for _ in range(N)]
for i in range(N):
A = int(eval(input()))
for _ in range(A):
x, y = list(map(int, input().split()))
evidences[i].append((x - 1, y))
result = 0
for i in range(1, 2 ** N):
consistent = True
for j in range(N):
... | # ビット全探索
from itertools import product
N = int(eval(input()))
evidences = [[] for _ in range(N)]
for i in range(N):
A = int(eval(input()))
for _ in range(A):
x, y = list(map(int, input().split()))
evidences[i].append((x - 1, y))
result = 0
for i in product([0, 1], repeat=N):
... | 24 | 27 | 610 | 638 | N = int(eval(input()))
evidences = [[] for _ in range(N)]
for i in range(N):
A = int(eval(input()))
for _ in range(A):
x, y = list(map(int, input().split()))
evidences[i].append((x - 1, y))
result = 0
for i in range(1, 2**N):
consistent = True
for j in range(N):
if (i >> j) & 1 =... | # ビット全探索
from itertools import product
N = int(eval(input()))
evidences = [[] for _ in range(N)]
for i in range(N):
A = int(eval(input()))
for _ in range(A):
x, y = list(map(int, input().split()))
evidences[i].append((x - 1, y))
result = 0
for i in product([0, 1], repeat=N):
consistent = Tr... | false | 11.111111 | [
"+# ビット全探索",
"+from itertools import product",
"+",
"-for i in range(1, 2**N):",
"+for i in product([0, 1], repeat=N):",
"- if (i >> j) & 1 == 0:",
"+ if i[j] == 0:",
"- if (i >> x) & 1 != y:",
"+ if i[x] != y:",
"- result = max(result, bin(i)[2:].count(\... | false | 0.036978 | 0.041151 | 0.8986 | [
"s868097722",
"s605093424"
] |
u436982376 | p02802 | python | s352806117 | s145984250 | 343 | 235 | 13,172 | 10,784 | Accepted | Accepted | 31.49 | n, m = list(map(int,input().split()))
pena_list = [[0, 0] for i in range(n)]
ac = 0
wa = 0
teishutu = []
for i in range(m):
p, s = input().split()
p = int(p)
if s == 'AC' and pena_list[p-1][0] == 0:
ac += 1
wa += pena_list[p-1][1]
pena_list[p-1][0] = 1
elif s == 'WA... | n,m = list(map(int,input().split()))
ac_list = [0 for i in range(n+1)]
wa_list = [0 for i in range(n+1)]
p_list = []
ac = 0
pena = 0
for i in range(m):
p,s = list(map(str,input().split()))
p = int(p)
if s == 'AC' and ac_list[p-1] != 1:
ac += 1
ac_list[p-1] = 1
pena += w... | 17 | 18 | 366 | 409 | n, m = list(map(int, input().split()))
pena_list = [[0, 0] for i in range(n)]
ac = 0
wa = 0
teishutu = []
for i in range(m):
p, s = input().split()
p = int(p)
if s == "AC" and pena_list[p - 1][0] == 0:
ac += 1
wa += pena_list[p - 1][1]
pena_list[p - 1][0] = 1
elif s == "WA":
... | n, m = list(map(int, input().split()))
ac_list = [0 for i in range(n + 1)]
wa_list = [0 for i in range(n + 1)]
p_list = []
ac = 0
pena = 0
for i in range(m):
p, s = list(map(str, input().split()))
p = int(p)
if s == "AC" and ac_list[p - 1] != 1:
ac += 1
ac_list[p - 1] = 1
pena += wa_... | false | 5.555556 | [
"-pena_list = [[0, 0] for i in range(n)]",
"+ac_list = [0 for i in range(n + 1)]",
"+wa_list = [0 for i in range(n + 1)]",
"+p_list = []",
"-wa = 0",
"-teishutu = []",
"+pena = 0",
"- p, s = input().split()",
"+ p, s = list(map(str, input().split()))",
"- if s == \"AC\" and pena_list[p - ... | false | 0.041694 | 0.042044 | 0.991672 | [
"s352806117",
"s145984250"
] |
u715355213 | p03611 | python | s300514834 | s433868870 | 286 | 173 | 46,940 | 30,940 | Accepted | Accepted | 39.51 | N = int(eval(input()))
import collections
a = list(map(int,input().split()))
b = [[0] * 3 for i in range(N)]
A = [] * 3 * N
for i in range(len(a)):
b[i][0] = a[i] - 1
b[i][1] = a[i]
b[i][2] = a[i] + 1
A.append(a[i] - 1)
A.append(a[i])
A.append(a[i] + 1)
c = collections.Counter(A)... | N = int(eval(input()))
import collections
a = list(map(int,input().split()))
A = [] * 3 * N
for i in range(len(a)):
A.append(a[i] - 1)
A.append(a[i])
A.append(a[i] + 1)
c = collections.Counter(A)
ans = c.most_common()[0][1]
print(ans)
| 17 | 13 | 356 | 255 | N = int(eval(input()))
import collections
a = list(map(int, input().split()))
b = [[0] * 3 for i in range(N)]
A = [] * 3 * N
for i in range(len(a)):
b[i][0] = a[i] - 1
b[i][1] = a[i]
b[i][2] = a[i] + 1
A.append(a[i] - 1)
A.append(a[i])
A.append(a[i] + 1)
c = collections.Counter(A)
ans = c.most_... | N = int(eval(input()))
import collections
a = list(map(int, input().split()))
A = [] * 3 * N
for i in range(len(a)):
A.append(a[i] - 1)
A.append(a[i])
A.append(a[i] + 1)
c = collections.Counter(A)
ans = c.most_common()[0][1]
print(ans)
| false | 23.529412 | [
"-b = [[0] * 3 for i in range(N)]",
"- b[i][0] = a[i] - 1",
"- b[i][1] = a[i]",
"- b[i][2] = a[i] + 1"
] | false | 0.04138 | 0.116981 | 0.353736 | [
"s300514834",
"s433868870"
] |
u586662847 | p02732 | python | s811822107 | s534686673 | 409 | 370 | 24,996 | 26,780 | Accepted | Accepted | 9.54 | N=int(eval(input()))
A=list(map(int,input().split()))
from collections import Counter
C=Counter(A)
ANS=0
for i in list(C.values()):
ANS+=i*(i-1)//2
for a in A:
k=C[a]
print((ANS-(k*(k-1)//2)+((k-1)*(k-2)//2)))
| import collections
def resolve():
N = int(eval(input()))
A = list(map(int, input().split()))
counter = collections.Counter(A)
ans = 0
for i in list(counter.values()):
ans += i * (i - 1) // 2
for a in A:
count = counter[a]
print((ans - (count * (count -... | 13 | 20 | 223 | 382 | N = int(eval(input()))
A = list(map(int, input().split()))
from collections import Counter
C = Counter(A)
ANS = 0
for i in list(C.values()):
ANS += i * (i - 1) // 2
for a in A:
k = C[a]
print((ANS - (k * (k - 1) // 2) + ((k - 1) * (k - 2) // 2)))
| import collections
def resolve():
N = int(eval(input()))
A = list(map(int, input().split()))
counter = collections.Counter(A)
ans = 0
for i in list(counter.values()):
ans += i * (i - 1) // 2
for a in A:
count = counter[a]
print((ans - (count * (count - 1) // 2) + ((coun... | false | 35 | [
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-from collections import Counter",
"+import collections",
"-C = Counter(A)",
"-ANS = 0",
"-for i in list(C.values()):",
"- ANS += i * (i - 1) // 2",
"-for a in A:",
"- k = C[a]",
"- print((ANS - (k * (k - 1) // 2) + ((k... | false | 0.09609 | 0.069174 | 1.389096 | [
"s811822107",
"s534686673"
] |
u644907318 | p03786 | python | s540044755 | s488016427 | 139 | 113 | 14,404 | 92,364 | Accepted | Accepted | 18.71 | N = int(eval(input()))
A = sorted(list(map(int,input().split())))
B = [0 for _ in range(N+1)]
for i in range(N):
B[i+1] = B[i]+A[i]
cnt = 1
for i in range(N-2,-1,-1):
if 2*B[i+1]>=A[i+1]:
cnt += 1
else:
break
print(cnt) | N = int(eval(input()))
A = sorted(list(map(int,input().split())))
B = [0 for _ in range(N+1)]
for i in range(1,N+1):
B[i] = B[i-1]+A[i-1]
cnt = 1
for i in range(N-2,-1,-1):
if A[i+1]<=2*B[i+1]:
cnt += 1
else:
break
print(cnt) | 12 | 12 | 252 | 258 | N = int(eval(input()))
A = sorted(list(map(int, input().split())))
B = [0 for _ in range(N + 1)]
for i in range(N):
B[i + 1] = B[i] + A[i]
cnt = 1
for i in range(N - 2, -1, -1):
if 2 * B[i + 1] >= A[i + 1]:
cnt += 1
else:
break
print(cnt)
| N = int(eval(input()))
A = sorted(list(map(int, input().split())))
B = [0 for _ in range(N + 1)]
for i in range(1, N + 1):
B[i] = B[i - 1] + A[i - 1]
cnt = 1
for i in range(N - 2, -1, -1):
if A[i + 1] <= 2 * B[i + 1]:
cnt += 1
else:
break
print(cnt)
| false | 0 | [
"-for i in range(N):",
"- B[i + 1] = B[i] + A[i]",
"+for i in range(1, N + 1):",
"+ B[i] = B[i - 1] + A[i - 1]",
"- if 2 * B[i + 1] >= A[i + 1]:",
"+ if A[i + 1] <= 2 * B[i + 1]:"
] | false | 0.03706 | 0.037449 | 0.989602 | [
"s540044755",
"s488016427"
] |
u525065967 | p02582 | python | s505663060 | s406131951 | 32 | 27 | 9,108 | 9,024 | Accepted | Accepted | 15.62 | s = eval(input())
if s=='RRR':print((3))
if s=='SSS':print((0))
if s=='RRS':print((2))
if s=='SSR':print((1))
if s=='RSR':print((1))
if s=='SRS':print((1))
if s=='SRR':print((2))
if s=='RSS':print((1))
| s = eval(input())
if s == 'RRR': print((3))
elif s == 'SSS': print((0))
elif s[0:2] == 'RR': print((2))
elif s[1:3] == 'RR': print((2))
else: print((1))
| 13 | 6 | 196 | 142 | s = eval(input())
if s == "RRR":
print((3))
if s == "SSS":
print((0))
if s == "RRS":
print((2))
if s == "SSR":
print((1))
if s == "RSR":
print((1))
if s == "SRS":
print((1))
if s == "SRR":
print((2))
if s == "RSS":
print((1))
| s = eval(input())
if s == "RRR":
print((3))
elif s == "SSS":
print((0))
elif s[0:2] == "RR":
print((2))
elif s[1:3] == "RR":
print((2))
else:
print((1))
| false | 53.846154 | [
"-if s == \"SSS\":",
"+elif s == \"SSS\":",
"-if s == \"RRS\":",
"+elif s[0:2] == \"RR\":",
"-if s == \"SSR\":",
"+elif s[1:3] == \"RR\":",
"+ print((2))",
"+else:",
"-if s == \"RSR\":",
"- print((1))",
"-if s == \"SRS\":",
"- print((1))",
"-if s == \"SRR\":",
"- print((2))",
... | false | 0.074062 | 0.039458 | 1.876996 | [
"s505663060",
"s406131951"
] |
u604839890 | p02621 | python | s738306932 | s394616290 | 72 | 65 | 61,900 | 61,684 | Accepted | Accepted | 9.72 | a = int(eval(input()))
print((a+a*a+a*a*a)) | a = int(eval(input()))
print((a+a*a+a**3)) | 2 | 2 | 36 | 35 | a = int(eval(input()))
print((a + a * a + a * a * a))
| a = int(eval(input()))
print((a + a * a + a**3))
| false | 0 | [
"-print((a + a * a + a * a * a))",
"+print((a + a * a + a**3))"
] | false | 0.03695 | 0.040357 | 0.915575 | [
"s738306932",
"s394616290"
] |
u768896740 | p03575 | python | s753579520 | s016639740 | 22 | 20 | 3,064 | 3,064 | Accepted | Accepted | 9.09 | n, m = list(map(int, input().split()))
li = []
count = 0
def check_dfs(node_list):
traveled = []
return dfs(node_list, traveled, 0)
def dfs(node_list, t_list, position):
t_list.append(position)
if len(t_list) == n:
return 0
for i in node_list[position]:
if i not in t... | import sys
sys.setrecursionlimit(10**5)
n, m = list(map(int, input().split()))
graph = [[] for _ in range(n)]
edge = []
for _ in range(m):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
graph[a].append(b)
graph[b].append(a)
edge.append([a, b])
cnt = 0
def dfs(start, ... | 36 | 36 | 807 | 735 | n, m = list(map(int, input().split()))
li = []
count = 0
def check_dfs(node_list):
traveled = []
return dfs(node_list, traveled, 0)
def dfs(node_list, t_list, position):
t_list.append(position)
if len(t_list) == n:
return 0
for i in node_list[position]:
if i not in t_list:
... | import sys
sys.setrecursionlimit(10**5)
n, m = list(map(int, input().split()))
graph = [[] for _ in range(n)]
edge = []
for _ in range(m):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
graph[a].append(b)
graph[b].append(a)
edge.append([a, b])
cnt = 0
def dfs(start, a, b, explored, n):
... | false | 0 | [
"+import sys",
"+",
"+sys.setrecursionlimit(10**5)",
"-li = []",
"-count = 0",
"+graph = [[] for _ in range(n)]",
"+edge = []",
"+for _ in range(m):",
"+ a, b = list(map(int, input().split()))",
"+ a -= 1",
"+ b -= 1",
"+ graph[a].append(b)",
"+ graph[b].append(a)",
"+ ed... | false | 0.057621 | 0.032456 | 1.775383 | [
"s753579520",
"s016639740"
] |
u651235280 | p02773 | python | s933361433 | s433224008 | 451 | 218 | 46,856 | 36,796 | Accepted | Accepted | 51.66 | import sys
from collections import defaultdict
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
n = int(eval(input()))
d = defaultdict(int)
for i in range(n):
s = input().rstrip()
d[s] += 1
ma = 0
for v in list(d.values()):
ma = max(ma, v)
a = sorted(d.items())
for k, v in a:
... | import sys
from collections import Counter
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
n = int(input())
cnt = Counter(input() for _ in range(n))
macnt = max(cnt.values())
names = [k for k, v in cnt.items() if v == macnt]
names.sort()
print(*names, sep='\n')
| 21 | 12 | 342 | 283 | import sys
from collections import defaultdict
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
n = int(eval(input()))
d = defaultdict(int)
for i in range(n):
s = input().rstrip()
d[s] += 1
ma = 0
for v in list(d.values()):
ma = max(ma, v)
a = sorted(d.items())
for k, v in a:
if ma == v:
... | import sys
from collections import Counter
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
n = int(input())
cnt = Counter(input() for _ in range(n))
macnt = max(cnt.values())
names = [k for k, v in cnt.items() if v == macnt]
names.sort()
print(*names, sep="\n")
| false | 42.857143 | [
"-from collections import defaultdict",
"+from collections import Counter",
"-n = int(eval(input()))",
"-d = defaultdict(int)",
"-for i in range(n):",
"- s = input().rstrip()",
"- d[s] += 1",
"-ma = 0",
"-for v in list(d.values()):",
"- ma = max(ma, v)",
"-a = sorted(d.items())",
"-fo... | false | 0.036375 | 0.074914 | 0.48556 | [
"s933361433",
"s433224008"
] |
u254871849 | p02915 | python | s910303817 | s002486766 | 19 | 17 | 3,188 | 2,940 | Accepted | Accepted | 10.53 | # 2019-11-18 00:38:19(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
import re
# import heapq
# import arr... | import sys
n = int(sys.stdin.readline().rstrip())
def main():
return n ** 3
if __name__ == '__main__':
ans = main()
print(ans) | 22 | 10 | 528 | 150 | # 2019-11-18 00:38:19(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
import re
# import heapq
# import array
# from... | import sys
n = int(sys.stdin.readline().rstrip())
def main():
return n**3
if __name__ == "__main__":
ans = main()
print(ans)
| false | 54.545455 | [
"-# 2019-11-18 00:38:19(JST)",
"-# import collections",
"-# import math",
"-# from string import ascii_lowercase, ascii_uppercase, digits",
"-# from bisect import bisect_left as bi_l, bisect_right as bi_r",
"-# import itertools",
"-# from functools import reduce",
"-# import operator as op",
"-impor... | false | 0.041028 | 0.041453 | 0.989732 | [
"s910303817",
"s002486766"
] |
u188827677 | p02819 | python | s684994876 | s663959751 | 358 | 217 | 10,868 | 10,868 | Accepted | Accepted | 39.39 | import math
x = int(eval(input()))
n = 10**6
flag = [True]*(n+1)
for i in range(4, n+1, 2):
flag[i] = False
t = int(n**0.5)+1
for i in range(3, t, 2):
for j in range(i+i, n+1, i):
flag[j] = False
for i in range(x,n+1):
if flag[i]:
print(i)
exit() | x = int(eval(input()))
n = 10**6
nums = [True]*(n+1)
nums[0] = nums[1] = False
for i in range(4, n+1, 2): nums[i] = False
for i in range(3, int(n**0.5)+1, 2):
if nums[i]:
for j in range(i+i, n, i):
nums[j] = False
while True:
if nums[x]:
print(x)
break
x += 1 | 18 | 16 | 281 | 294 | import math
x = int(eval(input()))
n = 10**6
flag = [True] * (n + 1)
for i in range(4, n + 1, 2):
flag[i] = False
t = int(n**0.5) + 1
for i in range(3, t, 2):
for j in range(i + i, n + 1, i):
flag[j] = False
for i in range(x, n + 1):
if flag[i]:
print(i)
exit()
| x = int(eval(input()))
n = 10**6
nums = [True] * (n + 1)
nums[0] = nums[1] = False
for i in range(4, n + 1, 2):
nums[i] = False
for i in range(3, int(n**0.5) + 1, 2):
if nums[i]:
for j in range(i + i, n, i):
nums[j] = False
while True:
if nums[x]:
print(x)
break
x += ... | false | 11.111111 | [
"-import math",
"-",
"-flag = [True] * (n + 1)",
"+nums = [True] * (n + 1)",
"+nums[0] = nums[1] = False",
"- flag[i] = False",
"-t = int(n**0.5) + 1",
"-for i in range(3, t, 2):",
"- for j in range(i + i, n + 1, i):",
"- flag[j] = False",
"-for i in range(x, n + 1):",
"- if fl... | false | 1.166949 | 0.539157 | 2.164395 | [
"s684994876",
"s663959751"
] |
u864197622 | p03107 | python | s498612099 | s965947522 | 103 | 29 | 3,956 | 3,492 | Accepted | Accepted | 71.84 | s = eval(input())
t = []
ans = 0
for i in range(len(s)):
t += [s[i]]
if t[-2:] == ["0", "1"] or t[-2:] == ["1", "0"]:
t.pop()
t.pop()
ans += 2
print(ans)
| from collections import Counter as C
a=C(eval(input()))
print((min(a["0"],a["1"])*2)) | 11 | 3 | 191 | 79 | s = eval(input())
t = []
ans = 0
for i in range(len(s)):
t += [s[i]]
if t[-2:] == ["0", "1"] or t[-2:] == ["1", "0"]:
t.pop()
t.pop()
ans += 2
print(ans)
| from collections import Counter as C
a = C(eval(input()))
print((min(a["0"], a["1"]) * 2))
| false | 72.727273 | [
"-s = eval(input())",
"-t = []",
"-ans = 0",
"-for i in range(len(s)):",
"- t += [s[i]]",
"- if t[-2:] == [\"0\", \"1\"] or t[-2:] == [\"1\", \"0\"]:",
"- t.pop()",
"- t.pop()",
"- ans += 2",
"-print(ans)",
"+from collections import Counter as C",
"+",
"+a = C(eval... | false | 0.037239 | 0.03862 | 0.964246 | [
"s498612099",
"s965947522"
] |
u079022693 | p02695 | python | s544484434 | s074571444 | 842 | 740 | 29,904 | 21,416 | Accepted | Accepted | 12.11 | from sys import stdin
from collections import deque
def main():
#入力
readline=stdin.readline
N,M,Q=list(map(int,readline().split()))
a=[]
b=[]
c=[]
d=[]
for i in range(Q):
li=list(map(int,readline().split()))
a.append(li[0])
b.append(li[1])
c.... | from sys import stdin
import itertools
def main():
#入力
readline=stdin.readline
N,M,Q=list(map(int,readline().split()))
a=[0]*Q
b=[0]*Q
c=[0]*Q
d=[0]*Q
for i in range(Q):
a[i],b[i],c[i],d[i]=list(map(int,readline().split()))
arrays=list(itertools.combinations_wit... | 44 | 24 | 966 | 580 | from sys import stdin
from collections import deque
def main():
# 入力
readline = stdin.readline
N, M, Q = list(map(int, readline().split()))
a = []
b = []
c = []
d = []
for i in range(Q):
li = list(map(int, readline().split()))
a.append(li[0])
b.append(li[1])
... | from sys import stdin
import itertools
def main():
# 入力
readline = stdin.readline
N, M, Q = list(map(int, readline().split()))
a = [0] * Q
b = [0] * Q
c = [0] * Q
d = [0] * Q
for i in range(Q):
a[i], b[i], c[i], d[i] = list(map(int, readline().split()))
arrays = list(iterto... | false | 45.454545 | [
"-from collections import deque",
"+import itertools",
"- a = []",
"- b = []",
"- c = []",
"- d = []",
"+ a = [0] * Q",
"+ b = [0] * Q",
"+ c = [0] * Q",
"+ d = [0] * Q",
"- li = list(map(int, readline().split()))",
"- a.append(li[0])",
"- b.appen... | false | 0.063214 | 0.046712 | 1.353264 | [
"s544484434",
"s074571444"
] |
u561083515 | p03044 | python | s920066998 | s848311763 | 766 | 689 | 42,800 | 42,796 | Accepted | Accepted | 10.05 | N = int(eval(input()))
edge = [[] for _ in range(N)]
for _ in range(N-1):
u,v,w = list(map(int, input().split()))
edge[u-1].append((v-1, w))
edge[v-1].append((u-1, w))
dist = [-1] * N
dist[0] = 0
que = [0]
while que:
u = que.pop()
d = dist[u]
for v,w in edge[u]:
if dist[... | N = int(eval(input()))
edge = [[] for _ in range(N)]
for _ in range(N-1):
u,v,w = list(map(int, input().split()))
edge[u-1].append((v-1, w))
edge[v-1].append((u-1, w))
dist = [-1] * N
dist[0] = 0
stack = [0]
while stack:
u = stack.pop()
d = dist[u]
for v,w in edge[u]:
if... | 25 | 25 | 470 | 478 | N = int(eval(input()))
edge = [[] for _ in range(N)]
for _ in range(N - 1):
u, v, w = list(map(int, input().split()))
edge[u - 1].append((v - 1, w))
edge[v - 1].append((u - 1, w))
dist = [-1] * N
dist[0] = 0
que = [0]
while que:
u = que.pop()
d = dist[u]
for v, w in edge[u]:
if dist[v] >... | N = int(eval(input()))
edge = [[] for _ in range(N)]
for _ in range(N - 1):
u, v, w = list(map(int, input().split()))
edge[u - 1].append((v - 1, w))
edge[v - 1].append((u - 1, w))
dist = [-1] * N
dist[0] = 0
stack = [0]
while stack:
u = stack.pop()
d = dist[u]
for v, w in edge[u]:
if dis... | false | 0 | [
"-que = [0]",
"-while que:",
"- u = que.pop()",
"+stack = [0]",
"+while stack:",
"+ u = stack.pop()",
"- que.append(v)",
"+ stack.append(v)"
] | false | 0.043264 | 0.045051 | 0.960334 | [
"s920066998",
"s848311763"
] |
u600402037 | p03087 | python | s656242761 | s228981282 | 1,768 | 867 | 17,212 | 9,204 | Accepted | Accepted | 50.96 | import numpy as np
N, Q = list(map(int, input().split()))
S = np.array(list('_' + eval(input())), dtype='U')
A = (S == 'A')
C = (S == 'C')
AC = A[:-1] & C[1:]
AC_cum = AC.cumsum()
for _ in range(Q):
l, r = list(map(int, input().split()))
print((AC_cum[r-1] - AC_cum[l-1])) | N, Q = list(map(int, input().split()))
S = eval(input())
B = [0] * N
for i in range(N-1):
if S[i] == 'A' and S[i+1] == 'C':
B[i] = 1
for i in range(1, N-1):
B[i] += B[i-1]
for i in range(Q):
l, r = list(map(int, input().split()))
print((B[r-2] - B[l-2])) | 13 | 11 | 275 | 268 | import numpy as np
N, Q = list(map(int, input().split()))
S = np.array(list("_" + eval(input())), dtype="U")
A = S == "A"
C = S == "C"
AC = A[:-1] & C[1:]
AC_cum = AC.cumsum()
for _ in range(Q):
l, r = list(map(int, input().split()))
print((AC_cum[r - 1] - AC_cum[l - 1]))
| N, Q = list(map(int, input().split()))
S = eval(input())
B = [0] * N
for i in range(N - 1):
if S[i] == "A" and S[i + 1] == "C":
B[i] = 1
for i in range(1, N - 1):
B[i] += B[i - 1]
for i in range(Q):
l, r = list(map(int, input().split()))
print((B[r - 2] - B[l - 2]))
| false | 15.384615 | [
"-import numpy as np",
"-",
"-S = np.array(list(\"_\" + eval(input())), dtype=\"U\")",
"-A = S == \"A\"",
"-C = S == \"C\"",
"-AC = A[:-1] & C[1:]",
"-AC_cum = AC.cumsum()",
"-for _ in range(Q):",
"+S = eval(input())",
"+B = [0] * N",
"+for i in range(N - 1):",
"+ if S[i] == \"A\" and S[i +... | false | 0.456499 | 0.037609 | 12.138125 | [
"s656242761",
"s228981282"
] |
u729133443 | p03148 | python | s441025425 | s768953257 | 778 | 583 | 72,884 | 36,960 | Accepted | Accepted | 25.06 | import heapq
n,k=list(map(int,input().split()))
z=[0,1]
for i in range(1,n):
z.append(z[i]+2)
s=sorted([list(map(int,input().split()))for _ in range(n)],key=lambda x:-x[1])
q=[]
v=0
ans=0
l=[0]*-~n
for a in s[:k]:
if not l[a[0]]:
v+=1
ans+=z[v]
else:
heapq.heappush(q,a... | import heapq as h;I=lambda:list(map(int,input().split()));n,k=I();z=[i*2+1for i in range(n)];s=sorted([I()for _ in[0]*n],key=lambda x:-x[1]);q=[];v=A=0;l=[0]*-~n
for a in s[:k]:
if l[a[0]]:h.heappush(q,a[1])
else:A+=z[v];v+=1
l[a[0]]=1;A+=a[1]
T=A
for a in s[k:]:
if not q:break
if l[a[0]]^1:l[a[0]]=1;t=h.h... | 28 | 10 | 527 | 371 | import heapq
n, k = list(map(int, input().split()))
z = [0, 1]
for i in range(1, n):
z.append(z[i] + 2)
s = sorted([list(map(int, input().split())) for _ in range(n)], key=lambda x: -x[1])
q = []
v = 0
ans = 0
l = [0] * -~n
for a in s[:k]:
if not l[a[0]]:
v += 1
ans += z[v]
else:
he... | import heapq as h
I = lambda: list(map(int, input().split()))
n, k = I()
z = [i * 2 + 1 for i in range(n)]
s = sorted([I() for _ in [0] * n], key=lambda x: -x[1])
q = []
v = A = 0
l = [0] * -~n
for a in s[:k]:
if l[a[0]]:
h.heappush(q, a[1])
else:
A += z[v]
v += 1
l[a[0]] = 1
A ... | false | 64.285714 | [
"-import heapq",
"+import heapq as h",
"-n, k = list(map(int, input().split()))",
"-z = [0, 1]",
"-for i in range(1, n):",
"- z.append(z[i] + 2)",
"-s = sorted([list(map(int, input().split())) for _ in range(n)], key=lambda x: -x[1])",
"+I = lambda: list(map(int, input().split()))",
"+n, k = I()"... | false | 0.04486 | 0.047707 | 0.940331 | [
"s441025425",
"s768953257"
] |
u620806894 | p02990 | python | s342251282 | s562645429 | 1,192 | 562 | 3,444 | 3,944 | Accepted | Accepted | 52.85 |
N, K = list(map(int, input().split()))
MOD=10**9+7
def cmb(n, r):
if n < r: return 0 #date added
if n - r < r: r = n - r
if r == 0: return 1
if r == 1: return n
numerator = [n - r + k + 1 for k in range(r)]
denominator = [k + 1 for k in range(r)]
for p in range(2,r+1):
... |
N, K = list(map(int, input().split()))
MOD=10**9+7
from operator import mul
from functools import reduce
def cmb(n,r):
if n < r: return 0 # added
r = min(n-r,r)
if r == 0: return 1
over = reduce(mul, list(range(n, n - r, -1)))
under = reduce(mul, list(range(1,r + 1)))
return over... | 33 | 19 | 827 | 436 | N, K = list(map(int, input().split()))
MOD = 10**9 + 7
def cmb(n, r):
if n < r:
return 0 # date added
if n - r < r:
r = n - r
if r == 0:
return 1
if r == 1:
return n
numerator = [n - r + k + 1 for k in range(r)]
denominator = [k + 1 for k in range(r)]
for p... | N, K = list(map(int, input().split()))
MOD = 10**9 + 7
from operator import mul
from functools import reduce
def cmb(n, r):
if n < r:
return 0 # added
r = min(n - r, r)
if r == 0:
return 1
over = reduce(mul, list(range(n, n - r, -1)))
under = reduce(mul, list(range(1, r + 1)))
... | false | 42.424242 | [
"+from operator import mul",
"+from functools import reduce",
"- return 0 # date added",
"- if n - r < r:",
"- r = n - r",
"+ return 0 # added",
"+ r = min(n - r, r)",
"- if r == 1:",
"- return n",
"- numerator = [n - r + k + 1 for k in range(r)]",
"- ... | false | 0.086409 | 0.03809 | 2.268557 | [
"s342251282",
"s562645429"
] |
u794173881 | p03388 | python | s080293754 | s759273750 | 224 | 189 | 40,812 | 38,768 | Accepted | Accepted | 15.62 | def solve(ab,i):
return (ab - 1) // i
q = int(eval(input()))
for i in range(q):
a, b = list(map(int, input().split()))
if a > b:
a, b = b, a
ans = a - 1
start_a = a + 1
num = int((a * b) ** 0.5)
while True:
if solve(a*b, num) == solve(a*b, num + 1):
... |
q = int(eval(input()))
info = [list(map(int, input().split())) for i in range(q)]
for i in range(q):
min_, max_ = info[i]
min_, max_ = min(min_, max_), max(min_, max_)
# a, b = 1, 1 のときREが出る
if min_ == 1 and max_ == 1:
print((0))
continue
mul = min_ * max_
... | 22 | 31 | 464 | 659 | def solve(ab, i):
return (ab - 1) // i
q = int(eval(input()))
for i in range(q):
a, b = list(map(int, input().split()))
if a > b:
a, b = b, a
ans = a - 1
start_a = a + 1
num = int((a * b) ** 0.5)
while True:
if solve(a * b, num) == solve(a * b, num + 1):
break
... | q = int(eval(input()))
info = [list(map(int, input().split())) for i in range(q)]
for i in range(q):
min_, max_ = info[i]
min_, max_ = min(min_, max_), max(min_, max_)
# a, b = 1, 1 のときREが出る
if min_ == 1 and max_ == 1:
print((0))
continue
mul = min_ * max_
ans = 2 * (min_ - 1)
... | false | 29.032258 | [
"-def solve(ab, i):",
"- return (ab - 1) // i",
"-",
"-",
"+info = [list(map(int, input().split())) for i in range(q)]",
"- a, b = list(map(int, input().split()))",
"- if a > b:",
"- a, b = b, a",
"- ans = a - 1",
"- start_a = a + 1",
"- num = int((a * b) ** 0.5)",
"- ... | false | 0.045897 | 0.085732 | 0.535357 | [
"s080293754",
"s759273750"
] |
u548303713 | p02713 | python | s874943388 | s512923106 | 724 | 499 | 70,208 | 67,904 | Accepted | Accepted | 31.08 | import math
k=int(eval(input()))
total=0
info=[0]
for i in range(1,201):
for j in range(1,201):
if j<i:
info.append(0)
continue
info.append(math.gcd(i,j))
#print(str(i)+" "+str(j)+" "+str(math.gcd(i,j)))
#print(info[202])
#print(info)
for i in range(1,k+1... | from math import gcd
k=int(eval(input()))
total=0
for i in range(1,k+1):
for j in range(1,k+1):
for m in range(1,k+1):
g=gcd(i,j)
g=gcd(g,m)
total+=g
print(total) | 31 | 10 | 730 | 213 | import math
k = int(eval(input()))
total = 0
info = [0]
for i in range(1, 201):
for j in range(1, 201):
if j < i:
info.append(0)
continue
info.append(math.gcd(i, j))
# print(str(i)+" "+str(j)+" "+str(math.gcd(i,j)))
# print(info[202])
# print(info)
for i in range(1, ... | from math import gcd
k = int(eval(input()))
total = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
for m in range(1, k + 1):
g = gcd(i, j)
g = gcd(g, m)
total += g
print(total)
| false | 67.741935 | [
"-import math",
"+from math import gcd",
"-info = [0]",
"-for i in range(1, 201):",
"- for j in range(1, 201):",
"- if j < i:",
"- info.append(0)",
"- continue",
"- info.append(math.gcd(i, j))",
"- # print(str(i)+\" \"+str(j)+\" \"+str(math.gcd(i,j)))"... | false | 0.056211 | 0.041012 | 1.370614 | [
"s874943388",
"s512923106"
] |
u667024514 | p03639 | python | s877323073 | s018898883 | 72 | 62 | 14,484 | 14,252 | Accepted | Accepted | 13.89 | n = int(eval(input()))
cou1 = 0
cou2 = 0
cou4 = 0
lis = list(map(int,input().split()))
for i in range(n):
if lis[i] % 2 == 0:
if lis[i] % 4 == 0:
cou4 += 1
else:
cou2 += 1
else:
cou1 += 1
if cou2 == 0:
if cou1 <= cou4 + 1:
print("Yes")
... | n = int(eval(input()))
lis = list(map(int,input().split()))
nu1 = 0
nu2 = 0
nu4 = 0
for nu in lis:
if nu % 2 == 0:
if nu % 4 == 0:
nu4 += 1
else:
nu2 = 1
else:
nu1 += 1
if nu4 + 1 >= nu1 + nu2:print("Yes")
else:print("No") | 23 | 15 | 427 | 286 | n = int(eval(input()))
cou1 = 0
cou2 = 0
cou4 = 0
lis = list(map(int, input().split()))
for i in range(n):
if lis[i] % 2 == 0:
if lis[i] % 4 == 0:
cou4 += 1
else:
cou2 += 1
else:
cou1 += 1
if cou2 == 0:
if cou1 <= cou4 + 1:
print("Yes")
else:
... | n = int(eval(input()))
lis = list(map(int, input().split()))
nu1 = 0
nu2 = 0
nu4 = 0
for nu in lis:
if nu % 2 == 0:
if nu % 4 == 0:
nu4 += 1
else:
nu2 = 1
else:
nu1 += 1
if nu4 + 1 >= nu1 + nu2:
print("Yes")
else:
print("No")
| false | 34.782609 | [
"-cou1 = 0",
"-cou2 = 0",
"-cou4 = 0",
"-for i in range(n):",
"- if lis[i] % 2 == 0:",
"- if lis[i] % 4 == 0:",
"- cou4 += 1",
"+nu1 = 0",
"+nu2 = 0",
"+nu4 = 0",
"+for nu in lis:",
"+ if nu % 2 == 0:",
"+ if nu % 4 == 0:",
"+ nu4 += 1",
"- ... | false | 0.039936 | 0.041623 | 0.959466 | [
"s877323073",
"s018898883"
] |
u594956556 | p03262 | python | s871431838 | s789414851 | 137 | 104 | 16,432 | 16,308 | Accepted | Accepted | 24.09 | from fractions import gcd
from functools import reduce
n,x_ = list(map(int, input().split()))
x = list(map(int, input().split()))
x.append(x_)
x.sort()
sa = [x[i+1]-x[i] for i in range(n)]
d = reduce(lambda a,b:gcd(a,b),sa)
print(d) | from fractions import gcd
from functools import reduce
n,x_ = list(map(int, input().split()))
x = list(map(int, input().split()))
x.append(x_)
sa = [abs(x[i+1]-x[i]) for i in range(n)]
d = reduce(lambda a,b:gcd(a,b),sa)
print(d) | 10 | 9 | 236 | 231 | from fractions import gcd
from functools import reduce
n, x_ = list(map(int, input().split()))
x = list(map(int, input().split()))
x.append(x_)
x.sort()
sa = [x[i + 1] - x[i] for i in range(n)]
d = reduce(lambda a, b: gcd(a, b), sa)
print(d)
| from fractions import gcd
from functools import reduce
n, x_ = list(map(int, input().split()))
x = list(map(int, input().split()))
x.append(x_)
sa = [abs(x[i + 1] - x[i]) for i in range(n)]
d = reduce(lambda a, b: gcd(a, b), sa)
print(d)
| false | 10 | [
"-x.sort()",
"-sa = [x[i + 1] - x[i] for i in range(n)]",
"+sa = [abs(x[i + 1] - x[i]) for i in range(n)]"
] | false | 0.042244 | 0.045881 | 0.920738 | [
"s871431838",
"s789414851"
] |
u737758066 | p02886 | python | s809641510 | s163576795 | 184 | 170 | 38,896 | 38,512 | Accepted | Accepted | 7.61 | import itertools
n = int(eval(input()))
d = list(map(int, input().split()))
ans = 0
for v in list(itertools.combinations(d, 2)):
ans += (v[0] * v[1])
print(ans)
| import itertools
n = int(eval(input()))
d = list(map(int, input().split()))
'''
ans = 0
for v in list(itertools.combinations(d, 2)):
ans += (v[0] * v[1])
print(ans)
'''
ans = 0
for i in range(n):
for j in range(i+1, n):
ans += d[i] * d[j]
print(ans)
| 10 | 19 | 171 | 283 | import itertools
n = int(eval(input()))
d = list(map(int, input().split()))
ans = 0
for v in list(itertools.combinations(d, 2)):
ans += v[0] * v[1]
print(ans)
| import itertools
n = int(eval(input()))
d = list(map(int, input().split()))
"""
ans = 0
for v in list(itertools.combinations(d, 2)):
ans += (v[0] * v[1])
print(ans)
"""
ans = 0
for i in range(n):
for j in range(i + 1, n):
ans += d[i] * d[j]
print(ans)
| false | 47.368421 | [
"+\"\"\"",
"- ans += v[0] * v[1]",
"+ ans += (v[0] * v[1])",
"+\"\"\"",
"+ans = 0",
"+for i in range(n):",
"+ for j in range(i + 1, n):",
"+ ans += d[i] * d[j]",
"+print(ans)"
] | false | 0.036528 | 0.036347 | 1.004981 | [
"s809641510",
"s163576795"
] |
u459861655 | p00026 | python | s669007460 | s044747357 | 20 | 10 | 5,016 | 5,016 | Accepted | Accepted | 50 | drops = {
1: ((0,0,0,0,0), (0,0,1,0,0), (0,1,1,1,0), (0,0,1,0,0), (0,0,0,0,0)),
2: ((0,0,0,0,0), (0,1,1,1,0), (0,1,1,1,0), (0,1,1,1,0), (0,0,0,0,0)),
3: ((0,0,1,0,0), (0,1,1,1,0), (1,1,1,1,1), (0,1,1,1,0), (0,0,1,0,0))}
paper = [[0 for i in range(14)] for j in range(14)]
def solve(x, y, size):
... | drops = {
1: ((0,0,0,0,0), (0,0,1,0,0), (0,1,1,1,0), (0,0,1,0,0), (0,0,0,0,0)),
2: ((0,0,0,0,0), (0,1,1,1,0), (0,1,1,1,0), (0,1,1,1,0), (0,0,0,0,0)),
3: ((0,0,1,0,0), (0,1,1,1,0), (1,1,1,1,1), (0,1,1,1,0), (0,0,1,0,0))}
paper = [[0] * 14 for j in range(14)]
def solve(x, y, size):
for i in rang... | 31 | 24 | 799 | 674 | drops = {
1: (
(0, 0, 0, 0, 0),
(0, 0, 1, 0, 0),
(0, 1, 1, 1, 0),
(0, 0, 1, 0, 0),
(0, 0, 0, 0, 0),
),
2: (
(0, 0, 0, 0, 0),
(0, 1, 1, 1, 0),
(0, 1, 1, 1, 0),
(0, 1, 1, 1, 0),
(0, 0, 0, 0, 0),
),
3: (
(0, 0, 1, 0... | drops = {
1: (
(0, 0, 0, 0, 0),
(0, 0, 1, 0, 0),
(0, 1, 1, 1, 0),
(0, 0, 1, 0, 0),
(0, 0, 0, 0, 0),
),
2: (
(0, 0, 0, 0, 0),
(0, 1, 1, 1, 0),
(0, 1, 1, 1, 0),
(0, 1, 1, 1, 0),
(0, 0, 0, 0, 0),
),
3: (
(0, 0, 1, 0... | false | 22.580645 | [
"-paper = [[0 for i in range(14)] for j in range(14)]",
"+paper = [[0] * 14 for j in range(14)]",
"- x, y, size = list(map(int, line.split(\",\")))",
"- solve(x, y, size)",
"-s = c = 0",
"-for i in range(2, 12):",
"- for j in range(2, 12):",
"- if paper[i][j] == 0:",
"- c ... | false | 0.089256 | 0.110274 | 0.8094 | [
"s669007460",
"s044747357"
] |
u347640436 | p03167 | python | s269405893 | s238798327 | 1,239 | 1,037 | 43,608 | 49,564 | Accepted | Accepted | 16.3 | # 配るDP
H, W = list(map(int, input().split()))
a = [eval(input()) for _ in range(H)]
dp = [[0] * W for _ in range(H)]
dp[0][0] = 1
for h in range(H - 1):
for w in range(W - 1):
if a[h][w] == '#':
continue
if a[h][w + 1] != '#':
dp[h][w + 1] = (dp[h][w + 1] + dp[h][w]) % 1000000007
... | # 配るDP
H, W = list(map(int, input().split()))
a = [eval(input()) for _ in range(H)]
m = 1000000007
dp = [[0] * W for _ in range(H)]
dp[0][0] = 1
for h in range(H - 1):
for w in range(W - 1):
if a[h][w] == '#':
continue
if a[h][w + 1] != '#':
dp[h][w + 1] = (dp[... | 25 | 27 | 725 | 763 | # 配るDP
H, W = list(map(int, input().split()))
a = [eval(input()) for _ in range(H)]
dp = [[0] * W for _ in range(H)]
dp[0][0] = 1
for h in range(H - 1):
for w in range(W - 1):
if a[h][w] == "#":
continue
if a[h][w + 1] != "#":
dp[h][w + 1] = (dp[h][w + 1] + dp[h][w]) % 100000... | # 配るDP
H, W = list(map(int, input().split()))
a = [eval(input()) for _ in range(H)]
m = 1000000007
dp = [[0] * W for _ in range(H)]
dp[0][0] = 1
for h in range(H - 1):
for w in range(W - 1):
if a[h][w] == "#":
continue
if a[h][w + 1] != "#":
dp[h][w + 1] = (dp[h][w + 1] + dp[... | false | 7.407407 | [
"+m = 1000000007",
"- dp[h][w + 1] = (dp[h][w + 1] + dp[h][w]) % 1000000007",
"+ dp[h][w + 1] = (dp[h][w + 1] + dp[h][w]) % m",
"- dp[h + 1][w] = (dp[h + 1][w] + dp[h][w]) % 1000000007",
"+ dp[h + 1][w] = (dp[h + 1][w] + dp[h][w]) % m",
"- dp[h + 1][W - 1... | false | 0.084842 | 0.040567 | 2.09139 | [
"s269405893",
"s238798327"
] |
u269969976 | p03107 | python | s603917771 | s268061585 | 67 | 18 | 3,956 | 3,188 | Accepted | Accepted | 73.13 | # coding: utf-8
mojiretsu = input().rstrip()
stk = []
ans = 0
for i in mojiretsu:
if len(stk) > 0 and stk[len(stk)-1] != i:
stk.pop()
ans += 2
else:
stk.append(i)
print(ans) | # coding: utf-8
s = input().rstrip()
ans = min(s.count("0"), s.count("1")) * 2
print(ans) | 16 | 7 | 225 | 98 | # coding: utf-8
mojiretsu = input().rstrip()
stk = []
ans = 0
for i in mojiretsu:
if len(stk) > 0 and stk[len(stk) - 1] != i:
stk.pop()
ans += 2
else:
stk.append(i)
print(ans)
| # coding: utf-8
s = input().rstrip()
ans = min(s.count("0"), s.count("1")) * 2
print(ans)
| false | 56.25 | [
"-mojiretsu = input().rstrip()",
"-stk = []",
"-ans = 0",
"-for i in mojiretsu:",
"- if len(stk) > 0 and stk[len(stk) - 1] != i:",
"- stk.pop()",
"- ans += 2",
"- else:",
"- stk.append(i)",
"+s = input().rstrip()",
"+ans = min(s.count(\"0\"), s.count(\"1\")) * 2"
] | false | 0.044242 | 0.036572 | 1.209742 | [
"s603917771",
"s268061585"
] |
u941438707 | p03069 | python | s610505248 | s883984220 | 133 | 96 | 16,960 | 17,000 | Accepted | Accepted | 27.82 | ans=n=int(eval(input()))
s=eval(input())
a=[0]
for i in s:
if i==".":a+=[a[-1]+1]
else:a+=[a[-1]]
w=s.count(".")
for i in range(n+1):
ans=min(ans,i-a[i]+w-a[i])
print(ans) | n=int(eval(input()))
s=eval(input())
a=[0]
for i in s:
if i==".":a+=[a[-1]+1]
else:a+=[a[-1]]
w=s.count(".")
print((min(i-a[i]+w-a[i] for i in range(n+1)))) | 10 | 8 | 180 | 157 | ans = n = int(eval(input()))
s = eval(input())
a = [0]
for i in s:
if i == ".":
a += [a[-1] + 1]
else:
a += [a[-1]]
w = s.count(".")
for i in range(n + 1):
ans = min(ans, i - a[i] + w - a[i])
print(ans)
| n = int(eval(input()))
s = eval(input())
a = [0]
for i in s:
if i == ".":
a += [a[-1] + 1]
else:
a += [a[-1]]
w = s.count(".")
print((min(i - a[i] + w - a[i] for i in range(n + 1))))
| false | 20 | [
"-ans = n = int(eval(input()))",
"+n = int(eval(input()))",
"-for i in range(n + 1):",
"- ans = min(ans, i - a[i] + w - a[i])",
"-print(ans)",
"+print((min(i - a[i] + w - a[i] for i in range(n + 1))))"
] | false | 0.038414 | 0.031349 | 1.225336 | [
"s610505248",
"s883984220"
] |
u891518152 | p03545 | python | s538907243 | s400817327 | 171 | 17 | 38,384 | 3,060 | Accepted | Accepted | 90.06 | N = list(input())
N = [int(i) for i in N]
for i in range(2**3):
cur = bin(i)[2::].zfill(3)
c = N[0]
n = []
for i in range(3):
if cur[i]=='0':
n.append('+')
c += N[i+1]
else:
n.append('-')
c -= N[i+1]
if c==7:
m = '... | #ABC079 C bit全探索
A, B, C, D = eval(input())
for i in range(2**3):
op = ['+']*3
for j in range(3):
if (i >> j) & 1:
op[j]='-'
if eval(A+op[0]+B+op[1]+C+op[2]+D) ==7:
print((A+op[0]+B+op[1]+C+op[2]+D+'=7' ))
break | 17 | 10 | 401 | 260 | N = list(input())
N = [int(i) for i in N]
for i in range(2**3):
cur = bin(i)[2::].zfill(3)
c = N[0]
n = []
for i in range(3):
if cur[i] == "0":
n.append("+")
c += N[i + 1]
else:
n.append("-")
c -= N[i + 1]
if c == 7:
m = "="
... | # ABC079 C bit全探索
A, B, C, D = eval(input())
for i in range(2**3):
op = ["+"] * 3
for j in range(3):
if (i >> j) & 1:
op[j] = "-"
if eval(A + op[0] + B + op[1] + C + op[2] + D) == 7:
print((A + op[0] + B + op[1] + C + op[2] + D + "=7"))
break
| false | 41.176471 | [
"-N = list(input())",
"-N = [int(i) for i in N]",
"+# ABC079 C bit全探索",
"+A, B, C, D = eval(input())",
"- cur = bin(i)[2::].zfill(3)",
"- c = N[0]",
"- n = []",
"- for i in range(3):",
"- if cur[i] == \"0\":",
"- n.append(\"+\")",
"- c += N[i + 1]",
"- ... | false | 0.047509 | 0.042652 | 1.113873 | [
"s538907243",
"s400817327"
] |
u228223940 | p03112 | python | s123366435 | s042851568 | 1,538 | 1,066 | 12,216 | 16,132 | Accepted | Accepted | 30.69 | import sys
import bisect
input = sys.stdin.readline
a,b,q = list(map(int,input().split()))
s = [int(eval(input())) for i in range(a)]
t = [int(eval(input())) for i in range(b)]
#x = [int(input()) for i in range(q)]
ans = 10**100
for i in range(q):
x = int(eval(input()))
ans = 10**100
s_id... | import sys
import bisect
input = sys.stdin.readline
a,b,q = list(map(int,input().split()))
ans = 10**100
s = [-ans] + [int(eval(input())) for i in range(a)] + [ans]
t = [-ans] + [int(eval(input())) for i in range(b)] + [ans]
x = [int(eval(input())) for i in range(q)]
ans = 10**100
for i in range(q)... | 25 | 27 | 688 | 678 | import sys
import bisect
input = sys.stdin.readline
a, b, q = list(map(int, input().split()))
s = [int(eval(input())) for i in range(a)]
t = [int(eval(input())) for i in range(b)]
# x = [int(input()) for i in range(q)]
ans = 10**100
for i in range(q):
x = int(eval(input()))
ans = 10**100
s_idx = bisect.bis... | import sys
import bisect
input = sys.stdin.readline
a, b, q = list(map(int, input().split()))
ans = 10**100
s = [-ans] + [int(eval(input())) for i in range(a)] + [ans]
t = [-ans] + [int(eval(input())) for i in range(b)] + [ans]
x = [int(eval(input())) for i in range(q)]
ans = 10**100
for i in range(q):
ans = 10**1... | false | 7.407407 | [
"-s = [int(eval(input())) for i in range(a)]",
"-t = [int(eval(input())) for i in range(b)]",
"-# x = [int(input()) for i in range(q)]",
"+ans = 10**100",
"+s = [-ans] + [int(eval(input())) for i in range(a)] + [ans]",
"+t = [-ans] + [int(eval(input())) for i in range(b)] + [ans]",
"+x = [int(eval(input... | false | 0.031996 | 0.035893 | 0.891418 | [
"s123366435",
"s042851568"
] |
u077291787 | p03739 | python | s641409822 | s438956003 | 102 | 76 | 14,468 | 14,332 | Accepted | Accepted | 25.49 | # ARC072C - Sequence (ABC059C)
def main():
n = int(eval(input()))
lst = list(map(int, input().rstrip().split()))
cnt = [0] * 2
# start with positive number
cur = 0
for i, j in enumerate(lst):
cur += j
if i % 2 == 0 and cur <= 0:
cnt[0] += abs(cur) + 1
... | # ARC072C - Sequence (ABC059C)
def seq_modifier(lst: list, flg: bool) -> int: # true: positive
"""
ARC072C - Sequence
https://atcoder.jp/contests/abc072/tasks/arc072_a
"""
cur, cnt = 0, 0
for i in lst:
cur += i
if flg and cur <= 0:
cnt += abs(cur) + 1
... | 33 | 27 | 789 | 667 | # ARC072C - Sequence (ABC059C)
def main():
n = int(eval(input()))
lst = list(map(int, input().rstrip().split()))
cnt = [0] * 2
# start with positive number
cur = 0
for i, j in enumerate(lst):
cur += j
if i % 2 == 0 and cur <= 0:
cnt[0] += abs(cur) + 1
cur ... | # ARC072C - Sequence (ABC059C)
def seq_modifier(lst: list, flg: bool) -> int: # true: positive
"""
ARC072C - Sequence
https://atcoder.jp/contests/abc072/tasks/arc072_a
"""
cur, cnt = 0, 0
for i in lst:
cur += i
if flg and cur <= 0:
cnt += abs(cur) + 1
cur... | false | 18.181818 | [
"+def seq_modifier(lst: list, flg: bool) -> int: # true: positive",
"+ \"\"\"",
"+ ARC072C - Sequence",
"+ https://atcoder.jp/contests/abc072/tasks/arc072_a",
"+ \"\"\"",
"+ cur, cnt = 0, 0",
"+ for i in lst:",
"+ cur += i",
"+ if flg and cur <= 0:",
"+ ... | false | 0.042631 | 0.112334 | 0.3795 | [
"s641409822",
"s438956003"
] |
u020390084 | p03221 | python | s691987077 | s652200977 | 681 | 432 | 50,260 | 44,268 | Accepted | Accepted | 36.56 | n,m=list(map(int,input().split()))
city_list = [[] for _ in range(n)]
py = [list(map(int,input().split())) for _ in range(m)]
for ppyy in py:
city_list[ppyy[0]-1].append(ppyy[1])
dict = {}
for index, ppyy in enumerate(city_list):
ppyy.sort()
for index2, pppyyy in enumerate(ppyy):
dict[pppyyy] =... | #!/usr/bin/env python3
import sys
def solve(N: int, M: int, P: "List[int]", Y: "List[int]"):
hashTable = {}
for i in range(M):
if hashTable.get(P[i]) == None:
hashTable[P[i]] = [Y[i]]
else:
hashTable[P[i]].append(Y[i])
# Year: idnumber
answer... | 16 | 45 | 404 | 1,089 | n, m = list(map(int, input().split()))
city_list = [[] for _ in range(n)]
py = [list(map(int, input().split())) for _ in range(m)]
for ppyy in py:
city_list[ppyy[0] - 1].append(ppyy[1])
dict = {}
for index, ppyy in enumerate(city_list):
ppyy.sort()
for index2, pppyyy in enumerate(ppyy):
dict[pppyyy]... | #!/usr/bin/env python3
import sys
def solve(N: int, M: int, P: "List[int]", Y: "List[int]"):
hashTable = {}
for i in range(M):
if hashTable.get(P[i]) == None:
hashTable[P[i]] = [Y[i]]
else:
hashTable[P[i]].append(Y[i])
# Year: idnumber
answerTable = {}
for k... | false | 64.444444 | [
"-n, m = list(map(int, input().split()))",
"-city_list = [[] for _ in range(n)]",
"-py = [list(map(int, input().split())) for _ in range(m)]",
"-for ppyy in py:",
"- city_list[ppyy[0] - 1].append(ppyy[1])",
"-dict = {}",
"-for index, ppyy in enumerate(city_list):",
"- ppyy.sort()",
"- for i... | false | 0.034639 | 0.074006 | 0.46805 | [
"s691987077",
"s652200977"
] |
u282228874 | p03325 | python | s197236457 | s677013935 | 121 | 102 | 4,148 | 4,524 | Accepted | Accepted | 15.7 | n = int(eval(input()))
A = list(map(int,input().split()))
count = 0
for a in A:
while a%2 == 0:
count += 1
a /= 2
print(count) | n = int(eval(input()))
A = list(map(int,input().split()))
cnt = 0
for a in A:
while a%2 == 0:
cnt += 1
a /= 2
print(cnt)
| 8 | 8 | 147 | 142 | n = int(eval(input()))
A = list(map(int, input().split()))
count = 0
for a in A:
while a % 2 == 0:
count += 1
a /= 2
print(count)
| n = int(eval(input()))
A = list(map(int, input().split()))
cnt = 0
for a in A:
while a % 2 == 0:
cnt += 1
a /= 2
print(cnt)
| false | 0 | [
"-count = 0",
"+cnt = 0",
"- count += 1",
"+ cnt += 1",
"-print(count)",
"+print(cnt)"
] | false | 0.052059 | 0.035051 | 1.485234 | [
"s197236457",
"s677013935"
] |
u077898957 | p03370 | python | s269184349 | s106610539 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | n,x = list(map(int,input().split()))
y = 1000
for i in range(n):
z = int(eval(input()))
x -= z
y = min(y,z)
print((n+x//y))
| n,x=list(map(int,input().split()))
M=sorted([int(eval(input())) for i in range(n)])
print((len(M)+(x-sum(M))//M[0]))
| 7 | 3 | 128 | 105 | n, x = list(map(int, input().split()))
y = 1000
for i in range(n):
z = int(eval(input()))
x -= z
y = min(y, z)
print((n + x // y))
| n, x = list(map(int, input().split()))
M = sorted([int(eval(input())) for i in range(n)])
print((len(M) + (x - sum(M)) // M[0]))
| false | 57.142857 | [
"-y = 1000",
"-for i in range(n):",
"- z = int(eval(input()))",
"- x -= z",
"- y = min(y, z)",
"-print((n + x // y))",
"+M = sorted([int(eval(input())) for i in range(n)])",
"+print((len(M) + (x - sum(M)) // M[0]))"
] | false | 0.124279 | 0.097927 | 1.269102 | [
"s269184349",
"s106610539"
] |
u698868214 | p02615 | python | s106007811 | s207394007 | 120 | 108 | 31,408 | 31,484 | Accepted | Accepted | 10 | N = int(eval(input()))
A = list(map(int,input().split()))
A = sorted(A,reverse=True)
ans = A[0]
for i in range(1,(N-2)//2+1):
ans += A[i]*2
if N % 2 == 1:
ans += A[(N-2)//2 + 1]
print(ans) | N = int(eval(input()))
A = list(map(int,input().split()))
A = sorted(A,reverse=True)
if N <= 3:
ans = sum(A[:-1])
elif N % 2 == 0:
ans = A[0] + sum(A[1:(N-2)//2+1])*2
elif N % 2 == 1:
ans = A[0] + sum(A[1:(N-2)//2+1])*2 + A[1+(N-2)//2]
print(ans)
| 13 | 13 | 204 | 264 | N = int(eval(input()))
A = list(map(int, input().split()))
A = sorted(A, reverse=True)
ans = A[0]
for i in range(1, (N - 2) // 2 + 1):
ans += A[i] * 2
if N % 2 == 1:
ans += A[(N - 2) // 2 + 1]
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
A = sorted(A, reverse=True)
if N <= 3:
ans = sum(A[:-1])
elif N % 2 == 0:
ans = A[0] + sum(A[1 : (N - 2) // 2 + 1]) * 2
elif N % 2 == 1:
ans = A[0] + sum(A[1 : (N - 2) // 2 + 1]) * 2 + A[1 + (N - 2) // 2]
print(ans)
| false | 0 | [
"-ans = A[0]",
"-for i in range(1, (N - 2) // 2 + 1):",
"- ans += A[i] * 2",
"-if N % 2 == 1:",
"- ans += A[(N - 2) // 2 + 1]",
"+if N <= 3:",
"+ ans = sum(A[:-1])",
"+elif N % 2 == 0:",
"+ ans = A[0] + sum(A[1 : (N - 2) // 2 + 1]) * 2",
"+elif N % 2 == 1:",
"+ ans = A[0] + sum(A[... | false | 0.042367 | 0.044743 | 0.946896 | [
"s106007811",
"s207394007"
] |
u075012704 | p02955 | python | s790143854 | s508329398 | 354 | 287 | 3,188 | 42,972 | Accepted | Accepted | 18.93 | from itertools import accumulate
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A_sum = sum(A)
ans_candidates = []
for n in range(1, int(A_sum ** 0.5) + 1):
if A_sum % n == 0:
ans_candidates.append(n)
ans_candidates.append(A_sum // n)
ans_candidates.sort(reve... | from itertools import accumulate
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
M = sum(A)
ans_candidates = []
for n in range(1, int(M ** 0.5) + 1):
if M % n == 0:
ans_candidates.append(n)
ans_candidates.append(M // n)
ans = 0
for X in ans_candidates:
... | 26 | 30 | 710 | 710 | from itertools import accumulate
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A_sum = sum(A)
ans_candidates = []
for n in range(1, int(A_sum**0.5) + 1):
if A_sum % n == 0:
ans_candidates.append(n)
ans_candidates.append(A_sum // n)
ans_candidates.sort(reverse=True)
for ... | from itertools import accumulate
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
M = sum(A)
ans_candidates = []
for n in range(1, int(M**0.5) + 1):
if M % n == 0:
ans_candidates.append(n)
ans_candidates.append(M // n)
ans = 0
for X in ans_candidates:
need_plus = sorte... | false | 13.333333 | [
"-A_sum = sum(A)",
"+M = sum(A)",
"-for n in range(1, int(A_sum**0.5) + 1):",
"- if A_sum % n == 0:",
"+for n in range(1, int(M**0.5) + 1):",
"+ if M % n == 0:",
"- ans_candidates.append(A_sum // n)",
"-ans_candidates.sort(reverse=True)",
"-for z in ans_candidates:",
"- need_add = ... | false | 0.049094 | 0.008747 | 5.612647 | [
"s790143854",
"s508329398"
] |
u596505843 | p02623 | python | s779353028 | s648147515 | 187 | 139 | 109,160 | 118,020 | Accepted | Accepted | 25.67 | import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(eval(input()))
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7
N, M, K = rl()
A = rl()
B = rl()
s = 0
for i, b in enumerate(B):
s += b
B[i] = s
import bisect
ans = 0
s = 0
j = bisect.bisect_r... | import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(eval(input()))
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7
N, M, K = rl()
A = rl()
B = rl()
s = 0
j = 0
for i, b in enumerate(B):
if s+b > K:
break
s += b
j += 1
ans = j
j -= 1
for i... | 31 | 31 | 486 | 452 | import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(eval(input()))
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7
N, M, K = rl()
A = rl()
B = rl()
s = 0
for i, b in enumerate(B):
s += b
B[i] = s
import bisect
ans = 0
s = 0
j = bisect.bisect_right(B, K)
ans =... | import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(eval(input()))
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7
N, M, K = rl()
A = rl()
B = rl()
s = 0
j = 0
for i, b in enumerate(B):
if s + b > K:
break
s += b
j += 1
ans = j
j -= 1
for i, a in e... | false | 0 | [
"+j = 0",
"+ if s + b > K:",
"+ break",
"- B[i] = s",
"-import bisect",
"-",
"-ans = 0",
"-s = 0",
"-j = bisect.bisect_right(B, K)",
"+ j += 1",
"+j -= 1",
"+ while j >= 0 and s > K:",
"+ s -= B[j]",
"+ j -= 1",
"- j = bisect.bisect_right(B, K - s)",
... | false | 0.032381 | 0.04205 | 0.770062 | [
"s779353028",
"s648147515"
] |
u580697892 | p02900 | python | s485626715 | s023048742 | 638 | 310 | 41,348 | 7,288 | Accepted | Accepted | 51.41 | # coding: utf-8
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
divisors.sort()
return divisors
A, B = list(map(int, input().split()))
dA = make_di... | # coding: utf-8
from fractions import gcd
def divisor(N):
# 約数列挙
divs = []
for i in range(1, int(N**0.5)+1):
if N % i == 0:
divs.append(i)
if i != N // i:
divs.append(N//i)
return divs
def eratosthenes(N):
# 素数判定
flag = True
for i... | 26 | 30 | 583 | 652 | # coding: utf-8
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
divisors.sort()
return divisors
A, B = list(map(int, input().split()))
dA = make_divisors(A)... | # coding: utf-8
from fractions import gcd
def divisor(N):
# 約数列挙
divs = []
for i in range(1, int(N**0.5) + 1):
if N % i == 0:
divs.append(i)
if i != N // i:
divs.append(N // i)
return divs
def eratosthenes(N):
# 素数判定
flag = True
for i in ra... | false | 13.333333 | [
"-def make_divisors(n):",
"- divisors = []",
"- for i in range(1, int(n**0.5) + 1):",
"- if n % i == 0:",
"- divisors.append(i)",
"- if i != n // i:",
"- divisors.append(n // i)",
"- divisors.sort()",
"- return divisors",
"+from fractions imp... | false | 0.039109 | 0.041819 | 0.935186 | [
"s485626715",
"s023048742"
] |
u561231954 | p03634 | python | s550658948 | s600177703 | 844 | 721 | 55,112 | 156,740 | Accepted | Accepted | 14.57 | import heapq
def dijkstra(V, edges, s):
inf=float('inf')
dist=[inf]*V
dist[s]=0
que=[[0,s]]
heapq.heapify(que) #最小値を管理 [dist[i],i]となる要素
while que:
p=heapq.heappop(que) #距離が最小のものを取り出す
dis=p[0]
v=p[1]
if dist[v] <dis:
continue
... | def main():
import sys
input=sys.stdin.readline
sys.setrecursionlimit(1000000)
n=int(eval(input()))
edges=[[] for _ in range(n)]
for i in range(n-1):
a,b,c=list(map(int,input().split()))
a-=1
b-=1
edges[a].append([b,c])
edges[b].append([a,c])
... | 48 | 36 | 1,085 | 797 | import heapq
def dijkstra(V, edges, s):
inf = float("inf")
dist = [inf] * V
dist[s] = 0
que = [[0, s]]
heapq.heapify(que) # 最小値を管理 [dist[i],i]となる要素
while que:
p = heapq.heappop(que) # 距離が最小のものを取り出す
dis = p[0]
v = p[1]
if dist[v] < dis:
continue
... | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
n = int(eval(input()))
edges = [[] for _ in range(n)]
for i in range(n - 1):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
edges[a].append([b, c])
edges[b].append([... | false | 25 | [
"-import heapq",
"-",
"-",
"-def dijkstra(V, edges, s):",
"- inf = float(\"inf\")",
"- dist = [inf] * V",
"- dist[s] = 0",
"- que = [[0, s]]",
"- heapq.heapify(que) # 最小値を管理 [dist[i],i]となる要素",
"- while que:",
"- p = heapq.heappop(que) # 距離が最小のものを取り出す",
"- dis ... | false | 0.035652 | 0.050464 | 0.706468 | [
"s550658948",
"s600177703"
] |
u439063038 | p02624 | python | s860026003 | s927582278 | 2,125 | 210 | 293,164 | 142,076 | Accepted | Accepted | 90.12 | N = int(eval(input()))
l = list(range(1, N+1))
def calc(i):
return sum(list(range(i, N+1, i)))
ans = 0
for i in range(1, N+1):
ans += calc(i)
print(ans) | N = int(eval(input()))
l = list(range(1, N+1))
def calc(i):
return (i + N//i * i) * (N//i) // 2
ans = 0
for i in range(1, N+1):
ans += calc(i)
print(ans) | 13 | 13 | 171 | 172 | N = int(eval(input()))
l = list(range(1, N + 1))
def calc(i):
return sum(list(range(i, N + 1, i)))
ans = 0
for i in range(1, N + 1):
ans += calc(i)
print(ans)
| N = int(eval(input()))
l = list(range(1, N + 1))
def calc(i):
return (i + N // i * i) * (N // i) // 2
ans = 0
for i in range(1, N + 1):
ans += calc(i)
print(ans)
| false | 0 | [
"- return sum(list(range(i, N + 1, i)))",
"+ return (i + N // i * i) * (N // i) // 2"
] | false | 0.326078 | 1.176076 | 0.277259 | [
"s860026003",
"s927582278"
] |
u145950990 | p03126 | python | s209468549 | s575191853 | 163 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.57 | n,m = list(map(int,input().split()))
flag = [0]*m
for i in range(n):
a = list(map(int,input().split()))
for j in a[1:]:
flag[j-1]+=1
print((sum(x==n for x in flag))) | n,m = list(map(int,input().split()))
x = [0]*(m+1)
for i in range(n):
d = list(map(int,input().split()))
for i in d[1:]:
x[i] += 1
print((x.count(n)))
| 7 | 7 | 179 | 165 | n, m = list(map(int, input().split()))
flag = [0] * m
for i in range(n):
a = list(map(int, input().split()))
for j in a[1:]:
flag[j - 1] += 1
print((sum(x == n for x in flag)))
| n, m = list(map(int, input().split()))
x = [0] * (m + 1)
for i in range(n):
d = list(map(int, input().split()))
for i in d[1:]:
x[i] += 1
print((x.count(n)))
| false | 0 | [
"-flag = [0] * m",
"+x = [0] * (m + 1)",
"- a = list(map(int, input().split()))",
"- for j in a[1:]:",
"- flag[j - 1] += 1",
"-print((sum(x == n for x in flag)))",
"+ d = list(map(int, input().split()))",
"+ for i in d[1:]:",
"+ x[i] += 1",
"+print((x.count(n)))"
] | false | 0.044521 | 0.04428 | 1.005449 | [
"s209468549",
"s575191853"
] |
u562935282 | p03108 | python | s846968283 | s066744349 | 811 | 665 | 92,140 | 24,048 | Accepted | Accepted | 18 | class UnionFind():
def __init__(self, n):
self.parent = [-1 for _ in range(n)]
# 正==子: 根の頂点番号 / 負==根: 連結頂点数
def find(self, x):
if self.parent[x] < 0:
return x
else:
self.parent[x] = self.find(self.parent[x])
return self.parent[x]
... | class UnionFind:
def __init__(self, n):
self.v = [-1] * n
def find(self, x):
if self.v[x] < 0:
return x
else:
self.v[x] = self.find(self.v[x])
return self.v[x]
def unite(self, x, y):
x = self.find(x)
y = self.find(y)
... | 53 | 75 | 1,268 | 1,606 | class UnionFind:
def __init__(self, n):
self.parent = [-1 for _ in range(n)]
# 正==子: 根の頂点番号 / 負==根: 連結頂点数
def find(self, x):
if self.parent[x] < 0:
return x
else:
self.parent[x] = self.find(self.parent[x])
return self.parent[x]
def unite(... | class UnionFind:
def __init__(self, n):
self.v = [-1] * n
def find(self, x):
if self.v[x] < 0:
return x
else:
self.v[x] = self.find(self.v[x])
return self.v[x]
def unite(self, x, y):
x = self.find(x)
y = self.find(y)
if x ... | false | 29.333333 | [
"- self.parent = [-1 for _ in range(n)]",
"- # 正==子: 根の頂点番号 / 負==根: 連結頂点数",
"+ self.v = [-1] * n",
"- if self.parent[x] < 0:",
"+ if self.v[x] < 0:",
"- self.parent[x] = self.find(self.parent[x])",
"- return self.parent[x]",
"+ self.v... | false | 0.035902 | 0.036181 | 0.992274 | [
"s846968283",
"s066744349"
] |
u017624958 | p02819 | python | s004617452 | s751636639 | 403 | 19 | 3,864 | 3,060 | Accepted | Accepted | 95.29 | X = int(eval(input()))
def is_prime_number(number):
is_dividable = lambda divided, divider: divided % divider == 0
result = all([not is_dividable(number, divider) for divider in range(2, number)])
return result
answer = X
while True:
if is_prime_number(answer): break
answer += 1
... | import math
X = int(eval(input()))
def is_prime_number(number):
is_dividable = lambda divided, divider: divided % divider == 0
result = all([not is_dividable(number, divider) for divider in range(2, int(math.sqrt(number)))])
return result
answer = X
while True:
if is_prime_number(ans... | 16 | 18 | 329 | 360 | X = int(eval(input()))
def is_prime_number(number):
is_dividable = lambda divided, divider: divided % divider == 0
result = all([not is_dividable(number, divider) for divider in range(2, number)])
return result
answer = X
while True:
if is_prime_number(answer):
break
answer += 1
print(an... | import math
X = int(eval(input()))
def is_prime_number(number):
is_dividable = lambda divided, divider: divided % divider == 0
result = all(
[
not is_dividable(number, divider)
for divider in range(2, int(math.sqrt(number)))
]
)
return result
answer = X
while... | false | 11.111111 | [
"+import math",
"+",
"- result = all([not is_dividable(number, divider) for divider in range(2, number)])",
"+ result = all(",
"+ [",
"+ not is_dividable(number, divider)",
"+ for divider in range(2, int(math.sqrt(number)))",
"+ ]",
"+ )"
] | false | 0.219187 | 0.037051 | 5.915875 | [
"s004617452",
"s751636639"
] |
u225388820 | p03371 | python | s458119656 | s073357817 | 160 | 17 | 38,256 | 3,064 | Accepted | Accepted | 89.38 | a,b,c,x,y= list(map(int, input().split()))
p=[0]*3
p[0]=a*x+b*y
if x<=y:
p[1]=2*c*y
p[2]=2*c*x+b*(y-x)
elif x>y:
p[1]=2*c*x
p[2]=a*(x-y)+2*c*y
print((min(p)))
| a,b,c,x,y=list(map(int,input().split()))
ans=min(x*a+y*b,2*max(x,y)*c)
if x>=y:
ans=min(ans,2*y*c+(x-y)*a)
else:
ans=min(ans,2*x*c+(y-x)*b)
print(ans) | 10 | 7 | 176 | 158 | a, b, c, x, y = list(map(int, input().split()))
p = [0] * 3
p[0] = a * x + b * y
if x <= y:
p[1] = 2 * c * y
p[2] = 2 * c * x + b * (y - x)
elif x > y:
p[1] = 2 * c * x
p[2] = a * (x - y) + 2 * c * y
print((min(p)))
| a, b, c, x, y = list(map(int, input().split()))
ans = min(x * a + y * b, 2 * max(x, y) * c)
if x >= y:
ans = min(ans, 2 * y * c + (x - y) * a)
else:
ans = min(ans, 2 * x * c + (y - x) * b)
print(ans)
| false | 30 | [
"-p = [0] * 3",
"-p[0] = a * x + b * y",
"-if x <= y:",
"- p[1] = 2 * c * y",
"- p[2] = 2 * c * x + b * (y - x)",
"-elif x > y:",
"- p[1] = 2 * c * x",
"- p[2] = a * (x - y) + 2 * c * y",
"-print((min(p)))",
"+ans = min(x * a + y * b, 2 * max(x, y) * c)",
"+if x >= y:",
"+ ans =... | false | 0.030957 | 0.033481 | 0.924605 | [
"s458119656",
"s073357817"
] |
u901447859 | p02939 | python | s192155184 | s400372151 | 118 | 67 | 3,500 | 3,500 | Accepted | Accepted | 43.22 | s=eval(input())
max_len=0
tmp=""
for i in range(1,min(len(s)+1,3)):
last=s[:i]
cnt=1
for s_ in s[i:]:
tmp+=s_
if tmp != last:
last=tmp
tmp=''
cnt+=1
max_len=max(max_len,cnt)
print(max_len) | s=eval(input())
tmp=""
last=""
cnt=0
for s_ in s:
tmp+=s_
if tmp != last:
last=tmp
tmp=''
cnt+=1
print(cnt) | 17 | 12 | 235 | 130 | s = eval(input())
max_len = 0
tmp = ""
for i in range(1, min(len(s) + 1, 3)):
last = s[:i]
cnt = 1
for s_ in s[i:]:
tmp += s_
if tmp != last:
last = tmp
tmp = ""
cnt += 1
max_len = max(max_len, cnt)
print(max_len)
| s = eval(input())
tmp = ""
last = ""
cnt = 0
for s_ in s:
tmp += s_
if tmp != last:
last = tmp
tmp = ""
cnt += 1
print(cnt)
| false | 29.411765 | [
"-max_len = 0",
"-for i in range(1, min(len(s) + 1, 3)):",
"- last = s[:i]",
"- cnt = 1",
"- for s_ in s[i:]:",
"- tmp += s_",
"- if tmp != last:",
"- last = tmp",
"- tmp = \"\"",
"- cnt += 1",
"- max_len = max(max_len, cnt)",
"-print(... | false | 0.037853 | 0.007093 | 5.336711 | [
"s192155184",
"s400372151"
] |
u255943004 | p02640 | python | s202445358 | s840758542 | 59 | 26 | 61,784 | 9,004 | Accepted | Accepted | 55.93 | X,Y = list(map(int,input().split()))
if Y % 2 == 0 and X * 4 >= Y and X * 2 <= Y:
print("Yes")
else:
print("No")
| X,Y = list(map(int,input().split()))
if Y%2==0 and (X*2 <= Y and X*4 >= Y):
print("Yes")
else:
print("No") | 5 | 5 | 119 | 108 | X, Y = list(map(int, input().split()))
if Y % 2 == 0 and X * 4 >= Y and X * 2 <= Y:
print("Yes")
else:
print("No")
| X, Y = list(map(int, input().split()))
if Y % 2 == 0 and (X * 2 <= Y and X * 4 >= Y):
print("Yes")
else:
print("No")
| false | 0 | [
"-if Y % 2 == 0 and X * 4 >= Y and X * 2 <= Y:",
"+if Y % 2 == 0 and (X * 2 <= Y and X * 4 >= Y):"
] | false | 0.037276 | 0.036208 | 1.029519 | [
"s202445358",
"s840758542"
] |
u186838327 | p03127 | python | s312907044 | s805254145 | 328 | 102 | 81,684 | 85,184 | Accepted | Accepted | 68.9 | n = int(eval(input()))
A = list(map(int, input().split()))
import fractions
#import math
from functools import reduce
def gcd(*numbers):
return reduce(fractions.gcd, numbers)
#return reduce(math.gcd, numbers)
def gcd_list(numbers):
return reduce(fractions.gcd, numbers)
#return reduce(mat... | n = int(eval(input()))
A = list(map(int, input().split()))
#import fractions
import math
from functools import reduce
def gcd(*numbers):
#return reduce(fractions.gcd, numbers)
return reduce(math.gcd, numbers)
def gcd_list(numbers):
#return reduce(fractions.gcd, numbers)
return reduce(mat... | 17 | 16 | 359 | 352 | n = int(eval(input()))
A = list(map(int, input().split()))
import fractions
# import math
from functools import reduce
def gcd(*numbers):
return reduce(fractions.gcd, numbers)
# return reduce(math.gcd, numbers)
def gcd_list(numbers):
return reduce(fractions.gcd, numbers)
# return reduce(math.gcd, n... | n = int(eval(input()))
A = list(map(int, input().split()))
# import fractions
import math
from functools import reduce
def gcd(*numbers):
# return reduce(fractions.gcd, numbers)
return reduce(math.gcd, numbers)
def gcd_list(numbers):
# return reduce(fractions.gcd, numbers)
return reduce(math.gcd, nu... | false | 5.882353 | [
"-import fractions",
"-",
"-# import math",
"+# import fractions",
"+import math",
"- return reduce(fractions.gcd, numbers)",
"- # return reduce(math.gcd, numbers)",
"+ # return reduce(fractions.gcd, numbers)",
"+ return reduce(math.gcd, numbers)",
"- return reduce(fractions.gcd, nu... | false | 0.087488 | 0.007814 | 11.196206 | [
"s312907044",
"s805254145"
] |
u905329882 | p02614 | python | s790719050 | s681542628 | 155 | 91 | 9,364 | 68,188 | Accepted | Accepted | 41.29 | import itertools
import copy
h,w,k = list(map(int,input().split()))
c = []
for i in range(h):
c.append(list(eval(input())))
lish = [-1]
lisw = [-1]
num = [i for i in range(1,h+1)]
numw = [i for i in range(1,w+1)]
numm = [[i] for i in range(1,h+1)]
numww = [[i] for i in range(1,w+1)]
lish.extend(numm)
... | h,w,k = list(map(int,input().split()))
c = []
for i in range(h):
c.append(list(eval(input())))
ans = 0
for i in range(2**h-1):
for j in range(2**w-1):
num = 0
for ii in range(h):
for jj in range(w):
if i&1<<ii==0 and j&1<<jj==0:
if c[ii... | 41 | 19 | 1,017 | 437 | import itertools
import copy
h, w, k = list(map(int, input().split()))
c = []
for i in range(h):
c.append(list(eval(input())))
lish = [-1]
lisw = [-1]
num = [i for i in range(1, h + 1)]
numw = [i for i in range(1, w + 1)]
numm = [[i] for i in range(1, h + 1)]
numww = [[i] for i in range(1, w + 1)]
lish.extend(numm... | h, w, k = list(map(int, input().split()))
c = []
for i in range(h):
c.append(list(eval(input())))
ans = 0
for i in range(2**h - 1):
for j in range(2**w - 1):
num = 0
for ii in range(h):
for jj in range(w):
if i & 1 << ii == 0 and j & 1 << jj == 0:
... | false | 53.658537 | [
"-import itertools",
"-import copy",
"-",
"-lish = [-1]",
"-lisw = [-1]",
"-num = [i for i in range(1, h + 1)]",
"-numw = [i for i in range(1, w + 1)]",
"-numm = [[i] for i in range(1, h + 1)]",
"-numww = [[i] for i in range(1, w + 1)]",
"-lish.extend(numm)",
"-lisw.extend(numww)",
"-for i in ... | false | 0.085587 | 0.036401 | 2.351195 | [
"s790719050",
"s681542628"
] |
u879870653 | p03007 | python | s539150502 | s458374495 | 1,841 | 300 | 22,652 | 23,336 | Accepted | Accepted | 83.7 | import bisect
N = int(eval(input()))
A = list(map(int,input().split()))
ans = []
A = sorted(A)
if N == 2 :
ans.append([A[1],A[0]])
calc = A[1] - A[0]
else :
ind = bisect.bisect_left(A,0)
X = A[:ind]
Y = A[ind:]
if len(X) == 0 :
ans.append([Y[0],Y[1]])
... | N = int(eval(input()))
A = list(map(int,input().split()))
A = sorted(A,reverse=True)
Y, X = [A[0]], [A[-1]]
for i in range(1, N-1):
if A[i] >= 0:
Y.append(A[i])
else:
X.append(A[i])
res = []
for i in range(len(Y)-1,0,-1) :
res.append([X[-1],Y[i]])
X[-1] -= Y[i]
for i in ... | 40 | 22 | 702 | 431 | import bisect
N = int(eval(input()))
A = list(map(int, input().split()))
ans = []
A = sorted(A)
if N == 2:
ans.append([A[1], A[0]])
calc = A[1] - A[0]
else:
ind = bisect.bisect_left(A, 0)
X = A[:ind]
Y = A[ind:]
if len(X) == 0:
ans.append([Y[0], Y[1]])
X.append(Y.pop(0) - Y.pop(... | N = int(eval(input()))
A = list(map(int, input().split()))
A = sorted(A, reverse=True)
Y, X = [A[0]], [A[-1]]
for i in range(1, N - 1):
if A[i] >= 0:
Y.append(A[i])
else:
X.append(A[i])
res = []
for i in range(len(Y) - 1, 0, -1):
res.append([X[-1], Y[i]])
X[-1] -= Y[i]
for i in range(len... | false | 45 | [
"-import bisect",
"-",
"-ans = []",
"-A = sorted(A)",
"-if N == 2:",
"- ans.append([A[1], A[0]])",
"- calc = A[1] - A[0]",
"-else:",
"- ind = bisect.bisect_left(A, 0)",
"- X = A[:ind]",
"- Y = A[ind:]",
"- if len(X) == 0:",
"- ans.append([Y[0], Y[1]])",
"- X... | false | 0.038015 | 0.061211 | 0.621049 | [
"s539150502",
"s458374495"
] |
u761320129 | p02885 | python | s553330502 | s886684981 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | A,B = list(map(int,input().split()))
x = A-B-B
print((max(0,x))) | A,B = list(map(int,input().split()))
print((max(0, A-B-B))) | 3 | 2 | 58 | 52 | A, B = list(map(int, input().split()))
x = A - B - B
print((max(0, x)))
| A, B = list(map(int, input().split()))
print((max(0, A - B - B)))
| false | 33.333333 | [
"-x = A - B - B",
"-print((max(0, x)))",
"+print((max(0, A - B - B)))"
] | false | 0.048192 | 0.048192 | 0.999999 | [
"s553330502",
"s886684981"
] |
u312025627 | p03212 | python | s254787116 | s536012777 | 90 | 67 | 2,940 | 8,892 | Accepted | Accepted | 25.56 | def main():
N = int(eval(input()))
def recur(s):
if int(s) > N:
return 0
ret = 1 if all(s.count(c) for c in '753') else 0
for c in '753':
ret += recur(s + c)
return ret
print((recur('0')))
if __name__ == '__main__':
main()
| def main():
N = int(input())
N_len = len(str(N))
if N_len < 3:
return print(0)
from itertools import product
ans_set = set()
for k in range(3, N_len+1):
ans_set = ans_set.union({s for s in product("753", repeat=k)
if int("".join(s)) <= N ... | 15 | 16 | 304 | 459 | def main():
N = int(eval(input()))
def recur(s):
if int(s) > N:
return 0
ret = 1 if all(s.count(c) for c in "753") else 0
for c in "753":
ret += recur(s + c)
return ret
print((recur("0")))
if __name__ == "__main__":
main()
| def main():
N = int(input())
N_len = len(str(N))
if N_len < 3:
return print(0)
from itertools import product
ans_set = set()
for k in range(3, N_len + 1):
ans_set = ans_set.union(
{
s
for s in product("753", repeat=k)
i... | false | 6.25 | [
"- N = int(eval(input()))",
"+ N = int(input())",
"+ N_len = len(str(N))",
"+ if N_len < 3:",
"+ return print(0)",
"+ from itertools import product",
"- def recur(s):",
"- if int(s) > N:",
"- return 0",
"- ret = 1 if all(s.count(c) for c in \"753\"... | false | 0.051415 | 0.048433 | 1.061555 | [
"s254787116",
"s536012777"
] |
u015593272 | p02659 | python | s124759991 | s463013461 | 27 | 24 | 10,052 | 9,064 | Accepted | Accepted | 11.11 | from decimal import *
A, B = list(map(Decimal, input().split()))
ans = int(A * B)
print(ans) | A, B = list(map(float, input().split()))
aa = int(A)
b_100 = int(round(100 * B))
seki = aa * b_100
ans = seki // 100
# ans=math.floor(aa*b_100/100)
# ab = Decimal(A) * Decimal(B)
# ans = math.floor(ab)
print(ans) | 5 | 13 | 91 | 222 | from decimal import *
A, B = list(map(Decimal, input().split()))
ans = int(A * B)
print(ans)
| A, B = list(map(float, input().split()))
aa = int(A)
b_100 = int(round(100 * B))
seki = aa * b_100
ans = seki // 100
# ans=math.floor(aa*b_100/100)
# ab = Decimal(A) * Decimal(B)
# ans = math.floor(ab)
print(ans)
| false | 61.538462 | [
"-from decimal import *",
"-",
"-A, B = list(map(Decimal, input().split()))",
"-ans = int(A * B)",
"+A, B = list(map(float, input().split()))",
"+aa = int(A)",
"+b_100 = int(round(100 * B))",
"+seki = aa * b_100",
"+ans = seki // 100",
"+# ans=math.floor(aa*b_100/100)",
"+# ab = Decimal(A) * Dec... | false | 0.036623 | 0.036717 | 0.997431 | [
"s124759991",
"s463013461"
] |
u962356464 | p02952 | python | s425297938 | s918584603 | 62 | 47 | 2,940 | 2,940 | Accepted | Accepted | 24.19 | N = int(eval(input()))
odd_num = 0
for i in range (1,N+1):
if len(str(i))%2==1:
odd_num += 1
print(odd_num) | N = int(eval(input()))
count = 0
for i in range(1, N + 1):
if 1<=i <=9 or 100<=i <= 999 or 10000<= i <= 99999:
count += 1
else:
count +=0
print(count) | 6 | 9 | 118 | 181 | N = int(eval(input()))
odd_num = 0
for i in range(1, N + 1):
if len(str(i)) % 2 == 1:
odd_num += 1
print(odd_num)
| N = int(eval(input()))
count = 0
for i in range(1, N + 1):
if 1 <= i <= 9 or 100 <= i <= 999 or 10000 <= i <= 99999:
count += 1
else:
count += 0
print(count)
| false | 33.333333 | [
"-odd_num = 0",
"+count = 0",
"- if len(str(i)) % 2 == 1:",
"- odd_num += 1",
"-print(odd_num)",
"+ if 1 <= i <= 9 or 100 <= i <= 999 or 10000 <= i <= 99999:",
"+ count += 1",
"+ else:",
"+ count += 0",
"+print(count)"
] | false | 0.043512 | 0.041088 | 1.059006 | [
"s425297938",
"s918584603"
] |
u761320129 | p03346 | python | s321521878 | s639846871 | 426 | 381 | 20,520 | 37,616 | Accepted | Accepted | 10.56 | N = int(eval(input()))
src = [int(eval(input()))-1 for i in range(N)]
ids = [None] * N
for i,a in enumerate(src):
ids[a] = i
longest = seq = 1
for i1,i2 in zip(ids, ids[1:]):
if i1 < i2:
seq += 1
else:
longest = max(longest, seq)
seq = 1
longest = max(longest, seq)
pri... | N = int(eval(input()))
P = [int(eval(input())) for i in range(N)]
D = {p:i for i,p in enumerate(P)}
pv = N
l = seq = 0
for n in range(1,N+1):
nx = D[n]
if pv < nx:
seq += 1
else:
l = max(l,seq)
seq = 1
pv = nx
l = max(l, seq)
print((N - l)) | 15 | 17 | 324 | 284 | N = int(eval(input()))
src = [int(eval(input())) - 1 for i in range(N)]
ids = [None] * N
for i, a in enumerate(src):
ids[a] = i
longest = seq = 1
for i1, i2 in zip(ids, ids[1:]):
if i1 < i2:
seq += 1
else:
longest = max(longest, seq)
seq = 1
longest = max(longest, seq)
print((N - lon... | N = int(eval(input()))
P = [int(eval(input())) for i in range(N)]
D = {p: i for i, p in enumerate(P)}
pv = N
l = seq = 0
for n in range(1, N + 1):
nx = D[n]
if pv < nx:
seq += 1
else:
l = max(l, seq)
seq = 1
pv = nx
l = max(l, seq)
print((N - l))
| false | 11.764706 | [
"-src = [int(eval(input())) - 1 for i in range(N)]",
"-ids = [None] * N",
"-for i, a in enumerate(src):",
"- ids[a] = i",
"-longest = seq = 1",
"-for i1, i2 in zip(ids, ids[1:]):",
"- if i1 < i2:",
"+P = [int(eval(input())) for i in range(N)]",
"+D = {p: i for i, p in enumerate(P)}",
"+pv = ... | false | 0.045948 | 0.046068 | 0.997399 | [
"s321521878",
"s639846871"
] |
u671060652 | p02951 | python | s752065053 | s890154613 | 173 | 119 | 38,384 | 72,776 | Accepted | Accepted | 31.21 | a, b, c = list(map(int, input().split()))
print((max(0, -(a-b-c)))) | import itertools
import math
import fractions
import functools
a, b, c = list(map(int, input().split()))
if a-b > c:
print((0))
else:
print((c-a+b)) | 2 | 9 | 60 | 154 | a, b, c = list(map(int, input().split()))
print((max(0, -(a - b - c))))
| import itertools
import math
import fractions
import functools
a, b, c = list(map(int, input().split()))
if a - b > c:
print((0))
else:
print((c - a + b))
| false | 77.777778 | [
"+import itertools",
"+import math",
"+import fractions",
"+import functools",
"+",
"-print((max(0, -(a - b - c))))",
"+if a - b > c:",
"+ print((0))",
"+else:",
"+ print((c - a + b))"
] | false | 0.036276 | 0.035453 | 1.023234 | [
"s752065053",
"s890154613"
] |
u296518383 | p02821 | python | s545600169 | s846832743 | 1,046 | 343 | 59,392 | 60,456 | Accepted | Accepted | 67.21 | from bisect import bisect_left
from itertools import accumulate
N, M = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
Acum = [0] + list(accumulate(A))
left = 0
right = max(A) * 2 + 1
while left + 1 < right:
mid = (left + right) // 2
tmp = 0
for i in range(N):
bi... | from itertools import accumulate
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort(reverse = True)
#print(A)
ok = -1
ng = 10 ** 11
while abs(ok - ng) > 1:
mid = (ok + ng) // 2
left, right = 0, N - 1
cnt = 0
while left <= N - 1 and right >= 0:
if ... | 30 | 48 | 603 | 997 | from bisect import bisect_left
from itertools import accumulate
N, M = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
Acum = [0] + list(accumulate(A))
left = 0
right = max(A) * 2 + 1
while left + 1 < right:
mid = (left + right) // 2
tmp = 0
for i in range(N):
bi = bisec... | from itertools import accumulate
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort(reverse=True)
# print(A)
ok = -1
ng = 10**11
while abs(ok - ng) > 1:
mid = (ok + ng) // 2
left, right = 0, N - 1
cnt = 0
while left <= N - 1 and right >= 0:
if A[left] + A[right] >... | false | 37.5 | [
"-from bisect import bisect_left",
"-A = sorted(list(map(int, input().split())))",
"+A = list(map(int, input().split()))",
"+A.sort(reverse=True)",
"+# print(A)",
"+ok = -1",
"+ng = 10**11",
"+while abs(ok - ng) > 1:",
"+ mid = (ok + ng) // 2",
"+ left, right = 0, N - 1",
"+ cnt = 0",
... | false | 0.041236 | 0.036391 | 1.133141 | [
"s545600169",
"s846832743"
] |
u852690916 | p02741 | python | s957712367 | s932618127 | 185 | 163 | 38,384 | 38,384 | Accepted | Accepted | 11.89 | K = int(eval(input()))
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print((l[K-1])) | l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(eval(input()))
print((l[K-1])) | 3 | 3 | 136 | 136 | K = int(eval(input()))
l = [
1,
1,
1,
2,
1,
2,
1,
5,
2,
2,
1,
5,
1,
2,
1,
14,
1,
5,
1,
5,
2,
2,
1,
15,
2,
2,
5,
4,
1,
4,
1,
51,
]
print((l[K - 1]))
| l = [
1,
1,
1,
2,
1,
2,
1,
5,
2,
2,
1,
5,
1,
2,
1,
14,
1,
5,
1,
5,
2,
2,
1,
15,
2,
2,
5,
4,
1,
4,
1,
51,
]
K = int(eval(input()))
print((l[K - 1]))
| false | 0 | [
"-K = int(eval(input()))",
"+K = int(eval(input()))"
] | false | 0.0648 | 0.133345 | 0.485961 | [
"s957712367",
"s932618127"
] |
u790710233 | p03634 | python | s774914230 | s682557398 | 817 | 703 | 46,268 | 131,772 | Accepted | Accepted | 13.95 | import sys
import heapq
input = sys.stdin.readline
n = int(eval(input()))
edges = [[]for _ in range(n)]
for _ in range(n-1):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
edges[a].append((c, b))
edges[b].append((c, a))
INF = float('inf')
def dijkstra(init_v):
dist = [I... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
n = int(eval(input()))
edges = [[]for _ in range(n)]
for _ in range(n-1):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
edges[a].append((c, b))
edges[b].append((c, a))
INF = float('inf')
def dfs(v, parent, d... | 35 | 28 | 829 | 621 | import sys
import heapq
input = sys.stdin.readline
n = int(eval(input()))
edges = [[] for _ in range(n)]
for _ in range(n - 1):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
edges[a].append((c, b))
edges[b].append((c, a))
INF = float("inf")
def dijkstra(init_v):
dist = [INF] * n
... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
n = int(eval(input()))
edges = [[] for _ in range(n)]
for _ in range(n - 1):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
edges[a].append((c, b))
edges[b].append((c, a))
INF = float("inf")
def dfs(v, parent, distance):
... | false | 20 | [
"-import heapq",
"+sys.setrecursionlimit(10**7)",
"-def dijkstra(init_v):",
"- dist = [INF] * n",
"- dist[init_v] = 0",
"- tasks = [(0, init_v)]",
"- while tasks:",
"- d, v = heapq.heappop(tasks)",
"- if dist[v] < d:",
"+def dfs(v, parent, distance):",
"+ dist[v] = d... | false | 0.040917 | 0.0425 | 0.962745 | [
"s774914230",
"s682557398"
] |
u644907318 | p02882 | python | s396314397 | s932980084 | 163 | 73 | 38,640 | 62,436 | Accepted | Accepted | 55.21 | import math
a,b,x = list(map(int,input().split()))
if x>a**2*b/2:
k = math.degrees(math.atan((2*a**2*b-2*x)/a**3))
else:
k = math.degrees(math.asin(b/(4*x**2/a**2/b**2+b**2)**0.5))
print(k) | import math
a,b,x = list(map(int,input().split()))
if x<=(a**2*b)/2:
deg = math.degrees(math.atan((a*b**2)/(2*x)))
else:
deg = math.degrees(math.atan(2*(b*a**2-x)/a**3))
print(deg) | 7 | 7 | 197 | 188 | import math
a, b, x = list(map(int, input().split()))
if x > a**2 * b / 2:
k = math.degrees(math.atan((2 * a**2 * b - 2 * x) / a**3))
else:
k = math.degrees(math.asin(b / (4 * x**2 / a**2 / b**2 + b**2) ** 0.5))
print(k)
| import math
a, b, x = list(map(int, input().split()))
if x <= (a**2 * b) / 2:
deg = math.degrees(math.atan((a * b**2) / (2 * x)))
else:
deg = math.degrees(math.atan(2 * (b * a**2 - x) / a**3))
print(deg)
| false | 0 | [
"-if x > a**2 * b / 2:",
"- k = math.degrees(math.atan((2 * a**2 * b - 2 * x) / a**3))",
"+if x <= (a**2 * b) / 2:",
"+ deg = math.degrees(math.atan((a * b**2) / (2 * x)))",
"- k = math.degrees(math.asin(b / (4 * x**2 / a**2 / b**2 + b**2) ** 0.5))",
"-print(k)",
"+ deg = math.degrees(math.a... | false | 0.034703 | 0.035247 | 0.984579 | [
"s396314397",
"s932980084"
] |
u477977638 | p02990 | python | s990991698 | s354578662 | 450 | 34 | 3,316 | 3,700 | Accepted | Accepted | 92.44 | import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines
# rstrip().decode('utf-8')
# INF=float("inf")
MOD=10**9+7
# sys.setrecursionlimit(2147483647)
# import math
#import numpy as np
# import operator
# import bisect
# from heapq import heapify,he... | import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines
# rstrip().decode('utf-8')
# INF=float("inf")
MOD=10**9+7
# sys.setrecursionlimit(2147483647)
# import math
#import numpy as np
# import operator
# import bisect
# from heapq import heapify,he... | 67 | 54 | 1,508 | 1,294 | import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines
# rstrip().decode('utf-8')
# INF=float("inf")
MOD = 10**9 + 7
# sys.setrecursionlimit(2147483647)
# import math
# import numpy as np
# import operator
# import bisect
# from heapq import heapify,heappop,heappu... | import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines
# rstrip().decode('utf-8')
# INF=float("inf")
MOD = 10**9 + 7
# sys.setrecursionlimit(2147483647)
# import math
# import numpy as np
# import operator
# import bisect
# from heapq import heapify,heappop,heappu... | false | 19.402985 | [
"-def framod(n, mod, a=1):",
"- for i in range(1, n + 1):",
"- a = a * i % mod",
"- return a",
"+mod = 10**9 + 7",
"+f = [1]",
"+for i in range(1, 10000):",
"+ f.append(f[-1] * i % mod)",
"-def power(n, r, mod):",
"- if r == 0:",
"- return 1",
"- if r % 2 == 0:",
... | false | 0.043258 | 0.040266 | 1.074319 | [
"s990991698",
"s354578662"
] |
u670567845 | p03331 | python | s674236528 | s070183021 | 224 | 146 | 3,060 | 9,048 | Accepted | Accepted | 34.82 | def digitsum(n):
s = str(n)
array = list(map(int, list(s)))
return sum(array)
N = int(eval(input()))
summin = 10**5
for i in range(1,int(N/2)+1) :
A = i
B = N - i
sumab = digitsum(A) + digitsum(B)
if (summin > sumab) :
summin = sumab
print(summin) | N = int(eval(input()))
ans = float('inf')
for i in range(N//2):
A = i+1
B = N-A
ans = min(ans, sum(list(map(int,str(A)))) + sum(list(map(int,str(B))) ))
print(ans) | 16 | 8 | 278 | 171 | def digitsum(n):
s = str(n)
array = list(map(int, list(s)))
return sum(array)
N = int(eval(input()))
summin = 10**5
for i in range(1, int(N / 2) + 1):
A = i
B = N - i
sumab = digitsum(A) + digitsum(B)
if summin > sumab:
summin = sumab
print(summin)
| N = int(eval(input()))
ans = float("inf")
for i in range(N // 2):
A = i + 1
B = N - A
ans = min(ans, sum(list(map(int, str(A)))) + sum(list(map(int, str(B)))))
print(ans)
| false | 50 | [
"-def digitsum(n):",
"- s = str(n)",
"- array = list(map(int, list(s)))",
"- return sum(array)",
"-",
"-",
"-summin = 10**5",
"-for i in range(1, int(N / 2) + 1):",
"- A = i",
"- B = N - i",
"- sumab = digitsum(A) + digitsum(B)",
"- if summin > sumab:",
"- summin ... | false | 0.16792 | 0.250604 | 0.670062 | [
"s674236528",
"s070183021"
] |
u464205401 | p03262 | python | s107616052 | s634202030 | 143 | 95 | 16,240 | 16,284 | Accepted | Accepted | 33.57 | import fractions
n,x=list(map(int,input().split()))
X=list(map(int,input().split()))
X.append(x)
X=sorted(X)
Y=[X[i+1]-X[i] for i in range(n)]
if n==1:
print((max(X)-min(X)))
else:
gcd=fractions.gcd(Y[0],Y[1])
for i in range(2,n):
gcd=fractions.gcd(gcd,Y[i])
print(gcd) | from fractions import gcd
from functools import reduce
n,x=list(map(int,input().split()))
X=list(map(int,input().split()))
Y=[abs(X[i]-x) for i in range(n)]
print((reduce(gcd,Y))) | 16 | 6 | 299 | 182 | import fractions
n, x = list(map(int, input().split()))
X = list(map(int, input().split()))
X.append(x)
X = sorted(X)
Y = [X[i + 1] - X[i] for i in range(n)]
if n == 1:
print((max(X) - min(X)))
else:
gcd = fractions.gcd(Y[0], Y[1])
for i in range(2, n):
gcd = fractions.gcd(gcd, Y[i])
print(gcd)... | from fractions import gcd
from functools import reduce
n, x = list(map(int, input().split()))
X = list(map(int, input().split()))
Y = [abs(X[i] - x) for i in range(n)]
print((reduce(gcd, Y)))
| false | 62.5 | [
"-import fractions",
"+from fractions import gcd",
"+from functools import reduce",
"-X.append(x)",
"-X = sorted(X)",
"-Y = [X[i + 1] - X[i] for i in range(n)]",
"-if n == 1:",
"- print((max(X) - min(X)))",
"-else:",
"- gcd = fractions.gcd(Y[0], Y[1])",
"- for i in range(2, n):",
"- ... | false | 0.044579 | 0.098495 | 0.452602 | [
"s107616052",
"s634202030"
] |
u883040023 | p02689 | python | s204340168 | s768569505 | 931 | 423 | 115,320 | 29,364 | Accepted | Accepted | 54.56 | n,m = list(map(int,input().split()))
H = list(map(int,input().split()))
AB = []
ans = 0
for i in range(m):
a,b = list(map(int,input().split()))
ai = a-1
bi = b-1
AB.append([ai,bi])
AB.append([bi,ai])
AB = sorted(AB)
import collections
que = collections.deque()
for i in AB:
... | n,m = list(map(int,input().split()))
H = list(map(int,input().split()))
edge = [[] for _ in range(n)]
for _ in range(m):
a,b = list(map(int,input().split()))
a -= 1
b -= 1
edge[a].append(b)
edge[b].append(a)
ans = 0
for i in range(n):
x = edge[i]
if len(x) == 0:
... | 41 | 29 | 710 | 500 | n, m = list(map(int, input().split()))
H = list(map(int, input().split()))
AB = []
ans = 0
for i in range(m):
a, b = list(map(int, input().split()))
ai = a - 1
bi = b - 1
AB.append([ai, bi])
AB.append([bi, ai])
AB = sorted(AB)
import collections
que = collections.deque()
for i in AB:
que.append... | n, m = list(map(int, input().split()))
H = list(map(int, input().split()))
edge = [[] for _ in range(n)]
for _ in range(m):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
edge[a].append(b)
edge[b].append(a)
ans = 0
for i in range(n):
x = edge[i]
if len(x) == 0:
ans += 1
... | false | 29.268293 | [
"-AB = []",
"+edge = [[] for _ in range(n)]",
"+for _ in range(m):",
"+ a, b = list(map(int, input().split()))",
"+ a -= 1",
"+ b -= 1",
"+ edge[a].append(b)",
"+ edge[b].append(a)",
"-for i in range(m):",
"- a, b = list(map(int, input().split()))",
"- ai = a - 1",
"- b... | false | 0.049306 | 0.035689 | 1.381558 | [
"s204340168",
"s768569505"
] |
u506287026 | p03645 | python | s224293764 | s498192434 | 989 | 902 | 70,920 | 74,256 | Accepted | Accepted | 8.8 | from collections import defaultdict
d = defaultdict(list)
n, m = list(map(int, input().split()))
for _ in range(m):
a, b = list(map(int, input().split()))
d[a].append(b)
# アクセスを高速にするためにsetに変換
for a in list(d.keys()):
d[a] = set(d[a])
def solve(n, d):
for a in d[1]:
if n in d[a]:... | from collections import defaultdict
d = defaultdict(set)
n, m = list(map(int, input().split()))
for _ in range(m):
a, b = list(map(int, input().split()))
d[a].add(b)
def solve(n, d):
for a in d[1]:
if n in d[a]:
return 'POSSIBLE'
return 'IMPOSSIBLE'
print((solve(n,... | 20 | 16 | 383 | 312 | from collections import defaultdict
d = defaultdict(list)
n, m = list(map(int, input().split()))
for _ in range(m):
a, b = list(map(int, input().split()))
d[a].append(b)
# アクセスを高速にするためにsetに変換
for a in list(d.keys()):
d[a] = set(d[a])
def solve(n, d):
for a in d[1]:
if n in d[a]:
r... | from collections import defaultdict
d = defaultdict(set)
n, m = list(map(int, input().split()))
for _ in range(m):
a, b = list(map(int, input().split()))
d[a].add(b)
def solve(n, d):
for a in d[1]:
if n in d[a]:
return "POSSIBLE"
return "IMPOSSIBLE"
print((solve(n, d)))
| false | 20 | [
"-d = defaultdict(list)",
"+d = defaultdict(set)",
"- d[a].append(b)",
"-# アクセスを高速にするためにsetに変換",
"-for a in list(d.keys()):",
"- d[a] = set(d[a])",
"+ d[a].add(b)"
] | false | 0.039213 | 0.075453 | 0.519701 | [
"s224293764",
"s498192434"
] |
u487861672 | p02243 | python | s562323132 | s958503111 | 1,270 | 580 | 69,140 | 68,620 | Accepted | Accepted | 54.33 | from sys import maxsize
from heapq import heappop, heappush
class Node:
WHITE = 0
GRAY = 1
BLACK = 2
def __init__(self):
self.adjs = []
self.color = Node.WHITE
self.dist = maxsize
def __lt__(self, other):
return self.dist < other.dist
def __r... | from sys import maxsize
from heapq import heappop, heappush
class Node:
WHITE = 0
GRAY = 1
BLACK = 2
def __init__(self):
self.adjs = []
self.color = Node.WHITE
self.dist = maxsize
def __lt__(self, other):
return self.dist < other.dist
def __r... | 68 | 70 | 1,490 | 1,564 | from sys import maxsize
from heapq import heappop, heappush
class Node:
WHITE = 0
GRAY = 1
BLACK = 2
def __init__(self):
self.adjs = []
self.color = Node.WHITE
self.dist = maxsize
def __lt__(self, other):
return self.dist < other.dist
def __repr__(self):
... | from sys import maxsize
from heapq import heappop, heappush
class Node:
WHITE = 0
GRAY = 1
BLACK = 2
def __init__(self):
self.adjs = []
self.color = Node.WHITE
self.dist = maxsize
def __lt__(self, other):
return self.dist < other.dist
def __repr__(self):
... | false | 2.857143 | [
"- min_node, min_dist = heappop(h)",
"+ min_dist, min_node = heappop(h)",
"+ nodes[min_node].color = Node.BLACK",
"- nodes[min_node].color = Node.BLACK",
"+ if nodes[adj].color == Node.BLACK:",
"+ continue",
"- heappush(h, (adj, nodes[... | false | 0.042891 | 0.040138 | 1.068575 | [
"s562323132",
"s958503111"
] |
u075012704 | p02804 | python | s780292924 | s497040204 | 593 | 278 | 16,144 | 25,736 | Accepted | Accepted | 53.12 | N, K = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
MOD = 10 ** 9 + 7
# 階乗 & 逆元計算
factorial = [1]
inverse = [1]
for i in range(1, N+2):
factorial.append(factorial[-1] * i % MOD)
inverse.append(pow(factorial[-1], MOD - 2, MOD))
# 組み合わせ計算
def nCr(n, r):
if n <... | N, K = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
MOD = 10 ** 9 + 7
factorial = [1, 1]
inverse = [1, 1]
invere_base = [0, 1]
for i in range(2, N + 2):
factorial.append((factorial[-1] * i) % MOD)
invere_base.append((-invere_base[MOD % i] * (MOD // i)) % MOD)
inve... | 33 | 28 | 672 | 664 | N, K = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
MOD = 10**9 + 7
# 階乗 & 逆元計算
factorial = [1]
inverse = [1]
for i in range(1, N + 2):
factorial.append(factorial[-1] * i % MOD)
inverse.append(pow(factorial[-1], MOD - 2, MOD))
# 組み合わせ計算
def nCr(n, r):
if n < r or r < 0:
... | N, K = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
MOD = 10**9 + 7
factorial = [1, 1]
inverse = [1, 1]
invere_base = [0, 1]
for i in range(2, N + 2):
factorial.append((factorial[-1] * i) % MOD)
invere_base.append((-invere_base[MOD % i] * (MOD // i)) % MOD)
inverse.append((inv... | false | 15.151515 | [
"-# 階乗 & 逆元計算",
"-factorial = [1]",
"-inverse = [1]",
"-for i in range(1, N + 2):",
"- factorial.append(factorial[-1] * i % MOD)",
"- inverse.append(pow(factorial[-1], MOD - 2, MOD))",
"-# 組み合わせ計算",
"+factorial = [1, 1]",
"+inverse = [1, 1]",
"+invere_base = [0, 1]",
"+for i in range(2, N ... | false | 0.04823 | 0.039586 | 1.218357 | [
"s780292924",
"s497040204"
] |
u340781749 | p02589 | python | s133004452 | s381660676 | 2,235 | 2,066 | 318,800 | 310,404 | Accepted | Accepted | 7.56 | from collections import Counter
n = int(eval(input()))
sss = [eval(input()) for _ in range(n)]
d = {s[1:]: 0 for s in sss}
flags = [1 << (i * 18) for i in range(26)]
trie_chr = [-1]
trie_children = [{}]
trie_counter = [0]
trie_fin = [0]
s_fin_node = []
l = 1
for s in sss:
node = 0
trie_counte... | from collections import Counter
from string import ascii_lowercase
n = int(eval(input()))
sss = [eval(input()) for _ in range(n)]
flags = {c: 1 << (ord(c) - 97) for c in ascii_lowercase}
trie_chr = [-1]
trie_children = [{}]
trie_counter = [0]
trie_fin = [0]
l = 1
for s in sss:
node = 0
trie_co... | 72 | 55 | 1,736 | 1,361 | from collections import Counter
n = int(eval(input()))
sss = [eval(input()) for _ in range(n)]
d = {s[1:]: 0 for s in sss}
flags = [1 << (i * 18) for i in range(26)]
trie_chr = [-1]
trie_children = [{}]
trie_counter = [0]
trie_fin = [0]
s_fin_node = []
l = 1
for s in sss:
node = 0
trie_counter[node] += 1
f... | from collections import Counter
from string import ascii_lowercase
n = int(eval(input()))
sss = [eval(input()) for _ in range(n)]
flags = {c: 1 << (ord(c) - 97) for c in ascii_lowercase}
trie_chr = [-1]
trie_children = [{}]
trie_counter = [0]
trie_fin = [0]
l = 1
for s in sss:
node = 0
trie_counter[node] += 1
... | false | 23.611111 | [
"+from string import ascii_lowercase",
"-d = {s[1:]: 0 for s in sss}",
"-flags = [1 << (i * 18) for i in range(26)]",
"+flags = {c: 1 << (ord(c) - 97) for c in ascii_lowercase}",
"-s_fin_node = []",
"- trie_fin[node] += 1",
"- s_fin_node.append(node)",
"-trie_flags = [0] * l",
"+ trie_fin[n... | false | 0.042592 | 0.052362 | 0.813416 | [
"s133004452",
"s381660676"
] |
u604774382 | p02414 | python | s047138676 | s018006981 | 480 | 230 | 9,392 | 5,000 | Accepted | Accepted | 52.08 | import sys
n, m, l = [ int( val ) for val in sys.stdin.readline().split( " " ) ]
matrixA = [ [ int( val ) for val in sys.stdin.readline().split( " " ) ] for row in range( n ) ]
matrixB = [ [ int( val ) for val in sys.stdin.readline().split( " " ) ] for row in range( m ) ]
c = 0
output = []
for i in range( ... | import sys
n, m, l = [ int( val ) for val in sys.stdin.readline().split( " " ) ]
matrixA = [ [ int( val ) for val in sys.stdin.readline().split( " " ) ] for row in range( n ) ]
matrixB = [ [ int( val ) for val in sys.stdin.readline().split( " " ) ] for row in range( m ) ]
matrixC = [ [ sum( matrixA[i][k] * mat... | 21 | 10 | 569 | 468 | import sys
n, m, l = [int(val) for val in sys.stdin.readline().split(" ")]
matrixA = [[int(val) for val in sys.stdin.readline().split(" ")] for row in range(n)]
matrixB = [[int(val) for val in sys.stdin.readline().split(" ")] for row in range(m)]
c = 0
output = []
for i in range(n):
for j in range(l):
c = ... | import sys
n, m, l = [int(val) for val in sys.stdin.readline().split(" ")]
matrixA = [[int(val) for val in sys.stdin.readline().split(" ")] for row in range(n)]
matrixB = [[int(val) for val in sys.stdin.readline().split(" ")] for row in range(m)]
matrixC = [
[sum(matrixA[i][k] * matrixB[k][j] for k in range(m)) fo... | false | 52.380952 | [
"-c = 0",
"-output = []",
"+matrixC = [",
"+ [sum(matrixA[i][k] * matrixB[k][j] for k in range(m)) for j in range(l)]",
"+ for i in range(n)",
"+]",
"- for j in range(l):",
"- c = 0",
"- for k in range(m):",
"- c += matrixA[i][k] * matrixB[k][j]",
"- outp... | false | 0.038053 | 0.038291 | 0.993798 | [
"s047138676",
"s018006981"
] |
u693378622 | p02862 | python | s078841333 | s957290313 | 1,299 | 381 | 122,048 | 128,864 | Accepted | Accepted | 70.67 | def cmb(n, r, mod):
if ( r<0 or r>n ):
return 0
r = min(r, n-r)
return g1[n] * g2[r] * g2[n-r] % mod
mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
for i in range( 2, N + 1 ):
g1.append( ( g1[-1] * i ) % mod )
inverse.ap... | def cmb(n, r, mod):
if ( r<0 or r>n ):
return 0
r = min(r, n-r)
return g1[n] * g2[r] * g2[n-r] % mod
mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
for i in range( 2, N + 1 ):
g1.append( ( g1[-1] * i ) % mod )
inverse.ap... | 38 | 28 | 664 | 600 | def cmb(n, r, mod):
if r < 0 or r > n:
return 0
r = min(r, n - r)
return g1[n] * g2[r] * g2[n - r] % mod
mod = 10**9 + 7 # 出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] # 逆元テーブル
inverse = [0, 1] # 逆元テーブル計算用テーブル
for i in range(2, N + 1):
g1.append((g1[-1] * i) % mod)
inverse.append((-... | def cmb(n, r, mod):
if r < 0 or r > n:
return 0
r = min(r, n - r)
return g1[n] * g2[r] * g2[n - r] % mod
mod = 10**9 + 7 # 出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] # 逆元テーブル
inverse = [0, 1] # 逆元テーブル計算用テーブル
for i in range(2, N + 1):
g1.append((g1[-1] * i) % mod)
inverse.append((-... | false | 26.315789 | [
"-if a % 3 != 0 or b % 3 != 0:",
"- print((0))",
"- exit(0)",
"-a = int(a / 3)",
"-b = int(b / 3)",
"-# print(a, b)",
"-mod = 10**9 + 7",
"-ans = cmb((a + b), a, mod)",
"+ans = 0",
"+if a % 3 == 0 and b % 3 == 0:",
"+ a = a // 3",
"+ b = b // 3",
"+ ans = cmb(a + b, a, mod)"
] | false | 1.359218 | 1.349869 | 1.006926 | [
"s078841333",
"s957290313"
] |
u816116805 | p03232 | python | s533494050 | s138274004 | 628 | 437 | 16,880 | 16,400 | Accepted | Accepted | 30.41 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
"""
AGC028 B
"""
import itertools
import math
n = int(eval(input()))
ali = list(map(int, input().split()))
cut = 10**9+7
def modInverse(a, b, divmod=divmod):
r0, r1, s0, s1 = a, b, 1, 0
while r1 != 0:
q, rtmp = ... | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
"""
AGC028 B
"""
import itertools
from functools import reduce
n = int(eval(input()))
ali = list(map(int, input().split()))
cut = 10**9+7
def modInverse(a, b, divmod=divmod):
r0, r1, s0, s1 = a, b, 1, 0
while r1 != 0:
... | 48 | 41 | 846 | 781 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
"""
AGC028 B
"""
import itertools
import math
n = int(eval(input()))
ali = list(map(int, input().split()))
cut = 10**9 + 7
def modInverse(a, b, divmod=divmod):
r0, r1, s0, s1 = a, b, 1, 0
while r1 != 0:
q, rtmp = divmod(r0, r1)
... | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
"""
AGC028 B
"""
import itertools
from functools import reduce
n = int(eval(input()))
ali = list(map(int, input().split()))
cut = 10**9 + 7
def modInverse(a, b, divmod=divmod):
r0, r1, s0, s1 = a, b, 1, 0
while r1 != 0:
q, rtmp = divmo... | false | 14.583333 | [
"-import math",
"+from functools import reduce",
"-# def factorial(n):",
"-# nn = 1",
"-# for i in range(2, n+1):",
"-# nn = nn*i",
"-# return(nn)",
"-nfact = math.factorial(n)",
"+nfact = reduce(lambda x, y: x * y % cut, list(range(1, n + 1)))"
] | false | 0.034907 | 0.039226 | 0.889876 | [
"s533494050",
"s138274004"
] |
u914797917 | p02726 | python | s429982521 | s777998208 | 1,989 | 1,467 | 3,444 | 3,444 | Accepted | Accepted | 26.24 | N,X,Y=list(map(int, input().split()))
D=[0]*(N-1)
for i in range(1,N):
for j in range(i+1,N+1):
d=min(abs(i-j),abs(X-i)+1+abs(Y-j),abs(X-j)+1+abs(Y-i))
D[d-1]+=1
#print(i,j,d)
for i in range(len(D)):
print((D[i])) | N,X,Y=list(map(int, input().split()))
D=[0]*(N-1)
for i in range(1,N):
for j in range(i+1,N+1):
d=min(abs(i-j),abs(X-i)+1+abs(Y-j))
D[d-1]+=1
#print(i,j,d)
for i in range(len(D)):
print((D[i])) | 11 | 11 | 233 | 213 | N, X, Y = list(map(int, input().split()))
D = [0] * (N - 1)
for i in range(1, N):
for j in range(i + 1, N + 1):
d = min(abs(i - j), abs(X - i) + 1 + abs(Y - j), abs(X - j) + 1 + abs(Y - i))
D[d - 1] += 1
# print(i,j,d)
for i in range(len(D)):
print((D[i]))
| N, X, Y = list(map(int, input().split()))
D = [0] * (N - 1)
for i in range(1, N):
for j in range(i + 1, N + 1):
d = min(abs(i - j), abs(X - i) + 1 + abs(Y - j))
D[d - 1] += 1
# print(i,j,d)
for i in range(len(D)):
print((D[i]))
| false | 0 | [
"- d = min(abs(i - j), abs(X - i) + 1 + abs(Y - j), abs(X - j) + 1 + abs(Y - i))",
"+ d = min(abs(i - j), abs(X - i) + 1 + abs(Y - j))"
] | false | 0.093935 | 0.074511 | 1.260689 | [
"s429982521",
"s777998208"
] |
u814271993 | p02613 | python | s555106657 | s267509354 | 161 | 148 | 9,140 | 16,064 | Accepted | Accepted | 8.07 | n = int(eval(input()))
a = 0
b = 0
c = 0
d = 0
for i in range(n):
S = str(eval(input()))
if S == 'AC':
a += 1
if S == 'WA':
b += 1
if S == 'TLE':
c += 1
if S == 'RE':
d += 1
print(('AC x '+str(a)))
print(('WA x '+str(b)))
print(('TLE x '+str(c)))
... | n=int(eval(input()))
l = [eval(input()) for i in range(n)]
ac = 0
wa = 0
tle = 0
re = 0
for i in l:
if i == 'AC':
ac += 1
if i == 'WA':
wa += 1
if i == 'TLE':
tle += 1
if i == 'RE':
re += 1
print(('AC x '+str(ac)))
print(('WA x '+str(wa)))
print(('... | 20 | 22 | 323 | 344 | n = int(eval(input()))
a = 0
b = 0
c = 0
d = 0
for i in range(n):
S = str(eval(input()))
if S == "AC":
a += 1
if S == "WA":
b += 1
if S == "TLE":
c += 1
if S == "RE":
d += 1
print(("AC x " + str(a)))
print(("WA x " + str(b)))
print(("TLE x " + str(c)))
print(("RE x " ... | n = int(eval(input()))
l = [eval(input()) for i in range(n)]
ac = 0
wa = 0
tle = 0
re = 0
for i in l:
if i == "AC":
ac += 1
if i == "WA":
wa += 1
if i == "TLE":
tle += 1
if i == "RE":
re += 1
print(("AC x " + str(ac)))
print(("WA x " + str(wa)))
print(("TLE x " + str(tle)... | false | 9.090909 | [
"-a = 0",
"-b = 0",
"-c = 0",
"-d = 0",
"-for i in range(n):",
"- S = str(eval(input()))",
"- if S == \"AC\":",
"- a += 1",
"- if S == \"WA\":",
"- b += 1",
"- if S == \"TLE\":",
"- c += 1",
"- if S == \"RE\":",
"- d += 1",
"-print((\"AC x \" + ... | false | 0.045732 | 0.046107 | 0.991867 | [
"s555106657",
"s267509354"
] |
u312025627 | p02574 | python | s416112258 | s354363061 | 755 | 633 | 212,892 | 181,528 | Accepted | Accepted | 16.16 | def main():
from math import gcd
_ = int(eval(input()))
A = [int(i) for i in input().split()]
maxA = max(A)
def Eratosthenes(sup: int) -> set:
primes = [True]*(sup+1)
primes[0] = False
primes[1] = False
for i in range(2, sup+1):
if primes[i]:
... | def main():
from math import gcd
_ = int(eval(input()))
A = [int(i) for i in input().split()]
def prime_factorize(n):
for i in range(2, n+1):
if i*i > n:
break
if n % i != 0:
continue
while n % i == 0:
... | 50 | 40 | 1,165 | 901 | def main():
from math import gcd
_ = int(eval(input()))
A = [int(i) for i in input().split()]
maxA = max(A)
def Eratosthenes(sup: int) -> set:
primes = [True] * (sup + 1)
primes[0] = False
primes[1] = False
for i in range(2, sup + 1):
if primes[i]:
... | def main():
from math import gcd
_ = int(eval(input()))
A = [int(i) for i in input().split()]
def prime_factorize(n):
for i in range(2, n + 1):
if i * i > n:
break
if n % i != 0:
continue
while n % i == 0:
n //... | false | 20 | [
"+",
"+ def prime_factorize(n):",
"+ for i in range(2, n + 1):",
"+ if i * i > n:",
"+ break",
"+ if n % i != 0:",
"+ continue",
"+ while n % i == 0:",
"+ n //= i",
"+ B[i] += 1",
"+ if n !=... | false | 0.042321 | 0.036682 | 1.153739 | [
"s416112258",
"s354363061"
] |
u102461423 | p03743 | python | s243994180 | s875649428 | 886 | 809 | 106,344 | 106,520 | Accepted | Accepted | 8.69 | import sys
input = sys.stdin.readline
"""
後ろから、到達不可能距離の集合を見ていきたい。
集合を持つと厳しいが、最小値だけ持っておけばよい。
"""
N,dist = list(map(int,input().split()))
D = [int(x) for x in input().split()]
# 各ターンの出発位置
start_dist = [dist]
for d in D:
x = start_dist[-1]
y = min(abs(x - d), x)
start_dist.append(y)
ng_di... | import sys
input = sys.stdin.readline
"""
後ろから、到達不可能距離の集合を見ていきたい。
集合を持つと厳しいが、最小値だけ持っておけばよい。
"""
N,dist = list(map(int,input().split()))
D = [int(x) for x in input().split()]
# 各ターンの出発位置
start_dist = [dist]
for d in D:
x = start_dist[-1]
y = x-d if x > d else d - x
start_dist.append(x if x... | 32 | 32 | 616 | 637 | import sys
input = sys.stdin.readline
"""
後ろから、到達不可能距離の集合を見ていきたい。
集合を持つと厳しいが、最小値だけ持っておけばよい。
"""
N, dist = list(map(int, input().split()))
D = [int(x) for x in input().split()]
# 各ターンの出発位置
start_dist = [dist]
for d in D:
x = start_dist[-1]
y = min(abs(x - d), x)
start_dist.append(y)
ng_dist = [None] * (N + ... | import sys
input = sys.stdin.readline
"""
後ろから、到達不可能距離の集合を見ていきたい。
集合を持つと厳しいが、最小値だけ持っておけばよい。
"""
N, dist = list(map(int, input().split()))
D = [int(x) for x in input().split()]
# 各ターンの出発位置
start_dist = [dist]
for d in D:
x = start_dist[-1]
y = x - d if x > d else d - x
start_dist.append(x if x < y else y)
n... | false | 0 | [
"- y = min(abs(x - d), x)",
"- start_dist.append(y)",
"+ y = x - d if x > d else d - x",
"+ start_dist.append(x if x < y else y)"
] | false | 0.037477 | 0.035921 | 1.043312 | [
"s243994180",
"s875649428"
] |
u547492399 | p02422 | python | s099451753 | s568033526 | 30 | 20 | 7,700 | 7,720 | Accepted | Accepted | 33.33 | s = eval(input())
n = int(eval(input()))
for _ in range(n):
line = input().split()
order = line[0]
a = int(line[1])
b = int(line[2])
p = line[3] if len(line) == 4 else ''
if order == 'print':
print((s[a:b+1]))
elif order == 'reverse':
s = s[:a] + ''.join(revers... | s = eval(input())
n = int(eval(input()))
for _ in range(n):
line = input().split()
order = line[0]
a = int(line[1])
b = int(line[2])
p = line[3] if len(line) == 4 else ''
if order == 'print':
print((s[a:b+1]))
elif order == 'reverse':
s = s[:a] + s[a:b+1][::-... | 16 | 16 | 392 | 381 | s = eval(input())
n = int(eval(input()))
for _ in range(n):
line = input().split()
order = line[0]
a = int(line[1])
b = int(line[2])
p = line[3] if len(line) == 4 else ""
if order == "print":
print((s[a : b + 1]))
elif order == "reverse":
s = s[:a] + "".join(reversed(s[a : b ... | s = eval(input())
n = int(eval(input()))
for _ in range(n):
line = input().split()
order = line[0]
a = int(line[1])
b = int(line[2])
p = line[3] if len(line) == 4 else ""
if order == "print":
print((s[a : b + 1]))
elif order == "reverse":
s = s[:a] + s[a : b + 1][::-1] + s[b ... | false | 0 | [
"- s = s[:a] + \"\".join(reversed(s[a : b + 1])) + s[b + 1 :]",
"+ s = s[:a] + s[a : b + 1][::-1] + s[b + 1 :]"
] | false | 0.03695 | 0.041689 | 0.886329 | [
"s099451753",
"s568033526"
] |
u380524497 | p03608 | python | s831152331 | s839408194 | 692 | 493 | 22,272 | 18,436 | Accepted | Accepted | 28.76 | import itertools
import sys
from scipy.sparse.csgraph import csgraph_from_dense
from scipy.sparse.csgraph import dijkstra
input = sys.stdin.readline
n, m, r = list(map(int, input().split()))
visiting_town = list(map(int, input().split()))
edges = [[float('INF')]*n for _ in range(n)]
for i in range(m):
... | import itertools
import sys
from scipy.sparse.csgraph import csgraph_from_dense
from scipy.sparse.csgraph import dijkstra
input = sys.stdin.readline
n, m, r = list(map(int, input().split()))
visiting_town = list(map(int, input().split()))
edges = [[float('INF')]*n for _ in range(n)]
for i in range(m):
... | 27 | 30 | 741 | 840 | import itertools
import sys
from scipy.sparse.csgraph import csgraph_from_dense
from scipy.sparse.csgraph import dijkstra
input = sys.stdin.readline
n, m, r = list(map(int, input().split()))
visiting_town = list(map(int, input().split()))
edges = [[float("INF")] * n for _ in range(n)]
for i in range(m):
a, b, c = ... | import itertools
import sys
from scipy.sparse.csgraph import csgraph_from_dense
from scipy.sparse.csgraph import dijkstra
input = sys.stdin.readline
n, m, r = list(map(int, input().split()))
visiting_town = list(map(int, input().split()))
edges = [[float("INF")] * n for _ in range(n)]
for i in range(m):
a, b, c = ... | false | 10 | [
"-comp_dist = dijkstra(G, directed=False)",
"+comp_dist = {}",
"+for node in visiting_town:",
"+ dist_list = dijkstra(G, directed=False, indices=node - 1)",
"+ comp_dist[node - 1] = dist_list"
] | false | 0.239188 | 0.340018 | 0.703456 | [
"s831152331",
"s839408194"
] |
u982591663 | p03043 | python | s940512633 | s407748511 | 48 | 39 | 3,060 | 2,940 | Accepted | Accepted | 18.75 | #ABC-126-C
N, K = list(map(int, input().split()))
possibility = 0
def check_double(n, K):
count = 0
while n < K:
n *= 2
count += 1
return count
for i in range(1, N+1):
possibility += (1/N) * (0.5 ** check_double(i, K))
print(possibility) | N, K = list(map(int, input().split()))
ans = 0
for i in range(1, N+1):
tmp = 1
while i < K:
tmp /= 2
i *= 2
ans += tmp
ans /= N
print(ans)
| 15 | 13 | 280 | 176 | # ABC-126-C
N, K = list(map(int, input().split()))
possibility = 0
def check_double(n, K):
count = 0
while n < K:
n *= 2
count += 1
return count
for i in range(1, N + 1):
possibility += (1 / N) * (0.5 ** check_double(i, K))
print(possibility)
| N, K = list(map(int, input().split()))
ans = 0
for i in range(1, N + 1):
tmp = 1
while i < K:
tmp /= 2
i *= 2
ans += tmp
ans /= N
print(ans)
| false | 13.333333 | [
"-# ABC-126-C",
"-possibility = 0",
"-",
"-",
"-def check_double(n, K):",
"- count = 0",
"- while n < K:",
"- n *= 2",
"- count += 1",
"- return count",
"-",
"-",
"+ans = 0",
"- possibility += (1 / N) * (0.5 ** check_double(i, K))",
"-print(possibility)",
"+ ... | false | 0.056001 | 0.048271 | 1.160142 | [
"s940512633",
"s407748511"
] |
u067983636 | p02629 | python | s909795198 | s672147244 | 64 | 31 | 61,880 | 9,180 | Accepted | Accepted | 51.56 | N = int(eval(input()))
res = ""
while N > 0:
r = (N - 1) % 26
res = chr(r + 97) + res
N -= r + 1
N //= 26
print(res) | N = int(eval(input()))
res = ""
while N > 0:
N -= 1
r = N % 26
res = chr(r + 97) + res
N //= 26
print(res) | 9 | 9 | 135 | 125 | N = int(eval(input()))
res = ""
while N > 0:
r = (N - 1) % 26
res = chr(r + 97) + res
N -= r + 1
N //= 26
print(res)
| N = int(eval(input()))
res = ""
while N > 0:
N -= 1
r = N % 26
res = chr(r + 97) + res
N //= 26
print(res)
| false | 0 | [
"- r = (N - 1) % 26",
"+ N -= 1",
"+ r = N % 26",
"- N -= r + 1"
] | false | 0.036564 | 0.037023 | 0.987619 | [
"s909795198",
"s672147244"
] |
u024340351 | p02552 | python | s367517762 | s414279787 | 33 | 27 | 9,080 | 8,984 | Accepted | Accepted | 18.18 | x = int(eval(input()))
print((1-x)) | print((1-int(eval(input())))) | 2 | 1 | 28 | 21 | x = int(eval(input()))
print((1 - x))
| print((1 - int(eval(input()))))
| false | 50 | [
"-x = int(eval(input()))",
"-print((1 - x))",
"+print((1 - int(eval(input()))))"
] | false | 0.038854 | 0.094456 | 0.411347 | [
"s367517762",
"s414279787"
] |
u726823037 | p02612 | python | s812817412 | s774715013 | 32 | 26 | 9,168 | 9,180 | Accepted | Accepted | 18.75 | import sys
def Ii():return int(sys.stdin.readline())
def Mi():return list(map(int,sys.stdin.buffer.readline().split()))
def Li():return list(map(int,sys.stdin.buffer.readline().split()))
n = Ii()
a = n%1000
if a == 0:
print((0))
else:
print((1000-a)) | import sys
def Ii():return int(sys.stdin.readline())
def Mi():return list(map(int,sys.stdin.buffer.readline().split()))
def Li():return list(map(int,sys.stdin.buffer.readline().split()))
n = Ii()
if n%1000 == 0:
print((0))
else:
print((1000-n%1000)) | 10 | 10 | 253 | 253 | import sys
def Ii():
return int(sys.stdin.readline())
def Mi():
return list(map(int, sys.stdin.buffer.readline().split()))
def Li():
return list(map(int, sys.stdin.buffer.readline().split()))
n = Ii()
a = n % 1000
if a == 0:
print((0))
else:
print((1000 - a))
| import sys
def Ii():
return int(sys.stdin.readline())
def Mi():
return list(map(int, sys.stdin.buffer.readline().split()))
def Li():
return list(map(int, sys.stdin.buffer.readline().split()))
n = Ii()
if n % 1000 == 0:
print((0))
else:
print((1000 - n % 1000))
| false | 0 | [
"-a = n % 1000",
"-if a == 0:",
"+if n % 1000 == 0:",
"- print((1000 - a))",
"+ print((1000 - n % 1000))"
] | false | 0.036667 | 0.099183 | 0.369694 | [
"s812817412",
"s774715013"
] |
u392319141 | p03221 | python | s782053681 | s960173738 | 798 | 674 | 35,940 | 46,424 | Accepted | Accepted | 15.54 | N, M = list(map(int, input().split()))
cities = [[] for _ in range(N)]
for i in range(M) :
p, y = list(map(int, input().split()))
cities[p - 1].append((i, y))
id = [0] * M
for p, city in enumerate(cities) :
city.sort(key = lambda A : A[1])
for index, (i, year) in enumerate(city) :
... | from collections import defaultdict
N, M = map(int, input().split())
A = defaultdict(list)
for i in range(M):
P, Y = map(int, input().split())
A[P].append((Y, i))
ans = [''] * M
for p, grp in A.items():
for j, (_, i) in enumerate(sorted(grp), start=1):
ans[i] = '%06d%06d' % (p, j)
pr... | 17 | 15 | 411 | 342 | N, M = list(map(int, input().split()))
cities = [[] for _ in range(N)]
for i in range(M):
p, y = list(map(int, input().split()))
cities[p - 1].append((i, y))
id = [0] * M
for p, city in enumerate(cities):
city.sort(key=lambda A: A[1])
for index, (i, year) in enumerate(city):
id[i] = "{pre:06}{i:... | from collections import defaultdict
N, M = map(int, input().split())
A = defaultdict(list)
for i in range(M):
P, Y = map(int, input().split())
A[P].append((Y, i))
ans = [""] * M
for p, grp in A.items():
for j, (_, i) in enumerate(sorted(grp), start=1):
ans[i] = "%06d%06d" % (p, j)
print(*ans, sep="... | false | 11.764706 | [
"-N, M = list(map(int, input().split()))",
"-cities = [[] for _ in range(N)]",
"+from collections import defaultdict",
"+",
"+N, M = map(int, input().split())",
"+A = defaultdict(list)",
"- p, y = list(map(int, input().split()))",
"- cities[p - 1].append((i, y))",
"-id = [0] * M",
"-for p, c... | false | 0.036108 | 0.034802 | 1.037534 | [
"s782053681",
"s960173738"
] |
u189023301 | p03497 | python | s579280413 | s729653800 | 212 | 180 | 41,500 | 41,504 | Accepted | Accepted | 15.09 | from collections import Counter
n, m = list(map(int, input().split()))
dic = Counter(list(map(int, input().split())))
lis = sorted(list(dic.items()), key=lambda x: x[1], reverse=True)
res = 0
for i, x in enumerate(lis):
if i < m:
continue
else:
res += x[1]
print(res)
| from collections import Counter
n, m = list(map(int, input().split()))
dic = Counter(list(map(int, input().split())))
lis = sorted(list(dic.items()), key=lambda x: x[1], reverse=True)
res = 0
for i in range(min(m, len(lis))):
res += lis[i][1]
print((n - res))
| 13 | 10 | 287 | 255 | from collections import Counter
n, m = list(map(int, input().split()))
dic = Counter(list(map(int, input().split())))
lis = sorted(list(dic.items()), key=lambda x: x[1], reverse=True)
res = 0
for i, x in enumerate(lis):
if i < m:
continue
else:
res += x[1]
print(res)
| from collections import Counter
n, m = list(map(int, input().split()))
dic = Counter(list(map(int, input().split())))
lis = sorted(list(dic.items()), key=lambda x: x[1], reverse=True)
res = 0
for i in range(min(m, len(lis))):
res += lis[i][1]
print((n - res))
| false | 23.076923 | [
"-for i, x in enumerate(lis):",
"- if i < m:",
"- continue",
"- else:",
"- res += x[1]",
"-print(res)",
"+for i in range(min(m, len(lis))):",
"+ res += lis[i][1]",
"+print((n - res))"
] | false | 0.03272 | 0.04298 | 0.761285 | [
"s579280413",
"s729653800"
] |
u633068244 | p00631 | python | s462599453 | s059795119 | 2,620 | 2,210 | 45,500 | 25,716 | Accepted | Accepted | 15.65 | while 1:
n = eval(input())
if n == 0: break
a = list(map(int,input().split()))
s = sum(a)
ref = [0]
for i in a:
ref += [i+j for j in ref if j < s/2]
print(min(abs(s-2*i) for i in ref)) | while 1:
n = eval(input())
if n == 0: break
a = sorted(map(int,input().split()))[::-1]
s = sum(a)
L = [0]
for i in a:
L += [i+j for j in L if j < s/2]
print(min(abs(s-2*i) for i in L)) | 9 | 9 | 192 | 198 | while 1:
n = eval(input())
if n == 0:
break
a = list(map(int, input().split()))
s = sum(a)
ref = [0]
for i in a:
ref += [i + j for j in ref if j < s / 2]
print(min(abs(s - 2 * i) for i in ref))
| while 1:
n = eval(input())
if n == 0:
break
a = sorted(map(int, input().split()))[::-1]
s = sum(a)
L = [0]
for i in a:
L += [i + j for j in L if j < s / 2]
print(min(abs(s - 2 * i) for i in L))
| false | 0 | [
"- a = list(map(int, input().split()))",
"+ a = sorted(map(int, input().split()))[::-1]",
"- ref = [0]",
"+ L = [0]",
"- ref += [i + j for j in ref if j < s / 2]",
"- print(min(abs(s - 2 * i) for i in ref))",
"+ L += [i + j for j in L if j < s / 2]",
"+ print(min(abs(s ... | false | 0.035748 | 0.073715 | 0.484944 | [
"s462599453",
"s059795119"
] |
u491550356 | p02678 | python | s282684092 | s920334869 | 788 | 703 | 64,900 | 65,008 | Accepted | Accepted | 10.79 | N, M = map(int, input().split())
AB = [tuple(map(int,input().split())) for i in range(M)]
es = [[] for _ in range(N)]
for a, b in AB:
es[a-1].append(b-1)
es[b-1].append(a-1)
ans = [-1] * N
ans[0] = 0
from collections import deque
que = deque([0])
while que:
s = que.popleft()
for v ... | N, M = map(int, input().split())
AB = [tuple(map(int,input().split())) for i in range(M)]
es = [[] for _ in range(N)]
for a, b in AB:
es[a-1].append(b-1)
es[b-1].append(a-1)
ans = [-1] * N
ans[0] = 0
from collections import deque
que = deque([])
que.append(0)
while que:
s = que.popleft... | 24 | 25 | 451 | 465 | N, M = map(int, input().split())
AB = [tuple(map(int, input().split())) for i in range(M)]
es = [[] for _ in range(N)]
for a, b in AB:
es[a - 1].append(b - 1)
es[b - 1].append(a - 1)
ans = [-1] * N
ans[0] = 0
from collections import deque
que = deque([0])
while que:
s = que.popleft()
for v in es[s]:
... | N, M = map(int, input().split())
AB = [tuple(map(int, input().split())) for i in range(M)]
es = [[] for _ in range(N)]
for a, b in AB:
es[a - 1].append(b - 1)
es[b - 1].append(a - 1)
ans = [-1] * N
ans[0] = 0
from collections import deque
que = deque([])
que.append(0)
while que:
s = que.popleft()
for v... | false | 4 | [
"-que = deque([0])",
"+que = deque([])",
"+que.append(0)"
] | false | 0.041047 | 0.040675 | 1.00913 | [
"s282684092",
"s920334869"
] |
u905203728 | p03546 | python | s004919624 | s676024458 | 38 | 33 | 3,444 | 3,444 | Accepted | Accepted | 13.16 | h,w=list(map(int,input().split()))
C=[list(map(int,input().split())) for i in range(10)]
A=[list(map(int,input().split())) for j in range(h)]
for k in range(10):
for i in range(10):
for j in range(10):
C[i][j]=min(C[i][j],C[i][k]+C[k][j])
cost=[C[i][1] for i in range(10)]
cnt=0
for i in... | h,w=list(map(int,input().split()))
C=[list(map(int,input().split())) for i in range(10)]
A=[list(map(int,input().split())) for j in range(h)]
#warshall_floyd法:最短経路を全探索で求める
for k in range(10):
for i in range(10):
for j in range(10):
C[i][j]=min(C[i][j],C[i][k]+C[k][j])
cost=[C[i][1] for... | 15 | 15 | 431 | 426 | h, w = list(map(int, input().split()))
C = [list(map(int, input().split())) for i in range(10)]
A = [list(map(int, input().split())) for j in range(h)]
for k in range(10):
for i in range(10):
for j in range(10):
C[i][j] = min(C[i][j], C[i][k] + C[k][j])
cost = [C[i][1] for i in range(10)]
cnt = ... | h, w = list(map(int, input().split()))
C = [list(map(int, input().split())) for i in range(10)]
A = [list(map(int, input().split())) for j in range(h)]
# warshall_floyd法:最短経路を全探索で求める
for k in range(10):
for i in range(10):
for j in range(10):
C[i][j] = min(C[i][j], C[i][k] + C[k][j])
cost = [C[i... | false | 0 | [
"+# warshall_floyd法:最短経路を全探索で求める",
"-cost = [C[i][1] for i in range(10)]",
"+cost = [C[i][1] for i in range(10)] + [0]",
"- add = A[i][j]",
"- if add != -1:",
"- cnt += cost[add]",
"+ cnt += cost[A[i][j]]"
] | false | 0.031006 | 0.031187 | 0.994197 | [
"s004919624",
"s676024458"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.