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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u111365362 | p02788 | python | s189476421 | s641797451 | 1,983 | 1,817 | 86,724 | 83,936 | Accepted | Accepted | 8.37 | n,d,a = list(map(int,input().split()))
raw = []
event = []
for i in range(n):
x,h = list(map(int,input().split()))
event.append([x,0,i,h])
for i in range(n):
tmp = event[i][0] + 2 * d
event.append([tmp,1,i])
event.sort()
#print(event)
use = [0 for _ in range(n)]
now = 0
ans = 0
for j in range(2*n)... | n,d,a = list(map(int,input().split()))
attack = [0 for _ in range(n)]
event = []
for i in range(n):
x,h = list(map(int,input().split()))
h = (h-1)//a+1
event.append([x-d,0,h,i])
event.append([x+d,1,h,i])
event.sort()
#print(event)
ans = 0
now = 0
for j in range(2*n):
x,m,h,i = event[j]
if m ==... | 30 | 22 | 578 | 432 | n, d, a = list(map(int, input().split()))
raw = []
event = []
for i in range(n):
x, h = list(map(int, input().split()))
event.append([x, 0, i, h])
for i in range(n):
tmp = event[i][0] + 2 * d
event.append([tmp, 1, i])
event.sort()
# print(event)
use = [0 for _ in range(n)]
now = 0
ans = 0
for j in range... | n, d, a = list(map(int, input().split()))
attack = [0 for _ in range(n)]
event = []
for i in range(n):
x, h = list(map(int, input().split()))
h = (h - 1) // a + 1
event.append([x - d, 0, h, i])
event.append([x + d, 1, h, i])
event.sort()
# print(event)
ans = 0
now = 0
for j in range(2 * n):
x, m, h,... | false | 26.666667 | [
"-raw = []",
"+attack = [0 for _ in range(n)]",
"- event.append([x, 0, i, h])",
"-for i in range(n):",
"- tmp = event[i][0] + 2 * d",
"- event.append([tmp, 1, i])",
"+ h = (h - 1) // a + 1",
"+ event.append([x - d, 0, h, i])",
"+ event.append([x + d, 1, h, i])",
"-use = [0 for _ ... | false | 0.042494 | 0.050025 | 0.849449 | [
"s189476421",
"s641797451"
] |
u585482323 | p03096 | python | s521871391 | s796622160 | 806 | 641 | 192,116 | 193,012 | Accepted | Accepted | 20.47 | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, ... | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, ... | 96 | 133 | 1,829 | 2,750 | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return list(map(int, sys.stdin.readline().split()))
def I():
return int(sys.stdin.readline())
def LS():
return list(m... | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return list(map(int, sys.stdin.readline().split()))
def I():
return int(sys.stdin.readline())
def LS():
return list(m... | false | 27.819549 | [
"- while q:",
"- x = heappop(q)",
"+ for x in range(n - 1):",
"- if path[y] == 0:",
"- heappush(q, y)",
"- return",
"+ sys.setrecursionlimit(100000)",
"+ n, a, b = LI()",
"+",
"+ def dfs(l, q, f):",
"+ if len(l) == po2[n]:",
"+ ... | false | 0.042673 | 0.043691 | 0.976705 | [
"s521871391",
"s796622160"
] |
u189023301 | p02559 | python | s433460157 | s931777756 | 624 | 565 | 175,832 | 175,676 | Accepted | Accepted | 9.46 | import sys
input = lambda: sys.stdin.readline()
class BIT:
def __init__(self, n):
self.n = n
self.data = [0] * n
def sum(self, i):
s = 0
while i > 0:
s += self.data[i - 1]
i &= i - 1
return s
def update(self, i, x):
w... | import sys
input = lambda: sys.stdin.readline()
class BIT:
def __init__(self, n):
self.n = n
self.data = [0] * (n + 1)
def sum(self, i):
s = 0
while i > 0:
s += self.data[i]
i -= i & -i
return s
def add(self, i, x):
... | 36 | 36 | 736 | 726 | import sys
input = lambda: sys.stdin.readline()
class BIT:
def __init__(self, n):
self.n = n
self.data = [0] * n
def sum(self, i):
s = 0
while i > 0:
s += self.data[i - 1]
i &= i - 1
return s
def update(self, i, x):
while i < self.... | import sys
input = lambda: sys.stdin.readline()
class BIT:
def __init__(self, n):
self.n = n
self.data = [0] * (n + 1)
def sum(self, i):
s = 0
while i > 0:
s += self.data[i]
i -= i & -i
return s
def add(self, i, x):
while i <= self... | false | 0 | [
"- self.data = [0] * n",
"+ self.data = [0] * (n + 1)",
"- s += self.data[i - 1]",
"- i &= i - 1",
"+ s += self.data[i]",
"+ i -= i & -i",
"- def update(self, i, x):",
"- while i < self.n:",
"+ def add(self, i, x):",
"+ ... | false | 0.046884 | 0.047429 | 0.988513 | [
"s433460157",
"s931777756"
] |
u254871849 | p02783 | python | s735584653 | s963989940 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | import sys
h, a = list(map(int, sys.stdin.readline().split()))
def main():
return (h + a - 1) // a
if __name__ == '__main__':
ans = main()
print(ans) | import sys
h, a = list(map(int, sys.stdin.readline().split()))
def main():
print(((h + a - 1) // a))
if __name__ == '__main__':
main() | 10 | 9 | 167 | 146 | import sys
h, a = list(map(int, sys.stdin.readline().split()))
def main():
return (h + a - 1) // a
if __name__ == "__main__":
ans = main()
print(ans)
| import sys
h, a = list(map(int, sys.stdin.readline().split()))
def main():
print(((h + a - 1) // a))
if __name__ == "__main__":
main()
| false | 10 | [
"- return (h + a - 1) // a",
"+ print(((h + a - 1) // a))",
"- ans = main()",
"- print(ans)",
"+ main()"
] | false | 0.035512 | 0.072922 | 0.486978 | [
"s735584653",
"s963989940"
] |
u141610915 | p02861 | python | s173490258 | s161913920 | 343 | 208 | 52,316 | 42,476 | Accepted | Accepted | 39.36 | import sys
from math import sqrt
input = sys.stdin.readline
N = int(eval(input()))
p = []
for _ in range(N):
p.append(list(map(int, input().split())))
def dist(x1, y1, x2, y2):
return sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
res = 0
vis = set()
c = 0
def fact(n):
r = 1
for i in range(1, n + 1):
... | import sys
from math import sqrt
from itertools import permutations as permi
input = sys.stdin.readline
N = int(eval(input()))
ps = []
for _ in range(N):
u, v = list(map(int, input().split()))
ps.append((u, v))
res = 0
c = 0
for p in permi([x for x in range(N)], N):
t = 0
c += 1
for i in range(... | 36 | 21 | 668 | 463 | import sys
from math import sqrt
input = sys.stdin.readline
N = int(eval(input()))
p = []
for _ in range(N):
p.append(list(map(int, input().split())))
def dist(x1, y1, x2, y2):
return sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
res = 0
vis = set()
c = 0
def fact(n):
r = 1
for i in range(1, n + 1):
... | import sys
from math import sqrt
from itertools import permutations as permi
input = sys.stdin.readline
N = int(eval(input()))
ps = []
for _ in range(N):
u, v = list(map(int, input().split()))
ps.append((u, v))
res = 0
c = 0
for p in permi([x for x in range(N)], N):
t = 0
c += 1
for i in range(N - ... | false | 41.666667 | [
"+from itertools import permutations as permi",
"-p = []",
"+ps = []",
"- p.append(list(map(int, input().split())))",
"-",
"-",
"-def dist(x1, y1, x2, y2):",
"- return sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)",
"-",
"-",
"+ u, v = list(map(int, input().split()))",
"+ ps.append((u, v))... | false | 0.041542 | 0.035343 | 1.175392 | [
"s173490258",
"s161913920"
] |
u634079249 | p03624 | python | s668492064 | s672981038 | 21 | 19 | 4,020 | 3,188 | Accepted | Accepted | 9.52 | import sys
import os
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]
iss = lambda: sys.stdin.... | import sys
import os
import math
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]
iss = lambd... | 30 | 29 | 846 | 814 | import sys
import os
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]
iss = lambda: sys.stdin.buffer.re... | import sys
import os
import math
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]
iss = lambda: sys.std... | false | 3.333333 | [
"+import math",
"- S = list(iss())",
"- for n in range(ord(\"a\"), ord(\"z\") + 1):",
"- if chr(n) not in S:",
"- print((chr(n)))",
"- exit()",
"- else:",
"- print(\"None\")",
"+ T = set(\"abcdefghijklmnopqrstuvwxyz\")",
"+ S = set(iss())",
"+ ... | false | 0.041731 | 0.038056 | 1.096573 | [
"s668492064",
"s672981038"
] |
u375616706 | p02556 | python | s243769427 | s108644086 | 520 | 359 | 152,176 | 107,936 | Accepted | Accepted | 30.96 | N=int(eval(input()))
P=[list(map(int,input().split())) for _ in range(N)]
L1=[]
L2=[]
L3=[]
L4=[]
for x,y in P:
L1.append(x+y)
L2.append(-x+y)
L3.append(x-y)
L4.append(-x-y)
L1=sorted(L1)
L2=sorted(L2)
L3=sorted(L3)
L4=sorted(L4)
ans=max(L1[-1]-L1[0],L2[-1]-L2[0],L3[-1]-L3[0],L4[-... | N=int(eval(input()))
Sum=[]
Sub=[]
for _ in range(N):
x,y = list(map(int,input().split()))
Sum.append(x+y)
Sub.append(x-y)
Sum = sorted(Sum)
Sub=sorted(Sub)
ans=max(abs(Sum[-1]-Sum[0]),abs(Sub[-1]-Sub[0]))
print(ans)
| 21 | 14 | 336 | 233 | N = int(eval(input()))
P = [list(map(int, input().split())) for _ in range(N)]
L1 = []
L2 = []
L3 = []
L4 = []
for x, y in P:
L1.append(x + y)
L2.append(-x + y)
L3.append(x - y)
L4.append(-x - y)
L1 = sorted(L1)
L2 = sorted(L2)
L3 = sorted(L3)
L4 = sorted(L4)
ans = max(L1[-1] - L1[0], L2[-1] - L2[0], L3... | N = int(eval(input()))
Sum = []
Sub = []
for _ in range(N):
x, y = list(map(int, input().split()))
Sum.append(x + y)
Sub.append(x - y)
Sum = sorted(Sum)
Sub = sorted(Sub)
ans = max(abs(Sum[-1] - Sum[0]), abs(Sub[-1] - Sub[0]))
print(ans)
| false | 33.333333 | [
"-P = [list(map(int, input().split())) for _ in range(N)]",
"-L1 = []",
"-L2 = []",
"-L3 = []",
"-L4 = []",
"-for x, y in P:",
"- L1.append(x + y)",
"- L2.append(-x + y)",
"- L3.append(x - y)",
"- L4.append(-x - y)",
"-L1 = sorted(L1)",
"-L2 = sorted(L2)",
"-L3 = sorted(L3)",
"... | false | 0.125778 | 0.06544 | 1.922033 | [
"s243769427",
"s108644086"
] |
u935558307 | p02863 | python | s942738563 | s289808457 | 245 | 146 | 145,920 | 75,256 | Accepted | Accepted | 40.41 | """
食べるのにかかる時間順にソートしてナップサックするのがよい。
dp[i][j]
"""
N,T = list(map(int,input().split()))
AB = [list(map(int,input().split())) for _ in range(N)]
AB.sort(key=lambda x: x[0])
dp = [[0]*(T) for _ in range(N+1)]
for i in range(1,N+1):
a,b = AB[i-1]
for j in range(1,T):
if j-a >= 0:
dp[i]... | N,T = list(map(int,input().split()))
AB = [list(map(int,input().split())) for _ in range(N)]
AB.sort()
dp = [0]*(T)
ans = 0
for i in range(N):
a,b = AB[i]
ans = max(ans,dp[-1]+b)
for j in range(T-1,-1,-1):
if j - a >= 0:
dp[j] = max(dp[j],dp[j-a]+b)
print(ans) | 21 | 13 | 494 | 299 | """
食べるのにかかる時間順にソートしてナップサックするのがよい。
dp[i][j]
"""
N, T = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x: x[0])
dp = [[0] * (T) for _ in range(N + 1)]
for i in range(1, N + 1):
a, b = AB[i - 1]
for j in range(1, T):
if j - a >= 0:
d... | N, T = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort()
dp = [0] * (T)
ans = 0
for i in range(N):
a, b = AB[i]
ans = max(ans, dp[-1] + b)
for j in range(T - 1, -1, -1):
if j - a >= 0:
dp[j] = max(dp[j], dp[j - a] + b)
print(ans)
| false | 38.095238 | [
"-\"\"\"",
"-食べるのにかかる時間順にソートしてナップサックするのがよい。",
"-dp[i][j]",
"-\"\"\"",
"-AB.sort(key=lambda x: x[0])",
"-dp = [[0] * (T) for _ in range(N + 1)]",
"-for i in range(1, N + 1):",
"- a, b = AB[i - 1]",
"- for j in range(1, T):",
"+AB.sort()",
"+dp = [0] * (T)",
"+ans = 0",
"+for i in range(... | false | 0.048578 | 0.047414 | 1.024562 | [
"s942738563",
"s289808457"
] |
u608088992 | p03476 | python | s993135641 | s442117689 | 904 | 254 | 8,984 | 5,432 | Accepted | Accepted | 71.9 | Num = [int(i) for i in range(2, 100001)]
Primes = [True for i in range(100001)]
Sim = [0 for i in range(100001)]
for i in range(2, 100001):
if Primes[i] == True:
j = i * 2
while j < 100001:
Primes[j] = False
j += i
for i in range(3, 100001):
if Primes[i] and... | import sys
def solve():
input = sys.stdin.readline
isPrime = [True] * (1 + 10**5)
isPrime[0] = isPrime[1] = False
Like = [0] * (1 + 10 ** 5)
for i in range(2, 1 + 10 ** 5):
if isPrime[i]:
k = 2 * i
while k <= 10 ** 5:
isPrime[k] = False
... | 21 | 27 | 515 | 695 | Num = [int(i) for i in range(2, 100001)]
Primes = [True for i in range(100001)]
Sim = [0 for i in range(100001)]
for i in range(2, 100001):
if Primes[i] == True:
j = i * 2
while j < 100001:
Primes[j] = False
j += i
for i in range(3, 100001):
if Primes[i] and Primes[(i + 1... | import sys
def solve():
input = sys.stdin.readline
isPrime = [True] * (1 + 10**5)
isPrime[0] = isPrime[1] = False
Like = [0] * (1 + 10**5)
for i in range(2, 1 + 10**5):
if isPrime[i]:
k = 2 * i
while k <= 10**5:
isPrime[k] = False
k +... | false | 22.222222 | [
"-Num = [int(i) for i in range(2, 100001)]",
"-Primes = [True for i in range(100001)]",
"-Sim = [0 for i in range(100001)]",
"-for i in range(2, 100001):",
"- if Primes[i] == True:",
"- j = i * 2",
"- while j < 100001:",
"- Primes[j] = False",
"- j += i",
"-f... | false | 0.474641 | 0.262728 | 1.806588 | [
"s993135641",
"s442117689"
] |
u994988729 | p03018 | python | s002800976 | s609983993 | 120 | 46 | 3,500 | 3,500 | Accepted | Accepted | 61.67 | S = "???" + eval(input()) + "???"
a = 0
ans = 0
i = 0
while i < len(S):
s = S[i]
if s == "A":
a += 1
i += 1
while i < len(S):
s1 = S[i]
s2 = S[i + 1]
if s1 == "A":
a += 1
i += 1
con... | S = eval(input())
S = S.replace("BC", "X")
a = 0
ans = 0
for s in S:
if s == "A":
a += 1
elif s == "X":
ans += a
else:
a = 0
print(ans) | 32 | 13 | 523 | 178 | S = "???" + eval(input()) + "???"
a = 0
ans = 0
i = 0
while i < len(S):
s = S[i]
if s == "A":
a += 1
i += 1
while i < len(S):
s1 = S[i]
s2 = S[i + 1]
if s1 == "A":
a += 1
i += 1
continue
elif ... | S = eval(input())
S = S.replace("BC", "X")
a = 0
ans = 0
for s in S:
if s == "A":
a += 1
elif s == "X":
ans += a
else:
a = 0
print(ans)
| false | 59.375 | [
"-S = \"???\" + eval(input()) + \"???\"",
"+S = eval(input())",
"+S = S.replace(\"BC\", \"X\")",
"-i = 0",
"-while i < len(S):",
"- s = S[i]",
"+for s in S:",
"- i += 1",
"- while i < len(S):",
"- s1 = S[i]",
"- s2 = S[i + 1]",
"- if s1 == \"A\... | false | 0.078109 | 0.09466 | 0.825161 | [
"s002800976",
"s609983993"
] |
u189023301 | p03739 | python | s749579112 | s362994379 | 105 | 88 | 14,828 | 14,332 | Accepted | Accepted | 16.19 | from functools import lru_cache
n = int(eval(input()))
s = list(map(int, input().split()))
@lru_cache(maxsize=None)
def cost_e():
res = 0
sum = 0
for j, y in enumerate(s, 1):
tmp = sum + y
if j & 1 and tmp >= 0:
sum = -1
res += abs(tmp) + 1
eli... | n = int(eval(input()))
s = list(map(int, input().split()))
def cost(t):
res = 0
sum = 0
for y in s:
sum += y
if sum * t <= 0:
res += abs(sum - t)
sum = t
t *= -1
return res
print((min(cost(1), cost(-1))))
| 40 | 17 | 845 | 281 | from functools import lru_cache
n = int(eval(input()))
s = list(map(int, input().split()))
@lru_cache(maxsize=None)
def cost_e():
res = 0
sum = 0
for j, y in enumerate(s, 1):
tmp = sum + y
if j & 1 and tmp >= 0:
sum = -1
res += abs(tmp) + 1
elif not j & 1 a... | n = int(eval(input()))
s = list(map(int, input().split()))
def cost(t):
res = 0
sum = 0
for y in s:
sum += y
if sum * t <= 0:
res += abs(sum - t)
sum = t
t *= -1
return res
print((min(cost(1), cost(-1))))
| false | 57.5 | [
"-from functools import lru_cache",
"-",
"-@lru_cache(maxsize=None)",
"-def cost_e():",
"+def cost(t):",
"- for j, y in enumerate(s, 1):",
"- tmp = sum + y",
"- if j & 1 and tmp >= 0:",
"- sum = -1",
"- res += abs(tmp) + 1",
"- elif not j & 1 and tmp... | false | 0.034425 | 0.054674 | 0.629648 | [
"s749579112",
"s362994379"
] |
u139984435 | p02658 | python | s724626437 | s410278566 | 94 | 60 | 21,556 | 23,624 | Accepted | Accepted | 36.17 | n = int(eval(input()))
l = [int(item) for item in input().split()]
l.sort()
product = 1
flag=0
for i in l:
product *= i
if product > int(10**18):
print("-1")
flag=1
break
if flag == 0:
print(product) | #!/usr/bin/env python3
import sys
def solve(N: int, A: "List[int]"):
if(0 in A):
print((0))
sys.exit()
sum_l = 1
for x in A:
sum_l *= x
if(sum_l > 10 **18):
print((-1))
sys.exit()
print(sum_l)
return
# Generated by 1.1... | 14 | 33 | 217 | 803 | n = int(eval(input()))
l = [int(item) for item in input().split()]
l.sort()
product = 1
flag = 0
for i in l:
product *= i
if product > int(10**18):
print("-1")
flag = 1
break
if flag == 0:
print(product)
| #!/usr/bin/env python3
import sys
def solve(N: int, A: "List[int]"):
if 0 in A:
print((0))
sys.exit()
sum_l = 1
for x in A:
sum_l *= x
if sum_l > 10**18:
print((-1))
sys.exit()
print(sum_l)
return
# Generated by 1.1.7.1 https://github.com/k... | false | 57.575758 | [
"-n = int(eval(input()))",
"-l = [int(item) for item in input().split()]",
"-l.sort()",
"-product = 1",
"-flag = 0",
"-for i in l:",
"- product *= i",
"- if product > int(10**18):",
"- print(\"-1\")",
"- flag = 1",
"- break",
"-if flag == 0:",
"- print(product)"... | false | 0.040559 | 0.039946 | 1.015347 | [
"s724626437",
"s410278566"
] |
u850243304 | p02725 | python | s283404262 | s321622149 | 140 | 96 | 31,756 | 31,588 | Accepted | Accepted | 31.43 | k,n = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
c = a[0] + (k - a[n-1])
for i in range(1,n):
c = max(c,a[i]-a[i-1])
print((k-c))
| k,n = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
c = a[0] + (k - a[n - 1])
d = max([a[i] - a[i - 1] for i in range(1, n)])
c = max(c,d)
print((k - c))
| 9 | 10 | 172 | 191 | k, n = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
c = a[0] + (k - a[n - 1])
for i in range(1, n):
c = max(c, a[i] - a[i - 1])
print((k - c))
| k, n = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
c = a[0] + (k - a[n - 1])
d = max([a[i] - a[i - 1] for i in range(1, n)])
c = max(c, d)
print((k - c))
| false | 10 | [
"-for i in range(1, n):",
"- c = max(c, a[i] - a[i - 1])",
"+d = max([a[i] - a[i - 1] for i in range(1, n)])",
"+c = max(c, d)"
] | false | 0.071998 | 0.09952 | 0.723454 | [
"s283404262",
"s321622149"
] |
u716530146 | p03943 | python | s176631897 | s232924362 | 299 | 263 | 64,364 | 63,852 | Accepted | Accepted | 12.04 | #!/usr/bin/env python3
import sys, itertools ,fractions
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0
a, b, c = list(map(int, input().split()))
for i in itertools.permutations([a, b, c], 3):
if i[0] == sum(i[1:]) or... | #!/usr/bin/env python3
import sys, itertools
from fractions import gcd
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0
a, b, c = list(map(int, input().split()))
for i in itertools.permutations([a, b, c], 3):
if i[0] ... | 16 | 17 | 388 | 404 | #!/usr/bin/env python3
import sys, itertools, fractions
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
sys.setrecursionlimit(10**8)
inf = float("inf")
ans = count = 0
a, b, c = list(map(int, input().split()))
for i in itertools.permutations([a, b, c], 3):
if i[0] == sum(i[1:]) or sum(i[:2]) =... | #!/usr/bin/env python3
import sys, itertools
from fractions import gcd
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
sys.setrecursionlimit(10**8)
inf = float("inf")
ans = count = 0
a, b, c = list(map(int, input().split()))
for i in itertools.permutations([a, b, c], 3):
if i[0] == sum(i[1:]) ... | false | 5.882353 | [
"-import sys, itertools, fractions",
"+import sys, itertools",
"+from fractions import gcd"
] | false | 0.047154 | 0.037104 | 1.270884 | [
"s176631897",
"s232924362"
] |
u514136877 | p02959 | python | s680731422 | s271360320 | 258 | 140 | 36,680 | 18,624 | Accepted | Accepted | 45.74 | from collections import defaultdict
if __name__=="__main__":
brave_n = int(eval(input()))
monster_dic = defaultdict(int)
brave_dic = defaultdict(int)
monster_n = list(map(int, input().split()))
brave_can = list(map(int, input().split()))
kill_count = 0
for i, m in enumerate(mon... | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
d_sum = sum(A)
for i in range(N):
if A[i] >= B[i]:
A[i] = A[i] - B[i]
else:
B[i] -= A[i]
A[i] = 0
if A[i+1] >= B[i]:
A[i+1] -= B[i]
B[i] = 0
... | 41 | 18 | 1,195 | 371 | from collections import defaultdict
if __name__ == "__main__":
brave_n = int(eval(input()))
monster_dic = defaultdict(int)
brave_dic = defaultdict(int)
monster_n = list(map(int, input().split()))
brave_can = list(map(int, input().split()))
kill_count = 0
for i, m in enumerate(monster_n):
... | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
d_sum = sum(A)
for i in range(N):
if A[i] >= B[i]:
A[i] = A[i] - B[i]
else:
B[i] -= A[i]
A[i] = 0
if A[i + 1] >= B[i]:
A[i + 1] -= B[i]
B[i] = 0
else:
... | false | 56.097561 | [
"-from collections import defaultdict",
"-",
"-if __name__ == \"__main__\":",
"- brave_n = int(eval(input()))",
"- monster_dic = defaultdict(int)",
"- brave_dic = defaultdict(int)",
"- monster_n = list(map(int, input().split()))",
"- brave_can = list(map(int, input().split()))",
"- ... | false | 0.040488 | 0.040549 | 0.998493 | [
"s680731422",
"s271360320"
] |
u879870653 | p04020 | python | s554787624 | s217009940 | 243 | 206 | 7,084 | 7,072 | Accepted | Accepted | 15.23 | N = int(eval(input()))
A = list(int(eval(input())) for i in range(N))
ans = 0
for i in range(N) :
ans += A[i]//2
if i != N-1 :
if A[i+1] >= 1 :
A[i+1] += A[i] % 2
print(ans)
| N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
ans = 0
cnt = 0
for a in A :
ans += (a+cnt) // 2
if a == 0 :
cnt = 0
else :
cnt = (a+cnt) % 2
print(ans)
| 10 | 14 | 200 | 203 | N = int(eval(input()))
A = list(int(eval(input())) for i in range(N))
ans = 0
for i in range(N):
ans += A[i] // 2
if i != N - 1:
if A[i + 1] >= 1:
A[i + 1] += A[i] % 2
print(ans)
| N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
ans = 0
cnt = 0
for a in A:
ans += (a + cnt) // 2
if a == 0:
cnt = 0
else:
cnt = (a + cnt) % 2
print(ans)
| false | 28.571429 | [
"-A = list(int(eval(input())) for i in range(N))",
"+A = [int(eval(input())) for i in range(N)]",
"-for i in range(N):",
"- ans += A[i] // 2",
"- if i != N - 1:",
"- if A[i + 1] >= 1:",
"- A[i + 1] += A[i] % 2",
"+cnt = 0",
"+for a in A:",
"+ ans += (a + cnt) // 2",
"+... | false | 0.040416 | 0.084884 | 0.476136 | [
"s554787624",
"s217009940"
] |
u621935300 | p02579 | python | s565106990 | s749401062 | 1,104 | 951 | 215,404 | 186,252 | Accepted | Accepted | 13.86 | # -*- coding: utf-8 -*-
import sys
from collections import defaultdict, deque
H,W=list(map(int, sys.stdin.readline().split()))
CH,CW=list(map(int, sys.stdin.readline().split()))
CH-=1
CW-=1
DH,DW=list(map(int, sys.stdin.readline().split()))
DH-=1
DW-=1
S=[ sys.stdin.readline().strip() for _ in range(H) ]
... | # -*- coding: utf-8 -*-
import sys
from collections import defaultdict, deque
H,W=list(map(int, sys.stdin.readline().split()))
CH,CW=list(map(int, sys.stdin.readline().split()))
CH-=1
CW-=1
DH,DW=list(map(int, sys.stdin.readline().split()))
DH-=1
DW-=1
S=[ sys.stdin.readline().strip() for _ in range(H) ]
... | 48 | 48 | 1,265 | 1,284 | # -*- coding: utf-8 -*-
import sys
from collections import defaultdict, deque
H, W = list(map(int, sys.stdin.readline().split()))
CH, CW = list(map(int, sys.stdin.readline().split()))
CH -= 1
CW -= 1
DH, DW = list(map(int, sys.stdin.readline().split()))
DH -= 1
DW -= 1
S = [sys.stdin.readline().strip() for _ in range(... | # -*- coding: utf-8 -*-
import sys
from collections import defaultdict, deque
H, W = list(map(int, sys.stdin.readline().split()))
CH, CW = list(map(int, sys.stdin.readline().split()))
CH -= 1
CW -= 1
DH, DW = list(map(int, sys.stdin.readline().split()))
DH -= 1
DW -= 1
S = [sys.stdin.readline().strip() for _ in range(... | false | 0 | [
"+ if (fro_h, fro_w) == (DH, DW):",
"+ print(d[(fro_h, fro_w)])",
"+ quit()",
"-if d[(DH, DW)] == float(\"inf\"):",
"- print(-1)",
"-else:",
"- print(d[(DH, DW)])",
"+print(-1)"
] | false | 0.155037 | 0.036202 | 4.282509 | [
"s565106990",
"s749401062"
] |
u226155577 | p03083 | python | s648791105 | s487825930 | 1,192 | 641 | 35,204 | 70,008 | Accepted | Accepted | 46.22 | import sys
B, W = list(map(int, sys.stdin.readline().split()))
MOD = 10**9 + 7
L = B+W
fact = [1]*(L+1)
rfact = [1]*(L+1)
for i in range(L):
fact[i+1] = r = fact[i] * (i+1) % MOD
rfact[i+1] = pow(r, MOD-2, MOD)
rev2 = pow(2, MOD-2, MOD)
p = q = 0
base = 1
ans = ["%d\n" % rev2]
for i in rang... | import sys
B, W = list(map(int, sys.stdin.readline().split()))
MOD = 10**9 + 7
L = B+W
fact = [1]*(L+1)
rfact = [1]*(L+1)
for i in range(L):
fact[i+1] = r = fact[i] * (i+1) % MOD
rfact[i+1] = pow(r, MOD-2, MOD)
rev2 = pow(2, MOD-2, MOD)
p = q = 0
base = 1
ans = ["%d\n" % rev2]
for i in rang... | 25 | 25 | 633 | 617 | import sys
B, W = list(map(int, sys.stdin.readline().split()))
MOD = 10**9 + 7
L = B + W
fact = [1] * (L + 1)
rfact = [1] * (L + 1)
for i in range(L):
fact[i + 1] = r = fact[i] * (i + 1) % MOD
rfact[i + 1] = pow(r, MOD - 2, MOD)
rev2 = pow(2, MOD - 2, MOD)
p = q = 0
base = 1
ans = ["%d\n" % rev2]
for i in rang... | import sys
B, W = list(map(int, sys.stdin.readline().split()))
MOD = 10**9 + 7
L = B + W
fact = [1] * (L + 1)
rfact = [1] * (L + 1)
for i in range(L):
fact[i + 1] = r = fact[i] * (i + 1) % MOD
rfact[i + 1] = pow(r, MOD - 2, MOD)
rev2 = pow(2, MOD - 2, MOD)
p = q = 0
base = 1
ans = ["%d\n" % rev2]
for i in rang... | false | 0 | [
"- p = (",
"- p + ((fact[i - 1] * rfact[B - 1] % MOD) * rfact[i - B] % MOD) * base % MOD",
"- ) % MOD",
"+ p = (p + (fact[i - 1] * rfact[B - 1] * rfact[i - B] % MOD) * base % MOD) % MOD",
"- q = (",
"- q + ((fact[i - 1] * rfact[W - 1] % MOD) * rfact[i - W]... | false | 0.038442 | 0.058631 | 0.655672 | [
"s648791105",
"s487825930"
] |
u314089899 | p02554 | python | s685249525 | s425124896 | 31 | 26 | 9,200 | 9,104 | Accepted | Accepted | 16.13 | N = int(eval(input()))
MOD_BY = 10**9 + 7
#全通り 10**(N)
#0を1個も含まない 9**(N)
#9を1個も含まない 9**(N)
#0も9を1個も含まない 8**(N)
#https://wakabame.hatenablog.com/entry/2017/09/21/012844
#a**n mod pの高速計算
def power_func(a,n,p):
bi = str(format(n,"b"))#2進表現に
res = 1
for i in range(len(bi)):
res = (res*re... | N = int(eval(input()))
MOD_BY = 10**9 + 7
a = pow(10,N,MOD_BY)
b = pow(9,N,MOD_BY)
c = pow(8,N,MOD_BY)
ans = a - 2*b + c
print((ans%MOD_BY)) | 24 | 8 | 518 | 142 | N = int(eval(input()))
MOD_BY = 10**9 + 7
# 全通り 10**(N)
# 0を1個も含まない 9**(N)
# 9を1個も含まない 9**(N)
# 0も9を1個も含まない 8**(N)
# https://wakabame.hatenablog.com/entry/2017/09/21/012844
# a**n mod pの高速計算
def power_func(a, n, p):
bi = str(format(n, "b")) # 2進表現に
res = 1
for i in range(len(bi)):
res = (res * res)... | N = int(eval(input()))
MOD_BY = 10**9 + 7
a = pow(10, N, MOD_BY)
b = pow(9, N, MOD_BY)
c = pow(8, N, MOD_BY)
ans = a - 2 * b + c
print((ans % MOD_BY))
| false | 66.666667 | [
"-# 全通り 10**(N)",
"-# 0を1個も含まない 9**(N)",
"-# 9を1個も含まない 9**(N)",
"-# 0も9を1個も含まない 8**(N)",
"-# https://wakabame.hatenablog.com/entry/2017/09/21/012844",
"-# a**n mod pの高速計算",
"-def power_func(a, n, p):",
"- bi = str(format(n, \"b\")) # 2進表現に",
"- res = 1",
"- for i in range(len(bi)):",
"... | false | 0.042965 | 0.042606 | 1.008428 | [
"s685249525",
"s425124896"
] |
u277312083 | p02882 | python | s854127664 | s185824072 | 21 | 17 | 3,316 | 3,064 | Accepted | Accepted | 19.05 | from math import pi, sin, cos, tan
EPS = 0.0000000001
def f(a, b, theta):
if theta > pi * 0.5 - EPS:
ret = 0.0
elif a * tan(theta) <= b:
ret = a**2 * b - a**3 * tan(theta) * 0.5
else:
ret = a * b**2 * 0.5 / tan(theta)
return ret
a, b, x = list(map(int, input().spl... | from math import pi, tan
EPS = 0.0000000001
def f(a, b, theta):
if theta > pi * 0.5 - EPS:
ret = 0.0
elif a * tan(theta) <= b:
ret = a**2 * b - a**3 * tan(theta) * 0.5
else:
ret = a * b**2 * 0.5 / tan(theta)
return ret
a, b, x = list(map(int, input().split()))
... | 24 | 24 | 511 | 501 | from math import pi, sin, cos, tan
EPS = 0.0000000001
def f(a, b, theta):
if theta > pi * 0.5 - EPS:
ret = 0.0
elif a * tan(theta) <= b:
ret = a**2 * b - a**3 * tan(theta) * 0.5
else:
ret = a * b**2 * 0.5 / tan(theta)
return ret
a, b, x = list(map(int, input().split()))
ok =... | from math import pi, tan
EPS = 0.0000000001
def f(a, b, theta):
if theta > pi * 0.5 - EPS:
ret = 0.0
elif a * tan(theta) <= b:
ret = a**2 * b - a**3 * tan(theta) * 0.5
else:
ret = a * b**2 * 0.5 / tan(theta)
return ret
a, b, x = list(map(int, input().split()))
ok = pi * 0.5
... | false | 0 | [
"-from math import pi, sin, cos, tan",
"+from math import pi, tan"
] | false | 0.036859 | 0.080986 | 0.455132 | [
"s854127664",
"s185824072"
] |
u493520238 | p02823 | python | s506806910 | s485030084 | 86 | 74 | 61,764 | 61,876 | Accepted | Accepted | 13.95 | n,a,b = list(map(int, input().split()))
diff = abs(a-b)
if diff%2 == 0:
print((diff//2))
exit()
adiff = min( abs(a-1), abs(n-a) )
bdiff = min( abs(b-1), abs(n-b) )
mdiff = min(adiff,bdiff)
ans = mdiff + 1 + diff//2
print(ans) | n,a,b = list(map(int, input().split()))
diff = abs(a-b)
if diff%2 == 0:
print((diff//2))
else:
near = min(abs(a-1), abs(n-b))
ans = near + (diff+1)//2
print(ans) | 13 | 8 | 240 | 176 | n, a, b = list(map(int, input().split()))
diff = abs(a - b)
if diff % 2 == 0:
print((diff // 2))
exit()
adiff = min(abs(a - 1), abs(n - a))
bdiff = min(abs(b - 1), abs(n - b))
mdiff = min(adiff, bdiff)
ans = mdiff + 1 + diff // 2
print(ans)
| n, a, b = list(map(int, input().split()))
diff = abs(a - b)
if diff % 2 == 0:
print((diff // 2))
else:
near = min(abs(a - 1), abs(n - b))
ans = near + (diff + 1) // 2
print(ans)
| false | 38.461538 | [
"- exit()",
"-adiff = min(abs(a - 1), abs(n - a))",
"-bdiff = min(abs(b - 1), abs(n - b))",
"-mdiff = min(adiff, bdiff)",
"-ans = mdiff + 1 + diff // 2",
"-print(ans)",
"+else:",
"+ near = min(abs(a - 1), abs(n - b))",
"+ ans = near + (diff + 1) // 2",
"+ print(ans)"
] | false | 0.036827 | 0.042413 | 0.868299 | [
"s506806910",
"s485030084"
] |
u748377775 | p03353 | python | s138661508 | s849825836 | 49 | 42 | 5,680 | 5,196 | Accepted | Accepted | 14.29 | s=eval(input())
K=int(eval(input()))
sub_list=[]
i,j=0,1
while True:
if(i+j>=len(s) and i==len(s)):
break
else:
sub_list.append(s[i:i+j])
if(j<=K):
j+=1
else:
i+=1
j=1
set_list=set(sub_list)
dict_list=list(set_list)
dict_lis... | s=eval(input())
K=int(eval(input()))
sub_list=[]
for i in range(len(s)):
for j in range(1,K+1):
if(i+j<=len(s)):
sub_list.append(s[i:i+j])
sub_set=set(sub_list)
sub_dict=sorted(sub_set,key=str)
print((sub_dict[K-1])) | 21 | 14 | 348 | 243 | s = eval(input())
K = int(eval(input()))
sub_list = []
i, j = 0, 1
while True:
if i + j >= len(s) and i == len(s):
break
else:
sub_list.append(s[i : i + j])
if j <= K:
j += 1
else:
i += 1
j = 1
set_list = set(sub_list)
dict_list = list(set_list... | s = eval(input())
K = int(eval(input()))
sub_list = []
for i in range(len(s)):
for j in range(1, K + 1):
if i + j <= len(s):
sub_list.append(s[i : i + j])
sub_set = set(sub_list)
sub_dict = sorted(sub_set, key=str)
print((sub_dict[K - 1]))
| false | 33.333333 | [
"-i, j = 0, 1",
"-while True:",
"- if i + j >= len(s) and i == len(s):",
"- break",
"- else:",
"- sub_list.append(s[i : i + j])",
"- if j <= K:",
"- j += 1",
"- else:",
"- i += 1",
"- j = 1",
"-set_list = set(sub_list)",
"-di... | false | 0.110067 | 0.047798 | 2.302726 | [
"s138661508",
"s849825836"
] |
u886747123 | p02883 | python | s134401140 | s087369415 | 566 | 509 | 37,276 | 38,748 | Accepted | Accepted | 10.07 | # E - Gluttony
import numpy as np
N, K = list(map(int, input().split()))
A = np.array(sorted(list(map(int, input().split()))))
F = np.array(sorted((list(map(int, input().split()))), reverse = True))
lower = 0
upper = A[-1] * F[0]
# 達成可能な最高成績を二分探索する
while lower <= upper:
result = (lower + upper) // ... | # E - Gluttony
import numpy as np
# np.arrayに変換する場合はsortedを使うよりnp.sortを使う方が少し速い
N, K = list(map(int, input().split()))
A = np.sort(np.array((list(map(int, input().split())))))
F = np.sort(np.array(sorted((list(map(int, input().split()))))))[::-1]
lower = 0
upper = A[-1] * F[0]
# 達成可能な最高成績を二分探索する
while ... | 23 | 24 | 574 | 623 | # E - Gluttony
import numpy as np
N, K = list(map(int, input().split()))
A = np.array(sorted(list(map(int, input().split()))))
F = np.array(sorted((list(map(int, input().split()))), reverse=True))
lower = 0
upper = A[-1] * F[0]
# 達成可能な最高成績を二分探索する
while lower <= upper:
result = (lower + upper) // 2
# resultを達成可... | # E - Gluttony
import numpy as np
# np.arrayに変換する場合はsortedを使うよりnp.sortを使う方が少し速い
N, K = list(map(int, input().split()))
A = np.sort(np.array((list(map(int, input().split())))))
F = np.sort(np.array(sorted((list(map(int, input().split()))))))[::-1]
lower = 0
upper = A[-1] * F[0]
# 達成可能な最高成績を二分探索する
while lower <= upper:
... | false | 4.166667 | [
"+# np.arrayに変換する場合はsortedを使うよりnp.sortを使う方が少し速い",
"-A = np.array(sorted(list(map(int, input().split()))))",
"-F = np.array(sorted((list(map(int, input().split()))), reverse=True))",
"+A = np.sort(np.array((list(map(int, input().split())))))",
"+F = np.sort(np.array(sorted((list(map(int, input().split())))))... | false | 0.547418 | 1.010155 | 0.541915 | [
"s134401140",
"s087369415"
] |
u072053884 | p00777 | python | s399473490 | s670661022 | 320 | 270 | 6,312 | 6,296 | Accepted | Accepted | 15.62 | def solve():
from collections import deque
def dfs(start, turn=False):
path = deque()
path.append(start)
bridge_lengths = deque()
bridge_lengths.append(0)
unvisited = [True] * (n + 1)
unvisited[start] = False
rest = core_... | def solve():
from collections import deque
def bfs(start):
q = deque()
q.append(start)
unvisited = [True] * (n + 1)
unvisited[start] = False
distances = [0] * (n + 1)
while q:
x = q.popleft()
for i, d... | 74 | 54 | 2,118 | 1,511 | def solve():
from collections import deque
def dfs(start, turn=False):
path = deque()
path.append(start)
bridge_lengths = deque()
bridge_lengths.append(0)
unvisited = [True] * (n + 1)
unvisited[start] = False
rest = core_islands_num - 1
diameter =... | def solve():
from collections import deque
def bfs(start):
q = deque()
q.append(start)
unvisited = [True] * (n + 1)
unvisited[start] = False
distances = [0] * (n + 1)
while q:
x = q.popleft()
for i, d in adj_list[x]:
if unv... | false | 27.027027 | [
"- def dfs(start, turn=False):",
"- path = deque()",
"- path.append(start)",
"- bridge_lengths = deque()",
"- bridge_lengths.append(0)",
"+ def bfs(start):",
"+ q = deque()",
"+ q.append(start)",
"- rest = core_islands_num - 1",
"- diam... | false | 0.037869 | 0.038134 | 0.993038 | [
"s399473490",
"s670661022"
] |
u116038906 | p02597 | python | s464061506 | s434968365 | 65 | 46 | 17,256 | 17,212 | Accepted | Accepted | 29.23 | # 初期入力
from bisect import bisect_left
import sys
#input = sys.stdin.readline #文字列では使わない
N = int(eval(input()))
c =input().strip()
ans =0
w =[i for i, x in enumerate(c) if x == 'W']
r =[i for i, x in enumerate(c) if x == 'R']
w_num =len(w) #全体でWの数
r_num =len(r) #全体でRの数
ans =bisect_left(r,r_num)
print((r_n... |
# 初期入力
from bisect import bisect_left
import sys
#input = sys.stdin.readline #文字列では使わない
N = int(eval(input()))
c =input().strip()
ans =0
r =[i for i, x in enumerate(c) if x == 'R'] #全体の中でRのIndex
r_num =len(r) #全体でRの数
ans =bisect_left(r,r_num) #呪われないためのRとWの境界
print((r_num -ans)) #境界より右側のRの数 | 14 | 13 | 321 | 297 | # 初期入力
from bisect import bisect_left
import sys
# input = sys.stdin.readline #文字列では使わない
N = int(eval(input()))
c = input().strip()
ans = 0
w = [i for i, x in enumerate(c) if x == "W"]
r = [i for i, x in enumerate(c) if x == "R"]
w_num = len(w) # 全体でWの数
r_num = len(r) # 全体でRの数
ans = bisect_left(r, r_num)
print((r_n... | # 初期入力
from bisect import bisect_left
import sys
# input = sys.stdin.readline #文字列では使わない
N = int(eval(input()))
c = input().strip()
ans = 0
r = [i for i, x in enumerate(c) if x == "R"] # 全体の中でRのIndex
r_num = len(r) # 全体でRの数
ans = bisect_left(r, r_num) # 呪われないためのRとWの境界
print((r_num - ans)) # 境界より右側のRの数
| false | 7.142857 | [
"-w = [i for i, x in enumerate(c) if x == \"W\"]",
"-r = [i for i, x in enumerate(c) if x == \"R\"]",
"-w_num = len(w) # 全体でWの数",
"+r = [i for i, x in enumerate(c) if x == \"R\"] # 全体の中でRのIndex",
"-ans = bisect_left(r, r_num)",
"-print((r_num - ans))",
"+ans = bisect_left(r, r_num) # 呪われないためのRとWの境界",... | false | 0.035708 | 0.07628 | 0.468125 | [
"s464061506",
"s434968365"
] |
u887207211 | p03317 | python | s511834688 | s952212087 | 41 | 18 | 13,880 | 3,060 | Accepted | Accepted | 56.1 | N, K = list(map(int,input().split()))
A = list(map(int,input().split()))
print(((N-2)//(K-1)+1)) | N, K = list(map(int,input().split()))
print(((N-2)//(K-1)+1)) | 3 | 2 | 90 | 54 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
print(((N - 2) // (K - 1) + 1))
| N, K = list(map(int, input().split()))
print(((N - 2) // (K - 1) + 1))
| false | 33.333333 | [
"-A = list(map(int, input().split()))"
] | false | 0.105913 | 0.038199 | 2.77266 | [
"s511834688",
"s952212087"
] |
u844646164 | p03032 | python | s187661854 | s922333119 | 40 | 31 | 3,064 | 3,188 | Accepted | Accepted | 22.5 | n, k = list(map(int, input().split()))
v = list(map(int, input().split()))
ans = 0
for a in range(min(n, k)+1):
for b in range(min(n, k)-a+1):
bag = []
bag += v[:a]
bag += v[len(v)-b:]
bag.sort()
if len(bag) > 0:
for c in range(k-a-b):
if bag[0] < 0:
bag.pop(0)
... | N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
ans = 0
for i in range(K+1):
for j in range(N, max(N-1-(K-i), i-1), -1):
bag = []
bag += V[:i] + V[j:]
bag.sort()
idx = 0
if len(bag) == 0:
continue
if len(bag) == 1:
ans = max(ans, sum(bag))
... | 18 | 23 | 407 | 550 | n, k = list(map(int, input().split()))
v = list(map(int, input().split()))
ans = 0
for a in range(min(n, k) + 1):
for b in range(min(n, k) - a + 1):
bag = []
bag += v[:a]
bag += v[len(v) - b :]
bag.sort()
if len(bag) > 0:
for c in range(k - a - b):
... | N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
ans = 0
for i in range(K + 1):
for j in range(N, max(N - 1 - (K - i), i - 1), -1):
bag = []
bag += V[:i] + V[j:]
bag.sort()
idx = 0
if len(bag) == 0:
continue
if len(bag) == 1:
... | false | 21.73913 | [
"-n, k = list(map(int, input().split()))",
"-v = list(map(int, input().split()))",
"+N, K = list(map(int, input().split()))",
"+V = list(map(int, input().split()))",
"-for a in range(min(n, k) + 1):",
"- for b in range(min(n, k) - a + 1):",
"+for i in range(K + 1):",
"+ for j in range(N, max(N -... | false | 0.047618 | 0.045754 | 1.040719 | [
"s187661854",
"s922333119"
] |
u761320129 | p03971 | python | s379340695 | s055893606 | 86 | 70 | 6,344 | 9,204 | Accepted | Accepted | 18.6 | N,A,B = map(int,input().split())
S = input()
a = b = 0
ans = []
for c in S:
if c=='a':
if a+b < A+B:
a += 1
ans.append('Yes')
else:
ans.append('No')
elif c=='b':
if a+b < A+B and b < B:
b += 1
ans.append('Yes')
... | N,A,B = list(map(int,input().split()))
S = eval(input())
ok = foreign = 0
for c in S:
if c=='a':
if ok < A+B:
ok += 1
print('Yes')
continue
elif c=='b':
if ok < A+B and foreign < B:
ok += 1
foreign += 1
print(... | 21 | 17 | 423 | 353 | N, A, B = map(int, input().split())
S = input()
a = b = 0
ans = []
for c in S:
if c == "a":
if a + b < A + B:
a += 1
ans.append("Yes")
else:
ans.append("No")
elif c == "b":
if a + b < A + B and b < B:
b += 1
ans.append("Yes")
... | N, A, B = list(map(int, input().split()))
S = eval(input())
ok = foreign = 0
for c in S:
if c == "a":
if ok < A + B:
ok += 1
print("Yes")
continue
elif c == "b":
if ok < A + B and foreign < B:
ok += 1
foreign += 1
print("Yes... | false | 19.047619 | [
"-N, A, B = map(int, input().split())",
"-S = input()",
"-a = b = 0",
"-ans = []",
"+N, A, B = list(map(int, input().split()))",
"+S = eval(input())",
"+ok = foreign = 0",
"- if a + b < A + B:",
"- a += 1",
"- ans.append(\"Yes\")",
"- else:",
"- a... | false | 0.042564 | 0.117318 | 0.362808 | [
"s379340695",
"s055893606"
] |
u844789719 | p03054 | python | s721870608 | s590224550 | 214 | 180 | 3,888 | 3,784 | Accepted | Accepted | 15.89 | H, W, N = [int(_) for _ in input().split()]
R, C = [int(_) for _ in input().split()]
S = eval(input())
T = eval(input())
#drop by up
r = R
for i in range(N):
if S[i] == 'U':
r -= 1
if r == 0:
print('NO')
exit()
if T[i] == 'D' and r < H:
r += 1
#d... | H, W, N = [int(_) for _ in input().split()]
R, C = [int(_) for _ in input().split()]
S = eval(input())
T = eval(input())
imin = 1
imax = H
jmin = 1
jmax = W
for n in range(N - 1, -1, -1):
s = S[n]
t = T[n]
if t == 'U':
imax = min(imax + 1, H)
elif t == 'D':
imin = max(i... | 50 | 36 | 907 | 740 | H, W, N = [int(_) for _ in input().split()]
R, C = [int(_) for _ in input().split()]
S = eval(input())
T = eval(input())
# drop by up
r = R
for i in range(N):
if S[i] == "U":
r -= 1
if r == 0:
print("NO")
exit()
if T[i] == "D" and r < H:
r += 1
# drop by down
r = ... | H, W, N = [int(_) for _ in input().split()]
R, C = [int(_) for _ in input().split()]
S = eval(input())
T = eval(input())
imin = 1
imax = H
jmin = 1
jmax = W
for n in range(N - 1, -1, -1):
s = S[n]
t = T[n]
if t == "U":
imax = min(imax + 1, H)
elif t == "D":
imin = max(imin - 1, 1)
el... | false | 28 | [
"-# drop by up",
"-r = R",
"-for i in range(N):",
"- if S[i] == \"U\":",
"- r -= 1",
"- if r == 0:",
"- print(\"NO\")",
"- exit()",
"- if T[i] == \"D\" and r < H:",
"- r += 1",
"-# drop by down",
"-r = R",
"-for i in range(N):",
"- if S[i... | false | 0.032682 | 0.077378 | 0.422372 | [
"s721870608",
"s590224550"
] |
u398175819 | p02900 | python | s195376031 | s340797539 | 388 | 193 | 3,188 | 3,436 | Accepted | Accepted | 50.26 | A,B = list(map(int, input().split()))
#解法の大まかな流れ
# AとBの素因数をそれぞれ計算し、And集合の長さを出す
# 数Nの素因数の算出方法
# 基本的には、Nを小さい数から順に割れるだけ割っていく(除算法)
# 割る数は素数だけでいい
# 課題:1~Aまでそれぞれ割って判定では計算量が足りない A <= 10^12なので
# アイディア①:素数一覧表を作成して、一覧表に入っている数字だけで、割れるか判定
# ⇒ 素数一覧表の作成の方が高コストになる可能性高い
# アイディア②: eratosthenesの篩の応用
def Soinsu(N):... |
from collections import defaultdict as dd
A,B = list(map(int,input().split()))
def get_p(n):
th = round(n**0.5)
ans = (n,1)
for i in range(2,th+1):
if n % i == 0:
ans = (i,n//i)
break
return(ans)
def get_yakusu(n):
flag = 1
pn_dic = ... | 50 | 48 | 1,246 | 944 | A, B = list(map(int, input().split()))
# 解法の大まかな流れ
# AとBの素因数をそれぞれ計算し、And集合の長さを出す
# 数Nの素因数の算出方法
# 基本的には、Nを小さい数から順に割れるだけ割っていく(除算法)
# 割る数は素数だけでいい
# 課題:1~Aまでそれぞれ割って判定では計算量が足りない A <= 10^12なので
# アイディア①:素数一覧表を作成して、一覧表に入っている数字だけで、割れるか判定
# ⇒ 素数一覧表の作成の方が高コストになる可能性高い
# アイディア②: eratosthenesの篩の応用
def Soinsu(N):
soinsu = ... | from collections import defaultdict as dd
A, B = list(map(int, input().split()))
def get_p(n):
th = round(n**0.5)
ans = (n, 1)
for i in range(2, th + 1):
if n % i == 0:
ans = (i, n // i)
break
return ans
def get_yakusu(n):
flag = 1
pn_dic = dd(lambda: 0)
... | false | 4 | [
"+from collections import defaultdict as dd",
"+",
"-# 解法の大まかな流れ",
"-# AとBの素因数をそれぞれ計算し、And集合の長さを出す",
"-# 数Nの素因数の算出方法",
"-# 基本的には、Nを小さい数から順に割れるだけ割っていく(除算法)",
"-# 割る数は素数だけでいい",
"-# 課題:1~Aまでそれぞれ割って判定では計算量が足りない A <= 10^12なので",
"-# アイディア①:素数一覧表を作成して、一覧表に入っている数字だけで、割れるか判定",
"-# ⇒ 素数一覧表の作成の方が高コストに... | false | 0.038309 | 0.044601 | 0.858932 | [
"s195376031",
"s340797539"
] |
u254871849 | p03761 | python | s747030347 | s952933700 | 25 | 18 | 3,772 | 3,064 | Accepted | Accepted | 28 | from string import ascii_lowercase
n = int(eval(input()))
strings = [eval(input()) for _ in range(n)]
alphabets = [a for a in ascii_lowercase]
counts = []
for a in alphabets:
for i in range(n):
count = strings[i].count(a)
if count == 0:
break
if i == 0:
... | n = int(eval(input()))
strings = [eval(input()) for _ in range(n)]
chars = []
for s in strings:
chars += list(set(s))
used_in_all = []
for c in set(chars):
if chars.count(c) == n:
used_in_all.append(c)
if not used_in_all:
print('')
exit()
used_in_all.sort()
counts = []
... | 24 | 33 | 490 | 555 | from string import ascii_lowercase
n = int(eval(input()))
strings = [eval(input()) for _ in range(n)]
alphabets = [a for a in ascii_lowercase]
counts = []
for a in alphabets:
for i in range(n):
count = strings[i].count(a)
if count == 0:
break
if i == 0:
m = count
... | n = int(eval(input()))
strings = [eval(input()) for _ in range(n)]
chars = []
for s in strings:
chars += list(set(s))
used_in_all = []
for c in set(chars):
if chars.count(c) == n:
used_in_all.append(c)
if not used_in_all:
print("")
exit()
used_in_all.sort()
counts = []
for c in used_in_all:
... | false | 27.272727 | [
"-from string import ascii_lowercase",
"-",
"-alphabets = [a for a in ascii_lowercase]",
"+chars = []",
"+for s in strings:",
"+ chars += list(set(s))",
"+used_in_all = []",
"+for c in set(chars):",
"+ if chars.count(c) == n:",
"+ used_in_all.append(c)",
"+if not used_in_all:",
"+... | false | 0.049939 | 0.085429 | 0.584571 | [
"s747030347",
"s952933700"
] |
u869154953 | p03597 | python | s771327839 | s112337452 | 29 | 25 | 9,116 | 9,004 | Accepted | Accepted | 13.79 | N=int(eval(input()))
A =int(eval(input()))
X=N*N
print((X-A))
| N=int(eval(input()))
A=int(eval(input()))
print(((N*N)-A)) | 6 | 4 | 55 | 48 | N = int(eval(input()))
A = int(eval(input()))
X = N * N
print((X - A))
| N = int(eval(input()))
A = int(eval(input()))
print(((N * N) - A))
| false | 33.333333 | [
"-X = N * N",
"-print((X - A))",
"+print(((N * N) - A))"
] | false | 0.036898 | 0.037143 | 0.993395 | [
"s771327839",
"s112337452"
] |
u186838327 | p02881 | python | s775840188 | s736625417 | 181 | 116 | 39,188 | 3,268 | Accepted | Accepted | 35.91 | n = int(eval(input()))
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
#divisors.sort(reverse=True)
return divisors
l = make_divisors(n)
ans = fl... | n =int(eval(input()))
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
#divisors.sort(reverse=True)
return divisors
l = make_divisors(n)
ans = float... | 19 | 17 | 391 | 379 | n = int(eval(input()))
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
# divisors.sort(reverse=True)
return divisors
l = make_divisors(n)
ans = float("inf... | n = int(eval(input()))
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
# divisors.sort(reverse=True)
return divisors
l = make_divisors(n)
ans = float("inf... | false | 10.526316 | [
"-for a in l:",
"- b = n // a",
"- ans = min(ans, a + b - 2)",
"+for i in l:",
"+ ans = min(ans, i - 1 + n // i - 1)"
] | false | 0.127238 | 0.035788 | 3.555368 | [
"s775840188",
"s736625417"
] |
u150984829 | p02265 | python | s217979614 | s535719765 | 4,400 | 1,200 | 69,732 | 212,224 | Accepted | Accepted | 72.73 | import collections
d=collections.deque()
for _ in range(int(eval(input()))):
e=eval(input())
if'i'==e[0]:d.appendleft(e.split()[1])
else:
if' '==e[6]:
m=e.split()[1]
if m in d:d.remove(m)
elif len(e)%2:d.popleft()
else:d.pop()
print((*d))
| import collections,sys
d=collections.deque()
eval(input())
for e in sys.stdin.readlines():
if'i'==e[0]:d.appendleft(e.split()[1])
else:
if' '==e[6]:
m=e.split()[1]
if m in d:d.remove(m)
elif len(e)%2:d.pop()
else:d.popleft()
print((*d))
| 12 | 12 | 251 | 254 | import collections
d = collections.deque()
for _ in range(int(eval(input()))):
e = eval(input())
if "i" == e[0]:
d.appendleft(e.split()[1])
else:
if " " == e[6]:
m = e.split()[1]
if m in d:
d.remove(m)
elif len(e) % 2:
d.popleft()
... | import collections, sys
d = collections.deque()
eval(input())
for e in sys.stdin.readlines():
if "i" == e[0]:
d.appendleft(e.split()[1])
else:
if " " == e[6]:
m = e.split()[1]
if m in d:
d.remove(m)
elif len(e) % 2:
d.pop()
els... | false | 0 | [
"-import collections",
"+import collections, sys",
"-for _ in range(int(eval(input()))):",
"- e = eval(input())",
"+eval(input())",
"+for e in sys.stdin.readlines():",
"+ d.pop()",
"+ else:",
"- else:",
"- d.pop()"
] | false | 0.044842 | 0.084413 | 0.531216 | [
"s217979614",
"s535719765"
] |
u761989513 | p03111 | python | s749350775 | s699629340 | 136 | 103 | 3,064 | 3,064 | Accepted | Accepted | 24.26 | def dfs(i, A, B, C):
global ans
if i == n:
if A and B and C:
s = 0
ABC = [A, B, C]
for i in range(3):
s += (len(ABC[i]) - 1) * 10 + abs(sum(ABC[i]) - abc[i])
ans = min(ans, s)
else:
dfs(i + 1, A + [l[i]], B, C)
... | def dfs(i, A, B, C):
global ans
if i == n:
if A and B and C:
ans = min(ans, abs(a - sum(A)) + abs(b - sum(B)) + abs(c - sum(C)) + (len(A) + len(B) + len(C) - 3) * 10)
else:
# a の肉焼き器に乗せるか、 b の肉焼き器に乗せるか
dfs(i + 1, A, B, C)
dfs(i + 1, A + [L[i]], B, C)
... | 21 | 17 | 566 | 522 | def dfs(i, A, B, C):
global ans
if i == n:
if A and B and C:
s = 0
ABC = [A, B, C]
for i in range(3):
s += (len(ABC[i]) - 1) * 10 + abs(sum(ABC[i]) - abc[i])
ans = min(ans, s)
else:
dfs(i + 1, A + [l[i]], B, C)
dfs(i + 1... | def dfs(i, A, B, C):
global ans
if i == n:
if A and B and C:
ans = min(
ans,
abs(a - sum(A))
+ abs(b - sum(B))
+ abs(c - sum(C))
+ (len(A) + len(B) + len(C) - 3) * 10,
)
else:
# a の肉焼き器に乗せ... | false | 19.047619 | [
"- s = 0",
"- ABC = [A, B, C]",
"- for i in range(3):",
"- s += (len(ABC[i]) - 1) * 10 + abs(sum(ABC[i]) - abc[i])",
"- ans = min(ans, s)",
"+ ans = min(",
"+ ans,",
"+ abs(a - sum(A))",
"+ ... | false | 0.155257 | 0.123235 | 1.25985 | [
"s749350775",
"s699629340"
] |
u592248346 | p03012 | python | s258967714 | s335233610 | 19 | 17 | 3,060 | 3,060 | Accepted | Accepted | 10.53 | x = 10**9
n = int(eval(input()))
w = list(map(int,input().split()))
for i in range(n):
g,t = 0,0
for j in range(i):
g+=w[j]
for k in range(n-i):
t+=w[n-k-1]
x = min(x,abs(g-t))
print(x) | n = int(eval(input()))
a = list(map(int,input().split()))
s,g = sum(a),0
ans = s
for i in a:
g+=i
s-=i
ans = min(ans,abs(s-g))
print(ans) | 11 | 9 | 221 | 151 | x = 10**9
n = int(eval(input()))
w = list(map(int, input().split()))
for i in range(n):
g, t = 0, 0
for j in range(i):
g += w[j]
for k in range(n - i):
t += w[n - k - 1]
x = min(x, abs(g - t))
print(x)
| n = int(eval(input()))
a = list(map(int, input().split()))
s, g = sum(a), 0
ans = s
for i in a:
g += i
s -= i
ans = min(ans, abs(s - g))
print(ans)
| false | 18.181818 | [
"-x = 10**9",
"-w = list(map(int, input().split()))",
"-for i in range(n):",
"- g, t = 0, 0",
"- for j in range(i):",
"- g += w[j]",
"- for k in range(n - i):",
"- t += w[n - k - 1]",
"- x = min(x, abs(g - t))",
"-print(x)",
"+a = list(map(int, input().split()))",
"+s... | false | 0.044727 | 0.049124 | 0.910491 | [
"s258967714",
"s335233610"
] |
u489959379 | p03818 | python | s316780492 | s436891817 | 65 | 57 | 21,968 | 22,032 | Accepted | Accepted | 12.31 | import sys
from collections import Counter
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
D = Counter(A)
ev = 0
od = 0
for k, v in list(D.items()):
... | import sys
from collections import Counter
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
D = Counter(A)
ev = 0
for k, v in list(D.items()):
if v % ... | 28 | 24 | 514 | 436 | import sys
from collections import Counter
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
D = Counter(A)
ev = 0
od = 0
for k, v in list(D.items()):
if v % 2 == 0:
... | import sys
from collections import Counter
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
D = Counter(A)
ev = 0
for k, v in list(D.items()):
if v % 2 == 0:
e... | false | 14.285714 | [
"- od = 0",
"- else:",
"- od += 1",
"- if ev % 2 == 0:",
"- print((ev + od))",
"- else:",
"- print((ev + od - 1))",
"+ print((len(D) if ev % 2 == 0 else len(D) - 1))"
] | false | 0.040439 | 0.151449 | 0.267013 | [
"s316780492",
"s436891817"
] |
u673361376 | p03425 | python | s725635963 | s202510586 | 463 | 183 | 43,864 | 3,572 | Accepted | Accepted | 60.48 | from functools import reduce
from itertools import combinations
import copy
N = int(eval(input()))
S = {key: 0 for key in 'MARCH'}
for _ in range(N):
s = eval(input())
if s[0] in S:
S[s[0]] += 1
newS = copy.deepcopy(S)
keys = []
for key, value in list(S.items()):
if value == 0: del newS[key]
... | import functools
import itertools
import operator
required_char = 'MARCH'
N = int(eval(input()))
name_counter = {s: 0 for s in required_char}
for _ in range(N):
S = eval(input())
if S[0] in required_char:
name_counter[S[0]] += 1
ans = 0
for cmb in itertools.combinations(list(name_counter.va... | 25 | 15 | 490 | 375 | from functools import reduce
from itertools import combinations
import copy
N = int(eval(input()))
S = {key: 0 for key in "MARCH"}
for _ in range(N):
s = eval(input())
if s[0] in S:
S[s[0]] += 1
newS = copy.deepcopy(S)
keys = []
for key, value in list(S.items()):
if value == 0:
del newS[key... | import functools
import itertools
import operator
required_char = "MARCH"
N = int(eval(input()))
name_counter = {s: 0 for s in required_char}
for _ in range(N):
S = eval(input())
if S[0] in required_char:
name_counter[S[0]] += 1
ans = 0
for cmb in itertools.combinations(list(name_counter.values()), 3):... | false | 40 | [
"-from functools import reduce",
"-from itertools import combinations",
"-import copy",
"+import functools",
"+import itertools",
"+import operator",
"+required_char = \"MARCH\"",
"-S = {key: 0 for key in \"MARCH\"}",
"+name_counter = {s: 0 for s in required_char}",
"- s = eval(input())",
"- ... | false | 0.044566 | 0.036975 | 1.205276 | [
"s725635963",
"s202510586"
] |
u476604182 | p03330 | python | s951159583 | s215534369 | 263 | 197 | 43,228 | 21,804 | Accepted | Accepted | 25.1 | from itertools import permutations
N, C = list(map(int, input().split()))
d = [[0]*C for i in range(C)]
for i in range(C):
d[i] = [int(c) for c in input().split()]
grid = [[0]*C for i in range(3)]
for i in range(N):
inf = [int(c)-1 for c in input().split()]
for j in range(N):
x = (j+i+2)%3
g... | from itertools import permutations
N, C, *L = list(map(int, open(0).read().split()))
ls =[[0]*(C+1) for i in range(3)]
D = L[:C*C]
X = L[C*C:]
for i in range(N):
for j in range(N):
c = X[i*N+j]
ls[(i+j)%3][c] += 1
cost = [[0]*(C+1) for i in range(3)]
for i in range(3):
n = sum(ls[i])
for j in ... | 31 | 20 | 668 | 526 | from itertools import permutations
N, C = list(map(int, input().split()))
d = [[0] * C for i in range(C)]
for i in range(C):
d[i] = [int(c) for c in input().split()]
grid = [[0] * C for i in range(3)]
for i in range(N):
inf = [int(c) - 1 for c in input().split()]
for j in range(N):
x = (j + i + 2) ... | from itertools import permutations
N, C, *L = list(map(int, open(0).read().split()))
ls = [[0] * (C + 1) for i in range(3)]
D = L[: C * C]
X = L[C * C :]
for i in range(N):
for j in range(N):
c = X[i * N + j]
ls[(i + j) % 3][c] += 1
cost = [[0] * (C + 1) for i in range(3)]
for i in range(3):
n ... | false | 35.483871 | [
"-N, C = list(map(int, input().split()))",
"-d = [[0] * C for i in range(C)]",
"-for i in range(C):",
"- d[i] = [int(c) for c in input().split()]",
"-grid = [[0] * C for i in range(3)]",
"+N, C, *L = list(map(int, open(0).read().split()))",
"+ls = [[0] * (C + 1) for i in range(3)]",
"+D = L[: C * C... | false | 0.038137 | 0.120641 | 0.316115 | [
"s951159583",
"s215534369"
] |
u499381410 | p02763 | python | s740151469 | s395953436 | 823 | 620 | 164,948 | 214,548 | Accepted | Accepted | 24.67 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, ... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
from copy import deepcopy
import string
from bisect import bisect_left, bisect_right
from ma... | 76 | 80 | 2,082 | 1,951 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
fro... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
from copy import deepcopy
import string
from bisect import bisect_left, bisect_right
from math import ... | false | 5 | [
"+from copy import deepcopy",
"-import pprint",
"-sys.setrecursionlimit(10**9)",
"+sys.setrecursionlimit(2147483647)",
"- return list(map(int, sys.stdin.buffer.readline().split()))",
"+ return list(map(int, sys.stdin.readline().split()))",
"- return int(sys.stdin.buffer.readline())",
"+ re... | false | 0.061886 | 0.043718 | 1.415547 | [
"s740151469",
"s395953436"
] |
u119148115 | p02576 | python | s253244117 | s391084574 | 87 | 71 | 61,772 | 61,784 | Accepted | Accepted | 18.39 | import sys
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし
def ... | import sys
def MI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,X,T = MI()
print((T*((N+X-1)//X)))
| 13 | 5 | 526 | 115 | import sys
sys.setrecursionlimit(10**7)
def I():
return int(sys.stdin.readline().rstrip())
def MI():
return list(map(int, sys.stdin.readline().rstrip().split()))
def LI():
return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり
def LI2():
return list(map(int, sys.stdin.readline().r... | import sys
def MI():
return list(map(int, sys.stdin.readline().rstrip().split()))
N, X, T = MI()
print((T * ((N + X - 1) // X)))
| false | 61.538462 | [
"-",
"-sys.setrecursionlimit(10**7)",
"-",
"-",
"-def I():",
"- return int(sys.stdin.readline().rstrip())",
"-def LI():",
"- return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり",
"-",
"-",
"-def LI2():",
"- return list(map(int, sys.stdin.readline().rstrip())) # 空白なし"... | false | 0.045534 | 0.042896 | 1.061507 | [
"s253244117",
"s391084574"
] |
u136811344 | p02995 | python | s940588190 | s648466441 | 35 | 17 | 5,048 | 3,060 | Accepted | Accepted | 51.43 | from fractions import gcd
A, B, C, D = list(map(int, input().split()))
l = C * D // gcd(C, D)
x = (A - 1) - (A - 1) // C - (A - 1) // D + (A - 1) // l
y = B - B // C - B // D + B // l
print((y - x)) | def gcd(a,b):
while b:
a, b = b, a%b
return a
def lcm(a,b):
return a*b//gcd(a,b)
def g(X):
return X - X//C - X//D + X//lcm(C,D)
A,B,C,D=list(map(int, input().split()))
ans = g(B) - g(A-1)
print(ans) | 7 | 15 | 197 | 222 | from fractions import gcd
A, B, C, D = list(map(int, input().split()))
l = C * D // gcd(C, D)
x = (A - 1) - (A - 1) // C - (A - 1) // D + (A - 1) // l
y = B - B // C - B // D + B // l
print((y - x))
| def gcd(a, b):
while b:
a, b = b, a % b
return a
def lcm(a, b):
return a * b // gcd(a, b)
def g(X):
return X - X // C - X // D + X // lcm(C, D)
A, B, C, D = list(map(int, input().split()))
ans = g(B) - g(A - 1)
print(ans)
| false | 53.333333 | [
"-from fractions import gcd",
"+def gcd(a, b):",
"+ while b:",
"+ a, b = b, a % b",
"+ return a",
"+",
"+",
"+def lcm(a, b):",
"+ return a * b // gcd(a, b)",
"+",
"+",
"+def g(X):",
"+ return X - X // C - X // D + X // lcm(C, D)",
"+",
"-l = C * D // gcd(C, D)",
"-x ... | false | 0.008077 | 0.068091 | 0.118627 | [
"s940588190",
"s648466441"
] |
u308684517 | p03262 | python | s058455856 | s603100190 | 197 | 91 | 14,352 | 14,252 | Accepted | Accepted | 53.81 | def gcd(x, y):
if y == 0:
return x
else:
return gcd(y, x % y)
n, X = list(map(int, input().split()))
x = list(map(int, input().split()))
if len(x) == 1:
print((abs(x[0] - X)))
else:
x.sort()
s = x[1] - x[0]
for i in range(1, n-1):
s = gcd(s, x[i+1]-x[i])
a = 1
f... | def gcd(x, y):
if y == 0:
return x
else:
return gcd(y, x % y)
n, X = list(map(int, input().split()))
x = list(map(int, input().split()))
a = abs(x[0] - X)
for i in x[1:]:
a = gcd(a, abs(i - X))
print(a) | 19 | 12 | 378 | 235 | def gcd(x, y):
if y == 0:
return x
else:
return gcd(y, x % y)
n, X = list(map(int, input().split()))
x = list(map(int, input().split()))
if len(x) == 1:
print((abs(x[0] - X)))
else:
x.sort()
s = x[1] - x[0]
for i in range(1, n - 1):
s = gcd(s, x[i + 1] - x[i])
a = 1... | def gcd(x, y):
if y == 0:
return x
else:
return gcd(y, x % y)
n, X = list(map(int, input().split()))
x = list(map(int, input().split()))
a = abs(x[0] - X)
for i in x[1:]:
a = gcd(a, abs(i - X))
print(a)
| false | 36.842105 | [
"-if len(x) == 1:",
"- print((abs(x[0] - X)))",
"-else:",
"- x.sort()",
"- s = x[1] - x[0]",
"- for i in range(1, n - 1):",
"- s = gcd(s, x[i + 1] - x[i])",
"- a = 1",
"- for i in range(n):",
"- a = max(a, gcd(abs(X - x[i]), s))",
"- print(a)",
"+a = abs(x[0]... | false | 0.096133 | 0.035691 | 2.693516 | [
"s058455856",
"s603100190"
] |
u476604182 | p03480 | python | s287247915 | s659122138 | 186 | 60 | 43,016 | 5,492 | Accepted | Accepted | 67.74 | S = eval(input())
j = 0
m = S[0]
ls = []
for i in range(len(S)):
if m!=S[i]:
ls += [i-j]
j = i
m = S[i]
ls += [len(S)-j]
N = len(ls)
if N<3:
print((max(ls)))
else:
ans = float('inf')
sls = [ls[0]]
for i in range(1,N):
sls += [sls[-1]+ls[i]]
for i in range(N-1):
ans = m... | def main():
S = eval(input())
j = 0
m = S[0]
ls = []
for i in range(len(S)):
if m!=S[i]:
ls.append(i-j)
j = i
m = S[i]
ls.append(len(S)-j)
N = len(ls)
if N<3:
print((max(ls)))
else:
ans = float('inf')
sls = [ls[0]]
for i in range(1,N):
sls ... | 21 | 24 | 361 | 448 | S = eval(input())
j = 0
m = S[0]
ls = []
for i in range(len(S)):
if m != S[i]:
ls += [i - j]
j = i
m = S[i]
ls += [len(S) - j]
N = len(ls)
if N < 3:
print((max(ls)))
else:
ans = float("inf")
sls = [ls[0]]
for i in range(1, N):
sls += [sls[-1] + ls[i]]
for i in ran... | def main():
S = eval(input())
j = 0
m = S[0]
ls = []
for i in range(len(S)):
if m != S[i]:
ls.append(i - j)
j = i
m = S[i]
ls.append(len(S) - j)
N = len(ls)
if N < 3:
print((max(ls)))
else:
ans = float("inf")
sls = [... | false | 12.5 | [
"-S = eval(input())",
"-j = 0",
"-m = S[0]",
"-ls = []",
"-for i in range(len(S)):",
"- if m != S[i]:",
"- ls += [i - j]",
"- j = i",
"- m = S[i]",
"-ls += [len(S) - j]",
"-N = len(ls)",
"-if N < 3:",
"- print((max(ls)))",
"-else:",
"- ans = float(\"inf\")",... | false | 0.04478 | 0.044818 | 0.999154 | [
"s287247915",
"s659122138"
] |
u392319141 | p03912 | python | s208135770 | s951597885 | 467 | 222 | 19,044 | 36,056 | Accepted | Accepted | 52.46 | from collections import Counter
N, M = list(map(int, input().split()))
X = list(map(int, input().split()))
modGrp = [[] for _ in range(M)]
for x in X:
modGrp[x % M].append(x)
ans = len(modGrp[0]) // 2
modGrp[0] = []
if M % 2 == 0:
ans += len(modGrp[M // 2]) // 2
modGrp[M // 2] = []
fo... | from collections import Counter, defaultdict
N, M = list(map(int, input().split()))
X = list(map(int, input().split()))
cntMod = defaultdict(int)
cntDup = defaultdict(int)
for x, c in list(Counter(X).items()):
cntMod[x % M] += c
cntDup[x % M] += c // 2
ans = 0
for m in range(M):
if m > M /... | 37 | 29 | 716 | 626 | from collections import Counter
N, M = list(map(int, input().split()))
X = list(map(int, input().split()))
modGrp = [[] for _ in range(M)]
for x in X:
modGrp[x % M].append(x)
ans = len(modGrp[0]) // 2
modGrp[0] = []
if M % 2 == 0:
ans += len(modGrp[M // 2]) // 2
modGrp[M // 2] = []
for m in range(1, M // 2... | from collections import Counter, defaultdict
N, M = list(map(int, input().split()))
X = list(map(int, input().split()))
cntMod = defaultdict(int)
cntDup = defaultdict(int)
for x, c in list(Counter(X).items()):
cntMod[x % M] += c
cntDup[x % M] += c // 2
ans = 0
for m in range(M):
if m > M // 2:
brea... | false | 21.621622 | [
"-from collections import Counter",
"+from collections import Counter, defaultdict",
"-modGrp = [[] for _ in range(M)]",
"-for x in X:",
"- modGrp[x % M].append(x)",
"-ans = len(modGrp[0]) // 2",
"-modGrp[0] = []",
"-if M % 2 == 0:",
"- ans += len(modGrp[M // 2]) // 2",
"- modGrp[M // 2] ... | false | 0.124739 | 0.155853 | 0.800363 | [
"s208135770",
"s951597885"
] |
u606045429 | p03725 | python | s953419586 | s277581731 | 1,682 | 192 | 11,252 | 9,204 | Accepted | Accepted | 88.59 | from collections import deque
INF = float("inf")
H, W, K = list(map(int, input().split()))
A = [list(eval(input())) for _ in range(H)]
Si, Sj = (0, 0)
for i, a in enumerate(A):
if "S" in a:
Si, Sj = (i, a.index("S"))
A[Si][Sj] = "c"
break
distance = INF
Q = deque([(0, Si... | from collections import deque
INF = float("inf")
H, W, K = list(map(int, input().split()))
A = [list(eval(input())) for _ in range(H)]
Si, Sj = (0, 0)
for i, a in enumerate(A):
if "S" in a:
Si, Sj = (i, a.index("S"))
A[Si][Sj] = "c"
break
distance = INF
Q = deque([(0, Si... | 31 | 33 | 688 | 726 | from collections import deque
INF = float("inf")
H, W, K = list(map(int, input().split()))
A = [list(eval(input())) for _ in range(H)]
Si, Sj = (0, 0)
for i, a in enumerate(A):
if "S" in a:
Si, Sj = (i, a.index("S"))
A[Si][Sj] = "c"
break
distance = INF
Q = deque([(0, Si, Sj)])
while Q:
... | from collections import deque
INF = float("inf")
H, W, K = list(map(int, input().split()))
A = [list(eval(input())) for _ in range(H)]
Si, Sj = (0, 0)
for i, a in enumerate(A):
if "S" in a:
Si, Sj = (i, a.index("S"))
A[Si][Sj] = "c"
break
distance = INF
Q = deque([(0, Si, Sj)])
while Q:
... | false | 6.060606 | [
"+ if distance == 0:",
"+ break"
] | false | 0.034657 | 0.105954 | 0.327099 | [
"s953419586",
"s277581731"
] |
u977855674 | p02713 | python | s863166863 | s504691665 | 845 | 737 | 9,196 | 9,196 | Accepted | Accepted | 12.78 | from math import gcd
k = int(eval(input())) + 1
ans = 0
for s in range(1, k):
for t in range(s, k):
for u in range(t, k):
if (v := len(set([s, t, u]))) == 1:
ans += gcd(gcd(s, t), u)
elif v == 2:
ans += gcd(gcd(s, t), u) * 3
e... | from math import gcd
k = int(eval(input())) + 1
ans = 0
for s in range(1, k):
for t in range(s, k):
first = gcd(s, t)
for u in range(t, k):
if (v := len(set([s, t, u]))) == 1:
ans += gcd(first, u)
elif v == 2:
ans += gcd(first, u)... | 16 | 17 | 379 | 394 | from math import gcd
k = int(eval(input())) + 1
ans = 0
for s in range(1, k):
for t in range(s, k):
for u in range(t, k):
if (v := len(set([s, t, u]))) == 1:
ans += gcd(gcd(s, t), u)
elif v == 2:
ans += gcd(gcd(s, t), u) * 3
else:
... | from math import gcd
k = int(eval(input())) + 1
ans = 0
for s in range(1, k):
for t in range(s, k):
first = gcd(s, t)
for u in range(t, k):
if (v := len(set([s, t, u]))) == 1:
ans += gcd(first, u)
elif v == 2:
ans += gcd(first, u) * 3
... | false | 5.882353 | [
"+ first = gcd(s, t)",
"- ans += gcd(gcd(s, t), u)",
"+ ans += gcd(first, u)",
"- ans += gcd(gcd(s, t), u) * 3",
"+ ans += gcd(first, u) * 3",
"- ans += gcd(gcd(s, t), u) * 6",
"+ ans += gcd(first, u) * 6"
] | false | 0.148708 | 0.244717 | 0.607675 | [
"s863166863",
"s504691665"
] |
u156896646 | p03162 | python | s099996796 | s287445368 | 837 | 724 | 120,640 | 44,148 | Accepted | Accepted | 13.5 | import sys
sys.setrecursionlimit(1000000)
N = int(eval(input()))
a = [[0]*3 for i in range(N)]
for i in range(N):
a[i] = [int(i) for i in input().split()]
def f(n, i):
if n ==0:
return a[0][i]
i1 = (i+1) % 3
i2 = (i+2) % 3
if F[n][i]:
return F[n][i]
F[n][i] = max(f(n-1, i1), f(n-... | N = int(eval(input()))
a = [[0]*3 for i in range(N)]
for i in range(N):
a[i] = [int(i) for i in input().split()]
def summerVacation(n, i):
if n ==0:
dp[n][i] = a[n][i]
return
i1 = (i+1) % 3
i2 = (i+2) % 3
dp[n][i] = max( dp[n-1][i1], dp[n-1][i2] ) + a[n][i]
dp =[[None]*3 for _ ... | 22 | 22 | 433 | 457 | import sys
sys.setrecursionlimit(1000000)
N = int(eval(input()))
a = [[0] * 3 for i in range(N)]
for i in range(N):
a[i] = [int(i) for i in input().split()]
def f(n, i):
if n == 0:
return a[0][i]
i1 = (i + 1) % 3
i2 = (i + 2) % 3
if F[n][i]:
return F[n][i]
F[n][i] = max(f(n - ... | N = int(eval(input()))
a = [[0] * 3 for i in range(N)]
for i in range(N):
a[i] = [int(i) for i in input().split()]
def summerVacation(n, i):
if n == 0:
dp[n][i] = a[n][i]
return
i1 = (i + 1) % 3
i2 = (i + 2) % 3
dp[n][i] = max(dp[n - 1][i1], dp[n - 1][i2]) + a[n][i]
dp = [[None] ... | false | 0 | [
"-import sys",
"-",
"-sys.setrecursionlimit(1000000)",
"-def f(n, i):",
"+def summerVacation(n, i):",
"- return a[0][i]",
"+ dp[n][i] = a[n][i]",
"+ return",
"- if F[n][i]:",
"- return F[n][i]",
"- F[n][i] = max(f(n - 1, i1), f(n - 1, i2)) + a[n][i]",
"- re... | false | 0.037833 | 0.037547 | 1.007601 | [
"s099996796",
"s287445368"
] |
u022979415 | p02801 | python | s058234841 | s145417451 | 24 | 17 | 3,772 | 2,940 | Accepted | Accepted | 29.17 | from string import ascii_lowercase as lower
def main():
C = eval(input())
for i in range(28):
if C == lower[i]:
print((lower[i+1]))
break
if __name__ == '__main__':
main() | def main():
c = eval(input())
print((chr(ord(c) + 1)))
if __name__ == '__main__':
main()
| 13 | 8 | 223 | 103 | from string import ascii_lowercase as lower
def main():
C = eval(input())
for i in range(28):
if C == lower[i]:
print((lower[i + 1]))
break
if __name__ == "__main__":
main()
| def main():
c = eval(input())
print((chr(ord(c) + 1)))
if __name__ == "__main__":
main()
| false | 38.461538 | [
"-from string import ascii_lowercase as lower",
"-",
"-",
"- C = eval(input())",
"- for i in range(28):",
"- if C == lower[i]:",
"- print((lower[i + 1]))",
"- break",
"+ c = eval(input())",
"+ print((chr(ord(c) + 1)))"
] | false | 0.098889 | 0.097701 | 1.012159 | [
"s058234841",
"s145417451"
] |
u697386253 | p02659 | python | s353830563 | s516968523 | 26 | 24 | 10,012 | 9,128 | Accepted | Accepted | 7.69 | from decimal import Decimal
a, b = input().split()
a = Decimal(a)
b = Decimal(b)
print((int(a*b)))
| a, b = input().split()
a = int(a)
b = int(b.replace(".", ""))
c = a*b // 100
print(c) | 7 | 8 | 105 | 95 | from decimal import Decimal
a, b = input().split()
a = Decimal(a)
b = Decimal(b)
print((int(a * b)))
| a, b = input().split()
a = int(a)
b = int(b.replace(".", ""))
c = a * b // 100
print(c)
| false | 12.5 | [
"-from decimal import Decimal",
"-",
"-a = Decimal(a)",
"-b = Decimal(b)",
"-print((int(a * b)))",
"+a = int(a)",
"+b = int(b.replace(\".\", \"\"))",
"+c = a * b // 100",
"+print(c)"
] | false | 0.042312 | 0.038952 | 1.086261 | [
"s353830563",
"s516968523"
] |
u633068244 | p00663 | python | s600929479 | s274591929 | 2,030 | 70 | 4,288 | 4,216 | Accepted | Accepted | 96.55 | def judge(ex,torf,i):
if i==3:
return eval(ex)
else:
return judge(ex,torf+[True],i+1) or judge(ex,torf+[False],i+1)
while 1:
ex=input().split("|")
if ex[0]=="#":break
for j in range(len(ex)):
dic=[]
ex[j]=list(ex[j])[1:-1]
for i in range(len(ex[j])):
if ex[j][i]=="&":ex[j][i]="and"
... | while 1:
exps=input().split("|")
if exps[0]=="#":break
for i in range(len(exps)):
v=True
lits=exps[i][1:-1].split("&")
for lit1 in lits:
for lit2 in lits:
if (lit1=="~"+lit2) or ("~"+lit1==lit2):
v=False
if v:
print("yes")
break
else:
print("no")
| 28 | 16 | 658 | 298 | def judge(ex, torf, i):
if i == 3:
return eval(ex)
else:
return judge(ex, torf + [True], i + 1) or judge(ex, torf + [False], i + 1)
while 1:
ex = input().split("|")
if ex[0] == "#":
break
for j in range(len(ex)):
dic = []
ex[j] = list(ex[j])[1:-1]
fo... | while 1:
exps = input().split("|")
if exps[0] == "#":
break
for i in range(len(exps)):
v = True
lits = exps[i][1:-1].split("&")
for lit1 in lits:
for lit2 in lits:
if (lit1 == "~" + lit2) or ("~" + lit1 == lit2):
v = False
... | false | 42.857143 | [
"-def judge(ex, torf, i):",
"- if i == 3:",
"- return eval(ex)",
"- else:",
"- return judge(ex, torf + [True], i + 1) or judge(ex, torf + [False], i + 1)",
"-",
"-",
"- ex = input().split(\"|\")",
"- if ex[0] == \"#\":",
"+ exps = input().split(\"|\")",
"+ if exps... | false | 0.039677 | 0.035336 | 1.122842 | [
"s600929479",
"s274591929"
] |
u188827677 | p03339 | python | s248071109 | s691280119 | 236 | 209 | 23,428 | 23,568 | Accepted | Accepted | 11.44 | n = int(eval(input()))
s = eval(input())
w = [0]*n
e = [0]*n
if s[0] == "W": w[0] = 1
else: e[0] = 1
for i in range(1,n):
if s[i] == "W":
w[i] = w[i-1]+1
e[i] = e[i-1]
else:
w[i] = w[i-1]
e[i] = e[i-1]+1
ans = float("inf")
for i in range(n):
t = 0
if i != 0: t += w[i-1]
if... | n = int(eval(input()))
s = eval(input())
w = [0]*n
e = [0]*n
if s[0] == "W": w[0] += 1
else: e[0] += 1
for i in range(1,n):
if s[i] == "W":
w[i] = w[i-1]+1
e[i] = e[i-1]
else:
w[i] = w[i-1]
e[i] = e[i-1]+1
ans = float("inf")
if e[n-1]-e[0] < ans: ans = e[n-1]-e[0]
if w[n-1] < an... | 22 | 24 | 373 | 412 | n = int(eval(input()))
s = eval(input())
w = [0] * n
e = [0] * n
if s[0] == "W":
w[0] = 1
else:
e[0] = 1
for i in range(1, n):
if s[i] == "W":
w[i] = w[i - 1] + 1
e[i] = e[i - 1]
else:
w[i] = w[i - 1]
e[i] = e[i - 1] + 1
ans = float("inf")
for i in range(n):
t = 0
... | n = int(eval(input()))
s = eval(input())
w = [0] * n
e = [0] * n
if s[0] == "W":
w[0] += 1
else:
e[0] += 1
for i in range(1, n):
if s[i] == "W":
w[i] = w[i - 1] + 1
e[i] = e[i - 1]
else:
w[i] = w[i - 1]
e[i] = e[i - 1] + 1
ans = float("inf")
if e[n - 1] - e[0] < ans:
... | false | 8.333333 | [
"- w[0] = 1",
"+ w[0] += 1",
"- e[0] = 1",
"+ e[0] += 1",
"-for i in range(n):",
"- t = 0",
"- if i != 0:",
"- t += w[i - 1]",
"- if i != n - 1:",
"- t += e[-1] - e[i]",
"+if e[n - 1] - e[0] < ans:",
"+ ans = e[n - 1] - e[0]",
"+if w[n - 1] < ans:",
"+... | false | 0.037773 | 0.037271 | 1.013471 | [
"s248071109",
"s691280119"
] |
u746419473 | p02796 | python | s941457218 | s300880021 | 529 | 456 | 37,924 | 21,336 | Accepted | Accepted | 13.8 | n = int(eval(input()))
xl = []
lr = []
for _ in range(n):
x, l = list(map(int, input().split()))
xl.append([x, l])
lr.append([x-l, x+l])
lr.sort(key=lambda x: x[1])
ans = 0
r = -float("inf")
for i in range(n):
if r <= lr[i][0]:
ans += 1
r = lr[i][1]
print(ans)
| n = int(eval(input()))
d = []
for _ in range(n):
x, l = list(map(int, input().split()))
d.append([x-l, x+l])
d.sort(key=lambda x: x[1])
c = -float("inf")
ans = 0
for i in range(n):
if c <= d[i][0]:
c = d[i][1]
ans += 1
print(ans)
| 18 | 16 | 301 | 264 | n = int(eval(input()))
xl = []
lr = []
for _ in range(n):
x, l = list(map(int, input().split()))
xl.append([x, l])
lr.append([x - l, x + l])
lr.sort(key=lambda x: x[1])
ans = 0
r = -float("inf")
for i in range(n):
if r <= lr[i][0]:
ans += 1
r = lr[i][1]
print(ans)
| n = int(eval(input()))
d = []
for _ in range(n):
x, l = list(map(int, input().split()))
d.append([x - l, x + l])
d.sort(key=lambda x: x[1])
c = -float("inf")
ans = 0
for i in range(n):
if c <= d[i][0]:
c = d[i][1]
ans += 1
print(ans)
| false | 11.111111 | [
"-xl = []",
"-lr = []",
"+d = []",
"- xl.append([x, l])",
"- lr.append([x - l, x + l])",
"-lr.sort(key=lambda x: x[1])",
"+ d.append([x - l, x + l])",
"+d.sort(key=lambda x: x[1])",
"+c = -float(\"inf\")",
"-r = -float(\"inf\")",
"- if r <= lr[i][0]:",
"+ if c <= d[i][0]:",
"+... | false | 0.042 | 0.041406 | 1.014361 | [
"s941457218",
"s300880021"
] |
u864069774 | p02924 | python | s646212256 | s086056470 | 36 | 17 | 5,332 | 2,940 | Accepted | Accepted | 52.78 | from decimal import *
N = int(eval(input()))
# if N == 1:
# print("0")
# exit()
ans = Decimal((Decimal(N-1) * Decimal(N) / 2))
print((int(ans)))
|
N = int(eval(input()))
# if N == 1:
# print("0")
# exit()
ans = (N-1)*N//2
print((int(ans)))
| 8 | 8 | 153 | 102 | from decimal import *
N = int(eval(input()))
# if N == 1:
# print("0")
# exit()
ans = Decimal((Decimal(N - 1) * Decimal(N) / 2))
print((int(ans)))
| N = int(eval(input()))
# if N == 1:
# print("0")
# exit()
ans = (N - 1) * N // 2
print((int(ans)))
| false | 0 | [
"-from decimal import *",
"-",
"-ans = Decimal((Decimal(N - 1) * Decimal(N) / 2))",
"+ans = (N - 1) * N // 2"
] | false | 0.121677 | 0.054343 | 2.239064 | [
"s646212256",
"s086056470"
] |
u597374218 | p02765 | python | s894489148 | s055023049 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | N,R=list(map(int,input().split()))
print((R+100*max(0,10-N))) | N, R = list(map(int, input().split()))
print((R if N >= 10 else R+100*(10-N))) | 2 | 2 | 54 | 71 | N, R = list(map(int, input().split()))
print((R + 100 * max(0, 10 - N)))
| N, R = list(map(int, input().split()))
print((R if N >= 10 else R + 100 * (10 - N)))
| false | 0 | [
"-print((R + 100 * max(0, 10 - N)))",
"+print((R if N >= 10 else R + 100 * (10 - N)))"
] | false | 0.053698 | 0.052802 | 1.016982 | [
"s894489148",
"s055023049"
] |
u498511622 | p02408 | python | s706753006 | s070047901 | 30 | 20 | 7,692 | 5,616 | Accepted | Accepted | 33.33 | cardlist = [[i for i in range(1,14)] for j in range(4)]
n=int(eval(input()))
for s in range(0,n):
x,y=(input().split())
y=int(y)
if x =="S":
cardlist[0].remove(y)
elif x =="H":
cardlist[1].remove(y)
elif x =="C":
cardlist[2].remove(y)
else:
cardlist[3].remove(y)
for i in cardl... | N = int(eval(input()))
x = [f"{x} {i}" for x in 'SHCD' for i in range(1,14) ]
[x.remove(eval(input())) for i in range(N)]
for i in x:
print(i)
| 22 | 5 | 458 | 139 | cardlist = [[i for i in range(1, 14)] for j in range(4)]
n = int(eval(input()))
for s in range(0, n):
x, y = input().split()
y = int(y)
if x == "S":
cardlist[0].remove(y)
elif x == "H":
cardlist[1].remove(y)
elif x == "C":
cardlist[2].remove(y)
else:
cardlist[3].r... | N = int(eval(input()))
x = [f"{x} {i}" for x in "SHCD" for i in range(1, 14)]
[x.remove(eval(input())) for i in range(N)]
for i in x:
print(i)
| false | 77.272727 | [
"-cardlist = [[i for i in range(1, 14)] for j in range(4)]",
"-n = int(eval(input()))",
"-for s in range(0, n):",
"- x, y = input().split()",
"- y = int(y)",
"- if x == \"S\":",
"- cardlist[0].remove(y)",
"- elif x == \"H\":",
"- cardlist[1].remove(y)",
"- elif x == \"... | false | 0.039574 | 0.03854 | 1.026831 | [
"s706753006",
"s070047901"
] |
u002459665 | p02984 | python | s863258396 | s795922280 | 292 | 121 | 19,616 | 19,276 | Accepted | Accepted | 58.56 | N = int(eval(input()))
A = list(map(int, input().split()))
A += A
g_rui = [0, A[0]]
k_rui = [0, A[1]]
for i in range(2, 2*N):
if i % 2 == 0:
x = g_rui[-1] + A[i]
g_rui.append(x)
if i % 2 != 0:
x = k_rui[-1] + A[i]
k_rui.append(x)
# print(A)
# print(g_rui)
# ... | N = int(eval(input()))
A = list(map(int, input().split()))
ans = []
x = 0
for i, ai in enumerate(A):
if i % 2 == 0:
x += ai
else:
x -= ai
ans.append(x)
for ai in A:
x = 2 * ai - x
ans.append(x)
ans = [str(i) for i in ans[:-1]]
print((" ".join(ans))) | 34 | 20 | 708 | 297 | N = int(eval(input()))
A = list(map(int, input().split()))
A += A
g_rui = [0, A[0]]
k_rui = [0, A[1]]
for i in range(2, 2 * N):
if i % 2 == 0:
x = g_rui[-1] + A[i]
g_rui.append(x)
if i % 2 != 0:
x = k_rui[-1] + A[i]
k_rui.append(x)
# print(A)
# print(g_rui)
# print(k_rui)
for i i... | N = int(eval(input()))
A = list(map(int, input().split()))
ans = []
x = 0
for i, ai in enumerate(A):
if i % 2 == 0:
x += ai
else:
x -= ai
ans.append(x)
for ai in A:
x = 2 * ai - x
ans.append(x)
ans = [str(i) for i in ans[:-1]]
print((" ".join(ans)))
| false | 41.176471 | [
"-A += A",
"-g_rui = [0, A[0]]",
"-k_rui = [0, A[1]]",
"-for i in range(2, 2 * N):",
"+ans = []",
"+x = 0",
"+for i, ai in enumerate(A):",
"- x = g_rui[-1] + A[i]",
"- g_rui.append(x)",
"- if i % 2 != 0:",
"- x = k_rui[-1] + A[i]",
"- k_rui.append(x)",
"-# prin... | false | 0.038179 | 0.0367 | 1.040282 | [
"s863258396",
"s795922280"
] |
u389910364 | p03097 | python | s776373355 | s630668245 | 871 | 786 | 13,380 | 13,332 | Accepted | Accepted | 9.76 | import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353
N, A, B = list(map(int, sys.stdin.buffer.readline().split()))
# 解説
# 違うbitの数が奇数なら戻ってこれる
def bitcount(n):
... | import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353
N, A, B = list(map(int, sys.stdin.buffer.readline().split()))
# 解説
# 違うbitの数が奇数なら戻ってこれる
def bitcount(n):
... | 77 | 79 | 1,607 | 1,659 | import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10**9)
INF = float("inf")
IINF = 10**18
MOD = 10**9 + 7
# MOD = 998244353
N, A, B = list(map(int, sys.stdin.buffer.readline().split()))
# 解説
# 違うbitの数が奇数なら戻ってこれる
def bitcount(n):
ret = 0
while n > 0:
... | import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10**9)
INF = float("inf")
IINF = 10**18
MOD = 10**9 + 7
# MOD = 998244353
N, A, B = list(map(int, sys.stdin.buffer.readline().split()))
# 解説
# 違うbitの数が奇数なら戻ってこれる
def bitcount(n):
ret = 0
while n > 0:
... | false | 2.531646 | [
"- na = a // (mask << 1) * mask + a % mask",
"- nb = b // (mask << 1) * mask + b % mask",
"+ r_mask = mask - 1",
"+ l_mask = ~mask - r_mask",
"+ na = ((a & l_mask) >> 1) + (a & r_mask)",
"+ nb = ((b & l_mask) >> 1) + (b & r_mask)",
"- ret.append((r // mask * mask << 1) + (a & ma... | false | 0.06813 | 0.091443 | 0.745057 | [
"s776373355",
"s630668245"
] |
u501503190 | p03043 | python | s763477008 | s263842098 | 43 | 31 | 2,940 | 3,316 | Accepted | Accepted | 27.91 | import math
n, k = list(map(int, input().split()))
p = 0.0
for i in range(n):
i += 1
num_required = 0.0
if i < k:
num_required = math.ceil(math.log2(k / i))
p += 0.5 ** num_required
p /= n
print(p) | #!/usr/bin/env python
import bisect
from collections import defaultdict
import math
def main():
N, K = list(map(int, input().split()))
prob = 0
for n in range(N):
n += 1
if n >= K:
p = 1.0
else:
min_val = math.ceil(math.log2(K / n))
... | 15 | 22 | 221 | 419 | import math
n, k = list(map(int, input().split()))
p = 0.0
for i in range(n):
i += 1
num_required = 0.0
if i < k:
num_required = math.ceil(math.log2(k / i))
p += 0.5**num_required
p /= n
print(p)
| #!/usr/bin/env python
import bisect
from collections import defaultdict
import math
def main():
N, K = list(map(int, input().split()))
prob = 0
for n in range(N):
n += 1
if n >= K:
p = 1.0
else:
min_val = math.ceil(math.log2(K / n))
p = 0.5**min_... | false | 31.818182 | [
"+#!/usr/bin/env python",
"+import bisect",
"+from collections import defaultdict",
"-n, k = list(map(int, input().split()))",
"-p = 0.0",
"-for i in range(n):",
"- i += 1",
"- num_required = 0.0",
"- if i < k:",
"- num_required = math.ceil(math.log2(k / i))",
"- p += 0.5**num... | false | 0.127356 | 0.046582 | 2.734005 | [
"s763477008",
"s263842098"
] |
u790012205 | p03361 | python | s745324645 | s880292145 | 170 | 18 | 38,896 | 3,064 | Accepted | Accepted | 89.41 | import sys
H, W = list(map(int, input().split()))
s = []
s.append('.' * (W + 2))
for i in range(1, H + 1):
a = eval(input())
a = '.' + a + '.'
s.append(a)
s.append('.' * (W + 2))
for i in range(1, H + 1):
for j in range(1, W + 1):
if s[i][j] == '#':
OK = False
... | import sys
H, W = list(map(int, input().split()))
s = [eval(input()) for i in range(H)]
S = []
S.append('.' * (W + 2))
for i in range(H):
S.append('.' + s[i] + '.')
S.append('.' * (W + 2))
for i in range(1, H + 1):
for j in range(1, W + 1):
if S[i][j] == '#':
if S[i + 1][j] == '#'... | 19 | 17 | 525 | 491 | import sys
H, W = list(map(int, input().split()))
s = []
s.append("." * (W + 2))
for i in range(1, H + 1):
a = eval(input())
a = "." + a + "."
s.append(a)
s.append("." * (W + 2))
for i in range(1, H + 1):
for j in range(1, W + 1):
if s[i][j] == "#":
OK = False
if (
... | import sys
H, W = list(map(int, input().split()))
s = [eval(input()) for i in range(H)]
S = []
S.append("." * (W + 2))
for i in range(H):
S.append("." + s[i] + ".")
S.append("." * (W + 2))
for i in range(1, H + 1):
for j in range(1, W + 1):
if S[i][j] == "#":
if (
S[i + 1][j... | false | 10.526316 | [
"-s = []",
"-s.append(\".\" * (W + 2))",
"-for i in range(1, H + 1):",
"- a = eval(input())",
"- a = \".\" + a + \".\"",
"- s.append(a)",
"-s.append(\".\" * (W + 2))",
"+s = [eval(input()) for i in range(H)]",
"+S = []",
"+S.append(\".\" * (W + 2))",
"+for i in range(H):",
"+ S.app... | false | 0.100621 | 0.035951 | 2.798845 | [
"s745324645",
"s880292145"
] |
u235376569 | p02959 | python | s456270511 | s539926929 | 274 | 144 | 81,892 | 25,352 | Accepted | Accepted | 47.45 | N=int(eval(input()))
A=[int(x) for x in input().rstrip().split()]
B=[int(x) for x in input().rstrip().split()]
ans=0
now=A[0]
for i in range(N):
if B[i]<=A[i]:
ans+=B[i]
else:
if A[i]+A[i+1]<=B[i]:
ans+=A[i]+A[i+1]
A[i+1]=0
else:
ans+=B[i]
A[i+1]=A[i+1]-(B[i]-A[i])
... | n=int(eval(input()))
a=[int(x) for x in input().rstrip().split()]
b=[int(x) for x in input().rstrip().split()]
ans=0
for i in range(len(b)):
if a[i]+a[i+1]<=b[i]:
ans+=a[i]+a[i+1]
a[i]=0
a[i+1]=0
elif a[i]<=b[i]:
ans+=a[i]
ans+=(b[i]-a[i])
a[i+1]=a[i+1]-(b[i]-a[i])
else:
... | 17 | 18 | 328 | 355 | N = int(eval(input()))
A = [int(x) for x in input().rstrip().split()]
B = [int(x) for x in input().rstrip().split()]
ans = 0
now = A[0]
for i in range(N):
if B[i] <= A[i]:
ans += B[i]
else:
if A[i] + A[i + 1] <= B[i]:
ans += A[i] + A[i + 1]
A[i + 1] = 0
else:
... | n = int(eval(input()))
a = [int(x) for x in input().rstrip().split()]
b = [int(x) for x in input().rstrip().split()]
ans = 0
for i in range(len(b)):
if a[i] + a[i + 1] <= b[i]:
ans += a[i] + a[i + 1]
a[i] = 0
a[i + 1] = 0
elif a[i] <= b[i]:
ans += a[i]
ans += b[i] - a[i]
... | false | 5.555556 | [
"-N = int(eval(input()))",
"-A = [int(x) for x in input().rstrip().split()]",
"-B = [int(x) for x in input().rstrip().split()]",
"+n = int(eval(input()))",
"+a = [int(x) for x in input().rstrip().split()]",
"+b = [int(x) for x in input().rstrip().split()]",
"-now = A[0]",
"-for i in range(N):",
"- ... | false | 0.039002 | 0.057135 | 0.682642 | [
"s456270511",
"s539926929"
] |
u968166680 | p03600 | python | s831349036 | s684564392 | 907 | 429 | 47,580 | 42,588 | Accepted | Accepted | 52.7 | from sys import stdin, setrecursionlimit
setrecursionlimit(10 ** 9)
INF = 1 << 60
def input():
return stdin.readline().strip()
def main():
N = int(eval(input()))
A = [list(map(int, input().split())) for _ in range(N)]
ans = 0
for i in range(N):
for j in range(i + 1, N):... | from sys import stdin, setrecursionlimit
setrecursionlimit(10 ** 9)
INF = 1 << 60
def input():
return stdin.readline().strip()
def main():
N = int(eval(input()))
A = [list(map(int, input().split())) for _ in range(N)]
ans = 0
for i in range(N):
for j in range(i + 1, N):... | 30 | 37 | 652 | 801 | from sys import stdin, setrecursionlimit
setrecursionlimit(10**9)
INF = 1 << 60
def input():
return stdin.readline().strip()
def main():
N = int(eval(input()))
A = [list(map(int, input().split())) for _ in range(N)]
ans = 0
for i in range(N):
for j in range(i + 1, N):
if any... | from sys import stdin, setrecursionlimit
setrecursionlimit(10**9)
INF = 1 << 60
def input():
return stdin.readline().strip()
def main():
N = int(eval(input()))
A = [list(map(int, input().split())) for _ in range(N)]
ans = 0
for i in range(N):
for j in range(i + 1, N):
requir... | false | 18.918919 | [
"- if any(A[i][j] > A[i][k] + A[k][j] for k in range(N) if k != i and k != j):",
"- print((-1))",
"- return",
"- if all(A[i][j] < A[i][k] + A[k][j] for k in range(N) if k != i and k != j):",
"+ required = True",
"+ for k in range(N)... | false | 0.073259 | 0.097 | 0.75525 | [
"s831349036",
"s684564392"
] |
u697696097 | p02762 | python | s402750334 | s708652744 | 1,842 | 1,629 | 128,156 | 122,396 | Accepted | Accepted | 11.56 | import sys
from io import StringIO
import unittest
class UnionFind():
# 作りたい要素数nで初期化
# 使用するインスタンス変数の初期化
def __init__(self, n):
self.n = n
# root[x]<0ならそのノードが根かつその値が木の要素数
# rootノードでその木の要素数を記録する
self.root = [-1]*(n+1)
# 木をくっつける時にアンバランスにならないように調整する
... | import sys
from io import StringIO
import unittest
class UnionFind():
# 作りたい要素数nで初期化
# 使用するインスタンス変数の初期化
def __init__(self, n):
self.n = n
# root[x]<0ならそのノードが根かつその値が木の要素数
# rootノードでその木の要素数を記録する
self.root = [-1]*(n+1)
# 木をくっつける時にアンバランスにならないように調整する
... | 89 | 85 | 2,260 | 2,144 | import sys
from io import StringIO
import unittest
class UnionFind:
# 作りたい要素数nで初期化
# 使用するインスタンス変数の初期化
def __init__(self, n):
self.n = n
# root[x]<0ならそのノードが根かつその値が木の要素数
# rootノードでその木の要素数を記録する
self.root = [-1] * (n + 1)
# 木をくっつける時にアンバランスにならないように調整する
self.rnk =... | import sys
from io import StringIO
import unittest
class UnionFind:
# 作りたい要素数nで初期化
# 使用するインスタンス変数の初期化
def __init__(self, n):
self.n = n
# root[x]<0ならそのノードが根かつその値が木の要素数
# rootノードでその木の要素数を記録する
self.root = [-1] * (n + 1)
# 木をくっつける時にアンバランスにならないように調整する
self.rnk =... | false | 4.494382 | [
"- frd = [[] for i in range(n)]",
"- blk = [[] for i in range(n)]",
"+ frd = [0 for i in range(n)]",
"+ blk = [0 for i in range(n)]",
"- frd[a].append(b)",
"- frd[b].append(a)",
"+ frd[a] += 1",
"+ frd[b] += 1",
"- # blk[a].append(b)",
"- # blk... | false | 0.034954 | 0.03917 | 0.892364 | [
"s402750334",
"s708652744"
] |
u554781254 | p02713 | python | s124054313 | s556038447 | 1,668 | 1,450 | 9,580 | 9,584 | Accepted | Accepted | 13.07 | import sys
input = sys.stdin.readline
from itertools import *
from functools import *
from collections import *
from heapq import heapify, heappop, heappush, heappushpop
# from math import gcd
def gcd(a, b):
"""
Greatest Common Divisor
Euclidean Algortihm
"""
if a < b:
g... | import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from itertools import permutations, combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop
from math import gcd
INF = float('inf')
NIL ... | 47 | 23 | 878 | 529 | import sys
input = sys.stdin.readline
from itertools import *
from functools import *
from collections import *
from heapq import heapify, heappop, heappush, heappushpop
# from math import gcd
def gcd(a, b):
"""
Greatest Common Divisor
Euclidean Algortihm
"""
if a < b:
gcd(b, a)
while ... | import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
from itertools import permutations, combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop
from math import gcd
INF = float("inf")
NIL = -1
K = int... | false | 51.06383 | [
"+sys.setrecursionlimit(10**9)",
"-from itertools import *",
"+from itertools import permutations, combinations, accumulate",
"-from collections import *",
"+from collections import deque, defaultdict, Counter",
"-",
"-# from math import gcd",
"-def gcd(a, b):",
"- \"\"\"",
"- Greatest Commo... | false | 0.117079 | 0.108819 | 1.075905 | [
"s124054313",
"s556038447"
] |
u729939940 | p02791 | python | s485280197 | s957845406 | 107 | 92 | 24,744 | 24,744 | Accepted | Accepted | 14.02 | N = int(eval(input()))
P = list(map(int, input().split()))
cnt, i = 1, 0
min = P[0]
for i in range(i + 1, N):
if min >= P[i]:
cnt += 1
min = P[i]
print(cnt) | N = int(eval(input()))
P = list(map(int, input().split()))
cnt = 1 # P[0] is counted forcely
min = P[0]
for p in P:
# (1≤j≤i),Pj=>Pi
if min > p:
min = p
cnt += 1
print(cnt) | 9 | 10 | 168 | 187 | N = int(eval(input()))
P = list(map(int, input().split()))
cnt, i = 1, 0
min = P[0]
for i in range(i + 1, N):
if min >= P[i]:
cnt += 1
min = P[i]
print(cnt)
| N = int(eval(input()))
P = list(map(int, input().split()))
cnt = 1 # P[0] is counted forcely
min = P[0]
for p in P:
# (1≤j≤i),Pj=>Pi
if min > p:
min = p
cnt += 1
print(cnt)
| false | 10 | [
"-cnt, i = 1, 0",
"+cnt = 1 # P[0] is counted forcely",
"-for i in range(i + 1, N):",
"- if min >= P[i]:",
"+for p in P:",
"+ # (1≤j≤i),Pj=>Pi",
"+ if min > p:",
"+ min = p",
"- min = P[i]"
] | false | 0.042189 | 0.043574 | 0.968224 | [
"s485280197",
"s957845406"
] |
u940139461 | p03700 | python | s563999378 | s640530264 | 769 | 649 | 119,128 | 118,488 | Accepted | Accepted | 15.6 | # int(input()) # 入力が1つ
from math import ceil
n, a, b = list(map(int, input().split())) # 入力が複数
# [int(i) for i in input().split()] # 配列で数字
monster = []
for i in range(n):
monster.append(int(eval(input())))
def check(monster, t):
temp = []
for i in range(n):
temp.append(monster[i] - b *... | # https://atcoder.jp/contests/abc063/tasks/arc075_b
n, a, b = list(map(int, input().split()))
monster = []
for i in range(n):
monster.append(int(eval(input())))
def damage(monster, t):
temp = []
for hp in monster:
s = hp - t * b
if s > 0:
temp.append(s)
ans = 0... | 32 | 31 | 676 | 657 | # int(input()) # 入力が1つ
from math import ceil
n, a, b = list(map(int, input().split())) # 入力が複数
# [int(i) for i in input().split()] # 配列で数字
monster = []
for i in range(n):
monster.append(int(eval(input())))
def check(monster, t):
temp = []
for i in range(n):
temp.append(monster[i] - b * t)
an... | # https://atcoder.jp/contests/abc063/tasks/arc075_b
n, a, b = list(map(int, input().split()))
monster = []
for i in range(n):
monster.append(int(eval(input())))
def damage(monster, t):
temp = []
for hp in monster:
s = hp - t * b
if s > 0:
temp.append(s)
ans = 0
for hp i... | false | 3.125 | [
"-# int(input()) # 入力が1つ",
"-from math import ceil",
"-",
"-n, a, b = list(map(int, input().split())) # 入力が複数",
"-# [int(i) for i in input().split()] # 配列で数字",
"+# https://atcoder.jp/contests/abc063/tasks/arc075_b",
"+n, a, b = list(map(int, input().split()))",
"-def check(monster, t):",
"+def dama... | false | 0.038885 | 0.085632 | 0.454097 | [
"s563999378",
"s640530264"
] |
u869919400 | p03163 | python | s889545191 | s665891667 | 1,833 | 274 | 22,300 | 41,836 | Accepted | Accepted | 85.05 | import numpy as np
N, W = list(map(int, input().split()))
l = sorted([tuple(map(int, input().split())) for i in range(N)], key=lambda x: x[0])
dp = np.zeros(W+1, dtype=int)
for i in range(N):
w = l[i][0]
dp[w:] = np.maximum(dp[w:], dp[:-w] + l[i][1])
print((dp[-1])) | N, W = list(map(int, input().split()))
wv = sorted([list(map(int, input().split())) for i in range(N)], key=lambda x: x[0])
# 重さをi、dp[i]を価値の最大値とする
dp = [0]*(W+1)
dp[0] = 0
for i in range(N):
w, v = wv[i]
# 前から埋めていくとさっき更新したやつをもとに更新してしまう(同じものを使ってしまう)ので逆から更新する
for j in range(W, w-1, -1):
d... | 8 | 14 | 273 | 360 | import numpy as np
N, W = list(map(int, input().split()))
l = sorted([tuple(map(int, input().split())) for i in range(N)], key=lambda x: x[0])
dp = np.zeros(W + 1, dtype=int)
for i in range(N):
w = l[i][0]
dp[w:] = np.maximum(dp[w:], dp[:-w] + l[i][1])
print((dp[-1]))
| N, W = list(map(int, input().split()))
wv = sorted([list(map(int, input().split())) for i in range(N)], key=lambda x: x[0])
# 重さをi、dp[i]を価値の最大値とする
dp = [0] * (W + 1)
dp[0] = 0
for i in range(N):
w, v = wv[i]
# 前から埋めていくとさっき更新したやつをもとに更新してしまう(同じものを使ってしまう)ので逆から更新する
for j in range(W, w - 1, -1):
dp[j] = ... | false | 42.857143 | [
"-import numpy as np",
"-",
"-l = sorted([tuple(map(int, input().split())) for i in range(N)], key=lambda x: x[0])",
"-dp = np.zeros(W + 1, dtype=int)",
"+wv = sorted([list(map(int, input().split())) for i in range(N)], key=lambda x: x[0])",
"+# 重さをi、dp[i]を価値の最大値とする",
"+dp = [0] * (W + 1)",
"+dp[0] = ... | false | 0.428946 | 0.03906 | 10.981816 | [
"s889545191",
"s665891667"
] |
u130900604 | p02786 | python | s729110790 | s474357391 | 73 | 63 | 61,692 | 61,708 | Accepted | Accepted | 13.7 | h=int(eval(input()))
def f(x):
if x==1:
return 1
return f(x//2)*2
ans=f(h)
print((ans*2-1)) | h=int(eval(input()))
def atk(n):
if n==1:
return 1
return 1+2*(atk(n//2))
print((atk(h))) | 8 | 6 | 99 | 94 | h = int(eval(input()))
def f(x):
if x == 1:
return 1
return f(x // 2) * 2
ans = f(h)
print((ans * 2 - 1))
| h = int(eval(input()))
def atk(n):
if n == 1:
return 1
return 1 + 2 * (atk(n // 2))
print((atk(h)))
| false | 25 | [
"-def f(x):",
"- if x == 1:",
"+def atk(n):",
"+ if n == 1:",
"- return f(x // 2) * 2",
"+ return 1 + 2 * (atk(n // 2))",
"-ans = f(h)",
"-print((ans * 2 - 1))",
"+print((atk(h)))"
] | false | 0.036593 | 0.059274 | 0.617361 | [
"s729110790",
"s474357391"
] |
u934442292 | p02796 | python | s178174061 | s981902263 | 162 | 148 | 24,072 | 23,928 | Accepted | Accepted | 8.64 | import sys
from operator import itemgetter
input = sys.stdin.readline
def main():
N = int(eval(input()))
LR = [None] * N
for i in range(N):
X, L = list(map(int, input().split()))
LR[i] = (X - L, X + L)
LR.sort(key=itemgetter(0))
ans = N
cur_R = LR[0][1]
fo... | import sys
from operator import itemgetter
input = sys.stdin.readline
def main():
N = int(eval(input()))
LR = [None] * N
for i in range(N):
X, L = list(map(int, input().split()))
LR[i] = (X - L, X + L)
LR.sort(key=itemgetter(0))
ans = N
cur_R = LR[0][1]
fo... | 28 | 29 | 506 | 525 | import sys
from operator import itemgetter
input = sys.stdin.readline
def main():
N = int(eval(input()))
LR = [None] * N
for i in range(N):
X, L = list(map(int, input().split()))
LR[i] = (X - L, X + L)
LR.sort(key=itemgetter(0))
ans = N
cur_R = LR[0][1]
for L, R in LR[1:]:... | import sys
from operator import itemgetter
input = sys.stdin.readline
def main():
N = int(eval(input()))
LR = [None] * N
for i in range(N):
X, L = list(map(int, input().split()))
LR[i] = (X - L, X + L)
LR.sort(key=itemgetter(0))
ans = N
cur_R = LR[0][1]
for L, R in LR[1:]:... | false | 3.448276 | [
"- cur_R = min(cur_R, R)",
"+ if R < cur_R:",
"+ cur_R = R"
] | false | 0.092514 | 0.09079 | 1.018985 | [
"s178174061",
"s981902263"
] |
u377370946 | p02714 | python | s218451430 | s987075338 | 1,685 | 881 | 9,424 | 76,724 | Accepted | Accepted | 47.72 | import bisect
import itertools
n = int(eval(input()))
s = eval(input())
RGB = [[], [], []]
for i in range(n):
if s[i] == 'R':
RGB[0].append(i)
elif s[i] == 'G':
RGB[1].append(i)
else:
RGB[2].append(i)
total = len(RGB[0]) * len(RGB[1]) * len(RGB[2])
RGB.sort(key=lambd... | import bisect
import itertools
n = int(eval(input()))
s = eval(input())
RGB = [[], [], []]
for i in range(n):
if s[i] == 'R':
RGB[0].append(i)
elif s[i] == 'G':
RGB[1].append(i)
else:
RGB[2].append(i)
total = len(RGB[0]) * len(RGB[1]) * len(RGB[2])
RGB.sort(key=lam... | 45 | 41 | 960 | 1,005 | import bisect
import itertools
n = int(eval(input()))
s = eval(input())
RGB = [[], [], []]
for i in range(n):
if s[i] == "R":
RGB[0].append(i)
elif s[i] == "G":
RGB[1].append(i)
else:
RGB[2].append(i)
total = len(RGB[0]) * len(RGB[1]) * len(RGB[2])
RGB.sort(key=lambda x: len(x))
len... | import bisect
import itertools
n = int(eval(input()))
s = eval(input())
RGB = [[], [], []]
for i in range(n):
if s[i] == "R":
RGB[0].append(i)
elif s[i] == "G":
RGB[1].append(i)
else:
RGB[2].append(i)
total = len(RGB[0]) * len(RGB[1]) * len(RGB[2])
RGB.sort(key=lambda x: len(x))
len... | false | 8.888889 | [
"-bool_B = [False for i in range(n)]",
"-for i in RGB[2]:",
"- bool_B[i] = True",
"- if bool_B[up]:",
"+ if RGB[2][bisect.bisect_left(RGB[2], up)] == up:",
"- if bool_B[down]:",
"+ if RGB[2][bisect.bisect_left(RGB[2], down)] == down:",
"- center = (r + g) // 2",
... | false | 0.064232 | 0.065935 | 0.97417 | [
"s218451430",
"s987075338"
] |
u744034042 | p02642 | python | s438274802 | s418624489 | 146 | 123 | 103,336 | 105,656 | Accepted | Accepted | 15.75 | N = int(eval(input()))
A = list(map(int,input().split()))
D = [0] * (10**6 + 1)
A.sort()
for i in range(N):
D[A[i]] += 1
ans = 0
for i in range(1, 10**6+1):
if D[i]:
if D[i]==1:
ans += 1
for j in range(i,A[-1]+1,i):
D[j] = 0
print(ans) | N = int(eval(input()))
A = list(map(int,input().split()))
m = max(A) + 1
cnt = [0]*m
for i in A:
cnt[i] += 1
ans = 0
for i in range(1,m):
if cnt[i]:
if cnt[i]==1:
ans += 1
for j in range(i,m,i):
cnt[j] = 0
print(ans) | 16 | 14 | 298 | 271 | N = int(eval(input()))
A = list(map(int, input().split()))
D = [0] * (10**6 + 1)
A.sort()
for i in range(N):
D[A[i]] += 1
ans = 0
for i in range(1, 10**6 + 1):
if D[i]:
if D[i] == 1:
ans += 1
for j in range(i, A[-1] + 1, i):
D[j] = 0
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
m = max(A) + 1
cnt = [0] * m
for i in A:
cnt[i] += 1
ans = 0
for i in range(1, m):
if cnt[i]:
if cnt[i] == 1:
ans += 1
for j in range(i, m, i):
cnt[j] = 0
print(ans)
| false | 12.5 | [
"-D = [0] * (10**6 + 1)",
"-A.sort()",
"-for i in range(N):",
"- D[A[i]] += 1",
"+m = max(A) + 1",
"+cnt = [0] * m",
"+for i in A:",
"+ cnt[i] += 1",
"-for i in range(1, 10**6 + 1):",
"- if D[i]:",
"- if D[i] == 1:",
"+for i in range(1, m):",
"+ if cnt[i]:",
"+ if... | false | 0.166436 | 0.037831 | 4.399455 | [
"s438274802",
"s418624489"
] |
u740284863 | p03281 | python | s714218111 | s078128596 | 20 | 18 | 3,060 | 3,060 | Accepted | Accepted | 10 | n = int(eval(input()))
c = []
for i in range(1,n+1):
k = []
for j in range(1,i+1):
if i % j == 0:
k.append(j)
if len(k) == 8:
if i % 2 != 0:
c.append(i)
print((len(c))) | def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
return len(divisors)
n = int(eval(input()))
ans = 0
for i in range(1,n+1,2):
if make_divisors(i) == 8:
... | 12 | 14 | 224 | 343 | n = int(eval(input()))
c = []
for i in range(1, n + 1):
k = []
for j in range(1, i + 1):
if i % j == 0:
k.append(j)
if len(k) == 8:
if i % 2 != 0:
c.append(i)
print((len(c)))
| def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
return len(divisors)
n = int(eval(input()))
ans = 0
for i in range(1, n + 1, 2):
if make_divisors(i) == 8:
... | false | 14.285714 | [
"+def make_divisors(n):",
"+ divisors = []",
"+ for i in range(1, int(n**0.5) + 1):",
"+ if n % i == 0:",
"+ divisors.append(i)",
"+ if i != n // i:",
"+ divisors.append(n // i)",
"+ return len(divisors)",
"+",
"+",
"-c = []",
"-for i in ran... | false | 0.038086 | 0.039637 | 0.96088 | [
"s714218111",
"s078128596"
] |
u790710233 | p02838 | python | s124886007 | s258062416 | 1,016 | 653 | 68,012 | 122,936 | Accepted | Accepted | 35.73 | MOD = 10**9+7
n = int(eval(input()))
A = ['{:060b}'.format(a)[::-1] for a in map(int, input().split())]
A_d = []
for col in zip(*A):
one_cnt = col.count('1')
A_d.append(one_cnt*(n-one_cnt))
ans = 0
for d in range(60):
ans = ans + A_d[d]*pow(2, d, MOD) % MOD
print((ans % MOD))
| MOD = 10**9+7
n = int(eval(input()))
A = list(map(int, input().split()))
n_bit = 60
bit_cnt = [0]*n_bit
for i in range(n):
for d in range(n_bit):
if (A[i] >> d) & 1:
bit_cnt[d] += 1
ans = 0
for d, one_cnt in enumerate(bit_cnt):
ans = ans + one_cnt*(n-one_cnt)*pow(2, d, MOD) % MO... | 12 | 14 | 293 | 333 | MOD = 10**9 + 7
n = int(eval(input()))
A = ["{:060b}".format(a)[::-1] for a in map(int, input().split())]
A_d = []
for col in zip(*A):
one_cnt = col.count("1")
A_d.append(one_cnt * (n - one_cnt))
ans = 0
for d in range(60):
ans = ans + A_d[d] * pow(2, d, MOD) % MOD
print((ans % MOD))
| MOD = 10**9 + 7
n = int(eval(input()))
A = list(map(int, input().split()))
n_bit = 60
bit_cnt = [0] * n_bit
for i in range(n):
for d in range(n_bit):
if (A[i] >> d) & 1:
bit_cnt[d] += 1
ans = 0
for d, one_cnt in enumerate(bit_cnt):
ans = ans + one_cnt * (n - one_cnt) * pow(2, d, MOD) % MOD
p... | false | 14.285714 | [
"-A = [\"{:060b}\".format(a)[::-1] for a in map(int, input().split())]",
"-A_d = []",
"-for col in zip(*A):",
"- one_cnt = col.count(\"1\")",
"- A_d.append(one_cnt * (n - one_cnt))",
"+A = list(map(int, input().split()))",
"+n_bit = 60",
"+bit_cnt = [0] * n_bit",
"+for i in range(n):",
"+ ... | false | 0.043873 | 0.036856 | 1.190387 | [
"s124886007",
"s258062416"
] |
u754022296 | p02588 | python | s352706119 | s769508581 | 691 | 368 | 94,844 | 88,664 | Accepted | Accepted | 46.74 | class BIT():
__slots__ = ["n", "data"]
def __init__(self, li):
self.n = len(li) + 1
self.data = [0] + li
for i in range(1, self.n):
if i + (i & -i) < self.n:
self.data[i + (i & -i)] += self.data[i]
def add(self, i, a):
i += 1
... | from collections import Counter
n = int(eval(input()))
D = dict()
TF = []
for _ in range(n):
s = eval(input())
if "." not in s:
s += "."
a, b = s.split(".")
k = len(b)
c = int(a+b)
t = 0
while c%2 == 0:
c //= 2
t += 1
f = 0
while c%5 == 0:
c //= 5
f += 1
t -= k... | 70 | 33 | 1,378 | 571 | class BIT:
__slots__ = ["n", "data"]
def __init__(self, li):
self.n = len(li) + 1
self.data = [0] + li
for i in range(1, self.n):
if i + (i & -i) < self.n:
self.data[i + (i & -i)] += self.data[i]
def add(self, i, a):
i += 1
while i < self... | from collections import Counter
n = int(eval(input()))
D = dict()
TF = []
for _ in range(n):
s = eval(input())
if "." not in s:
s += "."
a, b = s.split(".")
k = len(b)
c = int(a + b)
t = 0
while c % 2 == 0:
c //= 2
t += 1
f = 0
while c % 5 == 0:
c //=... | false | 52.857143 | [
"-class BIT:",
"- __slots__ = [\"n\", \"data\"]",
"-",
"- def __init__(self, li):",
"- self.n = len(li) + 1",
"- self.data = [0] + li",
"- for i in range(1, self.n):",
"- if i + (i & -i) < self.n:",
"- self.data[i + (i & -i)] += self.data[i]",
"... | false | 0.039541 | 0.037802 | 1.046014 | [
"s352706119",
"s769508581"
] |
u724687935 | p02536 | python | s121518362 | s195958733 | 245 | 204 | 91,208 | 91,224 | Accepted | Accepted | 16.73 | import sys
from collections import deque
N, M = list(map(int, input().split()))
edge = [[] for _ in range(N)]
for s in sys.stdin.readlines():
a, b = [int(x) - 1 for x in s.split()]
edge[a].append(b)
edge[b].append(a)
path = [-1] * N
cnt = 0
for i in range(N):
if path[i] < 0:
cn... | import sys
from collections import deque
N, M = list(map(int, input().split()))
edge = [[] for _ in range(N)]
for s in sys.stdin.readlines():
a, b = [int(x) - 1 for x in s.split()]
edge[a].append(b)
edge[b].append(a)
path = [0] * N
cnt = 0
for i in range(N):
if path[i] == 0:
cn... | 27 | 27 | 588 | 589 | import sys
from collections import deque
N, M = list(map(int, input().split()))
edge = [[] for _ in range(N)]
for s in sys.stdin.readlines():
a, b = [int(x) - 1 for x in s.split()]
edge[a].append(b)
edge[b].append(a)
path = [-1] * N
cnt = 0
for i in range(N):
if path[i] < 0:
cnt += 1
q ... | import sys
from collections import deque
N, M = list(map(int, input().split()))
edge = [[] for _ in range(N)]
for s in sys.stdin.readlines():
a, b = [int(x) - 1 for x in s.split()]
edge[a].append(b)
edge[b].append(a)
path = [0] * N
cnt = 0
for i in range(N):
if path[i] == 0:
cnt += 1
q ... | false | 0 | [
"-path = [-1] * N",
"+path = [0] * N",
"- if path[i] < 0:",
"+ if path[i] == 0:",
"- path[i] = i",
"+ path[i] = 1",
"- if path[np] < 0:",
"- path[np] = i",
"+ if path[np] == 0:",
"+ path[np] = 1"
] | false | 0.045728 | 0.039139 | 1.168356 | [
"s121518362",
"s195958733"
] |
u576335153 | p03017 | python | s382117781 | s005312782 | 67 | 52 | 9,564 | 9,464 | Accepted | Accepted | 22.39 | n, a, b, c, d = list(map(int, input().split()))
s = eval(input())
a -= 1
b -= 1
c -= 1
d -= 1
s += '#'
flg = True
ok = False
cnt = 0
for i in range(b, d):
if s[i] == '#':
cnt = 0
if s[i+1] == '#':
flg = False
else:
cnt += 1
if cnt == 3:
... | n, a, b, c, d = list(map(int, input().split()))
s = eval(input())
s = '#' + s + '#'
def can_reach(start, end):
for i in range(start, end+1):
if s[i] == '#' and s[i+1] == '#':
return False
return True
if not can_reach(a, b) or not can_reach(b, d):
print('No')
exit()
... | 41 | 25 | 690 | 535 | n, a, b, c, d = list(map(int, input().split()))
s = eval(input())
a -= 1
b -= 1
c -= 1
d -= 1
s += "#"
flg = True
ok = False
cnt = 0
for i in range(b, d):
if s[i] == "#":
cnt = 0
if s[i + 1] == "#":
flg = False
else:
cnt += 1
if cnt == 3:
ok = True
if cnt ... | n, a, b, c, d = list(map(int, input().split()))
s = eval(input())
s = "#" + s + "#"
def can_reach(start, end):
for i in range(start, end + 1):
if s[i] == "#" and s[i + 1] == "#":
return False
return True
if not can_reach(a, b) or not can_reach(b, d):
print("No")
exit()
if c > d:
... | false | 39.02439 | [
"-a -= 1",
"-b -= 1",
"-c -= 1",
"-d -= 1",
"-s += \"#\"",
"-flg = True",
"-ok = False",
"-cnt = 0",
"-for i in range(b, d):",
"- if s[i] == \"#\":",
"- cnt = 0",
"- if s[i + 1] == \"#\":",
"- flg = False",
"- else:",
"- cnt += 1",
"- if cnt... | false | 0.087995 | 0.122733 | 0.716963 | [
"s382117781",
"s005312782"
] |
u426764965 | p03274 | python | s269966083 | s743228633 | 114 | 98 | 14,384 | 14,224 | Accepted | Accepted | 14.04 | n, k = list(map(int, input().split()))
X = list(map(int, input().split()))
XR = [x if x > 0 else x * 2 for x in X]
XL = [x * 2 if x > 0 else x for x in X]
ans = 10**9
for i in range(k-1, n):
dist_R = XR[i] - min(0, XR[i-k+1])
dist_L = max(0, XL[i]) - XL[i-k+1]
#print(i, dist_R, dist_L)
ans = min(ans,... | n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = 10**9
for i in range(k-1, n):
dR = abs(x[i]) + abs(x[i] - x[i-k+1])
dL = abs(x[i-k+1]) + abs(x[i] - x[i-k+1])
ans = min(ans, dR, dL)
print(ans) | 12 | 8 | 342 | 231 | n, k = list(map(int, input().split()))
X = list(map(int, input().split()))
XR = [x if x > 0 else x * 2 for x in X]
XL = [x * 2 if x > 0 else x for x in X]
ans = 10**9
for i in range(k - 1, n):
dist_R = XR[i] - min(0, XR[i - k + 1])
dist_L = max(0, XL[i]) - XL[i - k + 1]
# print(i, dist_R, dist_L)
ans = ... | n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = 10**9
for i in range(k - 1, n):
dR = abs(x[i]) + abs(x[i] - x[i - k + 1])
dL = abs(x[i - k + 1]) + abs(x[i] - x[i - k + 1])
ans = min(ans, dR, dL)
print(ans)
| false | 33.333333 | [
"-X = list(map(int, input().split()))",
"-XR = [x if x > 0 else x * 2 for x in X]",
"-XL = [x * 2 if x > 0 else x for x in X]",
"+x = list(map(int, input().split()))",
"- dist_R = XR[i] - min(0, XR[i - k + 1])",
"- dist_L = max(0, XL[i]) - XL[i - k + 1]",
"- # print(i, dist_R, dist_L)",
"- ... | false | 0.113604 | 0.094494 | 1.20224 | [
"s269966083",
"s743228633"
] |
u191214791 | p03611 | python | s803147033 | s212505417 | 163 | 142 | 18,460 | 13,864 | Accepted | Accepted | 12.88 | # encoding: "utf-8"
from collections import defaultdict
class Stdin:
@staticmethod
def read_line(converter=str):
return [converter(x) for x in input().split()]
@staticmethod
def read_lines(n, converter=str):
result = list()
for _ in range(n):
resul... | # encoding: "utf-8"
class Stdin:
@staticmethod
def read_line(converter=str):
return [converter(x) for x in input().split()]
@staticmethod
def read_lines(n, converter=str):
result = list()
for _ in range(n):
result.append(Stdin.read_line(converter))
... | 54 | 53 | 1,214 | 1,223 | # encoding: "utf-8"
from collections import defaultdict
class Stdin:
@staticmethod
def read_line(converter=str):
return [converter(x) for x in input().split()]
@staticmethod
def read_lines(n, converter=str):
result = list()
for _ in range(n):
result.append(Stdin.re... | # encoding: "utf-8"
class Stdin:
@staticmethod
def read_line(converter=str):
return [converter(x) for x in input().split()]
@staticmethod
def read_lines(n, converter=str):
result = list()
for _ in range(n):
result.append(Stdin.read_line(converter))
return res... | false | 1.851852 | [
"-from collections import defaultdict",
"-",
"-",
"-def count_and_del(xs):",
"+def count_and_drop(xs):",
"- xs.sort(reverse=True)",
"- ys = defaultdict(int)",
"+ xs.sort()",
"+ ys = dict()",
"- cnt = count_and_del(xs)",
"- ys[key] += cnt",
"- ys[key - 1] += cnt... | false | 0.045214 | 0.048432 | 0.933555 | [
"s803147033",
"s212505417"
] |
u045176840 | p03448 | python | s756647075 | s713382080 | 135 | 53 | 26,964 | 9,108 | Accepted | Accepted | 60.74 | import numpy as np
A_init = 500
B_init = 100
C_init = 50
A_n = int(eval(input()))
B_n = int(eval(input()))
C_n = int(eval(input()))
X = int(eval(input()))
cnt = 0
for a in range(A_n+1):
if A_init * a <= X:
for b in range(B_n+1):
if (A_init * a + B_init * b) <= X:
... | # import numpy as np
A_init = 500
B_init = 100
C_init = 50
A_n = int(eval(input()))
B_n = int(eval(input()))
C_n = int(eval(input()))
X = int(eval(input()))
cnt = 0
for a in range(A_n+1):
if A_init * a <= X:
for b in range(B_n+1):
if (A_init * a + B_init * b) <= X:
... | 25 | 25 | 558 | 560 | import numpy as np
A_init = 500
B_init = 100
C_init = 50
A_n = int(eval(input()))
B_n = int(eval(input()))
C_n = int(eval(input()))
X = int(eval(input()))
cnt = 0
for a in range(A_n + 1):
if A_init * a <= X:
for b in range(B_n + 1):
if (A_init * a + B_init * b) <= X:
for c in ra... | # import numpy as np
A_init = 500
B_init = 100
C_init = 50
A_n = int(eval(input()))
B_n = int(eval(input()))
C_n = int(eval(input()))
X = int(eval(input()))
cnt = 0
for a in range(A_n + 1):
if A_init * a <= X:
for b in range(B_n + 1):
if (A_init * a + B_init * b) <= X:
for c in r... | false | 0 | [
"-import numpy as np",
"-",
"+# import numpy as np"
] | false | 0.042914 | 0.051732 | 0.829546 | [
"s756647075",
"s713382080"
] |
u797106134 | p02861 | python | s472107638 | s488397872 | 356 | 267 | 3,064 | 9,384 | Accepted | Accepted | 25 | # 2138~
# アイディア 2140
# permutationを使って,N!通りの経路を実際に作ってそれらの経路を足して最終的にpermutation数で割れば良い
# 実装2200
N = int(eval(input()))
X=[]
Y=[]
for _ in range(N):
xi,yi = list(map(int,input().split()))
X.append(xi)
Y.append(yi)
XY = [[x,y] for x,y in zip(X,Y)]
import itertools
All = itertools.permutation... | import itertools
import math
N = int(eval(input()))
P = [0] * N
for i in range(N):
P[i] = list(map(int,input().split()))
distance = 0
for root in itertools.permutations(P,N):
start = root[0]
for r in root:
distance += pow((r[0]-start[0])**2 + (r[1]-start[1])**2,1/2)
start = r
pr... | 30 | 13 | 627 | 346 | # 2138~
# アイディア 2140
# permutationを使って,N!通りの経路を実際に作ってそれらの経路を足して最終的にpermutation数で割れば良い
# 実装2200
N = int(eval(input()))
X = []
Y = []
for _ in range(N):
xi, yi = list(map(int, input().split()))
X.append(xi)
Y.append(yi)
XY = [[x, y] for x, y in zip(X, Y)]
import itertools
All = itertools.permutations(XY)
dis... | import itertools
import math
N = int(eval(input()))
P = [0] * N
for i in range(N):
P[i] = list(map(int, input().split()))
distance = 0
for root in itertools.permutations(P, N):
start = root[0]
for r in root:
distance += pow((r[0] - start[0]) ** 2 + (r[1] - start[1]) ** 2, 1 / 2)
start = r
p... | false | 56.666667 | [
"-# 2138~",
"-# アイディア 2140",
"-# permutationを使って,N!通りの経路を実際に作ってそれらの経路を足して最終的にpermutation数で割れば良い",
"-# 実装2200",
"-N = int(eval(input()))",
"-X = []",
"-Y = []",
"-for _ in range(N):",
"- xi, yi = list(map(int, input().split()))",
"- X.append(xi)",
"- Y.append(yi)",
"-XY = [[x, y] for x... | false | 0.084916 | 0.077659 | 1.093457 | [
"s472107638",
"s488397872"
] |
u533039576 | p03590 | python | s773035753 | s678471110 | 643 | 427 | 27,412 | 27,300 | Accepted | Accepted | 33.59 | n, k = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(n)]
ans = sum(b for a, b in ab if a | k == k)
k_bin = bin(k)
# print(k_bin)
for i in range(len(k_bin) - 2):
if (k >> i) & 1:
x = k_bin[:-(i + 1)] + '0' + '1' * i
x = int(x, 0)
cand = 0
... | n, k = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(n)]
k_subset = [k]
for i in range(len(bin(k)) - 2):
if (k >> i) & 1:
x = k & ~(1 << i) # remove i-th bit
x = x | ((1 << i) - 1) # add 1 to j-th bit (j<i)
k_subset.append(x)
ans = max(sum... | 19 | 13 | 470 | 380 | n, k = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(n)]
ans = sum(b for a, b in ab if a | k == k)
k_bin = bin(k)
# print(k_bin)
for i in range(len(k_bin) - 2):
if (k >> i) & 1:
x = k_bin[: -(i + 1)] + "0" + "1" * i
x = int(x, 0)
cand = 0
for a,... | n, k = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(n)]
k_subset = [k]
for i in range(len(bin(k)) - 2):
if (k >> i) & 1:
x = k & ~(1 << i) # remove i-th bit
x = x | ((1 << i) - 1) # add 1 to j-th bit (j<i)
k_subset.append(x)
ans = max(sum(b for a, b ... | false | 31.578947 | [
"-ans = sum(b for a, b in ab if a | k == k)",
"-k_bin = bin(k)",
"-# print(k_bin)",
"-for i in range(len(k_bin) - 2):",
"+k_subset = [k]",
"+for i in range(len(bin(k)) - 2):",
"- x = k_bin[: -(i + 1)] + \"0\" + \"1\" * i",
"- x = int(x, 0)",
"- cand = 0",
"- for a, b in... | false | 0.054904 | 0.036061 | 1.522516 | [
"s773035753",
"s678471110"
] |
u678167152 | p02586 | python | s854161597 | s609101918 | 1,460 | 1,222 | 177,164 | 186,484 | Accepted | Accepted | 16.3 | import numpy as np
import numba
from numba import njit, b1, i4, i8, f8
@njit((i8, i8, i8, i8[:,:]), cache=True)
def solve(R,C,K,item):
dp = np.zeros((C+1,4), dtype=np.int64)
for i in range(1,R+1):
new_dp = np.zeros((C+1,4), dtype=np.int64)
#上から移動
for k in range(4):
new_dp[:,0] = np.max... | import sys
import numpy as np
import numba
from numba import njit, b1, i4, i8, f8
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
@njit((i8, i8, i8, i8[:]), cache=True)
def solve(R,C,K,XYV):
item = np.zeros((R + 1, C + 1), dtype=np.int64)
for i in range(0, 3 * K, 3):
x, y, v = XYV[... | 28 | 32 | 792 | 933 | import numpy as np
import numba
from numba import njit, b1, i4, i8, f8
@njit((i8, i8, i8, i8[:, :]), cache=True)
def solve(R, C, K, item):
dp = np.zeros((C + 1, 4), dtype=np.int64)
for i in range(1, R + 1):
new_dp = np.zeros((C + 1, 4), dtype=np.int64)
# 上から移動
for k in range(4):
... | import sys
import numpy as np
import numba
from numba import njit, b1, i4, i8, f8
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
@njit((i8, i8, i8, i8[:]), cache=True)
def solve(R, C, K, XYV):
item = np.zeros((R + 1, C + 1), dtype=np.int64)
for i in range(0, 3 * K, 3):
x, y, v = XY... | false | 12.5 | [
"+import sys",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"-@njit((i8, i8, i8, i8[:, :]), cache=True)",
"-def solve(R, C, K, item):",
"+",
"+@njit((i8, i8, i8, i8[:]), cache=True)",
"+def solve(R, C, K, XYV):",
"+ item = np.zeros((R + 1, C + 1), dtype=np.int64)",
... | false | 0.246367 | 0.528031 | 0.466577 | [
"s854161597",
"s609101918"
] |
u308914480 | p02663 | python | s144717133 | s053715761 | 29 | 25 | 9,032 | 9,156 | Accepted | Accepted | 13.79 | h1, m1, h2, m2, k = list(map(int, input().split()))
l = (60 * h2 + m2) -(60 * h1 + m1)
ans = l - k
print(ans) | a,b,c,d,e=list(map(int,input().split()))
l=(60*c+d)-(60*a+b)
ans=l-e
print(ans) | 4 | 4 | 106 | 76 | h1, m1, h2, m2, k = list(map(int, input().split()))
l = (60 * h2 + m2) - (60 * h1 + m1)
ans = l - k
print(ans)
| a, b, c, d, e = list(map(int, input().split()))
l = (60 * c + d) - (60 * a + b)
ans = l - e
print(ans)
| false | 0 | [
"-h1, m1, h2, m2, k = list(map(int, input().split()))",
"-l = (60 * h2 + m2) - (60 * h1 + m1)",
"-ans = l - k",
"+a, b, c, d, e = list(map(int, input().split()))",
"+l = (60 * c + d) - (60 * a + b)",
"+ans = l - e"
] | false | 0.149806 | 0.0677 | 2.212782 | [
"s144717133",
"s053715761"
] |
u408260374 | p00254 | python | s292651152 | s615912275 | 380 | 330 | 6,724 | 6,724 | Accepted | Accepted | 13.16 | from functools import reduce
while True:
n = eval(input())
if n == '0000': break
if len(n) < 4: n = n.zfill(4)
if reduce(lambda x,y: x and y, [n[0] == s for s in n]):
print('NA')
else:
cnt = 0
while n != '6174':
l = ''.join(sorted(n, reverse=True))
... | from functools import reduce
while True:
n = eval(input())
if n == '0000': break
if len(n) < 4: n = n.zfill(4)
if reduce(lambda x,y: x and y, [n[0] == s for s in n]):
print('NA')
else:
cnt = 0
while n != '6174':
s = ''.join(sorted(n))
l = s[... | 16 | 16 | 454 | 440 | from functools import reduce
while True:
n = eval(input())
if n == "0000":
break
if len(n) < 4:
n = n.zfill(4)
if reduce(lambda x, y: x and y, [n[0] == s for s in n]):
print("NA")
else:
cnt = 0
while n != "6174":
l = "".join(sorted(n, reverse=True... | from functools import reduce
while True:
n = eval(input())
if n == "0000":
break
if len(n) < 4:
n = n.zfill(4)
if reduce(lambda x, y: x and y, [n[0] == s for s in n]):
print("NA")
else:
cnt = 0
while n != "6174":
s = "".join(sorted(n))
... | false | 0 | [
"- l = \"\".join(sorted(n, reverse=True))",
"- s = l[::-1]",
"+ s = \"\".join(sorted(n))",
"+ l = s[::-1]"
] | false | 0.036027 | 0.041211 | 0.874193 | [
"s292651152",
"s615912275"
] |
u057109575 | p02727 | python | s100017430 | s651937472 | 365 | 175 | 113,900 | 107,268 | Accepted | Accepted | 52.05 | X, Y, A, B, C = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
z = sorted(p)[-X:] + sorted(q)[-Y:] + r
print((sum(sorted(z)[-(X+Y):])))
|
X, Y, A, B, C = list(map(int, input().split()))
P = sorted(map(int, input().split()))
Q = sorted(map(int, input().split()))
R = sorted(map(int, input().split()))
cand = sorted(P[-X:] + Q[-Y:] + R)
print((sum(cand[-X-Y:])))
| 7 | 8 | 228 | 224 | X, Y, A, B, C = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
z = sorted(p)[-X:] + sorted(q)[-Y:] + r
print((sum(sorted(z)[-(X + Y) :])))
| X, Y, A, B, C = list(map(int, input().split()))
P = sorted(map(int, input().split()))
Q = sorted(map(int, input().split()))
R = sorted(map(int, input().split()))
cand = sorted(P[-X:] + Q[-Y:] + R)
print((sum(cand[-X - Y :])))
| false | 12.5 | [
"-p = list(map(int, input().split()))",
"-q = list(map(int, input().split()))",
"-r = list(map(int, input().split()))",
"-z = sorted(p)[-X:] + sorted(q)[-Y:] + r",
"-print((sum(sorted(z)[-(X + Y) :])))",
"+P = sorted(map(int, input().split()))",
"+Q = sorted(map(int, input().split()))",
"+R = sorted(m... | false | 0.036977 | 0.03841 | 0.962708 | [
"s100017430",
"s651937472"
] |
u935450383 | p02923 | python | s931017028 | s634402606 | 86 | 78 | 14,224 | 14,252 | Accepted | Accepted | 9.3 | N = int(eval(input()))
H = list(map(int, input().split()))
ans = 0
count = 0
for j in range(N):
if N == 1:
break
if H[j] >= H[j+1]:
count += 1
else:
ans = max(ans, count)
count = 0
if j == N-2:
if count > ans:
ans = coun... | N = int(eval(input()))
H = list(map(int, input().split()))
ans = 0
count = 0
for j in range(N):
if N == 1:
break
if H[j] >= H[j+1]:
count += 1
elif count > ans:
ans = count
count = 0
else:
count = 0
if j == N-2:
if co... | 23 | 25 | 344 | 381 | N = int(eval(input()))
H = list(map(int, input().split()))
ans = 0
count = 0
for j in range(N):
if N == 1:
break
if H[j] >= H[j + 1]:
count += 1
else:
ans = max(ans, count)
count = 0
if j == N - 2:
if count > ans:
ans = count
break
print(ans)
| N = int(eval(input()))
H = list(map(int, input().split()))
ans = 0
count = 0
for j in range(N):
if N == 1:
break
if H[j] >= H[j + 1]:
count += 1
elif count > ans:
ans = count
count = 0
else:
count = 0
if j == N - 2:
if count > ans:
ans = co... | false | 8 | [
"+ elif count > ans:",
"+ ans = count",
"+ count = 0",
"- ans = max(ans, count)"
] | false | 0.046266 | 0.133367 | 0.346907 | [
"s931017028",
"s634402606"
] |
u102461423 | p02632 | python | s769385426 | s815414142 | 817 | 446 | 163,172 | 97,332 | Accepted | Accepted | 45.41 | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9 + 7
def main(K, N, MOD):
def fact_table(N, MOD):
inv = np.empty(N, np.int64)
inv[0] = 0
inv[1] = 1
... | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9 + 7
def main(K, N, MOD):
def fact_table(N, MOD):
inv = np.empty(N, np.int64)
inv[0] = 0
inv[1] = 1
for n in range(2, N):... | 56 | 55 | 1,463 | 1,439 | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9 + 7
def main(K, N, MOD):
def fact_table(N, MOD):
inv = np.empty(N, np.int64)
inv[0] = 0
inv[1] = 1
for n in ran... | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9 + 7
def main(K, N, MOD):
def fact_table(N, MOD):
inv = np.empty(N, np.int64)
inv[0] = 0
inv[1] = 1
for n in range(2, N):
q... | false | 1.785714 | [
"-from numba import njit"
] | false | 0.740954 | 0.471528 | 1.571388 | [
"s769385426",
"s815414142"
] |
u423966555 | p02695 | python | s696582269 | s974476566 | 1,454 | 740 | 22,908 | 12,332 | Accepted | Accepted | 49.11 | N, M, Q = list(map(int, input().split()))
#N: 正整数列の長さ, M:正整数列の最大値, Q: 4つの整数の組みの数
Q_li = [list(map(int, input().split())) for _ in range(Q)]
def dfs(now, n, num): #nowはこれから生成するもの
if n == 0:
make_group.append(now)
else:
for i in range(num, M+1):
dfs(now+[i], n-1, i)
make... | N, M, Q = list(map(int, input().split()))
#N: 正整数列の長さ, M:正整数列の最大値, Q: 4つの整数の組みの数
a_l = [0]*Q
b_l = [0]*Q
c_l = [0]*Q
d_l = [0]*Q
for i in range(Q):
a_l[i], b_l[i], c_l[i], d_l[i] = list(map(int, input().split()))
def calc_score(now):
score = 0
for a, b, c, d in zip(a_l, b_l, c_l, d_l):
... | 25 | 30 | 560 | 650 | N, M, Q = list(map(int, input().split()))
# N: 正整数列の長さ, M:正整数列の最大値, Q: 4つの整数の組みの数
Q_li = [list(map(int, input().split())) for _ in range(Q)]
def dfs(now, n, num): # nowはこれから生成するもの
if n == 0:
make_group.append(now)
else:
for i in range(num, M + 1):
dfs(now + [i], n - 1, i)
make_g... | N, M, Q = list(map(int, input().split()))
# N: 正整数列の長さ, M:正整数列の最大値, Q: 4つの整数の組みの数
a_l = [0] * Q
b_l = [0] * Q
c_l = [0] * Q
d_l = [0] * Q
for i in range(Q):
a_l[i], b_l[i], c_l[i], d_l[i] = list(map(int, input().split()))
def calc_score(now):
score = 0
for a, b, c, d in zip(a_l, b_l, c_l, d_l):
a ... | false | 16.666667 | [
"-Q_li = [list(map(int, input().split())) for _ in range(Q)]",
"+a_l = [0] * Q",
"+b_l = [0] * Q",
"+c_l = [0] * Q",
"+d_l = [0] * Q",
"+for i in range(Q):",
"+ a_l[i], b_l[i], c_l[i], d_l[i] = list(map(int, input().split()))",
"+",
"+",
"+def calc_score(now):",
"+ score = 0",
"+ for ... | false | 0.057028 | 0.048643 | 1.172382 | [
"s696582269",
"s974476566"
] |
u225388820 | p02713 | python | s555595454 | s003975210 | 970 | 191 | 69,352 | 67,856 | Accepted | Accepted | 80.31 | from math import gcd
from functools import reduce
def gcd_list(numbers):
return reduce(gcd, numbers)
k=int(eval(input()))
ans=0
for i in range(1,k+1):
for j in range(1,k+1):
for x in range(1,k+1):
ans+=gcd_list([i,j,x])
print(ans) | from math import gcd
k=int(eval(input()))
ans=0
for i in range(1,k+1):
for j in range(1,k+1):
p=gcd(i,j)
for x in range(1,k+1):
ans+=gcd(x,p)
print(ans) | 11 | 9 | 261 | 186 | from math import gcd
from functools import reduce
def gcd_list(numbers):
return reduce(gcd, numbers)
k = int(eval(input()))
ans = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
for x in range(1, k + 1):
ans += gcd_list([i, j, x])
print(ans)
| from math import gcd
k = int(eval(input()))
ans = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
p = gcd(i, j)
for x in range(1, k + 1):
ans += gcd(x, p)
print(ans)
| false | 18.181818 | [
"-from functools import reduce",
"-",
"-",
"-def gcd_list(numbers):",
"- return reduce(gcd, numbers)",
"-",
"+ p = gcd(i, j)",
"- ans += gcd_list([i, j, x])",
"+ ans += gcd(x, p)"
] | false | 0.107187 | 0.106498 | 1.006472 | [
"s555595454",
"s003975210"
] |
u706929073 | p03111 | python | s732843297 | s347634325 | 75 | 63 | 3,064 | 3,064 | Accepted | Accepted | 16 | n, A, B, C = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(n)]
def dfs(i, a, b, c):
if i == n:
if a < 1 or b < 1 or c < 1:
return 10 ** 18
return abs(A-a) + abs(B-b) + abs(C-c)
res = dfs(i + 1, a, b, c)
res = min([res, dfs(i + 1, a + l[i], b, ... | n, A, B, C = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(n)]
def dfs(i, a, b, c):
if i == n:
if a < 1 or b < 1 or c < 1:
return 10 ** 18
return abs(A - a) + abs(B - b) + abs(C - c)
return min([
dfs(i + 1, a, b, c),
dfs(i + 1, a ... | 17 | 17 | 526 | 495 | n, A, B, C = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(n)]
def dfs(i, a, b, c):
if i == n:
if a < 1 or b < 1 or c < 1:
return 10**18
return abs(A - a) + abs(B - b) + abs(C - c)
res = dfs(i + 1, a, b, c)
res = min([res, dfs(i + 1, a + l[i], b, c) + (... | n, A, B, C = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(n)]
def dfs(i, a, b, c):
if i == n:
if a < 1 or b < 1 or c < 1:
return 10**18
return abs(A - a) + abs(B - b) + abs(C - c)
return min(
[
dfs(i + 1, a, b, c),
dfs(i + 1... | false | 0 | [
"- res = dfs(i + 1, a, b, c)",
"- res = min([res, dfs(i + 1, a + l[i], b, c) + (10 if a > 0 else 0)])",
"- res = min([res, dfs(i + 1, a, b + l[i], c) + (10 if b > 0 else 0)])",
"- res = min([res, dfs(i + 1, a, b, c + l[i]) + (10 if c > 0 else 0)])",
"- return res",
"+ return min(",
"+ ... | false | 0.083738 | 0.09397 | 0.891116 | [
"s732843297",
"s347634325"
] |
u098012509 | p03739 | python | s767171437 | s569776114 | 129 | 102 | 14,204 | 20,044 | Accepted | Accepted | 20.93 | import sys
import itertools
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = [int(x) for x in input().split()]
accu = list(itertools.accumulate(A))
ans1 = 0
ruiseki = 0
for i, x in enumerate(accu):
if i % 2 == 0:
if ruiseki + x <= 0:
... | N = int(eval(input()))
A = [int(x) for x in input().split()]
# plusスタートにする
ans1 = 0
c = 0
plus = True
for a in A:
c += a
if plus:
if c <= 0:
ans1 += abs(c) + 1
c = 1
plus = False
else:
if c >= 0:
ans1 += abs(c) + 1
c... | 41 | 39 | 989 | 652 | import sys
import itertools
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = [int(x) for x in input().split()]
accu = list(itertools.accumulate(A))
ans1 = 0
ruiseki = 0
for i, x in enumerate(accu):
if i % 2 == 0:
if ruiseki + x <= 0:
ans1 +... | N = int(eval(input()))
A = [int(x) for x in input().split()]
# plusスタートにする
ans1 = 0
c = 0
plus = True
for a in A:
c += a
if plus:
if c <= 0:
ans1 += abs(c) + 1
c = 1
plus = False
else:
if c >= 0:
ans1 += abs(c) + 1
c = -1
plus =... | false | 4.878049 | [
"-import sys",
"-import itertools",
"-",
"-input = sys.stdin.readline",
"-",
"-",
"-def main():",
"- N = int(eval(input()))",
"- A = [int(x) for x in input().split()]",
"- accu = list(itertools.accumulate(A))",
"- ans1 = 0",
"- ruiseki = 0",
"- for i, x in enumerate(accu):"... | false | 0.046752 | 0.046834 | 0.998248 | [
"s767171437",
"s569776114"
] |
u624475441 | p03731 | python | s908568279 | s868280169 | 91 | 79 | 25,132 | 25,132 | Accepted | Accepted | 13.19 | N, T, *L = list(map(int, open(0).read().split()))
a, d = T, 0
for t in L:
if a < t:
d += t - a
a = t + T
print((a - d)) | N, T, *L = list(map(int, open(0).read().split()))
print((L[-1] + T - sum(b - a - T for a, b in zip(L, L[1:]) if b - a > T))) | 7 | 2 | 133 | 117 | N, T, *L = list(map(int, open(0).read().split()))
a, d = T, 0
for t in L:
if a < t:
d += t - a
a = t + T
print((a - d))
| N, T, *L = list(map(int, open(0).read().split()))
print((L[-1] + T - sum(b - a - T for a, b in zip(L, L[1:]) if b - a > T)))
| false | 71.428571 | [
"-a, d = T, 0",
"-for t in L:",
"- if a < t:",
"- d += t - a",
"- a = t + T",
"-print((a - d))",
"+print((L[-1] + T - sum(b - a - T for a, b in zip(L, L[1:]) if b - a > T)))"
] | false | 0.035831 | 0.030135 | 1.189033 | [
"s908568279",
"s868280169"
] |
u606045429 | p03660 | python | s333304944 | s650954992 | 382 | 317 | 31,724 | 31,724 | Accepted | Accepted | 17.02 | from collections import deque
N, *AB = list(map(int, open(0).read().split()))
E = [[] for _ in range(N + 1)]
for a, b in zip(*[iter(AB)] * 2):
E[a].append(b)
E[b].append(a)
def get_dist(src):
Q = deque([src])
dist = [0] * (N + 1)
while Q:
v = Q.popleft()
for u in ... | from collections import deque
N, *AB = list(map(int, open(0).read().split()))
E = [[] for _ in range(N + 1)]
for a, b in zip(*[iter(AB)] * 2):
E[a].append(b)
E[b].append(a)
def get_dist(src):
Q = deque([src])
dist = [0] * (N + 1)
while Q:
v = Q.popleft()
for u in E[... | 35 | 29 | 661 | 598 | from collections import deque
N, *AB = list(map(int, open(0).read().split()))
E = [[] for _ in range(N + 1)]
for a, b in zip(*[iter(AB)] * 2):
E[a].append(b)
E[b].append(a)
def get_dist(src):
Q = deque([src])
dist = [0] * (N + 1)
while Q:
v = Q.popleft()
for u in E[v]:
... | from collections import deque
N, *AB = list(map(int, open(0).read().split()))
E = [[] for _ in range(N + 1)]
for a, b in zip(*[iter(AB)] * 2):
E[a].append(b)
E[b].append(a)
def get_dist(src):
Q = deque([src])
dist = [0] * (N + 1)
while Q:
v = Q.popleft()
for u in E[v]:
... | false | 17.142857 | [
"-fennec, snuke = 0, 0",
"-for f, s in zip(F, S):",
"- if f <= s:",
"- fennec += 1",
"- else:",
"- snuke += 1",
"-if fennec > snuke:",
"+fennec = sum(1 if f <= s else -1 for f, s in zip(F, S))",
"+if fennec > 0:"
] | false | 0.037999 | 0.040543 | 0.937256 | [
"s333304944",
"s650954992"
] |
u952708174 | p03401 | python | s485343191 | s276066645 | 174 | 148 | 14,164 | 20,112 | Accepted | Accepted | 14.94 | def c_traveling_plan(N, A):
total = 0 # すべての観光スポットを順に回ったときの費用
a = [0] + A + [0] # 0から出発して最後に0に帰るためこうする(forループも楽)
for i in range(N + 1):
total += abs(a[i] - a[i + 1])
ans = ''
for i in range(1, N + 1):
# a_{i-1}->a_i->a_{i+1} をつなぐ2つの経路の長さ(delta1)を引き、
# 新しい経路の長さ(delta... | def c_traveling_plan():
N = int(eval(input()))
# 原点から出発して最後に原点に帰るためこうする (forループも楽)
A = [0] + [int(i) for i in input().split()] + [0]
total_tour_cost = sum([abs(A[i] - A[i + 1]) for i in range(N + 1)])
ans = []
for i in range(1, N + 1):
# a_{i-1} -> a_i -> a_{i+1} の長さ(delta1)を引き,... | 17 | 16 | 599 | 585 | def c_traveling_plan(N, A):
total = 0 # すべての観光スポットを順に回ったときの費用
a = [0] + A + [0] # 0から出発して最後に0に帰るためこうする(forループも楽)
for i in range(N + 1):
total += abs(a[i] - a[i + 1])
ans = ""
for i in range(1, N + 1):
# a_{i-1}->a_i->a_{i+1} をつなぐ2つの経路の長さ(delta1)を引き、
# 新しい経路の長さ(delta2)を足す
... | def c_traveling_plan():
N = int(eval(input()))
# 原点から出発して最後に原点に帰るためこうする (forループも楽)
A = [0] + [int(i) for i in input().split()] + [0]
total_tour_cost = sum([abs(A[i] - A[i + 1]) for i in range(N + 1)])
ans = []
for i in range(1, N + 1):
# a_{i-1} -> a_i -> a_{i+1} の長さ(delta1)を引き,
... | false | 5.882353 | [
"-def c_traveling_plan(N, A):",
"- total = 0 # すべての観光スポットを順に回ったときの費用",
"- a = [0] + A + [0] # 0から出発して最後に0に帰るためこうする(forループも楽)",
"- for i in range(N + 1):",
"- total += abs(a[i] - a[i + 1])",
"- ans = \"\"",
"+def c_traveling_plan():",
"+ N = int(eval(input()))",
"+ # 原点から出発... | false | 0.073032 | 0.045025 | 1.622038 | [
"s485343191",
"s276066645"
] |
u941753895 | p03673 | python | s628999734 | s116102900 | 236 | 183 | 27,712 | 29,388 | Accepted | Accepted | 22.46 | n=int(eval(input()))
l=[0]*n
ind=n//2
l0=list(map(int,input().split()))
f=1
if n%2==0:
f=-1
for i in range(n):
if f==1:
l[ind-i]=l0[i]
f=-1
ind-=i
else:
l[ind+i]=l0[i]
f=1
ind+=i
print((*l)) | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
def LI(): return list(map(int,input().split()))
def I(): return int(eval(input()))
def LS(): return input().split()
def S(): return eval(input())
def main():
n=I(... | 17 | 37 | 228 | 754 | n = int(eval(input()))
l = [0] * n
ind = n // 2
l0 = list(map(int, input().split()))
f = 1
if n % 2 == 0:
f = -1
for i in range(n):
if f == 1:
l[ind - i] = l0[i]
f = -1
ind -= i
else:
l[ind + i] = l0[i]
f = 1
ind += i
print((*l))
| import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI():
return list(map(int, input().split()))
def I():
return int(eval(input()))
def LS():
return input().split()
def S():
return eval... | false | 54.054054 | [
"-n = int(eval(input()))",
"-l = [0] * n",
"-ind = n // 2",
"-l0 = list(map(int, input().split()))",
"-f = 1",
"-if n % 2 == 0:",
"- f = -1",
"-for i in range(n):",
"- if f == 1:",
"- l[ind - i] = l0[i]",
"- f = -1",
"- ind -= i",
"+import math, string, itertools, ... | false | 0.038648 | 0.007219 | 5.353682 | [
"s628999734",
"s116102900"
] |
u877470159 | p02888 | python | s161630957 | s359351716 | 1,980 | 743 | 51,872 | 45,348 | Accepted | Accepted | 62.47 | import sys
input=sys.stdin.readline
n=int(eval(input()))
l=list(map(int,input().split()))
l.sort()
import bisect
ans=0
for i in range(n):
for j in range(i+1,n):
x=bisect.bisect_left(l[j+1:n],l[i]+l[j])
ans+=x
print(ans)
| import sys
input=sys.stdin.readline
n=int(eval(input()))
l=list(map(int,input().split()))
l.sort()
import bisect
ans=0
for i in range(n):
for j in range(i+1,n):
x=bisect.bisect_left(l,l[i]+l[j],lo=j+1)
ans+=x-j-1
print(ans)
| 12 | 16 | 245 | 261 | import sys
input = sys.stdin.readline
n = int(eval(input()))
l = list(map(int, input().split()))
l.sort()
import bisect
ans = 0
for i in range(n):
for j in range(i + 1, n):
x = bisect.bisect_left(l[j + 1 : n], l[i] + l[j])
ans += x
print(ans)
| import sys
input = sys.stdin.readline
n = int(eval(input()))
l = list(map(int, input().split()))
l.sort()
import bisect
ans = 0
for i in range(n):
for j in range(i + 1, n):
x = bisect.bisect_left(l, l[i] + l[j], lo=j + 1)
ans += x - j - 1
print(ans)
| false | 25 | [
"- x = bisect.bisect_left(l[j + 1 : n], l[i] + l[j])",
"- ans += x",
"+ x = bisect.bisect_left(l, l[i] + l[j], lo=j + 1)",
"+ ans += x - j - 1"
] | false | 0.037269 | 0.058813 | 0.633676 | [
"s161630957",
"s359351716"
] |
u952708174 | p02680 | python | s313559598 | s284187367 | 2,656 | 2,410 | 713,140 | 713,524 | Accepted | Accepted | 9.26 | def f_single_dot():
# https://atcoder.jp/contests/abc168/submissions/13368489
import sys
from collections import deque
input = sys.stdin.readline
N, M = [int(i) for i in input().split()]
X, Y = set([0]), set([0])
A, B, C = [0] * N, [0] * N, [0] * N
for i in range(N):
A... | def f_single_dot():
# https://atcoder.jp/contests/abc168/submissions/13368489
import sys
from collections import deque
input = sys.stdin.readline
N, M = [int(i) for i in input().split()]
X, Y = set([0]), set([0])
A, B, C = [0] * N, [0] * N, [0] * N
for i in range(N):
A... | 64 | 60 | 2,228 | 2,154 | def f_single_dot():
# https://atcoder.jp/contests/abc168/submissions/13368489
import sys
from collections import deque
input = sys.stdin.readline
N, M = [int(i) for i in input().split()]
X, Y = set([0]), set([0])
A, B, C = [0] * N, [0] * N, [0] * N
for i in range(N):
A[i], B[i],... | def f_single_dot():
# https://atcoder.jp/contests/abc168/submissions/13368489
import sys
from collections import deque
input = sys.stdin.readline
N, M = [int(i) for i in input().split()]
X, Y = set([0]), set([0])
A, B, C = [0] * N, [0] * N, [0] * N
for i in range(N):
A[i], B[i],... | false | 6.25 | [
"- X.add(A[i])",
"- X.add(B[i])",
"- Y.add(C[i])",
"+ X |= {A[i], B[i]}",
"+ Y |= {C[i]}",
"- X.add(D[i])",
"- Y.add(E[i])",
"- Y.add(F[i])",
"- UX = list(X)",
"- UY = list(Y)",
"- UX.sort()",
"- UY.sort()",
"- dictx, dic... | false | 0.041743 | 0.008323 | 5.015605 | [
"s313559598",
"s284187367"
] |
u150984829 | p02234 | python | s202188059 | s219272494 | 100 | 90 | 5,720 | 5,720 | Accepted | Accepted | 10 | import sys
def s():
n=int(eval(input()))+1
e=list([x.split() for x in sys.stdin])
p=[int(e[0][0])]+list(int(x[1])for x in e)
m=[[0]*n for _ in[0]*n]
for i in range(n):
for r in range(n-i-1):
c=r+i+1
for j in range(r+1,c):
x=m[r][j]+m[j][c]+p[r]*p[j]*p[c]
if 1>m[r][c]or m[r][c]>x:m[r][c]=... | def s():
n=int(eval(input()))+1
e=[input().split()for _ in[0]*~-n]
p=[int(e[0][0])]+list(int(x[1])for x in e)
m=[[0]*n for _ in[0]*n]
for i in range(n):
for r in range(n-i-1):
c=r+i+1
for j in range(r+1,c):
x=m[r][j]+m[j][c]+p[r]*p[j]*p[c]
if 1>m[r][c]or m[r][c]>x:m[r][c]=x
print((m[r]... | 14 | 13 | 364 | 346 | import sys
def s():
n = int(eval(input())) + 1
e = list([x.split() for x in sys.stdin])
p = [int(e[0][0])] + list(int(x[1]) for x in e)
m = [[0] * n for _ in [0] * n]
for i in range(n):
for r in range(n - i - 1):
c = r + i + 1
for j in range(r + 1, c):
... | def s():
n = int(eval(input())) + 1
e = [input().split() for _ in [0] * ~-n]
p = [int(e[0][0])] + list(int(x[1]) for x in e)
m = [[0] * n for _ in [0] * n]
for i in range(n):
for r in range(n - i - 1):
c = r + i + 1
for j in range(r + 1, c):
x = m[r][j... | false | 7.142857 | [
"-import sys",
"-",
"-",
"- e = list([x.split() for x in sys.stdin])",
"+ e = [input().split() for _ in [0] * ~-n]"
] | false | 0.038769 | 0.039181 | 0.989473 | [
"s202188059",
"s219272494"
] |
u133936772 | p02983 | python | s645818607 | s901635596 | 38 | 34 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | l,r=list(map(int,input().split()))
print((0 if r-l>671 else min(i*j%2019 for i in range(l,r) for j in range(i+1,r+1)))) | L,R=list(map(int,input().split()))
M=2019;l=L%M;r=R%M
print((0 if l>r or R-L>671 else min(i*j%M for i in range(l,r) for j in range(i+1,r+1)))) | 2 | 3 | 112 | 136 | l, r = list(map(int, input().split()))
print(
(
0
if r - l > 671
else min(i * j % 2019 for i in range(l, r) for j in range(i + 1, r + 1))
)
)
| L, R = list(map(int, input().split()))
M = 2019
l = L % M
r = R % M
print(
(
0
if l > r or R - L > 671
else min(i * j % M for i in range(l, r) for j in range(i + 1, r + 1))
)
)
| false | 33.333333 | [
"-l, r = list(map(int, input().split()))",
"+L, R = list(map(int, input().split()))",
"+M = 2019",
"+l = L % M",
"+r = R % M",
"- if r - l > 671",
"- else min(i * j % 2019 for i in range(l, r) for j in range(i + 1, r + 1))",
"+ if l > r or R - L > 671",
"+ else min(i * j ... | false | 0.035522 | 0.032367 | 1.097488 | [
"s645818607",
"s901635596"
] |
u488178971 | p03854 | python | s344003989 | s952036104 | 128 | 75 | 3,316 | 3,380 | Accepted | Accepted | 41.41 | #049 C
S = eval(input())
A = 'dream'
B = 'dreamer'
C = 'erase'
D = 'eraser'
S=S[::-1]
A=A[::-1]
B=B[::-1]
C=C[::-1]
D=D[::-1]
tmp =""
for i in S:
tmp +=i
for j in [A,B,C,D]:
if tmp == j:
S=S.replace(tmp,"",1)
tmp=""
if len(S)==0:
print('YES')
else:
... | # C - 白昼夢
S = eval(input())
S2 = S
W_L = ["dream","dreamer","erase","eraser"]
while True:
cnt = 0
for w in W_L:
if S2.endswith(w):
S2 = S2[:-(len(w))]
cnt+=1
if cnt ==0:
print('NO')
exit()
if len(S2)<=7:
break
if ... | 25 | 21 | 329 | 376 | # 049 C
S = eval(input())
A = "dream"
B = "dreamer"
C = "erase"
D = "eraser"
S = S[::-1]
A = A[::-1]
B = B[::-1]
C = C[::-1]
D = D[::-1]
tmp = ""
for i in S:
tmp += i
for j in [A, B, C, D]:
if tmp == j:
S = S.replace(tmp, "", 1)
tmp = ""
if len(S) == 0:
print("YES")
else:
... | # C - 白昼夢
S = eval(input())
S2 = S
W_L = ["dream", "dreamer", "erase", "eraser"]
while True:
cnt = 0
for w in W_L:
if S2.endswith(w):
S2 = S2[: -(len(w))]
cnt += 1
if cnt == 0:
print("NO")
exit()
if len(S2) <= 7:
break
if S2 == "" or S2 in W_L:
... | false | 16 | [
"-# 049 C",
"+# C - 白昼夢",
"-A = \"dream\"",
"-B = \"dreamer\"",
"-C = \"erase\"",
"-D = \"eraser\"",
"-S = S[::-1]",
"-A = A[::-1]",
"-B = B[::-1]",
"-C = C[::-1]",
"-D = D[::-1]",
"-tmp = \"\"",
"-for i in S:",
"- tmp += i",
"- for j in [A, B, C, D]:",
"- if tmp == j:",
... | false | 0.037187 | 0.037837 | 0.982817 | [
"s344003989",
"s952036104"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.