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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u217627525 | p03737 | python | s676319048 | s078602161 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | s1,s2,s3=input().split()
s1=s1.upper()
s2=s2.upper()
s3=s3.upper()
print((s1[0]+s2[0]+s3[0])) | s1,s2,s3=input().split()
print((s1[0].upper()+s2[0].upper()+s3[0].upper())) | 5 | 2 | 95 | 74 | s1, s2, s3 = input().split()
s1 = s1.upper()
s2 = s2.upper()
s3 = s3.upper()
print((s1[0] + s2[0] + s3[0]))
| s1, s2, s3 = input().split()
print((s1[0].upper() + s2[0].upper() + s3[0].upper()))
| false | 60 | [
"-s1 = s1.upper()",
"-s2 = s2.upper()",
"-s3 = s3.upper()",
"-print((s1[0] + s2[0] + s3[0]))",
"+print((s1[0].upper() + s2[0].upper() + s3[0].upper()))"
] | false | 0.059952 | 0.044351 | 1.351774 | [
"s676319048",
"s078602161"
] |
u127499732 | p02899 | python | s242807443 | s800386589 | 81 | 72 | 15,588 | 15,528 | Accepted | Accepted | 11.11 | def main():
n=int(eval(input()))
a=list(map(int,input().split()))
b=[0]*n
for index,number in enumerate(a):
b[number-1]=str(index+1)
print((" ".join(b)))
if __name__=="__main__":
main() | def main():
import sys
n=int(eval(input()))
a=tuple(map(int,sys.stdin.readline().split()))
b=[0]*n
for index,number in enumerate(a):
b[number-1]=str(index+1)
print((" ".join(b)))
if __name__=="__main__":
main() | 9 | 10 | 201 | 229 | def main():
n = int(eval(input()))
a = list(map(int, input().split()))
b = [0] * n
for index, number in enumerate(a):
b[number - 1] = str(index + 1)
print((" ".join(b)))
if __name__ == "__main__":
main()
| def main():
import sys
n = int(eval(input()))
a = tuple(map(int, sys.stdin.readline().split()))
b = [0] * n
for index, number in enumerate(a):
b[number - 1] = str(index + 1)
print((" ".join(b)))
if __name__ == "__main__":
main()
| false | 10 | [
"+ import sys",
"+",
"- a = list(map(int, input().split()))",
"+ a = tuple(map(int, sys.stdin.readline().split()))"
] | false | 0.162359 | 0.053131 | 3.055798 | [
"s242807443",
"s800386589"
] |
u475402977 | p02583 | python | s906455176 | s253840093 | 165 | 116 | 9,220 | 9,116 | Accepted | Accepted | 29.7 | import itertools
N=int(eval(input()))
A=list(map(int, input().split()))
ans=0
for any_pair in itertools.combinations(A, 3):
pair=sorted(any_pair)
#print(type(pair))
if pair[0]+pair[1]>pair[2] and pair[1]+pair[2]>pair[0] and pair[0]+pair[2]>pair[1] and pair[0]!=pair[1] and pair[1]!=pair[2]:
a... | import itertools
N=int(eval(input()))
A=list(map(int, input().split()))
ans=0
for any_pair in itertools.combinations(A, 3):
pair=sorted(any_pair)#新しいリストを作成
#print(type(pair))
if pair[0]+pair[1]>pair[2] and pair[0]!=pair[1] and pair[1]!=pair[2]:
ans+=1
#print(pair)
print(ans) | 11 | 11 | 353 | 307 | import itertools
N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
for any_pair in itertools.combinations(A, 3):
pair = sorted(any_pair)
# print(type(pair))
if (
pair[0] + pair[1] > pair[2]
and pair[1] + pair[2] > pair[0]
and pair[0] + pair[2] > pair[1]
and ... | import itertools
N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
for any_pair in itertools.combinations(A, 3):
pair = sorted(any_pair) # 新しいリストを作成
# print(type(pair))
if pair[0] + pair[1] > pair[2] and pair[0] != pair[1] and pair[1] != pair[2]:
ans += 1
# print(pair)
pri... | false | 0 | [
"- pair = sorted(any_pair)",
"+ pair = sorted(any_pair) # 新しいリストを作成",
"- if (",
"- pair[0] + pair[1] > pair[2]",
"- and pair[1] + pair[2] > pair[0]",
"- and pair[0] + pair[2] > pair[1]",
"- and pair[0] != pair[1]",
"- and pair[1] != pair[2]",
"- ):",
... | false | 0.036929 | 0.037358 | 0.988497 | [
"s906455176",
"s253840093"
] |
u210827208 | p02684 | python | s373984561 | s463638950 | 175 | 108 | 32,400 | 95,628 | Accepted | Accepted | 38.29 | n,k=list(map(int,input().split()))
A=list(map(int,input().split()))
cnt=0
s=1
M=[0]
B=[0]*(n+1)
while cnt<n:
s=A[s-1]
if B[s-1]==0:
B[s-1]+=1
else:
imp=s-1
break
M.append(s-1)
cnt+=1
x=M.index(imp)
y=len(M)-x
if k<=x:
print((M[k]+1))
else:
N=M[x:... | n,k=list(map(int,input().split()))
A=list(map(int,input().split()))
cnt=0
s=1
M=[0]
B=[False]*(n+1)
while cnt<n:
s=A[s-1]
if not B[s-1]:
B[s-1]=True
else:
break
M.append(s-1)
cnt+=1
x=M.index(s-1)
y=len(M)-x
if k<=x:
print((M[k]+1))
else:
N=M[x:]
pri... | 23 | 22 | 338 | 328 | n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
cnt = 0
s = 1
M = [0]
B = [0] * (n + 1)
while cnt < n:
s = A[s - 1]
if B[s - 1] == 0:
B[s - 1] += 1
else:
imp = s - 1
break
M.append(s - 1)
cnt += 1
x = M.index(imp)
y = len(M) - x
if k <= x:
print... | n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
cnt = 0
s = 1
M = [0]
B = [False] * (n + 1)
while cnt < n:
s = A[s - 1]
if not B[s - 1]:
B[s - 1] = True
else:
break
M.append(s - 1)
cnt += 1
x = M.index(s - 1)
y = len(M) - x
if k <= x:
print((M[k] + 1))
... | false | 4.347826 | [
"-B = [0] * (n + 1)",
"+B = [False] * (n + 1)",
"- if B[s - 1] == 0:",
"- B[s - 1] += 1",
"+ if not B[s - 1]:",
"+ B[s - 1] = True",
"- imp = s - 1",
"-x = M.index(imp)",
"+x = M.index(s - 1)"
] | false | 0.139517 | 0.060777 | 2.295574 | [
"s373984561",
"s463638950"
] |
u254871849 | p03221 | python | s140193478 | s473941668 | 1,037 | 481 | 77,172 | 60,912 | Accepted | Accepted | 53.62 | # 2019-11-11 14:35:02(JST)
import sys
# import collections
import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# ... | import sys
from collections import defaultdict
n, m, *py = map(int, sys.stdin.read().split())
py = list(zip(*[iter(py)] * 2))
def main():
ids = defaultdict(list)
for p, y in py:
ids[p].append(y)
for p, ys in ids.items():
ids[p] = dict([(y, i) for i, y in enumerate(sorted(y... | 35 | 25 | 1,003 | 625 | # 2019-11-11 14:35:02(JST)
import sys
# import collections
import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import n... | import sys
from collections import defaultdict
n, m, *py = map(int, sys.stdin.read().split())
py = list(zip(*[iter(py)] * 2))
def main():
ids = defaultdict(list)
for p, y in py:
ids[p].append(y)
for p, ys in ids.items():
ids[p] = dict([(y, i) for i, y in enumerate(sorted(ys), 1)])
for... | false | 28.571429 | [
"-# 2019-11-11 14:35:02(JST)",
"+from collections import defaultdict",
"-# import collections",
"-import math",
"-",
"-# from string import ascii_lowercase, ascii_uppercase, digits",
"-# from bisect import bisect_left as bi_l, bisect_right as bi_r",
"-# import itertools",
"-# from functools import r... | false | 0.084687 | 0.036766 | 2.303438 | [
"s140193478",
"s473941668"
] |
u644907318 | p03804 | python | s896795551 | s117421387 | 168 | 65 | 38,384 | 63,580 | Accepted | Accepted | 61.31 | N,M = list(map(int,input().split()))
A = [input().strip() for _ in range(N)]
B = [input().strip() for _ in range(M)]
for i in range(N-M+1):
for j in range(N-M+1):
flag = 0
for k in range(M):
for l in range(M):
if B[k][l] != A[i+k][j+l]:
flag=1... | N,M = list(map(int,input().split()))
A = []
for _ in range(N):
A.append(input().strip())
B = []
for _ in range(M):
B.append(input().strip())
flag = 0
for i in range(N-M+1):
for j in range(N-M+1):
ind = 0
for k in range(M):
for l in range(M):
if A[i+k]... | 18 | 24 | 474 | 533 | N, M = list(map(int, input().split()))
A = [input().strip() for _ in range(N)]
B = [input().strip() for _ in range(M)]
for i in range(N - M + 1):
for j in range(N - M + 1):
flag = 0
for k in range(M):
for l in range(M):
if B[k][l] != A[i + k][j + l]:
f... | N, M = list(map(int, input().split()))
A = []
for _ in range(N):
A.append(input().strip())
B = []
for _ in range(M):
B.append(input().strip())
flag = 0
for i in range(N - M + 1):
for j in range(N - M + 1):
ind = 0
for k in range(M):
for l in range(M):
if A[i + k][... | false | 25 | [
"-A = [input().strip() for _ in range(N)]",
"-B = [input().strip() for _ in range(M)]",
"+A = []",
"+for _ in range(N):",
"+ A.append(input().strip())",
"+B = []",
"+for _ in range(M):",
"+ B.append(input().strip())",
"+flag = 0",
"- flag = 0",
"+ ind = 0",
"- ... | false | 0.061867 | 0.036017 | 1.717724 | [
"s896795551",
"s117421387"
] |
u627803856 | p03456 | python | s348541779 | s466509667 | 188 | 169 | 38,384 | 38,256 | Accepted | Accepted | 10.11 | a,b=list(map(str,input().split()))
c=int(a+b)
sq = [i*i for i in range(1,10001)]
if c in sq: print('Yes')
else: print('No') | a, b = map(int, input().split())
c = int(str(a) + str(b))
square = [i ** 2 for i in range(1, 500)]
print('Yes') if c in square else print('No')
| 5 | 7 | 121 | 152 | a, b = list(map(str, input().split()))
c = int(a + b)
sq = [i * i for i in range(1, 10001)]
if c in sq:
print("Yes")
else:
print("No")
| a, b = map(int, input().split())
c = int(str(a) + str(b))
square = [i**2 for i in range(1, 500)]
print("Yes") if c in square else print("No")
| false | 28.571429 | [
"-a, b = list(map(str, input().split()))",
"-c = int(a + b)",
"-sq = [i * i for i in range(1, 10001)]",
"-if c in sq:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+a, b = map(int, input().split())",
"+c = int(str(a) + str(b))",
"+square = [i**2 for i in range(1, 500)]",
"+print(\"Ye... | false | 0.036877 | 0.035673 | 1.033759 | [
"s348541779",
"s466509667"
] |
u285891772 | p03298 | python | s873330395 | s152468473 | 1,427 | 711 | 103,440 | 230,612 | Accepted | Accepted | 50.18 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | 65 | 62 | 1,713 | 1,636 | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
gcd,
)
from itertools import (
accumulate,
permutations,
combinations,
... | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
gcd,
)
from itertools import (
accumulate,
permutations,
combinations,
... | false | 4.615385 | [
"-def main():",
"- N = INT()",
"- S = eval(input())",
"- former = S[:N]",
"- latter = S[N:][::-1]",
"- dic_f = defaultdict(int)",
"- dic_l = defaultdict(int)",
"- for x in product([0, 1], repeat=N):",
"- tmp_red = \"\"",
"- tmp_blue = \"\"",
"- for i in ... | false | 0.034064 | 0.036678 | 0.928731 | [
"s873330395",
"s152468473"
] |
u821989875 | p02576 | python | s471271258 | s907824221 | 32 | 29 | 9,152 | 9,072 | Accepted | Accepted | 9.38 | n, x, t = list(map(int, input().split()))
if n % x == 0:
print(((n//x)*t))
else:
print((((n//x)+1)*t)) | import math
N, X, T = list(map(int, input().split()))
print((math.ceil(N/ X)* T)) | 5 | 3 | 100 | 75 | n, x, t = list(map(int, input().split()))
if n % x == 0:
print(((n // x) * t))
else:
print((((n // x) + 1) * t))
| import math
N, X, T = list(map(int, input().split()))
print((math.ceil(N / X) * T))
| false | 40 | [
"-n, x, t = list(map(int, input().split()))",
"-if n % x == 0:",
"- print(((n // x) * t))",
"-else:",
"- print((((n // x) + 1) * t))",
"+import math",
"+",
"+N, X, T = list(map(int, input().split()))",
"+print((math.ceil(N / X) * T))"
] | false | 0.139144 | 0.096899 | 1.435966 | [
"s471271258",
"s907824221"
] |
u021019433 | p02900 | python | s852242565 | s845003250 | 364 | 310 | 5,048 | 5,048 | Accepted | Accepted | 14.84 | from fractions import gcd
d = gcd(*list(map(int, input().split())))
r = 1
i = 2
while i * i <= d:
c = 0
while d % i == 0:
c += 1
d //= i
r += c > 0
i += 1
print((r + (d > 1))) | from fractions import gcd
d = gcd(*list(map(int, input().split())))
r = 1
i = 2
while i * i <= d:
c = 0
while d % i == 0:
c += 1
d //= i
if c: r += 1
i += 1
print((r + (d > 1))) | 13 | 13 | 213 | 215 | from fractions import gcd
d = gcd(*list(map(int, input().split())))
r = 1
i = 2
while i * i <= d:
c = 0
while d % i == 0:
c += 1
d //= i
r += c > 0
i += 1
print((r + (d > 1)))
| from fractions import gcd
d = gcd(*list(map(int, input().split())))
r = 1
i = 2
while i * i <= d:
c = 0
while d % i == 0:
c += 1
d //= i
if c:
r += 1
i += 1
print((r + (d > 1)))
| false | 0 | [
"- r += c > 0",
"+ if c:",
"+ r += 1"
] | false | 0.071105 | 0.053242 | 1.335493 | [
"s852242565",
"s845003250"
] |
u088552457 | p02614 | python | s289285671 | s252575526 | 352 | 109 | 69,752 | 78,292 | Accepted | Accepted | 69.03 | # import sys
# input = sys.stdin.readline
# import re
import math
import itertools
def main():
h, w, k = input_list()
maze = []
for H in range(h):
maze.append(list(eval(input())))
ans = []
a = 0
all = 0
for l in maze:
a += l.count('#')
all += l.coun... | # import sys
# input = sys.stdin.readline
import itertools
import collections
from decimal import Decimal
from functools import reduce
# 持っているビスケットを叩き、1枚増やす
# ビスケット A枚を 1円に交換する
# 1円をビスケット B枚に交換する
def main():
H, W, k = input_list()
maze = [list(eval(input())) for _ in range(H)]
ans = 0
f... | 94 | 70 | 2,528 | 1,679 | # import sys
# input = sys.stdin.readline
# import re
import math
import itertools
def main():
h, w, k = input_list()
maze = []
for H in range(h):
maze.append(list(eval(input())))
ans = []
a = 0
all = 0
for l in maze:
a += l.count("#")
all += l.count("#")
ans.ap... | # import sys
# input = sys.stdin.readline
import itertools
import collections
from decimal import Decimal
from functools import reduce
# 持っているビスケットを叩き、1枚増やす
# ビスケット A枚を 1円に交換する
# 1円をビスケット B枚に交換する
def main():
H, W, k = input_list()
maze = [list(eval(input())) for _ in range(H)]
ans = 0
for row_bit in it... | false | 25.531915 | [
"-# import re",
"-import math",
"+import collections",
"+from decimal import Decimal",
"+from functools import reduce",
"+",
"+# 持っているビスケットを叩き、1枚増やす",
"+# ビスケット A枚を 1円に交換する",
"+# 1円をビスケット B枚に交換する",
"+def main():",
"+ H, W, k = input_list()",
"+ maze = [list(eval(input())) for _ in range(... | false | 0.04723 | 0.046101 | 1.024488 | [
"s289285671",
"s252575526"
] |
u588341295 | p03112 | python | s814277990 | s995639538 | 1,265 | 1,029 | 30,120 | 14,504 | Accepted | Accepted | 18.66 | # -*- coding: utf-8 -*-
import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians, log10
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd
from heapq import heappop, heappush, heapify, heappushpop
from b... | # -*- coding: utf-8 -*-
"""
参考:https://img.atcoder.jp/abc119/editorial.pdf
"""
import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians, log10
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd
from ... | 90 | 71 | 2,602 | 2,274 | # -*- coding: utf-8 -*-
import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians, log10
if sys.version_info.minor >= 5:
from math import gcd
else:
from fractions import gcd
from heapq import heappop, heappush, heapify, heappushpop
from bi... | # -*- coding: utf-8 -*-
"""
参考:https://img.atcoder.jp/abc119/editorial.pdf
"""
import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians, log10
if sys.version_info.minor >= 5:
from math import gcd
else:
from fractions import gcd
from heapq... | false | 21.111111 | [
"+\"\"\"",
"+参考:https://img.atcoder.jp/abc119/editorial.pdf",
"+\"\"\"",
"-INF = float(\"inf\")",
"+INF = 10**18",
"-# Si番目の神社から左に一番近い寺",
"-L1 = [INF] * (A + 2)",
"-# Si番目の神社から右に一番近い寺",
"-R1 = [INF] * (A + 2)",
"-for i in range(1, A + 1):",
"- idx = bisect_right(T, S[i]) - 1",
"- if T[id... | false | 0.037125 | 0.037142 | 0.999548 | [
"s814277990",
"s995639538"
] |
u150984829 | p02419 | python | s945595291 | s524502012 | 30 | 20 | 5,564 | 5,540 | Accepted | Accepted | 33.33 | W=eval(input())
T=[]
while 1:
a=eval(input())
if'END_OF_TEXT'==a:break
T+=[s.lower() for s in a.split()]
print((T.count(W))) | import sys
W=eval(input())
print((sys.stdin.read().lower().split().count(W))) | 7 | 3 | 119 | 71 | W = eval(input())
T = []
while 1:
a = eval(input())
if "END_OF_TEXT" == a:
break
T += [s.lower() for s in a.split()]
print((T.count(W)))
| import sys
W = eval(input())
print((sys.stdin.read().lower().split().count(W)))
| false | 57.142857 | [
"+import sys",
"+",
"-T = []",
"-while 1:",
"- a = eval(input())",
"- if \"END_OF_TEXT\" == a:",
"- break",
"- T += [s.lower() for s in a.split()]",
"-print((T.count(W)))",
"+print((sys.stdin.read().lower().split().count(W)))"
] | false | 0.043013 | 0.042703 | 1.007257 | [
"s945595291",
"s524502012"
] |
u597374218 | p03126 | python | s946789304 | s353613147 | 30 | 25 | 9,108 | 9,152 | Accepted | Accepted | 16.67 | N,M=list(map(int,input().split()))
food=set(range(1,M+1))
for i in range(N):
K,*A=list(map(int,input().split()))
food&=set(A)
print((len(food))) | N,M=list(map(int,input().split()))
food=set(range(1,M+1))
for i in range(N):
A=list(map(int,input().split()[1:]))
food&=set(A)
print((len(food))) | 6 | 6 | 143 | 144 | N, M = list(map(int, input().split()))
food = set(range(1, M + 1))
for i in range(N):
K, *A = list(map(int, input().split()))
food &= set(A)
print((len(food)))
| N, M = list(map(int, input().split()))
food = set(range(1, M + 1))
for i in range(N):
A = list(map(int, input().split()[1:]))
food &= set(A)
print((len(food)))
| false | 0 | [
"- K, *A = list(map(int, input().split()))",
"+ A = list(map(int, input().split()[1:]))"
] | false | 0.049808 | 0.049129 | 1.013823 | [
"s946789304",
"s353613147"
] |
u670180528 | p04046 | python | s488284755 | s916785866 | 203 | 138 | 14,836 | 14,836 | Accepted | Accepted | 32.02 | h,w,a,b = list(map(int, input().split()))
mx = max(h,w)
mod = 10**9+7
fac = [1]*(h+w+1)
for i in range(1,h+w+1):
fac[i]=fac[i-1]*i%mod
rev = [1]*(mx+1)
rev[-1] = pow(fac[mx], mod-2, mod)
for i in range(mx-1, -1, -1):
rev[i] = rev[i+1]*(i+1)%mod
const = rev[h-a-1]*rev[a-1]%mod
ans = 0
for i in range(b,w):
... | def solve():
h,w,a,b = list(map(int, input().split()))
mx = max(h,w)
mod = 10**9+7
fac = [1]*(h+w+1)
for i in range(1,h+w+1):
fac[i]=fac[i-1]*i%mod
rev = [1]*(mx+1)
rev[-1] = pow(fac[mx], mod-2, mod)
for i in range(mx-1, -1, -1):
rev[i] = rev[i+1]*(i+1)%mod
const = rev[h-a-1]*rev[a-1]%mod
ans ... | 15 | 16 | 392 | 446 | h, w, a, b = list(map(int, input().split()))
mx = max(h, w)
mod = 10**9 + 7
fac = [1] * (h + w + 1)
for i in range(1, h + w + 1):
fac[i] = fac[i - 1] * i % mod
rev = [1] * (mx + 1)
rev[-1] = pow(fac[mx], mod - 2, mod)
for i in range(mx - 1, -1, -1):
rev[i] = rev[i + 1] * (i + 1) % mod
const = rev[h - a - 1] * r... | def solve():
h, w, a, b = list(map(int, input().split()))
mx = max(h, w)
mod = 10**9 + 7
fac = [1] * (h + w + 1)
for i in range(1, h + w + 1):
fac[i] = fac[i - 1] * i % mod
rev = [1] * (mx + 1)
rev[-1] = pow(fac[mx], mod - 2, mod)
for i in range(mx - 1, -1, -1):
rev[i] = ... | false | 6.25 | [
"-h, w, a, b = list(map(int, input().split()))",
"-mx = max(h, w)",
"-mod = 10**9 + 7",
"-fac = [1] * (h + w + 1)",
"-for i in range(1, h + w + 1):",
"- fac[i] = fac[i - 1] * i % mod",
"-rev = [1] * (mx + 1)",
"-rev[-1] = pow(fac[mx], mod - 2, mod)",
"-for i in range(mx - 1, -1, -1):",
"- re... | false | 0.090932 | 0.045645 | 1.992165 | [
"s488284755",
"s916785866"
] |
u821432765 | p02791 | python | s647283844 | s701062159 | 1,128 | 104 | 25,716 | 24,744 | Accepted | Accepted | 90.78 | # Binary Indexed Tree (Fenwick Tree)
class BIT:
def __init__(self, n):
self.n = n
self.data = [0]*(n+1)
self.el = [0]*(n+1)
def sum(self, i):
s = 0
while i > 0:
s += self.data[i]
i -= i & -i
return s
def add(self, i, x):
... | # # Binary Indexed Tree (Fenwick Tree)
# class BIT:
# def __init__(self, n):
# self.n = n
# self.data = [0]*(n+1)
# self.el = [0]*(n+1)
# def sum(self, i):
# s = 0
# while i > 0:
# s += self.data[i]
# i -= i & -i
# return s
# ... | 34 | 46 | 791 | 1,027 | # Binary Indexed Tree (Fenwick Tree)
class BIT:
def __init__(self, n):
self.n = n
self.data = [0] * (n + 1)
self.el = [0] * (n + 1)
def sum(self, i):
s = 0
while i > 0:
s += self.data[i]
i -= i & -i
return s
def add(self, i, x):
... | # # Binary Indexed Tree (Fenwick Tree)
# class BIT:
# def __init__(self, n):
# self.n = n
# self.data = [0]*(n+1)
# self.el = [0]*(n+1)
# def sum(self, i):
# s = 0
# while i > 0:
# s += self.data[i]
# i -= i & -i
# return s
# def add(se... | false | 26.086957 | [
"-# Binary Indexed Tree (Fenwick Tree)",
"-class BIT:",
"- def __init__(self, n):",
"- self.n = n",
"- self.data = [0] * (n + 1)",
"- self.el = [0] * (n + 1)",
"-",
"- def sum(self, i):",
"- s = 0",
"- while i > 0:",
"- s += self.data[i]",
"-... | false | 0.06795 | 0.034859 | 1.949299 | [
"s647283844",
"s701062159"
] |
u102461423 | p02888 | python | s217232802 | s028825832 | 281 | 165 | 153,024 | 12,940 | Accepted | Accepted | 41.28 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# 長さじゃなくて、棒自体で区別してるやんけー!
import numpy as np
N = int(readline())
L = np.array(read().split(),np.int32)
L.sort()
U=1000
counter = np.bincount(L,minlength=U+U+10)
cum = counter.cumsum()
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
from numpy.fft import rfft,irfft
N = int(readline())
L = np.array(read().split(),np.int32)
fft_len = 2048
counter = np.bincount(L,minlength=1001)
add = (irfft(rfft(cou... | 24 | 27 | 460 | 567 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# 長さじゃなくて、棒自体で区別してるやんけー!
import numpy as np
N = int(readline())
L = np.array(read().split(), np.int32)
L.sort()
U = 1000
counter = np.bincount(L, minlength=U + U + 10)
cum = counter.cumsum()
add = L[:, ... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
from numpy.fft import rfft, irfft
N = int(readline())
L = np.array(read().split(), np.int32)
fft_len = 2048
counter = np.bincount(L, minlength=1001)
add = (irfft(rfft(counter, fft_len... | false | 11.111111 | [
"-# 長さじゃなくて、棒自体で区別してるやんけー!",
"+from numpy.fft import rfft, irfft",
"-L.sort()",
"-U = 1000",
"-counter = np.bincount(L, minlength=U + U + 10)",
"+fft_len = 2048",
"+counter = np.bincount(L, minlength=1001)",
"+add = (irfft(rfft(counter, fft_len) ** 2) + 0.5).astype(int)",
"+# 同じものを2回使うパターンを除外",
"+... | false | 0.247387 | 0.317918 | 0.778148 | [
"s217232802",
"s028825832"
] |
u239091426 | p02712 | python | s885718316 | s957869804 | 160 | 121 | 9,140 | 30,024 | Accepted | Accepted | 24.38 | n = int(eval(input()))
c = 0
for i in range(1,n+1):
if i%3 != 0 and i%5 != 0:
c += i
print(c) | n = int(eval(input()))
l = [i for i in range(1,n+1) if i%3 != 0 and i%5 != 0]
print((sum(l))) | 6 | 3 | 98 | 87 | n = int(eval(input()))
c = 0
for i in range(1, n + 1):
if i % 3 != 0 and i % 5 != 0:
c += i
print(c)
| n = int(eval(input()))
l = [i for i in range(1, n + 1) if i % 3 != 0 and i % 5 != 0]
print((sum(l)))
| false | 50 | [
"-c = 0",
"-for i in range(1, n + 1):",
"- if i % 3 != 0 and i % 5 != 0:",
"- c += i",
"-print(c)",
"+l = [i for i in range(1, n + 1) if i % 3 != 0 and i % 5 != 0]",
"+print((sum(l)))"
] | false | 0.109938 | 0.124186 | 0.885264 | [
"s885718316",
"s957869804"
] |
u647766105 | p00133 | python | s859738370 | s397760862 | 20 | 10 | 4,300 | 4,300 | Accepted | Accepted | 50 | from functools import reduce
T = lambda d:["".join(d) for d in zip(*d[::-1])]
D = [input() for _ in range(8)]
for i in range(1,4):
print(str(90*i))
print("\n".join(reduce(lambda a,b:b(a),[T]*i,D))) | from functools import reduce
T = lambda d:["".join(d) for d in zip(*d[::-1])]
D = [input() for _ in range(8)]
for i in range(1,4):
print(90*i)
print("\n".join(reduce(lambda a,b:b(a),[T]*i,D))) | 5 | 5 | 184 | 179 | from functools import reduce
T = lambda d: ["".join(d) for d in zip(*d[::-1])]
D = [input() for _ in range(8)]
for i in range(1, 4):
print(str(90 * i))
print("\n".join(reduce(lambda a, b: b(a), [T] * i, D)))
| from functools import reduce
T = lambda d: ["".join(d) for d in zip(*d[::-1])]
D = [input() for _ in range(8)]
for i in range(1, 4):
print(90 * i)
print("\n".join(reduce(lambda a, b: b(a), [T] * i, D)))
| false | 0 | [
"- print(str(90 * i))",
"+ print(90 * i)"
] | false | 0.046164 | 0.04596 | 1.004448 | [
"s859738370",
"s397760862"
] |
u150984829 | p02262 | python | s106177575 | s932722285 | 19,030 | 11,310 | 53,288 | 53,324 | Accepted | Accepted | 40.57 | import sys
n = int(input())
A = [int(e)for e in sys.stdin]
cnt = 0
G = [int((3**i-1)/2)for i in range(14,0,-1)]
G = [v for v in G if v <= n]
def insertionSort(A, n, g):
global cnt
for i in range(g, n):
v = A[i]
j = i - g
while j >= 0 and A[j] > v:
A[j+g] = A[j]
... | import sys
n = int(input())
A = [int(e)for e in sys.stdin]
cnt = 0
G = [int((2.0555**i-1)/1.0555)for i in range(19,0,-1)]+[1]
G = [v for v in G if v <= n]
def insertionSort(A, n, g):
global cnt
for i in range(g, n):
v = A[i]
j = i - g
while j >= 0 and A[j] > v:
A[... | 22 | 22 | 482 | 496 | import sys
n = int(input())
A = [int(e) for e in sys.stdin]
cnt = 0
G = [int((3**i - 1) / 2) for i in range(14, 0, -1)]
G = [v for v in G if v <= n]
def insertionSort(A, n, g):
global cnt
for i in range(g, n):
v = A[i]
j = i - g
while j >= 0 and A[j] > v:
A[j + g] = A[j]
... | import sys
n = int(input())
A = [int(e) for e in sys.stdin]
cnt = 0
G = [int((2.0555**i - 1) / 1.0555) for i in range(19, 0, -1)] + [1]
G = [v for v in G if v <= n]
def insertionSort(A, n, g):
global cnt
for i in range(g, n):
v = A[i]
j = i - g
while j >= 0 and A[j] > v:
A... | false | 0 | [
"-G = [int((3**i - 1) / 2) for i in range(14, 0, -1)]",
"+G = [int((2.0555**i - 1) / 1.0555) for i in range(19, 0, -1)] + [1]"
] | false | 0.038035 | 0.066333 | 0.573398 | [
"s106177575",
"s932722285"
] |
u546285759 | p00424 | python | s079438919 | s456190171 | 310 | 260 | 7,744 | 7,868 | Accepted | Accepted | 16.13 | while True:
x = int(eval(input()))
if x == 0:
break
dcl = {}
for i in range(x):
inp = list(map(str, input().split()))
dcl[inp[0]] = inp[1]
ans = ""
x = int(eval(input()))
for i in range(x):
y = str(input()[0])
if y in dcl:
ans ... | while True:
n = int(eval(input()))
if n == 0:
break
d = {}
for _ in range(n):
a, b = input().split()
d[a] = b
m = int(eval(input()))
ans = ""
for _ in range(m):
a = input().strip()
ans += d.get(a, a)
print(ans) | 17 | 14 | 370 | 283 | while True:
x = int(eval(input()))
if x == 0:
break
dcl = {}
for i in range(x):
inp = list(map(str, input().split()))
dcl[inp[0]] = inp[1]
ans = ""
x = int(eval(input()))
for i in range(x):
y = str(input()[0])
if y in dcl:
ans += dcl[y]
... | while True:
n = int(eval(input()))
if n == 0:
break
d = {}
for _ in range(n):
a, b = input().split()
d[a] = b
m = int(eval(input()))
ans = ""
for _ in range(m):
a = input().strip()
ans += d.get(a, a)
print(ans)
| false | 17.647059 | [
"- x = int(eval(input()))",
"- if x == 0:",
"+ n = int(eval(input()))",
"+ if n == 0:",
"- dcl = {}",
"- for i in range(x):",
"- inp = list(map(str, input().split()))",
"- dcl[inp[0]] = inp[1]",
"+ d = {}",
"+ for _ in range(n):",
"+ a, b = input().sp... | false | 0.036776 | 0.035702 | 1.030093 | [
"s079438919",
"s456190171"
] |
u222668979 | p03209 | python | s643344758 | s508044155 | 64 | 31 | 61,872 | 9,156 | Accepted | Accepted | 51.56 | n, x = list(map(int, input().split()))
pate, slice = [1], [1]
for _ in range(n+1):
pate.append(2 * pate[-1] + 1)
slice.append(2 * slice[-1] + 3)
ans = 0
while n >= 0 and x > 0:
if n == 0 and x > 0:
ans += 1
x -= 1
elif x >= slice[n - 1] + 2:
ans += pate[n - 1] + 1
... | n, x = list(map(int, input().split()))
pate, slice = [1], [1]
for _ in range(n + 1):
pate.append(2 * pate[-1] + 1)
slice.append(2 * slice[-1] + 3)
ans = 0
while n > 0 and x > 0:
if x >= slice[n - 1] + 2:
ans += pate[n - 1] + 1
x -= slice[n - 1] + 2
elif x < slice[n - 1] + 2... | 19 | 16 | 417 | 366 | n, x = list(map(int, input().split()))
pate, slice = [1], [1]
for _ in range(n + 1):
pate.append(2 * pate[-1] + 1)
slice.append(2 * slice[-1] + 3)
ans = 0
while n >= 0 and x > 0:
if n == 0 and x > 0:
ans += 1
x -= 1
elif x >= slice[n - 1] + 2:
ans += pate[n - 1] + 1
x -= ... | n, x = list(map(int, input().split()))
pate, slice = [1], [1]
for _ in range(n + 1):
pate.append(2 * pate[-1] + 1)
slice.append(2 * slice[-1] + 3)
ans = 0
while n > 0 and x > 0:
if x >= slice[n - 1] + 2:
ans += pate[n - 1] + 1
x -= slice[n - 1] + 2
elif x < slice[n - 1] + 2:
x -=... | false | 15.789474 | [
"-while n >= 0 and x > 0:",
"- if n == 0 and x > 0:",
"- ans += 1",
"- x -= 1",
"- elif x >= slice[n - 1] + 2:",
"+while n > 0 and x > 0:",
"+ if x >= slice[n - 1] + 2:",
"-print(ans)",
"+print((ans + (x > 0)))"
] | false | 0.042394 | 0.07862 | 0.53923 | [
"s643344758",
"s508044155"
] |
u990608646 | p02888 | python | s920516409 | s026009923 | 1,859 | 1,608 | 3,188 | 3,188 | Accepted | Accepted | 13.5 | import itertools
N = int(eval(input()))
L = list(map(int,input().split()))
# N = 2000
# L = list(range(N))
# # 重複を消す
# L = list(set(L))
# N = len(L)
# Lを小さい順にソート
L = sorted(L)
# j=0〜max(L)について,L[i]<jを満たす最大のi: X[j] = i
X = []
for j in range(L[-1]+1):
flag = False
for i in range(N-1,-1,-1)... | import itertools
import bisect
N = int(eval(input()))
L = list(map(int,input().split()))
# Lを小さい順にソート
L = sorted(L)
# a <= b <= cを仮定してもおk
# a,bを全探索し,条件を満たすcの数をO(N)未満の方法で求めればよい
ans = 0
for i in range(N-2):
a = L[i]
for j in range(i+1,N-1):
b = L[j]
# Lの中で条件b-a<c... | 74 | 28 | 1,440 | 542 | import itertools
N = int(eval(input()))
L = list(map(int, input().split()))
# N = 2000
# L = list(range(N))
# # 重複を消す
# L = list(set(L))
# N = len(L)
# Lを小さい順にソート
L = sorted(L)
# j=0〜max(L)について,L[i]<jを満たす最大のi: X[j] = i
X = []
for j in range(L[-1] + 1):
flag = False
for i in range(N - 1, -1, -1):
if L[i... | import itertools
import bisect
N = int(eval(input()))
L = list(map(int, input().split()))
# Lを小さい順にソート
L = sorted(L)
# a <= b <= cを仮定してもおk
# a,bを全探索し,条件を満たすcの数をO(N)未満の方法で求めればよい
ans = 0
for i in range(N - 2):
a = L[i]
for j in range(i + 1, N - 1):
b = L[j]
# Lの中で条件b-a<cを満たす最小のc
ind_cmin ... | false | 62.162162 | [
"+import bisect",
"-# N = 2000",
"-# L = list(range(N))",
"-# # 重複を消す",
"-# L = list(set(L))",
"-# N = len(L)",
"-# j=0〜max(L)について,L[i]<jを満たす最大のi: X[j] = i",
"-X = []",
"-for j in range(L[-1] + 1):",
"- flag = False",
"- for i in range(N - 1, -1, -1):",
"- if L[i] < j:",
"- ... | false | 0.107272 | 0.070456 | 1.52254 | [
"s920516409",
"s026009923"
] |
u359358631 | p02578 | python | s734684387 | s252861152 | 101 | 82 | 32,232 | 32,376 | Accepted | Accepted | 18.81 | def main():
N = int(eval(input()))
A = list(map(int, input().split()))
h = A[0]
ans = 0
for i in range(N):
if A[i] < h:
ans += h - A[i]
if A[i] > h:
h = A[i]
print(ans)
if __name__ == "__main__":
main()
| def main():
N = int(eval(input()))
A = list(map(int, input().split()))
tallest = A[0]
ans = 0
for height in A:
if height < tallest:
ans += tallest - height
elif height > tallest:
tallest = height
print(ans)
if __name__ == "__main__":
... | 17 | 18 | 285 | 325 | def main():
N = int(eval(input()))
A = list(map(int, input().split()))
h = A[0]
ans = 0
for i in range(N):
if A[i] < h:
ans += h - A[i]
if A[i] > h:
h = A[i]
print(ans)
if __name__ == "__main__":
main()
| def main():
N = int(eval(input()))
A = list(map(int, input().split()))
tallest = A[0]
ans = 0
for height in A:
if height < tallest:
ans += tallest - height
elif height > tallest:
tallest = height
print(ans)
if __name__ == "__main__":
main()
| false | 5.555556 | [
"- h = A[0]",
"+ tallest = A[0]",
"- for i in range(N):",
"- if A[i] < h:",
"- ans += h - A[i]",
"- if A[i] > h:",
"- h = A[i]",
"+ for height in A:",
"+ if height < tallest:",
"+ ans += tallest - height",
"+ elif height > ... | false | 0.038742 | 0.039287 | 0.986131 | [
"s734684387",
"s252861152"
] |
u965436898 | p03161 | python | s950183306 | s743401971 | 1,805 | 414 | 21,968 | 55,264 | Accepted | Accepted | 77.06 | import numpy as np
n,k = list(map(int,input().split()))
field = np.array(input().split(),np.int64)
dp = np.zeros(n,np.int64)
# numpyのブロードキャストとスライスを組み合わせることで1重のfor文で済ますという変態的なことをしてる
# ただ計算量がO(N)になっているかは謎
for i in range(1,n):
left = max(0,i - k)
dp[i] = (dp[left:i] + abs(field[left:i] - field[i])).min()
prin... | n,k = list(map(int,input().split()))
field = list(map(int,input().split()))
dp = [float("inf")]*len(field)
dp[0] = 0
for i in range(0,n - 1):
for j in range(1,k + 1):
if i + j < n:
dp[i + j] = min(dp[i + j],dp[i] + abs(field[i + j] - field[i]))
print((dp[-1]))
| 10 | 9 | 323 | 273 | import numpy as np
n, k = list(map(int, input().split()))
field = np.array(input().split(), np.int64)
dp = np.zeros(n, np.int64)
# numpyのブロードキャストとスライスを組み合わせることで1重のfor文で済ますという変態的なことをしてる
# ただ計算量がO(N)になっているかは謎
for i in range(1, n):
left = max(0, i - k)
dp[i] = (dp[left:i] + abs(field[left:i] - field[i])).min()
pr... | n, k = list(map(int, input().split()))
field = list(map(int, input().split()))
dp = [float("inf")] * len(field)
dp[0] = 0
for i in range(0, n - 1):
for j in range(1, k + 1):
if i + j < n:
dp[i + j] = min(dp[i + j], dp[i] + abs(field[i + j] - field[i]))
print((dp[-1]))
| false | 10 | [
"-import numpy as np",
"-",
"-field = np.array(input().split(), np.int64)",
"-dp = np.zeros(n, np.int64)",
"-# numpyのブロードキャストとスライスを組み合わせることで1重のfor文で済ますという変態的なことをしてる",
"-# ただ計算量がO(N)になっているかは謎",
"-for i in range(1, n):",
"- left = max(0, i - k)",
"- dp[i] = (dp[left:i] + abs(field[left:i] - fiel... | false | 0.341289 | 0.045343 | 7.526778 | [
"s950183306",
"s743401971"
] |
u492026192 | p02949 | python | s513614275 | s151807272 | 843 | 754 | 50,412 | 49,772 | Accepted | Accepted | 10.56 | """解説を見てから解いたコード"""
N, M, P = list(map(int, input().split()))
edges = []
for _ in range(M):
a, b, c = list(map(int, input().split()))
edges.append((a, b, c-P))
INF = float('inf')
coin_map = [-INF] * (N+1)
coin_map[1] = 0
for i in range(2*N):
for a, b, c in edges:
if coin_map[b] < co... | n,m,p=list(map(int,input().split()))
A=[]
for i in range(m):
a,b,c=list(map(int,input().split()))
A.append((a,b,c-p))
def BellmanFord(edges,num_v,source):
#グラフの初期化
inf=float("inf")
dist=[-inf for i in range(num_v)]
dist[source-1]=0
#辺の緩和
buf=0
for i in range(num_v*2... | 28 | 28 | 558 | 704 | """解説を見てから解いたコード"""
N, M, P = list(map(int, input().split()))
edges = []
for _ in range(M):
a, b, c = list(map(int, input().split()))
edges.append((a, b, c - P))
INF = float("inf")
coin_map = [-INF] * (N + 1)
coin_map[1] = 0
for i in range(2 * N):
for a, b, c in edges:
if coin_map[b] < coin_map[a] +... | n, m, p = list(map(int, input().split()))
A = []
for i in range(m):
a, b, c = list(map(int, input().split()))
A.append((a, b, c - p))
def BellmanFord(edges, num_v, source):
# グラフの初期化
inf = float("inf")
dist = [-inf for i in range(num_v)]
dist[source - 1] = 0
# 辺の緩和
buf = 0
for i in... | false | 0 | [
"-\"\"\"解説を見てから解いたコード\"\"\"",
"-N, M, P = list(map(int, input().split()))",
"-edges = []",
"-for _ in range(M):",
"+n, m, p = list(map(int, input().split()))",
"+A = []",
"+for i in range(m):",
"- edges.append((a, b, c - P))",
"-INF = float(\"inf\")",
"-coin_map = [-INF] * (N + 1)",
"-coin_ma... | false | 0.03768 | 0.041389 | 0.910391 | [
"s513614275",
"s151807272"
] |
u083960235 | p02726 | python | s658172218 | s669358841 | 1,711 | 668 | 121,368 | 75,736 | Accepted | Accepted | 60.96 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | 60 | 49 | 1,615 | 1,300 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | false | 18.333333 | [
"-from heapq import heappop, heappush, heapify",
"-",
"-",
"-def dijkstra(E, start):",
"- N_d = len(E)",
"- dist = [INF] * N_d",
"- dist[start] = 0",
"- q = [(0, start)]",
"+N, X, Y = MAP()",
"+graph = [[] for i in range(N)]",
"+for i in range(N - 1):",
"+ graph[i].append(i + 1)... | false | 0.131548 | 0.044119 | 2.981685 | [
"s658172218",
"s669358841"
] |
u562935282 | p02646 | python | s647296608 | s017400253 | 23 | 21 | 9,184 | 9,172 | Accepted | Accepted | 8.7 | def main():
A, V = list(map(int, input().split()))
B, W = list(map(int, input().split()))
T = int(eval(input()))
if A == B:
print('YES')
return
d = abs(A - B)
dv = V - W
if d <= dv * T:
print('YES')
else:
print('NO')
return
if _... | def main():
A, V = list(map(int, input().split()))
B, W = list(map(int, input().split()))
T = int(eval(input()))
d = abs(A - B)
s = V - W
print(('YES' if T * s >= d else 'NO'))
if __name__ == '__main__':
main()
| 38 | 12 | 686 | 233 | def main():
A, V = list(map(int, input().split()))
B, W = list(map(int, input().split()))
T = int(eval(input()))
if A == B:
print("YES")
return
d = abs(A - B)
dv = V - W
if d <= dv * T:
print("YES")
else:
print("NO")
return
if __name__ == "__main__":... | def main():
A, V = list(map(int, input().split()))
B, W = list(map(int, input().split()))
T = int(eval(input()))
d = abs(A - B)
s = V - W
print(("YES" if T * s >= d else "NO"))
if __name__ == "__main__":
main()
| false | 68.421053 | [
"- if A == B:",
"- print(\"YES\")",
"- return",
"- dv = V - W",
"- if d <= dv * T:",
"- print(\"YES\")",
"- else:",
"- print(\"NO\")",
"- return",
"+ s = V - W",
"+ print((\"YES\" if T * s >= d else \"NO\"))",
"-# import sys",
"-# input = sys.... | false | 0.06702 | 0.035554 | 1.885041 | [
"s647296608",
"s017400253"
] |
u893063840 | p02955 | python | s732892869 | s825118170 | 280 | 225 | 3,192 | 3,064 | Accepted | Accepted | 19.64 | from math import sqrt
from itertools import accumulate
def common_divisors(x):
ret = []
for i in range(1, int(sqrt(x)) + 1):
if x % i == 0:
ret.append(i)
ret.append(x // i)
return ret
n, k = list(map(int, input().split()))
a = list(map(int, input().split()... | def get_divisors(x):
i = 1
ret = set()
while i * i <= x:
if x % i == 0:
ret.add(i)
ret.add(x // i)
i += 1
return ret
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
sm = sum(a)
divs = get_divisors(sm)
ans = 0
fo... | 32 | 34 | 662 | 597 | from math import sqrt
from itertools import accumulate
def common_divisors(x):
ret = []
for i in range(1, int(sqrt(x)) + 1):
if x % i == 0:
ret.append(i)
ret.append(x // i)
return ret
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
sm = sum(a)
c... | def get_divisors(x):
i = 1
ret = set()
while i * i <= x:
if x % i == 0:
ret.add(i)
ret.add(x // i)
i += 1
return ret
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
sm = sum(a)
divs = get_divisors(sm)
ans = 0
for div in divs:
mods ... | false | 5.882353 | [
"-from math import sqrt",
"-from itertools import accumulate",
"-",
"-",
"-def common_divisors(x):",
"- ret = []",
"- for i in range(1, int(sqrt(x)) + 1):",
"+def get_divisors(x):",
"+ i = 1",
"+ ret = set()",
"+ while i * i <= x:",
"- ret.append(i)",
"- ... | false | 0.037295 | 0.037271 | 1.000643 | [
"s732892869",
"s825118170"
] |
u223133214 | p03846 | python | s219404797 | s265766881 | 107 | 96 | 13,876 | 13,876 | Accepted | Accepted | 10.28 | from math import ceil
import sys
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
if N % 2 == 1:
num = (N - 1) // 2
if A[0] != 0:
print((0))
exit()
for i in range(1, N):
if A[i] == ceil(i / 2) * 2:
continue
... | from math import ceil
import sys
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
if N % 2 == 1:
num = (N - 1) // 2
if A[0] != 0:
print((0))
exit()
for i in range(1, N):
if A[i] == ceil(i / 2) * 2:
continue
... | 33 | 29 | 620 | 570 | from math import ceil
import sys
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
if N % 2 == 1:
num = (N - 1) // 2
if A[0] != 0:
print((0))
exit()
for i in range(1, N):
if A[i] == ceil(i / 2) * 2:
continue
else:
... | from math import ceil
import sys
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
if N % 2 == 1:
num = (N - 1) // 2
if A[0] != 0:
print((0))
exit()
for i in range(1, N):
if A[i] == ceil(i / 2) * 2:
continue
else:
... | false | 12.121212 | [
"-ans = 1",
"-for i in range(num):",
"- ans *= 2",
"- ans %= 10**9 + 7",
"-print(ans)",
"+print(((2**num) % (10**9 + 7)))"
] | false | 0.048737 | 0.048394 | 1.007095 | [
"s219404797",
"s265766881"
] |
u141419468 | p02689 | python | s370152803 | s844366387 | 309 | 252 | 27,756 | 20,060 | Accepted | Accepted | 18.45 | import collections
N, M = list(map(int,input().split()))
H = list(map(int,input().split()))
a = []
b = []
loser = []
for i in range(M):
A, B = list(map(int, input().split()))
a.append(A)
b.append(B)
if H[a[i]-1] > H[b[i]-1]:
loser.append(b[i])
elif H[a[i]-1] == H[b[i]-1]:... | N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
win = [1]*N
for _ in range(M):
A, B = list(map(int, input().split()))
if H[A-1] > H[B-1]:
win[B-1] = 0
elif H[A-1] < H[B-1]:
win[A-1] = 0
else:
win[A-1] = 0
win[B-1] = 0
print((sum... | 25 | 15 | 478 | 313 | import collections
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
a = []
b = []
loser = []
for i in range(M):
A, B = list(map(int, input().split()))
a.append(A)
b.append(B)
if H[a[i] - 1] > H[b[i] - 1]:
loser.append(b[i])
elif H[a[i] - 1] == H[b[i] - 1]:
... | N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
win = [1] * N
for _ in range(M):
A, B = list(map(int, input().split()))
if H[A - 1] > H[B - 1]:
win[B - 1] = 0
elif H[A - 1] < H[B - 1]:
win[A - 1] = 0
else:
win[A - 1] = 0
win[B - 1] = 0
print((su... | false | 40 | [
"-import collections",
"-",
"-a = []",
"-b = []",
"-loser = []",
"-for i in range(M):",
"+win = [1] * N",
"+for _ in range(M):",
"- a.append(A)",
"- b.append(B)",
"- if H[a[i] - 1] > H[b[i] - 1]:",
"- loser.append(b[i])",
"- elif H[a[i] - 1] == H[b[i] - 1]:",
"- l... | false | 0.042488 | 0.04356 | 0.975381 | [
"s370152803",
"s844366387"
] |
u189487046 | p03624 | python | s089849342 | s386846750 | 60 | 20 | 4,208 | 3,956 | Accepted | Accepted | 66.67 | ALPHABET = "abcdefghijklmnopqrstuvwxyz"
s = list(eval(input()))
s.sort()
for i in ALPHABET:
if i not in s:
print(i)
break
else:
print("None")
| ALPHABET = "abcdefghijklmnopqrstuvwxyz"
s = list(eval(input()))
for i in ALPHABET:
if i not in s:
print(i)
break
else:
print("None")
| 10 | 9 | 170 | 160 | ALPHABET = "abcdefghijklmnopqrstuvwxyz"
s = list(eval(input()))
s.sort()
for i in ALPHABET:
if i not in s:
print(i)
break
else:
print("None")
| ALPHABET = "abcdefghijklmnopqrstuvwxyz"
s = list(eval(input()))
for i in ALPHABET:
if i not in s:
print(i)
break
else:
print("None")
| false | 10 | [
"-s.sort()"
] | false | 0.039914 | 0.044332 | 0.900343 | [
"s089849342",
"s386846750"
] |
u580258754 | p03013 | python | s252648436 | s500533831 | 478 | 187 | 460,056 | 13,216 | Accepted | Accepted | 60.88 | N, M = list(map(int,input().split()))
a = set([int(eval(input())) for i in range(M)])
dp = [0 for i in range(N+1)]
dp[0] = 1
dp[1] = 1
for i in range(2,N+1):
if (i-2 in a) and (i-1 in a):
dp[-1] = 0
break
elif i-2 in a:
dp[i] = dp[i-1]
elif i-1 in a:
dp[i] = dp[i-2]
else:
dp[i]... | N,M = list(map(int,input().split()))
a = [int(eval(input())) for i in range(M)]
a = set(a)
dp = [0]*(N+100)
for i in range(N+1):
if i == 0:
dp[i] = 1
continue
if i in a:
continue
elif i-1 in a:
dp[i] = dp[i-2]
elif i-2 in a:
dp[i] = dp[i-1]
elif i-1 in a and i-2 in a:
... | 17 | 22 | 355 | 410 | N, M = list(map(int, input().split()))
a = set([int(eval(input())) for i in range(M)])
dp = [0 for i in range(N + 1)]
dp[0] = 1
dp[1] = 1
for i in range(2, N + 1):
if (i - 2 in a) and (i - 1 in a):
dp[-1] = 0
break
elif i - 2 in a:
dp[i] = dp[i - 1]
elif i - 1 in a:
dp[i] = d... | N, M = list(map(int, input().split()))
a = [int(eval(input())) for i in range(M)]
a = set(a)
dp = [0] * (N + 100)
for i in range(N + 1):
if i == 0:
dp[i] = 1
continue
if i in a:
continue
elif i - 1 in a:
dp[i] = dp[i - 2]
elif i - 2 in a:
dp[i] = dp[i - 1]
eli... | false | 22.727273 | [
"-a = set([int(eval(input())) for i in range(M)])",
"-dp = [0 for i in range(N + 1)]",
"-dp[0] = 1",
"-dp[1] = 1",
"-for i in range(2, N + 1):",
"- if (i - 2 in a) and (i - 1 in a):",
"- dp[-1] = 0",
"- break",
"+a = [int(eval(input())) for i in range(M)]",
"+a = set(a)",
"+dp =... | false | 0.036774 | 0.036548 | 1.006178 | [
"s252648436",
"s500533831"
] |
u029000441 | p04031 | python | s214312169 | s092367134 | 29 | 22 | 3,316 | 3,316 | Accepted | Accepted | 24.14 | 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... | 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... | 31 | 30 | 916 | 916 | 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... | 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 | 3.225806 | [
"-mn = inf",
"-for i in range(-100, 100 + 1):",
"- sm = 0",
"- for s in lis:",
"- sm += (s - i) ** 2",
"- if sm < mn:",
"- mn = sm",
"-print(mn)",
"+U, V = 0, 0",
"+u = ceil(sum(lis) / n)",
"+v = int(sum(lis) / n)",
"+for i in range(n):",
"+ U += (lis[i] - u) ** 2",... | false | 0.04052 | 0.037985 | 1.066735 | [
"s214312169",
"s092367134"
] |
u912237403 | p00038 | python | s752541984 | s911093993 | 20 | 10 | 4,304 | 4,240 | Accepted | Accepted | 50 | def readdata():
x = []
try:
while True:
x.append(list(map(int,input().split(","))))
except: return x
def checkhand2(hand):
tmp = [(e+11)%13 for e in hand]
x1=sorted(list(set(tmp)))
x2=[]
for e in x1:
x2.append(tmp.count(e))
return x1,x2
def is... | prize=["null","one pair","two pair","three card",
"straight","full house","four card"]
try:
while True:
hand = list(map(int,input().split(",")))
x = sorted(list(set(hand)))
a = len(x)
b = max([hand.count(e) for e in x])
if b==4: p=6
elif b==3:
... | 42 | 23 | 1,014 | 597 | def readdata():
x = []
try:
while True:
x.append(list(map(int, input().split(","))))
except:
return x
def checkhand2(hand):
tmp = [(e + 11) % 13 for e in hand]
x1 = sorted(list(set(tmp)))
x2 = []
for e in x1:
x2.append(tmp.count(e))
return x1, x2
d... | prize = [
"null",
"one pair",
"two pair",
"three card",
"straight",
"full house",
"four card",
]
try:
while True:
hand = list(map(int, input().split(",")))
x = sorted(list(set(hand)))
a = len(x)
b = max([hand.count(e) for e in x])
if b == 4:
... | false | 45.238095 | [
"-def readdata():",
"- x = []",
"- try:",
"- while True:",
"- x.append(list(map(int, input().split(\",\"))))",
"- except:",
"- return x",
"-",
"-",
"-def checkhand2(hand):",
"- tmp = [(e + 11) % 13 for e in hand]",
"- x1 = sorted(list(set(tmp)))",
"- ... | false | 0.041628 | 0.048608 | 0.856414 | [
"s752541984",
"s911093993"
] |
u647766105 | p00117 | python | s630584849 | s497905380 | 20 | 10 | 4,504 | 4,508 | Accepted | Accepted | 50 | import heapq
def dijkstra(start,goal,graph):
INF = 2 << 20
node_num = len(graph)
visited = [False] * node_num
costs = [INF] * node_num
pq = []
costs[start] = 0
heapq.heappush(pq, [0,start])
while not len(pq) == 0:
cur_cost,cur_node = heapq.heappop(pq)
if v... | import heapq
def dijkstra(start,goal,graph):
INF = 2 << 20
node_num = len(graph)
visited = [False] * node_num
costs = [INF] * node_num
pq = []
costs[start] = 0
heapq.heappush(pq, [0,start])
while not len(pq) == 0:
cur_cost,cur_node = heapq.heappop(pq)
if v... | 35 | 33 | 995 | 946 | import heapq
def dijkstra(start, goal, graph):
INF = 2 << 20
node_num = len(graph)
visited = [False] * node_num
costs = [INF] * node_num
pq = []
costs[start] = 0
heapq.heappush(pq, [0, start])
while not len(pq) == 0:
cur_cost, cur_node = heapq.heappop(pq)
if visited[cur... | import heapq
def dijkstra(start, goal, graph):
INF = 2 << 20
node_num = len(graph)
visited = [False] * node_num
costs = [INF] * node_num
pq = []
costs[start] = 0
heapq.heappush(pq, [0, start])
while not len(pq) == 0:
cur_cost, cur_node = heapq.heappop(pq)
if visited[cur... | false | 5.714286 | [
"- if all(visited[1:]):",
"- break"
] | false | 0.047596 | 0.085667 | 0.555596 | [
"s630584849",
"s497905380"
] |
u033606236 | p03409 | python | s419241965 | s099942388 | 174 | 19 | 39,152 | 3,064 | Accepted | Accepted | 89.08 | n = int(eval(input()))
red = [list(map(int,input().split())) for _ in range(n)]
blue = [list(map(int,input().split())) for _ in range(n)]
blue.sort(key=lambda x:(x[0],x[1]))
check = [False]*n
for i in range(n):
a = -1
c = -1
for j in range(n):
if check[j]:continue
if blue[i][0] > r... | n = int(eval(input()))
red = [list(map(int,input().split())) for _ in range(n)]
red.sort(key=lambda x:(x[1]))
blue = sorted(list(map(int,input().split())) for _ in range(n))
blue.sort(key=lambda x:(x[0],x[1]))
seen = [False]*n
for i in range(n):
check = -1
for j in range(n):
if seen[j]:continue... | 17 | 14 | 503 | 464 | n = int(eval(input()))
red = [list(map(int, input().split())) for _ in range(n)]
blue = [list(map(int, input().split())) for _ in range(n)]
blue.sort(key=lambda x: (x[0], x[1]))
check = [False] * n
for i in range(n):
a = -1
c = -1
for j in range(n):
if check[j]:
continue
if blue[... | n = int(eval(input()))
red = [list(map(int, input().split())) for _ in range(n)]
red.sort(key=lambda x: (x[1]))
blue = sorted(list(map(int, input().split())) for _ in range(n))
blue.sort(key=lambda x: (x[0], x[1]))
seen = [False] * n
for i in range(n):
check = -1
for j in range(n):
if seen[j]:
... | false | 17.647059 | [
"-blue = [list(map(int, input().split())) for _ in range(n)]",
"+red.sort(key=lambda x: (x[1]))",
"+blue = sorted(list(map(int, input().split())) for _ in range(n))",
"-check = [False] * n",
"+seen = [False] * n",
"- a = -1",
"- c = -1",
"+ check = -1",
"- if check[j]:",
"+ ... | false | 0.047254 | 0.038387 | 1.230974 | [
"s419241965",
"s099942388"
] |
u761529120 | p02960 | python | s060754657 | s393384008 | 651 | 414 | 61,916 | 101,420 | Accepted | Accepted | 36.41 | def main():
S = eval(input())
N = len(S)
MOD = 10 ** 9 + 7
dp = [[0] * 13 for _ in range(N + 5)]
dp[0][0] = 1
for i in range(N):
if S[i] != '?':
for j in range(13):
dp[i+1][(j * 10 + int(S[i]))%13] += dp[i][j]
dp[i+1][(j * 10 + int(... | def main():
S = list(eval(input()))
N = len(S)
MOD = 10 ** 9 + 7
dp = [[0] * 13 for _ in range(N + 5)]
dp[0][0] = 1
for i in range(N):
for j in range(13):
if S[i] != '?':
dp[i+1][(10 * j + int(S[i])) % 13] += dp[i][j]
dp[i+1][(10 * j ... | 24 | 20 | 600 | 575 | def main():
S = eval(input())
N = len(S)
MOD = 10**9 + 7
dp = [[0] * 13 for _ in range(N + 5)]
dp[0][0] = 1
for i in range(N):
if S[i] != "?":
for j in range(13):
dp[i + 1][(j * 10 + int(S[i])) % 13] += dp[i][j]
dp[i + 1][(j * 10 + int(S[i])) %... | def main():
S = list(eval(input()))
N = len(S)
MOD = 10**9 + 7
dp = [[0] * 13 for _ in range(N + 5)]
dp[0][0] = 1
for i in range(N):
for j in range(13):
if S[i] != "?":
dp[i + 1][(10 * j + int(S[i])) % 13] += dp[i][j]
dp[i + 1][(10 * j + int(S[... | false | 16.666667 | [
"- S = eval(input())",
"+ S = list(eval(input()))",
"- if S[i] != \"?\":",
"- for j in range(13):",
"- dp[i + 1][(j * 10 + int(S[i])) % 13] += dp[i][j]",
"- dp[i + 1][(j * 10 + int(S[i])) % 13] %= MOD",
"- else:",
"- for k in rang... | false | 0.038777 | 0.045486 | 0.852499 | [
"s060754657",
"s393384008"
] |
u899975427 | p03475 | python | s717838002 | s550450246 | 116 | 86 | 3,188 | 3,064 | Accepted | Accepted | 25.86 | import sys
input = sys.stdin.readline
n = int(eval(input()))
csfn = [() for i in range(n-1)]
tl = [0]*n
for i in range(n-1):
c,s,f = list(map(int,input().split()))
csfn[i] += (c,s,f)
for j in range(i+1):
if tl[j] < csfn[i][1]:
tl[j] = csfn[i][1] + csfn[i][0]
elif tl[j] % csfn[i][2] ... | import sys
input = sys.stdin.readline
n = int(eval(input()))
tl = [0]*n
for i in range(n-1):
c,s,f = list(map(int,input().split()))
for j in range(i+1):
if tl[j] < s:
tl[j] = s + c
elif tl[j] % f == 0:
tl[j] += c
else:
tl[j] += c + f - tl[j] % f
for k in tl:
print(k... | 19 | 16 | 440 | 309 | import sys
input = sys.stdin.readline
n = int(eval(input()))
csfn = [() for i in range(n - 1)]
tl = [0] * n
for i in range(n - 1):
c, s, f = list(map(int, input().split()))
csfn[i] += (c, s, f)
for j in range(i + 1):
if tl[j] < csfn[i][1]:
tl[j] = csfn[i][1] + csfn[i][0]
elif tl... | import sys
input = sys.stdin.readline
n = int(eval(input()))
tl = [0] * n
for i in range(n - 1):
c, s, f = list(map(int, input().split()))
for j in range(i + 1):
if tl[j] < s:
tl[j] = s + c
elif tl[j] % f == 0:
tl[j] += c
else:
tl[j] += c + f - tl[j] ... | false | 15.789474 | [
"-csfn = [() for i in range(n - 1)]",
"- csfn[i] += (c, s, f)",
"- if tl[j] < csfn[i][1]:",
"- tl[j] = csfn[i][1] + csfn[i][0]",
"- elif tl[j] % csfn[i][2] == 0:",
"- tl[j] += csfn[i][0]",
"+ if tl[j] < s:",
"+ tl[j] = s + c",
"+ elif t... | false | 0.156925 | 0.040839 | 3.842545 | [
"s717838002",
"s550450246"
] |
u029000441 | p03575 | python | s763740636 | s830377672 | 578 | 322 | 78,680 | 55,512 | Accepted | Accepted | 44.29 | #dpでできないかな?
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,... | #dpでできないかな?
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,... | 51 | 51 | 1,359 | 1,357 | # dpでできないかな?
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, heap... | # dpでできないかな?
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, heap... | false | 0 | [
"- if sum(al) == 0:",
"+ if not -1 in al:"
] | false | 0.048951 | 0.050135 | 0.976382 | [
"s763740636",
"s830377672"
] |
u193453446 | p02258 | python | s139635397 | s233601230 | 500 | 450 | 15,616 | 7,768 | Accepted | Accepted | 10 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
?????§?????????
FX????????§????????°?????????????????¨????????????????????¨??§????????????????????????????????¨?????§????????????
????????°????????????100???????????? 1000???????????????????????????????????? 1?????? 108???????????£??????????£??????¨???
(108??? ???... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
?????§?????????
FX????????§????????°?????????????????¨????????????????????¨??§????????????????????????????????¨?????§????????????
????????°????????????100???????????? 1000???????????????????????????????????? 1?????? 108???????????£??????????£??????¨???
(108??? ???... | 30 | 28 | 956 | 871 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
?????§?????????
FX????????§????????°?????????????????¨????????????????????¨??§????????????????????????????????¨?????§????????????
????????°????????????100???????????? 1000???????????????????????????????????? 1?????? 108???????????£??????????£??????¨???
(108??? ?????? 10... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
?????§?????????
FX????????§????????°?????????????????¨????????????????????¨??§????????????????????????????????¨?????§????????????
????????°????????????100???????????? 1000???????????????????????????????????? 1?????? 108???????????£??????????£??????¨???
(108??? ?????? 10... | false | 6.666667 | [
"+cnt = -1000000000",
"-a = []",
"-for i in range(n):",
"- a.append(int(input().strip()))",
"-min = a[0]",
"-cnt = -1000000000",
"-for j in range(1, n):",
"- x = a[j] - min",
"+min = int(input().strip())",
"+for i in range(1, n):",
"+ a = int(input().strip())",
"+ x = a - min",
"... | false | 0.04476 | 0.043596 | 1.026713 | [
"s139635397",
"s233601230"
] |
u729133443 | p02904 | python | s806557271 | s750802025 | 808 | 636 | 106,920 | 121,148 | Accepted | Accepted | 21.29 | from subprocess import*
call(('pypy3','-c',"""
def main():
def update(k,x):
k+=N0-1
data_min[k]=data_max[k]=x
while k>=0:
k=(k-1)//2
a,b=data_min[2*k+1],data_min[2*k+2]
data_min[k]=a if a<b else b
a,b=data_max[2*k+1],data_max[2*k+2]
data_max[k]=a if a>b else b
d... | class SWAG():
def __init__(self,unit,f):
self.fold_r=[unit]
self.fold_l=[unit]
self.data_r=[]
self.data_l=[]
self.f=f
def __refill_right(self):
temp=[]
n=len(self.data_l)
for _ in range(n//2):
temp.append(self.popleft())
... | 58 | 60 | 1,256 | 1,792 | from subprocess import *
call(
(
"pypy3",
"-c",
"""
def main():
def update(k,x):
k+=N0-1
data_min[k]=data_max[k]=x
while k>=0:
k=(k-1)//2
a,b=data_min[2*k+1],data_min[2*k+2]
data_min[k]=a if a<b else b
a,b=data_max[2*k+1],data_max[2*k+2]
data_max[... | class SWAG:
def __init__(self, unit, f):
self.fold_r = [unit]
self.fold_l = [unit]
self.data_r = []
self.data_l = []
self.f = f
def __refill_right(self):
temp = []
n = len(self.data_l)
for _ in range(n // 2):
temp.append(self.popleft()... | false | 3.333333 | [
"-from subprocess import *",
"+class SWAG:",
"+ def __init__(self, unit, f):",
"+ self.fold_r = [unit]",
"+ self.fold_l = [unit]",
"+ self.data_r = []",
"+ self.data_l = []",
"+ self.f = f",
"-call(",
"- (",
"- \"pypy3\",",
"- \"-c\",",
... | false | 0.062182 | 0.048088 | 1.293081 | [
"s806557271",
"s750802025"
] |
u219417113 | p03162 | python | s650932856 | s717767029 | 658 | 392 | 74,584 | 70,492 | Accepted | Accepted | 40.43 | n = int(eval(input()))
abc = [tuple(map(int, input().split())) for _ in range(n)]
dp = [[0] * 3 for _ in range(n)]
dp[0][0] = abc[0][0]
dp[0][1] = abc[0][1]
dp[0][2] = abc[0][2]
for i in range(1, n):
for j in range(3):
for k in range(3):
if j != k:
dp[i][j] = max(dp... | import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
abc = [tuple(map(int, input().split())) for _ in range(N)]
dp = [[0] * 3 for _ in range(N+1)]
for i in range(3):
dp[0][i] = 0
for i in range(1, N+1):
for today in range(3):
for yesterday ... | 15 | 21 | 369 | 611 | n = int(eval(input()))
abc = [tuple(map(int, input().split())) for _ in range(n)]
dp = [[0] * 3 for _ in range(n)]
dp[0][0] = abc[0][0]
dp[0][1] = abc[0][1]
dp[0][2] = abc[0][2]
for i in range(1, n):
for j in range(3):
for k in range(3):
if j != k:
dp[i][j] = max(dp[i][j], dp[i -... | import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
abc = [tuple(map(int, input().split())) for _ in range(N)]
dp = [[0] * 3 for _ in range(N + 1)]
for i in range(3):
dp[0][i] = 0
for i in range(1, N + 1):
for today in range(3):
for yesterday in ra... | false | 28.571429 | [
"-n = int(eval(input()))",
"-abc = [tuple(map(int, input().split())) for _ in range(n)]",
"-dp = [[0] * 3 for _ in range(n)]",
"-dp[0][0] = abc[0][0]",
"-dp[0][1] = abc[0][1]",
"-dp[0][2] = abc[0][2]",
"-for i in range(1, n):",
"- for j in range(3):",
"- for k in range(3):",
"- ... | false | 0.077162 | 0.077225 | 0.999191 | [
"s650932856",
"s717767029"
] |
u197300773 | p02937 | python | s846467922 | s217805027 | 306 | 277 | 74,256 | 75,868 | Accepted | Accepted | 9.48 | import sys
s=eval(input())
t=eval(input())
l=len(s)
d={}
for i in range(26):
d[chr(ord("a")+i)]=i
ref=[[] for _ in range(26)]
for i in range(l):
ref[d[s[i]]].append(i)
for i in range(26):
if ref[i]==[]: ref[i].append(-1)
tmp=[0 for i in range(26)]
next=[[-1]*26 for i in range(l)]
for i in ... | import sys
s=eval(input())
ss=s+s
t=eval(input())
l=len(s)
d={}
for i in range(26):
d[chr(ord("a")+i)]=i
ref=[[] for _ in range(26)]
for i in range(2*l):
ref[d[ss[i]]].append(i)
for i in range(26):
if ref[i]==[]: ref[i].append(-1)
tmp=[0 for i in range(26)]
next=[[-1]*26 for i in range(l)]... | 34 | 33 | 641 | 604 | import sys
s = eval(input())
t = eval(input())
l = len(s)
d = {}
for i in range(26):
d[chr(ord("a") + i)] = i
ref = [[] for _ in range(26)]
for i in range(l):
ref[d[s[i]]].append(i)
for i in range(26):
if ref[i] == []:
ref[i].append(-1)
tmp = [0 for i in range(26)]
next = [[-1] * 26 for i in range(... | import sys
s = eval(input())
ss = s + s
t = eval(input())
l = len(s)
d = {}
for i in range(26):
d[chr(ord("a") + i)] = i
ref = [[] for _ in range(26)]
for i in range(2 * l):
ref[d[ss[i]]].append(i)
for i in range(26):
if ref[i] == []:
ref[i].append(-1)
tmp = [0 for i in range(26)]
next = [[-1] * 26... | false | 2.941176 | [
"+ss = s + s",
"-for i in range(l):",
"- ref[d[s[i]]].append(i)",
"+for i in range(2 * l):",
"+ ref[d[ss[i]]].append(i)",
"- x = d[s[i]]",
"- tmp[x] = (tmp[x] + 1) % len(ref[x])",
"+ tmp[d[s[i]]] += 1",
"-ans = p",
"+ans = p",
"- if p >= q:",
"- ans += l",
"- p = ... | false | 0.047062 | 0.047826 | 0.98402 | [
"s846467922",
"s217805027"
] |
u498487134 | p02813 | python | s154697956 | s188031490 | 216 | 88 | 42,096 | 73,760 | Accepted | Accepted | 59.26 | import itertools
N=int(eval(input()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
a=0
b=0
index=0
for i in itertools.permutations(list(range(1,N+1)), N):
if P==list(i):
a=index
if Q==list(i):
b=index
index+=1
print((abs(b-a))) | import sys
input = sys.stdin.readline
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
N=I()
P=LI()
Q=LI()
import itertools
cnt=0
p=0
q=0
fo... | 16 | 30 | 288 | 524 | import itertools
N = int(eval(input()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
a = 0
b = 0
index = 0
for i in itertools.permutations(list(range(1, N + 1)), N):
if P == list(i):
a = index
if Q == list(i):
b = index
index += 1
print((abs(b - a)))
| import sys
input = sys.stdin.readline
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
mod = 10**9 + 7
N = I()
P = LI()
Q = LI()
import itertools
cnt = 0
p = 0
q = 0
... | false | 46.666667 | [
"-import itertools",
"+import sys",
"-N = int(eval(input()))",
"-P = list(map(int, input().split()))",
"-Q = list(map(int, input().split()))",
"-a = 0",
"-b = 0",
"-index = 0",
"-for i in itertools.permutations(list(range(1, N + 1)), N):",
"- if P == list(i):",
"- a = index",
"- i... | false | 0.006934 | 0.037174 | 0.186535 | [
"s154697956",
"s188031490"
] |
u167681750 | p03457 | python | s953188687 | s386757761 | 404 | 327 | 28,068 | 3,060 | Accepted | Accepted | 19.06 | n = int(eval(input()))
txy = [[int(0)] * 3]
txy += ([list(map(int, input().split())) for i in range(n)])
for i in range(n):
t_diff = txy[i+1][0] - txy[i][0]
xy_diff = (txy[i+1][1] + txy[i+1][2]) - (txy[i][1] + txy[i][2])
if t_diff % 2 != xy_diff % 2 or xy_diff > t_diff:
print("No")
... | n = int(eval(input()))
for i in range(n):
t, x, y = list(map(int, input().split()))
if (t + x + y) % 2 == 1 or (x + y) > t:
print("No")
exit()
print("Yes") | 13 | 9 | 339 | 177 | n = int(eval(input()))
txy = [[int(0)] * 3]
txy += [list(map(int, input().split())) for i in range(n)]
for i in range(n):
t_diff = txy[i + 1][0] - txy[i][0]
xy_diff = (txy[i + 1][1] + txy[i + 1][2]) - (txy[i][1] + txy[i][2])
if t_diff % 2 != xy_diff % 2 or xy_diff > t_diff:
print("No")
exit(... | n = int(eval(input()))
for i in range(n):
t, x, y = list(map(int, input().split()))
if (t + x + y) % 2 == 1 or (x + y) > t:
print("No")
exit()
print("Yes")
| false | 30.769231 | [
"-txy = [[int(0)] * 3]",
"-txy += [list(map(int, input().split())) for i in range(n)]",
"- t_diff = txy[i + 1][0] - txy[i][0]",
"- xy_diff = (txy[i + 1][1] + txy[i + 1][2]) - (txy[i][1] + txy[i][2])",
"- if t_diff % 2 != xy_diff % 2 or xy_diff > t_diff:",
"+ t, x, y = list(map(int, input().spl... | false | 0.037126 | 0.039069 | 0.95027 | [
"s953188687",
"s386757761"
] |
u896741788 | p03160 | python | s233159937 | s567629006 | 205 | 127 | 13,928 | 14,696 | Accepted | Accepted | 38.05 | n=int(eval(input()))
l=list(map(int,input().split()))
dp=[float("INF")]*n
dp[0]=0;dp[1]=abs(l[0]-l[1])
for i in range(2,n):
for j in range(1,3):
dp[i]=min(dp[i-j]+abs(l[i]-l[i-j]),dp[i])
print((dp[-1]))
| n=int(eval(input()))
dp=[10**4*n]*n
l=list(map(int,input().split()))
dp[0]=0
dp[1]=abs(l[0]-l[1])
for i in range(2,n):
dp[i]=min(dp[i-1]+abs(l[i]-l[i-1]),dp[i-2]+abs(l[i]-l[i-2]))
print((dp[-1])) | 8 | 8 | 208 | 196 | n = int(eval(input()))
l = list(map(int, input().split()))
dp = [float("INF")] * n
dp[0] = 0
dp[1] = abs(l[0] - l[1])
for i in range(2, n):
for j in range(1, 3):
dp[i] = min(dp[i - j] + abs(l[i] - l[i - j]), dp[i])
print((dp[-1]))
| n = int(eval(input()))
dp = [10**4 * n] * n
l = list(map(int, input().split()))
dp[0] = 0
dp[1] = abs(l[0] - l[1])
for i in range(2, n):
dp[i] = min(dp[i - 1] + abs(l[i] - l[i - 1]), dp[i - 2] + abs(l[i] - l[i - 2]))
print((dp[-1]))
| false | 0 | [
"+dp = [10**4 * n] * n",
"-dp = [float(\"INF\")] * n",
"- for j in range(1, 3):",
"- dp[i] = min(dp[i - j] + abs(l[i] - l[i - j]), dp[i])",
"+ dp[i] = min(dp[i - 1] + abs(l[i] - l[i - 1]), dp[i - 2] + abs(l[i] - l[i - 2]))"
] | false | 0.036413 | 0.039851 | 0.913751 | [
"s233159937",
"s567629006"
] |
u347640436 | p03806 | python | s495004056 | s183857440 | 1,048 | 894 | 4,844 | 4,844 | Accepted | Accepted | 14.69 | INF = float('inf')
MAXAB = 10
n, ma, mb = list(map(int, input().split()))
t = [[INF] * (n * MAXAB + 1) for _ in range(n * MAXAB + 1)]
t[0][0] = 0
for _ in range(n):
a, b, c = list(map(int, input().split()))
for aa in range(n * MAXAB, -1, -1):
for bb in range(n * MAXAB, -1, -1):
if t[aa][bb] == IN... | INF = float('inf')
n, ma, mb = list(map(int, input().split()))
ccmax = n * 10
t = [[INF] * (ccmax + 1) for _ in range(ccmax + 1)]
for _ in range(n):
a, b, c = list(map(int, input().split()))
for aa in range(ccmax, 0, -1):
taa = t[aa]
for bb in range(ccmax, 0, -1):
if taa[bb] == INF:
... | 21 | 24 | 623 | 636 | INF = float("inf")
MAXAB = 10
n, ma, mb = list(map(int, input().split()))
t = [[INF] * (n * MAXAB + 1) for _ in range(n * MAXAB + 1)]
t[0][0] = 0
for _ in range(n):
a, b, c = list(map(int, input().split()))
for aa in range(n * MAXAB, -1, -1):
for bb in range(n * MAXAB, -1, -1):
if t[aa][bb] ... | INF = float("inf")
n, ma, mb = list(map(int, input().split()))
ccmax = n * 10
t = [[INF] * (ccmax + 1) for _ in range(ccmax + 1)]
for _ in range(n):
a, b, c = list(map(int, input().split()))
for aa in range(ccmax, 0, -1):
taa = t[aa]
for bb in range(ccmax, 0, -1):
if taa[bb] == INF:
... | false | 12.5 | [
"-MAXAB = 10",
"-t = [[INF] * (n * MAXAB + 1) for _ in range(n * MAXAB + 1)]",
"-t[0][0] = 0",
"+ccmax = n * 10",
"+t = [[INF] * (ccmax + 1) for _ in range(ccmax + 1)]",
"- for aa in range(n * MAXAB, -1, -1):",
"- for bb in range(n * MAXAB, -1, -1):",
"- if t[aa][bb] == INF:",
"... | false | 0.008026 | 0.039397 | 0.203718 | [
"s495004056",
"s183857440"
] |
u320567105 | p03147 | python | s449297436 | s445455698 | 22 | 18 | 3,064 | 3,060 | Accepted | Accepted | 18.18 | ri = lambda: int(eval(input()))
rl = lambda: list(map(int,input().split()))
N = ri()
h = rl()
hl = len(h)
ans = 0
flag = 0
for _ in range(sum(h)):
if sum(h) == 0:
break
flag = 1
for i in range(hl):
if flag == 1 and h[i] != 0:
flag = 0
h[i] = h[i] - 1... | ri = lambda: int(eval(input()))
rl = lambda: list(map(int,input().split()))
N = ri()
h = rl()
ans = 0
pre = 0
for i in h:
if pre < i:
ans += i - pre
pre = i
print(ans) | 24 | 14 | 480 | 193 | ri = lambda: int(eval(input()))
rl = lambda: list(map(int, input().split()))
N = ri()
h = rl()
hl = len(h)
ans = 0
flag = 0
for _ in range(sum(h)):
if sum(h) == 0:
break
flag = 1
for i in range(hl):
if flag == 1 and h[i] != 0:
flag = 0
h[i] = h[i] - 1
ans ... | ri = lambda: int(eval(input()))
rl = lambda: list(map(int, input().split()))
N = ri()
h = rl()
ans = 0
pre = 0
for i in h:
if pre < i:
ans += i - pre
pre = i
print(ans)
| false | 41.666667 | [
"-hl = len(h)",
"-flag = 0",
"-for _ in range(sum(h)):",
"- if sum(h) == 0:",
"- break",
"- flag = 1",
"- for i in range(hl):",
"- if flag == 1 and h[i] != 0:",
"- flag = 0",
"- h[i] = h[i] - 1",
"- ans += 1",
"- elif flag == 0 and... | false | 0.041641 | 0.040232 | 1.035031 | [
"s449297436",
"s445455698"
] |
u505830998 | p03324 | python | s673342733 | s600578579 | 12 | 10 | 2,820 | 2,568 | Accepted | Accepted | 16.67 | # -*- coding: utf-8 -*-
# スペース区切りの整数の入力
D, N = list(map(int, input().split()))
l=[(100**D)*x for x in range(2*N) if (100**D)*x % (100**(D+1)) != 0]
print(l[N-1])
| # -*- coding: utf-8 -*-
# スペース区切りの整数の入力
D,N = list(map(int, input().split()))
print((100**D)*(N + (1 if N==100 else 0)))
| 6 | 4 | 165 | 121 | # -*- coding: utf-8 -*-
# スペース区切りの整数の入力
D, N = list(map(int, input().split()))
l = [(100**D) * x for x in range(2 * N) if (100**D) * x % (100 ** (D + 1)) != 0]
print(l[N - 1])
| # -*- coding: utf-8 -*-
# スペース区切りの整数の入力
D, N = list(map(int, input().split()))
print((100**D) * (N + (1 if N == 100 else 0)))
| false | 33.333333 | [
"-l = [(100**D) * x for x in range(2 * N) if (100**D) * x % (100 ** (D + 1)) != 0]",
"-print(l[N - 1])",
"+print((100**D) * (N + (1 if N == 100 else 0)))"
] | false | 0.046027 | 0.243239 | 0.189227 | [
"s673342733",
"s600578579"
] |
u624475441 | p03163 | python | s228337655 | s893711826 | 317 | 176 | 19,352 | 14,456 | Accepted | Accepted | 44.48 | import sys
import numpy as np
N, W = list(map(int, input().split()))
it = iter(map(int, sys.stdin.read().split()))
dp = np.zeros(W + 1, dtype=int)
for w, v in zip(it, it):
np.maximum(dp[:-w] + v, dp[w:], out=dp[w:])
print((dp[-1])) | import sys
import numpy as np
N, W = list(map(int, input().split()))
it = iter(map(int, sys.stdin.read().split()))
dp = np.zeros(W + 1, dtype=np.int64)
for w, v in zip(it, it):
np.maximum(dp[:-w] + v, dp[w:], out=dp[w:])
print((dp[-1])) | 8 | 8 | 234 | 239 | import sys
import numpy as np
N, W = list(map(int, input().split()))
it = iter(map(int, sys.stdin.read().split()))
dp = np.zeros(W + 1, dtype=int)
for w, v in zip(it, it):
np.maximum(dp[:-w] + v, dp[w:], out=dp[w:])
print((dp[-1]))
| import sys
import numpy as np
N, W = list(map(int, input().split()))
it = iter(map(int, sys.stdin.read().split()))
dp = np.zeros(W + 1, dtype=np.int64)
for w, v in zip(it, it):
np.maximum(dp[:-w] + v, dp[w:], out=dp[w:])
print((dp[-1]))
| false | 0 | [
"-dp = np.zeros(W + 1, dtype=int)",
"+dp = np.zeros(W + 1, dtype=np.int64)"
] | false | 0.468104 | 0.454001 | 1.031063 | [
"s228337655",
"s893711826"
] |
u729972685 | p03165 | python | s478275331 | s786891851 | 1,564 | 441 | 883,336 | 112,220 | Accepted | Accepted | 71.8 | """
https://atcoder.jp/contests/dp/tasks/dp_f
"""
from collections import defaultdict
s = eval(input())
t = eval(input())
ls = len(s)
lt = len(t)
dp = [[0] * (lt + 1) for _ in range(ls + 1)]
pre = defaultdict(lambda: defaultdict(tuple))
for i in range(ls):
for j in range(lt):
if s[i] == ... | """
https://atcoder.jp/contests/dp/tasks/dp_f
"""
from collections import defaultdict
s = eval(input())
t = eval(input())
ls = len(s)
lt = len(t)
dp = [[0] * (lt + 1) for _ in range(ls + 1)]
for i in range(ls):
for j in range(lt):
if s[i] == t[j]:
dp[i + 1][j + 1] = 1 + dp[i][j]
... | 39 | 35 | 833 | 697 | """
https://atcoder.jp/contests/dp/tasks/dp_f
"""
from collections import defaultdict
s = eval(input())
t = eval(input())
ls = len(s)
lt = len(t)
dp = [[0] * (lt + 1) for _ in range(ls + 1)]
pre = defaultdict(lambda: defaultdict(tuple))
for i in range(ls):
for j in range(lt):
if s[i] == t[j]:
d... | """
https://atcoder.jp/contests/dp/tasks/dp_f
"""
from collections import defaultdict
s = eval(input())
t = eval(input())
ls = len(s)
lt = len(t)
dp = [[0] * (lt + 1) for _ in range(ls + 1)]
for i in range(ls):
for j in range(lt):
if s[i] == t[j]:
dp[i + 1][j + 1] = 1 + dp[i][j]
else:
... | false | 10.25641 | [
"-pre = defaultdict(lambda: defaultdict(tuple))",
"- pre[i + 1][j + 1] = (i, j)",
"- if dp[i + 1][j] >= dp[i][j + 1]:",
"- dp[i + 1][j + 1] = dp[i + 1][j]",
"- pre[i + 1][j + 1] = pre[i + 1][j]",
"- else:",
"- dp[i + 1][j + 1]... | false | 0.055035 | 0.035376 | 1.555714 | [
"s478275331",
"s786891851"
] |
u659159398 | p03162 | python | s935385579 | s739346117 | 707 | 591 | 48,052 | 32,296 | Accepted | Accepted | 16.41 | n = int(eval(input()))
happymat = []
dp = []
for _ in range(n):
happymat.append(list(map(int, input().split())))
dp.append([0]*3)
# dp[i][j] stores the max happiness after day i ... doing activity j on that day
dp[0][0] = happymat[0][0]
dp[0][1] = happymat[0][1]
dp[0][2] = happymat[0][2]
for i in ... | n = int(eval(input()))
happymat = []
for _ in range(n):
happymat.append(list(map(int, input().split())))
# dp[j] stores the max happiness doing activity j on the current
dp = [0]*3
for i in range(n):
prev = dp.copy()
for j in range(3):
dp[j] = happymat[i][j] + max(prev[(j+1)%3], prev[(j... | 17 | 14 | 450 | 339 | n = int(eval(input()))
happymat = []
dp = []
for _ in range(n):
happymat.append(list(map(int, input().split())))
dp.append([0] * 3)
# dp[i][j] stores the max happiness after day i ... doing activity j on that day
dp[0][0] = happymat[0][0]
dp[0][1] = happymat[0][1]
dp[0][2] = happymat[0][2]
for i in range(1, n):... | n = int(eval(input()))
happymat = []
for _ in range(n):
happymat.append(list(map(int, input().split())))
# dp[j] stores the max happiness doing activity j on the current
dp = [0] * 3
for i in range(n):
prev = dp.copy()
for j in range(3):
dp[j] = happymat[i][j] + max(prev[(j + 1) % 3], prev[(j + 2) %... | false | 17.647059 | [
"-dp = []",
"- dp.append([0] * 3)",
"-# dp[i][j] stores the max happiness after day i ... doing activity j on that day",
"-dp[0][0] = happymat[0][0]",
"-dp[0][1] = happymat[0][1]",
"-dp[0][2] = happymat[0][2]",
"-for i in range(1, n):",
"+# dp[j] stores the max happiness doing activity j on the cur... | false | 0.185939 | 0.044256 | 4.201465 | [
"s935385579",
"s739346117"
] |
u451017206 | p03128 | python | s334439448 | s555594210 | 138 | 91 | 28,120 | 3,388 | Accepted | Accepted | 34.06 | N, M = list(map(int, input().split()))
A = [i for i in input().split()]
# dp[i] = i本使ってできる最大の数
def mx(a, b):
if a is not None and b is None:
return a
elif a is None and b is not None:
return b
if len(a) != len(b):
if len(a) > len(b):
return a
else:
... | N, M = list(map(int, input().split()))
A = sorted([int(i) for i in input().split()], reverse=True)
# xを作るために使うマッチの本数
h = {1:2, 2:5, 3:5, 4:4, 5:5, 6:6, 7:3, 8:7, 9:6}
# dp[i] = i 本のマッチ棒を使って、条件を満たす整数を作るときの最大桁数
dp = [-1] * (N + 1)
dp[0] = 0
for i in range(N + 1):
for a in A:
if i - h[a] < 0: co... | 34 | 28 | 750 | 619 | N, M = list(map(int, input().split()))
A = [i for i in input().split()]
# dp[i] = i本使ってできる最大の数
def mx(a, b):
if a is not None and b is None:
return a
elif a is None and b is not None:
return b
if len(a) != len(b):
if len(a) > len(b):
return a
else:
ret... | N, M = list(map(int, input().split()))
A = sorted([int(i) for i in input().split()], reverse=True)
# xを作るために使うマッチの本数
h = {1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}
# dp[i] = i 本のマッチ棒を使って、条件を満たす整数を作るときの最大桁数
dp = [-1] * (N + 1)
dp[0] = 0
for i in range(N + 1):
for a in A:
if i - h[a] < 0:
... | false | 17.647059 | [
"-A = [i for i in input().split()]",
"-# dp[i] = i本使ってできる最大の数",
"-def mx(a, b):",
"- if a is not None and b is None:",
"- return a",
"- elif a is None and b is not None:",
"- return b",
"- if len(a) != len(b):",
"- if len(a) > len(b):",
"- return a",
"- ... | false | 0.042898 | 0.039032 | 1.099027 | [
"s334439448",
"s555594210"
] |
u349444371 | p03821 | python | s865078158 | s267471224 | 428 | 379 | 27,380 | 28,148 | Accepted | Accepted | 11.45 | n=int(eval(input()))
ab = [list(map(int, input().split())) for _ in range(n)]
ans=0
for i in range(n):
#print(ab[-i-1][0]+ans,ab[-i-1][1])
if (ab[-i-1][0]+ans)%ab[-i-1][1]!=0:
ans+=ab[-i-1][1]-(ab[-i-1][0]+ans)%ab[-i-1][1]
#print(ans)
print(ans) | n=int(eval(input()))
ab = [list(map(int, input().split())) for _ in range(n)]
ab=ab[::-1]
#print(ab)
ans=0
for a,b in ab:
if (a+ans)%b!=0:
ans+=b-(a+ans)%b
print(ans) | 9 | 9 | 267 | 180 | n = int(eval(input()))
ab = [list(map(int, input().split())) for _ in range(n)]
ans = 0
for i in range(n):
# print(ab[-i-1][0]+ans,ab[-i-1][1])
if (ab[-i - 1][0] + ans) % ab[-i - 1][1] != 0:
ans += ab[-i - 1][1] - (ab[-i - 1][0] + ans) % ab[-i - 1][1]
# print(ans)
print(ans)
| n = int(eval(input()))
ab = [list(map(int, input().split())) for _ in range(n)]
ab = ab[::-1]
# print(ab)
ans = 0
for a, b in ab:
if (a + ans) % b != 0:
ans += b - (a + ans) % b
print(ans)
| false | 0 | [
"+ab = ab[::-1]",
"+# print(ab)",
"-for i in range(n):",
"- # print(ab[-i-1][0]+ans,ab[-i-1][1])",
"- if (ab[-i - 1][0] + ans) % ab[-i - 1][1] != 0:",
"- ans += ab[-i - 1][1] - (ab[-i - 1][0] + ans) % ab[-i - 1][1]",
"- # print(ans)",
"+for a, b in ab:",
"+ if (a + ans) % b != 0:"... | false | 0.04564 | 0.046391 | 0.983805 | [
"s865078158",
"s267471224"
] |
u514687406 | p02657 | python | s917903144 | s108106994 | 73 | 25 | 65,308 | 9,432 | Accepted | Accepted | 65.75 | """
~~ Author : Bhaskar
~~ Dated : 31~05~2020
"""
import sys
from bisect import *
from math import floor,sqrt,ceil,factorial as F,gcd,pi
from itertools import chain,combinations,permutations,accumulate
from collections import Counter,defaultdict,OrderedDict,deque
from array import array
INT_MAX = sys.maxsiz... | """
~~ Author : Bhaskar
~~ Dated : 13~06~2020
"""
import sys
from bisect import *
from math import floor, sqrt, ceil, factorial as F, gcd, pi
from itertools import chain, combinations, permutations, accumulate
from collections import Counter, defaultdict, OrderedDict, deque
INT_MAX = sys.maxsize
INT_MIN =... | 23 | 35 | 571 | 915 | """
~~ Author : Bhaskar
~~ Dated : 31~05~2020
"""
import sys
from bisect import *
from math import floor, sqrt, ceil, factorial as F, gcd, pi
from itertools import chain, combinations, permutations, accumulate
from collections import Counter, defaultdict, OrderedDict, deque
from array import array
INT_MAX = sys.maxsiz... | """
~~ Author : Bhaskar
~~ Dated : 13~06~2020
"""
import sys
from bisect import *
from math import floor, sqrt, ceil, factorial as F, gcd, pi
from itertools import chain, combinations, permutations, accumulate
from collections import Counter, defaultdict, OrderedDict, deque
INT_MAX = sys.maxsize
INT_MIN = -(sys.maxsiz... | false | 34.285714 | [
"-~~ Dated : 31~05~2020",
"+~~ Dated : 13~06~2020",
"-from array import array",
"+ch = \"abcdefghijklmnopqrstuvwxyz\"",
"+INT = (",
"+ lambda type: type(sys.stdin.readline())",
"+ if type in [int, float]",
"+ else type(sys.stdin.readline()).replace(\"\\n\", \"\")",
"+)",
"+ARRAY = lambda ... | false | 0.045041 | 0.047424 | 0.94976 | [
"s917903144",
"s108106994"
] |
u906501980 | p02744 | python | s927860611 | s868482947 | 495 | 450 | 49,084 | 49,088 | Accepted | Accepted | 9.09 | n = int(eval(input()))
s = "abcdefghij"
class Node:
def __init__(self, string, index):
self.children = []
self.string = string
self.index = index
def get_children(self):
parent = self.string
for i, c in enumerate(s[:self.index+1]):
self.children.... | n = int(eval(input()))
s = "abcdefghij"
class Node:
def __init__(self, string, index):
self.children = []
self.string = string
self.index = index
def get_children(self):
parent = self.string
for i, c in enumerate(s[:self.index+1], 1):
self.childr... | 23 | 23 | 615 | 616 | n = int(eval(input()))
s = "abcdefghij"
class Node:
def __init__(self, string, index):
self.children = []
self.string = string
self.index = index
def get_children(self):
parent = self.string
for i, c in enumerate(s[: self.index + 1]):
self.children.append(N... | n = int(eval(input()))
s = "abcdefghij"
class Node:
def __init__(self, string, index):
self.children = []
self.string = string
self.index = index
def get_children(self):
parent = self.string
for i, c in enumerate(s[: self.index + 1], 1):
self.children.appen... | false | 0 | [
"- for i, c in enumerate(s[: self.index + 1]):",
"- self.children.append(Node(parent + c, max(self.index, i + 1)))",
"+ for i, c in enumerate(s[: self.index + 1], 1):",
"+ self.children.append(Node(parent + c, max(i, self.index)))"
] | false | 0.044831 | 0.037387 | 1.199118 | [
"s927860611",
"s868482947"
] |
u778814286 | p03485 | python | s369422647 | s992446166 | 37 | 18 | 5,220 | 2,940 | Accepted | Accepted | 51.35 | import math
import statistics as st
a,b = list(map(int,input().split()))
print((math.ceil(st.mean((a,b))))) | import math
a, b = list(map(int,input().split()))
print((math.ceil((a+b)/2))) | 6 | 3 | 106 | 71 | import math
import statistics as st
a, b = list(map(int, input().split()))
print((math.ceil(st.mean((a, b)))))
| import math
a, b = list(map(int, input().split()))
print((math.ceil((a + b) / 2)))
| false | 50 | [
"-import statistics as st",
"-print((math.ceil(st.mean((a, b)))))",
"+print((math.ceil((a + b) / 2)))"
] | false | 0.180024 | 0.03774 | 4.770082 | [
"s369422647",
"s992446166"
] |
u721403425 | p02717 | python | s563117721 | s290327277 | 21 | 17 | 3,060 | 2,940 | Accepted | Accepted | 19.05 | x,y,z = list(map(int,input().split()))
print((z,x,y)) | x,y,z = input().split()
print((z,x,y)) | 2 | 2 | 46 | 37 | x, y, z = list(map(int, input().split()))
print((z, x, y))
| x, y, z = input().split()
print((z, x, y))
| false | 0 | [
"-x, y, z = list(map(int, input().split()))",
"+x, y, z = input().split()"
] | false | 0.045548 | 0.115844 | 0.393184 | [
"s563117721",
"s290327277"
] |
u407160848 | p02735 | python | s784587660 | s513764254 | 569 | 410 | 69,208 | 58,712 | Accepted | Accepted | 27.94 | import math
from functools import reduce
from collections import deque
import heapq
import sys
sys.setrecursionlimit(10**7)
# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
return [ int(s) for s in input().split(" ")]
# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
return [ int(input()) for _... | import heapq
import sys
# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
return [ int(s) for s in input().split(" ")]
def log(*args):
print("DEBUG:", *args, file=sys.stderr)
h,w = get_nums_l()
grid = [ input() for _ in range(h) ]
dp = [ [99999999999999999999] * w for _ in range(h)]
def bfs(co... | 57 | 45 | 1,320 | 1,012 | import math
from functools import reduce
from collections import deque
import heapq
import sys
sys.setrecursionlimit(10**7)
# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
return [int(s) for s in input().split(" ")]
# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
return [int(input()) for _ in range(n)]
... | import heapq
import sys
# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
return [int(s) for s in input().split(" ")]
def log(*args):
print("DEBUG:", *args, file=sys.stderr)
h, w = get_nums_l()
grid = [input() for _ in range(h)]
dp = [[99999999999999999999] * w for _ in range(h)]
def bfs(cost, x, y):
... | false | 21.052632 | [
"-import math",
"-from functools import reduce",
"-from collections import deque",
"-sys.setrecursionlimit(10**7)",
"-",
"-",
"-# 改行区切りの入力をn行読み込んで数値リストにして返します。",
"-def get_nums_n(n):",
"- return [int(input()) for _ in range(n)]",
"-",
"-",
"-# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。",
"-def g... | false | 0.045758 | 0.105672 | 0.433021 | [
"s784587660",
"s513764254"
] |
u163320134 | p03044 | python | s367073918 | s343333496 | 889 | 660 | 46,128 | 39,956 | Accepted | Accepted | 25.76 | import collections
n=int(eval(input()))
ans=[0]*(n+1)
tree=[[] for _ in range(n+1)]
for i in range(n-1):
u,v,w=list(map(int,input().split()))
tree[u].append([v,w])
tree[v].append([u,w])
q=collections.deque([1])
check=[False]*(n+1)
check[1]=True
tmp=tree[1][0]
if tmp[1]%2==0:
ans[1]=1
ans[tmp[0... | import collections
n=int(eval(input()))
g=[[] for _ in range(n+1)]
for _ in range(n-1):
a,b,w=list(map(int,input().split()))
g[a].append((b,w))
g[b].append((a,w))
q=collections.deque()
q.append(1)
checked=[0]*(n+1)
ans=[0]*(n+1)
ans[1]=0
while len(q)!=0:
v=q.popleft()
checked[v]=1
for u,w ... | 36 | 25 | 695 | 478 | import collections
n = int(eval(input()))
ans = [0] * (n + 1)
tree = [[] for _ in range(n + 1)]
for i in range(n - 1):
u, v, w = list(map(int, input().split()))
tree[u].append([v, w])
tree[v].append([u, w])
q = collections.deque([1])
check = [False] * (n + 1)
check[1] = True
tmp = tree[1][0]
if tmp[1] % 2 ... | import collections
n = int(eval(input()))
g = [[] for _ in range(n + 1)]
for _ in range(n - 1):
a, b, w = list(map(int, input().split()))
g[a].append((b, w))
g[b].append((a, w))
q = collections.deque()
q.append(1)
checked = [0] * (n + 1)
ans = [0] * (n + 1)
ans[1] = 0
while len(q) != 0:
v = q.popleft()... | false | 30.555556 | [
"+g = [[] for _ in range(n + 1)]",
"+for _ in range(n - 1):",
"+ a, b, w = list(map(int, input().split()))",
"+ g[a].append((b, w))",
"+ g[b].append((a, w))",
"+q = collections.deque()",
"+q.append(1)",
"+checked = [0] * (n + 1)",
"-tree = [[] for _ in range(n + 1)]",
"-for i in range(n -... | false | 0.105659 | 0.046032 | 2.295329 | [
"s367073918",
"s343333496"
] |
u077291787 | p02744 | python | s795070656 | s424330224 | 69 | 61 | 15,732 | 15,380 | Accepted | Accepted | 11.59 | # D - String Equivalence
from string import ascii_lowercase
def dfs(n: int) -> list:
if n == 1:
return ["a"]
cur = dfs(n - 1)
result = []
for s in cur:
for c in ascii_lowercase[: len(set(s)) + 1]:
result.append(s + c)
return result
def main():
N = ... | # D - String Equivalence
abc = "abcdefghij"
def dfs(n: int) -> list:
if n == 1:
return ["a"]
cur = dfs(n - 1)
result = []
for s in cur:
for c in abc[: len(set(s)) + 1]:
result.append(s + c)
return result
def main():
N = int(eval(input()))
resu... | 24 | 24 | 447 | 419 | # D - String Equivalence
from string import ascii_lowercase
def dfs(n: int) -> list:
if n == 1:
return ["a"]
cur = dfs(n - 1)
result = []
for s in cur:
for c in ascii_lowercase[: len(set(s)) + 1]:
result.append(s + c)
return result
def main():
N = int(eval(input()... | # D - String Equivalence
abc = "abcdefghij"
def dfs(n: int) -> list:
if n == 1:
return ["a"]
cur = dfs(n - 1)
result = []
for s in cur:
for c in abc[: len(set(s)) + 1]:
result.append(s + c)
return result
def main():
N = int(eval(input()))
result = dfs(N)
r... | false | 0 | [
"-from string import ascii_lowercase",
"+abc = \"abcdefghij\"",
"- for c in ascii_lowercase[: len(set(s)) + 1]:",
"+ for c in abc[: len(set(s)) + 1]:"
] | false | 0.049632 | 0.037699 | 1.316554 | [
"s795070656",
"s424330224"
] |
u677121387 | p02791 | python | s168910518 | s693337207 | 156 | 111 | 24,744 | 24,744 | Accepted | Accepted | 28.85 | n = int(eval(input()))
p = [int(i) for i in input().split()]
t = p[0]
ans = 0
for i in range(n):
if t >= p[i]:
ans += 1
t = min(p[i],t)
print(ans) | n = int(eval(input()))
p = [int(i) for i in input().split()]
t = p[0]
ans = 0
for i in range(n):
if t >= p[i]:
ans += 1
t = p[i]
print(ans) | 11 | 11 | 168 | 165 | n = int(eval(input()))
p = [int(i) for i in input().split()]
t = p[0]
ans = 0
for i in range(n):
if t >= p[i]:
ans += 1
t = min(p[i], t)
print(ans)
| n = int(eval(input()))
p = [int(i) for i in input().split()]
t = p[0]
ans = 0
for i in range(n):
if t >= p[i]:
ans += 1
t = p[i]
print(ans)
| false | 0 | [
"- t = min(p[i], t)",
"+ t = p[i]"
] | false | 0.04721 | 0.046517 | 1.01488 | [
"s168910518",
"s693337207"
] |
u450956662 | p02912 | python | s124972041 | s872081265 | 167 | 147 | 14,252 | 20,248 | Accepted | Accepted | 11.98 | import heapq
N, M = list(map(int, input().split()))
A = list([-int(x) for x in input().split()])
heapq.heapify(A)
for _ in range(M):
tmp = heapq.heappop(A)
heapq.heappush(A, -(-tmp // 2))
print((-sum(A)))
| import heapq
N, M = list(map(int, input().split()))
A = list([-int(x) for x in input().split()])
res = -sum(A)
heapq.heapify(A)
for _ in range(M):
a = heapq.heappop(A)
a *= -1
res -= (a - a // 2)
a //= 2
heapq.heappush(A, - a)
print(res) | 11 | 12 | 223 | 267 | import heapq
N, M = list(map(int, input().split()))
A = list([-int(x) for x in input().split()])
heapq.heapify(A)
for _ in range(M):
tmp = heapq.heappop(A)
heapq.heappush(A, -(-tmp // 2))
print((-sum(A)))
| import heapq
N, M = list(map(int, input().split()))
A = list([-int(x) for x in input().split()])
res = -sum(A)
heapq.heapify(A)
for _ in range(M):
a = heapq.heappop(A)
a *= -1
res -= a - a // 2
a //= 2
heapq.heappush(A, -a)
print(res)
| false | 8.333333 | [
"+res = -sum(A)",
"- tmp = heapq.heappop(A)",
"- heapq.heappush(A, -(-tmp // 2))",
"-print((-sum(A)))",
"+ a = heapq.heappop(A)",
"+ a *= -1",
"+ res -= a - a // 2",
"+ a //= 2",
"+ heapq.heappush(A, -a)",
"+print(res)"
] | false | 0.127166 | 0.055315 | 2.298957 | [
"s124972041",
"s872081265"
] |
u888092736 | p03044 | python | s929374377 | s653667934 | 539 | 487 | 109,260 | 78,652 | Accepted | Accepted | 9.65 | import sys
from collections import defaultdict
sys.setrecursionlimit(1_000_000)
def dfs(v):
for nv, nw in g[v]:
if visited[nv]:
continue
if nw % 2:
ans[nv] = ans[v] ^ 1
else:
ans[nv] = ans[v]
visited[nv] = True
dfs(nv)
... | from collections import defaultdict, deque
def bfs(start):
q = deque([start])
dist = [-1] * N
dist[start] = 0
while q:
v = q.popleft()
for nv, nw in g[v]:
if dist[nv] >= 0:
continue
dist[nv] = (dist[v] + nw) % 2
q.append(... | 33 | 27 | 598 | 571 | import sys
from collections import defaultdict
sys.setrecursionlimit(1_000_000)
def dfs(v):
for nv, nw in g[v]:
if visited[nv]:
continue
if nw % 2:
ans[nv] = ans[v] ^ 1
else:
ans[nv] = ans[v]
visited[nv] = True
dfs(nv)
N, *UVW = list(m... | from collections import defaultdict, deque
def bfs(start):
q = deque([start])
dist = [-1] * N
dist[start] = 0
while q:
v = q.popleft()
for nv, nw in g[v]:
if dist[nv] >= 0:
continue
dist[nv] = (dist[v] + nw) % 2
q.append(nv)
retur... | false | 18.181818 | [
"-import sys",
"-from collections import defaultdict",
"-",
"-sys.setrecursionlimit(1_000_000)",
"+from collections import defaultdict, deque",
"-def dfs(v):",
"- for nv, nw in g[v]:",
"- if visited[nv]:",
"- continue",
"- if nw % 2:",
"- ans[nv] = ans[v] ^... | false | 0.036559 | 0.03624 | 1.008806 | [
"s929374377",
"s653667934"
] |
u998733244 | p02714 | python | s376688887 | s664734655 | 1,760 | 122 | 9,284 | 73,856 | Accepted | Accepted | 93.07 | #!/usr/bin/env python3
MOD = 10**9
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
return divisors
N = int(eval(input()))
S = eval(input())
ans = ... | N = int(eval(input()))
S = eval(input())
ans = S.count('R') * S.count('G') * S.count('B')
SN = []
for s in S:
if s == 'R': SN.append(-1)
elif s == 'G': SN.append(0)
else: SN.append(1)
rem2 = ['RRR', 'GGG', 'BBB']
count = 0
for i in range(1, N-1):
index = i
left = i - 1
... | 44 | 32 | 892 | 631 | #!/usr/bin/env python3
MOD = 10**9
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
return divisors
N = int(eval(input()))
S = eval(input())
ans = S.count("R")... | N = int(eval(input()))
S = eval(input())
ans = S.count("R") * S.count("G") * S.count("B")
SN = []
for s in S:
if s == "R":
SN.append(-1)
elif s == "G":
SN.append(0)
else:
SN.append(1)
rem2 = ["RRR", "GGG", "BBB"]
count = 0
for i in range(1, N - 1):
index = i
left = i - 1
... | false | 27.272727 | [
"-#!/usr/bin/env python3",
"-MOD = 10**9",
"-",
"-",
"-def make_divisors(n):",
"- divisors = []",
"- for i in range(1, int(n**0.5) + 1):",
"- if n % i == 0:",
"- divisors.append(i)",
"- if i != n // i:",
"- divisors.append(n // i)",
"- retur... | false | 0.100269 | 0.036938 | 2.714487 | [
"s376688887",
"s664734655"
] |
u116002573 | p02790 | python | s460230107 | s698868981 | 64 | 58 | 61,820 | 61,804 | Accepted | Accepted | 9.38 | def main():
a, b = input().split()
s = a * int(b)
t = b * int(a)
if s < t:
return s
return t
if __name__ == '__main__':
print((main()))
| def main():
a, b = list(map(int, input().split()))
s = str(a) * b
t = str(b) * a
if s < t:
return s
return t
if __name__ == '__main__':
print((main()))
| 12 | 12 | 180 | 190 | def main():
a, b = input().split()
s = a * int(b)
t = b * int(a)
if s < t:
return s
return t
if __name__ == "__main__":
print((main()))
| def main():
a, b = list(map(int, input().split()))
s = str(a) * b
t = str(b) * a
if s < t:
return s
return t
if __name__ == "__main__":
print((main()))
| false | 0 | [
"- a, b = input().split()",
"- s = a * int(b)",
"- t = b * int(a)",
"+ a, b = list(map(int, input().split()))",
"+ s = str(a) * b",
"+ t = str(b) * a"
] | false | 0.0327 | 0.11046 | 0.296035 | [
"s460230107",
"s698868981"
] |
u618251217 | p02615 | python | s707168009 | s459190665 | 155 | 136 | 31,636 | 31,440 | Accepted | Accepted | 12.26 | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort(reverse=True)
cnt = 1
idx = 0
ans = 0
while cnt <= N-1:
ans += A[idx]
if cnt % 2 == 1:
#ans += A[idx]
idx += 1
#else:
#ans += A[idx]
cnt += 1
print(ans) | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = A[0] #最大値だけ1回
for i in range(N-2):
ans += A[i//2 + 1]
print(ans) | 16 | 7 | 268 | 154 | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort(reverse=True)
cnt = 1
idx = 0
ans = 0
while cnt <= N - 1:
ans += A[idx]
if cnt % 2 == 1:
# ans += A[idx]
idx += 1
# else:
# ans += A[idx]
cnt += 1
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = A[0] # 最大値だけ1回
for i in range(N - 2):
ans += A[i // 2 + 1]
print(ans)
| false | 56.25 | [
"-cnt = 1",
"-idx = 0",
"-ans = 0",
"-while cnt <= N - 1:",
"- ans += A[idx]",
"- if cnt % 2 == 1:",
"- # ans += A[idx]",
"- idx += 1",
"- # else:",
"- # ans += A[idx]",
"- cnt += 1",
"+ans = A[0] # 最大値だけ1回",
"+for i in range(N - 2):",
"+ ans += A[i // 2 + ... | false | 0.046531 | 0.046537 | 0.999886 | [
"s707168009",
"s459190665"
] |
u926412290 | p03805 | python | s824245006 | s713017617 | 85 | 29 | 74,536 | 9,140 | Accepted | Accepted | 65.88 | N, M = list(map(int, input().split()))
to = [[] for _ in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
to[a].append(b)
to[b].append(a)
res = 0
def dfs(v, seen):
global res
if seen == [1] * N:
res += 1
return
for nv ... | N, M = list(map(int, input().split()))
to = [[] for _ in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
to[a].append(b)
to[b].append(a)
def dfs(v, seen):
if seen == [1] * N:
return 1
res = 0
for nv in to[v]:
if ... | 32 | 31 | 555 | 551 | N, M = list(map(int, input().split()))
to = [[] for _ in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
to[a].append(b)
to[b].append(a)
res = 0
def dfs(v, seen):
global res
if seen == [1] * N:
res += 1
return
for nv in to[v]:
... | N, M = list(map(int, input().split()))
to = [[] for _ in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
to[a].append(b)
to[b].append(a)
def dfs(v, seen):
if seen == [1] * N:
return 1
res = 0
for nv in to[v]:
if not seen[nv]:
... | false | 3.125 | [
"-res = 0",
"- global res",
"- res += 1",
"- return",
"+ return 1",
"+ res = 0",
"- dfs(nv, seen)",
"+ res += dfs(nv, seen)",
"+ return res",
"- dfs(0, seen)",
"- print(res)",
"+ print((dfs(0, seen)))"
] | false | 0.038028 | 0.071136 | 0.53459 | [
"s824245006",
"s713017617"
] |
u506858457 | p02683 | python | s532075726 | s337406452 | 103 | 90 | 9,124 | 9,180 | Accepted | Accepted | 12.62 | def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
N,M,X=MI()
List=[]
for i in range(N):
CA=LI()
List.append(CA)
ans=-1
for i in range(1<<N):
tmp=[0]*M
cost=0
for j in range(N):
if 1&(i>>j):
cost+=List[j][0]
for k in range(M):
... | def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
N,M,X=MI()
C=[]
A=[]
for i in range(N):
L=LI()
C.append(L[0])
A.append(L[1:])
ans=-1
for i in range(1<<N):
tmp=[0]*M
cost=0
for j in range(N):
if 1&(i>>j):
cost+=C[j]
for m in ra... | 22 | 24 | 463 | 446 | def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
N, M, X = MI()
List = []
for i in range(N):
CA = LI()
List.append(CA)
ans = -1
for i in range(1 << N):
tmp = [0] * M
cost = 0
for j in range(N):
if 1 & (i >> j):
cost += ... | def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
N, M, X = MI()
C = []
A = []
for i in range(N):
L = LI()
C.append(L[0])
A.append(L[1:])
ans = -1
for i in range(1 << N):
tmp = [0] * M
cost = 0
for j in range(N):
if 1 & (i >> j)... | false | 8.333333 | [
"-List = []",
"+C = []",
"+A = []",
"- CA = LI()",
"- List.append(CA)",
"+ L = LI()",
"+ C.append(L[0])",
"+ A.append(L[1:])",
"- cost += List[j][0]",
"- for k in range(M):",
"- tmp[k] += List[j][k + 1]",
"- if min(tmp) >= X:",
"... | false | 0.037978 | 0.048175 | 0.788332 | [
"s532075726",
"s337406452"
] |
u633068244 | p00884 | python | s281780788 | s857327380 | 790 | 90 | 4,464 | 4,416 | Accepted | Accepted | 88.61 | while 1:
n = eval(input())
if n == 0: break
ans = {}
for i in range(n):
group,name = input().split(":")
if i == 0: first = group
ans[group] = set(name[:-1].split(","))
while 1:
for key in ans:
flag = 0
if key == first: continue
for key1 in ans:
if key in ans[key1]:
an... | while 1:
n = eval(input())
if n == 0: break
ans = {}
for i in range(n):
group,name = input().split(":")
if i == 0: first = group
ans[group] = set(name[:-1].split(","))
while 1:
for key in ans:
flag = 0
if key == first: continue
for key1 in ans:
if key in ans[key1]:
ans[key1]... | 19 | 22 | 431 | 463 | while 1:
n = eval(input())
if n == 0:
break
ans = {}
for i in range(n):
group, name = input().split(":")
if i == 0:
first = group
ans[group] = set(name[:-1].split(","))
while 1:
for key in ans:
flag = 0
if ke... | while 1:
n = eval(input())
if n == 0:
break
ans = {}
for i in range(n):
group, name = input().split(":")
if i == 0:
first = group
ans[group] = set(name[:-1].split(","))
while 1:
for key in ans:
flag = 0
if key == first:
... | false | 13.636364 | [
"- while 1:",
"- for key in ans:",
"- flag = 0",
"- if key == first:",
"- continue",
"- for key1 in ans:",
"- if key in ans[key1]:",
"- ans[key1] |= ans[key]",
"- ... | false | 0.036693 | 0.04465 | 0.821797 | [
"s281780788",
"s857327380"
] |
u411923565 | p03695 | python | s842503780 | s097317489 | 28 | 23 | 9,172 | 9,128 | Accepted | Accepted | 17.86 | #C - Colorful Leaderboard
N = int(eval(input()))
a = list(map(int,input().split()))
mini = 0
color_list = []
for i in a:
if (i//400)<8 and ((i//400 in color_list) == False):
mini += 1
color_list.append(i//400)
maxi = mini
for j in a:
if j >= 3200:
maxi += 1
if mini == 0... | #8 C - Colorful Leaderboard
N = int(eval(input()))
a = list(map(int,input().split()))
seen = [False]*8
cnt = 0
cnt_3200 = 0
for i in a:
i = i//400
if i >= 8:
cnt_3200 += 1
elif (seen[i] == False):
cnt += 1
seen[i] = True
if cnt == 0:
print((1,cnt_3200))
els... | 18 | 19 | 352 | 343 | # C - Colorful Leaderboard
N = int(eval(input()))
a = list(map(int, input().split()))
mini = 0
color_list = []
for i in a:
if (i // 400) < 8 and ((i // 400 in color_list) == False):
mini += 1
color_list.append(i // 400)
maxi = mini
for j in a:
if j >= 3200:
maxi += 1
if mini == 0: # 忘れて... | # 8 C - Colorful Leaderboard
N = int(eval(input()))
a = list(map(int, input().split()))
seen = [False] * 8
cnt = 0
cnt_3200 = 0
for i in a:
i = i // 400
if i >= 8:
cnt_3200 += 1
elif seen[i] == False:
cnt += 1
seen[i] = True
if cnt == 0:
print((1, cnt_3200))
else:
print((cnt,... | false | 5.263158 | [
"-# C - Colorful Leaderboard",
"+# 8 C - Colorful Leaderboard",
"-mini = 0",
"-color_list = []",
"+seen = [False] * 8",
"+cnt = 0",
"+cnt_3200 = 0",
"- if (i // 400) < 8 and ((i // 400 in color_list) == False):",
"- mini += 1",
"- color_list.append(i // 400)",
"-maxi = mini",
... | false | 0.008716 | 0.036083 | 0.241549 | [
"s842503780",
"s097317489"
] |
u103902792 | p03356 | python | s732221877 | s557984283 | 992 | 832 | 80,232 | 71,144 | Accepted | Accepted | 16.13 | n,m = list(map(int,input().split()))
P = list(map(int,input().split()))
uf = {i:-1 for i in range(1,n+1)}
def get_p(i):
while uf[i] != i:
if uf[i] == -1:
return i
i = uf[i]
return i
for _ in range(m):
x,y = list(map(int,input().split()))
if x > y:
x,y = y,x
if uf[x]== uf[y] ... | n,m = list(map(int,input().split()))
P = list(map(int,input().split()))
uf = {i:i for i in range(1,n+1)}
def get_parent(i):
lst = []
while uf[i] != i:
lst.append(i)
i = uf[i]
for l in lst[:-1]:
uf[l] = i
return i
def unite(i,j):
p = get_parent(i)
uf[get_parent(j)] = p
def s... | 41 | 30 | 754 | 518 | n, m = list(map(int, input().split()))
P = list(map(int, input().split()))
uf = {i: -1 for i in range(1, n + 1)}
def get_p(i):
while uf[i] != i:
if uf[i] == -1:
return i
i = uf[i]
return i
for _ in range(m):
x, y = list(map(int, input().split()))
if x > y:
x, y = ... | n, m = list(map(int, input().split()))
P = list(map(int, input().split()))
uf = {i: i for i in range(1, n + 1)}
def get_parent(i):
lst = []
while uf[i] != i:
lst.append(i)
i = uf[i]
for l in lst[:-1]:
uf[l] = i
return i
def unite(i, j):
p = get_parent(i)
uf[get_parent... | false | 26.829268 | [
"-uf = {i: -1 for i in range(1, n + 1)}",
"+uf = {i: i for i in range(1, n + 1)}",
"-def get_p(i):",
"+def get_parent(i):",
"+ lst = []",
"- if uf[i] == -1:",
"- return i",
"+ lst.append(i)",
"+ for l in lst[:-1]:",
"+ uf[l] = i",
"+",
"+",
"+def unite(i... | false | 0.107302 | 0.0402 | 2.669216 | [
"s732221877",
"s557984283"
] |
u067299340 | p00010 | python | s386023601 | s122823497 | 20 | 10 | 4,336 | 4,332 | Accepted | Accepted | 50 | def calc(a,b,c,d,e,f):
A=2*(c-a)
B=2*(d-b)
C=a*a-c*c+b*b-d*d
D=2*(e-a)
E=2*(f-b)
F=a*a-e*e+b*b-f*f
N=(A*E-D*B)
X=(B*F-E*C)/N
Y=(C*D-F*A)/N
R=((X-a)**2+(Y-b)**2)**0.5
return tuple(map(round,[X,Y,R],[3]*3))
l=[list(map(float,input().split()))for i in range(eval(input()))]
for k in l:print("%.3f %.... | def calc(a,b,c,d,e,f):
A=2*(c-a)
B=2*(d-b)
C=a*a-c*c+b*b-d*d
D=2*(e-a)
E=2*(f-b)
F=a*a-e*e+b*b-f*f
N=(A*E-D*B)
X=(B*F-E*C)/N
Y=(C*D-F*A)/N
return tuple(map(round,[X,Y,((X-a)**2+(Y-b)**2)**0.5],[3]*3))
l=[list(map(float,input().split()))for i in range(eval(input()))]
for k in l:print("%.3f %.3f %.3... | 14 | 13 | 330 | 324 | def calc(a, b, c, d, e, f):
A = 2 * (c - a)
B = 2 * (d - b)
C = a * a - c * c + b * b - d * d
D = 2 * (e - a)
E = 2 * (f - b)
F = a * a - e * e + b * b - f * f
N = A * E - D * B
X = (B * F - E * C) / N
Y = (C * D - F * A) / N
R = ((X - a) ** 2 + (Y - b) ** 2) ** 0.5
return tu... | def calc(a, b, c, d, e, f):
A = 2 * (c - a)
B = 2 * (d - b)
C = a * a - c * c + b * b - d * d
D = 2 * (e - a)
E = 2 * (f - b)
F = a * a - e * e + b * b - f * f
N = A * E - D * B
X = (B * F - E * C) / N
Y = (C * D - F * A) / N
return tuple(map(round, [X, Y, ((X - a) ** 2 + (Y - b)... | false | 7.142857 | [
"- R = ((X - a) ** 2 + (Y - b) ** 2) ** 0.5",
"- return tuple(map(round, [X, Y, R], [3] * 3))",
"+ return tuple(map(round, [X, Y, ((X - a) ** 2 + (Y - b) ** 2) ** 0.5], [3] * 3))"
] | false | 0.039181 | 0.031697 | 1.236128 | [
"s386023601",
"s122823497"
] |
u075012704 | p03464 | python | s217039175 | s662824047 | 1,986 | 500 | 14,252 | 63,984 | Accepted | Accepted | 74.82 | K = int(eval(input()))
A = list(map(int, input().split()))
lo = 2
hi = 10**18
def check1(people):
for a in A:
people = (people // a) * a
if people > 2:
return False
else:
return True
def check2(people):
for a in A:
people = (people // a) * a
if... | K = int(eval(input()))
A = list(map(int, input().split()))
# 最後に2人以上残るような最小のNを探す
ok, ng = 10 ** 18, 0
while abs(ok - ng) > 1:
n = (ok + ng) // 2
x = n
for a in A:
x = (x // a) * a
if x >= 2:
ok = n
else:
ng = n
m = ok
# 最後に2人以下になるような最大のNを探す
ok, ng = 0, 10 *... | 52 | 41 | 806 | 650 | K = int(eval(input()))
A = list(map(int, input().split()))
lo = 2
hi = 10**18
def check1(people):
for a in A:
people = (people // a) * a
if people > 2:
return False
else:
return True
def check2(people):
for a in A:
people = (people // a) * a
if people < 2:
... | K = int(eval(input()))
A = list(map(int, input().split()))
# 最後に2人以上残るような最小のNを探す
ok, ng = 10**18, 0
while abs(ok - ng) > 1:
n = (ok + ng) // 2
x = n
for a in A:
x = (x // a) * a
if x >= 2:
ok = n
else:
ng = n
m = ok
# 最後に2人以下になるような最大のNを探す
ok, ng = 0, 10**18
while abs(ok - ng)... | false | 21.153846 | [
"-lo = 2",
"-hi = 10**18",
"-",
"-",
"-def check1(people):",
"+# 最後に2人以上残るような最小のNを探す",
"+ok, ng = 10**18, 0",
"+while abs(ok - ng) > 1:",
"+ n = (ok + ng) // 2",
"+ x = n",
"- people = (people // a) * a",
"- if people > 2:",
"- return False",
"+ x = (x // a) *... | false | 0.04825 | 0.041162 | 1.172192 | [
"s217039175",
"s662824047"
] |
u729133443 | p03109 | python | s231158317 | s752347054 | 160 | 19 | 38,384 | 2,940 | Accepted | Accepted | 88.12 | print(('TBD'*(input()[5:]>'04/30')or'Heisei')) | print(('TBD'*(input()[5:7]>'04')or'Heisei')) | 1 | 1 | 44 | 42 | print(("TBD" * (input()[5:] > "04/30") or "Heisei"))
| print(("TBD" * (input()[5:7] > "04") or "Heisei"))
| false | 0 | [
"-print((\"TBD\" * (input()[5:] > \"04/30\") or \"Heisei\"))",
"+print((\"TBD\" * (input()[5:7] > \"04\") or \"Heisei\"))"
] | false | 0.033539 | 0.068229 | 0.491564 | [
"s231158317",
"s752347054"
] |
u499381410 | p03634 | python | s711306986 | s198880091 | 696 | 594 | 96,432 | 79,316 | Accepted | Accepted | 14.66 | from collections import defaultdict, deque
from heapq import heappush, heappop, heapify
import math
import bisect
import random
import sys
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LIM(): return list([int(x) - 1 for x in sys.stdin.readline().... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
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, ... | 49 | 51 | 1,146 | 1,436 | from collections import defaultdict, deque
from heapq import heappush, heappop, heapify
import math
import bisect
import random
import sys
def LI():
return list(map(int, sys.stdin.readline().split()))
def I():
return int(sys.stdin.readline())
def LIM():
return list([int(x) - 1 for x in sys.stdin.readl... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
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
fro... | false | 3.921569 | [
"-from collections import defaultdict, deque",
"+from collections import defaultdict, deque, Counter",
"+from itertools import permutations, accumulate, combinations, product",
"+import string",
"+from bisect import bisect_left, bisect_right",
"+from math import factorial, ceil, floor",
"+from operator ... | false | 0.06661 | 0.126335 | 0.527251 | [
"s711306986",
"s198880091"
] |
u758815106 | p03169 | python | s273134022 | s466882275 | 1,974 | 534 | 397,984 | 295,736 | Accepted | Accepted | 72.95 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
N = int(eval(input()))
a = list(map(int, input().split()))
one = a.count(1)
two = a.count(2)
three = a.count(3)
dp = [[[-1] * 301 for _ in range(301)] for _ in range(301)]
def rec(i, j, k):
if dp[i][j][k] >= 0:
return dp[i... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
N = int(eval(input()))
a = list(map(int, input().split()))
one = a.count(1)
two = a.count(2)
three = a.count(3)
dp = [[[0.0] * (N + 1) for _ in range((N + 1))] for _ in range((N + 1))]
max_one = one + two + three
max_two = two + three
... | 39 | 35 | 698 | 831 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
N = int(eval(input()))
a = list(map(int, input().split()))
one = a.count(1)
two = a.count(2)
three = a.count(3)
dp = [[[-1] * 301 for _ in range(301)] for _ in range(301)]
def rec(i, j, k):
if dp[i][j][k] >= 0:
return dp[i][j][k]
if i... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
N = int(eval(input()))
a = list(map(int, input().split()))
one = a.count(1)
two = a.count(2)
three = a.count(3)
dp = [[[0.0] * (N + 1) for _ in range((N + 1))] for _ in range((N + 1))]
max_one = one + two + three
max_two = two + three
max_three = three... | false | 10.25641 | [
"-dp = [[[-1] * 301 for _ in range(301)] for _ in range(301)]",
"-",
"-",
"-def rec(i, j, k):",
"- if dp[i][j][k] >= 0:",
"- return dp[i][j][k]",
"- if i == 0 and j == 0 and k == 0:",
"- return 0.0",
"- res = 0.0",
"- if i > 0:",
"- res += rec(i - 1, j, k) * i",
... | false | 1.19746 | 0.042632 | 28.088126 | [
"s273134022",
"s466882275"
] |
u256678932 | p02381 | python | s787273670 | s219395447 | 30 | 20 | 7,764 | 5,716 | Accepted | Accepted | 33.33 | import math
while True:
n = int(eval(input()))
if 0 == n:
break
points = list(map(int, input().split(' ')))
m = sum(points)/n
s = math.sqrt(sum([ (s - m)**2 for s in points ])/n)
print(('{:.5f}'.format(s))) | from math import sqrt
def sd(nums):
n = len(nums)
ave = sum(nums)/n
return abs(sqrt(sum([(s - ave)**2 for s in nums])/n))
def main():
while True:
n = eval(input())
if n == '0':
break
nums = [int(x) for x in input().split()]
print(("{:f}"... | 13 | 20 | 246 | 374 | import math
while True:
n = int(eval(input()))
if 0 == n:
break
points = list(map(int, input().split(" ")))
m = sum(points) / n
s = math.sqrt(sum([(s - m) ** 2 for s in points]) / n)
print(("{:.5f}".format(s)))
| from math import sqrt
def sd(nums):
n = len(nums)
ave = sum(nums) / n
return abs(sqrt(sum([(s - ave) ** 2 for s in nums]) / n))
def main():
while True:
n = eval(input())
if n == "0":
break
nums = [int(x) for x in input().split()]
print(("{:f}".format(sd(nu... | false | 35 | [
"-import math",
"+from math import sqrt",
"-while True:",
"- n = int(eval(input()))",
"- if 0 == n:",
"- break",
"- points = list(map(int, input().split(\" \")))",
"- m = sum(points) / n",
"- s = math.sqrt(sum([(s - m) ** 2 for s in points]) / n)",
"- print((\"{:.5f}\".for... | false | 0.121985 | 0.041654 | 2.928553 | [
"s787273670",
"s219395447"
] |
u597455618 | p02848 | python | s359748534 | s397537865 | 32 | 19 | 4,468 | 3,060 | Accepted | Accepted | 40.62 | n = int(input())
s = input()
for i in range(len(s)):
print(chr(((ord(s[i])+n)%91)%65+65), end = "")
| n = int(eval(input()))
s = eval(input())
alph = ""
for i in range(26):
alph += chr(65+i)
print((s.translate(str.maketrans(alph, alph[n:] + alph[:n])))) | 4 | 6 | 104 | 144 | n = int(input())
s = input()
for i in range(len(s)):
print(chr(((ord(s[i]) + n) % 91) % 65 + 65), end="")
| n = int(eval(input()))
s = eval(input())
alph = ""
for i in range(26):
alph += chr(65 + i)
print((s.translate(str.maketrans(alph, alph[n:] + alph[:n]))))
| false | 33.333333 | [
"-n = int(input())",
"-s = input()",
"-for i in range(len(s)):",
"- print(chr(((ord(s[i]) + n) % 91) % 65 + 65), end=\"\")",
"+n = int(eval(input()))",
"+s = eval(input())",
"+alph = \"\"",
"+for i in range(26):",
"+ alph += chr(65 + i)",
"+print((s.translate(str.maketrans(alph, alph[n:] + a... | false | 0.034536 | 0.036515 | 0.94582 | [
"s359748534",
"s397537865"
] |
u203669169 | p02759 | python | s711813508 | s301861214 | 37 | 18 | 5,048 | 2,940 | Accepted | Accepted | 51.35 | from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations
... | N = int(eval(input()))
print((int(N / 2 + N % 2))) | 12 | 3 | 393 | 45 | from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations
N = i... | N = int(eval(input()))
print((int(N / 2 + N % 2)))
| false | 75 | [
"-from fractions import gcd",
"-from collections import Counter, deque, defaultdict",
"-from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge",
"-from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort",
"-from itertools import accumulate, product, per... | false | 0.034244 | 0.034475 | 0.993288 | [
"s711813508",
"s301861214"
] |
u332906195 | p02948 | python | s694631375 | s389178323 | 571 | 441 | 18,232 | 26,984 | Accepted | Accepted | 22.77 | import heapq
maxB = 10 ** 1
N, M = list(map(int, input().split()))
AB = []
for _ in range(N):
A, B = list(map(int, input().split()))
AB.append((maxB - B, A))
AB.sort(key=lambda x: x[1])
ans, heap, idx, lAB = 0, [], 0, len(AB)
for i in range(M):
while idx < lAB and AB[idx][1] <= i + 1:
... | import heapq
N, M = list(map(int, input().split()))
AB = {i + 1: [] for i in range(10 ** 5)}
for _ in range(N):
A, B = list(map(int, input().split()))
AB[A].append(B)
ans, h = 0, []
for i in range(1, M + 1):
for b in AB[i]:
heapq.heappush(h, -b)
if len(h) > 0:
ans -= heapq... | 20 | 16 | 442 | 334 | import heapq
maxB = 10**1
N, M = list(map(int, input().split()))
AB = []
for _ in range(N):
A, B = list(map(int, input().split()))
AB.append((maxB - B, A))
AB.sort(key=lambda x: x[1])
ans, heap, idx, lAB = 0, [], 0, len(AB)
for i in range(M):
while idx < lAB and AB[idx][1] <= i + 1:
heapq.heappush(... | import heapq
N, M = list(map(int, input().split()))
AB = {i + 1: [] for i in range(10**5)}
for _ in range(N):
A, B = list(map(int, input().split()))
AB[A].append(B)
ans, h = 0, []
for i in range(1, M + 1):
for b in AB[i]:
heapq.heappush(h, -b)
if len(h) > 0:
ans -= heapq.heappop(h)
prin... | false | 20 | [
"-maxB = 10**1",
"-AB = []",
"+AB = {i + 1: [] for i in range(10**5)}",
"- AB.append((maxB - B, A))",
"-AB.sort(key=lambda x: x[1])",
"-ans, heap, idx, lAB = 0, [], 0, len(AB)",
"-for i in range(M):",
"- while idx < lAB and AB[idx][1] <= i + 1:",
"- heapq.heappush(heap, AB[idx])",
"- ... | false | 0.037877 | 0.09678 | 0.391371 | [
"s694631375",
"s389178323"
] |
u366886346 | p03994 | python | s847741943 | s079913026 | 79 | 65 | 10,100 | 10,228 | Accepted | Accepted | 17.72 | s=eval(input())
k=int(eval(input()))
n=len(s)
num=[0]*n
for i in range(n):
if s[i]!="a":
num[i]=123-ord(s[i])
if sum(num)>=k:
ans=""
for i in range(n-1):
if k>=num[i]:
k-=num[i]
ans+="a"
else:
ans+=s[i]
if k>=num[-1]:
an... | s=eval(input())
k=int(eval(input()))
num=[(123-ord(s[i]))%26 for i in range(len(s))]
ans=""
for i in range(len(s)-1):
if num[i]<=k:
ans+="a"
k-=num[i]
else:
ans+=s[i]
k%=26
if num[-1]<=k:
ans+=chr(97+k-num[-1])
else:
ans+=chr(ord(s[-1])+k)
print(ans)
| 24 | 16 | 451 | 294 | s = eval(input())
k = int(eval(input()))
n = len(s)
num = [0] * n
for i in range(n):
if s[i] != "a":
num[i] = 123 - ord(s[i])
if sum(num) >= k:
ans = ""
for i in range(n - 1):
if k >= num[i]:
k -= num[i]
ans += "a"
else:
ans += s[i]
if k >= num... | s = eval(input())
k = int(eval(input()))
num = [(123 - ord(s[i])) % 26 for i in range(len(s))]
ans = ""
for i in range(len(s) - 1):
if num[i] <= k:
ans += "a"
k -= num[i]
else:
ans += s[i]
k %= 26
if num[-1] <= k:
ans += chr(97 + k - num[-1])
else:
ans += chr(ord(s[-1]) + k)
prin... | false | 33.333333 | [
"-n = len(s)",
"-num = [0] * n",
"-for i in range(n):",
"- if s[i] != \"a\":",
"- num[i] = 123 - ord(s[i])",
"-if sum(num) >= k:",
"- ans = \"\"",
"- for i in range(n - 1):",
"- if k >= num[i]:",
"- k -= num[i]",
"- ans += \"a\"",
"- else:",
... | false | 0.038374 | 0.037625 | 1.019913 | [
"s847741943",
"s079913026"
] |
u994988729 | p03800 | python | s505233824 | s824688076 | 162 | 111 | 5,716 | 4,852 | Accepted | Accepted | 31.48 | N = int(eval(input()))
S = eval(input())
S = S[-1] + S + S[0]
# sheep:1, wolf:0
isOK = False
for x, y in [(1, 1), (1, 0), (0, 1), (0, 0)]:
A = [-1] * len(S)
A[0] = x
A[1] = y
for i in range(1, len(S)-1):
if A[i]: # 羊の場合
A[i + 1] = A[i - 1] if S[i] == "o" else 1 - A[i - ... | from itertools import product
N = int(eval(input()))
S = eval(input())
S += S[0]
def isOK(x, y):
WS = [-1] * (N + 2)
WS[0] = x
WS[1] = y
for i in range(1, N + 1):
if S[i] == "o":
WS[i + 1] = WS[i - 1] if WS[i] else 1 - WS[i - 1]
else:
WS[i + 1] = 1... | 27 | 37 | 598 | 712 | N = int(eval(input()))
S = eval(input())
S = S[-1] + S + S[0]
# sheep:1, wolf:0
isOK = False
for x, y in [(1, 1), (1, 0), (0, 1), (0, 0)]:
A = [-1] * len(S)
A[0] = x
A[1] = y
for i in range(1, len(S) - 1):
if A[i]: # 羊の場合
A[i + 1] = A[i - 1] if S[i] == "o" else 1 - A[i - 1]
... | from itertools import product
N = int(eval(input()))
S = eval(input())
S += S[0]
def isOK(x, y):
WS = [-1] * (N + 2)
WS[0] = x
WS[1] = y
for i in range(1, N + 1):
if S[i] == "o":
WS[i + 1] = WS[i - 1] if WS[i] else 1 - WS[i - 1]
else:
WS[i + 1] = 1 - WS[i - 1] ... | false | 27.027027 | [
"+from itertools import product",
"+",
"-S = S[-1] + S + S[0]",
"-# sheep:1, wolf:0",
"-isOK = False",
"-for x, y in [(1, 1), (1, 0), (0, 1), (0, 0)]:",
"- A = [-1] * len(S)",
"- A[0] = x",
"- A[1] = y",
"- for i in range(1, len(S) - 1):",
"- if A[i]: # 羊の場合",
"- ... | false | 0.123929 | 0.046774 | 2.649541 | [
"s505233824",
"s824688076"
] |
u432551953 | p02792 | python | s633001333 | s884717280 | 300 | 276 | 42,972 | 40,428 | Accepted | Accepted | 8 | import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30
def keta(n):
return len(str(n))
def make(n, l, r):
ans = 0
sn = str(n)
for i in range(5):
if keta(n) > 2+i:
ans += 10 ** i
elif keta(n) == 2 + i... | import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30
from collections import defaultdict
def main():
n = int(input().strip())
d = defaultdict(int)
for i in range(1, n+1):
ds = str(i)
d[(ds[0], ds[-1])] += 1
ans =... | 48 | 24 | 1,122 | 539 | import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30
def keta(n):
return len(str(n))
def make(n, l, r):
ans = 0
sn = str(n)
for i in range(5):
if keta(n) > 2 + i:
ans += 10**i
elif keta(n) == 2 + i:
... | import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30
from collections import defaultdict
def main():
n = int(input().strip())
d = defaultdict(int)
for i in range(1, n + 1):
ds = str(i)
d[(ds[0], ds[-1])] += 1
ans = 0
f... | false | 50 | [
"-",
"-",
"-def keta(n):",
"- return len(str(n))",
"-",
"-",
"-def make(n, l, r):",
"- ans = 0",
"- sn = str(n)",
"- for i in range(5):",
"- if keta(n) > 2 + i:",
"- ans += 10**i",
"- elif keta(n) == 2 + i:",
"- if sn[0] > str(l):",
"- ... | false | 0.109779 | 0.068174 | 1.610281 | [
"s633001333",
"s884717280"
] |
u363610900 | p03448 | python | s699045350 | s007271848 | 54 | 46 | 3,060 | 3,064 | Accepted | Accepted | 14.81 | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
ans = 0
for i in range(A+1):
for j in range(B+1):
for k in range(C+1):
temp = i * 500 + j * 100 + k * 50
if temp == X:
ans += 1
print(ans)
| # -*- coding: utf-8 -*-
A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
def solve(a, b, c):
ans = 0
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
temp = i * 500 + j * 100 + k * 50
if... | 15 | 26 | 276 | 457 | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
ans = 0
for i in range(A + 1):
for j in range(B + 1):
for k in range(C + 1):
temp = i * 500 + j * 100 + k * 50
if temp == X:
ans += 1
print(ans)
| # -*- coding: utf-8 -*-
A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
def solve(a, b, c):
ans = 0
for i in range(a + 1):
for j in range(b + 1):
for k in range(c + 1):
temp = i * 500 + j * 100 + k * 50
if temp == ... | false | 42.307692 | [
"+# -*- coding: utf-8 -*-",
"-ans = 0",
"-for i in range(A + 1):",
"- for j in range(B + 1):",
"- for k in range(C + 1):",
"- temp = i * 500 + j * 100 + k * 50",
"- if temp == X:",
"- ans += 1",
"-print(ans)",
"+",
"+",
"+def solve(a, b, c):",
"... | false | 0.161806 | 0.00789 | 20.507681 | [
"s699045350",
"s007271848"
] |
u599114793 | p02732 | python | s806125124 | s250915527 | 509 | 440 | 44,368 | 111,436 | Accepted | Accepted | 13.56 | n = int(eval(input()))
a = list(map(int,input().split()))
b = dict()
c = dict()
d = dict()
for i in range(n):
if a[i] not in b:
b[a[i]] = 0
b[a[i]] += 1
b = list(b.items())
for i in range(len(b)):
c[b[i][0]] = b[i][1] * (b[i][1]-1) // 2
d[b[i][0]] = (b[i][1]-1) * (b[i][1]-2) // 2
c_... | import collections
n = int(eval(input()))
a = list(map(int,input().split()))
c = collections.Counter(a)
c = list(c.items())
num = 0
nc2 = dict()
n_1c2 = dict()
for i in range(len(c)):
nc2[c[i][0]] = c[i][1] * (c[i][1]-1) // 2
num += c[i][1] * (c[i][1]-1) // 2
n_1c2[c[i][0]] = (c[i][1]-1)*(c[i][1]... | 18 | 16 | 416 | 397 | n = int(eval(input()))
a = list(map(int, input().split()))
b = dict()
c = dict()
d = dict()
for i in range(n):
if a[i] not in b:
b[a[i]] = 0
b[a[i]] += 1
b = list(b.items())
for i in range(len(b)):
c[b[i][0]] = b[i][1] * (b[i][1] - 1) // 2
d[b[i][0]] = (b[i][1] - 1) * (b[i][1] - 2) // 2
c_sum = ... | import collections
n = int(eval(input()))
a = list(map(int, input().split()))
c = collections.Counter(a)
c = list(c.items())
num = 0
nc2 = dict()
n_1c2 = dict()
for i in range(len(c)):
nc2[c[i][0]] = c[i][1] * (c[i][1] - 1) // 2
num += c[i][1] * (c[i][1] - 1) // 2
n_1c2[c[i][0]] = (c[i][1] - 1) * (c[i][1] ... | false | 11.111111 | [
"+import collections",
"+",
"-b = dict()",
"-c = dict()",
"-d = dict()",
"+c = collections.Counter(a)",
"+c = list(c.items())",
"+num = 0",
"+nc2 = dict()",
"+n_1c2 = dict()",
"+for i in range(len(c)):",
"+ nc2[c[i][0]] = c[i][1] * (c[i][1] - 1) // 2",
"+ num += c[i][1] * (c[i][1] - 1)... | false | 0.038698 | 0.038752 | 0.998601 | [
"s806125124",
"s250915527"
] |
u562935282 | p03338 | python | s391846653 | s182952932 | 26 | 24 | 3,444 | 3,772 | Accepted | Accepted | 7.69 | from collections import Counter
N = int(eval(input()))
s = eval(input())
res = 0
for i in range(1, N):
c1 = Counter(s[:i])
c2 = Counter(s[i:])
res = max(res, len(set(c1.keys()) & set(c2.keys())))
print(res)
| from string import ascii_lowercase
n = int(eval(input()))
s = eval(input())
ans = -1
for mid in range(1, n):
# [0, mid), [mid, n)
left = set(s[:mid])
right = set(s[mid:])
cnt = 0
for c in ascii_lowercase:
if c in left and c in right:
cnt += 1
ans = max(ans, ... | 12 | 17 | 221 | 325 | from collections import Counter
N = int(eval(input()))
s = eval(input())
res = 0
for i in range(1, N):
c1 = Counter(s[:i])
c2 = Counter(s[i:])
res = max(res, len(set(c1.keys()) & set(c2.keys())))
print(res)
| from string import ascii_lowercase
n = int(eval(input()))
s = eval(input())
ans = -1
for mid in range(1, n):
# [0, mid), [mid, n)
left = set(s[:mid])
right = set(s[mid:])
cnt = 0
for c in ascii_lowercase:
if c in left and c in right:
cnt += 1
ans = max(ans, cnt)
print(ans)
| false | 29.411765 | [
"-from collections import Counter",
"+from string import ascii_lowercase",
"-N = int(eval(input()))",
"+n = int(eval(input()))",
"-res = 0",
"-for i in range(1, N):",
"- c1 = Counter(s[:i])",
"- c2 = Counter(s[i:])",
"- res = max(res, len(set(c1.keys()) & set(c2.keys())))",
"-print(res)",... | false | 0.04542 | 0.125416 | 0.362155 | [
"s391846653",
"s182952932"
] |
u011062360 | p02773 | python | s811514417 | s728152936 | 963 | 853 | 46,092 | 55,512 | Accepted | Accepted | 11.42 | n = int(eval(input()))
data_list = []
for _ in range(n):
data_list.append(eval(input("")))
data_list_a = set(data_list)
data_list_a = list(data_list_a)
m = len(data_list_a)
data_a = [0 for _ in range(m)]
data_dic = dict(list(zip(data_list_a, data_a)))
for i in range(n):
data_dic[data_list[i]] ... | n = int(eval(input()))
list_S = []
for _ in range(n):
list_S.append(eval(input()))
dic_S = dict()
set_S = set()
for s in list_S:
if s in set_S:
dic_S[s] += 1
else:
dic_S[s] = 1
set_S.add(s)
list_ans = sorted(list(dic_S.items()), key=lambda x:x[1], reverse=True)
a = 0... | 30 | 25 | 550 | 473 | n = int(eval(input()))
data_list = []
for _ in range(n):
data_list.append(eval(input("")))
data_list_a = set(data_list)
data_list_a = list(data_list_a)
m = len(data_list_a)
data_a = [0 for _ in range(m)]
data_dic = dict(list(zip(data_list_a, data_a)))
for i in range(n):
data_dic[data_list[i]] += 1
data_score = ... | n = int(eval(input()))
list_S = []
for _ in range(n):
list_S.append(eval(input()))
dic_S = dict()
set_S = set()
for s in list_S:
if s in set_S:
dic_S[s] += 1
else:
dic_S[s] = 1
set_S.add(s)
list_ans = sorted(list(dic_S.items()), key=lambda x: x[1], reverse=True)
a = 0
ans = []
for i ... | false | 16.666667 | [
"-data_list = []",
"+list_S = []",
"- data_list.append(eval(input(\"\")))",
"-data_list_a = set(data_list)",
"-data_list_a = list(data_list_a)",
"-m = len(data_list_a)",
"-data_a = [0 for _ in range(m)]",
"-data_dic = dict(list(zip(data_list_a, data_a)))",
"-for i in range(n):",
"- data_dic[... | false | 0.047425 | 0.048344 | 0.980983 | [
"s811514417",
"s728152936"
] |
u038243492 | p02397 | python | s299582082 | s881791487 | 30 | 20 | 6,452 | 6,380 | Accepted | Accepted | 33.33 | list = []
while True:
line = input().split(" ")
if line[0] == "0" and line[1] == "0":
break
line = list(map(int, line))
#print line
if line[0] > line[1]:
temp = line[0]
line[0] = line[1]
line[1] = temp
print(" ".join(map(str, line))) | while True:
x, y = list(map(int, input().split()))
if x == 0 and y == 0:
break
else:
if x > y:
print(str(y) + " " + str(x))
else:
print(str(x) + " " + str(y)) | 12 | 9 | 269 | 222 | list = []
while True:
line = input().split(" ")
if line[0] == "0" and line[1] == "0":
break
line = list(map(int, line))
# print line
if line[0] > line[1]:
temp = line[0]
line[0] = line[1]
line[1] = temp
print(" ".join(map(str, line)))
| while True:
x, y = list(map(int, input().split()))
if x == 0 and y == 0:
break
else:
if x > y:
print(str(y) + " " + str(x))
else:
print(str(x) + " " + str(y))
| false | 25 | [
"-list = []",
"- line = input().split(\" \")",
"- if line[0] == \"0\" and line[1] == \"0\":",
"+ x, y = list(map(int, input().split()))",
"+ if x == 0 and y == 0:",
"- line = list(map(int, line))",
"- # print line",
"- if line[0] > line[1]:",
"- temp = line[0]",
"- ... | false | 0.108167 | 0.036634 | 2.952615 | [
"s299582082",
"s881791487"
] |
u120233192 | p02947 | python | s894450730 | s237839537 | 688 | 280 | 44,280 | 26,100 | Accepted | Accepted | 59.3 | # 3.4.3
import re
from collections import deque
from functools import reduce
from itertools import permutations
from math import pi
from operator import itemgetter
from operator import mul
from operator import xor
from os import linesep
from queue import PriorityQueue
from sys import stdin
def rline()... | # 3.4.3
import re
from collections import deque
from functools import reduce
from itertools import permutations
from math import pi
from operator import itemgetter
from operator import mul
from operator import xor
from os import linesep
from queue import PriorityQueue
from sys import stdin
def rline()... | 136 | 133 | 3,023 | 2,932 | # 3.4.3
import re
from collections import deque
from functools import reduce
from itertools import permutations
from math import pi
from operator import itemgetter
from operator import mul
from operator import xor
from os import linesep
from queue import PriorityQueue
from sys import stdin
def rline() -> str:
ret... | # 3.4.3
import re
from collections import deque
from functools import reduce
from itertools import permutations
from math import pi
from operator import itemgetter
from operator import mul
from operator import xor
from os import linesep
from queue import PriorityQueue
from sys import stdin
def rline() -> str:
ret... | false | 2.205882 | [
"- cnt = [0] * 26",
"- for c in s:",
"- cnt[ord(c) - ord(\"a\")] += 1",
"- tup = tuple(i for i in cnt)",
"- if not tup in list(dict.keys()):",
"- dict[tup] = 0",
"- dict[tup] += 1",
"+ k = \"\".join(sorted(list(s)))",
"+ if not k... | false | 0.036173 | 0.036767 | 0.983843 | [
"s894450730",
"s237839537"
] |
u553987207 | p02732 | python | s896045259 | s507738609 | 1,938 | 273 | 121,172 | 26,140 | Accepted | Accepted | 85.91 | from math import factorial
from functools import lru_cache
@lru_cache(maxsize=None)
def cmbcount(n):
if n > 1:
return factorial(n) // (factorial(n - 2) * factorial(2))
return 0
N = int(eval(input()))
A = list(map(int, input().split()))
samecnt = [0] * (N + 1)
for a in A:
samecnt[a] +=... | N = int(eval(input()))
A = list(map(int, input().split()))
c = [0] * (N + 1)
for a in A:
c[a] += 1
total = sum([n * (n - 1) // 2 for n in c])
for a in A:
print((total - (c[a] - 1))) | 22 | 8 | 504 | 188 | from math import factorial
from functools import lru_cache
@lru_cache(maxsize=None)
def cmbcount(n):
if n > 1:
return factorial(n) // (factorial(n - 2) * factorial(2))
return 0
N = int(eval(input()))
A = list(map(int, input().split()))
samecnt = [0] * (N + 1)
for a in A:
samecnt[a] += 1
cnts = [... | N = int(eval(input()))
A = list(map(int, input().split()))
c = [0] * (N + 1)
for a in A:
c[a] += 1
total = sum([n * (n - 1) // 2 for n in c])
for a in A:
print((total - (c[a] - 1)))
| false | 63.636364 | [
"-from math import factorial",
"-from functools import lru_cache",
"-",
"-",
"-@lru_cache(maxsize=None)",
"-def cmbcount(n):",
"- if n > 1:",
"- return factorial(n) // (factorial(n - 2) * factorial(2))",
"- return 0",
"-",
"-",
"-samecnt = [0] * (N + 1)",
"+c = [0] * (N + 1)",
... | false | 0.039503 | 0.106438 | 0.371134 | [
"s896045259",
"s507738609"
] |
u133936772 | p02715 | python | s878280367 | s756101124 | 270 | 197 | 11,304 | 11,920 | Accepted | Accepted | 27.04 | M=10**9+7
n,k=list(map(int,input().split()))
l=[0]*(k+1)
a=0
for i in range(k,0,-1):
l[i]=pow(k//i,n,M)-sum(l[j] for j in range(i*2,k+1,i))
a+=i*l[i]
print((a%M)) | M=10**9+7
n,k=list(map(int,input().split()))
l=[0]*(k+1)
a=0
for i in range(k,0,-1):
l[i]=pow(k//i,n,M)-sum(l[::i])
a+=i*l[i]
print((a%M)) | 8 | 8 | 165 | 141 | M = 10**9 + 7
n, k = list(map(int, input().split()))
l = [0] * (k + 1)
a = 0
for i in range(k, 0, -1):
l[i] = pow(k // i, n, M) - sum(l[j] for j in range(i * 2, k + 1, i))
a += i * l[i]
print((a % M))
| M = 10**9 + 7
n, k = list(map(int, input().split()))
l = [0] * (k + 1)
a = 0
for i in range(k, 0, -1):
l[i] = pow(k // i, n, M) - sum(l[::i])
a += i * l[i]
print((a % M))
| false | 0 | [
"- l[i] = pow(k // i, n, M) - sum(l[j] for j in range(i * 2, k + 1, i))",
"+ l[i] = pow(k // i, n, M) - sum(l[::i])"
] | false | 0.401331 | 0.354279 | 1.13281 | [
"s878280367",
"s756101124"
] |
u832526214 | p02661 | python | s402538504 | s916165026 | 461 | 208 | 25,352 | 55,376 | Accepted | Accepted | 54.88 | n = int(eval(input()))
a = []
b = []
for i in range(n):
a_1, b_1 = input().split()
a.append(int(a_1))
b.append(int(b_1))
a.sort()
b.sort()
is_odds = n % 2 == 0
if n % 2 == 0:
print((b[n // 2 - 1] + b[n // 2] - a[n // 2 - 1] - a[n // 2] + 1))
else:
print((b[(n + 1) // 2 - 1] - a[(n + 1) // 2 - 1] + 1)) | n, *AB = list(map(int, open(0).read().split()))
a = sorted(AB[::2])
b = sorted(AB[1::2])
is_odds = n % 2 == 0
if n % 2 == 0:
print((b[n // 2 - 1] + b[n // 2] - a[n // 2 - 1] - a[n // 2] + 1))
else:
print((b[(n + 1) // 2 - 1] - a[(n + 1) // 2 - 1] + 1)) | 14 | 8 | 310 | 251 | n = int(eval(input()))
a = []
b = []
for i in range(n):
a_1, b_1 = input().split()
a.append(int(a_1))
b.append(int(b_1))
a.sort()
b.sort()
is_odds = n % 2 == 0
if n % 2 == 0:
print((b[n // 2 - 1] + b[n // 2] - a[n // 2 - 1] - a[n // 2] + 1))
else:
print((b[(n + 1) // 2 - 1] - a[(n + 1) // 2 - 1] + 1... | n, *AB = list(map(int, open(0).read().split()))
a = sorted(AB[::2])
b = sorted(AB[1::2])
is_odds = n % 2 == 0
if n % 2 == 0:
print((b[n // 2 - 1] + b[n // 2] - a[n // 2 - 1] - a[n // 2] + 1))
else:
print((b[(n + 1) // 2 - 1] - a[(n + 1) // 2 - 1] + 1))
| false | 42.857143 | [
"-n = int(eval(input()))",
"-a = []",
"-b = []",
"-for i in range(n):",
"- a_1, b_1 = input().split()",
"- a.append(int(a_1))",
"- b.append(int(b_1))",
"-a.sort()",
"-b.sort()",
"+n, *AB = list(map(int, open(0).read().split()))",
"+a = sorted(AB[::2])",
"+b = sorted(AB[1::2])"
] | false | 0.039724 | 0.041638 | 0.954051 | [
"s402538504",
"s916165026"
] |
u785220618 | p03329 | python | s218837901 | s168293205 | 1,199 | 1,077 | 3,864 | 3,864 | Accepted | Accepted | 10.18 | # -*- coding: utf-8 -*-
N = int(eval(input()))
A = [1]
i = 1
while 6 ** i <= 100000:
A.append(6 ** i)
i += 1
j = 1
while 9 ** j <= 100000:
A.append(9 ** j)
j += 1
A.sort()
table = [1000000 for _ in range(N + 1)]
table[0] = 0
for i in range(1, N+1):
a = 0
while 6 ** a <= i... | # -*- coding: utf-8 -*-
N = int(eval(input()))
A = [1]
i = 1
while 6 ** i <= 100000:
A.append(6 ** i)
i += 1
j = 1
while 9 ** j <= 100000:
A.append(9 ** j)
j += 1
A.sort() # 引き出せる金額のリスト
table = [1000000 for _ in range(N + 1)] # i円を引き出す最小の操作回数をメモ、参照するのは常に前の値なのでループを回せる
table[0] = 0
... | 29 | 29 | 516 | 632 | # -*- coding: utf-8 -*-
N = int(eval(input()))
A = [1]
i = 1
while 6**i <= 100000:
A.append(6**i)
i += 1
j = 1
while 9**j <= 100000:
A.append(9**j)
j += 1
A.sort()
table = [1000000 for _ in range(N + 1)]
table[0] = 0
for i in range(1, N + 1):
a = 0
while 6**a <= i:
table[i] = min(table[i... | # -*- coding: utf-8 -*-
N = int(eval(input()))
A = [1]
i = 1
while 6**i <= 100000:
A.append(6**i)
i += 1
j = 1
while 9**j <= 100000:
A.append(9**j)
j += 1
A.sort() # 引き出せる金額のリスト
table = [1000000 for _ in range(N + 1)] # i円を引き出す最小の操作回数をメモ、参照するのは常に前の値なのでループを回せる
table[0] = 0
for i in range(1, N + 1):
... | false | 0 | [
"-A.sort()",
"-table = [1000000 for _ in range(N + 1)]",
"+A.sort() # 引き出せる金額のリスト",
"+table = [1000000 for _ in range(N + 1)] # i円を引き出す最小の操作回数をメモ、参照するのは常に前の値なのでループを回せる",
"- table[i] = min(table[i], table[i - 6**a] + 1)",
"+ table[i] = min(table[i], table[i - 6**a] + 1) # 1円,6円,36円,...を使って... | false | 0.356373 | 0.159539 | 2.233768 | [
"s218837901",
"s168293205"
] |
u952708174 | p03599 | python | s256868249 | s893072109 | 1,266 | 68 | 3,188 | 3,188 | Accepted | Accepted | 94.63 | def c_sugar_water(A, B, C, D, E, F):
x = set() # 水の量が取りうるパターン
y = set() # 砂糖の量が取りうるパターン
for i in range(F // 100 + 1):
for j in range(F // 100 + 1):
tmp = 100 * A * i + 100 * B * j
if tmp <= F:
x.add(tmp)
for i in range(F):
for j in range... | def c_sugar_water(A, B, C, D, E, F):
x = set() # 水の量が取りうるパターン
y = set() # 砂糖の量が取りうるパターン
for i in range(F // 100 + 1):
for j in range(F // 100 + 1):
tmp = 100 * A * i + 100 * B * j
if tmp <= F:
x.add(tmp)
else:
break # A,... | 36 | 37 | 1,170 | 1,244 | def c_sugar_water(A, B, C, D, E, F):
x = set() # 水の量が取りうるパターン
y = set() # 砂糖の量が取りうるパターン
for i in range(F // 100 + 1):
for j in range(F // 100 + 1):
tmp = 100 * A * i + 100 * B * j
if tmp <= F:
x.add(tmp)
for i in range(F):
for j in range(F):
... | def c_sugar_water(A, B, C, D, E, F):
x = set() # 水の量が取りうるパターン
y = set() # 砂糖の量が取りうるパターン
for i in range(F // 100 + 1):
for j in range(F // 100 + 1):
tmp = 100 * A * i + 100 * B * j
if tmp <= F:
x.add(tmp)
else:
break # A, Bは正整数なので... | false | 2.702703 | [
"+ else:",
"+ break # A, Bは正整数なので、Fを超えるようなjの値にする意味がない",
"+ else:",
"+ break",
"- # 水も砂糖も入れないパターン",
"- continue",
"+ continue # 水も砂糖も入れていない",
"- # 砂糖を溶かしきれない",
"- continue"... | false | 0.657666 | 0.045687 | 14.395182 | [
"s256868249",
"s893072109"
] |
u357218223 | p03207 | python | s025901808 | s850668975 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | # coding: utf-8
N = int(eval(input()))
p = [ int(eval(input())) for _ in range(N)]
m = max(p)//2
p[p.index(max(p))] = 0
print((sum(p)+m)) | # coding: utf-8
p = [ int(eval(input())) for _ in range(int(eval(input())))]
print((sum(p)-max(p)//2)) | 6 | 3 | 128 | 90 | # coding: utf-8
N = int(eval(input()))
p = [int(eval(input())) for _ in range(N)]
m = max(p) // 2
p[p.index(max(p))] = 0
print((sum(p) + m))
| # coding: utf-8
p = [int(eval(input())) for _ in range(int(eval(input())))]
print((sum(p) - max(p) // 2))
| false | 50 | [
"-N = int(eval(input()))",
"-p = [int(eval(input())) for _ in range(N)]",
"-m = max(p) // 2",
"-p[p.index(max(p))] = 0",
"-print((sum(p) + m))",
"+p = [int(eval(input())) for _ in range(int(eval(input())))]",
"+print((sum(p) - max(p) // 2))"
] | false | 0.080723 | 0.035818 | 2.253712 | [
"s025901808",
"s850668975"
] |
u111365362 | p03061 | python | s380837485 | s828060045 | 393 | 270 | 14,436 | 14,080 | Accepted | Accepted | 31.3 | n = int(eval(input()))
a = list(map(int,input().split()))
ans1 = a[1]
for i in range(1,n):
big,sml = a[i],ans1
while sml != 0:
big,sml = sml,big%sml
ans1 = big
ans2 = a[-2]
for i in range(n-1):
big,sml = a[i],ans2
while sml != 0:
big,sml = sml,big%sml
ans2 = big
l1 = [-1]
now = a[0]
... | #14:10
n = int(eval(input()))
a = list(map(int,input().split()))
b = []
for i in range(n):
if i == 0:
b.append(a[i])
else:
big = b[-1]
sml = a[i]
while sml != 0:
big,sml = sml,big%sml
b.append(big)
c = []
for j in range(n)[::-1]:
if j == n-1:
c.append(a[j])
else:
... | 51 | 40 | 987 | 691 | n = int(eval(input()))
a = list(map(int, input().split()))
ans1 = a[1]
for i in range(1, n):
big, sml = a[i], ans1
while sml != 0:
big, sml = sml, big % sml
ans1 = big
ans2 = a[-2]
for i in range(n - 1):
big, sml = a[i], ans2
while sml != 0:
big, sml = sml, big % sml
ans2 = big
l... | # 14:10
n = int(eval(input()))
a = list(map(int, input().split()))
b = []
for i in range(n):
if i == 0:
b.append(a[i])
else:
big = b[-1]
sml = a[i]
while sml != 0:
big, sml = sml, big % sml
b.append(big)
c = []
for j in range(n)[::-1]:
if j == n - 1:
... | false | 21.568627 | [
"+# 14:10",
"-ans1 = a[1]",
"-for i in range(1, n):",
"- big, sml = a[i], ans1",
"- while sml != 0:",
"- big, sml = sml, big % sml",
"- ans1 = big",
"-ans2 = a[-2]",
"-for i in range(n - 1):",
"- big, sml = a[i], ans2",
"- while sml != 0:",
"- big, sml = sml, big %... | false | 0.043512 | 0.035709 | 1.218514 | [
"s380837485",
"s828060045"
] |
u531631168 | p02725 | python | s886512017 | s544224157 | 279 | 164 | 26,444 | 26,444 | Accepted | Accepted | 41.22 | k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
a2 = a + [aa + k for aa in a]
max_inter = 0
for i in range(n*2 - 1):
max_inter = max(max_inter, a2[i+1] - a2[i])
print((k - max_inter)) | k, n = list(map(int, input().split()))
arr = list(map(int, input().split()))
max_inter = 0
max_inter = max(max_inter, arr[0]+k - arr[-1])
for i in range(n-1):
max_inter = max(max_inter, arr[i+1] - arr[i])
print((k - max_inter)) | 7 | 7 | 212 | 229 | k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
a2 = a + [aa + k for aa in a]
max_inter = 0
for i in range(n * 2 - 1):
max_inter = max(max_inter, a2[i + 1] - a2[i])
print((k - max_inter))
| k, n = list(map(int, input().split()))
arr = list(map(int, input().split()))
max_inter = 0
max_inter = max(max_inter, arr[0] + k - arr[-1])
for i in range(n - 1):
max_inter = max(max_inter, arr[i + 1] - arr[i])
print((k - max_inter))
| false | 0 | [
"-a = list(map(int, input().split()))",
"-a2 = a + [aa + k for aa in a]",
"+arr = list(map(int, input().split()))",
"-for i in range(n * 2 - 1):",
"- max_inter = max(max_inter, a2[i + 1] - a2[i])",
"+max_inter = max(max_inter, arr[0] + k - arr[-1])",
"+for i in range(n - 1):",
"+ max_inter = max... | false | 0.048901 | 0.036007 | 1.358088 | [
"s886512017",
"s544224157"
] |
u058781705 | p03292 | python | s730752993 | s804465419 | 187 | 62 | 38,384 | 61,688 | Accepted | Accepted | 66.84 |
def solve():
As = list(map(int, input().split()))
print((max(As)-min(As)))
# Solve
if __name__ == "__main__":
solve()
| alist = list(map(int, input().split()))
print((max(alist)-min(alist)))
| 10 | 3 | 141 | 72 | def solve():
As = list(map(int, input().split()))
print((max(As) - min(As)))
# Solve
if __name__ == "__main__":
solve()
| alist = list(map(int, input().split()))
print((max(alist) - min(alist)))
| false | 70 | [
"-def solve():",
"- As = list(map(int, input().split()))",
"- print((max(As) - min(As)))",
"-",
"-",
"-# Solve",
"-if __name__ == \"__main__\":",
"- solve()",
"+alist = list(map(int, input().split()))",
"+print((max(alist) - min(alist)))"
] | false | 0.036994 | 0.03779 | 0.978931 | [
"s730752993",
"s804465419"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.