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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u698919163 | p02996 | python | s067392687 | s282905624 | 902 | 580 | 55,260 | 48,496 | Accepted | Accepted | 35.7 | N = int(eval(input()))
AB = [list(map(int,input().split())) for i in range(N)]
sortedAB = sorted(AB, key= lambda x: x[1])
import sys
work = 0
for i in range(N):
work += sortedAB[i][0]
if work > sortedAB[i][1]:
print('No')
sys.exit()
print('Yes') | N = int(eval(input()))
AB = [list(map(int,input().split())) for i in range(N)]
sort_AB = sorted(AB, key= lambda x: x[1])
ans = 'Yes'
tmp = 0
for i in range(N):
tmp += sort_AB[i][0]
if tmp > sort_AB[i][1]:
ans = 'No'
break
print(ans) | 15 | 14 | 289 | 274 | N = int(eval(input()))
AB = [list(map(int, input().split())) for i in range(N)]
sortedAB = sorted(AB, key=lambda x: x[1])
import sys
work = 0
for i in range(N):
work += sortedAB[i][0]
if work > sortedAB[i][1]:
print("No")
sys.exit()
print("Yes")
| N = int(eval(input()))
AB = [list(map(int, input().split())) for i in range(N)]
sort_AB = sorted(AB, key=lambda x: x[1])
ans = "Yes"
tmp = 0
for i in range(N):
tmp += sort_AB[i][0]
if tmp > sort_AB[i][1]:
ans = "No"
break
print(ans)
| false | 6.666667 | [
"-sortedAB = sorted(AB, key=lambda x: x[1])",
"-import sys",
"-",
"-work = 0",
"+sort_AB = sorted(AB, key=lambda x: x[1])",
"+ans = \"Yes\"",
"+tmp = 0",
"- work += sortedAB[i][0]",
"- if work > sortedAB[i][1]:",
"- print(\"No\")",
"- sys.exit()",
"-print(\"Yes\")",
"+ ... | false | 0.102538 | 0.076225 | 1.345215 | [
"s067392687",
"s282905624"
] |
u007550226 | p03700 | python | s377761456 | s242197255 | 1,903 | 1,184 | 8,280 | 8,280 | Accepted | Accepted | 37.78 | n,a,b= list(map(int,input().split()))
sh = sorted([int(eval(input())) for i in range(n)],reverse=True)
sumh = sum(sh)
def nibu(t):
rt=0
for i in range(n):
temp = -1*(-1*max(0,sh[i]-t*b)//(a-b))
if temp>0:rt+=-1*(-1*max(0,sh[i]-t*b)//(a-b))
else:break
if rt>t:return False... | n,a,b= list(map(int,input().split()))
sh = sorted([int(eval(input())) for i in range(n)],reverse=True)
sumh = sum(sh)
def nibu(t):
rt=0
for i in range(n):
temp = -1*(-1*max(0,sh[i]-t*b)//(a-b))
if temp>0:rt+=temp
else:break
if rt>t:return False
return True if t>=rt ... | 18 | 18 | 452 | 426 | n, a, b = list(map(int, input().split()))
sh = sorted([int(eval(input())) for i in range(n)], reverse=True)
sumh = sum(sh)
def nibu(t):
rt = 0
for i in range(n):
temp = -1 * (-1 * max(0, sh[i] - t * b) // (a - b))
if temp > 0:
rt += -1 * (-1 * max(0, sh[i] - t * b) // (a - b))
... | n, a, b = list(map(int, input().split()))
sh = sorted([int(eval(input())) for i in range(n)], reverse=True)
sumh = sum(sh)
def nibu(t):
rt = 0
for i in range(n):
temp = -1 * (-1 * max(0, sh[i] - t * b) // (a - b))
if temp > 0:
rt += temp
else:
break
if r... | false | 0 | [
"- rt += -1 * (-1 * max(0, sh[i] - t * b) // (a - b))",
"+ rt += temp"
] | false | 0.038833 | 0.037482 | 1.036051 | [
"s377761456",
"s242197255"
] |
u896847891 | p02885 | python | s005820913 | s301324721 | 19 | 17 | 3,188 | 2,940 | Accepted | Accepted | 10.53 | a,b=list(map(int,input().split()))
print((max(0,a-b*2))) | a, b = list(map(int, input().split()))
print((max(0, a-2*b))) | 2 | 2 | 49 | 54 | a, b = list(map(int, input().split()))
print((max(0, a - b * 2)))
| a, b = list(map(int, input().split()))
print((max(0, a - 2 * b)))
| false | 0 | [
"-print((max(0, a - b * 2)))",
"+print((max(0, a - 2 * b)))"
] | false | 0.048589 | 0.04844 | 1.00308 | [
"s005820913",
"s301324721"
] |
u077291787 | p02953 | python | s112423061 | s183868414 | 223 | 52 | 63,984 | 14,524 | Accepted | Accepted | 76.68 | # ABC136C - Build Stairs
def main():
n = int(eval(input()))
A = tuple(map(int, input().rstrip().split()))
cur = A[0]
for i in A[1:]:
if i == cur or i - 1 == cur:
continue
elif i > cur:
cur = i - 1
else:
print("No")
break... | # ABC136C - Build Stairs
def main():
n = int(eval(input()))
A = tuple(map(int, input().rstrip().split()))
cur = A[0]
for i in A[1:]:
if i > cur + 1:
cur = i - 1
if i < cur:
print("No")
break
else:
print("Yes")
if __name__ =... | 19 | 17 | 391 | 339 | # ABC136C - Build Stairs
def main():
n = int(eval(input()))
A = tuple(map(int, input().rstrip().split()))
cur = A[0]
for i in A[1:]:
if i == cur or i - 1 == cur:
continue
elif i > cur:
cur = i - 1
else:
print("No")
break
else:
... | # ABC136C - Build Stairs
def main():
n = int(eval(input()))
A = tuple(map(int, input().rstrip().split()))
cur = A[0]
for i in A[1:]:
if i > cur + 1:
cur = i - 1
if i < cur:
print("No")
break
else:
print("Yes")
if __name__ == "__main__":
... | false | 10.526316 | [
"- if i == cur or i - 1 == cur:",
"- continue",
"- elif i > cur:",
"+ if i > cur + 1:",
"- else:",
"+ if i < cur:"
] | false | 0.064988 | 0.034802 | 1.867336 | [
"s112423061",
"s183868414"
] |
u281303342 | p04045 | python | s621961588 | s044260342 | 84 | 73 | 3,316 | 2,940 | Accepted | Accepted | 13.1 | N,K = list(map(int,input().split()))
D = set(input().split())
while True:
if not set(str(N)) & D:
break
N += 1
print(N) | N,K = list(map(int,input().split()))
D = set(input().split())
for i in range(N,100000):
# 禁止文字との共通集合がなければ良い
if not D & set(str(i)):
break
print(i) | 7 | 9 | 135 | 166 | N, K = list(map(int, input().split()))
D = set(input().split())
while True:
if not set(str(N)) & D:
break
N += 1
print(N)
| N, K = list(map(int, input().split()))
D = set(input().split())
for i in range(N, 100000):
# 禁止文字との共通集合がなければ良い
if not D & set(str(i)):
break
print(i)
| false | 22.222222 | [
"-while True:",
"- if not set(str(N)) & D:",
"+for i in range(N, 100000):",
"+ # 禁止文字との共通集合がなければ良い",
"+ if not D & set(str(i)):",
"- N += 1",
"-print(N)",
"+print(i)"
] | false | 0.035496 | 0.043576 | 0.814569 | [
"s621961588",
"s044260342"
] |
u564589929 | p02832 | python | s778726410 | s735610507 | 141 | 102 | 23,976 | 25,372 | Accepted | Accepted | 27.66 | from collections import deque
n = int(eval(input()))
A = deque(list(map(int, input().split())))
cnt = 0
flag_empty = False
flag_end = False
if not 1 in A:
cnt = -1
else:
for i in range(1, n+1):
if not i in A:
cnt += len(A)
break
while 1:
a = A.popleft()
if len(A) == ... | from collections import deque
n = int(eval(input()))
A = deque(list(map(int, input().split())))
next_ = 1
cnt = 0
for i in A:
if i == next_:
next_ += 1
else:
cnt += 1
if cnt == n:
cnt = -1
print(cnt) | 27 | 14 | 467 | 215 | from collections import deque
n = int(eval(input()))
A = deque(list(map(int, input().split())))
cnt = 0
flag_empty = False
flag_end = False
if not 1 in A:
cnt = -1
else:
for i in range(1, n + 1):
if not i in A:
cnt += len(A)
break
while 1:
a = A.popleft()
... | from collections import deque
n = int(eval(input()))
A = deque(list(map(int, input().split())))
next_ = 1
cnt = 0
for i in A:
if i == next_:
next_ += 1
else:
cnt += 1
if cnt == n:
cnt = -1
print(cnt)
| false | 48.148148 | [
"+next_ = 1",
"-flag_empty = False",
"-flag_end = False",
"-if not 1 in A:",
"+for i in A:",
"+ if i == next_:",
"+ next_ += 1",
"+ else:",
"+ cnt += 1",
"+if cnt == n:",
"-else:",
"- for i in range(1, n + 1):",
"- if not i in A:",
"- cnt += len(A)"... | false | 0.059478 | 0.097169 | 0.612111 | [
"s778726410",
"s735610507"
] |
u347640436 | p03127 | python | s361317774 | s628951733 | 212 | 81 | 14,252 | 16,200 | Accepted | Accepted | 61.79 | N = int(eval(input()))
A = list(map(int, input().split()))
while True:
A.sort()
t = sum(A)
for i in range(1, N):
if A[i] % A[0] == 0:
A[i] = A[0]
else:
A[i] = A[i] % A[0]
if sum(A) == t:
break
print((A[0]))
| from functools import reduce
from fractions import gcd
N = int(eval(input()))
A = list(map(int, input().split()))
print((reduce(gcd, A)))
| 14 | 7 | 277 | 138 | N = int(eval(input()))
A = list(map(int, input().split()))
while True:
A.sort()
t = sum(A)
for i in range(1, N):
if A[i] % A[0] == 0:
A[i] = A[0]
else:
A[i] = A[i] % A[0]
if sum(A) == t:
break
print((A[0]))
| from functools import reduce
from fractions import gcd
N = int(eval(input()))
A = list(map(int, input().split()))
print((reduce(gcd, A)))
| false | 50 | [
"+from functools import reduce",
"+from fractions import gcd",
"+",
"-while True:",
"- A.sort()",
"- t = sum(A)",
"- for i in range(1, N):",
"- if A[i] % A[0] == 0:",
"- A[i] = A[0]",
"- else:",
"- A[i] = A[i] % A[0]",
"- if sum(A) == t:",
"- ... | false | 0.121322 | 0.107226 | 1.131455 | [
"s361317774",
"s628951733"
] |
u607155447 | p02687 | python | s916626082 | s546102890 | 30 | 24 | 9,092 | 8,900 | Accepted | Accepted | 20 | s = {'ABC': 'ARC', 'ARC': 'ABC'}
print((s[eval(input())])) | N = eval(input())
if N == 'ABC':
print('ARC')
else:
print('ABC') | 2 | 6 | 51 | 72 | s = {"ABC": "ARC", "ARC": "ABC"}
print((s[eval(input())]))
| N = eval(input())
if N == "ABC":
print("ARC")
else:
print("ABC")
| false | 66.666667 | [
"-s = {\"ABC\": \"ARC\", \"ARC\": \"ABC\"}",
"-print((s[eval(input())]))",
"+N = eval(input())",
"+if N == \"ABC\":",
"+ print(\"ARC\")",
"+else:",
"+ print(\"ABC\")"
] | false | 0.039991 | 0.04087 | 0.978514 | [
"s916626082",
"s546102890"
] |
u545368057 | p02844 | python | s031057244 | s802660225 | 658 | 520 | 42,220 | 41,180 | Accepted | Accepted | 20.97 | N = int(eval(input()))
S = eval(input())
#0なし
numlist = [""]
dp = [False] * 1000
for s in S:
tmp = []
for n in numlist:
if len(n+s) == 3:
dp[int(n+s)] = True
if len(n+s) < 3:
tmp.append(n+s)
numlist.extend(tmp)
numlist = list(set(numlist))
print((sum... | N = int(eval(input()))
S = eval(input())
X = ["{:03d}".format(i) for i in range(1000)]
# print(X)
ans = 0
for x in X:
now = 0
for s in S:
if s == x[now]:
now += 1
if now == 3:
ans += 1
break
print(ans) | 15 | 14 | 312 | 262 | N = int(eval(input()))
S = eval(input())
# 0なし
numlist = [""]
dp = [False] * 1000
for s in S:
tmp = []
for n in numlist:
if len(n + s) == 3:
dp[int(n + s)] = True
if len(n + s) < 3:
tmp.append(n + s)
numlist.extend(tmp)
numlist = list(set(numlist))
print((sum(dp))... | N = int(eval(input()))
S = eval(input())
X = ["{:03d}".format(i) for i in range(1000)]
# print(X)
ans = 0
for x in X:
now = 0
for s in S:
if s == x[now]:
now += 1
if now == 3:
ans += 1
break
print(ans)
| false | 6.666667 | [
"-# 0なし",
"-numlist = [\"\"]",
"-dp = [False] * 1000",
"-for s in S:",
"- tmp = []",
"- for n in numlist:",
"- if len(n + s) == 3:",
"- dp[int(n + s)] = True",
"- if len(n + s) < 3:",
"- tmp.append(n + s)",
"- numlist.extend(tmp)",
"- numlist = l... | false | 0.032656 | 0.033608 | 0.97169 | [
"s031057244",
"s802660225"
] |
u498487134 | p02802 | python | s981514855 | s768433091 | 573 | 177 | 45,656 | 75,776 | Accepted | Accepted | 69.11 | N,M=list(map(int,input().split()))
AC=[0]*N
WA=[0]*N
for i in range(M):
p,s=list(map(str,input().split()))
p=int(p)
if s=="AC":
AC[p-1]=1
else:
if AC[p-1]==0:
WA[p-1]+=1
for i in range(N):
if AC[i]==0:
WA[i]=0
print((sum(AC),sum(WA))) |
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
N,M=MI()
AC=[0]*N
WA=[0]*N
for _ in range(M):
p,s=input().split()
p=int(p)-1
if s=="AC":
... | 17 | 29 | 294 | 529 | N, M = list(map(int, input().split()))
AC = [0] * N
WA = [0] * N
for i in range(M):
p, s = list(map(str, input().split()))
p = int(p)
if s == "AC":
AC[p - 1] = 1
else:
if AC[p - 1] == 0:
WA[p - 1] += 1
for i in range(N):
if AC[i] == 0:
WA[i] = 0
print((sum(AC), su... | def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
mod = 10**9 + 7
N, M = MI()
AC = [0] * N
WA = [0] * N
for _ in range(M):
p, s = input().split()
p = int(p) - 1
if... | false | 41.37931 | [
"-N, M = list(map(int, input().split()))",
"-AC = [0] * N",
"-WA = [0] * N",
"-for i in range(M):",
"- p, s = list(map(str, input().split()))",
"- p = int(p)",
"- if s == \"AC\":",
"- AC[p - 1] = 1",
"- else:",
"- if AC[p - 1] == 0:",
"- WA[p - 1] += 1",
"-... | false | 0.049593 | 0.073723 | 0.672701 | [
"s981514855",
"s768433091"
] |
u714225686 | p03273 | python | s288807857 | s165586801 | 47 | 38 | 5,456 | 5,204 | Accepted | Accepted | 19.15 | import math
import sys
import queue
from collections import Counter
from itertools import accumulate
from fractions import gcd
from functools import reduce
def lcm(a, b):
return a * b // gcd(a, b)
def combination_count(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)... | import math
import sys
import queue
from collections import Counter
from itertools import accumulate
from fractions import gcd
from functools import reduce
def lcm(a, b):
return a * b // gcd(a, b)
def combination_count(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)... | 65 | 52 | 1,449 | 1,295 | import math
import sys
import queue
from collections import Counter
from itertools import accumulate
from fractions import gcd
from functools import reduce
def lcm(a, b):
return a * b // gcd(a, b)
def combination_count(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def perm... | import math
import sys
import queue
from collections import Counter
from itertools import accumulate
from fractions import gcd
from functools import reduce
def lcm(a, b):
return a * b // gcd(a, b)
def combination_count(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def perm... | false | 20 | [
"- NL = []",
"- for l in L:",
"- if \"#\" in l:",
"- NL.append(l)",
"- # リストの転置",
"- # https://note.nkmk.me/python-list-transpose/",
"- L = list(zip(*NL))",
"- NL2 = []",
"- for l in L:",
"- if \"#\" in l:",
"- NL2.append(l)",
"- # もと... | false | 0.043067 | 0.144758 | 0.297511 | [
"s288807857",
"s165586801"
] |
u924691798 | p02913 | python | s690259465 | s354789260 | 395 | 75 | 43,612 | 3,416 | Accepted | Accepted | 81.01 | N = int(eval(input()))
S = eval(input())
def f(m):
res = False
hs = []
for i in range(0,N-m+1):
hs.append(hash(S[i:i+m]))
for i in range(0,N-m+1):
if hash(S[i:i+m]) in hs[i+m:]:
res = True
break
return res
l = 0
r = N//2+1
while (r-l)>1:
m... | N = int(eval(input()))
S = eval(input())
def f(m):
se = set()
arr = [None]*N
for i in range(0,N-m+1):
if i >= m:
se.add(arr[i-m])
arr[i] = hash(S[i:i+m])
if arr[i] in se:
return True
return False
l = 0
r = N//2+1
while (r-l)>1:
mid =... | 22 | 23 | 392 | 388 | N = int(eval(input()))
S = eval(input())
def f(m):
res = False
hs = []
for i in range(0, N - m + 1):
hs.append(hash(S[i : i + m]))
for i in range(0, N - m + 1):
if hash(S[i : i + m]) in hs[i + m :]:
res = True
break
return res
l = 0
r = N // 2 + 1
while (r... | N = int(eval(input()))
S = eval(input())
def f(m):
se = set()
arr = [None] * N
for i in range(0, N - m + 1):
if i >= m:
se.add(arr[i - m])
arr[i] = hash(S[i : i + m])
if arr[i] in se:
return True
return False
l = 0
r = N // 2 + 1
while (r - l) > 1:
... | false | 4.347826 | [
"- res = False",
"- hs = []",
"+ se = set()",
"+ arr = [None] * N",
"- hs.append(hash(S[i : i + m]))",
"- for i in range(0, N - m + 1):",
"- if hash(S[i : i + m]) in hs[i + m :]:",
"- res = True",
"- break",
"- return res",
"+ if i >= ... | false | 0.073092 | 0.060794 | 1.202283 | [
"s690259465",
"s354789260"
] |
u753803401 | p02818 | python | s960802400 | s557680913 | 185 | 169 | 38,384 | 38,384 | Accepted | Accepted | 8.65 | import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
a, b, k = list(map(int, readline().split()))
print((a - min(a, k), b - min(k - min(a, k), b)))
if __name__ == '__main__':
solve()
| import sys
def solve():
input = sys.stdin.readline
mod = 10 ** 9 + 7
a, b, k = list(map(int, input().rstrip('\n').split()))
t = min(a, k)
a -= t
k -= t
t = min(b, k)
b -= t
print((a, b))
if __name__ == '__main__':
solve()
| 12 | 17 | 242 | 280 | import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10**9 + 7
a, b, k = list(map(int, readline().split()))
print((a - min(a, k), b - min(k - min(a, k), b)))
if __name__ == "__main__":
solve()
| import sys
def solve():
input = sys.stdin.readline
mod = 10**9 + 7
a, b, k = list(map(int, input().rstrip("\n").split()))
t = min(a, k)
a -= t
k -= t
t = min(b, k)
b -= t
print((a, b))
if __name__ == "__main__":
solve()
| false | 29.411765 | [
"- readline = sys.stdin.buffer.readline",
"+ input = sys.stdin.readline",
"- a, b, k = list(map(int, readline().split()))",
"- print((a - min(a, k), b - min(k - min(a, k), b)))",
"+ a, b, k = list(map(int, input().rstrip(\"\\n\").split()))",
"+ t = min(a, k)",
"+ a -= t",
"+ k ... | false | 0.038975 | 0.158984 | 0.245152 | [
"s960802400",
"s557680913"
] |
u953237709 | p03148 | python | s357379122 | s554580465 | 530 | 433 | 30,940 | 22,964 | Accepted | Accepted | 18.3 | from heapq import heappop, heappush
n, nTake = list(map(int, input().split()))
a = sorted([tuple(map(int, input().split())) for _ in range(n)], key=lambda x: (-x[1], x[0]))
totalTaste = 0
same = []
types = set()
for i in range(nTake):
type, taste = a[i]
totalTaste += taste
if type not in types:... | n, nTake = list(map(int, input().split()))
a = sorted([tuple(map(int, input().split())) for _ in range(n)], key=lambda x: -x[1])
totalTaste = 0
same = []
types = set()
for i in range(nTake):
type, taste = a[i]
totalTaste += taste
if type not in types:
types.add(type)
else:
s... | 34 | 30 | 838 | 778 | from heapq import heappop, heappush
n, nTake = list(map(int, input().split()))
a = sorted(
[tuple(map(int, input().split())) for _ in range(n)], key=lambda x: (-x[1], x[0])
)
totalTaste = 0
same = []
types = set()
for i in range(nTake):
type, taste = a[i]
totalTaste += taste
if type not in types:
... | n, nTake = list(map(int, input().split()))
a = sorted([tuple(map(int, input().split())) for _ in range(n)], key=lambda x: -x[1])
totalTaste = 0
same = []
types = set()
for i in range(nTake):
type, taste = a[i]
totalTaste += taste
if type not in types:
types.add(type)
else:
same.append(ta... | false | 11.764706 | [
"-from heapq import heappop, heappush",
"-",
"-a = sorted(",
"- [tuple(map(int, input().split())) for _ in range(n)], key=lambda x: (-x[1], x[0])",
"-)",
"+a = sorted([tuple(map(int, input().split())) for _ in range(n)], key=lambda x: -x[1])",
"- heappush(same, taste)",
"+ same.append... | false | 0.045266 | 0.03702 | 1.222739 | [
"s357379122",
"s554580465"
] |
u964904181 | p02571 | python | s196457698 | s374017570 | 44 | 36 | 9,016 | 9,000 | Accepted | Accepted | 18.18 | S = eval(input())
T = eval(input())
# S = "cabacc"
# T = "abc"
lt = len(T)
def diff(s1, s2):
d = len(s1)
d -= len([i for i,j in zip(s1, s2) if i == j])
return d
dlen = 1000000000
for i in range(len(S)):
if i + lt <= len(S):
dlen = min(dlen, diff(T, S[i:i+lt]))
print(dlen... | S = eval(input())
T = eval(input())
lt, ls = len(T), len(S)
def diff(s1, s2):
d = len(s1)
d -= len([i for i,j in zip(s1, s2) if i == j])
return d
dlen = min([diff(T, S[i:i+lt]) for i in range(ls) if i + lt <= ls])
print(dlen)
| 20 | 14 | 310 | 244 | S = eval(input())
T = eval(input())
# S = "cabacc"
# T = "abc"
lt = len(T)
def diff(s1, s2):
d = len(s1)
d -= len([i for i, j in zip(s1, s2) if i == j])
return d
dlen = 1000000000
for i in range(len(S)):
if i + lt <= len(S):
dlen = min(dlen, diff(T, S[i : i + lt]))
print(dlen)
| S = eval(input())
T = eval(input())
lt, ls = len(T), len(S)
def diff(s1, s2):
d = len(s1)
d -= len([i for i, j in zip(s1, s2) if i == j])
return d
dlen = min([diff(T, S[i : i + lt]) for i in range(ls) if i + lt <= ls])
print(dlen)
| false | 30 | [
"-# S = \"cabacc\"",
"-# T = \"abc\"",
"-lt = len(T)",
"+lt, ls = len(T), len(S)",
"-dlen = 1000000000",
"-for i in range(len(S)):",
"- if i + lt <= len(S):",
"- dlen = min(dlen, diff(T, S[i : i + lt]))",
"+dlen = min([diff(T, S[i : i + lt]) for i in range(ls) if i + lt <= ls])"
] | false | 0.036441 | 0.035797 | 1.017989 | [
"s196457698",
"s374017570"
] |
u498487134 | p03043 | python | s808625394 | s039107698 | 180 | 67 | 38,896 | 63,968 | Accepted | Accepted | 62.78 | N,K=list(map(int,input().split()))
ans=0
n=20
p=[1]*n
for i in range(n-1):
p[i+1]=p[i]*2
for i in range(1,N+1):
temp=0
for j in range(n):
if i*p[j]>=K:
temp=j
break
ans+=1/N/p[temp]
print(ans) | import sys
input = sys.stdin.readline
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
N,K=MI()
ans=0
for i in range(1,N+1):
temp=1/N
score=i
while score<K:... | 17 | 23 | 257 | 413 | N, K = list(map(int, input().split()))
ans = 0
n = 20
p = [1] * n
for i in range(n - 1):
p[i + 1] = p[i] * 2
for i in range(1, N + 1):
temp = 0
for j in range(n):
if i * p[j] >= K:
temp = j
break
ans += 1 / N / p[temp]
print(ans)
| import sys
input = sys.stdin.readline
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
mod = 10**9 + 7
N, K = MI()
ans = 0
for i in range(1, N + 1):
temp = 1 / N
score = i... | false | 26.086957 | [
"-N, K = list(map(int, input().split()))",
"-ans = 0",
"-n = 20",
"-p = [1] * n",
"-for i in range(n - 1):",
"- p[i + 1] = p[i] * 2",
"-for i in range(1, N + 1):",
"- temp = 0",
"- for j in range(n):",
"- if i * p[j] >= K:",
"- temp = j",
"- break",
"- ... | false | 0.12193 | 0.05141 | 2.371697 | [
"s808625394",
"s039107698"
] |
u580697892 | p03449 | python | s075206756 | s837077391 | 312 | 18 | 21,168 | 3,064 | Accepted | Accepted | 94.23 | # coding: utf-8
import numpy as np
N = int(eval(input()))
A = []
for _ in range(2):
A.append(list(map(int, input().split())))
dp = [[0] * N] * 2
dp = np.array(dp)
dp[0][0] = A[0][0]
dp[1][0] = A[0][0] + A[1][0]
for i in range(1, N):
dp[0][i] = dp[0][i-1] + A[0][i]
dp[1][i] = max(dp[0][i], dp[1][... | # coding: utf-8
N = int(eval(input()))
A = []
for _ in range(2):
A.append(list(map(int, input().split())))
dp = [[0 for _ in range(N)] for _ in range(2)]
# dp = np.array(dp)
dp[0][0] = A[0][0]
dp[1][0] = A[0][0] + A[1][0]
for i in range(1, N):
dp[0][i] = dp[0][i-1] + A[0][i]
dp[1][i] = max(dp[0][... | 14 | 13 | 348 | 358 | # coding: utf-8
import numpy as np
N = int(eval(input()))
A = []
for _ in range(2):
A.append(list(map(int, input().split())))
dp = [[0] * N] * 2
dp = np.array(dp)
dp[0][0] = A[0][0]
dp[1][0] = A[0][0] + A[1][0]
for i in range(1, N):
dp[0][i] = dp[0][i - 1] + A[0][i]
dp[1][i] = max(dp[0][i], dp[1][i - 1]) +... | # coding: utf-8
N = int(eval(input()))
A = []
for _ in range(2):
A.append(list(map(int, input().split())))
dp = [[0 for _ in range(N)] for _ in range(2)]
# dp = np.array(dp)
dp[0][0] = A[0][0]
dp[1][0] = A[0][0] + A[1][0]
for i in range(1, N):
dp[0][i] = dp[0][i - 1] + A[0][i]
dp[1][i] = max(dp[0][i], dp[1]... | false | 7.142857 | [
"-import numpy as np",
"-",
"-dp = [[0] * N] * 2",
"-dp = np.array(dp)",
"+dp = [[0 for _ in range(N)] for _ in range(2)]",
"+# dp = np.array(dp)"
] | false | 0.345898 | 0.033392 | 10.358721 | [
"s075206756",
"s837077391"
] |
u786082266 | p03700 | python | s429647813 | s510106357 | 1,405 | 879 | 19,312 | 18,580 | Accepted | Accepted | 37.44 | import numpy as np
n, a, b = list(map(int, input().split()))
l = []
for i in range(n):
l.append(eval(input()))
ll = np.array(l)
ll.sort()
ll = ll[::-1]
# print count
def solve(count):
q = ll - b * count
t = q > 0
if a > b:
p = (q - 1) / (a - b) + 1
else:
p = q
p = p[p > 0]
if p.sum()... |
import numpy as np
n, a, b = list(map(int, input().split()))
l = []
for i in range(n):
l.append(eval(input()))
ll = np.array(l)
ll.sort()
ll = ll[::-1]
def solve(hp, count):
q = hp - b * count
t = q > 0
if a > b:
p = (q - 1) / (a - b) + 1
else:
p = q
p = p[p > 0]
if p.sum() <= count... | 40 | 40 | 515 | 514 | import numpy as np
n, a, b = list(map(int, input().split()))
l = []
for i in range(n):
l.append(eval(input()))
ll = np.array(l)
ll.sort()
ll = ll[::-1]
# print count
def solve(count):
q = ll - b * count
t = q > 0
if a > b:
p = (q - 1) / (a - b) + 1
else:
p = q
p = p[p > 0]
i... | import numpy as np
n, a, b = list(map(int, input().split()))
l = []
for i in range(n):
l.append(eval(input()))
ll = np.array(l)
ll.sort()
ll = ll[::-1]
def solve(hp, count):
q = hp - b * count
t = q > 0
if a > b:
p = (q - 1) / (a - b) + 1
else:
p = q
p = p[p > 0]
if p.sum(... | false | 0 | [
"-# print count",
"-def solve(count):",
"- q = ll - b * count",
"+",
"+",
"+def solve(hp, count):",
"+ q = hp - b * count",
"- if solve(m):",
"+ if solve(ll, m):",
"- if solve(1):",
"+ if solve(ll, 1):"
] | false | 0.199785 | 0.890745 | 0.22429 | [
"s429647813",
"s510106357"
] |
u514401521 | p02603 | python | s844423458 | s165548923 | 80 | 67 | 62,060 | 64,268 | Accepted | Accepted | 16.25 | import sys
N = int(eval(input()))
A = list(map(int, input().split()))
kai = [False] * N
uri = [False] * N
# 買いポイント探す
i = 0
# すべて同じ株価or単調減少
tmp = A[0]
flag = True
for i in range(1, N):
if A[i-1] < A[i]:
flag = False
if flag:
print((1000))
sys.exit(0)
start = 10000
stop = 10... | N = int(eval(input()))
A = list(map(int, input().split()))
dp = [0]*(N)
dp[0] = 1000
for i in range(1,N):
dp[i] = dp[i-1]
for j in range(i):
dp[i] = max(dp[i], (dp[j]//A[j])*A[i]+dp[j]%A[j])
ans = 0
for i in range(N):
ans = max(ans, dp[i])
print(ans) | 54 | 14 | 1,007 | 279 | import sys
N = int(eval(input()))
A = list(map(int, input().split()))
kai = [False] * N
uri = [False] * N
# 買いポイント探す
i = 0
# すべて同じ株価or単調減少
tmp = A[0]
flag = True
for i in range(1, N):
if A[i - 1] < A[i]:
flag = False
if flag:
print((1000))
sys.exit(0)
start = 10000
stop = 10000
for i in range(1, N)... | N = int(eval(input()))
A = list(map(int, input().split()))
dp = [0] * (N)
dp[0] = 1000
for i in range(1, N):
dp[i] = dp[i - 1]
for j in range(i):
dp[i] = max(dp[i], (dp[j] // A[j]) * A[i] + dp[j] % A[j])
ans = 0
for i in range(N):
ans = max(ans, dp[i])
print(ans)
| false | 74.074074 | [
"-import sys",
"-",
"-kai = [False] * N",
"-uri = [False] * N",
"-# 買いポイント探す",
"-i = 0",
"-# すべて同じ株価or単調減少",
"-tmp = A[0]",
"-flag = True",
"+dp = [0] * (N)",
"+dp[0] = 1000",
"- if A[i - 1] < A[i]:",
"- flag = False",
"-if flag:",
"- print((1000))",
"- sys.exit(0)",
... | false | 0.046561 | 0.110803 | 0.420217 | [
"s844423458",
"s165548923"
] |
u562935282 | p03032 | python | s505614632 | s979449357 | 962 | 27 | 3,188 | 3,060 | Accepted | Accepted | 97.19 | from heapq import heapify, heappop
N, K = list(map(int, input().split()))
vl = list(map(int, input().split()))
vr = list(reversed(vl))
sum_L = [0]
for vv in vl:
sum_L.append(sum_L[-1] + vv)
sum_R = [0]
for vv in vr:
sum_R.append(sum_R[-1] + vv)
ans = 0
for pick in range(min(K, N) + 1):
for... | N, K = list(map(int, input().split(" ")))
v = list(map(int, input().split(" ")))
pick_max = min(N, K)
ans = 0
for left in range(pick_max + 1):
for right in range(pick_max - left + 1):
t = v[:left] + v[N - right:]
m = sorted([x for x in t if x < 0])[:K - left - right]
ans = max(ans,... | 31 | 11 | 732 | 347 | from heapq import heapify, heappop
N, K = list(map(int, input().split()))
vl = list(map(int, input().split()))
vr = list(reversed(vl))
sum_L = [0]
for vv in vl:
sum_L.append(sum_L[-1] + vv)
sum_R = [0]
for vv in vr:
sum_R.append(sum_R[-1] + vv)
ans = 0
for pick in range(min(K, N) + 1):
for to_remove in ran... | N, K = list(map(int, input().split(" ")))
v = list(map(int, input().split(" ")))
pick_max = min(N, K)
ans = 0
for left in range(pick_max + 1):
for right in range(pick_max - left + 1):
t = v[:left] + v[N - right :]
m = sorted([x for x in t if x < 0])[: K - left - right]
ans = max(ans, sum(t) ... | false | 64.516129 | [
"-from heapq import heapify, heappop",
"-",
"-N, K = list(map(int, input().split()))",
"-vl = list(map(int, input().split()))",
"-vr = list(reversed(vl))",
"-sum_L = [0]",
"-for vv in vl:",
"- sum_L.append(sum_L[-1] + vv)",
"-sum_R = [0]",
"-for vv in vr:",
"- sum_R.append(sum_R[-1] + vv)"... | false | 0.084289 | 0.036113 | 2.334025 | [
"s505614632",
"s979449357"
] |
u130900604 | p02613 | python | s535989745 | s891243374 | 192 | 173 | 78,748 | 78,640 | Accepted | Accepted | 9.9 | # import time
# t1=time.time()
def LI():return list(map(int,input().split()))
def I(): return int(eval(input()))
from collections import deque, Counter, defaultdict
from heapq import heappop, heappush
# from pprint import pprint
# import numpy as np
n=I()
s=[eval(input()) for _ in range(n)]
sc=Counter(s)
p... | from collections import Counter
n=int(eval(input()))
s=[eval(input()) for _ in range(n)]
sc=Counter(s)
print(("AC x {}".format(sc["AC"])))
print(("WA x {}".format(sc["WA"])))
print(("TLE x {}".format(sc["TLE"])))
print(("RE x {}".format(sc["RE"]))) | 16 | 8 | 448 | 235 | # import time
# t1=time.time()
def LI():
return list(map(int, input().split()))
def I():
return int(eval(input()))
from collections import deque, Counter, defaultdict
from heapq import heappop, heappush
# from pprint import pprint
# import numpy as np
n = I()
s = [eval(input()) for _ in range(n)]
sc = Coun... | from collections import Counter
n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
sc = Counter(s)
print(("AC x {}".format(sc["AC"])))
print(("WA x {}".format(sc["WA"])))
print(("TLE x {}".format(sc["TLE"])))
print(("RE x {}".format(sc["RE"])))
| false | 50 | [
"-# import time",
"-# t1=time.time()",
"-def LI():",
"- return list(map(int, input().split()))",
"+from collections import Counter",
"-",
"-def I():",
"- return int(eval(input()))",
"-",
"-",
"-from collections import deque, Counter, defaultdict",
"-from heapq import heappop, heappush",
... | false | 0.040571 | 0.039024 | 1.039653 | [
"s535989745",
"s891243374"
] |
u518378780 | p03379 | python | s015322473 | s909307965 | 395 | 301 | 27,300 | 25,472 | Accepted | Accepted | 23.8 | import statistics
n = int(eval(input()))
x = [int(_) for _ in input().split()]
m1 = statistics.median_low(x)
m2 = statistics.median_high(x)
for i in range(n):
if x[i] <= m1:
print(m2)
else:
print(m1)
| n = int(eval(input()))
x = [int(_) for _ in input().split()]
l = sorted(x)
m1 = l[n//2 - 1]
m2 = l[n//2]
for i in range(n):
if x[i] <= m1:
print(m2)
else:
print(m1)
| 12 | 10 | 231 | 192 | import statistics
n = int(eval(input()))
x = [int(_) for _ in input().split()]
m1 = statistics.median_low(x)
m2 = statistics.median_high(x)
for i in range(n):
if x[i] <= m1:
print(m2)
else:
print(m1)
| n = int(eval(input()))
x = [int(_) for _ in input().split()]
l = sorted(x)
m1 = l[n // 2 - 1]
m2 = l[n // 2]
for i in range(n):
if x[i] <= m1:
print(m2)
else:
print(m1)
| false | 16.666667 | [
"-import statistics",
"-",
"-m1 = statistics.median_low(x)",
"-m2 = statistics.median_high(x)",
"+l = sorted(x)",
"+m1 = l[n // 2 - 1]",
"+m2 = l[n // 2]"
] | false | 0.055002 | 0.075624 | 0.72731 | [
"s015322473",
"s909307965"
] |
u698479721 | p03325 | python | s040742536 | s374176844 | 141 | 79 | 4,140 | 4,148 | Accepted | Accepted | 43.97 | N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
k = 0
while k < N:
if A[k] % 2 == 0:
ans += 1
A[k] = A[k]//2
else:
k += 1
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
for nums in A:
while nums%2==0:
nums = nums//2
ans += 1
print(ans) | 12 | 8 | 175 | 144 | N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
k = 0
while k < N:
if A[k] % 2 == 0:
ans += 1
A[k] = A[k] // 2
else:
k += 1
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
for nums in A:
while nums % 2 == 0:
nums = nums // 2
ans += 1
print(ans)
| false | 33.333333 | [
"-k = 0",
"-while k < N:",
"- if A[k] % 2 == 0:",
"+for nums in A:",
"+ while nums % 2 == 0:",
"+ nums = nums // 2",
"- A[k] = A[k] // 2",
"- else:",
"- k += 1"
] | false | 0.036627 | 0.036496 | 1.003605 | [
"s040742536",
"s374176844"
] |
u594567187 | p03295 | python | s431333772 | s393097942 | 703 | 414 | 63,320 | 21,336 | Accepted | Accepted | 41.11 | islands, requests = list(map(int, input().split(" ")))
req = []
for r in range(requests):
a, b = list(map(int, input().split(" ")))
req.append([a, b])
req = sorted(req, key = lambda x:x[1])
answer = 1
temp_end = req[0][1]
for r in req:
if r[0] >= temp_end:
temp_end = r[1]
answer +... | length, req = list(map(int, input().split(" ")))
target = []
for i in range(req):
s, e = list(map(int, input().split(" ")))
target.append([s, e])
target.sort(key = lambda x: x[1])
answer = 0
before_e = -1
for s, e in target:
# print(before_e, s, e)
if s < before_e:
answer += 1
el... | 13 | 15 | 326 | 354 | islands, requests = list(map(int, input().split(" ")))
req = []
for r in range(requests):
a, b = list(map(int, input().split(" ")))
req.append([a, b])
req = sorted(req, key=lambda x: x[1])
answer = 1
temp_end = req[0][1]
for r in req:
if r[0] >= temp_end:
temp_end = r[1]
answer += 1
print(an... | length, req = list(map(int, input().split(" ")))
target = []
for i in range(req):
s, e = list(map(int, input().split(" ")))
target.append([s, e])
target.sort(key=lambda x: x[1])
answer = 0
before_e = -1
for s, e in target:
# print(before_e, s, e)
if s < before_e:
answer += 1
else:
be... | false | 13.333333 | [
"-islands, requests = list(map(int, input().split(\" \")))",
"-req = []",
"-for r in range(requests):",
"- a, b = list(map(int, input().split(\" \")))",
"- req.append([a, b])",
"-req = sorted(req, key=lambda x: x[1])",
"-answer = 1",
"-temp_end = req[0][1]",
"-for r in req:",
"- if r[0] >... | false | 0.03957 | 0.033336 | 1.187019 | [
"s431333772",
"s393097942"
] |
u179169725 | p02781 | python | s020641673 | s636933487 | 33 | 20 | 3,812 | 3,064 | Accepted | Accepted | 39.39 | N = int(eval(input()))
K = int(eval(input()))
# F(N,K) ... N以下の整数で0でない数字がちょうどK個あるものの個数
from functools import lru_cache
import sys
sys.setrecursionlimit(1 << 25)
@lru_cache(None)
def F(N, K):
'''N以下でちょうど0以外がK回出てくる (0以外を特にカウントする)'''
# 終了条件
assert N > -1
if K < 0:
return 0
... | N = int(eval(input()))
K = int(eval(input()))
def ketadp(X):
X = '0' + str(X)
dp = [[[0] * 4 for _ in range(2)] for _ in range(len(X))]
dp[0][0][0] = 1
for i in range(len(X) - 1):
for j in range(2):
for d in range(10 if j else int(X[i + 1]) + 1):
if d == ... | 41 | 22 | 893 | 636 | N = int(eval(input()))
K = int(eval(input()))
# F(N,K) ... N以下の整数で0でない数字がちょうどK個あるものの個数
from functools import lru_cache
import sys
sys.setrecursionlimit(1 << 25)
@lru_cache(None)
def F(N, K):
"""N以下でちょうど0以外がK回出てくる (0以外を特にカウントする)"""
# 終了条件
assert N > -1
if K < 0:
return 0
if N < 10:
... | N = int(eval(input()))
K = int(eval(input()))
def ketadp(X):
X = "0" + str(X)
dp = [[[0] * 4 for _ in range(2)] for _ in range(len(X))]
dp[0][0][0] = 1
for i in range(len(X) - 1):
for j in range(2):
for d in range(10 if j else int(X[i + 1]) + 1):
if d == 0:
... | false | 46.341463 | [
"-# F(N,K) ... N以下の整数で0でない数字がちょうどK個あるものの個数",
"-from functools import lru_cache",
"-import sys",
"-",
"-sys.setrecursionlimit(1 << 25)",
"-@lru_cache(None)",
"-def F(N, K):",
"- \"\"\"N以下でちょうど0以外がK回出てくる (0以外を特にカウントする)\"\"\"",
"- # 終了条件",
"- assert N > -1",
"- if K < 0:",
"- r... | false | 0.077421 | 0.102795 | 0.753158 | [
"s020641673",
"s636933487"
] |
u085329544 | p02693 | python | s993337975 | s803602959 | 23 | 21 | 9,128 | 9,168 | Accepted | Accepted | 8.7 | k = int(eval(input()))
a,b = list(map(int, input().split()))
m = int(b/k)
for i in range(m):
if a<=k*(i+1) and b>=k*(i+1):
print('OK')
exit()
else:
i += 1
print('NG') | K = int(eval(input()))
A, B = list(map(int, input().split()))
for i in range(A, B + 1):
if i % K == 0:
print('OK')
exit()
print('NG') | 12 | 8 | 183 | 149 | k = int(eval(input()))
a, b = list(map(int, input().split()))
m = int(b / k)
for i in range(m):
if a <= k * (i + 1) and b >= k * (i + 1):
print("OK")
exit()
else:
i += 1
print("NG")
| K = int(eval(input()))
A, B = list(map(int, input().split()))
for i in range(A, B + 1):
if i % K == 0:
print("OK")
exit()
print("NG")
| false | 33.333333 | [
"-k = int(eval(input()))",
"-a, b = list(map(int, input().split()))",
"-m = int(b / k)",
"-for i in range(m):",
"- if a <= k * (i + 1) and b >= k * (i + 1):",
"+K = int(eval(input()))",
"+A, B = list(map(int, input().split()))",
"+for i in range(A, B + 1):",
"+ if i % K == 0:",
"- else:",... | false | 0.043749 | 0.043264 | 1.011207 | [
"s993337975",
"s803602959"
] |
u208464243 | p02813 | python | s516368316 | s639137589 | 37 | 34 | 8,052 | 8,052 | Accepted | Accepted | 8.11 | import itertools
N = int(eval(input()))
P_list = tuple(map(int,input().split()))
Q_list = tuple(map(int,input().split()))
tem_list = []
for i in range(1,N+1):
tem_list.append(i)
check_list = list(itertools.permutations(tem_list,N))
for i in range(0,len(check_list)):
if check_list[i] == P_list:
... | import itertools
N = int(eval(input()))
P_list = tuple(map(int,input().split()))
Q_list = tuple(map(int,input().split()))
tem_list = []
for i in range(1,N+1):
tem_list.append(i)
check_list = list(itertools.permutations(tem_list,N))
for i in range(0,len(check_list)):
if check_list[i] == P_list:
... | 19 | 18 | 445 | 409 | import itertools
N = int(eval(input()))
P_list = tuple(map(int, input().split()))
Q_list = tuple(map(int, input().split()))
tem_list = []
for i in range(1, N + 1):
tem_list.append(i)
check_list = list(itertools.permutations(tem_list, N))
for i in range(0, len(check_list)):
if check_list[i] == P_list:
t... | import itertools
N = int(eval(input()))
P_list = tuple(map(int, input().split()))
Q_list = tuple(map(int, input().split()))
tem_list = []
for i in range(1, N + 1):
tem_list.append(i)
check_list = list(itertools.permutations(tem_list, N))
for i in range(0, len(check_list)):
if check_list[i] == P_list:
t... | false | 5.263158 | [
"-for j in range(0, len(check_list)):",
"- if check_list[j] == Q_list:",
"- tem_2 = j",
"+ if check_list[i] == Q_list:",
"+ tem_2 = i"
] | false | 0.041524 | 0.041913 | 0.990707 | [
"s516368316",
"s639137589"
] |
u888092736 | p02837 | python | s009424920 | s602063570 | 1,529 | 809 | 3,064 | 3,188 | Accepted | Accepted | 47.09 | N = int(eval(input()))
T = [[-1] * N for _ in range(N)]
for i in range(N):
for _ in range(int(eval(input()))):
x, y = list(map(int, input().split()))
T[i][x - 1] = y
ans = 0
for i in range(1 << N):
is_kind = [i >> j & 1 for j in range(N)]
found = True
for j in range(N):
... | N = int(eval(input()))
T = [[-1] * N for _ in range(N)]
for i in range(N):
for _ in range(int(eval(input()))):
x, y = list(map(int, input().split()))
T[i][x - 1] = y
ans = 0
for i in range(1 << N):
is_kind = [i >> j & 1 for j in range(N)]
found = True
for j in range(N):
... | 21 | 23 | 559 | 601 | N = int(eval(input()))
T = [[-1] * N for _ in range(N)]
for i in range(N):
for _ in range(int(eval(input()))):
x, y = list(map(int, input().split()))
T[i][x - 1] = y
ans = 0
for i in range(1 << N):
is_kind = [i >> j & 1 for j in range(N)]
found = True
for j in range(N):
if not is... | N = int(eval(input()))
T = [[-1] * N for _ in range(N)]
for i in range(N):
for _ in range(int(eval(input()))):
x, y = list(map(int, input().split()))
T[i][x - 1] = y
ans = 0
for i in range(1 << N):
is_kind = [i >> j & 1 for j in range(N)]
found = True
for j in range(N):
if not is... | false | 8.695652 | [
"+ if not found:",
"+ break"
] | false | 0.036896 | 0.084669 | 0.435769 | [
"s009424920",
"s602063570"
] |
u363610900 | p03485 | python | s629810803 | s488629725 | 18 | 16 | 2,940 | 2,940 | Accepted | Accepted | 11.11 | # -*- coding: utf-8 -*-
def func(a, b):
result = int((a+b)/2 + 0.5)
return result
a, b = list(map(int, input().split()))
print((func(a, b))) | import math
a, b = list(map(int, input().split()))
print((math.ceil((a+b)/2))) | 11 | 3 | 155 | 72 | # -*- coding: utf-8 -*-
def func(a, b):
result = int((a + b) / 2 + 0.5)
return result
a, b = list(map(int, input().split()))
print((func(a, b)))
| import math
a, b = list(map(int, input().split()))
print((math.ceil((a + b) / 2)))
| false | 72.727273 | [
"-# -*- coding: utf-8 -*-",
"-def func(a, b):",
"- result = int((a + b) / 2 + 0.5)",
"- return result",
"-",
"+import math",
"-print((func(a, b)))",
"+print((math.ceil((a + b) / 2)))"
] | false | 0.046333 | 0.046253 | 1.001724 | [
"s629810803",
"s488629725"
] |
u802963389 | p03705 | python | s374845945 | s543442284 | 166 | 17 | 38,384 | 2,940 | Accepted | Accepted | 89.76 | N, A, B = list(map(int, input().split()))
if A > B:
print((0))
elif A == B:
print((1))
else:
if N == 1:
if A != B:
print((0))
else:
print((1))
else:
print(((N - 2) * (B - A) + 1)) | n, a, b = list(map(int, input().split()))
ans = max(0, b * (n - 1) + a - (b + a * (n - 1)) + 1)
print(ans) | 14 | 3 | 209 | 102 | N, A, B = list(map(int, input().split()))
if A > B:
print((0))
elif A == B:
print((1))
else:
if N == 1:
if A != B:
print((0))
else:
print((1))
else:
print(((N - 2) * (B - A) + 1))
| n, a, b = list(map(int, input().split()))
ans = max(0, b * (n - 1) + a - (b + a * (n - 1)) + 1)
print(ans)
| false | 78.571429 | [
"-N, A, B = list(map(int, input().split()))",
"-if A > B:",
"- print((0))",
"-elif A == B:",
"- print((1))",
"-else:",
"- if N == 1:",
"- if A != B:",
"- print((0))",
"- else:",
"- print((1))",
"- else:",
"- print(((N - 2) * (B - A) + 1)... | false | 0.042237 | 0.037948 | 1.113009 | [
"s374845945",
"s543442284"
] |
u617515020 | p03682 | python | s948938813 | s461571307 | 1,276 | 878 | 82,464 | 53,200 | Accepted | Accepted | 31.19 | from heapq import *
N = int(eval(input()))
X,Y=[],[]
for n in range(N):
x,y=list(map(int,input().split()))
X.append((x, n))
Y.append((y, n))
X.sort()
Y.sort()
D=[[] for v in range(N)]
for n in range(N-1):
cost = X[n+1][0]-X[n][0]
D[X[n+1][1]].append((cost,X[n][1]))
D[X[n][1]].append((cost,X[n+1... | N = int(eval(input()))
XYI = [tuple(map(int,input().split() + [i])) for i in range(N)]
sx = sorted(XYI, key=lambda x:x[0])
sy = sorted(XYI, key=lambda x:x[1])
es = []
for (x0,_,i0),(x1,_,i1) in zip(sx,sx[1:]):
es.append((x1-x0, i0, i1))
for (_,y0,i0),(_,y1,i1) in zip(sy,sy[1:]):
es.append((y1-y0, i0, i1))... | 35 | 43 | 680 | 1,112 | from heapq import *
N = int(eval(input()))
X, Y = [], []
for n in range(N):
x, y = list(map(int, input().split()))
X.append((x, n))
Y.append((y, n))
X.sort()
Y.sort()
D = [[] for v in range(N)]
for n in range(N - 1):
cost = X[n + 1][0] - X[n][0]
D[X[n + 1][1]].append((cost, X[n][1]))
D[X[n][1]]... | N = int(eval(input()))
XYI = [tuple(map(int, input().split() + [i])) for i in range(N)]
sx = sorted(XYI, key=lambda x: x[0])
sy = sorted(XYI, key=lambda x: x[1])
es = []
for (x0, _, i0), (x1, _, i1) in zip(sx, sx[1:]):
es.append((x1 - x0, i0, i1))
for (_, y0, i0), (_, y1, i1) in zip(sy, sy[1:]):
es.append((y1 -... | false | 18.604651 | [
"-from heapq import *",
"+N = int(eval(input()))",
"+XYI = [tuple(map(int, input().split() + [i])) for i in range(N)]",
"+sx = sorted(XYI, key=lambda x: x[0])",
"+sy = sorted(XYI, key=lambda x: x[1])",
"+es = []",
"+for (x0, _, i0), (x1, _, i1) in zip(sx, sx[1:]):",
"+ es.append((x1 - x0, i0, i1))"... | false | 0.038435 | 0.082482 | 0.465981 | [
"s948938813",
"s461571307"
] |
u089230684 | p03474 | python | s015067640 | s542206635 | 19 | 17 | 3,064 | 2,940 | Accepted | Accepted | 10.53 | A, B =list(map(int, input().split()))
S = eval(input())
NUM = list(range(10))
X = 0
while X != A+B+1:
if X == A:
if S[X] != "-":
print("No")
quit()
X += 1
else:
if S[X] == "-":
print("No")
quit()
if int(S[X]) in NUM:
... | a, b = list(map(int, input().split()))
s = eval(input())
if s[a] == '-' and s[:a].isdigit() and s[a+1:].isdigit():
print('Yes')
else:
print('No')
#GOFORIT | 20 | 8 | 400 | 158 | A, B = list(map(int, input().split()))
S = eval(input())
NUM = list(range(10))
X = 0
while X != A + B + 1:
if X == A:
if S[X] != "-":
print("No")
quit()
X += 1
else:
if S[X] == "-":
print("No")
quit()
if int(S[X]) in NUM:
... | a, b = list(map(int, input().split()))
s = eval(input())
if s[a] == "-" and s[:a].isdigit() and s[a + 1 :].isdigit():
print("Yes")
else:
print("No")
# GOFORIT
| false | 60 | [
"-A, B = list(map(int, input().split()))",
"-S = eval(input())",
"-NUM = list(range(10))",
"-X = 0",
"-while X != A + B + 1:",
"- if X == A:",
"- if S[X] != \"-\":",
"- print(\"No\")",
"- quit()",
"- X += 1",
"- else:",
"- if S[X] == \"-\":",
... | false | 0.062891 | 0.043213 | 1.455368 | [
"s015067640",
"s542206635"
] |
u531631168 | p02713 | python | s894383542 | s472378131 | 1,119 | 68 | 9,632 | 9,476 | Accepted | Accepted | 93.92 | import math
from functools import reduce
def gcd(*numbers):
return reduce(math.gcd, numbers)
comb_count = {1:1, 2:3, 3:6}
k = int(eval(input()))
ans = 0
for a in range(1, k+1):
for b in range(a, k+1):
for c in range(b, k+1):
ans += gcd(a, b, c) * comb_count[len(set([a, b, c]))]... | from collections import defaultdict
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a%b)
gcd_cnt = defaultdict(int)
ans = 0
k = int(eval(input()))
for a in range(1, k+1):
for b in range(1, k+1):
gcd_cnt[gcd(a, b)] += 1
for key in gcd_cnt:
for c in range(... | 14 | 19 | 326 | 377 | import math
from functools import reduce
def gcd(*numbers):
return reduce(math.gcd, numbers)
comb_count = {1: 1, 2: 3, 3: 6}
k = int(eval(input()))
ans = 0
for a in range(1, k + 1):
for b in range(a, k + 1):
for c in range(b, k + 1):
ans += gcd(a, b, c) * comb_count[len(set([a, b, c]))]
... | from collections import defaultdict
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
gcd_cnt = defaultdict(int)
ans = 0
k = int(eval(input()))
for a in range(1, k + 1):
for b in range(1, k + 1):
gcd_cnt[gcd(a, b)] += 1
for key in gcd_cnt:
for c in range(1, k + 1)... | false | 26.315789 | [
"-import math",
"-from functools import reduce",
"+from collections import defaultdict",
"-def gcd(*numbers):",
"- return reduce(math.gcd, numbers)",
"+def gcd(a, b):",
"+ if b == 0:",
"+ return a",
"+ else:",
"+ return gcd(b, a % b)",
"-comb_count = {1: 1, 2: 3, 3: 6}",
... | false | 0.189101 | 0.039075 | 4.83949 | [
"s894383542",
"s472378131"
] |
u631277801 | p03339 | python | s719014206 | s940132647 | 479 | 225 | 6,052 | 8,144 | Accepted | Accepted | 53.03 | n = int(eval(input()))
s = eval(input())
c = list(s)
lw = 0
le = 0
rw = s[1:].count("W")
re = s[1:].count("E")
ans = lw + re
for i in range(1,n):
lw = lw + bool(c[i-1] == "W")
le = le + bool(c[i-1] == "E")
rw = rw - bool(c[i] == "W")
re = re - bool(c[i] == "E")
ans = min(a... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.readl... | 21 | 38 | 336 | 760 | n = int(eval(input()))
s = eval(input())
c = list(s)
lw = 0
le = 0
rw = s[1:].count("W")
re = s[1:].count("E")
ans = lw + re
for i in range(1, n):
lw = lw + bool(c[i - 1] == "W")
le = le + bool(c[i - 1] == "E")
rw = rw - bool(c[i] == "W")
re = re - bool(c[i] == "E")
ans = min(ans, lw + re)
print(ans... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | false | 44.736842 | [
"-n = int(eval(input()))",
"-s = eval(input())",
"-c = list(s)",
"+import sys",
"+",
"+stdin = sys.stdin",
"+sys.setrecursionlimit(10**5)",
"+",
"+",
"+def li():",
"+ return list(map(int, stdin.readline().split()))",
"+",
"+",
"+def li_():",
"+ return [int(x) - 1 for x in stdin.rea... | false | 0.075187 | 0.081955 | 0.917429 | [
"s719014206",
"s940132647"
] |
u219197917 | p03037 | python | s053975563 | s939814570 | 317 | 217 | 21,108 | 9,132 | Accepted | Accepted | 31.55 | n, m = [int(i) for i in input().split()]
lr = [[int(i) for i in input().split()] for j in range(m)]
l = max(x[0] for x in lr)
r = min(x[1] for x in lr)
print((max(0, r - l + 1)))
| n, m = list(map(int, input().split()))
lmax, rmin = 0, n
for _ in range(m):
l, r = list(map(int, input().split()))
lmax = max(l, lmax)
rmin = min(r, rmin)
print((max(rmin - lmax + 1, 0)))
| 5 | 7 | 181 | 192 | n, m = [int(i) for i in input().split()]
lr = [[int(i) for i in input().split()] for j in range(m)]
l = max(x[0] for x in lr)
r = min(x[1] for x in lr)
print((max(0, r - l + 1)))
| n, m = list(map(int, input().split()))
lmax, rmin = 0, n
for _ in range(m):
l, r = list(map(int, input().split()))
lmax = max(l, lmax)
rmin = min(r, rmin)
print((max(rmin - lmax + 1, 0)))
| false | 28.571429 | [
"-n, m = [int(i) for i in input().split()]",
"-lr = [[int(i) for i in input().split()] for j in range(m)]",
"-l = max(x[0] for x in lr)",
"-r = min(x[1] for x in lr)",
"-print((max(0, r - l + 1)))",
"+n, m = list(map(int, input().split()))",
"+lmax, rmin = 0, n",
"+for _ in range(m):",
"+ l, r = ... | false | 0.042431 | 0.07786 | 0.544968 | [
"s053975563",
"s939814570"
] |
u130900604 | p02731 | python | s075789859 | s615259320 | 17 | 11 | 2,940 | 2,568 | Accepted | Accepted | 35.29 | print((int(eval(input()))**3/27)) | print(int(eval(input()))**3/27.) | 1 | 1 | 25 | 25 | print((int(eval(input())) ** 3 / 27))
| print(int(eval(input())) ** 3 / 27.0)
| false | 0 | [
"-print((int(eval(input())) ** 3 / 27))",
"+print(int(eval(input())) ** 3 / 27.0)"
] | false | 0.040653 | 0.128986 | 0.315176 | [
"s075789859",
"s615259320"
] |
u680851063 | p02630 | python | s931893270 | s454889831 | 491 | 161 | 21,088 | 20,432 | Accepted | Accepted | 67.21 | n = int(eval(input()))
A = list(map(int,input().split()))
q = int(eval(input()))
total = sum(A) # これを基に各queryに対応(加算、減算)する
l = [0 for i in range(10**5+1)] # 配列のインデックスを各valueとみなす
for _ in A: # 各インデックスに各keyを加算
l[_] += 1
for i in range(q):
b, c = list(map(int,input().split()))
total += c * l[b] #... | def Replacing():
import sys
input = sys.stdin.readline
n = int(eval(input()))
A = list(map(int,input().split()))
q = int(eval(input()))
total = sum(A) # これを基に各queryに対応(加算、減算)する
l = [0 for i in range(10**5+1)] # 配列のインデックスを各valueとみなす
for _ in A: # 各インデックスに各keyを加算
... | 17 | 23 | 409 | 559 | n = int(eval(input()))
A = list(map(int, input().split()))
q = int(eval(input()))
total = sum(A) # これを基に各queryに対応(加算、減算)する
l = [0 for i in range(10**5 + 1)] # 配列のインデックスを各valueとみなす
for _ in A: # 各インデックスに各keyを加算
l[_] += 1
for i in range(q):
b, c = list(map(int, input().split()))
total += c * l[b] # totalの... | def Replacing():
import sys
input = sys.stdin.readline
n = int(eval(input()))
A = list(map(int, input().split()))
q = int(eval(input()))
total = sum(A) # これを基に各queryに対応(加算、減算)する
l = [0 for i in range(10**5 + 1)] # 配列のインデックスを各valueとみなす
for _ in A: # 各インデックスに各keyを加算
l[_] += 1
... | false | 26.086957 | [
"-n = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-q = int(eval(input()))",
"-total = sum(A) # これを基に各queryに対応(加算、減算)する",
"-l = [0 for i in range(10**5 + 1)] # 配列のインデックスを各valueとみなす",
"-for _ in A: # 各インデックスに各keyを加算",
"- l[_] += 1",
"-for i in range(q):",
"- b, c = list(map(... | false | 0.053443 | 0.052428 | 1.019364 | [
"s931893270",
"s454889831"
] |
u472534477 | p02707 | python | s831686190 | s598942616 | 139 | 127 | 24,664 | 33,008 | Accepted | Accepted | 8.63 | n = int(eval(input()))
boss_list = list(map(int, input().split()))
employee_list = [0] * n
for boss in boss_list:
employee_list[boss - 1] += 1
for employee in employee_list:
print(employee) | N=int(eval(input()))
A=[int(n) for n in input().split()]
sub=[0]*N
for index in A:
sub[index-1]+=1
print(("\n".join(map(str,sub)))) | 11 | 6 | 197 | 132 | n = int(eval(input()))
boss_list = list(map(int, input().split()))
employee_list = [0] * n
for boss in boss_list:
employee_list[boss - 1] += 1
for employee in employee_list:
print(employee)
| N = int(eval(input()))
A = [int(n) for n in input().split()]
sub = [0] * N
for index in A:
sub[index - 1] += 1
print(("\n".join(map(str, sub))))
| false | 45.454545 | [
"-n = int(eval(input()))",
"-boss_list = list(map(int, input().split()))",
"-employee_list = [0] * n",
"-for boss in boss_list:",
"- employee_list[boss - 1] += 1",
"-for employee in employee_list:",
"- print(employee)",
"+N = int(eval(input()))",
"+A = [int(n) for n in input().split()]",
"+s... | false | 0.038713 | 0.03887 | 0.995973 | [
"s831686190",
"s598942616"
] |
u450956662 | p03253 | python | s128957319 | s776862150 | 166 | 27 | 38,768 | 3,692 | Accepted | Accepted | 83.73 | import sys
mod = 10 ** 9 + 7
sys.setrecursionlimit(mod)
def modpow(a, p):
if p == 0:
return 1
if p % 2 == 0:
half = modpow(a, p // 2)
return half * half % mod
else:
return a * modpow(a, p - 1) % mod
def combinations(a, b):
if 2 * b > a:
return c... | from collections import defaultdict
def sieve_of_eratosthenes(n):
sr_n = int(n ** 0.5)
f = [True] * (sr_n + 1)
res = []
for i in range(2, sr_n+1):
if f[i]:
res.append(i)
for j in range(2*i, sr_n+1, i):
f[j] = False
return res
def trial_d... | 44 | 43 | 863 | 938 | import sys
mod = 10**9 + 7
sys.setrecursionlimit(mod)
def modpow(a, p):
if p == 0:
return 1
if p % 2 == 0:
half = modpow(a, p // 2)
return half * half % mod
else:
return a * modpow(a, p - 1) % mod
def combinations(a, b):
if 2 * b > a:
return combinations(a, a... | from collections import defaultdict
def sieve_of_eratosthenes(n):
sr_n = int(n**0.5)
f = [True] * (sr_n + 1)
res = []
for i in range(2, sr_n + 1):
if f[i]:
res.append(i)
for j in range(2 * i, sr_n + 1, i):
f[j] = False
return res
def trial_division... | false | 2.272727 | [
"-import sys",
"-",
"-mod = 10**9 + 7",
"-sys.setrecursionlimit(mod)",
"+from collections import defaultdict",
"-def modpow(a, p):",
"- if p == 0:",
"- return 1",
"- if p % 2 == 0:",
"- half = modpow(a, p // 2)",
"- return half * half % mod",
"- else:",
"- ... | false | 0.05265 | 0.071262 | 0.738817 | [
"s128957319",
"s776862150"
] |
u735069283 | p03012 | python | s797091371 | s392707625 | 20 | 17 | 2,940 | 3,060 | Accepted | Accepted | 15 | N = int(eval(input()))
W = list(map(int,input().split()))
print((min(abs(sum(W[:i])-sum(W[i:])) for i in range(N)))) | N = int(eval(input()))
W = [int(x) for x in input().split()]
ans = float('inf')
for i in range(N-1):
ans=min(ans,abs(sum(W[:i+1])-sum(W[i+1:])))
print(ans) | 3 | 6 | 110 | 156 | N = int(eval(input()))
W = list(map(int, input().split()))
print((min(abs(sum(W[:i]) - sum(W[i:])) for i in range(N))))
| N = int(eval(input()))
W = [int(x) for x in input().split()]
ans = float("inf")
for i in range(N - 1):
ans = min(ans, abs(sum(W[: i + 1]) - sum(W[i + 1 :])))
print(ans)
| false | 50 | [
"-W = list(map(int, input().split()))",
"-print((min(abs(sum(W[:i]) - sum(W[i:])) for i in range(N))))",
"+W = [int(x) for x in input().split()]",
"+ans = float(\"inf\")",
"+for i in range(N - 1):",
"+ ans = min(ans, abs(sum(W[: i + 1]) - sum(W[i + 1 :])))",
"+print(ans)"
] | false | 0.038267 | 0.037711 | 1.014737 | [
"s797091371",
"s392707625"
] |
u757117214 | p03545 | python | s889579407 | s508672971 | 22 | 17 | 3,060 | 2,940 | Accepted | Accepted | 22.73 | import sys
import itertools
a,b,c,d=[i for i in eval(input())]
op=["+","-"]
for i in itertools.product(op,repeat=3):
ev=a+i[0]+b+i[1]+c+i[2]+d
if eval(ev)==7:
print((ev+"=7"))
sys.exit() | S = eval(input())
def saiki(i,s = S[0]):
if i == 3:
if eval(s) == 7:
print((str(s) + "=7"))
exit()
else:
return
saiki(i + 1, s + "+" + S[i+1])
saiki(i + 1, s + "-" + S[i+1])
saiki(0)
| 9 | 13 | 198 | 265 | import sys
import itertools
a, b, c, d = [i for i in eval(input())]
op = ["+", "-"]
for i in itertools.product(op, repeat=3):
ev = a + i[0] + b + i[1] + c + i[2] + d
if eval(ev) == 7:
print((ev + "=7"))
sys.exit()
| S = eval(input())
def saiki(i, s=S[0]):
if i == 3:
if eval(s) == 7:
print((str(s) + "=7"))
exit()
else:
return
saiki(i + 1, s + "+" + S[i + 1])
saiki(i + 1, s + "-" + S[i + 1])
saiki(0)
| false | 30.769231 | [
"-import sys",
"-import itertools",
"+S = eval(input())",
"-a, b, c, d = [i for i in eval(input())]",
"-op = [\"+\", \"-\"]",
"-for i in itertools.product(op, repeat=3):",
"- ev = a + i[0] + b + i[1] + c + i[2] + d",
"- if eval(ev) == 7:",
"- print((ev + \"=7\"))",
"- sys.exit(... | false | 0.035824 | 0.036081 | 0.992882 | [
"s889579407",
"s508672971"
] |
u841599623 | p02689 | python | s301740512 | s749604321 | 296 | 270 | 20,584 | 20,648 | Accepted | Accepted | 8.78 | import collections
N,M=list(map(int,input().split()))
H=list(map(int,input().split()))
ans=[1]*N
for _ in range(M):
AB=list(map(int,input().split()))
if H[AB[0]-1] < H[AB[1]-1]:
ans[AB[0]-1]=0
elif H[AB[0]-1] > H[AB[1]-1]:
ans[AB[1]-1]=0
else:
ans[AB[0]-1]=0
... | import collections
N,M=list(map(int,input().split()))
H=list(map(int,input().split()))
ans=[1]*N
for _ in range(M):
AB=list(map(int,input().split()))
if H[AB[0]-1] < H[AB[1]-1]:
ans[AB[0]-1]=0
elif H[AB[0]-1] > H[AB[1]-1]:
ans[AB[1]-1]=0
else:
ans[AB[0]-1]=0
... | 15 | 15 | 373 | 381 | import collections
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
ans = [1] * N
for _ in range(M):
AB = list(map(int, input().split()))
if H[AB[0] - 1] < H[AB[1] - 1]:
ans[AB[0] - 1] = 0
elif H[AB[0] - 1] > H[AB[1] - 1]:
ans[AB[1] - 1] = 0
else:
ans[A... | import collections
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
ans = [1] * N
for _ in range(M):
AB = list(map(int, input().split()))
if H[AB[0] - 1] < H[AB[1] - 1]:
ans[AB[0] - 1] = 0
elif H[AB[0] - 1] > H[AB[1] - 1]:
ans[AB[1] - 1] = 0
else:
ans[A... | false | 0 | [
"-c = collections.Counter(ans)",
"-print((c[1]))",
"+# c=collections.Counter(ans)",
"+print((ans.count(1)))"
] | false | 0.042535 | 0.036425 | 1.167746 | [
"s301740512",
"s749604321"
] |
u489277636 | p02861 | python | s503162368 | s934479066 | 240 | 158 | 15,108 | 12,500 | Accepted | Accepted | 34.17 | import numpy as np
import itertools
import math
def l2_norm(node1,node2):
x1 = node1[0]
y1 = node1[1]
x2 = node2[0]
y2 = node2[1]
return math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
def pmt(n):
result = 1
for i in range(1,n + 1):
result = result * i
return result
... | import math
import itertools
import numpy as np
def l2_dist(a,b):
return math.sqrt((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2)
def rate(n):
if n == 1:
return 2
else:
return n * rate(n - 1)
def fact(n):
if n == 1 or n == 0:
return 1
else:
return n * fact(n ... | 46 | 26 | 1,082 | 711 | import numpy as np
import itertools
import math
def l2_norm(node1, node2):
x1 = node1[0]
y1 = node1[1]
x2 = node2[0]
y2 = node2[1]
return math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
def pmt(n):
result = 1
for i in range(1, n + 1):
result = result * i
return result
node_num =... | import math
import itertools
import numpy as np
def l2_dist(a, b):
return math.sqrt((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2)
def rate(n):
if n == 1:
return 2
else:
return n * rate(n - 1)
def fact(n):
if n == 1 or n == 0:
return 1
else:
return n * fact(n - 1)
n... | false | 43.478261 | [
"+import math",
"+import itertools",
"-import itertools",
"-import math",
"-def l2_norm(node1, node2):",
"- x1 = node1[0]",
"- y1 = node1[1]",
"- x2 = node2[0]",
"- y2 = node2[1]",
"- return math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)",
"+def l2_dist(a, b):",
"+ return math.sq... | false | 0.672741 | 0.19349 | 3.476884 | [
"s503162368",
"s934479066"
] |
u270681687 | p03608 | python | s319862355 | s370988321 | 761 | 555 | 88,920 | 72,664 | Accepted | Accepted | 27.07 | from itertools import permutations
N, M, R = list(map(int, input().split()))
r = list(map(int, input().split()))
INF = float('inf')
graph = [[INF for i in range(N)] for j in range(N)]
for i in range(M):
A, B, C = list(map(int, input().split()))
graph[A-1][B-1] = C
graph[B-1][A-1] = C
for i in... | from itertools import permutations
N, M, R = list(map(int, input().split()))
r = list(map(int, input().split()))
INF = float('inf')
graph = [[INF for i in range(N)] for j in range(N)]
for i in range(M):
A, B, C = list(map(int, input().split()))
graph[A-1][B-1] = C
graph[B-1][A-1] = C
for i in... | 34 | 33 | 858 | 787 | from itertools import permutations
N, M, R = list(map(int, input().split()))
r = list(map(int, input().split()))
INF = float("inf")
graph = [[INF for i in range(N)] for j in range(N)]
for i in range(M):
A, B, C = list(map(int, input().split()))
graph[A - 1][B - 1] = C
graph[B - 1][A - 1] = C
for i in range... | from itertools import permutations
N, M, R = list(map(int, input().split()))
r = list(map(int, input().split()))
INF = float("inf")
graph = [[INF for i in range(N)] for j in range(N)]
for i in range(M):
A, B, C = list(map(int, input().split()))
graph[A - 1][B - 1] = C
graph[B - 1][A - 1] = C
for i in range... | false | 2.941176 | [
"- graph[j][i] = min(graph[j][i], graph[j][k] + graph[k][i])"
] | false | 0.035307 | 0.066268 | 0.53279 | [
"s319862355",
"s370988321"
] |
u079022693 | p02783 | python | s204486355 | s092933671 | 167 | 17 | 38,384 | 2,940 | Accepted | Accepted | 89.82 | H,A=list(map(int,input().split()))
count=0
while(H>0):
H-=A
count+=1
print(count) | h,a=list(map(int,input().split()))
print(((h+a-1)//a)) | 6 | 2 | 86 | 47 | H, A = list(map(int, input().split()))
count = 0
while H > 0:
H -= A
count += 1
print(count)
| h, a = list(map(int, input().split()))
print(((h + a - 1) // a))
| false | 66.666667 | [
"-H, A = list(map(int, input().split()))",
"-count = 0",
"-while H > 0:",
"- H -= A",
"- count += 1",
"-print(count)",
"+h, a = list(map(int, input().split()))",
"+print(((h + a - 1) // a))"
] | false | 0.044065 | 0.039595 | 1.112882 | [
"s204486355",
"s092933671"
] |
u190406011 | p03112 | python | s096634864 | s717232116 | 1,991 | 771 | 80,500 | 122,732 | Accepted | Accepted | 61.28 | import sys
import bisect
a, b, q = [int(i) for i in sys.stdin.readline().split()]
s_ls = []
t_ls = []
INF = 10 ** 18
for i in range(a):
s = int(eval(input()))
s_ls.append(s)
for i in range(b):
t = int(eval(input()))
t_ls.append(t)
for i in range(q):
x = int(eval(input()))
s_ind =... | import sys
import bisect
_input = sys.stdin.readlines()
a, b, q = [int(i) for i in _input[0].split()]
data = [int(i) for i in _input[1:]]
s_ls = data[:a]
t_ls = data[a:a+b]
x_ls = data[-q:]
INF = 10 ** 18
for x in x_ls:
s_ind = min(bisect.bisect_left(s_ls, x), a-1)
t_ind = min(bisect.bisect_left(t_... | 32 | 28 | 900 | 841 | import sys
import bisect
a, b, q = [int(i) for i in sys.stdin.readline().split()]
s_ls = []
t_ls = []
INF = 10**18
for i in range(a):
s = int(eval(input()))
s_ls.append(s)
for i in range(b):
t = int(eval(input()))
t_ls.append(t)
for i in range(q):
x = int(eval(input()))
s_ind = min(bisect.bisec... | import sys
import bisect
_input = sys.stdin.readlines()
a, b, q = [int(i) for i in _input[0].split()]
data = [int(i) for i in _input[1:]]
s_ls = data[:a]
t_ls = data[a : a + b]
x_ls = data[-q:]
INF = 10**18
for x in x_ls:
s_ind = min(bisect.bisect_left(s_ls, x), a - 1)
t_ind = min(bisect.bisect_left(t_ls, x), ... | false | 12.5 | [
"-a, b, q = [int(i) for i in sys.stdin.readline().split()]",
"-s_ls = []",
"-t_ls = []",
"+_input = sys.stdin.readlines()",
"+a, b, q = [int(i) for i in _input[0].split()]",
"+data = [int(i) for i in _input[1:]]",
"+s_ls = data[:a]",
"+t_ls = data[a : a + b]",
"+x_ls = data[-q:]",
"-for i in range... | false | 0.043364 | 0.037289 | 1.162919 | [
"s096634864",
"s717232116"
] |
u994988729 | p02862 | python | s720445346 | s063792802 | 1,608 | 155 | 3,064 | 3,188 | Accepted | Accepted | 90.36 | def knight(x, y):
mod = 10 ** 9 + 7
x, y = min(x, y), max(x, y)
if (x + y) % 3 != 0:
return 0
if y > 2 * x:
return 0
move = (x + y) // 3
right = 2 * move - y
up = move-right
ans = 1
for i in range(up):
ans *= (move - i)
ans *= pow(i ... | def knight(x, y):
mod = 10 ** 9 + 7
x, y = min(x, y), max(x, y)
if (x + y) % 3 != 0:
return 0
if y > 2 * x:
return 0
move = (x + y) // 3
right = 2 * move - y
up = move-right
ans = 1
tmp = 1
for i in range(up):
ans *= (move - i)
... | 26 | 28 | 487 | 540 | def knight(x, y):
mod = 10**9 + 7
x, y = min(x, y), max(x, y)
if (x + y) % 3 != 0:
return 0
if y > 2 * x:
return 0
move = (x + y) // 3
right = 2 * move - y
up = move - right
ans = 1
for i in range(up):
ans *= move - i
ans *= pow(i + 1, mod - 2, mod)
... | def knight(x, y):
mod = 10**9 + 7
x, y = min(x, y), max(x, y)
if (x + y) % 3 != 0:
return 0
if y > 2 * x:
return 0
move = (x + y) // 3
right = 2 * move - y
up = move - right
ans = 1
tmp = 1
for i in range(up):
ans *= move - i
tmp *= i + 1
a... | false | 7.142857 | [
"+ tmp = 1",
"- ans *= pow(i + 1, mod - 2, mod)",
"+ tmp *= i + 1",
"- return ans",
"+ tmp %= mod",
"+ ans *= pow(tmp, mod - 2, mod)",
"+ return ans % mod"
] | false | 0.748488 | 0.229375 | 3.263166 | [
"s720445346",
"s063792802"
] |
u588341295 | p03380 | python | s925004023 | s574191053 | 126 | 82 | 14,428 | 14,352 | Accepted | Accepted | 34.92 | # -*- coding: utf-8 -*-
"""
参考:https://img.atcoder.jp/arc095/editorial.pdf
"""
N = int(eval(input()))
aN = list(map(int, input().split()))
aN.sort(reverse=True)
n = aN[0]
r = aN[1]
for i in range(2, N):
if abs(n / 2 - aN[i]) < abs(n / 2 - r):
r = aN[i]
print((n, r))
| # -*- coding: utf-8 -*-
import sys
from bisect import bisect_left
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(... | 16 | 47 | 289 | 1,212 | # -*- coding: utf-8 -*-
"""
参考:https://img.atcoder.jp/arc095/editorial.pdf
"""
N = int(eval(input()))
aN = list(map(int, input().split()))
aN.sort(reverse=True)
n = aN[0]
r = aN[1]
for i in range(2, N):
if abs(n / 2 - aN[i]) < abs(n / 2 - r):
r = aN[i]
print((n, r))
| # -*- coding: utf-8 -*-
import sys
from bisect import bisect_left
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d f... | false | 65.957447 | [
"-\"\"\"",
"-参考:https://img.atcoder.jp/arc095/editorial.pdf",
"-\"\"\"",
"-N = int(eval(input()))",
"-aN = list(map(int, input().split()))",
"-aN.sort(reverse=True)",
"-n = aN[0]",
"-r = aN[1]",
"-for i in range(2, N):",
"- if abs(n / 2 - aN[i]) < abs(n / 2 - r):",
"- r = aN[i]",
"-p... | false | 0.007353 | 0.125974 | 0.058367 | [
"s925004023",
"s574191053"
] |
u228232845 | p03160 | python | s119429256 | s110478293 | 258 | 157 | 53,448 | 13,980 | Accepted | Accepted | 39.15 | import sys
n = int(sys.stdin.readline().strip('\n'))
h = list(map(int, sys.stdin.readline().strip('\n').split()))
dp = [float('inf') for _ in range(n)]
dp[0] = 0
for i in range(n):
# 配るdp
if i+1<=n-1: dp[i+1] = min(dp[i+1], dp[i] + abs(h[i]-h[i+1]))
if i+2<=n-1: dp[i+2] = min(dp[i+2], dp[i] + abs(h[i]-h[i... | n = int(eval(input()))
*h, = list(map(int, input().split()))
INF = float('inf')
costs = [INF for _ in range(n)]
costs[0] = 0
costs[1] = abs(h[1] - h[0])
for i in range(2, n):
costs[i] = min([costs[i],
costs[i - 2] + abs(h[i] - h[i - 2]),
costs[i - 1] + abs(h[i] - h[i - 1]... | 10 | 12 | 342 | 345 | import sys
n = int(sys.stdin.readline().strip("\n"))
h = list(map(int, sys.stdin.readline().strip("\n").split()))
dp = [float("inf") for _ in range(n)]
dp[0] = 0
for i in range(n):
# 配るdp
if i + 1 <= n - 1:
dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]))
if i + 2 <= n - 1:
dp[i + 2... | n = int(eval(input()))
(*h,) = list(map(int, input().split()))
INF = float("inf")
costs = [INF for _ in range(n)]
costs[0] = 0
costs[1] = abs(h[1] - h[0])
for i in range(2, n):
costs[i] = min(
[
costs[i],
costs[i - 2] + abs(h[i] - h[i - 2]),
costs[i - 1] + abs(h[i] - h[i ... | false | 16.666667 | [
"-import sys",
"-",
"-n = int(sys.stdin.readline().strip(\"\\n\"))",
"-h = list(map(int, sys.stdin.readline().strip(\"\\n\").split()))",
"-dp = [float(\"inf\") for _ in range(n)]",
"-dp[0] = 0",
"-for i in range(n):",
"- # 配るdp",
"- if i + 1 <= n - 1:",
"- dp[i + 1] = min(dp[i + 1], d... | false | 0.03677 | 0.076111 | 0.483105 | [
"s119429256",
"s110478293"
] |
u620868411 | p03504 | python | s984076293 | s797276488 | 1,397 | 597 | 26,160 | 26,164 | Accepted | Accepted | 57.27 | # -*- coding: utf-8 -*-
from operator import itemgetter
N,C = list(map(int, input().split()))
record = []
for _ in range(N):
s,t,c = list(map(int, input().split()))
record.append((s,t,c))
record.sort(key=itemgetter(1,0,2))
def can_record(k):
slots = [(-1,-1)]*k # (end_time, channel)
for... | # -*- coding: utf-8 -*-
from operator import itemgetter
N,C = list(map(int, input().split()))
T = 0
record = []
for _ in range(N):
s,t,c = list(map(int, input().split()))
T = max(T, t)
record.append((s,t,c))
record.sort(key=itemgetter(2,0,1))
tl = [0]*(T+1)
curr_channel = None
for r in recor... | 38 | 36 | 962 | 694 | # -*- coding: utf-8 -*-
from operator import itemgetter
N, C = list(map(int, input().split()))
record = []
for _ in range(N):
s, t, c = list(map(int, input().split()))
record.append((s, t, c))
record.sort(key=itemgetter(1, 0, 2))
def can_record(k):
slots = [(-1, -1)] * k # (end_time, channel)
for r ... | # -*- coding: utf-8 -*-
from operator import itemgetter
N, C = list(map(int, input().split()))
T = 0
record = []
for _ in range(N):
s, t, c = list(map(int, input().split()))
T = max(T, t)
record.append((s, t, c))
record.sort(key=itemgetter(2, 0, 1))
tl = [0] * (T + 1)
curr_channel = None
for r in record:
... | false | 5.263158 | [
"+T = 0",
"+ T = max(T, t)",
"-record.sort(key=itemgetter(1, 0, 2))",
"-",
"-",
"-def can_record(k):",
"- slots = [(-1, -1)] * k # (end_time, channel)",
"- for r in record:",
"- idx = -1",
"- t = -1",
"- for i in range(k):",
"- end_time, channel = slot... | false | 0.044631 | 0.037062 | 1.204203 | [
"s984076293",
"s797276488"
] |
u347640436 | p03160 | python | s472871170 | s681126063 | 184 | 166 | 14,056 | 13,908 | Accepted | Accepted | 9.78 | n = int(eval(input()))
h = [int(e) for e in input().split()]
cost = [float('inf')] * n
cost[0] = 0
for i in range(n - 2):
cost[i + 1] = min(cost[i + 1], cost[i] + abs(h[i + 1] - h[i]))
cost[i + 2] = min(cost[i + 2], cost[i] + abs(h[i + 2] - h[i]))
cost[n - 1] = min(cost[n - 1], cost[n - 2] + abs(h[n - 1] - h... | n = int(eval(input()))
h = list(map(int, input().split()))
cost = [float('inf')] * n
cost[0] = 0
for i in range(n - 2):
cost[i + 1] = min(cost[i + 1], cost[i] + abs(h[i + 1] - h[i]))
cost[i + 2] = min(cost[i + 2], cost[i] + abs(h[i + 2] - h[i]))
cost[n - 1] = min(cost[n - 1], cost[n - 2] + abs(h[n - 1] - h[n... | 9 | 9 | 344 | 342 | n = int(eval(input()))
h = [int(e) for e in input().split()]
cost = [float("inf")] * n
cost[0] = 0
for i in range(n - 2):
cost[i + 1] = min(cost[i + 1], cost[i] + abs(h[i + 1] - h[i]))
cost[i + 2] = min(cost[i + 2], cost[i] + abs(h[i + 2] - h[i]))
cost[n - 1] = min(cost[n - 1], cost[n - 2] + abs(h[n - 1] - h[n ... | n = int(eval(input()))
h = list(map(int, input().split()))
cost = [float("inf")] * n
cost[0] = 0
for i in range(n - 2):
cost[i + 1] = min(cost[i + 1], cost[i] + abs(h[i + 1] - h[i]))
cost[i + 2] = min(cost[i + 2], cost[i] + abs(h[i + 2] - h[i]))
cost[n - 1] = min(cost[n - 1], cost[n - 2] + abs(h[n - 1] - h[n - ... | false | 0 | [
"-h = [int(e) for e in input().split()]",
"+h = list(map(int, input().split()))"
] | false | 0.042976 | 0.110957 | 0.387326 | [
"s472871170",
"s681126063"
] |
u970348538 | p02901 | python | s386620241 | s609873332 | 205 | 184 | 12,772 | 12,644 | Accepted | Accepted | 10.24 | import numpy as np
(n,m),*d = [list(map(int, s.split())) for s in open(0)]
inf = 100000000
dp = np.full([2]*n, inf, dtype=np.int)
dp[tuple([0]*n)] = 0
for i in range(m):
a = d[2*i][0]
b = d[2*i][1]
c = d[2*i+1]
l0 = [slice(None)]*n
l1 = [slice(1,None)]*n
for x in c:
... | import numpy as np
(n,m),*d = [list(map(int, s.split())) for s in open(0)]
inf = 100000000
dp = np.full([2]*n, inf, dtype=np.int)
dp[tuple([0]*n)] = 0
for i in range(m):
a = d[2*i][0]
b = d[2*i][1]
c = d[2*i+1]
l0 = [slice(None)]*n
for x in c:
l0[x-1] = slice(None,1)
... | 24 | 22 | 529 | 443 | import numpy as np
(n, m), *d = [list(map(int, s.split())) for s in open(0)]
inf = 100000000
dp = np.full([2] * n, inf, dtype=np.int)
dp[tuple([0] * n)] = 0
for i in range(m):
a = d[2 * i][0]
b = d[2 * i][1]
c = d[2 * i + 1]
l0 = [slice(None)] * n
l1 = [slice(1, None)] * n
for x in c:
l... | import numpy as np
(n, m), *d = [list(map(int, s.split())) for s in open(0)]
inf = 100000000
dp = np.full([2] * n, inf, dtype=np.int)
dp[tuple([0] * n)] = 0
for i in range(m):
a = d[2 * i][0]
b = d[2 * i][1]
c = d[2 * i + 1]
l0 = [slice(None)] * n
for x in c:
l0[x - 1] = slice(None, 1)
... | false | 8.333333 | [
"- l1 = [slice(1, None)] * n",
"- l1[x - 1] = slice(None)",
"- dp = np.minimum(np.minimum(dp[tuple(l1)], dp[tuple(l0)] + a), dp)",
"+ dp = np.minimum(dp, dp[tuple(l0)] + a)"
] | false | 1.262018 | 0.953029 | 1.324217 | [
"s386620241",
"s609873332"
] |
u179169725 | p03796 | python | s013338942 | s408559915 | 48 | 34 | 9,112 | 10,824 | Accepted | Accepted | 29.17 | MOD = 10**9 + 7
N = int(eval(input()))
ans = 1
for i in range(2, N + 1):
ans *= i
ans %= MOD
print(ans)
| mycode = '''
# distutils: language=c++
# cython: language_level=3, boundscheck=False, wraparound=False
# cython: cdivision=True
# False:Cython はCの型に対する除算・剰余演算子に関する仕様を、(被演算子間の符号が異なる場合の振る舞いが異なる)Pythonのintの仕様に合わせ、除算する数が0の場合にZeroDivisionErrorを送出します。この処理を行わせると、速度に 35% ぐらいのペナルティが生じます。 True:チェックを行いません。
from libcpp.vect... | 7 | 32 | 112 | 793 | MOD = 10**9 + 7
N = int(eval(input()))
ans = 1
for i in range(2, N + 1):
ans *= i
ans %= MOD
print(ans)
| mycode = """
# distutils: language=c++
# cython: language_level=3, boundscheck=False, wraparound=False
# cython: cdivision=True
# False:Cython はCの型に対する除算・剰余演算子に関する仕様を、(被演算子間の符号が異なる場合の振る舞いが異なる)Pythonのintの仕様に合わせ、除算する数が0の場合にZeroDivisionErrorを送出します。この処理を行わせると、速度に 35% ぐらいのペナルティが生じます。 True:チェックを行いません。
from libcpp.vector cimp... | false | 78.125 | [
"-MOD = 10**9 + 7",
"-N = int(eval(input()))",
"-ans = 1",
"+mycode = \"\"\"",
"+# distutils: language=c++",
"+# cython: language_level=3, boundscheck=False, wraparound=False",
"+# cython: cdivision=True",
"+# False:Cython はCの型に対する除算・剰余演算子に関する仕様を、(被演算子間の符号が異なる場合の振る舞いが異なる)Pythonのintの仕様に合わせ、除算する数が0の場合にZ... | false | 0.106656 | 0.03704 | 2.879515 | [
"s013338942",
"s408559915"
] |
u150984829 | p00449 | python | s707295210 | s133038947 | 3,980 | 2,630 | 6,232 | 6,248 | Accepted | Accepted | 33.92 | import sys
r=sys.stdin.readline
I=float('inf')
for e in iter(r,'0 0\n'):
n,k=list(map(int,e.split()))
F=[[I]*-~n for _ in[0]*-~n]
for i in range(1,n+1):F[i][i]=0
for _ in[0]*k:
f=r();g=list(map(int,f[2:].split()))
if'0'==f[0]:a,b=g;A=F[a][b];print(([A,-1][A==I]))
else:
c,d,e=g
if e<F[c][d]:
... | def s():
import sys
r=sys.stdin.readline
I=float('inf')
for e in iter(r,'0 0\n'):
n,k=list(map(int,e.split()))
F=[[I]*-~n for _ in[0]*-~n]
for i in range(1,n+1):F[i][i]=0
for _ in[0]*k:
f=r();g=list(map(int,f[2:].split()))
if'0'==f[0]:a,b=g;A=F[a][b];print(([A,-1][A==I]))
else:
c,d,... | 16 | 18 | 433 | 487 | import sys
r = sys.stdin.readline
I = float("inf")
for e in iter(r, "0 0\n"):
n, k = list(map(int, e.split()))
F = [[I] * -~n for _ in [0] * -~n]
for i in range(1, n + 1):
F[i][i] = 0
for _ in [0] * k:
f = r()
g = list(map(int, f[2:].split()))
if "0" == f[0]:
... | def s():
import sys
r = sys.stdin.readline
I = float("inf")
for e in iter(r, "0 0\n"):
n, k = list(map(int, e.split()))
F = [[I] * -~n for _ in [0] * -~n]
for i in range(1, n + 1):
F[i][i] = 0
for _ in [0] * k:
f = r()
g = list(map(int... | false | 11.111111 | [
"-import sys",
"+def s():",
"+ import sys",
"-r = sys.stdin.readline",
"-I = float(\"inf\")",
"-for e in iter(r, \"0 0\\n\"):",
"- n, k = list(map(int, e.split()))",
"- F = [[I] * -~n for _ in [0] * -~n]",
"- for i in range(1, n + 1):",
"- F[i][i] = 0",
"- for _ in [0] * k:... | false | 0.040051 | 0.047314 | 0.846502 | [
"s707295210",
"s133038947"
] |
u411203878 | p02912 | python | s681845544 | s191651948 | 164 | 145 | 92,444 | 92,384 | Accepted | Accepted | 11.59 | import heapq
n,m = list(map(int,input().split()))
a = list(map(int,input().split()))
a = [-1*i for i in a]
heapq.heapify(a)
count = 0
while count < m:
item = heapq.heappop(a)
item= abs(item)
discount_item = item//2
heapq.heappush(a,-1*discount_item)
count += 1
print((abs(su... | import heapq
N,M = list(map(int,input().split()))
T = list(map(int,input().split()))
memo = []
for t in T:
memo.append(-t)
memo.sort()
for m in range(M):
tmp = heapq.heappop(memo)
tmp = int(tmp/2)
heapq.heappush(memo,tmp)
print((-1*sum(memo)))
| 20 | 16 | 319 | 271 | import heapq
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a = [-1 * i for i in a]
heapq.heapify(a)
count = 0
while count < m:
item = heapq.heappop(a)
item = abs(item)
discount_item = item // 2
heapq.heappush(a, -1 * discount_item)
count += 1
print((abs(sum(a))))
| import heapq
N, M = list(map(int, input().split()))
T = list(map(int, input().split()))
memo = []
for t in T:
memo.append(-t)
memo.sort()
for m in range(M):
tmp = heapq.heappop(memo)
tmp = int(tmp / 2)
heapq.heappush(memo, tmp)
print((-1 * sum(memo)))
| false | 20 | [
"-n, m = list(map(int, input().split()))",
"-a = list(map(int, input().split()))",
"-a = [-1 * i for i in a]",
"-heapq.heapify(a)",
"-count = 0",
"-while count < m:",
"- item = heapq.heappop(a)",
"- item = abs(item)",
"- discount_item = item // 2",
"- heapq.heappush(a, -1 * discount_it... | false | 0.096838 | 0.077337 | 1.252151 | [
"s681845544",
"s191651948"
] |
u589969467 | p03998 | python | s011658056 | s252957068 | 28 | 25 | 9,128 | 9,064 | Accepted | Accepted | 10.71 | dic = {}
dic.setdefault('a',str(eval(input()))+'E')
dic.setdefault('b',str(eval(input()))+'E')
dic.setdefault('c',str(eval(input()))+'E')
dare = dic['a'][0]
dic['a'] = dic['a'][1:]
while len(dic['a'])>0 and len(dic['b'])>0 and len(dic['c'])>0:
tmp = dic[dare][0]
dic[dare] = dic[dare][1:]
if tmp=='E... | dic = {}
dic.setdefault('a',str(eval(input()))+'A')
dic.setdefault('b',str(eval(input()))+'B')
dic.setdefault('c',str(eval(input()))+'C')
dare = dic['a'][0]
dic['a'] = dic['a'][1:]
while len(dic['a'])>0 and len(dic['b'])>0 and len(dic['c'])>0:
tmp = dic[dare][0]
dic[dare] = dic[dare][1:]
dare = tmp... | 13 | 11 | 361 | 316 | dic = {}
dic.setdefault("a", str(eval(input())) + "E")
dic.setdefault("b", str(eval(input())) + "E")
dic.setdefault("c", str(eval(input())) + "E")
dare = dic["a"][0]
dic["a"] = dic["a"][1:]
while len(dic["a"]) > 0 and len(dic["b"]) > 0 and len(dic["c"]) > 0:
tmp = dic[dare][0]
dic[dare] = dic[dare][1:]
if t... | dic = {}
dic.setdefault("a", str(eval(input())) + "A")
dic.setdefault("b", str(eval(input())) + "B")
dic.setdefault("c", str(eval(input())) + "C")
dare = dic["a"][0]
dic["a"] = dic["a"][1:]
while len(dic["a"]) > 0 and len(dic["b"]) > 0 and len(dic["c"]) > 0:
tmp = dic[dare][0]
dic[dare] = dic[dare][1:]
dare... | false | 15.384615 | [
"-dic.setdefault(\"a\", str(eval(input())) + \"E\")",
"-dic.setdefault(\"b\", str(eval(input())) + \"E\")",
"-dic.setdefault(\"c\", str(eval(input())) + \"E\")",
"+dic.setdefault(\"a\", str(eval(input())) + \"A\")",
"+dic.setdefault(\"b\", str(eval(input())) + \"B\")",
"+dic.setdefault(\"c\", str(eval(inp... | false | 0.060989 | 0.038717 | 1.575243 | [
"s011658056",
"s252957068"
] |
u865741247 | p03470 | python | s261952190 | s195290424 | 32 | 17 | 3,060 | 2,940 | Accepted | Accepted | 46.88 | a=int(eval(input()))
k=[]
for i in range(a):
k.append(int(eval(input())))
k.sort()
result=1
for i in range(len(k)-1):
if k[i]<k[i+1]:
result+=1
print(result) | n=eval(input())
moti=[]
n=int(n)
for _ in range(n):
moti.append(eval(input()))
moti=list(set(moti))
print((len(moti))) | 10 | 8 | 170 | 114 | a = int(eval(input()))
k = []
for i in range(a):
k.append(int(eval(input())))
k.sort()
result = 1
for i in range(len(k) - 1):
if k[i] < k[i + 1]:
result += 1
print(result)
| n = eval(input())
moti = []
n = int(n)
for _ in range(n):
moti.append(eval(input()))
moti = list(set(moti))
print((len(moti)))
| false | 20 | [
"-a = int(eval(input()))",
"-k = []",
"-for i in range(a):",
"- k.append(int(eval(input())))",
"-k.sort()",
"-result = 1",
"-for i in range(len(k) - 1):",
"- if k[i] < k[i + 1]:",
"- result += 1",
"-print(result)",
"+n = eval(input())",
"+moti = []",
"+n = int(n)",
"+for _ in ... | false | 0.094991 | 0.074842 | 1.269227 | [
"s261952190",
"s195290424"
] |
u520276780 | p02946 | python | s013034190 | s681711752 | 184 | 17 | 38,384 | 3,060 | Accepted | Accepted | 90.76 | k,x=list(map(int,input().split()))
ans=list(range(x-k+1,x+k))
print((*ans)) | k,x = map(int, input().split())
for i in range(k):
print(x-k+i+1,end=" ")
for i in range(1,k):
print(x+i,end=" ")
| 4 | 5 | 65 | 121 | k, x = list(map(int, input().split()))
ans = list(range(x - k + 1, x + k))
print((*ans))
| k, x = map(int, input().split())
for i in range(k):
print(x - k + i + 1, end=" ")
for i in range(1, k):
print(x + i, end=" ")
| false | 20 | [
"-k, x = list(map(int, input().split()))",
"-ans = list(range(x - k + 1, x + k))",
"-print((*ans))",
"+k, x = map(int, input().split())",
"+for i in range(k):",
"+ print(x - k + i + 1, end=\" \")",
"+for i in range(1, k):",
"+ print(x + i, end=\" \")"
] | false | 0.10552 | 0.038584 | 2.734818 | [
"s013034190",
"s681711752"
] |
u476604182 | p03660 | python | s866714874 | s939190476 | 741 | 355 | 75,480 | 30,964 | Accepted | Accepted | 52.09 | from collections import defaultdict
N = int(eval(input()))
dic = defaultdict(list)
for i in range(N-1):
a, b = list(map(int, input().split()))
dic[a-1] += [b-1]
dic[b-1] += [a-1]
dist1 = [float('inf')]*N
dist2 = [float('inf')]*N
q1 = [0]
q2 = [N-1]
dist1[0] = 0
dist2[N-1] = 0
while q1:
... | from collections import deque
N, *L = list(map(int, open(0).read().split()))
dic = [[] for i in range(N+1)]
for a,b in zip(*[iter(L)]*2):
dic[a] += [b]
dic[b] += [a]
fdist = [-1]*(N+1)
sdist = [-1]*(N+1)
fdist[1] = 0
sdist[N] = 0
q = deque([1])
while q:
v = q.popleft()
for u in dic[v]:
if fdis... | 43 | 29 | 714 | 616 | from collections import defaultdict
N = int(eval(input()))
dic = defaultdict(list)
for i in range(N - 1):
a, b = list(map(int, input().split()))
dic[a - 1] += [b - 1]
dic[b - 1] += [a - 1]
dist1 = [float("inf")] * N
dist2 = [float("inf")] * N
q1 = [0]
q2 = [N - 1]
dist1[0] = 0
dist2[N - 1] = 0
while q1:
... | from collections import deque
N, *L = list(map(int, open(0).read().split()))
dic = [[] for i in range(N + 1)]
for a, b in zip(*[iter(L)] * 2):
dic[a] += [b]
dic[b] += [a]
fdist = [-1] * (N + 1)
sdist = [-1] * (N + 1)
fdist[1] = 0
sdist[N] = 0
q = deque([1])
while q:
v = q.popleft()
for u in dic[v]:
... | false | 32.55814 | [
"-from collections import defaultdict",
"+from collections import deque",
"-N = int(eval(input()))",
"-dic = defaultdict(list)",
"-for i in range(N - 1):",
"- a, b = list(map(int, input().split()))",
"- dic[a - 1] += [b - 1]",
"- dic[b - 1] += [a - 1]",
"-dist1 = [float(\"inf\")] * N",
"-... | false | 0.077495 | 0.072544 | 1.068246 | [
"s866714874",
"s939190476"
] |
u970197315 | p02720 | python | s203190277 | s171815922 | 788 | 527 | 17,332 | 29,292 | Accepted | Accepted | 33.12 | def dfs(s,l):
if s!="":
if len(s)>10 or s[0]=="0":
return
if s!="":
l.append(int(s))
for c in "0123456789":
if s!="":
if abs(int(s[-1])-int(c))<=1:
dfs(s+c,l)
else:
if c!="0":
dfs(s+c,l)
k=int(eval(input()))
l=[]
dfs("",l)
l.sort()
print((l[k-1]... | import sys
sys.setrecursionlimit(10000000)
def dfs(s):
if len(s)==11:
return
if s!="":
a.append(int(s))
for c in "0123456789":
if s=="" and c=="0":continue
if len(s)>0:
if abs(ord(s[-1])-ord(c))<=1:
dfs(s+c)
else:
dfs(s+c)
k=int(eval(input()))
a=[]
dfs("")... | 19 | 20 | 315 | 356 | def dfs(s, l):
if s != "":
if len(s) > 10 or s[0] == "0":
return
if s != "":
l.append(int(s))
for c in "0123456789":
if s != "":
if abs(int(s[-1]) - int(c)) <= 1:
dfs(s + c, l)
else:
if c != "0":
dfs(s + c, l... | import sys
sys.setrecursionlimit(10000000)
def dfs(s):
if len(s) == 11:
return
if s != "":
a.append(int(s))
for c in "0123456789":
if s == "" and c == "0":
continue
if len(s) > 0:
if abs(ord(s[-1]) - ord(c)) <= 1:
dfs(s + c)
... | false | 5 | [
"-def dfs(s, l):",
"+import sys",
"+",
"+sys.setrecursionlimit(10000000)",
"+",
"+",
"+def dfs(s):",
"+ if len(s) == 11:",
"+ return",
"- if len(s) > 10 or s[0] == \"0\":",
"- return",
"- if s != \"\":",
"- l.append(int(s))",
"+ a.append(int(s))... | false | 1.710951 | 1.089771 | 1.570009 | [
"s203190277",
"s171815922"
] |
u037430802 | p03240 | python | s382307649 | s872454082 | 395 | 210 | 3,064 | 41,072 | Accepted | Accepted | 46.84 | N = int(eval(input()))
xyh = [tuple(map(int, input().split())) for _ in range(N)]
for cx in range(0, 101):
for cy in range(0, 101):
flag = True
for i, (x,y,h) in enumerate(xyh):
if h != 0:
H = h + abs(x - cx) + abs(y - cy)
for i, (x,y,h) in enumera... |
N = int(eval(input()))
HXY = []
for i in range(N):
x,y,h = list(map(int, input().split()))
HXY.append((h,x,y))
HXY.sort(reverse=True)
for cx in range(101):
for cy in range(101):
H = HXY[0][0] + abs(HXY[0][1] - cx) + abs(HXY[0][2] - cy)
is_valid = True
for h,x,... | 21 | 27 | 549 | 566 | N = int(eval(input()))
xyh = [tuple(map(int, input().split())) for _ in range(N)]
for cx in range(0, 101):
for cy in range(0, 101):
flag = True
for i, (x, y, h) in enumerate(xyh):
if h != 0:
H = h + abs(x - cx) + abs(y - cy)
for i, (x, y, h) in enumerate(xyh):
... | N = int(eval(input()))
HXY = []
for i in range(N):
x, y, h = list(map(int, input().split()))
HXY.append((h, x, y))
HXY.sort(reverse=True)
for cx in range(101):
for cy in range(101):
H = HXY[0][0] + abs(HXY[0][1] - cx) + abs(HXY[0][2] - cy)
is_valid = True
for h, x, y in HXY:
... | false | 22.222222 | [
"-xyh = [tuple(map(int, input().split())) for _ in range(N)]",
"-for cx in range(0, 101):",
"- for cy in range(0, 101):",
"- flag = True",
"- for i, (x, y, h) in enumerate(xyh):",
"- if h != 0:",
"- H = h + abs(x - cx) + abs(y - cy)",
"- for i, (x, y, ... | false | 0.0962 | 0.03982 | 2.415864 | [
"s382307649",
"s872454082"
] |
u335973735 | p03448 | python | s828320278 | s122546670 | 57 | 46 | 3,060 | 3,064 | Accepted | Accepted | 19.3 | coin_list = []
for i in range(3):
s = int(eval(input()))
coin_list.append(s)
target = int(eval(input()))
counter = 0
for a in range(coin_list[0]+1):
for b in range(coin_list[1]+1):
for c in range(coin_list[2]+1):
total = 500*a + 100*b + 50*c
if total == target:
... | coin_list = []
for i in range(3):
s = int(eval(input()))
coin_list.append(s)
target = int(eval(input()))
counter = 0
for a in range(coin_list[0]+1):
for b in range(coin_list[1]+1):
for c in range(coin_list[2]+1):
total = 500*a + 100*b + 50*c
if total == target:
... | 15 | 17 | 362 | 417 | coin_list = []
for i in range(3):
s = int(eval(input()))
coin_list.append(s)
target = int(eval(input()))
counter = 0
for a in range(coin_list[0] + 1):
for b in range(coin_list[1] + 1):
for c in range(coin_list[2] + 1):
total = 500 * a + 100 * b + 50 * c
if total == target:
... | coin_list = []
for i in range(3):
s = int(eval(input()))
coin_list.append(s)
target = int(eval(input()))
counter = 0
for a in range(coin_list[0] + 1):
for b in range(coin_list[1] + 1):
for c in range(coin_list[2] + 1):
total = 500 * a + 100 * b + 50 * c
if total == target:
... | false | 11.764706 | [
"+ if total > target:",
"+ break"
] | false | 0.105979 | 0.083068 | 1.275806 | [
"s828320278",
"s122546670"
] |
u073549161 | p03761 | python | s490167238 | s759822610 | 217 | 165 | 42,352 | 38,640 | Accepted | Accepted | 23.96 | # アルゴリズムイントロダクション 15.4 LCS
# Longest Common Subsequenceをとり、以下を返す
# b: 結果
# c: そこまでのlongestのcount(内部用)
def lcs_length(x, y):
m, n = len(x), len(y)
b = [[0 for _ in range(n + 1)] for _ in range(m + 1)]
c = [[0 for _ in range(n + 1)] for _ in range(m + 1)]
for i in range(1, m + 1):
for j i... | s = ""
dat = []
n = int(eval(input()))
for _ in range(n):
dat.append(eval(input()))
for i in range(26):
tch = chr(ord("a") + i)
num = 99999
for j in range(len(dat)):
num = min(num, dat[j].count(tch))
s += tch * num
print(s)
| 59 | 12 | 1,530 | 251 | # アルゴリズムイントロダクション 15.4 LCS
# Longest Common Subsequenceをとり、以下を返す
# b: 結果
# c: そこまでのlongestのcount(内部用)
def lcs_length(x, y):
m, n = len(x), len(y)
b = [[0 for _ in range(n + 1)] for _ in range(m + 1)]
c = [[0 for _ in range(n + 1)] for _ in range(m + 1)]
for i in range(1, m + 1):
for j in range(1... | s = ""
dat = []
n = int(eval(input()))
for _ in range(n):
dat.append(eval(input()))
for i in range(26):
tch = chr(ord("a") + i)
num = 99999
for j in range(len(dat)):
num = min(num, dat[j].count(tch))
s += tch * num
print(s)
| false | 79.661017 | [
"-# アルゴリズムイントロダクション 15.4 LCS",
"-# Longest Common Subsequenceをとり、以下を返す",
"-# b: 結果",
"-# c: そこまでのlongestのcount(内部用)",
"-def lcs_length(x, y):",
"- m, n = len(x), len(y)",
"- b = [[0 for _ in range(n + 1)] for _ in range(m + 1)]",
"- c = [[0 for _ in range(n + 1)] for _ in range(m + 1)]",
"-... | false | 0.073783 | 0.037227 | 1.98199 | [
"s490167238",
"s759822610"
] |
u620084012 | p03061 | python | s802797411 | s511324454 | 1,608 | 235 | 14,588 | 63,856 | Accepted | Accepted | 85.39 | import math
N = int(eval(input()))
A = sorted(list(map(int,input().split())))
def gcd(a,b):
if b == 0:
return a
return gcd(b,a%b)
M = A[-1]
P = [1,M]
for k in range(2,math.ceil(math.sqrt(M))+1):
if M % k == 0:
P.append(k)
P.append(M//k)
M = A[-2]
P.append(M)
for ... | import math
N = int(eval(input()))
A = sorted(list(map(int,input().split())))
def yakusuu(a):
P = [a]
for k in range(2,math.floor(math.sqrt(a))+1):
if a % k == 0:
P.append(k)
P.append(a//k)
return P
P = set(yakusuu(A[-1])+yakusuu(A[-2]))
ans = 1
for e in P:
... | 35 | 24 | 635 | 475 | import math
N = int(eval(input()))
A = sorted(list(map(int, input().split())))
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
M = A[-1]
P = [1, M]
for k in range(2, math.ceil(math.sqrt(M)) + 1):
if M % k == 0:
P.append(k)
P.append(M // k)
M = A[-2]
P.append(M)
for k in ... | import math
N = int(eval(input()))
A = sorted(list(map(int, input().split())))
def yakusuu(a):
P = [a]
for k in range(2, math.floor(math.sqrt(a)) + 1):
if a % k == 0:
P.append(k)
P.append(a // k)
return P
P = set(yakusuu(A[-1]) + yakusuu(A[-2]))
ans = 1
for e in P:
f... | false | 31.428571 | [
"-def gcd(a, b):",
"- if b == 0:",
"- return a",
"- return gcd(b, a % b)",
"+def yakusuu(a):",
"+ P = [a]",
"+ for k in range(2, math.floor(math.sqrt(a)) + 1):",
"+ if a % k == 0:",
"+ P.append(k)",
"+ P.append(a // k)",
"+ return P",
"-M = A[... | false | 0.062315 | 0.039578 | 1.574488 | [
"s802797411",
"s511324454"
] |
u367794409 | p02936 | python | s495865460 | s841633412 | 1,497 | 1,106 | 282,704 | 161,304 | Accepted | Accepted | 26.12 | import sys
sys.setrecursionlimit(10 ** 6)
def dfs(v,prev = -1):
for u in graph[v]:
if u == prev:
continue
point[u] += point[v]
dfs(u,v)
N, Q = list(map(int,input().split()))
graph = [[] for _ in range(N)]
point = [0]*N
for i in range(N-1):
a,b = list(map(int... | import sys
from collections import deque
sys.setrecursionlimit(10 ** 6)
def input():
return sys.stdin.readline()[:-1]
def dfs(s):
stack = [s]
visited = [False]*N
while stack:
v = stack.pop()
if visited[v]:
continue
visited[v] = True
for u in gra... | 26 | 35 | 515 | 767 | import sys
sys.setrecursionlimit(10**6)
def dfs(v, prev=-1):
for u in graph[v]:
if u == prev:
continue
point[u] += point[v]
dfs(u, v)
N, Q = list(map(int, input().split()))
graph = [[] for _ in range(N)]
point = [0] * N
for i in range(N - 1):
a, b = list(map(int, input()... | import sys
from collections import deque
sys.setrecursionlimit(10**6)
def input():
return sys.stdin.readline()[:-1]
def dfs(s):
stack = [s]
visited = [False] * N
while stack:
v = stack.pop()
if visited[v]:
continue
visited[v] = True
for u in graph[v]:
... | false | 25.714286 | [
"+from collections import deque",
"-def dfs(v, prev=-1):",
"- for u in graph[v]:",
"- if u == prev:",
"+def input():",
"+ return sys.stdin.readline()[:-1]",
"+",
"+",
"+def dfs(s):",
"+ stack = [s]",
"+ visited = [False] * N",
"+ while stack:",
"+ v = stack.pop()... | false | 0.044843 | 0.047586 | 0.942358 | [
"s495865460",
"s841633412"
] |
u991542950 | p02555 | python | s565267078 | s385952281 | 853 | 69 | 332,092 | 63,772 | Accepted | Accepted | 91.91 | S = int(eval(input()))
mod = (10 ** 9 + 7)
if S < 3:
print((0))
else:
ans = 1
max_length = S // 3
dp = [[-1 for i in range(S-3+1)] for j in range(max_length+1)]
for diff_size in range(S-3+1):
for length in range(max_length+1):
if length == 0:
dp[length][diff_size] = 0
elif ... | mod = (10 ** 9 + 7)
tot = 1
l = [1, 0, 0]
for i in range(2000):
nex = (tot - l[-1] - l[-2]) % mod
tot = (tot + nex) % mod
l.append(nex)
print((l[int(eval(input()))])) | 27 | 8 | 789 | 171 | S = int(eval(input()))
mod = 10**9 + 7
if S < 3:
print((0))
else:
ans = 1
max_length = S // 3
dp = [[-1 for i in range(S - 3 + 1)] for j in range(max_length + 1)]
for diff_size in range(S - 3 + 1):
for length in range(max_length + 1):
if length == 0:
dp[length][di... | mod = 10**9 + 7
tot = 1
l = [1, 0, 0]
for i in range(2000):
nex = (tot - l[-1] - l[-2]) % mod
tot = (tot + nex) % mod
l.append(nex)
print((l[int(eval(input()))]))
| false | 70.37037 | [
"-S = int(eval(input()))",
"-if S < 3:",
"- print((0))",
"-else:",
"- ans = 1",
"- max_length = S // 3",
"- dp = [[-1 for i in range(S - 3 + 1)] for j in range(max_length + 1)]",
"- for diff_size in range(S - 3 + 1):",
"- for length in range(max_length + 1):",
"- i... | false | 0.246496 | 0.037295 | 6.609304 | [
"s565267078",
"s385952281"
] |
u309141201 | p03767 | python | s115901436 | s373788693 | 323 | 155 | 119,392 | 42,640 | Accepted | Accepted | 52.01 | n = int(eval(input()))
a = sorted(map(int, input().split()))
ans = 0
l = 0
r = 3*n-1
while l < r:
ans += a[r-1]
l += 1
r -= 2
# print(l, r)
print(ans) | n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
a.sort(reverse=True)
for i in range(n):
ans += a[2*i+1]
print(ans) | 12 | 8 | 172 | 139 | n = int(eval(input()))
a = sorted(map(int, input().split()))
ans = 0
l = 0
r = 3 * n - 1
while l < r:
ans += a[r - 1]
l += 1
r -= 2
# print(l, r)
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
a.sort(reverse=True)
for i in range(n):
ans += a[2 * i + 1]
print(ans)
| false | 33.333333 | [
"-a = sorted(map(int, input().split()))",
"+a = list(map(int, input().split()))",
"-l = 0",
"-r = 3 * n - 1",
"-while l < r:",
"- ans += a[r - 1]",
"- l += 1",
"- r -= 2",
"- # print(l, r)",
"+a.sort(reverse=True)",
"+for i in range(n):",
"+ ans += a[2 * i + 1]"
] | false | 0.039959 | 0.0403 | 0.991533 | [
"s115901436",
"s373788693"
] |
u707498674 | p02642 | python | s651743816 | s634364631 | 235 | 208 | 32,216 | 32,208 | Accepted | Accepted | 11.49 | def solve(A):
n = A[-1]
is_nodiv = [True for _ in range(n+1)]
pre = 0
for a in A:
if pre == a or not is_nodiv[a]:
is_nodiv[a] = False
continue
for j in range(2*a, n+1, a):
is_nodiv[j] = False
pre = a
retur... | def solve(A):
n = A[-1]
is_nodiv = [True] * (n+1)
pre = 0
for a in A:
if pre == a or not is_nodiv[a]:
is_nodiv[a] = False
continue
for j in range(2*a, n+1, a):
is_nodiv[j] = False
pre = a
return sum([is_nodiv[a] f... | 28 | 28 | 526 | 506 | def solve(A):
n = A[-1]
is_nodiv = [True for _ in range(n + 1)]
pre = 0
for a in A:
if pre == a or not is_nodiv[a]:
is_nodiv[a] = False
continue
for j in range(2 * a, n + 1, a):
is_nodiv[j] = False
pre = a
return sum([is_nodiv[a] for a in A... | def solve(A):
n = A[-1]
is_nodiv = [True] * (n + 1)
pre = 0
for a in A:
if pre == a or not is_nodiv[a]:
is_nodiv[a] = False
continue
for j in range(2 * a, n + 1, a):
is_nodiv[j] = False
pre = a
return sum([is_nodiv[a] for a in A])
def mai... | false | 0 | [
"- is_nodiv = [True for _ in range(n + 1)]",
"+ is_nodiv = [True] * (n + 1)"
] | false | 0.110409 | 0.044721 | 2.468853 | [
"s651743816",
"s634364631"
] |
u997521090 | p03458 | python | s920408249 | s175363266 | 1,746 | 1,186 | 25,068 | 23,668 | Accepted | Accepted | 32.07 | R,r=range,raw_input
N,K=list(map(int,r().split()))
L=K+1
P,Q=R(K),R(L)
D=[L*[0]for i in Q]
a=b=0
for i in R(N):
x,y,c=r().split()
x,y=int(x),int(y)
p=(x/K+y/K+ord(c))%2
D[y%K+1][x%K+1]+=1-2*p
b+=p
for k in R(2):
for i in P:
for j in Q:D[(i+1,j)[k]][(j,i+1)[k]]+=D[(i,j)[k]][(j,i)[k]]
for i in Q:
... | R,r=range,raw_input;N,K=list(map(int,r().split()));L=K+1;P,Q=R(K),R(L);D=[L*[0]for i in Q];a=b=0
for i in R(N):x,y,c=r().split();x,y=int(x),int(y);p=(x/K+y/K+ord(c))%2;D[y%K+1][x%K+1]+=1-2*p;b+=p
for i in P:
for j in Q:D[i+1][j]+=D[i][j]
for i in P:
for j in Q:D[j][i+1]+=D[j][i]
for i in Q:
for j in Q:
S=D... | 20 | 10 | 392 | 370 | R, r = range, raw_input
N, K = list(map(int, r().split()))
L = K + 1
P, Q = R(K), R(L)
D = [L * [0] for i in Q]
a = b = 0
for i in R(N):
x, y, c = r().split()
x, y = int(x), int(y)
p = (x / K + y / K + ord(c)) % 2
D[y % K + 1][x % K + 1] += 1 - 2 * p
b += p
for k in R(2):
for i in P:
for... | R, r = range, raw_input
N, K = list(map(int, r().split()))
L = K + 1
P, Q = R(K), R(L)
D = [L * [0] for i in Q]
a = b = 0
for i in R(N):
x, y, c = r().split()
x, y = int(x), int(y)
p = (x / K + y / K + ord(c)) % 2
D[y % K + 1][x % K + 1] += 1 - 2 * p
b += p
for i in P:
for j in Q:
D[i + ... | false | 50 | [
"-for k in R(2):",
"- for i in P:",
"- for j in Q:",
"- D[(i + 1, j)[k]][(j, i + 1)[k]] += D[(i, j)[k]][(j, i)[k]]",
"+for i in P:",
"+ for j in Q:",
"+ D[i + 1][j] += D[i][j]",
"+for i in P:",
"+ for j in Q:",
"+ D[j][i + 1] += D[j][i]"
] | false | 0.071634 | 0.036558 | 1.959463 | [
"s920408249",
"s175363266"
] |
u941753895 | p03266 | python | s167195995 | s691085928 | 68 | 41 | 5,836 | 10,700 | Accepted | Accepted | 39.71 | 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) f... | 31 | 23 | 705 | 650 | 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 | 25.806452 | [
"-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(): return [floa... | false | 0.048725 | 0.046202 | 1.054596 | [
"s167195995",
"s691085928"
] |
u295361373 | p02612 | python | s836901225 | s083098030 | 180 | 120 | 68,072 | 68,204 | Accepted | Accepted | 33.33 | '''
Auther: ghoshashis545 Ashis Ghosh
College: jalpaiguri Govt Enggineering College
'''
from os import path
import sys
from heapq import heappush,heappop
from functools import cmp_to_key as ctk
from collections import deque,defaultdict as dd
from bisect import bisect,bisect_left,bisect_right,insort,... | '''
Auther: ghoshashis545 Ashis Ghosh
College: jalpaiguri Govt Enggineering College
'''
from os import path
import sys
from heapq import heappush,heappop
from functools import cmp_to_key as ctk
from collections import deque,defaultdict as dd
from bisect import bisect,bisect_left,bisect_right,insort,... | 66 | 66 | 1,190 | 1,190 | """
Auther: ghoshashis545 Ashis Ghosh
College: jalpaiguri Govt Enggineering College
"""
from os import path
import sys
from heapq import heappush, heappop
from functools import cmp_to_key as ctk
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort... | """
Auther: ghoshashis545 Ashis Ghosh
College: jalpaiguri Govt Enggineering College
"""
from os import path
import sys
from heapq import heappush, heappop
from functools import cmp_to_key as ctk
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort... | false | 0 | [
"-file = 0",
"+file = 1"
] | false | 0.044009 | 0.044562 | 0.987586 | [
"s836901225",
"s083098030"
] |
u804800128 | p02912 | python | s985953960 | s548044802 | 1,573 | 158 | 20,164 | 20,020 | Accepted | Accepted | 89.96 | def bin_tree( pri , li_pri , len_li ):
#pri: どこに入れていいかわからない値段
#li_pri: 値段のリスト(昇順)
#len_li: リストの長さ
lo = 0
hi = len_li - 1
while hi - lo > 1:
mid = lo + (hi - lo) // 2
guess = li_pri[mid]
if guess >= pri:
hi = mid
else:
lo = mid
... | import heapq
I = input().split()
N = int(I[0])
M = int(I[1])
# N: 品物の数
# M: 割引券の数
# A: 品物の値段行列
A = list(map(int , input().split()))
A = list([x*(-1) for x in A])
heapq.heapify(A)
for i in range(M):
M -= 1
pri = heapq.heappop(A)
pri *= -1
pri //= 2
pri *= -1
heapq.heappu... | 41 | 28 | 812 | 416 | def bin_tree(pri, li_pri, len_li):
# pri: どこに入れていいかわからない値段
# li_pri: 値段のリスト(昇順)
# len_li: リストの長さ
lo = 0
hi = len_li - 1
while hi - lo > 1:
mid = lo + (hi - lo) // 2
guess = li_pri[mid]
if guess >= pri:
hi = mid
else:
lo = mid
return lo
... | import heapq
I = input().split()
N = int(I[0])
M = int(I[1])
# N: 品物の数
# M: 割引券の数
# A: 品物の値段行列
A = list(map(int, input().split()))
A = list([x * (-1) for x in A])
heapq.heapify(A)
for i in range(M):
M -= 1
pri = heapq.heappop(A)
pri *= -1
pri //= 2
pri *= -1
heapq.heappush(A, pri)
Fi_pri = 0
fo... | false | 31.707317 | [
"-def bin_tree(pri, li_pri, len_li):",
"- # pri: どこに入れていいかわからない値段",
"- # li_pri: 値段のリスト(昇順)",
"- # len_li: リストの長さ",
"- lo = 0",
"- hi = len_li - 1",
"- while hi - lo > 1:",
"- mid = lo + (hi - lo) // 2",
"- guess = li_pri[mid]",
"- if guess >= pri:",
"- ... | false | 0.051848 | 0.039549 | 1.310978 | [
"s985953960",
"s548044802"
] |
u305366205 | p03103 | python | s470468845 | s863447717 | 874 | 491 | 63,576 | 26,748 | Accepted | Accepted | 43.82 | n, m = list(map(int, input().split()))
a = [0] * (n + 1)
b = [0] * (n + 1)
price = [0] * (n + 1)
ans = 0
shop = [tuple(map(int, input().split())) for _ in range(n)]
shop.sort()
for i in range(1, n + 1):
a_i, b_i = shop[i - 1]
a[i] = a[i - 1]
b[i] = b[i - 1]
price[i] = a_i
a[i] += a_i... | n, m = list(map(int, input().split()))
a = [0] * (n + 1)
b = [0] * (n + 1)
total = [0] * (n + 1)
ans = 0
# 安い店から選ぶ方法が最適
shop = [tuple(map(int, input().split())) for _ in range(n)]
shop.sort()
for i in range(1, n + 1):
a_i, b_i = shop[i - 1]
# 累積和を作っておく
# b[i]: i番目の店まで利用した際に購入できる栄養ドリンクの最大本数
... | 23 | 30 | 478 | 655 | n, m = list(map(int, input().split()))
a = [0] * (n + 1)
b = [0] * (n + 1)
price = [0] * (n + 1)
ans = 0
shop = [tuple(map(int, input().split())) for _ in range(n)]
shop.sort()
for i in range(1, n + 1):
a_i, b_i = shop[i - 1]
a[i] = a[i - 1]
b[i] = b[i - 1]
price[i] = a_i
a[i] += a_i * b_i
b[i] ... | n, m = list(map(int, input().split()))
a = [0] * (n + 1)
b = [0] * (n + 1)
total = [0] * (n + 1)
ans = 0
# 安い店から選ぶ方法が最適
shop = [tuple(map(int, input().split())) for _ in range(n)]
shop.sort()
for i in range(1, n + 1):
a_i, b_i = shop[i - 1]
# 累積和を作っておく
# b[i]: i番目の店まで利用した際に購入できる栄養ドリンクの最大本数
# total[i]: i... | false | 23.333333 | [
"-price = [0] * (n + 1)",
"+total = [0] * (n + 1)",
"+# 安い店から選ぶ方法が最適",
"- a[i] = a[i - 1]",
"+ # 累積和を作っておく",
"+ # b[i]: i番目の店まで利用した際に購入できる栄養ドリンクの最大本数",
"+ # total[i]: i番目の店まで利用した際に支払うお金の最大値",
"- price[i] = a_i",
"- a[i] += a_i * b_i",
"+ total[i] = total[i - 1]",
"+ total... | false | 0.035473 | 0.007368 | 4.814374 | [
"s470468845",
"s863447717"
] |
u860657719 | p03014 | python | s173420345 | s901726435 | 576 | 498 | 145,540 | 113,348 | Accepted | Accepted | 13.54 | h, w = list(map(int, input().split()))
s = []
for _ in range(h):
s.append(eval(input()))
lis_row = [[0 for j in range(w)] for i in range(h)]
lis_column = [[0 for j in range(w)] for i in range(h)]
for i in range(h):
tmp = 0
lis = []
for j in range(w):
if s[i][j] == "#":
lis... | h, w = list(map(int, input().split()))
s = []
for i in range(h):
s.append(eval(input()))
ans = [[0 for j in range(w)] for i in range(h)]
for i in range(h):
done = [False] * w
for j in range(w):
if s[i][j] == "#":
continue
if done[j]:
continue
l = 0... | 47 | 40 | 1,135 | 948 | h, w = list(map(int, input().split()))
s = []
for _ in range(h):
s.append(eval(input()))
lis_row = [[0 for j in range(w)] for i in range(h)]
lis_column = [[0 for j in range(w)] for i in range(h)]
for i in range(h):
tmp = 0
lis = []
for j in range(w):
if s[i][j] == "#":
lis.append(0)
... | h, w = list(map(int, input().split()))
s = []
for i in range(h):
s.append(eval(input()))
ans = [[0 for j in range(w)] for i in range(h)]
for i in range(h):
done = [False] * w
for j in range(w):
if s[i][j] == "#":
continue
if done[j]:
continue
l = 0
whi... | false | 14.893617 | [
"-for _ in range(h):",
"+for i in range(h):",
"-lis_row = [[0 for j in range(w)] for i in range(h)]",
"-lis_column = [[0 for j in range(w)] for i in range(h)]",
"+ans = [[0 for j in range(w)] for i in range(h)]",
"- tmp = 0",
"- lis = []",
"+ done = [False] * w",
"- lis.append(0)... | false | 0.089583 | 0.092104 | 0.972628 | [
"s173420345",
"s901726435"
] |
u086566114 | p02412 | python | s661718575 | s903205037 | 40 | 20 | 6,428 | 6,352 | Accepted | Accepted | 50 | def get_num(n, x):
ans = 0
for n3 in range(min(n, x - 3), (x + 2) / 3, -1):
for n2 in range(min(n3 - 1, x - n3 - 1), (x - n3 + 1) / 2 - 1, -1):
for n1 in range(min(n2 - 1, x - n3 - n2), 0, -1):
if n1 + n2 + n3 == x:
ans += 1
... | def get_num(n, x):
ans = 0
for n3 in range(min(n, x - 3), (x + 2) / 3, -1):
for n2 in range(min(n3 - 1, x - n3 - 1), (x - n3 + 1) / 2 - 1, -1):
for n1 in range(min(n2 - 1, x - n3 - n2), 0, -1):
if n3 == x - n1 - n2:
ans += 1
brea... | 19 | 19 | 519 | 524 | def get_num(n, x):
ans = 0
for n3 in range(min(n, x - 3), (x + 2) / 3, -1):
for n2 in range(min(n3 - 1, x - n3 - 1), (x - n3 + 1) / 2 - 1, -1):
for n1 in range(min(n2 - 1, x - n3 - n2), 0, -1):
if n1 + n2 + n3 == x:
ans += 1
return ans
while True:
... | def get_num(n, x):
ans = 0
for n3 in range(min(n, x - 3), (x + 2) / 3, -1):
for n2 in range(min(n3 - 1, x - n3 - 1), (x - n3 + 1) / 2 - 1, -1):
for n1 in range(min(n2 - 1, x - n3 - n2), 0, -1):
if n3 == x - n1 - n2:
ans += 1
break
r... | false | 0 | [
"- if n1 + n2 + n3 == x:",
"+ if n3 == x - n1 - n2:",
"+ break"
] | false | 0.036388 | 0.036026 | 1.010036 | [
"s661718575",
"s903205037"
] |
u077291787 | p03998 | python | s372225868 | s409701785 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | # ABC045B - 3人でカードゲームイージー / Card Game for Three (ABC Edit)
from collections import deque
def main():
S = {s: deque(list(input().rstrip())) for s in ("a", "b", "c")}
cur = S["a"].popleft()
while S[cur]: # search greedily
cur = S[cur].popleft()
print((cur.upper()))
if __name__ == ... | # ABC045B - 3人でカードゲームイージー / Card Game for Three (ABC Edit)
def main():
S = {s: list(input().rstrip())[::-1] for s in ("a", "b", "c")}
cur = "a"
while S[cur]: # search greedily
cur = S[cur].pop()
print((cur.upper()))
if __name__ == "__main__":
main() | 14 | 11 | 341 | 288 | # ABC045B - 3人でカードゲームイージー / Card Game for Three (ABC Edit)
from collections import deque
def main():
S = {s: deque(list(input().rstrip())) for s in ("a", "b", "c")}
cur = S["a"].popleft()
while S[cur]: # search greedily
cur = S[cur].popleft()
print((cur.upper()))
if __name__ == "__main__":
... | # ABC045B - 3人でカードゲームイージー / Card Game for Three (ABC Edit)
def main():
S = {s: list(input().rstrip())[::-1] for s in ("a", "b", "c")}
cur = "a"
while S[cur]: # search greedily
cur = S[cur].pop()
print((cur.upper()))
if __name__ == "__main__":
main()
| false | 21.428571 | [
"-from collections import deque",
"-",
"-",
"- S = {s: deque(list(input().rstrip())) for s in (\"a\", \"b\", \"c\")}",
"- cur = S[\"a\"].popleft()",
"+ S = {s: list(input().rstrip())[::-1] for s in (\"a\", \"b\", \"c\")}",
"+ cur = \"a\"",
"- cur = S[cur].popleft()",
"+ cur... | false | 0.041928 | 0.041246 | 1.01652 | [
"s372225868",
"s409701785"
] |
u018679195 | p03835 | python | s490916534 | s262869638 | 1,883 | 89 | 3,060 | 67,140 | Accepted | Accepted | 95.27 | from sys import stdin
n = input().split(' ')
c = 0
K = int(n[0])
S = int(n[1])
for i in range(int(K)+1):
for j in range(int(K)+1):
if(S-(i+j) <= K and S>=i+j):
c+=1
print(c) | k, s = list(map(int, input().split()))
ans = 0
for i in range(k + 1):
for j in range(k + 1):
if 0 <= s - i - j <= k:
ans +=1
print(ans) | 11 | 7 | 224 | 141 | from sys import stdin
n = input().split(" ")
c = 0
K = int(n[0])
S = int(n[1])
for i in range(int(K) + 1):
for j in range(int(K) + 1):
if S - (i + j) <= K and S >= i + j:
c += 1
print(c)
| k, s = list(map(int, input().split()))
ans = 0
for i in range(k + 1):
for j in range(k + 1):
if 0 <= s - i - j <= k:
ans += 1
print(ans)
| false | 36.363636 | [
"-from sys import stdin",
"-",
"-n = input().split(\" \")",
"-c = 0",
"-K = int(n[0])",
"-S = int(n[1])",
"-for i in range(int(K) + 1):",
"- for j in range(int(K) + 1):",
"- if S - (i + j) <= K and S >= i + j:",
"- c += 1",
"-print(c)",
"+k, s = list(map(int, input().split... | false | 0.084992 | 0.036706 | 2.315453 | [
"s490916534",
"s262869638"
] |
u912237403 | p00026 | python | s786661494 | s131372400 | 20 | 10 | 4,268 | 4,268 | Accepted | Accepted | 50 | def drop(x,y):
global paper
if 0<=x<10 and 0<=y<10: paper[y][x]+=1
return
def ink(x,y,size):
drop(x,y)
drop(x-1,y)
drop(x+1,y)
drop(x,y-1)
drop(x,y+1)
if size==1: return
drop(x-1,y-1)
drop(x-1,y+1)
drop(x+1,y-1)
drop(x+1,y+1)
if size==2: return
... | import sys
def ink(x,y,size):
global paper
paper[y][x]+=1
for d in [-1,1]:
paper[y+d][x]+=1
paper[y][x+d]+=1
if size==1: return
for d in [-1,1]:
paper[y+d][x+d]+=1
paper[y+d][x-d]+=1
if size==2: return
for d in [-2,2]:
paper[y+d][x]+=1
... | 33 | 30 | 657 | 593 | def drop(x, y):
global paper
if 0 <= x < 10 and 0 <= y < 10:
paper[y][x] += 1
return
def ink(x, y, size):
drop(x, y)
drop(x - 1, y)
drop(x + 1, y)
drop(x, y - 1)
drop(x, y + 1)
if size == 1:
return
drop(x - 1, y - 1)
drop(x - 1, y + 1)
drop(x + 1, y - 1)... | import sys
def ink(x, y, size):
global paper
paper[y][x] += 1
for d in [-1, 1]:
paper[y + d][x] += 1
paper[y][x + d] += 1
if size == 1:
return
for d in [-1, 1]:
paper[y + d][x + d] += 1
paper[y + d][x - d] += 1
if size == 2:
return
for d in [... | false | 9.090909 | [
"-def drop(x, y):",
"+import sys",
"+",
"+",
"+def ink(x, y, size):",
"- if 0 <= x < 10 and 0 <= y < 10:",
"- paper[y][x] += 1",
"+ paper[y][x] += 1",
"+ for d in [-1, 1]:",
"+ paper[y + d][x] += 1",
"+ paper[y][x + d] += 1",
"+ if size == 1:",
"+ retu... | false | 0.036656 | 0.039862 | 0.91957 | [
"s786661494",
"s131372400"
] |
u573754721 | p02803 | python | s901188481 | s028327908 | 1,758 | 295 | 58,204 | 48,348 | Accepted | Accepted | 83.22 | from collections import deque
h,w=list(map(int,input().split()))
S=[eval(input()) for _ in range(h)]
inf=float("inf")
ans=0
for i in range(h):
for j in range(w):
if S[i][j]=="#":
continue
else:
dist=[[inf for _ in range(w)] for _ in range(h)]
dist[i... | from collections import deque
h,w=list(map(int,input().split()))
S=[eval(input()) for _ in range(h)]
inf=float("inf")
ans=0
for i in range(h):
for j in range(w):
if S[i][j]=="#":
continue
else:
dist=[[inf for _ in range(w)] for _ in range(h)]
dist[i... | 29 | 25 | 1,023 | 784 | from collections import deque
h, w = list(map(int, input().split()))
S = [eval(input()) for _ in range(h)]
inf = float("inf")
ans = 0
for i in range(h):
for j in range(w):
if S[i][j] == "#":
continue
else:
dist = [[inf for _ in range(w)] for _ in range(h)]
dist[i... | from collections import deque
h, w = list(map(int, input().split()))
S = [eval(input()) for _ in range(h)]
inf = float("inf")
ans = 0
for i in range(h):
for j in range(w):
if S[i][j] == "#":
continue
else:
dist = [[inf for _ in range(w)] for _ in range(h)]
dist[i... | false | 13.793103 | [
"- queue = deque([(i, j)])",
"- while queue:",
"- si, sj = queue.popleft()",
"+ que = deque([(i, j)])",
"+ while que:",
"+ si, sj = que.popleft()",
"- queue.append((ni, nj))",
"- max_dis... | false | 0.068639 | 0.03645 | 1.883108 | [
"s901188481",
"s028327908"
] |
u711238850 | p03575 | python | s276481908 | s139390273 | 211 | 186 | 41,584 | 40,944 | Accepted | Accepted | 11.85 | class UnionFind:
def __init__(self,n):
super().__init__()
self.par = [-1]*n
self.rank = [0]*n
self.tsize = [1]*n
def root(self,x):
if self.par[x] == -1:
return x
else:
self.par[x] = self.root(self.par[x])
ret... | from collections import deque
n,m = tuple(map(int,input().split()))
edge = []
for i in range(m):
edge.append(tuple([int(a)-1 for a in input().split()]))
matrix = [[0]*n for _ in range(n)]
for a,b in edge:
matrix[a][b] = 1
matrix[b][a] = 1
ans = 0
for a,b in edge:
matrix[a][b] = 0
... | 56 | 39 | 1,364 | 705 | class UnionFind:
def __init__(self, n):
super().__init__()
self.par = [-1] * n
self.rank = [0] * n
self.tsize = [1] * n
def root(self, x):
if self.par[x] == -1:
return x
else:
self.par[x] = self.root(self.par[x])
return self.pa... | from collections import deque
n, m = tuple(map(int, input().split()))
edge = []
for i in range(m):
edge.append(tuple([int(a) - 1 for a in input().split()]))
matrix = [[0] * n for _ in range(n)]
for a, b in edge:
matrix[a][b] = 1
matrix[b][a] = 1
ans = 0
for a, b in edge:
matrix[a][b] = 0
matrix[b][... | false | 30.357143 | [
"-class UnionFind:",
"- def __init__(self, n):",
"- super().__init__()",
"- self.par = [-1] * n",
"- self.rank = [0] * n",
"- self.tsize = [1] * n",
"+from collections import deque",
"- def root(self, x):",
"- if self.par[x] == -1:",
"- return x"... | false | 0.037164 | 0.036738 | 1.011578 | [
"s276481908",
"s139390273"
] |
u943057856 | p03031 | python | s645775423 | s784713645 | 42 | 35 | 3,064 | 9,176 | Accepted | Accepted | 16.67 | n,m=list(map(int,input().split()))
switch=[list(map(int,input().split())) for i in range(m)]
p=list(map(int,input().split()))
ans=0
for i in range(2**n):
cnt=[0]*m
for j in range(n):
if (i>>j)&1==1:
for k in range(m):
if j+1 in switch[k][1:]:
cnt... | n,m=list(map(int,input().split()))
s=[list(map(int,input().split()))[1:] for _ in range(m)]
p=list(map(int,input().split()))
ans=0
for i in range(2**n):
tmp=[]
cnt=[0]*n
for j in range(n):
if (i>>j)&1:
tmp.append(j+1)
for k in range(m):
if len(set(tmp)&set(s[k]))... | 15 | 17 | 388 | 381 | n, m = list(map(int, input().split()))
switch = [list(map(int, input().split())) for i in range(m)]
p = list(map(int, input().split()))
ans = 0
for i in range(2**n):
cnt = [0] * m
for j in range(n):
if (i >> j) & 1 == 1:
for k in range(m):
if j + 1 in switch[k][1:]:
... | n, m = list(map(int, input().split()))
s = [list(map(int, input().split()))[1:] for _ in range(m)]
p = list(map(int, input().split()))
ans = 0
for i in range(2**n):
tmp = []
cnt = [0] * n
for j in range(n):
if (i >> j) & 1:
tmp.append(j + 1)
for k in range(m):
if len(set(tmp)... | false | 11.764706 | [
"-switch = [list(map(int, input().split())) for i in range(m)]",
"+s = [list(map(int, input().split()))[1:] for _ in range(m)]",
"- cnt = [0] * m",
"+ tmp = []",
"+ cnt = [0] * n",
"- if (i >> j) & 1 == 1:",
"- for k in range(m):",
"- if j + 1 in switch[k][1:]... | false | 0.068795 | 0.06891 | 0.998327 | [
"s645775423",
"s784713645"
] |
u078349616 | p02572 | python | s147738490 | s479022904 | 160 | 92 | 30,992 | 31,388 | Accepted | Accepted | 42.5 | N = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9+7
tmp = 0
for i in range(N):
tmp += A[i]
tmp = tmp % mod
all = (tmp % mod)**2
all = all % mod
tmp = 0
for i in range(N):
tmp += (A[i]* A[i]) % mod
di = tmp % mod
ans = all - di
ans *= (mod + 1) // 2
ans %= mod
p... | N = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9+7
S = sum(A)
S2 = sum([x*x for x in A])
print(((S*S - S2)//2 % mod)) | 22 | 9 | 323 | 146 | N = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7
tmp = 0
for i in range(N):
tmp += A[i]
tmp = tmp % mod
all = (tmp % mod) ** 2
all = all % mod
tmp = 0
for i in range(N):
tmp += (A[i] * A[i]) % mod
di = tmp % mod
ans = all - di
ans *= (mod + 1) // 2
ans %= mod
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7
S = sum(A)
S2 = sum([x * x for x in A])
print(((S * S - S2) // 2 % mod))
| false | 59.090909 | [
"-tmp = 0",
"-for i in range(N):",
"- tmp += A[i]",
"- tmp = tmp % mod",
"-all = (tmp % mod) ** 2",
"-all = all % mod",
"-tmp = 0",
"-for i in range(N):",
"- tmp += (A[i] * A[i]) % mod",
"-di = tmp % mod",
"-ans = all - di",
"-ans *= (mod + 1) // 2",
"-ans %= mod",
"-print(ans)",
... | false | 0.07002 | 0.073248 | 0.955931 | [
"s147738490",
"s479022904"
] |
u185249212 | p02690 | python | s319490683 | s178901642 | 174 | 127 | 78,388 | 78,316 | Accepted | Accepted | 27.01 |
import sys
sys.setrecursionlimit(500000)
import re
import array
import copy
import functools
import operator
import math
import string
import fractions
from fractions import Fraction
import collections
import itertools
import bisect
import random
import time
import heapq
from heapq import... |
import sys
sys.setrecursionlimit(500000)
import re
import array
import copy
import functools
import operator
import math
import string
import fractions
from fractions import Fraction
import collections
import itertools
import bisect
import random
import time
import heapq
from heapq import... | 92 | 92 | 1,728 | 1,727 | import sys
sys.setrecursionlimit(500000)
import re
import array
import copy
import functools
import operator
import math
import string
import fractions
from fractions import Fraction
import collections
import itertools
import bisect
import random
import time
import heapq
from heapq import heappush
from heapq import he... | import sys
sys.setrecursionlimit(500000)
import re
import array
import copy
import functools
import operator
import math
import string
import fractions
from fractions import Fraction
import collections
import itertools
import bisect
import random
import time
import heapq
from heapq import heappush
from heapq import he... | false | 0 | [
"- for a in range(0, 2000):",
"+ for a in range(0, 200):"
] | false | 1.932434 | 0.103088 | 18.74541 | [
"s319490683",
"s178901642"
] |
u951145045 | p02683 | python | s677259003 | s975653854 | 101 | 89 | 75,208 | 74,324 | Accepted | Accepted | 11.88 | number=list(map(int,input().split()))
n,m,x=number[0],number[1],number[2]
books=[list(map(int,input().split())) for i in range(n)]
U=[x for i in range(m+1)]
U[0]=0
pattern=[]
answer=[]
for i in range(2**n):
tmp=[False]*n
for j in range(n):
if (i>>j)&1:
tmp[j]=True
p... | number=list(map(int,input().split()))
N,M,X=number[0],number[1],number[2]
price=0
nums=[]
for i in range(N):
tmp=list(map(int,input().split()))
nums.append(tmp)
target=[0 for i in range(M)]
answer=10000000
for cowmask in range(1<<N):
price=0
target=[0 for k in range(M)]
for x... | 35 | 24 | 778 | 635 | number = list(map(int, input().split()))
n, m, x = number[0], number[1], number[2]
books = [list(map(int, input().split())) for i in range(n)]
U = [x for i in range(m + 1)]
U[0] = 0
pattern = []
answer = []
for i in range(2**n):
tmp = [False] * n
for j in range(n):
if (i >> j) & 1:
tmp[j] = ... | number = list(map(int, input().split()))
N, M, X = number[0], number[1], number[2]
price = 0
nums = []
for i in range(N):
tmp = list(map(int, input().split()))
nums.append(tmp)
target = [0 for i in range(M)]
answer = 10000000
for cowmask in range(1 << N):
price = 0
target = [0 for k in range(M)]
for... | false | 31.428571 | [
"-n, m, x = number[0], number[1], number[2]",
"-books = [list(map(int, input().split())) for i in range(n)]",
"-U = [x for i in range(m + 1)]",
"-U[0] = 0",
"-pattern = []",
"-answer = []",
"-for i in range(2**n):",
"- tmp = [False] * n",
"- for j in range(n):",
"- if (i >> j) & 1:",
... | false | 0.061567 | 0.061055 | 1.00839 | [
"s677259003",
"s975653854"
] |
u802963389 | p02960 | python | s373886583 | s720765002 | 766 | 552 | 62,300 | 62,172 | Accepted | Accepted | 27.94 | MOD = 10 ** 9 + 7
S = eval(input())
N = len(S)
dp = [[0] * 13 for _ in range(N + 1)]
dp[0][0] = 1
mul = 1
for i, x in enumerate(S[::-1]):
if x == "?":
for k in range(10):
for j in range(13):
jj = (mul * k + j) % 13
dp[i + 1][jj] += dp[i][j]
dp[i + 1][jj] %= MOD
... | S = eval(input())
n = len(S)
MOD = 10 ** 9 + 7
# dp[i][j] i桁までで、あまりjの個数
dp = [[0] * 13 for _ in range(n + 1)]
dp[0][0] = 1
for i, s in enumerate(S):
if s == "?":
c = -1
else:
c = int(s)
for j in range(10):
if c != -1 and c != j:
continue
for k in range(13):
dp[i + ... | 27 | 22 | 500 | 412 | MOD = 10**9 + 7
S = eval(input())
N = len(S)
dp = [[0] * 13 for _ in range(N + 1)]
dp[0][0] = 1
mul = 1
for i, x in enumerate(S[::-1]):
if x == "?":
for k in range(10):
for j in range(13):
jj = (mul * k + j) % 13
dp[i + 1][jj] += dp[i][j]
dp[i + 1]... | S = eval(input())
n = len(S)
MOD = 10**9 + 7
# dp[i][j] i桁までで、あまりjの個数
dp = [[0] * 13 for _ in range(n + 1)]
dp[0][0] = 1
for i, s in enumerate(S):
if s == "?":
c = -1
else:
c = int(s)
for j in range(10):
if c != -1 and c != j:
continue
for k in range(13):
... | false | 18.518519 | [
"+S = eval(input())",
"+n = len(S)",
"-S = eval(input())",
"-N = len(S)",
"-dp = [[0] * 13 for _ in range(N + 1)]",
"+# dp[i][j] i桁までで、あまりjの個数",
"+dp = [[0] * 13 for _ in range(n + 1)]",
"-mul = 1",
"-for i, x in enumerate(S[::-1]):",
"- if x == \"?\":",
"- for k in range(10):",
"- ... | false | 0.181173 | 0.048071 | 3.768877 | [
"s373886583",
"s720765002"
] |
u392319141 | p03347 | python | s081203154 | s535041796 | 508 | 214 | 22,056 | 27,908 | Accepted | Accepted | 57.87 | N = int(eval(input()))
A = [[]]
for _ in range(N):
a = int(eval(input()))
if len(A[-1]) > 0 and a < A[-1][-1]:
A.append([])
A[-1].append(a)
def isOk():
for l, r in zip(A, A[1:]):
if l[-1] + 1 < r[0]:
return False
for grp in A:
for l, r in zip(grp, ... | import sys
input = sys.stdin.buffer.readline
N = int(eval(input()))
G = [[]]
A = []
for _ in range(N):
a = int(eval(input()))
if len(G[-1]) > 0 and G[-1][-1] > a:
G.append([])
A.append(a)
G[-1].append(a)
def isOk():
if any(l[-1] + 1 < r[0] for l, r in zip(G, G[1:])):
... | 34 | 33 | 597 | 606 | N = int(eval(input()))
A = [[]]
for _ in range(N):
a = int(eval(input()))
if len(A[-1]) > 0 and a < A[-1][-1]:
A.append([])
A[-1].append(a)
def isOk():
for l, r in zip(A, A[1:]):
if l[-1] + 1 < r[0]:
return False
for grp in A:
for l, r in zip(grp, grp[1:]):
... | import sys
input = sys.stdin.buffer.readline
N = int(eval(input()))
G = [[]]
A = []
for _ in range(N):
a = int(eval(input()))
if len(G[-1]) > 0 and G[-1][-1] > a:
G.append([])
A.append(a)
G[-1].append(a)
def isOk():
if any(l[-1] + 1 < r[0] for l, r in zip(G, G[1:])):
return False
... | false | 2.941176 | [
"+import sys",
"+",
"+input = sys.stdin.buffer.readline",
"-A = [[]]",
"+G = [[]]",
"+A = []",
"- if len(A[-1]) > 0 and a < A[-1][-1]:",
"- A.append([])",
"- A[-1].append(a)",
"+ if len(G[-1]) > 0 and G[-1][-1] > a:",
"+ G.append([])",
"+ A.append(a)",
"+ G[-1].a... | false | 0.035746 | 0.035673 | 1.002026 | [
"s081203154",
"s535041796"
] |
u707500405 | p03547 | python | s793573568 | s622716525 | 149 | 17 | 12,636 | 2,940 | Accepted | Accepted | 88.59 | import numpy as np
ans = ["<", "=", ">"]
m = np.full((6, 6), 1, np.int64)
m[np.tri(6) == 0] = 0
m[np.tri(6).T == 0] = 2
X, Y = [ord(x) - 65 for x in input().split()]
print((ans[m[X][Y]]))
| ans = ["<", "=", ">"]
X, Y = [ord(x) - 65 for x in input().split()]
print((ans[1 - (X < Y) + (X > Y)]))
| 7 | 3 | 197 | 109 | import numpy as np
ans = ["<", "=", ">"]
m = np.full((6, 6), 1, np.int64)
m[np.tri(6) == 0] = 0
m[np.tri(6).T == 0] = 2
X, Y = [ord(x) - 65 for x in input().split()]
print((ans[m[X][Y]]))
| ans = ["<", "=", ">"]
X, Y = [ord(x) - 65 for x in input().split()]
print((ans[1 - (X < Y) + (X > Y)]))
| false | 57.142857 | [
"-import numpy as np",
"-",
"-m = np.full((6, 6), 1, np.int64)",
"-m[np.tri(6) == 0] = 0",
"-m[np.tri(6).T == 0] = 2",
"-print((ans[m[X][Y]]))",
"+print((ans[1 - (X < Y) + (X > Y)]))"
] | false | 0.250583 | 0.076082 | 3.29361 | [
"s793573568",
"s622716525"
] |
u766684188 | p02868 | python | s115388026 | s113979185 | 1,924 | 662 | 141,400 | 77,728 | Accepted | Accepted | 65.59 | #D
import sys
input=sys.stdin.readline
class SegmentTree():
def __init__(self,param,default,func):
if isinstance(param,list):
n=len(param)
else:
n=param
self.d=default
self.leaf=1<<(n-1).bit_length()
if isinstance(param,list):
s... | import sys
input=sys.stdin.readline
import heapq
def dijkstra(Route,v,start):
Dist=[float('inf')]*v
Dist[start]=0
Visited=[False]*v
hq=[(0,start)]
while hq:
dist,fr=heapq.heappop(hq)
Visited[fr]=True
for to,cost in Route[fr]:
if (not Visited[to]) and... | 60 | 32 | 1,748 | 831 | # D
import sys
input = sys.stdin.readline
class SegmentTree:
def __init__(self, param, default, func):
if isinstance(param, list):
n = len(param)
else:
n = param
self.d = default
self.leaf = 1 << (n - 1).bit_length()
if isinstance(param, list):
... | import sys
input = sys.stdin.readline
import heapq
def dijkstra(Route, v, start):
Dist = [float("inf")] * v
Dist[start] = 0
Visited = [False] * v
hq = [(0, start)]
while hq:
dist, fr = heapq.heappop(hq)
Visited[fr] = True
for to, cost in Route[fr]:
if (not Visi... | false | 46.666667 | [
"-# D",
"+import heapq",
"-class SegmentTree:",
"- def __init__(self, param, default, func):",
"- if isinstance(param, list):",
"- n = len(param)",
"- else:",
"- n = param",
"- self.d = default",
"- self.leaf = 1 << (n - 1).bit_length()",
"- ... | false | 0.036261 | 0.036586 | 0.991129 | [
"s115388026",
"s113979185"
] |
u644907318 | p03241 | python | s496579949 | s876125821 | 73 | 65 | 63,824 | 63,404 | Accepted | Accepted | 10.96 | N,M = list(map(int,input().split()))
amax = 1
for i in range(1,int(M**0.5)+1):
if M%i==0:
a = i
b = M//i
if b>=N:
amax = max(amax,a)
a,b = b,a
if b>=N:
amax = max(amax,a)
print(amax) | N,M = list(map(int,input().split()))
g = 0
for i in range(1,int(M**0.5)+1):
if M%i==0:
a = i
b = M//i
if a>=N:
g = max(g,b)
if b>=N:
g = max(g,a)
print(g) | 12 | 11 | 255 | 218 | N, M = list(map(int, input().split()))
amax = 1
for i in range(1, int(M**0.5) + 1):
if M % i == 0:
a = i
b = M // i
if b >= N:
amax = max(amax, a)
a, b = b, a
if b >= N:
amax = max(amax, a)
print(amax)
| N, M = list(map(int, input().split()))
g = 0
for i in range(1, int(M**0.5) + 1):
if M % i == 0:
a = i
b = M // i
if a >= N:
g = max(g, b)
if b >= N:
g = max(g, a)
print(g)
| false | 8.333333 | [
"-amax = 1",
"+g = 0",
"+ if a >= N:",
"+ g = max(g, b)",
"- amax = max(amax, a)",
"- a, b = b, a",
"- if b >= N:",
"- amax = max(amax, a)",
"-print(amax)",
"+ g = max(g, a)",
"+print(g)"
] | false | 0.080069 | 0.069696 | 1.148827 | [
"s496579949",
"s876125821"
] |
u888092736 | p03592 | python | s530542863 | s910150815 | 713 | 354 | 20,896 | 20,804 | Accepted | Accepted | 50.35 | N, M, K = map(int, input().split())
if K % N == 0 or K % M == 0:
print('Yes')
exit()
candidates = set()
for i in range(1, N):
curr = i * M
for j in range(1, M):
curr += N - 2 * i
candidates.add(curr)
for j in range(1, M):
curr = j * N
for i in range(1, N):
cu... | N, M, K = map(int, input().split())
if K % N == 0 or K % M == 0:
print('Yes')
exit()
candidates = set()
for i in range(1, N):
curr = i * M
for j in range(1, M):
curr += N - 2 * i
candidates.add(curr)
print('Yes') if K in candidates else print('No')
| 16 | 11 | 416 | 291 | N, M, K = map(int, input().split())
if K % N == 0 or K % M == 0:
print("Yes")
exit()
candidates = set()
for i in range(1, N):
curr = i * M
for j in range(1, M):
curr += N - 2 * i
candidates.add(curr)
for j in range(1, M):
curr = j * N
for i in range(1, N):
curr += M - 2 *... | N, M, K = map(int, input().split())
if K % N == 0 or K % M == 0:
print("Yes")
exit()
candidates = set()
for i in range(1, N):
curr = i * M
for j in range(1, M):
curr += N - 2 * i
candidates.add(curr)
print("Yes") if K in candidates else print("No")
| false | 31.25 | [
"-for j in range(1, M):",
"- curr = j * N",
"- for i in range(1, N):",
"- curr += M - 2 * j",
"- candidates.add(curr)"
] | false | 0.113011 | 0.064045 | 1.76455 | [
"s530542863",
"s910150815"
] |
u309120194 | p02783 | python | s502660972 | s776848753 | 28 | 25 | 9,052 | 9,156 | Accepted | Accepted | 10.71 | H, A = list(map(int, input().split()))
print((-(-H // A))) | import math
H, A = list(map(int, input().split()))
# H/A の切り上げ
# ceil or (H+A−1)/A の切り捨て
print((math.ceil(H/A))) | 3 | 6 | 53 | 110 | H, A = list(map(int, input().split()))
print((-(-H // A)))
| import math
H, A = list(map(int, input().split()))
# H/A の切り上げ
# ceil or (H+A−1)/A の切り捨て
print((math.ceil(H / A)))
| false | 50 | [
"+import math",
"+",
"-print((-(-H // A)))",
"+# H/A の切り上げ",
"+# ceil or (H+A−1)/A の切り捨て",
"+print((math.ceil(H / A)))"
] | false | 0.036622 | 0.037283 | 0.982276 | [
"s502660972",
"s776848753"
] |
u079022693 | p03014 | python | s177998731 | s297662026 | 1,934 | 1,251 | 235,536 | 235,528 | Accepted | Accepted | 35.32 | from sys import stdin
import numpy as np
def main():
#入力
readline=stdin.readline
h,w=list(map(int,readline().split()))
grid=[readline().strip() for _ in range(h)]
grid2=np.zeros((h,w),dtype="int64")
for i in range(h):
for j in range(w):
if grid[i][j]==".":
... | from sys import stdin
import numpy as np
def main():
#入力
readline=stdin.readline
h,w=list(map(int,readline().split()))
grid=[readline().strip() for _ in range(h)]
grid=[[1 if grid[i][j]=="." else 0 for j in range(w)] for i in range(h)]
grid=np.array(grid,dtype=np.int64)
up=np.zero... | 40 | 35 | 1,049 | 952 | from sys import stdin
import numpy as np
def main():
# 入力
readline = stdin.readline
h, w = list(map(int, readline().split()))
grid = [readline().strip() for _ in range(h)]
grid2 = np.zeros((h, w), dtype="int64")
for i in range(h):
for j in range(w):
if grid[i][j] == ".":
... | from sys import stdin
import numpy as np
def main():
# 入力
readline = stdin.readline
h, w = list(map(int, readline().split()))
grid = [readline().strip() for _ in range(h)]
grid = [[1 if grid[i][j] == "." else 0 for j in range(w)] for i in range(h)]
grid = np.array(grid, dtype=np.int64)
up ... | false | 12.5 | [
"- grid2 = np.zeros((h, w), dtype=\"int64\")",
"- for i in range(h):",
"- for j in range(w):",
"- if grid[i][j] == \".\":",
"- grid2[i][j] = 1",
"- else:",
"- grid2[i][j] = 0",
"+ grid = [[1 if grid[i][j] == \".\" else 0 for j in rang... | false | 0.192552 | 0.18263 | 1.054329 | [
"s177998731",
"s297662026"
] |
u780962115 | p03972 | python | s240402903 | s293863363 | 1,391 | 706 | 73,216 | 24,540 | Accepted | Accepted | 49.25 | # クラスかるほう
# 貪欲に辺ごとにソートをしてとけばいい
W, H = list(map(int, input().split()))
d = []
for i in range(W):
x = int(eval(input()))
d.append((x, "x"))
for j in range(H):
y = int(eval(input()))
d.append((y, "y"))
d.sort()
X = H+1
Y = W+1
ans = 0
for que in d:
weight, pos = que
if pos ==... | # クラスかるほう
# 貪欲に辺ごとにソートをしてとけばいい
W, H = list(map(int, input().split()))
d = []
for i in range(W):
x = int(eval(input()))
d.append((x, 0))
for j in range(H):
y = int(eval(input()))
d.append((y, 1))
d.sort()
X = H+1
Y = W+1
ans = 0
for que in d:
weight, pos = que
if pos <1:
... | 26 | 26 | 412 | 404 | # クラスかるほう
# 貪欲に辺ごとにソートをしてとけばいい
W, H = list(map(int, input().split()))
d = []
for i in range(W):
x = int(eval(input()))
d.append((x, "x"))
for j in range(H):
y = int(eval(input()))
d.append((y, "y"))
d.sort()
X = H + 1
Y = W + 1
ans = 0
for que in d:
weight, pos = que
if pos == "x":
ans ... | # クラスかるほう
# 貪欲に辺ごとにソートをしてとけばいい
W, H = list(map(int, input().split()))
d = []
for i in range(W):
x = int(eval(input()))
d.append((x, 0))
for j in range(H):
y = int(eval(input()))
d.append((y, 1))
d.sort()
X = H + 1
Y = W + 1
ans = 0
for que in d:
weight, pos = que
if pos < 1:
ans += X * ... | false | 0 | [
"- d.append((x, \"x\"))",
"+ d.append((x, 0))",
"- d.append((y, \"y\"))",
"+ d.append((y, 1))",
"- if pos == \"x\":",
"+ if pos < 1:"
] | false | 0.047506 | 0.047848 | 0.992868 | [
"s240402903",
"s293863363"
] |
u477977638 | p02780 | python | s986597903 | s771439480 | 219 | 125 | 66,800 | 31,848 | Accepted | Accepted | 42.92 | import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines
# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
# import numpy as np
def main():
n,k=list(map(int,input().split()))
p=list(map(int,input().split()))
s=sum(p[:k])
ans... | import sys
#input = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**9)
#from functools import lru_cache
def RD(): return sys.stdin.read()
def II(): return int(eval(input()))
def MI(): return list(map(int,input().split()))
def MF(): return list(map(float,input().split()))
def LI(): return list(map(int... | 31 | 50 | 477 | 739 | import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines
# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
# import numpy as np
def main():
n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
s = sum(p[:k])
an... | import sys
# input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**9)
# from functools import lru_cache
def RD():
return sys.stdin.read()
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MF():
return list(map(float, input().split()))
def LI():
... | false | 38 | [
"-read = sys.stdin.buffer.read",
"-input = sys.stdin.buffer.readline",
"-inputs = sys.stdin.buffer.readlines",
"-# mod=10**9+7",
"-# rstrip().decode('utf-8')",
"-# map(int,input().split())",
"+# input = sys.stdin.buffer.readline",
"+# sys.setrecursionlimit(10**9)",
"+# from functools import lru_cach... | false | 0.040075 | 0.053311 | 0.751717 | [
"s986597903",
"s771439480"
] |
u843175622 | p02954 | python | s412407317 | s689875850 | 127 | 88 | 21,112 | 10,676 | Accepted | Accepted | 30.71 | s = eval(input())
n = len(s)
l = []
i = 0
while i < n:
j = 1
while i + j < n and s[i] == s[i + j]:
j += 1
l.append((s[i], j, i))
i += j
ans = [0] * n
i = 0
if l[0][0] == 'L':
ans[0] = l[0][1]
i += 1
while i + 1 < len(l):
cr, R, pr = l[i]
cl, L, pl = l[i + 1]
... | s = eval(input())
n = len(s)
a = [0] * n
b = 0
for i in range(n):
if s[i] == 'R':
b += 1
elif b:
a[i - 1] += 0 - - b // 2
a[i] += b // 2
b = 0
a[-1] += b
b = 0
for i in range(n - 1, -1, -1):
if s[i] == 'L':
b += 1
elif b:
a[i] += b // 2
... | 27 | 23 | 464 | 385 | s = eval(input())
n = len(s)
l = []
i = 0
while i < n:
j = 1
while i + j < n and s[i] == s[i + j]:
j += 1
l.append((s[i], j, i))
i += j
ans = [0] * n
i = 0
if l[0][0] == "L":
ans[0] = l[0][1]
i += 1
while i + 1 < len(l):
cr, R, pr = l[i]
cl, L, pl = l[i + 1]
ans[pl - 1] = (R ... | s = eval(input())
n = len(s)
a = [0] * n
b = 0
for i in range(n):
if s[i] == "R":
b += 1
elif b:
a[i - 1] += 0 - -b // 2
a[i] += b // 2
b = 0
a[-1] += b
b = 0
for i in range(n - 1, -1, -1):
if s[i] == "L":
b += 1
elif b:
a[i] += b // 2
a[i + 1] += ... | false | 14.814815 | [
"-l = []",
"-i = 0",
"-while i < n:",
"- j = 1",
"- while i + j < n and s[i] == s[i + j]:",
"- j += 1",
"- l.append((s[i], j, i))",
"- i += j",
"-ans = [0] * n",
"-i = 0",
"-if l[0][0] == \"L\":",
"- ans[0] = l[0][1]",
"- i += 1",
"-while i + 1 < len(l):",
"- ... | false | 0.066325 | 0.032305 | 2.053108 | [
"s412407317",
"s689875850"
] |
u411923565 | p03031 | python | s635446846 | s215467600 | 105 | 85 | 9,284 | 74,164 | Accepted | Accepted | 19.05 | # C - Switches
#bit全探索の練習問題
import copy
N,M = input().split()
N = int(N)
M = int(M)
ks = []
for l in range(M):
s = input().split()
ks.append(s)
p = list(map(int, input().split()))
KS = []
for m in range(M):#列の数はМ
box = list()
for n in range(len(ks[m])):#M列の要素を数字に直す処理
ks[m][n... | # 93 C - Switches
N,M = list(map(int,input().split()))
K = []
S = []
for _ in range(M):
s = list(map(int,input().split()))
K.append(s[0])
# 0-indexed
s = [i-1 for i in s]
S.append(s[1:])
P = list(map(int,input().split()))
ans = 0
for i in range(1<<N):
swiches = [0]*N
for j i... | 54 | 36 | 1,341 | 788 | # C - Switches
# bit全探索の練習問題
import copy
N, M = input().split()
N = int(N)
M = int(M)
ks = []
for l in range(M):
s = input().split()
ks.append(s)
p = list(map(int, input().split()))
KS = []
for m in range(M): # 列の数はМ
box = list()
for n in range(len(ks[m])): # M列の要素を数字に直す処理
ks[m][n] = int(ks[m... | # 93 C - Switches
N, M = list(map(int, input().split()))
K = []
S = []
for _ in range(M):
s = list(map(int, input().split()))
K.append(s[0])
# 0-indexed
s = [i - 1 for i in s]
S.append(s[1:])
P = list(map(int, input().split()))
ans = 0
for i in range(1 << N):
swiches = [0] * N
for j in range... | false | 33.333333 | [
"-# C - Switches",
"-# bit全探索の練習問題",
"-import copy",
"-",
"-N, M = input().split()",
"-N = int(N)",
"-M = int(M)",
"-ks = []",
"-for l in range(M):",
"- s = input().split()",
"- ks.append(s)",
"-p = list(map(int, input().split()))",
"-KS = []",
"-for m in range(M): # 列の数はМ",
"- ... | false | 0.044442 | 0.041393 | 1.073676 | [
"s635446846",
"s215467600"
] |
u368796742 | p03354 | python | s333662848 | s896838276 | 766 | 665 | 45,536 | 13,812 | Accepted | Accepted | 13.19 | class Unionfind:
def __init__(self,n):
self.uf = [-1]*n
def find(self,x):
if self.uf[x] < 0:
return x
else:
self.uf[x] = self.find(self.uf[x])
return self.uf[x]
def same(self,x,y):
return self.find(x) == self.find(y)
... | class Unionfind:
def __init__(self,n):
self.uf = [-1]*n
def find(self,x):
if self.uf[x] < 0:
return x
else:
self.uf[x] = self.find(self.uf[x])
return self.uf[x]
def same(self,x,y):
return self.find(x) == self.find(y)
... | 48 | 45 | 1,049 | 900 | class Unionfind:
def __init__(self, n):
self.uf = [-1] * n
def find(self, x):
if self.uf[x] < 0:
return x
else:
self.uf[x] = self.find(self.uf[x])
return self.uf[x]
def same(self, x, y):
return self.find(x) == self.find(y)
def union(... | class Unionfind:
def __init__(self, n):
self.uf = [-1] * n
def find(self, x):
if self.uf[x] < 0:
return x
else:
self.uf[x] = self.find(self.uf[x])
return self.uf[x]
def same(self, x, y):
return self.find(x) == self.find(y)
def union(... | false | 6.25 | [
"-l1 = [[] for i in range(n)]",
"-l2 = [[] for i in range(n)]",
"-for i in range(n):",
"- x = u.find(i)",
"- l1[x].append(i)",
"- l2[x].append(l[i] - 1)",
"- a = set(l1[i])",
"- b = set(l2[i])",
"- ans += len(a & b)",
"+ if u.same(i, l[i] - 1):",
"+ ans += 1"
] | false | 0.035489 | 0.043891 | 0.808557 | [
"s333662848",
"s896838276"
] |
u877415670 | p02695 | python | s573932022 | s301083821 | 1,276 | 727 | 21,628 | 9,140 | Accepted | Accepted | 43.03 | import itertools
n,m,q=list(map(int,input().split()))
Q=[list(map(int,input().split())) for i in range(q)]
l = list(itertools.combinations_with_replacement([i+1 for i in range(m)], n))
MAX=0
for i in l:
ans=0
for g in range(q):
a,b,c,d = Q[g]
if i[b-1]-i[a-1]==c:
ans+=d... | def dfs(lst):
global ans
if len(lst) > n:
return
lowest = 1
if lst != []:
lowest = lst[-1]
for i in range(lowest, m+1):
lst.append(i)
dfs(lst)
lst.pop()
if len(lst) == n:
cnt = 0
for i in range(q):
a, b, c, d = ab[... | 15 | 25 | 349 | 547 | import itertools
n, m, q = list(map(int, input().split()))
Q = [list(map(int, input().split())) for i in range(q)]
l = list(itertools.combinations_with_replacement([i + 1 for i in range(m)], n))
MAX = 0
for i in l:
ans = 0
for g in range(q):
a, b, c, d = Q[g]
if i[b - 1] - i[a - 1] == c:
... | def dfs(lst):
global ans
if len(lst) > n:
return
lowest = 1
if lst != []:
lowest = lst[-1]
for i in range(lowest, m + 1):
lst.append(i)
dfs(lst)
lst.pop()
if len(lst) == n:
cnt = 0
for i in range(q):
a, b, c, d = ab[i]
... | false | 40 | [
"-import itertools",
"+def dfs(lst):",
"+ global ans",
"+ if len(lst) > n:",
"+ return",
"+ lowest = 1",
"+ if lst != []:",
"+ lowest = lst[-1]",
"+ for i in range(lowest, m + 1):",
"+ lst.append(i)",
"+ dfs(lst)",
"+ lst.pop()",
"+ if len... | false | 0.065535 | 0.060334 | 1.086208 | [
"s573932022",
"s301083821"
] |
u862359372 | p03107 | python | s673603148 | s623816494 | 377 | 18 | 3,428 | 3,188 | Accepted | Accepted | 95.23 | s = eval(input())
cnt = 0
idx = 1
tmp = ''
hit = True
while(hit):
hit = False
for i in range(idx, len(s)):
if s[i-1:i+1] == '01' or s[i-1:i+1] == '10':
tmp = s[0:i-1] + s[i+1: ]
cnt += 2
idx = i - 1 if i > 1 else 1
hit = True
s = tmp
break
print (cnt) | s = eval(input())
cnt0 = s.count('0')
cnt1 = s.count('1')
print((min(cnt0, cnt1) * 2)) | 17 | 4 | 296 | 82 | s = eval(input())
cnt = 0
idx = 1
tmp = ""
hit = True
while hit:
hit = False
for i in range(idx, len(s)):
if s[i - 1 : i + 1] == "01" or s[i - 1 : i + 1] == "10":
tmp = s[0 : i - 1] + s[i + 1 :]
cnt += 2
idx = i - 1 if i > 1 else 1
hit = True
s... | s = eval(input())
cnt0 = s.count("0")
cnt1 = s.count("1")
print((min(cnt0, cnt1) * 2))
| false | 76.470588 | [
"-cnt = 0",
"-idx = 1",
"-tmp = \"\"",
"-hit = True",
"-while hit:",
"- hit = False",
"- for i in range(idx, len(s)):",
"- if s[i - 1 : i + 1] == \"01\" or s[i - 1 : i + 1] == \"10\":",
"- tmp = s[0 : i - 1] + s[i + 1 :]",
"- cnt += 2",
"- idx = i - ... | false | 0.163821 | 0.035318 | 4.638491 | [
"s673603148",
"s623816494"
] |
u583285098 | p02679 | python | s443171398 | s319980229 | 1,208 | 1,096 | 72,012 | 71,852 | Accepted | Accepted | 9.27 | from math import gcd
n=int(eval(input()))
mod = 10**9+7
d = dict()
zeros=0
for _ in range(n):
a,b=list(map(int,input().split()))
if not any((a,b)):
zeros+=1
continue
if all((a,b)):
g = gcd(a,b)*(a//abs(a))
elif a:
g = a
else:
g = b
p = a//g,b//g
d[p] = d.get(... | from math import gcd
n=int(eval(input()))
mod = 10**9+7
d = dict()
zeros=0
for _ in range(n):
a,b=list(map(int,input().split()))
if not any((a,b)):
zeros+=1
continue
if all((a,b)):
g = gcd(a,b)*(a//abs(a))
elif a:
g = a
else:
g = b
p = a//g,b//g
d[p] = d.get(... | 32 | 32 | 561 | 553 | from math import gcd
n = int(eval(input()))
mod = 10**9 + 7
d = dict()
zeros = 0
for _ in range(n):
a, b = list(map(int, input().split()))
if not any((a, b)):
zeros += 1
continue
if all((a, b)):
g = gcd(a, b) * (a // abs(a))
elif a:
g = a
else:
g = b
p = ... | from math import gcd
n = int(eval(input()))
mod = 10**9 + 7
d = dict()
zeros = 0
for _ in range(n):
a, b = list(map(int, input().split()))
if not any((a, b)):
zeros += 1
continue
if all((a, b)):
g = gcd(a, b) * (a // abs(a))
elif a:
g = a
else:
g = b
p = ... | false | 0 | [
"- ans *= pow(2, v, mod) + pow(2, w, mod) - 1",
"+ ans *= pow(2, v) + pow(2, w) - 1"
] | false | 0.039973 | 0.040133 | 0.996006 | [
"s443171398",
"s319980229"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.