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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u029000441 | p02947 | python | s439858164 | s752784027 | 388 | 285 | 19,760 | 19,848 | Accepted | Accepted | 26.55 | import sys
input = sys.stdin.readline
import math
import collections
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
n=I()
strs=[]
for i in range(n):
line=sorted(input().rstrip())
STR=""
for j in line:
... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
fr... | 23 | 28 | 451 | 901 | import sys
input = sys.stdin.readline
import math
import collections
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
n = I()
strs = []
for i in range(n):
line = sorted(input().rstrip())
STR = ""
for j i... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left, bisect_right
from heapq import heapify, heappop, heappush
from mat... | false | 17.857143 | [
"-import math",
"-import collections",
"+sys.setrecursionlimit(10**7)",
"+from collections import Counter, deque",
"+from collections import defaultdict",
"+from itertools import combinations, permutations, accumulate, groupby, product",
"+from bisect import bisect_left, bisect_right",
"+from heapq im... | false | 0.052446 | 0.037686 | 1.39167 | [
"s439858164",
"s752784027"
] |
u086503932 | p03062 | python | s385439588 | s276604031 | 90 | 72 | 14,284 | 19,988 | Accepted | Accepted | 20 | #!/usr/bin/env python3
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
ans = sum(A)
for i in range(0,N-1,2):
# print(i)
tmp = ans - 2*(A[i]+A[i+1])
if tmp > ans:
ans = tmp
print(ans)
if __name__ == "__main__":
... | N = int(eval(input()))
A = list(map(int, input().split()))
cnt = 0
for i in range(N):
if A[i] < 0:
cnt += 1
A = [abs(a) for a in A]
if cnt % 2 == 0:
print((sum(A)))
else:
print((sum(A)-2*min(A))) | 17 | 11 | 326 | 215 | #!/usr/bin/env python3
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
ans = sum(A)
for i in range(0, N - 1, 2):
# print(i)
tmp = ans - 2 * (A[i] + A[i + 1])
if tmp > ans:
ans = tmp
print(ans)
if __name__ == "__main__":
ma... | N = int(eval(input()))
A = list(map(int, input().split()))
cnt = 0
for i in range(N):
if A[i] < 0:
cnt += 1
A = [abs(a) for a in A]
if cnt % 2 == 0:
print((sum(A)))
else:
print((sum(A) - 2 * min(A)))
| false | 35.294118 | [
"-#!/usr/bin/env python3",
"-def main():",
"- N = int(eval(input()))",
"- A = list(map(int, input().split()))",
"- A.sort()",
"- ans = sum(A)",
"- for i in range(0, N - 1, 2):",
"- # print(i)",
"- tmp = ans - 2 * (A[i] + A[i + 1])",
"- if tmp > ans:",
"- ... | false | 0.045604 | 0.043676 | 1.044148 | [
"s385439588",
"s276604031"
] |
u644907318 | p03578 | python | s893290190 | s443854761 | 344 | 221 | 35,164 | 148,724 | Accepted | Accepted | 35.76 | N = int(eval(input()))
D = sorted(list(map(int,input().split())))
M = int(eval(input()))
T = sorted(list(map(int,input().split())))
cur = 0
flag = 0
for i in range(N):
if cur<M and D[i]==T[cur]:
cur += 1
elif cur<M and D[i]<T[cur]:
continue
elif cur==M:
break
else:
... | N = int(eval(input()))
D = list(map(int,input().split()))
CD = {}
for i in range(N):
d = D[i]
if d not in CD:
CD[d] = 0
CD[d] += 1
M = int(eval(input()))
T = list(map(int,input().split()))
CT = {}
for j in range(M):
t = T[j]
if t not in CT:
CT[t] = 0
CT[t] += 1
fl... | 20 | 29 | 394 | 514 | N = int(eval(input()))
D = sorted(list(map(int, input().split())))
M = int(eval(input()))
T = sorted(list(map(int, input().split())))
cur = 0
flag = 0
for i in range(N):
if cur < M and D[i] == T[cur]:
cur += 1
elif cur < M and D[i] < T[cur]:
continue
elif cur == M:
break
else:
... | N = int(eval(input()))
D = list(map(int, input().split()))
CD = {}
for i in range(N):
d = D[i]
if d not in CD:
CD[d] = 0
CD[d] += 1
M = int(eval(input()))
T = list(map(int, input().split()))
CT = {}
for j in range(M):
t = T[j]
if t not in CT:
CT[t] = 0
CT[t] += 1
flag = 0
for t i... | false | 31.034483 | [
"-D = sorted(list(map(int, input().split())))",
"+D = list(map(int, input().split()))",
"+CD = {}",
"+for i in range(N):",
"+ d = D[i]",
"+ if d not in CD:",
"+ CD[d] = 0",
"+ CD[d] += 1",
"-T = sorted(list(map(int, input().split())))",
"-cur = 0",
"+T = list(map(int, input().spl... | false | 0.041468 | 0.043371 | 0.956114 | [
"s893290190",
"s443854761"
] |
u816872429 | p02998 | python | s827351505 | s094865785 | 928 | 775 | 90,072 | 101,280 | Accepted | Accepted | 16.49 | n = int(eval(input()))
xy = [list(map(int, input().split())) for _ in range(n)]
xtoy = {}
ytox = {}
for x, y in xy:
if x not in xtoy:
xtoy[x] = []
xtoy[x].append(y)
if y not in ytox:
ytox[y] = []
ytox[y].append(x)
ret = 0
while len(xtoy) > 0:
x = next(iter(xtoy))
xs... | import sys
sys.setrecursionlimit(100000)
n = int(eval(input()))
xy = [list(map(int, input().split())) for _ in range(n)]
xtoy = {}
ytox = {}
for x, y in xy:
if x not in xtoy:
xtoy[x] = [y]
else:
xtoy[x].append(y)
if y not in ytox:
ytox[y] = [x]
else:
ytox[... | 32 | 36 | 811 | 734 | n = int(eval(input()))
xy = [list(map(int, input().split())) for _ in range(n)]
xtoy = {}
ytox = {}
for x, y in xy:
if x not in xtoy:
xtoy[x] = []
xtoy[x].append(y)
if y not in ytox:
ytox[y] = []
ytox[y].append(x)
ret = 0
while len(xtoy) > 0:
x = next(iter(xtoy))
xs = set()
y... | import sys
sys.setrecursionlimit(100000)
n = int(eval(input()))
xy = [list(map(int, input().split())) for _ in range(n)]
xtoy = {}
ytox = {}
for x, y in xy:
if x not in xtoy:
xtoy[x] = [y]
else:
xtoy[x].append(y)
if y not in ytox:
ytox[y] = [x]
else:
ytox[y].append(x)
... | false | 11.111111 | [
"+import sys",
"+",
"+sys.setrecursionlimit(100000)",
"- xtoy[x] = []",
"- xtoy[x].append(y)",
"+ xtoy[x] = [y]",
"+ else:",
"+ xtoy[x].append(y)",
"- ytox[y] = []",
"- ytox[y].append(x)",
"+ ytox[y] = [x]",
"+ else:",
"+ ytox[y].append(x... | false | 0.043795 | 0.048593 | 0.901272 | [
"s827351505",
"s094865785"
] |
u196579381 | p03283 | python | s147426712 | s312369321 | 1,684 | 542 | 59,096 | 56,668 | Accepted | Accepted | 67.81 | from itertools import accumulate
N, M, Q = list(map(int, input().split()))
D = [[0] * (N + 1) for i in range(N + 1)]
for _ in range(M):
L, R = list(map(int, input().split()))
D[L][R] += 1
for i in range(N - 1, 0, -1):
for j in range(1, N + 1):
D[i][j] += D[i + 1][j]
for i in range(1, N + 1)... | from sys import stdin
from itertools import accumulate
input = stdin.readline
N, M, Q = list(map(int, input().split()))
D = [[0] * (N + 1) for i in range(N + 1)]
for _ in range(M):
L, R = list(map(int, input().split()))
D[L][R] += 1
for i in range(N - 1, 0, -1):
for j in range(i, N + 1):
D... | 14 | 16 | 422 | 469 | from itertools import accumulate
N, M, Q = list(map(int, input().split()))
D = [[0] * (N + 1) for i in range(N + 1)]
for _ in range(M):
L, R = list(map(int, input().split()))
D[L][R] += 1
for i in range(N - 1, 0, -1):
for j in range(1, N + 1):
D[i][j] += D[i + 1][j]
for i in range(1, N + 1):
D[... | from sys import stdin
from itertools import accumulate
input = stdin.readline
N, M, Q = list(map(int, input().split()))
D = [[0] * (N + 1) for i in range(N + 1)]
for _ in range(M):
L, R = list(map(int, input().split()))
D[L][R] += 1
for i in range(N - 1, 0, -1):
for j in range(i, N + 1):
D[i][j] +=... | false | 12.5 | [
"+from sys import stdin",
"+input = stdin.readline",
"- for j in range(1, N + 1):",
"+ for j in range(i, N + 1):"
] | false | 0.082851 | 0.007311 | 11.332695 | [
"s147426712",
"s312369321"
] |
u334712262 | p03132 | python | s718274405 | s560144381 | 1,373 | 766 | 50,448 | 56,248 | Accepted | Accepted | 44.21 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, produc... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, produc... | 97 | 105 | 2,108 | 2,130 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permut... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permut... | false | 7.619048 | [
"+def error_mat_print(m):",
"+ for r in m:",
"+ print(r, file=sys.stderr)",
"+",
"+",
"- dp = [[sys.maxsize] * (L + 1) for _ in range(5)]",
"+ dp = [[sys.maxsize] * (L + 1) for _ in range(6)]",
"-",
"+ # dp[0][0] = 0",
"- for j in range(5):",
"- if j > 0:",
... | false | 0.035803 | 0.035354 | 1.012703 | [
"s718274405",
"s560144381"
] |
u597455618 | p02720 | python | s117883938 | s945862680 | 74 | 61 | 11,912 | 12,108 | Accepted | Accepted | 17.57 | import collections
k = int(eval(input()))
Q = collections.deque([int(i) for i in range(1, 10)])
chk = False
for i in range(k):
x = Q.popleft()
if i + len(Q) > k:
chk = True
if chk:
continue
else:
if x%10:
Q.append(10*x + x%10 - 1)
Q.append(10*x ... | import collections
def main():
k = int(eval(input()))
Q = collections.deque([int(i) for i in range(1, 10)])
chk = False
for i in range(k):
x = Q.popleft()
if i + len(Q) > k:
chk = True
if chk:
continue
else:
if x%10:
... | 18 | 22 | 394 | 512 | import collections
k = int(eval(input()))
Q = collections.deque([int(i) for i in range(1, 10)])
chk = False
for i in range(k):
x = Q.popleft()
if i + len(Q) > k:
chk = True
if chk:
continue
else:
if x % 10:
Q.append(10 * x + x % 10 - 1)
Q.append(10 * x + x % ... | import collections
def main():
k = int(eval(input()))
Q = collections.deque([int(i) for i in range(1, 10)])
chk = False
for i in range(k):
x = Q.popleft()
if i + len(Q) > k:
chk = True
if chk:
continue
else:
if x % 10:
... | false | 18.181818 | [
"-k = int(eval(input()))",
"-Q = collections.deque([int(i) for i in range(1, 10)])",
"-chk = False",
"-for i in range(k):",
"- x = Q.popleft()",
"- if i + len(Q) > k:",
"- chk = True",
"- if chk:",
"- continue",
"- else:",
"- if x % 10:",
"- Q.append... | false | 0.058953 | 0.054368 | 1.084325 | [
"s117883938",
"s945862680"
] |
u882564128 | p03775 | python | s315786648 | s065531506 | 45 | 39 | 8,976 | 9,164 | Accepted | Accepted | 13.33 | import math
n = int(eval(input()))
if n < 10:
print((1))
else:
a = 0
for i in range(1, int(math.sqrt(n))+1):
if n % i == 0:
a = i
b = n//a
j = 1
while True:
m = b / (10**j)
if m>=1 and m<10:
ans = j+1
break
j+=1
... | import math
n = int(eval(input()))
a = 0
for i in range(1, int(math.sqrt(n))+1):
if n % i == 0:
a = i
b = n//a
j = 0
while True:
m = b / (10**j)
if m>=1 and m<10:
ans = j+1
break
j+=1
print(ans)
| 19 | 16 | 329 | 245 | import math
n = int(eval(input()))
if n < 10:
print((1))
else:
a = 0
for i in range(1, int(math.sqrt(n)) + 1):
if n % i == 0:
a = i
b = n // a
j = 1
while True:
m = b / (10**j)
if m >= 1 and m < 10:
ans = j + 1
break
j += 1
... | import math
n = int(eval(input()))
a = 0
for i in range(1, int(math.sqrt(n)) + 1):
if n % i == 0:
a = i
b = n // a
j = 0
while True:
m = b / (10**j)
if m >= 1 and m < 10:
ans = j + 1
break
j += 1
print(ans)
| false | 15.789474 | [
"-if n < 10:",
"- print((1))",
"-else:",
"- a = 0",
"- for i in range(1, int(math.sqrt(n)) + 1):",
"- if n % i == 0:",
"- a = i",
"- b = n // a",
"- j = 1",
"- while True:",
"- m = b / (10**j)",
"- if m >= 1 and m < 10:",
"- ans = ... | false | 0.055096 | 0.051962 | 1.060318 | [
"s315786648",
"s065531506"
] |
u094191970 | p03645 | python | s800976482 | s738887583 | 531 | 428 | 38,320 | 38,296 | Accepted | Accepted | 19.4 | from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
def main():
n,m=nii()
tree=[[] for i in range(n)]
for i in range(m):
a,b=nii()
a-=1
b-=1
tree[a]+=[b]
tree[b]+=[a]
for i in tree[0]:
for j in tree[i]:
if j==n-1:
print('POSSIBLE')
... | from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
def main():
n,m=nii()
tree=[[] for i in range(n)]
for i in range(m):
a,b=nii()
a-=1
b-=1
tree[a].append(b)
tree[b].append(a)
for i in tree[0]:
for j in tree[i]:
if j==n-1:
print('PO... | 23 | 23 | 389 | 399 | from sys import stdin
nii = lambda: list(map(int, stdin.readline().split()))
def main():
n, m = nii()
tree = [[] for i in range(n)]
for i in range(m):
a, b = nii()
a -= 1
b -= 1
tree[a] += [b]
tree[b] += [a]
for i in tree[0]:
for j in tree[i]:
... | from sys import stdin
nii = lambda: list(map(int, stdin.readline().split()))
def main():
n, m = nii()
tree = [[] for i in range(n)]
for i in range(m):
a, b = nii()
a -= 1
b -= 1
tree[a].append(b)
tree[b].append(a)
for i in tree[0]:
for j in tree[i]:
... | false | 0 | [
"- tree[a] += [b]",
"- tree[b] += [a]",
"+ tree[a].append(b)",
"+ tree[b].append(a)"
] | false | 0.078837 | 0.043991 | 1.792118 | [
"s800976482",
"s738887583"
] |
u936985471 | p02879 | python | s075172108 | s252987570 | 19 | 17 | 3,316 | 2,940 | Accepted | Accepted | 10.53 | a,b=list(map(int,input().split()))
if a<10 and b<10:
print((a*b))
else:
print((-1)) | a,b=list(map(int,input().split()))
print(((-1,a*b)[a<10 and b<10]))
| 6 | 2 | 83 | 61 | a, b = list(map(int, input().split()))
if a < 10 and b < 10:
print((a * b))
else:
print((-1))
| a, b = list(map(int, input().split()))
print(((-1, a * b)[a < 10 and b < 10]))
| false | 66.666667 | [
"-if a < 10 and b < 10:",
"- print((a * b))",
"-else:",
"- print((-1))",
"+print(((-1, a * b)[a < 10 and b < 10]))"
] | false | 0.041944 | 0.085477 | 0.49071 | [
"s075172108",
"s252987570"
] |
u273010357 | p03309 | python | s107503845 | s616505894 | 276 | 232 | 26,128 | 26,836 | Accepted | Accepted | 15.94 | N = int(eval(input()))
A = list(map(int, input().split()))
B = [0]*N
for i in range(N):
B[i] = A[i] - i
B.sort()
res = 0
x = B[N//2]
for i in range(N):
res += max(x - B[i], -x + B[i])
print(res) | N = int(eval(input()))
A = list(map(int, input().split()))
B = [0]*N
for i in range(N):
B[i] = A[i] - i
B.sort()
res = 0
x = B[N//2]
for i in range(N):
res += abs(x - B[i])
print(res) | 14 | 14 | 212 | 201 | N = int(eval(input()))
A = list(map(int, input().split()))
B = [0] * N
for i in range(N):
B[i] = A[i] - i
B.sort()
res = 0
x = B[N // 2]
for i in range(N):
res += max(x - B[i], -x + B[i])
print(res)
| N = int(eval(input()))
A = list(map(int, input().split()))
B = [0] * N
for i in range(N):
B[i] = A[i] - i
B.sort()
res = 0
x = B[N // 2]
for i in range(N):
res += abs(x - B[i])
print(res)
| false | 0 | [
"- res += max(x - B[i], -x + B[i])",
"+ res += abs(x - B[i])"
] | false | 0.044799 | 0.048907 | 0.916012 | [
"s107503845",
"s616505894"
] |
u312025627 | p02659 | python | s232548997 | s622024996 | 115 | 106 | 77,520 | 77,540 | Accepted | Accepted | 7.83 | def main():
from decimal import Decimal
a, b = (Decimal(i) for i in input().split())
print((int(a*b)))
if __name__ == '__main__':
main()
| def main():
from decimal import Decimal as D
N, M = (D(i) for i in input().split())
print((int(N*M)))
if __name__ == '__main__':
main()
| 8 | 8 | 160 | 159 | def main():
from decimal import Decimal
a, b = (Decimal(i) for i in input().split())
print((int(a * b)))
if __name__ == "__main__":
main()
| def main():
from decimal import Decimal as D
N, M = (D(i) for i in input().split())
print((int(N * M)))
if __name__ == "__main__":
main()
| false | 0 | [
"- from decimal import Decimal",
"+ from decimal import Decimal as D",
"- a, b = (Decimal(i) for i in input().split())",
"- print((int(a * b)))",
"+ N, M = (D(i) for i in input().split())",
"+ print((int(N * M)))"
] | false | 0.048329 | 0.037488 | 1.289187 | [
"s232548997",
"s622024996"
] |
u896741788 | p03038 | python | s630239782 | s962565218 | 615 | 445 | 30,928 | 43,928 | Accepted | Accepted | 27.64 | from itertools import groupby as gb
mai,sou=list(map(int,input().split()))
cards=[(e,len(list(f))) for e,f in gb(sorted(map(int,input().split())))]
sl=[tuple(list(map(int,input().split()))[::-1]) for a in range(sou)]
l=sorted(sl+cards,reverse=1)
s=0
for v,c in l:
s+=v*min(mai,c)
mai-=c
if mai<=0:break
p... | n,m=list(map(int,input().split()))
from collections import Counter as co
d=co(list(map(int,input().split())))
for i in range(m):
b,c=list(map(int,input().split()))
if c in d:d[c]+=b
else:d[c]=b
f=sorted(list(d.items()),reverse=1)
now =0
s=0
for k,v in f:
if now+v<=n:
now+=v
... | 11 | 18 | 321 | 367 | from itertools import groupby as gb
mai, sou = list(map(int, input().split()))
cards = [(e, len(list(f))) for e, f in gb(sorted(map(int, input().split())))]
sl = [tuple(list(map(int, input().split()))[::-1]) for a in range(sou)]
l = sorted(sl + cards, reverse=1)
s = 0
for v, c in l:
s += v * min(mai, c)
mai -=... | n, m = list(map(int, input().split()))
from collections import Counter as co
d = co(list(map(int, input().split())))
for i in range(m):
b, c = list(map(int, input().split()))
if c in d:
d[c] += b
else:
d[c] = b
f = sorted(list(d.items()), reverse=1)
now = 0
s = 0
for k, v in f:
if now +... | false | 38.888889 | [
"-from itertools import groupby as gb",
"+n, m = list(map(int, input().split()))",
"+from collections import Counter as co",
"-mai, sou = list(map(int, input().split()))",
"-cards = [(e, len(list(f))) for e, f in gb(sorted(map(int, input().split())))]",
"-sl = [tuple(list(map(int, input().split()))[::-1])... | false | 0.046224 | 0.070395 | 0.656633 | [
"s630239782",
"s962565218"
] |
u934940582 | p02606 | python | s800026921 | s616805122 | 29 | 25 | 8,976 | 9,092 | Accepted | Accepted | 13.79 | L,R,d = list(map(int,input().split()))
cnt = 0
for i in range(L,R + 1):
if i % d == 0:
cnt += 1
print(cnt) | L,R,d = list(map(int,input().split()))
print((R//d - (L-1)//d)) | 8 | 3 | 119 | 58 | L, R, d = list(map(int, input().split()))
cnt = 0
for i in range(L, R + 1):
if i % d == 0:
cnt += 1
print(cnt)
| L, R, d = list(map(int, input().split()))
print((R // d - (L - 1) // d))
| false | 62.5 | [
"-cnt = 0",
"-for i in range(L, R + 1):",
"- if i % d == 0:",
"- cnt += 1",
"-print(cnt)",
"+print((R // d - (L - 1) // d))"
] | false | 0.045994 | 0.045884 | 1.002381 | [
"s800026921",
"s616805122"
] |
u037430802 | p03525 | python | s411928648 | s944966356 | 85 | 23 | 3,444 | 3,444 | Accepted | Accepted | 72.94 | from collections import Counter
import copy
N = int(eval(input()))
D = list(map(int, input().split()))
if N == 1:
print((min(D[0], 24-D[0])))
exit()
D.append(0)
D.append(24) # 24-0のパターン
c = Counter(D)
times = []
p = []
for num, cnt in list(c.items()):
if (num == 0 or num == 12) and cnt ... |
from collections import Counter
from collections import defaultdict
N = list(map(int, input().split()))
D = list(map(int, input().split()))
c = Counter(D)
# 高橋君と同じ時間帯の人が一人でもいれば、時差の最小は常に0
if c[0] >= 2:
print((0))
exit(0)
# 高橋君との時差がdの人が3人以上いる場合も、時差の最小は常に0(同じ時間帯の都市に二人以上いることになるから)
for ... | 52 | 51 | 1,147 | 796 | from collections import Counter
import copy
N = int(eval(input()))
D = list(map(int, input().split()))
if N == 1:
print((min(D[0], 24 - D[0])))
exit()
D.append(0)
D.append(24) # 24-0のパターン
c = Counter(D)
times = []
p = []
for num, cnt in list(c.items()):
if (num == 0 or num == 12) and cnt >= 2:
# D... | from collections import Counter
from collections import defaultdict
N = list(map(int, input().split()))
D = list(map(int, input().split()))
c = Counter(D)
# 高橋君と同じ時間帯の人が一人でもいれば、時差の最小は常に0
if c[0] >= 2:
print((0))
exit(0)
# 高橋君との時差がdの人が3人以上いる場合も、時差の最小は常に0(同じ時間帯の都市に二人以上いることになるから)
for i in list(c.values()):
if... | false | 1.923077 | [
"-import copy",
"+from collections import defaultdict",
"-N = int(eval(input()))",
"+N = list(map(int, input().split()))",
"-if N == 1:",
"- print((min(D[0], 24 - D[0])))",
"- exit()",
"-D.append(0)",
"-D.append(24) # 24-0のパターン",
"-times = []",
"-p = []",
"-for num, cnt in list(c.items(... | false | 0.042517 | 0.111868 | 0.380069 | [
"s411928648",
"s944966356"
] |
u589886885 | p02265 | python | s495572266 | s251856678 | 3,170 | 1,580 | 71,892 | 71,924 | Accepted | Accepted | 50.16 | from collections import deque
n = int(eval(input()))
q = deque()
for i in range(n):
command = eval(input())
if command[0] == 'i':
q.appendleft(command[7:])
elif command[6] == ' ':
try:
q.remove(command[7:])
except Exception as e:
pass
elif ... | from collections import deque
import sys
n = int(sys.stdin.readline())
q = deque()
for i in range(n):
command = sys.stdin.readline()[:-1]
if command[0] == 'i':
q.appendleft(command[7:])
elif command[6] == ' ':
try:
q.remove(command[7:])
except Exception as ... | 20 | 21 | 397 | 440 | from collections import deque
n = int(eval(input()))
q = deque()
for i in range(n):
command = eval(input())
if command[0] == "i":
q.appendleft(command[7:])
elif command[6] == " ":
try:
q.remove(command[7:])
except Exception as e:
pass
elif command[6] == "... | from collections import deque
import sys
n = int(sys.stdin.readline())
q = deque()
for i in range(n):
command = sys.stdin.readline()[:-1]
if command[0] == "i":
q.appendleft(command[7:])
elif command[6] == " ":
try:
q.remove(command[7:])
except Exception as e:
... | false | 4.761905 | [
"+import sys",
"-n = int(eval(input()))",
"+n = int(sys.stdin.readline())",
"- command = eval(input())",
"+ command = sys.stdin.readline()[:-1]"
] | false | 0.035901 | 0.035709 | 1.005375 | [
"s495572266",
"s251856678"
] |
u773265208 | p02995 | python | s919338442 | s936473396 | 166 | 36 | 38,384 | 5,076 | Accepted | Accepted | 78.31 | def gcd(x,y):
while y:
x,y = y,x % y
return x
a,b,c,d = list(map(int,input().split()))
ans = 0
cd = c * d // gcd(c,d)
if a%c == 0:
start_c = a
else:
start_c = a + c - a % c
if a%d == 0:
start_d = a
else:
start_d = a + d - a % d
if a%cd == 0:
start_cd = a
else:
start_cd = a + cd - a %... | import math
from decimal import *
getcontext().prec = 50
a,b,c,d = list(map(int,input().split()))
from functools import reduce
def gcd(a,b):
if a < b:
a, b = b, a
while a % b != 0:
a, b = b, a % b
return b
def lcm_base(x, y):
return (x * y) // gcd(x, y)
def lcm_list(numbers):
retur... | 36 | 31 | 549 | 644 | def gcd(x, y):
while y:
x, y = y, x % y
return x
a, b, c, d = list(map(int, input().split()))
ans = 0
cd = c * d // gcd(c, d)
if a % c == 0:
start_c = a
else:
start_c = a + c - a % c
if a % d == 0:
start_d = a
else:
start_d = a + d - a % d
if a % cd == 0:
start_cd = a
else:
sta... | import math
from decimal import *
getcontext().prec = 50
a, b, c, d = list(map(int, input().split()))
from functools import reduce
def gcd(a, b):
if a < b:
a, b = b, a
while a % b != 0:
a, b = b, a % b
return b
def lcm_base(x, y):
return (x * y) // gcd(x, y)
def lcm_list(numbers):... | false | 13.888889 | [
"-def gcd(x, y):",
"- while y:",
"- x, y = y, x % y",
"- return x",
"+import math",
"+from decimal import *",
"+",
"+getcontext().prec = 50",
"+a, b, c, d = list(map(int, input().split()))",
"+from functools import reduce",
"-a, b, c, d = list(map(int, input().split()))",
"-ans = ... | false | 0.036606 | 0.061396 | 0.59622 | [
"s919338442",
"s936473396"
] |
u352394527 | p00231 | python | s635502946 | s778415175 | 110 | 100 | 5,628 | 5,624 | Accepted | Accepted | 9.09 | while True:
n = int(eval(input()))
if n == 0:
break
tlst = []
qlst = []
for _ in range(n):
m, a, b = list(map(int, input().split()))
qlst.append((m, a, b))
tlst.append(a)
tlst.append(b)
tlst.append(b - 1)
tlst = sorted(list(set(tlst)))
tlst.sort()
tdic = {}
for i... | while True:
n = int(eval(input()))
if n == 0:
break
tlst = []
qlst = []
for _ in range(n):
m, a, b = list(map(int, input().split()))
qlst.append((m, a, b))
tlst.append(a)
tlst.append(b)
tlst = sorted(list(set(tlst)))
tlst.sort()
tdic = {}
for i, t in enumerate(tlst):
... | 33 | 32 | 610 | 586 | while True:
n = int(eval(input()))
if n == 0:
break
tlst = []
qlst = []
for _ in range(n):
m, a, b = list(map(int, input().split()))
qlst.append((m, a, b))
tlst.append(a)
tlst.append(b)
tlst.append(b - 1)
tlst = sorted(list(set(tlst)))
tlst.sor... | while True:
n = int(eval(input()))
if n == 0:
break
tlst = []
qlst = []
for _ in range(n):
m, a, b = list(map(int, input().split()))
qlst.append((m, a, b))
tlst.append(a)
tlst.append(b)
tlst = sorted(list(set(tlst)))
tlst.sort()
tdic = {}
for i... | false | 3.030303 | [
"- tlst.append(b - 1)"
] | false | 0.075602 | 0.045157 | 1.674184 | [
"s635502946",
"s778415175"
] |
u572122511 | p03470 | python | s140531141 | s901477468 | 19 | 17 | 2,940 | 3,060 | Accepted | Accepted | 10.53 | N = int(eval(input()))
D = [int(eval(input())) for i in range(N)]
D = set(D)
print((len(D))) | N = int(eval(input()))
D = [int(eval(input())) for i in range(N)]
dic = {}
for i in range(len(D)):
dic[D[i]] = 1
print((len(dic))) | 4 | 7 | 81 | 127 | N = int(eval(input()))
D = [int(eval(input())) for i in range(N)]
D = set(D)
print((len(D)))
| N = int(eval(input()))
D = [int(eval(input())) for i in range(N)]
dic = {}
for i in range(len(D)):
dic[D[i]] = 1
print((len(dic)))
| false | 42.857143 | [
"-D = set(D)",
"-print((len(D)))",
"+dic = {}",
"+for i in range(len(D)):",
"+ dic[D[i]] = 1",
"+print((len(dic)))"
] | false | 0.047758 | 0.045732 | 1.044301 | [
"s140531141",
"s901477468"
] |
u825460912 | p03478 | python | s664029296 | s588754843 | 28 | 25 | 3,292 | 3,060 | Accepted | Accepted | 10.71 | N, A, B = list(map(int, input().split()))
l = []
ans = 0
for n in range(1, N+1):
count = 0
n_list = n
while True:
count += n%10
n = n//10
if n==0:
break
if A<= count <=B:
l.append(n_list)
for i in l:
ans += i
print(ans) | # 関数を使った場合
N, A, B = list(map(int, input().split()))
ans = 0
def FindSumOfDigits(x):
count = 0
while x>0:
count += x%10
x = x//10
return count
for n in range(1, N+1):
count = FindSumOfDigits(n)
if A<= count <=B:
ans += n
print(ans) | 20 | 19 | 301 | 301 | N, A, B = list(map(int, input().split()))
l = []
ans = 0
for n in range(1, N + 1):
count = 0
n_list = n
while True:
count += n % 10
n = n // 10
if n == 0:
break
if A <= count <= B:
l.append(n_list)
for i in l:
ans += i
print(ans)
| # 関数を使った場合
N, A, B = list(map(int, input().split()))
ans = 0
def FindSumOfDigits(x):
count = 0
while x > 0:
count += x % 10
x = x // 10
return count
for n in range(1, N + 1):
count = FindSumOfDigits(n)
if A <= count <= B:
ans += n
print(ans)
| false | 5 | [
"+# 関数を使った場合",
"-l = []",
"+",
"+",
"+def FindSumOfDigits(x):",
"+ count = 0",
"+ while x > 0:",
"+ count += x % 10",
"+ x = x // 10",
"+ return count",
"+",
"+",
"- count = 0",
"- n_list = n",
"- while True:",
"- count += n % 10",
"- n =... | false | 0.041652 | 0.04223 | 0.986302 | [
"s664029296",
"s588754843"
] |
u527993431 | p03680 | python | s566203164 | s478481730 | 222 | 176 | 7,084 | 13,052 | Accepted | Accepted | 20.72 | N=int(eval(input()))
L=[]
for i in range(N):
L.append(int(eval(input())))
count=0
ans=0
i=0
while(1):
count+=1
if count==N+100:
print((-1))
exit()
i=L[i]-1
ans+=1
if i==1:
print(ans)
exit() | N=int(eval(input()))
L=[]
count=0
t=0
for i in range(N):
L.append(int(eval(input())))
while(1):
count+=1
if count>N+10:
print((-1))
exit()
if L[t]==2:
print(count)
exit()
else:
t=L[t]-1 | 17 | 16 | 205 | 201 | N = int(eval(input()))
L = []
for i in range(N):
L.append(int(eval(input())))
count = 0
ans = 0
i = 0
while 1:
count += 1
if count == N + 100:
print((-1))
exit()
i = L[i] - 1
ans += 1
if i == 1:
print(ans)
exit()
| N = int(eval(input()))
L = []
count = 0
t = 0
for i in range(N):
L.append(int(eval(input())))
while 1:
count += 1
if count > N + 10:
print((-1))
exit()
if L[t] == 2:
print(count)
exit()
else:
t = L[t] - 1
| false | 5.882353 | [
"+count = 0",
"+t = 0",
"-count = 0",
"-ans = 0",
"-i = 0",
"- if count == N + 100:",
"+ if count > N + 10:",
"- i = L[i] - 1",
"- ans += 1",
"- if i == 1:",
"- print(ans)",
"+ if L[t] == 2:",
"+ print(count)",
"+ else:",
"+ t = L[t] - 1"
] | false | 0.198191 | 0.047749 | 4.150707 | [
"s566203164",
"s478481730"
] |
u583507988 | p03760 | python | s810505551 | s229307784 | 28 | 25 | 8,924 | 9,064 | Accepted | Accepted | 10.71 | o = input()
e = input()
ans = []
n = 0
while n < len(o)+len(e):
if n % 2 == 0:
ans.append(o[n//2])
else:
ans.append(e[n//2])
n += 1
print(*ans, sep='')
| o=input()
e=input()
n=len(o)
m=len(e)
ans=[]
for i in range(m):
ans.append(o[i])
ans.append(e[i])
if n-m==0:
print(*ans,sep='')
else:
ans.append(o[n-1])
print(*ans,sep='')
| 12 | 13 | 177 | 193 | o = input()
e = input()
ans = []
n = 0
while n < len(o) + len(e):
if n % 2 == 0:
ans.append(o[n // 2])
else:
ans.append(e[n // 2])
n += 1
print(*ans, sep="")
| o = input()
e = input()
n = len(o)
m = len(e)
ans = []
for i in range(m):
ans.append(o[i])
ans.append(e[i])
if n - m == 0:
print(*ans, sep="")
else:
ans.append(o[n - 1])
print(*ans, sep="")
| false | 7.692308 | [
"+n = len(o)",
"+m = len(e)",
"-n = 0",
"-while n < len(o) + len(e):",
"- if n % 2 == 0:",
"- ans.append(o[n // 2])",
"- else:",
"- ans.append(e[n // 2])",
"- n += 1",
"-print(*ans, sep=\"\")",
"+for i in range(m):",
"+ ans.append(o[i])",
"+ ans.append(e[i])",
... | false | 0.086017 | 0.068161 | 1.261972 | [
"s810505551",
"s229307784"
] |
u235376569 | p02773 | python | s020859624 | s312033402 | 719 | 639 | 32,096 | 32,096 | Accepted | Accepted | 11.13 | N=int(eval(input()))
l={}
for i in range(N):
s=eval(input())
if s in l:
l[s]+=1
else:
l[s]=1
# l=sorted(l,key=lambda x:x[1])
# ma=max(l)
# max_value=l[ma]
max_value=0
for i in l:
if max_value<l[i]:
max_value=l[i]
# print(max_value)
ans=[]
for i in l:
if max_value==l[i... | N=int(eval(input()))
l={}
for i in range(N):
s=eval(input())
if s in l:
l[s]+=1
else:
l[s]=1
# l=sorted(l,key=lambda x:x[1])
# ma=max(l)
max_value=max(l.values())
# max_value=0
# for i in l:
# if max_value<l[i]:
# max_value=l[i]
ans=[]
for i in l:
if max_value==l[i]:
... | 30 | 29 | 371 | 367 | N = int(eval(input()))
l = {}
for i in range(N):
s = eval(input())
if s in l:
l[s] += 1
else:
l[s] = 1
# l=sorted(l,key=lambda x:x[1])
# ma=max(l)
# max_value=l[ma]
max_value = 0
for i in l:
if max_value < l[i]:
max_value = l[i]
# print(max_value)
ans = []
for i in l:
if max_... | N = int(eval(input()))
l = {}
for i in range(N):
s = eval(input())
if s in l:
l[s] += 1
else:
l[s] = 1
# l=sorted(l,key=lambda x:x[1])
# ma=max(l)
max_value = max(l.values())
# max_value=0
# for i in l:
# if max_value<l[i]:
# max_value=l[i]
ans = []
for i in l:
if max_value == l[i]... | false | 3.333333 | [
"-# max_value=l[ma]",
"-max_value = 0",
"-for i in l:",
"- if max_value < l[i]:",
"- max_value = l[i]",
"-# print(max_value)",
"+max_value = max(l.values())",
"+# max_value=0",
"+# for i in l:",
"+# if max_value<l[i]:",
"+# max_value=l[i]"
] | false | 0.043724 | 0.085628 | 0.510627 | [
"s020859624",
"s312033402"
] |
u172147273 | p02779 | python | s443942658 | s033458473 | 154 | 82 | 32,844 | 26,800 | Accepted | Accepted | 46.75 | dic={}
n=int(eval(input()))
lis=list(map(int,input().split()))
for i in range(len(lis)):
if dic.get(lis[i],0)==0:
dic[lis[i]]=1
else:
print("NO")
exit()
print("YES") | n=eval(input())
l=list(map(int,input().split()))
if len(l)==len(set(l)):
print("YES")
else:print("NO")
| 10 | 5 | 200 | 105 | dic = {}
n = int(eval(input()))
lis = list(map(int, input().split()))
for i in range(len(lis)):
if dic.get(lis[i], 0) == 0:
dic[lis[i]] = 1
else:
print("NO")
exit()
print("YES")
| n = eval(input())
l = list(map(int, input().split()))
if len(l) == len(set(l)):
print("YES")
else:
print("NO")
| false | 50 | [
"-dic = {}",
"-n = int(eval(input()))",
"-lis = list(map(int, input().split()))",
"-for i in range(len(lis)):",
"- if dic.get(lis[i], 0) == 0:",
"- dic[lis[i]] = 1",
"- else:",
"- print(\"NO\")",
"- exit()",
"-print(\"YES\")",
"+n = eval(input())",
"+l = list(map(int... | false | 0.113979 | 0.080205 | 1.42109 | [
"s443942658",
"s033458473"
] |
u241159583 | p03785 | python | s233306371 | s949307251 | 254 | 193 | 7,384 | 14,168 | Accepted | Accepted | 24.02 | n,c,k = list(map(int, input().split()))
t = [int(eval(input())) for _ in range(n)]
t.sort()
T = 0
cnt = 0
ans = 0
for i in range(n):
if cnt == 0: #誰も待っていない
T = t[i] + k
cnt += 1
elif t[i] <= T:
cnt += 1
elif t[i] > T:
ans += 1
cnt = 1
T = t[i] + k
if cnt == c:
ans ... | n,c,k = list(map(int, input().split()))
t = sorted(list(int(eval(input())) for _ in range(n)))
#Ti以上Ti+k以下のバスに乗る
#定員はC人
T = 0
cnt = 0
bus = 0
for i in range(n):
if cnt == 0:
cnt += 1
T = t[i] + k
elif T >= t[i]:
cnt += 1
elif T < t[i]:
bus += 1
cnt ... | 23 | 25 | 371 | 434 | n, c, k = list(map(int, input().split()))
t = [int(eval(input())) for _ in range(n)]
t.sort()
T = 0
cnt = 0
ans = 0
for i in range(n):
if cnt == 0: # 誰も待っていない
T = t[i] + k
cnt += 1
elif t[i] <= T:
cnt += 1
elif t[i] > T:
ans += 1
cnt = 1
T = t[i] + k
if c... | n, c, k = list(map(int, input().split()))
t = sorted(list(int(eval(input())) for _ in range(n)))
# Ti以上Ti+k以下のバスに乗る
# 定員はC人
T = 0
cnt = 0
bus = 0
for i in range(n):
if cnt == 0:
cnt += 1
T = t[i] + k
elif T >= t[i]:
cnt += 1
elif T < t[i]:
bus += 1
cnt = 1
T =... | false | 8 | [
"-t = [int(eval(input())) for _ in range(n)]",
"-t.sort()",
"+t = sorted(list(int(eval(input())) for _ in range(n)))",
"+# Ti以上Ti+k以下のバスに乗る",
"+# 定員はC人",
"-ans = 0",
"+bus = 0",
"- if cnt == 0: # 誰も待っていない",
"+ if cnt == 0:",
"+ cnt += 1",
"+ elif T >= t[i]:",
"- elif t[i] <... | false | 0.04606 | 0.045817 | 1.005309 | [
"s233306371",
"s949307251"
] |
u014333473 | p03062 | python | s306335435 | s216564417 | 61 | 56 | 14,412 | 14,412 | Accepted | Accepted | 8.2 | N = int(eval(input()))
A =list(map(int, input().split()))
minus = [i for i in A if i < 0]
if len(minus) % 2 == 0:
max_num = [abs(i) for i in A]
print((sum(max_num)))
else:
max_num = [abs(i) for i in A]
if min(max_num) in A:
print((sum(max_num) - 2*min(max_num)))
else:
print((sum(max_num) + ... | N = int(eval(input()))
A =list(map(int, input().split()))
minus = [i for i in A if i < 0]
if len(minus) % 2 == 0:
max_num = [abs(i) for i in A]
print((sum(max_num)))
else:
max_num = [abs(i) for i in A]
print((sum(max_num) - (2*min(max_num)))) | 12 | 9 | 327 | 248 | N = int(eval(input()))
A = list(map(int, input().split()))
minus = [i for i in A if i < 0]
if len(minus) % 2 == 0:
max_num = [abs(i) for i in A]
print((sum(max_num)))
else:
max_num = [abs(i) for i in A]
if min(max_num) in A:
print((sum(max_num) - 2 * min(max_num)))
else:
print((sum(m... | N = int(eval(input()))
A = list(map(int, input().split()))
minus = [i for i in A if i < 0]
if len(minus) % 2 == 0:
max_num = [abs(i) for i in A]
print((sum(max_num)))
else:
max_num = [abs(i) for i in A]
print((sum(max_num) - (2 * min(max_num))))
| false | 25 | [
"- if min(max_num) in A:",
"- print((sum(max_num) - 2 * min(max_num)))",
"- else:",
"- print((sum(max_num) + -(2 * min(max_num))))",
"+ print((sum(max_num) - (2 * min(max_num))))"
] | false | 0.039873 | 0.040661 | 0.980623 | [
"s306335435",
"s216564417"
] |
u514401521 | p02719 | python | s873508320 | s564096012 | 190 | 18 | 38,256 | 2,940 | Accepted | Accepted | 90.53 | import sys
N, K = list(map(int,input().split()))
ans = N % K
ans = min(ans, abs(K-ans))
print(ans) | N, K = list(map(int, input().split()))
print((min(N%K, K-N%K))) | 6 | 3 | 98 | 58 | import sys
N, K = list(map(int, input().split()))
ans = N % K
ans = min(ans, abs(K - ans))
print(ans)
| N, K = list(map(int, input().split()))
print((min(N % K, K - N % K)))
| false | 50 | [
"-import sys",
"-",
"-ans = N % K",
"-ans = min(ans, abs(K - ans))",
"-print(ans)",
"+print((min(N % K, K - N % K)))"
] | false | 0.066143 | 0.065983 | 1.002419 | [
"s873508320",
"s564096012"
] |
u489959379 | p02765 | python | s677677372 | s449350926 | 177 | 18 | 38,384 | 2,940 | Accepted | Accepted | 89.83 | n, r = list(map(int, input().split()))
if n < 10:
print((r + 100*(10-n)))
else:
print(r) | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n, r = list(map(int, input().split()))
diff = 100 * (max(0, 10 - n))
print((r + diff))
if __name__ == '__main__':
resolve()
| 6 | 15 | 94 | 273 | n, r = list(map(int, input().split()))
if n < 10:
print((r + 100 * (10 - n)))
else:
print(r)
| import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n, r = list(map(int, input().split()))
diff = 100 * (max(0, 10 - n))
print((r + diff))
if __name__ == "__main__":
resolve()
| false | 60 | [
"-n, r = list(map(int, input().split()))",
"-if n < 10:",
"- print((r + 100 * (10 - n)))",
"-else:",
"- print(r)",
"+import sys",
"+",
"+sys.setrecursionlimit(10**7)",
"+input = sys.stdin.readline",
"+f_inf = float(\"inf\")",
"+mod = 10**9 + 7",
"+",
"+",
"+def resolve():",
"+ n... | false | 0.122655 | 0.043892 | 2.794502 | [
"s677677372",
"s449350926"
] |
u945181840 | p03141 | python | s693035274 | s779246954 | 262 | 211 | 33,068 | 33,068 | Accepted | Accepted | 19.47 | import sys
from operator import itemgetter
read = sys.stdin.read
N, *AB = list(map(int, read().split()))
A = AB[::2]
B = AB[1::2]
ab = [a + b for a, b in zip(A, B)]
ab, A, B = list(zip(*sorted(zip(ab, A, B), key=itemgetter(0), reverse=True)))
print((sum(A[::2]) - sum(B[1::2]))) | import sys
from operator import itemgetter
read = sys.stdin.read
def main():
N, *AB = list(map(int, read().split()))
A = AB[::2]
B = AB[1::2]
ab = [a + b for a, b in zip(A, B)]
ab, A, B = list(zip(*sorted(zip(ab, A, B), key=itemgetter(0), reverse=True)))
print((sum(A[::2]) - sum(B... | 10 | 17 | 274 | 359 | import sys
from operator import itemgetter
read = sys.stdin.read
N, *AB = list(map(int, read().split()))
A = AB[::2]
B = AB[1::2]
ab = [a + b for a, b in zip(A, B)]
ab, A, B = list(zip(*sorted(zip(ab, A, B), key=itemgetter(0), reverse=True)))
print((sum(A[::2]) - sum(B[1::2])))
| import sys
from operator import itemgetter
read = sys.stdin.read
def main():
N, *AB = list(map(int, read().split()))
A = AB[::2]
B = AB[1::2]
ab = [a + b for a, b in zip(A, B)]
ab, A, B = list(zip(*sorted(zip(ab, A, B), key=itemgetter(0), reverse=True)))
print((sum(A[::2]) - sum(B[1::2])))
... | false | 41.176471 | [
"-N, *AB = list(map(int, read().split()))",
"-A = AB[::2]",
"-B = AB[1::2]",
"-ab = [a + b for a, b in zip(A, B)]",
"-ab, A, B = list(zip(*sorted(zip(ab, A, B), key=itemgetter(0), reverse=True)))",
"-print((sum(A[::2]) - sum(B[1::2])))",
"+",
"+",
"+def main():",
"+ N, *AB = list(map(int, read(... | false | 0.036312 | 0.035614 | 1.019576 | [
"s693035274",
"s779246954"
] |
u321035578 | p02714 | python | s941311435 | s752121879 | 986 | 898 | 9,360 | 9,216 | Accepted | Accepted | 8.92 | def main():
n = int(eval(input()))
s = list(eval(input()))
r = [0] * n
g = [0] * n
b = [0] * n
# print(s)
for i, rgb in enumerate(s):
if rgb == 'R':
r[i] += 1
elif rgb == 'G':
g[i] += 1
else:
b[i] += 1
if i !... | def main():
n = int(eval(input()))
s = list(eval(input()))
r = 0
g = 0
b = 0
# print(s)
for i, rgb in enumerate(s):
if rgb == 'R':
r += 1
elif rgb == 'G':
g += 1
else:
b += 1
# print(r)
ans = 0
mid = ... | 58 | 55 | 1,459 | 1,304 | def main():
n = int(eval(input()))
s = list(eval(input()))
r = [0] * n
g = [0] * n
b = [0] * n
# print(s)
for i, rgb in enumerate(s):
if rgb == "R":
r[i] += 1
elif rgb == "G":
g[i] += 1
else:
b[i] += 1
if i != 0:
... | def main():
n = int(eval(input()))
s = list(eval(input()))
r = 0
g = 0
b = 0
# print(s)
for i, rgb in enumerate(s):
if rgb == "R":
r += 1
elif rgb == "G":
g += 1
else:
b += 1
# print(r)
ans = 0
mid = 0
# print('A')
... | false | 5.172414 | [
"- r = [0] * n",
"- g = [0] * n",
"- b = [0] * n",
"+ r = 0",
"+ g = 0",
"+ b = 0",
"- r[i] += 1",
"+ r += 1",
"- g[i] += 1",
"+ g += 1",
"- b[i] += 1",
"- if i != 0:",
"- r[i] += r[i - 1]",
"- ... | false | 0.037675 | 0.035374 | 1.065042 | [
"s941311435",
"s752121879"
] |
u670180528 | p03169 | python | s711230052 | s328885191 | 1,641 | 1,296 | 501,768 | 158,728 | Accepted | Accepted | 21.02 | n = int(eval(input()))
dp = [[[0] * (n + 1) for _ in range(n + 1)] for _ in range(n + 1)]
for thr in range(n + 1):
for two in range(n + 1):
for one in range(n + 1):
su = thr + two + one
if su > n or su == 0:
continue
#変更が起こるのに必要な回数の期待値
dp[thr][two][one] += n / su
#(各遷移先の期待値)×重み
if th... | def main():
n = int(eval(input()))
dp = [[[0] * (n - k - j + 1) for j in range(n - k + 1)] for k in range(n + 1)]
for thr in range(n + 1):
for two in range(n + 1):
for one in range(n + 1):
su = thr + two + one
if su > n or su == 0:
continue
dp[thr][two][one] += n / su
if thr:
... | 26 | 28 | 670 | 716 | n = int(eval(input()))
dp = [[[0] * (n + 1) for _ in range(n + 1)] for _ in range(n + 1)]
for thr in range(n + 1):
for two in range(n + 1):
for one in range(n + 1):
su = thr + two + one
if su > n or su == 0:
continue
# 変更が起こるのに必要な回数の期待値
dp[thr]... | def main():
n = int(eval(input()))
dp = [[[0] * (n - k - j + 1) for j in range(n - k + 1)] for k in range(n + 1)]
for thr in range(n + 1):
for two in range(n + 1):
for one in range(n + 1):
su = thr + two + one
if su > n or su == 0:
cont... | false | 7.142857 | [
"-n = int(eval(input()))",
"-dp = [[[0] * (n + 1) for _ in range(n + 1)] for _ in range(n + 1)]",
"-for thr in range(n + 1):",
"- for two in range(n + 1):",
"- for one in range(n + 1):",
"- su = thr + two + one",
"- if su > n or su == 0:",
"- continue",
... | false | 0.056681 | 0.078429 | 0.722708 | [
"s711230052",
"s328885191"
] |
u023229441 | p03557 | python | s403635843 | s685152423 | 331 | 258 | 23,328 | 29,552 | Accepted | Accepted | 22.05 | n=int(eval(input()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort() ; B.sort() ; C.sort()
import bisect as bi
ans=0
for i in B:
ans+= bi.bisect_left(A,i) * (n-bi.bisect_right(C,i))
print(ans)
| n=int(eval(input()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
import bisect as bi
ans=0
for i in range(n):
q=B[i]
oka= bi.bisect_left(A,q)
okb= n- bi.bisect_right(C,q)
ans+=oka*okb
print(ans) | 12 | 16 | 264 | 302 | n = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
import bisect as bi
ans = 0
for i in B:
ans += bi.bisect_left(A, i) * (n - bi.bisect_right(C, i))
print(ans)
| n = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
import bisect as bi
ans = 0
for i in range(n):
q = B[i]
oka = bi.bisect_left(A, q)
okb = n - bi.bisect_right(C, q)
ans += oka * okb
print(ans)
| false | 25 | [
"-for i in B:",
"- ans += bi.bisect_left(A, i) * (n - bi.bisect_right(C, i))",
"+for i in range(n):",
"+ q = B[i]",
"+ oka = bi.bisect_left(A, q)",
"+ okb = n - bi.bisect_right(C, q)",
"+ ans += oka * okb"
] | false | 0.101666 | 0.050252 | 2.023139 | [
"s403635843",
"s685152423"
] |
u597374218 | p03289 | python | s426576430 | s687901928 | 29 | 17 | 3,188 | 2,940 | Accepted | Accepted | 41.38 | import re
print(("AC" if re.match("^A[a-z]+C[a-z]+$",eval(input())) else "WA")) | s=eval(input())
print(("AC" if "C" in s[2:-1] and "A" in s and s[1:].replace("C","",1).islower() else "WA")) | 2 | 2 | 72 | 101 | import re
print(("AC" if re.match("^A[a-z]+C[a-z]+$", eval(input())) else "WA"))
| s = eval(input())
print(
(
"AC"
if "C" in s[2:-1] and "A" in s and s[1:].replace("C", "", 1).islower()
else "WA"
)
)
| false | 0 | [
"-import re",
"-",
"-print((\"AC\" if re.match(\"^A[a-z]+C[a-z]+$\", eval(input())) else \"WA\"))",
"+s = eval(input())",
"+print(",
"+ (",
"+ \"AC\"",
"+ if \"C\" in s[2:-1] and \"A\" in s and s[1:].replace(\"C\", \"\", 1).islower()",
"+ else \"WA\"",
"+ )",
"+)"
] | false | 0.043742 | 0.114206 | 0.383012 | [
"s426576430",
"s687901928"
] |
u994988729 | p02821 | python | s477006443 | s919552061 | 1,284 | 366 | 14,268 | 41,704 | Accepted | Accepted | 71.5 | import bisect
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
B = [0] * N
B[-1] = A[-1]
for i in range(N - 2, -1, -1):
B[i] = B[i+1]+A[i]
def C(mid):
tmp = 0
for a in A:
pos = bisect.bisect_right(A, mid - a)
tmp += N-pos
return tmp >... |
import numpy as np
N, M = list(map(int, input().split()))
A = np.array(input().split(), dtype=np.int32)
x = np.bincount(A)
fft_size = 1 << (2 * x.size + 10).bit_length()
fx = np.fft.rfft(x, fft_size)
conv = np.fft.irfft(fx * fx, fft_size)
conv = (conv + 0.5).astype(int)
tmp = np.arange(conv.size, dtype=... | 38 | 27 | 649 | 540 | import bisect
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
B = [0] * N
B[-1] = A[-1]
for i in range(N - 2, -1, -1):
B[i] = B[i + 1] + A[i]
def C(mid):
tmp = 0
for a in A:
pos = bisect.bisect_right(A, mid - a)
tmp += N - pos
return tmp > M
lb = ... | import numpy as np
N, M = list(map(int, input().split()))
A = np.array(input().split(), dtype=np.int32)
x = np.bincount(A)
fft_size = 1 << (2 * x.size + 10).bit_length()
fx = np.fft.rfft(x, fft_size)
conv = np.fft.irfft(fx * fx, fft_size)
conv = (conv + 0.5).astype(int)
tmp = np.arange(conv.size, dtype=int)
happy = tm... | false | 28.947368 | [
"-import bisect",
"+import numpy as np",
"-A = list(map(int, input().split()))",
"-A.sort()",
"-B = [0] * N",
"-B[-1] = A[-1]",
"-for i in range(N - 2, -1, -1):",
"- B[i] = B[i + 1] + A[i]",
"-",
"-",
"-def C(mid):",
"- tmp = 0",
"- for a in A:",
"- pos = bisect.bisect_righ... | false | 0.04454 | 0.608918 | 0.073146 | [
"s477006443",
"s919552061"
] |
u201234972 | p03786 | python | s561131268 | s455228493 | 564 | 453 | 14,224 | 14,428 | Accepted | Accepted | 19.68 | N = int( eval(input()))
A = list( map( int, input().split()))
A.sort()
l = -1
r = N-1
while r - l > 1:
m = (l+r)//2
now = sum(A[:m+1])
check = 1
for i in range(m+1,N):
if A[i] <= now*2:
now += A[i]
else:
check = 0
break
if check == 1... | from itertools import accumulate
N = int( eval(input()))
A = list( map( int, input().split()))
A.sort()
l = -1
r = N-1
B = list( accumulate(A))
while r - l > 1:
m = (l+r)//2
# now = sum(A[:m+1])
check = 1
for i in range(m+1,N):
if A[i] <= B[i-1]*2:
pass
else:
... | 20 | 22 | 368 | 426 | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
l = -1
r = N - 1
while r - l > 1:
m = (l + r) // 2
now = sum(A[: m + 1])
check = 1
for i in range(m + 1, N):
if A[i] <= now * 2:
now += A[i]
else:
check = 0
break
if check == 1:
... | from itertools import accumulate
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
l = -1
r = N - 1
B = list(accumulate(A))
while r - l > 1:
m = (l + r) // 2
# now = sum(A[:m+1])
check = 1
for i in range(m + 1, N):
if A[i] <= B[i - 1] * 2:
pass
else:
... | false | 9.090909 | [
"+from itertools import accumulate",
"+",
"+B = list(accumulate(A))",
"- now = sum(A[: m + 1])",
"+ # now = sum(A[:m+1])",
"- if A[i] <= now * 2:",
"- now += A[i]",
"+ if A[i] <= B[i - 1] * 2:",
"+ pass"
] | false | 0.04191 | 0.041547 | 1.008752 | [
"s561131268",
"s455228493"
] |
u380524497 | p03045 | python | s375767266 | s056083815 | 579 | 396 | 5,936 | 5,936 | Accepted | Accepted | 31.61 | class UnionFind:
def __init__(self, size):
self.parent = [-1] * size
self.rank = [1] * size
self.groups = size
def get_root(self, node):
parent = self.parent[node]
if parent == -1:
root = node
else:
root = self.get_root(parent)
... | import sys
input = sys.stdin.readline
class UnionFind:
def __init__(self, size):
self.parent = [-1] * size
self.rank = [1] * size
self.groups = size
def get_root(self, node):
parent = self.parent[node]
if parent == -1:
root = node
else... | 43 | 47 | 1,211 | 1,256 | class UnionFind:
def __init__(self, size):
self.parent = [-1] * size
self.rank = [1] * size
self.groups = size
def get_root(self, node):
parent = self.parent[node]
if parent == -1:
root = node
else:
root = self.get_root(parent)
... | import sys
input = sys.stdin.readline
class UnionFind:
def __init__(self, size):
self.parent = [-1] * size
self.rank = [1] * size
self.groups = size
def get_root(self, node):
parent = self.parent[node]
if parent == -1:
root = node
else:
... | false | 8.510638 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+"
] | false | 0.032875 | 0.067858 | 0.484461 | [
"s375767266",
"s056083815"
] |
u754022296 | p03040 | python | s765129715 | s998302902 | 1,355 | 541 | 11,128 | 11,140 | Accepted | Accepted | 60.07 | """
言い換えると次のことをすればよい
初期値をl = [], s = 0 として
'1 a b': lにaを追加、sにbを足す
'2': 中央値のインデックスより大きい要素の和-~~より小さい要素の和+sを出力
(要素が仮に昇順にソートされているなら、要素数をkとして、
sum(l[(k+1)//2:]) - sum(l[:k//2]) + s を出力、xとしてはl[(k-1)//2]を出力
"""
import heapq
less = []
greater = []
s = 0
sum_ = 0
q = int(eval(input()))
def query(n):
global s,... | import sys
input = sys.stdin.readline
import heapq
def main():
less = []
greater = []
s = 0
sum_ = 0
q = int(eval(input()))
def query(n):
nonlocal s, sum_
if n[0] == "1":
c, a, b = list(map(int, n.split()))
s += b
if len(less) == len(greater):
if not greate... | 46 | 44 | 1,011 | 964 | """
言い換えると次のことをすればよい
初期値をl = [], s = 0 として
'1 a b': lにaを追加、sにbを足す
'2': 中央値のインデックスより大きい要素の和-~~より小さい要素の和+sを出力
(要素が仮に昇順にソートされているなら、要素数をkとして、
sum(l[(k+1)//2:]) - sum(l[:k//2]) + s を出力、xとしてはl[(k-1)//2]を出力
"""
import heapq
less = []
greater = []
s = 0
sum_ = 0
q = int(eval(input()))
def query(n):
global s, sum_
if... | import sys
input = sys.stdin.readline
import heapq
def main():
less = []
greater = []
s = 0
sum_ = 0
q = int(eval(input()))
def query(n):
nonlocal s, sum_
if n[0] == "1":
c, a, b = list(map(int, n.split()))
s += b
if len(less) == len(greate... | false | 4.347826 | [
"-\"\"\"",
"-言い換えると次のことをすればよい",
"-初期値をl = [], s = 0 として",
"-'1 a b': lにaを追加、sにbを足す",
"-'2': 中央値のインデックスより大きい要素の和-~~より小さい要素の和+sを出力",
"-(要素が仮に昇順にソートされているなら、要素数をkとして、",
"-sum(l[(k+1)//2:]) - sum(l[:k//2]) + s を出力、xとしてはl[(k-1)//2]を出力",
"-\"\"\"",
"+import sys",
"+",
"+input = sys.stdin.readline",
"... | false | 0.044532 | 0.106698 | 0.417365 | [
"s765129715",
"s998302902"
] |
u693378622 | p02726 | python | s698313630 | s374457752 | 1,456 | 1,250 | 3,188 | 3,188 | Accepted | Accepted | 14.15 | n, x, y = list(map(int, input().split()))
x -= 1
y -= 1
ans = [0] * n
for j in range(n):
for i in range(j):
d = min(j-i, abs(x-i)+1+abs(j-y))
ans[d] += 1
print(( "\n".join( [str(d) for d in ans][1:] ))) | n, x, y = list(map(int, input().split()))
x -= 1
y -= 1
ans = [0] * n
for j in range(n):
for i in range(j):
d = min(j-i, abs(x-i)+1+abs(j-y))
ans[d] += 1
print(( "\n".join( [str(d) for d in ans[1:]] )))
| 12 | 12 | 218 | 219 | n, x, y = list(map(int, input().split()))
x -= 1
y -= 1
ans = [0] * n
for j in range(n):
for i in range(j):
d = min(j - i, abs(x - i) + 1 + abs(j - y))
ans[d] += 1
print(("\n".join([str(d) for d in ans][1:])))
| n, x, y = list(map(int, input().split()))
x -= 1
y -= 1
ans = [0] * n
for j in range(n):
for i in range(j):
d = min(j - i, abs(x - i) + 1 + abs(j - y))
ans[d] += 1
print(("\n".join([str(d) for d in ans[1:]])))
| false | 0 | [
"-print((\"\\n\".join([str(d) for d in ans][1:])))",
"+print((\"\\n\".join([str(d) for d in ans[1:]])))"
] | false | 0.040205 | 0.037734 | 1.065487 | [
"s698313630",
"s374457752"
] |
u905203728 | p02616 | python | s553355431 | s004871868 | 456 | 303 | 112,260 | 112,456 | Accepted | Accepted | 33.55 | import sys
input=sys.stdin.readline
mod=10**9+7
n,k=list(map(int,input().split()))
A=list(map(int,input().split()))
K=k
B,C=[],[]
for i in A:
if i>=0:B.append(i)
else:C.append(i)
B.sort()
C.sort(key=lambda x:abs(x))
ans,flag=1,1
while k!=0:
if k>=2:
point=0
if len(B)>=2... | n,k=list(map(int,input().split()))
A=list(map(int,input().split()))
mod=10**9+7
count=k
B,C=[],[]
for i in A:
if i<=0:B.append(i)
else:C.append(i)
B.sort(key=lambda x:abs(x))
C.sort()
ans,flag=1,1
while k!=0:
if k>=2:
if len(B)>=2 and len(C)>=2:
if B[-1]*B[-2]>C[-1]*C[-... | 42 | 44 | 854 | 907 | import sys
input = sys.stdin.readline
mod = 10**9 + 7
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
K = k
B, C = [], []
for i in A:
if i >= 0:
B.append(i)
else:
C.append(i)
B.sort()
C.sort(key=lambda x: abs(x))
ans, flag = 1, 1
while k != 0:
if k >= 2:
p... | n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
mod = 10**9 + 7
count = k
B, C = [], []
for i in A:
if i <= 0:
B.append(i)
else:
C.append(i)
B.sort(key=lambda x: abs(x))
C.sort()
ans, flag = 1, 1
while k != 0:
if k >= 2:
if len(B) >= 2 and len(C) >= 2:
... | false | 4.545455 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-mod = 10**9 + 7",
"-K = k",
"+mod = 10**9 + 7",
"+count = k",
"- if i >= 0:",
"+ if i <= 0:",
"-B.sort()",
"-C.sort(key=lambda x: abs(x))",
"+B.sort(key=lambda x: abs(x))",
"+C.sort()",
"- point = 0",
"- ans... | false | 0.036307 | 0.036163 | 1.003975 | [
"s553355431",
"s004871868"
] |
u644907318 | p03693 | python | s652311773 | s052277348 | 151 | 63 | 12,488 | 61,756 | Accepted | Accepted | 58.28 | import numpy as np
r,g,b = list(map(int,input().split()))
if (100*r+10*g+b)%4==0:
print("YES")
else:
print("NO") | r,g,b = input().split()
if int(r+g+b)%4==0:
print("YES")
else:
print("NO") | 6 | 5 | 119 | 86 | import numpy as np
r, g, b = list(map(int, input().split()))
if (100 * r + 10 * g + b) % 4 == 0:
print("YES")
else:
print("NO")
| r, g, b = input().split()
if int(r + g + b) % 4 == 0:
print("YES")
else:
print("NO")
| false | 16.666667 | [
"-import numpy as np",
"-",
"-r, g, b = list(map(int, input().split()))",
"-if (100 * r + 10 * g + b) % 4 == 0:",
"+r, g, b = input().split()",
"+if int(r + g + b) % 4 == 0:"
] | false | 0.037566 | 0.064312 | 0.584114 | [
"s652311773",
"s052277348"
] |
u994988729 | p02955 | python | s775178285 | s903238277 | 576 | 150 | 3,188 | 3,188 | Accepted | Accepted | 73.96 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
Asum = sum(A)
div = set()
for i in range(1, int(Asum ** 0.5 + 0.5) + 1):
if Asum % i == 0:
div.add(i)
div.add(Asum//i)
ans = 1
for d in div:
now = 10 ** 18
R = [a % d for a in A]
R.sort()
Rsum... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
Asum = sum(A)
div = set()
for i in range(1, int(Asum ** 0.5 + 0.5) + 1):
if Asum % i == 0:
div.add(i)
div.add(Asum//i)
ans = 1
for d in div:
R = [a % d for a in A]
R.sort()
r = sum(R) // d
l =... | 26 | 20 | 514 | 402 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
Asum = sum(A)
div = set()
for i in range(1, int(Asum**0.5 + 0.5) + 1):
if Asum % i == 0:
div.add(i)
div.add(Asum // i)
ans = 1
for d in div:
now = 10**18
R = [a % d for a in A]
R.sort()
Rsum = sum(d - r for r ... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
Asum = sum(A)
div = set()
for i in range(1, int(Asum**0.5 + 0.5) + 1):
if Asum % i == 0:
div.add(i)
div.add(Asum // i)
ans = 1
for d in div:
R = [a % d for a in A]
R.sort()
r = sum(R) // d
l = N - r
need =... | false | 23.076923 | [
"- now = 10**18",
"- Rsum = sum(d - r for r in R)",
"- Lsum = 0",
"- for r in R:",
"- Lsum += r",
"- Rsum -= d - r",
"- now = min(now, max(Lsum, Rsum))",
"- if now <= K:",
"+ r = sum(R) // d",
"+ l = N - r",
"+ need = sum(R[:l])",
"+ if need <= K... | false | 0.096314 | 0.076653 | 1.256495 | [
"s775178285",
"s903238277"
] |
u254871849 | p03548 | python | s927459715 | s235115125 | 25 | 17 | 2,940 | 2,940 | Accepted | Accepted | 32 | import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
def main():
x, y, z = (int(i) for i in sys.stdin.read().split())
n = 0
while True:
total = (n + 1) * z + n * y
if total <= x: n += 1; continue
... | import sys
L, l, d = list(map(int, sys.stdin.readline().split()))
def main():
x = (L - d) // (l + d)
return x
if __name__ == '__main__':
ans = main()
print(ans) | 23 | 11 | 493 | 183 | import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
def main():
x, y, z = (int(i) for i in sys.stdin.read().split())
n = 0
while True:
total = (n + 1) * z + n * y
if total <= x:
n += 1
conti... | import sys
L, l, d = list(map(int, sys.stdin.readline().split()))
def main():
x = (L - d) // (l + d)
return x
if __name__ == "__main__":
ans = main()
print(ans)
| false | 52.173913 | [
"-# import collections",
"-# import math",
"-# import string",
"-# import bisect",
"-# import re",
"-# import itertools",
"-# import statistics",
"+L, l, d = list(map(int, sys.stdin.readline().split()))",
"+",
"+",
"- x, y, z = (int(i) for i in sys.stdin.read().split())",
"- n = 0",
"-... | false | 0.047971 | 0.044611 | 1.075303 | [
"s927459715",
"s235115125"
] |
u774411119 | p03478 | python | s601237639 | s199327994 | 39 | 36 | 3,060 | 3,060 | Accepted | Accepted | 7.69 | INPUT=eval(input())
IN=INPUT.split(" ")
#N=int(IN[0])
number=int(IN[0])
#N
A=int(IN[1])
B=int(IN[2])
GOUKEI=0
kazu=0
while kazu<=number:
X=list(map(int,list(str(kazu))))
#X = list(map(int, n))
#print(X)
if A<=sum(X)<=B:
GOUKEI+=kazu
#print("add",kazu)
kazu+=1... | N, A, B = list(map(int, input().split()))
sum_N = 0
for i in range(N+1):
if A <= sum(list(map(int, list(str(i))))) <= B:
sum_N += i
print(sum_N)
| 21 | 8 | 330 | 160 | INPUT = eval(input())
IN = INPUT.split(" ")
# N=int(IN[0])
number = int(IN[0])
# N
A = int(IN[1])
B = int(IN[2])
GOUKEI = 0
kazu = 0
while kazu <= number:
X = list(map(int, list(str(kazu))))
# X = list(map(int, n))
# print(X)
if A <= sum(X) <= B:
GOUKEI += kazu
# print("add",kazu)
ka... | N, A, B = list(map(int, input().split()))
sum_N = 0
for i in range(N + 1):
if A <= sum(list(map(int, list(str(i))))) <= B:
sum_N += i
print(sum_N)
| false | 61.904762 | [
"-INPUT = eval(input())",
"-IN = INPUT.split(\" \")",
"-# N=int(IN[0])",
"-number = int(IN[0])",
"-# N",
"-A = int(IN[1])",
"-B = int(IN[2])",
"-GOUKEI = 0",
"-kazu = 0",
"-while kazu <= number:",
"- X = list(map(int, list(str(kazu))))",
"- # X = list(map(int, n))",
"- # print(X)",
... | false | 0.046964 | 0.04621 | 1.01632 | [
"s601237639",
"s199327994"
] |
u130900604 | p03476 | python | s570827464 | s086493010 | 1,844 | 1,003 | 24,556 | 53,704 | Accepted | Accepted | 45.61 | import numpy as np
MAX_N=10**5
prime=np.full(MAX_N+1,True)
prime[:2]=False #0,1をFalseにしてる
for p in range(2,int(MAX_N**.5)+1):
if prime[p]:
prime[p*p::p]=False #p:素数の倍数をFalseに変える
like2017=np.zeros(MAX_N+1,dtype=np.int64)
for p in range(1,MAX_N+1):
if 2*p>MAX_N: #(p+1)//2をpとよみかえると、pと2*p-1になる
brea... | U=10**5
is_prime=[True]*(U+1)
is_prime[0]=False
is_prime[1]=False
for p in range(2,U+1):
if p*p>U:
break
if is_prime[p]:
for j in range(p*p,U+1,p):
is_prime[j]=False
is_2017like=[0]*(U+1)
for p in range(1,U+1):
if (p+1)//2>U:
break
tmp=(is_prime[p] and... | 21 | 22 | 535 | 510 | import numpy as np
MAX_N = 10**5
prime = np.full(MAX_N + 1, True)
prime[:2] = False # 0,1をFalseにしてる
for p in range(2, int(MAX_N**0.5) + 1):
if prime[p]:
prime[p * p :: p] = False # p:素数の倍数をFalseに変える
like2017 = np.zeros(MAX_N + 1, dtype=np.int64)
for p in range(1, MAX_N + 1):
if 2 * p > MAX_N: # (p+1... | U = 10**5
is_prime = [True] * (U + 1)
is_prime[0] = False
is_prime[1] = False
for p in range(2, U + 1):
if p * p > U:
break
if is_prime[p]:
for j in range(p * p, U + 1, p):
is_prime[j] = False
is_2017like = [0] * (U + 1)
for p in range(1, U + 1):
if (p + 1) // 2 > U:
brea... | false | 4.545455 | [
"-import numpy as np",
"-",
"-MAX_N = 10**5",
"-prime = np.full(MAX_N + 1, True)",
"-prime[:2] = False # 0,1をFalseにしてる",
"-for p in range(2, int(MAX_N**0.5) + 1):",
"- if prime[p]:",
"- prime[p * p :: p] = False # p:素数の倍数をFalseに変える",
"-like2017 = np.zeros(MAX_N + 1, dtype=np.int64)",
"... | false | 0.249475 | 0.10628 | 2.347322 | [
"s570827464",
"s086493010"
] |
u888092736 | p03137 | python | s171241064 | s100764107 | 90 | 81 | 19,988 | 20,424 | Accepted | Accepted | 10 | N, M, *X = list(map(int, open(0).read().split()))
if N >= M:
print((0))
exit()
X.sort()
diff = []
for i in range(M - 1):
diff.append(X[i + 1] - X[i])
diff.sort()
print((sum(diff[: M - N])))
| from itertools import tee
def pairwise(iterable):
"s -> (s0,s1), (s1,s2), (s2, s3), ..."
a, b = tee(iterable)
next(b, None)
return list(zip(a, b))
N, M, *X = list(map(int, open(0).read().split()))
if N >= M:
print((0))
exit()
X.sort()
diffs = [cur - prev for prev, cur in pai... | 13 | 19 | 207 | 358 | N, M, *X = list(map(int, open(0).read().split()))
if N >= M:
print((0))
exit()
X.sort()
diff = []
for i in range(M - 1):
diff.append(X[i + 1] - X[i])
diff.sort()
print((sum(diff[: M - N])))
| from itertools import tee
def pairwise(iterable):
"s -> (s0,s1), (s1,s2), (s2, s3), ..."
a, b = tee(iterable)
next(b, None)
return list(zip(a, b))
N, M, *X = list(map(int, open(0).read().split()))
if N >= M:
print((0))
exit()
X.sort()
diffs = [cur - prev for prev, cur in pairwise(X)]
diffs.s... | false | 31.578947 | [
"+from itertools import tee",
"+",
"+",
"+def pairwise(iterable):",
"+ \"s -> (s0,s1), (s1,s2), (s2, s3), ...\"",
"+ a, b = tee(iterable)",
"+ next(b, None)",
"+ return list(zip(a, b))",
"+",
"+",
"-diff = []",
"-for i in range(M - 1):",
"- diff.append(X[i + 1] - X[i])",
"-d... | false | 0.046003 | 0.044025 | 1.044944 | [
"s171241064",
"s100764107"
] |
u867826040 | p02659 | python | s861453442 | s867911771 | 26 | 23 | 9,936 | 9,172 | Accepted | Accepted | 11.54 | from decimal import Decimal
a,b = list(map(Decimal,input().split()))
print((Decimal(a*b)//1)) | a,b = input().split()
b = list(b)
b.pop(-3)
b = int("".join(b))
print(((int(a)*b)//100)) | 3 | 5 | 87 | 90 | from decimal import Decimal
a, b = list(map(Decimal, input().split()))
print((Decimal(a * b) // 1))
| a, b = input().split()
b = list(b)
b.pop(-3)
b = int("".join(b))
print(((int(a) * b) // 100))
| false | 40 | [
"-from decimal import Decimal",
"-",
"-a, b = list(map(Decimal, input().split()))",
"-print((Decimal(a * b) // 1))",
"+a, b = input().split()",
"+b = list(b)",
"+b.pop(-3)",
"+b = int(\"\".join(b))",
"+print(((int(a) * b) // 100))"
] | false | 0.142903 | 0.055774 | 2.562153 | [
"s861453442",
"s867911771"
] |
u969850098 | p02720 | python | s652578827 | s662267912 | 205 | 104 | 17,004 | 12,896 | Accepted | Accepted | 49.27 | from collections import deque
def main():
K = int(eval(input()))
que = deque(['1', '2', '3', '4', '5', '6', '7', '8', '9'])
while K:
if K == 1:
ans = que.popleft()
break
K -= 1
v = que.popleft()
if v[-1] == '0':
que.append(... | from collections import deque
def main():
K = int(eval(input()))
que = deque([i for i in range(1, 10)])
while K:
if K == 1:
ans = que.popleft()
break
K -= 1
v = que.popleft()
if v % 10 == 0:
que.append(v * 10)
qu... | 28 | 26 | 667 | 643 | from collections import deque
def main():
K = int(eval(input()))
que = deque(["1", "2", "3", "4", "5", "6", "7", "8", "9"])
while K:
if K == 1:
ans = que.popleft()
break
K -= 1
v = que.popleft()
if v[-1] == "0":
que.append(v + "0")
... | from collections import deque
def main():
K = int(eval(input()))
que = deque([i for i in range(1, 10)])
while K:
if K == 1:
ans = que.popleft()
break
K -= 1
v = que.popleft()
if v % 10 == 0:
que.append(v * 10)
que.append(v * 1... | false | 7.142857 | [
"- que = deque([\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\"])",
"+ que = deque([i for i in range(1, 10)])",
"- if v[-1] == \"0\":",
"- que.append(v + \"0\")",
"- que.append(v + \"1\")",
"- elif v[-1] == \"9\":",
"- que.append(v + \"8... | false | 0.067579 | 0.082109 | 0.823046 | [
"s652578827",
"s662267912"
] |
u941753895 | p03262 | python | s408929569 | s714667222 | 173 | 90 | 16,240 | 16,508 | Accepted | Accepted | 47.98 | import fractions
n,x=list(map(int,input().split()))
if n==1:
print((abs(x-int(eval(input())))))
exit()
l=list(map(int,input().split()))
l.append(x)
l.sort()
l2=[]
for i in range(1,n+1):
l2.append(l[i]-l[i-1])
a=10000000000
for i in range(len(l2)-1):
b=fractions.gcd(l2[i],l2[i+1])
if b<a:
a=... | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
def LI(): return list(map(int,input().split()))
def I(): return int(eval(input()))
def LS(): return input().split()
def S(): return eval(input())
# GCD
def gcd(x,y)... | 17 | 28 | 318 | 478 | import fractions
n, x = list(map(int, input().split()))
if n == 1:
print((abs(x - int(eval(input())))))
exit()
l = list(map(int, input().split()))
l.append(x)
l.sort()
l2 = []
for i in range(1, n + 1):
l2.append(l[i] - l[i - 1])
a = 10000000000
for i in range(len(l2) - 1):
b = fractions.gcd(l2[i], l2[i... | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI():
return list(map(int, input().split()))
def I():
return int(eval(input()))
def LS():
return input().split()
def S():
return eval... | false | 39.285714 | [
"-import fractions",
"+import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time",
"-n, x = list(map(int, input().split()))",
"-if n == 1:",
"- print((abs(x - int(eval(input())))))",
"- exit()",
"-l = list(map(int, input().split()))",
"-l.append(x)",
"... | false | 0.061179 | 0.088929 | 0.687947 | [
"s408929569",
"s714667222"
] |
u097750021 | p04001 | python | s072830835 | s504517203 | 21 | 18 | 3,064 | 3,060 | Accepted | Accepted | 14.29 | s = eval(input())
ans = 0
n = len(s) - 1
m = 2 ** n
for i in range(m):
bit = bin(i)[2:len(bin(i))]
a = n - len(bit)
if a != 0:
bit = '0'*a + bit
tmp = int(s[0])
for j in range(n):
if bit[j] == '0':
tmp = 10*tmp + int(s[j+1])
elif bit[j] == '1':
... | s = eval(input())
n = len(s)
def dfs(i, l):
if i == n-1:
return sum(list(map(int, l.split("+"))))
return dfs(i+1, l+s[i+1]) + dfs(i+1, l+"+"+s[i+1])
print((dfs(0, s[0])))
| 18 | 8 | 391 | 187 | s = eval(input())
ans = 0
n = len(s) - 1
m = 2**n
for i in range(m):
bit = bin(i)[2 : len(bin(i))]
a = n - len(bit)
if a != 0:
bit = "0" * a + bit
tmp = int(s[0])
for j in range(n):
if bit[j] == "0":
tmp = 10 * tmp + int(s[j + 1])
elif bit[j] == "1":
a... | s = eval(input())
n = len(s)
def dfs(i, l):
if i == n - 1:
return sum(list(map(int, l.split("+"))))
return dfs(i + 1, l + s[i + 1]) + dfs(i + 1, l + "+" + s[i + 1])
print((dfs(0, s[0])))
| false | 55.555556 | [
"-ans = 0",
"-n = len(s) - 1",
"-m = 2**n",
"-for i in range(m):",
"- bit = bin(i)[2 : len(bin(i))]",
"- a = n - len(bit)",
"- if a != 0:",
"- bit = \"0\" * a + bit",
"- tmp = int(s[0])",
"- for j in range(n):",
"- if bit[j] == \"0\":",
"- tmp = 10 * tmp... | false | 0.04216 | 0.044705 | 0.943073 | [
"s072830835",
"s504517203"
] |
u970899068 | p02788 | python | s093082121 | s748339911 | 1,248 | 1,095 | 90,568 | 84,444 | Accepted | Accepted | 12.26 | import sys
input = sys.stdin.readline
import bisect
import collections
from collections import deque
n,d,a= list(map(int, input().split()))
x= [list(map(int, input().split())) for i in range(n)]
x.sort()
y=[]
for i in range(n):
y.append(x[i][0])
x[i][1]=-(-x[i][1]//a)
# どのモンスターまで倒したか管理しながら進める。
... | import sys
input = sys.stdin.readline
import collections
from collections import deque
n,d,a= list(map(int, input().split()))
x= [list(map(int, input().split())) for i in range(n)]
x.sort()
for i in range(n):
x[i][1]=-(-x[i][1]//a)
# どのモンスターまで倒したか管理しながら進める。
# 累積ダメージを管理
qq=deque([])
ans=0
atk=0
for... | 33 | 29 | 674 | 597 | import sys
input = sys.stdin.readline
import bisect
import collections
from collections import deque
n, d, a = list(map(int, input().split()))
x = [list(map(int, input().split())) for i in range(n)]
x.sort()
y = []
for i in range(n):
y.append(x[i][0])
x[i][1] = -(-x[i][1] // a)
# どのモンスターまで倒したか管理しながら進める。
# 累積ダ... | import sys
input = sys.stdin.readline
import collections
from collections import deque
n, d, a = list(map(int, input().split()))
x = [list(map(int, input().split())) for i in range(n)]
x.sort()
for i in range(n):
x[i][1] = -(-x[i][1] // a)
# どのモンスターまで倒したか管理しながら進める。
# 累積ダメージを管理
qq = deque([])
ans = 0
atk = 0
for i... | false | 12.121212 | [
"-import bisect",
"-y = []",
"- y.append(x[i][0])",
"- # iがダメージの有効期限を超過している場合",
"- while len(qq) > 0 and i > qq[0][0]:",
"+ # ダメージの有効期限を超過している場合",
"+ while len(qq) > 0 and x[i][0] > qq[0][0]:",
"- q = bisect.bisect_right(y, x[i][0] + 2 * d) - 1",
"- qq.append([q, w - atk... | false | 0.03983 | 0.046208 | 0.861973 | [
"s093082121",
"s748339911"
] |
u127499732 | p03504 | python | s058234643 | s151857775 | 417 | 247 | 130,228 | 38,524 | Accepted | Accepted | 40.77 | def main():
from itertools import accumulate
n, c, *stc = list(map(int, open(0).read().split()))
table = [0] * (10 ** 5 + 2)
m = sorted(list(zip(*[iter(stc)] * 3)), key=lambda a: (a[2], a[0], a[1]))
ch_ = 0
t_ = 0
for s, t, ch in m:
if ch != ch_:
ch_ = ch
... | def main():
from itertools import accumulate
n, c, *stc = list(map(int, open(0).read().split()))
table = [0] * (10 ** 5 + 2)
m = sorted(list(zip(*[iter(stc)] * 3)), key=lambda a: (a[2], a[0]))
ch_ = 0
t_ = 0
for s, t, ch in m:
if ch != ch_:
ch_ = ch
... | 28 | 28 | 580 | 574 | def main():
from itertools import accumulate
n, c, *stc = list(map(int, open(0).read().split()))
table = [0] * (10**5 + 2)
m = sorted(list(zip(*[iter(stc)] * 3)), key=lambda a: (a[2], a[0], a[1]))
ch_ = 0
t_ = 0
for s, t, ch in m:
if ch != ch_:
ch_ = ch
t_ = ... | def main():
from itertools import accumulate
n, c, *stc = list(map(int, open(0).read().split()))
table = [0] * (10**5 + 2)
m = sorted(list(zip(*[iter(stc)] * 3)), key=lambda a: (a[2], a[0]))
ch_ = 0
t_ = 0
for s, t, ch in m:
if ch != ch_:
ch_ = ch
t_ = 0
... | false | 0 | [
"- m = sorted(list(zip(*[iter(stc)] * 3)), key=lambda a: (a[2], a[0], a[1]))",
"+ m = sorted(list(zip(*[iter(stc)] * 3)), key=lambda a: (a[2], a[0]))"
] | false | 0.08033 | 0.077584 | 1.035385 | [
"s058234643",
"s151857775"
] |
u813953440 | p02887 | python | s708291823 | s000227984 | 73 | 37 | 4,212 | 4,852 | Accepted | Accepted | 49.32 | N = int(eval(input()))
S = eval(input())
#print(S)
cnt = 1
S_list = [s for s in S]
#print(S_list)
for i in range(N):
if S_list[N-1-i] != S_list[N-1-(i+1)] and N-1-(i+1)>=0:
#S_list.insert(N-1-i,"|")
cnt += 1
#print(S_list)
print(cnt) | N = int(eval(input()))
S = eval(input())
#print(S)
cnt = 1
S_list = [s for s in S]
S_list1 = S_list[1:]
for s,s1 in zip(S_list,S_list1):
if s != s1:
cnt += 1
print(cnt) | 12 | 10 | 256 | 177 | N = int(eval(input()))
S = eval(input())
# print(S)
cnt = 1
S_list = [s for s in S]
# print(S_list)
for i in range(N):
if S_list[N - 1 - i] != S_list[N - 1 - (i + 1)] and N - 1 - (i + 1) >= 0:
# S_list.insert(N-1-i,"|")
cnt += 1
# print(S_list)
print(cnt)
| N = int(eval(input()))
S = eval(input())
# print(S)
cnt = 1
S_list = [s for s in S]
S_list1 = S_list[1:]
for s, s1 in zip(S_list, S_list1):
if s != s1:
cnt += 1
print(cnt)
| false | 16.666667 | [
"-# print(S_list)",
"-for i in range(N):",
"- if S_list[N - 1 - i] != S_list[N - 1 - (i + 1)] and N - 1 - (i + 1) >= 0:",
"- # S_list.insert(N-1-i,\"|\")",
"+S_list1 = S_list[1:]",
"+for s, s1 in zip(S_list, S_list1):",
"+ if s != s1:",
"- # print(S_list)"
] | false | 0.047099 | 0.070169 | 0.671222 | [
"s708291823",
"s000227984"
] |
u260980560 | p00631 | python | s001433215 | s076313725 | 1,530 | 760 | 4,248 | 4,240 | Accepted | Accepted | 50.33 | A = 0
def solve(l,c,sa,sb):
if 2*sa>=A: return 2*sa-A
if 2*sb>=A: return 2*sb-A
return min(solve(l,c+1,sa+l[c],sb),solve(l,c+1,sa,sb+l[c]))
while 1:
n = eval(input())
if n==0: break
a = list(map(int, input().split()))
ans = 10**7; A = sum(a);
print(solve(a,0,0,0)) | A = 0
def solve(l,c,sa,sb):
if 2*sa>=A: return 2*sa-A
if 2*sb>=A: return 2*sb-A
return min(solve(l,c+1,sa+l[c],sb),solve(l,c+1,sa,sb+l[c]))
while 1:
n = eval(input())
if n==0: break
a = list(map(int, input().split()))
ans = 10**7; A = sum(a);
print(solve(a,1,a[0],0)) | 11 | 11 | 297 | 300 | A = 0
def solve(l, c, sa, sb):
if 2 * sa >= A:
return 2 * sa - A
if 2 * sb >= A:
return 2 * sb - A
return min(solve(l, c + 1, sa + l[c], sb), solve(l, c + 1, sa, sb + l[c]))
while 1:
n = eval(input())
if n == 0:
break
a = list(map(int, input().split()))
ans = 10**... | A = 0
def solve(l, c, sa, sb):
if 2 * sa >= A:
return 2 * sa - A
if 2 * sb >= A:
return 2 * sb - A
return min(solve(l, c + 1, sa + l[c], sb), solve(l, c + 1, sa, sb + l[c]))
while 1:
n = eval(input())
if n == 0:
break
a = list(map(int, input().split()))
ans = 10**... | false | 0 | [
"- print(solve(a, 0, 0, 0))",
"+ print(solve(a, 1, a[0], 0))"
] | false | 0.07391 | 0.036806 | 2.008085 | [
"s001433215",
"s076313725"
] |
u128236306 | p02388 | python | s448391811 | s719055299 | 30 | 20 | 7,536 | 7,624 | Accepted | Accepted | 33.33 | x = int(eval(input()))
print((x ** 3)) | x = eval(input())
x = int(x)
print((x ** 3)) | 2 | 3 | 31 | 38 | x = int(eval(input()))
print((x**3))
| x = eval(input())
x = int(x)
print((x**3))
| false | 33.333333 | [
"-x = int(eval(input()))",
"+x = eval(input())",
"+x = int(x)"
] | false | 0.037714 | 0.041727 | 0.903827 | [
"s448391811",
"s719055299"
] |
u368796742 | p02559 | python | s087185639 | s917732185 | 3,937 | 2,854 | 65,116 | 65,052 | Accepted | Accepted | 27.51 | class BIT:
def __init__(self, n):
self.size = n
self.tree = [0]*(n+1)
def make(self, list):
self.tree[1:] = list.copy()
for i in range(self.size+1):
j = i + (i & (-i))
if j < self.size+1:
self.tree[j] += self.tree[i]
... | import sys
input = sys.stdin.readline
class BIT:
def __init__(self, n):
self.size = n
self.tree = [0]*(n+1)
def make(self, list):
self.tree[1:] = list.copy()
for i in range(self.size+1):
j = i + (i & (-i))
if j < self.size+1:
... | 47 | 49 | 1,210 | 1,250 | class BIT:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def make(self, list):
self.tree[1:] = list.copy()
for i in range(self.size + 1):
j = i + (i & (-i))
if j < self.size + 1:
self.tree[j] += self.tree[i]
def sum(s... | import sys
input = sys.stdin.readline
class BIT:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def make(self, list):
self.tree[1:] = list.copy()
for i in range(self.size + 1):
j = i + (i & (-i))
if j < self.size + 1:
se... | false | 4.081633 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+"
] | false | 0.037611 | 0.03636 | 1.034396 | [
"s087185639",
"s917732185"
] |
u140201022 | p02271 | python | s216164050 | s392181717 | 920 | 20 | 4,732 | 4,692 | Accepted | Accepted | 97.83 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
from itertools import combinations
import time
import sys
import io
import re
import math
start = time.clock()
i = 0
def enum_sum_numbers(sets, s_range, r):
for cmb in combinations(sets,r):
yield sum(cmb)
if r <=s_range:
for s in enum_... | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import time
import sys
import io
import re
import math
start = time.clock()
i = 0
sys.stdin.readline()
a=[int(s) for s in sys.stdin.readline().split()]
sys.stdin.readline()
ms=[int(s) for s in sys.stdin.readline().split()]
ans=set([0])
for i in a:
ans|... | 25 | 22 | 668 | 473 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
from itertools import combinations
import time
import sys
import io
import re
import math
start = time.clock()
i = 0
def enum_sum_numbers(sets, s_range, r):
for cmb in combinations(sets, r):
yield sum(cmb)
if r <= s_range:
for s in enum_sum_numbers... | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import time
import sys
import io
import re
import math
start = time.clock()
i = 0
sys.stdin.readline()
a = [int(s) for s in sys.stdin.readline().split()]
sys.stdin.readline()
ms = [int(s) for s in sys.stdin.readline().split()]
ans = set([0])
for i in a:
ans |= set(j + i... | false | 12 | [
"-from itertools import combinations",
"-",
"-",
"-def enum_sum_numbers(sets, s_range, r):",
"- for cmb in combinations(sets, r):",
"- yield sum(cmb)",
"- if r <= s_range:",
"- for s in enum_sum_numbers(sets, s_range, r + 1):",
"- yield s",
"-",
"-",
"-sets = {s ... | false | 0.081673 | 0.032694 | 2.498115 | [
"s216164050",
"s392181717"
] |
u333139319 | p03774 | python | s748596068 | s432721299 | 21 | 19 | 3,064 | 3,064 | Accepted | Accepted | 9.52 | """
https://abc057.contest.atcoder.jp/tasks/abc057_b
"""
[n,m]=[int(i) for i in input().split()]
ab=[]
cd=[]
k=[]
box=[]
l=0
for i in range(n):
ab.append([int(j) for j in input().split()])
for i in range(m):
cd.append([int(j) for j in input().split()])
for i in range(n):
for j in range(m):
... | [n,m] = [int(i) for i in input().split()]
ls_st = []
ls_ch = []
for j in range(n):
ls_st.append([int(i) for i in input().split()])
for j in range(m):
ls_ch.append([int(i) for i in input().split()])
ans = []
for i in range(n):
dist = 10**20;
place = -1
for j in range(m):
if dist >... | 31 | 18 | 605 | 557 | """
https://abc057.contest.atcoder.jp/tasks/abc057_b
"""
[n, m] = [int(i) for i in input().split()]
ab = []
cd = []
k = []
box = []
l = 0
for i in range(n):
ab.append([int(j) for j in input().split()])
for i in range(m):
cd.append([int(j) for j in input().split()])
for i in range(n):
for j in range(m):
... | [n, m] = [int(i) for i in input().split()]
ls_st = []
ls_ch = []
for j in range(n):
ls_st.append([int(i) for i in input().split()])
for j in range(m):
ls_ch.append([int(i) for i in input().split()])
ans = []
for i in range(n):
dist = 10**20
place = -1
for j in range(m):
if dist > (abs(ls_st[... | false | 41.935484 | [
"-\"\"\"",
"-https://abc057.contest.atcoder.jp/tasks/abc057_b",
"-\"\"\"",
"-ab = []",
"-cd = []",
"-k = []",
"-box = []",
"-l = 0",
"+ls_st = []",
"+ls_ch = []",
"+for j in range(n):",
"+ ls_st.append([int(i) for i in input().split()])",
"+for j in range(m):",
"+ ls_ch.append([int(i... | false | 0.108314 | 0.113122 | 0.957496 | [
"s748596068",
"s432721299"
] |
u690037900 | p03160 | python | s324787347 | s158687808 | 228 | 116 | 52,208 | 13,980 | Accepted | Accepted | 49.12 | def main():
N = int(eval(input()))
H = list(map(int, input().split()))
h0 = 0
h1 = abs(H[1] - H[0])
for i in range(2, N):
h0, h1 = h1, min(
h0 + abs(H[i] - H[i - 2]),
h1 + abs(H[i] - H[i - 1]))
print(h1)
if __name__ == '__main__':
main() | N=int(eval(input()))
h=list(map(int,input().split()))
h1=abs(h[0]-h[1])
h0=0
for i in range(1,N-1):
h0,h1=h1,min(
abs(h[i+1]-h[i-1])+h0,
abs(h[i+1]-h[i])+h1
)
print(h1) | 17 | 10 | 312 | 187 | def main():
N = int(eval(input()))
H = list(map(int, input().split()))
h0 = 0
h1 = abs(H[1] - H[0])
for i in range(2, N):
h0, h1 = h1, min(h0 + abs(H[i] - H[i - 2]), h1 + abs(H[i] - H[i - 1]))
print(h1)
if __name__ == "__main__":
main()
| N = int(eval(input()))
h = list(map(int, input().split()))
h1 = abs(h[0] - h[1])
h0 = 0
for i in range(1, N - 1):
h0, h1 = h1, min(abs(h[i + 1] - h[i - 1]) + h0, abs(h[i + 1] - h[i]) + h1)
print(h1)
| false | 41.176471 | [
"-def main():",
"- N = int(eval(input()))",
"- H = list(map(int, input().split()))",
"- h0 = 0",
"- h1 = abs(H[1] - H[0])",
"- for i in range(2, N):",
"- h0, h1 = h1, min(h0 + abs(H[i] - H[i - 2]), h1 + abs(H[i] - H[i - 1]))",
"- print(h1)",
"-",
"-",
"-if __name__ == \"... | false | 0.03602 | 0.033921 | 1.061874 | [
"s324787347",
"s158687808"
] |
u325282913 | p02912 | python | s226998241 | s487625582 | 187 | 162 | 14,180 | 14,224 | Accepted | Accepted | 13.37 | import heapq
N, M = list(map(int, input().split()))
a = list([int(x)*(-1) for x in input().split()])
heapq.heapify(a)
for i in range(M):
tmp = heapq.heappop(a)
if tmp % 2 == 0:
tmp //= 2
else:
tmp //= 2
tmp += 1
heapq.heappush(a,tmp)
print((sum(a)*(-1))) | N, M = list(map(int, input().split()))
arr = list([int(x)*(-1) for x in input().split()])
import heapq
heapq.heapify(arr)
for _ in range(M):
tmp = heapq.heappop(arr)
heapq.heappush(arr,-(-tmp//2))
print((-sum(arr))) | 13 | 8 | 303 | 227 | import heapq
N, M = list(map(int, input().split()))
a = list([int(x) * (-1) for x in input().split()])
heapq.heapify(a)
for i in range(M):
tmp = heapq.heappop(a)
if tmp % 2 == 0:
tmp //= 2
else:
tmp //= 2
tmp += 1
heapq.heappush(a, tmp)
print((sum(a) * (-1)))
| N, M = list(map(int, input().split()))
arr = list([int(x) * (-1) for x in input().split()])
import heapq
heapq.heapify(arr)
for _ in range(M):
tmp = heapq.heappop(arr)
heapq.heappush(arr, -(-tmp // 2))
print((-sum(arr)))
| false | 38.461538 | [
"+N, M = list(map(int, input().split()))",
"+arr = list([int(x) * (-1) for x in input().split()])",
"-N, M = list(map(int, input().split()))",
"-a = list([int(x) * (-1) for x in input().split()])",
"-heapq.heapify(a)",
"-for i in range(M):",
"- tmp = heapq.heappop(a)",
"- if tmp % 2 == 0:",
"-... | false | 0.052872 | 0.052037 | 1.016043 | [
"s226998241",
"s487625582"
] |
u514390882 | p02729 | python | s898223743 | s051026334 | 181 | 70 | 38,256 | 61,864 | Accepted | Accepted | 61.33 | n, m = list(map(int, input().split()))
ans = 0
if n > 1:
ans += n * (n - 1) // 2
if m > 1:
ans += m * (m - 1) // 2
print(ans) | N, M = list(map(int, input().split()))
ans = N * (N - 1) // 2 + M * (M - 1) // 2
print(ans) | 7 | 4 | 133 | 89 | n, m = list(map(int, input().split()))
ans = 0
if n > 1:
ans += n * (n - 1) // 2
if m > 1:
ans += m * (m - 1) // 2
print(ans)
| N, M = list(map(int, input().split()))
ans = N * (N - 1) // 2 + M * (M - 1) // 2
print(ans)
| false | 42.857143 | [
"-n, m = list(map(int, input().split()))",
"-ans = 0",
"-if n > 1:",
"- ans += n * (n - 1) // 2",
"-if m > 1:",
"- ans += m * (m - 1) // 2",
"+N, M = list(map(int, input().split()))",
"+ans = N * (N - 1) // 2 + M * (M - 1) // 2"
] | false | 0.062544 | 0.080525 | 0.776708 | [
"s898223743",
"s051026334"
] |
u071680334 | p02734 | python | s033128597 | s133795154 | 406 | 283 | 83,196 | 97,288 | Accepted | Accepted | 30.3 | import numpy as np
MOD = 998244353
def main():
n, s = list(map(int, input().split()))
a = list(map(int, input().split()))
dp = [np.zeros(s+1, dtype=np.int64) for i in range(n+1)]
ans = 0
for i in range(n):
if a[i] <= s:
dp[i+1][a[i]:] = dp[i][:-a[i]]
dp[i+1]... | import numpy as np
MOD = 998244353
def main():
n, s = list(map(int, input().split()))
a = list(map(int, input().split()))
dp = np.zeros((n+1, s+1), dtype=np.int64)
for i, v in enumerate(a):
dp[i][0] += 1
dp[i+1] += dp[i]
if v <= s:
dp[i+1][v:] += dp[i][:... | 20 | 22 | 544 | 484 | import numpy as np
MOD = 998244353
def main():
n, s = list(map(int, input().split()))
a = list(map(int, input().split()))
dp = [np.zeros(s + 1, dtype=np.int64) for i in range(n + 1)]
ans = 0
for i in range(n):
if a[i] <= s:
dp[i + 1][a[i] :] = dp[i][: -a[i]]
dp[i +... | import numpy as np
MOD = 998244353
def main():
n, s = list(map(int, input().split()))
a = list(map(int, input().split()))
dp = np.zeros((n + 1, s + 1), dtype=np.int64)
for i, v in enumerate(a):
dp[i][0] += 1
dp[i + 1] += dp[i]
if v <= s:
dp[i + 1][v:] += dp[i][:-v]... | false | 9.090909 | [
"- dp = [np.zeros(s + 1, dtype=np.int64) for i in range(n + 1)]",
"+ dp = np.zeros((n + 1, s + 1), dtype=np.int64)",
"+ for i, v in enumerate(a):",
"+ dp[i][0] += 1",
"+ dp[i + 1] += dp[i]",
"+ if v <= s:",
"+ dp[i + 1][v:] += dp[i][:-v]",
"+ dp[i + 1] %... | false | 0.1997 | 0.195214 | 1.022976 | [
"s033128597",
"s133795154"
] |
u077291787 | p03354 | python | s398334772 | s199712724 | 388 | 358 | 35,324 | 35,316 | Accepted | Accepted | 7.73 | # ABC097D - Equals (ARC097D)
class UnionFind: # O(α(N))
def __init__(self, N): # construct a Union-Find tree (1-idx)
self.parent = [i for i in range(N + 1)]
self.rank = [0] * (N + 1)
def find(self, x): # find the group (root) of a vertex
if self.parent[x] == x:
re... | # ABC097D - Equals (ARC097D)
class UnionFind:
__slots__ = ["_data_size", "_first_index", "_parents"]
def __init__(self, data_size: int, is_zero_indexed: bool = True) -> None:
self._data_size = data_size
self._first_index = 0 if is_zero_indexed else 1
self._parents = [-1] * (data_... | 41 | 43 | 1,377 | 1,416 | # ABC097D - Equals (ARC097D)
class UnionFind: # O(α(N))
def __init__(self, N): # construct a Union-Find tree (1-idx)
self.parent = [i for i in range(N + 1)]
self.rank = [0] * (N + 1)
def find(self, x): # find the group (root) of a vertex
if self.parent[x] == x:
return x
... | # ABC097D - Equals (ARC097D)
class UnionFind:
__slots__ = ["_data_size", "_first_index", "_parents"]
def __init__(self, data_size: int, is_zero_indexed: bool = True) -> None:
self._data_size = data_size
self._first_index = 0 if is_zero_indexed else 1
self._parents = [-1] * (data_size + ... | false | 4.651163 | [
"-class UnionFind: # O(α(N))",
"- def __init__(self, N): # construct a Union-Find tree (1-idx)",
"- self.parent = [i for i in range(N + 1)]",
"- self.rank = [0] * (N + 1)",
"+class UnionFind:",
"+ __slots__ = [\"_data_size\", \"_first_index\", \"_parents\"]",
"- def find(self, x... | false | 0.038673 | 0.040678 | 0.950717 | [
"s398334772",
"s199712724"
] |
u011062360 | p03244 | python | s781657537 | s625201582 | 109 | 100 | 14,268 | 25,980 | Accepted | Accepted | 8.26 | n = int(eval(input()))
list_V = list(map(int, input().split()))
list_Vx = []
list_Vy = []
for i, s in enumerate(list_V):
if i % 2 == 0:
list_Vx.append(s)
else:
list_Vy.append(s)
list_Vx_Count = [0 for _ in range(pow(10, 5))]
list_Vy_Count = [0 for _ in range(pow(10, 5))]
for i... | from collections import Counter
n = int(eval(input()))
list_A = list(map(int, input().split()))
L, R = [], []
for i in range(n):
if i % 2 == 0:
L.append(list_A[i])
else:
R.append(list_A[i])
A = Counter(L)
A = sorted(list(A.items()), key=lambda x:x[1], reverse=True)
A.append((-1,... | 27 | 24 | 773 | 535 | n = int(eval(input()))
list_V = list(map(int, input().split()))
list_Vx = []
list_Vy = []
for i, s in enumerate(list_V):
if i % 2 == 0:
list_Vx.append(s)
else:
list_Vy.append(s)
list_Vx_Count = [0 for _ in range(pow(10, 5))]
list_Vy_Count = [0 for _ in range(pow(10, 5))]
for i in list_Vx:
li... | from collections import Counter
n = int(eval(input()))
list_A = list(map(int, input().split()))
L, R = [], []
for i in range(n):
if i % 2 == 0:
L.append(list_A[i])
else:
R.append(list_A[i])
A = Counter(L)
A = sorted(list(A.items()), key=lambda x: x[1], reverse=True)
A.append((-1, 0))
B = Counte... | false | 11.111111 | [
"+from collections import Counter",
"+",
"-list_V = list(map(int, input().split()))",
"-list_Vx = []",
"-list_Vy = []",
"-for i, s in enumerate(list_V):",
"+list_A = list(map(int, input().split()))",
"+L, R = [], []",
"+for i in range(n):",
"- list_Vx.append(s)",
"+ L.append(list_A... | false | 0.078952 | 0.039022 | 2.023257 | [
"s781657537",
"s625201582"
] |
u633068244 | p00429 | python | s343602787 | s407452513 | 60 | 50 | 4,996 | 4,988 | Accepted | Accepted | 16.67 | def f(a):
ans = ""
s = a[0]
c = 1
for i in range(1,len(a)):
if a[i] == s:
c += 1
else:
ans += str(c) + s
s = a[i]
c = 1
ans += str(c) + s
return ans
while 1:
n = eval(input())
if n == 0: break
a = input()
for i in range(n):
a = f(a)
print(a) | def f(a,n):
for j in range(n):
aa = ""
s = a[0]
c = 1
for i in range(1,len(a)):
if a[i] == s:
c += 1
else:
aa += str(c) + s
s = a[i]
c = 1
a = aa + str(c) + s
return a
while 1:
n = eval(input())
if n == 0: break
a = input()
print(f(a,n)) | 21 | 20 | 289 | 293 | def f(a):
ans = ""
s = a[0]
c = 1
for i in range(1, len(a)):
if a[i] == s:
c += 1
else:
ans += str(c) + s
s = a[i]
c = 1
ans += str(c) + s
return ans
while 1:
n = eval(input())
if n == 0:
break
a = input()
... | def f(a, n):
for j in range(n):
aa = ""
s = a[0]
c = 1
for i in range(1, len(a)):
if a[i] == s:
c += 1
else:
aa += str(c) + s
s = a[i]
c = 1
a = aa + str(c) + s
return a
while 1:
... | false | 4.761905 | [
"-def f(a):",
"- ans = \"\"",
"- s = a[0]",
"- c = 1",
"- for i in range(1, len(a)):",
"- if a[i] == s:",
"- c += 1",
"- else:",
"- ans += str(c) + s",
"- s = a[i]",
"- c = 1",
"- ans += str(c) + s",
"- return ans",
... | false | 0.052574 | 0.07822 | 0.67213 | [
"s343602787",
"s407452513"
] |
u837673618 | p02728 | python | s985544516 | s128788162 | 2,010 | 1,547 | 152,288 | 89,464 | Accepted | Accepted | 23.03 | from functools import *
from collections import *
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.buffer.readline
M = 10**9+7
@lru_cache(maxsize=None)
def mod_inv(x):
if x == 1:
return 1
return M // x * -mod_inv(M%x) % M
@lru_cache(maxsize=None)
def calc_subtree(v):
ret = 1
si... | from functools import *
from collections import *
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.buffer.readline
M = 10**9+7
N = int(eval(input()))
@lru_cache(maxsize=None)
def mod_inv(x):
if x == 1:
return 1
return M // x * -mod_inv(M%x) % M
weight = [0]*(N+1)
size = [0]*(N+1)
d... | 46 | 49 | 918 | 949 | from functools import *
from collections import *
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.buffer.readline
M = 10**9 + 7
@lru_cache(maxsize=None)
def mod_inv(x):
if x == 1:
return 1
return M // x * -mod_inv(M % x) % M
@lru_cache(maxsize=None)
def calc_subtree(v):
ret = 1
si... | from functools import *
from collections import *
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.buffer.readline
M = 10**9 + 7
N = int(eval(input()))
@lru_cache(maxsize=None)
def mod_inv(x):
if x == 1:
return 1
return M // x * -mod_inv(M % x) % M
weight = [0] * (N + 1)
size = [0] * (N + ... | false | 6.122449 | [
"+N = int(eval(input()))",
"-@lru_cache(maxsize=None)",
"+weight = [0] * (N + 1)",
"+size = [0] * (N + 1)",
"+",
"+",
"- ret = 1",
"- size = 1",
"+ W = 1",
"+ S = 1",
"- r, s = calc_subtree(child)",
"- ret = ret * r % M",
"- size += s",
"- ret = ret * si... | false | 0.052654 | 0.111415 | 0.472592 | [
"s985544516",
"s128788162"
] |
u943057856 | p03162 | python | s798144581 | s141041670 | 524 | 460 | 35,904 | 50,012 | Accepted | Accepted | 12.21 | n=int(eval(input()))
a=[0]*n
b=[0]*n
c=[0]*n
for i in range(n):
a[i],b[i],c[i]=list(map(int,input().split()))
dp=[[0,0,0] for _ in range(n+1)]
for i in range(1,n+1):
dp[i][0] = max(dp[i-1][1],dp[i-1][2])+a[i-1]
dp[i][1] = max(dp[i-1][0],dp[i-1][2])+b[i-1]
dp[i][2] = max(dp[i-1][0],dp[i-1][1]... | n=int(eval(input()))
l=[list(map(int,input().split())) for _ in range(n)]
dp=[[0]*3 for _ in range(n)]
dp[0]=l[0]
for i in range(n-1):
for j in range(3):
dp[i+1][j]=max(dp[i][(j+1)%3],dp[i][(j+2)%3])+l[i+1][j]
print((max(dp[n-1]))) | 14 | 8 | 337 | 242 | n = int(eval(input()))
a = [0] * n
b = [0] * n
c = [0] * n
for i in range(n):
a[i], b[i], c[i] = list(map(int, input().split()))
dp = [[0, 0, 0] for _ in range(n + 1)]
for i in range(1, n + 1):
dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a[i - 1]
dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + b[i - 1]
dp... | n = int(eval(input()))
l = [list(map(int, input().split())) for _ in range(n)]
dp = [[0] * 3 for _ in range(n)]
dp[0] = l[0]
for i in range(n - 1):
for j in range(3):
dp[i + 1][j] = max(dp[i][(j + 1) % 3], dp[i][(j + 2) % 3]) + l[i + 1][j]
print((max(dp[n - 1])))
| false | 42.857143 | [
"-a = [0] * n",
"-b = [0] * n",
"-c = [0] * n",
"-for i in range(n):",
"- a[i], b[i], c[i] = list(map(int, input().split()))",
"-dp = [[0, 0, 0] for _ in range(n + 1)]",
"-for i in range(1, n + 1):",
"- dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a[i - 1]",
"- dp[i][1] = max(dp[i - 1][0], ... | false | 0.03976 | 0.043107 | 0.922344 | [
"s798144581",
"s141041670"
] |
u989345508 | p02720 | python | s855711969 | s500275347 | 179 | 165 | 23,512 | 17,268 | Accepted | Accepted | 7.82 | k=int(eval(input()))
ans=[[i for i in range(1,10)]]
d=9
while d<k:
ans.append([])
for i in ans[-2]:
x=str(i)
z=int(x[-1])
ans[-1].append(x+str(z))
if z<=8:
ans[-1].append(x+str(z+1))
if z>=1:
ans[-1].append(x+str(z-1))
d+=len(ans[-... | k=int(eval(input()))
ans=[[i for i in range(1,10)]]
d=9
while d<k:
ans.append([])
for i in ans[-2]:
x=str(i)
z=int(x[-1])
ans[-1].append(x+str(z))
if z<=8:
ans[-1].append(x+str(z+1))
if z>=1:
ans[-1].append(x+str(z-1))
d+=len(ans[-... | 18 | 16 | 393 | 356 | k = int(eval(input()))
ans = [[i for i in range(1, 10)]]
d = 9
while d < k:
ans.append([])
for i in ans[-2]:
x = str(i)
z = int(x[-1])
ans[-1].append(x + str(z))
if z <= 8:
ans[-1].append(x + str(z + 1))
if z >= 1:
ans[-1].append(x + str(z - 1))
... | k = int(eval(input()))
ans = [[i for i in range(1, 10)]]
d = 9
while d < k:
ans.append([])
for i in ans[-2]:
x = str(i)
z = int(x[-1])
ans[-1].append(x + str(z))
if z <= 8:
ans[-1].append(x + str(z + 1))
if z >= 1:
ans[-1].append(x + str(z - 1))
... | false | 11.111111 | [
"-l = len(ans[-1])",
"-v = sorted([int(i) for i in ans[-1]])",
"-print((v[k - (d - l) - 1]))",
"+ans[-1].sort()",
"+print((ans[-1][k - d - 1]))"
] | false | 0.048958 | 0.047103 | 1.039382 | [
"s855711969",
"s500275347"
] |
u058781705 | p02744 | python | s437575062 | s712054303 | 425 | 292 | 61,016 | 80,220 | Accepted | Accepted | 31.29 | import math
def div_with_mod(x, y, mod):
# Fermat's little theorem
return x*pow(y, mod - 2, mod)
def comb(n, r, mod):
# calculates C(n,r) with mod (assuming mod is prime)
nc = n
for rc in range(1, r):
nc -= 1
n = n*nc % mod
r = r*rc % mod
return div_w... | import math
def div_with_mod(x, y, mod):
# Fermat's little theorem
return x*pow(y, mod - 2, mod)
def comb(n, r, mod):
# calculates C(n,r) with mod (assuming mod is prime)
nc = n
for rc in range(1, r):
nc -= 1
n = n*nc % mod
r = r*rc % mod
return div_w... | 38 | 49 | 672 | 1,016 | import math
def div_with_mod(x, y, mod):
# Fermat's little theorem
return x * pow(y, mod - 2, mod)
def comb(n, r, mod):
# calculates C(n,r) with mod (assuming mod is prime)
nc = n
for rc in range(1, r):
nc -= 1
n = n * nc % mod
r = r * rc % mod
return div_with_mod(n, ... | import math
def div_with_mod(x, y, mod):
# Fermat's little theorem
return x * pow(y, mod - 2, mod)
def comb(n, r, mod):
# calculates C(n,r) with mod (assuming mod is prime)
nc = n
for rc in range(1, r):
nc -= 1
n = n * nc % mod
r = r * rc % mod
return div_with_mod(n, ... | false | 22.44898 | [
"- list = [chr(ord(\"a\") + i) for i in range(10)]",
"-",
"- def dfs(w, i):",
"- if len(w) == N:",
"- return print(w)",
"- for j in range(i):",
"- dfs(w + list[j], i)",
"- dfs(w + list[i], i + 1)",
"-",
"- dfs(\"\", 0)",
"+ # ord(\"a\") Unic... | false | 0.054469 | 0.038127 | 1.428632 | [
"s437575062",
"s712054303"
] |
u380524497 | p02949 | python | s549625837 | s810906444 | 1,174 | 555 | 124,120 | 16,496 | Accepted | Accepted | 52.73 | import sys
sys.setrecursionlimit(10**6)
n, m, p = list(map(int, input().split()))
edges = []
routes = [[] for i in range(n)]
rev_routes = [[] for i in range(n)]
from_start = set()
to_goal = set()
def dfs(node, routes, seen):
if node in seen:
return
seen.add(node)
candidates = rout... | from scipy.sparse import coo_matrix
from scipy.sparse.csgraph import bellman_ford, NegativeCycleError
import sys
input = sys.stdin.readline
def main():
n, m, p = list(map(int, input().split()))
edges = []
routes = [[] for _ in range(n)]
rev_routes = [[] for _ in range(n)]
def get_re... | 54 | 73 | 1,293 | 1,952 | import sys
sys.setrecursionlimit(10**6)
n, m, p = list(map(int, input().split()))
edges = []
routes = [[] for i in range(n)]
rev_routes = [[] for i in range(n)]
from_start = set()
to_goal = set()
def dfs(node, routes, seen):
if node in seen:
return
seen.add(node)
candidates = routes[node]
for... | from scipy.sparse import coo_matrix
from scipy.sparse.csgraph import bellman_ford, NegativeCycleError
import sys
input = sys.stdin.readline
def main():
n, m, p = list(map(int, input().split()))
edges = []
routes = [[] for _ in range(n)]
rev_routes = [[] for _ in range(n)]
def get_reachable_nodes... | false | 26.027397 | [
"+from scipy.sparse import coo_matrix",
"+from scipy.sparse.csgraph import bellman_ford, NegativeCycleError",
"-sys.setrecursionlimit(10**6)",
"-n, m, p = list(map(int, input().split()))",
"-edges = []",
"-routes = [[] for i in range(n)]",
"-rev_routes = [[] for i in range(n)]",
"-from_start = set()",... | false | 0.037568 | 0.411029 | 0.0914 | [
"s549625837",
"s810906444"
] |
u072053884 | p02259 | python | s026201767 | s756029583 | 40 | 30 | 7,656 | 7,648 | Accepted | Accepted | 25 | n = int(eval(input()))
numbers = list(map(int, input().split(" ")))
flag = 1
cnt = 0
while flag:
flag = 0
for j in range(n - 1, 0, -1):
if numbers[j] < numbers[j - 1]:
numbers[j], numbers[j - 1] = numbers[j - 1], numbers[j]
flag = 1
cnt += 1
numbe... | n = int(eval(input()))
numbers = list(map(int, input().split(" ")))
flag = 1
cnt = 0
while flag:
flag = 0
for j in range(n - 1, 0, -1):
if numbers[j] < numbers[j - 1]:
tmp = numbers[j]
numbers[j] = numbers[j - 1]
numbers[j - 1] = tmp
# n... | 20 | 23 | 376 | 483 | n = int(eval(input()))
numbers = list(map(int, input().split(" ")))
flag = 1
cnt = 0
while flag:
flag = 0
for j in range(n - 1, 0, -1):
if numbers[j] < numbers[j - 1]:
numbers[j], numbers[j - 1] = numbers[j - 1], numbers[j]
flag = 1
cnt += 1
numbers = list(map(str, nu... | n = int(eval(input()))
numbers = list(map(int, input().split(" ")))
flag = 1
cnt = 0
while flag:
flag = 0
for j in range(n - 1, 0, -1):
if numbers[j] < numbers[j - 1]:
tmp = numbers[j]
numbers[j] = numbers[j - 1]
numbers[j - 1] = tmp
# numbers[j], numbers[... | false | 13.043478 | [
"- numbers[j], numbers[j - 1] = numbers[j - 1], numbers[j]",
"+ tmp = numbers[j]",
"+ numbers[j] = numbers[j - 1]",
"+ numbers[j - 1] = tmp",
"+ # numbers[j], numbers[j - 1] = numbers[j - 1], numbers[j]"
] | false | 0.036437 | 0.036004 | 1.012037 | [
"s026201767",
"s756029583"
] |
u197968862 | p03273 | python | s203585844 | s881792192 | 23 | 20 | 3,188 | 3,188 | Accepted | Accepted | 13.04 | h, w = list(map(int,input().split()))
a = [eval(input()) for _ in range(h)]
remove_a = []
for i in range(h):
if '#' in a[i]:
remove_a.append(list(a[i]))
n = len(remove_a)
l = []
for i in range(w):
s = ''
for j in range(n):
s += remove_a[j][i]
if '#' in s:
l.appen... | h, w = list(map(int,input().split()))
a = [list(eval(input())) for _ in range(h)]
yoko = []
for i in range(h):
seta = set(a[i])
if '#' in seta:
yoko.append(a[i])
h = len(yoko)
w = len(yoko[0])
for i in range(w):
tate = []
for j in range(h):
tate.append(yoko[j][i])
se... | 26 | 27 | 494 | 532 | h, w = list(map(int, input().split()))
a = [eval(input()) for _ in range(h)]
remove_a = []
for i in range(h):
if "#" in a[i]:
remove_a.append(list(a[i]))
n = len(remove_a)
l = []
for i in range(w):
s = ""
for j in range(n):
s += remove_a[j][i]
if "#" in s:
l.append(list(s))
ans =... | h, w = list(map(int, input().split()))
a = [list(eval(input())) for _ in range(h)]
yoko = []
for i in range(h):
seta = set(a[i])
if "#" in seta:
yoko.append(a[i])
h = len(yoko)
w = len(yoko[0])
for i in range(w):
tate = []
for j in range(h):
tate.append(yoko[j][i])
settate = set(tate... | false | 3.703704 | [
"-a = [eval(input()) for _ in range(h)]",
"-remove_a = []",
"+a = [list(eval(input())) for _ in range(h)]",
"+yoko = []",
"- if \"#\" in a[i]:",
"- remove_a.append(list(a[i]))",
"-n = len(remove_a)",
"-l = []",
"+ seta = set(a[i])",
"+ if \"#\" in seta:",
"+ yoko.append(a[... | false | 0.079113 | 0.088877 | 0.890143 | [
"s203585844",
"s881792192"
] |
u297574184 | p03553 | python | s072764124 | s510251017 | 25 | 23 | 3,444 | 3,444 | Accepted | Accepted | 8 | from collections import deque
# グラフに辺を追加する
def addEdge(adjL, vFr, vTo, cap):
adjL[vFr].append([vTo, cap, len(adjL[vTo])])
adjL[vTo].append([vFr, 0, len(adjL[vFr]) - 1]) # 逆辺
# Edmonds-Karp法(最大フローを求める)
def Edmonds_Karp(adjL, vSt, vEn):
# 残余グラフの始点から終点までの経路(増加パス)を、BFSで探索する
def BFS(vSt, vEn)... | from collections import deque
# グラフに辺を追加する
def addEdge(adjL, vFr, vTo, cap):
adjL[vFr].append([vTo, cap, len(adjL[vTo])])
adjL[vTo].append([vFr, 0, len(adjL[vFr]) - 1]) # 逆辺
# Dinic法(最大フローを求める)
def Dinic(adjL, vSt, vEn):
# 始点からの最短距離を、BFSで求める
def BFS(vSt):
dist[vSt] = 0
... | 77 | 89 | 1,997 | 2,335 | from collections import deque
# グラフに辺を追加する
def addEdge(adjL, vFr, vTo, cap):
adjL[vFr].append([vTo, cap, len(adjL[vTo])])
adjL[vTo].append([vFr, 0, len(adjL[vFr]) - 1]) # 逆辺
# Edmonds-Karp法(最大フローを求める)
def Edmonds_Karp(adjL, vSt, vEn):
# 残余グラフの始点から終点までの経路(増加パス)を、BFSで探索する
def BFS(vSt, vEn):
pr... | from collections import deque
# グラフに辺を追加する
def addEdge(adjL, vFr, vTo, cap):
adjL[vFr].append([vTo, cap, len(adjL[vTo])])
adjL[vTo].append([vFr, 0, len(adjL[vFr]) - 1]) # 逆辺
# Dinic法(最大フローを求める)
def Dinic(adjL, vSt, vEn):
# 始点からの最短距離を、BFSで求める
def BFS(vSt):
dist[vSt] = 0
Q = deque([vSt... | false | 13.483146 | [
"-# Edmonds-Karp法(最大フローを求める)",
"-def Edmonds_Karp(adjL, vSt, vEn):",
"- # 残余グラフの始点から終点までの経路(増加パス)を、BFSで探索する",
"- def BFS(vSt, vEn):",
"- prev = [-1] * numV",
"- prev[vSt] = None",
"- iE = [-1] * numV",
"- df = 0",
"- Q = deque([(vSt, float(\"inf\"))])",
"+#... | false | 0.036073 | 0.111014 | 0.324945 | [
"s072764124",
"s510251017"
] |
u461993794 | p03575 | python | s633766446 | s843162750 | 118 | 78 | 70,564 | 70,960 | Accepted | Accepted | 33.9 | from collections import deque
n, m = list(map(int, input().split()))
eg = [[] for _ in range(n + 1)]
al = [0] * m
bl = [0] * m
for i in range(m):
a, b = list(map(int, input().split()))
eg[a].append(b)
eg[b].append(a)
al[i], bl[i] = a, b
ans = 0
for i in range(m):
x, y = al[i], bl... | from collections import deque
n, m = list(map(int, input().split()))
eg = [[] for _ in range(n + 1)]
al = [0] * m
bl = [0] * m
for i in range(m):
a, b = list(map(int, input().split()))
eg[a].append(b)
eg[b].append(a)
al[i], bl[i] = a, b
ans = 0
for i in range(m):
x, y = al[i], bl... | 32 | 32 | 667 | 676 | from collections import deque
n, m = list(map(int, input().split()))
eg = [[] for _ in range(n + 1)]
al = [0] * m
bl = [0] * m
for i in range(m):
a, b = list(map(int, input().split()))
eg[a].append(b)
eg[b].append(a)
al[i], bl[i] = a, b
ans = 0
for i in range(m):
x, y = al[i], bl[i]
q = deque()... | from collections import deque
n, m = list(map(int, input().split()))
eg = [[] for _ in range(n + 1)]
al = [0] * m
bl = [0] * m
for i in range(m):
a, b = list(map(int, input().split()))
eg[a].append(b)
eg[b].append(a)
al[i], bl[i] = a, b
ans = 0
for i in range(m):
x, y = al[i], bl[i]
q = deque()... | false | 0 | [
"- while q:",
"+ while len(q) > 0:"
] | false | 0.048342 | 0.067691 | 0.71416 | [
"s633766446",
"s843162750"
] |
u426108351 | p02913 | python | s209166867 | s646417833 | 1,651 | 62 | 3,064 | 4,524 | Accepted | Accepted | 96.24 | N = int(eval(input()))
S = eval(input())
r = 0
ans = 0
for l in range(N):
while True:
if S.rfind(S[l:r+1]) >= r+1:
r += 1
ans = max(ans, r-l)
else:
break
print(ans)
| n = int(eval(input()))
s = eval(input())
import random
base1 = 1007
mod1 = 10**9+7
modTank1 = [3000012541,3000012553,3000012563,3000012649,3000012683,3000012709]
mod1 = modTank1[random.randint(0,5)]
base1 = 1007
mod1 = 10**9+7
hash1 = [0]*(n+1)
power1 = [1]*(n+1)
for i,e in enumerate(s):
hash1[i+1] = ... | 12 | 40 | 220 | 831 | N = int(eval(input()))
S = eval(input())
r = 0
ans = 0
for l in range(N):
while True:
if S.rfind(S[l : r + 1]) >= r + 1:
r += 1
ans = max(ans, r - l)
else:
break
print(ans)
| n = int(eval(input()))
s = eval(input())
import random
base1 = 1007
mod1 = 10**9 + 7
modTank1 = [3000012541, 3000012553, 3000012563, 3000012649, 3000012683, 3000012709]
mod1 = modTank1[random.randint(0, 5)]
base1 = 1007
mod1 = 10**9 + 7
hash1 = [0] * (n + 1)
power1 = [1] * (n + 1)
for i, e in enumerate(s):
hash1[i... | false | 70 | [
"-N = int(eval(input()))",
"-S = eval(input())",
"-r = 0",
"-ans = 0",
"-for l in range(N):",
"- while True:",
"- if S.rfind(S[l : r + 1]) >= r + 1:",
"- r += 1",
"- ans = max(ans, r - l)",
"- else:",
"+n = int(eval(input()))",
"+s = eval(input())",
"+i... | false | 0.110683 | 0.037021 | 2.989782 | [
"s209166867",
"s646417833"
] |
u347600233 | p02730 | python | s728637126 | s053917812 | 29 | 25 | 9,112 | 9,112 | Accepted | Accepted | 13.79 | def is_p(s):
return s == s[::-1]
s = eval(input())
n = len(s)
print(('Yes' if is_p(s) and is_p(s[:(n - 1)//2]) and is_p(s[(n + 3)//2 - 1:]) else 'No')) | def is_p(s):
return s == s[::-1]
s = eval(input())
n = len(s)
l = (n - 1)//2
r = l + 1
print(('Yes' if is_p(s) and is_p(s[:l]) and is_p(s[r:]) else 'No')) | 5 | 7 | 151 | 156 | def is_p(s):
return s == s[::-1]
s = eval(input())
n = len(s)
print(
(
"Yes"
if is_p(s) and is_p(s[: (n - 1) // 2]) and is_p(s[(n + 3) // 2 - 1 :])
else "No"
)
)
| def is_p(s):
return s == s[::-1]
s = eval(input())
n = len(s)
l = (n - 1) // 2
r = l + 1
print(("Yes" if is_p(s) and is_p(s[:l]) and is_p(s[r:]) else "No"))
| false | 28.571429 | [
"-print(",
"- (",
"- \"Yes\"",
"- if is_p(s) and is_p(s[: (n - 1) // 2]) and is_p(s[(n + 3) // 2 - 1 :])",
"- else \"No\"",
"- )",
"-)",
"+l = (n - 1) // 2",
"+r = l + 1",
"+print((\"Yes\" if is_p(s) and is_p(s[:l]) and is_p(s[r:]) else \"No\"))"
] | false | 0.082635 | 0.037032 | 2.231468 | [
"s728637126",
"s053917812"
] |
u359358631 | p02844 | python | s332543695 | s682468817 | 30 | 27 | 9,272 | 9,232 | Accepted | Accepted | 10 | def main():
N = int(eval(input()))
S = eval(input())
ans = 0
# password = set()
# for i in range(N - 2):
# for j in range(i + 1, N - 1):
# for k in range(10):
# if str(k) in S[j + 1:]:
# password.add(S[i] + S[j] + str(k))
for ... | def main():
N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(10):
for j in range(10):
for k in range(10):
i_index = S.find(str(i))
if i_index == -1:
continue
j_index = S.find(str(j), i_in... | 26 | 25 | 701 | 566 | def main():
N = int(eval(input()))
S = eval(input())
ans = 0
# password = set()
# for i in range(N - 2):
# for j in range(i + 1, N - 1):
# for k in range(10):
# if str(k) in S[j + 1:]:
# password.add(S[i] + S[j] + str(k))
for i in range(10)... | def main():
N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(10):
for j in range(10):
for k in range(10):
i_index = S.find(str(i))
if i_index == -1:
continue
j_index = S.find(str(j), i_index + 1)
... | false | 3.846154 | [
"- # password = set()",
"- # for i in range(N - 2):",
"- # for j in range(i + 1, N - 1):",
"- # for k in range(10):",
"- # if str(k) in S[j + 1:]:",
"- # password.add(S[i] + S[j] + str(k))",
"+ if i_index == -1:",
"+ ... | false | 0.038951 | 0.038361 | 1.015405 | [
"s332543695",
"s682468817"
] |
u633068244 | p00114 | python | s388232162 | s926294579 | 490 | 350 | 4,240 | 4,232 | Accepted | Accepted | 28.57 | def gcd(a,b):
return a if b==0 else gcd(b,a%b)
while 1:
a1,m1,a2,m2,a3,m3=list(map(int,input().split()))
if a1==0:break
x=y=z=1
x=a1*x%m1
y=a2*y%m2
z=a3*z%m3
cx=cy=cz=1
while 1:
if x!=1:
x=a1*x%m1
cx+=1
if y!=1:
y=a2*y%m2
cy+=1
if z!=1:
z=a3*z%m3
cz+=1
if (x,y,z... | def gcd(a,b):
return a if b==0 else gcd(b,a%b)
while 1:
a1,m1,a2,m2,a3,m3=list(map(int,input().split()))
if a1==0:break
x=y=z=1
x=a1*x%m1
y=a2*y%m2
z=a3*z%m3
cx=cy=cz=1
while x!=1:
x=a1*x%m1
cx+=1
while y!=1:
y=a2*y%m2
cy+=1
while z!=1:
z=a3*z%m3
cz+=1
lcd=cx*cy/gcd(cx,cy)
... | 26 | 23 | 399 | 354 | def gcd(a, b):
return a if b == 0 else gcd(b, a % b)
while 1:
a1, m1, a2, m2, a3, m3 = list(map(int, input().split()))
if a1 == 0:
break
x = y = z = 1
x = a1 * x % m1
y = a2 * y % m2
z = a3 * z % m3
cx = cy = cz = 1
while 1:
if x != 1:
x = a1 * x % m1
... | def gcd(a, b):
return a if b == 0 else gcd(b, a % b)
while 1:
a1, m1, a2, m2, a3, m3 = list(map(int, input().split()))
if a1 == 0:
break
x = y = z = 1
x = a1 * x % m1
y = a2 * y % m2
z = a3 * z % m3
cx = cy = cz = 1
while x != 1:
x = a1 * x % m1
cx += 1
... | false | 11.538462 | [
"- while 1:",
"- if x != 1:",
"- x = a1 * x % m1",
"- cx += 1",
"- if y != 1:",
"- y = a2 * y % m2",
"- cy += 1",
"- if z != 1:",
"- z = a3 * z % m3",
"- cz += 1",
"- if (x, y, z) == (1, 1, 1):",
"... | false | 0.088569 | 0.075716 | 1.169745 | [
"s388232162",
"s926294579"
] |
u777923818 | p03013 | python | s656732953 | s543403937 | 236 | 133 | 41,692 | 7,748 | Accepted | Accepted | 43.64 | import sys
input = sys.stdin.readline
def inpl(): return list(map(int, input().split()))
N, M = inpl()
MOD = 10**9 + 7
A = [1]*(N+3)
for _ in range(M):
a = int(eval(input()))
A[a] -= 1
DP = [0]*(N+3)
DP[0] = 1
for i in range(N):
DP[i+1] = ((DP[i+1] + DP[i])*A[i+1])%MOD
DP[i+2] = ((DP[i+... | import sys
input = sys.stdin.readline
from sys import setrecursionlimit
setrecursionlimit(10**9)
def inpl(): return list(map(int, input().split()))
N, M = inpl()
MOD = 10**9 + 7
A = [1]*(N+3)
A[N+2] = 0
A[N+1] = 0
for _ in range(M):
a = int(eval(input()))
A[a] = 0
DP = [0]*(N+3)
DP[0] = 1
for... | 17 | 21 | 351 | 439 | import sys
input = sys.stdin.readline
def inpl():
return list(map(int, input().split()))
N, M = inpl()
MOD = 10**9 + 7
A = [1] * (N + 3)
for _ in range(M):
a = int(eval(input()))
A[a] -= 1
DP = [0] * (N + 3)
DP[0] = 1
for i in range(N):
DP[i + 1] = ((DP[i + 1] + DP[i]) * A[i + 1]) % MOD
DP[i + ... | import sys
input = sys.stdin.readline
from sys import setrecursionlimit
setrecursionlimit(10**9)
def inpl():
return list(map(int, input().split()))
N, M = inpl()
MOD = 10**9 + 7
A = [1] * (N + 3)
A[N + 2] = 0
A[N + 1] = 0
for _ in range(M):
a = int(eval(input()))
A[a] = 0
DP = [0] * (N + 3)
DP[0] = 1
... | false | 19.047619 | [
"+from sys import setrecursionlimit",
"+",
"+setrecursionlimit(10**9)",
"+A[N + 2] = 0",
"+A[N + 1] = 0",
"- A[a] -= 1",
"+ A[a] = 0",
"-print((DP[N]))",
"+print((DP[N] % MOD))"
] | false | 0.037604 | 0.038188 | 0.984693 | [
"s656732953",
"s543403937"
] |
u744695362 | p02725 | python | s690398141 | s478102451 | 233 | 100 | 25,840 | 26,420 | Accepted | Accepted | 57.08 | k,n=list(map(int,input().split()))
arr=list(map(int,input().split()))
ans=10**18 #最小値を求めるので十分大きな値で初期化
for i in range(n): #上式を元に最短距離を求める
dist1=(arr[i-1]-arr[i])%k
dist2=(arr[i]-arr[(i+1)%n])%k
ans=min(ans,dist1,dist2)
print(ans)
| k,n = list(map(int,input().split()))
a =list(map(int,input().split()))
s =[a[i]-a[i-1] for i in range (1,n)] #2点距離をリストに格納(北端は越さない)
s.append(k-a[n-1]+a[0]) #北端を超える2点距離をリストに格納
print((k-max(s))) #最長距離となる2点を見つける→一周から引けば良い
| 8 | 5 | 232 | 219 | k, n = list(map(int, input().split()))
arr = list(map(int, input().split()))
ans = 10**18 # 最小値を求めるので十分大きな値で初期化
for i in range(n): # 上式を元に最短距離を求める
dist1 = (arr[i - 1] - arr[i]) % k
dist2 = (arr[i] - arr[(i + 1) % n]) % k
ans = min(ans, dist1, dist2)
print(ans)
| k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
s = [a[i] - a[i - 1] for i in range(1, n)] # 2点距離をリストに格納(北端は越さない)
s.append(k - a[n - 1] + a[0]) # 北端を超える2点距離をリストに格納
print((k - max(s))) # 最長距離となる2点を見つける→一周から引けば良い
| false | 37.5 | [
"-arr = list(map(int, input().split()))",
"-ans = 10**18 # 最小値を求めるので十分大きな値で初期化",
"-for i in range(n): # 上式を元に最短距離を求める",
"- dist1 = (arr[i - 1] - arr[i]) % k",
"- dist2 = (arr[i] - arr[(i + 1) % n]) % k",
"- ans = min(ans, dist1, dist2)",
"-print(ans)",
"+a = list(map(int, input().split()))"... | false | 0.037773 | 0.037543 | 1.006133 | [
"s690398141",
"s478102451"
] |
u046187684 | p03137 | python | s214530242 | s692964175 | 329 | 261 | 23,700 | 23,576 | Accepted | Accepted | 20.67 | import numpy as np
def solve(string):
n, m, *x = list(map(int, string.split()))
x = sorted(np.diff(sorted(x)))
return str(sum(x)) if n == 1 else str(sum(x[:-n + 1]))
if __name__ == '__main__':
print((solve("\n".join([eval(input()), eval(input())]))))
| import numpy as np
def solve(string):
n, m, *x = list(map(int, string.split()))
x = sorted(np.diff(sorted(x)), reverse=True)
return str(sum(x[n - 1:]))
if __name__ == '__main__':
print((solve("\n".join([eval(input()), eval(input())]))))
| 11 | 11 | 261 | 247 | import numpy as np
def solve(string):
n, m, *x = list(map(int, string.split()))
x = sorted(np.diff(sorted(x)))
return str(sum(x)) if n == 1 else str(sum(x[: -n + 1]))
if __name__ == "__main__":
print((solve("\n".join([eval(input()), eval(input())]))))
| import numpy as np
def solve(string):
n, m, *x = list(map(int, string.split()))
x = sorted(np.diff(sorted(x)), reverse=True)
return str(sum(x[n - 1 :]))
if __name__ == "__main__":
print((solve("\n".join([eval(input()), eval(input())]))))
| false | 0 | [
"- x = sorted(np.diff(sorted(x)))",
"- return str(sum(x)) if n == 1 else str(sum(x[: -n + 1]))",
"+ x = sorted(np.diff(sorted(x)), reverse=True)",
"+ return str(sum(x[n - 1 :]))"
] | false | 0.263561 | 0.196597 | 1.340611 | [
"s214530242",
"s692964175"
] |
u160414758 | p03490 | python | s283730656 | s764371183 | 23 | 19 | 3,572 | 3,188 | Accepted | Accepted | 17.39 | import sys,collections
sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def S(): return eval(input())
s = S()
gx,gy = Is()
l = s.split("T")
for i in range(len(l)):
l[i] = len(l[i])
xlis,ylis = l[::2],l[1::2]
sx = xlis.pop(0) if len(xlis)>0 else 0
sy = 0
xli... | s = input().split("T")
gx,gy = list(map(int,input().split()))
for i,e in enumerate(s):
s[i] = len(e)
xs,ys = s[::2],s[1::2]
x = xs.pop(0) if len(xs)>0 else 0
y = 0
xs.sort(reverse=True)
ys.sort(reverse=True)
def c(p,g,lis):
for e in lis:
if p <= g:
p += e
else:
... | 27 | 20 | 604 | 416 | import sys, collections
sys.setrecursionlimit(10**7)
def Is():
return [int(x) for x in sys.stdin.readline().split()]
def S():
return eval(input())
s = S()
gx, gy = Is()
l = s.split("T")
for i in range(len(l)):
l[i] = len(l[i])
xlis, ylis = l[::2], l[1::2]
sx = xlis.pop(0) if len(xlis) > 0 else 0
sy =... | s = input().split("T")
gx, gy = list(map(int, input().split()))
for i, e in enumerate(s):
s[i] = len(e)
xs, ys = s[::2], s[1::2]
x = xs.pop(0) if len(xs) > 0 else 0
y = 0
xs.sort(reverse=True)
ys.sort(reverse=True)
def c(p, g, lis):
for e in lis:
if p <= g:
p += e
else:
... | false | 25.925926 | [
"-import sys, collections",
"-",
"-sys.setrecursionlimit(10**7)",
"+s = input().split(\"T\")",
"+gx, gy = list(map(int, input().split()))",
"+for i, e in enumerate(s):",
"+ s[i] = len(e)",
"+xs, ys = s[::2], s[1::2]",
"+x = xs.pop(0) if len(xs) > 0 else 0",
"+y = 0",
"+xs.sort(reverse=True)",... | false | 0.045255 | 0.105941 | 0.427173 | [
"s283730656",
"s764371183"
] |
u811733736 | p02376 | python | s580959021 | s859979112 | 2,770 | 60 | 6,084 | 6,192 | Accepted | Accepted | 97.83 | # -*- coding: utf-8 -*-
"""
Network Flow - Maximum Flow
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_6_A&lang=jp
"""
import sys
from sys import stdin
from collections import namedtuple
input = stdin.readline
edge = namedtuple('edge', ['to', 'cap', 'rev'])
def add_edge(G, f, t, c):
G... | # -*- coding: utf-8 -*-
"""
Network Flow - Maximum Flow
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_6_A&lang=jp
"""
import sys
from sys import stdin
from collections import namedtuple, deque
input = stdin.readline
edge = namedtuple('edge', ['to', 'cap', 'rev'])
def add_edge(G, f, t, c... | 60 | 77 | 1,422 | 1,861 | # -*- coding: utf-8 -*-
"""
Network Flow - Maximum Flow
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_6_A&lang=jp
"""
import sys
from sys import stdin
from collections import namedtuple
input = stdin.readline
edge = namedtuple("edge", ["to", "cap", "rev"])
def add_edge(G, f, t, c):
G[f].append(edg... | # -*- coding: utf-8 -*-
"""
Network Flow - Maximum Flow
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_6_A&lang=jp
"""
import sys
from sys import stdin
from collections import namedtuple, deque
input = stdin.readline
edge = namedtuple("edge", ["to", "cap", "rev"])
def add_edge(G, f, t, c):
G[f].app... | false | 22.077922 | [
"-from collections import namedtuple",
"+from collections import namedtuple, deque",
"-def dfs(G, used, v, t, f):",
"+def bfs(G, level, s):",
"+ for i in range(len(level)):",
"+ level[i] = -1",
"+ que = deque()",
"+ level[s] = 0",
"+ que.append(s)",
"+ while que:",
"+ ... | false | 0.044529 | 0.038253 | 1.164067 | [
"s580959021",
"s859979112"
] |
u726769307 | p03087 | python | s601786226 | s423417492 | 975 | 423 | 28,296 | 17,312 | Accepted | Accepted | 56.62 | from numpy import cumsum
n,q=list(map(int,input().split()))
*s,=eval(input())
l=[0]*q
r=[0]*q
for i in range(q):
l[i],r[i]=list(map(int,input().split()))
a=[0]*n
for i in range(n-1):
if s[i]=="A" and s[i+1]=="C":
a[i]=1
b=[0]+list(cumsum(a))
for i in range(q):
print((b[r[i]-1]-b[l[i]-1]... | from itertools import accumulate
n,q=list(map(int,input().split()))
*s,=eval(input())
l=[0]*q
r=[0]*q
for i in range(q):
l[i],r[i]=list(map(int,input().split()))
a=[0]*n
for i in range(n-1):
if s[i]=="A" and s[i+1]=="C":
a[i]=1
b=[0]+list(accumulate(a))
for i in range(q):
print((b[r[i]-... | 14 | 14 | 302 | 314 | from numpy import cumsum
n, q = list(map(int, input().split()))
(*s,) = eval(input())
l = [0] * q
r = [0] * q
for i in range(q):
l[i], r[i] = list(map(int, input().split()))
a = [0] * n
for i in range(n - 1):
if s[i] == "A" and s[i + 1] == "C":
a[i] = 1
b = [0] + list(cumsum(a))
for i in range(q):
... | from itertools import accumulate
n, q = list(map(int, input().split()))
(*s,) = eval(input())
l = [0] * q
r = [0] * q
for i in range(q):
l[i], r[i] = list(map(int, input().split()))
a = [0] * n
for i in range(n - 1):
if s[i] == "A" and s[i + 1] == "C":
a[i] = 1
b = [0] + list(accumulate(a))
for i in ra... | false | 0 | [
"-from numpy import cumsum",
"+from itertools import accumulate",
"-b = [0] + list(cumsum(a))",
"+b = [0] + list(accumulate(a))"
] | false | 0.162935 | 0.036731 | 4.435901 | [
"s601786226",
"s423417492"
] |
u936985471 | p03162 | python | s798504839 | s066375896 | 577 | 241 | 25,340 | 28,764 | Accepted | Accepted | 58.23 | N=int(eval(input()))
dp=[[0 for i in range(3)] for j in range(N+1)]
for i in range(N):
a,b,c=list(map(int,input().split()))
dp[i+1][0]=max(dp[i][1]+a,dp[i][2]+a)
dp[i+1][1]=max(dp[i][0]+b,dp[i][2]+b)
dp[i+1][2]=max(dp[i][1]+c,dp[i][0]+c)
print((max(dp[N])))
| import sys
readline = sys.stdin.readline
N = int(readline())
dp = [[0] * 3 for i in range(N + 1)]
for i in range(N):
a,b,c = list(map(int,readline().split()))
dp[i + 1][0] = max(dp[i][1],dp[i][2]) + a
dp[i + 1][1] = max(dp[i][2],dp[i][0]) + b
dp[i + 1][2] = max(dp[i][0],dp[i][1]) + c
print((max... | 10 | 13 | 265 | 321 | N = int(eval(input()))
dp = [[0 for i in range(3)] for j in range(N + 1)]
for i in range(N):
a, b, c = list(map(int, input().split()))
dp[i + 1][0] = max(dp[i][1] + a, dp[i][2] + a)
dp[i + 1][1] = max(dp[i][0] + b, dp[i][2] + b)
dp[i + 1][2] = max(dp[i][1] + c, dp[i][0] + c)
print((max(dp[N])))
| import sys
readline = sys.stdin.readline
N = int(readline())
dp = [[0] * 3 for i in range(N + 1)]
for i in range(N):
a, b, c = list(map(int, readline().split()))
dp[i + 1][0] = max(dp[i][1], dp[i][2]) + a
dp[i + 1][1] = max(dp[i][2], dp[i][0]) + b
dp[i + 1][2] = max(dp[i][0], dp[i][1]) + c
print((max(d... | false | 23.076923 | [
"-N = int(eval(input()))",
"-dp = [[0 for i in range(3)] for j in range(N + 1)]",
"+import sys",
"+",
"+readline = sys.stdin.readline",
"+N = int(readline())",
"+dp = [[0] * 3 for i in range(N + 1)]",
"- a, b, c = list(map(int, input().split()))",
"- dp[i + 1][0] = max(dp[i][1] + a, dp[i][2] +... | false | 0.037152 | 0.098162 | 0.378476 | [
"s798504839",
"s066375896"
] |
u380524497 | p02679 | python | s034576947 | s218237957 | 939 | 660 | 49,476 | 49,360 | Accepted | Accepted | 29.71 | from collections import defaultdict
from math import gcd
mod = 10 ** 9 + 7
n = int(eval(input()))
fishes = defaultdict(int)
zero_zero = 0
zero = 0
inf = 0
for _ in range(n):
a, b = list(map(int, input().split()))
if a == 0 and b == 0:
zero_zero += 1
elif a == 0:
zero += 1
... | def main():
from collections import defaultdict
from math import gcd
import sys
input = sys.stdin.readline
mod = 10 ** 9 + 7
n = int(eval(input()))
fishes = defaultdict(int)
zero_zero = 0
zero = 0
inf = 0
for _ in range(n):
a, b = list(map(int, input... | 63 | 70 | 1,184 | 1,485 | from collections import defaultdict
from math import gcd
mod = 10**9 + 7
n = int(eval(input()))
fishes = defaultdict(int)
zero_zero = 0
zero = 0
inf = 0
for _ in range(n):
a, b = list(map(int, input().split()))
if a == 0 and b == 0:
zero_zero += 1
elif a == 0:
zero += 1
elif b == 0:
... | def main():
from collections import defaultdict
from math import gcd
import sys
input = sys.stdin.readline
mod = 10**9 + 7
n = int(eval(input()))
fishes = defaultdict(int)
zero_zero = 0
zero = 0
inf = 0
for _ in range(n):
a, b = list(map(int, input().split()))
... | false | 10 | [
"-from collections import defaultdict",
"-from math import gcd",
"+def main():",
"+ from collections import defaultdict",
"+ from math import gcd",
"+ import sys",
"-mod = 10**9 + 7",
"-n = int(eval(input()))",
"-fishes = defaultdict(int)",
"-zero_zero = 0",
"-zero = 0",
"-inf = 0",
... | false | 0.045046 | 0.045071 | 0.999435 | [
"s034576947",
"s218237957"
] |
u994988729 | p03700 | python | s948900861 | s096268306 | 1,035 | 372 | 7,064 | 17,864 | Accepted | Accepted | 64.06 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
N, A, B = list(map(int, readline().split()))
H = [int(readline()) for _ in range(N)]
def C(T):
"""
T回爆発させて、魔物全滅できるか
"""
damage = B * T
... | import numpy as np
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
N, A, B = list(map(int, readline().split()))
A = A - B
H = np.array([int(readline()) for _ in range(N)], dtype=np.int64)
def C(T):
h =... | 37 | 30 | 698 | 579 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
N, A, B = list(map(int, readline().split()))
H = [int(readline()) for _ in range(N)]
def C(T):
"""
T回爆発させて、魔物全滅できるか
"""
damage = B * T
cnt = 0
for h... | import numpy as np
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
N, A, B = list(map(int, readline().split()))
A = A - B
H = np.array([int(readline()) for _ in range(N)], dtype=np.int64)
def C(T):
h = H - B * T
... | false | 18.918919 | [
"+import numpy as np",
"-H = [int(readline()) for _ in range(N)]",
"+A = A - B",
"+H = np.array([int(readline()) for _ in range(N)], dtype=np.int64)",
"- \"\"\"",
"- T回爆発させて、魔物全滅できるか",
"- \"\"\"",
"- damage = B * T",
"- cnt = 0",
"- for h in H:",
"- h -= damage",
"- ... | false | 0.035561 | 0.175745 | 0.202347 | [
"s948900861",
"s096268306"
] |
u129749062 | p02622 | python | s684732562 | s704111752 | 84 | 62 | 12,564 | 9,400 | Accepted | Accepted | 26.19 | S = list(eval(input()))
T = list(eval(input()))
count = 0
for i in range(len(S)):
if S[i] != T[i]:
S[i] = T[i]
count += 1
print(count) | S = eval(input())
T = eval(input())
cnt = 0
for i in range(len(S)):
if S[i] != T[i]:
cnt+=1
print(cnt) | 8 | 7 | 149 | 102 | S = list(eval(input()))
T = list(eval(input()))
count = 0
for i in range(len(S)):
if S[i] != T[i]:
S[i] = T[i]
count += 1
print(count)
| S = eval(input())
T = eval(input())
cnt = 0
for i in range(len(S)):
if S[i] != T[i]:
cnt += 1
print(cnt)
| false | 12.5 | [
"-S = list(eval(input()))",
"-T = list(eval(input()))",
"-count = 0",
"+S = eval(input())",
"+T = eval(input())",
"+cnt = 0",
"- S[i] = T[i]",
"- count += 1",
"-print(count)",
"+ cnt += 1",
"+print(cnt)"
] | false | 0.043139 | 0.042027 | 1.026442 | [
"s684732562",
"s704111752"
] |
u989345508 | p02939 | python | s103525470 | s777015759 | 115 | 80 | 99,376 | 73,344 | Accepted | Accepted | 30.43 | s=eval(input())
n=len(s)
dp=[[0,0] for i in range(n)]
dp[0][0]=1
for i in range(1,n):
dp[i][0]=dp[i-1][1]+1
if s[i-1]!=s[i]:
dp[i][0]=max(dp[i][0],dp[i-1][0]+1)
if i>1:
dp[i][1]=dp[i-2][0]+1
if i>2:
if s[i-3:i-1]!=s[i-1:i+1]:
dp[i][1]=max(dp[i]... | s=eval(input())
ans=1
l=len(s)
now=s[0]
i=1
while i<l:
if now!=s[i]:
now=s[i]
ans+=1
i+=1
else:
if len(now)==2:
now=s[i]
ans+=1
i+=1
else:
if i<l-1:
now=s[i:i+2]
i+=2
... | 14 | 24 | 352 | 400 | s = eval(input())
n = len(s)
dp = [[0, 0] for i in range(n)]
dp[0][0] = 1
for i in range(1, n):
dp[i][0] = dp[i - 1][1] + 1
if s[i - 1] != s[i]:
dp[i][0] = max(dp[i][0], dp[i - 1][0] + 1)
if i > 1:
dp[i][1] = dp[i - 2][0] + 1
if i > 2:
if s[i - 3 : i - 1] != s[i - 1 : i +... | s = eval(input())
ans = 1
l = len(s)
now = s[0]
i = 1
while i < l:
if now != s[i]:
now = s[i]
ans += 1
i += 1
else:
if len(now) == 2:
now = s[i]
ans += 1
i += 1
else:
if i < l - 1:
now = s[i : i + 2]
... | false | 41.666667 | [
"-n = len(s)",
"-dp = [[0, 0] for i in range(n)]",
"-dp[0][0] = 1",
"-for i in range(1, n):",
"- dp[i][0] = dp[i - 1][1] + 1",
"- if s[i - 1] != s[i]:",
"- dp[i][0] = max(dp[i][0], dp[i - 1][0] + 1)",
"- if i > 1:",
"- dp[i][1] = dp[i - 2][0] + 1",
"- if i > 2:",
"-... | false | 0.038381 | 0.037746 | 1.016824 | [
"s103525470",
"s777015759"
] |
u401452016 | p02912 | python | s314384417 | s358996804 | 171 | 156 | 14,204 | 14,200 | Accepted | Accepted | 8.77 | import sys
import heapq
n, m = list(map(int, sys.stdin.readline().split()))
A = list([-int(x) for x in sys.stdin.readline().split()])
heapq.heapify(A)
for j in range(m):
heapq.heappush(A ,int(A[0]/2))
heapq.heappop(A)
print((-sum(A))) | #ABC141D
#heapq 効率的にリストの最小値を取り出す
def main():
import sys, heapq as h
N, M = list(map(int, sys.stdin.readline().split()))
A = list([-int(x) for x in sys.stdin.readline().split()])
#print(A)
h.heapify(A) #heap化
#print(A)
for m in range(M):
a = h.heappop(A)
#print(int(... | 11 | 18 | 250 | 437 | import sys
import heapq
n, m = list(map(int, sys.stdin.readline().split()))
A = list([-int(x) for x in sys.stdin.readline().split()])
heapq.heapify(A)
for j in range(m):
heapq.heappush(A, int(A[0] / 2))
heapq.heappop(A)
print((-sum(A)))
| # ABC141D
# heapq 効率的にリストの最小値を取り出す
def main():
import sys, heapq as h
N, M = list(map(int, sys.stdin.readline().split()))
A = list([-int(x) for x in sys.stdin.readline().split()])
# print(A)
h.heapify(A) # heap化
# print(A)
for m in range(M):
a = h.heappop(A)
# print(int(a/2... | false | 38.888889 | [
"-import sys",
"-import heapq",
"+# ABC141D",
"+# heapq 効率的にリストの最小値を取り出す",
"+def main():",
"+ import sys, heapq as h",
"-n, m = list(map(int, sys.stdin.readline().split()))",
"-A = list([-int(x) for x in sys.stdin.readline().split()])",
"-heapq.heapify(A)",
"-for j in range(m):",
"- heapq.... | false | 0.052071 | 0.048719 | 1.068804 | [
"s314384417",
"s358996804"
] |
u440161695 | p03607 | python | s713679822 | s327844461 | 205 | 189 | 11,884 | 14,696 | Accepted | Accepted | 7.8 | N=int(eval(input()))
s=set()
for i in range(N):
a=int(eval(input()))
if a in s:
s.remove(a)
else:
s.add(a)
print((len(s))) | N=int(eval(input()))
s=set()
for i in range(N):
s^={eval(input())}
print((len(s))) | 9 | 5 | 130 | 74 | N = int(eval(input()))
s = set()
for i in range(N):
a = int(eval(input()))
if a in s:
s.remove(a)
else:
s.add(a)
print((len(s)))
| N = int(eval(input()))
s = set()
for i in range(N):
s ^= {eval(input())}
print((len(s)))
| false | 44.444444 | [
"- a = int(eval(input()))",
"- if a in s:",
"- s.remove(a)",
"- else:",
"- s.add(a)",
"+ s ^= {eval(input())}"
] | false | 0.038629 | 0.045594 | 0.84724 | [
"s713679822",
"s327844461"
] |
u357751375 | p03568 | python | s907507190 | s174083430 | 274 | 29 | 9,012 | 9,128 | Accepted | Accepted | 89.42 | n = int(eval(input()))
a = list(map(int,input().split()))
amax = []
amin = []
for i in range(n):
amax.append(a[i] + 1)
amin.append(a[i] - 1)
m = 3 ** n
for z in range(3 ** n):
asearch = []
amulti = 1
x = z
for i in range(n):
asearch.append(x % 3)
x = x // 3
... | n = int(eval(input()))
a = list(map(int,input().split()))
ans = 3 ** n
o = 1
for i in range(n):
if a[i] % 2 == 0:
o *= 2
else:
o *= 1
print((ans - o)) | 30 | 10 | 555 | 175 | n = int(eval(input()))
a = list(map(int, input().split()))
amax = []
amin = []
for i in range(n):
amax.append(a[i] + 1)
amin.append(a[i] - 1)
m = 3**n
for z in range(3**n):
asearch = []
amulti = 1
x = z
for i in range(n):
asearch.append(x % 3)
x = x // 3
for i in range(n):
... | n = int(eval(input()))
a = list(map(int, input().split()))
ans = 3**n
o = 1
for i in range(n):
if a[i] % 2 == 0:
o *= 2
else:
o *= 1
print((ans - o))
| false | 66.666667 | [
"-amax = []",
"-amin = []",
"+ans = 3**n",
"+o = 1",
"- amax.append(a[i] + 1)",
"- amin.append(a[i] - 1)",
"-m = 3**n",
"-for z in range(3**n):",
"- asearch = []",
"- amulti = 1",
"- x = z",
"- for i in range(n):",
"- asearch.append(x % 3)",
"- x = x // 3",
... | false | 0.439592 | 0.040221 | 10.929366 | [
"s907507190",
"s174083430"
] |
u404627320 | p03455 | python | s201340135 | s876586738 | 21 | 18 | 3,316 | 2,940 | Accepted | Accepted | 14.29 | a, b = list(map(int, input().split()))
print(("Even" if a*b % 2 == 0 else "Odd")) | a, b = list(map(int, input().split()))
if a*b%2 == 0:
print("Even")
else:
print("Odd") | 2 | 5 | 74 | 88 | a, b = list(map(int, input().split()))
print(("Even" if a * b % 2 == 0 else "Odd"))
| a, b = list(map(int, input().split()))
if a * b % 2 == 0:
print("Even")
else:
print("Odd")
| false | 60 | [
"-print((\"Even\" if a * b % 2 == 0 else \"Odd\"))",
"+if a * b % 2 == 0:",
"+ print(\"Even\")",
"+else:",
"+ print(\"Odd\")"
] | false | 0.046231 | 0.04878 | 0.947735 | [
"s201340135",
"s876586738"
] |
u360116509 | p03673 | python | s599231020 | s134886799 | 88 | 49 | 25,716 | 24,260 | Accepted | Accepted | 44.32 | def main():
n = int(eval(input()))
A = input().split()
B = [0] * n
k = n % 2
l = n // 2
if k == 0:
l -= 1
r = l + 1
for i in range(n):
if i % 2 != k:
B[l] = A[i]
l -= 1
else:
B[r] = A[i]
r += 1
pr... | def main():
n = int(eval(input()))
A = input().split()
if n % 2 == 0:
print((' '.join(A[1::2][::-1] + A[0::2])))
else:
print((' '.join(A[0::2][::-1] + A[1::2])))
main()
| 20 | 10 | 343 | 202 | def main():
n = int(eval(input()))
A = input().split()
B = [0] * n
k = n % 2
l = n // 2
if k == 0:
l -= 1
r = l + 1
for i in range(n):
if i % 2 != k:
B[l] = A[i]
l -= 1
else:
B[r] = A[i]
r += 1
print((" ".join(B)... | def main():
n = int(eval(input()))
A = input().split()
if n % 2 == 0:
print((" ".join(A[1::2][::-1] + A[0::2])))
else:
print((" ".join(A[0::2][::-1] + A[1::2])))
main()
| false | 50 | [
"- B = [0] * n",
"- k = n % 2",
"- l = n // 2",
"- if k == 0:",
"- l -= 1",
"- r = l + 1",
"- for i in range(n):",
"- if i % 2 != k:",
"- B[l] = A[i]",
"- l -= 1",
"- else:",
"- B[r] = A[i]",
"- r += 1",
"- ... | false | 0.042531 | 0.043052 | 0.987891 | [
"s599231020",
"s134886799"
] |
u108617242 | p02934 | python | s886492682 | s038703895 | 193 | 168 | 38,256 | 38,512 | Accepted | Accepted | 12.95 | N = int(eval(input()))
A = list(map(int, input().split()))
rev_ans = 0
for a in A:
rev_ans += 1 / a
ans = 1 / rev_ans
print(ans) | N = int(eval(input()))
A = list(map(int, input().split()))
ans = 1 / sum([1 / x for x in A])
print(ans) | 7 | 4 | 126 | 105 | N = int(eval(input()))
A = list(map(int, input().split()))
rev_ans = 0
for a in A:
rev_ans += 1 / a
ans = 1 / rev_ans
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
ans = 1 / sum([1 / x for x in A])
print(ans)
| false | 42.857143 | [
"-rev_ans = 0",
"-for a in A:",
"- rev_ans += 1 / a",
"-ans = 1 / rev_ans",
"+ans = 1 / sum([1 / x for x in A])"
] | false | 0.042758 | 0.108453 | 0.394255 | [
"s886492682",
"s038703895"
] |
u894934980 | p02861 | python | s638690813 | s596215205 | 408 | 18 | 8,052 | 3,060 | Accepted | Accepted | 95.59 | import itertools
N = int(eval(input()))
points = [tuple(map(int, input().split())) for _ in range(N)]
sum_dist = 0
pattern = list(range(N))
patterns = list(itertools.permutations(pattern))
for pattern in patterns:
tmp_dist = 0
for i in range(N - 1):
x, y = points[pattern[i]]
nx, ... | N = int(eval(input()))
points = [list(map(int, input().split())) for _ in range(N)]
sum_dist = 0
for i in range(N):
for j in range(i + 1):
sum_dist += (
(points[j][0] - points[i][0]) ** 2 + (points[j][1] - points[i][1]) ** 2
) ** 0.5
print((sum_dist * 2 / N)) | 18 | 10 | 462 | 293 | import itertools
N = int(eval(input()))
points = [tuple(map(int, input().split())) for _ in range(N)]
sum_dist = 0
pattern = list(range(N))
patterns = list(itertools.permutations(pattern))
for pattern in patterns:
tmp_dist = 0
for i in range(N - 1):
x, y = points[pattern[i]]
nx, ny = points[pat... | N = int(eval(input()))
points = [list(map(int, input().split())) for _ in range(N)]
sum_dist = 0
for i in range(N):
for j in range(i + 1):
sum_dist += (
(points[j][0] - points[i][0]) ** 2 + (points[j][1] - points[i][1]) ** 2
) ** 0.5
print((sum_dist * 2 / N))
| false | 44.444444 | [
"-import itertools",
"-",
"-points = [tuple(map(int, input().split())) for _ in range(N)]",
"+points = [list(map(int, input().split())) for _ in range(N)]",
"-pattern = list(range(N))",
"-patterns = list(itertools.permutations(pattern))",
"-for pattern in patterns:",
"- tmp_dist = 0",
"- for i... | false | 0.158821 | 0.034839 | 4.558675 | [
"s638690813",
"s596215205"
] |
u596276291 | p03998 | python | s289501929 | s862719460 | 24 | 19 | 3,192 | 3,316 | Accepted | Accepted | 20.83 | def main():
sa = list(eval(input()))
sb = list(eval(input()))
sc = list(eval(input()))
c = {"a": sa, "b": sb, "c": sc}
now = "a"
while True:
s = c[now]
if len(s) == 0:
print((now.upper()))
break
now = c[now].pop(0)
if __name__ =... | from collections import defaultdict
def main():
d = {"a": eval(input()), "b": eval(input()), "c": eval(input())}
now = "a"
while True:
if len(d[now]) == 0:
print((now.upper()))
break
nex, d[now] = d[now][0], d[now][1:]
now = nex
if __name__ =... | 18 | 16 | 326 | 326 | def main():
sa = list(eval(input()))
sb = list(eval(input()))
sc = list(eval(input()))
c = {"a": sa, "b": sb, "c": sc}
now = "a"
while True:
s = c[now]
if len(s) == 0:
print((now.upper()))
break
now = c[now].pop(0)
if __name__ == "__main__":
... | from collections import defaultdict
def main():
d = {"a": eval(input()), "b": eval(input()), "c": eval(input())}
now = "a"
while True:
if len(d[now]) == 0:
print((now.upper()))
break
nex, d[now] = d[now][0], d[now][1:]
now = nex
if __name__ == "__main__":
... | false | 11.111111 | [
"+from collections import defaultdict",
"+",
"+",
"- sa = list(eval(input()))",
"- sb = list(eval(input()))",
"- sc = list(eval(input()))",
"- c = {\"a\": sa, \"b\": sb, \"c\": sc}",
"+ d = {\"a\": eval(input()), \"b\": eval(input()), \"c\": eval(input())}",
"- s = c[now]",
"... | false | 0.039519 | 0.055606 | 0.7107 | [
"s289501929",
"s862719460"
] |
u777923818 | p03008 | python | s002323758 | s280993357 | 805 | 706 | 41,180 | 42,204 | Accepted | Accepted | 12.3 | import sys
#input = sys.stdin.readline
from sys import setrecursionlimit
setrecursionlimit(10**9)
def inpl(): return list(map(int, input().split()))
N = int(eval(input()))
GA = inpl()
GB = inpl()
typ = [GA[i] <= GB[i] for i in range(3)]
if sum(typ) == 3:
ans = 0
for g in range(N//GA[0] + 1):
... | import sys
#input = sys.stdin.readline
from sys import setrecursionlimit
setrecursionlimit(10**9)
def inpl(): return list(map(int, input().split()))
N = int(eval(input()))
GA = inpl()
GB = inpl()
typ = [GA[i] <= GB[i] for i in range(3)]
if sum(typ) == 3:
ans = 0
for g in range(N//GA[0] + 1):
... | 53 | 50 | 1,457 | 1,332 | import sys
# input = sys.stdin.readline
from sys import setrecursionlimit
setrecursionlimit(10**9)
def inpl():
return list(map(int, input().split()))
N = int(eval(input()))
GA = inpl()
GB = inpl()
typ = [GA[i] <= GB[i] for i in range(3)]
if sum(typ) == 3:
ans = 0
for g in range(N // GA[0] + 1):
... | import sys
# input = sys.stdin.readline
from sys import setrecursionlimit
setrecursionlimit(10**9)
def inpl():
return list(map(int, input().split()))
N = int(eval(input()))
GA = inpl()
GB = inpl()
typ = [GA[i] <= GB[i] for i in range(3)]
if sum(typ) == 3:
ans = 0
for g in range(N // GA[0] + 1):
... | false | 5.660377 | [
"- for b in range(D // GB[y] + 1):",
"- a, D2 = divmod(D - GB[y] * b, GB[x])",
"- ans = max(ans, D2 + GA[x] * a + GA[y] * b)"
] | false | 0.044378 | 0.045484 | 0.975683 | [
"s002323758",
"s280993357"
] |
u729133443 | p03327 | python | s330997366 | s893916678 | 171 | 17 | 38,420 | 2,940 | Accepted | Accepted | 90.06 | print(('AB'+'CD'[len(eval(input()))>3])) | print(('DC'[len(eval(input('AB')))<4])) | 1 | 1 | 32 | 31 | print(("AB" + "CD"[len(eval(input())) > 3]))
| print(("DC"[len(eval(input("AB"))) < 4]))
| false | 0 | [
"-print((\"AB\" + \"CD\"[len(eval(input())) > 3]))",
"+print((\"DC\"[len(eval(input(\"AB\"))) < 4]))"
] | false | 0.046985 | 0.035962 | 1.306531 | [
"s330997366",
"s893916678"
] |
u089230684 | p03487 | python | s195924514 | s089314073 | 116 | 102 | 23,284 | 17,780 | Accepted | Accepted | 12.07 | n = int(eval(input()))
arr = []
out = {}
input = input().split(" ")
for i in input:
arr.append(int(i))
if out.get(arr[-1], False):
out[arr[-1]] += 1
else:
out[arr[-1]] = 1
count = 0
for key in out:
if key > out[key]:
count += out[key]
else:
count += out[key] - key
print(count) | N = int(eval(input()))
seq = list(map(int, input().split()))
d = {}
for i in range(0,N):
e = seq[i]
if e not in list(d.keys()):
d[e] = 1
else:
d[e] += 1
r = 0
for k in list(d.keys()):
v = d[k]
if (v < k):
r += v
else:
r += v-k
print(r)
| 21 | 20 | 309 | 296 | n = int(eval(input()))
arr = []
out = {}
input = input().split(" ")
for i in input:
arr.append(int(i))
if out.get(arr[-1], False):
out[arr[-1]] += 1
else:
out[arr[-1]] = 1
count = 0
for key in out:
if key > out[key]:
count += out[key]
else:
count += out[key] - key
pri... | N = int(eval(input()))
seq = list(map(int, input().split()))
d = {}
for i in range(0, N):
e = seq[i]
if e not in list(d.keys()):
d[e] = 1
else:
d[e] += 1
r = 0
for k in list(d.keys()):
v = d[k]
if v < k:
r += v
else:
r += v - k
print(r)
| false | 4.761905 | [
"-n = int(eval(input()))",
"-arr = []",
"-out = {}",
"-input = input().split(\" \")",
"-for i in input:",
"- arr.append(int(i))",
"- if out.get(arr[-1], False):",
"- out[arr[-1]] += 1",
"+N = int(eval(input()))",
"+seq = list(map(int, input().split()))",
"+d = {}",
"+for i in rang... | false | 0.1394 | 0.114977 | 1.212417 | [
"s195924514",
"s089314073"
] |
u279439669 | p02571 | python | s625638301 | s582321339 | 47 | 40 | 9,092 | 9,024 | Accepted | Accepted | 14.89 | def subst(S, T)-> int:
lenT = len(T)
result = lenT
for i in range(len(S) - lenT + 1):
# tempS = S[i-lenT:i]
tempResult = 0
for j in range(lenT):
if T[j] != S[j + i]:
tempResult += 1
if tempResult < result:
result = tempResult
return result
if __name__ == "... | def subst(S, T)-> int:
lenT = len(T)
result = lenT
for i in range(lenT, len(S) + 1):
tempS = S[i-lenT:i]
tempResult = 0
for j in range(lenT):
if T[j] != tempS[j]:
tempResult += 1
if tempResult < result:
result = tempResult
return result
if __name__ == "__m... | 18 | 18 | 382 | 379 | def subst(S, T) -> int:
lenT = len(T)
result = lenT
for i in range(len(S) - lenT + 1):
# tempS = S[i-lenT:i]
tempResult = 0
for j in range(lenT):
if T[j] != S[j + i]:
tempResult += 1
if tempResult < result:
result = tempResult
retur... | def subst(S, T) -> int:
lenT = len(T)
result = lenT
for i in range(lenT, len(S) + 1):
tempS = S[i - lenT : i]
tempResult = 0
for j in range(lenT):
if T[j] != tempS[j]:
tempResult += 1
if tempResult < result:
result = tempResult
retu... | false | 0 | [
"- for i in range(len(S) - lenT + 1):",
"- # tempS = S[i-lenT:i]",
"+ for i in range(lenT, len(S) + 1):",
"+ tempS = S[i - lenT : i]",
"- if T[j] != S[j + i]:",
"+ if T[j] != tempS[j]:"
] | false | 0.04522 | 0.046434 | 0.973856 | [
"s625638301",
"s582321339"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.