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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u335278042 | p03262 | python | s228025389 | s816655007 | 101 | 92 | 14,252 | 14,252 | Accepted | Accepted | 8.91 | N,X = list(map(int, input().split()))
def myabs(i):
return abs(i-X)
xlis = list(map(myabs, list(map(int, input().split()))))
from fractions import gcd
res = xlis[0]
for i in xlis:
res = gcd(i,res)
print(res) | N,X = list(map(int, input().split()))
def myabs(i):
return abs(i-X)
xlis = list(map(myabs, list(map(int, input().split()))))
from fractions import gcd
res = xlis[0]
for i in xlis:
if i%res == 0:
continue
res = gcd(i,res)
print(res) | 12 | 14 | 217 | 255 | N, X = list(map(int, input().split()))
def myabs(i):
return abs(i - X)
xlis = list(map(myabs, list(map(int, input().split()))))
from fractions import gcd
res = xlis[0]
for i in xlis:
res = gcd(i, res)
print(res)
| N, X = list(map(int, input().split()))
def myabs(i):
return abs(i - X)
xlis = list(map(myabs, list(map(int, input().split()))))
from fractions import gcd
res = xlis[0]
for i in xlis:
if i % res == 0:
continue
res = gcd(i, res)
print(res)
| false | 14.285714 | [
"+ if i % res == 0:",
"+ continue"
] | false | 0.055592 | 0.049133 | 1.131467 | [
"s228025389",
"s816655007"
] |
u047796752 | p03158 | python | s046037905 | s711275987 | 1,409 | 612 | 86,380 | 102,272 | Accepted | Accepted | 56.56 | import sys
input = sys.stdin.readline
from collections import *
from bisect import *
def judge(x):
tak = N-x
aoki = x-bisect_left(A, 2*X-A[x])+1
return tak<=aoki
def binary_search():
l, r = mark, N-1
while l<=r:
m = (l+r)//2
if judge(m):
... | import sys
input = sys.stdin.readline
from collections import *
from bisect import *
def judge(x):
aoki = N-x-bisect_left(A, 2*X-A[N-x])+1
return x<=aoki
def binary_search():
l, r = 1, N-bisect_left(A, X)
while l<=r:
m = (l+r)//2
if judge(m):
... | 50 | 48 | 935 | 905 | import sys
input = sys.stdin.readline
from collections import *
from bisect import *
def judge(x):
tak = N - x
aoki = x - bisect_left(A, 2 * X - A[x]) + 1
return tak <= aoki
def binary_search():
l, r = mark, N - 1
while l <= r:
m = (l + r) // 2
if judge(m):
r = m - 1... | import sys
input = sys.stdin.readline
from collections import *
from bisect import *
def judge(x):
aoki = N - x - bisect_left(A, 2 * X - A[N - x]) + 1
return x <= aoki
def binary_search():
l, r = 1, N - bisect_left(A, X)
while l <= r:
m = (l + r) // 2
if judge(m):
l = m ... | false | 4 | [
"- tak = N - x",
"- aoki = x - bisect_left(A, 2 * X - A[x]) + 1",
"- return tak <= aoki",
"+ aoki = N - x - bisect_left(A, 2 * X - A[N - x]) + 1",
"+ return x <= aoki",
"- l, r = mark, N - 1",
"+ l, r = 1, N - bisect_left(A, X)",
"+ l = m + 1",
"+ else:",
"- ... | false | 0.042588 | 0.036879 | 1.154822 | [
"s046037905",
"s711275987"
] |
u357751375 | p02773 | python | s649254126 | s504423557 | 641 | 525 | 48,708 | 48,648 | Accepted | Accepted | 18.1 | import collections
n = int(eval(input()))
s = list(eval(input()) for i in range(n))
s = sorted(s)
c = collections.Counter(s)
p = max(c.values())
s = sorted(list(set(s)))
for i in range(len(s)):
if c[s[i]] == p:
print((s[i])) | import collections
n = int(eval(input()))
s = list(eval(input()) for i in range(n))
c = collections.Counter(s)
p = max(c.values())
s = sorted(list(set(s)))
for i in range(len(s)):
if c[s[i]] == p:
print((s[i])) | 12 | 11 | 235 | 220 | import collections
n = int(eval(input()))
s = list(eval(input()) for i in range(n))
s = sorted(s)
c = collections.Counter(s)
p = max(c.values())
s = sorted(list(set(s)))
for i in range(len(s)):
if c[s[i]] == p:
print((s[i]))
| import collections
n = int(eval(input()))
s = list(eval(input()) for i in range(n))
c = collections.Counter(s)
p = max(c.values())
s = sorted(list(set(s)))
for i in range(len(s)):
if c[s[i]] == p:
print((s[i]))
| false | 8.333333 | [
"-s = sorted(s)"
] | false | 0.036869 | 0.035947 | 1.025649 | [
"s649254126",
"s504423557"
] |
u029000441 | p03160 | python | s831661899 | s194295240 | 195 | 145 | 14,056 | 14,492 | Accepted | Accepted | 25.64 | n=int(eval(input()))
hs=input().rstrip().split(" ")
costs=[0 for i in range(n)]
costs[1]=abs(int(hs[1])-int(hs[0]))
for i in range(n-2):
jump=costs[i]+abs(int(hs[i+2])-int(hs[i]))
walk=costs[i+1]+abs(int(hs[i+2])-int(hs[i+1]))
costs[i+2]=min(jump,walk)
print((costs[-1])) | 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... | 9 | 29 | 283 | 923 | n = int(eval(input()))
hs = input().rstrip().split(" ")
costs = [0 for i in range(n)]
costs[1] = abs(int(hs[1]) - int(hs[0]))
for i in range(n - 2):
jump = costs[i] + abs(int(hs[i + 2]) - int(hs[i]))
walk = costs[i + 1] + abs(int(hs[i + 2]) - int(hs[i + 1]))
costs[i + 2] = min(jump, walk)
print((costs[-1]))... | 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 | 68.965517 | [
"-n = int(eval(input()))",
"-hs = input().rstrip().split(\" \")",
"-costs = [0 for i in range(n)]",
"-costs[1] = abs(int(hs[1]) - int(hs[0]))",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+sys.setrecursionlimit(10**7)",
"+from collections import Counter, deque",
"+from collections import d... | false | 0.045333 | 0.075679 | 0.599016 | [
"s831661899",
"s194295240"
] |
u981931040 | p03380 | python | s330543297 | s629621444 | 113 | 100 | 14,428 | 14,180 | Accepted | Accepted | 11.5 | N = int(eval(input()))
A = list(map(int,input().split()))
A.sort(reverse=True)
max_val = A[0]
min_val = float("inf")
for i in range(1,N):
tmp_min = abs(max_val / 2 - A[i])
if min_val > tmp_min:
min_val = tmp_min
ans_min = A[i]
print((max_val , ans_min)) | import math
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
ans = A[-1]
target = math.ceil(A[-1] / 2)
dis = float('inf')
for a in A:
tmp_dis = abs(target - a)
if tmp_dis < dis:
dis = tmp_dis
tmp_ans = a
print((ans, tmp_ans))
| 11 | 13 | 279 | 273 | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort(reverse=True)
max_val = A[0]
min_val = float("inf")
for i in range(1, N):
tmp_min = abs(max_val / 2 - A[i])
if min_val > tmp_min:
min_val = tmp_min
ans_min = A[i]
print((max_val, ans_min))
| import math
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
ans = A[-1]
target = math.ceil(A[-1] / 2)
dis = float("inf")
for a in A:
tmp_dis = abs(target - a)
if tmp_dis < dis:
dis = tmp_dis
tmp_ans = a
print((ans, tmp_ans))
| false | 15.384615 | [
"+import math",
"+",
"-A.sort(reverse=True)",
"-max_val = A[0]",
"-min_val = float(\"inf\")",
"-for i in range(1, N):",
"- tmp_min = abs(max_val / 2 - A[i])",
"- if min_val > tmp_min:",
"- min_val = tmp_min",
"- ans_min = A[i]",
"-print((max_val, ans_min))",
"+A.sort()",
... | false | 0.041784 | 0.038461 | 1.086397 | [
"s330543297",
"s629621444"
] |
u254871849 | p03487 | python | s452890235 | s956781667 | 72 | 65 | 18,728 | 18,728 | Accepted | Accepted | 9.72 | import sys
import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
def main():
n, *a = (int(x) for x in sys.stdin.read().split())
c = collections.Counter(a)
count = 0
for i, j in list(c.items()):
if j < i: count += j
... | import sys
from collections import Counter
n, *a = list(map(int, sys.stdin.read().split()))
def main():
res = 0
for v, c in list(Counter(a).items()):
if c < v:
res += c
elif c > v:
res += c - v
return res
if __name__ == '__main__':
ans = main()
... | 23 | 17 | 451 | 322 | import sys
import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
def main():
n, *a = (int(x) for x in sys.stdin.read().split())
c = collections.Counter(a)
count = 0
for i, j in list(c.items()):
if j < i:
count += j
... | import sys
from collections import Counter
n, *a = list(map(int, sys.stdin.read().split()))
def main():
res = 0
for v, c in list(Counter(a).items()):
if c < v:
res += c
elif c > v:
res += c - v
return res
if __name__ == "__main__":
ans = main()
print(ans)... | false | 26.086957 | [
"-import collections",
"+from collections import Counter",
"-# import math",
"-# import string",
"-# import bisect",
"-# import re",
"-# import itertools",
"-# import statistics",
"+n, *a = list(map(int, sys.stdin.read().split()))",
"+",
"+",
"- n, *a = (int(x) for x in sys.stdin.read().spl... | false | 0.041 | 0.07854 | 0.522027 | [
"s452890235",
"s956781667"
] |
u421828301 | p02622 | python | s322603166 | s174603802 | 79 | 72 | 67,980 | 73,740 | Accepted | Accepted | 8.86 | # -*- coding: utf-8 -*-
S = str(eval(input()))
T = str(eval(input()))
ans = 0
for i in range(len(S)):
if S[i] != T[i]:
ans += 1
print(ans)
| #入力
s = str(eval(input()))
t = str(eval(input()))
#変数
count = 0
#必要な値を計算
l = len(s)
#処理
for i in range(l):
if (s[i] != t[i]):
count += 1
#出力
print(count)
| 11 | 18 | 152 | 176 | # -*- coding: utf-8 -*-
S = str(eval(input()))
T = str(eval(input()))
ans = 0
for i in range(len(S)):
if S[i] != T[i]:
ans += 1
print(ans)
| # 入力
s = str(eval(input()))
t = str(eval(input()))
# 変数
count = 0
# 必要な値を計算
l = len(s)
# 処理
for i in range(l):
if s[i] != t[i]:
count += 1
# 出力
print(count)
| false | 38.888889 | [
"-# -*- coding: utf-8 -*-",
"-S = str(eval(input()))",
"-T = str(eval(input()))",
"-ans = 0",
"-for i in range(len(S)):",
"- if S[i] != T[i]:",
"- ans += 1",
"-print(ans)",
"+# 入力",
"+s = str(eval(input()))",
"+t = str(eval(input()))",
"+# 変数",
"+count = 0",
"+# 必要な値を計算",
"+l =... | false | 0.038086 | 0.070911 | 0.53709 | [
"s322603166",
"s174603802"
] |
u392319141 | p03228 | python | s919686458 | s826745655 | 19 | 17 | 3,064 | 3,060 | Accepted | Accepted | 10.53 | A, B, K = list(map(int, input().split()))
for i in range(K):
if i % 2 == 0:
B += A // 2
A //= 2
else:
A += B // 2
B //= 2
print((A, B)) | A, B, K = list(map(int, input().split()))
while True:
if K == 0:
break
if A % 2 == 1:
A -= 1
A //= 2
B += A
K -= 1
if K == 0:
break
if B % 2 == 1:
B -= 1
B //= 2
A += B
K -= 1
print((A, B))
| 11 | 20 | 179 | 276 | A, B, K = list(map(int, input().split()))
for i in range(K):
if i % 2 == 0:
B += A // 2
A //= 2
else:
A += B // 2
B //= 2
print((A, B))
| A, B, K = list(map(int, input().split()))
while True:
if K == 0:
break
if A % 2 == 1:
A -= 1
A //= 2
B += A
K -= 1
if K == 0:
break
if B % 2 == 1:
B -= 1
B //= 2
A += B
K -= 1
print((A, B))
| false | 45 | [
"-for i in range(K):",
"- if i % 2 == 0:",
"- B += A // 2",
"- A //= 2",
"- else:",
"- A += B // 2",
"- B //= 2",
"+while True:",
"+ if K == 0:",
"+ break",
"+ if A % 2 == 1:",
"+ A -= 1",
"+ A //= 2",
"+ B += A",
"+ K -= 1",... | false | 0.0475 | 0.03771 | 1.259601 | [
"s919686458",
"s826745655"
] |
u638902622 | p03069 | python | s864640020 | s851250712 | 87 | 47 | 3,500 | 3,500 | Accepted | Accepted | 45.98 | import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
#======================================================#
def main():
n = II()
s = IS()
cnt_b = 0
cnt_w = s.count('.')
cnt = cnt_w
for i in rang... | import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
#======================================================#
def main():
n = II()
s = IS()
cnt_b = 0
cnt_w = s.count('.')
cnt = cnt_w
for si in s:
... | 22 | 24 | 508 | 530 | import sys
## io ##
def IS():
return sys.stdin.readline().rstrip()
def II():
return int(IS())
def MII():
return list(map(int, IS().split()))
# ======================================================#
def main():
n = II()
s = IS()
cnt_b = 0
cnt_w = s.count(".")
cnt = cnt_w
for i... | import sys
## io ##
def IS():
return sys.stdin.readline().rstrip()
def II():
return int(IS())
def MII():
return list(map(int, IS().split()))
# ======================================================#
def main():
n = II()
s = IS()
cnt_b = 0
cnt_w = s.count(".")
cnt = cnt_w
for s... | false | 8.333333 | [
"- for i in range(n):",
"- if s[i] == \"#\":",
"+ for si in s:",
"+ if si == \"#\":",
"- cnt = min(cnt, cnt_b + cnt_w)",
"+ c = cnt_b + cnt_w",
"+ if c < cnt:",
"+ cnt = c"
] | false | 0.237671 | 0.082351 | 2.886076 | [
"s864640020",
"s851250712"
] |
u729133443 | p04033 | python | s916109669 | s517466890 | 166 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.76 | a,b=list(map(int,input().split()));print(('NPeogsaittiivvee'[a>0or(b-a)%2::2]*(a*b>0)or'Zero')) | a,b=list(map(int,input().split()));print(('PNoesgiattiivvee'[b<0and(b-a+1)%2::2]*(a*b>0)or'Zero')) | 1 | 1 | 87 | 90 | a, b = list(map(int, input().split()))
print(("NPeogsaittiivvee"[a > 0 or (b - a) % 2 :: 2] * (a * b > 0) or "Zero"))
| a, b = list(map(int, input().split()))
print(("PNoesgiattiivvee"[b < 0 and (b - a + 1) % 2 :: 2] * (a * b > 0) or "Zero"))
| false | 0 | [
"-print((\"NPeogsaittiivvee\"[a > 0 or (b - a) % 2 :: 2] * (a * b > 0) or \"Zero\"))",
"+print((\"PNoesgiattiivvee\"[b < 0 and (b - a + 1) % 2 :: 2] * (a * b > 0) or \"Zero\"))"
] | false | 0.044881 | 0.007803 | 5.752 | [
"s916109669",
"s517466890"
] |
u634079249 | p03739 | python | s406423557 | s241106879 | 93 | 82 | 19,660 | 19,736 | Accepted | Accepted | 11.83 | import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque
# import fractions
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstr... | import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: li... | 62 | 63 | 1,675 | 1,669 | import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque
# import fractions
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il =... | import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(i... | false | 1.587302 | [
"-# import fractions",
"-# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)",
"- # 偶数番目の合計を負",
"- # 奇数番目の合計を正にするパターン",
"- sm, r1 = 0, 0",
"- for n in range(N):",
"- sm += A[n]",
"- if n % 2 == 0 and sm < 1:",
"- r1 += abs(sm) + 1",
"- sm = 1",
"- ... | false | 0.089212 | 0.041466 | 2.151453 | [
"s406423557",
"s241106879"
] |
u673361376 | p03262 | python | s727413886 | s075309610 | 338 | 96 | 90,260 | 16,280 | Accepted | Accepted | 71.6 | from fractions import gcd
from functools import reduce
N, X = list(map(int,input().split()))
xlist = list(map(int, input().split()))
new_xlist = [(x - xlist[0]) for x in xlist]
X -= xlist[0]
print((abs(reduce(gcd, new_xlist + [X])))) | import fractions
import functools
N, X = list(map(int, input().split()))
cities = []
for city in list(map(int, input().split())):
cities.append(city - X)
gcd = functools.reduce(fractions.gcd, cities)
print((gcd if gcd > 0 else -gcd)) | 8 | 9 | 233 | 238 | from fractions import gcd
from functools import reduce
N, X = list(map(int, input().split()))
xlist = list(map(int, input().split()))
new_xlist = [(x - xlist[0]) for x in xlist]
X -= xlist[0]
print((abs(reduce(gcd, new_xlist + [X]))))
| import fractions
import functools
N, X = list(map(int, input().split()))
cities = []
for city in list(map(int, input().split())):
cities.append(city - X)
gcd = functools.reduce(fractions.gcd, cities)
print((gcd if gcd > 0 else -gcd))
| false | 11.111111 | [
"-from fractions import gcd",
"-from functools import reduce",
"+import fractions",
"+import functools",
"-xlist = list(map(int, input().split()))",
"-new_xlist = [(x - xlist[0]) for x in xlist]",
"-X -= xlist[0]",
"-print((abs(reduce(gcd, new_xlist + [X]))))",
"+cities = []",
"+for city in list(m... | false | 0.117974 | 0.055068 | 2.142355 | [
"s727413886",
"s075309610"
] |
u572144347 | p03078 | python | s351310957 | s067386421 | 731 | 349 | 145,776 | 55,260 | Accepted | Accepted | 52.26 | X,Y,Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
apb = []
for a in A:
for b in B:
apb.append(a+b)
apb.sort(reverse=True)
... | X,Y,Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
count = 0
queued = set()
from heapq import heappush, heappop
hpq = []
i = j = k = 0
h... | 28 | 44 | 472 | 1,073 | X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
apb = []
for a in A:
for b in B:
apb.append(a + b)
apb.sort(reverse=True)
apb = apb[:K]
ans ... | X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
count = 0
queued = set()
from heapq import heappush, heappop
hpq = []
i = j = k = 0
heappush(hpq, (-(A[... | false | 36.363636 | [
"-apb = []",
"-for a in A:",
"- for b in B:",
"- apb.append(a + b)",
"-apb.sort(reverse=True)",
"-apb = apb[:K]",
"+count = 0",
"+queued = set()",
"+from heapq import heappush, heappop",
"+",
"+hpq = []",
"+i = j = k = 0",
"+heappush(hpq, (-(A[i] + B[j] + C[k]), i, j, k))",
"+que... | false | 0.069037 | 0.104113 | 0.663096 | [
"s351310957",
"s067386421"
] |
u758815106 | p02899 | python | s479991048 | s852955155 | 163 | 87 | 25,320 | 20,908 | Accepted | Accepted | 46.63 | N = int(input())
A = list(map(int, input().split()))
dic = {i:0 for i in range(1, N + 1)}
for i in range(N):
a = A[i]
dic[a] = i + 1
for i in range(1, N + 1):
print(dic[i], end="")
if i != N:
print(" ", end="")
print()
| N = int(eval(input()))
A = list(map(int, input().split()))
a = [0] * N
for i in range(N):
a[A[i] - 1] = str(i + 1)
res = " ".join(a)
print(res) | 16 | 11 | 262 | 155 | N = int(input())
A = list(map(int, input().split()))
dic = {i: 0 for i in range(1, N + 1)}
for i in range(N):
a = A[i]
dic[a] = i + 1
for i in range(1, N + 1):
print(dic[i], end="")
if i != N:
print(" ", end="")
print()
| N = int(eval(input()))
A = list(map(int, input().split()))
a = [0] * N
for i in range(N):
a[A[i] - 1] = str(i + 1)
res = " ".join(a)
print(res)
| false | 31.25 | [
"-N = int(input())",
"+N = int(eval(input()))",
"-dic = {i: 0 for i in range(1, N + 1)}",
"+a = [0] * N",
"- a = A[i]",
"- dic[a] = i + 1",
"-for i in range(1, N + 1):",
"- print(dic[i], end=\"\")",
"- if i != N:",
"- print(\" \", end=\"\")",
"-print()",
"+ a[A[i] - 1] = ... | false | 0.104677 | 0.037756 | 2.772451 | [
"s479991048",
"s852955155"
] |
u312025627 | p03565 | python | s408416274 | s715604899 | 183 | 168 | 38,384 | 38,384 | Accepted | Accepted | 8.2 | def main():
S = input()
T = input()
N = len(S)
M = len(T)
for i in range(N-M+1)[::-1]:
for s, t in zip(S[i:i+M], T):
if s != t and s != "?":
break
else:
return print(S[:i].replace("?", "a") + T + S[i+M:].replace("?", "a"))
print(... | def main():
S = input()
T = input()
N = len(S)
M = len(T)
for i in range(N-M+1)[::-1]:
if all(s == t or s == "?" for s, t in zip(S[i:i+M], T)):
return print(S[:i].replace("?", "a") + T + S[i+M:].replace("?", "a"))
print("UNRESTORABLE")
if __name__ == '__main__':
... | 16 | 13 | 380 | 332 | def main():
S = input()
T = input()
N = len(S)
M = len(T)
for i in range(N - M + 1)[::-1]:
for s, t in zip(S[i : i + M], T):
if s != t and s != "?":
break
else:
return print(S[:i].replace("?", "a") + T + S[i + M :].replace("?", "a"))
print(... | def main():
S = input()
T = input()
N = len(S)
M = len(T)
for i in range(N - M + 1)[::-1]:
if all(s == t or s == "?" for s, t in zip(S[i : i + M], T)):
return print(S[:i].replace("?", "a") + T + S[i + M :].replace("?", "a"))
print("UNRESTORABLE")
if __name__ == "__main__":
... | false | 18.75 | [
"- for s, t in zip(S[i : i + M], T):",
"- if s != t and s != \"?\":",
"- break",
"- else:",
"+ if all(s == t or s == \"?\" for s, t in zip(S[i : i + M], T)):"
] | false | 0.048397 | 0.048351 | 1.000948 | [
"s408416274",
"s715604899"
] |
u037430802 | p03061 | python | s848245397 | s729947038 | 317 | 234 | 14,584 | 14,564 | Accepted | Accepted | 26.18 | N = int(eval(input()))
A = list(map(int, input().split()))
def gcd(a,b):
x = max([a,b])
y = min([a,b])
while y:
x, y = y, x % y
return x
L = [0]
R = [0]
for i in range(N):
L.append(gcd(L[-1], A[i]))
for i in reversed(list(range(N))):
R.append(gcd(R[-1], A[i]))
R = list(... |
N = int(eval(input()))
A = tuple(map(int, input().split()))
from fractions import gcd
def lcm(x, y):
return x * y // gcd(x, y)
gcds = [0] * N
gcds[0] = A[0]
rev_gcds = [0] * N
rev_gcds[-1] = A[-1]
for i in range(1, N):
gcds[i] = gcd(A[i], gcds[i-1])
rev_gcds[N-1-i] = gcd(A[N-1-i], rev_... | 34 | 29 | 527 | 540 | N = int(eval(input()))
A = list(map(int, input().split()))
def gcd(a, b):
x = max([a, b])
y = min([a, b])
while y:
x, y = y, x % y
return x
L = [0]
R = [0]
for i in range(N):
L.append(gcd(L[-1], A[i]))
for i in reversed(list(range(N))):
R.append(gcd(R[-1], A[i]))
R = list(reversed(R)... | N = int(eval(input()))
A = tuple(map(int, input().split()))
from fractions import gcd
def lcm(x, y):
return x * y // gcd(x, y)
gcds = [0] * N
gcds[0] = A[0]
rev_gcds = [0] * N
rev_gcds[-1] = A[-1]
for i in range(1, N):
gcds[i] = gcd(A[i], gcds[i - 1])
rev_gcds[N - 1 - i] = gcd(A[N - 1 - i], rev_gcds[N -... | false | 14.705882 | [
"-A = list(map(int, input().split()))",
"+A = tuple(map(int, input().split()))",
"+from fractions import gcd",
"-def gcd(a, b):",
"- x = max([a, b])",
"- y = min([a, b])",
"- while y:",
"- x, y = y, x % y",
"- return x",
"+def lcm(x, y):",
"+ return x * y // gcd(x, y)",
"... | false | 0.034517 | 0.044803 | 0.770416 | [
"s848245397",
"s729947038"
] |
u531599639 | p02768 | python | s346561554 | s444505750 | 1,241 | 125 | 9,156 | 9,136 | Accepted | Accepted | 89.93 | mod = 10**9+7
n,a,b = list(map(int,input().split()))
base = pow(2,n,mod)-1
def comb(n,k):
comb = 1
for i in range(n-k+1,n+1):
comb *= i
comb %= mod
for i in range(1, k+1):
comb *= pow(i,mod-2,mod)
comb %= mod
return comb
print(((base-comb(n,a)-comb(n,b))%mod)) | mod = 10**9+7
n,a,b = list(map(int,input().split()))
def comb(k):
m = 1
c = 1
for i in range(k):
m = m*(n-i)%mod
c = c*(i+1)%mod
return (m*pow(c,mod-2,mod)%mod)
print(((pow(2,n,mod)-1-comb(a)-comb(b))%mod)) | 13 | 10 | 288 | 223 | mod = 10**9 + 7
n, a, b = list(map(int, input().split()))
base = pow(2, n, mod) - 1
def comb(n, k):
comb = 1
for i in range(n - k + 1, n + 1):
comb *= i
comb %= mod
for i in range(1, k + 1):
comb *= pow(i, mod - 2, mod)
comb %= mod
return comb
print(((base - comb(n, a... | mod = 10**9 + 7
n, a, b = list(map(int, input().split()))
def comb(k):
m = 1
c = 1
for i in range(k):
m = m * (n - i) % mod
c = c * (i + 1) % mod
return m * pow(c, mod - 2, mod) % mod
print(((pow(2, n, mod) - 1 - comb(a) - comb(b)) % mod))
| false | 23.076923 | [
"-base = pow(2, n, mod) - 1",
"-def comb(n, k):",
"- comb = 1",
"- for i in range(n - k + 1, n + 1):",
"- comb *= i",
"- comb %= mod",
"- for i in range(1, k + 1):",
"- comb *= pow(i, mod - 2, mod)",
"- comb %= mod",
"- return comb",
"+def comb(k):",
"+ ... | false | 1.214568 | 0.100364 | 12.101651 | [
"s346561554",
"s444505750"
] |
u440566786 | p02913 | python | s841562640 | s797616471 | 259 | 229 | 45,296 | 43,760 | Accepted | Accepted | 11.58 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def bisect(l,r,f,discrete=True,left=True):
"""
l,r: l<r int if discrete else float
f: function defined on [l,...,r] to {False,True}
if discrete: f defined on Z; else: R
if ... | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def bisect(l,r,f,discrete=True,left=True):
"""
l,r: l<r int if discrete else float
f: function defined on [l,...,r] to {False,True}
if discrete: f defined on Z; else: R
if ... | 98 | 94 | 3,056 | 2,966 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def bisect(l, r, f, discrete=True, left=True):
"""
l,r: l<r int if discrete else float
f: function defined on [l,...,r] to {False,True}
if discrete: f defined on Z; else: R
... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def bisect(l, r, f, discrete=True, left=True):
"""
l,r: l<r int if discrete else float
f: function defined on [l,...,r] to {False,True}
if discrete: f defined on Z; else: R
... | false | 4.081633 | [
"- self.__d = 0",
"- while m1:",
"- m1 //= 10",
"- self.__d += 1",
"- return hash of S[l:r]",
"+ return (hash1,hash2) of S[l:r]",
"- self.__H1[r] - self.__P1[r - l] * self.__H1[l] % self.__m1",
"- ) % self.__m1 * (10**self.__d) + (",
... | false | 0.039543 | 0.007413 | 5.334613 | [
"s841562640",
"s797616471"
] |
u580093517 | p03250 | python | s391779991 | s064907189 | 20 | 17 | 3,060 | 2,940 | Accepted | Accepted | 15 | a = list(map(int,input().split()))
x = max(a)
a.remove(max(a))
print((10*x + a[0] +a[1])) | a,b,c = sorted(map(int,input().split()))
print((10*c+a+b)) | 4 | 2 | 90 | 57 | a = list(map(int, input().split()))
x = max(a)
a.remove(max(a))
print((10 * x + a[0] + a[1]))
| a, b, c = sorted(map(int, input().split()))
print((10 * c + a + b))
| false | 50 | [
"-a = list(map(int, input().split()))",
"-x = max(a)",
"-a.remove(max(a))",
"-print((10 * x + a[0] + a[1]))",
"+a, b, c = sorted(map(int, input().split()))",
"+print((10 * c + a + b))"
] | false | 0.048775 | 0.048695 | 1.001644 | [
"s391779991",
"s064907189"
] |
u762420987 | p03998 | python | s215569705 | s167325550 | 166 | 17 | 38,384 | 2,940 | Accepted | Accepted | 89.76 | Sa = list(eval(input()))
Sb = list(eval(input()))
Sc = list(eval(input()))
dic = {"a": Sa, "b": Sb, "c": Sc}
hiku = "a"
while True:
try:
sasareta = dic[hiku].pop(0)
except IndexError:
print((hiku.upper()))
break
hiku = sasareta
| A = list(eval(input()))
B = list(eval(input()))
C = list(eval(input()))
now = "a"
d = {"a": A, "b": B, "c": C}
while A or B or C:
if not d[now]:
print((now.upper()))
break
else:
now = d[now].pop(0)
| 12 | 11 | 255 | 220 | Sa = list(eval(input()))
Sb = list(eval(input()))
Sc = list(eval(input()))
dic = {"a": Sa, "b": Sb, "c": Sc}
hiku = "a"
while True:
try:
sasareta = dic[hiku].pop(0)
except IndexError:
print((hiku.upper()))
break
hiku = sasareta
| A = list(eval(input()))
B = list(eval(input()))
C = list(eval(input()))
now = "a"
d = {"a": A, "b": B, "c": C}
while A or B or C:
if not d[now]:
print((now.upper()))
break
else:
now = d[now].pop(0)
| false | 8.333333 | [
"-Sa = list(eval(input()))",
"-Sb = list(eval(input()))",
"-Sc = list(eval(input()))",
"-dic = {\"a\": Sa, \"b\": Sb, \"c\": Sc}",
"-hiku = \"a\"",
"-while True:",
"- try:",
"- sasareta = dic[hiku].pop(0)",
"- except IndexError:",
"- print((hiku.upper()))",
"+A = list(eval(in... | false | 0.046671 | 0.042715 | 1.092624 | [
"s215569705",
"s167325550"
] |
u497592162 | p02773 | python | s064185788 | s001916852 | 976 | 608 | 101,276 | 35,216 | Accepted | Accepted | 37.7 | N = int(eval(input()))
input_line = [eval(input()) for _ in range(N)]
count = {}
for w in input_line:
if w in count:
count[w] += 1
else:
count[w] = 1
max_values = max(count.values())
keys = [k for k, v in list(count.items()) if v == max_values]
for w in sorted(keys):
print(w)
| N = int(eval(input()))
# input_line = [input() for _ in range(N)]
count = {}
for w in [eval(input()) for _ in range(N)]:
if w in count:
count[w] += 1
else:
count[w] = 1
max_values = max(count.values())
keys = [k for k, v in list(count.items()) if v == max_values]
for w in sorted(keys):... | 12 | 12 | 298 | 317 | N = int(eval(input()))
input_line = [eval(input()) for _ in range(N)]
count = {}
for w in input_line:
if w in count:
count[w] += 1
else:
count[w] = 1
max_values = max(count.values())
keys = [k for k, v in list(count.items()) if v == max_values]
for w in sorted(keys):
print(w)
| N = int(eval(input()))
# input_line = [input() for _ in range(N)]
count = {}
for w in [eval(input()) for _ in range(N)]:
if w in count:
count[w] += 1
else:
count[w] = 1
max_values = max(count.values())
keys = [k for k, v in list(count.items()) if v == max_values]
for w in sorted(keys):
print... | false | 0 | [
"-input_line = [eval(input()) for _ in range(N)]",
"+# input_line = [input() for _ in range(N)]",
"-for w in input_line:",
"+for w in [eval(input()) for _ in range(N)]:"
] | false | 0.037997 | 0.040562 | 0.936754 | [
"s064185788",
"s001916852"
] |
u591808161 | p02623 | python | s449555888 | s888396140 | 157 | 145 | 114,972 | 113,460 | Accepted | Accepted | 7.64 | #関数リスト
import sys
input = sys.stdin.readline
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def ruiseki(mydata):
res = [0]*(len(mydata)+1)
for i in range(len(mydata)):
res[i+1] = res[i] + mydata[i]
retu... | #関数リスト
import sys
input = sys.stdin.readline
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def ruiseki(mydata):
res = [0]*(len(mydata)+1)
for i in range(len(mydata)):
res[i+1] = res[i] + mydata[i]
retu... | 26 | 26 | 569 | 556 | # 関数リスト
import sys
input = sys.stdin.readline
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def ruiseki(mydata):
res = [0] * (len(mydata) + 1)
for i in range(len(mydata)):
res[i + 1] = res[i] + my... | # 関数リスト
import sys
input = sys.stdin.readline
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def ruiseki(mydata):
res = [0] * (len(mydata) + 1)
for i in range(len(mydata)):
res[i + 1] = res[i] + my... | false | 0 | [
"-a = tuple(ruiseki(LI()))",
"-b = tuple(ruiseki(LI()))",
"+a = ruiseki(LI())",
"+b = ruiseki(LI())"
] | false | 0.045856 | 0.044037 | 1.041288 | [
"s449555888",
"s888396140"
] |
u046187684 | p03108 | python | s841527447 | s736899697 | 530 | 481 | 26,648 | 26,264 | Accepted | Accepted | 9.25 | class uf:
def __init__(self, n):
self.table = [-1] * (n + 1)
self.size = [1] * (n + 1)
def merge(self, r1, r2):
self.table[r1] = r2
self.size[r2] += self.size[r1]
self.size[r1] = 0
def find_root(self, k):
path = []
curr = k
whi... | class UnionFind:
def __init__(self, n):
self.table = [-1] * (n + 1)
self.size = [1] * (n + 1)
def merge(self, r1, r2):
self.table[r1] = r2
self.size[r2] += self.size[r1]
self.size[r1] = 0
def find_root(self, k):
path = []
curr = k
... | 44 | 44 | 1,195 | 1,171 | class uf:
def __init__(self, n):
self.table = [-1] * (n + 1)
self.size = [1] * (n + 1)
def merge(self, r1, r2):
self.table[r1] = r2
self.size[r2] += self.size[r1]
self.size[r1] = 0
def find_root(self, k):
path = []
curr = k
while self.table[c... | class UnionFind:
def __init__(self, n):
self.table = [-1] * (n + 1)
self.size = [1] * (n + 1)
def merge(self, r1, r2):
self.table[r1] = r2
self.size[r2] += self.size[r1]
self.size[r1] = 0
def find_root(self, k):
path = []
curr = k
while self.... | false | 0 | [
"-class uf:",
"+class UnionFind:",
"- return curr, path",
"+ return curr",
"- table = uf(n)",
"+ uf = UnionFind(n)",
"- r_a, _ = table.find_root(_a)",
"- r_b, _ = table.find_root(_b)",
"- if r_a == r_b:",
"+ ra = uf.find_root(_a)",
"+ rb = u... | false | 0.040517 | 0.095092 | 0.426081 | [
"s841527447",
"s736899697"
] |
u764789069 | p00007 | python | s750775378 | s695213862 | 10 | 0 | 4,684 | 4,676 | Accepted | Accepted | 100 | rishi=0.05
debt= 100000
week = int(input())
kiriage = 1000
def ceil(src, range):
return((int)(src / range) + 1) * range
for i in range(0,week):
if debt * 1.05 % kiriage !=0:
debt = ceil(debt * (1+rishi), kiriage)
#print debt
else:
debt = debt * (1+rishi)
#pri... | rishi=0.05
debt= 100000
week = int(input())
kiriage = 1000
def ceil(src, range):
if int(src * (1 + rishi) % range) == 0:
return src * (1+rishi)
else:
return((int)(src*(1+rishi) / range) + 1) * range
for i in range(0,week):
debt = ceil(debt, kiriage)
print(debt) | 17 | 14 | 345 | 307 | rishi = 0.05
debt = 100000
week = int(input())
kiriage = 1000
def ceil(src, range):
return ((int)(src / range) + 1) * range
for i in range(0, week):
if debt * 1.05 % kiriage != 0:
debt = ceil(debt * (1 + rishi), kiriage)
# print debt
else:
debt = debt * (1 + rishi)
# prin... | rishi = 0.05
debt = 100000
week = int(input())
kiriage = 1000
def ceil(src, range):
if int(src * (1 + rishi) % range) == 0:
return src * (1 + rishi)
else:
return ((int)(src * (1 + rishi) / range) + 1) * range
for i in range(0, week):
debt = ceil(debt, kiriage)
print(debt)
| false | 17.647059 | [
"- return ((int)(src / range) + 1) * range",
"+ if int(src * (1 + rishi) % range) == 0:",
"+ return src * (1 + rishi)",
"+ else:",
"+ return ((int)(src * (1 + rishi) / range) + 1) * range",
"- if debt * 1.05 % kiriage != 0:",
"- debt = ceil(debt * (1 + rishi), kiriage)",... | false | 0.051049 | 0.04981 | 1.024861 | [
"s750775378",
"s695213862"
] |
u151625340 | p02861 | python | s725137982 | s807227609 | 198 | 18 | 38,384 | 3,064 | Accepted | Accepted | 90.91 | N = int(eval(input()))
L = [list(map(int,input().split())) for i in range(N)]
ans = 0
import math
def d(x1,x2):
return math.sqrt((x1[0]-x2[0])**2+(x1[1]-x2[1])**2)
for i in range(N-1):
for j in range(i+1,N):
ans += d(L[i],L[j])*2/N
print(ans) | N = int(eval(input()))
import math
def d(x,y):
return math.sqrt((x[0]-y[0])**2+(x[1]-y[1])**2)
ans = 0
xy = [list(map(int,input().split())) for i in range(N)]
for i in range(N-1):
for j in range(i,N):
ans += 2*d(xy[i],xy[j])/N
print(ans) | 10 | 10 | 261 | 256 | N = int(eval(input()))
L = [list(map(int, input().split())) for i in range(N)]
ans = 0
import math
def d(x1, x2):
return math.sqrt((x1[0] - x2[0]) ** 2 + (x1[1] - x2[1]) ** 2)
for i in range(N - 1):
for j in range(i + 1, N):
ans += d(L[i], L[j]) * 2 / N
print(ans)
| N = int(eval(input()))
import math
def d(x, y):
return math.sqrt((x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2)
ans = 0
xy = [list(map(int, input().split())) for i in range(N)]
for i in range(N - 1):
for j in range(i, N):
ans += 2 * d(xy[i], xy[j]) / N
print(ans)
| false | 0 | [
"-L = [list(map(int, input().split())) for i in range(N)]",
"-ans = 0",
"-def d(x1, x2):",
"- return math.sqrt((x1[0] - x2[0]) ** 2 + (x1[1] - x2[1]) ** 2)",
"+def d(x, y):",
"+ return math.sqrt((x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2)",
"+ans = 0",
"+xy = [list(map(int, input().split())) for i ... | false | 0.124753 | 0.067209 | 1.856191 | [
"s725137982",
"s807227609"
] |
u785989355 | p02913 | python | s900717866 | s484073021 | 559 | 250 | 153,992 | 46,444 | Accepted | Accepted | 55.28 | import sys
def input():
return sys.stdin.readline()[:-1]
from collections import defaultdict
N = int(eval(input()))
S = eval(input())
def is_pos(n,S,N):
dd = defaultdict(int)
flag =True
for i in range(N-n+1):
s = dd[S[i:i+n]]
if s!=0:
if i+1-s>=n:
... | class RollingHash():
def __init__(self, s):
self.length = len(s)
self.base = 1009
self.mod = (1 << 127) - 1
self.hash = [0] * (self.length + 1)
self.pow = [1] * (self.length + 1)
for i in range(self.length):
self.hash[i+1] = (self.hash[i] + ord(... | 33 | 49 | 606 | 1,126 | import sys
def input():
return sys.stdin.readline()[:-1]
from collections import defaultdict
N = int(eval(input()))
S = eval(input())
def is_pos(n, S, N):
dd = defaultdict(int)
flag = True
for i in range(N - n + 1):
s = dd[S[i : i + n]]
if s != 0:
if i + 1 - s >= n:
... | class RollingHash:
def __init__(self, s):
self.length = len(s)
self.base = 1009
self.mod = (1 << 127) - 1
self.hash = [0] * (self.length + 1)
self.pow = [1] * (self.length + 1)
for i in range(self.length):
self.hash[i + 1] = (self.hash[i] + ord(s[i])) * se... | false | 32.653061 | [
"-import sys",
"+class RollingHash:",
"+ def __init__(self, s):",
"+ self.length = len(s)",
"+ self.base = 1009",
"+ self.mod = (1 << 127) - 1",
"+ self.hash = [0] * (self.length + 1)",
"+ self.pow = [1] * (self.length + 1)",
"+ for i in range(self.length... | false | 0.127213 | 0.092807 | 1.370732 | [
"s900717866",
"s484073021"
] |
u750651325 | p02696 | python | s337727221 | s473691779 | 23 | 20 | 9,100 | 9,080 | Accepted | Accepted | 13.04 | import sys
input = sys.stdin.readline
A, B, N = list(map(int,input().split()))
x = 0
if N >= B:
x = B-1
else:
x = N
print((A*x//B))
| import sys
sys.stdin.readline
A, B, N = list(map(int, input().split()))
ans = 0
if N >= B:
ans = B-1
else:
ans = N
print((A * ans //B))
| 12 | 12 | 146 | 150 | import sys
input = sys.stdin.readline
A, B, N = list(map(int, input().split()))
x = 0
if N >= B:
x = B - 1
else:
x = N
print((A * x // B))
| import sys
sys.stdin.readline
A, B, N = list(map(int, input().split()))
ans = 0
if N >= B:
ans = B - 1
else:
ans = N
print((A * ans // B))
| false | 0 | [
"-input = sys.stdin.readline",
"+sys.stdin.readline",
"-x = 0",
"+ans = 0",
"- x = B - 1",
"+ ans = B - 1",
"- x = N",
"-print((A * x // B))",
"+ ans = N",
"+print((A * ans // B))"
] | false | 0.074009 | 0.063078 | 1.173291 | [
"s337727221",
"s473691779"
] |
u829249049 | p03161 | python | s605497256 | s314041574 | 228 | 179 | 85,408 | 84,736 | Accepted | Accepted | 21.49 | n,k=list(map(int,input().split()))
h=list(map(int,input().split()))
cost=[0]*n
for i in range(1,n):
cost[i]=min( [cost[i-j]+abs(h[i]-h[i-j]) for j in range(1,min(i+1,k+1))] )
print((cost[-1])) | n,k=list(map(int,input().split()))
h=list(map(int,input().split()))
cost=[10**9]*n
cost[0]=0
for i in range(1,n):
for j in range(1,min(i+1,k+1)):
cost[i]=min(cost[i],cost[i-j]+abs(h[i]-h[i-j]))
print((cost[-1])) | 7 | 9 | 194 | 219 | n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
cost = [0] * n
for i in range(1, n):
cost[i] = min(
[cost[i - j] + abs(h[i] - h[i - j]) for j in range(1, min(i + 1, k + 1))]
)
print((cost[-1]))
| n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
cost = [10**9] * n
cost[0] = 0
for i in range(1, n):
for j in range(1, min(i + 1, k + 1)):
cost[i] = min(cost[i], cost[i - j] + abs(h[i] - h[i - j]))
print((cost[-1]))
| false | 22.222222 | [
"-cost = [0] * n",
"+cost = [10**9] * n",
"+cost[0] = 0",
"- cost[i] = min(",
"- [cost[i - j] + abs(h[i] - h[i - j]) for j in range(1, min(i + 1, k + 1))]",
"- )",
"+ for j in range(1, min(i + 1, k + 1)):",
"+ cost[i] = min(cost[i], cost[i - j] + abs(h[i] - h[i - j]))"
] | false | 0.040068 | 0.040847 | 0.980939 | [
"s605497256",
"s314041574"
] |
u546338822 | p02695 | python | s055570627 | s395304289 | 958 | 604 | 9,224 | 9,064 | Accepted | Accepted | 36.95 | def main():
n,m,q = list(map(int,input().split()))
Q = []
for _ in range(q):
a,b,c,d = list(map(int,input().split()))
Q.append([a,b,c,d])
ans = 0
for a in range(1,11):
for b in range(a,11):
for c in range(b,11):
for d in range(c,11):
... | def main():
import itertools
n,m,q = list(map(int,input().split()))
Q = []
for i in range(q):
Q.append(list(map(int,input().split())))
cmb = [i for i in range(1,m+1)]
ans = 0
for que in itertools.combinations_with_replacement(cmb,n):
m = 0
for i in range(q):... | 34 | 20 | 1,361 | 505 | def main():
n, m, q = list(map(int, input().split()))
Q = []
for _ in range(q):
a, b, c, d = list(map(int, input().split()))
Q.append([a, b, c, d])
ans = 0
for a in range(1, 11):
for b in range(a, 11):
for c in range(b, 11):
for d in range(c, 11):
... | def main():
import itertools
n, m, q = list(map(int, input().split()))
Q = []
for i in range(q):
Q.append(list(map(int, input().split())))
cmb = [i for i in range(1, m + 1)]
ans = 0
for que in itertools.combinations_with_replacement(cmb, n):
m = 0
for i in range(q):
... | false | 41.176471 | [
"+ import itertools",
"+",
"- for _ in range(q):",
"- a, b, c, d = list(map(int, input().split()))",
"- Q.append([a, b, c, d])",
"+ for i in range(q):",
"+ Q.append(list(map(int, input().split())))",
"+ cmb = [i for i in range(1, m + 1)]",
"- for a in range(1, 11)... | false | 1.27821 | 0.054394 | 23.499169 | [
"s055570627",
"s395304289"
] |
u124498235 | p02928 | python | s926993169 | s485049548 | 1,348 | 1,002 | 3,188 | 3,188 | Accepted | Accepted | 25.67 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 10**9+7
cnt = 0
cnt2 = 0
for i in range(n):
for j in range(n):
if i < j and a[i] > a[j]:
cnt += 1
if a[i] > a[j]:
cnt2 += 1
ans = (cnt*k + (k*(k-1)//2)*cnt2)%mod
print (ans) | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 10**9+7
cnt = 0
cnt2 = 0
for i in range(n):
for j in range(n):
if a[i] > a[j]:
cnt2 += 1
if i < j:
cnt += 1
ans = (cnt*k + (k*(k-1)//2)*cnt2)%mod
print (ans) | 13 | 13 | 282 | 270 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 10**9 + 7
cnt = 0
cnt2 = 0
for i in range(n):
for j in range(n):
if i < j and a[i] > a[j]:
cnt += 1
if a[i] > a[j]:
cnt2 += 1
ans = (cnt * k + (k * (k - 1) // 2) * cnt2) % mod
print(ans)
| n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 10**9 + 7
cnt = 0
cnt2 = 0
for i in range(n):
for j in range(n):
if a[i] > a[j]:
cnt2 += 1
if i < j:
cnt += 1
ans = (cnt * k + (k * (k - 1) // 2) * cnt2) % mod
print(ans)
| false | 0 | [
"- if i < j and a[i] > a[j]:",
"- cnt += 1",
"+ if i < j:",
"+ cnt += 1"
] | false | 0.033004 | 0.038022 | 0.868024 | [
"s926993169",
"s485049548"
] |
u057586044 | p03760 | python | s125597837 | s803805127 | 20 | 17 | 3,060 | 3,060 | Accepted | Accepted | 15 | o, e = [input().rstrip() for i in range(2)]
ans = ""
for i in range(len(o)):
ans += o[i]
if len(e) > i: ans += e[i]
print(ans) | O,E=[list(input().rstrip()) for _ in range(2)]
for i in range(len(E)):
O.insert(2*i+1,E[i])
print(*O,sep="")
| 6 | 4 | 136 | 115 | o, e = [input().rstrip() for i in range(2)]
ans = ""
for i in range(len(o)):
ans += o[i]
if len(e) > i:
ans += e[i]
print(ans)
| O, E = [list(input().rstrip()) for _ in range(2)]
for i in range(len(E)):
O.insert(2 * i + 1, E[i])
print(*O, sep="")
| false | 33.333333 | [
"-o, e = [input().rstrip() for i in range(2)]",
"-ans = \"\"",
"-for i in range(len(o)):",
"- ans += o[i]",
"- if len(e) > i:",
"- ans += e[i]",
"-print(ans)",
"+O, E = [list(input().rstrip()) for _ in range(2)]",
"+for i in range(len(E)):",
"+ O.insert(2 * i + 1, E[i])",
"+print... | false | 0.047024 | 0.048351 | 0.972554 | [
"s125597837",
"s803805127"
] |
u761320129 | p03408 | python | s073121588 | s027561474 | 30 | 21 | 3,444 | 3,316 | Accepted | Accepted | 30 | from collections import Counter
N = int(eval(input()))
s1 = [eval(input()) for i in range(N)]
c1 = Counter(s1)
M = int(eval(input()))
s2 = [eval(input()) for i in range(M)]
c2 = Counter(s2)
ans = 0
for k,v in list(c1.items()):
ans = max(ans, v-c2[k])
print(ans) | from collections import Counter
N = int(eval(input()))
S = [eval(input()) for i in range(N)]
M = int(eval(input()))
T = [eval(input()) for i in range(M)]
c1 = Counter(S)
c2 = Counter(T)
ans = 0
for k,v in list(c1.items()):
tmp = v - c2[k]
ans = max(ans, tmp)
print(ans) | 12 | 13 | 247 | 260 | from collections import Counter
N = int(eval(input()))
s1 = [eval(input()) for i in range(N)]
c1 = Counter(s1)
M = int(eval(input()))
s2 = [eval(input()) for i in range(M)]
c2 = Counter(s2)
ans = 0
for k, v in list(c1.items()):
ans = max(ans, v - c2[k])
print(ans)
| from collections import Counter
N = int(eval(input()))
S = [eval(input()) for i in range(N)]
M = int(eval(input()))
T = [eval(input()) for i in range(M)]
c1 = Counter(S)
c2 = Counter(T)
ans = 0
for k, v in list(c1.items()):
tmp = v - c2[k]
ans = max(ans, tmp)
print(ans)
| false | 7.692308 | [
"-s1 = [eval(input()) for i in range(N)]",
"-c1 = Counter(s1)",
"+S = [eval(input()) for i in range(N)]",
"-s2 = [eval(input()) for i in range(M)]",
"-c2 = Counter(s2)",
"+T = [eval(input()) for i in range(M)]",
"+c1 = Counter(S)",
"+c2 = Counter(T)",
"- ans = max(ans, v - c2[k])",
"+ tmp = ... | false | 0.036955 | 0.067097 | 0.550767 | [
"s073121588",
"s027561474"
] |
u804085889 | p03110 | python | s709693493 | s639647463 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | N = int(eval(input()))
JPY = 0
BTC = 0
for _ in range(N):
a = list(input().split())
if a[1] == 'JPY': JPY += int(a[0])
else: BTC += float(a[0])
print((float(JPY + BTC*380000.0))) | n = int(eval(input()))
money = [input().split() for _ in range(n)]
print((sum([float(x)*{"JPY":1, "BTC":380000}[u] for x,u in money]))) | 8 | 3 | 189 | 129 | N = int(eval(input()))
JPY = 0
BTC = 0
for _ in range(N):
a = list(input().split())
if a[1] == "JPY":
JPY += int(a[0])
else:
BTC += float(a[0])
print((float(JPY + BTC * 380000.0)))
| n = int(eval(input()))
money = [input().split() for _ in range(n)]
print((sum([float(x) * {"JPY": 1, "BTC": 380000}[u] for x, u in money])))
| false | 62.5 | [
"-N = int(eval(input()))",
"-JPY = 0",
"-BTC = 0",
"-for _ in range(N):",
"- a = list(input().split())",
"- if a[1] == \"JPY\":",
"- JPY += int(a[0])",
"- else:",
"- BTC += float(a[0])",
"-print((float(JPY + BTC * 380000.0)))",
"+n = int(eval(input()))",
"+money = [input... | false | 0.050175 | 0.048261 | 1.039678 | [
"s709693493",
"s639647463"
] |
u119714109 | p03161 | python | s145000362 | s510257603 | 796 | 167 | 117,792 | 84,880 | Accepted | Accepted | 79.02 | from numba import jit
import math
N, K = list(map(int, input().split()))
h = list(map(int, input().split()))
@jit
def nya(N, K, h):
S = [0] * N
S[0] = 0
for i in range(1, N):
value = math.inf
for step in range(1, K + 1):
if i - step < 0:
break
... | import math
N, K = list(map(int, input().split()))
h = list(map(int, input().split()))
def nya(N, K, h):
S = [0] * N
S[0] = 0
for i in range(1, N):
value = math.inf
for step in range(1, K + 1):
if i - step < 0:
break
value = min(value,... | 20 | 18 | 446 | 417 | from numba import jit
import math
N, K = list(map(int, input().split()))
h = list(map(int, input().split()))
@jit
def nya(N, K, h):
S = [0] * N
S[0] = 0
for i in range(1, N):
value = math.inf
for step in range(1, K + 1):
if i - step < 0:
break
value... | import math
N, K = list(map(int, input().split()))
h = list(map(int, input().split()))
def nya(N, K, h):
S = [0] * N
S[0] = 0
for i in range(1, N):
value = math.inf
for step in range(1, K + 1):
if i - step < 0:
break
value = min(value, S[i - step] +... | false | 10 | [
"-from numba import jit",
"-@jit"
] | false | 0.04531 | 0.038929 | 1.163922 | [
"s145000362",
"s510257603"
] |
u297574184 | p03536 | python | s537712570 | s334603369 | 1,676 | 850 | 4,544 | 4,004 | Accepted | Accepted | 49.28 | from bisect import bisect_right
N = int(eval(input()))
HPs = [tuple(map(int, input().split())) for i in range(N)]
HPs.sort(key=lambda x: x[0] + x[1])
# i人目まで考慮して、j人積んだ場合の積まれている高さの最小値
# 計算量削減のため、dp[j]=∞であるjのうち、最小のj以外は省略する
INF = float('inf')
dp = [0] + [INF]
for H, P in HPs:
iH = bisect_right(dp, H)
... | from bisect import bisect_right
N = int(eval(input()))
HPs = [tuple(map(int, input().split())) for i in range(N)]
HPs.sort(key=lambda x: x[0] + x[1])
# i人目まで考慮して、j人積んだ場合の積まれている高さの最小値
# 計算量削減のため、dp[j]=∞であるjのうち、最小のj以外は省略する
INF = float('inf')
dp = [0] + [INF]
lenDP = 2
num = 0
for i, (H, P) in enumerate(HP... | 20 | 32 | 507 | 846 | from bisect import bisect_right
N = int(eval(input()))
HPs = [tuple(map(int, input().split())) for i in range(N)]
HPs.sort(key=lambda x: x[0] + x[1])
# i人目まで考慮して、j人積んだ場合の積まれている高さの最小値
# 計算量削減のため、dp[j]=∞であるjのうち、最小のj以外は省略する
INF = float("inf")
dp = [0] + [INF]
for H, P in HPs:
iH = bisect_right(dp, H)
dp0 = [0] + ... | from bisect import bisect_right
N = int(eval(input()))
HPs = [tuple(map(int, input().split())) for i in range(N)]
HPs.sort(key=lambda x: x[0] + x[1])
# i人目まで考慮して、j人積んだ場合の積まれている高さの最小値
# 計算量削減のため、dp[j]=∞であるjのうち、最小のj以外は省略する
INF = float("inf")
dp = [0] + [INF]
lenDP = 2
num = 0
for i, (H, P) in enumerate(HPs, 1):
iH =... | false | 37.5 | [
"-for H, P in HPs:",
"+lenDP = 2",
"+num = 0",
"+for i, (H, P) in enumerate(HPs, 1):",
"- dp0 = [0] + [hgt + P for hgt in dp[:iH]] + [INF] * (len(dp) - iH)",
"- dp = [x if x <= y else y for x, y in zip(dp0, dp)]",
"+ x = lenDP - N + i - 2",
"+ if x <= 0:",
"+ dp0 = [0] + [hgt + P ... | false | 0.032411 | 0.040106 | 0.808129 | [
"s537712570",
"s334603369"
] |
u780962115 | p02844 | python | s668182425 | s084026591 | 1,204 | 530 | 193,140 | 42,716 | Accepted | Accepted | 55.98 | n=int(eval(input()))
S=eval(input())
ans=0
sublist=[]
for i in range(100):
used=0
j="0"*(2-len(str(i)))+str(i)
flag1=False
flag2=False
for i in range(n):
if not flag1 and S[i]==j[0]:
flag1=True
continue
if flag1 and not flag2:
if S[i]... | n=int(eval(input()))
S=eval(input())
ans=0
for i in range(1000):
j="0"*(3-len(str(i)))+str(i)
flag1=False
flag2=False
flag3=False
for i in range(n):
if not flag1 and S[i]==j[0]:
flag1=True
continue
if flag1 and not flag2:
if S[i]==j[... | 28 | 24 | 626 | 521 | n = int(eval(input()))
S = eval(input())
ans = 0
sublist = []
for i in range(100):
used = 0
j = "0" * (2 - len(str(i))) + str(i)
flag1 = False
flag2 = False
for i in range(n):
if not flag1 and S[i] == j[0]:
flag1 = True
continue
if flag1 and not flag2:
... | n = int(eval(input()))
S = eval(input())
ans = 0
for i in range(1000):
j = "0" * (3 - len(str(i))) + str(i)
flag1 = False
flag2 = False
flag3 = False
for i in range(n):
if not flag1 and S[i] == j[0]:
flag1 = True
continue
if flag1 and not flag2:
if... | false | 14.285714 | [
"-sublist = []",
"-for i in range(100):",
"- used = 0",
"- j = \"0\" * (2 - len(str(i))) + str(i)",
"+for i in range(1000):",
"+ j = \"0\" * (3 - len(str(i))) + str(i)",
"+ flag3 = False",
"- used = i + 1",
"- if flag2:",
"- sublist.append((j, used))",
"-ansl... | false | 0.089699 | 0.086109 | 1.041693 | [
"s668182425",
"s084026591"
] |
u476604182 | p03148 | python | s242415803 | s231100075 | 801 | 299 | 78,680 | 32,140 | Accepted | Accepted | 62.67 | from heapq import heappush, heappop
N, K = list(map(int, input().split()))
log = [0]*N
pre = []
ls = []
for i in range(N):
t, d = list(map(int, input().split()))
t = t-1
heappush(ls,(-d,t))
v = 0
n = 0
for i in range(K):
d, t = heappop(ls)
d = -d
log[t] += 1
v += d
if log[t]>1:
heap... | from heapq import heappush, heappop
N, K, *L = list(map(int, open(0).read().split()))
ls = []
for t,d in zip(*[iter(L)]*2):
ls += [(d,t)]
used = []
cnt = {}
hq = []
S = set()
ls.sort(reverse=True)
m = 0
for i in range(K):
d,t = ls[i]
cnt[t] = cnt.get(t,0)+1
m += d
if cnt[t]>1:
heappush(use... | 37 | 38 | 574 | 662 | from heapq import heappush, heappop
N, K = list(map(int, input().split()))
log = [0] * N
pre = []
ls = []
for i in range(N):
t, d = list(map(int, input().split()))
t = t - 1
heappush(ls, (-d, t))
v = 0
n = 0
for i in range(K):
d, t = heappop(ls)
d = -d
log[t] += 1
v += d
if log[t] > 1:
... | from heapq import heappush, heappop
N, K, *L = list(map(int, open(0).read().split()))
ls = []
for t, d in zip(*[iter(L)] * 2):
ls += [(d, t)]
used = []
cnt = {}
hq = []
S = set()
ls.sort(reverse=True)
m = 0
for i in range(K):
d, t = ls[i]
cnt[t] = cnt.get(t, 0) + 1
m += d
if cnt[t] > 1:
hea... | false | 2.631579 | [
"-N, K = list(map(int, input().split()))",
"-log = [0] * N",
"-pre = []",
"+N, K, *L = list(map(int, open(0).read().split()))",
"-for i in range(N):",
"- t, d = list(map(int, input().split()))",
"- t = t - 1",
"- heappush(ls, (-d, t))",
"-v = 0",
"-n = 0",
"+for t, d in zip(*[iter(L)] *... | false | 0.11581 | 0.076052 | 1.522769 | [
"s242415803",
"s231100075"
] |
u067983636 | p03634 | python | s767896667 | s006989207 | 1,562 | 1,274 | 67,036 | 65,628 | Accepted | Accepted | 18.44 | import queue
N = int(eval(input()))
E = {n: set() for n in range(N)}
for _ in range(N - 1):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
E[a].add((b, c))
E[b].add((a, c))
def m():
Q, K = list(map(int, input().split()))
K -= 1
dist = [-1] * N
already = se... | import queue
import sys
input = sys.stdin.readline
N = int(eval(input()))
E = {n: set() for n in range(N)}
for _ in range(N - 1):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
E[a].add((b, c))
E[b].add((a, c))
def m():
Q, K = list(map(int, input().split()))
K -= ... | 40 | 39 | 816 | 808 | import queue
N = int(eval(input()))
E = {n: set() for n in range(N)}
for _ in range(N - 1):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
E[a].add((b, c))
E[b].add((a, c))
def m():
Q, K = list(map(int, input().split()))
K -= 1
dist = [-1] * N
already = set()
que = qu... | import queue
import sys
input = sys.stdin.readline
N = int(eval(input()))
E = {n: set() for n in range(N)}
for _ in range(N - 1):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
E[a].add((b, c))
E[b].add((a, c))
def m():
Q, K = list(map(int, input().split()))
K -= 1
dist = [-1... | false | 2.5 | [
"+import sys",
"+input = sys.stdin.readline",
"- res = \"\"",
"- res += str(dist[x] + dist[y]) + \"\\n\"",
"- print(res)",
"+ print((dist[x] + dist[y]))"
] | false | 0.045973 | 0.040636 | 1.131337 | [
"s767896667",
"s006989207"
] |
u571281863 | p02678 | python | s592963622 | s413735513 | 445 | 356 | 56,616 | 56,676 | Accepted | Accepted | 20 | from collections import deque
N,M,*AB=map(int,open(0).read().split())
to=[[] for _ in range(N)]
for a,b in zip(*[iter(AB)]*2):
to[a-1].append(b-1)
to[b-1].append(a-1)
q=deque([0])
r=[None]*N
while q:
x=q.popleft()
for i in to[x]:
if r[i] is None:
q.append(i)
r[i]=x+1
... | # D - .. (Double Dots)
from collections import deque
def main():
N, M, *AB = list(map(int, open(0).read().split()))
graph = [[] for _ in range(N + 1)]
for a, b in zip(*[iter(AB)] * 2):
graph[a].append(b)
graph[b].append(a)
# bfs
queue = deque([1])
signposts = [0... | 20 | 29 | 352 | 635 | from collections import deque
N, M, *AB = map(int, open(0).read().split())
to = [[] for _ in range(N)]
for a, b in zip(*[iter(AB)] * 2):
to[a - 1].append(b - 1)
to[b - 1].append(a - 1)
q = deque([0])
r = [None] * N
while q:
x = q.popleft()
for i in to[x]:
if r[i] is None:
q.append(i... | # D - .. (Double Dots)
from collections import deque
def main():
N, M, *AB = list(map(int, open(0).read().split()))
graph = [[] for _ in range(N + 1)]
for a, b in zip(*[iter(AB)] * 2):
graph[a].append(b)
graph[b].append(a)
# bfs
queue = deque([1])
signposts = [0] * (N + 1)
... | false | 31.034483 | [
"+# D - .. (Double Dots)",
"-N, M, *AB = map(int, open(0).read().split())",
"-to = [[] for _ in range(N)]",
"-for a, b in zip(*[iter(AB)] * 2):",
"- to[a - 1].append(b - 1)",
"- to[b - 1].append(a - 1)",
"-q = deque([0])",
"-r = [None] * N",
"-while q:",
"- x = q.popleft()",
"- for i... | false | 0.039641 | 0.044181 | 0.89723 | [
"s592963622",
"s413735513"
] |
u562935282 | p02623 | python | s960097885 | s703227241 | 195 | 152 | 50,612 | 42,192 | Accepted | Accepted | 22.05 | # 解説
def main():
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
def accumulate(a):
s = 0
yield s
for x in a:
s += x
yield s
A = accumulate(A)
*B, = accumulate(B)
... | def main():
from itertools import chain
N, M, K = list(map(int, input().split()))
*A, = list(map(int, input().split()))
*B, = list(map(int, input().split()))
t = sum(B)
ans = 0
j = M
for i, x in enumerate(chain([0], A)):
t += x
while j > 0 and t > K:
... | 30 | 23 | 514 | 473 | # 解説
def main():
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
def accumulate(a):
s = 0
yield s
for x in a:
s += x
yield s
A = accumulate(A)
(*B,) = accumulate(B)
ans = 0
... | def main():
from itertools import chain
N, M, K = list(map(int, input().split()))
(*A,) = list(map(int, input().split()))
(*B,) = list(map(int, input().split()))
t = sum(B)
ans = 0
j = M
for i, x in enumerate(chain([0], A)):
t += x
while j > 0 and t > K:
j -=... | false | 23.333333 | [
"-# 解説",
"+ from itertools import chain",
"+",
"- A = list(map(int, input().split()))",
"- B = list(map(int, input().split()))",
"-",
"- def accumulate(a):",
"- s = 0",
"- yield s",
"- for x in a:",
"- s += x",
"- yield s",
"-",
"- ... | false | 0.109366 | 0.131888 | 0.829232 | [
"s960097885",
"s703227241"
] |
u969850098 | p02713 | python | s110956816 | s289392519 | 952 | 751 | 69,320 | 9,080 | Accepted | Accepted | 21.11 | import math
from functools import reduce
def gcd(*numbers):
return reduce(math.gcd, numbers)
def main():
K = int(eval(input()))
ans = 0
for i in range(1, K+1):
for j in range(1, K+1):
for k in range(1, K+1):
ans += gcd(i, j, k)
print(ans)
if __na... | from math import gcd
def main():
K = int(eval(input()))
ans = 0
for i in range(1, K+1):
for j in range(1, K+1):
g = gcd(i, j)
for k in range(1, K+1):
ans += gcd(g, k)
print(ans)
if __name__ == "__main__":
main() | 18 | 15 | 345 | 288 | import math
from functools import reduce
def gcd(*numbers):
return reduce(math.gcd, numbers)
def main():
K = int(eval(input()))
ans = 0
for i in range(1, K + 1):
for j in range(1, K + 1):
for k in range(1, K + 1):
ans += gcd(i, j, k)
print(ans)
if __name__ =... | from math import gcd
def main():
K = int(eval(input()))
ans = 0
for i in range(1, K + 1):
for j in range(1, K + 1):
g = gcd(i, j)
for k in range(1, K + 1):
ans += gcd(g, k)
print(ans)
if __name__ == "__main__":
main()
| false | 16.666667 | [
"-import math",
"-from functools import reduce",
"-",
"-",
"-def gcd(*numbers):",
"- return reduce(math.gcd, numbers)",
"+from math import gcd",
"+ g = gcd(i, j)",
"- ans += gcd(i, j, k)",
"+ ans += gcd(g, k)"
] | false | 0.048342 | 0.117301 | 0.412119 | [
"s110956816",
"s289392519"
] |
u883621917 | p02629 | python | s304227579 | s577695953 | 97 | 88 | 68,676 | 68,500 | Accepted | Accepted | 9.28 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
n = int(eval(input()))
import string
from collections import deque
name_table = 'z' + string.ascii_lowercase
ans = deque()
while n > 0:
q = n // 26
m = n % 26
ans.appendleft(name_table[m])
if m == 0:
n = ... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
n = int(eval(input()))
import string
from collections import deque
name_table = string.ascii_lowercase
ans = deque()
while n > 0:
n -= 1
m = n % 26
ans.appendleft(name_table[m])
n //= 26
print((''.join(ans)))
| 23 | 20 | 369 | 311 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
n = int(eval(input()))
import string
from collections import deque
name_table = "z" + string.ascii_lowercase
ans = deque()
while n > 0:
q = n // 26
m = n % 26
ans.appendleft(name_table[m])
if m == 0:
n = q - 1
else:
... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
n = int(eval(input()))
import string
from collections import deque
name_table = string.ascii_lowercase
ans = deque()
while n > 0:
n -= 1
m = n % 26
ans.appendleft(name_table[m])
n //= 26
print(("".join(ans)))
| false | 13.043478 | [
"-name_table = \"z\" + string.ascii_lowercase",
"+name_table = string.ascii_lowercase",
"- q = n // 26",
"+ n -= 1",
"- if m == 0:",
"- n = q - 1",
"- else:",
"- n = q",
"+ n //= 26"
] | false | 0.055028 | 0.054805 | 1.004076 | [
"s304227579",
"s577695953"
] |
u644210195 | p03401 | python | s065623172 | s405008715 | 1,318 | 230 | 13,536 | 13,536 | Accepted | Accepted | 82.55 | from collections import deque
n = int(eval(input()))
a = deque(list(map(int, input().split())))
a.appendleft(0)
a.append(0)
sum = sum([abs(a[i + 1] - a[i]) for i in range(len(a) - 1)])
ans = 0
for i in range(n):
ans = sum
ans = ans - abs(a[i + 1] - a[i]) - abs(a[i + 2] - a[i + 1]) + abs(a[i + 2] ... | from collections import deque
n = int(eval(input()))
a = deque(list(map(int, input().split())))
a.appendleft(0)
a.append(0)
a = list(a)
sum = sum([abs(a[i + 1] - a[i]) for i in range(len(a) - 1)])
ans = 0
for i in range(n):
ans = sum
ans = ans - abs(a[i + 1] - a[i]) - abs(a[i + 2] - a[i + 1]) + ... | 14 | 15 | 331 | 344 | from collections import deque
n = int(eval(input()))
a = deque(list(map(int, input().split())))
a.appendleft(0)
a.append(0)
sum = sum([abs(a[i + 1] - a[i]) for i in range(len(a) - 1)])
ans = 0
for i in range(n):
ans = sum
ans = ans - abs(a[i + 1] - a[i]) - abs(a[i + 2] - a[i + 1]) + abs(a[i + 2] - a[i])
pr... | from collections import deque
n = int(eval(input()))
a = deque(list(map(int, input().split())))
a.appendleft(0)
a.append(0)
a = list(a)
sum = sum([abs(a[i + 1] - a[i]) for i in range(len(a) - 1)])
ans = 0
for i in range(n):
ans = sum
ans = ans - abs(a[i + 1] - a[i]) - abs(a[i + 2] - a[i + 1]) + abs(a[i + 2] - ... | false | 6.666667 | [
"+a = list(a)"
] | false | 0.046498 | 0.045993 | 1.010966 | [
"s065623172",
"s405008715"
] |
u241159583 | p03645 | python | s246609782 | s965630011 | 598 | 449 | 4,596 | 54,608 | Accepted | Accepted | 24.92 | n,m = list(map(int, input().split()))
l = [0] * (n+1)
for _ in range(m):
a,b = list(map(int, input().split()))
if a == 1: l[b] += 1
if b == n: l[a] += 1
print(("POSSIBLE" if 2 in l else "IMPOSSIBLE")) | n,m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
start = []
goal = []
for a,b in ab:
if a == 1: start.append(b)
elif b == n: goal.append(a)
print(("POSSIBLE" if list(set(start) & set(goal)) else "IMPOSSIBLE")) | 8 | 8 | 200 | 262 | n, m = list(map(int, input().split()))
l = [0] * (n + 1)
for _ in range(m):
a, b = list(map(int, input().split()))
if a == 1:
l[b] += 1
if b == n:
l[a] += 1
print(("POSSIBLE" if 2 in l else "IMPOSSIBLE"))
| n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
start = []
goal = []
for a, b in ab:
if a == 1:
start.append(b)
elif b == n:
goal.append(a)
print(("POSSIBLE" if list(set(start) & set(goal)) else "IMPOSSIBLE"))
| false | 0 | [
"-l = [0] * (n + 1)",
"-for _ in range(m):",
"- a, b = list(map(int, input().split()))",
"+ab = [list(map(int, input().split())) for _ in range(m)]",
"+start = []",
"+goal = []",
"+for a, b in ab:",
"- l[b] += 1",
"- if b == n:",
"- l[a] += 1",
"-print((\"POSSIBLE\" if 2 in l... | false | 0.17146 | 0.048745 | 3.517515 | [
"s246609782",
"s965630011"
] |
u788137651 | p02678 | python | s954334190 | s664409750 | 611 | 439 | 104,192 | 95,160 | Accepted | Accepted | 28.15 | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import... | n,m = list(map(int,input().split()))
AB = []
ans = [0] * (n-1)
edge = [[] for _ in range(n+1)] #edge[i] := 頂点iから伸びてる辺の行き先のリスト
for i in range(m):
a,b = list(map(int,input().split()))
edge[a].append(b)
edge[b].append(a)
import collections
que = collections.deque()
que.append(1)
... | 66 | 33 | 1,849 | 619 | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
from math import floor, sqrt, factorial, hypot, log # log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import Counter, defa... | n, m = list(map(int, input().split()))
AB = []
ans = [0] * (n - 1)
edge = [[] for _ in range(n + 1)] # edge[i] := 頂点iから伸びてる辺の行き先のリスト
for i in range(m):
a, b = list(map(int, input().split()))
edge[a].append(b)
edge[b].append(a)
import collections
que = collections.deque()
que.append(1)
while que:
x = q... | false | 50 | [
"-#",
"-# ⋀_⋀",
"-# (・ω・)",
"-# ./ U ∽ U\",
"-# │* 合 *│",
"-# │* 格 *│",
"-# │* 祈 *│",
"-# │* 願 *│",
"-# │* *│",
"-#  ̄",
"-#",
"-import sys",
"+n, m = list(map(int, input().split()))",
"+AB = []",
"+ans = [0] * (n - 1)",
"+edge = [[] for _ in range(n + 1)] # edge[i]... | false | 0.042583 | 0.040357 | 1.055156 | [
"s954334190",
"s664409750"
] |
u474232743 | p02420 | python | s320413070 | s471578937 | 30 | 20 | 7,616 | 7,660 | Accepted | Accepted | 33.33 | while True:
l = eval(input())
if l == '-':
break
deck = list(l)
for i in range(int(eval(input()))):
n = int(eval(input()))
deck = deck[n:] + deck[:n]
print((''.join(deck))) | while True:
deck = eval(input())
if deck == '-':
break
for i in range(int(eval(input()))):
n = int(eval(input()))
deck = deck[n:] + deck[:n]
print(deck) | 9 | 8 | 204 | 181 | while True:
l = eval(input())
if l == "-":
break
deck = list(l)
for i in range(int(eval(input()))):
n = int(eval(input()))
deck = deck[n:] + deck[:n]
print(("".join(deck)))
| while True:
deck = eval(input())
if deck == "-":
break
for i in range(int(eval(input()))):
n = int(eval(input()))
deck = deck[n:] + deck[:n]
print(deck)
| false | 11.111111 | [
"- l = eval(input())",
"- if l == \"-\":",
"+ deck = eval(input())",
"+ if deck == \"-\":",
"- deck = list(l)",
"- print((\"\".join(deck)))",
"+ print(deck)"
] | false | 0.066362 | 0.06443 | 1.029987 | [
"s320413070",
"s471578937"
] |
u534308356 | p02971 | python | s293673720 | s975203526 | 868 | 559 | 70,360 | 14,112 | Accepted | Accepted | 35.6 | N = int(eval(input()))
data = [ int(eval(input())) for _ in range(N) ]
s_data = sorted(data)
for i in range(N):
if s_data[N-1] == data[i]:
print((s_data[N-2]))
else:
print((s_data[N-1]))
| n = int(eval(input()))
data = []
for _ in range(n):
data.append( int(eval(input())) )
data_s = sorted(data)
for d in data:
if d == data_s[-1]:
print((data_s[-2]))
else:
print((data_s[-1]))
# print(data)
# print(data_s)
| 9 | 15 | 204 | 234 | N = int(eval(input()))
data = [int(eval(input())) for _ in range(N)]
s_data = sorted(data)
for i in range(N):
if s_data[N - 1] == data[i]:
print((s_data[N - 2]))
else:
print((s_data[N - 1]))
| n = int(eval(input()))
data = []
for _ in range(n):
data.append(int(eval(input())))
data_s = sorted(data)
for d in data:
if d == data_s[-1]:
print((data_s[-2]))
else:
print((data_s[-1]))
# print(data)
# print(data_s)
| false | 40 | [
"-N = int(eval(input()))",
"-data = [int(eval(input())) for _ in range(N)]",
"-s_data = sorted(data)",
"-for i in range(N):",
"- if s_data[N - 1] == data[i]:",
"- print((s_data[N - 2]))",
"+n = int(eval(input()))",
"+data = []",
"+for _ in range(n):",
"+ data.append(int(eval(input()))... | false | 0.040534 | 0.041673 | 0.972676 | [
"s293673720",
"s975203526"
] |
u729133443 | p02789 | python | s697505899 | s118696865 | 174 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.23 | print(('YNeos'[eval(input().replace(' ','>'))::2])) | a,b=input().split();print(('YNeos'[a!=b::2])) | 1 | 1 | 49 | 43 | print(("YNeos"[eval(input().replace(" ", ">")) :: 2]))
| a, b = input().split()
print(("YNeos"[a != b :: 2]))
| false | 0 | [
"-print((\"YNeos\"[eval(input().replace(\" \", \">\")) :: 2]))",
"+a, b = input().split()",
"+print((\"YNeos\"[a != b :: 2]))"
] | false | 0.046394 | 0.041382 | 1.121137 | [
"s697505899",
"s118696865"
] |
u227082700 | p03472 | python | s368380357 | s761121269 | 687 | 629 | 30,564 | 30,660 | Accepted | Accepted | 8.44 | n,h=list(map(int,input().split()))
a=[]
for i in range(n):
b,c=list(map(int,input().split()))
a+=[[b,0],[c,1]]
a.sort(reverse=1)
i=0
ans=0
while h>0:
if a[i][1]==1:
h-=a[i][0]
ans+=1
else:
ans+=0--h//a[i][0]
h=0
i+=1
print(ans) | n,h=list(map(int,input().split()))
x=[]
for i in range(n):
a,b=list(map(int,input().split()))
x.append([a,0])
x.append([b,1])
x.sort(reverse=1)
i=ans=0
while h>0:
if x[i][1]:
h-=x[i][0]
ans+=1
else:
ans+=0--h//x[i][0]
h=0
i+=1
print(ans) | 17 | 17 | 257 | 269 | n, h = list(map(int, input().split()))
a = []
for i in range(n):
b, c = list(map(int, input().split()))
a += [[b, 0], [c, 1]]
a.sort(reverse=1)
i = 0
ans = 0
while h > 0:
if a[i][1] == 1:
h -= a[i][0]
ans += 1
else:
ans += 0 - -h // a[i][0]
h = 0
i += 1
print(ans)
| n, h = list(map(int, input().split()))
x = []
for i in range(n):
a, b = list(map(int, input().split()))
x.append([a, 0])
x.append([b, 1])
x.sort(reverse=1)
i = ans = 0
while h > 0:
if x[i][1]:
h -= x[i][0]
ans += 1
else:
ans += 0 - -h // x[i][0]
h = 0
i += 1
print... | false | 0 | [
"-a = []",
"+x = []",
"- b, c = list(map(int, input().split()))",
"- a += [[b, 0], [c, 1]]",
"-a.sort(reverse=1)",
"-i = 0",
"-ans = 0",
"+ a, b = list(map(int, input().split()))",
"+ x.append([a, 0])",
"+ x.append([b, 1])",
"+x.sort(reverse=1)",
"+i = ans = 0",
"- if a[i][... | false | 0.051343 | 0.04871 | 1.054057 | [
"s368380357",
"s761121269"
] |
u362347649 | p03160 | python | s264412813 | s345140619 | 127 | 89 | 13,980 | 13,980 | Accepted | Accepted | 29.92 | N = int(eval(input()))
h = list(map(int, input().split()))
dp = [float("inf")] * N
dp[0] = 0
dp[1] = abs(h[0] - h[1])
h_2 = h[0]
h_1 = h[1]
for i in range(2, N):
x = h[i]
dp[i] = min(
dp[i - 1] + abs(x - h_1),
dp[i - 2] + abs(x - h_2)
)
h_2 = h_1
h_1 = x
print((dp[-1... | def solve():
N = int(eval(input()))
h = list(map(int, input().split()))
dp = [float("inf")] * N
dp[0] = 0
dp[1] = abs(h[0] - h[1])
h_2 = h[0]
h_1 = h[1]
for i in range(2, N):
x = h[i]
dp[i] = min(
dp[i - 1] + abs(x - h_1),
dp[i - 2] +... | 17 | 22 | 316 | 445 | N = int(eval(input()))
h = list(map(int, input().split()))
dp = [float("inf")] * N
dp[0] = 0
dp[1] = abs(h[0] - h[1])
h_2 = h[0]
h_1 = h[1]
for i in range(2, N):
x = h[i]
dp[i] = min(dp[i - 1] + abs(x - h_1), dp[i - 2] + abs(x - h_2))
h_2 = h_1
h_1 = x
print((dp[-1]))
| def solve():
N = int(eval(input()))
h = list(map(int, input().split()))
dp = [float("inf")] * N
dp[0] = 0
dp[1] = abs(h[0] - h[1])
h_2 = h[0]
h_1 = h[1]
for i in range(2, N):
x = h[i]
dp[i] = min(dp[i - 1] + abs(x - h_1), dp[i - 2] + abs(x - h_2))
h_2 = h_1
... | false | 22.727273 | [
"-N = int(eval(input()))",
"-h = list(map(int, input().split()))",
"-dp = [float(\"inf\")] * N",
"-dp[0] = 0",
"-dp[1] = abs(h[0] - h[1])",
"-h_2 = h[0]",
"-h_1 = h[1]",
"-for i in range(2, N):",
"- x = h[i]",
"- dp[i] = min(dp[i - 1] + abs(x - h_1), dp[i - 2] + abs(x - h_2))",
"- h_2 =... | false | 0.036387 | 0.042274 | 0.860748 | [
"s264412813",
"s345140619"
] |
u571969099 | p03078 | python | s525269347 | s851023330 | 1,744 | 232 | 3,700 | 46,064 | Accepted | Accepted | 86.7 | x,y,z,k=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
a.sort()
a.reverse()
b.sort()
b.reverse()
c.sort()
c.reverse()
a2=a[:k]
b2=[]
for i in a2:
for j in b[:k]:
b2.append(i+j)
b2.sort()
b2.rever... | xx, yy, zz, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a.sort(reverse=1)
b.sort(reverse=1)
c.sort(reverse=1)
ans = []
for x in range(min(xx, k)):
for y in range(min(yy, k // (x + 1))):
fo... | 30 | 17 | 467 | 475 | x, y, z, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a.sort()
a.reverse()
b.sort()
b.reverse()
c.sort()
c.reverse()
a2 = a[:k]
b2 = []
for i in a2:
for j in b[:k]:
b2.append(i + j)
b2.sort()
b... | xx, yy, zz, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a.sort(reverse=1)
b.sort(reverse=1)
c.sort(reverse=1)
ans = []
for x in range(min(xx, k)):
for y in range(min(yy, k // (x + 1))):
for z in range... | false | 43.333333 | [
"-x, y, z, k = [int(i) for i in input().split()]",
"+xx, yy, zz, k = [int(i) for i in input().split()]",
"-a.sort()",
"-a.reverse()",
"-b.sort()",
"-b.reverse()",
"-c.sort()",
"-c.reverse()",
"-a2 = a[:k]",
"-b2 = []",
"-for i in a2:",
"- for j in b[:k]:",
"- b2.append(i + j)",
"... | false | 0.036663 | 0.035435 | 1.034652 | [
"s525269347",
"s851023330"
] |
u729133443 | p03282 | python | s987201324 | s847410842 | 22 | 18 | 3,316 | 2,940 | Accepted | Accepted | 18.18 | print((input()[:int(eval(input()))].replace('1','')[:1]or'1')) | print((input()[:int(eval(input()))].replace('1','')[:1]or 1)) | 1 | 1 | 54 | 53 | print((input()[: int(eval(input()))].replace("1", "")[:1] or "1"))
| print((input()[: int(eval(input()))].replace("1", "")[:1] or 1))
| false | 0 | [
"-print((input()[: int(eval(input()))].replace(\"1\", \"\")[:1] or \"1\"))",
"+print((input()[: int(eval(input()))].replace(\"1\", \"\")[:1] or 1))"
] | false | 0.042924 | 0.054241 | 0.791351 | [
"s987201324",
"s847410842"
] |
u807028974 | p04043 | python | s963691306 | s607836878 | 179 | 165 | 38,636 | 38,384 | Accepted | Accepted | 7.82 | import math
import queue
import bisect
import heapq
import time
import itertools
mod = int(1e9+7)
def swap(a,b):
return (b,a)
def gcd(a,b): #最大公約数
if (a<b):
a,b = swap(a,b)
if (b==0):
return a
else:
return gcd(b,a%b)
def divisors(a): # 約数列挙
divisors =... | # import math
# import decimal
# import queue
# import bisect
# import heapq
# import time
# import itertools
mod = int(1e9+7)
class Library():
@staticmethod
def Swap(a,b):
return [b,a]
@staticmethod
def myRound(a,dig=0): # 四捨五入
# dig => 桁数
# dig = 1 => 10の位
... | 75 | 111 | 1,412 | 2,605 | import math
import queue
import bisect
import heapq
import time
import itertools
mod = int(1e9 + 7)
def swap(a, b):
return (b, a)
def gcd(a, b): # 最大公約数
if a < b:
a, b = swap(a, b)
if b == 0:
return a
else:
return gcd(b, a % b)
def divisors(a): # 約数列挙
divisors = []
... | # import math
# import decimal
# import queue
# import bisect
# import heapq
# import time
# import itertools
mod = int(1e9 + 7)
class Library:
@staticmethod
def Swap(a, b):
return [b, a]
@staticmethod
def myRound(a, dig=0): # 四捨五入
# dig => 桁数
# dig = 1 => 10の位
# dig ... | false | 32.432432 | [
"-import math",
"-import queue",
"-import bisect",
"-import heapq",
"-import time",
"-import itertools",
"-",
"+# import math",
"+# import decimal",
"+# import queue",
"+# import bisect",
"+# import heapq",
"+# import time",
"+# import itertools",
"-def swap(a, b):",
"- return (b, a... | false | 0.046251 | 0.047367 | 0.976432 | [
"s963691306",
"s607836878"
] |
u086566114 | p02264 | python | s499800665 | s028386341 | 680 | 580 | 33,280 | 26,384 | Accepted | Accepted | 14.71 | import time as ti
class MyQueue(object):
"""
My Queue class
Attributes:
queue: queue
head
tail
"""
def __init__(self):
"""Constructor
"""
self.length = 50010
self.queue = []
counter = 0
while counter < sel... | import time as ti
class MyQueue(object):
"""
My Queue class
Attributes:
queue: queue
head
tail
"""
def __init__(self):
"""Constructor
"""
self.length = 50010
self.queue = [0] * self.length
# counter = 0
# ... | 136 | 136 | 3,124 | 3,127 | import time as ti
class MyQueue(object):
"""
My Queue class
Attributes:
queue: queue
head
tail
"""
def __init__(self):
"""Constructor
"""
self.length = 50010
self.queue = []
counter = 0
while counter < self.length:
s... | import time as ti
class MyQueue(object):
"""
My Queue class
Attributes:
queue: queue
head
tail
"""
def __init__(self):
"""Constructor
"""
self.length = 50010
self.queue = [0] * self.length
# counter = 0
# while counter < self.le... | false | 0 | [
"- self.queue = []",
"- counter = 0",
"- while counter < self.length:",
"- self.queue.append(Process())",
"- counter += 1",
"+ self.queue = [0] * self.length",
"+ # counter = 0",
"+ # while counter < self.length:",
"+ # self.... | false | 0.044722 | 0.044175 | 1.01238 | [
"s499800665",
"s028386341"
] |
u853185302 | p03011 | python | s000693636 | s100186499 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | num = list(map(int,input().split()))
num.sort()
print((num[0]+num[1]))
| p,q,r = list(map(int,input().split()))
print((min(p+q,q+r,r+p))) | 4 | 3 | 73 | 59 | num = list(map(int, input().split()))
num.sort()
print((num[0] + num[1]))
| p, q, r = list(map(int, input().split()))
print((min(p + q, q + r, r + p)))
| false | 25 | [
"-num = list(map(int, input().split()))",
"-num.sort()",
"-print((num[0] + num[1]))",
"+p, q, r = list(map(int, input().split()))",
"+print((min(p + q, q + r, r + p)))"
] | false | 0.045907 | 0.046597 | 0.9852 | [
"s000693636",
"s100186499"
] |
u983853152 | p02631 | python | s852555741 | s106752162 | 158 | 139 | 103,152 | 97,008 | Accepted | Accepted | 12.03 | import copy
def main():
N = int(eval(input()))
A =list(map(int, input().split()))
AD = copy.copy(A)
AAA = []
while len(AD) > 1:
if len(AD)%2==1:
AD.append(0)
for i in range(0,len(AD),2):
AAA.append(AD[i]^AD[i+1])
AD = copy.copy(AAA)
... | def main():
N = int(eval(input()))
A =list(map(int, input().split()))
su = 0
for i in range(N):
su = su ^ A[i]
for i in range(N):
A[i] = su ^ A[i]
print((*A))
if __name__ == '__main__':
main() | 27 | 18 | 460 | 260 | import copy
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
AD = copy.copy(A)
AAA = []
while len(AD) > 1:
if len(AD) % 2 == 1:
AD.append(0)
for i in range(0, len(AD), 2):
AAA.append(AD[i] ^ AD[i + 1])
AD = copy.copy(AAA)
... | def main():
N = int(eval(input()))
A = list(map(int, input().split()))
su = 0
for i in range(N):
su = su ^ A[i]
for i in range(N):
A[i] = su ^ A[i]
print((*A))
if __name__ == "__main__":
main()
| false | 33.333333 | [
"-import copy",
"-",
"-",
"- AD = copy.copy(A)",
"- AAA = []",
"- while len(AD) > 1:",
"- if len(AD) % 2 == 1:",
"- AD.append(0)",
"- for i in range(0, len(AD), 2):",
"- AAA.append(AD[i] ^ AD[i + 1])",
"- AD = copy.copy(AAA)",
"- AAA.c... | false | 0.043684 | 0.049693 | 0.879066 | [
"s852555741",
"s106752162"
] |
u821588465 | p03545 | python | s033072567 | s149413442 | 26 | 24 | 9,160 | 9,036 | Accepted | Accepted | 7.69 | n = [int(x) for x in eval(input())]
op_cnt = len(n) - 1
for i in range(1 << op_cnt):
op = ['-'] * op_cnt
for j in range(op_cnt):
if (i >> j) & 1:
op[op_cnt - 1 - j] = '+'
formula = "{}{}{}{}{}{}{}".format(n[0], op[0], n[1], op[1], n[2], op[2], n[3])
if eval(formula) == 7:
... | s = eval(input())
n = len(s) - 1
for i in range(1 << n):
p_or_m = ['-'] * n
for j in range(n):
if i >> j & 1:
p_or_m[n-j-1] = '+'
formula = ''
for k in range(n):
formula += s[k] + p_or_m[k]
formula += s[3]
if eval(formula) == 7:
print((formu... | 11 | 15 | 357 | 339 | n = [int(x) for x in eval(input())]
op_cnt = len(n) - 1
for i in range(1 << op_cnt):
op = ["-"] * op_cnt
for j in range(op_cnt):
if (i >> j) & 1:
op[op_cnt - 1 - j] = "+"
formula = "{}{}{}{}{}{}{}".format(n[0], op[0], n[1], op[1], n[2], op[2], n[3])
if eval(formula) == 7:
pri... | s = eval(input())
n = len(s) - 1
for i in range(1 << n):
p_or_m = ["-"] * n
for j in range(n):
if i >> j & 1:
p_or_m[n - j - 1] = "+"
formula = ""
for k in range(n):
formula += s[k] + p_or_m[k]
formula += s[3]
if eval(formula) == 7:
print((formula + "=7"))
... | false | 26.666667 | [
"-n = [int(x) for x in eval(input())]",
"-op_cnt = len(n) - 1",
"-for i in range(1 << op_cnt):",
"- op = [\"-\"] * op_cnt",
"- for j in range(op_cnt):",
"- if (i >> j) & 1:",
"- op[op_cnt - 1 - j] = \"+\"",
"- formula = \"{}{}{}{}{}{}{}\".format(n[0], op[0], n[1], op[1], n[2... | false | 0.089194 | 0.036372 | 2.452289 | [
"s033072567",
"s149413442"
] |
u347640436 | p02640 | python | s223850435 | s678602719 | 26 | 24 | 9,160 | 9,156 | Accepted | Accepted | 7.69 | X, Y = list(map(int, input().split()))
for i in range(X + 1):
if i * 2 + (X - i) * 4 == Y:
print('Yes')
exit()
print('No')
| X, Y = list(map(int, input().split()))
for i in range(X + 1):
if i * 2 + (X - i) * 4 == Y:
print('Yes')
break
else:
print('No')
| 7 | 8 | 144 | 154 | X, Y = list(map(int, input().split()))
for i in range(X + 1):
if i * 2 + (X - i) * 4 == Y:
print("Yes")
exit()
print("No")
| X, Y = list(map(int, input().split()))
for i in range(X + 1):
if i * 2 + (X - i) * 4 == Y:
print("Yes")
break
else:
print("No")
| false | 12.5 | [
"- exit()",
"-print(\"No\")",
"+ break",
"+else:",
"+ print(\"No\")"
] | false | 0.047437 | 0.075293 | 0.630035 | [
"s223850435",
"s678602719"
] |
u133936772 | p03061 | python | s041691318 | s850751780 | 164 | 142 | 14,488 | 20,824 | Accepted | Accepted | 13.41 | import sys
input = sys.stdin.readline
n = int(eval(input()))
a = list(map(int, input().split()))
def gcd(x,y):
while y:
x, y = y, x%y
return x
ll, lr = [0]*n, [0]*n
ll[0], lr[n-1] = a[0], a[n-1]
for i in range(1,n):
ll[i] = gcd(ll[i-1], a[i])
lr[n-i-1] = gcd(lr[n-i], a[n-i-1])
print((ma... | n=int(eval(input()))
a=[*list(map(int,input().split()))]
from math import *
l=a.copy()
r=a.copy()
for i in range(n-1):
l[i+1]=gcd(l[i],l[i+1])
r[-i-2]=gcd(r[-i-1],r[-i-2])
a=max(l[-2],r[1])
for i in range(1,n-1):
a=max(a,gcd(l[i-1],r[i+1]))
print(a) | 18 | 12 | 377 | 254 | import sys
input = sys.stdin.readline
n = int(eval(input()))
a = list(map(int, input().split()))
def gcd(x, y):
while y:
x, y = y, x % y
return x
ll, lr = [0] * n, [0] * n
ll[0], lr[n - 1] = a[0], a[n - 1]
for i in range(1, n):
ll[i] = gcd(ll[i - 1], a[i])
lr[n - i - 1] = gcd(lr[n - i], a[n... | n = int(eval(input()))
a = [*list(map(int, input().split()))]
from math import *
l = a.copy()
r = a.copy()
for i in range(n - 1):
l[i + 1] = gcd(l[i], l[i + 1])
r[-i - 2] = gcd(r[-i - 1], r[-i - 2])
a = max(l[-2], r[1])
for i in range(1, n - 1):
a = max(a, gcd(l[i - 1], r[i + 1]))
print(a)
| false | 33.333333 | [
"-import sys",
"+n = int(eval(input()))",
"+a = [*list(map(int, input().split()))]",
"+from math import *",
"-input = sys.stdin.readline",
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-",
"-",
"-def gcd(x, y):",
"- while y:",
"- x, y = y, x % y",
"- return... | false | 0.077391 | 0.079532 | 0.973084 | [
"s041691318",
"s850751780"
] |
u015418072 | p03416 | python | s800504849 | s573594189 | 70 | 47 | 2,940 | 3,060 | Accepted | Accepted | 32.86 | import sys
def input():
return sys.stdin.readline().rstrip()
if __name__ == "__main__":
a, b = list(map(int, input().split()))
count = 0
for i in range(a, b+1):
if str(i)[0] == str(i)[-1] and str(i)[1] == str(i)[-2]:
count += 1
print(count)
| import sys
def input():
return sys.stdin.readline().rstrip()
if __name__ == "__main__":
a, b = list(map(int, input().split()))
count = 0
for i in range(a, b+1):
s = str(i)
if s[0] == s[-1] and s[1] == s[-2]:
count += 1
print(count)
| 14 | 15 | 292 | 292 | import sys
def input():
return sys.stdin.readline().rstrip()
if __name__ == "__main__":
a, b = list(map(int, input().split()))
count = 0
for i in range(a, b + 1):
if str(i)[0] == str(i)[-1] and str(i)[1] == str(i)[-2]:
count += 1
print(count)
| import sys
def input():
return sys.stdin.readline().rstrip()
if __name__ == "__main__":
a, b = list(map(int, input().split()))
count = 0
for i in range(a, b + 1):
s = str(i)
if s[0] == s[-1] and s[1] == s[-2]:
count += 1
print(count)
| false | 6.666667 | [
"- if str(i)[0] == str(i)[-1] and str(i)[1] == str(i)[-2]:",
"+ s = str(i)",
"+ if s[0] == s[-1] and s[1] == s[-2]:"
] | false | 0.047703 | 0.047669 | 1.00071 | [
"s800504849",
"s573594189"
] |
u030726788 | p03775 | python | s233650595 | s719107903 | 76 | 29 | 3,060 | 3,060 | Accepted | Accepted | 61.84 | import math
n=int(eval(input()))
x=1
while(x<=n**0.5):
if(n%x!=0):
x+=1
else:
mins=int(math.log10(n//x))
x+=1
print((mins+1)) | import math
import sys
n=int(eval(input()))
mi=int(math.log10(n))
nb=n
m=1
for i in range(1,int(nb**0.5)+2):
if(n%i==0):
mi=min(mi,max(int(math.log10(n/i)),int(math.log10(i))))
print((mi+1)) | 11 | 10 | 148 | 197 | import math
n = int(eval(input()))
x = 1
while x <= n**0.5:
if n % x != 0:
x += 1
else:
mins = int(math.log10(n // x))
x += 1
print((mins + 1))
| import math
import sys
n = int(eval(input()))
mi = int(math.log10(n))
nb = n
m = 1
for i in range(1, int(nb**0.5) + 2):
if n % i == 0:
mi = min(mi, max(int(math.log10(n / i)), int(math.log10(i))))
print((mi + 1))
| false | 9.090909 | [
"+import sys",
"-x = 1",
"-while x <= n**0.5:",
"- if n % x != 0:",
"- x += 1",
"- else:",
"- mins = int(math.log10(n // x))",
"- x += 1",
"-print((mins + 1))",
"+mi = int(math.log10(n))",
"+nb = n",
"+m = 1",
"+for i in range(1, int(nb**0.5) + 2):",
"+ if n %... | false | 0.055361 | 0.047971 | 1.154059 | [
"s233650595",
"s719107903"
] |
u298224238 | p02262 | python | s529627482 | s252369185 | 19,070 | 17,280 | 125,976 | 125,980 | Accepted | Accepted | 9.39 | cnt = 0
def insertionSort(arr, N, g):
global cnt
for i in range(g, N):
tmp = arr[i]
j = i - g
while(j >= 0 and arr[j] > tmp):
arr[j + g] = arr[j]
j -= g
cnt += 1
arr[j + g] = tmp
def shellSort(arr, N):
G = []
h = 0
... | def insertionSort(arr, N, g):
cnt = 0
for i in range(g, N):
tmp = arr[i]
j = i - g
while(j >= 0 and arr[j] > tmp):
arr[j + g] = arr[j]
j -= g
cnt += 1
arr[j + g] = tmp
return cnt
def shellSort(arr, N):
G = []
h = 0
... | 35 | 33 | 664 | 683 | cnt = 0
def insertionSort(arr, N, g):
global cnt
for i in range(g, N):
tmp = arr[i]
j = i - g
while j >= 0 and arr[j] > tmp:
arr[j + g] = arr[j]
j -= g
cnt += 1
arr[j + g] = tmp
def shellSort(arr, N):
G = []
h = 0
m = 0
whil... | def insertionSort(arr, N, g):
cnt = 0
for i in range(g, N):
tmp = arr[i]
j = i - g
while j >= 0 and arr[j] > tmp:
arr[j + g] = arr[j]
j -= g
cnt += 1
arr[j + g] = tmp
return cnt
def shellSort(arr, N):
G = []
h = 0
m = 0
wh... | false | 5.714286 | [
"-cnt = 0",
"-",
"-",
"- global cnt",
"+ cnt = 0",
"+ return cnt",
"+ G.append(h)",
"- G.append(h)",
"- for g in G:",
"- insertionSort(arr, N, g)",
"- return G",
"+ cnt = sum([insertionSort(arr, N, g) for g in G])",
"+ return (cnt, G)",
"-G = shell... | false | 0.049569 | 0.044164 | 1.122369 | [
"s529627482",
"s252369185"
] |
u968166680 | p02623 | python | s986029623 | s767091537 | 218 | 200 | 150,164 | 149,896 | Accepted | Accepted | 8.26 | import sys
from itertools import accumulate
from bisect import bisect_right
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, M, K, *AB = list(map(int, read().split()))
A = AB[:N]
... | import sys
from itertools import accumulate
from bisect import bisect_right
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, M, K, *AB = list(map(int, read().split()))
A = AB[:N]
... | 41 | 41 | 762 | 741 | import sys
from itertools import accumulate
from bisect import bisect_right
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, M, K, *AB = list(map(int, read().split()))
A = AB[:N]
B = AB[N:]
t... | import sys
from itertools import accumulate
from bisect import bisect_right
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, M, K, *AB = list(map(int, read().split()))
A = AB[:N]
B = AB[N:]
t... | false | 0 | [
"- for i in range(N + 1):",
"- tmp = i",
"- ta = time_A[i]",
"- if ta <= K:",
"- tb = K - ta",
"- j = bisect_right(time_B, tb)",
"- tmp += j - 1",
"- if ans < tmp:",
"- ans = tmp",
"+ j = M",
"+ for i, ta in... | false | 0.048273 | 0.086806 | 0.556099 | [
"s986029623",
"s767091537"
] |
u299869545 | p03326 | python | s022471351 | s335284441 | 33 | 25 | 3,316 | 3,316 | Accepted | Accepted | 24.24 | N,M = list(map(int, input().split()))
cakes = []
for i in range(N):
cakes.append(list(map(int, input().split())))
ans = 0
for i in range(8):
values = []
for cake in cakes:
value = 0
for j in range(3):
if (i >> j) % 2 == 1:
value -= cake[j]
... | N,M = list(map(int, input().split()))
cakes = []
for i in range(N):
cakes.append(list(map(int, input().split())))
ans = 0
values = []
for x,y,z in cakes:
values.append(x+y+z)
values.sort()
values = values[::-1]
ans = max(ans, sum(values[:M]))
values = []
for x,y,z in cakes:
values.append(... | 23 | 72 | 496 | 1,230 | N, M = list(map(int, input().split()))
cakes = []
for i in range(N):
cakes.append(list(map(int, input().split())))
ans = 0
for i in range(8):
values = []
for cake in cakes:
value = 0
for j in range(3):
if (i >> j) % 2 == 1:
value -= cake[j]
else:
... | N, M = list(map(int, input().split()))
cakes = []
for i in range(N):
cakes.append(list(map(int, input().split())))
ans = 0
values = []
for x, y, z in cakes:
values.append(x + y + z)
values.sort()
values = values[::-1]
ans = max(ans, sum(values[:M]))
values = []
for x, y, z in cakes:
values.append(x + y - z)... | false | 68.055556 | [
"-for i in range(8):",
"- values = []",
"- for cake in cakes:",
"- value = 0",
"- for j in range(3):",
"- if (i >> j) % 2 == 1:",
"- value -= cake[j]",
"- else:",
"- value += cake[j]",
"- values.append(value)",
"- ... | false | 0.100267 | 0.083779 | 1.196801 | [
"s022471351",
"s335284441"
] |
u982473248 | p03262 | python | s606384587 | s182030093 | 1,021 | 97 | 14,224 | 16,244 | Accepted | Accepted | 90.5 | c, d = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
b = a.copy()
k = 0
for i in a:
b[k] = abs(i - d)
k += 1
m = min(b)
def dec():
i = m
while i > 0:
if m% i == 0:
k = 0
for j in b:
if j%i ==0:
... | import fractions
N, X = list(map(int, input().split()))
x = list(map(int,input().split()))
D = abs(x[0]-X)
for i in x:
D = fractions.gcd(D,abs(i-X))
print(D) | 33 | 8 | 547 | 164 | c, d = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
b = a.copy()
k = 0
for i in a:
b[k] = abs(i - d)
k += 1
m = min(b)
def dec():
i = m
while i > 0:
if m % i == 0:
k = 0
for j in b:
if j % i == 0:
k += 1
... | import fractions
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
D = abs(x[0] - X)
for i in x:
D = fractions.gcd(D, abs(i - X))
print(D)
| false | 75.757576 | [
"-c, d = (int(i) for i in input().split())",
"-a = [int(i) for i in input().split()]",
"-b = a.copy()",
"-k = 0",
"-for i in a:",
"- b[k] = abs(i - d)",
"- k += 1",
"-m = min(b)",
"+import fractions",
"-",
"-def dec():",
"- i = m",
"- while i > 0:",
"- if m % i == 0:",
... | false | 0.087544 | 0.059199 | 1.478816 | [
"s606384587",
"s182030093"
] |
u148551245 | p03292 | python | s949431983 | s704307520 | 172 | 17 | 38,256 | 3,064 | Accepted | Accepted | 90.12 | a = list(map(int, input().split()))
r = max(a)
a.remove(max(a))
ans = 0
ans += abs(r - max(a)) + abs(a[0] - a[1])
print(ans)
| a, b, c = list(map(int, input().split()))
l = [a ,b, c]
l.sort()
ans = []
p = l.pop()
ans.append(abs(p-l[0]) + abs(l[0]-l[1]))
ans.append(abs(p-l[1]) + abs(l[1]-l[0]))
print((min(ans))) | 6 | 8 | 130 | 184 | a = list(map(int, input().split()))
r = max(a)
a.remove(max(a))
ans = 0
ans += abs(r - max(a)) + abs(a[0] - a[1])
print(ans)
| a, b, c = list(map(int, input().split()))
l = [a, b, c]
l.sort()
ans = []
p = l.pop()
ans.append(abs(p - l[0]) + abs(l[0] - l[1]))
ans.append(abs(p - l[1]) + abs(l[1] - l[0]))
print((min(ans)))
| false | 25 | [
"-a = list(map(int, input().split()))",
"-r = max(a)",
"-a.remove(max(a))",
"-ans = 0",
"-ans += abs(r - max(a)) + abs(a[0] - a[1])",
"-print(ans)",
"+a, b, c = list(map(int, input().split()))",
"+l = [a, b, c]",
"+l.sort()",
"+ans = []",
"+p = l.pop()",
"+ans.append(abs(p - l[0]) + abs(l[0] -... | false | 0.102596 | 0.043808 | 2.341951 | [
"s949431983",
"s704307520"
] |
u426534722 | p02240 | python | s182724590 | s829931191 | 380 | 340 | 10,032 | 10,032 | Accepted | Accepted | 10.53 | import sys
readline = sys.stdin.readline
def MAIN():
n, m = list(map(int, input().split()))
li = [i for i in range(n)]
def f(a):
if li[a] == a:
return a
li[a] = f(li[a])
return li[a]
def f2(a, b):
if li[a] == a:
li[a] = b
r... | import sys
readline = sys.stdin.readline
def MAIN():
n, m = list(map(int, input().split()))
li = [i for i in range(n)]
def f(a):
if li[a] == a:
return a
li[a] = f(li[a])
return li[a]
def f2(a, b):
if li[a] == a:
li[a] = b
else:... | 27 | 30 | 672 | 736 | import sys
readline = sys.stdin.readline
def MAIN():
n, m = list(map(int, input().split()))
li = [i for i in range(n)]
def f(a):
if li[a] == a:
return a
li[a] = f(li[a])
return li[a]
def f2(a, b):
if li[a] == a:
li[a] = b
return
... | import sys
readline = sys.stdin.readline
def MAIN():
n, m = list(map(int, input().split()))
li = [i for i in range(n)]
def f(a):
if li[a] == a:
return a
li[a] = f(li[a])
return li[a]
def f2(a, b):
if li[a] == a:
li[a] = b
else:
... | false | 10 | [
"- return",
"- f2(li[a], b)",
"- li[a] = b",
"+ else:",
"+ f2(li[a], b)",
"+ li[a] = b",
"+",
"+ def solve(a, b):",
"+ if f(a) == f(b):",
"+ return \"yes\"",
"+ return \"no\"",
"- elif f(x) < f(y):",
"+ ... | false | 0.065269 | 0.070663 | 0.923665 | [
"s182724590",
"s829931191"
] |
u970197315 | p03592 | python | s737350485 | s734507497 | 369 | 279 | 2,940 | 9,116 | Accepted | Accepted | 24.39 | # B fLIP
n,m,k=list(map(int,input().split()))
for h in range(n+1):
for w in range(m+1):
black=m*h+n*w-2*h*w
if black==k:
print('Yes')
exit()
print('No') | n,m,k = list(map(int,input().split()))
for i in range(0,n+1):
for j in range(0,m+1):
if n*j+m*i-2*i*j == k:
print("Yes")
exit(0)
print("No")
| 10 | 9 | 200 | 181 | # B fLIP
n, m, k = list(map(int, input().split()))
for h in range(n + 1):
for w in range(m + 1):
black = m * h + n * w - 2 * h * w
if black == k:
print("Yes")
exit()
print("No")
| n, m, k = list(map(int, input().split()))
for i in range(0, n + 1):
for j in range(0, m + 1):
if n * j + m * i - 2 * i * j == k:
print("Yes")
exit(0)
print("No")
| false | 10 | [
"-# B fLIP",
"-for h in range(n + 1):",
"- for w in range(m + 1):",
"- black = m * h + n * w - 2 * h * w",
"- if black == k:",
"+for i in range(0, n + 1):",
"+ for j in range(0, m + 1):",
"+ if n * j + m * i - 2 * i * j == k:",
"- exit()",
"+ exit(0... | false | 0.091611 | 0.046451 | 1.972217 | [
"s737350485",
"s734507497"
] |
u281610856 | p03103 | python | s239398157 | s902594616 | 503 | 261 | 28,556 | 24,544 | Accepted | Accepted | 48.11 | n, m = list(map(int, input().split()))
l = [0 for _ in range(n)]
for i in range(n):
l[i] = list(map(int, input().split()))
l_sort = sorted(l)
ans = 0
drink = 0
for j in range(n):
cnt_lim = l_sort[j][1]
cnt = 0
while cnt < cnt_lim:
ans += l_sort[j][0]
cnt += 1
drink +... | from collections import defaultdict, deque
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
# MOD = 10 ** 9 + 7
# INF = float("inf")
def main():
n, m = list(map(int, input().split()))
dd = defaultdict(int)
for _ in range(n):
a, b = list(map(int, input().split()))
... | 17 | 27 | 385 | 628 | n, m = list(map(int, input().split()))
l = [0 for _ in range(n)]
for i in range(n):
l[i] = list(map(int, input().split()))
l_sort = sorted(l)
ans = 0
drink = 0
for j in range(n):
cnt_lim = l_sort[j][1]
cnt = 0
while cnt < cnt_lim:
ans += l_sort[j][0]
cnt += 1
drink += 1
i... | from collections import defaultdict, deque
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
# MOD = 10 ** 9 + 7
# INF = float("inf")
def main():
n, m = list(map(int, input().split()))
dd = defaultdict(int)
for _ in range(n):
a, b = list(map(int, input().split()))
dd[a] += ... | false | 37.037037 | [
"-n, m = list(map(int, input().split()))",
"-l = [0 for _ in range(n)]",
"-for i in range(n):",
"- l[i] = list(map(int, input().split()))",
"-l_sort = sorted(l)",
"-ans = 0",
"-drink = 0",
"-for j in range(n):",
"- cnt_lim = l_sort[j][1]",
"- cnt = 0",
"- while cnt < cnt_lim:",
"- ... | false | 0.041451 | 0.047258 | 0.877129 | [
"s239398157",
"s902594616"
] |
u185896732 | p03355 | python | s211602667 | s189728267 | 1,757 | 655 | 4,084 | 40,944 | Accepted | Accepted | 62.72 | s=eval(input())
k=int(eval(input()))
cnt=[]
for i in range(len(s)):
for j in range(min(len(s)-i,k)):
t=s[i:i+j+1]
if t not in cnt:
cnt.append(t)
print((sorted(cnt)[k-1])) | s=eval(input())
k=int(eval(input()))
c=[]
for i in range(len(s)):
for j in range(min(len(s)-i,k)):
t=s[i:i+j+1]
if t not in c:
c.append(t)
print((sorted(c)[k-1])) | 9 | 9 | 196 | 188 | s = eval(input())
k = int(eval(input()))
cnt = []
for i in range(len(s)):
for j in range(min(len(s) - i, k)):
t = s[i : i + j + 1]
if t not in cnt:
cnt.append(t)
print((sorted(cnt)[k - 1]))
| s = eval(input())
k = int(eval(input()))
c = []
for i in range(len(s)):
for j in range(min(len(s) - i, k)):
t = s[i : i + j + 1]
if t not in c:
c.append(t)
print((sorted(c)[k - 1]))
| false | 0 | [
"-cnt = []",
"+c = []",
"- if t not in cnt:",
"- cnt.append(t)",
"-print((sorted(cnt)[k - 1]))",
"+ if t not in c:",
"+ c.append(t)",
"+print((sorted(c)[k - 1]))"
] | false | 0.043626 | 0.046208 | 0.944115 | [
"s211602667",
"s189728267"
] |
u994307795 | p02881 | python | s720812517 | s418720598 | 734 | 130 | 2,940 | 2,940 | Accepted | Accepted | 82.29 | n = int(eval(input()))
ans = n-1
cnt = 2
while cnt <= int(n**0.5)+1:
if n%cnt==0:
ans = min(ans, (cnt-1)+(n//cnt-1))
cnt += 1
print(ans) | n = int(eval(input()))
print((min(a+(n//a)-2 for a in range(1, int(n**0.5)+1) if n%a==0))) | 8 | 2 | 153 | 83 | n = int(eval(input()))
ans = n - 1
cnt = 2
while cnt <= int(n**0.5) + 1:
if n % cnt == 0:
ans = min(ans, (cnt - 1) + (n // cnt - 1))
cnt += 1
print(ans)
| n = int(eval(input()))
print((min(a + (n // a) - 2 for a in range(1, int(n**0.5) + 1) if n % a == 0)))
| false | 75 | [
"-ans = n - 1",
"-cnt = 2",
"-while cnt <= int(n**0.5) + 1:",
"- if n % cnt == 0:",
"- ans = min(ans, (cnt - 1) + (n // cnt - 1))",
"- cnt += 1",
"-print(ans)",
"+print((min(a + (n // a) - 2 for a in range(1, int(n**0.5) + 1) if n % a == 0)))"
] | false | 0.05397 | 0.038919 | 1.386705 | [
"s720812517",
"s418720598"
] |
u547167033 | p02732 | python | s715666765 | s474354716 | 434 | 378 | 24,748 | 26,140 | Accepted | Accepted | 12.9 | n=int(eval(input()))
a=list(map(int,input().split()))
cnt=[0]*(n+1)
for i in range(n):
cnt[a[i]]+=1
ans=0
for i in range(n+1):
ans+=cnt[i]*(cnt[i]-1)//2
for i in range(n):
print((ans-cnt[a[i]]*(cnt[a[i]]-1)//2+(cnt[a[i]]-1)*(cnt[a[i]]-2)//2)) | n=int(eval(input()))
a=list(map(int,input().split()))
d=[0]*(2*10**5+1)
ans=0
for i in a:
d[i]+=1
for v in d:
ans+=v*(v-1)//2
for i in range(n):
v=d[a[i]]
print((ans-v*(v-1)//2+(v-1)*(v-2)//2)) | 10 | 11 | 252 | 203 | n = int(eval(input()))
a = list(map(int, input().split()))
cnt = [0] * (n + 1)
for i in range(n):
cnt[a[i]] += 1
ans = 0
for i in range(n + 1):
ans += cnt[i] * (cnt[i] - 1) // 2
for i in range(n):
print(
(
ans
- cnt[a[i]] * (cnt[a[i]] - 1) // 2
+ (cnt[a[i]] - 1) *... | n = int(eval(input()))
a = list(map(int, input().split()))
d = [0] * (2 * 10**5 + 1)
ans = 0
for i in a:
d[i] += 1
for v in d:
ans += v * (v - 1) // 2
for i in range(n):
v = d[a[i]]
print((ans - v * (v - 1) // 2 + (v - 1) * (v - 2) // 2))
| false | 9.090909 | [
"-cnt = [0] * (n + 1)",
"+d = [0] * (2 * 10**5 + 1)",
"+ans = 0",
"+for i in a:",
"+ d[i] += 1",
"+for v in d:",
"+ ans += v * (v - 1) // 2",
"- cnt[a[i]] += 1",
"-ans = 0",
"-for i in range(n + 1):",
"- ans += cnt[i] * (cnt[i] - 1) // 2",
"-for i in range(n):",
"- print(",
... | false | 0.044894 | 0.08582 | 0.523119 | [
"s715666765",
"s474354716"
] |
u698176039 | p02763 | python | s417464421 | s536539661 | 1,606 | 693 | 410,448 | 109,736 | Accepted | Accepted | 56.85 |
# 点更新,区間クエリ
class SegTree:
# n : 元の配列の長さ
# init_list: 元の配列
# segfunc : 載せる関数(演算)
# ide_ele : segfuncの単位元
def __init__(self, n, init_list ,segfunc, ide_ele):
# num : 2**num >= n となる最小の整数 (葉の数)
# seg : segtreeのリスト
self.num = 2**((n-1).bit_length())
... |
# 点更新,区間クエリ
class SegTree:
# n : 元の配列の長さ
# init_list: 元の配列
# segfunc : 載せる関数(演算)
# ide_ele : segfuncの単位元
def __init__(self, n, init_list ,segfunc, ide_ele):
# num : 2**num >= n となる最小の整数 (葉の数)
# seg : segtreeのリスト
self.num = 2**((n-1).bit_length())
... | 111 | 102 | 2,616 | 2,356 | # 点更新,区間クエリ
class SegTree:
# n : 元の配列の長さ
# init_list: 元の配列
# segfunc : 載せる関数(演算)
# ide_ele : segfuncの単位元
def __init__(self, n, init_list, segfunc, ide_ele):
# num : 2**num >= n となる最小の整数 (葉の数)
# seg : segtreeのリスト
self.num = 2 ** ((n - 1).bit_length())
self.seg = [ide_... | # 点更新,区間クエリ
class SegTree:
# n : 元の配列の長さ
# init_list: 元の配列
# segfunc : 載せる関数(演算)
# ide_ele : segfuncの単位元
def __init__(self, n, init_list, segfunc, ide_ele):
# num : 2**num >= n となる最小の整数 (葉の数)
# seg : segtreeのリスト
self.num = 2 ** ((n - 1).bit_length())
self.seg = [ide_... | false | 8.108108 | [
"- return max(x, y)",
"+ return x | y",
"-alphalist = [[0] * N for _ in range(26)]",
"+A = [0] * N",
"-for i, s in enumerate(S):",
"- alphalist[ord(s) - atmp][i] = 1",
"-seglist = [None] * 26",
"-for i in range(26):",
"- seglist[i] = SegTree(N, alphalist[i], segfunc, 0)",
"+for i in ra... | false | 0.038669 | 0.065987 | 0.586004 | [
"s417464421",
"s536539661"
] |
u941438707 | p03037 | python | s398722813 | s714107802 | 321 | 76 | 3,060 | 31,720 | Accepted | Accepted | 76.32 | n,m=list(map(int,input().split()))
l,r=1,n
for i in range(m):
a,b=list(map(int,input().split()))
l=max(l,a)
r=min(r,b)
print((r-l+1 if r>=l else 0)) | n,m,*a=list(map(int,open(0).read().split()))
b=min(a[1::2])-max(a[::2])+1
print((b if b>0 else 0)) | 7 | 3 | 152 | 92 | n, m = list(map(int, input().split()))
l, r = 1, n
for i in range(m):
a, b = list(map(int, input().split()))
l = max(l, a)
r = min(r, b)
print((r - l + 1 if r >= l else 0))
| n, m, *a = list(map(int, open(0).read().split()))
b = min(a[1::2]) - max(a[::2]) + 1
print((b if b > 0 else 0))
| false | 57.142857 | [
"-n, m = list(map(int, input().split()))",
"-l, r = 1, n",
"-for i in range(m):",
"- a, b = list(map(int, input().split()))",
"- l = max(l, a)",
"- r = min(r, b)",
"-print((r - l + 1 if r >= l else 0))",
"+n, m, *a = list(map(int, open(0).read().split()))",
"+b = min(a[1::2]) - max(a[::2]) ... | false | 0.038677 | 0.045524 | 0.849593 | [
"s398722813",
"s714107802"
] |
u497596438 | p03253 | python | s436536201 | s405298745 | 1,995 | 805 | 114,396 | 40,044 | Accepted | Accepted | 59.65 | from math import factorial
from math import sqrt
def nCr(n,r):
return factorial(n)//(factorial(r)*factorial(n-r))
"""
def factorize(p):
b=[]
for i in range(2,int(sqrt(p)+2)):
a=0
while((p%i)==0):
a+=1
p=p//i
if a!=0:
b.ap... | from math import factorial
from math import sqrt
def nCr(n,r):
a=1
x=n
while(x!=n-r):
a*=x
x-=1
b=1
x=r
while(x!=0):
b*=x
x-=1
return a//b
INF=10**9+7
N,m=list(map(int,input().split()))
sum=1
yd = {}
i = 2
while m != 1:
while m % i == 0:
... | 41 | 34 | 667 | 470 | from math import factorial
from math import sqrt
def nCr(n, r):
return factorial(n) // (factorial(r) * factorial(n - r))
"""
def factorize(p):
b=[]
for i in range(2,int(sqrt(p)+2)):
a=0
while((p%i)==0):
a+=1
p=p//i
if a!=0:
b.append(a)
... | from math import factorial
from math import sqrt
def nCr(n, r):
a = 1
x = n
while x != n - r:
a *= x
x -= 1
b = 1
x = r
while x != 0:
b *= x
x -= 1
return a // b
INF = 10**9 + 7
N, m = list(map(int, input().split()))
sum = 1
yd = {}
i = 2
while m != 1:
... | false | 17.073171 | [
"- return factorial(n) // (factorial(r) * factorial(n - r))",
"+ a = 1",
"+ x = n",
"+ while x != n - r:",
"+ a *= x",
"+ x -= 1",
"+ b = 1",
"+ x = r",
"+ while x != 0:",
"+ b *= x",
"+ x -= 1",
"+ return a // b",
"-\"\"\"",
"-def factor... | false | 0.619785 | 0.039866 | 15.546855 | [
"s436536201",
"s405298745"
] |
u150984829 | p02234 | python | s859972561 | s822726527 | 130 | 90 | 5,716 | 5,716 | Accepted | Accepted | 30.77 | def s():
n=int(eval(input()))+1
e=[input().split()for _ in[0]*~-n]
p=[int(e[0][0])]+list(int(x[1])for x in e)
m=[[0]*n for _ in[0]*n]
for i in range(n):
for r in range(n-i-1):
c=r+i+1
for j in range(r+1,c):
x=m[r][j]+m[j][c]+p[r]*p[j]*p[c]
if not 0<m[r][c]<=x:m[r][c]=x
print((m[r][c]))... | def s():
n=int(eval(input()))+1
e=[input().split()for _ in[0]*~-n]
p=[int(e[0][0])]+list(int(x[1])for x in e)
m=[[0]*n for _ in[0]*n]
for i in range(n):
for r in range(n-i-1):
c=r+i+1
for j in range(r+1,c):
x=m[r][j]+m[j][c]+p[r]*p[j]*p[c]
if not 0<m[r][c]<x:m[r][c]=x
print((m[r][c]))
... | 13 | 13 | 341 | 340 | def s():
n = int(eval(input())) + 1
e = [input().split() for _ in [0] * ~-n]
p = [int(e[0][0])] + list(int(x[1]) for x in e)
m = [[0] * n for _ in [0] * n]
for i in range(n):
for r in range(n - i - 1):
c = r + i + 1
for j in range(r + 1, c):
x = m[r][j... | def s():
n = int(eval(input())) + 1
e = [input().split() for _ in [0] * ~-n]
p = [int(e[0][0])] + list(int(x[1]) for x in e)
m = [[0] * n for _ in [0] * n]
for i in range(n):
for r in range(n - i - 1):
c = r + i + 1
for j in range(r + 1, c):
x = m[r][j... | false | 0 | [
"- if not 0 < m[r][c] <= x:",
"+ if not 0 < m[r][c] < x:"
] | false | 0.078385 | 0.110726 | 0.707918 | [
"s859972561",
"s822726527"
] |
u883040023 | p02773 | python | s237262969 | s973089012 | 790 | 709 | 45,040 | 45,064 | Accepted | Accepted | 10.25 | import collections
n = int(eval(input()))
s = []
for i in range(n):
s.append(eval(input()))
dic = collections.Counter(s)
dic = dic.most_common()
ans = [dic[0][0]]
for i in range(len(dic)-1):
if dic[i][1] == dic[i+1][1]:
ans.append(dic[i+1][0])
else:
break
ans... | n = int(eval(input()))
S = [eval(input()) for i in range(n)]
import collections
c = collections.Counter(S)
c = c.most_common()
ans = [c[0][0]]
for i in range(len(c)-1):
if c[i][1] == c[i+1][1]:
ans.append(c[i+1][0])
else:
break
ans = sorted(ans)
print(("\n".... | 21 | 18 | 370 | 317 | import collections
n = int(eval(input()))
s = []
for i in range(n):
s.append(eval(input()))
dic = collections.Counter(s)
dic = dic.most_common()
ans = [dic[0][0]]
for i in range(len(dic) - 1):
if dic[i][1] == dic[i + 1][1]:
ans.append(dic[i + 1][0])
else:
break
ans = sorted(ans)
for i in ra... | n = int(eval(input()))
S = [eval(input()) for i in range(n)]
import collections
c = collections.Counter(S)
c = c.most_common()
ans = [c[0][0]]
for i in range(len(c) - 1):
if c[i][1] == c[i + 1][1]:
ans.append(c[i + 1][0])
else:
break
ans = sorted(ans)
print(("\n".join(ans)))
| false | 14.285714 | [
"+n = int(eval(input()))",
"+S = [eval(input()) for i in range(n)]",
"-n = int(eval(input()))",
"-s = []",
"-for i in range(n):",
"- s.append(eval(input()))",
"-dic = collections.Counter(s)",
"-dic = dic.most_common()",
"-ans = [dic[0][0]]",
"-for i in range(len(dic) - 1):",
"- if dic[i][1... | false | 0.050017 | 0.046201 | 1.082597 | [
"s237262969",
"s973089012"
] |
u761989513 | p03463 | python | s259221137 | s690842795 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | n, a, b = list(map(int, input().split()))
if (b - a) % 2 == 0:
print("Alice")
else:
print("Borys") | n, a, b = list(map(int, input().split()))
if (b - a + 1) % 2:
print("Alice")
else:
print("Borys") | 5 | 5 | 104 | 103 | n, a, b = list(map(int, input().split()))
if (b - a) % 2 == 0:
print("Alice")
else:
print("Borys")
| n, a, b = list(map(int, input().split()))
if (b - a + 1) % 2:
print("Alice")
else:
print("Borys")
| false | 0 | [
"-if (b - a) % 2 == 0:",
"+if (b - a + 1) % 2:"
] | false | 0.039389 | 0.040338 | 0.976477 | [
"s259221137",
"s690842795"
] |
u968166680 | p03575 | python | s398520990 | s889299240 | 195 | 21 | 40,944 | 3,064 | Accepted | Accepted | 89.23 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
class UnionFind:
# Reference: https://note.nkmk.me/python-union-find/
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def f... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
class UnionFind:
# Reference: https://note.nkmk.me/python-union-find/
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def f... | 72 | 72 | 1,684 | 1,637 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
class UnionFind:
# Reference: https://note.nkmk.me/python-union-find/
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
class UnionFind:
# Reference: https://note.nkmk.me/python-union-find/
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
... | false | 0 | [
"- def all_group_members(self):",
"- return {r: self.members(r) for r in self.roots()}",
"- def __str__(self):",
"- return \"\\n\".join(\"{}: {}\".format(r, self.members(r)) for r in self.roots())",
"+def main():",
"+ N, M = list(map(int, readline().split()))",
"+ AB = [[int(s)... | false | 0.048355 | 0.044979 | 1.075062 | [
"s398520990",
"s889299240"
] |
u667135132 | p02947 | python | s670823283 | s915914082 | 1,758 | 603 | 72,648 | 68,312 | Accepted | Accepted | 65.7 | from collections import Counter
N = int(eval(input()))
A = [0]*N
for i in range(N):
#各文字列に番号A[i]を与える
string = eval(input())
flag = True
for j in range(10):
A[i]+=10**(ord(string[j])-ord('a'))
if(j<9):
if(string[j]!=string[j+1]):
flag = False
... | from collections import Counter
N = int(eval(input()))
A = []
for i in range(N):
s = "".join(sorted(eval(input())))
A.append(s)
C = Counter(A)
ans=0
for i in list(C.values()):
if i==1:
continue
ans+=i*(i-1)//2
print(ans)
| 26 | 18 | 487 | 249 | from collections import Counter
N = int(eval(input()))
A = [0] * N
for i in range(N):
# 各文字列に番号A[i]を与える
string = eval(input())
flag = True
for j in range(10):
A[i] += 10 ** (ord(string[j]) - ord("a"))
if j < 9:
if string[j] != string[j + 1]:
flag = False
... | from collections import Counter
N = int(eval(input()))
A = []
for i in range(N):
s = "".join(sorted(eval(input())))
A.append(s)
C = Counter(A)
ans = 0
for i in list(C.values()):
if i == 1:
continue
ans += i * (i - 1) // 2
print(ans)
| false | 30.769231 | [
"-A = [0] * N",
"+A = []",
"- # 各文字列に番号A[i]を与える",
"- string = eval(input())",
"- flag = True",
"- for j in range(10):",
"- A[i] += 10 ** (ord(string[j]) - ord(\"a\"))",
"- if j < 9:",
"- if string[j] != string[j + 1]:",
"- flag = False",
"- ... | false | 0.042919 | 0.106476 | 0.403085 | [
"s670823283",
"s915914082"
] |
u227082700 | p03578 | python | s319962995 | s575594187 | 324 | 268 | 67,680 | 56,960 | Accepted | Accepted | 17.28 | from collections import Counter
n,d,m,t,ans=int(eval(input())),Counter(list(map(int,input().split()))),int(eval(input())),Counter(list(map(int,input().split()))),"YES"
for i in list(t.keys()):
if i in list(d.keys()):
if d[i]<t[i]:ans="NO"
else:ans="NO"
print(ans) | n=int(eval(input()))
a=list(map(int,input().split()))
from collections import Counter
d=Counter(a)
m=int(eval(input()))
b=list(map(int,input().split()))
dd=Counter(b)
for i in dd:
if i not in d:
print("NO")
exit()
if d[i]<dd[i]:
print("NO")
exit()
print("YES") | 7 | 15 | 241 | 282 | from collections import Counter
n, d, m, t, ans = (
int(eval(input())),
Counter(list(map(int, input().split()))),
int(eval(input())),
Counter(list(map(int, input().split()))),
"YES",
)
for i in list(t.keys()):
if i in list(d.keys()):
if d[i] < t[i]:
ans = "NO"
else:
... | n = int(eval(input()))
a = list(map(int, input().split()))
from collections import Counter
d = Counter(a)
m = int(eval(input()))
b = list(map(int, input().split()))
dd = Counter(b)
for i in dd:
if i not in d:
print("NO")
exit()
if d[i] < dd[i]:
print("NO")
exit()
print("YES")
| false | 53.333333 | [
"+n = int(eval(input()))",
"+a = list(map(int, input().split()))",
"-n, d, m, t, ans = (",
"- int(eval(input())),",
"- Counter(list(map(int, input().split()))),",
"- int(eval(input())),",
"- Counter(list(map(int, input().split()))),",
"- \"YES\",",
"-)",
"-for i in list(t.keys()):",... | false | 0.040146 | 0.106086 | 0.378428 | [
"s319962995",
"s575594187"
] |
u803848678 | p03629 | python | s804589898 | s429907232 | 493 | 272 | 130,888 | 63,568 | Accepted | Accepted | 44.83 | a = list([ord(x)-ord("a") for x in list(eval(input()))])
n = len(a)
m = 26
b = [1]*(n+1)
prev = [n]*m
G = [[] for i in range(n+1)]
for i in reversed(list(range(n))):
ai = a[i]
tmp = min(b[j] for j in prev)
for j in prev:
G[i].append(j)
b[i] = tmp+1
prev[ai] = i
cnt = min(b[j... | a = list([ord(x)-ord("a") for x in list(eval(input()))])
n = len(a)
m = 26
b = [0]*n
pos = [[] for i in range(m)]
s = set()
cnt = 0
for i in reversed(list(range(n))):
b[i] = cnt
if a[i] not in s:
s.add(a[i])
pos[a[i]].append(i)
if len(s) == m:
cnt += 1
s = set()
... | 25 | 40 | 544 | 764 | a = list([ord(x) - ord("a") for x in list(eval(input()))])
n = len(a)
m = 26
b = [1] * (n + 1)
prev = [n] * m
G = [[] for i in range(n + 1)]
for i in reversed(list(range(n))):
ai = a[i]
tmp = min(b[j] for j in prev)
for j in prev:
G[i].append(j)
b[i] = tmp + 1
prev[ai] = i
cnt = min(b[j] for... | a = list([ord(x) - ord("a") for x in list(eval(input()))])
n = len(a)
m = 26
b = [0] * n
pos = [[] for i in range(m)]
s = set()
cnt = 0
for i in reversed(list(range(n))):
b[i] = cnt
if a[i] not in s:
s.add(a[i])
pos[a[i]].append(i)
if len(s) == m:
cnt += 1
s = set()
for i in rang... | false | 37.5 | [
"-b = [1] * (n + 1)",
"-prev = [n] * m",
"-G = [[] for i in range(n + 1)]",
"+b = [0] * n",
"+pos = [[] for i in range(m)]",
"+s = set()",
"+cnt = 0",
"- ai = a[i]",
"- tmp = min(b[j] for j in prev)",
"- for j in prev:",
"- G[i].append(j)",
"- b[i] = tmp + 1",
"- prev[a... | false | 0.036617 | 0.037381 | 0.979571 | [
"s804589898",
"s429907232"
] |
u936051377 | p02259 | python | s138251948 | s386184385 | 30 | 20 | 7,692 | 7,744 | Accepted | Accepted | 33.33 | N = int(input().rstrip())
A = list(map(int, input().rstrip().split()))
flag = True
c = 0
while flag:
flag = False
for j in reversed(list(range(1, N))):
if A[j - 1] > A[j]:
A[j - 1], A[j] = A[j], A[j - 1]
c += 1
flag = True
print((' '.join(map(st... | def bubble_sort(A, N):
sw = 0
flag = True
while flag:
flag = False
for j in reversed(list(range(1, N))):
if A[j - 1] > A[j]:
A[j - 1], A[j] = A[j], A[j - 1]
sw += 1
flag = True
return sw
def main():
N = int(... | 15 | 23 | 330 | 537 | N = int(input().rstrip())
A = list(map(int, input().rstrip().split()))
flag = True
c = 0
while flag:
flag = False
for j in reversed(list(range(1, N))):
if A[j - 1] > A[j]:
A[j - 1], A[j] = A[j], A[j - 1]
c += 1
flag = True
print((" ".join(map(str, A))))
print(c)
| def bubble_sort(A, N):
sw = 0
flag = True
while flag:
flag = False
for j in reversed(list(range(1, N))):
if A[j - 1] > A[j]:
A[j - 1], A[j] = A[j], A[j - 1]
sw += 1
flag = True
return sw
def main():
N = int(input().rstrip(... | false | 34.782609 | [
"-N = int(input().rstrip())",
"-A = list(map(int, input().rstrip().split()))",
"-flag = True",
"-c = 0",
"-while flag:",
"- flag = False",
"- for j in reversed(list(range(1, N))):",
"- if A[j - 1] > A[j]:",
"- A[j - 1], A[j] = A[j], A[j - 1]",
"- c += 1",
"- ... | false | 0.050034 | 0.051007 | 0.980925 | [
"s138251948",
"s386184385"
] |
u512212329 | p02660 | python | s013435808 | s742169626 | 143 | 103 | 9,456 | 9,684 | Accepted | Accepted | 27.97 | from itertools import accumulate
from collections import defaultdict
def main():
n = int(eval(input()))
prime_counter = defaultdict(int) # key ^ value
acc = tuple(accumulate(list(range(1, 42)))) # because 10^12 < 2^39
def facs():
yield 2
for x in range(10 ** 5 * 5):
... | from itertools import accumulate
from collections import defaultdict
def main():
n = int(eval(input()))
prime_counter = defaultdict(int) # key ^ value
acc = tuple(accumulate(list(range(1, 42)))) # because 10^12 < 2^39
def facs(n):
yield 2
max_x = int((n ** 0.5 - 3) / 2 + ... | 36 | 36 | 859 | 869 | from itertools import accumulate
from collections import defaultdict
def main():
n = int(eval(input()))
prime_counter = defaultdict(int) # key ^ value
acc = tuple(accumulate(list(range(1, 42)))) # because 10^12 < 2^39
def facs():
yield 2
for x in range(10**5 * 5):
yield ... | from itertools import accumulate
from collections import defaultdict
def main():
n = int(eval(input()))
prime_counter = defaultdict(int) # key ^ value
acc = tuple(accumulate(list(range(1, 42)))) # because 10^12 < 2^39
def facs(n):
yield 2
max_x = int((n**0.5 - 3) / 2 + 1)
fo... | false | 0 | [
"- def facs():",
"+ def facs(n):",
"- for x in range(10**5 * 5):",
"+ max_x = int((n**0.5 - 3) / 2 + 1)",
"+ for x in range(max_x):",
"- for fac in facs():",
"- count = 0",
"+ for fac in facs(n):",
"- count += 1",
"- # ここで if braek を入れる... | false | 0.38145 | 0.055334 | 6.893622 | [
"s013435808",
"s742169626"
] |
u466917094 | p02713 | python | s969204598 | s474573111 | 920 | 556 | 189,376 | 68,664 | Accepted | Accepted | 39.57 | from math import gcd
from functools import reduce
k=int(eval(input()))
z=list(range(1,k+1))
print((sum([gcd(i,gcd(j,k)) for i in z for j in z for k in z])))
| from math import gcd
from functools import reduce
k=int(eval(input()))
z=list(range(1,k+1))
print((sum(gcd(i,gcd(j,k)) for i in z for j in z for k in z)))
| 6 | 6 | 150 | 148 | from math import gcd
from functools import reduce
k = int(eval(input()))
z = list(range(1, k + 1))
print((sum([gcd(i, gcd(j, k)) for i in z for j in z for k in z])))
| from math import gcd
from functools import reduce
k = int(eval(input()))
z = list(range(1, k + 1))
print((sum(gcd(i, gcd(j, k)) for i in z for j in z for k in z)))
| false | 0 | [
"-print((sum([gcd(i, gcd(j, k)) for i in z for j in z for k in z])))",
"+print((sum(gcd(i, gcd(j, k)) for i in z for j in z for k in z)))"
] | false | 0.209472 | 0.090275 | 2.320372 | [
"s969204598",
"s474573111"
] |
u332385682 | p03719 | python | s768670189 | s407081395 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | import sys
from collections import Counter
sys.setrecursionlimit(10**7)
inf = 1<<100
def solve():
a, b, c = list(map(int, input().split()))
print(('Yes' if a <= c <= b else 'No'))
if __name__ == '__main__':
solve() | import sys
def solve():
a, b, c = list(map(int, input().split()))
print(('Yes' if a <= c <= b else 'No'))
if __name__ == '__main__':
solve() | 14 | 9 | 238 | 160 | import sys
from collections import Counter
sys.setrecursionlimit(10**7)
inf = 1 << 100
def solve():
a, b, c = list(map(int, input().split()))
print(("Yes" if a <= c <= b else "No"))
if __name__ == "__main__":
solve()
| import sys
def solve():
a, b, c = list(map(int, input().split()))
print(("Yes" if a <= c <= b else "No"))
if __name__ == "__main__":
solve()
| false | 35.714286 | [
"-from collections import Counter",
"-",
"-sys.setrecursionlimit(10**7)",
"-inf = 1 << 100"
] | false | 0.161126 | 0.089518 | 1.799932 | [
"s768670189",
"s407081395"
] |
u952708174 | p02787 | python | s266176948 | s916883213 | 1,105 | 400 | 286,344 | 46,556 | Accepted | Accepted | 63.8 | def e_crested_ibis_vs_monster():
H, N = [int(i) for i in input().split()]
Damage, Cost = [], []
for _ in range(N):
a, b = [int(i) for i in input().split()]
Damage.append(a)
Cost.append(b)
# dp[i][j]: 最初の i 種類の魔法でモンスターに j ダメージ与える場合の消費魔力の最小値
dp = [[float('inf')] * (H ... | def e_crested_ibis_vs_monster():
H, N = [int(i) for i in input().split()]
Monsters = [[int(i) for i in input().split()] for j in range(N)]
# dp[i][j]: 最初の i 種類の魔法でモンスターに j ダメージ与える場合の消費魔力の最小値
# としたとき、更新順序を工夫することで添字 i をなくせる
dp = [0] + [float('inf')] * H
for a, b in Monsters:
for j... | 21 | 14 | 756 | 470 | def e_crested_ibis_vs_monster():
H, N = [int(i) for i in input().split()]
Damage, Cost = [], []
for _ in range(N):
a, b = [int(i) for i in input().split()]
Damage.append(a)
Cost.append(b)
# dp[i][j]: 最初の i 種類の魔法でモンスターに j ダメージ与える場合の消費魔力の最小値
dp = [[float("inf")] * (H + 1) for _... | def e_crested_ibis_vs_monster():
H, N = [int(i) for i in input().split()]
Monsters = [[int(i) for i in input().split()] for j in range(N)]
# dp[i][j]: 最初の i 種類の魔法でモンスターに j ダメージ与える場合の消費魔力の最小値
# としたとき、更新順序を工夫することで添字 i をなくせる
dp = [0] + [float("inf")] * H
for a, b in Monsters:
for j in range... | false | 33.333333 | [
"- Damage, Cost = [], []",
"- for _ in range(N):",
"- a, b = [int(i) for i in input().split()]",
"- Damage.append(a)",
"- Cost.append(b)",
"+ Monsters = [[int(i) for i in input().split()] for j in range(N)]",
"- dp = [[float(\"inf\")] * (H + 1) for _ in range(N + 1)]",
... | false | 0.14275 | 0.06659 | 2.14372 | [
"s266176948",
"s916883213"
] |
u909514237 | p02584 | python | s711306287 | s742061363 | 118 | 64 | 61,576 | 61,856 | Accepted | Accepted | 45.76 | X,K,D = list(map(int, input().split()))
ans = 0
if K < abs(X)//D:
ans = abs(X) - D*K
else:
if ((K-X//D)%2 == 0):
ans = abs(X%D)
else:
ans = abs(abs(X%D) - D)
print(ans) | X,K,D = list(map(int, input().split()))
X = abs(X)
ans = 0
if K*D < X:
ans = X - K*D
else:
if (K - X // D) % 2 == 0:
ans = X % D
else:
ans = abs(X % D - D)
print(ans) | 10 | 12 | 185 | 186 | X, K, D = list(map(int, input().split()))
ans = 0
if K < abs(X) // D:
ans = abs(X) - D * K
else:
if (K - X // D) % 2 == 0:
ans = abs(X % D)
else:
ans = abs(abs(X % D) - D)
print(ans)
| X, K, D = list(map(int, input().split()))
X = abs(X)
ans = 0
if K * D < X:
ans = X - K * D
else:
if (K - X // D) % 2 == 0:
ans = X % D
else:
ans = abs(X % D - D)
print(ans)
| false | 16.666667 | [
"+X = abs(X)",
"-if K < abs(X) // D:",
"- ans = abs(X) - D * K",
"+if K * D < X:",
"+ ans = X - K * D",
"- ans = abs(X % D)",
"+ ans = X % D",
"- ans = abs(abs(X % D) - D)",
"+ ans = abs(X % D - D)"
] | false | 0.037253 | 0.099562 | 0.374173 | [
"s711306287",
"s742061363"
] |
u997641430 | p02781 | python | s494756573 | s807474133 | 505 | 430 | 3,060 | 3,060 | Accepted | Accepted | 14.85 | def f(N, K):
M, R = N // 10, N % 10
if K == 0:
return 1
elif M == 0 and K == 1:
return R
elif M == 0 and K != 1:
return 0
else:
return R * f(M, K-1) + (9-R) * f(M-1, K-1) + f(M, K)
N = int(eval(input()))
K = int(eval(input()))
print((f(N, K)))
| def DP(n, k):
if k == 0:
return 1
elif n < 10 and k == 1:
return n
elif n < 10 and k != 0:
return 0
else:
q, r = n//10, n % 10
return DP(q, k)+r*DP(q, k-1)+(9-r)*DP(q-1, k-1)
n = int(eval(input()))
k = int(eval(input()))
print((DP(n, k)))
| 15 | 15 | 298 | 297 | def f(N, K):
M, R = N // 10, N % 10
if K == 0:
return 1
elif M == 0 and K == 1:
return R
elif M == 0 and K != 1:
return 0
else:
return R * f(M, K - 1) + (9 - R) * f(M - 1, K - 1) + f(M, K)
N = int(eval(input()))
K = int(eval(input()))
print((f(N, K)))
| def DP(n, k):
if k == 0:
return 1
elif n < 10 and k == 1:
return n
elif n < 10 and k != 0:
return 0
else:
q, r = n // 10, n % 10
return DP(q, k) + r * DP(q, k - 1) + (9 - r) * DP(q - 1, k - 1)
n = int(eval(input()))
k = int(eval(input()))
print((DP(n, k)))
| false | 0 | [
"-def f(N, K):",
"- M, R = N // 10, N % 10",
"- if K == 0:",
"+def DP(n, k):",
"+ if k == 0:",
"- elif M == 0 and K == 1:",
"- return R",
"- elif M == 0 and K != 1:",
"+ elif n < 10 and k == 1:",
"+ return n",
"+ elif n < 10 and k != 0:",
"- return R *... | false | 0.163922 | 0.160241 | 1.02297 | [
"s494756573",
"s807474133"
] |
u780962115 | p02803 | python | s686281454 | s160987031 | 302 | 163 | 52,056 | 3,572 | Accepted | Accepted | 46.03 | h,w=list(map(int,input().split()))
field=[]
field.append([True for i in range(w+2)])
start=[]
for i in range(h):
s=eval(input())
sub=[True]
for j in range(w):
if s[j]=="#":
sub.append(True)
else:
sub.append(False)
start.append((i+1,j+1))
... | h,w=list(map(int,input().split()))
data=[]
data.append(list("#"*(w+2)))
for i in range(h):
s=eval(input())
s="#"+s+"#"
lists=list(s)
data.append(lists)
data.append("#"*(w+2))
s=0
uselist=[]
graph={i:[] for i in range(1,h*w+1)}
for i in range(1,h+1):
for j in range(1,w+1):
if da... | 58 | 58 | 1,542 | 1,365 | h, w = list(map(int, input().split()))
field = []
field.append([True for i in range(w + 2)])
start = []
for i in range(h):
s = eval(input())
sub = [True]
for j in range(w):
if s[j] == "#":
sub.append(True)
else:
sub.append(False)
start.append((i + 1, j + 1... | h, w = list(map(int, input().split()))
data = []
data.append(list("#" * (w + 2)))
for i in range(h):
s = eval(input())
s = "#" + s + "#"
lists = list(s)
data.append(lists)
data.append("#" * (w + 2))
s = 0
uselist = []
graph = {i: [] for i in range(1, h * w + 1)}
for i in range(1, h + 1):
for j in ra... | false | 0 | [
"-field = []",
"-field.append([True for i in range(w + 2)])",
"-start = []",
"+data = []",
"+data.append(list(\"#\" * (w + 2)))",
"- sub = [True]",
"- for j in range(w):",
"- if s[j] == \"#\":",
"- sub.append(True)",
"- else:",
"- sub.append(False)",
"... | false | 0.136705 | 0.038475 | 3.553114 | [
"s686281454",
"s160987031"
] |
u695811449 | p02816 | python | s213995371 | s577445518 | 1,484 | 800 | 64,956 | 54,136 | Accepted | Accepted | 46.09 | N=int(eval(input()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
A.append(A[0])
B.append(B[0])
AX=[]
BX=[]
for i in range(N):
AX.append(A[i]^A[i+1])
BX.append(B[i]^B[i+1])
AX+=AX+[AX[0]]
# Rolling Hashで。
p=1<<30
mod=(1<<62)+1 # Hashがぶつからない, pと互いに素な数を適当に指定
A_TABLE=... | N=int(eval(input()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
A.append(A[0])
B.append(B[0])
AX=[]
BX=[]
for i in range(N):
AX.append(A[i]^A[i+1])
BX.append(B[i]^B[i+1])
AX+=AX[:-1]
# MP法
LEN=len(BX)
MP=[-1]*(LEN+1) #「接頭辞と接尾辞が最大何文字一致しているか」を記録する配列
NOW=-1 # 何文字一致し... | 40 | 44 | 791 | 851 | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A.append(A[0])
B.append(B[0])
AX = []
BX = []
for i in range(N):
AX.append(A[i] ^ A[i + 1])
BX.append(B[i] ^ B[i + 1])
AX += AX + [AX[0]]
# Rolling Hashで。
p = 1 << 30
mod = (1 << 62) + 1 # Hashがぶつからない, pと互いに素な数を適当に指定... | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A.append(A[0])
B.append(B[0])
AX = []
BX = []
for i in range(N):
AX.append(A[i] ^ A[i + 1])
BX.append(B[i] ^ B[i + 1])
AX += AX[:-1]
# MP法
LEN = len(BX)
MP = [-1] * (LEN + 1) # 「接頭辞と接尾辞が最大何文字一致しているか」を記録する配列
NOW = -1 ... | false | 9.090909 | [
"-AX += AX + [AX[0]]",
"-# Rolling Hashで。",
"-p = 1 << 30",
"-mod = (1 << 62) + 1 # Hashがぶつからない, pと互いに素な数を適当に指定",
"-A_TABLE = [0] # Rolling Hashのテーブル. 最初は0",
"-B_TABLE = [0] # Rolling Hashのテーブル. 最初は0",
"-for i in range(len(AX)):",
"- A_TABLE.append((p * A_TABLE[-1] % mod + AX[i]) % mod) # テーブルを... | false | 0.036542 | 0.040432 | 0.903777 | [
"s213995371",
"s577445518"
] |
u281610856 | p03487 | python | s120542856 | s023688095 | 129 | 108 | 14,692 | 21,232 | Accepted | Accepted | 16.28 | n = int(eval(input()))
a = list(map(int, input().split()))
n = len(a)
a.sort()
a.append(-1)
ans = 0
i = 0
while i < n:
cnt = 1
while a[i] == a[i+1]:
cnt += 1
i += 1
if i == len(a)-1:
break
if cnt > a[i]:
ans += cnt - a[i]
elif cnt < a[i]:
... | from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
c = Counter(a)
ans = 0
for val, cnt in c.most_common():
if val > cnt:
ans += cnt
elif val < cnt:
ans += cnt - val
print(ans) | 20 | 11 | 352 | 243 | n = int(eval(input()))
a = list(map(int, input().split()))
n = len(a)
a.sort()
a.append(-1)
ans = 0
i = 0
while i < n:
cnt = 1
while a[i] == a[i + 1]:
cnt += 1
i += 1
if i == len(a) - 1:
break
if cnt > a[i]:
ans += cnt - a[i]
elif cnt < a[i]:
ans += cn... | from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
c = Counter(a)
ans = 0
for val, cnt in c.most_common():
if val > cnt:
ans += cnt
elif val < cnt:
ans += cnt - val
print(ans)
| false | 45 | [
"+from collections import Counter",
"+",
"-n = len(a)",
"-a.sort()",
"-a.append(-1)",
"+c = Counter(a)",
"-i = 0",
"-while i < n:",
"- cnt = 1",
"- while a[i] == a[i + 1]:",
"- cnt += 1",
"- i += 1",
"- if i == len(a) - 1:",
"- break",
"- if cnt >... | false | 0.044107 | 0.041387 | 1.065721 | [
"s120542856",
"s023688095"
] |
u499381410 | p02626 | python | s499917053 | s705171808 | 145 | 120 | 76,760 | 81,396 | Accepted | Accepted | 17.24 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gcd, s... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gcd, s... | 76 | 73 | 1,638 | 1,618 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gcd, sqrt
from... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gcd, sqrt
from... | false | 3.947368 | [
"-if c < t:",
"+b1 = c - t",
"+if b1 < 0 or b1 % 2:",
"-if (c - t) % 2:",
"- flg = 1",
"-b1 = (c - t) // 2",
"+b1 //= 2"
] | false | 0.040053 | 0.040161 | 0.997329 | [
"s499917053",
"s705171808"
] |
u156815136 | p03828 | python | s450778185 | s605848484 | 34 | 19 | 3,064 | 3,064 | Accepted | Accepted | 44.12 | #
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
r_ = n / m
if (r_ - (n // m)) > 0:
return (n//m) + 1
else:
return (n//m)"""
""" n! mod m 階乗
mod = 1e9 + 7
N = 10000000
... | #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
#from itertools import combinations # (string,3) 3回
#from collections import deque
#import collections.defaultdict
#import bisect
#
# d = m - k[i] - k[j]
# if kk[bisect.bi... | 79 | 47 | 1,332 | 1,048 | #
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
# import math
# mod = 10**9+7
# import itertools
# import fractions
# import numpy as np
# mod = 10**4 + 7
"""def kiri(n,m):
r_ = n / m
if (r_ - (n // m)) > 0:
return (n//m) + 1
else:
return (n//m)"""
""" n! mod m 階乗
mod = 1e9 + 7
N = 10000000
fac = [0] * N
... | # from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
# from itertools import combinations # (string,3) 3回
# from collections import deque
# import collections.defaultdict
# import bisect
#
# d = m - k[i] - k[j]
# if kk[bisect.bise... | false | 40.506329 | [
"+# from statistics import median",
"+# import collections",
"+# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]",
"+# from itertools import combinations # (string,3) 3回",
"+# from collections import deque",
"+# import collections.defaultdict",
"+# import bisect",
"-#... | false | 0.077178 | 0.096024 | 0.803738 | [
"s450778185",
"s605848484"
] |
u409757418 | p02831 | python | s576705869 | s346140311 | 47 | 17 | 5,560 | 2,940 | Accepted | Accepted | 63.83 | import fractions
a, b = list(map(int, input().split()))
ab = a * b
n = max(a, b)
gcd = int(fractions.gcd(a, b))
print((ab // gcd)) | a , b = list(map(int, input().split()))
ab = a*b
if a < b:
a, b = b, a
while b > 0:
a, b = b, a % b
print((ab // a)) | 6 | 7 | 127 | 118 | import fractions
a, b = list(map(int, input().split()))
ab = a * b
n = max(a, b)
gcd = int(fractions.gcd(a, b))
print((ab // gcd))
| a, b = list(map(int, input().split()))
ab = a * b
if a < b:
a, b = b, a
while b > 0:
a, b = b, a % b
print((ab // a))
| false | 14.285714 | [
"-import fractions",
"-",
"-n = max(a, b)",
"-gcd = int(fractions.gcd(a, b))",
"-print((ab // gcd))",
"+if a < b:",
"+ a, b = b, a",
"+while b > 0:",
"+ a, b = b, a % b",
"+print((ab // a))"
] | false | 0.043642 | 0.036293 | 1.202491 | [
"s576705869",
"s346140311"
] |
u525065967 | p02623 | python | s962563168 | s503622249 | 260 | 236 | 45,824 | 40,528 | Accepted | Accepted | 9.23 | from bisect import *
n, m, k = list(map(int, input().split()))
A, B = [0], [0]
for x in map(int, input().split()): A.append(A[-1]+x)
for x in map(int, input().split()): B.append(B[-1]+x)
ans, j = 0, m
for i in range(n+1):
if A[i] > k: break
while A[i] + B[j] > k: j -= 1
ans = max(ans, i+j)
print(a... | from bisect import *
n, m, k = list(map(int, input().split()))
A = [*list(map(int, input().split()))]
B = [*list(map(int, input().split()))]
tot = sum(B)
ans, j = 0, m
for i in range(n+1):
while j > 0 and tot > k:
j -= 1
tot -= B[j]
if tot > k: break
if i < n: tot += A[i]
ans... | 11 | 14 | 318 | 331 | from bisect import *
n, m, k = list(map(int, input().split()))
A, B = [0], [0]
for x in map(int, input().split()):
A.append(A[-1] + x)
for x in map(int, input().split()):
B.append(B[-1] + x)
ans, j = 0, m
for i in range(n + 1):
if A[i] > k:
break
while A[i] + B[j] > k:
j -= 1
ans = ... | from bisect import *
n, m, k = list(map(int, input().split()))
A = [*list(map(int, input().split()))]
B = [*list(map(int, input().split()))]
tot = sum(B)
ans, j = 0, m
for i in range(n + 1):
while j > 0 and tot > k:
j -= 1
tot -= B[j]
if tot > k:
break
if i < n:
tot += A[i]
... | false | 21.428571 | [
"-A, B = [0], [0]",
"-for x in map(int, input().split()):",
"- A.append(A[-1] + x)",
"-for x in map(int, input().split()):",
"- B.append(B[-1] + x)",
"+A = [*list(map(int, input().split()))]",
"+B = [*list(map(int, input().split()))]",
"+tot = sum(B)",
"- if A[i] > k:",
"+ while j > 0 ... | false | 0.007918 | 0.047918 | 0.165249 | [
"s962563168",
"s503622249"
] |
u583507988 | p02953 | python | s269894614 | s116805943 | 95 | 84 | 20,672 | 84,832 | Accepted | Accepted | 11.58 | n=int(eval(input()))
h=list(map(int,input().split()))
if n==1:
print('Yes')
exit()
res=h[n-1]
for i in range(1,n):
if h[n-1-i]-res<=1:
res=min(res,h[n-1-i])
else:
print('No')
exit()
print('Yes') | n=int(eval(input()))
h=list(map(int,input().split()))
res=h[n-1]
for i in range(1,n):
if h[n-1-i]<=res:
res=h[n-1-i]
elif h[n-1-i]==res+1:
res=h[n-1-i]-1
else:
print('No')
exit()
print('Yes') | 13 | 12 | 220 | 218 | n = int(eval(input()))
h = list(map(int, input().split()))
if n == 1:
print("Yes")
exit()
res = h[n - 1]
for i in range(1, n):
if h[n - 1 - i] - res <= 1:
res = min(res, h[n - 1 - i])
else:
print("No")
exit()
print("Yes")
| n = int(eval(input()))
h = list(map(int, input().split()))
res = h[n - 1]
for i in range(1, n):
if h[n - 1 - i] <= res:
res = h[n - 1 - i]
elif h[n - 1 - i] == res + 1:
res = h[n - 1 - i] - 1
else:
print("No")
exit()
print("Yes")
| false | 7.692308 | [
"-if n == 1:",
"- print(\"Yes\")",
"- exit()",
"- if h[n - 1 - i] - res <= 1:",
"- res = min(res, h[n - 1 - i])",
"+ if h[n - 1 - i] <= res:",
"+ res = h[n - 1 - i]",
"+ elif h[n - 1 - i] == res + 1:",
"+ res = h[n - 1 - i] - 1"
] | false | 0.056747 | 0.036414 | 1.558367 | [
"s269894614",
"s116805943"
] |
u075012704 | p03732 | python | s145410736 | s984194759 | 220 | 192 | 42,860 | 40,560 | Accepted | Accepted | 12.73 | from itertools import accumulate
N, W_limit = list(map(int, input().split()))
W, V = [], []
for i in range(N):
w, v = list(map(int, input().split()))
W.append(w)
V.append(v)
# 基準となるW
base_W = W[0]
# 0 ~ 3の範囲に調節
W = [w - base_W for w in W]
# 重みごとに商品を分ける
Items = [[] for i in range(4)]
for w, ... | from itertools import accumulate
N, W = list(map(int, input().split()))
Item = [[] for i in range(4)]
for i in range(N):
wi, vi = list(map(int, input().split()))
if i == 0:
Item[0].append(vi)
w_base = wi
else:
Item[wi - w_base].append(vi)
w0, w1, w2, w3 = Item
w0 = [0] +... | 35 | 28 | 969 | 904 | from itertools import accumulate
N, W_limit = list(map(int, input().split()))
W, V = [], []
for i in range(N):
w, v = list(map(int, input().split()))
W.append(w)
V.append(v)
# 基準となるW
base_W = W[0]
# 0 ~ 3の範囲に調節
W = [w - base_W for w in W]
# 重みごとに商品を分ける
Items = [[] for i in range(4)]
for w, v in zip(W, V):
... | from itertools import accumulate
N, W = list(map(int, input().split()))
Item = [[] for i in range(4)]
for i in range(N):
wi, vi = list(map(int, input().split()))
if i == 0:
Item[0].append(vi)
w_base = wi
else:
Item[wi - w_base].append(vi)
w0, w1, w2, w3 = Item
w0 = [0] + list(accumu... | false | 20 | [
"-N, W_limit = list(map(int, input().split()))",
"-W, V = [], []",
"+N, W = list(map(int, input().split()))",
"+Item = [[] for i in range(4)]",
"- w, v = list(map(int, input().split()))",
"- W.append(w)",
"- V.append(v)",
"-# 基準となるW",
"-base_W = W[0]",
"-# 0 ~ 3の範囲に調節",
"-W = [w - base_... | false | 0.042547 | 0.04467 | 0.952474 | [
"s145410736",
"s984194759"
] |
u488401358 | p03554 | python | s622078287 | s209953398 | 2,200 | 1,840 | 135,396 | 132,232 | Accepted | Accepted | 16.36 | n=int(eval(input()))
b=list(map(int,input().split()))
ope=[[] for i in range(n)]
Q=int(eval(input()))
for i in range(Q):
l,r=list(map(int,input().split()))
ope[r-1].append(l-1)
res=b.count(0)
Data=[(-1)**((b[i]==1)+1) for i in range(n)]
for i in range(1,n):
Data[i]+=Data[i-1]
Data=[0]+Data
... | import sys
input=sys.stdin.readline
n=int(eval(input()))
b=list(map(int,input().split()))
ope=[[] for i in range(n)]
Q=int(eval(input()))
for i in range(Q):
l,r=list(map(int,input().split()))
ope[r-1].append(l-1)
res=b.count(0)
Data=[(-1)**((b[i]==1)+1) for i in range(n)]
for i in range(1,n):... | 70 | 74 | 1,478 | 1,521 | n = int(eval(input()))
b = list(map(int, input().split()))
ope = [[] for i in range(n)]
Q = int(eval(input()))
for i in range(Q):
l, r = list(map(int, input().split()))
ope[r - 1].append(l - 1)
res = b.count(0)
Data = [(-1) ** ((b[i] == 1) + 1) for i in range(n)]
for i in range(1, n):
Data[i] += Data[i - 1]... | import sys
input = sys.stdin.readline
n = int(eval(input()))
b = list(map(int, input().split()))
ope = [[] for i in range(n)]
Q = int(eval(input()))
for i in range(Q):
l, r = list(map(int, input().split()))
ope[r - 1].append(l - 1)
res = b.count(0)
Data = [(-1) ** ((b[i] == 1) + 1) for i in range(n)]
for i in ... | false | 5.405405 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.096353 | 0.070964 | 1.357769 | [
"s622078287",
"s209953398"
] |
u022407960 | p02234 | python | s357646145 | s161317469 | 130 | 120 | 7,952 | 7,860 | Accepted | Accepted | 7.69 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def mat_mul_opt(_mat_info):
rc_info = list(map(int, _mat_info[0]))
rc_info.extend(list([int(x[1]) for x in _mat_info[1:]]))
for l in range(2, mat_num + 1):
for i in range(1, mat_num - l + 2):
j = i + l - 1
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def mat_mul_opt(_mat_info):
rc_info = list(map(int, _mat_info[0]))
rc_info.extend(list([int(x[1]) for x in _mat_info[1:]]))
ans = [[0] * (mat_num + 1) for _ in range(mat_num + 1)]
for l in range(2, mat_num + 1):
for i in ... | 29 | 30 | 850 | 852 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def mat_mul_opt(_mat_info):
rc_info = list(map(int, _mat_info[0]))
rc_info.extend(list([int(x[1]) for x in _mat_info[1:]]))
for l in range(2, mat_num + 1):
for i in range(1, mat_num - l + 2):
j = i + l - 1
ans[i][j] =... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def mat_mul_opt(_mat_info):
rc_info = list(map(int, _mat_info[0]))
rc_info.extend(list([int(x[1]) for x in _mat_info[1:]]))
ans = [[0] * (mat_num + 1) for _ in range(mat_num + 1)]
for l in range(2, mat_num + 1):
for i in range(1, mat_num... | false | 3.333333 | [
"+ ans = [[0] * (mat_num + 1) for _ in range(mat_num + 1)]",
"- ans = [[0] * (mat_num + 1) for _ in range(mat_num + 1)]"
] | false | 0.039968 | 0.038194 | 1.046427 | [
"s357646145",
"s161317469"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.