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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u498467969 | p04044 | python | s956790736 | s013124789 | 318 | 37 | 3,448 | 3,064 | Accepted | Accepted | 88.36 | N, L = list(map(int, input().split()))
S = []
s = ""
for _ in range(N):
S.append(eval(input()))
S.sort()
for i in range(N):
s += S[i]
print(s)
| N, L = list(map(int, input().split()))
S = [eval(input()) for _ in range(N)]
s = ""
S.sort()
for i in range(N):
s += S[i]
print(s)
| 13 | 11 | 170 | 150 | N, L = list(map(int, input().split()))
S = []
s = ""
for _ in range(N):
S.append(eval(input()))
S.sort()
for i in range(N):
s += S[i]
print(s)
| N, L = list(map(int, input().split()))
S = [eval(input()) for _ in range(N)]
s = ""
S.sort()
for i in range(N):
s += S[i]
print(s)
| false | 15.384615 | [
"-S = []",
"+S = [eval(input()) for _ in range(N)]",
"-for _ in range(N):",
"- S.append(eval(input()))"
] | false | 0.037572 | 0.042276 | 0.888742 | [
"s956790736",
"s013124789"
] |
u788703383 | p03472 | python | s999555444 | s615282241 | 297 | 255 | 27,836 | 18,188 | Accepted | Accepted | 14.14 | import math
n,h = list(map(int,input().split()))
l = []; x,y = 0,0
for _ in range(n):
a,b = list(map(int,input().split()))
if a > x or a == x and b < y:
x,y = a,b
if b < x:continue
l.append((a,b))
l.remove((x,y))
l = sorted(l,key=lambda x:-x[1])
ans = 0
for a,b in l:
if b <= x:b... | import math
n,h = list(map(int,input().split()))
A = 0; b = []; ans = 0
for _ in range(n):
u,v = list(map(int,input().split()))
A = max(A,u); b.append(v)
for B in sorted(b,key=lambda x:-x):
if h <= 0 or B <= A:break
h -= B
ans += 1
print((max(0,math.ceil(h/A)) + ans)) | 22 | 12 | 495 | 286 | import math
n, h = list(map(int, input().split()))
l = []
x, y = 0, 0
for _ in range(n):
a, b = list(map(int, input().split()))
if a > x or a == x and b < y:
x, y = a, b
if b < x:
continue
l.append((a, b))
l.remove((x, y))
l = sorted(l, key=lambda x: -x[1])
ans = 0
for a, b in l:
if... | import math
n, h = list(map(int, input().split()))
A = 0
b = []
ans = 0
for _ in range(n):
u, v = list(map(int, input().split()))
A = max(A, u)
b.append(v)
for B in sorted(b, key=lambda x: -x):
if h <= 0 or B <= A:
break
h -= B
ans += 1
print((max(0, math.ceil(h / A)) + ans))
| false | 45.454545 | [
"-l = []",
"-x, y = 0, 0",
"+A = 0",
"+b = []",
"+ans = 0",
"- a, b = list(map(int, input().split()))",
"- if a > x or a == x and b < y:",
"- x, y = a, b",
"- if b < x:",
"- continue",
"- l.append((a, b))",
"-l.remove((x, y))",
"-l = sorted(l, key=lambda x: -x[1])",... | false | 0.048691 | 0.044467 | 1.095005 | [
"s999555444",
"s615282241"
] |
u508732591 | p02257 | python | s795730102 | s320365619 | 70 | 60 | 7,704 | 7,736 | Accepted | Accepted | 14.29 | def maybe_prime(d,s,n):
for a in (2,3,5,7):
x = pow(a,d,n)
if x==1 or x==n-1:
continue
for i in range(1,s):
x = pow(x,2,n)
if x==1: return False
elif x == n-1:
break
else:
return False
return ... | def maybe_prime(d,s,n):
for a in (2,3,5,7):
x = pow(a,d,n)
if x==1 or x==n-1:
continue
for i in range(1,s):
x = x*x%n
if x==1: return False
elif x == n-1:
break
else:
return False
return T... | 30 | 29 | 723 | 655 | def maybe_prime(d, s, n):
for a in (2, 3, 5, 7):
x = pow(a, d, n)
if x == 1 or x == n - 1:
continue
for i in range(1, s):
x = pow(x, 2, n)
if x == 1:
return False
elif x == n - 1:
break
else:
... | def maybe_prime(d, s, n):
for a in (2, 3, 5, 7):
x = pow(a, d, n)
if x == 1 or x == n - 1:
continue
for i in range(1, s):
x = x * x % n
if x == 1:
return False
elif x == n - 1:
break
else:
ret... | false | 3.333333 | [
"- x = pow(x, 2, n)",
"+ x = x * x % n",
"- return False",
"- elif 0 in [n % i for i in range(11, min(n - 1, 50), 2)]:"
] | false | 0.043129 | 0.044854 | 0.961554 | [
"s795730102",
"s320365619"
] |
u562935282 | p03111 | python | s375411341 | s872909518 | 325 | 228 | 3,064 | 9,220 | Accepted | Accepted | 29.85 | def main():
from itertools import product
N, A, B, C = list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
ans = 3000
for prod in product([0, 1, 2, 3], repeat=N):
t = [[] for _ in range(3)]
for i, x in enumerate(prod):
if x == 3: continu... | from itertools import product
INF = 10 ** 9
N, *A = list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
def estimate(lst):
if any(not p for p in lst):
return INF
ret = 0
for p, g in zip(lst, A):
ret += abs(g - sum(p)) + (len(p) - 1) * 10
return ... | 27 | 27 | 734 | 634 | def main():
from itertools import product
N, A, B, C = list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
ans = 3000
for prod in product([0, 1, 2, 3], repeat=N):
t = [[] for _ in range(3)]
for i, x in enumerate(prod):
if x == 3:
co... | from itertools import product
INF = 10**9
N, *A = list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
def estimate(lst):
if any(not p for p in lst):
return INF
ret = 0
for p, g in zip(lst, A):
ret += abs(g - sum(p)) + (len(p) - 1) * 10
return ret
ans = INF
for... | false | 0 | [
"-def main():",
"- from itertools import product",
"+from itertools import product",
"- N, A, B, C = list(map(int, input().split()))",
"- L = [int(eval(input())) for _ in range(N)]",
"- ans = 3000",
"- for prod in product([0, 1, 2, 3], repeat=N):",
"- t = [[] for _ in range(3)]",... | false | 0.230447 | 0.280595 | 0.82128 | [
"s375411341",
"s872909518"
] |
u724687935 | p04000 | python | s465994793 | s983154322 | 1,567 | 848 | 155,896 | 169,080 | Accepted | Accepted | 45.88 | def main():
import sys
# readline = sys.stdin.readline
readlines = sys.stdin.readlines
H, W, N = map(int, input().split())
grid = {}
P = set()
for s in readlines():
a, b = map(int, s.split())
a -= 1; b -= 1
if a in grid:
grid[a].add(b)
... | def main():
import sys
from collections import Counter
# readline = sys.stdin.readline
readlines = sys.stdin.readlines
H, W, N = list(map(int, input().split()))
P = set()
for s in readlines():
a, b = list(map(int, s.split()))
a -= 1; b -= 1
P.add((a, b))
... | 39 | 27 | 1,094 | 710 | def main():
import sys
# readline = sys.stdin.readline
readlines = sys.stdin.readlines
H, W, N = map(int, input().split())
grid = {}
P = set()
for s in readlines():
a, b = map(int, s.split())
a -= 1
b -= 1
if a in grid:
grid[a].add(b)
else... | def main():
import sys
from collections import Counter
# readline = sys.stdin.readline
readlines = sys.stdin.readlines
H, W, N = list(map(int, input().split()))
P = set()
for s in readlines():
a, b = list(map(int, s.split()))
a -= 1
b -= 1
P.add((a, b))
c... | false | 30.769231 | [
"+ from collections import Counter",
"- H, W, N = map(int, input().split())",
"- grid = {}",
"+ H, W, N = list(map(int, input().split()))",
"- a, b = map(int, s.split())",
"+ a, b = list(map(int, s.split()))",
"- if a in grid:",
"- grid[a].add(b)",
"- ... | false | 0.037845 | 0.065137 | 0.581006 | [
"s465994793",
"s983154322"
] |
u735335967 | p03680 | python | s304709426 | s230943695 | 329 | 206 | 25,136 | 7,084 | Accepted | Accepted | 37.39 | n = int(eval(input()))
a = [list(map(int, input().split())) for i in range(n)]
a = [e for row in a for e in row]
ans = 0
i = 0
while n > 0:
ans += 1
if a[i] == 2:
print(ans)
quit()
else:
i = a[i]-1
n -= 1
print((-1))
| n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
ans = 0
i = 0
while n > 0:
ans += 1
if a[i] == 2:
print(ans)
quit()
else:
i = a[i]-1
n -= 1
print((-1))
| 14 | 14 | 262 | 210 | n = int(eval(input()))
a = [list(map(int, input().split())) for i in range(n)]
a = [e for row in a for e in row]
ans = 0
i = 0
while n > 0:
ans += 1
if a[i] == 2:
print(ans)
quit()
else:
i = a[i] - 1
n -= 1
print((-1))
| n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
ans = 0
i = 0
while n > 0:
ans += 1
if a[i] == 2:
print(ans)
quit()
else:
i = a[i] - 1
n -= 1
print((-1))
| false | 0 | [
"-a = [list(map(int, input().split())) for i in range(n)]",
"-a = [e for row in a for e in row]",
"+a = [int(eval(input())) for i in range(n)]"
] | false | 0.03794 | 0.08931 | 0.424814 | [
"s304709426",
"s230943695"
] |
u627803856 | p02819 | python | s553710850 | s909890852 | 177 | 71 | 38,384 | 64,428 | Accepted | Accepted | 59.89 | x = int(eval(input()))
def is_prime(n):
for i in range(2, int(n ** 0.5) + 1):
if n % i == 0:
return False
return n != 1 # 1のときは例外
while True:
if is_prime(x):
print(x)
break
x += 1 | x = int(eval(input()))
# 素数
n = 10 ** 5 + 1000
primes = [True] * (n + 1)
p = 2
while p * p <= n:
if primes[p]:
for i in range(p * p, n + 1, p): # p*pスタートでいいのか
primes[i] = False
p += 1
primes[0], primes[1] = False, False
while True:
if primes[x]:
print(x)
... | 14 | 19 | 202 | 335 | x = int(eval(input()))
def is_prime(n):
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
return False
return n != 1 # 1のときは例外
while True:
if is_prime(x):
print(x)
break
x += 1
| x = int(eval(input()))
# 素数
n = 10**5 + 1000
primes = [True] * (n + 1)
p = 2
while p * p <= n:
if primes[p]:
for i in range(p * p, n + 1, p): # p*pスタートでいいのか
primes[i] = False
p += 1
primes[0], primes[1] = False, False
while True:
if primes[x]:
print(x)
exit()
x += 1
| false | 26.315789 | [
"-",
"-",
"-def is_prime(n):",
"- for i in range(2, int(n**0.5) + 1):",
"- if n % i == 0:",
"- return False",
"- return n != 1 # 1のときは例外",
"-",
"-",
"+# 素数",
"+n = 10**5 + 1000",
"+primes = [True] * (n + 1)",
"+p = 2",
"+while p * p <= n:",
"+ if primes[p]:",
... | false | 0.045016 | 0.07889 | 0.570615 | [
"s553710850",
"s909890852"
] |
u421781073 | p03807 | python | s951506350 | s222848144 | 60 | 47 | 11,104 | 11,104 | Accepted | Accepted | 21.67 | # -*- coding: utf-8 -*-
import sys
n = sys.stdin.readline().rstrip()
nums = (int(i) for i in sys.stdin.readline().rstrip().split())
odds = 0
for a in nums:
if a % 2 != 0:
odds += a
if odds % 2 == 0:
print('YES')
else:
print('NO') | # -*- coding: utf-8 -*-
import sys
n = sys.stdin.readline().rstrip()
nums = (int(i) for i in sys.stdin.readline().rstrip().split())
if sum(nums) % 2 == 0:
print('YES')
else:
print('NO') | 15 | 10 | 256 | 200 | # -*- coding: utf-8 -*-
import sys
n = sys.stdin.readline().rstrip()
nums = (int(i) for i in sys.stdin.readline().rstrip().split())
odds = 0
for a in nums:
if a % 2 != 0:
odds += a
if odds % 2 == 0:
print("YES")
else:
print("NO")
| # -*- coding: utf-8 -*-
import sys
n = sys.stdin.readline().rstrip()
nums = (int(i) for i in sys.stdin.readline().rstrip().split())
if sum(nums) % 2 == 0:
print("YES")
else:
print("NO")
| false | 33.333333 | [
"-odds = 0",
"-for a in nums:",
"- if a % 2 != 0:",
"- odds += a",
"-if odds % 2 == 0:",
"+if sum(nums) % 2 == 0:"
] | false | 0.084907 | 0.109089 | 0.778329 | [
"s951506350",
"s222848144"
] |
u703214333 | p03317 | python | s884353473 | s858191981 | 47 | 40 | 13,880 | 14,008 | Accepted | Accepted | 14.89 | n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
if n==k:
print((1))
exit()
i=n-k
ans=1
while i>0:
i=i-k+1
ans+=1
print(ans) | n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
print((-(-(n-k)//(k-1))+1))
| 11 | 3 | 161 | 90 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
if n == k:
print((1))
exit()
i = n - k
ans = 1
while i > 0:
i = i - k + 1
ans += 1
print(ans)
| n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
print((-(-(n - k) // (k - 1)) + 1))
| false | 72.727273 | [
"-if n == k:",
"- print((1))",
"- exit()",
"-i = n - k",
"-ans = 1",
"-while i > 0:",
"- i = i - k + 1",
"- ans += 1",
"-print(ans)",
"+print((-(-(n - k) // (k - 1)) + 1))"
] | false | 0.03747 | 0.036695 | 1.021115 | [
"s884353473",
"s858191981"
] |
u802963389 | p03564 | python | s357103258 | s294030363 | 164 | 17 | 38,384 | 2,940 | Accepted | Accepted | 89.63 | n = int(eval(input()))
k = int(eval(input()))
val = 1
for i in range(n):
val = min(val + k, val * 2)
print(val) | n = int(eval(input()))
k = int(eval(input()))
p = 1
for _ in range(n):
if p * 2 < p + k:
p *= 2
else:
p += k
print(p) | 7 | 9 | 108 | 125 | n = int(eval(input()))
k = int(eval(input()))
val = 1
for i in range(n):
val = min(val + k, val * 2)
print(val)
| n = int(eval(input()))
k = int(eval(input()))
p = 1
for _ in range(n):
if p * 2 < p + k:
p *= 2
else:
p += k
print(p)
| false | 22.222222 | [
"-val = 1",
"-for i in range(n):",
"- val = min(val + k, val * 2)",
"-print(val)",
"+p = 1",
"+for _ in range(n):",
"+ if p * 2 < p + k:",
"+ p *= 2",
"+ else:",
"+ p += k",
"+print(p)"
] | false | 0.04707 | 0.046418 | 1.014045 | [
"s357103258",
"s294030363"
] |
u796942881 | p03557 | python | s163392655 | s779646171 | 820 | 321 | 26,528 | 29,708 | Accepted | Accepted | 60.85 | N = int(eval(input()))
An = sorted([int(i) for i in input().split()])
Bn = list(map(int, input().split()))
Cn = sorted([int(i) for i in input().split()])
def lowerBound(a, v):
# 以上
return lb(a, 0, len(a), v)
def upperBound(a, v):
# より大きい
# 値をプラス1
return lb(a, 0, len(a), v + 1)
... | def main():
from bisect import bisect_left
from bisect import bisect_right
N = int(eval(input()))
An = list(map(int, input().split()))
Bn = list(map(int, input().split()))
Cn = list(map(int, input().split()))
A = sorted(An)
C = sorted(Cn)
print((sum(bisect_left(A, Bi... | 40 | 18 | 665 | 364 | N = int(eval(input()))
An = sorted([int(i) for i in input().split()])
Bn = list(map(int, input().split()))
Cn = sorted([int(i) for i in input().split()])
def lowerBound(a, v):
# 以上
return lb(a, 0, len(a), v)
def upperBound(a, v):
# より大きい
# 値をプラス1
return lb(a, 0, len(a), v + 1)
def lb(a, l, r, ... | def main():
from bisect import bisect_left
from bisect import bisect_right
N = int(eval(input()))
An = list(map(int, input().split()))
Bn = list(map(int, input().split()))
Cn = list(map(int, input().split()))
A = sorted(An)
C = sorted(Cn)
print((sum(bisect_left(A, Bi) * (N - bisect_... | false | 55 | [
"-N = int(eval(input()))",
"-An = sorted([int(i) for i in input().split()])",
"-Bn = list(map(int, input().split()))",
"-Cn = sorted([int(i) for i in input().split()])",
"+def main():",
"+ from bisect import bisect_left",
"+ from bisect import bisect_right",
"-",
"-def lowerBound(a, v):",
"-... | false | 0.126151 | 0.045918 | 2.747318 | [
"s163392655",
"s779646171"
] |
u490642448 | p03782 | python | s783655211 | s503359293 | 174 | 69 | 71,912 | 73,700 | Accepted | Accepted | 60.34 | n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
a.sort(reverse=True)
dp = [False] * (k)
dp[0] = True
min_n = 10**10
for i in a:
for j in range(k-1,-1,-1):
if(dp[j]):
if(j+i >= k):
min_n = i
else:
dp[j+i] = True
... | n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
a.sort(reverse=True)
mask = (1<<k)-1
dp = 1
min_n = 10**10
for i in a:
if(i >= k):
min_n = i
continue
dp |= (dp<<i)
if(dp > mask):
min_n = i
dp &= mask
ans = 0
for i in a:
... | 20 | 21 | 372 | 347 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort(reverse=True)
dp = [False] * (k)
dp[0] = True
min_n = 10**10
for i in a:
for j in range(k - 1, -1, -1):
if dp[j]:
if j + i >= k:
min_n = i
else:
dp[j + i] = True
ans = 0
... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort(reverse=True)
mask = (1 << k) - 1
dp = 1
min_n = 10**10
for i in a:
if i >= k:
min_n = i
continue
dp |= dp << i
if dp > mask:
min_n = i
dp &= mask
ans = 0
for i in a:
ans += i < min_n
print(... | false | 4.761905 | [
"-dp = [False] * (k)",
"-dp[0] = True",
"+mask = (1 << k) - 1",
"+dp = 1",
"- for j in range(k - 1, -1, -1):",
"- if dp[j]:",
"- if j + i >= k:",
"- min_n = i",
"- else:",
"- dp[j + i] = True",
"+ if i >= k:",
"+ min_n = i... | false | 0.040862 | 0.054567 | 0.748845 | [
"s783655211",
"s503359293"
] |
u137226361 | p02935 | python | s613101636 | s437357557 | 27 | 24 | 9,152 | 9,132 | Accepted | Accepted | 11.11 | n = int(eval(input()))
v =list(map(int, input().split()))
v.sort()
a = v[0]
for i in range(1, n):
a = (a+v[i])/2
print(a) | n = int(eval(input()))
v = list(map(int, input().split()))
v.sort()
ans = v[0]
for i in range(1, n):
ans = (ans + v[i]) / 2
print(ans) | 12 | 7 | 135 | 138 | n = int(eval(input()))
v = list(map(int, input().split()))
v.sort()
a = v[0]
for i in range(1, n):
a = (a + v[i]) / 2
print(a)
| n = int(eval(input()))
v = list(map(int, input().split()))
v.sort()
ans = v[0]
for i in range(1, n):
ans = (ans + v[i]) / 2
print(ans)
| false | 41.666667 | [
"-a = v[0]",
"+ans = v[0]",
"- a = (a + v[i]) / 2",
"-print(a)",
"+ ans = (ans + v[i]) / 2",
"+print(ans)"
] | false | 0.036302 | 0.035838 | 1.012955 | [
"s613101636",
"s437357557"
] |
u143492911 | p03854 | python | s528040390 | s068609716 | 22 | 19 | 3,188 | 3,188 | Accepted | Accepted | 13.64 | s=input().replace("eraser",",").replace("erase",",").replace("dreamer",",").replace("dream",",").replace(",","")
print(("YES" if s=="" else "NO")) | s=input().replace("eraser","").replace("erase","").replace("dreamer","").replace("dream","")
print(("YES" if s=="" else "NO")) | 2 | 2 | 145 | 125 | s = (
input()
.replace("eraser", ",")
.replace("erase", ",")
.replace("dreamer", ",")
.replace("dream", ",")
.replace(",", "")
)
print(("YES" if s == "" else "NO"))
| s = (
input()
.replace("eraser", "")
.replace("erase", "")
.replace("dreamer", "")
.replace("dream", "")
)
print(("YES" if s == "" else "NO"))
| false | 0 | [
"- .replace(\"eraser\", \",\")",
"- .replace(\"erase\", \",\")",
"- .replace(\"dreamer\", \",\")",
"- .replace(\"dream\", \",\")",
"- .replace(\",\", \"\")",
"+ .replace(\"eraser\", \"\")",
"+ .replace(\"erase\", \"\")",
"+ .replace(\"dreamer\", \"\")",
"+ .replace(\"dream... | false | 0.047298 | 0.038652 | 1.223673 | [
"s528040390",
"s068609716"
] |
u919633157 | p02911 | python | s964715581 | s887826647 | 166 | 130 | 13,548 | 6,580 | Accepted | Accepted | 21.69 | import sys
from collections import Counter
input=sys.stdin.readline
n,k,q=list(map(int,input().split()))
a=Counter([int(eval(input())) for _ in range(q)])
ans=[False]*n
for key,v in list(a.items()):
if k-(q-v)>0:
ans[key-1]=True
ss=set(a.keys())
for i in range(n):
if i+1 in ss:continu... | # 2019/09/16
# 解説のやつ
import sys
input=sys.stdin.readline
n,k,q=list(map(int,input().split()))
res=[k-q]*n
for i in range(q):
res[int(eval(input()))-1]+=1
for e in res:
print(('Yes' if e>0 else 'No')) | 26 | 13 | 429 | 208 | import sys
from collections import Counter
input = sys.stdin.readline
n, k, q = list(map(int, input().split()))
a = Counter([int(eval(input())) for _ in range(q)])
ans = [False] * n
for key, v in list(a.items()):
if k - (q - v) > 0:
ans[key - 1] = True
ss = set(a.keys())
for i in range(n):
if i + 1 in ... | # 2019/09/16
# 解説のやつ
import sys
input = sys.stdin.readline
n, k, q = list(map(int, input().split()))
res = [k - q] * n
for i in range(q):
res[int(eval(input())) - 1] += 1
for e in res:
print(("Yes" if e > 0 else "No"))
| false | 50 | [
"+# 2019/09/16",
"+# 解説のやつ",
"-from collections import Counter",
"-a = Counter([int(eval(input())) for _ in range(q)])",
"-ans = [False] * n",
"-for key, v in list(a.items()):",
"- if k - (q - v) > 0:",
"- ans[key - 1] = True",
"-ss = set(a.keys())",
"-for i in range(n):",
"- if i +... | false | 0.12779 | 0.10232 | 1.24892 | [
"s964715581",
"s887826647"
] |
u841568901 | p03835 | python | s870268306 | s528971159 | 1,418 | 843 | 9,164 | 9,064 | Accepted | Accepted | 40.55 | K, S = list(map(int, input().split()))
print((sum(0<=S-x-y<=min(K,S) for x in range(K+1) for y in range(K+1)))) | K, S = list(map(int, input().split()))
s = 0
for x in range(min(S,K)+1):
for y in range(min(S-x,K)+1):
if S-x-y<=K:
s += 1
print(s) | 2 | 7 | 104 | 143 | K, S = list(map(int, input().split()))
print((sum(0 <= S - x - y <= min(K, S) for x in range(K + 1) for y in range(K + 1))))
| K, S = list(map(int, input().split()))
s = 0
for x in range(min(S, K) + 1):
for y in range(min(S - x, K) + 1):
if S - x - y <= K:
s += 1
print(s)
| false | 71.428571 | [
"-print((sum(0 <= S - x - y <= min(K, S) for x in range(K + 1) for y in range(K + 1))))",
"+s = 0",
"+for x in range(min(S, K) + 1):",
"+ for y in range(min(S - x, K) + 1):",
"+ if S - x - y <= K:",
"+ s += 1",
"+print(s)"
] | false | 0.038254 | 0.007275 | 5.258194 | [
"s870268306",
"s528971159"
] |
u847467233 | p00208 | python | s517315788 | s429558692 | 380 | 310 | 5,628 | 5,624 | Accepted | Accepted | 18.42 | # AOJ 0208 Room Numbers of a Hospital
# Python3 2018.6.23 bal4u
# 8進数に変換して、01234567を01235789に置き換える
dic = {'0':'0','1':'1','2':'2','3':'3','4':'5','5':'7','6':'8','7':'9'}
while 1:
n = int(input())
if n == 0: break
s = list(format(n, 'o'))
for i in range(len(s)): s[i] = dic[s[i]]
print(*s, sep='')
| # AOJ 0208 Room Numbers of a Hospital
# Python3 2018.6.23 bal4u
# 8進数に変換して、01234567を01235789に置き換える
dic = {'0':'0','1':'1','2':'2','3':'3','4':'5','5':'7','6':'8','7':'9'}
while 1:
n = int(eval(input()))
if n == 0: break
s = format(n, 'o')
ans = ''
for i in range(len(s)): ans += dic[s[i]]
print(ans)
... | 12 | 13 | 317 | 315 | # AOJ 0208 Room Numbers of a Hospital
# Python3 2018.6.23 bal4u
# 8進数に変換して、01234567を01235789に置き換える
dic = {"0": "0", "1": "1", "2": "2", "3": "3", "4": "5", "5": "7", "6": "8", "7": "9"}
while 1:
n = int(input())
if n == 0:
break
s = list(format(n, "o"))
for i in range(len(s)):
s[i] = dic... | # AOJ 0208 Room Numbers of a Hospital
# Python3 2018.6.23 bal4u
# 8進数に変換して、01234567を01235789に置き換える
dic = {"0": "0", "1": "1", "2": "2", "3": "3", "4": "5", "5": "7", "6": "8", "7": "9"}
while 1:
n = int(eval(input()))
if n == 0:
break
s = format(n, "o")
ans = ""
for i in range(len(s)):
... | false | 7.692308 | [
"- n = int(input())",
"+ n = int(eval(input()))",
"- s = list(format(n, \"o\"))",
"+ s = format(n, \"o\")",
"+ ans = \"\"",
"- s[i] = dic[s[i]]",
"- print(*s, sep=\"\")",
"+ ans += dic[s[i]]",
"+ print(ans)"
] | false | 0.070533 | 0.061975 | 1.138076 | [
"s517315788",
"s429558692"
] |
u162911959 | p02952 | python | s614562878 | s898513321 | 66 | 58 | 3,060 | 3,060 | Accepted | Accepted | 12.12 | #!/usr/bin/env python3
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)
import math
n = int(readline())
count = 0
for i in range(1, n + 1):
if int(math.log10(i)) % 2 == 0:
count +=1
print(count) | #!/usr/bin/env python3
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)
n = int(readline())
count = 0
for i in range(1, n + 1):
if len(str(i)) % 2 == 1:
count += 1
print(count) | 14 | 13 | 299 | 278 | #!/usr/bin/env python3
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**7)
import math
n = int(readline())
count = 0
for i in range(1, n + 1):
if int(math.log10(i)) % 2 == 0:
count += 1
print(count)
| #!/usr/bin/env python3
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**7)
n = int(readline())
count = 0
for i in range(1, n + 1):
if len(str(i)) % 2 == 1:
count += 1
print(count)
| false | 7.142857 | [
"-import math",
"-",
"- if int(math.log10(i)) % 2 == 0:",
"+ if len(str(i)) % 2 == 1:"
] | false | 0.055836 | 0.04502 | 1.240253 | [
"s614562878",
"s898513321"
] |
u644516473 | p02665 | python | s600564033 | s988280384 | 1,049 | 906 | 668,704 | 668,704 | Accepted | Accepted | 13.63 | N = int(eval(input()))
A = list(map(int, input().split()))
d = [1] * (N+1)
d[0] -= A[0]
for i in range(N):
d[i+1] = d[i] * 2 - A[i+1]
if d[-1] < 0:
print((-1))
exit()
else:
d[-1] = A[-1]
for i in range(N, 0, -1):
x = d[i]
x += A[i-1]
if d[i-1] * 2 < x:
y = x - A[i-... | N = int(eval(input()))
A = list(map(int, input().split()))
d = [1] * (N+1)
d[0] -= A[0]
for i in range(N):
d[i+1] = d[i] * 2 - A[i+1]
if d[-1] < 0:
print((-1))
exit()
else:
d[-1] = A[-1]
for i in range(N, 0, -1):
x = d[i]
x += A[i-1]
d[i-1] = min(x, d[i-1]+A[i-1])
print((s... | 22 | 18 | 441 | 318 | N = int(eval(input()))
A = list(map(int, input().split()))
d = [1] * (N + 1)
d[0] -= A[0]
for i in range(N):
d[i + 1] = d[i] * 2 - A[i + 1]
if d[-1] < 0:
print((-1))
exit()
else:
d[-1] = A[-1]
for i in range(N, 0, -1):
x = d[i]
x += A[i - 1]
if d[i - 1] * 2 < x:
y = x - A[i - 1]
... | N = int(eval(input()))
A = list(map(int, input().split()))
d = [1] * (N + 1)
d[0] -= A[0]
for i in range(N):
d[i + 1] = d[i] * 2 - A[i + 1]
if d[-1] < 0:
print((-1))
exit()
else:
d[-1] = A[-1]
for i in range(N, 0, -1):
x = d[i]
x += A[i - 1]
d[i - 1] = min(x, d[i - 1] + A[i - 1])
print((sum(... | false | 18.181818 | [
"- if d[i - 1] * 2 < x:",
"- y = x - A[i - 1]",
"- if (y + 1) // 2 + A[i - 1] <= d[i - 1] * 2:",
"- x = d[i - 1] * 2"
] | false | 0.113022 | 0.046173 | 2.447822 | [
"s600564033",
"s988280384"
] |
u002459665 | p02842 | python | s106249039 | s734495603 | 32 | 29 | 3,060 | 2,940 | Accepted | Accepted | 9.38 | import math
def main():
N = int(eval(input()))
ans = False
for i in range(N+1):
x = math.floor(i * 1.08)
if x == N:
print(i)
ans = True
break
if not ans:
print(':(')
if __name__ == "__main__":
main() | import math
def main():
N = int(eval(input()))
ans = ':('
for i in range(N+1):
x = int(i * 1.08)
if x == N:
ans = i
print(ans)
if __name__ == "__main__":
main() | 16 | 13 | 290 | 216 | import math
def main():
N = int(eval(input()))
ans = False
for i in range(N + 1):
x = math.floor(i * 1.08)
if x == N:
print(i)
ans = True
break
if not ans:
print(":(")
if __name__ == "__main__":
main()
| import math
def main():
N = int(eval(input()))
ans = ":("
for i in range(N + 1):
x = int(i * 1.08)
if x == N:
ans = i
print(ans)
if __name__ == "__main__":
main()
| false | 18.75 | [
"- ans = False",
"+ ans = \":(\"",
"- x = math.floor(i * 1.08)",
"+ x = int(i * 1.08)",
"- print(i)",
"- ans = True",
"- break",
"- if not ans:",
"- print(\":(\")",
"+ ans = i",
"+ print(ans)"
] | false | 0.038366 | 0.035812 | 1.0713 | [
"s106249039",
"s734495603"
] |
u077291787 | p03425 | python | s727798192 | s552323487 | 141 | 50 | 3,888 | 3,884 | Accepted | Accepted | 64.54 | # ABC089C - March
from itertools import combinations
def main():
n = int(eval(input()))
lst = [input().rstrip()[0] for _ in range(n)]
cand = [lst.count(s) for s in "MARCH"]
ans = sum(x * y * z for x, y, z in combinations(cand, 3))
print(ans)
if __name__ == "__main__":
main() | # ABC089C - March
import sys
input = sys.stdin.readline
from itertools import combinations
def main():
n = int(eval(input()))
lst = [input().rstrip()[0] for _ in range(n)]
cand = [lst.count(s) for s in "MARCH"]
ans = sum(x * y * z for x, y, z in combinations(cand, 3))
print(ans)
... | 14 | 17 | 310 | 352 | # ABC089C - March
from itertools import combinations
def main():
n = int(eval(input()))
lst = [input().rstrip()[0] for _ in range(n)]
cand = [lst.count(s) for s in "MARCH"]
ans = sum(x * y * z for x, y, z in combinations(cand, 3))
print(ans)
if __name__ == "__main__":
main()
| # ABC089C - March
import sys
input = sys.stdin.readline
from itertools import combinations
def main():
n = int(eval(input()))
lst = [input().rstrip()[0] for _ in range(n)]
cand = [lst.count(s) for s in "MARCH"]
ans = sum(x * y * z for x, y, z in combinations(cand, 3))
print(ans)
if __name__ == ... | false | 17.647059 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.034953 | 0.037325 | 0.936445 | [
"s727798192",
"s552323487"
] |
u603958124 | p03363 | python | s576251666 | s267752803 | 219 | 186 | 43,304 | 46,044 | Accepted | Accepted | 15.07 | from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator i... | from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator i... | 30 | 26 | 871 | 843 | from math import (
ceil,
floor,
factorial,
gcd,
sqrt,
log2,
cos,
sin,
tan,
acos,
asin,
atan,
degrees,
radians,
pi,
inf,
)
from itertools import (
accumulate,
groupby,
permutations,
combinations,
product,
combinations_with_replacemen... | from math import (
ceil,
floor,
factorial,
gcd,
sqrt,
log2,
cos,
sin,
tan,
acos,
asin,
atan,
degrees,
radians,
pi,
inf,
)
from itertools import (
accumulate,
groupby,
permutations,
combinations,
product,
combinations_with_replacemen... | false | 13.333333 | [
"-s = accumulate(a)",
"-d = defaultdict(int)",
"-for x in s:",
"- d[x] += 1",
"-ans = d[0]",
"-for x in d:",
"- ans += d[x] * (d[x] - 1) // 2",
"+b = Counter(list(accumulate(a)) + [0])",
"+ans = 0",
"+for x in b:",
"+ ans += b[x] * (b[x] - 1) // 2"
] | false | 0.037256 | 0.098267 | 0.379129 | [
"s576251666",
"s267752803"
] |
u845573105 | p02623 | python | s110278729 | s107990801 | 1,058 | 282 | 41,972 | 47,464 | Accepted | Accepted | 73.35 | N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A = [0] + A
B = [0] + B
for i in range(1, N+1):
A[i] += A[i-1]
for i in range(1, M+1):
B[i] += B[i-1]
start = 0
end = N+1
while end-start > 1:
sep = (start+end)//2
if A[sep] <= K:
... | N,M,K=list(map(int,input().split()))
A=list(map(int, input().split()))
B=list(map(int, input().split()))
#入力終わり
#累積和とる
A_wa = [0]
for i in range(N) :
A_wa.append(A_wa[i]+A[i])
B_wa = [0]
for i in range(M) :
B_wa.append(B_wa[i]+B[i])
a = N
ans = 0
for b in range(M+1):
A_lim = K - B_wa... | 52 | 28 | 922 | 435 | N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A = [0] + A
B = [0] + B
for i in range(1, N + 1):
A[i] += A[i - 1]
for i in range(1, M + 1):
B[i] += B[i - 1]
start = 0
end = N + 1
while end - start > 1:
sep = (start + end) // 2
if A[sep] ... | N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
# 入力終わり
# 累積和とる
A_wa = [0]
for i in range(N):
A_wa.append(A_wa[i] + A[i])
B_wa = [0]
for i in range(M):
B_wa.append(B_wa[i] + B[i])
a = N
ans = 0
for b in range(M + 1):
A_lim = K - B_wa[b]
i... | false | 46.153846 | [
"-A = [0] + A",
"-B = [0] + B",
"-for i in range(1, N + 1):",
"- A[i] += A[i - 1]",
"-for i in range(1, M + 1):",
"- B[i] += B[i - 1]",
"-start = 0",
"-end = N + 1",
"-while end - start > 1:",
"- sep = (start + end) // 2",
"- if A[sep] <= K:",
"- start = sep",
"- else:"... | false | 0.061123 | 0.061672 | 0.991097 | [
"s110278729",
"s107990801"
] |
u634079249 | p02612 | python | s861282906 | s039751257 | 40 | 36 | 10,220 | 10,152 | Accepted | Accepted | 10 | import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: li... | import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: li... | 38 | 32 | 1,121 | 1,013 | import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(i... | import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(i... | false | 15.789474 | [
"- n = 1",
"- while True:",
"- if n * 1000 >= N:",
"- print(((n * 1000) - N))",
"- exit()",
"- else:",
"- n += 1",
"+ print(((1000 - N % 1000) % 1000))"
] | false | 0.037348 | 0.037192 | 1.004183 | [
"s861282906",
"s039751257"
] |
u991542950 | p02577 | python | s186429925 | s342397816 | 96 | 84 | 86,620 | 94,956 | Accepted | Accepted | 12.5 | N = eval(input())
N = list(N)
N = list(map(int, N))
if sum(N)%9 == 0:
print("Yes")
else:
print("No") | N = list(map(int, list(eval(input()))))
if sum(N) % 9 == 0:
print("Yes")
else:
print("No")
| 7 | 5 | 104 | 93 | N = eval(input())
N = list(N)
N = list(map(int, N))
if sum(N) % 9 == 0:
print("Yes")
else:
print("No")
| N = list(map(int, list(eval(input()))))
if sum(N) % 9 == 0:
print("Yes")
else:
print("No")
| false | 28.571429 | [
"-N = eval(input())",
"-N = list(N)",
"-N = list(map(int, N))",
"+N = list(map(int, list(eval(input()))))"
] | false | 0.044218 | 0.044958 | 0.983526 | [
"s186429925",
"s342397816"
] |
u515740713 | p02660 | python | s557003612 | s222239898 | 194 | 112 | 27,312 | 9,164 | Accepted | Accepted | 42.27 | import sys
import numpy as np
import bisect
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# 1~1000の累計和
a = [i for i in range(1,1000)]
s = np.cumsum(a)
s_list=list(s)
N = int(read())
if N ==1:
print((0))
sys.exit()
def factorization(n):
ar... | import math
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def factorization(n):
arr = []
for i in range(2,int(math.sqrt(n))+1):
cnt = 0
if n % i == 0:
while n % i ==0:
n //= i
... | 39 | 32 | 780 | 661 | import sys
import numpy as np
import bisect
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# 1~1000の累計和
a = [i for i in range(1, 1000)]
s = np.cumsum(a)
s_list = list(s)
N = int(read())
if N == 1:
print((0))
sys.exit()
def factorization(n):
arr = ... | import math
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def factorization(n):
arr = []
for i in range(2, int(math.sqrt(n)) + 1):
cnt = 0
if n % i == 0:
while n % i == 0:
n //= i
... | false | 17.948718 | [
"+import math",
"-import numpy as np",
"-import bisect",
"-# 1~1000の累計和",
"-a = [i for i in range(1, 1000)]",
"-s = np.cumsum(a)",
"-s_list = list(s)",
"-N = int(read())",
"-if N == 1:",
"- print((0))",
"- sys.exit()",
"- temp = n",
"- for i in range(2, int(-(-(n**0.5) // 1)) + 1... | false | 0.483923 | 0.132859 | 3.642371 | [
"s557003612",
"s222239898"
] |
u102242691 | p03720 | python | s982503846 | s216698407 | 19 | 17 | 3,060 | 3,060 | Accepted | Accepted | 10.53 |
n,m = list(map(int,input().split()))
city = []
for i in range(n):
city.append([i,0])
for i in range(m):
a,b = list(map(int,input().split()))
city[a-1][1] += 1
city[b-1][1] += 1
for j in range(n):
print((city[j][1]))
|
n,m = list(map(int,input().split()))
s = [[0]*n for _ in range(n)]
for _ in range(m):
a,b = list(map(int,input().split()))
# print(a,b)
s[a-1][b-1] += 1
s[b-1][a-1] += 1
# print(s)
for i in range(n):
print((sum(s[i])))
"""
以下の指定では、一度の値変更で、全ての要素の該当部分の数値が一斉に変わる。
http://delta11451... | 13 | 20 | 237 | 398 | n, m = list(map(int, input().split()))
city = []
for i in range(n):
city.append([i, 0])
for i in range(m):
a, b = list(map(int, input().split()))
city[a - 1][1] += 1
city[b - 1][1] += 1
for j in range(n):
print((city[j][1]))
| n, m = list(map(int, input().split()))
s = [[0] * n for _ in range(n)]
for _ in range(m):
a, b = list(map(int, input().split()))
# print(a,b)
s[a - 1][b - 1] += 1
s[b - 1][a - 1] += 1
# print(s)
for i in range(n):
print((sum(s[i])))
"""
以下の指定では、一度の値変更で、全ての要素の該当部分の数値が一斉に変わる。
http://delta114514.... | false | 35 | [
"-city = []",
"+s = [[0] * n for _ in range(n)]",
"+for _ in range(m):",
"+ a, b = list(map(int, input().split()))",
"+ # print(a,b)",
"+ s[a - 1][b - 1] += 1",
"+ s[b - 1][a - 1] += 1",
"+# print(s)",
"- city.append([i, 0])",
"-for i in range(m):",
"- a, b = list(map(int... | false | 0.049331 | 0.068308 | 0.722191 | [
"s982503846",
"s216698407"
] |
u112364985 | p03545 | python | s535052922 | s243360291 | 28 | 25 | 9,112 | 9,068 | Accepted | Accepted | 10.71 | a,b,c,d=eval(input())
for i in range(2**3):
l=["-","-","-"]
for j in range(3):
if (i>>j&1):
l[j]="+"
if eval(a+l[0]+b+l[1]+c+l[2]+d)==7:
print((a+l[0]+b+l[1]+c+l[2]+d+"=7"))
exit() | a,b,c,d=eval(input())
for i in range(2**3):
op=["-","-","-"]
for j in range(3):
if (i>>j&1):
op[j]="+"
if eval(a+op[0]+b+op[1]+c+op[2]+d)==7:
print((a+op[0]+b+op[1]+c+op[2]+d+"=7"))
exit() | 9 | 9 | 228 | 236 | a, b, c, d = eval(input())
for i in range(2**3):
l = ["-", "-", "-"]
for j in range(3):
if i >> j & 1:
l[j] = "+"
if eval(a + l[0] + b + l[1] + c + l[2] + d) == 7:
print((a + l[0] + b + l[1] + c + l[2] + d + "=7"))
exit()
| a, b, c, d = eval(input())
for i in range(2**3):
op = ["-", "-", "-"]
for j in range(3):
if i >> j & 1:
op[j] = "+"
if eval(a + op[0] + b + op[1] + c + op[2] + d) == 7:
print((a + op[0] + b + op[1] + c + op[2] + d + "=7"))
exit()
| false | 0 | [
"- l = [\"-\", \"-\", \"-\"]",
"+ op = [\"-\", \"-\", \"-\"]",
"- l[j] = \"+\"",
"- if eval(a + l[0] + b + l[1] + c + l[2] + d) == 7:",
"- print((a + l[0] + b + l[1] + c + l[2] + d + \"=7\"))",
"+ op[j] = \"+\"",
"+ if eval(a + op[0] + b + op[1] + c + op[2] + d) ... | false | 0.035996 | 0.037788 | 0.95257 | [
"s535052922",
"s243360291"
] |
u285443936 | p02796 | python | s405982408 | s264816116 | 412 | 284 | 21,400 | 24,684 | Accepted | Accepted | 31.07 | N = int(eval(input()))
XL = [tuple(map(int,input().split())) for i in range(N)]
XL.sort(key=lambda x: x[0]+x[1])
right = -float('inf')
ans = 0
for x,l in XL:
s,t = x-l, x+l
if s >= right:
right = t
ans += 1
print(ans)
| N = int(eval(input()))
table = []
for i in range(N):
X,L = list(map(int,input().split()))
table.append((X-L,X+L))
table = sorted(table, key=lambda x:x[1])
cur = 0
l_cur, r_cur = table[0]
ans = N
for i in range(1,N):
l,r = table[i]
if r_cur > l:
ans -= 1
else:
l_cur, r... | 11 | 17 | 246 | 330 | N = int(eval(input()))
XL = [tuple(map(int, input().split())) for i in range(N)]
XL.sort(key=lambda x: x[0] + x[1])
right = -float("inf")
ans = 0
for x, l in XL:
s, t = x - l, x + l
if s >= right:
right = t
ans += 1
print(ans)
| N = int(eval(input()))
table = []
for i in range(N):
X, L = list(map(int, input().split()))
table.append((X - L, X + L))
table = sorted(table, key=lambda x: x[1])
cur = 0
l_cur, r_cur = table[0]
ans = N
for i in range(1, N):
l, r = table[i]
if r_cur > l:
ans -= 1
else:
l_cur, r_cur =... | false | 35.294118 | [
"-XL = [tuple(map(int, input().split())) for i in range(N)]",
"-XL.sort(key=lambda x: x[0] + x[1])",
"-right = -float(\"inf\")",
"-ans = 0",
"-for x, l in XL:",
"- s, t = x - l, x + l",
"- if s >= right:",
"- right = t",
"- ans += 1",
"+table = []",
"+for i in range(N):",
"... | false | 0.036504 | 0.035665 | 1.023534 | [
"s405982408",
"s264816116"
] |
u692632484 | p03329 | python | s134478625 | s524793299 | 1,308 | 242 | 3,864 | 3,060 | Accepted | Accepted | 81.5 | INF=9999999
n=int(eval(input()))
dp=[INF for i in range(n+1)]
dp[-1]=0
for i in range(n,0,-1):
e6=1
while 6**e6<=i:
dp[i-6**e6]=min(dp[i]+1,dp[i-6**e6])
e6+=1
e9=1
while 9**e9<=i:
dp[i-9**e9]=min(dp[i]+1,dp[i-9**e9])
e9+=1
ans=INF
for i in range(n):
i... | #補助関数
def convert(num,radix):
res = 0
while num > 0:
res += num % radix
num //= radix
return res
#入力
INF = (1 << 31)
N = int(eval(input()))
ans = INF
#計算
for i in range(N + 1):
dec6 = i
dec9 = N - i
ans = min(ans , convert(dec6,6) + convert(dec9,9))
#出力
... | 22 | 21 | 407 | 325 | INF = 9999999
n = int(eval(input()))
dp = [INF for i in range(n + 1)]
dp[-1] = 0
for i in range(n, 0, -1):
e6 = 1
while 6**e6 <= i:
dp[i - 6**e6] = min(dp[i] + 1, dp[i - 6**e6])
e6 += 1
e9 = 1
while 9**e9 <= i:
dp[i - 9**e9] = min(dp[i] + 1, dp[i - 9**e9])
e9 += 1
ans = I... | # 補助関数
def convert(num, radix):
res = 0
while num > 0:
res += num % radix
num //= radix
return res
# 入力
INF = 1 << 31
N = int(eval(input()))
ans = INF
# 計算
for i in range(N + 1):
dec6 = i
dec9 = N - i
ans = min(ans, convert(dec6, 6) + convert(dec9, 9))
# 出力
print(ans)
| false | 4.545455 | [
"-INF = 9999999",
"-n = int(eval(input()))",
"-dp = [INF for i in range(n + 1)]",
"-dp[-1] = 0",
"-for i in range(n, 0, -1):",
"- e6 = 1",
"- while 6**e6 <= i:",
"- dp[i - 6**e6] = min(dp[i] + 1, dp[i - 6**e6])",
"- e6 += 1",
"- e9 = 1",
"- while 9**e9 <= i:",
"- ... | false | 0.244187 | 0.056562 | 4.317114 | [
"s134478625",
"s524793299"
] |
u667084803 | p04046 | python | s370159088 | s468564545 | 360 | 274 | 26,864 | 18,964 | Accepted | Accepted | 23.89 | from math import factorial
H,W,A,B=list(map(int, input().split()))
p=10**9+7
ans=0
X=[1,1] #階乗テーブル
Y=[1,1] #階乗の逆元テーブル
calc=[0,1] #逆元計算用テーブル
for i in range( 2, H+W-2 ):
X.append( ( X[-1] * i ) % p )
calc.append( ( -calc[p % i] * (p//i) ) % p )
Y.append( (Y[-1] * calc[-1]) % p )
for i in range(B... | def power_func(a,b,p):
"""a^b mod p を求める"""
if b==0: return 1
if b%2==0:
d=power_func(a,b//2,p)
return d*d %p
if b%2==1:
return (a*power_func(a,b-1,p ))%p
H,W,A,B=list(map(int, input().split()))
p=10**9+7
ans=0
X=[1] #階乗テーブル
for i in range(1,H+W-1):
X+=[ (X[-1]*i) %p ]
Y=[1]*(H+W-... | 15 | 23 | 398 | 521 | from math import factorial
H, W, A, B = list(map(int, input().split()))
p = 10**9 + 7
ans = 0
X = [1, 1] # 階乗テーブル
Y = [1, 1] # 階乗の逆元テーブル
calc = [0, 1] # 逆元計算用テーブル
for i in range(2, H + W - 2):
X.append((X[-1] * i) % p)
calc.append((-calc[p % i] * (p // i)) % p)
Y.append((Y[-1] * calc[-1]) % p)
for i in ... | def power_func(a, b, p):
"""a^b mod p を求める"""
if b == 0:
return 1
if b % 2 == 0:
d = power_func(a, b // 2, p)
return d * d % p
if b % 2 == 1:
return (a * power_func(a, b - 1, p)) % p
H, W, A, B = list(map(int, input().split()))
p = 10**9 + 7
ans = 0
X = [1] # 階乗テーブル
fo... | false | 34.782609 | [
"-from math import factorial",
"+def power_func(a, b, p):",
"+ \"\"\"a^b mod p を求める\"\"\"",
"+ if b == 0:",
"+ return 1",
"+ if b % 2 == 0:",
"+ d = power_func(a, b // 2, p)",
"+ return d * d % p",
"+ if b % 2 == 1:",
"+ return (a * power_func(a, b - 1, p)) ... | false | 0.041939 | 0.045787 | 0.915955 | [
"s370159088",
"s468564545"
] |
u440566786 | p03409 | python | s316793786 | s432040252 | 207 | 175 | 45,036 | 39,280 | Accepted | Accepted | 15.46 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
from collections import deque
class HopcroftKarp:
def __init__(self, N0, N1):
self.N0 = N0
self.N1 = N1
self.N = N = 2+N0+N1
self.G = [[] for i in range(... | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
n=int(eval(input()))
AB=[list(map(int,input().split())) for _ in range(n)]
CD=[list(map(int,input().split())) for _ in range(n)]
AB.sort(lambda x:x[1],reverse=1)
... | 90 | 24 | 2,547 | 606 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
from collections import deque
class HopcroftKarp:
def __init__(self, N0, N1):
self.N0 = N0
self.N1 = N1
self.N = N = 2 + N0 + N1
self.G = [[] for i in rang... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def resolve():
n = int(eval(input()))
AB = [list(map(int, input().split())) for _ in range(n)]
CD = [list(map(int, input().split())) for _ in range(n)]
AB.sort(lambda x: x[1],... | false | 73.333333 | [
"-from collections import deque",
"-",
"-",
"-class HopcroftKarp:",
"- def __init__(self, N0, N1):",
"- self.N0 = N0",
"- self.N1 = N1",
"- self.N = N = 2 + N0 + N1",
"- self.G = [[] for i in range(N)]",
"- for i in range(N0):",
"- forward = [2 + ... | false | 0.038119 | 0.037053 | 1.028771 | [
"s316793786",
"s432040252"
] |
u790710233 | p02572 | python | s136718831 | s479178611 | 167 | 120 | 31,252 | 31,448 | Accepted | Accepted | 28.14 | from itertools import accumulate
n = int(eval(input()))
A = list(map(int, input().split()))
MOD = 10**9+7
Acum = list(accumulate(A))
ans = 0
for i, a in enumerate(reversed(A[1:])):
ans += Acum[n-i-2]*a
ans %= MOD
print(ans)
| n = int(eval(input()))
A = list(map(int, input().split()))
S = sum(A)
T = sum([x**2 for x in A])
print(((S**2-T)//2 % (10**9+7)))
| 13 | 5 | 241 | 131 | from itertools import accumulate
n = int(eval(input()))
A = list(map(int, input().split()))
MOD = 10**9 + 7
Acum = list(accumulate(A))
ans = 0
for i, a in enumerate(reversed(A[1:])):
ans += Acum[n - i - 2] * a
ans %= MOD
print(ans)
| n = int(eval(input()))
A = list(map(int, input().split()))
S = sum(A)
T = sum([x**2 for x in A])
print(((S**2 - T) // 2 % (10**9 + 7)))
| false | 61.538462 | [
"-from itertools import accumulate",
"-",
"-MOD = 10**9 + 7",
"-Acum = list(accumulate(A))",
"-ans = 0",
"-for i, a in enumerate(reversed(A[1:])):",
"- ans += Acum[n - i - 2] * a",
"- ans %= MOD",
"-print(ans)",
"+S = sum(A)",
"+T = sum([x**2 for x in A])",
"+print(((S**2 - T) // 2 % (10... | false | 0.048024 | 0.043379 | 1.107072 | [
"s136718831",
"s479178611"
] |
u934442292 | p03523 | python | s564080825 | s495557986 | 31 | 26 | 9,100 | 9,044 | Accepted | Accepted | 16.13 | import sys
input = sys.stdin.readline
def main():
S = input().rstrip()
for s in "KIHBR":
if S.count(s) != 1:
print("NO")
exit()
A = S.count("A")
if len(S) - A != 5:
print("NO")
exit()
K = S.find("K")
I = S.find("I")
H ... | import sys
input = sys.stdin.readline
def main():
S = input().rstrip()
# AKIHABARA
correct_list = [
"AKIHABARA",
"KIHABARA",
"AKIHBARA",
"AKIHABRA",
"AKIHABAR",
"KIHBARA",
"KIHABRA",
"KIHABAR",
"AKIHBRA",
... | 50 | 42 | 853 | 708 | import sys
input = sys.stdin.readline
def main():
S = input().rstrip()
for s in "KIHBR":
if S.count(s) != 1:
print("NO")
exit()
A = S.count("A")
if len(S) - A != 5:
print("NO")
exit()
K = S.find("K")
I = S.find("I")
H = S.find("H")
B = S... | import sys
input = sys.stdin.readline
def main():
S = input().rstrip()
# AKIHABARA
correct_list = [
"AKIHABARA",
"KIHABARA",
"AKIHBARA",
"AKIHABRA",
"AKIHABAR",
"KIHBARA",
"KIHABRA",
"KIHABAR",
"AKIHBRA",
"AKIHBAR",
"... | false | 16 | [
"- for s in \"KIHBR\":",
"- if S.count(s) != 1:",
"- print(\"NO\")",
"- exit()",
"- A = S.count(\"A\")",
"- if len(S) - A != 5:",
"+ # AKIHABARA",
"+ correct_list = [",
"+ \"AKIHABARA\",",
"+ \"KIHABARA\",",
"+ \"AKIHBARA\",",
"+... | false | 0.039377 | 0.038708 | 1.017276 | [
"s564080825",
"s495557986"
] |
u177398299 | p03326 | python | s740472392 | s042194347 | 797 | 217 | 167,388 | 40,816 | Accepted | Accepted | 72.77 | N, M = list(map(int, input().split()))
cake = [list(map(int, input().split())) for _ in range(N)]
INF = 10 ** 18
dp = [[[-INF] * 8 for _ in range(M + 1)] for _ in range(N + 1)]
for i in range(N + 1):
for msk in range(8):
dp[i][0][msk] = 0
for i in range(1, N + 1):
x, y, z = cake[i - 1]
... | N, M = list(map(int, input().split()))
cake = [list(map(int, input().split())) for _ in range(N)]
ans = [[] for _ in range(8)]
for x, y, z in cake:
for msk in range(8):
mx = x * (1 - 2 * (msk >> 2 & 1))
my = y * (1 - 2 * (msk >> 1 & 1))
mz = z * (1 - 2 * (msk >> 0 & 1))
ans... | 20 | 12 | 678 | 401 | N, M = list(map(int, input().split()))
cake = [list(map(int, input().split())) for _ in range(N)]
INF = 10**18
dp = [[[-INF] * 8 for _ in range(M + 1)] for _ in range(N + 1)]
for i in range(N + 1):
for msk in range(8):
dp[i][0][msk] = 0
for i in range(1, N + 1):
x, y, z = cake[i - 1]
for j in range(... | N, M = list(map(int, input().split()))
cake = [list(map(int, input().split())) for _ in range(N)]
ans = [[] for _ in range(8)]
for x, y, z in cake:
for msk in range(8):
mx = x * (1 - 2 * (msk >> 2 & 1))
my = y * (1 - 2 * (msk >> 1 & 1))
mz = z * (1 - 2 * (msk >> 0 & 1))
ans[msk].appe... | false | 40 | [
"-INF = 10**18",
"-dp = [[[-INF] * 8 for _ in range(M + 1)] for _ in range(N + 1)]",
"-for i in range(N + 1):",
"+ans = [[] for _ in range(8)]",
"+for x, y, z in cake:",
"- dp[i][0][msk] = 0",
"-for i in range(1, N + 1):",
"- x, y, z = cake[i - 1]",
"- for j in range(1, M + 1):",
"- ... | false | 0.037217 | 0.036406 | 1.022277 | [
"s740472392",
"s042194347"
] |
u368796742 | p02735 | python | s373851747 | s975488457 | 815 | 204 | 816,648 | 43,120 | Accepted | Accepted | 74.97 | def main():
from collections import deque
h,w = list(map(int,input().split()))
l = [list(eval(input())) for i in range(h)]
dp = [[[-1]*(h*w) for i in range(w)] for i in range(h)]
q = deque([])
if l[0][0] == ".":
q.append((0,0,0,"."))
else:
q.append((0,0,1,"#"))
... | h,w = list(map(int,input().split()))
l = [list(eval(input())) for i in range(h)]
dp = [[-1]*w for i in range(h)]
if l[0][0] == ".":
dp[0][0] = 0
else:
dp[0][0] = 1
for i in range(h):
for j in range(w):
if i == 0 and j == 0:
continue
if i == 0:
if l[i... | 33 | 35 | 960 | 917 | def main():
from collections import deque
h, w = list(map(int, input().split()))
l = [list(eval(input())) for i in range(h)]
dp = [[[-1] * (h * w) for i in range(w)] for i in range(h)]
q = deque([])
if l[0][0] == ".":
q.append((0, 0, 0, "."))
else:
q.append((0, 0, 1, "#"))
... | h, w = list(map(int, input().split()))
l = [list(eval(input())) for i in range(h)]
dp = [[-1] * w for i in range(h)]
if l[0][0] == ".":
dp[0][0] = 0
else:
dp[0][0] = 1
for i in range(h):
for j in range(w):
if i == 0 and j == 0:
continue
if i == 0:
if l[i][j - 1] == ".... | false | 5.714286 | [
"-def main():",
"- from collections import deque",
"-",
"- h, w = list(map(int, input().split()))",
"- l = [list(eval(input())) for i in range(h)]",
"- dp = [[[-1] * (h * w) for i in range(w)] for i in range(h)]",
"- q = deque([])",
"- if l[0][0] == \".\":",
"- q.append((0, ... | false | 0.067235 | 0.071712 | 0.937569 | [
"s373851747",
"s975488457"
] |
u777283665 | p03017 | python | s649488991 | s943890032 | 51 | 37 | 3,572 | 3,636 | Accepted | Accepted | 27.45 | n, a, b, c, d = list(map(int, input().split()))
a, b, c, d = a-1, b-1, c-1, d-1
s = eval(input())
if c < d:
for i in range(b, d):
if s[i] == "#" and s[i+1] == "#":
print("No")
exit()
for i in range(a, c):
if s[i] == "#" and s[i+1] == "#":
print("... | n, a, b, c, d = list(map(int, input().split()))
a, b, c, d = a-1, b-1, c-1, d-1
s = eval(input())
if "##" in s[a:d]:
print("No")
exit()
if c < d:
for i in range(b, d):
if s[i] == "#" and s[i+1] == "#":
print("No")
exit()
print("Yes")
else:
for i i... | 23 | 23 | 514 | 450 | n, a, b, c, d = list(map(int, input().split()))
a, b, c, d = a - 1, b - 1, c - 1, d - 1
s = eval(input())
if c < d:
for i in range(b, d):
if s[i] == "#" and s[i + 1] == "#":
print("No")
exit()
for i in range(a, c):
if s[i] == "#" and s[i + 1] == "#":
print("No... | n, a, b, c, d = list(map(int, input().split()))
a, b, c, d = a - 1, b - 1, c - 1, d - 1
s = eval(input())
if "##" in s[a:d]:
print("No")
exit()
if c < d:
for i in range(b, d):
if s[i] == "#" and s[i + 1] == "#":
print("No")
exit()
print("Yes")
else:
for i in range(b, ... | false | 0 | [
"+if \"##\" in s[a:d]:",
"+ print(\"No\")",
"+ exit()",
"- if s[i] == \"#\" and s[i + 1] == \"#\":",
"- print(\"No\")",
"- exit()",
"- for i in range(a, c):"
] | false | 0.037478 | 0.043215 | 0.867248 | [
"s649488991",
"s943890032"
] |
u273010357 | p02802 | python | s194485668 | s293925606 | 312 | 267 | 4,596 | 44,464 | Accepted | Accepted | 14.42 | def solve():
N, M = list(map(int, input().split()))
WAnum = 0
ACnum = 0
WA = [0]*(N+1)
AC = [False]*(N+1)
for _ in range(M):
p, S = list(map(str, input().split()))
p = int(p)
if AC[p] == True:
continue
if S == 'AC':
AC[p] = Tr... | import sys, heapq
from collections import defaultdict
from itertools import product, permutations, combinations
from bisect import bisect_left # bisect(list, value) -> index
sys.setrecursionlimit(10**7)
def input():
return sys.stdin.readline()[:-1]
N, M = list(map(int, input().split()))
pS = [list(input... | 23 | 30 | 490 | 833 | def solve():
N, M = list(map(int, input().split()))
WAnum = 0
ACnum = 0
WA = [0] * (N + 1)
AC = [False] * (N + 1)
for _ in range(M):
p, S = list(map(str, input().split()))
p = int(p)
if AC[p] == True:
continue
if S == "AC":
AC[p] = True
... | import sys, heapq
from collections import defaultdict
from itertools import product, permutations, combinations
from bisect import bisect_left # bisect(list, value) -> index
sys.setrecursionlimit(10**7)
def input():
return sys.stdin.readline()[:-1]
N, M = list(map(int, input().split()))
pS = [list(input().spl... | false | 23.333333 | [
"-def solve():",
"- N, M = list(map(int, input().split()))",
"- WAnum = 0",
"- ACnum = 0",
"- WA = [0] * (N + 1)",
"- AC = [False] * (N + 1)",
"- for _ in range(M):",
"- p, S = list(map(str, input().split()))",
"- p = int(p)",
"- if AC[p] == True:",
"- ... | false | 0.03775 | 0.036404 | 1.036964 | [
"s194485668",
"s293925606"
] |
u038021590 | p03167 | python | s044319736 | s212084841 | 405 | 159 | 129,368 | 119,732 | Accepted | Accepted | 60.74 | mod = 10**9 + 7
H, W = list(map(int, input().split()))
Maze = [[0]*(W+1) for _ in range(H+1)]
Memo = [[0]*(W+1) for _ in range(H+1)]
Memo[H-1][W-1] = 1
for i in range(H):
S = eval(input())
for j in range(W):
Maze[i][j] = S[j]
for a in range(H-1, -1, -1):
for b in range(W-1, -1, -1):
... | H, W = list(map(int, input().split()))
S = [[a for a in eval(input())] for _ in range(H)]
mod = 10 ** 9 + 7
DP = [[0] * (W + 1) for _ in range(H+1)]
DP[1][1] = 1
for i in range(1, H+1):
for j in range(1, W+1):
if S[i-1][j-1] == '#':
continue
if i == 1 and j == 1:
co... | 20 | 15 | 545 | 409 | mod = 10**9 + 7
H, W = list(map(int, input().split()))
Maze = [[0] * (W + 1) for _ in range(H + 1)]
Memo = [[0] * (W + 1) for _ in range(H + 1)]
Memo[H - 1][W - 1] = 1
for i in range(H):
S = eval(input())
for j in range(W):
Maze[i][j] = S[j]
for a in range(H - 1, -1, -1):
for b in range(W - 1, -1, -... | H, W = list(map(int, input().split()))
S = [[a for a in eval(input())] for _ in range(H)]
mod = 10**9 + 7
DP = [[0] * (W + 1) for _ in range(H + 1)]
DP[1][1] = 1
for i in range(1, H + 1):
for j in range(1, W + 1):
if S[i - 1][j - 1] == "#":
continue
if i == 1 and j == 1:
cont... | false | 25 | [
"+H, W = list(map(int, input().split()))",
"+S = [[a for a in eval(input())] for _ in range(H)]",
"-H, W = list(map(int, input().split()))",
"-Maze = [[0] * (W + 1) for _ in range(H + 1)]",
"-Memo = [[0] * (W + 1) for _ in range(H + 1)]",
"-Memo[H - 1][W - 1] = 1",
"-for i in range(H):",
"- S = eva... | false | 0.085071 | 0.043938 | 1.936161 | [
"s044319736",
"s212084841"
] |
u074220993 | p03835 | python | s809890998 | s347019040 | 1,175 | 1,076 | 9,112 | 9,088 | Accepted | Accepted | 8.43 | K, S = list(map(int, input().split()))
cnt = 0
for x in range(K+1):
for y in range(K+1):
z = S - x - y
if 0 <= z <= K:
cnt += 1
print(cnt) | K, S = list(map(int, input().split()))
cnt = 0
from itertools import product as prd
for x, y in prd(list(range(K+1)),list(range(K+1))):
if 0 <= S-x-y <= K:
cnt += 1
print(cnt) | 8 | 7 | 171 | 175 | K, S = list(map(int, input().split()))
cnt = 0
for x in range(K + 1):
for y in range(K + 1):
z = S - x - y
if 0 <= z <= K:
cnt += 1
print(cnt)
| K, S = list(map(int, input().split()))
cnt = 0
from itertools import product as prd
for x, y in prd(list(range(K + 1)), list(range(K + 1))):
if 0 <= S - x - y <= K:
cnt += 1
print(cnt)
| false | 12.5 | [
"-for x in range(K + 1):",
"- for y in range(K + 1):",
"- z = S - x - y",
"- if 0 <= z <= K:",
"- cnt += 1",
"+from itertools import product as prd",
"+",
"+for x, y in prd(list(range(K + 1)), list(range(K + 1))):",
"+ if 0 <= S - x - y <= K:",
"+ cnt += 1"
] | false | 0.05831 | 0.039734 | 1.467495 | [
"s809890998",
"s347019040"
] |
u156815136 | p02642 | python | s454886602 | s822795712 | 393 | 338 | 45,220 | 50,616 | Accepted | Accepted | 13.99 | #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
#from fractions import gcd
#from itertools import combinations # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict
#import bisect
#
# d =... | #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict
#import bisect
... | 58 | 44 | 1,224 | 993 | # from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
# from fractions import gcd
# from itertools import combinations # (string,3) 3回
# from collections import deque
from collections import deque, defaultdict
# import bisect
#
# d =... | # from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations, permutations # (string,3) 3回
# from collections import deque
from collections import deque, defaultdict
# import bisec... | false | 24.137931 | [
"-# from fractions import gcd",
"-# from itertools import combinations # (string,3) 3回",
"+from fractions import gcd",
"+from itertools import combinations, permutations # (string,3) 3回",
"+",
"-n = I()",
"-A = sorted(readInts())",
"-dic = defaultdict(int)",
"+N = I()",
"+A = readInts()",
"+imp... | false | 0.154277 | 0.148878 | 1.036269 | [
"s454886602",
"s822795712"
] |
u488401358 | p02816 | python | s581442773 | s330998755 | 1,505 | 583 | 138,624 | 128,080 | Accepted | Accepted | 61.26 | def divisors(M):#Mの約数列 O(n^(0.5+e))
import math
d=[]
i=1
while math.sqrt(M)>=i:
if M%i==0:
d.append(i)
if i**2!=M:
d.append(M//i)
i=i+1
d.sort()
return d
N=int(eval(input()))
a=list(map(int,input().split()))
b=list(map(int,i... | #Z[i]:length of the longest list starting from S[i] which is also a prefix of S
#O(|S|)
def Z_algorithm(s):
N = len(s)
Z_alg = [0]*N
Z_alg[0] = N
i = 1
j = 0
while i < N:
while i+j < N and s[j] == s[i+j]:
j += 1
Z_alg[i] = j
if j == 0:
... | 47 | 35 | 1,144 | 796 | def divisors(M): # Mの約数列 O(n^(0.5+e))
import math
d = []
i = 1
while math.sqrt(M) >= i:
if M % i == 0:
d.append(i)
if i**2 != M:
d.append(M // i)
i = i + 1
d.sort()
return d
N = int(eval(input()))
a = list(map(int, input().split()))
b =... | # Z[i]:length of the longest list starting from S[i] which is also a prefix of S
# O(|S|)
def Z_algorithm(s):
N = len(s)
Z_alg = [0] * N
Z_alg[0] = N
i = 1
j = 0
while i < N:
while i + j < N and s[j] == s[i + j]:
j += 1
Z_alg[i] = j
if j == 0:
i +=... | false | 25.531915 | [
"-def divisors(M): # Mの約数列 O(n^(0.5+e))",
"- import math",
"-",
"- d = []",
"+# Z[i]:length of the longest list starting from S[i] which is also a prefix of S",
"+# O(|S|)",
"+def Z_algorithm(s):",
"+ N = len(s)",
"+ Z_alg = [0] * N",
"+ Z_alg[0] = N",
"- while math.sqrt(M) >=... | false | 0.037518 | 0.059776 | 0.627648 | [
"s581442773",
"s330998755"
] |
u366959492 | p03835 | python | s773347265 | s908563231 | 1,794 | 271 | 2,940 | 41,948 | Accepted | Accepted | 84.89 | k,s=list(map(int,input().split()))
m=0
for x in range(k+1):
for y in range(k+1):
z=s-x-y
if z>=0 and z<=k:
m+=1
print(m)
| k,s=list(map(int,input().split()))
ans=0
for x in range(k+1):
for y in range(k+1):
z=s-x-y
if z<0:
break
if 0<=z<=k:
ans+=1
print(ans)
| 9 | 10 | 156 | 190 | k, s = list(map(int, input().split()))
m = 0
for x in range(k + 1):
for y in range(k + 1):
z = s - x - y
if z >= 0 and z <= k:
m += 1
print(m)
| k, s = list(map(int, input().split()))
ans = 0
for x in range(k + 1):
for y in range(k + 1):
z = s - x - y
if z < 0:
break
if 0 <= z <= k:
ans += 1
print(ans)
| false | 10 | [
"-m = 0",
"+ans = 0",
"- if z >= 0 and z <= k:",
"- m += 1",
"-print(m)",
"+ if z < 0:",
"+ break",
"+ if 0 <= z <= k:",
"+ ans += 1",
"+print(ans)"
] | false | 0.041678 | 0.041296 | 1.009261 | [
"s773347265",
"s908563231"
] |
u753589982 | p02994 | python | s058088627 | s895658581 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | N, L = [int(i) for i in input().split(' ')]
min_ = L
max_ = L + N -1
def eat_apple(N, L):
if L < 0:
if max_<0:
return max_
return 0
return L
print((int((min_+max_)*(max_-min_+1)/2 - eat_apple(N, L)))) | N, L = [int(i) for i in input().split()]
min_ = L
max_ = L + N -1
def eat_apple(N, L):
if max_<0:
return max_
if L < 0:
return 0
return L
print(((min_+max_)*(max_-min_+1)//2 - eat_apple(N, L))) | 13 | 13 | 250 | 235 | N, L = [int(i) for i in input().split(" ")]
min_ = L
max_ = L + N - 1
def eat_apple(N, L):
if L < 0:
if max_ < 0:
return max_
return 0
return L
print((int((min_ + max_) * (max_ - min_ + 1) / 2 - eat_apple(N, L))))
| N, L = [int(i) for i in input().split()]
min_ = L
max_ = L + N - 1
def eat_apple(N, L):
if max_ < 0:
return max_
if L < 0:
return 0
return L
print(((min_ + max_) * (max_ - min_ + 1) // 2 - eat_apple(N, L)))
| false | 0 | [
"-N, L = [int(i) for i in input().split(\" \")]",
"+N, L = [int(i) for i in input().split()]",
"+ if max_ < 0:",
"+ return max_",
"- if max_ < 0:",
"- return max_",
"-print((int((min_ + max_) * (max_ - min_ + 1) / 2 - eat_apple(N, L))))",
"+print(((min_ + max_) * (max_ - mi... | false | 0.041875 | 0.04098 | 1.021841 | [
"s058088627",
"s895658581"
] |
u815763296 | p02603 | python | s530243329 | s999817085 | 93 | 30 | 9,232 | 9,196 | Accepted | Accepted | 67.74 | N = int(eval(input()))
money = 1000
M = N//2
prices = list(map(int, input().split()))
prices.append(0)
dp = [[0 for j in range(M+1)]for i in range(N+1)]
dp[0][0] = money
max_p = money
for i in range(1, N+1):
for j in range(M+1):
dp[i][j] = dp[i-1][j]
if j > 0:
for l in rang... | N = int(eval(input()))
money = 1000
A = list(map(int, input().split()))
A.append(0)
kabu = 0
for i in range(N):
if A[i] <= A[i+1]:
buy = money//A[i]
money -= buy*A[i]
kabu += buy
if A[i] >= A[i+1]:
money += kabu*A[i]
kabu = 0
print(money) | 20 | 14 | 548 | 293 | N = int(eval(input()))
money = 1000
M = N // 2
prices = list(map(int, input().split()))
prices.append(0)
dp = [[0 for j in range(M + 1)] for i in range(N + 1)]
dp[0][0] = money
max_p = money
for i in range(1, N + 1):
for j in range(M + 1):
dp[i][j] = dp[i - 1][j]
if j > 0:
for l in range... | N = int(eval(input()))
money = 1000
A = list(map(int, input().split()))
A.append(0)
kabu = 0
for i in range(N):
if A[i] <= A[i + 1]:
buy = money // A[i]
money -= buy * A[i]
kabu += buy
if A[i] >= A[i + 1]:
money += kabu * A[i]
kabu = 0
print(money)
| false | 30 | [
"-M = N // 2",
"-prices = list(map(int, input().split()))",
"-prices.append(0)",
"-dp = [[0 for j in range(M + 1)] for i in range(N + 1)]",
"-dp[0][0] = money",
"-max_p = money",
"-for i in range(1, N + 1):",
"- for j in range(M + 1):",
"- dp[i][j] = dp[i - 1][j]",
"- if j > 0:",
... | false | 0.037071 | 0.046029 | 0.805389 | [
"s530243329",
"s999817085"
] |
u440566786 | p02913 | python | s349674305 | s648540674 | 1,038 | 955 | 51,164 | 53,636 | Accepted | Accepted | 8 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
class SuffixArray:
"""
construct:
suffix array: O(N(logN)^2)
lcp array: O(N)
sparse table: O(NlogN)
query:
get_lcp: O(1)
"""
def __init_... | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
class SuffixArray(object):
"""
construct:
suffix array: O(N(logN)^2)
lcp array: O(N)
sparse table: O(NlogN)
query:
lcp: O(1)
"""
def __i... | 99 | 93 | 2,835 | 2,510 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
class SuffixArray:
"""
construct:
suffix array: O(N(logN)^2)
lcp array: O(N)
sparse table: O(NlogN)
query:
get_lcp: O(1)
"""
def __init__(... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
class SuffixArray(object):
"""
construct:
suffix array: O(N(logN)^2)
lcp array: O(N)
sparse table: O(NlogN)
query:
lcp: O(1)
"""
def __ini... | false | 6.060606 | [
"-class SuffixArray:",
"+class SuffixArray(object):",
"- get_lcp: O(1)",
"+ lcp: O(1)",
"+ s = self.__s",
"- s = self.__s",
"- # sparse table (LCPのminをとるindexを持つ)",
"+ # sparse table",
"- table[0] = list(range(n))",
"+ table[0] = self.__lcp[:]",
"-... | false | 0.049884 | 0.047361 | 1.053258 | [
"s349674305",
"s648540674"
] |
u459215900 | p03723 | python | s104188706 | s700830100 | 1,440 | 713 | 3,188 | 2,940 | Accepted | Accepted | 50.49 | a, b, c = list(map(int, input().split()))
ans = 0
while True:
if ans > 999999:
print((-1))
break
elif a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
print(ans)
break
n_a = b/2 + c/2
n_b = a/2 + c/2
n_c = a/2 + b/2
a = n_a
b = n_b
c = n_c
... | a, b, c = list(map(int, input().split()))
ans = 0
while True:
if ans > 999999:
print((-1))
break
elif a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
print(ans)
break
a, b, c = (b+c) // 2, (a+c) // 2, (a+b) // 2
ans += 1
| 18 | 13 | 323 | 268 | a, b, c = list(map(int, input().split()))
ans = 0
while True:
if ans > 999999:
print((-1))
break
elif a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
print(ans)
break
n_a = b / 2 + c / 2
n_b = a / 2 + c / 2
n_c = a / 2 + b / 2
a = n_a
b = n_b
c = n_c
ans += 1
| a, b, c = list(map(int, input().split()))
ans = 0
while True:
if ans > 999999:
print((-1))
break
elif a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
print(ans)
break
a, b, c = (b + c) // 2, (a + c) // 2, (a + b) // 2
ans += 1
| false | 27.777778 | [
"- n_a = b / 2 + c / 2",
"- n_b = a / 2 + c / 2",
"- n_c = a / 2 + b / 2",
"- a = n_a",
"- b = n_b",
"- c = n_c",
"+ a, b, c = (b + c) // 2, (a + c) // 2, (a + b) // 2"
] | false | 0.245058 | 0.161578 | 1.516658 | [
"s104188706",
"s700830100"
] |
u762955009 | p03013 | python | s986471018 | s868459397 | 495 | 201 | 56,664 | 11,884 | Accepted | Accepted | 59.39 | MOD = 10**9 + 7
N, M = [int(x) for x in input().split()]
a = set([int(eval(input())) for i in range(M)])
dp = [0]*(N + 1)
dp[0] = 1
for step in range(N):
if step in a:
continue
for width in [1, 2]:
to = step + width
if to <= N and not to in a:
dp[to] = (dp[to] + ... | MOD = 10**9 + 7
N, M = [int(x) for x in input().split()]
a = set()
for i in range(M):
a.add(int(eval(input())))
dp = [0]*(N + 1)
dp[0] = 1
for step in range(N):
if not step in a:
for width in [1, 2]:
to = step + width
if to <= N and not to in a:
dp[t... | 15 | 16 | 345 | 360 | MOD = 10**9 + 7
N, M = [int(x) for x in input().split()]
a = set([int(eval(input())) for i in range(M)])
dp = [0] * (N + 1)
dp[0] = 1
for step in range(N):
if step in a:
continue
for width in [1, 2]:
to = step + width
if to <= N and not to in a:
dp[to] = (dp[to] + dp[step]) %... | MOD = 10**9 + 7
N, M = [int(x) for x in input().split()]
a = set()
for i in range(M):
a.add(int(eval(input())))
dp = [0] * (N + 1)
dp[0] = 1
for step in range(N):
if not step in a:
for width in [1, 2]:
to = step + width
if to <= N and not to in a:
dp[to] = (dp[to]... | false | 6.25 | [
"-a = set([int(eval(input())) for i in range(M)])",
"+a = set()",
"+for i in range(M):",
"+ a.add(int(eval(input())))",
"- if step in a:",
"- continue",
"- for width in [1, 2]:",
"- to = step + width",
"- if to <= N and not to in a:",
"- dp[to] = (dp[to] + ... | false | 0.04355 | 0.04792 | 0.908817 | [
"s986471018",
"s868459397"
] |
u345966487 | p03165 | python | s820229362 | s079357821 | 1,693 | 336 | 120,540 | 153,604 | Accepted | Accepted | 80.15 | import bisect
import collections
import sys
sys.setrecursionlimit(10 ** 8)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
S = readline().rstrip()
T = readline().rstrip()
if len(S) < len(T):
S, T = T, S
def pretty(ss):
buf = []
wh... | import numpy as np
S = np.array([ord(i) for i in eval(input())], dtype=int)
T = np.array([ord(i) for i in eval(input())], dtype=int)
NS = len(S)
NT = len(T)
equal = np.equal.outer(S, T).astype(int)
dp = [np.zeros(NT + 1, dtype=int)]
for i in range(NS):
x = dp[-1].copy()
ndp = x.copy()
ndp[1:] ... | 51 | 31 | 1,267 | 691 | import bisect
import collections
import sys
sys.setrecursionlimit(10**8)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
S = readline().rstrip()
T = readline().rstrip()
if len(S) < len(T):
S, T = T, S
def pretty(ss):
buf = []
while ss is not None:
... | import numpy as np
S = np.array([ord(i) for i in eval(input())], dtype=int)
T = np.array([ord(i) for i in eval(input())], dtype=int)
NS = len(S)
NT = len(T)
equal = np.equal.outer(S, T).astype(int)
dp = [np.zeros(NT + 1, dtype=int)]
for i in range(NS):
x = dp[-1].copy()
ndp = x.copy()
ndp[1:] = np.maximum(... | false | 39.215686 | [
"-import bisect",
"-import collections",
"-import sys",
"+import numpy as np",
"-sys.setrecursionlimit(10**8)",
"-read = sys.stdin.buffer.read",
"-readline = sys.stdin.buffer.readline",
"-readlines = sys.stdin.buffer.readlines",
"-S = readline().rstrip()",
"-T = readline().rstrip()",
"-if len(S)... | false | 0.037353 | 0.219284 | 0.170341 | [
"s820229362",
"s079357821"
] |
u263830634 | p03310 | python | s222956637 | s935787493 | 867 | 257 | 27,468 | 41,416 | Accepted | Accepted | 70.36 | N = int(eval(input()))
#累積和で受け取る
A = [0] * N
S = 0
for i, a in enumerate(input().split()):
S += int(a)
A[i] = S
answer = S
#indexは最後に回収する番号
B = 0
D = 0
for C in range(1, N - 2):
D = max(D, C + 1)
SB = A[B]
SC = A[C] - A[B]
SD = A[D] - A[C]
SE = S - A[D]
left_scor... | import numpy as np
N = int(eval(input()))
A = np.zeros(N + 2, dtype = np.int64)
A[1:-1] = input().split()
np.cumsum(A, out = A)
total = A[-1]
A[-1] = 10 ** 18
left = np.searchsorted(A, A/2)
P1 = A[left - 1]
P2 = A[left]
Q1, Q2 = A - P1, A - P2
np.maximum(P1, Q2, out = P1)
np.minimum(P2, Q1, out = P2... | 47 | 31 | 955 | 670 | N = int(eval(input()))
# 累積和で受け取る
A = [0] * N
S = 0
for i, a in enumerate(input().split()):
S += int(a)
A[i] = S
answer = S
# indexは最後に回収する番号
B = 0
D = 0
for C in range(1, N - 2):
D = max(D, C + 1)
SB = A[B]
SC = A[C] - A[B]
SD = A[D] - A[C]
SE = S - A[D]
left_score = abs(SB - SC)
# ... | import numpy as np
N = int(eval(input()))
A = np.zeros(N + 2, dtype=np.int64)
A[1:-1] = input().split()
np.cumsum(A, out=A)
total = A[-1]
A[-1] = 10**18
left = np.searchsorted(A, A / 2)
P1 = A[left - 1]
P2 = A[left]
Q1, Q2 = A - P1, A - P2
np.maximum(P1, Q2, out=P1)
np.minimum(P2, Q1, out=P2)
P, Q = P1, P2
right = np.... | false | 34.042553 | [
"+import numpy as np",
"+",
"-# 累積和で受け取る",
"-A = [0] * N",
"-S = 0",
"-for i, a in enumerate(input().split()):",
"- S += int(a)",
"- A[i] = S",
"-answer = S",
"-# indexは最後に回収する番号",
"-B = 0",
"-D = 0",
"-for C in range(1, N - 2):",
"- D = max(D, C + 1)",
"- SB = A[B]",
"- ... | false | 0.041562 | 0.201595 | 0.206164 | [
"s222956637",
"s935787493"
] |
u537782349 | p04001 | python | s326406544 | s947995854 | 21 | 18 | 3,316 | 3,064 | Accepted | Accepted | 14.29 | def f(a, b, le, tf):
b[le] = tf
if le == len(b)-1:
t = ""
s1 = 0
for i in range(len(b)):
t += a[i]
if b[i] == 1:
s1 += int(t)
t = ""
t += a[len(b)]
s1 += int(t)
return s1
else:
retur... | def clc(a, b, c, p, t):
if c == 0:
b = a[0]
return clc(a, b, c + 1, True, t) + clc(a, b, c + 1, False, t)
elif c == len(a)-1:
if p:
return t + int(b) + int(a[c])
else:
return t + int(b + a[c])
else:
if p:
t += int(b)
... | 23 | 20 | 485 | 517 | def f(a, b, le, tf):
b[le] = tf
if le == len(b) - 1:
t = ""
s1 = 0
for i in range(len(b)):
t += a[i]
if b[i] == 1:
s1 += int(t)
t = ""
t += a[len(b)]
s1 += int(t)
return s1
else:
return f(a, b, le... | def clc(a, b, c, p, t):
if c == 0:
b = a[0]
return clc(a, b, c + 1, True, t) + clc(a, b, c + 1, False, t)
elif c == len(a) - 1:
if p:
return t + int(b) + int(a[c])
else:
return t + int(b + a[c])
else:
if p:
t += int(b)
b... | false | 13.043478 | [
"-def f(a, b, le, tf):",
"- b[le] = tf",
"- if le == len(b) - 1:",
"- t = \"\"",
"- s1 = 0",
"- for i in range(len(b)):",
"- t += a[i]",
"- if b[i] == 1:",
"- s1 += int(t)",
"- t = \"\"",
"- t += a[len(b)]",
... | false | 0.048221 | 0.039616 | 1.217232 | [
"s326406544",
"s947995854"
] |
u310678820 | p02692 | python | s167346733 | s629009011 | 293 | 206 | 92,664 | 95,984 | Accepted | Accepted | 29.69 | def solve():
ans = []
for i, (x, y) in enumerate(s):
if num[x]>num[y]: x, y = y, x
if num[x]==num[y] and i < n-1:
if y == s[i+1][0] or y == s[i+1][1]:
x, y = y, x
num[x]+=1
num[y]-=1
ans.append(x)
if num[y]<0: return False
... | def solve():
ans = []
for i, (x, y) in enumerate(s):
if num[x]>num[y]: x, y = y, x
if num[x]==num[y] and i < n-1:
if y == s[i+1][0] or y == s[i+1][1]:
x, y = y, x
num[x]+=1
num[y]-=1
ans.append(x)
if num[y]<0: return False
... | 27 | 25 | 637 | 603 | def solve():
ans = []
for i, (x, y) in enumerate(s):
if num[x] > num[y]:
x, y = y, x
if num[x] == num[y] and i < n - 1:
if y == s[i + 1][0] or y == s[i + 1][1]:
x, y = y, x
num[x] += 1
num[y] -= 1
ans.append(x)
if num[y] < 0... | def solve():
ans = []
for i, (x, y) in enumerate(s):
if num[x] > num[y]:
x, y = y, x
if num[x] == num[y] and i < n - 1:
if y == s[i + 1][0] or y == s[i + 1][1]:
x, y = y, x
num[x] += 1
num[y] -= 1
ans.append(x)
if num[y] < 0... | false | 7.407407 | [
"-import sys",
"+s = [input() for _ in range(n)]",
"-s = [input() for _ in range(n)]",
"-id = [\"A\", \"B\", \"C\"]"
] | false | 0.046638 | 0.007665 | 6.084299 | [
"s167346733",
"s629009011"
] |
u667458133 | p03625 | python | s583404371 | s694725878 | 1,536 | 96 | 14,252 | 18,600 | Accepted | Accepted | 93.75 | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
A.reverse()
flag = 0
result = [0, 0]
while len(A) >= 2 and flag < 2:
N = A.pop(0)
if N == A[0]:
result[flag] = N
del A[0]
flag += 1
print((result[0]*result[1]))
| import collections
N = int(eval(input()))
A = list(map(int, input().split()))
a = collections.Counter(A)
array = [0, 0]
for i in a:
if a[i] >= 4:
array += [i, i]
elif a[i] >= 2:
array.append(i)
array.sort()
array.reverse()
print((array[0]*array[1]))
| 15 | 16 | 269 | 284 | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
A.reverse()
flag = 0
result = [0, 0]
while len(A) >= 2 and flag < 2:
N = A.pop(0)
if N == A[0]:
result[flag] = N
del A[0]
flag += 1
print((result[0] * result[1]))
| import collections
N = int(eval(input()))
A = list(map(int, input().split()))
a = collections.Counter(A)
array = [0, 0]
for i in a:
if a[i] >= 4:
array += [i, i]
elif a[i] >= 2:
array.append(i)
array.sort()
array.reverse()
print((array[0] * array[1]))
| false | 6.25 | [
"+import collections",
"+",
"-A.sort()",
"-A.reverse()",
"-flag = 0",
"-result = [0, 0]",
"-while len(A) >= 2 and flag < 2:",
"- N = A.pop(0)",
"- if N == A[0]:",
"- result[flag] = N",
"- del A[0]",
"- flag += 1",
"-print((result[0] * result[1]))",
"+a = collecti... | false | 0.082242 | 0.036828 | 2.233128 | [
"s583404371",
"s694725878"
] |
u879870653 | p03017 | python | s372267677 | s660764630 | 49 | 19 | 3,572 | 3,572 | Accepted | Accepted | 61.22 | N,a,b,c,d = list(map(int,input().split()))
S = eval(input())
a -= 1
b -= 1
c -= 1
d -= 1
if c < d :
if (S[b:d+1].count("##") == 0) and (S[a:c+1].count("##") == 0) :
ans = "Yes"
else :
ans = "No"
else :
if (S[b:d+1].count("##") == 0) and (S[a:c+1].count("##") == 0) :
fl... | N,a,b,c,d = list(map(int,input().split()))
S = eval(input())
a -= 1
b -= 1
c -= 1
d -= 1
flg1 = S[a:c+1].count("##")
flg2 = S[b:d+1].count("##")
flg3 = S[b-1:d+2].count("...")
if c < d :
if flg1 + flg2 == 0 :
ans = "Yes"
else :
ans = "No"
else :
if (flg1 + flg2 == 0) and... | 39 | 24 | 700 | 382 | N, a, b, c, d = list(map(int, input().split()))
S = eval(input())
a -= 1
b -= 1
c -= 1
d -= 1
if c < d:
if (S[b : d + 1].count("##") == 0) and (S[a : c + 1].count("##") == 0):
ans = "Yes"
else:
ans = "No"
else:
if (S[b : d + 1].count("##") == 0) and (S[a : c + 1].count("##") == 0):
f... | N, a, b, c, d = list(map(int, input().split()))
S = eval(input())
a -= 1
b -= 1
c -= 1
d -= 1
flg1 = S[a : c + 1].count("##")
flg2 = S[b : d + 1].count("##")
flg3 = S[b - 1 : d + 2].count("...")
if c < d:
if flg1 + flg2 == 0:
ans = "Yes"
else:
ans = "No"
else:
if (flg1 + flg2 == 0) and flg3:... | false | 38.461538 | [
"+flg1 = S[a : c + 1].count(\"##\")",
"+flg2 = S[b : d + 1].count(\"##\")",
"+flg3 = S[b - 1 : d + 2].count(\"...\")",
"- if (S[b : d + 1].count(\"##\") == 0) and (S[a : c + 1].count(\"##\") == 0):",
"+ if flg1 + flg2 == 0:",
"- if (S[b : d + 1].count(\"##\") == 0) and (S[a : c + 1].count(\"##\")... | false | 0.132956 | 0.040351 | 3.295036 | [
"s372267677",
"s660764630"
] |
u670180528 | p04000 | python | s987177343 | s135784553 | 1,077 | 821 | 131,432 | 111,136 | Accepted | Accepted | 23.77 | from collections import Counter as C;H,W,N,*L=list(map(int,open(0).read().split()));K=[];M=[(H-2)*(W-2)]+[0]*9
for a,b in zip(*[iter(L)]*2):
for c in range(9):
x=b-c//3;y=a-c%3
if H-1>y>0<x<W-1:K+=[y*W+x]
for k,v in list(C(list(C(K).values())).items()):M[0]-=v;M[k]+=v
print((*M)) | from collections import Counter as C;r=list(range(3))
def s():
H,W,N,*L=list(map(int,open(0).read().split()));D={};M=[(H-2)*(W-2)]+[0]*9
for a,b in zip(*[iter(L)]*2):
for x in r:
for y in r:
if H-1>a-y>0<b-x<W-1:
t=(a-y)*W+b-x
D[t]=D.get(t,0)+1
for k,v in list(C(list(D.values())).items())... | 7 | 12 | 271 | 353 | from collections import Counter as C
H, W, N, *L = list(map(int, open(0).read().split()))
K = []
M = [(H - 2) * (W - 2)] + [0] * 9
for a, b in zip(*[iter(L)] * 2):
for c in range(9):
x = b - c // 3
y = a - c % 3
if H - 1 > y > 0 < x < W - 1:
K += [y * W + x]
for k, v in list(C(l... | from collections import Counter as C
r = list(range(3))
def s():
H, W, N, *L = list(map(int, open(0).read().split()))
D = {}
M = [(H - 2) * (W - 2)] + [0] * 9
for a, b in zip(*[iter(L)] * 2):
for x in r:
for y in r:
if H - 1 > a - y > 0 < b - x < W - 1:
... | false | 41.666667 | [
"-H, W, N, *L = list(map(int, open(0).read().split()))",
"-K = []",
"-M = [(H - 2) * (W - 2)] + [0] * 9",
"-for a, b in zip(*[iter(L)] * 2):",
"- for c in range(9):",
"- x = b - c // 3",
"- y = a - c % 3",
"- if H - 1 > y > 0 < x < W - 1:",
"- K += [y * W + x]",
... | false | 0.036574 | 0.038406 | 0.952315 | [
"s987177343",
"s135784553"
] |
u782930273 | p02708 | python | s821876063 | s428102616 | 119 | 25 | 9,132 | 9,172 | Accepted | Accepted | 78.99 | N, K = list(map(int, input().split()))
ans = 0
for i in range(K, N + 2):
max_num = i * (N + N + 1 - i) // 2
min_num = i * (0 + i - 1) // 2
ans += max_num - min_num + 1
print((ans % (10**9 + 7))) | N, K = list(map(int, input().split()))
ans = (K - N - 2) * (2 * K * K - K * (N + 2) - N * N - N - 6) // 6
print((ans % (10**9 + 7))) | 9 | 3 | 208 | 126 | N, K = list(map(int, input().split()))
ans = 0
for i in range(K, N + 2):
max_num = i * (N + N + 1 - i) // 2
min_num = i * (0 + i - 1) // 2
ans += max_num - min_num + 1
print((ans % (10**9 + 7)))
| N, K = list(map(int, input().split()))
ans = (K - N - 2) * (2 * K * K - K * (N + 2) - N * N - N - 6) // 6
print((ans % (10**9 + 7)))
| false | 66.666667 | [
"-ans = 0",
"-for i in range(K, N + 2):",
"- max_num = i * (N + N + 1 - i) // 2",
"- min_num = i * (0 + i - 1) // 2",
"- ans += max_num - min_num + 1",
"+ans = (K - N - 2) * (2 * K * K - K * (N + 2) - N * N - N - 6) // 6"
] | false | 0.07397 | 0.052312 | 1.414033 | [
"s821876063",
"s428102616"
] |
u380524497 | p03045 | python | s824223498 | s990663776 | 344 | 247 | 5,936 | 32,428 | Accepted | Accepted | 28.2 | import sys
input = sys.stdin.readline
class UnionFind:
def __init__(self, size):
self.parent = [-1] * size
self.rank = [1] * size
self.groups = size
def get_root(self, node):
parent = self.parent[node]
if parent == -1:
root = node
else... | class UnionFind:
def __init__(self, size):
self.parent = [-1] * size
self.rank = [1] * size
self.groups = size
def get_root(self, node):
parent = self.parent[node]
if parent == -1:
root = node
else:
root = self.get_root(parent)
... | 42 | 36 | 1,092 | 949 | import sys
input = sys.stdin.readline
class UnionFind:
def __init__(self, size):
self.parent = [-1] * size
self.rank = [1] * size
self.groups = size
def get_root(self, node):
parent = self.parent[node]
if parent == -1:
root = node
else:
... | class UnionFind:
def __init__(self, size):
self.parent = [-1] * size
self.rank = [1] * size
self.groups = size
def get_root(self, node):
parent = self.parent[node]
if parent == -1:
root = node
else:
root = self.get_root(parent)
... | false | 14.285714 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-",
"-",
"- self.parent[node] = root # 同じnodeへの2回目以降のget_rootを高速にするために、直接rootに繋いでおく",
"+ self.parent[node] = root",
"- if self.rank[main_root] < self.rank[sub_root]: # rankの大きい方をmain_rootにする",
"+ if self.rank[m... | false | 0.047298 | 0.045661 | 1.035835 | [
"s824223498",
"s990663776"
] |
u094999522 | p03341 | python | s175020002 | s532345742 | 225 | 143 | 33,296 | 9,748 | Accepted | Accepted | 36.44 | #!/usr/bin/env python3
n = int(eval(input()))
s = eval(input())
e = [0]
w = [0]
for i in s:
e.append(e[-1] + (i == "E"))
w.append(w[-1] + (i == "W"))
ans = 10**6
for i in range(n):
ans = min(ans, w[i] + e[-1] - e[i + 1])
print(ans)
| #!/usr/bin/env python3
n = int(eval(input()))
s = eval(input())
w = 0
e = s.count("E")
ans = 10**6
for i in s:
e -= i == "E"
ans = min(ans, e + w)
w += i == "W"
print(ans)
| 12 | 11 | 243 | 182 | #!/usr/bin/env python3
n = int(eval(input()))
s = eval(input())
e = [0]
w = [0]
for i in s:
e.append(e[-1] + (i == "E"))
w.append(w[-1] + (i == "W"))
ans = 10**6
for i in range(n):
ans = min(ans, w[i] + e[-1] - e[i + 1])
print(ans)
| #!/usr/bin/env python3
n = int(eval(input()))
s = eval(input())
w = 0
e = s.count("E")
ans = 10**6
for i in s:
e -= i == "E"
ans = min(ans, e + w)
w += i == "W"
print(ans)
| false | 8.333333 | [
"-e = [0]",
"-w = [0]",
"+w = 0",
"+e = s.count(\"E\")",
"+ans = 10**6",
"- e.append(e[-1] + (i == \"E\"))",
"- w.append(w[-1] + (i == \"W\"))",
"-ans = 10**6",
"-for i in range(n):",
"- ans = min(ans, w[i] + e[-1] - e[i + 1])",
"+ e -= i == \"E\"",
"+ ans = min(ans, e + w)",
... | false | 0.06968 | 0.062563 | 1.113754 | [
"s175020002",
"s532345742"
] |
u489959379 | p03266 | python | s820994727 | s751008007 | 104 | 55 | 4,632 | 2,940 | Accepted | Accepted | 47.12 | n, k = list(map(int, input().split()))
# num[x]:kで割ってxあまる数が1以上N以下に何個あるか
num = [0 for _ in range(k)]
for i in range(1, n + 1):
num[i % k] += 1
res = 0
for a in range(k):
b = (k - a) % k
c = (k - a) % k
if (b + c) % k != 0:
continue
res += num[a] * num[b] * num[c]
print(res)
| n, k = list(map(int, input().split()))
if k % 2 != 0:
x = n // k
print((x ** 3))
else:
x = n // k
y = 0
for i in range(1, n + 1):
if i % k == k // 2:
y += 1
print((x ** 3 + y ** 3))
| 16 | 12 | 314 | 228 | n, k = list(map(int, input().split()))
# num[x]:kで割ってxあまる数が1以上N以下に何個あるか
num = [0 for _ in range(k)]
for i in range(1, n + 1):
num[i % k] += 1
res = 0
for a in range(k):
b = (k - a) % k
c = (k - a) % k
if (b + c) % k != 0:
continue
res += num[a] * num[b] * num[c]
print(res)
| n, k = list(map(int, input().split()))
if k % 2 != 0:
x = n // k
print((x**3))
else:
x = n // k
y = 0
for i in range(1, n + 1):
if i % k == k // 2:
y += 1
print((x**3 + y**3))
| false | 25 | [
"-# num[x]:kで割ってxあまる数が1以上N以下に何個あるか",
"-num = [0 for _ in range(k)]",
"-for i in range(1, n + 1):",
"- num[i % k] += 1",
"-res = 0",
"-for a in range(k):",
"- b = (k - a) % k",
"- c = (k - a) % k",
"- if (b + c) % k != 0:",
"- continue",
"- res += num[a] * num[b] * num[c]",
... | false | 0.042326 | 0.03998 | 1.058685 | [
"s820994727",
"s751008007"
] |
u677267454 | p03074 | python | s860747815 | s369728041 | 202 | 158 | 4,092 | 7,932 | Accepted | Accepted | 21.78 | # -*- coding: utf-8 -*-
n, k = list(map(int, input().split()))
s = eval(input())
nums = []
now = 1
cnt = 0
for i in range(n):
if s[i] == str(int('0') + now):
cnt += 1
else:
nums.append(cnt)
now = 1 - now
cnt = 1
if cnt != 0:
nums.append(cnt)
ans = 0
left... | # -*- coding: utf-8 -*-
n, k = list(map(int, input().split()))
s = eval(input())
nums = []
now = 1
cnt = 0
for i in range(n):
if s[i] == str(int('0') + now):
cnt += 1
else:
nums.append(cnt)
now = 1 - now
cnt = 1
if cnt != 0:
nums.append(cnt)
t = [0]
for ... | 38 | 30 | 639 | 519 | # -*- coding: utf-8 -*-
n, k = list(map(int, input().split()))
s = eval(input())
nums = []
now = 1
cnt = 0
for i in range(n):
if s[i] == str(int("0") + now):
cnt += 1
else:
nums.append(cnt)
now = 1 - now
cnt = 1
if cnt != 0:
nums.append(cnt)
ans = 0
left = 0
right = 0
tmp = 0... | # -*- coding: utf-8 -*-
n, k = list(map(int, input().split()))
s = eval(input())
nums = []
now = 1
cnt = 0
for i in range(n):
if s[i] == str(int("0") + now):
cnt += 1
else:
nums.append(cnt)
now = 1 - now
cnt = 1
if cnt != 0:
nums.append(cnt)
t = [0]
for i in range(len(nums)):... | false | 21.052632 | [
"+t = [0]",
"+for i in range(len(nums)):",
"+ t.append(t[i] + nums[i])",
"-left = 0",
"-right = 0",
"-tmp = 0",
"- next_left = i",
"- next_right = min(i + 2 * k + 1, len(nums))",
"- while left < next_left:",
"- tmp -= nums[left]",
"- left += 1",
"- while right < ne... | false | 0.048228 | 0.086807 | 0.555575 | [
"s860747815",
"s369728041"
] |
u281610856 | p03575 | python | s793347029 | s384280326 | 156 | 20 | 12,360 | 3,064 | Accepted | Accepted | 87.18 | from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations
import math
import bisect
import numpy as np
from collections import defaultdict, deque
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
# MOD = 10 ** 9 + 7
INF = float("inf")
class Unio... | import sys
sys.setrecursionlimit(10**6)
N, M = list(map(int, input().split()))
G = [[] for _ in range(N)]
edge = []
for _ in range(M):
u, v = list(map(int, input().split()))
G[u-1].append(v-1)
G[v-1].append(u-1)
edge.append((u-1, v-1))
# 連結かどうかの判定->DFS, BFS, Dijkstra, UnionFindなどで解ける
de... | 84 | 32 | 2,260 | 690 | from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations
import math
import bisect
import numpy as np
from collections import defaultdict, deque
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
# MOD = 10 ** 9 + 7
INF = float("inf")
class UnionFind:
def _... | import sys
sys.setrecursionlimit(10**6)
N, M = list(map(int, input().split()))
G = [[] for _ in range(N)]
edge = []
for _ in range(M):
u, v = list(map(int, input().split()))
G[u - 1].append(v - 1)
G[v - 1].append(u - 1)
edge.append((u - 1, v - 1))
# 連結かどうかの判定->DFS, BFS, Dijkstra, UnionFindなどで解ける
def df... | false | 61.904762 | [
"-from heapq import heappush, heappop",
"-from itertools import permutations, accumulate, combinations",
"-import math",
"-import bisect",
"-import numpy as np",
"-from collections import defaultdict, deque",
"-input = sys.stdin.readline",
"-# MOD = 10 ** 9 + 7",
"-INF = float(\"inf\")",
"+N, M = ... | false | 0.036603 | 0.037399 | 0.978709 | [
"s793347029",
"s384280326"
] |
u371132735 | p02748 | python | s526572328 | s811654175 | 731 | 473 | 70,124 | 24,804 | Accepted | Accepted | 35.29 | A,B,M = list(map(int,input().split()))
Ai = list(map(int,input().split()))
Bi = list(map(int,input().split()))
amin = min(Ai)
bmin= min(Bi)
min = amin+bmin
for i in range(M):
xi,yi,ci = list(map(int,input().split()))
if Ai[xi-1] + Bi[yi-1] - ci < min:
min = Ai[xi-1] + Bi[yi-1] - ci
print(min)
| # hitachi2020_b.py
_, _, M = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
X = []
Y = []
C = []
amin = min(A)
bmin = min(B)
for i in range(M):
x, y, c = list(map(int, input().split()))
X.append(x)
Y.append(y)
C.append(c)
ans = ami... | 11 | 20 | 296 | 428 | A, B, M = list(map(int, input().split()))
Ai = list(map(int, input().split()))
Bi = list(map(int, input().split()))
amin = min(Ai)
bmin = min(Bi)
min = amin + bmin
for i in range(M):
xi, yi, ci = list(map(int, input().split()))
if Ai[xi - 1] + Bi[yi - 1] - ci < min:
min = Ai[xi - 1] + Bi[yi - 1] - ci
pr... | # hitachi2020_b.py
_, _, M = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
X = []
Y = []
C = []
amin = min(A)
bmin = min(B)
for i in range(M):
x, y, c = list(map(int, input().split()))
X.append(x)
Y.append(y)
C.append(c)
ans = amin + bmin
for i i... | false | 45 | [
"-A, B, M = list(map(int, input().split()))",
"-Ai = list(map(int, input().split()))",
"-Bi = list(map(int, input().split()))",
"-amin = min(Ai)",
"-bmin = min(Bi)",
"-min = amin + bmin",
"+# hitachi2020_b.py",
"+_, _, M = list(map(int, input().split()))",
"+A = list(map(int, input().split()))",
"... | false | 0.042069 | 0.040657 | 1.034737 | [
"s526572328",
"s811654175"
] |
u225388820 | p02719 | python | s828765823 | s015450863 | 22 | 17 | 2,940 | 2,940 | Accepted | Accepted | 22.73 | n,k=list(map(int,input().split()))
if n>k:
n=n-n//k*k
ans=10**18+10
for i in range(10000):
ans=min(ans,n)
n=abs(n-k)
print(ans) | n,k=list(map(int,input().split()))
print((min(n%k,k-n%k))) | 8 | 2 | 140 | 51 | n, k = list(map(int, input().split()))
if n > k:
n = n - n // k * k
ans = 10**18 + 10
for i in range(10000):
ans = min(ans, n)
n = abs(n - k)
print(ans)
| n, k = list(map(int, input().split()))
print((min(n % k, k - n % k)))
| false | 75 | [
"-if n > k:",
"- n = n - n // k * k",
"-ans = 10**18 + 10",
"-for i in range(10000):",
"- ans = min(ans, n)",
"- n = abs(n - k)",
"-print(ans)",
"+print((min(n % k, k - n % k)))"
] | false | 0.039162 | 0.036047 | 1.08639 | [
"s828765823",
"s015450863"
] |
u780962115 | p02632 | python | s611681132 | s811057398 | 1,241 | 809 | 313,532 | 187,260 | Accepted | Accepted | 34.81 | #標準入力 テスト
import sys
input = lambda: sys.stdin.readline().rstrip()
K=int(eval(input()))
S=eval(input())
M=len(S)
N=K+M
mod=10**9+7
ans=pow(26,N,mod)
class Data():
def __init__(self):
self.power=1
self.rev=1
class Combi():
def __init__(self,N,mod):
self.lists=[Data() f... | # ライブラリ高速化実験テスト
import sys
class Combi():
def __init__(self, N, mod):
self.power = [1 for _ in range(N+1)]
self.rev = [1 for _ in range(N+1)]
self.mod = mod
for i in range(2, N+1):
self.power[i] = (self.power[i-1]*i) % self.mod
self.rev[N] = pow(self.... | 34 | 44 | 919 | 1,020 | # 標準入力 テスト
import sys
input = lambda: sys.stdin.readline().rstrip()
K = int(eval(input()))
S = eval(input())
M = len(S)
N = K + M
mod = 10**9 + 7
ans = pow(26, N, mod)
class Data:
def __init__(self):
self.power = 1
self.rev = 1
class Combi:
def __init__(self, N, mod):
self.lists = [... | # ライブラリ高速化実験テスト
import sys
class Combi:
def __init__(self, N, mod):
self.power = [1 for _ in range(N + 1)]
self.rev = [1 for _ in range(N + 1)]
self.mod = mod
for i in range(2, N + 1):
self.power[i] = (self.power[i - 1] * i) % self.mod
self.rev[N] = pow(self.pow... | false | 22.727273 | [
"-# 標準入力 テスト",
"+# ライブラリ高速化実験テスト",
"-input = lambda: sys.stdin.readline().rstrip()",
"+",
"+class Combi:",
"+ def __init__(self, N, mod):",
"+ self.power = [1 for _ in range(N + 1)]",
"+ self.rev = [1 for _ in range(N + 1)]",
"+ self.mod = mod",
"+ for i in range(2, ... | false | 0.041522 | 0.059046 | 0.70322 | [
"s611681132",
"s811057398"
] |
u279493135 | p03305 | python | s857767413 | s603205587 | 1,614 | 1,382 | 115,544 | 115,328 | Accepted | Accepted | 14.37 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digi... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digi... | 60 | 63 | 1,622 | 1,679 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
fro... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
fro... | false | 4.761905 | [
"-def dijkstra(E, start):",
"- N_d = len(E)",
"- dist = [INF] * N_d",
"- dist[start] = 0",
"- q = [(0, start)]",
"- while q:",
"- dist_v, v = heappop(q)",
"- if dist[v] != dist_v:",
"- continue",
"- for u, dist_vu in E[v]:",
"- dist_u = d... | false | 0.491396 | 0.04549 | 10.802317 | [
"s857767413",
"s603205587"
] |
u822353071 | p03943 | python | s151956699 | s487474373 | 24 | 21 | 3,316 | 3,064 | Accepted | Accepted | 12.5 | # import time
# starttime=time.clock()
A,B,C =input().split()
a=int(A)
b=int(B)
c=int(C)
# print(a+c)
if a>b:
temp = a
a = b
b = temp
if b>c:
temp = b
b = c
c = temp
if (a+b)==c:
print("Yes")
# endtime = time.clock()
# print(endtime-starttime)
else:
pri... | a,b,c = list(map(int,input().split()))
if a>b:
temp = a
a = b
b = temp
if b>c:
temp = b
b = c
c = temp
if (a+b)==c:
print("Yes")
else:
print("No")
| 27 | 15 | 400 | 190 | # import time
# starttime=time.clock()
A, B, C = input().split()
a = int(A)
b = int(B)
c = int(C)
# print(a+c)
if a > b:
temp = a
a = b
b = temp
if b > c:
temp = b
b = c
c = temp
if (a + b) == c:
print("Yes")
# endtime = time.clock()
# print(endtime-starttime)
else:
print("No")
#... | a, b, c = list(map(int, input().split()))
if a > b:
temp = a
a = b
b = temp
if b > c:
temp = b
b = c
c = temp
if (a + b) == c:
print("Yes")
else:
print("No")
| false | 44.444444 | [
"-# import time",
"-# starttime=time.clock()",
"-A, B, C = input().split()",
"-a = int(A)",
"-b = int(B)",
"-c = int(C)",
"-# print(a+c)",
"+a, b, c = list(map(int, input().split()))",
"-# endtime = time.clock()",
"-# print(endtime-starttime)",
"-# endtime = time.clock()",
"-# ... | false | 0.038401 | 0.042428 | 0.905103 | [
"s151956699",
"s487474373"
] |
u761320129 | p03799 | python | s629889729 | s652249328 | 29 | 26 | 8,912 | 8,952 | Accepted | Accepted | 10.34 | s,c = list(map(int,input().split()))
ans = min(s,c//2)
c -= ans*2
ans += c//4
print(ans) | S,C = list(map(int,input().split()))
p = min(S,C//2)
C -= p*2
ans = p + C//4
print(ans) | 5 | 6 | 86 | 87 | s, c = list(map(int, input().split()))
ans = min(s, c // 2)
c -= ans * 2
ans += c // 4
print(ans)
| S, C = list(map(int, input().split()))
p = min(S, C // 2)
C -= p * 2
ans = p + C // 4
print(ans)
| false | 16.666667 | [
"-s, c = list(map(int, input().split()))",
"-ans = min(s, c // 2)",
"-c -= ans * 2",
"-ans += c // 4",
"+S, C = list(map(int, input().split()))",
"+p = min(S, C // 2)",
"+C -= p * 2",
"+ans = p + C // 4"
] | false | 0.04829 | 0.057176 | 0.844573 | [
"s629889729",
"s652249328"
] |
u896588506 | p02713 | python | s623035891 | s506843779 | 1,817 | 989 | 9,116 | 9,124 | Accepted | Accepted | 45.57 | from math import gcd
k = int(eval(input()))
ans = 0
for l in range(1,k+1):
for m in range(1,k+1):
for n in range(1,k+1):
ans += gcd(gcd(l,m),n)
print(ans) | import math
import itertools
k = int(eval(input()))
lst = [i for i in range(1,k+1)]
itr = itertools.combinations_with_replacement(lst, 3)
ans = 0
for i in itr:
st = set(i)
num = len(st)
if num == 1:
ans += i[0]
elif num == 2:
a,b = st
ans += math.gcd(a,b) * 3
else:
ans += ma... | 10 | 20 | 171 | 365 | from math import gcd
k = int(eval(input()))
ans = 0
for l in range(1, k + 1):
for m in range(1, k + 1):
for n in range(1, k + 1):
ans += gcd(gcd(l, m), n)
print(ans)
| import math
import itertools
k = int(eval(input()))
lst = [i for i in range(1, k + 1)]
itr = itertools.combinations_with_replacement(lst, 3)
ans = 0
for i in itr:
st = set(i)
num = len(st)
if num == 1:
ans += i[0]
elif num == 2:
a, b = st
ans += math.gcd(a, b) * 3
else:
... | false | 50 | [
"-from math import gcd",
"+import math",
"+import itertools",
"+lst = [i for i in range(1, k + 1)]",
"+itr = itertools.combinations_with_replacement(lst, 3)",
"-for l in range(1, k + 1):",
"- for m in range(1, k + 1):",
"- for n in range(1, k + 1):",
"- ans += gcd(gcd(l, m), n)"... | false | 0.155354 | 0.082617 | 1.880409 | [
"s623035891",
"s506843779"
] |
u955251526 | p03714 | python | s402795869 | s044979062 | 776 | 470 | 68,700 | 37,212 | Accepted | Accepted | 39.43 | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(enumerate(a))
l = sorted(b[:2*n], key=lambda x: x[1], reverse=True)
r = sorted(b[n:], key=lambda x: x[1])
big = [0] * (3*n)
small = [0] * (3*n)
for i, (pos, z) in enumerate(l):
big[pos] = i
for i, (pos, z) in enumerate(r):
sma... | import heapq
n = int(eval(input()))
a = list(map(int, input().split()))
h = a[:n]
heapq.heapify(h)
first = [0] * (n+1)
s = sum(a[:n])
first[0] = s
for i in range(n):
s += a[n+i]
heapq.heappush(h, a[n+i])
s -= heapq.heappop(h)
first[i+1] = s
h = list([-x for x in a[2*n:]])
heapq.heapify... | 38 | 30 | 812 | 610 | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(enumerate(a))
l = sorted(b[: 2 * n], key=lambda x: x[1], reverse=True)
r = sorted(b[n:], key=lambda x: x[1])
big = [0] * (3 * n)
small = [0] * (3 * n)
for i, (pos, z) in enumerate(l):
big[pos] = i
for i, (pos, z) in enumerate(r):
small[pos] = i... | import heapq
n = int(eval(input()))
a = list(map(int, input().split()))
h = a[:n]
heapq.heapify(h)
first = [0] * (n + 1)
s = sum(a[:n])
first[0] = s
for i in range(n):
s += a[n + i]
heapq.heappush(h, a[n + i])
s -= heapq.heappop(h)
first[i + 1] = s
h = list([-x for x in a[2 * n :]])
heapq.heapify(h)
se... | false | 21.052632 | [
"+import heapq",
"+",
"-b = list(enumerate(a))",
"-l = sorted(b[: 2 * n], key=lambda x: x[1], reverse=True)",
"-r = sorted(b[n:], key=lambda x: x[1])",
"-big = [0] * (3 * n)",
"-small = [0] * (3 * n)",
"-for i, (pos, z) in enumerate(l):",
"- big[pos] = i",
"-for i, (pos, z) in enumerate(r):",
... | false | 0.047419 | 0.107574 | 0.440801 | [
"s402795869",
"s044979062"
] |
u837673618 | p02736 | python | s340242180 | s112489005 | 645 | 566 | 3,060 | 3,060 | Accepted | Accepted | 12.25 | import sys
N = int(eval(input())) - 1
two = False
S = 0
for i in range(N+1):
a = int(sys.stdin.read(1))
two |= (a == 2)
if i & N == i:
S ^= a-1
if two:
S &= ~2
print(S)
| import sys
N = int(eval(input())) - 1
two = False
S = 0
for i in range(N+1):
a = int(sys.stdin.read(1))
if not two:
two = a == 2
if i & N == i:
S ^= a-1
if two:
S &= ~2
print(S)
| 15 | 16 | 192 | 206 | import sys
N = int(eval(input())) - 1
two = False
S = 0
for i in range(N + 1):
a = int(sys.stdin.read(1))
two |= a == 2
if i & N == i:
S ^= a - 1
if two:
S &= ~2
print(S)
| import sys
N = int(eval(input())) - 1
two = False
S = 0
for i in range(N + 1):
a = int(sys.stdin.read(1))
if not two:
two = a == 2
if i & N == i:
S ^= a - 1
if two:
S &= ~2
print(S)
| false | 6.25 | [
"- two |= a == 2",
"+ if not two:",
"+ two = a == 2"
] | false | 0.042975 | 0.04196 | 1.024194 | [
"s340242180",
"s112489005"
] |
u078214750 | p03281 | python | s385548341 | s487860149 | 30 | 27 | 9,064 | 9,104 | Accepted | Accepted | 10 | import sys
input = lambda: sys.stdin.readline().rstrip()
N = int(eval(input()))
ans = 0
for i in range(1, N+1, 2):
yaku = 0
for j in range(1, i+1):
if i%j==0:
yaku += 1
if yaku == 8:
ans += 1
print(ans)
| import sys
input = lambda: sys.stdin.readline().rstrip()
N = int(eval(input()))
ans = 0
for n in range(1, N+1, 2):
yaku = 0
for i in range(1, n+1):
if n%i==0:
yaku += 1
if yaku == 8:
ans += 1
print(ans)
| 12 | 12 | 248 | 248 | import sys
input = lambda: sys.stdin.readline().rstrip()
N = int(eval(input()))
ans = 0
for i in range(1, N + 1, 2):
yaku = 0
for j in range(1, i + 1):
if i % j == 0:
yaku += 1
if yaku == 8:
ans += 1
print(ans)
| import sys
input = lambda: sys.stdin.readline().rstrip()
N = int(eval(input()))
ans = 0
for n in range(1, N + 1, 2):
yaku = 0
for i in range(1, n + 1):
if n % i == 0:
yaku += 1
if yaku == 8:
ans += 1
print(ans)
| false | 0 | [
"-for i in range(1, N + 1, 2):",
"+for n in range(1, N + 1, 2):",
"- for j in range(1, i + 1):",
"- if i % j == 0:",
"+ for i in range(1, n + 1):",
"+ if n % i == 0:"
] | false | 0.04625 | 0.040993 | 1.12824 | [
"s385548341",
"s487860149"
] |
u761320129 | p03566 | python | s523391179 | s984383030 | 81 | 71 | 3,500 | 4,624 | Accepted | Accepted | 12.35 | N = int(eval(input()))
ts = list(map(int,input().split()))
vs = list(map(int,input().split()))
maxv = [0]
for v,t in zip(vs,ts):
maxv[-1] = min(maxv[-1], v)
for ti in range(t*2):
maxv.append(v)
T = len(maxv)
for i in range(T-1):
maxv[i+1] = min(maxv[i+1], maxv[i] + 0.5)
maxv[-1] = 0... | N = int(eval(input()))
T = list([int(x)*2 for x in input().split()])
V = list([int(x)*2 for x in input().split()])
sumt = sum(T)
maxv = [min(i, sumt-i) for i in range(sumt+1)]
ct = 0
for t,v in zip(T,V):
for i in range(ct,ct+t+1):
maxv[i] = min(maxv[i], v)
ct += t
for i in range(sumt):
... | 22 | 19 | 480 | 463 | N = int(eval(input()))
ts = list(map(int, input().split()))
vs = list(map(int, input().split()))
maxv = [0]
for v, t in zip(vs, ts):
maxv[-1] = min(maxv[-1], v)
for ti in range(t * 2):
maxv.append(v)
T = len(maxv)
for i in range(T - 1):
maxv[i + 1] = min(maxv[i + 1], maxv[i] + 0.5)
maxv[-1] = 0
for ... | N = int(eval(input()))
T = list([int(x) * 2 for x in input().split()])
V = list([int(x) * 2 for x in input().split()])
sumt = sum(T)
maxv = [min(i, sumt - i) for i in range(sumt + 1)]
ct = 0
for t, v in zip(T, V):
for i in range(ct, ct + t + 1):
maxv[i] = min(maxv[i], v)
ct += t
for i in range(sumt):
... | false | 13.636364 | [
"-ts = list(map(int, input().split()))",
"-vs = list(map(int, input().split()))",
"-maxv = [0]",
"-for v, t in zip(vs, ts):",
"- maxv[-1] = min(maxv[-1], v)",
"- for ti in range(t * 2):",
"- maxv.append(v)",
"-T = len(maxv)",
"-for i in range(T - 1):",
"- maxv[i + 1] = min(maxv[i +... | false | 0.038154 | 0.039568 | 0.964249 | [
"s523391179",
"s984383030"
] |
u057109575 | p02962 | python | s339106213 | s338355466 | 408 | 330 | 151,400 | 87,372 | Accepted | Accepted | 19.12 | s = eval(input())
t = eval(input())
def z_algorithm(s):
n = len(s)
res = [0] * n
i = 1
j = 0
while i < n:
# i番目以降の一致文字数
while i + j < n and s[j] == s[i + j]:
j += 1
res[i] = j
# 一文字も一致しない場合,次の文字へ
if j == 0:
i += 1
... | s = eval(input())
t = eval(input())
def z_algorithm(s):
n = len(s)
res = [0] * n
i = 1
j = 0
while i < n:
# i番目以降の一致文字数
while i + j < n and s[j] == s[i + j]:
j += 1
res[i] = j
# 一文字も一致しない場合,次の文字へ
if j == 0:
i += 1
... | 54 | 52 | 937 | 893 | s = eval(input())
t = eval(input())
def z_algorithm(s):
n = len(s)
res = [0] * n
i = 1
j = 0
while i < n:
# i番目以降の一致文字数
while i + j < n and s[j] == s[i + j]:
j += 1
res[i] = j
# 一文字も一致しない場合,次の文字へ
if j == 0:
i += 1
continue... | s = eval(input())
t = eval(input())
def z_algorithm(s):
n = len(s)
res = [0] * n
i = 1
j = 0
while i < n:
# i番目以降の一致文字数
while i + j < n and s[j] == s[i + j]:
j += 1
res[i] = j
# 一文字も一致しない場合,次の文字へ
if j == 0:
i += 1
continue... | false | 3.703704 | [
"-z = [min(z[i], n) for i in range(n, len(z))]",
"- for v in z[i::n]:",
"- if v == n:",
"+ for v in z[n + i :: n]:",
"+ if v >= n:"
] | false | 0.036607 | 0.063614 | 0.575445 | [
"s339106213",
"s338355466"
] |
u759412327 | p03835 | python | s775725551 | s023378311 | 1,021 | 805 | 9,104 | 57,776 | Accepted | Accepted | 21.16 | K,S = list(map(int,input().split()))
a = 0
for X in range(K+1):
for Y in range(K+1):
if 0<=S-X-Y<=K:
a+=1
print(a) | K,S = list(map(int,input().split()))
print((sum([0<=S-X-Y<=K for X in range(K+1) for Y in range(K+1)]))) | 9 | 2 | 130 | 97 | K, S = list(map(int, input().split()))
a = 0
for X in range(K + 1):
for Y in range(K + 1):
if 0 <= S - X - Y <= K:
a += 1
print(a)
| K, S = list(map(int, input().split()))
print((sum([0 <= S - X - Y <= K for X in range(K + 1) for Y in range(K + 1)])))
| false | 77.777778 | [
"-a = 0",
"-for X in range(K + 1):",
"- for Y in range(K + 1):",
"- if 0 <= S - X - Y <= K:",
"- a += 1",
"-print(a)",
"+print((sum([0 <= S - X - Y <= K for X in range(K + 1) for Y in range(K + 1)])))"
] | false | 0.041767 | 0.080216 | 0.520674 | [
"s775725551",
"s023378311"
] |
u469254913 | p02624 | python | s555630302 | s307244503 | 783 | 562 | 108,856 | 108,988 | Accepted | Accepted | 28.22 | # import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)
from numba import njit
@njit
def sum_g(N):
res = 0
for i in range(1,N+1):
end = N // i
res += end * (end + 1) * i // 2
retur... | # import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)
from numba import njit,i8
@njit(i8(i8))
def sum_g(N):
res = 0
for i in range(1,N+1):
end = N // i
res += end * (end + 1) * i // 2... | 28 | 28 | 418 | 428 | # import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)
from numba import njit
@njit
def sum_g(N):
res = 0
for i in range(1, N + 1):
end = N // i
res += end * (end + 1) * i // 2
return res
def ... | # import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)
from numba import njit, i8
@njit(i8(i8))
def sum_g(N):
res = 0
for i in range(1, N + 1):
end = N // i
res += end * (end + 1) * i // 2
retur... | false | 0 | [
"-from numba import njit",
"+from numba import njit, i8",
"-@njit",
"+@njit(i8(i8))"
] | false | 0.038373 | 0.048556 | 0.790289 | [
"s555630302",
"s307244503"
] |
u816631826 | p03986 | python | s713371882 | s644712879 | 53 | 45 | 4,456 | 2,948 | Accepted | Accepted | 15.09 | #!/usr/bin/env python
s = input()
s1 = []
for x in s:
if not s1:
s1.append(x)
continue
if x == 'T' and s1[-1] == 'S':
# s1 = s1[:-1]
del s1[-1]
else:
s1.append(x)
print(len(s1))
| s = input()
sn = 0
tn = 0
for i in s:
if i == "S":
sn += 1
elif i == "T":
tn += 1
if sn > 0:
sn -= 1
tn -= 1
print(sn + tn) | 16 | 12 | 212 | 151 | #!/usr/bin/env python
s = input()
s1 = []
for x in s:
if not s1:
s1.append(x)
continue
if x == "T" and s1[-1] == "S":
# s1 = s1[:-1]
del s1[-1]
else:
s1.append(x)
print(len(s1))
| s = input()
sn = 0
tn = 0
for i in s:
if i == "S":
sn += 1
elif i == "T":
tn += 1
if sn > 0:
sn -= 1
tn -= 1
print(sn + tn)
| false | 25 | [
"-#!/usr/bin/env python",
"-s1 = []",
"-for x in s:",
"- if not s1:",
"- s1.append(x)",
"- continue",
"- if x == \"T\" and s1[-1] == \"S\":",
"- # s1 = s1[:-1]",
"- del s1[-1]",
"- else:",
"- s1.append(x)",
"-print(len(s1))",
"+sn = 0",
"+tn = 0"... | false | 0.04347 | 0.134009 | 0.324382 | [
"s713371882",
"s644712879"
] |
u017810624 | p02901 | python | s286768198 | s789544637 | 516 | 470 | 82,632 | 81,880 | Accepted | Accepted | 8.91 | from operator import itemgetter
n,m=list(map(int,input().split()))
l=[]
for i in range(m):
l2=[]
a,b=list(map(int,input().split()))
l2.append(a)
x=list(map(int,input().split()))
ct=0
for i in range(n):
if i+1 in x:
ct+=2**i
l2.append(ct)
l.append(l2)
dp=[[999999999999 for i in ... | from operator import itemgetter
n,m=list(map(int,input().split()))
l=[]
for i in range(m):
l2=[]
a,b=list(map(int,input().split()))
l2.append(a)
x=list(map(int,input().split()))
ct=0
for i in range(n):
if i+1 in x:
ct+=2**i
l2.append(ct)
l.append(l2)
dp=[[999999999999 for i in ... | 27 | 27 | 628 | 608 | from operator import itemgetter
n, m = list(map(int, input().split()))
l = []
for i in range(m):
l2 = []
a, b = list(map(int, input().split()))
l2.append(a)
x = list(map(int, input().split()))
ct = 0
for i in range(n):
if i + 1 in x:
ct += 2**i
l2.append(ct)
l.append... | from operator import itemgetter
n, m = list(map(int, input().split()))
l = []
for i in range(m):
l2 = []
a, b = list(map(int, input().split()))
l2.append(a)
x = list(map(int, input().split()))
ct = 0
for i in range(n):
if i + 1 in x:
ct += 2**i
l2.append(ct)
l.append... | false | 0 | [
"- dp[i][j | l[i - 1][1]] = min(",
"- dp[i - 1][j | l[i - 1][1]],",
"- dp[i - 1][j] + l[i - 1][0],",
"- dp[i][j | l[i - 1][1]],",
"- )",
"+ dp[i][j | l[i - 1][1]] = min(dp[i - 1][j] + l[i - 1][0], dp[i][j | l[i - 1][1]])"
] | false | 0.044341 | 0.044751 | 0.990837 | [
"s286768198",
"s789544637"
] |
u864197622 | p03246 | python | s782933560 | s070103270 | 183 | 87 | 17,116 | 18,656 | Accepted | Accepted | 52.46 | from collections import Counter as C
n = int(eval(input()))
v = [int(a) for a in input().split()]
k1 = C(v[::2]).most_common()[0][0]
v1 = C(v[::2]).most_common()[0][1]
if v1 == n/2:
k2 = 0
v2 = 0
else:
k2 = C(v[::2]).most_common()[1][0]
v2 = C(v[::2]).most_common()[1][1]
k3 = C(v[1::2])... | from collections import Counter as C
n = int(eval(input()))
v = [int(a) for a in input().split()]
a=C(v[::2])
b=C(v[1::2])
a[0]=b[0]=0
a=a.most_common()
b=b.most_common()
if a[0][0] != b[0][0]:
print((n-a[0][1]-b[0][1]))
else:
print((min(n-a[1][1]-b[0][1],n-a[0][1]-b[1][1])))
| 28 | 13 | 592 | 290 | from collections import Counter as C
n = int(eval(input()))
v = [int(a) for a in input().split()]
k1 = C(v[::2]).most_common()[0][0]
v1 = C(v[::2]).most_common()[0][1]
if v1 == n / 2:
k2 = 0
v2 = 0
else:
k2 = C(v[::2]).most_common()[1][0]
v2 = C(v[::2]).most_common()[1][1]
k3 = C(v[1::2]).most_common()... | from collections import Counter as C
n = int(eval(input()))
v = [int(a) for a in input().split()]
a = C(v[::2])
b = C(v[1::2])
a[0] = b[0] = 0
a = a.most_common()
b = b.most_common()
if a[0][0] != b[0][0]:
print((n - a[0][1] - b[0][1]))
else:
print((min(n - a[1][1] - b[0][1], n - a[0][1] - b[1][1])))
| false | 53.571429 | [
"-k1 = C(v[::2]).most_common()[0][0]",
"-v1 = C(v[::2]).most_common()[0][1]",
"-if v1 == n / 2:",
"- k2 = 0",
"- v2 = 0",
"+a = C(v[::2])",
"+b = C(v[1::2])",
"+a[0] = b[0] = 0",
"+a = a.most_common()",
"+b = b.most_common()",
"+if a[0][0] != b[0][0]:",
"+ print((n - a[0][1] - b[0][1]... | false | 0.047028 | 0.125716 | 0.374083 | [
"s782933560",
"s070103270"
] |
u410118019 | p03038 | python | s386769840 | s284200974 | 680 | 431 | 52,244 | 24,776 | Accepted | Accepted | 36.62 | n,m = list(map(int,input().split()))
bc = {}
a = list(input().split())
for i in a:
if i in bc:
bc[i] += 1
else:
bc[i] = 1
for i in range(m):
b,c = input().split()
b = int(b)
if c in bc:
bc[c] += b
else:
bc.update({c:b})
key = sorted(bc)
for k in range(len(key)):
key[k] = i... | n,m = list(map(int,input().split()))
a = list(map(int,input().split()))
bc = []
for i in range(m):
b,c = list(map(int,input().split()))
bc.append((b,c))
bc = sorted(bc,key=lambda x:x[1])
bc.reverse()
count = 0
for b,c in bc:
count += b
a += [c] * b
if count >= n:
break
a.sort()
a.reverse()
... | 34 | 17 | 580 | 326 | n, m = list(map(int, input().split()))
bc = {}
a = list(input().split())
for i in a:
if i in bc:
bc[i] += 1
else:
bc[i] = 1
for i in range(m):
b, c = input().split()
b = int(b)
if c in bc:
bc[c] += b
else:
bc.update({c: b})
key = sorted(bc)
for k in range(len(key)... | n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
bc = []
for i in range(m):
b, c = list(map(int, input().split()))
bc.append((b, c))
bc = sorted(bc, key=lambda x: x[1])
bc.reverse()
count = 0
for b, c in bc:
count += b
a += [c] * b
if count >= n:
break
a.sort()
a.re... | false | 50 | [
"-bc = {}",
"-a = list(input().split())",
"-for i in a:",
"- if i in bc:",
"- bc[i] += 1",
"- else:",
"- bc[i] = 1",
"+a = list(map(int, input().split()))",
"+bc = []",
"- b, c = input().split()",
"- b = int(b)",
"- if c in bc:",
"- bc[c] += b",
"- el... | false | 0.046191 | 0.046579 | 0.991672 | [
"s386769840",
"s284200974"
] |
u255943004 | p02936 | python | s093644768 | s636509512 | 1,977 | 492 | 133,036 | 124,116 | Accepted | Accepted | 75.11 | N,Q = list(map(int,input().split()))
AB = [[] for _ in range(N-1)]
for n in range(N-1):
AB[n] = list(map(int,input().split()))
PX = [[] for _ in range(Q)]
for q in range(Q):
PX[q] = list(map(int,input().split()))
graph = [[] for _ in range(N+1)]
for ab in AB:
graph[ab[0]].append(ab[1])
graph[a... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N,Q = list(map(int,readline().split()))
ABPX = list(map(int,read().split()))
AB = iter(ABPX[:N+N-2])
PX = iter(ABPX[N+N-2:])
graph = [[] for _ in range(N+1)]
for a,b in zip(AB,AB):
graph... | 26 | 32 | 655 | 673 | N, Q = list(map(int, input().split()))
AB = [[] for _ in range(N - 1)]
for n in range(N - 1):
AB[n] = list(map(int, input().split()))
PX = [[] for _ in range(Q)]
for q in range(Q):
PX[q] = list(map(int, input().split()))
graph = [[] for _ in range(N + 1)]
for ab in AB:
graph[ab[0]].append(ab[1])
graph[a... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, Q = list(map(int, readline().split()))
ABPX = list(map(int, read().split()))
AB = iter(ABPX[: N + N - 2])
PX = iter(ABPX[N + N - 2 :])
graph = [[] for _ in range(N + 1)]
for a, b in zip(AB, AB):
g... | false | 18.75 | [
"-N, Q = list(map(int, input().split()))",
"-AB = [[] for _ in range(N - 1)]",
"-for n in range(N - 1):",
"- AB[n] = list(map(int, input().split()))",
"-PX = [[] for _ in range(Q)]",
"-for q in range(Q):",
"- PX[q] = list(map(int, input().split()))",
"+import sys",
"+",
"+read = sys.stdin.bu... | false | 0.046999 | 0.067808 | 0.693114 | [
"s093644768",
"s636509512"
] |
u680851063 | p03779 | python | s053562329 | s037078276 | 42 | 37 | 10,600 | 9,088 | Accepted | Accepted | 11.9 | x = int(eval(input()))
i=1
cum=[0]
while cum[-1] < 10**9:
cum+=[cum[-1]+i]
i+=1
import bisect
index = bisect.bisect_left(cum, x)
print(index) | x = int(eval(input()))
i=1
while i*(i+1)//2 < x:
i+=1
print(i) | 12 | 7 | 157 | 68 | x = int(eval(input()))
i = 1
cum = [0]
while cum[-1] < 10**9:
cum += [cum[-1] + i]
i += 1
import bisect
index = bisect.bisect_left(cum, x)
print(index)
| x = int(eval(input()))
i = 1
while i * (i + 1) // 2 < x:
i += 1
print(i)
| false | 41.666667 | [
"-cum = [0]",
"-while cum[-1] < 10**9:",
"- cum += [cum[-1] + i]",
"+while i * (i + 1) // 2 < x:",
"-import bisect",
"-",
"-index = bisect.bisect_left(cum, x)",
"-print(index)",
"+print(i)"
] | false | 0.071979 | 0.046585 | 1.545093 | [
"s053562329",
"s037078276"
] |
u310678820 | p02788 | python | s673385800 | s926250954 | 1,577 | 1,237 | 88,428 | 96,348 | Accepted | Accepted | 21.56 | import sys
input = sys.stdin.readline
N, D, A = list(map(int, input().split()))
XH = [list(map(int, input().split())) for _ in range(N)]
XH.sort()
X = [XH[i][0] for i in range(N)]
ans = 0
res = 0
from bisect import bisect_left
cnt = [0]*(N+1)
for i in range(N):
x, h = XH[i]
res-=cnt[i]
h-=res
... | import sys
input = sys.stdin.readline
N, D, A = list(map(int, input().split()))
XH = [list(map(int, input().split())) for _ in range(N)]
XH.sort(key = lambda x:x[0])
X = [XH[i][0] for i in range(N)]
ans = 0
res = 0
from bisect import bisect_left
cnt = [0]*(N+1)
for i in range(N):
x, h = XH[i]
res-=c... | 26 | 26 | 478 | 497 | import sys
input = sys.stdin.readline
N, D, A = list(map(int, input().split()))
XH = [list(map(int, input().split())) for _ in range(N)]
XH.sort()
X = [XH[i][0] for i in range(N)]
ans = 0
res = 0
from bisect import bisect_left
cnt = [0] * (N + 1)
for i in range(N):
x, h = XH[i]
res -= cnt[i]
h -= res
... | import sys
input = sys.stdin.readline
N, D, A = list(map(int, input().split()))
XH = [list(map(int, input().split())) for _ in range(N)]
XH.sort(key=lambda x: x[0])
X = [XH[i][0] for i in range(N)]
ans = 0
res = 0
from bisect import bisect_left
cnt = [0] * (N + 1)
for i in range(N):
x, h = XH[i]
res -= cnt[i]... | false | 0 | [
"-XH.sort()",
"+XH.sort(key=lambda x: x[0])"
] | false | 0.03871 | 0.066612 | 0.581126 | [
"s673385800",
"s926250954"
] |
u021019433 | p02873 | python | s089451709 | s841768397 | 270 | 206 | 4,104 | 4,104 | Accepted | Accepted | 23.7 | r = p = 0
l = [0, 0]
for c in eval(input()):
f = c == '<'
if c != p:
p = c
if f:
r -= min(l)
l = [0, 0]
l[f] += 1
r += l[f]
if not f:
r -= min(l)
print(r)
| r = l = p = lp = 0
for c in eval(input()):
if c != p:
if c == '<':
r -= min(l, lp)
p = c
lp = l
l = 0
l += 1
r += l
if p == '>':
r -= min(l, lp)
print(r)
| 14 | 13 | 222 | 223 | r = p = 0
l = [0, 0]
for c in eval(input()):
f = c == "<"
if c != p:
p = c
if f:
r -= min(l)
l = [0, 0]
l[f] += 1
r += l[f]
if not f:
r -= min(l)
print(r)
| r = l = p = lp = 0
for c in eval(input()):
if c != p:
if c == "<":
r -= min(l, lp)
p = c
lp = l
l = 0
l += 1
r += l
if p == ">":
r -= min(l, lp)
print(r)
| false | 7.142857 | [
"-r = p = 0",
"-l = [0, 0]",
"+r = l = p = lp = 0",
"- f = c == \"<\"",
"+ if c == \"<\":",
"+ r -= min(l, lp)",
"- if f:",
"- r -= min(l)",
"- l = [0, 0]",
"- l[f] += 1",
"- r += l[f]",
"-if not f:",
"- r -= min(l)",
"+ lp ... | false | 0.037103 | 0.036956 | 1.00397 | [
"s089451709",
"s841768397"
] |
u554781254 | p02971 | python | s400754218 | s058977231 | 411 | 355 | 62,428 | 14,720 | Accepted | Accepted | 13.63 | 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
INF = float('inf')
NIL = - 1
N = int(eva... | 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
INF = float('inf')
NIL = - 1
N = int(eva... | 32 | 36 | 717 | 853 | 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
INF = float("inf")
NIL = -1
N = int(eval(input()))
A = [... | 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
INF = float("inf")
NIL = -1
N = int(eval(input()))
A = [... | false | 11.111111 | [
"-max_a = max(A)",
"-max_idx = [i for i, x in enumerate(A) if x == max_a]",
"-if len(max_idx) > 1:",
"- for i in range(N):",
"- print(max_a)",
"- exit()",
"-else:",
"- for i in max_idx:",
"- A[i] = NIL",
"- second_max = max(A)",
"- for i in range(N):",
"- if... | false | 0.040287 | 0.039668 | 1.01559 | [
"s400754218",
"s058977231"
] |
u517152997 | p02928 | python | s726837137 | s282764194 | 1,266 | 779 | 14,456 | 3,188 | Accepted | Accepted | 38.47 | # -*- coding: utf-8 -*-
#
import math
import sys
import itertools
import numpy as np
DIV_NUM = 1000000000 + 7
INPUT_NUMS = list(map(int, input().split()))
N=int(INPUT_NUMS[0])
K=int(INPUT_NUMS[1])
A = [int(x) for x in input().split()]
AA = np.array(A)
if N==1:
print((0))
exit()
# https:/... | # -*- coding: utf-8 -*-
#
import math
import sys
import itertools
DIV_NUM = 1000000000 + 7
N,K = list(map(int, input().split()))
A = [int(x) for x in input().split()]
if N==1:
print((0))
exit()
answer = 0
for i in range(len(A)):
for j in range(len(A)-1,i,-1):
if A[j]<A[j-1]:
... | 50 | 37 | 933 | 633 | # -*- coding: utf-8 -*-
#
import math
import sys
import itertools
import numpy as np
DIV_NUM = 1000000000 + 7
INPUT_NUMS = list(map(int, input().split()))
N = int(INPUT_NUMS[0])
K = int(INPUT_NUMS[1])
A = [int(x) for x in input().split()]
AA = np.array(A)
if N == 1:
print((0))
exit()
# https://kira000.hatenadi... | # -*- coding: utf-8 -*-
#
import math
import sys
import itertools
DIV_NUM = 1000000000 + 7
N, K = list(map(int, input().split()))
A = [int(x) for x in input().split()]
if N == 1:
print((0))
exit()
answer = 0
for i in range(len(A)):
for j in range(len(A) - 1, i, -1):
if A[j] < A[j - 1]:
... | false | 26 | [
"-import numpy as np",
"-INPUT_NUMS = list(map(int, input().split()))",
"-N = int(INPUT_NUMS[0])",
"-K = int(INPUT_NUMS[1])",
"+N, K = list(map(int, input().split()))",
"-AA = np.array(A)",
"-# https://kira000.hatenadiary.jp/entry/2019/02/23/053917",
"-def bubble_sort(A):",
"- cnt = 0",
"- f... | false | 0.223365 | 0.039558 | 5.646499 | [
"s726837137",
"s282764194"
] |
u581187895 | p02923 | python | s468745585 | s361866381 | 177 | 81 | 24,232 | 15,020 | Accepted | Accepted | 54.24 | import numpy as np
N = int(eval(input()))
H = np.array(input().split(), dtype=np.int32)
"""
A = [10,4,8,7,3]
left_idx = [0,0,2,2,2]
というものを作る
"""
left_idx = np.arange(N)
left_idx[1:][H[:-1] >= H[1:]] = 0
np.maximum.accumulate(left_idx, out=left_idx)
ans = (np.arange(N) - left_idx).max()
print(ans) | N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
count = 0
for h1, h2 in zip(A, A[1:]):
count += 1
if h1 < h2:
count = 0
ans = max(ans, count)
print(ans) | 16 | 12 | 309 | 192 | import numpy as np
N = int(eval(input()))
H = np.array(input().split(), dtype=np.int32)
"""
A = [10,4,8,7,3]
left_idx = [0,0,2,2,2]
というものを作る
"""
left_idx = np.arange(N)
left_idx[1:][H[:-1] >= H[1:]] = 0
np.maximum.accumulate(left_idx, out=left_idx)
ans = (np.arange(N) - left_idx).max()
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
count = 0
for h1, h2 in zip(A, A[1:]):
count += 1
if h1 < h2:
count = 0
ans = max(ans, count)
print(ans)
| false | 25 | [
"-import numpy as np",
"-",
"-H = np.array(input().split(), dtype=np.int32)",
"-\"\"\"",
"-A = [10,4,8,7,3]",
"-left_idx = [0,0,2,2,2]",
"-というものを作る",
"-\"\"\"",
"-left_idx = np.arange(N)",
"-left_idx[1:][H[:-1] >= H[1:]] = 0",
"-np.maximum.accumulate(left_idx, out=left_idx)",
"-ans = (np.arang... | false | 0.234166 | 0.076881 | 3.045824 | [
"s468745585",
"s361866381"
] |
u581187895 | p03126 | python | s702975956 | s726634887 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | from collections import Counter
n, m = list(map(int, input().split()))
food_arr = []
total = 0
for i in range(n):
food_arr += list(map(int, input().split()[1:]))
counter = Counter(food_arr)
for key, value in list(counter.items()):
if value == n:
total += 1
print(total) | N, M = list(map(int, input().split()))
se = set(range(1,M+1))
for _ in range(N):
k, *A = list(map(int, input().split()))
se &= set(A)
print((len(se))) | 12 | 7 | 287 | 151 | from collections import Counter
n, m = list(map(int, input().split()))
food_arr = []
total = 0
for i in range(n):
food_arr += list(map(int, input().split()[1:]))
counter = Counter(food_arr)
for key, value in list(counter.items()):
if value == n:
total += 1
print(total)
| N, M = list(map(int, input().split()))
se = set(range(1, M + 1))
for _ in range(N):
k, *A = list(map(int, input().split()))
se &= set(A)
print((len(se)))
| false | 41.666667 | [
"-from collections import Counter",
"-",
"-n, m = list(map(int, input().split()))",
"-food_arr = []",
"-total = 0",
"-for i in range(n):",
"- food_arr += list(map(int, input().split()[1:]))",
"-counter = Counter(food_arr)",
"-for key, value in list(counter.items()):",
"- if value == n:",
"... | false | 0.17194 | 0.161364 | 1.065538 | [
"s702975956",
"s726634887"
] |
u217303170 | p02915 | python | s040293165 | s884560794 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | n = int(eval(input()))
print((n*n*n))
| n = int(eval(input()))
print((n**3))
| 2 | 2 | 31 | 30 | n = int(eval(input()))
print((n * n * n))
| n = int(eval(input()))
print((n**3))
| false | 0 | [
"-print((n * n * n))",
"+print((n**3))"
] | false | 0.03585 | 0.035259 | 1.016741 | [
"s040293165",
"s884560794"
] |
u600402037 | p03416 | python | s278850556 | s748267746 | 59 | 48 | 2,940 | 2,940 | Accepted | Accepted | 18.64 | A, B = list(map(int, input().split()))
count = 0
for n in range(A, B+1):
n = str(n)
if n == n[::-1]:
count += 1
print(count)
| A, B = list(map(int, input().split()))
print((sum(n == n[::-1] for n in map(str, list(range(A, B+1)))))) | 7 | 2 | 141 | 91 | A, B = list(map(int, input().split()))
count = 0
for n in range(A, B + 1):
n = str(n)
if n == n[::-1]:
count += 1
print(count)
| A, B = list(map(int, input().split()))
print((sum(n == n[::-1] for n in map(str, list(range(A, B + 1))))))
| false | 71.428571 | [
"-count = 0",
"-for n in range(A, B + 1):",
"- n = str(n)",
"- if n == n[::-1]:",
"- count += 1",
"-print(count)",
"+print((sum(n == n[::-1] for n in map(str, list(range(A, B + 1))))))"
] | false | 0.062074 | 0.061232 | 1.013764 | [
"s278850556",
"s748267746"
] |
u396495667 | p03573 | python | s487111171 | s481384456 | 170 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90 | a,b,c = list(map(int, input().split()))
if a == b:
print(c)
elif a == c:
print(b)
else:
print(a) | a = [int(_) for _ in input().split()]
a.sort()
if a[0] == a[1]:
print((a[2]))
elif a[0] == a[2]:
print((a[1]))
else:
print((a[0])) | 8 | 8 | 104 | 137 | a, b, c = list(map(int, input().split()))
if a == b:
print(c)
elif a == c:
print(b)
else:
print(a)
| a = [int(_) for _ in input().split()]
a.sort()
if a[0] == a[1]:
print((a[2]))
elif a[0] == a[2]:
print((a[1]))
else:
print((a[0]))
| false | 0 | [
"-a, b, c = list(map(int, input().split()))",
"-if a == b:",
"- print(c)",
"-elif a == c:",
"- print(b)",
"+a = [int(_) for _ in input().split()]",
"+a.sort()",
"+if a[0] == a[1]:",
"+ print((a[2]))",
"+elif a[0] == a[2]:",
"+ print((a[1]))",
"- print(a)",
"+ print((a[0]))"... | false | 0.032444 | 0.031741 | 1.022144 | [
"s487111171",
"s481384456"
] |
u222668979 | p03111 | python | s761623122 | s870640710 | 353 | 208 | 92,484 | 78,016 | Accepted | Accepted | 41.08 | from itertools import product
def solve(NUM, LIST):
lst = [l[i] for i, li in enumerate(LIST) if li == NUM]
if len(lst) == 0:
return 10 ** 5
ANS = (len(lst) - 1) * 10
ANS += abs(sum(lst) - target[NUM])
return ANS
target = list(map(int, input().split()))
l = [int(eval(input())) fo... | from itertools import product
def solve(NUM, LIST):
lst = [l[i] for i, t in enumerate(LIST) if t == NUM]
if len(lst) == 0:
return 10 ** 5
ANS = (len(lst) - 1) * 10
ANS += abs(sum(lst) - tgt[NUM])
return ANS
tgt = list(map(int, input().split()))
l = [int(eval(input())) for _ in r... | 18 | 18 | 498 | 486 | from itertools import product
def solve(NUM, LIST):
lst = [l[i] for i, li in enumerate(LIST) if li == NUM]
if len(lst) == 0:
return 10**5
ANS = (len(lst) - 1) * 10
ANS += abs(sum(lst) - target[NUM])
return ANS
target = list(map(int, input().split()))
l = [int(eval(input())) for _ in rang... | from itertools import product
def solve(NUM, LIST):
lst = [l[i] for i, t in enumerate(LIST) if t == NUM]
if len(lst) == 0:
return 10**5
ANS = (len(lst) - 1) * 10
ANS += abs(sum(lst) - tgt[NUM])
return ANS
tgt = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(tgt[0]... | false | 0 | [
"- lst = [l[i] for i, li in enumerate(LIST) if li == NUM]",
"+ lst = [l[i] for i, t in enumerate(LIST) if t == NUM]",
"- ANS += abs(sum(lst) - target[NUM])",
"+ ANS += abs(sum(lst) - tgt[NUM])",
"-target = list(map(int, input().split()))",
"-l = [int(eval(input())) for _ in range(target[0])]",... | false | 0.333059 | 0.287914 | 1.156802 | [
"s761623122",
"s870640710"
] |
u111365362 | p02617 | python | s469702948 | s404490707 | 337 | 303 | 94,324 | 74,540 | Accepted | Accepted | 10.09 | n = int(eval(input()))
a = [i+1 for i in range(n)]
b = [1]
for i in range(1,n):
b.append(b[-1] + a[i])
c = [0]
for i in range(n-1):
c.append(c[-1]+b[i])
#print(a)
#print(b)
#print(c)
ans = b[-1] + c[-1]
for _ in range(n-1):
xy = list(map(int,input().split()))
xy.sort()
x,y = xy
ans -= x * (n... | n = int(eval(input()))
ans = n*(n+1)*(n+2)//6
for i in range(n-1):
xy = list(map(int,input().split()))
ans -= min(xy) * (n+1-max(xy))
print(ans) | 18 | 6 | 331 | 147 | n = int(eval(input()))
a = [i + 1 for i in range(n)]
b = [1]
for i in range(1, n):
b.append(b[-1] + a[i])
c = [0]
for i in range(n - 1):
c.append(c[-1] + b[i])
# print(a)
# print(b)
# print(c)
ans = b[-1] + c[-1]
for _ in range(n - 1):
xy = list(map(int, input().split()))
xy.sort()
x, y = xy
ans... | n = int(eval(input()))
ans = n * (n + 1) * (n + 2) // 6
for i in range(n - 1):
xy = list(map(int, input().split()))
ans -= min(xy) * (n + 1 - max(xy))
print(ans)
| false | 66.666667 | [
"-a = [i + 1 for i in range(n)]",
"-b = [1]",
"-for i in range(1, n):",
"- b.append(b[-1] + a[i])",
"-c = [0]",
"+ans = n * (n + 1) * (n + 2) // 6",
"- c.append(c[-1] + b[i])",
"-# print(a)",
"-# print(b)",
"-# print(c)",
"-ans = b[-1] + c[-1]",
"-for _ in range(n - 1):",
"- xy.sort... | false | 0.045787 | 0.084886 | 0.539389 | [
"s469702948",
"s404490707"
] |
u148551245 | p03469 | python | s057198773 | s166566641 | 173 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.17 | s = eval(input())
s = s.replace("7", "8", 1)
print(s) | s = eval(input())
print(("2018" + s[4:])) | 3 | 2 | 49 | 34 | s = eval(input())
s = s.replace("7", "8", 1)
print(s)
| s = eval(input())
print(("2018" + s[4:]))
| false | 33.333333 | [
"-s = s.replace(\"7\", \"8\", 1)",
"-print(s)",
"+print((\"2018\" + s[4:]))"
] | false | 0.079423 | 0.038957 | 2.038722 | [
"s057198773",
"s166566641"
] |
u522945737 | p02641 | python | s184982949 | s034577678 | 117 | 28 | 27,076 | 9,204 | Accepted | Accepted | 76.07 | import sys
import numpy as np
X, N = list(map(int, input().split()))
if N == 0:
print(X)
sys.exit()
p = list(map(int, input().split()))
forbid = [True]*102
for i in range(len(p)):
if forbid[p[i]]:
forbid[p[i]] = False
pp = []
for i in range(len(forbid)):
if forbid[i]... | import sys
X, N = list(map(int, input().split()))
if N == 0:
print(X)
sys.exit()
p = list(map(int, input().split()))
forbid = [True]*102
for i in range(len(p)):
if forbid[p[i]]:
forbid[p[i]] = False
pp = []
for i in range(len(forbid)):
if forbid[i]:
pp.append... | 26 | 25 | 511 | 462 | import sys
import numpy as np
X, N = list(map(int, input().split()))
if N == 0:
print(X)
sys.exit()
p = list(map(int, input().split()))
forbid = [True] * 102
for i in range(len(p)):
if forbid[p[i]]:
forbid[p[i]] = False
pp = []
for i in range(len(forbid)):
if forbid[i]:
pp.append(i - X)... | import sys
X, N = list(map(int, input().split()))
if N == 0:
print(X)
sys.exit()
p = list(map(int, input().split()))
forbid = [True] * 102
for i in range(len(p)):
if forbid[p[i]]:
forbid[p[i]] = False
pp = []
for i in range(len(forbid)):
if forbid[i]:
pp.append(i - X)
num = pp[len(pp) -... | false | 3.846154 | [
"-import numpy as np",
"-# num = pp[len(pp)-1]",
"-# for i in range(len(pp)-1,0,-1):",
"-# if abs(num) >= abs(pp[i]):",
"-# num = pp[i]",
"-print((pp[np.argmin(np.abs(pp))] + X))",
"+num = pp[len(pp) - 1]",
"+for i in range(len(pp) - 1, -1, -1):",
"+ if abs(num) >= abs(pp[i]):",
"+ ... | false | 0.197065 | 0.103016 | 1.912948 | [
"s184982949",
"s034577678"
] |
u941407962 | p02846 | python | s741060137 | s416986297 | 180 | 166 | 38,384 | 38,384 | Accepted | Accepted | 7.78 | t1,t2 = list(map(int, input().split()))
a1,a2 = list(map(int, input().split()))
b1,b2 = list(map(int, input().split()))
x,y=(a1-b1)*t1 + (a2-b2)*t2, (a1-b1)*t1
if x == 0:
print("infinity")
elif x*y > 0:
print((0))
else:
s,t = divmod(abs(y), abs(x))
print((s*2+(1 if t else 0)))
| t,T,a,A,b,B=list(map(int, open(0).read().split()))
x,y=(a-b)*t,(A-B)*T
if x+y==0:
r="infinity"
else:
s,t=divmod(-x, x+y)
r=0 if s<0 else s*2+(1 if t else 0)
print(r) | 11 | 8 | 282 | 169 | t1, t2 = list(map(int, input().split()))
a1, a2 = list(map(int, input().split()))
b1, b2 = list(map(int, input().split()))
x, y = (a1 - b1) * t1 + (a2 - b2) * t2, (a1 - b1) * t1
if x == 0:
print("infinity")
elif x * y > 0:
print((0))
else:
s, t = divmod(abs(y), abs(x))
print((s * 2 + (1 if t else 0)))
| t, T, a, A, b, B = list(map(int, open(0).read().split()))
x, y = (a - b) * t, (A - B) * T
if x + y == 0:
r = "infinity"
else:
s, t = divmod(-x, x + y)
r = 0 if s < 0 else s * 2 + (1 if t else 0)
print(r)
| false | 27.272727 | [
"-t1, t2 = list(map(int, input().split()))",
"-a1, a2 = list(map(int, input().split()))",
"-b1, b2 = list(map(int, input().split()))",
"-x, y = (a1 - b1) * t1 + (a2 - b2) * t2, (a1 - b1) * t1",
"-if x == 0:",
"- print(\"infinity\")",
"-elif x * y > 0:",
"- print((0))",
"+t, T, a, A, b, B = lis... | false | 0.043311 | 0.046417 | 0.933098 | [
"s741060137",
"s416986297"
] |
u597374218 | p02983 | python | s263952911 | s488264739 | 333 | 308 | 75,416 | 2,940 | Accepted | Accepted | 7.51 | L,R=list(map(int,input().split()))
left,right=L%2019,R%2019
print((0 if R-L>=2019 else min([i*j%2019 for i in range(left,right+1) for j in range(i+1,right+1)]))) | L,R=list(map(int,input().split()))
left,right=L%2019,R%2019
print((0 if R-L>=2019 else min(i*j%2019 for i in range(left,right+1) for j in range(i+1,right+1)))) | 3 | 3 | 155 | 153 | L, R = list(map(int, input().split()))
left, right = L % 2019, R % 2019
print(
(
0
if R - L >= 2019
else min(
[
i * j % 2019
for i in range(left, right + 1)
for j in range(i + 1, right + 1)
]
)
)
)
| L, R = list(map(int, input().split()))
left, right = L % 2019, R % 2019
print(
(
0
if R - L >= 2019
else min(
i * j % 2019
for i in range(left, right + 1)
for j in range(i + 1, right + 1)
)
)
)
| false | 0 | [
"- [",
"- i * j % 2019",
"- for i in range(left, right + 1)",
"- for j in range(i + 1, right + 1)",
"- ]",
"+ i * j % 2019",
"+ for i in range(left, right + 1)",
"+ for j in range(i + 1, right + 1)"
] | false | 0.170703 | 0.049605 | 3.441212 | [
"s263952911",
"s488264739"
] |
u801512570 | p03289 | python | s654980327 | s156579016 | 20 | 17 | 3,064 | 2,940 | Accepted | Accepted | 15 | S = eval(input())
if S[0]=='A' and S[2:-1].count('C')==1:
S=S.replace("A", "a")
S=S.replace("C", "c")
if S.islower()==True:
print('AC')
else:
print('WA')
else:
print('WA') | S = eval(input())
if S[0]=='A' and S[2:-1].count('C')==1:
S=S[1:].replace("C", "c")
if S.islower()==True:
print('AC')
else:
print('WA')
else:
print('WA') | 11 | 10 | 212 | 189 | S = eval(input())
if S[0] == "A" and S[2:-1].count("C") == 1:
S = S.replace("A", "a")
S = S.replace("C", "c")
if S.islower() == True:
print("AC")
else:
print("WA")
else:
print("WA")
| S = eval(input())
if S[0] == "A" and S[2:-1].count("C") == 1:
S = S[1:].replace("C", "c")
if S.islower() == True:
print("AC")
else:
print("WA")
else:
print("WA")
| false | 9.090909 | [
"- S = S.replace(\"A\", \"a\")",
"- S = S.replace(\"C\", \"c\")",
"+ S = S[1:].replace(\"C\", \"c\")"
] | false | 0.046155 | 0.063329 | 0.728822 | [
"s654980327",
"s156579016"
] |
u888337853 | p02588 | python | s810136454 | s778290074 | 1,687 | 1,446 | 276,920 | 289,552 | Accepted | Accepted | 14.29 | import sys
import math
import collections
import bisect
import itertools
import decimal
# import numpy as np
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
# MOD = 10 ** 9 + 7
MOD = 998244353
ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: list(map(int, sys.stdin.readline().rstrip().split(... | import sys
import math
import collections
import bisect
import itertools
import decimal
# import numpy as np
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
# MOD = 10 ** 9 + 7
MOD = 998244353
ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: list(map(int, sys.stdin.readline().rstrip().split(... | 73 | 73 | 1,637 | 1,659 | import sys
import math
import collections
import bisect
import itertools
import decimal
# import numpy as np
sys.setrecursionlimit(10**7)
INF = 10**20
# MOD = 10 ** 9 + 7
MOD = 998244353
ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na = lambda: list... | import sys
import math
import collections
import bisect
import itertools
import decimal
# import numpy as np
sys.setrecursionlimit(10**7)
INF = 10**20
# MOD = 10 ** 9 + 7
MOD = 998244353
ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na = lambda: list... | false | 0 | [
"- a = [int(decimal.Decimal(eval(input())) * (10**9)) for _ in range(n)]",
"+ a = [",
"+ int(decimal.Decimal(sys.stdin.readline().rstrip()) * (10**9))",
"+ for _ in range(n)",
"+ ]"
] | false | 0.039329 | 0.039844 | 0.987087 | [
"s810136454",
"s778290074"
] |
u562935282 | p03326 | python | s124711901 | s178672976 | 36 | 28 | 3,316 | 3,260 | Accepted | Accepted | 22.22 | N, M = list(map(int, input().split()))
XYZs = [list(map(int, input().split())) for _ in range(N)]
ans = 0
for op in range(1 << 3):
lst = []
for xyz in XYZs:
v = 0
for j in range(3):
v += xyz[j] * ((-1) ** ((op >> j) & 1))
lst.append(v)
ans = max(ans, sum(sorte... | N, M = list(map(int, input().split()))
XYZs = [tuple(map(int, input().split())) for _ in range(N)]
ans = 0
for i in range(1 << 3):
signs = []
for j in range(3):
if i >> j & 1:
signs.append(1)
else:
signs.append(-1)
t = []
for xyz in XYZs:
x, ... | 14 | 17 | 354 | 452 | N, M = list(map(int, input().split()))
XYZs = [list(map(int, input().split())) for _ in range(N)]
ans = 0
for op in range(1 << 3):
lst = []
for xyz in XYZs:
v = 0
for j in range(3):
v += xyz[j] * ((-1) ** ((op >> j) & 1))
lst.append(v)
ans = max(ans, sum(sorted(lst, rever... | N, M = list(map(int, input().split()))
XYZs = [tuple(map(int, input().split())) for _ in range(N)]
ans = 0
for i in range(1 << 3):
signs = []
for j in range(3):
if i >> j & 1:
signs.append(1)
else:
signs.append(-1)
t = []
for xyz in XYZs:
x, y, z = xyz
... | false | 17.647059 | [
"-XYZs = [list(map(int, input().split())) for _ in range(N)]",
"+XYZs = [tuple(map(int, input().split())) for _ in range(N)]",
"-for op in range(1 << 3):",
"- lst = []",
"+for i in range(1 << 3):",
"+ signs = []",
"+ for j in range(3):",
"+ if i >> j & 1:",
"+ signs.append... | false | 0.040014 | 0.04039 | 0.990698 | [
"s124711901",
"s178672976"
] |
u345966487 | p02918 | python | s189976751 | s239228944 | 36 | 29 | 3,956 | 3,188 | Accepted | Accepted | 19.44 | N,K=list(map(int,input().split()));S=eval(input());u=[S[0]]
for c in S:c==u[-1]or u.append(c)
print((len(S)-max(len(u)-2*K,1))) | n,s=open(0);n,k=list(map(int,n.split()));print((n-max(sum(i!=j for i,j in zip(s,s[1:]))-2*k,1))) | 3 | 1 | 115 | 88 | N, K = list(map(int, input().split()))
S = eval(input())
u = [S[0]]
for c in S:
c == u[-1] or u.append(c)
print((len(S) - max(len(u) - 2 * K, 1)))
| n, s = open(0)
n, k = list(map(int, n.split()))
print((n - max(sum(i != j for i, j in zip(s, s[1:])) - 2 * k, 1)))
| false | 66.666667 | [
"-N, K = list(map(int, input().split()))",
"-S = eval(input())",
"-u = [S[0]]",
"-for c in S:",
"- c == u[-1] or u.append(c)",
"-print((len(S) - max(len(u) - 2 * K, 1)))",
"+n, s = open(0)",
"+n, k = list(map(int, n.split()))",
"+print((n - max(sum(i != j for i, j in zip(s, s[1:])) - 2 * k, 1)))"... | false | 0.071492 | 0.042629 | 1.677074 | [
"s189976751",
"s239228944"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.