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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u367701763 | p03112 | python | s712591638 | s544376455 | 720 | 275 | 88,544 | 80,356 | Accepted | Accepted | 61.81 | def near(x, X):
i = bisect_left(X, x)
if i == 0: return [X[i]-x]
elif i == len(X): return [X[i-1]-x]
else: return [X[i]-x, X[i-1]-x]
from bisect import *
from itertools import product
A, B, Q = list(map(int, input().split()))
S, T = [], []
for _ in range(A):
S.append(int(eval(input())))
f... | def near(x, X):
i = bisect_left(X, x)
if i == 0: return [X[i]-x]
elif i == len(X): return [X[i-1]-x]
else: return [X[i]-x, X[i-1]-x]
import sys
input = sys.stdin.readline
from bisect import *
from itertools import product
A, B, Q = list(map(int, input().split()))
S, T = [], []
for _ in range(... | 19 | 21 | 538 | 578 | def near(x, X):
i = bisect_left(X, x)
if i == 0:
return [X[i] - x]
elif i == len(X):
return [X[i - 1] - x]
else:
return [X[i] - x, X[i - 1] - x]
from bisect import *
from itertools import product
A, B, Q = list(map(int, input().split()))
S, T = [], []
for _ in range(A):
S.... | def near(x, X):
i = bisect_left(X, x)
if i == 0:
return [X[i] - x]
elif i == len(X):
return [X[i - 1] - x]
else:
return [X[i] - x, X[i - 1] - x]
import sys
input = sys.stdin.readline
from bisect import *
from itertools import product
A, B, Q = list(map(int, input().split()))
... | false | 9.52381 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.038832 | 0.036901 | 1.05232 | [
"s712591638",
"s544376455"
] |
u014333473 | p03370 | python | s292422401 | s487414326 | 357 | 17 | 3,060 | 2,940 | Accepted | Accepted | 95.24 | N, X = list(map(int, input().split()))
m = [int(eval(input())) for _ in range(N)]
result = len(m)
X -= sum(m)
while X >= min(m):
result += 1
X -= min(m)
print(result) | N, X = list(map(int, input().split()))
m = [int(eval(input())) for _ in range(N)]
print((len(m)+(X-sum(m))//min(m))) | 8 | 3 | 165 | 104 | N, X = list(map(int, input().split()))
m = [int(eval(input())) for _ in range(N)]
result = len(m)
X -= sum(m)
while X >= min(m):
result += 1
X -= min(m)
print(result)
| N, X = list(map(int, input().split()))
m = [int(eval(input())) for _ in range(N)]
print((len(m) + (X - sum(m)) // min(m)))
| false | 62.5 | [
"-result = len(m)",
"-X -= sum(m)",
"-while X >= min(m):",
"- result += 1",
"- X -= min(m)",
"-print(result)",
"+print((len(m) + (X - sum(m)) // min(m)))"
] | false | 0.106057 | 0.035994 | 2.946521 | [
"s292422401",
"s487414326"
] |
u016881126 | p03030 | python | s713943920 | s466111632 | 33 | 25 | 9,340 | 9,136 | Accepted | Accepted | 24.24 | import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')
N = int(eval(input()))
import collections
d = collections.defaultdict(list)
for i in range(N):
S, P = input().split()
P = int(P)
... | import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')
N = int(eval(input()))
SP = []
for i in range(N):
s,p = input().split()
SP.append((s,-int(p),i+1))
SP.sort()
for s,p,i in SP:
... | 25 | 18 | 538 | 325 | import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10**7)
INF = float("inf")
N = int(eval(input()))
import collections
d = collections.defaultdict(list)
for i in range(N):
S, P = input().split()
P = int(P)
d[S].append((... | import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10**7)
INF = float("inf")
N = int(eval(input()))
SP = []
for i in range(N):
s, p = input().split()
SP.append((s, -int(p), i + 1))
SP.sort()
for s, p, i in SP:
print(i)
| false | 28 | [
"-import collections",
"-",
"-d = collections.defaultdict(list)",
"+SP = []",
"- S, P = input().split()",
"- P = int(P)",
"- d[S].append((i + 1, P))",
"-ordered = list(d.keys())",
"-ordered.sort()",
"-for city in ordered:",
"- mises = d[city]",
"- mises = sorted(mises, key=lambd... | false | 0.069128 | 0.067629 | 1.022163 | [
"s713943920",
"s466111632"
] |
u133936772 | p02936 | python | s010817701 | s593504220 | 1,964 | 1,754 | 55,732 | 268,464 | Accepted | Accepted | 10.69 | f=lambda:list(map(int,input().split()))
n,q=f()
g=[[] for _ in range(n)]
for i in range(n-1):
a,b=f()
g[a-1]+=[b-1]
g[b-1]+=[a-1]
c=[0]*n
for i in range(q): v,x=f(); c[v-1]+=x
b=[1]*n
s=[0]
b[0]=0
while s:
t=s.pop()
for i in g[t]:
if b[i]: c[i]+=c[t]; s+=[i]; b[i]=0
print((*c)) | import sys
sys.setrecursionlimit(10**9)
f=lambda:list(map(int,sys.stdin.readline().split()))
n,q=f()
g=[[] for _ in range(n)]
for i in range(n-1):
a,b=f()
g[a-1]+=[b-1]
g[b-1]+=[a-1]
c=[0]*n
for i in range(q):
v,x=f()
c[v-1]+=x
def dfs(v,p=-1):
for i in g[v]:
if i==p: continue
c[i]+=... | 17 | 20 | 300 | 351 | f = lambda: list(map(int, input().split()))
n, q = f()
g = [[] for _ in range(n)]
for i in range(n - 1):
a, b = f()
g[a - 1] += [b - 1]
g[b - 1] += [a - 1]
c = [0] * n
for i in range(q):
v, x = f()
c[v - 1] += x
b = [1] * n
s = [0]
b[0] = 0
while s:
t = s.pop()
for i in g[t]:
if b[i]... | import sys
sys.setrecursionlimit(10**9)
f = lambda: list(map(int, sys.stdin.readline().split()))
n, q = f()
g = [[] for _ in range(n)]
for i in range(n - 1):
a, b = f()
g[a - 1] += [b - 1]
g[b - 1] += [a - 1]
c = [0] * n
for i in range(q):
v, x = f()
c[v - 1] += x
def dfs(v, p=-1):
for i in g... | false | 15 | [
"-f = lambda: list(map(int, input().split()))",
"+import sys",
"+",
"+sys.setrecursionlimit(10**9)",
"+f = lambda: list(map(int, sys.stdin.readline().split()))",
"-b = [1] * n",
"-s = [0]",
"-b[0] = 0",
"-while s:",
"- t = s.pop()",
"- for i in g[t]:",
"- if b[i]:",
"- ... | false | 0.061606 | 0.07248 | 0.849967 | [
"s010817701",
"s593504220"
] |
u971091945 | p02732 | python | s215762704 | s656821637 | 369 | 319 | 26,780 | 26,780 | Accepted | Accepted | 13.55 | import collections
n = int(eval(input()))
a = list(map(int, input().split()))
c = collections.Counter(a)
li = list(c.values())
ans = 0
for i in li:
ans += i*(i-1)//2
num = 0
for i in range(n):
num = c[a[i]]
if num == 1:
print(ans)
else:
print((ans-(num-1))) | import collections
n = int(eval(input()))
a = list(map(int, input().split()))
c = collections.Counter(a)
ans = 0
for i in list(c.values()):
ans += i * (i - 1) // 2
for i in a:
num = c[i]
print((ans - (num - 1))) | 21 | 13 | 307 | 230 | import collections
n = int(eval(input()))
a = list(map(int, input().split()))
c = collections.Counter(a)
li = list(c.values())
ans = 0
for i in li:
ans += i * (i - 1) // 2
num = 0
for i in range(n):
num = c[a[i]]
if num == 1:
print(ans)
else:
print((ans - (num - 1)))
| import collections
n = int(eval(input()))
a = list(map(int, input().split()))
c = collections.Counter(a)
ans = 0
for i in list(c.values()):
ans += i * (i - 1) // 2
for i in a:
num = c[i]
print((ans - (num - 1)))
| false | 38.095238 | [
"-li = list(c.values())",
"-for i in li:",
"+for i in list(c.values()):",
"-num = 0",
"-for i in range(n):",
"- num = c[a[i]]",
"- if num == 1:",
"- print(ans)",
"- else:",
"- print((ans - (num - 1)))",
"+for i in a:",
"+ num = c[i]",
"+ print((ans - (num - 1)))"... | false | 0.037548 | 0.041059 | 0.914479 | [
"s215762704",
"s656821637"
] |
u677121387 | p02659 | python | s455573185 | s191437176 | 27 | 20 | 9,788 | 9,160 | Accepted | Accepted | 25.93 | from decimal import Decimal
a,b = list(map(Decimal,input().split()))
print(((a*b)//1)) | a,b = input().split()
print((int(a)*int(float(b)*100+0.5)//100)) | 3 | 2 | 80 | 63 | from decimal import Decimal
a, b = list(map(Decimal, input().split()))
print(((a * b) // 1))
| a, b = input().split()
print((int(a) * int(float(b) * 100 + 0.5) // 100))
| false | 33.333333 | [
"-from decimal import Decimal",
"-",
"-a, b = list(map(Decimal, input().split()))",
"-print(((a * b) // 1))",
"+a, b = input().split()",
"+print((int(a) * int(float(b) * 100 + 0.5) // 100))"
] | false | 0.102498 | 0.044386 | 2.309261 | [
"s455573185",
"s191437176"
] |
u823513038 | p02393 | python | s796461601 | s196835133 | 40 | 20 | 7,616 | 5,588 | Accepted | Accepted | 50 | a = list(map(int, input().split()))
print((" ".join(map(str, sorted(a))))) | a = list(map(int, input().split()))
a.sort()
print((a[0], a[1], a[2]))
| 2 | 3 | 73 | 71 | a = list(map(int, input().split()))
print((" ".join(map(str, sorted(a)))))
| a = list(map(int, input().split()))
a.sort()
print((a[0], a[1], a[2]))
| false | 33.333333 | [
"-print((\" \".join(map(str, sorted(a)))))",
"+a.sort()",
"+print((a[0], a[1], a[2]))"
] | false | 0.044107 | 0.157433 | 0.280164 | [
"s796461601",
"s196835133"
] |
u392319141 | p02973 | python | s640574688 | s589874393 | 270 | 112 | 7,068 | 11,108 | Accepted | Accepted | 58.52 | from bisect import bisect_right
N = int(eval(input()))
S = [1]
for _ in range(N):
a = int(eval(input()))
a *= -1
i = bisect_right(S, a)
if i == len(S):
S.append(a)
else:
S[i] = a
print((len(S))) | from bisect import bisect_right
import sys
input = sys.stdin.buffer.readline
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
dp = [10**10] * N
for a in A:
a = -a
dp[bisect_right(dp, a)] = a
ans = N - dp.count(10**10)
print(ans)
| 16 | 15 | 235 | 260 | from bisect import bisect_right
N = int(eval(input()))
S = [1]
for _ in range(N):
a = int(eval(input()))
a *= -1
i = bisect_right(S, a)
if i == len(S):
S.append(a)
else:
S[i] = a
print((len(S)))
| from bisect import bisect_right
import sys
input = sys.stdin.buffer.readline
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
dp = [10**10] * N
for a in A:
a = -a
dp[bisect_right(dp, a)] = a
ans = N - dp.count(10**10)
print(ans)
| false | 6.25 | [
"+import sys",
"+input = sys.stdin.buffer.readline",
"-S = [1]",
"-for _ in range(N):",
"- a = int(eval(input()))",
"- a *= -1",
"- i = bisect_right(S, a)",
"- if i == len(S):",
"- S.append(a)",
"- else:",
"- S[i] = a",
"-print((len(S)))",
"+A = [int(eval(input()... | false | 0.223986 | 0.219667 | 1.01966 | [
"s640574688",
"s589874393"
] |
u546285759 | p00312 | python | s249004109 | s314196585 | 60 | 40 | 7,704 | 7,700 | Accepted | Accepted | 33.33 | D, L = list(map(int, input().split()))
print((sum(divmod(D, L)))) | D, L = list(map(int, input().split()))
print((D//L + D%L)) | 2 | 2 | 58 | 51 | D, L = list(map(int, input().split()))
print((sum(divmod(D, L))))
| D, L = list(map(int, input().split()))
print((D // L + D % L))
| false | 0 | [
"-print((sum(divmod(D, L))))",
"+print((D // L + D % L))"
] | false | 0.039934 | 0.132585 | 0.301193 | [
"s249004109",
"s314196585"
] |
u171366497 | p03680 | python | s556299629 | s519763821 | 214 | 191 | 13,212 | 7,084 | Accepted | Accepted | 10.75 | n=int(eval(input()))
data=[int(eval(input())) for i in range(n)]
x=1
was=set()
now=1
while x==1:
if now==2:
print((len(was)))
break
if now in was:
print('-1')
break
was|={now,}
now=data[now-1]
| N=int(eval(input()))
A=[int(eval(input())) for i in range(N)]
cnt=0
now=1
for i in range(N+1):
if now==2:
break
cnt+=1
now=A[now-1]
if cnt>N:print((-1))
else:print(cnt) | 15 | 11 | 245 | 184 | n = int(eval(input()))
data = [int(eval(input())) for i in range(n)]
x = 1
was = set()
now = 1
while x == 1:
if now == 2:
print((len(was)))
break
if now in was:
print("-1")
break
was |= {
now,
}
now = data[now - 1]
| N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
cnt = 0
now = 1
for i in range(N + 1):
if now == 2:
break
cnt += 1
now = A[now - 1]
if cnt > N:
print((-1))
else:
print(cnt)
| false | 26.666667 | [
"-n = int(eval(input()))",
"-data = [int(eval(input())) for i in range(n)]",
"-x = 1",
"-was = set()",
"+N = int(eval(input()))",
"+A = [int(eval(input())) for i in range(N)]",
"+cnt = 0",
"-while x == 1:",
"+for i in range(N + 1):",
"- print((len(was)))",
"- if now in was:",
"- ... | false | 0.047242 | 0.037543 | 1.258345 | [
"s556299629",
"s519763821"
] |
u222801992 | p03163 | python | s914530253 | s878415934 | 638 | 290 | 171,784 | 42,092 | Accepted | Accepted | 54.55 | N,W=list(map(int,input().split()))
w=[0]*N
v=[0]*N
for i in range(N):
w[i],v[i]=list(map(int,input().split()))
dp=[[0 for i in range(W+1)] for j in range(N+1)]
for i in range(N):
for j in range(W+1):
if j<w[i]:
dp[i+1][j]=dp[i][j]
else:
dp[i+1][j]=max(dp[i][j],... | N,W=list(map(int,input().split()))
w=[0]*N
v=[0]*N
for i in range(N):
w[i],v[i]=list(map(int,input().split()))
dp=[0]*(W+1)
for i in range(N):
j=W
while j>=w[i]:
dp[j]=max(dp[j],dp[j-w[i]]+v[i])
j-=1
print((dp[W])) | 13 | 12 | 345 | 239 | N, W = list(map(int, input().split()))
w = [0] * N
v = [0] * N
for i in range(N):
w[i], v[i] = list(map(int, input().split()))
dp = [[0 for i in range(W + 1)] for j in range(N + 1)]
for i in range(N):
for j in range(W + 1):
if j < w[i]:
dp[i + 1][j] = dp[i][j]
else:
dp[i ... | N, W = list(map(int, input().split()))
w = [0] * N
v = [0] * N
for i in range(N):
w[i], v[i] = list(map(int, input().split()))
dp = [0] * (W + 1)
for i in range(N):
j = W
while j >= w[i]:
dp[j] = max(dp[j], dp[j - w[i]] + v[i])
j -= 1
print((dp[W]))
| false | 7.692308 | [
"-dp = [[0 for i in range(W + 1)] for j in range(N + 1)]",
"+dp = [0] * (W + 1)",
"- for j in range(W + 1):",
"- if j < w[i]:",
"- dp[i + 1][j] = dp[i][j]",
"- else:",
"- dp[i + 1][j] = max(dp[i][j], dp[i][j - w[i]] + v[i])",
"-print((dp[N][W]))",
"+ j = W",... | false | 0.008664 | 0.031788 | 0.27254 | [
"s914530253",
"s878415934"
] |
u926657458 | p02268 | python | s674226430 | s441196654 | 370 | 250 | 16,360 | 16,712 | Accepted | Accepted | 32.43 | import sys
def binsearch(x, s):
l = 0
r = len(s)
while (l < r):
m = int((l + r) / 2)
if s[m] == x:
return True
else:
if s[m] < x:
l = m + 1
else:
r = m
return False
ns = sys.stdin.readline()... | n = int(eval(input()))
S = list(map(int,input().split()))
q = int(eval(input()))
T = list(map(int,input().split()))
def search(a, X):
l = 0
r = len(X)
while l < r:
m = (l + r ) // 2
if a == X[m]:
return m
elif a > X[m]:
l = m + 1
elif a < X[m]:
r = m
return ... | 28 | 29 | 530 | 402 | import sys
def binsearch(x, s):
l = 0
r = len(s)
while l < r:
m = int((l + r) / 2)
if s[m] == x:
return True
else:
if s[m] < x:
l = m + 1
else:
r = m
return False
ns = sys.stdin.readline()
s = [int(i) for i i... | n = int(eval(input()))
S = list(map(int, input().split()))
q = int(eval(input()))
T = list(map(int, input().split()))
def search(a, X):
l = 0
r = len(X)
while l < r:
m = (l + r) // 2
if a == X[m]:
return m
elif a > X[m]:
l = m + 1
elif a < X[m]:
... | false | 3.448276 | [
"-import sys",
"+n = int(eval(input()))",
"+S = list(map(int, input().split()))",
"+q = int(eval(input()))",
"+T = list(map(int, input().split()))",
"-def binsearch(x, s):",
"+def search(a, X):",
"- r = len(s)",
"+ r = len(X)",
"- m = int((l + r) / 2)",
"- if s[m] == x:",
"... | false | 0.147165 | 0.074987 | 1.962538 | [
"s674226430",
"s441196654"
] |
u029000441 | p03944 | python | s889302592 | s233721933 | 169 | 77 | 38,384 | 65,872 | Accepted | Accepted | 54.44 | 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,bisect_right
from heapq import heapify, heappop, heappush
fr... | # 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... | 34 | 42 | 1,046 | 1,136 | 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, bisect_right
from heapq import heapify, heappop, heappush
from mat... | # 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 | 19.047619 | [
"+# coding: utf-8",
"+# hello worldと表示する",
"+# float型を許すな",
"+# numpyはpythonで",
"-from math import floor, ceil",
"+from math import floor, ceil, pi, factorial, sqrt",
"+def SI():",
"+ return input().rstrip()",
"+",
"+",
"-# s=input().rstrip()",
"-rect = [0, w, 0, h]",
"+xmx = w",
"+ymx ... | false | 0.046525 | 0.10789 | 0.431229 | [
"s889302592",
"s233721933"
] |
u340781749 | p02651 | python | s694992830 | s820383939 | 685 | 95 | 73,452 | 9,180 | Accepted | Accepted | 86.13 | from itertools import groupby, chain
from operator import itemgetter
def sweep(l):
result = []
s = set(l)
while s:
a = max(s)
b = 1 << (a.bit_length() - 1)
s = {t ^ a if t >= b else t for t in s}
s.discard(0)
result.append([a, b])
return result
... | from bisect import insort
t = int(eval(input()))
buf = []
for _ in range(t):
n = int(eval(input()))
aaa = list(map(int, input().split()))
s = eval(input())
is_ok = 0
can = []
for i in range(n - 1, -1, -1):
a = aaa[i]
if s[i] == '0':
for (b, c) in can... | 55 | 32 | 1,235 | 705 | from itertools import groupby, chain
from operator import itemgetter
def sweep(l):
result = []
s = set(l)
while s:
a = max(s)
b = 1 << (a.bit_length() - 1)
s = {t ^ a if t >= b else t for t in s}
s.discard(0)
result.append([a, b])
return result
t = int(eval(in... | from bisect import insort
t = int(eval(input()))
buf = []
for _ in range(t):
n = int(eval(input()))
aaa = list(map(int, input().split()))
s = eval(input())
is_ok = 0
can = []
for i in range(n - 1, -1, -1):
a = aaa[i]
if s[i] == "0":
for (b, c) in can[::-1]:
... | false | 41.818182 | [
"-from itertools import groupby, chain",
"-from operator import itemgetter",
"-",
"-",
"-def sweep(l):",
"- result = []",
"- s = set(l)",
"- while s:",
"- a = max(s)",
"- b = 1 << (a.bit_length() - 1)",
"- s = {t ^ a if t >= b else t for t in s}",
"- s.disc... | false | 0.03829 | 0.039077 | 0.979876 | [
"s694992830",
"s820383939"
] |
u863370423 | p03073 | python | s725515188 | s547671921 | 92 | 68 | 5,532 | 4,084 | Accepted | Accepted | 26.09 | x=eval(input())
x=[i for i in x]
n=len(x)
y=['1']
a=0
b=0
for i in range(n-1):
if i%2==0:
y.append('0')
else:
y.append('1')
z=['0']
for i in range(n-1):
if i%2==0:
z.append('1')
else:
z.append('0')
for i in range(n):
if x[i]!=y[i]:
a+=1
... | colormap = eval(input(''))
colormaplist = [int(i) for i in colormap]
changecounter = 0
for i in range(len(colormaplist)-1):
if colormaplist[i+1] == colormaplist[i]:
colormaplist[i+1] = 1-colormaplist[i+1]
changecounter+=1
print(changecounter)
| 23 | 11 | 361 | 270 | x = eval(input())
x = [i for i in x]
n = len(x)
y = ["1"]
a = 0
b = 0
for i in range(n - 1):
if i % 2 == 0:
y.append("0")
else:
y.append("1")
z = ["0"]
for i in range(n - 1):
if i % 2 == 0:
z.append("1")
else:
z.append("0")
for i in range(n):
if x[i] != y[i]:
... | colormap = eval(input(""))
colormaplist = [int(i) for i in colormap]
changecounter = 0
for i in range(len(colormaplist) - 1):
if colormaplist[i + 1] == colormaplist[i]:
colormaplist[i + 1] = 1 - colormaplist[i + 1]
changecounter += 1
print(changecounter)
| false | 52.173913 | [
"-x = eval(input())",
"-x = [i for i in x]",
"-n = len(x)",
"-y = [\"1\"]",
"-a = 0",
"-b = 0",
"-for i in range(n - 1):",
"- if i % 2 == 0:",
"- y.append(\"0\")",
"- else:",
"- y.append(\"1\")",
"-z = [\"0\"]",
"-for i in range(n - 1):",
"- if i % 2 == 0:",
"- ... | false | 0.095561 | 0.092268 | 1.03569 | [
"s725515188",
"s547671921"
] |
u477343425 | p03250 | python | s374838799 | s015105741 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | a,b,c = sorted(map(int,input().split()))
ans = 10 * c + b + a
print(ans)
| a, b, c = sorted(map(int, input().split()))
print((10*c + b + a))
| 3 | 3 | 75 | 67 | a, b, c = sorted(map(int, input().split()))
ans = 10 * c + b + a
print(ans)
| a, b, c = sorted(map(int, input().split()))
print((10 * c + b + a))
| false | 0 | [
"-ans = 10 * c + b + a",
"-print(ans)",
"+print((10 * c + b + a))"
] | false | 0.047958 | 0.048806 | 0.982636 | [
"s374838799",
"s015105741"
] |
u707500405 | p04002 | python | s827825810 | s506557064 | 2,132 | 1,761 | 98,084 | 113,816 | Accepted | Accepted | 17.4 | from collections import defaultdict
def gen_bound(x,B):
if x < 3: lb = 2
else: lb = x - 1
if x > B-2: ub = B-1
else: ub = x + 1
return lb,ub+1
def solve():
count = defaultdict(int)
ans = [0]*10
H,W,N = list(map(int,input().split()))
ans[0] = (H-2)*(W-2)
for i in range(N):
a,b = list(map(int,inp... | from collections import defaultdict
from sys import stdin
def gen_bound(x,B):
if x < 3: lb = 2
else: lb = x - 1
if x > B-2: ub = B-1
else: ub = x + 1
return lb,ub+1
def solve():
count = defaultdict(int)
ans = [0]*10
L = [list(map(int,x.split())) for x in stdin.readlines()]
H,W,N = L[0]
ans[0] = (... | 23 | 24 | 573 | 607 | from collections import defaultdict
def gen_bound(x, B):
if x < 3:
lb = 2
else:
lb = x - 1
if x > B - 2:
ub = B - 1
else:
ub = x + 1
return lb, ub + 1
def solve():
count = defaultdict(int)
ans = [0] * 10
H, W, N = list(map(int, input().split()))
an... | from collections import defaultdict
from sys import stdin
def gen_bound(x, B):
if x < 3:
lb = 2
else:
lb = x - 1
if x > B - 2:
ub = B - 1
else:
ub = x + 1
return lb, ub + 1
def solve():
count = defaultdict(int)
ans = [0] * 10
L = [list(map(int, x.split... | false | 4.166667 | [
"+from sys import stdin",
"- H, W, N = list(map(int, input().split()))",
"+ L = [list(map(int, x.split())) for x in stdin.readlines()]",
"+ H, W, N = L[0]",
"- for i in range(N):",
"- a, b = list(map(int, input().split()))",
"- xlb, xub = gen_bound(a, H)",
"- ylb, yub ... | false | 0.042681 | 0.107523 | 0.39695 | [
"s827825810",
"s506557064"
] |
u768896740 | p03338 | python | s276775110 | s182280002 | 20 | 17 | 3,060 | 2,940 | Accepted | Accepted | 15 | n = int(eval(input()))
s = list(eval(input()))
max_num = 0
def check_list_element(list):
a = []
for i in list:
if i not in a:
a.append(i)
return a
for i in range(n):
count = 0
a = s[:i]
b = s[i:]
a = check_list_element(a)
for j in range(len(a)):
... | n = int(eval(input()))
s = list(eval(input()))
max_char = 0
for i in range(1, n):
s1 = set(s[0:i])
s2 = set(s[i:])
num = len(s1 & s2)
if num > max_char:
max_char = num
print(max_char) | 27 | 12 | 428 | 208 | n = int(eval(input()))
s = list(eval(input()))
max_num = 0
def check_list_element(list):
a = []
for i in list:
if i not in a:
a.append(i)
return a
for i in range(n):
count = 0
a = s[:i]
b = s[i:]
a = check_list_element(a)
for j in range(len(a)):
if a[j] in... | n = int(eval(input()))
s = list(eval(input()))
max_char = 0
for i in range(1, n):
s1 = set(s[0:i])
s2 = set(s[i:])
num = len(s1 & s2)
if num > max_char:
max_char = num
print(max_char)
| false | 55.555556 | [
"-max_num = 0",
"-",
"-",
"-def check_list_element(list):",
"- a = []",
"- for i in list:",
"- if i not in a:",
"- a.append(i)",
"- return a",
"-",
"-",
"-for i in range(n):",
"- count = 0",
"- a = s[:i]",
"- b = s[i:]",
"- a = check_list_element(... | false | 0.051057 | 0.071545 | 0.713631 | [
"s276775110",
"s182280002"
] |
u768896740 | p03086 | python | s976839446 | s424486935 | 19 | 17 | 3,060 | 3,060 | Accepted | Accepted | 10.53 | s = list(eval(input()))
max = 0
length = 0
for i in range(len(s)):
if s[i] == 'A' or s[i] == 'T' or s[i] == 'G' or s[i] == 'C':
length += 1
if max < length:
max = length
else:
length = 0
print(max) | s = eval(input())
word_list = ['A', 'T', 'G', 'C']
cnt = 0
max = 0
for i in s:
if i in word_list:
cnt += 1
if cnt > max:
max = cnt
else:
cnt = 0
print(max) | 14 | 16 | 251 | 212 | s = list(eval(input()))
max = 0
length = 0
for i in range(len(s)):
if s[i] == "A" or s[i] == "T" or s[i] == "G" or s[i] == "C":
length += 1
if max < length:
max = length
else:
length = 0
print(max)
| s = eval(input())
word_list = ["A", "T", "G", "C"]
cnt = 0
max = 0
for i in s:
if i in word_list:
cnt += 1
if cnt > max:
max = cnt
else:
cnt = 0
print(max)
| false | 12.5 | [
"-s = list(eval(input()))",
"+s = eval(input())",
"+word_list = [\"A\", \"T\", \"G\", \"C\"]",
"+cnt = 0",
"-length = 0",
"-for i in range(len(s)):",
"- if s[i] == \"A\" or s[i] == \"T\" or s[i] == \"G\" or s[i] == \"C\":",
"- length += 1",
"- if max < length:",
"- max ... | false | 0.048686 | 0.048794 | 0.997776 | [
"s976839446",
"s424486935"
] |
u185249212 | p02690 | python | s319294315 | s319490683 | 201 | 174 | 78,232 | 78,388 | Accepted | Accepted | 13.43 |
import sys
sys.setrecursionlimit(500000)
import re
import array
import copy
import functools
import operator
import math
import string
import fractions
from fractions import Fraction
import collections
import itertools
import bisect
import random
import time
import heapq
from heapq import... |
import sys
sys.setrecursionlimit(500000)
import re
import array
import copy
import functools
import operator
import math
import string
import fractions
from fractions import Fraction
import collections
import itertools
import bisect
import random
import time
import heapq
from heapq import... | 82 | 92 | 1,531 | 1,728 | import sys
sys.setrecursionlimit(500000)
import re
import array
import copy
import functools
import operator
import math
import string
import fractions
from fractions import Fraction
import collections
import itertools
import bisect
import random
import time
import heapq
from heapq import heappush
from heapq import he... | import sys
sys.setrecursionlimit(500000)
import re
import array
import copy
import functools
import operator
import math
import string
import fractions
from fractions import Fraction
import collections
import itertools
import bisect
import random
import time
import heapq
from heapq import heappush
from heapq import he... | false | 10.869565 | [
"+ # inputs",
"+ # a,b > 0",
"- for b in range(-100, 2000):",
"+ for b in range(0, a + 1):",
"+ if a**5 - b**5 == x:",
"+ print(a, b)",
"+ return",
"+ # a >0 and b < 0",
"+ for a in range(0, 100):",
"+ for b in range(-100, 1... | false | 0.085681 | 1.932434 | 0.044338 | [
"s319294315",
"s319490683"
] |
u968166680 | p03557 | python | s333199672 | s542220515 | 425 | 304 | 92,968 | 22,720 | Accepted | Accepted | 28.47 | from sys import stdin
from bisect import bisect_left
def input():
return stdin.readline().strip()
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()... | from sys import stdin
from bisect import bisect_right, bisect_left
def input():
return stdin.readline().strip()
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()... | 39 | 27 | 698 | 484 | from sys import stdin
from bisect import bisect_left
def input():
return stdin.readline().strip()
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
nums = [0] *... | from sys import stdin
from bisect import bisect_right, bisect_left
def input():
return stdin.readline().strip()
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
... | false | 30.769231 | [
"-from bisect import bisect_left",
"+from bisect import bisect_right, bisect_left",
"- nums = [0] * (N + 1)",
"- pos = 0",
"- for i, b in enumerate(B):",
"- pos = bisect_left(C, b + 1, pos)",
"- nums[i] = N - pos",
"- for i in range(N, 0, -1):",
"- nums[i - 1] += num... | false | 0.048857 | 0.049884 | 0.979421 | [
"s333199672",
"s542220515"
] |
u033606236 | p03361 | python | s716227239 | s106640818 | 20 | 18 | 3,064 | 3,064 | Accepted | Accepted | 10 | import sys
height, width = list(map(int, input().split()))
array = [0 for i in range(height)]
for i in range(height):
array[i] = list(eval(input()))
h = [-1, 0,0,1]
w = [ 0,-1,1,0]
for a in range(height):
for b in range(width):
if array[a][b] == "#":
for i in range(4):
... | 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]==".":
flag=1
print(("Yes... | 24 | 10 | 619 | 330 | import sys
height, width = list(map(int, input().split()))
array = [0 for i in range(height)]
for i in range(height):
array[i] = list(eval(input()))
h = [-1, 0, 0, 1]
w = [0, -1, 1, 0]
for a in range(height):
for b in range(width):
if array[a][b] == "#":
for i in range(4):
y... | 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 ... | false | 58.333333 | [
"-import sys",
"-",
"-height, width = list(map(int, input().split()))",
"-array = [0 for i in range(height)]",
"-for i in range(height):",
"- array[i] = list(eval(input()))",
"-h = [-1, 0, 0, 1]",
"-w = [0, -1, 1, 0]",
"-for a in range(height):",
"- for b in range(width):",
"- if ar... | false | 0.065847 | 0.03813 | 1.726923 | [
"s716227239",
"s106640818"
] |
u631277801 | p03450 | python | s615262941 | s741768701 | 1,770 | 1,468 | 40,280 | 40,328 | Accepted | Accepted | 17.06 | class WeightedUnionFind:
def __init__(self, node:int) -> None:
self.n = node
self.par = [i for i in range(self.n)]
self.rank = [0 for i in range(self.n)]
self.diff_weight = [0 for i in range(self.n)]
# ノードxのルートを求める
def find(self, x:int) -> int:
if x ... | from sys import stdin
input = stdin.readline
class WeightedUnionFind:
def __init__(self, node:int) -> None:
self.n = node
self.par = [i for i in range(self.n)]
self.rank = [0 for i in range(self.n)]
self.diff_weight = [0 for i in range(self.n)]
# ノードxのルートを求める
... | 81 | 84 | 2,060 | 2,110 | class WeightedUnionFind:
def __init__(self, node: int) -> None:
self.n = node
self.par = [i for i in range(self.n)]
self.rank = [0 for i in range(self.n)]
self.diff_weight = [0 for i in range(self.n)]
# ノードxのルートを求める
def find(self, x: int) -> int:
if x == self.par[x]:... | from sys import stdin
input = stdin.readline
class WeightedUnionFind:
def __init__(self, node: int) -> None:
self.n = node
self.par = [i for i in range(self.n)]
self.rank = [0 for i in range(self.n)]
self.diff_weight = [0 for i in range(self.n)]
# ノードxのルートを求める
def find(se... | false | 3.571429 | [
"+from sys import stdin",
"+",
"+input = stdin.readline",
"+",
"+"
] | false | 0.041554 | 0.038919 | 1.067715 | [
"s615262941",
"s741768701"
] |
u562935282 | p03806 | python | s697155521 | s302184696 | 519 | 293 | 4,876 | 4,852 | Accepted | Accepted | 43.55 | N, Ma, Mb = list(map(int, input().split()))
e = [tuple(map(int, input().split())) for _ in range(N)]
N_max = 40
a_max = 10
b_max = 10
c_max = 100
inf = N_max * c_max + 1
dp = [[inf] * (N_max * b_max + 1) for _ in range(N_max * a_max + 1)]
dp[0][0] = 0
for i, (aa, bb, cc) in enumerate(e):
for a in re... | inf = float('inf')
N, Ma, Mb = list(map(int, input().split()))
dp = [[inf] * (400 + 1) for _ in range(400 + 1)]
dp[0][0] = 0
max_a = 0
max_b = 0
for i in range(N):
a, b, c = list(map(int, input().split()))
max_a += a
max_b += b
for j in reversed(list(range(max_a + 1 - a))):
for k ... | 27 | 27 | 823 | 607 | N, Ma, Mb = list(map(int, input().split()))
e = [tuple(map(int, input().split())) for _ in range(N)]
N_max = 40
a_max = 10
b_max = 10
c_max = 100
inf = N_max * c_max + 1
dp = [[inf] * (N_max * b_max + 1) for _ in range(N_max * a_max + 1)]
dp[0][0] = 0
for i, (aa, bb, cc) in enumerate(e):
for a in reversed(list(rang... | inf = float("inf")
N, Ma, Mb = list(map(int, input().split()))
dp = [[inf] * (400 + 1) for _ in range(400 + 1)]
dp[0][0] = 0
max_a = 0
max_b = 0
for i in range(N):
a, b, c = list(map(int, input().split()))
max_a += a
max_b += b
for j in reversed(list(range(max_a + 1 - a))):
for k in range(max_b ... | false | 0 | [
"+inf = float(\"inf\")",
"-e = [tuple(map(int, input().split())) for _ in range(N)]",
"-N_max = 40",
"-a_max = 10",
"-b_max = 10",
"-c_max = 100",
"-inf = N_max * c_max + 1",
"-dp = [[inf] * (N_max * b_max + 1) for _ in range(N_max * a_max + 1)]",
"+dp = [[inf] * (400 + 1) for _ in range(400 + 1)]",... | false | 0.106236 | 0.068003 | 1.562231 | [
"s697155521",
"s302184696"
] |
u522140891 | p02792 | python | s757061104 | s152570107 | 70 | 64 | 65,608 | 62,432 | Accepted | Accepted | 8.57 | from collections import defaultdict
from collections import deque
from collections import OrderedDict
import itertools
from sys import stdin
input = stdin.readline
def check(min_, max_, x):
if max_ <= x:
# return 10**max(0, len(str(min_))-2)
return int((max_ - min_)/10) + 1
elif min_ <= x:
... | from sys import stdin
input = stdin.readline
def check(min_, max_, x):
if x < min_:
return 0
else:
return int((min(max_, x) - min_)/10) + 1
def main():
N = int(eval(input()))
if len(str(N)) == 1:
print(N)
return
sum_ = 0
for l in range(1, 10):
for r in range(l, 10... | 58 | 47 | 1,383 | 1,020 | from collections import defaultdict
from collections import deque
from collections import OrderedDict
import itertools
from sys import stdin
input = stdin.readline
def check(min_, max_, x):
if max_ <= x:
# return 10**max(0, len(str(min_))-2)
return int((max_ - min_) / 10) + 1
elif min_ <= x:
... | from sys import stdin
input = stdin.readline
def check(min_, max_, x):
if x < min_:
return 0
else:
return int((min(max_, x) - min_) / 10) + 1
def main():
N = int(eval(input()))
if len(str(N)) == 1:
print(N)
return
sum_ = 0
for l in range(1, 10):
for r... | false | 18.965517 | [
"-from collections import defaultdict",
"-from collections import deque",
"-from collections import OrderedDict",
"-import itertools",
"- if max_ <= x:",
"- # return 10**max(0, len(str(min_))-2)",
"- return int((max_ - min_) / 10) + 1",
"- elif min_ <= x:",
"- # ret = max(... | false | 0.047352 | 0.039511 | 1.198454 | [
"s757061104",
"s152570107"
] |
u899909022 | p02947 | python | s464578257 | s017768050 | 849 | 467 | 19,412 | 19,460 | Accepted | Accepted | 44.99 | N=int(eval(input()))
S = []
for _ in range(N):
tmp = []
for s in eval(input()):
tmp.append(s)
tmp.sort()
S.append("".join(tmp))
dic = {}
for s in S:
if s not in dic:
dic[s] = 0
dic[s] += 1
ans = 0
import math
for v in list(dic.values()):
if v == 1:
co... | N=int(eval(input()))
S = []
for _ in range(N):
tmp = []
for s in eval(input()):
tmp.append(s)
tmp.sort()
S.append("".join(tmp))
dic = {}
for s in S:
if s not in dic:
dic[s] = 0
dic[s] += 1
ans = 0
for v in list(dic.values()):
ans += v * (v - 1) // 2
print((int... | 21 | 17 | 407 | 308 | N = int(eval(input()))
S = []
for _ in range(N):
tmp = []
for s in eval(input()):
tmp.append(s)
tmp.sort()
S.append("".join(tmp))
dic = {}
for s in S:
if s not in dic:
dic[s] = 0
dic[s] += 1
ans = 0
import math
for v in list(dic.values()):
if v == 1:
continue
p =... | N = int(eval(input()))
S = []
for _ in range(N):
tmp = []
for s in eval(input()):
tmp.append(s)
tmp.sort()
S.append("".join(tmp))
dic = {}
for s in S:
if s not in dic:
dic[s] = 0
dic[s] += 1
ans = 0
for v in list(dic.values()):
ans += v * (v - 1) // 2
print((int(ans)))
| false | 19.047619 | [
"-import math",
"-",
"- if v == 1:",
"- continue",
"- p = math.factorial(v) // (math.factorial(v - 2) * math.factorial(2))",
"- ans += p",
"-print(ans)",
"+ ans += v * (v - 1) // 2",
"+print((int(ans)))"
] | false | 0.077793 | 0.074337 | 1.04649 | [
"s464578257",
"s017768050"
] |
u179169725 | p03088 | python | s136826966 | s817138697 | 305 | 255 | 21,388 | 12,484 | Accepted | Accepted | 16.39 | # DPを用いて解く。
# 少し複雑なので、自分の解説と照らし合わせて読むこと。
MOD = 10**9+7
N = int(eval(input()))
# AGCT→0123として扱う
# dpテーブルの作成shape=(101, 3,3,3) #長さが0~100まで扱いたいため
import numpy as np
dp = np.zeros((N+1, 4, 4, 4), dtype=int)
dp[0, 3, 3, 3] = 1 # 解説放送流テクニカルな楽な初期化
# 末尾がc3,c2,c1で終わる長さlの文字列の通りの数を計算していく
# print(dp)
for l in ran... | # DPを用いて解く。
# 少し複雑なので、自分の解説と照らし合わせて読むこと。
MOD = 10**9+7
N = int(eval(input()))
# AGCT→0123として扱う
# dpテーブルの作成shape=(101, 3,3,3) #長さが0~100まで扱いたいため
import numpy as np
dp = np.zeros((N+1, 4, 4, 4), dtype="longlong")
dp[0, 3, 3, 3] = 1 # 解説放送流テクニカルな楽な初期化
# 末尾がc3,c2,c1で終わる長さlの文字列の通りの数を計算していく
# print(dp)
for l... | 39 | 38 | 1,270 | 1,241 | # DPを用いて解く。
# 少し複雑なので、自分の解説と照らし合わせて読むこと。
MOD = 10**9 + 7
N = int(eval(input()))
# AGCT→0123として扱う
# dpテーブルの作成shape=(101, 3,3,3) #長さが0~100まで扱いたいため
import numpy as np
dp = np.zeros((N + 1, 4, 4, 4), dtype=int)
dp[0, 3, 3, 3] = 1 # 解説放送流テクニカルな楽な初期化
# 末尾がc3,c2,c1で終わる長さlの文字列の通りの数を計算していく
# print(dp)
for l in range(N):
f... | # DPを用いて解く。
# 少し複雑なので、自分の解説と照らし合わせて読むこと。
MOD = 10**9 + 7
N = int(eval(input()))
# AGCT→0123として扱う
# dpテーブルの作成shape=(101, 3,3,3) #長さが0~100まで扱いたいため
import numpy as np
dp = np.zeros((N + 1, 4, 4, 4), dtype="longlong")
dp[0, 3, 3, 3] = 1 # 解説放送流テクニカルな楽な初期化
# 末尾がc3,c2,c1で終わる長さlの文字列の通りの数を計算していく
# print(dp)
for l in range(N)... | false | 2.564103 | [
"-dp = np.zeros((N + 1, 4, 4, 4), dtype=int)",
"+dp = np.zeros((N + 1, 4, 4, 4), dtype=\"longlong\")",
"- # print('ok?')"
] | false | 0.467378 | 0.31481 | 1.484635 | [
"s136826966",
"s817138697"
] |
u699089116 | p03730 | python | s198988306 | s974526071 | 179 | 162 | 38,256 | 38,256 | Accepted | Accepted | 9.5 | a, b, c = list(map(int, input().split()))
i = 1
while i <= b:
if (a * i) % b == c:
print("YES")
exit()
i += 1
print("NO") | a, b, c = list(map(int, input().split()))
for i in range(1, 101):
if a * i % b == c:
print("YES")
exit()
else:
print("NO") | 10 | 8 | 150 | 148 | a, b, c = list(map(int, input().split()))
i = 1
while i <= b:
if (a * i) % b == c:
print("YES")
exit()
i += 1
print("NO")
| a, b, c = list(map(int, input().split()))
for i in range(1, 101):
if a * i % b == c:
print("YES")
exit()
else:
print("NO")
| false | 20 | [
"-i = 1",
"-while i <= b:",
"- if (a * i) % b == c:",
"+for i in range(1, 101):",
"+ if a * i % b == c:",
"- i += 1",
"-print(\"NO\")",
"+else:",
"+ print(\"NO\")"
] | false | 0.046759 | 0.047009 | 0.994691 | [
"s198988306",
"s974526071"
] |
u138486156 | p03262 | python | s647226368 | s209367470 | 830 | 93 | 14,252 | 16,280 | Accepted | Accepted | 88.8 | n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
if n == 1:
print((abs(x-a[0])))
exit()
else:
a.append(x)
a.sort()
box = [a[i+1]-a[i] for i in range(n)]
b = min(box)
for i in range(1,b+1):
for j in range(n-1):
if box[j]%i:
... | #reduce(func, list)
#複数の要素を 1 つにまとめたいときに使う.
#具体的には,配列の先頭から 2 つの要素を取り出して処理を行い,
#次はその結果とその次の要素に処理を行う,ということを繰り返す.
from fractions import gcd
from functools import reduce
n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = reduce(gcd, [abs(x-a[i]) for i in range(n)])
print(ans)
| 17 | 10 | 391 | 306 | n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
if n == 1:
print((abs(x - a[0])))
exit()
else:
a.append(x)
a.sort()
box = [a[i + 1] - a[i] for i in range(n)]
b = min(box)
for i in range(1, b + 1):
for j in range(n - 1):
if box[j] % i:
... | # reduce(func, list)
# 複数の要素を 1 つにまとめたいときに使う.
# 具体的には,配列の先頭から 2 つの要素を取り出して処理を行い,
# 次はその結果とその次の要素に処理を行う,ということを繰り返す.
from fractions import gcd
from functools import reduce
n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = reduce(gcd, [abs(x - a[i]) for i in range(n)])
print(ans)
| false | 41.176471 | [
"+# reduce(func, list)",
"+# 複数の要素を 1 つにまとめたいときに使う.",
"+# 具体的には,配列の先頭から 2 つの要素を取り出して処理を行い,",
"+# 次はその結果とその次の要素に処理を行う,ということを繰り返す.",
"+from fractions import gcd",
"+from functools import reduce",
"+",
"-if n == 1:",
"- print((abs(x - a[0])))",
"- exit()",
"-else:",
"- a.append(x)",
"-... | false | 0.045594 | 0.007126 | 6.397834 | [
"s647226368",
"s209367470"
] |
u474423089 | p02659 | python | s417943780 | s805859078 | 26 | 24 | 10,076 | 9,152 | Accepted | Accepted | 7.69 | from decimal import *
A,B =[Decimal(x) for x in input().split(' ')]
print((int(A*B))) | A,B=[int(x.replace('.','')) for x in input().split(' ')]
print((A*B//100)) | 3 | 2 | 88 | 76 | from decimal import *
A, B = [Decimal(x) for x in input().split(" ")]
print((int(A * B)))
| A, B = [int(x.replace(".", "")) for x in input().split(" ")]
print((A * B // 100))
| false | 33.333333 | [
"-from decimal import *",
"-",
"-A, B = [Decimal(x) for x in input().split(\" \")]",
"-print((int(A * B)))",
"+A, B = [int(x.replace(\".\", \"\")) for x in input().split(\" \")]",
"+print((A * B // 100))"
] | false | 0.043296 | 0.040054 | 1.080957 | [
"s417943780",
"s805859078"
] |
u345966487 | p03862 | python | s325983274 | s218003140 | 135 | 87 | 14,092 | 14,092 | Accepted | Accepted | 35.56 | n,x,*a=list(map(int,open(0).read().split()));r=0
for i in range(1,n):e=max(a[i]+a[i-1]-x,0);a[i]-=min(e,a[i]);r+=e
print(r) | n,x,*a=list(map(int,open(0).read().split()));t=r=0
for i in a:t=min(i,x-t);r+=i-t
print(r) | 3 | 3 | 119 | 86 | n, x, *a = list(map(int, open(0).read().split()))
r = 0
for i in range(1, n):
e = max(a[i] + a[i - 1] - x, 0)
a[i] -= min(e, a[i])
r += e
print(r)
| n, x, *a = list(map(int, open(0).read().split()))
t = r = 0
for i in a:
t = min(i, x - t)
r += i - t
print(r)
| false | 0 | [
"-r = 0",
"-for i in range(1, n):",
"- e = max(a[i] + a[i - 1] - x, 0)",
"- a[i] -= min(e, a[i])",
"- r += e",
"+t = r = 0",
"+for i in a:",
"+ t = min(i, x - t)",
"+ r += i - t"
] | false | 0.063267 | 0.058261 | 1.085932 | [
"s325983274",
"s218003140"
] |
u102461423 | p02936 | python | s941574231 | s377104108 | 1,284 | 824 | 67,076 | 85,876 | Accepted | Accepted | 35.83 | import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
# 遅延評価で加えてあげるだけ
N,Q = list(map(int,readline().split()))
AB = (tuple(int(x) for x in readline().split()) for _ in range(N-1))
PX = (tuple(int(x) for x in readline().split()) for _ in range(Q))
graph = [[] for _ in range(N+1)]
for a,b ... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N,Q = list(map(int,readline().split()))
ABPX = list(map(int,read().split()))
AB = iter(ABPX[:N+N-2])
PX = iter(ABPX[N+N-2:])
graph = [[] for _ in range(N+1)]
for a,b in zip(AB,AB):
graph... | 32 | 31 | 685 | 670 | import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
# 遅延評価で加えてあげるだけ
N, Q = list(map(int, readline().split()))
AB = (tuple(int(x) for x in readline().split()) for _ in range(N - 1))
PX = (tuple(int(x) for x in readline().split()) for _ in range(Q))
graph = [[] for _ in range(N + 1)]
for a, b in AB:... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, Q = list(map(int, readline().split()))
ABPX = list(map(int, read().split()))
AB = iter(ABPX[: N + N - 2])
PX = iter(ABPX[N + N - 2 :])
graph = [[] for _ in range(N + 1)]
for a, b in zip(AB, AB):
g... | false | 3.125 | [
"-readline = sys.stdin.readline",
"-readlines = sys.stdin.readlines",
"-# 遅延評価で加えてあげるだけ",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"-AB = (tuple(int(x) for x in readline().split()) for _ in range(N - 1))",
"-PX = (tuple(int(x)... | false | 0.058257 | 0.05951 | 0.978949 | [
"s941574231",
"s377104108"
] |
u806403461 | p03370 | python | s571579470 | s670347878 | 197 | 17 | 3,060 | 2,940 | Accepted | Accepted | 91.37 | n, x = list(map(int, input().split()))
m = list()
for a in range(0, n):
m.append(int(eval(input())))
sm = sum(m)
ans = n
while sm <= x:
sm += min(m)
ans += 1
if sm > x:
ans -= 1
print(ans)
| n, x = list(map(int, input().split()))
m = list()
for a in range(0, n):
m.append(int(eval(input())))
s = sum(m)
print((n + (x - s) // min(m)))
| 19 | 10 | 218 | 146 | n, x = list(map(int, input().split()))
m = list()
for a in range(0, n):
m.append(int(eval(input())))
sm = sum(m)
ans = n
while sm <= x:
sm += min(m)
ans += 1
if sm > x:
ans -= 1
print(ans)
| n, x = list(map(int, input().split()))
m = list()
for a in range(0, n):
m.append(int(eval(input())))
s = sum(m)
print((n + (x - s) // min(m)))
| false | 47.368421 | [
"-sm = sum(m)",
"-ans = n",
"-while sm <= x:",
"- sm += min(m)",
"- ans += 1",
"-if sm > x:",
"- ans -= 1",
"-print(ans)",
"+s = sum(m)",
"+print((n + (x - s) // min(m)))"
] | false | 0.039844 | 0.035936 | 1.108749 | [
"s571579470",
"s670347878"
] |
u668503853 | p03416 | python | s997162543 | s263880001 | 80 | 52 | 2,940 | 2,940 | Accepted | Accepted | 35 | a,b=list(map(int,input().split()))
ans=0
for i in range(a,b+1):
ir=str(i)
ir=ir[::-1]
ir=int(ir)
if i == ir:
ans+=1
print(ans) | a,b=list(map(int,input().split()))
ans=0
for i in range(a,b+1):
ir=str(i)
if ir == ir[::-1]:
ans+=1
print(ans)
| 9 | 7 | 140 | 119 | a, b = list(map(int, input().split()))
ans = 0
for i in range(a, b + 1):
ir = str(i)
ir = ir[::-1]
ir = int(ir)
if i == ir:
ans += 1
print(ans)
| a, b = list(map(int, input().split()))
ans = 0
for i in range(a, b + 1):
ir = str(i)
if ir == ir[::-1]:
ans += 1
print(ans)
| false | 22.222222 | [
"- ir = ir[::-1]",
"- ir = int(ir)",
"- if i == ir:",
"+ if ir == ir[::-1]:"
] | false | 0.129176 | 0.046477 | 2.779375 | [
"s997162543",
"s263880001"
] |
u127499732 | p03062 | python | s593785015 | s620983313 | 54 | 48 | 14,116 | 15,504 | Accepted | Accepted | 11.11 | def main():
n, *a = list(map(int, open(0).read().split()))
b = [i for i in a if i <= 0]
*ab, = list(map(abs, a))
c = sum(ab)
if len(b) % 2 == 0:
print(c)
else:
print((c - 2 * min(ab)))
if __name__ == '__main__':
main()
| def main():
s = open(0).read()
b = s.count('-')
_, *c, = list(map(int, s.replace('-', '').split()))
z = c.count(0)
d = min(c)
e = sum(c)
if b % 2 == 0 or z > 0:
print(e)
else:
print((e - 2 * d))
if __name__ == '__main__':
main()
| 13 | 16 | 263 | 291 | def main():
n, *a = list(map(int, open(0).read().split()))
b = [i for i in a if i <= 0]
(*ab,) = list(map(abs, a))
c = sum(ab)
if len(b) % 2 == 0:
print(c)
else:
print((c - 2 * min(ab)))
if __name__ == "__main__":
main()
| def main():
s = open(0).read()
b = s.count("-")
(
_,
*c,
) = list(map(int, s.replace("-", "").split()))
z = c.count(0)
d = min(c)
e = sum(c)
if b % 2 == 0 or z > 0:
print(e)
else:
print((e - 2 * d))
if __name__ == "__main__":
main()
| false | 18.75 | [
"- n, *a = list(map(int, open(0).read().split()))",
"- b = [i for i in a if i <= 0]",
"- (*ab,) = list(map(abs, a))",
"- c = sum(ab)",
"- if len(b) % 2 == 0:",
"- print(c)",
"+ s = open(0).read()",
"+ b = s.count(\"-\")",
"+ (",
"+ _,",
"+ *c,",
"+ ... | false | 0.149243 | 0.039353 | 3.792377 | [
"s593785015",
"s620983313"
] |
u150984829 | p02283 | python | s155749613 | s572574636 | 6,090 | 3,900 | 115,000 | 63,248 | Accepted | Accepted | 35.96 | import sys
class Node:
def __init__(self, key):
self.key = key
self.left = self.right = None
class BST:
def __init__(self):
self.root = None
def insert(self, key):
x, y = self.root, None
while x != None: x, y = x.left if key < x.key else x.right, x
... | import sys
class Node:
__slots__ = ['key', 'left', 'right']
def __init__(self, key):
self.key = key
self.left = self.right = None
class BST:
__slots__ = ['root']
def __init__(self):
self.root = None
def insert(self, key):
x, y = self.root, None
... | 29 | 31 | 906 | 974 | import sys
class Node:
def __init__(self, key):
self.key = key
self.left = self.right = None
class BST:
def __init__(self):
self.root = None
def insert(self, key):
x, y = self.root, None
while x != None:
x, y = x.left if key < x.key else x.right, x
... | import sys
class Node:
__slots__ = ["key", "left", "right"]
def __init__(self, key):
self.key = key
self.left = self.right = None
class BST:
__slots__ = ["root"]
def __init__(self):
self.root = None
def insert(self, key):
x, y = self.root, None
while x ... | false | 6.451613 | [
"+ __slots__ = [\"key\", \"left\", \"right\"]",
"+",
"+ __slots__ = [\"root\"]",
"+"
] | false | 0.036106 | 0.007539 | 4.789355 | [
"s155749613",
"s572574636"
] |
u456353530 | p03078 | python | s785246651 | s587774497 | 1,872 | 120 | 14,196 | 8,708 | Accepted | Accepted | 93.59 | def main():
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse = True)
B.sort(reverse = True)
C.sort(reverse = True)
A += [-1e10]
B += [-1e10]
C += [-1e10]
memo = [A[... | X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse = True)
B.sort(reverse = True)
C.sort(reverse = True)
abc = []
for i in range(X):
for j in range(Y):
if (i + 1) * (j + 1) > K:
... | 36 | 21 | 801 | 515 | def main():
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
A += [-1e10]
B += [-1e10]
C += [-1e10]
memo = [A... | X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
abc = []
for i in range(X):
for j in range(Y):
if (i + 1) * (j + 1) > K:
break
... | false | 41.666667 | [
"-def main():",
"- X, Y, Z, K = list(map(int, input().split()))",
"- A = list(map(int, input().split()))",
"- B = list(map(int, input().split()))",
"- C = list(map(int, input().split()))",
"- A.sort(reverse=True)",
"- B.sort(reverse=True)",
"- C.sort(reverse=True)",
"- A += [... | false | 0.109919 | 0.03643 | 3.017269 | [
"s785246651",
"s587774497"
] |
u973013625 | p02712 | python | s907935659 | s133162824 | 158 | 146 | 9,040 | 9,020 | Accepted | Accepted | 7.59 | n = int(eval(input()))
x = 0
for i in range(1, n+1):
if i%3!=0 and i%5!=0:
x+=i
print(x) | n = int(eval(input()))
x = 0
for i in range(1, n+1):
if i%3 and i%5:
x+=i
print(x) | 6 | 6 | 99 | 93 | n = int(eval(input()))
x = 0
for i in range(1, n + 1):
if i % 3 != 0 and i % 5 != 0:
x += i
print(x)
| n = int(eval(input()))
x = 0
for i in range(1, n + 1):
if i % 3 and i % 5:
x += i
print(x)
| false | 0 | [
"- if i % 3 != 0 and i % 5 != 0:",
"+ if i % 3 and i % 5:"
] | false | 0.189246 | 0.196831 | 0.961466 | [
"s907935659",
"s133162824"
] |
u835844653 | p02361 | python | s683962454 | s174710649 | 5,410 | 3,890 | 83,676 | 90,448 | Accepted | Accepted | 28.1 | v,e,s=list(map(int,input().split()))
edge=[]
inf =1000000100
for i in range(v):
edge.append([])
for i in range(e):
vs,vt,d=list(map(int,input().split()))
edge[vs].append((vt,d))
dis=[]
for i in range(v):
dis.append(inf)
dis[s]=0
for j in range(v):
update=False
for i in ... | '''
????????£????????????????????????
'''
import queue
v,e,s=list(map(int,input().split()))
edge=[]
inf =1000000100
for i in range(v):
edge.append([])
for i in range(e):
vs,vt,d=list(map(int,input().split()))
edge[vs].append((vt,d))
dis=[]
for i in range(v):
dis.append(inf)
... | 31 | 41 | 610 | 716 | v, e, s = list(map(int, input().split()))
edge = []
inf = 1000000100
for i in range(v):
edge.append([])
for i in range(e):
vs, vt, d = list(map(int, input().split()))
edge[vs].append((vt, d))
dis = []
for i in range(v):
dis.append(inf)
dis[s] = 0
for j in range(v):
update = False
for i in range(... | """
????????£????????????????????????
"""
import queue
v, e, s = list(map(int, input().split()))
edge = []
inf = 1000000100
for i in range(v):
edge.append([])
for i in range(e):
vs, vt, d = list(map(int, input().split()))
edge[vs].append((vt, d))
dis = []
for i in range(v):
dis.append(inf)
dis[s] = 0
q... | false | 24.390244 | [
"+\"\"\"",
"+????????£????????????????????????",
"+\"\"\"",
"+import queue",
"+",
"-for j in range(v):",
"- update = False",
"- for i in range(v):",
"- for (t, d) in edge[i]:",
"- if dis[i] < inf and d < inf and dis[t] > dis[i] + d:",
"- dis[t] = dis[i] + d... | false | 0.043846 | 0.052055 | 0.842304 | [
"s683962454",
"s174710649"
] |
u588341295 | p03252 | python | s894346199 | s974607393 | 124 | 43 | 3,632 | 3,896 | Accepted | Accepted | 65.32 | # -*- coding: utf-8 -*-
S = eval(input())
T = eval(input())
# 1対1の変換表(dict)
start = {}
goal = {}
for i in range(len(S)):
s = S[i]
t = T[i]
# 変換表の該当箇所がまだ空いてるかどうか
if s in start or t in goal:
# 埋まっている場合、今回の組み合わせと一致しているかどうか
if start.get(s) != t or goal.get(t) != s:
... | # -*- coding: utf-8 -*-
import sys
from collections import Counter
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range... | 24 | 36 | 435 | 961 | # -*- coding: utf-8 -*-
S = eval(input())
T = eval(input())
# 1対1の変換表(dict)
start = {}
goal = {}
for i in range(len(S)):
s = S[i]
t = T[i]
# 変換表の該当箇所がまだ空いてるかどうか
if s in start or t in goal:
# 埋まっている場合、今回の組み合わせと一致しているかどうか
if start.get(s) != t or goal.get(t) != s:
print("No")
... | # -*- coding: utf-8 -*-
import sys
from collections import Counter
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d ... | false | 33.333333 | [
"+import sys",
"+from collections import Counter",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline().strip()",
"+",
"+",
"+def list2d(a, b, c):",
"+ return [[c] * b for i in range(a)]",
"+",
"+",
"+def list3d(a, b, c, d):",
"+ return [[[d] * c for j in range(b)] for i in r... | false | 0.035292 | 0.058293 | 0.605427 | [
"s894346199",
"s974607393"
] |
u868701750 | p03331 | python | s274264729 | s482349555 | 395 | 17 | 3,848 | 2,940 | Accepted | Accepted | 95.7 | n = int(eval(input()))
_list = []
for a in range(1, n):
b = n - a
_list.append(sum(list(map(int, str(a)[::]))) + sum(list(map(int, str(b)[::]))))
print((min(_list))) | N = int(eval(input()))
n = 10 ** (len(str(N-1)) - 1)
a = list(str(N - n))
print((sum(list(map(int, a)))+1))
| 9 | 4 | 176 | 103 | n = int(eval(input()))
_list = []
for a in range(1, n):
b = n - a
_list.append(sum(list(map(int, str(a)[::]))) + sum(list(map(int, str(b)[::]))))
print((min(_list)))
| N = int(eval(input()))
n = 10 ** (len(str(N - 1)) - 1)
a = list(str(N - n))
print((sum(list(map(int, a))) + 1))
| false | 55.555556 | [
"-n = int(eval(input()))",
"-_list = []",
"-for a in range(1, n):",
"- b = n - a",
"- _list.append(sum(list(map(int, str(a)[::]))) + sum(list(map(int, str(b)[::]))))",
"-print((min(_list)))",
"+N = int(eval(input()))",
"+n = 10 ** (len(str(N - 1)) - 1)",
"+a = list(str(N - n))",
"+print((sum... | false | 0.228033 | 0.036277 | 6.285861 | [
"s274264729",
"s482349555"
] |
u983918956 | p03157 | python | s717618768 | s166867147 | 602 | 407 | 150,728 | 6,124 | Accepted | Accepted | 32.39 | import sys
sys.setrecursionlimit(10**6)
around = [(0,1),(1,0),(0,-1),(-1,0)]
H,W = list(map(int,input().split()))
grid = [list(eval(input())) for _ in range(H)]
checked = [[0]*W for _ in range(H)]
def dfs(i,j):
checked[i][j] = 1
for di,dj in around:
ni = i + di; nj = j + dj
if ... | from collections import deque
around = [(0,1),(1,0),(0,-1),(-1,0)]
H,W = list(map(int,input().split()))
grid = [list(eval(input())) for _ in range(H)]
checked = [[0]*W for i in range(H)]
def bfs(si,sj):
if grid[si][sj] == ".":
b = 0; w = 1
if grid[si][sj] == "#":
b = 1; w = 0
... | 37 | 42 | 853 | 1,114 | import sys
sys.setrecursionlimit(10**6)
around = [(0, 1), (1, 0), (0, -1), (-1, 0)]
H, W = list(map(int, input().split()))
grid = [list(eval(input())) for _ in range(H)]
checked = [[0] * W for _ in range(H)]
def dfs(i, j):
checked[i][j] = 1
for di, dj in around:
ni = i + di
nj = j + dj
... | from collections import deque
around = [(0, 1), (1, 0), (0, -1), (-1, 0)]
H, W = list(map(int, input().split()))
grid = [list(eval(input())) for _ in range(H)]
checked = [[0] * W for i in range(H)]
def bfs(si, sj):
if grid[si][sj] == ".":
b = 0
w = 1
if grid[si][sj] == "#":
b = 1
... | false | 11.904762 | [
"-import sys",
"+from collections import deque",
"-sys.setrecursionlimit(10**6)",
"-checked = [[0] * W for _ in range(H)]",
"+checked = [[0] * W for i in range(H)]",
"-def dfs(i, j):",
"- checked[i][j] = 1",
"- for di, dj in around:",
"- ni = i + di",
"- nj = j + dj",
"- ... | false | 0.04375 | 0.038519 | 1.1358 | [
"s717618768",
"s166867147"
] |
u057109575 | p02743 | python | s116775996 | s047969934 | 176 | 64 | 38,384 | 61,384 | Accepted | Accepted | 63.64 | a, b, c = list(map(int, input().split()))
l = a * b * 4
r = c - a - b
if r < 0 or l >= r ** 2:
print("No")
else:
print("Yes")
|
A, B, C = list(map(int, input().split()))
x = A * B * 4
y = (C - A - B) ** 2
if x < y and C - A - B > 0:
print("Yes")
else:
print("No")
| 8 | 9 | 136 | 148 | a, b, c = list(map(int, input().split()))
l = a * b * 4
r = c - a - b
if r < 0 or l >= r**2:
print("No")
else:
print("Yes")
| A, B, C = list(map(int, input().split()))
x = A * B * 4
y = (C - A - B) ** 2
if x < y and C - A - B > 0:
print("Yes")
else:
print("No")
| false | 11.111111 | [
"-a, b, c = list(map(int, input().split()))",
"-l = a * b * 4",
"-r = c - a - b",
"-if r < 0 or l >= r**2:",
"+A, B, C = list(map(int, input().split()))",
"+x = A * B * 4",
"+y = (C - A - B) ** 2",
"+if x < y and C - A - B > 0:",
"+ print(\"Yes\")",
"+else:",
"-else:",
"- print(\"Yes\")"... | false | 0.045555 | 0.045664 | 0.997616 | [
"s116775996",
"s047969934"
] |
u072053884 | p02279 | python | s191603408 | s396759259 | 1,370 | 870 | 55,584 | 55,668 | Accepted | Accepted | 36.5 | class Node:
def __init__(self, num, parent, children):
self.id = num
self.parent = -1
self.children = children
self.depth = 0
def show_info(self):
print('node {0}: '.format(self.id), end = '')
print('parent = {0}, '.format(self.parent), end = '')... | class Node:
def __init__(self, num, parent, children):
self.id = num
self.parent = -1
self.depth = 0
self.type = None
self.children = children
def show_info(self):
print(('node {0}: parent = {1}, depth = {2}, {3}, {4}'.format(self.id,
... | 52 | 54 | 1,222 | 1,362 | class Node:
def __init__(self, num, parent, children):
self.id = num
self.parent = -1
self.children = children
self.depth = 0
def show_info(self):
print("node {0}: ".format(self.id), end="")
print("parent = {0}, ".format(self.parent), end="")
print("depth... | class Node:
def __init__(self, num, parent, children):
self.id = num
self.parent = -1
self.depth = 0
self.type = None
self.children = children
def show_info(self):
print(
(
"node {0}: parent = {1}, depth = {2}, {3}, {4}".format(
... | false | 3.703704 | [
"+ self.depth = 0",
"+ self.type = None",
"- self.depth = 0",
"- print(\"node {0}: \".format(self.id), end=\"\")",
"- print(\"parent = {0}, \".format(self.parent), end=\"\")",
"- print(\"depth = {0}, \".format(self.depth), end=\"\")",
"- if self.children ... | false | 0.039782 | 0.066169 | 0.601215 | [
"s191603408",
"s396759259"
] |
u648212584 | p02727 | python | s819156799 | s644541960 | 356 | 229 | 21,092 | 21,088 | Accepted | Accepted | 35.67 | import sys
input = sys.stdin.buffer.readline
import heapq
def main():
X,Y,A,B,C = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort()
q.sort()
r.sort()
p = p[-X:]
q = q[-Y:]
... | import sys
input = sys.stdin.buffer.readline
def main():
X,Y,A,B,C = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort()
q.sort()
r.sort()
p = p[-X:]
q = q[-Y:]
use = p+q+r
... | 30 | 19 | 655 | 411 | import sys
input = sys.stdin.buffer.readline
import heapq
def main():
X, Y, A, B, C = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort()
q.sort()
r.sort()
p = p[-X:]
q = q[-Y:]
r ... | import sys
input = sys.stdin.buffer.readline
def main():
X, Y, A, B, C = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort()
q.sort()
r.sort()
p = p[-X:]
q = q[-Y:]
use = p + q + r... | false | 36.666667 | [
"-import heapq",
"- r = r[-X - Y :]",
"- use = p + q",
"- heapq.heapify(use)",
"- heapq.heapify(r)",
"- while len(r) > 0:",
"- unt = heapq.heappop(use)",
"- nc = heapq.heappop(r)",
"- if nc > unt:",
"- heapq.heappush(use, nc)",
"- else:",
"... | false | 0.043316 | 0.03993 | 1.084819 | [
"s819156799",
"s644541960"
] |
u952708174 | p02641 | python | s641719902 | s508899999 | 26 | 23 | 9,204 | 9,192 | Accepted | Accepted | 11.54 | def c_forbidden_list():
X, N = [int(i) for i in input().split()]
P = set([int(i) for i in input().split()]) if N != 0 else []
if not P:
return X
minimum = float('inf')
ans = -float('inf')
for t in range(102):
if (not t in P) and (abs(X - t) < minimum):
mi... | def c_forbidden_list(RANGE=101):
X, N = [int(i) for i in input().split()]
P = set([int(i) for i in input().split()]) if N != 0 else set()
for t in range(RANGE + 1):
if X - t not in P:
return X - t
elif X + t not in P:
return X + t
return None # 入力の制約上ここ... | 16 | 12 | 404 | 354 | def c_forbidden_list():
X, N = [int(i) for i in input().split()]
P = set([int(i) for i in input().split()]) if N != 0 else []
if not P:
return X
minimum = float("inf")
ans = -float("inf")
for t in range(102):
if (not t in P) and (abs(X - t) < minimum):
minimum = abs(X... | def c_forbidden_list(RANGE=101):
X, N = [int(i) for i in input().split()]
P = set([int(i) for i in input().split()]) if N != 0 else set()
for t in range(RANGE + 1):
if X - t not in P:
return X - t
elif X + t not in P:
return X + t
return None # 入力の制約上ここには来ない
pr... | false | 25 | [
"-def c_forbidden_list():",
"+def c_forbidden_list(RANGE=101):",
"- P = set([int(i) for i in input().split()]) if N != 0 else []",
"- if not P:",
"- return X",
"- minimum = float(\"inf\")",
"- ans = -float(\"inf\")",
"- for t in range(102):",
"- if (not t in P) and (abs(... | false | 0.036382 | 0.04422 | 0.822752 | [
"s641719902",
"s508899999"
] |
u784022244 | p02804 | python | s741642710 | s408201892 | 366 | 143 | 26,704 | 105,108 | Accepted | Accepted | 60.93 | N, K=list(map(int, input().split()))
def cmb(n, r, p):
if (r < 0) or (n < r):
return 0
r = min(r, n - r)
return fact[n] * factinv[r] * factinv[n-r] % p
p=10**9+7
fact = [1, 1] # fact[n] = (n! mod p)
factinv = [1, 1] # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1] # factinv 計算用
for i in range(2... | N,K=list(map(int, input().split()))
A=list(map(int, input().split()))
p=10**9+7
def cmb(n, r, p):
if (r < 0) or (n < r):
return 0
r = min(r, n - r)
return fact[n] * factinv[r] * factinv[n-r] % p
p = 10 ** 9 + 7
n = 10 ** 5 # N は必要分だけ用意する
fact = [1, 1] # fact[n] = (n! mod p) 階乗の... | 28 | 40 | 629 | 764 | N, K = list(map(int, input().split()))
def cmb(n, r, p):
if (r < 0) or (n < r):
return 0
r = min(r, n - r)
return fact[n] * factinv[r] * factinv[n - r] % p
p = 10**9 + 7
fact = [1, 1] # fact[n] = (n! mod p)
factinv = [1, 1] # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1] # factinv 計算用
for i in ... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
p = 10**9 + 7
def cmb(n, r, p):
if (r < 0) or (n < r):
return 0
r = min(r, n - r)
return fact[n] * factinv[r] * factinv[n - r] % p
p = 10**9 + 7
n = 10**5 # N は必要分だけ用意する
fact = [1, 1] # fact[n] = (n! mod p) 階乗のmod
facti... | false | 30 | [
"+A = list(map(int, input().split()))",
"+p = 10**9 + 7",
"-fact = [1, 1] # fact[n] = (n! mod p)",
"+n = 10**5 # N は必要分だけ用意する",
"+fact = [1, 1] # fact[n] = (n! mod p) 階乗のmod",
"-for i in range(2, N + 1):",
"+for i in range(2, n + 1):",
"-A = sorted(list(map(int, input().split())))",
"-mn = 0",
... | false | 0.034917 | 0.320235 | 0.109036 | [
"s741642710",
"s408201892"
] |
u987164499 | p03387 | python | s300657862 | s205890114 | 22 | 17 | 3,064 | 2,940 | Accepted | Accepted | 22.73 | from sys import stdin
import math
li = list(map(int,stdin.readline().rstrip().split()))
li.sort(reverse = True)
point = 0
su = sum(li)%2
sai = li[0]%2
if sum(li) == 1:
print((1))
exit()
else:
if su != sai:
li[0] += 1
point += 1
point += (li[0]*2-li[1]-li[2])//2
... | li = list(map(int,input().split()))
li.sort()
lin = li[:]
if sum(li)%2 != 3*li[2]%2:
lin[2] += 1
print(((lin[2]*3-sum(li))//2)) | 22 | 9 | 331 | 140 | from sys import stdin
import math
li = list(map(int, stdin.readline().rstrip().split()))
li.sort(reverse=True)
point = 0
su = sum(li) % 2
sai = li[0] % 2
if sum(li) == 1:
print((1))
exit()
else:
if su != sai:
li[0] += 1
point += 1
point += (li[0] * 2 - li[1] - li[2]) // 2
print(point)
| li = list(map(int, input().split()))
li.sort()
lin = li[:]
if sum(li) % 2 != 3 * li[2] % 2:
lin[2] += 1
print(((lin[2] * 3 - sum(li)) // 2))
| false | 59.090909 | [
"-from sys import stdin",
"-import math",
"-",
"-li = list(map(int, stdin.readline().rstrip().split()))",
"-li.sort(reverse=True)",
"-point = 0",
"-su = sum(li) % 2",
"-sai = li[0] % 2",
"-if sum(li) == 1:",
"- print((1))",
"- exit()",
"-else:",
"- if su != sai:",
"- li[0] ... | false | 0.040937 | 0.032011 | 1.278827 | [
"s300657862",
"s205890114"
] |
u735069283 | p02854 | python | s235828631 | s134967392 | 886 | 224 | 34,216 | 34,168 | Accepted | Accepted | 74.72 | import sys
input = sys.stdin.readline
import numpy as np
N=int(eval(input()))
A = np.array([int(x) for x in input().split()])
if N==2:
print((abs(A[0]-A[1])))
else:
B = np.concatenate([[0],A.cumsum()])
H = np.searchsorted(B,sum(A)//2)
result=float('inf')
for i in range(min(5,len(A)//2)):
re... | import sys
input = sys.stdin.readline
import numpy as np
N=int(eval(input()))
A = np.array([int(x) for x in input().split()])
B = A.cumsum()
L=B
R=B[-1]-L
answer=np.abs(L-R).min()
print(answer) | 16 | 14 | 410 | 205 | import sys
input = sys.stdin.readline
import numpy as np
N = int(eval(input()))
A = np.array([int(x) for x in input().split()])
if N == 2:
print((abs(A[0] - A[1])))
else:
B = np.concatenate([[0], A.cumsum()])
H = np.searchsorted(B, sum(A) // 2)
result = float("inf")
for i in range(min(5, len(A) //... | import sys
input = sys.stdin.readline
import numpy as np
N = int(eval(input()))
A = np.array([int(x) for x in input().split()])
B = A.cumsum()
L = B
R = B[-1] - L
answer = np.abs(L - R).min()
print(answer)
| false | 12.5 | [
"-if N == 2:",
"- print((abs(A[0] - A[1])))",
"-else:",
"- B = np.concatenate([[0], A.cumsum()])",
"- H = np.searchsorted(B, sum(A) // 2)",
"- result = float(\"inf\")",
"- for i in range(min(5, len(A) // 2)):",
"- result = min(",
"- result,",
"- abs(sum(... | false | 0.516336 | 0.479532 | 1.076749 | [
"s235828631",
"s134967392"
] |
u043639882 | p02390 | python | s437020613 | s107971099 | 30 | 20 | 7,676 | 7,656 | Accepted | Accepted | 33.33 | S = int(input())
h = S // 3600
m = S % 3600 // 60
s = S % 60
print(h,m,s,sep=':')
| S=int(input())
h=S//3600
m=(S%3600)//60
s=S%60
print(h,m,s,sep=":")
| 5 | 5 | 85 | 71 | S = int(input())
h = S // 3600
m = S % 3600 // 60
s = S % 60
print(h, m, s, sep=":")
| S = int(input())
h = S // 3600
m = (S % 3600) // 60
s = S % 60
print(h, m, s, sep=":")
| false | 0 | [
"-m = S % 3600 // 60",
"+m = (S % 3600) // 60"
] | false | 0.048598 | 0.048818 | 0.995498 | [
"s437020613",
"s107971099"
] |
u241159583 | p02777 | python | s437783852 | s135702300 | 19 | 17 | 3,316 | 2,940 | Accepted | Accepted | 10.53 | S, T = input().split()
A, B = list(map(int, input().split()))
U = eval(input())
if U == S:
print((A - 1, B))
else:
print((A, B-1)) | S, T = input().split()
A, B = list(map(int, input().split()))
U = eval(input())
if S == U: A -= 1
elif T == U: B -= 1
print((A, B)) | 8 | 6 | 126 | 122 | S, T = input().split()
A, B = list(map(int, input().split()))
U = eval(input())
if U == S:
print((A - 1, B))
else:
print((A, B - 1))
| S, T = input().split()
A, B = list(map(int, input().split()))
U = eval(input())
if S == U:
A -= 1
elif T == U:
B -= 1
print((A, B))
| false | 25 | [
"-if U == S:",
"- print((A - 1, B))",
"-else:",
"- print((A, B - 1))",
"+if S == U:",
"+ A -= 1",
"+elif T == U:",
"+ B -= 1",
"+print((A, B))"
] | false | 0.066295 | 0.064948 | 1.020738 | [
"s437783852",
"s135702300"
] |
u353895424 | p03262 | python | s861350759 | s992910758 | 330 | 147 | 88,852 | 16,276 | Accepted | Accepted | 55.45 | import fractions
n, X = list(map(int, input().split()))
x = list(map(int, input().split()))
l = []
for _x in x:
l.append(abs(_x - X))
gcd = l[0]
for i in range(1, n):
gcd = fractions.gcd(gcd, l[i])
print(gcd) | import fractions
def GCD(a):
gcd = a[0]
N = len(a)
for i in range(1, N):
gcd = fractions.gcd(gcd, a[i])
return gcd
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
if len(x) == 1:
print((abs(x[0] - X)))
exit()
x.append(X)
x.sort()
ans = flo... | 10 | 25 | 223 | 406 | import fractions
n, X = list(map(int, input().split()))
x = list(map(int, input().split()))
l = []
for _x in x:
l.append(abs(_x - X))
gcd = l[0]
for i in range(1, n):
gcd = fractions.gcd(gcd, l[i])
print(gcd)
| import fractions
def GCD(a):
gcd = a[0]
N = len(a)
for i in range(1, N):
gcd = fractions.gcd(gcd, a[i])
return gcd
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
if len(x) == 1:
print((abs(x[0] - X)))
exit()
x.append(X)
x.sort()
ans = float("inf")
d = []
f... | false | 60 | [
"-n, X = list(map(int, input().split()))",
"+",
"+def GCD(a):",
"+ gcd = a[0]",
"+ N = len(a)",
"+ for i in range(1, N):",
"+ gcd = fractions.gcd(gcd, a[i])",
"+ return gcd",
"+",
"+",
"+N, X = list(map(int, input().split()))",
"-l = []",
"-for _x in x:",
"- l.append(... | false | 0.04769 | 0.058081 | 0.821084 | [
"s861350759",
"s992910758"
] |
u663230781 | p03449 | python | s468495771 | s514666748 | 36 | 21 | 3,828 | 3,444 | Accepted | Accepted | 41.67 | n = int(eval(input()))
input_data = {}
for r in range(2):
line_data = [int(x) for x in input().split(" ")]
for c, value in enumerate(line_data):
input_data[(r, c)] = value
from collections import defaultdict
answer = defaultdict(int)
#for c, value in enumerate(range(n)):
# answer[(... | #■標準入力ショートカット
def get_next_int():
return int(float(eval(input())))
def get_next_str():
return eval(input())
def get_next_ints(delim=" "):
return tuple([int(float(x)) for x in input().split(delim)])
def get_next_strs(delim=" "):
return tuple(input().split(delim))
def get_next_by_types(*val... | 22 | 36 | 543 | 900 | n = int(eval(input()))
input_data = {}
for r in range(2):
line_data = [int(x) for x in input().split(" ")]
for c, value in enumerate(line_data):
input_data[(r, c)] = value
from collections import defaultdict
answer = defaultdict(int)
# for c, value in enumerate(range(n)):
# answer[(0,c)] = input_dat... | # ■標準入力ショートカット
def get_next_int():
return int(float(eval(input())))
def get_next_str():
return eval(input())
def get_next_ints(delim=" "):
return tuple([int(float(x)) for x in input().split(delim)])
def get_next_strs(delim=" "):
return tuple(input().split(delim))
def get_next_by_types(*value_typ... | false | 38.888889 | [
"-n = int(eval(input()))",
"-input_data = {}",
"-for r in range(2):",
"- line_data = [int(x) for x in input().split(\" \")]",
"- for c, value in enumerate(line_data):",
"- input_data[(r, c)] = value",
"-from collections import defaultdict",
"+# ■標準入力ショートカット",
"+def get_next_int():",
"... | false | 0.042408 | 0.106513 | 0.398154 | [
"s468495771",
"s514666748"
] |
u241190159 | p03821 | python | s564476936 | s152976806 | 113 | 92 | 25,124 | 25,124 | Accepted | Accepted | 18.58 | _, *AB = list(map(int, open(0).read().split()))
AB = iter(AB[::-1])
increment = 0
for b, a in zip(AB, AB):
a += increment
if a % b:
increment += b - a % b
print(increment) | def main():
_, *AB = list(map(int, open(0).read().split()))
AB = iter(AB[::-1])
increment = 0
for b, a in zip(AB, AB):
a += increment
if a % b:
increment += b - a % b
print(increment)
if __name__=="__main__":
main() | 11 | 15 | 190 | 255 | _, *AB = list(map(int, open(0).read().split()))
AB = iter(AB[::-1])
increment = 0
for b, a in zip(AB, AB):
a += increment
if a % b:
increment += b - a % b
print(increment)
| def main():
_, *AB = list(map(int, open(0).read().split()))
AB = iter(AB[::-1])
increment = 0
for b, a in zip(AB, AB):
a += increment
if a % b:
increment += b - a % b
print(increment)
if __name__ == "__main__":
main()
| false | 26.666667 | [
"-_, *AB = list(map(int, open(0).read().split()))",
"-AB = iter(AB[::-1])",
"-increment = 0",
"-for b, a in zip(AB, AB):",
"- a += increment",
"- if a % b:",
"- increment += b - a % b",
"-print(increment)",
"+def main():",
"+ _, *AB = list(map(int, open(0).read().split()))",
"+ ... | false | 0.048067 | 0.077209 | 0.622549 | [
"s564476936",
"s152976806"
] |
u963903527 | p03088 | python | s241484614 | s027258713 | 127 | 43 | 3,872 | 3,312 | Accepted | Accepted | 66.14 | n, mod = int(eval(input())), 10 ** 9 + 7
memo = [{} for i in range(n+1)]
def check(l):
for i in range(4):
t = list(l)
if i >= 1:
t[i-1], t[i] = t[i], t[i-1] # 順序の入れ替え
if ''.join(t).count('AGC') >= 1:
return False
return True
def dfs(cur, last3):
i... | """
n, mod = int(input()), 10 ** 9 + 7
memo = [{} for i in range(n+1)]
def check(l):
for i in range(4):
t = list(l)
if i >= 1:
t[i-1], t[i] = t[i], t[i-1] # 順序の入れ替え
if ''.join(t).count('AGC') >= 1:
return False
return True
def dfs(cur, last3):
if... | 24 | 55 | 599 | 1,747 | n, mod = int(eval(input())), 10**9 + 7
memo = [{} for i in range(n + 1)]
def check(l):
for i in range(4):
t = list(l)
if i >= 1:
t[i - 1], t[i] = t[i], t[i - 1] # 順序の入れ替え
if "".join(t).count("AGC") >= 1:
return False
return True
def dfs(cur, last3):
if la... | """
n, mod = int(input()), 10 ** 9 + 7
memo = [{} for i in range(n+1)]
def check(l):
for i in range(4):
t = list(l)
if i >= 1:
t[i-1], t[i] = t[i], t[i-1] # 順序の入れ替え
if ''.join(t).count('AGC') >= 1:
return False
return True
def dfs(cur, last3):
if last3 in memo... | false | 56.363636 | [
"-n, mod = int(eval(input())), 10**9 + 7",
"-memo = [{} for i in range(n + 1)]",
"-",
"-",
"+\"\"\"",
"+n, mod = int(input()), 10 ** 9 + 7",
"+memo = [{} for i in range(n+1)]",
"- t[i - 1], t[i] = t[i], t[i - 1] # 順序の入れ替え",
"- if \"\".join(t).count(\"AGC\") >= 1:",
"+ ... | false | 0.074541 | 0.047846 | 1.55792 | [
"s241484614",
"s027258713"
] |
u306843722 | p03738 | python | s106043225 | s521992975 | 14 | 11 | 2,948 | 2,568 | Accepted | Accepted | 21.43 | #coding:utf-8
if __name__ == "__main__":
a = int(input())
b = int(input())
if a > b:
print("GREATER")
elif a < b:
print("LESS")
elif a == b:
print("EQUAL")
| #coding:utf-8
import math
if __name__ == "__main__":
a = input()
b = input()
if len(a) > len(b):
print("GREATER")
elif len(a) < len(b):
print("LESS")
elif len(a) == len(b):
for i in range(len(a)):
if a[i] > b[i]:
print("GREATER")
... | 12 | 23 | 218 | 517 | # coding:utf-8
if __name__ == "__main__":
a = int(input())
b = int(input())
if a > b:
print("GREATER")
elif a < b:
print("LESS")
elif a == b:
print("EQUAL")
| # coding:utf-8
import math
if __name__ == "__main__":
a = input()
b = input()
if len(a) > len(b):
print("GREATER")
elif len(a) < len(b):
print("LESS")
elif len(a) == len(b):
for i in range(len(a)):
if a[i] > b[i]:
print("GREATER")
... | false | 47.826087 | [
"+import math",
"+",
"- a = int(input())",
"- b = int(input())",
"- if a > b:",
"+ a = input()",
"+ b = input()",
"+ if len(a) > len(b):",
"- elif a < b:",
"+ elif len(a) < len(b):",
"- elif a == b:",
"- print(\"EQUAL\")",
"+ elif len(a) == len(b):",
"+... | false | 0.110113 | 0.040466 | 2.721115 | [
"s106043225",
"s521992975"
] |
u947883560 | p02728 | python | s873120618 | s353969379 | 1,596 | 934 | 131,636 | 111,312 | Accepted | Accepted | 41.48 | #!/usr/bin/env python3
import sys
from collections import defaultdict
from functools import lru_cache
from collections import deque
MOD = 1000000007 # type: int
class Graph(object):
def __init__(self, N):
self.N = N
self.E = defaultdict(list)
def add_edge(self, src, dest, w=1):
... | #!/usr/bin/env python3
import sys
from collections import defaultdict
from functools import lru_cache
MOD = 1000000007 # type: int
@lru_cache(maxsize=None)
def div(a, b):
return (a * pow(b, MOD-2, MOD)) % MOD
class Combination(object):
def __init__(self, N, mod=MOD):
fac, finv, inv ... | 124 | 114 | 2,974 | 2,717 | #!/usr/bin/env python3
import sys
from collections import defaultdict
from functools import lru_cache
from collections import deque
MOD = 1000000007 # type: int
class Graph(object):
def __init__(self, N):
self.N = N
self.E = defaultdict(list)
def add_edge(self, src, dest, w=1):
self... | #!/usr/bin/env python3
import sys
from collections import defaultdict
from functools import lru_cache
MOD = 1000000007 # type: int
@lru_cache(maxsize=None)
def div(a, b):
return (a * pow(b, MOD - 2, MOD)) % MOD
class Combination(object):
def __init__(self, N, mod=MOD):
fac, finv, inv = [0] * (N + ... | false | 8.064516 | [
"-from collections import deque",
"-",
"-",
"-class Graph(object):",
"- def __init__(self, N):",
"- self.N = N",
"- self.E = defaultdict(list)",
"-",
"- def add_edge(self, src, dest, w=1):",
"- self.E[src].append((dest, w))",
"- self.E[dest].append((src, w))",
... | false | 0.047383 | 0.044147 | 1.073294 | [
"s873120618",
"s353969379"
] |
u773265208 | p02726 | python | s022981746 | s504722367 | 1,158 | 951 | 86,236 | 79,452 | Accepted | Accepted | 17.88 | import heapq
import sys
input = sys.stdin.readline
def dijkstra(s,edge):
#始点sから各頂点への最短距離
d = [10**20] * n
used = [True] * n #True:未確定
d[s] = 0
used[s] = False
edgelist = []
for a,b in edge[s]:
heapq.heappush(edgelist,a*(10**6)+b)
while len(edgelist):
mine... | import heapq
import sys
def main():
input = sys.stdin.readline
def dijkstra(s,edge):
#始点sから各頂点への最短距離
d = [10**20] * n
used = [True] * n #True:未確定
d[s] = 0
used[s] = False
edgelist = []
for a,b in edge[s]:
heapq.heappush(edgelist,a... | 46 | 53 | 1,103 | 1,392 | import heapq
import sys
input = sys.stdin.readline
def dijkstra(s, edge):
# 始点sから各頂点への最短距離
d = [10**20] * n
used = [True] * n # True:未確定
d[s] = 0
used[s] = False
edgelist = []
for a, b in edge[s]:
heapq.heappush(edgelist, a * (10**6) + b)
while len(edgelist):
minedge ... | import heapq
import sys
def main():
input = sys.stdin.readline
def dijkstra(s, edge):
# 始点sから各頂点への最短距離
d = [10**20] * n
used = [True] * n # True:未確定
d[s] = 0
used[s] = False
edgelist = []
for a, b in edge[s]:
heapq.heappush(edgelist, a * (1... | false | 13.207547 | [
"-input = sys.stdin.readline",
"+",
"+def main():",
"+ input = sys.stdin.readline",
"+",
"+ def dijkstra(s, edge):",
"+ # 始点sから各頂点への最短距離",
"+ d = [10**20] * n",
"+ used = [True] * n # True:未確定",
"+ d[s] = 0",
"+ used[s] = False",
"+ edgelist = [... | false | 0.039154 | 0.039737 | 0.985333 | [
"s022981746",
"s504722367"
] |
u318127926 | p02802 | python | s650871934 | s238545856 | 312 | 288 | 4,596 | 19,732 | Accepted | Accepted | 7.69 | n, m = list(map(int, input().split()))
is_ac = [False]*n
ac = 0
was = [0]*n
for _ in range(m):
p, s = input().split()
p = int(p) - 1
if s=='AC' and (not is_ac[p]):
ac += 1
is_ac[p] = True
if s=='WA' and (not is_ac[p]):
was[p] += 1
wa = 0
for i in range(n):
if is... | n, m = list(map(int, input().split()))
ps = []
for _ in range(m):
p, s = input().split()
ps.append((int(p), s))
was = [0]*(n+1)
total_ac = 0
total_wa = 0
for p, s in ps:
if was[p]<0:
continue
if s=='AC':
total_wa += was[p]
total_ac += 1
was[p] = -1
else... | 17 | 18 | 358 | 363 | n, m = list(map(int, input().split()))
is_ac = [False] * n
ac = 0
was = [0] * n
for _ in range(m):
p, s = input().split()
p = int(p) - 1
if s == "AC" and (not is_ac[p]):
ac += 1
is_ac[p] = True
if s == "WA" and (not is_ac[p]):
was[p] += 1
wa = 0
for i in range(n):
if is_ac[i]... | n, m = list(map(int, input().split()))
ps = []
for _ in range(m):
p, s = input().split()
ps.append((int(p), s))
was = [0] * (n + 1)
total_ac = 0
total_wa = 0
for p, s in ps:
if was[p] < 0:
continue
if s == "AC":
total_wa += was[p]
total_ac += 1
was[p] = -1
else:
... | false | 5.555556 | [
"-is_ac = [False] * n",
"-ac = 0",
"-was = [0] * n",
"+ps = []",
"- p = int(p) - 1",
"- if s == \"AC\" and (not is_ac[p]):",
"- ac += 1",
"- is_ac[p] = True",
"- if s == \"WA\" and (not is_ac[p]):",
"+ ps.append((int(p), s))",
"+was = [0] * (n + 1)",
"+total_ac = 0",
... | false | 0.044328 | 0.047674 | 0.9298 | [
"s650871934",
"s238545856"
] |
u405660020 | p02834 | python | s496009599 | s846155553 | 956 | 803 | 124,796 | 106,588 | Accepted | Accepted | 16 | import sys
sys.setrecursionlimit(10**7)
n,u,v=list(map(int, input().split()))
u-=1
v-=1
graph = [[] for _ in range(n+1)]
# for i in range(n-1):
# a, b=map(int, input().split())
# graph[a-1].append(b-1)
# graph[b-1].append(a-1)
ab=[list(map(int, input().split())) for _ in range(n-1)]
for a... | import sys
sys.setrecursionlimit(10**7)
n,u,v=list(map(int, input().split()))
u-=1
v-=1
graph = [[] for _ in range(n+1)]
for i in range(n-1):
a, b=list(map(int, input().split()))
graph[a-1].append(b-1)
graph[b-1].append(a-1)
# ab=[list(map(int, input().split())) for _ in range(n-1)]
# for... | 45 | 45 | 920 | 920 | import sys
sys.setrecursionlimit(10**7)
n, u, v = list(map(int, input().split()))
u -= 1
v -= 1
graph = [[] for _ in range(n + 1)]
# for i in range(n-1):
# a, b=map(int, input().split())
# graph[a-1].append(b-1)
# graph[b-1].append(a-1)
ab = [list(map(int, input().split())) for _ in range(n - 1)]
for a, b ... | import sys
sys.setrecursionlimit(10**7)
n, u, v = list(map(int, input().split()))
u -= 1
v -= 1
graph = [[] for _ in range(n + 1)]
for i in range(n - 1):
a, b = list(map(int, input().split()))
graph[a - 1].append(b - 1)
graph[b - 1].append(a - 1)
# ab=[list(map(int, input().split())) for _ in range(n-1)]
#... | false | 0 | [
"-# for i in range(n-1):",
"-# a, b=map(int, input().split())",
"+for i in range(n - 1):",
"+ a, b = list(map(int, input().split()))",
"+ graph[a - 1].append(b - 1)",
"+ graph[b - 1].append(a - 1)",
"+# ab=[list(map(int, input().split())) for _ in range(n-1)]",
"+# for a,b in ab:",
"-ab... | false | 0.040645 | 0.035619 | 1.141101 | [
"s496009599",
"s846155553"
] |
u528470578 | p04001 | python | s501726456 | s251946151 | 202 | 34 | 40,048 | 3,064 | Accepted | Accepted | 83.17 | S = eval(input())
op_cnt = len(S) - 1
ans = 0
for i in range(2 ** 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 + [""]):
if p_o == "+":
formula += (p_n +... | S = eval(input())
ls = len(S)
ans = 0
for i in range(2 ** (ls-1)):
susiki = ""
shiki = []
for j in range(ls-1):
if (i >> j) & 1:
shiki.append("+")
else:
shiki.append("")
for k in range(ls):
if k == ls - 1:
susiki = susiki... | 20 | 21 | 402 | 422 | S = eval(input())
op_cnt = len(S) - 1
ans = 0
for i in range(2**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 + [""]):
if p_o == "+":
formula += p_n + p_o
else:
... | S = eval(input())
ls = len(S)
ans = 0
for i in range(2 ** (ls - 1)):
susiki = ""
shiki = []
for j in range(ls - 1):
if (i >> j) & 1:
shiki.append("+")
else:
shiki.append("")
for k in range(ls):
if k == ls - 1:
susiki = susiki + S[k]
els... | false | 4.761905 | [
"-op_cnt = len(S) - 1",
"+ls = len(S)",
"-for i in range(2**op_cnt):",
"- op = [\"-\"] * op_cnt",
"- for j in range(op_cnt):",
"+for i in range(2 ** (ls - 1)):",
"+ susiki = \"\"",
"+ shiki = []",
"+ for j in range(ls - 1):",
"- op[op_cnt - 1 - j] = \"+\"",
"- formul... | false | 0.045763 | 0.007087 | 6.457532 | [
"s501726456",
"s251946151"
] |
u489959379 | p02984 | python | s897825711 | s603007819 | 153 | 127 | 16,968 | 14,108 | Accepted | Accepted | 16.99 | n = int(eval(input()))
a = list(map(int, input().split()))
x_2 = 0
for i in range(n):
if i % 2:
x_2 -= a[i]
else:
x_2 += a[i]
ans = [0 for _ in range(n)]
for j in range(n):
if j == 0:
ans[j] = x_2 // 2
else:
ans[j] = a[j - 1] - ans[j - 1]
print((*[a * ... | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
B = [0] * n
for i in range(n):
B[0] += A[i] if i % 2 == 0 else -A[i]
for j in range(1, n)... | 18 | 24 | 330 | 420 | n = int(eval(input()))
a = list(map(int, input().split()))
x_2 = 0
for i in range(n):
if i % 2:
x_2 -= a[i]
else:
x_2 += a[i]
ans = [0 for _ in range(n)]
for j in range(n):
if j == 0:
ans[j] = x_2 // 2
else:
ans[j] = a[j - 1] - ans[j - 1]
print((*[a * 2 for a in ans]))
| import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
B = [0] * n
for i in range(n):
B[0] += A[i] if i % 2 == 0 else -A[i]
for j in range(1, n):
B[j] = 2 * A... | false | 25 | [
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-x_2 = 0",
"-for i in range(n):",
"- if i % 2:",
"- x_2 -= a[i]",
"- else:",
"- x_2 += a[i]",
"-ans = [0 for _ in range(n)]",
"-for j in range(n):",
"- if j == 0:",
"- ans[j] = x_2 // 2",
"- ... | false | 0.036516 | 0.044037 | 0.829203 | [
"s897825711",
"s603007819"
] |
u352394527 | p00042 | python | s168753016 | s467078962 | 1,230 | 540 | 16,336 | 16,340 | Accepted | Accepted | 56.1 | case = 0
while True:
case += 1
W = int(eval(input()))
if (W == 0):
break
N = int(eval(input()))
vl = [0]
wl = [0]
for i in range(N):
(v,w) = tuple(map(int,input().split(",")))
vl.append(v)
wl.append(w)
dp = [[0 for i in range(W+1)] for j in range(N+1)]
for i in range(1,N+... | """
0-1ナップザック
dp[i][j]...i個目までの宝で重さjの時の価値の最大
wi = wlst[i]...i個目の重さ
vi = vlst[i]...i個目の価値
dp[i][j] = max(dp[i - 1][j], dp[i][j - 1], dp[i - 1][j - wi] + vi) (wi <= j)
dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]) (wi > j)
"""
def main():
case = 0
while True:
w = int(eval(... | 26 | 51 | 635 | 1,085 | case = 0
while True:
case += 1
W = int(eval(input()))
if W == 0:
break
N = int(eval(input()))
vl = [0]
wl = [0]
for i in range(N):
(v, w) = tuple(map(int, input().split(",")))
vl.append(v)
wl.append(w)
dp = [[0 for i in range(W + 1)] for j in range(N + 1)]... | """
0-1ナップザック
dp[i][j]...i個目までの宝で重さjの時の価値の最大
wi = wlst[i]...i個目の重さ
vi = vlst[i]...i個目の価値
dp[i][j] = max(dp[i - 1][j], dp[i][j - 1], dp[i - 1][j - wi] + vi) (wi <= j)
dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]) (wi > j)
"""
def main():
case = 0
while True:
w = int(eval(input()... | false | 49.019608 | [
"-case = 0",
"-while True:",
"- case += 1",
"- W = int(eval(input()))",
"- if W == 0:",
"- break",
"- N = int(eval(input()))",
"- vl = [0]",
"- wl = [0]",
"- for i in range(N):",
"- (v, w) = tuple(map(int, input().split(\",\")))",
"- vl.append(v)",
"... | false | 0.036212 | 0.040705 | 0.889629 | [
"s168753016",
"s467078962"
] |
u564589929 | p03436 | python | s214791273 | s453314857 | 152 | 24 | 12,300 | 3,420 | Accepted | Accepted | 84.21 | import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline ####
def int1(x): return int(x) - 1
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LI1(): return... | import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline ####
def int1(x): return int(x) - 1
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LI1(): return... | 66 | 66 | 1,985 | 1,989 | import sys
sys.setrecursionlimit(10**9)
# input = sys.stdin.readline ####
def int1(x):
return int(x) - 1
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MI1():
return list(map(int1, input().split()))
def LI():
return list(map(int, input().split())... | import sys
sys.setrecursionlimit(10**9)
# input = sys.stdin.readline ####
def int1(x):
return int(x) - 1
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MI1():
return list(map(int1, input().split()))
def LI():
return list(map(int, input().split())... | false | 0 | [
"-import numpy as np",
"-",
"+# import numpy as np",
"-from pprint import pprint",
"-",
"-",
"+# from pprint import pprint"
] | false | 0.055816 | 0.037551 | 1.486388 | [
"s214791273",
"s453314857"
] |
u029169777 | p03574 | python | s320356386 | s463225007 | 32 | 22 | 3,064 | 3,064 | Accepted | Accepted | 31.25 | H,W=list(map(int,input().split()))
P=[]
for i in range(H):
S=list(eval(input()))
P.append(S)
dx=[-1,-1,-1,0,1,1,1,0]
dy=[-1,0,1,1,1,0,-1,-1]
for i in range(H):
for j in range(W):
if P[i][j]=='.':
count=0
for k in range(8):
x=i+dx[k]
y=j+dy[k]
if x<H an... | H,W=list(map(int,input().split()))
Mine=[]
for i in range(H):
Mine.append(list(eval(input())))
for i in range(H):
answer=[]
for j in range(W):
if Mine[i][j]=='#':
answer.append('#')
else:
count=0
if i!=0:
if j!=0:
if Mine[i-1][j-1]=='#':
count+... | 30 | 37 | 556 | 854 | H, W = list(map(int, input().split()))
P = []
for i in range(H):
S = list(eval(input()))
P.append(S)
dx = [-1, -1, -1, 0, 1, 1, 1, 0]
dy = [-1, 0, 1, 1, 1, 0, -1, -1]
for i in range(H):
for j in range(W):
if P[i][j] == ".":
count = 0
for k in range(8):
x = i +... | H, W = list(map(int, input().split()))
Mine = []
for i in range(H):
Mine.append(list(eval(input())))
for i in range(H):
answer = []
for j in range(W):
if Mine[i][j] == "#":
answer.append("#")
else:
count = 0
if i != 0:
if j != 0:
... | false | 18.918919 | [
"-P = []",
"+Mine = []",
"- S = list(eval(input()))",
"- P.append(S)",
"-dx = [-1, -1, -1, 0, 1, 1, 1, 0]",
"-dy = [-1, 0, 1, 1, 1, 0, -1, -1]",
"+ Mine.append(list(eval(input())))",
"+ answer = []",
"- if P[i][j] == \".\":",
"+ if Mine[i][j] == \"#\":",
"+ a... | false | 0.040527 | 0.080551 | 0.503122 | [
"s320356386",
"s463225007"
] |
u860829879 | p03682 | python | s171358901 | s918393594 | 1,238 | 825 | 133,468 | 120,256 | Accepted | Accepted | 33.36 | import heapq
n=int(eval(input()))
pts=[list(map(int,input().split())) for _ in range(n)]
x=sorted([(i,pts[i][0]) for i in range(n)],key=lambda x:x[1])
y=sorted([(i,pts[i][1]) for i in range(n)],key=lambda x:x[1])
invx=[0]*n
invy=[0]*n
for i in range(n):
cx,_=x[i]
invx[cx]=i
cy,_=y[i]
... | import heapq
n=int(eval(input()))
pts=[list(map(int,input().split())) for _ in range(n)]
x=sorted([(i,pts[i][0]) for i in range(n)],key=lambda x:x[1])
y=sorted([(i,pts[i][1]) for i in range(n)],key=lambda x:x[1])
invx=[0]*n
invy=[0]*n
for i in range(n):
invx[x[i][0]]=i
invy[y[i][0]]=i
q=[(0,... | 49 | 41 | 956 | 788 | import heapq
n = int(eval(input()))
pts = [list(map(int, input().split())) for _ in range(n)]
x = sorted([(i, pts[i][0]) for i in range(n)], key=lambda x: x[1])
y = sorted([(i, pts[i][1]) for i in range(n)], key=lambda x: x[1])
invx = [0] * n
invy = [0] * n
for i in range(n):
cx, _ = x[i]
invx[cx] = i
cy, ... | import heapq
n = int(eval(input()))
pts = [list(map(int, input().split())) for _ in range(n)]
x = sorted([(i, pts[i][0]) for i in range(n)], key=lambda x: x[1])
y = sorted([(i, pts[i][1]) for i in range(n)], key=lambda x: x[1])
invx = [0] * n
invy = [0] * n
for i in range(n):
invx[x[i][0]] = i
invy[y[i][0]] = ... | false | 16.326531 | [
"- cx, _ = x[i]",
"- invx[cx] = i",
"- cy, _ = y[i]",
"- invy[cy] = i",
"-xi = invx[0]",
"-yi = invy[0]",
"+ invx[x[i][0]] = i",
"+ invy[y[i][0]] = i",
"- if xi > 0 and visit[x[xi - 1][0]] == 0:",
"- heapq.heappush(q, (x[xi][1] - x[xi - 1][1], x[xi - 1][0]))",
"- i... | false | 0.040253 | 0.038942 | 1.033667 | [
"s171358901",
"s918393594"
] |
u200887663 | p02720 | python | s621797838 | s334231468 | 497 | 131 | 70,616 | 12,304 | Accepted | Accepted | 73.64 | k=int(eval(input()))
#a,b=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
from collections import deque
q=deque([1,2,3,4,5,6,7,8,9])
ansl=[]
s=1
while len(str(s))<=10:
s=q.popleft()
ansl.append(s)
sl=list(str(s))
last_digit... | k=int(eval(input()))
#n,p=map(int,input().split())
#al=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
#素因数分解した結果を2次元配列にして返す
all_list=[]
def rec(d,val):
global all_list
all_list.append(val)
if d==10:
return
for j in range(-1,2,1):
add=... | 20 | 22 | 524 | 464 | k = int(eval(input()))
# a,b=map(int,input().split())
# l=list(map(int,input().split()))
# l=[list(map(int,input().split())) for i in range(n)]
from collections import deque
q = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])
ansl = []
s = 1
while len(str(s)) <= 10:
s = q.popleft()
ansl.append(s)
sl = list(str(s))
... | k = int(eval(input()))
# n,p=map(int,input().split())
# al=list(map(int,input().split()))
# l=[list(map(int,input().split())) for i in range(n)]
# 素因数分解した結果を2次元配列にして返す
all_list = []
def rec(d, val):
global all_list
all_list.append(val)
if d == 10:
return
for j in range(-1, 2, 1):
add =... | false | 9.090909 | [
"-# a,b=map(int,input().split())",
"-# l=list(map(int,input().split()))",
"+# n,p=map(int,input().split())",
"+# al=list(map(int,input().split()))",
"-from collections import deque",
"+# 素因数分解した結果を2次元配列にして返す",
"+all_list = []",
"-q = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])",
"-ansl = []",
"-s = 1",
"... | false | 2.518493 | 0.216665 | 11.623929 | [
"s621797838",
"s334231468"
] |
u855199458 | p02363 | python | s855053513 | s655496388 | 740 | 490 | 8,348 | 6,172 | Accepted | Accepted | 33.78 | # -*- coding: utf-8 -*-
def inpl(): return tuple(map(int, input().split()))
INF = float("inf")
V, E = inpl()
adj = [[] for _ in range(V)]
D = [[INF]*V for _ in range(V)]
for _ in range(E):
s, t, d = inpl()
D[s][t] = d
D[t][t] = d
for v in range(V):
D[v][v] = 0
for k in range(V):
... | # -*- coding: utf-8 -*-
def inpl(): return tuple(map(int, input().split()))
INF = float("inf")
V, E = inpl()
adj = [[] for _ in range(V)]
D = [[INF]*V for _ in range(V)]
for _ in range(E):
s, t, d = inpl()
D[s][t] = d
for v in range(V):
D[v][v] = 0
def WarshallFloyd(G):
V = le... | 31 | 33 | 660 | 691 | # -*- coding: utf-8 -*-
def inpl():
return tuple(map(int, input().split()))
INF = float("inf")
V, E = inpl()
adj = [[] for _ in range(V)]
D = [[INF] * V for _ in range(V)]
for _ in range(E):
s, t, d = inpl()
D[s][t] = d
D[t][t] = d
for v in range(V):
D[v][v] = 0
for k in range(V):
for i in ran... | # -*- coding: utf-8 -*-
def inpl():
return tuple(map(int, input().split()))
INF = float("inf")
V, E = inpl()
adj = [[] for _ in range(V)]
D = [[INF] * V for _ in range(V)]
for _ in range(E):
s, t, d = inpl()
D[s][t] = d
for v in range(V):
D[v][v] = 0
def WarshallFloyd(G):
V = len(G)
for k in... | false | 6.060606 | [
"- D[t][t] = d",
"-for k in range(V):",
"- for i in range(V):",
"- if D[i][k] == INF:",
"- continue",
"- for j in range(V):",
"- D[i][j] = min(D[i][j], D[i][k] + D[k][j])",
"+",
"+",
"+def WarshallFloyd(G):",
"+ V = len(G)",
"+ for k in range(V):... | false | 0.036442 | 0.035458 | 1.027762 | [
"s855053513",
"s655496388"
] |
u893063840 | p03557 | python | s635075487 | s270541036 | 347 | 317 | 23,328 | 26,016 | Accepted | Accepted | 8.65 | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
import bisect
ans = 0
for j in range(n):
i = bisect.bisect_left(a, b[j])
k = bisect.bisect_right(c, b[j])
ans += i * (n - k)
prin... | from bisect import bisect_left
from itertools import accumulate
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
ba_cnt = [bisect_left(a, e) for e in b]
ba_acm = [0] + list(accumulate(ba_cnt))
... | 18 | 21 | 321 | 399 | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
import bisect
ans = 0
for j in range(n):
i = bisect.bisect_left(a, b[j])
k = bisect.bisect_right(c, b[j])
ans += i * (n - k)
print(ans)
| from bisect import bisect_left
from itertools import accumulate
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
ba_cnt = [bisect_left(a, e) for e in b]
ba_acm = [0] + list(accumulate(ba_cnt))
ans = 0
for e in ... | false | 14.285714 | [
"+from bisect import bisect_left",
"+from itertools import accumulate",
"+",
"-import bisect",
"-",
"+ba_cnt = [bisect_left(a, e) for e in b]",
"+ba_acm = [0] + list(accumulate(ba_cnt))",
"-for j in range(n):",
"- i = bisect.bisect_left(a, b[j])",
"- k = bisect.bisect_right(c, b[j])",
"- ... | false | 0.208007 | 0.124341 | 1.672876 | [
"s635075487",
"s270541036"
] |
u038408819 | p02743 | python | s139040313 | s413339440 | 36 | 17 | 5,076 | 2,940 | Accepted | Accepted | 52.78 | import math
from decimal import Decimal
a, b, c = list(map(int, input().split()))
A = Decimal(str(a))**Decimal('0.5')
B = Decimal(str(b))**Decimal('0.5')
C = Decimal(str(c))**Decimal('0.5')
if A + B < C:
print('Yes')
else:
print('No') | a, b, c = list(map(int, input().split()))
#import numpy as np
import math
#abc_sq = np.sqrt(abc)
d = c - a - b
if 4*a*b < d**2 and d > 0:
print('Yes')
else:
print('No')
| 10 | 10 | 245 | 181 | import math
from decimal import Decimal
a, b, c = list(map(int, input().split()))
A = Decimal(str(a)) ** Decimal("0.5")
B = Decimal(str(b)) ** Decimal("0.5")
C = Decimal(str(c)) ** Decimal("0.5")
if A + B < C:
print("Yes")
else:
print("No")
| a, b, c = list(map(int, input().split()))
# import numpy as np
import math
# abc_sq = np.sqrt(abc)
d = c - a - b
if 4 * a * b < d**2 and d > 0:
print("Yes")
else:
print("No")
| false | 0 | [
"+a, b, c = list(map(int, input().split()))",
"+# import numpy as np",
"-from decimal import Decimal",
"-a, b, c = list(map(int, input().split()))",
"-A = Decimal(str(a)) ** Decimal(\"0.5\")",
"-B = Decimal(str(b)) ** Decimal(\"0.5\")",
"-C = Decimal(str(c)) ** Decimal(\"0.5\")",
"-if A + B < C:",
"... | false | 0.04313 | 0.05569 | 0.774457 | [
"s139040313",
"s413339440"
] |
u867826040 | p04045 | python | s311132908 | s233228873 | 85 | 49 | 2,940 | 9,180 | Accepted | Accepted | 42.35 | n,k = list(map(int,input().split()))
d = input().split()
f = True
while(f):
for s in d:
if s in str(n):
_ = n
n += 1
break
else:
break
print(n) | n,k = list(map(int,input().split()))
d = list(map(int,input().split()))
while(True):
x = n
while(x):
if x%10 in d:
break
x//=10
else:
print(n)
quit(0)
n += 1 | 14 | 13 | 182 | 224 | n, k = list(map(int, input().split()))
d = input().split()
f = True
while f:
for s in d:
if s in str(n):
_ = n
n += 1
break
else:
break
print(n)
| n, k = list(map(int, input().split()))
d = list(map(int, input().split()))
while True:
x = n
while x:
if x % 10 in d:
break
x //= 10
else:
print(n)
quit(0)
n += 1
| false | 7.142857 | [
"-d = input().split()",
"-f = True",
"-while f:",
"- for s in d:",
"- if s in str(n):",
"- _ = n",
"- n += 1",
"+d = list(map(int, input().split()))",
"+while True:",
"+ x = n",
"+ while x:",
"+ if x % 10 in d:",
"+ x //= 10",
"- b... | false | 0.045291 | 0.039073 | 1.159152 | [
"s311132908",
"s233228873"
] |
u067975558 | p02412 | python | s203275517 | s519759368 | 560 | 250 | 6,724 | 6,724 | Accepted | Accepted | 55.36 | while True:
(n, x) = [int(i) for i in input().split()]
if n == x == 0: break
count = 0
for i in range(1,n - 1):
for j in range(i + 1 ,n):
for k in range(j + 1 ,n + 1):
if i + j + k == x:
count += 1
break
print(co... | while True:
(n, x) = [int(i) for i in input().split()]
if n == x == 0: break
count = 0
for i in range(1,n - 1):
for j in range(i + 1 ,n):
if i + j + j + 1 > x: break
for k in range(j + 1 ,n + 1):
if i + j + k == x:
count += 1
... | 11 | 12 | 324 | 363 | while True:
(n, x) = [int(i) for i in input().split()]
if n == x == 0:
break
count = 0
for i in range(1, n - 1):
for j in range(i + 1, n):
for k in range(j + 1, n + 1):
if i + j + k == x:
count += 1
break
print(count... | while True:
(n, x) = [int(i) for i in input().split()]
if n == x == 0:
break
count = 0
for i in range(1, n - 1):
for j in range(i + 1, n):
if i + j + j + 1 > x:
break
for k in range(j + 1, n + 1):
if i + j + k == x:
... | false | 8.333333 | [
"+ if i + j + j + 1 > x:",
"+ break"
] | false | 0.037594 | 0.037633 | 0.998972 | [
"s203275517",
"s519759368"
] |
u223663729 | p02586 | python | s855657780 | s134680710 | 1,772 | 1,091 | 110,536 | 107,924 | Accepted | Accepted | 38.43 | import sys
read = sys.stdin.buffer.read
readlines = sys.stdin.buffer.readlines
input = sys.stdin.buffer.readline
H, W, K = list(map(int, input().split()))
B = {}
for _ in range(K):
r, c, v = list(map(int, input().split()))
B[(r-1,c-1)] = v
dp = [[0]*(W+1) for _ in range(4)]
for i in range(H):
... | import sys
input = sys.stdin.buffer.readline
H, W, K = list(map(int, input().split()))
B = {}
for _ in range(K):
r, c, v = list(map(int, input().split()))
B[(r, c)] = v
dp = [[0]*(W+1) for _ in range(4)]
for i in range(1, H+1):
for j in range(1, W+1):
if (i, j) in B:
v = B... | 27 | 25 | 877 | 800 | import sys
read = sys.stdin.buffer.read
readlines = sys.stdin.buffer.readlines
input = sys.stdin.buffer.readline
H, W, K = list(map(int, input().split()))
B = {}
for _ in range(K):
r, c, v = list(map(int, input().split()))
B[(r - 1, c - 1)] = v
dp = [[0] * (W + 1) for _ in range(4)]
for i in range(H):
for ... | import sys
input = sys.stdin.buffer.readline
H, W, K = list(map(int, input().split()))
B = {}
for _ in range(K):
r, c, v = list(map(int, input().split()))
B[(r, c)] = v
dp = [[0] * (W + 1) for _ in range(4)]
for i in range(1, H + 1):
for j in range(1, W + 1):
if (i, j) in B:
v = B[(i, j... | false | 7.407407 | [
"-read = sys.stdin.buffer.read",
"-readlines = sys.stdin.buffer.readlines",
"- B[(r - 1, c - 1)] = v",
"+ B[(r, c)] = v",
"-for i in range(H):",
"- for j in range(W):",
"+for i in range(1, H + 1):",
"+ for j in range(1, W + 1):",
"- dp[0][j + 1] = max(",
"- dp... | false | 0.076259 | 0.037547 | 2.031013 | [
"s855657780",
"s134680710"
] |
u426683236 | p03564 | python | s913669569 | s623872339 | 175 | 27 | 38,256 | 9,104 | Accepted | Accepted | 84.57 | N=int(eval(input()))
K=int(eval(input()))
n=1
for i in range(N):
if n<K:
n*=2
else:
n+=K
print(n)
| def solve():
n = int(eval(input()))
k = int(eval(input()))
ans = 1
for i in range(n):
if ans < k:
ans *= 2
else:
ans += k
print(ans)
if __name__ == "__main__":
solve()
| 9 | 15 | 118 | 237 | N = int(eval(input()))
K = int(eval(input()))
n = 1
for i in range(N):
if n < K:
n *= 2
else:
n += K
print(n)
| def solve():
n = int(eval(input()))
k = int(eval(input()))
ans = 1
for i in range(n):
if ans < k:
ans *= 2
else:
ans += k
print(ans)
if __name__ == "__main__":
solve()
| false | 40 | [
"-N = int(eval(input()))",
"-K = int(eval(input()))",
"-n = 1",
"-for i in range(N):",
"- if n < K:",
"- n *= 2",
"- else:",
"- n += K",
"-print(n)",
"+def solve():",
"+ n = int(eval(input()))",
"+ k = int(eval(input()))",
"+ ans = 1",
"+ for i in range(n):"... | false | 0.037205 | 0.04395 | 0.846528 | [
"s913669569",
"s623872339"
] |
u811733736 | p02390 | python | s498705744 | s810568985 | 40 | 20 | 7,636 | 7,768 | Accepted | Accepted | 50 | if __name__ == '__main__':
time_in_second = int(eval(input()))
hour = time_in_second // 3600
minute = (time_in_second % 3600) // 60
second = time_in_second % 60
print(('{0:d}:{1:d}:{2:d}'.format(hour, minute, second))) | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_D&lang=jp
"""
import sys
from sys import stdin
input = stdin.readline
def main(args):
S = int(eval(input()))
h = S // 3600
m = (S % 3600) // 60
s = S % 60
print(('{}:{}:{}'.format(h, m, s)... | 8 | 22 | 239 | 376 | if __name__ == "__main__":
time_in_second = int(eval(input()))
hour = time_in_second // 3600
minute = (time_in_second % 3600) // 60
second = time_in_second % 60
print(("{0:d}:{1:d}:{2:d}".format(hour, minute, second)))
| # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_D&lang=jp
"""
import sys
from sys import stdin
input = stdin.readline
def main(args):
S = int(eval(input()))
h = S // 3600
m = (S % 3600) // 60
s = S % 60
print(("{}:{}:{}".format(h, m, s)))
if __name__ ... | false | 63.636364 | [
"+# -*- coding: utf-8 -*-",
"+\"\"\"",
"+http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_D&lang=jp",
"+\"\"\"",
"+import sys",
"+from sys import stdin",
"+",
"+input = stdin.readline",
"+",
"+",
"+def main(args):",
"+ S = int(eval(input()))",
"+ h = S // 3600",
"+ ... | false | 0.047664 | 0.108359 | 0.439872 | [
"s498705744",
"s810568985"
] |
u585482323 | p03600 | python | s329833402 | s603832035 | 850 | 635 | 44,892 | 45,424 | Accepted | Accepted | 25.29 | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, ... | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline()... | 106 | 52 | 1,911 | 1,311 | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return list(map(int, sys.stdin.readline().split()))
def I():
return int(sys.stdin.readline())
def LS():
return list(m... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
return [list(x) for x in sys.stdin... | false | 50.943396 | [
"-from collections import defaultdict",
"-from collections import deque",
"+from collections import defaultdict, deque",
"- return list(map(int, sys.stdin.readline().split()))",
"+ return [int(x) for x in sys.stdin.readline().split()]",
"- return list(map(list, sys.stdin.readline().split()))",
... | false | 0.047303 | 0.049242 | 0.960622 | [
"s329833402",
"s603832035"
] |
u747602774 | p03786 | python | s297349945 | s105400645 | 282 | 136 | 14,480 | 14,320 | Accepted | Accepted | 51.77 | def cumulative_sum(l):
cumu = [0]
s = 0
for num in l:
s += num
cumu.append(s)
return cumu
N = int(eval(input()))
A = list(map(int,input().split()))
A.sort()
C = cumulative_sum(A)
AM = [C[i+1] for i in range(N)]
k = 1
for i in range(N):
AM[i] = max(AM[i],AM[max... | def cumulative_sum(l):
cumu = [0]
s = 0
for num in l:
s += num
cumu.append(s)
return cumu
N = int(eval(input()))
A = list(map(int,input().split()))
A.sort()
C = cumulative_sum(A)
AM = [C[i+1] for i in range(N)]
ans = 1
for i in range(1,N):
if 2*AM[-1-i] >= A[-... | 34 | 24 | 565 | 373 | def cumulative_sum(l):
cumu = [0]
s = 0
for num in l:
s += num
cumu.append(s)
return cumu
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
C = cumulative_sum(A)
AM = [C[i + 1] for i in range(N)]
k = 1
for i in range(N):
AM[i] = max(AM[i], AM[max(0, i - 1)])
f... | def cumulative_sum(l):
cumu = [0]
s = 0
for num in l:
s += num
cumu.append(s)
return cumu
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
C = cumulative_sum(A)
AM = [C[i + 1] for i in range(N)]
ans = 1
for i in range(1, N):
if 2 * AM[-1 - i] >= A[-i]:
an... | false | 29.411765 | [
"-k = 1",
"-for i in range(N):",
"- AM[i] = max(AM[i], AM[max(0, i - 1)])",
"- for j in range(max(k, i + 1), N):",
"- if AM[i] * 2 >= A[j]:",
"- AM[i] += A[j]",
"- k = j + 1",
"- else:",
"- break",
"-S = sum(A)",
"-ans = 0",
"-for i in range... | false | 0.046132 | 0.036619 | 1.259791 | [
"s297349945",
"s105400645"
] |
u647766105 | p00147 | python | s344232851 | s443109756 | 30 | 20 | 4,520 | 4,512 | Accepted | Accepted | 33.33 | #Fukushimaken:
from heapq import heappop, heappush
OUT, IN = 0, 1
def P(i):
return 31 if i % 5 == 1 else 3
def M(i):
return 17 * (i % 2) + 3 * (i % 3) + 19
def check(c, n):
for i in range(16):
if (c >> i) & n == 0:
return i
return None
ans = [-1] * 100 + [0]
eq = ... | #Fukushimaken:
from heapq import heappop, heappush
def P(i):
return 31 if i % 5 == 1 else 3
def M(i):
return 17 * (i % 2) + 3 * (i % 3) + 19
def check(c, n):
for i in range(16):
if (c >> i) & n == 0:
return i
return None
ans = [-1] * 100 + [0]
eq = [(i * 5, i, None... | 37 | 35 | 867 | 820 | # Fukushimaken:
from heapq import heappop, heappush
OUT, IN = 0, 1
def P(i):
return 31 if i % 5 == 1 else 3
def M(i):
return 17 * (i % 2) + 3 * (i % 3) + 19
def check(c, n):
for i in range(16):
if (c >> i) & n == 0:
return i
return None
ans = [-1] * 100 + [0]
eq = [(i * 5, i... | # Fukushimaken:
from heapq import heappop, heappush
def P(i):
return 31 if i % 5 == 1 else 3
def M(i):
return 17 * (i % 2) + 3 * (i % 3) + 19
def check(c, n):
for i in range(16):
if (c >> i) & n == 0:
return i
return None
ans = [-1] * 100 + [0]
eq = [(i * 5, i, None, P(i)) fo... | false | 5.405405 | [
"-",
"-OUT, IN = 0, 1",
"-eq = [(i * 5, i, IN, None, P(i)) for i in range(100)]",
"+eq = [(i * 5, i, None, P(i)) for i in range(100)]",
"- m, n, et, i, p = heappop(eq)",
"- if et == IN:",
"+ m, n, i, p = heappop(eq)",
"+ if i is None:",
"- heappush(eq, (m + M(n), n, OUT, i, p)... | false | 0.045481 | 0.044849 | 1.014094 | [
"s344232851",
"s443109756"
] |
u408071652 | p03168 | python | s286523109 | s322284232 | 295 | 145 | 223,932 | 70,924 | Accepted | Accepted | 50.85 | import sys
sys.setrecursionlimit(10 ** 9)
# map(int, sys.stdin.read().split())
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(eval(input()))
P = list(map(float,input().split()))
dp = [[0 for _ in range(N+1)] for i in range(N+1)] #i枚投げたときの j表が出た枚 のdpが確立
... | import sys
import math
# \n
def input():
return sys.stdin.readline().rstrip()
def main():
N=int(eval(input()))
P=list(map(float,input().split()))
dp=[0]*(N+1)
dp[0]=1
for j in range(N):
p =P[j]
for i in range(N, -1, -1):
dp[i] = dp[i]*(1-p)
... | 29 | 33 | 560 | 476 | import sys
sys.setrecursionlimit(10**9)
# map(int, sys.stdin.read().split())
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(eval(input()))
P = list(map(float, input().split()))
dp = [[0 for _ in range(N + 1)] for i in range(N + 1)] # i枚投げたときの j表が出た枚 のdpが確立
dp[0][0] = 1
... | import sys
import math
# \n
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(eval(input()))
P = list(map(float, input().split()))
dp = [0] * (N + 1)
dp[0] = 1
for j in range(N):
p = P[j]
for i in range(N, -1, -1):
dp[i] = dp[i] * (1 - p)
... | false | 12.121212 | [
"+import math",
"-sys.setrecursionlimit(10**9)",
"-# map(int, sys.stdin.read().split())",
"+# \\n",
"- dp = [[0 for _ in range(N + 1)] for i in range(N + 1)] # i枚投げたときの j表が出た枚 のdpが確立",
"- dp[0][0] = 1",
"- for i in range(1, N + 1):",
"- for j in range(0, i + 1):",
"- dp[i... | false | 0.037514 | 0.037783 | 0.992887 | [
"s286523109",
"s322284232"
] |
u150984829 | p02288 | python | s404343654 | s584198836 | 830 | 730 | 63,672 | 65,080 | Accepted | Accepted | 12.05 | eval(input())
A=[0]+list(map(int,input().split()))
H=len(A)
def h(i):
l=2*i;r,g=l+1,[i,l][l<H and A[i]<A[l]]
if r<H and A[g]<A[r]:g=r
if g!=i:A[i],A[g]=A[g],A[i];h(g)
for i in range(H//2,0,-1):h(i)
a=''
for s in A[1:]:a+=f' {s}'
print(a)
| eval(input())
A=[0]+list(map(int,input().split()))
H=len(A)
def h(i):
l=2*i;r,g=l+1,[i,l][l<H and A[i]<A[l]]
if r<H and A[g]<A[r]:g=r
if g!=i:A[i],A[g]=A[g],A[i];h(g)
for i in range(H//2,0,-1):h(i)
print((' '+' '.join(map(str,A[1:]))))
| 11 | 9 | 245 | 239 | eval(input())
A = [0] + list(map(int, input().split()))
H = len(A)
def h(i):
l = 2 * i
r, g = l + 1, [i, l][l < H and A[i] < A[l]]
if r < H and A[g] < A[r]:
g = r
if g != i:
A[i], A[g] = A[g], A[i]
h(g)
for i in range(H // 2, 0, -1):
h(i)
a = ""
for s in A[1:]:
a += f... | eval(input())
A = [0] + list(map(int, input().split()))
H = len(A)
def h(i):
l = 2 * i
r, g = l + 1, [i, l][l < H and A[i] < A[l]]
if r < H and A[g] < A[r]:
g = r
if g != i:
A[i], A[g] = A[g], A[i]
h(g)
for i in range(H // 2, 0, -1):
h(i)
print((" " + " ".join(map(str, A[... | false | 18.181818 | [
"-a = \"\"",
"-for s in A[1:]:",
"- a += f\" {s}\"",
"-print(a)",
"+print((\" \" + \" \".join(map(str, A[1:]))))"
] | false | 0.043735 | 0.047048 | 0.929567 | [
"s404343654",
"s584198836"
] |
u852690916 | p02972 | python | s174385003 | s119961839 | 584 | 285 | 7,148 | 68,344 | Accepted | Accepted | 51.2 | N=int(input())
A=list(map(int,input().split()))
ans=[0]*(N+1)
for i in range(N,0,-1):
cnt=0
for j in range(i*2,N+1,i):
cnt+=ans[j]
ans[i]=cnt&1^A[i-1]
print(sum(ans))
for i in range(1,N+1):
if ans[i]:
print(i,end=' ')
| import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
b = list(map(int, input().split()))
lst = b[:]
for i in range(N,0,-1):
j = i
a = 0
while j <=N: a, j = a^lst[j-1], j+i
lst[i-1] = a
ans = [i+1 for i in range(N) if lst[i]]
print... | 15 | 19 | 266 | 389 | N = int(input())
A = list(map(int, input().split()))
ans = [0] * (N + 1)
for i in range(N, 0, -1):
cnt = 0
for j in range(i * 2, N + 1, i):
cnt += ans[j]
ans[i] = cnt & 1 ^ A[i - 1]
print(sum(ans))
for i in range(1, N + 1):
if ans[i]:
print(i, end=" ")
| import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
b = list(map(int, input().split()))
lst = b[:]
for i in range(N, 0, -1):
j = i
a = 0
while j <= N:
a, j = a ^ lst[j - 1], j + i
lst[i - 1] = a
ans = [i + 1 for i in range(N) if lst... | false | 21.052632 | [
"-N = int(input())",
"-A = list(map(int, input().split()))",
"-ans = [0] * (N + 1)",
"-for i in range(N, 0, -1):",
"- cnt = 0",
"- for j in range(i * 2, N + 1, i):",
"- cnt += ans[j]",
"- ans[i] = cnt & 1 ^ A[i - 1]",
"-print(sum(ans))",
"-for i in range(1, N + 1):",
"- if ans... | false | 0.047628 | 0.038069 | 1.251088 | [
"s174385003",
"s119961839"
] |
u191874006 | p02837 | python | s204986686 | s853375882 | 240 | 103 | 46,700 | 74,532 | Accepted | Accepted | 57.08 | #!/usr/bin/env python3
#ABC147 C
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Count... | #!/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... | 53 | 44 | 1,281 | 1,130 | #!/usr/bin/env python3
# ABC147 C
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from c... | #!/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 | 16.981132 | [
"-# ABC147 C",
"-sys.setrecursionlimit(1000000)",
"+sys.setrecursionlimit(2147483647)",
"-lst = [[] for _ in range(n)]",
"+info = [[] for _ in range(n)]",
"- for j in range(a):",
"+ for _ in range(a):",
"- lst[i].append((x - 1, y))",
"-for i in range(2**n):",
"- b = [0] * n",
"+ ... | false | 0.043867 | 0.091392 | 0.479981 | [
"s204986686",
"s853375882"
] |
u926046014 | p02714 | python | s431662491 | s469470306 | 327 | 179 | 74,072 | 72,596 | Accepted | Accepted | 45.26 | n=int(eval(input()))
s=eval(input())
ans=0
for i in range(n-2):
if s[i]=="R":
a,b="G","B"
elif s[i]=="G":
a,b="B","R"
else:
a,b="R","G"
cnt=[None]*(n-i-1)
acnt=0
bcnt=0
for j in range(i+1,n):
if s[j]==a:
acnt+=1
cnt[j-i-... | n=int(eval(input()))
s=eval(input())
r=s.count("R")
g=s.count("G")
b=s.count("B")
ans=r*g*b
for i in range(n):
a=s[i]
for j in range(i+1,n):
b=s[j]
d=j-i
if j+d>=n:
break
c=s[j+d]
if a!=b and b!=c and c!=a:
ans-=1
print(ans) | 28 | 17 | 592 | 300 | n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(n - 2):
if s[i] == "R":
a, b = "G", "B"
elif s[i] == "G":
a, b = "B", "R"
else:
a, b = "R", "G"
cnt = [None] * (n - i - 1)
acnt = 0
bcnt = 0
for j in range(i + 1, n):
if s[j] == a:
acn... | n = int(eval(input()))
s = eval(input())
r = s.count("R")
g = s.count("G")
b = s.count("B")
ans = r * g * b
for i in range(n):
a = s[i]
for j in range(i + 1, n):
b = s[j]
d = j - i
if j + d >= n:
break
c = s[j + d]
if a != b and b != c and c != a:
... | false | 39.285714 | [
"-ans = 0",
"-for i in range(n - 2):",
"- if s[i] == \"R\":",
"- a, b = \"G\", \"B\"",
"- elif s[i] == \"G\":",
"- a, b = \"B\", \"R\"",
"- else:",
"- a, b = \"R\", \"G\"",
"- cnt = [None] * (n - i - 1)",
"- acnt = 0",
"- bcnt = 0",
"+r = s.count(\"R\")",... | false | 0.107525 | 0.129872 | 0.82793 | [
"s431662491",
"s469470306"
] |
u450956662 | p03329 | python | s102740851 | s404908107 | 683 | 628 | 3,828 | 3,828 | Accepted | Accepted | 8.05 | N = int(eval(input()))
dp = [10 ** 6] * (N + 1)
dp[0] = 0
for i in range(N+1):
p = 1
while p <= N:
dp[i] = min(dp[i], dp[i-p] + 1)
p *= 6
p = 1
while p <= N:
dp[i] = min(dp[i], dp[i-p] + 1)
p *= 9
print((dp[N])) | N = int(eval(input()))
dp = [10 ** 6] * (N + 1)
dp[0] = 0
for i in range(N+1):
p = 1
while p <= i:
dp[i] = min(dp[i], dp[i-p] + 1)
p *= 6
p = 1
while p <= i:
dp[i] = min(dp[i], dp[i-p] + 1)
p *= 9
print((dp[N])) | 15 | 15 | 267 | 267 | N = int(eval(input()))
dp = [10**6] * (N + 1)
dp[0] = 0
for i in range(N + 1):
p = 1
while p <= N:
dp[i] = min(dp[i], dp[i - p] + 1)
p *= 6
p = 1
while p <= N:
dp[i] = min(dp[i], dp[i - p] + 1)
p *= 9
print((dp[N]))
| N = int(eval(input()))
dp = [10**6] * (N + 1)
dp[0] = 0
for i in range(N + 1):
p = 1
while p <= i:
dp[i] = min(dp[i], dp[i - p] + 1)
p *= 6
p = 1
while p <= i:
dp[i] = min(dp[i], dp[i - p] + 1)
p *= 9
print((dp[N]))
| false | 0 | [
"- while p <= N:",
"+ while p <= i:",
"- while p <= N:",
"+ while p <= i:"
] | false | 0.132751 | 0.124348 | 1.06757 | [
"s102740851",
"s404908107"
] |
u493130708 | p02679 | python | s470651143 | s674468009 | 1,211 | 560 | 98,916 | 159,636 | Accepted | Accepted | 53.76 | import sys
input = sys.stdin.readline
import math
MOD = 10**9+7
N = int(eval(input()))
F = []
zero_v = 0
inf = 0
zero = 0
for _ in range(N):
x,y = list(map(int,input().split()))
if x==0 and y==0:
zero_v += 1
elif x==0:
inf += 1
elif y==0:
zero += 1
else:
G = math.gcd(abs(x)... | import sys
input = sys.stdin.readline
def gcd(a, b):
while b:
a, b = b, a % b
return a
MOD = 10**9+7
N = int(eval(input()))
F = []
zero_v = 0
inf = 0
zero = 0
for _ in range(N):
x,y = list(map(int,input().split()))
if x==0 and y==0:
zero_v += 1
elif x==0:
inf += 1
elif y==0... | 63 | 67 | 1,036 | 1,081 | import sys
input = sys.stdin.readline
import math
MOD = 10**9 + 7
N = int(eval(input()))
F = []
zero_v = 0
inf = 0
zero = 0
for _ in range(N):
x, y = list(map(int, input().split()))
if x == 0 and y == 0:
zero_v += 1
elif x == 0:
inf += 1
elif y == 0:
zero += 1
else:
... | import sys
input = sys.stdin.readline
def gcd(a, b):
while b:
a, b = b, a % b
return a
MOD = 10**9 + 7
N = int(eval(input()))
F = []
zero_v = 0
inf = 0
zero = 0
for _ in range(N):
x, y = list(map(int, input().split()))
if x == 0 and y == 0:
zero_v += 1
elif x == 0:
inf +... | false | 5.970149 | [
"-import math",
"+",
"+",
"+def gcd(a, b):",
"+ while b:",
"+ a, b = b, a % b",
"+ return a",
"+",
"- G = math.gcd(abs(x), abs(y))",
"+ G = gcd(abs(x), abs(y))"
] | false | 0.037446 | 0.038056 | 0.983987 | [
"s470651143",
"s674468009"
] |
u393253137 | p03274 | python | s556492234 | s956157339 | 83 | 70 | 14,388 | 14,380 | Accepted | Accepted | 15.66 | n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
ans=4*10**8
# zip関数は多い元は無視する.
for a, b in zip(x, x[k-1:]):
cand = b-a + min(abs(a), abs(b))
ans = min(cand, ans)
print(ans) | n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
ans=[0]*(n-k+1)
# zip関数は多い元は無視する.
for i, a, b in zip(list(range(n)), x, x[k-1:]):
ans[i] = b-a + min(abs(a), abs(b))
print((min(ans))) | 8 | 7 | 207 | 205 | n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = 4 * 10**8
# zip関数は多い元は無視する.
for a, b in zip(x, x[k - 1 :]):
cand = b - a + min(abs(a), abs(b))
ans = min(cand, ans)
print(ans)
| n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = [0] * (n - k + 1)
# zip関数は多い元は無視する.
for i, a, b in zip(list(range(n)), x, x[k - 1 :]):
ans[i] = b - a + min(abs(a), abs(b))
print((min(ans)))
| false | 12.5 | [
"-ans = 4 * 10**8",
"+ans = [0] * (n - k + 1)",
"-for a, b in zip(x, x[k - 1 :]):",
"- cand = b - a + min(abs(a), abs(b))",
"- ans = min(cand, ans)",
"-print(ans)",
"+for i, a, b in zip(list(range(n)), x, x[k - 1 :]):",
"+ ans[i] = b - a + min(abs(a), abs(b))",
"+print((min(ans)))"
] | false | 0.044154 | 0.043009 | 1.026627 | [
"s556492234",
"s956157339"
] |
u813098295 | p03775 | python | s604589395 | s536891663 | 39 | 28 | 2,568 | 2,568 | Accepted | Accepted | 28.21 | N = int(input())
for i in range(1, N+1):
if i*i > N:
break
elif i*i == N:
t = i
break
if N % i == 0:
t = i
print(len(str(N/t))) | N = int(input())
for i in range(1, N+1):
if i*i > N:
break
if N % i == 0:
t = i
print(len(str(N/t))) | 15 | 11 | 194 | 142 | N = int(input())
for i in range(1, N + 1):
if i * i > N:
break
elif i * i == N:
t = i
break
if N % i == 0:
t = i
print(len(str(N / t)))
| N = int(input())
for i in range(1, N + 1):
if i * i > N:
break
if N % i == 0:
t = i
print(len(str(N / t)))
| false | 26.666667 | [
"- elif i * i == N:",
"- t = i",
"- break"
] | false | 0.137064 | 0.1146 | 1.196024 | [
"s604589395",
"s536891663"
] |
u202727309 | p02948 | python | s264667047 | s712277427 | 866 | 615 | 79,704 | 75,612 | Accepted | Accepted | 28.98 | import heapq
N, M = list(map(int, input().split()))
X = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x: x[0])
heap = []
ans = 0
j = 0
for i in range(1, M+1): # M - i 日後にするバイトを考える
while (j < N) and (X[j][0] <= i): # 支払いがi日以内
heapq.heappush(heap, -X[j][1]) # 候補の追加。最大の値が欲しい... | from heapq import heappop, heappush
import sys
input = sys.stdin.readline
import heapq
N, M = list(map(int, input().split()))
X = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x: x[0])
heap = []
ans = 0
j = 0
for i in range(1, M+1): # M - i 日後にするバイトを考える
while (j < N) and (X[j... | 14 | 18 | 429 | 508 | import heapq
N, M = list(map(int, input().split()))
X = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x: x[0])
heap = []
ans = 0
j = 0
for i in range(1, M + 1): # M - i 日後にするバイトを考える
while (j < N) and (X[j][0] <= i): # 支払いがi日以内
heapq.heappush(heap, -X[j][1]) # 候補の追加。最大の値が欲しいためマイナ... | from heapq import heappop, heappush
import sys
input = sys.stdin.readline
import heapq
N, M = list(map(int, input().split()))
X = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x: x[0])
heap = []
ans = 0
j = 0
for i in range(1, M + 1): # M - i 日後にするバイトを考える
while (j < N) and (X[j][0] <= i)... | false | 22.222222 | [
"+from heapq import heappop, heappush",
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.038212 | 0.039041 | 0.97876 | [
"s264667047",
"s712277427"
] |
u654470292 | p03032 | python | s716830928 | s122676160 | 206 | 90 | 41,964 | 74,916 | Accepted | Accepted | 56.31 | # from collections import deque
n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
# v=deque()
# for i in range(n):
# v.append(a[i])
# print(v)
ans=0
for i in range(1,k+1):
if i<=n:
for j in range(i+1):
tmp=[]
# print("{0} {1}".format(i,j))
... | import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
def celi(a,b):
return -(-a//b)
sys.... | 30 | 37 | 778 | 919 | # from collections import deque
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
# v=deque()
# for i in range(n):
# v.append(a[i])
# print(v)
ans = 0
for i in range(1, k + 1):
if i <= n:
for j in range(i + 1):
tmp = []
# print("{0} {1}".format(i,j))
... | import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0] + list(accumulate(lst))
def celi(a, b):
return -(-a // b)
s... | false | 18.918919 | [
"-# from collections import deque",
"+import bisect, copy, heapq, math, sys",
"+from collections import *",
"+from functools import lru_cache",
"+from itertools import accumulate, combinations, permutations, product",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline()[:-1]",
"+",
"+",
... | false | 0.036308 | 0.038297 | 0.948055 | [
"s716830928",
"s122676160"
] |
u063596417 | p03611 | python | s377934571 | s075241988 | 140 | 123 | 90,376 | 91,348 | Accepted | Accepted | 12.14 | from collections import defaultdict
def main():
n = int(eval(input()))
a = [int(an) for an in input().split()]
cnt = defaultdict(int)
for an in a:
for val in {an - 1, an, an + 1}:
cnt[val] += 1
print((max(cnt.values())))
if __name__ == "__main__":
main()
| from collections import defaultdict
def main():
_ = eval(input())
a = [int(an) for an in input().split()]
cnt = defaultdict(int)
for an in a:
cnt[an - 1] += 1
cnt[an] += 1
cnt[an + 1] += 1
print((max(cnt.values())))
if __name__ == "__main__":
main()
| 15 | 16 | 309 | 309 | from collections import defaultdict
def main():
n = int(eval(input()))
a = [int(an) for an in input().split()]
cnt = defaultdict(int)
for an in a:
for val in {an - 1, an, an + 1}:
cnt[val] += 1
print((max(cnt.values())))
if __name__ == "__main__":
main()
| from collections import defaultdict
def main():
_ = eval(input())
a = [int(an) for an in input().split()]
cnt = defaultdict(int)
for an in a:
cnt[an - 1] += 1
cnt[an] += 1
cnt[an + 1] += 1
print((max(cnt.values())))
if __name__ == "__main__":
main()
| false | 6.25 | [
"- n = int(eval(input()))",
"+ _ = eval(input())",
"- for val in {an - 1, an, an + 1}:",
"- cnt[val] += 1",
"+ cnt[an - 1] += 1",
"+ cnt[an] += 1",
"+ cnt[an + 1] += 1"
] | false | 0.117593 | 0.040096 | 2.932765 | [
"s377934571",
"s075241988"
] |
u606045429 | p03151 | python | s473980677 | s562381494 | 131 | 115 | 19,188 | 19,068 | Accepted | Accepted | 12.21 | N = int(eval(input()))
A = [int(_) for _ in input().split()]
B = [int(_) for _ in input().split()]
M = []
P = []
for i in range(N):
tmp = A[i] - B[i]
if tmp < 0:
M.append(tmp)
else:
P.append(tmp)
ms = sum(M)
if ms == 0:
print((0))
exit(0)
P.sort(reverse=True)
... | from itertools import accumulate
N = int(eval(input()))
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
D = [ai - bi for ai, bi in zip(A, B)]
M = [di for di in D if di < 0]
P = [di for di in D if di > 0]
sum_m = sum(M)
if sum_m == 0:
print((0))
exit()
P = accumulat... | 32 | 21 | 459 | 450 | N = int(eval(input()))
A = [int(_) for _ in input().split()]
B = [int(_) for _ in input().split()]
M = []
P = []
for i in range(N):
tmp = A[i] - B[i]
if tmp < 0:
M.append(tmp)
else:
P.append(tmp)
ms = sum(M)
if ms == 0:
print((0))
exit(0)
P.sort(reverse=True)
count = 0
for pi in P:
... | from itertools import accumulate
N = int(eval(input()))
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
D = [ai - bi for ai, bi in zip(A, B)]
M = [di for di in D if di < 0]
P = [di for di in D if di > 0]
sum_m = sum(M)
if sum_m == 0:
print((0))
exit()
P = accumulate(sorted(P, revers... | false | 34.375 | [
"+from itertools import accumulate",
"+",
"-A = [int(_) for _ in input().split()]",
"-B = [int(_) for _ in input().split()]",
"-M = []",
"-P = []",
"-for i in range(N):",
"- tmp = A[i] - B[i]",
"- if tmp < 0:",
"- M.append(tmp)",
"- else:",
"- P.append(tmp)",
"-ms = su... | false | 0.037169 | 0.072224 | 0.514632 | [
"s473980677",
"s562381494"
] |
u603745966 | p03854 | python | s987116305 | s474135762 | 1,554 | 107 | 4,580 | 3,812 | Accepted | Accepted | 93.11 | from functools import reduce
def main():
# 切り捨て
# 4 // 3
# 切り上げ
#-(-4 // 3)
# 初期値用:十分大きい数(100億)
# 1e10
# 初期値用:十分小さい数(-100億)
# -1e10
# 1文字のみを読み込み
# 入力:2
# a = input().rstrip()
# 変数:a='2'
# スペース区切りで標準入力を配列として読み込み
# 入力:2 4 5 7
... | from functools import reduce
def main():
# 切り捨て
# 4 // 3
# 切り上げ
#-(-4 // 3)
# 初期値用:十分大きい数(100億)
# 1e10
# 初期値用:十分小さい数(-100億)
# -1e10
# 1文字のみを読み込み
# 入力:2
# a = input().rstrip()
# 変数:a='2'
# スペース区切りで標準入力を配列として読み込み
# 入力:2 4 5 7
... | 67 | 74 | 1,572 | 1,779 | from functools import reduce
def main():
# 切り捨て
# 4 // 3
# 切り上げ
# -(-4 // 3)
# 初期値用:十分大きい数(100億)
# 1e10
# 初期値用:十分小さい数(-100億)
# -1e10
# 1文字のみを読み込み
# 入力:2
# a = input().rstrip()
# 変数:a='2'
# スペース区切りで標準入力を配列として読み込み
# 入力:2 4 5 7
# a, b, c, d = (int(_) for _ in i... | from functools import reduce
def main():
# 切り捨て
# 4 // 3
# 切り上げ
# -(-4 // 3)
# 初期値用:十分大きい数(100億)
# 1e10
# 初期値用:十分小さい数(-100億)
# -1e10
# 1文字のみを読み込み
# 入力:2
# a = input().rstrip()
# 変数:a='2'
# スペース区切りで標準入力を配列として読み込み
# 入力:2 4 5 7
# a, b, c, d = (int(_) for _ in i... | false | 9.459459 | [
"- S = list(_ for _ in eval(input()))",
"- S.reverse()",
"+ # S = list(_ for _ in input())",
"+ S = eval(input())",
"+ S = S[::-1]",
"+ # S.reverse()",
"+ # S.sort(reversed=True)",
"- for i in range(len(T[0])):",
"- S.pop(0)",
"+ S = S[len(... | false | 0.09607 | 0.036187 | 2.654847 | [
"s987116305",
"s474135762"
] |
u688564053 | p02887 | python | s948080076 | s552373496 | 187 | 168 | 45,168 | 39,408 | Accepted | Accepted | 10.16 | N = int(eval(input()))
S = eval(input())
import itertools
l = [k for k, v in itertools.groupby(S)]
print((len(l)))
| N = int(eval(input()))
S = eval(input())
cnt = 1
for i in range(len(S)-1):
if S[i] != S[i+1]:
cnt += 1
print(cnt)
| 7 | 7 | 109 | 120 | N = int(eval(input()))
S = eval(input())
import itertools
l = [k for k, v in itertools.groupby(S)]
print((len(l)))
| N = int(eval(input()))
S = eval(input())
cnt = 1
for i in range(len(S) - 1):
if S[i] != S[i + 1]:
cnt += 1
print(cnt)
| false | 0 | [
"-import itertools",
"-",
"-l = [k for k, v in itertools.groupby(S)]",
"-print((len(l)))",
"+cnt = 1",
"+for i in range(len(S) - 1):",
"+ if S[i] != S[i + 1]:",
"+ cnt += 1",
"+print(cnt)"
] | false | 0.041631 | 0.129178 | 0.322278 | [
"s948080076",
"s552373496"
] |
u433532588 | p03013 | python | s856181402 | s338112681 | 564 | 450 | 480,844 | 460,020 | Accepted | Accepted | 20.21 |
# 壊れている床を無視すればフィボナッチ数になってる
from collections import defaultdict
def Fib(n, broken):
dd = defaultdict(int)
dd[0] = 1
dd[1] = 1
for i in range(2, n+1):
if broken[i-1] == 0:
dd[i] += dd[i-1]
if broken[i-2] == 0:
dd[i] += dd[i-2]
return dd[n]
... |
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################
N, M = list(map(int, input().split()))
A = [0] * M
dp = [-1] * (N+1)
for i in range(M):
a = int(eval(input()))
dp[a] = 0
dp[0] = 1
if dp[1] != 0:
dp[1] = 1
for i in range(2, N+1):
if... | 27 | 23 | 502 | 384 | # 壊れている床を無視すればフィボナッチ数になってる
from collections import defaultdict
def Fib(n, broken):
dd = defaultdict(int)
dd[0] = 1
dd[1] = 1
for i in range(2, n + 1):
if broken[i - 1] == 0:
dd[i] += dd[i - 1]
if broken[i - 2] == 0:
dd[i] += dd[i - 2]
return dd[n]
n, m = l... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################
N, M = list(map(int, input().split()))
A = [0] * M
dp = [-1] * (N + 1)
for i in range(M):
a = int(eval(input()))
dp[a] = 0
dp[0] = 1
if dp[1] != 0:
dp[1] = 1
for i in range(2, N + 1):
if dp[i] != 0:
... | false | 14.814815 | [
"-# 壊れている床を無視すればフィボナッチ数になってる",
"-from collections import defaultdict",
"+import sys",
"-",
"-def Fib(n, broken):",
"- dd = defaultdict(int)",
"- dd[0] = 1",
"- dd[1] = 1",
"- for i in range(2, n + 1):",
"- if broken[i - 1] == 0:",
"- dd[i] += dd[i - 1]",
"- ... | false | 0.039829 | 0.086313 | 0.46145 | [
"s856181402",
"s338112681"
] |
u326609687 | p03087 | python | s559752571 | s449358352 | 543 | 410 | 30,464 | 30,432 | Accepted | Accepted | 24.49 | import bisect
import re
N, Q = list(map(int, input().split()))
S = eval(input())
P = [list(map(int, input().split())) for _ in range(Q)]
r = re.compile('AC')
a = [x.start() for x in r.finditer(S)]
if a:
for q in P:
p1 = bisect.bisect_left(a, q[0] - 1)
p2 = bisect.bisect_right(a, q[1]... | import bisect
import re
import sys
N, Q = list(map(int, input().split()))
S = sys.stdin.readline()
P = [list(map(int, sys.stdin.readline().split())) for _ in range(Q)]
r = re.compile('AC')
a = [x.start() for x in r.finditer(S)]
if a:
for q in P:
p1 = bisect.bisect_left(a, q[0] - 1)
... | 18 | 19 | 380 | 417 | import bisect
import re
N, Q = list(map(int, input().split()))
S = eval(input())
P = [list(map(int, input().split())) for _ in range(Q)]
r = re.compile("AC")
a = [x.start() for x in r.finditer(S)]
if a:
for q in P:
p1 = bisect.bisect_left(a, q[0] - 1)
p2 = bisect.bisect_right(a, q[1] - 2)
p... | import bisect
import re
import sys
N, Q = list(map(int, input().split()))
S = sys.stdin.readline()
P = [list(map(int, sys.stdin.readline().split())) for _ in range(Q)]
r = re.compile("AC")
a = [x.start() for x in r.finditer(S)]
if a:
for q in P:
p1 = bisect.bisect_left(a, q[0] - 1)
p2 = bisect.bise... | false | 5.263158 | [
"+import sys",
"-S = eval(input())",
"-P = [list(map(int, input().split())) for _ in range(Q)]",
"+S = sys.stdin.readline()",
"+P = [list(map(int, sys.stdin.readline().split())) for _ in range(Q)]"
] | false | 0.049346 | 0.19334 | 0.255231 | [
"s559752571",
"s449358352"
] |
u691018832 | p03063 | python | s043705855 | s604460465 | 101 | 84 | 3,500 | 3,500 | Accepted | Accepted | 16.83 | N = int(eval(input()))
S = eval(input())
a = S.count('.')
ans = a
for i in S:
a += -1 if i == '.' else 1
ans = min(ans, a)
print(ans) | N = int(eval(input()))
S = eval(input())
a = S.count('.')
ans = a
for i in S:
if i == '.':
a -= 1
else:
a += 1
ans = min(ans, a)
print(ans) | 8 | 13 | 136 | 169 | N = int(eval(input()))
S = eval(input())
a = S.count(".")
ans = a
for i in S:
a += -1 if i == "." else 1
ans = min(ans, a)
print(ans)
| N = int(eval(input()))
S = eval(input())
a = S.count(".")
ans = a
for i in S:
if i == ".":
a -= 1
else:
a += 1
ans = min(ans, a)
print(ans)
| false | 38.461538 | [
"- a += -1 if i == \".\" else 1",
"+ if i == \".\":",
"+ a -= 1",
"+ else:",
"+ a += 1"
] | false | 0.040655 | 0.041237 | 0.98589 | [
"s043705855",
"s604460465"
] |
u891516200 | p02623 | python | s057869903 | s723347484 | 394 | 270 | 41,148 | 44,324 | Accepted | Accepted | 31.47 | from bisect import bisect_right
from time import time
N, M, K = [int(x) for x in input().split()]
a_book = [0]
for index, i in enumerate(input().split(), 1):
if a_book[index-1] + int(i) <= K:
a_book.append(a_book[index-1] + int(i))
else:
N = index - 1
break
b_book = [0]
... | from bisect import bisect_right
from itertools import accumulate
N, M, K = [int(x) for x in input().split()]
a_book = [0] + list(accumulate([int(x) for x in input().split()]))
b_book = [0] + list(accumulate([int(x) for x in input().split()]))
check = {}
max_books = 0
for i, a in enumerate(a_book):
... | 32 | 22 | 702 | 481 | from bisect import bisect_right
from time import time
N, M, K = [int(x) for x in input().split()]
a_book = [0]
for index, i in enumerate(input().split(), 1):
if a_book[index - 1] + int(i) <= K:
a_book.append(a_book[index - 1] + int(i))
else:
N = index - 1
break
b_book = [0]
for index, i... | from bisect import bisect_right
from itertools import accumulate
N, M, K = [int(x) for x in input().split()]
a_book = [0] + list(accumulate([int(x) for x in input().split()]))
b_book = [0] + list(accumulate([int(x) for x in input().split()]))
check = {}
max_books = 0
for i, a in enumerate(a_book):
if a > K:
... | false | 31.25 | [
"-from time import time",
"+from itertools import accumulate",
"-a_book = [0]",
"-for index, i in enumerate(input().split(), 1):",
"- if a_book[index - 1] + int(i) <= K:",
"- a_book.append(a_book[index - 1] + int(i))",
"- else:",
"- N = index - 1",
"- break",
"-b_book = ... | false | 0.109095 | 0.08283 | 1.317089 | [
"s057869903",
"s723347484"
] |
u729939940 | p02707 | python | s831575855 | s447474451 | 179 | 124 | 35,524 | 32,880 | Accepted | Accepted | 30.73 | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
subordinates = [0] * N
boss_and_cnt = Counter(A)
for boss, cnt in list(boss_and_cnt.items()):
subordinates[boss - 1] = cnt
for s in subordinates:
print(s) | N = int(eval(input()))
A = list(map(int, input().split()))
subordinate_cnt = [0] * N
for boss_num in A:
subordinate_cnt[boss_num - 1] += 1
print(("\n".join(map(str, subordinate_cnt)))) | 9 | 6 | 245 | 183 | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
subordinates = [0] * N
boss_and_cnt = Counter(A)
for boss, cnt in list(boss_and_cnt.items()):
subordinates[boss - 1] = cnt
for s in subordinates:
print(s)
| N = int(eval(input()))
A = list(map(int, input().split()))
subordinate_cnt = [0] * N
for boss_num in A:
subordinate_cnt[boss_num - 1] += 1
print(("\n".join(map(str, subordinate_cnt))))
| false | 33.333333 | [
"-from collections import Counter",
"-",
"-subordinates = [0] * N",
"-boss_and_cnt = Counter(A)",
"-for boss, cnt in list(boss_and_cnt.items()):",
"- subordinates[boss - 1] = cnt",
"-for s in subordinates:",
"- print(s)",
"+subordinate_cnt = [0] * N",
"+for boss_num in A:",
"+ subordina... | false | 0.036523 | 0.036713 | 0.994828 | [
"s831575855",
"s447474451"
] |
u814986259 | p02995 | python | s878595800 | s553808176 | 42 | 36 | 5,048 | 5,048 | Accepted | Accepted | 14.29 | import fractions
A,B,C,D = list(map(int,input().split()))
lcm = int(C*D / fractions.gcd(C,D))
ans_b = B - (B // C) - (B // D) + (B // lcm)
ans_a = A - 1 - ((A - 1)// C) - ((A - 1)// D) + ((A - 1) // lcm)
print((int(ans_b - ans_a))) | import fractions
A,B,C,D = list(map(int,input().split()))
icm = int(C*D / fractions.gcd(C,D))
ans = (B - A + 1)
if A != B:
if A % C == 0:
ans -= int(B // C - A // C) + 1
else:
ans -= int(B // C - A // C)
if A % D == 0:
ans -= int(B // D - A // D) + 1
else:
a... | 8 | 25 | 232 | 571 | import fractions
A, B, C, D = list(map(int, input().split()))
lcm = int(C * D / fractions.gcd(C, D))
ans_b = B - (B // C) - (B // D) + (B // lcm)
ans_a = A - 1 - ((A - 1) // C) - ((A - 1) // D) + ((A - 1) // lcm)
print((int(ans_b - ans_a)))
| import fractions
A, B, C, D = list(map(int, input().split()))
icm = int(C * D / fractions.gcd(C, D))
ans = B - A + 1
if A != B:
if A % C == 0:
ans -= int(B // C - A // C) + 1
else:
ans -= int(B // C - A // C)
if A % D == 0:
ans -= int(B // D - A // D) + 1
else:
ans -= in... | false | 68 | [
"-lcm = int(C * D / fractions.gcd(C, D))",
"-ans_b = B - (B // C) - (B // D) + (B // lcm)",
"-ans_a = A - 1 - ((A - 1) // C) - ((A - 1) // D) + ((A - 1) // lcm)",
"-print((int(ans_b - ans_a)))",
"+icm = int(C * D / fractions.gcd(C, D))",
"+ans = B - A + 1",
"+if A != B:",
"+ if A % C == 0:",
"+ ... | false | 0.048718 | 0.047144 | 1.033395 | [
"s878595800",
"s553808176"
] |
u589886885 | p02397 | python | s503140583 | s785086724 | 50 | 40 | 8,176 | 8,104 | Accepted | Accepted | 20 | import sys
n = sys.stdin.readlines()
for i in n:
a = [int(x) for x in i.split()]
if a[0] == 0 and a[1] == 0:
break
print((*sorted(a))) | import sys
n = sys.stdin.readlines()
for i in n:
a, b = [int(x) for x in i.split()]
if a == 0 and b == 0:
break
if a < b:
print((a, b))
else:
print((b, a)) | 8 | 11 | 160 | 202 | import sys
n = sys.stdin.readlines()
for i in n:
a = [int(x) for x in i.split()]
if a[0] == 0 and a[1] == 0:
break
print((*sorted(a)))
| import sys
n = sys.stdin.readlines()
for i in n:
a, b = [int(x) for x in i.split()]
if a == 0 and b == 0:
break
if a < b:
print((a, b))
else:
print((b, a))
| false | 27.272727 | [
"- a = [int(x) for x in i.split()]",
"- if a[0] == 0 and a[1] == 0:",
"+ a, b = [int(x) for x in i.split()]",
"+ if a == 0 and b == 0:",
"- print((*sorted(a)))",
"+ if a < b:",
"+ print((a, b))",
"+ else:",
"+ print((b, a))"
] | false | 0.044209 | 0.042422 | 1.042123 | [
"s503140583",
"s785086724"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.