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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u530383736 | p02598 | python | s642951492 | s417325001 | 1,402 | 1,061 | 32,712 | 31,924 | Accepted | Accepted | 24.32 | # -*- coding: utf-8 -*-
import sys
from decimal import Decimal, ROUND_HALF_UP
def main():
N,K = list(map(int, sys.stdin.readline().split()))
A_list = list(map(int, sys.stdin.readline().split()))
def check(length :int) -> bool:
cnt = 0
for a in A_list:
if a >= l... | # -*- coding: utf-8 -*-
import sys
import math
def main():
N,K = list(map(int, sys.stdin.readline().split()))
A_list = list(map(int, sys.stdin.readline().split()))
def check(length :int) -> bool:
cnt = 0
for a in A_list:
if a >= length:
quotien... | 39 | 40 | 800 | 828 | # -*- coding: utf-8 -*-
import sys
from decimal import Decimal, ROUND_HALF_UP
def main():
N, K = list(map(int, sys.stdin.readline().split()))
A_list = list(map(int, sys.stdin.readline().split()))
def check(length: int) -> bool:
cnt = 0
for a in A_list:
if a >= length:
... | # -*- coding: utf-8 -*-
import sys
import math
def main():
N, K = list(map(int, sys.stdin.readline().split()))
A_list = list(map(int, sys.stdin.readline().split()))
def check(length: int) -> bool:
cnt = 0
for a in A_list:
if a >= length:
quotient = a / length
... | false | 2.5 | [
"-from decimal import Decimal, ROUND_HALF_UP",
"+import math",
"- divide = -(-quotient // 1) # round up",
"+ # divide = -(-quotient // 1) # round up",
"+ divide = math.ceil(quotient) # round up"
] | false | 0.101769 | 0.049693 | 2.047976 | [
"s642951492",
"s417325001"
] |
u143278390 | p03160 | python | s464296434 | s333128642 | 218 | 188 | 13,976 | 14,052 | Accepted | Accepted | 13.76 | n=int(eval(input()))
h=[int(i) for i in input().split()]
h.append(10000)
dp=[float('inf') for i in range(n+1)]
dp[0]=0
for i in range(n-1):
dp[i+1]=min(dp[i+1],dp[i]+abs(h[i]-h[i+1]))
if(i<n-2):
dp[i+2]=min(dp[i+2],dp[i]+abs(h[i]-h[i+2]))
print((dp[n-1])) | n=int(eval(input()))
h=[int(i) for i in input().split()]
h.append(10000)
dp=[float('inf') for i in range(n+1)]
dp[0]=0
for i in range(n-1):
dp[i+1]=min(dp[i+1],dp[i]+abs(h[i]-h[i+1]))
dp[i+2]=min(dp[i+2],dp[i]+abs(h[i]-h[i+2]))
print((dp[n-1])) | 10 | 9 | 272 | 252 | n = int(eval(input()))
h = [int(i) for i in input().split()]
h.append(10000)
dp = [float("inf") for i in range(n + 1)]
dp[0] = 0
for i in range(n - 1):
dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]))
if i < n - 2:
dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]))
print((dp[n - 1]))
| n = int(eval(input()))
h = [int(i) for i in input().split()]
h.append(10000)
dp = [float("inf") for i in range(n + 1)]
dp[0] = 0
for i in range(n - 1):
dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]))
dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]))
print((dp[n - 1]))
| false | 10 | [
"- if i < n - 2:",
"- dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]))",
"+ dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]))"
] | false | 0.046905 | 0.040602 | 1.155263 | [
"s464296434",
"s333128642"
] |
u263830634 | p03295 | python | s320875865 | s386211593 | 605 | 478 | 20,556 | 29,140 | Accepted | Accepted | 20.99 | N, M = list(map(int, input().split()))
lst = []
for i in range(M):
a = list(map(int, input().split()))
lst += [a[::-1]]
lst.sort()
count = 0
position = 0
for i in range(M):
if position <= lst[i][1]:
count += 1
position = lst[i][0]
print(count) | N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(M)]
AB.sort(key = lambda x: x[0])
MAX = 10 ** 9
count = 1
min_ = MAX
for a, b in AB:
if a < min_:
min_ = min(min_, b)
else:
count += 1
min_ = b
print (count)
| 18 | 18 | 295 | 298 | N, M = list(map(int, input().split()))
lst = []
for i in range(M):
a = list(map(int, input().split()))
lst += [a[::-1]]
lst.sort()
count = 0
position = 0
for i in range(M):
if position <= lst[i][1]:
count += 1
position = lst[i][0]
print(count)
| N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(M)]
AB.sort(key=lambda x: x[0])
MAX = 10**9
count = 1
min_ = MAX
for a, b in AB:
if a < min_:
min_ = min(min_, b)
else:
count += 1
min_ = b
print(count)
| false | 0 | [
"-lst = []",
"-for i in range(M):",
"- a = list(map(int, input().split()))",
"- lst += [a[::-1]]",
"-lst.sort()",
"-count = 0",
"-position = 0",
"-for i in range(M):",
"- if position <= lst[i][1]:",
"+AB = [list(map(int, input().split())) for _ in range(M)]",
"+AB.sort(key=lambda x: x[0... | false | 0.067238 | 0.051634 | 1.302202 | [
"s320875865",
"s386211593"
] |
u375695365 | p02971 | python | s651396844 | s393945714 | 548 | 359 | 14,088 | 18,796 | Accepted | Accepted | 34.49 | a=int(eval(input()))
b=[int(eval(input())) for i in range(a)]
m=max(b)
if b.count(m)>=2:
for i in range(a):
print (m)
else:
c=b.copy()
c.sort(reverse=True)
m2=c[1]
for i in range(a):
if b[i]==m:
print(m2)
else:
print (m)
... | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
maxa = max(a)
# print(maxa)
if a.count(maxa) == 1:
b = sorted(a, reverse=True)
maxa2 = b[1]
for i in range(n):
if a[i] == maxa:
print(maxa2)
else:
print(maxa)
else:
for i in range(n... | 18 | 17 | 310 | 332 | a = int(eval(input()))
b = [int(eval(input())) for i in range(a)]
m = max(b)
if b.count(m) >= 2:
for i in range(a):
print(m)
else:
c = b.copy()
c.sort(reverse=True)
m2 = c[1]
for i in range(a):
if b[i] == m:
print(m2)
else:
print(m)
| n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
maxa = max(a)
# print(maxa)
if a.count(maxa) == 1:
b = sorted(a, reverse=True)
maxa2 = b[1]
for i in range(n):
if a[i] == maxa:
print(maxa2)
else:
print(maxa)
else:
for i in range(n):
print(... | false | 5.555556 | [
"-a = int(eval(input()))",
"-b = [int(eval(input())) for i in range(a)]",
"-m = max(b)",
"-if b.count(m) >= 2:",
"- for i in range(a):",
"- print(m)",
"+n = int(eval(input()))",
"+a = [int(eval(input())) for _ in range(n)]",
"+maxa = max(a)",
"+# print(maxa)",
"+if a.count(maxa) == 1:"... | false | 0.081339 | 0.043762 | 1.858674 | [
"s651396844",
"s393945714"
] |
u877415670 | p02642 | python | s982725409 | s490481731 | 597 | 430 | 32,248 | 32,260 | Accepted | Accepted | 27.97 | n = int(eval(input()))
a = list(map(int, input().split()))
M = max(a)
ok = [0]*(M+1)
a.sort()
for i in range(n):
ok[a[i]] += 1
for i in range(n):
if ok[a[i]] != 0:
for g in range(a[i], M+1, a[i]):
if g != a[i]:
ok[g] = 0
print((ok.count(1))) | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
MAX = a[-1]
l = [0]*(MAX+1)
for i in range(n):
l[a[i]] += 1
ans = 0
for i in range(n):
if l[a[i]] == 1:
ans += 1
for g in range(a[i], MAX+1, a[i]):
l[g] = 10
print(ans)
| 16 | 16 | 295 | 276 | n = int(eval(input()))
a = list(map(int, input().split()))
M = max(a)
ok = [0] * (M + 1)
a.sort()
for i in range(n):
ok[a[i]] += 1
for i in range(n):
if ok[a[i]] != 0:
for g in range(a[i], M + 1, a[i]):
if g != a[i]:
ok[g] = 0
print((ok.count(1)))
| n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
MAX = a[-1]
l = [0] * (MAX + 1)
for i in range(n):
l[a[i]] += 1
ans = 0
for i in range(n):
if l[a[i]] == 1:
ans += 1
for g in range(a[i], MAX + 1, a[i]):
l[g] = 10
print(ans)
| false | 0 | [
"-M = max(a)",
"-ok = [0] * (M + 1)",
"+MAX = a[-1]",
"+l = [0] * (MAX + 1)",
"- ok[a[i]] += 1",
"+ l[a[i]] += 1",
"+ans = 0",
"- if ok[a[i]] != 0:",
"- for g in range(a[i], M + 1, a[i]):",
"- if g != a[i]:",
"- ok[g] = 0",
"-print((ok.count(1)))",
"... | false | 0.068026 | 0.03783 | 1.798215 | [
"s982725409",
"s490481731"
] |
u970308980 | p03387 | python | s824319038 | s750060661 | 185 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.81 | A, B, C = list(map(int, input().split()))
M = max(A, B, C)
if M % 2 == (A + B + C) % 2:
X = M
else:
X = M + 1
ans = (3 * X - (A + B + C)) // 2
print(ans)
| ABC = list(map(int, input().split()))
sm = sum(ABC)
mx = max(ABC)
if (mx * 3) % 2 == sm % 2:
ans = (mx * 3 - sm) // 2
else:
ans = ((mx + 1) * 3 - sm) // 2
print(ans)
| 11 | 11 | 169 | 187 | A, B, C = list(map(int, input().split()))
M = max(A, B, C)
if M % 2 == (A + B + C) % 2:
X = M
else:
X = M + 1
ans = (3 * X - (A + B + C)) // 2
print(ans)
| ABC = list(map(int, input().split()))
sm = sum(ABC)
mx = max(ABC)
if (mx * 3) % 2 == sm % 2:
ans = (mx * 3 - sm) // 2
else:
ans = ((mx + 1) * 3 - sm) // 2
print(ans)
| false | 0 | [
"-A, B, C = list(map(int, input().split()))",
"-M = max(A, B, C)",
"-if M % 2 == (A + B + C) % 2:",
"- X = M",
"+ABC = list(map(int, input().split()))",
"+sm = sum(ABC)",
"+mx = max(ABC)",
"+if (mx * 3) % 2 == sm % 2:",
"+ ans = (mx * 3 - sm) // 2",
"- X = M + 1",
"-ans = (3 * X - (A + ... | false | 0.077204 | 0.039884 | 1.93574 | [
"s824319038",
"s750060661"
] |
u327532412 | p03353 | python | s994795319 | s966031509 | 1,120 | 45 | 5,564 | 7,600 | Accepted | Accepted | 95.98 | S = eval(input())
N = len(S)
K = int(eval(input()))
cnt = {i: [] for i in range(N)}
for i in range(N):
for j in range(N - i):
s = S[j:j+i+1]
l = len(s)
if s not in cnt[l-1]:
cnt[l-1].append(s)
if i > K:
break
ttl = []
for k, v in list(cnt.items()):
t... | S = eval(input())
N = len(S)
K = int(eval(input()))
ttl = []
for i in range(N):
for j in range(N - i):
ttl.append(S[j:j+i+1])
if i > K:
break
ttl = sorted(list(set(ttl)))
print((ttl[K-1])) | 17 | 11 | 343 | 208 | S = eval(input())
N = len(S)
K = int(eval(input()))
cnt = {i: [] for i in range(N)}
for i in range(N):
for j in range(N - i):
s = S[j : j + i + 1]
l = len(s)
if s not in cnt[l - 1]:
cnt[l - 1].append(s)
if i > K:
break
ttl = []
for k, v in list(cnt.items()):
ttl.e... | S = eval(input())
N = len(S)
K = int(eval(input()))
ttl = []
for i in range(N):
for j in range(N - i):
ttl.append(S[j : j + i + 1])
if i > K:
break
ttl = sorted(list(set(ttl)))
print((ttl[K - 1]))
| false | 35.294118 | [
"-cnt = {i: [] for i in range(N)}",
"+ttl = []",
"- s = S[j : j + i + 1]",
"- l = len(s)",
"- if s not in cnt[l - 1]:",
"- cnt[l - 1].append(s)",
"+ ttl.append(S[j : j + i + 1])",
"-ttl = []",
"-for k, v in list(cnt.items()):",
"- ttl.extend(v)",
"-ttl.s... | false | 0.121805 | 0.034681 | 3.512144 | [
"s994795319",
"s966031509"
] |
u608088992 | p03274 | python | s554402981 | s320206932 | 283 | 77 | 23,072 | 14,940 | Accepted | Accepted | 72.79 | import numpy as np
N, K =list(map(int, input().split()))
X = [int(_) for _ in input().split()]
X2 = np.zeros((N,))
X2 += X
minus = X2[X2 < 0] * (-1)
minus.sort()
plus = X2[X2 >= 0]
lenM, lenP = len(minus), len(plus)
def length(i, j):
if i == 0:
return plus[j-1]
if j == 0:
return ... | import sys
def solve():
input = sys.stdin.readline
N, K = list(map(int, input().split()))
X = [int(x) for x in input().split()]
left = [0]
right = [0]
for x in X:
if x < 0: left.append(-x)
else: right.append(x)
left.sort()
lenl = len(left)
lenr = len(rig... | 26 | 26 | 603 | 597 | import numpy as np
N, K = list(map(int, input().split()))
X = [int(_) for _ in input().split()]
X2 = np.zeros((N,))
X2 += X
minus = X2[X2 < 0] * (-1)
minus.sort()
plus = X2[X2 >= 0]
lenM, lenP = len(minus), len(plus)
def length(i, j):
if i == 0:
return plus[j - 1]
if j == 0:
return minus[i - ... | import sys
def solve():
input = sys.stdin.readline
N, K = list(map(int, input().split()))
X = [int(x) for x in input().split()]
left = [0]
right = [0]
for x in X:
if x < 0:
left.append(-x)
else:
right.append(x)
left.sort()
lenl = len(left)
le... | false | 0 | [
"-import numpy as np",
"-",
"-N, K = list(map(int, input().split()))",
"-X = [int(_) for _ in input().split()]",
"-X2 = np.zeros((N,))",
"-X2 += X",
"-minus = X2[X2 < 0] * (-1)",
"-minus.sort()",
"-plus = X2[X2 >= 0]",
"-lenM, lenP = len(minus), len(plus)",
"+import sys",
"-def length(i, j):",... | false | 0.3012 | 0.03685 | 8.173741 | [
"s554402981",
"s320206932"
] |
u562935282 | p03045 | python | s165585332 | s410725599 | 524 | 371 | 63,152 | 49,028 | Accepted | Accepted | 29.2 | import sys
input = sys.stdin.readline
class UnionFind:
def __init__(self, n):
self.v = [-1 for _ in range(n)] # 根(負): 連結頂点数 * (-1) / 子(正): 根の頂点番号(0-indexed)
def find(self, x): # xを含む木における根の頂点番号を返す
if self.v[x] < 0: # (負)は根
return x
else: # 根の頂点番号
... | def main():
from collections import deque
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
g = tuple(set() for _ in range(N))
for _ in range(M):
x, y, _ = (int(x) - 1 for x in input().split())
g[x].add(y)
g[y].add(x)
ans = 0... | 46 | 33 | 1,278 | 716 | import sys
input = sys.stdin.readline
class UnionFind:
def __init__(self, n):
self.v = [-1 for _ in range(n)] # 根(負): 連結頂点数 * (-1) / 子(正): 根の頂点番号(0-indexed)
def find(self, x): # xを含む木における根の頂点番号を返す
if self.v[x] < 0: # (負)は根
return x
else: # 根の頂点番号
self.v[x]... | def main():
from collections import deque
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
g = tuple(set() for _ in range(N))
for _ in range(M):
x, y, _ = (int(x) - 1 for x in input().split())
g[x].add(y)
g[y].add(x)
ans = 0
checked = ... | false | 28.26087 | [
"-import sys",
"+def main():",
"+ from collections import deque",
"+ import sys",
"-input = sys.stdin.readline",
"+ input = sys.stdin.readline",
"+ N, M = list(map(int, input().split()))",
"+ g = tuple(set() for _ in range(N))",
"+ for _ in range(M):",
"+ x, y, _ = (int(x)... | false | 0.041607 | 0.072775 | 0.571726 | [
"s165585332",
"s410725599"
] |
u794161347 | p03030 | python | s771366284 | s269623977 | 23 | 18 | 3,064 | 3,064 | Accepted | Accepted | 21.74 | #B
N = int(eval(input()))
S = [""] * N
P = [0] * N
P2 = [""] * N
NUM = [0] * N
for i in range(0, N):
S[i], P2[i] = list(map(str, input().split()))
P[i] = int(P2[i])
NUM[i] = i + 1
for i in range(0, N):
for j in range(1, N):
if S[j] < S[j-1]:
S[j-1], S[j] = S[j], S[j-1]
... | from operator import itemgetter
N = int(eval(input()))
S = [""] * N
P = [0] * N
P2 = [""] * N
NUM = [0] * N
lst = [""] * N
for i in range(0, N):
S[i], P2[i] = list(map(str, input().split()))
P[i] = int(P2[i])
NUM[i] = i + 1
lst[i] = (S[i], P[i], NUM[i])
sorted1 = sorted(lst, key=itemgetter(1... | 23 | 16 | 639 | 419 | # B
N = int(eval(input()))
S = [""] * N
P = [0] * N
P2 = [""] * N
NUM = [0] * N
for i in range(0, N):
S[i], P2[i] = list(map(str, input().split()))
P[i] = int(P2[i])
NUM[i] = i + 1
for i in range(0, N):
for j in range(1, N):
if S[j] < S[j - 1]:
S[j - 1], S[j] = S[j], S[j - 1]
... | from operator import itemgetter
N = int(eval(input()))
S = [""] * N
P = [0] * N
P2 = [""] * N
NUM = [0] * N
lst = [""] * N
for i in range(0, N):
S[i], P2[i] = list(map(str, input().split()))
P[i] = int(P2[i])
NUM[i] = i + 1
lst[i] = (S[i], P[i], NUM[i])
sorted1 = sorted(lst, key=itemgetter(1), reverse=... | false | 30.434783 | [
"-# B",
"+from operator import itemgetter",
"+",
"+lst = [\"\"] * N",
"+ lst[i] = (S[i], P[i], NUM[i])",
"+sorted1 = sorted(lst, key=itemgetter(1), reverse=True)",
"+sorted2 = sorted(sorted1, key=itemgetter(0))",
"- for j in range(1, N):",
"- if S[j] < S[j - 1]:",
"- S[j - ... | false | 0.059439 | 0.03629 | 1.637868 | [
"s771366284",
"s269623977"
] |
u367130284 | p03568 | python | s949006784 | s599098892 | 162 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.51 | print((3**int(eval(input()))-2**sum(~int(s)%2 for s in input().split()))) | print((3**int(eval(input()))-2**sum(int(s)%2==0for s in input().split()))) | 1 | 1 | 65 | 66 | print((3 ** int(eval(input())) - 2 ** sum(~int(s) % 2 for s in input().split())))
| print((3 ** int(eval(input())) - 2 ** sum(int(s) % 2 == 0 for s in input().split())))
| false | 0 | [
"-print((3 ** int(eval(input())) - 2 ** sum(~int(s) % 2 for s in input().split())))",
"+print((3 ** int(eval(input())) - 2 ** sum(int(s) % 2 == 0 for s in input().split())))"
] | false | 0.04204 | 0.036343 | 1.156737 | [
"s949006784",
"s599098892"
] |
u855831834 | p02691 | python | s382984201 | s180537099 | 201 | 138 | 40,404 | 120,588 | Accepted | Accepted | 31.34 | #E
N = int(eval(input()))
A = list(map(int,input().split()))
p = {}
ans = 0
for i in range(N):
if i+1-A[i] in p:
ans += p[i+1-A[i]]
if A[i] + (i+1) in p:
p[i+1+A[i]] += 1
else:
p[i+1+A[i]] = 1
#print(p)
print(ans) | n = int(eval(input()))
A = [0]+list(map(int,input().split()))
d = {}
ans = 0
for i in range(1,n+1):
if i+A[i] not in d:
d[i+A[i]] = 1
else:
d[i+A[i]] += 1
if i-A[i] in d:
ans += d[i-A[i]]
print(ans) | 16 | 15 | 264 | 253 | # E
N = int(eval(input()))
A = list(map(int, input().split()))
p = {}
ans = 0
for i in range(N):
if i + 1 - A[i] in p:
ans += p[i + 1 - A[i]]
if A[i] + (i + 1) in p:
p[i + 1 + A[i]] += 1
else:
p[i + 1 + A[i]] = 1
# print(p)
print(ans)
| n = int(eval(input()))
A = [0] + list(map(int, input().split()))
d = {}
ans = 0
for i in range(1, n + 1):
if i + A[i] not in d:
d[i + A[i]] = 1
else:
d[i + A[i]] += 1
if i - A[i] in d:
ans += d[i - A[i]]
print(ans)
| false | 6.25 | [
"-# E",
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-p = {}",
"+n = int(eval(input()))",
"+A = [0] + list(map(int, input().split()))",
"+d = {}",
"-for i in range(N):",
"- if i + 1 - A[i] in p:",
"- ans += p[i + 1 - A[i]]",
"- if A[i] + (i + 1) in p:",
"- ... | false | 0.048427 | 0.04204 | 1.151939 | [
"s382984201",
"s180537099"
] |
u600402037 | p02756 | python | s886906113 | s746719929 | 1,392 | 307 | 4,548 | 4,340 | Accepted | Accepted | 77.95 | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
S = sr()
Q = ir()
dir = 0 #最初の向きを0、逆向きを1
head_tail = ['', '']
for _ in range(Q):
x = sr().split()
if x[0] == '1':
dir = (1 - dir)
else:
t, f, c = x
... | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
S = sr()
Q = ir()
rev = 0
top = ''
tail = ''
# xor
for _ in range(Q):
x = sr().split()
if x[0] == '1':
rev ^= 1
else:
_, f, c = x
... | 27 | 29 | 561 | 495 | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
S = sr()
Q = ir()
dir = 0 # 最初の向きを0、逆向きを1
head_tail = ["", ""]
for _ in range(Q):
x = sr().split()
if x[0] == "1":
dir = 1 - dir
else:
t, f, c = x
h_d = dir
... | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
S = sr()
Q = ir()
rev = 0
top = ""
tail = ""
# xor
for _ in range(Q):
x = sr().split()
if x[0] == "1":
rev ^= 1
else:
_, f, c = x
if (int(f) ^ rev) ... | false | 6.896552 | [
"+# coding: utf-8",
"-dir = 0 # 最初の向きを0、逆向きを1",
"-head_tail = [\"\", \"\"]",
"+rev = 0",
"+top = \"\"",
"+tail = \"\"",
"+# xor",
"- dir = 1 - dir",
"+ rev ^= 1",
"- t, f, c = x",
"- h_d = dir",
"- if f == \"2\":",
"- h_d = 1 - h_d",
"- ... | false | 0.043953 | 0.036491 | 1.204476 | [
"s886906113",
"s746719929"
] |
u811733736 | p02276 | python | s175092328 | s741659742 | 100 | 70 | 18,336 | 18,152 | Accepted | Accepted | 30 | def partition(A, p, r):
x = A[r - 1]
i = p - 1
for j in range(p, r-1):
if A[j] <= x:
i += 1
temp = A[i]
A[i] = A[j]
A[j] = temp
temp = A[i+1]
A[i+1] = A[r-1]
A[r-1] = temp
return i
if __name__ == '__main__':
# ... | def partition(A, p, r):
x = A[r]
i = p - 1
for j in range(p, r):
if A[j] <= x:
i += 1
temp = A[i]
A[i] = A[j]
A[j] = temp
temp = A[i+1]
A[i+1] = A[r]
A[r] = temp
return i
if __name__ == '__main__':
# ??????????... | 31 | 31 | 716 | 708 | def partition(A, p, r):
x = A[r - 1]
i = p - 1
for j in range(p, r - 1):
if A[j] <= x:
i += 1
temp = A[i]
A[i] = A[j]
A[j] = temp
temp = A[i + 1]
A[i + 1] = A[r - 1]
A[r - 1] = temp
return i
if __name__ == "__main__":
# ??????????... | def partition(A, p, r):
x = A[r]
i = p - 1
for j in range(p, r):
if A[j] <= x:
i += 1
temp = A[i]
A[i] = A[j]
A[j] = temp
temp = A[i + 1]
A[i + 1] = A[r]
A[r] = temp
return i
if __name__ == "__main__":
# ??????????????\???
# A... | false | 0 | [
"- x = A[r - 1]",
"+ x = A[r]",
"- for j in range(p, r - 1):",
"+ for j in range(p, r):",
"- A[i + 1] = A[r - 1]",
"- A[r - 1] = temp",
"+ A[i + 1] = A[r]",
"+ A[r] = temp",
"- p = partition(A, 0, len(A))",
"+ p = partition(A, 0, len(A) - 1)"
] | false | 0.039375 | 0.040108 | 0.98173 | [
"s175092328",
"s741659742"
] |
u638456847 | p02679 | python | s524650998 | s105318732 | 618 | 409 | 72,812 | 72,596 | Accepted | Accepted | 33.82 | from math import gcd
from collections import Counter
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
MOD = 10**9+7
def main():
N,*ab = list(map(int, read().split()))
ab_zero = 0
ratio = []
for a, b in zip(*[iter(ab)]*2):
if a == 0 ... | from math import gcd
from collections import Counter
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
MOD = 10**9+7
def main():
N,*ab = list(map(int, read().split()))
ab_zero = 0
ratio = []
for a, b in zip(*[iter(ab)]*2):
if a == 0 ... | 54 | 52 | 1,256 | 1,094 | from math import gcd
from collections import Counter
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
MOD = 10**9 + 7
def main():
N, *ab = list(map(int, read().split()))
ab_zero = 0
ratio = []
for a, b in zip(*[iter(ab)] * 2):
if a == 0 and b == 0... | from math import gcd
from collections import Counter
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
MOD = 10**9 + 7
def main():
N, *ab = list(map(int, read().split()))
ab_zero = 0
ratio = []
for a, b in zip(*[iter(ab)] * 2):
if a == 0 and b == 0... | false | 3.703704 | [
"- ab_zero %= MOD",
"+ no_pair = 0",
"- if v == 0:",
"- continue",
"- if (-b, a) in s:",
"- bad *= (pow(2, v, MOD) + pow(2, s[(-b, a)], MOD) - 1) % MOD",
"- bad %= MOD",
"- s[(-b, a)] = 0",
"- elif (b, -a) in s:",
"- ... | false | 0.046135 | 0.045886 | 1.005423 | [
"s524650998",
"s105318732"
] |
u888092736 | p02923 | python | s688929216 | s284310923 | 88 | 78 | 14,224 | 14,224 | Accepted | Accepted | 11.36 | n = int(eval(input()))
H = list(map(int, input().split()))
ans = 0
curr = 0
for i in range(1, n):
if H[i] <= H[i - 1]:
curr += 1
else:
curr = 0
ans = max(ans, curr)
print(ans)
| n = int(eval(input()))
H = list(map(int, input().split()))
ans = 0
curr = 0
for i in range(1, n):
if H[i] <= H[i - 1]:
curr += 1
else:
ans = max(ans, curr)
curr = 0
ans = max(ans, curr)
print(ans)
| 12 | 13 | 210 | 236 | n = int(eval(input()))
H = list(map(int, input().split()))
ans = 0
curr = 0
for i in range(1, n):
if H[i] <= H[i - 1]:
curr += 1
else:
curr = 0
ans = max(ans, curr)
print(ans)
| n = int(eval(input()))
H = list(map(int, input().split()))
ans = 0
curr = 0
for i in range(1, n):
if H[i] <= H[i - 1]:
curr += 1
else:
ans = max(ans, curr)
curr = 0
ans = max(ans, curr)
print(ans)
| false | 7.692308 | [
"+ ans = max(ans, curr)",
"- ans = max(ans, curr)",
"+ans = max(ans, curr)"
] | false | 0.051467 | 0.037002 | 1.390927 | [
"s688929216",
"s284310923"
] |
u562935282 | p02901 | python | s008955681 | s270688672 | 294 | 207 | 46,296 | 42,844 | Accepted | Accepted | 29.59 | inf = 10 ** 8 + 10
n, m = list(map(int, input().split()))
keys = set()
for i in range(m):
price, _ = list(map(int, input().split()))
key = 0
for ind in (int(x) - 1 for x in input().split()):
key += (1 << ind)
keys.add((price, key))
dp = [inf] * (1 << n)
dp[0] = 0
for price, ... | def main():
import sys
input = sys.stdin.readline
inf = 10 ** 8 + 10
n, m = list(map(int, input().split()))
size = (1 << n)
dp = [inf] * size
dp[0] = 0
for _ in range(m):
price, _ = list(map(int, input().split()))
key = sum(1 << ind for ind in (int(x... | 22 | 26 | 485 | 551 | inf = 10**8 + 10
n, m = list(map(int, input().split()))
keys = set()
for i in range(m):
price, _ = list(map(int, input().split()))
key = 0
for ind in (int(x) - 1 for x in input().split()):
key += 1 << ind
keys.add((price, key))
dp = [inf] * (1 << n)
dp[0] = 0
for price, key in sorted(keys):
... | def main():
import sys
input = sys.stdin.readline
inf = 10**8 + 10
n, m = list(map(int, input().split()))
size = 1 << n
dp = [inf] * size
dp[0] = 0
for _ in range(m):
price, _ = list(map(int, input().split()))
key = sum(1 << ind for ind in (int(x) - 1 for x in input().sp... | false | 15.384615 | [
"-inf = 10**8 + 10",
"-n, m = list(map(int, input().split()))",
"-keys = set()",
"-for i in range(m):",
"- price, _ = list(map(int, input().split()))",
"- key = 0",
"- for ind in (int(x) - 1 for x in input().split()):",
"- key += 1 << ind",
"- keys.add((price, key))",
"-dp = [in... | false | 0.037024 | 0.036793 | 1.006277 | [
"s008955681",
"s270688672"
] |
u726615467 | p03147 | python | s915854971 | s942383442 | 21 | 18 | 3,060 | 3,064 | Accepted | Accepted | 14.29 | N = int(eval(input()))
h = list(map(int, input().split()))
ans = 0
for h_ref in range(1, 101):
prev = 0
for i, hi in enumerate(h):
curr = int(hi >= h_ref)
if curr > prev: ans += 1
prev = curr
print(ans) | N = int(eval(input()))
h = list(map(int, input().split()))
h += [0]
prev = 0
imos = [None] * (N + 1)
for i in range(N + 1):
imos[i] = h[i] - prev
prev = h[i]
# print("#", h)
# print("#", imos)
ans = sum([int(item > 0) * item for item in imos])
print(ans) | 12 | 14 | 241 | 275 | N = int(eval(input()))
h = list(map(int, input().split()))
ans = 0
for h_ref in range(1, 101):
prev = 0
for i, hi in enumerate(h):
curr = int(hi >= h_ref)
if curr > prev:
ans += 1
prev = curr
print(ans)
| N = int(eval(input()))
h = list(map(int, input().split()))
h += [0]
prev = 0
imos = [None] * (N + 1)
for i in range(N + 1):
imos[i] = h[i] - prev
prev = h[i]
# print("#", h)
# print("#", imos)
ans = sum([int(item > 0) * item for item in imos])
print(ans)
| false | 14.285714 | [
"-ans = 0",
"-for h_ref in range(1, 101):",
"- prev = 0",
"- for i, hi in enumerate(h):",
"- curr = int(hi >= h_ref)",
"- if curr > prev:",
"- ans += 1",
"- prev = curr",
"+h += [0]",
"+prev = 0",
"+imos = [None] * (N + 1)",
"+for i in range(N + 1):",
"+... | false | 0.117356 | 0.087798 | 1.33665 | [
"s915854971",
"s942383442"
] |
u325282913 | p02735 | python | s507096191 | s113807170 | 211 | 91 | 41,456 | 74,104 | Accepted | Accepted | 56.87 | H, W = list(map(int, input().split()))
grid = [eval(input()) for _ in range(H)]
dp = [[float('inf')] * W for i in range(H)]
dp[0][0] = 1 if grid[0][0] == '#' else 0
for i in range(H):
for j in range(W):
for y, x in ((1,0), (0,1)):
ni, nj = i + y, j + x
if ni >= H or nj >= W... | H, W = list(map(int,input().split()))
grid = [eval(input()) for _ in range(H)]
dp = [[float('inf')]*(W) for _ in range(H)]
dp[0][0] = 0 if grid[0][0] == '.' else 1
for i in range(H):
for k in range(W):
if i+1 < H:
if grid[i][k] == '.' and grid[i+1][k] == '#':
dp[i+1][k] =... | 17 | 17 | 515 | 639 | H, W = list(map(int, input().split()))
grid = [eval(input()) for _ in range(H)]
dp = [[float("inf")] * W for i in range(H)]
dp[0][0] = 1 if grid[0][0] == "#" else 0
for i in range(H):
for j in range(W):
for y, x in ((1, 0), (0, 1)):
ni, nj = i + y, j + x
if ni >= H or nj >= W:
... | H, W = list(map(int, input().split()))
grid = [eval(input()) for _ in range(H)]
dp = [[float("inf")] * (W) for _ in range(H)]
dp[0][0] = 0 if grid[0][0] == "." else 1
for i in range(H):
for k in range(W):
if i + 1 < H:
if grid[i][k] == "." and grid[i + 1][k] == "#":
dp[i + 1][k] ... | false | 0 | [
"-dp = [[float(\"inf\")] * W for i in range(H)]",
"-dp[0][0] = 1 if grid[0][0] == \"#\" else 0",
"+dp = [[float(\"inf\")] * (W) for _ in range(H)]",
"+dp[0][0] = 0 if grid[0][0] == \".\" else 1",
"- for j in range(W):",
"- for y, x in ((1, 0), (0, 1)):",
"- ni, nj = i + y, j + x",
... | false | 0.061064 | 0.034243 | 1.783276 | [
"s507096191",
"s113807170"
] |
u060793972 | p02911 | python | s696972893 | s231149659 | 277 | 221 | 6,576 | 5,032 | Accepted | Accepted | 20.22 | n,k,q=list(map(int,input().split()))
l=[k for i in range(n)]
for i in range(q):
l[int(eval(input()))-1]+=1
for i in range(n):
print(('Yes' if l[i]-q>0 else 'No')) | n,k,q=list(map(int,input().split()))
l=[0 for i in range(n)]
for i in range(q):
l[int(eval(input()))-1]+=1
print(('\n'.join('Yes' if l[i]-q+k>0 else 'No' for i in range(n)))) | 6 | 5 | 161 | 168 | n, k, q = list(map(int, input().split()))
l = [k for i in range(n)]
for i in range(q):
l[int(eval(input())) - 1] += 1
for i in range(n):
print(("Yes" if l[i] - q > 0 else "No"))
| n, k, q = list(map(int, input().split()))
l = [0 for i in range(n)]
for i in range(q):
l[int(eval(input())) - 1] += 1
print(("\n".join("Yes" if l[i] - q + k > 0 else "No" for i in range(n))))
| false | 16.666667 | [
"-l = [k for i in range(n)]",
"+l = [0 for i in range(n)]",
"-for i in range(n):",
"- print((\"Yes\" if l[i] - q > 0 else \"No\"))",
"+print((\"\\n\".join(\"Yes\" if l[i] - q + k > 0 else \"No\" for i in range(n))))"
] | false | 0.044061 | 0.088902 | 0.495606 | [
"s696972893",
"s231149659"
] |
u599114793 | p03610 | python | s490023067 | s664884695 | 38 | 20 | 4,268 | 4,264 | Accepted | Accepted | 47.37 | s = list(eval(input()))
ans = []
for i in range(len(s)):
if i % 2 == 0:
ans.append(s[i])
print(("".join(ans)))
| s = list(eval(input()))
print(("".join(s[0:len(s):2])))
| 6 | 3 | 120 | 51 | s = list(eval(input()))
ans = []
for i in range(len(s)):
if i % 2 == 0:
ans.append(s[i])
print(("".join(ans)))
| s = list(eval(input()))
print(("".join(s[0 : len(s) : 2])))
| false | 50 | [
"-ans = []",
"-for i in range(len(s)):",
"- if i % 2 == 0:",
"- ans.append(s[i])",
"-print((\"\".join(ans)))",
"+print((\"\".join(s[0 : len(s) : 2])))"
] | false | 0.042296 | 0.055757 | 0.758572 | [
"s490023067",
"s664884695"
] |
u394721319 | p02831 | python | s439427025 | s305583522 | 36 | 30 | 5,048 | 8,996 | Accepted | Accepted | 16.67 | from fractions import gcd
A,B = [int(zz) for zz in input().split()]
def lcm(a,b):
return a*b//gcd(a,b)
print((lcm(A,B)))
| from math import gcd
A,B = [int(i) for i in input().split()]
print((A*B//gcd(A,B)))
| 8 | 5 | 133 | 88 | from fractions import gcd
A, B = [int(zz) for zz in input().split()]
def lcm(a, b):
return a * b // gcd(a, b)
print((lcm(A, B)))
| from math import gcd
A, B = [int(i) for i in input().split()]
print((A * B // gcd(A, B)))
| false | 37.5 | [
"-from fractions import gcd",
"+from math import gcd",
"-A, B = [int(zz) for zz in input().split()]",
"-",
"-",
"-def lcm(a, b):",
"- return a * b // gcd(a, b)",
"-",
"-",
"-print((lcm(A, B)))",
"+A, B = [int(i) for i in input().split()]",
"+print((A * B // gcd(A, B)))"
] | false | 0.040676 | 0.035688 | 1.139751 | [
"s439427025",
"s305583522"
] |
u033602950 | p02678 | python | s134757795 | s984622490 | 463 | 275 | 104,592 | 105,296 | Accepted | Accepted | 40.6 | import sys
#import time
#import copy
from collections import deque, Counter, defaultdict
#from fractions import gcd
#import bisect
#import itertools
#input = sys.stdin.readline
sys.setrecursionlimit(10**6)
def ri():
return list(map(int, input().split()))
def rs():
return list(input().strip())
... | import sys
#import time
#import copy
from collections import deque, Counter, defaultdict
#from fractions import gcd
#import bisect
#import itertools
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
def ri():
return list(map(int, input().split()))
def rs():
return list(input().strip())
n... | 58 | 56 | 1,132 | 1,077 | import sys
# import time
# import copy
from collections import deque, Counter, defaultdict
# from fractions import gcd
# import bisect
# import itertools
# input = sys.stdin.readline
sys.setrecursionlimit(10**6)
def ri():
return list(map(int, input().split()))
def rs():
return list(input().strip())
n, m... | import sys
# import time
# import copy
from collections import deque, Counter, defaultdict
# from fractions import gcd
# import bisect
# import itertools
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
def ri():
return list(map(int, input().split()))
def rs():
return list(input().strip())
n, m =... | false | 3.448276 | [
"-# input = sys.stdin.readline",
"+input = sys.stdin.readline",
"+ visited[now] = 1",
"- visited[now] = 1",
"- continue",
"- if e == now:"
] | false | 0.0428 | 0.059939 | 0.714062 | [
"s134757795",
"s984622490"
] |
u731235119 | p00706 | python | s516586507 | s494227261 | 1,780 | 90 | 4,372 | 4,396 | Accepted | Accepted | 94.94 | while 1:
n = int(input())
if n == 0:
break
w,h = list(map(int,input().split(" ")))
field = [[0 for i in range(0,w+1)] for j in range(0,h+1)]
for i in range(n):
x,y = list(map(int,input().split(" ")))
field[y][x] = 1
s,t = list(map(int,input().split(" ")))
tree_max = 0
for i in range(1,w-s+2):
... | while 1:
n = int(input())
if n == 0:
break
w,h = list(map(int,input().split(" ")))
tree_loc = [list(map(int,input().split(" "))) for i in range(n)]
s,t = list(map(int,input().split(" ")))
get_field = [[0 for i in range(0,w-s+2)] for j in range(0,h-t+2)]
for x,y in tree_loc:
get_field[max(y-t+1,1)][... | 20 | 26 | 502 | 818 | while 1:
n = int(input())
if n == 0:
break
w, h = list(map(int, input().split(" ")))
field = [[0 for i in range(0, w + 1)] for j in range(0, h + 1)]
for i in range(n):
x, y = list(map(int, input().split(" ")))
field[y][x] = 1
s, t = list(map(int, input().split(" ")))
... | while 1:
n = int(input())
if n == 0:
break
w, h = list(map(int, input().split(" ")))
tree_loc = [list(map(int, input().split(" "))) for i in range(n)]
s, t = list(map(int, input().split(" ")))
get_field = [[0 for i in range(0, w - s + 2)] for j in range(0, h - t + 2)]
for x, y in tre... | false | 23.076923 | [
"- field = [[0 for i in range(0, w + 1)] for j in range(0, h + 1)]",
"- for i in range(n):",
"- x, y = list(map(int, input().split(\" \")))",
"- field[y][x] = 1",
"+ tree_loc = [list(map(int, input().split(\" \"))) for i in range(n)]",
"- tree_max = 0",
"- for i in range(1, ... | false | 0.076533 | 0.036361 | 2.104829 | [
"s516586507",
"s494227261"
] |
u863442865 | p02787 | python | s575555810 | s170002573 | 841 | 427 | 43,676 | 42,460 | Accepted | Accepted | 49.23 | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
fr... | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
fr... | 30 | 31 | 890 | 865 | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
# from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left, bisect_right
from h... | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
# from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left, bisect_right
from h... | false | 3.225806 | [
"- dp = [inf] * (3 * (10**4))",
"+ dp = [inf] * (h + 1)",
"- for i in range(3 * (10**4)):",
"+ for i in range(h + 1):",
"- if i - a >= 0:",
"- dp[i] = min(dp[i], dp[i - a] + b)",
"- res = inf",
"- for i in range(h, 3 * (10**4)):",
"- res = min(res, ... | false | 0.406533 | 0.093317 | 4.356477 | [
"s575555810",
"s170002573"
] |
u023127434 | p03369 | python | s010193019 | s343303714 | 27 | 24 | 9,088 | 9,072 | Accepted | Accepted | 11.11 | s = eval(input())
ex = s.count("o")
print((700 + 100 * ex)) | s = eval(input())
ex = int(s.count("o"))
print((700 + 100 * ex)) | 3 | 3 | 53 | 58 | s = eval(input())
ex = s.count("o")
print((700 + 100 * ex))
| s = eval(input())
ex = int(s.count("o"))
print((700 + 100 * ex))
| false | 0 | [
"-ex = s.count(\"o\")",
"+ex = int(s.count(\"o\"))"
] | false | 0.085712 | 0.085453 | 1.003033 | [
"s010193019",
"s343303714"
] |
u947327691 | p02689 | python | s975016630 | s797425922 | 283 | 247 | 20,012 | 20,036 | Accepted | Accepted | 12.72 | n,m=list(map(int,input().split()))
l=list(map(int,input().split()))
tmp=[0]*n
for i in range(m):
a,b=list(map(int,input().split()))
if l[a-1] > l[b-1]:
tmp[b-1]=-1
if l[a-1] < l[b-1]:
tmp[a-1]=-1
if l[a-1] == l[b-1]:
tmp[b-1]=-1
tmp[a-1]=-1
print((tmp.coun... | n,m=list(map(int,input().split()))
l=list(map(int,input().split()))
tmp=[0]*n
for i in range(m):
a,b=list(map(int,input().split()))
if l[a-1] > l[b-1]:
tmp[b-1]=-1
elif l[a-1] == l[b-1]:
tmp[a-1]=-1
tmp[b-1]=-1
else:
tmp[a-1]=-1
print((tmp.count(0)))
... | 15 | 18 | 312 | 307 | n, m = list(map(int, input().split()))
l = list(map(int, input().split()))
tmp = [0] * n
for i in range(m):
a, b = list(map(int, input().split()))
if l[a - 1] > l[b - 1]:
tmp[b - 1] = -1
if l[a - 1] < l[b - 1]:
tmp[a - 1] = -1
if l[a - 1] == l[b - 1]:
tmp[b - 1] = -1
tmp[... | n, m = list(map(int, input().split()))
l = list(map(int, input().split()))
tmp = [0] * n
for i in range(m):
a, b = list(map(int, input().split()))
if l[a - 1] > l[b - 1]:
tmp[b - 1] = -1
elif l[a - 1] == l[b - 1]:
tmp[a - 1] = -1
tmp[b - 1] = -1
else:
tmp[a - 1] = -1
prin... | false | 16.666667 | [
"- if l[a - 1] < l[b - 1]:",
"+ elif l[a - 1] == l[b - 1]:",
"- if l[a - 1] == l[b - 1]:",
"+ else:"
] | false | 0.068725 | 0.057176 | 1.201988 | [
"s975016630",
"s797425922"
] |
u186838327 | p04030 | python | s085530070 | s150653651 | 170 | 71 | 38,384 | 61,816 | Accepted | Accepted | 58.24 | s = str(eval(input()))
l = []
for i in range(len(s)):
if s[i] == '0':
l.append('0')
elif s[i] == '1':
l.append('1')
else:
if l:
l.pop()
print((''.join(l)))
| s = str(eval(input()))
ans = []
for i in range(len(s)):
if s[i] == '0':
ans.append('0')
elif s[i] == '1':
ans.append('1')
else:
if ans:
ans.pop()
print((''.join(ans)))
| 11 | 11 | 206 | 218 | s = str(eval(input()))
l = []
for i in range(len(s)):
if s[i] == "0":
l.append("0")
elif s[i] == "1":
l.append("1")
else:
if l:
l.pop()
print(("".join(l)))
| s = str(eval(input()))
ans = []
for i in range(len(s)):
if s[i] == "0":
ans.append("0")
elif s[i] == "1":
ans.append("1")
else:
if ans:
ans.pop()
print(("".join(ans)))
| false | 0 | [
"-l = []",
"+ans = []",
"- l.append(\"0\")",
"+ ans.append(\"0\")",
"- l.append(\"1\")",
"+ ans.append(\"1\")",
"- if l:",
"- l.pop()",
"-print((\"\".join(l)))",
"+ if ans:",
"+ ans.pop()",
"+print((\"\".join(ans)))"
] | false | 0.058769 | 0.057636 | 1.019668 | [
"s085530070",
"s150653651"
] |
u113971909 | p02983 | python | s524908004 | s750090114 | 1,094 | 938 | 148,260 | 148,408 | Accepted | Accepted | 14.26 | L,R=list(map(int, input().split()))
LR = list(range(L,R+1))
from itertools import permutations, combinations,combinations_with_replacement,product
if (R+1-L)<2019:
C = combinations(LR, 2)
Ret = 2019
for i in list(C):
Ret = min(Ret,(i[0]*i[1])%2019)
else:
Ret = 0
print(Ret) | L,R=list(map(int, input().split()))
from itertools import permutations, combinations,combinations_with_replacement,product
if (R+1-L)<2019:
LR = list(range(L,R+1))
LRA = []
for i in LR:
LRA.append(i%2019)
LRAA = set(LRA)
C = combinations(LRAA, 2)
Ret = 2019
for i in list(C):
Ret = min(R... | 11 | 15 | 283 | 359 | L, R = list(map(int, input().split()))
LR = list(range(L, R + 1))
from itertools import permutations, combinations, combinations_with_replacement, product
if (R + 1 - L) < 2019:
C = combinations(LR, 2)
Ret = 2019
for i in list(C):
Ret = min(Ret, (i[0] * i[1]) % 2019)
else:
Ret = 0
print(Ret)
| L, R = list(map(int, input().split()))
from itertools import permutations, combinations, combinations_with_replacement, product
if (R + 1 - L) < 2019:
LR = list(range(L, R + 1))
LRA = []
for i in LR:
LRA.append(i % 2019)
LRAA = set(LRA)
C = combinations(LRAA, 2)
Ret = 2019
for i in ... | false | 26.666667 | [
"-LR = list(range(L, R + 1))",
"- C = combinations(LR, 2)",
"+ LR = list(range(L, R + 1))",
"+ LRA = []",
"+ for i in LR:",
"+ LRA.append(i % 2019)",
"+ LRAA = set(LRA)",
"+ C = combinations(LRAA, 2)"
] | false | 0.054194 | 0.136056 | 0.39832 | [
"s524908004",
"s750090114"
] |
u827202523 | p03241 | python | s599823865 | s517991588 | 275 | 173 | 64,364 | 38,772 | Accepted | Accepted | 37.09 | import sys
# input = sys.stdin.buffer.readline
def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getlist():
return list(map(int, input().split()))
import math
import heapq
import fractions
from collections import defaultdict, Counter, deque
MOD = 10**9... | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
from collections import defaultdict, deque
from sys import exit
import math
import copy
from bisect import bisect_left, bisect_right
import heapq
impo... | 63 | 49 | 1,162 | 1,038 | import sys
# input = sys.stdin.buffer.readline
def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getlist():
return list(map(int, input().split()))
import math
import heapq
import fractions
from collections import defaultdict, Counter, deque
MOD = 10**9 + 7... | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
from collections import defaultdict, deque
from sys import exit
import math
import copy
from bisect import bisect_left, bisect_right
import heapq
import sys
... | false | 22.222222 | [
"-import sys",
"-",
"-# input = sys.stdin.buffer.readline",
"-def getlist():",
"+def getList():",
"+from collections import defaultdict, deque",
"+from sys import exit",
"+import copy",
"+from bisect import bisect_left, bisect_right",
"-import fractions",
"-from collections import defaultdict, C... | false | 0.066576 | 0.042098 | 1.581438 | [
"s599823865",
"s517991588"
] |
u600402037 | p02971 | python | s358716453 | s151900644 | 838 | 418 | 29,104 | 50,852 | Accepted | Accepted | 50.12 | import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
A = np.zeros(N+2, np.int32)
A[1:-1] = np.array([ir() for _ in range(N)])
left_max = np.maximum.accumulate(A[:-2])
right_max = np.maximum.accumulate(A[::-1])[:... | import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
A = np.zeros(N+2, np.int32)
A[1:-1] = np.array([ir() for _ in range(N)])
left_max = np.maximum.accumulate(A[:-2])
right_max = np.maximum.accumulate(A[::-1])[:... | 15 | 15 | 407 | 409 | import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
A = np.zeros(N + 2, np.int32)
A[1:-1] = np.array([ir() for _ in range(N)])
left_max = np.maximum.accumulate(A[:-2])
right_max = np.maximum.accumulate(A[::-1])[::-1][2:]
ans... | import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
A = np.zeros(N + 2, np.int32)
A[1:-1] = np.array([ir() for _ in range(N)])
left_max = np.maximum.accumulate(A[:-2])
right_max = np.maximum.accumulate(A[::-1])[::-1][2:]
ans... | false | 0 | [
"-print((\"\\n\".join(map(str, answer))))",
"+print((\"\\n\".join(answer.astype(str))))"
] | false | 0.287504 | 0.49001 | 0.586732 | [
"s358716453",
"s151900644"
] |
u733814820 | p03103 | python | s559286873 | s196952748 | 517 | 467 | 27,756 | 20,072 | Accepted | Accepted | 9.67 | # ABC 121 C
N, M = list(map(int, input().split()))
arr = []
for i in range(N):
arr.append(list(map(int, input().split())))
arr.sort()
sum = 0
for i in range(N):
if arr[i][1] < M:
sum += arr[i][0] * arr[i][1]
M -= arr[i][1]
else:
sum += arr[i][0] * M
b... | def resolve():
n, m = list(map(int, input().split()))
l = []
for i in range(n):
a, b = list(map(int, input().split()))
l.append([a, b])
l.sort()
ans = 0
for ab in l:
if ab[1] < m:
m -= ab[1]
ans += ab[0] * ab[1]
else:
ans += ab[0] * m
m = 0
break
... | 22 | 21 | 333 | 375 | # ABC 121 C
N, M = list(map(int, input().split()))
arr = []
for i in range(N):
arr.append(list(map(int, input().split())))
arr.sort()
sum = 0
for i in range(N):
if arr[i][1] < M:
sum += arr[i][0] * arr[i][1]
M -= arr[i][1]
else:
sum += arr[i][0] * M
break
print(sum)
| def resolve():
n, m = list(map(int, input().split()))
l = []
for i in range(n):
a, b = list(map(int, input().split()))
l.append([a, b])
l.sort()
ans = 0
for ab in l:
if ab[1] < m:
m -= ab[1]
ans += ab[0] * ab[1]
else:
ans += ab[... | false | 4.545455 | [
"-# ABC 121 C",
"-N, M = list(map(int, input().split()))",
"-arr = []",
"-for i in range(N):",
"- arr.append(list(map(int, input().split())))",
"-arr.sort()",
"-sum = 0",
"-for i in range(N):",
"- if arr[i][1] < M:",
"- sum += arr[i][0] * arr[i][1]",
"- M -= arr[i][1]",
"- ... | false | 0.03617 | 0.040555 | 0.891871 | [
"s559286873",
"s196952748"
] |
u017415492 | p03681 | python | s721181572 | s085979982 | 204 | 68 | 83,316 | 3,064 | Accepted | Accepted | 66.67 | n,m=list(map(int,input().split()))
mod=10**9+7
import sys
sys.setrecursionlimit(100002)
def kaijou(x):
if x==1:
return 1
else:
return ((x%mod)*kaijou(x-1))%mod
if abs(m-n)==1:
n2=kaijou(n)
m2=kaijou(m)
print(((n2*m2)%mod))
elif abs(m-n)==0:
n2=kaijou(n)
m2=kaijou(m)
print((2*(n... | n,m=list(map(int,input().split()))
mod=10**9+7
nkai=1
mkai=1
for i in range(1,n+1):
nkai*=(i%mod)
nkai=(nkai%mod)
for i in range(1,m+1):
mkai*=(i%mod)
mkai=(mkai%mod)
if abs(n-m)>=2:
print((0))
elif abs(n-m)==1:
print(((mkai*nkai)%mod))
elif abs(n-m)==0:
print(((mkai*nkai*2)%mod)) | 20 | 16 | 340 | 298 | n, m = list(map(int, input().split()))
mod = 10**9 + 7
import sys
sys.setrecursionlimit(100002)
def kaijou(x):
if x == 1:
return 1
else:
return ((x % mod) * kaijou(x - 1)) % mod
if abs(m - n) == 1:
n2 = kaijou(n)
m2 = kaijou(m)
print(((n2 * m2) % mod))
elif abs(m - n) == 0:
... | n, m = list(map(int, input().split()))
mod = 10**9 + 7
nkai = 1
mkai = 1
for i in range(1, n + 1):
nkai *= i % mod
nkai = nkai % mod
for i in range(1, m + 1):
mkai *= i % mod
mkai = mkai % mod
if abs(n - m) >= 2:
print((0))
elif abs(n - m) == 1:
print(((mkai * nkai) % mod))
elif abs(n - m) == 0:... | false | 20 | [
"-import sys",
"-",
"-sys.setrecursionlimit(100002)",
"-",
"-",
"-def kaijou(x):",
"- if x == 1:",
"- return 1",
"- else:",
"- return ((x % mod) * kaijou(x - 1)) % mod",
"-",
"-",
"-if abs(m - n) == 1:",
"- n2 = kaijou(n)",
"- m2 = kaijou(m)",
"- print(((n2... | false | 0.041468 | 0.037907 | 1.093955 | [
"s721181572",
"s085979982"
] |
u119148115 | p02714 | python | s954702232 | s228502340 | 1,112 | 232 | 9,220 | 74,136 | Accepted | Accepted | 79.14 | N = int(eval(input()))
S = list(eval(input()))
r = 0
g = 0
b = 0
for i in range(N):
if S[i] == 'R':
r += 1
elif S[i] == 'G':
g += 1
else:
b += 1
ans = r*g*b
for i in range(1,N-1):
for j in range(1,min(i,N-i-1)+1):
if S[i] != S[i-j] and S[i] != S[i+j] and S[i-j] != S[i+j]:
... | import sys
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし
def ... | 22 | 56 | 341 | 1,695 | N = int(eval(input()))
S = list(eval(input()))
r = 0
g = 0
b = 0
for i in range(N):
if S[i] == "R":
r += 1
elif S[i] == "G":
g += 1
else:
b += 1
ans = r * g * b
for i in range(1, N - 1):
for j in range(1, min(i, N - i - 1) + 1):
if S[i] != S[i - j] and S[i] != S[i + j] an... | import sys
sys.setrecursionlimit(10**7)
def I():
return int(sys.stdin.readline().rstrip())
def MI():
return list(map(int, sys.stdin.readline().rstrip().split()))
def LI():
return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり
def LI2():
return list(map(int, sys.stdin.readline().r... | false | 60.714286 | [
"-N = int(eval(input()))",
"-S = list(eval(input()))",
"-r = 0",
"-g = 0",
"-b = 0",
"-for i in range(N):",
"+import sys",
"+",
"+sys.setrecursionlimit(10**7)",
"+",
"+",
"+def I():",
"+ return int(sys.stdin.readline().rstrip())",
"+",
"+",
"+def MI():",
"+ return list(map(int,... | false | 0.076661 | 0.043119 | 1.77791 | [
"s954702232",
"s228502340"
] |
u185896732 | p03037 | python | s132576205 | s500365569 | 568 | 334 | 43,780 | 6,900 | Accepted | Accepted | 41.2 | n,m=list(map(int,input().split()))
maxl,minr=0,n
for i in range(m):
l,r=list(map(int,input().split()))
maxl=max(maxl,l)
minr=min(minr,r)
print((max(0,minr-maxl+1))) | n,m=list(map(int,input().split()))
card=[0]*(n+1)
for _ in range(m):
l,r=list(map(int,input().split()))
card[l-1]+=1
card[r]-=1
for i in range(1,n+1):
card[i]+=card[i-1]
print((card.count(m))) | 7 | 9 | 168 | 202 | n, m = list(map(int, input().split()))
maxl, minr = 0, n
for i in range(m):
l, r = list(map(int, input().split()))
maxl = max(maxl, l)
minr = min(minr, r)
print((max(0, minr - maxl + 1)))
| n, m = list(map(int, input().split()))
card = [0] * (n + 1)
for _ in range(m):
l, r = list(map(int, input().split()))
card[l - 1] += 1
card[r] -= 1
for i in range(1, n + 1):
card[i] += card[i - 1]
print((card.count(m)))
| false | 22.222222 | [
"-maxl, minr = 0, n",
"-for i in range(m):",
"+card = [0] * (n + 1)",
"+for _ in range(m):",
"- maxl = max(maxl, l)",
"- minr = min(minr, r)",
"-print((max(0, minr - maxl + 1)))",
"+ card[l - 1] += 1",
"+ card[r] -= 1",
"+for i in range(1, n + 1):",
"+ card[i] += card[i - 1]",
"... | false | 0.042416 | 0.111111 | 0.381747 | [
"s132576205",
"s500365569"
] |
u562935282 | p02949 | python | s757746048 | s990764707 | 1,793 | 1,302 | 46,852 | 49,628 | Accepted | Accepted | 27.38 | def Bellman_Ford(s, g, inf=1 << 60):
# https://tjkendev.github.io/procon-library/python/graph/bellman-ford.html
N = len(g)
dist = [inf] * N
dist[s] = 0
for _ in range(N):
not_updated = True
for v in range(N):
for u, c in g[v]:
if (dist[v] == inf) ... | def main():
from collections import deque
import sys
input = sys.stdin.readline
inf = 1 << 60
N, M, P = list(map(int, input().split()))
to = tuple(set() for _ in range(N))
ot = tuple(set() for _ in range(N))
for _ in range(M):
a, b, c = list(map(int, input().split(... | 51 | 68 | 1,295 | 1,860 | def Bellman_Ford(s, g, inf=1 << 60):
# https://tjkendev.github.io/procon-library/python/graph/bellman-ford.html
N = len(g)
dist = [inf] * N
dist[s] = 0
for _ in range(N):
not_updated = True
for v in range(N):
for u, c in g[v]:
if (dist[v] == inf) or (dist[... | def main():
from collections import deque
import sys
input = sys.stdin.readline
inf = 1 << 60
N, M, P = list(map(int, input().split()))
to = tuple(set() for _ in range(N))
ot = tuple(set() for _ in range(N))
for _ in range(M):
a, b, c = list(map(int, input().split()))
a ... | false | 25 | [
"-def Bellman_Ford(s, g, inf=1 << 60):",
"- # https://tjkendev.github.io/procon-library/python/graph/bellman-ford.html",
"- N = len(g)",
"- dist = [inf] * N",
"- dist[s] = 0",
"- for _ in range(N):",
"- not_updated = True",
"- for v in range(N):",
"- for u, c ... | false | 0.03932 | 0.095566 | 0.411438 | [
"s757746048",
"s990764707"
] |
u729133443 | p03073 | python | s911709712 | s413882097 | 198 | 66 | 47,452 | 3,188 | Accepted | Accepted | 66.67 | *s,=list(map(int,eval(input())));a=0
for i in range(1,len(s)):a+=s[i]==s[i-1];s[i]=1-s[i-1]
print(a) | a=0
for i,s in enumerate(eval(input())):a+=i%2^int(s)
print((min(a,i-a+1))) | 3 | 3 | 90 | 69 | (*s,) = list(map(int, eval(input())))
a = 0
for i in range(1, len(s)):
a += s[i] == s[i - 1]
s[i] = 1 - s[i - 1]
print(a)
| a = 0
for i, s in enumerate(eval(input())):
a += i % 2 ^ int(s)
print((min(a, i - a + 1)))
| false | 0 | [
"-(*s,) = list(map(int, eval(input())))",
"-for i in range(1, len(s)):",
"- a += s[i] == s[i - 1]",
"- s[i] = 1 - s[i - 1]",
"-print(a)",
"+for i, s in enumerate(eval(input())):",
"+ a += i % 2 ^ int(s)",
"+print((min(a, i - a + 1)))"
] | false | 0.037721 | 0.087848 | 0.429389 | [
"s911709712",
"s413882097"
] |
u340781749 | p03472 | python | s283557299 | s682406987 | 473 | 347 | 59,096 | 12,084 | Accepted | Accepted | 26.64 | from math import ceil
def solve(h, aa, bb):
max_a = max(aa)
i = 0
for b in sorted(bb, reverse=True):
if b <= max_a:
break
i += 1
h -= b
if h <= 0:
return i
return i + ceil(h / max_a)
n, h = list(map(int, input().split()))
aa, b... | from math import ceil
def solve(h, aa, bb):
max_a = max(aa)
i = 0
for b in sorted(bb, reverse=True):
if b <= max_a:
break
i += 1
h -= b
if h <= 0:
return i
return i + ceil(h / max_a)
n, h = list(map(int, input().split()))
aa, b... | 20 | 24 | 397 | 446 | from math import ceil
def solve(h, aa, bb):
max_a = max(aa)
i = 0
for b in sorted(bb, reverse=True):
if b <= max_a:
break
i += 1
h -= b
if h <= 0:
return i
return i + ceil(h / max_a)
n, h = list(map(int, input().split()))
aa, bb = list(zip(*(li... | from math import ceil
def solve(h, aa, bb):
max_a = max(aa)
i = 0
for b in sorted(bb, reverse=True):
if b <= max_a:
break
i += 1
h -= b
if h <= 0:
return i
return i + ceil(h / max_a)
n, h = list(map(int, input().split()))
aa, bb = [], []
for _ ... | false | 16.666667 | [
"-aa, bb = list(zip(*(list(map(int, input().split())) for _ in range(n))))",
"+aa, bb = [], []",
"+for _ in range(n):",
"+ a, b = list(map(int, input().split()))",
"+ aa.append(a)",
"+ bb.append(b)"
] | false | 0.038092 | 0.03517 | 1.083066 | [
"s283557299",
"s682406987"
] |
u067694718 | p02779 | python | s010054813 | s607179000 | 188 | 103 | 25,168 | 25,936 | Accepted | Accepted | 45.21 | n = int(eval(input()))
a = [int(i) for i in input().split()]
a.sort()
for i in range(n-1):
if a[i] == a[i+1]:
print("NO")
exit()
print("YES") | n = int(eval(input()))
a = [int(i) for i in input().split()]
aset = set(a)
print(("YES" if len(a) == len(aset) else "NO")) | 10 | 5 | 166 | 119 | n = int(eval(input()))
a = [int(i) for i in input().split()]
a.sort()
for i in range(n - 1):
if a[i] == a[i + 1]:
print("NO")
exit()
print("YES")
| n = int(eval(input()))
a = [int(i) for i in input().split()]
aset = set(a)
print(("YES" if len(a) == len(aset) else "NO"))
| false | 50 | [
"-a.sort()",
"-for i in range(n - 1):",
"- if a[i] == a[i + 1]:",
"- print(\"NO\")",
"- exit()",
"-print(\"YES\")",
"+aset = set(a)",
"+print((\"YES\" if len(a) == len(aset) else \"NO\"))"
] | false | 0.072132 | 0.085073 | 0.847887 | [
"s010054813",
"s607179000"
] |
u608088992 | p04035 | python | s871010429 | s821157096 | 157 | 124 | 14,068 | 14,072 | Accepted | Accepted | 21.02 | N, L = list(map(int, input().split()))
A = [int(a) for a in input().split()]
CanRemain = []
CutFirst = []
for i in range(N-1):
if A[i] + A[i+1] >= L: CanRemain.append(i+1)
else: CutFirst.append(i+1)
if not CanRemain: print("Impossible")
else:
print("Possible")
for num in CutFirst:
... | import sys
def solve():
input = sys.stdin.readline
N, L = list(map(int, input().split()))
A = [int(a) for a in input().split()]
for i in range(N - 1):
if A[i] + A[i+1] >= L:
print("Possible")
for k in range(i): print((k + 1))
for k in reversed(list(... | 19 | 19 | 535 | 476 | N, L = list(map(int, input().split()))
A = [int(a) for a in input().split()]
CanRemain = []
CutFirst = []
for i in range(N - 1):
if A[i] + A[i + 1] >= L:
CanRemain.append(i + 1)
else:
CutFirst.append(i + 1)
if not CanRemain:
print("Impossible")
else:
print("Possible")
for num in CutF... | import sys
def solve():
input = sys.stdin.readline
N, L = list(map(int, input().split()))
A = [int(a) for a in input().split()]
for i in range(N - 1):
if A[i] + A[i + 1] >= L:
print("Possible")
for k in range(i):
print((k + 1))
for k in rever... | false | 0 | [
"-N, L = list(map(int, input().split()))",
"-A = [int(a) for a in input().split()]",
"-CanRemain = []",
"-CutFirst = []",
"-for i in range(N - 1):",
"- if A[i] + A[i + 1] >= L:",
"- CanRemain.append(i + 1)",
"+import sys",
"+",
"+",
"+def solve():",
"+ input = sys.stdin.readline",... | false | 0.05739 | 0.041164 | 1.39419 | [
"s871010429",
"s821157096"
] |
u753803401 | p03588 | python | s401291021 | s910432178 | 571 | 525 | 56,412 | 54,748 | Accepted | Accepted | 8.06 | def slove():
import sys
input = sys.stdin.readline
n = int(input().rstrip('\n'))
ab = [list(map(int, input().rstrip('\n').split())) for _ in range(n)]
ab.sort()
print((ab[-1][0] + ab[-1][1]))
if __name__ == '__main__':
slove()
| import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
n = int(readline())
ab = [list(map(int, readline().split())) for _ in range(n)]
ab.sort()
print(((ab[-1][0] - ab[0][0] + 1) + (ab[0][0] - 1) + (ab[-1][1])))
if __name__ == '__main__':
solve()
| 11 | 14 | 265 | 314 | def slove():
import sys
input = sys.stdin.readline
n = int(input().rstrip("\n"))
ab = [list(map(int, input().rstrip("\n").split())) for _ in range(n)]
ab.sort()
print((ab[-1][0] + ab[-1][1]))
if __name__ == "__main__":
slove()
| import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10**9 + 7
n = int(readline())
ab = [list(map(int, readline().split())) for _ in range(n)]
ab.sort()
print(((ab[-1][0] - ab[0][0] + 1) + (ab[0][0] - 1) + (ab[-1][1])))
if __name__ == "__main__":
solve()
| false | 21.428571 | [
"-def slove():",
"- import sys",
"+import sys",
"- input = sys.stdin.readline",
"- n = int(input().rstrip(\"\\n\"))",
"- ab = [list(map(int, input().rstrip(\"\\n\").split())) for _ in range(n)]",
"+",
"+def solve():",
"+ readline = sys.stdin.buffer.readline",
"+ mod = 10**9 + 7",... | false | 0.043702 | 0.055596 | 0.786061 | [
"s401291021",
"s910432178"
] |
u823044869 | p03433 | python | s772732554 | s374301915 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | N = int(eval(input()))
A = int(eval(input()))
amari = N % 500
if amari <= A:
print('Yes')
else:
print('No') | n = int(eval(input()))
a = int(eval(input()))
if n%500 <= a:
print("Yes")
else:
print("No")
| 9 | 8 | 113 | 93 | N = int(eval(input()))
A = int(eval(input()))
amari = N % 500
if amari <= A:
print("Yes")
else:
print("No")
| n = int(eval(input()))
a = int(eval(input()))
if n % 500 <= a:
print("Yes")
else:
print("No")
| false | 11.111111 | [
"-N = int(eval(input()))",
"-A = int(eval(input()))",
"-amari = N % 500",
"-if amari <= A:",
"+n = int(eval(input()))",
"+a = int(eval(input()))",
"+if n % 500 <= a:"
] | false | 0.046155 | 0.043793 | 1.05393 | [
"s772732554",
"s374301915"
] |
u077291787 | p03274 | python | s478470509 | s255491125 | 66 | 57 | 14,052 | 14,052 | Accepted | Accepted | 13.64 | # ABC107C - Candles (ARC101C)
def main():
N, K, *X = list(map(int, open(0).read().split()))
ans = float("inf")
for l, r in zip(X, X[K - 1 :]):
ans = min(ans, r - l + min(abs(l), abs(r)))
print(ans)
if __name__ == "__main__":
main() | # ABC107C - Candles (ARC101C)
def main():
N, K, *X = list(map(int, open(0).read().split()))
ans = float("inf")
for l, r in zip(X, X[K - 1 :]):
x = r - l + min(abs(l), abs(r))
ans = x if x < ans else ans
print(ans)
if __name__ == "__main__":
main() | 11 | 12 | 265 | 290 | # ABC107C - Candles (ARC101C)
def main():
N, K, *X = list(map(int, open(0).read().split()))
ans = float("inf")
for l, r in zip(X, X[K - 1 :]):
ans = min(ans, r - l + min(abs(l), abs(r)))
print(ans)
if __name__ == "__main__":
main()
| # ABC107C - Candles (ARC101C)
def main():
N, K, *X = list(map(int, open(0).read().split()))
ans = float("inf")
for l, r in zip(X, X[K - 1 :]):
x = r - l + min(abs(l), abs(r))
ans = x if x < ans else ans
print(ans)
if __name__ == "__main__":
main()
| false | 8.333333 | [
"- ans = min(ans, r - l + min(abs(l), abs(r)))",
"+ x = r - l + min(abs(l), abs(r))",
"+ ans = x if x < ans else ans"
] | false | 0.127162 | 0.038272 | 3.322579 | [
"s478470509",
"s255491125"
] |
u094191970 | p03062 | python | s157729738 | s033726511 | 106 | 69 | 14,412 | 14,224 | Accepted | Accepted | 34.91 | n=int(eval(input()))
a=list(map(int, input().split()))
a_s=sorted(a)
for i in range(0,n-1,2):
if a_s[i]<0 and a_s[i+1]<0:
a_s[i]=-a_s[i]
a_s[i+1]=-a_s[i+1]
elif a_s[i]<0 and -a_s[i]>a_s[i+1]:
a_s[i]=-a_s[i]
a_s[i+1]=-a_s[i+1]
else:
break
print((sum(a_s))) | n=int(eval(input()))
a=list(map(int, input().split()))
b=list(map(abs, a))
cnt = 0
for i in range(n):
if a[i]<0:
cnt+=1
if cnt%2==0:
print((sum(b)))
else:
print((sum(b)-2*min(b))) | 13 | 11 | 311 | 199 | n = int(eval(input()))
a = list(map(int, input().split()))
a_s = sorted(a)
for i in range(0, n - 1, 2):
if a_s[i] < 0 and a_s[i + 1] < 0:
a_s[i] = -a_s[i]
a_s[i + 1] = -a_s[i + 1]
elif a_s[i] < 0 and -a_s[i] > a_s[i + 1]:
a_s[i] = -a_s[i]
a_s[i + 1] = -a_s[i + 1]
else:
... | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(abs, a))
cnt = 0
for i in range(n):
if a[i] < 0:
cnt += 1
if cnt % 2 == 0:
print((sum(b)))
else:
print((sum(b) - 2 * min(b)))
| false | 15.384615 | [
"-a_s = sorted(a)",
"-for i in range(0, n - 1, 2):",
"- if a_s[i] < 0 and a_s[i + 1] < 0:",
"- a_s[i] = -a_s[i]",
"- a_s[i + 1] = -a_s[i + 1]",
"- elif a_s[i] < 0 and -a_s[i] > a_s[i + 1]:",
"- a_s[i] = -a_s[i]",
"- a_s[i + 1] = -a_s[i + 1]",
"- else:",
"- ... | false | 0.035718 | 0.03638 | 0.981819 | [
"s157729738",
"s033726511"
] |
u167681750 | p03487 | python | s742127105 | s528102359 | 78 | 71 | 18,672 | 18,672 | Accepted | Accepted | 8.97 | from collections import Counter
N = int(eval(input()))
a = list(map(int, input().split()))
ca = Counter(a)
ans = 0
for num, freq in list(ca.items()):
ans += freq- num if freq >= num else freq
print(ans) | from collections import Counter
N = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for num, freq in list(Counter(a).items()):
ans += freq- num if freq >= num else freq
print(ans) | 12 | 10 | 209 | 198 | from collections import Counter
N = int(eval(input()))
a = list(map(int, input().split()))
ca = Counter(a)
ans = 0
for num, freq in list(ca.items()):
ans += freq - num if freq >= num else freq
print(ans)
| from collections import Counter
N = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for num, freq in list(Counter(a).items()):
ans += freq - num if freq >= num else freq
print(ans)
| false | 16.666667 | [
"-ca = Counter(a)",
"-for num, freq in list(ca.items()):",
"+for num, freq in list(Counter(a).items()):"
] | false | 0.055366 | 0.054485 | 1.016179 | [
"s742127105",
"s528102359"
] |
u528748570 | p03161 | python | s703605281 | s217233644 | 1,428 | 456 | 56,320 | 52,448 | Accepted | Accepted | 68.07 | import heapq
N, K = list(map(int, input().split()))
h = list(map(int, input().split()))
dp = [0] * N
dp[1] = dp[0] + abs(h[1]-h[0])
for i in range(2, N):
compare = []
heapq.heapify(compare)
cnt = min(K, i)
for j in range(cnt):
heapq.heappush(compare, dp[i-j-1] + abs(h[i]-h[i-j-1])... | N, K = list(map(int, input().split()))
h = list(map(int, input().split()))
dp = [0] * N
dp[1] = dp[0] + abs(h[1]-h[0])
for i in range(2, N):
compare = []
cnt = min(K, i)
for j in range(cnt):
compare.append(dp[i-j-1] + abs(h[i]-h[i-j-1]))
dp[i] = min(compare)
print((dp[-1]))
| 16 | 14 | 369 | 308 | import heapq
N, K = list(map(int, input().split()))
h = list(map(int, input().split()))
dp = [0] * N
dp[1] = dp[0] + abs(h[1] - h[0])
for i in range(2, N):
compare = []
heapq.heapify(compare)
cnt = min(K, i)
for j in range(cnt):
heapq.heappush(compare, dp[i - j - 1] + abs(h[i] - h[i - j - 1]))
... | N, K = list(map(int, input().split()))
h = list(map(int, input().split()))
dp = [0] * N
dp[1] = dp[0] + abs(h[1] - h[0])
for i in range(2, N):
compare = []
cnt = min(K, i)
for j in range(cnt):
compare.append(dp[i - j - 1] + abs(h[i] - h[i - j - 1]))
dp[i] = min(compare)
print((dp[-1]))
| false | 12.5 | [
"-import heapq",
"-",
"- heapq.heapify(compare)",
"- heapq.heappush(compare, dp[i - j - 1] + abs(h[i] - h[i - j - 1]))",
"- dp[i] = heapq.heappop(compare)",
"+ compare.append(dp[i - j - 1] + abs(h[i] - h[i - j - 1]))",
"+ dp[i] = min(compare)"
] | false | 0.034235 | 0.043463 | 0.787669 | [
"s703605281",
"s217233644"
] |
u888092736 | p03178 | python | s621350021 | s035090457 | 976 | 816 | 86,380 | 129,008 | Accepted | Accepted | 16.39 | def solve(K, D):
N = len(K)
MOD = 1_000_000_007
dp = [[[0] * D for _ in range(2)] for _ in range(N + 1)]
dp[0][0][0] = 1
for i in range(N):
for is_less in range(2):
for k in range(D):
for l in range(10 if is_less else K[i] + 1):
is_les... | # 25:27
import numpy as np
from numba import njit
@njit("i8(i8[:],i8)")
def solve(K, D):
N = len(K)
MOD = 1_000_000_007
dp = np.zeros((N + 1, 2, D), dtype=np.int64)
dp[0][0][0] = 1
for i in range(N):
for is_less in range(2):
for k in range(D):
for ... | 17 | 23 | 608 | 686 | def solve(K, D):
N = len(K)
MOD = 1_000_000_007
dp = [[[0] * D for _ in range(2)] for _ in range(N + 1)]
dp[0][0][0] = 1
for i in range(N):
for is_less in range(2):
for k in range(D):
for l in range(10 if is_less else K[i] + 1):
is_less_ = is_l... | # 25:27
import numpy as np
from numba import njit
@njit("i8(i8[:],i8)")
def solve(K, D):
N = len(K)
MOD = 1_000_000_007
dp = np.zeros((N + 1, 2, D), dtype=np.int64)
dp[0][0][0] = 1
for i in range(N):
for is_less in range(2):
for k in range(D):
for l in range(10 ... | false | 26.086957 | [
"+# 25:27",
"+import numpy as np",
"+from numba import njit",
"+",
"+",
"+@njit(\"i8(i8[:],i8)\")",
"- dp = [[[0] * D for _ in range(2)] for _ in range(N + 1)]",
"+ dp = np.zeros((N + 1, 2, D), dtype=np.int64)",
"-print((solve(list(map(int, eval(input()))), int(eval(input())))))",
"+print((s... | false | 0.048199 | 0.560681 | 0.085964 | [
"s621350021",
"s035090457"
] |
u949517845 | p02279 | python | s717024258 | s994742347 | 4,450 | 2,880 | 254,592 | 176,224 | Accepted | Accepted | 35.28 | # -*- coding:utf-8 -*-
import sys
from collections import OrderedDict
def cleate_node_dict(children):
node_dict = OrderedDict()
for val in children:
node_dict[val] = OrderedDict()
return node_dict
def cleate_tree(nodes):
tree = nodes.copy()
for node, children in list(nodes.... | # -*- coding:utf-8 -*-
import sys
from collections import OrderedDict
def cleate_node_dict(children):
node_dict = OrderedDict()
for val in children:
node_dict[val] = None
return node_dict
def cleate_tree(nodes):
tree = nodes.copy()
for node, children in list(nodes.items()):... | 50 | 53 | 1,328 | 1,349 | # -*- coding:utf-8 -*-
import sys
from collections import OrderedDict
def cleate_node_dict(children):
node_dict = OrderedDict()
for val in children:
node_dict[val] = OrderedDict()
return node_dict
def cleate_tree(nodes):
tree = nodes.copy()
for node, children in list(nodes.items()):
... | # -*- coding:utf-8 -*-
import sys
from collections import OrderedDict
def cleate_node_dict(children):
node_dict = OrderedDict()
for val in children:
node_dict[val] = None
return node_dict
def cleate_tree(nodes):
tree = nodes.copy()
for node, children in list(nodes.items()):
for k... | false | 5.660377 | [
"- node_dict[val] = OrderedDict()",
"+ node_dict[val] = None",
"+def rooted_trees(lst, n):",
"+ nodes = {val[0]: cleate_node_dict(val[2:]) for val in lst}",
"+ tree = cleate_tree(nodes)",
"+ node_info = [None] * n",
"+ rec(tree, node_info)",
"+ print((\"\\n\".join(node_inf... | false | 0.038356 | 0.039475 | 0.971639 | [
"s717024258",
"s994742347"
] |
u166621202 | p03102 | python | s758204829 | s443837901 | 151 | 18 | 12,504 | 3,060 | Accepted | Accepted | 88.08 | import numpy as np
N,M,C = list(map(int,input().split()))
B=np.array(list(map(int,input().split())))
ans=0
for i in range(N):
A=np.array(list(map(int,input().split())))
if sum(A*B)+C > 0:
ans+=1
print(ans)
| N,M,C = list(map(int,input().split()))
B = list(map(int,input().split()))
ans=0
for i in range(N):
ab=0
A = list(map(int,input().split()))
for j in range(M):
ab += A[j] * B[j]
if ab + C > 0:
ans+=1
print(ans) | 11 | 12 | 220 | 230 | import numpy as np
N, M, C = list(map(int, input().split()))
B = np.array(list(map(int, input().split())))
ans = 0
for i in range(N):
A = np.array(list(map(int, input().split())))
if sum(A * B) + C > 0:
ans += 1
print(ans)
| N, M, C = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
for i in range(N):
ab = 0
A = list(map(int, input().split()))
for j in range(M):
ab += A[j] * B[j]
if ab + C > 0:
ans += 1
print(ans)
| false | 8.333333 | [
"-import numpy as np",
"-",
"-B = np.array(list(map(int, input().split())))",
"+B = list(map(int, input().split()))",
"- A = np.array(list(map(int, input().split())))",
"- if sum(A * B) + C > 0:",
"+ ab = 0",
"+ A = list(map(int, input().split()))",
"+ for j in range(M):",
"+ ... | false | 0.163475 | 0.034939 | 4.678902 | [
"s758204829",
"s443837901"
] |
u712429027 | p02597 | python | s638404069 | s477202080 | 68 | 61 | 12,616 | 12,684 | Accepted | Accepted | 10.29 | import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print('\n'.join(map(str, x)))
n = ini()
s = list(ins())
t = sorted(s)
ans = 0
for i in range(n):
... | import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print('\n'.join(map(str, x)))
n = ini()
s = list(ins())
n = s.count("R")
t = sorted(s)
ans = 0
for ... | 18 | 17 | 405 | 386 | import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print("\n".join(map(str, x)))
n = ini()
s = list(ins())
t = sorted(s)
ans = 0
for i in range(n):
if t[i] != ... | import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print("\n".join(map(str, x)))
n = ini()
s = list(ins())
n = s.count("R")
t = sorted(s)
ans = 0
for i in range(n)... | false | 5.555556 | [
"+n = s.count(\"R\")",
"- if t[i] != \"R\":",
"- break"
] | false | 0.046552 | 0.040589 | 1.146918 | [
"s638404069",
"s477202080"
] |
u847497464 | p02971 | python | s459526694 | s587997949 | 560 | 515 | 14,112 | 14,112 | Accepted | Accepted | 8.04 | n = int(eval(input()))
a = [ int(eval(input())) for x in range(n) ]
b = sorted(a, reverse = True)
maximum = b[0]
for i in a:
if i == maximum:
print((b[1]))
else:
print(maximum) | n = int(eval(input()))
a = [ int(eval(input())) for x in range(n) ]
b = sorted(a, reverse = True)
maximum = b[0]
for i in a:
print(( b[1] if i == maximum else maximum )) | 11 | 8 | 199 | 168 | n = int(eval(input()))
a = [int(eval(input())) for x in range(n)]
b = sorted(a, reverse=True)
maximum = b[0]
for i in a:
if i == maximum:
print((b[1]))
else:
print(maximum)
| n = int(eval(input()))
a = [int(eval(input())) for x in range(n)]
b = sorted(a, reverse=True)
maximum = b[0]
for i in a:
print((b[1] if i == maximum else maximum))
| false | 27.272727 | [
"- if i == maximum:",
"- print((b[1]))",
"- else:",
"- print(maximum)",
"+ print((b[1] if i == maximum else maximum))"
] | false | 0.036076 | 0.045619 | 0.79082 | [
"s459526694",
"s587997949"
] |
u896741788 | p03715 | python | s701857962 | s654768375 | 193 | 75 | 40,496 | 67,768 | Accepted | Accepted | 61.14 | h,w=list(map(int,input().split()))
if h*w%3:
ans=min(h,w)
for x in range(1,w+1):
ans=min(ans,max(h*x,h//2*(w-x),(h-h//2)*(w-x))-min(h*x,h//2*(w-x),(h-h//2)*(w-x)))
h,w=w,h
for x in range(1,w+1):
ans=min(ans,max(h*x,h//2*(w-x),(h-h//2)*(w-x))-min(h*x,h//2*(w-x),(h-h//2)*(w-x)))
print(ans)
else... | h,w=list(map(int,input().split()))
def f(x,y):
ret=(1 if x%3 else 0)*y
for i in range(1,x):
f=sorted((i*y,y//2*(x-i),(1+y)//2*(x-i)))
ret=min(ret,f[2]-f[0])
return ret
print((min(f(h,w),f(w,h)))) | 10 | 8 | 323 | 222 | h, w = list(map(int, input().split()))
if h * w % 3:
ans = min(h, w)
for x in range(1, w + 1):
ans = min(
ans,
max(h * x, h // 2 * (w - x), (h - h // 2) * (w - x))
- min(h * x, h // 2 * (w - x), (h - h // 2) * (w - x)),
)
h, w = w, h
for x in range(1, ... | h, w = list(map(int, input().split()))
def f(x, y):
ret = (1 if x % 3 else 0) * y
for i in range(1, x):
f = sorted((i * y, y // 2 * (x - i), (1 + y) // 2 * (x - i)))
ret = min(ret, f[2] - f[0])
return ret
print((min(f(h, w), f(w, h))))
| false | 20 | [
"-if h * w % 3:",
"- ans = min(h, w)",
"- for x in range(1, w + 1):",
"- ans = min(",
"- ans,",
"- max(h * x, h // 2 * (w - x), (h - h // 2) * (w - x))",
"- - min(h * x, h // 2 * (w - x), (h - h // 2) * (w - x)),",
"- )",
"- h, w = w, h",
"- ... | false | 0.055113 | 0.042082 | 1.309654 | [
"s701857962",
"s654768375"
] |
u536560967 | p03220 | python | s448269978 | s580997934 | 152 | 18 | 12,600 | 3,060 | Accepted | Accepted | 88.16 | #!/usr/bin/env python3
import numpy as np
n = int(eval(input()))
t, a = list(map(int, input().split()))
h = list(map(int, input().split()))
a_t = []
for i in h:
a_t.append(t - i * 0.006)
print((np.abs(np.asarray(a_t) - a).argmin() + 1)) | #!/usr/bin/env python3
n = int(eval(input()))
t, a = list(map(int, input().split()))
h = [abs(t - x * 0.006 - a) for x in map(int, input().split())]
print((h.index(min(h)) + 1)) | 9 | 5 | 235 | 168 | #!/usr/bin/env python3
import numpy as np
n = int(eval(input()))
t, a = list(map(int, input().split()))
h = list(map(int, input().split()))
a_t = []
for i in h:
a_t.append(t - i * 0.006)
print((np.abs(np.asarray(a_t) - a).argmin() + 1))
| #!/usr/bin/env python3
n = int(eval(input()))
t, a = list(map(int, input().split()))
h = [abs(t - x * 0.006 - a) for x in map(int, input().split())]
print((h.index(min(h)) + 1))
| false | 44.444444 | [
"-import numpy as np",
"-",
"-h = list(map(int, input().split()))",
"-a_t = []",
"-for i in h:",
"- a_t.append(t - i * 0.006)",
"-print((np.abs(np.asarray(a_t) - a).argmin() + 1))",
"+h = [abs(t - x * 0.006 - a) for x in map(int, input().split())]",
"+print((h.index(min(h)) + 1))"
] | false | 0.915126 | 0.047118 | 19.422193 | [
"s448269978",
"s580997934"
] |
u298297089 | p02948 | python | s118079152 | s640737495 | 687 | 475 | 35,784 | 27,428 | Accepted | Accepted | 30.86 | from heapq import heappop, heappush
n,m = list(map(int,input().split()))
byte = {}
for i in range(n):
a,b = list(map(int,input().split()))
if a not in byte:
byte[a] = []
heappush(byte[a], [-b,a])
ans = 0
res = []
for i in range(1, m+1):
if i in byte:
heappush(res, heappop... | from heapq import heappop, heappush
n,m = list(map(int,input().split()))
byte = {}
for i in range(n):
a,b = list(map(int,input().split()))
if a > m:
continue
if a not in byte:
byte[a] = []
heappush(byte[a], -b)
ans = 0
res = []
for i in range(1, m+1):
if i in byte:
... | 23 | 21 | 468 | 429 | from heapq import heappop, heappush
n, m = list(map(int, input().split()))
byte = {}
for i in range(n):
a, b = list(map(int, input().split()))
if a not in byte:
byte[a] = []
heappush(byte[a], [-b, a])
ans = 0
res = []
for i in range(1, m + 1):
if i in byte:
heappush(res, heappop(byte[i]... | from heapq import heappop, heappush
n, m = list(map(int, input().split()))
byte = {}
for i in range(n):
a, b = list(map(int, input().split()))
if a > m:
continue
if a not in byte:
byte[a] = []
heappush(byte[a], -b)
ans = 0
res = []
for i in range(1, m + 1):
if i in byte:
whi... | false | 8.695652 | [
"+ if a > m:",
"+ continue",
"- heappush(byte[a], [-b, a])",
"+ heappush(byte[a], -b)",
"- heappush(res, heappop(byte[i]))",
"- if not res:",
"- continue",
"- b, a = heappop(res)",
"- ans -= b",
"- if byte[a]:",
"- heappush(res, heappop(byte[a]))"... | false | 0.070237 | 0.065029 | 1.080085 | [
"s118079152",
"s640737495"
] |
u887207211 | p03835 | python | s387941242 | s610259052 | 1,805 | 1,368 | 2,940 | 2,940 | Accepted | Accepted | 24.21 | K, S = list(map(int,input().split()))
cnt = 0
for i in range(K+1):
for j in range(K+1):
if(S-(i+j) <= K and S-(i+j) >= 0):
cnt += 1
print(cnt) | K, S = list(map(int,input().split()))
cnt = 0
for i in range(K+1):
for j in range(K+1):
if(0 <= S-i-j < K+1):
cnt += 1
print(cnt) | 8 | 7 | 156 | 141 | K, S = list(map(int, input().split()))
cnt = 0
for i in range(K + 1):
for j in range(K + 1):
if S - (i + j) <= K and S - (i + j) >= 0:
cnt += 1
print(cnt)
| K, S = list(map(int, input().split()))
cnt = 0
for i in range(K + 1):
for j in range(K + 1):
if 0 <= S - i - j < K + 1:
cnt += 1
print(cnt)
| false | 12.5 | [
"- if S - (i + j) <= K and S - (i + j) >= 0:",
"+ if 0 <= S - i - j < K + 1:"
] | false | 0.087699 | 0.047572 | 1.843514 | [
"s387941242",
"s610259052"
] |
u474561976 | p02614 | python | s338660566 | s080479476 | 131 | 54 | 9,240 | 9,116 | Accepted | Accepted | 58.78 | import io,sys,copy
sys.setrecursionlimit(10**6)
def main():
h,w,poi = list(map(int,input().split()))
G = []
for _ in range(h):
s = eval(input())
temp = []
for i in s:
temp.append(i)
G.append(temp)
ans = 0
for i in range(0b1<<w):
... | def main2():
h,w,k = list(map(int,input().split()))
G = []
for _ in range(h):
c = list(eval(input()))
G.append(c)
ans = 0
for ib in range(1<<h):
for jb in range(1<<w):
ct = 0
for i in range(h):
for j in range(w):
... | 46 | 21 | 1,061 | 489 | import io, sys, copy
sys.setrecursionlimit(10**6)
def main():
h, w, poi = list(map(int, input().split()))
G = []
for _ in range(h):
s = eval(input())
temp = []
for i in s:
temp.append(i)
G.append(temp)
ans = 0
for i in range(0b1 << w):
for j in ... | def main2():
h, w, k = list(map(int, input().split()))
G = []
for _ in range(h):
c = list(eval(input()))
G.append(c)
ans = 0
for ib in range(1 << h):
for jb in range(1 << w):
ct = 0
for i in range(h):
for j in range(w):
... | false | 54.347826 | [
"-import io, sys, copy",
"-",
"-sys.setrecursionlimit(10**6)",
"-",
"-",
"-def main():",
"- h, w, poi = list(map(int, input().split()))",
"+def main2():",
"+ h, w, k = list(map(int, input().split()))",
"- s = eval(input())",
"- temp = []",
"- for i in s:",
"- ... | false | 0.043407 | 0.036348 | 1.194217 | [
"s338660566",
"s080479476"
] |
u562016607 | p03026 | python | s018942408 | s788924767 | 357 | 312 | 50,136 | 49,240 | Accepted | Accepted | 12.61 | from collections import deque
N=int(eval(input()))
A=[0 for i in range(N-1)]
B=[0 for i in range(N-1)]
G=[[] for i in range(N)]
for i in range(N-1):
a,b=list(map(int,input().split()))
a-=1;b-=1
A[i],B[i]=a,b
G[a].append(b)
G[b].append(a)
j=0
for i in range(N):
if len(G[i])>len(G[j])... | from collections import deque
N=int(eval(input()))
G=[[] for i in range(N)]
for i in range(N-1):
a,b=list(map(int,input().split()))
a-=1;b-=1
G[a].append(b)
G[b].append(a)
j=0
for i in range(N):
if len(G[i])>len(G[j]):
j=i
c=sorted([int(i) for i in input().split()])
M=sum(c)-max... | 27 | 24 | 599 | 526 | from collections import deque
N = int(eval(input()))
A = [0 for i in range(N - 1)]
B = [0 for i in range(N - 1)]
G = [[] for i in range(N)]
for i in range(N - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
A[i], B[i] = a, b
G[a].append(b)
G[b].append(a)
j = 0
for i in range(N):
if... | from collections import deque
N = int(eval(input()))
G = [[] for i in range(N)]
for i in range(N - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
G[a].append(b)
G[b].append(a)
j = 0
for i in range(N):
if len(G[i]) > len(G[j]):
j = i
c = sorted([int(i) for i in input().split()]... | false | 11.111111 | [
"-A = [0 for i in range(N - 1)]",
"-B = [0 for i in range(N - 1)]",
"- A[i], B[i] = a, b"
] | false | 0.040886 | 0.041875 | 0.976387 | [
"s018942408",
"s788924767"
] |
u054514819 | p02722 | python | s771816363 | s737927073 | 289 | 186 | 3,956 | 65,508 | Accepted | Accepted | 35.64 | from math import sqrt
N = int(eval(input()))
ans = 0
divisors = []
for i in range(2, int(sqrt(N))+1):
if N%i==0:
divisors.append(i)
divisors.append(N//i)
for d in set(divisors):
i = 1
while N%(d**i)==0:
i += 1
n = N//(d**(i-1))
if n%d==1:
ans+=1
f... | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
def make_divisors(n):
lower_divisors , upper_divisors = [], []
i = 1
while i*i <= n:
if n % i == 0:
lower_divisors.append(i)
... | 28 | 28 | 498 | 661 | from math import sqrt
N = int(eval(input()))
ans = 0
divisors = []
for i in range(2, int(sqrt(N)) + 1):
if N % i == 0:
divisors.append(i)
divisors.append(N // i)
for d in set(divisors):
i = 1
while N % (d**i) == 0:
i += 1
n = N // (d ** (i - 1))
if n % d == 1:
ans +=... | import sys
def input():
return sys.stdin.readline().strip()
def mapint():
return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
def make_divisors(n):
lower_divisors, upper_divisors = [], []
i = 1
while i * i <= n:
if n % i == 0:
lower_divisors.append(i)
... | false | 0 | [
"-from math import sqrt",
"+import sys",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline().strip()",
"+",
"+",
"+def mapint():",
"+ return list(map(int, input().split()))",
"+",
"+",
"+sys.setrecursionlimit(10**9)",
"+",
"+",
"+def make_divisors(n):",
"+ lower_diviso... | false | 0.121291 | 0.10629 | 1.141126 | [
"s771816363",
"s737927073"
] |
u919633157 | p03524 | python | s775357822 | s600251992 | 26 | 18 | 3,444 | 3,188 | Accepted | Accepted | 30.77 | # 2019/09/27
from collections import Counter
s=eval(input())
n=len(s)
c=Counter(s)
res=list(c.values())
if len(res)<3:
if n==len(res):
print('YES')
else:print('NO')
exit()
if max(res)-min(res)>1 :
print('NO')
else:
print('YES')
| s=eval(input())
a=s.count('a')
b=s.count('b')
c=s.count('c')
print(('YES' if max(a,b,c)-min(a,b,c)<=1 else 'NO')) | 19 | 6 | 266 | 111 | # 2019/09/27
from collections import Counter
s = eval(input())
n = len(s)
c = Counter(s)
res = list(c.values())
if len(res) < 3:
if n == len(res):
print("YES")
else:
print("NO")
exit()
if max(res) - min(res) > 1:
print("NO")
else:
print("YES")
| s = eval(input())
a = s.count("a")
b = s.count("b")
c = s.count("c")
print(("YES" if max(a, b, c) - min(a, b, c) <= 1 else "NO"))
| false | 68.421053 | [
"-# 2019/09/27",
"-from collections import Counter",
"-",
"-n = len(s)",
"-c = Counter(s)",
"-res = list(c.values())",
"-if len(res) < 3:",
"- if n == len(res):",
"- print(\"YES\")",
"- else:",
"- print(\"NO\")",
"- exit()",
"-if max(res) - min(res) > 1:",
"- prin... | false | 0.043353 | 0.034021 | 1.274272 | [
"s775357822",
"s600251992"
] |
u644907318 | p02888 | python | s796391884 | s586447063 | 638 | 361 | 75,288 | 74,612 | Accepted | Accepted | 43.42 | from bisect import bisect_right,bisect_left
N = int(eval(input()))
L = sorted(list(map(int,input().split())))
cnt = 0
for i in range(N-1):
for j in range(i+1,N):
a = L[i]
b = L[j]
indU = bisect_left(L,a+b)
indL = bisect_right(L,b-a)
if j<indU and i>= indL:
... | from bisect import bisect_left
N = int(eval(input()))
L = sorted(list(map(int,input().split())))
cnt = 0
for i in range(N-2):
for j in range(i+1,N-1):
a = L[i]
b = L[j]
ind = bisect_left(L,a+b)
cnt += ind-j-1
print(cnt) | 17 | 11 | 513 | 259 | from bisect import bisect_right, bisect_left
N = int(eval(input()))
L = sorted(list(map(int, input().split())))
cnt = 0
for i in range(N - 1):
for j in range(i + 1, N):
a = L[i]
b = L[j]
indU = bisect_left(L, a + b)
indL = bisect_right(L, b - a)
if j < indU and i >= indL:
... | from bisect import bisect_left
N = int(eval(input()))
L = sorted(list(map(int, input().split())))
cnt = 0
for i in range(N - 2):
for j in range(i + 1, N - 1):
a = L[i]
b = L[j]
ind = bisect_left(L, a + b)
cnt += ind - j - 1
print(cnt)
| false | 35.294118 | [
"-from bisect import bisect_right, bisect_left",
"+from bisect import bisect_left",
"-for i in range(N - 1):",
"- for j in range(i + 1, N):",
"+for i in range(N - 2):",
"+ for j in range(i + 1, N - 1):",
"- indU = bisect_left(L, a + b)",
"- indL = bisect_right(L, b - a)",
"- ... | false | 0.035542 | 0.047424 | 0.749455 | [
"s796391884",
"s586447063"
] |
u842964692 | p02781 | python | s898643000 | s580909728 | 1,157 | 22 | 3,064 | 3,188 | Accepted | Accepted | 98.1 | N=eval(input())
K=int(eval(input()))
def rec(N,K):
if K==0:
return 1#N以下の数で、0以外の数が0、すなわち残りの桁が全て0になるパターン
if len(N)<K:
return 0
lsb=int(N[-1])
if len(N)==1:
return lsb
return rec(N[:-1],K-1)*(lsb)+rec(str(int(N[:-1])-1),K-1)*(9-lsb)+rec(N[:-1],K)
... | N=eval(input())
K=int(eval(input()))
dp=[[[0 for _ in range(K+2)] for _ in range(2)] for _ in range(len(N)+1)]
dp[0][0][0]=1
for i in range(len(N)):
for smaller in range(2):
for j in range(K+1):
for x in range(10 if smaller==1 else int(N[i])+1):
dp[i+1][smaller or (... | 18 | 13 | 326 | 404 | N = eval(input())
K = int(eval(input()))
def rec(N, K):
if K == 0:
return 1 # N以下の数で、0以外の数が0、すなわち残りの桁が全て0になるパターン
if len(N) < K:
return 0
lsb = int(N[-1])
if len(N) == 1:
return lsb
return (
rec(N[:-1], K - 1) * (lsb)
+ rec(str(int(N[:-1]) - 1), K - 1) * (9 ... | N = eval(input())
K = int(eval(input()))
dp = [[[0 for _ in range(K + 2)] for _ in range(2)] for _ in range(len(N) + 1)]
dp[0][0][0] = 1
for i in range(len(N)):
for smaller in range(2):
for j in range(K + 1):
for x in range(10 if smaller == 1 else int(N[i]) + 1):
dp[i + 1][smalle... | false | 27.777778 | [
"-",
"-",
"-def rec(N, K):",
"- if K == 0:",
"- return 1 # N以下の数で、0以外の数が0、すなわち残りの桁が全て0になるパターン",
"- if len(N) < K:",
"- return 0",
"- lsb = int(N[-1])",
"- if len(N) == 1:",
"- return lsb",
"- return (",
"- rec(N[:-1], K - 1) * (lsb)",
"- + r... | false | 0.104919 | 0.050022 | 2.097448 | [
"s898643000",
"s580909728"
] |
u936985471 | p02813 | python | s014666279 | s816401791 | 265 | 37 | 6,244 | 9,084 | Accepted | Accepted | 86.04 | N=int(eval(input()))
P=list(map(int,input().split()))
ps=""
for i in range(N):
ps+=str(P[i])
Q=list(map(int,input().split()))
qs=""
for i in range(N):
qs+=str(Q[i])
stack=[]
stack.append("")
res=[]
while stack:
d=stack.pop()
if len(d)==N:
res.append(d)
continue
for i in range(1,N+1)... | import sys
readline = sys.stdin.readline
N = int(readline())
P = tuple(map(int,readline().split()))
Q = tuple(map(int,readline().split()))
import itertools
a = 0
b = 0
cnt = 0
for perm in itertools.permutations(list(range(1, N + 1))):
cnt += 1
if perm == P:
a = cnt
if perm == Q:
b = cnt
... | 32 | 19 | 504 | 342 | N = int(eval(input()))
P = list(map(int, input().split()))
ps = ""
for i in range(N):
ps += str(P[i])
Q = list(map(int, input().split()))
qs = ""
for i in range(N):
qs += str(Q[i])
stack = []
stack.append("")
res = []
while stack:
d = stack.pop()
if len(d) == N:
res.append(d)
continue
... | import sys
readline = sys.stdin.readline
N = int(readline())
P = tuple(map(int, readline().split()))
Q = tuple(map(int, readline().split()))
import itertools
a = 0
b = 0
cnt = 0
for perm in itertools.permutations(list(range(1, N + 1))):
cnt += 1
if perm == P:
a = cnt
if perm == Q:
b = cnt
... | false | 40.625 | [
"-N = int(eval(input()))",
"-P = list(map(int, input().split()))",
"-ps = \"\"",
"-for i in range(N):",
"- ps += str(P[i])",
"-Q = list(map(int, input().split()))",
"-qs = \"\"",
"-for i in range(N):",
"- qs += str(Q[i])",
"-stack = []",
"-stack.append(\"\")",
"-res = []",
"-while stac... | false | 0.039364 | 0.056655 | 0.694801 | [
"s014666279",
"s816401791"
] |
u496821919 | p02607 | python | s891999270 | s386076496 | 27 | 22 | 9,108 | 8,996 | Accepted | Accepted | 18.52 | n = int(eval(input()))
A = list(map(int,input().split()))
ans = 0
for i in range(n):
if i %2 == 1:
continue
if A[i] % 2 == 1:
ans += 1
print(ans) | n = eval(input())
ans = 0
for i,j in enumerate(map(int,input().split())):
ans += (~i&1 and j&1)
print(ans) | 9 | 5 | 171 | 108 | n = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
for i in range(n):
if i % 2 == 1:
continue
if A[i] % 2 == 1:
ans += 1
print(ans)
| n = eval(input())
ans = 0
for i, j in enumerate(map(int, input().split())):
ans += ~i & 1 and j & 1
print(ans)
| false | 44.444444 | [
"-n = int(eval(input()))",
"-A = list(map(int, input().split()))",
"+n = eval(input())",
"-for i in range(n):",
"- if i % 2 == 1:",
"- continue",
"- if A[i] % 2 == 1:",
"- ans += 1",
"+for i, j in enumerate(map(int, input().split())):",
"+ ans += ~i & 1 and j & 1"
] | false | 0.070083 | 0.070041 | 1.000605 | [
"s891999270",
"s386076496"
] |
u008079810 | p02698 | python | s169861260 | s832200024 | 1,527 | 1,270 | 239,368 | 78,108 | Accepted | Accepted | 16.83 | import bisect
import sys
sys.setrecursionlimit(10**7)
def dfs(v):
pos=bisect.bisect_left(dp,arr[v])
changes.append((pos,dp[pos]))
dp[pos]=arr[v]
ans[v]=bisect.bisect_left(dp,10**18)
for u in g[v]:
if checked[u]==0:
checked[u]=1
dfs(u)
pos,val=changes... | from collections import deque
import bisect
N=int(eval(input()))
A=list(map(int,input().split()))
ans=[0]*N
Edge=[[] for _ in range(N)]
loute=[str(0)]*N
for i in range(N-1):
u,v=list(map(int,input().split()))
Edge[u-1].append(v-1)
Edge[v-1].append(u-1)
tmp=deque(str(0))
CHN=deque()
LIS=[1... | 32 | 40 | 671 | 824 | import bisect
import sys
sys.setrecursionlimit(10**7)
def dfs(v):
pos = bisect.bisect_left(dp, arr[v])
changes.append((pos, dp[pos]))
dp[pos] = arr[v]
ans[v] = bisect.bisect_left(dp, 10**18)
for u in g[v]:
if checked[u] == 0:
checked[u] = 1
dfs(u)
pos, val = ch... | from collections import deque
import bisect
N = int(eval(input()))
A = list(map(int, input().split()))
ans = [0] * N
Edge = [[] for _ in range(N)]
loute = [str(0)] * N
for i in range(N - 1):
u, v = list(map(int, input().split()))
Edge[u - 1].append(v - 1)
Edge[v - 1].append(u - 1)
tmp = deque(str(0))
CHN =... | false | 20 | [
"+from collections import deque",
"-import sys",
"-sys.setrecursionlimit(10**7)",
"-",
"-",
"-def dfs(v):",
"- pos = bisect.bisect_left(dp, arr[v])",
"- changes.append((pos, dp[pos]))",
"- dp[pos] = arr[v]",
"- ans[v] = bisect.bisect_left(dp, 10**18)",
"- for u in g[v]:",
"- ... | false | 0.007497 | 0.042064 | 0.178218 | [
"s169861260",
"s832200024"
] |
u312025627 | p02864 | python | s086040081 | s194656253 | 345 | 304 | 42,460 | 42,216 | Accepted | Accepted | 11.88 | def main():
import sys
input = sys.stdin.buffer.readline
N, K = (int(i) for i in input().split())
H = [0] + [int(i) for i in input().split()]
if N == K:
return print(0)
elif K == 0:
ans = 0
for i in range(N):
ans += max(H[i+1] - H[i], 0)
ret... | def main():
N, K = (int(i) for i in input().split())
H = [0] + [int(i) for i in input().split()]
# 1-indexed
if N == K:
return print(0)
elif K == 0:
ans = 0
for i in range(N):
ans += max(H[i+1] - H[i], 0)
return print(ans)
dp = [[10**12]*(N-... | 32 | 29 | 838 | 722 | def main():
import sys
input = sys.stdin.buffer.readline
N, K = (int(i) for i in input().split())
H = [0] + [int(i) for i in input().split()]
if N == K:
return print(0)
elif K == 0:
ans = 0
for i in range(N):
ans += max(H[i + 1] - H[i], 0)
return prin... | def main():
N, K = (int(i) for i in input().split())
H = [0] + [int(i) for i in input().split()]
# 1-indexed
if N == K:
return print(0)
elif K == 0:
ans = 0
for i in range(N):
ans += max(H[i + 1] - H[i], 0)
return print(ans)
dp = [[10**12] * (N - K + 1... | false | 9.375 | [
"- import sys",
"-",
"- input = sys.stdin.buffer.readline",
"+ # 1-indexed",
"- dp = [[10**10] * (N - K + 1) for i in range(N + 1)]",
"- dp[0][0] = 0",
"- for i, h in enumerate(H):",
"- if i == 0:",
"- continue",
"- dp[i][1] = h",
"+ dp = [[10**12] *... | false | 0.033723 | 0.05211 | 0.647156 | [
"s086040081",
"s194656253"
] |
u966695411 | p04045 | python | s677247769 | s195578349 | 911 | 94 | 3,700 | 2,940 | Accepted | Accepted | 89.68 | N, L = list(map(int, input().split()))
D = input().split()
ans = N
while 1:
s = str(ans)
f = 1
for i in D:
if i in s : f = 0
if f : break
ans += 1
print(ans) | def main():
N, L = list(map(int, input().split()))
D = input().split()
ans = N
while 1:
s = str(ans)
if not [1 for i in D if i in s] : break
ans += 1
print(ans)
if __name__ == '__main__':
main() | 11 | 11 | 189 | 246 | N, L = list(map(int, input().split()))
D = input().split()
ans = N
while 1:
s = str(ans)
f = 1
for i in D:
if i in s:
f = 0
if f:
break
ans += 1
print(ans)
| def main():
N, L = list(map(int, input().split()))
D = input().split()
ans = N
while 1:
s = str(ans)
if not [1 for i in D if i in s]:
break
ans += 1
print(ans)
if __name__ == "__main__":
main()
| false | 0 | [
"-N, L = list(map(int, input().split()))",
"-D = input().split()",
"-ans = N",
"-while 1:",
"- s = str(ans)",
"- f = 1",
"- for i in D:",
"- if i in s:",
"- f = 0",
"- if f:",
"- break",
"- ans += 1",
"-print(ans)",
"+def main():",
"+ N, L = lis... | false | 0.123678 | 0.119821 | 1.032189 | [
"s677247769",
"s195578349"
] |
u644907318 | p03776 | python | s251557662 | s519404697 | 189 | 69 | 38,768 | 69,848 | Accepted | Accepted | 63.49 | from math import factorial
N,A,B = list(map(int,input().split()))
V = sorted(list(map(int,input().split())),reverse=True)
C = {}
for i in range(N):
if V[i] not in C:
C[V[i]] = 0
C[V[i]] += 1
v = V[A-1]
avg = sum(V[:A])/A
print(avg)
cnt = V[:A].count(v)
if cnt<A:
tot = factorial(C[v])//f... | memo = {}
def f(m,k):
if k>m:
return 0
if m==1:
return 1
if k==0:
return 1
if k==1:
return m
if (m,k) in memo:
return memo[(m,k)]
memo[(m,k)]=f(m-1,k-1)+f(m-1,k)
return memo[(m,k)]
N,A,B = list(map(int,input().split()))
V = sorted(list... | 19 | 41 | 490 | 788 | from math import factorial
N, A, B = list(map(int, input().split()))
V = sorted(list(map(int, input().split())), reverse=True)
C = {}
for i in range(N):
if V[i] not in C:
C[V[i]] = 0
C[V[i]] += 1
v = V[A - 1]
avg = sum(V[:A]) / A
print(avg)
cnt = V[:A].count(v)
if cnt < A:
tot = factorial(C[v]) // ... | memo = {}
def f(m, k):
if k > m:
return 0
if m == 1:
return 1
if k == 0:
return 1
if k == 1:
return m
if (m, k) in memo:
return memo[(m, k)]
memo[(m, k)] = f(m - 1, k - 1) + f(m - 1, k)
return memo[(m, k)]
N, A, B = list(map(int, input().split()))
... | false | 53.658537 | [
"-from math import factorial",
"+memo = {}",
"+",
"+",
"+def f(m, k):",
"+ if k > m:",
"+ return 0",
"+ if m == 1:",
"+ return 1",
"+ if k == 0:",
"+ return 1",
"+ if k == 1:",
"+ return m",
"+ if (m, k) in memo:",
"+ return memo[(m, k)]"... | false | 0.092722 | 0.041907 | 2.212562 | [
"s251557662",
"s519404697"
] |
u631277801 | p04013 | python | s869774719 | s956072730 | 176 | 37 | 5,744 | 3,572 | Accepted | Accepted | 78.98 | N,A = list(map(int,input().split()))
X = list(map(int, input().split()))
for i in range(N):
X[i] -= A
dp = [[0 for _ in range(100*N+1)] for _ in range(N+1)]
dp[0][50*N] = 1
for i in range(1,N+1):
for summ in range(2*50*N+1):
if 0 <= summ-X[i-1] <= 100*N:
dp[i][summ] = dp[i-1][... | from collections import Counter
N,A = list(map(int,input().split()))
X = list(map(int, input().split()))
X = [X[i] - A for i in range(N)]
sums = Counter([0, X[0]])
for x in X[1:]:
c = Counter()
for k,v in list(sums.items()):
c[x+k] = v
sums += c
print((sums[0]-1)) | 17 | 16 | 434 | 294 | N, A = list(map(int, input().split()))
X = list(map(int, input().split()))
for i in range(N):
X[i] -= A
dp = [[0 for _ in range(100 * N + 1)] for _ in range(N + 1)]
dp[0][50 * N] = 1
for i in range(1, N + 1):
for summ in range(2 * 50 * N + 1):
if 0 <= summ - X[i - 1] <= 100 * N:
dp[i][summ] ... | from collections import Counter
N, A = list(map(int, input().split()))
X = list(map(int, input().split()))
X = [X[i] - A for i in range(N)]
sums = Counter([0, X[0]])
for x in X[1:]:
c = Counter()
for k, v in list(sums.items()):
c[x + k] = v
sums += c
print((sums[0] - 1))
| false | 5.882353 | [
"+from collections import Counter",
"+",
"-for i in range(N):",
"- X[i] -= A",
"-dp = [[0 for _ in range(100 * N + 1)] for _ in range(N + 1)]",
"-dp[0][50 * N] = 1",
"-for i in range(1, N + 1):",
"- for summ in range(2 * 50 * N + 1):",
"- if 0 <= summ - X[i - 1] <= 100 * N:",
"- ... | false | 0.037282 | 0.035958 | 1.036835 | [
"s869774719",
"s956072730"
] |
u489124637 | p02720 | python | s674398775 | s902379817 | 303 | 192 | 70,364 | 84,360 | Accepted | Accepted | 36.63 | from collections import deque
K = int(eval(input()))
que = deque(["1","2","3","4","5","6","7","8","9"])
cnt = 0
while cnt < K:
q = que.popleft()
a = int(q[-1])
q = int(q)
cnt += 1
if a == 0:
que.append(str(q*10+a))
que.append(str(q*10+a+1))
elif a == 9:
... | import sys
sys.setrecursionlimit(10**9)
k = int(eval(input()))
l = 10
A = [str(i+1) for i in range(9)]
B = ["0"] + A
ans = []
#print(l)
def dfs(num,l):
if len(num) >= l:
ans.append(int(num))
else:
ans.append(int(num))
for i in B:
if abs(int(num[-1])-int(i)) ... | 25 | 26 | 515 | 479 | from collections import deque
K = int(eval(input()))
que = deque(["1", "2", "3", "4", "5", "6", "7", "8", "9"])
cnt = 0
while cnt < K:
q = que.popleft()
a = int(q[-1])
q = int(q)
cnt += 1
if a == 0:
que.append(str(q * 10 + a))
que.append(str(q * 10 + a + 1))
elif a == 9:
... | import sys
sys.setrecursionlimit(10**9)
k = int(eval(input()))
l = 10
A = [str(i + 1) for i in range(9)]
B = ["0"] + A
ans = []
# print(l)
def dfs(num, l):
if len(num) >= l:
ans.append(int(num))
else:
ans.append(int(num))
for i in B:
if abs(int(num[-1]) - int(i)) < 2:
... | false | 3.846154 | [
"-from collections import deque",
"+import sys",
"-K = int(eval(input()))",
"-que = deque([\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\"])",
"-cnt = 0",
"-while cnt < K:",
"- q = que.popleft()",
"- a = int(q[-1])",
"- q = int(q)",
"- cnt += 1",
"- if a == 0:",
"-... | false | 0.06195 | 0.604382 | 0.102501 | [
"s674398775",
"s902379817"
] |
u392319141 | p02644 | python | s221005672 | s860803839 | 2,267 | 1,817 | 38,468 | 36,712 | Accepted | Accepted | 19.85 | from collections import deque
import sys
input = sys.stdin.buffer.readline
H, W, K = list(map(int, input().split()))
sx, sy, tx, ty = [int(a) - 1 for a in input().split()]
INF = 10**18
A = [input().decode() for _ in range(H)]
minDist = [[INF] * W for _ in range(H)]
minDist[sx][sy] = 0
que = deque([(0, sx... | from collections import deque
H, W, K = list(map(int, input().split()))
sx, sy, tx, ty = [int(a) - 1 for a in input().split()]
INF = 10**18
A = [eval(input()) for _ in range(H)]
minDist = [[INF] * W for _ in range(H)]
minDist[sx][sy] = 0
que = deque([(0, sx, sy)])
while que:
dist, nx, ny = que.popl... | 52 | 52 | 1,613 | 1,603 | from collections import deque
import sys
input = sys.stdin.buffer.readline
H, W, K = list(map(int, input().split()))
sx, sy, tx, ty = [int(a) - 1 for a in input().split()]
INF = 10**18
A = [input().decode() for _ in range(H)]
minDist = [[INF] * W for _ in range(H)]
minDist[sx][sy] = 0
que = deque([(0, sx, sy)])
while ... | from collections import deque
H, W, K = list(map(int, input().split()))
sx, sy, tx, ty = [int(a) - 1 for a in input().split()]
INF = 10**18
A = [eval(input()) for _ in range(H)]
minDist = [[INF] * W for _ in range(H)]
minDist[sx][sy] = 0
que = deque([(0, sx, sy)])
while que:
dist, nx, ny = que.popleft()
if nx ... | false | 0 | [
"-import sys",
"-input = sys.stdin.buffer.readline",
"-A = [input().decode() for _ in range(H)]",
"+A = [eval(input()) for _ in range(H)]",
"+ if nx == tx and ny == ty:",
"+ break"
] | false | 0.048957 | 0.051359 | 0.953236 | [
"s221005672",
"s860803839"
] |
u194894739 | p03044 | python | s295577768 | s127879693 | 837 | 472 | 72,608 | 68,400 | Accepted | Accepted | 43.61 | from collections import deque
N = int(eval(input()))
adj = [[] for i in range(N)]
for _ in range(N-1):
u, v, w = list(map(int, input().split()))
adj[u-1].append((v-1,w))
adj[v-1].append((u-1,w))
color = [0]*N
visited = [0]*N
visited[0] = 1
q = deque()
q.append((0,0))
while q:
v, l = q... | import sys
input = sys.stdin.readline
from collections import deque
N = int(eval(input()))
adj = [[] for i in range(N)]
for _ in range(N-1):
u, v, w = list(map(int, input().split()))
adj[u-1].append((v-1,w))
adj[v-1].append((u-1,w))
color = [0]*N
visited = [0]*N
visited[0] = 1
q = deque()
q... | 26 | 28 | 505 | 545 | from collections import deque
N = int(eval(input()))
adj = [[] for i in range(N)]
for _ in range(N - 1):
u, v, w = list(map(int, input().split()))
adj[u - 1].append((v - 1, w))
adj[v - 1].append((u - 1, w))
color = [0] * N
visited = [0] * N
visited[0] = 1
q = deque()
q.append((0, 0))
while q:
v, l = q.... | import sys
input = sys.stdin.readline
from collections import deque
N = int(eval(input()))
adj = [[] for i in range(N)]
for _ in range(N - 1):
u, v, w = list(map(int, input().split()))
adj[u - 1].append((v - 1, w))
adj[v - 1].append((u - 1, w))
color = [0] * N
visited = [0] * N
visited[0] = 1
q = deque()
... | false | 7.142857 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.041372 | 0.036477 | 1.134189 | [
"s295577768",
"s127879693"
] |
u519939795 | p03102 | python | s500195527 | s756936209 | 298 | 17 | 21,500 | 3,060 | Accepted | Accepted | 94.3 | import numpy as np
N, M, C = list(map(int, input().split()))
B = np.array(list(map(int, input().split())))
ans = 0
for i in range(N):
tmp = np.dot(np.array(list(map(int, input().split()))), B)
if (tmp.sum() + C) > 0:
ans += 1
print(ans)
| n,m,c=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
sum1=0
for i in range(n):
a=list(map(int,input().split()))
for j in range(m):
sum1+=a[j]*b[j]
if sum1+c>0:
ans+=1
sum1=0
print(ans) | 12 | 12 | 261 | 244 | import numpy as np
N, M, C = list(map(int, input().split()))
B = np.array(list(map(int, input().split())))
ans = 0
for i in range(N):
tmp = np.dot(np.array(list(map(int, input().split()))), B)
if (tmp.sum() + C) > 0:
ans += 1
print(ans)
| n, m, c = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
sum1 = 0
for i in range(n):
a = list(map(int, input().split()))
for j in range(m):
sum1 += a[j] * b[j]
if sum1 + c > 0:
ans += 1
sum1 = 0
print(ans)
| false | 0 | [
"-import numpy as np",
"-",
"-N, M, C = list(map(int, input().split()))",
"-B = np.array(list(map(int, input().split())))",
"+n, m, c = list(map(int, input().split()))",
"+b = list(map(int, input().split()))",
"-for i in range(N):",
"- tmp = np.dot(np.array(list(map(int, input().split()))), B)",
... | false | 0.190422 | 0.034619 | 5.500566 | [
"s500195527",
"s756936209"
] |
u303059352 | p03424 | python | s272499684 | s146570131 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | eval(input())
print(("Four" if "Y" in eval(input()) else "Three")) | print(("TFhoruere"['Y'in open(0).read()::2])) | 2 | 1 | 53 | 43 | eval(input())
print(("Four" if "Y" in eval(input()) else "Three"))
| print(("TFhoruere"["Y" in open(0).read() :: 2]))
| false | 50 | [
"-eval(input())",
"-print((\"Four\" if \"Y\" in eval(input()) else \"Three\"))",
"+print((\"TFhoruere\"[\"Y\" in open(0).read() :: 2]))"
] | false | 0.043375 | 0.043853 | 0.989115 | [
"s272499684",
"s146570131"
] |
u744920373 | p03212 | python | s775064964 | s723693044 | 61 | 50 | 4,272 | 4,008 | Accepted | Accepted | 18.03 | import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return list(map(int, sys.stdin.readline().split()))
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): ret... | import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return list(map(int, sys.stdin.readline().split()))
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): ret... | 31 | 30 | 915 | 878 | import sys
sys.setrecursionlimit(10**8)
def ii():
return int(sys.stdin.readline())
def mi():
return list(map(int, sys.stdin.readline().split()))
def li():
return list(map(int, sys.stdin.readline().split()))
def li2(N):
return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
de... | import sys
sys.setrecursionlimit(10**8)
def ii():
return int(sys.stdin.readline())
def mi():
return list(map(int, sys.stdin.readline().split()))
def li():
return list(map(int, sys.stdin.readline().split()))
def li2(N):
return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
de... | false | 3.225806 | [
"-import itertools # list(accumulate(A))",
"+# import itertools #list(accumulate(A))",
"+# from collections import deque",
"+## FlagをもたせたDFS",
"+N = ii()",
"+ele = [3, 5, 7]",
"+l = []",
"-N = ii()",
"-l = []",
"-for keta in range(3, 10):",
"- for koho in itertools.product([\"3\", \"5\", \"7... | false | 0.055975 | 0.037378 | 1.497549 | [
"s775064964",
"s723693044"
] |
u807864121 | p02984 | python | s772147610 | s120078680 | 752 | 92 | 71,192 | 19,096 | Accepted | Accepted | 87.77 | import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.linalg import spsolve
N = int(input())
A = 2 * np.array(list(map(int, input().split())))
r, c, v = [None] * 2 * N, [None] * 2 * N, [None] * 2 * N
for n in range(N):
r[2 * n] = n
r[2 * n + 1] = n
c[2 * n] = n
c[2 * n + 1] = n + ... | N = int(eval(input()))
A = list(map(int, input().split()))
X = [None] * N
X[0] = sum(A) - 2 * sum(A[1::2])
for n in range(1, N):
X[n] = 2 * A[n - 1] - X[n - 1]
print((' '.join(map(str, X)))) | 18 | 7 | 492 | 190 | import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.linalg import spsolve
N = int(input())
A = 2 * np.array(list(map(int, input().split())))
r, c, v = [None] * 2 * N, [None] * 2 * N, [None] * 2 * N
for n in range(N):
r[2 * n] = n
r[2 * n + 1] = n
c[2 * n] = n
c[2 * n + 1] = n + 1 i... | N = int(eval(input()))
A = list(map(int, input().split()))
X = [None] * N
X[0] = sum(A) - 2 * sum(A[1::2])
for n in range(1, N):
X[n] = 2 * A[n - 1] - X[n - 1]
print((" ".join(map(str, X))))
| false | 61.111111 | [
"-import numpy as np",
"-from scipy.sparse import csr_matrix",
"-from scipy.sparse.linalg import spsolve",
"-",
"-N = int(input())",
"-A = 2 * np.array(list(map(int, input().split())))",
"-r, c, v = [None] * 2 * N, [None] * 2 * N, [None] * 2 * N",
"-for n in range(N):",
"- r[2 * n] = n",
"- ... | false | 0.51516 | 0.043976 | 11.714461 | [
"s772147610",
"s120078680"
] |
u425177436 | p03486 | python | s861325214 | s011960513 | 19 | 17 | 2,940 | 3,064 | Accepted | Accepted | 10.53 | s=eval(input())
t=eval(input())
print(("Yes"if"".join(sorted(s))<"".join(reversed(sorted(t)))else"No")) | print(("Yes"if"".join(sorted(eval(input())))<"".join(sorted(eval(input()))[::-1])else"No")) | 3 | 1 | 91 | 77 | s = eval(input())
t = eval(input())
print(("Yes" if "".join(sorted(s)) < "".join(reversed(sorted(t))) else "No"))
| print(
(
"Yes"
if "".join(sorted(eval(input()))) < "".join(sorted(eval(input()))[::-1])
else "No"
)
)
| false | 66.666667 | [
"-s = eval(input())",
"-t = eval(input())",
"-print((\"Yes\" if \"\".join(sorted(s)) < \"\".join(reversed(sorted(t))) else \"No\"))",
"+print(",
"+ (",
"+ \"Yes\"",
"+ if \"\".join(sorted(eval(input()))) < \"\".join(sorted(eval(input()))[::-1])",
"+ else \"No\"",
"+ )",
... | false | 0.04085 | 0.048747 | 0.838004 | [
"s861325214",
"s011960513"
] |
u279493135 | p03175 | python | s595827248 | s724032160 | 623 | 442 | 167,908 | 124,516 | Accepted | Accepted | 29.05 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, islice
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, a... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, islice
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, a... | 48 | 41 | 1,503 | 1,204 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, islice
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_u... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, islice
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_u... | false | 14.583333 | [
"-@lru_cache(maxsize=None)",
"-def DFS(i, par, c): # c:0->white, 1->black",
"- if par and len(tree[i]) == 1:",
"- return 1",
"- if c == 0:",
"- cnt = 1",
"- for node in tree[i]:",
"- if node != par:",
"- cnt *= DFS(node, i, 0) + DFS(node, i, 1)",... | false | 0.03825 | 0.037143 | 1.029816 | [
"s595827248",
"s724032160"
] |
u331606500 | p03078 | python | s724855492 | s288191795 | 1,029 | 134 | 141,000 | 9,584 | Accepted | Accepted | 86.98 | r=range;x,y,z,k=list(map(int,input().split()))
a,b,c=eval("list(map(int,input().split())), "*3)
ab=sorted([a[i]+b[j]for i in r(x)for j in r(y)],reverse=True)
abc=sorted([ab[i]+c[j]for i in r(min(3000,x*y))for j in r(z)],reverse=True)
print((*[abc[i]for i in r(k)])) | r=range;x,y,z,k=list(map(int,input().split()))
a,b,c=eval("sorted(list(map(int,input().split())),reverse=True),"*3)
abc=[]
for l in r(x):
for m in r(y):
if -~l*-~m>k:break
for n in r(z):
if -~l*-~m*-~n>k:break
abc+=[a[l]+b[m]+c[n]]
print((*sorted(abc,reverse=True)[:k])) | 5 | 10 | 261 | 282 | r = range
x, y, z, k = list(map(int, input().split()))
a, b, c = eval("list(map(int,input().split())), " * 3)
ab = sorted([a[i] + b[j] for i in r(x) for j in r(y)], reverse=True)
abc = sorted([ab[i] + c[j] for i in r(min(3000, x * y)) for j in r(z)], reverse=True)
print((*[abc[i] for i in r(k)]))
| r = range
x, y, z, k = list(map(int, input().split()))
a, b, c = eval("sorted(list(map(int,input().split())),reverse=True)," * 3)
abc = []
for l in r(x):
for m in r(y):
if -~l * -~m > k:
break
for n in r(z):
if -~l * -~m * -~n > k:
break
abc += [a[... | false | 50 | [
"-a, b, c = eval(\"list(map(int,input().split())), \" * 3)",
"-ab = sorted([a[i] + b[j] for i in r(x) for j in r(y)], reverse=True)",
"-abc = sorted([ab[i] + c[j] for i in r(min(3000, x * y)) for j in r(z)], reverse=True)",
"-print((*[abc[i] for i in r(k)]))",
"+a, b, c = eval(\"sorted(list(map(int,input().... | false | 0.03545 | 0.036085 | 0.982403 | [
"s724855492",
"s288191795"
] |
u921773161 | p03211 | python | s913102539 | s714507271 | 297 | 17 | 21,676 | 2,940 | Accepted | Accepted | 94.28 | import numpy as np
S = eval(input())
l = []
for i in range(len(S)-2):
l.append(int(S[i:i+3]))
l = np.array(l)
l -= 753
for i in range(len(l)):
if l[i] <0:
l[i] = - l[i]
print((min(l))) | S = eval(input())
l = []
for i in range(len(S)-2):
tmp = int(S[i:i+3])
l.append(abs(tmp-753))
print((min(l)))
| 14 | 7 | 208 | 117 | import numpy as np
S = eval(input())
l = []
for i in range(len(S) - 2):
l.append(int(S[i : i + 3]))
l = np.array(l)
l -= 753
for i in range(len(l)):
if l[i] < 0:
l[i] = -l[i]
print((min(l)))
| S = eval(input())
l = []
for i in range(len(S) - 2):
tmp = int(S[i : i + 3])
l.append(abs(tmp - 753))
print((min(l)))
| false | 50 | [
"-import numpy as np",
"-",
"- l.append(int(S[i : i + 3]))",
"-l = np.array(l)",
"-l -= 753",
"-for i in range(len(l)):",
"- if l[i] < 0:",
"- l[i] = -l[i]",
"+ tmp = int(S[i : i + 3])",
"+ l.append(abs(tmp - 753))"
] | false | 0.192423 | 0.035933 | 5.355056 | [
"s913102539",
"s714507271"
] |
u671060652 | p02700 | python | s627939163 | s705958293 | 99 | 69 | 72,804 | 61,764 | Accepted | Accepted | 30.3 | import itertools
import math
import fractions
import functools
a, b, c, d = list(map(int, input().split()))
# if c // b > a // d:
# print("Yes")
# else:
# print("No")
while c > 0 and a > 0:
c = c - b
if c <= 0:
print('Yes')
quit()
a = a - d
if a<= 0:
... | a, b, c, d = list(map(int, input().split()))
if (c+b-1) // b <= (a+d-1) // d:
print("Yes")
else:
print("No") | 22 | 7 | 348 | 118 | import itertools
import math
import fractions
import functools
a, b, c, d = list(map(int, input().split()))
# if c // b > a // d:
# print("Yes")
# else:
# print("No")
while c > 0 and a > 0:
c = c - b
if c <= 0:
print("Yes")
quit()
a = a - d
if a <= 0:
print("No")
... | a, b, c, d = list(map(int, input().split()))
if (c + b - 1) // b <= (a + d - 1) // d:
print("Yes")
else:
print("No")
| false | 68.181818 | [
"-import itertools",
"-import math",
"-import fractions",
"-import functools",
"-",
"-# if c // b > a // d:",
"-# print(\"Yes\")",
"-# else:",
"-# print(\"No\")",
"-while c > 0 and a > 0:",
"- c = c - b",
"- if c <= 0:",
"- print(\"Yes\")",
"- quit()",
"- a... | false | 0.043975 | 0.042383 | 1.037558 | [
"s627939163",
"s705958293"
] |
u688055251 | p02612 | python | s402101335 | s476442426 | 33 | 28 | 9,100 | 9,104 | Accepted | Accepted | 15.15 | n=int(eval(input()))
res=0
cont=1
while n>0:
n=n-(1000*cont)
print((abs(n))) | n = int(eval(input()))
while n>0:
n=n-1000
print((abs(n)))
| 7 | 6 | 79 | 62 | n = int(eval(input()))
res = 0
cont = 1
while n > 0:
n = n - (1000 * cont)
print((abs(n)))
| n = int(eval(input()))
while n > 0:
n = n - 1000
print((abs(n)))
| false | 14.285714 | [
"-res = 0",
"-cont = 1",
"- n = n - (1000 * cont)",
"+ n = n - 1000"
] | false | 0.099018 | 0.039041 | 2.536216 | [
"s402101335",
"s476442426"
] |
u186838327 | p04034 | python | s989980357 | s391780331 | 319 | 193 | 75,888 | 75,932 | Accepted | Accepted | 39.5 | n, m = list(map(int, input().split()))
X = [0]*n
C = [1]*n
X[0] = 1
for i in range(m):
x, y = list(map(int, input().split()))
x, y = x-1, y-1
if X[x] == 1:
X[y] = 1
if C[x] == 1:
X[x] = 0
C[x] -= 1
C[y] += 1
else:
C[x] -= 1
C... | n, m = list(map(int, input().split()))
X = [0]*n
X[0] = 1
C = [1]*n
for i in range(m):
x, y = list(map(int, input().split()))
x, y = x-1, y-1
if X[x] == 1:
if C[x] == 1:
X[x] = 0
X[y] = 1
C[x] -= 1
C[y] += 1
else:
X[x]... | 21 | 23 | 345 | 447 | n, m = list(map(int, input().split()))
X = [0] * n
C = [1] * n
X[0] = 1
for i in range(m):
x, y = list(map(int, input().split()))
x, y = x - 1, y - 1
if X[x] == 1:
X[y] = 1
if C[x] == 1:
X[x] = 0
C[x] -= 1
C[y] += 1
else:
C[x] -= 1
C[y] += 1
an... | n, m = list(map(int, input().split()))
X = [0] * n
X[0] = 1
C = [1] * n
for i in range(m):
x, y = list(map(int, input().split()))
x, y = x - 1, y - 1
if X[x] == 1:
if C[x] == 1:
X[x] = 0
X[y] = 1
C[x] -= 1
C[y] += 1
else:
X[x] = 1
... | false | 8.695652 | [
"+X[0] = 1",
"-X[0] = 1",
"- X[y] = 1",
"- C[x] -= 1",
"- C[y] += 1",
"+ X[y] = 1",
"+ C[x] -= 1",
"+ C[y] += 1",
"+ else:",
"+ X[x] = 1",
"+ X[y] = 1",
"+ C[x] -= 1",
"+ C[y] += 1",
"-... | false | 0.065916 | 0.070627 | 0.933293 | [
"s989980357",
"s391780331"
] |
u588341295 | p02791 | python | s437962816 | s917937410 | 1,292 | 97 | 25,864 | 25,860 | Accepted | Accepted | 92.49 | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | 68 | 30 | 1,678 | 815 | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d for j in range(c)] for j in rang... | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d for j in range(c)] for j in rang... | false | 55.882353 | [
"-",
"-",
"-class BIT:",
"- \"\"\"Binary Indexed Tree\"\"\"",
"-",
"- def __init__(self, n):",
"- # 0-indexed",
"- n += 1",
"- nv = 1",
"- while nv < n:",
"- nv *= 2",
"- self.size = nv",
"- self.tree = [0] * nv",
"-",
"- def ... | false | 0.111125 | 0.046208 | 2.404895 | [
"s437962816",
"s917937410"
] |
u394731058 | p02699 | python | s367439832 | s171163272 | 23 | 19 | 9,100 | 9,136 | Accepted | Accepted | 17.39 | def main():
ans = 'safe'
s,w = list(map(int, input().split()))
if w >= s:
ans = 'unsafe'
print(ans)
if __name__ == '__main__':
main() | s,w = list(map(int, input().split()))
if s <= w:
print('unsafe')
else:
print('safe') | 10 | 5 | 170 | 86 | def main():
ans = "safe"
s, w = list(map(int, input().split()))
if w >= s:
ans = "unsafe"
print(ans)
if __name__ == "__main__":
main()
| s, w = list(map(int, input().split()))
if s <= w:
print("unsafe")
else:
print("safe")
| false | 50 | [
"-def main():",
"- ans = \"safe\"",
"- s, w = list(map(int, input().split()))",
"- if w >= s:",
"- ans = \"unsafe\"",
"- print(ans)",
"-",
"-",
"-if __name__ == \"__main__\":",
"- main()",
"+s, w = list(map(int, input().split()))",
"+if s <= w:",
"+ print(\"unsafe\")... | false | 0.041436 | 0.074207 | 0.558388 | [
"s367439832",
"s171163272"
] |
u972658925 | p03427 | python | s733201115 | s799316347 | 29 | 26 | 9,200 | 9,112 | Accepted | Accepted | 10.34 | def ketawa(x):
l = list(str(x))
wa = 0
for a in l:
wa += int(a)
return wa
n = int(eval(input()))
lst = list(str(n))
keta = len(str(n))
nine = int("".join([lst[0]] + ["9"]*(keta-1)))
if nine <= n:
print((ketawa(nine)))
else:
lst_head = str(int(lst[0]) - 1)
ni... | n = int(eval(input()))
lst = list(map(int,str(n)))
if len(lst) == 1:
print(n)
elif set(lst[1:]) == {9}:
print((lst[0] + 9*(len(lst)-1)))
else:
print(((lst[0]-1) + 9*(len(lst)-1))) | 22 | 9 | 383 | 190 | def ketawa(x):
l = list(str(x))
wa = 0
for a in l:
wa += int(a)
return wa
n = int(eval(input()))
lst = list(str(n))
keta = len(str(n))
nine = int("".join([lst[0]] + ["9"] * (keta - 1)))
if nine <= n:
print((ketawa(nine)))
else:
lst_head = str(int(lst[0]) - 1)
nine = int("".join([ls... | n = int(eval(input()))
lst = list(map(int, str(n)))
if len(lst) == 1:
print(n)
elif set(lst[1:]) == {9}:
print((lst[0] + 9 * (len(lst) - 1)))
else:
print(((lst[0] - 1) + 9 * (len(lst) - 1)))
| false | 59.090909 | [
"-def ketawa(x):",
"- l = list(str(x))",
"- wa = 0",
"- for a in l:",
"- wa += int(a)",
"- return wa",
"-",
"-",
"-lst = list(str(n))",
"-keta = len(str(n))",
"-nine = int(\"\".join([lst[0]] + [\"9\"] * (keta - 1)))",
"-if nine <= n:",
"- print((ketawa(nine)))",
"+lst... | false | 0.039467 | 0.052097 | 0.757571 | [
"s733201115",
"s799316347"
] |
u150984829 | p02414 | python | s508971380 | s987136922 | 120 | 110 | 7,008 | 6,996 | Accepted | Accepted | 8.33 | n,m,l=map(int,input().split())
a=[list(map(int,input().split()))for _ in range(n)]
b=[list(map(int,input().split()))for _ in range(m)]
[print(*x)for x in[[sum([s*t for s,t in zip(c,l)])for l in zip(*b)]for c in a]]
| n,m,l=list(map(int,input().split()))
a=[list(map(int,input().split()))for _ in range(n)]
b=[list(map(int,input().split()))for _ in range(m)]
for x in[[sum([s*t for s,t in zip(c,l)])for l in zip(*b)]for c in a]:print((*x))
| 4 | 4 | 217 | 217 | n, m, l = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]
b = [list(map(int, input().split())) for _ in range(m)]
[print(*x) for x in [[sum([s * t for s, t in zip(c, l)]) for l in zip(*b)] for c in a]]
| n, m, l = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n)]
b = [list(map(int, input().split())) for _ in range(m)]
for x in [[sum([s * t for s, t in zip(c, l)]) for l in zip(*b)] for c in a]:
print((*x))
| false | 0 | [
"-n, m, l = map(int, input().split())",
"+n, m, l = list(map(int, input().split()))",
"-[print(*x) for x in [[sum([s * t for s, t in zip(c, l)]) for l in zip(*b)] for c in a]]",
"+for x in [[sum([s * t for s, t in zip(c, l)]) for l in zip(*b)] for c in a]:",
"+ print((*x))"
] | false | 0.041735 | 0.12177 | 0.342736 | [
"s508971380",
"s987136922"
] |
u606045429 | p02874 | python | s232603078 | s319024910 | 542 | 299 | 24,940 | 27,440 | Accepted | Accepted | 44.83 | def main():
N = int(eval(input()))
L, R = [0] * N, [0] * N
for i in range(N):
L[i], R[i] = list(map(int, input().split()))
max_l = max(L)
min_r = min(R)
ab = [(max(0, r - max_l + 1), -max(0, min_r - l + 1)) for l, r in zip(L, R)]
ab.sort()
mi = float("inf")
ma... | from sys import stdin
def main():
N, *LR = list(map(int, stdin.buffer.read().split()))
L, R = LR[::2], LR[1::2]
max_l = max(L)
min_r = min(R)
ab = [(max(0, r - max_l + 1), -max(0, min_r - l + 1)) for l, r in zip(L, R)]
ab.sort()
mi = float("inf")
ma = max(r - l + 1 for l... | 21 | 22 | 505 | 489 | def main():
N = int(eval(input()))
L, R = [0] * N, [0] * N
for i in range(N):
L[i], R[i] = list(map(int, input().split()))
max_l = max(L)
min_r = min(R)
ab = [(max(0, r - max_l + 1), -max(0, min_r - l + 1)) for l, r in zip(L, R)]
ab.sort()
mi = float("inf")
ma = max(r - l + 1... | from sys import stdin
def main():
N, *LR = list(map(int, stdin.buffer.read().split()))
L, R = LR[::2], LR[1::2]
max_l = max(L)
min_r = min(R)
ab = [(max(0, r - max_l + 1), -max(0, min_r - l + 1)) for l, r in zip(L, R)]
ab.sort()
mi = float("inf")
ma = max(r - l + 1 for l, r in zip(L, R... | false | 4.545455 | [
"+from sys import stdin",
"+",
"+",
"- N = int(eval(input()))",
"- L, R = [0] * N, [0] * N",
"- for i in range(N):",
"- L[i], R[i] = list(map(int, input().split()))",
"+ N, *LR = list(map(int, stdin.buffer.read().split()))",
"+ L, R = LR[::2], LR[1::2]",
"- for i in range(... | false | 0.060696 | 0.036827 | 1.648128 | [
"s232603078",
"s319024910"
] |
u891635666 | p02912 | python | s789079770 | s842896981 | 686 | 163 | 145,064 | 14,180 | Accepted | Accepted | 76.24 | n, m = list(map(int, input().split()))
ps = list(map(int, input().split()))
s = sum(ps)
ls = []
for p in ps:
prev = p
while p > 0:
p //= 2
ls.append(prev - p)
prev = p
ls.sort(reverse=True)
print((s - sum(ls[:m]))) | import heapq
n, m = list(map(int, input().split()))
ps = list([-x for x in list(map(int, input().split()))])
heapq.heapify(ps)
for _ in range(m):
p = -heapq.heappop(ps)
heapq.heappush(ps, -(p // 2))
print((-sum(ps))) | 12 | 10 | 249 | 226 | n, m = list(map(int, input().split()))
ps = list(map(int, input().split()))
s = sum(ps)
ls = []
for p in ps:
prev = p
while p > 0:
p //= 2
ls.append(prev - p)
prev = p
ls.sort(reverse=True)
print((s - sum(ls[:m])))
| import heapq
n, m = list(map(int, input().split()))
ps = list([-x for x in list(map(int, input().split()))])
heapq.heapify(ps)
for _ in range(m):
p = -heapq.heappop(ps)
heapq.heappush(ps, -(p // 2))
print((-sum(ps)))
| false | 16.666667 | [
"+import heapq",
"+",
"-ps = list(map(int, input().split()))",
"-s = sum(ps)",
"-ls = []",
"-for p in ps:",
"- prev = p",
"- while p > 0:",
"- p //= 2",
"- ls.append(prev - p)",
"- prev = p",
"-ls.sort(reverse=True)",
"-print((s - sum(ls[:m])))",
"+ps = list([-x ... | false | 0.041662 | 0.104522 | 0.398594 | [
"s789079770",
"s842896981"
] |
u761320129 | p03674 | python | s069519604 | s266971365 | 1,508 | 398 | 29,164 | 33,324 | Accepted | Accepted | 73.61 | from collections import Counter
N = int(input())
src = list(map(int,input().split()))
ctr = Counter(src)
most = ctr.most_common(1)[0][0]
i1 = src.index(most)
i2 = src[i1+1:].index(most) + i1+1
d = i2 - i1
MOD = 10**9+7
def mul(a,b):
return (a*b) % MOD
def pow(a,n): # a^n
ret = 1
mag =... | from collections import Counter
N = int(input())
src = list(map(int,input().split()))
ctr = Counter(src)
doub = ctr.most_common()[0][0]
i1 = src.index(doub)
i2 = src[::-1].index(doub)
doub_len = (i1+i2+1)
MOD = 10**9+7
fac = [1,1] + [0]*N
finv = [1,1] + [0]*N
inv = [0,1] + [0]*N
for i in range(2,N+2):
... | 48 | 31 | 862 | 731 | from collections import Counter
N = int(input())
src = list(map(int, input().split()))
ctr = Counter(src)
most = ctr.most_common(1)[0][0]
i1 = src.index(most)
i2 = src[i1 + 1 :].index(most) + i1 + 1
d = i2 - i1
MOD = 10**9 + 7
def mul(a, b):
return (a * b) % MOD
def pow(a, n): # a^n
ret = 1
mag = a
... | from collections import Counter
N = int(input())
src = list(map(int, input().split()))
ctr = Counter(src)
doub = ctr.most_common()[0][0]
i1 = src.index(doub)
i2 = src[::-1].index(doub)
doub_len = i1 + i2 + 1
MOD = 10**9 + 7
fac = [1, 1] + [0] * N
finv = [1, 1] + [0] * N
inv = [0, 1] + [0] * N
for i in range(2, N + 2):... | false | 35.416667 | [
"-most = ctr.most_common(1)[0][0]",
"-i1 = src.index(most)",
"-i2 = src[i1 + 1 :].index(most) + i1 + 1",
"-d = i2 - i1",
"+doub = ctr.most_common()[0][0]",
"+i1 = src.index(doub)",
"+i2 = src[::-1].index(doub)",
"+doub_len = i1 + i2 + 1",
"-",
"-",
"-def mul(a, b):",
"- return (a * b) % MOD... | false | 0.037582 | 0.036065 | 1.042061 | [
"s069519604",
"s266971365"
] |
u569960318 | p02272 | python | s080998844 | s627474162 | 4,960 | 4,270 | 63,772 | 63,748 | Accepted | Accepted | 13.91 | cnt = 0
def merge(L,R):
global cnt
A = []
i = j = 0
n = len(L)+len(R)
L.append(float("inf"))
R.append(float("inf"))
for _ in range(n):
cnt += 1
if L[i] <= R[j]:
A.append(L[i])
i += 1
else:
A.append(R[j])
j... | cnt = 0
def merge(L,R):
global cnt
n = len(L)+len(R)
cnt += n
A = []
i = j = 0
L.append(float("inf"))
R.append(float("inf"))
for _ in range(n):
if L[i] <= R[j]:
A.append(L[i])
i += 1
else:
A.append(R[j])
j += ... | 29 | 29 | 596 | 592 | cnt = 0
def merge(L, R):
global cnt
A = []
i = j = 0
n = len(L) + len(R)
L.append(float("inf"))
R.append(float("inf"))
for _ in range(n):
cnt += 1
if L[i] <= R[j]:
A.append(L[i])
i += 1
else:
A.append(R[j])
j += 1
... | cnt = 0
def merge(L, R):
global cnt
n = len(L) + len(R)
cnt += n
A = []
i = j = 0
L.append(float("inf"))
R.append(float("inf"))
for _ in range(n):
if L[i] <= R[j]:
A.append(L[i])
i += 1
else:
A.append(R[j])
j += 1
retu... | false | 0 | [
"+ n = len(L) + len(R)",
"+ cnt += n",
"- n = len(L) + len(R)",
"- cnt += 1"
] | false | 0.035805 | 0.035252 | 1.015684 | [
"s080998844",
"s627474162"
] |
u992910889 | p02831 | python | s742911236 | s225565345 | 288 | 40 | 65,388 | 5,304 | Accepted | Accepted | 86.11 | # import bisect
# import copy
import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product
def resolve():
A,B=list(map(int,input().split()))
print((A*B//fractions.gcd(A,... | import fractions
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()
def resolve():
A,B=list(map(int,input().split()))
val=A* B //fractions.gcd(A, B)
print(val)
resolve()
| 14 | 11 | 331 | 233 | # import bisect
# import copy
import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product
def resolve():
A, B = list(map(int, input().split()))
print((A * B // fractions.gcd(A, B... | import fractions
import sys
sys.setrecursionlimit(10**5 + 10)
def input():
return sys.stdin.readline().strip()
def resolve():
A, B = list(map(int, input().split()))
val = A * B // fractions.gcd(A, B)
print(val)
resolve()
| false | 21.428571 | [
"-# import bisect",
"-# import copy",
"+import sys",
"-# import math",
"-# import numpy as np",
"-# from collections import Counter, deque",
"-# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product",
"+sys.setrecursionlimit(10**5 + 10)",
"+",
"+",
"+d... | false | 0.043728 | 0.125762 | 0.347701 | [
"s742911236",
"s225565345"
] |
u556589653 | p02682 | python | s377183974 | s502804959 | 24 | 20 | 9,160 | 9,136 | Accepted | Accepted | 16.67 | #Solver:Rute
a,b,c,k = list(map(int,input().split()))
if k<=a:
print(k)
elif a<k<a+b:
print(k)
else:
#-1のカードの枚数超過 (k-(a+b))枚
print((a-(k-(a+b)))) | #Solver:Rute
a,b,c,k = list(map(int,input().split()))
if 0<=k<=a:
print(k)
elif a<k<=a+b:
print(a)
else:
print((a-(k-(a+b)))) | 9 | 8 | 153 | 130 | # Solver:Rute
a, b, c, k = list(map(int, input().split()))
if k <= a:
print(k)
elif a < k < a + b:
print(k)
else:
# -1のカードの枚数超過 (k-(a+b))枚
print((a - (k - (a + b))))
| # Solver:Rute
a, b, c, k = list(map(int, input().split()))
if 0 <= k <= a:
print(k)
elif a < k <= a + b:
print(a)
else:
print((a - (k - (a + b))))
| false | 11.111111 | [
"-if k <= a:",
"+if 0 <= k <= a:",
"-elif a < k < a + b:",
"- print(k)",
"+elif a < k <= a + b:",
"+ print(a)",
"- # -1のカードの枚数超過 (k-(a+b))枚"
] | false | 0.050614 | 0.049395 | 1.024689 | [
"s377183974",
"s502804959"
] |
u083960235 | p03208 | python | s076924997 | s990332446 | 227 | 168 | 7,384 | 8,120 | Accepted | Accepted | 25.99 | n,k=list(map(int,input().split()))
h=[int(eval(input())) for i in range(n)]
h.sort()
#for i in range(n-k+1):
print((min(h[i+k-1]-h[i] for i in range(n-k+1))))
| import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | 6 | 28 | 154 | 885 | n, k = list(map(int, input().split()))
h = [int(eval(input())) for i in range(n)]
h.sort()
# for i in range(n-k+1):
print((min(h[i + k - 1] - h[i] for i in range(n - k + 1))))
| import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | false | 78.571429 | [
"-n, k = list(map(int, input().split()))",
"-h = [int(eval(input())) for i in range(n)]",
"-h.sort()",
"-# for i in range(n-k+1):",
"-print((min(h[i + k - 1] - h[i] for i in range(n - k + 1))))",
"+import sys, re, os",
"+from collections import deque, defaultdict, Counter",
"+from math import ceil, sq... | false | 0.047918 | 0.070587 | 0.678847 | [
"s076924997",
"s990332446"
] |
u658627575 | p03043 | python | s964262307 | s248994197 | 50 | 34 | 2,940 | 2,940 | Accepted | Accepted | 32 | import math
N, K = list(map(int,input().split()))
#N, K = 100000, 5
ans = 0
for i in range(1,N+1):
a = i
b = 1
while a < K:
a *= 2
b *= 0.50000000000
ans += b
print((ans/N))
| import math
N, K = list(map(int,input().split()))
#N, K = 100000, 5
ans = 0
total = 0
for i in range(0,N):
if i < K:
#dice_times = math.ceil(math.log2(K/(i+1)))
dice_times = math.ceil(math.log2(K/(i+1)))
total = total + (0.50000000000**dice_times)
#print(total)
else:
total += 1
print((tota... | 16 | 17 | 193 | 318 | import math
N, K = list(map(int, input().split()))
# N, K = 100000, 5
ans = 0
for i in range(1, N + 1):
a = i
b = 1
while a < K:
a *= 2
b *= 0.50000000000
ans += b
print((ans / N))
| import math
N, K = list(map(int, input().split()))
# N, K = 100000, 5
ans = 0
total = 0
for i in range(0, N):
if i < K:
# dice_times = math.ceil(math.log2(K/(i+1)))
dice_times = math.ceil(math.log2(K / (i + 1)))
total = total + (0.50000000000**dice_times)
# print(total)
else:
... | false | 5.882353 | [
"-for i in range(1, N + 1):",
"- a = i",
"- b = 1",
"- while a < K:",
"- a *= 2",
"- b *= 0.50000000000",
"- ans += b",
"-print((ans / N))",
"+total = 0",
"+for i in range(0, N):",
"+ if i < K:",
"+ # dice_times = math.ceil(math.log2(K/(i+1)))",
"+ ... | false | 0.050937 | 0.047622 | 1.069616 | [
"s964262307",
"s248994197"
] |
u805332733 | p02713 | python | s320185982 | s225391620 | 1,819 | 1,034 | 71,968 | 72,184 | Accepted | Accepted | 43.16 | from math import gcd
from functools import reduce
import itertools
def resolve():
K = int(eval(input()))
gcds = sum([ gcd(gcd(x[0], x[1]), x[2]) for x in itertools.product(list(range(1, K+1)), list(range(1, K+1)), list(range(1, K+1))) ])
print(gcds)
if __name__ == "__main__":
resolve() | from math import gcd
from functools import reduce
from itertools import product
def resolve():
K = int(eval(input()))
# result = sum([ gcd(gcd(x[0], x[1]), x[2]) for x in itertools.product(range(1, K+1), range(1, K+1), range(1, K+1)) ])
step1 = [ gcd(x[0], x[1]) for x in product(list(range(1, K+1)), list(... | 11 | 13 | 285 | 457 | from math import gcd
from functools import reduce
import itertools
def resolve():
K = int(eval(input()))
gcds = sum(
[
gcd(gcd(x[0], x[1]), x[2])
for x in itertools.product(
list(range(1, K + 1)), list(range(1, K + 1)), list(range(1, K + 1))
)
... | from math import gcd
from functools import reduce
from itertools import product
def resolve():
K = int(eval(input()))
# result = sum([ gcd(gcd(x[0], x[1]), x[2]) for x in itertools.product(range(1, K+1), range(1, K+1), range(1, K+1)) ])
step1 = [
gcd(x[0], x[1]) for x in product(list(range(1, K + ... | false | 15.384615 | [
"-import itertools",
"+from itertools import product",
"- gcds = sum(",
"- [",
"- gcd(gcd(x[0], x[1]), x[2])",
"- for x in itertools.product(",
"- list(range(1, K + 1)), list(range(1, K + 1)), list(range(1, K + 1))",
"- )",
"- ]",
"-... | false | 0.102795 | 0.094783 | 1.084528 | [
"s320185982",
"s225391620"
] |
u077291787 | p03197 | python | s070388722 | s572656301 | 237 | 216 | 71,228 | 71,228 | Accepted | Accepted | 8.86 | # caddi2018D - Harlequin
def main():
N, *A = list(map(int, open(0).read().split()))
flg = all(i % 2 == 0 for i in A)
print(("second" if flg else "first"))
if __name__ == "__main__":
main() | # caddi2018D - Harlequin
def main():
N, *A = list(map(int, open(0).read().split()))
flg = any(i & 1 for i in A)
print(("first" if flg else "second"))
if __name__ == "__main__":
main() | 9 | 9 | 206 | 201 | # caddi2018D - Harlequin
def main():
N, *A = list(map(int, open(0).read().split()))
flg = all(i % 2 == 0 for i in A)
print(("second" if flg else "first"))
if __name__ == "__main__":
main()
| # caddi2018D - Harlequin
def main():
N, *A = list(map(int, open(0).read().split()))
flg = any(i & 1 for i in A)
print(("first" if flg else "second"))
if __name__ == "__main__":
main()
| false | 0 | [
"- flg = all(i % 2 == 0 for i in A)",
"- print((\"second\" if flg else \"first\"))",
"+ flg = any(i & 1 for i in A)",
"+ print((\"first\" if flg else \"second\"))"
] | false | 0.043211 | 0.042431 | 1.018384 | [
"s070388722",
"s572656301"
] |
u753803401 | p02901 | python | s641378118 | s607433251 | 359 | 210 | 43,228 | 42,460 | Accepted | Accepted | 41.5 | import sys
def solve():
input = sys.stdin.readline
mod = 10 ** 9 + 7
n, m = list(map(int, input().rstrip('\n').split()))
pw = 2 ** n
dp = [10 ** 20] * pw
dp[0] = 0
for i in range(m):
a, b = list(map(int, input().rstrip('\n').split()))
c = sum(2 ** (i - 1) for i ... | import sys
def solve():
input = sys.stdin.readline
mod = 10 ** 9 + 7
n, m = list(map(int, input().rstrip('\n').split()))
pw = pow(2, n)
dp = [10 ** 15] * pw
dp[0] = 0
for _ in range(m):
a, b = list(map(int, input().rstrip('\n').split()))
c = sum(2 ** (i - 1) for... | 24 | 20 | 602 | 546 | import sys
def solve():
input = sys.stdin.readline
mod = 10**9 + 7
n, m = list(map(int, input().rstrip("\n").split()))
pw = 2**n
dp = [10**20] * pw
dp[0] = 0
for i in range(m):
a, b = list(map(int, input().rstrip("\n").split()))
c = sum(2 ** (i - 1) for i in list(map(int, i... | import sys
def solve():
input = sys.stdin.readline
mod = 10**9 + 7
n, m = list(map(int, input().rstrip("\n").split()))
pw = pow(2, n)
dp = [10**15] * pw
dp[0] = 0
for _ in range(m):
a, b = list(map(int, input().rstrip("\n").split()))
c = sum(2 ** (i - 1) for i in list(map(i... | false | 16.666667 | [
"- pw = 2**n",
"- dp = [10**20] * pw",
"+ pw = pow(2, n)",
"+ dp = [10**15] * pw",
"- for i in range(m):",
"+ for _ in range(m):",
"- for j in range(pw):",
"- if dp[j | c] > dp[j] + a:",
"- dp[j | c] = dp[j] + a",
"- if dp[-1] == 10**20:",
"-... | false | 0.036943 | 0.1024 | 0.360776 | [
"s641378118",
"s607433251"
] |
u941407962 | p02888 | python | s533019647 | s667493721 | 1,992 | 1,339 | 84,216 | 3,188 | Accepted | Accepted | 32.78 | n = int(eval(input()))
xs = list(map(int, input().split()))
xs = sorted(list(xs))
ts = []
for i in range(n):
for j in range(i+1, n):
ts.append(xs[i] + xs[j])
ts.sort()
i = 0
j = 0
r = 0
xs.append(10**18)
while True:
if j == len(xs) or i == len(ts):
break
if ts[i] <= xs[j]:
... | n = int(eval(input()))
X = list(map(int, input().split()))
X.sort()
k=r=0
for i in range(n):
k = i
for j in range(i+1, n):
while k<n and X[i]+X[j]>X[k]:
k +=1
r += k-j-1
print(r)
| 21 | 11 | 395 | 219 | n = int(eval(input()))
xs = list(map(int, input().split()))
xs = sorted(list(xs))
ts = []
for i in range(n):
for j in range(i + 1, n):
ts.append(xs[i] + xs[j])
ts.sort()
i = 0
j = 0
r = 0
xs.append(10**18)
while True:
if j == len(xs) or i == len(ts):
break
if ts[i] <= xs[j]:
i += 1
... | n = int(eval(input()))
X = list(map(int, input().split()))
X.sort()
k = r = 0
for i in range(n):
k = i
for j in range(i + 1, n):
while k < n and X[i] + X[j] > X[k]:
k += 1
r += k - j - 1
print(r)
| false | 47.619048 | [
"-xs = list(map(int, input().split()))",
"-xs = sorted(list(xs))",
"-ts = []",
"+X = list(map(int, input().split()))",
"+X.sort()",
"+k = r = 0",
"+ k = i",
"- ts.append(xs[i] + xs[j])",
"-ts.sort()",
"-i = 0",
"-j = 0",
"-r = 0",
"-xs.append(10**18)",
"-while True:",
"- if ... | false | 0.041135 | 0.041262 | 0.99692 | [
"s533019647",
"s667493721"
] |
u879309973 | p02580 | python | s448391295 | s829526079 | 1,573 | 1,354 | 183,620 | 166,020 | Accepted | Accepted | 13.92 | import numpy as np
def solve(H, W, M, h, w):
f = [0] * (H+1)
g = [0] * (W+1)
for r, c in zip(h, w):
f[r] += 1
g[c] += 1
p = np.max(f)
q = np.max(g)
num = len(list(filter(p.__eq__, f))) * len(list(filter(q.__eq__, g)))
for r, c in zip(h, w):
if (f[r] == p)... | def solve(H, W, M, h, w):
f = [0] * (H+1)
g = [0] * (W+1)
for r, c in zip(h, w):
f[r] += 1
g[c] += 1
p = max(f)
q = max(g)
num = len(list(filter(p.__eq__, f))) * len(list(filter(q.__eq__, g)))
num -= len(list([_ for _ in zip(h, w) if f[_[0]] + g[_[1]] == p + q]))
... | 19 | 15 | 518 | 478 | import numpy as np
def solve(H, W, M, h, w):
f = [0] * (H + 1)
g = [0] * (W + 1)
for r, c in zip(h, w):
f[r] += 1
g[c] += 1
p = np.max(f)
q = np.max(g)
num = len(list(filter(p.__eq__, f))) * len(list(filter(q.__eq__, g)))
for r, c in zip(h, w):
if (f[r] == p) and (g... | def solve(H, W, M, h, w):
f = [0] * (H + 1)
g = [0] * (W + 1)
for r, c in zip(h, w):
f[r] += 1
g[c] += 1
p = max(f)
q = max(g)
num = len(list(filter(p.__eq__, f))) * len(list(filter(q.__eq__, g)))
num -= len(list([_ for _ in zip(h, w) if f[_[0]] + g[_[1]] == p + q]))
retu... | false | 21.052632 | [
"-import numpy as np",
"-",
"-",
"- p = np.max(f)",
"- q = np.max(g)",
"+ p = max(f)",
"+ q = max(g)",
"- for r, c in zip(h, w):",
"- if (f[r] == p) and (g[c] == q):",
"- num -= 1",
"+ num -= len(list([_ for _ in zip(h, w) if f[_[0]] + g[_[1]] == p + q]))"
] | false | 0.282475 | 0.075868 | 3.723256 | [
"s448391295",
"s829526079"
] |
u489959379 | p03325 | python | s723241572 | s764439096 | 82 | 62 | 4,148 | 4,148 | Accepted | Accepted | 24.39 | n = int(eval(input()))
a = list(map(int, input().split()))
res = 0
for i in range(n):
if a[i] % 2 == 0:
k = a[i]
while k % 2 == 0:
k //= 2
res += 1
print(res)
| import sys
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
even = [A[i] for i in range(n) if A[i] % 2 == 0]
res = 0
for number in even:
while number % 2 == 0:
res ... | 12 | 24 | 210 | 410 | n = int(eval(input()))
a = list(map(int, input().split()))
res = 0
for i in range(n):
if a[i] % 2 == 0:
k = a[i]
while k % 2 == 0:
k //= 2
res += 1
print(res)
| import sys
sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
even = [A[i] for i in range(n) if A[i] % 2 == 0]
res = 0
for number in even:
while number % 2 == 0:
res += 1
numbe... | false | 50 | [
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-res = 0",
"-for i in range(n):",
"- if a[i] % 2 == 0:",
"- k = a[i]",
"- while k % 2 == 0:",
"- k //= 2",
"+import sys",
"+",
"+sys.setrecursionlimit(10**7)",
"+f_inf = float(\"inf\")",
"+mod = 1... | false | 0.046684 | 0.048984 | 0.95304 | [
"s723241572",
"s764439096"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.