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
sequence | 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
sequence |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u078042885 | p01741 | python | s676302265 | s199650243 | 40 | 20 | 7,536 | 7,600 | Accepted | Accepted | 50 | import math
n=float(eval(input()))
print((int(n)+1 if n*math.sqrt(2)<int(n)+1 else n*math.sqrt(2))) | n=float(eval(input()))
print((int(n)+1 if n*2**0.5<int(n)+1 else n*2**0.5)) | 3 | 2 | 93 | 68 | import math
n = float(eval(input()))
print((int(n) + 1 if n * math.sqrt(2) < int(n) + 1 else n * math.sqrt(2)))
| n = float(eval(input()))
print((int(n) + 1 if n * 2**0.5 < int(n) + 1 else n * 2**0.5))
| false | 33.333333 | [
"-import math",
"-",
"-print((int(n) + 1 if n * math.sqrt(2) < int(n) + 1 else n * math.sqrt(2)))",
"+print((int(n) + 1 if n * 2**0.5 < int(n) + 1 else n * 2**0.5))"
] | false | 0.070971 | 0.075352 | 0.941852 | [
"s676302265",
"s199650243"
] |
u411858517 | p03290 | python | s040153155 | s641738793 | 52 | 37 | 3,188 | 3,188 | Accepted | Accepted | 28.85 | import itertools
D, G = list(map(int, input().split()))
L = [list(map(int, input().split())) for _ in range(D)]
num = D #生成するビット数
bit_list = list(itertools.product([0, 1], repeat=num))
tmp = 10 ** 6
for bit in bit_list:
count = 0
num = 0
for i in range(D):
if bit[i] == 1:
count += L[i][0] *(i+1) * 100 + L[i][1]
num += L[i][0]
if count >= G:
tmp = min(num, tmp)
else:
for i in range(1, D+1):
if bit[D-i] == 0:
for j in range(L[D-i][0]):
count += (D-i+1) * 100
num += 1
if count >= G:
break
break
if count >= G:
tmp = min(num, tmp)
print(tmp) | import itertools
def solve(D, G, problems):
bit_list = list(itertools.product([0, 1], repeat=D))
result_count = 10 ** 8
for pattern in bit_list:
score = 0 # スコアの合計
count = 0 # 解いた問題数
for i in range(D):
if pattern[i] == 1: # ビット値が1の難易度の問題は全て解く
score += problems[i][0] * (i+1) * 100 + problems[i][1] # 問題のスコア + ボーナス点
count += problems[i][0]
else:
max_score_problem = i
# 合計スコアが足りない場合,もっともスコアの高い未着手の問題を必要な分だけ解く
if score < G:
for i in range(problems[max_score_problem][0]):
count += 1
score += (max_score_problem + 1) * 100
if score >= G:
break
if score >= G:
result_count = min(result_count, count)
print(result_count)
if __name__ == '__main__':
D, G = list(map(int, input().split()))
problems = [list(map(int, input().split())) for _ in range(D)]
solve(D, G, problems) | 34 | 35 | 840 | 1,088 | import itertools
D, G = list(map(int, input().split()))
L = [list(map(int, input().split())) for _ in range(D)]
num = D # 生成するビット数
bit_list = list(itertools.product([0, 1], repeat=num))
tmp = 10**6
for bit in bit_list:
count = 0
num = 0
for i in range(D):
if bit[i] == 1:
count += L[i][0] * (i + 1) * 100 + L[i][1]
num += L[i][0]
if count >= G:
tmp = min(num, tmp)
else:
for i in range(1, D + 1):
if bit[D - i] == 0:
for j in range(L[D - i][0]):
count += (D - i + 1) * 100
num += 1
if count >= G:
break
break
if count >= G:
tmp = min(num, tmp)
print(tmp)
| import itertools
def solve(D, G, problems):
bit_list = list(itertools.product([0, 1], repeat=D))
result_count = 10**8
for pattern in bit_list:
score = 0 # スコアの合計
count = 0 # 解いた問題数
for i in range(D):
if pattern[i] == 1: # ビット値が1の難易度の問題は全て解く
score += (
problems[i][0] * (i + 1) * 100 + problems[i][1]
) # 問題のスコア + ボーナス点
count += problems[i][0]
else:
max_score_problem = i
# 合計スコアが足りない場合,もっともスコアの高い未着手の問題を必要な分だけ解く
if score < G:
for i in range(problems[max_score_problem][0]):
count += 1
score += (max_score_problem + 1) * 100
if score >= G:
break
if score >= G:
result_count = min(result_count, count)
print(result_count)
if __name__ == "__main__":
D, G = list(map(int, input().split()))
problems = [list(map(int, input().split())) for _ in range(D)]
solve(D, G, problems)
| false | 2.857143 | [
"-D, G = list(map(int, input().split()))",
"-L = [list(map(int, input().split())) for _ in range(D)]",
"-num = D # 生成するビット数",
"-bit_list = list(itertools.product([0, 1], repeat=num))",
"-tmp = 10**6",
"-for bit in bit_list:",
"- count = 0",
"- num = 0",
"- for i in range(D):",
"- if bit[i] == 1:",
"- count += L[i][0] * (i + 1) * 100 + L[i][1]",
"- num += L[i][0]",
"- if count >= G:",
"- tmp = min(num, tmp)",
"- else:",
"- for i in range(1, D + 1):",
"- if bit[D - i] == 0:",
"- for j in range(L[D - i][0]):",
"- count += (D - i + 1) * 100",
"- num += 1",
"- if count >= G:",
"- break",
"- break",
"- if count >= G:",
"- tmp = min(num, tmp)",
"-print(tmp)",
"+",
"+def solve(D, G, problems):",
"+ bit_list = list(itertools.product([0, 1], repeat=D))",
"+ result_count = 10**8",
"+ for pattern in bit_list:",
"+ score = 0 # スコアの合計",
"+ count = 0 # 解いた問題数",
"+ for i in range(D):",
"+ if pattern[i] == 1: # ビット値が1の難易度の問題は全て解く",
"+ score += (",
"+ problems[i][0] * (i + 1) * 100 + problems[i][1]",
"+ ) # 問題のスコア + ボーナス点",
"+ count += problems[i][0]",
"+ else:",
"+ max_score_problem = i",
"+ # 合計スコアが足りない場合,もっともスコアの高い未着手の問題を必要な分だけ解く",
"+ if score < G:",
"+ for i in range(problems[max_score_problem][0]):",
"+ count += 1",
"+ score += (max_score_problem + 1) * 100",
"+ if score >= G:",
"+ break",
"+ if score >= G:",
"+ result_count = min(result_count, count)",
"+ print(result_count)",
"+",
"+",
"+if __name__ == \"__main__\":",
"+ D, G = list(map(int, input().split()))",
"+ problems = [list(map(int, input().split())) for _ in range(D)]",
"+ solve(D, G, problems)"
] | false | 0.037761 | 0.039442 | 0.957377 | [
"s040153155",
"s641738793"
] |
u873134970 | p02971 | python | s495096499 | s249678483 | 667 | 535 | 23,232 | 15,548 | Accepted | Accepted | 19.79 | import numpy as np
n=int(eval(input()))
a=[int(eval(input())) for i in range(n)]
a_=sorted(a)
m=max(a)
for i in range(n):
if a[i]!=m:
print(m)
else:
print((a_[-2])) |
n=int(eval(input()))
a=[int(eval(input())) for i in range(n)]
a_=sorted(a)
m=a_[-1]
for i in range(n):
if a[i]!=m:
print(m)
else:
print((a_[-2])) | 10 | 10 | 171 | 153 | import numpy as np
n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
a_ = sorted(a)
m = max(a)
for i in range(n):
if a[i] != m:
print(m)
else:
print((a_[-2]))
| n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
a_ = sorted(a)
m = a_[-1]
for i in range(n):
if a[i] != m:
print(m)
else:
print((a_[-2]))
| false | 0 | [
"-import numpy as np",
"-",
"-m = max(a)",
"+m = a_[-1]"
] | false | 0.047639 | 0.046999 | 1.013629 | [
"s495096499",
"s249678483"
] |
u562935282 | p02603 | python | s483918067 | s025695484 | 34 | 26 | 9,028 | 9,128 | Accepted | Accepted | 23.53 | def main():
N = int(eval(input()))
*A, = list(map(int, input().split()))
money = 1000
low = A[0]
p = A[0]
for x in A:
if p > x:
money += (p - low) * (money // low)
low = x
p = x
money += (p - low) * (money // low)
print(money)
if __name__ == '__main__':
main()
| def main():
_ = int(eval(input()))
*A, = list(map(int, input().split()))
A += [0]
money = 1000
stock = 0
for a, b in zip(A, A[1:]):
money += stock * a
stock = 0
if a < b:
buy, rest = divmod(money, a)
stock = buy
money = rest
print(money)
if __name__ == '__main__':
main()
| 21 | 19 | 351 | 373 | def main():
N = int(eval(input()))
(*A,) = list(map(int, input().split()))
money = 1000
low = A[0]
p = A[0]
for x in A:
if p > x:
money += (p - low) * (money // low)
low = x
p = x
money += (p - low) * (money // low)
print(money)
if __name__ == "__main__":
main()
| def main():
_ = int(eval(input()))
(*A,) = list(map(int, input().split()))
A += [0]
money = 1000
stock = 0
for a, b in zip(A, A[1:]):
money += stock * a
stock = 0
if a < b:
buy, rest = divmod(money, a)
stock = buy
money = rest
print(money)
if __name__ == "__main__":
main()
| false | 9.52381 | [
"- N = int(eval(input()))",
"+ _ = int(eval(input()))",
"+ A += [0]",
"- low = A[0]",
"- p = A[0]",
"- for x in A:",
"- if p > x:",
"- money += (p - low) * (money // low)",
"- low = x",
"- p = x",
"- money += (p - low) * (money // low)",
"+ stock = 0",
"+ for a, b in zip(A, A[1:]):",
"+ money += stock * a",
"+ stock = 0",
"+ if a < b:",
"+ buy, rest = divmod(money, a)",
"+ stock = buy",
"+ money = rest"
] | false | 0.045118 | 0.045251 | 0.99705 | [
"s483918067",
"s025695484"
] |
u539281377 | p02707 | python | s477204476 | s210742543 | 162 | 132 | 32,364 | 25,984 | Accepted | Accepted | 18.52 | N=int(eval(input()))
A=list(map(int,input().split()))
P=[0]*N
for i in range(N-1):
P[A[i]-1]+=1
for i in range(N):
print((P[i]))
| N=int(eval(input()))
n=[0]*N
for i in input().split():
n[int(i)-1]+=1
print((*n)) | 7 | 5 | 135 | 81 | N = int(eval(input()))
A = list(map(int, input().split()))
P = [0] * N
for i in range(N - 1):
P[A[i] - 1] += 1
for i in range(N):
print((P[i]))
| N = int(eval(input()))
n = [0] * N
for i in input().split():
n[int(i) - 1] += 1
print((*n))
| false | 28.571429 | [
"-A = list(map(int, input().split()))",
"-P = [0] * N",
"-for i in range(N - 1):",
"- P[A[i] - 1] += 1",
"-for i in range(N):",
"- print((P[i]))",
"+n = [0] * N",
"+for i in input().split():",
"+ n[int(i) - 1] += 1",
"+print((*n))"
] | false | 0.048141 | 0.045602 | 1.055679 | [
"s477204476",
"s210742543"
] |
u102278909 | p02843 | python | s515824316 | s461433734 | 265 | 211 | 65,284 | 43,504 | Accepted | Accepted | 20.38 | # coding: utf-8
import sys
import math
import collections
import itertools
from inspect import currentframe
INF = 10 ** 10
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(eval(input()))
def MI() : return list(map(int, input().split()))
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(eval(input())) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def chkprint(*args) : names = {id(v):k for k,v in list(currentframe().f_back.f_locals.items())}; print((', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args)))
K = I()
N = 6
a = [100,101,102,103,104,105]
m = [1000000 for i in range(N)]
# initialize
dp = [0 if i==0 else -1 for i in range(K + 1)]
# DP
for i in range(N):
dp_tmp = []
for j in range(K + 1):
if (dp[j] >= 0):
dp_next = m[i]
elif ((j < a[i]) or (dp_tmp[j-a[i]] <= 0)):
dp_next = -1
else:
dp_next = dp_tmp[j-a[i]] - 1
dp_tmp.append(dp_next)
dp = dp_tmp
if dp[-1] >= 0:
print((1))
else:
print((0))
| # coding: utf-8
import sys
import math
import collections
import itertools
from inspect import currentframe
INF = 10 ** 10
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(eval(input()))
def MI() : return list(map(int, input().split()))
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(eval(input())) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def chkprint(*args) : names = {id(v):k for k,v in list(currentframe().f_back.f_locals.items())}; print((', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args)))
X = I()
for i in range(X):
if i * 100 <= X and X <= i * 105:
print((1))
break
else:
print((0))
| 46 | 27 | 1,245 | 855 | # coding: utf-8
import sys
import math
import collections
import itertools
from inspect import currentframe
INF = 10**10
MOD = 10**9 + 7
def input():
return sys.stdin.readline().strip()
def gcd(x, y):
return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y):
return (x * y) // gcd(x, y)
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return [int(x) for x in input().split()]
def RI(N):
return [int(eval(input())) for _ in range(N)]
def LRI(N):
return [[int(x) for x in input().split()] for _ in range(N)]
def chkprint(*args):
names = {id(v): k for k, v in list(currentframe().f_back.f_locals.items())}
print((", ".join(names.get(id(arg), "???") + " = " + repr(arg) for arg in args)))
K = I()
N = 6
a = [100, 101, 102, 103, 104, 105]
m = [1000000 for i in range(N)]
# initialize
dp = [0 if i == 0 else -1 for i in range(K + 1)]
# DP
for i in range(N):
dp_tmp = []
for j in range(K + 1):
if dp[j] >= 0:
dp_next = m[i]
elif (j < a[i]) or (dp_tmp[j - a[i]] <= 0):
dp_next = -1
else:
dp_next = dp_tmp[j - a[i]] - 1
dp_tmp.append(dp_next)
dp = dp_tmp
if dp[-1] >= 0:
print((1))
else:
print((0))
| # coding: utf-8
import sys
import math
import collections
import itertools
from inspect import currentframe
INF = 10**10
MOD = 10**9 + 7
def input():
return sys.stdin.readline().strip()
def gcd(x, y):
return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y):
return (x * y) // gcd(x, y)
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return [int(x) for x in input().split()]
def RI(N):
return [int(eval(input())) for _ in range(N)]
def LRI(N):
return [[int(x) for x in input().split()] for _ in range(N)]
def chkprint(*args):
names = {id(v): k for k, v in list(currentframe().f_back.f_locals.items())}
print((", ".join(names.get(id(arg), "???") + " = " + repr(arg) for arg in args)))
X = I()
for i in range(X):
if i * 100 <= X and X <= i * 105:
print((1))
break
else:
print((0))
| false | 41.304348 | [
"-K = I()",
"-N = 6",
"-a = [100, 101, 102, 103, 104, 105]",
"-m = [1000000 for i in range(N)]",
"-# initialize",
"-dp = [0 if i == 0 else -1 for i in range(K + 1)]",
"-# DP",
"-for i in range(N):",
"- dp_tmp = []",
"- for j in range(K + 1):",
"- if dp[j] >= 0:",
"- dp_next = m[i]",
"- elif (j < a[i]) or (dp_tmp[j - a[i]] <= 0):",
"- dp_next = -1",
"- else:",
"- dp_next = dp_tmp[j - a[i]] - 1",
"- dp_tmp.append(dp_next)",
"- dp = dp_tmp",
"-if dp[-1] >= 0:",
"- print((1))",
"+X = I()",
"+for i in range(X):",
"+ if i * 100 <= X and X <= i * 105:",
"+ print((1))",
"+ break"
] | false | 0.056153 | 0.062666 | 0.89607 | [
"s515824316",
"s461433734"
] |
u761320129 | p03345 | python | s890685284 | s894757833 | 20 | 18 | 3,316 | 2,940 | Accepted | Accepted | 10 | A,B,C,K = list(map(int,input().split()))
print((B-A if K%2 else A-B))
| A,B,C,K = list(map(int,input().split()))
if K%2:
print((B-A))
else:
print((A-B)) | 3 | 5 | 65 | 82 | A, B, C, K = list(map(int, input().split()))
print((B - A if K % 2 else A - B))
| A, B, C, K = list(map(int, input().split()))
if K % 2:
print((B - A))
else:
print((A - B))
| false | 40 | [
"-print((B - A if K % 2 else A - B))",
"+if K % 2:",
"+ print((B - A))",
"+else:",
"+ print((A - B))"
] | false | 0.229666 | 0.105363 | 2.179759 | [
"s890685284",
"s894757833"
] |
u773265208 | p02948 | python | s253018696 | s910244670 | 553 | 511 | 34,152 | 18,352 | Accepted | Accepted | 7.59 | import sys
import heapq
s = sys.stdin.readlines()
n,m = list(map(int,s[0].split()))
a = []
b = []
l = []
ans = 0
count = 0
for i in range(1,n+1):
a_dash,b_dash = list(map(int,s[i].split()))
a.append(-a_dash)
b.append(-b_dash)
c = list(zip(a,b))
c = sorted(c,reverse=True)
a,b = list(zip(*c))
a_length = len(a)
for i in reversed(list(range(m))):
for j in range(count,a_length):
if -a[j] + i == m:
heapq.heappush(l,b[j])
count += 1
else:
break
if len(l) != 0:
maximum = heapq.heappop(l)
ans += maximum
print((-ans))
| n,m = list(map(int,input().split()))
ab = [[] for _ in range(10**5)]
for i in range(n):
a,b = list(map(int,input().split()))
a -= 1
ab[a].append(b)
import heapq
q = []
heapq.heapify(q)
ans = 0
for i in range(m):
if len(ab[i]) != 0:
for j in range(len(ab[i])):
heapq.heappush(q,-1*ab[i][j])
if len(q) != 0:
ans += -1 * heapq.heappop(q)
print(ans)
| 33 | 21 | 541 | 370 | import sys
import heapq
s = sys.stdin.readlines()
n, m = list(map(int, s[0].split()))
a = []
b = []
l = []
ans = 0
count = 0
for i in range(1, n + 1):
a_dash, b_dash = list(map(int, s[i].split()))
a.append(-a_dash)
b.append(-b_dash)
c = list(zip(a, b))
c = sorted(c, reverse=True)
a, b = list(zip(*c))
a_length = len(a)
for i in reversed(list(range(m))):
for j in range(count, a_length):
if -a[j] + i == m:
heapq.heappush(l, b[j])
count += 1
else:
break
if len(l) != 0:
maximum = heapq.heappop(l)
ans += maximum
print((-ans))
| n, m = list(map(int, input().split()))
ab = [[] for _ in range(10**5)]
for i in range(n):
a, b = list(map(int, input().split()))
a -= 1
ab[a].append(b)
import heapq
q = []
heapq.heapify(q)
ans = 0
for i in range(m):
if len(ab[i]) != 0:
for j in range(len(ab[i])):
heapq.heappush(q, -1 * ab[i][j])
if len(q) != 0:
ans += -1 * heapq.heappop(q)
print(ans)
| false | 36.363636 | [
"-import sys",
"+n, m = list(map(int, input().split()))",
"+ab = [[] for _ in range(10**5)]",
"+for i in range(n):",
"+ a, b = list(map(int, input().split()))",
"+ a -= 1",
"+ ab[a].append(b)",
"-s = sys.stdin.readlines()",
"-n, m = list(map(int, s[0].split()))",
"-a = []",
"-b = []",
"-l = []",
"+q = []",
"+heapq.heapify(q)",
"-count = 0",
"-for i in range(1, n + 1):",
"- a_dash, b_dash = list(map(int, s[i].split()))",
"- a.append(-a_dash)",
"- b.append(-b_dash)",
"-c = list(zip(a, b))",
"-c = sorted(c, reverse=True)",
"-a, b = list(zip(*c))",
"-a_length = len(a)",
"-for i in reversed(list(range(m))):",
"- for j in range(count, a_length):",
"- if -a[j] + i == m:",
"- heapq.heappush(l, b[j])",
"- count += 1",
"- else:",
"- break",
"- if len(l) != 0:",
"- maximum = heapq.heappop(l)",
"- ans += maximum",
"-print((-ans))",
"+for i in range(m):",
"+ if len(ab[i]) != 0:",
"+ for j in range(len(ab[i])):",
"+ heapq.heappush(q, -1 * ab[i][j])",
"+ if len(q) != 0:",
"+ ans += -1 * heapq.heappop(q)",
"+print(ans)"
] | false | 0.046411 | 0.088366 | 0.525209 | [
"s253018696",
"s910244670"
] |
u912237403 | p00018 | python | s264784654 | s493104511 | 20 | 10 | 4,188 | 4,188 | Accepted | Accepted | 50 | for e in sorted(map(int,input().split()))[::-1]:
print(e, end=' ') | x=sorted(map(int,input().split()))[::-1]
for e in x:
print(e, end=' ') | 2 | 3 | 66 | 71 | for e in sorted(map(int, input().split()))[::-1]:
print(e, end=" ")
| x = sorted(map(int, input().split()))[::-1]
for e in x:
print(e, end=" ")
| false | 33.333333 | [
"-for e in sorted(map(int, input().split()))[::-1]:",
"+x = sorted(map(int, input().split()))[::-1]",
"+for e in x:"
] | false | 0.084752 | 0.128972 | 0.657136 | [
"s264784654",
"s493104511"
] |
u411203878 | p02996 | python | s613103816 | s348473677 | 1,179 | 591 | 89,176 | 114,808 | Accepted | Accepted | 49.87 | n=int(eval(input()))
ab = []
for _ in range(n):
a, b = (int(x) for x in input().split())
ab.append([a, b])
ab = sorted(ab, key=lambda x: x[1])
limit = 0
for i, j in ab:
limit += i
if j < limit:
print('No')
exit()
print('Yes') | n=int(eval(input()))
ab = []
for _ in range(n):
a, b = (int(x) for x in input().split())
ab.append([a, b])
ab = sorted(ab, key=lambda x: x[1])
memo = 0
flag = True
for a,b in ab:
memo += a
if b < memo:
flag = False
break
if flag:
print('Yes')
else:
print('No') | 15 | 18 | 267 | 312 | n = int(eval(input()))
ab = []
for _ in range(n):
a, b = (int(x) for x in input().split())
ab.append([a, b])
ab = sorted(ab, key=lambda x: x[1])
limit = 0
for i, j in ab:
limit += i
if j < limit:
print("No")
exit()
print("Yes")
| n = int(eval(input()))
ab = []
for _ in range(n):
a, b = (int(x) for x in input().split())
ab.append([a, b])
ab = sorted(ab, key=lambda x: x[1])
memo = 0
flag = True
for a, b in ab:
memo += a
if b < memo:
flag = False
break
if flag:
print("Yes")
else:
print("No")
| false | 16.666667 | [
"-limit = 0",
"-for i, j in ab:",
"- limit += i",
"- if j < limit:",
"- print(\"No\")",
"- exit()",
"-print(\"Yes\")",
"+memo = 0",
"+flag = True",
"+for a, b in ab:",
"+ memo += a",
"+ if b < memo:",
"+ flag = False",
"+ break",
"+if flag:",
"+ print(\"Yes\")",
"+else:",
"+ print(\"No\")"
] | false | 0.068805 | 0.068451 | 1.00517 | [
"s613103816",
"s348473677"
] |
u718706790 | p02784 | python | s327286485 | s661489985 | 87 | 41 | 13,964 | 13,964 | Accepted | Accepted | 52.87 | h, n = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort(reverse=True)
sum = 0
for i in a:
sum += i
if sum >= h:
print('Yes')
exit()
print('No') | h, n = list(map(int, input().split()))
a = list(map(int, input().split()))
if h - sum(a) <= 0:
print('Yes')
else:
print('No') | 13 | 7 | 190 | 130 | h, n = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort(reverse=True)
sum = 0
for i in a:
sum += i
if sum >= h:
print("Yes")
exit()
print("No")
| h, n = list(map(int, input().split()))
a = list(map(int, input().split()))
if h - sum(a) <= 0:
print("Yes")
else:
print("No")
| false | 46.153846 | [
"-a.sort(reverse=True)",
"-sum = 0",
"-for i in a:",
"- sum += i",
"- if sum >= h:",
"- print(\"Yes\")",
"- exit()",
"-print(\"No\")",
"+if h - sum(a) <= 0:",
"+ print(\"Yes\")",
"+else:",
"+ print(\"No\")"
] | false | 0.037684 | 0.046056 | 0.818212 | [
"s327286485",
"s661489985"
] |
u280853184 | p02898 | python | s393774178 | s737287134 | 62 | 55 | 9,232 | 9,232 | Accepted | Accepted | 11.29 | N,K = list(map(int,input().split()))
h = list(map(int,input().split()))
ans = 0
for i in h:
if i >= K:
ans = ans + 1
print(ans) | N,K = list(map(int,input().split()))
A = list(map(int,input().split()))
ans = 0
for i in A:
if i>=K:
ans = ans + 1
print(ans) | 9 | 7 | 144 | 132 | N, K = list(map(int, input().split()))
h = list(map(int, input().split()))
ans = 0
for i in h:
if i >= K:
ans = ans + 1
print(ans)
| N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = 0
for i in A:
if i >= K:
ans = ans + 1
print(ans)
| false | 22.222222 | [
"-h = list(map(int, input().split()))",
"+A = list(map(int, input().split()))",
"-for i in h:",
"+for i in A:"
] | false | 0.034943 | 0.035338 | 0.988812 | [
"s393774178",
"s737287134"
] |
u312025627 | p02850 | python | s787527086 | s067772487 | 404 | 372 | 97,812 | 92,584 | Accepted | Accepted | 7.92 | def main():
N = int(eval(input()))
G = [[] for _ in range(N)]
edge = [-1] * (N-1)
for i in range(N-1):
a, b = (int(i)-1 for i in input().split())
G[a].append((b, i))
G[b].append((a, i))
max_deg = max(len(G[i]) for i in range(N))
from collections import deque
def bfs(s):
que = deque([])
par = [-1]*N
que.append(s)
while que:
pos = que.popleft()
c = -1
k = 1
for (v, i) in G[pos]:
if par[pos] == v:
c = edge[i]
for (v, i) in G[pos]:
if par[pos] == v:
continue
if k == c:
k += 1
par[v] = pos
edge[i] = k
k += 1
que.append(v)
bfs(0)
print(max_deg)
for i in range(N-1):
print((edge[i]))
if __name__ == '__main__':
main()
| def main():
N = int(eval(input()))
G = [[] for _ in range(N)]
edge = [-1] * (N-1)
for i in range(N-1):
a, b = (int(i)-1 for i in input().split())
G[a].append(b*N + i)
G[b].append(a*N + i)
max_deg = max(len(G[i]) for i in range(N))
from collections import deque
def bfs(s):
que = deque([])
par = [-1]*N
que.append(s)
while que:
pos = que.popleft()
c = -1
k = 1
for vi in G[pos]:
v, i = divmod(vi, N)
if par[pos] == v:
c = edge[i]
for vi in G[pos]:
v, i = divmod(vi, N)
if par[pos] == v:
continue
if k == c:
k += 1
par[v] = pos
edge[i] = k
k += 1
que.append(v)
bfs(0)
print(max_deg)
for i in range(N-1):
print((edge[i]))
if __name__ == '__main__':
main()
| 43 | 45 | 998 | 1,068 | def main():
N = int(eval(input()))
G = [[] for _ in range(N)]
edge = [-1] * (N - 1)
for i in range(N - 1):
a, b = (int(i) - 1 for i in input().split())
G[a].append((b, i))
G[b].append((a, i))
max_deg = max(len(G[i]) for i in range(N))
from collections import deque
def bfs(s):
que = deque([])
par = [-1] * N
que.append(s)
while que:
pos = que.popleft()
c = -1
k = 1
for (v, i) in G[pos]:
if par[pos] == v:
c = edge[i]
for (v, i) in G[pos]:
if par[pos] == v:
continue
if k == c:
k += 1
par[v] = pos
edge[i] = k
k += 1
que.append(v)
bfs(0)
print(max_deg)
for i in range(N - 1):
print((edge[i]))
if __name__ == "__main__":
main()
| def main():
N = int(eval(input()))
G = [[] for _ in range(N)]
edge = [-1] * (N - 1)
for i in range(N - 1):
a, b = (int(i) - 1 for i in input().split())
G[a].append(b * N + i)
G[b].append(a * N + i)
max_deg = max(len(G[i]) for i in range(N))
from collections import deque
def bfs(s):
que = deque([])
par = [-1] * N
que.append(s)
while que:
pos = que.popleft()
c = -1
k = 1
for vi in G[pos]:
v, i = divmod(vi, N)
if par[pos] == v:
c = edge[i]
for vi in G[pos]:
v, i = divmod(vi, N)
if par[pos] == v:
continue
if k == c:
k += 1
par[v] = pos
edge[i] = k
k += 1
que.append(v)
bfs(0)
print(max_deg)
for i in range(N - 1):
print((edge[i]))
if __name__ == "__main__":
main()
| false | 4.444444 | [
"- G[a].append((b, i))",
"- G[b].append((a, i))",
"+ G[a].append(b * N + i)",
"+ G[b].append(a * N + i)",
"- for (v, i) in G[pos]:",
"+ for vi in G[pos]:",
"+ v, i = divmod(vi, N)",
"- for (v, i) in G[pos]:",
"+ for vi in G[pos]:",
"+ v, i = divmod(vi, N)"
] | false | 0.042606 | 0.007779 | 5.477148 | [
"s787527086",
"s067772487"
] |
u644907318 | p02866 | python | s862829929 | s746274505 | 235 | 151 | 62,252 | 93,040 | Accepted | Accepted | 35.74 | INFTY = 998244353
N = int(eval(input()))
D = list(map(int,input().split()))
C = {}
dmax = 0
for i in range(N):
d = D[i]
dmax = max(dmax,d)
if d not in C:
C[d] = 0
C[d] += 1
if D[0]!=0 or C[0]!=1:
flag = 1
else:
flag = 0
for i in range(dmax+1):
if i not in C:
cnt = 0
flag = 1
break
if flag==1:
cnt = 0
else:
cnt = 1
for i in range(1,dmax):
cnt = (cnt*(C[i]**C[i+1]))%INFTY
print(cnt) | p=998244353
def pow(x,m):
if m==0:
return 1
if m==1:
return x
if m%2==0:
return (pow(x,m//2)**2)%p
else:
return (x*(pow(x,(m-1)//2)**2)%p)%p
N = int(eval(input()))
D = list(map(int,input().split()))
D.insert(0,0)
C = {i:0 for i in range(N)}
for i in range(1,N+1):
C[D[i]] += 1
if C[0]!=1 or D[1]!=0:
cnt = 0
else:
ind = 0
for i in range(N):
if C[i]==0:
ind = i
break
flag = 0
if ind>0:
for i in range(ind+1,N):
if C[i]>0:
flag = 1
break
if flag==1:
cnt = 0
else:
C = sorted(list(C.items()),key=lambda x:x[0])
cnt = 1
for i in range(1,N):
if C[i][1]==0:break
c0 = C[i-1][1]
c1 = C[i][1]
cnt = (cnt*(pow(c0,c1)))%p
print(cnt) | 27 | 41 | 503 | 901 | INFTY = 998244353
N = int(eval(input()))
D = list(map(int, input().split()))
C = {}
dmax = 0
for i in range(N):
d = D[i]
dmax = max(dmax, d)
if d not in C:
C[d] = 0
C[d] += 1
if D[0] != 0 or C[0] != 1:
flag = 1
else:
flag = 0
for i in range(dmax + 1):
if i not in C:
cnt = 0
flag = 1
break
if flag == 1:
cnt = 0
else:
cnt = 1
for i in range(1, dmax):
cnt = (cnt * (C[i] ** C[i + 1])) % INFTY
print(cnt)
| p = 998244353
def pow(x, m):
if m == 0:
return 1
if m == 1:
return x
if m % 2 == 0:
return (pow(x, m // 2) ** 2) % p
else:
return (x * (pow(x, (m - 1) // 2) ** 2) % p) % p
N = int(eval(input()))
D = list(map(int, input().split()))
D.insert(0, 0)
C = {i: 0 for i in range(N)}
for i in range(1, N + 1):
C[D[i]] += 1
if C[0] != 1 or D[1] != 0:
cnt = 0
else:
ind = 0
for i in range(N):
if C[i] == 0:
ind = i
break
flag = 0
if ind > 0:
for i in range(ind + 1, N):
if C[i] > 0:
flag = 1
break
if flag == 1:
cnt = 0
else:
C = sorted(list(C.items()), key=lambda x: x[0])
cnt = 1
for i in range(1, N):
if C[i][1] == 0:
break
c0 = C[i - 1][1]
c1 = C[i][1]
cnt = (cnt * (pow(c0, c1))) % p
print(cnt)
| false | 34.146341 | [
"-INFTY = 998244353",
"+p = 998244353",
"+",
"+",
"+def pow(x, m):",
"+ if m == 0:",
"+ return 1",
"+ if m == 1:",
"+ return x",
"+ if m % 2 == 0:",
"+ return (pow(x, m // 2) ** 2) % p",
"+ else:",
"+ return (x * (pow(x, (m - 1) // 2) ** 2) % p) % p",
"+",
"+",
"-C = {}",
"-dmax = 0",
"-for i in range(N):",
"- d = D[i]",
"- dmax = max(dmax, d)",
"- if d not in C:",
"- C[d] = 0",
"- C[d] += 1",
"-if D[0] != 0 or C[0] != 1:",
"- flag = 1",
"-else:",
"- flag = 0",
"- for i in range(dmax + 1):",
"- if i not in C:",
"- cnt = 0",
"- flag = 1",
"- break",
"-if flag == 1:",
"+D.insert(0, 0)",
"+C = {i: 0 for i in range(N)}",
"+for i in range(1, N + 1):",
"+ C[D[i]] += 1",
"+if C[0] != 1 or D[1] != 0:",
"- cnt = 1",
"- for i in range(1, dmax):",
"- cnt = (cnt * (C[i] ** C[i + 1])) % INFTY",
"+ ind = 0",
"+ for i in range(N):",
"+ if C[i] == 0:",
"+ ind = i",
"+ break",
"+ flag = 0",
"+ if ind > 0:",
"+ for i in range(ind + 1, N):",
"+ if C[i] > 0:",
"+ flag = 1",
"+ break",
"+ if flag == 1:",
"+ cnt = 0",
"+ else:",
"+ C = sorted(list(C.items()), key=lambda x: x[0])",
"+ cnt = 1",
"+ for i in range(1, N):",
"+ if C[i][1] == 0:",
"+ break",
"+ c0 = C[i - 1][1]",
"+ c1 = C[i][1]",
"+ cnt = (cnt * (pow(c0, c1))) % p"
] | false | 0.039398 | 0.061042 | 0.645427 | [
"s862829929",
"s746274505"
] |
u762540523 | p02662 | python | s697547727 | s696342462 | 179 | 159 | 68,316 | 68,232 | Accepted | Accepted | 11.17 | def resolve():
n, s = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 998244353
dp = [0] * (s + 1)
dp[0] = 1
for i in a:
for j in range(s - i, -1, -1):
dp[j + i] = dp[j + i] * 2 + dp[j]
dp[j + i] %= mod
for j in range(min(i, s + 1)):
dp[j] *= 2
dp[j] %= mod
print((dp[-1]))
if __name__ == '__main__':
resolve()
| def resolve():
n, s = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 998244353
modinv = pow(2, mod - 2, mod)
dp = [0] * (s + 1)
dp[0] = pow(2, n, mod)
for i in a:
for j in range(s - i, -1, -1):
dp[j + i] += dp[j] * modinv
dp[j + i] %= mod
print((dp[-1]))
if __name__ == '__main__':
resolve()
| 18 | 16 | 444 | 396 | def resolve():
n, s = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 998244353
dp = [0] * (s + 1)
dp[0] = 1
for i in a:
for j in range(s - i, -1, -1):
dp[j + i] = dp[j + i] * 2 + dp[j]
dp[j + i] %= mod
for j in range(min(i, s + 1)):
dp[j] *= 2
dp[j] %= mod
print((dp[-1]))
if __name__ == "__main__":
resolve()
| def resolve():
n, s = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 998244353
modinv = pow(2, mod - 2, mod)
dp = [0] * (s + 1)
dp[0] = pow(2, n, mod)
for i in a:
for j in range(s - i, -1, -1):
dp[j + i] += dp[j] * modinv
dp[j + i] %= mod
print((dp[-1]))
if __name__ == "__main__":
resolve()
| false | 11.111111 | [
"+ modinv = pow(2, mod - 2, mod)",
"- dp[0] = 1",
"+ dp[0] = pow(2, n, mod)",
"- dp[j + i] = dp[j + i] * 2 + dp[j]",
"+ dp[j + i] += dp[j] * modinv",
"- for j in range(min(i, s + 1)):",
"- dp[j] *= 2",
"- dp[j] %= mod"
] | false | 0.006928 | 0.103234 | 0.067114 | [
"s697547727",
"s696342462"
] |
u796942881 | p03262 | python | s700811330 | s307579296 | 92 | 81 | 16,224 | 14,548 | Accepted | Accepted | 11.96 | from sys import stdin
from functools import reduce
# バージョン 3.4.X 以前
import fractions
# バージョン 3.4.X より 後
# import math
input = stdin.readline
N, X = list(map(int, input().split()))
xn = [abs(X - int(i)) for i in input().split()]
def main():
print((reduce(fractions.gcd, xn)))
return
main()
| from functools import reduce
def gcd(a, b):
while b:
a, b = b, a % b
return a
def gcd_n(numbers):
return reduce(gcd, numbers)
def main():
N, X, *x = list(map(int, open(0).read().split()))
x = [abs(X - int(i)) for i in x]
print((gcd_n(x)))
return
main()
| 20 | 21 | 315 | 309 | from sys import stdin
from functools import reduce
# バージョン 3.4.X 以前
import fractions
# バージョン 3.4.X より 後
# import math
input = stdin.readline
N, X = list(map(int, input().split()))
xn = [abs(X - int(i)) for i in input().split()]
def main():
print((reduce(fractions.gcd, xn)))
return
main()
| from functools import reduce
def gcd(a, b):
while b:
a, b = b, a % b
return a
def gcd_n(numbers):
return reduce(gcd, numbers)
def main():
N, X, *x = list(map(int, open(0).read().split()))
x = [abs(X - int(i)) for i in x]
print((gcd_n(x)))
return
main()
| false | 4.761905 | [
"-from sys import stdin",
"-# バージョン 3.4.X 以前",
"-import fractions",
"-# バージョン 3.4.X より 後",
"-# import math",
"-input = stdin.readline",
"-N, X = list(map(int, input().split()))",
"-xn = [abs(X - int(i)) for i in input().split()]",
"+def gcd(a, b):",
"+ while b:",
"+ a, b = b, a % b",
"+ return a",
"+",
"+",
"+def gcd_n(numbers):",
"+ return reduce(gcd, numbers)",
"- print((reduce(fractions.gcd, xn)))",
"+ N, X, *x = list(map(int, open(0).read().split()))",
"+ x = [abs(X - int(i)) for i in x]",
"+ print((gcd_n(x)))"
] | false | 0.049813 | 0.046463 | 1.072106 | [
"s700811330",
"s307579296"
] |
u738898077 | p02785 | python | s351461402 | s509435662 | 198 | 153 | 25,740 | 26,016 | Accepted | Accepted | 22.73 | import math
n,k = list(map(int,input().split()))
als = list(map(int,input().split()))
als.sort(reverse=1)
ans = 0
for i in range(k,n):
ans += als[i]
print(ans)
| n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
a.sort(reverse=1)
print((sum(a[k:])))
| 9 | 4 | 167 | 105 | import math
n, k = list(map(int, input().split()))
als = list(map(int, input().split()))
als.sort(reverse=1)
ans = 0
for i in range(k, n):
ans += als[i]
print(ans)
| n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort(reverse=1)
print((sum(a[k:])))
| false | 55.555556 | [
"-import math",
"-",
"-als = list(map(int, input().split()))",
"-als.sort(reverse=1)",
"-ans = 0",
"-for i in range(k, n):",
"- ans += als[i]",
"-print(ans)",
"+a = list(map(int, input().split()))",
"+a.sort(reverse=1)",
"+print((sum(a[k:])))"
] | false | 0.04611 | 0.043412 | 1.062166 | [
"s351461402",
"s509435662"
] |
u569960318 | p02401 | python | s262693904 | s066781681 | 30 | 20 | 7,664 | 7,604 | Accepted | Accepted | 33.33 | while True:
a,op,b=input().split()
if op=='?': break
elif op=='+': print(( int(a) + int(b) ))
elif op=='-': print(( int(a) - int(b) ))
elif op=='*': print(( int(a) * int(b) ))
elif op=='/': print(( int(a) // int(b) )) | while True:
a,op,b=input().split()
if op=='?': break
eval("print( int(int(a) {0} int(b)) )".format(op)) | 7 | 4 | 242 | 118 | while True:
a, op, b = input().split()
if op == "?":
break
elif op == "+":
print((int(a) + int(b)))
elif op == "-":
print((int(a) - int(b)))
elif op == "*":
print((int(a) * int(b)))
elif op == "/":
print((int(a) // int(b)))
| while True:
a, op, b = input().split()
if op == "?":
break
eval("print( int(int(a) {0} int(b)) )".format(op))
| false | 42.857143 | [
"- elif op == \"+\":",
"- print((int(a) + int(b)))",
"- elif op == \"-\":",
"- print((int(a) - int(b)))",
"- elif op == \"*\":",
"- print((int(a) * int(b)))",
"- elif op == \"/\":",
"- print((int(a) // int(b)))",
"+ eval(\"print( int(int(a) {0} int(b)) )\".format(op))"
] | false | 0.047531 | 0.044175 | 1.075982 | [
"s262693904",
"s066781681"
] |
u488178971 | p03478 | python | s662556457 | s141692804 | 46 | 33 | 3,060 | 2,940 | Accepted | Accepted | 28.26 | #083 B
N,A,B =list(map(int,input().split()))
ans = 0
for i in range(N+1):
tmp=0
for j in range(len(str(i))):
tmp+=int(str(i)[j])
if A<=tmp<=B:
ans +=i
print(ans) | # B - Some Sums
N,A,B= list(map(int,input().split()))
cnt = 0
for n in range(1,N+1):
tmp = sum([int(i) for i in str(n)])
if A<=tmp and tmp <= B:
cnt+=n
print(cnt) | 11 | 8 | 194 | 179 | # 083 B
N, A, B = list(map(int, input().split()))
ans = 0
for i in range(N + 1):
tmp = 0
for j in range(len(str(i))):
tmp += int(str(i)[j])
if A <= tmp <= B:
ans += i
print(ans)
| # B - Some Sums
N, A, B = list(map(int, input().split()))
cnt = 0
for n in range(1, N + 1):
tmp = sum([int(i) for i in str(n)])
if A <= tmp and tmp <= B:
cnt += n
print(cnt)
| false | 27.272727 | [
"-# 083 B",
"+# B - Some Sums",
"-ans = 0",
"-for i in range(N + 1):",
"- tmp = 0",
"- for j in range(len(str(i))):",
"- tmp += int(str(i)[j])",
"- if A <= tmp <= B:",
"- ans += i",
"-print(ans)",
"+cnt = 0",
"+for n in range(1, N + 1):",
"+ tmp = sum([int(i) for i in str(n)])",
"+ if A <= tmp and tmp <= B:",
"+ cnt += n",
"+print(cnt)"
] | false | 0.049053 | 0.085188 | 0.575823 | [
"s662556457",
"s141692804"
] |
u616169109 | p02947 | python | s177056088 | s220240743 | 1,921 | 335 | 98,464 | 19,472 | Accepted | Accepted | 82.56 | import collections
import sys
N = int(eval(input()))
s = [sorted(collections.Counter(sys.stdin.readline().rstrip()).items()) for _ in range(N)]
counted = {}
for s_count in s:
if str(s_count) not in counted:
counted[str(s_count)] = 1
else:
counted[str(s_count)] += 1
count = 0
for n in list(counted.values()):
count += n * (n - 1) // 2
print(count) | n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
for i in range(n):
s[i] = ''.join(sorted(s[i]))
t = {}
for i in range(n):
if s[i] in t:
t[s[i]] += 1
else:
t[s[i]] = 1
print((sum(t[k] * (t[k] -1) // 2 for k in t))) | 19 | 11 | 406 | 236 | import collections
import sys
N = int(eval(input()))
s = [
sorted(collections.Counter(sys.stdin.readline().rstrip()).items()) for _ in range(N)
]
counted = {}
for s_count in s:
if str(s_count) not in counted:
counted[str(s_count)] = 1
else:
counted[str(s_count)] += 1
count = 0
for n in list(counted.values()):
count += n * (n - 1) // 2
print(count)
| n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
for i in range(n):
s[i] = "".join(sorted(s[i]))
t = {}
for i in range(n):
if s[i] in t:
t[s[i]] += 1
else:
t[s[i]] = 1
print((sum(t[k] * (t[k] - 1) // 2 for k in t)))
| false | 42.105263 | [
"-import collections",
"-import sys",
"-",
"-N = int(eval(input()))",
"-s = [",
"- sorted(collections.Counter(sys.stdin.readline().rstrip()).items()) for _ in range(N)",
"-]",
"-counted = {}",
"-for s_count in s:",
"- if str(s_count) not in counted:",
"- counted[str(s_count)] = 1",
"+n = int(eval(input()))",
"+s = [eval(input()) for _ in range(n)]",
"+for i in range(n):",
"+ s[i] = \"\".join(sorted(s[i]))",
"+t = {}",
"+for i in range(n):",
"+ if s[i] in t:",
"+ t[s[i]] += 1",
"- counted[str(s_count)] += 1",
"-count = 0",
"-for n in list(counted.values()):",
"- count += n * (n - 1) // 2",
"-print(count)",
"+ t[s[i]] = 1",
"+print((sum(t[k] * (t[k] - 1) // 2 for k in t)))"
] | false | 0.099154 | 0.097639 | 1.015516 | [
"s177056088",
"s220240743"
] |
u021763820 | p03835 | python | s241464402 | s872881942 | 1,845 | 1,483 | 2,940 | 2,940 | Accepted | Accepted | 19.62 | # -*- coding: utf-8 -*-
K, S = list(map(int, input().split()))
cnt = 0
for X in range(0, K+1):
for Y in range(0, K+1):
if 0<=S-X-Y and S-X-Y<=K:
cnt += 1
print(cnt) | # -*- coding: utf-8 -*-
k, s = list(map(int,input().split()))
cnt = 0
for x in range(k + 1):
for y in range(k + 1):
z = s - x - y
if (0 <= z <= k):
cnt += 1
print(cnt) | 10 | 9 | 215 | 202 | # -*- coding: utf-8 -*-
K, S = list(map(int, input().split()))
cnt = 0
for X in range(0, K + 1):
for Y in range(0, K + 1):
if 0 <= S - X - Y and S - X - Y <= K:
cnt += 1
print(cnt)
| # -*- coding: utf-8 -*-
k, s = list(map(int, input().split()))
cnt = 0
for x in range(k + 1):
for y in range(k + 1):
z = s - x - y
if 0 <= z <= k:
cnt += 1
print(cnt)
| false | 10 | [
"-K, S = list(map(int, input().split()))",
"+k, s = list(map(int, input().split()))",
"-for X in range(0, K + 1):",
"- for Y in range(0, K + 1):",
"- if 0 <= S - X - Y and S - X - Y <= K:",
"+for x in range(k + 1):",
"+ for y in range(k + 1):",
"+ z = s - x - y",
"+ if 0 <= z <= k:"
] | false | 0.082834 | 0.04325 | 1.915218 | [
"s241464402",
"s872881942"
] |
u924691798 | p02861 | python | s334937628 | s697772961 | 257 | 81 | 9,132 | 73,812 | Accepted | Accepted | 68.48 | import itertools
import math
N = int(eval(input()))
XY = [tuple(map(int, input().split())) for _ in range(N)]
cnt = 0
tot = 0
for arr in itertools.permutations(list(range(N))):
now = XY[arr[0]]
cnt += 1
for i in arr[1:]:
nex = XY[i]
tot += math.sqrt(pow(now[0]-nex[0], 2)+pow(now[1]-nex[1], 2))
print((tot/cnt))
| import itertools
import math
N = int(eval(input()))
XY = [tuple(map(int, input().split())) for _ in range(N)]
cnt = 0
tot = 0
for ptn in itertools.permutations(XY):
now = ptn[0]
cnt += 1
for nex in ptn[1:]:
tot += math.sqrt(pow(now[0]-nex[0], 2)+pow(now[1]-nex[1], 2))
now = nex
print((tot/cnt))
| 14 | 14 | 340 | 330 | import itertools
import math
N = int(eval(input()))
XY = [tuple(map(int, input().split())) for _ in range(N)]
cnt = 0
tot = 0
for arr in itertools.permutations(list(range(N))):
now = XY[arr[0]]
cnt += 1
for i in arr[1:]:
nex = XY[i]
tot += math.sqrt(pow(now[0] - nex[0], 2) + pow(now[1] - nex[1], 2))
print((tot / cnt))
| import itertools
import math
N = int(eval(input()))
XY = [tuple(map(int, input().split())) for _ in range(N)]
cnt = 0
tot = 0
for ptn in itertools.permutations(XY):
now = ptn[0]
cnt += 1
for nex in ptn[1:]:
tot += math.sqrt(pow(now[0] - nex[0], 2) + pow(now[1] - nex[1], 2))
now = nex
print((tot / cnt))
| false | 0 | [
"-for arr in itertools.permutations(list(range(N))):",
"- now = XY[arr[0]]",
"+for ptn in itertools.permutations(XY):",
"+ now = ptn[0]",
"- for i in arr[1:]:",
"- nex = XY[i]",
"+ for nex in ptn[1:]:",
"+ now = nex"
] | false | 0.008878 | 0.039483 | 0.224845 | [
"s334937628",
"s697772961"
] |
u385244248 | p02948 | python | s149585078 | s285972829 | 1,014 | 519 | 73,176 | 17,804 | Accepted | Accepted | 48.82 | import heapq
N,M = list(map(int,input().split()))
l = [tuple(map(int,input().split())) for _ in range(N)]
l = sorted(l,reverse=True)
heap = []
ans = 0
for i in range(1,M+1):
while l and l[-1][0] == i:
heapq.heappush(heap, (l.pop()[1]*(-1)))
if heap :
ans -= (heapq.heappop(heap))
print(ans)
| import heapq
N,M = list(map(int,input().split()))
l = [tuple(map(int,input().split())) for _ in range(N)]
l = sorted(l,reverse=True)
heap = []
ans = 0
for i in range(1,M+1):
while l and l[-1][0] == i:
heapq.heappush(heap, -(l.pop()[1]))
if heap :
ans -= (heapq.heappop(heap))
print(ans)
| 12 | 15 | 336 | 338 | import heapq
N, M = list(map(int, input().split()))
l = [tuple(map(int, input().split())) for _ in range(N)]
l = sorted(l, reverse=True)
heap = []
ans = 0
for i in range(1, M + 1):
while l and l[-1][0] == i:
heapq.heappush(heap, (l.pop()[1] * (-1)))
if heap:
ans -= heapq.heappop(heap)
print(ans)
| import heapq
N, M = list(map(int, input().split()))
l = [tuple(map(int, input().split())) for _ in range(N)]
l = sorted(l, reverse=True)
heap = []
ans = 0
for i in range(1, M + 1):
while l and l[-1][0] == i:
heapq.heappush(heap, -(l.pop()[1]))
if heap:
ans -= heapq.heappop(heap)
print(ans)
| false | 20 | [
"- heapq.heappush(heap, (l.pop()[1] * (-1)))",
"+ heapq.heappush(heap, -(l.pop()[1]))"
] | false | 0.046596 | 0.089612 | 0.519978 | [
"s149585078",
"s285972829"
] |
u223663729 | p04025 | python | s329655850 | s577218012 | 171 | 21 | 39,024 | 3,064 | Accepted | Accepted | 87.72 | # AtCoder Regular Contest 059
# C - いっしょ
# https://atcoder.jp/contests/arc059/tasks/arc059_a
N = int(eval(input()))
*A, = list(map(int, input().split()))
mincost = 10**10
for i in range(-100, 101):
cost = 0
for a in A:
cost += (a-i)*(a-i)
if cost < mincost:
mincost = cost
print(mincost)
| N, *A = list(map(int, open(0).read().split()))
ans = 10**10
for i in range(-100, 101):
sn = sum((a-i)*(a-i) for a in A)
if sn < ans:
ans = sn
print(ans)
| 16 | 8 | 322 | 171 | # AtCoder Regular Contest 059
# C - いっしょ
# https://atcoder.jp/contests/arc059/tasks/arc059_a
N = int(eval(input()))
(*A,) = list(map(int, input().split()))
mincost = 10**10
for i in range(-100, 101):
cost = 0
for a in A:
cost += (a - i) * (a - i)
if cost < mincost:
mincost = cost
print(mincost)
| N, *A = list(map(int, open(0).read().split()))
ans = 10**10
for i in range(-100, 101):
sn = sum((a - i) * (a - i) for a in A)
if sn < ans:
ans = sn
print(ans)
| false | 50 | [
"-# AtCoder Regular Contest 059",
"-# C - いっしょ",
"-# https://atcoder.jp/contests/arc059/tasks/arc059_a",
"-N = int(eval(input()))",
"-(*A,) = list(map(int, input().split()))",
"-mincost = 10**10",
"+N, *A = list(map(int, open(0).read().split()))",
"+ans = 10**10",
"- cost = 0",
"- for a in A:",
"- cost += (a - i) * (a - i)",
"- if cost < mincost:",
"- mincost = cost",
"-print(mincost)",
"+ sn = sum((a - i) * (a - i) for a in A)",
"+ if sn < ans:",
"+ ans = sn",
"+print(ans)"
] | false | 0.038883 | 0.03866 | 1.005781 | [
"s329655850",
"s577218012"
] |
u761320129 | p02837 | python | s194737687 | s064421066 | 149 | 81 | 3,064 | 3,064 | Accepted | Accepted | 45.64 | N = int(eval(input()))
xs = [[] for i in range(N)]
for i in range(N):
a = int(eval(input()))
for j in range(a):
x,y = list(map(int,input().split()))
xs[i].append((x-1,y))
ans = 0
for b in range(1<<N):
mujun = False
for k,z in enumerate(xs):
for x,y in z:
if b&(1<<k):
if b&(1<<x):
if y==0:
mujun = True
else:
if y==1:
mujun = True
if mujun:
break
if mujun:
break
if not mujun:
tmp = bin(b).count('1')
ans = max(ans, tmp)
print(ans) | N = int(eval(input()))
xys = [[] 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()))
xys[i].append((x-1,y))
ans = 0
for b in range(1<<N):
cnt = bin(b).count('1')
if cnt <= ans: continue
for i in range(N):
if b&(1<<i):
for x,y in xys[i]:
if y==1 and b&(1<<x): continue
if y==0 and b&(1<<x)==0: continue
break
else:
continue
break
else:
ans = cnt
print(ans) | 27 | 24 | 679 | 582 | N = int(eval(input()))
xs = [[] for i in range(N)]
for i in range(N):
a = int(eval(input()))
for j in range(a):
x, y = list(map(int, input().split()))
xs[i].append((x - 1, y))
ans = 0
for b in range(1 << N):
mujun = False
for k, z in enumerate(xs):
for x, y in z:
if b & (1 << k):
if b & (1 << x):
if y == 0:
mujun = True
else:
if y == 1:
mujun = True
if mujun:
break
if mujun:
break
if not mujun:
tmp = bin(b).count("1")
ans = max(ans, tmp)
print(ans)
| N = int(eval(input()))
xys = [[] 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()))
xys[i].append((x - 1, y))
ans = 0
for b in range(1 << N):
cnt = bin(b).count("1")
if cnt <= ans:
continue
for i in range(N):
if b & (1 << i):
for x, y in xys[i]:
if y == 1 and b & (1 << x):
continue
if y == 0 and b & (1 << x) == 0:
continue
break
else:
continue
break
else:
ans = cnt
print(ans)
| false | 11.111111 | [
"-xs = [[] for i in range(N)]",
"+xys = [[] for _ in range(N)]",
"- a = int(eval(input()))",
"- for j in range(a):",
"+ A = int(eval(input()))",
"+ for j in range(A):",
"- xs[i].append((x - 1, y))",
"+ xys[i].append((x - 1, y))",
"- mujun = False",
"- for k, z in enumerate(xs):",
"- for x, y in z:",
"- if b & (1 << k):",
"- if b & (1 << x):",
"- if y == 0:",
"- mujun = True",
"- else:",
"- if y == 1:",
"- mujun = True",
"- if mujun:",
"+ cnt = bin(b).count(\"1\")",
"+ if cnt <= ans:",
"+ continue",
"+ for i in range(N):",
"+ if b & (1 << i):",
"+ for x, y in xys[i]:",
"+ if y == 1 and b & (1 << x):",
"+ continue",
"+ if y == 0 and b & (1 << x) == 0:",
"+ continue",
"- if mujun:",
"+ else:",
"+ continue",
"- if not mujun:",
"- tmp = bin(b).count(\"1\")",
"- ans = max(ans, tmp)",
"+ else:",
"+ ans = cnt"
] | false | 0.125121 | 0.085342 | 1.466116 | [
"s194737687",
"s064421066"
] |
u694467277 | p02688 | python | s443599356 | s364419463 | 31 | 22 | 9,080 | 9,116 | Accepted | Accepted | 29.03 | n,k=list(map(int,input().split()))
LI=list(range(1,n+1))
kari=n+1
for i in range(1,k+1):
d=int(eval(input()))
li=list(map(int,input().split()))
for x in range(1,n+1):
if li.count(x)!=0:
if LI.count(x)!=0:
LI.remove(x)
print((len(LI)))
| n,k=list(map(int,input().split()))
cnt=[0]*(n)
for i in range(k):
d=int(eval(input()))
kou=list(map(int,input().split()))
for j in kou:
cnt[j-1]=1
print((cnt.count(0))) | 14 | 8 | 276 | 171 | n, k = list(map(int, input().split()))
LI = list(range(1, n + 1))
kari = n + 1
for i in range(1, k + 1):
d = int(eval(input()))
li = list(map(int, input().split()))
for x in range(1, n + 1):
if li.count(x) != 0:
if LI.count(x) != 0:
LI.remove(x)
print((len(LI)))
| n, k = list(map(int, input().split()))
cnt = [0] * (n)
for i in range(k):
d = int(eval(input()))
kou = list(map(int, input().split()))
for j in kou:
cnt[j - 1] = 1
print((cnt.count(0)))
| false | 42.857143 | [
"-LI = list(range(1, n + 1))",
"-kari = n + 1",
"-for i in range(1, k + 1):",
"+cnt = [0] * (n)",
"+for i in range(k):",
"- li = list(map(int, input().split()))",
"- for x in range(1, n + 1):",
"- if li.count(x) != 0:",
"- if LI.count(x) != 0:",
"- LI.remove(x)",
"-print((len(LI)))",
"+ kou = list(map(int, input().split()))",
"+ for j in kou:",
"+ cnt[j - 1] = 1",
"+print((cnt.count(0)))"
] | false | 0.041258 | 0.038903 | 1.060532 | [
"s443599356",
"s364419463"
] |
u279493135 | p02947 | python | s829866783 | s705350017 | 298 | 273 | 12,732 | 21,508 | Accepted | Accepted | 8.39 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
N = INT()
s = ["".join(sorted(eval(input()))) for _ in range(N)]
s.sort()
ans = 0
count = 0
tmp = ""
for i in s:
if tmp == i:
count += 1
else:
ans += count*(count+1)//2
count = 0
tmp = i
ans += count*(count+1)//2
print(ans)
| import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect
def input(): return sys.stdin.readline().strip()
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
N = INT()
s = ["".join(sorted(eval(input()))) for _ in range(N)]
dic = defaultdict(int)
for x in s:
dic[x] += 1
ans = 0
for n in list(dic.values()):
ans += n*(n-1)//2
print(ans)
| 34 | 27 | 864 | 808 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input():
return sys.stdin.readline().strip()
def INT():
return int(eval(input()))
def MAP():
return list(map(int, input().split()))
def LIST():
return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
INF = float("inf")
mod = 10**9 + 7
N = INT()
s = ["".join(sorted(eval(input()))) for _ in range(N)]
s.sort()
ans = 0
count = 0
tmp = ""
for i in s:
if tmp == i:
count += 1
else:
ans += count * (count + 1) // 2
count = 0
tmp = i
ans += count * (count + 1) // 2
print(ans)
| import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect
def input():
return sys.stdin.readline().strip()
def INT():
return int(eval(input()))
def MAP():
return list(map(int, input().split()))
def LIST():
return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
INF = float("inf")
mod = 10**9 + 7
N = INT()
s = ["".join(sorted(eval(input()))) for _ in range(N)]
dic = defaultdict(int)
for x in s:
dic[x] += 1
ans = 0
for n in list(dic.values()):
ans += n * (n - 1) // 2
print(ans)
| false | 20.588235 | [
"-from itertools import permutations, combinations, product, accumulate",
"+from itertools import permutations, combinations, product",
"+from bisect import bisect",
"-s.sort()",
"+dic = defaultdict(int)",
"+for x in s:",
"+ dic[x] += 1",
"-count = 0",
"-tmp = \"\"",
"-for i in s:",
"- if tmp == i:",
"- count += 1",
"- else:",
"- ans += count * (count + 1) // 2",
"- count = 0",
"- tmp = i",
"-ans += count * (count + 1) // 2",
"+for n in list(dic.values()):",
"+ ans += n * (n - 1) // 2"
] | false | 0.036454 | 0.034455 | 1.058028 | [
"s829866783",
"s705350017"
] |
u383416302 | p02756 | python | s459534991 | s282553219 | 1,662 | 370 | 4,516 | 4,468 | Accepted | Accepted | 77.74 | def main():
S = eval(input())
Q = int(eval(input()))
reverse = False
head = ''
tail = ''
for _ in range(Q):
query= eval(input())
if query == '1':
reverse = not reverse
head, tail = tail, head
else:
_, f, c = query.split()
if f == '1':
head = ''.join([head,c])
else:
tail = ''.join([tail,c])
if reverse:
S = S[::-1]
print((''.join([head[::-1], S, tail])))
if __name__ == "__main__":
main() | def main():
S = eval(input())
Q = int(eval(input()))
reverse = False
head = ''
tail = ''
for _ in range(Q):
query= eval(input())
if query == '1':
reverse = not reverse
head, tail = tail, head
else:
_, f, c = query.split()
if f == '1':
# head = ''.join([head,c])
head += c
else:
# tail = ''.join([tail,c])
tail += c
if reverse:
S = S[::-1]
print((''.join([head[::-1], S, tail])))
if __name__ == "__main__":
main() | 28 | 30 | 561 | 617 | def main():
S = eval(input())
Q = int(eval(input()))
reverse = False
head = ""
tail = ""
for _ in range(Q):
query = eval(input())
if query == "1":
reverse = not reverse
head, tail = tail, head
else:
_, f, c = query.split()
if f == "1":
head = "".join([head, c])
else:
tail = "".join([tail, c])
if reverse:
S = S[::-1]
print(("".join([head[::-1], S, tail])))
if __name__ == "__main__":
main()
| def main():
S = eval(input())
Q = int(eval(input()))
reverse = False
head = ""
tail = ""
for _ in range(Q):
query = eval(input())
if query == "1":
reverse = not reverse
head, tail = tail, head
else:
_, f, c = query.split()
if f == "1":
# head = ''.join([head,c])
head += c
else:
# tail = ''.join([tail,c])
tail += c
if reverse:
S = S[::-1]
print(("".join([head[::-1], S, tail])))
if __name__ == "__main__":
main()
| false | 6.666667 | [
"- head = \"\".join([head, c])",
"+ # head = ''.join([head,c])",
"+ head += c",
"- tail = \"\".join([tail, c])",
"+ # tail = ''.join([tail,c])",
"+ tail += c"
] | false | 0.112161 | 0.036428 | 3.079005 | [
"s459534991",
"s282553219"
] |
u775681539 | p03086 | python | s755818559 | s780336272 | 21 | 18 | 3,316 | 3,060 | Accepted | Accepted | 14.29 | #python3
from collections import Counter
def main():
s = eval(input())
ans = 0
cnt = 0
for i in range(len(s)):
if (s[i] == "A") | (s[i] == "T") | (s[i] == "C") | (s[i] == "G"):
cnt += 1
else:
cnt = 0
ans = max(ans, cnt)
print(ans)
main()
| #python3
def main():
s = eval(input())
ans = 0
cnt = 0
for i in range(len(s)):
if (s[i] == "A") | (s[i] == "T") | (s[i] == "C") | (s[i] == "G"):
cnt += 1
else:
cnt = 0
ans = max(ans, cnt)
print(ans)
main()
| 14 | 13 | 313 | 280 | # python3
from collections import Counter
def main():
s = eval(input())
ans = 0
cnt = 0
for i in range(len(s)):
if (s[i] == "A") | (s[i] == "T") | (s[i] == "C") | (s[i] == "G"):
cnt += 1
else:
cnt = 0
ans = max(ans, cnt)
print(ans)
main()
| # python3
def main():
s = eval(input())
ans = 0
cnt = 0
for i in range(len(s)):
if (s[i] == "A") | (s[i] == "T") | (s[i] == "C") | (s[i] == "G"):
cnt += 1
else:
cnt = 0
ans = max(ans, cnt)
print(ans)
main()
| false | 7.142857 | [
"-from collections import Counter",
"-",
"-"
] | false | 0.044282 | 0.038529 | 1.149312 | [
"s755818559",
"s780336272"
] |
u029315034 | p03286 | python | s335348811 | s415671445 | 20 | 18 | 2,940 | 2,940 | Accepted | Accepted | 10 | N = int(eval(input()))
ans = 0
if N != 0:
s = ''
while N != 0:
if N % 2 != 0:
N -= 1
s = '1' + s
else:
s = '0' + s
N //= -2
ans = s
print(ans) | n = int(eval(input()))
ans = 0
if n != 0:
s = ''
while n != 0:
if n % 2 != 0:
n -= 1
s = '1' + s
else:
s = '0' + s
n //= -2
ans = s
print(ans) | 15 | 15 | 224 | 224 | N = int(eval(input()))
ans = 0
if N != 0:
s = ""
while N != 0:
if N % 2 != 0:
N -= 1
s = "1" + s
else:
s = "0" + s
N //= -2
ans = s
print(ans)
| n = int(eval(input()))
ans = 0
if n != 0:
s = ""
while n != 0:
if n % 2 != 0:
n -= 1
s = "1" + s
else:
s = "0" + s
n //= -2
ans = s
print(ans)
| false | 0 | [
"-N = int(eval(input()))",
"+n = int(eval(input()))",
"-if N != 0:",
"+if n != 0:",
"- while N != 0:",
"- if N % 2 != 0:",
"- N -= 1",
"+ while n != 0:",
"+ if n % 2 != 0:",
"+ n -= 1",
"- N //= -2",
"+ n //= -2"
] | false | 0.044357 | 0.046797 | 0.947862 | [
"s335348811",
"s415671445"
] |
u853952087 | p04001 | python | s553731102 | s547957035 | 28 | 21 | 3,064 | 3,064 | Accepted | Accepted | 25 | s=int(eval(input()))
S=str(s)
w=len(str(s))-1
l=[]
L=[]
if w==0:
print(s)
else:
for i in range(2**w):
l.append(format(i, '0{}b'.format(w)))
for e in l:
q=[]
x=int(S[0])
for i in range(len(e)):
if e[i]=='0':
x=x*10+int(S[i+1])
else:
q.append(x)
x=int(S[i+1])
q.append(x)
L.append(sum(q))
print((sum(L))) | S=eval(input())
w=len(S)-1
l=[]
L=[]
#S一桁の時の例外処理
if w==0:
print((int(S)))
else:
for i in range(2**w):
#format(i,'0?b')で好きな長さの2進数表示にできる
l.append(format(i, '0{}b'.format(w)))
#+が入るなら区切り、入らないなら⋆10して足す
for e in l:
q=[]
x=int(S[0])
for i in range(len(e)):
if e[i]=='0':
x=x*10+int(S[i+1])
else:
q.append(x)
x=int(S[i+1])
q.append(x)
L.append(sum(q))
print((sum(L))) | 22 | 24 | 451 | 521 | s = int(eval(input()))
S = str(s)
w = len(str(s)) - 1
l = []
L = []
if w == 0:
print(s)
else:
for i in range(2**w):
l.append(format(i, "0{}b".format(w)))
for e in l:
q = []
x = int(S[0])
for i in range(len(e)):
if e[i] == "0":
x = x * 10 + int(S[i + 1])
else:
q.append(x)
x = int(S[i + 1])
q.append(x)
L.append(sum(q))
print((sum(L)))
| S = eval(input())
w = len(S) - 1
l = []
L = []
# S一桁の時の例外処理
if w == 0:
print((int(S)))
else:
for i in range(2**w):
# format(i,'0?b')で好きな長さの2進数表示にできる
l.append(format(i, "0{}b".format(w)))
# +が入るなら区切り、入らないなら⋆10して足す
for e in l:
q = []
x = int(S[0])
for i in range(len(e)):
if e[i] == "0":
x = x * 10 + int(S[i + 1])
else:
q.append(x)
x = int(S[i + 1])
q.append(x)
L.append(sum(q))
print((sum(L)))
| false | 8.333333 | [
"-s = int(eval(input()))",
"-S = str(s)",
"-w = len(str(s)) - 1",
"+S = eval(input())",
"+w = len(S) - 1",
"+# S一桁の時の例外処理",
"- print(s)",
"+ print((int(S)))",
"+ # format(i,'0?b')で好きな長さの2進数表示にできる",
"+ # +が入るなら区切り、入らないなら⋆10して足す"
] | false | 0.039811 | 0.040247 | 0.989162 | [
"s553731102",
"s547957035"
] |
u002459665 | p03338 | python | s904293882 | s095467026 | 19 | 17 | 3,064 | 3,060 | Accepted | Accepted | 10.53 | def func(s1, s2):
set1 = set(s1)
set2 = set(s2)
cnt = 0
for _ in range(len(set1)):
s = set1.pop()
if s in set2:
cnt += 1
return cnt
def main():
n = int(eval(input()))
s = eval(input())
mx = 0
for i in range(len(s) - 1):
s1 = s[:i + 1]
s2 = s[i + 1:]
ans = func(s1, s2)
if ans > mx:
mx = ans
print(mx)
if __name__ == '__main__':
main()
# print(func([1, 2, 2, 3], [2, 3, 4, 4, 1]))
| def check(s1, s2):
ss1 = set(s1)
ss2 = set(s2)
count = 0
for si in ss1:
if si in ss2:
count += 1;
return count
def main():
n = int(eval(input()))
s = eval(input())
mx = 0
for i in range(1, len(s)):
s1 = s[:i]
s2 = s[i:]
mx = max(check(s1, s2), mx)
print(mx)
if __name__ == '__main__':
main()
| 30 | 25 | 524 | 398 | def func(s1, s2):
set1 = set(s1)
set2 = set(s2)
cnt = 0
for _ in range(len(set1)):
s = set1.pop()
if s in set2:
cnt += 1
return cnt
def main():
n = int(eval(input()))
s = eval(input())
mx = 0
for i in range(len(s) - 1):
s1 = s[: i + 1]
s2 = s[i + 1 :]
ans = func(s1, s2)
if ans > mx:
mx = ans
print(mx)
if __name__ == "__main__":
main()
# print(func([1, 2, 2, 3], [2, 3, 4, 4, 1]))
| def check(s1, s2):
ss1 = set(s1)
ss2 = set(s2)
count = 0
for si in ss1:
if si in ss2:
count += 1
return count
def main():
n = int(eval(input()))
s = eval(input())
mx = 0
for i in range(1, len(s)):
s1 = s[:i]
s2 = s[i:]
mx = max(check(s1, s2), mx)
print(mx)
if __name__ == "__main__":
main()
| false | 16.666667 | [
"-def func(s1, s2):",
"- set1 = set(s1)",
"- set2 = set(s2)",
"- cnt = 0",
"- for _ in range(len(set1)):",
"- s = set1.pop()",
"- if s in set2:",
"- cnt += 1",
"- return cnt",
"+def check(s1, s2):",
"+ ss1 = set(s1)",
"+ ss2 = set(s2)",
"+ count = 0",
"+ for si in ss1:",
"+ if si in ss2:",
"+ count += 1",
"+ return count",
"- for i in range(len(s) - 1):",
"- s1 = s[: i + 1]",
"- s2 = s[i + 1 :]",
"- ans = func(s1, s2)",
"- if ans > mx:",
"- mx = ans",
"+ for i in range(1, len(s)):",
"+ s1 = s[:i]",
"+ s2 = s[i:]",
"+ mx = max(check(s1, s2), mx)",
"- # print(func([1, 2, 2, 3], [2, 3, 4, 4, 1]))"
] | false | 0.048684 | 0.054391 | 0.895079 | [
"s904293882",
"s095467026"
] |
u745561510 | p03401 | python | s481986734 | s622251482 | 261 | 226 | 13,928 | 13,920 | Accepted | Accepted | 13.41 | N = int(eval(input()))
a = list(map(int, input().split()))
a.insert(0,0)
a.append(0)
all_sum = 0
for i in range(0,N+1):
all_sum += abs(a[i+1] - a[i])
for i in range(1, N+1):
if a[i-1] <= a[i] <= a[i+1] or a[i-1] >= a[i] >= a[i+1]:
print(all_sum)
elif a[i-1] <= a[i] and a[i-1] >= a[i+1]:
#増減
print((all_sum - abs(a[i] - a[i-1]) * 2))
elif a[i-1] <= a[i] and a[i-1] <= a[i+1]:
#増減
print((all_sum - abs(a[i] - a[i+1]) * 2))
elif a[i-1] >= a[i] and a[i-1] >= a[i+1]:
#減増
print((all_sum - abs(a[i] - a[i+1]) * 2))
elif a[i-1] >= a[i] and a[i-1] <= a[i+1]:
#減増
print((all_sum - abs(a[i] - a[i-1]) * 2))
else:
print((i, "yukkuri")) | N = int(eval(input()))
a = list(map(int, input().split()))
a.insert(0,0)
a.append(0)
all_sum = 0
for i in range(0,N+1):
all_sum += abs(a[i+1] - a[i])
for i in range(1, N+1):
print((all_sum - (abs(a[i-1] - a[i]) + abs(a[i+1] - a[i])) + abs(a[i+1] - a[i-1]))) | 28 | 13 | 756 | 273 | N = int(eval(input()))
a = list(map(int, input().split()))
a.insert(0, 0)
a.append(0)
all_sum = 0
for i in range(0, N + 1):
all_sum += abs(a[i + 1] - a[i])
for i in range(1, N + 1):
if a[i - 1] <= a[i] <= a[i + 1] or a[i - 1] >= a[i] >= a[i + 1]:
print(all_sum)
elif a[i - 1] <= a[i] and a[i - 1] >= a[i + 1]:
# 増減
print((all_sum - abs(a[i] - a[i - 1]) * 2))
elif a[i - 1] <= a[i] and a[i - 1] <= a[i + 1]:
# 増減
print((all_sum - abs(a[i] - a[i + 1]) * 2))
elif a[i - 1] >= a[i] and a[i - 1] >= a[i + 1]:
# 減増
print((all_sum - abs(a[i] - a[i + 1]) * 2))
elif a[i - 1] >= a[i] and a[i - 1] <= a[i + 1]:
# 減増
print((all_sum - abs(a[i] - a[i - 1]) * 2))
else:
print((i, "yukkuri"))
| N = int(eval(input()))
a = list(map(int, input().split()))
a.insert(0, 0)
a.append(0)
all_sum = 0
for i in range(0, N + 1):
all_sum += abs(a[i + 1] - a[i])
for i in range(1, N + 1):
print(
(
all_sum
- (abs(a[i - 1] - a[i]) + abs(a[i + 1] - a[i]))
+ abs(a[i + 1] - a[i - 1])
)
)
| false | 53.571429 | [
"- if a[i - 1] <= a[i] <= a[i + 1] or a[i - 1] >= a[i] >= a[i + 1]:",
"- print(all_sum)",
"- elif a[i - 1] <= a[i] and a[i - 1] >= a[i + 1]:",
"- # 増減",
"- print((all_sum - abs(a[i] - a[i - 1]) * 2))",
"- elif a[i - 1] <= a[i] and a[i - 1] <= a[i + 1]:",
"- # 増減",
"- print((all_sum - abs(a[i] - a[i + 1]) * 2))",
"- elif a[i - 1] >= a[i] and a[i - 1] >= a[i + 1]:",
"- # 減増",
"- print((all_sum - abs(a[i] - a[i + 1]) * 2))",
"- elif a[i - 1] >= a[i] and a[i - 1] <= a[i + 1]:",
"- # 減増",
"- print((all_sum - abs(a[i] - a[i - 1]) * 2))",
"- else:",
"- print((i, \"yukkuri\"))",
"+ print(",
"+ (",
"+ all_sum",
"+ - (abs(a[i - 1] - a[i]) + abs(a[i + 1] - a[i]))",
"+ + abs(a[i + 1] - a[i - 1])",
"+ )",
"+ )"
] | false | 0.092293 | 0.090342 | 1.021594 | [
"s481986734",
"s622251482"
] |
u320121447 | p02270 | python | s637345587 | s402200952 | 770 | 650 | 9,564 | 9,560 | Accepted | Accepted | 15.58 | n, k = [int(t) for t in input().split()]
w = [int(eval(input())) for i in range(n)]
hi = sum(w)
lo = max(w)
def canMove(w, P, k):
s = 0
for i in range(len(w)):
if s + w[i] > P:
s = 0
k -= 1
if k <= 0: return False
s += w[i]
return True
P = hi
while lo < hi:
m = (lo + hi) // 2
if canMove(w, m, k):
P = m
hi = m
else:
lo = m + 1
print(P)
| n, k = [int(t) for t in input().split()]
w = [int(eval(input())) for i in range(n)]
def canMove(w, P, k):
s = 0
for i in range(len(w)):
if s + w[i] > P:
s = 0
k -= 1
if k <= 0: return False
s += w[i]
return True
hi = sum(w)
lo = max(w)
P = hi
while lo < hi:
m = (lo + hi) // 2
if canMove(w, m, k):
P = m
hi = m
else:
lo = m + 1
print(P)
| 27 | 27 | 462 | 462 | n, k = [int(t) for t in input().split()]
w = [int(eval(input())) for i in range(n)]
hi = sum(w)
lo = max(w)
def canMove(w, P, k):
s = 0
for i in range(len(w)):
if s + w[i] > P:
s = 0
k -= 1
if k <= 0:
return False
s += w[i]
return True
P = hi
while lo < hi:
m = (lo + hi) // 2
if canMove(w, m, k):
P = m
hi = m
else:
lo = m + 1
print(P)
| n, k = [int(t) for t in input().split()]
w = [int(eval(input())) for i in range(n)]
def canMove(w, P, k):
s = 0
for i in range(len(w)):
if s + w[i] > P:
s = 0
k -= 1
if k <= 0:
return False
s += w[i]
return True
hi = sum(w)
lo = max(w)
P = hi
while lo < hi:
m = (lo + hi) // 2
if canMove(w, m, k):
P = m
hi = m
else:
lo = m + 1
print(P)
| false | 0 | [
"-hi = sum(w)",
"-lo = max(w)",
"+hi = sum(w)",
"+lo = max(w)"
] | false | 0.057269 | 0.036145 | 1.584433 | [
"s637345587",
"s402200952"
] |
u797673668 | p02297 | python | s906138512 | s675888007 | 70 | 30 | 7,716 | 7,704 | Accepted | Accepted | 57.14 | n = int(eval(input()))
points = [tuple(map(int, input().split())) for _ in range(n)]
result = 0
px, py = points[0]
while points:
x, y = points.pop()
result += x * py - px * y
px, py = x, y
print((abs(result) / 2)) | n = int(eval(input()))
points = [complex(*list(map(int, input().split()))) for _ in range(n)]
result, prev = 0, points[0]
while points:
point = points.pop()
result += point.real * prev.imag - prev.real * point.imag
prev = point
print((abs(result) / 2)) | 9 | 8 | 225 | 257 | n = int(eval(input()))
points = [tuple(map(int, input().split())) for _ in range(n)]
result = 0
px, py = points[0]
while points:
x, y = points.pop()
result += x * py - px * y
px, py = x, y
print((abs(result) / 2))
| n = int(eval(input()))
points = [complex(*list(map(int, input().split()))) for _ in range(n)]
result, prev = 0, points[0]
while points:
point = points.pop()
result += point.real * prev.imag - prev.real * point.imag
prev = point
print((abs(result) / 2))
| false | 11.111111 | [
"-points = [tuple(map(int, input().split())) for _ in range(n)]",
"-result = 0",
"-px, py = points[0]",
"+points = [complex(*list(map(int, input().split()))) for _ in range(n)]",
"+result, prev = 0, points[0]",
"- x, y = points.pop()",
"- result += x * py - px * y",
"- px, py = x, y",
"+ point = points.pop()",
"+ result += point.real * prev.imag - prev.real * point.imag",
"+ prev = point"
] | false | 0.043933 | 0.037153 | 1.182477 | [
"s906138512",
"s675888007"
] |
u759412327 | p02785 | python | s602356884 | s625003911 | 151 | 109 | 26,180 | 31,544 | Accepted | Accepted | 27.81 | N,K = list(map(int,input().split()))
H = sorted(list(map(int,input().split())))
print((sum(H[:N-min(N,K)]))) | N,K = list(map(int,input().split()))
H = sorted(list(map(int,input().split())))[::-1]
print((sum(H[K:]))) | 3 | 3 | 102 | 99 | N, K = list(map(int, input().split()))
H = sorted(list(map(int, input().split())))
print((sum(H[: N - min(N, K)])))
| N, K = list(map(int, input().split()))
H = sorted(list(map(int, input().split())))[::-1]
print((sum(H[K:])))
| false | 0 | [
"-H = sorted(list(map(int, input().split())))",
"-print((sum(H[: N - min(N, K)])))",
"+H = sorted(list(map(int, input().split())))[::-1]",
"+print((sum(H[K:])))"
] | false | 0.031784 | 0.035695 | 0.890424 | [
"s602356884",
"s625003911"
] |
u098012509 | p03050 | python | s061664841 | s001078918 | 397 | 116 | 2,940 | 3,272 | Accepted | Accepted | 70.78 | N = int(eval(input()))
ans = 0
for i in range(1, N + 1):
x = (N - i) // i
if x <= i:
break
if (N - i) % i == 0:
ans += x
print(ans)
| N = int(eval(input()))
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
# divisors.sort()
return divisors
divs = make_divisors(N)
ans = 0
for d in divs:
if d == 1:
continue
m = d - 1
if N // m == N % m:
ans += m
print(ans)
| 15 | 27 | 175 | 436 | N = int(eval(input()))
ans = 0
for i in range(1, N + 1):
x = (N - i) // i
if x <= i:
break
if (N - i) % i == 0:
ans += x
print(ans)
| N = int(eval(input()))
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
# divisors.sort()
return divisors
divs = make_divisors(N)
ans = 0
for d in divs:
if d == 1:
continue
m = d - 1
if N // m == N % m:
ans += m
print(ans)
| false | 44.444444 | [
"+",
"+",
"+def make_divisors(n):",
"+ divisors = []",
"+ for i in range(1, int(n**0.5) + 1):",
"+ if n % i == 0:",
"+ divisors.append(i)",
"+ if i != n // i:",
"+ divisors.append(n // i)",
"+ # divisors.sort()",
"+ return divisors",
"+",
"+",
"+divs = make_divisors(N)",
"-for i in range(1, N + 1):",
"- x = (N - i) // i",
"- if x <= i:",
"- break",
"- if (N - i) % i == 0:",
"- ans += x",
"+for d in divs:",
"+ if d == 1:",
"+ continue",
"+ m = d - 1",
"+ if N // m == N % m:",
"+ ans += m"
] | false | 0.811389 | 0.1353 | 5.996941 | [
"s061664841",
"s001078918"
] |
u140201022 | p02393 | python | s371361581 | s868954163 | 20 | 10 | 4,188 | 4,188 | Accepted | Accepted | 50 | m=list(map(int, input().split()))
m.sort()
print(' '.join(map(str, m))) | a=list(map(int,input().split()));a.sort();print(a[0],a[1],a[2]) | 3 | 1 | 70 | 60 | m = list(map(int, input().split()))
m.sort()
print(" ".join(map(str, m)))
| a = list(map(int, input().split()))
a.sort()
print(a[0], a[1], a[2])
| false | 66.666667 | [
"-m = list(map(int, input().split()))",
"-m.sort()",
"-print(\" \".join(map(str, m)))",
"+a = list(map(int, input().split()))",
"+a.sort()",
"+print(a[0], a[1], a[2])"
] | false | 0.041157 | 0.039242 | 1.048792 | [
"s371361581",
"s868954163"
] |
u184898414 | p03170 | python | s976816260 | s726365703 | 278 | 232 | 41,836 | 45,040 | Accepted | Accepted | 16.55 | n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
dp=[0]*(k+1)
for i in range(1,k+1):
for j in a:
if i>=j and dp[i-j]==0:
dp[i]=1
break
if dp[k]:
print("First")
else:
print("Second") | n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
dp = [0 for i in range(k+1)]
dp[0]=2
for i in range(1,k+1):
l=0
for j in range(n):
if dp[i-a[j]]==2:
l=l+1
break
if l==1:
dp[i]=1
else:
dp[i]=2
if dp[k]==1:
print("First")
else:
print("Second")
| 12 | 18 | 259 | 355 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
dp = [0] * (k + 1)
for i in range(1, k + 1):
for j in a:
if i >= j and dp[i - j] == 0:
dp[i] = 1
break
if dp[k]:
print("First")
else:
print("Second")
| n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
dp = [0 for i in range(k + 1)]
dp[0] = 2
for i in range(1, k + 1):
l = 0
for j in range(n):
if dp[i - a[j]] == 2:
l = l + 1
break
if l == 1:
dp[i] = 1
else:
dp[i] = 2
if dp[k] == 1:
print("First")
else:
print("Second")
| false | 33.333333 | [
"-dp = [0] * (k + 1)",
"+dp = [0 for i in range(k + 1)]",
"+dp[0] = 2",
"- for j in a:",
"- if i >= j and dp[i - j] == 0:",
"- dp[i] = 1",
"+ l = 0",
"+ for j in range(n):",
"+ if dp[i - a[j]] == 2:",
"+ l = l + 1",
"-if dp[k]:",
"+ if l == 1:",
"+ dp[i] = 1",
"+ else:",
"+ dp[i] = 2",
"+if dp[k] == 1:"
] | false | 0.043159 | 0.049691 | 0.868535 | [
"s976816260",
"s726365703"
] |
u941753895 | p03731 | python | s433316484 | s017803979 | 147 | 127 | 26,708 | 27,756 | Accepted | Accepted | 13.61 | n,t=list(map(int,input().split()))
l=list(map(int,input().split()))
l.append(l[-1]+t)
s=0
for i in range(len(l)-1):
s+=min(l[i+1]-l[i],t)
print(s) | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
def LI(): return list(map(int,input().split()))
def I(): return int(eval(input()))
def LS(): return input().split()
def S(): return eval(input())
def main():
n,t=LI()
l=LI()
sm=0
for i in range(n-1):
a=l[i]
b=l[i+1]
if b-a>t:
sm+=t
else:
sm+=b-a
return sm+t
print((main()))
| 7 | 28 | 148 | 473 | n, t = list(map(int, input().split()))
l = list(map(int, input().split()))
l.append(l[-1] + t)
s = 0
for i in range(len(l) - 1):
s += min(l[i + 1] - l[i], t)
print(s)
| import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI():
return list(map(int, input().split()))
def I():
return int(eval(input()))
def LS():
return input().split()
def S():
return eval(input())
def main():
n, t = LI()
l = LI()
sm = 0
for i in range(n - 1):
a = l[i]
b = l[i + 1]
if b - a > t:
sm += t
else:
sm += b - a
return sm + t
print((main()))
| false | 75 | [
"-n, t = list(map(int, input().split()))",
"-l = list(map(int, input().split()))",
"-l.append(l[-1] + t)",
"-s = 0",
"-for i in range(len(l) - 1):",
"- s += min(l[i + 1] - l[i], t)",
"-print(s)",
"+import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time",
"+",
"+sys.setrecursionlimit(10**7)",
"+inf = 10**20",
"+mod = 10**9 + 7",
"+",
"+",
"+def LI():",
"+ return list(map(int, input().split()))",
"+",
"+",
"+def I():",
"+ return int(eval(input()))",
"+",
"+",
"+def LS():",
"+ return input().split()",
"+",
"+",
"+def S():",
"+ return eval(input())",
"+",
"+",
"+def main():",
"+ n, t = LI()",
"+ l = LI()",
"+ sm = 0",
"+ for i in range(n - 1):",
"+ a = l[i]",
"+ b = l[i + 1]",
"+ if b - a > t:",
"+ sm += t",
"+ else:",
"+ sm += b - a",
"+ return sm + t",
"+",
"+",
"+print((main()))"
] | false | 0.04509 | 0.008072 | 5.586119 | [
"s433316484",
"s017803979"
] |
u021019433 | p02837 | python | s689288750 | s423553431 | 63 | 58 | 3,064 | 3,064 | Accepted | Accepted | 7.94 | from itertools import combinations
n = int(eval(input()))
r = list(range(n))
a = [([], []) for _ in r]
for i in r:
for _ in range(int(eval(input()))):
x, y = list(map(int, input().split()))
a[i][y].append(x - 1)
fail = lambda x: not all(x.isdisjoint(a[i][0]) and x.issuperset(a[i][1]) for i in x)
while all(map(fail, list(map(set, combinations(r, n))))):
n -= 1
print(n)
| from itertools import combinations
n = int(eval(input()))
r = list(range(n))
a = [(set(), set()) for _ in r]
for i in r:
for _ in range(int(eval(input()))):
x, y = list(map(int, input().split()))
a[i][y].add(x - 1)
fail = lambda x: not all(a[i][0].isdisjoint(x) and a[i][1] < x for i in x)
while all(map(fail, list(map(set, combinations(r, n))))):
n -= 1
print(n)
| 15 | 15 | 370 | 366 | from itertools import combinations
n = int(eval(input()))
r = list(range(n))
a = [([], []) for _ in r]
for i in r:
for _ in range(int(eval(input()))):
x, y = list(map(int, input().split()))
a[i][y].append(x - 1)
fail = lambda x: not all(x.isdisjoint(a[i][0]) and x.issuperset(a[i][1]) for i in x)
while all(map(fail, list(map(set, combinations(r, n))))):
n -= 1
print(n)
| from itertools import combinations
n = int(eval(input()))
r = list(range(n))
a = [(set(), set()) for _ in r]
for i in r:
for _ in range(int(eval(input()))):
x, y = list(map(int, input().split()))
a[i][y].add(x - 1)
fail = lambda x: not all(a[i][0].isdisjoint(x) and a[i][1] < x for i in x)
while all(map(fail, list(map(set, combinations(r, n))))):
n -= 1
print(n)
| false | 0 | [
"-a = [([], []) for _ in r]",
"+a = [(set(), set()) for _ in r]",
"- a[i][y].append(x - 1)",
"-fail = lambda x: not all(x.isdisjoint(a[i][0]) and x.issuperset(a[i][1]) for i in x)",
"+ a[i][y].add(x - 1)",
"+fail = lambda x: not all(a[i][0].isdisjoint(x) and a[i][1] < x for i in x)"
] | false | 0.045241 | 0.047468 | 0.953097 | [
"s689288750",
"s423553431"
] |
u821251381 | p02691 | python | s212679278 | s120149126 | 314 | 194 | 59,508 | 40,312 | Accepted | Accepted | 38.22 | from collections import defaultdict
N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
R = defaultdict(int)
#R= defaultdict(lambda:0)
for i ,Ai in enumerate(A,1):
R[i+Ai]+=1
L = defaultdict(int)
for j ,Aj in enumerate(A,1):
L[j-Aj]+=1
for i in R:
ans+=R.get(i,0)*L.get(i,0)
print(ans) | n = int(eval(input()))
la = [int(i) for i in input().split()]
ia = {}
pair = 0
for j, a in enumerate(la):
ia[j + a] = ia.get(j + a, 0) + 1
for j, a in enumerate(la):
pair += ia.get(j - a, 0)
print(pair)
| 21 | 12 | 330 | 216 | from collections import defaultdict
N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
R = defaultdict(int)
# R= defaultdict(lambda:0)
for i, Ai in enumerate(A, 1):
R[i + Ai] += 1
L = defaultdict(int)
for j, Aj in enumerate(A, 1):
L[j - Aj] += 1
for i in R:
ans += R.get(i, 0) * L.get(i, 0)
print(ans)
| n = int(eval(input()))
la = [int(i) for i in input().split()]
ia = {}
pair = 0
for j, a in enumerate(la):
ia[j + a] = ia.get(j + a, 0) + 1
for j, a in enumerate(la):
pair += ia.get(j - a, 0)
print(pair)
| false | 42.857143 | [
"-from collections import defaultdict",
"-",
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-ans = 0",
"-R = defaultdict(int)",
"-# R= defaultdict(lambda:0)",
"-for i, Ai in enumerate(A, 1):",
"- R[i + Ai] += 1",
"-L = defaultdict(int)",
"-for j, Aj in enumerate(A, 1):",
"- L[j - Aj] += 1",
"-for i in R:",
"- ans += R.get(i, 0) * L.get(i, 0)",
"-print(ans)",
"+n = int(eval(input()))",
"+la = [int(i) for i in input().split()]",
"+ia = {}",
"+pair = 0",
"+for j, a in enumerate(la):",
"+ ia[j + a] = ia.get(j + a, 0) + 1",
"+for j, a in enumerate(la):",
"+ pair += ia.get(j - a, 0)",
"+print(pair)"
] | false | 0.034098 | 0.034568 | 0.986396 | [
"s212679278",
"s120149126"
] |
u882460931 | p03284 | python | s894358385 | s234888877 | 19 | 17 | 3,188 | 2,940 | Accepted | Accepted | 10.53 | import re
match = re.fullmatch(r'(?P<N>[0-9]+) (?P<K>[0-9]+)', eval(input()))
n = int(match.group('N'))
k = int(match.group('K'))
if n % k == 0:
print((0))
else:
print((1)) | split = input().split()
n = int(split[0])
k = int(split[1])
if n % k == 0:
print((0))
else:
print((1)) | 11 | 8 | 183 | 114 | import re
match = re.fullmatch(r"(?P<N>[0-9]+) (?P<K>[0-9]+)", eval(input()))
n = int(match.group("N"))
k = int(match.group("K"))
if n % k == 0:
print((0))
else:
print((1))
| split = input().split()
n = int(split[0])
k = int(split[1])
if n % k == 0:
print((0))
else:
print((1))
| false | 27.272727 | [
"-import re",
"-",
"-match = re.fullmatch(r\"(?P<N>[0-9]+) (?P<K>[0-9]+)\", eval(input()))",
"-n = int(match.group(\"N\"))",
"-k = int(match.group(\"K\"))",
"+split = input().split()",
"+n = int(split[0])",
"+k = int(split[1])"
] | false | 0.069483 | 0.04575 | 1.518744 | [
"s894358385",
"s234888877"
] |
u997521090 | p03128 | python | s416035102 | s730479279 | 225 | 134 | 15,268 | 15,796 | Accepted | Accepted | 40.44 | n,m,*a=list(map(int,open(0).read().split()))
d=[0]*n*9
for i in range(n):
for j in a:c=i+int("0255456376"[j]);d[c]=max(d[c],(d[i]*10+j)*(i<1or d[i]>0))###
print((d[n])) | n,m,*a=list(map(int,open(0).read().split()))
d=[0]*n*9+[-1]*n*9
for i in range(1,n+1):d[i]=max(d[i-int("0255456376"[j])]*10+j for j in a)
print((d[n])) | 5 | 4 | 165 | 146 | n, m, *a = list(map(int, open(0).read().split()))
d = [0] * n * 9
for i in range(n):
for j in a:
c = i + int("0255456376"[j])
d[c] = max(d[c], (d[i] * 10 + j) * (i < 1 or d[i] > 0)) ###
print((d[n]))
| n, m, *a = list(map(int, open(0).read().split()))
d = [0] * n * 9 + [-1] * n * 9
for i in range(1, n + 1):
d[i] = max(d[i - int("0255456376"[j])] * 10 + j for j in a)
print((d[n]))
| false | 20 | [
"-d = [0] * n * 9",
"-for i in range(n):",
"- for j in a:",
"- c = i + int(\"0255456376\"[j])",
"- d[c] = max(d[c], (d[i] * 10 + j) * (i < 1 or d[i] > 0)) ###",
"+d = [0] * n * 9 + [-1] * n * 9",
"+for i in range(1, n + 1):",
"+ d[i] = max(d[i - int(\"0255456376\"[j])] * 10 + j for j in a)"
] | false | 0.036848 | 0.103673 | 0.355425 | [
"s416035102",
"s730479279"
] |
u871934301 | p02678 | python | s469559230 | s774025328 | 793 | 649 | 66,476 | 37,496 | Accepted | Accepted | 18.16 | from collections import deque
mi = lambda:list(map(int,input().split()))
mix = lambda x:list(mi() for _ in range(x))
##########
def main(n,m,l):
#グラフの作成
g = creategraph(n,l)
#独立した部屋がある場合はNG
for i in range(1,len(g)):
if len(g[i]) == 0:
print("No")
return
#BFSで道標を作成
navi = bfs(n,g)
#部屋1を除く部屋の道標が更新されていなければNG
if min(navi[2:]) == 0:
print("No")
else:
print("Yes")
for i in navi[2:]:
print(i)
#BFS幅優先探索
def bfs(n,g):
navi = [0]*(n+1)
navi[1] = -1
q = deque()
q.append(1)
while len(q) > 0:
#キューから現在地を取り出す
cp = q.popleft()
#現在地の隣接点リストを取得
np = g[cp]
#隣接点が未探索ならキューに入れる+道標更新
for i in np:
if navi[i] == 0:
navi[i] = cp
q.append(i)
return navi
#各Nodeの隣接点を保持するリストを生成する
def creategraph(n,l):
g = {i:[] for i in range(n+1)}
for a,b in l:
g[a].append(b)
g[b].append(a)
return g
def resolve():
n,m = mi()
l = mix(m)
main(n,m,l)
if __name__ == "__main__":
resolve() | from collections import deque
N,M=list(map(int,input().split()))
graph=[[] for i in range(N+1)]
for i in range(M):
A,B=list(map(int,input().split()))
graph[A].append(B)
graph[B].append(A)
dist=[-1]*(N+1)
dist[0]=0
dist[1]=0
d=deque()
d.append(1)
ans=[0]*(N+1)
while d:
v=d.popleft()
for i in graph[v]:
if dist[i]!=-1:
continue
dist[i]=dist[v]+1
d.append(i)
if ans[i]!=0:
continue
ans[i]+=v
print("Yes")
for i in ans:
if i==0:
continue
print(i)
| 56 | 184 | 1,172 | 976 | from collections import deque
mi = lambda: list(map(int, input().split()))
mix = lambda x: list(mi() for _ in range(x))
##########
def main(n, m, l):
# グラフの作成
g = creategraph(n, l)
# 独立した部屋がある場合はNG
for i in range(1, len(g)):
if len(g[i]) == 0:
print("No")
return
# BFSで道標を作成
navi = bfs(n, g)
# 部屋1を除く部屋の道標が更新されていなければNG
if min(navi[2:]) == 0:
print("No")
else:
print("Yes")
for i in navi[2:]:
print(i)
# BFS幅優先探索
def bfs(n, g):
navi = [0] * (n + 1)
navi[1] = -1
q = deque()
q.append(1)
while len(q) > 0:
# キューから現在地を取り出す
cp = q.popleft()
# 現在地の隣接点リストを取得
np = g[cp]
# 隣接点が未探索ならキューに入れる+道標更新
for i in np:
if navi[i] == 0:
navi[i] = cp
q.append(i)
return navi
# 各Nodeの隣接点を保持するリストを生成する
def creategraph(n, l):
g = {i: [] for i in range(n + 1)}
for a, b in l:
g[a].append(b)
g[b].append(a)
return g
def resolve():
n, m = mi()
l = mix(m)
main(n, m, l)
if __name__ == "__main__":
resolve()
| from collections import deque
N, M = list(map(int, input().split()))
graph = [[] for i in range(N + 1)]
for i in range(M):
A, B = list(map(int, input().split()))
graph[A].append(B)
graph[B].append(A)
dist = [-1] * (N + 1)
dist[0] = 0
dist[1] = 0
d = deque()
d.append(1)
ans = [0] * (N + 1)
while d:
v = d.popleft()
for i in graph[v]:
if dist[i] != -1:
continue
dist[i] = dist[v] + 1
d.append(i)
if ans[i] != 0:
continue
ans[i] += v
print("Yes")
for i in ans:
if i == 0:
continue
print(i)
| false | 69.565217 | [
"-mi = lambda: list(map(int, input().split()))",
"-mix = lambda x: list(mi() for _ in range(x))",
"-##########",
"-def main(n, m, l):",
"- # グラフの作成",
"- g = creategraph(n, l)",
"- # 独立した部屋がある場合はNG",
"- for i in range(1, len(g)):",
"- if len(g[i]) == 0:",
"- print(\"No\")",
"- return",
"- # BFSで道標を作成",
"- navi = bfs(n, g)",
"- # 部屋1を除く部屋の道標が更新されていなければNG",
"- if min(navi[2:]) == 0:",
"- print(\"No\")",
"- else:",
"- print(\"Yes\")",
"- for i in navi[2:]:",
"- print(i)",
"-",
"-",
"-# BFS幅優先探索",
"-def bfs(n, g):",
"- navi = [0] * (n + 1)",
"- navi[1] = -1",
"- q = deque()",
"- q.append(1)",
"- while len(q) > 0:",
"- # キューから現在地を取り出す",
"- cp = q.popleft()",
"- # 現在地の隣接点リストを取得",
"- np = g[cp]",
"- # 隣接点が未探索ならキューに入れる+道標更新",
"- for i in np:",
"- if navi[i] == 0:",
"- navi[i] = cp",
"- q.append(i)",
"- return navi",
"-",
"-",
"-# 各Nodeの隣接点を保持するリストを生成する",
"-def creategraph(n, l):",
"- g = {i: [] for i in range(n + 1)}",
"- for a, b in l:",
"- g[a].append(b)",
"- g[b].append(a)",
"- return g",
"-",
"-",
"-def resolve():",
"- n, m = mi()",
"- l = mix(m)",
"- main(n, m, l)",
"-",
"-",
"-if __name__ == \"__main__\":",
"- resolve()",
"+N, M = list(map(int, input().split()))",
"+graph = [[] for i in range(N + 1)]",
"+for i in range(M):",
"+ A, B = list(map(int, input().split()))",
"+ graph[A].append(B)",
"+ graph[B].append(A)",
"+dist = [-1] * (N + 1)",
"+dist[0] = 0",
"+dist[1] = 0",
"+d = deque()",
"+d.append(1)",
"+ans = [0] * (N + 1)",
"+while d:",
"+ v = d.popleft()",
"+ for i in graph[v]:",
"+ if dist[i] != -1:",
"+ continue",
"+ dist[i] = dist[v] + 1",
"+ d.append(i)",
"+ if ans[i] != 0:",
"+ continue",
"+ ans[i] += v",
"+print(\"Yes\")",
"+for i in ans:",
"+ if i == 0:",
"+ continue",
"+ print(i)"
] | false | 0.065535 | 0.097133 | 0.674693 | [
"s469559230",
"s774025328"
] |
u797673668 | p02270 | python | s167120867 | s865759754 | 520 | 400 | 11,596 | 11,664 | Accepted | Accepted | 23.08 | def check_p(p):
global k, ws
ct, nt = 0, 1
for w in ws:
if ct + w <= p:
ct += w
else:
nt += 1
if nt > k:
return False
ct = w
return True
n, k = list(map(int, input().split()))
ws = [int(eval(input())) for _ in range(n)]
l, r, p = max(ws), sum(ws), 0
while l < r:
p = (l + r) // 2
if check_p(p):
r = p
else:
l = p = p + 1
print(p) | def check_p(p):
global k, ws
lt, nt = 0, 1 # loadage_of_current_truck, num_of_truck
for w in ws:
lt += w
if lt > p:
nt += 1
if nt > k:
return False
lt = w
return True
n, k = list(map(int, input().split()))
ws = [int(eval(input())) for _ in range(n)]
l, r, p = max(ws), sum(ws), 0
while l < r:
p = (l + r) // 2
if check_p(p):
r = p
else:
l = p = p + 1
print(p) | 27 | 26 | 472 | 490 | def check_p(p):
global k, ws
ct, nt = 0, 1
for w in ws:
if ct + w <= p:
ct += w
else:
nt += 1
if nt > k:
return False
ct = w
return True
n, k = list(map(int, input().split()))
ws = [int(eval(input())) for _ in range(n)]
l, r, p = max(ws), sum(ws), 0
while l < r:
p = (l + r) // 2
if check_p(p):
r = p
else:
l = p = p + 1
print(p)
| def check_p(p):
global k, ws
lt, nt = 0, 1 # loadage_of_current_truck, num_of_truck
for w in ws:
lt += w
if lt > p:
nt += 1
if nt > k:
return False
lt = w
return True
n, k = list(map(int, input().split()))
ws = [int(eval(input())) for _ in range(n)]
l, r, p = max(ws), sum(ws), 0
while l < r:
p = (l + r) // 2
if check_p(p):
r = p
else:
l = p = p + 1
print(p)
| false | 3.703704 | [
"- ct, nt = 0, 1",
"+ lt, nt = 0, 1 # loadage_of_current_truck, num_of_truck",
"- if ct + w <= p:",
"- ct += w",
"- else:",
"+ lt += w",
"+ if lt > p:",
"- ct = w",
"+ lt = w"
] | false | 0.038678 | 0.042615 | 0.907605 | [
"s167120867",
"s865759754"
] |
u936985471 | p03262 | python | s192059390 | s510109605 | 132 | 117 | 14,224 | 14,252 | Accepted | Accepted | 11.36 | N,X=list(map(int,input().split()))
x=list(map(int,input().split()))
x.append(X)
x=sorted(x)
dif=[0]*(len(x)-1)
for i in range(len(x)-1):
dif[i]=x[i+1]-x[i]
def gcd(a,b):
if b>a:
a,b=b,a
while True:
if a%b==0:
return b
else:
a,b=b,a%b
ans=dif[0]
for i in range(1,len(dif)):
ans=gcd(ans,dif[i])
print(ans) | n,x=list(map(int,input().split()))
p=sorted(list(map(int,input().split())))
def gcd(a,b):
if a<b:
a,b=b,a
while a%b>0:
a,b=b,a%b
return b
ans=abs(x-p[0])
for i in range(1,n):
ans=gcd(ans,p[i]-p[i-1])
print(ans) | 22 | 13 | 353 | 235 | N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
x.append(X)
x = sorted(x)
dif = [0] * (len(x) - 1)
for i in range(len(x) - 1):
dif[i] = x[i + 1] - x[i]
def gcd(a, b):
if b > a:
a, b = b, a
while True:
if a % b == 0:
return b
else:
a, b = b, a % b
ans = dif[0]
for i in range(1, len(dif)):
ans = gcd(ans, dif[i])
print(ans)
| n, x = list(map(int, input().split()))
p = sorted(list(map(int, input().split())))
def gcd(a, b):
if a < b:
a, b = b, a
while a % b > 0:
a, b = b, a % b
return b
ans = abs(x - p[0])
for i in range(1, n):
ans = gcd(ans, p[i] - p[i - 1])
print(ans)
| false | 40.909091 | [
"-N, X = list(map(int, input().split()))",
"-x = list(map(int, input().split()))",
"-x.append(X)",
"-x = sorted(x)",
"-dif = [0] * (len(x) - 1)",
"-for i in range(len(x) - 1):",
"- dif[i] = x[i + 1] - x[i]",
"+n, x = list(map(int, input().split()))",
"+p = sorted(list(map(int, input().split())))",
"- if b > a:",
"+ if a < b:",
"- while True:",
"- if a % b == 0:",
"- return b",
"- else:",
"- a, b = b, a % b",
"+ while a % b > 0:",
"+ a, b = b, a % b",
"+ return b",
"-ans = dif[0]",
"-for i in range(1, len(dif)):",
"- ans = gcd(ans, dif[i])",
"+ans = abs(x - p[0])",
"+for i in range(1, n):",
"+ ans = gcd(ans, p[i] - p[i - 1])"
] | false | 0.044986 | 0.124697 | 0.360759 | [
"s192059390",
"s510109605"
] |
u118642796 | p03576 | python | s305012989 | s420044885 | 755 | 28 | 118,068 | 3,064 | Accepted | Accepted | 96.29 | import sys
def LI(): return([int(x) for x in sys.stdin.readline().split()])
N,K = LI()
XY = [LI() for _ in range(N)]
X = []
Y = []
for x,y in XY:
if not(x in X):
X.append(x)
if not(y in Y):
Y.append(y)
X.sort()
Y.sort()
dic_XoYo = {}
dic_XcYo = {}
dic_XoYc = {}
dic_XcYc = {}
for x1 in X:
for y1 in Y:
key = x1*(10**10)+y1
cnt_XoYo = 0
cnt_XcYo = 0
cnt_XoYc = 0
cnt_XcYc = 0
for x2,y2 in XY:
if x2<=x1 and y2<=y1:
cnt_XcYc += 1
if x2<x1 and y2<=y1:
cnt_XoYc += 1
if x2<=x1 and y2<y1:
cnt_XcYo += 1
if x2<x1 and y2<y1:
cnt_XoYo += 1
dic_XcYc[key] = cnt_XcYc
dic_XoYc[key] = cnt_XoYc
dic_XcYo[key] = cnt_XcYo
dic_XoYo[key] = cnt_XoYo
ans = []
for xl in range(len(X)-1):
for xr in range(xl,len(X)):
for yd in range(len(Y)-1):
for yu in range(yd,len(Y)):
cnt = dic_XcYc[X[xr]*(10**10)+Y[yu]]
cnt -= dic_XcYo[X[xr]*(10**10)+Y[yd]]
cnt -= dic_XoYc[X[xl]*(10**10)+Y[yu]]
cnt += dic_XoYo[X[xl]*(10**10)+Y[yd]]
if cnt>=K:
ans.append((X[xr]-X[xl])*(Y[yu]-Y[yd]))
print((min(ans)))
| import sys
I = lambda:[int(x) for x in sys.stdin.readline().split()]
N,K = I()
Z = [I() for _ in range(N)]
Z.sort()
INF = 10**20
ans = INF
for i in range(N):
for j in range(i+K-1,N):
l = sorted(t[1] for t in Z[i:j+1])
ans_tmp = [(Z[j][0]-Z[i][0])*(v-u) for u,v in zip(l,l[K-1:])]
ans = min(ans,*ans_tmp)
print(ans)
| 54 | 15 | 1,219 | 359 | import sys
def LI():
return [int(x) for x in sys.stdin.readline().split()]
N, K = LI()
XY = [LI() for _ in range(N)]
X = []
Y = []
for x, y in XY:
if not (x in X):
X.append(x)
if not (y in Y):
Y.append(y)
X.sort()
Y.sort()
dic_XoYo = {}
dic_XcYo = {}
dic_XoYc = {}
dic_XcYc = {}
for x1 in X:
for y1 in Y:
key = x1 * (10**10) + y1
cnt_XoYo = 0
cnt_XcYo = 0
cnt_XoYc = 0
cnt_XcYc = 0
for x2, y2 in XY:
if x2 <= x1 and y2 <= y1:
cnt_XcYc += 1
if x2 < x1 and y2 <= y1:
cnt_XoYc += 1
if x2 <= x1 and y2 < y1:
cnt_XcYo += 1
if x2 < x1 and y2 < y1:
cnt_XoYo += 1
dic_XcYc[key] = cnt_XcYc
dic_XoYc[key] = cnt_XoYc
dic_XcYo[key] = cnt_XcYo
dic_XoYo[key] = cnt_XoYo
ans = []
for xl in range(len(X) - 1):
for xr in range(xl, len(X)):
for yd in range(len(Y) - 1):
for yu in range(yd, len(Y)):
cnt = dic_XcYc[X[xr] * (10**10) + Y[yu]]
cnt -= dic_XcYo[X[xr] * (10**10) + Y[yd]]
cnt -= dic_XoYc[X[xl] * (10**10) + Y[yu]]
cnt += dic_XoYo[X[xl] * (10**10) + Y[yd]]
if cnt >= K:
ans.append((X[xr] - X[xl]) * (Y[yu] - Y[yd]))
print((min(ans)))
| import sys
I = lambda: [int(x) for x in sys.stdin.readline().split()]
N, K = I()
Z = [I() for _ in range(N)]
Z.sort()
INF = 10**20
ans = INF
for i in range(N):
for j in range(i + K - 1, N):
l = sorted(t[1] for t in Z[i : j + 1])
ans_tmp = [(Z[j][0] - Z[i][0]) * (v - u) for u, v in zip(l, l[K - 1 :])]
ans = min(ans, *ans_tmp)
print(ans)
| false | 72.222222 | [
"-",
"-def LI():",
"- return [int(x) for x in sys.stdin.readline().split()]",
"-",
"-",
"-N, K = LI()",
"-XY = [LI() for _ in range(N)]",
"-X = []",
"-Y = []",
"-for x, y in XY:",
"- if not (x in X):",
"- X.append(x)",
"- if not (y in Y):",
"- Y.append(y)",
"-X.sort()",
"-Y.sort()",
"-dic_XoYo = {}",
"-dic_XcYo = {}",
"-dic_XoYc = {}",
"-dic_XcYc = {}",
"-for x1 in X:",
"- for y1 in Y:",
"- key = x1 * (10**10) + y1",
"- cnt_XoYo = 0",
"- cnt_XcYo = 0",
"- cnt_XoYc = 0",
"- cnt_XcYc = 0",
"- for x2, y2 in XY:",
"- if x2 <= x1 and y2 <= y1:",
"- cnt_XcYc += 1",
"- if x2 < x1 and y2 <= y1:",
"- cnt_XoYc += 1",
"- if x2 <= x1 and y2 < y1:",
"- cnt_XcYo += 1",
"- if x2 < x1 and y2 < y1:",
"- cnt_XoYo += 1",
"- dic_XcYc[key] = cnt_XcYc",
"- dic_XoYc[key] = cnt_XoYc",
"- dic_XcYo[key] = cnt_XcYo",
"- dic_XoYo[key] = cnt_XoYo",
"-ans = []",
"-for xl in range(len(X) - 1):",
"- for xr in range(xl, len(X)):",
"- for yd in range(len(Y) - 1):",
"- for yu in range(yd, len(Y)):",
"- cnt = dic_XcYc[X[xr] * (10**10) + Y[yu]]",
"- cnt -= dic_XcYo[X[xr] * (10**10) + Y[yd]]",
"- cnt -= dic_XoYc[X[xl] * (10**10) + Y[yu]]",
"- cnt += dic_XoYo[X[xl] * (10**10) + Y[yd]]",
"- if cnt >= K:",
"- ans.append((X[xr] - X[xl]) * (Y[yu] - Y[yd]))",
"-print((min(ans)))",
"+I = lambda: [int(x) for x in sys.stdin.readline().split()]",
"+N, K = I()",
"+Z = [I() for _ in range(N)]",
"+Z.sort()",
"+INF = 10**20",
"+ans = INF",
"+for i in range(N):",
"+ for j in range(i + K - 1, N):",
"+ l = sorted(t[1] for t in Z[i : j + 1])",
"+ ans_tmp = [(Z[j][0] - Z[i][0]) * (v - u) for u, v in zip(l, l[K - 1 :])]",
"+ ans = min(ans, *ans_tmp)",
"+print(ans)"
] | false | 0.114132 | 0.031995 | 3.567145 | [
"s305012989",
"s420044885"
] |
u788137651 | p03274 | python | s703247465 | s668954386 | 147 | 70 | 18,980 | 14,252 | Accepted | Accepted | 52.38 | #ans = min(b - a + min(abs(a), abs(b)) for a, b in zip(x, x[K-1:]))
N, K = list(map(int, input().split()))
INF = 10**10
x_first = [-INF for i in range(K)]
x_ap = [int(i) for i in input().split()]
x_last = [INF for i in range(K)]
x = x_first + x_ap + x_last + [0]
x.sort()
zero_index = x.index(0)
key = []
for i in range(K+1):
left = abs(x[zero_index - i])
right = abs(x[zero_index - i + K])
# left か rightの 0に近い方に行ってからもう片方にいく
if left > right:
right *= 2
else:
left *= 2
key.append(left + right)
print((min(key)))
| N, K = list(map(int, input().split()))
x = [int(i) for i in input().split()]
key = []
for left, right in zip(x, x[K - 1:]):
key.append(right-left+min(abs(left), abs(right)))
print((min(key)))
| 22 | 6 | 568 | 193 | # ans = min(b - a + min(abs(a), abs(b)) for a, b in zip(x, x[K-1:]))
N, K = list(map(int, input().split()))
INF = 10**10
x_first = [-INF for i in range(K)]
x_ap = [int(i) for i in input().split()]
x_last = [INF for i in range(K)]
x = x_first + x_ap + x_last + [0]
x.sort()
zero_index = x.index(0)
key = []
for i in range(K + 1):
left = abs(x[zero_index - i])
right = abs(x[zero_index - i + K])
# left か rightの 0に近い方に行ってからもう片方にいく
if left > right:
right *= 2
else:
left *= 2
key.append(left + right)
print((min(key)))
| N, K = list(map(int, input().split()))
x = [int(i) for i in input().split()]
key = []
for left, right in zip(x, x[K - 1 :]):
key.append(right - left + min(abs(left), abs(right)))
print((min(key)))
| false | 72.727273 | [
"-# ans = min(b - a + min(abs(a), abs(b)) for a, b in zip(x, x[K-1:]))",
"-INF = 10**10",
"-x_first = [-INF for i in range(K)]",
"-x_ap = [int(i) for i in input().split()]",
"-x_last = [INF for i in range(K)]",
"-x = x_first + x_ap + x_last + [0]",
"-x.sort()",
"-zero_index = x.index(0)",
"+x = [int(i) for i in input().split()]",
"-for i in range(K + 1):",
"- left = abs(x[zero_index - i])",
"- right = abs(x[zero_index - i + K])",
"- # left か rightの 0に近い方に行ってからもう片方にいく",
"- if left > right:",
"- right *= 2",
"- else:",
"- left *= 2",
"- key.append(left + right)",
"+for left, right in zip(x, x[K - 1 :]):",
"+ key.append(right - left + min(abs(left), abs(right)))"
] | false | 0.047344 | 0.046858 | 1.010373 | [
"s703247465",
"s668954386"
] |
u716529032 | p04013 | python | s143309269 | s552751590 | 172 | 26 | 5,228 | 3,188 | Accepted | Accepted | 84.88 | N, A = list(map(int, input().split()))
X = list(map(int, input().split()))
s = [{} for i in range(N+1)]
s[0][0] = 1
for i in range(N):
cur = X[i]
for j in range(N, 0, -1):
for k, v in list(s[j-1].items()):
s[j][cur + k] = s[j].get(cur + k, 0) + v
ans = 0
for i in range(1, N+1):
ans += s[i].get(i*A, 0)
print(ans) | N, A = list(map(int, input().split()))
X = list([int(x) - A for x in input().split()])
d = {0: 1}
for cur in X:
for k, v in list(d.items()):
d[cur + k] = d.get(cur + k, 0) + v
print((d[0]-1)) | 15 | 10 | 333 | 210 | N, A = list(map(int, input().split()))
X = list(map(int, input().split()))
s = [{} for i in range(N + 1)]
s[0][0] = 1
for i in range(N):
cur = X[i]
for j in range(N, 0, -1):
for k, v in list(s[j - 1].items()):
s[j][cur + k] = s[j].get(cur + k, 0) + v
ans = 0
for i in range(1, N + 1):
ans += s[i].get(i * A, 0)
print(ans)
| N, A = list(map(int, input().split()))
X = list([int(x) - A for x in input().split()])
d = {0: 1}
for cur in X:
for k, v in list(d.items()):
d[cur + k] = d.get(cur + k, 0) + v
print((d[0] - 1))
| false | 33.333333 | [
"-X = list(map(int, input().split()))",
"-s = [{} for i in range(N + 1)]",
"-s[0][0] = 1",
"-for i in range(N):",
"- cur = X[i]",
"- for j in range(N, 0, -1):",
"- for k, v in list(s[j - 1].items()):",
"- s[j][cur + k] = s[j].get(cur + k, 0) + v",
"-ans = 0",
"-for i in range(1, N + 1):",
"- ans += s[i].get(i * A, 0)",
"-print(ans)",
"+X = list([int(x) - A for x in input().split()])",
"+d = {0: 1}",
"+for cur in X:",
"+ for k, v in list(d.items()):",
"+ d[cur + k] = d.get(cur + k, 0) + v",
"+print((d[0] - 1))"
] | false | 0.048343 | 0.039245 | 1.231812 | [
"s143309269",
"s552751590"
] |
u790922244 | p03013 | python | s783968940 | s239186426 | 265 | 206 | 8,624 | 8,648 | Accepted | Accepted | 22.26 | OK = 0
BRO = 1
MOD = 1000000007
N,M=list(map(int, input().split()))
Broken=[int(eval(input())) for i in range(M)]
#K = "".join(list(BRO if i in Broken else OK for i in range(N+1)))
K = list(0 for i in range(N+1))
for i in range(M):
K[Broken[i]] = 1
dp=[0 for i in range(N+1)]
dp[0]=1
for i in range(N):
for j in range(i+1,min(i+2+1,N+1)):
if K[j]==OK:
dp[j]+=dp[i]
dp[j]%=MOD
print((dp[N]))
| OK = 0
BRO = 1
N,M=list(map(int, input().split()))
Broken=[int(eval(input())) for i in range(M)]
#K = "".join(list(BRO if i in Broken else OK for i in range(N+1)))
K = list(0 for i in range(N+1))
for i in range(M):
K[Broken[i]] = 1
if N == 1:
print((1))
exit()
c=[0 for i in range(N+1)]
if K[N-1]==OK:
c[1]=1
if K[N-2]==OK and K[N-1]==OK:
c[2]=2
if K[N-2]==OK and K[N-1]==BRO:
c[2]=1
for i in range(3,N+1):
if K[N-i]==OK:
if K[N-i+1]==OK and K[N-i+2]==OK:
c[i]=c[i-1]+c[i-2]
if K[N-i+1]==OK and K[N-i+2]==BRO:
c[i]=c[i-1]
if K[N-i+1]==BRO and K[N-i+2]==OK:
c[i]=c[i-2]
c[i]%=1000000007
print((c[N] % 1000000007))
| 20 | 33 | 427 | 686 | OK = 0
BRO = 1
MOD = 1000000007
N, M = list(map(int, input().split()))
Broken = [int(eval(input())) for i in range(M)]
# K = "".join(list(BRO if i in Broken else OK for i in range(N+1)))
K = list(0 for i in range(N + 1))
for i in range(M):
K[Broken[i]] = 1
dp = [0 for i in range(N + 1)]
dp[0] = 1
for i in range(N):
for j in range(i + 1, min(i + 2 + 1, N + 1)):
if K[j] == OK:
dp[j] += dp[i]
dp[j] %= MOD
print((dp[N]))
| OK = 0
BRO = 1
N, M = list(map(int, input().split()))
Broken = [int(eval(input())) for i in range(M)]
# K = "".join(list(BRO if i in Broken else OK for i in range(N+1)))
K = list(0 for i in range(N + 1))
for i in range(M):
K[Broken[i]] = 1
if N == 1:
print((1))
exit()
c = [0 for i in range(N + 1)]
if K[N - 1] == OK:
c[1] = 1
if K[N - 2] == OK and K[N - 1] == OK:
c[2] = 2
if K[N - 2] == OK and K[N - 1] == BRO:
c[2] = 1
for i in range(3, N + 1):
if K[N - i] == OK:
if K[N - i + 1] == OK and K[N - i + 2] == OK:
c[i] = c[i - 1] + c[i - 2]
if K[N - i + 1] == OK and K[N - i + 2] == BRO:
c[i] = c[i - 1]
if K[N - i + 1] == BRO and K[N - i + 2] == OK:
c[i] = c[i - 2]
c[i] %= 1000000007
print((c[N] % 1000000007))
| false | 39.393939 | [
"-MOD = 1000000007",
"-dp = [0 for i in range(N + 1)]",
"-dp[0] = 1",
"-for i in range(N):",
"- for j in range(i + 1, min(i + 2 + 1, N + 1)):",
"- if K[j] == OK:",
"- dp[j] += dp[i]",
"- dp[j] %= MOD",
"-print((dp[N]))",
"+if N == 1:",
"+ print((1))",
"+ exit()",
"+c = [0 for i in range(N + 1)]",
"+if K[N - 1] == OK:",
"+ c[1] = 1",
"+if K[N - 2] == OK and K[N - 1] == OK:",
"+ c[2] = 2",
"+if K[N - 2] == OK and K[N - 1] == BRO:",
"+ c[2] = 1",
"+for i in range(3, N + 1):",
"+ if K[N - i] == OK:",
"+ if K[N - i + 1] == OK and K[N - i + 2] == OK:",
"+ c[i] = c[i - 1] + c[i - 2]",
"+ if K[N - i + 1] == OK and K[N - i + 2] == BRO:",
"+ c[i] = c[i - 1]",
"+ if K[N - i + 1] == BRO and K[N - i + 2] == OK:",
"+ c[i] = c[i - 2]",
"+ c[i] %= 1000000007",
"+print((c[N] % 1000000007))"
] | false | 0.03609 | 0.036355 | 0.992721 | [
"s783968940",
"s239186426"
] |
u762420987 | p02983 | python | s917611825 | s264450873 | 1,521 | 807 | 2,940 | 2,940 | Accepted | Accepted | 46.94 | L, R = list(map(int, input().split()))
mod = 2019
ans = 10**9 + 7
for i in range(L, min(L + mod, R)):
for j in range(i + 1, min(i + mod + 1, R + 1)):
ans = min((i * j) % mod, ans)
print(ans)
| L, R = list(map(int, input().split()))
mod = 2019
ans = 10**9
for i in range(L, min(R+1, L+2030)):
for j in range(i+1, min(R+1, L+2030)):
ans = min(ans, (i*j)%mod)
print(ans)
| 7 | 7 | 197 | 187 | L, R = list(map(int, input().split()))
mod = 2019
ans = 10**9 + 7
for i in range(L, min(L + mod, R)):
for j in range(i + 1, min(i + mod + 1, R + 1)):
ans = min((i * j) % mod, ans)
print(ans)
| L, R = list(map(int, input().split()))
mod = 2019
ans = 10**9
for i in range(L, min(R + 1, L + 2030)):
for j in range(i + 1, min(R + 1, L + 2030)):
ans = min(ans, (i * j) % mod)
print(ans)
| false | 0 | [
"-ans = 10**9 + 7",
"-for i in range(L, min(L + mod, R)):",
"- for j in range(i + 1, min(i + mod + 1, R + 1)):",
"- ans = min((i * j) % mod, ans)",
"+ans = 10**9",
"+for i in range(L, min(R + 1, L + 2030)):",
"+ for j in range(i + 1, min(R + 1, L + 2030)):",
"+ ans = min(ans, (i * j) % mod)"
] | false | 0.123811 | 0.168643 | 0.734162 | [
"s917611825",
"s264450873"
] |
u597374218 | p02993 | python | s537516131 | s840057871 | 22 | 17 | 3,060 | 2,940 | Accepted | Accepted | 22.73 | s=eval(input())
print(("Good" if s[0]!=s[1] and s[1]!=s[2] and s[2]!=s[3] else "Bad")) | a,b,c,d=eval(input())
print(("Good" if a!=b and b!=c and c!=d else "Bad")) | 2 | 2 | 79 | 67 | s = eval(input())
print(("Good" if s[0] != s[1] and s[1] != s[2] and s[2] != s[3] else "Bad"))
| a, b, c, d = eval(input())
print(("Good" if a != b and b != c and c != d else "Bad"))
| false | 0 | [
"-s = eval(input())",
"-print((\"Good\" if s[0] != s[1] and s[1] != s[2] and s[2] != s[3] else \"Bad\"))",
"+a, b, c, d = eval(input())",
"+print((\"Good\" if a != b and b != c and c != d else \"Bad\"))"
] | false | 0.15195 | 0.060493 | 2.511858 | [
"s537516131",
"s840057871"
] |
u716530146 | p02936 | python | s305468930 | s900407517 | 1,787 | 790 | 232,496 | 94,720 | Accepted | Accepted | 55.79 | #!/usr/bin/env python3
import sys
input = lambda: sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**8)
inf = float('inf')
mod = 10**9+7
def dfs(node):
tmp = data[node]
for v in G[node]:
if not visited[v]:
visited[v]=1
data[v]+=tmp
dfs(v)
return 0
n,q=list(map(int,input().split()))
G=[[] for i in range(n)]
for i in range(n-1):
a,b=list(map(int,input().split()))
a-=1;b-=1
G[a].append(b)
G[b].append(a)
data=[0]*n
for i in range(q):
p,x=list(map(int,input().split()))
data[p-1]+=x
visited=[0]*n
visited[0]=1
dfs(0)
print((*data))
| #!/usr/bin/env python3
import sys
input = lambda: sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**8)
inf = float('inf')
mod = 10**9+7
n,q=list(map(int,input().split()))
G=[[] for i in range(n)]
for i in range(n-1):
a,b=list(map(int,input().split()))
a-=1;b-=1
G[a].append(b)
G[b].append(a)
data=[0]*n
for i in range(q):
p,x=list(map(int,input().split()))
data[p-1]+=x
visited=[0]*n
visited[0]=1
stack=[0]
while stack:
node=stack.pop()
for v in G[node]:
if not visited[v]:
visited[v]=1
data[v]+=data[node]
stack.append(v)
print((*data)) | 33 | 35 | 628 | 636 | #!/usr/bin/env python3
import sys
input = lambda: sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**8)
inf = float("inf")
mod = 10**9 + 7
def dfs(node):
tmp = data[node]
for v in G[node]:
if not visited[v]:
visited[v] = 1
data[v] += tmp
dfs(v)
return 0
n, q = list(map(int, input().split()))
G = [[] for i in range(n)]
for i in range(n - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
G[a].append(b)
G[b].append(a)
data = [0] * n
for i in range(q):
p, x = list(map(int, input().split()))
data[p - 1] += x
visited = [0] * n
visited[0] = 1
dfs(0)
print((*data))
| #!/usr/bin/env python3
import sys
input = lambda: sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**8)
inf = float("inf")
mod = 10**9 + 7
n, q = list(map(int, input().split()))
G = [[] for i in range(n)]
for i in range(n - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
G[a].append(b)
G[b].append(a)
data = [0] * n
for i in range(q):
p, x = list(map(int, input().split()))
data[p - 1] += x
visited = [0] * n
visited[0] = 1
stack = [0]
while stack:
node = stack.pop()
for v in G[node]:
if not visited[v]:
visited[v] = 1
data[v] += data[node]
stack.append(v)
print((*data))
| false | 5.714286 | [
"-",
"-",
"-def dfs(node):",
"- tmp = data[node]",
"- for v in G[node]:",
"- if not visited[v]:",
"- visited[v] = 1",
"- data[v] += tmp",
"- dfs(v)",
"- return 0",
"-",
"-",
"-dfs(0)",
"+stack = [0]",
"+while stack:",
"+ node = stack.pop()",
"+ for v in G[node]:",
"+ if not visited[v]:",
"+ visited[v] = 1",
"+ data[v] += data[node]",
"+ stack.append(v)"
] | false | 0.04068 | 0.038129 | 1.066893 | [
"s305468930",
"s900407517"
] |
u316341119 | p03031 | python | s534532165 | s337452567 | 23 | 20 | 3,188 | 3,064 | Accepted | Accepted | 13.04 | N, M = list(map(int, input().split()))
kss = []
for i in range(M):
tmp = list(map(int, input().split()))
k = tmp[0]
s = tmp[1:]
kss.append([k, s])
ps = list(map(int, input().split()))
def check_on(s_all, s, p):
oncnt = 0
for i in s:
if s_all[i]:
oncnt += 1
if oncnt % 2 == p:
return True
else:
return False
def check_all_on(s_all, kss, ps):
for i in range(M):
s = kss[i][1]
p = ps[i]
if not check_on(s_all, s, p):
return False
return True
def rec(s_all, kss, ps, cnt):
if len(s_all) == N+1:
if check_all_on(s_all, kss, ps):
cnt[0] += 1
return
else:
s_all.append(0)
rec(s_all, kss, ps, cnt)
s_all.pop()
s_all.append(1)
rec(s_all, kss, ps, cnt)
s_all.pop()
s_all = [0]
cnt = [0]
rec(s_all, kss, ps, cnt)
print((cnt[0]))
| N, M = list(map(int, input().split()))
onptns = []
for i in range(M):
k, *s= list(map(int, input().split()))
onptn = 0
for i in s:
onptn += 1 << (i - 1)
onptns.append(onptn)
ps = list(map(int, input().split()))
ans = 0
s = 0
while s < (1 << N):
ans += 1
for onptn, p in zip(onptns, ps):
if bin(s & onptn).count('1') % 2 != p:
ans -= 1
break
s += 1
print(ans)
| 46 | 22 | 961 | 445 | N, M = list(map(int, input().split()))
kss = []
for i in range(M):
tmp = list(map(int, input().split()))
k = tmp[0]
s = tmp[1:]
kss.append([k, s])
ps = list(map(int, input().split()))
def check_on(s_all, s, p):
oncnt = 0
for i in s:
if s_all[i]:
oncnt += 1
if oncnt % 2 == p:
return True
else:
return False
def check_all_on(s_all, kss, ps):
for i in range(M):
s = kss[i][1]
p = ps[i]
if not check_on(s_all, s, p):
return False
return True
def rec(s_all, kss, ps, cnt):
if len(s_all) == N + 1:
if check_all_on(s_all, kss, ps):
cnt[0] += 1
return
else:
s_all.append(0)
rec(s_all, kss, ps, cnt)
s_all.pop()
s_all.append(1)
rec(s_all, kss, ps, cnt)
s_all.pop()
s_all = [0]
cnt = [0]
rec(s_all, kss, ps, cnt)
print((cnt[0]))
| N, M = list(map(int, input().split()))
onptns = []
for i in range(M):
k, *s = list(map(int, input().split()))
onptn = 0
for i in s:
onptn += 1 << (i - 1)
onptns.append(onptn)
ps = list(map(int, input().split()))
ans = 0
s = 0
while s < (1 << N):
ans += 1
for onptn, p in zip(onptns, ps):
if bin(s & onptn).count("1") % 2 != p:
ans -= 1
break
s += 1
print(ans)
| false | 52.173913 | [
"-kss = []",
"+onptns = []",
"- tmp = list(map(int, input().split()))",
"- k = tmp[0]",
"- s = tmp[1:]",
"- kss.append([k, s])",
"+ k, *s = list(map(int, input().split()))",
"+ onptn = 0",
"+ for i in s:",
"+ onptn += 1 << (i - 1)",
"+ onptns.append(onptn)",
"-",
"-",
"-def check_on(s_all, s, p):",
"- oncnt = 0",
"- for i in s:",
"- if s_all[i]:",
"- oncnt += 1",
"- if oncnt % 2 == p:",
"- return True",
"- else:",
"- return False",
"-",
"-",
"-def check_all_on(s_all, kss, ps):",
"- for i in range(M):",
"- s = kss[i][1]",
"- p = ps[i]",
"- if not check_on(s_all, s, p):",
"- return False",
"- return True",
"-",
"-",
"-def rec(s_all, kss, ps, cnt):",
"- if len(s_all) == N + 1:",
"- if check_all_on(s_all, kss, ps):",
"- cnt[0] += 1",
"- return",
"- else:",
"- s_all.append(0)",
"- rec(s_all, kss, ps, cnt)",
"- s_all.pop()",
"- s_all.append(1)",
"- rec(s_all, kss, ps, cnt)",
"- s_all.pop()",
"-",
"-",
"-s_all = [0]",
"-cnt = [0]",
"-rec(s_all, kss, ps, cnt)",
"-print((cnt[0]))",
"+ans = 0",
"+s = 0",
"+while s < (1 << N):",
"+ ans += 1",
"+ for onptn, p in zip(onptns, ps):",
"+ if bin(s & onptn).count(\"1\") % 2 != p:",
"+ ans -= 1",
"+ break",
"+ s += 1",
"+print(ans)"
] | false | 0.072734 | 0.071234 | 1.021068 | [
"s534532165",
"s337452567"
] |
u226108478 | p03137 | python | s844486667 | s433327465 | 105 | 83 | 13,968 | 20,484 | Accepted | Accepted | 20.95 | # -*- coding: utf-8 -*-
def main():
n, m = list(map(int, input().split()))
xs = sorted(list(map(int, input().split())))
if n >= m:
print((0))
else:
ans = xs[-1] - xs[0]
diff = [0 for _ in range(m - 1)]
for i in range(m - 1):
diff[i] = xs[i + 1] - xs[i]
print((ans - sum(sorted(diff, reverse=True)[:n - 1])))
if __name__ == '__main__':
main()
| # -*- coding: utf-8 -*-
def main():
n, m = list(map(int, input().split()))
x = sorted(list(map(int, input().split())))
diff = list()
for i, j in zip(x, x[1:]):
diff.append(abs(i - j))
diff = sorted(diff, reverse=True)
print((sum(diff) - sum(diff[:n - 1])))
if __name__ == '__main__':
main()
| 21 | 17 | 431 | 341 | # -*- coding: utf-8 -*-
def main():
n, m = list(map(int, input().split()))
xs = sorted(list(map(int, input().split())))
if n >= m:
print((0))
else:
ans = xs[-1] - xs[0]
diff = [0 for _ in range(m - 1)]
for i in range(m - 1):
diff[i] = xs[i + 1] - xs[i]
print((ans - sum(sorted(diff, reverse=True)[: n - 1])))
if __name__ == "__main__":
main()
| # -*- coding: utf-8 -*-
def main():
n, m = list(map(int, input().split()))
x = sorted(list(map(int, input().split())))
diff = list()
for i, j in zip(x, x[1:]):
diff.append(abs(i - j))
diff = sorted(diff, reverse=True)
print((sum(diff) - sum(diff[: n - 1])))
if __name__ == "__main__":
main()
| false | 19.047619 | [
"- xs = sorted(list(map(int, input().split())))",
"- if n >= m:",
"- print((0))",
"- else:",
"- ans = xs[-1] - xs[0]",
"- diff = [0 for _ in range(m - 1)]",
"- for i in range(m - 1):",
"- diff[i] = xs[i + 1] - xs[i]",
"- print((ans - sum(sorted(diff, reverse=True)[: n - 1])))",
"+ x = sorted(list(map(int, input().split())))",
"+ diff = list()",
"+ for i, j in zip(x, x[1:]):",
"+ diff.append(abs(i - j))",
"+ diff = sorted(diff, reverse=True)",
"+ print((sum(diff) - sum(diff[: n - 1])))"
] | false | 0.110128 | 0.03839 | 2.868655 | [
"s844486667",
"s433327465"
] |
u150984829 | p02257 | python | s559344264 | s731894858 | 610 | 320 | 5,704 | 5,668 | Accepted | Accepted | 47.54 | c=0
n=int(eval(input()))
for _ in range(n):
x=int(eval(input()))
for i in range(2,int(x**.5+1)):
if x%i==0:c+=1;break
print((n-c))
| c=0
n=int(eval(input()))
for _ in range(n):
x=int(eval(input()))
if x!=2 and x%2==0:c+=1;continue
for i in range(3,int(x**.5+1),2):
if x%i==0:c+=1;break
print((n-c))
| 7 | 8 | 127 | 164 | c = 0
n = int(eval(input()))
for _ in range(n):
x = int(eval(input()))
for i in range(2, int(x**0.5 + 1)):
if x % i == 0:
c += 1
break
print((n - c))
| c = 0
n = int(eval(input()))
for _ in range(n):
x = int(eval(input()))
if x != 2 and x % 2 == 0:
c += 1
continue
for i in range(3, int(x**0.5 + 1), 2):
if x % i == 0:
c += 1
break
print((n - c))
| false | 12.5 | [
"- for i in range(2, int(x**0.5 + 1)):",
"+ if x != 2 and x % 2 == 0:",
"+ c += 1",
"+ continue",
"+ for i in range(3, int(x**0.5 + 1), 2):"
] | false | 0.061459 | 0.033548 | 1.831983 | [
"s559344264",
"s731894858"
] |
u562935282 | p03170 | python | s465820337 | s456759479 | 1,922 | 94 | 3,828 | 4,596 | Accepted | Accepted | 95.11 | n, k = list(map(int, input().split()))
a = tuple(map(int, input().split()))
dp = [None] * (k + 1)
# dp[手番の石の数] := 手番の勝敗
# True(勝ち) / None(負け)
for my_remains in range(k + 1):
for my_take in a:
opponent_remains = my_remains - my_take # 相手が操作を行う石の数
if opponent_remains >= 0 and dp[opponent_remains] is None:
dp[my_remains] = True
ans = dp[k]
print(('First' if ans else 'Second'))
| n, k = list(map(int, input().split()))
a = tuple(map(int, input().split()))
dp = [None] * (k + k + 1)
# dp[手番の石の数] := 手番の勝敗
# True(勝ち) / None(負け)
for opponent_remains in range(k): # 自分が石を取った残りなので、k未満
if dp[opponent_remains] is None: # 相手が負ける場合
for my_take in a: # 自分が取る石の数
my_remains = opponent_remains + my_take # 相手が負けるようにできる、自分の手番の石の数
dp[my_remains] = True
ans = dp[k]
print(('First' if ans else 'Second'))
| 15 | 15 | 419 | 459 | n, k = list(map(int, input().split()))
a = tuple(map(int, input().split()))
dp = [None] * (k + 1)
# dp[手番の石の数] := 手番の勝敗
# True(勝ち) / None(負け)
for my_remains in range(k + 1):
for my_take in a:
opponent_remains = my_remains - my_take # 相手が操作を行う石の数
if opponent_remains >= 0 and dp[opponent_remains] is None:
dp[my_remains] = True
ans = dp[k]
print(("First" if ans else "Second"))
| n, k = list(map(int, input().split()))
a = tuple(map(int, input().split()))
dp = [None] * (k + k + 1)
# dp[手番の石の数] := 手番の勝敗
# True(勝ち) / None(負け)
for opponent_remains in range(k): # 自分が石を取った残りなので、k未満
if dp[opponent_remains] is None: # 相手が負ける場合
for my_take in a: # 自分が取る石の数
my_remains = opponent_remains + my_take # 相手が負けるようにできる、自分の手番の石の数
dp[my_remains] = True
ans = dp[k]
print(("First" if ans else "Second"))
| false | 0 | [
"-dp = [None] * (k + 1)",
"+dp = [None] * (k + k + 1)",
"-for my_remains in range(k + 1):",
"- for my_take in a:",
"- opponent_remains = my_remains - my_take # 相手が操作を行う石の数",
"- if opponent_remains >= 0 and dp[opponent_remains] is None:",
"+for opponent_remains in range(k): # 自分が石を取った残りなので、k未満",
"+ if dp[opponent_remains] is None: # 相手が負ける場合",
"+ for my_take in a: # 自分が取る石の数",
"+ my_remains = opponent_remains + my_take # 相手が負けるようにできる、自分の手番の石の数"
] | false | 0.085912 | 0.033688 | 2.550222 | [
"s465820337",
"s456759479"
] |
u021019433 | p02744 | python | s595325686 | s649719014 | 195 | 119 | 17,992 | 14,688 | Accepted | Accepted | 38.97 | n = int(input())
r = 'a',
for _ in range(n - 1):
r = {s + c for s in r for c in s + chr(ord(max(s)) + 1)}
print(*sorted(r), sep='\n')
| n = int(input())
r = 'a',
for _ in range(n - 1):
r = [s + c for s in r for c in set(s + chr(ord(max(s)) + 1))]
print(*sorted(r), sep='\n')
| 5 | 5 | 140 | 145 | n = int(input())
r = ("a",)
for _ in range(n - 1):
r = {s + c for s in r for c in s + chr(ord(max(s)) + 1)}
print(*sorted(r), sep="\n")
| n = int(input())
r = ("a",)
for _ in range(n - 1):
r = [s + c for s in r for c in set(s + chr(ord(max(s)) + 1))]
print(*sorted(r), sep="\n")
| false | 0 | [
"- r = {s + c for s in r for c in s + chr(ord(max(s)) + 1)}",
"+ r = [s + c for s in r for c in set(s + chr(ord(max(s)) + 1))]"
] | false | 0.076784 | 0.127274 | 0.603298 | [
"s595325686",
"s649719014"
] |
u970197315 | p02881 | python | s326710359 | s172326618 | 261 | 143 | 3,060 | 3,060 | Accepted | Accepted | 45.21 | n=int(eval(input()))
ans=10**13
for i in range(1,int(n**0.5)+1):
j=n//i
if n%i==0:
ans=min(ans,i+j)
print((ans-2))
| n=int(eval(input()))
ans=10**18
for i in range(1,int(n**0.5)+1):
if n%i!=0:continue
j=n//i
t=i+j-2
ans=min(t,ans)
print(ans) | 7 | 8 | 129 | 141 | n = int(eval(input()))
ans = 10**13
for i in range(1, int(n**0.5) + 1):
j = n // i
if n % i == 0:
ans = min(ans, i + j)
print((ans - 2))
| n = int(eval(input()))
ans = 10**18
for i in range(1, int(n**0.5) + 1):
if n % i != 0:
continue
j = n // i
t = i + j - 2
ans = min(t, ans)
print(ans)
| false | 12.5 | [
"-ans = 10**13",
"+ans = 10**18",
"+ if n % i != 0:",
"+ continue",
"- if n % i == 0:",
"- ans = min(ans, i + j)",
"-print((ans - 2))",
"+ t = i + j - 2",
"+ ans = min(t, ans)",
"+print(ans)"
] | false | 0.05326 | 0.050362 | 1.057547 | [
"s326710359",
"s172326618"
] |
u099450021 | p03212 | python | s424625476 | s544076836 | 81 | 74 | 6,896 | 4,852 | Accepted | Accepted | 8.64 | Ns = eval(input())
N = int(Ns)
Nl = len(Ns)
ret = set()
def doit(t, f , s, now):
if t + f + s == 0:
if int(now) <= N:
ret.add(now)
return
if t > 0:
doit(t - 1, f, s, now + str(3))
if f > 0:
doit(t, f - 1, s, now + str(5))
if s > 0:
doit(t, f, s - 1, now + str(7))
for seven in range(1, Nl - 1):
for five in range(1, Nl - seven):
least = Nl - seven - five
for three in range(1, least + 1):
doit(three, five, seven, '')
print((len(ret)))
| Ns = eval(input())
N = int(Ns)
Nl = len(Ns)
ret = []
def doit(t, f , s, now):
if t + f + s == 0:
if int(now) <= N:
ret.append(now)
return
if t > 0:
doit(t - 1, f, s, now + str(3))
if f > 0:
doit(t, f - 1, s, now + str(5))
if s > 0:
doit(t, f, s - 1, now + str(7))
for seven in range(1, Nl - 1):
for five in range(1, Nl - seven):
least = Nl - seven - five
for three in range(1, least + 1):
doit(three, five, seven, '')
print((len(ret)))
| 24 | 23 | 561 | 559 | Ns = eval(input())
N = int(Ns)
Nl = len(Ns)
ret = set()
def doit(t, f, s, now):
if t + f + s == 0:
if int(now) <= N:
ret.add(now)
return
if t > 0:
doit(t - 1, f, s, now + str(3))
if f > 0:
doit(t, f - 1, s, now + str(5))
if s > 0:
doit(t, f, s - 1, now + str(7))
for seven in range(1, Nl - 1):
for five in range(1, Nl - seven):
least = Nl - seven - five
for three in range(1, least + 1):
doit(three, five, seven, "")
print((len(ret)))
| Ns = eval(input())
N = int(Ns)
Nl = len(Ns)
ret = []
def doit(t, f, s, now):
if t + f + s == 0:
if int(now) <= N:
ret.append(now)
return
if t > 0:
doit(t - 1, f, s, now + str(3))
if f > 0:
doit(t, f - 1, s, now + str(5))
if s > 0:
doit(t, f, s - 1, now + str(7))
for seven in range(1, Nl - 1):
for five in range(1, Nl - seven):
least = Nl - seven - five
for three in range(1, least + 1):
doit(three, five, seven, "")
print((len(ret)))
| false | 4.166667 | [
"-ret = set()",
"+ret = []",
"- ret.add(now)",
"+ ret.append(now)"
] | false | 0.008484 | 0.073899 | 0.114805 | [
"s424625476",
"s544076836"
] |
u466335531 | p03240 | python | s537934290 | s495355954 | 354 | 81 | 3,064 | 3,064 | Accepted | Accepted | 77.12 | N=int(eval(input()))
data=[]
for _ in range(N):
x,y,h=list(map(int,input().split()))
data.append([x,y,h])
def test():
for cx in range(101):
for cy in range(101):
for i in range(N):
if data[i][2]:
temph=data[i][2]+abs(data[i][0]-cx)+abs(data[i][1]-cy)
flag=True
for d in data:
if d[2] != max(temph-abs(d[0]-cx)-abs(d[1]-cy),0):
flag=False
break
if flag:
print((cx,cy,temph))
return
test() | N=int(eval(input()))
data=[]
for _ in range(N):
x,y,h=list(map(int,input().split()))
data.append([x,y,h])
def test():
for cx in range(101):
for cy in range(101):
for i in range(N):
if data[i][2]:
temph=data[i][2]+abs(data[i][0]-cx)+abs(data[i][1]-cy)
flag=True
break
for d in data:
if d[2] != max(temph-abs(d[0]-cx)-abs(d[1]-cy),0):
flag=False
break
if flag:
print((cx,cy,temph))
return
test() | 27 | 28 | 659 | 686 | N = int(eval(input()))
data = []
for _ in range(N):
x, y, h = list(map(int, input().split()))
data.append([x, y, h])
def test():
for cx in range(101):
for cy in range(101):
for i in range(N):
if data[i][2]:
temph = data[i][2] + abs(data[i][0] - cx) + abs(data[i][1] - cy)
flag = True
for d in data:
if d[2] != max(temph - abs(d[0] - cx) - abs(d[1] - cy), 0):
flag = False
break
if flag:
print((cx, cy, temph))
return
test()
| N = int(eval(input()))
data = []
for _ in range(N):
x, y, h = list(map(int, input().split()))
data.append([x, y, h])
def test():
for cx in range(101):
for cy in range(101):
for i in range(N):
if data[i][2]:
temph = data[i][2] + abs(data[i][0] - cx) + abs(data[i][1] - cy)
flag = True
break
for d in data:
if d[2] != max(temph - abs(d[0] - cx) - abs(d[1] - cy), 0):
flag = False
break
if flag:
print((cx, cy, temph))
return
test()
| false | 3.571429 | [
"+ break"
] | false | 0.084388 | 0.068969 | 1.223558 | [
"s537934290",
"s495355954"
] |
u116002573 | p02957 | python | s303742732 | s429454040 | 19 | 17 | 3,316 | 3,060 | Accepted | Accepted | 10.53 | ab = input().split()
A, B = int(ab[0]), int(ab[1])
if A == B:
print((1))
elif A % 2 != B % 2:
print("IMPOSSIBLE")
else:
K = (A+B) // 2
if abs(A-K) == abs(B-K):
print(K)
else:
print("IMPOSSIBLE") | ab = input().split()
A, B = int(ab[0]), int(ab[1])
out = None
if A == B:
out = None
elif A % 2 != B % 2:
out = "IMPOSSIBLE"
else:
K = (A+B) // 2
if abs(A-K) == abs(B-K):
out = K
else:
out = "IMPOSSIBLE"
print(out) | 13 | 16 | 241 | 266 | ab = input().split()
A, B = int(ab[0]), int(ab[1])
if A == B:
print((1))
elif A % 2 != B % 2:
print("IMPOSSIBLE")
else:
K = (A + B) // 2
if abs(A - K) == abs(B - K):
print(K)
else:
print("IMPOSSIBLE")
| ab = input().split()
A, B = int(ab[0]), int(ab[1])
out = None
if A == B:
out = None
elif A % 2 != B % 2:
out = "IMPOSSIBLE"
else:
K = (A + B) // 2
if abs(A - K) == abs(B - K):
out = K
else:
out = "IMPOSSIBLE"
print(out)
| false | 18.75 | [
"+out = None",
"- print((1))",
"+ out = None",
"- print(\"IMPOSSIBLE\")",
"+ out = \"IMPOSSIBLE\"",
"- print(K)",
"+ out = K",
"- print(\"IMPOSSIBLE\")",
"+ out = \"IMPOSSIBLE\"",
"+print(out)"
] | false | 0.051329 | 0.049339 | 1.040334 | [
"s303742732",
"s429454040"
] |
u414980766 | p02890 | python | s375331198 | s252490733 | 705 | 547 | 28,252 | 49,852 | Accepted | Accepted | 22.41 | N = int(eval(input()))
A = list(map(int, input().split()))
C = [0]*N
for a in A:
C[a - 1] += 1
D = [0]*(N + 1)
for c in C:
D[c] += 1
Dk_accum = [0]*(N + 1)
for i in range(1, N + 1):
Dk_accum[i] = Dk_accum[i - 1] + i*D[i]
D_sum = sum(D)
D_accum = [0]*(N + 2)
D_accum[0] = D_sum
for i in range(1, N + 1):
D_accum[i] = D_accum[i - 1] - D[i - 1]
F = [0]*(N + 1)
for i in range(1, N + 1):
F[i] = (Dk_accum[i]//i + D_accum[i + 1])
i = N
for K in range(1, N + 1):
while i > 0 and K > F[i]:
i -= 1
print(i)
| from collections import Counter
N = int(eval(input()))
C = sorted(list(Counter(list(map(int, input().split()))).values()))
rest = N
removed = 0
for K in range(1, N + 1):
d = K - removed
while C and C[- 1] > rest//d:
rest -= C[- 1]
C.pop()
removed += 1
d -= 1
print((rest//d))
| 29 | 14 | 571 | 320 | N = int(eval(input()))
A = list(map(int, input().split()))
C = [0] * N
for a in A:
C[a - 1] += 1
D = [0] * (N + 1)
for c in C:
D[c] += 1
Dk_accum = [0] * (N + 1)
for i in range(1, N + 1):
Dk_accum[i] = Dk_accum[i - 1] + i * D[i]
D_sum = sum(D)
D_accum = [0] * (N + 2)
D_accum[0] = D_sum
for i in range(1, N + 1):
D_accum[i] = D_accum[i - 1] - D[i - 1]
F = [0] * (N + 1)
for i in range(1, N + 1):
F[i] = Dk_accum[i] // i + D_accum[i + 1]
i = N
for K in range(1, N + 1):
while i > 0 and K > F[i]:
i -= 1
print(i)
| from collections import Counter
N = int(eval(input()))
C = sorted(list(Counter(list(map(int, input().split()))).values()))
rest = N
removed = 0
for K in range(1, N + 1):
d = K - removed
while C and C[-1] > rest // d:
rest -= C[-1]
C.pop()
removed += 1
d -= 1
print((rest // d))
| false | 51.724138 | [
"+from collections import Counter",
"+",
"-A = list(map(int, input().split()))",
"-C = [0] * N",
"-for a in A:",
"- C[a - 1] += 1",
"-D = [0] * (N + 1)",
"-for c in C:",
"- D[c] += 1",
"-Dk_accum = [0] * (N + 1)",
"-for i in range(1, N + 1):",
"- Dk_accum[i] = Dk_accum[i - 1] + i * D[i]",
"-D_sum = sum(D)",
"-D_accum = [0] * (N + 2)",
"-D_accum[0] = D_sum",
"-for i in range(1, N + 1):",
"- D_accum[i] = D_accum[i - 1] - D[i - 1]",
"-F = [0] * (N + 1)",
"-for i in range(1, N + 1):",
"- F[i] = Dk_accum[i] // i + D_accum[i + 1]",
"-i = N",
"+C = sorted(list(Counter(list(map(int, input().split()))).values()))",
"+rest = N",
"+removed = 0",
"- while i > 0 and K > F[i]:",
"- i -= 1",
"- print(i)",
"+ d = K - removed",
"+ while C and C[-1] > rest // d:",
"+ rest -= C[-1]",
"+ C.pop()",
"+ removed += 1",
"+ d -= 1",
"+ print((rest // d))"
] | false | 0.039193 | 0.04259 | 0.92024 | [
"s375331198",
"s252490733"
] |
u677121387 | p02755 | python | s041287419 | s271479306 | 22 | 18 | 2,940 | 3,060 | Accepted | Accepted | 18.18 | a,b = list(map(int,input().split()))
v = 1
while True:
if (v*0.08)//1 == a and (v*0.1)//1 == b:
ans = v
break
v += 1
if v > 10100:
ans = -1
break
print(ans)
| a,b = list(map(int,input().split()))
v = 1
for v in range(1,1010):
if (v*0.08)//1 == a and (v*0.1)//1 == b:
ans = v
break
else:
ans = -1
print(ans) | 11 | 9 | 205 | 173 | a, b = list(map(int, input().split()))
v = 1
while True:
if (v * 0.08) // 1 == a and (v * 0.1) // 1 == b:
ans = v
break
v += 1
if v > 10100:
ans = -1
break
print(ans)
| a, b = list(map(int, input().split()))
v = 1
for v in range(1, 1010):
if (v * 0.08) // 1 == a and (v * 0.1) // 1 == b:
ans = v
break
else:
ans = -1
print(ans)
| false | 18.181818 | [
"-while True:",
"+for v in range(1, 1010):",
"- v += 1",
"- if v > 10100:",
"- ans = -1",
"- break",
"+else:",
"+ ans = -1"
] | false | 0.080117 | 0.09917 | 0.807876 | [
"s041287419",
"s271479306"
] |
u057964173 | p03971 | python | s096977092 | s946882030 | 99 | 88 | 4,712 | 4,704 | Accepted | Accepted | 11.11 | def resolve():
n,a,b=list(map(int, input().split()))
s=list(eval(input()))
cnt=0
cnt_b=0
for i in range(n):
if s[i]=='c':
print('No')
elif s[i]=='a':
if cnt<a+b:
print('Yes')
cnt+=1
else:
print('No')
else:
if cnt<a+b and cnt_b<b:
print('Yes')
cnt+=1
cnt_b+=1
else:
print('No')
resolve() | def resolve():
n,a,b=list(map(int, input().split()))
s=list(eval(input()))
cnt=0
cnt_b=0
for i in range(n):
if s[i]=='b' and cnt<a+b and cnt_b<b:
print('Yes')
cnt+=1
cnt_b+=1
elif s[i]=='a' and cnt<a+b:
print('Yes')
cnt+=1
else:
print('No')
resolve() | 22 | 16 | 511 | 369 | def resolve():
n, a, b = list(map(int, input().split()))
s = list(eval(input()))
cnt = 0
cnt_b = 0
for i in range(n):
if s[i] == "c":
print("No")
elif s[i] == "a":
if cnt < a + b:
print("Yes")
cnt += 1
else:
print("No")
else:
if cnt < a + b and cnt_b < b:
print("Yes")
cnt += 1
cnt_b += 1
else:
print("No")
resolve()
| def resolve():
n, a, b = list(map(int, input().split()))
s = list(eval(input()))
cnt = 0
cnt_b = 0
for i in range(n):
if s[i] == "b" and cnt < a + b and cnt_b < b:
print("Yes")
cnt += 1
cnt_b += 1
elif s[i] == "a" and cnt < a + b:
print("Yes")
cnt += 1
else:
print("No")
resolve()
| false | 27.272727 | [
"- if s[i] == \"c\":",
"+ if s[i] == \"b\" and cnt < a + b and cnt_b < b:",
"+ print(\"Yes\")",
"+ cnt += 1",
"+ cnt_b += 1",
"+ elif s[i] == \"a\" and cnt < a + b:",
"+ print(\"Yes\")",
"+ cnt += 1",
"+ else:",
"- elif s[i] == \"a\":",
"- if cnt < a + b:",
"- print(\"Yes\")",
"- cnt += 1",
"- else:",
"- print(\"No\")",
"- else:",
"- if cnt < a + b and cnt_b < b:",
"- print(\"Yes\")",
"- cnt += 1",
"- cnt_b += 1",
"- else:",
"- print(\"No\")"
] | false | 0.034589 | 0.036075 | 0.958799 | [
"s096977092",
"s946882030"
] |
u963009166 | p03457 | python | s015785587 | s912412925 | 237 | 161 | 3,064 | 3,316 | Accepted | Accepted | 32.07 | import sys
input = sys.stdin.readline
class Deer:
def __init__(self):
self.x = 0
self.y = 0
self.t = 0
def move(self, ti, xi, yi):
time_interval = ti - self.t
manhattan_distance = abs(xi - self.x) + abs(yi - self.y)
val = time_interval - manhattan_distance
if (val >= 0) and (val % 2 == 0):
self.x = xi
self.y = yi
self.t = ti
return True
else:
return False
AtCoDeer = Deer()
N = int(eval(input()))
flag = True
for _ in range(N):
ti, xi, yi = list(map(int, input().split()))
flag = flag and AtCoDeer.move(ti, xi, yi)
if flag:
print('Yes')
else:
print('No')
| import sys
input = sys.stdin.readline
N = int(eval(input()))
flag = True
for _ in range(N):
t, x, y = list(map(int, input().split()))
if (t < x + y) or (x + y + t) % 2:
flag = False
if flag:
print('Yes')
else:
print('No')
| 34 | 16 | 732 | 253 | import sys
input = sys.stdin.readline
class Deer:
def __init__(self):
self.x = 0
self.y = 0
self.t = 0
def move(self, ti, xi, yi):
time_interval = ti - self.t
manhattan_distance = abs(xi - self.x) + abs(yi - self.y)
val = time_interval - manhattan_distance
if (val >= 0) and (val % 2 == 0):
self.x = xi
self.y = yi
self.t = ti
return True
else:
return False
AtCoDeer = Deer()
N = int(eval(input()))
flag = True
for _ in range(N):
ti, xi, yi = list(map(int, input().split()))
flag = flag and AtCoDeer.move(ti, xi, yi)
if flag:
print("Yes")
else:
print("No")
| import sys
input = sys.stdin.readline
N = int(eval(input()))
flag = True
for _ in range(N):
t, x, y = list(map(int, input().split()))
if (t < x + y) or (x + y + t) % 2:
flag = False
if flag:
print("Yes")
else:
print("No")
| false | 52.941176 | [
"-",
"-",
"-class Deer:",
"- def __init__(self):",
"- self.x = 0",
"- self.y = 0",
"- self.t = 0",
"-",
"- def move(self, ti, xi, yi):",
"- time_interval = ti - self.t",
"- manhattan_distance = abs(xi - self.x) + abs(yi - self.y)",
"- val = time_interval - manhattan_distance",
"- if (val >= 0) and (val % 2 == 0):",
"- self.x = xi",
"- self.y = yi",
"- self.t = ti",
"- return True",
"- else:",
"- return False",
"-",
"-",
"-AtCoDeer = Deer()",
"- ti, xi, yi = list(map(int, input().split()))",
"- flag = flag and AtCoDeer.move(ti, xi, yi)",
"+ t, x, y = list(map(int, input().split()))",
"+ if (t < x + y) or (x + y + t) % 2:",
"+ flag = False"
] | false | 0.06943 | 0.035813 | 1.93867 | [
"s015785587",
"s912412925"
] |
u248424983 | p02418 | python | s173728514 | s025067333 | 30 | 20 | 7,468 | 5,560 | Accepted | Accepted | 33.33 | p=eval(input())
s=eval(input())
ret = 'Yes'
try: (p+p).index(s)
except : ret = 'No'
print(ret) | s = eval(input())
p = eval(input())
ret = 'No'
tts = s + s[:len(p)]
if p in tts: ret = 'Yes'
print(ret)
| 7 | 6 | 89 | 97 | p = eval(input())
s = eval(input())
ret = "Yes"
try:
(p + p).index(s)
except:
ret = "No"
print(ret)
| s = eval(input())
p = eval(input())
ret = "No"
tts = s + s[: len(p)]
if p in tts:
ret = "Yes"
print(ret)
| false | 14.285714 | [
"+s = eval(input())",
"-s = eval(input())",
"-ret = \"Yes\"",
"-try:",
"- (p + p).index(s)",
"-except:",
"- ret = \"No\"",
"+ret = \"No\"",
"+tts = s + s[: len(p)]",
"+if p in tts:",
"+ ret = \"Yes\""
] | false | 0.046673 | 0.110516 | 0.422315 | [
"s173728514",
"s025067333"
] |
u852690916 | p02763 | python | s314920739 | s413906125 | 672 | 468 | 116,300 | 116,300 | Accepted | Accepted | 30.36 | def main():
N = int(eval(input()))
S = eval(input())
tree = SegmentTree(initial_values=S, f=lambda x,y:x|y, converter=lambda c: 1 << (ord(c)-ord('a')))
Q = int(eval(input()))
update = tree.update
query = tree.query
for _ in range(Q):
t, a, b = input().split()
if t == '1': update(int(a)-1, b)
else: print((bin(query(int(a)-1, int(b))).count('1')))
class SegmentTree:
def __init__(self, n=None, f=max, zero_factory=int, converter=lambda x:x, initial_values=None):
assert(n or initial_values)
self.__f, self.__z, self.__c = f, zero_factory, converter
size = n if n else len(initial_values)
self.__n = 1 << ((size - 1).bit_length())
d = [zero_factory() for _ in range(2 * self.__n + 1)]
self.__dat = d
if initial_values:
for i, v in enumerate(initial_values): d[self.__n + i] = converter(v)
for i in range(self.__n - 1, 0, -1): d[i] = f(d[i<<1], d[i<<1|1])
def update(self, index, value):
i, v, d = index + self.__n, self.__c(value), self.__dat
if d[i] == v: return
d[i] = v
while i:
i = i >> 1
d[i] = self.__f(d[i<<1], d[i<<1|1])
def query(self, from_inclusive, to_exclusive):
ans = self.__z()
if to_exclusive <= from_inclusive: return ans
l, r = from_inclusive + self.__n, to_exclusive + self.__n
while l < r:
if l & 1: ans, l = self.__f(ans, self.__dat[l]), l+1
if r & 1: ans, r = self.__f(ans, self.__dat[r-1]), r-1
l, r = l >> 1, r >> 1
return ans
if __name__ == '__main__':
main()
| import sys
def main():
input = sys.stdin.readline
N = int(eval(input()))
S = input().rstrip()
tree = SegmentTree(initial_values=S, f=lambda x,y:x|y, converter=lambda c: 1 << (ord(c)-ord('a')))
Q = int(eval(input()))
update = tree.update
query = tree.query
for _ in range(Q):
t, a, b = input().rstrip().split()
if t == '1': update(int(a)-1, b)
else: print((bin(query(int(a)-1, int(b))).count('1')))
class SegmentTree:
def __init__(self, n=None, f=max, zero_factory=int, converter=lambda x:x, initial_values=None):
assert(n or initial_values)
self.__f, self.__z, self.__c = f, zero_factory, converter
size = n if n else len(initial_values)
self.__n = 1 << ((size - 1).bit_length())
d = [zero_factory() for _ in range(2 * self.__n + 1)]
self.__dat = d
if initial_values:
for i, v in enumerate(initial_values): d[self.__n + i] = converter(v)
for i in range(self.__n - 1, 0, -1): d[i] = f(d[i<<1], d[i<<1|1])
def update(self, index, value):
i, v, d = index + self.__n, self.__c(value), self.__dat
if d[i] == v: return
d[i] = v
while i:
i = i >> 1
d[i] = self.__f(d[i<<1], d[i<<1|1])
def query(self, from_inclusive, to_exclusive):
ans = self.__z()
if to_exclusive <= from_inclusive: return ans
l, r = from_inclusive + self.__n, to_exclusive + self.__n
while l < r:
if l & 1: ans, l = self.__f(ans, self.__dat[l]), l+1
if r & 1: ans, r = self.__f(ans, self.__dat[r-1]), r-1
l, r = l >> 1, r >> 1
return ans
if __name__ == '__main__':
main()
| 44 | 47 | 1,695 | 1,760 | def main():
N = int(eval(input()))
S = eval(input())
tree = SegmentTree(
initial_values=S,
f=lambda x, y: x | y,
converter=lambda c: 1 << (ord(c) - ord("a")),
)
Q = int(eval(input()))
update = tree.update
query = tree.query
for _ in range(Q):
t, a, b = input().split()
if t == "1":
update(int(a) - 1, b)
else:
print((bin(query(int(a) - 1, int(b))).count("1")))
class SegmentTree:
def __init__(
self,
n=None,
f=max,
zero_factory=int,
converter=lambda x: x,
initial_values=None,
):
assert n or initial_values
self.__f, self.__z, self.__c = f, zero_factory, converter
size = n if n else len(initial_values)
self.__n = 1 << ((size - 1).bit_length())
d = [zero_factory() for _ in range(2 * self.__n + 1)]
self.__dat = d
if initial_values:
for i, v in enumerate(initial_values):
d[self.__n + i] = converter(v)
for i in range(self.__n - 1, 0, -1):
d[i] = f(d[i << 1], d[i << 1 | 1])
def update(self, index, value):
i, v, d = index + self.__n, self.__c(value), self.__dat
if d[i] == v:
return
d[i] = v
while i:
i = i >> 1
d[i] = self.__f(d[i << 1], d[i << 1 | 1])
def query(self, from_inclusive, to_exclusive):
ans = self.__z()
if to_exclusive <= from_inclusive:
return ans
l, r = from_inclusive + self.__n, to_exclusive + self.__n
while l < r:
if l & 1:
ans, l = self.__f(ans, self.__dat[l]), l + 1
if r & 1:
ans, r = self.__f(ans, self.__dat[r - 1]), r - 1
l, r = l >> 1, r >> 1
return ans
if __name__ == "__main__":
main()
| import sys
def main():
input = sys.stdin.readline
N = int(eval(input()))
S = input().rstrip()
tree = SegmentTree(
initial_values=S,
f=lambda x, y: x | y,
converter=lambda c: 1 << (ord(c) - ord("a")),
)
Q = int(eval(input()))
update = tree.update
query = tree.query
for _ in range(Q):
t, a, b = input().rstrip().split()
if t == "1":
update(int(a) - 1, b)
else:
print((bin(query(int(a) - 1, int(b))).count("1")))
class SegmentTree:
def __init__(
self,
n=None,
f=max,
zero_factory=int,
converter=lambda x: x,
initial_values=None,
):
assert n or initial_values
self.__f, self.__z, self.__c = f, zero_factory, converter
size = n if n else len(initial_values)
self.__n = 1 << ((size - 1).bit_length())
d = [zero_factory() for _ in range(2 * self.__n + 1)]
self.__dat = d
if initial_values:
for i, v in enumerate(initial_values):
d[self.__n + i] = converter(v)
for i in range(self.__n - 1, 0, -1):
d[i] = f(d[i << 1], d[i << 1 | 1])
def update(self, index, value):
i, v, d = index + self.__n, self.__c(value), self.__dat
if d[i] == v:
return
d[i] = v
while i:
i = i >> 1
d[i] = self.__f(d[i << 1], d[i << 1 | 1])
def query(self, from_inclusive, to_exclusive):
ans = self.__z()
if to_exclusive <= from_inclusive:
return ans
l, r = from_inclusive + self.__n, to_exclusive + self.__n
while l < r:
if l & 1:
ans, l = self.__f(ans, self.__dat[l]), l + 1
if r & 1:
ans, r = self.__f(ans, self.__dat[r - 1]), r - 1
l, r = l >> 1, r >> 1
return ans
if __name__ == "__main__":
main()
| false | 6.382979 | [
"+import sys",
"+",
"+",
"+ input = sys.stdin.readline",
"- S = eval(input())",
"+ S = input().rstrip()",
"- t, a, b = input().split()",
"+ t, a, b = input().rstrip().split()"
] | false | 0.044751 | 0.083718 | 0.534548 | [
"s314920739",
"s413906125"
] |
u216015528 | p03162 | python | s266761273 | s221937243 | 1,923 | 984 | 49,300 | 50,312 | Accepted | Accepted | 48.83 | def resolve():
import sys
import itertools
import numpy as np
readline = sys.stdin.readline
N = int(readline())
lst = [list(map(int, readline().split())) for _ in [0] * N]
dp = np.full((N, 3), -1, np.int32)
for i in range(N):
for a, b in itertools.permutations([0, 1, 2], 2):
if a == b:
continue
if i == 0:
dp[i][a] = lst[i][a]
else:
dp[i][a] = max(dp[i][a], dp[i - 1][b] + lst[i][a])
print((max(dp[-1])))
resolve()
| #!/usr/bin/env python3
def main():
import numpy as np
N = int(eval(input()))
happiness = [list(map(int, input().split())) for _ in range(N)]
dp = np.zeros((N, 3), dtype=np.int64)
dp[0] = happiness[0]
for i in range(1, N):
for a, yesterday in enumerate(dp[i - 1]):
for b, today in enumerate(happiness[i]):
if a == b:
continue
dp[i][b] = max(dp[i][b], yesterday + today)
print((max(dp[-1])))
if __name__ == '__main__':
main()
| 22 | 20 | 567 | 543 | def resolve():
import sys
import itertools
import numpy as np
readline = sys.stdin.readline
N = int(readline())
lst = [list(map(int, readline().split())) for _ in [0] * N]
dp = np.full((N, 3), -1, np.int32)
for i in range(N):
for a, b in itertools.permutations([0, 1, 2], 2):
if a == b:
continue
if i == 0:
dp[i][a] = lst[i][a]
else:
dp[i][a] = max(dp[i][a], dp[i - 1][b] + lst[i][a])
print((max(dp[-1])))
resolve()
| #!/usr/bin/env python3
def main():
import numpy as np
N = int(eval(input()))
happiness = [list(map(int, input().split())) for _ in range(N)]
dp = np.zeros((N, 3), dtype=np.int64)
dp[0] = happiness[0]
for i in range(1, N):
for a, yesterday in enumerate(dp[i - 1]):
for b, today in enumerate(happiness[i]):
if a == b:
continue
dp[i][b] = max(dp[i][b], yesterday + today)
print((max(dp[-1])))
if __name__ == "__main__":
main()
| false | 9.090909 | [
"-def resolve():",
"- import sys",
"- import itertools",
"+#!/usr/bin/env python3",
"+def main():",
"- readline = sys.stdin.readline",
"- N = int(readline())",
"- lst = [list(map(int, readline().split())) for _ in [0] * N]",
"- dp = np.full((N, 3), -1, np.int32)",
"- for i in range(N):",
"- for a, b in itertools.permutations([0, 1, 2], 2):",
"- if a == b:",
"- continue",
"- if i == 0:",
"- dp[i][a] = lst[i][a]",
"- else:",
"- dp[i][a] = max(dp[i][a], dp[i - 1][b] + lst[i][a])",
"+ N = int(eval(input()))",
"+ happiness = [list(map(int, input().split())) for _ in range(N)]",
"+ dp = np.zeros((N, 3), dtype=np.int64)",
"+ dp[0] = happiness[0]",
"+ for i in range(1, N):",
"+ for a, yesterday in enumerate(dp[i - 1]):",
"+ for b, today in enumerate(happiness[i]):",
"+ if a == b:",
"+ continue",
"+ dp[i][b] = max(dp[i][b], yesterday + today)",
"-resolve()",
"+if __name__ == \"__main__\":",
"+ main()"
] | false | 0.935784 | 0.766117 | 1.221463 | [
"s266761273",
"s221937243"
] |
u349449706 | p02888 | python | s842305429 | s654211582 | 741 | 372 | 74,988 | 74,748 | Accepted | Accepted | 49.8 | def is_ok1(a,b,c):
return L[b] < L[c] + L[a]
def is_ok2(a,b,c):
return L[c] < L[a] + L[b]
def meguru_bisect(ng, ok, is_ok, a, b):
'''
初期値のng,okを受け取り,is_okを満たす最小(最大)のokを返す
まずis_okを定義すべし
ng ok は とり得る最小の値-1 とり得る最大の値+1
最大最小が逆の場合はよしなにひっくり返す
'''
while (abs(ok - ng) > 1):
mid = (ok + ng) // 2
if is_ok(a, b, mid):
ok = mid
else:
ng = mid
return ok
N = int(eval(input()))
L = sorted(list(map(int, input().split())))
ans = 0
for a in range(N):
for b in range(a+1, N):
ans += max(0, meguru_bisect(N, b, is_ok2, a, b)-meguru_bisect(b, N, is_ok1, a, b)+1)
print(ans)
| def is_ok(a,b,c):
return L[a] < L[b] + L[c]
def meguru_bisect(ng, ok, a, b):
'''
初期値のng,okを受け取り,is_okを満たす最小(最大)のokを返す
まずis_okを定義すべし
ng ok は とり得る最小の値-1 とり得る最大の値+1
最大最小が逆の場合はよしなにひっくり返す
'''
while (abs(ok - ng) > 1):
mid = (ok + ng) // 2
if is_ok(a, b, mid):
ok = mid
else:
ng = mid
return ok
N = int(eval(input()))
L = sorted(list(map(int, input().split())), reverse=True)
ans = 0
for a in range(N):
for b in range(a+1, N):
ans += meguru_bisect(N,b,a,b)-b
print(ans)
| 25 | 23 | 675 | 577 | def is_ok1(a, b, c):
return L[b] < L[c] + L[a]
def is_ok2(a, b, c):
return L[c] < L[a] + L[b]
def meguru_bisect(ng, ok, is_ok, a, b):
"""
初期値のng,okを受け取り,is_okを満たす最小(最大)のokを返す
まずis_okを定義すべし
ng ok は とり得る最小の値-1 とり得る最大の値+1
最大最小が逆の場合はよしなにひっくり返す
"""
while abs(ok - ng) > 1:
mid = (ok + ng) // 2
if is_ok(a, b, mid):
ok = mid
else:
ng = mid
return ok
N = int(eval(input()))
L = sorted(list(map(int, input().split())))
ans = 0
for a in range(N):
for b in range(a + 1, N):
ans += max(
0, meguru_bisect(N, b, is_ok2, a, b) - meguru_bisect(b, N, is_ok1, a, b) + 1
)
print(ans)
| def is_ok(a, b, c):
return L[a] < L[b] + L[c]
def meguru_bisect(ng, ok, a, b):
"""
初期値のng,okを受け取り,is_okを満たす最小(最大)のokを返す
まずis_okを定義すべし
ng ok は とり得る最小の値-1 とり得る最大の値+1
最大最小が逆の場合はよしなにひっくり返す
"""
while abs(ok - ng) > 1:
mid = (ok + ng) // 2
if is_ok(a, b, mid):
ok = mid
else:
ng = mid
return ok
N = int(eval(input()))
L = sorted(list(map(int, input().split())), reverse=True)
ans = 0
for a in range(N):
for b in range(a + 1, N):
ans += meguru_bisect(N, b, a, b) - b
print(ans)
| false | 8 | [
"-def is_ok1(a, b, c):",
"- return L[b] < L[c] + L[a]",
"+def is_ok(a, b, c):",
"+ return L[a] < L[b] + L[c]",
"-def is_ok2(a, b, c):",
"- return L[c] < L[a] + L[b]",
"-",
"-",
"-def meguru_bisect(ng, ok, is_ok, a, b):",
"+def meguru_bisect(ng, ok, a, b):",
"-L = sorted(list(map(int, input().split())))",
"+L = sorted(list(map(int, input().split())), reverse=True)",
"- ans += max(",
"- 0, meguru_bisect(N, b, is_ok2, a, b) - meguru_bisect(b, N, is_ok1, a, b) + 1",
"- )",
"+ ans += meguru_bisect(N, b, a, b) - b"
] | false | 0.068258 | 0.049383 | 1.382238 | [
"s842305429",
"s654211582"
] |
u353919145 | p03555 | python | s004185346 | s475624966 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | a=eval(input())
b=eval(input())
rev = ''.join(reversed(a))
if rev==b:
print("YES")
else:
print("NO") | str1=eval(input())
str2=eval(input())
str2=str2[::-1]
if(str1==str2):
print('YES')
else:
print('NO') | 7 | 9 | 102 | 106 | a = eval(input())
b = eval(input())
rev = "".join(reversed(a))
if rev == b:
print("YES")
else:
print("NO")
| str1 = eval(input())
str2 = eval(input())
str2 = str2[::-1]
if str1 == str2:
print("YES")
else:
print("NO")
| false | 22.222222 | [
"-a = eval(input())",
"-b = eval(input())",
"-rev = \"\".join(reversed(a))",
"-if rev == b:",
"+str1 = eval(input())",
"+str2 = eval(input())",
"+str2 = str2[::-1]",
"+if str1 == str2:"
] | false | 0.066934 | 0.065527 | 1.021472 | [
"s004185346",
"s475624966"
] |
u131984977 | p02414 | python | s558625795 | s712435472 | 550 | 430 | 7,760 | 8,372 | Accepted | Accepted | 21.82 | (n, m, l) = [int(i) for i in input().split()]
A = []
for nc in range(n):
A.append([int(i) for i in input().split()])
B = []
for mc in range(m):
B.append([int(i) for i in input().split()])
product = [[0 for d in range(l)] for dd in range(n)]
for nc in range(n):
for lc in range(l):
for mc in range(m):
product[nc][lc] += A[nc][mc] * B[mc][lc]
for r in product:
print((' '.join([str(d) for d in r]))) | (n, m, l) = [int(i) for i in input().split()]
A = []
B = []
for _ in range(n):
A.append([int(i) for i in input().split()])
for _ in range(m):
B.append([int(i) for i in input().split()])
for i in range(n):
C = [0 for _ in range(l)]
for j in range(l):
for k in range(m):
C[j] += A[i][k] * B[k][j]
print((" ".join([str(a) for a in C]))) | 19 | 15 | 455 | 387 | (n, m, l) = [int(i) for i in input().split()]
A = []
for nc in range(n):
A.append([int(i) for i in input().split()])
B = []
for mc in range(m):
B.append([int(i) for i in input().split()])
product = [[0 for d in range(l)] for dd in range(n)]
for nc in range(n):
for lc in range(l):
for mc in range(m):
product[nc][lc] += A[nc][mc] * B[mc][lc]
for r in product:
print((" ".join([str(d) for d in r])))
| (n, m, l) = [int(i) for i in input().split()]
A = []
B = []
for _ in range(n):
A.append([int(i) for i in input().split()])
for _ in range(m):
B.append([int(i) for i in input().split()])
for i in range(n):
C = [0 for _ in range(l)]
for j in range(l):
for k in range(m):
C[j] += A[i][k] * B[k][j]
print((" ".join([str(a) for a in C])))
| false | 21.052632 | [
"-for nc in range(n):",
"+B = []",
"+for _ in range(n):",
"-B = []",
"-for mc in range(m):",
"+for _ in range(m):",
"-product = [[0 for d in range(l)] for dd in range(n)]",
"-for nc in range(n):",
"- for lc in range(l):",
"- for mc in range(m):",
"- product[nc][lc] += A[nc][mc] * B[mc][lc]",
"-for r in product:",
"- print((\" \".join([str(d) for d in r])))",
"+for i in range(n):",
"+ C = [0 for _ in range(l)]",
"+ for j in range(l):",
"+ for k in range(m):",
"+ C[j] += A[i][k] * B[k][j]",
"+ print((\" \".join([str(a) for a in C])))"
] | false | 0.04703 | 0.045885 | 1.024957 | [
"s558625795",
"s712435472"
] |
u936985471 | p04035 | python | s511420041 | s678427575 | 122 | 100 | 14,060 | 19,856 | Accepted | Accepted | 18.03 | n,l=list(map(int,input().split()))
a=list(map(int,input().split()))
last=-1
for i in range(n-1):
if a[i]+a[i+1]>=l:
last=i+1
break
if last==-1:
print("Impossible")
else:
print("Possible")
for i in range(1,last):
print(i)
for i in range(len(a)-1,last-1,-1):
print(i)
| import sys
readline = sys.stdin.readline
N,L = list(map(int,readline().split()))
A = list(map(int,readline().split()))
# 2個でL以上の隣合うペアがどこかにあれば、そこを最後に残せば大丈夫
target = -1
for i in range(1,len(A)):
if A[i] + A[i - 1] >= L:
target = i
break
if target == -1:
print("Impossible")
exit(0)
left = []
for i in range(1,target):
left.append(i)
right = []
for i in range(len(A) - 1,target,-1):
right.append(i)
print("Possible")
for l in left:
print(l)
for r in right:
print(r)
print(target) | 15 | 30 | 300 | 528 | n, l = list(map(int, input().split()))
a = list(map(int, input().split()))
last = -1
for i in range(n - 1):
if a[i] + a[i + 1] >= l:
last = i + 1
break
if last == -1:
print("Impossible")
else:
print("Possible")
for i in range(1, last):
print(i)
for i in range(len(a) - 1, last - 1, -1):
print(i)
| import sys
readline = sys.stdin.readline
N, L = list(map(int, readline().split()))
A = list(map(int, readline().split()))
# 2個でL以上の隣合うペアがどこかにあれば、そこを最後に残せば大丈夫
target = -1
for i in range(1, len(A)):
if A[i] + A[i - 1] >= L:
target = i
break
if target == -1:
print("Impossible")
exit(0)
left = []
for i in range(1, target):
left.append(i)
right = []
for i in range(len(A) - 1, target, -1):
right.append(i)
print("Possible")
for l in left:
print(l)
for r in right:
print(r)
print(target)
| false | 50 | [
"-n, l = list(map(int, input().split()))",
"-a = list(map(int, input().split()))",
"-last = -1",
"-for i in range(n - 1):",
"- if a[i] + a[i + 1] >= l:",
"- last = i + 1",
"+import sys",
"+",
"+readline = sys.stdin.readline",
"+N, L = list(map(int, readline().split()))",
"+A = list(map(int, readline().split()))",
"+# 2個でL以上の隣合うペアがどこかにあれば、そこを最後に残せば大丈夫",
"+target = -1",
"+for i in range(1, len(A)):",
"+ if A[i] + A[i - 1] >= L:",
"+ target = i",
"-if last == -1:",
"+if target == -1:",
"-else:",
"- print(\"Possible\")",
"- for i in range(1, last):",
"- print(i)",
"- for i in range(len(a) - 1, last - 1, -1):",
"- print(i)",
"+ exit(0)",
"+left = []",
"+for i in range(1, target):",
"+ left.append(i)",
"+right = []",
"+for i in range(len(A) - 1, target, -1):",
"+ right.append(i)",
"+print(\"Possible\")",
"+for l in left:",
"+ print(l)",
"+for r in right:",
"+ print(r)",
"+print(target)"
] | false | 0.04964 | 0.050144 | 0.989967 | [
"s511420041",
"s678427575"
] |
u392319141 | p03946 | python | s361854109 | s052611497 | 118 | 94 | 15,020 | 14,244 | Accepted | Accepted | 20.34 | N, T = list(map(int, input().split()))
A = list(map(int, input().split()))
mx = [0] * (N + 1)
for i, a in enumerate(A[::-1], start=1):
mx[-i] = max(mx[-i + 1], a)
mxD = 0
ans = 0
for i, a in enumerate(A):
d = mx[i + 1] - a
if mxD < d:
mxD = d
ans = 0
if mxD == d:
ans += 1
print(ans)
| N, _ = list(map(int, input().split()))
A = list(map(int, input().split()))
mi = 10**18
mx = -10**18
ans = 0
for a in A:
if mx < a - mi:
ans = 0
mx = a - mi
if mx == a - mi:
ans += 1
mi = min(mi, a)
print(ans)
| 18 | 15 | 338 | 255 | N, T = list(map(int, input().split()))
A = list(map(int, input().split()))
mx = [0] * (N + 1)
for i, a in enumerate(A[::-1], start=1):
mx[-i] = max(mx[-i + 1], a)
mxD = 0
ans = 0
for i, a in enumerate(A):
d = mx[i + 1] - a
if mxD < d:
mxD = d
ans = 0
if mxD == d:
ans += 1
print(ans)
| N, _ = list(map(int, input().split()))
A = list(map(int, input().split()))
mi = 10**18
mx = -(10**18)
ans = 0
for a in A:
if mx < a - mi:
ans = 0
mx = a - mi
if mx == a - mi:
ans += 1
mi = min(mi, a)
print(ans)
| false | 16.666667 | [
"-N, T = list(map(int, input().split()))",
"+N, _ = list(map(int, input().split()))",
"-mx = [0] * (N + 1)",
"-for i, a in enumerate(A[::-1], start=1):",
"- mx[-i] = max(mx[-i + 1], a)",
"-mxD = 0",
"+mi = 10**18",
"+mx = -(10**18)",
"-for i, a in enumerate(A):",
"- d = mx[i + 1] - a",
"- if mxD < d:",
"- mxD = d",
"+for a in A:",
"+ if mx < a - mi:",
"- if mxD == d:",
"+ mx = a - mi",
"+ if mx == a - mi:",
"+ mi = min(mi, a)"
] | false | 0.039657 | 0.046339 | 0.855802 | [
"s361854109",
"s052611497"
] |
u046187684 | p03472 | python | s708588535 | s188436676 | 1,025 | 229 | 21,660 | 27,268 | Accepted | Accepted | 77.66 | #!/usr/bin/env python3
# coding=utf-8
import sys
import math
import numpy as np
n, h = list(map(int, sys.stdin.readline().strip().split(" ")))
a = []
b = []
for _ in range(n):
_a, _b = list(map(int, sys.stdin.readline().strip().split(" ")))
a.append(_a)
b.append(_b)
max_a = max(a)
cnt = 0
b = np.asarray(sorted(b))
b = b[b > max_a]
while h > 0 and len(b) > 0:
cnt += 1
h -= b[-1]
b = b[:-1]
if h > 0:
cnt += math.ceil(h / max_a)
print(cnt)
| from math import ceil
def solve(string):
n, h, * ab = list(map(int, string.split()))
max_a = max(ab[::2])
cnt = 0
b = sorted([b for b in ab[1::2] if b > max_a], reverse=True)
if sum(b) < h:
cnt = len(b) + ceil((h-sum(b)) / max_a)
else:
for _b in b:
cnt += 1
h -= _b
if h <= 0:
break
return str(cnt)
if __name__ == '__main__':
n, m = list(map(int, input().split()))
print((solve('{} {}\n'.format(n, m)+'\n'.join([eval(input()) for _ in range(n)]))))
| 24 | 22 | 481 | 558 | #!/usr/bin/env python3
# coding=utf-8
import sys
import math
import numpy as np
n, h = list(map(int, sys.stdin.readline().strip().split(" ")))
a = []
b = []
for _ in range(n):
_a, _b = list(map(int, sys.stdin.readline().strip().split(" ")))
a.append(_a)
b.append(_b)
max_a = max(a)
cnt = 0
b = np.asarray(sorted(b))
b = b[b > max_a]
while h > 0 and len(b) > 0:
cnt += 1
h -= b[-1]
b = b[:-1]
if h > 0:
cnt += math.ceil(h / max_a)
print(cnt)
| from math import ceil
def solve(string):
n, h, *ab = list(map(int, string.split()))
max_a = max(ab[::2])
cnt = 0
b = sorted([b for b in ab[1::2] if b > max_a], reverse=True)
if sum(b) < h:
cnt = len(b) + ceil((h - sum(b)) / max_a)
else:
for _b in b:
cnt += 1
h -= _b
if h <= 0:
break
return str(cnt)
if __name__ == "__main__":
n, m = list(map(int, input().split()))
print(
(solve("{} {}\n".format(n, m) + "\n".join([eval(input()) for _ in range(n)])))
)
| false | 8.333333 | [
"-#!/usr/bin/env python3",
"-# coding=utf-8",
"-import sys",
"-import math",
"-import numpy as np",
"+from math import ceil",
"-n, h = list(map(int, sys.stdin.readline().strip().split(\" \")))",
"-a = []",
"-b = []",
"-for _ in range(n):",
"- _a, _b = list(map(int, sys.stdin.readline().strip().split(\" \")))",
"- a.append(_a)",
"- b.append(_b)",
"-max_a = max(a)",
"-cnt = 0",
"-b = np.asarray(sorted(b))",
"-b = b[b > max_a]",
"-while h > 0 and len(b) > 0:",
"- cnt += 1",
"- h -= b[-1]",
"- b = b[:-1]",
"-if h > 0:",
"- cnt += math.ceil(h / max_a)",
"-print(cnt)",
"+",
"+def solve(string):",
"+ n, h, *ab = list(map(int, string.split()))",
"+ max_a = max(ab[::2])",
"+ cnt = 0",
"+ b = sorted([b for b in ab[1::2] if b > max_a], reverse=True)",
"+ if sum(b) < h:",
"+ cnt = len(b) + ceil((h - sum(b)) / max_a)",
"+ else:",
"+ for _b in b:",
"+ cnt += 1",
"+ h -= _b",
"+ if h <= 0:",
"+ break",
"+ return str(cnt)",
"+",
"+",
"+if __name__ == \"__main__\":",
"+ n, m = list(map(int, input().split()))",
"+ print(",
"+ (solve(\"{} {}\\n\".format(n, m) + \"\\n\".join([eval(input()) for _ in range(n)])))",
"+ )"
] | false | 0.305796 | 0.03844 | 7.955072 | [
"s708588535",
"s188436676"
] |
u077291787 | p02756 | python | s429034890 | s182633371 | 387 | 83 | 8,564 | 21,224 | Accepted | Accepted | 78.55 | # D - String Formation
from collections import deque
def main():
S = input().rstrip()
Q = int(eval(input()))
queue = deque(S)
is_reversed = 0
for _ in range(Q):
query = input().split()
if query[0] == "1":
is_reversed ^= 1
continue
com, c = query[1], query[2]
if com == "1":
if not is_reversed:
queue.appendleft(c)
else:
queue.append(c)
else:
if not is_reversed:
queue.append(c)
else:
queue.appendleft(c)
ans = "".join(queue) if not is_reversed else "".join(reversed(queue))
print(ans)
if __name__ == "__main__":
main()
| # D - String Formation
import sys
from collections import deque
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
S = readline().rstrip()
_ = readline()
queries = readlines()
queue = deque(S)
to_beginning, to_end = queue.appendleft, queue.append
is_reversed = 0
for query in queries:
if query[0] == "1":
to_beginning, to_end = to_end, to_beginning
is_reversed ^= 1
continue
com, c = query[2], query[4]
if com == "1":
to_beginning(c)
else:
to_end(c)
ans = "".join(queue) if not is_reversed else "".join(reversed(queue))
print(ans)
if __name__ == "__main__":
main()
| 31 | 31 | 755 | 755 | # D - String Formation
from collections import deque
def main():
S = input().rstrip()
Q = int(eval(input()))
queue = deque(S)
is_reversed = 0
for _ in range(Q):
query = input().split()
if query[0] == "1":
is_reversed ^= 1
continue
com, c = query[1], query[2]
if com == "1":
if not is_reversed:
queue.appendleft(c)
else:
queue.append(c)
else:
if not is_reversed:
queue.append(c)
else:
queue.appendleft(c)
ans = "".join(queue) if not is_reversed else "".join(reversed(queue))
print(ans)
if __name__ == "__main__":
main()
| # D - String Formation
import sys
from collections import deque
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
S = readline().rstrip()
_ = readline()
queries = readlines()
queue = deque(S)
to_beginning, to_end = queue.appendleft, queue.append
is_reversed = 0
for query in queries:
if query[0] == "1":
to_beginning, to_end = to_end, to_beginning
is_reversed ^= 1
continue
com, c = query[2], query[4]
if com == "1":
to_beginning(c)
else:
to_end(c)
ans = "".join(queue) if not is_reversed else "".join(reversed(queue))
print(ans)
if __name__ == "__main__":
main()
| false | 0 | [
"+import sys",
"+",
"+readline = sys.stdin.readline",
"+readlines = sys.stdin.readlines",
"- S = input().rstrip()",
"- Q = int(eval(input()))",
"+ S = readline().rstrip()",
"+ _ = readline()",
"+ queries = readlines()",
"+ to_beginning, to_end = queue.appendleft, queue.append",
"- for _ in range(Q):",
"- query = input().split()",
"+ for query in queries:",
"+ to_beginning, to_end = to_end, to_beginning",
"- com, c = query[1], query[2]",
"+ com, c = query[2], query[4]",
"- if not is_reversed:",
"- queue.appendleft(c)",
"- else:",
"- queue.append(c)",
"+ to_beginning(c)",
"- if not is_reversed:",
"- queue.append(c)",
"- else:",
"- queue.appendleft(c)",
"+ to_end(c)"
] | false | 0.044775 | 0.037872 | 1.182278 | [
"s429034890",
"s182633371"
] |
u179750651 | p02712 | python | s308840515 | s129586468 | 147 | 135 | 53,580 | 52,624 | Accepted | Accepted | 8.16 | n=int(eval(input()))
n=list(range(1,n+1))
n=([i for i in n if i % 3 != 0])
n=([i for i in n if i % 5 != 0])
print((sum(n))) | n=int(eval(input()))
n=list(range(1,n+1))
n=([i for i in n if i % 3 != 0 and i % 5 != 0])
print((sum(n)))
| 5 | 4 | 119 | 101 | n = int(eval(input()))
n = list(range(1, n + 1))
n = [i for i in n if i % 3 != 0]
n = [i for i in n if i % 5 != 0]
print((sum(n)))
| n = int(eval(input()))
n = list(range(1, n + 1))
n = [i for i in n if i % 3 != 0 and i % 5 != 0]
print((sum(n)))
| false | 20 | [
"-n = [i for i in n if i % 3 != 0]",
"-n = [i for i in n if i % 5 != 0]",
"+n = [i for i in n if i % 3 != 0 and i % 5 != 0]"
] | false | 0.111569 | 0.101394 | 1.100353 | [
"s308840515",
"s129586468"
] |
u782098901 | p03244 | python | s885073796 | s348528765 | 118 | 108 | 20,700 | 20,700 | Accepted | Accepted | 8.47 | import collections
n = int(eval(input()))
v = list(map(int, input().split()))
v1 = collections.Counter([x for i, x in enumerate(v) if i % 2 == 0]).most_common()
v2 = collections.Counter([x for i, x in enumerate(v) if i % 2 == 1]).most_common()
v1.append((0, 0))
v2.append((0, 0))
max_v1 = v1[0][1]
max_v2 = v2[0][1]
if v1[0][0] == v2[0][0]:
if max_v1 == max_v2:
if v1[1][1] >= v2[1][1]:
max_v1 = v1[1][1]
else:
max_v2 = v2[1][1]
elif max_v1 > max_v2:
max_v2 = v2[1][1]
elif max_v1 < max_v2:
max_v1 = v1[1][1]
ans = 0
for a in v1:
ans += a[1]
for a in v2:
ans += a[1]
print((ans - max_v1 - max_v2))
| import collections
n = int(eval(input()))
v = list(map(int, input().split()))
v1 = collections.Counter([x for i, x in enumerate(v) if i % 2 == 0]).most_common()
v2 = collections.Counter([x for i, x in enumerate(v) if i % 2 == 1]).most_common()
v1.append((0, 0))
v2.append((0, 0))
if v1[0][0] != v2[0][0]:
print((n - v1[0][1] - v2[0][1]))
else:
print((min(n - v1[0][1] - v2[1][1], n - v1[1][1] - v2[0][1])))
| 30 | 13 | 700 | 419 | import collections
n = int(eval(input()))
v = list(map(int, input().split()))
v1 = collections.Counter([x for i, x in enumerate(v) if i % 2 == 0]).most_common()
v2 = collections.Counter([x for i, x in enumerate(v) if i % 2 == 1]).most_common()
v1.append((0, 0))
v2.append((0, 0))
max_v1 = v1[0][1]
max_v2 = v2[0][1]
if v1[0][0] == v2[0][0]:
if max_v1 == max_v2:
if v1[1][1] >= v2[1][1]:
max_v1 = v1[1][1]
else:
max_v2 = v2[1][1]
elif max_v1 > max_v2:
max_v2 = v2[1][1]
elif max_v1 < max_v2:
max_v1 = v1[1][1]
ans = 0
for a in v1:
ans += a[1]
for a in v2:
ans += a[1]
print((ans - max_v1 - max_v2))
| import collections
n = int(eval(input()))
v = list(map(int, input().split()))
v1 = collections.Counter([x for i, x in enumerate(v) if i % 2 == 0]).most_common()
v2 = collections.Counter([x for i, x in enumerate(v) if i % 2 == 1]).most_common()
v1.append((0, 0))
v2.append((0, 0))
if v1[0][0] != v2[0][0]:
print((n - v1[0][1] - v2[0][1]))
else:
print((min(n - v1[0][1] - v2[1][1], n - v1[1][1] - v2[0][1])))
| false | 56.666667 | [
"-max_v1 = v1[0][1]",
"-max_v2 = v2[0][1]",
"-if v1[0][0] == v2[0][0]:",
"- if max_v1 == max_v2:",
"- if v1[1][1] >= v2[1][1]:",
"- max_v1 = v1[1][1]",
"- else:",
"- max_v2 = v2[1][1]",
"- elif max_v1 > max_v2:",
"- max_v2 = v2[1][1]",
"- elif max_v1 < max_v2:",
"- max_v1 = v1[1][1]",
"-ans = 0",
"-for a in v1:",
"- ans += a[1]",
"-for a in v2:",
"- ans += a[1]",
"-print((ans - max_v1 - max_v2))",
"+if v1[0][0] != v2[0][0]:",
"+ print((n - v1[0][1] - v2[0][1]))",
"+else:",
"+ print((min(n - v1[0][1] - v2[1][1], n - v1[1][1] - v2[0][1])))"
] | false | 0.035697 | 0.061657 | 0.578959 | [
"s885073796",
"s348528765"
] |
u141574039 | p02818 | python | s094469676 | s400297832 | 24 | 17 | 2,940 | 3,060 | Accepted | Accepted | 29.17 | A,B,K=list(map(int,input().split()))
C=A+B-K
if C<=0:
A=0
B=0
else:
if A>=K:
A=A-K
else:
B=B-(K-A)
A=0
print((A,B)) | A,B,K=list(map(int,input().split()))
t,a=0,0
if K>(A+B):
print((t,a))
else:
if K>=A:
t=0
a=B+(A-K)
else:
t=A-K
a=B
print((t,a)) | 12 | 12 | 138 | 152 | A, B, K = list(map(int, input().split()))
C = A + B - K
if C <= 0:
A = 0
B = 0
else:
if A >= K:
A = A - K
else:
B = B - (K - A)
A = 0
print((A, B))
| A, B, K = list(map(int, input().split()))
t, a = 0, 0
if K > (A + B):
print((t, a))
else:
if K >= A:
t = 0
a = B + (A - K)
else:
t = A - K
a = B
print((t, a))
| false | 0 | [
"-C = A + B - K",
"-if C <= 0:",
"- A = 0",
"- B = 0",
"+t, a = 0, 0",
"+if K > (A + B):",
"+ print((t, a))",
"- if A >= K:",
"- A = A - K",
"+ if K >= A:",
"+ t = 0",
"+ a = B + (A - K)",
"- B = B - (K - A)",
"- A = 0",
"-print((A, B))",
"+ t = A - K",
"+ a = B",
"+ print((t, a))"
] | false | 0.036944 | 0.059294 | 0.623063 | [
"s094469676",
"s400297832"
] |
u130900604 | p02640 | python | s143451716 | s609565555 | 76 | 56 | 64,744 | 61,856 | Accepted | Accepted | 26.32 | def LI():return list(map(int,input().split()))
def MI():return list(map(int,open(0).read().split()))
def I():return int(eval(input()))
def yes():print("Yes")
def no():print("No")
from collections import deque, Counter
from heapq import heappop, heappush
INF=float("inf")
# import math
# pi=math.pi
# import numpy as np
x,y=LI()
for a in range(0,x+1):
b=x-a
if b>=0 and 2*a+4*b==y:
yes()
exit()
no()
| x,y=list(map(int,input().split()))
for a in range(0,x+1):
b=x-a
if 2*a+4*b==y:
print("Yes")
exit()
print("No") | 24 | 7 | 448 | 134 | def LI():
return list(map(int, input().split()))
def MI():
return list(map(int, open(0).read().split()))
def I():
return int(eval(input()))
def yes():
print("Yes")
def no():
print("No")
from collections import deque, Counter
from heapq import heappop, heappush
INF = float("inf")
# import math
# pi=math.pi
# import numpy as np
x, y = LI()
for a in range(0, x + 1):
b = x - a
if b >= 0 and 2 * a + 4 * b == y:
yes()
exit()
no()
| x, y = list(map(int, input().split()))
for a in range(0, x + 1):
b = x - a
if 2 * a + 4 * b == y:
print("Yes")
exit()
print("No")
| false | 70.833333 | [
"-def LI():",
"- return list(map(int, input().split()))",
"-",
"-",
"-def MI():",
"- return list(map(int, open(0).read().split()))",
"-",
"-",
"-def I():",
"- return int(eval(input()))",
"-",
"-",
"-def yes():",
"- print(\"Yes\")",
"-",
"-",
"-def no():",
"- print(\"No\")",
"-",
"-",
"-from collections import deque, Counter",
"-from heapq import heappop, heappush",
"-",
"-INF = float(\"inf\")",
"-# import math",
"-# pi=math.pi",
"-# import numpy as np",
"-x, y = LI()",
"+x, y = list(map(int, input().split()))",
"- if b >= 0 and 2 * a + 4 * b == y:",
"- yes()",
"+ if 2 * a + 4 * b == y:",
"+ print(\"Yes\")",
"-no()",
"+print(\"No\")"
] | false | 0.038207 | 0.0745 | 0.512855 | [
"s143451716",
"s609565555"
] |
u730769327 | p03575 | python | s924296769 | s163972439 | 1,199 | 107 | 59,612 | 75,400 | Accepted | Accepted | 91.08 | n,m=list(map(int,input().split()))
e=[[] for _ in range(n)]
b=[]
for i in range(m):
x,y=list(map(int,input().split()))
e[x-1].append(y-1)
e[y-1].append(x-1)
b.append([x-1,y-1])
def ne(now,s,visit):
visit.append(now)
for i in e[now]:
if i not in visit:
ne(i, s, visit[:])
elif len(visit)>2 and s==i:
v1=visit[1]
v2=visit[-1]
if [s,v1] in b: b.remove([s,v1])
elif [v1,s] in b: b.remove([v1,s])
if [s,v2] in b:b.remove([s,v2])
elif [v2,s] in b:b.remove([v2,s])
break
for i in range(n):
ne(i,i,[])
print((len(b))) | from itertools import combinations
class UnionFind():
def __init__(self, n):
self.n = n
self.root = [-1]*(n+1)
self.rnk = [0]*(n+1)
def Find_Root(self, x):
if(self.root[x] < 0):
return x
else:
self.root[x] = self.Find_Root(self.root[x])
return self.root[x]
def Unite(self, x, y):
x = self.Find_Root(x)
y = self.Find_Root(y)
if(x == y):
return
elif(self.rnk[x] > self.rnk[y]):
self.root[x] += self.root[y]
self.root[y] = x
else:
self.root[y] += self.root[x]
self.root[x] = y
if(self.rnk[x] == self.rnk[y]):
self.rnk[y] += 1
def isSameGroup(self, x, y):
return self.Find_Root(x) == self.Find_Root(y)
def Count(self, x):
return -self.root[self.Find_Root(x)]
n,m=list(map(int,input().split()))
uf=UnionFind(n)
e=[]
comb=list(combinations(list(range(n)),2))
for _ in range(m):
a,b=list(map(int,input().split()))
e.append((a-1,b-1))
ans=0
for i in range(m):
uf=UnionFind(n)
for j in range(m):
if i==j:continue
uf.Unite(*e[j])
if not all([uf.isSameGroup(x,y) for x,y in comb]):ans+=1
print(ans) | 27 | 45 | 594 | 1,279 | n, m = list(map(int, input().split()))
e = [[] for _ in range(n)]
b = []
for i in range(m):
x, y = list(map(int, input().split()))
e[x - 1].append(y - 1)
e[y - 1].append(x - 1)
b.append([x - 1, y - 1])
def ne(now, s, visit):
visit.append(now)
for i in e[now]:
if i not in visit:
ne(i, s, visit[:])
elif len(visit) > 2 and s == i:
v1 = visit[1]
v2 = visit[-1]
if [s, v1] in b:
b.remove([s, v1])
elif [v1, s] in b:
b.remove([v1, s])
if [s, v2] in b:
b.remove([s, v2])
elif [v2, s] in b:
b.remove([v2, s])
break
for i in range(n):
ne(i, i, [])
print((len(b)))
| from itertools import combinations
class UnionFind:
def __init__(self, n):
self.n = n
self.root = [-1] * (n + 1)
self.rnk = [0] * (n + 1)
def Find_Root(self, x):
if self.root[x] < 0:
return x
else:
self.root[x] = self.Find_Root(self.root[x])
return self.root[x]
def Unite(self, x, y):
x = self.Find_Root(x)
y = self.Find_Root(y)
if x == y:
return
elif self.rnk[x] > self.rnk[y]:
self.root[x] += self.root[y]
self.root[y] = x
else:
self.root[y] += self.root[x]
self.root[x] = y
if self.rnk[x] == self.rnk[y]:
self.rnk[y] += 1
def isSameGroup(self, x, y):
return self.Find_Root(x) == self.Find_Root(y)
def Count(self, x):
return -self.root[self.Find_Root(x)]
n, m = list(map(int, input().split()))
uf = UnionFind(n)
e = []
comb = list(combinations(list(range(n)), 2))
for _ in range(m):
a, b = list(map(int, input().split()))
e.append((a - 1, b - 1))
ans = 0
for i in range(m):
uf = UnionFind(n)
for j in range(m):
if i == j:
continue
uf.Unite(*e[j])
if not all([uf.isSameGroup(x, y) for x, y in comb]):
ans += 1
print(ans)
| false | 40 | [
"-n, m = list(map(int, input().split()))",
"-e = [[] for _ in range(n)]",
"-b = []",
"-for i in range(m):",
"- x, y = list(map(int, input().split()))",
"- e[x - 1].append(y - 1)",
"- e[y - 1].append(x - 1)",
"- b.append([x - 1, y - 1])",
"+from itertools import combinations",
"-def ne(now, s, visit):",
"- visit.append(now)",
"- for i in e[now]:",
"- if i not in visit:",
"- ne(i, s, visit[:])",
"- elif len(visit) > 2 and s == i:",
"- v1 = visit[1]",
"- v2 = visit[-1]",
"- if [s, v1] in b:",
"- b.remove([s, v1])",
"- elif [v1, s] in b:",
"- b.remove([v1, s])",
"- if [s, v2] in b:",
"- b.remove([s, v2])",
"- elif [v2, s] in b:",
"- b.remove([v2, s])",
"- break",
"+class UnionFind:",
"+ def __init__(self, n):",
"+ self.n = n",
"+ self.root = [-1] * (n + 1)",
"+ self.rnk = [0] * (n + 1)",
"+",
"+ def Find_Root(self, x):",
"+ if self.root[x] < 0:",
"+ return x",
"+ else:",
"+ self.root[x] = self.Find_Root(self.root[x])",
"+ return self.root[x]",
"+",
"+ def Unite(self, x, y):",
"+ x = self.Find_Root(x)",
"+ y = self.Find_Root(y)",
"+ if x == y:",
"+ return",
"+ elif self.rnk[x] > self.rnk[y]:",
"+ self.root[x] += self.root[y]",
"+ self.root[y] = x",
"+ else:",
"+ self.root[y] += self.root[x]",
"+ self.root[x] = y",
"+ if self.rnk[x] == self.rnk[y]:",
"+ self.rnk[y] += 1",
"+",
"+ def isSameGroup(self, x, y):",
"+ return self.Find_Root(x) == self.Find_Root(y)",
"+",
"+ def Count(self, x):",
"+ return -self.root[self.Find_Root(x)]",
"-for i in range(n):",
"- ne(i, i, [])",
"-print((len(b)))",
"+n, m = list(map(int, input().split()))",
"+uf = UnionFind(n)",
"+e = []",
"+comb = list(combinations(list(range(n)), 2))",
"+for _ in range(m):",
"+ a, b = list(map(int, input().split()))",
"+ e.append((a - 1, b - 1))",
"+ans = 0",
"+for i in range(m):",
"+ uf = UnionFind(n)",
"+ for j in range(m):",
"+ if i == j:",
"+ continue",
"+ uf.Unite(*e[j])",
"+ if not all([uf.isSameGroup(x, y) for x, y in comb]):",
"+ ans += 1",
"+print(ans)"
] | false | 0.052612 | 0.007855 | 6.698214 | [
"s924296769",
"s163972439"
] |
u577170763 | p02921 | python | s164867889 | s415723448 | 180 | 21 | 38,384 | 3,436 | Accepted | Accepted | 88.33 | import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**8)
def geta(fn=lambda s: s.decode()):
return list(map(fn, readline().split()))
def gete(fn=lambda s: s.decode()):
return fn(readline().rstrip())
def main():
s = gete()
t = gete()
ans = 0
for i in range(len(s)):
if s[i] == t[i]:
ans += 1
print(ans)
if __name__ == "__main__":
main() | import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**8)
def geta(fn=lambda s: s.decode()):
return list(map(fn, readline().split()))
def gete(fn=lambda s: s.decode()):
return fn(readline().rstrip())
def main():
s = gete()
t = gete()
ans = 0
for i in range(3):
if s[i] == t[i]: ans += 1
print(ans)
if __name__ == "__main__":
main() | 27 | 26 | 473 | 455 | import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**8)
def geta(fn=lambda s: s.decode()):
return list(map(fn, readline().split()))
def gete(fn=lambda s: s.decode()):
return fn(readline().rstrip())
def main():
s = gete()
t = gete()
ans = 0
for i in range(len(s)):
if s[i] == t[i]:
ans += 1
print(ans)
if __name__ == "__main__":
main()
| import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**8)
def geta(fn=lambda s: s.decode()):
return list(map(fn, readline().split()))
def gete(fn=lambda s: s.decode()):
return fn(readline().rstrip())
def main():
s = gete()
t = gete()
ans = 0
for i in range(3):
if s[i] == t[i]:
ans += 1
print(ans)
if __name__ == "__main__":
main()
| false | 3.703704 | [
"- for i in range(len(s)):",
"+ for i in range(3):"
] | false | 0.035564 | 0.035385 | 1.005058 | [
"s164867889",
"s415723448"
] |
u440566786 | p02886 | python | s520602319 | s870853725 | 183 | 164 | 39,024 | 38,384 | Accepted | Accepted | 10.38 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# input=lambda :sys.stdin.readline().rstrip()
def resolve():
n=int(eval(input()))
D=list(map(int,input().split()))
ans=0
for i in range(n):
for j in range(i+1,n):
ans+=D[i]*D[j]
print(ans)
resolve() | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
n=int(eval(input()))
A=list(map(int,input().split()))
s=sum(A)
t=sum(a**2 for a in A)
print(((s**2-t)//2))
resolve() | 14 | 12 | 319 | 271 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
# input=lambda :sys.stdin.readline().rstrip()
def resolve():
n = int(eval(input()))
D = list(map(int, input().split()))
ans = 0
for i in range(n):
for j in range(i + 1, n):
ans += D[i] * D[j]
print(ans)
resolve()
| import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
s = sum(A)
t = sum(a**2 for a in A)
print(((s**2 - t) // 2))
resolve()
| false | 14.285714 | [
"-# input=lambda :sys.stdin.readline().rstrip()",
"+input = lambda: sys.stdin.readline().rstrip()",
"+",
"+",
"- D = list(map(int, input().split()))",
"- ans = 0",
"- for i in range(n):",
"- for j in range(i + 1, n):",
"- ans += D[i] * D[j]",
"- print(ans)",
"+ A = list(map(int, input().split()))",
"+ s = sum(A)",
"+ t = sum(a**2 for a in A)",
"+ print(((s**2 - t) // 2))"
] | false | 0.043122 | 0.044979 | 0.958711 | [
"s520602319",
"s870853725"
] |
u627600101 | p02574 | python | s827306757 | s795284731 | 588 | 443 | 215,580 | 205,108 | Accepted | Accepted | 24.66 | from math import gcd
from collections import deque
# = map(int, input().split())
N = int(eval(input()))
A = deque(list(map(int, input().split())))
mA = max(A)
counter = [0 for _ in range(mA+1)]
primenum = [2]
sgn = [-1 for _ in range(int(mA**0.5)+1)]
k = 3
while k**2 <= mA:
if sgn[k] == -1:
primenum.append(k)
add = k*k
ok = k
while ok**2 <= mA:
sgn[ok] = 1
ok += add
k += 2
#prime_num が用意されているとき
def factorization(n):
M = n
for p in primenum:
if p**2 > M:
break
else:
if M%p == 0:
if counter[p] == 0:
counter[p] = 1
else:
return False
while M%p == 0:
M //= p
if M > 1:
if counter[M] == 0:
counter[M] = 1
else:
return False
return True
g = A[0]
flag = True
for k in range(N):
a = A.popleft()
g = gcd(g, a)
if flag:
flag = factorization(a)
if flag == False:
if g == 1:
break
if flag:
print('pairwise coprime')
exit()
if g == 1:
print('setwise coprime')
else:
print('not coprime')
| from math import gcd
# = map(int, input().split())
N = int(eval(input()))
A = list(map(int, input().split()))
flag = True
c2 = 0
c3 = 0
c5 = 0
for k in range(N):
if A[k] %2 ==0:
c2 += 1
if c2 > 1:
flag = False
break
elif A[k] %3 ==0:
c3 += 1
if c3 > 1:
flag = False
break
elif A[k] %5 == 0:
c5 += 1
if c5 >1:
flag = False
break
if flag:
mA = max(A)
counter = [0 for _ in range(mA+1)]
primenum = [2]
sgn = [-1 for _ in range(int(mA**0.5)+1)]
k = 3
while k**2 <= mA:
if sgn[k] == -1:
primenum.append(k)
add = k*k
ok = k
while ok**2 <= mA:
sgn[ok] = 1
ok += add
k += 2
#prime_num が用意されているとき
def factorization(n):
M = n
for p in primenum:
if p**2 > M:
break
else:
if M%p == 0:
if counter[p] == 0:
counter[p] = 1
else:
return False
while M%p == 0:
M //= p
if M > 1:
if counter[M] == 0:
counter[M] = 1
else:
return False
return True
g = A[0]
for k in range(N):
a = A[k]
g = gcd(g, a)
if flag:
flag = factorization(a)
if flag == False:
if g == 1:
break
if flag:
print('pairwise coprime')
exit()
if g == 1:
print('setwise coprime')
else:
print('not coprime')
| 62 | 83 | 1,099 | 1,433 | from math import gcd
from collections import deque
# = map(int, input().split())
N = int(eval(input()))
A = deque(list(map(int, input().split())))
mA = max(A)
counter = [0 for _ in range(mA + 1)]
primenum = [2]
sgn = [-1 for _ in range(int(mA**0.5) + 1)]
k = 3
while k**2 <= mA:
if sgn[k] == -1:
primenum.append(k)
add = k * k
ok = k
while ok**2 <= mA:
sgn[ok] = 1
ok += add
k += 2
# prime_num が用意されているとき
def factorization(n):
M = n
for p in primenum:
if p**2 > M:
break
else:
if M % p == 0:
if counter[p] == 0:
counter[p] = 1
else:
return False
while M % p == 0:
M //= p
if M > 1:
if counter[M] == 0:
counter[M] = 1
else:
return False
return True
g = A[0]
flag = True
for k in range(N):
a = A.popleft()
g = gcd(g, a)
if flag:
flag = factorization(a)
if flag == False:
if g == 1:
break
if flag:
print("pairwise coprime")
exit()
if g == 1:
print("setwise coprime")
else:
print("not coprime")
| from math import gcd
# = map(int, input().split())
N = int(eval(input()))
A = list(map(int, input().split()))
flag = True
c2 = 0
c3 = 0
c5 = 0
for k in range(N):
if A[k] % 2 == 0:
c2 += 1
if c2 > 1:
flag = False
break
elif A[k] % 3 == 0:
c3 += 1
if c3 > 1:
flag = False
break
elif A[k] % 5 == 0:
c5 += 1
if c5 > 1:
flag = False
break
if flag:
mA = max(A)
counter = [0 for _ in range(mA + 1)]
primenum = [2]
sgn = [-1 for _ in range(int(mA**0.5) + 1)]
k = 3
while k**2 <= mA:
if sgn[k] == -1:
primenum.append(k)
add = k * k
ok = k
while ok**2 <= mA:
sgn[ok] = 1
ok += add
k += 2
# prime_num が用意されているとき
def factorization(n):
M = n
for p in primenum:
if p**2 > M:
break
else:
if M % p == 0:
if counter[p] == 0:
counter[p] = 1
else:
return False
while M % p == 0:
M //= p
if M > 1:
if counter[M] == 0:
counter[M] = 1
else:
return False
return True
g = A[0]
for k in range(N):
a = A[k]
g = gcd(g, a)
if flag:
flag = factorization(a)
if flag == False:
if g == 1:
break
if flag:
print("pairwise coprime")
exit()
if g == 1:
print("setwise coprime")
else:
print("not coprime")
| false | 25.301205 | [
"-from collections import deque",
"-A = deque(list(map(int, input().split())))",
"-mA = max(A)",
"-counter = [0 for _ in range(mA + 1)]",
"-primenum = [2]",
"-sgn = [-1 for _ in range(int(mA**0.5) + 1)]",
"-k = 3",
"-while k**2 <= mA:",
"- if sgn[k] == -1:",
"- primenum.append(k)",
"- add = k * k",
"- ok = k",
"- while ok**2 <= mA:",
"- sgn[ok] = 1",
"- ok += add",
"- k += 2",
"-# prime_num が用意されているとき",
"-def factorization(n):",
"- M = n",
"- for p in primenum:",
"- if p**2 > M:",
"+A = list(map(int, input().split()))",
"+flag = True",
"+c2 = 0",
"+c3 = 0",
"+c5 = 0",
"+for k in range(N):",
"+ if A[k] % 2 == 0:",
"+ c2 += 1",
"+ if c2 > 1:",
"+ flag = False",
"- else:",
"- if M % p == 0:",
"- if counter[p] == 0:",
"- counter[p] = 1",
"- else:",
"- return False",
"- while M % p == 0:",
"- M //= p",
"- if M > 1:",
"- if counter[M] == 0:",
"- counter[M] = 1",
"- else:",
"- return False",
"- return True",
"+ elif A[k] % 3 == 0:",
"+ c3 += 1",
"+ if c3 > 1:",
"+ flag = False",
"+ break",
"+ elif A[k] % 5 == 0:",
"+ c5 += 1",
"+ if c5 > 1:",
"+ flag = False",
"+ break",
"+if flag:",
"+ mA = max(A)",
"+ counter = [0 for _ in range(mA + 1)]",
"+ primenum = [2]",
"+ sgn = [-1 for _ in range(int(mA**0.5) + 1)]",
"+ k = 3",
"+ while k**2 <= mA:",
"+ if sgn[k] == -1:",
"+ primenum.append(k)",
"+ add = k * k",
"+ ok = k",
"+ while ok**2 <= mA:",
"+ sgn[ok] = 1",
"+ ok += add",
"+ k += 2",
"+ # prime_num が用意されているとき",
"+ def factorization(n):",
"+ M = n",
"+ for p in primenum:",
"+ if p**2 > M:",
"+ break",
"+ else:",
"+ if M % p == 0:",
"+ if counter[p] == 0:",
"+ counter[p] = 1",
"+ else:",
"+ return False",
"+ while M % p == 0:",
"+ M //= p",
"+ if M > 1:",
"+ if counter[M] == 0:",
"+ counter[M] = 1",
"+ else:",
"+ return False",
"+ return True",
"-flag = True",
"- a = A.popleft()",
"+ a = A[k]"
] | false | 0.040861 | 0.123148 | 0.331808 | [
"s827306757",
"s795284731"
] |
u019637926 | p03166 | python | s593755657 | s973829396 | 878 | 590 | 143,904 | 135,344 | Accepted | Accepted | 32.8 | import sys
sys.setrecursionlimit(10 ** 5 * 2)
N, M = list(map(int, input().split()))
Ps = [[] for _ in range(N)]
for i in range(M):
x, y = list(map(int, input().split()))
Ps[x - 1].append(y - 1)
mem = [-1] * N
def rec(n):
if mem[n] > -1:
return mem[n]
elif len(Ps[n]) == 0:
mem[n] = 0
return mem[n]
else:
mem[n] = max([rec(Ps[n][i]) for i in range(len(Ps[n]))]) + 1
return mem[n]
for i in range(N):
rec(i)
print((max(mem))) | import sys
sys.setrecursionlimit(10 ** 5 * 2)
input = sys.stdin.readline
N, M = list(map(int, input().split()))
Ps = [[] for _ in range(N)]
for i in range(M):
x, y = list(map(int, input().split()))
Ps[x - 1].append(y - 1)
mem = [-1] * N
def rec(n):
if mem[n] > -1:
return mem[n]
elif len(Ps[n]) == 0:
mem[n] = 0
return mem[n]
else:
mem[n] = max([rec(Ps[n][i]) for i in range(len(Ps[n]))]) + 1
return mem[n]
for i in range(N):
rec(i)
print((max(mem))) | 26 | 27 | 504 | 532 | import sys
sys.setrecursionlimit(10**5 * 2)
N, M = list(map(int, input().split()))
Ps = [[] for _ in range(N)]
for i in range(M):
x, y = list(map(int, input().split()))
Ps[x - 1].append(y - 1)
mem = [-1] * N
def rec(n):
if mem[n] > -1:
return mem[n]
elif len(Ps[n]) == 0:
mem[n] = 0
return mem[n]
else:
mem[n] = max([rec(Ps[n][i]) for i in range(len(Ps[n]))]) + 1
return mem[n]
for i in range(N):
rec(i)
print((max(mem)))
| import sys
sys.setrecursionlimit(10**5 * 2)
input = sys.stdin.readline
N, M = list(map(int, input().split()))
Ps = [[] for _ in range(N)]
for i in range(M):
x, y = list(map(int, input().split()))
Ps[x - 1].append(y - 1)
mem = [-1] * N
def rec(n):
if mem[n] > -1:
return mem[n]
elif len(Ps[n]) == 0:
mem[n] = 0
return mem[n]
else:
mem[n] = max([rec(Ps[n][i]) for i in range(len(Ps[n]))]) + 1
return mem[n]
for i in range(N):
rec(i)
print((max(mem)))
| false | 3.703704 | [
"+input = sys.stdin.readline"
] | false | 0.078247 | 0.036976 | 2.116148 | [
"s593755657",
"s973829396"
] |
u281303342 | p03351 | python | s189643024 | s027543344 | 19 | 17 | 3,316 | 2,940 | Accepted | Accepted | 10.53 | a,b,c,d = list(map(int,input().split()))
if abs(a-c) <= d or (abs(a-b) <= d and abs(c-b) <= d):
print("Yes")
else:
print("No") | A,B,C,D = list(map(int,input().split()))
print(("Yes" if abs(A-C)<=D or abs(A-B)<=D and abs(B-C)<=D else "No")) | 5 | 2 | 132 | 104 | a, b, c, d = list(map(int, input().split()))
if abs(a - c) <= d or (abs(a - b) <= d and abs(c - b) <= d):
print("Yes")
else:
print("No")
| A, B, C, D = list(map(int, input().split()))
print(("Yes" if abs(A - C) <= D or abs(A - B) <= D and abs(B - C) <= D else "No"))
| false | 60 | [
"-a, b, c, d = list(map(int, input().split()))",
"-if abs(a - c) <= d or (abs(a - b) <= d and abs(c - b) <= d):",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+A, B, C, D = list(map(int, input().split()))",
"+print((\"Yes\" if abs(A - C) <= D or abs(A - B) <= D and abs(B - C) <= D else \"No\"))"
] | false | 0.037036 | 0.10236 | 0.36182 | [
"s189643024",
"s027543344"
] |
u757117214 | p02641 | python | s168478061 | s414886972 | 60 | 23 | 61,928 | 9,184 | Accepted | Accepted | 61.67 | X,N,*p = list(map(int,open(0).read().split()))
dif = 100
ans = -1
for i in range(102):
a = abs(X-i)
if i in p:
continue
if a < dif:
dif = a
ans = i
print(ans) | X,N= list(map(int,input().split()))
p = list(map(int,input().split()))
for i in range(100):
if X-i not in p:
print((X-i))
exit()
if X+i not in p:
print((X+i))
exit() | 11 | 9 | 199 | 183 | X, N, *p = list(map(int, open(0).read().split()))
dif = 100
ans = -1
for i in range(102):
a = abs(X - i)
if i in p:
continue
if a < dif:
dif = a
ans = i
print(ans)
| X, N = list(map(int, input().split()))
p = list(map(int, input().split()))
for i in range(100):
if X - i not in p:
print((X - i))
exit()
if X + i not in p:
print((X + i))
exit()
| false | 18.181818 | [
"-X, N, *p = list(map(int, open(0).read().split()))",
"-dif = 100",
"-ans = -1",
"-for i in range(102):",
"- a = abs(X - i)",
"- if i in p:",
"- continue",
"- if a < dif:",
"- dif = a",
"- ans = i",
"-print(ans)",
"+X, N = list(map(int, input().split()))",
"+p = list(map(int, input().split()))",
"+for i in range(100):",
"+ if X - i not in p:",
"+ print((X - i))",
"+ exit()",
"+ if X + i not in p:",
"+ print((X + i))",
"+ exit()"
] | false | 0.036634 | 0.040259 | 0.909955 | [
"s168478061",
"s414886972"
] |
u055941944 | p03073 | python | s320833364 | s094257334 | 94 | 77 | 4,724 | 3,188 | Accepted | Accepted | 18.09 | s = eval(input())
l = [int(x) for x in list(str(s))]
ans_a = 0
for i in range(len(s)):
if i%2 ==0 and l[i] == 0:
pass
elif i%2==1 and l[i] ==1:
pass
else:
ans_a += 1
ans_b = 0
for i in range(len(s)):
if i%2 ==0 and l[i] == 1:
pass
elif i%2 ==1 and l[i] == 0:
pass
else:
ans_b += 1
print((min(ans_b,ans_a))) | s = eval(input())
ans_a = 0
ans_b = 0
for i in range(len(s)):
if i%2 == 0 and s[i] =="0":
pass
elif i%2 == 1 and s[i]=="1":
pass
else:
ans_a += 1
for i in range(len(s)):
if i%2 == 0 and s[i] =="1":
pass
elif i%2 == 1 and s[i]=="0":
pass
else:
ans_b += 1
print((min(ans_a, ans_b))) | 21 | 20 | 338 | 311 | s = eval(input())
l = [int(x) for x in list(str(s))]
ans_a = 0
for i in range(len(s)):
if i % 2 == 0 and l[i] == 0:
pass
elif i % 2 == 1 and l[i] == 1:
pass
else:
ans_a += 1
ans_b = 0
for i in range(len(s)):
if i % 2 == 0 and l[i] == 1:
pass
elif i % 2 == 1 and l[i] == 0:
pass
else:
ans_b += 1
print((min(ans_b, ans_a)))
| s = eval(input())
ans_a = 0
ans_b = 0
for i in range(len(s)):
if i % 2 == 0 and s[i] == "0":
pass
elif i % 2 == 1 and s[i] == "1":
pass
else:
ans_a += 1
for i in range(len(s)):
if i % 2 == 0 and s[i] == "1":
pass
elif i % 2 == 1 and s[i] == "0":
pass
else:
ans_b += 1
print((min(ans_a, ans_b)))
| false | 4.761905 | [
"-l = [int(x) for x in list(str(s))]",
"+ans_b = 0",
"- if i % 2 == 0 and l[i] == 0:",
"+ if i % 2 == 0 and s[i] == \"0\":",
"- elif i % 2 == 1 and l[i] == 1:",
"+ elif i % 2 == 1 and s[i] == \"1\":",
"-ans_b = 0",
"- if i % 2 == 0 and l[i] == 1:",
"+ if i % 2 == 0 and s[i] == \"1\":",
"- elif i % 2 == 1 and l[i] == 0:",
"+ elif i % 2 == 1 and s[i] == \"0\":",
"-print((min(ans_b, ans_a)))",
"+print((min(ans_a, ans_b)))"
] | false | 0.107736 | 0.045361 | 2.375074 | [
"s320833364",
"s094257334"
] |
u225388820 | p02614 | python | s259468779 | s168341834 | 170 | 62 | 73,500 | 9,008 | Accepted | Accepted | 63.53 | from copy import deepcopy
h, w, k = list(map(int, input().split()))
c = [list(eval(input())) for i in range(h)]
ans = 0
for i in range(1 << h):
for j in range(1 << w):
t = deepcopy(c)
for x in range(h):
for y in range(w):
if (i >> x & 1) or (j >> y & 1):
t[x][y] = "."
p = 0
for x in range(h):
for y in range(w):
if t[x][y] == "#":
p += 1
if p == k:
ans += 1
print(ans)
| h, w, k = list(map(int, input().split()))
c = [eval(input()) for i in range(h)]
ans = 0
for i in range(1 << h):
for j in range(1 << w):
cnt = 0
for x in range(h):
for y in range(w):
if (i >> x & 1) or (j >> y & 1):
continue
if c[x][y] == "#":
cnt += 1
if cnt == k:
ans += 1
print(ans) | 19 | 15 | 528 | 410 | from copy import deepcopy
h, w, k = list(map(int, input().split()))
c = [list(eval(input())) for i in range(h)]
ans = 0
for i in range(1 << h):
for j in range(1 << w):
t = deepcopy(c)
for x in range(h):
for y in range(w):
if (i >> x & 1) or (j >> y & 1):
t[x][y] = "."
p = 0
for x in range(h):
for y in range(w):
if t[x][y] == "#":
p += 1
if p == k:
ans += 1
print(ans)
| h, w, k = list(map(int, input().split()))
c = [eval(input()) for i in range(h)]
ans = 0
for i in range(1 << h):
for j in range(1 << w):
cnt = 0
for x in range(h):
for y in range(w):
if (i >> x & 1) or (j >> y & 1):
continue
if c[x][y] == "#":
cnt += 1
if cnt == k:
ans += 1
print(ans)
| false | 21.052632 | [
"-from copy import deepcopy",
"-",
"-c = [list(eval(input())) for i in range(h)]",
"+c = [eval(input()) for i in range(h)]",
"- t = deepcopy(c)",
"+ cnt = 0",
"- t[x][y] = \".\"",
"- p = 0",
"- for x in range(h):",
"- for y in range(w):",
"- if t[x][y] == \"#\":",
"- p += 1",
"- if p == k:",
"+ continue",
"+ if c[x][y] == \"#\":",
"+ cnt += 1",
"+ if cnt == k:"
] | false | 0.040146 | 0.083648 | 0.479944 | [
"s259468779",
"s168341834"
] |
u075012704 | p03504 | python | s628468837 | s126888861 | 813 | 740 | 124,888 | 120,152 | Accepted | Accepted | 8.98 | from itertools import accumulate
N, C = list(map(int, input().split()))
V = [[0] * (10 ** 5 + 1) for i in range(C)]
for i in range(N):
s, t, c = list(map(int, input().split()))
s, t, c = s - 1, t - 1, c - 1
V[c][s] += 1
V[c][t + 1] -= 1
for c in range(C):
V[c] = list(accumulate(V[c]))
ans = 0
for i in range(10 ** 5 + 1):
tmp = 0
for c in range(C):
tmp += min(1, V[c][i])
ans = max(ans, tmp)
print(ans)
| from itertools import accumulate
N, C = list(map(int, input().split()))
TimeTable = [[0] * (10 ** 5 + 2) for i in range(C + 1)]
for i in range(N):
s, t, c = list(map(int, input().split()))
TimeTable[c][s] += 1
TimeTable[c][t + 1] -= 1
for c in range(C + 1):
TimeTable[c] = list(accumulate(TimeTable[c]))
ans = 0
for i in range(10 ** 5 + 2):
cnt = 0
for c in range(C + 1):
cnt += min(TimeTable[c][i], 1)
ans = max(ans, cnt)
print(ans)
| 21 | 20 | 456 | 481 | from itertools import accumulate
N, C = list(map(int, input().split()))
V = [[0] * (10**5 + 1) for i in range(C)]
for i in range(N):
s, t, c = list(map(int, input().split()))
s, t, c = s - 1, t - 1, c - 1
V[c][s] += 1
V[c][t + 1] -= 1
for c in range(C):
V[c] = list(accumulate(V[c]))
ans = 0
for i in range(10**5 + 1):
tmp = 0
for c in range(C):
tmp += min(1, V[c][i])
ans = max(ans, tmp)
print(ans)
| from itertools import accumulate
N, C = list(map(int, input().split()))
TimeTable = [[0] * (10**5 + 2) for i in range(C + 1)]
for i in range(N):
s, t, c = list(map(int, input().split()))
TimeTable[c][s] += 1
TimeTable[c][t + 1] -= 1
for c in range(C + 1):
TimeTable[c] = list(accumulate(TimeTable[c]))
ans = 0
for i in range(10**5 + 2):
cnt = 0
for c in range(C + 1):
cnt += min(TimeTable[c][i], 1)
ans = max(ans, cnt)
print(ans)
| false | 4.761905 | [
"-V = [[0] * (10**5 + 1) for i in range(C)]",
"+TimeTable = [[0] * (10**5 + 2) for i in range(C + 1)]",
"- s, t, c = s - 1, t - 1, c - 1",
"- V[c][s] += 1",
"- V[c][t + 1] -= 1",
"-for c in range(C):",
"- V[c] = list(accumulate(V[c]))",
"+ TimeTable[c][s] += 1",
"+ TimeTable[c][t + 1] -= 1",
"+for c in range(C + 1):",
"+ TimeTable[c] = list(accumulate(TimeTable[c]))",
"-for i in range(10**5 + 1):",
"- tmp = 0",
"- for c in range(C):",
"- tmp += min(1, V[c][i])",
"- ans = max(ans, tmp)",
"+for i in range(10**5 + 2):",
"+ cnt = 0",
"+ for c in range(C + 1):",
"+ cnt += min(TimeTable[c][i], 1)",
"+ ans = max(ans, cnt)"
] | false | 0.243309 | 0.280753 | 0.866631 | [
"s628468837",
"s126888861"
] |
u941407962 | p02728 | python | s588210050 | s819859968 | 1,701 | 1,175 | 124,036 | 131,076 | Accepted | Accepted | 30.92 | import sys;input=sys.stdin.readline
mod = pow(10, 9) + 7
sys.setrecursionlimit(pow(10, 8))
def mul(a, b):
return ((a % mod) * (b % mod)) % mod
def div(a, b):
return mul(a, modinv(b))
def modinv(a):
b, u, v = mod, 1, 0
while b:
t = a//b
a, u = a-t*b, u-t*v
a, b, u, v = b, a, v, u
u %= mod
return u
def cmb(n, r, mod):
if ( r<0 or r>n ):
return 0
r = min(r, n-r)
return g1[n] * g2[r] * g2[n-r] % mod
NNN = (2*10**5)
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
for i in range( 2, NNN + 1 ):
g1.append( ( g1[-1] * i ) % mod )
inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
g2.append( (g2[-1] * inverse[-1]) % mod )
N, = list(map(int, input().split()))
d = [list() for _ in range(N+1)]
for _ in range(N-1):
a, b = list(map(int, input().split()))
d[a].append(b)
d[b].append(a)
vs = set([1])
stack = [1]
vs_bfs = list()
parents = [0] * (N+1)
while stack:
v = stack.pop()
vs_bfs.append(v)
for u in d[v]:
if u in vs:
continue
parents[u] = v
vs.add(u)
stack.append(u)
dp1 = [0 for _ in range(N+1)]
sss = [0 for _ in range(N+1)]
for v in vs_bfs[::-1]:
t = 1
ts = []
for u in d[v]:
if u == parents[v]:
continue
t = mul(dp1[u], t)
ts.append(sss[u])
st = sum(ts)
sss[v] = st + 1
for tt in ts:
t = mul(cmb(st, tt, mod), t)
st -= tt
dp1[v] = t
for v in vs_bfs:
if v == 1:
continue
p = parents[v]
dp1[v] = mul(
div(dp1[p], cmb(N-1, sss[v], mod)),
cmb(N-1, N-sss[v], mod)
)
for x in dp1[1:]:
print(x)
| import sys;input=sys.stdin.readline
mod = pow(10, 9) + 7
sys.setrecursionlimit(pow(10, 8))
def mul(a, b):
return ((a % mod) * (b % mod)) % mod
def div(a, b):
return mul(a, modinv(b))
def modinv(a):
b, u, v = mod, 1, 0
while b:
t = a//b
a, u = a-t*b, u-t*v
a, b, u, v = b, a, v, u
u %= mod
return u
def cmb(n, r):
if ( r<0 or r>n ):
return 0
r = min(r, n-r)
return g1[n] * g2[r] * g2[n-r] % mod
NNN = (2*10**5)
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
for i in range( 2, NNN + 1 ):
g1.append( ( g1[-1] * i ) % mod )
inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
g2.append( (g2[-1] * inverse[-1]) % mod )
N, = list(map(int, input().split()))
d = [list() for _ in range(N+1)]
for _ in range(N-1):
a, b = list(map(int, input().split()))
d[a].append(b)
d[b].append(a)
vs = set([1])
stack = [1]
vs_bfs = list()
parents = [0] * (N+1)
while stack:
v = stack.pop()
vs_bfs.append(v)
for u in d[v]:
if u in vs:
continue
parents[u] = v
vs.add(u)
stack.append(u)
dp1 = [0 for _ in range(N+1)]
sss = [0 for _ in range(N+1)]
for v in vs_bfs[::-1]:
t = 1
ts = []
for u in d[v]:
if u == parents[v]:
continue
t = mul(dp1[u], t)
ts.append(sss[u])
st = sum(ts)
sss[v] = st + 1
for tt in ts:
t = mul(cmb(st, tt), t)
st -= tt
dp1[v] = t
for v in vs_bfs:
if v == 1:
continue
p = parents[v]
dp1[v] = mul(
mul(dp1[p], sss[v]),
inverse[N-sss[v]]
)
for x in dp1[1:]:
print(x)
| 78 | 78 | 1,749 | 1,718 | import sys
input = sys.stdin.readline
mod = pow(10, 9) + 7
sys.setrecursionlimit(pow(10, 8))
def mul(a, b):
return ((a % mod) * (b % mod)) % mod
def div(a, b):
return mul(a, modinv(b))
def modinv(a):
b, u, v = mod, 1, 0
while b:
t = a // b
a, u = a - t * b, u - t * v
a, b, u, v = b, a, v, u
u %= mod
return u
def cmb(n, r, mod):
if r < 0 or r > n:
return 0
r = min(r, n - r)
return g1[n] * g2[r] * g2[n - r] % mod
NNN = 2 * 10**5
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
for i in range(2, NNN + 1):
g1.append((g1[-1] * i) % mod)
inverse.append((-inverse[mod % i] * (mod // i)) % mod)
g2.append((g2[-1] * inverse[-1]) % mod)
(N,) = list(map(int, input().split()))
d = [list() for _ in range(N + 1)]
for _ in range(N - 1):
a, b = list(map(int, input().split()))
d[a].append(b)
d[b].append(a)
vs = set([1])
stack = [1]
vs_bfs = list()
parents = [0] * (N + 1)
while stack:
v = stack.pop()
vs_bfs.append(v)
for u in d[v]:
if u in vs:
continue
parents[u] = v
vs.add(u)
stack.append(u)
dp1 = [0 for _ in range(N + 1)]
sss = [0 for _ in range(N + 1)]
for v in vs_bfs[::-1]:
t = 1
ts = []
for u in d[v]:
if u == parents[v]:
continue
t = mul(dp1[u], t)
ts.append(sss[u])
st = sum(ts)
sss[v] = st + 1
for tt in ts:
t = mul(cmb(st, tt, mod), t)
st -= tt
dp1[v] = t
for v in vs_bfs:
if v == 1:
continue
p = parents[v]
dp1[v] = mul(div(dp1[p], cmb(N - 1, sss[v], mod)), cmb(N - 1, N - sss[v], mod))
for x in dp1[1:]:
print(x)
| import sys
input = sys.stdin.readline
mod = pow(10, 9) + 7
sys.setrecursionlimit(pow(10, 8))
def mul(a, b):
return ((a % mod) * (b % mod)) % mod
def div(a, b):
return mul(a, modinv(b))
def modinv(a):
b, u, v = mod, 1, 0
while b:
t = a // b
a, u = a - t * b, u - t * v
a, b, u, v = b, a, v, u
u %= mod
return u
def cmb(n, r):
if r < 0 or r > n:
return 0
r = min(r, n - r)
return g1[n] * g2[r] * g2[n - r] % mod
NNN = 2 * 10**5
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
for i in range(2, NNN + 1):
g1.append((g1[-1] * i) % mod)
inverse.append((-inverse[mod % i] * (mod // i)) % mod)
g2.append((g2[-1] * inverse[-1]) % mod)
(N,) = list(map(int, input().split()))
d = [list() for _ in range(N + 1)]
for _ in range(N - 1):
a, b = list(map(int, input().split()))
d[a].append(b)
d[b].append(a)
vs = set([1])
stack = [1]
vs_bfs = list()
parents = [0] * (N + 1)
while stack:
v = stack.pop()
vs_bfs.append(v)
for u in d[v]:
if u in vs:
continue
parents[u] = v
vs.add(u)
stack.append(u)
dp1 = [0 for _ in range(N + 1)]
sss = [0 for _ in range(N + 1)]
for v in vs_bfs[::-1]:
t = 1
ts = []
for u in d[v]:
if u == parents[v]:
continue
t = mul(dp1[u], t)
ts.append(sss[u])
st = sum(ts)
sss[v] = st + 1
for tt in ts:
t = mul(cmb(st, tt), t)
st -= tt
dp1[v] = t
for v in vs_bfs:
if v == 1:
continue
p = parents[v]
dp1[v] = mul(mul(dp1[p], sss[v]), inverse[N - sss[v]])
for x in dp1[1:]:
print(x)
| false | 0 | [
"-def cmb(n, r, mod):",
"+def cmb(n, r):",
"- t = mul(cmb(st, tt, mod), t)",
"+ t = mul(cmb(st, tt), t)",
"- dp1[v] = mul(div(dp1[p], cmb(N - 1, sss[v], mod)), cmb(N - 1, N - sss[v], mod))",
"+ dp1[v] = mul(mul(dp1[p], sss[v]), inverse[N - sss[v]])"
] | false | 2.004717 | 1.052611 | 1.904518 | [
"s588210050",
"s819859968"
] |
u867848444 | p03013 | python | s677973380 | s764982506 | 491 | 194 | 50,520 | 11,884 | Accepted | Accepted | 60.49 | n,m=list(map(int,input().split()))
a=[int(eval(input())) for i in range(m)]
dp=[1]*(n+1)
for i in a:
dp[i]=0
k=10**9+7
for i in range(2,n+1):
if dp[i]!=0:
dp[i]=(dp[i-1]+dp[i-2])%k
print((dp[-1]))
| n,m=list(map(int,input().split()))
a={int(eval(input())) for i in range(m)}
dp=[0]*(n+2)
num=10**9+7
dp[0]=1
for i in range(n):
if i in a:
dp[i]=0
else:
dp[i]=dp[i]%num
if i<n:
dp[i+1]+=dp[i]
dp[i+2]+=dp[i]
print((dp[-2]%num)) | 12 | 14 | 224 | 281 | n, m = list(map(int, input().split()))
a = [int(eval(input())) for i in range(m)]
dp = [1] * (n + 1)
for i in a:
dp[i] = 0
k = 10**9 + 7
for i in range(2, n + 1):
if dp[i] != 0:
dp[i] = (dp[i - 1] + dp[i - 2]) % k
print((dp[-1]))
| n, m = list(map(int, input().split()))
a = {int(eval(input())) for i in range(m)}
dp = [0] * (n + 2)
num = 10**9 + 7
dp[0] = 1
for i in range(n):
if i in a:
dp[i] = 0
else:
dp[i] = dp[i] % num
if i < n:
dp[i + 1] += dp[i]
dp[i + 2] += dp[i]
print((dp[-2] % num))
| false | 14.285714 | [
"-a = [int(eval(input())) for i in range(m)]",
"-dp = [1] * (n + 1)",
"-for i in a:",
"- dp[i] = 0",
"-k = 10**9 + 7",
"-for i in range(2, n + 1):",
"- if dp[i] != 0:",
"- dp[i] = (dp[i - 1] + dp[i - 2]) % k",
"-print((dp[-1]))",
"+a = {int(eval(input())) for i in range(m)}",
"+dp = [0] * (n + 2)",
"+num = 10**9 + 7",
"+dp[0] = 1",
"+for i in range(n):",
"+ if i in a:",
"+ dp[i] = 0",
"+ else:",
"+ dp[i] = dp[i] % num",
"+ if i < n:",
"+ dp[i + 1] += dp[i]",
"+ dp[i + 2] += dp[i]",
"+print((dp[-2] % num))"
] | false | 0.007337 | 0.040574 | 0.180841 | [
"s677973380",
"s764982506"
] |
u848535504 | p02748 | python | s061956789 | s623014871 | 321 | 285 | 30,688 | 24,716 | Accepted | Accepted | 11.21 | A,B,M = list(map(int,input().split()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
x = []
y = []
c = []
for _ in range(M):
X,Y,Z = list(map(int,input().split()))
x.append(X)
y.append(Y)
c.append(Z)
mini = min(a) + min(b)
for i in range(M):
rei = a[x[i]-1]
den = b[y[i]-1]
coop = c[i]
if rei + den - coop < mini:
mini = rei + den - coop
print(mini)
| A,B,M = list(map(int,input().split()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
mini = min(a) + min(b)
for i in range(M):
x,y,c = list(map(int,input().split()))
rei = a[x-1]
den = b[y-1]
coop = c
if rei + den - coop < mini:
mini = rei + den - coop
print(mini) | 23 | 16 | 428 | 323 | A, B, M = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = []
y = []
c = []
for _ in range(M):
X, Y, Z = list(map(int, input().split()))
x.append(X)
y.append(Y)
c.append(Z)
mini = min(a) + min(b)
for i in range(M):
rei = a[x[i] - 1]
den = b[y[i] - 1]
coop = c[i]
if rei + den - coop < mini:
mini = rei + den - coop
print(mini)
| A, B, M = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
mini = min(a) + min(b)
for i in range(M):
x, y, c = list(map(int, input().split()))
rei = a[x - 1]
den = b[y - 1]
coop = c
if rei + den - coop < mini:
mini = rei + den - coop
print(mini)
| false | 30.434783 | [
"-x = []",
"-y = []",
"-c = []",
"-for _ in range(M):",
"- X, Y, Z = list(map(int, input().split()))",
"- x.append(X)",
"- y.append(Y)",
"- c.append(Z)",
"- rei = a[x[i] - 1]",
"- den = b[y[i] - 1]",
"- coop = c[i]",
"+ x, y, c = list(map(int, input().split()))",
"+ rei = a[x - 1]",
"+ den = b[y - 1]",
"+ coop = c"
] | false | 0.042176 | 0.041544 | 1.015197 | [
"s061956789",
"s623014871"
] |
u320098990 | p02725 | python | s651015945 | s412230756 | 142 | 131 | 32,256 | 32,308 | Accepted | Accepted | 7.75 | k, n = list(map(int, input().split()))
a_list = list(map(int, input().split()))
longest = 0
for i in range(n):
if i==n-1:
longest = max(longest, k-a_list[i]+a_list[0])
else:
distance = a_list[i+1] - a_list[i]
longest = max(longest, distance)
print((k-longest)) | k, n = list(map(int, input().split()))
a_list = list(map(int, input().split()))
longest = 0
for i in range(n-1):
distance = a_list[i+1] - a_list[i]
longest = max(longest, distance)
print((k-max(longest, k-a_list[n-1]+a_list[0]))) | 10 | 9 | 293 | 247 | k, n = list(map(int, input().split()))
a_list = list(map(int, input().split()))
longest = 0
for i in range(n):
if i == n - 1:
longest = max(longest, k - a_list[i] + a_list[0])
else:
distance = a_list[i + 1] - a_list[i]
longest = max(longest, distance)
print((k - longest))
| k, n = list(map(int, input().split()))
a_list = list(map(int, input().split()))
longest = 0
for i in range(n - 1):
distance = a_list[i + 1] - a_list[i]
longest = max(longest, distance)
print((k - max(longest, k - a_list[n - 1] + a_list[0])))
| false | 10 | [
"-for i in range(n):",
"- if i == n - 1:",
"- longest = max(longest, k - a_list[i] + a_list[0])",
"- else:",
"- distance = a_list[i + 1] - a_list[i]",
"- longest = max(longest, distance)",
"-print((k - longest))",
"+for i in range(n - 1):",
"+ distance = a_list[i + 1] - a_list[i]",
"+ longest = max(longest, distance)",
"+print((k - max(longest, k - a_list[n - 1] + a_list[0])))"
] | false | 0.039821 | 0.040623 | 0.980242 | [
"s651015945",
"s412230756"
] |
u512212329 | p02727 | python | s133154470 | s658081993 | 287 | 244 | 22,548 | 22,592 | Accepted | Accepted | 14.98 | x, y, a, b, c = list(map(int, input().split()))
red = sorted(int(x) for x in input().split())[-x:]
green = sorted(int(x) for x in input().split())[-y:]
print((sum(sorted([int(x) for x in input().split()] + red + green)[-(x+y):])))
| x, y, a, b, c = list(map(int, input().split()))
red = [int(x) for x in input().split()]
green = [int(x) for x in input().split()]
red.sort(reverse=True)
green.sort(reverse=True)
candidates = [int(x) for x in input().split()] + red[:x] + green[:y]
candidates.sort(reverse=True)
print((sum(candidates[:x+y]))) | 4 | 8 | 226 | 306 | x, y, a, b, c = list(map(int, input().split()))
red = sorted(int(x) for x in input().split())[-x:]
green = sorted(int(x) for x in input().split())[-y:]
print((sum(sorted([int(x) for x in input().split()] + red + green)[-(x + y) :])))
| x, y, a, b, c = list(map(int, input().split()))
red = [int(x) for x in input().split()]
green = [int(x) for x in input().split()]
red.sort(reverse=True)
green.sort(reverse=True)
candidates = [int(x) for x in input().split()] + red[:x] + green[:y]
candidates.sort(reverse=True)
print((sum(candidates[: x + y])))
| false | 50 | [
"-red = sorted(int(x) for x in input().split())[-x:]",
"-green = sorted(int(x) for x in input().split())[-y:]",
"-print((sum(sorted([int(x) for x in input().split()] + red + green)[-(x + y) :])))",
"+red = [int(x) for x in input().split()]",
"+green = [int(x) for x in input().split()]",
"+red.sort(reverse=True)",
"+green.sort(reverse=True)",
"+candidates = [int(x) for x in input().split()] + red[:x] + green[:y]",
"+candidates.sort(reverse=True)",
"+print((sum(candidates[: x + y])))"
] | false | 0.075582 | 0.072949 | 1.036082 | [
"s133154470",
"s658081993"
] |
u573754721 | p02970 | python | s728734177 | s690827224 | 173 | 18 | 38,384 | 3,188 | Accepted | Accepted | 89.6 | n,d = list(map(int, input().split()))
if n%(2*d + 1) == 0:
print((n//(2*d + 1)))
else:
print((n//(2*d + 1) + 1)) | import math
n,d=list(map(int,input().split()))
print((math.ceil(n/(d*2+1)))) | 6 | 3 | 116 | 70 | n, d = list(map(int, input().split()))
if n % (2 * d + 1) == 0:
print((n // (2 * d + 1)))
else:
print((n // (2 * d + 1) + 1))
| import math
n, d = list(map(int, input().split()))
print((math.ceil(n / (d * 2 + 1))))
| false | 50 | [
"+import math",
"+",
"-if n % (2 * d + 1) == 0:",
"- print((n // (2 * d + 1)))",
"-else:",
"- print((n // (2 * d + 1) + 1))",
"+print((math.ceil(n / (d * 2 + 1))))"
] | false | 0.088466 | 0.032533 | 2.719249 | [
"s728734177",
"s690827224"
] |
u009348313 | p02695 | python | s197484967 | s333267076 | 244 | 139 | 73,144 | 67,952 | Accepted | Accepted | 43.03 | import sys
sys.setrecursionlimit(10 ** 9)
n,m,q = list(map(int,input().split()))
abcd = []
for i in range(q):
abcd.append(tuple(map(int,input().split())))
ans = 0
def dfs(l):
global ans
if len(l) == n:
ans = max(check(l),ans)
else:
if len(l) == 0:
mx = 1
else:
mx = l[-1]
for i in range(mx,m+1):
tmpl = l + [i]
dfs(tmpl)
def check(l):
res = 0
for a,b,c,d in abcd:
a -= 1
b -= 1
if l[b]-l[a] == c:
res += d
return res
dfs([])
print(ans)
| import itertools
n,m,q = list(map(int,input().split()))
abcd = []
for i in range(q):
abcd.append(tuple(map(int,input().split())))
def check(l):
res = 0
for a,b,c,d in abcd:
a -= 1
b -= 1
if l[b]-l[a] == c:
res += d
return res
l = itertools.combinations_with_replacement(list(range(1,m+1)),n)
ans = 0
for li in l:
ans = max(check(li),ans)
print(ans)
| 33 | 21 | 538 | 388 | import sys
sys.setrecursionlimit(10**9)
n, m, q = list(map(int, input().split()))
abcd = []
for i in range(q):
abcd.append(tuple(map(int, input().split())))
ans = 0
def dfs(l):
global ans
if len(l) == n:
ans = max(check(l), ans)
else:
if len(l) == 0:
mx = 1
else:
mx = l[-1]
for i in range(mx, m + 1):
tmpl = l + [i]
dfs(tmpl)
def check(l):
res = 0
for a, b, c, d in abcd:
a -= 1
b -= 1
if l[b] - l[a] == c:
res += d
return res
dfs([])
print(ans)
| import itertools
n, m, q = list(map(int, input().split()))
abcd = []
for i in range(q):
abcd.append(tuple(map(int, input().split())))
def check(l):
res = 0
for a, b, c, d in abcd:
a -= 1
b -= 1
if l[b] - l[a] == c:
res += d
return res
l = itertools.combinations_with_replacement(list(range(1, m + 1)), n)
ans = 0
for li in l:
ans = max(check(li), ans)
print(ans)
| false | 36.363636 | [
"-import sys",
"+import itertools",
"-sys.setrecursionlimit(10**9)",
"-ans = 0",
"-",
"-",
"-def dfs(l):",
"- global ans",
"- if len(l) == n:",
"- ans = max(check(l), ans)",
"- else:",
"- if len(l) == 0:",
"- mx = 1",
"- else:",
"- mx = l[-1]",
"- for i in range(mx, m + 1):",
"- tmpl = l + [i]",
"- dfs(tmpl)",
"-dfs([])",
"+l = itertools.combinations_with_replacement(list(range(1, m + 1)), n)",
"+ans = 0",
"+for li in l:",
"+ ans = max(check(li), ans)"
] | false | 0.06637 | 0.070949 | 0.93546 | [
"s197484967",
"s333267076"
] |
u537782349 | p03424 | python | s313060721 | s654143371 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | a = int(eval(input()))
b = {}
c = list(input().split())
for i in range(a):
b[c[i]] = 1
print(("Three" if len(b) == 3 else "Four"))
| a = int(eval(input()))
b = list(map(str, input().split()))
c = {}
for i in b:
c[i] = 1
print(("Three" if len(c) == 3 else "Four"))
| 6 | 6 | 132 | 132 | a = int(eval(input()))
b = {}
c = list(input().split())
for i in range(a):
b[c[i]] = 1
print(("Three" if len(b) == 3 else "Four"))
| a = int(eval(input()))
b = list(map(str, input().split()))
c = {}
for i in b:
c[i] = 1
print(("Three" if len(c) == 3 else "Four"))
| false | 0 | [
"-b = {}",
"-c = list(input().split())",
"-for i in range(a):",
"- b[c[i]] = 1",
"-print((\"Three\" if len(b) == 3 else \"Four\"))",
"+b = list(map(str, input().split()))",
"+c = {}",
"+for i in b:",
"+ c[i] = 1",
"+print((\"Three\" if len(c) == 3 else \"Four\"))"
] | false | 0.041094 | 0.04074 | 1.008683 | [
"s313060721",
"s654143371"
] |
u316603606 | p03210 | python | s907194312 | s854689273 | 31 | 26 | 9,124 | 9,096 | Accepted | Accepted | 16.13 | x = int (eval(input ()))
if x==3 or x==5 or x==7:
print ('YES')
else:
print ('NO') | X = int (eval(input ()))
if X==7 or X==5 or X==3:
print ('YES')
else:
print ('NO') | 5 | 5 | 84 | 84 | x = int(eval(input()))
if x == 3 or x == 5 or x == 7:
print("YES")
else:
print("NO")
| X = int(eval(input()))
if X == 7 or X == 5 or X == 3:
print("YES")
else:
print("NO")
| false | 0 | [
"-x = int(eval(input()))",
"-if x == 3 or x == 5 or x == 7:",
"+X = int(eval(input()))",
"+if X == 7 or X == 5 or X == 3:"
] | false | 0.037219 | 0.039115 | 0.951539 | [
"s907194312",
"s854689273"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.