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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u562935282 | p02936 | python | s171082962 | s282095960 | 1,880 | 1,079 | 81,920 | 80,600 | Accepted | Accepted | 42.61 | n, q = list(map(int, input().split()))
g = [set() for _ in range(n)]
for _ in range(n - 1):
a, b = (int(x) - 1 for x in input().split())
g[a].add(b)
g[b].add(a)
ctr = [0] * n
for _ in range(q):
it = list(map(int, input().split()))
p = next(it) - 1
x = next(it)
ctr[p] += x
s... | def main():
import sys
input = sys.stdin.readline
n, q = list(map(int, input().split()))
g = [set() for _ in range(n)]
for _ in range(n - 1):
a, b = (int(x) - 1 for x in input().split())
g[a].add(b)
g[b].add(a)
ctr = [0] * n
for _ in range(q):
... | 26 | 34 | 506 | 705 | n, q = list(map(int, input().split()))
g = [set() for _ in range(n)]
for _ in range(n - 1):
a, b = (int(x) - 1 for x in input().split())
g[a].add(b)
g[b].add(a)
ctr = [0] * n
for _ in range(q):
it = list(map(int, input().split()))
p = next(it) - 1
x = next(it)
ctr[p] += x
st = [0]
used = [0]... | def main():
import sys
input = sys.stdin.readline
n, q = list(map(int, input().split()))
g = [set() for _ in range(n)]
for _ in range(n - 1):
a, b = (int(x) - 1 for x in input().split())
g[a].add(b)
g[b].add(a)
ctr = [0] * n
for _ in range(q):
it = list(map(i... | false | 23.529412 | [
"-n, q = list(map(int, input().split()))",
"-g = [set() for _ in range(n)]",
"-for _ in range(n - 1):",
"- a, b = (int(x) - 1 for x in input().split())",
"- g[a].add(b)",
"- g[b].add(a)",
"-ctr = [0] * n",
"-for _ in range(q):",
"- it = list(map(int, input().split()))",
"- p = next(... | false | 0.037728 | 0.075824 | 0.497576 | [
"s171082962",
"s282095960"
] |
u074220993 | p03457 | python | s662292028 | s920265773 | 263 | 170 | 23,868 | 24,056 | Accepted | Accepted | 35.36 | N = int(eval(input()))
P = [(0,0,0)] + [tuple(int(x) for x in input().split()) for _ in range(N)]
def travelable(p,q):
time = q[0] - p[0]
dist = abs(q[1]-p[1]) + abs(q[2]-p[2])
if dist <= time and time%2 == dist%2:
return True
else:
return False
print(('Yes' if all(t... | from collections import namedtuple
plan = namedtuple('plan', ['time', 'x', 'y'])
def main():
with open(0) as f:
N = int(f.readline())
plans = []
for _ in range(N):
t, x, y = list(map(int, f.readline().split()))
plans.append(plan(t, x, y))
current = plan... | 12 | 25 | 367 | 646 | N = int(eval(input()))
P = [(0, 0, 0)] + [tuple(int(x) for x in input().split()) for _ in range(N)]
def travelable(p, q):
time = q[0] - p[0]
dist = abs(q[1] - p[1]) + abs(q[2] - p[2])
if dist <= time and time % 2 == dist % 2:
return True
else:
return False
print(("Yes" if all(travela... | from collections import namedtuple
plan = namedtuple("plan", ["time", "x", "y"])
def main():
with open(0) as f:
N = int(f.readline())
plans = []
for _ in range(N):
t, x, y = list(map(int, f.readline().split()))
plans.append(plan(t, x, y))
current = plan(0, 0, 0... | false | 52 | [
"-N = int(eval(input()))",
"-P = [(0, 0, 0)] + [tuple(int(x) for x in input().split()) for _ in range(N)]",
"+from collections import namedtuple",
"+",
"+plan = namedtuple(\"plan\", [\"time\", \"x\", \"y\"])",
"-def travelable(p, q):",
"- time = q[0] - p[0]",
"- dist = abs(q[1] - p[1]) + abs(q[2... | false | 0.04493 | 0.038496 | 1.167138 | [
"s662292028",
"s920265773"
] |
u672475305 | p03829 | python | s918752070 | s823413426 | 226 | 95 | 62,704 | 14,224 | Accepted | Accepted | 57.96 | n,a,b = list(map(int,input().split()))
lst = list(map(int,input().split()))
ans = 0
for i in range(1,n):
if (lst[i] - lst[i-1]) * a >= b:
ans += b
else:
ans += (lst[i] - lst[i-1]) * a
print(ans) | n,a,b = list(map(int,input().split()))
X = list(map(int,input().split()))
pos = X[0]
ans = 0
for i in range(1, n):
ans += min(b, (X[i] - pos)*a)
pos = X[i]
print(ans) | 9 | 8 | 220 | 175 | n, a, b = list(map(int, input().split()))
lst = list(map(int, input().split()))
ans = 0
for i in range(1, n):
if (lst[i] - lst[i - 1]) * a >= b:
ans += b
else:
ans += (lst[i] - lst[i - 1]) * a
print(ans)
| n, a, b = list(map(int, input().split()))
X = list(map(int, input().split()))
pos = X[0]
ans = 0
for i in range(1, n):
ans += min(b, (X[i] - pos) * a)
pos = X[i]
print(ans)
| false | 11.111111 | [
"-lst = list(map(int, input().split()))",
"+X = list(map(int, input().split()))",
"+pos = X[0]",
"- if (lst[i] - lst[i - 1]) * a >= b:",
"- ans += b",
"- else:",
"- ans += (lst[i] - lst[i - 1]) * a",
"+ ans += min(b, (X[i] - pos) * a)",
"+ pos = X[i]"
] | false | 0.160812 | 0.038652 | 4.160508 | [
"s918752070",
"s823413426"
] |
u156383602 | p02897 | python | s920334165 | s261665654 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | n=int(eval(input()))
if n%2==0:
print((0.5))
else:
print(((n-1)/(2*n)+1/n))
| a=int(eval(input()))
print((-(-a//2)/a)) | 5 | 2 | 78 | 33 | n = int(eval(input()))
if n % 2 == 0:
print((0.5))
else:
print(((n - 1) / (2 * n) + 1 / n))
| a = int(eval(input()))
print((-(-a // 2) / a))
| false | 60 | [
"-n = int(eval(input()))",
"-if n % 2 == 0:",
"- print((0.5))",
"-else:",
"- print(((n - 1) / (2 * n) + 1 / n))",
"+a = int(eval(input()))",
"+print((-(-a // 2) / a))"
] | false | 0.050926 | 0.050967 | 0.999195 | [
"s920334165",
"s261665654"
] |
u313111801 | p02590 | python | s032212518 | s152657283 | 1,226 | 903 | 86,756 | 86,648 | Accepted | Accepted | 26.35 | import sys
import numpy as np
def fft_convolve(f, g):
"""
数列 (多項式) f, g の畳み込みの計算.上下 15 bitずつ分けて計算することで,
30 bit以下の整数,長さ 250000 程度の数列での計算が正確に行える.
"""
fft = np.fft.rfft
ifft = np.fft.irfft
Lf = len(f)
Lg = len(g)
L = Lf + Lg - 1
fft_len = 1 << L.bit_length()
fl = ... | import sys
import numpy as np
def fft_convolve(f, g):
"""
数列 (多項式) f, g の畳み込みの計算.上下 15 bitずつ分けて計算することで,
30 bit以下の整数,長さ 250000 程度の数列での計算が正確に行える.
"""
fft = np.fft.rfft
ifft = np.fft.irfft
Lf = len(f)
Lg = len(g)
L = Lf + Lg - 1
fft_len = 1 << L.bit_length()
fl = ... | 63 | 55 | 1,294 | 1,137 | import sys
import numpy as np
def fft_convolve(f, g):
"""
数列 (多項式) f, g の畳み込みの計算.上下 15 bitずつ分けて計算することで,
30 bit以下の整数,長さ 250000 程度の数列での計算が正確に行える.
"""
fft = np.fft.rfft
ifft = np.fft.irfft
Lf = len(f)
Lg = len(g)
L = Lf + Lg - 1
fft_len = 1 << L.bit_length()
fl = f & (1 << 15)... | import sys
import numpy as np
def fft_convolve(f, g):
"""
数列 (多項式) f, g の畳み込みの計算.上下 15 bitずつ分けて計算することで,
30 bit以下の整数,長さ 250000 程度の数列での計算が正確に行える.
"""
fft = np.fft.rfft
ifft = np.fft.irfft
Lf = len(f)
Lg = len(g)
L = Lf + Lg - 1
fft_len = 1 << L.bit_length()
fl = f & (1 << 15)... | false | 12.698413 | [
"-for i in range(P - 1, len(C)):",
"- C[i % (P - 1)] += C[i]",
"-C = C[: P - 1]",
"-for i in range(len(B)):",
"- C[2 * i % (P - 1)] -= B[i] * B[i]",
"- ans += B[i] * (B[i] - 1) // 2 * pw[2 * i % (P - 1)]",
"+for a in A:",
"+ ans -= a * a % P",
"- C[i] //= 2",
"-for i in range(len(C)... | false | 2.72074 | 0.972198 | 2.798546 | [
"s032212518",
"s152657283"
] |
u934442292 | p02642 | python | s107600433 | s250036126 | 766 | 618 | 136,780 | 132,020 | Accepted | Accepted | 19.32 | import sys
from collections import Counter
import numba as nb
import numpy as np
input = sys.stdin.readline
@nb.njit("i8(i8[:],i8[:])")
def solve(keys, values):
MAX_A = 10 ** 6
divisible = [False] * (MAX_A + 1)
ans = 0
for k, v in zip(keys, values):
if v == 1 and not divisible... | import sys
from collections import Counter
import numba as nb
import numpy as np
input = sys.stdin.readline
@nb.njit("i8(i8[:],i8[:])", cache=True)
def solve(keys, values):
MAX_A = 10 ** 6
divisible = [False] * (MAX_A + 1)
ans = 0
for k, v in zip(keys, values):
if v == 1 and n... | 37 | 37 | 759 | 771 | import sys
from collections import Counter
import numba as nb
import numpy as np
input = sys.stdin.readline
@nb.njit("i8(i8[:],i8[:])")
def solve(keys, values):
MAX_A = 10**6
divisible = [False] * (MAX_A + 1)
ans = 0
for k, v in zip(keys, values):
if v == 1 and not divisible[k]:
a... | import sys
from collections import Counter
import numba as nb
import numpy as np
input = sys.stdin.readline
@nb.njit("i8(i8[:],i8[:])", cache=True)
def solve(keys, values):
MAX_A = 10**6
divisible = [False] * (MAX_A + 1)
ans = 0
for k, v in zip(keys, values):
if v == 1 and not divisible[k]:
... | false | 0 | [
"-@nb.njit(\"i8(i8[:],i8[:])\")",
"+@nb.njit(\"i8(i8[:],i8[:])\", cache=True)"
] | false | 0.042499 | 0.045313 | 0.937908 | [
"s107600433",
"s250036126"
] |
u241159583 | p02861 | python | s803207641 | s481164981 | 498 | 424 | 8,052 | 3,064 | Accepted | Accepted | 14.86 | import itertools
N = int(eval(input()))
xy = [list(map(int, input().split())) for _ in range(N)]
route = list(itertools.permutations(list(range(N))))
ans = 0
for i in range(len(route)):
for j in range(N-1):
a = route[i][j]
b = route[i][j + 1]
X = (xy[a][0] - xy[b][0]) ** 2
Y = (xy[a][1] ... | import itertools
N = int(eval(input()))
xy = [list(map(int, input().split())) for _ in range(N)]
d = 0
c = 0
for x in itertools.permutations(xy):
c += 1
D = 0
for i in range(N-1):
D += ((x[i][0]-x[i+1][0]) ** 2 + (x[i][1]-x[i+1][1]) ** 2) ** 0.5
d += D
ans = d / c
print(ans) | 15 | 14 | 383 | 295 | import itertools
N = int(eval(input()))
xy = [list(map(int, input().split())) for _ in range(N)]
route = list(itertools.permutations(list(range(N))))
ans = 0
for i in range(len(route)):
for j in range(N - 1):
a = route[i][j]
b = route[i][j + 1]
X = (xy[a][0] - xy[b][0]) ** 2
Y = (xy... | import itertools
N = int(eval(input()))
xy = [list(map(int, input().split())) for _ in range(N)]
d = 0
c = 0
for x in itertools.permutations(xy):
c += 1
D = 0
for i in range(N - 1):
D += ((x[i][0] - x[i + 1][0]) ** 2 + (x[i][1] - x[i + 1][1]) ** 2) ** 0.5
d += D
ans = d / c
print(ans)
| false | 6.666667 | [
"-route = list(itertools.permutations(list(range(N))))",
"-ans = 0",
"-for i in range(len(route)):",
"- for j in range(N - 1):",
"- a = route[i][j]",
"- b = route[i][j + 1]",
"- X = (xy[a][0] - xy[b][0]) ** 2",
"- Y = (xy[a][1] - xy[b][1]) ** 2",
"- ans += (X + ... | false | 0.042055 | 0.040656 | 1.034406 | [
"s803207641",
"s481164981"
] |
u429029348 | p02658 | python | s568897306 | s410259238 | 53 | 49 | 21,712 | 21,448 | Accepted | Accepted | 7.55 | n=int(eval(input()))
a=list(map(int,input().split()))
if 0 in a:
ans=0
else:
ans=1
for i in range(n):
ans*=a[i]
if ans<=10**18:
continue
else:
ans=-1
break
print(ans) | n=int(eval(input()))
a=list(map(int,input().split()))
ans=1
if 0 in a:
ans=0
else:
for i in range(n):
ans*=a[i]
if ans>10**18:
ans=-1
break
print(ans) | 14 | 12 | 245 | 179 | n = int(eval(input()))
a = list(map(int, input().split()))
if 0 in a:
ans = 0
else:
ans = 1
for i in range(n):
ans *= a[i]
if ans <= 10**18:
continue
else:
ans = -1
break
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split()))
ans = 1
if 0 in a:
ans = 0
else:
for i in range(n):
ans *= a[i]
if ans > 10**18:
ans = -1
break
print(ans)
| false | 14.285714 | [
"+ans = 1",
"- ans = 1",
"- if ans <= 10**18:",
"- continue",
"- else:",
"+ if ans > 10**18:"
] | false | 0.104453 | 0.03818 | 2.735795 | [
"s568897306",
"s410259238"
] |
u652150585 | p03487 | python | s030373326 | s996787049 | 152 | 77 | 18,340 | 18,336 | Accepted | Accepted | 49.34 | import sys
import collections
input=sys.stdin.readline
n=int(eval(input()))
l=list(map(int,input().split()))
li=collections.Counter(l)
#print(li)
a=0
for k,v in list(li.items()):
if k>v:
a+=v
else:
a+=v-k
print(a) | import sys
import collections
input=sys.stdin.readline
n=int(eval(input()))
l=list(map(int,input().split()))
s=collections.Counter(l)
#print(s)
a=0
for k,v in list(s.items()):
if k>v:
a+=v
else:
a+=v-k
print(a) | 15 | 15 | 240 | 237 | import sys
import collections
input = sys.stdin.readline
n = int(eval(input()))
l = list(map(int, input().split()))
li = collections.Counter(l)
# print(li)
a = 0
for k, v in list(li.items()):
if k > v:
a += v
else:
a += v - k
print(a)
| import sys
import collections
input = sys.stdin.readline
n = int(eval(input()))
l = list(map(int, input().split()))
s = collections.Counter(l)
# print(s)
a = 0
for k, v in list(s.items()):
if k > v:
a += v
else:
a += v - k
print(a)
| false | 0 | [
"-li = collections.Counter(l)",
"-# print(li)",
"+s = collections.Counter(l)",
"+# print(s)",
"-for k, v in list(li.items()):",
"+for k, v in list(s.items()):"
] | false | 0.038694 | 0.052726 | 0.733875 | [
"s030373326",
"s996787049"
] |
u879870653 | p03162 | python | s852388905 | s061732327 | 1,071 | 498 | 47,324 | 30,580 | Accepted | Accepted | 53.5 | N = int(eval(input()))
L = []
for i in range(N) :
L.append(list(map(int,input().split())))
dp = [[0,0,0] for i in range(N+1)]
for i in range(N) :
for j in range(3) :
for k in range(3) :
if j == k :
continue
dp[i+1][k] = max(dp[i+1][k], dp[i][j] + L[i... | N = int(eval(input()))
L = [list(map(int,input().split())) for i in range(N)]
NOW = [0,0,0]
NEXT = [None,None,None]
for i in range(N) :
NEXT[0] = max(NOW[1],NOW[2]) + L[i][0]
NEXT[1] = max(NOW[2],NOW[0]) + L[i][1]
NEXT[2] = max(NOW[0],NOW[1]) + L[i][2]
NOW = NEXT.copy()
print((max(NOW))... | 14 | 12 | 341 | 314 | N = int(eval(input()))
L = []
for i in range(N):
L.append(list(map(int, input().split())))
dp = [[0, 0, 0] for i in range(N + 1)]
for i in range(N):
for j in range(3):
for k in range(3):
if j == k:
continue
dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + L[i][k])
prin... | N = int(eval(input()))
L = [list(map(int, input().split())) for i in range(N)]
NOW = [0, 0, 0]
NEXT = [None, None, None]
for i in range(N):
NEXT[0] = max(NOW[1], NOW[2]) + L[i][0]
NEXT[1] = max(NOW[2], NOW[0]) + L[i][1]
NEXT[2] = max(NOW[0], NOW[1]) + L[i][2]
NOW = NEXT.copy()
print((max(NOW)))
| false | 14.285714 | [
"-L = []",
"+L = [list(map(int, input().split())) for i in range(N)]",
"+NOW = [0, 0, 0]",
"+NEXT = [None, None, None]",
"- L.append(list(map(int, input().split())))",
"-dp = [[0, 0, 0] for i in range(N + 1)]",
"-for i in range(N):",
"- for j in range(3):",
"- for k in range(3):",
"- ... | false | 0.037471 | 0.037095 | 1.01012 | [
"s852388905",
"s061732327"
] |
u392319141 | p03634 | python | s114827522 | s721579669 | 839 | 614 | 46,540 | 63,484 | Accepted | Accepted | 26.82 | import sys
import heapq
from operator import itemgetter
from collections import deque, defaultdict
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
class Heapq:
def __init__(self, que=[], asc=True):
if not asc:
que = [-a for a in ... | from collections import deque
import sys
input = sys.stdin.buffer.readline
N = int(input())
edges = [[] for _ in range(N)]
for _ in range(N - 1):
fr, to, cost = map(int, input().split())
fr -= 1
to -= 1
edges[fr].append((to, cost))
edges[to].append((fr, cost))
Q, K = map(int, input(... | 67 | 30 | 1,620 | 698 | import sys
import heapq
from operator import itemgetter
from collections import deque, defaultdict
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
class Heapq:
def __init__(self, que=[], asc=True):
if not asc:
que = [-a for a in que]
... | from collections import deque
import sys
input = sys.stdin.buffer.readline
N = int(input())
edges = [[] for _ in range(N)]
for _ in range(N - 1):
fr, to, cost = map(int, input().split())
fr -= 1
to -= 1
edges[fr].append((to, cost))
edges[to].append((fr, cost))
Q, K = map(int, input().split())
K -= ... | false | 55.223881 | [
"+from collections import deque",
"-import heapq",
"-from operator import itemgetter",
"-from collections import deque, defaultdict",
"-from bisect import bisect_left, bisect_right",
"-input = sys.stdin.readline",
"-sys.setrecursionlimit(10**7)",
"-",
"-",
"-class Heapq:",
"- def __init__(sel... | false | 0.043823 | 0.038341 | 1.142984 | [
"s114827522",
"s721579669"
] |
u279493135 | p02743 | python | s727266254 | s646456108 | 158 | 40 | 13,668 | 5,268 | Accepted | Accepted | 74.68 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upp... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upp... | 27 | 27 | 836 | 864 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase... | false | 0 | [
"-import numpy as np",
"+from decimal import *",
"-if c - a - b > 0 and 4 * a * b < (c - a - b) ** 2:",
"+if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():"
] | false | 0.046362 | 0.040364 | 1.148587 | [
"s727266254",
"s646456108"
] |
u298297089 | p03426 | python | s566885244 | s476684221 | 722 | 666 | 52,608 | 49,724 | Accepted | Accepted | 7.76 | H,W,D = list(map(int, input().split()))
grid_dict = {}
for i in range(H):
for j,s in enumerate(input().split()):
grid_dict[int(s)] = [i,j]
Q = int(eval(input()))
exam = []
for i in range(Q):
exam.append(list(map(int, input().split())))
man = lambda x,y: abs(x[0]-y[0])+abs(x[1]-y[1])
powe... | H,W,D = list(map(int, input().split()))
A = {}
for i in range(H):
for j, s in enumerate(input().split()):
A[int(s)] = [i,j]
Q = int(eval(input()))
exam = []
for i in range(Q):
exam.append(list(map(int, input().split())))
grid = [0]
manta = lambda x,y:abs(x[0]-y[0])+abs(x[1]-y[1])
for i in r... | 26 | 19 | 651 | 484 | H, W, D = list(map(int, input().split()))
grid_dict = {}
for i in range(H):
for j, s in enumerate(input().split()):
grid_dict[int(s)] = [i, j]
Q = int(eval(input()))
exam = []
for i in range(Q):
exam.append(list(map(int, input().split())))
man = lambda x, y: abs(x[0] - y[0]) + abs(x[1] - y[1])
power = [... | H, W, D = list(map(int, input().split()))
A = {}
for i in range(H):
for j, s in enumerate(input().split()):
A[int(s)] = [i, j]
Q = int(eval(input()))
exam = []
for i in range(Q):
exam.append(list(map(int, input().split())))
grid = [0]
manta = lambda x, y: abs(x[0] - y[0]) + abs(x[1] - y[1])
for i in ran... | false | 26.923077 | [
"-grid_dict = {}",
"+A = {}",
"- grid_dict[int(s)] = [i, j]",
"+ A[int(s)] = [i, j]",
"-man = lambda x, y: abs(x[0] - y[0]) + abs(x[1] - y[1])",
"-power = [[0] for i in range(D)]",
"-power[0].append(0)",
"+grid = [0]",
"+manta = lambda x, y: abs(x[0] - y[0]) + abs(x[1] - y[1])",
"- ... | false | 0.130171 | 0.04965 | 2.621766 | [
"s566885244",
"s476684221"
] |
u863370423 | p02900 | python | s260612400 | s524590402 | 250 | 176 | 3,188 | 38,512 | Accepted | Accepted | 29.6 | import math
def primes(n):
l= []
for i in range(2,math.floor(math.sqrt(n))):
while n % i == 0:
n = n//i
l.append(i)
if n == 1:
break
if n > 1:
l.append(n)
return l
a,b=list(map(int,input().split()))
sa=set(primes(a))
sb=s... | def prime_factors(n):
res = set()
while n % 2 == 0:
res.add(2)
n //= 2
i = 3
while i * i <= n:
if n % i == 0:
res.add(i)
n //= i
else:
i += 2
if n != 1:
res.add(n)
return res
a, b = list(map(int, input()... | 19 | 20 | 373 | 392 | import math
def primes(n):
l = []
for i in range(2, math.floor(math.sqrt(n))):
while n % i == 0:
n = n // i
l.append(i)
if n == 1:
break
if n > 1:
l.append(n)
return l
a, b = list(map(int, input().split()))
sa = set(primes(a))
sb = set(prim... | def prime_factors(n):
res = set()
while n % 2 == 0:
res.add(2)
n //= 2
i = 3
while i * i <= n:
if n % i == 0:
res.add(i)
n //= i
else:
i += 2
if n != 1:
res.add(n)
return res
a, b = list(map(int, input().split()))
a = ... | false | 5 | [
"-import math",
"-",
"-",
"-def primes(n):",
"- l = []",
"- for i in range(2, math.floor(math.sqrt(n))):",
"- while n % i == 0:",
"- n = n // i",
"- l.append(i)",
"- if n == 1:",
"- break",
"- if n > 1:",
"- l.append(n)",
"- ... | false | 0.064484 | 0.097862 | 0.658928 | [
"s260612400",
"s524590402"
] |
u046187684 | p02630 | python | s959391585 | s920638203 | 218 | 191 | 44,224 | 44,260 | Accepted | Accepted | 12.39 | from collections import Counter
def solve(string):
n, *aqbc = list(map(int, string.split()))
a, _, bc = aqbc[:n], aqbc[n], aqbc[n + 1:]
s = sum(a)
t = Counter(a)
ans = []
for b, c in zip(*[iter(bc)] * 2):
s += (c - b) * t[b]
t[c] += t[b]
t[b] = 0
an... | from collections import Counter
def solve(string):
n, *aqbc = list(map(int, string.split()))
a, _, bc = aqbc[:n], aqbc[n], aqbc[n + 1:]
s = sum(a)
t = Counter(a)
ans = []
for b, c in zip(*[iter(bc)] * 2):
if b not in list(t.keys()):
ans.append(s)
con... | 20 | 23 | 455 | 535 | from collections import Counter
def solve(string):
n, *aqbc = list(map(int, string.split()))
a, _, bc = aqbc[:n], aqbc[n], aqbc[n + 1 :]
s = sum(a)
t = Counter(a)
ans = []
for b, c in zip(*[iter(bc)] * 2):
s += (c - b) * t[b]
t[c] += t[b]
t[b] = 0
ans.append(s)
... | from collections import Counter
def solve(string):
n, *aqbc = list(map(int, string.split()))
a, _, bc = aqbc[:n], aqbc[n], aqbc[n + 1 :]
s = sum(a)
t = Counter(a)
ans = []
for b, c in zip(*[iter(bc)] * 2):
if b not in list(t.keys()):
ans.append(s)
continue
... | false | 13.043478 | [
"+ if b not in list(t.keys()):",
"+ ans.append(s)",
"+ continue"
] | false | 0.060136 | 0.058104 | 1.034959 | [
"s959391585",
"s920638203"
] |
u028973125 | p02646 | python | s206741321 | s820368136 | 31 | 27 | 9,960 | 9,192 | Accepted | Accepted | 12.9 | import sys
from pprint import pprint
A, V = list(map(int, sys.stdin.readline().strip().split()))
B, W = list(map(int, sys.stdin.readline().strip().split()))
T = int(sys.stdin.readline().strip())
d = abs(A - B)
if d == 0:
print("YES")
elif V < W:
print("NO")
else:
if d <= T * (V - W):
... | import sys
A, V = list(map(int, sys.stdin.readline().split()))
B, W = list(map(int, sys.stdin.readline().split()))
T = int(sys.stdin.readline())
if W < V and abs(A - B) <= (V - W) * T:
print("YES")
else:
print("NO") | 17 | 10 | 353 | 222 | import sys
from pprint import pprint
A, V = list(map(int, sys.stdin.readline().strip().split()))
B, W = list(map(int, sys.stdin.readline().strip().split()))
T = int(sys.stdin.readline().strip())
d = abs(A - B)
if d == 0:
print("YES")
elif V < W:
print("NO")
else:
if d <= T * (V - W):
print("YES")
... | import sys
A, V = list(map(int, sys.stdin.readline().split()))
B, W = list(map(int, sys.stdin.readline().split()))
T = int(sys.stdin.readline())
if W < V and abs(A - B) <= (V - W) * T:
print("YES")
else:
print("NO")
| false | 41.176471 | [
"-from pprint import pprint",
"-A, V = list(map(int, sys.stdin.readline().strip().split()))",
"-B, W = list(map(int, sys.stdin.readline().strip().split()))",
"-T = int(sys.stdin.readline().strip())",
"-d = abs(A - B)",
"-if d == 0:",
"+A, V = list(map(int, sys.stdin.readline().split()))",
"+B, W = lis... | false | 0.049094 | 0.072318 | 0.678865 | [
"s206741321",
"s820368136"
] |
u644546699 | p02693 | python | s594003448 | s770038535 | 21 | 19 | 9,172 | 9,200 | Accepted | Accepted | 9.52 | def resolve():
K = int(eval(input()))
A, B= list(map(int, input().split()))
for i in range(A, B+1):
if i % K == 0:
print("OK")
return
print("NG")
return
if __name__ == "__main__":
resolve() | import math
def resolve():
K = int(eval(input()))
A, B= list(map(int, input().split()))
if A <= math.floor(B/K) * K:
print("OK")
else:
print("NG")
if __name__ == "__main__":
resolve() | 15 | 14 | 252 | 225 | def resolve():
K = int(eval(input()))
A, B = list(map(int, input().split()))
for i in range(A, B + 1):
if i % K == 0:
print("OK")
return
print("NG")
return
if __name__ == "__main__":
resolve()
| import math
def resolve():
K = int(eval(input()))
A, B = list(map(int, input().split()))
if A <= math.floor(B / K) * K:
print("OK")
else:
print("NG")
if __name__ == "__main__":
resolve()
| false | 6.666667 | [
"+import math",
"+",
"+",
"- for i in range(A, B + 1):",
"- if i % K == 0:",
"- print(\"OK\")",
"- return",
"- print(\"NG\")",
"- return",
"+ if A <= math.floor(B / K) * K:",
"+ print(\"OK\")",
"+ else:",
"+ print(\"NG\")"
] | false | 0.042264 | 0.091633 | 0.461236 | [
"s594003448",
"s770038535"
] |
u759412327 | p03105 | python | s983771787 | s736654709 | 24 | 18 | 2,940 | 2,940 | Accepted | Accepted | 25 | a,b,c=list(map(int,input().split()))
print((min(c,b//a))) | A,B,C = list(map(int,input().split()))
print((min(C,B//A))) | 2 | 2 | 50 | 52 | a, b, c = list(map(int, input().split()))
print((min(c, b // a)))
| A, B, C = list(map(int, input().split()))
print((min(C, B // A)))
| false | 0 | [
"-a, b, c = list(map(int, input().split()))",
"-print((min(c, b // a)))",
"+A, B, C = list(map(int, input().split()))",
"+print((min(C, B // A)))"
] | false | 0.086977 | 0.088841 | 0.979015 | [
"s983771787",
"s736654709"
] |
u906769651 | p02786 | python | s800497983 | s099594250 | 150 | 28 | 12,500 | 9,152 | Accepted | Accepted | 81.33 | import numpy as np
H=eval(input())
H=int(H)
def count(H):
count=1
while True:
if int(H/2)==0:
break
else:
H=int(H/2)
count+=1
continue
return count
A=0
for i in range(int(count(H))):
A+=2**i
print(A) | # coding: utf-8
# Your code here!
H=int(eval(input()))
count=0
ans=0
while H>1:
H=H//2
count+=1
for i in range(count+1):
ans+=2**i
print(ans) | 20 | 12 | 238 | 159 | import numpy as np
H = eval(input())
H = int(H)
def count(H):
count = 1
while True:
if int(H / 2) == 0:
break
else:
H = int(H / 2)
count += 1
continue
return count
A = 0
for i in range(int(count(H))):
A += 2**i
print(A)
| # coding: utf-8
# Your code here!
H = int(eval(input()))
count = 0
ans = 0
while H > 1:
H = H // 2
count += 1
for i in range(count + 1):
ans += 2**i
print(ans)
| false | 40 | [
"-import numpy as np",
"-",
"-H = eval(input())",
"-H = int(H)",
"-",
"-",
"-def count(H):",
"- count = 1",
"- while True:",
"- if int(H / 2) == 0:",
"- break",
"- else:",
"- H = int(H / 2)",
"- count += 1",
"- continue",
... | false | 0.0641 | 0.138299 | 0.463488 | [
"s800497983",
"s099594250"
] |
u377989038 | p03588 | python | s537155503 | s167083097 | 571 | 495 | 28,972 | 28,652 | Accepted | Accepted | 13.31 | n = int(eval(input()))
a = sorted([list(map(int, input().split())) for _ in range(n)])
cnt = a[0][0] - 1 + n + a[-1][1]
for i in range(n - 1):
cnt += min(a[i + 1][0] - a[i][0], a[i][1] - a[i + 1][1]) - 1
print(cnt) | n = int(eval(input()))
a = sorted([list(map(int, input().split())) for _ in range(n)])
print((sum(a[-1]))) | 7 | 3 | 219 | 100 | n = int(eval(input()))
a = sorted([list(map(int, input().split())) for _ in range(n)])
cnt = a[0][0] - 1 + n + a[-1][1]
for i in range(n - 1):
cnt += min(a[i + 1][0] - a[i][0], a[i][1] - a[i + 1][1]) - 1
print(cnt)
| n = int(eval(input()))
a = sorted([list(map(int, input().split())) for _ in range(n)])
print((sum(a[-1])))
| false | 57.142857 | [
"-cnt = a[0][0] - 1 + n + a[-1][1]",
"-for i in range(n - 1):",
"- cnt += min(a[i + 1][0] - a[i][0], a[i][1] - a[i + 1][1]) - 1",
"-print(cnt)",
"+print((sum(a[-1])))"
] | false | 0.034186 | 0.045906 | 0.744691 | [
"s537155503",
"s167083097"
] |
u983918956 | p03805 | python | s069651648 | s127489344 | 30 | 25 | 3,064 | 3,064 | Accepted | Accepted | 16.67 | N,M = list(map(int,input().split()))
ad = [[0]*N for _ in range(N)]
for _ in range(M):
a,b = list(map(int,input().split()))
a -= 1; b -= 1
ad[a][b] = 1
ad[b][a] = 1
ans = 0
def dfs(v=0,visited=[0]*N):
visited[v] = 1
if all(visited):
global ans
ans += 1
re... | N,M = list(map(int,input().split()))
ad = [[] for _ in range(N)]
for _ in range(M):
a,b = list(map(int,input().split()))
a -= 1; b -= 1
ad[a].append(b)
ad[b].append(a)
ans = 0
def dfs(v=0,visited=[0]*N):
visited[v] = 1
if all(visited):
global ans
ans += 1
... | 22 | 22 | 450 | 425 | N, M = list(map(int, input().split()))
ad = [[0] * N for _ in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
ad[a][b] = 1
ad[b][a] = 1
ans = 0
def dfs(v=0, visited=[0] * N):
visited[v] = 1
if all(visited):
global ans
ans += 1
retur... | N, M = list(map(int, input().split()))
ad = [[] for _ in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
ad[a].append(b)
ad[b].append(a)
ans = 0
def dfs(v=0, visited=[0] * N):
visited[v] = 1
if all(visited):
global ans
ans += 1
retu... | false | 0 | [
"-ad = [[0] * N for _ in range(N)]",
"+ad = [[] for _ in range(N)]",
"- ad[a][b] = 1",
"- ad[b][a] = 1",
"+ ad[a].append(b)",
"+ ad[b].append(a)",
"- for nv, bit in enumerate(ad[v]):",
"- if bit == 0 or visited[nv] == 1:",
"+ for nv in ad[v]:",
"+ if visited[nv] == ... | false | 0.113722 | 0.041822 | 2.719177 | [
"s069651648",
"s127489344"
] |
u367130284 | p03338 | python | s211616330 | s722813548 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | n,a=open(0).read().split();a,l=list(a),[]
for s in range(1,len(a)):l.append(len(set(a[:s])&set(a[s:])))
print((max(l))) | n,a=eval(input()),eval(input());print((max(len(set(a[:s])&set(a[s:]))for s in range(len(a))))) | 3 | 1 | 119 | 80 | n, a = open(0).read().split()
a, l = list(a), []
for s in range(1, len(a)):
l.append(len(set(a[:s]) & set(a[s:])))
print((max(l)))
| n, a = eval(input()), eval(input())
print((max(len(set(a[:s]) & set(a[s:])) for s in range(len(a)))))
| false | 66.666667 | [
"-n, a = open(0).read().split()",
"-a, l = list(a), []",
"-for s in range(1, len(a)):",
"- l.append(len(set(a[:s]) & set(a[s:])))",
"-print((max(l)))",
"+n, a = eval(input()), eval(input())",
"+print((max(len(set(a[:s]) & set(a[s:])) for s in range(len(a)))))"
] | false | 0.050288 | 0.069383 | 0.724779 | [
"s211616330",
"s722813548"
] |
u784022244 | p02732 | python | s005266337 | s288581093 | 436 | 355 | 27,024 | 26,140 | Accepted | Accepted | 18.58 | from operator import mul
from functools import reduce
def cmb(n):
return n*(n-1)//2
N=int(eval(input()))
A=list(map(int, input().split()))
#インデックス0は除外
count=[0]*(N+1)
for a in A:
count[a]+=1
cmbs=[0]*N
for i,c in enumerate(count):
if i==0:
continue
cmbs[i-1]=cmb(c)
SUM=sum(cmbs)
for... | N=int(eval(input()))
A=list(map(int, input().split()))
L=[0]*(max(A)+1)
for a in A:
L[a]+=1
#print(L)
SUM=0
for l in L:
SUM+=l*(l-1)//2
for a in A:
l=L[a]
print((SUM-l*(l-1)//2+(l-1)*(l-2)//2))
| 27 | 14 | 436 | 212 | from operator import mul
from functools import reduce
def cmb(n):
return n * (n - 1) // 2
N = int(eval(input()))
A = list(map(int, input().split()))
# インデックス0は除外
count = [0] * (N + 1)
for a in A:
count[a] += 1
cmbs = [0] * N
for i, c in enumerate(count):
if i == 0:
continue
cmbs[i - 1] = cmb... | N = int(eval(input()))
A = list(map(int, input().split()))
L = [0] * (max(A) + 1)
for a in A:
L[a] += 1
# print(L)
SUM = 0
for l in L:
SUM += l * (l - 1) // 2
for a in A:
l = L[a]
print((SUM - l * (l - 1) // 2 + (l - 1) * (l - 2) // 2))
| false | 48.148148 | [
"-from operator import mul",
"-from functools import reduce",
"-",
"-",
"-def cmb(n):",
"- return n * (n - 1) // 2",
"-",
"-",
"-# インデックス0は除外",
"-count = [0] * (N + 1)",
"+L = [0] * (max(A) + 1)",
"- count[a] += 1",
"-cmbs = [0] * N",
"-for i, c in enumerate(count):",
"- if i ==... | false | 0.050111 | 0.050459 | 0.993102 | [
"s005266337",
"s288581093"
] |
u600402037 | p03715 | python | s521132956 | s920365830 | 21 | 18 | 3,316 | 3,064 | Accepted | Accepted | 14.29 | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
H, W = lr()
if H%3==0 or W%3==0:
answer = 0
else:
answer = min(H, W)
# さらに小さくするには縦と横で割る
h = H // 3
area = [h * W, (H-h) * (W//2), (H-h) * ((W+1)//2)]
answer = min(answer, max(ar... | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
H, W = lr()
if H%3==0 or W%3==0:
answer = 0
else:
answer = min(H, W)
# さらに小さくするには縦と横で割る
def cal(H, W):
global answer
h = H // 3
area = [h * W, (H-h) * (W//2), (H-h)... | 27 | 25 | 670 | 541 | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
H, W = lr()
if H % 3 == 0 or W % 3 == 0:
answer = 0
else:
answer = min(H, W)
# さらに小さくするには縦と横で割る
h = H // 3
area = [h * W, (H - h) * (W // 2), (H - h) * ((W + 1) // 2)]
answer = min(answer, max... | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
H, W = lr()
if H % 3 == 0 or W % 3 == 0:
answer = 0
else:
answer = min(H, W)
# さらに小さくするには縦と横で割る
def cal(H, W):
global answer
h = H // 3
area = [h * W, (H - h) * (W // 2), (H - h) *... | false | 7.407407 | [
"-h = H // 3",
"-area = [h * W, (H - h) * (W // 2), (H - h) * ((W + 1) // 2)]",
"-answer = min(answer, max(area) - min(area))",
"-h += 1",
"-area = [h * W, (H - h) * (W // 2), (H - h) * ((W + 1) // 2)]",
"-answer = min(answer, max(area) - min(area))",
"-w = W // 3",
"-area = [w * H, (W - w) * (H // 2)... | false | 0.048869 | 0.048976 | 0.997831 | [
"s521132956",
"s920365830"
] |
u506858457 | p03163 | python | s972594167 | s994157270 | 150 | 134 | 68,208 | 67,072 | Accepted | Accepted | 10.67 | import sys
input = sys.stdin.readline
n,w = list(map(int,input().split()))
wv = [tuple(map(int,input().split())) for i in range(n)]
dp = [0]*(w+1)
for i in range(n):
for j in range(w,wv[i][0]-1,-1):
dp[j] = max(dp[j],dp[j-wv[i][0]]+wv[i][1])
print((max(dp))) | def MI(): return list(map(int, input().split()))
import sys
input = sys.stdin.readline
n,w = list(map(int,input().split()))
#wv = [tuple(map(int,input().split())) for i in range(n)]
W=[]
V=[]
for i in range(n):
a,b=MI()
W.append(a)
V.append(b)
dp = [0]*(w+1)
for i in range(n):
for j in range(w,W[... | 11 | 16 | 274 | 377 | import sys
input = sys.stdin.readline
n, w = list(map(int, input().split()))
wv = [tuple(map(int, input().split())) for i in range(n)]
dp = [0] * (w + 1)
for i in range(n):
for j in range(w, wv[i][0] - 1, -1):
dp[j] = max(dp[j], dp[j - wv[i][0]] + wv[i][1])
print((max(dp)))
| def MI():
return list(map(int, input().split()))
import sys
input = sys.stdin.readline
n, w = list(map(int, input().split()))
# wv = [tuple(map(int,input().split())) for i in range(n)]
W = []
V = []
for i in range(n):
a, b = MI()
W.append(a)
V.append(b)
dp = [0] * (w + 1)
for i in range(n):
for j... | false | 31.25 | [
"+def MI():",
"+ return list(map(int, input().split()))",
"+",
"+",
"-wv = [tuple(map(int, input().split())) for i in range(n)]",
"+# wv = [tuple(map(int,input().split())) for i in range(n)]",
"+W = []",
"+V = []",
"+for i in range(n):",
"+ a, b = MI()",
"+ W.append(a)",
"+ V.appen... | false | 0.046415 | 0.109268 | 0.424777 | [
"s972594167",
"s994157270"
] |
u923662841 | p02630 | python | s796659580 | s132265373 | 562 | 147 | 23,924 | 44,004 | Accepted | Accepted | 73.84 | import collections
N = int(eval(input()))
A = list(map(int, input().split()))
S = sum(A)
Q = int(eval(input()))
T = collections.Counter(A)
for i in range(Q):
b, c = list(map(int, input().split()))
S += T[b]*(c-b)
T[c] += T[b]
T[b] = 0
print(S) | def main():
n, *i = list(map(int, open(0).read().split()))
a = i[:n]
_ = i[n]
s = sum(a)
m = [0] * (10 ** 5 + 1)
for x in a:
m[x] += 1
ans = []
for b, c in zip(*[iter(i[n + 1:])] * 2):
m[c] += m[b]
s += (c - b) * m[b]
m[b] = 0
ans.... | 13 | 21 | 258 | 404 | import collections
N = int(eval(input()))
A = list(map(int, input().split()))
S = sum(A)
Q = int(eval(input()))
T = collections.Counter(A)
for i in range(Q):
b, c = list(map(int, input().split()))
S += T[b] * (c - b)
T[c] += T[b]
T[b] = 0
print(S)
| def main():
n, *i = list(map(int, open(0).read().split()))
a = i[:n]
_ = i[n]
s = sum(a)
m = [0] * (10**5 + 1)
for x in a:
m[x] += 1
ans = []
for b, c in zip(*[iter(i[n + 1 :])] * 2):
m[c] += m[b]
s += (c - b) * m[b]
m[b] = 0
ans.append(s)
prin... | false | 38.095238 | [
"-import collections",
"+def main():",
"+ n, *i = list(map(int, open(0).read().split()))",
"+ a = i[:n]",
"+ _ = i[n]",
"+ s = sum(a)",
"+ m = [0] * (10**5 + 1)",
"+ for x in a:",
"+ m[x] += 1",
"+ ans = []",
"+ for b, c in zip(*[iter(i[n + 1 :])] * 2):",
"+ ... | false | 0.048005 | 0.037081 | 1.294615 | [
"s796659580",
"s132265373"
] |
u386249594 | p03073 | python | s856297623 | s710023474 | 62 | 43 | 4,060 | 5,408 | Accepted | Accepted | 30.65 | S = eval(input())
l = "01" * (len(S)//2) + ("0" if len(S)%2 == 1 else "")
l = [int(x) + int(y) for (x,y) in zip(S,l)]
print((min(l.count(1),(l.count(0)+l.count(2)))))
| S = list(map(int,eval(input())))
l =[0,1] * (len(S)//2) + ([0] if len(S)%2 == 1 else [])
l = [x + y for (x,y) in zip(S,l)]
print((min(l.count(1),(l.count(0)+l.count(2)))))
| 7 | 7 | 168 | 173 | S = eval(input())
l = "01" * (len(S) // 2) + ("0" if len(S) % 2 == 1 else "")
l = [int(x) + int(y) for (x, y) in zip(S, l)]
print((min(l.count(1), (l.count(0) + l.count(2)))))
| S = list(map(int, eval(input())))
l = [0, 1] * (len(S) // 2) + ([0] if len(S) % 2 == 1 else [])
l = [x + y for (x, y) in zip(S, l)]
print((min(l.count(1), (l.count(0) + l.count(2)))))
| false | 0 | [
"-S = eval(input())",
"-l = \"01\" * (len(S) // 2) + (\"0\" if len(S) % 2 == 1 else \"\")",
"-l = [int(x) + int(y) for (x, y) in zip(S, l)]",
"+S = list(map(int, eval(input())))",
"+l = [0, 1] * (len(S) // 2) + ([0] if len(S) % 2 == 1 else [])",
"+l = [x + y for (x, y) in zip(S, l)]"
] | false | 0.034766 | 0.067413 | 0.515719 | [
"s856297623",
"s710023474"
] |
u706414019 | p02756 | python | s601092647 | s825569034 | 900 | 314 | 9,932 | 14,248 | Accepted | Accepted | 65.11 | s = eval(input())
Q = int(eval(input()))
rev_count = 0
sbf=''
saf=''
for i in range(Q):
que = eval(input())
if que[0] == '1':
rev_count +=1
elif que[0] == '2':
if (rev_count + int(que[2]))%2 == 0:
saf = saf + que[4]
else:
sbf = que[4] + sbf
p... | from collections import deque
s = eval(input())
Q = int(eval(input()))
SS =deque(list(s))
rev_count = 0
for i in range(Q):
que = eval(input())
if que[0] == '1':
rev_count +=1
elif que[0] == '2':
if (rev_count + int(que[2]))%2 == 0:
SS.append(que[4])
else:
... | 17 | 18 | 364 | 407 | s = eval(input())
Q = int(eval(input()))
rev_count = 0
sbf = ""
saf = ""
for i in range(Q):
que = eval(input())
if que[0] == "1":
rev_count += 1
elif que[0] == "2":
if (rev_count + int(que[2])) % 2 == 0:
saf = saf + que[4]
else:
sbf = que[4] + sbf
print((sbf +... | from collections import deque
s = eval(input())
Q = int(eval(input()))
SS = deque(list(s))
rev_count = 0
for i in range(Q):
que = eval(input())
if que[0] == "1":
rev_count += 1
elif que[0] == "2":
if (rev_count + int(que[2])) % 2 == 0:
SS.append(que[4])
else:
... | false | 5.555556 | [
"+from collections import deque",
"+",
"+SS = deque(list(s))",
"-sbf = \"\"",
"-saf = \"\"",
"- saf = saf + que[4]",
"+ SS.append(que[4])",
"- sbf = que[4] + sbf",
"-print((sbf + s + saf if rev_count % 2 == 0 else (sbf + s + saf)[-1::-1]))",
"+ SS.append... | false | 0.035646 | 0.050757 | 0.702286 | [
"s601092647",
"s825569034"
] |
u875291233 | p02564 | python | s097131683 | s708668677 | 1,535 | 1,405 | 237,316 | 232,608 | Accepted | Accepted | 8.47 | def SCC_Tarjan(g):
def dfs(v):
nonlocal idx
used[v] = 1
pre[v] = low[v] = idx
idx += 1
S.append(v)
onS[v] = 1
for c in g[v]:
if not used[c]:
dfs(c)
low[v] = min(low[v], low[c])
elif onS[c]:
... | def SCC_Tarjan(g):
def dfs(v):
nonlocal idx
pre[v] = low[v] = idx
idx += 1
S.append(v)
#onS[v] = 1
for c in g[v]:
if pre[c] == -1:
dfs(c)
low[v] = min(low[v], low[c])
#elif onS[c]:
else:
... | 67 | 66 | 1,557 | 1,581 | def SCC_Tarjan(g):
def dfs(v):
nonlocal idx
used[v] = 1
pre[v] = low[v] = idx
idx += 1
S.append(v)
onS[v] = 1
for c in g[v]:
if not used[c]:
dfs(c)
low[v] = min(low[v], low[c])
elif onS[c]:
... | def SCC_Tarjan(g):
def dfs(v):
nonlocal idx
pre[v] = low[v] = idx
idx += 1
S.append(v)
# onS[v] = 1
for c in g[v]:
if pre[c] == -1:
dfs(c)
low[v] = min(low[v], low[c])
# elif onS[c]:
else:
... | false | 1.492537 | [
"- used[v] = 1",
"- onS[v] = 1",
"+ # onS[v] = 1",
"- if not used[c]:",
"+ if pre[c] == -1:",
"- elif onS[c]:",
"+ # elif onS[c]:",
"+ else:",
"- used[v] = 2",
"- onS[w] = 0",
"+ # on... | false | 0.048215 | 0.038054 | 1.267017 | [
"s097131683",
"s708668677"
] |
u867320886 | p03112 | python | s132766103 | s170210957 | 576 | 495 | 36,612 | 38,636 | Accepted | Accepted | 14.06 | from bisect import bisect_left
a,b,q,*stx = list(map(int,open(0).read().split()))
s = [-1e10] + stx[:a] + [2*1e10]
t = [-1e10] + stx[a:-q] + [2*1e10]
x = stx[-q:]
for i in x:
pos_s = bisect_left(s,i)
pos_t = bisect_left(t,i)
sl = s[pos_s-1]; sr = s[pos_s]
tl = t[pos_t-1]; tr = t[pos_t]
ans... | from bisect import bisect
def main():
a,b,q,*stx = list(map(int,open(0).read().split()))
s = [-1e10] + stx[:a] + [2*1e10]
t = [-1e10] + stx[a:a+b] + [2*1e10]
x = stx[a+b:a+b+q]
for i in x:
pos_s = bisect(s,i)
pos_t = bisect(t,i)
sl = s[pos_s-1]; sr = s[pos_s]
... | 12 | 17 | 418 | 531 | from bisect import bisect_left
a, b, q, *stx = list(map(int, open(0).read().split()))
s = [-1e10] + stx[:a] + [2 * 1e10]
t = [-1e10] + stx[a:-q] + [2 * 1e10]
x = stx[-q:]
for i in x:
pos_s = bisect_left(s, i)
pos_t = bisect_left(t, i)
sl = s[pos_s - 1]
sr = s[pos_s]
tl = t[pos_t - 1]
tr = t[pos... | from bisect import bisect
def main():
a, b, q, *stx = list(map(int, open(0).read().split()))
s = [-1e10] + stx[:a] + [2 * 1e10]
t = [-1e10] + stx[a : a + b] + [2 * 1e10]
x = stx[a + b : a + b + q]
for i in x:
pos_s = bisect(s, i)
pos_t = bisect(t, i)
sl = s[pos_s - 1]
... | false | 29.411765 | [
"-from bisect import bisect_left",
"+from bisect import bisect",
"-a, b, q, *stx = list(map(int, open(0).read().split()))",
"-s = [-1e10] + stx[:a] + [2 * 1e10]",
"-t = [-1e10] + stx[a:-q] + [2 * 1e10]",
"-x = stx[-q:]",
"-for i in x:",
"- pos_s = bisect_left(s, i)",
"- pos_t = bisect_left(t, ... | false | 0.066326 | 0.06522 | 1.016956 | [
"s132766103",
"s170210957"
] |
u585482323 | p03128 | python | s082647829 | s649438597 | 1,860 | 990 | 236,680 | 476,168 | Accepted | Accepted | 46.77 | #!usr/bin/env python3
from collections import defaultdict
import math
import bisect
import random
def LI(): return list(map(int, input().split()))
def II(): return int(eval(input()))
def LS(): return input().split()
def S(): return list(eval(input()))
def IIR(n): return [II() for i in range(n)]
def LIR(n): re... | #!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, ... | 115 | 117 | 1,792 | 2,454 | #!usr/bin/env python3
from collections import defaultdict
import math
import bisect
import random
def LI():
return list(map(int, input().split()))
def II():
return int(eval(input()))
def LS():
return input().split()
def S():
return list(eval(input()))
def IIR(n):
return [II() for i in rang... | #!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... | false | 1.709402 | [
"+from collections import deque",
"+from heapq import heappush, heappop",
"+import sys",
"- return list(map(int, input().split()))",
"+ return list(map(int, sys.stdin.readline().split()))",
"-def II():",
"- return int(eval(input()))",
"+def I():",
"+ return int(sys.stdin.readline())",
... | false | 0.063551 | 0.090456 | 0.702566 | [
"s082647829",
"s649438597"
] |
u814986259 | p03721 | python | s122408559 | s694815908 | 485 | 425 | 29,864 | 18,616 | Accepted | Accepted | 12.37 | N,K=list(map(int,input().split()))
ab=[[0]*2 for i in range(N)]
for i in range(N):
ab[i]=list(map(int,input().split()))
ab=sorted(ab,key=lambda x:x[0])
i=-1
while(K > 0):
i+=1
K -= ab[i][1]
print((ab[i][0])) | N, K = list(map(int, input().split()))
ab = [tuple(map(int, input().split())) for i in range(N)]
ab.sort()
id = 0
for a, b in ab:
if id + b >= K:
print(a)
break
else:
id += b
| 12 | 12 | 220 | 214 | N, K = list(map(int, input().split()))
ab = [[0] * 2 for i in range(N)]
for i in range(N):
ab[i] = list(map(int, input().split()))
ab = sorted(ab, key=lambda x: x[0])
i = -1
while K > 0:
i += 1
K -= ab[i][1]
print((ab[i][0]))
| N, K = list(map(int, input().split()))
ab = [tuple(map(int, input().split())) for i in range(N)]
ab.sort()
id = 0
for a, b in ab:
if id + b >= K:
print(a)
break
else:
id += b
| false | 0 | [
"-ab = [[0] * 2 for i in range(N)]",
"-for i in range(N):",
"- ab[i] = list(map(int, input().split()))",
"-ab = sorted(ab, key=lambda x: x[0])",
"-i = -1",
"-while K > 0:",
"- i += 1",
"- K -= ab[i][1]",
"-print((ab[i][0]))",
"+ab = [tuple(map(int, input().split())) for i in range(N)]",
... | false | 0.132727 | 0.039931 | 3.323879 | [
"s122408559",
"s694815908"
] |
u707960254 | p02754 | python | s103871223 | s753709517 | 258 | 172 | 38,384 | 38,384 | Accepted | Accepted | 33.33 | n, a, b = list(map(int, input().split()))
if n%(a+b) >a:
print((int(n//(a+b))*a +a))
else:
print((int(n//(a+b))*a +n%(a+b))) | n, a, b = list(map(int, input().split()))
print((n//(a+b)*a + min(a, n%(a+b)))) | 6 | 2 | 128 | 72 | n, a, b = list(map(int, input().split()))
if n % (a + b) > a:
print((int(n // (a + b)) * a + a))
else:
print((int(n // (a + b)) * a + n % (a + b)))
| n, a, b = list(map(int, input().split()))
print((n // (a + b) * a + min(a, n % (a + b))))
| false | 66.666667 | [
"-if n % (a + b) > a:",
"- print((int(n // (a + b)) * a + a))",
"-else:",
"- print((int(n // (a + b)) * a + n % (a + b)))",
"+print((n // (a + b) * a + min(a, n % (a + b))))"
] | false | 0.006932 | 0.084642 | 0.081897 | [
"s103871223",
"s753709517"
] |
u149580849 | p04029 | python | s502739588 | s845060677 | 39 | 28 | 3,064 | 2,568 | Accepted | Accepted | 28.21 | n = int(eval(input()))
sum = 0
for num in range(1,n + 1):
sum += num
print(sum) | n = int(eval(input()))
print((sum(list(range(1,n+1))))) | 5 | 2 | 81 | 48 | n = int(eval(input()))
sum = 0
for num in range(1, n + 1):
sum += num
print(sum)
| n = int(eval(input()))
print((sum(list(range(1, n + 1)))))
| false | 60 | [
"-sum = 0",
"-for num in range(1, n + 1):",
"- sum += num",
"-print(sum)",
"+print((sum(list(range(1, n + 1)))))"
] | false | 0.032658 | 0.04134 | 0.789984 | [
"s502739588",
"s845060677"
] |
u562935282 | p03482 | python | s720026945 | s160834282 | 720 | 73 | 4,768 | 4,084 | Accepted | Accepted | 89.86 | def is_ok(k):
imos = [0] * (len(s) + 2)
for i, x in enumerate(s, 1):
imos[i] ^= imos[i - 1]
if i <= len(s) - (k - 1):
# 連続kの区間をi起点に取ることができる
if x ^ imos[i - 1]:
imos[i] ^= 1
imos[i + k] ^= 1
else:
if x ^ imos[... | s = tuple(map(int, eval(input())))
n = len(s)
ret = n
p = s[0]
for i, x in enumerate(s):
if x != p:
ret = min(ret, max(i, n - i))
p = x
print(ret)
| 36 | 10 | 711 | 167 | def is_ok(k):
imos = [0] * (len(s) + 2)
for i, x in enumerate(s, 1):
imos[i] ^= imos[i - 1]
if i <= len(s) - (k - 1):
# 連続kの区間をi起点に取ることができる
if x ^ imos[i - 1]:
imos[i] ^= 1
imos[i + k] ^= 1
else:
if x ^ imos[i - 1]:
... | s = tuple(map(int, eval(input())))
n = len(s)
ret = n
p = s[0]
for i, x in enumerate(s):
if x != p:
ret = min(ret, max(i, n - i))
p = x
print(ret)
| false | 72.222222 | [
"-def is_ok(k):",
"- imos = [0] * (len(s) + 2)",
"- for i, x in enumerate(s, 1):",
"- imos[i] ^= imos[i - 1]",
"- if i <= len(s) - (k - 1):",
"- # 連続kの区間をi起点に取ることができる",
"- if x ^ imos[i - 1]:",
"- imos[i] ^= 1",
"- imos[i + k] ^... | false | 0.044583 | 0.047007 | 0.948422 | [
"s720026945",
"s160834282"
] |
u490489966 | p02608 | python | s499397071 | s298165778 | 472 | 432 | 9,144 | 9,252 | Accepted | Accepted | 8.47 | n = int(input())
ans=[0]*(n+1)
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
a = x * x + y * y + z * z + x * y + y * z + z * x
if n >= a >= 1:
ans[a] += 1
print(*ans[1:],sep="\n")
| import math
n = int(input())
ans = [0] * (n + 1)
for x in range(1, int(math.sqrt(n))):
for y in range(1, int(math.sqrt(n))):
for z in range(1, int(math.sqrt(n))):
a = x * x + y * y + z * z + x * y + y * z + z * x
if n >= a >= 1:
ans[a] += 1
print(*ans[1:],sep... | 9 | 10 | 265 | 326 | n = int(input())
ans = [0] * (n + 1)
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
a = x * x + y * y + z * z + x * y + y * z + z * x
if n >= a >= 1:
ans[a] += 1
print(*ans[1:], sep="\n")
| import math
n = int(input())
ans = [0] * (n + 1)
for x in range(1, int(math.sqrt(n))):
for y in range(1, int(math.sqrt(n))):
for z in range(1, int(math.sqrt(n))):
a = x * x + y * y + z * z + x * y + y * z + z * x
if n >= a >= 1:
ans[a] += 1
print(*ans[1:], sep="\n")
| false | 10 | [
"+import math",
"+",
"-for x in range(1, 101):",
"- for y in range(1, 101):",
"- for z in range(1, 101):",
"+for x in range(1, int(math.sqrt(n))):",
"+ for y in range(1, int(math.sqrt(n))):",
"+ for z in range(1, int(math.sqrt(n))):"
] | false | 1.261489 | 0.050103 | 25.17796 | [
"s499397071",
"s298165778"
] |
u560867850 | p03325 | python | s529129652 | s617734126 | 115 | 65 | 4,148 | 3,828 | Accepted | Accepted | 43.48 | n = int(eval(input()))
a = [int(c) for c in input().split()]
count = 0
for n in a:
x = n
while x % 2 == 0:
x /= 2
count += 1
print(count) | def main():
N = int(eval(input()))
ans = 0
for a in [x for x in map(int, input().split()) if x % 2 == 0]:
i = a
while i % 2 == 0:
i //= 2
ans += 1
print(ans)
main() | 11 | 12 | 167 | 230 | n = int(eval(input()))
a = [int(c) for c in input().split()]
count = 0
for n in a:
x = n
while x % 2 == 0:
x /= 2
count += 1
print(count)
| def main():
N = int(eval(input()))
ans = 0
for a in [x for x in map(int, input().split()) if x % 2 == 0]:
i = a
while i % 2 == 0:
i //= 2
ans += 1
print(ans)
main()
| false | 8.333333 | [
"-n = int(eval(input()))",
"-a = [int(c) for c in input().split()]",
"-count = 0",
"-for n in a:",
"- x = n",
"- while x % 2 == 0:",
"- x /= 2",
"- count += 1",
"-print(count)",
"+def main():",
"+ N = int(eval(input()))",
"+ ans = 0",
"+ for a in [x for x in map(... | false | 0.037835 | 0.038173 | 0.991126 | [
"s529129652",
"s617734126"
] |
u915355756 | p03071 | python | s681478682 | s664963614 | 149 | 18 | 12,488 | 2,940 | Accepted | Accepted | 87.92 | import numpy as np
#input
[A,B] = list(map(int,input().split()))
#[A,B] = [5,5]
ans = 0
if A == B:
ans = 2*A
else:
ans = 2*max(A,B) - 1
print(ans) |
#input
#[A, B] = [5, 3]
[A, B] = list(map(int,input().split()))
if A == B:
print((2*A))
else:
print((2*max(A,B)-1))
| 10 | 17 | 163 | 162 | import numpy as np
# input
[A, B] = list(map(int, input().split()))
# [A,B] = [5,5]
ans = 0
if A == B:
ans = 2 * A
else:
ans = 2 * max(A, B) - 1
print(ans)
| # input
# [A, B] = [5, 3]
[A, B] = list(map(int, input().split()))
if A == B:
print((2 * A))
else:
print((2 * max(A, B) - 1))
| false | 41.176471 | [
"-import numpy as np",
"-",
"+# [A, B] = [5, 3]",
"-# [A,B] = [5,5]",
"-ans = 0",
"- ans = 2 * A",
"+ print((2 * A))",
"- ans = 2 * max(A, B) - 1",
"-print(ans)",
"+ print((2 * max(A, B) - 1))"
] | false | 0.03778 | 0.059507 | 0.634878 | [
"s681478682",
"s664963614"
] |
u580996582 | p03478 | python | s798995197 | s885514252 | 1,443 | 33 | 3,060 | 3,060 | Accepted | Accepted | 97.71 | n,a,b = list(map(int,input().split()))
ans = 0;
for i in range(1,n+1):
sum = 0;
x = i;
while x:
sum += int(x%10);
x/=10;
if a <= sum <= b:
ans+=i;
print(("%d" % (ans) )); | # n,a,b = map(int,input().split())
# ans = 0;
# for i in range(1,n+1):
# sum = 0;
# x = i;
# while x:
# sum += int(x%10);
# x/=10;
# if a <= sum <= b:
# ans+=i;
# print("%d" % (ans) );
n,a,b = list(map(int,input().split()))
ans = 0;
for i in range(n+1):
str_i ... | 11 | 22 | 212 | 432 | n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
sum = 0
x = i
while x:
sum += int(x % 10)
x /= 10
if a <= sum <= b:
ans += i
print(("%d" % (ans)))
| # n,a,b = map(int,input().split())
# ans = 0;
# for i in range(1,n+1):
# sum = 0;
# x = i;
# while x:
# sum += int(x%10);
# x/=10;
# if a <= sum <= b:
# ans+=i;
# print("%d" % (ans) );
n, a, b = list(map(int, input().split()))
ans = 0
for i in range(n + 1):
str_i = str(i)
... | false | 50 | [
"+# n,a,b = map(int,input().split())",
"+# ans = 0;",
"+# for i in range(1,n+1):",
"+# sum = 0;",
"+# x = i;",
"+# while x:",
"+# sum += int(x%10);",
"+# x/=10;",
"+# if a <= sum <= b:",
"+# ans+=i;",
"+# print(\"%d\" % (ans) );",
"-for i in range(1, n +... | false | 0.053513 | 0.007073 | 7.565693 | [
"s798995197",
"s885514252"
] |
u560867850 | p03038 | python | s004145290 | s403596964 | 363 | 334 | 25,372 | 22,292 | Accepted | Accepted | 7.99 | import heapq
import sys
input = sys.stdin.readline
def readlines(n):
for _ in range(n):
b, c = list(map(int, input().split()))
yield b, c
def main():
_, M = list(map(int, input().split()))
A = list(map(int, input().split()))
total = sum(A)
heapq.heapify(A)
for b... | import heapq
import sys
input = sys.stdin.readline
from operator import itemgetter
def readlines(n):
for _ in range(n):
b, c = list(map(int, input().split()))
yield b, c
def main():
_, M = list(map(int, input().split()))
A = list(map(int, input().split()))
total = sum(A)
... | 26 | 27 | 565 | 610 | import heapq
import sys
input = sys.stdin.readline
def readlines(n):
for _ in range(n):
b, c = list(map(int, input().split()))
yield b, c
def main():
_, M = list(map(int, input().split()))
A = list(map(int, input().split()))
total = sum(A)
heapq.heapify(A)
for b, c in sorted... | import heapq
import sys
input = sys.stdin.readline
from operator import itemgetter
def readlines(n):
for _ in range(n):
b, c = list(map(int, input().split()))
yield b, c
def main():
_, M = list(map(int, input().split()))
A = list(map(int, input().split()))
total = sum(A)
heapq.h... | false | 3.703704 | [
"+from operator import itemgetter",
"- for b, c in sorted(readlines(M), key=lambda x: -x[1]):",
"+ for b, c in sorted(readlines(M), key=itemgetter(1), reverse=True):"
] | false | 0.040661 | 0.10182 | 0.399341 | [
"s004145290",
"s403596964"
] |
u392319141 | p03658 | python | s984895969 | s920226727 | 181 | 18 | 38,384 | 2,940 | Accepted | Accepted | 90.06 | N, K = list(map(int, input().split()))
L = list(map(int, input().split()))
L.sort(reverse=True)
print((sum(L[:K])))
| N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort(reverse=True)
print((sum(A[:K]))) | 5 | 4 | 113 | 110 | N, K = list(map(int, input().split()))
L = list(map(int, input().split()))
L.sort(reverse=True)
print((sum(L[:K])))
| N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort(reverse=True)
print((sum(A[:K])))
| false | 20 | [
"-L = list(map(int, input().split()))",
"-L.sort(reverse=True)",
"-print((sum(L[:K])))",
"+A = list(map(int, input().split()))",
"+A.sort(reverse=True)",
"+print((sum(A[:K])))"
] | false | 0.036331 | 0.036336 | 0.999857 | [
"s984895969",
"s920226727"
] |
u489959379 | p03524 | python | s387982889 | s042923119 | 25 | 18 | 3,956 | 3,188 | Accepted | Accepted | 28 | S = list(eval(input()))
ma = 0
for s in set(S):
cnt = S.count(s)
ma = max(ma, cnt)
if len(S) - ma >= (ma - 1) * 2 or len(S) == 1:
print("YES")
else:
print("NO") | # https://atcoder.jp/contests/cf17-final/submissions/12544627
# B - Palindrome-phobia
import sys
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
s = eval(input())
a = s.count("a")
b = s.count("b")
c = s.count("c")
print(("YES" if max(a, b, c)... | 11 | 21 | 171 | 392 | S = list(eval(input()))
ma = 0
for s in set(S):
cnt = S.count(s)
ma = max(ma, cnt)
if len(S) - ma >= (ma - 1) * 2 or len(S) == 1:
print("YES")
else:
print("NO")
| # https://atcoder.jp/contests/cf17-final/submissions/12544627
# B - Palindrome-phobia
import sys
sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
s = eval(input())
a = s.count("a")
b = s.count("b")
c = s.count("c")
print(("YES" if max(a, b, c) <= min(a, b, c) + 1 e... | false | 47.619048 | [
"-S = list(eval(input()))",
"-ma = 0",
"-for s in set(S):",
"- cnt = S.count(s)",
"- ma = max(ma, cnt)",
"-if len(S) - ma >= (ma - 1) * 2 or len(S) == 1:",
"- print(\"YES\")",
"-else:",
"- print(\"NO\")",
"+# https://atcoder.jp/contests/cf17-final/submissions/12544627",
"+# B - Palin... | false | 0.044082 | 0.077851 | 0.566245 | [
"s387982889",
"s042923119"
] |
u588341295 | p03946 | python | s759482629 | s977149473 | 91 | 83 | 15,020 | 15,060 | Accepted | Accepted | 8.79 | # -*- coding: utf-8 -*-
"""
参考:https://atcoder.jp/contests/abc047/submissions/4077573
"""
import sys
import re
from collections import deque, Counter, defaultdict
from math import sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bise... | # -*- coding: utf-8 -*-
"""
参考:https://atcoder.jp/contests/abc047/submissions/4077573
"""
import sys
def input(): return sys.stdin.readline().strip()
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD =... | 44 | 33 | 1,173 | 683 | # -*- coding: utf-8 -*-
"""
参考:https://atcoder.jp/contests/abc047/submissions/4077573
"""
import sys
import re
from collections import deque, Counter, defaultdict
from math import sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bise... | # -*- coding: utf-8 -*-
"""
参考:https://atcoder.jp/contests/abc047/submissions/4077573
"""
import sys
def input():
return sys.stdin.readline().strip()
def MAP():
return list(map(int, input().split()))
def LIST():
return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
INF = float("inf")
M... | false | 25 | [
"-import re",
"-from collections import deque, Counter, defaultdict",
"-from math import sqrt, hypot, factorial, pi, sin, cos, radians",
"-from heapq import heappop, heappush, heapify, heappushpop",
"-from bisect import bisect_left, bisect_right",
"-from itertools import permutations, product, combination... | false | 0.039283 | 0.166414 | 0.236058 | [
"s759482629",
"s977149473"
] |
u864197622 | p03198 | python | s846784970 | s375142912 | 811 | 552 | 28,432 | 30,484 | Accepted | Accepted | 31.94 | from collections import deque
q = deque([])
def ct(a,b):
ans = 0
while abs(a)<abs(b):
ans += 2
a *= 4
return ans
N = int(eval(input()))
A = [int(a) for a in input().split()]
# A = [3, 1, 4, 1]
# N = len(A)
X = [0] * (N)
Y = [0] * (N)
a = -1
for i in range(N):
... | def f(A, s):
X = [0] * N
q = []
a = 0
for i in range(N):
b = a
X[i] = X[i-1]
a = A[i]
if a * s < 0:
X[i] += 1
a *= -2
if i == 0:
continue
r = b/a
while r >= 4:
q.append(... | 81 | 35 | 1,401 | 660 | from collections import deque
q = deque([])
def ct(a, b):
ans = 0
while abs(a) < abs(b):
ans += 2
a *= 4
return ans
N = int(eval(input()))
A = [int(a) for a in input().split()]
# A = [3, 1, 4, 1]
# N = len(A)
X = [0] * (N)
Y = [0] * (N)
a = -1
for i in range(N):
b = a
if i > 0:
... | def f(A, s):
X = [0] * N
q = []
a = 0
for i in range(N):
b = a
X[i] = X[i - 1]
a = A[i]
if a * s < 0:
X[i] += 1
a *= -2
if i == 0:
continue
r = b / a
while r >= 4:
q.append(i)
r /= 4
... | false | 56.790123 | [
"-from collections import deque",
"-",
"-q = deque([])",
"-",
"-",
"-def ct(a, b):",
"- ans = 0",
"- while abs(a) < abs(b):",
"- ans += 2",
"- a *= 4",
"- return ans",
"+def f(A, s):",
"+ X = [0] * N",
"+ q = []",
"+ a = 0",
"+ for i in range(N):",
... | false | 0.037024 | 0.037808 | 0.979282 | [
"s846784970",
"s375142912"
] |
u708890186 | p02773 | python | s149657818 | s047100707 | 868 | 719 | 47,640 | 47,640 | Accepted | Accepted | 17.17 | import collections
N = int(eval(input()))
s = [eval(input()) for i in range(N)]
counter = collections.Counter(s)
count = counter.most_common()
most = count[0][1]
c =[]
for i in range(len(count)):
if count[i][1] == most:
c.append(count[i][0])
c.sort()
for i in range(len(c)):
pr... | import collections
N = int(eval(input()))
s = [eval(input()) for i in range(N)]
counter = collections.Counter(s)
count = counter.most_common()
most = count[0][1]
c =[]
for i in range(len(counter)):
if count[i][1] == most:
c.append(count[i][0])
c.sort()
for i in range(len(c)):
... | 18 | 18 | 317 | 319 | import collections
N = int(eval(input()))
s = [eval(input()) for i in range(N)]
counter = collections.Counter(s)
count = counter.most_common()
most = count[0][1]
c = []
for i in range(len(count)):
if count[i][1] == most:
c.append(count[i][0])
c.sort()
for i in range(len(c)):
print((c[i]))
| import collections
N = int(eval(input()))
s = [eval(input()) for i in range(N)]
counter = collections.Counter(s)
count = counter.most_common()
most = count[0][1]
c = []
for i in range(len(counter)):
if count[i][1] == most:
c.append(count[i][0])
c.sort()
for i in range(len(c)):
print((c[i]))
| false | 0 | [
"-for i in range(len(count)):",
"+for i in range(len(counter)):"
] | false | 0.08123 | 0.040599 | 2.000774 | [
"s149657818",
"s047100707"
] |
u368796742 | p02726 | python | s267203059 | s808462083 | 1,378 | 950 | 3,444 | 135,560 | Accepted | Accepted | 31.06 | n,x,y = list(map(int,input().split()))
ans = [0]*(n)
for i in range(1,n):
for j in range(i+1,n+1):
d = min(j-i,abs(x-i)+abs(y-j)+1)
ans[d] += 1
for i in ans[1:]:
print(i) | def main():
import sys
input = sys.stdin.readline
from collections import deque
n,x,y = list(map(int,input().split()))
ans = [0]*(n)
E = [[] for i in range(n)]
E[0].append(1)
E[n-1].append(n-2)
for i in range(1,n-1):
E[i].append(i-1)
E[i].append(i+1)
E... | 9 | 41 | 197 | 990 | n, x, y = list(map(int, input().split()))
ans = [0] * (n)
for i in range(1, n):
for j in range(i + 1, n + 1):
d = min(j - i, abs(x - i) + abs(y - j) + 1)
ans[d] += 1
for i in ans[1:]:
print(i)
| def main():
import sys
input = sys.stdin.readline
from collections import deque
n, x, y = list(map(int, input().split()))
ans = [0] * (n)
E = [[] for i in range(n)]
E[0].append(1)
E[n - 1].append(n - 2)
for i in range(1, n - 1):
E[i].append(i - 1)
E[i].append(i + 1)... | false | 78.04878 | [
"-n, x, y = list(map(int, input().split()))",
"-ans = [0] * (n)",
"-for i in range(1, n):",
"- for j in range(i + 1, n + 1):",
"- d = min(j - i, abs(x - i) + abs(y - j) + 1)",
"- ans[d] += 1",
"-for i in ans[1:]:",
"- print(i)",
"+def main():",
"+ import sys",
"+",
"+ ... | false | 0.130102 | 0.041388 | 3.143477 | [
"s267203059",
"s808462083"
] |
u782685137 | p03200 | python | s905775357 | s974745647 | 45 | 41 | 11,428 | 11,428 | Accepted | Accepted | 8.89 | S=input()[::-1]
n=len(S)
l=list(i for i in range(n) if S[i]=='B')
k=len(l)*(len(l)-1)//2
print((sum(l)-k)) | l=[i for i,s in enumerate(input()[::-1])if s=='B']
m=len(l)
print((sum(l)-m*~-m//2)) | 5 | 3 | 108 | 84 | S = input()[::-1]
n = len(S)
l = list(i for i in range(n) if S[i] == "B")
k = len(l) * (len(l) - 1) // 2
print((sum(l) - k))
| l = [i for i, s in enumerate(input()[::-1]) if s == "B"]
m = len(l)
print((sum(l) - m * ~-m // 2))
| false | 40 | [
"-S = input()[::-1]",
"-n = len(S)",
"-l = list(i for i in range(n) if S[i] == \"B\")",
"-k = len(l) * (len(l) - 1) // 2",
"-print((sum(l) - k))",
"+l = [i for i, s in enumerate(input()[::-1]) if s == \"B\"]",
"+m = len(l)",
"+print((sum(l) - m * ~-m // 2))"
] | false | 0.063191 | 0.04632 | 1.36422 | [
"s905775357",
"s974745647"
] |
u475675023 | p02843 | python | s202431964 | s784604441 | 29 | 24 | 2,940 | 2,940 | Accepted | Accepted | 17.24 | x=int(eval(input()))
for i in range(1,100000):
if 100*i<=x<=105*i:
print((1))
exit()
print((0)) | x=int(eval(input()))
print((1 if x<=x//100*105 else 0)) | 6 | 2 | 100 | 48 | x = int(eval(input()))
for i in range(1, 100000):
if 100 * i <= x <= 105 * i:
print((1))
exit()
print((0))
| x = int(eval(input()))
print((1 if x <= x // 100 * 105 else 0))
| false | 66.666667 | [
"-for i in range(1, 100000):",
"- if 100 * i <= x <= 105 * i:",
"- print((1))",
"- exit()",
"-print((0))",
"+print((1 if x <= x // 100 * 105 else 0))"
] | false | 0.043455 | 0.080032 | 0.542979 | [
"s202431964",
"s784604441"
] |
u357630630 | p03556 | python | s678617225 | s356733033 | 73 | 67 | 8,548 | 5,864 | Accepted | Accepted | 8.22 | N=int(input())
[exit(0) if i ** 2 > N else print(i ** 2) if (i+1) ** 2 > N else print("", end="") for i in range(1, N+1)]
| N=int(input())
[exit(0)if i**2>N else print(i**2)if(i+1)**2>N else print(end="")for i in range(1,N+1)]
| 2 | 2 | 122 | 103 | N = int(input())
[
exit(0) if i ** 2 > N else print(i**2) if (i + 1) ** 2 > N else print("", end="")
for i in range(1, N + 1)
]
| N = int(input())
[
exit(0) if i ** 2 > N else print(i**2) if (i + 1) ** 2 > N else print(end="")
for i in range(1, N + 1)
]
| false | 0 | [
"- exit(0) if i ** 2 > N else print(i**2) if (i + 1) ** 2 > N else print(\"\", end=\"\")",
"+ exit(0) if i ** 2 > N else print(i**2) if (i + 1) ** 2 > N else print(end=\"\")"
] | false | 0.041205 | 0.05183 | 0.795012 | [
"s678617225",
"s356733033"
] |
u978313283 | p03309 | python | s596681009 | s962676332 | 380 | 187 | 29,748 | 26,704 | Accepted | Accepted | 50.79 | N=int(eval(input()))
A=list(map(int,input().split()))
A=[a-i for i,a in enumerate(A,1)]
A.sort()
A_posi=[0 for i in range(N)]
A_posi[0]=A[0]
for i in range(1,N):
A_posi[i]=A_posi[i-1]+A[i]
value=[0 for i in range(N)]
value[0]=A_posi[N-1]-N*A[0]
for i in range(1,N):
value[i]=A_posi[N-1]-A_posi[i]-(N-i... | N=int(eval(input()))
A=list(map(int,input().split()))
A=[a-i for i,a in enumerate(A,1)]
A.sort()
b=A[len(A)//2]
A=[abs(a-b) for a in A]
print((sum(A)))
| 13 | 7 | 363 | 150 | N = int(eval(input()))
A = list(map(int, input().split()))
A = [a - i for i, a in enumerate(A, 1)]
A.sort()
A_posi = [0 for i in range(N)]
A_posi[0] = A[0]
for i in range(1, N):
A_posi[i] = A_posi[i - 1] + A[i]
value = [0 for i in range(N)]
value[0] = A_posi[N - 1] - N * A[0]
for i in range(1, N):
value[i] = (
... | N = int(eval(input()))
A = list(map(int, input().split()))
A = [a - i for i, a in enumerate(A, 1)]
A.sort()
b = A[len(A) // 2]
A = [abs(a - b) for a in A]
print((sum(A)))
| false | 46.153846 | [
"-A_posi = [0 for i in range(N)]",
"-A_posi[0] = A[0]",
"-for i in range(1, N):",
"- A_posi[i] = A_posi[i - 1] + A[i]",
"-value = [0 for i in range(N)]",
"-value[0] = A_posi[N - 1] - N * A[0]",
"-for i in range(1, N):",
"- value[i] = (",
"- A_posi[N - 1] - A_posi[i] - (N - i - 1) * A[i]... | false | 0.035794 | 0.036046 | 0.993015 | [
"s596681009",
"s962676332"
] |
u580404776 | p03814 | python | s237196783 | s651779990 | 26 | 18 | 6,180 | 3,500 | Accepted | Accepted | 30.77 | S=list(eval(input()))
N=len(S)
pos_Z=N-S[::-1].index("Z")
pos_A=S.index("A")
print((pos_Z-pos_A)) | S=eval(input())
print((S.rfind("Z")-S.find("A")+1)) | 5 | 2 | 93 | 44 | S = list(eval(input()))
N = len(S)
pos_Z = N - S[::-1].index("Z")
pos_A = S.index("A")
print((pos_Z - pos_A))
| S = eval(input())
print((S.rfind("Z") - S.find("A") + 1))
| false | 60 | [
"-S = list(eval(input()))",
"-N = len(S)",
"-pos_Z = N - S[::-1].index(\"Z\")",
"-pos_A = S.index(\"A\")",
"-print((pos_Z - pos_A))",
"+S = eval(input())",
"+print((S.rfind(\"Z\") - S.find(\"A\") + 1))"
] | false | 0.036493 | 0.037032 | 0.985457 | [
"s237196783",
"s651779990"
] |
u759412327 | p03327 | python | s284826229 | s518533112 | 20 | 17 | 3,060 | 2,940 | Accepted | Accepted | 15 | print("ABC") if int(input())<=999 else print("ABD")
| if int(eval(input()))<1000:
print("ABC")
else:
print("ABD") | 1 | 4 | 51 | 60 | print("ABC") if int(input()) <= 999 else print("ABD")
| if int(eval(input())) < 1000:
print("ABC")
else:
print("ABD")
| false | 75 | [
"-print(\"ABC\") if int(input()) <= 999 else print(\"ABD\")",
"+if int(eval(input())) < 1000:",
"+ print(\"ABC\")",
"+else:",
"+ print(\"ABD\")"
] | false | 0.045187 | 0.045266 | 0.998259 | [
"s284826229",
"s518533112"
] |
u067694718 | p03617 | python | s157853000 | s716499763 | 31 | 28 | 9,152 | 9,156 | Accepted | Accepted | 9.68 | q, h, s, d = [int(i) for i in input().split()]
n = int(eval(input()))
d = min(min(d, s*2), min(h*4, q*8))
s = min(s, min(h*2, q*4))
h = min(h, q*2)
ans = (n // 2) * d
n %= 2
while n > 0:
if n >= 1:
n -= 1
ans += s
elif n >= 0.5:
n -= 0.5
ans += h
else:
... | q, h, s, d = [int(i) for i in input().split()]
n = int(eval(input()))
d = min(min(d, s*2), min(h*4, q*8))
s = min(s, min(h*2, q*4))
print(((n // 2) * d + (n % 2) * s)) | 19 | 5 | 355 | 163 | q, h, s, d = [int(i) for i in input().split()]
n = int(eval(input()))
d = min(min(d, s * 2), min(h * 4, q * 8))
s = min(s, min(h * 2, q * 4))
h = min(h, q * 2)
ans = (n // 2) * d
n %= 2
while n > 0:
if n >= 1:
n -= 1
ans += s
elif n >= 0.5:
n -= 0.5
ans += h
else:
n -... | q, h, s, d = [int(i) for i in input().split()]
n = int(eval(input()))
d = min(min(d, s * 2), min(h * 4, q * 8))
s = min(s, min(h * 2, q * 4))
print(((n // 2) * d + (n % 2) * s))
| false | 73.684211 | [
"-h = min(h, q * 2)",
"-ans = (n // 2) * d",
"-n %= 2",
"-while n > 0:",
"- if n >= 1:",
"- n -= 1",
"- ans += s",
"- elif n >= 0.5:",
"- n -= 0.5",
"- ans += h",
"- else:",
"- n -= 0.25",
"- ans += q",
"-print(ans)",
"+print(((n // 2) *... | false | 0.008053 | 0.067138 | 0.119941 | [
"s157853000",
"s716499763"
] |
u077291787 | p03503 | python | s151421563 | s258250295 | 227 | 195 | 3,316 | 3,316 | Accepted | Accepted | 14.1 | # ABC080C - Shopping Street
import sys
input = sys.stdin.readline
from itertools import product
def main():
N = int(eval(input()))
F = tuple(tuple(map(int, input().split())) for _ in range(N))
P = tuple(tuple(map(int, input().split())) for _ in range(N))
ans = []
for b in tuple(product(... | # ABC080C - Shopping Street
import sys
input = sys.stdin.readline
from itertools import product
def main():
N = int(eval(input()))
F = tuple(tuple(map(int, input().split())) for _ in range(N))
P = tuple(tuple(map(int, input().split())) for _ in range(N))
ans = []
for b in tuple(product(... | 22 | 22 | 579 | 561 | # ABC080C - Shopping Street
import sys
input = sys.stdin.readline
from itertools import product
def main():
N = int(eval(input()))
F = tuple(tuple(map(int, input().split())) for _ in range(N))
P = tuple(tuple(map(int, input().split())) for _ in range(N))
ans = []
for b in tuple(product((0, 1), re... | # ABC080C - Shopping Street
import sys
input = sys.stdin.readline
from itertools import product
def main():
N = int(eval(input()))
F = tuple(tuple(map(int, input().split())) for _ in range(N))
P = tuple(tuple(map(int, input().split())) for _ in range(N))
ans = []
for b in tuple(product((0, 1), re... | false | 0 | [
"- opening = sum(b[i] == 1 and b[i] == f[i] for i in range(10))",
"+ opening = sum(i & j for i, j in zip(b, f))"
] | false | 0.057153 | 0.051796 | 1.103429 | [
"s151421563",
"s258250295"
] |
u338068977 | p03069 | python | s849020094 | s868057058 | 761 | 108 | 36,096 | 3,500 | Accepted | Accepted | 85.81 | import numpy
N=int(eval(input()))
S=list(map(str,eval(input())))
S_modify = [0 if i=="." else 1 for i in S]
count_list = []
sum_list=numpy.cumsum(S_modify)
sum_list_reverse=numpy.cumsum(S_modify[::-1])
for i in range(N):
count = sum_list[i]+((N-i-1)-sum_list_reverse[N-i-1])
count_list.append(count)
... | N = int(eval(input()))
S = eval(input())
left_black=0
right_white=S.count(".")
ans=left_black+right_white
for i in S:
if i==".":
right_white-=1
ans=min(ans,left_black+right_white)
else:
left_black+=1
ans=min(ans,left_black+right_white)
print(ans) | 12 | 15 | 330 | 292 | import numpy
N = int(eval(input()))
S = list(map(str, eval(input())))
S_modify = [0 if i == "." else 1 for i in S]
count_list = []
sum_list = numpy.cumsum(S_modify)
sum_list_reverse = numpy.cumsum(S_modify[::-1])
for i in range(N):
count = sum_list[i] + ((N - i - 1) - sum_list_reverse[N - i - 1])
count_list.ap... | N = int(eval(input()))
S = eval(input())
left_black = 0
right_white = S.count(".")
ans = left_black + right_white
for i in S:
if i == ".":
right_white -= 1
ans = min(ans, left_black + right_white)
else:
left_black += 1
ans = min(ans, left_black + right_white)
print(ans)
| false | 20 | [
"-import numpy",
"-",
"-S = list(map(str, eval(input())))",
"-S_modify = [0 if i == \".\" else 1 for i in S]",
"-count_list = []",
"-sum_list = numpy.cumsum(S_modify)",
"-sum_list_reverse = numpy.cumsum(S_modify[::-1])",
"-for i in range(N):",
"- count = sum_list[i] + ((N - i - 1) - sum_list_reve... | false | 0.172498 | 0.085237 | 2.023747 | [
"s849020094",
"s868057058"
] |
u987170100 | p03273 | python | s647942208 | s623926670 | 28 | 18 | 4,468 | 3,060 | Accepted | Accepted | 35.71 | H, W = map(int, input().split())
lst = []
for _ in range(H):
s = input()
if s.find('#') >= 0:
lst.append(s)
lst2 = []
for w in range(W):
skip = True
for h in range(len(lst)):
if lst[h][w] == '#':
skip = False
break
lst2.append(skip)
for x in ... | H, W = list(map(int, input().split()))
lst = []
for _ in range(H):
s = eval(input())
if s.find('#') >= 0:
lst.append(s)
lst2 = []
for tpl in zip(*lst):
if '#' in tpl:
lst2.append(tpl)
for tpl in zip(*lst2):
print((''.join(tpl))) | 21 | 14 | 427 | 261 | H, W = map(int, input().split())
lst = []
for _ in range(H):
s = input()
if s.find("#") >= 0:
lst.append(s)
lst2 = []
for w in range(W):
skip = True
for h in range(len(lst)):
if lst[h][w] == "#":
skip = False
break
lst2.append(skip)
for x in lst:
for idx, ... | H, W = list(map(int, input().split()))
lst = []
for _ in range(H):
s = eval(input())
if s.find("#") >= 0:
lst.append(s)
lst2 = []
for tpl in zip(*lst):
if "#" in tpl:
lst2.append(tpl)
for tpl in zip(*lst2):
print(("".join(tpl)))
| false | 33.333333 | [
"-H, W = map(int, input().split())",
"+H, W = list(map(int, input().split()))",
"- s = input()",
"+ s = eval(input())",
"-for w in range(W):",
"- skip = True",
"- for h in range(len(lst)):",
"- if lst[h][w] == \"#\":",
"- skip = False",
"- break",
"- l... | false | 0.074306 | 0.119411 | 0.62227 | [
"s647942208",
"s623926670"
] |
u934442292 | p04012 | python | s521256635 | s986245020 | 25 | 20 | 3,772 | 3,316 | Accepted | Accepted | 20 | import string
import sys
input = sys.stdin.readline
AL = string.ascii_lowercase
def main():
w = input().rstrip()
ans = "Yes"
for s in AL:
cnt = w.count(s)
if cnt % 2 == 1:
ans = "No"
print(ans)
if __name__ == "__main__":
main()
| import sys
from collections import Counter
input = sys.stdin.readline
def main():
w = input().rstrip()
c = Counter(w)
ans = "Yes"
for v in list(c.values()):
if v % 2 != 0:
ans = "No"
print(ans)
if __name__ == "__main__":
main()
| 19 | 20 | 299 | 292 | import string
import sys
input = sys.stdin.readline
AL = string.ascii_lowercase
def main():
w = input().rstrip()
ans = "Yes"
for s in AL:
cnt = w.count(s)
if cnt % 2 == 1:
ans = "No"
print(ans)
if __name__ == "__main__":
main()
| import sys
from collections import Counter
input = sys.stdin.readline
def main():
w = input().rstrip()
c = Counter(w)
ans = "Yes"
for v in list(c.values()):
if v % 2 != 0:
ans = "No"
print(ans)
if __name__ == "__main__":
main()
| false | 5 | [
"-import string",
"+from collections import Counter",
"-AL = string.ascii_lowercase",
"+ c = Counter(w)",
"- for s in AL:",
"- cnt = w.count(s)",
"- if cnt % 2 == 1:",
"+ for v in list(c.values()):",
"+ if v % 2 != 0:"
] | false | 0.047018 | 0.04462 | 1.053738 | [
"s521256635",
"s986245020"
] |
u094191970 | p02556 | python | s812785366 | s330187328 | 461 | 238 | 48,776 | 24,904 | Accepted | Accepted | 48.37 | from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
lnii=lambda:tuple(map(int,stdin.readline().split()))
n=int(eval(input()))
l=set(tuple([lnii() for i in range(n)]))
if len(l)==1:
print((0))
exit()
x_max=0
x_min=10**10
y_max=0
y_min=10**10
for x,y in l:
# s=abs(x-y)
... | from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
lnii=lambda:list(map(int,stdin.readline().split()))
n=int(eval(input()))
z=[]
w=[]
for i in range(n):
x,y=nii()
z.append(x-y)
w.append(x+y)
z_ans=max(z)-min(z)
w_ans=max(w)-min(w)
print((max(z_ans,w_ans))) | 31 | 16 | 490 | 288 | from sys import stdin
nii = lambda: list(map(int, stdin.readline().split()))
lnii = lambda: tuple(map(int, stdin.readline().split()))
n = int(eval(input()))
l = set(tuple([lnii() for i in range(n)]))
if len(l) == 1:
print((0))
exit()
x_max = 0
x_min = 10**10
y_max = 0
y_min = 10**10
for x, y in l:
# s=abs... | from sys import stdin
nii = lambda: list(map(int, stdin.readline().split()))
lnii = lambda: list(map(int, stdin.readline().split()))
n = int(eval(input()))
z = []
w = []
for i in range(n):
x, y = nii()
z.append(x - y)
w.append(x + y)
z_ans = max(z) - min(z)
w_ans = max(w) - min(w)
print((max(z_ans, w_ans))... | false | 48.387097 | [
"-lnii = lambda: tuple(map(int, stdin.readline().split()))",
"+lnii = lambda: list(map(int, stdin.readline().split()))",
"-l = set(tuple([lnii() for i in range(n)]))",
"-if len(l) == 1:",
"- print((0))",
"- exit()",
"-x_max = 0",
"-x_min = 10**10",
"-y_max = 0",
"-y_min = 10**10",
"-for x,... | false | 0.041592 | 0.037654 | 1.104598 | [
"s812785366",
"s330187328"
] |
u645250356 | p02954 | python | s493268975 | s590399670 | 340 | 112 | 73,528 | 12,056 | Accepted | Accepted | 67.06 | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.std... | 30 | 34 | 789 | 800 | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.read... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map... | false | 11.764706 | [
"-from heapq import heappop, heappush, heapify",
"-import sys, bisect, math, itertools, fractions, pprint",
"+from heapq import heappop, heappush",
"+from bisect import bisect_left, bisect_right",
"+import sys, math, itertools, fractions",
"-def inpln(n):",
"- return list(int(sys.stdin.readline()) fo... | false | 0.042738 | 0.134101 | 0.318701 | [
"s493268975",
"s590399670"
] |
u690536347 | p02929 | python | s197955005 | s164995533 | 145 | 129 | 16,344 | 12,340 | Accepted | Accepted | 11.03 | N = int(eval(input()))
S = eval(input())
MOD = 10**9+7
if S[0]=="W" or S[-1]=="W":
print((0))
else:
l = [0]*(2*N)
for i in range(1, 2*N):
if S[i]==S[i-1]:
l[i] = 1 if l[i-1]==0 else 0
else:
l[i] = 0 if l[i-1]==0 else 1
pair = sum(l)
fac = [Non... | N = int(eval(input()))
S = eval(input())
MOD = 10**9+7
if S[0]=="W" or S[-1]=="W":
print((0))
else:
l = [0]*(2*N)
for i in range(1, 2*N):
if S[i]==S[i-1]:
l[i] = 0 if l[i-1] else 1
else:
l[i] = 1 if l[i-1] else 0
pair = sum(l)
facN = 1
fo... | 36 | 32 | 722 | 626 | N = int(eval(input()))
S = eval(input())
MOD = 10**9 + 7
if S[0] == "W" or S[-1] == "W":
print((0))
else:
l = [0] * (2 * N)
for i in range(1, 2 * N):
if S[i] == S[i - 1]:
l[i] = 1 if l[i - 1] == 0 else 0
else:
l[i] = 0 if l[i - 1] == 0 else 1
pair = sum(l)
fac... | N = int(eval(input()))
S = eval(input())
MOD = 10**9 + 7
if S[0] == "W" or S[-1] == "W":
print((0))
else:
l = [0] * (2 * N)
for i in range(1, 2 * N):
if S[i] == S[i - 1]:
l[i] = 0 if l[i - 1] else 1
else:
l[i] = 1 if l[i - 1] else 0
pair = sum(l)
facN = 1
... | false | 11.111111 | [
"- l[i] = 1 if l[i - 1] == 0 else 0",
"+ l[i] = 0 if l[i - 1] else 1",
"- l[i] = 0 if l[i - 1] == 0 else 1",
"+ l[i] = 1 if l[i - 1] else 0",
"- fac = [None] * (N + 1)",
"- fac[1] = 1",
"+ facN = 1",
"- fac[i] = fac[i - 1] * i",
"- f... | false | 0.13962 | 0.119366 | 1.169679 | [
"s197955005",
"s164995533"
] |
u627600101 | p02696 | python | s093296447 | s595954735 | 23 | 20 | 9,180 | 9,168 | Accepted | Accepted | 13.04 | A, B, N = list(map(int,input().split()))
import math
x3 = min(N,B-1)
def f(x):
t = math.floor((A*x)/B) - A * math.floor(x/B)
return int(t)
print((f(x3))) | A, B, N = list(map(int,input().split()))
import math
x1 = N
x2 = min(N,B-1)
def f(x):
return A*x//B - A*(x//B)
print((max(f(x1),f(x2)))) | 8 | 7 | 162 | 139 | A, B, N = list(map(int, input().split()))
import math
x3 = min(N, B - 1)
def f(x):
t = math.floor((A * x) / B) - A * math.floor(x / B)
return int(t)
print((f(x3)))
| A, B, N = list(map(int, input().split()))
import math
x1 = N
x2 = min(N, B - 1)
def f(x):
return A * x // B - A * (x // B)
print((max(f(x1), f(x2))))
| false | 12.5 | [
"-x3 = min(N, B - 1)",
"+x1 = N",
"+x2 = min(N, B - 1)",
"- t = math.floor((A * x) / B) - A * math.floor(x / B)",
"- return int(t)",
"+ return A * x // B - A * (x // B)",
"-print((f(x3)))",
"+print((max(f(x1), f(x2))))"
] | false | 0.098413 | 0.065628 | 1.499553 | [
"s093296447",
"s595954735"
] |
u761320129 | p04019 | python | s532527685 | s961546843 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | from collections import Counter
S = input()
c = Counter(S)
if (c['N'] > 0 and c['S'] == 0) or (c['S'] > 0 and c['N'] == 0) or\
(c['W'] > 0 and c['E'] == 0) or (c['E'] > 0 and c['W'] == 0):
print('No')
else:
print('Yes')
| S = eval(input())
n = 'N' in S
w = 'W' in S
s = 'S' in S
e = 'E' in S
print(('No' if (n and not s) or (s and not n) or (w and not e) or (e and not w) else 'Yes'))
| 8 | 6 | 237 | 160 | from collections import Counter
S = input()
c = Counter(S)
if (
(c["N"] > 0 and c["S"] == 0)
or (c["S"] > 0 and c["N"] == 0)
or (c["W"] > 0 and c["E"] == 0)
or (c["E"] > 0 and c["W"] == 0)
):
print("No")
else:
print("Yes")
| S = eval(input())
n = "N" in S
w = "W" in S
s = "S" in S
e = "E" in S
print(
(
"No"
if (n and not s) or (s and not n) or (w and not e) or (e and not w)
else "Yes"
)
)
| false | 25 | [
"-from collections import Counter",
"-",
"-S = input()",
"-c = Counter(S)",
"-if (",
"- (c[\"N\"] > 0 and c[\"S\"] == 0)",
"- or (c[\"S\"] > 0 and c[\"N\"] == 0)",
"- or (c[\"W\"] > 0 and c[\"E\"] == 0)",
"- or (c[\"E\"] > 0 and c[\"W\"] == 0)",
"-):",
"- print(\"No\")",
"-else:... | false | 0.040164 | 0.037719 | 1.064807 | [
"s532527685",
"s961546843"
] |
u407160848 | p02945 | python | s622684648 | s798037610 | 177 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.4 | import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)
def s(generator, splitter, mapper):
return [ mapper(s) for s in generator().split(splitter) ]
# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
return [ int(s) for s in input().split(" ")]... |
import sys
def log(*args, **kwargs):
print(*args, file=sys.stderr)
log("hogehoge")
a,b = map(int, input().split())
print(max(a*b, a+b, a-b))
| 19 | 11 | 470 | 159 | import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)
def s(generator, splitter, mapper):
return [mapper(s) for s in generator().split(splitter)]
# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
return [int(s) for s in input().split(" ")]
# 改行区切りの... | import sys
def log(*args, **kwargs):
print(*args, file=sys.stderr)
log("hogehoge")
a, b = map(int, input().split())
print(max(a * b, a + b, a - b))
| false | 42.105263 | [
"-import math",
"-from functools import reduce",
"-from collections import deque",
"-sys.setrecursionlimit(10**7)",
"+",
"+def log(*args, **kwargs):",
"+ print(*args, file=sys.stderr)",
"-def s(generator, splitter, mapper):",
"- return [mapper(s) for s in generator().split(splitter)]",
"-",
... | false | 0.041453 | 0.040838 | 1.015059 | [
"s622684648",
"s798037610"
] |
u210545407 | p04043 | python | s373453388 | s578374161 | 27 | 23 | 8,972 | 9,040 | Accepted | Accepted | 14.81 | A, B, C=list(map(int, input().split(" ")))
if ([A, B, C].count(5)==2) and ([A, B, C].count(7)==1):
print('YES')
else:
print('NO')
| data=list(map(int, input().split(" ")))
if (data.count(5)==2) and (data.count(7)==1):
print('YES')
else:
print('NO') | 5 | 5 | 138 | 124 | A, B, C = list(map(int, input().split(" ")))
if ([A, B, C].count(5) == 2) and ([A, B, C].count(7) == 1):
print("YES")
else:
print("NO")
| data = list(map(int, input().split(" ")))
if (data.count(5) == 2) and (data.count(7) == 1):
print("YES")
else:
print("NO")
| false | 0 | [
"-A, B, C = list(map(int, input().split(\" \")))",
"-if ([A, B, C].count(5) == 2) and ([A, B, C].count(7) == 1):",
"+data = list(map(int, input().split(\" \")))",
"+if (data.count(5) == 2) and (data.count(7) == 1):"
] | false | 0.036996 | 0.038909 | 0.950822 | [
"s373453388",
"s578374161"
] |
u254871849 | p03449 | python | s058468415 | s403577723 | 277 | 17 | 20,360 | 3,064 | Accepted | Accepted | 93.86 | import sys
import numpy as np
I = np.array(sys.stdin.read().split(), dtype=np.int64)
n = I[0]
l1, l2 = I[1:].reshape(2, n)
def main():
res = 0
for i in range(n):
res = max(res, np.sum(l1[:i+1]) + np.sum(l2[i:]))
return res
if __name__ == '__main__':
ans = main()
print(ans) | import sys
n = int(sys.stdin.readline().rstrip())
a = [0] + [int(x) for x in sys.stdin.readline().split()]
b = [0] + [int(x) for x in sys.stdin.readline().split()]
def main():
for i in range(n):
a[i+1] += a[i]
b[i+1] += b[i]
res = 0
for i in range(1, n + 1):
res = max(r... | 16 | 17 | 320 | 404 | import sys
import numpy as np
I = np.array(sys.stdin.read().split(), dtype=np.int64)
n = I[0]
l1, l2 = I[1:].reshape(2, n)
def main():
res = 0
for i in range(n):
res = max(res, np.sum(l1[: i + 1]) + np.sum(l2[i:]))
return res
if __name__ == "__main__":
ans = main()
print(ans)
| import sys
n = int(sys.stdin.readline().rstrip())
a = [0] + [int(x) for x in sys.stdin.readline().split()]
b = [0] + [int(x) for x in sys.stdin.readline().split()]
def main():
for i in range(n):
a[i + 1] += a[i]
b[i + 1] += b[i]
res = 0
for i in range(1, n + 1):
res = max(res, a[i... | false | 5.882353 | [
"-import numpy as np",
"-I = np.array(sys.stdin.read().split(), dtype=np.int64)",
"-n = I[0]",
"-l1, l2 = I[1:].reshape(2, n)",
"+n = int(sys.stdin.readline().rstrip())",
"+a = [0] + [int(x) for x in sys.stdin.readline().split()]",
"+b = [0] + [int(x) for x in sys.stdin.readline().split()]",
"+ for... | false | 0.193508 | 0.036909 | 5.24289 | [
"s058468415",
"s403577723"
] |
u103902792 | p02922 | python | s419128409 | s232284268 | 173 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.17 | a,b = list(map(int,input().split()))
ans = 0
tap = 1
while tap < b:
tap += a-1
ans += 1
print(ans) | a,b = list(map(int,input().split()))
ans = 0
tap = 1
while tap < b:
ans += 1
tap += a-1
print(ans) | 9 | 7 | 108 | 102 | a, b = list(map(int, input().split()))
ans = 0
tap = 1
while tap < b:
tap += a - 1
ans += 1
print(ans)
| a, b = list(map(int, input().split()))
ans = 0
tap = 1
while tap < b:
ans += 1
tap += a - 1
print(ans)
| false | 22.222222 | [
"+ ans += 1",
"- ans += 1"
] | false | 0.041583 | 0.081564 | 0.509817 | [
"s419128409",
"s232284268"
] |
u340781749 | p03216 | python | s598159606 | s441655277 | 2,057 | 1,896 | 147,172 | 107,252 | Accepted | Accepted | 7.83 | from itertools import accumulate
n = int(eval(input()))
s = eval(input())
acc_cnt_a = [0] * (n + 1)
acc_cnt_b = [0] * (n + 1)
acc_cnt_ab = [0] * (n + 1)
c_loc = []
cnt_a = 0
for i, c in enumerate(s):
if c == 'D':
acc_cnt_a[i] += 1
cnt_a += 1
elif c == 'M':
acc_cnt_b[i] += ... | n = int(eval(input()))
s = eval(input())
acc_cnt_a = [0] * (n + 1)
acc_cnt_b = [0] * (n + 1)
acc_cnt_ab = [0] * (n + 1)
c_loc = []
cnt_a = 0
cnt_b = 0
cnt_ab = 0
for i, c in enumerate(s):
if c == 'D':
cnt_a += 1
elif c == 'M':
cnt_b += 1
cnt_ab += cnt_a
elif c == 'C':
... | 37 | 36 | 1,000 | 895 | from itertools import accumulate
n = int(eval(input()))
s = eval(input())
acc_cnt_a = [0] * (n + 1)
acc_cnt_b = [0] * (n + 1)
acc_cnt_ab = [0] * (n + 1)
c_loc = []
cnt_a = 0
for i, c in enumerate(s):
if c == "D":
acc_cnt_a[i] += 1
cnt_a += 1
elif c == "M":
acc_cnt_b[i] += 1
acc_... | n = int(eval(input()))
s = eval(input())
acc_cnt_a = [0] * (n + 1)
acc_cnt_b = [0] * (n + 1)
acc_cnt_ab = [0] * (n + 1)
c_loc = []
cnt_a = 0
cnt_b = 0
cnt_ab = 0
for i, c in enumerate(s):
if c == "D":
cnt_a += 1
elif c == "M":
cnt_b += 1
cnt_ab += cnt_a
elif c == "C":
c_loc.a... | false | 2.702703 | [
"-from itertools import accumulate",
"-",
"+cnt_b = 0",
"+cnt_ab = 0",
"- acc_cnt_a[i] += 1",
"- acc_cnt_b[i] += 1",
"- acc_cnt_ab[i] += cnt_a",
"+ cnt_b += 1",
"+ cnt_ab += cnt_a",
"-acc_cnt_a = [0] + list(accumulate(acc_cnt_a))",
"-acc_cnt_b = [0] + list(accu... | false | 0.048457 | 0.049163 | 0.985635 | [
"s598159606",
"s441655277"
] |
u644907318 | p02861 | python | s018159047 | s438669038 | 208 | 98 | 40,812 | 74,508 | Accepted | Accepted | 52.88 | from itertools import permutations
def dist(x,y):
return ((x[0]-y[0])**2+(x[1]-y[1])**2)**0.5
N = int(eval(input()))
X = [list(map(int,input().split())) for _ in range(N)]
tot = 0
cnt = 0
for z in permutations(list(range(N))):
cnt += 1
for i in range(1,N):
tot += dist(X[z[i]],X[z[i-1]])
p... | from itertools import permutations
def dist(x,y):
return ((x[0]-y[0])**2+(x[1]-y[1])**2)**0.5
N = int(eval(input()))
X = [list(map(int,input().split())) for _ in range(N)]
cnt = 0
for z in permutations(list(range(N)),N):
for i in range(1,N):
cnt += dist(X[z[i]],X[z[i-1]])
k = 1
for i in range(... | 12 | 13 | 321 | 342 | from itertools import permutations
def dist(x, y):
return ((x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2) ** 0.5
N = int(eval(input()))
X = [list(map(int, input().split())) for _ in range(N)]
tot = 0
cnt = 0
for z in permutations(list(range(N))):
cnt += 1
for i in range(1, N):
tot += dist(X[z[i]], X[z... | from itertools import permutations
def dist(x, y):
return ((x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2) ** 0.5
N = int(eval(input()))
X = [list(map(int, input().split())) for _ in range(N)]
cnt = 0
for z in permutations(list(range(N)), N):
for i in range(1, N):
cnt += dist(X[z[i]], X[z[i - 1]])
k = 1
fo... | false | 7.692308 | [
"-tot = 0",
"-for z in permutations(list(range(N))):",
"- cnt += 1",
"+for z in permutations(list(range(N)), N):",
"- tot += dist(X[z[i]], X[z[i - 1]])",
"-print((tot / cnt))",
"+ cnt += dist(X[z[i]], X[z[i - 1]])",
"+k = 1",
"+for i in range(2, N + 1):",
"+ k = k * i",
"+pri... | false | 0.05473 | 0.040338 | 1.356762 | [
"s018159047",
"s438669038"
] |
u987164499 | p02984 | python | s549886507 | s369173501 | 145 | 116 | 14,032 | 14,028 | Accepted | Accepted | 20 | from sys import stdin
n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))
point = 0
for i in range(n):
if i%2 == 0:
point += li[i]
else:
point -= li[i]
lin = [point]
for i in range(n-1):
lin.append((li[i]-lin[i]//2)*2)
print((*lin)) | n = int(eval(input()))
a = list(map(int,input().split()))
s = sum(a)
start = s-2*sum(a[1::2])
li = [start]
for i in range(1,n):
li.append(2*a[i-1]-li[-1])
print((*li)) | 13 | 13 | 307 | 180 | from sys import stdin
n = int(stdin.readline().rstrip())
li = list(map(int, stdin.readline().rstrip().split()))
point = 0
for i in range(n):
if i % 2 == 0:
point += li[i]
else:
point -= li[i]
lin = [point]
for i in range(n - 1):
lin.append((li[i] - lin[i] // 2) * 2)
print((*lin))
| n = int(eval(input()))
a = list(map(int, input().split()))
s = sum(a)
start = s - 2 * sum(a[1::2])
li = [start]
for i in range(1, n):
li.append(2 * a[i - 1] - li[-1])
print((*li))
| false | 0 | [
"-from sys import stdin",
"-",
"-n = int(stdin.readline().rstrip())",
"-li = list(map(int, stdin.readline().rstrip().split()))",
"-point = 0",
"-for i in range(n):",
"- if i % 2 == 0:",
"- point += li[i]",
"- else:",
"- point -= li[i]",
"-lin = [point]",
"-for i in range(n ... | false | 0.041685 | 0.038637 | 1.078878 | [
"s549886507",
"s369173501"
] |
u691018832 | p03229 | python | s982917258 | s072111488 | 837 | 80 | 9,320 | 13,028 | Accepted | Accepted | 90.44 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
from collections import deque
from math import ceil
n = int(readline())
a = sorted([int(readline()) for i in range(n)])
c = deque(a[:ceil(n / 2)])
d = deque(a[... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
n, *a = list(map(int, read().split()))
a.sort()
a1 = 2 * (sum(a[(n + 1) // 2:]) - sum(a[:(n + 1) // 2]))
a2 = 2 * (sum(a[n // 2:]) - sum(a[:n // 2]))
if n % 2 == ... | 44 | 18 | 1,276 | 479 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
from collections import deque
from math import ceil
n = int(readline())
a = sorted([int(readline()) for i in range(n)])
c = deque(a[: ceil(n / 2)])
d = deque(a[ceil(n / 2) :... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
n, *a = list(map(int, read().split()))
a.sort()
a1 = 2 * (sum(a[(n + 1) // 2 :]) - sum(a[: (n + 1) // 2]))
a2 = 2 * (sum(a[n // 2 :]) - sum(a[: n // 2]))
if n % 2 == 0:
v... | false | 59.090909 | [
"-from collections import deque",
"-from math import ceil",
"-",
"-n = int(readline())",
"-a = sorted([int(readline()) for i in range(n)])",
"-c = deque(a[: ceil(n / 2)])",
"-d = deque(a[ceil(n / 2) :])",
"-b = deque(a[n // 2 :])",
"-a = deque(a[: n // 2])",
"-check_1 = deque([a.popleft()])",
"-... | false | 0.047501 | 0.043964 | 1.080444 | [
"s982917258",
"s072111488"
] |
u811733736 | p02329 | python | s717837660 | s515450781 | 3,630 | 3,070 | 102,904 | 102,524 | Accepted | Accepted | 15.43 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_4_A
TLE
"""
import sys
from sys import stdin
from bisect import bisect_right, bisect_left
input = stdin.readline
def main(args):
N, V = list(map(int, input().split()))
A = [int(x) for x in input().split()]
... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_4_A
AC
"""
import sys
from sys import stdin
from bisect import bisect_right, bisect_left
input = stdin.readline
def main(args):
N, V = list(map(int, input().split()))
A = [int(x) for x in input().split()]
... | 41 | 45 | 884 | 1,019 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_4_A
TLE
"""
import sys
from sys import stdin
from bisect import bisect_right, bisect_left
input = stdin.readline
def main(args):
N, V = list(map(int, input().split()))
A = [int(x) for x in input().split()]
B = [int(x... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_4_A
AC
"""
import sys
from sys import stdin
from bisect import bisect_right, bisect_left
input = stdin.readline
def main(args):
N, V = list(map(int, input().split()))
A = [int(x) for x in input().split()]
B = [int(x)... | false | 8.888889 | [
"-TLE",
"+AC",
"- AB = []",
"- for i in A:",
"- for j in B:",
"- AB.append(i + j)",
"- AB.sort()",
"- CD = [float(\"-inf\"), float(\"inf\")]",
"- for i in C:",
"- for j in D:",
"- CD.append(i + j)",
"+ # AB = []",
"+ # for i in A:",
... | false | 0.045104 | 0.069154 | 0.65223 | [
"s717837660",
"s515450781"
] |
u585482323 | p02900 | python | s383024667 | s477988956 | 216 | 196 | 39,280 | 38,512 | Accepted | Accepted | 9.26 | #!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()... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS... | 93 | 50 | 1,687 | 1,138 | #!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... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI():
return [int(x) for x in sys.stdin.buffer.readline().split()]
def I():
return int(sys.stdin.buffer.readline())
d... | false | 46.236559 | [
"+from itertools import permutations, accumulate",
"-import random",
"- return [int(x) for x in sys.stdin.readline().split()]",
"+ return [int(x) for x in sys.stdin.buffer.readline().split()]",
"- return int(sys.stdin.readline())",
"+ return int(sys.stdin.buffer.readline())",
"-# A",
"-def... | false | 0.040523 | 0.047119 | 0.86003 | [
"s383024667",
"s477988956"
] |
u312025627 | p03971 | python | s092894409 | s868768600 | 308 | 96 | 51,928 | 4,016 | Accepted | Accepted | 68.83 | def main():
N, A, B = (int(i) for i in input().split())
S = eval(input())
b_cnt = 0
cnt = 0
for s in S:
if s == 'a' and cnt < A + B:
print("Yes")
cnt += 1
elif s == 'b' and cnt < A + B and b_cnt < B:
print("Yes")
cnt += 1
... | def main():
N, A, B = (int(i) for i in input().split())
S = eval(input())
cnt = 0
cnt_ob = 0
for s in S:
if s == "a":
if cnt < A+B:
print("Yes")
cnt += 1
else:
print("No")
elif s == "b":
... | 19 | 25 | 419 | 560 | def main():
N, A, B = (int(i) for i in input().split())
S = eval(input())
b_cnt = 0
cnt = 0
for s in S:
if s == "a" and cnt < A + B:
print("Yes")
cnt += 1
elif s == "b" and cnt < A + B and b_cnt < B:
print("Yes")
cnt += 1
b_... | def main():
N, A, B = (int(i) for i in input().split())
S = eval(input())
cnt = 0
cnt_ob = 0
for s in S:
if s == "a":
if cnt < A + B:
print("Yes")
cnt += 1
else:
print("No")
elif s == "b":
if cnt < A ... | false | 24 | [
"- b_cnt = 0",
"+ cnt_ob = 0",
"- if s == \"a\" and cnt < A + B:",
"- print(\"Yes\")",
"- cnt += 1",
"- elif s == \"b\" and cnt < A + B and b_cnt < B:",
"- print(\"Yes\")",
"- cnt += 1",
"- b_cnt += 1",
"+ if s == \"... | false | 0.083111 | 0.089464 | 0.928988 | [
"s092894409",
"s868768600"
] |
u285891772 | p02804 | python | s444603627 | s444157327 | 418 | 203 | 49,344 | 29,644 | Accepted | Accepted | 51.44 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | 90 | 57 | 2,104 | 1,573 | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
gcd,
)
from itertools import (
accumulate,
permutations,
combinations,
... | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
gcd,
)
from itertools import (
accumulate,
permutations,
combinations,
... | false | 36.666667 | [
"-A_cnt = Counter(A)",
"-P = list(A_cnt.keys())",
"-p = list(A_cnt.values())",
"-# print(\"P={}\".format(P))",
"-# print(\"p={}\".format(p))",
"-p_acc = list(accumulate(p))",
"-p_acc_rev = list(accumulate(p[::-1]))",
"-# print(\"p_acc={}\".format(p_acc))",
"-# print(\"p_acc_rev={}\".format(p_acc_rev... | false | 0.341344 | 0.417444 | 0.8177 | [
"s444603627",
"s444157327"
] |
u224353074 | p02720 | python | s526739698 | s766407118 | 275 | 222 | 45,300 | 56,376 | Accepted | Accepted | 19.27 | from collections import deque
K = int(eval(input()))
q = deque([[1],[2],[3],[4],[5],[6],[7],[8],[9]])
cnt = 0
while cnt != K:
nums = q.popleft()
last = nums[-1]
if last == 9:
tmp = nums.copy()
tmp.append(8)
q.append(tmp)
tmp = nums.copy()
tmp.append(9)
... | K = int(eval(input()))
lunlun = [1,2,3,4,5,6,7,8,9]
p = 0
def lunlun_generator(now_lunlun):
last = now_lunlun%10
if last-1>=0:
yield 10*now_lunlun+last-1
yield 10*now_lunlun+last
if last+1<=9:
yield 10*now_lunlun+last+1
while 1:
for new_lunlun in lunlun_generator(lu... | 42 | 24 | 855 | 429 | from collections import deque
K = int(eval(input()))
q = deque([[1], [2], [3], [4], [5], [6], [7], [8], [9]])
cnt = 0
while cnt != K:
nums = q.popleft()
last = nums[-1]
if last == 9:
tmp = nums.copy()
tmp.append(8)
q.append(tmp)
tmp = nums.copy()
tmp.append(9)
... | K = int(eval(input()))
lunlun = [1, 2, 3, 4, 5, 6, 7, 8, 9]
p = 0
def lunlun_generator(now_lunlun):
last = now_lunlun % 10
if last - 1 >= 0:
yield 10 * now_lunlun + last - 1
yield 10 * now_lunlun + last
if last + 1 <= 9:
yield 10 * now_lunlun + last + 1
while 1:
for new_lunlun in... | false | 42.857143 | [
"-from collections import deque",
"+K = int(eval(input()))",
"+lunlun = [1, 2, 3, 4, 5, 6, 7, 8, 9]",
"+p = 0",
"-K = int(eval(input()))",
"-q = deque([[1], [2], [3], [4], [5], [6], [7], [8], [9]])",
"-cnt = 0",
"-while cnt != K:",
"- nums = q.popleft()",
"- last = nums[-1]",
"- if last... | false | 0.070772 | 0.055002 | 1.286719 | [
"s526739698",
"s766407118"
] |
u463655976 | p02960 | python | s439703180 | s105400571 | 1,932 | 1,668 | 4,092 | 4,092 | Accepted | Accepted | 13.66 | S = [int(x) if x != "?" else -1 for x in eval(input())]
g = 10 ** 9 + 7
x = 1
DP = [[0] * 13 for _ in range(2)]
DP[0][0] = 1
for i in range(len(S)):
for j in range(13):
DP[1][j] = DP[0][j] % g
DP[0][j] = 0
for j in range(13):
if S[i] == -1:
s = (j*10)%13
... | S = [int(x) if x != "?" else -1 for x in eval(input())]
g = 10 ** 9 + 7
x = 1
DP = [[0] * 13 for _ in range(2)]
DP[0][0] = 1
for i in range(len(S)):
DP[1], DP[0] = DP[0], DP[1]
for j in range(13):
DP[0][j] = 0
for j in range(13):
if S[i] == -1:
s = (j*10)%13
... | 26 | 26 | 621 | 630 | S = [int(x) if x != "?" else -1 for x in eval(input())]
g = 10**9 + 7
x = 1
DP = [[0] * 13 for _ in range(2)]
DP[0][0] = 1
for i in range(len(S)):
for j in range(13):
DP[1][j] = DP[0][j] % g
DP[0][j] = 0
for j in range(13):
if S[i] == -1:
s = (j * 10) % 13
e = (s ... | S = [int(x) if x != "?" else -1 for x in eval(input())]
g = 10**9 + 7
x = 1
DP = [[0] * 13 for _ in range(2)]
DP[0][0] = 1
for i in range(len(S)):
DP[1], DP[0] = DP[0], DP[1]
for j in range(13):
DP[0][j] = 0
for j in range(13):
if S[i] == -1:
s = (j * 10) % 13
e = (s ... | false | 0 | [
"+ DP[1], DP[0] = DP[0], DP[1]",
"- DP[1][j] = DP[0][j] % g",
"- w += DP[0][j]",
"+ w = (w + DP[0][j]) % g"
] | false | 0.042994 | 0.038619 | 1.113263 | [
"s439703180",
"s105400571"
] |
u298633786 | p03221 | python | s648135682 | s254270955 | 1,084 | 836 | 80,344 | 42,172 | Accepted | Accepted | 22.88 | import sys
import math # noqa
import bisect # noqa
import queue # noqa
def input():
return sys.stdin.readline().rstrip()
if __name__ == '__main__':
N, M = list(map(int, input().split()))
PY = []
for i in range(M):
P, Y = list(map(int, input().split()))
PY.append([Y,... | import sys
import math # noqa
import bisect # noqa
import queue # noqa
if __name__ == '__main__':
N, M = list(map(int, sys.stdin.readline().rstrip().split()))
PY = []
for i in range(M):
P, Y = list(map(int, sys.stdin.readline().rstrip().split()))
PY.append([Y, P, i + 1])
... | 32 | 28 | 673 | 657 | import sys
import math # noqa
import bisect # noqa
import queue # noqa
def input():
return sys.stdin.readline().rstrip()
if __name__ == "__main__":
N, M = list(map(int, input().split()))
PY = []
for i in range(M):
P, Y = list(map(int, input().split()))
PY.append([Y, P, i + 1])
... | import sys
import math # noqa
import bisect # noqa
import queue # noqa
if __name__ == "__main__":
N, M = list(map(int, sys.stdin.readline().rstrip().split()))
PY = []
for i in range(M):
P, Y = list(map(int, sys.stdin.readline().rstrip().split()))
PY.append([Y, P, i + 1])
PY.sort()
... | false | 12.5 | [
"-",
"-def input():",
"- return sys.stdin.readline().rstrip()",
"-",
"-",
"- N, M = list(map(int, input().split()))",
"+ N, M = list(map(int, sys.stdin.readline().rstrip().split()))",
"- P, Y = list(map(int, input().split()))",
"+ P, Y = list(map(int, sys.stdin.readline().rstr... | false | 0.041027 | 0.07741 | 0.530001 | [
"s648135682",
"s254270955"
] |
u325282913 | p03472 | python | s701040588 | s488844000 | 340 | 195 | 11,312 | 72,668 | Accepted | Accepted | 42.65 | N, H = list(map(int, input().split()))
A, B = [0]*N, [0]*N
for i in range(N):
A[i], B[i] = list(map(int, input().split()))
target = max(A)
ans = 0
B.sort(reverse=True)
for i in B:
if i >= target:
H -= i
ans += 1
if H <= 0:
print(ans)
exit()
print((ans-(-H//targe... | N, H = list(map(int, input().split()))
A = [0]*N
B = [0]*N
for i in range(N):
A[i], B[i] = list(map(int, input().split()))
a = max(A)
B.sort()
ans = 0
while len(B) > 0 and B[-1] >= a and H > 0:
H -= B.pop()
ans += 1
if H <= 0:
print(ans)
exit()
print((ans+(-(-H//a)))) | 15 | 15 | 310 | 300 | N, H = list(map(int, input().split()))
A, B = [0] * N, [0] * N
for i in range(N):
A[i], B[i] = list(map(int, input().split()))
target = max(A)
ans = 0
B.sort(reverse=True)
for i in B:
if i >= target:
H -= i
ans += 1
if H <= 0:
print(ans)
exit()
print((ans - (-H // target)))
| N, H = list(map(int, input().split()))
A = [0] * N
B = [0] * N
for i in range(N):
A[i], B[i] = list(map(int, input().split()))
a = max(A)
B.sort()
ans = 0
while len(B) > 0 and B[-1] >= a and H > 0:
H -= B.pop()
ans += 1
if H <= 0:
print(ans)
exit()
print((ans + (-(-H // a))))
| false | 0 | [
"-A, B = [0] * N, [0] * N",
"+A = [0] * N",
"+B = [0] * N",
"-target = max(A)",
"+a = max(A)",
"+B.sort()",
"-B.sort(reverse=True)",
"-for i in B:",
"- if i >= target:",
"- H -= i",
"- ans += 1",
"+while len(B) > 0 and B[-1] >= a and H > 0:",
"+ H -= B.pop()",
"+ ans... | false | 0.041542 | 0.058544 | 0.709595 | [
"s701040588",
"s488844000"
] |
u102960641 | p02868 | python | s564814491 | s507188561 | 990 | 653 | 93,660 | 60,508 | Accepted | Accepted | 34.04 | import sys
input = sys.stdin.readline
n,m = list(map(int, input().split()))
t = sorted([tuple(map(int, input().split())) for i in range(m)], key=lambda x:(x[0], -x[1]))
d=[0,0]+[1e18]*n
for l,r,c in t:
for i in range(r,l,-1):
if d[l]+c<d[i]:
d[i]=d[l]+c
else:
break
print((d[-2]%10**18... | import sys
input = sys.stdin.readline
n,m = list(map(int, input().split()))
t = sorted([tuple(map(int, input().split())) for i in range(m)])
INF = 10 ** 18
dp = [0,0] + [INF] * (n-1)
for l,r,c in t:
for i in range(r,l,-1):
if dp[l] + c < dp[i]:
dp[i] = dp[l] + c
else:
break
ans = dp[... | 13 | 18 | 319 | 366 | import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
t = sorted(
[tuple(map(int, input().split())) for i in range(m)], key=lambda x: (x[0], -x[1])
)
d = [0, 0] + [1e18] * n
for l, r, c in t:
for i in range(r, l, -1):
if d[l] + c < d[i]:
d[i] = d[l] + c
else:
... | import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
t = sorted([tuple(map(int, input().split())) for i in range(m)])
INF = 10**18
dp = [0, 0] + [INF] * (n - 1)
for l, r, c in t:
for i in range(r, l, -1):
if dp[l] + c < dp[i]:
dp[i] = dp[l] + c
else:
... | false | 27.777778 | [
"-t = sorted(",
"- [tuple(map(int, input().split())) for i in range(m)], key=lambda x: (x[0], -x[1])",
"-)",
"-d = [0, 0] + [1e18] * n",
"+t = sorted([tuple(map(int, input().split())) for i in range(m)])",
"+INF = 10**18",
"+dp = [0, 0] + [INF] * (n - 1)",
"- if d[l] + c < d[i]:",
"- ... | false | 0.078449 | 0.03633 | 2.159375 | [
"s564814491",
"s507188561"
] |
u606045429 | p03607 | python | s380805912 | s578463516 | 261 | 194 | 7,488 | 13,204 | Accepted | Accepted | 25.67 | N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
A.sort()
result = 0
cur = 0
while cur < N:
a = A[cur]
count = 0
while cur < N and A[cur] == a:
cur += 1
count += 1
result += count % 2
print(result) | N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
paper = set()
for a in A:
paper ^= {a}
print((len(paper))) | 16 | 8 | 252 | 123 | N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
A.sort()
result = 0
cur = 0
while cur < N:
a = A[cur]
count = 0
while cur < N and A[cur] == a:
cur += 1
count += 1
result += count % 2
print(result)
| N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
paper = set()
for a in A:
paper ^= {a}
print((len(paper)))
| false | 50 | [
"-A.sort()",
"-result = 0",
"-cur = 0",
"-while cur < N:",
"- a = A[cur]",
"- count = 0",
"- while cur < N and A[cur] == a:",
"- cur += 1",
"- count += 1",
"- result += count % 2",
"-print(result)",
"+paper = set()",
"+for a in A:",
"+ paper ^= {a}",
"+print(... | false | 0.040077 | 0.040385 | 0.992364 | [
"s380805912",
"s578463516"
] |
u995109095 | p02819 | python | s238265400 | s129625741 | 187 | 36 | 40,176 | 3,828 | Accepted | Accepted | 80.75 | nn=int(eval(input()))
n=10**5+100
ar=[0]*(n)
ar[1]=0
ans=0
pre=1
for i in range(2,n):
if ar[i]==0:
for j in range(2*i,n,i):
ar[j]=1
ans=1
if ar[nn]==0:
print(nn)
else:
for i in range(nn,n):
if ar[i]==0:
print(i)
break
... | nn=int(eval(input()))
n=10**5+100
ar=[0]*(n)
ar[1]=0
ans=0
pre=1
for i in range(2,int((n**0.5))+1):
if ar[i]==0:
for j in range(2*i,n,i):
ar[j]=1
ans=1
if ar[nn]==0:
print(nn)
else:
for i in range(nn,n):
if ar[i]==0:
print(i)
b... | 23 | 23 | 326 | 340 | nn = int(eval(input()))
n = 10**5 + 100
ar = [0] * (n)
ar[1] = 0
ans = 0
pre = 1
for i in range(2, n):
if ar[i] == 0:
for j in range(2 * i, n, i):
ar[j] = 1
ans = 1
if ar[nn] == 0:
print(nn)
else:
for i in range(nn, n):
if ar[i] == 0:
print(i)
break
| nn = int(eval(input()))
n = 10**5 + 100
ar = [0] * (n)
ar[1] = 0
ans = 0
pre = 1
for i in range(2, int((n**0.5)) + 1):
if ar[i] == 0:
for j in range(2 * i, n, i):
ar[j] = 1
ans = 1
if ar[nn] == 0:
print(nn)
else:
for i in range(nn, n):
if ar[i] == 0:
print(i)
... | false | 0 | [
"-for i in range(2, n):",
"+for i in range(2, int((n**0.5)) + 1):"
] | false | 0.283794 | 0.052964 | 5.358215 | [
"s238265400",
"s129625741"
] |
u647999897 | p02787 | python | s579640071 | s294709463 | 1,666 | 657 | 409,884 | 249,584 | Accepted | Accepted | 60.56 | def solve():
H,N = list(map(int,input().split()))
attack = []
mp = []
for i in range(N):
a,b = list(map(int,input().split()))
attack.append(a)
mp.append(b)
max_attack = max(attack)
dp = [[float('inf')] * (H+max_attack) for _ in range(N+1)]
for i in r... | def solve():
H,N = list(map(int,input().split()))
ap = []
mp = []
for _ in range(N):
a,b = list(map(int,input().split()))
ap.append(a)
mp.append(b)
ap_max = max(ap)
dp = [[float('inf')] * (H+ap_max+1) for _ in range(N+1)]
for i in range(N+1):
... | 30 | 29 | 797 | 721 | def solve():
H, N = list(map(int, input().split()))
attack = []
mp = []
for i in range(N):
a, b = list(map(int, input().split()))
attack.append(a)
mp.append(b)
max_attack = max(attack)
dp = [[float("inf")] * (H + max_attack) for _ in range(N + 1)]
for i in range(N + 1... | def solve():
H, N = list(map(int, input().split()))
ap = []
mp = []
for _ in range(N):
a, b = list(map(int, input().split()))
ap.append(a)
mp.append(b)
ap_max = max(ap)
dp = [[float("inf")] * (H + ap_max + 1) for _ in range(N + 1)]
for i in range(N + 1):
dp[i]... | false | 3.333333 | [
"- attack = []",
"+ ap = []",
"- for i in range(N):",
"+ for _ in range(N):",
"- attack.append(a)",
"+ ap.append(a)",
"- max_attack = max(attack)",
"- dp = [[float(\"inf\")] * (H + max_attack) for _ in range(N + 1)]",
"+ ap_max = max(ap)",
"+ dp = [[float(\"in... | false | 0.103306 | 0.086858 | 1.189365 | [
"s579640071",
"s294709463"
] |
u063346608 | p02621 | python | s973807456 | s116569983 | 31 | 26 | 9,104 | 9,116 | Accepted | Accepted | 16.13 | a = int(eval(input()))
print((a + a * a + a * a * a)) | a = int(eval(input()))
print((a + a ** 2 + a ** 3)) | 3 | 3 | 49 | 46 | a = int(eval(input()))
print((a + a * a + a * a * a))
| a = int(eval(input()))
print((a + a**2 + a**3))
| false | 0 | [
"-print((a + a * a + a * a * a))",
"+print((a + a**2 + a**3))"
] | false | 0.039135 | 0.048295 | 0.810346 | [
"s973807456",
"s116569983"
] |
u015315385 | p03309 | python | s753441037 | s489235201 | 236 | 206 | 27,244 | 27,200 | Accepted | Accepted | 12.71 | from statistics import median
n = eval(input())
a = input().split()
a = list(map(int, a))
b = []
for i, v in enumerate(a):
b.append(v - (i + 1))
median = int(median(b))
c = 0
for v in b:
c = c + abs(v - median)
print(c)
| from statistics import median
n = eval(input())
a = list(map(int, input().split()))
b = [v - (i + 1) for i, v in enumerate(a)]
median = int(median(b))
c = sum(abs(v - median) for v in b)
print(c)
| 19 | 12 | 247 | 206 | from statistics import median
n = eval(input())
a = input().split()
a = list(map(int, a))
b = []
for i, v in enumerate(a):
b.append(v - (i + 1))
median = int(median(b))
c = 0
for v in b:
c = c + abs(v - median)
print(c)
| from statistics import median
n = eval(input())
a = list(map(int, input().split()))
b = [v - (i + 1) for i, v in enumerate(a)]
median = int(median(b))
c = sum(abs(v - median) for v in b)
print(c)
| false | 36.842105 | [
"-a = input().split()",
"-a = list(map(int, a))",
"-b = []",
"-for i, v in enumerate(a):",
"- b.append(v - (i + 1))",
"+a = list(map(int, input().split()))",
"+b = [v - (i + 1) for i, v in enumerate(a)]",
"-c = 0",
"-for v in b:",
"- c = c + abs(v - median)",
"+c = sum(abs(v - median) for ... | false | 0.044407 | 0.048779 | 0.910355 | [
"s753441037",
"s489235201"
] |
u305366205 | p03103 | python | s863447717 | s654989514 | 491 | 451 | 26,748 | 16,988 | Accepted | Accepted | 8.15 | n, m = list(map(int, input().split()))
a = [0] * (n + 1)
b = [0] * (n + 1)
total = [0] * (n + 1)
ans = 0
# 安い店から選ぶ方法が最適
shop = [tuple(map(int, input().split())) for _ in range(n)]
shop.sort()
for i in range(1, n + 1):
a_i, b_i = shop[i - 1]
# 累積和を作っておく
# b[i]: i番目の店まで利用した際に購入できる栄養ドリンクの最大本数
... | n, m = list(map(int, input().split()))
ans = 0
shop = [tuple(map(int, input().split())) for _ in range(n)]
shop.sort()
for price, num in shop:
num = min(m, num)
ans += price * num
m -= num
print(ans) | 30 | 9 | 655 | 213 | n, m = list(map(int, input().split()))
a = [0] * (n + 1)
b = [0] * (n + 1)
total = [0] * (n + 1)
ans = 0
# 安い店から選ぶ方法が最適
shop = [tuple(map(int, input().split())) for _ in range(n)]
shop.sort()
for i in range(1, n + 1):
a_i, b_i = shop[i - 1]
# 累積和を作っておく
# b[i]: i番目の店まで利用した際に購入できる栄養ドリンクの最大本数
# total[i]: i... | n, m = list(map(int, input().split()))
ans = 0
shop = [tuple(map(int, input().split())) for _ in range(n)]
shop.sort()
for price, num in shop:
num = min(m, num)
ans += price * num
m -= num
print(ans)
| false | 70 | [
"-a = [0] * (n + 1)",
"-b = [0] * (n + 1)",
"-total = [0] * (n + 1)",
"-# 安い店から選ぶ方法が最適",
"-for i in range(1, n + 1):",
"- a_i, b_i = shop[i - 1]",
"- # 累積和を作っておく",
"- # b[i]: i番目の店まで利用した際に購入できる栄養ドリンクの最大本数",
"- # total[i]: i番目の店まで利用した際に支払うお金の最大値",
"- b[i] = b[i - 1]",
"- total[i... | false | 0.007368 | 0.060376 | 0.122037 | [
"s863447717",
"s654989514"
] |
u827448139 | p01713 | python | s264147134 | s557589301 | 4,630 | 330 | 88,360 | 21,584 | Accepted | Accepted | 92.87 | from queue import PriorityQueue
class State:
def __init__(self,index,time):
self.index=index
self.time=time
def __lt__(self,state):
return self.time>state.time
while 1:
try: n=int(eval(input()))
except: break
a=list(map(int,input().split()))
ts=[float("inf")]*n
vis=[False]*... | n=int(eval(input()))
a=list(map(int,input().split()))
ts=[0]*n
for indices in list(range(n)),reversed(list(range(n))):
t=0
for i in indices:
if a[i]==0: t=float("inf")
if a[i]<0: t=min(t,-a[i])
if a[i]>0: ts[i]=max(ts[i],min(a[i],t))
t-=1
print((sum(ts))) | 36 | 12 | 845 | 267 | from queue import PriorityQueue
class State:
def __init__(self, index, time):
self.index = index
self.time = time
def __lt__(self, state):
return self.time > state.time
while 1:
try:
n = int(eval(input()))
except:
break
a = list(map(int, input().split()))... | n = int(eval(input()))
a = list(map(int, input().split()))
ts = [0] * n
for indices in list(range(n)), reversed(list(range(n))):
t = 0
for i in indices:
if a[i] == 0:
t = float("inf")
if a[i] < 0:
t = min(t, -a[i])
if a[i] > 0:
ts[i] = max(ts[i], min(a... | false | 66.666667 | [
"-from queue import PriorityQueue",
"-",
"-",
"-class State:",
"- def __init__(self, index, time):",
"- self.index = index",
"- self.time = time",
"-",
"- def __lt__(self, state):",
"- return self.time > state.time",
"-",
"-",
"-while 1:",
"- try:",
"- ... | false | 0.058516 | 0.04095 | 1.428959 | [
"s264147134",
"s557589301"
] |
u940102677 | p03745 | python | s886904408 | s236149256 | 576 | 485 | 23,128 | 23,096 | Accepted | Accepted | 15.8 | from numpy import sign
n = int(eval(input()))
a = list(map(int,input().split()))
b = [sign(a[i+1]-a[i]) for i in range(n-1)]
c = 1
f = 0
for t in b:
if f == 0:
f = t
elif f == 1 and t == -1:
c += 1
f = 0
elif f == -1 and t == 1:
c += 1
f = 0
print(c)
| from numpy import sign
n = int(eval(input()))
a = list(map(int,input().split()))
b = [sign(a[i+1]-a[i]) for i in range(n-1)]
c = 1
f = 0
for t in b:
if f == 0:
f = t
elif f*t == -1:
c += 1
f = 0
print(c) | 20 | 15 | 299 | 230 | from numpy import sign
n = int(eval(input()))
a = list(map(int, input().split()))
b = [sign(a[i + 1] - a[i]) for i in range(n - 1)]
c = 1
f = 0
for t in b:
if f == 0:
f = t
elif f == 1 and t == -1:
c += 1
f = 0
elif f == -1 and t == 1:
c += 1
f = 0
print(c)
| from numpy import sign
n = int(eval(input()))
a = list(map(int, input().split()))
b = [sign(a[i + 1] - a[i]) for i in range(n - 1)]
c = 1
f = 0
for t in b:
if f == 0:
f = t
elif f * t == -1:
c += 1
f = 0
print(c)
| false | 25 | [
"- elif f == 1 and t == -1:",
"- c += 1",
"- f = 0",
"- elif f == -1 and t == 1:",
"+ elif f * t == -1:"
] | false | 0.225408 | 0.192665 | 1.169946 | [
"s886904408",
"s236149256"
] |
u941047297 | p03127 | python | s465322660 | s782706229 | 79 | 59 | 16,276 | 20,564 | Accepted | Accepted | 25.32 | import fractions
from functools import reduce
def gcd_list(l):
return reduce(fractions.gcd, l)
n = int(eval(input()))
A = list(map(int, input().split()))
print((gcd_list(A))) | from functools import reduce
import math
def main():
n = int(eval(input()))
A = list(map(int, input().split()))
print((reduce(math.gcd, A)))
if __name__ == '__main__':
main()
| 7 | 9 | 176 | 192 | import fractions
from functools import reduce
def gcd_list(l):
return reduce(fractions.gcd, l)
n = int(eval(input()))
A = list(map(int, input().split()))
print((gcd_list(A)))
| from functools import reduce
import math
def main():
n = int(eval(input()))
A = list(map(int, input().split()))
print((reduce(math.gcd, A)))
if __name__ == "__main__":
main()
| false | 22.222222 | [
"-import fractions",
"+import math",
"-def gcd_list(l):",
"- return reduce(fractions.gcd, l)",
"+def main():",
"+ n = int(eval(input()))",
"+ A = list(map(int, input().split()))",
"+ print((reduce(math.gcd, A)))",
"-n = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-p... | false | 0.049775 | 0.156333 | 0.31839 | [
"s465322660",
"s782706229"
] |
u243572357 | p03860 | python | s429474013 | s333602992 | 24 | 17 | 2,940 | 2,940 | Accepted | Accepted | 29.17 | n = input().split()[1]
print(('A%sC'%n[0])) | a = input().split()
print((a[0][0] + a[1][0] + a[2][0])) | 2 | 2 | 42 | 55 | n = input().split()[1]
print(("A%sC" % n[0]))
| a = input().split()
print((a[0][0] + a[1][0] + a[2][0]))
| false | 0 | [
"-n = input().split()[1]",
"-print((\"A%sC\" % n[0]))",
"+a = input().split()",
"+print((a[0][0] + a[1][0] + a[2][0]))"
] | false | 0.037369 | 0.037438 | 0.998161 | [
"s429474013",
"s333602992"
] |
u416011173 | p02687 | python | s031772973 | s958908516 | 24 | 21 | 9,088 | 9,052 | Accepted | Accepted | 12.5 | # -*- coding: utf-8 -*-
# 標準入力の取得
S = eval(input())
# 求解処理
result = ""
if S == "ABC":
result = "ARC"
elif S == "ARC":
result = "ABC"
# 結果出力
print(result)
| # -*- coding: utf-8 -*-
# 標準入力の取得
S = eval(input())
def main() -> None:
"""Entry point
"""
# 求解処理
"""
先週"ABC"が開催された場合は"ARC"、
先週"ARC"が開催された場合は"ABC"を返す
"""
result = ""
if S == "ABC":
result = "ARC"
elif S == "ARC":
result = "ABC"
# 結果出力
... | 13 | 25 | 170 | 374 | # -*- coding: utf-8 -*-
# 標準入力の取得
S = eval(input())
# 求解処理
result = ""
if S == "ABC":
result = "ARC"
elif S == "ARC":
result = "ABC"
# 結果出力
print(result)
| # -*- coding: utf-8 -*-
# 標準入力の取得
S = eval(input())
def main() -> None:
"""Entry point"""
# 求解処理
"""
先週"ABC"が開催された場合は"ARC"、
先週"ARC"が開催された場合は"ABC"を返す
"""
result = ""
if S == "ABC":
result = "ARC"
elif S == "ARC":
result = "ABC"
# 結果出力
print(result)
if __nam... | false | 48 | [
"-# 求解処理",
"-result = \"\"",
"-if S == \"ABC\":",
"- result = \"ARC\"",
"-elif S == \"ARC\":",
"- result = \"ABC\"",
"-# 結果出力",
"-print(result)",
"+",
"+",
"+def main() -> None:",
"+ \"\"\"Entry point\"\"\"",
"+ # 求解処理",
"+ \"\"\"",
"+ 先週\"ABC\"が開催された場合は\"ARC\"、",
"+ ... | false | 0.047154 | 0.047655 | 0.989503 | [
"s031772973",
"s958908516"
] |
u459697504 | p04012 | python | s973798315 | s355023137 | 30 | 21 | 3,572 | 3,316 | Accepted | Accepted | 30 | #! /usr/bin/python3
# ABC044_B
# B - 美しい文字列 / Beautiful Strings
"""
collectionsを使わないタイプ
制約
1≤|w|≤100
w は英小文字 (a-z) のみからなる文字列である。
"""
import collections
test_mode = False
use_Counter = False # collections.Counter を使うかどうか
def judge_0(l):
"""
collections.Counter を使うタイプ
奇数会出現する... | #! /usr/bin/python3
# ABC044_B
# B - 美しい文字列 / Beautiful Strings
"""
collectionsを使わないタイプ
制約
1≤|w|≤100
w は英小文字 (a-z) のみからなる文字列である。
"""
import collections
test_mode = False
use_Counter = True # collections.Counter を使うかどうか
def judge_0(l):
"""
collections.Counter を使うタイプ
奇数会出現する要... | 78 | 74 | 1,439 | 1,321 | #! /usr/bin/python3
# ABC044_B
# B - 美しい文字列 / Beautiful Strings
"""
collectionsを使わないタイプ
制約
1≤|w|≤100
w は英小文字 (a-z) のみからなる文字列である。
"""
import collections
test_mode = False
use_Counter = False # collections.Counter を使うかどうか
def judge_0(l):
"""
collections.Counter を使うタイプ
奇数会出現する要素があると False を返し、
... | #! /usr/bin/python3
# ABC044_B
# B - 美しい文字列 / Beautiful Strings
"""
collectionsを使わないタイプ
制約
1≤|w|≤100
w は英小文字 (a-z) のみからなる文字列である。
"""
import collections
test_mode = False
use_Counter = True # collections.Counter を使うかどうか
def judge_0(l):
"""
collections.Counter を使うタイプ
奇数会出現する要素があると False を返し、
全... | false | 5.128205 | [
"-use_Counter = False # collections.Counter を使うかどうか",
"+use_Counter = True # collections.Counter を使うかどうか",
"- broken = False",
"- broken = True",
"- break",
"- return not broken",
"+ return False",
"+ return True",
"- broken = False # break したら True にな... | false | 0.037516 | 0.05152 | 0.728181 | [
"s973798315",
"s355023137"
] |
u891635666 | p03078 | python | s080013466 | s156472812 | 774 | 39 | 4,716 | 5,264 | Accepted | Accepted | 94.96 | import heapq
x, y, z, k = map(int, input().split())
ls = [list(map(int, input().split())) for _ in range(3)]
for i in range(3):
ls[i].sort(reverse=True)
q = [(-sum([ls[i][0] for i in range(3)]), 0, 0, 0)]
res = []
used = [(0, 0, 0)]
while len(res) < k:
s, i, j, l = heapq.heappop(q)
res.append(-s... | import collections
import heapq
x, y, z, k = map(int, input().split())
ls = [list(map(int, input().split())) for _ in range(3)]
for i in range(3):
ls[i].sort(reverse=True)
q = [(-sum([ls[i][0] for i in range(3)]), 0, 0, 0)]
res = []
used = collections.defaultdict(lambda: False)
while len(res) < k:
s... | 22 | 23 | 842 | 883 | import heapq
x, y, z, k = map(int, input().split())
ls = [list(map(int, input().split())) for _ in range(3)]
for i in range(3):
ls[i].sort(reverse=True)
q = [(-sum([ls[i][0] for i in range(3)]), 0, 0, 0)]
res = []
used = [(0, 0, 0)]
while len(res) < k:
s, i, j, l = heapq.heappop(q)
res.append(-s)
if i ... | import collections
import heapq
x, y, z, k = map(int, input().split())
ls = [list(map(int, input().split())) for _ in range(3)]
for i in range(3):
ls[i].sort(reverse=True)
q = [(-sum([ls[i][0] for i in range(3)]), 0, 0, 0)]
res = []
used = collections.defaultdict(lambda: False)
while len(res) < k:
s, i, j, l =... | false | 4.347826 | [
"+import collections",
"-used = [(0, 0, 0)]",
"+used = collections.defaultdict(lambda: False)",
"- if i + 1 < x and (i + 1, j, l) not in used:",
"+ if i + 1 < x and not used[(i + 1, j, l)]:",
"- used.append((i + 1, j, l))",
"- if j + 1 < y and (i, j + 1, l) not in used:",
"+ use... | false | 0.041062 | 0.032942 | 1.246479 | [
"s080013466",
"s156472812"
] |
u426764965 | p03229 | python | s442544884 | s896155967 | 268 | 215 | 8,292 | 7,764 | Accepted | Accepted | 19.78 | def tenka18beg_c():
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
A_desc = sorted(A, reverse=True)
if N % 2 == 1:
tot1, tot2 = 0, 0
for i, a in enumerate(A_desc):
if i < N//2 - 1:
tot1 += 2*a
tot2 += 2*a
... | # https://atcoder.jp/contests/tenka1-2018-beginner/submissions/6799465
def tenka18beg_c():
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
A.sort()
if N % 2 == 0:
lower = A[:N//2]
upper = A[N//2:]
ans = (2 * sum(upper) - upper[0]) - (2 * sum(lower) - l... | 39 | 20 | 1,029 | 641 | def tenka18beg_c():
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
A_desc = sorted(A, reverse=True)
if N % 2 == 1:
tot1, tot2 = 0, 0
for i, a in enumerate(A_desc):
if i < N // 2 - 1:
tot1 += 2 * a
tot2 += 2 * a
el... | # https://atcoder.jp/contests/tenka1-2018-beginner/submissions/6799465
def tenka18beg_c():
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
A.sort()
if N % 2 == 0:
lower = A[: N // 2]
upper = A[N // 2 :]
ans = (2 * sum(upper) - upper[0]) - (2 * sum(lower) - lower... | false | 48.717949 | [
"+# https://atcoder.jp/contests/tenka1-2018-beginner/submissions/6799465",
"- A_desc = sorted(A, reverse=True)",
"- if N % 2 == 1:",
"- tot1, tot2 = 0, 0",
"- for i, a in enumerate(A_desc):",
"- if i < N // 2 - 1:",
"- tot1 += 2 * a",
"- tot... | false | 0.04109 | 0.044793 | 0.917328 | [
"s442544884",
"s896155967"
] |
u703092276 | p02657 | python | s229243280 | s306026736 | 30 | 25 | 9,136 | 8,988 | Accepted | Accepted | 16.67 | a,b=list(map(int,input().split()));print((a*b)) | x,y=input().split();x=int(x);y=float(y);print((int(x*y))) | 1 | 1 | 39 | 55 | a, b = list(map(int, input().split()))
print((a * b))
| x, y = input().split()
x = int(x)
y = float(y)
print((int(x * y)))
| false | 0 | [
"-a, b = list(map(int, input().split()))",
"-print((a * b))",
"+x, y = input().split()",
"+x = int(x)",
"+y = float(y)",
"+print((int(x * y)))"
] | false | 0.044681 | 0.047639 | 0.937908 | [
"s229243280",
"s306026736"
] |
u638795007 | p03037 | python | s638440118 | s521434261 | 324 | 188 | 10,996 | 4,720 | Accepted | Accepted | 41.98 | N,M =list(map(int,input().split()))
L = [0]*M
R = [0]*M
ans = int(0)
for i in range(M):
L[i],R[i] = list(map(int,input().split()))
a1 = max(L)
a2 = min(R)
ans = a2-a1+1
if ans<0 : ans = int(0)
print((int(ans)))
| def examA():
N, M = LI()
l = 1; r = N
for _ in range(M):
L, R = LI()
l = max(L,l)
r = min(R,r)
ans = max(0,r-l+1)
print(ans)
return
def examB():
ans = 0
print(ans)
return
def examC():
ans = 0
print(ans)
return
def examD():
... | 16 | 66 | 227 | 1,277 | N, M = list(map(int, input().split()))
L = [0] * M
R = [0] * M
ans = int(0)
for i in range(M):
L[i], R[i] = list(map(int, input().split()))
a1 = max(L)
a2 = min(R)
ans = a2 - a1 + 1
if ans < 0:
ans = int(0)
print((int(ans)))
| def examA():
N, M = LI()
l = 1
r = N
for _ in range(M):
L, R = LI()
l = max(L, l)
r = min(R, r)
ans = max(0, r - l + 1)
print(ans)
return
def examB():
ans = 0
print(ans)
return
def examC():
ans = 0
print(ans)
return
def examD():
ans =... | false | 75.757576 | [
"-N, M = list(map(int, input().split()))",
"-L = [0] * M",
"-R = [0] * M",
"-ans = int(0)",
"-for i in range(M):",
"- L[i], R[i] = list(map(int, input().split()))",
"-a1 = max(L)",
"-a2 = min(R)",
"-ans = a2 - a1 + 1",
"-if ans < 0:",
"- ans = int(0)",
"-print((int(ans)))",
"+def examA... | false | 0.045035 | 0.045874 | 0.981692 | [
"s638440118",
"s521434261"
] |
u201234972 | p03295 | python | s698008759 | s675546613 | 1,994 | 494 | 23,284 | 22,432 | Accepted | Accepted | 75.23 | N, M = list(map( int, input().split()))
Q = [[int(s) for s in input().split()] for _ in range(M)]
Q = sorted(Q)
ans = 1
LQ = len(Q)
while LQ != 0:
stan = Q[0][1]
k = 1
while LQ != 0:
if Q[0][0] < stan:
stan = min(stan,Q.pop(0)[1])
LQ -= 1
else:
... | N, M = list(map( int, input().split()))
Q = [[int(s) for s in input().split()] for _ in range(M)]
Q = sorted(Q)
ans = 1
stan = Q[0][1]
for i in range(M):
if Q[i][0] < stan:
stan = min(stan,Q[i][1])
else:
ans += 1
if i == M-1:
break
else:
stan ... | 16 | 15 | 355 | 335 | N, M = list(map(int, input().split()))
Q = [[int(s) for s in input().split()] for _ in range(M)]
Q = sorted(Q)
ans = 1
LQ = len(Q)
while LQ != 0:
stan = Q[0][1]
k = 1
while LQ != 0:
if Q[0][0] < stan:
stan = min(stan, Q.pop(0)[1])
LQ -= 1
else:
ans += 1
... | N, M = list(map(int, input().split()))
Q = [[int(s) for s in input().split()] for _ in range(M)]
Q = sorted(Q)
ans = 1
stan = Q[0][1]
for i in range(M):
if Q[i][0] < stan:
stan = min(stan, Q[i][1])
else:
ans += 1
if i == M - 1:
break
else:
stan = Q[i][1]
p... | false | 6.25 | [
"-LQ = len(Q)",
"-while LQ != 0:",
"- stan = Q[0][1]",
"- k = 1",
"- while LQ != 0:",
"- if Q[0][0] < stan:",
"- stan = min(stan, Q.pop(0)[1])",
"- LQ -= 1",
"+stan = Q[0][1]",
"+for i in range(M):",
"+ if Q[i][0] < stan:",
"+ stan = min(stan, Q[... | false | 0.040127 | 0.041999 | 0.955421 | [
"s698008759",
"s675546613"
] |
u047796752 | p02744 | python | s002178141 | s316795286 | 175 | 137 | 79,212 | 75,904 | Accepted | Accepted | 21.71 | from collections import *
def dfs(l):
if len(l)==N:
print((''.join(l)))
return
for a in range(ord('a'), ord(max(l))+2):
l.append(chr(a))
dfs(l)
l.pop()
N = int(eval(input()))
dfs(deque(['a'])) | from collections import *
def dfs(q):
if len(q)==N:
print((''.join(q)))
return
M = 'a'
for qi in q:
M = max(M, qi)
for i in range(ord(M)-ord('a')+2):
q.append(alpha[i])
dfs(q)
q.pop()
N = int(eval(input()))
alpha = '... | 14 | 20 | 256 | 358 | from collections import *
def dfs(l):
if len(l) == N:
print(("".join(l)))
return
for a in range(ord("a"), ord(max(l)) + 2):
l.append(chr(a))
dfs(l)
l.pop()
N = int(eval(input()))
dfs(deque(["a"]))
| from collections import *
def dfs(q):
if len(q) == N:
print(("".join(q)))
return
M = "a"
for qi in q:
M = max(M, qi)
for i in range(ord(M) - ord("a") + 2):
q.append(alpha[i])
dfs(q)
q.pop()
N = int(eval(input()))
alpha = "abcdefghijklmnopqrstuvwxyz"
df... | false | 30 | [
"-def dfs(l):",
"- if len(l) == N:",
"- print((\"\".join(l)))",
"+def dfs(q):",
"+ if len(q) == N:",
"+ print((\"\".join(q)))",
"- for a in range(ord(\"a\"), ord(max(l)) + 2):",
"- l.append(chr(a))",
"- dfs(l)",
"- l.pop()",
"+ M = \"a\"",
"+ f... | false | 0.04584 | 0.043952 | 1.042962 | [
"s002178141",
"s316795286"
] |
u077337864 | p04006 | python | s697108822 | s186176445 | 1,610 | 988 | 3,188 | 3,188 | Accepted | Accepted | 38.63 | n, x = list(map(int, input().split()))
alist = list(map(int, input().split()))
blist = alist[:]
ans = None
for i in range(n):
for j in range(n):
blist[j] = min(blist[j], alist[j-i])
if ans is None:
ans = i * x + sum(blist)
else:
ans = min(ans, i * x + sum(blist))
print(ans)
| def main():
n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = 1100100100100100100
mina = [10000000000 for i in range(n)]
for i in range(n):
for j in range(n):
mina[j] = min(mina[j], a[i - j])
sumb = sum(mina)
ans = min(ans, ... | 13 | 15 | 300 | 388 | n, x = list(map(int, input().split()))
alist = list(map(int, input().split()))
blist = alist[:]
ans = None
for i in range(n):
for j in range(n):
blist[j] = min(blist[j], alist[j - i])
if ans is None:
ans = i * x + sum(blist)
else:
ans = min(ans, i * x + sum(blist))
print(ans)
| def main():
n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = 1100100100100100100
mina = [10000000000 for i in range(n)]
for i in range(n):
for j in range(n):
mina[j] = min(mina[j], a[i - j])
sumb = sum(mina)
ans = min(ans, sumb + i ... | false | 13.333333 | [
"-n, x = list(map(int, input().split()))",
"-alist = list(map(int, input().split()))",
"-blist = alist[:]",
"-ans = None",
"-for i in range(n):",
"- for j in range(n):",
"- blist[j] = min(blist[j], alist[j - i])",
"- if ans is None:",
"- ans = i * x + sum(blist)",
"- else:",... | false | 0.033955 | 0.03178 | 1.06845 | [
"s697108822",
"s186176445"
] |
u588341295 | p03987 | python | s994207180 | s424531152 | 1,395 | 1,268 | 80,080 | 77,648 | Accepted | Accepted | 9.1 | # -*- coding: utf-8 -*-
import sys
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(c)] for j in range(b)] for i in ... | # -*- coding: utf-8 -*-
import sys
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(c)] for j in range(b)] for i in ... | 107 | 106 | 2,559 | 2,693 | # -*- coding: utf-8 -*-
import sys
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(c)] for j in rang... | # -*- coding: utf-8 -*-
import sys
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(c)] for j in rang... | false | 0.934579 | [
"+ def bisearch_left(self, l, r, x):",
"+ \"\"\"区間l,rで左からx番目の値がある位置\"\"\"",
"+ l_val = self.sum(l)",
"+ ok = r",
"+ ng = l",
"+ while ng + 1 < ok:",
"+ mid = (ok + ng) // 2",
"+ if self.sum(mid) - l_val >= x:",
"+ ok = mid",
... | false | 0.038068 | 0.042702 | 0.891483 | [
"s994207180",
"s424531152"
] |
u044952145 | p03361 | python | s968431650 | s639394538 | 39 | 18 | 5,236 | 3,064 | Accepted | Accepted | 53.85 | import sys
sys.setrecursionlimit(100000)
H, W = list(map(int, input().split()))
s = [[c for c in eval(input())] for _ in range(H)]
accept = True
def dfs(x, y, count):
if x < 0 or W <= x or y < 0 or H <= y:
return count - 1
elif s[y][x] != "#":
return count - 1
else:
s... | H, W = list(map(int, input().split()))
s = [[c for c in eval(input())] for _ in range(H)]
accept = True
s = [["."]*(W+2)] + s + [["."]*(W+2)]
for i in range(1, H+1):
s[i] = ["."] + s[i] + ["."]
for y in range(1, H+1):
for x in range(1, W+1):
if s[y][x] == "#":
if s[y-1][x] == ".... | 27 | 18 | 647 | 467 | import sys
sys.setrecursionlimit(100000)
H, W = list(map(int, input().split()))
s = [[c for c in eval(input())] for _ in range(H)]
accept = True
def dfs(x, y, count):
if x < 0 or W <= x or y < 0 or H <= y:
return count - 1
elif s[y][x] != "#":
return count - 1
else:
s[y][x] = "."
... | H, W = list(map(int, input().split()))
s = [[c for c in eval(input())] for _ in range(H)]
accept = True
s = [["."] * (W + 2)] + s + [["."] * (W + 2)]
for i in range(1, H + 1):
s[i] = ["."] + s[i] + ["."]
for y in range(1, H + 1):
for x in range(1, W + 1):
if s[y][x] == "#":
if (
... | false | 33.333333 | [
"-import sys",
"-",
"-sys.setrecursionlimit(100000)",
"-",
"-",
"-def dfs(x, y, count):",
"- if x < 0 or W <= x or y < 0 or H <= y:",
"- return count - 1",
"- elif s[y][x] != \"#\":",
"- return count - 1",
"- else:",
"- s[y][x] = \".\"",
"- return max(",
... | false | 0.12097 | 0.059377 | 2.037336 | [
"s968431650",
"s639394538"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.