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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u985041094 | p02613 | python | s074369081 | s910006756 | 147 | 52 | 16,332 | 17,184 | Accepted | Accepted | 64.63 | def B():
n = int(eval(input()))
s = []
for _ in range(n):
s.append(eval(input()))
import collections
c = collections.Counter(s)
ret_l = ["AC","WA","TLE","RE"]
for t in ret_l:
print((t + " x " + str(c[t])))
B() | def B():
n, *s = open(0).read().split()
import collections
c = collections.Counter(s)
ret_l = ["AC","WA","TLE","RE"]
for t in ret_l:
print((t + " x " + str(c[t])))
B() | 11 | 8 | 250 | 201 | def B():
n = int(eval(input()))
s = []
for _ in range(n):
s.append(eval(input()))
import collections
c = collections.Counter(s)
ret_l = ["AC", "WA", "TLE", "RE"]
for t in ret_l:
print((t + " x " + str(c[t])))
B()
| def B():
n, *s = open(0).read().split()
import collections
c = collections.Counter(s)
ret_l = ["AC", "WA", "TLE", "RE"]
for t in ret_l:
print((t + " x " + str(c[t])))
B()
| false | 27.272727 | [
"- n = int(eval(input()))",
"- s = []",
"- for _ in range(n):",
"- s.append(eval(input()))",
"+ n, *s = open(0).read().split()"
] | false | 0.075541 | 0.105845 | 0.713699 | [
"s074369081",
"s910006756"
] |
u466335531 | p02780 | python | s155595245 | s742916711 | 188 | 159 | 24,812 | 24,804 | Accepted | Accepted | 15.43 | N, K = list(map(int,input().split()))
P = list(map(int,input().split()))
P = [(p+1)/2 for p in P]
sm = sum(P[:K]) # 先頭のK個の和を計算
ans = sm # 最大値(答え)を保存する
for i in range(N-K):
sm = sm - P[i] + P[K+i] # 窓をずらす
ans = max(ans, sm) # 最大値(答え)を更新
print (ans) | N, K = list(map(int,input().split()))
P = list(map(int,input().split()))
P = [p+1 for p in P]
sm = sum(P[:K]) # 先頭のK個の和を計算
ans = sm # 最大値(答え)を保存する
for i in range(N-K):
sm = sm - P[i] + P[K+i] # 窓をずらす
ans = max(ans, sm) # 最大値(答え)を更新
print((ans/2))
| 9 | 9 | 262 | 261 | N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
P = [(p + 1) / 2 for p in P]
sm = sum(P[:K]) # 先頭のK個の和を計算
ans = sm # 最大値(答え)を保存する
for i in range(N - K):
sm = sm - P[i] + P[K + i] # 窓をずらす
ans = max(ans, sm) # 最大値(答え)を更新
print(ans)
| N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
P = [p + 1 for p in P]
sm = sum(P[:K]) # 先頭のK個の和を計算
ans = sm # 最大値(答え)を保存する
for i in range(N - K):
sm = sm - P[i] + P[K + i] # 窓をずらす
ans = max(ans, sm) # 最大値(答え)を更新
print((ans / 2))
| false | 0 | [
"-P = [(p + 1) / 2 for p in P]",
"+P = [p + 1 for p in P]",
"-print(ans)",
"+print((ans / 2))"
] | false | 0.130278 | 0.045777 | 2.84595 | [
"s155595245",
"s742916711"
] |
u130979865 | p02383 | python | s387602961 | s503501792 | 30 | 10 | 6,480 | 6,500 | Accepted | Accepted | 66.67 | # -*- coding: utf-8 -*-
class dice_class:
def __init__(self, top, front, right, left, back, bottom):
self.top = top
self.front = front
self.right = right
self.left = left
self.back = back
self.bottom = bottom
def roll(self, s):
... | # -*- coding: utf-8 -*-
class dice_class:
def __init__(self, list):
self.num = list
def roll(self, s):
for i in s:
if i == 'E':
self.rollE()
elif i == 'N':
self.rollN()
elif i == 'S':
self.rollS()
... | 56 | 35 | 1,540 | 1,022 | # -*- coding: utf-8 -*-
class dice_class:
def __init__(self, top, front, right, left, back, bottom):
self.top = top
self.front = front
self.right = right
self.left = left
self.back = back
self.bottom = bottom
def roll(self, s):
for i in s:
if ... | # -*- coding: utf-8 -*-
class dice_class:
def __init__(self, list):
self.num = list
def roll(self, s):
for i in s:
if i == "E":
self.rollE()
elif i == "N":
self.rollN()
elif i == "S":
self.rollS()
el... | false | 37.5 | [
"- def __init__(self, top, front, right, left, back, bottom):",
"- self.top = top",
"- self.front = front",
"- self.right = right",
"- self.left = left",
"- self.back = back",
"- self.bottom = bottom",
"+ def __init__(self, list):",
"+ self.num ... | false | 0.036999 | 0.064084 | 0.577348 | [
"s387602961",
"s503501792"
] |
u373274281 | p03241 | python | s499020259 | s144392294 | 481 | 22 | 40,044 | 3,060 | Accepted | Accepted | 95.43 | n, m = list(map(int, input().split()))
for i in range(m//n, 0, -1):
if m % i != 0:
continue
print(i)
break | from math import sqrt, ceil
n, m = list(map(int, input().split()))
M = set()
for i in range(1, ceil(sqrt(m))+1):
if m % i == 0:
M.add(i)
M.add(m//i)
M = sorted(list(M), reverse=True)
#print(M)
for i in M:
if i <= m // n:
print(i)
break
| 7 | 14 | 128 | 284 | n, m = list(map(int, input().split()))
for i in range(m // n, 0, -1):
if m % i != 0:
continue
print(i)
break
| from math import sqrt, ceil
n, m = list(map(int, input().split()))
M = set()
for i in range(1, ceil(sqrt(m)) + 1):
if m % i == 0:
M.add(i)
M.add(m // i)
M = sorted(list(M), reverse=True)
# print(M)
for i in M:
if i <= m // n:
print(i)
break
| false | 50 | [
"+from math import sqrt, ceil",
"+",
"-for i in range(m // n, 0, -1):",
"- if m % i != 0:",
"- continue",
"- print(i)",
"- break",
"+M = set()",
"+for i in range(1, ceil(sqrt(m)) + 1):",
"+ if m % i == 0:",
"+ M.add(i)",
"+ M.add(m // i)",
"+M = sorted(list(M... | false | 0.10435 | 0.037395 | 2.790453 | [
"s499020259",
"s144392294"
] |
u363421241 | p02690 | python | s665198103 | s802040498 | 137 | 50 | 9,176 | 9,108 | Accepted | Accepted | 63.5 | x = int(eval(input()))
for a in range(1000):
for b in range(-1000,1000):
if a**5-b**5 == x:
print((a,b))
exit() | x = int(eval(input()))
for a in range(-118, 120):
for b in range(-119, 119):
if a**5 - b**5 == x:
print((a, b))
exit() | 7 | 7 | 146 | 153 | x = int(eval(input()))
for a in range(1000):
for b in range(-1000, 1000):
if a**5 - b**5 == x:
print((a, b))
exit()
| x = int(eval(input()))
for a in range(-118, 120):
for b in range(-119, 119):
if a**5 - b**5 == x:
print((a, b))
exit()
| false | 0 | [
"-for a in range(1000):",
"- for b in range(-1000, 1000):",
"+for a in range(-118, 120):",
"+ for b in range(-119, 119):"
] | false | 0.038581 | 0.050261 | 0.767617 | [
"s665198103",
"s802040498"
] |
u518378780 | p03014 | python | s670512473 | s983668913 | 1,250 | 947 | 184,324 | 183,940 | Accepted | Accepted | 24.24 | def add(n, l):
global dp
t = 0
for v in range(1, len(l)):
y = l[v]
x = l[v-1]
while t != y:
dp[n][t] += y - 1 - x
t += 1
t += 1
def add2(n, l):
global dp2
t = 0
for v in range(1, len(l)):
y = l[v]
x = l[v-1]... | def add(dp, n, l):
t = 0
for v in range(1, len(l)):
y = l[v]
x = l[v-1]
while t != y:
dp[n][t] += y - 1 - x
t += 1
t += 1
H,W = [int(_) for _ in input().split()]
s = []
b = []
c = []
for _ in range(H):
s.append(eval(input()))
for i i... | 62 | 48 | 1,319 | 1,030 | def add(n, l):
global dp
t = 0
for v in range(1, len(l)):
y = l[v]
x = l[v - 1]
while t != y:
dp[n][t] += y - 1 - x
t += 1
t += 1
def add2(n, l):
global dp2
t = 0
for v in range(1, len(l)):
y = l[v]
x = l[v - 1]
wh... | def add(dp, n, l):
t = 0
for v in range(1, len(l)):
y = l[v]
x = l[v - 1]
while t != y:
dp[n][t] += y - 1 - x
t += 1
t += 1
H, W = [int(_) for _ in input().split()]
s = []
b = []
c = []
for _ in range(H):
s.append(eval(input()))
for i in range(H):
... | false | 22.580645 | [
"-def add(n, l):",
"- global dp",
"+def add(dp, n, l):",
"- t += 1",
"- t += 1",
"-",
"-",
"-def add2(n, l):",
"- global dp2",
"- t = 0",
"- for v in range(1, len(l)):",
"- y = l[v]",
"- x = l[v - 1]",
"- while t != y:",
"- dp... | false | 0.03649 | 0.054893 | 0.664743 | [
"s670512473",
"s983668913"
] |
u279955105 | p02394 | python | s311002864 | s897863786 | 60 | 50 | 7,664 | 7,576 | Accepted | Accepted | 16.67 | W,H,x,y,r = list(map(int, input().split()))
if (0 <= x-r and x+r <= W) and (0 <= y-r and y+r <= H):
print("Yes")
else:
print("No") | W,H,x,y,r = list(map(int, input().split()))
if ((0 <= x-r) and (r+x <= W)) and ((0 <= y-r) and (r+y <= H)):
print("Yes")
else:
print("No") | 6 | 5 | 138 | 144 | W, H, x, y, r = list(map(int, input().split()))
if (0 <= x - r and x + r <= W) and (0 <= y - r and y + r <= H):
print("Yes")
else:
print("No")
| W, H, x, y, r = list(map(int, input().split()))
if ((0 <= x - r) and (r + x <= W)) and ((0 <= y - r) and (r + y <= H)):
print("Yes")
else:
print("No")
| false | 16.666667 | [
"-if (0 <= x - r and x + r <= W) and (0 <= y - r and y + r <= H):",
"+if ((0 <= x - r) and (r + x <= W)) and ((0 <= y - r) and (r + y <= H)):"
] | false | 0.094827 | 0.059193 | 1.60199 | [
"s311002864",
"s897863786"
] |
u246809151 | p02641 | python | s645980271 | s060450949 | 33 | 27 | 9,168 | 9,156 | Accepted | Accepted | 18.18 | x,n = list(map(int, input().split()))
num_list = list(map(int, input().split()))
for i in range(101):
if (x-i) not in num_list:
print((x-i))
exit()
if (x+i) not in num_list:
print((x+i))
exit()
| x,n = list(map(int, input().split()))
num_list = list(map(int, input().split()))
for i in range(100):
if (x-i) not in num_list:
print((x-i))
exit()
if (x+i) not in num_list:
print((x+i))
exit()
| 11 | 11 | 236 | 236 | x, n = list(map(int, input().split()))
num_list = list(map(int, input().split()))
for i in range(101):
if (x - i) not in num_list:
print((x - i))
exit()
if (x + i) not in num_list:
print((x + i))
exit()
| x, n = list(map(int, input().split()))
num_list = list(map(int, input().split()))
for i in range(100):
if (x - i) not in num_list:
print((x - i))
exit()
if (x + i) not in num_list:
print((x + i))
exit()
| false | 0 | [
"-for i in range(101):",
"+for i in range(100):"
] | false | 0.065926 | 0.107095 | 0.615589 | [
"s645980271",
"s060450949"
] |
u201928947 | p03062 | python | s098601328 | s114468526 | 103 | 74 | 14,412 | 14,412 | Accepted | Accepted | 28.16 | n = int(eval(input()))
a = list(map(int,input().split()))
m = 100000000000
count = 0
ans = 0
for i in range(n):
if a[i] < 0:
count += 1
x = abs(a[i])
ans += x
m = min(m,x)
if count % 2 != 0:
ans -= 2*m
print(ans)
| n = int(eval(input()))
a = list(map(int,input().split()))
m = 10000000000
count = 0
for i in range(n):
if a[i] < 0:
count += 1
a[i] = -a[i]
if count % 2 == 1:
print((sum(a)-2*min(a)))
else:
print((sum(a))) | 14 | 12 | 249 | 234 | n = int(eval(input()))
a = list(map(int, input().split()))
m = 100000000000
count = 0
ans = 0
for i in range(n):
if a[i] < 0:
count += 1
x = abs(a[i])
ans += x
m = min(m, x)
if count % 2 != 0:
ans -= 2 * m
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split()))
m = 10000000000
count = 0
for i in range(n):
if a[i] < 0:
count += 1
a[i] = -a[i]
if count % 2 == 1:
print((sum(a) - 2 * min(a)))
else:
print((sum(a)))
| false | 14.285714 | [
"-m = 100000000000",
"+m = 10000000000",
"-ans = 0",
"- x = abs(a[i])",
"- ans += x",
"- m = min(m, x)",
"-if count % 2 != 0:",
"- ans -= 2 * m",
"-print(ans)",
"+ a[i] = -a[i]",
"+if count % 2 == 1:",
"+ print((sum(a) - 2 * min(a)))",
"+else:",
"+ print((sum(a)))"... | false | 0.033749 | 0.067908 | 0.496972 | [
"s098601328",
"s114468526"
] |
u408071652 | p03243 | python | s415436487 | s005934117 | 73 | 27 | 62,272 | 9,092 | Accepted | Accepted | 63.01 | import sys
import math
import itertools
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(eval(input()))
d,m = divmod(N-1,111)
print(((d+1)*111))
if __name__ == "__main__":
main()
| import sys
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(eval(input()))
d =(N-1)//111
print(((d+1)*111))
if __name__ == "__main__":
main()
| 17 | 14 | 234 | 193 | import sys
import math
import itertools
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(eval(input()))
d, m = divmod(N - 1, 111)
print(((d + 1) * 111))
if __name__ == "__main__":
main()
| import sys
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(eval(input()))
d = (N - 1) // 111
print(((d + 1) * 111))
if __name__ == "__main__":
main()
| false | 17.647059 | [
"-import math",
"-import itertools",
"- d, m = divmod(N - 1, 111)",
"+ d = (N - 1) // 111"
] | false | 0.033346 | 0.075929 | 0.439176 | [
"s415436487",
"s005934117"
] |
u115110170 | p02793 | python | s757704524 | s848097367 | 1,894 | 274 | 6,116 | 4,596 | Accepted | Accepted | 85.53 | import math
import fractions
def lcm(x, y):
return (x * y) // fractions.gcd(x, y)
def main():
mod = 10**9 +7
n = int(eval(input()))
ls = list(map(int,input().split()))
t = ls[0]
for a in ls:
t = lcm(t,a)
ans = 0
for a in ls:
ans += t//a
print((ans%mod))
if __name... | class PrimeOptimizer:
def __init__(self, MAX_NUM=10**3):
is_prime = [True] * MAX_NUM
is_prime[0] = False
is_prime[1] = False
primes = []
for i in range(MAX_NUM):
if is_prime[i]:
primes.append(i)
for j in range(2*i, MAX_NUM,... | 21 | 57 | 340 | 1,506 | import math
import fractions
def lcm(x, y):
return (x * y) // fractions.gcd(x, y)
def main():
mod = 10**9 + 7
n = int(eval(input()))
ls = list(map(int, input().split()))
t = ls[0]
for a in ls:
t = lcm(t, a)
ans = 0
for a in ls:
ans += t // a
print((ans % mod))
i... | class PrimeOptimizer:
def __init__(self, MAX_NUM=10**3):
is_prime = [True] * MAX_NUM
is_prime[0] = False
is_prime[1] = False
primes = []
for i in range(MAX_NUM):
if is_prime[i]:
primes.append(i)
for j in range(2 * i, MAX_NUM, i):
... | false | 63.157895 | [
"-import math",
"-import fractions",
"+class PrimeOptimizer:",
"+ def __init__(self, MAX_NUM=10**3):",
"+ is_prime = [True] * MAX_NUM",
"+ is_prime[0] = False",
"+ is_prime[1] = False",
"+ primes = []",
"+ for i in range(MAX_NUM):",
"+ if is_prime[i... | false | 0.055271 | 0.038693 | 1.428472 | [
"s757704524",
"s848097367"
] |
u240096083 | p03163 | python | s729717417 | s137199688 | 1,126 | 1,009 | 306,968 | 306,968 | Accepted | Accepted | 10.39 | from pprint import pprint
n,w = list(map(int,input().split()))
wv = [list(map(int,input().split())) for _ in range(n)]
dp_table = [[-float("inf")]*(w+1) for _ in range(n+1)]
dp_table[0] = [0]*(w+1)
#sum_w以下の重さの時のvalueの合計の最大を求めていく。
for i in range(1,n+1):
for sum_w in range(w+1):
#i番目の品物... | from pprint import pprint
n,w = list(map(int,input().split()))
wv = [list(map(int,input().split())) for _ in range(n)]
dp_table = [[-float("inf")]*(w+1) for _ in range(n+1)]
dp_table[0] = [0]*(w+1)
#sum_w以下の重さの時のvalueの合計の最大を求めていく。
for i in range(1,n+1):
for sum_w in range(w+1):
#i番目の品物... | 26 | 25 | 638 | 601 | from pprint import pprint
n, w = list(map(int, input().split()))
wv = [list(map(int, input().split())) for _ in range(n)]
dp_table = [[-float("inf")] * (w + 1) for _ in range(n + 1)]
dp_table[0] = [0] * (w + 1)
# sum_w以下の重さの時のvalueの合計の最大を求めていく。
for i in range(1, n + 1):
for sum_w in range(w + 1):
# i番目の品物を... | from pprint import pprint
n, w = list(map(int, input().split()))
wv = [list(map(int, input().split())) for _ in range(n)]
dp_table = [[-float("inf")] * (w + 1) for _ in range(n + 1)]
dp_table[0] = [0] * (w + 1)
# sum_w以下の重さの時のvalueの合計の最大を求めていく。
for i in range(1, n + 1):
for sum_w in range(w + 1):
# i番目の品物を... | false | 3.846154 | [
"- # i番目の品物を選ばない場合",
"- dp_table[i][sum_w] = max(dp_table[i][sum_w], dp_table[i - 1][sum_w])",
"- dp_table[i][sum_w], dp_table[i - 1][sum_w - wv[i - 1][0]] + wv[i - 1][1]",
"+ dp_table[i - 1][sum_w],",
"+ dp_table[i - 1][sum_w - wv[i - 1][0]] + wv[i... | false | 0.157314 | 0.045712 | 3.441419 | [
"s729717417",
"s137199688"
] |
u562935282 | p02843 | python | s508740676 | s701579104 | 201 | 17 | 41,452 | 2,940 | Accepted | Accepted | 91.54 | x = int(eval(input()))
dp = [False] * (x + 1)
dp[0] = True
for j in range(100, x + 1):
for t in range(100, 105 + 1):
if j - t >= 0:
dp[j] = dp[j] or dp[j - t]
print((1 if dp[x] else 0))
| def solve():
x = int(eval(input()))
min_ = x // 105
max_ = x // 100
for c in range(max_, max_ + 1):
if 100 * c <= x <= 105 * c:
return 1
return 0
print((solve()))
# 品物の個数 C が決まっていると、合計価格としてありうるものは 「100 × C 円以上 105 × C 円以下」 す
# べてになります。ですので、判定が簡単です。
# C = 1, 2... | 11 | 22 | 215 | 509 | x = int(eval(input()))
dp = [False] * (x + 1)
dp[0] = True
for j in range(100, x + 1):
for t in range(100, 105 + 1):
if j - t >= 0:
dp[j] = dp[j] or dp[j - t]
print((1 if dp[x] else 0))
| def solve():
x = int(eval(input()))
min_ = x // 105
max_ = x // 100
for c in range(max_, max_ + 1):
if 100 * c <= x <= 105 * c:
return 1
return 0
print((solve()))
# 品物の個数 C が決まっていると、合計価格としてありうるものは 「100 × C 円以上 105 × C 円以下」 す
# べてになります。ですので、判定が簡単です。
# C = 1, 2, 3, …, X すべてに対して判定... | false | 50 | [
"-x = int(eval(input()))",
"-dp = [False] * (x + 1)",
"-dp[0] = True",
"-for j in range(100, x + 1):",
"- for t in range(100, 105 + 1):",
"- if j - t >= 0:",
"- dp[j] = dp[j] or dp[j - t]",
"-print((1 if dp[x] else 0))",
"+def solve():",
"+ x = int(eval(input()))",
"+ ... | false | 0.080846 | 0.035586 | 2.271848 | [
"s508740676",
"s701579104"
] |
u888092736 | p03274 | python | s969287894 | s965536178 | 91 | 84 | 14,252 | 14,392 | Accepted | Accepted | 7.69 | N, K = list(map(int, input().split()))
X = list(map(int, input().split()))
ans = float("inf")
for i in range(N - K + 1):
left, right = X[i], X[i + K - 1]
if left * right <= 0:
ans = min(ans, abs(left) + right + min(abs(left), right))
elif left > 0:
ans = min(ans, right)
else:
... | N, K = list(map(int, input().split()))
X = list(map(int, input().split()))
ans = float("inf")
for i in range(N - K + 1):
left, right = X[i], X[i + K - 1]
dist = right - left
ans = min(ans, abs(left) + dist, abs(right) + dist)
print(ans)
| 12 | 8 | 359 | 250 | N, K = list(map(int, input().split()))
X = list(map(int, input().split()))
ans = float("inf")
for i in range(N - K + 1):
left, right = X[i], X[i + K - 1]
if left * right <= 0:
ans = min(ans, abs(left) + right + min(abs(left), right))
elif left > 0:
ans = min(ans, right)
else:
ans... | N, K = list(map(int, input().split()))
X = list(map(int, input().split()))
ans = float("inf")
for i in range(N - K + 1):
left, right = X[i], X[i + K - 1]
dist = right - left
ans = min(ans, abs(left) + dist, abs(right) + dist)
print(ans)
| false | 33.333333 | [
"- if left * right <= 0:",
"- ans = min(ans, abs(left) + right + min(abs(left), right))",
"- elif left > 0:",
"- ans = min(ans, right)",
"- else:",
"- ans = min(ans, abs(left))",
"+ dist = right - left",
"+ ans = min(ans, abs(left) + dist, abs(right) + dist)"
] | false | 0.037075 | 0.039551 | 0.937405 | [
"s969287894",
"s965536178"
] |
u597374218 | p02640 | python | s032571470 | s525353515 | 31 | 26 | 9,104 | 9,156 | Accepted | Accepted | 16.13 | X,Y=list(map(int,input().split()))
for i in range(X+1):
if 2*i+4*(X-i)==Y:
print("Yes")
break
else:
print("No") | X,Y=list(map(int,input().split()))
for num in range(X+1):
if 2*num+4*(X-num)==Y:
print("Yes")
break
else:
print("No") | 7 | 7 | 135 | 141 | X, Y = list(map(int, input().split()))
for i in range(X + 1):
if 2 * i + 4 * (X - i) == Y:
print("Yes")
break
else:
print("No")
| X, Y = list(map(int, input().split()))
for num in range(X + 1):
if 2 * num + 4 * (X - num) == Y:
print("Yes")
break
else:
print("No")
| false | 0 | [
"-for i in range(X + 1):",
"- if 2 * i + 4 * (X - i) == Y:",
"+for num in range(X + 1):",
"+ if 2 * num + 4 * (X - num) == Y:"
] | false | 0.044898 | 0.047335 | 0.948501 | [
"s032571470",
"s525353515"
] |
u645250356 | p02971 | python | s292165819 | s145084798 | 541 | 425 | 4,540 | 60,124 | Accepted | Accepted | 21.44 | N = int(eval(input()))
max = 0
max_i = N + 1
max_sc = 0
for i in range(N):
tmp = int(eval(input()))
if tmp > max:
max_sc = max
max = tmp
max_i = i
elif tmp > max_sc:
max_sc = tmp
for i in range(N):
if i == max_i:
print(max_sc)
else:
p... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return ... | 17 | 32 | 317 | 762 | N = int(eval(input()))
max = 0
max_i = N + 1
max_sc = 0
for i in range(N):
tmp = int(eval(input()))
if tmp > max:
max_sc = max
max = tmp
max_i = i
elif tmp > max_sc:
max_sc = tmp
for i in range(N):
if i == max_i:
print(max_sc)
else:
print(max)
| from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, string, queue
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.readline().split()))
def ... | false | 46.875 | [
"-N = int(eval(input()))",
"-max = 0",
"-max_i = N + 1",
"-max_sc = 0",
"-for i in range(N):",
"- tmp = int(eval(input()))",
"- if tmp > max:",
"- max_sc = max",
"- max = tmp",
"- max_i = i",
"- elif tmp > max_sc:",
"- max_sc = tmp",
"-for i in range(N):"... | false | 0.037337 | 0.056161 | 0.664811 | [
"s292165819",
"s145084798"
] |
u353797797 | p03221 | python | s523023062 | s904712522 | 771 | 601 | 33,704 | 33,700 | Accepted | Accepted | 22.05 | m,n=list(map(int,input().split()))
dt=[]
for i in range(n):
p,y = list(map(int, input().split()))
dt+=[[i,p,y,0]]
dt.sort(key=lambda x:(x[1],x[2]))
pi=1
prep=0
for x in dt:
if prep==x[1]:
pi+=1
else:
pi=1
x[3]=pi
prep=x[1]
dt.sort()
for x in dt:
print((str(x[... | import sys
input=sys.stdin.readline
m,n=list(map(int,input().split()))
dt=[]
for i in range(n):
p,y = list(map(int, input().split()))
dt+=[[i,p,y,0]]
dt.sort(key=lambda x:(x[1],x[2]))
pi=1
prep=0
for x in dt:
if prep==x[1]:
pi+=1
else:
pi=1
x[3]=pi
prep=x[1]
dt... | 18 | 21 | 339 | 379 | m, n = list(map(int, input().split()))
dt = []
for i in range(n):
p, y = list(map(int, input().split()))
dt += [[i, p, y, 0]]
dt.sort(key=lambda x: (x[1], x[2]))
pi = 1
prep = 0
for x in dt:
if prep == x[1]:
pi += 1
else:
pi = 1
x[3] = pi
prep = x[1]
dt.sort()
for x in dt:
pr... | import sys
input = sys.stdin.readline
m, n = list(map(int, input().split()))
dt = []
for i in range(n):
p, y = list(map(int, input().split()))
dt += [[i, p, y, 0]]
dt.sort(key=lambda x: (x[1], x[2]))
pi = 1
prep = 0
for x in dt:
if prep == x[1]:
pi += 1
else:
pi = 1
x[3] = pi
pr... | false | 14.285714 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.043337 | 0.00853 | 5.080348 | [
"s523023062",
"s904712522"
] |
u761529120 | p02725 | python | s576313104 | s037749220 | 285 | 256 | 78,728 | 80,684 | Accepted | Accepted | 10.18 | def main():
K, N = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = float('inf')
for i in range(N):
if A[i] > A[i-1]:
tmp = (K + A[i-1]) - A[i]
else:
tmp = A[i-1] - A[i]
ans = min(ans, tmp)
for i in range(N):
... | def main():
K, N = list(map(int, input().split()))
A = list(map(int, input().split()))
B = [0] * (2 * N)
for i in range(2*N):
if i < N:
B[i] = A[i]
else:
B[i] = K + A[i - N]
l = 0
for i in range(N):
tmp = B[i+1] - B[i]
l = m... | 24 | 23 | 509 | 405 | def main():
K, N = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = float("inf")
for i in range(N):
if A[i] > A[i - 1]:
tmp = (K + A[i - 1]) - A[i]
else:
tmp = A[i - 1] - A[i]
ans = min(ans, tmp)
for i in range(N):
if i... | def main():
K, N = list(map(int, input().split()))
A = list(map(int, input().split()))
B = [0] * (2 * N)
for i in range(2 * N):
if i < N:
B[i] = A[i]
else:
B[i] = K + A[i - N]
l = 0
for i in range(N):
tmp = B[i + 1] - B[i]
l = max(l, tmp)
... | false | 4.166667 | [
"- ans = float(\"inf\")",
"+ B = [0] * (2 * N)",
"+ for i in range(2 * N):",
"+ if i < N:",
"+ B[i] = A[i]",
"+ else:",
"+ B[i] = K + A[i - N]",
"+ l = 0",
"- if A[i] > A[i - 1]:",
"- tmp = (K + A[i - 1]) - A[i]",
"- else:"... | false | 0.042064 | 0.037934 | 1.108885 | [
"s576313104",
"s037749220"
] |
u753803401 | p03095 | python | s848492400 | s563071233 | 191 | 174 | 49,392 | 39,280 | Accepted | Accepted | 8.9 | def slove():
import sys
import collections
input = sys.stdin.readline
n = int(input().rstrip('\n'))
a = list(str(input().rstrip('\n')))
a = collections.Counter(a)
cnt = 1
for k, v in list(a.items()):
cnt = (cnt * (v + 1) % (10 ** 9 + 7))
print((cnt - 1))
if __n... | def slove():
import sys
import collections
input = sys.stdin.readline
n = int(input().rstrip('\n'))
s = collections.Counter(str(input().rstrip('\n')))
t = 1
for k, v in list(s.items()):
t = (t * (v + 1)) % (10 ** 9 + 7)
print((t - 1))
if __name__ == '__main__':
... | 15 | 14 | 346 | 321 | def slove():
import sys
import collections
input = sys.stdin.readline
n = int(input().rstrip("\n"))
a = list(str(input().rstrip("\n")))
a = collections.Counter(a)
cnt = 1
for k, v in list(a.items()):
cnt = cnt * (v + 1) % (10**9 + 7)
print((cnt - 1))
if __name__ == "__main... | def slove():
import sys
import collections
input = sys.stdin.readline
n = int(input().rstrip("\n"))
s = collections.Counter(str(input().rstrip("\n")))
t = 1
for k, v in list(s.items()):
t = (t * (v + 1)) % (10**9 + 7)
print((t - 1))
if __name__ == "__main__":
slove()
| false | 6.666667 | [
"- a = list(str(input().rstrip(\"\\n\")))",
"- a = collections.Counter(a)",
"- cnt = 1",
"- for k, v in list(a.items()):",
"- cnt = cnt * (v + 1) % (10**9 + 7)",
"- print((cnt - 1))",
"+ s = collections.Counter(str(input().rstrip(\"\\n\")))",
"+ t = 1",
"+ for k, v in ... | false | 0.04407 | 0.037441 | 1.177066 | [
"s848492400",
"s563071233"
] |
u639989198 | p02913 | python | s343209504 | s019985587 | 273 | 93 | 44,764 | 3,444 | Accepted | Accepted | 65.93 | import random
import string
N = int(eval(input()))
S = eval(input())
l, r = 0, N
def pow_mod(a, b, m):
ab = 1
for _ in range(b):
ab = (ab * a) % m
return ab
def c2n(c):
return ord(c) - 97
def hash(s, B, H):
sh = 0
for c in s:
sh = (sh * B + c2n(c)) % H
return sh
def t(n):
... | N = int(eval(input()))
S = eval(input())
l, r = 0, N
def pow_mod(a, b, m):
ab = 1
for _ in range(b):
ab = (ab * a) % m
return ab
def c2n(c):
return ord(c) - 97
def hash(s, B, H):
sh = 0
for c in s:
sh = (sh * B + c2n(c)) % H
return sh
def t(n):
B, H = 10 ** 8 + 7, 2 ** 64... | 48 | 46 | 809 | 779 | import random
import string
N = int(eval(input()))
S = eval(input())
l, r = 0, N
def pow_mod(a, b, m):
ab = 1
for _ in range(b):
ab = (ab * a) % m
return ab
def c2n(c):
return ord(c) - 97
def hash(s, B, H):
sh = 0
for c in s:
sh = (sh * B + c2n(c)) % H
return sh
def ... | N = int(eval(input()))
S = eval(input())
l, r = 0, N
def pow_mod(a, b, m):
ab = 1
for _ in range(b):
ab = (ab * a) % m
return ab
def c2n(c):
return ord(c) - 97
def hash(s, B, H):
sh = 0
for c in s:
sh = (sh * B + c2n(c)) % H
return sh
def t(n):
B, H = 10**8 + 7, 2... | false | 4.166667 | [
"-import random",
"-import string",
"-"
] | false | 0.046072 | 0.04327 | 1.064759 | [
"s343209504",
"s019985587"
] |
u968166680 | p02862 | python | s252520946 | s776847666 | 233 | 201 | 54,512 | 41,328 | Accepted | Accepted | 13.73 | from sys import stdin, setrecursionlimit
setrecursionlimit(10 ** 9)
INF = 1 << 60
def input():
return stdin.readline().strip()
X, Y = list(map(int, input().split()))
n = (X + Y) // 3
x = (2 * X - Y) // 3
y = (-X + 2 * Y) // 3
if (X + Y) % 3 or x < 0 or y < 0:
print((0))
exit()
MOD ... | from sys import stdin, setrecursionlimit
setrecursionlimit(10 ** 9)
INF = 1 << 60
def input():
return stdin.readline().strip()
MOD = 1000000007
X, Y = list(map(int, input().split()))
n = (X + Y) // 3
x = (2 * X - Y) // 3
y = (-X + 2 * Y) // 3
if (X + Y) % 3 or x < 0 or y < 0:
print((0))
... | 42 | 44 | 822 | 783 | from sys import stdin, setrecursionlimit
setrecursionlimit(10**9)
INF = 1 << 60
def input():
return stdin.readline().strip()
X, Y = list(map(int, input().split()))
n = (X + Y) // 3
x = (2 * X - Y) // 3
y = (-X + 2 * Y) // 3
if (X + Y) % 3 or x < 0 or y < 0:
print((0))
exit()
MOD = 1000000007
COM_MAX = ... | from sys import stdin, setrecursionlimit
setrecursionlimit(10**9)
INF = 1 << 60
def input():
return stdin.readline().strip()
MOD = 1000000007
X, Y = list(map(int, input().split()))
n = (X + Y) // 3
x = (2 * X - Y) // 3
y = (-X + 2 * Y) // 3
if (X + Y) % 3 or x < 0 or y < 0:
print((0))
exit()
def mod_... | false | 4.545455 | [
"+MOD = 1000000007",
"-MOD = 1000000007",
"-COM_MAX = n",
"-fac, finv, inv = [0] * (COM_MAX + 1), [0] * (COM_MAX + 1), [0] * (COM_MAX + 1)",
"-fac[0] = fac[1] = 1",
"-finv[0] = finv[1] = 1",
"-inv[1] = 1",
"-for i in range(2, COM_MAX + 1):",
"- fac[i] = fac[i - 1] * i % MOD",
"- inv[i] = MOD... | false | 0.917338 | 0.104123 | 8.81013 | [
"s252520946",
"s776847666"
] |
u080364835 | p03371 | python | s530654860 | s813338009 | 877 | 28 | 3,060 | 9,172 | Accepted | Accepted | 96.81 | a, b, c, x, y = list(map(int, input().split()))
mi = 10**10
for i in range(10**6):
cost = c*2*i + a*max((x-i), 0) + b*max((y-i), 0)
if cost < mi:
mi = cost
print(mi) | a, b, c, x, y = list(map(int, input().split()))
if x > y:
cost = min(a*x + b*y, x*c*2, y*c*2 + (x-y)*a)
else:
cost = min(a*x + b*y, y*c*2, x*c*2 + (y-x)*b)
print(cost) | 8 | 7 | 183 | 176 | a, b, c, x, y = list(map(int, input().split()))
mi = 10**10
for i in range(10**6):
cost = c * 2 * i + a * max((x - i), 0) + b * max((y - i), 0)
if cost < mi:
mi = cost
print(mi)
| a, b, c, x, y = list(map(int, input().split()))
if x > y:
cost = min(a * x + b * y, x * c * 2, y * c * 2 + (x - y) * a)
else:
cost = min(a * x + b * y, y * c * 2, x * c * 2 + (y - x) * b)
print(cost)
| false | 12.5 | [
"-mi = 10**10",
"-for i in range(10**6):",
"- cost = c * 2 * i + a * max((x - i), 0) + b * max((y - i), 0)",
"- if cost < mi:",
"- mi = cost",
"-print(mi)",
"+if x > y:",
"+ cost = min(a * x + b * y, x * c * 2, y * c * 2 + (x - y) * a)",
"+else:",
"+ cost = min(a * x + b * y, y ... | false | 1.585681 | 0.035604 | 44.537137 | [
"s530654860",
"s813338009"
] |
u994988729 | p04034 | python | s322918567 | s104336833 | 334 | 107 | 4,724 | 11,032 | Accepted | Accepted | 67.96 | n, m = list(map(int, input().split()))
white = [1]*n
white[0] = 0
red = [0] * n
red[0] = 1
for _ in range(m):
x, y = list(map(int, input().split()))
x -= 1
y -= 1
if red[x] > 0:
red[y] += 1
else:
white[y] += 1
if white[x] > 0:
white[x] -= 1
else:
... | import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
N, M = list(map(int, input().split()))
red = [0] * (N + 1)
white = [1] * (N + 1)
red[1] = 1
white[1] = 0
for _ in range(M):
x, y = list(map(int, input().split()))
if red[x]:
red[y] += 1
else:
white[y... | 24 | 22 | 367 | 416 | n, m = list(map(int, input().split()))
white = [1] * n
white[0] = 0
red = [0] * n
red[0] = 1
for _ in range(m):
x, y = list(map(int, input().split()))
x -= 1
y -= 1
if red[x] > 0:
red[y] += 1
else:
white[y] += 1
if white[x] > 0:
white[x] -= 1
else:
red[x] -= 1... | import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
N, M = list(map(int, input().split()))
red = [0] * (N + 1)
white = [1] * (N + 1)
red[1] = 1
white[1] = 0
for _ in range(M):
x, y = list(map(int, input().split()))
if red[x]:
red[y] += 1
else:
white[y] += 1
if whit... | false | 8.333333 | [
"-n, m = list(map(int, input().split()))",
"-white = [1] * n",
"-white[0] = 0",
"-red = [0] * n",
"-red[0] = 1",
"-for _ in range(m):",
"+import sys",
"+",
"+input = sys.stdin.buffer.readline",
"+sys.setrecursionlimit(10**7)",
"+N, M = list(map(int, input().split()))",
"+red = [0] * (N + 1)",
... | false | 0.046119 | 0.064613 | 0.713767 | [
"s322918567",
"s104336833"
] |
u318127926 | p02852 | python | s242537607 | s953988018 | 129 | 108 | 6,372 | 11,396 | Accepted | Accepted | 16.28 | import sys
n, m = list(map(int, input().split()))
s = eval(input())
p = n
hist = []
while p>0:
for i in range(max(0,p-m), p):
if s[i]=='0':
hist.append(p-i)
p = i
break
else:
print((-1))
sys.exit()
print((*hist[::-1])) | n, m = list(map(int, input().split()))
s = input()[::-1]
ans = []
now = 0
while now<n:
for i in range(min(m, n-now), 0, -1):
if s[now+i]=='0':
now += i
ans.append(i)
break
else:
print((-1))
exit(0)
print((*ans[::-1])) | 15 | 14 | 250 | 288 | import sys
n, m = list(map(int, input().split()))
s = eval(input())
p = n
hist = []
while p > 0:
for i in range(max(0, p - m), p):
if s[i] == "0":
hist.append(p - i)
p = i
break
else:
print((-1))
sys.exit()
print((*hist[::-1]))
| n, m = list(map(int, input().split()))
s = input()[::-1]
ans = []
now = 0
while now < n:
for i in range(min(m, n - now), 0, -1):
if s[now + i] == "0":
now += i
ans.append(i)
break
else:
print((-1))
exit(0)
print((*ans[::-1]))
| false | 6.666667 | [
"-import sys",
"-",
"-s = eval(input())",
"-p = n",
"-hist = []",
"-while p > 0:",
"- for i in range(max(0, p - m), p):",
"- if s[i] == \"0\":",
"- hist.append(p - i)",
"- p = i",
"+s = input()[::-1]",
"+ans = []",
"+now = 0",
"+while now < n:",
"+ for ... | false | 0.102087 | 0.128482 | 0.794558 | [
"s242537607",
"s953988018"
] |
u408260374 | p01486 | python | s576539998 | s421414583 | 1,400 | 490 | 9,368 | 9,428 | Accepted | Accepted | 65 | S = eval(input())
L = len(S)
dp = [[False] * (L + 1) for _ in range(L + 1)]
# [left, right)
for i in range(L + 1):
dp[i][i] = True
for w in range(3, L + 1):
for left in range(L - w + 1):
right = left + w
if S[left] != 'm' or S[right - 1] != 'w':
continue
for mi... | S = eval(input())
L = len(S)
dp = [[False] * (L + 1) for _ in range(L + 1)]
# [left, right)
for i in range(L + 1):
dp[i][i] = True
for w in range(3, L + 1, 3):
for left in range(L - w + 1):
right = left + w
if S[left] != 'm' or S[right - 1] != 'w':
continue
for... | 18 | 18 | 525 | 528 | S = eval(input())
L = len(S)
dp = [[False] * (L + 1) for _ in range(L + 1)]
# [left, right)
for i in range(L + 1):
dp[i][i] = True
for w in range(3, L + 1):
for left in range(L - w + 1):
right = left + w
if S[left] != "m" or S[right - 1] != "w":
continue
for mid in range(left... | S = eval(input())
L = len(S)
dp = [[False] * (L + 1) for _ in range(L + 1)]
# [left, right)
for i in range(L + 1):
dp[i][i] = True
for w in range(3, L + 1, 3):
for left in range(L - w + 1):
right = left + w
if S[left] != "m" or S[right - 1] != "w":
continue
for mid in range(l... | false | 0 | [
"-for w in range(3, L + 1):",
"+for w in range(3, L + 1, 3):"
] | false | 0.108776 | 0.044206 | 2.460656 | [
"s576539998",
"s421414583"
] |
u094191970 | p03325 | python | s650985371 | s913524371 | 88 | 69 | 4,148 | 10,064 | Accepted | Accepted | 21.59 | n=int(eval(input()))
a=list(map(int,input().split()))
ans=0
for i in a:
while i%2==0:
i//=2
ans+=1
print(ans) | n=int(eval(input()))
a=list(map(int,input().split()))
ans=0
for i in a:
while i%2==0:
ans+=1
i//=2
print(ans) | 10 | 9 | 124 | 122 | n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in a:
while i % 2 == 0:
i //= 2
ans += 1
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in a:
while i % 2 == 0:
ans += 1
i //= 2
print(ans)
| false | 10 | [
"+ ans += 1",
"- ans += 1"
] | false | 0.036878 | 0.068877 | 0.535419 | [
"s650985371",
"s913524371"
] |
u037430802 | p02990 | python | s795646587 | s124755141 | 1,770 | 548 | 3,444 | 3,944 | Accepted | Accepted | 69.04 | N, K = list(map(int, input().split()))
def nCr(n,r):
if n < 0 or r < 0 or n < r: return 0
if n - r < r: r = n - r
if r == 0: return 1
if r == 1: return n
# 分子のn*(n-1)*...がr個分続くやつ
numerator = [n-r+k+1 for k in range(r)]
# 分母:r!=r*(r-1)*...*3*2の要素
denominator = [k+1 for k in range(r)]
... | from operator import mul
from functools import reduce
def nCr(n,r):
r = min(n-r,r)
if r == 0: return 1
# reduceは第一引数で与えた関数を第二引数のiterbleのそれぞれで実行した結果をもどす
over = reduce(mul, list(range(n, n - r, -1)), 1)
under = reduce(mul, list(range(1,r + 1)), 1)
return over // under
MOD = 10**... | 41 | 24 | 1,033 | 499 | N, K = list(map(int, input().split()))
def nCr(n, r):
if n < 0 or r < 0 or n < r:
return 0
if n - r < r:
r = n - r
if r == 0:
return 1
if r == 1:
return n
# 分子のn*(n-1)*...がr個分続くやつ
numerator = [n - r + k + 1 for k in range(r)]
# 分母:r!=r*(r-1)*...*3*2の要素
d... | from operator import mul
from functools import reduce
def nCr(n, r):
r = min(n - r, r)
if r == 0:
return 1
# reduceは第一引数で与えた関数を第二引数のiterbleのそれぞれで実行した結果をもどす
over = reduce(mul, list(range(n, n - r, -1)), 1)
under = reduce(mul, list(range(1, r + 1)), 1)
return over // under
MOD = 10**9 ... | false | 41.463415 | [
"-N, K = list(map(int, input().split()))",
"+from operator import mul",
"+from functools import reduce",
"- if n < 0 or r < 0 or n < r:",
"- return 0",
"- if n - r < r:",
"- r = n - r",
"+ r = min(n - r, r)",
"- if r == 1:",
"- return n",
"- # 分子のn*(n-1)*...がr... | false | 0.045487 | 0.038192 | 1.190997 | [
"s795646587",
"s124755141"
] |
u318127926 | p02972 | python | s378388588 | s961606134 | 604 | 549 | 13,112 | 14,080 | Accepted | Accepted | 9.11 | n = int(eval(input()))
a = list(map(int, input().split()))
b = [None]*n
for i in range(n, 0, -1):
s = 0
for j in range(2*i, n+1, i):
s += b[j-1]
b[i-1] = a[i-1]^(s%2)
print((sum(b)))
print((*[ind+1 for ind, i in enumerate(b) if i]))
| n = int(eval(input()))
a = list(map(int, input().split()))
balls = [0]*(n+1)
ans = []
for ind, i in enumerate(reversed(a)):
ind = n-ind
tmp = i
for j in range(ind*2, n+1, ind):
tmp += balls[j]
balls[ind] = tmp%2
if tmp%2==1:
ans.append(ind)
print((len(ans)))
print((*an... | 10 | 15 | 252 | 313 | n = int(eval(input()))
a = list(map(int, input().split()))
b = [None] * n
for i in range(n, 0, -1):
s = 0
for j in range(2 * i, n + 1, i):
s += b[j - 1]
b[i - 1] = a[i - 1] ^ (s % 2)
print((sum(b)))
print((*[ind + 1 for ind, i in enumerate(b) if i]))
| n = int(eval(input()))
a = list(map(int, input().split()))
balls = [0] * (n + 1)
ans = []
for ind, i in enumerate(reversed(a)):
ind = n - ind
tmp = i
for j in range(ind * 2, n + 1, ind):
tmp += balls[j]
balls[ind] = tmp % 2
if tmp % 2 == 1:
ans.append(ind)
print((len(ans)))
print((*a... | false | 33.333333 | [
"-b = [None] * n",
"-for i in range(n, 0, -1):",
"- s = 0",
"- for j in range(2 * i, n + 1, i):",
"- s += b[j - 1]",
"- b[i - 1] = a[i - 1] ^ (s % 2)",
"-print((sum(b)))",
"-print((*[ind + 1 for ind, i in enumerate(b) if i]))",
"+balls = [0] * (n + 1)",
"+ans = []",
"+for ind, i ... | false | 0.040524 | 0.043621 | 0.929009 | [
"s378388588",
"s961606134"
] |
u912237403 | p02406 | python | s288322500 | s453599392 | 30 | 20 | 4,516 | 4,200 | Accepted | Accepted | 33.33 | n=int(input())
i=1
SP=[]
while i<=n:
x=i
if x%3==0:
SP.append(str(i))
else:
while x:
if x%10==3:
SP.append(str(i))
break
x/=10
i+=1
print("", " ".join(SP)) | n=int(input())
i=1
print("", end=' ')
while i<=n:
x=i
if x%3==0:
print(i, end=' ')
else:
while x:
if x%10==3:
print(i, end=' ')
break
x/=10
i+=1 | 15 | 14 | 216 | 178 | n = int(input())
i = 1
SP = []
while i <= n:
x = i
if x % 3 == 0:
SP.append(str(i))
else:
while x:
if x % 10 == 3:
SP.append(str(i))
break
x /= 10
i += 1
print("", " ".join(SP))
| n = int(input())
i = 1
print("", end=" ")
while i <= n:
x = i
if x % 3 == 0:
print(i, end=" ")
else:
while x:
if x % 10 == 3:
print(i, end=" ")
break
x /= 10
i += 1
| false | 6.666667 | [
"-SP = []",
"+print(\"\", end=\" \")",
"- SP.append(str(i))",
"+ print(i, end=\" \")",
"- SP.append(str(i))",
"+ print(i, end=\" \")",
"-print(\"\", \" \".join(SP))"
] | false | 0.077599 | 0.076267 | 1.017468 | [
"s288322500",
"s453599392"
] |
u784022244 | p02837 | python | s607948233 | s811607279 | 1,457 | 1,213 | 3,188 | 3,064 | Accepted | Accepted | 16.75 | N=int(eval(input()))
A=[[-1]*N for _ in range(N)]
for i in range(N):
a=int(eval(input()))
for j in range(a):
x,y=list(map(int, input().split()))
A[i][x-1]=y
#正直者が正直者に不親切と言われていない
#→正直ものが不親切を正直者と言っていないか
ans=0
for i in range(2**N):
ok=True
for j in range(N):
if (i>>j&1)==1:
for k ... | N=int(eval(input()))
#正直者も発言に矛盾が生じない
L=[[-1]*N for _ in range(N)]
for i in range(N):
A=int(eval(input()))
for a in range(A):
x,y=list(map(int, input().split()))
L[i][x-1]=y
ans=0
for b in range(2**N):
ok=True
for i in range(N):
if b>>i&1==1:
l=L[i]
... | 22 | 22 | 444 | 474 | N = int(eval(input()))
A = [[-1] * N for _ in range(N)]
for i in range(N):
a = int(eval(input()))
for j in range(a):
x, y = list(map(int, input().split()))
A[i][x - 1] = y
# 正直者が正直者に不親切と言われていない
# →正直ものが不親切を正直者と言っていないか
ans = 0
for i in range(2**N):
ok = True
for j in range(N):
if ... | N = int(eval(input()))
# 正直者も発言に矛盾が生じない
L = [[-1] * N for _ in range(N)]
for i in range(N):
A = int(eval(input()))
for a in range(A):
x, y = list(map(int, input().split()))
L[i][x - 1] = y
ans = 0
for b in range(2**N):
ok = True
for i in range(N):
if b >> i & 1 == 1:
... | false | 0 | [
"-A = [[-1] * N for _ in range(N)]",
"+# 正直者も発言に矛盾が生じない",
"+L = [[-1] * N for _ in range(N)]",
"- a = int(eval(input()))",
"- for j in range(a):",
"+ A = int(eval(input()))",
"+ for a in range(A):",
"- A[i][x - 1] = y",
"-# 正直者が正直者に不親切と言われていない",
"-# →正直ものが不親切を正直者と言っていないか",
"+ ... | false | 0.104167 | 0.040465 | 2.574257 | [
"s607948233",
"s811607279"
] |
u319245933 | p04019 | python | s641969502 | s300739339 | 32 | 27 | 9,376 | 9,132 | Accepted | Accepted | 15.62 | import collections
S = eval(input())
c = collections.Counter(S)
K = list(c.keys())
if len(K) == 4:
print('Yes')
elif len(K) == 2:
if 'N' in K and 'S' in K:
print('Yes')
elif 'W' in K and 'E' in K:
print('Yes')
else:
print('No')
else:
print('No') | *S, = eval(input())
flag_x = False
flag_y = False
if 'S' in S and 'N' in S:
flag_y = True
if 'S' not in S and 'N' not in S:
flag_y = True
if 'E' in S and 'W' in S:
flag_x = True
if 'E' not in S and 'W' not in S:
flag_x = True
if flag_x and flag_y:
print('Yes')
else:
print('... | 18 | 19 | 297 | 318 | import collections
S = eval(input())
c = collections.Counter(S)
K = list(c.keys())
if len(K) == 4:
print("Yes")
elif len(K) == 2:
if "N" in K and "S" in K:
print("Yes")
elif "W" in K and "E" in K:
print("Yes")
else:
print("No")
else:
print("No")
| (*S,) = eval(input())
flag_x = False
flag_y = False
if "S" in S and "N" in S:
flag_y = True
if "S" not in S and "N" not in S:
flag_y = True
if "E" in S and "W" in S:
flag_x = True
if "E" not in S and "W" not in S:
flag_x = True
if flag_x and flag_y:
print("Yes")
else:
print("No")
| false | 5.263158 | [
"-import collections",
"-",
"-S = eval(input())",
"-c = collections.Counter(S)",
"-K = list(c.keys())",
"-if len(K) == 4:",
"+(*S,) = eval(input())",
"+flag_x = False",
"+flag_y = False",
"+if \"S\" in S and \"N\" in S:",
"+ flag_y = True",
"+if \"S\" not in S and \"N\" not in S:",
"+ ... | false | 0.054903 | 0.036053 | 1.522839 | [
"s641969502",
"s300739339"
] |
u556589653 | p03835 | python | s452465547 | s586235838 | 1,546 | 1,268 | 2,940 | 2,940 | Accepted | Accepted | 17.98 | K,S = list(map(int,input().split()))
ans = 0
for i in range(K+1):
for j in range(K+1):
z = S-i-j
if 0<=z<=K:
ans += 1
print(ans)
| K,S = list(map(int,input().split()))
ans = 0
for i in range(K+1):
for j in range(K+1):
if 0<=S-i-j<=K:
ans += 1
print(ans) | 8 | 7 | 162 | 146 | K, S = list(map(int, input().split()))
ans = 0
for i in range(K + 1):
for j in range(K + 1):
z = S - i - j
if 0 <= z <= K:
ans += 1
print(ans)
| K, S = list(map(int, input().split()))
ans = 0
for i in range(K + 1):
for j in range(K + 1):
if 0 <= S - i - j <= K:
ans += 1
print(ans)
| false | 12.5 | [
"- z = S - i - j",
"- if 0 <= z <= K:",
"+ if 0 <= S - i - j <= K:"
] | false | 0.051708 | 0.00701 | 7.376456 | [
"s452465547",
"s586235838"
] |
u991567869 | p02887 | python | s828217493 | s925579793 | 407 | 42 | 4,084 | 3,316 | Accepted | Accepted | 89.68 | n = int(eval(input()))
s = eval(input())
l = []
for i in range(n):
l.append(s[i])
for i in range(n - 1, 0, -1):
if l[i] == l[i - 1]:
del l[i]
print((len(l))) | n = int(eval(input()))
s = eval(input())
ans = 1
for i in range(n - 1):
if s[i] != s[i + 1]:
ans += 1
print(ans) | 11 | 9 | 171 | 122 | n = int(eval(input()))
s = eval(input())
l = []
for i in range(n):
l.append(s[i])
for i in range(n - 1, 0, -1):
if l[i] == l[i - 1]:
del l[i]
print((len(l)))
| n = int(eval(input()))
s = eval(input())
ans = 1
for i in range(n - 1):
if s[i] != s[i + 1]:
ans += 1
print(ans)
| false | 18.181818 | [
"-l = []",
"-for i in range(n):",
"- l.append(s[i])",
"-for i in range(n - 1, 0, -1):",
"- if l[i] == l[i - 1]:",
"- del l[i]",
"-print((len(l)))",
"+ans = 1",
"+for i in range(n - 1):",
"+ if s[i] != s[i + 1]:",
"+ ans += 1",
"+print(ans)"
] | false | 0.042762 | 0.04294 | 0.995849 | [
"s828217493",
"s925579793"
] |
u691018832 | p02641 | python | s108502866 | s709628204 | 61 | 21 | 61,896 | 9,196 | Accepted | Accepted | 65.57 | def main():
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
x, n = list(map(int, readline().split()))
p = list(map(int, readline().split()))
check = float('inf')
ans = 0
... | def main():
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
x, n = list(map(int, readline().split()))
p = list(map(int, readline().split()))
check = float('inf')
ans = 0
... | 21 | 21 | 518 | 517 | def main():
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
x, n = list(map(int, readline().split()))
p = list(map(int, readline().split()))
check = float("inf")
ans = 0
for i in ran... | def main():
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
x, n = list(map(int, readline().split()))
p = list(map(int, readline().split()))
check = float("inf")
ans = 0
for i in ran... | false | 0 | [
"- for i in range(1000):",
"+ for i in range(102):"
] | false | 0.037988 | 0.126537 | 0.300209 | [
"s108502866",
"s709628204"
] |
u546285759 | p00003 | python | s736528712 | s840753801 | 50 | 40 | 7,600 | 7,604 | Accepted | Accepted | 20 | N = int(eval(input()))
for _ in range(N):
a, b, c = sorted(list(map(int, input().split())))
print(("YES" if a*a + b*b == c*c else "NO")) | N = int(eval(input()))
for _ in range(N):
a, b, c = sorted(map(int, input().split()))
print(("YES" if a*a + b*b == c*c else "NO")) | 4 | 4 | 139 | 133 | N = int(eval(input()))
for _ in range(N):
a, b, c = sorted(list(map(int, input().split())))
print(("YES" if a * a + b * b == c * c else "NO"))
| N = int(eval(input()))
for _ in range(N):
a, b, c = sorted(map(int, input().split()))
print(("YES" if a * a + b * b == c * c else "NO"))
| false | 0 | [
"- a, b, c = sorted(list(map(int, input().split())))",
"+ a, b, c = sorted(map(int, input().split()))"
] | false | 0.114343 | 0.105182 | 1.087094 | [
"s736528712",
"s840753801"
] |
u488401358 | p03562 | python | s377586903 | s299818393 | 778 | 550 | 85,808 | 85,416 | Accepted | Accepted | 29.31 | import random
mod=998244353
N,X=input().split()
N=int(N)
A=[]
for i in range(N):
A.append(int(eval(input()),2))
A.sort()
a=A[-1]
M=max(len(X)-1,a.bit_length()-1)
base=[]
n=a.bit_length()-1
for i in range(M-n,-1,-1):
base.append(a<<i)
for i in range(0,N-1):
a=A[i]
for j in range(M):... | import random
mod=998244353
N,X=input().split()
N=int(N)
A=[]
for i in range(N):
A.append(int(eval(input()),2))
A.sort()
a=A[-1]
M=max(len(X)-1,a.bit_length()-1)
data=[0]*(M+1)
n=a.bit_length()-1
for i in range(M-n,-1,-1):
data[i+n]=a<<i
for i in range(0,N-1):
a=A[i]
flag=True
... | 70 | 78 | 1,270 | 1,565 | import random
mod = 998244353
N, X = input().split()
N = int(N)
A = []
for i in range(N):
A.append(int(eval(input()), 2))
A.sort()
a = A[-1]
M = max(len(X) - 1, a.bit_length() - 1)
base = []
n = a.bit_length() - 1
for i in range(M - n, -1, -1):
base.append(a << i)
for i in range(0, N - 1):
a = A[i]
for... | import random
mod = 998244353
N, X = input().split()
N = int(N)
A = []
for i in range(N):
A.append(int(eval(input()), 2))
A.sort()
a = A[-1]
M = max(len(X) - 1, a.bit_length() - 1)
data = [0] * (M + 1)
n = a.bit_length() - 1
for i in range(M - n, -1, -1):
data[i + n] = a << i
for i in range(0, N - 1):
a = ... | false | 10.25641 | [
"-base = []",
"+data = [0] * (M + 1)",
"- base.append(a << i)",
"+ data[i + n] = a << i",
"- for j in range(M):",
"- for b in base:",
"- a = min(a, a ^ b)",
"- if a == 0:",
"+ flag = True",
"+ while flag:",
"+ n = a.bit_length()",
"+ for j ... | false | 0.034973 | 0.035169 | 0.994427 | [
"s377586903",
"s299818393"
] |
u163703551 | p03814 | python | s910874121 | s517343846 | 49 | 17 | 3,512 | 3,512 | Accepted | Accepted | 65.31 | s = eval(input())
n = len(s)
res = 0
for i in range(0, n):
if s[i] == "A":
j = i
break
for i in range(0, n):
if s[i] == "Z":
k = i
res = k - j + 1
print(res) | s = eval(input())
res = s.rfind('Z') - s.find('A') + 1
print(res)
| 14 | 3 | 198 | 62 | s = eval(input())
n = len(s)
res = 0
for i in range(0, n):
if s[i] == "A":
j = i
break
for i in range(0, n):
if s[i] == "Z":
k = i
res = k - j + 1
print(res)
| s = eval(input())
res = s.rfind("Z") - s.find("A") + 1
print(res)
| false | 78.571429 | [
"-n = len(s)",
"-res = 0",
"-for i in range(0, n):",
"- if s[i] == \"A\":",
"- j = i",
"- break",
"-for i in range(0, n):",
"- if s[i] == \"Z\":",
"- k = i",
"-res = k - j + 1",
"+res = s.rfind(\"Z\") - s.find(\"A\") + 1"
] | false | 0.035931 | 0.058703 | 0.612076 | [
"s910874121",
"s517343846"
] |
u780962115 | p02973 | python | s006523772 | s373205638 | 561 | 230 | 50,392 | 7,840 | Accepted | Accepted | 59 | #LIS
n=int(eval(input()))
lists=[0]*n
for i in range(n):
lists[i]=int(eval(input()))
import bisect
counter=0
lislist=[lists[-1]]
for i in range(2,n+1):
a=lists[-i]
index=bisect.bisect_right(lislist,a)
if index<len(lislist):
lislist[index]=a
elif index==len(lislist):
l... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# sequence decomposing
import bisect
n = int(eval(input()))
lists = [int(eval(input())) for _ in range(n)]
lists = lists[::-1]
dataset = []
dataset.append(lists[0])
# datasetは単調増加なリストの値
for i in range(1, n):
x = lists[i]
if x >= dataset[-1]:
dat... | 18 | 18 | 348 | 447 | # LIS
n = int(eval(input()))
lists = [0] * n
for i in range(n):
lists[i] = int(eval(input()))
import bisect
counter = 0
lislist = [lists[-1]]
for i in range(2, n + 1):
a = lists[-i]
index = bisect.bisect_right(lislist, a)
if index < len(lislist):
lislist[index] = a
elif index == len(lislist... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# sequence decomposing
import bisect
n = int(eval(input()))
lists = [int(eval(input())) for _ in range(n)]
lists = lists[::-1]
dataset = []
dataset.append(lists[0])
# datasetは単調増加なリストの値
for i in range(1, n):
x = lists[i]
if x >= dataset[-1]:
dataset.append(... | false | 0 | [
"-# LIS",
"-n = int(eval(input()))",
"-lists = [0] * n",
"-for i in range(n):",
"- lists[i] = int(eval(input()))",
"+#!/usr/bin/env python",
"+# -*- coding: utf-8 -*-",
"+# sequence decomposing",
"-counter = 0",
"-lislist = [lists[-1]]",
"-for i in range(2, n + 1):",
"- a = lists[-i]",
... | false | 0.067321 | 0.045814 | 1.469436 | [
"s006523772",
"s373205638"
] |
u562935282 | p03135 | python | s302619462 | s057664880 | 24 | 17 | 3,316 | 2,940 | Accepted | Accepted | 29.17 | t, x = list(map(int, input().split()))
print((t / x))
| T, X = list(map(int, input().split()))
print((T / X))
| 2 | 2 | 47 | 47 | t, x = list(map(int, input().split()))
print((t / x))
| T, X = list(map(int, input().split()))
print((T / X))
| false | 0 | [
"-t, x = list(map(int, input().split()))",
"-print((t / x))",
"+T, X = list(map(int, input().split()))",
"+print((T / X))"
] | false | 0.036277 | 0.04185 | 0.866841 | [
"s302619462",
"s057664880"
] |
u867826040 | p02970 | python | s736893604 | s483726758 | 36 | 17 | 5,332 | 2,940 | Accepted | Accepted | 52.78 | from decimal import Decimal,ROUND_HALF_UP
n,d = list(map(int,input().split()))
x = (n+d*2)//(d*2+1)
print(x) | n,d = list(map(int,input().split()))
x = (n+d*2)//(d*2+1)
print(x) | 4 | 3 | 105 | 62 | from decimal import Decimal, ROUND_HALF_UP
n, d = list(map(int, input().split()))
x = (n + d * 2) // (d * 2 + 1)
print(x)
| n, d = list(map(int, input().split()))
x = (n + d * 2) // (d * 2 + 1)
print(x)
| false | 25 | [
"-from decimal import Decimal, ROUND_HALF_UP",
"-"
] | false | 0.046169 | 0.045507 | 1.014543 | [
"s736893604",
"s483726758"
] |
u133936772 | p03221 | python | s889007389 | s731883258 | 966 | 492 | 58,700 | 43,828 | Accepted | Accepted | 49.07 | import sys
input = sys.stdin.readline
f = lambda:list(map(int,input().split()))
n,m = f()
llm = []
lln = [[] for _ in range(n)]
ll = []
for i in range(m):
p,y = f()
llm.append([i,p,y])
lln[p-1].append([y,i])
for j in range(n):
lln[j].sort()
for k in range(len(lln[j])):
ll.append([lln[j][k][1... | import sys
input = sys.stdin.readline
f = lambda:list(map(int,input().split()))
n,m = f()
ll = [list(f()) for _ in range(m)]
l = [0]*n
d = {}
for p,y in sorted(ll,key=lambda k:k[1]):
l[p-1] += 1
d[y] = str(p).zfill(6)+str(l[p-1]).zfill(6)
for l in ll:
print((d[l[1]])) | 18 | 12 | 412 | 277 | import sys
input = sys.stdin.readline
f = lambda: list(map(int, input().split()))
n, m = f()
llm = []
lln = [[] for _ in range(n)]
ll = []
for i in range(m):
p, y = f()
llm.append([i, p, y])
lln[p - 1].append([y, i])
for j in range(n):
lln[j].sort()
for k in range(len(lln[j])):
ll.append([l... | import sys
input = sys.stdin.readline
f = lambda: list(map(int, input().split()))
n, m = f()
ll = [list(f()) for _ in range(m)]
l = [0] * n
d = {}
for p, y in sorted(ll, key=lambda k: k[1]):
l[p - 1] += 1
d[y] = str(p).zfill(6) + str(l[p - 1]).zfill(6)
for l in ll:
print((d[l[1]]))
| false | 33.333333 | [
"-llm = []",
"-lln = [[] for _ in range(n)]",
"-ll = []",
"-for i in range(m):",
"- p, y = f()",
"- llm.append([i, p, y])",
"- lln[p - 1].append([y, i])",
"-for j in range(n):",
"- lln[j].sort()",
"- for k in range(len(lln[j])):",
"- ll.append([lln[j][k][1], j + 1, k + 1])"... | false | 0.035809 | 0.034069 | 1.051082 | [
"s889007389",
"s731883258"
] |
u942982291 | p01811 | python | s376815858 | s114258485 | 90 | 30 | 6,484 | 6,480 | Accepted | Accepted | 66.67 | #!/usr/bin/python
if __name__ == "__main__":
S = input()
c = ['A','B','C']
while True:
if len(S) <= 3:
print("Yes" if S == "ABC" else "No")
break
T = S.strip().split("ABC")
if len(T) == 1:
print("No")
break
P = ''.join(T)
cnt = 0
for x in c:
if x in P:
cnt... | #!/usr/bin/python
if __name__ == "__main__":
S = input()
c = ['A','B','C']
while True:
if len(S) <= 3:
print("Yes" if S == "ABC" else "No")
break
T = S.strip().split("ABC")
P = ''.join(T)
cnt = 0
for x in c:
if x in P:
cnt += 1
else:
S = x.join(T)
i... | 27 | 24 | 401 | 374 | #!/usr/bin/python
if __name__ == "__main__":
S = input()
c = ["A", "B", "C"]
while True:
if len(S) <= 3:
print("Yes" if S == "ABC" else "No")
break
T = S.strip().split("ABC")
if len(T) == 1:
print("No")
break
P = "".join(T)
... | #!/usr/bin/python
if __name__ == "__main__":
S = input()
c = ["A", "B", "C"]
while True:
if len(S) <= 3:
print("Yes" if S == "ABC" else "No")
break
T = S.strip().split("ABC")
P = "".join(T)
cnt = 0
for x in c:
if x in P:
... | false | 11.111111 | [
"- if len(T) == 1:",
"- print(\"No\")",
"- break",
"- if cnt != 2:",
"+ if len(T) == 1 or cnt != 2:"
] | false | 0.037159 | 0.007126 | 5.214279 | [
"s376815858",
"s114258485"
] |
u204842730 | p03160 | python | s577615582 | s110424551 | 170 | 127 | 13,980 | 13,980 | Accepted | Accepted | 25.29 | n=int(eval(input()))
h=list(map(int,input().split()))
dp = [float("inf")]*n #最小値求めるのでinfで初期化
dp[0]=0
for i in range(1,n):
dp[i]=min(dp[i],dp[i-1]+abs(h[i]-h[i-1]))
if i-2>=0:
dp[i]=min(dp[i],dp[i-2]+abs(h[i]-h[i-2]))
print((dp[-1])) | n=int(eval(input()))
h=list(map(int,input().split()))
dp = [float("inf")]*n #最小値求めるのでinfで初期化
dp[0]=0
dp[1]=abs(h[1]-h[0])
for i in range(2,n):
dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
print((dp[-1])) | 11 | 9 | 252 | 224 | n = int(eval(input()))
h = list(map(int, input().split()))
dp = [float("inf")] * n # 最小値求めるのでinfで初期化
dp[0] = 0
for i in range(1, n):
dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))
if i - 2 >= 0:
dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[-1]))
| n = int(eval(input()))
h = list(map(int, input().split()))
dp = [float("inf")] * n # 最小値求めるのでinfで初期化
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, n):
dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[-1]))
| false | 18.181818 | [
"-for i in range(1, n):",
"- dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))",
"- if i - 2 >= 0:",
"- dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]))",
"+dp[1] = abs(h[1] - h[0])",
"+for i in range(2, n):",
"+ dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] -... | false | 0.054144 | 0.088818 | 0.609609 | [
"s577615582",
"s110424551"
] |
u136090046 | p03487 | python | s193284163 | s784794357 | 182 | 98 | 18,676 | 18,676 | Accepted | Accepted | 46.15 | import collections
num = int(eval(input()))
val = [int(x) for x in input().split()]
cnt = collections.Counter(val)
res = 0
for x in cnt:
if cnt[x] > x:
res += cnt[x] - x
elif cnt[x] < x:
res += cnt[x]
print(res) | import collections
n = int(eval(input()))
array = [int(x) for x in input().split()]
_dict = collections.Counter(array)
res = 0
for i, j in list(_dict.items()):
if i != j:
if i > j:
res += j
else:
res += abs(i-j)
print(res) | 14 | 14 | 245 | 269 | import collections
num = int(eval(input()))
val = [int(x) for x in input().split()]
cnt = collections.Counter(val)
res = 0
for x in cnt:
if cnt[x] > x:
res += cnt[x] - x
elif cnt[x] < x:
res += cnt[x]
print(res)
| import collections
n = int(eval(input()))
array = [int(x) for x in input().split()]
_dict = collections.Counter(array)
res = 0
for i, j in list(_dict.items()):
if i != j:
if i > j:
res += j
else:
res += abs(i - j)
print(res)
| false | 0 | [
"-num = int(eval(input()))",
"-val = [int(x) for x in input().split()]",
"-cnt = collections.Counter(val)",
"+n = int(eval(input()))",
"+array = [int(x) for x in input().split()]",
"+_dict = collections.Counter(array)",
"-for x in cnt:",
"- if cnt[x] > x:",
"- res += cnt[x] - x",
"- e... | false | 0.040279 | 0.038336 | 1.050689 | [
"s193284163",
"s784794357"
] |
u562016607 | p03487 | python | s503324872 | s330426158 | 136 | 101 | 15,688 | 18,164 | Accepted | Accepted | 25.74 | N=int(eval(input()))
a=[0 for i in range(N)]
st=input().split()
for i in range(N):
a[i]=int(st[i])
aa=sorted(a)
count=0
nowp=aa[0]
aa.append(10**9+1)
nowcount=1
for i in range(1,N+1):
if aa[i-1]==aa[i]:
nowcount+=1
else:
nowp=aa[i]
if nowcount<aa[i-1]:
cou... | N=int(eval(input()))
a=[int(i) for i in input().split()]
D=dict()
for i in range(N):
if a[i] in D:
D[a[i]]+=1
else:
D[a[i]]=1
ans=0
for num in D:
if num<=D[num]:
ans+=D[num]-num
else:
ans+=D[num]
print(ans)
| 22 | 15 | 415 | 263 | N = int(eval(input()))
a = [0 for i in range(N)]
st = input().split()
for i in range(N):
a[i] = int(st[i])
aa = sorted(a)
count = 0
nowp = aa[0]
aa.append(10**9 + 1)
nowcount = 1
for i in range(1, N + 1):
if aa[i - 1] == aa[i]:
nowcount += 1
else:
nowp = aa[i]
if nowcount < aa[i - 1]... | N = int(eval(input()))
a = [int(i) for i in input().split()]
D = dict()
for i in range(N):
if a[i] in D:
D[a[i]] += 1
else:
D[a[i]] = 1
ans = 0
for num in D:
if num <= D[num]:
ans += D[num] - num
else:
ans += D[num]
print(ans)
| false | 31.818182 | [
"-a = [0 for i in range(N)]",
"-st = input().split()",
"+a = [int(i) for i in input().split()]",
"+D = dict()",
"- a[i] = int(st[i])",
"-aa = sorted(a)",
"-count = 0",
"-nowp = aa[0]",
"-aa.append(10**9 + 1)",
"-nowcount = 1",
"-for i in range(1, N + 1):",
"- if aa[i - 1] == aa[i]:",
"... | false | 0.042509 | 0.041639 | 1.020903 | [
"s503324872",
"s330426158"
] |
u597374218 | p02993 | python | s474376049 | s042041541 | 29 | 25 | 9,020 | 9,036 | Accepted | Accepted | 13.79 | S = eval(input())
print(("Good" if S[0] != S[1] != S[2] != S[3] else "Bad")) | a, b, c, d = eval(input())
print(("Good" if a != b != c != d else "Bad")) | 2 | 2 | 69 | 66 | S = eval(input())
print(("Good" if S[0] != S[1] != S[2] != S[3] else "Bad"))
| a, b, c, d = eval(input())
print(("Good" if a != b != c != d else "Bad"))
| false | 0 | [
"-S = eval(input())",
"-print((\"Good\" if S[0] != S[1] != S[2] != S[3] else \"Bad\"))",
"+a, b, c, d = eval(input())",
"+print((\"Good\" if a != b != c != d else \"Bad\"))"
] | false | 0.041616 | 0.045433 | 0.915966 | [
"s474376049",
"s042041541"
] |
u968166680 | p03557 | python | s340330086 | s114581002 | 787 | 365 | 38,620 | 36,292 | Accepted | Accepted | 53.62 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def main():
N, *ABC = list(map(int, read().split()))
A = sorted(ABC[:N])
B = sorted(ABC[N : 2 * N])
C = sorted(ABC[2 * N : 3 * N])
ans = 0
... | import sys
from bisect import bisect_left, bisect_right
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def main():
N, *ABC = list(map(int, read().split()))
A = sorted(ABC[:N])
B = ABC[N : 2 * N]
C = sorted... | 45 | 24 | 873 | 483 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
def main():
N, *ABC = list(map(int, read().split()))
A = sorted(ABC[:N])
B = sorted(ABC[N : 2 * N])
C = sorted(ABC[2 * N : 3 * N])
ans = 0
for b in B:
... | import sys
from bisect import bisect_left, bisect_right
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
def main():
N, *ABC = list(map(int, read().split()))
A = sorted(ABC[:N])
B = ABC[N : 2 * N]
C = sorted(ABC[2 * N : 3 *... | false | 46.666667 | [
"+from bisect import bisect_left, bisect_right",
"- B = sorted(ABC[N : 2 * N])",
"+ B = ABC[N : 2 * N]",
"- ans = 0",
"- for b in B:",
"- ok = -1",
"- ng = N",
"- while ng - ok > 1:",
"- mid = (ok + ng) // 2",
"- if A[mid] < b:",
"- ... | false | 0.041015 | 0.040748 | 1.006546 | [
"s340330086",
"s114581002"
] |
u365364616 | p02603 | python | s774817768 | s505736453 | 33 | 29 | 9,100 | 9,000 | Accepted | Accepted | 12.12 | n = int(eval(input()))
a = list(map(int, input().split()))
a_cur = a[0]
m = 1000
s = 0
for i in range(1, n):
a_next = a[i]
if a_cur < a_next:
# buy current and sell next
s = m // a_cur
m += s * (a_next - a_cur)
a_cur = a_next
print(m) | n = int(eval(input()))
a = list(map(int, input().split()))
a_cur = a[0]
m = 1000
s = 0
for i in range(1, n):
a_next = a[i]
if a_cur < a_next:
# buy
s += m // a_cur
m -= m // a_cur * a_cur
else:
# sell
m += s * a_cur
s = 0
a_cur = a_next
... | 15 | 20 | 280 | 339 | n = int(eval(input()))
a = list(map(int, input().split()))
a_cur = a[0]
m = 1000
s = 0
for i in range(1, n):
a_next = a[i]
if a_cur < a_next:
# buy current and sell next
s = m // a_cur
m += s * (a_next - a_cur)
a_cur = a_next
print(m)
| n = int(eval(input()))
a = list(map(int, input().split()))
a_cur = a[0]
m = 1000
s = 0
for i in range(1, n):
a_next = a[i]
if a_cur < a_next:
# buy
s += m // a_cur
m -= m // a_cur * a_cur
else:
# sell
m += s * a_cur
s = 0
a_cur = a_next
m += s * a_cur
prin... | false | 25 | [
"- # buy current and sell next",
"- s = m // a_cur",
"- m += s * (a_next - a_cur)",
"+ # buy",
"+ s += m // a_cur",
"+ m -= m // a_cur * a_cur",
"+ else:",
"+ # sell",
"+ m += s * a_cur",
"+ s = 0",
"+m += s * a_cur"
] | false | 0.064684 | 0.04415 | 1.465102 | [
"s774817768",
"s505736453"
] |
u726285999 | p02726 | python | s352878826 | s416576639 | 1,343 | 1,199 | 210,432 | 3,444 | Accepted | Accepted | 10.72 | import itertools
import collections
N, X, Y = list(map(int, input().split()))
pos = [i for i in range(1,N+1)]
ways = list(itertools.combinations(pos,2))
dist_l = [min(abs(i-j), abs(i - X) + 1 + abs(Y - j)) for i,j in ways]
dic = collections.Counter(dist_l)
for i in range(1,N):
print((dic[i])) | N, X, Y = list(map(int, input().split()))
X -= 1
Y -= 1
dist_l = [0] * N
for i in range(N):
for j in range(i+1,N):
dist_l[min(j-i, abs(i - X) + 1 + abs(Y - j))] += 1
for i in range(1,N):
print((dist_l[i])) | 13 | 11 | 305 | 225 | import itertools
import collections
N, X, Y = list(map(int, input().split()))
pos = [i for i in range(1, N + 1)]
ways = list(itertools.combinations(pos, 2))
dist_l = [min(abs(i - j), abs(i - X) + 1 + abs(Y - j)) for i, j in ways]
dic = collections.Counter(dist_l)
for i in range(1, N):
print((dic[i]))
| N, X, Y = list(map(int, input().split()))
X -= 1
Y -= 1
dist_l = [0] * N
for i in range(N):
for j in range(i + 1, N):
dist_l[min(j - i, abs(i - X) + 1 + abs(Y - j))] += 1
for i in range(1, N):
print((dist_l[i]))
| false | 15.384615 | [
"-import itertools",
"-import collections",
"-",
"-pos = [i for i in range(1, N + 1)]",
"-ways = list(itertools.combinations(pos, 2))",
"-dist_l = [min(abs(i - j), abs(i - X) + 1 + abs(Y - j)) for i, j in ways]",
"-dic = collections.Counter(dist_l)",
"+X -= 1",
"+Y -= 1",
"+dist_l = [0] * N",
"+... | false | 0.043565 | 0.03783 | 1.151618 | [
"s352878826",
"s416576639"
] |
u638456847 | p03027 | python | s821776795 | s926026466 | 1,382 | 1,250 | 127,428 | 116,464 | Accepted | Accepted | 9.55 | MOD = 10**6+3
def main():
# preprocess
fac = [1, 1]
f_inv = [1, 1]
inv = [0, 1]
for i in range(2, MOD+1):
fac.append((fac[-1] * i) % MOD)
inv.append((-inv[MOD % i] * (MOD//i)) % MOD)
f_inv.append((f_inv[-1] * inv[-1]) % MOD)
Q = int(eval(input()))
for... | MOD = 10**6+3
def main():
# preprocess
fac = [1, 1]
for i in range(2, MOD+1):
fac.append((fac[-1] * i) % MOD)
Q = int(eval(input()))
for i in range(Q):
x, d, n = list(map(int, input().split()))
if d == 0:
print((pow(x, n, MOD)))
contin... | 31 | 26 | 707 | 577 | MOD = 10**6 + 3
def main():
# preprocess
fac = [1, 1]
f_inv = [1, 1]
inv = [0, 1]
for i in range(2, MOD + 1):
fac.append((fac[-1] * i) % MOD)
inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
f_inv.append((f_inv[-1] * inv[-1]) % MOD)
Q = int(eval(input()))
for i in ran... | MOD = 10**6 + 3
def main():
# preprocess
fac = [1, 1]
for i in range(2, MOD + 1):
fac.append((fac[-1] * i) % MOD)
Q = int(eval(input()))
for i in range(Q):
x, d, n = list(map(int, input().split()))
if d == 0:
print((pow(x, n, MOD)))
continue
... | false | 16.129032 | [
"- f_inv = [1, 1]",
"- inv = [0, 1]",
"- inv.append((-inv[MOD % i] * (MOD // i)) % MOD)",
"- f_inv.append((f_inv[-1] * inv[-1]) % MOD)",
"- print((pow(d, n, MOD) * fac[xd + (n - 1)] * f_inv[xd - 1] % MOD))",
"+ print(",
"+ (pow(d, n, MOD) * fac[xd + (n - 1)] ... | false | 2.919368 | 0.608477 | 4.797825 | [
"s821776795",
"s926026466"
] |
u945181840 | p02735 | python | s573435974 | s232396542 | 531 | 50 | 3,444 | 3,188 | Accepted | Accepted | 90.58 | import sys
from collections import deque
read = sys.stdin.read
readline = sys.stdin.readline
H, W = list(map(int, readline().split()))
s = tuple(map(str, read().split()))
INF = 10 ** 10
grid = [[INF] * W for _ in range(H)]
start = (0, 0)
queue = deque([start])
grid[0][0] = 0
while queue:
x, y = queu... | import sys
from heapq import heapify, heappush, heappop
read = sys.stdin.read
readline = sys.stdin.readline
H, W = list(map(int, readline().split()))
s = tuple(map(str, read().split()))
INF = 10 ** 10
grid = [[INF] * W for _ in range(H)]
if s[0][0] == '#':
grid[0][0] = 1
else:
grid[0][0] = 0
sta... | 35 | 34 | 975 | 886 | import sys
from collections import deque
read = sys.stdin.read
readline = sys.stdin.readline
H, W = list(map(int, readline().split()))
s = tuple(map(str, read().split()))
INF = 10**10
grid = [[INF] * W for _ in range(H)]
start = (0, 0)
queue = deque([start])
grid[0][0] = 0
while queue:
x, y = queue.pop()
for i... | import sys
from heapq import heapify, heappush, heappop
read = sys.stdin.read
readline = sys.stdin.readline
H, W = list(map(int, readline().split()))
s = tuple(map(str, read().split()))
INF = 10**10
grid = [[INF] * W for _ in range(H)]
if s[0][0] == "#":
grid[0][0] = 1
else:
grid[0][0] = 0
start = (grid[0][0],... | false | 2.857143 | [
"-from collections import deque",
"+from heapq import heapify, heappush, heappop",
"-start = (0, 0)",
"-queue = deque([start])",
"-grid[0][0] = 0",
"-while queue:",
"- x, y = queue.pop()",
"+if s[0][0] == \"#\":",
"+ grid[0][0] = 1",
"+else:",
"+ grid[0][0] = 0",
"+start = (grid[0][0]... | false | 0.099984 | 0.047978 | 2.083946 | [
"s573435974",
"s232396542"
] |
u892882715 | p02713 | python | s075767302 | s791776654 | 1,413 | 608 | 9,176 | 9,184 | Accepted | Accepted | 56.97 | import math
K = int(eval(input()))
total = 0
for a in range(1, K + 1):
for b in range(1, K + 1):
ab = math.gcd(a, b)
for c in range(1, K + 1):
total += math.gcd(ab, c)
print(total) | import math
K = int(eval(input()))
total = 0
for a in range(1, K + 1):
for b in range(1, K + 1):
ab = math.gcd(a, b)
if ab == 1:
total += K
else:
for c in range(1, K + 1):
total += math.gcd(ab, c)
print(total) | 12 | 15 | 220 | 288 | import math
K = int(eval(input()))
total = 0
for a in range(1, K + 1):
for b in range(1, K + 1):
ab = math.gcd(a, b)
for c in range(1, K + 1):
total += math.gcd(ab, c)
print(total)
| import math
K = int(eval(input()))
total = 0
for a in range(1, K + 1):
for b in range(1, K + 1):
ab = math.gcd(a, b)
if ab == 1:
total += K
else:
for c in range(1, K + 1):
total += math.gcd(ab, c)
print(total)
| false | 20 | [
"- for c in range(1, K + 1):",
"- total += math.gcd(ab, c)",
"+ if ab == 1:",
"+ total += K",
"+ else:",
"+ for c in range(1, K + 1):",
"+ total += math.gcd(ab, c)"
] | false | 0.059866 | 0.082574 | 0.725001 | [
"s075767302",
"s791776654"
] |
u197457087 | p02725 | python | s719920990 | s386410561 | 163 | 126 | 26,444 | 32,204 | Accepted | Accepted | 22.7 | k, n = list(map(int, input().split()))
a = list(map(int, input().rstrip().split()))
temp = a[0] + k - a[n-1]
for i in range(n-1):
temp = max(temp, a[i+1] - a[i])
print((k-temp)) | K,N = list(map(int,input().split()))
A = list(map(int,input().split()))
B = []
for i in range(N-1):
temp = A[i+1]-A[i]
B.append(temp)
B.append(K-A[-1]+A[0])
B.sort()
#print(B)
ans = K-B[-1]
print(ans)
| 9 | 11 | 182 | 209 | k, n = list(map(int, input().split()))
a = list(map(int, input().rstrip().split()))
temp = a[0] + k - a[n - 1]
for i in range(n - 1):
temp = max(temp, a[i + 1] - a[i])
print((k - temp))
| K, N = list(map(int, input().split()))
A = list(map(int, input().split()))
B = []
for i in range(N - 1):
temp = A[i + 1] - A[i]
B.append(temp)
B.append(K - A[-1] + A[0])
B.sort()
# print(B)
ans = K - B[-1]
print(ans)
| false | 18.181818 | [
"-k, n = list(map(int, input().split()))",
"-a = list(map(int, input().rstrip().split()))",
"-temp = a[0] + k - a[n - 1]",
"-for i in range(n - 1):",
"- temp = max(temp, a[i + 1] - a[i])",
"-print((k - temp))",
"+K, N = list(map(int, input().split()))",
"+A = list(map(int, input().split()))",
"+B... | false | 0.039915 | 0.044808 | 0.890792 | [
"s719920990",
"s386410561"
] |
u729133443 | p02761 | python | s647006252 | s463759645 | 165 | 18 | 38,356 | 3,060 | Accepted | Accepted | 89.09 | (n,_),*t=[t.split()for t in open(0)]
n=int(n)
for i in range(10**(n-1)-(n<2),10**n):
i=str(i)
for s,c in t:
if i[int(s)-1]!=c:
break
else:
print(i)
break
else:
print((-1)) | (n,_),*z=[t.split()for t in open(0)]
n=int(n)
a=0
for i in range(1000):
t=str(i)
a|=n==-~a*len(t)and all(c==t[int(s)-1]for s,c in z)and-~i
print((a-1)) | 12 | 7 | 206 | 159 | (n, _), *t = [t.split() for t in open(0)]
n = int(n)
for i in range(10 ** (n - 1) - (n < 2), 10**n):
i = str(i)
for s, c in t:
if i[int(s) - 1] != c:
break
else:
print(i)
break
else:
print((-1))
| (n, _), *z = [t.split() for t in open(0)]
n = int(n)
a = 0
for i in range(1000):
t = str(i)
a |= n == -~a * len(t) and all(c == t[int(s) - 1] for s, c in z) and -~i
print((a - 1))
| false | 41.666667 | [
"-(n, _), *t = [t.split() for t in open(0)]",
"+(n, _), *z = [t.split() for t in open(0)]",
"-for i in range(10 ** (n - 1) - (n < 2), 10**n):",
"- i = str(i)",
"- for s, c in t:",
"- if i[int(s) - 1] != c:",
"- break",
"- else:",
"- print(i)",
"- break",
... | false | 0.034887 | 0.036486 | 0.956184 | [
"s647006252",
"s463759645"
] |
u389910364 | p03209 | python | s051629487 | s934843043 | 23 | 20 | 3,700 | 3,188 | Accepted | Accepted | 13.04 | from functools import lru_cache
n, x = map(int, input().split())
sizes = [1]
for i in range(50):
sizes.append(sizes[-1] * 2 + 3)
@lru_cache(maxsize=None)
def count_patti(level, index):
"""
左から index 番目までのパティの数
:param level:
:param index:
:return:
"""
if level == 0:
... | import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353
N, X = list(map(int, sys.stdin.buffer.readline().split()))
sizes = [1]
for _ in range(N):
sizes.append(sizes[-1] ... | 33 | 36 | 952 | 697 | from functools import lru_cache
n, x = map(int, input().split())
sizes = [1]
for i in range(50):
sizes.append(sizes[-1] * 2 + 3)
@lru_cache(maxsize=None)
def count_patti(level, index):
"""
左から index 番目までのパティの数
:param level:
:param index:
:return:
"""
if level == 0:
return 1
... | import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10**9)
INF = float("inf")
IINF = 10**18
MOD = 10**9 + 7
# MOD = 998244353
N, X = list(map(int, sys.stdin.buffer.readline().split()))
sizes = [1]
for _ in range(N):
sizes.append(sizes[-1] * 2 + 3)
patties = [1]
fo... | false | 8.333333 | [
"-from functools import lru_cache",
"+import os",
"+import sys",
"-n, x = map(int, input().split())",
"+if os.getenv(\"LOCAL\"):",
"+ sys.stdin = open(\"_in.txt\", \"r\")",
"+sys.setrecursionlimit(10**9)",
"+INF = float(\"inf\")",
"+IINF = 10**18",
"+MOD = 10**9 + 7",
"+# MOD = 998244353",
... | false | 0.049108 | 0.047842 | 1.026461 | [
"s051629487",
"s934843043"
] |
u038021590 | p03170 | python | s374130184 | s895608808 | 250 | 109 | 44,004 | 74,180 | Accepted | Accepted | 56.4 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
sorted(A)
DP = [-1] * (K+1)
for i in range(K+1):
if i < A[0]:
DP[i] = False
else:
for j in A:
if i - j <= 0:
DP[i] = False
if not DP[i-j]:
DP[i] = True
... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
m = min(A)
DP = [False] * (K+1)
for i in range(m, K+1):
for a in A:
if i - a >= 0 and DP[i-a] == False:
DP[i] = True
break
if DP[-1]:
print('First')
else:
print('Second') | 19 | 15 | 422 | 307 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
sorted(A)
DP = [-1] * (K + 1)
for i in range(K + 1):
if i < A[0]:
DP[i] = False
else:
for j in A:
if i - j <= 0:
DP[i] = False
if not DP[i - j]:
DP[i] = True
... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
m = min(A)
DP = [False] * (K + 1)
for i in range(m, K + 1):
for a in A:
if i - a >= 0 and DP[i - a] == False:
DP[i] = True
break
if DP[-1]:
print("First")
else:
print("Second")
| false | 21.052632 | [
"-sorted(A)",
"-DP = [-1] * (K + 1)",
"-for i in range(K + 1):",
"- if i < A[0]:",
"- DP[i] = False",
"- else:",
"- for j in A:",
"- if i - j <= 0:",
"- DP[i] = False",
"- if not DP[i - j]:",
"- DP[i] = True",
"- ... | false | 0.03771 | 0.075427 | 0.499948 | [
"s374130184",
"s895608808"
] |
u863442865 | p02756 | python | s399754717 | s180672586 | 1,563 | 988 | 4,856 | 4,744 | Accepted | Accepted | 36.79 | def main():
import sys
#input = sys.stdin.readline
sys.setrecursionlimit(10000000)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations
#from itertools import accumulate, product
from bisect import bisect_lef... | def main():
from sys import stdin
#input = sys.stdin.readline
#sys.setrecursionlimit(10000000)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations
#from itertools import accumulate, product
from bisect impor... | 42 | 40 | 1,051 | 1,055 | def main():
import sys
# input = sys.stdin.readline
sys.setrecursionlimit(10000000)
from collections import Counter, deque
# from collections import defaultdict
from itertools import combinations, permutations
# from itertools import accumulate, product
from bisect import bisect_left,... | def main():
from sys import stdin
# input = sys.stdin.readline
# sys.setrecursionlimit(10000000)
from collections import Counter, deque
# from collections import defaultdict
from itertools import combinations, permutations
# from itertools import accumulate, product
from bisect import... | false | 4.761905 | [
"- import sys",
"+ from sys import stdin",
"- sys.setrecursionlimit(10000000)",
"+ # sys.setrecursionlimit(10000000)",
"- q = list(input().split())",
"+ q = stdin.readline()",
"- if q[1] == \"1\" and s:",
"- mae = q[2] + mae",
"- elif q[... | false | 0.039174 | 0.089086 | 0.43973 | [
"s399754717",
"s180672586"
] |
u136090046 | p04045 | python | s595994390 | s900108819 | 208 | 131 | 40,684 | 2,940 | Accepted | Accepted | 37.02 | n, k = list(map(int, input().split()))
d_array = [int(x) for x in input().split()]
for i in range(n, 100000):
flag = True
price = str(i)
for d in d_array:
str_d = str(d)
if str_d in price:
flag = False
else:
if flag:
print(i)
exit... | n, k = list(map(int, input().split()))
d_array = [str(x) for x in input().split()]
price = 0
while True:
flag = True
for s in str(price):
if s in d_array:
flag = False
if price >= n and flag:
print(price)
break
price+=1 | 16 | 12 | 332 | 277 | n, k = list(map(int, input().split()))
d_array = [int(x) for x in input().split()]
for i in range(n, 100000):
flag = True
price = str(i)
for d in d_array:
str_d = str(d)
if str_d in price:
flag = False
else:
if flag:
print(i)
exit()
| n, k = list(map(int, input().split()))
d_array = [str(x) for x in input().split()]
price = 0
while True:
flag = True
for s in str(price):
if s in d_array:
flag = False
if price >= n and flag:
print(price)
break
price += 1
| false | 25 | [
"-d_array = [int(x) for x in input().split()]",
"-for i in range(n, 100000):",
"+d_array = [str(x) for x in input().split()]",
"+price = 0",
"+while True:",
"- price = str(i)",
"- for d in d_array:",
"- str_d = str(d)",
"- if str_d in price:",
"+ for s in str(price):",
"+ ... | false | 0.044544 | 0.040216 | 1.107623 | [
"s595994390",
"s900108819"
] |
u558242240 | p03164 | python | s916538172 | s027447014 | 729 | 258 | 811,312 | 41,580 | Accepted | Accepted | 64.61 | import numpy as np
n, w = list(map(int, input().split()))
wv = [tuple(map(int, input().split())) for _ in range(n)]
INF = 10**9 + 100
MAX_V = 10 ** 6
dp = np.full((n+1, MAX_V), INF, np.int64)
dp[0][0] = 0
for i, (wi, vi) in enumerate(wv):
dp[i+1] = dp[i]
np.minimum(dp[i][vi:], dp[i][:-vi] + wi, o... | n, w = list(map(int, input().split()))
wv = [tuple(map(int, input().split())) for _ in range(n)]
INF = 10**9 + 100
MAX_V = 10**5 + 100
dp = [INF] * (MAX_V + 1)
dp[0] = 0
for wi, vi in wv:
for sum_v in range(MAX_V, vi-1, -1):
dp[sum_v] = min(dp[sum_v - vi] + wi, dp[sum_v])
#print(dp)
ans = 0
f... | 16 | 18 | 380 | 411 | import numpy as np
n, w = list(map(int, input().split()))
wv = [tuple(map(int, input().split())) for _ in range(n)]
INF = 10**9 + 100
MAX_V = 10**6
dp = np.full((n + 1, MAX_V), INF, np.int64)
dp[0][0] = 0
for i, (wi, vi) in enumerate(wv):
dp[i + 1] = dp[i]
np.minimum(dp[i][vi:], dp[i][:-vi] + wi, out=dp[i + 1]... | n, w = list(map(int, input().split()))
wv = [tuple(map(int, input().split())) for _ in range(n)]
INF = 10**9 + 100
MAX_V = 10**5 + 100
dp = [INF] * (MAX_V + 1)
dp[0] = 0
for wi, vi in wv:
for sum_v in range(MAX_V, vi - 1, -1):
dp[sum_v] = min(dp[sum_v - vi] + wi, dp[sum_v])
# print(dp)
ans = 0
for i in rang... | false | 11.111111 | [
"-import numpy as np",
"-",
"-MAX_V = 10**6",
"-dp = np.full((n + 1, MAX_V), INF, np.int64)",
"-dp[0][0] = 0",
"-for i, (wi, vi) in enumerate(wv):",
"- dp[i + 1] = dp[i]",
"- np.minimum(dp[i][vi:], dp[i][:-vi] + wi, out=dp[i + 1][vi:])",
"-ans = np.where(dp[n] <= w)[0][-1]",
"-print(ans)",
... | false | 0.621868 | 0.812385 | 0.765484 | [
"s916538172",
"s027447014"
] |
u709304134 | p02623 | python | s689823263 | s379116544 | 245 | 158 | 47,652 | 130,044 | Accepted | Accepted | 35.51 | import itertools
N,M,K = list(map(int,input().split()))
A = [0]+list(map(int,input().split()))
B = [0]+list(map(int,input().split()))
SA = list(itertools.accumulate(A))
SB = list(itertools.accumulate(B))
ans = 0
pt = len(B)-1
for i,sa in enumerate(SA):
while(pt>=0):
if sa + SB[pt] <= K:
... | import itertools
N,M,K = list(map(int,input().split()))
A = [0]+list(map(int,input().split()))
B = [0]+list(map(int,input().split()))
SA = list(itertools.accumulate(A))
SB = list(itertools.accumulate(B))
ans = 0
j = len(B)-1
for i in range(len(SA)):
while(j>=0):
if SA[i] + SB[j] <= K:
... | 19 | 18 | 392 | 386 | import itertools
N, M, K = list(map(int, input().split()))
A = [0] + list(map(int, input().split()))
B = [0] + list(map(int, input().split()))
SA = list(itertools.accumulate(A))
SB = list(itertools.accumulate(B))
ans = 0
pt = len(B) - 1
for i, sa in enumerate(SA):
while pt >= 0:
if sa + SB[pt] <= K:
... | import itertools
N, M, K = list(map(int, input().split()))
A = [0] + list(map(int, input().split()))
B = [0] + list(map(int, input().split()))
SA = list(itertools.accumulate(A))
SB = list(itertools.accumulate(B))
ans = 0
j = len(B) - 1
for i in range(len(SA)):
while j >= 0:
if SA[i] + SB[j] <= K:
... | false | 5.263158 | [
"-pt = len(B) - 1",
"-for i, sa in enumerate(SA):",
"- while pt >= 0:",
"- if sa + SB[pt] <= K:",
"- ans = max(ans, i + pt)",
"+j = len(B) - 1",
"+for i in range(len(SA)):",
"+ while j >= 0:",
"+ if SA[i] + SB[j] <= K:",
"+ ans = max(ans, i + j)",
"- ... | false | 0.033823 | 0.037371 | 0.905047 | [
"s689823263",
"s379116544"
] |
u761529120 | p03283 | python | s548869085 | s876819637 | 1,758 | 540 | 57,816 | 55,132 | Accepted | Accepted | 69.28 | def main():
N, M, Q = list(map(int, input().split()))
S = [[0] * (N+1) for _ in range(N+1)]
for i in range(M):
L, R = list(map(int, input().split()))
S[L][R] += 1
for i in range(1,N+1):
for j in range(1,N+1):
S[i][j] += S[i-1][j] + S[i][j-1] - S[i-1][j-1]
... | import sys
def input():
return sys.stdin.readline()[:-1]
def main():
N, M, Q = list(map(int, input().split()))
S = [[0] * (N+1) for _ in range(N+1)]
for i in range(M):
L, R = list(map(int, input().split()))
S[L][R] += 1
for i in range(1,N+1):
for j in range(1,N+... | 20 | 24 | 474 | 540 | def main():
N, M, Q = list(map(int, input().split()))
S = [[0] * (N + 1) for _ in range(N + 1)]
for i in range(M):
L, R = list(map(int, input().split()))
S[L][R] += 1
for i in range(1, N + 1):
for j in range(1, N + 1):
S[i][j] += S[i - 1][j] + S[i][j - 1] - S[i - 1][j... | import sys
def input():
return sys.stdin.readline()[:-1]
def main():
N, M, Q = list(map(int, input().split()))
S = [[0] * (N + 1) for _ in range(N + 1)]
for i in range(M):
L, R = list(map(int, input().split()))
S[L][R] += 1
for i in range(1, N + 1):
for j in range(1, N + ... | false | 16.666667 | [
"+import sys",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline()[:-1]",
"+",
"+"
] | false | 0.07371 | 0.043165 | 1.707643 | [
"s548869085",
"s876819637"
] |
u460737328 | p02983 | python | s761715009 | s384865548 | 1,731 | 993 | 2,940 | 2,940 | Accepted | Accepted | 42.63 | L, R = list(map(int, input().split()))
ans = 10**9
rng = R - L
if rng > 2019:
ans = 0
else:
for i in range(L, R+1):
for j in range(L, R+1):
if i != j:
ans = min(ans, i*j % 2019)
print(ans)
| L, R = list(map(int, input().split()))
ans = 10**9
for i in range(L, min(R, L+2019)+1):
for j in range(i+1, min(R, L+2019)+1):
ans = min(ans, (i % 2019) * (j % 2019) % 2019)
print(ans)
| 13 | 8 | 241 | 200 | L, R = list(map(int, input().split()))
ans = 10**9
rng = R - L
if rng > 2019:
ans = 0
else:
for i in range(L, R + 1):
for j in range(L, R + 1):
if i != j:
ans = min(ans, i * j % 2019)
print(ans)
| L, R = list(map(int, input().split()))
ans = 10**9
for i in range(L, min(R, L + 2019) + 1):
for j in range(i + 1, min(R, L + 2019) + 1):
ans = min(ans, (i % 2019) * (j % 2019) % 2019)
print(ans)
| false | 38.461538 | [
"-rng = R - L",
"-if rng > 2019:",
"- ans = 0",
"-else:",
"- for i in range(L, R + 1):",
"- for j in range(L, R + 1):",
"- if i != j:",
"- ans = min(ans, i * j % 2019)",
"+for i in range(L, min(R, L + 2019) + 1):",
"+ for j in range(i + 1, min(R, L + 2019)... | false | 0.069817 | 0.088898 | 0.785361 | [
"s761715009",
"s384865548"
] |
u057415180 | p02767 | python | s375562456 | s742225236 | 21 | 18 | 3,060 | 3,060 | Accepted | Accepted | 14.29 | n = int(eval(input()))
x = list(map(int, input().split()))
ans = 10 ** 9
for p in range(0, 101):
cnt = 0
for i in x:
cnt += (i-p)**2
ans = min(ans, cnt)
print(ans) | n = int(eval(input()))
x = list(map(int, input().split()))
ans1 = 0
ans2 = 0
xa = sum(x) // n
for i in x:
ans1 += (abs(i-xa))**2
for i in x:
ans2 += (abs(i-xa-1))**2
print((min(ans1, ans2)))
| 9 | 12 | 185 | 204 | n = int(eval(input()))
x = list(map(int, input().split()))
ans = 10**9
for p in range(0, 101):
cnt = 0
for i in x:
cnt += (i - p) ** 2
ans = min(ans, cnt)
print(ans)
| n = int(eval(input()))
x = list(map(int, input().split()))
ans1 = 0
ans2 = 0
xa = sum(x) // n
for i in x:
ans1 += (abs(i - xa)) ** 2
for i in x:
ans2 += (abs(i - xa - 1)) ** 2
print((min(ans1, ans2)))
| false | 25 | [
"-ans = 10**9",
"-for p in range(0, 101):",
"- cnt = 0",
"- for i in x:",
"- cnt += (i - p) ** 2",
"- ans = min(ans, cnt)",
"-print(ans)",
"+ans1 = 0",
"+ans2 = 0",
"+xa = sum(x) // n",
"+for i in x:",
"+ ans1 += (abs(i - xa)) ** 2",
"+for i in x:",
"+ ans2 += (abs(i ... | false | 0.045324 | 0.113729 | 0.398521 | [
"s375562456",
"s742225236"
] |
u793868662 | p02695 | python | s254437449 | s039471373 | 155 | 137 | 84,664 | 68,028 | Accepted | Accepted | 11.61 | def resolve():
import itertools
n, m, q = list(map(int, input().split()))
cond = [list(map(int, input().split())) for _ in range(q)]
ans = 0
for i in list(itertools.combinations_with_replacement(list(range(1, m+1)), n)):
point = 0
for j in range(q):
if i[cond[j][1... | def resolve():
import itertools
n, m, q = list(map(int, input().split()))
cond = [list(map(int, input().split())) for _ in range(q)]
ans = 0
for i in itertools.combinations_with_replacement(list(range(1, m+1)), n):
point = 0
for j in range(q):
if i[cond[j][1]-1] -... | 13 | 13 | 440 | 434 | def resolve():
import itertools
n, m, q = list(map(int, input().split()))
cond = [list(map(int, input().split())) for _ in range(q)]
ans = 0
for i in list(itertools.combinations_with_replacement(list(range(1, m + 1)), n)):
point = 0
for j in range(q):
if i[cond[j][1] - 1... | def resolve():
import itertools
n, m, q = list(map(int, input().split()))
cond = [list(map(int, input().split())) for _ in range(q)]
ans = 0
for i in itertools.combinations_with_replacement(list(range(1, m + 1)), n):
point = 0
for j in range(q):
if i[cond[j][1] - 1] - i[... | false | 0 | [
"- for i in list(itertools.combinations_with_replacement(list(range(1, m + 1)), n)):",
"+ for i in itertools.combinations_with_replacement(list(range(1, m + 1)), n):"
] | false | 0.05378 | 0.05659 | 0.950359 | [
"s254437449",
"s039471373"
] |
u588341295 | p03739 | python | s466193144 | s004060343 | 132 | 113 | 14,468 | 14,332 | Accepted | Accepted | 14.39 | # -*- coding: utf-8 -*-
N = int(eval(input()))
aN = list(map(int, input().split()))
sum1 = 0
cnt1 = 0
for i in range(N):
sum1 += aN[i]
if i % 2 == 0:
if sum1 >= 0:
tmp = abs(sum1) +1
cnt1 += tmp
sum1 -= tmp
else:
if sum1 <= 0:
... | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | 37 | 45 | 737 | 1,313 | # -*- coding: utf-8 -*-
N = int(eval(input()))
aN = list(map(int, input().split()))
sum1 = 0
cnt1 = 0
for i in range(N):
sum1 += aN[i]
if i % 2 == 0:
if sum1 >= 0:
tmp = abs(sum1) + 1
cnt1 += tmp
sum1 -= tmp
else:
if sum1 <= 0:
tmp = abs(sum1) ... | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d for j in range(c)] for j in rang... | false | 17.777778 | [
"-N = int(eval(input()))",
"-aN = list(map(int, input().split()))",
"-sum1 = 0",
"-cnt1 = 0",
"-for i in range(N):",
"- sum1 += aN[i]",
"- if i % 2 == 0:",
"- if sum1 >= 0:",
"- tmp = abs(sum1) + 1",
"- cnt1 += tmp",
"- sum1 -= tmp",
"- else:",
... | false | 0.044022 | 0.048548 | 0.90676 | [
"s466193144",
"s004060343"
] |
u279266699 | p02912 | python | s383704837 | s652778029 | 153 | 131 | 14,252 | 20,392 | Accepted | Accepted | 14.38 | import heapq
def main():
n, m = list(map(int, input().split()))
a = list([int(x)*(-1) for x in input().split()])
heapq.heapify(a)
for i in range(m):
item = heapq.heappop(a)
heapq.heappush(a, (-1) * (-item // 2))
print((-sum(a)))
if __name__ == '__main__':
main()... | import heapq
n, m = list(map(int, input().split()))
A = list([-int(x) for x in input().split()])
heapq.heapify(A)
for i in range(m):
item = heapq.heappop(A)
heapq.heappush(A, (-1) * (-item // 2))
print((-sum(A))) | 15 | 11 | 318 | 230 | import heapq
def main():
n, m = list(map(int, input().split()))
a = list([int(x) * (-1) for x in input().split()])
heapq.heapify(a)
for i in range(m):
item = heapq.heappop(a)
heapq.heappush(a, (-1) * (-item // 2))
print((-sum(a)))
if __name__ == "__main__":
main()
| import heapq
n, m = list(map(int, input().split()))
A = list([-int(x) for x in input().split()])
heapq.heapify(A)
for i in range(m):
item = heapq.heappop(A)
heapq.heappush(A, (-1) * (-item // 2))
print((-sum(A)))
| false | 26.666667 | [
"-",
"-def main():",
"- n, m = list(map(int, input().split()))",
"- a = list([int(x) * (-1) for x in input().split()])",
"- heapq.heapify(a)",
"- for i in range(m):",
"- item = heapq.heappop(a)",
"- heapq.heappush(a, (-1) * (-item // 2))",
"- print((-sum(a)))",
"-",
... | false | 0.096869 | 0.25916 | 0.373782 | [
"s383704837",
"s652778029"
] |
u678167152 | p03111 | python | s311786915 | s035925987 | 689 | 282 | 105,120 | 76,388 | Accepted | Accepted | 59.07 | N, A, B, C = list(map(int, input().split()))
L = [0]*N
for i in range(N):
L[i] = int(eval(input()))
import itertools
bambuu = [[0,0,0] for _ in range(4**N)]
for i,pro in enumerate(itertools.product(['A','B',"C",'D'], repeat=N)):
lisA = [L[j] for j in range(N) if pro[j]=='A']
lisB = [L[j] for j in ra... | from itertools import groupby, accumulate, product, permutations, combinations
def calc(x,X):
n = len(x)
ans = 10**10
for q in product([0,1],repeat=n):
point = 0
cnt = 0
for i in range(n):
if q[i]==1:
if cnt>0:
point += 10
cnt += x[i]
if cnt>0:
po... | 26 | 37 | 841 | 867 | N, A, B, C = list(map(int, input().split()))
L = [0] * N
for i in range(N):
L[i] = int(eval(input()))
import itertools
bambuu = [[0, 0, 0] for _ in range(4**N)]
for i, pro in enumerate(itertools.product(["A", "B", "C", "D"], repeat=N)):
lisA = [L[j] for j in range(N) if pro[j] == "A"]
lisB = [L[j] for j in... | from itertools import groupby, accumulate, product, permutations, combinations
def calc(x, X):
n = len(x)
ans = 10**10
for q in product([0, 1], repeat=n):
point = 0
cnt = 0
for i in range(n):
if q[i] == 1:
if cnt > 0:
point += 10
... | false | 29.72973 | [
"-N, A, B, C = list(map(int, input().split()))",
"-L = [0] * N",
"-for i in range(N):",
"- L[i] = int(eval(input()))",
"-import itertools",
"+from itertools import groupby, accumulate, product, permutations, combinations",
"-bambuu = [[0, 0, 0] for _ in range(4**N)]",
"-for i, pro in enumerate(iter... | false | 0.468895 | 1.954242 | 0.239937 | [
"s311786915",
"s035925987"
] |
u639343026 | p02971 | python | s985449164 | s986269877 | 892 | 390 | 57,432 | 58,832 | Accepted | Accepted | 56.28 | my_max=0
my_sec=0
cnt=0
n=int(eval(input()))
a=[0]*n
r_n =list(range(n))
for i in r_n:
a[i]=int(eval(input()))
if my_max<a[i]:
my_max=a[i]
elif my_sec<a[i]:
my_sec=a[i]
for i in r_n:
if my_max==a[i]:
cnt+=1
for i in r_n:
if my_sec!=0:
if my_max!=a[i]:
print(... | import sys
input=sys.stdin.readline
n=int(eval(input()))
max1=0
max2=0
a=[int(eval(input())) for i in range(n)]
for i in a:
if i>=max1:
max2=max1
max1=i
elif i>=max2:
max2=i
if max2==0:
for i in range(n):
print(max1)
exit()
for i in a:
if i==max1:
... | 30 | 22 | 418 | 363 | my_max = 0
my_sec = 0
cnt = 0
n = int(eval(input()))
a = [0] * n
r_n = list(range(n))
for i in r_n:
a[i] = int(eval(input()))
if my_max < a[i]:
my_max = a[i]
elif my_sec < a[i]:
my_sec = a[i]
for i in r_n:
if my_max == a[i]:
cnt += 1
for i in r_n:
if my_sec != 0:
if m... | import sys
input = sys.stdin.readline
n = int(eval(input()))
max1 = 0
max2 = 0
a = [int(eval(input())) for i in range(n)]
for i in a:
if i >= max1:
max2 = max1
max1 = i
elif i >= max2:
max2 = i
if max2 == 0:
for i in range(n):
print(max1)
exit()
for i in a:
if i == m... | false | 26.666667 | [
"-my_max = 0",
"-my_sec = 0",
"-cnt = 0",
"+import sys",
"+",
"+input = sys.stdin.readline",
"-a = [0] * n",
"-r_n = list(range(n))",
"-for i in r_n:",
"- a[i] = int(eval(input()))",
"- if my_max < a[i]:",
"- my_max = a[i]",
"- elif my_sec < a[i]:",
"- my_sec = a[i]"... | false | 0.040849 | 0.040124 | 1.018066 | [
"s985449164",
"s986269877"
] |
u059436995 | p03607 | python | s813870854 | s657594820 | 205 | 92 | 11,884 | 11,884 | Accepted | Accepted | 55.12 | a =set()
n = int(eval(input()))
for _ in range(n):
tmp = int(eval(input()))
if tmp in a:
a.remove(tmp)
else:
a.add(tmp)
print((len(a)))
| import sys
a =set()
n = int(sys.stdin.readline())
for _ in range(n):
tmp = int(sys.stdin.readline())
if tmp in a:
a.remove(tmp)
else:
a.add(tmp)
print((len(a)))
| 9 | 10 | 159 | 197 | a = set()
n = int(eval(input()))
for _ in range(n):
tmp = int(eval(input()))
if tmp in a:
a.remove(tmp)
else:
a.add(tmp)
print((len(a)))
| import sys
a = set()
n = int(sys.stdin.readline())
for _ in range(n):
tmp = int(sys.stdin.readline())
if tmp in a:
a.remove(tmp)
else:
a.add(tmp)
print((len(a)))
| false | 10 | [
"+import sys",
"+",
"-n = int(eval(input()))",
"+n = int(sys.stdin.readline())",
"- tmp = int(eval(input()))",
"+ tmp = int(sys.stdin.readline())"
] | false | 0.041069 | 0.071437 | 0.574893 | [
"s813870854",
"s657594820"
] |
u073729602 | p02639 | python | s421512343 | s919996552 | 27 | 23 | 8,956 | 9,076 | Accepted | Accepted | 14.81 | l = input().split()
print((l.index('0')+1))
| x = list(map(int, input().split()))
print((x.index(0) + 1))
| 2 | 2 | 43 | 59 | l = input().split()
print((l.index("0") + 1))
| x = list(map(int, input().split()))
print((x.index(0) + 1))
| false | 0 | [
"-l = input().split()",
"-print((l.index(\"0\") + 1))",
"+x = list(map(int, input().split()))",
"+print((x.index(0) + 1))"
] | false | 0.177073 | 0.009148 | 19.357072 | [
"s421512343",
"s919996552"
] |
u604774382 | p02383 | python | s892473849 | s025159174 | 30 | 20 | 6,800 | 4,320 | Accepted | Accepted | 33.33 | diceface = { "TOP":0,"FRONT":1,"RIGHT":2,"LEFT":3,"BACK":4,"BOTTOM":5 }
dice = [ int( i ) for i in input( ).split( " " ) ]
roll = eval(input( ))
for i in range( len( roll ) ):
if "E" == roll[i]:
t = dice[ diceface["TOP"] ]
dice[ diceface["TOP"] ] = dice[ diceface["LEFT"] ]
dice[ diceface["LEFT"] ] = di... | diceface = { "TOP":0,"FRONT":1,"RIGHT":2,"LEFT":3,"BACK":4,"BOTTOM":5 }
dice = [ int( i ) for i in input( ).split( " " ) ]
roll = input( )
for i in roll:
if "E" == i:
t = dice[ diceface["TOP"] ]
dice[ diceface["TOP"] ] = dice[ diceface["LEFT"] ]
dice[ diceface["LEFT"] ] = dice[ diceface["BOTTOM"] ]
d... | 31 | 31 | 1,234 | 1,201 | diceface = {"TOP": 0, "FRONT": 1, "RIGHT": 2, "LEFT": 3, "BACK": 4, "BOTTOM": 5}
dice = [int(i) for i in input().split(" ")]
roll = eval(input())
for i in range(len(roll)):
if "E" == roll[i]:
t = dice[diceface["TOP"]]
dice[diceface["TOP"]] = dice[diceface["LEFT"]]
dice[diceface["LEFT"]] = di... | diceface = {"TOP": 0, "FRONT": 1, "RIGHT": 2, "LEFT": 3, "BACK": 4, "BOTTOM": 5}
dice = [int(i) for i in input().split(" ")]
roll = input()
for i in roll:
if "E" == i:
t = dice[diceface["TOP"]]
dice[diceface["TOP"]] = dice[diceface["LEFT"]]
dice[diceface["LEFT"]] = dice[diceface["BOTTOM"]]
... | false | 0 | [
"-roll = eval(input())",
"-for i in range(len(roll)):",
"- if \"E\" == roll[i]:",
"+roll = input()",
"+for i in roll:",
"+ if \"E\" == i:",
"- elif \"N\" == roll[i]:",
"+ elif \"N\" == i:",
"- elif \"S\" == roll[i]:",
"+ elif \"S\" == i:",
"- elif \"W\" == roll[i]:",
"+ ... | false | 0.037268 | 0.037648 | 0.989913 | [
"s892473849",
"s025159174"
] |
u363407238 | p02996 | python | s581504202 | s687938557 | 614 | 468 | 53,616 | 31,840 | Accepted | Accepted | 23.78 | import sys
input = sys.stdin.readline
n = int(eval(input()))
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort(key=lambda x: x[1])
sum = 0
for cost, limit in ab:
sum += cost
if sum > limit:
print('No')
break
else:
print('Yes')
| import sys
input = sys.stdin.readline
n = int(eval(input()))
ab = [tuple(map(int, input().split())) for _ in range(n)]
ab.sort(key=lambda x: x[1])
sum = 0
for cost, limit in ab:
sum += cost
if sum > limit:
print('No')
break
else:
print('Yes')
| 16 | 16 | 282 | 283 | import sys
input = sys.stdin.readline
n = int(eval(input()))
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort(key=lambda x: x[1])
sum = 0
for cost, limit in ab:
sum += cost
if sum > limit:
print("No")
break
else:
print("Yes")
| import sys
input = sys.stdin.readline
n = int(eval(input()))
ab = [tuple(map(int, input().split())) for _ in range(n)]
ab.sort(key=lambda x: x[1])
sum = 0
for cost, limit in ab:
sum += cost
if sum > limit:
print("No")
break
else:
print("Yes")
| false | 0 | [
"-ab = [list(map(int, input().split())) for _ in range(n)]",
"+ab = [tuple(map(int, input().split())) for _ in range(n)]"
] | false | 0.047731 | 0.047134 | 1.012681 | [
"s581504202",
"s687938557"
] |
u188827677 | p03436 | python | s805777516 | s133956778 | 34 | 30 | 9,228 | 9,416 | Accepted | Accepted | 11.76 | from collections import deque
def bfs(sy,sx):
queue = deque([[sy,sx]])
d[sy][sx] = 0
while queue:
y,x = queue.popleft()
for i,j in [(-1,0),(1,0),(0,-1),(0,1)]:
dy,dx = y+i,x+j
if dy < 0 or h <= dy: continue
elif dx < 0 or w <= dx: continue
elif s[dy][dx] == "#": continu... | from collections import deque
def bfs(sy,sx):
q = deque([[sy,sx]])
d[sy][sx] = 0
while q:
y,x = q.popleft()
for i,j in [(-1,0),(1,0),(0,-1),(0,1)]:
dy,dx = y+i,x+j
if dy < 0 or h <= dy: continue
elif dx < 0 or w <= dx: continue
elif s[dy][dx] == "#": continue
eli... | 30 | 30 | 715 | 704 | from collections import deque
def bfs(sy, sx):
queue = deque([[sy, sx]])
d[sy][sx] = 0
while queue:
y, x = queue.popleft()
for i, j in [(-1, 0), (1, 0), (0, -1), (0, 1)]:
dy, dx = y + i, x + j
if dy < 0 or h <= dy:
continue
elif dx < 0 or... | from collections import deque
def bfs(sy, sx):
q = deque([[sy, sx]])
d[sy][sx] = 0
while q:
y, x = q.popleft()
for i, j in [(-1, 0), (1, 0), (0, -1), (0, 1)]:
dy, dx = y + i, x + j
if dy < 0 or h <= dy:
continue
elif dx < 0 or w <= dx:
... | false | 0 | [
"- queue = deque([[sy, sx]])",
"+ q = deque([[sy, sx]])",
"- while queue:",
"- y, x = queue.popleft()",
"+ while q:",
"+ y, x = q.popleft()",
"- queue.append([dy, dx])",
"+ q.append([dy, dx])",
"- for i in s:",
"- t += i.count(\"#\")",
"-... | false | 0.036997 | 0.065943 | 0.561042 | [
"s805777516",
"s133956778"
] |
u736443076 | p02640 | python | s426244997 | s820581610 | 25 | 20 | 9,156 | 9,064 | Accepted | Accepted | 20 | x, y = list(map(int,input().split()))
ans = y / 2 - x
if y % 2 == 0 and 0 <= ans <= x:
print("Yes")
else:
print("No")
| x, y = list(map(int,input().split()))
ans = y / 2 - x
if y % 2 == 1:
print("No")
elif 0 <= ans <= x:
print("Yes")
else:
print("No")
| 6 | 8 | 132 | 152 | x, y = list(map(int, input().split()))
ans = y / 2 - x
if y % 2 == 0 and 0 <= ans <= x:
print("Yes")
else:
print("No")
| x, y = list(map(int, input().split()))
ans = y / 2 - x
if y % 2 == 1:
print("No")
elif 0 <= ans <= x:
print("Yes")
else:
print("No")
| false | 25 | [
"-if y % 2 == 0 and 0 <= ans <= x:",
"+if y % 2 == 1:",
"+ print(\"No\")",
"+elif 0 <= ans <= x:"
] | false | 0.044748 | 0.040759 | 1.097862 | [
"s426244997",
"s820581610"
] |
u764600134 | p03476 | python | s200918010 | s064604795 | 420 | 309 | 54,448 | 22,216 | Accepted | Accepted | 26.43 | # -*- coding: utf-8 -*-
"""
https://beta.atcoder.jp/contests/abc084/tasks/abc084_d
AC
"""
import sys
from sys import stdin
from math import ceil, floor
input = stdin.readline
def create_prime_list(limit):
""" エラトステネスの篩でlimitまでの素数リストを求める
https://ja.wikipedia.org/wiki/%E3%82%A8%E3%83%A9%E3%83%88%E3... | # -*- coding: utf-8 -*-
"""
https://beta.atcoder.jp/contests/abc084/tasks/abc084_d
AC
"""
import sys
from sys import stdin
from math import ceil, floor
input = stdin.readline
def create_prime_list(limit):
""" エラトステネスの篩でlimitまでの素数リストを求める
https://ja.wikipedia.org/wiki/%E3%82%A8%E3%83%A9%E3%83%88%E3... | 59 | 61 | 1,561 | 1,599 | # -*- coding: utf-8 -*-
"""
https://beta.atcoder.jp/contests/abc084/tasks/abc084_d
AC
"""
import sys
from sys import stdin
from math import ceil, floor
input = stdin.readline
def create_prime_list(limit):
"""エラトステネスの篩でlimitまでの素数リストを求める
https://ja.wikipedia.org/wiki/%E3%82%A8%E3%83%A9%E3%83%88%E3%82%B9%E3%83%... | # -*- coding: utf-8 -*-
"""
https://beta.atcoder.jp/contests/abc084/tasks/abc084_d
AC
"""
import sys
from sys import stdin
from math import ceil, floor
input = stdin.readline
def create_prime_list(limit):
"""エラトステネスの篩でlimitまでの素数リストを求める
https://ja.wikipedia.org/wiki/%E3%82%A8%E3%83%A9%E3%83%88%E3%82%B9%E3%83%... | false | 3.278689 | [
"- queries = [list(map(int, input().split())) for _ in range(Q)]",
"+ for _ in range(Q):",
"+ l, r = list(map(int, input().split()))",
"+ queries.append((l, r))"
] | false | 0.30332 | 0.242688 | 1.249834 | [
"s200918010",
"s064604795"
] |
u271934630 | p02959 | python | s139785314 | s527007488 | 295 | 175 | 82,148 | 19,220 | Accepted | Accepted | 40.68 | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for i in range(n):
left = min(a[i], b[i])
ans += left
a[i] -= left
b[i] -= left
right = min(a[i+1], b[i])
ans += right
a[i+1] -= right
b[i] -= right
print(ans)
| import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()
N = i_i()
A = i_l()
B = i_l()
ans = 0
for i in range(len(B)):
if A[i] >= B[i]:
ans += B[i]
A[i] -= B[... | 18 | 32 | 310 | 644 | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for i in range(n):
left = min(a[i], b[i])
ans += left
a[i] -= left
b[i] -= left
right = min(a[i + 1], b[i])
ans += right
a[i + 1] -= right
b[i] -= right
print(ans)
| import sys
stdin = sys.stdin
sys.setrecursionlimit(10**7)
i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()
N = i_i()
A = i_l()
B = i_l()
ans = 0
for i in range(len(B)):
if A[i] >= B[i]:
ans += B[i]
A[i] -= B[i]
B[i] = 0
... | false | 43.75 | [
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-b = list(map(int, input().split()))",
"+import sys",
"+",
"+stdin = sys.stdin",
"+sys.setrecursionlimit(10**7)",
"+i_i = lambda: int(i_s())",
"+i_l = lambda: list(map(int, stdin.readline().split()))",
"+i_s = lambda: stdin.readli... | false | 0.09104 | 0.133022 | 0.684396 | [
"s139785314",
"s527007488"
] |
u071680334 | p02726 | python | s205401769 | s811618941 | 941 | 773 | 4,592 | 9,236 | Accepted | Accepted | 17.85 | import queue
def main():
n, x, y = list(map(int, input().split()))
x -= 1
y -= 1
ans = [0]*n
t = [[i+1, i-1] for i in range(n)]
t[x].append(y)
t[y].append(x)
for i in range(n):
for j in range(i+1, n):
if j <= x:
ans[j-i] += 1
e... | def main():
n, x, y = list(map(int, input().split()))
ans = [0]*(n)
for i in range(1, n):
for j in range(i+1, n+1):
ans[min(j-i, abs(x-i)+abs(y-j)+1)] += 1
for v in ans[1:]:
print(v)
if __name__ == "__main__":
main()
| 23 | 11 | 602 | 270 | import queue
def main():
n, x, y = list(map(int, input().split()))
x -= 1
y -= 1
ans = [0] * n
t = [[i + 1, i - 1] for i in range(n)]
t[x].append(y)
t[y].append(x)
for i in range(n):
for j in range(i + 1, n):
if j <= x:
ans[j - i] += 1
el... | def main():
n, x, y = list(map(int, input().split()))
ans = [0] * (n)
for i in range(1, n):
for j in range(i + 1, n + 1):
ans[min(j - i, abs(x - i) + abs(y - j) + 1)] += 1
for v in ans[1:]:
print(v)
if __name__ == "__main__":
main()
| false | 52.173913 | [
"-import queue",
"-",
"-",
"- x -= 1",
"- y -= 1",
"- ans = [0] * n",
"- t = [[i + 1, i - 1] for i in range(n)]",
"- t[x].append(y)",
"- t[y].append(x)",
"- for i in range(n):",
"- for j in range(i + 1, n):",
"- if j <= x:",
"- ans[j - i]... | false | 0.090823 | 0.077015 | 1.179288 | [
"s205401769",
"s811618941"
] |
u294385082 | p03370 | python | s752397142 | s783537646 | 40 | 17 | 3,060 | 2,940 | Accepted | Accepted | 57.5 | n,x = list(map(int,input().split()))
m = sorted([int(eval(input())) for i in range(n)])
newx = x - sum(m)
c = n
for i in range(114514):
newx -= m[0]
c += 1
if newx < 0 :
break
print((c-1)) | n,x = list(map(int,input().split()))
m = sorted([int(eval(input())) for i in range(n)])
newx = x - sum(m)
a = newx//m[0]
print((n+a)) | 12 | 7 | 198 | 127 | n, x = list(map(int, input().split()))
m = sorted([int(eval(input())) for i in range(n)])
newx = x - sum(m)
c = n
for i in range(114514):
newx -= m[0]
c += 1
if newx < 0:
break
print((c - 1))
| n, x = list(map(int, input().split()))
m = sorted([int(eval(input())) for i in range(n)])
newx = x - sum(m)
a = newx // m[0]
print((n + a))
| false | 41.666667 | [
"-c = n",
"-for i in range(114514):",
"- newx -= m[0]",
"- c += 1",
"- if newx < 0:",
"- break",
"-print((c - 1))",
"+a = newx // m[0]",
"+print((n + a))"
] | false | 0.037874 | 0.042337 | 0.894596 | [
"s752397142",
"s783537646"
] |
u970899068 | p03044 | python | s244062240 | s388015659 | 937 | 498 | 85,212 | 86,620 | Accepted | Accepted | 46.85 | import sys
sys.setrecursionlimit(10**9)
def dfs(now, prev):
# 今いる頂点から行ける頂点を順に next に入れてループ
for next, w in g[now]:
if ans[next] == -1:
ans[next]=0
if w % 2 != 0:
if ans[now]==0:
ans[next]=1
dfs(next,now)
... | import sys
input = sys.stdin.readline
n=int(eval(input()))
a= [list(map(int, input().split())) for i in range(n-1)]
b = [[] for i in range(n)]
for i in range(n-1):
b[a[i][0]-1].append((a[i][1]-1,a[i][2]))
b[a[i][1]-1].append((a[i][0]-1,a[i][2]))
import collections
from collections import deque
... | 35 | 42 | 762 | 862 | import sys
sys.setrecursionlimit(10**9)
def dfs(now, prev):
# 今いる頂点から行ける頂点を順に next に入れてループ
for next, w in g[now]:
if ans[next] == -1:
ans[next] = 0
if w % 2 != 0:
if ans[now] == 0:
ans[next] = 1
dfs(next, now)
... | import sys
input = sys.stdin.readline
n = int(eval(input()))
a = [list(map(int, input().split())) for i in range(n - 1)]
b = [[] for i in range(n)]
for i in range(n - 1):
b[a[i][0] - 1].append((a[i][1] - 1, a[i][2]))
b[a[i][1] - 1].append((a[i][0] - 1, a[i][2]))
import collections
from collections import deque... | false | 16.666667 | [
"-sys.setrecursionlimit(10**9)",
"+input = sys.stdin.readline",
"+n = int(eval(input()))",
"+a = [list(map(int, input().split())) for i in range(n - 1)]",
"+b = [[] for i in range(n)]",
"+for i in range(n - 1):",
"+ b[a[i][0] - 1].append((a[i][1] - 1, a[i][2]))",
"+ b[a[i][1] - 1].append((a[i][0... | false | 0.047945 | 0.007544 | 6.354997 | [
"s244062240",
"s388015659"
] |
u992910889 | p03161 | python | s193259590 | s387023331 | 428 | 380 | 56,928 | 52,448 | Accepted | Accepted | 11.21 | N,K=list(map(int,input().split()))
h=list(map(int,input().split()))
#dp[i]はh[i]までにかかるコストの最小値
dp=[float('inf') for _ in range(N)]
dp[0]=0
for i in range(N-1):
for j in range(1,min(K+1,N-i)):
dp[i+j]=min(dp[i+j],dp[i]+abs(h[i+j]-h[i]))
print((dp[N-1]))
| import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()
def resolve():
# https://qiita.com/drken/items/dc53c683d6de8aeacf5a#dp-%E5%AE%9F%E8%A3%85%E3%81%AE%E9%A0%86%E5%BA%8F
INF = 10**10 # INF+INFを計算してもオーバーフローしない範囲で大きく
N,K=list(map(int,... | 11 | 48 | 268 | 1,224 | N, K = list(map(int, input().split()))
h = list(map(int, input().split()))
# dp[i]はh[i]までにかかるコストの最小値
dp = [float("inf") for _ in range(N)]
dp[0] = 0
for i in range(N - 1):
for j in range(1, min(K + 1, N - i)):
dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]))
print((dp[N - 1]))
| import sys
sys.setrecursionlimit(10**5 + 10)
def input():
return sys.stdin.readline().strip()
def resolve():
# https://qiita.com/drken/items/dc53c683d6de8aeacf5a#dp-%E5%AE%9F%E8%A3%85%E3%81%AE%E9%A0%86%E5%BA%8F
INF = 10**10 # INF+INFを計算してもオーバーフローしない範囲で大きく
N, K = list(map(int, input().split()))
... | false | 77.083333 | [
"-N, K = list(map(int, input().split()))",
"-h = list(map(int, input().split()))",
"-# dp[i]はh[i]までにかかるコストの最小値",
"-dp = [float(\"inf\") for _ in range(N)]",
"-dp[0] = 0",
"-for i in range(N - 1):",
"- for j in range(1, min(K + 1, N - i)):",
"- dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] ... | false | 0.097627 | 0.060126 | 1.623711 | [
"s193259590",
"s387023331"
] |
u762469320 | p02899 | python | s145322517 | s767078092 | 94 | 85 | 14,976 | 14,972 | Accepted | Accepted | 9.57 | n= int(eval(input()))
a = list(map(int,input().split()))
x = [0 for i in range(len(a))]
for i,v in enumerate(a):
x[v-1] = str(i+1)
print((' '.join(x))) | n= int(eval(input()))
a = list(map(int,input().split()))
x = [0] * len(a)
for i,v in enumerate(a):
x[v-1] = str(i+1)
print((' '.join(x))) | 9 | 9 | 155 | 141 | n = int(eval(input()))
a = list(map(int, input().split()))
x = [0 for i in range(len(a))]
for i, v in enumerate(a):
x[v - 1] = str(i + 1)
print((" ".join(x)))
| n = int(eval(input()))
a = list(map(int, input().split()))
x = [0] * len(a)
for i, v in enumerate(a):
x[v - 1] = str(i + 1)
print((" ".join(x)))
| false | 0 | [
"-x = [0 for i in range(len(a))]",
"+x = [0] * len(a)"
] | false | 0.036565 | 0.034779 | 1.051328 | [
"s145322517",
"s767078092"
] |
u638456847 | p03253 | python | s414308149 | s318779524 | 206 | 120 | 57,840 | 15,264 | Accepted | Accepted | 41.75 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
MOD = 10**9 + 7
fac = [1, 1] # 元テーブル
f_inv = [1, 1] # 逆元テーブル
inv = [0, 1] # 逆元テーブル計算用テーブル
def prepare(n, mod):
for i in range(2, n+1):
fac.append((fac[-1] * i) % mod)
inv.append((-... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
MOD = 10**9+7
fac = [1, 1] # 元テーブル
f_inv = [1, 1] # 逆元テーブル
inv = [0, 1] # 逆元テーブル計算用テーブル
def prepare(n, mod):
for i in range(2, n+1):
fac.append((fac[-1] * i) % mod)
inv.append((-in... | 57 | 58 | 1,118 | 1,128 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
MOD = 10**9 + 7
fac = [1, 1] # 元テーブル
f_inv = [1, 1] # 逆元テーブル
inv = [0, 1] # 逆元テーブル計算用テーブル
def prepare(n, mod):
for i in range(2, n + 1):
fac.append((fac[-1] * i) % mod)
inv.append((-inv[mod % i] * (m... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
MOD = 10**9 + 7
fac = [1, 1] # 元テーブル
f_inv = [1, 1] # 逆元テーブル
inv = [0, 1] # 逆元テーブル計算用テーブル
def prepare(n, mod):
for i in range(2, n + 1):
fac.append((fac[-1] * i) % mod)
inv.append((-inv[mod % i] * (m... | false | 1.724138 | [
"- d = {}",
"- i = 2",
"+ d = []",
"+ i, e = 2, 0 # factor, exponent",
"- if n % i == 0:",
"- d[i] = 1",
"+ while n % i == 0:",
"- while n % i == 0:",
"- n //= i",
"- d[i] += 1",
"+ e += 1",
"+ if ... | false | 0.179464 | 0.259027 | 0.69284 | [
"s414308149",
"s318779524"
] |
u297574184 | p02780 | python | s655847117 | s596275609 | 214 | 127 | 26,364 | 34,472 | Accepted | Accepted | 40.65 | from itertools import accumulate
N, K = list(map(int, input().split()))
ps = list(map(int, input().split()))
Es = [p*(p+1)/2/p for p in ps]
accEs = list(accumulate([0]+Es))
ans = 0
for i in range(N-K+1):
e = accEs[i+K] - accEs[i]
ans = max(ans, e)
print(ans)
| from itertools import accumulate
N, K = list(map(int, input().split()))
Ps = list(map(int, input().split()))
Es = [(P+1)/2 for P in Ps]
accEs = list(accumulate([0]+Es))
ans = 0.0
for i in range(N-K+1):
e = accEs[i+K] - accEs[i]
if e > ans:
ans = e
print(ans)
| 15 | 15 | 280 | 287 | from itertools import accumulate
N, K = list(map(int, input().split()))
ps = list(map(int, input().split()))
Es = [p * (p + 1) / 2 / p for p in ps]
accEs = list(accumulate([0] + Es))
ans = 0
for i in range(N - K + 1):
e = accEs[i + K] - accEs[i]
ans = max(ans, e)
print(ans)
| from itertools import accumulate
N, K = list(map(int, input().split()))
Ps = list(map(int, input().split()))
Es = [(P + 1) / 2 for P in Ps]
accEs = list(accumulate([0] + Es))
ans = 0.0
for i in range(N - K + 1):
e = accEs[i + K] - accEs[i]
if e > ans:
ans = e
print(ans)
| false | 0 | [
"-ps = list(map(int, input().split()))",
"-Es = [p * (p + 1) / 2 / p for p in ps]",
"+Ps = list(map(int, input().split()))",
"+Es = [(P + 1) / 2 for P in Ps]",
"-ans = 0",
"+ans = 0.0",
"- ans = max(ans, e)",
"+ if e > ans:",
"+ ans = e"
] | false | 0.006955 | 0.031683 | 0.219523 | [
"s655847117",
"s596275609"
] |
u945641805 | p02924 | python | s489506956 | s517062917 | 49 | 35 | 5,460 | 5,076 | Accepted | Accepted | 28.57 | from decimal import Decimal
N = int(eval(input()))
print((Decimal(N * (N - 1) // 2))) | from decimal import Decimal
N = int(eval(input()))
print((int(Decimal(1/2) * Decimal(N) * Decimal(N - 1)))) | 3 | 3 | 79 | 101 | from decimal import Decimal
N = int(eval(input()))
print((Decimal(N * (N - 1) // 2)))
| from decimal import Decimal
N = int(eval(input()))
print((int(Decimal(1 / 2) * Decimal(N) * Decimal(N - 1))))
| false | 0 | [
"-print((Decimal(N * (N - 1) // 2)))",
"+print((int(Decimal(1 / 2) * Decimal(N) * Decimal(N - 1))))"
] | false | 0.037546 | 0.038135 | 0.984552 | [
"s489506956",
"s517062917"
] |
u388927326 | p03634 | python | s520828448 | s414599925 | 685 | 559 | 47,072 | 46,996 | Accepted | Accepted | 18.39 | #!/usr/bin/env python3
import sys
import heapq
def main():
input = sys.stdin.readline
n = int(eval(input()))
adjs = [[] for i in range(n)]
for i in range(n - 1):
a, b, c = list(map(int, input().split()))
adjs[a - 1].append((b - 1, c))
adjs[b - 1].append((a - 1, c))
... | #!/usr/bin/env python3
import sys
def main():
input = sys.stdin.readline
n = int(eval(input()))
adjs = [[] for i in range(n)]
for i in range(n - 1):
a, b, c = list(map(int, input().split()))
adjs[a - 1].append((b - 1, c))
adjs[b - 1].append((a - 1, c))
q, k = li... | 37 | 36 | 890 | 853 | #!/usr/bin/env python3
import sys
import heapq
def main():
input = sys.stdin.readline
n = int(eval(input()))
adjs = [[] for i in range(n)]
for i in range(n - 1):
a, b, c = list(map(int, input().split()))
adjs[a - 1].append((b - 1, c))
adjs[b - 1].append((a - 1, c))
q, k = l... | #!/usr/bin/env python3
import sys
def main():
input = sys.stdin.readline
n = int(eval(input()))
adjs = [[] for i in range(n)]
for i in range(n - 1):
a, b, c = list(map(int, input().split()))
adjs[a - 1].append((b - 1, c))
adjs[b - 1].append((a - 1, c))
q, k = list(map(int, ... | false | 2.702703 | [
"-import heapq",
"- # Dijkstra",
"+ # DFS",
"- d, j = heapq.heappop(hq)",
"+ d, j = hq.pop()",
"- heapq.heappush(hq, (d + d2, j2))",
"+ hq.append((d + d2, j2))"
] | false | 0.141187 | 0.03915 | 3.606326 | [
"s520828448",
"s414599925"
] |
u672220554 | p03317 | python | s713623835 | s163460263 | 197 | 176 | 52,652 | 42,864 | Accepted | Accepted | 10.66 | def main():
n,k = list(map(int,input().split()))
a=list(map(int,input().split()))
id1 = a.index(1)
return (n-1+k-2)//(k-1)
print((main())) | n,k = list(map(int,input().split()))
a=eval(input())
print(((n+k-3)//(k-1))) | 10 | 3 | 159 | 64 | def main():
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
id1 = a.index(1)
return (n - 1 + k - 2) // (k - 1)
print((main()))
| n, k = list(map(int, input().split()))
a = eval(input())
print(((n + k - 3) // (k - 1)))
| false | 70 | [
"-def main():",
"- n, k = list(map(int, input().split()))",
"- a = list(map(int, input().split()))",
"- id1 = a.index(1)",
"- return (n - 1 + k - 2) // (k - 1)",
"-",
"-",
"-print((main()))",
"+n, k = list(map(int, input().split()))",
"+a = eval(input())",
"+print(((n + k - 3) // (k ... | false | 0.081572 | 0.044952 | 1.814647 | [
"s713623835",
"s163460263"
] |
u285681431 | p02714 | python | s179580424 | s879881605 | 1,896 | 1,387 | 9,140 | 9,196 | Accepted | Accepted | 26.85 | N = int(eval(input()))
S = eval(input())
# R/G/Bそれぞれの個数
r = S.count('R')
g = S.count('G')
b = S.count('B')
# R,G,Bとなる選び方の総数。順番はRGBとは限らない
ans = r * g * b
# j-i != k-j は扱いにくい
# j-i == k-j の数を求めて引く(余事象)
# この時、k == 2*j - i、すなわちi,jが決まればkは一意に定まる
# i = 0,1,2,...,N-3
# j = i+1,i+2,...,N-2
# k = 2*j-1
fo... | N = int(eval(input()))
S = eval(input())
# R/G/Bそれぞれの個数
r = S.count('R')
g = S.count('G')
b = S.count('B')
# R,G,Bとなる選び方の総数。順番はRGBとは限らない
ans = r * g * b
# j-i != k-j は扱いにくい
# j-i == k-j の数を求めて引く(余事象)
# この時、k == 2*j - i、すなわちi,jが決まればkは一意に定まる
# i = 0,1,2,...,N-3
# j = i+1,i+2,...,N-2
# k = 2*j-1
fo... | 27 | 29 | 531 | 568 | N = int(eval(input()))
S = eval(input())
# R/G/Bそれぞれの個数
r = S.count("R")
g = S.count("G")
b = S.count("B")
# R,G,Bとなる選び方の総数。順番はRGBとは限らない
ans = r * g * b
# j-i != k-j は扱いにくい
# j-i == k-j の数を求めて引く(余事象)
# この時、k == 2*j - i、すなわちi,jが決まればkは一意に定まる
# i = 0,1,2,...,N-3
# j = i+1,i+2,...,N-2
# k = 2*j-1
for i in range(N - 2):
... | N = int(eval(input()))
S = eval(input())
# R/G/Bそれぞれの個数
r = S.count("R")
g = S.count("G")
b = S.count("B")
# R,G,Bとなる選び方の総数。順番はRGBとは限らない
ans = r * g * b
# j-i != k-j は扱いにくい
# j-i == k-j の数を求めて引く(余事象)
# この時、k == 2*j - i、すなわちi,jが決まればkは一意に定まる
# i = 0,1,2,...,N-3
# j = i+1,i+2,...,N-2
# k = 2*j-1
for i in range(N - 2):
... | false | 6.896552 | [
"- # kが範囲内、かつ、条件1を満たしている場合",
"- if k <= N - 1 and S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:",
"+ # k>=N となったらそれ以降jについてのfor回すのは無駄、次のjへ",
"+ if k >= N:",
"+ break",
"+ if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:"
] | false | 0.036379 | 0.082636 | 0.440239 | [
"s179580424",
"s879881605"
] |
u724687935 | p03457 | python | s430753865 | s097898642 | 609 | 194 | 61,656 | 10,284 | Accepted | Accepted | 68.14 | def is_reachable(dept, dest):
distance = abs(dest[1] - dept[1]) + abs(dest[2] - dept[2])
time = dest[0] - dept[0]
if (time - distance >= 0) and ((time - distance) % 2 == 0):
return True
else:
return False
N = int(eval(input()))
itin = [(0, 0, 0)]
itin_append = itin.append
f... | import sys
N = int(eval(input()))
t, x, y = 0, 0, 0
ans = 'No'
for s in sys.stdin.readlines():
nt, nx, ny = list(map(int, s.split()))
T = nt - t
D = abs(nx - x) + abs(ny - y)
if T < D or T % 2 != D % 2:
break
t, x, y = nt, nx, ny
else:
ans = 'Yes'
print(ans)
| 23 | 17 | 539 | 298 | def is_reachable(dept, dest):
distance = abs(dest[1] - dept[1]) + abs(dest[2] - dept[2])
time = dest[0] - dept[0]
if (time - distance >= 0) and ((time - distance) % 2 == 0):
return True
else:
return False
N = int(eval(input()))
itin = [(0, 0, 0)]
itin_append = itin.append
for n in rang... | import sys
N = int(eval(input()))
t, x, y = 0, 0, 0
ans = "No"
for s in sys.stdin.readlines():
nt, nx, ny = list(map(int, s.split()))
T = nt - t
D = abs(nx - x) + abs(ny - y)
if T < D or T % 2 != D % 2:
break
t, x, y = nt, nx, ny
else:
ans = "Yes"
print(ans)
| false | 26.086957 | [
"-def is_reachable(dept, dest):",
"- distance = abs(dest[1] - dept[1]) + abs(dest[2] - dept[2])",
"- time = dest[0] - dept[0]",
"- if (time - distance >= 0) and ((time - distance) % 2 == 0):",
"- return True",
"- else:",
"- return False",
"-",
"+import sys",
"-itin = [(0,... | false | 0.048126 | 0.008312 | 5.789952 | [
"s430753865",
"s097898642"
] |
u694665829 | p02621 | python | s748011081 | s170051837 | 29 | 24 | 9,148 | 8,988 | Accepted | Accepted | 17.24 | a=int(eval(input()))
print((int(a+a**2+a**3))) | a=int(eval(input()))
print((a+a**2+a**3)) | 2 | 2 | 39 | 34 | a = int(eval(input()))
print((int(a + a**2 + a**3)))
| a = int(eval(input()))
print((a + a**2 + a**3))
| false | 0 | [
"-print((int(a + a**2 + a**3)))",
"+print((a + a**2 + a**3))"
] | false | 0.040288 | 0.041214 | 0.977517 | [
"s748011081",
"s170051837"
] |
u703180353 | p03854 | python | s330684312 | s565882369 | 160 | 117 | 9,088 | 9,144 | Accepted | Accepted | 26.88 | S = eval(input())
words = ['dreameraser','dreamerase','dreamer','dream','eraser','erase']
i = 0
while i < len(S):
update = False
for w in words:
if S[i:].startswith(w):
i += len(w)
update =True
break
if not update:
break
print(('YES' if i == le... | S = eval(input())
words = ['dreamer','dream','eraser','erase']
i = len(S)
while i>0:
update = False
for w in words:
if S[:i].endswith(w):
i -= len(w)
update =True
break
if not update:
break
print(('YES' if i == 0 else 'NO')) | 13 | 13 | 328 | 292 | S = eval(input())
words = ["dreameraser", "dreamerase", "dreamer", "dream", "eraser", "erase"]
i = 0
while i < len(S):
update = False
for w in words:
if S[i:].startswith(w):
i += len(w)
update = True
break
if not update:
break
print(("YES" if i == len(S) e... | S = eval(input())
words = ["dreamer", "dream", "eraser", "erase"]
i = len(S)
while i > 0:
update = False
for w in words:
if S[:i].endswith(w):
i -= len(w)
update = True
break
if not update:
break
print(("YES" if i == 0 else "NO"))
| false | 0 | [
"-words = [\"dreameraser\", \"dreamerase\", \"dreamer\", \"dream\", \"eraser\", \"erase\"]",
"-i = 0",
"-while i < len(S):",
"+words = [\"dreamer\", \"dream\", \"eraser\", \"erase\"]",
"+i = len(S)",
"+while i > 0:",
"- if S[i:].startswith(w):",
"- i += len(w)",
"+ if S[:i].... | false | 0.00699 | 0.078126 | 0.089472 | [
"s330684312",
"s565882369"
] |
u098968285 | p03088 | python | s591192783 | s708075501 | 386 | 321 | 3,188 | 3,188 | Accepted | Accepted | 16.84 | import re
def makelist(n, m):
return [[0 for i in range(m)] for j in range(n)]
N = int(eval(input()))
MOD = int(1e9) + 7
acgt = ["A", "C", "G", "T"]
changed = list([re.compile(pat) for pat in [r".*AGC", r".*GAC", r".*ACG", r".*A.GC", r".*AG.C"]])
abcl = [ a+b+c for a in acgt for b in acgt for c in ac... | import re
def makelist(n, m):
return [[0 for i in range(m)] for j in range(n)]
N = int(eval(input()))
MOD = int(1e9) + 7
acgt = ["A", "C", "G", "T"]
changed = list([re.compile(pat) for pat in [r"AGC", r"GAC", r"ACG", r"A.GC", r"AG.C"]])
abcl = [ a+b+c for a in acgt for b in acgt for c in acgt]
dp ... | 41 | 41 | 888 | 880 | import re
def makelist(n, m):
return [[0 for i in range(m)] for j in range(n)]
N = int(eval(input()))
MOD = int(1e9) + 7
acgt = ["A", "C", "G", "T"]
changed = list(
[re.compile(pat) for pat in [r".*AGC", r".*GAC", r".*ACG", r".*A.GC", r".*AG.C"]]
)
abcl = [a + b + c for a in acgt for b in acgt for c in acgt... | import re
def makelist(n, m):
return [[0 for i in range(m)] for j in range(n)]
N = int(eval(input()))
MOD = int(1e9) + 7
acgt = ["A", "C", "G", "T"]
changed = list([re.compile(pat) for pat in [r"AGC", r"GAC", r"ACG", r"A.GC", r"AG.C"]])
abcl = [a + b + c for a in acgt for b in acgt for c in acgt]
dp = {}
for no... | false | 0 | [
"-changed = list(",
"- [re.compile(pat) for pat in [r\".*AGC\", r\".*GAC\", r\".*ACG\", r\".*A.GC\", r\".*AG.C\"]]",
"-)",
"+changed = list([re.compile(pat) for pat in [r\"AGC\", r\"GAC\", r\"ACG\", r\"A.GC\", r\"AG.C\"]])",
"- if any([ch.match(now) for ch in changed]):",
"+ if any([ch.search(now... | false | 0.330487 | 0.199397 | 1.657433 | [
"s591192783",
"s708075501"
] |
u368780724 | p02564 | python | s922994792 | s674215991 | 2,528 | 2,026 | 367,464 | 284,776 | Accepted | Accepted | 19.86 | import sys
readline = sys.stdin.readline
#非再帰
import sys
def scc(Edge):
N = len(Edge)
Edgeinv = [[] for _ in range(N)]
for vn in range(N):
for vf in Edge[vn]:
Edgeinv[vf].append(vn)
used = [False]*N
dim = [len(Edge[i]) for i in range(N)]
order = []
for ... | import sys
readline = sys.stdin.readline
#非再帰
import sys
def scc(Edge):
N = len(Edge)
Edgeinv = [[] for _ in range(N)]
for vn in range(N):
for vf in Edge[vn]:
Edgeinv[vf].append(vn)
used = [False]*N
dim = [len(Edge[i]) for i in range(N)]
order = []
for ... | 76 | 78 | 2,141 | 2,159 | import sys
readline = sys.stdin.readline
# 非再帰
import sys
def scc(Edge):
N = len(Edge)
Edgeinv = [[] for _ in range(N)]
for vn in range(N):
for vf in Edge[vn]:
Edgeinv[vf].append(vn)
used = [False] * N
dim = [len(Edge[i]) for i in range(N)]
order = []
for st in range(N... | import sys
readline = sys.stdin.readline
# 非再帰
import sys
def scc(Edge):
N = len(Edge)
Edgeinv = [[] for _ in range(N)]
for vn in range(N):
for vf in Edge[vn]:
Edgeinv[vf].append(vn)
used = [False] * N
dim = [len(Edge[i]) for i in range(N)]
order = []
for st in range(N... | false | 2.564103 | [
"+ \"\"\"",
"- if tn != tf and tn * M + tf not in teset:",
"- teset.add(tn * M + tf)",
"+ if tn != tf and tn*M + tf not in teset:",
"+ teset.add(tn*M + tf)",
"+ \"\"\""
] | false | 0.050019 | 0.050016 | 1.00007 | [
"s922994792",
"s674215991"
] |
u760569096 | p02614 | python | s352689112 | s948089668 | 95 | 56 | 68,516 | 9,216 | Accepted | Accepted | 41.05 | import itertools
h,w,k = list(map(int, input().split()))
g = []
for _ in range(h):
i = eval(input())
g.append(i)
l = [0 for j in range(h)]
d = [0 for j in range(w)]
c =0
for i in range(h):
a = 0
for j in range(w):
if g[i][j] == '#':
a +=1
l[i]+=a
c+=a
for i in range(w):
b = 0
... | import itertools
h,w,k = list(map(int, input().split()))
g = []
for _ in range(h):
g.append(eval(input()))
ans = 0
for i in list(itertools.product([0,1], repeat=h)):
for j in list(itertools.product([0,1], repeat=w)):
e = 0
for x in range(h):
for y in range(w):
if i[x] == 1 and j[y] ... | 40 | 16 | 791 | 386 | import itertools
h, w, k = list(map(int, input().split()))
g = []
for _ in range(h):
i = eval(input())
g.append(i)
l = [0 for j in range(h)]
d = [0 for j in range(w)]
c = 0
for i in range(h):
a = 0
for j in range(w):
if g[i][j] == "#":
a += 1
l[i] += a
c += a
for i in range(... | import itertools
h, w, k = list(map(int, input().split()))
g = []
for _ in range(h):
g.append(eval(input()))
ans = 0
for i in list(itertools.product([0, 1], repeat=h)):
for j in list(itertools.product([0, 1], repeat=w)):
e = 0
for x in range(h):
for y in range(w):
if... | false | 60 | [
"- i = eval(input())",
"- g.append(i)",
"-l = [0 for j in range(h)]",
"-d = [0 for j in range(w)]",
"-c = 0",
"-for i in range(h):",
"- a = 0",
"- for j in range(w):",
"- if g[i][j] == \"#\":",
"- a += 1",
"- l[i] += a",
"- c += a",
"-for i in range(w):",
... | false | 0.040053 | 0.039748 | 1.00768 | [
"s352689112",
"s948089668"
] |
u515740713 | p02726 | python | s966120305 | s478064519 | 1,590 | 1,183 | 9,284 | 9,880 | Accepted | Accepted | 25.6 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N,X,Y = list(map(int,readline().split()))
ans = [0]*N
for i in range(1,N):
for j in range(i+1,N+1):
dist = min(j-i,abs(i-X)+1+abs(j-Y),abs(i-Y)+1+abs(j-X))
ans[dist]+=1
prin... | import sys
from collections import deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N,X,Y = list(map(int,readline().split()))
ans = [0]*N
graph = [[] for _ in range(N)]
for i in range(N-1):
graph[i].append(i+1)
graph[i+1].append(i)
graph[... | 11 | 31 | 351 | 736 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, X, Y = list(map(int, readline().split()))
ans = [0] * N
for i in range(1, N):
for j in range(i + 1, N + 1):
dist = min(j - i, abs(i - X) + 1 + abs(j - Y), abs(i - Y) + 1 + abs(j - X))
... | import sys
from collections import deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, X, Y = list(map(int, readline().split()))
ans = [0] * N
graph = [[] for _ in range(N)]
for i in range(N - 1):
graph[i].append(i + 1)
graph[i + 1].append(i)
graph[... | false | 64.516129 | [
"+from collections import deque",
"-for i in range(1, N):",
"- for j in range(i + 1, N + 1):",
"- dist = min(j - i, abs(i - X) + 1 + abs(j - Y), abs(i - Y) + 1 + abs(j - X))",
"- ans[dist] += 1",
"+graph = [[] for _ in range(N)]",
"+for i in range(N - 1):",
"+ graph[i].append(i + 1... | false | 0.035655 | 0.042415 | 0.840613 | [
"s966120305",
"s478064519"
] |
u761320129 | p03329 | python | s026002160 | s256290193 | 591 | 130 | 3,828 | 9,800 | Accepted | Accepted | 78 | N = int(eval(input()))
s = set()
a = 1
while a <= 100000:
s.add(a)
a *= 6
a = 1
while a <= 100000:
s.add(a)
a *= 9
s = sorted(s)
INF = float('inf')
dp = [INF] * (N+1)
dp[0] = 0
for i in range(N):
for a in s:
if i+a > N: break
dp[i+a] = min(dp[i+a], dp[i] + 1)
pr... | import sys
sys.setrecursionlimit(10**8)
N = int(eval(input()))
ss = set()
n = 6
while n <= 10**5:
ss.add(n)
n *= 6
n = 9
while n <= 10**5:
ss.add(n)
n *= 9
dp = [None] * (N+1)
def rec(n):
if dp[n] is not None:
return dp[n]
tmp = n
for s in ss:
if s >... | 21 | 31 | 324 | 474 | N = int(eval(input()))
s = set()
a = 1
while a <= 100000:
s.add(a)
a *= 6
a = 1
while a <= 100000:
s.add(a)
a *= 9
s = sorted(s)
INF = float("inf")
dp = [INF] * (N + 1)
dp[0] = 0
for i in range(N):
for a in s:
if i + a > N:
break
dp[i + a] = min(dp[i + a], dp[i] + 1)
prin... | import sys
sys.setrecursionlimit(10**8)
N = int(eval(input()))
ss = set()
n = 6
while n <= 10**5:
ss.add(n)
n *= 6
n = 9
while n <= 10**5:
ss.add(n)
n *= 9
dp = [None] * (N + 1)
def rec(n):
if dp[n] is not None:
return dp[n]
tmp = n
for s in ss:
if s > n:
conti... | false | 32.258065 | [
"+import sys",
"+",
"+sys.setrecursionlimit(10**8)",
"-s = set()",
"-a = 1",
"-while a <= 100000:",
"- s.add(a)",
"- a *= 6",
"-a = 1",
"-while a <= 100000:",
"- s.add(a)",
"- a *= 9",
"-s = sorted(s)",
"-INF = float(\"inf\")",
"-dp = [INF] * (N + 1)",
"-dp[0] = 0",
"-for... | false | 0.10622 | 0.134164 | 0.791716 | [
"s026002160",
"s256290193"
] |
u667024514 | p03488 | python | s947356486 | s351064387 | 1,942 | 1,477 | 3,820 | 3,816 | Accepted | Accepted | 23.94 | s = eval(input())
x, y = list(map(int, input().split()))
s = s.split("T")
s_x = []
s_y = []
for i in range(0,len(s),2):
s_x.append(s[i])
for i in range(1,len(s),2):
s_y.append(s[i])
x_cou = []
y_cou = []
for i in range(len(s_x)):
x_cou.append(s_x[i].count("F"))
for j in range(len(s_y)):
... | s = [len(w) for w in input().split("T")]
x,y = list(map(int,input().split()))
lisx = s[2::2]
lisy = s[1::2]
nowx = {s[0]}
nowy = {0}
for x1 in lisx:
gone = set()
for x2 in nowx:
gone.add(x2 + x1)
gone.add(x2 - x1)
nowx = gone
for y1 in lisy:
gone = set()
for y2 in nowy:
gone... | 44 | 26 | 992 | 428 | s = eval(input())
x, y = list(map(int, input().split()))
s = s.split("T")
s_x = []
s_y = []
for i in range(0, len(s), 2):
s_x.append(s[i])
for i in range(1, len(s), 2):
s_y.append(s[i])
x_cou = []
y_cou = []
for i in range(len(s_x)):
x_cou.append(s_x[i].count("F"))
for j in range(len(s_y)):
y_cou.append... | s = [len(w) for w in input().split("T")]
x, y = list(map(int, input().split()))
lisx = s[2::2]
lisy = s[1::2]
nowx = {s[0]}
nowy = {0}
for x1 in lisx:
gone = set()
for x2 in nowx:
gone.add(x2 + x1)
gone.add(x2 - x1)
nowx = gone
for y1 in lisy:
gone = set()
for y2 in nowy:
gon... | false | 40.909091 | [
"-s = eval(input())",
"+s = [len(w) for w in input().split(\"T\")]",
"-s = s.split(\"T\")",
"-s_x = []",
"-s_y = []",
"-for i in range(0, len(s), 2):",
"- s_x.append(s[i])",
"-for i in range(1, len(s), 2):",
"- s_y.append(s[i])",
"-x_cou = []",
"-y_cou = []",
"-for i in range(len(s_x)):"... | false | 0.037863 | 0.107289 | 0.352909 | [
"s947356486",
"s351064387"
] |
u626337957 | p02573 | python | s169024687 | s961628628 | 613 | 418 | 123,804 | 79,304 | Accepted | Accepted | 31.81 | from collections import deque
N, M = list(map(int, input().split()))
friends = [[] for _ in range(N+1)]
for __ in range(M):
a, b = list(map(int, input().split()))
friends[a].append(b)
friends[b].append(a)
checked = [0 for ___ in range(N+1)]
answer = 1
for i in range(1, N+1):
friend = deque(friends[i... | class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
... | 25 | 56 | 568 | 1,413 | from collections import deque
N, M = list(map(int, input().split()))
friends = [[] for _ in range(N + 1)]
for __ in range(M):
a, b = list(map(int, input().split()))
friends[a].append(b)
friends[b].append(a)
checked = [0 for ___ in range(N + 1)]
answer = 1
for i in range(1, N + 1):
friend = deque(friend... | class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = se... | false | 55.357143 | [
"-from collections import deque",
"+class UnionFind:",
"+ def __init__(self, n):",
"+ self.n = n",
"+ self.parents = [-1] * n",
"+",
"+ def find(self, x):",
"+ if self.parents[x] < 0:",
"+ return x",
"+ else:",
"+ self.parents[x] = self.fin... | false | 0.038224 | 0.089052 | 0.42923 | [
"s169024687",
"s961628628"
] |
u896741788 | p02767 | python | s623692138 | s016328168 | 20 | 18 | 2,940 | 3,060 | Accepted | Accepted | 10 | n=int(eval(input()))
l=list(map(int,input().split()))
ans=float("inf")
for i in range(1,101):
ans=min(ans,sum([(c-i)**2 for c in l]))
print(ans) | import sys
input=sys.stdin.readline
n=int(eval(input()))
l=list(map(int,input().split()))
d=sum(l)//n
def dis(x):
global l;ret=0
for i in l:
ret+=(x-i)**2
return ret
print((min(dis(d),dis(d+1)))) | 7 | 12 | 147 | 219 | n = int(eval(input()))
l = list(map(int, input().split()))
ans = float("inf")
for i in range(1, 101):
ans = min(ans, sum([(c - i) ** 2 for c in l]))
print(ans)
| import sys
input = sys.stdin.readline
n = int(eval(input()))
l = list(map(int, input().split()))
d = sum(l) // n
def dis(x):
global l
ret = 0
for i in l:
ret += (x - i) ** 2
return ret
print((min(dis(d), dis(d + 1))))
| false | 41.666667 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"-ans = float(\"inf\")",
"-for i in range(1, 101):",
"- ans = min(ans, sum([(c - i) ** 2 for c in l]))",
"-print(ans)",
"+d = sum(l) // n",
"+",
"+",
"+def dis(x):",
"+ global l",
"+ ret = 0",
"+ for i in l:",
"+ ret +... | false | 0.045463 | 0.0447 | 1.017076 | [
"s623692138",
"s016328168"
] |
u546285759 | p00102 | python | s095918412 | s920789353 | 30 | 20 | 7,612 | 5,620 | Accepted | Accepted | 33.33 | while True:
n = int(input())
if n == 0:
break
rows = [list(map(int, input().split())) for _ in range(n)]
for row in rows:
print("".join(map("{0:>5}".format, row)), end="")
print("{:>5}".format(sum(row)))
columns = list(zip(*rows))
print("".join(map("{0:>5}".forma... | while True:
n = int(eval(input()))
if n == 0:
break
matrix = [list(map(int, input().split())) for _ in range(n)]
for i in range(n):
sum_ = sum(matrix[i])
print((str("{:>5d}" * (n+1)).format(*matrix[i], sum_)))
sum_ = [sum(e) for e in list(zip(*matrix))]
print((st... | 11 | 11 | 432 | 359 | while True:
n = int(input())
if n == 0:
break
rows = [list(map(int, input().split())) for _ in range(n)]
for row in rows:
print("".join(map("{0:>5}".format, row)), end="")
print("{:>5}".format(sum(row)))
columns = list(zip(*rows))
print(
"".join(map("{0:>5}".forma... | while True:
n = int(eval(input()))
if n == 0:
break
matrix = [list(map(int, input().split())) for _ in range(n)]
for i in range(n):
sum_ = sum(matrix[i])
print((str("{:>5d}" * (n + 1)).format(*matrix[i], sum_)))
sum_ = [sum(e) for e in list(zip(*matrix))]
print((str("{:>5... | false | 0 | [
"- n = int(input())",
"+ n = int(eval(input()))",
"- rows = [list(map(int, input().split())) for _ in range(n)]",
"- for row in rows:",
"- print(\"\".join(map(\"{0:>5}\".format, row)), end=\"\")",
"- print(\"{:>5}\".format(sum(row)))",
"- columns = list(zip(*rows))",
"- ... | false | 0.042116 | 0.042077 | 1.000919 | [
"s095918412",
"s920789353"
] |
u254871849 | p02996 | python | s427566387 | s732824487 | 540 | 347 | 31,844 | 49,116 | Accepted | Accepted | 35.74 | # 2019-11-14 20:54:46(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
... | import sys
n, *ab = list(map(int, sys.stdin.read().split()))
ab = sorted(zip(*[iter(ab)] * 2), key=lambda x: x[1])
def main():
t = 0
for a, b in ab:
t += a
if t > b:
return 'No'
return 'Yes'
if __name__ == '__main__':
ans = main()
print(ans) | 32 | 16 | 779 | 301 | # 2019-11-14 20:54:46(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import ... | import sys
n, *ab = list(map(int, sys.stdin.read().split()))
ab = sorted(zip(*[iter(ab)] * 2), key=lambda x: x[1])
def main():
t = 0
for a, b in ab:
t += a
if t > b:
return "No"
return "Yes"
if __name__ == "__main__":
ans = main()
print(ans)
| false | 50 | [
"-# 2019-11-14 20:54:46(JST)",
"-# import collections",
"-# import math",
"-# from string import ascii_lowercase, ascii_uppercase, digits",
"-# from bisect import bisect_left as bi_l, bisect_right as bi_r",
"-# import itertools",
"-# from functools import reduce",
"-# import operator as op",
"-# fro... | false | 0.141276 | 0.036434 | 3.877622 | [
"s427566387",
"s732824487"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.