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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u343977188 | p03944 | python | s022075526 | s227469846 | 31 | 24 | 9,168 | 9,204 | Accepted | Accepted | 22.58 | w,h,n=list(map(int,input().split()))
x1=0
x2=w
y1=0
y2=h
for i in range(n):
x,y,a=list(map(int,input().split()))
if a==1 and x > x1:
x1 = x
elif a==2 and x < x2:
x2 = x
elif a==3 and y > y1:
y1 = y
elif a==4 and y < y2:
y2 = y
if x1 > x2 or y1 > y2:
print((0))
else:
print... | w,h,n=list(map(int,input().split()))
x1,x2,y1,y2=0,w,0,h
for i in range(n):
x,y,a=list(map(int,input().split()))
if a==1 and x > x1:
x1 = x
elif a==2 and x < x2:
x2 = x
elif a==3 and y > y1:
y1 = y
elif a==4 and y < y2:
y2 = y
if x1 > x2 or y1 > y2:
print((0))
else:
print(((... | 19 | 16 | 328 | 324 | w, h, n = list(map(int, input().split()))
x1 = 0
x2 = w
y1 = 0
y2 = h
for i in range(n):
x, y, a = list(map(int, input().split()))
if a == 1 and x > x1:
x1 = x
elif a == 2 and x < x2:
x2 = x
elif a == 3 and y > y1:
y1 = y
elif a == 4 and y < y2:
y2 = y
if x1 > x2 or y... | w, h, n = list(map(int, input().split()))
x1, x2, y1, y2 = 0, w, 0, h
for i in range(n):
x, y, a = list(map(int, input().split()))
if a == 1 and x > x1:
x1 = x
elif a == 2 and x < x2:
x2 = x
elif a == 3 and y > y1:
y1 = y
elif a == 4 and y < y2:
y2 = y
if x1 > x2 or y... | false | 15.789474 | [
"-x1 = 0",
"-x2 = w",
"-y1 = 0",
"-y2 = h",
"+x1, x2, y1, y2 = 0, w, 0, h"
] | false | 0.035238 | 0.033253 | 1.059693 | [
"s022075526",
"s227469846"
] |
u908984540 | p02255 | python | s555772911 | s810565012 | 50 | 30 | 8,532 | 8,016 | Accepted | Accepted | 40 | def show_list(num_list):
for i in range(len(num_list)):
print(str(num_list[i]), end="")
if i < len(num_list)-1:
print(" ", end="")
else:
print()
input_num = int(input())
num_list = [int(i) for i in input().split()]
show_list(num_list)
for i in range(1, len... | # -*- coding : utf-8 -*-
def insertion_sort(list):
for i in range(1, len(list)):
key = list[i]
j = i - 1
show_list(list)
while(j >= 0 and list[j] > key):
list[j+1] = list[j]
j = j - 1
list[j+1] = key
show_list(list)
return list
... | 19 | 24 | 508 | 550 | def show_list(num_list):
for i in range(len(num_list)):
print(str(num_list[i]), end="")
if i < len(num_list) - 1:
print(" ", end="")
else:
print()
input_num = int(input())
num_list = [int(i) for i in input().split()]
show_list(num_list)
for i in range(1, len(num_lis... | # -*- coding : utf-8 -*-
def insertion_sort(list):
for i in range(1, len(list)):
key = list[i]
j = i - 1
show_list(list)
while j >= 0 and list[j] > key:
list[j + 1] = list[j]
j = j - 1
list[j + 1] = key
show_list(list)
return list
def show_li... | false | 20.833333 | [
"-def show_list(num_list):",
"- for i in range(len(num_list)):",
"- print(str(num_list[i]), end=\"\")",
"- if i < len(num_list) - 1:",
"- print(\" \", end=\"\")",
"- else:",
"- print()",
"+# -*- coding : utf-8 -*-",
"+def insertion_sort(list):",
"+ ... | false | 0.041769 | 0.035751 | 1.168337 | [
"s555772911",
"s810565012"
] |
u729133443 | p02579 | python | s926973726 | s597123005 | 1,406 | 1,247 | 252,796 | 255,684 | Accepted | Accepted | 11.31 | from collections import*
I=9**9
(h,w),(s,t),(f,g)=eval('map(int,input().split()),'*3)
m,d=list(zip(*eval('(input(),[I]*w),'*h)))
q=deque([(s-1,t-1,1)])
r=list(range(-2,3))
while q:
y,x,c=q.popleft()
if d[y][x]>c:
for a in r:
for b in r:i=a+y;j=b+x;d[y][x]=c;h>i>-1<j<w!=m[i][j]>'#'!=(abs(a)+abs(b)<2!=q... | from collections import*
I=9**9
(h,w),(s,t),(f,g)=eval('map(int,input().split()),'*3)
m,d=list(zip(*eval('(input(),[I]*w),'*h)))
q=deque([(s-1,t-1,1)])
while q:
y,x,c=q.popleft()
if d[y][x]>c:
for a in range(25):a,b=a//5-2,a%5-2;i=a+y;j=b+x;d[y][x]=c;h>i>-1<j<w!=m[i][j]>'#'!=(abs(a)+abs(b)<2!=q.appendleft((... | 12 | 10 | 373 | 366 | from collections import *
I = 9**9
(h, w), (s, t), (f, g) = eval("map(int,input().split())," * 3)
m, d = list(zip(*eval("(input(),[I]*w)," * h)))
q = deque([(s - 1, t - 1, 1)])
r = list(range(-2, 3))
while q:
y, x, c = q.popleft()
if d[y][x] > c:
for a in r:
for b in r:
i = ... | from collections import *
I = 9**9
(h, w), (s, t), (f, g) = eval("map(int,input().split())," * 3)
m, d = list(zip(*eval("(input(),[I]*w)," * h)))
q = deque([(s - 1, t - 1, 1)])
while q:
y, x, c = q.popleft()
if d[y][x] > c:
for a in range(25):
a, b = a // 5 - 2, a % 5 - 2
i = a ... | false | 16.666667 | [
"-r = list(range(-2, 3))",
"- for a in r:",
"- for b in r:",
"- i = a + y",
"- j = b + x",
"- d[y][x] = c",
"- h > i > -1 < j < w != m[i][j] > \"#\" != (",
"- abs(a) + abs(b) < 2 != q.appendleft((i, j, c))... | false | 0.034899 | 0.036885 | 0.946149 | [
"s926973726",
"s597123005"
] |
u620480037 | p03305 | python | s806130892 | s462467600 | 1,575 | 1,349 | 81,596 | 81,452 | Accepted | Accepted | 14.35 | n,m,s,t=list(map(int,input().split()))
en=[[]for i in range(n+1)]
sn=[[]for i in range(n+1)]
for i in range(m):
u,v,a,b=list(map(int,input().split()))
en[v].append((u,a))
en[u].append((v,a))
sn[v].append((u,b))
sn[u].append((v,b))
#print(en)
import numpy as np
INF=10**20
def dijk... | import sys
input=sys.stdin.readline
n,m,s,t=list(map(int,input().split()))
en=[[]for i in range(n+1)]
sn=[[]for i in range(n+1)]
for i in range(m):
u,v,a,b=list(map(int,input().split()))
en[v].append((u,a))
en[u].append((v,a))
sn[v].append((u,b))
sn[u].append((v,b))
#print(en)
impo... | 49 | 51 | 1,019 | 1,057 | n, m, s, t = list(map(int, input().split()))
en = [[] for i in range(n + 1)]
sn = [[] for i in range(n + 1)]
for i in range(m):
u, v, a, b = list(map(int, input().split()))
en[v].append((u, a))
en[u].append((v, a))
sn[v].append((u, b))
sn[u].append((v, b))
# print(en)
import numpy as np
INF = 10**2... | import sys
input = sys.stdin.readline
n, m, s, t = list(map(int, input().split()))
en = [[] for i in range(n + 1)]
sn = [[] for i in range(n + 1)]
for i in range(m):
u, v, a, b = list(map(int, input().split()))
en[v].append((u, a))
en[u].append((v, a))
sn[v].append((u, b))
sn[u].append((v, b))
# pr... | false | 3.921569 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.51632 | 0.22456 | 2.299252 | [
"s806130892",
"s462467600"
] |
u312025627 | p03214 | python | s220957677 | s610733188 | 166 | 69 | 38,384 | 61,984 | Accepted | Accepted | 58.43 | def main():
N = int(eval(input()))
A = [int(i) for i in input().split()]
avg = sum(A)/N
ans = 0
mi = abs(A[0] - avg)
for i, a in enumerate(A[1:], start=1):
if abs(a - avg) < mi:
ans = i
mi = abs(a - avg)
print(ans)
if __name__ == '__main__':
... | def main():
N = int(eval(input()))
A = [int(i) for i in input().split()]
avg = sum(A)/N
mi = abs(A[0] - avg)
idx = 0
for i, a in enumerate(A[1:], start=1):
if abs(a - avg) < mi:
mi = abs(a - avg)
idx = i
print(idx)
if __name__ == '__main__':
... | 15 | 15 | 323 | 323 | def main():
N = int(eval(input()))
A = [int(i) for i in input().split()]
avg = sum(A) / N
ans = 0
mi = abs(A[0] - avg)
for i, a in enumerate(A[1:], start=1):
if abs(a - avg) < mi:
ans = i
mi = abs(a - avg)
print(ans)
if __name__ == "__main__":
main()
| def main():
N = int(eval(input()))
A = [int(i) for i in input().split()]
avg = sum(A) / N
mi = abs(A[0] - avg)
idx = 0
for i, a in enumerate(A[1:], start=1):
if abs(a - avg) < mi:
mi = abs(a - avg)
idx = i
print(idx)
if __name__ == "__main__":
main()
| false | 0 | [
"- ans = 0",
"+ idx = 0",
"- ans = i",
"- print(ans)",
"+ idx = i",
"+ print(idx)"
] | false | 0.200367 | 0.044368 | 4.51606 | [
"s220957677",
"s610733188"
] |
u644516473 | p03379 | python | s643062004 | s695756555 | 235 | 205 | 25,620 | 30,228 | Accepted | Accepted | 12.77 | N = int(input())
X = list(map(int, input().split()))
mid1, mid2 = sorted(X)[N//2-1:N//2+1]
print(*[mid1 if xi>mid1 else mid2 for xi in X], sep="\n")
| N = int(eval(input()))
X = list(map(int, input().split()))
mid1, mid2 = sorted(X)[N//2-1:N//2+1]
print(('\n'.join(str(mid1) if xi>mid1 else str(mid2) for xi in X)))
| 5 | 5 | 154 | 162 | N = int(input())
X = list(map(int, input().split()))
mid1, mid2 = sorted(X)[N // 2 - 1 : N // 2 + 1]
print(*[mid1 if xi > mid1 else mid2 for xi in X], sep="\n")
| N = int(eval(input()))
X = list(map(int, input().split()))
mid1, mid2 = sorted(X)[N // 2 - 1 : N // 2 + 1]
print(("\n".join(str(mid1) if xi > mid1 else str(mid2) for xi in X)))
| false | 0 | [
"-N = int(input())",
"+N = int(eval(input()))",
"-print(*[mid1 if xi > mid1 else mid2 for xi in X], sep=\"\\n\")",
"+print((\"\\n\".join(str(mid1) if xi > mid1 else str(mid2) for xi in X)))"
] | false | 0.045457 | 0.068141 | 0.667096 | [
"s643062004",
"s695756555"
] |
u873482706 | p00254 | python | s924145797 | s967447549 | 480 | 270 | 4,224 | 4,224 | Accepted | Accepted | 43.75 | data = [str(i+1)*4 for i in range(9)]
while True:
n = input()
if n == '0000':
break
elif n in data:
print('NA')
continue
c = 0
while n != '6174':
L = int(''.join(sorted(list(n), key=int, reverse=True)))
S = int(''.join(sorted(list(n), key=int)))
... | data = [str(i+1)*4 for i in range(9)]
while True:
n = input()
if n == '0000':
break
elif n in data:
print('NA')
continue
c = 0
while n != '6174':
L = int(''.join(sorted(n, reverse=True)))
S = int(''.join(sorted(n)))
n = str(L-S).zfill(4)
... | 16 | 16 | 395 | 365 | data = [str(i + 1) * 4 for i in range(9)]
while True:
n = input()
if n == "0000":
break
elif n in data:
print("NA")
continue
c = 0
while n != "6174":
L = int("".join(sorted(list(n), key=int, reverse=True)))
S = int("".join(sorted(list(n), key=int)))
n ... | data = [str(i + 1) * 4 for i in range(9)]
while True:
n = input()
if n == "0000":
break
elif n in data:
print("NA")
continue
c = 0
while n != "6174":
L = int("".join(sorted(n, reverse=True)))
S = int("".join(sorted(n)))
n = str(L - S).zfill(4)
... | false | 0 | [
"- L = int(\"\".join(sorted(list(n), key=int, reverse=True)))",
"- S = int(\"\".join(sorted(list(n), key=int)))",
"+ L = int(\"\".join(sorted(n, reverse=True)))",
"+ S = int(\"\".join(sorted(n)))"
] | false | 0.037533 | 0.065929 | 0.569295 | [
"s924145797",
"s967447549"
] |
u287132915 | p02804 | python | s525528614 | s388002200 | 567 | 359 | 16,408 | 71,208 | Accepted | Accepted | 36.68 | n,k = list(map(int, input().split()))
a = sorted(list(map(int, input().split())))
a_reverse = a[::-1]
mod = 10**9+7
factorial = [1]
inverse = [1]
for i in range(1, n+1):
factorial.append(factorial[-1] * i % mod)
inverse.append(pow(factorial[-1], mod - 2, mod))
def comb(n, r, mod):
if n < r o... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 10**9 + 7
factorial = [1]
inverse = [1]
for i in range(1, n+1):
factorial.append(factorial[-1] * i % mod)
inverse.append(pow(factorial[-1], mod - 2, mod))
def comb(n, r, mod):
if n < r or r < 0: return 0
elif ... | 29 | 28 | 690 | 635 | n, k = list(map(int, input().split()))
a = sorted(list(map(int, input().split())))
a_reverse = a[::-1]
mod = 10**9 + 7
factorial = [1]
inverse = [1]
for i in range(1, n + 1):
factorial.append(factorial[-1] * i % mod)
inverse.append(pow(factorial[-1], mod - 2, mod))
def comb(n, r, mod):
if n < r or r < 0:
... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 10**9 + 7
factorial = [1]
inverse = [1]
for i in range(1, n + 1):
factorial.append(factorial[-1] * i % mod)
inverse.append(pow(factorial[-1], mod - 2, mod))
def comb(n, r, mod):
if n < r or r < 0:
return 0
elif r ... | false | 3.448276 | [
"-a = sorted(list(map(int, input().split())))",
"-a_reverse = a[::-1]",
"+a = list(map(int, input().split()))",
"-plus = 0",
"-minus = 0",
"-cnt = 0",
"-ind = 0",
"-for i in range(n - k + 1):",
"- kaisu = comb(n - i - 1, k - 1, mod)",
"- plus = (plus + (kaisu * a_reverse[ind]) % mod) % mod",... | false | 0.118386 | 0.037933 | 3.120946 | [
"s525528614",
"s388002200"
] |
u104911888 | p00441 | python | s861495348 | s700288175 | 21,720 | 12,130 | 5,256 | 5,788 | Accepted | Accepted | 44.15 | while True:
n = eval(input())
if n == 0: break
P = set(tuple(map(int, input().split())) for i in range(n))
ans = 0
for xi, yi in P:
for xj, yj in P:
q = (xj - yj + yi, yj + xj - xi)
r = (xi - yj + yi, yi + xj - xi)
if q in P and r in P:
... | while True:
n = eval(input())
if n == 0: break
P = [(list(map(int, input().split()))) for i in range(n)]
S = set(map(tuple, P))
ans = 0
for i in range(n - 1):
xi, yi = P[i]
for j in range(i + 1, n):
xj, yj = P[j]
q = (xj - yj + yi, yj + xj - xi)
... | 12 | 15 | 387 | 472 | while True:
n = eval(input())
if n == 0:
break
P = set(tuple(map(int, input().split())) for i in range(n))
ans = 0
for xi, yi in P:
for xj, yj in P:
q = (xj - yj + yi, yj + xj - xi)
r = (xi - yj + yi, yi + xj - xi)
if q in P and r in P:
... | while True:
n = eval(input())
if n == 0:
break
P = [(list(map(int, input().split()))) for i in range(n)]
S = set(map(tuple, P))
ans = 0
for i in range(n - 1):
xi, yi = P[i]
for j in range(i + 1, n):
xj, yj = P[j]
q = (xj - yj + yi, yj + xj - xi)
... | false | 20 | [
"- P = set(tuple(map(int, input().split())) for i in range(n))",
"+ P = [(list(map(int, input().split()))) for i in range(n)]",
"+ S = set(map(tuple, P))",
"- for xi, yi in P:",
"- for xj, yj in P:",
"+ for i in range(n - 1):",
"+ xi, yi = P[i]",
"+ for j in range(i... | false | 0.042764 | 0.037524 | 1.139636 | [
"s861495348",
"s700288175"
] |
u308914480 | p03156 | python | s968676935 | s811161036 | 31 | 25 | 9,048 | 9,044 | Accepted | Accepted | 19.35 | n = int(eval(input()))
a,b = list(map(int,input().split()))
l = list(map(int,input().split()))
c = [0,0,0]
for i in l:
if i <= a:
c[0] += 1
elif i > b:
c[2] += 1
else:
c[1] += 1
print((min(c))) | n=int(eval(input()))
a,b=list(map(int, input().split()))
p=list(map(int, input().split()))
c=[0]*3
for i in p:
if i <=a:
c[0] +=1
elif i>b:
c[2] +=1
else:
c[1]+=1
print((min(c))) | 12 | 12 | 226 | 220 | n = int(eval(input()))
a, b = list(map(int, input().split()))
l = list(map(int, input().split()))
c = [0, 0, 0]
for i in l:
if i <= a:
c[0] += 1
elif i > b:
c[2] += 1
else:
c[1] += 1
print((min(c)))
| n = int(eval(input()))
a, b = list(map(int, input().split()))
p = list(map(int, input().split()))
c = [0] * 3
for i in p:
if i <= a:
c[0] += 1
elif i > b:
c[2] += 1
else:
c[1] += 1
print((min(c)))
| false | 0 | [
"-l = list(map(int, input().split()))",
"-c = [0, 0, 0]",
"-for i in l:",
"+p = list(map(int, input().split()))",
"+c = [0] * 3",
"+for i in p:"
] | false | 0.044932 | 0.039716 | 1.131338 | [
"s968676935",
"s811161036"
] |
u735335967 | p03073 | python | s155719697 | s044983903 | 129 | 51 | 3,956 | 3,956 | Accepted | Accepted | 60.47 | s = eval(input())
s = list("".join(s))
ans = 0
for i in range(1,len(s)):
if int(s[i-1]) == int(s[i]) == 0:
s[i] = 1
ans += 1
elif int(s[i-1]) == int(s[i]) == 1:
s[i] = 0
ans += 1
print(ans)
| s = eval(input())
s = list(s)
ans = 0
for i in range(1,len(s)):
if s[i] == s[i-1]:
ans += 1
if s[i] == "0":
s[i] = "1"
else:
s[i] = "0"
print(ans)
| 11 | 11 | 234 | 203 | s = eval(input())
s = list("".join(s))
ans = 0
for i in range(1, len(s)):
if int(s[i - 1]) == int(s[i]) == 0:
s[i] = 1
ans += 1
elif int(s[i - 1]) == int(s[i]) == 1:
s[i] = 0
ans += 1
print(ans)
| s = eval(input())
s = list(s)
ans = 0
for i in range(1, len(s)):
if s[i] == s[i - 1]:
ans += 1
if s[i] == "0":
s[i] = "1"
else:
s[i] = "0"
print(ans)
| false | 0 | [
"-s = list(\"\".join(s))",
"+s = list(s)",
"- if int(s[i - 1]) == int(s[i]) == 0:",
"- s[i] = 1",
"+ if s[i] == s[i - 1]:",
"- elif int(s[i - 1]) == int(s[i]) == 1:",
"- s[i] = 0",
"- ans += 1",
"+ if s[i] == \"0\":",
"+ s[i] = \"1\"",
"+ el... | false | 0.036287 | 0.035987 | 1.008325 | [
"s155719697",
"s044983903"
] |
u764860452 | p03545 | python | s496817092 | s790413117 | 19 | 17 | 3,060 | 3,060 | Accepted | Accepted | 10.53 | import itertools
S=eval(input())
sum1=0
for i in itertools.product(["+","-"],repeat=3):
ans=""
for j in range(3):
if i[j]=="+":
ans+=S[j]+i[j]
elif i[j]=="-":
ans+=S[j]+"-"
ans+=S[-1]
sum1=eval(ans)
if sum1==7:
print((ans+"="+str(7))... | import itertools
S=eval(input())
for i in itertools.product(["+","-"],repeat=3):
ans=""
for j in range(3):
if i[j]=="+":
ans+=S[j]+i[j]
elif i[j]=="-":
ans+=S[j]+i[j]
ans+=S[-1]
sum1=eval(ans)
if sum1==7:
print((ans+"="+str(7)))
... | 20 | 16 | 345 | 320 | import itertools
S = eval(input())
sum1 = 0
for i in itertools.product(["+", "-"], repeat=3):
ans = ""
for j in range(3):
if i[j] == "+":
ans += S[j] + i[j]
elif i[j] == "-":
ans += S[j] + "-"
ans += S[-1]
sum1 = eval(ans)
if sum1 == 7:
print((ans + "... | import itertools
S = eval(input())
for i in itertools.product(["+", "-"], repeat=3):
ans = ""
for j in range(3):
if i[j] == "+":
ans += S[j] + i[j]
elif i[j] == "-":
ans += S[j] + i[j]
ans += S[-1]
sum1 = eval(ans)
if sum1 == 7:
print((ans + "=" + str... | false | 20 | [
"-sum1 = 0",
"- ans += S[j] + \"-\"",
"+ ans += S[j] + i[j]"
] | false | 0.040265 | 0.039601 | 1.016772 | [
"s496817092",
"s790413117"
] |
u145950990 | p03241 | python | s222975967 | s394680208 | 171 | 21 | 38,640 | 3,060 | Accepted | Accepted | 87.72 | n,m = list(map(int,input().split()))
ans = 1
for i in range(1,int(m**0.5)+1):
if m%i==0:
x = m//i
if x>=n:
ans = max(ans,i)
if i>=n:
ans = max(ans,x)
print(ans)
| n,m = list(map(int,input().split()))
ans = 1
for i in range(1,int(m**0.5)+1):
if m%i!=0:continue
if m//i>=n:
ans = max(i,ans)
if i>=n:
ans = max(m//i,ans)
print(ans) | 11 | 10 | 226 | 197 | n, m = list(map(int, input().split()))
ans = 1
for i in range(1, int(m**0.5) + 1):
if m % i == 0:
x = m // i
if x >= n:
ans = max(ans, i)
if i >= n:
ans = max(ans, x)
print(ans)
| n, m = list(map(int, input().split()))
ans = 1
for i in range(1, int(m**0.5) + 1):
if m % i != 0:
continue
if m // i >= n:
ans = max(i, ans)
if i >= n:
ans = max(m // i, ans)
print(ans)
| false | 9.090909 | [
"- if m % i == 0:",
"- x = m // i",
"- if x >= n:",
"- ans = max(ans, i)",
"- if i >= n:",
"- ans = max(ans, x)",
"+ if m % i != 0:",
"+ continue",
"+ if m // i >= n:",
"+ ans = max(i, ans)",
"+ if i >= n:",
"+ ans = m... | false | 0.092507 | 0.039925 | 2.317014 | [
"s222975967",
"s394680208"
] |
u268314634 | p02988 | python | s172237420 | s310386986 | 27 | 24 | 9,164 | 9,180 | Accepted | Accepted | 11.11 |
n=int(eval(input()))
p=list(map(int, input().split()))
o=0
for i in range(1,n-1):
if p[i-1]>p[i]>p[i+1] or p[i+1]>p[i]>p[i-1]:
o+=1
print(o)
|
n=int(eval(input()))
p=list(map(int, input().split()))
c=0
for i in range(0,n-2):
if p[i]<p[i+1]<p[i+2] or p[i+2]<p[i+1]<p[i]:
c+=1
print(c)
| 14 | 10 | 167 | 169 | n = int(eval(input()))
p = list(map(int, input().split()))
o = 0
for i in range(1, n - 1):
if p[i - 1] > p[i] > p[i + 1] or p[i + 1] > p[i] > p[i - 1]:
o += 1
print(o)
| n = int(eval(input()))
p = list(map(int, input().split()))
c = 0
for i in range(0, n - 2):
if p[i] < p[i + 1] < p[i + 2] or p[i + 2] < p[i + 1] < p[i]:
c += 1
print(c)
| false | 28.571429 | [
"-o = 0",
"-for i in range(1, n - 1):",
"- if p[i - 1] > p[i] > p[i + 1] or p[i + 1] > p[i] > p[i - 1]:",
"- o += 1",
"-print(o)",
"+c = 0",
"+for i in range(0, n - 2):",
"+ if p[i] < p[i + 1] < p[i + 2] or p[i + 2] < p[i + 1] < p[i]:",
"+ c += 1",
"+print(c)"
] | false | 0.164511 | 0.044251 | 3.717703 | [
"s172237420",
"s310386986"
] |
u801049006 | p02598 | python | s410519906 | s666683034 | 1,303 | 989 | 30,672 | 30,856 | Accepted | Accepted | 24.1 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
def check(l):
cnt = 0
for i in range(n):
cnt += a[i] // mid
if a[i] % mid != 0:
cnt += 1
cnt -= 1
return cnt <= k
lb, ub = 0, max(a)
while ub - lb > 1:
mid = (ub + lb) // ... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
def check(l):
cnt = 0
for L in a:
cnt += L // mid
if L % mid != 0:
cnt += 1
cnt -= 1
return cnt <= k
lb, ub = 0, max(a)
while ub - lb > 1:
mid = (ub + lb) // 2
if c... | 25 | 25 | 398 | 385 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
def check(l):
cnt = 0
for i in range(n):
cnt += a[i] // mid
if a[i] % mid != 0:
cnt += 1
cnt -= 1
return cnt <= k
lb, ub = 0, max(a)
while ub - lb > 1:
mid = (ub + lb) // 2
if check(mid... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
def check(l):
cnt = 0
for L in a:
cnt += L // mid
if L % mid != 0:
cnt += 1
cnt -= 1
return cnt <= k
lb, ub = 0, max(a)
while ub - lb > 1:
mid = (ub + lb) // 2
if check(mid):
ub... | false | 0 | [
"- for i in range(n):",
"- cnt += a[i] // mid",
"- if a[i] % mid != 0:",
"+ for L in a:",
"+ cnt += L // mid",
"+ if L % mid != 0:"
] | false | 0.102256 | 0.159488 | 0.641154 | [
"s410519906",
"s666683034"
] |
u823885866 | p03162 | python | s310015186 | s181214589 | 608 | 305 | 56,520 | 43,116 | Accepted | Accepted | 49.84 | import sys
import math
import itertools
import collections
import numpy as np
rl = sys.stdin.readline
n = int(rl())
li = [list(map(int, rl().split())) for _ in range(n)]
dp = [[0]*3 for _ in range(n)]
dp[0] = li[0]
for i in range(1, n):
a = dp[i-1][1] + li[i][0]
b = dp[i-1][2] + li[i][0]
... | import sys
rl = sys.stdin.readline
n = int(rl())
x, y, z = 0, 0, 0
for _ in range(n):
a, b, c = list(map(int, rl().split()))
x, y, z = max(y, z) + a, max(x, z) + b, max(x, y) + c
print((max(x, y, z)))
| 27 | 8 | 547 | 204 | import sys
import math
import itertools
import collections
import numpy as np
rl = sys.stdin.readline
n = int(rl())
li = [list(map(int, rl().split())) for _ in range(n)]
dp = [[0] * 3 for _ in range(n)]
dp[0] = li[0]
for i in range(1, n):
a = dp[i - 1][1] + li[i][0]
b = dp[i - 1][2] + li[i][0]
dp[i][0] = m... | import sys
rl = sys.stdin.readline
n = int(rl())
x, y, z = 0, 0, 0
for _ in range(n):
a, b, c = list(map(int, rl().split()))
x, y, z = max(y, z) + a, max(x, z) + b, max(x, y) + c
print((max(x, y, z)))
| false | 70.37037 | [
"-import math",
"-import itertools",
"-import collections",
"-import numpy as np",
"-li = [list(map(int, rl().split())) for _ in range(n)]",
"-dp = [[0] * 3 for _ in range(n)]",
"-dp[0] = li[0]",
"-for i in range(1, n):",
"- a = dp[i - 1][1] + li[i][0]",
"- b = dp[i - 1][2] + li[i][0]",
"-... | false | 0.064729 | 0.13701 | 0.472437 | [
"s310015186",
"s181214589"
] |
u761320129 | p03600 | python | s004059451 | s466356055 | 943 | 744 | 44,764 | 45,788 | Accepted | Accepted | 21.1 | N = int(eval(input()))
src = [list(map(int,input().split())) for i in range(N)]
ans = 0
for k in range(N):
for i in range(N):
for j in range(N):
if src[i][j] > src[i][k] + src[k][j]:
print((-1))
exit()
src[i][j] = min(src[i][j], src[i][k] + ... | N = int(eval(input()))
src = [list(map(int,input().split())) for i in range(N)]
ans = 0
for k in range(N):
for i in range(N):
for j in range(N):
if src[i][j] > src[i][k] + src[k][j]:
print((-1))
exit()
for i in range(N-1):
for j in range(i+1,N):
... | 23 | 22 | 624 | 561 | N = int(eval(input()))
src = [list(map(int, input().split())) for i in range(N)]
ans = 0
for k in range(N):
for i in range(N):
for j in range(N):
if src[i][j] > src[i][k] + src[k][j]:
print((-1))
exit()
src[i][j] = min(src[i][j], src[i][k] + src[k][j])... | N = int(eval(input()))
src = [list(map(int, input().split())) for i in range(N)]
ans = 0
for k in range(N):
for i in range(N):
for j in range(N):
if src[i][j] > src[i][k] + src[k][j]:
print((-1))
exit()
for i in range(N - 1):
for j in range(i + 1, N):
... | false | 4.347826 | [
"- src[i][j] = min(src[i][j], src[i][k] + src[k][j])"
] | false | 0.037645 | 0.038866 | 0.968565 | [
"s004059451",
"s466356055"
] |
u678167152 | p02623 | python | s009182153 | s113955381 | 261 | 193 | 47,436 | 41,844 | Accepted | Accepted | 26.05 | from bisect import *
def solve():
ans = 0
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))+[float('inf')]
B = list(map(int, input().split()))+[float('inf')]
cumA = [0]*(N+1)
cumB = [0]*(M+1)
for i in range(N):
cumA[i+1] = cumA[i]+A[i]
for i ... | from itertools import groupby, accumulate, product, permutations, combinations
def solve():
ans = 0
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A = [0]+list(accumulate(A))
B = [0]+list(accumulate(B))
b = M
for... | 20 | 17 | 554 | 478 | from bisect import *
def solve():
ans = 0
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split())) + [float("inf")]
B = list(map(int, input().split())) + [float("inf")]
cumA = [0] * (N + 1)
cumB = [0] * (M + 1)
for i in range(N):
cumA[i + 1] = cumA[i] + A[i]
... | from itertools import groupby, accumulate, product, permutations, combinations
def solve():
ans = 0
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A = [0] + list(accumulate(A))
B = [0] + list(accumulate(B))
b = M
for a ... | false | 15 | [
"-from bisect import *",
"+from itertools import groupby, accumulate, product, permutations, combinations",
"- A = list(map(int, input().split())) + [float(\"inf\")]",
"- B = list(map(int, input().split())) + [float(\"inf\")]",
"- cumA = [0] * (N + 1)",
"- cumB = [0] * (M + 1)",
"- for i ... | false | 0.036294 | 0.035859 | 1.012119 | [
"s009182153",
"s113955381"
] |
u497596438 | p03253 | python | s405178062 | s170765548 | 828 | 594 | 40,044 | 38,512 | Accepted | Accepted | 28.26 | def nCr(n,r):
a=1
x=n
while(x!=n-r):
a*=x
x-=1
b=1
x=r
while(x!=0):
b*=x
x-=1
return a//b
INF=10**9+7
N,m=list(map(int,input().split()))
sum=1
yd = {}
i = 2
while m != 1:
while m % i == 0:
if i in yd:
yd[i] += 1
else:
... | def main():
def nCr(n,r):
a=1
x=n
while(x!=n-r):
a*=x
x-=1
b=1
x=r
while(x!=0):
b*=x
x-=1
return a//b
INF=10**9+7
N,m=list(map(int,input().split()))
sum=1
yd = {}
i = 2
whi... | 35 | 38 | 480 | 661 | def nCr(n, r):
a = 1
x = n
while x != n - r:
a *= x
x -= 1
b = 1
x = r
while x != 0:
b *= x
x -= 1
return a // b
INF = 10**9 + 7
N, m = list(map(int, input().split()))
sum = 1
yd = {}
i = 2
while m != 1:
while m % i == 0:
if i in yd:
... | def main():
def nCr(n, r):
a = 1
x = n
while x != n - r:
a *= x
x -= 1
b = 1
x = r
while x != 0:
b *= x
x -= 1
return a // b
INF = 10**9 + 7
N, m = list(map(int, input().split()))
sum = 1
yd = {}... | false | 7.894737 | [
"-def nCr(n, r):",
"- a = 1",
"- x = n",
"- while x != n - r:",
"- a *= x",
"- x -= 1",
"- b = 1",
"- x = r",
"- while x != 0:",
"- b *= x",
"- x -= 1",
"- return a // b",
"+def main():",
"+ def nCr(n, r):",
"+ a = 1",
"+ ... | false | 0.085937 | 0.03946 | 2.177798 | [
"s405178062",
"s170765548"
] |
u571969099 | p03163 | python | s785235465 | s077679208 | 420 | 315 | 42,348 | 41,740 | Accepted | Accepted | 25 | n, w = [int(i) for i in input().split()]
a = [0] * (w + 1)
for _ in range(n):
b, c = [int(i) for i in input().split()]
for i in reversed(list(range(w + 1))):
if i + b >= w + 1:
continue
d = i + b
a[d] = max(a[d], a[i] + c)
print((a[-1]))
| n, w = [int(i) for i in input().split()]
dp = [0] * (w + 1)
for _ in range(n):
u, v = [int(i) for i in input().split()]
for i in reversed(list(range(w - u + 1))):
dp[i + u] = max(dp[i + u], dp[i] + v)
print((max(dp)))
| 10 | 8 | 283 | 234 | n, w = [int(i) for i in input().split()]
a = [0] * (w + 1)
for _ in range(n):
b, c = [int(i) for i in input().split()]
for i in reversed(list(range(w + 1))):
if i + b >= w + 1:
continue
d = i + b
a[d] = max(a[d], a[i] + c)
print((a[-1]))
| n, w = [int(i) for i in input().split()]
dp = [0] * (w + 1)
for _ in range(n):
u, v = [int(i) for i in input().split()]
for i in reversed(list(range(w - u + 1))):
dp[i + u] = max(dp[i + u], dp[i] + v)
print((max(dp)))
| false | 20 | [
"-a = [0] * (w + 1)",
"+dp = [0] * (w + 1)",
"- b, c = [int(i) for i in input().split()]",
"- for i in reversed(list(range(w + 1))):",
"- if i + b >= w + 1:",
"- continue",
"- d = i + b",
"- a[d] = max(a[d], a[i] + c)",
"-print((a[-1]))",
"+ u, v = [int(i) ... | false | 0.042214 | 0.044952 | 0.939095 | [
"s785235465",
"s077679208"
] |
u522293645 | p02642 | python | s344634919 | s061602378 | 489 | 159 | 219,804 | 100,860 | Accepted | Accepted | 67.48 | n = int(eval(input()))
li = list(map(int,input().split()))
ok = set()
ng = set()
mul = set()
ans = 0
for i in li:
if i not in ok:
ok.add(i)
else:
ng.add(i)
M = max(ok)
for i in ok:
for j in range(2,M+1):
if i*j > 10**6:
break
else:
... | N = 1000001
a = [0]* N
eval(input())
for x in input().split():
a[int(x)] += 1
for i in range(1, N):
if a[i]:
for j in range(i + i, N, i):
a[j] = 0
print((a.count(1))) | 29 | 10 | 429 | 181 | n = int(eval(input()))
li = list(map(int, input().split()))
ok = set()
ng = set()
mul = set()
ans = 0
for i in li:
if i not in ok:
ok.add(i)
else:
ng.add(i)
M = max(ok)
for i in ok:
for j in range(2, M + 1):
if i * j > 10**6:
break
else:
mul.add(i * j)... | N = 1000001
a = [0] * N
eval(input())
for x in input().split():
a[int(x)] += 1
for i in range(1, N):
if a[i]:
for j in range(i + i, N, i):
a[j] = 0
print((a.count(1)))
| false | 65.517241 | [
"-n = int(eval(input()))",
"-li = list(map(int, input().split()))",
"-ok = set()",
"-ng = set()",
"-mul = set()",
"-ans = 0",
"-for i in li:",
"- if i not in ok:",
"- ok.add(i)",
"- else:",
"- ng.add(i)",
"-M = max(ok)",
"-for i in ok:",
"- for j in range(2, M + 1):"... | false | 0.057189 | 0.514111 | 0.111239 | [
"s344634919",
"s061602378"
] |
u004208081 | p03111 | python | s781927900 | s975823689 | 308 | 73 | 3,316 | 3,064 | Accepted | Accepted | 76.3 | n, a, b, c = list(map(int, input().split()))
l = []
for _ in range(n):
l.append(int(eval(input())))
def dfs(depth, t, ans):
if depth == n:
sum = calc(t)
if sum < ans:
return sum
else:
return ans
for j in range(4):
tt = t.copy()
... | N, A, B, C = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(N)]
INF = 10**12
def dfs(depth, a, b, c):
if depth == N:
return abs(A - a) + abs(B - b) + abs(C - c) - 30 if min(a, b, c) > 0 else INF
res1 = dfs(depth + 1, a, b, c)
res2 = dfs(depth + 1, a + l[depth], b, ... | 40 | 16 | 814 | 493 | n, a, b, c = list(map(int, input().split()))
l = []
for _ in range(n):
l.append(int(eval(input())))
def dfs(depth, t, ans):
if depth == n:
sum = calc(t)
if sum < ans:
return sum
else:
return ans
for j in range(4):
tt = t.copy()
tt.append(j)
... | N, A, B, C = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(N)]
INF = 10**12
def dfs(depth, a, b, c):
if depth == N:
return abs(A - a) + abs(B - b) + abs(C - c) - 30 if min(a, b, c) > 0 else INF
res1 = dfs(depth + 1, a, b, c)
res2 = dfs(depth + 1, a + l[depth], b, c) + 10
... | false | 60 | [
"-n, a, b, c = list(map(int, input().split()))",
"-l = []",
"-for _ in range(n):",
"- l.append(int(eval(input())))",
"+N, A, B, C = list(map(int, input().split()))",
"+l = [int(eval(input())) for _ in range(N)]",
"+INF = 10**12",
"-def dfs(depth, t, ans):",
"- if depth == n:",
"- sum ... | false | 0.354223 | 0.203968 | 1.736658 | [
"s781927900",
"s975823689"
] |
u496821919 | p02803 | python | s979834240 | s098008596 | 637 | 576 | 3,572 | 3,316 | Accepted | Accepted | 9.58 | from collections import deque
import copy
h,w = list(map(int,input().split()))
origin = []
dx = [1,-1,0,0]
dy = [0,0,1,-1]
ans = 0
for i in range(h):
origin.append(list(eval(input())))
for i in range(h):
if "#" in origin[i]:
break
else:
print((h+w-2))
exit()
for i in range(h):
... | from collections import deque
h,w = list(map(int,input().split()))
dx = [1,-1,0,0]
dy = [0,0,1,-1]
ans = 0
maze = []
for i in range(h):
maze.append(list(eval(input())))
for i in range(h):
for j in range(w):
if maze[i][j] == ".":
d = [[-1 for a in range(w)] for b in range(h)]
... | 33 | 24 | 948 | 775 | from collections import deque
import copy
h, w = list(map(int, input().split()))
origin = []
dx = [1, -1, 0, 0]
dy = [0, 0, 1, -1]
ans = 0
for i in range(h):
origin.append(list(eval(input())))
for i in range(h):
if "#" in origin[i]:
break
else:
print((h + w - 2))
exit()
for i in range(h):
f... | from collections import deque
h, w = list(map(int, input().split()))
dx = [1, -1, 0, 0]
dy = [0, 0, 1, -1]
ans = 0
maze = []
for i in range(h):
maze.append(list(eval(input())))
for i in range(h):
for j in range(w):
if maze[i][j] == ".":
d = [[-1 for a in range(w)] for b in range(h)]
... | false | 27.272727 | [
"-import copy",
"-origin = []",
"+maze = []",
"- origin.append(list(eval(input())))",
"-for i in range(h):",
"- if \"#\" in origin[i]:",
"- break",
"-else:",
"- print((h + w - 2))",
"- exit()",
"+ maze.append(list(eval(input())))",
"- if origin[i][j] == \".\":",
... | false | 0.0367 | 0.036262 | 1.012066 | [
"s979834240",
"s098008596"
] |
u323045245 | p02971 | python | s148654822 | s164571476 | 577 | 431 | 14,112 | 19,100 | Accepted | Accepted | 25.3 | n = int(eval(input()))
num = [int(eval(input())) for _ in range(n)]
Sort_num = sorted(num)
for i in range(n):
if num[i] == Sort_num[n-1]:
print((Sort_num[n-2]))
else:
print((Sort_num[n-1]))
| from copy import deepcopy
n=int(eval(input()))
a=[int(eval(input())) for _ in range(n)]
b = deepcopy(a)
b.sort()
for i in range(n):
if a[i] == b[-1]:
print((b[-2]))
else:
print((b[-1]))
| 8 | 11 | 193 | 205 | n = int(eval(input()))
num = [int(eval(input())) for _ in range(n)]
Sort_num = sorted(num)
for i in range(n):
if num[i] == Sort_num[n - 1]:
print((Sort_num[n - 2]))
else:
print((Sort_num[n - 1]))
| from copy import deepcopy
n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
b = deepcopy(a)
b.sort()
for i in range(n):
if a[i] == b[-1]:
print((b[-2]))
else:
print((b[-1]))
| false | 27.272727 | [
"+from copy import deepcopy",
"+",
"-num = [int(eval(input())) for _ in range(n)]",
"-Sort_num = sorted(num)",
"+a = [int(eval(input())) for _ in range(n)]",
"+b = deepcopy(a)",
"+b.sort()",
"- if num[i] == Sort_num[n - 1]:",
"- print((Sort_num[n - 2]))",
"+ if a[i] == b[-1]:",
"+ ... | false | 0.007861 | 0.127073 | 0.06186 | [
"s148654822",
"s164571476"
] |
u454093752 | p03043 | python | s476205313 | s852578110 | 249 | 178 | 60,012 | 38,896 | Accepted | Accepted | 28.51 | from decimal import Decimal
N, K = list(map(int, input().split()))
t = 0
i = 1
while(i < K):
t += 1
i *= 2
under = 2**t
p = 0
for i in range(1, N+1):
c = 0
while(i < K):
c += 1
i *= 2
p += 2**(t-c)
print((Decimal(p/((2**t)*N))))
| N, K = list(map(int, input().split()))
t = 0
i = 1
while(i < K):
t += 1
i *= 2
under = 2**t
p = 0
for i in range(1, N+1):
c = 0
while(i < K):
c += 1
i *= 2
p += 2**(t-c)
print((p/((2**t)*N))) | 17 | 16 | 274 | 235 | from decimal import Decimal
N, K = list(map(int, input().split()))
t = 0
i = 1
while i < K:
t += 1
i *= 2
under = 2**t
p = 0
for i in range(1, N + 1):
c = 0
while i < K:
c += 1
i *= 2
p += 2 ** (t - c)
print((Decimal(p / ((2**t) * N))))
| N, K = list(map(int, input().split()))
t = 0
i = 1
while i < K:
t += 1
i *= 2
under = 2**t
p = 0
for i in range(1, N + 1):
c = 0
while i < K:
c += 1
i *= 2
p += 2 ** (t - c)
print((p / ((2**t) * N)))
| false | 5.882353 | [
"-from decimal import Decimal",
"-",
"-print((Decimal(p / ((2**t) * N))))",
"+print((p / ((2**t) * N)))"
] | false | 0.093439 | 0.007986 | 11.700323 | [
"s476205313",
"s852578110"
] |
u226108478 | p03253 | python | s238650880 | s071615012 | 27 | 19 | 3,508 | 3,064 | Accepted | Accepted | 29.63 | # -*- coding: utf-8 -*-
'''Snippets for prime.
Available functions:
- is_included: Determine whether it is a prime number.
- generate: Generate a list of prime numbers using sieve of Eratosthenes.
'''
class Prime(object):
'''Represents a snippet for prime numbers.
'''
def __init__(self, n... | # -*- coding: utf-8 -*-
mod = 10 ** 9 + 7
'''Snippets for combination.
Available functions:
- count_combination: Count the total number of combinations.
'''
def count_combination(n: int, r: int, mod: int = 10 ** 9 + 7) -> int:
'''Count the total number of combinations.
nCr % mod.
... | 107 | 85 | 2,676 | 1,717 | # -*- coding: utf-8 -*-
"""Snippets for prime.
Available functions:
- is_included: Determine whether it is a prime number.
- generate: Generate a list of prime numbers using sieve of Eratosthenes.
"""
class Prime(object):
"""Represents a snippet for prime numbers."""
def __init__(self, number):
self.... | # -*- coding: utf-8 -*-
mod = 10**9 + 7
"""Snippets for combination.
Available functions:
- count_combination: Count the total number of combinations.
"""
def count_combination(n: int, r: int, mod: int = 10**9 + 7) -> int:
"""Count the total number of combinations.
nCr % mod.
Args:
n : Eleme... | false | 20.560748 | [
"-\"\"\"Snippets for prime.",
"+mod = 10**9 + 7",
"+\"\"\"Snippets for combination.",
"-- is_included: Determine whether it is a prime number.",
"-- generate: Generate a list of prime numbers using sieve of Eratosthenes.",
"+- count_combination: Count the total number of combinations.",
"-class Prime(ob... | false | 0.046677 | 0.081852 | 0.570252 | [
"s238650880",
"s071615012"
] |
u782930273 | p02923 | python | s681377097 | s942090940 | 90 | 76 | 14,252 | 14,252 | Accepted | Accepted | 15.56 | N = int(eval(input()))
H = [int(h) for h in input().split()]
H.append(1e10)
dH = [H[i + 1] - H[i] for i in range(N)]
m, c = 0, 0
for i in range(N):
d = H[i + 1] - H[i]
if d <= 0:
c += 1
else:
if c > m:
m = c
c = 0
print(m) | N = int(eval(input()))
H = [int(h) for h in input().split()]
H.append(1e10)
m, c = 0, 0
for i in range(N):
d = H[i + 1] - H[i]
if d <= 0:
c += 1
else:
if c > m:
m = c
c = 0
print(m) | 14 | 13 | 277 | 211 | N = int(eval(input()))
H = [int(h) for h in input().split()]
H.append(1e10)
dH = [H[i + 1] - H[i] for i in range(N)]
m, c = 0, 0
for i in range(N):
d = H[i + 1] - H[i]
if d <= 0:
c += 1
else:
if c > m:
m = c
c = 0
print(m)
| N = int(eval(input()))
H = [int(h) for h in input().split()]
H.append(1e10)
m, c = 0, 0
for i in range(N):
d = H[i + 1] - H[i]
if d <= 0:
c += 1
else:
if c > m:
m = c
c = 0
print(m)
| false | 7.142857 | [
"-dH = [H[i + 1] - H[i] for i in range(N)]"
] | false | 0.132857 | 0.07502 | 1.770946 | [
"s681377097",
"s942090940"
] |
u440566786 | p02840 | python | s242900918 | s963395140 | 1,559 | 687 | 82,524 | 88,148 | Accepted | Accepted | 55.93 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
from itertools import groupby
def resolve():
n,a,d=list(map(int,input().split()))
if(d==0):
if(a==0): print((1))
else: print((n+1))
return
if(d<0): a,d=-a,... | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
from collections import defaultdict
def resolve():
n,a,d=list(map(int,input().split()))
if(d==0):
if(a!=0):
print((n+1))
else:
print((1))
... | 37 | 37 | 832 | 868 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
from itertools import groupby
def resolve():
n, a, d = list(map(int, input().split()))
if d == 0:
if a == 0:
print((1))
else:
print((n + 1))
... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
from collections import defaultdict
def resolve():
n, a, d = list(map(int, input().split()))
if d == 0:
if a != 0:
print((n + 1))
else:
print((... | false | 0 | [
"-from itertools import groupby",
"+from collections import defaultdict",
"- if a == 0:",
"+ if a != 0:",
"+ print((n + 1))",
"+ else:",
"- else:",
"- print((n + 1))",
"- a, d = -a, -d",
"- A = [None] * (2 * n + 2)",
"+ a, d = -a... | false | 0.042815 | 0.03854 | 1.110928 | [
"s242900918",
"s963395140"
] |
u562935282 | p02991 | python | s387769891 | s329618121 | 636 | 549 | 93,708 | 99,496 | Accepted | Accepted | 13.68 | def bfs(g, N, s, t):
from collections import deque
dist = [-1] * (N * 3)
dist[s] = 0
dq = deque()
dq.append(s)
while dq:
v = dq.popleft()
d = dist[v]
for u in g[v]:
if ~dist[u]: continue
dist[u] = d + 1
if u == t:
... | def main():
from collections import deque
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
g = tuple(set() for _ in range(N * 3))
for _ in range(M):
u, v = (int(x) - 1 for x in input().split())
g[u].add(v + N)
g[u + N].add(v + N + ... | 43 | 37 | 882 | 772 | def bfs(g, N, s, t):
from collections import deque
dist = [-1] * (N * 3)
dist[s] = 0
dq = deque()
dq.append(s)
while dq:
v = dq.popleft()
d = dist[v]
for u in g[v]:
if ~dist[u]:
continue
dist[u] = d + 1
if u == t:
... | def main():
from collections import deque
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
g = tuple(set() for _ in range(N * 3))
for _ in range(M):
u, v = (int(x) - 1 for x in input().split())
g[u].add(v + N)
g[u + N].add(v + N + N)
g... | false | 13.953488 | [
"-def bfs(g, N, s, t):",
"+def main():",
"-",
"- dist = [-1] * (N * 3)",
"- dist[s] = 0",
"- dq = deque()",
"- dq.append(s)",
"- while dq:",
"- v = dq.popleft()",
"- d = dist[v]",
"- for u in g[v]:",
"- if ~dist[u]:",
"- continue"... | false | 0.039666 | 0.038102 | 1.041048 | [
"s387769891",
"s329618121"
] |
u047102107 | p03283 | python | s865069002 | s328712539 | 2,931 | 633 | 55,384 | 78,524 | Accepted | Accepted | 78.4 | # https://atcoder.jp/contests/abc106/tasks/abc106_d
# MAX_N = 505
n, m, q = list(map(int, input().split()))
X = [[0] * (n + 1) for _ in range(n + 1)]
C = [[0] * (n + 1) for _ in range(n + 1)]
count = [0] * (n + 1)
for _ in range(m):
li, ri = list(map(int, input().split()))
X[li][ri] += 1
for i in ran... | # https://atcoder.jp/contests/abc106/tasks/abc106_d
MAX_N = 505
n, m, q = list(map(int, input().split()))
P = [[0] * MAX_N for _ in range(MAX_N)]
# 二次元累積和
for _ in range(m):
li, ri = list(map(int, input().split()))
P[li][ri] += 1
for i in range(1, MAX_N):
for j in range(1, MAX_N):
P[i]... | 20 | 22 | 557 | 570 | # https://atcoder.jp/contests/abc106/tasks/abc106_d
# MAX_N = 505
n, m, q = list(map(int, input().split()))
X = [[0] * (n + 1) for _ in range(n + 1)]
C = [[0] * (n + 1) for _ in range(n + 1)]
count = [0] * (n + 1)
for _ in range(m):
li, ri = list(map(int, input().split()))
X[li][ri] += 1
for i in range(1, n + 1... | # https://atcoder.jp/contests/abc106/tasks/abc106_d
MAX_N = 505
n, m, q = list(map(int, input().split()))
P = [[0] * MAX_N for _ in range(MAX_N)]
# 二次元累積和
for _ in range(m):
li, ri = list(map(int, input().split()))
P[li][ri] += 1
for i in range(1, MAX_N):
for j in range(1, MAX_N):
P[i][j] += P[i][j ... | false | 9.090909 | [
"-# MAX_N = 505",
"+MAX_N = 505",
"-X = [[0] * (n + 1) for _ in range(n + 1)]",
"-C = [[0] * (n + 1) for _ in range(n + 1)]",
"-count = [0] * (n + 1)",
"+P = [[0] * MAX_N for _ in range(MAX_N)]",
"+# 二次元累積和",
"- X[li][ri] += 1",
"-for i in range(1, n + 1):",
"- for j in range(1, n + 1):",
... | false | 0.045826 | 0.952121 | 0.048131 | [
"s865069002",
"s328712539"
] |
u596276291 | p04014 | python | s943327468 | s766193186 | 425 | 264 | 3,064 | 4,068 | Accepted | Accepted | 37.88 | from math import floor, sqrt
INF = 10 ** 20
def f(b, n):
if n < b:
return n
else:
return f(b, n // b) + (n % b)
def main():
n = int(eval(input()))
s = int(eval(input()))
ans = INF
# 1桁
if n == s:
ans = min(ans, n + 1)
# 2桁
for p in r... | from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
... | 36 | 66 | 643 | 1,430 | from math import floor, sqrt
INF = 10**20
def f(b, n):
if n < b:
return n
else:
return f(b, n // b) + (n % b)
def main():
n = int(eval(input()))
s = int(eval(input()))
ans = INF
# 1桁
if n == s:
ans = min(ans, n + 1)
# 2桁
for p in range(1, int(sqrt(n)) + 1... | from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.se... | false | 45.454545 | [
"-from math import floor, sqrt",
"+from collections import defaultdict, Counter",
"+from itertools import product, groupby, count, permutations, combinations",
"+from math import pi, sqrt, floor",
"+from collections import deque",
"+from bisect import bisect, bisect_left, bisect_right",
"+from string im... | false | 0.066538 | 0.055929 | 1.189673 | [
"s943327468",
"s766193186"
] |
u021019433 | p03032 | python | s937139481 | s621293098 | 44 | 40 | 3,316 | 3,064 | Accepted | Accepted | 9.09 | from itertools import chain
R = lambda: list(map(int, input().split()))
n, k = R()
v = list(R())
a = sorted((x, i) for i, x in enumerate(v) if x < 0)
r = 0
for i in range(1, min(n, k) + 1):
for j in range(i):
r1, r2 = list(range(i - j)), list(range(n - j, n))
s = sum(v[m] for m in chain(... | from itertools import chain
R = lambda: list(map(int, input().split()))
n, k = R()
v = list(R())
a = sorted((x, i) for i, x in enumerate(v) if x < 0)
r = 0
for i in range(1, min(n, k) + 1):
for j in range(i):
r1, r2 = i - j, n - j
s = sum(v[m] for m in chain(list(range(r1)), list(range(r... | 20 | 20 | 514 | 513 | from itertools import chain
R = lambda: list(map(int, input().split()))
n, k = R()
v = list(R())
a = sorted((x, i) for i, x in enumerate(v) if x < 0)
r = 0
for i in range(1, min(n, k) + 1):
for j in range(i):
r1, r2 = list(range(i - j)), list(range(n - j, n))
s = sum(v[m] for m in chain(r1, r2))
... | from itertools import chain
R = lambda: list(map(int, input().split()))
n, k = R()
v = list(R())
a = sorted((x, i) for i, x in enumerate(v) if x < 0)
r = 0
for i in range(1, min(n, k) + 1):
for j in range(i):
r1, r2 = i - j, n - j
s = sum(v[m] for m in chain(list(range(r1)), list(range(r2, n))))
... | false | 0 | [
"- r1, r2 = list(range(i - j)), list(range(n - j, n))",
"- s = sum(v[m] for m in chain(r1, r2))",
"+ r1, r2 = i - j, n - j",
"+ s = sum(v[m] for m in chain(list(range(r1)), list(range(r2, n))))",
"- if m in r1 or m in r2:",
"+ if m < r1 or m >= r2:"
] | false | 0.038038 | 0.112788 | 0.337251 | [
"s937139481",
"s621293098"
] |
u561231954 | p02948 | python | s227824266 | s701467233 | 488 | 446 | 31,924 | 20,432 | Accepted | Accepted | 8.61 | def main():
from heapq import heapify,heappop,heappush
n,m=list(map(int,input().split()))
W=[list(map(int,input().split())) for _ in range(n)]
W.sort(key=lambda x:x[0])
q=[]
heapify(q)
j,income=0,0
for i in range(1,m+1):
while j<n and W[j][0]<=i:
hea... | MOD = 10 ** 9 + 7
INF = 10 ** 11
import sys
sys.setrecursionlimit(100000000)
from heapq import heapify,heappop,heappush
def main():
N,M = list(map(int,input().split()))
works = [tuple(map(int,input().split())) for _ in range(N)]
works.sort(key = lambda x:x[0])
q = []
ans = 0
j = 0
... | 22 | 23 | 476 | 563 | def main():
from heapq import heapify, heappop, heappush
n, m = list(map(int, input().split()))
W = [list(map(int, input().split())) for _ in range(n)]
W.sort(key=lambda x: x[0])
q = []
heapify(q)
j, income = 0, 0
for i in range(1, m + 1):
while j < n and W[j][0] <= i:
... | MOD = 10**9 + 7
INF = 10**11
import sys
sys.setrecursionlimit(100000000)
from heapq import heapify, heappop, heappush
def main():
N, M = list(map(int, input().split()))
works = [tuple(map(int, input().split())) for _ in range(N)]
works.sort(key=lambda x: x[0])
q = []
ans = 0
j = 0
for i i... | false | 4.347826 | [
"+MOD = 10**9 + 7",
"+INF = 10**11",
"+import sys",
"+",
"+sys.setrecursionlimit(100000000)",
"+from heapq import heapify, heappop, heappush",
"+",
"+",
"- from heapq import heapify, heappop, heappush",
"-",
"- n, m = list(map(int, input().split()))",
"- W = [list(map(int, input().spl... | false | 0.066278 | 0.069222 | 0.957476 | [
"s227824266",
"s701467233"
] |
u235027735 | p02755 | python | s604555250 | s948619459 | 20 | 17 | 3,060 | 2,940 | Accepted | Accepted | 15 | import math
a, b = list(map(int, input().split()))
for i in range(10001):
if math.floor(i*0.08)==a and math.floor(i*0.1)==b:
ans = i
break
else :
ans = -1
print(ans)
| import math
a, b = list(map(int, input().split()))
for i in range(1001):
if math.floor(i*0.08)==a and math.floor(i*0.1)==b:
ans = i
break
else :
ans = -1
print(ans)
| 13 | 13 | 208 | 207 | import math
a, b = list(map(int, input().split()))
for i in range(10001):
if math.floor(i * 0.08) == a and math.floor(i * 0.1) == b:
ans = i
break
else:
ans = -1
print(ans)
| import math
a, b = list(map(int, input().split()))
for i in range(1001):
if math.floor(i * 0.08) == a and math.floor(i * 0.1) == b:
ans = i
break
else:
ans = -1
print(ans)
| false | 0 | [
"-for i in range(10001):",
"+for i in range(1001):"
] | false | 0.046184 | 0.045377 | 1.017799 | [
"s604555250",
"s948619459"
] |
u970197315 | p03761 | python | s134877597 | s855267943 | 22 | 18 | 3,316 | 3,064 | Accepted | Accepted | 18.18 | # ABC0 C - 怪文書 / Dubious Document
from collections import defaultdict
si = lambda: eval(input())
ni = lambda: int(eval(input()))
nm = lambda: list(map(int, input().split()))
nl = lambda: list(map(int, input().split()))
N = ni()
S = [eval(input()) for _ in range(N)]
ABC = set()
t = set()
for i,s in enumera... | n=int(eval(input()))
s=[eval(input()) for i in range(n)]
c=[[0]*26 for i in range(n)]
a=[0]*26
for i,ss in enumerate(s):
for sss in ss:
c[i][ord(sss)-97]+=1
for i in range(26):
tmp=10**9
for j in range(n):
tmp=min(tmp,c[j][i])
a[i]=tmp
ans=[]
for i,aa in enumerate(a):
... | 43 | 21 | 795 | 383 | # ABC0 C - 怪文書 / Dubious Document
from collections import defaultdict
si = lambda: eval(input())
ni = lambda: int(eval(input()))
nm = lambda: list(map(int, input().split()))
nl = lambda: list(map(int, input().split()))
N = ni()
S = [eval(input()) for _ in range(N)]
ABC = set()
t = set()
for i, s in enumerate(S):
i... | n = int(eval(input()))
s = [eval(input()) for i in range(n)]
c = [[0] * 26 for i in range(n)]
a = [0] * 26
for i, ss in enumerate(s):
for sss in ss:
c[i][ord(sss) - 97] += 1
for i in range(26):
tmp = 10**9
for j in range(n):
tmp = min(tmp, c[j][i])
a[i] = tmp
ans = []
for i, aa in enumer... | false | 51.162791 | [
"-# ABC0 C - 怪文書 / Dubious Document",
"-from collections import defaultdict",
"-",
"-si = lambda: eval(input())",
"-ni = lambda: int(eval(input()))",
"-nm = lambda: list(map(int, input().split()))",
"-nl = lambda: list(map(int, input().split()))",
"-N = ni()",
"-S = [eval(input()) for _ in range(N)]... | false | 0.045483 | 0.044727 | 1.016899 | [
"s134877597",
"s855267943"
] |
u729133443 | p03399 | python | s747100861 | s385458396 | 164 | 17 | 38,420 | 2,940 | Accepted | Accepted | 89.63 | i=lambda:int(eval(input()));print((min(i(),i())+min(i(),i()))) | s='int(input())';print((eval(('+min(%s,%s)'%(s,s))*2))) | 1 | 1 | 54 | 53 | i = lambda: int(eval(input()))
print((min(i(), i()) + min(i(), i())))
| s = "int(input())"
print((eval(("+min(%s,%s)" % (s, s)) * 2)))
| false | 0 | [
"-i = lambda: int(eval(input()))",
"-print((min(i(), i()) + min(i(), i())))",
"+s = \"int(input())\"",
"+print((eval((\"+min(%s,%s)\" % (s, s)) * 2)))"
] | false | 0.147949 | 0.04208 | 3.515886 | [
"s747100861",
"s385458396"
] |
u347640436 | p03262 | python | s958376148 | s940922170 | 100 | 90 | 16,080 | 16,080 | Accepted | Accepted | 10 | from sys import stdin
from fractions import gcd
n, x, *xs = list(map(int, stdin.read().split()))
result = abs(xs[0] - x)
for i in range(1, n):
result = gcd(result, abs(xs[i] - x))
print(result)
| from sys import stdin
from fractions import gcd
from functools import reduce
n, x, *xs = list(map(int, stdin.read().split()))
print((reduce(gcd, [abs(xs[i] - x) for i in range(n)])))
| 7 | 5 | 196 | 179 | from sys import stdin
from fractions import gcd
n, x, *xs = list(map(int, stdin.read().split()))
result = abs(xs[0] - x)
for i in range(1, n):
result = gcd(result, abs(xs[i] - x))
print(result)
| from sys import stdin
from fractions import gcd
from functools import reduce
n, x, *xs = list(map(int, stdin.read().split()))
print((reduce(gcd, [abs(xs[i] - x) for i in range(n)])))
| false | 28.571429 | [
"+from functools import reduce",
"-result = abs(xs[0] - x)",
"-for i in range(1, n):",
"- result = gcd(result, abs(xs[i] - x))",
"-print(result)",
"+print((reduce(gcd, [abs(xs[i] - x) for i in range(n)])))"
] | false | 0.049416 | 0.046759 | 1.056835 | [
"s958376148",
"s940922170"
] |
u714300041 | p03162 | python | s258107612 | s035962523 | 1,274 | 972 | 15,928 | 31,896 | Accepted | Accepted | 23.7 | import numpy as np
N = int(eval(input()))
dp = np.zeros((N+1, 3)) # (i日目にa, b, cを行って)i日目までに得られる幸福度の最大値
"""
i日目にaを選んだ場合
dp[i, 0] = max(dp[i-1, 1], dp[i-1, 2]) + a
i日目にbを選んだ場合
dp[i, 1] = max(dp[i-1, 0], dp[i-1, 2]) + b
i-1日目にcを選んだ場合
dp[i, 2] = max(dp[i-1, 0], dp[i-1, 1]) + c
"""
for i in range(1, N+1):
... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
import bisect
import numpy as np
N = int(eval(input()))
ABC = np.array([np.array(list(map(int, input().split()))) for _ in range(N)])
dp = np.ones((N, 3))*-float("inf")
dp[0] = ABC[0]
for i in range(1, N):
dp[i, 0] = max(dp[i-1, ... | 20 | 19 | 527 | 480 | import numpy as np
N = int(eval(input()))
dp = np.zeros((N + 1, 3)) # (i日目にa, b, cを行って)i日目までに得られる幸福度の最大値
"""
i日目にaを選んだ場合
dp[i, 0] = max(dp[i-1, 1], dp[i-1, 2]) + a
i日目にbを選んだ場合
dp[i, 1] = max(dp[i-1, 0], dp[i-1, 2]) + b
i-1日目にcを選んだ場合
dp[i, 2] = max(dp[i-1, 0], dp[i-1, 1]) + c
"""
for i in range(1, N + 1):
a, b, c ... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
import bisect
import numpy as np
N = int(eval(input()))
ABC = np.array([np.array(list(map(int, input().split()))) for _ in range(N)])
dp = np.ones((N, 3)) * -float("inf")
dp[0] = ABC[0]
for i in range(1, N):
dp[i, 0] = max(dp[i - 1, 1], dp[i - 1, ... | false | 5 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"+sys.setrecursionlimit(10**7)",
"+import bisect",
"-dp = np.zeros((N + 1, 3)) # (i日目にa, b, cを行って)i日目までに得られる幸福度の最大値",
"-\"\"\"",
"-i日目にaを選んだ場合",
"-dp[i, 0] = max(dp[i-1, 1], dp[i-1, 2]) + a",
"-i日目にbを選んだ場合",
"-dp[i, 1] = max(dp[i-1, 0], dp[i-1,... | false | 0.20239 | 0.508637 | 0.397906 | [
"s258107612",
"s035962523"
] |
u523087093 | p02579 | python | s027618031 | s232262323 | 1,919 | 677 | 23,116 | 129,064 | Accepted | Accepted | 64.72 | import sys
input = sys.stdin.readline
def main():
h, w = list(map(int, input().split()))
ch, cw = list(map(int, input().split()))
dh, dw = list(map(int, input().split()))
ch += 1
cw += 1
dh += 1
dw += 1
s = ["#"*(w+4)]
s.append("#"*(w+4))
for i i... | #----------[インポート]----------#
from collections import deque
def main():
#----------[入力受取・初期設定]----------#
H, W = list(map(int, input().split()))
C = tuple(map(int, input().split())) # 魔法の位置
D = tuple(map(int, input().split())) # ゴール
D_y = D[0] -1 # 0スタート
D_x = D[1] -1 # 0スタート
S = ... | 64 | 58 | 1,732 | 2,105 | import sys
input = sys.stdin.readline
def main():
h, w = list(map(int, input().split()))
ch, cw = list(map(int, input().split()))
dh, dw = list(map(int, input().split()))
ch += 1
cw += 1
dh += 1
dw += 1
s = ["#" * (w + 4)]
s.append("#" * (w + 4))
for i in range(h):
s.a... | # ----------[インポート]----------#
from collections import deque
def main():
# ----------[入力受取・初期設定]----------#
H, W = list(map(int, input().split()))
C = tuple(map(int, input().split())) # 魔法の位置
D = tuple(map(int, input().split())) # ゴール
D_y = D[0] - 1 # 0スタート
D_x = D[1] - 1 # 0スタート
S = [... | false | 9.375 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"+from collections import deque",
"- h, w = list(map(int, input().split()))",
"- ch, cw = list(map(int, input().split()))",
"- dh, dw = list(map(int, input().split()))",
"- ch += 1",
"- cw += 1",
"- dh += 1",
"- dw += 1",
... | false | 0.036445 | 0.037553 | 0.970499 | [
"s027618031",
"s232262323"
] |
u449473917 | p03029 | python | s394515964 | s131119825 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | a,b=list(map(int,input().split()))
print((((a*3)+b)//2)) | import math
a,p=list(map(int,input().split()))
ans=math.floor((a*3+p)/2)
print(ans) | 2 | 6 | 49 | 84 | a, b = list(map(int, input().split()))
print((((a * 3) + b) // 2))
| import math
a, p = list(map(int, input().split()))
ans = math.floor((a * 3 + p) / 2)
print(ans)
| false | 66.666667 | [
"-a, b = list(map(int, input().split()))",
"-print((((a * 3) + b) // 2))",
"+import math",
"+",
"+a, p = list(map(int, input().split()))",
"+ans = math.floor((a * 3 + p) / 2)",
"+print(ans)"
] | false | 0.111305 | 0.051995 | 2.140688 | [
"s394515964",
"s131119825"
] |
u732061897 | p03147 | python | s340722382 | s112929968 | 34 | 29 | 9,108 | 9,160 | Accepted | Accepted | 14.71 | N = int(eval(input()))
H = list(map(int, input().split()))
is_init = True
is_end = False
ans = 0
while not is_end:
is_init = True
for i in range(N):
h = H[i]
if h <= 0:
if i == N - 1 and is_init:
is_end = True
H[i] -= 1
else:
... | N = int(eval(input()))
H = list(map(int, input().split()))
ans = H[0]
active = H[0]
for i in range(1,N):
h = H[i]
ans += max(0, h - active)
active = h
print(ans)
| 24 | 9 | 566 | 176 | N = int(eval(input()))
H = list(map(int, input().split()))
is_init = True
is_end = False
ans = 0
while not is_end:
is_init = True
for i in range(N):
h = H[i]
if h <= 0:
if i == N - 1 and is_init:
is_end = True
H[i] -= 1
else:
is_init = ... | N = int(eval(input()))
H = list(map(int, input().split()))
ans = H[0]
active = H[0]
for i in range(1, N):
h = H[i]
ans += max(0, h - active)
active = h
print(ans)
| false | 62.5 | [
"-is_init = True",
"-is_end = False",
"-ans = 0",
"-while not is_end:",
"- is_init = True",
"- for i in range(N):",
"- h = H[i]",
"- if h <= 0:",
"- if i == N - 1 and is_init:",
"- is_end = True",
"- H[i] -= 1",
"- else:",
"- ... | false | 0.037621 | 0.036925 | 1.018842 | [
"s340722382",
"s112929968"
] |
u977389981 | p03013 | python | s478164558 | s416497846 | 480 | 146 | 50,776 | 14,320 | Accepted | Accepted | 69.58 | import sys
N, M = list(map(int, input().split()))
A = [int(eval(input())) for _ in range(M)]
mod = 10 ** 9 + 7
if N == 1:
print((1))
sys.exit()
B = ['.'] * (N + 1)
for a in A:
B[a] = '#'
dp = [0] * (N + 1)
if B[1] == '.' and B[2] == '.':
dp[1] = 1
dp[2] = 2
elif B[1] == '#' ... | import sys
n, m = list(map(int, input().split()))
A = [int(eval(input())) for _ in range(m)]
mod = 1000000007
if n == 1:
print((1))
sys.exit()
B = ['.'] * (n + 1)
for a in A:
B[a] = '#'
dp = [0] * (n + 1)
if B[1] == '.' and B[2] == '.':
dp[1] = 1
dp[2] = 2
elif B[1] == '#' an... | 27 | 27 | 508 | 507 | import sys
N, M = list(map(int, input().split()))
A = [int(eval(input())) for _ in range(M)]
mod = 10**9 + 7
if N == 1:
print((1))
sys.exit()
B = ["."] * (N + 1)
for a in A:
B[a] = "#"
dp = [0] * (N + 1)
if B[1] == "." and B[2] == ".":
dp[1] = 1
dp[2] = 2
elif B[1] == "#" and B[2] == ".":
dp[2]... | import sys
n, m = list(map(int, input().split()))
A = [int(eval(input())) for _ in range(m)]
mod = 1000000007
if n == 1:
print((1))
sys.exit()
B = ["."] * (n + 1)
for a in A:
B[a] = "#"
dp = [0] * (n + 1)
if B[1] == "." and B[2] == ".":
dp[1] = 1
dp[2] = 2
elif B[1] == "#" and B[2] == ".":
dp[2... | false | 0 | [
"-N, M = list(map(int, input().split()))",
"-A = [int(eval(input())) for _ in range(M)]",
"-mod = 10**9 + 7",
"-if N == 1:",
"+n, m = list(map(int, input().split()))",
"+A = [int(eval(input())) for _ in range(m)]",
"+mod = 1000000007",
"+if n == 1:",
"-B = [\".\"] * (N + 1)",
"+B = [\".\"] * (n + ... | false | 0.043335 | 0.043346 | 0.99974 | [
"s478164558",
"s416497846"
] |
u313291636 | p03000 | python | s884325223 | s333580229 | 61 | 29 | 61,900 | 9,112 | Accepted | Accepted | 52.46 | n, x = list(map(int, input().split()))
l = list(map(int, input().split()))
bound = [0]
for i in range(n):
bound.append(bound[i] + l[i])
ans = 0
for j in range(n+1):
if bound[j] <= x:
ans += 1
print(ans)
| n, x = list(map(int, input().split()))
l = list(map(int, input().split()))
d = [0] * (n+1)
ans = 1
for i in range(1, n+1):
d[i] = d[i-1] + l[i-1]
if d[i] <= x:
ans += 1
print(ans)
| 12 | 11 | 226 | 202 | n, x = list(map(int, input().split()))
l = list(map(int, input().split()))
bound = [0]
for i in range(n):
bound.append(bound[i] + l[i])
ans = 0
for j in range(n + 1):
if bound[j] <= x:
ans += 1
print(ans)
| n, x = list(map(int, input().split()))
l = list(map(int, input().split()))
d = [0] * (n + 1)
ans = 1
for i in range(1, n + 1):
d[i] = d[i - 1] + l[i - 1]
if d[i] <= x:
ans += 1
print(ans)
| false | 8.333333 | [
"-bound = [0]",
"-for i in range(n):",
"- bound.append(bound[i] + l[i])",
"-ans = 0",
"-for j in range(n + 1):",
"- if bound[j] <= x:",
"+d = [0] * (n + 1)",
"+ans = 1",
"+for i in range(1, n + 1):",
"+ d[i] = d[i - 1] + l[i - 1]",
"+ if d[i] <= x:"
] | false | 0.03838 | 0.037219 | 1.031203 | [
"s884325223",
"s333580229"
] |
u072053884 | p02246 | python | s248305161 | s821769700 | 12,520 | 4,370 | 424,920 | 7,936 | Accepted | Accepted | 65.1 | # Manhattan Distance
distance = (
(),
(0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6),
(1, 0, 1, 2, 2, 1, 2, 3, 3, 2, 3, 4, 4, 3, 4, 5),
(2, 1, 0, 1, 3, 2, 1, 2, 4, 3, 2, 3, 5, 4, 3, 4),
(3, 2, 1, 0, 4, 3, 2, 1, 5, 4, 3, 2, 6, 5, 4, 3),
(1, 2, 3, 4, 0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5),
... | distance = (
(),
(0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6),
(1, 0, 1, 2, 2, 1, 2, 3, 3, 2, 3, 4, 4, 3, 4, 5),
(2, 1, 0, 1, 3, 2, 1, 2, 4, 3, 2, 3, 5, 4, 3, 4),
(3, 2, 1, 0, 4, 3, 2, 1, 5, 4, 3, 2, 6, 5, 4, 3),
(1, 2, 3, 4, 0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5),
(2, 1, 2, 3, 1, 0,... | 81 | 83 | 2,421 | 2,410 | # Manhattan Distance
distance = (
(),
(0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6),
(1, 0, 1, 2, 2, 1, 2, 3, 3, 2, 3, 4, 4, 3, 4, 5),
(2, 1, 0, 1, 3, 2, 1, 2, 4, 3, 2, 3, 5, 4, 3, 4),
(3, 2, 1, 0, 4, 3, 2, 1, 5, 4, 3, 2, 6, 5, 4, 3),
(1, 2, 3, 4, 0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5),
(2, ... | distance = (
(),
(0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6),
(1, 0, 1, 2, 2, 1, 2, 3, 3, 2, 3, 4, 4, 3, 4, 5),
(2, 1, 0, 1, 3, 2, 1, 2, 4, 3, 2, 3, 5, 4, 3, 4),
(3, 2, 1, 0, 4, 3, 2, 1, 5, 4, 3, 2, 6, 5, 4, 3),
(1, 2, 3, 4, 0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5),
(2, 1, 2, 3, 1, 0, 1, 2, ... | false | 2.409639 | [
"-# Manhattan Distance",
"-import sys",
"-import heapq",
"-# A* algorithm",
"-def solve():",
"- board = list(map(int, sys.stdin.read().split()))",
"- h_cost = get_distance(board)",
"- state = (h_cost, board)",
"- q = [state] # priority queue",
"- d = {tuple(board): True}",
"- ... | false | 0.103632 | 0.043582 | 2.377897 | [
"s248305161",
"s821769700"
] |
u606878291 | p03163 | python | s051295031 | s412755248 | 227 | 182 | 92,616 | 29,620 | Accepted | Accepted | 19.82 | import numpy as np
N, W = list(map(int, input().split(' ')))
items = [tuple(map(int, input().split(' '))) for _ in range(N)]
dp = np.zeros(shape=(N + 1, W + 1), dtype=int)
for i in range(N):
weight = items[i][0]
value = items[i][1]
dp[i + 1][:weight] = dp[i][:weight]
dp[i + 1][weight:] =... | import numpy as np
N, W = list(map(int, input().split(' ')))
items = [tuple(map(int, input().split(' '))) for _ in range(N)]
dp = np.zeros(shape=W + 1, dtype=np.int64)
for weight, value in items:
dp[weight:] = np.maximum(dp[weight:], dp[:-weight] + value)
print((dp[-1]))
| 15 | 10 | 386 | 280 | import numpy as np
N, W = list(map(int, input().split(" ")))
items = [tuple(map(int, input().split(" "))) for _ in range(N)]
dp = np.zeros(shape=(N + 1, W + 1), dtype=int)
for i in range(N):
weight = items[i][0]
value = items[i][1]
dp[i + 1][:weight] = dp[i][:weight]
dp[i + 1][weight:] = np.maximum(dp[... | import numpy as np
N, W = list(map(int, input().split(" ")))
items = [tuple(map(int, input().split(" "))) for _ in range(N)]
dp = np.zeros(shape=W + 1, dtype=np.int64)
for weight, value in items:
dp[weight:] = np.maximum(dp[weight:], dp[:-weight] + value)
print((dp[-1]))
| false | 33.333333 | [
"-dp = np.zeros(shape=(N + 1, W + 1), dtype=int)",
"-for i in range(N):",
"- weight = items[i][0]",
"- value = items[i][1]",
"- dp[i + 1][:weight] = dp[i][:weight]",
"- dp[i + 1][weight:] = np.maximum(dp[i][weight:], value + dp[i][:-weight])",
"-print((dp[N][W]))",
"+dp = np.zeros(shape=W ... | false | 0.253446 | 0.252911 | 1.002114 | [
"s051295031",
"s412755248"
] |
u816631826 | p03239 | python | s598687606 | s010226842 | 20 | 18 | 3,316 | 3,064 | Accepted | Accepted | 10 | a, b = list(map(int, input().split()))
menor_t, menor_c = 1000, 1000
index = 0
for i in range(a):
c, t = list(map(int, input().split()))
if t <= b:
if c < menor_c:
menor_c = c
index = i + 1
if index == 0:
print('TLE')
else:
print(menor_c) | fline = eval(input())
it, max_time = [int(n) for n in fline.split()]
cost_time = []
for i in range(it):
line = eval(input())
c, t = [int(n) for n in line.split()]
pair = (c, t)
cost_time.append(pair)
cost_time.sort(key=lambda x: x[1])
cost_time2 = []
for i in range(it):
tupl = cost_... | 13 | 24 | 282 | 515 | a, b = list(map(int, input().split()))
menor_t, menor_c = 1000, 1000
index = 0
for i in range(a):
c, t = list(map(int, input().split()))
if t <= b:
if c < menor_c:
menor_c = c
index = i + 1
if index == 0:
print("TLE")
else:
print(menor_c)
| fline = eval(input())
it, max_time = [int(n) for n in fline.split()]
cost_time = []
for i in range(it):
line = eval(input())
c, t = [int(n) for n in line.split()]
pair = (c, t)
cost_time.append(pair)
cost_time.sort(key=lambda x: x[1])
cost_time2 = []
for i in range(it):
tupl = cost_time[i]
if tu... | false | 45.833333 | [
"-a, b = list(map(int, input().split()))",
"-menor_t, menor_c = 1000, 1000",
"-index = 0",
"-for i in range(a):",
"- c, t = list(map(int, input().split()))",
"- if t <= b:",
"- if c < menor_c:",
"- menor_c = c",
"- index = i + 1",
"-if index == 0:",
"+fline = eval(... | false | 0.044798 | 0.045687 | 0.980529 | [
"s598687606",
"s010226842"
] |
u730769327 | p03281 | python | s994222868 | s455453505 | 164 | 63 | 38,256 | 63,504 | Accepted | Accepted | 61.59 | n=int(eval(input()))
a=[3,5,7,9,11,13,17,19]
count=0
for i in range(len(a)):
for j in range(i+1,len(a)):
for k in range(j+1,len(a)):
if a[i]*a[j]*a[k]<=n:
count+=1
print(count) | n=int(eval(input()))
ans=0
for i in range(1,n+1):
cnt=0
if i%2==0:continue
for j in range(1,i+1):
if i%j==0:cnt+=1
if cnt==8:
ans+=1
print(ans) | 11 | 10 | 202 | 162 | n = int(eval(input()))
a = [3, 5, 7, 9, 11, 13, 17, 19]
count = 0
for i in range(len(a)):
for j in range(i + 1, len(a)):
for k in range(j + 1, len(a)):
if a[i] * a[j] * a[k] <= n:
count += 1
print(count)
| n = int(eval(input()))
ans = 0
for i in range(1, n + 1):
cnt = 0
if i % 2 == 0:
continue
for j in range(1, i + 1):
if i % j == 0:
cnt += 1
if cnt == 8:
ans += 1
print(ans)
| false | 9.090909 | [
"-a = [3, 5, 7, 9, 11, 13, 17, 19]",
"-count = 0",
"-for i in range(len(a)):",
"- for j in range(i + 1, len(a)):",
"- for k in range(j + 1, len(a)):",
"- if a[i] * a[j] * a[k] <= n:",
"- count += 1",
"-print(count)",
"+ans = 0",
"+for i in range(1, n + 1):",
"... | false | 0.038771 | 0.063471 | 0.610844 | [
"s994222868",
"s455453505"
] |
u644907318 | p03733 | python | s751367899 | s331922142 | 268 | 107 | 85,328 | 103,836 | Accepted | Accepted | 60.07 | N,T = list(map(int,input().split()))
A = list(map(int,input().split()))
cnt = 0
cur = 0
for i in range(1,N):
b = A[i]
a = A[i-1]
if b-a<T:
cur += b-a
else:
cnt += cur+T
cur = 0
cnt += cur+T
print(cnt) | N,T = list(map(int,input().split()))
A = list(map(int,input().split()))
cnt = 0
cur = 0
for i in range(1,N):
if A[i]-A[i-1]>T:
cnt += A[i-1]-cur+T
cur = A[i]
cnt += A[N-1]+T-cur
print(cnt) | 14 | 10 | 247 | 211 | N, T = list(map(int, input().split()))
A = list(map(int, input().split()))
cnt = 0
cur = 0
for i in range(1, N):
b = A[i]
a = A[i - 1]
if b - a < T:
cur += b - a
else:
cnt += cur + T
cur = 0
cnt += cur + T
print(cnt)
| N, T = list(map(int, input().split()))
A = list(map(int, input().split()))
cnt = 0
cur = 0
for i in range(1, N):
if A[i] - A[i - 1] > T:
cnt += A[i - 1] - cur + T
cur = A[i]
cnt += A[N - 1] + T - cur
print(cnt)
| false | 28.571429 | [
"- b = A[i]",
"- a = A[i - 1]",
"- if b - a < T:",
"- cur += b - a",
"- else:",
"- cnt += cur + T",
"- cur = 0",
"-cnt += cur + T",
"+ if A[i] - A[i - 1] > T:",
"+ cnt += A[i - 1] - cur + T",
"+ cur = A[i]",
"+cnt += A[N - 1] + T - cur"
] | false | 0.107952 | 0.038027 | 2.838814 | [
"s751367899",
"s331922142"
] |
u367701763 | p03014 | python | s159844207 | s123206640 | 1,499 | 642 | 227,636 | 254,444 | Accepted | Accepted | 57.17 | def make_mat(grid, H, W):
res = [[0] * W for _ in range(H)]
for h in range(H):
cnt = 0
for w in range(W):
if (grid[h]>>w)&1 == 1:
for i in range(cnt):
res[h][w - 1 - i] = cnt
cnt = 0
else:
cnt +... | def make_mat(grid, H, W):
res = [[0] * W for _ in range(H)]
for h in range(H):
cnt = 0
for w in range(W):
if grid[h][w] == 1:
for i in range(cnt):
res[h][w - 1 - i] = cnt
cnt = 0
else:
cnt += 1
... | 45 | 48 | 953 | 1,043 | def make_mat(grid, H, W):
res = [[0] * W for _ in range(H)]
for h in range(H):
cnt = 0
for w in range(W):
if (grid[h] >> w) & 1 == 1:
for i in range(cnt):
res[h][w - 1 - i] = cnt
cnt = 0
else:
cnt += 1
... | def make_mat(grid, H, W):
res = [[0] * W for _ in range(H)]
for h in range(H):
cnt = 0
for w in range(W):
if grid[h][w] == 1:
for i in range(cnt):
res[h][w - 1 - i] = cnt
cnt = 0
else:
cnt += 1
if... | false | 6.25 | [
"- if (grid[h] >> w) & 1 == 1:",
"+ if grid[h][w] == 1:",
"- if (grid[h] >> w) & 1 == 0:",
"+ if grid[h][w] == 0:",
"-grid_t = [0] * W",
"+grid_t = [[] for _ in range(W)]",
"- temp = 0",
"+ temp = []",
"- temp += 1 << w",
"- grid_t[w]... | false | 0.073511 | 0.037895 | 1.939867 | [
"s159844207",
"s123206640"
] |
u853185302 | p03274 | python | s272336329 | s509842005 | 239 | 96 | 23,108 | 14,252 | Accepted | Accepted | 59.83 | import numpy as np
N,K = list(map(int,input().split()))
x = list(map(int,input().split()))
min_t = None
for i in range(N-K+1):
t = min(abs(x[i])+abs(x[i]-x[i+K-1]), abs(x[i+K-1])+abs(x[i]-x[i+K-1]))
if min_t == None:
min_t = t
if min_t > t:
min_t = t
print(min_t)
| n,k = list(map(int,input().split()))
x = list(map(int,input().split()))
INF = float("inf")
cost = INF
for i in range(len(x)-k+1):
l = x[i]
r = x[i+k-1]
tmp = min(abs(l)+abs(l-r),abs(r)+abs(r-l))
cost = min(cost,tmp)
print(cost)
| 14 | 10 | 290 | 239 | import numpy as np
N, K = list(map(int, input().split()))
x = list(map(int, input().split()))
min_t = None
for i in range(N - K + 1):
t = min(
abs(x[i]) + abs(x[i] - x[i + K - 1]),
abs(x[i + K - 1]) + abs(x[i] - x[i + K - 1]),
)
if min_t == None:
min_t = t
if min_t > t:
... | n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
INF = float("inf")
cost = INF
for i in range(len(x) - k + 1):
l = x[i]
r = x[i + k - 1]
tmp = min(abs(l) + abs(l - r), abs(r) + abs(r - l))
cost = min(cost, tmp)
print(cost)
| false | 28.571429 | [
"-import numpy as np",
"-",
"-N, K = list(map(int, input().split()))",
"+n, k = list(map(int, input().split()))",
"-min_t = None",
"-for i in range(N - K + 1):",
"- t = min(",
"- abs(x[i]) + abs(x[i] - x[i + K - 1]),",
"- abs(x[i + K - 1]) + abs(x[i] - x[i + K - 1]),",
"- )",
... | false | 0.092835 | 0.044734 | 2.075266 | [
"s272336329",
"s509842005"
] |
u046187684 | p03457 | python | s119524723 | s657157865 | 216 | 151 | 28,224 | 29,596 | Accepted | Accepted | 30.09 | def solve(string):
n, *txy = list(map(int, string.split()))
checks = [
abs(x) + abs(y) <= t and (t + x + y) % 2 == 0
for t, x, y in zip(txy[::3], txy[1::3], txy[2::3])
]
return "Yes" if all(checks) else "No"
if __name__ == '__main__':
n = int(eval(input()))
print((... | #!/usr/bin/env python3
# coding=utf-8
import sys
n = int(sys.stdin.readline().strip())
txy = [(0,0,0)]+[tuple(map(int, l.strip().split(" "))) for l in sys.stdin.readlines()]
check_txy = [abs(_x - _xp) + abs(_y - _yp) <= _t - _tp and (_t + _x + _y) % 2 == 0 for (_t, _x, _y), (_tp, _xp, _yp) in zip(txy[1:], tx... | 13 | 13 | 373 | 386 | def solve(string):
n, *txy = list(map(int, string.split()))
checks = [
abs(x) + abs(y) <= t and (t + x + y) % 2 == 0
for t, x, y in zip(txy[::3], txy[1::3], txy[2::3])
]
return "Yes" if all(checks) else "No"
if __name__ == "__main__":
n = int(eval(input()))
print((solve("{}\n".... | #!/usr/bin/env python3
# coding=utf-8
import sys
n = int(sys.stdin.readline().strip())
txy = [(0, 0, 0)] + [
tuple(map(int, l.strip().split(" "))) for l in sys.stdin.readlines()
]
check_txy = [
abs(_x - _xp) + abs(_y - _yp) <= _t - _tp and (_t + _x + _y) % 2 == 0
for (_t, _x, _y), (_tp, _xp, _yp) in zip(tx... | false | 0 | [
"-def solve(string):",
"- n, *txy = list(map(int, string.split()))",
"- checks = [",
"- abs(x) + abs(y) <= t and (t + x + y) % 2 == 0",
"- for t, x, y in zip(txy[::3], txy[1::3], txy[2::3])",
"- ]",
"- return \"Yes\" if all(checks) else \"No\"",
"+#!/usr/bin/env python3",
"... | false | 0.085421 | 0.044863 | 1.904035 | [
"s119524723",
"s657157865"
] |
u644907318 | p03712 | python | s177666544 | s478214273 | 168 | 64 | 38,384 | 62,088 | Accepted | Accepted | 61.9 | H,W = list(map(int,input().split()))
A = [input().strip() for _ in range(H)]
A.insert(0,"#"*(W+2))
for i in range(1,H+1):
A[i] = "#"+A[i]+"#"
A.append("#"*(W+2))
for i in range(H+2):
print((A[i])) | H,W = list(map(int,input().split()))
x = ["#"*(W+2)]
for _ in range(H):
a = input().strip()
a = "#"+a+"#"
x.append(a)
x.append("#"*(W+2))
for i in range(H+2):
print((x[i])) | 8 | 9 | 203 | 188 | H, W = list(map(int, input().split()))
A = [input().strip() for _ in range(H)]
A.insert(0, "#" * (W + 2))
for i in range(1, H + 1):
A[i] = "#" + A[i] + "#"
A.append("#" * (W + 2))
for i in range(H + 2):
print((A[i]))
| H, W = list(map(int, input().split()))
x = ["#" * (W + 2)]
for _ in range(H):
a = input().strip()
a = "#" + a + "#"
x.append(a)
x.append("#" * (W + 2))
for i in range(H + 2):
print((x[i]))
| false | 11.111111 | [
"-A = [input().strip() for _ in range(H)]",
"-A.insert(0, \"#\" * (W + 2))",
"-for i in range(1, H + 1):",
"- A[i] = \"#\" + A[i] + \"#\"",
"-A.append(\"#\" * (W + 2))",
"+x = [\"#\" * (W + 2)]",
"+for _ in range(H):",
"+ a = input().strip()",
"+ a = \"#\" + a + \"#\"",
"+ x.append(a)"... | false | 0.037994 | 0.037263 | 1.019626 | [
"s177666544",
"s478214273"
] |
u367130284 | p03721 | python | s413728679 | s572543154 | 673 | 464 | 57,560 | 29,912 | Accepted | Accepted | 31.05 | n,k=list(map(int,input().split()))
L=[]
for s in range(n):
a,b=list(map(int,input().split()))
L.append((a,b))
#print(L)
L=sorted(L,key=lambda x:x[0])
#print(L)
sun=0
for s in L:
sun+=s[1]
if sun+1>k:
print((s[0]))
exit() | n,k=list(map(int,input().split()))
for s,t in sorted([list(map(int,input().split()))for i in range(n)],key=lambda x:x[0]):
if k>t:
k-=t
else:
print(s)
exit()
| 14 | 8 | 235 | 195 | n, k = list(map(int, input().split()))
L = []
for s in range(n):
a, b = list(map(int, input().split()))
L.append((a, b))
# print(L)
L = sorted(L, key=lambda x: x[0])
# print(L)
sun = 0
for s in L:
sun += s[1]
if sun + 1 > k:
print((s[0]))
exit()
| n, k = list(map(int, input().split()))
for s, t in sorted(
[list(map(int, input().split())) for i in range(n)], key=lambda x: x[0]
):
if k > t:
k -= t
else:
print(s)
exit()
| false | 42.857143 | [
"-L = []",
"-for s in range(n):",
"- a, b = list(map(int, input().split()))",
"- L.append((a, b))",
"-# print(L)",
"-L = sorted(L, key=lambda x: x[0])",
"-# print(L)",
"-sun = 0",
"-for s in L:",
"- sun += s[1]",
"- if sun + 1 > k:",
"- print((s[0]))",
"+for s, t in sorted... | false | 0.045294 | 0.045051 | 1.005393 | [
"s413728679",
"s572543154"
] |
u021019433 | p03032 | python | s570342146 | s041913919 | 27 | 24 | 3,060 | 3,060 | Accepted | Accepted | 11.11 | R = lambda: list(map(int, input().split()))
n, k = R()
v = list(R())
a = sorted((x, i) for i, x in enumerate(v) if x < 0)
ans = max(sum(v[:i - j] + v[n - j:]) -
sum([x for x, m in a if m < i - j or m >= n - j][:k - i])
for i in range(1, min(n, k) + 1) for j in range(i))
print(ans)
| R = lambda: list(map(int, input().split()))
n, k = R()
v = list(R())
ans = max(sum(v[:i - j] + v[n - j:]) -
sum(sorted(x for x in v[:i - j] + v[n - j:] if x < 0)[: k - i])
for i in range(1, min(n, k) + 1) for j in range(i))
print(ans)
| 8 | 7 | 303 | 255 | R = lambda: list(map(int, input().split()))
n, k = R()
v = list(R())
a = sorted((x, i) for i, x in enumerate(v) if x < 0)
ans = max(
sum(v[: i - j] + v[n - j :])
- sum([x for x, m in a if m < i - j or m >= n - j][: k - i])
for i in range(1, min(n, k) + 1)
for j in range(i)
)
print(ans)
| R = lambda: list(map(int, input().split()))
n, k = R()
v = list(R())
ans = max(
sum(v[: i - j] + v[n - j :])
- sum(sorted(x for x in v[: i - j] + v[n - j :] if x < 0)[: k - i])
for i in range(1, min(n, k) + 1)
for j in range(i)
)
print(ans)
| false | 12.5 | [
"-a = sorted((x, i) for i, x in enumerate(v) if x < 0)",
"- - sum([x for x, m in a if m < i - j or m >= n - j][: k - i])",
"+ - sum(sorted(x for x in v[: i - j] + v[n - j :] if x < 0)[: k - i])"
] | false | 0.057039 | 0.045102 | 1.264656 | [
"s570342146",
"s041913919"
] |
u936985471 | p03854 | python | s383455888 | s373872699 | 60 | 37 | 3,432 | 3,188 | Accepted | Accepted | 38.33 | S=eval(input())
W=("dream","dreamer","erase","eraser")
s=[0]
while s:
i=s.pop()
if i==len(S):
print("YES")
break
for w in W:
if S[i:i+len(w)]==w:
s.append(i+len(w))
else:
print("NO") | S=input()[::-1]
W=("dream"[::-1],"dreamer"[::-1],"erase"[::-1],"eraser"[::-1])
ind=0
while ind<len(S):
for w in W:
if S[ind:ind+len(w)]==w:
ind+=len(w)
break
else:
print("NO")
break
else:
print("YES") | 13 | 13 | 214 | 242 | S = eval(input())
W = ("dream", "dreamer", "erase", "eraser")
s = [0]
while s:
i = s.pop()
if i == len(S):
print("YES")
break
for w in W:
if S[i : i + len(w)] == w:
s.append(i + len(w))
else:
print("NO")
| S = input()[::-1]
W = ("dream"[::-1], "dreamer"[::-1], "erase"[::-1], "eraser"[::-1])
ind = 0
while ind < len(S):
for w in W:
if S[ind : ind + len(w)] == w:
ind += len(w)
break
else:
print("NO")
break
else:
print("YES")
| false | 0 | [
"-S = eval(input())",
"-W = (\"dream\", \"dreamer\", \"erase\", \"eraser\")",
"-s = [0]",
"-while s:",
"- i = s.pop()",
"- if i == len(S):",
"- print(\"YES\")",
"+S = input()[::-1]",
"+W = (\"dream\"[::-1], \"dreamer\"[::-1], \"erase\"[::-1], \"eraser\"[::-1])",
"+ind = 0",
"+while ... | false | 0.056912 | 0.05605 | 1.015384 | [
"s383455888",
"s373872699"
] |
u297574184 | p02987 | python | s116770422 | s841410776 | 61 | 17 | 3,444 | 2,940 | Accepted | Accepted | 72.13 | from collections import Counter
Ss = eval(input())
num = len(set(Ss))
cnt = Counter(Ss)
if num == 2 and min(cnt.values()) == 2:
print('Yes')
else:
print('No')
| Ss = list(input().rstrip())
Ss.sort()
if Ss[0]==Ss[1] and Ss[1]!=Ss[2] and Ss[2]==Ss[3]:
print('Yes')
else:
print('No')
| 11 | 8 | 174 | 137 | from collections import Counter
Ss = eval(input())
num = len(set(Ss))
cnt = Counter(Ss)
if num == 2 and min(cnt.values()) == 2:
print("Yes")
else:
print("No")
| Ss = list(input().rstrip())
Ss.sort()
if Ss[0] == Ss[1] and Ss[1] != Ss[2] and Ss[2] == Ss[3]:
print("Yes")
else:
print("No")
| false | 27.272727 | [
"-from collections import Counter",
"-",
"-Ss = eval(input())",
"-num = len(set(Ss))",
"-cnt = Counter(Ss)",
"-if num == 2 and min(cnt.values()) == 2:",
"+Ss = list(input().rstrip())",
"+Ss.sort()",
"+if Ss[0] == Ss[1] and Ss[1] != Ss[2] and Ss[2] == Ss[3]:"
] | false | 0.007116 | 0.040227 | 0.176888 | [
"s116770422",
"s841410776"
] |
u729133443 | p03416 | python | s863598517 | s998837613 | 187 | 51 | 40,428 | 2,940 | Accepted | Accepted | 72.73 | a,b=list(map(int,input().split()));c=0
while a<=b:s=str(a);c+=s==s[::-1];a+=1
print(c) | a,b=list(map(int,input().split()));print((sum(s==s[::-1]for s in map(str,list(range(a,b+1)))))) | 3 | 1 | 82 | 81 | a, b = list(map(int, input().split()))
c = 0
while a <= b:
s = str(a)
c += s == s[::-1]
a += 1
print(c)
| a, b = list(map(int, input().split()))
print((sum(s == s[::-1] for s in map(str, list(range(a, b + 1))))))
| false | 66.666667 | [
"-c = 0",
"-while a <= b:",
"- s = str(a)",
"- c += s == s[::-1]",
"- a += 1",
"-print(c)",
"+print((sum(s == s[::-1] for s in map(str, list(range(a, b + 1))))))"
] | false | 0.04933 | 0.073251 | 0.673444 | [
"s863598517",
"s998837613"
] |
u380524497 | p03148 | python | s295346426 | s242091551 | 666 | 440 | 33,804 | 33,804 | Accepted | Accepted | 33.93 | from collections import defaultdict
import heapq
n, k = list(map(int, input().split()))
sushi = [list(map(int, input().split())) for _ in range(n)]
sushi.sort(key=lambda x: x[1])
kinds = defaultdict(int)
eaten = []
ans = 0
for i in range(k):
neta, point = sushi.pop()
kinds[neta] += 1
ans +=... | from collections import defaultdict
import heapq
import sys
input = sys.stdin.readline
n, k = list(map(int, input().split()))
sushi = [list(map(int, input().split())) for _ in range(n)]
sushi.sort(key=lambda x: x[1])
kinds = defaultdict(int)
eaten = []
ans = 0
for i in range(k):
neta, point = sushi... | 42 | 44 | 920 | 960 | from collections import defaultdict
import heapq
n, k = list(map(int, input().split()))
sushi = [list(map(int, input().split())) for _ in range(n)]
sushi.sort(key=lambda x: x[1])
kinds = defaultdict(int)
eaten = []
ans = 0
for i in range(k):
neta, point = sushi.pop()
kinds[neta] += 1
ans += point
heapq... | from collections import defaultdict
import heapq
import sys
input = sys.stdin.readline
n, k = list(map(int, input().split()))
sushi = [list(map(int, input().split())) for _ in range(n)]
sushi.sort(key=lambda x: x[1])
kinds = defaultdict(int)
eaten = []
ans = 0
for i in range(k):
neta, point = sushi.pop()
kinds... | false | 4.545455 | [
"+import sys",
"+input = sys.stdin.readline"
] | false | 0.038404 | 0.038582 | 0.995365 | [
"s295346426",
"s242091551"
] |
u909643606 | p03339 | python | s825742800 | s334745293 | 276 | 214 | 3,828 | 65,252 | Accepted | Accepted | 22.46 | n=int(eval(input()))
s=eval(input())
ss=s[::-1]
ans=10**7
front_bucket=[0,0]
back_bucket=[0,0]
for i in range(n):
if s[i]=="E":
front_bucket[0]+=1
else:
front_bucket[1]+=1
for i in range(n):
if ss[i]=="E":
front_bucket[0]-=1
ans=min(ans, front_bucket[1]+back_bucket[0])
back_... |
n=int(eval(input()))
s=eval(input())
E = [0 for i in range(n)]
W = [0 for i in range(n)]
for i in range(n):
if s[i] == "E":
E[i] = 1
else:
W[i] = 1
for i in range(n-1):
W[i+1] += W[i]
E[-i-2] += E[-i-1]
ans = float("inf")
for i in range(n):
if i == 0:
a... | 25 | 28 | 446 | 467 | n = int(eval(input()))
s = eval(input())
ss = s[::-1]
ans = 10**7
front_bucket = [0, 0]
back_bucket = [0, 0]
for i in range(n):
if s[i] == "E":
front_bucket[0] += 1
else:
front_bucket[1] += 1
for i in range(n):
if ss[i] == "E":
front_bucket[0] -= 1
ans = min(ans, front_bucket... | n = int(eval(input()))
s = eval(input())
E = [0 for i in range(n)]
W = [0 for i in range(n)]
for i in range(n):
if s[i] == "E":
E[i] = 1
else:
W[i] = 1
for i in range(n - 1):
W[i + 1] += W[i]
E[-i - 2] += E[-i - 1]
ans = float("inf")
for i in range(n):
if i == 0:
ans = min(an... | false | 10.714286 | [
"-ss = s[::-1]",
"-ans = 10**7",
"-front_bucket = [0, 0]",
"-back_bucket = [0, 0]",
"+E = [0 for i in range(n)]",
"+W = [0 for i in range(n)]",
"- front_bucket[0] += 1",
"+ E[i] = 1",
"- front_bucket[1] += 1",
"+ W[i] = 1",
"+for i in range(n - 1):",
"+ W[i + 1] ... | false | 0.039501 | 0.040219 | 0.982138 | [
"s825742800",
"s334745293"
] |
u287500079 | p02683 | python | s059774434 | s267925804 | 111 | 94 | 70,252 | 70,284 | Accepted | Accepted | 15.32 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd
from itertools import permutations, combinations, product, accumulate, combinations_with_replacement
from operator import itemgetter, mul
fr... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd
from itertools import permutations, combinations, product, accumulate, combinations_with_replacement
from operator import itemgetter, mul
fr... | 52 | 51 | 1,648 | 1,604 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
radians,
acos,
atan,
asin,
log,
log10,
gcd,
)
from itertools import (
permutations,
combinations,
product,
accumul... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
radians,
acos,
atan,
asin,
log,
log10,
gcd,
)
from itertools import (
permutations,
combinations,
product,
accumul... | false | 1.923077 | [
"-for i in range(1, n + 1):",
"- cmb = list(combinations(list(range(n)), i))",
"- for lst in cmb:",
"- tmp = [0 for _ in range(m)]",
"- cst = 0",
"- for idx in lst:",
"- cst += c[idx]",
"- for j in range(m):",
"- tmp[j] += a[idx][j]",
... | false | 0.120167 | 0.049403 | 2.43236 | [
"s059774434",
"s267925804"
] |
u493520238 | p03486 | python | s393445489 | s841755161 | 71 | 63 | 61,968 | 61,860 | Accepted | Accepted | 11.27 | s =eval(input())
t = eval(input())
s = sorted(s, key=str.lower)
t = sorted(t, key=str.lower, reverse=True)
s = ''.join(s)
t = ''.join(t)
l = [s,t]
l.sort()
if l[0] == s and s != t:
print('Yes')
else:
print('No') | s=eval(input())
t=eval(input())
s = sorted(s)
t = sorted(t, reverse=True)
if s < t:
print('Yes')
else:
print('No') | 12 | 8 | 218 | 117 | s = eval(input())
t = eval(input())
s = sorted(s, key=str.lower)
t = sorted(t, key=str.lower, reverse=True)
s = "".join(s)
t = "".join(t)
l = [s, t]
l.sort()
if l[0] == s and s != t:
print("Yes")
else:
print("No")
| s = eval(input())
t = eval(input())
s = sorted(s)
t = sorted(t, reverse=True)
if s < t:
print("Yes")
else:
print("No")
| false | 33.333333 | [
"-s = sorted(s, key=str.lower)",
"-t = sorted(t, key=str.lower, reverse=True)",
"-s = \"\".join(s)",
"-t = \"\".join(t)",
"-l = [s, t]",
"-l.sort()",
"-if l[0] == s and s != t:",
"+s = sorted(s)",
"+t = sorted(t, reverse=True)",
"+if s < t:"
] | false | 0.043546 | 0.042855 | 1.016122 | [
"s393445489",
"s841755161"
] |
u263830634 | p03329 | python | s440754070 | s428285053 | 670 | 580 | 3,828 | 3,828 | Accepted | Accepted | 13.43 | #DP 動的計画法
N = int(eval(input()))
INF = 10 ** 9
dp = [INF] * (N+1) #初期化配列
dp[0] = 0
for n in range(1, N+1):
power = 1
while power <= N:
dp[n] = min(dp[n], dp[n-power]+1)
power *= 6
power = 1
while power <= N:
dp[n] = min(dp[n], dp[n-power]+1)
power *= 9
... | N = int(eval(input()))
INF = 10 ** 9
dp = [INF] * (N + 1)
dp[0] = 0
for i in range(1, N + 1):
dp[i] = dp[i - 1] + 1
tmp = 6
while i - tmp >= 0:
dp[i] = min(dp[i], dp[i - tmp] + 1)
tmp *= 6
tmp = 9
while i - tmp >= 0:
dp[i] = min(dp[i], dp[i - tmp... | 20 | 22 | 343 | 369 | # DP 動的計画法
N = int(eval(input()))
INF = 10**9
dp = [INF] * (N + 1) # 初期化配列
dp[0] = 0
for n in range(1, N + 1):
power = 1
while power <= N:
dp[n] = min(dp[n], dp[n - power] + 1)
power *= 6
power = 1
while power <= N:
dp[n] = min(dp[n], dp[n - power] + 1)
power *= 9
# prin... | N = int(eval(input()))
INF = 10**9
dp = [INF] * (N + 1)
dp[0] = 0
for i in range(1, N + 1):
dp[i] = dp[i - 1] + 1
tmp = 6
while i - tmp >= 0:
dp[i] = min(dp[i], dp[i - tmp] + 1)
tmp *= 6
tmp = 9
while i - tmp >= 0:
dp[i] = min(dp[i], dp[i - tmp] + 1)
tmp *= 9
# print ... | false | 9.090909 | [
"-# DP 動的計画法",
"-dp = [INF] * (N + 1) # 初期化配列",
"+dp = [INF] * (N + 1)",
"-for n in range(1, N + 1):",
"- power = 1",
"- while power <= N:",
"- dp[n] = min(dp[n], dp[n - power] + 1)",
"- power *= 6",
"- power = 1",
"- while power <= N:",
"- dp[n] = min(dp[n], dp... | false | 0.109041 | 0.096724 | 1.127344 | [
"s440754070",
"s428285053"
] |
u930705402 | p02599 | python | s366308648 | s915715107 | 1,724 | 799 | 231,808 | 184,796 | Accepted | Accepted | 53.65 | import sys
read=sys.stdin.buffer.readline
class BIT:
def __init__(self,N):
self.N=N
self.bit=[0]*N
def add(self,a,w):
x=a
while(x<self.N):
self.bit[x]+=w
x|=x+1
def get(self,a):
ret,x=0,a-1
while(x>=0):
ret+=... | import sys
read=sys.stdin.buffer.readline
class BIT:
def __init__(self,N):
self.N=N
self.bit=[0]*N
def add(self,a,w):
x=a
while(x<self.N):
self.bit[x]+=w
x|=x+1
def get(self,a):
ret,x=0,a-1
while(x>=0):
ret+=... | 50 | 54 | 1,003 | 1,055 | import sys
read = sys.stdin.buffer.readline
class BIT:
def __init__(self, N):
self.N = N
self.bit = [0] * N
def add(self, a, w):
x = a
while x < self.N:
self.bit[x] += w
x |= x + 1
def get(self, a):
ret, x = 0, a - 1
while x >= 0:
... | import sys
read = sys.stdin.buffer.readline
class BIT:
def __init__(self, N):
self.N = N
self.bit = [0] * N
def add(self, a, w):
x = a
while x < self.N:
self.bit[x] += w
x |= x + 1
def get(self, a):
ret, x = 0, a - 1
while x >= 0:
... | false | 7.407407 | [
"- Query.append((l, r, i))",
"-Query.sort(key=lambda x: x[1])",
"+ Query.append(r * 10**12 + l * 10**6 + i)",
"+Query.sort()",
"-for L, R, w in Query:",
"+for w in Query:",
"+ R = w // 10**12",
"+ w %= 10**12",
"+ L = w // 10**6",
"+ w %= 10**6"
] | false | 0.043505 | 0.037544 | 1.158779 | [
"s366308648",
"s915715107"
] |
u281303342 | p03829 | python | s826471081 | s032049000 | 105 | 86 | 14,172 | 14,172 | Accepted | Accepted | 18.1 | # python3 (3.4.3)
import sys
input = sys.stdin.readline
# main
N,A,B = list(map(int,input().split()))
X = list(map(int,input().split()))
ans = 0
for i in range(N-1):
ans += min(B, A*(X[i+1]-X[i]))
print(ans) | # Python3 (3.4.3)
import sys
input = sys.stdin.readline
# -------------------------------------------------------------
# function
# -------------------------------------------------------------
# -------------------------------------------------------------
# main
# --------------------------------------... | 13 | 24 | 220 | 549 | # python3 (3.4.3)
import sys
input = sys.stdin.readline
# main
N, A, B = list(map(int, input().split()))
X = list(map(int, input().split()))
ans = 0
for i in range(N - 1):
ans += min(B, A * (X[i + 1] - X[i]))
print(ans)
| # Python3 (3.4.3)
import sys
input = sys.stdin.readline
# -------------------------------------------------------------
# function
# -------------------------------------------------------------
# -------------------------------------------------------------
# main
# ---------------------------------------------------... | false | 45.833333 | [
"-# python3 (3.4.3)",
"+# Python3 (3.4.3)",
"+# function",
"- ans += min(B, A * (X[i + 1] - X[i]))",
"+ d = X[i + 1] - X[i]",
"+ if d * A > B:",
"+ ans += B",
"+ else:",
"+ ans += d * A"
] | false | 0.048411 | 0.04952 | 0.977592 | [
"s826471081",
"s032049000"
] |
u592547545 | p02761 | python | s760128511 | s530605723 | 29 | 26 | 9,244 | 9,300 | Accepted | Accepted | 10.34 | def readinput():
n,m=list(map(int,input().split()))
sc=[]
for _ in range(m):
s,c=list(map(int,input().split()))
sc.append((s,c))
return n,m,sc
def main(n,m,sc):
ans=[-1]*n
for s,c in sc:
if ans[s-1]==-1:
ans[s-1]=c
else:
if a... | def readinput():
n,m=list(map(int,input().split()))
sc=[]
for _ in range(m):
s,c=list(map(int,input().split()))
sc.append((s,c))
return n,m,sc
def main(n,m,sc):
ans=[-1]*n
for s,c in sc:
if ans[s-1]==-1:
ans[s-1]=c
else:
if a... | 39 | 58 | 794 | 1,191 | def readinput():
n, m = list(map(int, input().split()))
sc = []
for _ in range(m):
s, c = list(map(int, input().split()))
sc.append((s, c))
return n, m, sc
def main(n, m, sc):
ans = [-1] * n
for s, c in sc:
if ans[s - 1] == -1:
ans[s - 1] = c
else:
... | def readinput():
n, m = list(map(int, input().split()))
sc = []
for _ in range(m):
s, c = list(map(int, input().split()))
sc.append((s, c))
return n, m, sc
def main(n, m, sc):
ans = [-1] * n
for s, c in sc:
if ans[s - 1] == -1:
ans[s - 1] = c
else:
... | false | 32.758621 | [
"+def main2(n, m, sc):",
"+ cands = [x for x in range(10**n)]",
"+ for cand in cands:",
"+ cc = str(cand)",
"+ if len(cc) != n:",
"+ continue",
"+ i = 0",
"+ # print(cc)",
"+ while i < m:",
"+ # print(sc[i])",
"+ s, c = sc... | false | 0.039177 | 0.039436 | 0.993444 | [
"s760128511",
"s530605723"
] |
u934442292 | p02936 | python | s254935316 | s443211760 | 1,406 | 887 | 232,212 | 54,516 | Accepted | Accepted | 36.91 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
def dfs(G, v, p, point):
"""G: graph, v: vertex, p: parent"""
# Loop for each child
for c in G[v]:
if c == p:
continue
point[c] += point[v]
dfs(G, c, v, point)
def main():
N, Q ... | import sys
input = sys.stdin.readline # NOQA
sys.setrecursionlimit(10 ** 7) # NOQA
from collections import deque
def dfs(G, v, p, counter):
"""G: graph, v: vertex, p: parent"""
parent = [-1] * len(G)
stack = deque([v])
while stack:
v = stack.pop()
for c in G[v]:
... | 38 | 43 | 768 | 929 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
def dfs(G, v, p, point):
"""G: graph, v: vertex, p: parent"""
# Loop for each child
for c in G[v]:
if c == p:
continue
point[c] += point[v]
dfs(G, c, v, point)
def main():
N, Q = list(map(int, inp... | import sys
input = sys.stdin.readline # NOQA
sys.setrecursionlimit(10**7) # NOQA
from collections import deque
def dfs(G, v, p, counter):
"""G: graph, v: vertex, p: parent"""
parent = [-1] * len(G)
stack = deque([v])
while stack:
v = stack.pop()
for c in G[v]:
if c == pa... | false | 11.627907 | [
"-input = sys.stdin.readline",
"-sys.setrecursionlimit(10**7)",
"+input = sys.stdin.readline # NOQA",
"+sys.setrecursionlimit(10**7) # NOQA",
"+from collections import deque",
"-def dfs(G, v, p, point):",
"+def dfs(G, v, p, counter):",
"- # Loop for each child",
"- for c in G[v]:",
"- ... | false | 0.035203 | 0.036988 | 0.951738 | [
"s254935316",
"s443211760"
] |
u811967730 | p02971 | python | s995282187 | s397179466 | 392 | 339 | 14,204 | 14,092 | Accepted | Accepted | 13.52 | import sys
input = sys.stdin.readline
n = int(eval(input()))
nums = [None] * n
for i in range(n):
nums[i] = int(eval(input()))
sorted_nums = sorted(nums)
for i in range(n):
max_val = sorted_nums[n - 1]
if nums[i] == max_val:
max_val = sorted_nums[n - 2]
print(max_val)
| import sys
input = sys.stdin.readline
n = int(eval(input()))
nums = [None] * n
for i in range(n):
nums[i] = int(eval(input()))
sorted_nums = sorted(nums)
for num in nums:
max_val = sorted_nums[n - 1]
if num == max_val:
max_val = sorted_nums[n - 2]
print(max_val)
| 15 | 15 | 298 | 292 | import sys
input = sys.stdin.readline
n = int(eval(input()))
nums = [None] * n
for i in range(n):
nums[i] = int(eval(input()))
sorted_nums = sorted(nums)
for i in range(n):
max_val = sorted_nums[n - 1]
if nums[i] == max_val:
max_val = sorted_nums[n - 2]
print(max_val)
| import sys
input = sys.stdin.readline
n = int(eval(input()))
nums = [None] * n
for i in range(n):
nums[i] = int(eval(input()))
sorted_nums = sorted(nums)
for num in nums:
max_val = sorted_nums[n - 1]
if num == max_val:
max_val = sorted_nums[n - 2]
print(max_val)
| false | 0 | [
"-for i in range(n):",
"+for num in nums:",
"- if nums[i] == max_val:",
"+ if num == max_val:"
] | false | 0.035635 | 0.04358 | 0.8177 | [
"s995282187",
"s397179466"
] |
u729133443 | p02904 | python | s330084945 | s561210699 | 1,805 | 736 | 28,896 | 120,892 | Accepted | Accepted | 59.22 | class SWAG():
def __init__(self,unit,f):
self.fold_r=[unit]
self.fold_l=[unit]
self.data_r=[]
self.data_l=[]
self.f=f
def __refill_right(self):
temp=[]
n=len(self.data_l)
for _ in range(n//2):
temp.append(self.popleft())
... | class SWAG():
def __init__(self,unit,f):
self.fold_r=[unit]
self.fold_l=[unit]
self.data_r=[]
self.data_l=[]
self.f=f
def __refill_right(self):
temp=[]
n=len(self.data_l)
*_,=list(map(temp.append,(self.popleft()for _ in range(n//2))))
... | 60 | 54 | 1,812 | 1,738 | class SWAG:
def __init__(self, unit, f):
self.fold_r = [unit]
self.fold_l = [unit]
self.data_r = []
self.data_l = []
self.f = f
def __refill_right(self):
temp = []
n = len(self.data_l)
for _ in range(n // 2):
temp.append(self.popleft()... | class SWAG:
def __init__(self, unit, f):
self.fold_r = [unit]
self.fold_l = [unit]
self.data_r = []
self.data_l = []
self.f = f
def __refill_right(self):
temp = []
n = len(self.data_l)
(*_,) = list(map(temp.append, (self.popleft() for _ in range(n... | false | 10 | [
"- for _ in range(n // 2):",
"- temp.append(self.popleft())",
"- for _ in range(n // 2, n):",
"- self.append(self.popleft())",
"- for _ in range(n // 2):",
"- self.appendleft(temp.pop())",
"+ (*_,) = list(map(temp.append, (self.popleft() for _... | false | 0.043671 | 0.044489 | 0.9816 | [
"s330084945",
"s561210699"
] |
u077291787 | p02913 | python | s509912036 | s605360236 | 108 | 83 | 76,212 | 11,208 | Accepted | Accepted | 23.15 | from typing import List, Tuple
class RollingHash:
"""Rolling Hash"""
__slots__ = ["_base", "_mod", "_hash", "_power"]
def __init__(self, source: str, base: int = 1007, mod: int = 10 ** 9 + 7):
self._base = base
self._mod = mod
self._hash, self._power = self._build(sour... | from typing import List, Tuple
class RollingHash:
"""Rolling Hash"""
__slots__ = ["_base", "_mod", "_hash", "_power"]
def __init__(self, source: str, base: int = 1007, mod: int = 10 ** 9 + 7):
self._base = base
self._mod = mod
self._hash, self._power = self._build(sour... | 56 | 55 | 1,743 | 1,723 | from typing import List, Tuple
class RollingHash:
"""Rolling Hash"""
__slots__ = ["_base", "_mod", "_hash", "_power"]
def __init__(self, source: str, base: int = 1007, mod: int = 10**9 + 7):
self._base = base
self._mod = mod
self._hash, self._power = self._build(source)
def ... | from typing import List, Tuple
class RollingHash:
"""Rolling Hash"""
__slots__ = ["_base", "_mod", "_hash", "_power"]
def __init__(self, source: str, base: int = 1007, mod: int = 10**9 + 7):
self._base = base
self._mod = mod
self._hash, self._power = self._build(source)
def ... | false | 1.785714 | [
"- length = len(source)",
"- hash_, power = [0] * (length + 1), [0] * (length + 1)",
"+ hash_, power = [0] * (len(source) + 1), [0] * (len(source) + 1)"
] | false | 0.089157 | 0.081822 | 1.089645 | [
"s509912036",
"s605360236"
] |
u608088992 | p02861 | python | s129430528 | s726833218 | 375 | 330 | 3,064 | 3,064 | Accepted | Accepted | 12 | import sys
from itertools import permutations
from math import sqrt
def solve():
input = sys.stdin.readline
N = int(eval(input()))
coordinate = dict()
for i in range(N):
coordinate[i] = tuple(map(int, input().split()))
total_length = 0
perm_count = 0
for p in permutati... | import sys
from itertools import permutations
from math import sqrt
def solve():
input = sys.stdin.readline
N = int(eval(input()))
C = [[int(i) for i in input().split()] for _ in range(N)]
totalDist = 0
count =0
for order in permutations(list(range(N))):
count += 1
... | 27 | 24 | 711 | 591 | import sys
from itertools import permutations
from math import sqrt
def solve():
input = sys.stdin.readline
N = int(eval(input()))
coordinate = dict()
for i in range(N):
coordinate[i] = tuple(map(int, input().split()))
total_length = 0
perm_count = 0
for p in permutations(list(rang... | import sys
from itertools import permutations
from math import sqrt
def solve():
input = sys.stdin.readline
N = int(eval(input()))
C = [[int(i) for i in input().split()] for _ in range(N)]
totalDist = 0
count = 0
for order in permutations(list(range(N))):
count += 1
dist = 0
... | false | 11.111111 | [
"- coordinate = dict()",
"- for i in range(N):",
"- coordinate[i] = tuple(map(int, input().split()))",
"- total_length = 0",
"- perm_count = 0",
"- for p in permutations(list(range(N))):",
"- perm_count += 1",
"- current_id = coordinate[int(p[0])]",
"- for ... | false | 0.039814 | 0.034148 | 1.16592 | [
"s129430528",
"s726833218"
] |
u909643606 | p03716 | python | s777672817 | s090431689 | 543 | 501 | 38,292 | 38,288 | Accepted | Accepted | 7.73 | import heapq
n = int(eval(input()))
a = [int(i) for i in input().split()]
k = 0
a_front = []
a_center = []
a_back = []
front_sum = 0
back_sum = 0
for i in a:
k += 1
if k <= n:
a_front += [i]
front_sum += i
elif k <= 2 * n:
a_center += [i]
else:
a_back +... | import heapq
def calc(front_sum, back_sum):
heapq.heapify(a_front)
heapq.heapify(a_back)
front_sums = [front_sum]
back_sums = [back_sum]
for i in range(n):
front_sum += a_center[i] - heapq.heappushpop(a_front, a_center[i])
front_sums += [front_sum]
back_sum += a_ce... | 35 | 39 | 792 | 963 | import heapq
n = int(eval(input()))
a = [int(i) for i in input().split()]
k = 0
a_front = []
a_center = []
a_back = []
front_sum = 0
back_sum = 0
for i in a:
k += 1
if k <= n:
a_front += [i]
front_sum += i
elif k <= 2 * n:
a_center += [i]
else:
a_back += [-i]
bac... | import heapq
def calc(front_sum, back_sum):
heapq.heapify(a_front)
heapq.heapify(a_back)
front_sums = [front_sum]
back_sums = [back_sum]
for i in range(n):
front_sum += a_center[i] - heapq.heappushpop(a_front, a_center[i])
front_sums += [front_sum]
back_sum += a_center[-i -... | false | 10.25641 | [
"-n = int(eval(input()))",
"-a = [int(i) for i in input().split()]",
"-k = 0",
"-a_front = []",
"-a_center = []",
"-a_back = []",
"-front_sum = 0",
"-back_sum = 0",
"-for i in a:",
"- k += 1",
"- if k <= n:",
"- a_front += [i]",
"- front_sum += i",
"- elif k <= 2 * n... | false | 0.049052 | 0.040747 | 1.203818 | [
"s777672817",
"s090431689"
] |
u987164499 | p03352 | python | s998520805 | s606963513 | 288 | 22 | 18,532 | 2,940 | Accepted | Accepted | 92.36 | from sys import stdin
import bisect
from itertools import accumulate
import numpy as np
n = int(stdin.readline().rstrip())
li = [1]
for i in range(2,34):
for s in range(2,10):
if i**s <= 1000:
li.append(i**s)
else:
break
li = list(set(li))
li.sort()... | x = int(eval(input()))
ma = 0
for i in range(1,100):
for j in range(2,100):
if i**j <= x:
ma = max(ma,i**j)
print(ma) | 21 | 7 | 356 | 141 | from sys import stdin
import bisect
from itertools import accumulate
import numpy as np
n = int(stdin.readline().rstrip())
li = [1]
for i in range(2, 34):
for s in range(2, 10):
if i**s <= 1000:
li.append(i**s)
else:
break
li = list(set(li))
li.sort()
print((li[bisect.bisect... | x = int(eval(input()))
ma = 0
for i in range(1, 100):
for j in range(2, 100):
if i**j <= x:
ma = max(ma, i**j)
print(ma)
| false | 66.666667 | [
"-from sys import stdin",
"-import bisect",
"-from itertools import accumulate",
"-import numpy as np",
"-",
"-n = int(stdin.readline().rstrip())",
"-li = [1]",
"-for i in range(2, 34):",
"- for s in range(2, 10):",
"- if i**s <= 1000:",
"- li.append(i**s)",
"- else... | false | 0.060076 | 0.054311 | 1.106147 | [
"s998520805",
"s606963513"
] |
u507116804 | p03609 | python | s251900635 | s174110353 | 21 | 18 | 3,060 | 2,940 | Accepted | Accepted | 14.29 | x,t=list(map(int, input().split()))
if x-t>0:
print((int(x-t)))
else:
print((int(0))) | x,t=list(map(int, input().split()))
A=x-t
if A>=0:
print(A)
else:
print((0)) | 6 | 8 | 85 | 81 | x, t = list(map(int, input().split()))
if x - t > 0:
print((int(x - t)))
else:
print((int(0)))
| x, t = list(map(int, input().split()))
A = x - t
if A >= 0:
print(A)
else:
print((0))
| false | 25 | [
"-if x - t > 0:",
"- print((int(x - t)))",
"+A = x - t",
"+if A >= 0:",
"+ print(A)",
"- print((int(0)))",
"+ print((0))"
] | false | 0.035939 | 0.034757 | 1.033985 | [
"s251900635",
"s174110353"
] |
u831244171 | p02255 | python | s600882488 | s423637954 | 30 | 20 | 5,976 | 5,604 | Accepted | Accepted | 33.33 | n = int(input())
lst = list(map(int,input().split()))
def pri(lst):
for i in range(len(lst)-1):
print(lst[i],end=" ")
print(lst[-1])
pri(lst)
for i in range(1,n):
v = lst[i]
j = i-1
while True:
if j < 0:
lst[0] = v
break
if lst[j] > v... | def insertsort(array):
for i in range(1,len(array)):
print((" ".join(list(map(str,array)))))
temp = array[i]
j = i-1
while j >= 0 and temp < array[j]:
array[j+1] = array[j]
j -= 1
array[j+1] = temp
return array
eval(input())
a = insert... | 24 | 15 | 449 | 386 | n = int(input())
lst = list(map(int, input().split()))
def pri(lst):
for i in range(len(lst) - 1):
print(lst[i], end=" ")
print(lst[-1])
pri(lst)
for i in range(1, n):
v = lst[i]
j = i - 1
while True:
if j < 0:
lst[0] = v
break
if lst[j] > v:
... | def insertsort(array):
for i in range(1, len(array)):
print((" ".join(list(map(str, array)))))
temp = array[i]
j = i - 1
while j >= 0 and temp < array[j]:
array[j + 1] = array[j]
j -= 1
array[j + 1] = temp
return array
eval(input())
a = insertsor... | false | 37.5 | [
"-n = int(input())",
"-lst = list(map(int, input().split()))",
"+def insertsort(array):",
"+ for i in range(1, len(array)):",
"+ print((\" \".join(list(map(str, array)))))",
"+ temp = array[i]",
"+ j = i - 1",
"+ while j >= 0 and temp < array[j]:",
"+ array[... | false | 0.039082 | 0.078754 | 0.496259 | [
"s600882488",
"s423637954"
] |
u987164499 | p03574 | python | s695652480 | s668421136 | 153 | 33 | 12,264 | 3,188 | Accepted | Accepted | 78.43 | from sys import stdin
import math
import bisect
import heapq
import numpy as np
from math import factorial
inf = 10**10
h,w = [int(x) for x in stdin.readline().rstrip().split()]
li = [["." for i in range(w+2)]for j in range(h+2)]
for i in range(1,h+1):
s = stdin.readline().rstrip()
for j in range... | from sys import stdin,setrecursionlimit
setrecursionlimit(10 ** 7)
h,w = list(map(int,stdin.readline().rstrip().split()))
s = [stdin.readline().rstrip() for _ in range(h)]
li = [[0 for i in range(w)]for j in range(h)]
x = [-1,0,1]
y = [-1,0,1]
for i in range(h):
for j in range(w):
count = 0... | 45 | 30 | 1,169 | 786 | from sys import stdin
import math
import bisect
import heapq
import numpy as np
from math import factorial
inf = 10**10
h, w = [int(x) for x in stdin.readline().rstrip().split()]
li = [["." for i in range(w + 2)] for j in range(h + 2)]
for i in range(1, h + 1):
s = stdin.readline().rstrip()
for j in range(1, w... | from sys import stdin, setrecursionlimit
setrecursionlimit(10**7)
h, w = list(map(int, stdin.readline().rstrip().split()))
s = [stdin.readline().rstrip() for _ in range(h)]
li = [[0 for i in range(w)] for j in range(h)]
x = [-1, 0, 1]
y = [-1, 0, 1]
for i in range(h):
for j in range(w):
count = 0
f... | false | 33.333333 | [
"-from sys import stdin",
"-import math",
"-import bisect",
"-import heapq",
"-import numpy as np",
"-from math import factorial",
"+from sys import stdin, setrecursionlimit",
"-inf = 10**10",
"-h, w = [int(x) for x in stdin.readline().rstrip().split()]",
"-li = [[\".\" for i in range(w + 2)] for ... | false | 0.04071 | 0.066684 | 0.610497 | [
"s695652480",
"s668421136"
] |
u496744988 | p03487 | python | s578663801 | s963769344 | 111 | 87 | 21,224 | 18,672 | Accepted | Accepted | 21.62 | from collections import Counter
def MI(): return list(map(int, input().split()))
def II(): return int(eval(input()))
def IS(): return eval(input())
def LI(): return list(map(int, input().split()))
n = II()
l = list(Counter(LI()).items())
ans = 0
for num in l:
if num[0] < num[1]:
ans += num[1]-... | from collections import Counter
n=int(eval(input()))
ans=0
for i in list(Counter(list(map(int,input().split()))).items()):
if i[0]<i[1]:
ans+=i[1]-i[0]
elif i[0]>i[1]:
ans+=i[1]
print(ans) | 18 | 9 | 416 | 208 | from collections import Counter
def MI():
return list(map(int, input().split()))
def II():
return int(eval(input()))
def IS():
return eval(input())
def LI():
return list(map(int, input().split()))
n = II()
l = list(Counter(LI()).items())
ans = 0
for num in l:
if num[0] < num[1]:
an... | from collections import Counter
n = int(eval(input()))
ans = 0
for i in list(Counter(list(map(int, input().split()))).items()):
if i[0] < i[1]:
ans += i[1] - i[0]
elif i[0] > i[1]:
ans += i[1]
print(ans)
| false | 50 | [
"-",
"-def MI():",
"- return list(map(int, input().split()))",
"-",
"-",
"-def II():",
"- return int(eval(input()))",
"-",
"-",
"-def IS():",
"- return eval(input())",
"-",
"-",
"-def LI():",
"- return list(map(int, input().split()))",
"-",
"-",
"-n = II()",
"-l = lis... | false | 0.126231 | 0.044637 | 2.827954 | [
"s578663801",
"s963769344"
] |
u037430802 | p03253 | python | s866685188 | s808175288 | 1,708 | 22 | 4,400 | 3,316 | Accepted | Accepted | 98.71 | import math
def getPrimeFactorsDict(num):
pn = 2 #素数は2から
pfdict = {} #素因数のリスト
while pn * pn <= num: #√numまで調べる
while num % pn == 0: #現在の素数で割り切れる範囲でループ
num = num / pn
pfdict[pn] = pfdict.get(pn, 0) + 1
pn += 1 #割り切れなくなったら次の素数へ
if num > 1:
pfdict[int(num)] = pfdict.get(int(num)... | from collections import defaultdict
N,M = list(map(int, input().split()))
MOD = 10**9+7
# 素因数分解
d = defaultdict(int)
i = 2
while i*i <= M:
if M % i == 0:
d[i] += 1
M //= i
else:
i += 1
if M > 1:
d[M] += 1
# 素因数をN個に分配する方法
def nCr(n,r):
if n < 0 or r < 0 or n < ... | 30 | 59 | 616 | 1,392 | import math
def getPrimeFactorsDict(num):
pn = 2 # 素数は2から
pfdict = {} # 素因数のリスト
while pn * pn <= num: # √numまで調べる
while num % pn == 0: # 現在の素数で割り切れる範囲でループ
num = num / pn
pfdict[pn] = pfdict.get(pn, 0) + 1
pn += 1 # 割り切れなくなったら次の素数へ
if num > 1:
pfdict... | from collections import defaultdict
N, M = list(map(int, input().split()))
MOD = 10**9 + 7
# 素因数分解
d = defaultdict(int)
i = 2
while i * i <= M:
if M % i == 0:
d[i] += 1
M //= i
else:
i += 1
if M > 1:
d[M] += 1
# 素因数をN個に分配する方法
def nCr(n, r):
if n < 0 or r < 0 or n < r:
re... | false | 49.152542 | [
"-import math",
"+from collections import defaultdict",
"+",
"+N, M = list(map(int, input().split()))",
"+MOD = 10**9 + 7",
"+# 素因数分解",
"+d = defaultdict(int)",
"+i = 2",
"+while i * i <= M:",
"+ if M % i == 0:",
"+ d[i] += 1",
"+ M //= i",
"+ else:",
"+ i += 1",... | false | 0.319679 | 0.049415 | 6.469268 | [
"s866685188",
"s808175288"
] |
u203383537 | p02732 | python | s300609572 | s163932468 | 475 | 282 | 26,772 | 33,988 | Accepted | Accepted | 40.63 | import collections
n=int(eval(input()))
A=list(map(int,input().split()))
a=collections.Counter(A)
total=0
for v in list(a.values()):
if v>1:
c=(v*(v-1))//2
total+=c
for i in A:
ans=total-(a[i]*(a[i]-1))//2+((a[i]-1)*(a[i]-2))//2
print(ans) | from collections import Counter
n = int(eval(input()))
a = list(map(int,input().split()))
A = Counter(a)
cnt = 0
for i in list(A.values()):
if i > 1:
cnt += (i*(i-1)//2)
for i in a:
ans = 0
before = (A[i]*(A[i]-1))//2
after = ((A[i]-1)*(A[i]-2))//2
ans = cnt... | 16 | 21 | 274 | 341 | import collections
n = int(eval(input()))
A = list(map(int, input().split()))
a = collections.Counter(A)
total = 0
for v in list(a.values()):
if v > 1:
c = (v * (v - 1)) // 2
total += c
for i in A:
ans = total - (a[i] * (a[i] - 1)) // 2 + ((a[i] - 1) * (a[i] - 2)) // 2
print(ans)
| from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
A = Counter(a)
cnt = 0
for i in list(A.values()):
if i > 1:
cnt += i * (i - 1) // 2
for i in a:
ans = 0
before = (A[i] * (A[i] - 1)) // 2
after = ((A[i] - 1) * (A[i] - 2)) // 2
ans = cnt - before + af... | false | 23.809524 | [
"-import collections",
"+from collections import Counter",
"-A = list(map(int, input().split()))",
"-a = collections.Counter(A)",
"-total = 0",
"-for v in list(a.values()):",
"- if v > 1:",
"- c = (v * (v - 1)) // 2",
"- total += c",
"-for i in A:",
"- ans = total - (a[i] * (... | false | 0.036291 | 0.036907 | 0.98331 | [
"s300609572",
"s163932468"
] |
u021019433 | p02975 | python | s201198322 | s197239541 | 76 | 62 | 14,212 | 14,212 | Accepted | Accepted | 18.42 | R = lambda: list(map(int, input().split()))
n = int(eval(input()))
if n % 3:
ans = 'YNeos'[any(R())::2]
else:
a = sorted(R())
m = n // 3
if a[0] ^ a[m] ^ a[2 * m]:
ans = 'No'
elif any(a[i] != a[i - 1] for i in range(1, n) if m != i != 2 * m):
ans = 'No'
else:
... | R = lambda: list(map(int, input().split()))
n = int(eval(input()))
if n % 3:
ans = 'YNeos'[any(R())::2]
else:
a = sorted(R())
m = n // 3
if a[0] ^ a[m] ^ a[2 * m]:
ans = 'No'
elif any(len(set(a[i:i + m])) > 1 for i in range(0, n, m)):
ans = 'No'
else:
ans =... | 15 | 15 | 335 | 326 | R = lambda: list(map(int, input().split()))
n = int(eval(input()))
if n % 3:
ans = "YNeos"[any(R()) :: 2]
else:
a = sorted(R())
m = n // 3
if a[0] ^ a[m] ^ a[2 * m]:
ans = "No"
elif any(a[i] != a[i - 1] for i in range(1, n) if m != i != 2 * m):
ans = "No"
else:
ans = "Yes... | R = lambda: list(map(int, input().split()))
n = int(eval(input()))
if n % 3:
ans = "YNeos"[any(R()) :: 2]
else:
a = sorted(R())
m = n // 3
if a[0] ^ a[m] ^ a[2 * m]:
ans = "No"
elif any(len(set(a[i : i + m])) > 1 for i in range(0, n, m)):
ans = "No"
else:
ans = "Yes"
prin... | false | 0 | [
"- elif any(a[i] != a[i - 1] for i in range(1, n) if m != i != 2 * m):",
"+ elif any(len(set(a[i : i + m])) > 1 for i in range(0, n, m)):"
] | false | 0.042564 | 0.037758 | 1.127294 | [
"s201198322",
"s197239541"
] |
u440180827 | p02385 | python | s438004176 | s642733299 | 30 | 20 | 7,732 | 7,724 | Accepted | Accepted | 33.33 | x = list(map(int, input().split()))
y = list(map(int, input().split()))
z = [0, 1, 2]
for i in range(6):
order = [0, 0, 0]
for j in range(3):
if {x[j], x[-j-1]} != {y[z[j]], y[-z[j]-1]}:
break
if x[j] == y[z[j]]:
order[j] = 1
if x[j] == x[-j-1]:
... | x = list(map(int, input().split()))
y = list(map(int, input().split()))
z = [0, 1, 2]
for i in range(6):
order = [0, 0, 0]
for j in range(3):
if {x[j], x[-j-1]} != {y[z[j]], y[-z[j]-1]}:
break
if x[j] == y[z[j]]:
order[j] = 1
if x[j] == x[-j-1]:
... | 21 | 21 | 553 | 556 | x = list(map(int, input().split()))
y = list(map(int, input().split()))
z = [0, 1, 2]
for i in range(6):
order = [0, 0, 0]
for j in range(3):
if {x[j], x[-j - 1]} != {y[z[j]], y[-z[j] - 1]}:
break
if x[j] == y[z[j]]:
order[j] = 1
if x[j] == x[-j - 1]:
... | x = list(map(int, input().split()))
y = list(map(int, input().split()))
z = [0, 1, 2]
for i in range(6):
order = [0, 0, 0]
for j in range(3):
if {x[j], x[-j - 1]} != {y[z[j]], y[-z[j] - 1]}:
break
if x[j] == y[z[j]]:
order[j] = 1
if x[j] == x[-j - 1]:
... | false | 0 | [
"- z = z[-1:] + z[:-1]",
"+ z = [z[2], z[0], z[1]]"
] | false | 0.035138 | 0.033625 | 1.045003 | [
"s438004176",
"s642733299"
] |
u074220993 | p03759 | python | s089818497 | s632912155 | 29 | 26 | 9,160 | 9,160 | Accepted | Accepted | 10.34 | a, b, c = list(map(int, input().split()))
if b - a == c - b:
print("YES")
else:
print("NO") | a,b,c = list(map(int, input().split()))
print(('YES' if b-a == c-b else 'NO')) | 5 | 2 | 97 | 71 | a, b, c = list(map(int, input().split()))
if b - a == c - b:
print("YES")
else:
print("NO")
| a, b, c = list(map(int, input().split()))
print(("YES" if b - a == c - b else "NO"))
| false | 60 | [
"-if b - a == c - b:",
"- print(\"YES\")",
"-else:",
"- print(\"NO\")",
"+print((\"YES\" if b - a == c - b else \"NO\"))"
] | false | 0.19749 | 0.121291 | 1.628239 | [
"s089818497",
"s632912155"
] |
u762420987 | p03799 | python | s228199201 | s295588336 | 166 | 17 | 38,384 | 2,940 | Accepted | Accepted | 89.76 | N, M = list(map(int, input().split()))
if N == M // 2:
ans = N
if N > M // 2:
ans = M // 2
if N < M // 2:
ans = N
M -= (N * 2)
ans += M // 4
print(ans)
| N, M = list(map(int, input().split()))
if 2*N <= M:
ans = N
M -= 2*N
ans += M//4
else:
ans = M//2
print(ans)
| 10 | 8 | 175 | 126 | N, M = list(map(int, input().split()))
if N == M // 2:
ans = N
if N > M // 2:
ans = M // 2
if N < M // 2:
ans = N
M -= N * 2
ans += M // 4
print(ans)
| N, M = list(map(int, input().split()))
if 2 * N <= M:
ans = N
M -= 2 * N
ans += M // 4
else:
ans = M // 2
print(ans)
| false | 20 | [
"-if N == M // 2:",
"+if 2 * N <= M:",
"-if N > M // 2:",
"+ M -= 2 * N",
"+ ans += M // 4",
"+else:",
"-if N < M // 2:",
"- ans = N",
"- M -= N * 2",
"- ans += M // 4"
] | false | 0.045293 | 0.036995 | 1.224323 | [
"s228199201",
"s295588336"
] |
u581187895 | p02682 | python | s826177538 | s090344876 | 23 | 20 | 9,140 | 9,180 | Accepted | Accepted | 13.04 |
def resolve():
A, B, C, K = map(int, input().split())
ans = 0
cnt = min(K, A)
ans += cnt * 1
K -= cnt
if K < 1:
return print(ans)
cnt = min(K, B)
ans += cnt * 0
K -= cnt
if K < 1:
return print(ans)
ans += K * -1
print(ans)
if __n... |
def resolve():
a, b,c,k = list(map(int, input().split()))
ans = 0
used = min(k,a)
ans += used * 1
k -= used
used = min(k, b)
k -= used
ans += k*(-1)
print(ans)
if __name__ == "__main__":
resolve() | 23 | 16 | 355 | 249 | def resolve():
A, B, C, K = map(int, input().split())
ans = 0
cnt = min(K, A)
ans += cnt * 1
K -= cnt
if K < 1:
return print(ans)
cnt = min(K, B)
ans += cnt * 0
K -= cnt
if K < 1:
return print(ans)
ans += K * -1
print(ans)
if __name__ == "__main__":
... | def resolve():
a, b, c, k = list(map(int, input().split()))
ans = 0
used = min(k, a)
ans += used * 1
k -= used
used = min(k, b)
k -= used
ans += k * (-1)
print(ans)
if __name__ == "__main__":
resolve()
| false | 30.434783 | [
"- A, B, C, K = map(int, input().split())",
"+ a, b, c, k = list(map(int, input().split()))",
"- cnt = min(K, A)",
"- ans += cnt * 1",
"- K -= cnt",
"- if K < 1:",
"- return print(ans)",
"- cnt = min(K, B)",
"- ans += cnt * 0",
"- K -= cnt",
"- if K < 1:",
... | false | 0.046938 | 0.047118 | 0.996194 | [
"s826177538",
"s090344876"
] |
u179169725 | p03283 | python | s671831877 | s515183551 | 1,423 | 1,237 | 20,656 | 48,896 | Accepted | Accepted | 13.07 | # https://atcoder.jp/contests/abc106/tasks/abc106_d
# どうやったら高速に区間[p,q]に完全に入っている区間の数を取得できるか?
# p,qを二次元座標として捉えると電車1本の線は二次元平面上の1点として表せる
# このときp,qの区間に完全に入っている電車の本数というのは、x軸、y軸の両方において[p,q]となる四角形内にある電車の本数
# queryに高速に答えるために二次元累積和を構築する
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, re... | # https://atcoder.jp/contests/abc106/tasks/abc106_d
# どうやったら高速に区間[p,q]に完全に入っている区間の数を取得できるか?
# p,qを二次元座標として捉えると電車1本の線は二次元平面上の1点として表せる
# このときp,qの区間に完全に入っている電車の本数というのは、x軸、y軸の両方において[p,q]となる四角形内にある電車の本数
# queryに高速に答えるために二次元累積和を構築する
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, re... | 50 | 43 | 1,126 | 1,077 | # https://atcoder.jp/contests/abc106/tasks/abc106_d
# どうやったら高速に区間[p,q]に完全に入っている区間の数を取得できるか?
# p,qを二次元座標として捉えると電車1本の線は二次元平面上の1点として表せる
# このときp,qの区間に完全に入っている電車の本数というのは、x軸、y軸の両方において[p,q]となる四角形内にある電車の本数
# queryに高速に答えるために二次元累積和を構築する
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().spli... | # https://atcoder.jp/contests/abc106/tasks/abc106_d
# どうやったら高速に区間[p,q]に完全に入っている区間の数を取得できるか?
# p,qを二次元座標として捉えると電車1本の線は二次元平面上の1点として表せる
# このときp,qの区間に完全に入っている電車の本数というのは、x軸、y軸の両方において[p,q]となる四角形内にある電車の本数
# queryに高速に答えるために二次元累積和を構築する
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().spli... | false | 14 | [
"+LR = read_tuple(M)",
"+pq = read_tuple(Q)",
"-for _ in range(M):",
"- L, R = read_ints()",
"+for L, R in LR:",
"-LR2d = np.array(LR2d)",
"+LR2d = np.array(LR2d, np.int64)",
"-# pq = read_tuple(Q)",
"-for _ in range(Q):",
"- p, q = read_ints()",
"+# queryに答えていく",
"+for p, q in pq:",
"... | false | 0.263134 | 0.200981 | 1.309253 | [
"s671831877",
"s515183551"
] |
u077291787 | p03162 | python | s878590467 | s375287991 | 413 | 247 | 21,308 | 21,308 | Accepted | Accepted | 40.19 | # dpC - Vacation
# 3 variables
def main():
n = int(eval(input()))
A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))
a, b, c = A[0]
for x, y, z in A[1:]:
a, b, c = x + max(b, c), y + max(a, c), z + max(a, b)
print((max(a, b, c)))
if __name__ == "__main__":
... | # dpC - Vacation
# 3 variables
import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))
a, b, c = A[0]
for x, y, z in A[1:]:
a, b, c = x + max(b, c), y + max(a, c), z + max(a, b)
print((max(a, ... | 13 | 16 | 321 | 363 | # dpC - Vacation
# 3 variables
def main():
n = int(eval(input()))
A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))
a, b, c = A[0]
for x, y, z in A[1:]:
a, b, c = x + max(b, c), y + max(a, c), z + max(a, b)
print((max(a, b, c)))
if __name__ == "__main__":
main()
| # dpC - Vacation
# 3 variables
import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))
a, b, c = A[0]
for x, y, z in A[1:]:
a, b, c = x + max(b, c), y + max(a, c), z + max(a, b)
print((max(a, b, c)))
... | false | 18.75 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+"
] | false | 0.035085 | 0.042429 | 0.826916 | [
"s878590467",
"s375287991"
] |
u033606236 | p03434 | python | s717818983 | s598336588 | 21 | 17 | 3,060 | 3,060 | Accepted | Accepted | 19.05 | Num = int(eval(input()))
Num_Array = list(map(int,input().split()))
Alice,Bob = 0,0
for i in range ( Num ):
Check_Max = -1
for x in range(len(Num_Array)):
if Num_Array[x] > Check_Max :
Check_Max = Num_Array[x]
check = x
Num_Array.pop(check)
if i % 2 == 0... | Num = int(eval(input()))
Num_Array = sorted(list(map(int,input().split())),reverse=True)
Alice,Bob = 0,0
for i in range(Num):
if i % 2 == 0 :
Alice += Num_Array[i]
else:
Bob += Num_Array[i]
print((Alice - Bob)) | 20 | 12 | 403 | 242 | Num = int(eval(input()))
Num_Array = list(map(int, input().split()))
Alice, Bob = 0, 0
for i in range(Num):
Check_Max = -1
for x in range(len(Num_Array)):
if Num_Array[x] > Check_Max:
Check_Max = Num_Array[x]
check = x
Num_Array.pop(check)
if i % 2 == 0:
Alice += ... | Num = int(eval(input()))
Num_Array = sorted(list(map(int, input().split())), reverse=True)
Alice, Bob = 0, 0
for i in range(Num):
if i % 2 == 0:
Alice += Num_Array[i]
else:
Bob += Num_Array[i]
print((Alice - Bob))
| false | 40 | [
"-Num_Array = list(map(int, input().split()))",
"+Num_Array = sorted(list(map(int, input().split())), reverse=True)",
"- Check_Max = -1",
"- for x in range(len(Num_Array)):",
"- if Num_Array[x] > Check_Max:",
"- Check_Max = Num_Array[x]",
"- check = x",
"- Num_Arr... | false | 0.046239 | 0.045273 | 1.021335 | [
"s717818983",
"s598336588"
] |
u934442292 | p03017 | python | s704702493 | s721974806 | 76 | 61 | 3,572 | 9,516 | Accepted | Accepted | 19.74 | import sys
input = sys.stdin.readline # NOQA
def main():
N, A, B, C, D = list(map(int, input().split()))
A -= 1
B -= 1
C -= 1
D -= 1
S = input().rstrip()
can_jump_R = True # '##'
can_jump_B = False # '...'
for i in range(A + 1, N - 1):
if S[i] == S[i+1] =... | import sys
input = sys.stdin.readline
def main():
N, A, B, C, D = list(map(int, input().split()))
A -= 1
B -= 1
C -= 1
D -= 1
S = input().rstrip()
if C < D:
is_ok = True
for i in range(A, D):
if S[i:i + 2] == "##":
is_ok = Fals... | 37 | 41 | 797 | 873 | import sys
input = sys.stdin.readline # NOQA
def main():
N, A, B, C, D = list(map(int, input().split()))
A -= 1
B -= 1
C -= 1
D -= 1
S = input().rstrip()
can_jump_R = True # '##'
can_jump_B = False # '...'
for i in range(A + 1, N - 1):
if S[i] == S[i + 1] == "#":
... | import sys
input = sys.stdin.readline
def main():
N, A, B, C, D = list(map(int, input().split()))
A -= 1
B -= 1
C -= 1
D -= 1
S = input().rstrip()
if C < D:
is_ok = True
for i in range(A, D):
if S[i : i + 2] == "##":
is_ok = False
... | false | 9.756098 | [
"-input = sys.stdin.readline # NOQA",
"+input = sys.stdin.readline",
"- can_jump_R = True # '##'",
"- can_jump_B = False # '...'",
"- for i in range(A + 1, N - 1):",
"- if S[i] == S[i + 1] == \"#\":",
"- if A < i < C or B < i < D:",
"- can_jump_R = False",
... | false | 0.048268 | 0.063593 | 0.759005 | [
"s704702493",
"s721974806"
] |
u619144316 | p02928 | python | s701332170 | s441154376 | 1,463 | 1,281 | 3,188 | 3,188 | Accepted | Accepted | 12.44 | N, k = list(map(int,input().split()))
A = list(map(int,input().split()))
MOD = 10**9+7
ans = 0
for i in range(N):
for j in range(N):
if A[i] > A[j]:
if i > j:
ans += k*(k-1)//2
elif i < j:
ans += k*(k+1)//2
ans %= MOD
print(... | N,k = list(map(int,input().split()))
A = list(map(int,input().split()))
ans = 0
MOD = 10**9+7
for i in range(N):
for j in range(i+1,N):
if A[i] > A[j]:
ans += k*(k+1)//2
elif A[i] < A[j]:
ans += k*(k-1)//2
ans %= MOD
print(ans) | 15 | 14 | 319 | 288 | N, k = list(map(int, input().split()))
A = list(map(int, input().split()))
MOD = 10**9 + 7
ans = 0
for i in range(N):
for j in range(N):
if A[i] > A[j]:
if i > j:
ans += k * (k - 1) // 2
elif i < j:
ans += k * (k + 1) // 2
ans %= MOD
print(... | N, k = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = 0
MOD = 10**9 + 7
for i in range(N):
for j in range(i + 1, N):
if A[i] > A[j]:
ans += k * (k + 1) // 2
elif A[i] < A[j]:
ans += k * (k - 1) // 2
ans %= MOD
print(ans)
| false | 6.666667 | [
"+ans = 0",
"-ans = 0",
"- for j in range(N):",
"+ for j in range(i + 1, N):",
"- if i > j:",
"- ans += k * (k - 1) // 2",
"- elif i < j:",
"- ans += k * (k + 1) // 2",
"- ans %= MOD",
"+ ans += k * (k + 1) // 2",
"+... | false | 0.04768 | 0.046418 | 1.027179 | [
"s701332170",
"s441154376"
] |
u694665829 | p03472 | python | s655725003 | s709929477 | 278 | 255 | 13,044 | 14,448 | Accepted | Accepted | 8.27 | N,H=list(map(int,input().split()))
B=[]
A=0
for _ in range(N):
a,b=list(map(int,input().split()))
A=max(A,a)
B.append(b)
B.sort(reverse=True)
ans=(H-1)//A+1
for i in range(N):
H-=B[i]
if H<=0:
ans=min(ans,i+1)
break
ans=min(ans,(H-1)//A+1+i+1)
print(ans) | N,H=list(map(int,input().split()))
B=[]
A=0
for _ in range(N):
a,b = list(map(int,input().split()))
A = max(A,a)
B.append(b)
B = sorted(B, reverse=True) + [0]
i = 0
while B[i] >= A:
i += 1
B = B[:i]
ans = 0
for i in range(len(B)):
H -= B[i]
ans += 1
if H <= 0:
pr... | 16 | 22 | 297 | 361 | N, H = list(map(int, input().split()))
B = []
A = 0
for _ in range(N):
a, b = list(map(int, input().split()))
A = max(A, a)
B.append(b)
B.sort(reverse=True)
ans = (H - 1) // A + 1
for i in range(N):
H -= B[i]
if H <= 0:
ans = min(ans, i + 1)
break
ans = min(ans, (H - 1) // A + 1 ... | N, H = list(map(int, input().split()))
B = []
A = 0
for _ in range(N):
a, b = list(map(int, input().split()))
A = max(A, a)
B.append(b)
B = sorted(B, reverse=True) + [0]
i = 0
while B[i] >= A:
i += 1
B = B[:i]
ans = 0
for i in range(len(B)):
H -= B[i]
ans += 1
if H <= 0:
print(ans)
... | false | 27.272727 | [
"-B.sort(reverse=True)",
"-ans = (H - 1) // A + 1",
"-for i in range(N):",
"+B = sorted(B, reverse=True) + [0]",
"+i = 0",
"+while B[i] >= A:",
"+ i += 1",
"+B = B[:i]",
"+ans = 0",
"+for i in range(len(B)):",
"+ ans += 1",
"- ans = min(ans, i + 1)",
"- break",
"- an... | false | 0.047106 | 0.047122 | 0.999663 | [
"s655725003",
"s709929477"
] |
u623814058 | p03160 | python | s529528911 | s763159513 | 142 | 118 | 20,444 | 20,388 | Accepted | Accepted | 16.9 | N=int(eval(input()))
*H,=list(map(int,input().split()))
D=[10**4*N]*N
D[0]=0
for i in range(N):
if 1<=i:
#print(i,H[i],H[i-1],abs(H[i]-H[i-1]))
D[i]=min(D[i],abs(H[i]-H[i-1])+D[i-1])
if 2<=i:
#print(i,H[i],H[i-2],abs(H[i]-H[i-2]))
D[i]=min(D[i],abs(H[i]-H[i-2])+D[i-... | N=int(eval(input()))
*H,=list(map(int,input().split()))
D=[-1]*N
D[0]=0
D[1]=abs(H[1]-H[0])
for i in range(2,N):
D[i]=min(abs(H[i]-H[i-1])+D[i-1],abs(H[i]-H[i-2])+D[i-2])
print((D[-1])) | 14 | 8 | 325 | 182 | N = int(eval(input()))
(*H,) = list(map(int, input().split()))
D = [10**4 * N] * N
D[0] = 0
for i in range(N):
if 1 <= i:
# print(i,H[i],H[i-1],abs(H[i]-H[i-1]))
D[i] = min(D[i], abs(H[i] - H[i - 1]) + D[i - 1])
if 2 <= i:
# print(i,H[i],H[i-2],abs(H[i]-H[i-2]))
D[i] = min(D[i], ... | N = int(eval(input()))
(*H,) = list(map(int, input().split()))
D = [-1] * N
D[0] = 0
D[1] = abs(H[1] - H[0])
for i in range(2, N):
D[i] = min(abs(H[i] - H[i - 1]) + D[i - 1], abs(H[i] - H[i - 2]) + D[i - 2])
print((D[-1]))
| false | 42.857143 | [
"-D = [10**4 * N] * N",
"+D = [-1] * N",
"-for i in range(N):",
"- if 1 <= i:",
"- # print(i,H[i],H[i-1],abs(H[i]-H[i-1]))",
"- D[i] = min(D[i], abs(H[i] - H[i - 1]) + D[i - 1])",
"- if 2 <= i:",
"- # print(i,H[i],H[i-2],abs(H[i]-H[i-2]))",
"- D[i] = min(D[i], abs(H... | false | 0.042779 | 0.035744 | 1.196831 | [
"s529528911",
"s763159513"
] |
u810356688 | p02845 | python | s597440370 | s598206311 | 300 | 67 | 53,036 | 14,008 | Accepted | Accepted | 77.67 | import sys
def input(): return sys.stdin.readline().rstrip()
from collections import Counter
def main():
n=int(eval(input()))
A=list(map(int,input().split()))
rgb=[-1,-1,-1]
ans=1
mod=10**9+7
for a in A:
ans=ans*Counter(rgb)[a-1]%mod
if ans==0:break
rgb[rgb.in... | import sys
def input(): return sys.stdin.readline().rstrip()
def main():
n=int(eval(input()))
A=list(map(int,input().split()))
cunt=[0]*(n+1)
cunt[0]=3
ans=1
mod=10**9+7
for a in A:
ans=ans*cunt[a]%mod
if ans==0:break
cunt[a+1]+=1
cunt[a]-=1
... | 18 | 19 | 388 | 370 | import sys
def input():
return sys.stdin.readline().rstrip()
from collections import Counter
def main():
n = int(eval(input()))
A = list(map(int, input().split()))
rgb = [-1, -1, -1]
ans = 1
mod = 10**9 + 7
for a in A:
ans = ans * Counter(rgb)[a - 1] % mod
if ans == 0:
... | import sys
def input():
return sys.stdin.readline().rstrip()
def main():
n = int(eval(input()))
A = list(map(int, input().split()))
cunt = [0] * (n + 1)
cunt[0] = 3
ans = 1
mod = 10**9 + 7
for a in A:
ans = ans * cunt[a] % mod
if ans == 0:
break
cu... | false | 5.263158 | [
"-from collections import Counter",
"-",
"-",
"- rgb = [-1, -1, -1]",
"+ cunt = [0] * (n + 1)",
"+ cunt[0] = 3",
"- ans = ans * Counter(rgb)[a - 1] % mod",
"+ ans = ans * cunt[a] % mod",
"- rgb[rgb.index(a - 1)] += 1",
"+ cunt[a + 1] += 1",
"+ cunt[a] ... | false | 0.037393 | 0.036885 | 1.013756 | [
"s597440370",
"s598206311"
] |
u761320129 | p02763 | python | s417211494 | s249305189 | 914 | 839 | 172,148 | 172,020 | Accepted | Accepted | 8.21 | import sys
input = sys.stdin.readline
N = int(input())
S = input().rstrip()
Q = int(input())
qs = [input().split() for i in range(Q)]
def ctoi(c):
return ord(c) - ord('a')
bit = [[0]*(N+2) for _ in range(26)]
def bit_add(x,w,ci):
while x <= N+1:
bit[ci][x] += w
x += (x & -x)
def... | import sys
input = sys.stdin.readline
N = int(input())
S = input().rstrip()
Q = int(input())
qs = [input().split() for i in range(Q)]
def ctoi(c):
return ord(c) - ord('a')
class BinaryIndexedTree:
def __init__(self,size):
self.N = size
self.bit = [0]*(size+1)
def add(self,x,w... | 40 | 44 | 846 | 1,020 | import sys
input = sys.stdin.readline
N = int(input())
S = input().rstrip()
Q = int(input())
qs = [input().split() for i in range(Q)]
def ctoi(c):
return ord(c) - ord("a")
bit = [[0] * (N + 2) for _ in range(26)]
def bit_add(x, w, ci):
while x <= N + 1:
bit[ci][x] += w
x += x & -x
def b... | import sys
input = sys.stdin.readline
N = int(input())
S = input().rstrip()
Q = int(input())
qs = [input().split() for i in range(Q)]
def ctoi(c):
return ord(c) - ord("a")
class BinaryIndexedTree:
def __init__(self, size):
self.N = size
self.bit = [0] * (size + 1)
def add(self, x, w):
... | false | 9.090909 | [
"-bit = [[0] * (N + 2) for _ in range(26)]",
"+class BinaryIndexedTree:",
"+ def __init__(self, size):",
"+ self.N = size",
"+ self.bit = [0] * (size + 1)",
"+",
"+ def add(self, x, w):",
"+ while x <= self.N:",
"+ self.bit[x] += w",
"+ x += x & -x"... | false | 0.0378 | 0.036134 | 1.046104 | [
"s417211494",
"s249305189"
] |
u454022848 | p02401 | python | s016457594 | s297057212 | 30 | 10 | 6,732 | 6,432 | Accepted | Accepted | 66.67 | while True:
a,op,b=input().split(" ")
a,b=[int(i) for i in (a,b)]
if op=="+":
print((a+b))
elif op=="-":
print((a-b))
elif op=="*":
print((a*b))
elif op=="/":
print((int(a/b)))
else:
break | # encoding:utf-8
while True:
a, op, b = input().split()
if op == "?":
break
a, b = list(map(int, (a,b)))
if op == "+":
print((a+b))
elif op == "-":
print((a-b))
elif op == "*":
print((a*b))
else:
print((a/b)) | 13 | 15 | 209 | 230 | while True:
a, op, b = input().split(" ")
a, b = [int(i) for i in (a, b)]
if op == "+":
print((a + b))
elif op == "-":
print((a - b))
elif op == "*":
print((a * b))
elif op == "/":
print((int(a / b)))
else:
break
| # encoding:utf-8
while True:
a, op, b = input().split()
if op == "?":
break
a, b = list(map(int, (a, b)))
if op == "+":
print((a + b))
elif op == "-":
print((a - b))
elif op == "*":
print((a * b))
else:
print((a / b))
| false | 13.333333 | [
"+# encoding:utf-8",
"- a, op, b = input().split(\" \")",
"- a, b = [int(i) for i in (a, b)]",
"+ a, op, b = input().split()",
"+ if op == \"?\":",
"+ break",
"+ a, b = list(map(int, (a, b)))",
"- elif op == \"/\":",
"- print((int(a / b)))",
"- break",
"+ ... | false | 0.037626 | 0.036955 | 1.018172 | [
"s016457594",
"s297057212"
] |
u970197315 | p02802 | python | s404693032 | s868855244 | 431 | 340 | 27,744 | 12,652 | Accepted | Accepted | 21.11 | # ABC151 C
si = lambda: eval(input())
ni = lambda: int(eval(input()))
nm = lambda: list(map(str, input().split()))
nl = lambda: list(map(int, input().split()))
from collections import defaultdict
n,m=list(map(int, input().split()))
ac=set()
ac_cnt=0
wa_cnt=0
d_ac=defaultdict(int)
d_wa=defaultdict(int)
for i... | n,m=list(map(int,input().split()))
ac,wa=0,0
ac_set=set()
wa_cnt=[0]*(n+1)
for i in range(m):
p,s=list(map(str,input().split()))
p=int(p)
if s=="AC":
if p in ac_set:
continue
ac_set.add(p)
else:
if p in ac_set:
continue
wa_cnt[p]+=1
ac=len(ac_set)
for a in ac_set:
... | 29 | 19 | 587 | 335 | # ABC151 C
si = lambda: eval(input())
ni = lambda: int(eval(input()))
nm = lambda: list(map(str, input().split()))
nl = lambda: list(map(int, input().split()))
from collections import defaultdict
n, m = list(map(int, input().split()))
ac = set()
ac_cnt = 0
wa_cnt = 0
d_ac = defaultdict(int)
d_wa = defaultdict(int)
for... | n, m = list(map(int, input().split()))
ac, wa = 0, 0
ac_set = set()
wa_cnt = [0] * (n + 1)
for i in range(m):
p, s = list(map(str, input().split()))
p = int(p)
if s == "AC":
if p in ac_set:
continue
ac_set.add(p)
else:
if p in ac_set:
continue
wa_c... | false | 34.482759 | [
"-# ABC151 C",
"-si = lambda: eval(input())",
"-ni = lambda: int(eval(input()))",
"-nm = lambda: list(map(str, input().split()))",
"-nl = lambda: list(map(int, input().split()))",
"-from collections import defaultdict",
"-",
"-ac = set()",
"-ac_cnt = 0",
"-wa_cnt = 0",
"-d_ac = defaultdict(int)"... | false | 0.045375 | 0.04892 | 0.927547 | [
"s404693032",
"s868855244"
] |
u595289165 | p02832 | python | s763013270 | s963373666 | 106 | 89 | 24,744 | 24,744 | Accepted | Accepted | 16.04 | n = int(eval(input()))
a = list(map(int, input().split()))
now = 1
ans = 0
for i in range(n):
if a[i] == now:
now += 1
else:
ans += 1
if ans == len(a):
print((-1))
else:
print(ans) | n = int(eval(input()))
a = list(map(int, input().split()))
val = 1
ans = 0
for a_i in a:
if a_i == val:
val += 1
else:
ans += 1
if val == 1:
print((-1))
else:
print(ans) | 15 | 15 | 220 | 209 | n = int(eval(input()))
a = list(map(int, input().split()))
now = 1
ans = 0
for i in range(n):
if a[i] == now:
now += 1
else:
ans += 1
if ans == len(a):
print((-1))
else:
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split()))
val = 1
ans = 0
for a_i in a:
if a_i == val:
val += 1
else:
ans += 1
if val == 1:
print((-1))
else:
print(ans)
| false | 0 | [
"-now = 1",
"+val = 1",
"-for i in range(n):",
"- if a[i] == now:",
"- now += 1",
"+for a_i in a:",
"+ if a_i == val:",
"+ val += 1",
"-if ans == len(a):",
"+if val == 1:"
] | false | 0.031128 | 0.032439 | 0.95957 | [
"s763013270",
"s963373666"
] |
u218834617 | p02579 | python | s427956692 | s996247067 | 1,235 | 826 | 217,728 | 201,324 | Accepted | Accepted | 33.12 | import sys
from collections import deque
H,W=list(map(int,input().split()))
si,sj=[int(x)-1 for x in input().split()]
ti,tj=[int(x)-1 for x in input().split()]
A=list(sys.stdin)
dirs=[-2,-1,0,1,2]
dist=[[10**6]*W for _ in range(H)]
dist[si][sj]=0
dq=deque()
dq.append((0,si,sj))
ok=False
while dq:
k... | import sys
from collections import deque
H,W=list(map(int,input().split()))
si,sj=[int(x)-1 for x in input().split()]
ti,tj=[int(x)-1 for x in input().split()]
A=[[*next(sys.stdin)] for _ in range(H)]
N=-1
for i in range(H):
for j in range(W):
if A[i][j]!='.':
continue
N+=... | 47 | 75 | 1,048 | 1,737 | import sys
from collections import deque
H, W = list(map(int, input().split()))
si, sj = [int(x) - 1 for x in input().split()]
ti, tj = [int(x) - 1 for x in input().split()]
A = list(sys.stdin)
dirs = [-2, -1, 0, 1, 2]
dist = [[10**6] * W for _ in range(H)]
dist[si][sj] = 0
dq = deque()
dq.append((0, si, sj))
ok = Fal... | import sys
from collections import deque
H, W = list(map(int, input().split()))
si, sj = [int(x) - 1 for x in input().split()]
ti, tj = [int(x) - 1 for x in input().split()]
A = [[*next(sys.stdin)] for _ in range(H)]
N = -1
for i in range(H):
for j in range(W):
if A[i][j] != ".":
continue
... | false | 37.333333 | [
"-A = list(sys.stdin)",
"+A = [[*next(sys.stdin)] for _ in range(H)]",
"+N = -1",
"+for i in range(H):",
"+ for j in range(W):",
"+ if A[i][j] != \".\":",
"+ continue",
"+ N += 1",
"+ stk = [(i, j)]",
"+ while stk:",
"+ ii, jj = stk.pop()",
... | false | 0.038372 | 0.040389 | 0.95006 | [
"s427956692",
"s996247067"
] |
u357230322 | p02713 | python | s485022710 | s549967397 | 1,557 | 1,096 | 188,732 | 69,864 | Accepted | Accepted | 29.61 | import math
from functools import reduce
def gcd(*numbers):
return reduce(math.gcd, numbers)
x=0
k=int(eval(input()))
r = list(range(1, k + 1))
x = sum([gcd(a, b, c) for a in r for b in r for c in r])
print(x)
| import math
from functools import reduce
def gcd(*numbers):
return reduce(math.gcd, numbers)
x=0
k=int(eval(input()))
for i in range(1,k+1):
for j in range(1,k+1):
for l in range(1,k+1):
x+=gcd(i,j,l)
print(x)
| 11 | 15 | 214 | 238 | import math
from functools import reduce
def gcd(*numbers):
return reduce(math.gcd, numbers)
x = 0
k = int(eval(input()))
r = list(range(1, k + 1))
x = sum([gcd(a, b, c) for a in r for b in r for c in r])
print(x)
| import math
from functools import reduce
def gcd(*numbers):
return reduce(math.gcd, numbers)
x = 0
k = int(eval(input()))
for i in range(1, k + 1):
for j in range(1, k + 1):
for l in range(1, k + 1):
x += gcd(i, j, l)
print(x)
| false | 26.666667 | [
"-r = list(range(1, k + 1))",
"-x = sum([gcd(a, b, c) for a in r for b in r for c in r])",
"+for i in range(1, k + 1):",
"+ for j in range(1, k + 1):",
"+ for l in range(1, k + 1):",
"+ x += gcd(i, j, l)"
] | false | 0.045008 | 0.034246 | 1.314238 | [
"s485022710",
"s549967397"
] |
u754022296 | p03634 | python | s727416408 | s242581462 | 1,541 | 1,396 | 137,936 | 131,632 | Accepted | Accepted | 9.41 | import sys
sys.setrecursionlimit(10**7)
n = int(eval(input()))
l = [[] for _ in range(n)]
for _ in range(n-1):
a, b, c = list(map(int, input().split()))
l[a-1].append([b-1, c])
l[b-1].append([a-1, c])
q, k = list(map(int, input().split()))
dist = [-1]*n
dist[k-1] = 0
def dfs(v):
for nv, c in l[v]:... | import sys
sys.setrecursionlimit(10**7)
n = int(eval(input()))
l = [[] for _ in range(n)]
for _ in range(n-1):
a, b, c = list(map(int, input().split()))
l[a-1].append((b-1, c))
l[b-1].append((a-1, c))
q, k = list(map(int, input().split()))
dist = [-1]*n
dist[k-1] = 0
def dfs(v):
for nv, c in l[v]:... | 21 | 21 | 467 | 468 | import sys
sys.setrecursionlimit(10**7)
n = int(eval(input()))
l = [[] for _ in range(n)]
for _ in range(n - 1):
a, b, c = list(map(int, input().split()))
l[a - 1].append([b - 1, c])
l[b - 1].append([a - 1, c])
q, k = list(map(int, input().split()))
dist = [-1] * n
dist[k - 1] = 0
def dfs(v):
for nv,... | import sys
sys.setrecursionlimit(10**7)
n = int(eval(input()))
l = [[] for _ in range(n)]
for _ in range(n - 1):
a, b, c = list(map(int, input().split()))
l[a - 1].append((b - 1, c))
l[b - 1].append((a - 1, c))
q, k = list(map(int, input().split()))
dist = [-1] * n
dist[k - 1] = 0
def dfs(v):
for nv,... | false | 0 | [
"- l[a - 1].append([b - 1, c])",
"- l[b - 1].append([a - 1, c])",
"+ l[a - 1].append((b - 1, c))",
"+ l[b - 1].append((a - 1, c))"
] | false | 0.084899 | 0.043173 | 1.96651 | [
"s727416408",
"s242581462"
] |
u606045429 | p03296 | python | s236419901 | s692497044 | 19 | 17 | 3,316 | 3,060 | Accepted | Accepted | 10.53 | N = int(eval(input()))
a = [int(i) for i in input().split()]
result = 0
prev = -1
count = 1
for i in range(len(a)):
if a[i] == prev:
count += 1
if i == N - 1:
result += count // 2
else:
result += count // 2
prev = a[i]
count = 1
print(result) | from itertools import groupby
N, *A = list(map(int, open(0).read().split()))
print((sum(len(tuple(v)) // 2 for _, v in groupby(A))))
| 17 | 4 | 314 | 129 | N = int(eval(input()))
a = [int(i) for i in input().split()]
result = 0
prev = -1
count = 1
for i in range(len(a)):
if a[i] == prev:
count += 1
if i == N - 1:
result += count // 2
else:
result += count // 2
prev = a[i]
count = 1
print(result)
| from itertools import groupby
N, *A = list(map(int, open(0).read().split()))
print((sum(len(tuple(v)) // 2 for _, v in groupby(A))))
| false | 76.470588 | [
"-N = int(eval(input()))",
"-a = [int(i) for i in input().split()]",
"-result = 0",
"-prev = -1",
"-count = 1",
"-for i in range(len(a)):",
"- if a[i] == prev:",
"- count += 1",
"- if i == N - 1:",
"- result += count // 2",
"- else:",
"- result += count //... | false | 0.061368 | 0.071791 | 0.854807 | [
"s236419901",
"s692497044"
] |
u151005508 | p02861 | python | s898540789 | s220403430 | 377 | 18 | 3,064 | 3,064 | Accepted | Accepted | 95.23 | import itertools
import math
n=int(eval(input()))
lst=[None]*n
for i in range(n):
lst[i]=tuple(map(int, input().split()))
total=0
for v in itertools.permutations(lst):
for i in range(n-1):
dis=math.sqrt( (v[i][0]-v[i+1][0])**2 + (v[i][1]-v[i+1][1])**2 )
total+=dis
print((total/math.fa... | import itertools
import math
N=int(eval(input()))
lst=[None]*N
for i in range(N):
lst[i]=tuple(map(int, input().split()))
total=0
for i in range(N-1):
for j in range(i+1,N):
total+=math.sqrt( (lst[i][0]-lst[j][0])**2 + (lst[i][1]-lst[j][1])**2 )
ave=total*2/N
print(ave) | 13 | 13 | 327 | 293 | import itertools
import math
n = int(eval(input()))
lst = [None] * n
for i in range(n):
lst[i] = tuple(map(int, input().split()))
total = 0
for v in itertools.permutations(lst):
for i in range(n - 1):
dis = math.sqrt((v[i][0] - v[i + 1][0]) ** 2 + (v[i][1] - v[i + 1][1]) ** 2)
total += dis
prin... | import itertools
import math
N = int(eval(input()))
lst = [None] * N
for i in range(N):
lst[i] = tuple(map(int, input().split()))
total = 0
for i in range(N - 1):
for j in range(i + 1, N):
total += math.sqrt((lst[i][0] - lst[j][0]) ** 2 + (lst[i][1] - lst[j][1]) ** 2)
ave = total * 2 / N
print(ave)
| false | 0 | [
"-n = int(eval(input()))",
"-lst = [None] * n",
"-for i in range(n):",
"+N = int(eval(input()))",
"+lst = [None] * N",
"+for i in range(N):",
"-for v in itertools.permutations(lst):",
"- for i in range(n - 1):",
"- dis = math.sqrt((v[i][0] - v[i + 1][0]) ** 2 + (v[i][1] - v[i + 1][1]) ** 2... | false | 0.106479 | 0.039934 | 2.666372 | [
"s898540789",
"s220403430"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.