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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u786020649 | p03600 | python | s504465806 | s036041832 | 360 | 330 | 84,792 | 84,376 | Accepted | Accepted | 8.33 | import sys
from copy import deepcopy
import numpy as np
readline=sys.stdin.readline
read=sys.stdin.read
def main():
n=int(readline())
a=np.array([list(map(int,l.split())) for l in read().splitlines()])
cost=deepcopy(a)
for k in range(n):
arr=np.stack([cost,[cost[k]]+np.transpose([cos... | import sys
from copy import deepcopy
import numpy as np
readline=sys.stdin.readline
read=sys.stdin.read
def main():
n=int(readline())
a=np.array([list(map(int,l.split())) for l in read().splitlines()])
cost=deepcopy(a)
for k in range(n):
arr=np.stack([cost,[cost[k]]+np.transpose([cos... | 23 | 22 | 615 | 592 | import sys
from copy import deepcopy
import numpy as np
readline = sys.stdin.readline
read = sys.stdin.read
def main():
n = int(readline())
a = np.array([list(map(int, l.split())) for l in read().splitlines()])
cost = deepcopy(a)
for k in range(n):
arr = np.stack([cost, [cost[k]] + np.transpo... | import sys
from copy import deepcopy
import numpy as np
readline = sys.stdin.readline
read = sys.stdin.read
def main():
n = int(readline())
a = np.array([list(map(int, l.split())) for l in read().splitlines()])
cost = deepcopy(a)
for k in range(n):
arr = np.stack([cost, [cost[k]] + np.transpo... | false | 4.347826 | [
"- cost2 = deepcopy(a)"
] | false | 0.206158 | 0.205335 | 1.004005 | [
"s504465806",
"s036041832"
] |
u077337864 | p03426 | python | s002270284 | s538846508 | 978 | 420 | 22,932 | 55,676 | Accepted | Accepted | 57.06 | h, w, d = list(map(int, input().split()))
amd = {}
for i in range(h):
al = list(map(int, input().split()))
for j, a in enumerate(al):
amd[a] = (j+1, i+1)
dsum = [0 for _ in range(d+1)]
for i in range(d+1, h*w+1):
dsum.append(dsum[-d] + abs(amd[i][0]-amd[i-d][0]) + abs(amd[i][1]-amd[i-d][1]))
q = ... | import sys
input = sys.stdin.readline
def main():
h, w, d = list(map(int, input().split()))
axy = [None for _ in range(h*w+1)]
for y in range(h):
for x, a in enumerate(map(int, input().split())):
axy[a] = (x, y)
dlist = [0 for _ in range(h*w+1)]
for a in range(d+1, h*w+1):
dlist[a]... | 16 | 22 | 415 | 546 | h, w, d = list(map(int, input().split()))
amd = {}
for i in range(h):
al = list(map(int, input().split()))
for j, a in enumerate(al):
amd[a] = (j + 1, i + 1)
dsum = [0 for _ in range(d + 1)]
for i in range(d + 1, h * w + 1):
dsum.append(
dsum[-d] + abs(amd[i][0] - amd[i - d][0]) + abs(amd[i]... | import sys
input = sys.stdin.readline
def main():
h, w, d = list(map(int, input().split()))
axy = [None for _ in range(h * w + 1)]
for y in range(h):
for x, a in enumerate(map(int, input().split())):
axy[a] = (x, y)
dlist = [0 for _ in range(h * w + 1)]
for a in range(d + 1, h... | false | 27.272727 | [
"-h, w, d = list(map(int, input().split()))",
"-amd = {}",
"-for i in range(h):",
"- al = list(map(int, input().split()))",
"- for j, a in enumerate(al):",
"- amd[a] = (j + 1, i + 1)",
"-dsum = [0 for _ in range(d + 1)]",
"-for i in range(d + 1, h * w + 1):",
"- dsum.append(",
"- ... | false | 0.037984 | 0.108257 | 0.350864 | [
"s002270284",
"s538846508"
] |
u424768586 | p02781 | python | s502815065 | s925524919 | 279 | 194 | 60,908 | 40,304 | Accepted | Accepted | 30.47 | import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from co... | import sys
def input():
x=sys.stdin.readline()
return x[:-1] if x[-1]=="\n" else x
#ABC145-E
def kdp(s,K):#s(str)以下の非負整数で条件をK桁満たすものの個数
#K: 条件を満たすべき桁数 O(桁数*条件を満たすべき桁数*10)
#mod = 1000000007
keta=len(s)
dp=[[[0,0] for _ in range(K+1)] for _ in range(keta+1)]
#dp[i][j][k]前から... | 89 | 42 | 2,961 | 1,126 | import sys
sys.setrecursionlimit(10**7) # 再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right # 2分探索
# bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from co... | import sys
def input():
x = sys.stdin.readline()
return x[:-1] if x[-1] == "\n" else x
# ABC145-E
def kdp(s, K): # s(str)以下の非負整数で条件をK桁満たすものの個数
# K: 条件を満たすべき桁数 O(桁数*条件を満たすべき桁数*10)
# mod = 1000000007
keta = len(s)
dp = [[[0, 0] for _ in range(K + 1)] for _ in range(keta + 1)]
# dp[i][j][k... | false | 52.808989 | [
"-",
"-sys.setrecursionlimit(10**7) # 再帰関数の上限,10**5以上の場合python",
"-import math",
"-from copy import copy, deepcopy",
"-from copy import deepcopy as dcp",
"-from operator import itemgetter",
"-from bisect import bisect_left, bisect, bisect_right # 2分探索",
"-",
"-# bisect_left(l,x), bisect(l,x)#aはソート... | false | 0.061031 | 0.038634 | 1.579734 | [
"s502815065",
"s925524919"
] |
u158899997 | p03478 | python | s857553374 | s784848575 | 208 | 30 | 41,068 | 3,296 | Accepted | Accepted | 85.58 | def main():
N, A, B = list(map(int,input().split()))
#print('N:%d A:%d B: %d' % (N,A,B))
answer = []
for i in range(N+1):
s = sum( map(int,list(str(i)) )) # list of int -> sum
if s >= A and s <= B: answer.append(i)
#print('i:%d s:%d' % (i,s))
print((sum(answer)))
... | import sys
def main():
input = sys.stdin.readline()
N, A, B = list(map(int,input.split()))
#print('N:%d A:%d B: %d' % (N,A,B))
answer = []
for i in range(N+1):
s = sum( map(int,list(str(i)) )) # list of int -> sum
if s >= A and s <= B: answer.append(i)
#print('i:%... | 13 | 15 | 352 | 396 | def main():
N, A, B = list(map(int, input().split()))
# print('N:%d A:%d B: %d' % (N,A,B))
answer = []
for i in range(N + 1):
s = sum(map(int, list(str(i)))) # list of int -> sum
if s >= A and s <= B:
answer.append(i)
# print('i:%d s:%d' % (i,s))
print((sum(answe... | import sys
def main():
input = sys.stdin.readline()
N, A, B = list(map(int, input.split()))
# print('N:%d A:%d B: %d' % (N,A,B))
answer = []
for i in range(N + 1):
s = sum(map(int, list(str(i)))) # list of int -> sum
if s >= A and s <= B:
answer.append(i)
# pri... | false | 13.333333 | [
"+import sys",
"+",
"+",
"- N, A, B = list(map(int, input().split()))",
"+ input = sys.stdin.readline()",
"+ N, A, B = list(map(int, input.split()))"
] | false | 0.054875 | 0.036966 | 1.484475 | [
"s857553374",
"s784848575"
] |
u899308536 | p02775 | python | s302640186 | s724770513 | 1,731 | 1,071 | 5,492 | 13,632 | Accepted | Accepted | 38.13 | N = eval(input())
n = len(N)
a = int(N[0])
b = 11-int(N[0])
for i in range(n-1):
a1 = min(a+int(N[i+1]), b+int(N[i+1]))
b1 = min(a+11-int(N[i+1]), b+9-int(N[i+1]))
a = a1
b = b1
print((min(a,b))) | N = [int(s) for s in eval(input())]
n = len(N)
a = 0
b = 11
for n in N:
a1 = min(a+n, b+n)
b1 = min(a+11-n, b+9-n)
a = a1
b = b1
print((min(a,b))) | 10 | 10 | 212 | 163 | N = eval(input())
n = len(N)
a = int(N[0])
b = 11 - int(N[0])
for i in range(n - 1):
a1 = min(a + int(N[i + 1]), b + int(N[i + 1]))
b1 = min(a + 11 - int(N[i + 1]), b + 9 - int(N[i + 1]))
a = a1
b = b1
print((min(a, b)))
| N = [int(s) for s in eval(input())]
n = len(N)
a = 0
b = 11
for n in N:
a1 = min(a + n, b + n)
b1 = min(a + 11 - n, b + 9 - n)
a = a1
b = b1
print((min(a, b)))
| false | 0 | [
"-N = eval(input())",
"+N = [int(s) for s in eval(input())]",
"-a = int(N[0])",
"-b = 11 - int(N[0])",
"-for i in range(n - 1):",
"- a1 = min(a + int(N[i + 1]), b + int(N[i + 1]))",
"- b1 = min(a + 11 - int(N[i + 1]), b + 9 - int(N[i + 1]))",
"+a = 0",
"+b = 11",
"+for n in N:",
"+ a1 =... | false | 0.046686 | 0.086557 | 0.539364 | [
"s302640186",
"s724770513"
] |
u165368960 | p02887 | python | s393742742 | s226366844 | 42 | 36 | 3,956 | 3,956 | Accepted | Accepted | 14.29 | n = int(eval(input()))
s = list(eval(input()))
ans = s[0]
for x in s:
if x != ans[-1]:
ans += x
print((len(ans))) | n = int(eval(input()))
s = eval(input())
list1 = [s[0]]
for x in s:
if x != list1[-1]:
list1.append(x)
print((len(list1))) | 9 | 9 | 115 | 128 | n = int(eval(input()))
s = list(eval(input()))
ans = s[0]
for x in s:
if x != ans[-1]:
ans += x
print((len(ans)))
| n = int(eval(input()))
s = eval(input())
list1 = [s[0]]
for x in s:
if x != list1[-1]:
list1.append(x)
print((len(list1)))
| false | 0 | [
"-s = list(eval(input()))",
"-ans = s[0]",
"+s = eval(input())",
"+list1 = [s[0]]",
"- if x != ans[-1]:",
"- ans += x",
"-print((len(ans)))",
"+ if x != list1[-1]:",
"+ list1.append(x)",
"+print((len(list1)))"
] | false | 0.140055 | 0.00786 | 17.819235 | [
"s393742742",
"s226366844"
] |
u414376763 | p02613 | python | s410463444 | s451980155 | 158 | 138 | 9,204 | 16,108 | Accepted | Accepted | 12.66 | ac = 0
wa = 0
tle = 0
re = 0
n = int(eval(input()))
for i in range(n):
s = str(eval(input()))
if s == 'AC':
ac += 1
elif s == 'WA':
wa += 1
elif s == 'TLE':
tle += 1
elif s == 'RE':
re += 1
print(('AC','x',ac))
print(('WA','x',wa))
print(('TLE','x',tle))
print(('RE','... | n = int(eval(input()))
s = [eval(input()) for i in range(n)]
a = ["AC","WA","TLE","RE"]
for i in a:
print((i,'x',s.count(i))) | 22 | 5 | 308 | 117 | ac = 0
wa = 0
tle = 0
re = 0
n = int(eval(input()))
for i in range(n):
s = str(eval(input()))
if s == "AC":
ac += 1
elif s == "WA":
wa += 1
elif s == "TLE":
tle += 1
elif s == "RE":
re += 1
print(("AC", "x", ac))
print(("WA", "x", wa))
print(("TLE", "x", tle))
print((... | n = int(eval(input()))
s = [eval(input()) for i in range(n)]
a = ["AC", "WA", "TLE", "RE"]
for i in a:
print((i, "x", s.count(i)))
| false | 77.272727 | [
"-ac = 0",
"-wa = 0",
"-tle = 0",
"-re = 0",
"-for i in range(n):",
"- s = str(eval(input()))",
"- if s == \"AC\":",
"- ac += 1",
"- elif s == \"WA\":",
"- wa += 1",
"- elif s == \"TLE\":",
"- tle += 1",
"- elif s == \"RE\":",
"- re += 1",
"-pri... | false | 0.041914 | 0.043347 | 0.966945 | [
"s410463444",
"s451980155"
] |
u096128910 | p02881 | python | s104484252 | s987616882 | 276 | 126 | 40,940 | 66,508 | Accepted | Accepted | 54.35 | n = int(eval(input()))
a = n - 1
p = 1
for c in range(2, int((n ** 0.5) * 2)):
if p % 2 == 1 and c > (n ** 0.5):
break
if n % c == 0:
p = c
w = int(n / c)
if (w + c - 2) < a:
a = (w + c -2)
else:
continue
else:
continue
p... | N = int(eval(input()))
ans = N - 1
p = 1
for i in range(2, int((N ** 0.5) + 1)):
if p % 2 == 1 and i > (N ** 0.5):
break
if N % i == 0:
p = i
j = N // i
m = i + j - 2
if m < ans:
ans = m
else:
continue
else:
conti... | 16 | 17 | 322 | 330 | n = int(eval(input()))
a = n - 1
p = 1
for c in range(2, int((n**0.5) * 2)):
if p % 2 == 1 and c > (n**0.5):
break
if n % c == 0:
p = c
w = int(n / c)
if (w + c - 2) < a:
a = w + c - 2
else:
continue
else:
continue
print(a)
| N = int(eval(input()))
ans = N - 1
p = 1
for i in range(2, int((N**0.5) + 1)):
if p % 2 == 1 and i > (N**0.5):
break
if N % i == 0:
p = i
j = N // i
m = i + j - 2
if m < ans:
ans = m
else:
continue
else:
continue
print(ans)
| false | 5.882353 | [
"-n = int(eval(input()))",
"-a = n - 1",
"+N = int(eval(input()))",
"+ans = N - 1",
"-for c in range(2, int((n**0.5) * 2)):",
"- if p % 2 == 1 and c > (n**0.5):",
"+for i in range(2, int((N**0.5) + 1)):",
"+ if p % 2 == 1 and i > (N**0.5):",
"- if n % c == 0:",
"- p = c",
"- ... | false | 0.059049 | 0.128235 | 0.460473 | [
"s104484252",
"s987616882"
] |
u077291787 | p03800 | python | s600263369 | s398893475 | 116 | 103 | 4,852 | 4,852 | Accepted | Accepted | 11.21 | # ARC069D - Menagerie (ABC055D)
def check(a: int, b: int) -> list:
ret, cur, prev = [], a, b
for i in S:
ret += [cur]
if cur ^ (i == "o"): # oSo or oWx
prev, cur = cur, prev ^ 1 # both neighbors are different
else: # oSx or oWo
prev, cur = cur, prev # ... | # ARC069D - Menagerie (ABC055D)
def check(a: int, b: int) -> list:
ret, cur, prev = [], a, b
for i in S:
ret += [cur]
if cur ^ (i == "o"): # oSo or oWx
prev, cur = cur, prev ^ 1 # both neighbors are different
else: # oSx or oWo
prev, cur = cur, prev # ... | 28 | 29 | 777 | 798 | # ARC069D - Menagerie (ABC055D)
def check(a: int, b: int) -> list:
ret, cur, prev = [], a, b
for i in S:
ret += [cur]
if cur ^ (i == "o"): # oSo or oWx
prev, cur = cur, prev ^ 1 # both neighbors are different
else: # oSx or oWo
prev, cur = cur, prev # both are... | # ARC069D - Menagerie (ABC055D)
def check(a: int, b: int) -> list:
ret, cur, prev = [], a, b
for i in S:
ret += [cur]
if cur ^ (i == "o"): # oSo or oWx
prev, cur = cur, prev ^ 1 # both neighbors are different
else: # oSx or oWo
prev, cur = cur, prev # both are... | false | 3.448276 | [
"- ans = check(a, b)",
"- if ans:",
"- print((\"\".join(\"S\" if i else \"W\" for i in ans)))",
"+ x = check(a, b)",
"+ if x:",
"+ ans = \"\".join(\"S\" if i else \"W\" for i in x)",
"+ print(ans)"
] | false | 0.041065 | 0.043359 | 0.947093 | [
"s600263369",
"s398893475"
] |
u988916215 | p02912 | python | s615286488 | s034725554 | 837 | 434 | 139,212 | 73,196 | Accepted | Accepted | 48.15 | # coding: utf-8
# Your code here!
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
l = []
for i in range(N):
num = A[i]
while num > 0:
l.append(num)
num = int(num / 2)
l.sort(reverse = True)
s = sum(A)
p = 0
if len(l) >= M:
for i in range(M):
... | # coding: utf-8
# Your code here!
import heapq
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
A = list([x*(-1) for x in A]) #各要素を-1倍
heapq.heapify(A)
for i in range(M):
tmp_min = heapq.heappop(A)
heapq.heappush(A,int(tmp_min / 2))
print((-sum(A))) | 25 | 14 | 392 | 297 | # coding: utf-8
# Your code here!
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
l = []
for i in range(N):
num = A[i]
while num > 0:
l.append(num)
num = int(num / 2)
l.sort(reverse=True)
s = sum(A)
p = 0
if len(l) >= M:
for i in range(M):
p += l[i] - int(l... | # coding: utf-8
# Your code here!
import heapq
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A = list([x * (-1) for x in A]) # 各要素を-1倍
heapq.heapify(A)
for i in range(M):
tmp_min = heapq.heappop(A)
heapq.heappush(A, int(tmp_min / 2))
print((-sum(A)))
| false | 44 | [
"+import heapq",
"+",
"-l = []",
"-for i in range(N):",
"- num = A[i]",
"- while num > 0:",
"- l.append(num)",
"- num = int(num / 2)",
"-l.sort(reverse=True)",
"-s = sum(A)",
"-p = 0",
"-if len(l) >= M:",
"- for i in range(M):",
"- p += l[i] - int(l[i] / 2)",
... | false | 0.062524 | 0.108238 | 0.577657 | [
"s615286488",
"s034725554"
] |
u882460931 | p02913 | python | s559473718 | s618104047 | 1,725 | 341 | 429,832 | 135,644 | Accepted | Accepted | 80.23 | N = int(eval(input()))
S = eval(input())
dp = [[None for j in range(N)] for i in range(N)]
vlen = 0
for i in range(N-1):
for j in range(i + 1, N):
if S[i] != S[j]:
dp[i][j] = 0
elif i - 1 >= 0 and j - 1 >= 0:
dp[i][j] = dp[i - 1][j - 1] + 1
else:
... | N = int(eval(input()))
S = eval(input())
def check(vlen):
part = set()
for l1 in range(N - vlen * 2 + 1):
part.add(S[l1:l1 + vlen])
l2 = l1 + vlen
if S[l2:l2 + vlen] in part:
return True
return False
oklen = 0
nglen = N // 2 + 1
while nglen - oklen >... | 16 | 24 | 409 | 443 | N = int(eval(input()))
S = eval(input())
dp = [[None for j in range(N)] for i in range(N)]
vlen = 0
for i in range(N - 1):
for j in range(i + 1, N):
if S[i] != S[j]:
dp[i][j] = 0
elif i - 1 >= 0 and j - 1 >= 0:
dp[i][j] = dp[i - 1][j - 1] + 1
else:
dp[i][j... | N = int(eval(input()))
S = eval(input())
def check(vlen):
part = set()
for l1 in range(N - vlen * 2 + 1):
part.add(S[l1 : l1 + vlen])
l2 = l1 + vlen
if S[l2 : l2 + vlen] in part:
return True
return False
oklen = 0
nglen = N // 2 + 1
while nglen - oklen > 1:
midlen... | false | 33.333333 | [
"-dp = [[None for j in range(N)] for i in range(N)]",
"-vlen = 0",
"-for i in range(N - 1):",
"- for j in range(i + 1, N):",
"- if S[i] != S[j]:",
"- dp[i][j] = 0",
"- elif i - 1 >= 0 and j - 1 >= 0:",
"- dp[i][j] = dp[i - 1][j - 1] + 1",
"- else:",
"-... | false | 0.073043 | 0.036259 | 2.01446 | [
"s559473718",
"s618104047"
] |
u094191970 | p03611 | python | s455277603 | s840708317 | 179 | 165 | 14,564 | 14,564 | Accepted | Accepted | 7.82 | from collections import Counter
n=int(eval(input()))
a=list(map(int,input().split()))
a_max=max(a)
c=Counter(a)
ans=0
for i in range(a_max+1):
ans=max(ans,c[i]+c[i+1]+c[i+2])
print(ans) | from collections import Counter
n=int(eval(input()))
a=list(map(int,input().split()))
min_v=min(a)
max_v=max(a)
c=Counter(a)
ans=0
for i in range(min_v,max_v+1):
t_ans=c[i-1]+c[i]+c[i+1]
ans=max(ans,t_ans)
print(ans) | 13 | 16 | 197 | 234 | from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
a_max = max(a)
c = Counter(a)
ans = 0
for i in range(a_max + 1):
ans = max(ans, c[i] + c[i + 1] + c[i + 2])
print(ans)
| from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
min_v = min(a)
max_v = max(a)
c = Counter(a)
ans = 0
for i in range(min_v, max_v + 1):
t_ans = c[i - 1] + c[i] + c[i + 1]
ans = max(ans, t_ans)
print(ans)
| false | 18.75 | [
"-a_max = max(a)",
"+min_v = min(a)",
"+max_v = max(a)",
"-for i in range(a_max + 1):",
"- ans = max(ans, c[i] + c[i + 1] + c[i + 2])",
"+for i in range(min_v, max_v + 1):",
"+ t_ans = c[i - 1] + c[i] + c[i + 1]",
"+ ans = max(ans, t_ans)"
] | false | 0.047703 | 0.071967 | 0.662855 | [
"s455277603",
"s840708317"
] |
u585482323 | p03937 | python | s031565407 | s253866681 | 191 | 176 | 39,024 | 38,256 | Accepted | Accepted | 7.85 | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline()... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS... | 89 | 57 | 2,022 | 1,530 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
return [list(x) for x in sys.stdin... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI():
return [int(x) for x in sys.stdin.buffer.readline().split()]
def I():
return int(sys.stdin.buffer.readline())
d... | false | 35.955056 | [
"+from itertools import permutations, accumulate",
"-import random",
"- return [int(x) for x in sys.stdin.readline().split()]",
"+ return [int(x) for x in sys.stdin.buffer.readline().split()]",
"- return int(sys.stdin.readline())",
"+ return int(sys.stdin.buffer.readline())",
"-# A",
"-def... | false | 0.09903 | 0.044325 | 2.234183 | [
"s031565407",
"s253866681"
] |
u225388820 | p02861 | python | s549982545 | s762483888 | 393 | 17 | 3,064 | 3,060 | Accepted | Accepted | 95.67 | def d(x,y):
return ((x[0]-y[0])**2+(x[1]-y[1])**2)**(1/2)
import itertools
ans=0
k=1
n= int(eval(input()))
xy=[list(map(int,input().split())) for i in range(n)]
l=[i for i in range(n)]
for v in itertools.permutations(l, n):
for i in range(n-1):
ans+=d(xy[v[i]],xy[v[i+1]])
for i in range(1,n... | def d(x,y):
return ((x[0]-y[0])**2+(x[1]-y[1])**2)**(1/2)
n= int(eval(input()))
x=[list(map(int,input().split())) for i in range(n)]
ans=0
for i in range(n):
for j in range(n):
ans+=d(x[i],x[j])
print((ans/n)) | 15 | 9 | 342 | 225 | def d(x, y):
return ((x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2) ** (1 / 2)
import itertools
ans = 0
k = 1
n = int(eval(input()))
xy = [list(map(int, input().split())) for i in range(n)]
l = [i for i in range(n)]
for v in itertools.permutations(l, n):
for i in range(n - 1):
ans += d(xy[v[i]], xy[v[i + 1... | def d(x, y):
return ((x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2) ** (1 / 2)
n = int(eval(input()))
x = [list(map(int, input().split())) for i in range(n)]
ans = 0
for i in range(n):
for j in range(n):
ans += d(x[i], x[j])
print((ans / n))
| false | 40 | [
"-import itertools",
"-",
"+n = int(eval(input()))",
"+x = [list(map(int, input().split())) for i in range(n)]",
"-k = 1",
"-n = int(eval(input()))",
"-xy = [list(map(int, input().split())) for i in range(n)]",
"-l = [i for i in range(n)]",
"-for v in itertools.permutations(l, n):",
"- for i in... | false | 0.11219 | 0.039649 | 2.829625 | [
"s549982545",
"s762483888"
] |
u122428774 | p02577 | python | s781664517 | s502744206 | 346 | 198 | 79,852 | 68,772 | Accepted | Accepted | 42.77 | n = int(eval(input()))
print(('YNeos'[n%9>0::2])) | print(("YNeos"[int(eval(input()))%9>0::2])) | 3 | 1 | 44 | 35 | n = int(eval(input()))
print(("YNeos"[n % 9 > 0 :: 2]))
| print(("YNeos"[int(eval(input())) % 9 > 0 :: 2]))
| false | 66.666667 | [
"-n = int(eval(input()))",
"-print((\"YNeos\"[n % 9 > 0 :: 2]))",
"+print((\"YNeos\"[int(eval(input())) % 9 > 0 :: 2]))"
] | false | 0.044127 | 0.105138 | 0.419708 | [
"s781664517",
"s502744206"
] |
u585482323 | p03032 | python | s859574946 | s347848674 | 212 | 194 | 42,352 | 41,580 | Accepted | Accepted | 8.49 | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, ... | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline()... | 114 | 50 | 2,332 | 1,227 | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return list(map(int, sys.stdin.readline().split()))
def I():
return int(sys.stdin.readline())
def LS():
return list(m... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
return [list(x) for x in sys.stdin... | false | 56.140351 | [
"-from collections import defaultdict",
"-from collections import deque",
"+from collections import defaultdict, deque",
"- return list(map(int, sys.stdin.readline().split()))",
"+ return [int(x) for x in sys.stdin.readline().split()]",
"- return list(map(list, sys.stdin.readline().split()))",
... | false | 0.075743 | 0.049584 | 1.527557 | [
"s859574946",
"s347848674"
] |
u057668615 | p02689 | python | s990983853 | s749516194 | 319 | 292 | 99,404 | 20,108 | Accepted | Accepted | 8.46 | from collections import defaultdict
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
ans = N
tog = defaultdict(list)
arr = set()
cnt = 0
for i in range(M):
a, b = list(map(int, input().split()))
tog[a].append(H[b-1])
tog[b].append(H[a-1])
'''
if str(a) not in ... | N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
arr = [True for i in range(N)]
ans = 0
for i in range(M):
A, B = list(map(int, input().split()))
A -= 1
B -= 1
if H[A] <= H[B]:
arr[A] = False
if H[B] <= H[A]:
arr[B] = False
for ele in arr:
i... | 35 | 17 | 717 | 366 | from collections import defaultdict
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
ans = N
tog = defaultdict(list)
arr = set()
cnt = 0
for i in range(M):
a, b = list(map(int, input().split()))
tog[a].append(H[b - 1])
tog[b].append(H[a - 1])
"""
if str(a) not in arr:
... | N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
arr = [True for i in range(N)]
ans = 0
for i in range(M):
A, B = list(map(int, input().split()))
A -= 1
B -= 1
if H[A] <= H[B]:
arr[A] = False
if H[B] <= H[A]:
arr[B] = False
for ele in arr:
if ele == True... | false | 51.428571 | [
"-from collections import defaultdict",
"-",
"-ans = N",
"-tog = defaultdict(list)",
"-arr = set()",
"-cnt = 0",
"+arr = [True for i in range(N)]",
"+ans = 0",
"- a, b = list(map(int, input().split()))",
"- tog[a].append(H[b - 1])",
"- tog[b].append(H[a - 1])",
"- \"\"\"",
"- ... | false | 0.057436 | 0.035138 | 1.634614 | [
"s990983853",
"s749516194"
] |
u426649993 | p03160 | python | s268248519 | s729332035 | 126 | 100 | 13,928 | 20,572 | Accepted | Accepted | 20.63 | if __name__ == "__main__":
N = int(eval(input()))
h = list(map(int, input().split()))
dp = [0] * N
dp[1] = abs(h[1] - h[0])
for i in range(2, N):
dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]))
print((dp[N-1]))
| def main():
N = int(eval(input()))
h = list(map(int, input().split()))
dp = [0] * (N+5)
dp[1] = abs(h[1]-h[0])
for i in range(2, N):
dp[i] = min(dp[i-1] + abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))
print((dp[N-1]))
if __name__ == "__main__":
main()
| 11 | 15 | 272 | 297 | if __name__ == "__main__":
N = int(eval(input()))
h = list(map(int, input().split()))
dp = [0] * N
dp[1] = abs(h[1] - h[0])
for i in range(2, N):
dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[N - 1]))
| def main():
N = int(eval(input()))
h = list(map(int, input().split()))
dp = [0] * (N + 5)
dp[1] = abs(h[1] - h[0])
for i in range(2, N):
dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[N - 1]))
if __name__ == "__main__":
main()
| false | 26.666667 | [
"-if __name__ == \"__main__\":",
"+def main():",
"- dp = [0] * N",
"+ dp = [0] * (N + 5)",
"+",
"+",
"+if __name__ == \"__main__\":",
"+ main()"
] | false | 0.035651 | 0.035904 | 0.992941 | [
"s268248519",
"s729332035"
] |
u989345508 | p02669 | python | s077734530 | s411123900 | 1,830 | 1,617 | 138,908 | 120,148 | Accepted | Accepted | 11.64 | check=dict()
N,z,d=0,[],0
#ttfは235、chaはabc
def dfs_sub(n,ttf,cha):
global check,d
#-1ずつしていく場合
check[0]=min(check[n]+n*d,check[0])
#最寄りまで-してく場合
x1,x2=n//ttf,n%ttf
if x1 in check:
if check[x1]>check[n]+x2*d+cha:
check[x1]=check[n]+x2*d+cha
dfs(x1)
... | check=dict()
N,z,d=0,[],0
#ttfは235、chaはabc
def dfs_sub(n,ttf,cha):
global check,d
#-1ずつしていく場合
check[0]=min(check[n]+n*d,check[0])
#最寄りまで-してく場合
x1,x2=n//ttf,n%ttf
if x1 in check:
if check[x1]>check[n]+x2*d+cha:
check[x1]=check[n]+x2*d+cha
dfs(x1)
... | 43 | 43 | 858 | 871 | check = dict()
N, z, d = 0, [], 0
# ttfは235、chaはabc
def dfs_sub(n, ttf, cha):
global check, d
# -1ずつしていく場合
check[0] = min(check[n] + n * d, check[0])
# 最寄りまで-してく場合
x1, x2 = n // ttf, n % ttf
if x1 in check:
if check[x1] > check[n] + x2 * d + cha:
check[x1] = check[n] + x2 * d... | check = dict()
N, z, d = 0, [], 0
# ttfは235、chaはabc
def dfs_sub(n, ttf, cha):
global check, d
# -1ずつしていく場合
check[0] = min(check[n] + n * d, check[0])
# 最寄りまで-してく場合
x1, x2 = n // ttf, n % ttf
if x1 in check:
if check[x1] > check[n] + x2 * d + cha:
check[x1] = check[n] + x2 * d... | false | 0 | [
"- global z",
"- for i, j in z:",
"+ global b",
"+ for i, j in zip([2, 3, 5], b):"
] | false | 1.426641 | 1.497844 | 0.952463 | [
"s077734530",
"s411123900"
] |
u860002137 | p02912 | python | s256004301 | s531214676 | 150 | 127 | 14,180 | 20,148 | Accepted | Accepted | 15.33 | from heapq import heapify, heappop, heappush
n, m = list(map(int, input().split()))
arr = [-x for x in map(int, input().split())]
heapify(arr)
for _ in range(m):
tmp = heappop(arr)
heappush(arr, int(tmp / 2))
print((-sum(arr))) | from heapq import heappop, heappush, heapify
n, m = list(map(int, input().split()))
arr = list(map(int, input().split()))
arr = [-x for x in arr]
heapify(arr)
for _ in range(m):
a = heappop(arr)
heappush(arr, -(-a // 2))
print((-sum(arr))) | 11 | 13 | 240 | 255 | from heapq import heapify, heappop, heappush
n, m = list(map(int, input().split()))
arr = [-x for x in map(int, input().split())]
heapify(arr)
for _ in range(m):
tmp = heappop(arr)
heappush(arr, int(tmp / 2))
print((-sum(arr)))
| from heapq import heappop, heappush, heapify
n, m = list(map(int, input().split()))
arr = list(map(int, input().split()))
arr = [-x for x in arr]
heapify(arr)
for _ in range(m):
a = heappop(arr)
heappush(arr, -(-a // 2))
print((-sum(arr)))
| false | 15.384615 | [
"-from heapq import heapify, heappop, heappush",
"+from heapq import heappop, heappush, heapify",
"-arr = [-x for x in map(int, input().split())]",
"+arr = list(map(int, input().split()))",
"+arr = [-x for x in arr]",
"- tmp = heappop(arr)",
"- heappush(arr, int(tmp / 2))",
"+ a = heappop(arr... | false | 0.052628 | 0.091434 | 0.57558 | [
"s256004301",
"s531214676"
] |
u077291787 | p02971 | python | s467935443 | s534614868 | 245 | 188 | 23,728 | 28,956 | Accepted | Accepted | 23.27 | # ABC134
import sys
input = sys.stdin.readline
def main():
n = int(input())
A = list(map(int, [input() for _ in range(n)]))
SA = sorted(A)
ma, ma2 = SA[-1], SA[-2]
ans = (ma if i != ma else ma2 for i in A)
print(*ans, sep="\n")
if __name__ == "__main__":
main()
| # ABC134C - Exception Handling
def main():
N, *A = list(map(int, open(0)))
sorted_A = sorted(A)
m1, m2 = sorted_A[-1], sorted_A[-2]
ans = [m1 if i != m1 else m2 for i in A]
print(("\n".join(map(str, ans))))
if __name__ == "__main__":
main() | 15 | 11 | 306 | 268 | # ABC134
import sys
input = sys.stdin.readline
def main():
n = int(input())
A = list(map(int, [input() for _ in range(n)]))
SA = sorted(A)
ma, ma2 = SA[-1], SA[-2]
ans = (ma if i != ma else ma2 for i in A)
print(*ans, sep="\n")
if __name__ == "__main__":
main()
| # ABC134C - Exception Handling
def main():
N, *A = list(map(int, open(0)))
sorted_A = sorted(A)
m1, m2 = sorted_A[-1], sorted_A[-2]
ans = [m1 if i != m1 else m2 for i in A]
print(("\n".join(map(str, ans))))
if __name__ == "__main__":
main()
| false | 26.666667 | [
"-# ABC134",
"-import sys",
"-",
"-input = sys.stdin.readline",
"-",
"-",
"+# ABC134C - Exception Handling",
"- n = int(input())",
"- A = list(map(int, [input() for _ in range(n)]))",
"- SA = sorted(A)",
"- ma, ma2 = SA[-1], SA[-2]",
"- ans = (ma if i != ma else ma2 for i in A)"... | false | 0.042612 | 0.038001 | 1.12134 | [
"s467935443",
"s534614868"
] |
u564589929 | p03569 | python | s143932933 | s387005342 | 60 | 55 | 9,244 | 9,192 | Accepted | Accepted | 8.33 | S = eval(input())
N = len(S)
nx = S.replace('x', '')
N2 = len(nx)
for i in range(N2):
if nx[i] != nx[N2-i-1]:
print((-1))
exit()
if N == N2:
# x not inclueded
print((0))
else:
cnt = 0
i = 0
j = N-1
while i < j:
if S[i] == 'x':
if S[j] == 'x':
i += 1
j... | S = eval(input())
N = len(S)
cnt = 0
i = 0
j = N-1
while i < j:
if S[i] == 'x':
if S[j] == 'x':
i += 1
j -= 1
else:
i += 1
cnt += 1
else:
if S[i] == S[j]:
i += 1
j -= 1
elif S[j] == 'x':
cnt += 1
j -= 1
else:
print((-1)... | 36 | 25 | 534 | 339 | S = eval(input())
N = len(S)
nx = S.replace("x", "")
N2 = len(nx)
for i in range(N2):
if nx[i] != nx[N2 - i - 1]:
print((-1))
exit()
if N == N2:
# x not inclueded
print((0))
else:
cnt = 0
i = 0
j = N - 1
while i < j:
if S[i] == "x":
if S[j] == "x":
... | S = eval(input())
N = len(S)
cnt = 0
i = 0
j = N - 1
while i < j:
if S[i] == "x":
if S[j] == "x":
i += 1
j -= 1
else:
i += 1
cnt += 1
else:
if S[i] == S[j]:
i += 1
j -= 1
elif S[j] == "x":
cnt += ... | false | 30.555556 | [
"-nx = S.replace(\"x\", \"\")",
"-N2 = len(nx)",
"-for i in range(N2):",
"- if nx[i] != nx[N2 - i - 1]:",
"- print((-1))",
"- exit()",
"-if N == N2:",
"- # x not inclueded",
"- print((0))",
"-else:",
"- cnt = 0",
"- i = 0",
"- j = N - 1",
"- while i < j:"... | false | 0.061254 | 0.032901 | 1.861779 | [
"s143932933",
"s387005342"
] |
u445624660 | p03162 | python | s281734637 | s397349019 | 762 | 609 | 112,688 | 36,136 | Accepted | Accepted | 20.08 | # dp[i日目][i-1日目にどれを選んだか] = i日目までの最大の幸福度
import sys
sys.setrecursionlimit(10 ** 8)
n = int(eval(input()))
a, b, c = [0 for _ in range(n)], [0 for _ in range(n)], [0 for _ in range(n)]
for i in range(n):
a[i], b[i], c[i] = list(map(int, input().split()))
dp = [[-1 for _ in range(3)] for _ in range(n + 1)]
... | # dp[i日目][i-1日目にどれを選んだか] = i日目までの最大の幸福度
# これはループでやってみたバージョン
n = int(eval(input()))
a, b, c = [0 for _ in range(n)], [0 for _ in range(n)], [0 for _ in range(n)]
for i in range(n):
a[i], b[i], c[i] = list(map(int, input().split()))
dp = [[-1 for _ in range(3)] for _ in range(n + 1)]
# 初期値、最初間違えて0にしてた
dp[... | 31 | 22 | 848 | 709 | # dp[i日目][i-1日目にどれを選んだか] = i日目までの最大の幸福度
import sys
sys.setrecursionlimit(10**8)
n = int(eval(input()))
a, b, c = [0 for _ in range(n)], [0 for _ in range(n)], [0 for _ in range(n)]
for i in range(n):
a[i], b[i], c[i] = list(map(int, input().split()))
dp = [[-1 for _ in range(3)] for _ in range(n + 1)]
for i in ran... | # dp[i日目][i-1日目にどれを選んだか] = i日目までの最大の幸福度
# これはループでやってみたバージョン
n = int(eval(input()))
a, b, c = [0 for _ in range(n)], [0 for _ in range(n)], [0 for _ in range(n)]
for i in range(n):
a[i], b[i], c[i] = list(map(int, input().split()))
dp = [[-1 for _ in range(3)] for _ in range(n + 1)]
# 初期値、最初間違えて0にしてた
dp[0][0] = a[0]... | false | 29.032258 | [
"-import sys",
"-",
"-sys.setrecursionlimit(10**8)",
"+# これはループでやってみたバージョン",
"-for i in range(3):",
"- dp[0][i] = 0",
"-",
"-",
"-def rec(i, choice):",
"- if dp[i][choice] > 0:",
"- return dp[i][choice]",
"- if i == n:",
"- return 0",
"- ret = 0 # ループじゃなくてifでやってる... | false | 0.037436 | 0.061122 | 0.61248 | [
"s281734637",
"s397349019"
] |
u477977638 | p02792 | python | s317321883 | s944111432 | 242 | 166 | 41,324 | 3,064 | Accepted | Accepted | 31.4 | import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines
#mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
#import numpy as np
def main():
n=int(eval(input()))
ans1=0
ans2=0
for i in range(1,n+1):
a=int(str(i)[0])
... | import sys
#input = sys.stdin.readline
input = sys.stdin.buffer.readline
# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
#import numpy as np
def main():
li=[[0]*10 for i in range(10)]
n=int(eval(input()))
for i in range(1,n+1):
i=str(i)
li[int(i[0])][int(i[-1])]+=1
ans=0... | 45 | 42 | 624 | 477 | import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines
# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
# import numpy as np
def main():
n = int(eval(input()))
ans1 = 0
ans2 = 0
for i in range(1, n + 1):
a = int(str(i)[0]... | import sys
# input = sys.stdin.readline
input = sys.stdin.buffer.readline
# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
# import numpy as np
def main():
li = [[0] * 10 for i in range(10)]
n = int(eval(input()))
for i in range(1, n + 1):
i = str(i)
li[int(i[0])][int(i[-... | false | 6.666667 | [
"-read = sys.stdin.buffer.read",
"+# input = sys.stdin.readline",
"-inputs = sys.stdin.buffer.readlines",
"+ li = [[0] * 10 for i in range(10)]",
"- ans1 = 0",
"- ans2 = 0",
"- a = int(str(i)[0])",
"- b = i % 10",
"- if b == 0:",
"- continue",
"- k... | false | 0.188532 | 0.199697 | 0.944087 | [
"s317321883",
"s944111432"
] |
u638456847 | p02623 | python | s549010197 | s455515053 | 241 | 191 | 49,200 | 50,468 | Accepted | Accepted | 20.75 | from itertools import accumulate
from bisect import bisect_right
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
N,M,K = list(map(int, readline().split()))
A = [int(i) for i in readline().split()]
B = [int(i) for i in readline().split()]
... | from itertools import accumulate
from bisect import bisect_right
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
N,M,K = list(map(int, readline().split()))
A = [int(i) for i in readline().split()]
B = [int(i) for i in readline().split()]
... | 33 | 33 | 754 | 718 | from itertools import accumulate
from bisect import bisect_right
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
N, M, K = list(map(int, readline().split()))
A = [int(i) for i in readline().split()]
B = [int(i) for i in readline().split()]
ac... | from itertools import accumulate
from bisect import bisect_right
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
N, M, K = list(map(int, readline().split()))
A = [int(i) for i in readline().split()]
B = [int(i) for i in readline().split()]
ac... | false | 0 | [
"+ b_ind = M",
"- tmp = i",
"- rest = K - a",
"- if rest < 0:",
"- ans = max(ans, bisect_right(acc_B, K) - 1)",
"+ remain = K - a",
"+ if remain < 0:",
"- b_ind = bisect_right(acc_B, rest) - 1",
"- tmp += b_ind",
"+ while acc_B[... | false | 0.044107 | 0.04361 | 1.0114 | [
"s549010197",
"s455515053"
] |
u863442865 | p02830 | python | s829346537 | s758973748 | 166 | 21 | 38,256 | 3,316 | Accepted | Accepted | 87.35 | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby
#from itertools import product
from bisect import bisec... | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby
#from itertools import product
from bisect import bisec... | 26 | 25 | 702 | 685 | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
# from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby
# from itertools import product
from bisect import bisect_l... | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
# from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby
# from itertools import product
from bisect import bisect_l... | false | 3.846154 | [
"- for i in range(n):",
"- res += s[i]",
"- res += t[i]",
"+ for a, b in zip(s, t):",
"+ res += a + b"
] | false | 0.113656 | 0.036166 | 3.142577 | [
"s829346537",
"s758973748"
] |
u045953894 | p02689 | python | s745164269 | s614339854 | 342 | 245 | 22,952 | 20,108 | Accepted | Accepted | 28.36 | n,m = list(map(int,input().split()))
h = list(map(int,input().split()))
A = []
B = []
h_new = [0]*n
c = 0
for i in range(m):
a,b = list(map(int,input().split()))
A += [a]
B += [b]
for i in range(m):
h_new[A[i]-1] = max(h[B[i]-1],h_new[A[i]-1])
h_new[B[i]-1] = max(h_new[B[i]-1],h[A[... | n,m = list(map(int,input().split()))
h = list(map(int,input().split()))
l = [1]*n
for i in range(m):
a,b = list(map(int,input().split()))
if h[a-1] > h[b-1]:
l[b-1] = 0
elif h[b-1] > h[a-1]:
l[a-1] = 0
else:
l[a-1] = l[b-1] = 0
print((sum(l)))
| 19 | 13 | 391 | 291 | n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
A = []
B = []
h_new = [0] * n
c = 0
for i in range(m):
a, b = list(map(int, input().split()))
A += [a]
B += [b]
for i in range(m):
h_new[A[i] - 1] = max(h[B[i] - 1], h_new[A[i] - 1])
h_new[B[i] - 1] = max(h_new[B[i] - 1], h[A... | n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
l = [1] * n
for i in range(m):
a, b = list(map(int, input().split()))
if h[a - 1] > h[b - 1]:
l[b - 1] = 0
elif h[b - 1] > h[a - 1]:
l[a - 1] = 0
else:
l[a - 1] = l[b - 1] = 0
print((sum(l)))
| false | 31.578947 | [
"-A = []",
"-B = []",
"-h_new = [0] * n",
"-c = 0",
"+l = [1] * n",
"- A += [a]",
"- B += [b]",
"-for i in range(m):",
"- h_new[A[i] - 1] = max(h[B[i] - 1], h_new[A[i] - 1])",
"- h_new[B[i] - 1] = max(h_new[B[i] - 1], h[A[i] - 1])",
"-for i in range(n):",
"- if h[i] > h_new[i]:"... | false | 0.045865 | 0.043004 | 1.066536 | [
"s745164269",
"s614339854"
] |
u440566786 | p03963 | python | s650073977 | s202644427 | 174 | 62 | 38,256 | 61,624 | Accepted | Accepted | 64.37 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
n,k=list(map(int,input().split()))
print((k*((k-1)**(n-1))))
resolve() | import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
n, k = list(map(int, input().split()))
print((k * pow(k - 1, n - 1)))
resolve() | 9 | 9 | 211 | 234 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def resolve():
n, k = list(map(int, input().split()))
print((k * ((k - 1) ** (n - 1))))
resolve()
| import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda: sys.stdin.readline().rstrip()
def resolve():
n, k = list(map(int, input().split()))
print((k * pow(k - 1, n - 1)))
resolve()
| false | 0 | [
"+INF = 1 << 60",
"+MOD = 10**9 + 7 # 998244353",
"-INF = float(\"inf\")",
"-MOD = 10**9 + 7",
"- print((k * ((k - 1) ** (n - 1))))",
"+ print((k * pow(k - 1, n - 1)))"
] | false | 0.038266 | 0.047171 | 0.811213 | [
"s650073977",
"s202644427"
] |
u600402037 | p02744 | python | s997144648 | s606157350 | 737 | 157 | 44,872 | 4,340 | Accepted | Accepted | 78.7 | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
A = [[0]]
limit = 0
for i in range(N-1):
B = []
for j in range(limit + 2):
for x in A:
if max(x) + 1 < j:
continue
y = ... | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
def dfs(s, limit):
if len(s) == N:
print(s)
else:
for i in range(limit+2):
x = chr(i + ord('a'))
dfs(s + x, max(limit, i))
d... | 25 | 18 | 505 | 336 | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
A = [[0]]
limit = 0
for i in range(N - 1):
B = []
for j in range(limit + 2):
for x in A:
if max(x) + 1 < j:
continue
y = x + [j]
... | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
def dfs(s, limit):
if len(s) == N:
print(s)
else:
for i in range(limit + 2):
x = chr(i + ord("a"))
dfs(s + x, max(limit, i))
dfs("a", 0)
# ... | false | 28 | [
"-A = [[0]]",
"-limit = 0",
"-for i in range(N - 1):",
"- B = []",
"- for j in range(limit + 2):",
"- for x in A:",
"- if max(x) + 1 < j:",
"- continue",
"- y = x + [j]",
"- B.append(y)",
"- A = B",
"- limit += 1",
"-A = [tup... | false | 0.046481 | 0.042594 | 1.091243 | [
"s997144648",
"s606157350"
] |
u312025627 | p03240 | python | s470689578 | s186349277 | 266 | 195 | 48,988 | 41,200 | Accepted | Accepted | 26.69 | def main():
N = int(input())
xyh = [[int(i) for i in input().split()] for _ in range(N)]
sx, sy, sh = [(x, y, h) for x, y, h in xyh if h != 0][0]
for cx in range(101):
for cy in range(101):
H = sh + abs(sx - cx) + abs(sy - cy)
if all(max(H-abs(x - cx)-abs(y - cy), ... | def main():
import sys
input = sys.stdin.buffer.readline
N = int(input())
XYH = [[int(i) for i in input().split()] for j in range(N)]
XYH.sort(reverse=True, key=lambda p: p[2])
for cy in range(101):
for cx in range(101):
ch = XYH[0][2] + abs(XYH[0][0] - cx) + abs(XY... | 13 | 21 | 434 | 616 | def main():
N = int(input())
xyh = [[int(i) for i in input().split()] for _ in range(N)]
sx, sy, sh = [(x, y, h) for x, y, h in xyh if h != 0][0]
for cx in range(101):
for cy in range(101):
H = sh + abs(sx - cx) + abs(sy - cy)
if all(max(H - abs(x - cx) - abs(y - cy), 0) ... | def main():
import sys
input = sys.stdin.buffer.readline
N = int(input())
XYH = [[int(i) for i in input().split()] for j in range(N)]
XYH.sort(reverse=True, key=lambda p: p[2])
for cy in range(101):
for cx in range(101):
ch = XYH[0][2] + abs(XYH[0][0] - cx) + abs(XYH[0][1] -... | false | 38.095238 | [
"+ import sys",
"+",
"+ input = sys.stdin.buffer.readline",
"- xyh = [[int(i) for i in input().split()] for _ in range(N)]",
"- sx, sy, sh = [(x, y, h) for x, y, h in xyh if h != 0][0]",
"- for cx in range(101):",
"- for cy in range(101):",
"- H = sh + abs(sx - cx) + a... | false | 0.034045 | 0.036794 | 0.925267 | [
"s470689578",
"s186349277"
] |
u798818115 | p03164 | python | s253710813 | s283906961 | 260 | 113 | 41,964 | 70,200 | Accepted | Accepted | 56.54 | # coding: utf-8
# Your code here!
N,W=list(map(int,input().split()))
jwels=[]
for _ in range(N):
jwels.append(list(map(int,input().split())))
dp=[10**10]*(10**5+1)
dp[0]=0
for w,v in jwels:
for i in range(10**5+1)[::-1]:
if dp[i]!=10**10 and i+v<=10**5:
dp[i+v]=min(dp[i]+w... | # coding: utf-8
# Your code here!
#D流用したので文字滅茶苦茶
N,W=list(map(int,input().split()))
dp=[10**9+1]*(10**5+1)
dp[0]=0
for _ in range(N):
w,v=list(map(int,input().split()))
for i in range(10**5+1)[::-1]:
if dp[i]!=-10**9+1 and i+v<=10**5:
dp[i+v]=min(dp[i]+w,dp[i+v])
ans=0
... | 25 | 22 | 433 | 379 | # coding: utf-8
# Your code here!
N, W = list(map(int, input().split()))
jwels = []
for _ in range(N):
jwels.append(list(map(int, input().split())))
dp = [10**10] * (10**5 + 1)
dp[0] = 0
for w, v in jwels:
for i in range(10**5 + 1)[::-1]:
if dp[i] != 10**10 and i + v <= 10**5:
dp[i + v] = mi... | # coding: utf-8
# Your code here!
# D流用したので文字滅茶苦茶
N, W = list(map(int, input().split()))
dp = [10**9 + 1] * (10**5 + 1)
dp[0] = 0
for _ in range(N):
w, v = list(map(int, input().split()))
for i in range(10**5 + 1)[::-1]:
if dp[i] != -(10**9) + 1 and i + v <= 10**5:
dp[i + v] = min(dp[i] + w,... | false | 12 | [
"+# D流用したので文字滅茶苦茶",
"-jwels = []",
"+dp = [10**9 + 1] * (10**5 + 1)",
"+dp[0] = 0",
"- jwels.append(list(map(int, input().split())))",
"-dp = [10**10] * (10**5 + 1)",
"-dp[0] = 0",
"-for w, v in jwels:",
"+ w, v = list(map(int, input().split()))",
"- if dp[i] != 10**10 and i + v <= 10... | false | 0.098679 | 0.634421 | 0.155541 | [
"s253710813",
"s283906961"
] |
u185688520 | p03273 | python | s390967511 | s085045736 | 160 | 31 | 13,840 | 4,468 | Accepted | Accepted | 80.62 | # -*- coding: utf-8 -*-
import numpy as np
H, W = map(int, input().split())
masu = []
res = []
str1 = '.' * W
for i in range(H):
str2 = input()
if str1 != str2:
masu.append(str2)
l = ['.'] * len(masu)
for i in range(W):
tmp = [k[i] for k in masu]
if tmp != l:
res.append(tmp)
ww = len(... | # -*- coding: utf-8 -*-
h, w = map(int, input().split())
a = [''] * h
for i in range(h):
a[i] = input()
row = [False] * h
col = [False] * w
for i in range(h):
for j in range(w):
if a[i][j] == '#':
row[i] = True
col[j] = True
for i in range(h):
if row[i]:
for j in range(w):
if co... | 27 | 21 | 425 | 364 | # -*- coding: utf-8 -*-
import numpy as np
H, W = map(int, input().split())
masu = []
res = []
str1 = "." * W
for i in range(H):
str2 = input()
if str1 != str2:
masu.append(str2)
l = ["."] * len(masu)
for i in range(W):
tmp = [k[i] for k in masu]
if tmp != l:
res.append(tmp)
ww = len(re... | # -*- coding: utf-8 -*-
h, w = map(int, input().split())
a = [""] * h
for i in range(h):
a[i] = input()
row = [False] * h
col = [False] * w
for i in range(h):
for j in range(w):
if a[i][j] == "#":
row[i] = True
col[j] = True
for i in range(h):
if row[i]:
for j in rang... | false | 22.222222 | [
"-import numpy as np",
"-",
"-H, W = map(int, input().split())",
"-masu = []",
"-res = []",
"-str1 = \".\" * W",
"-for i in range(H):",
"- str2 = input()",
"- if str1 != str2:",
"- masu.append(str2)",
"-l = [\".\"] * len(masu)",
"-for i in range(W):",
"- tmp = [k[i] for k in ... | false | 0.043564 | 0.0413 | 1.054836 | [
"s390967511",
"s085045736"
] |
u464205401 | p02725 | python | s277030368 | s342919317 | 111 | 93 | 32,372 | 32,276 | Accepted | Accepted | 16.22 | n, k = list(map(int,input().split()))
a = list(map(int,input().split()))
b = [0] * (k-1)
for i in range(k-1):
b[i] = a[i+1]-a[i]
b.append(n-a[-1]+a[0])
print((sum(b)-max(b))) | n, k = list(map(int,input().split()))
a = list(map(int,input().split()))
b = [a[i+1]-a[i] for i in range(k-1)]
b.append(n-a[-1]+a[0])
print((n-max(b))) | 9 | 5 | 178 | 147 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = [0] * (k - 1)
for i in range(k - 1):
b[i] = a[i + 1] - a[i]
b.append(n - a[-1] + a[0])
print((sum(b) - max(b)))
| n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = [a[i + 1] - a[i] for i in range(k - 1)]
b.append(n - a[-1] + a[0])
print((n - max(b)))
| false | 44.444444 | [
"-b = [0] * (k - 1)",
"-for i in range(k - 1):",
"- b[i] = a[i + 1] - a[i]",
"+b = [a[i + 1] - a[i] for i in range(k - 1)]",
"-print((sum(b) - max(b)))",
"+print((n - max(b)))"
] | false | 0.036905 | 0.065402 | 0.564269 | [
"s277030368",
"s342919317"
] |
u057109575 | p02883 | python | s613972078 | s813991314 | 493 | 301 | 119,500 | 123,824 | Accepted | Accepted | 38.95 | from heapq import heappop, heappush
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
def ok(x):
cnt = 0
for i in range(N):
current = A[i] * F[i]
if current > x:
cnt += -(-(current - x) // F[i])
... | from heapq import heappush, heappop
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
F.sort()
x = [a * b for a, b in zip(F, sorted(A, reverse=True))]
ub = max(x)
lb = 0
while ub - lb > 1:
mid = (ub + lb) // 2
res = 0
for i in ran... | 33 | 28 | 578 | 511 | from heapq import heappop, heappush
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
def ok(x):
cnt = 0
for i in range(N):
current = A[i] * F[i]
if current > x:
cnt += -(-(current - x) // F[i])
return cnt <= K
A.s... | from heapq import heappush, heappop
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
F.sort()
x = [a * b for a, b in zip(F, sorted(A, reverse=True))]
ub = max(x)
lb = 0
while ub - lb > 1:
mid = (ub + lb) // 2
res = 0
for i in range(N):
t... | false | 15.151515 | [
"-from heapq import heappop, heappush",
"+from heapq import heappush, heappop",
"-",
"-",
"-def ok(x):",
"- cnt = 0",
"+F.sort()",
"+x = [a * b for a, b in zip(F, sorted(A, reverse=True))]",
"+ub = max(x)",
"+lb = 0",
"+while ub - lb > 1:",
"+ mid = (ub + lb) // 2",
"+ res = 0",
"... | false | 0.036023 | 0.095513 | 0.377154 | [
"s613972078",
"s813991314"
] |
u888092736 | p02936 | python | s709399030 | s239233553 | 1,934 | 1,527 | 349,236 | 99,396 | Accepted | Accepted | 21.04 | import sys
sys.setrecursionlimit(10 ** 6)
def dfs(v, pv):
for nv in g[v]:
if nv == pv:
continue
cnt[nv] += cnt[v]
dfs(nv, v)
(N, Q), *ABPX = [list(map(int, s.split())) for s in open(0)]
g = [set() for _ in range(N)]
for a, b in ABPX[:N - 1]:
g[a - 1].add(b ... | import sys
sys.setrecursionlimit(10 ** 6)
def dfs(v):
print(counter)
for nv in g[v]:
if nv in visited:
continue
visited.add(nv)
counter[nv] += counter[v]
dfs(nv)
def input():
return sys.stdin.readline().strip()
N, Q = list(map(int, inpu... | 23 | 45 | 440 | 846 | import sys
sys.setrecursionlimit(10**6)
def dfs(v, pv):
for nv in g[v]:
if nv == pv:
continue
cnt[nv] += cnt[v]
dfs(nv, v)
(N, Q), *ABPX = [list(map(int, s.split())) for s in open(0)]
g = [set() for _ in range(N)]
for a, b in ABPX[: N - 1]:
g[a - 1].add(b - 1)
g[b - ... | import sys
sys.setrecursionlimit(10**6)
def dfs(v):
print(counter)
for nv in g[v]:
if nv in visited:
continue
visited.add(nv)
counter[nv] += counter[v]
dfs(nv)
def input():
return sys.stdin.readline().strip()
N, Q = list(map(int, input().split()))
g = [set(... | false | 48.888889 | [
"-def dfs(v, pv):",
"+def dfs(v):",
"+ print(counter)",
"- if nv == pv:",
"+ if nv in visited:",
"- cnt[nv] += cnt[v]",
"- dfs(nv, v)",
"+ visited.add(nv)",
"+ counter[nv] += counter[v]",
"+ dfs(nv)",
"-(N, Q), *ABPX = [list(map(int, s.split())... | false | 0.099988 | 0.046089 | 2.169435 | [
"s709399030",
"s239233553"
] |
u328751895 | p02689 | python | s701742490 | s588886177 | 381 | 256 | 19,908 | 20,108 | Accepted | Accepted | 32.81 | N, M = list(map(int, input().split()))
h_list = list(map(int, input().split()))
# 隣接展望台の高さで最大のものをセット
max_h_map = dict()
for _ in range(M):
src, dst = list(map(int, input().split()))
max_h_map[src] = max(max_h_map.get(src, 0), h_list[dst - 1])
max_h_map[dst] = max(max_h_map.get(dst, 0), h_list[src -... | N, M = list(map(int, input().split()))
h_list = list(map(int, input().split()))
# 隣接する展望台より低い時点でbad
bad_set = set()
for _ in range(M):
src, dst = list(map(int, input().split()))
src_h = h_list[src - 1]
dst_h = h_list[dst - 1]
if src_h < dst_h:
bad_set.add(src)
elif dst_h < src_h:... | 18 | 18 | 465 | 424 | N, M = list(map(int, input().split()))
h_list = list(map(int, input().split()))
# 隣接展望台の高さで最大のものをセット
max_h_map = dict()
for _ in range(M):
src, dst = list(map(int, input().split()))
max_h_map[src] = max(max_h_map.get(src, 0), h_list[dst - 1])
max_h_map[dst] = max(max_h_map.get(dst, 0), h_list[src - 1])
good... | N, M = list(map(int, input().split()))
h_list = list(map(int, input().split()))
# 隣接する展望台より低い時点でbad
bad_set = set()
for _ in range(M):
src, dst = list(map(int, input().split()))
src_h = h_list[src - 1]
dst_h = h_list[dst - 1]
if src_h < dst_h:
bad_set.add(src)
elif dst_h < src_h:
bad... | false | 0 | [
"-# 隣接展望台の高さで最大のものをセット",
"-max_h_map = dict()",
"+# 隣接する展望台より低い時点でbad",
"+bad_set = set()",
"- max_h_map[src] = max(max_h_map.get(src, 0), h_list[dst - 1])",
"- max_h_map[dst] = max(max_h_map.get(dst, 0), h_list[src - 1])",
"-good_cnt = 0",
"-for i in range(N):",
"- h = h_list[i]",
"- ... | false | 0.042713 | 0.0845 | 0.505474 | [
"s701742490",
"s588886177"
] |
u759412327 | p03424 | python | s260362282 | s225813472 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | eval(input())
if len(set(input().split()))==3:
print("Three")
else:
print("Four") | N = int(eval(input()))
S = set(input().split())
if len(S)==3:
print("Three")
else:
print("Four") | 5 | 7 | 83 | 101 | eval(input())
if len(set(input().split())) == 3:
print("Three")
else:
print("Four")
| N = int(eval(input()))
S = set(input().split())
if len(S) == 3:
print("Three")
else:
print("Four")
| false | 28.571429 | [
"-eval(input())",
"-if len(set(input().split())) == 3:",
"+N = int(eval(input()))",
"+S = set(input().split())",
"+if len(S) == 3:"
] | false | 0.064267 | 0.070686 | 0.909187 | [
"s260362282",
"s225813472"
] |
u757117214 | p02983 | python | s464232774 | s075300515 | 880 | 77 | 3,060 | 3,064 | Accepted | Accepted | 91.25 | L,R=list(map(int,input().split()))
_min=2018
if L==0:
_min=0
elif R-L>=2019:
_min=0
else:
for l in range(L,R):
for r in range(L+1,R+1):
mm=(l*r)%2019
if mm==0:
_min=0
break
elif _min>mm:
_min=mm
print(_min)
| import sys
L,R=list(map(int,input().split()))
_min=2018
if L==0 or R-L>=2019:
print((0))
sys.exit()
else:
for l in range(L,R):
for r in range(L+1,R+1):
mm=(l*r)%2019
if mm==0:
print((0))
sys.exit()
elif _min>mm:
_min=mm
print(_min) | 17 | 16 | 274 | 294 | L, R = list(map(int, input().split()))
_min = 2018
if L == 0:
_min = 0
elif R - L >= 2019:
_min = 0
else:
for l in range(L, R):
for r in range(L + 1, R + 1):
mm = (l * r) % 2019
if mm == 0:
_min = 0
break
elif _min > mm:
... | import sys
L, R = list(map(int, input().split()))
_min = 2018
if L == 0 or R - L >= 2019:
print((0))
sys.exit()
else:
for l in range(L, R):
for r in range(L + 1, R + 1):
mm = (l * r) % 2019
if mm == 0:
print((0))
sys.exit()
elif _m... | false | 5.882353 | [
"+import sys",
"+",
"-if L == 0:",
"- _min = 0",
"-elif R - L >= 2019:",
"- _min = 0",
"+if L == 0 or R - L >= 2019:",
"+ print((0))",
"+ sys.exit()",
"- _min = 0",
"- break",
"+ print((0))",
"+ sys.exit()"
] | false | 0.053075 | 0.044425 | 1.194711 | [
"s464232774",
"s075300515"
] |
u751485759 | p02658 | python | s718839681 | s450981578 | 77 | 53 | 21,664 | 21,408 | Accepted | Accepted | 31.17 | import sys
n = int(eval(input()))
a = list(map(int,input().split()))
a.sort()
if 0 in a:
print((0))
else:
cur = 1
for x in a:
cur *= x
if cur > 10 ** 18:
print((-1))
sys.exit()
print(cur)
| import sys
n = int(eval(input()))
a_list = list(map(int,input().split()))
if 0 in a_list:
print((0))
sys.exit()
else:
cul = 1
for a in a_list:
cul *= a
if cul > 10 ** 18:
print((-1))
sys.exit()
print(cul)
| 16 | 16 | 251 | 272 | import sys
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
if 0 in a:
print((0))
else:
cur = 1
for x in a:
cur *= x
if cur > 10**18:
print((-1))
sys.exit()
print(cur)
| import sys
n = int(eval(input()))
a_list = list(map(int, input().split()))
if 0 in a_list:
print((0))
sys.exit()
else:
cul = 1
for a in a_list:
cul *= a
if cul > 10**18:
print((-1))
sys.exit()
print(cul)
| false | 0 | [
"-a = list(map(int, input().split()))",
"-a.sort()",
"-if 0 in a:",
"+a_list = list(map(int, input().split()))",
"+if 0 in a_list:",
"+ sys.exit()",
"- cur = 1",
"- for x in a:",
"- cur *= x",
"- if cur > 10**18:",
"+ cul = 1",
"+ for a in a_list:",
"+ cul... | false | 0.079014 | 0.037099 | 2.129825 | [
"s718839681",
"s450981578"
] |
u365686736 | p02397 | python | s595194234 | s718115918 | 50 | 40 | 7,600 | 7,920 | Accepted | Accepted | 20 | while 1:
a,b=list(map(int,input().split()))
if a+b==0:break
if a>b:a,b=b,a
print((a,b)) | import sys
for c in sys.stdin:
a,b=sorted(map(int,c.split()))
if a+b==0:break
print((a,b)) | 5 | 5 | 99 | 104 | while 1:
a, b = list(map(int, input().split()))
if a + b == 0:
break
if a > b:
a, b = b, a
print((a, b))
| import sys
for c in sys.stdin:
a, b = sorted(map(int, c.split()))
if a + b == 0:
break
print((a, b))
| false | 0 | [
"-while 1:",
"- a, b = list(map(int, input().split()))",
"+import sys",
"+",
"+for c in sys.stdin:",
"+ a, b = sorted(map(int, c.split()))",
"- if a > b:",
"- a, b = b, a"
] | false | 0.044792 | 0.140733 | 0.31828 | [
"s595194234",
"s718115918"
] |
u919730120 | p03163 | python | s084255857 | s326143474 | 464 | 220 | 119,916 | 15,500 | Accepted | Accepted | 52.59 | n,W=list(map(int,input().split()))
dp=[[0]*(W+1) for _ in range(n+1)]
for i in range(1,n+1):
w,v=list(map(int,input().split()))
for j in range(1,W+1):
if j-w<0:
dp[i][j]=dp[i-1][j]
else:
dp[i][j]=max(dp[i-1][j],dp[i-1][j-w]+v)
print((max(dp[n]))) | import sys
input = sys.stdin.readline
import numpy as np
def main():
n, W = list(map(int, input().split()))
dp = np.zeros(W + 1, dtype = np.int64)
for i in range(n):
w,v=list(map(int,input().split()))
dp[w:]=np.maximum(dp[w:],dp[:-w]+v)
print((max(dp)))
if __name__ == '__ma... | 10 | 14 | 289 | 324 | n, W = list(map(int, input().split()))
dp = [[0] * (W + 1) for _ in range(n + 1)]
for i in range(1, n + 1):
w, v = list(map(int, input().split()))
for j in range(1, W + 1):
if j - w < 0:
dp[i][j] = dp[i - 1][j]
else:
dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w] + v)
prin... | import sys
input = sys.stdin.readline
import numpy as np
def main():
n, W = list(map(int, input().split()))
dp = np.zeros(W + 1, dtype=np.int64)
for i in range(n):
w, v = list(map(int, input().split()))
dp[w:] = np.maximum(dp[w:], dp[:-w] + v)
print((max(dp)))
if __name__ == "__main... | false | 28.571429 | [
"-n, W = list(map(int, input().split()))",
"-dp = [[0] * (W + 1) for _ in range(n + 1)]",
"-for i in range(1, n + 1):",
"- w, v = list(map(int, input().split()))",
"- for j in range(1, W + 1):",
"- if j - w < 0:",
"- dp[i][j] = dp[i - 1][j]",
"- else:",
"- d... | false | 0.040503 | 0.191006 | 0.21205 | [
"s084255857",
"s326143474"
] |
u328099989 | p03161 | python | s027980996 | s791869853 | 469 | 388 | 55,716 | 55,588 | Accepted | Accepted | 17.27 | #!/usr/bin/env python3
import sys
def solve(N: int, K: int, h: "List[int]"):
dp = [float("inf")] * N
dp[0] = 0
dp[1] = abs(h[0] - h[1])
for i in range(2, N):
for k in range(1, K+1):
if i - k < 0:
continue
dp[i] = min(dp[i], dp[i-k] + abs(h[... | #!/usr/bin/env python3
import sys
def solve(N: int, K: int, h: "List[int]"):
dp = [float("inf")] * N
dp[0] = 0
for i in range(1, N):
for j in range(max(0, i-K), i):
dp[i] = min(dp[i], dp[j] + abs(h[i] - h[j]))
print((dp[-1]))
# Generated by 1.1.6 https://github.com/k... | 33 | 28 | 908 | 825 | #!/usr/bin/env python3
import sys
def solve(N: int, K: int, h: "List[int]"):
dp = [float("inf")] * N
dp[0] = 0
dp[1] = abs(h[0] - h[1])
for i in range(2, N):
for k in range(1, K + 1):
if i - k < 0:
continue
dp[i] = min(dp[i], dp[i - k] + abs(h[i] - h[i -... | #!/usr/bin/env python3
import sys
def solve(N: int, K: int, h: "List[int]"):
dp = [float("inf")] * N
dp[0] = 0
for i in range(1, N):
for j in range(max(0, i - K), i):
dp[i] = min(dp[i], dp[j] + abs(h[i] - h[j]))
print((dp[-1]))
# Generated by 1.1.6 https://github.com/kyuridenamid... | false | 15.151515 | [
"- dp[1] = abs(h[0] - h[1])",
"- for i in range(2, N):",
"- for k in range(1, K + 1):",
"- if i - k < 0:",
"- continue",
"- dp[i] = min(dp[i], dp[i - k] + abs(h[i] - h[i - k]))",
"+ for i in range(1, N):",
"+ for j in range(max(0, i - K), i):... | false | 0.038294 | 0.038193 | 1.002659 | [
"s027980996",
"s791869853"
] |
u357230322 | p03160 | python | s870840909 | s694025638 | 202 | 125 | 13,928 | 13,980 | Accepted | Accepted | 38.12 | N = int(eval(input()))
*h, = list(map(int, input().split()))
dp = [float("inf") for _ in range(N)]
dp[0] = 0
for i in range(N - 1):
dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))
if i < N - 2:
dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]))
print((dp[N - 1])) | n = int(eval(input()))
h=list(map(int,input().split()))
dp=[0]*(n)
dp[1]=abs(h[1]-h[0])
for i in range(2,n):
dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
print((dp[n-1]))
| 9 | 7 | 276 | 187 | N = int(eval(input()))
(*h,) = list(map(int, input().split()))
dp = [float("inf") for _ in range(N)]
dp[0] = 0
for i in range(N - 1):
dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))
if i < N - 2:
dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]))
print((dp[N - 1]))
| n = int(eval(input()))
h = list(map(int, input().split()))
dp = [0] * (n)
dp[1] = abs(h[1] - h[0])
for i in range(2, n):
dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[n - 1]))
| false | 22.222222 | [
"-N = int(eval(input()))",
"-(*h,) = list(map(int, input().split()))",
"-dp = [float(\"inf\") for _ in range(N)]",
"-dp[0] = 0",
"-for i in range(N - 1):",
"- dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))",
"- if i < N - 2:",
"- dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] -... | false | 0.085573 | 0.052631 | 1.625913 | [
"s870840909",
"s694025638"
] |
u440566786 | p02630 | python | s866528027 | s468137222 | 286 | 232 | 88,408 | 92,512 | Accepted | Accepted | 18.88 | import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
from collections import Counter
def resolve():
n = int(eval(input()))
C = Counter(list(map(int, input().split())))
total = 0
for key, val in list(C.items()):
... | import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
from collections import Counter
def resolve():
n = int(eval(input()))
C = Counter(list(map(int, input().split())))
total = 0
for key, val in list(C.items()):
... | 21 | 21 | 522 | 528 | import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda: sys.stdin.readline().rstrip()
from collections import Counter
def resolve():
n = int(eval(input()))
C = Counter(list(map(int, input().split())))
total = 0
for key, val in list(C.items()):
t... | import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda: sys.stdin.readline().rstrip()
from collections import Counter
def resolve():
n = int(eval(input()))
C = Counter(list(map(int, input().split())))
total = 0
for key, val in list(C.items()):
t... | false | 0 | [
"- k = C[b]",
"- total += k * (c - b)",
"+ num = C[b]",
"+ total += (c - b) * num",
"- C[c] += k",
"+ C[c] += num"
] | false | 0.039374 | 0.040116 | 0.981509 | [
"s866528027",
"s468137222"
] |
u506858457 | p02832 | python | s191406301 | s879349898 | 151 | 101 | 26,268 | 26,140 | Accepted | Accepted | 33.11 | '''ika tako
先頭から貪欲に残せる要素を拾っていって、
残る要素数を N から引いた値が答え
'''
n = int(eval(input()))
aaa = list(map(int, input().split()))
if 1 not in aaa:#'1'がどこにも無ければ不可能なので'-1'を出力して終了
print((-1))
exit()
i = 0
a = 1
while True:
try:
j = aaa.index(a, i)
#文字列.index(検索する文字列 [,開始の位置 [,終了の位置]])
... | '''AtCoder水色になりたいのよさ
一番左を「1」にするために、「num」の初期値を1にし、
配列aを順番に判定していきます。
1以外のブロックは壊して「b_num」に足していきます。
1が見つかった後は、「num」を1増やして、同じ処理を続けます。
結果的に壊したブロックの数「b_num」が答えになります。
'''
n = int(eval(input()))
a = list(map(int, input().split()))
num = 1
b_num = 0
for i in range(n):
if num != a[i]:
b_num += 1
el... | 23 | 22 | 421 | 385 | """ika tako
先頭から貪欲に残せる要素を拾っていって、
残る要素数を N から引いた値が答え
"""
n = int(eval(input()))
aaa = list(map(int, input().split()))
if 1 not in aaa: #'1'がどこにも無ければ不可能なので'-1'を出力して終了
print((-1))
exit()
i = 0
a = 1
while True:
try:
j = aaa.index(a, i)
# 文字列.index(検索する文字列 [,開始の位置 [,終了の位置]])
except ValueE... | """AtCoder水色になりたいのよさ
一番左を「1」にするために、「num」の初期値を1にし、
配列aを順番に判定していきます。
1以外のブロックは壊して「b_num」に足していきます。
1が見つかった後は、「num」を1増やして、同じ処理を続けます。
結果的に壊したブロックの数「b_num」が答えになります。
"""
n = int(eval(input()))
a = list(map(int, input().split()))
num = 1
b_num = 0
for i in range(n):
if num != a[i]:
b_num += 1
else:
num ... | false | 4.347826 | [
"-\"\"\"ika tako",
"-先頭から貪欲に残せる要素を拾っていって、",
"-残る要素数を N から引いた値が答え",
"+\"\"\"AtCoder水色になりたいのよさ",
"+一番左を「1」にするために、「num」の初期値を1にし、",
"+配列aを順番に判定していきます。",
"+1以外のブロックは壊して「b_num」に足していきます。",
"+1が見つかった後は、「num」を1増やして、同じ処理を続けます。",
"+結果的に壊したブロックの数「b_num」が答えになります。",
"-aaa = list(map(int, input().split()))",
... | false | 0.038487 | 0.045733 | 0.841561 | [
"s191406301",
"s879349898"
] |
u375616706 | p03578 | python | s619735532 | s592141955 | 296 | 197 | 55,264 | 139,704 | Accepted | Accepted | 33.45 | from collections import Counter
N=int(eval(input()))
C = Counter(list(map(int,input().split())))
O=int(eval(input()))
M = Counter(list(map(int,input().split())))
for key in list(M.keys()):
if C[key]<M[key]:
print("NO")
break
else:
print("YES")
| from collections import Counter
N = int(eval(input()))
D=list(map(int,input().split()))
M = int(eval(input()))
T=list(map(int,input().split()))
C=Counter(D)
for t in T:
if C[t]<=0:
print("NO")
exit()
else:
C[t]-=1
print("YES")
| 12 | 15 | 251 | 263 | from collections import Counter
N = int(eval(input()))
C = Counter(list(map(int, input().split())))
O = int(eval(input()))
M = Counter(list(map(int, input().split())))
for key in list(M.keys()):
if C[key] < M[key]:
print("NO")
break
else:
print("YES")
| from collections import Counter
N = int(eval(input()))
D = list(map(int, input().split()))
M = int(eval(input()))
T = list(map(int, input().split()))
C = Counter(D)
for t in T:
if C[t] <= 0:
print("NO")
exit()
else:
C[t] -= 1
print("YES")
| false | 20 | [
"-C = Counter(list(map(int, input().split())))",
"-O = int(eval(input()))",
"-M = Counter(list(map(int, input().split())))",
"-for key in list(M.keys()):",
"- if C[key] < M[key]:",
"+D = list(map(int, input().split()))",
"+M = int(eval(input()))",
"+T = list(map(int, input().split()))",
"+C = Cou... | false | 0.031982 | 0.080721 | 0.396209 | [
"s619735532",
"s592141955"
] |
u591503175 | p02954 | python | s622677396 | s952177888 | 168 | 148 | 7,280 | 7,152 | Accepted | Accepted | 11.9 | def resolve():
'''
code here
'''
S = eval(input())
memo = 1
new_list = []
prev = S[0]
cnt = 0
for i in range(len(S)-1):
if S[i+1] == prev:
memo += 1
else:
new_list.append(memo)
memo = 1
prev = S[i+1]... | def resolve():
'''
code here
'''
S = eval(input())
memo = 1
new_list = []
prev = S[0]
for i in range(len(S)-1):
if S[i+1] == prev:
memo += 1
else:
new_list.append(memo)
memo = 1
prev = S[i+1]
else:
... | 47 | 38 | 980 | 692 | def resolve():
"""
code here
"""
S = eval(input())
memo = 1
new_list = []
prev = S[0]
cnt = 0
for i in range(len(S) - 1):
if S[i + 1] == prev:
memo += 1
else:
new_list.append(memo)
memo = 1
prev = S[i + 1]
else:
... | def resolve():
"""
code here
"""
S = eval(input())
memo = 1
new_list = []
prev = S[0]
for i in range(len(S) - 1):
if S[i + 1] == prev:
memo += 1
else:
new_list.append(memo)
memo = 1
prev = S[i + 1]
else:
new_list.app... | false | 19.148936 | [
"- cnt = 0",
"- if (a + b) % 2 == 1:",
"- res += [0 for _ in range(new_list[i * 2])]",
"- res[-1] = (a + 1) // 2 + b // 2",
"- res += [a // 2 + (b + 1) // 2]",
"- res += [0 for _ in range(new_list[i * 2 + 1] - 1)]",
"- else:",
"- ... | false | 0.047893 | 0.039646 | 1.208013 | [
"s622677396",
"s952177888"
] |
u298297089 | p03481 | python | s854554737 | s450363628 | 163 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.57 | X,Y = list(map(int, input().split()))
ans = 0
while X <= Y:
ans += 1
X = X << 1
print(ans)
| x,y = list(map(int, input().split()))
cnt = 0
while x <= y:
x *= 2
cnt += 1
print(cnt)
| 8 | 7 | 106 | 96 | X, Y = list(map(int, input().split()))
ans = 0
while X <= Y:
ans += 1
X = X << 1
print(ans)
| x, y = list(map(int, input().split()))
cnt = 0
while x <= y:
x *= 2
cnt += 1
print(cnt)
| false | 12.5 | [
"-X, Y = list(map(int, input().split()))",
"-ans = 0",
"-while X <= Y:",
"- ans += 1",
"- X = X << 1",
"-print(ans)",
"+x, y = list(map(int, input().split()))",
"+cnt = 0",
"+while x <= y:",
"+ x *= 2",
"+ cnt += 1",
"+print(cnt)"
] | false | 0.043819 | 0.045169 | 0.970112 | [
"s854554737",
"s450363628"
] |
u796942881 | p03607 | python | s741772375 | s718576998 | 86 | 74 | 18,772 | 18,668 | Accepted | Accepted | 13.95 | from collections import Counter
from sys import stdin
lines = stdin.readlines
N, *A = [int(line) for line in lines()]
An = Counter(A)
def main():
print((sum([1 for k, v in list(An.items()) if v % 2])))
return
main()
| from collections import Counter
from sys import stdin
lines = stdin.readlines
N, *A = list(map(int, lines()))
An = Counter(A)
def main():
print((sum([1 for v in list(An.values()) if v % 2])))
return
main()
| 15 | 15 | 236 | 220 | from collections import Counter
from sys import stdin
lines = stdin.readlines
N, *A = [int(line) for line in lines()]
An = Counter(A)
def main():
print((sum([1 for k, v in list(An.items()) if v % 2])))
return
main()
| from collections import Counter
from sys import stdin
lines = stdin.readlines
N, *A = list(map(int, lines()))
An = Counter(A)
def main():
print((sum([1 for v in list(An.values()) if v % 2])))
return
main()
| false | 0 | [
"-N, *A = [int(line) for line in lines()]",
"+N, *A = list(map(int, lines()))",
"- print((sum([1 for k, v in list(An.items()) if v % 2])))",
"+ print((sum([1 for v in list(An.values()) if v % 2])))"
] | false | 0.03888 | 0.046425 | 0.837486 | [
"s741772375",
"s718576998"
] |
u827202523 | p03295 | python | s810200065 | s966169705 | 354 | 210 | 7,080 | 84,864 | Accepted | Accepted | 40.68 | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
N, M = getNM()
req = [N for i in range(N)]
for i in range(M):
l,r = getNM()
if req[l] > r-1:
req[l] = r-1
ans = 0
tar = 0
#print(re... | import sys
from collections import defaultdict, deque, Counter
import math
# import copy
from bisect import bisect_left, bisect_right
# import heapq
# sys.setrecursionlimit(1000000)
# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(eval(input()))
getList = l... | 27 | 94 | 501 | 2,013 | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
N, M = getNM()
req = [N for i in range(N)]
for i in range(M):
l, r = getNM()
if req[l] > r - 1:
req[l] = r - 1
ans = 0
tar = 0
# print(req) #[... | import sys
from collections import defaultdict, deque, Counter
import math
# import copy
from bisect import bisect_left, bisect_right
# import heapq
# sys.setrecursionlimit(1000000)
# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(eval(input()))
getList = lambda: list(map(i... | false | 71.276596 | [
"-def getN():",
"- return int(eval(input()))",
"+import sys",
"+from collections import defaultdict, deque, Counter",
"+import math",
"+",
"+# import copy",
"+from bisect import bisect_left, bisect_right",
"+",
"+# import heapq",
"+# sys.setrecursionlimit(1000000)",
"+# input aliases",
"+... | false | 0.072602 | 0.03843 | 1.889182 | [
"s810200065",
"s966169705"
] |
u047796752 | p03785 | python | s901124541 | s152921378 | 249 | 100 | 43,996 | 77,108 | Accepted | Accepted | 59.84 | import sys
input = sys.stdin.readline
N, C, K = list(map(int, input().split()))
T = [int(eval(input())) for _ in range(N)]
T.sort()
now = 0
ans = 0
while now<N:
ans += 1
lim = T[now]+K
for _ in range(C):
if T[now]<=lim:
now += 1
else:
break
... | import sys
input = sys.stdin.readline
N, C, K = list(map(int, input().split()))
T = [int(eval(input())) for _ in range(N)]
T.sort()
ans = 0
i = 0
while i<N:
lim = T[i]+K
ans += 1
cnt = 0
while i<N and cnt<C and T[i]<=lim:
i += 1
cnt += 1
print(ans) | 23 | 19 | 367 | 302 | import sys
input = sys.stdin.readline
N, C, K = list(map(int, input().split()))
T = [int(eval(input())) for _ in range(N)]
T.sort()
now = 0
ans = 0
while now < N:
ans += 1
lim = T[now] + K
for _ in range(C):
if T[now] <= lim:
now += 1
else:
break
if now == N:... | import sys
input = sys.stdin.readline
N, C, K = list(map(int, input().split()))
T = [int(eval(input())) for _ in range(N)]
T.sort()
ans = 0
i = 0
while i < N:
lim = T[i] + K
ans += 1
cnt = 0
while i < N and cnt < C and T[i] <= lim:
i += 1
cnt += 1
print(ans)
| false | 17.391304 | [
"-now = 0",
"-while now < N:",
"+i = 0",
"+while i < N:",
"+ lim = T[i] + K",
"- lim = T[now] + K",
"- for _ in range(C):",
"- if T[now] <= lim:",
"- now += 1",
"- else:",
"- break",
"- if now == N:",
"- break",
"+ cnt = 0",... | false | 0.038217 | 0.10281 | 0.371725 | [
"s901124541",
"s152921378"
] |
u436982376 | p02678 | python | s049316573 | s125564840 | 1,031 | 672 | 34,156 | 34,048 | Accepted | Accepted | 34.82 | import queue
n,m = list(map(int,input().split()))
hen = [[] for i in range(n)]
ans = [0 for i in range(n)]
a,b = 0,0
for i in range(m):
a,b = list(map(int,input().split()))
hen[a-1].append(b)
hen[b-1].append(a)
q = queue.Queue()
q.put(1)
while q.empty() == False:
head = q.get()
... | from collections import deque
n, m = list(map(int,input().split()))
turo = [[] for i in range(n+1)]
sirusi = [-1 for i in range(n+1)]
for i in range(m):
tmp = list(map(int,input().split()))
turo[tmp[0]].append(tmp[1])
turo[tmp[1]].append(tmp[0])
sirusi[1] = 0
q = deque()
q.append(1)
whi... | 36 | 27 | 617 | 546 | import queue
n, m = list(map(int, input().split()))
hen = [[] for i in range(n)]
ans = [0 for i in range(n)]
a, b = 0, 0
for i in range(m):
a, b = list(map(int, input().split()))
hen[a - 1].append(b)
hen[b - 1].append(a)
q = queue.Queue()
q.put(1)
while q.empty() == False:
head = q.get()
for h in h... | from collections import deque
n, m = list(map(int, input().split()))
turo = [[] for i in range(n + 1)]
sirusi = [-1 for i in range(n + 1)]
for i in range(m):
tmp = list(map(int, input().split()))
turo[tmp[0]].append(tmp[1])
turo[tmp[1]].append(tmp[0])
sirusi[1] = 0
q = deque()
q.append(1)
while len(q) != 0... | false | 25 | [
"-import queue",
"+from collections import deque",
"-hen = [[] for i in range(n)]",
"-ans = [0 for i in range(n)]",
"-a, b = 0, 0",
"+turo = [[] for i in range(n + 1)]",
"+sirusi = [-1 for i in range(n + 1)]",
"- a, b = list(map(int, input().split()))",
"- hen[a - 1].append(b)",
"- hen[b ... | false | 0.037411 | 0.063526 | 0.588903 | [
"s049316573",
"s125564840"
] |
u561231954 | p02821 | python | s526220717 | s732460824 | 777 | 355 | 23,412 | 23,396 | Accepted | Accepted | 54.31 | def main():
import numpy as np
n,m=list(map(int,input().split()))
A=list(map(int,input().split()))
A.sort()
A=np.array(A)
def cnt_shake(x): #握手の組であって合計パワーがx以上となる組みの数
return n**2-np.searchsorted(A,x-A).sum()
right=10**10*1
left=-10**10-1
while right-left>1:
... | def main():
import numpy as np
n,m=list(map(int,input().split()))
A=list(map(int,input().split()))
A.sort()
A=np.array(A)
def cnt_shake(x): #握手の組であって合計パワーがx以上となる組みの数
return n**2-np.searchsorted(A,x-A).sum()
right=2*10**5+1
left=-1
while right-left>1:
... | 34 | 27 | 754 | 660 | def main():
import numpy as np
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
A = np.array(A)
def cnt_shake(x): # 握手の組であって合計パワーがx以上となる組みの数
return n**2 - np.searchsorted(A, x - A).sum()
right = 10**10 * 1
left = -(10**10) - 1
while righ... | def main():
import numpy as np
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
A = np.array(A)
def cnt_shake(x): # 握手の組であって合計パワーがx以上となる組みの数
return n**2 - np.searchsorted(A, x - A).sum()
right = 2 * 10**5 + 1
left = -1
while right - left... | false | 20.588235 | [
"- right = 10**10 * 1",
"- left = -(10**10) - 1",
"+ right = 2 * 10**5 + 1",
"+ left = -1",
"- # print(border,A,B,C)",
"- s, cnt = 0, 0",
"- for i in range(n):",
"- if C[i] > 0:",
"- cnt += C[i]",
"- s += B[C[i] - 1] + A[i] * C[i]",
"- s += bo... | false | 0.170787 | 0.178074 | 0.959081 | [
"s526220717",
"s732460824"
] |
u185896732 | p03805 | python | s097117785 | s111649120 | 225 | 35 | 42,844 | 3,064 | Accepted | Accepted | 84.44 | import os,re,sys,operator
from collections import Counter,deque
from operator import itemgetter
from itertools import accumulate,combinations,groupby
from sys import stdin,setrecursionlimit
from copy import deepcopy
import heapq
setrecursionlimit(10**6)
def dfs(now,depth):
global used
global gragh... | import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
n,m=list(map(int,input().split()))
G=[[False]*n for _ in range(n)]
used=[False]*n
def dfs(now,depth):
if used[now]:
return 0
if n==depth:
return 1
used[now]=True
ans=0
for i in range(n):
if G... | 36 | 28 | 781 | 512 | import os, re, sys, operator
from collections import Counter, deque
from operator import itemgetter
from itertools import accumulate, combinations, groupby
from sys import stdin, setrecursionlimit
from copy import deepcopy
import heapq
setrecursionlimit(10**6)
def dfs(now, depth):
global used
global gragh
... | import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
n, m = list(map(int, input().split()))
G = [[False] * n for _ in range(n)]
used = [False] * n
def dfs(now, depth):
if used[now]:
return 0
if n == depth:
return 1
used[now] = True
ans = 0
for i in range(n):
... | false | 22.222222 | [
"-import os, re, sys, operator",
"-from collections import Counter, deque",
"-from operator import itemgetter",
"-from itertools import accumulate, combinations, groupby",
"-from sys import stdin, setrecursionlimit",
"-from copy import deepcopy",
"-import heapq",
"+import sys",
"-setrecursionlimit(1... | false | 0.037472 | 0.058342 | 0.642279 | [
"s097117785",
"s111649120"
] |
u631277801 | p03305 | python | s822582518 | s974420711 | 1,438 | 1,202 | 81,452 | 125,548 | Accepted | Accepted | 16.41 |
import heapq as hq
INF = 10**16
OKANE = 10**15
N, M, S, T = list(map(int, input().split()))
graph_yen = [[] for _ in range(N+1)]
graph_snk = [[] for _ in range(N+1)]
for i in range(M):
u, v, a, b = list(map(int, input().split()))
graph_yen[u].append((a, v))
graph_yen[v].append((a, u... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x) - 1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.r... | 63 | 74 | 1,314 | 1,691 | import heapq as hq
INF = 10**16
OKANE = 10**15
N, M, S, T = list(map(int, input().split()))
graph_yen = [[] for _ in range(N + 1)]
graph_snk = [[] for _ in range(N + 1)]
for i in range(M):
u, v, a, b = list(map(int, input().split()))
graph_yen[u].append((a, v))
graph_yen[v].append((a, u))
graph_snk[u].... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**7)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | false | 14.864865 | [
"-import heapq as hq",
"+import sys",
"-INF = 10**16",
"-OKANE = 10**15",
"-N, M, S, T = list(map(int, input().split()))",
"-graph_yen = [[] for _ in range(N + 1)]",
"-graph_snk = [[] for _ in range(N + 1)]",
"-for i in range(M):",
"- u, v, a, b = list(map(int, input().split()))",
"- graph_y... | false | 0.048364 | 0.049397 | 0.979095 | [
"s822582518",
"s974420711"
] |
u225084815 | p02689 | python | s046674056 | s749655838 | 231 | 152 | 93,424 | 93,712 | Accepted | Accepted | 34.2 | n, m = list(map(int, input().split()))
n_l = [1] * n
h_l = list(map(int, input().split())) #list
ab_li = [list(map(int, input().split())) for _ in range(m)] #n行にmつずつ入力される整数
for a, b in ab_li:
if h_l[a-1] > h_l[b-1]:
n_l[b-1] = 0
elif h_l[a-1] < h_l[b-1]:
n_l[a-1] = 0
else:
... | import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return list(map(int,sys.stdin.readline().rstrip().split()))
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS()... | 13 | 20 | 365 | 663 | n, m = list(map(int, input().split()))
n_l = [1] * n
h_l = list(map(int, input().split())) # list
ab_li = [list(map(int, input().split())) for _ in range(m)] # n行にmつずつ入力される整数
for a, b in ab_li:
if h_l[a - 1] > h_l[b - 1]:
n_l[b - 1] = 0
elif h_l[a - 1] < h_l[b - 1]:
n_l[a - 1] = 0
else:
... | import bisect, collections, copy, heapq, itertools, math, string
import sys
def S():
return sys.stdin.readline().rstrip()
def M():
return list(map(int, sys.stdin.readline().rstrip().split()))
def I():
return int(sys.stdin.readline().rstrip())
def LI():
return list(map(int, sys.stdin.readline().r... | false | 35 | [
"-n, m = list(map(int, input().split()))",
"-n_l = [1] * n",
"-h_l = list(map(int, input().split())) # list",
"-ab_li = [list(map(int, input().split())) for _ in range(m)] # n行にmつずつ入力される整数",
"-for a, b in ab_li:",
"- if h_l[a - 1] > h_l[b - 1]:",
"- n_l[b - 1] = 0",
"- elif h_l[a - 1] <... | false | 0.047695 | 0.130395 | 0.365772 | [
"s046674056",
"s749655838"
] |
u379142263 | p02594 | python | s244329171 | s731967424 | 141 | 72 | 67,896 | 61,688 | Accepted | Accepted | 48.94 | import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
INF = 10**18
if __name__ == "__main__":
x = int(eval(input()))
if x>=30:
print("Yes")
else:
print("No") | x = int(eval(input()))
if x>=30:
print("Yes")
else:
print("No") | 16 | 5 | 302 | 65 | import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify, heappop, heappush, heappushpop
import math
import collections
import copy
INF = 10**18
if __name__ == "__main__":
x = int(eval(input()))
if x >= 30:
print("Yes")
else:
print("No")
| x = int(eval(input()))
if x >= 30:
print("Yes")
else:
print("No")
| false | 68.75 | [
"-import sys",
"-import itertools",
"-",
"-sys.setrecursionlimit(1000000000)",
"-from heapq import heapify, heappop, heappush, heappushpop",
"-import math",
"-import collections",
"-import copy",
"-",
"-INF = 10**18",
"-if __name__ == \"__main__\":",
"- x = int(eval(input()))",
"- if x... | false | 0.045991 | 0.046413 | 0.990893 | [
"s244329171",
"s731967424"
] |
u207241407 | p02844 | python | s433633417 | s172115329 | 31 | 27 | 9,204 | 9,196 | Accepted | Accepted | 12.9 | n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(10):
a = s.find(str(i))
if a == -1:
continue
for j in range(10):
b = s.find(str(j), a + 1)
if b == -1:
continue
for k in range(10):
c = s.find(str(k), b + 1)
i... | def main():
n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(10):
a = s.find(str(i))
if a == -1:
continue
for j in range(10):
b = s.find(str(j), a + 1)
if b == -1:
continue
for k in ran... | 19 | 24 | 378 | 503 | n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(10):
a = s.find(str(i))
if a == -1:
continue
for j in range(10):
b = s.find(str(j), a + 1)
if b == -1:
continue
for k in range(10):
c = s.find(str(k), b + 1)
if c == -1:
... | def main():
n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(10):
a = s.find(str(i))
if a == -1:
continue
for j in range(10):
b = s.find(str(j), a + 1)
if b == -1:
continue
for k in range(10):
... | false | 20.833333 | [
"-n = int(eval(input()))",
"-s = eval(input())",
"-ans = 0",
"-for i in range(10):",
"- a = s.find(str(i))",
"- if a == -1:",
"- continue",
"- for j in range(10):",
"- b = s.find(str(j), a + 1)",
"- if b == -1:",
"+def main():",
"+ n = int(eval(input()))",
"+... | false | 0.146689 | 0.048532 | 3.022506 | [
"s433633417",
"s172115329"
] |
u048945791 | p03339 | python | s497663602 | s733801773 | 168 | 147 | 6,044 | 6,048 | Accepted | Accepted | 12.5 | N = int(eval(input()))
S = eval(input())
leftWest = 0
rightEast = list(S).count("E")
ans = 10 ** 6
for si in S:
if si == "E":
rightEast -= 1
ans = min(ans, leftWest + rightEast)
if si == "W":
leftWest += 1
print(ans) | N = int(eval(input()))
S = eval(input())
cost = list(S).count("E")
ans = 10 ** 6
for si in S:
if si == "E":
cost -= 1
ans = min(ans, cost)
if si == "W":
cost += 1
print(ans) | 17 | 16 | 257 | 213 | N = int(eval(input()))
S = eval(input())
leftWest = 0
rightEast = list(S).count("E")
ans = 10**6
for si in S:
if si == "E":
rightEast -= 1
ans = min(ans, leftWest + rightEast)
if si == "W":
leftWest += 1
print(ans)
| N = int(eval(input()))
S = eval(input())
cost = list(S).count("E")
ans = 10**6
for si in S:
if si == "E":
cost -= 1
ans = min(ans, cost)
if si == "W":
cost += 1
print(ans)
| false | 5.882353 | [
"-leftWest = 0",
"-rightEast = list(S).count(\"E\")",
"+cost = list(S).count(\"E\")",
"- rightEast -= 1",
"- ans = min(ans, leftWest + rightEast)",
"+ cost -= 1",
"+ ans = min(ans, cost)",
"- leftWest += 1",
"+ cost += 1"
] | false | 0.121046 | 0.165994 | 0.729216 | [
"s497663602",
"s733801773"
] |
u935558307 | p03476 | python | s485661693 | s915212029 | 1,914 | 1,034 | 51,292 | 51,928 | Accepted | Accepted | 45.98 | """
事前に、100000以下の数のうち、2017に似た数を列挙しておく。
メモの仕方としては、2017に似た数を小さい順に並べておけばよい。
2017に似た数を探すのは、まず100000以下の素数を全部列挙して、その中で条件に当てはまるものを愚直に探す。
"""
memo = [1]*(100001)
memo[0] = 0
memo[1] = 0
primes = set()
for i in range(100001):
if memo[i] == 1:
primes.add(i)
for j in range(i*2,100001,i):
... | """
10^5以下の素数を列挙しておく。
それをもとに、10^5以下の各整数以下の2017に似た数の個数のメモを作成する。
"""
#10^5以下の素数を列挙
prime = [1] * (100001)
prime[0] = 0
prime[1] = 0
for i in range(2,100001):
if prime[i]:
for j in range(i*i,100001,i):
prime[j] = 0
memo = [0]*(100001)
for i in range(3,100001):
memo[i] = memo[i-1... | 28 | 23 | 594 | 487 | """
事前に、100000以下の数のうち、2017に似た数を列挙しておく。
メモの仕方としては、2017に似た数を小さい順に並べておけばよい。
2017に似た数を探すのは、まず100000以下の素数を全部列挙して、その中で条件に当てはまるものを愚直に探す。
"""
memo = [1] * (100001)
memo[0] = 0
memo[1] = 0
primes = set()
for i in range(100001):
if memo[i] == 1:
primes.add(i)
for j in range(i * 2, 100001, i):
memo... | """
10^5以下の素数を列挙しておく。
それをもとに、10^5以下の各整数以下の2017に似た数の個数のメモを作成する。
"""
# 10^5以下の素数を列挙
prime = [1] * (100001)
prime[0] = 0
prime[1] = 0
for i in range(2, 100001):
if prime[i]:
for j in range(i * i, 100001, i):
prime[j] = 0
memo = [0] * (100001)
for i in range(3, 100001):
memo[i] = memo[i - 1]
... | false | 17.857143 | [
"-事前に、100000以下の数のうち、2017に似た数を列挙しておく。",
"-メモの仕方としては、2017に似た数を小さい順に並べておけばよい。",
"-2017に似た数を探すのは、まず100000以下の素数を全部列挙して、その中で条件に当てはまるものを愚直に探す。",
"+10^5以下の素数を列挙しておく。",
"+それをもとに、10^5以下の各整数以下の2017に似た数の個数のメモを作成する。",
"-memo = [1] * (100001)",
"-memo[0] = 0",
"-memo[1] = 0",
"-primes = set()",
"-for i in range... | false | 0.088926 | 0.169007 | 0.526172 | [
"s485661693",
"s915212029"
] |
u648881683 | p02936 | python | s851478032 | s492893546 | 1,718 | 1,111 | 268,444 | 56,712 | Accepted | Accepted | 35.33 | import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**6)
def resolve():
N, Q = list(map(int, input().split()))
edge = [[] for _ in range(N)]
for i in range(N-1):
a, b = list(map(int, input().split()))
edge[a-1].append(b-1)
edge[b-1].append(a-1... | import sys
input = lambda: sys.stdin.readline().rstrip()
def resolve():
N, Q = list(map(int, input().split()))
edge = [[] for _ in range(N)]
for i in range(N-1):
a, b = list(map(int, input().split()))
edge[a-1].append(b-1)
edge[b-1].append(a-1)
cnt = [0]*N
for i ... | 29 | 35 | 649 | 847 | import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**6)
def resolve():
N, Q = list(map(int, input().split()))
edge = [[] for _ in range(N)]
for i in range(N - 1):
a, b = list(map(int, input().split()))
edge[a - 1].append(b - 1)
edge[b - 1].append(a - ... | import sys
input = lambda: sys.stdin.readline().rstrip()
def resolve():
N, Q = list(map(int, input().split()))
edge = [[] for _ in range(N)]
for i in range(N - 1):
a, b = list(map(int, input().split()))
edge[a - 1].append(b - 1)
edge[b - 1].append(a - 1)
cnt = [0] * N
for ... | false | 17.142857 | [
"-sys.setrecursionlimit(10**6)",
"-",
"- def dfs(v, par):",
"+ stk = []",
"+ # visited = set()",
"+ stk.append((0, -1))",
"+ while len(stk):",
"+ # print(stk, visited)",
"+ v, par = stk.pop()",
"+ # if not v in visited:",
"+ # visited.add(v)",
"- ... | false | 0.043709 | 0.037698 | 1.159432 | [
"s851478032",
"s492893546"
] |
u014333473 | p03011 | python | s416435794 | s039446207 | 30 | 26 | 9,088 | 9,164 | Accepted | Accepted | 13.33 | p,q,r=list(map(int,input().split()));print((min(p+q,q+r,r+p))) | print((sum(sorted(map(int,input().split()))[:2]))) | 1 | 1 | 54 | 48 | p, q, r = list(map(int, input().split()))
print((min(p + q, q + r, r + p)))
| print((sum(sorted(map(int, input().split()))[:2])))
| false | 0 | [
"-p, q, r = list(map(int, input().split()))",
"-print((min(p + q, q + r, r + p)))",
"+print((sum(sorted(map(int, input().split()))[:2])))"
] | false | 0.042016 | 0.039869 | 1.053855 | [
"s416435794",
"s039446207"
] |
u585482323 | p03061 | python | s097788423 | s482483240 | 1,551 | 1,274 | 124,380 | 124,508 | Accepted | Accepted | 17.86 | import operator
class SegmentTree:
def __init__(self, size, default, op = operator.add):
self.size = 1
while self.size < size:
self.size *= 2
self.dat = [default for i in range(self.size*2-1)]
self.op = op
def update(self, i, x):
i += self.size - 1
... | import operator
class SegmentTree:
def __init__(self, size, default, op = operator.add):
self.size = 2**size.bit_length()
self.dat = [default]*(self.size*2)
self.op = op
def update(self, i, x):
i += self.size
self.dat[i] = x
while i > 0:
i ... | 62 | 63 | 1,550 | 1,568 | import operator
class SegmentTree:
def __init__(self, size, default, op=operator.add):
self.size = 1
while self.size < size:
self.size *= 2
self.dat = [default for i in range(self.size * 2 - 1)]
self.op = op
def update(self, i, x):
i += self.size - 1
... | import operator
class SegmentTree:
def __init__(self, size, default, op=operator.add):
self.size = 2 ** size.bit_length()
self.dat = [default] * (self.size * 2)
self.op = op
def update(self, i, x):
i += self.size
self.dat[i] = x
while i > 0:
i >>= 1... | false | 1.587302 | [
"- self.size = 1",
"- while self.size < size:",
"- self.size *= 2",
"- self.dat = [default for i in range(self.size * 2 - 1)]",
"+ self.size = 2 ** size.bit_length()",
"+ self.dat = [default] * (self.size * 2)",
"- i += self.size - 1",
"+ i +... | false | 0.048832 | 0.050233 | 0.9721 | [
"s097788423",
"s482483240"
] |
u514383727 | p02744 | python | s468027477 | s358773917 | 154 | 134 | 12,772 | 4,412 | Accepted | Accepted | 12.99 | N = int(eval(input()))
al = "abcdefghijklmnopqrstuvwxyz"
atoi = {s:i for i, s in enumerate(al)}
itoa = {i:s for i, s in enumerate(al)}
l = []
def func(s, i):
if i == N:
print(s)
l.append(s)
return
# if al[:i] == s:
# for c in al[:i+1]:
# func(s + c, i+1)... | N = int(eval(input()))
al = "abcdefghijklmnopqrstuvwxyz"
atoi = {s:i for i, s in enumerate(al)}
def func(s, i):
if i == N:
print(s)
return
maxi = max([atoi[c] for c in s])
for c in al[:maxi+2]:
func(s+c, i+1)
func("a", 1)
| 28 | 15 | 590 | 270 | N = int(eval(input()))
al = "abcdefghijklmnopqrstuvwxyz"
atoi = {s: i for i, s in enumerate(al)}
itoa = {i: s for i, s in enumerate(al)}
l = []
def func(s, i):
if i == N:
print(s)
l.append(s)
return
# if al[:i] == s:
# for c in al[:i+1]:
# func(s + c, i+1)
# els... | N = int(eval(input()))
al = "abcdefghijklmnopqrstuvwxyz"
atoi = {s: i for i, s in enumerate(al)}
def func(s, i):
if i == N:
print(s)
return
maxi = max([atoi[c] for c in s])
for c in al[: maxi + 2]:
func(s + c, i + 1)
func("a", 1)
| false | 46.428571 | [
"-itoa = {i: s for i, s in enumerate(al)}",
"-l = []",
"- l.append(s)",
"- # if al[:i] == s:",
"- # for c in al[:i+1]:",
"- # func(s + c, i+1)",
"- # else:",
"- # for c in al:",
"- # func(s + c, i+1 )",
"- # if i == N - 1:",
"- # else:",
"... | false | 0.03885 | 0.041392 | 0.938579 | [
"s468027477",
"s358773917"
] |
u119148115 | p02556 | python | s312934580 | s719221024 | 216 | 158 | 119,580 | 91,556 | Accepted | Accepted | 26.85 | import sys
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし
def ... | import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N = I()
A,B = [],[] # x+y,x-y たちのリスト
for i in range(N):
x,y = MI()
A.append(x+y)
B.append(x-y)
print((max(max(A)-min(A),max(B)-min(B))))
| 25 | 13 | 699 | 289 | import sys
sys.setrecursionlimit(10**7)
def I():
return int(sys.stdin.readline().rstrip())
def MI():
return list(map(int, sys.stdin.readline().rstrip().split()))
def LI():
return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり
def LI2():
return list(map(int, sys.stdin.readline().r... | import sys
def I():
return int(sys.stdin.readline().rstrip())
def MI():
return list(map(int, sys.stdin.readline().rstrip().split()))
N = I()
A, B = [], [] # x+y,x-y たちのリスト
for i in range(N):
x, y = MI()
A.append(x + y)
B.append(x - y)
print((max(max(A) - min(A), max(B) - min(B))))
| false | 48 | [
"-",
"-sys.setrecursionlimit(10**7)",
"-def LI():",
"- return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり",
"-",
"-",
"-def LI2():",
"- return list(map(int, sys.stdin.readline().rstrip())) # 空白なし",
"-",
"-",
"-def S():",
"- return sys.stdin.readline().rstrip()",
"... | false | 0.037346 | 0.035642 | 1.04781 | [
"s312934580",
"s719221024"
] |
u229478139 | p02388 | python | s576937327 | s922762309 | 30 | 20 | 7,628 | 5,584 | Accepted | Accepted | 33.33 | x=int(eval(input()))
print((x**3)) | def cubic(x):
return x**3
x = int(eval(input()))
ans = cubic(x)
print(ans)
| 2 | 9 | 27 | 85 | x = int(eval(input()))
print((x**3))
| def cubic(x):
return x**3
x = int(eval(input()))
ans = cubic(x)
print(ans)
| false | 77.777778 | [
"+def cubic(x):",
"+ return x**3",
"+",
"+",
"-print((x**3))",
"+ans = cubic(x)",
"+print(ans)"
] | false | 0.045564 | 0.045833 | 0.994132 | [
"s576937327",
"s922762309"
] |
u961223096 | p02555 | python | s461761144 | s863716398 | 1,209 | 617 | 33,940 | 34,012 | Accepted | Accepted | 48.97 | import numpy as np
MOD = 10**9+7
n = int(eval(input()))
arr = np.zeros((n+1,n+1), dtype=int)
for i in np.arange(3,n+1):
arr[0,i] = 1
for i in np.arange(1,n+1):
sum_ = 0
for j in np.arange(3*i,n+1):
sum_ += arr[i-1,j]
sum_ %= MOD
if j+3 >= n + 1:
break
... | import sys
import numpy as np
def dump(x):
print(x, file=sys.stderr)
MOD = 10**9+7
N = int(input())
arr = np.zeros((N+1,N+1),dtype=int)
for i in range(3,N+1):
arr[0,i] = 1
for i in range(1,N+1):
sum_ = 0
for j in range(3*i,N+1):
sum_ += arr[i-1,j]
sum_ %= MOD
... | 29 | 38 | 433 | 498 | import numpy as np
MOD = 10**9 + 7
n = int(eval(input()))
arr = np.zeros((n + 1, n + 1), dtype=int)
for i in np.arange(3, n + 1):
arr[0, i] = 1
for i in np.arange(1, n + 1):
sum_ = 0
for j in np.arange(3 * i, n + 1):
sum_ += arr[i - 1, j]
sum_ %= MOD
if j + 3 >= n + 1:
b... | import sys
import numpy as np
def dump(x):
print(x, file=sys.stderr)
MOD = 10**9 + 7
N = int(input())
arr = np.zeros((N + 1, N + 1), dtype=int)
for i in range(3, N + 1):
arr[0, i] = 1
for i in range(1, N + 1):
sum_ = 0
for j in range(3 * i, N + 1):
sum_ += arr[i - 1, j]
sum_ %= MOD
... | false | 23.684211 | [
"+import sys",
"+",
"+def dump(x):",
"+ print(x, file=sys.stderr)",
"+",
"+",
"-n = int(eval(input()))",
"-arr = np.zeros((n + 1, n + 1), dtype=int)",
"-for i in np.arange(3, n + 1):",
"+N = int(input())",
"+arr = np.zeros((N + 1, N + 1), dtype=int)",
"+for i in range(3, N + 1):",
"-for i... | false | 0.359164 | 0.324515 | 1.10677 | [
"s461761144",
"s863716398"
] |
u493520238 | p02901 | python | s958498276 | s244444289 | 1,496 | 302 | 9,204 | 107,076 | Accepted | Accepted | 79.81 | n,m = list(map(int, input().split()))
abcsl = []
for _ in range(m):
a,b = list(map(int, input().split()))
cl = list(map(int, input().split()))
abcsl.append((a,b,cl))
# dp = [ [10**9]*(2**n) for _ in range(m) ]
dp = [10**9]*(2**n)
dp[0] = 0
for a,b,cl in abcsl:
b_bit = 0
for c in cl:
... | n,m = list(map(int, input().split()))
# abl = []
# cl = []
dp = [ [10**9]*(2**n) for _ in range(m+1) ]
dp[0][0] = 0
for i in range(m):
a,b = list(map(int, input().split()))
cl = list(map(int, input().split()))
cbit = 0
for c in cl:
cbit += 2**(c-1)
for j in range(2**n):
... | 22 | 24 | 481 | 550 | n, m = list(map(int, input().split()))
abcsl = []
for _ in range(m):
a, b = list(map(int, input().split()))
cl = list(map(int, input().split()))
abcsl.append((a, b, cl))
# dp = [ [10**9]*(2**n) for _ in range(m) ]
dp = [10**9] * (2**n)
dp[0] = 0
for a, b, cl in abcsl:
b_bit = 0
for c in cl:
... | n, m = list(map(int, input().split()))
# abl = []
# cl = []
dp = [[10**9] * (2**n) for _ in range(m + 1)]
dp[0][0] = 0
for i in range(m):
a, b = list(map(int, input().split()))
cl = list(map(int, input().split()))
cbit = 0
for c in cl:
cbit += 2 ** (c - 1)
for j in range(2**n):
if dp... | false | 8.333333 | [
"-abcsl = []",
"-for _ in range(m):",
"+# abl = []",
"+# cl = []",
"+dp = [[10**9] * (2**n) for _ in range(m + 1)]",
"+dp[0][0] = 0",
"+for i in range(m):",
"- abcsl.append((a, b, cl))",
"-# dp = [ [10**9]*(2**n) for _ in range(m) ]",
"-dp = [10**9] * (2**n)",
"-dp[0] = 0",
"-for a, b, cl i... | false | 0.111938 | 0.035518 | 3.151611 | [
"s958498276",
"s244444289"
] |
u060736237 | p03673 | python | s109785182 | s122345981 | 156 | 119 | 29,124 | 29,124 | Accepted | Accepted | 23.72 | from collections import deque
n, a, b = int(eval(input())), list(map(int, input().split())), deque()
append, appendleft = b.append, b.appendleft
flag = True
for i in range(n):
if flag: append(a[i])
else: appendleft(a[i])
flag = not flag
if not flag: b.reverse()
print((" ".join(list(map(str, b))))) | from collections import deque
def main():
n, a, b = int(eval(input())), list(map(int, input().split())), deque()
append, appendleft = b.append, b.appendleft
flag = True
for el in a:
if flag: append(el)
else: appendleft(el)
flag = not flag
if not flag: b.reverse()
... | 10 | 12 | 311 | 358 | from collections import deque
n, a, b = int(eval(input())), list(map(int, input().split())), deque()
append, appendleft = b.append, b.appendleft
flag = True
for i in range(n):
if flag:
append(a[i])
else:
appendleft(a[i])
flag = not flag
if not flag:
b.reverse()
print((" ".join(list(map(... | from collections import deque
def main():
n, a, b = int(eval(input())), list(map(int, input().split())), deque()
append, appendleft = b.append, b.appendleft
flag = True
for el in a:
if flag:
append(el)
else:
appendleft(el)
flag = not flag
if not flag... | false | 16.666667 | [
"-n, a, b = int(eval(input())), list(map(int, input().split())), deque()",
"-append, appendleft = b.append, b.appendleft",
"-flag = True",
"-for i in range(n):",
"- if flag:",
"- append(a[i])",
"- else:",
"- appendleft(a[i])",
"- flag = not flag",
"-if not flag:",
"- b.... | false | 0.041132 | 0.039659 | 1.03715 | [
"s109785182",
"s122345981"
] |
u254871849 | p03721 | python | s557465674 | s627691413 | 167 | 122 | 5,744 | 25,972 | Accepted | Accepted | 26.95 | from sys import stdin
input = stdin.readline
N, K = [int(x) for x in input().split()]
arr = [0] * (10**5+1)
for _ in range(N):
a, b = [int(x) for x in input().split()]
arr[a] += b
remain = K
for i in range(1, 10**5+1):
if arr[i] != 0:
remain -= arr[i]
if remain <= 0:
prin... | import sys
from collections import defaultdict
n, k, *ab = list(map(int, sys.stdin.read().split()))
ab = list(zip(*[iter(ab)] * 2))
def main():
cnt = defaultdict(int)
for a, b in ab:
cnt[a] += b
s = 0
for v, c in sorted(cnt.items()):
s += c
if s >= k:
... | 16 | 20 | 340 | 386 | from sys import stdin
input = stdin.readline
N, K = [int(x) for x in input().split()]
arr = [0] * (10**5 + 1)
for _ in range(N):
a, b = [int(x) for x in input().split()]
arr[a] += b
remain = K
for i in range(1, 10**5 + 1):
if arr[i] != 0:
remain -= arr[i]
if remain <= 0:
print(i)
... | import sys
from collections import defaultdict
n, k, *ab = list(map(int, sys.stdin.read().split()))
ab = list(zip(*[iter(ab)] * 2))
def main():
cnt = defaultdict(int)
for a, b in ab:
cnt[a] += b
s = 0
for v, c in sorted(cnt.items()):
s += c
if s >= k:
return v
if... | false | 20 | [
"-from sys import stdin",
"+import sys",
"+from collections import defaultdict",
"-input = stdin.readline",
"-N, K = [int(x) for x in input().split()]",
"-arr = [0] * (10**5 + 1)",
"-for _ in range(N):",
"- a, b = [int(x) for x in input().split()]",
"- arr[a] += b",
"-remain = K",
"-for i ... | false | 0.04729 | 0.036022 | 1.312799 | [
"s557465674",
"s627691413"
] |
u627803856 | p03212 | python | s092403294 | s086024489 | 348 | 264 | 55,004 | 45,020 | Accepted | Accepted | 24.14 | n = int(eval(input()))
def dfs(s):
if int(s) > n:
return 0
ret = 1 if all(s.count(c) > 0 for c in '753') else 0
for c in '753':
ret += dfs(s + c)
return ret
print((dfs('0'))) | import itertools
n = int(eval(input()))
digits = [3, 5, 7]
def count(digits, n):
A = []
p = 3
while True:
for tup in itertools.product(digits, repeat=p):
a = int(''.join(list(map(str, tup))))
if a > n:
break
A.append(a)
else:
p += 1
continue
break
return A
lst = count... | 11 | 28 | 186 | 424 | n = int(eval(input()))
def dfs(s):
if int(s) > n:
return 0
ret = 1 if all(s.count(c) > 0 for c in "753") else 0
for c in "753":
ret += dfs(s + c)
return ret
print((dfs("0")))
| import itertools
n = int(eval(input()))
digits = [3, 5, 7]
def count(digits, n):
A = []
p = 3
while True:
for tup in itertools.product(digits, repeat=p):
a = int("".join(list(map(str, tup))))
if a > n:
break
A.append(a)
else:
... | false | 60.714286 | [
"+import itertools",
"+",
"+digits = [3, 5, 7]",
"-def dfs(s):",
"- if int(s) > n:",
"- return 0",
"- ret = 1 if all(s.count(c) > 0 for c in \"753\") else 0",
"- for c in \"753\":",
"- ret += dfs(s + c)",
"- return ret",
"+def count(digits, n):",
"+ A = []",
"+ ... | false | 0.068304 | 0.06449 | 1.059143 | [
"s092403294",
"s086024489"
] |
u497952650 | p02824 | python | s288440523 | s781197996 | 324 | 286 | 14,480 | 14,964 | Accepted | Accepted | 11.73 | def check(n):
if n <= P-1:
return True
if A[n]+M < A[P-1]:
return False
votes = (P+N-1-n)*M + sum([A[n]+M-A[i] for i in range(P-1,n)])
if votes < M*V:
return False
else:
return True
N,M,V,P = list(map(int,input().split()))
A = list(map(int,i... | def check(n):
if n <= P-1:
return True
if A[n]+M < A[P-1]:
return False
votes = (P+N-1-n)*M + sum([A[n]+M-A[i] for i in range(P-1,n)])
if votes < M*V:
return False
else:
return True
N,M,V,P = list(map(int,input().split()))
A = list(map(int,inp... | 41 | 34 | 588 | 532 | def check(n):
if n <= P - 1:
return True
if A[n] + M < A[P - 1]:
return False
votes = (P + N - 1 - n) * M + sum([A[n] + M - A[i] for i in range(P - 1, n)])
if votes < M * V:
return False
else:
return True
N, M, V, P = list(map(int, input().split()))
A = list(map(int... | def check(n):
if n <= P - 1:
return True
if A[n] + M < A[P - 1]:
return False
votes = (P + N - 1 - n) * M + sum([A[n] + M - A[i] for i in range(P - 1, n)])
if votes < M * V:
return False
else:
return True
N, M, V, P = list(map(int, input().split()))
A = list(map(int... | false | 17.073171 | [
"+##開区間",
"-left = -1",
"-##",
"-\"\"\"",
"-if check(right):",
"- print(N)",
"- exit()",
"-\"\"\"",
"+left = 0"
] | false | 0.037318 | 0.040404 | 0.923626 | [
"s288440523",
"s781197996"
] |
u617515020 | p02861 | python | s459272196 | s942353581 | 441 | 303 | 9,992 | 9,224 | Accepted | Accepted | 31.29 | import itertools
from math import *
n=int(eval(input()))
ps=[list(map(int,input().split())) for _ in range(n)]
perms = list(itertools.permutations(ps, n))
dists = []
for i in range(len(perms)):
dist = 0
cur = perms[i][0]
for j in range(1,len(perms[i])):
d = sqrt((perms[i][j][0]-cur[0]) ** 2 + (perms... | from math import sqrt
from itertools import permutations
N=int(eval(input()))
xy=[list(map(int,input().split())) for _ in range(N)]
ans=0
cnt=0
for i in permutations(list(range(N))):
d=0
for j in range(N-1):
dx=xy[i[j+1]][0]-xy[i[j]][0]
dy=xy[i[j+1]][1]-xy[i[j]][1]
d+=sqrt(dx**2+dy**2)
ans... | 16 | 15 | 427 | 337 | import itertools
from math import *
n = int(eval(input()))
ps = [list(map(int, input().split())) for _ in range(n)]
perms = list(itertools.permutations(ps, n))
dists = []
for i in range(len(perms)):
dist = 0
cur = perms[i][0]
for j in range(1, len(perms[i])):
d = sqrt((perms[i][j][0] - cur[0]) ** 2... | from math import sqrt
from itertools import permutations
N = int(eval(input()))
xy = [list(map(int, input().split())) for _ in range(N)]
ans = 0
cnt = 0
for i in permutations(list(range(N))):
d = 0
for j in range(N - 1):
dx = xy[i[j + 1]][0] - xy[i[j]][0]
dy = xy[i[j + 1]][1] - xy[i[j]][1]
... | false | 6.25 | [
"-import itertools",
"-from math import *",
"+from math import sqrt",
"+from itertools import permutations",
"-n = int(eval(input()))",
"-ps = [list(map(int, input().split())) for _ in range(n)]",
"-perms = list(itertools.permutations(ps, n))",
"-dists = []",
"-for i in range(len(perms)):",
"- ... | false | 0.038838 | 0.055389 | 0.701192 | [
"s459272196",
"s942353581"
] |
u392319141 | p03274 | python | s286402553 | s769336639 | 97 | 81 | 14,384 | 14,384 | Accepted | Accepted | 16.49 | N, K = list(map(int, input().split()))
X = list(map(int, input().split()))
ans = 10**18
for l in range(N - K + 1):
D = X[l + K - 1] - X[l]
if X[l] <= 0 <= X[l + K - 1]:
D += min(-X[l], X[l + K - 1])
elif X[l + K - 1] <= 0:
D += -X[l + K - 1]
elif X[l] >= 0:
D += X[l]
... | N, K = list(map(int, input().split()))
X = list(map(int, input().split()))
ans = 10**18
for l, r in zip(X, X[K - 1:]):
if r <= 0:
ans = min(ans, abs(l))
if l >= 0:
ans = min(ans, abs(r))
if l < 0 < r:
ans = min(ans, r - l + min(abs(r), abs(l)))
print(ans)
| 14 | 12 | 349 | 298 | N, K = list(map(int, input().split()))
X = list(map(int, input().split()))
ans = 10**18
for l in range(N - K + 1):
D = X[l + K - 1] - X[l]
if X[l] <= 0 <= X[l + K - 1]:
D += min(-X[l], X[l + K - 1])
elif X[l + K - 1] <= 0:
D += -X[l + K - 1]
elif X[l] >= 0:
D += X[l]
ans = mi... | N, K = list(map(int, input().split()))
X = list(map(int, input().split()))
ans = 10**18
for l, r in zip(X, X[K - 1 :]):
if r <= 0:
ans = min(ans, abs(l))
if l >= 0:
ans = min(ans, abs(r))
if l < 0 < r:
ans = min(ans, r - l + min(abs(r), abs(l)))
print(ans)
| false | 14.285714 | [
"-for l in range(N - K + 1):",
"- D = X[l + K - 1] - X[l]",
"- if X[l] <= 0 <= X[l + K - 1]:",
"- D += min(-X[l], X[l + K - 1])",
"- elif X[l + K - 1] <= 0:",
"- D += -X[l + K - 1]",
"- elif X[l] >= 0:",
"- D += X[l]",
"- ans = min(ans, D)",
"+for l, r in zip(X,... | false | 0.044193 | 0.046225 | 0.956045 | [
"s286402553",
"s769336639"
] |
u543000780 | p02571 | python | s320982083 | s392946572 | 70 | 63 | 9,060 | 8,896 | Accepted | Accepted | 10 | S = eval(input())
T = eval(input())
ans = len(T)
for num1 in range(len(S)-len(T)+1):
temp = len(T)
for num2 in range(len(T)):
if S[num1+num2] == T[num2]:
temp -= 1
if temp < ans:
ans = temp
print(ans) | S = eval(input())
T = eval(input())
min_change = 10**9
for posi_1 in range(len(S)-len(T)+1):
tmp = 0
for posi_2 in range(len(T)):
if S[posi_1+posi_2] != T[posi_2]:
tmp += 1
min_change = min(tmp, min_change)
print(min_change) | 11 | 10 | 218 | 237 | S = eval(input())
T = eval(input())
ans = len(T)
for num1 in range(len(S) - len(T) + 1):
temp = len(T)
for num2 in range(len(T)):
if S[num1 + num2] == T[num2]:
temp -= 1
if temp < ans:
ans = temp
print(ans)
| S = eval(input())
T = eval(input())
min_change = 10**9
for posi_1 in range(len(S) - len(T) + 1):
tmp = 0
for posi_2 in range(len(T)):
if S[posi_1 + posi_2] != T[posi_2]:
tmp += 1
min_change = min(tmp, min_change)
print(min_change)
| false | 9.090909 | [
"-ans = len(T)",
"-for num1 in range(len(S) - len(T) + 1):",
"- temp = len(T)",
"- for num2 in range(len(T)):",
"- if S[num1 + num2] == T[num2]:",
"- temp -= 1",
"- if temp < ans:",
"- ans = temp",
"-print(ans)",
"+min_change = 10**9",
"+for posi_1 in range(len(... | false | 0.046775 | 0.048212 | 0.97019 | [
"s320982083",
"s392946572"
] |
u133936772 | p02837 | python | s837965544 | s466428651 | 161 | 98 | 3,064 | 3,064 | Accepted | Accepted | 39.13 | import sys
input=sys.stdin.readline
n=int(eval(input()))
ll=[]
for i in range(n):
a=int(eval(input()))
for _ in range(a):
x,y=list(map(int,input().split()))
ll+=[(i,x-1,y)]
c=0
for p in range(2**n):
b=1
for i,x,y in ll:
if p>>i&1 and p>>x&1!=y:
b=0
break
if b: c=max(c,s... | import sys,itertools as it
input=sys.stdin.readline
n=int(eval(input()))
ll=[]
for i in range(n):
a=int(eval(input()))
for _ in range(a):
x,y=list(map(int,input().split()))
ll+=[(i,x-1,y)]
c=0
for p in it.product([0,1],repeat=n):
b=1
for i,x,y in ll:
if p[i] and p[x]!=y:
b=0
... | 18 | 18 | 341 | 345 | import sys
input = sys.stdin.readline
n = int(eval(input()))
ll = []
for i in range(n):
a = int(eval(input()))
for _ in range(a):
x, y = list(map(int, input().split()))
ll += [(i, x - 1, y)]
c = 0
for p in range(2**n):
b = 1
for i, x, y in ll:
if p >> i & 1 and p >> x & 1 != y:
... | import sys, itertools as it
input = sys.stdin.readline
n = int(eval(input()))
ll = []
for i in range(n):
a = int(eval(input()))
for _ in range(a):
x, y = list(map(int, input().split()))
ll += [(i, x - 1, y)]
c = 0
for p in it.product([0, 1], repeat=n):
b = 1
for i, x, y in ll:
i... | false | 0 | [
"-import sys",
"+import sys, itertools as it",
"-for p in range(2**n):",
"+for p in it.product([0, 1], repeat=n):",
"- if p >> i & 1 and p >> x & 1 != y:",
"+ if p[i] and p[x] != y:",
"- c = max(c, sum(p >> i & 1 for i in range(n)))",
"+ c = max(c, sum(p))"
] | false | 0.15048 | 0.081202 | 1.853161 | [
"s837965544",
"s466428651"
] |
u706414019 | p03212 | python | s299621899 | s099203928 | 226 | 52 | 71,480 | 13,704 | Accepted | Accepted | 76.99 | import itertools
import bisect
lis = list(itertools.product('7530',repeat = 9))
int_lis = list(map(int,list(map(''.join,lis))))
str_lis = list(map(str,int_lis[:-16]))
lis = []
for s in str_lis:
if ('7' in s) and ('5' in s) and ('3' in s) and ('0' not in s) :
lis.append(int(s))
print((bisect.bisec... | import itertools,bisect
num_list = []
def toInt(arr):
num = int(''.join(arr))
for i in range(3,10):
num_list += list(itertools.product('753',repeat=i) )
num = []
for nm in num_list:
if '3' in nm and '5' in nm and '7' in nm:
num.append(int(''.join(nm)))
num.sort()
print((bisect.bisect_... | 11 | 14 | 348 | 344 | import itertools
import bisect
lis = list(itertools.product("7530", repeat=9))
int_lis = list(map(int, list(map("".join, lis))))
str_lis = list(map(str, int_lis[:-16]))
lis = []
for s in str_lis:
if ("7" in s) and ("5" in s) and ("3" in s) and ("0" not in s):
lis.append(int(s))
print((bisect.bisect_right(s... | import itertools, bisect
num_list = []
def toInt(arr):
num = int("".join(arr))
for i in range(3, 10):
num_list += list(itertools.product("753", repeat=i))
num = []
for nm in num_list:
if "3" in nm and "5" in nm and "7" in nm:
num.append(int("".join(nm)))
num.sort()
print((bisect.bisect_right(nu... | false | 21.428571 | [
"-import itertools",
"-import bisect",
"+import itertools, bisect",
"-lis = list(itertools.product(\"7530\", repeat=9))",
"-int_lis = list(map(int, list(map(\"\".join, lis))))",
"-str_lis = list(map(str, int_lis[:-16]))",
"-lis = []",
"-for s in str_lis:",
"- if (\"7\" in s) and (\"5\" in s) and ... | false | 0.500623 | 0.143907 | 3.478799 | [
"s299621899",
"s099203928"
] |
u761320129 | p03592 | python | s242720781 | s651607907 | 321 | 277 | 3,060 | 9,168 | Accepted | Accepted | 13.71 | N,M,K = list(map(int,input().split()))
for a in range(N+1):
for b in range(M+1):
k = a*b + (N-a)*(M-b)
if k==K:
print('Yes')
exit()
print('No') | N,M,K = list(map(int,input().split()))
for i in range(N+1):
for j in range(M+1):
t = i*M + j*N - i*j*2
if t==K:
print('Yes')
exit()
print('No') | 8 | 9 | 188 | 190 | N, M, K = list(map(int, input().split()))
for a in range(N + 1):
for b in range(M + 1):
k = a * b + (N - a) * (M - b)
if k == K:
print("Yes")
exit()
print("No")
| N, M, K = list(map(int, input().split()))
for i in range(N + 1):
for j in range(M + 1):
t = i * M + j * N - i * j * 2
if t == K:
print("Yes")
exit()
print("No")
| false | 11.111111 | [
"-for a in range(N + 1):",
"- for b in range(M + 1):",
"- k = a * b + (N - a) * (M - b)",
"- if k == K:",
"+for i in range(N + 1):",
"+ for j in range(M + 1):",
"+ t = i * M + j * N - i * j * 2",
"+ if t == K:"
] | false | 0.046273 | 0.046341 | 0.998529 | [
"s242720781",
"s651607907"
] |
u078276601 | p02641 | python | s887052133 | s261681863 | 32 | 27 | 8,912 | 9,120 | Accepted | Accepted | 15.62 | x, n = list(map(int, input().split()))
a = list(map(int, input().split()))
for i in range(105):
if (x-i) not in a:
print((x-i))
break
if (x+i) not in a:
print((x+i))
break | x, n = list(map(int, input().split()))
a = list(map(int, input().split()))
for i in range(105):
if (x-i) not in a:
print((x-i))
exit()
if (x+i) not in a:
print((x+i))
exit() | 9 | 9 | 209 | 211 | x, n = list(map(int, input().split()))
a = list(map(int, input().split()))
for i in range(105):
if (x - i) not in a:
print((x - i))
break
if (x + i) not in a:
print((x + i))
break
| x, n = list(map(int, input().split()))
a = list(map(int, input().split()))
for i in range(105):
if (x - i) not in a:
print((x - i))
exit()
if (x + i) not in a:
print((x + i))
exit()
| false | 0 | [
"- break",
"+ exit()",
"- break",
"+ exit()"
] | false | 0.035898 | 0.036947 | 0.971609 | [
"s887052133",
"s261681863"
] |
u572373398 | p03281 | python | s981848623 | s012079875 | 20 | 18 | 2,940 | 2,940 | Accepted | Accepted | 10 | n = int(eval(input()))
ans = 0
for i in range(1, n + 1, 2):
div_count = 0
for j in range(1, i + 1):
if i % j == 0:
div_count += 1
if div_count == 8:
ans += 1
print(ans) | N = int(eval(input()))
ans = 0
for i in range(1, N + 1, 2):
mod_count = 0
for j in range(1, i + 1):
if i % j == 0:
mod_count += 1
if mod_count == 8:
ans += 1
print(ans)
| 12 | 11 | 195 | 214 | n = int(eval(input()))
ans = 0
for i in range(1, n + 1, 2):
div_count = 0
for j in range(1, i + 1):
if i % j == 0:
div_count += 1
if div_count == 8:
ans += 1
print(ans)
| N = int(eval(input()))
ans = 0
for i in range(1, N + 1, 2):
mod_count = 0
for j in range(1, i + 1):
if i % j == 0:
mod_count += 1
if mod_count == 8:
ans += 1
print(ans)
| false | 8.333333 | [
"-n = int(eval(input()))",
"+N = int(eval(input()))",
"-for i in range(1, n + 1, 2):",
"- div_count = 0",
"+for i in range(1, N + 1, 2):",
"+ mod_count = 0",
"- div_count += 1",
"- if div_count == 8:",
"+ mod_count += 1",
"+ if mod_count == 8:"
] | false | 0.04401 | 0.043723 | 1.006576 | [
"s981848623",
"s012079875"
] |
u729133443 | p03759 | python | s521431736 | s971293554 | 168 | 32 | 38,384 | 9,028 | Accepted | Accepted | 80.95 | a,b,c=list(map(int,input().split()));print(('YNEOS'[b-a!=c-b::2])) | a,b,c=list(map(int,input().split()))
print(('YNEOS'[a+c!=b+b::2])) | 1 | 2 | 58 | 59 | a, b, c = list(map(int, input().split()))
print(("YNEOS"[b - a != c - b :: 2]))
| a, b, c = list(map(int, input().split()))
print(("YNEOS"[a + c != b + b :: 2]))
| false | 50 | [
"-print((\"YNEOS\"[b - a != c - b :: 2]))",
"+print((\"YNEOS\"[a + c != b + b :: 2]))"
] | false | 0.039546 | 0.034018 | 1.162502 | [
"s521431736",
"s971293554"
] |
u564589929 | p02712 | python | s819920822 | s211130856 | 129 | 116 | 9,208 | 9,228 | Accepted | Accepted | 10.08 | import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline ####
int1 = lambda x: int(x) - 1
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LI1(): retur... | import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline ####
def int1(x): return int(x) - 1
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LI1(): return... | 26 | 32 | 634 | 1,140 | import sys
sys.setrecursionlimit(10**6)
# input = sys.stdin.readline ####
int1 = lambda x: int(x) - 1
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MI1():
return list(map(int1, input().split()))
def LI():
return list(map(int, input().split()))
def... | import sys
sys.setrecursionlimit(10**9)
# input = sys.stdin.readline ####
def int1(x):
return int(x) - 1
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MI1():
return list(map(int1, input().split()))
def LI():
return list(map(int, input().split())... | false | 18.75 | [
"-sys.setrecursionlimit(10**6)",
"+sys.setrecursionlimit(10**9)",
"-int1 = lambda x: int(x) - 1",
"+def int1(x):",
"+ return int(x) - 1",
"-INF = float(\"inf\")",
"+def MS():",
"+ return input().split()",
"+def LS():",
"+ return list(eval(input()))",
"+",
"+",
"+def LLS(rows_number)... | false | 0.153911 | 0.232009 | 0.663382 | [
"s819920822",
"s211130856"
] |
u126232616 | p03599 | python | s205116796 | s771430929 | 768 | 22 | 3,064 | 3,064 | Accepted | Accepted | 97.14 | a,b,c,d,e,f = list(map(int,input().split()))
maxa = f//(100*a)
ans = [0,0,0]
for i in range(maxa+1): # iはAの回数
for j in range((f-100*a*i)//b+1):
v = 100*a*i + 100*b*j
if f < v: continue
for k in range((f-v)//d+1):
for l in range((f-v-k*d)//c+1,-1,-1):
s ... | a,b,c,d,e,f = list(map(int,input().split()))
maxa = f//(100*a)
ans = [0,0,0]
for i in range(maxa+1): # iはAの回数
for j in range((f-100*a*i)//b+1):
v = 100*a*i + 100*b*j
if f < v: break
maxs = min(v*e//100,f-v)
for k in range(maxs//d+1):
l = (maxs-d*k)//c
... | 18 | 18 | 578 | 537 | a, b, c, d, e, f = list(map(int, input().split()))
maxa = f // (100 * a)
ans = [0, 0, 0]
for i in range(maxa + 1): # iはAの回数
for j in range((f - 100 * a * i) // b + 1):
v = 100 * a * i + 100 * b * j
if f < v:
continue
for k in range((f - v) // d + 1):
for l in range((... | a, b, c, d, e, f = list(map(int, input().split()))
maxa = f // (100 * a)
ans = [0, 0, 0]
for i in range(maxa + 1): # iはAの回数
for j in range((f - 100 * a * i) // b + 1):
v = 100 * a * i + 100 * b * j
if f < v:
break
maxs = min(v * e // 100, f - v)
for k in range(maxs // d ... | false | 0 | [
"- continue",
"- for k in range((f - v) // d + 1):",
"- for l in range((f - v - k * d) // c + 1, -1, -1):",
"- s = c * l + d * k",
"- if v + s > f:",
"- continue",
"- if v / 100 * e < s:",
"- ... | false | 0.801536 | 0.037128 | 21.588339 | [
"s205116796",
"s771430929"
] |
u543954314 | p02585 | python | s508782342 | s537799248 | 680 | 282 | 68,896 | 20,456 | Accepted | Accepted | 58.53 | import sys
readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')
def solve():
n, k = nm()
p = nl()
... | import sys
readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')
def solve():
n, k = nm()
p = nl()
... | 54 | 53 | 1,461 | 1,615 | import sys
readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep="\n")
def solve():
n, k = nm()
p = nl()
c = nl()... | import sys
readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep="\n")
def solve():
n, k = nm()
p = nl()
_c = nl(... | false | 1.851852 | [
"- c = nl()",
"- seen = [0] * n",
"- ans = max(c)",
"+ _c = nl()",
"+ c = [0] * n",
"- if seen[i]:",
"- continue",
"- g = list()",
"- v = i",
"- while not seen[v]:",
"- g.append(c[v])",
"- seen[v] = 1",
"- ... | false | 0.090434 | 0.113949 | 0.793637 | [
"s508782342",
"s537799248"
] |
u762540523 | p02645 | python | s935000004 | s799462419 | 24 | 22 | 8,952 | 9,084 | Accepted | Accepted | 8.33 | s=eval(input());print((s[:3])) | print((input()[:3])) | 1 | 1 | 22 | 18 | s = eval(input())
print((s[:3]))
| print((input()[:3]))
| false | 0 | [
"-s = eval(input())",
"-print((s[:3]))",
"+print((input()[:3]))"
] | false | 0.042638 | 0.096428 | 0.44217 | [
"s935000004",
"s799462419"
] |
u236679854 | p00023 | python | s873718617 | s969308401 | 50 | 20 | 7,740 | 7,636 | Accepted | Accepted | 60 | import math
n = int(eval(input()))
for i in range(n):
xa, ya, ra, xb, yb, rb = list(map(float, input().split()))
d = math.sqrt((xb - xa) ** 2 + (yb - ya) ** 2)
if d < ra - rb:
print((2))
elif d < rb - ra:
print((-2))
elif abs(rb - ra) <= d and d <= ra + rb:
print(... | import math
n = int(eval(input()))
for i in range(n):
xa, ya, ra, xb, yb, rb = list(map(float, input().split()))
d = math.sqrt((xb - xa) ** 2 + (yb - ya) ** 2)
if d < ra - rb:
print((2))
elif d < rb - ra:
print((-2))
elif d <= ra + rb:
print((1))
else:
... | 14 | 14 | 335 | 313 | import math
n = int(eval(input()))
for i in range(n):
xa, ya, ra, xb, yb, rb = list(map(float, input().split()))
d = math.sqrt((xb - xa) ** 2 + (yb - ya) ** 2)
if d < ra - rb:
print((2))
elif d < rb - ra:
print((-2))
elif abs(rb - ra) <= d and d <= ra + rb:
print((1))
el... | import math
n = int(eval(input()))
for i in range(n):
xa, ya, ra, xb, yb, rb = list(map(float, input().split()))
d = math.sqrt((xb - xa) ** 2 + (yb - ya) ** 2)
if d < ra - rb:
print((2))
elif d < rb - ra:
print((-2))
elif d <= ra + rb:
print((1))
else:
print((0))... | false | 0 | [
"- elif abs(rb - ra) <= d and d <= ra + rb:",
"+ elif d <= ra + rb:"
] | false | 0.038797 | 0.167503 | 0.231619 | [
"s873718617",
"s969308401"
] |
u366959492 | p03086 | python | s061000981 | s908023521 | 164 | 61 | 38,256 | 61,864 | Accepted | Accepted | 62.8 | s=eval(input())
ans=0
c=0
d={"A","C","G","T"}
for i in range(len(s)):
if not s[i] in d:
ans=max(ans,c)
c=0
else:
c+=1
ans=max(ans,c)
print(ans)
| s=eval(input())
ans=0
c=0
for i in range(len(s)):
if s[i] in ["A","C","G","T"]:
c+=1
else:
c=0
ans=max(ans,c)
print(ans) | 13 | 10 | 183 | 151 | s = eval(input())
ans = 0
c = 0
d = {"A", "C", "G", "T"}
for i in range(len(s)):
if not s[i] in d:
ans = max(ans, c)
c = 0
else:
c += 1
ans = max(ans, c)
print(ans)
| s = eval(input())
ans = 0
c = 0
for i in range(len(s)):
if s[i] in ["A", "C", "G", "T"]:
c += 1
else:
c = 0
ans = max(ans, c)
print(ans)
| false | 23.076923 | [
"-d = {\"A\", \"C\", \"G\", \"T\"}",
"- if not s[i] in d:",
"- ans = max(ans, c)",
"+ if s[i] in [\"A\", \"C\", \"G\", \"T\"]:",
"+ c += 1",
"+ else:",
"- else:",
"- c += 1",
"-ans = max(ans, c)",
"+ ans = max(ans, c)"
] | false | 0.04662 | 0.116421 | 0.400446 | [
"s061000981",
"s908023521"
] |
u279493135 | p02596 | python | s271628189 | s767593591 | 416 | 361 | 76,752 | 17,484 | Accepted | Accepted | 13.22 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
... | 37 | 37 | 1,052 | 1,033 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import (
accumulate,
permutations,
combinations,
product,
groupby,
combinations_with_replacement,
)
from operator import itemgetter, mul
fro... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import (
accumulate,
permutations,
combinations,
product,
groupby,
combinations_with_replacement,
)
from operator import itemgetter, mul
fro... | false | 0 | [
"-checked = [0] * (10**6 + 1)",
"+checked = [0] * K",
"- mo = mo + 7 * pow(10, p, K)",
"+ mo = 10 * mo + 7"
] | false | 0.438417 | 0.101698 | 4.310979 | [
"s271628189",
"s767593591"
] |
u930705402 | p02718 | python | s188134405 | s986673978 | 170 | 68 | 38,704 | 64,884 | Accepted | Accepted | 60 | N,M=list(map(int,input().split()))
A=sorted(map(int,input().split()),reverse=True)
s=sum(A)
if(4*M*A[M-1]>=s):
print('Yes')
else:
print('No') | from collections import Counter
N,M=list(map(int,input().split()))
A=sorted(map(int,input().split()),reverse=True)
s=sum(A)/(4*M)
for i in range(M):
if A[i]<s:
print('No')
exit()
print('Yes') | 7 | 9 | 149 | 213 | N, M = list(map(int, input().split()))
A = sorted(map(int, input().split()), reverse=True)
s = sum(A)
if 4 * M * A[M - 1] >= s:
print("Yes")
else:
print("No")
| from collections import Counter
N, M = list(map(int, input().split()))
A = sorted(map(int, input().split()), reverse=True)
s = sum(A) / (4 * M)
for i in range(M):
if A[i] < s:
print("No")
exit()
print("Yes")
| false | 22.222222 | [
"+from collections import Counter",
"+",
"-s = sum(A)",
"-if 4 * M * A[M - 1] >= s:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+s = sum(A) / (4 * M)",
"+for i in range(M):",
"+ if A[i] < s:",
"+ print(\"No\")",
"+ exit()",
"+print(\"Yes\")"
] | false | 0.038294 | 0.036286 | 1.055338 | [
"s188134405",
"s986673978"
] |
u620084012 | p03325 | python | s611254031 | s080562239 | 189 | 90 | 40,560 | 4,148 | Accepted | Accepted | 52.38 | N = int(eval(input()))
A = list(map(int,input().split()))
ans = 0
for a in A:
while a > 0 and a%2 == 0:
a //= 2
ans += 1
print(ans)
| N = int(eval(input()))
a = list(map(int,input().split()))
ans = 0
for e in a:
while e%2 == 0:
ans += 1
e //= 2
print(ans)
| 8 | 9 | 153 | 145 | N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
for a in A:
while a > 0 and a % 2 == 0:
a //= 2
ans += 1
print(ans)
| N = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for e in a:
while e % 2 == 0:
ans += 1
e //= 2
print(ans)
| false | 11.111111 | [
"-A = list(map(int, input().split()))",
"+a = list(map(int, input().split()))",
"-for a in A:",
"- while a > 0 and a % 2 == 0:",
"- a //= 2",
"+for e in a:",
"+ while e % 2 == 0:",
"+ e //= 2"
] | false | 0.038115 | 0.039127 | 0.974138 | [
"s611254031",
"s080562239"
] |
u852690916 | p03312 | python | s940602046 | s350275576 | 935 | 630 | 110,488 | 91,160 | Accepted | Accepted | 32.62 | import sys
from itertools import accumulate
from bisect import bisect
def main():
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
ac = [0] + list(accumulate(A))
def calc(lst): return abs(max(lst) - min(lst))
def sm(l,r): return ac[r+1] - ac[l]
... | import sys
from itertools import accumulate
from bisect import bisect
def main():
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
ac = [0] + list(accumulate(A))
def calc(lst): return abs(max(lst) - min(lst))
def sm(l,r): return ac[r+1] - ac[l]
... | 29 | 30 | 848 | 967 | import sys
from itertools import accumulate
from bisect import bisect
def main():
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
ac = [0] + list(accumulate(A))
def calc(lst):
return abs(max(lst) - min(lst))
def sm(l, r):
return ac[r + 1]... | import sys
from itertools import accumulate
from bisect import bisect
def main():
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
ac = [0] + list(accumulate(A))
def calc(lst):
return abs(max(lst) - min(lst))
def sm(l, r):
return ac[r + 1]... | false | 3.333333 | [
"- def get_min_max(l, r):",
"- if r - l <= 1:",
"- return [A[l], A[r]]",
"- med = ac[l] + sm(l, r) / 2",
"- i = bisect(ac, med, l + 1, r + 1)",
"- r1 = [sm(l, i - 1), sm(i, r)]",
"- if i - 1 == l:",
"- return r1",
"- r2 = [sm(l, i - ... | false | 0.037699 | 0.051245 | 0.735656 | [
"s940602046",
"s350275576"
] |
u963903527 | p04047 | python | s023611746 | s230778464 | 157 | 17 | 12,500 | 2,940 | Accepted | Accepted | 89.17 | N = int(eval(input()))
l = [int(x) for x in input().split(" ")]
import numpy as np
ans=0
while len(l) !=0:
x=0
y=0
x+=max(l)
l.pop(np.argmax(l))
y+=max(l)
l.pop(np.argmax(l))
ans+=min(x,y)
print(ans) | N = int(eval(input()))
L = [int(i) for i in input().split()]
L.sort()
ans = 0
while len(L) != 0:
ans += min(L.pop(0), L.pop(0))
print(ans) | 14 | 7 | 235 | 142 | N = int(eval(input()))
l = [int(x) for x in input().split(" ")]
import numpy as np
ans = 0
while len(l) != 0:
x = 0
y = 0
x += max(l)
l.pop(np.argmax(l))
y += max(l)
l.pop(np.argmax(l))
ans += min(x, y)
print(ans)
| N = int(eval(input()))
L = [int(i) for i in input().split()]
L.sort()
ans = 0
while len(L) != 0:
ans += min(L.pop(0), L.pop(0))
print(ans)
| false | 50 | [
"-l = [int(x) for x in input().split(\" \")]",
"-import numpy as np",
"-",
"+L = [int(i) for i in input().split()]",
"+L.sort()",
"-while len(l) != 0:",
"- x = 0",
"- y = 0",
"- x += max(l)",
"- l.pop(np.argmax(l))",
"- y += max(l)",
"- l.pop(np.argmax(l))",
"- ans += mi... | false | 0.328794 | 0.042222 | 7.787195 | [
"s023611746",
"s230778464"
] |
u347640436 | p02990 | python | s975707615 | s880141634 | 718 | 648 | 98,156 | 98,160 | Accepted | Accepted | 9.75 | # パスカルの三角形
N, K = list(map(int, input().split()))
c = [[0] * 2001 for _ in range(2000 + 1)]
c[0][0] = 1
for i in range(1, 2000 + 1):
ci = c[i]
ci1 = c[i - 1]
ci[0] = 1
for j in range(1, i + 1):
ci[j] = (ci1[j - 1] + ci1[j]) % 1000000007
result = []
for i in range(1, K + 1):
r... | # パスカルの三角形
N, K = list(map(int, input().split()))
n = max(K, N - K + 1)
c = [[0] * (n + 1) for _ in range(n + 1)]
c[0][0] = 1
for i in range(1, n + 1):
ci = c[i]
ci1 = c[i - 1]
ci[0] = 1
for j in range(1, i + 1):
ci[j] = (ci1[j - 1] + ci1[j]) % 1000000007
result = []
for i in ran... | 16 | 17 | 417 | 437 | # パスカルの三角形
N, K = list(map(int, input().split()))
c = [[0] * 2001 for _ in range(2000 + 1)]
c[0][0] = 1
for i in range(1, 2000 + 1):
ci = c[i]
ci1 = c[i - 1]
ci[0] = 1
for j in range(1, i + 1):
ci[j] = (ci1[j - 1] + ci1[j]) % 1000000007
result = []
for i in range(1, K + 1):
result.append(c[K... | # パスカルの三角形
N, K = list(map(int, input().split()))
n = max(K, N - K + 1)
c = [[0] * (n + 1) for _ in range(n + 1)]
c[0][0] = 1
for i in range(1, n + 1):
ci = c[i]
ci1 = c[i - 1]
ci[0] = 1
for j in range(1, i + 1):
ci[j] = (ci1[j - 1] + ci1[j]) % 1000000007
result = []
for i in range(1, K + 1):
... | false | 5.882353 | [
"-c = [[0] * 2001 for _ in range(2000 + 1)]",
"+n = max(K, N - K + 1)",
"+c = [[0] * (n + 1) for _ in range(n + 1)]",
"-for i in range(1, 2000 + 1):",
"+for i in range(1, n + 1):"
] | false | 0.915388 | 0.219079 | 4.178346 | [
"s975707615",
"s880141634"
] |
u241190159 | p03229 | python | s569314700 | s886575948 | 240 | 111 | 23,112 | 14,452 | Accepted | Accepted | 53.75 | import numpy as np
def main():
N, *A = list(map(int, open(0).read().split()))
A.sort()
A = np.array(A)
if N % 2:
array1 = np.array([-2] * (N // 2) + [1] * 2 + [2] * (N // 2 - 1))
array2 = np.array([-2] * (N // 2 - 1) + [-1] * 2 + [2] * (N // 2))
ret1 = np.dot(A, array1)
ret2 =... | def main():
N, *A = list(map(int, open(0).read().split()))
A.sort()
if N % 2:
array1 = [-2] * (N // 2) + [1] * 2 + [2] * (N // 2 - 1)
array2 = [-2] * (N // 2 - 1) + [-1] * 2 + [2] * (N // 2)
ret1 = 0
ret2 = 0
for i in range(N):
ret1 += A[i]*array1[i]
ret2 += A[i]*a... | 25 | 27 | 539 | 559 | import numpy as np
def main():
N, *A = list(map(int, open(0).read().split()))
A.sort()
A = np.array(A)
if N % 2:
array1 = np.array([-2] * (N // 2) + [1] * 2 + [2] * (N // 2 - 1))
array2 = np.array([-2] * (N // 2 - 1) + [-1] * 2 + [2] * (N // 2))
ret1 = np.dot(A, array1)
... | def main():
N, *A = list(map(int, open(0).read().split()))
A.sort()
if N % 2:
array1 = [-2] * (N // 2) + [1] * 2 + [2] * (N // 2 - 1)
array2 = [-2] * (N // 2 - 1) + [-1] * 2 + [2] * (N // 2)
ret1 = 0
ret2 = 0
for i in range(N):
ret1 += A[i] * array1[i]
... | false | 7.407407 | [
"-import numpy as np",
"-",
"-",
"- A = np.array(A)",
"- array1 = np.array([-2] * (N // 2) + [1] * 2 + [2] * (N // 2 - 1))",
"- array2 = np.array([-2] * (N // 2 - 1) + [-1] * 2 + [2] * (N // 2))",
"- ret1 = np.dot(A, array1)",
"- ret2 = np.dot(A, array2)",
"+ ar... | false | 0.226636 | 0.072734 | 3.11596 | [
"s569314700",
"s886575948"
] |
u222668979 | p02837 | python | s366219774 | s032826029 | 164 | 100 | 3,064 | 75,064 | Accepted | Accepted | 39.02 | from itertools import product as pro
n = int(eval(input()))
xy = []
for i in range(n):
a_i = int(eval(input()))
xy.append([tuple(map(int, input().split())) for _ in range(a_i)])
ans = 0
for l in pro([0, 1], repeat=n):
for i, t in enumerate(l):
if t == 1:
if not all(l[x-1] =... | from itertools import product
n = int(eval(input()))
xy = []
for _ in range(n):
a = int(eval(input()))
tmp = [list(map(int, input().split())) for _ in range(a)]
xy.append(tmp)
ans = 0
for bit in product([0, 1], repeat=n):
for i, liar in enumerate(bit):
if liar and any(bit[x - 1] !=... | 18 | 17 | 411 | 407 | from itertools import product as pro
n = int(eval(input()))
xy = []
for i in range(n):
a_i = int(eval(input()))
xy.append([tuple(map(int, input().split())) for _ in range(a_i)])
ans = 0
for l in pro([0, 1], repeat=n):
for i, t in enumerate(l):
if t == 1:
if not all(l[x - 1] == y for x, ... | from itertools import product
n = int(eval(input()))
xy = []
for _ in range(n):
a = int(eval(input()))
tmp = [list(map(int, input().split())) for _ in range(a)]
xy.append(tmp)
ans = 0
for bit in product([0, 1], repeat=n):
for i, liar in enumerate(bit):
if liar and any(bit[x - 1] != y for x, y i... | false | 5.555556 | [
"-from itertools import product as pro",
"+from itertools import product",
"-for i in range(n):",
"- a_i = int(eval(input()))",
"- xy.append([tuple(map(int, input().split())) for _ in range(a_i)])",
"+for _ in range(n):",
"+ a = int(eval(input()))",
"+ tmp = [list(map(int, input().split())... | false | 0.008311 | 0.034962 | 0.237704 | [
"s366219774",
"s032826029"
] |
u188827677 | p03147 | python | s552896758 | s469714309 | 71 | 56 | 9,180 | 9,068 | Accepted | Accepted | 21.13 | n = int(eval(input()))
h = list(map(int, input().split()))
ans = 0
while sum(h) != 0:
flag = False
for i in range(n):
if h[i] != 0: flag = True
if flag == True and h[i] == 0: break
elif flag == False and h[i] == 0: continue
h[i] -= 1
ans += 1
print(ans) | n = int(eval(input()))
h = list(map(int, input().split()))
ans = 0
while max(h) != 0:
if h[0] > 0: flag = True
else: flag = False
if flag:
for i in range(n):
if h[i] == 0: break
h[i] -= 1
ans += 1
else:
for i in range(1,n):
if flag == False and h[i] == 0: conti... | 13 | 22 | 282 | 437 | n = int(eval(input()))
h = list(map(int, input().split()))
ans = 0
while sum(h) != 0:
flag = False
for i in range(n):
if h[i] != 0:
flag = True
if flag == True and h[i] == 0:
break
elif flag == False and h[i] == 0:
continue
h[i] -= 1
ans +=... | n = int(eval(input()))
h = list(map(int, input().split()))
ans = 0
while max(h) != 0:
if h[0] > 0:
flag = True
else:
flag = False
if flag:
for i in range(n):
if h[i] == 0:
break
h[i] -= 1
ans += 1
else:
for i in range(1, n):... | false | 40.909091 | [
"-while sum(h) != 0:",
"- flag = False",
"- for i in range(n):",
"- if h[i] != 0:",
"+while max(h) != 0:",
"+ if h[0] > 0:",
"+ flag = True",
"+ else:",
"+ flag = False",
"+ if flag:",
"+ for i in range(n):",
"+ if h[i] == 0:",
"+ ... | false | 0.039504 | 0.042145 | 0.937339 | [
"s552896758",
"s469714309"
] |
u671060652 | p03137 | python | s408354859 | s037521164 | 329 | 104 | 82,340 | 90,192 | Accepted | Accepted | 68.39 | import itertools
import math
import fractions
import functools
import copy
n, m = list(map(int, input().split()))
x = list(map(int, input().split()))
sub = []
x.sort()
for i in range(m-1):
sub.append(abs(x[i]-x[i+1]))
sub.sort(reverse=True)
if n >= m:
print((0))
quit()
for i in range(n-1... | def main():
# n = int(input())
n, m = list(map(int, input().split()))
x = list(map(int, input().split()))
# s = input()
# h = [int(input()) for _ in range(n)]
x.sort()
subs = []
for i in range(1, m):
subs.append(abs(x[i]-x[i-1]))
subs.sort()
if (m < n):... | 20 | 23 | 347 | 421 | import itertools
import math
import fractions
import functools
import copy
n, m = list(map(int, input().split()))
x = list(map(int, input().split()))
sub = []
x.sort()
for i in range(m - 1):
sub.append(abs(x[i] - x[i + 1]))
sub.sort(reverse=True)
if n >= m:
print((0))
quit()
for i in range(n - 1):
sub[... | def main():
# n = int(input())
n, m = list(map(int, input().split()))
x = list(map(int, input().split()))
# s = input()
# h = [int(input()) for _ in range(n)]
x.sort()
subs = []
for i in range(1, m):
subs.append(abs(x[i] - x[i - 1]))
subs.sort()
if m < n:
print((0... | false | 13.043478 | [
"-import itertools",
"-import math",
"-import fractions",
"-import functools",
"-import copy",
"+def main():",
"+ # n = int(input())",
"+ n, m = list(map(int, input().split()))",
"+ x = list(map(int, input().split()))",
"+ # s = input()",
"+ # h = [int(input()) for _ in range(n)]"... | false | 0.040808 | 0.040604 | 1.005029 | [
"s408354859",
"s037521164"
] |
u357218223 | p03136 | python | s022368938 | s994353992 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | # coding: utf-8
N = int(eval(input()))
Ls = sorted(list(map(int,input().split())))
print(( "Yes" if Ls.pop() < sum(Ls) else "No")) | # coding: utf-8
N = int(eval(input()))
Ls = sorted(list(map(int,input().split())))
print(("Yes" if max(Ls) < sum(Ls) - max(Ls) else "No")) | 4 | 4 | 126 | 133 | # coding: utf-8
N = int(eval(input()))
Ls = sorted(list(map(int, input().split())))
print(("Yes" if Ls.pop() < sum(Ls) else "No"))
| # coding: utf-8
N = int(eval(input()))
Ls = sorted(list(map(int, input().split())))
print(("Yes" if max(Ls) < sum(Ls) - max(Ls) else "No"))
| false | 0 | [
"-print((\"Yes\" if Ls.pop() < sum(Ls) else \"No\"))",
"+print((\"Yes\" if max(Ls) < sum(Ls) - max(Ls) else \"No\"))"
] | false | 0.04418 | 0.04346 | 1.016556 | [
"s022368938",
"s994353992"
] |
u984276646 | p02708 | python | s450022605 | s105906264 | 74 | 20 | 9,168 | 9,176 | Accepted | Accepted | 72.97 | N, K = list(map(int, input().split()))
mod = int(1e9) + 7
S = 0
for i in range(K, N+2):
S += (N - i + 1) * i + 1
S %= mod
print(S) | N, K = list(map(int, input().split()))
mod = int(1e9) + 7
S = (N * (N + 1) * (N + 2) - (3 * N - 2 * K + 4) * K * (K - 1)) // 6 + N - K + 2
print((S % mod)) | 7 | 4 | 138 | 150 | N, K = list(map(int, input().split()))
mod = int(1e9) + 7
S = 0
for i in range(K, N + 2):
S += (N - i + 1) * i + 1
S %= mod
print(S)
| N, K = list(map(int, input().split()))
mod = int(1e9) + 7
S = (N * (N + 1) * (N + 2) - (3 * N - 2 * K + 4) * K * (K - 1)) // 6 + N - K + 2
print((S % mod))
| false | 42.857143 | [
"-S = 0",
"-for i in range(K, N + 2):",
"- S += (N - i + 1) * i + 1",
"- S %= mod",
"-print(S)",
"+S = (N * (N + 1) * (N + 2) - (3 * N - 2 * K + 4) * K * (K - 1)) // 6 + N - K + 2",
"+print((S % mod))"
] | false | 0.007234 | 0.059822 | 0.120932 | [
"s450022605",
"s105906264"
] |
u197300773 | p03196 | python | s856859402 | s324764073 | 289 | 237 | 10,008 | 10,100 | Accepted | Accepted | 17.99 | def Sieve_of_Eratosthenes(N):
if N<2:
prime = [False for i in range(N+1)]
return prime
prime = [True for i in range(N+1)]
prime[0] = False
prime[1] = False
for i in range(2, int(N**0.5)+1):
if prime[i]:
for j in range(i*2, N+1, i):
... | def Sieve_of_Eratosthenes(N):
if N<2:
prime = [False for i in range(N+1)]
return prime
prime = [True for i in range(N+1)]
prime[0] = False
prime[1] = False
for i in range(2, int(N**0.5)+1):
if prime[i]:
for j in range(i*2, N+1, i):
... | 33 | 33 | 708 | 722 | def Sieve_of_Eratosthenes(N):
if N < 2:
prime = [False for i in range(N + 1)]
return prime
prime = [True for i in range(N + 1)]
prime[0] = False
prime[1] = False
for i in range(2, int(N**0.5) + 1):
if prime[i]:
for j in range(i * 2, N + 1, i):
prim... | def Sieve_of_Eratosthenes(N):
if N < 2:
prime = [False for i in range(N + 1)]
return prime
prime = [True for i in range(N + 1)]
prime[0] = False
prime[1] = False
for i in range(2, int(N**0.5) + 1):
if prime[i]:
for j in range(i * 2, N + 1, i):
prim... | false | 0 | [
"+ if prime[i] == False:",
"+ continue",
"- if tmp >= n:",
"- for _ in range(tmp // n):",
"- ans *= i",
"+ for _ in range(tmp // n):",
"+ ans *= i"
] | false | 0.228382 | 0.12943 | 1.764512 | [
"s856859402",
"s324764073"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.