user_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 1
value | submission_id_v0 stringlengths 10 10 | submission_id_v1 stringlengths 10 10 | cpu_time_v0 int64 10 38.3k | cpu_time_v1 int64 0 24.7k | memory_v0 int64 2.57k 1.02M | memory_v1 int64 2.57k 869k | status_v0 stringclasses 1
value | status_v1 stringclasses 1
value | improvement_frac float64 7.51 100 | input stringlengths 20 4.55k | target stringlengths 17 3.34k | code_v0_loc int64 1 148 | code_v1_loc int64 1 184 | code_v0_num_chars int64 13 4.55k | code_v1_num_chars int64 14 3.34k | code_v0_no_empty_lines stringlengths 21 6.88k | code_v1_no_empty_lines stringlengths 20 4.93k | code_same bool 1
class | relative_loc_diff_percent float64 0 79.8 | diff list | diff_only_import_comment bool 1
class | measured_runtime_v0 float64 0.01 4.45 | measured_runtime_v1 float64 0.01 4.31 | runtime_lift float64 0 359 | key list |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u981931040 | p02954 | python | s567392142 | s648320694 | 200 | 151 | 4,864 | 10,268 | Accepted | Accepted | 24.5 | S = input()
S = S + "R"
odd_count = 0
even_count = 0
ans = [0] * len(S)
for i in range(len(S) - 1):
if i % 2 == 0:
even_count += 1
else:
odd_count += 1
if S[i] == 'R' and S[i + 1] == 'L':
right_index = i + 1
left_index = i
start = i
if S[i] == "L" an... | S = eval(input())
len_S = len(S)
now = "R"
R_cnt = 0
L_cnt = 0
ans = [0] * len_S
R_idx_list = []
L_idx_list = []
for i in range(len_S - 1):
if S[i] == "R" and S[i + 1] == "L":
R_idx_list.append(i)
L_idx_list.append(i + 1)
idx = 0
for i in range(len(S)):
s = S[i]
if i == le... | 25 | 32 | 656 | 697 | S = input()
S = S + "R"
odd_count = 0
even_count = 0
ans = [0] * len(S)
for i in range(len(S) - 1):
if i % 2 == 0:
even_count += 1
else:
odd_count += 1
if S[i] == "R" and S[i + 1] == "L":
right_index = i + 1
left_index = i
start = i
if S[i] == "L" and S[i + 1] == ... | S = eval(input())
len_S = len(S)
now = "R"
R_cnt = 0
L_cnt = 0
ans = [0] * len_S
R_idx_list = []
L_idx_list = []
for i in range(len_S - 1):
if S[i] == "R" and S[i + 1] == "L":
R_idx_list.append(i)
L_idx_list.append(i + 1)
idx = 0
for i in range(len(S)):
s = S[i]
if i == len_S - 1:
L_... | false | 21.875 | [
"-S = input()",
"-S = S + \"R\"",
"-odd_count = 0",
"-even_count = 0",
"-ans = [0] * len(S)",
"-for i in range(len(S) - 1):",
"- if i % 2 == 0:",
"- even_count += 1",
"+S = eval(input())",
"+len_S = len(S)",
"+now = \"R\"",
"+R_cnt = 0",
"+L_cnt = 0",
"+ans = [0] * len_S",
"+R_... | false | 0.047366 | 0.043701 | 1.083868 | [
"s567392142",
"s648320694"
] |
u227476288 | p03051 | python | s227897286 | s571748999 | 1,254 | 504 | 69,340 | 128,848 | Accepted | Accepted | 59.81 | N = int(eval(input()))
A = [int(i) for i in input().split()]
mod = 10**9 + 7
b = [0]*N
b[0] = A[0]
for n in range(1,N):
b[n] = A[n] ^ b[n-1]
#print('累積論理和',b)
m = max(b)
dp = [[0]*(m+1) for j in range(2)]
dp[0] = [1]*(m+1)
cnt = [0]*(m+1)
z = 0
for i in range(N):
if b[i] == 0:
z +=1... | N = int(eval(input()))
A = [int(i) for i in input().split()]
mod = 10**9 + 7
b = [0]*N
b[0] = A[0]
for n in range(1,N):
b[n] = A[n] ^ b[n-1]
#print('累積論理和',b)
m = max(b)
dp = [[0]*(m+1) for j in range(2)]
dp[0] = [1]*(m+1)
cnt = [0]*(m+1)
z = 0 #zero_count
for i in range(N):
if b[i] == 0:
... | 33 | 34 | 625 | 701 | N = int(eval(input()))
A = [int(i) for i in input().split()]
mod = 10**9 + 7
b = [0] * N
b[0] = A[0]
for n in range(1, N):
b[n] = A[n] ^ b[n - 1]
# print('累積論理和',b)
m = max(b)
dp = [[0] * (m + 1) for j in range(2)]
dp[0] = [1] * (m + 1)
cnt = [0] * (m + 1)
z = 0
for i in range(N):
if b[i] == 0:
z += 1
... | N = int(eval(input()))
A = [int(i) for i in input().split()]
mod = 10**9 + 7
b = [0] * N
b[0] = A[0]
for n in range(1, N):
b[n] = A[n] ^ b[n - 1]
# print('累積論理和',b)
m = max(b)
dp = [[0] * (m + 1) for j in range(2)]
dp[0] = [1] * (m + 1)
cnt = [0] * (m + 1)
z = 0 # zero_count
for i in range(N):
if b[i] == 0:
... | false | 2.941176 | [
"-z = 0",
"+z = 0 # zero_count",
"+ # print('i=',i,',bi=',b[i],',dp=',dp,'zero',z)",
"- ans = pow(2, z - 1, mod)",
"+ ans = pow(2, z - 1, mod) # 2^(z-1)%mod"
] | false | 0.037418 | 0.035656 | 1.049416 | [
"s227897286",
"s571748999"
] |
u074220993 | p03494 | python | s894510563 | s693780740 | 31 | 26 | 9,104 | 9,060 | Accepted | Accepted | 16.13 | N = eval(input())
A = [int(x) for x in input().split()]
def cnt(x):
i = 0
while x%2 == 0:
x //= 2
i += 1
return i
ans = min(cnt(a) for a in A)
print(ans) |
def div_by_2(n):
res = 0
while n % 2 == 0:
n //= 2
res += 1
return res
N = int(eval(input()))
A = list(map(int, input().split()))
print((min(list(map(div_by_2, A))))) | 10 | 11 | 184 | 192 | N = eval(input())
A = [int(x) for x in input().split()]
def cnt(x):
i = 0
while x % 2 == 0:
x //= 2
i += 1
return i
ans = min(cnt(a) for a in A)
print(ans)
| def div_by_2(n):
res = 0
while n % 2 == 0:
n //= 2
res += 1
return res
N = int(eval(input()))
A = list(map(int, input().split()))
print((min(list(map(div_by_2, A)))))
| false | 9.090909 | [
"-N = eval(input())",
"-A = [int(x) for x in input().split()]",
"+def div_by_2(n):",
"+ res = 0",
"+ while n % 2 == 0:",
"+ n //= 2",
"+ res += 1",
"+ return res",
"-def cnt(x):",
"- i = 0",
"- while x % 2 == 0:",
"- x //= 2",
"- i += 1",
"- re... | false | 0.100478 | 0.042023 | 2.39103 | [
"s894510563",
"s693780740"
] |
u608088992 | p03695 | python | s877296664 | s458959930 | 20 | 17 | 3,444 | 3,064 | Accepted | Accepted | 15 | from collections import defaultdict
N = int(eval(input()))
A = [int(i) for i in input().split()]
def upper(x):
if x < 3200:
return (x//400 + 1) * 400 -1
else:
return 3200
Rate = defaultdict(int)
for a in A:
Rate[upper(a)] += 1
ans = 0
for r in Rate:
if r < 3200:
... | import sys
def solve():
input = sys.stdin.readline
Rate = [0] * 9
N = int(eval(input()))
A = [int(a) for a in input().split()]
for a in A: Rate[min(8, a // 400)] += 1
count = 0
for i in range(8):
if Rate[i] > 0: count += 1
minC, maxC = count, count + Rate[8]
if c... | 22 | 19 | 405 | 415 | from collections import defaultdict
N = int(eval(input()))
A = [int(i) for i in input().split()]
def upper(x):
if x < 3200:
return (x // 400 + 1) * 400 - 1
else:
return 3200
Rate = defaultdict(int)
for a in A:
Rate[upper(a)] += 1
ans = 0
for r in Rate:
if r < 3200:
ans += 1
... | import sys
def solve():
input = sys.stdin.readline
Rate = [0] * 9
N = int(eval(input()))
A = [int(a) for a in input().split()]
for a in A:
Rate[min(8, a // 400)] += 1
count = 0
for i in range(8):
if Rate[i] > 0:
count += 1
minC, maxC = count, count + Rate[8]... | false | 13.636364 | [
"-from collections import defaultdict",
"-",
"-N = int(eval(input()))",
"-A = [int(i) for i in input().split()]",
"+import sys",
"-def upper(x):",
"- if x < 3200:",
"- return (x // 400 + 1) * 400 - 1",
"- else:",
"- return 3200",
"+def solve():",
"+ input = sys.stdin.rea... | false | 0.007048 | 0.039614 | 0.177925 | [
"s877296664",
"s458959930"
] |
u619197965 | p03087 | python | s889664254 | s319563027 | 1,442 | 889 | 6,420 | 6,164 | Accepted | Accepted | 38.35 | from collections import deque
n,q=list(map(int,input().split()))
s=eval(input())
AC=deque()
count=0
for i in range(n):
if i!=0:
if s[i-1:i+1]=="AC":
count+=1
AC.append(count)
for _ in range(q):
l,r=list(map(int,input().split()))
print((AC[r-1]-AC[l-1])) | n,q=[int(i) for i in input().split()]
s=eval(input())
AC=[0]*n
cnt=0
for i in range(1,n):
if s[i-1:i+1]=="AC":
cnt+=1
AC[i]=cnt
for i in range(q):
l,r=[int(j) for j in input().split()]
print((AC[r-1]-AC[l-1])) | 13 | 11 | 281 | 237 | from collections import deque
n, q = list(map(int, input().split()))
s = eval(input())
AC = deque()
count = 0
for i in range(n):
if i != 0:
if s[i - 1 : i + 1] == "AC":
count += 1
AC.append(count)
for _ in range(q):
l, r = list(map(int, input().split()))
print((AC[r - 1] - AC[l - 1]... | n, q = [int(i) for i in input().split()]
s = eval(input())
AC = [0] * n
cnt = 0
for i in range(1, n):
if s[i - 1 : i + 1] == "AC":
cnt += 1
AC[i] = cnt
for i in range(q):
l, r = [int(j) for j in input().split()]
print((AC[r - 1] - AC[l - 1]))
| false | 15.384615 | [
"-from collections import deque",
"-",
"-n, q = list(map(int, input().split()))",
"+n, q = [int(i) for i in input().split()]",
"-AC = deque()",
"-count = 0",
"-for i in range(n):",
"- if i != 0:",
"- if s[i - 1 : i + 1] == \"AC\":",
"- count += 1",
"- AC.append(count)",
... | false | 0.037122 | 0.035076 | 1.05833 | [
"s889664254",
"s319563027"
] |
u363995337 | p02767 | python | s103057970 | s073098542 | 21 | 17 | 3,060 | 2,940 | Accepted | Accepted | 19.05 |
N = int(eval(input()))
x_list = list(map(int, input().split()))
maxValue = max(x_list)
minValue = 1000000
for i in range(1,100):
ans = 0
for j in range(N):
ans += ( x_list[j] - i ) **2
if(ans < minValue):
minValue = ans
print(minValue) |
N = int(eval(input()))
x_list = list(map(int, input().split()))
p = round( sum(x_list) / N )
ans = 0
for i in range(N):
# ans += round( (x_list[i] - p) ** 2 )
ans += (x_list[i] - p) ** 2
print(ans)
| 14 | 15 | 273 | 224 | N = int(eval(input()))
x_list = list(map(int, input().split()))
maxValue = max(x_list)
minValue = 1000000
for i in range(1, 100):
ans = 0
for j in range(N):
ans += (x_list[j] - i) ** 2
if ans < minValue:
minValue = ans
print(minValue)
| N = int(eval(input()))
x_list = list(map(int, input().split()))
p = round(sum(x_list) / N)
ans = 0
for i in range(N):
# ans += round( (x_list[i] - p) ** 2 )
ans += (x_list[i] - p) ** 2
print(ans)
| false | 6.666667 | [
"-maxValue = max(x_list)",
"-minValue = 1000000",
"-for i in range(1, 100):",
"- ans = 0",
"- for j in range(N):",
"- ans += (x_list[j] - i) ** 2",
"- if ans < minValue:",
"- minValue = ans",
"-print(minValue)",
"+p = round(sum(x_list) / N)",
"+ans = 0",
"+for i in range... | false | 0.132965 | 0.091756 | 1.449103 | [
"s103057970",
"s073098542"
] |
u327125861 | p02388 | python | s663883250 | s967641299 | 50 | 20 | 7,620 | 7,628 | Accepted | Accepted | 60 | x = int(eval(input()))
x = x*x*x
print((int(x))) | x = int(eval(input()))
x = x * x * x
print(x) | 3 | 3 | 42 | 41 | x = int(eval(input()))
x = x * x * x
print((int(x)))
| x = int(eval(input()))
x = x * x * x
print(x)
| false | 0 | [
"-print((int(x)))",
"+print(x)"
] | false | 0.040198 | 0.076743 | 0.523805 | [
"s663883250",
"s967641299"
] |
u620084012 | p03112 | python | s612893798 | s068450018 | 1,512 | 676 | 12,800 | 12,796 | Accepted | Accepted | 55.29 | import bisect
A, B, Q = list(map(int,input().split()))
s = [-10**20] + [int(eval(input())) for k in range(A)] + [10**20,10**20]
t = [-10**20] + [int(eval(input())) for k in range(B)] + [10**20,10**20]
for _ in range(Q):
x = int(eval(input()))
S = bisect.bisect_left(s,x)
T = bisect.bisect_left(t,x)
... | import bisect
import sys
def input():
return sys.stdin.readline()[:-1]
def main():
A, B, Q = list(map(int,input().split()))
s = [-10**20] + [int(eval(input())) for k in range(A)] + [10**20,10**20]
t = [-10**20] + [int(eval(input())) for k in range(B)] + [10**20,10**20]
for _ in range(Q):
... | 16 | 22 | 499 | 672 | import bisect
A, B, Q = list(map(int, input().split()))
s = [-(10**20)] + [int(eval(input())) for k in range(A)] + [10**20, 10**20]
t = [-(10**20)] + [int(eval(input())) for k in range(B)] + [10**20, 10**20]
for _ in range(Q):
x = int(eval(input()))
S = bisect.bisect_left(s, x)
T = bisect.bisect_left(t, x)... | import bisect
import sys
def input():
return sys.stdin.readline()[:-1]
def main():
A, B, Q = list(map(int, input().split()))
s = [-(10**20)] + [int(eval(input())) for k in range(A)] + [10**20, 10**20]
t = [-(10**20)] + [int(eval(input())) for k in range(B)] + [10**20, 10**20]
for _ in range(Q):
... | false | 27.272727 | [
"+import sys",
"-A, B, Q = list(map(int, input().split()))",
"-s = [-(10**20)] + [int(eval(input())) for k in range(A)] + [10**20, 10**20]",
"-t = [-(10**20)] + [int(eval(input())) for k in range(B)] + [10**20, 10**20]",
"-for _ in range(Q):",
"- x = int(eval(input()))",
"- S = bisect.bisect_left(... | false | 0.04186 | 0.036656 | 1.141951 | [
"s612893798",
"s068450018"
] |
u426534722 | p02277 | python | s442118547 | s918950764 | 1,270 | 750 | 23,472 | 26,604 | Accepted | Accepted | 40.94 | import sys
readline = sys.stdin.readline
INF = int(1e10)
def merge(A, left, mid, right):
L = A[left: mid] + [[0, INF]]
R = A[mid: right] + [[0, INF]]
i = j = 0
for k in range(left, right):
if L[i][1] <= R[j][1]:
A[k] = L[i]
i += 1
else:
A[k... | import sys
readline = sys.stdin.readline
import sys
readline = sys.stdin.readline
INF = int(1e10)
def partition(A, p, r):
x = A[r][1]
i = p - 1
for j in range(p, r):
if A[j][1] <= x:
i += 1
A[i], A[j] = A[j], A[i]
A[i + 1], A[r] = A[r], A[i + 1]
return i ... | 43 | 32 | 1,148 | 868 | import sys
readline = sys.stdin.readline
INF = int(1e10)
def merge(A, left, mid, right):
L = A[left:mid] + [[0, INF]]
R = A[mid:right] + [[0, INF]]
i = j = 0
for k in range(left, right):
if L[i][1] <= R[j][1]:
A[k] = L[i]
i += 1
else:
A[k] = R[j]
... | import sys
readline = sys.stdin.readline
import sys
readline = sys.stdin.readline
INF = int(1e10)
def partition(A, p, r):
x = A[r][1]
i = p - 1
for j in range(p, r):
if A[j][1] <= x:
i += 1
A[i], A[j] = A[j], A[i]
A[i + 1], A[r] = A[r], A[i + 1]
return i + 1
def... | false | 25.581395 | [
"+import sys",
"+",
"+readline = sys.stdin.readline",
"-",
"-",
"-def merge(A, left, mid, right):",
"- L = A[left:mid] + [[0, INF]]",
"- R = A[mid:right] + [[0, INF]]",
"- i = j = 0",
"- for k in range(left, right):",
"- if L[i][1] <= R[j][1]:",
"- A[k] = L[i]",
... | false | 0.096963 | 0.044202 | 2.193644 | [
"s442118547",
"s918950764"
] |
u678167152 | p03168 | python | s058808561 | s688957909 | 622 | 476 | 215,944 | 157,916 | Accepted | Accepted | 23.47 | N = int(eval(input()))
P = list(map(float, input().split()))
def solve():
dp = [[0]*(i+2) for i in range(N+1)]
dp[0][0] = 1
for i in range(1,N+1):
dp[i][0] = dp[i-1][0]*(1-P[i-1])
for i in range(1,N+1):
for j in range(1,i+1):
dp[i][j] = dp[i-1][j-1]*P[i-1]+dp[i-1... | N = int(eval(input()))
P = list(map(float, input().split()))
def solve():
dp = [[0]*(i+3) for i in range(N+1)]
dp[0][1] = 1
for i in range(1,N+1):
for j in range(1,i+2):
dp[i][j] = dp[i-1][j-1]*P[i-1]+dp[i-1][j]*(1-P[i-1])
ans = sum(dp[-1][(N+3)//2:])
return ans
pri... | 15 | 13 | 395 | 325 | N = int(eval(input()))
P = list(map(float, input().split()))
def solve():
dp = [[0] * (i + 2) for i in range(N + 1)]
dp[0][0] = 1
for i in range(1, N + 1):
dp[i][0] = dp[i - 1][0] * (1 - P[i - 1])
for i in range(1, N + 1):
for j in range(1, i + 1):
dp[i][j] = dp[i - 1][j - ... | N = int(eval(input()))
P = list(map(float, input().split()))
def solve():
dp = [[0] * (i + 3) for i in range(N + 1)]
dp[0][1] = 1
for i in range(1, N + 1):
for j in range(1, i + 2):
dp[i][j] = dp[i - 1][j - 1] * P[i - 1] + dp[i - 1][j] * (1 - P[i - 1])
ans = sum(dp[-1][(N + 3) // 2... | false | 13.333333 | [
"- dp = [[0] * (i + 2) for i in range(N + 1)]",
"- dp[0][0] = 1",
"+ dp = [[0] * (i + 3) for i in range(N + 1)]",
"+ dp[0][1] = 1",
"- dp[i][0] = dp[i - 1][0] * (1 - P[i - 1])",
"- for i in range(1, N + 1):",
"- for j in range(1, i + 1):",
"+ for j in range(1, i + 2... | false | 0.116641 | 0.037336 | 3.124125 | [
"s058808561",
"s688957909"
] |
u756829954 | p03169 | python | s708977146 | s595652967 | 1,994 | 905 | 604,552 | 253,832 | Accepted | Accepted | 54.61 | def p_j_dp():
n = int(eval(input()))
*a, = list(map(int, input().split()))
c1 = a.count(1)
c2 = a.count(2)
c3 = a.count(3)
dp = [[[0] * (n + 1) for _ in range(n + 1)] for _ in range(n + 1)]
for k in range(c3 + 1):
for j in range(c3 + c2 + 1 - k):
for i in range(n... | def p_j_dp():
n = int(eval(input()))
*a, = list(map(int, input().split()))
c1 = a.count(1)
c2 = a.count(2)
c3 = a.count(3)
dp = [[[0.0] * (n + 1) for _ in range(n + 1)] for _ in range(n + 1)]
for k in range(c3 + 1):
for j in range(c3 + c2 + 1 - k):
for i in range... | 24 | 24 | 758 | 760 | def p_j_dp():
n = int(eval(input()))
(*a,) = list(map(int, input().split()))
c1 = a.count(1)
c2 = a.count(2)
c3 = a.count(3)
dp = [[[0] * (n + 1) for _ in range(n + 1)] for _ in range(n + 1)]
for k in range(c3 + 1):
for j in range(c3 + c2 + 1 - k):
for i in range(n + 1 - ... | def p_j_dp():
n = int(eval(input()))
(*a,) = list(map(int, input().split()))
c1 = a.count(1)
c2 = a.count(2)
c3 = a.count(3)
dp = [[[0.0] * (n + 1) for _ in range(n + 1)] for _ in range(n + 1)]
for k in range(c3 + 1):
for j in range(c3 + c2 + 1 - k):
for i in range(n + 1 ... | false | 0 | [
"- dp = [[[0] * (n + 1) for _ in range(n + 1)] for _ in range(n + 1)]",
"+ dp = [[[0.0] * (n + 1) for _ in range(n + 1)] for _ in range(n + 1)]"
] | false | 0.036144 | 0.036519 | 0.989729 | [
"s708977146",
"s595652967"
] |
u852690916 | p02537 | python | s891692369 | s230152509 | 468 | 419 | 122,732 | 122,864 | Accepted | Accepted | 10.47 | # でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
def main(N, K, A):
tree = SegmentTree(300_300)
for a in A:
p = tree.query(max(0, a - K), min(300_300, a + K + 1))
tree.modify(a, p + 1)
print((tree.query_all()))
class SegmentTree:
__slots__ = ('__n', '__d', '__f', '__e... | # でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
def main(N, K, A):
tree = SegmentTree(300_300)
for a in A:
p = tree.query(max(0, a - K), min(300_300, a + K + 1))
tree.modify(a, p + 1)
print((tree.query_all()))
class SegmentTree:
__slots__ = ('__n', '__d', '__f', '__e... | 67 | 67 | 2,414 | 2,402 | # でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
def main(N, K, A):
tree = SegmentTree(300_300)
for a in A:
p = tree.query(max(0, a - K), min(300_300, a + K + 1))
tree.modify(a, p + 1)
print((tree.query_all()))
class SegmentTree:
__slots__ = ("__n", "__d", "__f", "__e")
... | # でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
def main(N, K, A):
tree = SegmentTree(300_300)
for a in A:
p = tree.query(max(0, a - K), min(300_300, a + K + 1))
tree.modify(a, p + 1)
print((tree.query_all()))
class SegmentTree:
__slots__ = ("__n", "__d", "__f", "__e")
... | false | 0 | [
"- return self.query(0, self.__n)",
"+ return self.__d[1]"
] | false | 0.095609 | 0.126644 | 0.75494 | [
"s891692369",
"s230152509"
] |
u133936772 | p02660 | python | s926876836 | s986307249 | 124 | 94 | 9,436 | 9,416 | Accepted | Accepted | 24.19 | n=int(eval(input()))
int_sqrt=lambda x:int(x**0.5)+1
def prime_factor(x):
d={}
for i in p:
while x%i<1:
x//=i
d[i]=d.get(i,0)+1
if x<2: break
if x>1: d[x]=1
return d
p=list(range(2,int_sqrt(n)))
d=prime_factor(n)
a=0
for i in list(d.values()):
t=c=0
while t+c<i: c+=1;... | n=int(eval(input()))
d={2:0}
while n%2<1: n//=2; d[2]+=1
for i in range(3,int(n**0.5)+1,2):
while n%i<1: n//=i; d[i]=d.get(i,0)+1
if n<2: break
if n>1: d[n]=1
a=0
for i in list(d.values()):
t=c=0
while t+c<i: c+=1; t+=c
a+=c
print(a) | 21 | 13 | 325 | 247 | n = int(eval(input()))
int_sqrt = lambda x: int(x**0.5) + 1
def prime_factor(x):
d = {}
for i in p:
while x % i < 1:
x //= i
d[i] = d.get(i, 0) + 1
if x < 2:
break
if x > 1:
d[x] = 1
return d
p = list(range(2, int_sqrt(n)))
d = prime_factor... | n = int(eval(input()))
d = {2: 0}
while n % 2 < 1:
n //= 2
d[2] += 1
for i in range(3, int(n**0.5) + 1, 2):
while n % i < 1:
n //= i
d[i] = d.get(i, 0) + 1
if n < 2:
break
if n > 1:
d[n] = 1
a = 0
for i in list(d.values()):
t = c = 0
while t + c < i:
c += 1
... | false | 38.095238 | [
"-int_sqrt = lambda x: int(x**0.5) + 1",
"-",
"-",
"-def prime_factor(x):",
"- d = {}",
"- for i in p:",
"- while x % i < 1:",
"- x //= i",
"- d[i] = d.get(i, 0) + 1",
"- if x < 2:",
"- break",
"- if x > 1:",
"- d[x] = 1",
"- ... | false | 0.064226 | 0.039831 | 1.612461 | [
"s926876836",
"s986307249"
] |
u989345508 | p03806 | python | s016351203 | s273251367 | 950 | 772 | 5,480 | 5,368 | Accepted | Accepted | 18.74 | n,ma,mb=list(map(int,input().split()))
el=[list(map(int,input().split())) for i in range(n)]
sa=sum(i[0] for i in el)
sb=sum(i[1] for i in el)
#mi=min(sa//ma,sb//mb)
inf=10000000000
x=[[inf for j in range(sb+1)] for i in range(sa+1)]
x[0][0]=0
for i in range(n):
now=el[i]
x_sub=[[0 for j in range(sb+1... | n,ma,mb=list(map(int,input().split()))
el=[list(map(int,input().split())) for i in range(n)]
sa=sum(i[0] for i in el)
sb=sum(i[1] for i in el)
sa1=sa+1
sb1=sb+1
inf=10000000000
x=[[inf]*(sb1) for i in range(sa1)]
x[0][0]=0
for i in range(n):
now=el[i]
x_sub=[[0]*(sb1) for i in range(sa1)]
for ... | 27 | 31 | 810 | 816 | n, ma, mb = list(map(int, input().split()))
el = [list(map(int, input().split())) for i in range(n)]
sa = sum(i[0] for i in el)
sb = sum(i[1] for i in el)
# mi=min(sa//ma,sb//mb)
inf = 10000000000
x = [[inf for j in range(sb + 1)] for i in range(sa + 1)]
x[0][0] = 0
for i in range(n):
now = el[i]
x_sub = [[0 fo... | n, ma, mb = list(map(int, input().split()))
el = [list(map(int, input().split())) for i in range(n)]
sa = sum(i[0] for i in el)
sb = sum(i[1] for i in el)
sa1 = sa + 1
sb1 = sb + 1
inf = 10000000000
x = [[inf] * (sb1) for i in range(sa1)]
x[0][0] = 0
for i in range(n):
now = el[i]
x_sub = [[0] * (sb1) for i in ... | false | 12.903226 | [
"-# mi=min(sa//ma,sb//mb)",
"+sa1 = sa + 1",
"+sb1 = sb + 1",
"-x = [[inf for j in range(sb + 1)] for i in range(sa + 1)]",
"+x = [[inf] * (sb1) for i in range(sa1)]",
"- x_sub = [[0 for j in range(sb + 1)] for i in range(sa + 1)]",
"- for k in range(sa + 1):",
"- for l in range(sb + 1):"... | false | 0.042381 | 0.168741 | 0.251158 | [
"s016351203",
"s273251367"
] |
u798803522 | p02315 | python | s619229282 | s655628450 | 670 | 610 | 6,968 | 6,260 | Accepted | Accepted | 8.96 | import copy
length, capacity = list(map(int, input().split(" ")))
nap = []
for _ in range(length):
v, w = list(map(int, input().split(" ")))
nap.append([v, w])
dp = [0 for n in range(capacity + 1)]
for i, (v, w) in enumerate(nap):
new_dp = dp[::]
if w <= capacity:
new_dp[w] = max(v, ... | length, weight = (int(n) for n in input().split(" ") )
dp = [0 for n in range(weight + 1)]
for l in range(length):
v, w = (int(n) for n in input().split(" ") )
temp = dp[:]
for i, d in enumerate(dp):
if d and i + w <= weight:
temp[i + w] = max(d + v, dp[i + w])
dp = temp
... | 21 | 13 | 536 | 390 | import copy
length, capacity = list(map(int, input().split(" ")))
nap = []
for _ in range(length):
v, w = list(map(int, input().split(" ")))
nap.append([v, w])
dp = [0 for n in range(capacity + 1)]
for i, (v, w) in enumerate(nap):
new_dp = dp[::]
if w <= capacity:
new_dp[w] = max(v, dp[w])
... | length, weight = (int(n) for n in input().split(" "))
dp = [0 for n in range(weight + 1)]
for l in range(length):
v, w = (int(n) for n in input().split(" "))
temp = dp[:]
for i, d in enumerate(dp):
if d and i + w <= weight:
temp[i + w] = max(d + v, dp[i + w])
dp = temp
dp[w] = ma... | false | 38.095238 | [
"-import copy",
"-",
"-length, capacity = list(map(int, input().split(\" \")))",
"-nap = []",
"-for _ in range(length):",
"- v, w = list(map(int, input().split(\" \")))",
"- nap.append([v, w])",
"-dp = [0 for n in range(capacity + 1)]",
"-for i, (v, w) in enumerate(nap):",
"- new_dp = dp[... | false | 0.071081 | 0.04329 | 1.641984 | [
"s619229282",
"s655628450"
] |
u350997995 | p03111 | python | s475195213 | s978803294 | 383 | 69 | 3,064 | 3,064 | Accepted | Accepted | 81.98 | N,A,B,C = map(int,input().split())
l = [int(input()) for i in range(N)]
def return_4(x, k):
four_hairetu = [0 for i in range(k)]
for i in range(k):
four_hairetu[i] = x%4
x = x//4
return four_hairetu
min_mp = 1000000
for i in range(4**N):
ABC = [0,0,0,0] #[not,A,B,C] = [0,1,2,3]... | N,A,B,C = list(map(int,input().split()))
l = [int(eval(input())) for i in range(N)]
def dfs(k,a,b,c):
global N,A,B,C,l
if k == N:
return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c)>0 else 1000000
det0 = dfs(k+1, a+l[k], b, c)+10
det1 = dfs(k+1, a, b+l[k], c)+10
det2 = dfs(k+1, a, b, ... | 23 | 12 | 756 | 409 | N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
def return_4(x, k):
four_hairetu = [0 for i in range(k)]
for i in range(k):
four_hairetu[i] = x % 4
x = x // 4
return four_hairetu
min_mp = 1000000
for i in range(4**N):
ABC = [0, 0, 0, 0] # [not,A,B,C] = [0... | N, A, B, C = list(map(int, input().split()))
l = [int(eval(input())) for i in range(N)]
def dfs(k, a, b, c):
global N, A, B, C, l
if k == N:
return (
abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else 1000000
)
det0 = dfs(k + 1, a + l[k], b, c) + 10
det1 = d... | false | 47.826087 | [
"-N, A, B, C = map(int, input().split())",
"-l = [int(input()) for i in range(N)]",
"+N, A, B, C = list(map(int, input().split()))",
"+l = [int(eval(input())) for i in range(N)]",
"-def return_4(x, k):",
"- four_hairetu = [0 for i in range(k)]",
"- for i in range(k):",
"- four_hairetu[i] ... | false | 0.066254 | 0.088628 | 0.747546 | [
"s475195213",
"s978803294"
] |
u462329577 | p03031 | python | s987114294 | s438249648 | 183 | 55 | 39,920 | 3,064 | Accepted | Accepted | 69.95 | N,M = list(map(int,input().split()))
ls = []
for i in range(M):
s = list(map(int,input().split()))
ls.append(s[1:])
p = list(map(int,input().split()))
#greedy O(2^N)(MN) : (all set of switch N) = 2^10 * M 10 10^4 OK
ans = 0
for i in range(2**N): # all set of N 2**N == 1 << N (shif operator N right shif... | n,m = list(map(int,input().split()))
light = []
for i in range(m):
light.append(list(map(int,input().split())))
p = list(map(int,input().split()))
# bit全探索 nで スイッチのパターンを全てためす
#
ans = 0
for i in range(2**n):
ng = 0
for j in range(m):
ans_j = 0
for k in range(n):
if i >> k & 1 and k+1 in... | 21 | 22 | 555 | 518 | N, M = list(map(int, input().split()))
ls = []
for i in range(M):
s = list(map(int, input().split()))
ls.append(s[1:])
p = list(map(int, input().split()))
# greedy O(2^N)(MN) : (all set of switch N) = 2^10 * M 10 10^4 OK
ans = 0
for i in range(2**N): # all set of N 2**N == 1 << N (shif operator N right shift)... | n, m = list(map(int, input().split()))
light = []
for i in range(m):
light.append(list(map(int, input().split())))
p = list(map(int, input().split()))
# bit全探索 nで スイッチのパターンを全てためす
#
ans = 0
for i in range(2**n):
ng = 0
for j in range(m):
ans_j = 0
for k in range(n):
if i >> k & 1 ... | false | 4.545455 | [
"-N, M = list(map(int, input().split()))",
"-ls = []",
"-for i in range(M):",
"- s = list(map(int, input().split()))",
"- ls.append(s[1:])",
"+n, m = list(map(int, input().split()))",
"+light = []",
"+for i in range(m):",
"+ light.append(list(map(int, input().split())))",
"-# greedy O(2^N... | false | 0.099701 | 0.088399 | 1.127851 | [
"s987114294",
"s438249648"
] |
u977389981 | p03059 | python | s866291443 | s216829636 | 20 | 18 | 3,316 | 2,940 | Accepted | Accepted | 10 | A, B, T = list(map(int, input().split()))
print((T // A * B)) | A, B, T = list(map(int, input().split()))
x = T + 0.5
y = x // A
print((int(B * y))) | 2 | 5 | 54 | 81 | A, B, T = list(map(int, input().split()))
print((T // A * B))
| A, B, T = list(map(int, input().split()))
x = T + 0.5
y = x // A
print((int(B * y)))
| false | 60 | [
"-print((T // A * B))",
"+x = T + 0.5",
"+y = x // A",
"+print((int(B * y)))"
] | false | 0.065492 | 0.044049 | 1.486788 | [
"s866291443",
"s216829636"
] |
u334712262 | p03013 | python | s561194609 | s513098047 | 327 | 124 | 66,136 | 11,076 | Accepted | Accepted | 62.08 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, produc... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, produc... | 105 | 104 | 1,972 | 1,967 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permut... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permut... | false | 0.952381 | [
"-@mt"
] | false | 0.035221 | 0.036237 | 0.971945 | [
"s561194609",
"s513098047"
] |
u573754721 | p02887 | python | s301412222 | s315139037 | 189 | 47 | 49,648 | 4,652 | Accepted | Accepted | 75.13 | n=int(eval(input()))
s=list(eval(input()))
ans=[]
latest=0
for i in range(n):
if s[i]!=latest:
ans.append(s[i])
latest=s[i]
print((len(ans)))
| n=int(eval(input()))
s=list(eval(input()))
latest=0
L=[]
for i in range(n):
if s[i]!=latest:
L.append(s[i])
latest=s[i]
print((len(L))) | 9 | 10 | 156 | 161 | n = int(eval(input()))
s = list(eval(input()))
ans = []
latest = 0
for i in range(n):
if s[i] != latest:
ans.append(s[i])
latest = s[i]
print((len(ans)))
| n = int(eval(input()))
s = list(eval(input()))
latest = 0
L = []
for i in range(n):
if s[i] != latest:
L.append(s[i])
latest = s[i]
print((len(L)))
| false | 10 | [
"-ans = []",
"+L = []",
"- ans.append(s[i])",
"+ L.append(s[i])",
"-print((len(ans)))",
"+print((len(L)))"
] | false | 0.043019 | 0.048364 | 0.889479 | [
"s301412222",
"s315139037"
] |
u255943004 | p02947 | python | s150573272 | s291994259 | 1,765 | 348 | 223,724 | 25,324 | Accepted | Accepted | 80.28 | from scipy.misc import comb
from collections import Counter
N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
chars = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
result = []
for n in range(N):
res = {}
for char in chars:
r... | N = int(eval(input()))
S = [""] * N
for n in range(N):
S[n] = eval(input())
from collections import defaultdict
dct = defaultdict(int)
for s in S:
sorted_s = "".join(sorted(s))
dct[sorted_s] += 1
ans = 0
for k,v in list(dct.items()):
ans += v*(v-1)//2
print(ans)
| 19 | 13 | 559 | 273 | from scipy.misc import comb
from collections import Counter
N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
chars = [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",... | N = int(eval(input()))
S = [""] * N
for n in range(N):
S[n] = eval(input())
from collections import defaultdict
dct = defaultdict(int)
for s in S:
sorted_s = "".join(sorted(s))
dct[sorted_s] += 1
ans = 0
for k, v in list(dct.items()):
ans += v * (v - 1) // 2
print(ans)
| false | 31.578947 | [
"-from scipy.misc import comb",
"-from collections import Counter",
"+N = int(eval(input()))",
"+S = [\"\"] * N",
"+for n in range(N):",
"+ S[n] = eval(input())",
"+from collections import defaultdict",
"-N = int(eval(input()))",
"-S = [eval(input()) for _ in range(N)]",
"-chars = [",
"- \... | false | 0.322271 | 0.036998 | 8.710421 | [
"s150573272",
"s291994259"
] |
u945181840 | p02793 | python | s445068202 | s661529051 | 242 | 191 | 51,692 | 52,068 | Accepted | Accepted | 21.07 | import sys
from collections import Counter, defaultdict
read = sys.stdin.read
# 最小素因数を求める(エラトステネスの篩の亜種?)
def min_factor(n):
sieve = list(range(n + 1))
sieve[2::2] = [2] * (n // 2)
for i in range(3, int(n ** 0.5) + 2, 2):
if sieve[i] == i:
sieve[i * i::2 * i] = [i] * ((n - ... | import sys
from collections import defaultdict
read = sys.stdin.read
# 最小素因数を求める(エラトステネスの篩の亜種?)
def min_factor(n):
sieve = list(range(n + 1))
sieve[2::2] = [2] * (n // 2)
for i in range(3, int(n ** 0.5) + 2, 2):
if sieve[i] == i:
sieve[i * i::2 * i] = [i] * ((n - i * i - 1... | 44 | 44 | 895 | 888 | import sys
from collections import Counter, defaultdict
read = sys.stdin.read
# 最小素因数を求める(エラトステネスの篩の亜種?)
def min_factor(n):
sieve = list(range(n + 1))
sieve[2::2] = [2] * (n // 2)
for i in range(3, int(n**0.5) + 2, 2):
if sieve[i] == i:
sieve[i * i :: 2 * i] = [i] * ((n - i * i - 1) // ... | import sys
from collections import defaultdict
read = sys.stdin.read
# 最小素因数を求める(エラトステネスの篩の亜種?)
def min_factor(n):
sieve = list(range(n + 1))
sieve[2::2] = [2] * (n // 2)
for i in range(3, int(n**0.5) + 2, 2):
if sieve[i] == i:
sieve[i * i :: 2 * i] = [i] * ((n - i * i - 1) // (2 * i) +... | false | 0 | [
"-from collections import Counter, defaultdict",
"+from collections import defaultdict",
"- a = [1]",
"+ a = defaultdict(int)",
"- a.append(b)",
"+ a[b] += 1",
"- for key, value in list(Counter(prime_factorize(i)).items()):",
"+ for key, value in list(prime_factorize(i).items... | false | 0.33297 | 0.328099 | 1.014844 | [
"s445068202",
"s661529051"
] |
u987164499 | p03435 | python | s638718658 | s382776650 | 149 | 17 | 12,492 | 3,064 | Accepted | Accepted | 88.59 | from sys import stdin
from itertools import combinations
from math import factorial
import numpy as np
li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(3)]
a1 = 0
b1 = li[0][0]-a1
b2 = li[0][1]-a1
b3 = li[0][2]-a1
a2 = li[1][0]-b1
a3 = li[2][0]-b1
lin = [[a1,a2,a3],[b1,b2,b3]]
f... | c = [list(map(int,input().split())) for i in range(3)]
a = [0]*3
b = [0]*3
b[0] = c[0][0]
b[1] = c[0][1]
b[2] = c[0][2]
a[1] = c[1][1]-b[1]
a[2] = c[2][2]-b[2]
for i in range(3):
for j in range(3):
if c[i][j] != a[i]+b[j]:
print("No")
exit()
print("Yes") | 23 | 15 | 467 | 305 | from sys import stdin
from itertools import combinations
from math import factorial
import numpy as np
li = [list(map(int, stdin.readline().rstrip().split())) for _ in range(3)]
a1 = 0
b1 = li[0][0] - a1
b2 = li[0][1] - a1
b3 = li[0][2] - a1
a2 = li[1][0] - b1
a3 = li[2][0] - b1
lin = [[a1, a2, a3], [b1, b2, b3]]
for ... | c = [list(map(int, input().split())) for i in range(3)]
a = [0] * 3
b = [0] * 3
b[0] = c[0][0]
b[1] = c[0][1]
b[2] = c[0][2]
a[1] = c[1][1] - b[1]
a[2] = c[2][2] - b[2]
for i in range(3):
for j in range(3):
if c[i][j] != a[i] + b[j]:
print("No")
exit()
print("Yes")
| false | 34.782609 | [
"-from sys import stdin",
"-from itertools import combinations",
"-from math import factorial",
"-import numpy as np",
"-",
"-li = [list(map(int, stdin.readline().rstrip().split())) for _ in range(3)]",
"-a1 = 0",
"-b1 = li[0][0] - a1",
"-b2 = li[0][1] - a1",
"-b3 = li[0][2] - a1",
"-a2 = li[1][... | false | 0.03716 | 0.082952 | 0.447969 | [
"s638718658",
"s382776650"
] |
u645855527 | p03294 | python | s839259752 | s107358873 | 184 | 62 | 38,768 | 64,900 | Accepted | Accepted | 66.3 | n = int(eval(input()))
a = list(map(int, input().split()))
print((sum(a)-len(a))) | N = int(eval(input()))
a = list(map(int, input().split()))
print((sum(a)-N)) | 3 | 4 | 75 | 72 | n = int(eval(input()))
a = list(map(int, input().split()))
print((sum(a) - len(a)))
| N = int(eval(input()))
a = list(map(int, input().split()))
print((sum(a) - N))
| false | 25 | [
"-n = int(eval(input()))",
"+N = int(eval(input()))",
"-print((sum(a) - len(a)))",
"+print((sum(a) - N))"
] | false | 0.037384 | 0.037056 | 1.008858 | [
"s839259752",
"s107358873"
] |
u328069918 | p00002 | python | s926140423 | s481865899 | 30 | 20 | 7,540 | 7,572 | Accepted | Accepted | 33.33 | while True:
try:
print((len(str(sum(map(int, input().split()))))))
except EOFError:
break | import sys
[print(len(str(y[0] + y[1]))) for y in [[int(z) for z in x.split()] for x in sys.stdin]]
| 5 | 3 | 115 | 103 | while True:
try:
print((len(str(sum(map(int, input().split()))))))
except EOFError:
break
| import sys
[print(len(str(y[0] + y[1]))) for y in [[int(z) for z in x.split()] for x in sys.stdin]]
| false | 40 | [
"-while True:",
"- try:",
"- print((len(str(sum(map(int, input().split()))))))",
"- except EOFError:",
"- break",
"+import sys",
"+",
"+[print(len(str(y[0] + y[1]))) for y in [[int(z) for z in x.split()] for x in sys.stdin]]"
] | false | 0.03623 | 0.036381 | 0.995834 | [
"s926140423",
"s481865899"
] |
u426534722 | p02283 | python | s002133740 | s052219514 | 8,320 | 7,370 | 105,016 | 105,028 | Accepted | Accepted | 11.42 | NIL = None
class Tree:
def __init__(self, key = None):
self.key = key
self.p = NIL
self.left = NIL
self.right = NIL
n = int(input())
tree = {"root":NIL}
def insert(T, z):
y = NIL
x = T["root"]
while x != NIL:
y = x
if z.key < x.key:
... | import sys
readline = sys.stdin.readline
NIL = None
class Tree:
def __init__(self, key = None):
self.key = key
self.p = NIL
self.left = NIL
self.right = NIL
n = int(input())
tree = {"root":NIL}
def insert(T, z):
y = NIL
x = T["root"]
while x != NIL:
... | 48 | 50 | 1,116 | 1,162 | NIL = None
class Tree:
def __init__(self, key=None):
self.key = key
self.p = NIL
self.left = NIL
self.right = NIL
n = int(input())
tree = {"root": NIL}
def insert(T, z):
y = NIL
x = T["root"]
while x != NIL:
y = x
if z.key < x.key:
x = x.... | import sys
readline = sys.stdin.readline
NIL = None
class Tree:
def __init__(self, key=None):
self.key = key
self.p = NIL
self.left = NIL
self.right = NIL
n = int(input())
tree = {"root": NIL}
def insert(T, z):
y = NIL
x = T["root"]
while x != NIL:
y = x
... | false | 4 | [
"+import sys",
"+",
"+readline = sys.stdin.readline",
"- ss = input()",
"+ ss = readline()"
] | false | 0.008248 | 0.11235 | 0.07341 | [
"s002133740",
"s052219514"
] |
u088552457 | p02954 | python | s622220082 | s956703924 | 319 | 90 | 73,152 | 78,324 | Accepted | Accepted | 71.79 | def count_section_by_zero(data):
count = 0
flg = False
start = 0
for i, d in enumerate(data):
if flg is False and d != 0:
count += 1
flg = True
if d == 0:
flg = False
return count
def input_list():
return list(map(int, input().split()))
def input_list_str()... | import sys
input = sys.stdin.readline
import math
# 持っているビスケットを叩き、1枚増やす
# ビスケット A枚を 1円に交換する
# 1円をビスケット B枚に交換する
def main():
s = str(eval(input())).strip()
n = len(s)
cnt = 0
ans = [0] * n
for i, moji in enumerate(s):
if moji == "R":
cnt += 1
continue
... | 83 | 54 | 1,613 | 1,171 | def count_section_by_zero(data):
count = 0
flg = False
start = 0
for i, d in enumerate(data):
if flg is False and d != 0:
count += 1
flg = True
if d == 0:
flg = False
return count
def input_list():
return list(map(int, input().split()))
def... | import sys
input = sys.stdin.readline
import math
# 持っているビスケットを叩き、1枚増やす
# ビスケット A枚を 1円に交換する
# 1円をビスケット B枚に交換する
def main():
s = str(eval(input())).strip()
n = len(s)
cnt = 0
ans = [0] * n
for i, moji in enumerate(s):
if moji == "R":
cnt += 1
continue
else:
... | false | 34.939759 | [
"-def count_section_by_zero(data):",
"- count = 0",
"- flg = False",
"- start = 0",
"- for i, d in enumerate(data):",
"- if flg is False and d != 0:",
"- count += 1",
"- flg = True",
"- if d == 0:",
"- flg = False",
"- return count",
... | false | 0.104555 | 0.060637 | 1.724285 | [
"s622220082",
"s956703924"
] |
u393253137 | p03578 | python | s725730550 | s152714845 | 400 | 300 | 57,184 | 59,492 | Accepted | Accepted | 25 | from collections import Counter
def main():
n = int(eval(input()))
D = sorted(map(int, input().split()))
m = int(eval(input()))
T = sorted(map(int, input().split()))
CD = Counter(D)
CT = list(Counter(T).items())
for i, c in CT:
if CD[i] < c:
print('NO')
... | from collections import Counter
def main():
n = int(eval(input()))
D = list(map(int, input().split()))
m = int(eval(input()))
T = list(map(int, input().split()))
C = Counter(D)
for t in T:
if t not in C or C[t] == 0:
print('NO')
return
else:
... | 14 | 15 | 339 | 341 | from collections import Counter
def main():
n = int(eval(input()))
D = sorted(map(int, input().split()))
m = int(eval(input()))
T = sorted(map(int, input().split()))
CD = Counter(D)
CT = list(Counter(T).items())
for i, c in CT:
if CD[i] < c:
print("NO")
retu... | from collections import Counter
def main():
n = int(eval(input()))
D = list(map(int, input().split()))
m = int(eval(input()))
T = list(map(int, input().split()))
C = Counter(D)
for t in T:
if t not in C or C[t] == 0:
print("NO")
return
else:
... | false | 6.666667 | [
"- D = sorted(map(int, input().split()))",
"+ D = list(map(int, input().split()))",
"- T = sorted(map(int, input().split()))",
"- CD = Counter(D)",
"- CT = list(Counter(T).items())",
"- for i, c in CT:",
"- if CD[i] < c:",
"+ T = list(map(int, input().split()))",
"+ C ... | false | 0.04651 | 0.065853 | 0.706262 | [
"s725730550",
"s152714845"
] |
u083960235 | p03575 | python | s311452208 | s346505869 | 64 | 53 | 5,204 | 3,956 | Accepted | Accepted | 17.19 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | 54 | 58 | 1,525 | 1,535 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | false | 6.896552 | [
"-from fractions import gcd",
"-N, M = MAP()",
"-L = [LIST() for i in range(M)]",
"+N, M = MAP()",
"+L = [LIST() for i in range(M)]",
"-for a, b in L:",
"+for i in range(M):",
"+ a, b = L[i]",
"- d = dijkstra(E, a - 1)",
"- if d[b - 1] == INF:",
"+ dist = dijkstra(E, 0)",
"+ if ... | false | 0.044111 | 0.042512 | 1.037614 | [
"s311452208",
"s346505869"
] |
u044220565 | p02586 | python | s619136977 | s751859445 | 1,753 | 1,562 | 501,808 | 470,712 | Accepted | Accepted | 10.9 | # coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
#from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10**7)
#import math
#from itertools import product, accumulate, combinations, product
imp... | # coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
#from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10**7)
#import math
#from itertools import product, accumulate, combinations, product
#im... | 70 | 51 | 1,984 | 1,384 | # coding: utf-8
import sys
# from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
# from heapq import heappop, heappush
# from collections import defaultdict
sys.setrecursionlimit(10**7)
# import math
# from itertools import product, accumulate, combinations, product
import ... | # coding: utf-8
import sys
# from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
# from heapq import heappop, heappush
# from collections import defaultdict
sys.setrecursionlimit(10**7)
# import math
# from itertools import product, accumulate, combinations, product
# impor... | false | 27.142857 | [
"-import bisect",
"+# import bisect",
"-def run_dp(MAP, dp, Rs, Cs):",
"- for i in range(1, len(Rs) + 1):",
"- for j in range(1, len(Cs) + 1):",
"+def run_dp(MAP, dp, R, C):",
"+ for i in range(1, R + 1):",
"+ for j in range(1, C + 1):",
"- return dp[len(Rs), len(Cs)].max()",
... | false | 0.287119 | 0.262714 | 1.092897 | [
"s619136977",
"s751859445"
] |
u729133443 | p03079 | python | s438032179 | s718172529 | 181 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.61 | print(('YNeos'[len(set(input().split()))>1::2])) | a,b,c=input().split();print(('YNeos'[b!=c::2])) | 1 | 1 | 46 | 45 | print(("YNeos"[len(set(input().split())) > 1 :: 2]))
| a, b, c = input().split()
print(("YNeos"[b != c :: 2]))
| false | 0 | [
"-print((\"YNeos\"[len(set(input().split())) > 1 :: 2]))",
"+a, b, c = input().split()",
"+print((\"YNeos\"[b != c :: 2]))"
] | false | 0.169719 | 0.081267 | 2.088408 | [
"s438032179",
"s718172529"
] |
u084320347 | p03835 | python | s469261636 | s777009538 | 1,486 | 1,221 | 2,940 | 2,940 | Accepted | Accepted | 17.83 | k,s = list(map(int,input().split()))
ans = 0
for i in range(0,k+1):
for j in range(0,k+1):
z = s-i-j
if 0<=z<=k:
ans+=1
print(ans) | k,s = list(map(int,input().split()))
cnt = 0
for i in range(k+1):
for j in range(k+1):
if 0<=s-i-j <=k:
cnt+=1
print(cnt)
| 9 | 9 | 165 | 156 | k, s = list(map(int, input().split()))
ans = 0
for i in range(0, k + 1):
for j in range(0, k + 1):
z = s - i - j
if 0 <= z <= k:
ans += 1
print(ans)
| k, s = list(map(int, input().split()))
cnt = 0
for i in range(k + 1):
for j in range(k + 1):
if 0 <= s - i - j <= k:
cnt += 1
print(cnt)
| false | 0 | [
"-ans = 0",
"-for i in range(0, k + 1):",
"- for j in range(0, k + 1):",
"- z = s - i - j",
"- if 0 <= z <= k:",
"- ans += 1",
"-print(ans)",
"+cnt = 0",
"+for i in range(k + 1):",
"+ for j in range(k + 1):",
"+ if 0 <= s - i - j <= k:",
"+ cnt ... | false | 0.036983 | 0.036201 | 1.021592 | [
"s469261636",
"s777009538"
] |
u606878291 | p03160 | python | s186284468 | s274704520 | 155 | 135 | 13,924 | 14,184 | Accepted | Accepted | 12.9 | INF = 1 << 64
def calc_cost(height1, height2):
return abs(height1 - height2)
def main(n, heights):
heights.append(INF)
heights.append(INF)
costs = [INF for i in range(n + 2)]
costs[0] = 0
for i in range(n):
costs[i + 1] = min(costs[i + 1], calc_cost(heights[i], heights[i... | N = int(eval(input()))
heights = tuple(map(int, input().split(' ')))
dp = [0] * (N + 1)
dp[1] = 0
dp[2] = abs(heights[0] - heights[1])
for hi, i in enumerate(list(range(3, N + 1)), start=2):
dp[i] = min(
dp[i - 1] + abs(heights[hi] - heights[hi - 1]),
dp[i - 2] + abs(heights[hi] - he... | 22 | 16 | 574 | 347 | INF = 1 << 64
def calc_cost(height1, height2):
return abs(height1 - height2)
def main(n, heights):
heights.append(INF)
heights.append(INF)
costs = [INF for i in range(n + 2)]
costs[0] = 0
for i in range(n):
costs[i + 1] = min(
costs[i + 1], calc_cost(heights[i], heights[i... | N = int(eval(input()))
heights = tuple(map(int, input().split(" ")))
dp = [0] * (N + 1)
dp[1] = 0
dp[2] = abs(heights[0] - heights[1])
for hi, i in enumerate(list(range(3, N + 1)), start=2):
dp[i] = min(
dp[i - 1] + abs(heights[hi] - heights[hi - 1]),
dp[i - 2] + abs(heights[hi] - heights[hi - 2]),
... | false | 27.272727 | [
"-INF = 1 << 64",
"-",
"-",
"-def calc_cost(height1, height2):",
"- return abs(height1 - height2)",
"-",
"-",
"-def main(n, heights):",
"- heights.append(INF)",
"- heights.append(INF)",
"- costs = [INF for i in range(n + 2)]",
"- costs[0] = 0",
"- for i in range(n):",
"- ... | false | 0.065056 | 0.061345 | 1.060506 | [
"s186284468",
"s274704520"
] |
u111365362 | p02901 | python | s452678014 | s281918346 | 369 | 303 | 45,672 | 47,576 | Accepted | Accepted | 17.89 | n,m = list(map(int,input().split()))
tr = [ 10 ** 18 for _ in range(2**n) ]
tr[0] = 0
key = []
for _ in range(m):
cost,b = list(map(int,input().split()))
raw = list(map(int,input().split()))
get = 0
for i in range(b):
get += 2 ** (raw[i]-1)
key.append([get,cost])
#print(key)
key.sort()
#print... | n,m = list(map(int,input().split()))
inf = 10 ** 18
cost = [inf for _ in range(2**n)]
cost[0] = 0
for _ in range(m):
a,b = list(map(int,input().split()))
c = list(map(int,input().split()))
key = 0
for i in range(b):
key += 2 ** (c[i]-1)
#print(key)
for t in range(2**n):
cost[t|key] = min... | 25 | 19 | 566 | 410 | n, m = list(map(int, input().split()))
tr = [10**18 for _ in range(2**n)]
tr[0] = 0
key = []
for _ in range(m):
cost, b = list(map(int, input().split()))
raw = list(map(int, input().split()))
get = 0
for i in range(b):
get += 2 ** (raw[i] - 1)
key.append([get, cost])
# print(key)
key.sort()
... | n, m = list(map(int, input().split()))
inf = 10**18
cost = [inf for _ in range(2**n)]
cost[0] = 0
for _ in range(m):
a, b = list(map(int, input().split()))
c = list(map(int, input().split()))
key = 0
for i in range(b):
key += 2 ** (c[i] - 1)
# print(key)
for t in range(2**n):
cos... | false | 24 | [
"-tr = [10**18 for _ in range(2**n)]",
"-tr[0] = 0",
"-key = []",
"+inf = 10**18",
"+cost = [inf for _ in range(2**n)]",
"+cost[0] = 0",
"- cost, b = list(map(int, input().split()))",
"- raw = list(map(int, input().split()))",
"- get = 0",
"+ a, b = list(map(int, input().split()))",
... | false | 0.039376 | 0.040234 | 0.97867 | [
"s452678014",
"s281918346"
] |
u796942881 | p03147 | python | s760512870 | s841784491 | 20 | 17 | 3,060 | 2,940 | Accepted | Accepted | 15 | N = int(eval(input()))
h = [int(i) for i in input().split()]
ans = 0
while max(h):
mx = max(h)
on = False
for i in range(N):
if h[i] == mx:
h[i] -= 1
if not on:
ans += 1
on = True
else:
on = False
print(ans... | def main():
N, *h = list(map(int, open(0).read().split()))
ans = h[0]
for i in range(N - 1):
ans += max(h[i + 1] - h[i], 0)
print(ans)
return
main()
| 19 | 10 | 316 | 182 | N = int(eval(input()))
h = [int(i) for i in input().split()]
ans = 0
while max(h):
mx = max(h)
on = False
for i in range(N):
if h[i] == mx:
h[i] -= 1
if not on:
ans += 1
on = True
else:
on = False
print(ans)
| def main():
N, *h = list(map(int, open(0).read().split()))
ans = h[0]
for i in range(N - 1):
ans += max(h[i + 1] - h[i], 0)
print(ans)
return
main()
| false | 47.368421 | [
"-N = int(eval(input()))",
"-h = [int(i) for i in input().split()]",
"-ans = 0",
"-while max(h):",
"- mx = max(h)",
"- on = False",
"- for i in range(N):",
"- if h[i] == mx:",
"- h[i] -= 1",
"- if not on:",
"- ans += 1",
"- on = T... | false | 0.04537 | 0.119274 | 0.380385 | [
"s760512870",
"s841784491"
] |
u645250356 | p03640 | python | s323014608 | s207372087 | 240 | 45 | 45,412 | 5,592 | Accepted | Accepted | 81.25 | from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
de... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(m... | 28 | 29 | 794 | 785 | from collections import Counter, defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.readline().split()))
def inpl_str():
return list(sys.stdin.... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
... | false | 3.448276 | [
"-import sys, heapq, bisect, math, itertools, string, queue",
"+from heapq import heappop, heappush, heapify",
"+from bisect import bisect_left, bisect_right",
"+import sys, math, itertools, fractions, pprint",
"+INF = float(\"inf\")",
"-def inpl_str():",
"- return list(sys.stdin.readline().split())"... | false | 0.038733 | 0.037797 | 1.024755 | [
"s323014608",
"s207372087"
] |
u227082700 | p03291 | python | s701736045 | s121770439 | 426 | 317 | 27,556 | 32,012 | Accepted | Accepted | 25.59 | s=eval(input())
l=len(s)
dp=[4*[0]for _ in range(l+1)]
dp[0][0]=1
for i in range(1,l+1):
si=s[i-1]
for j in range(4):dp[i][j]=dp[i-1][j]*((si=="?")*2+1)
if si=="A":dp[i][1]+=dp[i-1][0]
if si=="B":dp[i][2]+=dp[i-1][1]
if si=="C":dp[i][3]+=dp[i-1][2]
if si=="?":
dp[i][1]+=dp[i-1][0]
dp[i][... | mod=10**9+7
s=eval(input())
n=len(s)
dp=[[0]*4 for _ in range(n+1)]
dp[0][0]=1
for i in range(1,n+1):
dp[i][0]=dp[i-1][0]*((s[i-1]=="?")*2+1)
dp[i][1]=dp[i-1][1]*((s[i-1]=="?")*2+1)
dp[i][2]=dp[i-1][2]*((s[i-1]=="?")*2+1)
dp[i][3]=dp[i-1][3]*((s[i-1]=="?")*2+1)
if s[i-1]=="A" or s[i-1]=="?... | 16 | 21 | 412 | 571 | s = eval(input())
l = len(s)
dp = [4 * [0] for _ in range(l + 1)]
dp[0][0] = 1
for i in range(1, l + 1):
si = s[i - 1]
for j in range(4):
dp[i][j] = dp[i - 1][j] * ((si == "?") * 2 + 1)
if si == "A":
dp[i][1] += dp[i - 1][0]
if si == "B":
dp[i][2] += dp[i - 1][1]
if si == "C"... | mod = 10**9 + 7
s = eval(input())
n = len(s)
dp = [[0] * 4 for _ in range(n + 1)]
dp[0][0] = 1
for i in range(1, n + 1):
dp[i][0] = dp[i - 1][0] * ((s[i - 1] == "?") * 2 + 1)
dp[i][1] = dp[i - 1][1] * ((s[i - 1] == "?") * 2 + 1)
dp[i][2] = dp[i - 1][2] * ((s[i - 1] == "?") * 2 + 1)
dp[i][3] = dp[i - 1][... | false | 23.809524 | [
"+mod = 10**9 + 7",
"-l = len(s)",
"-dp = [4 * [0] for _ in range(l + 1)]",
"+n = len(s)",
"+dp = [[0] * 4 for _ in range(n + 1)]",
"-for i in range(1, l + 1):",
"- si = s[i - 1]",
"- for j in range(4):",
"- dp[i][j] = dp[i - 1][j] * ((si == \"?\") * 2 + 1)",
"- if si == \"A\":",
... | false | 0.041515 | 0.04166 | 0.996519 | [
"s701736045",
"s121770439"
] |
u355726239 | p00424 | python | s129218292 | s552085775 | 390 | 340 | 7,172 | 7,168 | Accepted | Accepted | 12.82 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
while True:
dic = {}
n = int(eval(input()))
if n == 0:
break
for i in range(n):
key, value = input().split()
dic[key] = value
ret = ''
m = int(eval(input()))
for i in range(m):
s = input().spli... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
while True:
dic = {}
n = int(eval(input()))
if n == 0:
break
for i in range(n):
key, value = input().split()
dic[key] = value
ret = ''
m = int(eval(input()))
for i in range(m):
s = input().stri... | 21 | 21 | 362 | 359 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
while True:
dic = {}
n = int(eval(input()))
if n == 0:
break
for i in range(n):
key, value = input().split()
dic[key] = value
ret = ""
m = int(eval(input()))
for i in range(m):
s = input().split()[0]
ret +=... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
while True:
dic = {}
n = int(eval(input()))
if n == 0:
break
for i in range(n):
key, value = input().split()
dic[key] = value
ret = ""
m = int(eval(input()))
for i in range(m):
s = input().strip()
ret += di... | false | 0 | [
"- s = input().split()[0]",
"+ s = input().strip()"
] | false | 0.044393 | 0.043308 | 1.025054 | [
"s129218292",
"s552085775"
] |
u970899068 | p03290 | python | s731152251 | s197153549 | 139 | 25 | 3,064 | 3,064 | Accepted | Accepted | 82.01 | d,g=list(map(int, input().split()))
p=[list(map(int, input().split())) for i in range(d)]
x=[]
for i in range(2**d):
t=0
u=0
v=[]
for k in range(d):
v.append(k)
for j in range(d):
if ((i>>j)&1):
t+=p[j][0]*100*(j+1)+p[j][1]
u+=p[j][0]
... | d,g= list(map(int, input().split()))
x = [list(map(int, input().split())) for i in range(d)]
ans2=float('inf')
for i in range(2**d):
v=[0]*d
ans=0
ans1=0
for j in range(d):
if (i>>j)&1==1:
ans+=(x[j][0]*100*(j+1))+x[j][1]
ans1+=x[j][0]
v[j]=1
... | 21 | 27 | 517 | 635 | d, g = list(map(int, input().split()))
p = [list(map(int, input().split())) for i in range(d)]
x = []
for i in range(2**d):
t = 0
u = 0
v = []
for k in range(d):
v.append(k)
for j in range(d):
if (i >> j) & 1:
t += p[j][0] * 100 * (j + 1) + p[j][1]
u += p[j][0... | d, g = list(map(int, input().split()))
x = [list(map(int, input().split())) for i in range(d)]
ans2 = float("inf")
for i in range(2**d):
v = [0] * d
ans = 0
ans1 = 0
for j in range(d):
if (i >> j) & 1 == 1:
ans += (x[j][0] * 100 * (j + 1)) + x[j][1]
ans1 += x[j][0]
... | false | 22.222222 | [
"-p = [list(map(int, input().split())) for i in range(d)]",
"-x = []",
"+x = [list(map(int, input().split())) for i in range(d)]",
"+ans2 = float(\"inf\")",
"- t = 0",
"- u = 0",
"- v = []",
"- for k in range(d):",
"- v.append(k)",
"+ v = [0] * d",
"+ ans = 0",
"+ a... | false | 0.039405 | 0.038723 | 1.017599 | [
"s731152251",
"s197153549"
] |
u562935282 | p03634 | python | s770179373 | s143869460 | 1,273 | 731 | 165,188 | 163,764 | Accepted | Accepted | 42.58 | # bellman_ford : O(V E)
# dijkstra : O(E log V), 負辺は無理
# warshall_floyd : O(V**3)
from collections import namedtuple
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
def solve():
inf = 10 ** 14 + 10
Edge = namedtuple('Edge', 'cost to')
def dfs(v: 'vertex_index, 0-in... | # bellman_ford : O(V E)
# dijkstra : O(E log V), 負辺は無理
# warshall_floyd : O(V**3)
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
def solve():
inf = 10 ** 14 + 10
def dfs(v: 'vertex_index, 0-indexed') -> None:
for c, t in e[v]:
if d[t] != inf:
... | 49 | 46 | 1,003 | 883 | # bellman_ford : O(V E)
# dijkstra : O(E log V), 負辺は無理
# warshall_floyd : O(V**3)
from collections import namedtuple
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
def solve():
inf = 10**14 + 10
Edge = namedtuple("Edge", "cost to")
def dfs(v: "vertex_index, 0-indexed") -> None:
... | # bellman_ford : O(V E)
# dijkstra : O(E log V), 負辺は無理
# warshall_floyd : O(V**3)
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
def solve():
inf = 10**14 + 10
def dfs(v: "vertex_index, 0-indexed") -> None:
for c, t in e[v]:
if d[t] != inf:
continue
... | false | 6.122449 | [
"-from collections import namedtuple",
"- Edge = namedtuple(\"Edge\", \"cost to\")",
"- for e_ in e[v]:",
"- if d[e_.to] != inf:",
"+ for c, t in e[v]:",
"+ if d[t] != inf:",
"- d[e_.to] = d[v] + e_.cost",
"- dfs(e_.to)",
"+ d[t... | false | 0.044032 | 0.03973 | 1.108274 | [
"s770179373",
"s143869460"
] |
u343977188 | p03371 | python | s373793819 | s523693167 | 30 | 26 | 9,160 | 9,164 | Accepted | Accepted | 13.33 | a,b,c,x,y=list(map(int,input().split()))
k=min(x,y)
ans=0
if 2*c < a+b:
ans+=2*c*k
d=x-y
if d>=0:
ans+=min(a*d,2*c*d)
else:
ans+=min(b*(-d),2*c*(-d))
else:
ans+=min(a*x,2*c*x)+min(b*y,2*c*y)
print(ans) | a,b,c,x,y=list(map(int,input().split()))
k=min(x,y)
ans=0
AB = 2*c
if 2*c < a+b:
ans+=AB*k
d=x-y
if d>=0:
ans+=min(a*d,AB*d)
else:
ans+=min(b*(-d),AB*(-d))
else:
ans+=min(a*x,AB*x)+min(b*y,AB*y)
print(ans) | 14 | 15 | 227 | 232 | a, b, c, x, y = list(map(int, input().split()))
k = min(x, y)
ans = 0
if 2 * c < a + b:
ans += 2 * c * k
d = x - y
if d >= 0:
ans += min(a * d, 2 * c * d)
else:
ans += min(b * (-d), 2 * c * (-d))
else:
ans += min(a * x, 2 * c * x) + min(b * y, 2 * c * y)
print(ans)
| a, b, c, x, y = list(map(int, input().split()))
k = min(x, y)
ans = 0
AB = 2 * c
if 2 * c < a + b:
ans += AB * k
d = x - y
if d >= 0:
ans += min(a * d, AB * d)
else:
ans += min(b * (-d), AB * (-d))
else:
ans += min(a * x, AB * x) + min(b * y, AB * y)
print(ans)
| false | 6.666667 | [
"+AB = 2 * c",
"- ans += 2 * c * k",
"+ ans += AB * k",
"- ans += min(a * d, 2 * c * d)",
"+ ans += min(a * d, AB * d)",
"- ans += min(b * (-d), 2 * c * (-d))",
"+ ans += min(b * (-d), AB * (-d))",
"- ans += min(a * x, 2 * c * x) + min(b * y, 2 * c * y)",
"+ a... | false | 0.04396 | 0.124964 | 0.351782 | [
"s373793819",
"s523693167"
] |
u761529120 | p03108 | python | s171621628 | s766479546 | 1,097 | 414 | 98,392 | 97,372 | Accepted | Accepted | 62.26 | class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
... | class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
... | 55 | 73 | 1,307 | 1,790 | class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = se... | class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = se... | false | 24.657534 | [
"+ def size(self, x):",
"+ return -self.parents[self.find(x)]",
"+",
"- def size(self, x):",
"- return -self.parents[self.find(x)]",
"+ def members(self, x):",
"+ root = self.find(x)",
"+ return [i for i in range(self.n) if self.find(i) == root]",
"+",
"+ de... | false | 0.043977 | 0.038514 | 1.141858 | [
"s171621628",
"s766479546"
] |
u054556734 | p03775 | python | s069280540 | s830026366 | 36 | 32 | 3,060 | 3,060 | Accepted | Accepted | 11.11 | import math
n = int(eval(input()))
nn = int(math.sqrt(n))
while n%nn != 0: nn-=1
ans = len(str(n//nn))
print(ans) | import math
n = int(eval(input()))
a = int(math.sqrt(n))
while n%a != 0: a-=1
print((len(str(n//a)))) | 6 | 5 | 112 | 97 | import math
n = int(eval(input()))
nn = int(math.sqrt(n))
while n % nn != 0:
nn -= 1
ans = len(str(n // nn))
print(ans)
| import math
n = int(eval(input()))
a = int(math.sqrt(n))
while n % a != 0:
a -= 1
print((len(str(n // a))))
| false | 16.666667 | [
"-nn = int(math.sqrt(n))",
"-while n % nn != 0:",
"- nn -= 1",
"-ans = len(str(n // nn))",
"-print(ans)",
"+a = int(math.sqrt(n))",
"+while n % a != 0:",
"+ a -= 1",
"+print((len(str(n // a))))"
] | false | 0.046532 | 0.093134 | 0.499623 | [
"s069280540",
"s830026366"
] |
u203843959 | p02852 | python | s035858550 | s132831695 | 582 | 536 | 88,668 | 83,420 | Accepted | Accepted | 7.9 | import sys
N,M=list(map(int,input().split()))
slist=list(map(int,eval(input())))
seq=0
for s in slist:
if s==0:
seq=0
else:
seq+=1
if seq==M:
print((-1))
sys.exit(0)
#####segfunc#####
def segfunc(x,y):
return min(x,y)
#####ide_ele#####
ide_ele=float("inf")
class Se... | import sys
N,M=list(map(int,input().split()))
slist=list(map(int,eval(input())))
seq=0
for s in slist:
if s==0:
seq=0
else:
seq+=1
if seq==M:
print((-1))
sys.exit(0)
class SegTree:
#init(init_val, ide_ele): 配列init_valで初期化 O(N)
def __init__(self, init_val, segfunc, ide_e... | 104 | 93 | 2,161 | 2,096 | import sys
N, M = list(map(int, input().split()))
slist = list(map(int, eval(input())))
seq = 0
for s in slist:
if s == 0:
seq = 0
else:
seq += 1
if seq == M:
print((-1))
sys.exit(0)
#####segfunc#####
def segfunc(x, y):
return min(x, y)
#####ide_ele#####
id... | import sys
N, M = list(map(int, input().split()))
slist = list(map(int, eval(input())))
seq = 0
for s in slist:
if s == 0:
seq = 0
else:
seq += 1
if seq == M:
print((-1))
sys.exit(0)
class SegTree:
# init(init_val, ide_ele): 配列init_valで初期化 O(N)
def __in... | false | 10.576923 | [
"-#####segfunc#####",
"-def segfunc(x, y):",
"- return min(x, y)",
"-",
"-",
"-#####ide_ele#####",
"-ide_ele = float(\"inf\")",
"- \"\"\"",
"- init(init_val, ide_ele): 配列init_valで初期化 O(N)",
"- update(k, x): k番目の値をxに更新 O(logN)",
"- query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN)",
"... | false | 0.07762 | 0.118721 | 0.653804 | [
"s035858550",
"s132831695"
] |
u455505352 | p03855 | python | s754801422 | s196802933 | 1,980 | 1,772 | 79,404 | 82,472 | Accepted | Accepted | 10.51 | class UnionFind:
"""Union-Find,
http://www.slideshare.net/chokudai/union-find-49066733"""
def __init__(self, N):
self.par = [i for i in range(N)]
def root(self, x):
if(self.par[x]==x):
return x
else:
self.par[x] = self.root(self.par[x])
return self.par[x]
def same(self, x, y):
r... | class UnionFind:
"""Union-Find,
http://www.slideshare.net/chokudai/union-find-49066733"""
def __init__(self, N):
self.par = [i for i in range(N)]
self.rank = [0 for i in range(N)]
def root(self, x):
if(self.par[x]==x):
return x
else:
self.par[x] = self.root(self.par[x])
return self.... | 67 | 73 | 1,396 | 1,563 | class UnionFind:
"""Union-Find,
http://www.slideshare.net/chokudai/union-find-49066733"""
def __init__(self, N):
self.par = [i for i in range(N)]
def root(self, x):
if self.par[x] == x:
return x
else:
self.par[x] = self.root(self.par[x])
retu... | class UnionFind:
"""Union-Find,
http://www.slideshare.net/chokudai/union-find-49066733"""
def __init__(self, N):
self.par = [i for i in range(N)]
self.rank = [0 for i in range(N)]
def root(self, x):
if self.par[x] == x:
return x
else:
self.par[x]... | false | 8.219178 | [
"+ self.rank = [0 for i in range(N)]",
"- # if x==y:",
"- # \treturn",
"- self.par[x] = y",
"+ if x == y:",
"+ return",
"+ if self.rank[x] < self.rank[y]:",
"+ self.par[x] = y",
"+ else:",
"+ self.par[y] = x",
"+ ... | false | 0.052045 | 0.089437 | 0.581919 | [
"s754801422",
"s196802933"
] |
u514401521 | p02629 | python | s110061778 | s158150028 | 82 | 72 | 61,624 | 61,756 | Accepted | Accepted | 12.2 | N = int(eval(input()))
ans = ""
while N > 0:
N -= 1
ans += chr(ord("a") + N % 26)
N //= 26
print((ans[::-1])) | N = int(eval(input()))
s = ""
while N != 0:
N -= 1
r = N % 26
s += chr(ord('a') + r)
N //= 26
print((s[::-1])) | 9 | 9 | 123 | 127 | N = int(eval(input()))
ans = ""
while N > 0:
N -= 1
ans += chr(ord("a") + N % 26)
N //= 26
print((ans[::-1]))
| N = int(eval(input()))
s = ""
while N != 0:
N -= 1
r = N % 26
s += chr(ord("a") + r)
N //= 26
print((s[::-1]))
| false | 0 | [
"-ans = \"\"",
"-while N > 0:",
"+s = \"\"",
"+while N != 0:",
"- ans += chr(ord(\"a\") + N % 26)",
"+ r = N % 26",
"+ s += chr(ord(\"a\") + r)",
"-print((ans[::-1]))",
"+print((s[::-1]))"
] | false | 0.037597 | 0.086697 | 0.43366 | [
"s110061778",
"s158150028"
] |
u285443936 | p02936 | python | s532269132 | s091618554 | 1,284 | 1,100 | 58,836 | 73,104 | Accepted | Accepted | 14.33 | from collections import deque
import sys
input = sys.stdin.readline
N, Q = list(map(int, input().split()))
table = [[] for i in range(N)]
for i in range(N-1):
a,b = list(map(int, input().split()))
a -= 1
b -= 1
table[a].append(b)
table[b].append(a)
task = [0]*N
point = [-1]*N
point[0] = 0
for ... | from collections import deque
import sys
input = sys.stdin.readline
N, Q = list(map(int, input().split()))
table = [[] for i in range(N)]
for i in range(N-1):
a,b = list(map(int, input().split()))
a -= 1
b -= 1
table[a].append(b)
table[b].append(a)
task = [0]*N
point = [-1]*N
point[0] = 0
for ... | 32 | 31 | 601 | 596 | from collections import deque
import sys
input = sys.stdin.readline
N, Q = list(map(int, input().split()))
table = [[] for i in range(N)]
for i in range(N - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
table[a].append(b)
table[b].append(a)
task = [0] * N
point = [-1] * N
point[0] = 0
fo... | from collections import deque
import sys
input = sys.stdin.readline
N, Q = list(map(int, input().split()))
table = [[] for i in range(N)]
for i in range(N - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
table[a].append(b)
table[b].append(a)
task = [0] * N
point = [-1] * N
point[0] = 0
fo... | false | 3.125 | [
"-for i in range(N):",
"- print((point[i]))",
"+print((\" \".join(map(str, point))))"
] | false | 0.082294 | 0.049187 | 1.673087 | [
"s532269132",
"s091618554"
] |
u955248595 | p04013 | python | s849748187 | s507929733 | 175 | 74 | 135,652 | 69,552 | Accepted | Accepted | 57.71 | N,A = (int(T) for T in input().split())
X = [int(T) for T in input().split()]
DP = [[[0]*(N+1) for TS in range(0,50*N+1)] for TI in range(0,N+1)]
DP[0][0][0] = 1
for TI in range(0,N):
for TS in range(0,50*N+1):
for TK in range(0,N+1):
if DP[TI][TS][TK]!=0:
DP[TI+1][TS][TK... | N,A = (int(T) for T in input().split())
X = [int(T)-A for T in input().split()]
DP = [[0]*(2*(50*N)+1) for TI in range(0,N+1)]
DP[0][50*N] = 1
for TI in range(0,N):
for TS in range(0,2*50*N+1):
if DP[TI][TS]!=0:
DP[TI+1][TS] += DP[TI][TS]
DP[TI+1][TS+X[TI]] += DP[TI][TS]
pri... | 11 | 10 | 451 | 337 | N, A = (int(T) for T in input().split())
X = [int(T) for T in input().split()]
DP = [[[0] * (N + 1) for TS in range(0, 50 * N + 1)] for TI in range(0, N + 1)]
DP[0][0][0] = 1
for TI in range(0, N):
for TS in range(0, 50 * N + 1):
for TK in range(0, N + 1):
if DP[TI][TS][TK] != 0:
... | N, A = (int(T) for T in input().split())
X = [int(T) - A for T in input().split()]
DP = [[0] * (2 * (50 * N) + 1) for TI in range(0, N + 1)]
DP[0][50 * N] = 1
for TI in range(0, N):
for TS in range(0, 2 * 50 * N + 1):
if DP[TI][TS] != 0:
DP[TI + 1][TS] += DP[TI][TS]
DP[TI + 1][TS + X... | false | 9.090909 | [
"-X = [int(T) for T in input().split()]",
"-DP = [[[0] * (N + 1) for TS in range(0, 50 * N + 1)] for TI in range(0, N + 1)]",
"-DP[0][0][0] = 1",
"+X = [int(T) - A for T in input().split()]",
"+DP = [[0] * (2 * (50 * N) + 1) for TI in range(0, N + 1)]",
"+DP[0][50 * N] = 1",
"- for TS in range(0, 50 ... | false | 0.040415 | 0.036582 | 1.104778 | [
"s849748187",
"s507929733"
] |
u734876600 | p03478 | python | s204919338 | s170407775 | 37 | 34 | 3,060 | 3,060 | Accepted | Accepted | 8.11 | n,a,b = list(map(int,input().split()))
ans = 0
i = 1
while i <= n:
x = 0
li = list(str(i))
for p in li:
x += int(p)
if a <= x <= b:
ans += i
i += 1
else:
i += 1
print(ans) | n,a,b = list(map(int,input().split()))
ans = 0
i = 1
for i in range(1,n+1):
x = 0
num = str(i)
for p in num:
x += int(p)
if a <= x <= b:
ans += i
i += 1
print(ans) | 14 | 12 | 230 | 208 | n, a, b = list(map(int, input().split()))
ans = 0
i = 1
while i <= n:
x = 0
li = list(str(i))
for p in li:
x += int(p)
if a <= x <= b:
ans += i
i += 1
else:
i += 1
print(ans)
| n, a, b = list(map(int, input().split()))
ans = 0
i = 1
for i in range(1, n + 1):
x = 0
num = str(i)
for p in num:
x += int(p)
if a <= x <= b:
ans += i
i += 1
print(ans)
| false | 14.285714 | [
"-while i <= n:",
"+for i in range(1, n + 1):",
"- li = list(str(i))",
"- for p in li:",
"+ num = str(i)",
"+ for p in num:",
"- else:",
"- i += 1"
] | false | 0.046918 | 0.114138 | 0.411061 | [
"s204919338",
"s170407775"
] |
u352394527 | p00464 | python | s575736208 | s411804089 | 1,760 | 1,180 | 30,308 | 30,336 | Accepted | Accepted | 32.95 | while True:
h,w,n = list(map(int,input().split()))
if not h: break
sss = [[1 if s == "1" else 0 for s in input().split()] for i in range(h)]
dp = [[0 for i in range(w + 1)] for j in range(h + 1)]
dp[0][0] = n - 1
for x in range(h):
for y in range(w):
a = dp[x][y]
if sss[x][y]:
... | def solve():
while True:
h,w,n = list(map(int,input().split()))
if not h: break
sss = [[1 if s == "1" else 0 for s in input().split()] for i in range(h)]
dp = [[0 for i in range(w + 1)] for j in range(h + 1)]
dp[0][0] = n - 1
for x in range(h):
for y in range(w):
a = dp[... | 35 | 37 | 868 | 974 | while True:
h, w, n = list(map(int, input().split()))
if not h:
break
sss = [[1 if s == "1" else 0 for s in input().split()] for i in range(h)]
dp = [[0 for i in range(w + 1)] for j in range(h + 1)]
dp[0][0] = n - 1
for x in range(h):
for y in range(w):
a = dp[x][y]
... | def solve():
while True:
h, w, n = list(map(int, input().split()))
if not h:
break
sss = [[1 if s == "1" else 0 for s in input().split()] for i in range(h)]
dp = [[0 for i in range(w + 1)] for j in range(h + 1)]
dp[0][0] = n - 1
for x in range(h):
... | false | 5.405405 | [
"-while True:",
"- h, w, n = list(map(int, input().split()))",
"- if not h:",
"- break",
"- sss = [[1 if s == \"1\" else 0 for s in input().split()] for i in range(h)]",
"- dp = [[0 for i in range(w + 1)] for j in range(h + 1)]",
"- dp[0][0] = n - 1",
"- for x in range(h):",
... | false | 0.034922 | 0.046355 | 0.753364 | [
"s575736208",
"s411804089"
] |
u941753895 | p03165 | python | s827567772 | s955309512 | 602 | 507 | 125,784 | 136,280 | Accepted | Accepted | 15.78 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
de... | import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for... | 49 | 52 | 1,108 | 1,133 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI():
return [int(x) ... | import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI():
return [int(x) for x in sys.stdin.readline().spl... | false | 5.769231 | [
"-import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy",
"+import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy",
"-def LI_():",
"- return [int(x) - 1 for x in sys.stdin.readline().split()]",
"+def LF():",
"+ retu... | false | 0.036761 | 0.037774 | 0.973172 | [
"s827567772",
"s955309512"
] |
u119148115 | p02973 | python | s985042022 | s888452737 | 227 | 128 | 77,748 | 77,456 | Accepted | Accepted | 43.61 | import sys
def I(): return int(sys.stdin.readline().rstrip())
N = I()
A = [-I() for i in range(N)]
# Aの最大非増加部分列の長さを求めればOK
from bisect import bisect,bisect_left
def LIS(l): #リストlのLISの長さを求める
dp = [float('inf')]*(len(l)+1)
dp[0] = -float('inf')
for i in range(len(l)):
j = bisect(dp... | import sys
def I(): return int(sys.stdin.readline().rstrip())
N = I()
A = [-I() for i in range(N)]
# Aの最大非増加部分列の長さを求めればOK
from bisect import bisect_left,bisect
def LNDS(l): #リストlのLNDSの長さを求める
dp = [float('inf')]*(len(l)+1)
dp[0] = -float('inf')
for i in range(len(l)):
j = bisect(... | 20 | 20 | 408 | 411 | import sys
def I():
return int(sys.stdin.readline().rstrip())
N = I()
A = [-I() for i in range(N)]
# Aの最大非増加部分列の長さを求めればOK
from bisect import bisect, bisect_left
def LIS(l): # リストlのLISの長さを求める
dp = [float("inf")] * (len(l) + 1)
dp[0] = -float("inf")
for i in range(len(l)):
j = bisect(dp, l[... | import sys
def I():
return int(sys.stdin.readline().rstrip())
N = I()
A = [-I() for i in range(N)]
# Aの最大非増加部分列の長さを求めればOK
from bisect import bisect_left, bisect
def LNDS(l): # リストlのLNDSの長さを求める
dp = [float("inf")] * (len(l) + 1)
dp[0] = -float("inf")
for i in range(len(l)):
j = bisect(dp, ... | false | 0 | [
"-from bisect import bisect, bisect_left",
"+from bisect import bisect_left, bisect",
"-def LIS(l): # リストlのLISの長さを求める",
"+def LNDS(l): # リストlのLNDSの長さを求める",
"-print((LIS(A)))",
"+print((LNDS(A)))"
] | false | 0.037602 | 0.068247 | 0.550977 | [
"s985042022",
"s888452737"
] |
u587712547 | p02396 | python | s846881705 | s911259365 | 140 | 60 | 6,216 | 5,708 | Accepted | Accepted | 57.14 | i=1
while True:
n=eval(input())
if not n:
break
print("Case %d: %d"%(i,n))
i+=1 | import sys
def resolve():
idx = 1
for num_s in sys.stdin:
num = int(num_s)
if num == 0:
break
print(("Case {}: {}".format(idx, int(num))))
idx += 1
resolve()
| 7 | 14 | 102 | 225 | i = 1
while True:
n = eval(input())
if not n:
break
print("Case %d: %d" % (i, n))
i += 1
| import sys
def resolve():
idx = 1
for num_s in sys.stdin:
num = int(num_s)
if num == 0:
break
print(("Case {}: {}".format(idx, int(num))))
idx += 1
resolve()
| false | 50 | [
"-i = 1",
"-while True:",
"- n = eval(input())",
"- if not n:",
"- break",
"- print(\"Case %d: %d\" % (i, n))",
"- i += 1",
"+import sys",
"+",
"+",
"+def resolve():",
"+ idx = 1",
"+ for num_s in sys.stdin:",
"+ num = int(num_s)",
"+ if num == 0:",... | false | 0.008121 | 0.040016 | 0.202954 | [
"s846881705",
"s911259365"
] |
u810288681 | p02742 | python | s443030349 | s485784531 | 170 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90 | h,w = list(map(int, input().split()))
print((1 if h==1 or w==1 else (h*w+1)//2)) | import math
h,w = list(map(int, input().split()))
print((1 if h==1 or w==1 else math.ceil(h*w/2) )) | 2 | 3 | 73 | 93 | h, w = list(map(int, input().split()))
print((1 if h == 1 or w == 1 else (h * w + 1) // 2))
| import math
h, w = list(map(int, input().split()))
print((1 if h == 1 or w == 1 else math.ceil(h * w / 2)))
| false | 33.333333 | [
"+import math",
"+",
"-print((1 if h == 1 or w == 1 else (h * w + 1) // 2))",
"+print((1 if h == 1 or w == 1 else math.ceil(h * w / 2)))"
] | false | 0.036742 | 0.035182 | 1.04435 | [
"s443030349",
"s485784531"
] |
u129749062 | p02627 | python | s063564046 | s451873113 | 31 | 24 | 9,016 | 9,024 | Accepted | Accepted | 22.58 | a = eval(input())
print(('A' if a.isupper() == True else 'a')) | print(('A' if input().isupper() else 'a')) | 2 | 1 | 55 | 40 | a = eval(input())
print(("A" if a.isupper() == True else "a"))
| print(("A" if input().isupper() else "a"))
| false | 50 | [
"-a = eval(input())",
"-print((\"A\" if a.isupper() == True else \"a\"))",
"+print((\"A\" if input().isupper() else \"a\"))"
] | false | 0.043997 | 0.03718 | 1.183361 | [
"s063564046",
"s451873113"
] |
u052244548 | p02714 | python | s704905253 | s890981153 | 1,957 | 1,055 | 9,492 | 9,484 | Accepted | Accepted | 46.09 | import itertools
from collections import Counter
N = int(eval(input()))
S = eval(input())
C=Counter(S)
r = C['R']
g = C['G']
b = C['B']
cnt = r * g * b
for i in range(0,N-2):
for j in range(i,N-1):
k = j + j - i
if k < N:
if S[i] != S[j] and S[i] != S[k] and S[j] !... | from collections import Counter
def SUMCHK():
N = int(eval(input()))
S = eval(input())
C=Counter(S)
r = C['R']
g = C['G']
b = C['B']
cnt = r * g * b
for i in range(0,N-2):
for j in range(i,N-1):
k = j + j - i
if k < N:
... | 22 | 24 | 356 | 421 | import itertools
from collections import Counter
N = int(eval(input()))
S = eval(input())
C = Counter(S)
r = C["R"]
g = C["G"]
b = C["B"]
cnt = r * g * b
for i in range(0, N - 2):
for j in range(i, N - 1):
k = j + j - i
if k < N:
if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
... | from collections import Counter
def SUMCHK():
N = int(eval(input()))
S = eval(input())
C = Counter(S)
r = C["R"]
g = C["G"]
b = C["B"]
cnt = r * g * b
for i in range(0, N - 2):
for j in range(i, N - 1):
k = j + j - i
if k < N:
if S[i] != ... | false | 8.333333 | [
"-import itertools",
"-N = int(eval(input()))",
"-S = eval(input())",
"-C = Counter(S)",
"-r = C[\"R\"]",
"-g = C[\"G\"]",
"-b = C[\"B\"]",
"-cnt = r * g * b",
"-for i in range(0, N - 2):",
"- for j in range(i, N - 1):",
"- k = j + j - i",
"- if k < N:",
"- if S[i... | false | 0.045889 | 0.03907 | 1.174535 | [
"s704905253",
"s890981153"
] |
u796942881 | p02947 | python | s319223539 | s793452647 | 228 | 171 | 26,752 | 21,000 | Accepted | Accepted | 25 | from collections import defaultdict
def main():
s = ["".join(sorted(x)) for x in open(0).read().split()[1:]]
d = defaultdict(lambda: 0)
ans = 0
for i in s:
ans += d[i]
d[i] += 1
print(ans)
return
main()
| def main():
s = ["".join(sorted(i)) for i in open(0).read().split()[1:]]
ans = 0
d = {}
for i in s:
if i in d:
ans += d[i]
d[i] += 1
else:
d[i] = 1
print(ans)
return
main()
| 15 | 15 | 266 | 265 | from collections import defaultdict
def main():
s = ["".join(sorted(x)) for x in open(0).read().split()[1:]]
d = defaultdict(lambda: 0)
ans = 0
for i in s:
ans += d[i]
d[i] += 1
print(ans)
return
main()
| def main():
s = ["".join(sorted(i)) for i in open(0).read().split()[1:]]
ans = 0
d = {}
for i in s:
if i in d:
ans += d[i]
d[i] += 1
else:
d[i] = 1
print(ans)
return
main()
| false | 0 | [
"-from collections import defaultdict",
"-",
"-",
"- s = [\"\".join(sorted(x)) for x in open(0).read().split()[1:]]",
"- d = defaultdict(lambda: 0)",
"+ s = [\"\".join(sorted(i)) for i in open(0).read().split()[1:]]",
"+ d = {}",
"- ans += d[i]",
"- d[i] += 1",
"+ ... | false | 0.045362 | 0.050441 | 0.8993 | [
"s319223539",
"s793452647"
] |
u562935282 | p02749 | python | s731830679 | s659065143 | 1,028 | 845 | 82,792 | 81,120 | Accepted | Accepted | 17.8 | # 完全二部グラフで大丈夫なら全部大丈夫(最悪で大丈夫かどうか)
# 簡単のためN=3kとする(3の倍数以外でもほとんど同じなので)
# 0,1,2がk個ずつ
# 1-1,2-2間に辺があるとダメ(これだけを避ければよい)
# 1-2,1-0,2-1,2-0,0-0はOKなので
# 二部グラフで片側の頂点が2k以上(もう一方がk個以下)の場合
# 2k以上の方に1,2を割り当てて、反対側をすべて0にする
# 両方とも(k,2k)の場合
# 両方k以上なのでLを1、Rを2で埋めて残りを0で埋める
def main():
from collections import deque
... | # 完全二部グラフで大丈夫なら全部大丈夫(最悪で大丈夫かどうか)
# 簡単のためN=3kとする(3の倍数以外でもほとんど同じなので)
# 0,1,2がk個ずつ
# 1-1,2-2間に辺があるとダメ(これだけを避ければよい)
# 1-2,1-0,2-1,2-0,0-0はOKなので
# 二部グラフで片側の頂点が2k以上(もう一方がk個以下)の場合
# 2k以上の方に1,2を割り当てて、反対側をすべて0にする
# 両方とも(k,2k)の場合
# 両方k以上なのでLを1、Rを2で埋めて残りを0で埋める
def main():
from collections import deque
... | 97 | 68 | 2,150 | 1,759 | # 完全二部グラフで大丈夫なら全部大丈夫(最悪で大丈夫かどうか)
# 簡単のためN=3kとする(3の倍数以外でもほとんど同じなので)
# 0,1,2がk個ずつ
# 1-1,2-2間に辺があるとダメ(これだけを避ければよい)
# 1-2,1-0,2-1,2-0,0-0はOKなので
# 二部グラフで片側の頂点が2k以上(もう一方がk個以下)の場合
# 2k以上の方に1,2を割り当てて、反対側をすべて0にする
# 両方とも(k,2k)の場合
# 両方k以上なのでLを1、Rを2で埋めて残りを0で埋める
def main():
from collections import deque
from itertools i... | # 完全二部グラフで大丈夫なら全部大丈夫(最悪で大丈夫かどうか)
# 簡単のためN=3kとする(3の倍数以外でもほとんど同じなので)
# 0,1,2がk個ずつ
# 1-1,2-2間に辺があるとダメ(これだけを避ければよい)
# 1-2,1-0,2-1,2-0,0-0はOKなので
# 二部グラフで片側の頂点が2k以上(もう一方がk個以下)の場合
# 2k以上の方に1,2を割り当てて、反対側をすべて0にする
# 両方とも(k,2k)の場合
# 両方k以上なのでLを1、Rを2で埋めて残りを0で埋める
def main():
from collections import deque
from itertools i... | false | 29.896907 | [
"- vs = [[] for _ in range(2)]",
"- vs[0].append(0)",
"+ size_0 = 0",
"+ if p == 0:",
"+ size_0 += 1",
"- vs[np].append(u)",
"- g1 = iter(list(range(1, N + 1, 3)))",
"- g2 = iter(list(range(2, N + 1, 3)))",
"+ g1 = iter(list(range(1, N + 1, 3))) # rang... | false | 0.049606 | 0.047814 | 1.037494 | [
"s731830679",
"s659065143"
] |
u644907318 | p03951 | python | s063671814 | s333495578 | 85 | 66 | 61,872 | 61,920 | Accepted | Accepted | 22.35 | N = int(eval(input()))
s = input().strip()
t = input().strip()
k = 0
for i in range(1,N+1):
if s[-i:]==t[:i]:
k = i
continue
print((2*N-k)) | N = int(eval(input()))
s = input().strip()
t = input().strip()
ind = -1
for i in range(N):
x = s[i:]
y = t[:N-i]
if x==y:
ind = i
break
if ind>=0:
print((N+i))
else:
print((2*N)) | 9 | 14 | 159 | 217 | N = int(eval(input()))
s = input().strip()
t = input().strip()
k = 0
for i in range(1, N + 1):
if s[-i:] == t[:i]:
k = i
continue
print((2 * N - k))
| N = int(eval(input()))
s = input().strip()
t = input().strip()
ind = -1
for i in range(N):
x = s[i:]
y = t[: N - i]
if x == y:
ind = i
break
if ind >= 0:
print((N + i))
else:
print((2 * N))
| false | 35.714286 | [
"-k = 0",
"-for i in range(1, N + 1):",
"- if s[-i:] == t[:i]:",
"- k = i",
"- continue",
"-print((2 * N - k))",
"+ind = -1",
"+for i in range(N):",
"+ x = s[i:]",
"+ y = t[: N - i]",
"+ if x == y:",
"+ ind = i",
"+ break",
"+if ind >= 0:",
"+ p... | false | 0.046704 | 0.038102 | 1.225761 | [
"s063671814",
"s333495578"
] |
u393971002 | p04006 | python | s390060910 | s458925428 | 1,635 | 1,330 | 3,188 | 3,316 | Accepted | Accepted | 18.65 | N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
B = a[:] # 魔法の回数がk以下のときのスライムjをてに入れる最小の時間(ただし、魔法を唱える時間は最後に
# 加えるのでここでは除いている
ans = 10 ** 13
for i in range(N):
for j in range(N):
if B[j] > a[j - i]:
B[j] = a[j - i]
tmp = sum(B) + i * x
if ans > ... | N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
B = a[:] # 魔法の回数がk以下のときのスライムjをてに入れる最小の時間(ただし、魔法を唱える時間は最後に
# 加えるのでここでは除いている
ans = 10 ** 13
for i in range(N):
B = [a[j - i] if B[j] > a[j - i] else B[j] for j in range(N)]
tmp = sum(B) + i * x
if ans > tmp:
a... | 14 | 12 | 352 | 337 | N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
B = a[:] # 魔法の回数がk以下のときのスライムjをてに入れる最小の時間(ただし、魔法を唱える時間は最後に
# 加えるのでここでは除いている
ans = 10**13
for i in range(N):
for j in range(N):
if B[j] > a[j - i]:
B[j] = a[j - i]
tmp = sum(B) + i * x
if ans > tmp:
ans = t... | N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
B = a[:] # 魔法の回数がk以下のときのスライムjをてに入れる最小の時間(ただし、魔法を唱える時間は最後に
# 加えるのでここでは除いている
ans = 10**13
for i in range(N):
B = [a[j - i] if B[j] > a[j - i] else B[j] for j in range(N)]
tmp = sum(B) + i * x
if ans > tmp:
ans = tmp
print(ans)... | false | 14.285714 | [
"- for j in range(N):",
"- if B[j] > a[j - i]:",
"- B[j] = a[j - i]",
"+ B = [a[j - i] if B[j] > a[j - i] else B[j] for j in range(N)]"
] | false | 0.032015 | 0.040073 | 0.79891 | [
"s390060910",
"s458925428"
] |
u057109575 | p03038 | python | s043070803 | s680774853 | 797 | 355 | 82,976 | 115,360 | Accepted | Accepted | 55.46 | N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(M)]
A.sort()
idx = 0
for b, c in sorted(X, key=lambda x: -x[1]):
for j in range(idx, min(N, idx + b)):
if A[j] < c:
A[j] = c
idx += b
print((sum(A)))
... |
from collections import Counter
from heapq import heappop, heappush
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(M)]
pq = []
ctr = Counter(A)
for val, cnt in list(ctr.items()):
heappush(pq, (-val, cnt))
for b, c in X:... | 13 | 24 | 314 | 461 | N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(M)]
A.sort()
idx = 0
for b, c in sorted(X, key=lambda x: -x[1]):
for j in range(idx, min(N, idx + b)):
if A[j] < c:
A[j] = c
idx += b
print((sum(A)))
| from collections import Counter
from heapq import heappop, heappush
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(M)]
pq = []
ctr = Counter(A)
for val, cnt in list(ctr.items()):
heappush(pq, (-val, cnt))
for b, c in X:
heappush(pq... | false | 45.833333 | [
"+from collections import Counter",
"+from heapq import heappop, heappush",
"+",
"-A.sort()",
"-idx = 0",
"-for b, c in sorted(X, key=lambda x: -x[1]):",
"- for j in range(idx, min(N, idx + b)):",
"- if A[j] < c:",
"- A[j] = c",
"- idx += b",
"-print((sum(A)))",
"+pq = ... | false | 0.042743 | 0.067985 | 0.628705 | [
"s043070803",
"s680774853"
] |
u957843607 | p02840 | python | s487568958 | s632074588 | 657 | 544 | 89,852 | 72,152 | Accepted | Accepted | 17.2 | import numpy as np
N, X, D = list(map(int, input().split()))
if not D:
if not X:
print((1))
else:
print((N+1))
else:
num_dict = dict()
ans = 0
for i in range(N+1):
left_num = int(i*X/D) + int(i*(i-1)/2)
right_num = int(i*X/D) + int(i*(2*N-1-i)/2)
judge_num = i*X%D
if ... | N, X, D = list(map(int, input().split()))
if not D:
if not X:
print((1))
else:
print((N+1))
else:
num_dict = dict()
ans = 0
for i in range(N+1):
left_num = int(i*X/D) + int(i*(i-1)/2)
right_num = int(i*X/D) + int(i*(2*N-1-i)/2)
judge_num = i*X%D
if not judge_num in num... | 34 | 33 | 744 | 724 | import numpy as np
N, X, D = list(map(int, input().split()))
if not D:
if not X:
print((1))
else:
print((N + 1))
else:
num_dict = dict()
ans = 0
for i in range(N + 1):
left_num = int(i * X / D) + int(i * (i - 1) / 2)
right_num = int(i * X / D) + int(i * (2 * N - 1 - ... | N, X, D = list(map(int, input().split()))
if not D:
if not X:
print((1))
else:
print((N + 1))
else:
num_dict = dict()
ans = 0
for i in range(N + 1):
left_num = int(i * X / D) + int(i * (i - 1) / 2)
right_num = int(i * X / D) + int(i * (2 * N - 1 - i) / 2)
judg... | false | 2.941176 | [
"-import numpy as np",
"-"
] | false | 0.092083 | 0.039103 | 2.354896 | [
"s487568958",
"s632074588"
] |
u324314500 | p03013 | python | s866806361 | s246946867 | 556 | 239 | 471,544 | 57,820 | Accepted | Accepted | 57.01 | import sys
from collections import deque
# q = deque(); q.append(x); q.appendleft(x); q.pop() -> x; q.popleft() -> x
from collections import defaultdict
# d = defaultdict(lambda: []); d[key] -> []
import heapq
# hq = []; heapq.heappush(hq, x); heapq.heappop(hq) -> x; heapq.heappushpop(hq, x) -> x
import bisect... | import sys
from collections import deque
# q = deque(); q.append(x); q.appendleft(x); q.pop() -> x; q.popleft() -> x
from collections import defaultdict
# d = defaultdict(lambda: []); d[key] -> []
import heapq
# hq = []; heapq.heappush(hq, x); heapq.heappop(hq) -> x; heapq.heappushpop(hq, x) -> x
import bisect... | 57 | 71 | 1,509 | 1,812 | import sys
from collections import deque
# q = deque(); q.append(x); q.appendleft(x); q.pop() -> x; q.popleft() -> x
from collections import defaultdict
# d = defaultdict(lambda: []); d[key] -> []
import heapq
# hq = []; heapq.heappush(hq, x); heapq.heappop(hq) -> x; heapq.heappushpop(hq, x) -> x
import bisect
# i ... | import sys
from collections import deque
# q = deque(); q.append(x); q.appendleft(x); q.pop() -> x; q.popleft() -> x
from collections import defaultdict
# d = defaultdict(lambda: []); d[key] -> []
import heapq
# hq = []; heapq.heappush(hq, x); heapq.heappop(hq) -> x; heapq.heappushpop(hq, x) -> x
import bisect
# i ... | false | 19.71831 | [
"-def main():",
"+def main_nondp():",
"+def main():",
"+ N, M = i2nn()",
"+ A = ii2nn(M)",
"+ MOD = int(1e9) + 7",
"+ AS = set(A)",
"+ dp = [0] * (N + 9) # i段目のパターン数",
"+ dp[0] = 1",
"+ for i in range(1, N + 1):",
"+ if i in AS:",
"+ dp[i] = 0",
"+ ... | false | 0.081014 | 0.08777 | 0.923026 | [
"s866806361",
"s246946867"
] |
u556594202 | p02880 | python | s634642834 | s152631639 | 32 | 29 | 9,164 | 9,020 | Accepted | Accepted | 9.38 | N = int(eval(input()))
flag=False
for i in range(1,10):
if (N%i==0 and N/i<=9):
flag=True
print(("Yes" if flag else "No"))
| N=int(eval(input()))
for i in range(1,10):
if 1<=N/i<=9 and N%i==0:
print("Yes")
exit()
print("No")
| 6 | 7 | 132 | 121 | N = int(eval(input()))
flag = False
for i in range(1, 10):
if N % i == 0 and N / i <= 9:
flag = True
print(("Yes" if flag else "No"))
| N = int(eval(input()))
for i in range(1, 10):
if 1 <= N / i <= 9 and N % i == 0:
print("Yes")
exit()
print("No")
| false | 14.285714 | [
"-flag = False",
"- if N % i == 0 and N / i <= 9:",
"- flag = True",
"-print((\"Yes\" if flag else \"No\"))",
"+ if 1 <= N / i <= 9 and N % i == 0:",
"+ print(\"Yes\")",
"+ exit()",
"+print(\"No\")"
] | false | 0.040992 | 0.047203 | 0.868411 | [
"s634642834",
"s152631639"
] |
u368249389 | p02787 | python | s741570897 | s062876712 | 1,158 | 561 | 281,352 | 42,348 | Accepted | Accepted | 51.55 | # ダイナミック・プログラミング
# PythonではTLEを起こしてしまう例
INF = float('inf')
H, N = list(map(int, input().split()))
A = []
B = []
for i in range(N):
a_i, b_i = list(map(int, input().split()))
A.append(a_i)
B.append(b_i)
dp = [[INF]*(H+1) for i in range(N+1)] # DP用配列
dp[0][0] = 0 # 初期化処理
for i in range(0,N... | # Problem E - Crested Ibis vs Monster
# input
H, N = list(map(int, input().split()))
magic_list = []
for i in range(N):
A, B = list(map(int, input().split()))
magic_list.append([A, B])
# initialization
dp = [float('INF')]*(H+1)
dp[0] = 0
mg_len = len(magic_list)
# dp
for i in range(1, H+1):
... | 30 | 27 | 622 | 554 | # ダイナミック・プログラミング
# PythonではTLEを起こしてしまう例
INF = float("inf")
H, N = list(map(int, input().split()))
A = []
B = []
for i in range(N):
a_i, b_i = list(map(int, input().split()))
A.append(a_i)
B.append(b_i)
dp = [[INF] * (H + 1) for i in range(N + 1)] # DP用配列
dp[0][0] = 0 # 初期化処理
for i in range(0, N):
for ... | # Problem E - Crested Ibis vs Monster
# input
H, N = list(map(int, input().split()))
magic_list = []
for i in range(N):
A, B = list(map(int, input().split()))
magic_list.append([A, B])
# initialization
dp = [float("INF")] * (H + 1)
dp[0] = 0
mg_len = len(magic_list)
# dp
for i in range(1, H + 1):
for j in r... | false | 10 | [
"-# ダイナミック・プログラミング",
"-# PythonではTLEを起こしてしまう例",
"-INF = float(\"inf\")",
"+# Problem E - Crested Ibis vs Monster",
"+# input",
"-A = []",
"-B = []",
"+magic_list = []",
"- a_i, b_i = list(map(int, input().split()))",
"- A.append(a_i)",
"- B.append(b_i)",
"-dp = [[INF] * (H + 1) for i ... | false | 0.127326 | 0.086796 | 1.466955 | [
"s741570897",
"s062876712"
] |
u426534722 | p02234 | python | s944386267 | s976129859 | 220 | 190 | 7,744 | 7,868 | Accepted | Accepted | 13.64 | n = int(eval(input()))
m = [[0 for j in range(n + 1)] for i in range(n + 1)]
z = [0] * (n + 1)
for i in range(1, n + 1):
z[i - 1], z[i] = list(map(int, input().split()))
j = 0
for l in range(2, n + 1):
for i in range(1, n - l + 2):
j = i + l - 1
m[i][j] = int(1e8)
for k in rang... | n = int(eval(input()))
m = [[0] * (n + 1) for _ in range(n + 1)]
z = [0] * (n + 1)
for i in range(n):
z[i], z[i + 1] = list(map(int, input().split()))
j = 0
for l in range(2, n + 1):
for i in range(1, n - l + 2):
j = i + l - 1
m[i][j] = float("inf")
for k in range(i, j):
... | 13 | 13 | 416 | 401 | n = int(eval(input()))
m = [[0 for j in range(n + 1)] for i in range(n + 1)]
z = [0] * (n + 1)
for i in range(1, n + 1):
z[i - 1], z[i] = list(map(int, input().split()))
j = 0
for l in range(2, n + 1):
for i in range(1, n - l + 2):
j = i + l - 1
m[i][j] = int(1e8)
for k in range(i, j):
... | n = int(eval(input()))
m = [[0] * (n + 1) for _ in range(n + 1)]
z = [0] * (n + 1)
for i in range(n):
z[i], z[i + 1] = list(map(int, input().split()))
j = 0
for l in range(2, n + 1):
for i in range(1, n - l + 2):
j = i + l - 1
m[i][j] = float("inf")
for k in range(i, j):
m[i]... | false | 0 | [
"-m = [[0 for j in range(n + 1)] for i in range(n + 1)]",
"+m = [[0] * (n + 1) for _ in range(n + 1)]",
"-for i in range(1, n + 1):",
"- z[i - 1], z[i] = list(map(int, input().split()))",
"+for i in range(n):",
"+ z[i], z[i + 1] = list(map(int, input().split()))",
"- m[i][j] = int(1e8)",
... | false | 0.037611 | 0.037614 | 0.999912 | [
"s944386267",
"s976129859"
] |
u816631826 | p03251 | python | s132263617 | s196620239 | 18 | 11 | 3,064 | 2,568 | Accepted | Accepted | 38.89 | n,m,a,b = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x = max(x)
y = min(y)
for z in range(x+1,y+1):
if a < z and z <= b:
print("No War")
quit()
print("War") | #!/usr/bin/python
# -*- coding: utf-8 -*-
s = input()
n, m, x, y = [int(x) for x in s.split()]
xx = [int(a) for a in input().split()]
yy = [int(a) for a in input().split()]
xx = sorted(xx)
yy = sorted(yy)
if xx[-1] >= y or yy[0] <= x or xx[-1] >= yy[0]:
print('War')
else:
print('No War') | 10 | 14 | 240 | 321 | n, m, a, b = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x = max(x)
y = min(y)
for z in range(x + 1, y + 1):
if a < z and z <= b:
print("No War")
quit()
print("War")
| #!/usr/bin/python
# -*- coding: utf-8 -*-
s = input()
n, m, x, y = [int(x) for x in s.split()]
xx = [int(a) for a in input().split()]
yy = [int(a) for a in input().split()]
xx = sorted(xx)
yy = sorted(yy)
if xx[-1] >= y or yy[0] <= x or xx[-1] >= yy[0]:
print("War")
else:
print("No War")
| false | 28.571429 | [
"-n, m, a, b = list(map(int, input().split()))",
"-x = list(map(int, input().split()))",
"-y = list(map(int, input().split()))",
"-x = max(x)",
"-y = min(y)",
"-for z in range(x + 1, y + 1):",
"- if a < z and z <= b:",
"- print(\"No War\")",
"- quit()",
"-print(\"War\")",
"+#!/u... | false | 0.035995 | 0.036989 | 0.97314 | [
"s132263617",
"s196620239"
] |
u747709646 | p02410 | python | s367563258 | s821153490 | 60 | 50 | 8,056 | 7,964 | Accepted | Accepted | 16.67 | n,m = list(map(int, input().split()))
A = []
for i in range(n):
A.append(list(map(int, input().split())))
b = []
for i in range(m):
b.append(int(eval(input())))
c = []
for i in range(n):
tmp = 0
for j in range(m):
tmp += A[i][j] * b[j]
c.append(tmp)
for i in range(n):
... | n,m = list(map(int, input().split()))
A = []
for i in range(n):
A.append(list(map(int, input().split())))
b = [0] * m
for i in range(m):
b[i] = int(eval(input()))
c = [0] * n
for i in range(n):
for j in range(m):
c[i] += A[i][j] * b[j]
print((c[i])) | 20 | 15 | 324 | 276 | n, m = list(map(int, input().split()))
A = []
for i in range(n):
A.append(list(map(int, input().split())))
b = []
for i in range(m):
b.append(int(eval(input())))
c = []
for i in range(n):
tmp = 0
for j in range(m):
tmp += A[i][j] * b[j]
c.append(tmp)
for i in range(n):
print((c[i]))
| n, m = list(map(int, input().split()))
A = []
for i in range(n):
A.append(list(map(int, input().split())))
b = [0] * m
for i in range(m):
b[i] = int(eval(input()))
c = [0] * n
for i in range(n):
for j in range(m):
c[i] += A[i][j] * b[j]
print((c[i]))
| false | 25 | [
"-b = []",
"+b = [0] * m",
"- b.append(int(eval(input())))",
"-c = []",
"+ b[i] = int(eval(input()))",
"+c = [0] * n",
"- tmp = 0",
"- tmp += A[i][j] * b[j]",
"- c.append(tmp)",
"-for i in range(n):",
"+ c[i] += A[i][j] * b[j]"
] | false | 0.114951 | 0.065109 | 1.765502 | [
"s367563258",
"s821153490"
] |
u600402037 | p03212 | python | s190630429 | s182672630 | 93 | 49 | 3,060 | 3,064 | Accepted | Accepted | 47.31 | N = int(eval(input()))
def dfs(s):
if int(s) > N:
return 0
ret = 1 if all(s.count(c) > 0 for c in '357') else 0
for c in '357':
ret += dfs(s + c)
return ret
print((dfs('0'))) | # coding: utf-8
import sys
import itertools
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
answer = 0
digit = len(str(N))
# 3, 5, 7だけでできた数を列挙
for d in range(3, digit+1):
for x in itertools.product(['3', '5', '7'], repeat=d):
... | 11 | 21 | 210 | 457 | N = int(eval(input()))
def dfs(s):
if int(s) > N:
return 0
ret = 1 if all(s.count(c) > 0 for c in "357") else 0
for c in "357":
ret += dfs(s + c)
return ret
print((dfs("0")))
| # coding: utf-8
import sys
import itertools
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
answer = 0
digit = len(str(N))
# 3, 5, 7だけでできた数を列挙
for d in range(3, digit + 1):
for x in itertools.product(["3", "5", "7"], repeat=d):
if len(set... | false | 47.619048 | [
"-N = int(eval(input()))",
"+# coding: utf-8",
"+import sys",
"+import itertools",
"-",
"-def dfs(s):",
"- if int(s) > N:",
"- return 0",
"- ret = 1 if all(s.count(c) > 0 for c in \"357\") else 0",
"- for c in \"357\":",
"- ret += dfs(s + c)",
"- return ret",
"-",
... | false | 0.050695 | 0.045028 | 1.125859 | [
"s190630429",
"s182672630"
] |
u062691227 | p02598 | python | s024642283 | s696488259 | 1,579 | 214 | 118,816 | 109,104 | Accepted | Accepted | 86.45 | from math import ceil
from fractions import Fraction
n, k, *aa = list(map(Fraction, open(0).read().split()))
imp_length = 0
psbl_length = max(aa)
while psbl_length - imp_length > 1:
mid = (psbl_length + imp_length) // 2
cost = sum(ceil(a / mid) - 1 for a in aa)
if cost <= k:
psbl_leng... | n, k, *aa = list(map(int, open(0).read().split()))
imp_length = 0
psbl_length = max(aa)
while psbl_length - imp_length > 1:
mid = (psbl_length + imp_length) // 2
cost = sum(0 - -a // mid - 1 for a in aa)
if cost <= k:
psbl_length = mid
else:
imp_length = mid
print(psbl_le... | 17 | 14 | 381 | 319 | from math import ceil
from fractions import Fraction
n, k, *aa = list(map(Fraction, open(0).read().split()))
imp_length = 0
psbl_length = max(aa)
while psbl_length - imp_length > 1:
mid = (psbl_length + imp_length) // 2
cost = sum(ceil(a / mid) - 1 for a in aa)
if cost <= k:
psbl_length = mid
e... | n, k, *aa = list(map(int, open(0).read().split()))
imp_length = 0
psbl_length = max(aa)
while psbl_length - imp_length > 1:
mid = (psbl_length + imp_length) // 2
cost = sum(0 - -a // mid - 1 for a in aa)
if cost <= k:
psbl_length = mid
else:
imp_length = mid
print(psbl_length)
| false | 17.647059 | [
"-from math import ceil",
"-from fractions import Fraction",
"-",
"-n, k, *aa = list(map(Fraction, open(0).read().split()))",
"+n, k, *aa = list(map(int, open(0).read().split()))",
"- cost = sum(ceil(a / mid) - 1 for a in aa)",
"+ cost = sum(0 - -a // mid - 1 for a in aa)"
] | false | 0.052757 | 0.035796 | 1.473807 | [
"s024642283",
"s696488259"
] |
u173148629 | p02644 | python | s375831478 | s920089266 | 2,864 | 2,331 | 44,068 | 43,272 | Accepted | Accepted | 18.61 | H,W,K=list(map(int,input().split()))
x1,y1,x2,y2=[int(x)-1 for x in input().split()]
pond=[]
for _ in range(H):
pond.append(list(eval(input())))
inf=10**7
cost=[[inf]*W for _ in range(H)]
cost[x1][y1]=0
from heapq import heapify,heappop,heappush
hq=[(0,x1,y1)]
while hq:
t,x,y=heappop(hq)
#... | H,W,K=list(map(int,input().split()))
x1,y1,x2,y2=[int(x)-1 for x in input().split()]
pond=[]
for _ in range(H):
pond.append(list(eval(input())))
inf=10**7
cost=[[inf]*W for _ in range(H)]
cost[x1][y1]=0
from heapq import heapify,heappop,heappush
hq=[(0,x1,y1)]
while hq:
t,x,y=heappop(hq)
i... | 48 | 49 | 1,240 | 1,235 | H, W, K = list(map(int, input().split()))
x1, y1, x2, y2 = [int(x) - 1 for x in input().split()]
pond = []
for _ in range(H):
pond.append(list(eval(input())))
inf = 10**7
cost = [[inf] * W for _ in range(H)]
cost[x1][y1] = 0
from heapq import heapify, heappop, heappush
hq = [(0, x1, y1)]
while hq:
t, x, y = he... | H, W, K = list(map(int, input().split()))
x1, y1, x2, y2 = [int(x) - 1 for x in input().split()]
pond = []
for _ in range(H):
pond.append(list(eval(input())))
inf = 10**7
cost = [[inf] * W for _ in range(H)]
cost[x1][y1] = 0
from heapq import heapify, heappop, heappush
hq = [(0, x1, y1)]
while hq:
t, x, y = he... | false | 2.040816 | [
"+ if x == x2 and y == y2:",
"+ print(t)",
"+ exit()",
"-if cost[x2][y2] == inf:",
"- print((-1))",
"- exit()",
"-print((cost[x2][y2]))",
"+print((-1))"
] | false | 0.041136 | 0.048773 | 0.843412 | [
"s375831478",
"s920089266"
] |
u226155577 | p03061 | python | s272565175 | s938941727 | 261 | 211 | 63,984 | 16,148 | Accepted | Accepted | 19.16 | def gcd(m, n):
r = m % n
return gcd(n, r) if r else n
N = int(eval(input()))
*A, = list(map(int, input().split()))
L = [0]*N
L[0] = A[0]
v = A[0]
for i in range(N-1):
L[i+1] = v = gcd(v, A[i+1])
R = [0]*N
R[-1] = A[-1]
v = A[-1]
for i in range(N-1, -1, -1):
R[i] = v = gcd(v, A[i])
ans... | from fractions import gcd
N, *A = list(map(int, open(0).read().split()))
L = [0]*N
L[0] = v = A[0]
for i in range(N-1):
L[i+1] = v = gcd(v, A[i+1])
R = [0]*N
R[-1] = v = A[-1]
for i in range(N-1, -1, -1):
R[i] = v = gcd(v, A[i])
ans = max(L[-1], L[-2], R[1])
for i in range(1, N-1):
ans = max(a... | 21 | 15 | 412 | 350 | def gcd(m, n):
r = m % n
return gcd(n, r) if r else n
N = int(eval(input()))
(*A,) = list(map(int, input().split()))
L = [0] * N
L[0] = A[0]
v = A[0]
for i in range(N - 1):
L[i + 1] = v = gcd(v, A[i + 1])
R = [0] * N
R[-1] = A[-1]
v = A[-1]
for i in range(N - 1, -1, -1):
R[i] = v = gcd(v, A[i])
ans = ... | from fractions import gcd
N, *A = list(map(int, open(0).read().split()))
L = [0] * N
L[0] = v = A[0]
for i in range(N - 1):
L[i + 1] = v = gcd(v, A[i + 1])
R = [0] * N
R[-1] = v = A[-1]
for i in range(N - 1, -1, -1):
R[i] = v = gcd(v, A[i])
ans = max(L[-1], L[-2], R[1])
for i in range(1, N - 1):
ans = max(... | false | 28.571429 | [
"-def gcd(m, n):",
"- r = m % n",
"- return gcd(n, r) if r else n",
"+from fractions import gcd",
"-",
"-N = int(eval(input()))",
"-(*A,) = list(map(int, input().split()))",
"+N, *A = list(map(int, open(0).read().split()))",
"-L[0] = A[0]",
"-v = A[0]",
"+L[0] = v = A[0]",
"-R[-1] = A[-1... | false | 0.038601 | 0.048193 | 0.800977 | [
"s272565175",
"s938941727"
] |
u401077816 | p03448 | python | s416456664 | s805355691 | 54 | 49 | 3,060 | 3,060 | Accepted | Accepted | 9.26 | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
res = 0
for a in range(1 + A):
for b in range(1 + B):
for c in range(1 + C):
if a*500 + b*100 + 50*c == X:
res += 1
print(res) | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
res = 0
for a in range(A+1):
for b in range(B+1):
for c in range(C+1):
if a*500 + 100*b + c*50 == X:
res += 1
print(res) | 14 | 14 | 230 | 232 | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
res = 0
for a in range(1 + A):
for b in range(1 + B):
for c in range(1 + C):
if a * 500 + b * 100 + 50 * c == X:
res += 1
print(res)
| A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
res = 0
for a in range(A + 1):
for b in range(B + 1):
for c in range(C + 1):
if a * 500 + 100 * b + c * 50 == X:
res += 1
print(res)
| false | 0 | [
"-for a in range(1 + A):",
"- for b in range(1 + B):",
"- for c in range(1 + C):",
"- if a * 500 + b * 100 + 50 * c == X:",
"+for a in range(A + 1):",
"+ for b in range(B + 1):",
"+ for c in range(C + 1):",
"+ if a * 500 + 100 * b + c * 50 == X:"
] | false | 0.12589 | 0.099238 | 1.268566 | [
"s416456664",
"s805355691"
] |
u936985471 | p02960 | python | s827862155 | s308666810 | 428 | 309 | 96,336 | 96,280 | Accepted | Accepted | 27.8 | import sys
readline = sys.stdin.readline
conv = {}
for i in range(13):
conv[i] = (i * 10) % 13
S = readline().rstrip()
N = len(S)
DIV = 10 ** 9 + 7
dp = [[0] * 13 for i in range(N)]
x0 = S[0]
if x0 == "?":
for i in range(10):
dp[0][i] = 1
else:
dp[0][int(x0)] = 1
for i in range(1, N... | import sys
readline = sys.stdin.readline
S = readline().rstrip()
N = len(S)
DIV = 10 ** 9 + 7
dp = [[0] * 13 for i in range(N)]
x0 = S[0]
if x0 == "?":
for i in range(10):
dp[0][i] = 1
else:
dp[0][int(x0)] = 1
for i in range(1, N):
x = S[i]
if x == "?":
for j in range(13):
... | 33 | 31 | 648 | 587 | import sys
readline = sys.stdin.readline
conv = {}
for i in range(13):
conv[i] = (i * 10) % 13
S = readline().rstrip()
N = len(S)
DIV = 10**9 + 7
dp = [[0] * 13 for i in range(N)]
x0 = S[0]
if x0 == "?":
for i in range(10):
dp[0][i] = 1
else:
dp[0][int(x0)] = 1
for i in range(1, N):
x = S[i]
... | import sys
readline = sys.stdin.readline
S = readline().rstrip()
N = len(S)
DIV = 10**9 + 7
dp = [[0] * 13 for i in range(N)]
x0 = S[0]
if x0 == "?":
for i in range(10):
dp[0][i] = 1
else:
dp[0][int(x0)] = 1
for i in range(1, N):
x = S[i]
if x == "?":
for j in range(13):
for... | false | 6.060606 | [
"-conv = {}",
"-for i in range(13):",
"- conv[i] = (i * 10) % 13",
"- dp[i][(conv[j] + k) % 13] += dp[i - 1][j]",
"- dp[i][(conv[j] + k) % 13] %= DIV",
"+ ind = (j * 10 + k) % 13",
"+ dp[i][ind] += dp[i - 1][j]",
"+ dp[i][in... | false | 0.037382 | 0.035713 | 1.046734 | [
"s827862155",
"s308666810"
] |
u046158516 | p02883 | python | s800020960 | s044787238 | 569 | 338 | 80,740 | 117,920 | Accepted | Accepted | 40.6 | import os,io
input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
f=list(map(int,input().split()))
a.sort()
a.reverse()
f.sort()
maxproduct=0
for i in range(n):
maxproduct=max(f[i]*a[i],maxproduct)
l1=0
r1=maxproduct
while True:
... | import sys
import os,io
input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
f=list(map(int,input().split()))
a.sort()
f.sort()
f.reverse()
if sum(a)<=k:
print((0))
sys.exit()
pointer=0
l=0
r=0
for i in range(n):
r=max(r,a[i]... | 42 | 33 | 744 | 590 | import os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a.sort()
a.reverse()
f.sort()
maxproduct = 0
for i in range(n):
maxproduct = max(f[i] * a[i], maxproduct)
l1 = 0
r1 = maxproduct
... | import sys
import os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a.sort()
f.sort()
f.reverse()
if sum(a) <= k:
print((0))
sys.exit()
pointer = 0
l = 0
r = 0
for i in range(n):
... | false | 21.428571 | [
"+import sys",
"-a.reverse()",
"-maxproduct = 0",
"+f.reverse()",
"+if sum(a) <= k:",
"+ print((0))",
"+ sys.exit()",
"+pointer = 0",
"+l = 0",
"+r = 0",
"- maxproduct = max(f[i] * a[i], maxproduct)",
"-l1 = 0",
"-r1 = maxproduct",
"-while True:",
"- l2 = l1",
"- r2 = (l... | false | 0.060142 | 0.080695 | 0.745301 | [
"s800020960",
"s044787238"
] |
u225388820 | p03164 | python | s000484788 | s200964976 | 561 | 284 | 171,120 | 45,168 | Accepted | Accepted | 49.38 | """
重さと価値がそれぞれw_i,v_iであるようなn個の品物がある.
これらの品物の中から, 重さの総和がWを超えないように選んだ時の,
価値の総和の最大値を求めよ.
1<=n<=100, 1<=w_i<=10^7, 1<=v_i<=100, 1<=limit_w<=10^9
"""
#-------------------------------------------------------------------------------
#入力
INF = 2000000000
"""
メモ : Pythonでは無限大を表す float('inf') があるが, 処理がかなり重たいので
... | """
重さと価値がそれぞれw_i,v_iであるようなn個の品物がある.
これらの品物の中から, 重さの総和がWを超えないように選んだ時の,
価値の総和の最大値を求めよ.
1<=n<=100, 1<=w_i<=10^7, 1<=v_i<=100, 1<=limit_w<=10^9
"""
#-------------------------------------------------------------------------------
#入力
INF = 2000000000
"""
メモ : Pythonでは無限大を表す float('inf') があるが, 処理がかなり重たいので
... | 41 | 39 | 1,112 | 1,008 | """
重さと価値がそれぞれw_i,v_iであるようなn個の品物がある.
これらの品物の中から, 重さの総和がWを超えないように選んだ時の,
価値の総和の最大値を求めよ.
1<=n<=100, 1<=w_i<=10^7, 1<=v_i<=100, 1<=limit_w<=10^9
"""
# -------------------------------------------------------------------------------
# 入力
INF = 2000000000
"""
メモ : Pythonでは無限大を表す float('inf') があるが, 処理がかなり重たいので
代わりにsum(v... | """
重さと価値がそれぞれw_i,v_iであるようなn個の品物がある.
これらの品物の中から, 重さの総和がWを超えないように選んだ時の,
価値の総和の最大値を求めよ.
1<=n<=100, 1<=w_i<=10^7, 1<=v_i<=100, 1<=limit_w<=10^9
"""
# -------------------------------------------------------------------------------
# 入力
INF = 2000000000
"""
メモ : Pythonでは無限大を表す float('inf') があるが, 処理がかなり重たいので
代わりにsum(v... | false | 4.878049 | [
"-dp = [[INF for i in range(sum_v + 1)] for j in range(n + 1)]",
"+dp = [INF for i in range(sum_v + 1)]",
"-dp[0][0] = 0",
"+dp[0] = 0",
"- for j in range(sum_v + 1):",
"- if j < v[i]:",
"- dp[i + 1][j] = dp[i][j]",
"- else:",
"- dp[i + 1][j] = min(dp[i][j], dp... | false | 0.047857 | 0.081876 | 0.584509 | [
"s000484788",
"s200964976"
] |
u143322814 | p02714 | python | s802845596 | s540205112 | 1,034 | 923 | 9,216 | 9,204 | Accepted | Accepted | 10.74 |
def main():
n = int(eval(input()))
s = eval(input())
r,g,b = 0,0,0
for i in s:
if i == 'R': r += 1
elif i == 'G': g += 1
elif i == 'B': b += 1
ans = r*g*b
for j in range(n):
for i in range(j):
k = j+(j-i)
if k < n:
... |
def main():
n = int(eval(input()))
s = eval(input())
r,g,b = 0,0,0
for i in s:
if i == 'R': r += 1
elif i == 'G': g += 1
elif i == 'B': b += 1
ans = r*g*b
for j in range(n):
sj = s[j]
for i in range(j):
k = j+(j-i)
if... | 20 | 23 | 474 | 535 | def main():
n = int(eval(input()))
s = eval(input())
r, g, b = 0, 0, 0
for i in s:
if i == "R":
r += 1
elif i == "G":
g += 1
elif i == "B":
b += 1
ans = r * g * b
for j in range(n):
for i in range(j):
k = j + (j - i)... | def main():
n = int(eval(input()))
s = eval(input())
r, g, b = 0, 0, 0
for i in s:
if i == "R":
r += 1
elif i == "G":
g += 1
elif i == "B":
b += 1
ans = r * g * b
for j in range(n):
sj = s[j]
for i in range(j):
... | false | 13.043478 | [
"+ sj = s[j]",
"- if s[i] == s[j] or s[i] == s[k] or s[k] == s[j]:",
"+ si = s[i]",
"+ sk = s[k]",
"+ if si == sj or si == sk or sk == sj:"
] | false | 0.036355 | 0.07379 | 0.492679 | [
"s802845596",
"s540205112"
] |
u077291787 | p02900 | python | s122144978 | s828733083 | 77 | 62 | 3,064 | 3,064 | Accepted | Accepted | 19.48 | # ABC142D - Disjoint Set of Common Divisors
def gcd(x: int, y: int) -> int:
while y:
x, y = y, x % y
return x
def prime_factorization(x: int) -> dict:
max_prime, ret = 0, {}
# Divide x by 2 as much as possible
cnt = 0
while x % 2 == 0:
x //= 2
cnt += 1
... | # ABC142D - Disjoint Set of Common Divisors
def gcd(x: int, y: int) -> int:
while y:
x, y = y, x % y
return x
def prime_factors(x: int) -> list:
if x % 2:
max_prime, factors = 0, []
else:
max_prime, factors = 2, [2]
while x % 2 == 0:
x //= 2
... | 46 | 35 | 1,030 | 823 | # ABC142D - Disjoint Set of Common Divisors
def gcd(x: int, y: int) -> int:
while y:
x, y = y, x % y
return x
def prime_factorization(x: int) -> dict:
max_prime, ret = 0, {}
# Divide x by 2 as much as possible
cnt = 0
while x % 2 == 0:
x //= 2
cnt += 1
if cnt > 0:
... | # ABC142D - Disjoint Set of Common Divisors
def gcd(x: int, y: int) -> int:
while y:
x, y = y, x % y
return x
def prime_factors(x: int) -> list:
if x % 2:
max_prime, factors = 0, []
else:
max_prime, factors = 2, [2]
while x % 2 == 0:
x //= 2
for i in ran... | false | 23.913043 | [
"-def prime_factorization(x: int) -> dict:",
"- max_prime, ret = 0, {}",
"- # Divide x by 2 as much as possible",
"- cnt = 0",
"- while x % 2 == 0:",
"- x //= 2",
"- cnt += 1",
"- if cnt > 0:",
"- max_prime = 2",
"- ret[max_prime] = cnt",
"- # x must... | false | 0.054926 | 0.045853 | 1.197862 | [
"s122144978",
"s828733083"
] |
u844646164 | p03607 | python | s032696160 | s379858458 | 239 | 192 | 15,452 | 90,108 | Accepted | Accepted | 19.67 | from collections import defaultdict
n = int(eval(input()))
d = defaultdict(int)
for _ in range(n):
d[int(eval(input()))] += 1
count = 0
for v in list(d.values()):
if v % 2 != 0:
count += 1
print(count)
|
from collections import Counter
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
ca = Counter(A)
ans = 0
for v in list(ca.values()):
if v%2:
ans += 1
print(ans) | 12 | 11 | 205 | 177 | from collections import defaultdict
n = int(eval(input()))
d = defaultdict(int)
for _ in range(n):
d[int(eval(input()))] += 1
count = 0
for v in list(d.values()):
if v % 2 != 0:
count += 1
print(count)
| from collections import Counter
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
ca = Counter(A)
ans = 0
for v in list(ca.values()):
if v % 2:
ans += 1
print(ans)
| false | 8.333333 | [
"-from collections import defaultdict",
"+from collections import Counter",
"-n = int(eval(input()))",
"-d = defaultdict(int)",
"-for _ in range(n):",
"- d[int(eval(input()))] += 1",
"-count = 0",
"-for v in list(d.values()):",
"- if v % 2 != 0:",
"- count += 1",
"-print(count)",
... | false | 0.040163 | 0.042049 | 0.95516 | [
"s032696160",
"s379858458"
] |
u810735437 | p03584 | python | s068958854 | s764981173 | 1,102 | 995 | 15,184 | 15,112 | Accepted | Accepted | 9.71 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 110101以下の数は、以下のいずれかである
#
# 110101
# 110100 (1を一つ選んで0にする、それ以下の桁はなんでもよいので?とする)
# 1100??
# 10????
# 0?????
#
# 上の各パターンについて条件を満たすものをそれぞれ探し、maxをとる
# 各パターンでは、0になるべき桁が必ず0になるようにする
#
# 実装上は、?をすべて1で置換。orをとっても以下の数値を超えないようにする
#
# 110101
# 110011
# 101111
# 01111... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 動画解説を見る
#
# 110101以下の数は、以下のいずれかである
#
# 110101
# 110100 (1を一つ選んで0にする、それ以下の桁はなんでもよいので?とする)
# 1100??
# 10????
# 0?????
#
# 上の各パターンについて条件を満たすものをそれぞれ探し、maxをとる
# 各パターンでは、0になるべき桁が必ず0になるようにする
#
# 実装上は、?をすべて1で置換。orをとった結果、0の箇所に1が来ないようにする
#
# 110101
# 110011
# ... | 71 | 70 | 1,173 | 1,176 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 110101以下の数は、以下のいずれかである
#
# 110101
# 110100 (1を一つ選んで0にする、それ以下の桁はなんでもよいので?とする)
# 1100??
# 10????
# 0?????
#
# 上の各パターンについて条件を満たすものをそれぞれ探し、maxをとる
# 各パターンでは、0になるべき桁が必ず0になるようにする
#
# 実装上は、?をすべて1で置換。orをとっても以下の数値を超えないようにする
#
# 110101
# 110011
# 101111
# 011111
#
import array
from... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 動画解説を見る
#
# 110101以下の数は、以下のいずれかである
#
# 110101
# 110100 (1を一つ選んで0にする、それ以下の桁はなんでもよいので?とする)
# 1100??
# 10????
# 0?????
#
# 上の各パターンについて条件を満たすものをそれぞれ探し、maxをとる
# 各パターンでは、0になるべき桁が必ず0になるようにする
#
# 実装上は、?をすべて1で置換。orをとった結果、0の箇所に1が来ないようにする
#
# 110101
# 110011
# 101111
# 011111
impor... | false | 1.408451 | [
"+# 動画解説を見る",
"+#",
"-# 実装上は、?をすべて1で置換。orをとっても以下の数値を超えないようにする",
"+# 実装上は、?をすべて1で置換。orをとった結果、0の箇所に1が来ないようにする",
"-#",
"-for n in range(31):",
"+for i in range(31):",
"- if (K >> n) & 1 == 0:",
"- K |= 1 << n",
"+ if (K >> i) & 1 == 0:",
"+ K |= 1 << i",
"- K ^= 1 << n"... | false | 0.038669 | 0.045917 | 0.842164 | [
"s068958854",
"s764981173"
] |
u509739538 | p02596 | python | s930751747 | s117728643 | 283 | 247 | 9,372 | 9,340 | Accepted | Accepted | 12.72 | from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math
import bisect
def readInt():
return int(eval(input()))
def readInts():
return list(map(int, input().split()))
def readChar():
return eval(input())
def readChars():
return... | from collections import defaultdict
from collections import deque
from collections import Counter
import math
def readInt():
return int(eval(input()))
def readInts():
return list(map(int, input().split()))
def readChar():
return eval(input())
def readChars():
return input().split()
k = readInt()
... | 29 | 25 | 479 | 413 | from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math
import bisect
def readInt():
return int(eval(input()))
def readInts():
return list(map(int, input().split()))
def readChar():
return eval(input())
def readChars():
retur... | from collections import defaultdict
from collections import deque
from collections import Counter
import math
def readInt():
return int(eval(input()))
def readInts():
return list(map(int, input().split()))
def readChar():
return eval(input())
def readChars():
return input().split()
k = readInt... | false | 13.793103 | [
"-import itertools",
"-import bisect",
"-x = 0",
"-a = 7 % k",
"-ans = 0",
"-for i in range(10**6 + 1):",
"- x = (x * 10 % k + a) % k",
"- ans += 1",
"- if x == 0:",
"- print(ans)",
"+n = 7",
"+for i in range(10**6):",
"+ if n % k == 0:",
"+ print((i + 1))",
"+ ... | false | 0.121911 | 0.156621 | 0.778382 | [
"s930751747",
"s117728643"
] |
u133936772 | p02803 | python | s345551426 | s321271794 | 836 | 459 | 3,188 | 3,424 | Accepted | Accepted | 45.1 | h, w = list(map(int, input().split()))
grid = [eval(input()) for _ in range(h)]
ans = 0
for i in range(h):
for j in range(w):
if grid[i][j] == ".":
q = [(i, j)]
dist = [[-1]*w for _ in range(h)]
dist[i][j] = 0
while q:
x, y = q.po... | h,w = list(map(int,input().split()))
ls = [eval(input()) for _ in range(h)]
from collections import deque
a = 0
for i in range(h):
for j in range(w):
if ls[i][j]=='#': continue
d = [[-1]*w for _ in range(h)]
d[i][j] = 0
q = deque([(i,j)])
while q:
x,y = q.popleft()
for dx,d... | 25 | 20 | 825 | 585 | h, w = list(map(int, input().split()))
grid = [eval(input()) for _ in range(h)]
ans = 0
for i in range(h):
for j in range(w):
if grid[i][j] == ".":
q = [(i, j)]
dist = [[-1] * w for _ in range(h)]
dist[i][j] = 0
while q:
x, y = q.pop(0)
... | h, w = list(map(int, input().split()))
ls = [eval(input()) for _ in range(h)]
from collections import deque
a = 0
for i in range(h):
for j in range(w):
if ls[i][j] == "#":
continue
d = [[-1] * w for _ in range(h)]
d[i][j] = 0
q = deque([(i, j)])
while q:
... | false | 20 | [
"-grid = [eval(input()) for _ in range(h)]",
"-ans = 0",
"+ls = [eval(input()) for _ in range(h)]",
"+from collections import deque",
"+",
"+a = 0",
"- if grid[i][j] == \".\":",
"- q = [(i, j)]",
"- dist = [[-1] * w for _ in range(h)]",
"- dist[i][j] = 0",
... | false | 0.078174 | 0.035888 | 2.178244 | [
"s345551426",
"s321271794"
] |
u963128036 | p02779 | python | s198716768 | s488076911 | 104 | 87 | 33,996 | 26,808 | Accepted | Accepted | 16.35 | # coding: utf-8
import collections
n=int(eval(input()))
a_list=list(map(int,input().split()))
if len(collections.Counter(a_list))==len(a_list):
print("YES")
else:
print("NO") | # coding: utf-8
n=int(eval(input()))
a_list=list(map(int,input().split()))
if len(a_list)==len(set(a_list)):
print("YES")
else:
print("NO") | 11 | 9 | 189 | 151 | # coding: utf-8
import collections
n = int(eval(input()))
a_list = list(map(int, input().split()))
if len(collections.Counter(a_list)) == len(a_list):
print("YES")
else:
print("NO")
| # coding: utf-8
n = int(eval(input()))
a_list = list(map(int, input().split()))
if len(a_list) == len(set(a_list)):
print("YES")
else:
print("NO")
| false | 18.181818 | [
"-import collections",
"-",
"-if len(collections.Counter(a_list)) == len(a_list):",
"+if len(a_list) == len(set(a_list)):"
] | false | 0.035518 | 0.037927 | 0.936496 | [
"s198716768",
"s488076911"
] |
u529012223 | p02971 | python | s502554080 | s368356311 | 633 | 566 | 12,532 | 14,112 | Accepted | Accepted | 10.58 | #134
N = int(eval(input()))
A_max = 0
A_max_s = 0
flag = 0
A = []
for i in range(N):
a = int(eval(input()))
A.append(a)
if a > A_max:
A_max_s = A_max
A_max = a
ind_max = i
flag = 0
elif A_max_s < a < A_max:
A_max_s = a
elif a == A_max:
... | N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
A_copy = A[:]
A_copy.sort()
# print(A, A_sort)
A_max = A_copy[len(A_copy)-1]
A_second = A_copy[len(A_copy)-2]
for i in range(N):
if A[i] != A_max:
print(A_max)
else:
print(A_second) | 33 | 12 | 543 | 270 | # 134
N = int(eval(input()))
A_max = 0
A_max_s = 0
flag = 0
A = []
for i in range(N):
a = int(eval(input()))
A.append(a)
if a > A_max:
A_max_s = A_max
A_max = a
ind_max = i
flag = 0
elif A_max_s < a < A_max:
A_max_s = a
elif a == A_max:
flag += 1
if fl... | N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
A_copy = A[:]
A_copy.sort()
# print(A, A_sort)
A_max = A_copy[len(A_copy) - 1]
A_second = A_copy[len(A_copy) - 2]
for i in range(N):
if A[i] != A_max:
print(A_max)
else:
print(A_second)
| false | 63.636364 | [
"-# 134",
"-A_max = 0",
"-A_max_s = 0",
"-flag = 0",
"-A = []",
"+A = [int(eval(input())) for i in range(N)]",
"+A_copy = A[:]",
"+A_copy.sort()",
"+# print(A, A_sort)",
"+A_max = A_copy[len(A_copy) - 1]",
"+A_second = A_copy[len(A_copy) - 2]",
"- a = int(eval(input()))",
"- A.append(a... | false | 0.046682 | 0.045906 | 1.016895 | [
"s502554080",
"s368356311"
] |
u462329577 | p03657 | python | s014906136 | s321553192 | 173 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.17 | a,b = list(map(int,input().split()))
print(("Possible" if not a%3 or not b%3 or not (a+b)%3 else "Impossible"))
| #!/usr/bin/env python3
a,b = list(map(int,input().split()))
if a % 3 == 0 or b % 3 == 0 or (a+b)%3 == 0:
print("Possible")
else:
print("Impossible") | 2 | 6 | 106 | 155 | a, b = list(map(int, input().split()))
print(("Possible" if not a % 3 or not b % 3 or not (a + b) % 3 else "Impossible"))
| #!/usr/bin/env python3
a, b = list(map(int, input().split()))
if a % 3 == 0 or b % 3 == 0 or (a + b) % 3 == 0:
print("Possible")
else:
print("Impossible")
| false | 66.666667 | [
"+#!/usr/bin/env python3",
"-print((\"Possible\" if not a % 3 or not b % 3 or not (a + b) % 3 else \"Impossible\"))",
"+if a % 3 == 0 or b % 3 == 0 or (a + b) % 3 == 0:",
"+ print(\"Possible\")",
"+else:",
"+ print(\"Impossible\")"
] | false | 0.099723 | 0.064434 | 1.547664 | [
"s014906136",
"s321553192"
] |
u729133443 | p02753 | python | s343871854 | s707635105 | 163 | 24 | 38,384 | 9,020 | Accepted | Accepted | 85.28 | print(('YNeos'[len(set(eval(input())))<2::2])) | print(('YNeos'[len({*eval(input())})<2::2])) | 1 | 1 | 38 | 36 | print(("YNeos"[len(set(eval(input()))) < 2 :: 2]))
| print(("YNeos"[len({*eval(input())}) < 2 :: 2]))
| false | 0 | [
"-print((\"YNeos\"[len(set(eval(input()))) < 2 :: 2]))",
"+print((\"YNeos\"[len({*eval(input())}) < 2 :: 2]))"
] | false | 0.090251 | 0.108523 | 0.831624 | [
"s343871854",
"s707635105"
] |
u408260374 | p00719 | python | s115060695 | s930486847 | 6,310 | 4,930 | 7,904 | 7,836 | Accepted | Accepted | 21.87 | while True:
N, M, P, A, B = list(map(int, input().split()))
if not (N | M | P | A | B):
break
A, B = A - 1, B - 1
T = [int(x) for x in input().split()]
dp = [[float("inf")] * M for _ in range(1 << N)]
dp[0][A] = 0
edges = []
for _ in range(P):
s, t, c = list(map... | while True:
N, M, P, A, B = list(map(int, input().split()))
if not (N | M | P | A | B):
break
A, B = A - 1, B - 1
T = [int(x) for x in input().split()]
dp = [[float("inf")] * M for _ in range(1 << N)]
dp[0][A] = 0
edges = []
for _ in range(P):
s, t, c = list(map... | 22 | 22 | 804 | 840 | while True:
N, M, P, A, B = list(map(int, input().split()))
if not (N | M | P | A | B):
break
A, B = A - 1, B - 1
T = [int(x) for x in input().split()]
dp = [[float("inf")] * M for _ in range(1 << N)]
dp[0][A] = 0
edges = []
for _ in range(P):
s, t, c = list(map(int, inpu... | while True:
N, M, P, A, B = list(map(int, input().split()))
if not (N | M | P | A | B):
break
A, B = A - 1, B - 1
T = [int(x) for x in input().split()]
dp = [[float("inf")] * M for _ in range(1 << N)]
dp[0][A] = 0
edges = []
for _ in range(P):
s, t, c = list(map(int, inpu... | false | 0 | [
"- if state >> k & 1:",
"- dp[state][t] = min(",
"- dp[state][t], dp[state & ~(1 << k)][s] + c / T[k]",
"- )",
"+ if (",
"+ state >> k & 1",
"+ and dp[state][t] > dp[state & ~... | false | 0.121277 | 0.128147 | 0.946389 | [
"s115060695",
"s930486847"
] |
u028939600 | p00481 | python | s386615948 | s037457778 | 10,310 | 7,960 | 44,200 | 36,912 | Accepted | Accepted | 22.79 | from collections import deque
def getStart(field):
search_field = field[1:] # cut the first [H,W,N] for min_path matrix
for y in range(len(search_field)):
for x in range(len(search_field[0])):
if search_field[y][x] == "S":
return x,y+1
def bfs(field,start_x,s... |
def bfs(field,H,W,start_x,start_y,tmp_N):
direction = [[-1,0],[1,0],[0,-1],[0,1]]
que = []
que.append([start_x,start_y])
INF = 1000000
min_path = [[INF] * W for i in range(H)]
min_path[start_y][start_x] = 0
while len(que) != 0:
current = que.pop(0)
for d in directi... | 65 | 56 | 2,181 | 1,721 | from collections import deque
def getStart(field):
search_field = field[1:] # cut the first [H,W,N] for min_path matrix
for y in range(len(search_field)):
for x in range(len(search_field[0])):
if search_field[y][x] == "S":
return x, y + 1
def bfs(field, start_x, start_y,... | def bfs(field, H, W, start_x, start_y, tmp_N):
direction = [[-1, 0], [1, 0], [0, -1], [0, 1]]
que = []
que.append([start_x, start_y])
INF = 1000000
min_path = [[INF] * W for i in range(H)]
min_path[start_y][start_x] = 0
while len(que) != 0:
current = que.pop(0)
for d in direc... | false | 13.846154 | [
"-from collections import deque",
"-",
"-",
"-def getStart(field):",
"- search_field = field[1:] # cut the first [H,W,N] for min_path matrix",
"- for y in range(len(search_field)):",
"- for x in range(len(search_field[0])):",
"- if search_field[y][x] == \"S\":",
"- ... | false | 0.045201 | 0.044858 | 1.00766 | [
"s386615948",
"s037457778"
] |
u696197059 | p03470 | python | s499347465 | s402834987 | 61 | 26 | 62,380 | 9,184 | Accepted | Accepted | 57.38 | n = int(eval(input()))
syu = set([int(eval(input())) for i in range(n)])
print((len(syu))) | n = int(eval(input()))
int_list = sorted([int(eval(input())) for i in range(n)],reverse=True)
count = 1
i= 0
while i + 1 < len(int_list) :
if int_list[i] > int_list[i + 1]:
count += 1
i += 1
print(count) | 4 | 9 | 80 | 216 | n = int(eval(input()))
syu = set([int(eval(input())) for i in range(n)])
print((len(syu)))
| n = int(eval(input()))
int_list = sorted([int(eval(input())) for i in range(n)], reverse=True)
count = 1
i = 0
while i + 1 < len(int_list):
if int_list[i] > int_list[i + 1]:
count += 1
i += 1
print(count)
| false | 55.555556 | [
"-syu = set([int(eval(input())) for i in range(n)])",
"-print((len(syu)))",
"+int_list = sorted([int(eval(input())) for i in range(n)], reverse=True)",
"+count = 1",
"+i = 0",
"+while i + 1 < len(int_list):",
"+ if int_list[i] > int_list[i + 1]:",
"+ count += 1",
"+ i += 1",
"+print(c... | false | 0.037132 | 0.037523 | 0.989578 | [
"s499347465",
"s402834987"
] |
u075012704 | p03696 | python | s546588130 | s540716932 | 21 | 17 | 3,316 | 3,064 | Accepted | Accepted | 19.05 | from collections import deque
N = int(eval(input()))
S = list(eval(input()))
A = deque()
B = []
left_cnt = 0
right_cnt = 0
for s in S:
if s == "(":
left_cnt += 1
A.append("(")
else:
A.append(")")
if right_cnt + 1 > left_cnt:
B.append("(")
else... | N = int(eval(input()))
S = eval(input())
T = 0
ans = []
for s in S:
if s == "(":
T += 1
ans.append("(")
else:
T -= 1
ans.append(")")
if T < 0:
ans.insert(0, "(")
T = 0
for i in range(T):
ans.append(")")
print(("".join(ans)... | 23 | 20 | 421 | 308 | from collections import deque
N = int(eval(input()))
S = list(eval(input()))
A = deque()
B = []
left_cnt = 0
right_cnt = 0
for s in S:
if s == "(":
left_cnt += 1
A.append("(")
else:
A.append(")")
if right_cnt + 1 > left_cnt:
B.append("(")
else:
ri... | N = int(eval(input()))
S = eval(input())
T = 0
ans = []
for s in S:
if s == "(":
T += 1
ans.append("(")
else:
T -= 1
ans.append(")")
if T < 0:
ans.insert(0, "(")
T = 0
for i in range(T):
ans.append(")")
print(("".join(ans)))
| false | 13.043478 | [
"-from collections import deque",
"-",
"-S = list(eval(input()))",
"-A = deque()",
"-B = []",
"-left_cnt = 0",
"-right_cnt = 0",
"+S = eval(input())",
"+T = 0",
"+ans = []",
"- left_cnt += 1",
"- A.append(\"(\")",
"+ T += 1",
"+ ans.append(\"(\")",
"- A... | false | 0.152899 | 0.074573 | 2.050342 | [
"s546588130",
"s540716932"
] |
u413165887 | p03599 | python | s552182739 | s811451116 | 861 | 485 | 38,148 | 75,512 | Accepted | Accepted | 43.67 | a, b, c, d, e, f = list(map(int, input().split()))
water = []
for i in range(31):
for j in range(31):
if (a*i+b*j)*100<=f:
water.append(a*i+b*j)
water = list(set(water))
result = [[0,a*100,0]]
for i in water:
for x in range(301):
for y in range(301):
if i > 0... | a, b, c, d, e, f = list(map(int, input().split()))
water = []
for i in range(31):
for j in range(31):
if a*i+b*j <= f//100:
water.append(a*i+b*j)
water.pop(water.index(0))
water = list(set(water))
result = [[0,0,0]]
for w in water:
for i in range(301):
for j in range(301):... | 17 | 17 | 523 | 537 | a, b, c, d, e, f = list(map(int, input().split()))
water = []
for i in range(31):
for j in range(31):
if (a * i + b * j) * 100 <= f:
water.append(a * i + b * j)
water = list(set(water))
result = [[0, a * 100, 0]]
for i in water:
for x in range(301):
for y in range(301):
i... | a, b, c, d, e, f = list(map(int, input().split()))
water = []
for i in range(31):
for j in range(31):
if a * i + b * j <= f // 100:
water.append(a * i + b * j)
water.pop(water.index(0))
water = list(set(water))
result = [[0, 0, 0]]
for w in water:
for i in range(301):
for j in range(... | false | 0 | [
"- if (a * i + b * j) * 100 <= f:",
"+ if a * i + b * j <= f // 100:",
"+water.pop(water.index(0))",
"-result = [[0, a * 100, 0]]",
"-for i in water:",
"- for x in range(301):",
"- for y in range(301):",
"- if (",
"- i > 0",
"- and c... | false | 0.266573 | 0.179646 | 1.483884 | [
"s552182739",
"s811451116"
] |
u071211072 | p02576 | python | s124875208 | s036980946 | 29 | 25 | 9,044 | 9,132 | Accepted | Accepted | 13.79 | from math import ceil
N,X,T = list(map(int,input().split(' ')))
p = ceil(N/X)
print((p*T)) | from math import ceil
N,X,T = list(map(int,input().split(' ')))
print((ceil(N/X)*T)) | 4 | 3 | 91 | 85 | from math import ceil
N, X, T = list(map(int, input().split(" ")))
p = ceil(N / X)
print((p * T))
| from math import ceil
N, X, T = list(map(int, input().split(" ")))
print((ceil(N / X) * T))
| false | 25 | [
"-p = ceil(N / X)",
"-print((p * T))",
"+print((ceil(N / X) * T))"
] | false | 0.047185 | 0.047461 | 0.994194 | [
"s124875208",
"s036980946"
] |
u426108351 | p03162 | python | s186684966 | s812011505 | 659 | 542 | 61,788 | 22,740 | Accepted | Accepted | 17.75 | N = int(eval(input()))
dp = [[0 for i in range(3)] for i in range(N+1)]
for i in range(N):
a, b, c = list(map(int, input().split()))
dp[i+1][0] = max(dp[i][1], dp[i][2]) + a
dp[i+1][1] = max(dp[i][0], dp[i][2]) + b
dp[i+1][2] = max(dp[i][0], dp[i][1]) + c
print((max(dp[N])))
| N = int(eval(input()))
dp = [[0]*3 for i in range(N+1)]
for i in range(N):
a, b, c = list(map(int, input().split()))
dp[i+1][0] = max(dp[i][1] + a, dp[i][2] + a, dp[i][0])
dp[i+1][1] = max(dp[i][2] + b, dp[i][0] + b, dp[i][1])
dp[i+1][2] = max(dp[i][0] + c, dp[i][1] + c, dp[i][2])
print((max(... | 8 | 10 | 285 | 315 | N = int(eval(input()))
dp = [[0 for i in range(3)] for i in range(N + 1)]
for i in range(N):
a, b, c = list(map(int, input().split()))
dp[i + 1][0] = max(dp[i][1], dp[i][2]) + a
dp[i + 1][1] = max(dp[i][0], dp[i][2]) + b
dp[i + 1][2] = max(dp[i][0], dp[i][1]) + c
print((max(dp[N])))
| N = int(eval(input()))
dp = [[0] * 3 for i in range(N + 1)]
for i in range(N):
a, b, c = list(map(int, input().split()))
dp[i + 1][0] = max(dp[i][1] + a, dp[i][2] + a, dp[i][0])
dp[i + 1][1] = max(dp[i][2] + b, dp[i][0] + b, dp[i][1])
dp[i + 1][2] = max(dp[i][0] + c, dp[i][1] + c, dp[i][2])
print((max(d... | false | 20 | [
"-dp = [[0 for i in range(3)] for i in range(N + 1)]",
"+dp = [[0] * 3 for i in range(N + 1)]",
"- dp[i + 1][0] = max(dp[i][1], dp[i][2]) + a",
"- dp[i + 1][1] = max(dp[i][0], dp[i][2]) + b",
"- dp[i + 1][2] = max(dp[i][0], dp[i][1]) + c",
"+ dp[i + 1][0] = max(dp[i][1] + a, dp[i][2] + a, dp[i... | false | 0.041399 | 0.090754 | 0.45616 | [
"s186684966",
"s812011505"
] |
u559196406 | p02802 | python | s297904818 | s144120122 | 312 | 214 | 4,596 | 10,764 | Accepted | Accepted | 31.41 | n,m = list(map(int,input().split()))
ac = [False]*n
count = [0]*n
a=0
b=0
for _ in range(m):
p,s = input().split()
if s == 'AC':
if ac[int(p)-1]==False:
ac[int(p)-1]=True
a+=1
b+=count[int(p)-1]
else:
if ac[int(p)-1]==False:
count... | n,m = list(map(int,input().split()))
ans_list = [False for _ in range(n+1)]
pe_list = [0 for _ in range(n+1)]
ac=0
pe=0
for _ in range(m):
p,s = input().split()
if not ans_list[int(p)]:
if s == 'AC':
ac+=1
pe+=pe_list[int(p)]
ans_list[int(p)]=True
... | 17 | 16 | 367 | 379 | n, m = list(map(int, input().split()))
ac = [False] * n
count = [0] * n
a = 0
b = 0
for _ in range(m):
p, s = input().split()
if s == "AC":
if ac[int(p) - 1] == False:
ac[int(p) - 1] = True
a += 1
b += count[int(p) - 1]
else:
if ac[int(p) - 1] == False:
... | n, m = list(map(int, input().split()))
ans_list = [False for _ in range(n + 1)]
pe_list = [0 for _ in range(n + 1)]
ac = 0
pe = 0
for _ in range(m):
p, s = input().split()
if not ans_list[int(p)]:
if s == "AC":
ac += 1
pe += pe_list[int(p)]
ans_list[int(p)] = True
... | false | 5.882353 | [
"-ac = [False] * n",
"-count = [0] * n",
"-a = 0",
"-b = 0",
"+ans_list = [False for _ in range(n + 1)]",
"+pe_list = [0 for _ in range(n + 1)]",
"+ac = 0",
"+pe = 0",
"- if s == \"AC\":",
"- if ac[int(p) - 1] == False:",
"- ac[int(p) - 1] = True",
"- a += 1",
... | false | 0.037054 | 0.038064 | 0.973466 | [
"s297904818",
"s144120122"
] |
u734169929 | p02627 | python | s497711093 | s283053513 | 34 | 27 | 9,064 | 8,996 | Accepted | Accepted | 20.59 | strr = eval(input())
if strr == "A" or strr =="B" or strr == "C" or strr == "D" or strr =="E" or strr =="F" or strr =="G" or strr =="H" or strr =="I" or strr =="J" or strr =="K" or strr =="L" or strr =="N" or strr =="M" or strr =="O" or strr =="P" or strr =="Q" or strr =="R" or strr =="S" or strr =="T" or strr =="U"... | a =eval(input())
if a.isupper() == True:
print("A")
else:
print("a") | 6 | 6 | 424 | 76 | strr = eval(input())
if (
strr == "A"
or strr == "B"
or strr == "C"
or strr == "D"
or strr == "E"
or strr == "F"
or strr == "G"
or strr == "H"
or strr == "I"
or strr == "J"
or strr == "K"
or strr == "L"
or strr == "N"
or strr == "M"
or strr == "O"
or strr ... | a = eval(input())
if a.isupper() == True:
print("A")
else:
print("a")
| false | 0 | [
"-strr = eval(input())",
"-if (",
"- strr == \"A\"",
"- or strr == \"B\"",
"- or strr == \"C\"",
"- or strr == \"D\"",
"- or strr == \"E\"",
"- or strr == \"F\"",
"- or strr == \"G\"",
"- or strr == \"H\"",
"- or strr == \"I\"",
"- or strr == \"J\"",
"- or st... | false | 0.036374 | 0.044309 | 0.820911 | [
"s497711093",
"s283053513"
] |
u905582793 | p03700 | python | s655900826 | s677697193 | 1,679 | 1,519 | 7,072 | 7,072 | Accepted | Accepted | 9.53 | n,a,b = list(map(int,input().split()))
hls = [int(eval(input())) for i in range(n)]
l = 0
r = 10**15
while l<r:
x = (l+r)//2
cnt = 0
for hp in hls:
if hp-x*b>0:
cnt += (hp-x*b+(a-b)-1)//(a-b)
if cnt>x:
l = x+1
elif cnt<x:
r = x
else:
ans = x
break
if l == r:
ans... | import sys
input = sys.stdin.readline
n,a,b = list(map(int,input().split()))
hls = [int(eval(input())) for i in range(n)]
l = 0
r = sum(hls)
while l<r:
x = (l+r)//2
cnt = 0
for hp in hls:
if hp-x*b>0:
cnt += (hp-x*b+(a-b)-1)//(a-b)
if cnt>x:
l = x+1
elif cnt<x:
r = x
else:
... | 20 | 22 | 324 | 366 | n, a, b = list(map(int, input().split()))
hls = [int(eval(input())) for i in range(n)]
l = 0
r = 10**15
while l < r:
x = (l + r) // 2
cnt = 0
for hp in hls:
if hp - x * b > 0:
cnt += (hp - x * b + (a - b) - 1) // (a - b)
if cnt > x:
l = x + 1
elif cnt < x:
r = x
... | import sys
input = sys.stdin.readline
n, a, b = list(map(int, input().split()))
hls = [int(eval(input())) for i in range(n)]
l = 0
r = sum(hls)
while l < r:
x = (l + r) // 2
cnt = 0
for hp in hls:
if hp - x * b > 0:
cnt += (hp - x * b + (a - b) - 1) // (a - b)
if cnt > x:
l ... | false | 9.090909 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"-r = 10**15",
"+r = sum(hls)"
] | false | 0.161215 | 0.047277 | 3.409991 | [
"s655900826",
"s677697193"
] |
u440566786 | p03142 | python | s968992414 | s364128514 | 1,024 | 436 | 158,768 | 61,104 | Accepted | Accepted | 57.42 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
n,m=map(int,input().split())
E=[[] for _ in range(n)]
R=[[] for _ in range(n)]
for _ in range(n-1+m):
u,v=map(int,input().split())
u-=1; v-=1
... | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 # 998244353
input=lambda:sys.stdin.readline().rstrip()
def resolve():
n, m = list(map(int,input().split()))
E = [[] for _ in range(n)]
indeg = [0] * n
for _ in range(n + m - 1):
u, v = list(map(int,input().split(... | 40 | 28 | 941 | 749 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def resolve():
n, m = map(int, input().split())
E = [[] for _ in range(n)]
R = [[] for _ in range(n)]
for _ in range(n - 1 + m):
u, v = map(int, input().split())
... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7 # 998244353
input = lambda: sys.stdin.readline().rstrip()
def resolve():
n, m = list(map(int, input().split()))
E = [[] for _ in range(n)]
indeg = [0] * n
for _ in range(n + m - 1):
u, v = list(map(int, input().s... | false | 30 | [
"-MOD = 10**9 + 7",
"+MOD = 10**9 + 7 # 998244353",
"- n, m = map(int, input().split())",
"+ n, m = list(map(int, input().split()))",
"- R = [[] for _ in range(n)]",
"- for _ in range(n - 1 + m):",
"- u, v = map(int, input().split())",
"+ indeg = [0] * n",
"+ for _ in range... | false | 0.035833 | 0.044104 | 0.812459 | [
"s968992414",
"s364128514"
] |
u133936772 | p02720 | python | s125878614 | s930249918 | 208 | 68 | 12,404 | 7,320 | Accepted | Accepted | 67.31 | from collections import *
k=int(eval(input()));q=deque(list(range(1,10)));c=0
while c<k:
t=q.popleft()
for j in range(max(t%10-1,0),min(t%10+2,10)): q+=[t*10+j]
c+=1
print(t) | k=int(eval(input()));l=list(range(1,10))
for i in l:
if len(l)>k: break
for j in range(max(i%10-1,0),min(i%10+2,10)): l.append(i*10+j)
print((l[k-1])) | 7 | 5 | 174 | 150 | from collections import *
k = int(eval(input()))
q = deque(list(range(1, 10)))
c = 0
while c < k:
t = q.popleft()
for j in range(max(t % 10 - 1, 0), min(t % 10 + 2, 10)):
q += [t * 10 + j]
c += 1
print(t)
| k = int(eval(input()))
l = list(range(1, 10))
for i in l:
if len(l) > k:
break
for j in range(max(i % 10 - 1, 0), min(i % 10 + 2, 10)):
l.append(i * 10 + j)
print((l[k - 1]))
| false | 28.571429 | [
"-from collections import *",
"-",
"-q = deque(list(range(1, 10)))",
"-c = 0",
"-while c < k:",
"- t = q.popleft()",
"- for j in range(max(t % 10 - 1, 0), min(t % 10 + 2, 10)):",
"- q += [t * 10 + j]",
"- c += 1",
"-print(t)",
"+l = list(range(1, 10))",
"+for i in l:",
"+ ... | false | 0.08719 | 0.040301 | 2.163495 | [
"s125878614",
"s930249918"
] |
u609061751 | p02909 | python | s476566324 | s012413347 | 175 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.29 | S=eval(input())
if S == 'Sunny':
print('Cloudy')
elif S=='Cloudy':
print('Rainy')
else:
print('Sunny') | import sys
input = sys.stdin.readline
weather = {"Sunny":"Cloudy", "Cloudy":"Rainy", "Rainy":"Sunny"}
print((weather[input().rstrip()]))
| 7 | 6 | 114 | 142 | S = eval(input())
if S == "Sunny":
print("Cloudy")
elif S == "Cloudy":
print("Rainy")
else:
print("Sunny")
| import sys
input = sys.stdin.readline
weather = {"Sunny": "Cloudy", "Cloudy": "Rainy", "Rainy": "Sunny"}
print((weather[input().rstrip()]))
| false | 14.285714 | [
"-S = eval(input())",
"-if S == \"Sunny\":",
"- print(\"Cloudy\")",
"-elif S == \"Cloudy\":",
"- print(\"Rainy\")",
"-else:",
"- print(\"Sunny\")",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+weather = {\"Sunny\": \"Cloudy\", \"Cloudy\": \"Rainy\", \"Rainy\": \"Sunny\"}",
"+p... | false | 0.040636 | 0.043567 | 0.932732 | [
"s476566324",
"s012413347"
] |
u168578024 | p02625 | python | s131495132 | s584412182 | 439 | 125 | 101,984 | 107,388 | Accepted | Accepted | 71.53 | fac=[1]*505050
inv=[1]*505050
finv=[1]*505050
mod=1000000007
for i in range(2,500010):
fac[i]=fac[i-1]*i%mod
inv[i]=-inv[mod%i]*(mod//i)%mod
finv[i]=finv[i-1]*inv[i]%mod
def C(n,r):
if n<0 or r<0 or n<r: return 0
return fac[n]*finv[n-r]%mod*finv[r]%mod
N,M=list(map(int,input().split()))
ans=0
... | fac=[1]*505050
inv=[1]*505050
finv=[1]*505050
mod=1000000007
for i in range(2,500010):
fac[i]=fac[i-1]*i%mod
inv[i]=-inv[mod%i]*(mod//i)%mod
finv[i]=finv[i-1]*inv[i]%mod
def C(n,r):
if n<0 or r<0 or n<r: return 0
return fac[n]*finv[n-r]%mod*finv[r]%mod
N,M=list(map(int,input().split()))
ans=0
... | 19 | 19 | 460 | 464 | fac = [1] * 505050
inv = [1] * 505050
finv = [1] * 505050
mod = 1000000007
for i in range(2, 500010):
fac[i] = fac[i - 1] * i % mod
inv[i] = -inv[mod % i] * (mod // i) % mod
finv[i] = finv[i - 1] * inv[i] % mod
def C(n, r):
if n < 0 or r < 0 or n < r:
return 0
return fac[n] * finv[n - r] %... | fac = [1] * 505050
inv = [1] * 505050
finv = [1] * 505050
mod = 1000000007
for i in range(2, 500010):
fac[i] = fac[i - 1] * i % mod
inv[i] = -inv[mod % i] * (mod // i) % mod
finv[i] = finv[i - 1] * inv[i] % mod
def C(n, r):
if n < 0 or r < 0 or n < r:
return 0
return fac[n] * finv[n - r] %... | false | 0 | [
"- * ((fac[M - i] * finv[M - N]) ** 2 % mod)",
"+ * ((fac[M - i] * finv[M - N] % mod) ** 2 % mod)"
] | false | 0.9841 | 0.909539 | 1.081976 | [
"s131495132",
"s584412182"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.