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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u077291787 | p03044 | python | s189557664 | s852876281 | 436 | 267 | 42,796 | 126,100 | Accepted | Accepted | 38.76 | # ABC126D - Even Relation
def dfs(r: int) -> None:
stack = [r]
while stack:
v = stack.pop()
for u, w in T[v]:
if D[u] == -1:
D[u] = (D[v] + w) % 2
stack += [u]
def main():
global T, D
N, *A = map(int, open(0).read().split())
... | # D - Even Relation
from typing import List, Tuple
def main():
N, *X = list(map(int, open(0).read().split()))
tree: List[List[Tuple[int, int]]] = [[] for _ in range(N + 1)]
for u, v, w in zip(*[iter(X)] * 3):
w %= 2
tree[u].append((v, w)), tree[v].append((u, w))
color = [-1... | 27 | 28 | 650 | 666 | # ABC126D - Even Relation
def dfs(r: int) -> None:
stack = [r]
while stack:
v = stack.pop()
for u, w in T[v]:
if D[u] == -1:
D[u] = (D[v] + w) % 2
stack += [u]
def main():
global T, D
N, *A = map(int, open(0).read().split())
T = [[] for _... | # D - Even Relation
from typing import List, Tuple
def main():
N, *X = list(map(int, open(0).read().split()))
tree: List[List[Tuple[int, int]]] = [[] for _ in range(N + 1)]
for u, v, w in zip(*[iter(X)] * 3):
w %= 2
tree[u].append((v, w)), tree[v].append((u, w))
color = [-1] * (N + 1)
... | false | 3.571429 | [
"-# ABC126D - Even Relation",
"-def dfs(r: int) -> None:",
"- stack = [r]",
"- while stack:",
"- v = stack.pop()",
"- for u, w in T[v]:",
"- if D[u] == -1:",
"- D[u] = (D[v] + w) % 2",
"- stack += [u]",
"+# D - Even Relation",
"+from t... | false | 0.038515 | 0.057193 | 0.673429 | [
"s189557664",
"s852876281"
] |
u481187938 | p02888 | python | s245003855 | s690998898 | 1,655 | 146 | 83,504 | 73,276 | Accepted | Accepted | 91.18 | #!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify
import itertools
import math, fractions
import sys, copy
def L(): return sys.stdin.readline... | #!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify
import itertools
import math, fractions
import sys, copy
def L(): return sys.stdin.readline... | 53 | 53 | 1,960 | 1,839 | #!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify
import itertools
import math, fractions
import sys, copy
def L():
return sys.stdin.readline().spl... | #!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify
import itertools
import math, fractions
import sys, copy
def L():
return sys.stdin.readline().spl... | false | 0 | [
"+ k = i",
"- a, b = L[i], L[j]",
"- # print(L[j+1:], abs(a - b), a+b, bisect_left(L[j+1:], abs(a - b)), bisect_left(L[j+1:], a + b))",
"- ans += bisect_left(L[j + 1 :], a + b) - bisect_left(L[j + 1 :], abs(a - b))",
"+ while k < N and L[k] < L[i] + L[j]:",... | false | 0.079008 | 0.068213 | 1.158253 | [
"s245003855",
"s690998898"
] |
u690536347 | p02990 | python | s249826021 | s533995073 | 468 | 28 | 3,444 | 3,444 | Accepted | Accepted | 94.02 | N, K = list(map(int, input().split()))
mod = 10**9+7
fac = [1]*(N+1)
rev = [1]*(N+1)
for i in range(1,N+1):
fac[i] = i*fac[i-1]%mod
rev[i] = pow(fac[i], mod-2, mod)
comb = lambda a,b:(fac[a]*rev[a-b]*rev[b])%mod
for i in range(1, K+1):
v1 = comb(K-1, i-1)
v2 = 0
if i == 1:
... | N, K = list(map(int, input().split()))
mod = 10**9+7
fac = [1]*(N+1)
rev = [1]*(N+1)
for i in range(1,N+1):
fac[i] = i*fac[i-1]%mod
rev[i] = pow(fac[i], mod-2, mod)
comb = lambda a,b:(fac[a]*rev[a-b]*rev[b])%mod
for i in range(1, K+1):
ans = (comb(K-1, i-1)*comb(N-K+1, i))%mod if N-K+1>=i else ... | 22 | 14 | 444 | 331 | N, K = list(map(int, input().split()))
mod = 10**9 + 7
fac = [1] * (N + 1)
rev = [1] * (N + 1)
for i in range(1, N + 1):
fac[i] = i * fac[i - 1] % mod
rev[i] = pow(fac[i], mod - 2, mod)
comb = lambda a, b: (fac[a] * rev[a - b] * rev[b]) % mod
for i in range(1, K + 1):
v1 = comb(K - 1, i - 1)
v2 = 0
... | N, K = list(map(int, input().split()))
mod = 10**9 + 7
fac = [1] * (N + 1)
rev = [1] * (N + 1)
for i in range(1, N + 1):
fac[i] = i * fac[i - 1] % mod
rev[i] = pow(fac[i], mod - 2, mod)
comb = lambda a, b: (fac[a] * rev[a - b] * rev[b]) % mod
for i in range(1, K + 1):
ans = (comb(K - 1, i - 1) * comb(N - K ... | false | 36.363636 | [
"- v1 = comb(K - 1, i - 1)",
"- v2 = 0",
"- if i == 1:",
"- v2 = N - K + 1",
"- else:",
"- for j in range(i - 1, N - K + 1):",
"- v2 += comb(j - 1, i - 2) * (N - K - j + 1)",
"- print(((v1 * v2) % mod))",
"+ ans = (comb(K - 1, i - 1) * comb(N - K + 1, i)) %... | false | 0.107614 | 0.037702 | 2.854315 | [
"s249826021",
"s533995073"
] |
u119983020 | p03478 | python | s122177262 | s090307219 | 34 | 29 | 3,060 | 3,060 | Accepted | Accepted | 14.71 | N, A, B = list(map(int,input().split()))
sum = 0
for num in range(1,N+1):
digit_sum = 0
num_temp = num
while num_temp > 0:
digit_sum += num_temp%10
num_temp = int(num_temp/10)
if (A <= digit_sum) and (digit_sum <= B):
sum += num
print(sum) | N,A,B = list(map(int, input().split()))
def find_sum_of_digit(n):
sum = 0
while True:
sum += n%10
n = int(n/10)
if n == 0:
break
return sum
ans = 0
for i in range(1,N+1):
a = find_sum_of_digit(i)
if a>=A and a<=B:
ans += i
print(ans) | 11 | 15 | 263 | 305 | N, A, B = list(map(int, input().split()))
sum = 0
for num in range(1, N + 1):
digit_sum = 0
num_temp = num
while num_temp > 0:
digit_sum += num_temp % 10
num_temp = int(num_temp / 10)
if (A <= digit_sum) and (digit_sum <= B):
sum += num
print(sum)
| N, A, B = list(map(int, input().split()))
def find_sum_of_digit(n):
sum = 0
while True:
sum += n % 10
n = int(n / 10)
if n == 0:
break
return sum
ans = 0
for i in range(1, N + 1):
a = find_sum_of_digit(i)
if a >= A and a <= B:
ans += i
print(ans)
| false | 26.666667 | [
"-sum = 0",
"-for num in range(1, N + 1):",
"- digit_sum = 0",
"- num_temp = num",
"- while num_temp > 0:",
"- digit_sum += num_temp % 10",
"- num_temp = int(num_temp / 10)",
"- if (A <= digit_sum) and (digit_sum <= B):",
"- sum += num",
"-print(sum)",
"+",
"+"... | false | 0.043291 | 0.093132 | 0.464832 | [
"s122177262",
"s090307219"
] |
u434872492 | p02972 | python | s077295207 | s228429049 | 523 | 160 | 14,140 | 107,520 | Accepted | Accepted | 69.41 | N=int(eval(input()))
a=list(map(int,input().split()))
res=[0]*(N+1)
for i in range(1,N+1)[::-1]:
sum_res=sum(res[x] for x in range(i,N+1,i))
if sum_res % 2!=a[i-1]:
res[i] = 1
print((sum(res)))
if sum(res):
ans=[]
for i,ele in enumerate(res):
if ele:
ans.app... | N = int(eval(input()))
A = list(map(int,input().split()))
ans = [0 for i in range(N)]
for i in range(N-1,-1,-1):
val = i+1
if val*2>N:
if A[i]==0:
ans[i] = 0
else:
ans[i] = 1
else:
tmp = 0
res = val
while(1):
if val>... | 17 | 41 | 335 | 771 | N = int(eval(input()))
a = list(map(int, input().split()))
res = [0] * (N + 1)
for i in range(1, N + 1)[::-1]:
sum_res = sum(res[x] for x in range(i, N + 1, i))
if sum_res % 2 != a[i - 1]:
res[i] = 1
print((sum(res)))
if sum(res):
ans = []
for i, ele in enumerate(res):
if ele:
... | N = int(eval(input()))
A = list(map(int, input().split()))
ans = [0 for i in range(N)]
for i in range(N - 1, -1, -1):
val = i + 1
if val * 2 > N:
if A[i] == 0:
ans[i] = 0
else:
ans[i] = 1
else:
tmp = 0
res = val
while 1:
if val > N:... | false | 58.536585 | [
"-a = list(map(int, input().split()))",
"-res = [0] * (N + 1)",
"-for i in range(1, N + 1)[::-1]:",
"- sum_res = sum(res[x] for x in range(i, N + 1, i))",
"- if sum_res % 2 != a[i - 1]:",
"- res[i] = 1",
"-print((sum(res)))",
"-if sum(res):",
"- ans = []",
"- for i, ele in enume... | false | 0.065475 | 0.090727 | 0.721672 | [
"s077295207",
"s228429049"
] |
u439063038 | p03167 | python | s687954276 | s175977862 | 904 | 577 | 49,236 | 51,216 | Accepted | Accepted | 36.17 | MOD = 10**9+7
H, W = list(map(int, input().split()))
a = [eval(input()) for _ in range(H)]
dp = [[0] * W for _ in range(H)]
dp[0][0] = 1
for i in range(H):
for j in range(W):
if j+1 < W:
if a[i][j+1] != '#':
dp[i][j+1] += dp[i][j] % MOD
if i+1 < H:
... | H, W = list(map(int, input().split()))
a = [eval(input()) for _ in range(H)]
MOD = 10**9 + 7
dp = [[0]*1100 for _ in range(1100)]
dp[1][1] = 1
for h in range(1, H+1):
for w in range(1, W+1):
if h == 1 and w == 1:
continue
if a[h-1][w-1] == '#':
dp[h][w] = 0
... | 16 | 15 | 417 | 396 | MOD = 10**9 + 7
H, W = list(map(int, input().split()))
a = [eval(input()) for _ in range(H)]
dp = [[0] * W for _ in range(H)]
dp[0][0] = 1
for i in range(H):
for j in range(W):
if j + 1 < W:
if a[i][j + 1] != "#":
dp[i][j + 1] += dp[i][j] % MOD
if i + 1 < H:
i... | H, W = list(map(int, input().split()))
a = [eval(input()) for _ in range(H)]
MOD = 10**9 + 7
dp = [[0] * 1100 for _ in range(1100)]
dp[1][1] = 1
for h in range(1, H + 1):
for w in range(1, W + 1):
if h == 1 and w == 1:
continue
if a[h - 1][w - 1] == "#":
dp[h][w] = 0
... | false | 6.25 | [
"-MOD = 10**9 + 7",
"-dp = [[0] * W for _ in range(H)]",
"-dp[0][0] = 1",
"-for i in range(H):",
"- for j in range(W):",
"- if j + 1 < W:",
"- if a[i][j + 1] != \"#\":",
"- dp[i][j + 1] += dp[i][j] % MOD",
"- if i + 1 < H:",
"- if a[i + 1][j] !... | false | 0.046872 | 0.04764 | 0.983886 | [
"s687954276",
"s175977862"
] |
u593567568 | p02913 | python | s293346555 | s596112272 | 753 | 154 | 51,780 | 5,008 | Accepted | Accepted | 79.55 | import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# 文字列アルゴリズム
# Z-Algorithm
# ZAlgorithm
# AC
N = int(eval(input()))
S = list(eval(input()))
ans = 0
def Z_Algorithm(S):
L = len(S)
Z = [... | import sys
import random
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# 文字列アルゴリズム
# RollingHash
# ローリングハッシュ
# 64bit 溢れないように
class RollingHash:
MASK30 = (1 << 30) - 1
... | 63 | 101 | 967 | 2,156 | import sys
sys.setrecursionlimit(10**7)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# 文字列アルゴリズム
# Z-Algorithm
# ZAlgorithm
# AC
N = int(eval(input()))
S = list(eval(input()))
ans = 0
def Z_Algorithm(S):
L = len(S)
Z = [0] * L
Z[0] = L
i = 1... | import sys
import random
from collections import defaultdict
sys.setrecursionlimit(10**7)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# 文字列アルゴリズム
# RollingHash
# ローリングハッシュ
# 64bit 溢れないように
class RollingHash:
MASK30 = (1 << 30) - 1
MASK31 = (1 << 31) -... | false | 37.623762 | [
"+import random",
"+from collections import defaultdict",
"-# Z-Algorithm",
"-# ZAlgorithm",
"-# AC",
"-N = int(eval(input()))",
"-S = list(eval(input()))",
"-ans = 0",
"+# RollingHash",
"+# ローリングハッシュ",
"+# 64bit 溢れないように",
"+class RollingHash:",
"+ MASK30 = (1 << 30) - 1",
"+ MASK31 ... | false | 0.115853 | 0.034272 | 3.380402 | [
"s293346555",
"s596112272"
] |
u739721456 | p03478 | python | s729088227 | s731148638 | 82 | 39 | 3,060 | 2,940 | Accepted | Accepted | 52.44 | def sums(n):
return(sum(list(map(int,[str(n)[i] for i in range(len(str(n)))]))))
n,a,b=list(map(int,input().split()))
ans=0
for j in range(n+1):
if sums(j)>=a and sums(j)<=b:
ans+=j
print(ans)
| n,a,b=list(map(int,input().split()))
ans=0
for i in range(1,n+1):
i=str(i)
m=0
for j in range(len(i)):
m+=int(i[j])
if m>=a and m<=b:
ans+=int(i)
print(ans)
| 11 | 12 | 216 | 196 | def sums(n):
return sum(list(map(int, [str(n)[i] for i in range(len(str(n)))])))
n, a, b = list(map(int, input().split()))
ans = 0
for j in range(n + 1):
if sums(j) >= a and sums(j) <= b:
ans += j
print(ans)
| n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
i = str(i)
m = 0
for j in range(len(i)):
m += int(i[j])
if m >= a and m <= b:
ans += int(i)
print(ans)
| false | 8.333333 | [
"-def sums(n):",
"- return sum(list(map(int, [str(n)[i] for i in range(len(str(n)))])))",
"-",
"-",
"-for j in range(n + 1):",
"- if sums(j) >= a and sums(j) <= b:",
"- ans += j",
"+for i in range(1, n + 1):",
"+ i = str(i)",
"+ m = 0",
"+ for j in range(len(i)):",
"+ ... | false | 0.037494 | 0.036673 | 1.022396 | [
"s729088227",
"s731148638"
] |
u186838327 | p03831 | python | s504443255 | s214854987 | 222 | 96 | 62,704 | 84,712 | Accepted | Accepted | 56.76 | n, a, b = list(map(int, input().split()))
l = list(map(int, input().split()))
ans = 0
for i in range(n-1):
if (l[i+1]-l[i])*a <= b:
ans += (l[i+1]-l[i])*a
else:
ans += b
print(ans) | n, a, b = list(map(int, input().split()))
X = list(map(int, input().split()))
ans = 0
for i in range(n-1):
if a*(X[i+1]-X[i]) <= b:
ans += a*(X[i+1]-X[i])
else:
ans += b
print(ans)
| 9 | 10 | 194 | 209 | n, a, b = list(map(int, input().split()))
l = list(map(int, input().split()))
ans = 0
for i in range(n - 1):
if (l[i + 1] - l[i]) * a <= b:
ans += (l[i + 1] - l[i]) * a
else:
ans += b
print(ans)
| n, a, b = list(map(int, input().split()))
X = list(map(int, input().split()))
ans = 0
for i in range(n - 1):
if a * (X[i + 1] - X[i]) <= b:
ans += a * (X[i + 1] - X[i])
else:
ans += b
print(ans)
| false | 10 | [
"-l = list(map(int, input().split()))",
"+X = list(map(int, input().split()))",
"- if (l[i + 1] - l[i]) * a <= b:",
"- ans += (l[i + 1] - l[i]) * a",
"+ if a * (X[i + 1] - X[i]) <= b:",
"+ ans += a * (X[i + 1] - X[i])"
] | false | 0.040132 | 0.037116 | 1.081255 | [
"s504443255",
"s214854987"
] |
u603958124 | p03212 | python | s406153960 | s152381024 | 884 | 86 | 10,164 | 10,184 | Accepted | Accepted | 90.27 | from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator i... | from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator i... | 28 | 28 | 983 | 910 | from math import (
ceil,
floor,
factorial,
gcd,
sqrt,
log2,
cos,
sin,
tan,
acos,
asin,
atan,
degrees,
radians,
pi,
inf,
)
from itertools import (
accumulate,
groupby,
permutations,
combinations,
product,
combinations_with_replacemen... | from math import (
ceil,
floor,
factorial,
gcd,
sqrt,
log2,
cos,
sin,
tan,
acos,
asin,
atan,
degrees,
radians,
pi,
inf,
)
from itertools import (
accumulate,
groupby,
permutations,
combinations,
product,
combinations_with_replacemen... | false | 0 | [
"-ans = 0",
"-for x in product([0, 3, 5, 7], repeat=9):",
"- y = 0",
"- for i in range(9):",
"- y += x[8 - i] * 10**i",
"- if y > n:",
"- break",
"- if str(y).count(\"0\") == 0 and x.count(3) > 0 and x.count(5) > 0 and x.count(7) > 0:",
"- ans += 1",
"-print(ans)",... | false | 0.288349 | 0.045197 | 6.379824 | [
"s406153960",
"s152381024"
] |
u273010357 | p03373 | python | s167847511 | s425978133 | 99 | 91 | 3,060 | 3,060 | Accepted | Accepted | 8.08 | a,b,c,x,y = list(map(int, input().split()))
ans = float('inf')
for i in range(10**5+1):
tmp = i*2*c + max(0, x-i)*a + max(0, y-i)*b
if ans > tmp:
ans = tmp
print(ans) | a,b,c,x,y = list(map(int, input().split()))
ans = float('inf')
for i in range(10**5+1):
tmp = i*2*c
if i>=x:
pass
else:
tmp += (x-i)*a
if i>=y:
pass
else:
tmp += (y-i)*b
if ans > tmp:
ans = tmp
print(ans) | 8 | 17 | 184 | 280 | a, b, c, x, y = list(map(int, input().split()))
ans = float("inf")
for i in range(10**5 + 1):
tmp = i * 2 * c + max(0, x - i) * a + max(0, y - i) * b
if ans > tmp:
ans = tmp
print(ans)
| a, b, c, x, y = list(map(int, input().split()))
ans = float("inf")
for i in range(10**5 + 1):
tmp = i * 2 * c
if i >= x:
pass
else:
tmp += (x - i) * a
if i >= y:
pass
else:
tmp += (y - i) * b
if ans > tmp:
ans = tmp
print(ans)
| false | 52.941176 | [
"- tmp = i * 2 * c + max(0, x - i) * a + max(0, y - i) * b",
"+ tmp = i * 2 * c",
"+ if i >= x:",
"+ pass",
"+ else:",
"+ tmp += (x - i) * a",
"+ if i >= y:",
"+ pass",
"+ else:",
"+ tmp += (y - i) * b"
] | false | 0.123344 | 0.172143 | 0.716523 | [
"s167847511",
"s425978133"
] |
u731368968 | p02947 | python | s613010181 | s801472088 | 581 | 505 | 21,988 | 24,560 | Accepted | Accepted | 13.08 | n = int(eval(input()))
d={}
for i in range(n):
s=str(sorted(eval(input())))
try:
d[s]+=1
except:
d[s]=1
ans=0
for i in list(d.values()):
ans+=i*(i-1)//2
print(ans) | import collections
ss = []
N = int(eval(input()))
for i in range(N):
s = str(sorted(eval(input())))
ss.append(s)
c = collections.Counter(ss)
ans = 0
for v in list(c.values()):
ans += v * (v - 1) // 2
print(ans)
| 13 | 16 | 194 | 225 | n = int(eval(input()))
d = {}
for i in range(n):
s = str(sorted(eval(input())))
try:
d[s] += 1
except:
d[s] = 1
ans = 0
for i in list(d.values()):
ans += i * (i - 1) // 2
print(ans)
| import collections
ss = []
N = int(eval(input()))
for i in range(N):
s = str(sorted(eval(input())))
ss.append(s)
c = collections.Counter(ss)
ans = 0
for v in list(c.values()):
ans += v * (v - 1) // 2
print(ans)
| false | 18.75 | [
"-n = int(eval(input()))",
"-d = {}",
"-for i in range(n):",
"+import collections",
"+",
"+ss = []",
"+N = int(eval(input()))",
"+for i in range(N):",
"- try:",
"- d[s] += 1",
"- except:",
"- d[s] = 1",
"+ ss.append(s)",
"+c = collections.Counter(ss)",
"-for i in l... | false | 0.089421 | 0.169802 | 0.526615 | [
"s613010181",
"s801472088"
] |
u191874006 | p02995 | python | s477451344 | s436428508 | 170 | 71 | 38,484 | 65,648 | Accepted | Accepted | 58.24 | #!/usr/bin/env python3
#ABC131 C
import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import ite... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | 33 | 26 | 785 | 755 | #!/usr/bin/env python3
# ABC131 C
import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
fr... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | false | 21.212121 | [
"-# ABC131 C",
"-import bisect",
"+from bisect import bisect_right as br",
"+from bisect import bisect_left as bl",
"-sys.setrecursionlimit(1000000000)",
"+sys.setrecursionlimit(2147483647)",
"-def gcd(n, m):",
"- if m == 0:",
"- return n",
"- else:",
"- return gcd(m, n % m)"... | false | 0.041386 | 0.041635 | 0.994013 | [
"s477451344",
"s436428508"
] |
u170349801 | p02548 | python | s493007393 | s497325170 | 238 | 152 | 9,184 | 8,892 | Accepted | Accepted | 36.13 | N = int(eval(input()))
count = 0
count += int(N/2)
if int(N/2)-N/2 == 0:
for i in range(1,int(N/2)):
if int(N/i)-N/i == 0:
count += int(N/i)-1
else:
count += int(N/i)
else:
for i in range(1,int(N/2)+1):
if int(N/i)-N/i == 0:
count += ... | n = int(eval(input()))
ans = 0
for a in range(1, n):
ans += (n - 1) // a
print(ans)
| 20 | 5 | 386 | 84 | N = int(eval(input()))
count = 0
count += int(N / 2)
if int(N / 2) - N / 2 == 0:
for i in range(1, int(N / 2)):
if int(N / i) - N / i == 0:
count += int(N / i) - 1
else:
count += int(N / i)
else:
for i in range(1, int(N / 2) + 1):
if int(N / i) - N / i == 0:
... | n = int(eval(input()))
ans = 0
for a in range(1, n):
ans += (n - 1) // a
print(ans)
| false | 75 | [
"-N = int(eval(input()))",
"-count = 0",
"-count += int(N / 2)",
"-if int(N / 2) - N / 2 == 0:",
"- for i in range(1, int(N / 2)):",
"- if int(N / i) - N / i == 0:",
"- count += int(N / i) - 1",
"- else:",
"- count += int(N / i)",
"-else:",
"- for i in r... | false | 0.07194 | 0.08573 | 0.839147 | [
"s493007393",
"s497325170"
] |
u017603316 | p02861 | python | s272483957 | s193550320 | 241 | 105 | 63,728 | 80,892 | Accepted | Accepted | 56.43 |
N = int(eval(input()))
xy = []
for i in range(N):
xy.append(list(map(int,input().split())))
from itertools import permutations
a = list(range(N))
Ps = list(permutations(a))
#print('Ps', Ps)
keiro = []
for P in Ps:
#print('P', P)
for i in range(N-1):
keiro.append( ((xy[P[i]][0] - xy... | N = int(eval(input()))
xy = []
for i in range(N):
xy.append(list(map(int,input().split())))
from itertools import permutations
a=list(range(1,N+1))
ps = list(permutations(a))
#print(ps)
dammy=0
for p in ps:
#print('p:',p)
for j in range(1,N):
dammy += ((xy[p[j-1]-1][0] - xy[p[j]-1][0... | 19 | 18 | 427 | 410 | N = int(eval(input()))
xy = []
for i in range(N):
xy.append(list(map(int, input().split())))
from itertools import permutations
a = list(range(N))
Ps = list(permutations(a))
# print('Ps', Ps)
keiro = []
for P in Ps:
# print('P', P)
for i in range(N - 1):
keiro.append(
(
... | N = int(eval(input()))
xy = []
for i in range(N):
xy.append(list(map(int, input().split())))
from itertools import permutations
a = list(range(1, N + 1))
ps = list(permutations(a))
# print(ps)
dammy = 0
for p in ps:
# print('p:',p)
for j in range(1, N):
dammy += (
(xy[p[j - 1] - 1][0] -... | false | 5.263158 | [
"-a = list(range(N))",
"-Ps = list(permutations(a))",
"-# print('Ps', Ps)",
"-keiro = []",
"-for P in Ps:",
"- # print('P', P)",
"- for i in range(N - 1):",
"- keiro.append(",
"- (",
"- (xy[P[i]][0] - xy[P[i + 1]][0]) ** 2",
"- + (xy[P[i]][1]... | false | 0.041046 | 0.047964 | 0.855779 | [
"s272483957",
"s193550320"
] |
u581187895 | p03170 | python | s490841267 | s614810345 | 1,772 | 1,452 | 9,576 | 9,668 | Accepted | Accepted | 18.06 |
def resolve():
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
dp = [False]*(K+1)
for i in range(K+1):
for j in range(N):
if i - A[j] >= 0:
dp[i] |= ~dp[i-A[j]]
if dp[K]:
print("First")
else:
print("S... |
def resolve():
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
dp = [False]*(K+1)
for i in range(K+1):
for j in range(N):
if i - A[j] >= 0:
dp[i] |= not dp[i-A[j]]
if dp[K]:
print("First")
else:
... | 19 | 19 | 368 | 379 | def resolve():
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
dp = [False] * (K + 1)
for i in range(K + 1):
for j in range(N):
if i - A[j] >= 0:
dp[i] |= ~dp[i - A[j]]
if dp[K]:
print("First")
else:
print("Second")
... | def resolve():
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
dp = [False] * (K + 1)
for i in range(K + 1):
for j in range(N):
if i - A[j] >= 0:
dp[i] |= not dp[i - A[j]]
if dp[K]:
print("First")
else:
print("Second"... | false | 0 | [
"- dp[i] |= ~dp[i - A[j]]",
"+ dp[i] |= not dp[i - A[j]]"
] | false | 0.036953 | 0.036895 | 1.001556 | [
"s490841267",
"s614810345"
] |
u596276291 | p04030 | python | s851401642 | s448020805 | 24 | 20 | 3,064 | 3,316 | Accepted | Accepted | 16.67 | def main():
s = eval(input())
ans = ""
for c in s:
if c == "0":
ans += "0"
elif c == "1":
ans += "1"
elif c == "B":
ans = ans[:-1]
print(ans)
if __name__ == '__main__':
main()
| from collections import defaultdict
def main():
s = eval(input())
ans = ""
for c in s:
if c in ["0", "1"]:
ans += c
elif c == "B" and len(ans) > 0:
ans = ans[:len(ans) - 1]
print(ans)
if __name__ == '__main__':
main()
| 14 | 15 | 264 | 289 | def main():
s = eval(input())
ans = ""
for c in s:
if c == "0":
ans += "0"
elif c == "1":
ans += "1"
elif c == "B":
ans = ans[:-1]
print(ans)
if __name__ == "__main__":
main()
| from collections import defaultdict
def main():
s = eval(input())
ans = ""
for c in s:
if c in ["0", "1"]:
ans += c
elif c == "B" and len(ans) > 0:
ans = ans[: len(ans) - 1]
print(ans)
if __name__ == "__main__":
main()
| false | 6.666667 | [
"+from collections import defaultdict",
"+",
"+",
"- if c == \"0\":",
"- ans += \"0\"",
"- elif c == \"1\":",
"- ans += \"1\"",
"- elif c == \"B\":",
"- ans = ans[:-1]",
"+ if c in [\"0\", \"1\"]:",
"+ ans += c",
"+ ... | false | 0.038667 | 0.06551 | 0.59025 | [
"s851401642",
"s448020805"
] |
u606045429 | p02998 | python | s073055290 | s126336295 | 455 | 356 | 38,580 | 38,580 | Accepted | Accepted | 21.76 | from collections import Counter
def main():
class UnionFind:
def __init__(self, size):
self.data = [-1] * size
def find(self, x):
if self.data[x] < 0:
return x
else:
self.data[x] = self.find(self.data[x])
... | from collections import Counter
def main():
MAX = 10 ** 5 + 1
data = [-1] * (2 * MAX)
def find(x):
if data[x] < 0:
return x
else:
data[x] = find(data[x])
return data[x]
def union(x, y):
x, y = find(x), find(y)
if x... | 41 | 39 | 1,042 | 812 | from collections import Counter
def main():
class UnionFind:
def __init__(self, size):
self.data = [-1] * size
def find(self, x):
if self.data[x] < 0:
return x
else:
self.data[x] = self.find(self.data[x])
return s... | from collections import Counter
def main():
MAX = 10**5 + 1
data = [-1] * (2 * MAX)
def find(x):
if data[x] < 0:
return x
else:
data[x] = find(data[x])
return data[x]
def union(x, y):
x, y = find(x), find(y)
if x != y:
i... | false | 4.878049 | [
"- class UnionFind:",
"- def __init__(self, size):",
"- self.data = [-1] * size",
"+ MAX = 10**5 + 1",
"+ data = [-1] * (2 * MAX)",
"- def find(self, x):",
"- if self.data[x] < 0:",
"- return x",
"- else:",
"- se... | false | 0.268606 | 0.34305 | 0.782993 | [
"s073055290",
"s126336295"
] |
u562935282 | p03986 | python | s390559784 | s901559292 | 60 | 45 | 3,500 | 3,500 | Accepted | Accepted | 25 | x = eval(input())
ans = 0
cnt = 0
for i in range(len(x)):
if x[i] == 'S':
cnt += 1
elif x[i] == 'T':
if cnt > 0:
cnt -= 1
else:
ans += 2
print(ans) | x = eval(input())
ans = 0
cnt_s = 0
for xx in x:
if xx == 'T':
if cnt_s > 0:
cnt_s -= 1
else:
ans += 2
else:
cnt_s += 1
print(ans)
| 13 | 13 | 214 | 194 | x = eval(input())
ans = 0
cnt = 0
for i in range(len(x)):
if x[i] == "S":
cnt += 1
elif x[i] == "T":
if cnt > 0:
cnt -= 1
else:
ans += 2
print(ans)
| x = eval(input())
ans = 0
cnt_s = 0
for xx in x:
if xx == "T":
if cnt_s > 0:
cnt_s -= 1
else:
ans += 2
else:
cnt_s += 1
print(ans)
| false | 0 | [
"-cnt = 0",
"-for i in range(len(x)):",
"- if x[i] == \"S\":",
"- cnt += 1",
"- elif x[i] == \"T\":",
"- if cnt > 0:",
"- cnt -= 1",
"+cnt_s = 0",
"+for xx in x:",
"+ if xx == \"T\":",
"+ if cnt_s > 0:",
"+ cnt_s -= 1",
"+ else:",
"+ ... | false | 0.04533 | 0.04976 | 0.910963 | [
"s390559784",
"s901559292"
] |
u814781830 | p02574 | python | s877297821 | s080434243 | 708 | 392 | 225,148 | 189,256 | Accepted | Accepted | 44.63 | import math
NOTCOM = "not coprime"
SETWISE = "setwise coprime"
PAIRWISE = "pairwise coprime"
def calc_prime(N):
prime, i = set(), 1
while i * i <= N:
if N % i == 0:
yield i
if i != N//i: yield N//i
i += 1
def main():
N = int(eval(input()))
A = lis... | import math
NOTCOM = "not coprime"
SETWISE = "setwise coprime"
PAIRWISE = "pairwise coprime"
MAX_A = 10 ** 6 + 5
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
c = [0] * MAX_A
for a in A:
c[a] += 1
pairwse = True
for i in range(2, MAX_A):
cn... | 41 | 28 | 882 | 614 | import math
NOTCOM = "not coprime"
SETWISE = "setwise coprime"
PAIRWISE = "pairwise coprime"
def calc_prime(N):
prime, i = set(), 1
while i * i <= N:
if N % i == 0:
yield i
if i != N // i:
yield N // i
i += 1
def main():
N = int(eval(input()))
... | import math
NOTCOM = "not coprime"
SETWISE = "setwise coprime"
PAIRWISE = "pairwise coprime"
MAX_A = 10**6 + 5
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
c = [0] * MAX_A
for a in A:
c[a] += 1
pairwse = True
for i in range(2, MAX_A):
cnt = 0
... | false | 31.707317 | [
"-",
"-",
"-def calc_prime(N):",
"- prime, i = set(), 1",
"- while i * i <= N:",
"- if N % i == 0:",
"- yield i",
"- if i != N // i:",
"- yield N // i",
"- i += 1",
"+MAX_A = 10**6 + 5",
"- A = list(set(A))",
"- cnt2 = 0",
"- ... | false | 0.035712 | 2.796256 | 0.012771 | [
"s877297821",
"s080434243"
] |
u254871849 | p03946 | python | s431117641 | s446886761 | 149 | 88 | 23,512 | 22,112 | Accepted | Accepted | 40.94 | import sys
from heapq import heappush, heappop
from collections import Counter
n, t, *a = list(map(int, sys.stdin.read().split()))
def main():
cand = []
hq = [a[0]]
for x in a[1:]:
y = heappop(hq)
cand.append(x - y)
heappush(hq, x)
heappush(hq, y)
c = Counter(cand)
ans = c[max... | import sys
from collections import Counter
n, t, *a = list(map(int, sys.stdin.read().split()))
def main():
cand = []
mi = a[0]
for x in a[1:]:
cand.append(x - mi)
mi = min(mi, x)
c = Counter(cand)
ans = c[max(c.keys())]
print(ans)
if __name__ == '__main__':
main() | 20 | 17 | 381 | 301 | import sys
from heapq import heappush, heappop
from collections import Counter
n, t, *a = list(map(int, sys.stdin.read().split()))
def main():
cand = []
hq = [a[0]]
for x in a[1:]:
y = heappop(hq)
cand.append(x - y)
heappush(hq, x)
heappush(hq, y)
c = Counter(cand)
... | import sys
from collections import Counter
n, t, *a = list(map(int, sys.stdin.read().split()))
def main():
cand = []
mi = a[0]
for x in a[1:]:
cand.append(x - mi)
mi = min(mi, x)
c = Counter(cand)
ans = c[max(c.keys())]
print(ans)
if __name__ == "__main__":
main()
| false | 15 | [
"-from heapq import heappush, heappop",
"- hq = [a[0]]",
"+ mi = a[0]",
"- y = heappop(hq)",
"- cand.append(x - y)",
"- heappush(hq, x)",
"- heappush(hq, y)",
"+ cand.append(x - mi)",
"+ mi = min(mi, x)"
] | false | 0.040009 | 0.039348 | 1.016802 | [
"s431117641",
"s446886761"
] |
u043048943 | p03475 | python | s931078078 | s397640491 | 242 | 207 | 43,884 | 41,708 | Accepted | Accepted | 14.46 | N = int(eval(input()))
dia = [0]*(N-1)
for i in range(N-1):
c,s,f = list(map(int,input().split()))
dia[i] = (c,s,f)
for i in range(N-1):
time = 0
for j in range(i,N-1):
c,s,f = dia[j]
if time > s:
x = (time - s)/f
if x.is_integer():
s +... | N = int(eval(input()))
dia = [0]*(N-1)
for i in range(N-1):
c,s,f = list(map(int,input().split()))
dia[i] = (c,s,f)
for i in range(N-1):
time = 0
for j in range(i,N-1):
c,s,f = dia[j]
if time > s:
if time % f == 0:
s = time
else:
... | 26 | 25 | 437 | 409 | N = int(eval(input()))
dia = [0] * (N - 1)
for i in range(N - 1):
c, s, f = list(map(int, input().split()))
dia[i] = (c, s, f)
for i in range(N - 1):
time = 0
for j in range(i, N - 1):
c, s, f = dia[j]
if time > s:
x = (time - s) / f
if x.is_integer():
... | N = int(eval(input()))
dia = [0] * (N - 1)
for i in range(N - 1):
c, s, f = list(map(int, input().split()))
dia[i] = (c, s, f)
for i in range(N - 1):
time = 0
for j in range(i, N - 1):
c, s, f = dia[j]
if time > s:
if time % f == 0:
s = time
else:
... | false | 3.846154 | [
"- x = (time - s) / f",
"- if x.is_integer():",
"- s += int(x) * f",
"+ if time % f == 0:",
"+ s = time",
"- s += int(x + 1) * f",
"+ s = time + f - time % f"
] | false | 0.036229 | 0.036496 | 0.99269 | [
"s931078078",
"s397640491"
] |
u227082700 | p03805 | python | s599508824 | s303957688 | 380 | 31 | 3,064 | 3,064 | Accepted | Accepted | 91.84 | z,m=list(map(int,input().split()));a=[[],[]];ans=0
for i in range(m):aa,bb=list(map(int,input().split()));a[0].append(aa);a[1].append(bb)
def d(n,nl,ml):
if sorted(nl+[n])==[i+1for i in range(z)]:return 1
if n in nl:return 0
l=len(ml[0]);ans=0
for i in range(l):
c=[ml[0][:i]+ml[0][i+1:],ml[1][:i]+ml[... | n,m=list(map(int,input().split()))
edge=[n*[0]for _ in range(n)]
for i in range(m):
a,b=list(map(int,input().split()))
a-=1
b-=1
edge[a][b]=edge[b][a]=1
from itertools import permutations
ans=0
for i in permutations([j for j in range(1,n)],n-1):
f=True
t=[0]+list(i)
for j in range(1,n):
if edge[t[... | 16 | 16 | 549 | 356 | z, m = list(map(int, input().split()))
a = [[], []]
ans = 0
for i in range(m):
aa, bb = list(map(int, input().split()))
a[0].append(aa)
a[1].append(bb)
def d(n, nl, ml):
if sorted(nl + [n]) == [i + 1 for i in range(z)]:
return 1
if n in nl:
return 0
l = len(ml[0])
ans = 0
... | n, m = list(map(int, input().split()))
edge = [n * [0] for _ in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
edge[a][b] = edge[b][a] = 1
from itertools import permutations
ans = 0
for i in permutations([j for j in range(1, n)], n - 1):
f = True
t = [0] + lis... | false | 0 | [
"-z, m = list(map(int, input().split()))",
"-a = [[], []]",
"+n, m = list(map(int, input().split()))",
"+edge = [n * [0] for _ in range(n)]",
"+for i in range(m):",
"+ a, b = list(map(int, input().split()))",
"+ a -= 1",
"+ b -= 1",
"+ edge[a][b] = edge[b][a] = 1",
"+from itertools imp... | false | 0.072733 | 0.063881 | 1.138557 | [
"s599508824",
"s303957688"
] |
u983918956 | p03524 | python | s995234856 | s691649754 | 168 | 39 | 3,188 | 3,188 | Accepted | Accepted | 76.79 | S = eval(input())
cnt = [0]*3
for s in S:
cnt[ord(s)-97] += 1
cnt.sort()
ans = "YES"
prepre = -1
pre = -1
while cnt != [0]*3:
for i in range(3)[::-1]:
if cnt[i] > 0:
if prepre == i or pre == i:
ans = "NO"
cnt[i] -= 1
prepre = pre
... | S = eval(input())
cnt = [0]*3
for s in S:
cnt[ord(s)-97] += 1
if max(cnt) - min(cnt) <= 1:
print("YES")
else:
print("NO") | 22 | 11 | 348 | 140 | S = eval(input())
cnt = [0] * 3
for s in S:
cnt[ord(s) - 97] += 1
cnt.sort()
ans = "YES"
prepre = -1
pre = -1
while cnt != [0] * 3:
for i in range(3)[::-1]:
if cnt[i] > 0:
if prepre == i or pre == i:
ans = "NO"
cnt[i] -= 1
prepre = pre
pre ... | S = eval(input())
cnt = [0] * 3
for s in S:
cnt[ord(s) - 97] += 1
if max(cnt) - min(cnt) <= 1:
print("YES")
else:
print("NO")
| false | 50 | [
"-cnt.sort()",
"-ans = \"YES\"",
"-prepre = -1",
"-pre = -1",
"-while cnt != [0] * 3:",
"- for i in range(3)[::-1]:",
"- if cnt[i] > 0:",
"- if prepre == i or pre == i:",
"- ans = \"NO\"",
"- cnt[i] -= 1",
"- prepre = pre",
"- ... | false | 0.103775 | 0.039667 | 2.616149 | [
"s995234856",
"s691649754"
] |
u263830634 | p03045 | python | s292795125 | s825446819 | 693 | 538 | 5,376 | 5,424 | Accepted | Accepted | 22.37 | class UnionFind(object):
def __init__(self, N):
self.parent = [-1] * N #parent[i] は(i+1)番目の要素が含まれる要素数の(-1)倍
#要素が負-->その数を親とするグループに属する要素の数×(-1)
#要素が正-->親のindex
#Aがどのグループに属しているかを調べる
def root(self, A):
if self.parent[A-1] < 0: #負の数-->その数は親
return A
self.par... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7
N, M = list(map(int, input().split()))
class UnionFind(object):
def __init__(self, N):
self.parent = [-1] * N #parent[i] は(i+1)番目の要素が含まれる要素数の(-1)倍
#要素が負-->その数を親とするグループに属する要素の数×(-1)
#要素が正-->親のindex
... | 64 | 55 | 1,808 | 1,525 | class UnionFind(object):
def __init__(self, N):
self.parent = [-1] * N # parent[i] は(i+1)番目の要素が含まれる要素数の(-1)倍
# 要素が負-->その数を親とするグループに属する要素の数×(-1)
# 要素が正-->親のindex
# Aがどのグループに属しているかを調べる
def root(self, A):
if self.parent[A - 1] < 0: # 負の数-->その数は親
return A
self.pare... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)
MOD = 10**9 + 7
N, M = list(map(int, input().split()))
class UnionFind(object):
def __init__(self, N):
self.parent = [-1] * N # parent[i] は(i+1)番目の要素が含まれる要素数の(-1)倍
# 要素が負-->その数を親とするグループに属する要素の数×(-1)
# 要素が正-->親のindex
# Aがどのグル... | false | 14.0625 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"+sys.setrecursionlimit(10**9)",
"+MOD = 10**9 + 7",
"+N, M = list(map(int, input().split()))",
"+",
"+",
"-# N, Q = map(int, input().split())",
"-# uni = UnionFind(N)",
"-# for _ in range(Q):",
"-# P, A, B = map(int, input().split())",
... | false | 0.087287 | 0.112742 | 0.774214 | [
"s292795125",
"s825446819"
] |
u970197315 | p02971 | python | s655588320 | s724074245 | 563 | 488 | 14,112 | 20,112 | Accepted | Accepted | 13.32 | N = int(eval(input()))
a = []
b = []
a_max = 0
a_second = 0
for i in range(N):
a.append(int(eval(input())))
b = a[:]
a.sort(reverse=True)
a_max = a[0]
a_second = a[1]
for i in range(N):
if b[i] == a_max:
print(a_second)
else:
print(a_max)
| n=int(eval(input()))
a=[int(eval(input())) for i in range(n)]
l=[0]*n
r=[0]*n
t=0
for i in range(n):
t=max(t,a[i])
l[i]=t
t=0
for i in range(n-1,-1,-1):
t=max(t,a[i])
r[i]=t
# print(l)
# print(r)
for i in range(n):
if i==0:
print((r[i+1]))
continue
if i==n-1:
print((l[i-1]))
... | 20 | 22 | 278 | 346 | N = int(eval(input()))
a = []
b = []
a_max = 0
a_second = 0
for i in range(N):
a.append(int(eval(input())))
b = a[:]
a.sort(reverse=True)
a_max = a[0]
a_second = a[1]
for i in range(N):
if b[i] == a_max:
print(a_second)
else:
print(a_max)
| n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
l = [0] * n
r = [0] * n
t = 0
for i in range(n):
t = max(t, a[i])
l[i] = t
t = 0
for i in range(n - 1, -1, -1):
t = max(t, a[i])
r[i] = t
# print(l)
# print(r)
for i in range(n):
if i == 0:
print((r[i + 1]))
continue
... | false | 9.090909 | [
"-N = int(eval(input()))",
"-a = []",
"-b = []",
"-a_max = 0",
"-a_second = 0",
"-for i in range(N):",
"- a.append(int(eval(input())))",
"-b = a[:]",
"-a.sort(reverse=True)",
"-a_max = a[0]",
"-a_second = a[1]",
"-for i in range(N):",
"- if b[i] == a_max:",
"- print(a_second)"... | false | 0.04117 | 0.036716 | 1.121325 | [
"s655588320",
"s724074245"
] |
u623819879 | p03221 | python | s076856318 | s643104491 | 1,023 | 829 | 88,920 | 80,416 | Accepted | Accepted | 18.96 | from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations
import sys
import bisect
import string
sys.setrecursionlimit(10**6)
def SI():
return input().split()
def MI():
return list(map(int,input().split()))
def I():
... | from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations
import sys
import bisect
import string
sys.setrecursionlimit(10**6)
def SI():
return input().split()
def MI():
return list(map(int,input().split()))
def I():
... | 41 | 37 | 857 | 793 | from heapq import heappush, heappop
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations
import sys
import bisect
import string
sys.setrecursionlimit(10**6)
def SI():
return input().split()
def MI():
return list(map(int, input().split()))
def I():
re... | from heapq import heappush, heappop
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations
import sys
import bisect
import string
sys.setrecursionlimit(10**6)
def SI():
return input().split()
def MI():
return list(map(int, input().split()))
def I():
re... | false | 9.756098 | [
"-pref = []",
"+ids = [0] * m",
"+pref = [[] for i in range(1 + n)]",
"- pref += [(p, i, y)]",
"-pref.sort(key=lambda x: x[0] * 10**10 + x[2])",
"-c = 0",
"-pre = pref[0][0]",
"-ans = []",
"-for p, i, y in pref:",
"- pid = \"0\" * (6 - len(str(p))) + str(p)",
"- if pre == p:",
"+ p... | false | 0.041882 | 0.039452 | 1.061586 | [
"s076856318",
"s643104491"
] |
u740284863 | p04047 | python | s117957140 | s892975584 | 23 | 18 | 3,316 | 2,940 | Accepted | Accepted | 21.74 | N = int(eval(input()))
kushi = sorted(list(map(int,input().split())))
sum = 0
for i in range(2*N):
if i % 2 == 0:
sum += kushi[i]
print(sum)
| N = int(eval(input()))
kushi = sorted(list(map(int,input().split())))
sum = 0
for i in range(0,2*N,2):
sum += kushi[i]
print(sum)
| 7 | 6 | 153 | 133 | N = int(eval(input()))
kushi = sorted(list(map(int, input().split())))
sum = 0
for i in range(2 * N):
if i % 2 == 0:
sum += kushi[i]
print(sum)
| N = int(eval(input()))
kushi = sorted(list(map(int, input().split())))
sum = 0
for i in range(0, 2 * N, 2):
sum += kushi[i]
print(sum)
| false | 14.285714 | [
"-for i in range(2 * N):",
"- if i % 2 == 0:",
"- sum += kushi[i]",
"+for i in range(0, 2 * N, 2):",
"+ sum += kushi[i]"
] | false | 0.041606 | 0.118245 | 0.351865 | [
"s117957140",
"s892975584"
] |
u279493135 | p03013 | python | s918354394 | s107831959 | 176 | 136 | 11,552 | 11,580 | Accepted | Accepted | 22.73 | 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
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upp... | 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, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ... | 34 | 38 | 935 | 1,069 | 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
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase... | 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, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_... | false | 10.526316 | [
"-from itertools import accumulate, permutations, combinations, product",
"+from itertools import accumulate, permutations, combinations, product, groupby",
"+from functools import reduce",
"+def ZIP(n):",
"+ return list(zip(*(MAP() for _ in range(n))))",
"+",
"+",
"-ng = [0] * (N + 1)",
"-for i ... | false | 0.071123 | 0.047937 | 1.483675 | [
"s918354394",
"s107831959"
] |
u869919400 | p03031 | python | s693266866 | s265275697 | 217 | 40 | 41,456 | 9,128 | Accepted | Accepted | 81.57 | N, M = list(map(int, input().split()))
KS = [list(map(int, input().split())) for i in range(M)]
P = list(map(int, input().split()))
ans = 0
for i in range(2**N):
bit = str(bin(i))[2:].zfill(N)
for (_, *s), p in zip(KS, P):
ons = 0
for si in s:
ons += int(bit[si-1])
... | N, M = list(map(int, input().split()))
KS = [list(map(int, input().split())) for i in range(M)]
P = list(map(int, input().split()))
ans = 0
for i in range(2**N):
switches = bin(i)[2:].zfill(N)
all_light_on = True
for j in range(M):
_, *S = KS[j]
on = 0
for k, s in enumera... | 17 | 22 | 394 | 562 | N, M = list(map(int, input().split()))
KS = [list(map(int, input().split())) for i in range(M)]
P = list(map(int, input().split()))
ans = 0
for i in range(2**N):
bit = str(bin(i))[2:].zfill(N)
for (_, *s), p in zip(KS, P):
ons = 0
for si in s:
ons += int(bit[si - 1])
if ons %... | N, M = list(map(int, input().split()))
KS = [list(map(int, input().split())) for i in range(M)]
P = list(map(int, input().split()))
ans = 0
for i in range(2**N):
switches = bin(i)[2:].zfill(N)
all_light_on = True
for j in range(M):
_, *S = KS[j]
on = 0
for k, s in enumerate(switches,... | false | 22.727273 | [
"- bit = str(bin(i))[2:].zfill(N)",
"- for (_, *s), p in zip(KS, P):",
"- ons = 0",
"- for si in s:",
"- ons += int(bit[si - 1])",
"- if ons % 2 != p:",
"+ switches = bin(i)[2:].zfill(N)",
"+ all_light_on = True",
"+ for j in range(M):",
"+ _, ... | false | 0.054109 | 0.03667 | 1.475566 | [
"s693266866",
"s265275697"
] |
u309120194 | p03060 | python | s577559061 | s324693634 | 30 | 26 | 9,156 | 9,164 | Accepted | Accepted | 13.33 | N = int(eval(input()))
V = list(map(int, input().split()))
C = list(map(int, input().split()))
D = [V[i] - C[i] for i in range(N)]
ans = 0
for i in range(N):
if D[i] > 0: ans += D[i]
print(ans) | N = int(eval(input()))
V = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
for i in range(N):
tmp = V[i] - C[i]
if tmp > 0: ans += tmp
print(ans) | 10 | 10 | 200 | 183 | N = int(eval(input()))
V = list(map(int, input().split()))
C = list(map(int, input().split()))
D = [V[i] - C[i] for i in range(N)]
ans = 0
for i in range(N):
if D[i] > 0:
ans += D[i]
print(ans)
| N = int(eval(input()))
V = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
for i in range(N):
tmp = V[i] - C[i]
if tmp > 0:
ans += tmp
print(ans)
| false | 0 | [
"-D = [V[i] - C[i] for i in range(N)]",
"- if D[i] > 0:",
"- ans += D[i]",
"+ tmp = V[i] - C[i]",
"+ if tmp > 0:",
"+ ans += tmp"
] | false | 0.03974 | 0.03979 | 0.998739 | [
"s577559061",
"s324693634"
] |
u094191970 | p02936 | python | s368376425 | s144360782 | 1,794 | 1,587 | 62,780 | 62,804 | Accepted | Accepted | 11.54 | from collections import deque
n,q=list(map(int,input().split()))
tree=[[] for i in range(n)]
for i in range(n-1):
i,j=list(map(int,input().split()))
tree[i-1].append(j-1)
tree[j-1].append(i-1)
cnt=[0 for i in range(n)]
for i in range(q):
p,x=list(map(int,input().split()))
cnt[p-1]+=x
seen=set([0... | from collections import deque
def main():
n,q=list(map(int,input().split()))
tree=[[] for i in range(n)]
for i in range(n-1):
i,j=list(map(int,input().split()))
tree[i-1].append(j-1)
tree[j-1].append(i-1)
cnt=[0 for i in range(n)]
for i in range(q):
p,x=list(map(int,input().split()))
cnt... | 30 | 34 | 489 | 563 | from collections import deque
n, q = list(map(int, input().split()))
tree = [[] for i in range(n)]
for i in range(n - 1):
i, j = list(map(int, input().split()))
tree[i - 1].append(j - 1)
tree[j - 1].append(i - 1)
cnt = [0 for i in range(n)]
for i in range(q):
p, x = list(map(int, input().split()))
... | from collections import deque
def main():
n, q = list(map(int, input().split()))
tree = [[] for i in range(n)]
for i in range(n - 1):
i, j = list(map(int, input().split()))
tree[i - 1].append(j - 1)
tree[j - 1].append(i - 1)
cnt = [0 for i in range(n)]
for i in range(q):
... | false | 11.764706 | [
"-n, q = list(map(int, input().split()))",
"-tree = [[] for i in range(n)]",
"-for i in range(n - 1):",
"- i, j = list(map(int, input().split()))",
"- tree[i - 1].append(j - 1)",
"- tree[j - 1].append(i - 1)",
"-cnt = [0 for i in range(n)]",
"-for i in range(q):",
"- p, x = list(map(int,... | false | 0.042091 | 0.043661 | 0.964039 | [
"s368376425",
"s144360782"
] |
u965397031 | p02595 | python | s077735285 | s543215038 | 880 | 443 | 116,644 | 9,016 | Accepted | Accepted | 49.66 | n, d = list(map(int, input().split()))
xy = [list(map(int, input().split())) for _ in range(n)]
x, y = [list(i) for i in zip(*xy)]
ans = 0
d = d ** 2
for i in range(n):
if ( x[i] ** 2 + y[i] ** 2 ) <= d:
ans += 1
print(ans) | #下手にlist作って呼び出すよりも、逐次計算するほうが早い?
n, d = list(map(int, input().split()))
ans = 0
d = d ** 2
for i in range(n):
x, y = list(map(int, input().split()))
if d >= x ** 2 + y ** 2:
ans += 1
print(ans) | 11 | 11 | 235 | 208 | n, d = list(map(int, input().split()))
xy = [list(map(int, input().split())) for _ in range(n)]
x, y = [list(i) for i in zip(*xy)]
ans = 0
d = d**2
for i in range(n):
if (x[i] ** 2 + y[i] ** 2) <= d:
ans += 1
print(ans)
| # 下手にlist作って呼び出すよりも、逐次計算するほうが早い?
n, d = list(map(int, input().split()))
ans = 0
d = d**2
for i in range(n):
x, y = list(map(int, input().split()))
if d >= x**2 + y**2:
ans += 1
print(ans)
| false | 0 | [
"+# 下手にlist作って呼び出すよりも、逐次計算するほうが早い?",
"-xy = [list(map(int, input().split())) for _ in range(n)]",
"-x, y = [list(i) for i in zip(*xy)]",
"- if (x[i] ** 2 + y[i] ** 2) <= d:",
"+ x, y = list(map(int, input().split()))",
"+ if d >= x**2 + y**2:"
] | false | 0.039647 | 0.087111 | 0.45513 | [
"s077735285",
"s543215038"
] |
u396961814 | p03273 | python | s117196071 | s650834238 | 21 | 18 | 3,188 | 3,188 | Accepted | Accepted | 14.29 | h, w = [int(x) for x in input().split()]
A = []
rm_pos = []
for i in range(h):
a = eval(input())
if a != '.' * w:
A += [list(a)]
flg = True
# 白マスのみの列 検索
for j in range(w):
for i in range(len(A)):
if A[i][j] != '.':
flg = False
break
if flg == T... | h, w = [int(x) for x in input().split()]
A = []
# 列削除用フラグ初期化 1で削除
rm_pos = [1]*w
# 白マスのみの行はリスト追加しない
for i in range(h):
a = eval(input())
if a != '.' * w:
A += [list(a)]
# 白マスのみの列 検索、. が含まれていない場合は 削除フラグを0に
for j in range(w):
for i in range(len(A)):
if A[i][j] != '.':
... | 31 | 27 | 525 | 548 | h, w = [int(x) for x in input().split()]
A = []
rm_pos = []
for i in range(h):
a = eval(input())
if a != "." * w:
A += [list(a)]
flg = True
# 白マスのみの列 検索
for j in range(w):
for i in range(len(A)):
if A[i][j] != ".":
flg = False
break
if flg == True:
rm_pos ... | h, w = [int(x) for x in input().split()]
A = []
# 列削除用フラグ初期化 1で削除
rm_pos = [1] * w
# 白マスのみの行はリスト追加しない
for i in range(h):
a = eval(input())
if a != "." * w:
A += [list(a)]
# 白マスのみの列 検索、. が含まれていない場合は 削除フラグを0に
for j in range(w):
for i in range(len(A)):
if A[i][j] != ".":
rm_pos[j] =... | false | 12.903226 | [
"-rm_pos = []",
"+# 列削除用フラグ初期化 1で削除",
"+rm_pos = [1] * w",
"+# 白マスのみの行はリスト追加しない",
"-flg = True",
"-# 白マスのみの列 検索",
"+# 白マスのみの列 検索、. が含まれていない場合は 削除フラグを0に",
"- flg = False",
"+ rm_pos[j] = 0",
"- if flg == True:",
"- rm_pos += [j]",
"- flg = True",
"-rm_pos = ... | false | 0.037225 | 0.036837 | 1.010527 | [
"s117196071",
"s650834238"
] |
u753682919 | p02887 | python | s088373073 | s327842501 | 1,532 | 42 | 4,664 | 3,316 | Accepted | Accepted | 97.26 | N=int(eval(input()))
S=list(eval(input()))
s=S.copy()
n=0
for i in range(N-1):
if S[i]==S[i+1]:
del s[i+1-n]
n+=1
print((len(s))) | N=int(eval(input()))
S=eval(input())
n=0
for i in range(N-1):
if S[i]==S[i+1]:
n+=1
print((N-n)) | 9 | 7 | 133 | 94 | N = int(eval(input()))
S = list(eval(input()))
s = S.copy()
n = 0
for i in range(N - 1):
if S[i] == S[i + 1]:
del s[i + 1 - n]
n += 1
print((len(s)))
| N = int(eval(input()))
S = eval(input())
n = 0
for i in range(N - 1):
if S[i] == S[i + 1]:
n += 1
print((N - n))
| false | 22.222222 | [
"-S = list(eval(input()))",
"-s = S.copy()",
"+S = eval(input())",
"- del s[i + 1 - n]",
"-print((len(s)))",
"+print((N - n))"
] | false | 0.061501 | 0.042553 | 1.445297 | [
"s088373073",
"s327842501"
] |
u200887663 | p03013 | python | s544955945 | s865255311 | 199 | 174 | 7,832 | 21,256 | Accepted | Accepted | 12.56 | n,m=list(map(int,input().split()))
broken=[False for i in range(n+1)]
for i in range(m):
a=int(eval(input()))
broken[a]=True
ans=[1]
if broken[1]:
ans.append(0)
else:
ans.append(1)
for i in range(2,n+1):
if broken[i]:
ans.append(0)
else:
ans.append((ans[i-1]+ans[i-2... | #n=int(input())
n,m=list(map(int,input().split()))
#t=int(input())
#al=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
dp=[0]*(n+1)
mod=10**9+7
broken={i:False for i in range(1,n+1)}
for i in range(m):
a=int(eval(input()))
broken[a]=True
if broken[1]:
dp[1]... | 16 | 22 | 338 | 440 | n, m = list(map(int, input().split()))
broken = [False for i in range(n + 1)]
for i in range(m):
a = int(eval(input()))
broken[a] = True
ans = [1]
if broken[1]:
ans.append(0)
else:
ans.append(1)
for i in range(2, n + 1):
if broken[i]:
ans.append(0)
else:
ans.append((ans[i - 1] + ... | # n=int(input())
n, m = list(map(int, input().split()))
# t=int(input())
# al=list(map(int,input().split()))
# l=[list(map(int,input().split())) for i in range(n)]
dp = [0] * (n + 1)
mod = 10**9 + 7
broken = {i: False for i in range(1, n + 1)}
for i in range(m):
a = int(eval(input()))
broken[a] = True
if broken... | false | 27.272727 | [
"+# n=int(input())",
"-broken = [False for i in range(n + 1)]",
"+# t=int(input())",
"+# al=list(map(int,input().split()))",
"+# l=[list(map(int,input().split())) for i in range(n)]",
"+dp = [0] * (n + 1)",
"+mod = 10**9 + 7",
"+broken = {i: False for i in range(1, n + 1)}",
"-ans = [1]",
"- an... | false | 0.037588 | 0.037992 | 0.989367 | [
"s544955945",
"s865255311"
] |
u137226361 | p02996 | python | s575139223 | s021939783 | 820 | 721 | 39,796 | 39,768 | Accepted | Accepted | 12.07 | n = int(eval(input()))
ls = []
for _ in range(n):
a, b = list(map(int, input().split()))
ls.append([b,a])
ls = sorted(ls)
t=0
for i in ls:
t += i[1]
if t > i[0]:
print('No')
exit(0)
print('Yes') | def main():
n = int(eval(input()))
ls = []
for _ in range(n):
a, b = list(map(int, input().split()))
ls.append([b,a])
ls = sorted(ls)
t=0
for i in ls:
t += i[1]
if t > i[0]:
print('No')
exit(0)
print('Yes')
if __name__ ==... | 13 | 16 | 227 | 332 | n = int(eval(input()))
ls = []
for _ in range(n):
a, b = list(map(int, input().split()))
ls.append([b, a])
ls = sorted(ls)
t = 0
for i in ls:
t += i[1]
if t > i[0]:
print("No")
exit(0)
print("Yes")
| def main():
n = int(eval(input()))
ls = []
for _ in range(n):
a, b = list(map(int, input().split()))
ls.append([b, a])
ls = sorted(ls)
t = 0
for i in ls:
t += i[1]
if t > i[0]:
print("No")
exit(0)
print("Yes")
if __name__ == "__main__... | false | 18.75 | [
"-n = int(eval(input()))",
"-ls = []",
"-for _ in range(n):",
"- a, b = list(map(int, input().split()))",
"- ls.append([b, a])",
"-ls = sorted(ls)",
"-t = 0",
"-for i in ls:",
"- t += i[1]",
"- if t > i[0]:",
"- print(\"No\")",
"- exit(0)",
"-print(\"Yes\")",
"+de... | false | 0.139409 | 0.043805 | 3.182468 | [
"s575139223",
"s021939783"
] |
u150984829 | p00012 | python | s708872570 | s126693480 | 30 | 20 | 5,592 | 5,588 | Accepted | Accepted | 33.33 | import sys
def f(h,i,j,k):
z=(j-h)*(y-k)-(k-i)*(x-j);return([-1,1][z>0],0)[z==0]
for e in sys.stdin:
p,q,r,s,t,u,x,y=list(map(float,e.split()))
g=[p,q,r,s,t,u]
print((['NO','YES'][f(*g[:4])==f(*g[2:6])==f(*g[4:],*g[:2])]))
| import sys
def f(h,i,j,k):
z=(j-h)*(y-k)-(k-i)*(x-j);return([-1,1][z>0],0)[z==0]
for e in sys.stdin:
p,q,r,s,t,u,x,y=list(map(float,e.split()))
print((['NO','YES'][f(p,q,r,s)==f(r,s,t,u)==f(t,u,p,q)]))
| 7 | 6 | 225 | 202 | import sys
def f(h, i, j, k):
z = (j - h) * (y - k) - (k - i) * (x - j)
return ([-1, 1][z > 0], 0)[z == 0]
for e in sys.stdin:
p, q, r, s, t, u, x, y = list(map(float, e.split()))
g = [p, q, r, s, t, u]
print((["NO", "YES"][f(*g[:4]) == f(*g[2:6]) == f(*g[4:], *g[:2])]))
| import sys
def f(h, i, j, k):
z = (j - h) * (y - k) - (k - i) * (x - j)
return ([-1, 1][z > 0], 0)[z == 0]
for e in sys.stdin:
p, q, r, s, t, u, x, y = list(map(float, e.split()))
print((["NO", "YES"][f(p, q, r, s) == f(r, s, t, u) == f(t, u, p, q)]))
| false | 14.285714 | [
"- g = [p, q, r, s, t, u]",
"- print(([\"NO\", \"YES\"][f(*g[:4]) == f(*g[2:6]) == f(*g[4:], *g[:2])]))",
"+ print(([\"NO\", \"YES\"][f(p, q, r, s) == f(r, s, t, u) == f(t, u, p, q)]))"
] | false | 0.041288 | 0.066831 | 0.617791 | [
"s708872570",
"s126693480"
] |
u620084012 | p03831 | python | s760509029 | s607012657 | 244 | 223 | 62,704 | 62,704 | Accepted | Accepted | 8.61 | import sys
import math
def input():
return sys.stdin.readline()[:-1]
def main():
N, A, B = list(map(int,input().split()))
X = sorted(list(map(int,input().split())))
Y = [0 for k in range(N)]
for k in range(1,N):
Y[k-1] = X[k] - X[k-1]
Y = sorted(Y)
ans = 0
for e i... | N, A, B = list(map(int,input().split()))
X = list(map(int,input().split()))
ans = 0
for k in range(N-1):
ans += min((X[k+1]-X[k])*A,B)
print(ans)
| 20 | 6 | 404 | 149 | import sys
import math
def input():
return sys.stdin.readline()[:-1]
def main():
N, A, B = list(map(int, input().split()))
X = sorted(list(map(int, input().split())))
Y = [0 for k in range(N)]
for k in range(1, N):
Y[k - 1] = X[k] - X[k - 1]
Y = sorted(Y)
ans = 0
for e in Y:
... | N, A, B = list(map(int, input().split()))
X = list(map(int, input().split()))
ans = 0
for k in range(N - 1):
ans += min((X[k + 1] - X[k]) * A, B)
print(ans)
| false | 70 | [
"-import sys",
"-import math",
"-",
"-",
"-def input():",
"- return sys.stdin.readline()[:-1]",
"-",
"-",
"-def main():",
"- N, A, B = list(map(int, input().split()))",
"- X = sorted(list(map(int, input().split())))",
"- Y = [0 for k in range(N)]",
"- for k in range(1, N):",
... | false | 0.068652 | 0.036863 | 1.862362 | [
"s760509029",
"s607012657"
] |
u600402037 | p03045 | python | s151861846 | s411070296 | 562 | 411 | 23,508 | 14,616 | Accepted | Accepted | 26.87 | import sys
import numpy as np
sys.setrecursionlimit(10 ** 7)
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, M = lr()
# Aでxの根を求める
def find(A, x):
p = A[x]
if p == x:
return x
a = find(A, p)
A[x] = a
return a
... | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# Aでxの根を求める
def find(A,x):
p = A[x]
if p == x: return x
a = find(A,p)
A[x] = a
return a
# Aでxとyの属する集合の併合
def union(A, x, y):
if find(A,x) > fin... | 37 | 34 | 733 | 670 | import sys
import numpy as np
sys.setrecursionlimit(10**7)
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, M = lr()
# Aでxの根を求める
def find(A, x):
p = A[x]
if p == x:
return x
a = find(A, p)
A[x] = a
return a
# Aでxとyの属する集合の併合
def... | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# Aでxの根を求める
def find(A, x):
p = A[x]
if p == x:
return x
a = find(A, p)
A[x] = a
return a
# Aでxとyの属する集合の併合
def union(A, x, y):
if find(A, x) > find(A,... | false | 8.108108 | [
"+# coding: utf-8",
"-import numpy as np",
"-sys.setrecursionlimit(10**7)",
"-N, M = lr()",
"- # 根をbx(値の小さい方)に統一",
"- A[by] = bx",
"+ A[by] = bx # 根をbxに統一",
"-V = [i for i in range(N)]",
"-for i in range(M):",
"+N, M = lr()",
"+V = [x for x in range(N + 1)]",
"+for _ in range(M):",
... | false | 0.073988 | 0.077181 | 0.958623 | [
"s151861846",
"s411070296"
] |
u636683284 | p03574 | python | s532154013 | s153901232 | 183 | 95 | 39,920 | 68,356 | Accepted | Accepted | 48.09 | h,w = list(map(int,input().split()))
l=[]
for i in range(h):
s = list(eval(input()))
l.append(s)
for i in range(h):
for j in range(w):
kazu = 0
if l[i][j] == '.':
if j != 0 and l[i][j-1] == '#':
kazu += 1
if j != w-1 and l[i][j+1] == '#':
kazu += 1
if i != 0 ... | h,w = list(map(int,input().split()))
l = [['*']*(w+2)]
for i in range(h):
l.append(['*']+list(eval(input()))+['*'])
l.append(['*']*(w+2))
for i in range(1,h+1):
s = ''
for j in range(1,w+1):
directions = [(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1),(-1,0),(-1,1)]
alist = [(i+dir[0],... | 28 | 21 | 770 | 552 | h, w = list(map(int, input().split()))
l = []
for i in range(h):
s = list(eval(input()))
l.append(s)
for i in range(h):
for j in range(w):
kazu = 0
if l[i][j] == ".":
if j != 0 and l[i][j - 1] == "#":
kazu += 1
if j != w - 1 and l[i][j + 1] == "#":
... | h, w = list(map(int, input().split()))
l = [["*"] * (w + 2)]
for i in range(h):
l.append(["*"] + list(eval(input())) + ["*"])
l.append(["*"] * (w + 2))
for i in range(1, h + 1):
s = ""
for j in range(1, w + 1):
directions = [
(0, 1),
(1, 1),
(1, 0),
(1... | false | 25 | [
"-l = []",
"+l = [[\"*\"] * (w + 2)]",
"- s = list(eval(input()))",
"- l.append(s)",
"-for i in range(h):",
"- for j in range(w):",
"- kazu = 0",
"- if l[i][j] == \".\":",
"- if j != 0 and l[i][j - 1] == \"#\":",
"- kazu += 1",
"- if j ... | false | 0.061277 | 0.051191 | 1.197028 | [
"s532154013",
"s153901232"
] |
u995053308 | p03986 | python | s501252669 | s010178375 | 133 | 117 | 5,648 | 5,652 | Accepted | Accepted | 12.03 | # -*- coding: cp932 -*-
import sys
import os
import re
import datetime
import bisect
### main ###
X = eval(input())
restS = []
for c in X:
#print("c = {}".format(c))
restS.append(c)
if c == 'T':
while(len(restS) >= 2):
#print("restS = {}, last 2 string = {} ".format... | # -*- coding: cp932 -*-
import sys
import os
import re
import datetime
import bisect
### main ###
X = eval(input())
restS = []
for c in X:
#print("c = {}".format(c))
restS.append(c)
if c == 'T':
while(len(restS) >= 2):
#print("restS = {}, last 2 string = {} ".format... | 29 | 30 | 654 | 823 | # -*- coding: cp932 -*-
import sys
import os
import re
import datetime
import bisect
### main ###
X = eval(input())
restS = []
for c in X:
# print("c = {}".format(c))
restS.append(c)
if c == "T":
while len(restS) >= 2:
# print("restS = {}, last 2 string = {} ".format(restS, restS[-2:]))... | # -*- coding: cp932 -*-
import sys
import os
import re
import datetime
import bisect
### main ###
X = eval(input())
restS = []
for c in X:
# print("c = {}".format(c))
restS.append(c)
if c == "T":
while len(restS) >= 2:
# print("restS = {}, last 2 string = {} ".format(restS, restS[-2:]))... | false | 3.333333 | [
"- if \"\".join(restS[-2:]) == \"ST\":",
"- # print(\"hit\")",
"+ # if(\"\".join(restS[-2:]) == 'ST'):",
"+ if restS[-2] == \"S\" and restS[-1] == \"T\": # Higher Speed than join ?",
"+ # print(\"hit restS[-2] = {}, restS[-1] = {}\".format(rest... | false | 0.167676 | 0.049993 | 3.353995 | [
"s501252669",
"s010178375"
] |
u606878291 | p02983 | python | s644369973 | s228643952 | 750 | 60 | 2,940 | 2,940 | Accepted | Accepted | 92 | L, R = list(map(int, input().split(' ')))
if R - L >= 2018:
print((0))
else:
min_value = 2018
for i in range(L, R):
for j in range(i + 1, R + 1):
min_value = min(min_value, i * j % 2019)
print(min_value)
| L, R = list(map(int, input().split(' ')))
min_value = 2018
for i in range(L, R):
for j in range(i + 1, R + 1):
min_value = min(min_value, i * j % 2019)
if min_value == 0:
break
else:
continue
break
print(min_value)
| 10 | 13 | 242 | 275 | L, R = list(map(int, input().split(" ")))
if R - L >= 2018:
print((0))
else:
min_value = 2018
for i in range(L, R):
for j in range(i + 1, R + 1):
min_value = min(min_value, i * j % 2019)
print(min_value)
| L, R = list(map(int, input().split(" ")))
min_value = 2018
for i in range(L, R):
for j in range(i + 1, R + 1):
min_value = min(min_value, i * j % 2019)
if min_value == 0:
break
else:
continue
break
print(min_value)
| false | 23.076923 | [
"-if R - L >= 2018:",
"- print((0))",
"-else:",
"- min_value = 2018",
"- for i in range(L, R):",
"- for j in range(i + 1, R + 1):",
"- min_value = min(min_value, i * j % 2019)",
"- print(min_value)",
"+min_value = 2018",
"+for i in range(L, R):",
"+ for j in rang... | false | 0.068139 | 0.007032 | 9.689758 | [
"s644369973",
"s228643952"
] |
u562935282 | p02913 | python | s936370814 | s737964494 | 573 | 524 | 231,560 | 229,768 | Accepted | Accepted | 8.55 | # 解説
def main():
N = int(eval(input()))
s = eval(input())
dp = [[0] * N for _ in range(N)]
ans = 0
for i in reversed(list(range(N))):
for j in reversed(list(range(i, N))):
if s[i] == s[j]:
if i + 1 < N and j + 1 < N:
dp[i][j] = mi... | # 解説
def main():
N = int(eval(input()))
s = eval(input())
dp = [[0] * (N + 1) for _ in range(N + 1)]
ans = 0
for i in reversed(list(range(N))):
for j in reversed(list(range(i, N))):
if s[i] == s[j]:
dp[i][j] = min(dp[i + 1][j + 1] + 1, j - i)
... | 32 | 18 | 682 | 390 | # 解説
def main():
N = int(eval(input()))
s = eval(input())
dp = [[0] * N for _ in range(N)]
ans = 0
for i in reversed(list(range(N))):
for j in reversed(list(range(i, N))):
if s[i] == s[j]:
if i + 1 < N and j + 1 < N:
dp[i][j] = min(dp[i + 1][j ... | # 解説
def main():
N = int(eval(input()))
s = eval(input())
dp = [[0] * (N + 1) for _ in range(N + 1)]
ans = 0
for i in reversed(list(range(N))):
for j in reversed(list(range(i, N))):
if s[i] == s[j]:
dp[i][j] = min(dp[i + 1][j + 1] + 1, j - i)
ans =... | false | 43.75 | [
"- dp = [[0] * N for _ in range(N)]",
"+ dp = [[0] * (N + 1) for _ in range(N + 1)]",
"- if i + 1 < N and j + 1 < N:",
"- dp[i][j] = min(dp[i + 1][j + 1] + 1, j - i)",
"- ans = max(ans, dp[i][j])",
"- else:",
"- ... | false | 0.038418 | 0.035986 | 1.067603 | [
"s936370814",
"s737964494"
] |
u815878613 | p02843 | python | s961251340 | s092235169 | 1,614 | 17 | 21,356 | 2,940 | Accepted | Accepted | 98.95 | import sys
import numpy as np
def main():
X = int(eval(input()))
V = (100, 101, 102, 103, 104, 105)
m1 = X // 100
if m1 == 0:
print((0))
sys.exit()
dp = np.full([(m1 + 1) * 105], 10**9, np.int32)
dp[0] = 0
for j in range(1, m1 + 1):
for v in V:
... | X = int(eval(input()))
for i in range(1000):
if 100 * i <= X and X <= 105 * i:
print((1))
break
else:
print((0))
| 27 | 7 | 497 | 133 | import sys
import numpy as np
def main():
X = int(eval(input()))
V = (100, 101, 102, 103, 104, 105)
m1 = X // 100
if m1 == 0:
print((0))
sys.exit()
dp = np.full([(m1 + 1) * 105], 10**9, np.int32)
dp[0] = 0
for j in range(1, m1 + 1):
for v in V:
w = v * j... | X = int(eval(input()))
for i in range(1000):
if 100 * i <= X and X <= 105 * i:
print((1))
break
else:
print((0))
| false | 74.074074 | [
"-import sys",
"-import numpy as np",
"-",
"-",
"-def main():",
"- X = int(eval(input()))",
"- V = (100, 101, 102, 103, 104, 105)",
"- m1 = X // 100",
"- if m1 == 0:",
"- print((0))",
"- sys.exit()",
"- dp = np.full([(m1 + 1) * 105], 10**9, np.int32)",
"- dp[0... | false | 0.435306 | 0.074286 | 5.859869 | [
"s961251340",
"s092235169"
] |
u380524497 | p02901 | python | s401920463 | s282583299 | 769 | 430 | 3,188 | 3,836 | Accepted | Accepted | 44.08 | def main():
n, m = list(map(int, input().split()))
all_patterns = 2**n
DP = [10**9] * all_patterns
DP[0] = 0
for _ in range(m):
cost, types = list(map(int, input().split()))
to_open = list(map(int, input().split()))
openable = 0
for open in to_open:
... | def main():
n, m = list(map(int, input().split()))
DP = [10**9] * 2**n
DP[0] = 0
updated_patterns = {0}
for _ in range(m):
cost, types = list(map(int, input().split()))
to_open = list(map(int, input().split()))
openable = 0
for open in to_open:
... | 29 | 32 | 714 | 810 | def main():
n, m = list(map(int, input().split()))
all_patterns = 2**n
DP = [10**9] * all_patterns
DP[0] = 0
for _ in range(m):
cost, types = list(map(int, input().split()))
to_open = list(map(int, input().split()))
openable = 0
for open in to_open:
openab... | def main():
n, m = list(map(int, input().split()))
DP = [10**9] * 2**n
DP[0] = 0
updated_patterns = {0}
for _ in range(m):
cost, types = list(map(int, input().split()))
to_open = list(map(int, input().split()))
openable = 0
for open in to_open:
openable +=... | false | 9.375 | [
"- all_patterns = 2**n",
"- DP = [10**9] * all_patterns",
"+ DP = [10**9] * 2**n",
"+ updated_patterns = {0}",
"- for opened in range(all_patterns):",
"+ new_updated = set()",
"+ for opened in updated_patterns:",
"+ new_updated.add(pattern)",
"+ ... | false | 0.035374 | 0.041624 | 0.84984 | [
"s401920463",
"s282583299"
] |
u493520238 | p02948 | python | s981321878 | s697942871 | 452 | 307 | 27,344 | 89,376 | Accepted | Accepted | 32.08 | import heapq
N, M = list(map(int, input().split()))
day_rew = {}
for _ in range(N):
a, b = list(map(int, input().split()))
day_rew.setdefault(a,[])
day_rew[a].append(b)
ans = 0
job_rew = []
heapq.heapify(job_rew)
for i in range(1, M+1):
if i in day_rew:
for r in day_rew[i]:
... | import heapq
n,m = list(map(int, input().split()))
day_rews_l = [ [] for _ in range(m+1)]
for _ in range(n):
a,b = list(map(int, input().split()))
if a > m: continue
day_rews_l[a].append(b)
jobs = []
ans = 0
for i in range(1,m+1):
for rew in day_rews_l[i]:
heapq.heappush(jobs, (... | 23 | 21 | 466 | 414 | import heapq
N, M = list(map(int, input().split()))
day_rew = {}
for _ in range(N):
a, b = list(map(int, input().split()))
day_rew.setdefault(a, [])
day_rew[a].append(b)
ans = 0
job_rew = []
heapq.heapify(job_rew)
for i in range(1, M + 1):
if i in day_rew:
for r in day_rew[i]:
heapq... | import heapq
n, m = list(map(int, input().split()))
day_rews_l = [[] for _ in range(m + 1)]
for _ in range(n):
a, b = list(map(int, input().split()))
if a > m:
continue
day_rews_l[a].append(b)
jobs = []
ans = 0
for i in range(1, m + 1):
for rew in day_rews_l[i]:
heapq.heappush(jobs, (-1... | false | 8.695652 | [
"-N, M = list(map(int, input().split()))",
"-day_rew = {}",
"-for _ in range(N):",
"+n, m = list(map(int, input().split()))",
"+day_rews_l = [[] for _ in range(m + 1)]",
"+for _ in range(n):",
"- day_rew.setdefault(a, [])",
"- day_rew[a].append(b)",
"+ if a > m:",
"+ continue",
"... | false | 0.068643 | 0.036688 | 1.87101 | [
"s981321878",
"s697942871"
] |
u371763408 | p03212 | python | s692606310 | s870631519 | 324 | 96 | 19,228 | 2,940 | Accepted | Accepted | 70.37 | n=int(eval(input()))
s=[]
def dfs(string,cur):
if cur==len(str(n)):
if string.count('3')>0 and string.count('5')>0 and string.count('7'):
s.append(string)
return
dfs(string+"",cur+1)
dfs(string+"7",cur+1)
dfs(string+"5",cur+1)
dfs(string+"3",cur+1)
dfs("",0)
cnt=0
for i in set(s):... | n=int(eval(input()))
def dfs(s):
if int(s)>n:
return 0
ret = 1 if all(s.count(c) for c in "753") else 0
for c in '753':
ret+=dfs(s+c)
return ret
print((dfs("0"))) | 18 | 9 | 355 | 178 | n = int(eval(input()))
s = []
def dfs(string, cur):
if cur == len(str(n)):
if string.count("3") > 0 and string.count("5") > 0 and string.count("7"):
s.append(string)
return
dfs(string + "", cur + 1)
dfs(string + "7", cur + 1)
dfs(string + "5", cur + 1)
dfs(string + "3",... | n = int(eval(input()))
def dfs(s):
if int(s) > n:
return 0
ret = 1 if all(s.count(c) for c in "753") else 0
for c in "753":
ret += dfs(s + c)
return ret
print((dfs("0")))
| false | 50 | [
"-s = []",
"-def dfs(string, cur):",
"- if cur == len(str(n)):",
"- if string.count(\"3\") > 0 and string.count(\"5\") > 0 and string.count(\"7\"):",
"- s.append(string)",
"- return",
"- dfs(string + \"\", cur + 1)",
"- dfs(string + \"7\", cur + 1)",
"- dfs(strin... | false | 0.120618 | 0.045291 | 2.663184 | [
"s692606310",
"s870631519"
] |
u692746605 | p02888 | python | s476430691 | s063078282 | 1,632 | 1,324 | 3,188 | 3,188 | Accepted | Accepted | 18.87 | import bisect
n=int(eval(input()))
l=sorted(map(int,input().split()))
t=0
for i in range(n):
for j in range(i+1,n):
a = j+1
b = bisect.bisect_left(l,l[i]+l[j])
t += b-a if b>a else 0
print(t)
| import bisect
n=int(eval(input()))
l=sorted(map(int,input().split()))
t=0
for i in range(n):
for j in range(i+1,n):
t += bisect.bisect_left(l,l[i]+l[j]) - j - 1
print(t)
| 13 | 11 | 215 | 183 | import bisect
n = int(eval(input()))
l = sorted(map(int, input().split()))
t = 0
for i in range(n):
for j in range(i + 1, n):
a = j + 1
b = bisect.bisect_left(l, l[i] + l[j])
t += b - a if b > a else 0
print(t)
| import bisect
n = int(eval(input()))
l = sorted(map(int, input().split()))
t = 0
for i in range(n):
for j in range(i + 1, n):
t += bisect.bisect_left(l, l[i] + l[j]) - j - 1
print(t)
| false | 15.384615 | [
"- a = j + 1",
"- b = bisect.bisect_left(l, l[i] + l[j])",
"- t += b - a if b > a else 0",
"+ t += bisect.bisect_left(l, l[i] + l[j]) - j - 1"
] | false | 0.043221 | 0.136992 | 0.3155 | [
"s476430691",
"s063078282"
] |
u393253137 | p02954 | python | s680591957 | s679942598 | 165 | 81 | 10,324 | 6,400 | Accepted | Accepted | 50.91 | S = eval(input())
N = len(S)
# Rなら右隣, Lなら左隣のindexを格納
X = [i-1 if S[i] == "L" else i+1 for i in range(N)]
# ループを何度行ってもi番目の元はi+偶数番目にしか移動しない.
# RLの部分は互換の後, 恒等写像なので不変.
# RRRやLLLの部分は 1ループで2の冪乗で精度が上がる.
# ex.) RRRRRRR だと, k回ループで index i の元が i + 2**kに移動する.
# log(2**20)=6.01より10**5程度なら20回ループで十分.
for _ in range(20):
... | #別解
def main():
S = eval(input())
Ans = [0]*len(S)
# 左隣までに Rがr個, Lがl個連続して並んでいる.
r, l = 1, 0
# 左からS+'R'をcheckしていく.
# RRRRRは全て0.
# RLが出てきたら 続くLLLLLの部分は全て0で
# 次にRが出れば初めのRLを決定できる.
for i, s in enumerate(S[1:]+'R', 1):
if s == 'R':
# Rの左隣がL... | 17 | 27 | 425 | 627 | S = eval(input())
N = len(S)
# Rなら右隣, Lなら左隣のindexを格納
X = [i - 1 if S[i] == "L" else i + 1 for i in range(N)]
# ループを何度行ってもi番目の元はi+偶数番目にしか移動しない.
# RLの部分は互換の後, 恒等写像なので不変.
# RRRやLLLの部分は 1ループで2の冪乗で精度が上がる.
# ex.) RRRRRRR だと, k回ループで index i の元が i + 2**kに移動する.
# log(2**20)=6.01より10**5程度なら20回ループで十分.
for _ in range(20):
X = ... | # 別解
def main():
S = eval(input())
Ans = [0] * len(S)
# 左隣までに Rがr個, Lがl個連続して並んでいる.
r, l = 1, 0
# 左からS+'R'をcheckしていく.
# RRRRRは全て0.
# RLが出てきたら 続くLLLLLの部分は全て0で
# 次にRが出れば初めのRLを決定できる.
for i, s in enumerate(S[1:] + "R", 1):
if s == "R":
# Rの左隣がLのとき
if l:
... | false | 37.037037 | [
"-S = eval(input())",
"-N = len(S)",
"-# Rなら右隣, Lなら左隣のindexを格納",
"-X = [i - 1 if S[i] == \"L\" else i + 1 for i in range(N)]",
"-# ループを何度行ってもi番目の元はi+偶数番目にしか移動しない.",
"-# RLの部分は互換の後, 恒等写像なので不変.",
"-# RRRやLLLの部分は 1ループで2の冪乗で精度が上がる.",
"-# ex.) RRRRRRR だと, k回ループで index i の元が i + 2**kに移動する.",
"-# log(2**20... | false | 0.037309 | 0.049905 | 0.74761 | [
"s680591957",
"s679942598"
] |
u638057737 | p02708 | python | s427949887 | s776223404 | 80 | 20 | 9,152 | 9,192 | Accepted | Accepted | 75 | MOD = 10**9 + 7
N,K = list(map(int,input().split()))
s = 0
for k in range(K, N+2):
s = (s + N*k - k*k + k + 1) % MOD
print(s) | N,K = list(map(int,input().split()))
print(((((N+1)*(N+2-K)*(K+N+1))//2 - ((N+1)*(N+2)*(2*N+3))//6 + (K*(K-1)*(2*K-1))//6 + N + 2 - K) % (10**9 + 7))) | 7 | 2 | 127 | 143 | MOD = 10**9 + 7
N, K = list(map(int, input().split()))
s = 0
for k in range(K, N + 2):
s = (s + N * k - k * k + k + 1) % MOD
print(s)
| N, K = list(map(int, input().split()))
print(
(
(
((N + 1) * (N + 2 - K) * (K + N + 1)) // 2
- ((N + 1) * (N + 2) * (2 * N + 3)) // 6
+ (K * (K - 1) * (2 * K - 1)) // 6
+ N
+ 2
- K
)
% (10**9 + 7)
)
)
| false | 71.428571 | [
"-MOD = 10**9 + 7",
"-s = 0",
"-for k in range(K, N + 2):",
"- s = (s + N * k - k * k + k + 1) % MOD",
"-print(s)",
"+print(",
"+ (",
"+ (",
"+ ((N + 1) * (N + 2 - K) * (K + N + 1)) // 2",
"+ - ((N + 1) * (N + 2) * (2 * N + 3)) // 6",
"+ + (K * (K - ... | false | 0.047279 | 0.039418 | 1.199426 | [
"s427949887",
"s776223404"
] |
u191874006 | p03073 | python | s487358547 | s563706350 | 183 | 78 | 40,176 | 73,928 | Accepted | Accepted | 57.38 | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | 39 | 39 | 931 | 923 | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | false | 0 | [
"-ans1 = 0",
"+cnt1 = 0",
"- if i % 2 == 0:",
"+ if i % 2:",
"- ans1 += 1",
"+ cnt1 += 1",
"- ans1 += 1",
"-ans2 = 0",
"+ cnt1 += 1",
"+cnt2 = 0",
"- if i % 2 == 0:",
"+ if i % 2:",
"- ans2 += 1",
"+ cnt2 += 1",
... | false | 0.078115 | 0.058445 | 1.336545 | [
"s487358547",
"s563706350"
] |
u703950586 | p02956 | python | s721815470 | s832689594 | 1,647 | 1,505 | 124,220 | 123,928 | Accepted | Accepted | 8.62 | import sys,queue,math,copy,itertools,bisect,collections,heapq
def main():
MOD = 998244353
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())
N = NI()
dat = [LI() for _ in range(N)]
dat.sort()
yo = [y for _,y in dat]
yo.sort()... | import sys,queue,math,copy,itertools,bisect,collections,heapq
def main():
MOD = 998244353
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())
N = NI()
dat = [LI() for _ in range(N)]
dat.sort()
yo = [y for _,y in dat]
yo.sort()... | 59 | 63 | 1,420 | 1,452 | import sys, queue, math, copy, itertools, bisect, collections, heapq
def main():
MOD = 998244353
LI = lambda: [int(x) for x in sys.stdin.readline().split()]
NI = lambda: int(sys.stdin.readline())
N = NI()
dat = [LI() for _ in range(N)]
dat.sort()
yo = [y for _, y in dat]
yo.sort()
... | import sys, queue, math, copy, itertools, bisect, collections, heapq
def main():
MOD = 998244353
LI = lambda: [int(x) for x in sys.stdin.readline().split()]
NI = lambda: int(sys.stdin.readline())
N = NI()
dat = [LI() for _ in range(N)]
dat.sort()
yo = [y for _, y in dat]
yo.sort()
... | false | 6.349206 | [
"- p = (pow(2, a + d, MOD) - 1) - (pow(2, a, MOD) - 1) - (pow(2, d, MOD) - 1)",
"- q = (pow(2, b + c, MOD) - 1) - (pow(2, b, MOD) - 1) - (pow(2, c, MOD) - 1)",
"- x = p * (pow(2, b, MOD) + pow(2, c, MOD) - 1)",
"- y = q * (pow(2, a, MOD) + pow(2, d, MOD) - 1)",
"+ pa = pow... | false | 0.107779 | 0.106714 | 1.009983 | [
"s721815470",
"s832689594"
] |
u254871849 | p02773 | python | s095234848 | s680769568 | 468 | 344 | 45,292 | 38,392 | Accepted | Accepted | 26.5 | import sys
from collections import Counter
n, *s = sys.stdin.read().split()
def main():
cnt = sorted(Counter(s).items(), key=lambda x: -x[1])
m = cnt[0][1]
ans = [s for s, c in cnt if c == m]
print(*sorted(ans), sep='\n')
if __name__ == '__main__':
main()
| import sys
from collections import Counter
n, *s = sys.stdin.read().split()
def main():
c = Counter(s)
m = max(c.values())
ans = [s for s, v in c.items() if v == m]
print(*sorted(ans), sep='\n')
if __name__ == '__main__':
main()
| 14 | 13 | 302 | 273 | import sys
from collections import Counter
n, *s = sys.stdin.read().split()
def main():
cnt = sorted(Counter(s).items(), key=lambda x: -x[1])
m = cnt[0][1]
ans = [s for s, c in cnt if c == m]
print(*sorted(ans), sep="\n")
if __name__ == "__main__":
main()
| import sys
from collections import Counter
n, *s = sys.stdin.read().split()
def main():
c = Counter(s)
m = max(c.values())
ans = [s for s, v in c.items() if v == m]
print(*sorted(ans), sep="\n")
if __name__ == "__main__":
main()
| false | 7.142857 | [
"- cnt = sorted(Counter(s).items(), key=lambda x: -x[1])",
"- m = cnt[0][1]",
"- ans = [s for s, c in cnt if c == m]",
"+ c = Counter(s)",
"+ m = max(c.values())",
"+ ans = [s for s, v in c.items() if v == m]"
] | false | 0.042713 | 0.043522 | 0.981419 | [
"s095234848",
"s680769568"
] |
u272336707 | p02781 | python | s318977781 | s539765068 | 768 | 29 | 3,064 | 3,940 | Accepted | Accepted | 96.22 | N = int(eval(input()))
K = int(eval(input()))
def dp(n, k): #0以上n以下の数で0でない数字がちょうどk個あるもの。
if k == 0:
return 1
elif n == 0:
return 0
else:
n = int(n)
s = str(n)
digit = len(s)
m, fdigit = divmod(n,10)
if m >= 1:
return int(dp(m, k-1) * fdigit + dp(m-1, k-1)* (9-fdigi... | N = int(eval(input()))
K = int(eval(input()))
from functools import lru_cache
@lru_cache(maxsize=1000)
def dp(n, k): #0以上n以下の数で0でない数字がちょうどk個あるもの。
if k == 0:
return 1
elif n == 0:
return 0
else:
n = int(n)
s = str(n)
digit = len(s)
m, fdigit = divmod(n,10)
if m >= 1:
... | 25 | 28 | 520 | 581 | N = int(eval(input()))
K = int(eval(input()))
def dp(n, k): # 0以上n以下の数で0でない数字がちょうどk個あるもの。
if k == 0:
return 1
elif n == 0:
return 0
else:
n = int(n)
s = str(n)
digit = len(s)
m, fdigit = divmod(n, 10)
if m >= 1:
return int(
... | N = int(eval(input()))
K = int(eval(input()))
from functools import lru_cache
@lru_cache(maxsize=1000)
def dp(n, k): # 0以上n以下の数で0でない数字がちょうどk個あるもの。
if k == 0:
return 1
elif n == 0:
return 0
else:
n = int(n)
s = str(n)
digit = len(s)
m, fdigit = divmod(n, 10)... | false | 10.714286 | [
"+from functools import lru_cache",
"+@lru_cache(maxsize=1000)"
] | false | 0.171383 | 0.036458 | 4.700801 | [
"s318977781",
"s539765068"
] |
u179169725 | p03108 | python | s259706379 | s655232969 | 857 | 709 | 42,088 | 42,092 | Accepted | Accepted | 17.27 | def readln():
import sys
read = sys.stdin.readline
return list(map(int, read().split()))
N, M = readln()
AB = [readln() for _ in range(M)]
A = [ab[0]-1 for ab in AB[::-1]]
B = [ab[1]-1 for ab in AB[::-1]]
class UnionFind:
def __init__(self, N):
self.N = N # ノード数
# 親ノー... | import sys
read = sys.stdin.readline
def readln():
return list(map(int, read().split()))
N, M = readln()
AB = [readln() for _ in range(M)]
A = [ab[0]-1 for ab in AB[::-1]]
B = [ab[1]-1 for ab in AB[::-1]]
class UnionFind:
def __init__(self, N):
self.N = N # ノード数
# 親ノードをしめ... | 62 | 64 | 1,541 | 1,537 | def readln():
import sys
read = sys.stdin.readline
return list(map(int, read().split()))
N, M = readln()
AB = [readln() for _ in range(M)]
A = [ab[0] - 1 for ab in AB[::-1]]
B = [ab[1] - 1 for ab in AB[::-1]]
class UnionFind:
def __init__(self, N):
self.N = N # ノード数
# 親ノードをしめす。負は自身... | import sys
read = sys.stdin.readline
def readln():
return list(map(int, read().split()))
N, M = readln()
AB = [readln() for _ in range(M)]
A = [ab[0] - 1 for ab in AB[::-1]]
B = [ab[1] - 1 for ab in AB[::-1]]
class UnionFind:
def __init__(self, N):
self.N = N # ノード数
# 親ノードをしめす。負は自身が親というこ... | false | 3.125 | [
"+import sys",
"+",
"+read = sys.stdin.readline",
"+",
"+",
"- import sys",
"-",
"- read = sys.stdin.readline"
] | false | 0.03887 | 0.037461 | 1.037636 | [
"s259706379",
"s655232969"
] |
u150984829 | p02386 | python | s054326734 | s639485261 | 70 | 30 | 5,608 | 5,616 | Accepted | Accepted | 57.14 | n=int(eval(input()))
a=[list(map(int,input().split()))for _ in range(n)]
def f():
for i in range(n-1):
d=a[i][:];d[3],d[4]=d[4],d[3]
for j in range(i+1,n):
e=a[j][:];e[3],e[4]=e[4],e[3]
for p in('012345','152043','215304','302541','410352','514320'):
f=[d[int(k)]for k in p]
if f[0]==e[0]and ... | n=int(eval(input()))
a=[list(map(int,input().split()))for _ in range(n)]
def f():
for i in range(n-1):
d=a[i][:];d[3],d[4]=d[4],d[3]
for j in range(i+1,n):
e=a[j][:];e[3],e[4]=e[4],e[3]
for p in([0,1,2,3,4,5],[1,5,2,0,4,3],[2,1,5,3,0,4],[3,0,2,5,4,1],[4,1,0,3,5,2],[5,1,4,3,2,0]):
f=[d[k]for k in ... | 15 | 15 | 432 | 457 | n = int(eval(input()))
a = [list(map(int, input().split())) for _ in range(n)]
def f():
for i in range(n - 1):
d = a[i][:]
d[3], d[4] = d[4], d[3]
for j in range(i + 1, n):
e = a[j][:]
e[3], e[4] = e[4], e[3]
for p in ("012345", "152043", "215304", "3025... | n = int(eval(input()))
a = [list(map(int, input().split())) for _ in range(n)]
def f():
for i in range(n - 1):
d = a[i][:]
d[3], d[4] = d[4], d[3]
for j in range(i + 1, n):
e = a[j][:]
e[3], e[4] = e[4], e[3]
for p in (
[0, 1, 2, 3, 4, 5]... | false | 0 | [
"- for p in (\"012345\", \"152043\", \"215304\", \"302541\", \"410352\", \"514320\"):",
"- f = [d[int(k)] for k in p]",
"+ for p in (",
"+ [0, 1, 2, 3, 4, 5],",
"+ [1, 5, 2, 0, 4, 3],",
"+ [2, 1, 5, 3, 0, 4],",
"+ ... | false | 0.041067 | 0.036625 | 1.12127 | [
"s054326734",
"s639485261"
] |
u525065967 | p03290 | python | s347312364 | s479602857 | 252 | 29 | 3,064 | 3,064 | Accepted | Accepted | 88.49 | d,g = list(map(int,input().split()))
P,C = [],[]
for i in range(1, d+1):
p,c = list(map(int,input().split()))
P.append(p)
C.append(c)
ans = 10**9
for bin in range(1, 1<<d):
cnt = tot = 0
for j in range(d):
if bin & 1<<j:
cnt += P[j]
tot += P[j]*(j+1)*100 +... | d,g = list(map(int,input().split()))
g //= 100
P,C = [],[]
for i in range(1, d+1):
p,c = list(map(int,input().split()))
P.append(p)
C.append(c//100)
ans = 10**9
# print(P)
# print(C)
for bin in range(1, 1<<d):
cnt = tot = 0
for j in range(d):
if bin & 1<<j:
cnt += P... | 24 | 37 | 649 | 1,160 | d, g = list(map(int, input().split()))
P, C = [], []
for i in range(1, d + 1):
p, c = list(map(int, input().split()))
P.append(p)
C.append(c)
ans = 10**9
for bin in range(1, 1 << d):
cnt = tot = 0
for j in range(d):
if bin & 1 << j:
cnt += P[j]
tot += P[j] * (j + 1) *... | d, g = list(map(int, input().split()))
g //= 100
P, C = [], []
for i in range(1, d + 1):
p, c = list(map(int, input().split()))
P.append(p)
C.append(c // 100)
ans = 10**9
# print(P)
# print(C)
for bin in range(1, 1 << d):
cnt = tot = 0
for j in range(d):
if bin & 1 << j:
cnt += P... | false | 35.135135 | [
"+g //= 100",
"- C.append(c)",
"+ C.append(c // 100)",
"+# print(P)",
"+# print(C)",
"- tot += P[j] * (j + 1) * 100 + C[j]",
"+ tot += P[j] * (j + 1) + C[j]",
"+ # print('tot',tot, end=' ')",
"+ # print('cnt',cnt, end='\\n')",
"- now_cnt = cnt",
"- ... | false | 0.055625 | 0.051124 | 1.08805 | [
"s347312364",
"s479602857"
] |
u572122511 | p02831 | python | s205212725 | s242946128 | 41 | 36 | 5,432 | 5,048 | Accepted | Accepted | 12.2 | from fractions import gcd
A, B = list(map(int, input().split()))
print((A * B // gcd(A, B))) | from fractions import gcd
def lcm(x, y):
return x * y // gcd(x, y)
A, B = list(map(int, input().split()))
print((lcm(A, B)))
| 5 | 8 | 90 | 131 | from fractions import gcd
A, B = list(map(int, input().split()))
print((A * B // gcd(A, B)))
| from fractions import gcd
def lcm(x, y):
return x * y // gcd(x, y)
A, B = list(map(int, input().split()))
print((lcm(A, B)))
| false | 37.5 | [
"+",
"+def lcm(x, y):",
"+ return x * y // gcd(x, y)",
"+",
"+",
"-print((A * B // gcd(A, B)))",
"+print((lcm(A, B)))"
] | false | 0.087532 | 0.047767 | 1.832479 | [
"s205212725",
"s242946128"
] |
u535803878 | p03660 | python | s830038314 | s007019675 | 300 | 246 | 114,624 | 91,244 | Accepted | Accepted | 18 | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
### 木の読み込み tree
# サイズが大きいとdefaultdictが早い(for文を書かなくて済む)
from collections import defaultdict
n = int(eval(input()))
ns = defaultdict(set)
for _ in range(n-1):
u,... | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
### 木の読み込み tree
# サイズが大きいとdefaultdictが早い(for文を書かなくて済む)
from collections import defaultdict
n = int(eval(input()))
ns = [[] for _ in range(n)]
for _ in range(n-1):
... | 42 | 42 | 880 | 892 | import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x + "\n")
### 木の読み込み tree
# サイズが大きいとdefaultdictが早い(for文を書かなくて済む)
from collections import defaultdict
n = int(eval(input()))
ns = defaultdict(set)
for _ in range(n - 1):
u, v = list(m... | import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x + "\n")
### 木の読み込み tree
# サイズが大きいとdefaultdictが早い(for文を書かなくて済む)
from collections import defaultdict
n = int(eval(input()))
ns = [[] for _ in range(n)]
for _ in range(n - 1):
u, v = ... | false | 0 | [
"-ns = defaultdict(set)",
"+ns = [[] for _ in range(n)]",
"- ns[u].add(v)",
"- ns[v].add(u)",
"+ ns[u].append(v)",
"+ ns[v].append(u)"
] | false | 0.032115 | 0.111977 | 0.286802 | [
"s830038314",
"s007019675"
] |
u836737505 | p03574 | python | s613726467 | s409010082 | 185 | 31 | 12,880 | 3,188 | Accepted | Accepted | 83.24 | import numpy as np
h,w = map(int, input().split())
a = [list(input()) for i in range(h)]
a = np.array(a)
for hi in range(h):
for wi in range(w):
c = 0
if a[hi][wi] == "#":
print('#',end='')
else:
print(np.count_nonzero(a[max(0,hi-1):hi+2,max(0,wi-1):wi+2] ==... | h,w = list(map(int, input().split()))
f = [list(eval(input())) for _ in range(h)]
for k in range(h):
for l in range(w):
if f[k][l] == ".":
c = 0
for i in range(-1,2):
for j in range(-1,2):
xi,yi = k+i,l+j
#xi,yiが範囲内で水溜り... | 12 | 16 | 347 | 495 | import numpy as np
h, w = map(int, input().split())
a = [list(input()) for i in range(h)]
a = np.array(a)
for hi in range(h):
for wi in range(w):
c = 0
if a[hi][wi] == "#":
print("#", end="")
else:
print(
np.count_nonzero(
a[max(0,... | h, w = list(map(int, input().split()))
f = [list(eval(input())) for _ in range(h)]
for k in range(h):
for l in range(w):
if f[k][l] == ".":
c = 0
for i in range(-1, 2):
for j in range(-1, 2):
xi, yi = k + i, l + j
# xi,yiが範囲内で水溜... | false | 25 | [
"-import numpy as np",
"-",
"-h, w = map(int, input().split())",
"-a = [list(input()) for i in range(h)]",
"-a = np.array(a)",
"-for hi in range(h):",
"- for wi in range(w):",
"- c = 0",
"- if a[hi][wi] == \"#\":",
"- print(\"#\", end=\"\")",
"- else:",
"- ... | false | 0.255936 | 0.036113 | 7.087156 | [
"s613726467",
"s409010082"
] |
u057109575 | p02597 | python | s326426101 | s449332817 | 127 | 69 | 77,688 | 63,072 | Accepted | Accepted | 45.67 |
N = int(eval(input()))
S = list(eval(input()))
cnt = S.count("R")
ans = S[cnt:].count("R")
print(ans)
|
N = int(eval(input()))
S = eval(input())
c = S.count("R")
res = S[c:].count("R")
print(res)
| 7 | 7 | 98 | 88 | N = int(eval(input()))
S = list(eval(input()))
cnt = S.count("R")
ans = S[cnt:].count("R")
print(ans)
| N = int(eval(input()))
S = eval(input())
c = S.count("R")
res = S[c:].count("R")
print(res)
| false | 0 | [
"-S = list(eval(input()))",
"-cnt = S.count(\"R\")",
"-ans = S[cnt:].count(\"R\")",
"-print(ans)",
"+S = eval(input())",
"+c = S.count(\"R\")",
"+res = S[c:].count(\"R\")",
"+print(res)"
] | false | 0.064731 | 0.069396 | 0.932767 | [
"s326426101",
"s449332817"
] |
u408260374 | p02373 | python | s259590242 | s738807195 | 1,910 | 1,520 | 110,136 | 38,688 | Accepted | Accepted | 20.42 | import sys
if sys.version[0] == '2':
range, input = xrange, raw_input
class Edge:
def __init__(self, dst, weight):
self.dst, self.weight = dst, weight
def __lt__(self, e):
return self.weight > e.weight
class Graph:
def __init__(self, V):
self.V = V
se... | import sys
if sys.version[0] == '2':
range, input = xrange, raw_input
class HeavyLightDecomposition:
def __init__(self, g, root=0):
self.g = g
self.vid, self.head, self.heavy, self.parent = [0] * len(g), [-1] * len(g), [-1] * len(g), [-1] * len(g)
self.dfs(root)
self.bf... | 81 | 63 | 2,357 | 1,995 | import sys
if sys.version[0] == "2":
range, input = xrange, raw_input
class Edge:
def __init__(self, dst, weight):
self.dst, self.weight = dst, weight
def __lt__(self, e):
return self.weight > e.weight
class Graph:
def __init__(self, V):
self.V = V
self.E = [[] for ... | import sys
if sys.version[0] == "2":
range, input = xrange, raw_input
class HeavyLightDecomposition:
def __init__(self, g, root=0):
self.g = g
self.vid, self.head, self.heavy, self.parent = (
[0] * len(g),
[-1] * len(g),
[-1] * len(g),
[-1] * le... | false | 22.222222 | [
"-class Edge:",
"- def __init__(self, dst, weight):",
"- self.dst, self.weight = dst, weight",
"-",
"- def __lt__(self, e):",
"- return self.weight > e.weight",
"-",
"-",
"-class Graph:",
"- def __init__(self, V):",
"- self.V = V",
"- self.E = [[] for _ in ... | false | 0.043248 | 0.094637 | 0.45699 | [
"s259590242",
"s738807195"
] |
u141429472 | p02818 | python | s203729466 | s429628640 | 236 | 62 | 51,564 | 6,080 | Accepted | Accepted | 73.73 | import sys
input = sys.stdin.readline
A,B,K=list(map(int,input().rstrip().split()))
def resolve():
if(A>K):
ansA=int(A)-int(K)
ansB=int(B)
else:
ansA=0
ansB=int(B)-(int(K)-int(A))
if(ansB<0):
ansB=0
print((str(int(ansA))+" "+str(int(ans... | import sys
input = sys.stdin.readline
A,B,K=list(map(int,input().rstrip().split()))
"""
def resolve():
if(A>K):
ansA=int(A)-int(K)
ansB=int(B)
else:
ansA=0
ansB=int(B)-(int(K)-int(A))
if(ansB<0):
ansB=0
print(str(int(ansA))+" "+str(int(ansB... | 41 | 54 | 1,118 | 1,334 | import sys
input = sys.stdin.readline
A, B, K = list(map(int, input().rstrip().split()))
def resolve():
if A > K:
ansA = int(A) - int(K)
ansB = int(B)
else:
ansA = 0
ansB = int(B) - (int(K) - int(A))
if ansB < 0:
ansB = 0
print((str(int(ansA)) + " " + s... | import sys
input = sys.stdin.readline
A, B, K = list(map(int, input().rstrip().split()))
"""
def resolve():
if(A>K):
ansA=int(A)-int(K)
ansB=int(B)
else:
ansA=0
ansB=int(B)-(int(K)-int(A))
if(ansB<0):
ansB=0
print(str(int(ansA))+" "+str(int(ansB)))
"""
... | false | 24.074074 | [
"+\"\"\"",
"+def resolve():",
"+ if(A>K):",
"+ ansA=int(A)-int(K)",
"+ ansB=int(B)",
"+ else:",
"+ ansA=0",
"+ ansB=int(B)-(int(K)-int(A))",
"+ if(ansB<0):",
"+ ansB=0",
"+ print(str(int(ansA))+\" \"+str(int(ansB)))",
"+\"\"\"",
"- pr... | false | 0.122105 | 0.28043 | 0.435421 | [
"s203729466",
"s429628640"
] |
u759412327 | p04031 | python | s132525578 | s859358608 | 33 | 26 | 9,108 | 9,064 | Accepted | Accepted | 21.21 | N = int(eval(input()))
A = list(map(int,input().split()))
print((min(sum((a-n)**2 for a in A) for n in range(min(A),1+max(A))))) | N = int(eval(input()))
A = list(map(int,input().split()))
m = round(sum(A)/N)
print((sum((a-m)**2 for a in A))) | 3 | 4 | 122 | 106 | N = int(eval(input()))
A = list(map(int, input().split()))
print((min(sum((a - n) ** 2 for a in A) for n in range(min(A), 1 + max(A)))))
| N = int(eval(input()))
A = list(map(int, input().split()))
m = round(sum(A) / N)
print((sum((a - m) ** 2 for a in A)))
| false | 25 | [
"-print((min(sum((a - n) ** 2 for a in A) for n in range(min(A), 1 + max(A)))))",
"+m = round(sum(A) / N)",
"+print((sum((a - m) ** 2 for a in A)))"
] | false | 0.149908 | 0.041777 | 3.588245 | [
"s132525578",
"s859358608"
] |
u183754334 | p03854 | python | s640485314 | s360884684 | 105 | 18 | 3,480 | 3,188 | Accepted | Accepted | 82.86 | # coding: utf-8
"""this is python work script"""
CHECK_WORDS = ['dream', 'dreamer', 'erase', 'eraser']
def check_word(word, check_word_list):
find_word = False
# print(word, check_word_list)
for i, cw in enumerate(check_word_list):
find_result = word.find(cw)
# print(i, cw, fin... | # coding: utf-8
"""this is python work script"""
def solver(word):
"""solve this problem"""
check_result = word.replace('eraser', '').replace('erase', '').replace('dreamer', '').replace('dream', '')
answer = 'YES'
if check_result:
answer = 'NO'
return answer
def main():
... | 53 | 21 | 1,350 | 470 | # coding: utf-8
"""this is python work script"""
CHECK_WORDS = ["dream", "dreamer", "erase", "eraser"]
def check_word(word, check_word_list):
find_word = False
# print(word, check_word_list)
for i, cw in enumerate(check_word_list):
find_result = word.find(cw)
# print(i, cw, find_result)
... | # coding: utf-8
"""this is python work script"""
def solver(word):
"""solve this problem"""
check_result = (
word.replace("eraser", "")
.replace("erase", "")
.replace("dreamer", "")
.replace("dream", "")
)
answer = "YES"
if check_result:
answer = "NO"
re... | false | 60.377358 | [
"-CHECK_WORDS = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]",
"-def check_word(word, check_word_list):",
"- find_word = False",
"- # print(word, check_word_list)",
"- for i, cw in enumerate(check_word_list):",
"- find_result = word.find(cw)",
"- # print(i, cw, find_result)",
... | false | 0.038168 | 0.037606 | 1.01494 | [
"s640485314",
"s360884684"
] |
u922965680 | p02900 | python | s143480135 | s956033128 | 216 | 191 | 38,612 | 38,512 | Accepted | Accepted | 11.57 | import sys
import math
def main():
a, b = [int(s) for s in sys.stdin.readline().strip().split()]
def factorize(x):
ret = set()
for n in range(2, int(math.sqrt(x))+2):
if x % n == 0:
while x % n == 0:
x //= n
ret.add(n)... | import sys
import math
def main():
a, b = [int(s) for s in sys.stdin.readline().strip().split()]
def factorize(x):
ret = set()
for n in range(2, int(math.sqrt(x))+1):
if x % n == 0:
while x % n == 0:
x //= n
ret.add(... | 24 | 25 | 531 | 533 | import sys
import math
def main():
a, b = [int(s) for s in sys.stdin.readline().strip().split()]
def factorize(x):
ret = set()
for n in range(2, int(math.sqrt(x)) + 2):
if x % n == 0:
while x % n == 0:
x //= n
ret.add(n)
... | import sys
import math
def main():
a, b = [int(s) for s in sys.stdin.readline().strip().split()]
def factorize(x):
ret = set()
for n in range(2, int(math.sqrt(x)) + 1):
if x % n == 0:
while x % n == 0:
x //= n
ret.add(n)
... | false | 4 | [
"- for n in range(2, int(math.sqrt(x)) + 2):",
"+ for n in range(2, int(math.sqrt(x)) + 1):"
] | false | 0.065228 | 0.067117 | 0.97185 | [
"s143480135",
"s956033128"
] |
u072717685 | p02720 | python | s067777404 | s560060939 | 294 | 266 | 13,868 | 38,380 | Accepted | Accepted | 9.52 | import sys
sys.setrecursionlimit(10**6)
from copy import deepcopy
def main():
k = int(eval(input()))
l = []
ll = [1,2,3,4,5,6,7,8,9]
def dfs(num, keta):
#print(num,len(num),keta)
if len(num) == keta:
ll.append(int(num))
#print(len(l))
e... | import sys
sys.setrecursionlimit(10**6)
read = sys.stdin.read
readlines = sys.stdin.readlines
from math import ceil, log
def main():
k = int(eval(input()))
k2 = int(log(ceil(k / 10), 3)) + 1
def getlun(n, keta, last):
lunluns.append(n)
if keta > k2:
pass
else:... | 43 | 29 | 1,043 | 776 | import sys
sys.setrecursionlimit(10**6)
from copy import deepcopy
def main():
k = int(eval(input()))
l = []
ll = [1, 2, 3, 4, 5, 6, 7, 8, 9]
def dfs(num, keta):
# print(num,len(num),keta)
if len(num) == keta:
ll.append(int(num))
# print(len(l))
else:
... | import sys
sys.setrecursionlimit(10**6)
read = sys.stdin.read
readlines = sys.stdin.readlines
from math import ceil, log
def main():
k = int(eval(input()))
k2 = int(log(ceil(k / 10), 3)) + 1
def getlun(n, keta, last):
lunluns.append(n)
if keta > k2:
pass
else:
... | false | 32.55814 | [
"-from copy import deepcopy",
"+read = sys.stdin.read",
"+readlines = sys.stdin.readlines",
"+from math import ceil, log",
"- l = []",
"- ll = [1, 2, 3, 4, 5, 6, 7, 8, 9]",
"+ k2 = int(log(ceil(k / 10), 3)) + 1",
"- def dfs(num, keta):",
"- # print(num,len(num),keta)",
"- ... | false | 0.070691 | 0.083078 | 0.850902 | [
"s067777404",
"s560060939"
] |
u957198490 | p03371 | python | s675883106 | s177851215 | 180 | 29 | 38,384 | 9,160 | Accepted | Accepted | 83.89 | A, B, C, X, Y = list(map(int, input().split()))
ans = 0
if A + B <= 2*C:
ans = A*X + B*Y
else:
ans += 2*C*min(X, Y)
if X >= Y:
ans += min(A, 2*C) * (X-Y)
else:
ans += min(B, 2*C) * (Y-X)
print (ans)
| A,B,C,x,y = list(map(int,input().split()))
ans = 0
if A+B > 2*C:
ans += min(x,y)*C*2
else:
ans += x*A + y*B
print(ans)
exit()
if x >= y:
x -= y
y = 0
if A <2*C:
ans += x*A
else:
ans += x*2*C
else:
y -= x
x = 0
if B < 2*C:
a... | 12 | 24 | 237 | 369 | A, B, C, X, Y = list(map(int, input().split()))
ans = 0
if A + B <= 2 * C:
ans = A * X + B * Y
else:
ans += 2 * C * min(X, Y)
if X >= Y:
ans += min(A, 2 * C) * (X - Y)
else:
ans += min(B, 2 * C) * (Y - X)
print(ans)
| A, B, C, x, y = list(map(int, input().split()))
ans = 0
if A + B > 2 * C:
ans += min(x, y) * C * 2
else:
ans += x * A + y * B
print(ans)
exit()
if x >= y:
x -= y
y = 0
if A < 2 * C:
ans += x * A
else:
ans += x * 2 * C
else:
y -= x
x = 0
if B < 2 * C:
a... | false | 50 | [
"-A, B, C, X, Y = list(map(int, input().split()))",
"+A, B, C, x, y = list(map(int, input().split()))",
"-if A + B <= 2 * C:",
"- ans = A * X + B * Y",
"+if A + B > 2 * C:",
"+ ans += min(x, y) * C * 2",
"- ans += 2 * C * min(X, Y)",
"- if X >= Y:",
"- ans += min(A, 2 * C) * (X - ... | false | 0.05426 | 0.035434 | 1.531277 | [
"s675883106",
"s177851215"
] |
u454093752 | p02551 | python | s092554924 | s003137194 | 1,946 | 1,250 | 127,408 | 101,636 | Accepted | Accepted | 35.77 | class LazySegmentTree:
"""
init(init_val, ide_ele): 配列init_valで初期化 O(N)
update(l, r, x): 区間[l, r)をxに更新 O(logN)
query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN)
"""
def __init__(self, init_val, segfunc, ide_ele):
"""
init_val: 配列の初期値
segfunc: 区間にしたい操作
ide_ele... | class LazySegmentTree:
def __init__(self, init_val, segfunc, ide_ele):
n = len(init_val)
self.segfunc = segfunc
self.ide_ele = ide_ele
self.num = 1 << (n - 1).bit_length()
self.data = [ide_ele] * 2 * self.num
self.lazy = [None] * 2 * self.num
for i... | 139 | 106 | 3,725 | 2,866 | class LazySegmentTree:
"""
init(init_val, ide_ele): 配列init_valで初期化 O(N)
update(l, r, x): 区間[l, r)をxに更新 O(logN)
query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN)
"""
def __init__(self, init_val, segfunc, ide_ele):
"""
init_val: 配列の初期値
segfunc: 区間にしたい操作
ide_ele: 単位元
... | class LazySegmentTree:
def __init__(self, init_val, segfunc, ide_ele):
n = len(init_val)
self.segfunc = segfunc
self.ide_ele = ide_ele
self.num = 1 << (n - 1).bit_length()
self.data = [ide_ele] * 2 * self.num
self.lazy = [None] * 2 * self.num
for i in range(n)... | false | 23.741007 | [
"- \"\"\"",
"- init(init_val, ide_ele): 配列init_valで初期化 O(N)",
"- update(l, r, x): 区間[l, r)をxに更新 O(logN)",
"- query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN)",
"- \"\"\"",
"-",
"- \"\"\"",
"- init_val: 配列の初期値",
"- segfunc: 区間にしたい操作",
"- ide_ele: 単位元",
"- ... | false | 0.740363 | 0.39967 | 1.852434 | [
"s092554924",
"s003137194"
] |
u185249212 | p03031 | python | s945280374 | s366120875 | 402 | 32 | 59,868 | 3,188 | Accepted | Accepted | 92.04 |
# import numpy as np
# import numpypy as np
import sys
input = sys.stdin.readline
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
# import math
# import string
# import fractions
# from fractions import Fraction
# from fractions import gcd
# def lcm(n,m):
# return int(n*m/... |
# import numpy as np
# import numpypy as np
import sys
input = sys.stdin.readline
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def main():
n,m = list(map(int, input().split())) # n represents switch, m represents lights
lights=[]
for i in range(m):
ll=list... | 97 | 38 | 2,185 | 986 | # import numpy as np
# import numpypy as np
import sys
input = sys.stdin.readline
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
# import math
# import string
# import fractions
# from fractions import Fraction
# from fractions import gcd
# def lcm(n,m):
# return int(n*m/gcd(n,m))
# i... | # import numpy as np
# import numpypy as np
import sys
input = sys.stdin.readline
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def main():
n, m = list(map(int, input().split())) # n represents switch, m represents lights
lights = []
for i in range(m):
ll = list(map(... | false | 60.824742 | [
"-# import math",
"-# import string",
"-# import fractions",
"-# from fractions import Fraction",
"-# from fractions import gcd",
"-# def lcm(n,m):",
"-# return int(n*m/gcd(n,m))",
"-# import re",
"-# import array",
"-# import copy",
"-# import functools",
"-# import operator",
"-# impor... | false | 0.038727 | 0.040464 | 0.957092 | [
"s945280374",
"s366120875"
] |
u896741788 | p03475 | python | s829354703 | s071664529 | 75 | 66 | 3,188 | 3,188 | Accepted | Accepted | 12 | def f():
n=int(eval(input()))
l=tuple(tuple(map(int,input().split())) for i in range(n-1))
for i in range(n):
now=0
for a,s,d in l[i:]:
now=a+s-(-max(0,now-s)//d)*d
print(now)
if __name__=="__main__":
f() | import sys
input = sys.stdin.readline
def f():
n=int(eval(input()))
l=tuple(tuple(map(int,input().split())) for i in range(n-1))
for i in range(n):
now=0
for a,s,d in l[i:]:
now=a+s-(-max(0,now-s)//d)*d
print(now)
if __name__=="__main__":
f()
| 10 | 12 | 233 | 274 | def f():
n = int(eval(input()))
l = tuple(tuple(map(int, input().split())) for i in range(n - 1))
for i in range(n):
now = 0
for a, s, d in l[i:]:
now = a + s - (-max(0, now - s) // d) * d
print(now)
if __name__ == "__main__":
f()
| import sys
input = sys.stdin.readline
def f():
n = int(eval(input()))
l = tuple(tuple(map(int, input().split())) for i in range(n - 1))
for i in range(n):
now = 0
for a, s, d in l[i:]:
now = a + s - (-max(0, now - s) // d) * d
print(now)
if __name__ == "__main__":
... | false | 16.666667 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+"
] | false | 0.042786 | 0.035436 | 1.20741 | [
"s829354703",
"s071664529"
] |
u608007704 | p02537 | python | s289747745 | s010343308 | 1,663 | 1,399 | 102,952 | 102,152 | Accepted | Accepted | 15.87 | def op(a,b):
return max(a,b)
class segmentTree:
def __init__(self,n,op,init_value):
dataLen=1 << (n - 1).bit_length()
self.data=[init_value]*(2*dataLen)
self.op=op
self.length=dataLen
def getIdx(self,left,right):
idxs=[]
l=left
r=right
... | def op(a,b):
return max(a,b)
class segmentTree:
def __init__(self,n,op,init_value):
dataLen=1 << (n - 1).bit_length()
self.data=[init_value]*(2*dataLen)
self.op=op
self.length=dataLen
def getIdx(self,left,right):
idxs=[]
l=left
r=right
... | 66 | 63 | 1,696 | 1,601 | def op(a, b):
return max(a, b)
class segmentTree:
def __init__(self, n, op, init_value):
dataLen = 1 << (n - 1).bit_length()
self.data = [init_value] * (2 * dataLen)
self.op = op
self.length = dataLen
def getIdx(self, left, right):
idxs = []
l = left
... | def op(a, b):
return max(a, b)
class segmentTree:
def __init__(self, n, op, init_value):
dataLen = 1 << (n - 1).bit_length()
self.data = [init_value] * (2 * dataLen)
self.op = op
self.length = dataLen
def getIdx(self, left, right):
idxs = []
l = left
... | false | 4.545455 | [
"- return self.data[self.getIdx(n, n + 1)[0]]",
"+ return self.data[n + self.length]",
"- if n < 0 or n >= self.length:",
"- return False",
"- idx1 = self.getIdx(n, n + 1)[0]",
"+ idx1 = n + self.length",
"- return True"
] | false | 0.075439 | 0.075531 | 0.99878 | [
"s289747745",
"s010343308"
] |
u816631826 | p03272 | python | s053699673 | s733357264 | 183 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.71 | N,i= list(map(int,input().split()))
print((N-i+1)) | n, i = list(map(int, input().split()))
print((n + 1 - i))
| 3 | 2 | 131 | 51 | N, i = list(map(int, input().split()))
print((N - i + 1))
| n, i = list(map(int, input().split()))
print((n + 1 - i))
| false | 33.333333 | [
"-N, i = list(map(int, input().split()))",
"-print((N - i + 1))",
"+n, i = list(map(int, input().split()))",
"+print((n + 1 - i))"
] | false | 0.04803 | 0.053366 | 0.900011 | [
"s053699673",
"s733357264"
] |
u163320134 | p02743 | python | s900291474 | s692952826 | 34 | 18 | 5,076 | 2,940 | Accepted | Accepted | 47.06 | from decimal import *
a,b,c=list(map(int,input().split()))
a,b,c=Decimal(a),Decimal(b),Decimal(c)
if c**Decimal(0.5)>a**Decimal(0.5)+b**Decimal(0.5):
print('Yes')
else:
print('No') | a,b,c=list(map(int,input().split()))
if 4*a*b<(c-a-b)**2 and a+b<c:
print('Yes')
else:
print('No') | 8 | 5 | 186 | 100 | from decimal import *
a, b, c = list(map(int, input().split()))
a, b, c = Decimal(a), Decimal(b), Decimal(c)
if c ** Decimal(0.5) > a ** Decimal(0.5) + b ** Decimal(0.5):
print("Yes")
else:
print("No")
| a, b, c = list(map(int, input().split()))
if 4 * a * b < (c - a - b) ** 2 and a + b < c:
print("Yes")
else:
print("No")
| false | 37.5 | [
"-from decimal import *",
"-",
"-a, b, c = Decimal(a), Decimal(b), Decimal(c)",
"-if c ** Decimal(0.5) > a ** Decimal(0.5) + b ** Decimal(0.5):",
"+if 4 * a * b < (c - a - b) ** 2 and a + b < c:"
] | false | 0.065149 | 0.035449 | 1.837806 | [
"s900291474",
"s692952826"
] |
u199588618 | p02693 | python | s086003145 | s684809993 | 68 | 55 | 61,592 | 61,820 | Accepted | Accepted | 19.12 | k = int(eval(input()))
a, b = list(map(int, input().split()))
for i in range(a, b+1):
if i%k == 0:
print('OK')
exit()
print('NG') | K=int(eval(input()))
A,B=list(map(int,input().split()))
t=A%K
if t>=1 and B>=A+(K-t):
print("OK")
elif t==0 and A<=B:
print("OK")
else:
print("NG") | 9 | 9 | 147 | 155 | k = int(eval(input()))
a, b = list(map(int, input().split()))
for i in range(a, b + 1):
if i % k == 0:
print("OK")
exit()
print("NG")
| K = int(eval(input()))
A, B = list(map(int, input().split()))
t = A % K
if t >= 1 and B >= A + (K - t):
print("OK")
elif t == 0 and A <= B:
print("OK")
else:
print("NG")
| false | 0 | [
"-k = int(eval(input()))",
"-a, b = list(map(int, input().split()))",
"-for i in range(a, b + 1):",
"- if i % k == 0:",
"- print(\"OK\")",
"- exit()",
"-print(\"NG\")",
"+K = int(eval(input()))",
"+A, B = list(map(int, input().split()))",
"+t = A % K",
"+if t >= 1 and B >= A + (... | false | 0.094811 | 0.041307 | 2.295299 | [
"s086003145",
"s684809993"
] |
u075595666 | p02973 | python | s797057385 | s463400768 | 529 | 418 | 27,108 | 8,092 | Accepted | Accepted | 20.98 | import sys
input = sys.stdin.readline
n = int(eval(input()))
if n == 1:
print((1))
exit()
chk = []
for i in range(n):
a = int(eval(input()))
chk.append((i,a))
from bisect import bisect_left,insort_left
from collections import deque
ans = 1
c = deque([])
for j in chk:
i,a = j
if i =... | import sys
input = sys.stdin.readline
n = int(eval(input()))
if n == 1:
print((1))
exit()
chk = []
for i in range(n):
a = int(eval(input()))
chk.append(a)
from bisect import bisect_left,insort_left
from collections import deque
ans = 0
c = deque([])
for j in chk:
if i == 0:
c.app... | 30 | 29 | 496 | 459 | import sys
input = sys.stdin.readline
n = int(eval(input()))
if n == 1:
print((1))
exit()
chk = []
for i in range(n):
a = int(eval(input()))
chk.append((i, a))
from bisect import bisect_left, insort_left
from collections import deque
ans = 1
c = deque([])
for j in chk:
i, a = j
if i == 0:
... | import sys
input = sys.stdin.readline
n = int(eval(input()))
if n == 1:
print((1))
exit()
chk = []
for i in range(n):
a = int(eval(input()))
chk.append(a)
from bisect import bisect_left, insort_left
from collections import deque
ans = 0
c = deque([])
for j in chk:
if i == 0:
c.append(j)
... | false | 3.333333 | [
"- chk.append((i, a))",
"+ chk.append(a)",
"-ans = 1",
"+ans = 0",
"- i, a = j",
"- c.append((a, n - i))",
"+ c.append(j)",
"- ind = bisect_left(c, (a, n - i))",
"+ ind = bisect_left(c, j)",
"- c.appendleft((a, n - i))",
"+ c.appendleft(... | false | 0.042848 | 0.037743 | 1.135262 | [
"s797057385",
"s463400768"
] |
u891635666 | p03354 | python | s019908626 | s450583417 | 788 | 704 | 76,352 | 36,072 | Accepted | Accepted | 10.66 | n, m = list(map(int, input().split()))
ps = list(map(int, input().split()))
ls = [list(map(int, input().split())) for _ in range(m)]
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = list(range(n + 1))
self.ranks = [0 for _ in range(n + 1)]
def get_root(self... | n, m = list(map(int, input().split()))
ps = list(map(int, input().split()))
ls = [list(map(int, input().split())) for _ in range(m)]
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = list(range(n + 1))
self.ranks = [0 for _ in range(n + 1)]
def get_root(self... | 46 | 39 | 1,180 | 1,009 | n, m = list(map(int, input().split()))
ps = list(map(int, input().split()))
ls = [list(map(int, input().split())) for _ in range(m)]
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = list(range(n + 1))
self.ranks = [0 for _ in range(n + 1)]
def get_root(self, x):
... | n, m = list(map(int, input().split()))
ps = list(map(int, input().split()))
ls = [list(map(int, input().split())) for _ in range(m)]
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = list(range(n + 1))
self.ranks = [0 for _ in range(n + 1)]
def get_root(self, x):
... | false | 15.217391 | [
"+res = 0",
"- uf.get_root(i)",
"-cs = uf.parents",
"-s0 = {c: [] for c in set(cs[1:])}",
"-s1 = {c: [] for c in set(cs[1:])}",
"-for i in range(1, n + 1):",
"- c = cs[i]",
"- s0[c].append(ps[i - 1])",
"- s1[c].append(i)",
"-res = 0",
"-for c in set(cs[1:]):",
"- res += len(set(... | false | 0.043128 | 0.037938 | 1.136817 | [
"s019908626",
"s450583417"
] |
u589276934 | p00100 | python | s100440095 | s693858034 | 90 | 80 | 7,968 | 7,840 | Accepted | Accepted | 11.11 | # coding: utf-8
# Here your code !
employeeSalesList = []
def resetDataset():
del employeeSalesList[0 : len(employeeSalesList) + 1]
def readDataCount():
return int(eval(input()))
def searchEmployeeSales(employeeId):
for data in employeeSalesList:
if data[0] == employeeId:
... | # coding: utf-8
# Here your code !
employeeSalesList = []
def resetDataset():
del employeeSalesList[0 : len(employeeSalesList) + 1]
def readDataCount():
return int(eval(input()))
def searchEmployeeSales(employeeId):
for data in employeeSalesList:
if data[0] == employeeId:
... | 42 | 36 | 1,076 | 1,002 | # coding: utf-8
# Here your code !
employeeSalesList = []
def resetDataset():
del employeeSalesList[0 : len(employeeSalesList) + 1]
def readDataCount():
return int(eval(input()))
def searchEmployeeSales(employeeId):
for data in employeeSalesList:
if data[0] == employeeId:
return da... | # coding: utf-8
# Here your code !
employeeSalesList = []
def resetDataset():
del employeeSalesList[0 : len(employeeSalesList) + 1]
def readDataCount():
return int(eval(input()))
def searchEmployeeSales(employeeId):
for data in employeeSalesList:
if data[0] == employeeId:
return da... | false | 14.285714 | [
"-answerList = []",
"-",
"-",
"- found = False",
"- for data in employeeSalesList:",
"- if data[1] >= 1000000:",
"- answerList.append(data[0])",
"- found = True",
"- if not found:",
"- answerList.append(\"NA\")",
"+ answerList = [data[0] for data i... | false | 0.038789 | 0.068396 | 0.567122 | [
"s100440095",
"s693858034"
] |
u260980560 | p01105 | python | s021974341 | s956724924 | 780 | 700 | 7,956 | 7,736 | Accepted | Accepted | 10.26 | def calc(s):
s = s.replace("-", "-~-")
res = 0
for bit in range(16):
a, b, c, d = list(map(int, format(bit, '04b')))
if eval(s):
res += 1 << bit
return res
base = "abcd10"
L = {}
for e in base:
state = calc(e)
L[state] = 1
ALL = 2**16-1
MAX = 10**18
for... | a=65280; b=61680; c=52428; d=43690; e=65535
def calc(s):
res = eval(s.replace("-", "~").replace("*", "&").replace("1", "e"))
return e ^ ~res if res < 0 else res
base = [a, b, c, d, e, 0]
L = {el: 1 for el in base}
for i in range(6):
R = dict(L)
for p in R:
if R[p] < 16:
L[p... | 30 | 21 | 767 | 677 | def calc(s):
s = s.replace("-", "-~-")
res = 0
for bit in range(16):
a, b, c, d = list(map(int, format(bit, "04b")))
if eval(s):
res += 1 << bit
return res
base = "abcd10"
L = {}
for e in base:
state = calc(e)
L[state] = 1
ALL = 2**16 - 1
MAX = 10**18
for i in range... | a = 65280
b = 61680
c = 52428
d = 43690
e = 65535
def calc(s):
res = eval(s.replace("-", "~").replace("*", "&").replace("1", "e"))
return e ^ ~res if res < 0 else res
base = [a, b, c, d, e, 0]
L = {el: 1 for el in base}
for i in range(6):
R = dict(L)
for p in R:
if R[p] < 16:
L[p... | false | 30 | [
"-def calc(s):",
"- s = s.replace(\"-\", \"-~-\")",
"- res = 0",
"- for bit in range(16):",
"- a, b, c, d = list(map(int, format(bit, \"04b\")))",
"- if eval(s):",
"- res += 1 << bit",
"- return res",
"+a = 65280",
"+b = 61680",
"+c = 52428",
"+d = 43690",
... | false | 1.493906 | 1.397945 | 1.068644 | [
"s021974341",
"s956724924"
] |
u790710233 | p04034 | python | s669293519 | s835619834 | 460 | 390 | 15,204 | 5,364 | Accepted | Accepted | 15.22 | n, m = list(map(int, input().split()))
A = [[1, 1]] + [[0, 1] for _ in range(n-1)]
for _ in range(m):
x, y = [int(x) - 1 for x in input().split()]
A[x][1] -= 1
A[y][1] += 1
if A[x][0]:
A[y][0] = 1
if A[x][1] == 0:
A[x][0] = 0
print((sum(a[0] for a in A))) | n, m = list(map(int, input().split()))
num = [1]*n
red = [1] + [0]*(n-1)
for _ in range(m):
x, y = [int(x)-1 for x in input().split()]
num[x] -= 1
num[y] += 1
if red[x]:
red[y] = 1
if num[x] == 0:
red[x] = 0
print((sum(red))) | 16 | 16 | 308 | 277 | n, m = list(map(int, input().split()))
A = [[1, 1]] + [[0, 1] for _ in range(n - 1)]
for _ in range(m):
x, y = [int(x) - 1 for x in input().split()]
A[x][1] -= 1
A[y][1] += 1
if A[x][0]:
A[y][0] = 1
if A[x][1] == 0:
A[x][0] = 0
print((sum(a[0] for a in A)))
| n, m = list(map(int, input().split()))
num = [1] * n
red = [1] + [0] * (n - 1)
for _ in range(m):
x, y = [int(x) - 1 for x in input().split()]
num[x] -= 1
num[y] += 1
if red[x]:
red[y] = 1
if num[x] == 0:
red[x] = 0
print((sum(red)))
| false | 0 | [
"-A = [[1, 1]] + [[0, 1] for _ in range(n - 1)]",
"+num = [1] * n",
"+red = [1] + [0] * (n - 1)",
"- A[x][1] -= 1",
"- A[y][1] += 1",
"- if A[x][0]:",
"- A[y][0] = 1",
"- if A[x][1] == 0:",
"- A[x][0] = 0",
"-print((sum(a[0] for a in A)))",
"+ num[x] -= 1",
"+ n... | false | 0.042846 | 0.039861 | 1.074883 | [
"s669293519",
"s835619834"
] |
u368796742 | p02549 | python | s746796275 | s017734103 | 157 | 141 | 80,632 | 82,716 | Accepted | Accepted | 10.19 | mod = 998244353
n,k = list(map(int,input().split()))
K = [list(map(int,input().split())) for i in range(k)]
dp = [0]*(n+5)
dp[1] = 1
dp2 = [0]*(n+5)
for i in range(1,n+1):
dp[i] = (dp[i]+dp2[i]+dp2[i-1])%mod
dp2[i] = (dp2[i]+dp2[i-1])%mod
for l,r in K:
dp2[min(i+l,n+2)] += dp[i]
... | mod = 998244353
n,k = list(map(int,input().split()))
K = [list(map(int,input().split())) for i in range(k)]
dp = [0]*(n+1)
dp[0] = 1
dp2 = [0]*(n+1)
for i in range(n):
dp2[i] = (dp2[i]+dp2[i-1])%mod
dp[i] = (dp[i]+dp2[i])%mod
for l,r in K:
dp2[min(i+l,n)] = (dp2[min(i+l,n)]+dp[i])%mod
... | 16 | 14 | 432 | 391 | mod = 998244353
n, k = list(map(int, input().split()))
K = [list(map(int, input().split())) for i in range(k)]
dp = [0] * (n + 5)
dp[1] = 1
dp2 = [0] * (n + 5)
for i in range(1, n + 1):
dp[i] = (dp[i] + dp2[i] + dp2[i - 1]) % mod
dp2[i] = (dp2[i] + dp2[i - 1]) % mod
for l, r in K:
dp2[min(i + l, n +... | mod = 998244353
n, k = list(map(int, input().split()))
K = [list(map(int, input().split())) for i in range(k)]
dp = [0] * (n + 1)
dp[0] = 1
dp2 = [0] * (n + 1)
for i in range(n):
dp2[i] = (dp2[i] + dp2[i - 1]) % mod
dp[i] = (dp[i] + dp2[i]) % mod
for l, r in K:
dp2[min(i + l, n)] = (dp2[min(i + l, n... | false | 12.5 | [
"-dp = [0] * (n + 5)",
"-dp[1] = 1",
"-dp2 = [0] * (n + 5)",
"-for i in range(1, n + 1):",
"- dp[i] = (dp[i] + dp2[i] + dp2[i - 1]) % mod",
"+dp = [0] * (n + 1)",
"+dp[0] = 1",
"+dp2 = [0] * (n + 1)",
"+for i in range(n):",
"+ dp[i] = (dp[i] + dp2[i]) % mod",
"- dp2[min(i + l, n + 2... | false | 0.036942 | 0.044463 | 0.830852 | [
"s746796275",
"s017734103"
] |
u831725332 | p00003 | python | s752121389 | s810221166 | 50 | 40 | 5,600 | 5,596 | Accepted | Accepted | 20 | N = int(eval(input()))
for i in range(N):
sides = sorted(list(map(int, input().split())))
if sides[0]**2 + sides[1]**2 == sides[2]**2:
print('YES')
else:
print('NO')
| N = int(eval(input()))
for i in range(N):
adjacent_side_1, adjacent_side_2, hypotenuse = sorted(list(map(int, input().split())))
if adjacent_side_1**2 + adjacent_side_2**2 == hypotenuse**2:
print('YES')
else:
print('NO')
| 9 | 9 | 198 | 253 | N = int(eval(input()))
for i in range(N):
sides = sorted(list(map(int, input().split())))
if sides[0] ** 2 + sides[1] ** 2 == sides[2] ** 2:
print("YES")
else:
print("NO")
| N = int(eval(input()))
for i in range(N):
adjacent_side_1, adjacent_side_2, hypotenuse = sorted(
list(map(int, input().split()))
)
if adjacent_side_1**2 + adjacent_side_2**2 == hypotenuse**2:
print("YES")
else:
print("NO")
| false | 0 | [
"- sides = sorted(list(map(int, input().split())))",
"- if sides[0] ** 2 + sides[1] ** 2 == sides[2] ** 2:",
"+ adjacent_side_1, adjacent_side_2, hypotenuse = sorted(",
"+ list(map(int, input().split()))",
"+ )",
"+ if adjacent_side_1**2 + adjacent_side_2**2 == hypotenuse**2:"
] | false | 0.044551 | 0.039292 | 1.133836 | [
"s752121389",
"s810221166"
] |
u606878291 | p02900 | python | s234616096 | s930198760 | 805 | 166 | 119,776 | 9,608 | Accepted | Accepted | 79.38 | from functools import lru_cache
@lru_cache(maxsize=None)
def get_dividers(n):
"""
正の整数 n の約数を取得する
"""
dividers = {i for i in range(1, int(n ** 0.5) + 1) if n % i == 0}
return dividers | {n // d for d in dividers}
A, B = list(map(int, input().split(' ')))
a_dividers = get_divider... | from functools import lru_cache
@lru_cache(maxsize=None)
def prime_factorization(n):
"""
nを素因数分解して素因数のリストを返却する
"""
primes = []
while n % 2 == 0:
primes.append(2)
n //= 2
i = 3
while i ** 2 <= n:
while n % i == 0:
primes.append(i)
... | 29 | 29 | 603 | 571 | from functools import lru_cache
@lru_cache(maxsize=None)
def get_dividers(n):
"""
正の整数 n の約数を取得する
"""
dividers = {i for i in range(1, int(n**0.5) + 1) if n % i == 0}
return dividers | {n // d for d in dividers}
A, B = list(map(int, input().split(" ")))
a_dividers = get_dividers(A)
b_dividers = g... | from functools import lru_cache
@lru_cache(maxsize=None)
def prime_factorization(n):
"""
nを素因数分解して素因数のリストを返却する
"""
primes = []
while n % 2 == 0:
primes.append(2)
n //= 2
i = 3
while i**2 <= n:
while n % i == 0:
primes.append(i)
n //= i
... | false | 0 | [
"-def get_dividers(n):",
"+def prime_factorization(n):",
"- 正の整数 n の約数を取得する",
"+ nを素因数分解して素因数のリストを返却する",
"- dividers = {i for i in range(1, int(n**0.5) + 1) if n % i == 0}",
"- return dividers | {n // d for d in dividers}",
"+ primes = []",
"+ while n % 2 == 0:",
"+ primes.a... | false | 0.080257 | 0.037723 | 2.127536 | [
"s234616096",
"s930198760"
] |
u753803401 | p03303 | python | s670790415 | s845775678 | 194 | 177 | 38,384 | 38,256 | Accepted | Accepted | 8.76 | def slove():
import sys
input = sys.stdin.readline
s = list(str(input().rstrip('\n')))
w = int(input().rstrip('\n'))
print(("".join(s[::w])))
if __name__ == '__main__':
slove()
| import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
s = str(readline().rstrip().decode('utf-8'))
w = int(readline())
ans = []
for i in range(0, len(s), w):
ans.append(s[i])
print(("".join(ans)))
if __name__ == '__main__':
solve()
| 10 | 16 | 210 | 314 | def slove():
import sys
input = sys.stdin.readline
s = list(str(input().rstrip("\n")))
w = int(input().rstrip("\n"))
print(("".join(s[::w])))
if __name__ == "__main__":
slove()
| import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10**9 + 7
s = str(readline().rstrip().decode("utf-8"))
w = int(readline())
ans = []
for i in range(0, len(s), w):
ans.append(s[i])
print(("".join(ans)))
if __name__ == "__main__":
solve()
| false | 37.5 | [
"-def slove():",
"- import sys",
"+import sys",
"- input = sys.stdin.readline",
"- s = list(str(input().rstrip(\"\\n\")))",
"- w = int(input().rstrip(\"\\n\"))",
"- print((\"\".join(s[::w])))",
"+",
"+def solve():",
"+ readline = sys.stdin.buffer.readline",
"+ mod = 10**9 + ... | false | 0.035751 | 0.034587 | 1.033641 | [
"s670790415",
"s845775678"
] |
u489959379 | p03408 | python | s894337300 | s024574960 | 24 | 21 | 3,564 | 3,316 | Accepted | Accepted | 12.5 | from collections import Counter
n = int(eval(input()))
s = list(eval(input()) for _ in range(n))
m = int(eval(input()))
t = list(eval(input()) for _ in range(m))
res = Counter(s)
for i in range(m):
if t[i] in res:
res[t[i]] -= 1
ans = 0
for v in list(res.values()):
ans = max(ans, v)
... | import sys
from collections import Counter
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(eval(input()))
S = [eval(input()) for _ in range(n)]
m = int(eval(input()))
T = [eval(input()) for _ in range(m)]
D_S = Counter(S)
D_T = Counte... | 17 | 25 | 300 | 471 | from collections import Counter
n = int(eval(input()))
s = list(eval(input()) for _ in range(n))
m = int(eval(input()))
t = list(eval(input()) for _ in range(m))
res = Counter(s)
for i in range(m):
if t[i] in res:
res[t[i]] -= 1
ans = 0
for v in list(res.values()):
ans = max(ans, v)
print(ans)
| import sys
from collections import Counter
sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n = int(eval(input()))
S = [eval(input()) for _ in range(n)]
m = int(eval(input()))
T = [eval(input()) for _ in range(m)]
D_S = Counter(S)
D_T = Counter(T)
res = 0
... | false | 32 | [
"+import sys",
"-n = int(eval(input()))",
"-s = list(eval(input()) for _ in range(n))",
"-m = int(eval(input()))",
"-t = list(eval(input()) for _ in range(m))",
"-res = Counter(s)",
"-for i in range(m):",
"- if t[i] in res:",
"- res[t[i]] -= 1",
"-ans = 0",
"-for v in list(res.values()... | false | 0.042537 | 0.084981 | 0.500544 | [
"s894337300",
"s024574960"
] |
u759412327 | p03339 | python | s932573434 | s320767350 | 147 | 111 | 9,632 | 9,632 | Accepted | Accepted | 24.49 | N = int(eval(input()))
S = eval(input())
l = 0
r = S[1:N].count('E')
ans = l+r
for n in range(1,N):
if S[n-1]=="W":
l+=1
if S[n]=="E":
r-=1
ans=min(ans,l+r)
print(ans) | N = int(eval(input()))
S = eval(input())
a = S.count("E")
c = a
for s in S:
if s=="E":
c-=1
else:
c+=1
a=min(a,c)
print(a) | 14 | 13 | 184 | 139 | N = int(eval(input()))
S = eval(input())
l = 0
r = S[1:N].count("E")
ans = l + r
for n in range(1, N):
if S[n - 1] == "W":
l += 1
if S[n] == "E":
r -= 1
ans = min(ans, l + r)
print(ans)
| N = int(eval(input()))
S = eval(input())
a = S.count("E")
c = a
for s in S:
if s == "E":
c -= 1
else:
c += 1
a = min(a, c)
print(a)
| false | 7.142857 | [
"-l = 0",
"-r = S[1:N].count(\"E\")",
"-ans = l + r",
"-for n in range(1, N):",
"- if S[n - 1] == \"W\":",
"- l += 1",
"- if S[n] == \"E\":",
"- r -= 1",
"- ans = min(ans, l + r)",
"-print(ans)",
"+a = S.count(\"E\")",
"+c = a",
"+for s in S:",
"+ if s == \"E\":",... | false | 0.04841 | 0.046957 | 1.030946 | [
"s932573434",
"s320767350"
] |
u728611988 | p03845 | python | s454010432 | s795111479 | 23 | 18 | 3,444 | 3,060 | Accepted | Accepted | 21.74 | import copy
n = int(eval(input()))
T = list(map(int, input().split()))
m = int(eval(input()))
for i in range(m):
t = copy.copy(T)
p, x = list(map(int, input().split()))
t[p-1] = x
print((sum(t))) | n = int(eval(input()))
T = list(map(int, input().split()))
m = int(eval(input()))
for i in range(m):
t = T.copy()
p, x = list(map(int, input().split()))
t[p-1] = x
print((sum(t))) | 9 | 8 | 199 | 182 | import copy
n = int(eval(input()))
T = list(map(int, input().split()))
m = int(eval(input()))
for i in range(m):
t = copy.copy(T)
p, x = list(map(int, input().split()))
t[p - 1] = x
print((sum(t)))
| n = int(eval(input()))
T = list(map(int, input().split()))
m = int(eval(input()))
for i in range(m):
t = T.copy()
p, x = list(map(int, input().split()))
t[p - 1] = x
print((sum(t)))
| false | 11.111111 | [
"-import copy",
"-",
"- t = copy.copy(T)",
"+ t = T.copy()"
] | false | 0.038933 | 0.042284 | 0.920756 | [
"s454010432",
"s795111479"
] |
u644907318 | p02707 | python | s495984740 | s692342376 | 295 | 192 | 60,332 | 121,752 | Accepted | Accepted | 34.92 | N = int(eval(input()))
A = list(map(int,input().split()))
A.insert(0,0)
A.insert(0,0)
G = {i:[] for i in range(1,N+1)}
for i in range(2,N+1):
G[A[i]].append(i)
for i in range(1,N+1):
print((len(G[i]))) | N = int(eval(input()))
A = list(map(int,input().split()))
A.insert(0,0)
A.insert(0,0)
C = {i:0 for i in range(1,N+1)}
for i in range(2,N+1):
a = A[i]
C[a] += 1
for i in range(1,N+1):
print((C[i])) | 9 | 10 | 209 | 209 | N = int(eval(input()))
A = list(map(int, input().split()))
A.insert(0, 0)
A.insert(0, 0)
G = {i: [] for i in range(1, N + 1)}
for i in range(2, N + 1):
G[A[i]].append(i)
for i in range(1, N + 1):
print((len(G[i])))
| N = int(eval(input()))
A = list(map(int, input().split()))
A.insert(0, 0)
A.insert(0, 0)
C = {i: 0 for i in range(1, N + 1)}
for i in range(2, N + 1):
a = A[i]
C[a] += 1
for i in range(1, N + 1):
print((C[i]))
| false | 10 | [
"-G = {i: [] for i in range(1, N + 1)}",
"+C = {i: 0 for i in range(1, N + 1)}",
"- G[A[i]].append(i)",
"+ a = A[i]",
"+ C[a] += 1",
"- print((len(G[i])))",
"+ print((C[i]))"
] | false | 0.115086 | 0.040365 | 2.851116 | [
"s495984740",
"s692342376"
] |
u802963389 | p03031 | python | s992336251 | s875480000 | 45 | 37 | 3,064 | 9,136 | Accepted | Accepted | 17.78 | N, M = list(map(int, input().split()))
ks = [list(map(int, input().split())) for _ in range(M)]
p = list(map(int, input().split()))
# print(N, M)
# print(ks)
# print(p)
ans = 0
import itertools
for i in itertools.product([0,1], repeat=N):
righted = 0
for iter, j in enumerate(ks):
# print(iter, j )... | n, m = list(map(int, input().split()))
S = [list(map(int, input().split()))[1:] for _ in range(m)]
P = list(map(int, input().split()))
ans = 0
for b in range(2 ** n):
onswitch = [i + 1 for i in range(n) if (b >> i) & 1]
if all(sum(o in s for o in onswitch) % 2 == p for s, p in zip(S, P)):
ans += 1
... | 23 | 11 | 489 | 329 | N, M = list(map(int, input().split()))
ks = [list(map(int, input().split())) for _ in range(M)]
p = list(map(int, input().split()))
# print(N, M)
# print(ks)
# print(p)
ans = 0
import itertools
for i in itertools.product([0, 1], repeat=N):
righted = 0
for iter, j in enumerate(ks):
# print(iter, j )
... | n, m = list(map(int, input().split()))
S = [list(map(int, input().split()))[1:] for _ in range(m)]
P = list(map(int, input().split()))
ans = 0
for b in range(2**n):
onswitch = [i + 1 for i in range(n) if (b >> i) & 1]
if all(sum(o in s for o in onswitch) % 2 == p for s, p in zip(S, P)):
ans += 1
print(a... | false | 52.173913 | [
"-N, M = list(map(int, input().split()))",
"-ks = [list(map(int, input().split())) for _ in range(M)]",
"-p = list(map(int, input().split()))",
"-# print(N, M)",
"-# print(ks)",
"-# print(p)",
"+n, m = list(map(int, input().split()))",
"+S = [list(map(int, input().split()))[1:] for _ in range(m)]",
... | false | 0.04858 | 0.046395 | 1.047103 | [
"s992336251",
"s875480000"
] |
u506858457 | p02761 | python | s656257705 | s515299772 | 20 | 18 | 3,064 | 3,064 | Accepted | Accepted | 10 | def check(x):
if len(str(x))!=N:
return False
for i in range(M):
if str(x)[S[i]]!=str(C[i]):
return False
return True
N,M=list(map(int,input().split()))
S=[]
C=[]
for i in range(M):
s,c=list(map(int,input().split()))
s-=1
S.append(s)
C.append(c)
#print(S,C)
for i in range(1... | N,M=list(map(int,input().split()))
#SC=[s,c for input().split() in range(M)]
SC=[list(input().split()) for i in range(M)]
'''
SC=[]
for i in range(M):
SC.append((input().split()))
'''
def check(x):
x=str(x)
if len(x)!=N:
return False
for s,c in SC:
if x[int(s)-1]!=c:
return False
... | 22 | 21 | 373 | 401 | def check(x):
if len(str(x)) != N:
return False
for i in range(M):
if str(x)[S[i]] != str(C[i]):
return False
return True
N, M = list(map(int, input().split()))
S = []
C = []
for i in range(M):
s, c = list(map(int, input().split()))
s -= 1
S.append(s)
C.append(c... | N, M = list(map(int, input().split()))
# SC=[s,c for input().split() in range(M)]
SC = [list(input().split()) for i in range(M)]
"""
SC=[]
for i in range(M):
SC.append((input().split()))
"""
def check(x):
x = str(x)
if len(x) != N:
return False
for s, c in SC:
if x[int(s) - 1] != c:
... | false | 4.545455 | [
"+N, M = list(map(int, input().split()))",
"+# SC=[s,c for input().split() in range(M)]",
"+SC = [list(input().split()) for i in range(M)]",
"+\"\"\"",
"+SC=[]",
"+for i in range(M):",
"+ SC.append((input().split()))",
"+\"\"\"",
"+",
"+",
"- if len(str(x)) != N:",
"+ x = str(x)",
"+ ... | false | 0.036114 | 0.036074 | 1.001113 | [
"s656257705",
"s515299772"
] |
u087218797 | p02915 | python | s980641075 | s804293850 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | i = int(eval(input()))
print((str(i*i*i))) | tmp = int(eval(input()))
ans = tmp * tmp * tmp
print(ans)
| 2 | 7 | 35 | 62 | i = int(eval(input()))
print((str(i * i * i)))
| tmp = int(eval(input()))
ans = tmp * tmp * tmp
print(ans)
| false | 71.428571 | [
"-i = int(eval(input()))",
"-print((str(i * i * i)))",
"+tmp = int(eval(input()))",
"+ans = tmp * tmp * tmp",
"+print(ans)"
] | false | 0.043051 | 0.041339 | 1.041417 | [
"s980641075",
"s804293850"
] |
u263830634 | p02787 | python | s597718122 | s610491341 | 528 | 318 | 119,388 | 42,220 | Accepted | Accepted | 39.77 | INF = 10 ** 18
H, N = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
dp = [[INF] * (H + 1) for _ in range(N + 1)]
dp[0][0] = 0
for i in range(N):
for j in range(H + 1):
if j < AB[i][0]:
dp[i + 1][j] = min(dp[i][j], dp[i + 1][0] + AB[i][1])
... | import sys
input = sys.stdin.readline
INF = 10 ** 18
H, N = list(map(int, input().split()))
dp = [INF] * (H + 1)
dp[0] = 0
for i in range(N):
A, B = list(map(int, input().split()))
for j in range(H + 1):
if j < A:
dp[j] = min(dp[j], dp[0] + B)
else:
dp... | 19 | 22 | 465 | 395 | INF = 10**18
H, N = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
dp = [[INF] * (H + 1) for _ in range(N + 1)]
dp[0][0] = 0
for i in range(N):
for j in range(H + 1):
if j < AB[i][0]:
dp[i + 1][j] = min(dp[i][j], dp[i + 1][0] + AB[i][1])
else:
... | import sys
input = sys.stdin.readline
INF = 10**18
H, N = list(map(int, input().split()))
dp = [INF] * (H + 1)
dp[0] = 0
for i in range(N):
A, B = list(map(int, input().split()))
for j in range(H + 1):
if j < A:
dp[j] = min(dp[j], dp[0] + B)
else:
dp[j] = min(dp[j], dp[j... | false | 13.636364 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"-AB = [list(map(int, input().split())) for _ in range(N)]",
"-dp = [[INF] * (H + 1) for _ in range(N + 1)]",
"-dp[0][0] = 0",
"+dp = [INF] * (H + 1)",
"+dp[0] = 0",
"+ A, B = list(map(int, input().split()))",
"- if j < AB[i][0]:",
"- ... | false | 0.38338 | 0.189203 | 2.026286 | [
"s597718122",
"s610491341"
] |
u641406334 | p02832 | python | s787281580 | s216927133 | 871 | 93 | 25,244 | 24,744 | Accepted | Accepted | 89.32 | from collections import deque
n = int(eval(input()))
r = deque(list(map(int, input().split())))
i=0
while True:
if max(len(r),i)==i:
break
if r[i]!=i+1:
r.popleft()
else:
i+=1
print(('-1' if len(r)==0 else n-len(r))) | n = int(eval(input()))
R = list(map(int, input().split()))
c, i = 0, 1
for r in R:
if r==i: i+=1
else: c+=1
print((c if c<n else '-1'))
| 12 | 7 | 249 | 138 | from collections import deque
n = int(eval(input()))
r = deque(list(map(int, input().split())))
i = 0
while True:
if max(len(r), i) == i:
break
if r[i] != i + 1:
r.popleft()
else:
i += 1
print(("-1" if len(r) == 0 else n - len(r)))
| n = int(eval(input()))
R = list(map(int, input().split()))
c, i = 0, 1
for r in R:
if r == i:
i += 1
else:
c += 1
print((c if c < n else "-1"))
| false | 41.666667 | [
"-from collections import deque",
"-",
"-r = deque(list(map(int, input().split())))",
"-i = 0",
"-while True:",
"- if max(len(r), i) == i:",
"- break",
"- if r[i] != i + 1:",
"- r.popleft()",
"+R = list(map(int, input().split()))",
"+c, i = 0, 1",
"+for r in R:",
"+ if... | false | 0.118833 | 0.044039 | 2.69837 | [
"s787281580",
"s216927133"
] |
u883048396 | p03201 | python | s454605380 | s358336790 | 417 | 373 | 42,296 | 44,560 | Accepted | Accepted | 10.55 | N = int(eval(input()))
dA1 ={}
dA0 ={}
def lenbin(a):
return len(bin(a)) - 2
def addData(oDict,a):
if a in oDict:
oDict[a]+=1
else:
oDict[a]=1
for a in input().split():
a = int(a)
if a % 2 :
addData(dA1,a)
else:
addData(dA0,a)
def searchPair(oD):
... |
#偶奇合わせてたのはグルグル回してたからだが
#一意に決めるんなら偶奇合わせる必要ないのでは
def 解():
N = int(eval(input()))
dA ={}
def lenbin(a):
return len(bin(a)) - 2
def addData(oDict,a):
if a in oDict:
oDict[a]+=1
else:
oDict[a]=1
for a in map(int,input().split()):
addD... | 35 | 32 | 756 | 840 | N = int(eval(input()))
dA1 = {}
dA0 = {}
def lenbin(a):
return len(bin(a)) - 2
def addData(oDict, a):
if a in oDict:
oDict[a] += 1
else:
oDict[a] = 1
for a in input().split():
a = int(a)
if a % 2:
addData(dA1, a)
else:
addData(dA0, a)
def searchPair(oD):
... | # 偶奇合わせてたのはグルグル回してたからだが
# 一意に決めるんなら偶奇合わせる必要ないのでは
def 解():
N = int(eval(input()))
dA = {}
def lenbin(a):
return len(bin(a)) - 2
def addData(oDict, a):
if a in oDict:
oDict[a] += 1
else:
oDict[a] = 1
for a in map(int, input().split()):
addData... | false | 8.571429 | [
"-N = int(eval(input()))",
"-dA1 = {}",
"-dA0 = {}",
"+# 偶奇合わせてたのはグルグル回してたからだが",
"+# 一意に決めるんなら偶奇合わせる必要ないのでは",
"+def 解():",
"+ N = int(eval(input()))",
"+ dA = {}",
"+",
"+ def lenbin(a):",
"+ return len(bin(a)) - 2",
"+",
"+ def addData(oDict, a):",
"+ if a in oDi... | false | 0.118827 | 0.088897 | 1.336675 | [
"s454605380",
"s358336790"
] |
u024782094 | p03161 | python | s118275333 | s422408835 | 452 | 396 | 55,264 | 57,696 | Accepted | Accepted | 12.39 | from collections import Counter
from collections import deque
import math
import bisect
import sys
def input(): return sys.stdin.readline().strip()
def mp(): return list(map(int,input().split()))
def lmp(): return list(map(int,input().split()))
n,k=mp()
h=lmp()
h.insert(0,0)
dp=[float("inf")]*(n+1)
dp[1... | n,k = list(map(int,input().split()))
height = list(map(int,input().split()))
cost_list = []
for m in range(1,n+1):
if m <= k:
cost_list.append(abs(height[m-1]-height[0]))
else:
Min = cost_list[-1] + abs(height[m-2]-height[m-1])
if k > 1:
for x in range(2,k+1):
money2 = cost_list[... | 20 | 15 | 461 | 450 | from collections import Counter
from collections import deque
import math
import bisect
import sys
def input():
return sys.stdin.readline().strip()
def mp():
return list(map(int, input().split()))
def lmp():
return list(map(int, input().split()))
n, k = mp()
h = lmp()
h.insert(0, 0)
dp = [float("inf... | n, k = list(map(int, input().split()))
height = list(map(int, input().split()))
cost_list = []
for m in range(1, n + 1):
if m <= k:
cost_list.append(abs(height[m - 1] - height[0]))
else:
Min = cost_list[-1] + abs(height[m - 2] - height[m - 1])
if k > 1:
for x in range(2, k + ... | false | 25 | [
"-from collections import Counter",
"-from collections import deque",
"-import math",
"-import bisect",
"-import sys",
"-",
"-",
"-def input():",
"- return sys.stdin.readline().strip()",
"-",
"-",
"-def mp():",
"- return list(map(int, input().split()))",
"-",
"-",
"-def lmp():",
... | false | 0.046703 | 0.047553 | 0.982142 | [
"s118275333",
"s422408835"
] |
u599547273 | p03325 | python | s144152043 | s990642047 | 72 | 60 | 4,452 | 4,148 | Accepted | Accepted | 16.67 | from functools import reduce
def count_two(n):
two_count = 0
while n != 0 and n % 2 == 0:
two_count += 1
n //= 2
return two_count
n = int(eval(input()))
a = list(map(int, input().split()))
a_two_count_sum = sum([count_two(ai) for ai in a])
print(a_two_count_sum) | def count_two(n):
two = 0
while n%2 == 0:
n //= 2
two += 1
return two
n = int(eval(input()))
a = [int(m) for m in input().split(" ")]
print((sum([count_two(a_n) for a_n in a]))) | 13 | 11 | 271 | 188 | from functools import reduce
def count_two(n):
two_count = 0
while n != 0 and n % 2 == 0:
two_count += 1
n //= 2
return two_count
n = int(eval(input()))
a = list(map(int, input().split()))
a_two_count_sum = sum([count_two(ai) for ai in a])
print(a_two_count_sum)
| def count_two(n):
two = 0
while n % 2 == 0:
n //= 2
two += 1
return two
n = int(eval(input()))
a = [int(m) for m in input().split(" ")]
print((sum([count_two(a_n) for a_n in a])))
| false | 15.384615 | [
"-from functools import reduce",
"-",
"-",
"- two_count = 0",
"- while n != 0 and n % 2 == 0:",
"- two_count += 1",
"+ two = 0",
"+ while n % 2 == 0:",
"- return two_count",
"+ two += 1",
"+ return two",
"-a = list(map(int, input().split()))",
"-a_two_count_su... | false | 0.040113 | 0.040091 | 1.000555 | [
"s144152043",
"s990642047"
] |
u294385082 | p03308 | python | s688414957 | s706961627 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | n = int(eval(input()))
a = list(map(int,input().split()))
maxabs = 0
for i in range(n):
for j in range(i+1,n):
c = abs(a[i] - a[j])
maxabs = max(maxabs,c)
print(maxabs)
| n = int(eval(input()))
a = list(map(int,input().split()))
print((max(a)-min(a))) | 10 | 4 | 188 | 76 | n = int(eval(input()))
a = list(map(int, input().split()))
maxabs = 0
for i in range(n):
for j in range(i + 1, n):
c = abs(a[i] - a[j])
maxabs = max(maxabs, c)
print(maxabs)
| n = int(eval(input()))
a = list(map(int, input().split()))
print((max(a) - min(a)))
| false | 60 | [
"-maxabs = 0",
"-for i in range(n):",
"- for j in range(i + 1, n):",
"- c = abs(a[i] - a[j])",
"- maxabs = max(maxabs, c)",
"-print(maxabs)",
"+print((max(a) - min(a)))"
] | false | 0.051063 | 0.048038 | 1.062965 | [
"s688414957",
"s706961627"
] |
u186838327 | p03963 | python | s064140117 | s160175803 | 179 | 16 | 38,256 | 2,940 | Accepted | Accepted | 91.06 | n, k = list(map(int, input().split()))
ans = k*((k-1)**(n-1))
print(ans)
| n, k = list(map(int, input().split()))
print((k*(k-1)**(n-1)))
| 3 | 2 | 73 | 56 | n, k = list(map(int, input().split()))
ans = k * ((k - 1) ** (n - 1))
print(ans)
| n, k = list(map(int, input().split()))
print((k * (k - 1) ** (n - 1)))
| false | 33.333333 | [
"-ans = k * ((k - 1) ** (n - 1))",
"-print(ans)",
"+print((k * (k - 1) ** (n - 1)))"
] | false | 0.067551 | 0.037332 | 1.809473 | [
"s064140117",
"s160175803"
] |
u297574184 | p03879 | python | s600962160 | s518602955 | 24 | 19 | 3,444 | 3,188 | Accepted | Accepted | 20.83 | from math import acos, tan, hypot
def getRad1(s12, s13, s23):
return acos((s12*s12 + s13*s13 - s23*s23) / (2*s12*s13))
def getMaxR(s12, rad1, rad2):
tan1 = tan(rad1 / 2)
tan2 = tan(rad2 / 2)
h = s12 * (tan1*tan2) / (tan1+tan2)
return h * (tan1+tan2) / (2*tan1*tan2 + tan1 + tan2)
x1, y1... | from math import acos, tan, hypot
def getRad1(s12, s13, s23):
return acos((s12*s12 + s13*s13 - s23*s23) / (2*s12*s13))
def getMaxR(s12, rad1, rad2):
tan1 = tan(rad1 / 2)
tan2 = tan(rad2 / 2)
h = s12 * (tan1*tan2) / (tan1+tan2)
def isOK(mid):
return s12 - mid/tan1 - mid/tan2 <= ... | 29 | 40 | 727 | 920 | from math import acos, tan, hypot
def getRad1(s12, s13, s23):
return acos((s12 * s12 + s13 * s13 - s23 * s23) / (2 * s12 * s13))
def getMaxR(s12, rad1, rad2):
tan1 = tan(rad1 / 2)
tan2 = tan(rad2 / 2)
h = s12 * (tan1 * tan2) / (tan1 + tan2)
return h * (tan1 + tan2) / (2 * tan1 * tan2 + tan1 + ta... | from math import acos, tan, hypot
def getRad1(s12, s13, s23):
return acos((s12 * s12 + s13 * s13 - s23 * s23) / (2 * s12 * s13))
def getMaxR(s12, rad1, rad2):
tan1 = tan(rad1 / 2)
tan2 = tan(rad2 / 2)
h = s12 * (tan1 * tan2) / (tan1 + tan2)
def isOK(mid):
return s12 - mid / tan1 - mid /... | false | 27.5 | [
"- return h * (tan1 + tan2) / (2 * tan1 * tan2 + tan1 + tan2)",
"+",
"+ def isOK(mid):",
"+ return s12 - mid / tan1 - mid / tan2 <= 2 * mid",
"+",
"+ ng, ok = 0, h",
"+ while abs(ok - ng) > 10**-12:",
"+ mid = (ng + ok) / 2",
"+ if isOK(mid):",
"+ ok = m... | false | 0.036957 | 0.071235 | 0.518807 | [
"s600962160",
"s518602955"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.