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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u970197315 | p03038 | python | s093895382 | s989608938 | 605 | 514 | 23,996 | 32,968 | Accepted | Accepted | 15.04 | n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
b=[]
for i in range(m):
bb,cc=list(map(int,input().split()))
b.append([cc,bb])
a.sort()
b.sort(reverse=True)
i=0
j=0
while i<n:
if j==m:
break
if b[j][1]>0:
if a[i]<b[j][0]:
a[i]=b[j][0]
... | n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
bc=[list(map(int,input().split())) for i in range(m)]
a.sort()
bc.sort(key=lambda x: x[1],reverse=True)
# print(a)
# print(bc)
i=0
for b,c in bc:
tb=b
while tb>0:
if n==i:
break
if a[i]>=c:
break
a[i]=c
t... | 24 | 22 | 433 | 387 | n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
b = []
for i in range(m):
bb, cc = list(map(int, input().split()))
b.append([cc, bb])
a.sort()
b.sort(reverse=True)
i = 0
j = 0
while i < n:
if j == m:
break
if b[j][1] > 0:
if a[i] < b[j][0]:
a[i] = b... | n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
bc = [list(map(int, input().split())) for i in range(m)]
a.sort()
bc.sort(key=lambda x: x[1], reverse=True)
# print(a)
# print(bc)
i = 0
for b, c in bc:
tb = b
while tb > 0:
if n == i:
break
if a[i] >= c:
... | false | 8.333333 | [
"-b = []",
"-for i in range(m):",
"- bb, cc = list(map(int, input().split()))",
"- b.append([cc, bb])",
"+bc = [list(map(int, input().split())) for i in range(m)]",
"-b.sort(reverse=True)",
"+bc.sort(key=lambda x: x[1], reverse=True)",
"+# print(a)",
"+# print(bc)",
"-j = 0",
"-while i < n... | false | 0.045055 | 0.04613 | 0.976714 | [
"s093895382",
"s989608938"
] |
u922449550 | p02556 | python | s906023781 | s206397145 | 747 | 454 | 37,424 | 51,912 | Accepted | Accepted | 39.22 | N = int(eval(input()))
xy = [tuple(map(int, input().split())) for _ in range(N)]
xy.sort(reverse=True)
ans = 0
M = xy[0][0] + xy[0][1]
m = xy[0][0] - xy[0][1]
for x, y in xy[1:]:
ans = max(ans, M-x-y, m-x+y)
M = max(M, x+y)
m = max(m, x-y)
print(ans) | N = int(eval(input()))
xy = [tuple(map(int, input().split())) for _ in range(N)]
z = []; w = []
for x, y in xy:
z.append(x + y)
w.append(x - y)
print((max(max(z)-min(z), max(w)-min(w)))) | 13 | 8 | 270 | 194 | N = int(eval(input()))
xy = [tuple(map(int, input().split())) for _ in range(N)]
xy.sort(reverse=True)
ans = 0
M = xy[0][0] + xy[0][1]
m = xy[0][0] - xy[0][1]
for x, y in xy[1:]:
ans = max(ans, M - x - y, m - x + y)
M = max(M, x + y)
m = max(m, x - y)
print(ans)
| N = int(eval(input()))
xy = [tuple(map(int, input().split())) for _ in range(N)]
z = []
w = []
for x, y in xy:
z.append(x + y)
w.append(x - y)
print((max(max(z) - min(z), max(w) - min(w))))
| false | 38.461538 | [
"-xy.sort(reverse=True)",
"-ans = 0",
"-M = xy[0][0] + xy[0][1]",
"-m = xy[0][0] - xy[0][1]",
"-for x, y in xy[1:]:",
"- ans = max(ans, M - x - y, m - x + y)",
"- M = max(M, x + y)",
"- m = max(m, x - y)",
"-print(ans)",
"+z = []",
"+w = []",
"+for x, y in xy:",
"+ z.append(x + y... | false | 0.076799 | 0.039972 | 1.921292 | [
"s906023781",
"s206397145"
] |
u706929073 | p03127 | python | s930402426 | s164667225 | 1,621 | 136 | 14,224 | 14,252 | Accepted | Accepted | 91.61 | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
while 1 < len(a):
while 0 != a[0]:
r = a[1] % a[0]
a[1] = a[0]
a[0] = r
a.pop(0)
print((a[0])) | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
for i in range(1, len(a)):
while 0 != a[i - 1]:
r = a[i] % a[i - 1]
a[i] = a[i - 1]
a[i - 1] = r
print((a[-1]))
| 11 | 10 | 197 | 210 | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
while 1 < len(a):
while 0 != a[0]:
r = a[1] % a[0]
a[1] = a[0]
a[0] = r
a.pop(0)
print((a[0]))
| n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
for i in range(1, len(a)):
while 0 != a[i - 1]:
r = a[i] % a[i - 1]
a[i] = a[i - 1]
a[i - 1] = r
print((a[-1]))
| false | 9.090909 | [
"-while 1 < len(a):",
"- while 0 != a[0]:",
"- r = a[1] % a[0]",
"- a[1] = a[0]",
"- a[0] = r",
"- a.pop(0)",
"-print((a[0]))",
"+for i in range(1, len(a)):",
"+ while 0 != a[i - 1]:",
"+ r = a[i] % a[i - 1]",
"+ a[i] = a[i - 1]",
"+ a[i - 1] ... | false | 0.042657 | 0.055265 | 0.771868 | [
"s930402426",
"s164667225"
] |
u759412327 | p02802 | python | s985249797 | s301263554 | 293 | 198 | 4,596 | 10,456 | Accepted | Accepted | 32.42 | N,M = list(map(int,input().split()))
AC = (N+1)*[0]
WA = (N+1)*[0]
wa=0
for m in range(M):
p,s = input().split()
p = int(p)
if AC[p]==0 and s=="AC":
AC[p]=1
wa+=WA[p]
WA[p]+=1
print((sum(AC),wa)) | N,M = list(map(int,input().split()))
AC = N*[0]
WA = N*[0]
for m in range(M):
P,S = input().split()
P = int(P)-1
if AC[P]==1:
continue
if S=="WA":
WA[P]+=1
else:
AC[P]=1
wa = 0
for a,w in zip(AC,WA):
wa+=w*a
print((sum(AC),wa)) | 16 | 20 | 227 | 269 | N, M = list(map(int, input().split()))
AC = (N + 1) * [0]
WA = (N + 1) * [0]
wa = 0
for m in range(M):
p, s = input().split()
p = int(p)
if AC[p] == 0 and s == "AC":
AC[p] = 1
wa += WA[p]
WA[p] += 1
print((sum(AC), wa))
| N, M = list(map(int, input().split()))
AC = N * [0]
WA = N * [0]
for m in range(M):
P, S = input().split()
P = int(P) - 1
if AC[P] == 1:
continue
if S == "WA":
WA[P] += 1
else:
AC[P] = 1
wa = 0
for a, w in zip(AC, WA):
wa += w * a
print((sum(AC), wa))
| false | 20 | [
"-AC = (N + 1) * [0]",
"-WA = (N + 1) * [0]",
"+AC = N * [0]",
"+WA = N * [0]",
"+for m in range(M):",
"+ P, S = input().split()",
"+ P = int(P) - 1",
"+ if AC[P] == 1:",
"+ continue",
"+ if S == \"WA\":",
"+ WA[P] += 1",
"+ else:",
"+ AC[P] = 1",
"-for ... | false | 0.095896 | 0.047005 | 2.040102 | [
"s985249797",
"s301263554"
] |
u309141201 | p03031 | python | s449523486 | s762621985 | 66 | 47 | 3,064 | 3,064 | Accepted | Accepted | 28.79 | # import itertools
n, m = list(map(int, input().split()))
s = []
for i in range(m):
s.append(list(map(int, input().split())))
p = list(map(int, input().split()))
ans = 0
for i in range(2**n):
b = list(str(bin(i))[2:].zfill(n))
# print(b)
ok = True
for j in range(m):
Sum = 0
... | N, M = list(map(int, input().split()))
s = []
k = []
for _ in range(M):
x = list(map(int, input().split()))
k.append(x.pop(0))
s.append(x)
p = list(map(int, input().split()))
# print(s, k, p)
ans = 0
for i in range(2**N):
Switches = [0]*N
for j in range(N):
if (i >> j) & 1:
... | 23 | 37 | 532 | 777 | # import itertools
n, m = list(map(int, input().split()))
s = []
for i in range(m):
s.append(list(map(int, input().split())))
p = list(map(int, input().split()))
ans = 0
for i in range(2**n):
b = list(str(bin(i))[2:].zfill(n))
# print(b)
ok = True
for j in range(m):
Sum = 0
for k in ... | N, M = list(map(int, input().split()))
s = []
k = []
for _ in range(M):
x = list(map(int, input().split()))
k.append(x.pop(0))
s.append(x)
p = list(map(int, input().split()))
# print(s, k, p)
ans = 0
for i in range(2**N):
Switches = [0] * N
for j in range(N):
if (i >> j) & 1:
Swi... | false | 37.837838 | [
"-# import itertools",
"-n, m = list(map(int, input().split()))",
"+N, M = list(map(int, input().split()))",
"-for i in range(m):",
"- s.append(list(map(int, input().split())))",
"+k = []",
"+for _ in range(M):",
"+ x = list(map(int, input().split()))",
"+ k.append(x.pop(0))",
"+ s.app... | false | 0.068824 | 0.10394 | 0.66215 | [
"s449523486",
"s762621985"
] |
u620084012 | p03945 | python | s864442929 | s999676110 | 201 | 182 | 39,408 | 39,280 | Accepted | Accepted | 9.45 | S = eval(input())
t = S[0]
ans = 0
for k in range(1,len(S)):
if t != S[k]:
ans += 1
t = S[k]
print(ans)
| S = eval(input())
ans = 0
for k in range(1,len(S)):
if S[k-1] != S[k]:
ans += 1
print(ans)
| 8 | 6 | 125 | 102 | S = eval(input())
t = S[0]
ans = 0
for k in range(1, len(S)):
if t != S[k]:
ans += 1
t = S[k]
print(ans)
| S = eval(input())
ans = 0
for k in range(1, len(S)):
if S[k - 1] != S[k]:
ans += 1
print(ans)
| false | 25 | [
"-t = S[0]",
"- if t != S[k]:",
"+ if S[k - 1] != S[k]:",
"- t = S[k]"
] | false | 0.04979 | 0.050672 | 0.982598 | [
"s864442929",
"s999676110"
] |
u013408661 | p03361 | python | s854184975 | s462123555 | 20 | 18 | 3,064 | 3,064 | Accepted | Accepted | 10 | h,w=list(map(int,input().split()))
mapdata=[]
re=0
for i in range(h):
line=str(eval(input()))
line2=list(line)
mapdata.append(line2)
def jugde(i,j):
count=0
for x in (i-1,i+1):
if 0<=x<=h-1:
if mapdata[x][j]=='#':
count+=1
for y in (j-1,j+1):
if 0<=y<=w-1:
if mapda... | # coding: utf-8
# Your code here!
H,W=list(map(int, input().split()))
S=["."+eval(input())+"." for i in range(H)]
S=["."*(W+2)]+S+["."*(W+2)]
flag = 0
for i in range(H):
for j in range(W):
if S[i][j]=="#":
if S[i-1][j]=="." and S[i+1][j]=="." and S[i][j-1]=="." and S[i][j+1]==".":
... | 30 | 13 | 566 | 365 | h, w = list(map(int, input().split()))
mapdata = []
re = 0
for i in range(h):
line = str(eval(input()))
line2 = list(line)
mapdata.append(line2)
def jugde(i, j):
count = 0
for x in (i - 1, i + 1):
if 0 <= x <= h - 1:
if mapdata[x][j] == "#":
count += 1
for y... | # coding: utf-8
# Your code here!
H, W = list(map(int, input().split()))
S = ["." + eval(input()) + "." for i in range(H)]
S = ["." * (W + 2)] + S + ["." * (W + 2)]
flag = 0
for i in range(H):
for j in range(W):
if S[i][j] == "#":
if (
S[i - 1][j] == "."
and S[i +... | false | 56.666667 | [
"-h, w = list(map(int, input().split()))",
"-mapdata = []",
"-re = 0",
"-for i in range(h):",
"- line = str(eval(input()))",
"- line2 = list(line)",
"- mapdata.append(line2)",
"-",
"-",
"-def jugde(i, j):",
"- count = 0",
"- for x in (i - 1, i + 1):",
"- if 0 <= x <= h ... | false | 0.041324 | 0.040187 | 1.028296 | [
"s854184975",
"s462123555"
] |
u644907318 | p02725 | python | s209079793 | s341824222 | 272 | 109 | 79,340 | 99,992 | Accepted | Accepted | 59.93 | K,N = list(map(int,input().split()))
A = list(map(int,input().split()))
cnt = K+A[0]-A[N-1]
for i in range(1,N):
cnt = max(cnt,A[i]-A[i-1])
print((K-cnt)) | K,N = list(map(int,input().split()))
A = list(map(int,input().split()))
tmin = 2*K
for i in range(1,N):
tmin = min(tmin,K-(A[i]-A[i-1]))
tmin = min(tmin,A[N-1]-A[0])
print(tmin) | 6 | 7 | 155 | 181 | K, N = list(map(int, input().split()))
A = list(map(int, input().split()))
cnt = K + A[0] - A[N - 1]
for i in range(1, N):
cnt = max(cnt, A[i] - A[i - 1])
print((K - cnt))
| K, N = list(map(int, input().split()))
A = list(map(int, input().split()))
tmin = 2 * K
for i in range(1, N):
tmin = min(tmin, K - (A[i] - A[i - 1]))
tmin = min(tmin, A[N - 1] - A[0])
print(tmin)
| false | 14.285714 | [
"-cnt = K + A[0] - A[N - 1]",
"+tmin = 2 * K",
"- cnt = max(cnt, A[i] - A[i - 1])",
"-print((K - cnt))",
"+ tmin = min(tmin, K - (A[i] - A[i - 1]))",
"+tmin = min(tmin, A[N - 1] - A[0])",
"+print(tmin)"
] | false | 0.086792 | 0.157308 | 0.551733 | [
"s209079793",
"s341824222"
] |
u585482323 | p03575 | python | s337838793 | s720472611 | 212 | 166 | 42,476 | 38,384 | Accepted | Accepted | 21.7 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [lis... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [lis... | 69 | 72 | 1,656 | 1,850 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
r... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
r... | false | 4.166667 | [
"+cnt = 0",
"- def root(x):",
"- if par[x] == x:",
"- return x",
"- par[x] = root(par[x])",
"- return par[x]",
"+ def lowlink(v):",
"+ global cnt",
"- def unite(x, y):",
"- x = root(x)",
"- y = root(y)",
"- if rank[x] < rank[... | false | 0.038011 | 0.038996 | 0.974722 | [
"s337838793",
"s720472611"
] |
u083960235 | p03607 | python | s325547317 | s818185168 | 214 | 131 | 16,604 | 28,288 | Accepted | Accepted | 38.79 | from collections import Counter
N=int(eval(input()))
A=[]
for i in range(N):
A.append(int(eval(input())))
a=Counter(A)
count=0
#for i in values
for i in list(a.values()):
if i%2!=0:
count+=1
# print(i)
print(count) | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | 14 | 32 | 229 | 926 | from collections import Counter
N = int(eval(input()))
A = []
for i in range(N):
A.append(int(eval(input())))
a = Counter(A)
count = 0
# for i in values
for i in list(a.values()):
if i % 2 != 0:
count += 1
# print(i)
print(count)
| import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | false | 56.25 | [
"-from collections import Counter",
"+import sys, re, os",
"+from collections import deque, defaultdict, Counter",
"+from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians",
"+from itertools import permutations, combinations, product, accumulate",
"+from operator import itemgetter, mul",
"... | false | 0.088052 | 0.035311 | 2.493627 | [
"s325547317",
"s818185168"
] |
u543954314 | p03839 | python | s610545928 | s296591396 | 207 | 189 | 16,840 | 16,832 | Accepted | Accepted | 8.7 | n,k = list(map(int, input().split()))
a = list(map(int, input().split()))
al = [0]*(n+1)
pl = [0]*(n+1)
ans = -10**10
for i in range(n):
al[i+1] = al[i] + a[i]
pl[i+1] = pl[i] + max(0,a[i])
for i in range(n-k+1):
l,r = i,i+k-1
cur = max(0,al[r+1]-al[l]) + pl[l] + pl[-1] - pl[r+1]
if cur > ans:
... | n,k = list(map(int,input().split()))
a = list(map(int, input().split()))
al = [0]*(n+1)
pl = [0]*(n+1)
ans = 0
for i in range(n):
al[i+1] = al[i] + a[i]
pl[i+1] = pl[i]
if a[i] > 0: pl[i+1] += a[i]
for r in range(k-1,n):
l = r-k+1
cur = pl[l] + max(0, al[r+1] - al[l]) + pl[n] - pl[r+1]
if ans < ... | 14 | 14 | 336 | 340 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
al = [0] * (n + 1)
pl = [0] * (n + 1)
ans = -(10**10)
for i in range(n):
al[i + 1] = al[i] + a[i]
pl[i + 1] = pl[i] + max(0, a[i])
for i in range(n - k + 1):
l, r = i, i + k - 1
cur = max(0, al[r + 1] - al[l]) + pl[l] + pl[-1] - ... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
al = [0] * (n + 1)
pl = [0] * (n + 1)
ans = 0
for i in range(n):
al[i + 1] = al[i] + a[i]
pl[i + 1] = pl[i]
if a[i] > 0:
pl[i + 1] += a[i]
for r in range(k - 1, n):
l = r - k + 1
cur = pl[l] + max(0, al[r + 1] - al[l]... | false | 0 | [
"-ans = -(10**10)",
"+ans = 0",
"- pl[i + 1] = pl[i] + max(0, a[i])",
"-for i in range(n - k + 1):",
"- l, r = i, i + k - 1",
"- cur = max(0, al[r + 1] - al[l]) + pl[l] + pl[-1] - pl[r + 1]",
"- if cur > ans:",
"+ pl[i + 1] = pl[i]",
"+ if a[i] > 0:",
"+ pl[i + 1] += a[i]"... | false | 0.043378 | 0.046925 | 0.924413 | [
"s610545928",
"s296591396"
] |
u634079249 | p03112 | python | s391780032 | s362243278 | 815 | 510 | 17,680 | 17,884 | Accepted | Accepted | 37.42 | import sys
import os
import math
import bisect
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]... | import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque
# import fractions
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstr... | 40 | 55 | 1,209 | 1,946 | import sys
import os
import math
import bisect
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]
iss = l... | import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque
# import fractions
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il =... | false | 27.272727 | [
"-import sys",
"-import os",
"-import math",
"-import bisect",
"+import sys, os, math, bisect, itertools, collections, heapq, queue",
"+# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall",
"+from decimal import Decimal",
"+from collections import defaultdict, deque",
"+",
"+# im... | false | 0.039017 | 0.048936 | 0.797314 | [
"s391780032",
"s362243278"
] |
u608088992 | p03103 | python | s959284945 | s015125039 | 457 | 280 | 21,604 | 21,528 | Accepted | Accepted | 38.73 | N, M = list(map(int, input().split()))
Drink = [[int(i) for i in input().split()] for _ in range(N)]
Drink.sort()
Need = M
Payment = 0
for i in range(N):
if Need > Drink[i][1]:
Payment += Drink[i][0] * Drink[i][1]
Need -= Drink[i][1]
else:
Payment += Drink[i][0] * Need
... | import sys
def solve():
input = sys.stdin.readline
N, M = list(map(int, input().split()))
drink = [[int(a) for a in input().split()] for _ in range(N)]
drink.sort()
price = 0
for i in range(N):
a, b = drink[i]
if b <= M:
price += a * b
M -= b
... | 14 | 22 | 339 | 453 | N, M = list(map(int, input().split()))
Drink = [[int(i) for i in input().split()] for _ in range(N)]
Drink.sort()
Need = M
Payment = 0
for i in range(N):
if Need > Drink[i][1]:
Payment += Drink[i][0] * Drink[i][1]
Need -= Drink[i][1]
else:
Payment += Drink[i][0] * Need
break
prin... | import sys
def solve():
input = sys.stdin.readline
N, M = list(map(int, input().split()))
drink = [[int(a) for a in input().split()] for _ in range(N)]
drink.sort()
price = 0
for i in range(N):
a, b = drink[i]
if b <= M:
price += a * b
M -= b
els... | false | 36.363636 | [
"-N, M = list(map(int, input().split()))",
"-Drink = [[int(i) for i in input().split()] for _ in range(N)]",
"-Drink.sort()",
"-Need = M",
"-Payment = 0",
"-for i in range(N):",
"- if Need > Drink[i][1]:",
"- Payment += Drink[i][0] * Drink[i][1]",
"- Need -= Drink[i][1]",
"- el... | false | 0.036029 | 0.031251 | 1.152876 | [
"s959284945",
"s015125039"
] |
u022979415 | p03077 | python | s648781794 | s126081526 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | from math import ceil
def main():
l = [int(eval(input())) for _ in range(6)]
n, a, b, c, d, e = l
group = ceil(n / min(a, b, c, d, e))
print((4 + group))
if __name__ == '__main__':
main()
| from math import ceil
def main():
n = int(eval(input()))
required_times = [int(eval(input())) for _ in range(5)]
groups = ceil(n / min(required_times))
print((groups + 4))
if __name__ == '__main__':
main()
| 13 | 13 | 217 | 229 | from math import ceil
def main():
l = [int(eval(input())) for _ in range(6)]
n, a, b, c, d, e = l
group = ceil(n / min(a, b, c, d, e))
print((4 + group))
if __name__ == "__main__":
main()
| from math import ceil
def main():
n = int(eval(input()))
required_times = [int(eval(input())) for _ in range(5)]
groups = ceil(n / min(required_times))
print((groups + 4))
if __name__ == "__main__":
main()
| false | 0 | [
"- l = [int(eval(input())) for _ in range(6)]",
"- n, a, b, c, d, e = l",
"- group = ceil(n / min(a, b, c, d, e))",
"- print((4 + group))",
"+ n = int(eval(input()))",
"+ required_times = [int(eval(input())) for _ in range(5)]",
"+ groups = ceil(n / min(required_times))",
"+ pr... | false | 0.044064 | 0.044085 | 0.999504 | [
"s648781794",
"s126081526"
] |
u077291787 | p02558 | python | s490098431 | s015604642 | 329 | 283 | 146,700 | 145,256 | Accepted | Accepted | 13.98 | from typing import List
class UnionFind:
"""Union Find (Disjoint Set): O(α(N))
References:
https://github.com/atcoder/ac-library/blob/master/atcoder/dsu.hpp
https://tumoiyorozu.github.io/single-file-ac-library/document_en/dsu.html
"""
__slots__ = ["_data_size", "_roots"]
... | class UnionFind:
__slots__ = ["_data_size", "_roots"]
def __init__(self, N):
self._data_size = N
self._roots = [-1] * N
def __getitem__(self, x: int) -> int:
while self._roots[x] >= 0:
x = self._roots[x]
return x
def unite(self, x, y):
... | 53 | 40 | 1,626 | 952 | from typing import List
class UnionFind:
"""Union Find (Disjoint Set): O(α(N))
References:
https://github.com/atcoder/ac-library/blob/master/atcoder/dsu.hpp
https://tumoiyorozu.github.io/single-file-ac-library/document_en/dsu.html
"""
__slots__ = ["_data_size", "_roots"]
def __in... | class UnionFind:
__slots__ = ["_data_size", "_roots"]
def __init__(self, N):
self._data_size = N
self._roots = [-1] * N
def __getitem__(self, x: int) -> int:
while self._roots[x] >= 0:
x = self._roots[x]
return x
def unite(self, x, y):
x = self[x]
... | false | 24.528302 | [
"-from typing import List",
"-",
"-",
"- \"\"\"Union Find (Disjoint Set): O(α(N))",
"- References:",
"- https://github.com/atcoder/ac-library/blob/master/atcoder/dsu.hpp",
"- https://tumoiyorozu.github.io/single-file-ac-library/document_en/dsu.html",
"- \"\"\"",
"-",
"- d... | false | 0.055765 | 0.042734 | 1.304942 | [
"s490098431",
"s015604642"
] |
u357335656 | p02658 | python | s511783102 | s265570900 | 88 | 81 | 21,736 | 21,420 | Accepted | Accepted | 7.95 | n = int(eval(input()))
a = list(map(int,input().split()))
a.sort()
ans = 1
for i in range(n):
ans *= a[i]
if ans > 10 ** 18:
ans = -1
break
print(ans) | n = int(eval(input()))
a = list(map(int,input().split()))
a.sort()
if a[0] == 0:
print((0))
exit()
a.sort(reverse=True)
ans = 1
for i in range(n):
ans *= a[i]
if ans > 10 ** 18:
ans = -1
break
print(ans) | 12 | 18 | 169 | 232 | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
ans = 1
for i in range(n):
ans *= a[i]
if ans > 10**18:
ans = -1
break
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
if a[0] == 0:
print((0))
exit()
a.sort(reverse=True)
ans = 1
for i in range(n):
ans *= a[i]
if ans > 10**18:
ans = -1
break
print(ans)
| false | 33.333333 | [
"+if a[0] == 0:",
"+ print((0))",
"+ exit()",
"+a.sort(reverse=True)"
] | false | 0.110237 | 0.047014 | 2.344783 | [
"s511783102",
"s265570900"
] |
u347640436 | p02996 | python | s891006650 | s762919203 | 1,556 | 828 | 48,320 | 41,176 | Accepted | Accepted | 46.79 | import sys
from functools import cmp_to_key
n = int(eval(input()))
data = [[int(j) for j in input().split()] for i in range(n)]
t = 0
data.sort(key = cmp_to_key(lambda x, y: x[1] - y[1]))
for d in data:
t += d[0]
if t > d[1]:
print('No')
sys.exit()
print('Yes')
| from sys import exit
n = int(eval(input()))
data = [[int(j) for j in input().split()] for i in range(n)]
t = 0
data.sort(key=lambda x: x[1])
for d in data:
t += d[0]
if t > d[1]:
print('No')
exit()
print('Yes')
| 12 | 13 | 279 | 243 | import sys
from functools import cmp_to_key
n = int(eval(input()))
data = [[int(j) for j in input().split()] for i in range(n)]
t = 0
data.sort(key=cmp_to_key(lambda x, y: x[1] - y[1]))
for d in data:
t += d[0]
if t > d[1]:
print("No")
sys.exit()
print("Yes")
| from sys import exit
n = int(eval(input()))
data = [[int(j) for j in input().split()] for i in range(n)]
t = 0
data.sort(key=lambda x: x[1])
for d in data:
t += d[0]
if t > d[1]:
print("No")
exit()
print("Yes")
| false | 7.692308 | [
"-import sys",
"-from functools import cmp_to_key",
"+from sys import exit",
"-data.sort(key=cmp_to_key(lambda x, y: x[1] - y[1]))",
"+data.sort(key=lambda x: x[1])",
"- sys.exit()",
"+ exit()"
] | false | 0.037083 | 0.075821 | 0.489091 | [
"s891006650",
"s762919203"
] |
u852613820 | p02918 | python | s845188592 | s672261687 | 49 | 43 | 3,956 | 3,956 | Accepted | Accepted | 12.24 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
def main():
N, K = list(map(int, input().split()))
S = list(eval(input()))
rev = False
rev_count = 0
for i in range(1,N):
if S[i] == S[i-1]:
rev = False
else:
if not rev and r... | # 解説見た後に作ったやつ
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
def main():
N, K = list(map(int, input().split()))
S = list(eval(input()))
rev = False
ans = 0
rev_count = 0
for i in range(1,N):
if S[i] == S[i-1]:
ans += 1
rev = ... | 32 | 31 | 612 | 597 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
def main():
N, K = list(map(int, input().split()))
S = list(eval(input()))
rev = False
rev_count = 0
for i in range(1, N):
if S[i] == S[i - 1]:
rev = False
else:
if not rev and rev_count < K... | # 解説見た後に作ったやつ
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
def main():
N, K = list(map(int, input().split()))
S = list(eval(input()))
rev = False
ans = 0
rev_count = 0
for i in range(1, N):
if S[i] == S[i - 1]:
ans += 1
rev = False
... | false | 3.125 | [
"+# 解説見た後に作ったやつ",
"+ ans = 0",
"+ ans += 1",
"- ans = 0",
"- for i in range(1, N):",
"- if S[i] == S[i - 1]:",
"- ans += 1",
"+ ans += 1"
] | false | 0.036285 | 0.113857 | 0.318693 | [
"s845188592",
"s672261687"
] |
u757117214 | p03111 | python | s929980729 | s902658981 | 259 | 82 | 3,064 | 3,188 | Accepted | Accepted | 68.34 | import itertools
def diff(a,b,c):
return abs(A-a)+abs(B-b)+abs(C-c)
N,A,B,C,*l=list(map(int,open(0).read().split()))
_min=10**6
for i in itertools.product([0,1,2,3],repeat=N):
cnt=0
abc=[0,0,0]
for j in range(N):
if i[j] !=3:
abc[i[j]]+=l[j]
cnt+=1
... | def dfs(cnt,a,b,c):
if cnt == N:
_sum = abs(A-a) + abs(B-b) + abs(C-c) - 30
return _sum if min(a,b,c) > 0 else 10**9
ret0 = dfs(cnt+1, a, b, c)
ret1 = dfs(cnt+1, a+l[cnt] , b, c) + 10
ret2 = dfs(cnt+1, a, b+l[cnt], c) + 10
ret3 = dfs(cnt+1, a, b, c+l[cnt]) + 10
return min... | 18 | 12 | 424 | 415 | import itertools
def diff(a, b, c):
return abs(A - a) + abs(B - b) + abs(C - c)
N, A, B, C, *l = list(map(int, open(0).read().split()))
_min = 10**6
for i in itertools.product([0, 1, 2, 3], repeat=N):
cnt = 0
abc = [0, 0, 0]
for j in range(N):
if i[j] != 3:
abc[i[j]] += l[j]
... | def dfs(cnt, a, b, c):
if cnt == N:
_sum = abs(A - a) + abs(B - b) + abs(C - c) - 30
return _sum if min(a, b, c) > 0 else 10**9
ret0 = dfs(cnt + 1, a, b, c)
ret1 = dfs(cnt + 1, a + l[cnt], b, c) + 10
ret2 = dfs(cnt + 1, a, b + l[cnt], c) + 10
ret3 = dfs(cnt + 1, a, b, c + l[cnt]) + 1... | false | 33.333333 | [
"-import itertools",
"-",
"-",
"-def diff(a, b, c):",
"- return abs(A - a) + abs(B - b) + abs(C - c)",
"+def dfs(cnt, a, b, c):",
"+ if cnt == N:",
"+ _sum = abs(A - a) + abs(B - b) + abs(C - c) - 30",
"+ return _sum if min(a, b, c) > 0 else 10**9",
"+ ret0 = dfs(cnt + 1, a,... | false | 0.356906 | 0.15129 | 2.359079 | [
"s929980729",
"s902658981"
] |
u566297428 | p02641 | python | s058755783 | s711501876 | 30 | 27 | 9,112 | 9,152 | Accepted | Accepted | 10 | X, N = list(map(int, input().split()))
p = list(map(int, input().split()))
for d in range(X + 1):
for s in [-1, +1]:
a = X + s * d
if p.count(a) == 0:
print(a)
exit(0) | import sys
X, N = list(map(int, input().split()))
p = list(map(int, input().split()))
for d in range(X + 1):
for s in [-1, +1]:
a = X + s * d
if p.count(a) == 0:
print(a)
sys.exit(0) | 8 | 9 | 212 | 228 | X, N = list(map(int, input().split()))
p = list(map(int, input().split()))
for d in range(X + 1):
for s in [-1, +1]:
a = X + s * d
if p.count(a) == 0:
print(a)
exit(0)
| import sys
X, N = list(map(int, input().split()))
p = list(map(int, input().split()))
for d in range(X + 1):
for s in [-1, +1]:
a = X + s * d
if p.count(a) == 0:
print(a)
sys.exit(0)
| false | 11.111111 | [
"+import sys",
"+",
"- exit(0)",
"+ sys.exit(0)"
] | false | 0.147124 | 0.269172 | 0.54658 | [
"s058755783",
"s711501876"
] |
u312025627 | p02995 | python | s357557954 | s471340990 | 162 | 65 | 38,384 | 62,232 | Accepted | Accepted | 59.88 | def main():
a, b, c, d = (int(i) for i in input().split())
def gcd(x, y):
if y == 0:
return x
while y != 0:
x, y = y, x % y
return x
def lcm(x, y):
return x*y//gcd(x, y)
def f(x):
p = x//c
q = x//d
r = x//... | def main():
from math import gcd
a, b, c, d = (int(i) for i in input().split())
L = c*d//gcd(c, d)
ans = b - (b//c + b//d - b//L)
ans -= (a-1) - ((a-1)//c + (a-1)//d - (a-1)//L)
print(ans)
if __name__ == '__main__':
main()
| 24 | 11 | 432 | 263 | def main():
a, b, c, d = (int(i) for i in input().split())
def gcd(x, y):
if y == 0:
return x
while y != 0:
x, y = y, x % y
return x
def lcm(x, y):
return x * y // gcd(x, y)
def f(x):
p = x // c
q = x // d
r = x // lcm(c,... | def main():
from math import gcd
a, b, c, d = (int(i) for i in input().split())
L = c * d // gcd(c, d)
ans = b - (b // c + b // d - b // L)
ans -= (a - 1) - ((a - 1) // c + (a - 1) // d - (a - 1) // L)
print(ans)
if __name__ == "__main__":
main()
| false | 54.166667 | [
"+ from math import gcd",
"+",
"-",
"- def gcd(x, y):",
"- if y == 0:",
"- return x",
"- while y != 0:",
"- x, y = y, x % y",
"- return x",
"-",
"- def lcm(x, y):",
"- return x * y // gcd(x, y)",
"-",
"- def f(x):",
"- ... | false | 0.109788 | 0.038513 | 2.850681 | [
"s357557954",
"s471340990"
] |
u488636998 | p02934 | python | s452229054 | s925818634 | 151 | 18 | 12,444 | 2,940 | Accepted | Accepted | 88.08 | import numpy as np
N=int(eval(input()))
str_list = input().split(' ')
A = [int(x) for x in str_list]
A = np.array(A)
total = A.sum()
prod = A.prod()
#print( prod/( (prod/A).sum() ) )
print(( 1.0/np.sum(1.0/A) )) | N=int(eval(input()))
A=list(map(int, input().split()))
prod = 1
for ii in range(N):
prod *= A[ii]
sum = 0
for ii in range(N):
sum += prod//A[ii]
print((float(prod)/float(sum)))
| 10 | 10 | 213 | 187 | import numpy as np
N = int(eval(input()))
str_list = input().split(" ")
A = [int(x) for x in str_list]
A = np.array(A)
total = A.sum()
prod = A.prod()
# print( prod/( (prod/A).sum() ) )
print((1.0 / np.sum(1.0 / A)))
| N = int(eval(input()))
A = list(map(int, input().split()))
prod = 1
for ii in range(N):
prod *= A[ii]
sum = 0
for ii in range(N):
sum += prod // A[ii]
print((float(prod) / float(sum)))
| false | 0 | [
"-import numpy as np",
"-",
"-str_list = input().split(\" \")",
"-A = [int(x) for x in str_list]",
"-A = np.array(A)",
"-total = A.sum()",
"-prod = A.prod()",
"-# print( prod/( (prod/A).sum() ) )",
"-print((1.0 / np.sum(1.0 / A)))",
"+A = list(map(int, input().split()))",
"+prod = 1",
"+for ii... | false | 0.17109 | 0.036079 | 4.742132 | [
"s452229054",
"s925818634"
] |
u543954314 | p02914 | python | s338147295 | s281795216 | 1,625 | 982 | 16,116 | 16,116 | Accepted | Accepted | 39.57 | def maxSubarrayXOR(lis, n, INT_BITS = 60):
idx = 0
for i in range(INT_BITS-1,-1,-1):
Mele = -1
bit_i = 1 << i
for j in range(idx, n):
if lis[j] & bit_i and lis[j] > Mele:
Midx, Mele = j, lis[j]
if Mele < 0: continue
lis[Midx], lis[idx]... | def maxSubarrayXOR(lis, n, INT_BITS = 60):
idx = 0
for i in range(INT_BITS-1,-1,-1):
Midx = -1
bit_i = 1 << i
for j in range(idx, n):
if lis[j] & bit_i:
Midx = j
break
else: continue
lis[Midx], lis[idx] = lis[idx], lis... | 24 | 25 | 671 | 656 | def maxSubarrayXOR(lis, n, INT_BITS=60):
idx = 0
for i in range(INT_BITS - 1, -1, -1):
Mele = -1
bit_i = 1 << i
for j in range(idx, n):
if lis[j] & bit_i and lis[j] > Mele:
Midx, Mele = j, lis[j]
if Mele < 0:
continue
lis[Midx], lis... | def maxSubarrayXOR(lis, n, INT_BITS=60):
idx = 0
for i in range(INT_BITS - 1, -1, -1):
Midx = -1
bit_i = 1 << i
for j in range(idx, n):
if lis[j] & bit_i:
Midx = j
break
else:
continue
lis[Midx], lis[idx] = lis[idx],... | false | 4 | [
"- Mele = -1",
"+ Midx = -1",
"- if lis[j] & bit_i and lis[j] > Mele:",
"- Midx, Mele = j, lis[j]",
"- if Mele < 0:",
"+ if lis[j] & bit_i:",
"+ Midx = j",
"+ break",
"+ else:"
] | false | 0.036731 | 0.067077 | 0.547594 | [
"s338147295",
"s281795216"
] |
u580258754 | p02900 | python | s136901356 | s099218999 | 197 | 163 | 5,048 | 5,048 | Accepted | Accepted | 17.26 | import fractions
a, b = list(map(int, input().split()))
n = fractions.gcd(a, b)
def prime_decomposition(n):
i = 2
table = []
while i * i <= n:
while n % i == 0:
n //= i
table.append(i)
i += 1
if n > 1:
table.append(n)
return table
pri... | import fractions
a, b = list(map(int, input().split()))
common_num = fractions.gcd(a, b)
ans = 1
for i in range(2,int(1+common_num**0.5)):
if common_num % i == 0:
ans += 1
while common_num % i == 0:
common_num //= i
if common_num > 1:
ans += 1
print(ans) | 17 | 14 | 352 | 288 | import fractions
a, b = list(map(int, input().split()))
n = fractions.gcd(a, b)
def prime_decomposition(n):
i = 2
table = []
while i * i <= n:
while n % i == 0:
n //= i
table.append(i)
i += 1
if n > 1:
table.append(n)
return table
print((len(set(p... | import fractions
a, b = list(map(int, input().split()))
common_num = fractions.gcd(a, b)
ans = 1
for i in range(2, int(1 + common_num**0.5)):
if common_num % i == 0:
ans += 1
while common_num % i == 0:
common_num //= i
if common_num > 1:
ans += 1
print(ans)
| false | 17.647059 | [
"-n = fractions.gcd(a, b)",
"-",
"-",
"-def prime_decomposition(n):",
"- i = 2",
"- table = []",
"- while i * i <= n:",
"- while n % i == 0:",
"- n //= i",
"- table.append(i)",
"- i += 1",
"- if n > 1:",
"- table.append(n)",
"- retu... | false | 0.053699 | 0.123862 | 0.433542 | [
"s136901356",
"s099218999"
] |
u360116509 | p03031 | python | s120622450 | s945565177 | 26 | 22 | 3,064 | 3,064 | Accepted | Accepted | 15.38 | def main():
N, M = list(map(int, input().split()))
switchs = []
for _ in range(M):
ks = list(map(int, input().split()))
switchs.append(ks[1:])
p = list(map(int, input().split()))
ans = 0
for b in range(1 << N):
f = True
for i, s in enumerate(switchs):
... | def main():
N, M = list(map(int, input().split()))
switchs = []
for _ in range(M):
ks = list(map(int, input().split()))
switchs.append([1 << s - 1 for s in ks[1:]])
p = list(map(int, input().split()))
ans = 0
for b in range(1 << N):
f = True
for i, s in ... | 23 | 23 | 569 | 578 | def main():
N, M = list(map(int, input().split()))
switchs = []
for _ in range(M):
ks = list(map(int, input().split()))
switchs.append(ks[1:])
p = list(map(int, input().split()))
ans = 0
for b in range(1 << N):
f = True
for i, s in enumerate(switchs):
... | def main():
N, M = list(map(int, input().split()))
switchs = []
for _ in range(M):
ks = list(map(int, input().split()))
switchs.append([1 << s - 1 for s in ks[1:]])
p = list(map(int, input().split()))
ans = 0
for b in range(1 << N):
f = True
for i, s in enumerate(... | false | 0 | [
"- switchs.append(ks[1:])",
"+ switchs.append([1 << s - 1 for s in ks[1:]])",
"- if b & (1 << (ss - 1)):",
"+ if b & ss:"
] | false | 0.099069 | 0.044991 | 2.201989 | [
"s120622450",
"s945565177"
] |
u153665391 | p02268 | python | s952918986 | s391573632 | 1,110 | 520 | 18,820 | 16,716 | Accepted | Accepted | 53.15 | def binary_search(S, n, index ):
if S[index] == n:
return 'eq'
elif S[index] < n:
return 'bt'
elif S[index] > n:
return 'lt'
n = int(eval(input()))
S = [int(i) for i in input().split()]
q = int(eval(input()))
T = [int(i) for i in input().split()]
cnt = 0
for i in T:
... | N = int(eval(input()))
S = list(map(int, input().split()))
Q = int(eval(input()))
T = list(map(int, input().split()))
def binary_search(target_num, head, tail):
idx = int((head+tail)/2)
if target_num == S[idx]:
return True
elif target_num < S[idx]:
if head == idx:
ret... | 29 | 25 | 652 | 634 | def binary_search(S, n, index):
if S[index] == n:
return "eq"
elif S[index] < n:
return "bt"
elif S[index] > n:
return "lt"
n = int(eval(input()))
S = [int(i) for i in input().split()]
q = int(eval(input()))
T = [int(i) for i in input().split()]
cnt = 0
for i in T:
mini = 0
... | N = int(eval(input()))
S = list(map(int, input().split()))
Q = int(eval(input()))
T = list(map(int, input().split()))
def binary_search(target_num, head, tail):
idx = int((head + tail) / 2)
if target_num == S[idx]:
return True
elif target_num < S[idx]:
if head == idx:
return Fa... | false | 13.793103 | [
"-def binary_search(S, n, index):",
"- if S[index] == n:",
"- return \"eq\"",
"- elif S[index] < n:",
"- return \"bt\"",
"- elif S[index] > n:",
"- return \"lt\"",
"+N = int(eval(input()))",
"+S = list(map(int, input().split()))",
"+Q = int(eval(input()))",
"+T = li... | false | 0.039766 | 0.043109 | 0.922448 | [
"s952918986",
"s391573632"
] |
u476604182 | p03142 | python | s178212338 | s948838246 | 352 | 297 | 31,600 | 37,140 | Accepted | Accepted | 15.62 | from collections import defaultdict, deque
N, M, *L = list(map(int, open(0).read().split()))
dic = defaultdict(list)
par = [0]*(N+1)
cnt = [0]*(N+1)
for a,b in zip(*[iter(L)]*2):
dic[a] += [b]
cnt[b] += 1
for i in range(1,N+1):
if cnt[i]==0:
q = deque([i])
break
while q:
m = q.poplef... | from collections import defaultdict, deque
N, M, *L = list(map(int, open(0).read().split()))
dic = defaultdict(list)
par = [0]*N
cnt = [0]*(N+1)
for a,b in zip(*[iter(L)]*2):
dic[a] += [b]
cnt[b] += 1
for i in range(1,N+1):
if cnt[i]==0:
q = deque([i])
par[i-1] = '0'
break
while q:... | 24 | 25 | 450 | 466 | from collections import defaultdict, deque
N, M, *L = list(map(int, open(0).read().split()))
dic = defaultdict(list)
par = [0] * (N + 1)
cnt = [0] * (N + 1)
for a, b in zip(*[iter(L)] * 2):
dic[a] += [b]
cnt[b] += 1
for i in range(1, N + 1):
if cnt[i] == 0:
q = deque([i])
break
while q:
... | from collections import defaultdict, deque
N, M, *L = list(map(int, open(0).read().split()))
dic = defaultdict(list)
par = [0] * N
cnt = [0] * (N + 1)
for a, b in zip(*[iter(L)] * 2):
dic[a] += [b]
cnt[b] += 1
for i in range(1, N + 1):
if cnt[i] == 0:
q = deque([i])
par[i - 1] = "0"
... | false | 4 | [
"-par = [0] * (N + 1)",
"+par = [0] * N",
"+ par[i - 1] = \"0\"",
"- par[c] = m",
"+ par[c - 1] = str(m)",
"-for i in range(1, N + 1):",
"- print((par[i]))",
"+ans = \"\\n\".join(par)",
"+print(ans)"
] | false | 0.059025 | 0.035363 | 1.66914 | [
"s178212338",
"s948838246"
] |
u279493135 | p02804 | python | s578472654 | s807630002 | 878 | 419 | 90,096 | 92,316 | Accepted | Accepted | 52.28 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, atan, degrees
from itertools import permutations, combinations, product, accumulate
# とけてない
from operator import itemgetter, mul
from copy import deepcopy
from string import as... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upp... | 57 | 44 | 1,537 | 1,329 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, atan, degrees
from itertools import permutations, combinations, product, accumulate
# とけてない
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lo... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase... | false | 22.807018 | [
"-from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, atan, degrees",
"-from itertools import permutations, combinations, product, accumulate",
"-",
"-# とけてない",
"+from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians",
"+from itertools import accumulate, permutations, comb... | false | 0.867527 | 1.437886 | 0.603335 | [
"s578472654",
"s807630002"
] |
u214434454 | p03680 | python | s419669038 | s141527706 | 238 | 204 | 15,992 | 7,084 | Accepted | Accepted | 14.29 | n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
ans = False
used = set()
i = 1
count = 0
while ans == False:
count += 1
if a[i-1] == 2:
ans = True
elif i-1 in used:
break
else:
used.add(i-1)
i = a[i-1]
if ans == True:
print(count)
el... | n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
count = 0
i = 0
ans = False
while count < n:
count += 1
if a[i] == 2:
ans = True
break
else:
i = a[i] - 1
if ans == True:
print(count)
else:
print("-1") | 20 | 16 | 338 | 265 | n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
ans = False
used = set()
i = 1
count = 0
while ans == False:
count += 1
if a[i - 1] == 2:
ans = True
elif i - 1 in used:
break
else:
used.add(i - 1)
i = a[i - 1]
if ans == True:
print(count)
else:
p... | n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
count = 0
i = 0
ans = False
while count < n:
count += 1
if a[i] == 2:
ans = True
break
else:
i = a[i] - 1
if ans == True:
print(count)
else:
print("-1")
| false | 20 | [
"+count = 0",
"+i = 0",
"-used = set()",
"-i = 1",
"-count = 0",
"-while ans == False:",
"+while count < n:",
"- if a[i - 1] == 2:",
"+ if a[i] == 2:",
"- elif i - 1 in used:",
"- used.add(i - 1)",
"- i = a[i - 1]",
"+ i = a[i] - 1"
] | false | 0.140149 | 0.085148 | 1.645948 | [
"s419669038",
"s141527706"
] |
u291278680 | p03013 | python | s432591336 | s932103450 | 329 | 188 | 21,076 | 11,884 | Accepted | Accepted | 42.86 | import numpy as np
from collections import defaultdict
from functools import reduce
MOD = 1000000007
A = set()
# s = input()
# n = int(input())
# A = list(map(int, input().split()))
n, m = list(map(int, input().split()))
for _ in range(m):
a = int(eval(input()))
A.add(a)
res = [0]*(n+1)
... | MOD = 1000000007
A = set()
# s = input()
# n = int(input())
# A = list(map(int, input().split()))
n, m = list(map(int, input().split()))
for _ in range(m):
a = int(eval(input()))
A.add(a)
res = [0]*(n+1)
res[0] = 1
if 1 not in A:
res[1] = 1
for i in range(2, n+1):
if i in A:
... | 49 | 25 | 915 | 381 | import numpy as np
from collections import defaultdict
from functools import reduce
MOD = 1000000007
A = set()
# s = input()
# n = int(input())
# A = list(map(int, input().split()))
n, m = list(map(int, input().split()))
for _ in range(m):
a = int(eval(input()))
A.add(a)
res = [0] * (n + 1)
res[0] = 1
if 1 not... | MOD = 1000000007
A = set()
# s = input()
# n = int(input())
# A = list(map(int, input().split()))
n, m = list(map(int, input().split()))
for _ in range(m):
a = int(eval(input()))
A.add(a)
res = [0] * (n + 1)
res[0] = 1
if 1 not in A:
res[1] = 1
for i in range(2, n + 1):
if i in A:
continue
r... | false | 48.979592 | [
"-import numpy as np",
"-from collections import defaultdict",
"-from functools import reduce",
"-",
"-",
"-",
"-class Interval:",
"- def __init__(self, li):",
"- self.li = li",
"- self.n = len(li)",
"- self.sum_li = [li[0]]",
"- for i in range(1, self.n):",
"-... | false | 0.03868 | 0.037935 | 1.01965 | [
"s432591336",
"s932103450"
] |
u382748202 | p03070 | python | s011865462 | s906099103 | 2,933 | 1,382 | 328,896 | 329,152 | Accepted | Accepted | 52.88 | import math
import numpy as np
N = int(eval(input()))
a = np.array([int(eval(input())) for _ in range(N)])
s = np.sum(a)
# Counts of (R >= s / 2)
dp0 = np.zeros((N + 1, s + 1))
dp0[0, 0] = 1
# Counts of (R == s / 2 and G == s / 2)
dp1 = np.zeros((N + 1, s // 2 + 1))
dp1[0, 0] = 1
mod = 998244353
for i... | import math
import numpy as np
N = int(eval(input()))
a = np.array([int(eval(input())) for _ in range(N)])
s = np.sum(a)
dp0 = np.zeros((N + 1, s + 1), dtype=np.int64)
dp0[0, 0] = 1
dp1 = np.zeros((N + 1, s // 2 + 1), dtype=np.int64)
dp1[0, 0] = 1
mod = 998244353
for i, x in enumerate(a):
dp0[i + 1... | 26 | 26 | 638 | 670 | import math
import numpy as np
N = int(eval(input()))
a = np.array([int(eval(input())) for _ in range(N)])
s = np.sum(a)
# Counts of (R >= s / 2)
dp0 = np.zeros((N + 1, s + 1))
dp0[0, 0] = 1
# Counts of (R == s / 2 and G == s / 2)
dp1 = np.zeros((N + 1, s // 2 + 1))
dp1[0, 0] = 1
mod = 998244353
for i, x in enumerate(... | import math
import numpy as np
N = int(eval(input()))
a = np.array([int(eval(input())) for _ in range(N)])
s = np.sum(a)
dp0 = np.zeros((N + 1, s + 1), dtype=np.int64)
dp0[0, 0] = 1
dp1 = np.zeros((N + 1, s // 2 + 1), dtype=np.int64)
dp1[0, 0] = 1
mod = 998244353
for i, x in enumerate(a):
dp0[i + 1, :] += dp0[i, :... | false | 0 | [
"-# Counts of (R >= s / 2)",
"-dp0 = np.zeros((N + 1, s + 1))",
"+dp0 = np.zeros((N + 1, s + 1), dtype=np.int64)",
"-# Counts of (R == s / 2 and G == s / 2)",
"-dp1 = np.zeros((N + 1, s // 2 + 1))",
"+dp1 = np.zeros((N + 1, s // 2 + 1), dtype=np.int64)",
"+# Counts of (R >= s / 2)",
"+# Counts of (R =... | false | 0.221761 | 0.652499 | 0.339865 | [
"s011865462",
"s906099103"
] |
u528470578 | p03162 | python | s145884989 | s031429517 | 698 | 639 | 74,968 | 51,416 | Accepted | Accepted | 8.45 | N = int(eval(input()))
abc = [list(map(int, input().split())) for _ in range(N)]
dp = []
for i in range(N+1):
dp.append([0] * 3)
for j in range(1, N+1):
for k in range(3):
if j == 1:
dp[j][k] = abc[0][k]
else:
box = []
for l in range(3):
... | N = int(eval(input()))
dpa = [0] * N
dpb = [0] * N
dpc = [0] * N
a, b, c = list(map(int, input().split()))
dpa[0] = a
dpb[0] = b
dpc[0] = c
for i in range(1, N):
a, b, c = list(map(int, input().split()))
dpa[i] = max(dpb[i-1] + a, dpc[i-1] + a)
dpb[i] = max(dpa[i-1] + b, dpc[i-1] + b)
dpc[... | 20 | 16 | 513 | 382 | N = int(eval(input()))
abc = [list(map(int, input().split())) for _ in range(N)]
dp = []
for i in range(N + 1):
dp.append([0] * 3)
for j in range(1, N + 1):
for k in range(3):
if j == 1:
dp[j][k] = abc[0][k]
else:
box = []
for l in range(3):
if... | N = int(eval(input()))
dpa = [0] * N
dpb = [0] * N
dpc = [0] * N
a, b, c = list(map(int, input().split()))
dpa[0] = a
dpb[0] = b
dpc[0] = c
for i in range(1, N):
a, b, c = list(map(int, input().split()))
dpa[i] = max(dpb[i - 1] + a, dpc[i - 1] + a)
dpb[i] = max(dpa[i - 1] + b, dpc[i - 1] + b)
dpc[i] = m... | false | 20 | [
"-abc = [list(map(int, input().split())) for _ in range(N)]",
"-dp = []",
"-for i in range(N + 1):",
"- dp.append([0] * 3)",
"-for j in range(1, N + 1):",
"- for k in range(3):",
"- if j == 1:",
"- dp[j][k] = abc[0][k]",
"- else:",
"- box = []",
"- ... | false | 0.03567 | 0.062313 | 0.572432 | [
"s145884989",
"s031429517"
] |
u670567845 | p03030 | python | s761920153 | s421242181 | 59 | 23 | 62,744 | 9,116 | Accepted | Accepted | 61.02 | N = int(eval(input()))
sp = [list(input().split()) for i in range(N)]
for i in range(N):
sp[i].append(i+1)
sorted_data = sorted(sp, key=lambda x:(x[0], -int(x[1])))
for i in range(N):
print((sorted_data[i][2])) | N = int(eval(input()))
D = [list(map(str,input().split())) for _ in range(N)]
for i in range(N):
D[i].append(i+1)
sorted_d = sorted(D, key = lambda x: (x[0], -int(x[1])))
for i in range(N):
print((sorted_d[i][2])) | 7 | 7 | 212 | 215 | N = int(eval(input()))
sp = [list(input().split()) for i in range(N)]
for i in range(N):
sp[i].append(i + 1)
sorted_data = sorted(sp, key=lambda x: (x[0], -int(x[1])))
for i in range(N):
print((sorted_data[i][2]))
| N = int(eval(input()))
D = [list(map(str, input().split())) for _ in range(N)]
for i in range(N):
D[i].append(i + 1)
sorted_d = sorted(D, key=lambda x: (x[0], -int(x[1])))
for i in range(N):
print((sorted_d[i][2]))
| false | 0 | [
"-sp = [list(input().split()) for i in range(N)]",
"+D = [list(map(str, input().split())) for _ in range(N)]",
"- sp[i].append(i + 1)",
"-sorted_data = sorted(sp, key=lambda x: (x[0], -int(x[1])))",
"+ D[i].append(i + 1)",
"+sorted_d = sorted(D, key=lambda x: (x[0], -int(x[1])))",
"- print((sor... | false | 0.137173 | 0.053843 | 2.547627 | [
"s761920153",
"s421242181"
] |
u150984829 | p02271 | python | s691527674 | s677062504 | 1,050 | 20 | 5,656 | 5,652 | Accepted | Accepted | 98.1 | n=int(eval(input()))
A=list(map(int,input().split()))
r=set()
def f(s,k):
if k>=0:
global r
r.add(s)
f(s+A[k-1],k-1)
f(s,k-1)
f(0,n)
eval(input())
for e in map(int,input().split()):print((['no','yes'][e in r]))
| eval(input())
s = {0}
for a in map(int,input().split()):
for b in list(s):
s.add(a+b)
eval(input())
for e in map(int,input().split()):
print(('yes' if e in s else 'no'))
| 12 | 8 | 244 | 179 | n = int(eval(input()))
A = list(map(int, input().split()))
r = set()
def f(s, k):
if k >= 0:
global r
r.add(s)
f(s + A[k - 1], k - 1)
f(s, k - 1)
f(0, n)
eval(input())
for e in map(int, input().split()):
print((["no", "yes"][e in r]))
| eval(input())
s = {0}
for a in map(int, input().split()):
for b in list(s):
s.add(a + b)
eval(input())
for e in map(int, input().split()):
print(("yes" if e in s else "no"))
| false | 33.333333 | [
"-n = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-r = set()",
"-",
"-",
"-def f(s, k):",
"- if k >= 0:",
"- global r",
"- r.add(s)",
"- f(s + A[k - 1], k - 1)",
"- f(s, k - 1)",
"-",
"-",
"-f(0, n)",
"+eval(input())",
"+s = {0}",
"+fo... | false | 0.119752 | 0.04553 | 2.630184 | [
"s691527674",
"s677062504"
] |
u691018832 | p02845 | python | s031688306 | s623700318 | 136 | 106 | 13,876 | 12,408 | Accepted | Accepted | 22.06 | import sys
input = sys.stdin.readline
n = int(eval(input()))
a = list(map(int, input().split()))
rbg = [-1, -1, -1]
ans = 1
mod = 10 ** 9 + 7
for A in a:
ans *= rbg.count(A - 1)
ans %= mod
for i in range(3):
if rbg[i] == A - 1:
rbg[i] = A
break
print(ans)
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
n, *a = list(map(int, read().split()))
ans = 1
mod = 10 ** 9 + 7
memo = [0, 0, 0]
for check in a:
if check in memo:
ans *= memo.count(check)
... | 18 | 19 | 314 | 422 | import sys
input = sys.stdin.readline
n = int(eval(input()))
a = list(map(int, input().split()))
rbg = [-1, -1, -1]
ans = 1
mod = 10**9 + 7
for A in a:
ans *= rbg.count(A - 1)
ans %= mod
for i in range(3):
if rbg[i] == A - 1:
rbg[i] = A
break
print(ans)
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
n, *a = list(map(int, read().split()))
ans = 1
mod = 10**9 + 7
memo = [0, 0, 0]
for check in a:
if check in memo:
ans *= memo.count(check)
ans %= mod
... | false | 5.263158 | [
"-input = sys.stdin.readline",
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-rbg = [-1, -1, -1]",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"+sys.setrecursionlimit(10**7)",
"+n, *a = list(map(int, read(... | false | 0.11454 | 0.047418 | 2.415529 | [
"s031688306",
"s623700318"
] |
u705621008 | p03147 | python | s847916349 | s312669482 | 20 | 18 | 3,064 | 3,060 | Accepted | Accepted | 10 | s = int(eval(input()))
a = list(map(int, input().split()))
incFlg = True #登る場合はTure, 降る場合はFalse
before_height = 0
sum = 0
for i in range(len(a)-1):
#降る場合
if a[i] > a[i+1]:
#その前が登り
if incFlg:
sum += a[i] - before_height
incFlg = False
#その前が下り
... | s = int(eval(input()))
a = list(map(int, input().split()))
incFlg = True #登る場合はTure, 降る場合はFalse
before_height = 0
sum = 0
for i in range(len(a)-1):
#降る場合
if a[i] > a[i+1]:
#その前が登り
if incFlg:
sum += a[i] - before_height
incFlg = False
#その前が下り
... | 27 | 27 | 530 | 536 | s = int(eval(input()))
a = list(map(int, input().split()))
incFlg = True # 登る場合はTure, 降る場合はFalse
before_height = 0
sum = 0
for i in range(len(a) - 1):
# 降る場合
if a[i] > a[i + 1]:
# その前が登り
if incFlg:
sum += a[i] - before_height
incFlg = False
# その前が下り
else:... | s = int(eval(input()))
a = list(map(int, input().split()))
incFlg = True # 登る場合はTure, 降る場合はFalse
before_height = 0
sum = 0
for i in range(len(a) - 1):
# 降る場合
if a[i] > a[i + 1]:
# その前が登り
if incFlg:
sum += a[i] - before_height
incFlg = False
# その前が下り
# els... | false | 0 | [
"- else:",
"- before_height = a[i]",
"+ # else:",
"+ # # before_height = a[i]"
] | false | 0.039426 | 0.03835 | 1.028054 | [
"s847916349",
"s312669482"
] |
u434630332 | p04029 | python | s023264655 | s150665520 | 24 | 22 | 9,076 | 9,100 | Accepted | Accepted | 8.33 | n = int(eval(input()))
answer = int((n + 1) * n / 2)
print(answer) | n = int(eval(input()))
print((int((n + 1) * n / 2))) | 5 | 2 | 66 | 45 | n = int(eval(input()))
answer = int((n + 1) * n / 2)
print(answer)
| n = int(eval(input()))
print((int((n + 1) * n / 2)))
| false | 60 | [
"-answer = int((n + 1) * n / 2)",
"-print(answer)",
"+print((int((n + 1) * n / 2)))"
] | false | 0.036436 | 0.042366 | 0.860024 | [
"s023264655",
"s150665520"
] |
u246217175 | p03575 | python | s200049859 | s747395186 | 257 | 209 | 46,572 | 42,992 | Accepted | Accepted | 18.68 | from collections import Counter
n , m = list(map(int, input().split()))
err = 0
ans = 0
par = [0] * n
rank = [0] * n
#初期化
for i in range(n):
par[i] = i
rank[i] = 0
#判定(一番上野根を求める)
def find(x):
if par[x] == x:
return x
else:
par[x] = find(par[x])
return par[... | from collections import Counter
maxn = 100000
n , m = list(map(int, input().split()))
par = [0] * n
rank = [0] * n
#初期化
for i in range(n):
par[i] = i
rank[i] = 0
#判定(一番上野根を求める)
def find(x):
if par[x] == x:
return x
else:
par[x] = find(par[x])
return par[x... | 59 | 67 | 997 | 1,118 | from collections import Counter
n, m = list(map(int, input().split()))
err = 0
ans = 0
par = [0] * n
rank = [0] * n
# 初期化
for i in range(n):
par[i] = i
rank[i] = 0
# 判定(一番上野根を求める)
def find(x):
if par[x] == x:
return x
else:
par[x] = find(par[x])
return par[x]
# 結合
def unite(x,... | from collections import Counter
maxn = 100000
n, m = list(map(int, input().split()))
par = [0] * n
rank = [0] * n
# 初期化
for i in range(n):
par[i] = i
rank[i] = 0
# 判定(一番上野根を求める)
def find(x):
if par[x] == x:
return x
else:
par[x] = find(par[x])
return par[x]
# 結合
def unite(x, y... | false | 11.940299 | [
"+maxn = 100000",
"-err = 0",
"-ans = 0",
"+ a[i] -= 1",
"+ b[i] -= 1",
"- for v in range(n):",
"- par[v] = v",
"- rank[v] = 0",
"+ for j in range(n):",
"+ par[j] = j",
"+ rank[j] = 0",
"- if j == i:",
"+ if i == j:",
"- unite(a[... | false | 0.169137 | 0.206624 | 0.818572 | [
"s200049859",
"s747395186"
] |
u678167152 | p02714 | python | s753341474 | s512369032 | 775 | 160 | 74,996 | 74,176 | Accepted | Accepted | 79.35 | N = int(eval(input()))
S = eval(input())
R, G, B = [],[],[]
for i,s in enumerate(S):
if s=='R':
R.append(i)
elif s=='G':
G.append(i)
else:
B.append(i)
R.sort()
G.sort()
B.sort()
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
... | from collections import Counter
def solve():
N = int(eval(input()))
S = list(eval(input()))
c = Counter(S)
ans = c['R']*c['G']*c['B']
for i in range(N):
for j in range(i+1,N):
k = j*2-i
if k>N-1:
break
if S[i]!=S[j] and S[j]!=S[k] and S[i]!=S[k]:
ans -= 1
r... | 29 | 15 | 607 | 333 | N = int(eval(input()))
S = eval(input())
R, G, B = [], [], []
for i, s in enumerate(S):
if s == "R":
R.append(i)
elif s == "G":
G.append(i)
else:
B.append(i)
R.sort()
G.sort()
B.sort()
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
ans = len(... | from collections import Counter
def solve():
N = int(eval(input()))
S = list(eval(input()))
c = Counter(S)
ans = c["R"] * c["G"] * c["B"]
for i in range(N):
for j in range(i + 1, N):
k = j * 2 - i
if k > N - 1:
break
if S[i] != S[j] and S... | false | 48.275862 | [
"-N = int(eval(input()))",
"-S = eval(input())",
"-R, G, B = [], [], []",
"-for i, s in enumerate(S):",
"- if s == \"R\":",
"- R.append(i)",
"- elif s == \"G\":",
"- G.append(i)",
"- else:",
"- B.append(i)",
"-R.sort()",
"-G.sort()",
"-B.sort()",
"-from bisect... | false | 0.088744 | 0.038907 | 2.280906 | [
"s753341474",
"s512369032"
] |
u997641430 | p02788 | python | s261873022 | s072244003 | 1,419 | 1,294 | 44,268 | 44,316 | Accepted | Accepted | 8.81 | n, d, a = list(map(int, input().split()))
XH = []
for i in range(n):
x, h = list(map(int, input().split()))
XH.append((x, h))
XH.sort()
X = [x for x, h in XH]
H = [h for x, h in XH]
# n, d, a = 9, 2, 2
# X = [1, 3, 4, 6, 9, 10, 12, 13, 16]
# H = [7, 6, 7, 5, 10, 3, 8, 9, 6]
X.append(10**10)
H.append... | n, d, a = list(map(int, input().split()))
XH = [tuple(map(int, input().split())) for i in range(n)]
XH.sort()
X = [x for x, h in XH]
H = [h for x, h in XH]
X.append(10**10)
H.append(0)
j = 0
S = [0]*(n+1)
ans = 0
for i in range(n):
H[i] = max(0, H[i]-S[i])
c = -(-H[i]//a)
while X[j] <= X[i] + 2... | 29 | 19 | 605 | 403 | n, d, a = list(map(int, input().split()))
XH = []
for i in range(n):
x, h = list(map(int, input().split()))
XH.append((x, h))
XH.sort()
X = [x for x, h in XH]
H = [h for x, h in XH]
# n, d, a = 9, 2, 2
# X = [1, 3, 4, 6, 9, 10, 12, 13, 16]
# H = [7, 6, 7, 5, 10, 3, 8, 9, 6]
X.append(10**10)
H.append(0)
j = 0
c ... | n, d, a = list(map(int, input().split()))
XH = [tuple(map(int, input().split())) for i in range(n)]
XH.sort()
X = [x for x, h in XH]
H = [h for x, h in XH]
X.append(10**10)
H.append(0)
j = 0
S = [0] * (n + 1)
ans = 0
for i in range(n):
H[i] = max(0, H[i] - S[i])
c = -(-H[i] // a)
while X[j] <= X[i] + 2 * d:... | false | 34.482759 | [
"-XH = []",
"-for i in range(n):",
"- x, h = list(map(int, input().split()))",
"- XH.append((x, h))",
"+XH = [tuple(map(int, input().split())) for i in range(n)]",
"-# n, d, a = 9, 2, 2",
"-# X = [1, 3, 4, 6, 9, 10, 12, 13, 16]",
"-# H = [7, 6, 7, 5, 10, 3, 8, 9, 6]",
"-c = 0",
"+ans = 0",
... | false | 0.038276 | 0.062548 | 0.611947 | [
"s261873022",
"s072244003"
] |
u743164083 | p03127 | python | s761194140 | s795378289 | 178 | 107 | 14,596 | 85,148 | Accepted | Accepted | 39.89 | from functools import reduce
def gcd(a, b):
if b > a:
a, b = b, a
dp = [a, b]
for i, v in enumerate(dp, start=2):
dp.append(dp[i - 2] % dp[i - 1])
if dp[i] == 0:
break
return dp[i - 1]
N = int(eval(input()))
a = list(map(int, input().split()))
prin... | import math
n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in a:
ans = math.gcd(ans, i)
print(ans)
| 17 | 9 | 332 | 133 | from functools import reduce
def gcd(a, b):
if b > a:
a, b = b, a
dp = [a, b]
for i, v in enumerate(dp, start=2):
dp.append(dp[i - 2] % dp[i - 1])
if dp[i] == 0:
break
return dp[i - 1]
N = int(eval(input()))
a = list(map(int, input().split()))
print((reduce(gcd, a... | import math
n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in a:
ans = math.gcd(ans, i)
print(ans)
| false | 47.058824 | [
"-from functools import reduce",
"+import math",
"-",
"-def gcd(a, b):",
"- if b > a:",
"- a, b = b, a",
"- dp = [a, b]",
"- for i, v in enumerate(dp, start=2):",
"- dp.append(dp[i - 2] % dp[i - 1])",
"- if dp[i] == 0:",
"- break",
"- return dp[i - 1... | false | 0.008053 | 0.064441 | 0.12496 | [
"s761194140",
"s795378289"
] |
u294922877 | p02393 | python | s758646874 | s428604004 | 30 | 20 | 7,616 | 5,592 | Accepted | Accepted | 33.33 | nums=sorted(list(map(int, input().split())))
print(('%d %d %d' % (nums[0],nums[1],nums[2]))) | def execute(a, b, c):
return sorted([a, b, c])
if __name__ == '__main__':
numbers = list(map(int, input().split(' ')))
print((*execute(*numbers)))
| 2 | 7 | 91 | 159 | nums = sorted(list(map(int, input().split())))
print(("%d %d %d" % (nums[0], nums[1], nums[2])))
| def execute(a, b, c):
return sorted([a, b, c])
if __name__ == "__main__":
numbers = list(map(int, input().split(" ")))
print((*execute(*numbers)))
| false | 71.428571 | [
"-nums = sorted(list(map(int, input().split())))",
"-print((\"%d %d %d\" % (nums[0], nums[1], nums[2])))",
"+def execute(a, b, c):",
"+ return sorted([a, b, c])",
"+",
"+",
"+if __name__ == \"__main__\":",
"+ numbers = list(map(int, input().split(\" \")))",
"+ print((*execute(*numbers)))"
] | false | 0.063289 | 0.104677 | 0.604614 | [
"s758646874",
"s428604004"
] |
u599547273 | p04001 | python | s534855626 | s313072591 | 29 | 20 | 3,060 | 3,188 | Accepted | Accepted | 31.03 | # abc 045 c
from itertools import zip_longest
s = eval(input())
sum_num = 0
for i in range(0, 2**(len(s)-1)):
sings = bin(i)[2:].zfill(len(s)-1).replace("1", "+").replace("0", " ")
formula = ("".join("".join(t) for t in zip_longest(s, sings, fillvalue=" "))).replace(" ", "")
sum_num += eval(formula)
pr... | s = eval(input())
s_len = len(s)
sum_num = 0
for i in range(1<<(s_len-1), 1<<s_len):
n, a = 0, 0
for j in range(s_len):
if (i>>j)%2 == 0:
continue
n += int(s[a:j+1])
a = j+1
sum_num += n
print(sum_num) | 12 | 15 | 326 | 224 | # abc 045 c
from itertools import zip_longest
s = eval(input())
sum_num = 0
for i in range(0, 2 ** (len(s) - 1)):
sings = bin(i)[2:].zfill(len(s) - 1).replace("1", "+").replace("0", " ")
formula = (
"".join("".join(t) for t in zip_longest(s, sings, fillvalue=" "))
).replace(" ", "")
sum_num += ... | s = eval(input())
s_len = len(s)
sum_num = 0
for i in range(1 << (s_len - 1), 1 << s_len):
n, a = 0, 0
for j in range(s_len):
if (i >> j) % 2 == 0:
continue
n += int(s[a : j + 1])
a = j + 1
sum_num += n
print(sum_num)
| false | 20 | [
"-# abc 045 c",
"-from itertools import zip_longest",
"-",
"+s_len = len(s)",
"-for i in range(0, 2 ** (len(s) - 1)):",
"- sings = bin(i)[2:].zfill(len(s) - 1).replace(\"1\", \"+\").replace(\"0\", \" \")",
"- formula = (",
"- \"\".join(\"\".join(t) for t in zip_longest(s, sings, fillvalue... | false | 0.040436 | 0.039716 | 1.018129 | [
"s534855626",
"s313072591"
] |
u729133443 | p03287 | python | s047640165 | s882456493 | 408 | 107 | 16,100 | 14,476 | Accepted | Accepted | 73.77 | import math
def f(x):return math.factorial(x)
def g(x):return f(x)//(f(x-2)*f(2))if x>1else 0
n,m=list(map(int,input().split()))
b=0
c={}
for a in input().split():
b+=int(a)
c[b%m]=c.get(b%m,0)+1
print((sum([g(x) for x in list(c.values())])+c.get(0,0))) | n,m,*c=list(map(int,open(0).read().split()))
d={0:1}
r=s=0
for i in c:s+=i;x=d.get(s%m,0);r+=x;d[s%m]=x+1
print(r) | 10 | 5 | 255 | 112 | import math
def f(x):
return math.factorial(x)
def g(x):
return f(x) // (f(x - 2) * f(2)) if x > 1 else 0
n, m = list(map(int, input().split()))
b = 0
c = {}
for a in input().split():
b += int(a)
c[b % m] = c.get(b % m, 0) + 1
print((sum([g(x) for x in list(c.values())]) + c.get(0, 0)))
| n, m, *c = list(map(int, open(0).read().split()))
d = {0: 1}
r = s = 0
for i in c:
s += i
x = d.get(s % m, 0)
r += x
d[s % m] = x + 1
print(r)
| false | 50 | [
"-import math",
"-",
"-",
"-def f(x):",
"- return math.factorial(x)",
"-",
"-",
"-def g(x):",
"- return f(x) // (f(x - 2) * f(2)) if x > 1 else 0",
"-",
"-",
"-n, m = list(map(int, input().split()))",
"-b = 0",
"-c = {}",
"-for a in input().split():",
"- b += int(a)",
"- ... | false | 0.036585 | 0.035475 | 1.031278 | [
"s047640165",
"s882456493"
] |
u699089116 | p02659 | python | s736832453 | s264659037 | 92 | 63 | 71,104 | 61,540 | Accepted | Accepted | 31.52 | from decimal import Decimal, ROUND_DOWN
a, b = list(map(str, input().split()))
a = Decimal(a)
b = Decimal(b)
print(((a*b).quantize(Decimal("0"), rounding=ROUND_DOWN))) | a, b = list(map(str, input().split()))
b = b.replace(".", "")
print((int(a) * int(b) // 100)) | 6 | 3 | 165 | 87 | from decimal import Decimal, ROUND_DOWN
a, b = list(map(str, input().split()))
a = Decimal(a)
b = Decimal(b)
print(((a * b).quantize(Decimal("0"), rounding=ROUND_DOWN)))
| a, b = list(map(str, input().split()))
b = b.replace(".", "")
print((int(a) * int(b) // 100))
| false | 50 | [
"-from decimal import Decimal, ROUND_DOWN",
"-",
"-a = Decimal(a)",
"-b = Decimal(b)",
"-print(((a * b).quantize(Decimal(\"0\"), rounding=ROUND_DOWN)))",
"+b = b.replace(\".\", \"\")",
"+print((int(a) * int(b) // 100))"
] | false | 0.092774 | 0.038529 | 2.40792 | [
"s736832453",
"s264659037"
] |
u628335443 | p03127 | python | s465784414 | s973961787 | 106 | 92 | 20,076 | 20,056 | Accepted | Accepted | 13.21 | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
i = 0
while i < n-1:
x = a[i+1] % a[i]
a[i+1] = a[i]
a[i] = x
if a[i] == 0:
i += 1
print((a[i]))
| n = int(eval(input()))
a = list(map(int, input().split()))
i = 0
while i < n-1:
x = a[i+1] % a[i]
a[i+1] = a[i]
a[i] = x
if a[i] == 0:
i += 1
print((a[i]))
| 12 | 11 | 193 | 183 | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
i = 0
while i < n - 1:
x = a[i + 1] % a[i]
a[i + 1] = a[i]
a[i] = x
if a[i] == 0:
i += 1
print((a[i]))
| n = int(eval(input()))
a = list(map(int, input().split()))
i = 0
while i < n - 1:
x = a[i + 1] % a[i]
a[i + 1] = a[i]
a[i] = x
if a[i] == 0:
i += 1
print((a[i]))
| false | 8.333333 | [
"-a.sort()"
] | false | 0.033585 | 0.035548 | 0.944791 | [
"s465784414",
"s973961787"
] |
u838644735 | p02756 | python | s808615231 | s355158333 | 213 | 182 | 8,548 | 8,548 | Accepted | Accepted | 14.55 | from collections import deque
from sys import stdin
def main():
S = deque([s for s in eval(input())])
Q = int(eval(input()))
order = True
for i in range(Q):
query = stdin.readline().split()
t = int(query[0])
if t == 1:
order = not order
else:
... | from collections import deque
from sys import stdin
def main():
S = deque([s for s in eval(input())])
Q = int(eval(input()))
order = True
for i in range(Q):
query = stdin.readline()
t = int(query[0])
if t == 1:
order = not order
else:
... | 28 | 28 | 666 | 658 | from collections import deque
from sys import stdin
def main():
S = deque([s for s in eval(input())])
Q = int(eval(input()))
order = True
for i in range(Q):
query = stdin.readline().split()
t = int(query[0])
if t == 1:
order = not order
else:
f =... | from collections import deque
from sys import stdin
def main():
S = deque([s for s in eval(input())])
Q = int(eval(input()))
order = True
for i in range(Q):
query = stdin.readline()
t = int(query[0])
if t == 1:
order = not order
else:
f = int(que... | false | 0 | [
"- query = stdin.readline().split()",
"+ query = stdin.readline()",
"- f = int(query[1])",
"- c = query[2]",
"+ f = int(query[2])",
"+ c = query[4]"
] | false | 0.044705 | 0.094426 | 0.473438 | [
"s808615231",
"s355158333"
] |
u247211039 | p03086 | python | s095869593 | s497352260 | 34 | 28 | 9,032 | 9,068 | Accepted | Accepted | 17.65 | S=eval(input())
T='ATCG'
flag =0
ans =0
for i in range(len(S)):
flag =0
for j in range(i,len(S)):
if S[j] == 'A' or S[j] == 'G' or S[j] == 'T' or S[j] == 'C':
flag +=1
ans = max(ans,flag)
else:
break
print(ans) | S=eval(input())
A=['A','G','T','C']
ans=0
cnt=0
N=len(S)
for i in range(N):
cnt=0
for j in range(0,N-i):
if S[i+j] in A:
cnt+=1
else:
break
ans=max(ans,cnt)
print(ans) | 16 | 15 | 292 | 228 | S = eval(input())
T = "ATCG"
flag = 0
ans = 0
for i in range(len(S)):
flag = 0
for j in range(i, len(S)):
if S[j] == "A" or S[j] == "G" or S[j] == "T" or S[j] == "C":
flag += 1
ans = max(ans, flag)
else:
break
print(ans)
| S = eval(input())
A = ["A", "G", "T", "C"]
ans = 0
cnt = 0
N = len(S)
for i in range(N):
cnt = 0
for j in range(0, N - i):
if S[i + j] in A:
cnt += 1
else:
break
ans = max(ans, cnt)
print(ans)
| false | 6.25 | [
"-T = \"ATCG\"",
"-flag = 0",
"+A = [\"A\", \"G\", \"T\", \"C\"]",
"-for i in range(len(S)):",
"- flag = 0",
"- for j in range(i, len(S)):",
"- if S[j] == \"A\" or S[j] == \"G\" or S[j] == \"T\" or S[j] == \"C\":",
"- flag += 1",
"- ans = max(ans, flag)",
"+cnt =... | false | 0.036644 | 0.038096 | 0.961892 | [
"s095869593",
"s497352260"
] |
u970197315 | p03212 | python | s201010816 | s159425216 | 92 | 70 | 2,940 | 3,060 | Accepted | Accepted | 23.91 | # ABC114 C - 755
N = int(eval(input()))
def rep(s):
if int(s) > N:
return 0
ret = 1 if all(s.count(c) > 0 for c in '753') else 0
for c in '753':
ret += rep(s + c)
return ret
print((rep('0'))) | # C - 755
def dfs(n,s):
if int(s)>n:
return 0
res=0
if s.count('7')>0 and s.count('5')>0 and s.count('3')>0:
res=1
for i in '753':
res+=dfs(n,s+i)
return res
n=int(eval(input()))
print((dfs(n,'0'))) | 12 | 15 | 230 | 255 | # ABC114 C - 755
N = int(eval(input()))
def rep(s):
if int(s) > N:
return 0
ret = 1 if all(s.count(c) > 0 for c in "753") else 0
for c in "753":
ret += rep(s + c)
return ret
print((rep("0")))
| # C - 755
def dfs(n, s):
if int(s) > n:
return 0
res = 0
if s.count("7") > 0 and s.count("5") > 0 and s.count("3") > 0:
res = 1
for i in "753":
res += dfs(n, s + i)
return res
n = int(eval(input()))
print((dfs(n, "0")))
| false | 20 | [
"-# ABC114 C - 755",
"-N = int(eval(input()))",
"+# C - 755",
"+def dfs(n, s):",
"+ if int(s) > n:",
"+ return 0",
"+ res = 0",
"+ if s.count(\"7\") > 0 and s.count(\"5\") > 0 and s.count(\"3\") > 0:",
"+ res = 1",
"+ for i in \"753\":",
"+ res += dfs(n, s + i)",... | false | 0.138994 | 0.058364 | 2.381512 | [
"s201010816",
"s159425216"
] |
u044964932 | p02954 | python | s999794125 | s336241246 | 97 | 82 | 7,096 | 11,568 | Accepted | Accepted | 15.46 | def main():
ss = list(eval(input()))
n = len(ss)
ans = [0]*n
cnt = 0
for i, lr in enumerate(ss):
if lr == "R":
cnt += 1
continue
else:
even_num = cnt//2
odd_num = cnt - even_num
ans[i] += even_num
an... | def main():
ss = list(eval(input()))
n = len(ss)
ans = [0] * n
cnt = 0
for i in range(n):
if ss[i] == "R":
cnt += 1
else:
even_num = cnt // 2
odd_num = cnt - even_num
ans[i] += even_num
ans[i-1] += odd_num
... | 31 | 29 | 690 | 657 | def main():
ss = list(eval(input()))
n = len(ss)
ans = [0] * n
cnt = 0
for i, lr in enumerate(ss):
if lr == "R":
cnt += 1
continue
else:
even_num = cnt // 2
odd_num = cnt - even_num
ans[i] += even_num
ans[i - 1] ... | def main():
ss = list(eval(input()))
n = len(ss)
ans = [0] * n
cnt = 0
for i in range(n):
if ss[i] == "R":
cnt += 1
else:
even_num = cnt // 2
odd_num = cnt - even_num
ans[i] += even_num
ans[i - 1] += odd_num
cnt ... | false | 6.451613 | [
"- for i, lr in enumerate(ss):",
"- if lr == \"R\":",
"+ for i in range(n):",
"+ if ss[i] == \"R\":",
"- continue",
"+ cnt = 0",
"- continue"
] | false | 0.036079 | 0.084838 | 0.425266 | [
"s999794125",
"s336241246"
] |
u606045429 | p02814 | python | s520172681 | s281008263 | 236 | 122 | 16,092 | 16,148 | Accepted | Accepted | 48.31 | from fractions import gcd
from functools import reduce
N, M, *A = list(map(int, open(0).read().split()))
Y = reduce(lambda a, b: a * b // gcd(a, b), A)
print((M // (Y // 2) - (M // Y) if all((Y // a) % 2 for a in A) else 0)) | from fractions import gcd
lcm = lambda a, b: a * b // gcd(a, b)
N, M, *A = list(map(int, open(0).read().split()))
Y = A[0]
for a in A[1:]:
Y = lcm(Y, a)
if Y > 2 * M:
print((0))
quit()
print((M // (Y // 2) - (M // Y) if all((Y // a) % 2 for a in A) else 0)) | 8 | 14 | 226 | 288 | from fractions import gcd
from functools import reduce
N, M, *A = list(map(int, open(0).read().split()))
Y = reduce(lambda a, b: a * b // gcd(a, b), A)
print((M // (Y // 2) - (M // Y) if all((Y // a) % 2 for a in A) else 0))
| from fractions import gcd
lcm = lambda a, b: a * b // gcd(a, b)
N, M, *A = list(map(int, open(0).read().split()))
Y = A[0]
for a in A[1:]:
Y = lcm(Y, a)
if Y > 2 * M:
print((0))
quit()
print((M // (Y // 2) - (M // Y) if all((Y // a) % 2 for a in A) else 0))
| false | 42.857143 | [
"-from functools import reduce",
"+lcm = lambda a, b: a * b // gcd(a, b)",
"-Y = reduce(lambda a, b: a * b // gcd(a, b), A)",
"+Y = A[0]",
"+for a in A[1:]:",
"+ Y = lcm(Y, a)",
"+ if Y > 2 * M:",
"+ print((0))",
"+ quit()"
] | false | 0.047949 | 0.048068 | 0.997534 | [
"s520172681",
"s281008263"
] |
u150984829 | p00096 | python | s433879670 | s207663890 | 30 | 20 | 5,636 | 5,636 | Accepted | Accepted | 33.33 | import sys
a=[0]*4001
for i in range(1999):a[i]=a[4000-i]=(i+3)*(i+2)*(i+1)//6-a[i-1001]*4*(i>999)
for e in sys.stdin:print((a[int(e)]))
| import sys
a=[0]*4001
for i in range(2001):a[i]=a[4000-i]=(i+3)*(i+2)*(i+1)//6-a[i-1001]*4*(i>999)
for e in sys.stdin:print((a[int(e)]))
| 4 | 4 | 138 | 138 | import sys
a = [0] * 4001
for i in range(1999):
a[i] = a[4000 - i] = (i + 3) * (i + 2) * (i + 1) // 6 - a[i - 1001] * 4 * (i > 999)
for e in sys.stdin:
print((a[int(e)]))
| import sys
a = [0] * 4001
for i in range(2001):
a[i] = a[4000 - i] = (i + 3) * (i + 2) * (i + 1) // 6 - a[i - 1001] * 4 * (i > 999)
for e in sys.stdin:
print((a[int(e)]))
| false | 0 | [
"-for i in range(1999):",
"+for i in range(2001):"
] | false | 0.105735 | 0.051562 | 2.05064 | [
"s433879670",
"s207663890"
] |
u644907318 | p02862 | python | s173020420 | s606590702 | 831 | 250 | 223,920 | 91,152 | Accepted | Accepted | 69.92 | p = 10**9+7
def pow(x,m):
if m==0:return 1
if m%2==0:
return (pow(x,m//2)**2)%p
else:
return (x*(pow(x,(m-1)//2)**2))%p
X,Y = list(map(int,input().split()))
K = X+Y
A = [1 for _ in range(K)]
for i in range(2,K):
A[i] = (A[i-1]*i)%p
B = [1 for _ in range(K)]
B[K-1] = pow(A[K-... | def pow(x,m):
if m==0:
return 1
if m==1:
return x
if m%2==0:
return (pow(x,m//2)**2)%p
else:
return (x*pow(x,m-1))%p
p = 10**9+7
N = (2*10**6)//3
A = [1 for _ in range(N+1)]
for i in range(2,N+1):
A[i] = (A[i-1]*i)%p
B = [1 for _ in range(N+1)]
B[N] = p... | 23 | 26 | 541 | 574 | p = 10**9 + 7
def pow(x, m):
if m == 0:
return 1
if m % 2 == 0:
return (pow(x, m // 2) ** 2) % p
else:
return (x * (pow(x, (m - 1) // 2) ** 2)) % p
X, Y = list(map(int, input().split()))
K = X + Y
A = [1 for _ in range(K)]
for i in range(2, K):
A[i] = (A[i - 1] * i) % p
B = [... | def pow(x, m):
if m == 0:
return 1
if m == 1:
return x
if m % 2 == 0:
return (pow(x, m // 2) ** 2) % p
else:
return (x * pow(x, m - 1)) % p
p = 10**9 + 7
N = (2 * 10**6) // 3
A = [1 for _ in range(N + 1)]
for i in range(2, N + 1):
A[i] = (A[i - 1] * i) % p
B = [1 fo... | false | 11.538462 | [
"-p = 10**9 + 7",
"-",
"-",
"+ if m == 1:",
"+ return x",
"- return (x * (pow(x, (m - 1) // 2) ** 2)) % p",
"+ return (x * pow(x, m - 1)) % p",
"+p = 10**9 + 7",
"+N = (2 * 10**6) // 3",
"+A = [1 for _ in range(N + 1)]",
"+for i in range(2, N + 1):",
"+ A[i] = (A[i -... | false | 0.730173 | 1.035194 | 0.705349 | [
"s173020420",
"s606590702"
] |
u189023301 | p03162 | python | s905243897 | s606852098 | 638 | 306 | 74,328 | 67,548 | Accepted | Accepted | 52.04 | def main():
n = int(eval(input()))
a = [list(map(int, input().split())) for _ in range(n)]
dp = [[0] * 3 for _ in range(n)]
dp[0] = a[0]
for i in range(n - 1):
dp[i + 1][0] = a[i + 1][0] + max(dp[i][1], dp[i][2])
dp[i + 1][1] = a[i + 1][1] + max(dp[i][2], dp[i][0])
... | import sys
readline = sys.stdin.buffer.readline
def main():
n = int(readline())
a = [list(map(int, readline().split())) for _ in range(n)]
dp = [[0] * 3 for _ in range(n)]
dp[0] = a[0]
for i in range(n - 1):
dp[i + 1][0] = a[i + 1][0] + max(dp[i][1], dp[i][2])
dp[i + 1... | 16 | 18 | 440 | 492 | def main():
n = int(eval(input()))
a = [list(map(int, input().split())) for _ in range(n)]
dp = [[0] * 3 for _ in range(n)]
dp[0] = a[0]
for i in range(n - 1):
dp[i + 1][0] = a[i + 1][0] + max(dp[i][1], dp[i][2])
dp[i + 1][1] = a[i + 1][1] + max(dp[i][2], dp[i][0])
dp[i + 1][... | import sys
readline = sys.stdin.buffer.readline
def main():
n = int(readline())
a = [list(map(int, readline().split())) for _ in range(n)]
dp = [[0] * 3 for _ in range(n)]
dp[0] = a[0]
for i in range(n - 1):
dp[i + 1][0] = a[i + 1][0] + max(dp[i][1], dp[i][2])
dp[i + 1][1] = a[i +... | false | 11.111111 | [
"+import sys",
"+",
"+readline = sys.stdin.buffer.readline",
"+",
"+",
"- n = int(eval(input()))",
"- a = [list(map(int, input().split())) for _ in range(n)]",
"+ n = int(readline())",
"+ a = [list(map(int, readline().split())) for _ in range(n)]"
] | false | 0.085838 | 0.087105 | 0.985452 | [
"s905243897",
"s606852098"
] |
u968166680 | p03088 | python | s195971651 | s699243894 | 47 | 39 | 9,972 | 9,920 | Accepted | Accepted | 17.02 | import sys
from collections import defaultdict
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N = int(readline())
dp = [defaultdict(int) for _ in range(N)]
for c in 'ACGT':
... | import sys
from collections import defaultdict
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N = int(readline())
dp = [defaultdict(int) for _ in range(N)]
for c in 'ACGT':
... | 40 | 41 | 1,062 | 1,061 | import sys
from collections import defaultdict
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N = int(readline())
dp = [defaultdict(int) for _ in range(N)]
for c in "ACGT":
dp[0][c + "XX"]... | import sys
from collections import defaultdict
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N = int(readline())
dp = [defaultdict(int) for _ in range(N)]
for c in "ACGT":
dp[0][c + "XX"]... | false | 2.439024 | [
"+ t = s[:2]",
"- dp[i][c + s[:2]] = (dp[i][c + s[:2]] + v) % MOD",
"+ dp[i][c + t] = (dp[i][c + t] + v) % MOD",
"- dp[i][\"G\" + s[:2]] = (dp[i][\"G\" + s[:2]] + v) % MOD",
"+ dp[i][\"G\" + t] = (dp[i][\"G\" + t] + v) % MOD",
"- ... | false | 0.046056 | 0.093155 | 0.494406 | [
"s195971651",
"s699243894"
] |
u556594202 | p02730 | python | s187518718 | s230968138 | 32 | 27 | 9,076 | 8,988 | Accepted | Accepted | 15.62 | S = eval(input())
N = len(S)
flag = [0,0,0]
if S=="".join(reversed(list(S))):
flag[0]=1
if S[:int((N-1)/2)]=="".join(reversed(list(S[:int((N-1)/2)]))):
flag[1]=1
if S[int((N+3)/2)-1:]=="".join(reversed(list(S[int((N+3)/2)-1:]))):
flag[2]=1
print(("Yes" if flag==[1,1,1] else "No"))
| S = eval(input())
N = len(S)
flag = True
if S!="".join(reversed(list(S))):
flag=False
if S[:int((N-1)/2)]!="".join(reversed(list(S[:int((N-1)/2)]))):
flag=False
print(("Yes" if flag else "No"))
| 12 | 9 | 299 | 203 | S = eval(input())
N = len(S)
flag = [0, 0, 0]
if S == "".join(reversed(list(S))):
flag[0] = 1
if S[: int((N - 1) / 2)] == "".join(reversed(list(S[: int((N - 1) / 2)]))):
flag[1] = 1
if S[int((N + 3) / 2) - 1 :] == "".join(reversed(list(S[int((N + 3) / 2) - 1 :]))):
flag[2] = 1
print(("Yes" if flag == [1, 1,... | S = eval(input())
N = len(S)
flag = True
if S != "".join(reversed(list(S))):
flag = False
if S[: int((N - 1) / 2)] != "".join(reversed(list(S[: int((N - 1) / 2)]))):
flag = False
print(("Yes" if flag else "No"))
| false | 25 | [
"-flag = [0, 0, 0]",
"-if S == \"\".join(reversed(list(S))):",
"- flag[0] = 1",
"-if S[: int((N - 1) / 2)] == \"\".join(reversed(list(S[: int((N - 1) / 2)]))):",
"- flag[1] = 1",
"-if S[int((N + 3) / 2) - 1 :] == \"\".join(reversed(list(S[int((N + 3) / 2) - 1 :]))):",
"- flag[2] = 1",
"-print... | false | 0.040699 | 0.084302 | 0.482775 | [
"s187518718",
"s230968138"
] |
u353895424 | p03137 | python | s343378371 | s419913140 | 1,562 | 115 | 13,968 | 13,968 | Accepted | Accepted | 92.64 | n, m = list(map(int, input().split()))
x = list(map(int, input().split()))
if m <= n:
print((0))
else:
x.sort()
diff = []#i番目とi+1番目の距離
for i in range(m-1):
diff.append(x[i+1] - x[i])
diff.sort(reverse=True)
# print(diff)
if n > 1:
for i in range(n-1):
... | n, m = list(map(int, input().split()))
x = list(map(int, input().split()))
x.sort()
d = []
for i in range(m-1):
d.append(x[i+1] - x[i])
d.sort(reverse=True)
# print(d)
print((sum(d[n-1:]))) | 17 | 12 | 367 | 199 | n, m = list(map(int, input().split()))
x = list(map(int, input().split()))
if m <= n:
print((0))
else:
x.sort()
diff = [] # i番目とi+1番目の距離
for i in range(m - 1):
diff.append(x[i + 1] - x[i])
diff.sort(reverse=True)
# print(diff)
if n > 1:
for i in range(n - 1):
dif... | n, m = list(map(int, input().split()))
x = list(map(int, input().split()))
x.sort()
d = []
for i in range(m - 1):
d.append(x[i + 1] - x[i])
d.sort(reverse=True)
# print(d)
print((sum(d[n - 1 :])))
| false | 29.411765 | [
"-if m <= n:",
"- print((0))",
"-else:",
"- x.sort()",
"- diff = [] # i番目とi+1番目の距離",
"- for i in range(m - 1):",
"- diff.append(x[i + 1] - x[i])",
"- diff.sort(reverse=True)",
"- # print(diff)",
"- if n > 1:",
"- for i in range(n - 1):",
"- diff.p... | false | 0.034976 | 0.035865 | 0.975214 | [
"s343378371",
"s419913140"
] |
u562935282 | p03073 | python | s669972200 | s821748284 | 79 | 71 | 3,956 | 3,188 | Accepted | Accepted | 10.13 | s = eval(input())
s = list(map(int, s))
ans = len(s)
for i in range(2):
cnt = 0
for j, ss in enumerate(s):
if (j + i) % 2 != ss: cnt += 1
ans = min(ans, cnt)
print(ans)
| inf = float('inf')
s = eval(input())
ans = inf
for start_color in '01':
cost = 0
for i, ss in enumerate(s):
if i % 2 == 0:
if ss != start_color:
cost += 1
else:
if ss == start_color:
cost += 1
ans = min(ans, cost)
print... | 9 | 16 | 191 | 320 | s = eval(input())
s = list(map(int, s))
ans = len(s)
for i in range(2):
cnt = 0
for j, ss in enumerate(s):
if (j + i) % 2 != ss:
cnt += 1
ans = min(ans, cnt)
print(ans)
| inf = float("inf")
s = eval(input())
ans = inf
for start_color in "01":
cost = 0
for i, ss in enumerate(s):
if i % 2 == 0:
if ss != start_color:
cost += 1
else:
if ss == start_color:
cost += 1
ans = min(ans, cost)
print(ans)
| false | 43.75 | [
"+inf = float(\"inf\")",
"-s = list(map(int, s))",
"-ans = len(s)",
"-for i in range(2):",
"- cnt = 0",
"- for j, ss in enumerate(s):",
"- if (j + i) % 2 != ss:",
"- cnt += 1",
"- ans = min(ans, cnt)",
"+ans = inf",
"+for start_color in \"01\":",
"+ cost = 0",
"... | false | 0.040849 | 0.033481 | 1.220071 | [
"s669972200",
"s821748284"
] |
u667084803 | p03634 | python | s386928811 | s288167938 | 1,570 | 767 | 49,928 | 69,296 | Accepted | Accepted | 51.15 | def BFS(K,path,N):
"""リストのリスト道順path,頂点の個数Nが与えられたとき, 頂点Kから各頂点までの距離をlistで返す"""
from collections import deque
dist=[-1]*N
dist[K]=0
que=deque()
que.append(K)
while que:
label=que.popleft()
for i,c in path[label]:
if dist[i]==-1:
dist[i]=dist[label]+c
que+=[i]
retu... | from sys import stdin
input = stdin.readline
def BFS(K,path,N):
"""リストのリスト道順path,頂点の個数Nが与えられたとき, 頂点Kから各頂点までの距離をlistで返す"""
from collections import deque
dist=[-1]*N
dist[K]=0
que=deque()
que.append(K)
while que:
label=que.popleft()
for i,c in path[label]:
if dist[i]==-1:
... | 26 | 28 | 626 | 710 | def BFS(K, path, N):
"""リストのリスト道順path,頂点の個数Nが与えられたとき, 頂点Kから各頂点までの距離をlistで返す"""
from collections import deque
dist = [-1] * N
dist[K] = 0
que = deque()
que.append(K)
while que:
label = que.popleft()
for i, c in path[label]:
if dist[i] == -1:
dist[i... | from sys import stdin
input = stdin.readline
def BFS(K, path, N):
"""リストのリスト道順path,頂点の個数Nが与えられたとき, 頂点Kから各頂点までの距離をlistで返す"""
from collections import deque
dist = [-1] * N
dist[K] = 0
que = deque()
que.append(K)
while que:
label = que.popleft()
for i, c in path[label]:
... | false | 7.142857 | [
"+from sys import stdin",
"+",
"+input = stdin.readline",
"+",
"+",
"- path[a - 1] += [[b - 1, c]]",
"- path[b - 1] += [[a - 1, c]]",
"+ path[a - 1] += [(b - 1, c)]",
"+ path[b - 1] += [(a - 1, c)]",
"+xy = [list(map(int, input().split())) for i in range(Q)]",
"- x, y = list(map(i... | false | 0.03942 | 0.048628 | 0.810628 | [
"s386928811",
"s288167938"
] |
u633068244 | p01136 | python | s876561421 | s930807130 | 450 | 390 | 4,340 | 4,340 | Accepted | Accepted | 13.33 | while 1:
N = int(input())
if N == 0: break
free = [list(map(int,input().split()))[1:] for i in range(N)]
have = [set([i]) for i in range(N)]
for day in range(1,31):
gather = set([])
for i in range(N):
if day in free[i]:
gather |= have[i]
... | while 1:
N = int(input())
if N == 0: break
free = [list(map(int,input().split()))[1:] for i in range(N)]
have = [set([i]) for i in range(N)]
for day in range(1,31):
gather = set([])
come = [i for i in range(N) if day in free[i]]
for i in come:
gather |= h... | 19 | 18 | 525 | 500 | while 1:
N = int(input())
if N == 0:
break
free = [list(map(int, input().split()))[1:] for i in range(N)]
have = [set([i]) for i in range(N)]
for day in range(1, 31):
gather = set([])
for i in range(N):
if day in free[i]:
gather |= have[i]
... | while 1:
N = int(input())
if N == 0:
break
free = [list(map(int, input().split()))[1:] for i in range(N)]
have = [set([i]) for i in range(N)]
for day in range(1, 31):
gather = set([])
come = [i for i in range(N) if day in free[i]]
for i in come:
gather |= ... | false | 5.263158 | [
"- for i in range(N):",
"- if day in free[i]:",
"- gather |= have[i]",
"+ come = [i for i in range(N) if day in free[i]]",
"+ for i in come:",
"+ gather |= have[i]",
"- for i in range(N):",
"- if day in free[i]:",
"- ... | false | 0.034734 | 0.032228 | 1.07777 | [
"s876561421",
"s930807130"
] |
u363421241 | p02659 | python | s800978101 | s634865412 | 27 | 23 | 10,072 | 9,164 | Accepted | Accepted | 14.81 | from decimal import Decimal
a, b = input().split()
a = Decimal(a)
b = Decimal(b)
print((int(a*b))) | a, b = input().split()
a = int(a)
b = int(b.replace('.',''))
print((a*b//100)) | 5 | 4 | 100 | 79 | from decimal import Decimal
a, b = input().split()
a = Decimal(a)
b = Decimal(b)
print((int(a * b)))
| a, b = input().split()
a = int(a)
b = int(b.replace(".", ""))
print((a * b // 100))
| false | 20 | [
"-from decimal import Decimal",
"-",
"-a = Decimal(a)",
"-b = Decimal(b)",
"-print((int(a * b)))",
"+a = int(a)",
"+b = int(b.replace(\".\", \"\"))",
"+print((a * b // 100))"
] | false | 0.051798 | 0.050187 | 1.032106 | [
"s800978101",
"s634865412"
] |
u326775883 | p02848 | python | s831331450 | s171455707 | 24 | 22 | 3,188 | 3,060 | Accepted | Accepted | 8.33 | n = int(eval(input()))
s = list(eval(input()))
list = []
for i in range(len(s)):
eng = ord(s[i]) + n
if eng > 90:
eng = eng - 26
eng2 = chr(eng)
list += eng2
l = ''.join(list)
print(l) | n = int(eval(input()))
s = eval(input())
list = []
for i in range(len(s)):
asc = ord(s[i])+n
if asc > 90:
asc = asc-26
list.append(chr(asc))
print((''.join(list))) | 13 | 12 | 198 | 177 | n = int(eval(input()))
s = list(eval(input()))
list = []
for i in range(len(s)):
eng = ord(s[i]) + n
if eng > 90:
eng = eng - 26
eng2 = chr(eng)
list += eng2
l = "".join(list)
print(l)
| n = int(eval(input()))
s = eval(input())
list = []
for i in range(len(s)):
asc = ord(s[i]) + n
if asc > 90:
asc = asc - 26
list.append(chr(asc))
print(("".join(list)))
| false | 7.692308 | [
"-s = list(eval(input()))",
"+s = eval(input())",
"- eng = ord(s[i]) + n",
"- if eng > 90:",
"- eng = eng - 26",
"- eng2 = chr(eng)",
"- list += eng2",
"-l = \"\".join(list)",
"-print(l)",
"+ asc = ord(s[i]) + n",
"+ if asc > 90:",
"+ asc = asc - 26",
"+ li... | false | 0.038672 | 0.039544 | 0.977947 | [
"s831331450",
"s171455707"
] |
u311379832 | p03031 | python | s149809992 | s333678766 | 37 | 29 | 3,064 | 3,064 | Accepted | Accepted | 21.62 | N, M = list(map(int, input().split()))
ks = [list(map(int, input().split())) for _ in range(M)]
p = list(map(int, input().split()))
blst = []
cnt = 0
for i in range(2 ** N):
slst = []
for j in range(N):
if i >> j & 1:
slst.append(j)
blst.append(slst)
for i in blst:
ansF... |
def dfs(cnt):
global ans
if cnt == N:
onF = True
for i in range(M):
tmp = 0
for j in range(ks[i][0]):
if bit[ks[i][j + 1] - 1] == 1:
tmp += 1
if tmp % 2 != p[i]:
onF = False
break... | 28 | 28 | 621 | 620 | N, M = list(map(int, input().split()))
ks = [list(map(int, input().split())) for _ in range(M)]
p = list(map(int, input().split()))
blst = []
cnt = 0
for i in range(2**N):
slst = []
for j in range(N):
if i >> j & 1:
slst.append(j)
blst.append(slst)
for i in blst:
ansF = False
for... | def dfs(cnt):
global ans
if cnt == N:
onF = True
for i in range(M):
tmp = 0
for j in range(ks[i][0]):
if bit[ks[i][j + 1] - 1] == 1:
tmp += 1
if tmp % 2 != p[i]:
onF = False
break
if o... | false | 0 | [
"+def dfs(cnt):",
"+ global ans",
"+ if cnt == N:",
"+ onF = True",
"+ for i in range(M):",
"+ tmp = 0",
"+ for j in range(ks[i][0]):",
"+ if bit[ks[i][j + 1] - 1] == 1:",
"+ tmp += 1",
"+ if tmp % 2 != p[i]:",
... | false | 0.051465 | 0.008199 | 6.27676 | [
"s149809992",
"s333678766"
] |
u532966492 | p04001 | python | s684961479 | s151947972 | 38 | 21 | 3,572 | 3,188 | Accepted | Accepted | 44.74 | from copy import deepcopy
N=list(eval(input()))
lenn=len(N)-1
cnt=0
for i in range(2**lenn):
n=deepcopy(N)
b=(("0"*lenn)+bin(i)[2:])[-lenn:]
for i in range(lenn-1,-1,-1):
if b[i]=="1":
n.insert(i+1,"+")
cnt+=eval("".join(n))
print(cnt) | a=eval(input())
l=len(a)
ans=0
for i in range(2**(l-1)):
i=("0"*l+bin(i)[2:])[-l+1:]
cnt=a[0]
for j in range(l-1):
if i[j]=="0":
cnt+=a[j+1]
else:
ans+=int(cnt)
if j<l-1:
cnt=a[j+1]
else:
cnt=""
... | 12 | 19 | 276 | 364 | from copy import deepcopy
N = list(eval(input()))
lenn = len(N) - 1
cnt = 0
for i in range(2**lenn):
n = deepcopy(N)
b = (("0" * lenn) + bin(i)[2:])[-lenn:]
for i in range(lenn - 1, -1, -1):
if b[i] == "1":
n.insert(i + 1, "+")
cnt += eval("".join(n))
print(cnt)
| a = eval(input())
l = len(a)
ans = 0
for i in range(2 ** (l - 1)):
i = ("0" * l + bin(i)[2:])[-l + 1 :]
cnt = a[0]
for j in range(l - 1):
if i[j] == "0":
cnt += a[j + 1]
else:
ans += int(cnt)
if j < l - 1:
cnt = a[j + 1]
else:
... | false | 36.842105 | [
"-from copy import deepcopy",
"-",
"-N = list(eval(input()))",
"-lenn = len(N) - 1",
"-cnt = 0",
"-for i in range(2**lenn):",
"- n = deepcopy(N)",
"- b = ((\"0\" * lenn) + bin(i)[2:])[-lenn:]",
"- for i in range(lenn - 1, -1, -1):",
"- if b[i] == \"1\":",
"- n.insert(i... | false | 0.047075 | 0.040706 | 1.156459 | [
"s684961479",
"s151947972"
] |
u353797797 | p02901 | python | s086089239 | s908879134 | 1,245 | 858 | 3,188 | 3,572 | Accepted | Accepted | 31.08 | import sys
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
def main():
inf = 10 ** 9
n, m = list(map(int, input().split()))
dp = [inf] * (1 << n)
dp[0] = 0
for _ in range(m):
a, b = list(map(int, input().split()))
cc = list(map(int, input().split()))
... | from itertools import permutations
import sys
sys.setrecursionlimit(10 ** 6)
from bisect import *
from collections import *
from heapq import *
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
de... | 30 | 44 | 700 | 1,150 | import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
def main():
inf = 10**9
n, m = list(map(int, input().split()))
dp = [inf] * (1 << n)
dp[0] = 0
for _ in range(m):
a, b = list(map(int, input().split()))
cc = list(map(int, input().split()))
mask = 0
... | from itertools import permutations
import sys
sys.setrecursionlimit(10**6)
from bisect import *
from collections import *
from heapq import *
def II():
return int(sys.stdin.readline())
def MI():
return map(int, sys.stdin.readline().split())
def LI():
return list(map(int, sys.stdin.readline().split())... | false | 31.818182 | [
"+from itertools import permutations",
"-input = sys.stdin.readline",
"+from bisect import *",
"+from collections import *",
"+from heapq import *",
"+",
"+",
"+def II():",
"+ return int(sys.stdin.readline())",
"+",
"+",
"+def MI():",
"+ return map(int, sys.stdin.readline().split())",
... | false | 0.071019 | 0.036971 | 1.920953 | [
"s086089239",
"s908879134"
] |
u628262476 | p03611 | python | s663476804 | s726735441 | 320 | 83 | 22,396 | 11,476 | Accepted | Accepted | 74.06 | import numpy as np;c=[0]*10**5;eval(input())
for i in map(int,input().split()):
c[i]+=1
print((max([sum(c[i:i+3]) for i in range(10**5)]))) | c=[0]*10**5;eval(input())
for i in map(int,input().split()):
c[i]+=1
print((max([sum(c[i:i+3]) for i in range(10**5)]))) | 4 | 4 | 138 | 119 | import numpy as np
c = [0] * 10**5
eval(input())
for i in map(int, input().split()):
c[i] += 1
print((max([sum(c[i : i + 3]) for i in range(10**5)])))
| c = [0] * 10**5
eval(input())
for i in map(int, input().split()):
c[i] += 1
print((max([sum(c[i : i + 3]) for i in range(10**5)])))
| false | 0 | [
"-import numpy as np",
"-"
] | false | 0.283494 | 0.078855 | 3.595136 | [
"s663476804",
"s726735441"
] |
u888092736 | p03617 | python | s191440843 | s848969083 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | Q, H, S, D = list(map(int, input().split()))
Q *= 4
H *= 2
N = int(eval(input()))
print((N // 2 * min(Q * 2, H * 2, S * 2, D) + N % 2 * min(Q, H, S)))
| Q, H, S, D = list(map(int, input().split()))
N = int(eval(input()))
Q *= 4
H *= 2
S = min(Q, H, S)
print((N // 2 * min(2 * S, D) + N % 2 * S)) | 5 | 6 | 141 | 133 | Q, H, S, D = list(map(int, input().split()))
Q *= 4
H *= 2
N = int(eval(input()))
print((N // 2 * min(Q * 2, H * 2, S * 2, D) + N % 2 * min(Q, H, S)))
| Q, H, S, D = list(map(int, input().split()))
N = int(eval(input()))
Q *= 4
H *= 2
S = min(Q, H, S)
print((N // 2 * min(2 * S, D) + N % 2 * S))
| false | 16.666667 | [
"+N = int(eval(input()))",
"-N = int(eval(input()))",
"-print((N // 2 * min(Q * 2, H * 2, S * 2, D) + N % 2 * min(Q, H, S)))",
"+S = min(Q, H, S)",
"+print((N // 2 * min(2 * S, D) + N % 2 * S))"
] | false | 0.037277 | 0.035879 | 1.038966 | [
"s191440843",
"s848969083"
] |
u118211443 | p02717 | python | s216748998 | s699517109 | 170 | 30 | 38,256 | 9,136 | Accepted | Accepted | 82.35 | a, b, c = list(map(int, input().split()))
print((c, a, b))
| x, y, z = list(map(int, input().split()))
print((z, x, y))
| 2 | 2 | 52 | 52 | a, b, c = list(map(int, input().split()))
print((c, a, b))
| x, y, z = list(map(int, input().split()))
print((z, x, y))
| false | 0 | [
"-a, b, c = list(map(int, input().split()))",
"-print((c, a, b))",
"+x, y, z = list(map(int, input().split()))",
"+print((z, x, y))"
] | false | 0.036529 | 0.078316 | 0.466425 | [
"s216748998",
"s699517109"
] |
u029000441 | p02773 | python | s157195803 | s565145283 | 473 | 361 | 32,988 | 142,356 | Accepted | Accepted | 23.68 | from sys import stdin
n=int(stdin.readline().rstrip())
#print(n)
dic={}
for i in range(n):
s=stdin.readline().rstrip()
if s in list(dic.keys()):
dic[s] +=1
else:
dic[s]=1
#print(dic)
#print(dic.keys())
sup=0
suc=[]
for (i,number) in list(dic.items()):
if number>sup:
... | # coding: utf-8
# hello worldと表示する
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_l... | 23 | 39 | 445 | 1,075 | from sys import stdin
n = int(stdin.readline().rstrip())
# print(n)
dic = {}
for i in range(n):
s = stdin.readline().rstrip()
if s in list(dic.keys()):
dic[s] += 1
else:
dic[s] = 1
# print(dic)
# print(dic.keys())
sup = 0
suc = []
for (i, number) in list(dic.items()):
if number > sup:
... | # coding: utf-8
# hello worldと表示する
# float型を許すな
# numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left, bi... | false | 41.025641 | [
"-from sys import stdin",
"+# coding: utf-8",
"+# hello worldと表示する",
"+# float型を許すな",
"+# numpyはpythonで",
"+import sys",
"-n = int(stdin.readline().rstrip())",
"-# print(n)",
"-dic = {}",
"-for i in range(n):",
"- s = stdin.readline().rstrip()",
"- if s in list(dic.keys()):",
"- ... | false | 0.04567 | 0.035502 | 1.286388 | [
"s157195803",
"s565145283"
] |
u580920947 | p03545 | python | s160951500 | s483963875 | 183 | 169 | 38,384 | 38,608 | Accepted | Accepted | 7.65 | #/usr/bin/env python
def main():
s = eval(input())
op_cnt = len(s) -1
for i in range(1<<op_cnt):
op = ["-"] * op_cnt
for j in range(op_cnt):
if ((i >> j) & 1):
op[op_cnt -1 -j] = "+"
formula = ""
for p_n, p_o in zip(s, op+[""]):
... | #!/usr/bin/env python
def main():
S = eval(input())
for i in range(1 << 3):
operator = ["-", "-", "-"]
for j in range(3):
if ((i >> j) & 1):
operator[j] = "+"
formula = ""
for s, op in zip(S, operator + [""]):
formula += s + ... | 20 | 19 | 472 | 445 | # /usr/bin/env python
def main():
s = eval(input())
op_cnt = len(s) - 1
for i in range(1 << op_cnt):
op = ["-"] * op_cnt
for j in range(op_cnt):
if (i >> j) & 1:
op[op_cnt - 1 - j] = "+"
formula = ""
for p_n, p_o in zip(s, op + [""]):
f... | #!/usr/bin/env python
def main():
S = eval(input())
for i in range(1 << 3):
operator = ["-", "-", "-"]
for j in range(3):
if (i >> j) & 1:
operator[j] = "+"
formula = ""
for s, op in zip(S, operator + [""]):
formula += s + op
if eva... | false | 5 | [
"-# /usr/bin/env python",
"+#!/usr/bin/env python",
"- s = eval(input())",
"- op_cnt = len(s) - 1",
"- for i in range(1 << op_cnt):",
"- op = [\"-\"] * op_cnt",
"- for j in range(op_cnt):",
"+ S = eval(input())",
"+ for i in range(1 << 3):",
"+ operator = [\"-\"... | false | 0.039205 | 0.037245 | 1.052628 | [
"s160951500",
"s483963875"
] |
u883048396 | p03965 | python | s099186073 | s535839733 | 50 | 39 | 3,316 | 3,188 | Accepted | Accepted | 22 | s = input().rstrip()
iG = 0
iP = 0
iR = 0
for i in range(len(s)):
if s[i] == "g":
if iP < iG:
iR += 1
iP += 1
else:
iG += 1
elif s[i] == "p":
if iP < iG:
iP += 1
else:
iR -= 1
iG += 1
pri... | #len(s)//2-s.count("p")
iG = 0
iP = 0
iR = 0
for s in input().rstrip():
if s == "g":
if iP < iG:
iR += 1
iP += 1
else:
iG += 1
else:
if iP < iG:
iP += 1
else:
iR -= 1
iG += 1
print(iR)
| 20 | 20 | 327 | 318 | s = input().rstrip()
iG = 0
iP = 0
iR = 0
for i in range(len(s)):
if s[i] == "g":
if iP < iG:
iR += 1
iP += 1
else:
iG += 1
elif s[i] == "p":
if iP < iG:
iP += 1
else:
iR -= 1
iG += 1
print(iR)
| # len(s)//2-s.count("p")
iG = 0
iP = 0
iR = 0
for s in input().rstrip():
if s == "g":
if iP < iG:
iR += 1
iP += 1
else:
iG += 1
else:
if iP < iG:
iP += 1
else:
iR -= 1
iG += 1
print(iR)
| false | 0 | [
"-s = input().rstrip()",
"+# len(s)//2-s.count(\"p\")",
"-for i in range(len(s)):",
"- if s[i] == \"g\":",
"+for s in input().rstrip():",
"+ if s == \"g\":",
"- elif s[i] == \"p\":",
"+ else:"
] | false | 0.077687 | 0.043084 | 1.803156 | [
"s099186073",
"s535839733"
] |
u191874006 | p02684 | python | s937883939 | s782979441 | 121 | 107 | 90,104 | 90,056 | Accepted | Accepted | 11.57 | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | 42 | 45 | 987 | 1,051 | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | false | 6.666667 | [
"-check = [-1] * n",
"-cntr = 0",
"-tmp = 0",
"+check_num = [-1] * n",
"+idx = 0",
"+cnt = 1",
"- if check[tmp] != -1:",
"+ idx = a[idx] - 1",
"+ if check_num[idx] != -1:",
"+ s = check_num[idx] - 1",
"- check[tmp] = cntr",
"- cntr += 1",
"- tmp = a[tmp] - 1",
"-c ... | false | 0.037013 | 0.03658 | 1.011814 | [
"s937883939",
"s782979441"
] |
u790710233 | p03775 | python | s994679721 | s858256082 | 50 | 29 | 3,060 | 3,060 | Accepted | Accepted | 42 | n = int(eval(input()))
ans = 11
for i in range(1, int(-(-n**.5//1))+1):
x, r = divmod(n, i)
if r == 0:
ans = min(ans, max([len(str(x)) for x in (i, x)]))
print(ans) | n = int(eval(input()))
INF = 10**18
ans = INF
def F(a, b):
return max(len(str(a)), len(str(b)))
for i in range(1, int(n**.5)+1):
if n % i == 0:
x = F(i, n//i)
if x < ans:
ans = x
print(ans) | 7 | 15 | 185 | 237 | n = int(eval(input()))
ans = 11
for i in range(1, int(-(-(n**0.5) // 1)) + 1):
x, r = divmod(n, i)
if r == 0:
ans = min(ans, max([len(str(x)) for x in (i, x)]))
print(ans)
| n = int(eval(input()))
INF = 10**18
ans = INF
def F(a, b):
return max(len(str(a)), len(str(b)))
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
x = F(i, n // i)
if x < ans:
ans = x
print(ans)
| false | 53.333333 | [
"-ans = 11",
"-for i in range(1, int(-(-(n**0.5) // 1)) + 1):",
"- x, r = divmod(n, i)",
"- if r == 0:",
"- ans = min(ans, max([len(str(x)) for x in (i, x)]))",
"+INF = 10**18",
"+ans = INF",
"+",
"+",
"+def F(a, b):",
"+ return max(len(str(a)), len(str(b)))",
"+",
"+",
"+f... | false | 0.044229 | 0.050672 | 0.872844 | [
"s994679721",
"s858256082"
] |
u408071652 | p03212 | python | s179743837 | s497781194 | 168 | 48 | 70,436 | 13,492 | Accepted | Accepted | 71.43 | import sys
import math
import itertools
# \n
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(eval(input()))
A = int(math.log10(N))
flag=0
count =0
for a in range(3,A+2):
for i in itertools.product([3,5,7],repeat=a):
digit=0
... | import sys
import math
import itertools
# \n
def input():
return sys.stdin.readline().rstrip()
def main():
list = [[3, 5, 7]]
N=int(eval(input()))
for i in range(9):
new = []
for j in list[-1]:
a = 10 * j
new.append(a + 3)
new.app... | 34 | 40 | 614 | 682 | import sys
import math
import itertools
# \n
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(eval(input()))
A = int(math.log10(N))
flag = 0
count = 0
for a in range(3, A + 2):
for i in itertools.product([3, 5, 7], repeat=a):
digit = 0
if 3... | import sys
import math
import itertools
# \n
def input():
return sys.stdin.readline().rstrip()
def main():
list = [[3, 5, 7]]
N = int(eval(input()))
for i in range(9):
new = []
for j in list[-1]:
a = 10 * j
new.append(a + 3)
new.append(a + 5)
... | false | 15 | [
"+ list = [[3, 5, 7]]",
"- A = int(math.log10(N))",
"- flag = 0",
"+ for i in range(9):",
"+ new = []",
"+ for j in list[-1]:",
"+ a = 10 * j",
"+ new.append(a + 3)",
"+ new.append(a + 5)",
"+ new.append(a + 7)",
"+ lis... | false | 0.087239 | 0.062439 | 1.397192 | [
"s179743837",
"s497781194"
] |
u388927326 | p03295 | python | s601188143 | s426170210 | 432 | 335 | 57,184 | 37,320 | Accepted | Accepted | 22.45 | #!/usr/bin/env python3
import sys
from collections import defaultdict
def main():
n, m = list(map(int, input().split()))
a = []
b = []
atoi = defaultdict(list)
btoi = defaultdict(list)
for i in range(m):
aa, bb = list(map(int, sys.stdin.readline().split()))
a.appen... | #!/usr/bin/env python3
import sys
def main():
n, m = list(map(int, input().split()))
a = []
b = []
atoi = [[] for i in range(n)]
btoi = [[] for i in range(n)]
for i in range(m):
aa, bb = list(map(int, sys.stdin.readline().split()))
a.append(aa - 1)
b.append... | 36 | 35 | 884 | 857 | #!/usr/bin/env python3
import sys
from collections import defaultdict
def main():
n, m = list(map(int, input().split()))
a = []
b = []
atoi = defaultdict(list)
btoi = defaultdict(list)
for i in range(m):
aa, bb = list(map(int, sys.stdin.readline().split()))
a.append(aa - 1)
... | #!/usr/bin/env python3
import sys
def main():
n, m = list(map(int, input().split()))
a = []
b = []
atoi = [[] for i in range(n)]
btoi = [[] for i in range(n)]
for i in range(m):
aa, bb = list(map(int, sys.stdin.readline().split()))
a.append(aa - 1)
b.append(bb - 1)
... | false | 2.777778 | [
"-from collections import defaultdict",
"- atoi = defaultdict(list)",
"- btoi = defaultdict(list)",
"+ atoi = [[] for i in range(n)]",
"+ btoi = [[] for i in range(n)]"
] | false | 0.041593 | 0.041228 | 1.008851 | [
"s601188143",
"s426170210"
] |
u350997995 | p03145 | python | s160082300 | s149473626 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | a = list(map(int,input().split()))
a.sort()
print((int(a[0]*a[1]/2))) | l = list(map(int,input().split()))
l.sort()
print((int(l[0]*l[1]/2))) | 3 | 3 | 69 | 69 | a = list(map(int, input().split()))
a.sort()
print((int(a[0] * a[1] / 2)))
| l = list(map(int, input().split()))
l.sort()
print((int(l[0] * l[1] / 2)))
| false | 0 | [
"-a = list(map(int, input().split()))",
"-a.sort()",
"-print((int(a[0] * a[1] / 2)))",
"+l = list(map(int, input().split()))",
"+l.sort()",
"+print((int(l[0] * l[1] / 2)))"
] | false | 0.11156 | 0.104503 | 1.06753 | [
"s160082300",
"s149473626"
] |
u687574784 | p02629 | python | s518189613 | s040320914 | 43 | 38 | 9,964 | 9,992 | Accepted | Accepted | 11.63 | n = int(eval(input()))
#26進数
dim = []
while n>0:
q,r = divmod(n-1, 26)
dim.append(r)
n=q
import string
dic = {i:l for i,l in enumerate(string.ascii_lowercase)}
print((''.join([dic[d] for d in reversed(dim)])))
| import string
n = int(eval(input()))
#26進数
ans = []
while n>0:
q,r = divmod(n-1, 26)
ans.append(r)
n=q
print((''.join([string.ascii_lowercase[bit] for bit in reversed(ans)])))
| 14 | 11 | 234 | 192 | n = int(eval(input()))
# 26進数
dim = []
while n > 0:
q, r = divmod(n - 1, 26)
dim.append(r)
n = q
import string
dic = {i: l for i, l in enumerate(string.ascii_lowercase)}
print(("".join([dic[d] for d in reversed(dim)])))
| import string
n = int(eval(input()))
# 26進数
ans = []
while n > 0:
q, r = divmod(n - 1, 26)
ans.append(r)
n = q
print(("".join([string.ascii_lowercase[bit] for bit in reversed(ans)])))
| false | 21.428571 | [
"+import string",
"+",
"-dim = []",
"+ans = []",
"- dim.append(r)",
"+ ans.append(r)",
"-import string",
"-",
"-dic = {i: l for i, l in enumerate(string.ascii_lowercase)}",
"-print((\"\".join([dic[d] for d in reversed(dim)])))",
"+print((\"\".join([string.ascii_lowercase[bit] for bit in re... | false | 0.044468 | 0.05991 | 0.742241 | [
"s518189613",
"s040320914"
] |
u400765446 | p02257 | python | s626415655 | s770768538 | 210 | 60 | 5,676 | 6,312 | Accepted | Accepted | 71.43 | def main():
n = int(eval(input()))
count = 0
for _ in range(n):
x = int(eval(input()))
count += isprime(x)
print(count)
def isprime(x: int):
if x == 2:
return True
if x % 2 == 0:
return False
for y in range(3, int(x**0.5)+1, 2):
if x % y... | def main():
A = set()
n_prime = 0
while True:
try:
x = int(eval(input()))
A.add(x)
except:
break
for x in A:
n_prime += is_prime(x)
print(n_prime)
def is_prime(x):
if x == 2:
return 1
elif x % 2 == 0... | 21 | 25 | 402 | 396 | def main():
n = int(eval(input()))
count = 0
for _ in range(n):
x = int(eval(input()))
count += isprime(x)
print(count)
def isprime(x: int):
if x == 2:
return True
if x % 2 == 0:
return False
for y in range(3, int(x**0.5) + 1, 2):
if x % y == 0:
... | def main():
A = set()
n_prime = 0
while True:
try:
x = int(eval(input()))
A.add(x)
except:
break
for x in A:
n_prime += is_prime(x)
print(n_prime)
def is_prime(x):
if x == 2:
return 1
elif x % 2 == 0:
return 0
... | false | 16 | [
"- n = int(eval(input()))",
"- count = 0",
"- for _ in range(n):",
"- x = int(eval(input()))",
"- count += isprime(x)",
"- print(count)",
"+ A = set()",
"+ n_prime = 0",
"+ while True:",
"+ try:",
"+ x = int(eval(input()))",
"+ A.... | false | 0.044611 | 0.03666 | 1.216893 | [
"s626415655",
"s770768538"
] |
u308684517 | p03147 | python | s116859392 | s952140024 | 70 | 19 | 3,060 | 3,064 | Accepted | Accepted | 72.86 | n = int(eval(input()))
H = list(map(int, input().split()))
T = [0 for _ in range(n)]
c = 0
while True:
f = False
S = {0:1}
for j in range(n):
if H[j] > 0:
S[1] = 1
H[j] -= 1
f = True
elif len(S) > 1 and H[j] == 0:
break
if f: c += 1
if H == T: break
print(c)
| n = int(eval(input()))
H = [0] + list(map(int, input().split())) + [0]
T = [0 for _ in range(n+2)]
c = 0
while True:
s0 = 0; t1 = 0
for i in range(0, n+2):
if H[i] > 0 and s0 == 1:
H[i] -= 1
t1 = 1
elif H[i] == 0 and t1 == 1:
c += 1
t1 = 0
elif H[i] == 0:
s0 = 1
if H == T: break
... | 17 | 17 | 311 | 322 | n = int(eval(input()))
H = list(map(int, input().split()))
T = [0 for _ in range(n)]
c = 0
while True:
f = False
S = {0: 1}
for j in range(n):
if H[j] > 0:
S[1] = 1
H[j] -= 1
f = True
elif len(S) > 1 and H[j] == 0:
break
if f:
c += ... | n = int(eval(input()))
H = [0] + list(map(int, input().split())) + [0]
T = [0 for _ in range(n + 2)]
c = 0
while True:
s0 = 0
t1 = 0
for i in range(0, n + 2):
if H[i] > 0 and s0 == 1:
H[i] -= 1
t1 = 1
elif H[i] == 0 and t1 == 1:
c += 1
t1 = 0
... | false | 0 | [
"-H = list(map(int, input().split()))",
"-T = [0 for _ in range(n)]",
"+H = [0] + list(map(int, input().split())) + [0]",
"+T = [0 for _ in range(n + 2)]",
"- f = False",
"- S = {0: 1}",
"- for j in range(n):",
"- if H[j] > 0:",
"- S[1] = 1",
"- H[j] -= 1",
... | false | 0.03768 | 0.042138 | 0.894218 | [
"s116859392",
"s952140024"
] |
u094999522 | p02844 | python | s858718808 | s089529335 | 130 | 84 | 72,304 | 9,864 | Accepted | Accepted | 35.38 | #!/usr/bin/env python3
n = int(eval(input()))
s = eval(input())
c = 0
for i in range(10):
i = str(i)
for j in range(10):
j = str(j)
for k in range(10):
k = str(k)
if i in s:
t = s[s.index(i)+1:]
if j in t:
... | #!/usr/bin/env python3
n = int(eval(input()))
s = eval(input())
s = [int(i) for i in s]
c = 0
for i in range(10):
for j in range(10):
if i in s:
t = s[s.index(i) + 1:]
if j in t:
c += len(set(t[t.index(j) + 1:]))
print(c)
| 19 | 12 | 404 | 273 | #!/usr/bin/env python3
n = int(eval(input()))
s = eval(input())
c = 0
for i in range(10):
i = str(i)
for j in range(10):
j = str(j)
for k in range(10):
k = str(k)
if i in s:
t = s[s.index(i) + 1 :]
if j in t:
u = t[t.ind... | #!/usr/bin/env python3
n = int(eval(input()))
s = eval(input())
s = [int(i) for i in s]
c = 0
for i in range(10):
for j in range(10):
if i in s:
t = s[s.index(i) + 1 :]
if j in t:
c += len(set(t[t.index(j) + 1 :]))
print(c)
| false | 36.842105 | [
"+s = [int(i) for i in s]",
"- i = str(i)",
"- j = str(j)",
"- for k in range(10):",
"- k = str(k)",
"- if i in s:",
"- t = s[s.index(i) + 1 :]",
"- if j in t:",
"- u = t[t.index(j) + 1 :]",
"- ... | false | 0.042607 | 0.042028 | 1.013769 | [
"s858718808",
"s089529335"
] |
u729133443 | p02665 | python | s551813899 | s443901482 | 104 | 94 | 20,160 | 20,128 | Accepted | Accepted | 9.62 | *a,=list(map(int,[*open(0)][1].split()))
c=[s:=0]
for i in a[:0:-1]:c+=c[-1]+i,
b=1
for a in a:
if b<a:
s=-1
break
s+=b
b=min(c.pop(),(b-a)*2)
print(s) | *a,=list(map(int,[*open(s:=0)][1].split()))
c=sum(a)
b=1
for a in a:
if b<a:
s=-1
break
s+=b
c-=a
b=min(c,(b-a)*2)
print(s) | 11 | 11 | 169 | 143 | (*a,) = list(map(int, [*open(0)][1].split()))
c = [s := 0]
for i in a[:0:-1]:
c += (c[-1] + i,)
b = 1
for a in a:
if b < a:
s = -1
break
s += b
b = min(c.pop(), (b - a) * 2)
print(s)
| (*a,) = list(map(int, [*open(s := 0)][1].split()))
c = sum(a)
b = 1
for a in a:
if b < a:
s = -1
break
s += b
c -= a
b = min(c, (b - a) * 2)
print(s)
| false | 0 | [
"-(*a,) = list(map(int, [*open(0)][1].split()))",
"-c = [s := 0]",
"-for i in a[:0:-1]:",
"- c += (c[-1] + i,)",
"+(*a,) = list(map(int, [*open(s := 0)][1].split()))",
"+c = sum(a)",
"- b = min(c.pop(), (b - a) * 2)",
"+ c -= a",
"+ b = min(c, (b - a) * 2)"
] | false | 0.058758 | 0.173019 | 0.339606 | [
"s551813899",
"s443901482"
] |
u380524497 | p02862 | python | s789232911 | s938847824 | 1,327 | 121 | 124,232 | 3,064 | Accepted | Accepted | 90.88 | def cmb(n, r, mod):
if r < 0 or r > n:
return 0
r = min(r, n - r)
return g1[n] * g2[r] * g2[n - r] % mod
mod = 10 ** 9 + 7 # 出力の制限
N = 10 ** 6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] # 逆元テーブル
inverse = [0, 1] # 逆元テーブル計算用テーブル
for i in range( 2, N + 1 ):
g1.append( ( g1[-1] * i ) % mo... | def nCr(n,r,mod = 10**9+7):
r = min(n-r,r)
numer = denom = 1
for i in range(1,r+1):
numer = numer * (n+1-i) %mod
denom = denom * i % mod
return numer * pow(denom,mod-2,mod) %mod
x, y = list(map(int, input().split()))
if (x+y) % 3 != 0:
print((0))
exit()
count... | 32 | 26 | 610 | 425 | def cmb(n, r, mod):
if r < 0 or r > n:
return 0
r = min(r, n - r)
return g1[n] * g2[r] * g2[n - r] % mod
mod = 10**9 + 7 # 出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] # 逆元テーブル
inverse = [0, 1] # 逆元テーブル計算用テーブル
for i in range(2, N + 1):
g1.append((g1[-1] * i) % mod)
inverse.append((-... | def nCr(n, r, mod=10**9 + 7):
r = min(n - r, r)
numer = denom = 1
for i in range(1, r + 1):
numer = numer * (n + 1 - i) % mod
denom = denom * i % mod
return numer * pow(denom, mod - 2, mod) % mod
x, y = list(map(int, input().split()))
if (x + y) % 3 != 0:
print((0))
exit()
coun... | false | 18.75 | [
"-def cmb(n, r, mod):",
"- if r < 0 or r > n:",
"- return 0",
"- r = min(r, n - r)",
"- return g1[n] * g2[r] * g2[n - r] % mod",
"+def nCr(n, r, mod=10**9 + 7):",
"+ r = min(n - r, r)",
"+ numer = denom = 1",
"+ for i in range(1, r + 1):",
"+ numer = numer * (n + 1 ... | false | 1.336053 | 0.049715 | 26.873998 | [
"s789232911",
"s938847824"
] |
u844789719 | p03569 | python | s251416212 | s894990129 | 315 | 65 | 3,316 | 3,316 | Accepted | Accepted | 79.37 | s = eval(input())
ans = 0
while s:
if s[0] == s[-1]:
s = s[1:-1]
elif s[0] == 'x':
s = s[1:]
ans += 1
elif s[-1] == 'x':
s = s[:-1]
ans += 1
else:
ans = -1
break
print(ans)
# https://img.atcoder.jp/code-festival-2017-qualc/editorial.... | s = eval(input())
ans = 0
lb = 0
rb = len(s) - 1
while rb - lb > 0:
if s[lb] == s[rb]:
lb += 1
rb -= 1
elif s[lb] == 'x':
lb += 1
ans += 1
elif s[rb] == 'x':
rb -= 1
ans += 1
else:
ans = -1
break
print(ans)
# https://img.a... | 16 | 19 | 318 | 363 | s = eval(input())
ans = 0
while s:
if s[0] == s[-1]:
s = s[1:-1]
elif s[0] == "x":
s = s[1:]
ans += 1
elif s[-1] == "x":
s = s[:-1]
ans += 1
else:
ans = -1
break
print(ans)
# https://img.atcoder.jp/code-festival-2017-qualc/editorial.pdf
| s = eval(input())
ans = 0
lb = 0
rb = len(s) - 1
while rb - lb > 0:
if s[lb] == s[rb]:
lb += 1
rb -= 1
elif s[lb] == "x":
lb += 1
ans += 1
elif s[rb] == "x":
rb -= 1
ans += 1
else:
ans = -1
break
print(ans)
# https://img.atcoder.jp/code-fes... | false | 15.789474 | [
"-while s:",
"- if s[0] == s[-1]:",
"- s = s[1:-1]",
"- elif s[0] == \"x\":",
"- s = s[1:]",
"+lb = 0",
"+rb = len(s) - 1",
"+while rb - lb > 0:",
"+ if s[lb] == s[rb]:",
"+ lb += 1",
"+ rb -= 1",
"+ elif s[lb] == \"x\":",
"+ lb += 1",
"- e... | false | 0.037612 | 0.06611 | 0.568923 | [
"s251416212",
"s894990129"
] |
u994988729 | p03061 | python | s234976323 | s124657849 | 420 | 220 | 14,332 | 14,052 | Accepted | Accepted | 47.62 | def gcd(x, y):
x, y = max(x, y), min(x, y)
if y == 0:
return x
return gcd(y, x % y)
n = int(eval(input()))
a = list(map(int, input().split()))
l = [0]*n
r = [0] * n
for i in range(n):
if i == 0:
l[i] = a[i]
continue
l[i] = gcd(a[i], l[i-1])
for i in rang... | N = int(eval(input()))
A = list(map(int, input().split()))
def gcd(x, y):
if y == 0:
return x
return gcd(y, x % y)
fromLeft = [0]
fromRight = [0]
for i, a in enumerate(A):
if i == 0:
fromLeft.append(a)
continue
fromLeft.append(gcd(a, fromLeft[-1]))
for i, a... | 31 | 35 | 536 | 662 | def gcd(x, y):
x, y = max(x, y), min(x, y)
if y == 0:
return x
return gcd(y, x % y)
n = int(eval(input()))
a = list(map(int, input().split()))
l = [0] * n
r = [0] * n
for i in range(n):
if i == 0:
l[i] = a[i]
continue
l[i] = gcd(a[i], l[i - 1])
for i in range(n - 1, -1, -1)... | N = int(eval(input()))
A = list(map(int, input().split()))
def gcd(x, y):
if y == 0:
return x
return gcd(y, x % y)
fromLeft = [0]
fromRight = [0]
for i, a in enumerate(A):
if i == 0:
fromLeft.append(a)
continue
fromLeft.append(gcd(a, fromLeft[-1]))
for i, a in enumerate(A[::-... | false | 11.428571 | [
"+N = int(eval(input()))",
"+A = list(map(int, input().split()))",
"+",
"+",
"- x, y = max(x, y), min(x, y)",
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-l = [0] * n",
"-r = [0] * n",
"-for i in range(n):",
"+fromLeft = [0]",
"+fromRight = [0]",
"+for i, a in enum... | false | 0.072321 | 0.047734 | 1.515089 | [
"s234976323",
"s124657849"
] |
u761320129 | p02732 | python | s011727820 | s469930105 | 320 | 207 | 30,716 | 33,352 | Accepted | Accepted | 35.31 | N = int(input())
A = list(map(int,input().split()))
from collections import Counter
ctr = Counter(A)
al = 0
for v in ctr.values():
al += v*(v-1)//2
ans = []
for a in A:
ans.append(al - ctr[a] + 1)
print(*ans, sep='\n')
| N = int(input())
A = list(map(int,input().split()))
from collections import Counter
ctr = Counter(A)
full = sum(v*(v-1)//2 for v in ctr.values())
ans = []
for a in A:
ans.append(full - ctr[a] + 1)
print(*ans, sep='\n')
| 12 | 10 | 238 | 232 | N = int(input())
A = list(map(int, input().split()))
from collections import Counter
ctr = Counter(A)
al = 0
for v in ctr.values():
al += v * (v - 1) // 2
ans = []
for a in A:
ans.append(al - ctr[a] + 1)
print(*ans, sep="\n")
| N = int(input())
A = list(map(int, input().split()))
from collections import Counter
ctr = Counter(A)
full = sum(v * (v - 1) // 2 for v in ctr.values())
ans = []
for a in A:
ans.append(full - ctr[a] + 1)
print(*ans, sep="\n")
| false | 16.666667 | [
"-al = 0",
"-for v in ctr.values():",
"- al += v * (v - 1) // 2",
"+full = sum(v * (v - 1) // 2 for v in ctr.values())",
"- ans.append(al - ctr[a] + 1)",
"+ ans.append(full - ctr[a] + 1)"
] | false | 0.036586 | 0.036954 | 0.990031 | [
"s011727820",
"s469930105"
] |
u729133443 | p03074 | python | s532479642 | s164738150 | 88 | 49 | 9,388 | 8,720 | Accepted | Accepted | 44.32 | n,k=list(map(int,input().split()))
*s,=eval(input())
g=[]
t=1
for i in range(1,n):
if s[i]==s[i-1]:t+=1
else:g.append(t);t=1
g.append(t)
for i in range(1,len(g)):g[i]+=g[i-1]
g=[0]+g+[g[-1]]
print((max(g[i]-g[max(0,i-2*k-1)]for i in range(s[0]=='1',len(g),2)))) | t,s=open(0)
n,k=list(map(int,t.split()))
l=2*k+1
x=[0]*(2+int(s[0]))+[i+1for i in range(n-1)if s[i]!=s[i+1]]+[n]*l
print((max(x[i+l]-x[i]for i in range(0,len(x)-l,2)))) | 11 | 5 | 259 | 164 | n, k = list(map(int, input().split()))
(*s,) = eval(input())
g = []
t = 1
for i in range(1, n):
if s[i] == s[i - 1]:
t += 1
else:
g.append(t)
t = 1
g.append(t)
for i in range(1, len(g)):
g[i] += g[i - 1]
g = [0] + g + [g[-1]]
print((max(g[i] - g[max(0, i - 2 * k - 1)] for i in range(... | t, s = open(0)
n, k = list(map(int, t.split()))
l = 2 * k + 1
x = [0] * (2 + int(s[0])) + [i + 1 for i in range(n - 1) if s[i] != s[i + 1]] + [n] * l
print((max(x[i + l] - x[i] for i in range(0, len(x) - l, 2))))
| false | 54.545455 | [
"-n, k = list(map(int, input().split()))",
"-(*s,) = eval(input())",
"-g = []",
"-t = 1",
"-for i in range(1, n):",
"- if s[i] == s[i - 1]:",
"- t += 1",
"- else:",
"- g.append(t)",
"- t = 1",
"-g.append(t)",
"-for i in range(1, len(g)):",
"- g[i] += g[i - 1]",
... | false | 0.041018 | 0.040819 | 1.004895 | [
"s532479642",
"s164738150"
] |
u625963200 | p03503 | python | s946338100 | s958102747 | 278 | 75 | 3,064 | 3,064 | Accepted | Accepted | 73.02 | N=int(eval(input()))
F=[list(map(int,input().split())) for _ in range(N)]
P=[list(map(int,input().split())) for _ in range(N)]
ans=-10**18
for i in range(1,2**10):
tmp=0
for j in range(N):
cnt=0
for k in range(10):
if i&(1<<k) and F[j][k]:
cnt+=1
tmp+=P[j][cnt]
ans=max(ans,... | import sys
input=sys.stdin.readline
N=int(eval(input()))
F=[int(input().replace(' ',''),2) for _ in range(N)]
P=[list(map(int,input().split())) for _ in range(N)]
ans=-10**18
for i in range(1,2**10):
cnt=0
for j in range(N):
cnt+=P[j][bin(F[j] & i).count('1')]
ans=max(ans,cnt)
print(ans) | 15 | 13 | 330 | 305 | N = int(eval(input()))
F = [list(map(int, input().split())) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(N)]
ans = -(10**18)
for i in range(1, 2**10):
tmp = 0
for j in range(N):
cnt = 0
for k in range(10):
if i & (1 << k) and F[j][k]:
cnt += ... | import sys
input = sys.stdin.readline
N = int(eval(input()))
F = [int(input().replace(" ", ""), 2) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(N)]
ans = -(10**18)
for i in range(1, 2**10):
cnt = 0
for j in range(N):
cnt += P[j][bin(F[j] & i).count("1")]
ans = max(ans, cnt... | false | 13.333333 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"-F = [list(map(int, input().split())) for _ in range(N)]",
"+F = [int(input().replace(\" \", \"\"), 2) for _ in range(N)]",
"- tmp = 0",
"+ cnt = 0",
"- cnt = 0",
"- for k in range(10):",
"- if i & (1 << k) and F[j]... | false | 0.043161 | 0.118496 | 0.364238 | [
"s946338100",
"s958102747"
] |
u608088992 | p02802 | python | s873924229 | s567496893 | 289 | 205 | 4,724 | 4,784 | Accepted | Accepted | 29.07 | N, M = list(map(int, input().split()))
pen = [0] * N
AC = [False] * N
for _ in range(M):
p, s = input().split()
if s == "AC": AC[int(p) - 1] = True
else:
if AC[int(p) - 1] == False : pen[int(p) - 1] += 1
ACcount = AC.count(True)
Pcount = 0
for i in range(N):
if AC[i]: Pcount += pen[i]... | import sys
def solve():
input = sys.stdin.readline
N, M = list(map(int, input().split()))
penalty = [0] * N
accepted = [False for _ in range(N)]
totalPenalty = 0
totalAccepted = 0
for _ in range(M):
p, s = list(map(str, input().strip("\n").split()))
if s == "WA" ... | 13 | 23 | 338 | 652 | N, M = list(map(int, input().split()))
pen = [0] * N
AC = [False] * N
for _ in range(M):
p, s = input().split()
if s == "AC":
AC[int(p) - 1] = True
else:
if AC[int(p) - 1] == False:
pen[int(p) - 1] += 1
ACcount = AC.count(True)
Pcount = 0
for i in range(N):
if AC[i]:
... | import sys
def solve():
input = sys.stdin.readline
N, M = list(map(int, input().split()))
penalty = [0] * N
accepted = [False for _ in range(N)]
totalPenalty = 0
totalAccepted = 0
for _ in range(M):
p, s = list(map(str, input().strip("\n").split()))
if s == "WA" and not acc... | false | 43.478261 | [
"-N, M = list(map(int, input().split()))",
"-pen = [0] * N",
"-AC = [False] * N",
"-for _ in range(M):",
"- p, s = input().split()",
"- if s == \"AC\":",
"- AC[int(p) - 1] = True",
"- else:",
"- if AC[int(p) - 1] == False:",
"- pen[int(p) - 1] += 1",
"-ACcount =... | false | 0.0458 | 0.080018 | 0.572364 | [
"s873924229",
"s567496893"
] |
u072717685 | p03544 | python | s156081685 | s982513571 | 161 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.44 | def return_Lucas(num1, num2):
return num1 + num2
n = int(eval(input()))
n1 = 2
n2 = 1
if n == 0:
print(n1)
elif n == 1:
print(n2)
else:
for i in range(2, n+1):
n1, n2 = n2, return_Lucas(n1,n2)
if i == n:
print(n2)
| n = int(eval(input()))
n1 = 2
n2 = 1
if n == 0:
print(n1)
elif n == 1:
print(n2)
else:
for i in range(2, n+1):
n1, n2 = n2, n1+n2
if i == n:
print(n2)
| 17 | 14 | 256 | 188 | def return_Lucas(num1, num2):
return num1 + num2
n = int(eval(input()))
n1 = 2
n2 = 1
if n == 0:
print(n1)
elif n == 1:
print(n2)
else:
for i in range(2, n + 1):
n1, n2 = n2, return_Lucas(n1, n2)
if i == n:
print(n2)
| n = int(eval(input()))
n1 = 2
n2 = 1
if n == 0:
print(n1)
elif n == 1:
print(n2)
else:
for i in range(2, n + 1):
n1, n2 = n2, n1 + n2
if i == n:
print(n2)
| false | 17.647059 | [
"-def return_Lucas(num1, num2):",
"- return num1 + num2",
"-",
"-",
"- n1, n2 = n2, return_Lucas(n1, n2)",
"+ n1, n2 = n2, n1 + n2"
] | false | 0.086409 | 0.035335 | 2.445421 | [
"s156081685",
"s982513571"
] |
u186838327 | p03163 | python | s172266934 | s362338523 | 286 | 263 | 92,056 | 148,312 | Accepted | Accepted | 8.04 | import numpy as np
N, W = list(map(int, input().split()))
dp = np.zeros((N+1, W+1), dtype='uint64')
for i in range(N):
w, v = list(map(int, input().split()))
dp[i+1][:w] = dp[i][:w]
dp[i+1][w:] = np.maximum(dp[i][w:], dp[i][:-w]+v)
print((np.max(dp[N, :]))) | n, W = list(map(int, input().split()))
WV = []
for i in range(n):
w, v = list(map(int, input().split()))
WV.append((w, v))
INF = 10**18
dp = [[-INF]*(W+1) for _ in range(n+1)]
dp[0][0] = 0
for i in range(n):
w, v = WV[i]
for j in range(W+1):
dp[i+1][j] = dp[i][j]
for j in ran... | 12 | 18 | 266 | 417 | import numpy as np
N, W = list(map(int, input().split()))
dp = np.zeros((N + 1, W + 1), dtype="uint64")
for i in range(N):
w, v = list(map(int, input().split()))
dp[i + 1][:w] = dp[i][:w]
dp[i + 1][w:] = np.maximum(dp[i][w:], dp[i][:-w] + v)
print((np.max(dp[N, :])))
| n, W = list(map(int, input().split()))
WV = []
for i in range(n):
w, v = list(map(int, input().split()))
WV.append((w, v))
INF = 10**18
dp = [[-INF] * (W + 1) for _ in range(n + 1)]
dp[0][0] = 0
for i in range(n):
w, v = WV[i]
for j in range(W + 1):
dp[i + 1][j] = dp[i][j]
for j in range(W +... | false | 33.333333 | [
"-import numpy as np",
"-",
"-N, W = list(map(int, input().split()))",
"-dp = np.zeros((N + 1, W + 1), dtype=\"uint64\")",
"-for i in range(N):",
"+n, W = list(map(int, input().split()))",
"+WV = []",
"+for i in range(n):",
"- dp[i + 1][:w] = dp[i][:w]",
"- dp[i + 1][w:] = np.maximum(dp[i][w... | false | 0.464824 | 0.04579 | 10.15117 | [
"s172266934",
"s362338523"
] |
u638456847 | p02629 | python | s411464493 | s477300099 | 35 | 28 | 9,144 | 9,176 | Accepted | Accepted | 20 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
N = int(readline())
ans = ''
while N:
if N % 26 == 0:
ans += "z"
N -= 1
N //= 26
else:
ans += chr((N % 26) -1 + 97)... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
N = int(readline())
ans = ''
while N:
N -= 1
ans += chr((N % 26) + 97)
N //= 26
print((ans[::-1]))
if __name__ == "__main__":
main()
| 22 | 18 | 409 | 307 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
N = int(readline())
ans = ""
while N:
if N % 26 == 0:
ans += "z"
N -= 1
N //= 26
else:
ans += chr((N % 26) - 1 + 97)
N //=... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
N = int(readline())
ans = ""
while N:
N -= 1
ans += chr((N % 26) + 97)
N //= 26
print((ans[::-1]))
if __name__ == "__main__":
main()
| false | 18.181818 | [
"- if N % 26 == 0:",
"- ans += \"z\"",
"- N -= 1",
"- N //= 26",
"- else:",
"- ans += chr((N % 26) - 1 + 97)",
"- N //= 26",
"+ N -= 1",
"+ ans += chr((N % 26) + 97)",
"+ N //= 26"
] | false | 0.041016 | 0.096684 | 0.424232 | [
"s411464493",
"s477300099"
] |
u857759499 | p02726 | python | s753607557 | s520442924 | 1,457 | 978 | 3,188 | 3,316 | Accepted | Accepted | 32.88 | n,x,y = list(map(int,input().split()))
a = [0 for _ in range(n-1)]
for i in range(1,n):
for j in range(i+1,n+1):
l = min(j-i,abs(x-i)+1+abs(j-y))
a[l-1] += 1
print(("\n".join(map(str,a)))) | def main():
n,x,y = list(map(int,input().split()))
a = [0 for _ in range(n-1)]
for i in range(1,n):
for j in range(i+1,n+1):
l = min(j-i,abs(x-i)+1+abs(j-y))
a[l-1] += 1
print(("\n".join(map(str,a))))
main() | 7 | 10 | 196 | 233 | n, x, y = list(map(int, input().split()))
a = [0 for _ in range(n - 1)]
for i in range(1, n):
for j in range(i + 1, n + 1):
l = min(j - i, abs(x - i) + 1 + abs(j - y))
a[l - 1] += 1
print(("\n".join(map(str, a))))
| def main():
n, x, y = list(map(int, input().split()))
a = [0 for _ in range(n - 1)]
for i in range(1, n):
for j in range(i + 1, n + 1):
l = min(j - i, abs(x - i) + 1 + abs(j - y))
a[l - 1] += 1
print(("\n".join(map(str, a))))
main()
| false | 30 | [
"-n, x, y = list(map(int, input().split()))",
"-a = [0 for _ in range(n - 1)]",
"-for i in range(1, n):",
"- for j in range(i + 1, n + 1):",
"- l = min(j - i, abs(x - i) + 1 + abs(j - y))",
"- a[l - 1] += 1",
"-print((\"\\n\".join(map(str, a))))",
"+def main():",
"+ n, x, y = lis... | false | 0.04545 | 0.041946 | 1.083533 | [
"s753607557",
"s520442924"
] |
u094191970 | p02689 | python | s398102377 | s374372066 | 438 | 246 | 26,116 | 22,972 | Accepted | Accepted | 43.84 | n,m=list(map(int,input().split()))
h=list(map(int,input().split()))
tree=[[0] for i in range(n)]
for i in range(m):
a,b=list(map(int,input().split()))
tree[a-1].append(h[b-1])
tree[b-1].append(h[a-1])
cnt=0
for i in range(n):
if h[i]>max(tree[i]):
cnt+=1
print(cnt) | from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
lnii=lambda:list(map(int,stdin.readline().split()))
n,m=nii()
h=lnii()
tree=[[] for i in range(n)]
for i in range(m):
a,b=nii()
a-=1
b-=1
tree[a].append(h[b])
tree[b].append(h[a])
ans=0
for i in range(n):
if tree[i]... | 15 | 24 | 282 | 392 | n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
tree = [[0] for i in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
tree[a - 1].append(h[b - 1])
tree[b - 1].append(h[a - 1])
cnt = 0
for i in range(n):
if h[i] > max(tree[i]):
cnt += 1
print(cnt)
| from sys import stdin
nii = lambda: list(map(int, stdin.readline().split()))
lnii = lambda: list(map(int, stdin.readline().split()))
n, m = nii()
h = lnii()
tree = [[] for i in range(n)]
for i in range(m):
a, b = nii()
a -= 1
b -= 1
tree[a].append(h[b])
tree[b].append(h[a])
ans = 0
for i in range(n... | false | 37.5 | [
"-n, m = list(map(int, input().split()))",
"-h = list(map(int, input().split()))",
"-tree = [[0] for i in range(n)]",
"+from sys import stdin",
"+",
"+nii = lambda: list(map(int, stdin.readline().split()))",
"+lnii = lambda: list(map(int, stdin.readline().split()))",
"+n, m = nii()",
"+h = lnii()",
... | false | 0.075798 | 0.055905 | 1.355847 | [
"s398102377",
"s374372066"
] |
u222668979 | p03330 | python | s959649494 | s118689775 | 187 | 147 | 77,384 | 76,648 | Accepted | Accepted | 21.39 | from collections import defaultdict
from itertools import permutations
n, c = list(map(int, input().split()))
d = [list(map(int, input().split())) for _ in range(c)]
cmat = [list(map(int, input().split())) for _ in range(n)]
dcnt = [defaultdict(int) for _ in range(3)]
for i, ci in enumerate(cmat):
for j,... | from itertools import permutations
n, c = list(map(int, input().split()))
d = [list(map(int, input().split())) for _ in range(c)]
cmat = [list(map(int, input().split())) for _ in range(n)]
dcnt = [[0] * c for _ in range(3)]
for i, ci in enumerate(cmat):
for j, cij in enumerate(ci):
mod = (i + j) ... | 20 | 19 | 597 | 556 | from collections import defaultdict
from itertools import permutations
n, c = list(map(int, input().split()))
d = [list(map(int, input().split())) for _ in range(c)]
cmat = [list(map(int, input().split())) for _ in range(n)]
dcnt = [defaultdict(int) for _ in range(3)]
for i, ci in enumerate(cmat):
for j, cij in en... | from itertools import permutations
n, c = list(map(int, input().split()))
d = [list(map(int, input().split())) for _ in range(c)]
cmat = [list(map(int, input().split())) for _ in range(n)]
dcnt = [[0] * c for _ in range(3)]
for i, ci in enumerate(cmat):
for j, cij in enumerate(ci):
mod = (i + j) % 3
... | false | 5 | [
"-from collections import defaultdict",
"-dcnt = [defaultdict(int) for _ in range(3)]",
"+dcnt = [[0] * c for _ in range(3)]",
"- tmp += sum(d[k][tgt] * cnt[k] for k in cnt)",
"+ tmp += sum(d[i][tgt] * cnt[i] for i in range(c))"
] | false | 0.035511 | 0.036621 | 0.969694 | [
"s959649494",
"s118689775"
] |
u729133443 | p03777 | python | s102947415 | s474202016 | 170 | 18 | 38,256 | 2,940 | Accepted | Accepted | 89.41 | a,b=input().split();print(('DH'[a==b])) | print(('HD'[len(set(eval(input())))-2])) | 1 | 1 | 37 | 32 | a, b = input().split()
print(("DH"[a == b]))
| print(("HD"[len(set(eval(input()))) - 2]))
| false | 0 | [
"-a, b = input().split()",
"-print((\"DH\"[a == b]))",
"+print((\"HD\"[len(set(eval(input()))) - 2]))"
] | false | 0.040489 | 0.041851 | 0.967455 | [
"s102947415",
"s474202016"
] |
u606045429 | p02850 | python | s749982356 | s997186209 | 547 | 203 | 55,068 | 25,900 | Accepted | Accepted | 62.89 | from collections import deque
N, *AB = list(map(int, open(0).read().split()))
E = [[] for _ in range(N + 1)]
memo = {}
for i, (a, b) in enumerate(zip(*[iter(AB)] * 2)):
E[a].append(b)
E[b].append(a)
memo[(a, b)] = i
memo[(b, a)] = i
K = max(len(e) for e in E)
A = [0] * (N - 1)
can... | from collections import deque
def main():
N, *AB = list(map(int, open(0).read().split()))
E = [[] for _ in range(N + 1)]
I = []
for a, b in zip(*[iter(AB)] * 2):
E[a].append(b)
I.append(b)
Q = deque([1])
C = [0] * (N + 1)
while Q:
v = Q.popleft()
... | 37 | 26 | 684 | 502 | from collections import deque
N, *AB = list(map(int, open(0).read().split()))
E = [[] for _ in range(N + 1)]
memo = {}
for i, (a, b) in enumerate(zip(*[iter(AB)] * 2)):
E[a].append(b)
E[b].append(a)
memo[(a, b)] = i
memo[(b, a)] = i
K = max(len(e) for e in E)
A = [0] * (N - 1)
cand = {i for i in range(... | from collections import deque
def main():
N, *AB = list(map(int, open(0).read().split()))
E = [[] for _ in range(N + 1)]
I = []
for a, b in zip(*[iter(AB)] * 2):
E[a].append(b)
I.append(b)
Q = deque([1])
C = [0] * (N + 1)
while Q:
v = Q.popleft()
c = 0
... | false | 29.72973 | [
"-N, *AB = list(map(int, open(0).read().split()))",
"-E = [[] for _ in range(N + 1)]",
"-memo = {}",
"-for i, (a, b) in enumerate(zip(*[iter(AB)] * 2)):",
"- E[a].append(b)",
"- E[b].append(a)",
"- memo[(a, b)] = i",
"- memo[(b, a)] = i",
"-K = max(len(e) for e in E)",
"-A = [0] * (N -... | false | 0.041331 | 0.04145 | 0.997126 | [
"s749982356",
"s997186209"
] |
u970449052 | p03807 | python | s326093729 | s861950717 | 60 | 43 | 14,108 | 11,104 | Accepted | Accepted | 28.33 | n=int(eval(input()))
al=list(map(int,input().split()))
c=0
for a in al:
c+=1 if a%2==1 else 0
print(('YES' if c%2==0 else 'NO')) | eval(input())
print(('YES' if sum(map(int,input().split()))%2==0 else 'NO')) | 6 | 2 | 129 | 69 | n = int(eval(input()))
al = list(map(int, input().split()))
c = 0
for a in al:
c += 1 if a % 2 == 1 else 0
print(("YES" if c % 2 == 0 else "NO"))
| eval(input())
print(("YES" if sum(map(int, input().split())) % 2 == 0 else "NO"))
| false | 66.666667 | [
"-n = int(eval(input()))",
"-al = list(map(int, input().split()))",
"-c = 0",
"-for a in al:",
"- c += 1 if a % 2 == 1 else 0",
"-print((\"YES\" if c % 2 == 0 else \"NO\"))",
"+eval(input())",
"+print((\"YES\" if sum(map(int, input().split())) % 2 == 0 else \"NO\"))"
] | false | 0.117318 | 0.082285 | 1.425756 | [
"s326093729",
"s861950717"
] |
u185249212 | p03221 | python | s167055009 | s024994748 | 1,976 | 1,582 | 173,144 | 120,792 | Accepted | Accepted | 19.94 |
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... |
from functools import reduce
from operator import mul
from collections import Counter
from collections import deque
from itertools import accumulate
from queue import Queue
from queue import PriorityQueue as pq
from heapq import heapreplace
from heapq import heapify
from heapq import heappushpop
from heap... | 118 | 89 | 2,387 | 1,836 | 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... | from functools import reduce
from operator import mul
from collections import Counter
from collections import deque
from itertools import accumulate
from queue import Queue
from queue import PriorityQueue as pq
from heapq import heapreplace
from heapq import heapify
from heapq import heappushpop
from heapq import heapp... | false | 24.576271 | [
"+from functools import reduce",
"+from operator import mul",
"+from collections import Counter",
"+from collections import deque",
"+from itertools import accumulate",
"+from queue import Queue",
"+from queue import PriorityQueue as pq",
"+from heapq import heapreplace",
"+from heapq import heapify... | false | 0.048679 | 0.04818 | 1.010366 | [
"s167055009",
"s024994748"
] |
u871867619 | p02658 | python | s261996467 | s508761665 | 85 | 50 | 21,464 | 21,504 | Accepted | Accepted | 41.18 | N = int(eval(input()))
A = list(map(int, input().split()))
result = 1
A.sort()
for i in A:
result *= i
if result > 10**18:
result = -1
break
print(result)
| N = int(eval(input()))
A = list(map(int, input().split()))
result = 1
if 0 in A:
result = 0
else:
for i in A:
result *= i
if result > 10**18:
result = -1
break
print(result)
| 12 | 14 | 187 | 232 | N = int(eval(input()))
A = list(map(int, input().split()))
result = 1
A.sort()
for i in A:
result *= i
if result > 10**18:
result = -1
break
print(result)
| N = int(eval(input()))
A = list(map(int, input().split()))
result = 1
if 0 in A:
result = 0
else:
for i in A:
result *= i
if result > 10**18:
result = -1
break
print(result)
| false | 14.285714 | [
"-A.sort()",
"-for i in A:",
"- result *= i",
"- if result > 10**18:",
"- result = -1",
"- break",
"+if 0 in A:",
"+ result = 0",
"+else:",
"+ for i in A:",
"+ result *= i",
"+ if result > 10**18:",
"+ result = -1",
"+ break"
] | false | 0.043191 | 0.03696 | 1.168579 | [
"s261996467",
"s508761665"
] |
u408071652 | p02684 | python | s635605846 | s668640732 | 195 | 98 | 51,056 | 32,336 | Accepted | Accepted | 49.74 | import sys
import numpy as np
from collections import defaultdict
#input = sys.stdin.readline
def main():
N, K = list(map(int,input().split()))
A = list(map(int,input().split()))
A = [0] +A #transporter
visited = [0] * (N+1)
town = 1
cycle = 0
for i in range(1,K+1):
... |
#input = sys.stdin.readline
def main():
N, K = list(map(int,input().split()))
A = list(map(int,input().split()))
A = [0] +A #transporter
visited = [0] * (N+1)
town = 1
cycle = 0
for i in range(1,K+1):
town = A[town]
if visited[town] ==0:
visited[... | 31 | 27 | 639 | 568 | import sys
import numpy as np
from collections import defaultdict
# input = sys.stdin.readline
def main():
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A = [0] + A # transporter
visited = [0] * (N + 1)
town = 1
cycle = 0
for i in range(1, K + 1):
town ... | # input = sys.stdin.readline
def main():
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A = [0] + A # transporter
visited = [0] * (N + 1)
town = 1
cycle = 0
for i in range(1, K + 1):
town = A[town]
if visited[town] == 0:
visited[town] ... | false | 12.903226 | [
"-import sys",
"-import numpy as np",
"-from collections import defaultdict",
"-"
] | false | 0.136514 | 0.074888 | 1.822902 | [
"s635605846",
"s668640732"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.