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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u539692012 | p02558 | python | s660951160 | s297033321 | 670 | 259 | 76,236 | 74,804 | Accepted | Accepted | 61.34 | class dsu:
def __init__(self, n=0):
self._n = n
self.parent_or_size = [-1] * n
def merge(self, a: int, b: int) -> int:
x = self.leader(a)
y = self.leader(b)
if x == y:
return x
if self.parent_or_size[x] > self.parent_or_size[y]:
... | class dsu:
def __init__(self, n=0):
self._n = n
self.parent_or_size = [-1] * n
def merge(self, a: int, b: int) -> int:
x = self.leader(a)
y = self.leader(b)
if x == y:
return x
if self.parent_or_size[x] > self.parent_or_size[y]:
... | 44 | 46 | 1,273 | 1,314 | class dsu:
def __init__(self, n=0):
self._n = n
self.parent_or_size = [-1] * n
def merge(self, a: int, b: int) -> int:
x = self.leader(a)
y = self.leader(b)
if x == y:
return x
if self.parent_or_size[x] > self.parent_or_size[y]:
x, y = y, ... | class dsu:
def __init__(self, n=0):
self._n = n
self.parent_or_size = [-1] * n
def merge(self, a: int, b: int) -> int:
x = self.leader(a)
y = self.leader(b)
if x == y:
return x
if self.parent_or_size[x] > self.parent_or_size[y]:
x, y = y, ... | false | 4.347826 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.037538 | 0.038377 | 0.978135 | [
"s660951160",
"s297033321"
] |
u150711673 | p02255 | python | s254455343 | s980972953 | 50 | 20 | 5,976 | 5,600 | Accepted | Accepted | 60 | def show (nums):
for i in range(len(nums)):
if i!=len(nums)-1:
print(nums[i],end=' ')
else :
print(nums[i])
n=int(input())
nums=list(map(int,input().split()))
show(nums)
for i in range(1,n):
v=nums[i]
j=i-1
while (j>=0 and nums[j]>v):
nums[... | N = int(eval(input()))
A_str = eval(input())
A = []
for s in A_str.split():
A.append(int(s))
print((" ".join(map(str, A))))
for i in range(1, len(A)):
key = A[i]
j = i - 1
while j >= 0 and A[j] > key:
A[j + 1] = A[j]
j -= 1
A[j + 1] = key
print((" ".join(map(str, A... | 18 | 16 | 380 | 311 | def show(nums):
for i in range(len(nums)):
if i != len(nums) - 1:
print(nums[i], end=" ")
else:
print(nums[i])
n = int(input())
nums = list(map(int, input().split()))
show(nums)
for i in range(1, n):
v = nums[i]
j = i - 1
while j >= 0 and nums[j] > v:
nu... | N = int(eval(input()))
A_str = eval(input())
A = []
for s in A_str.split():
A.append(int(s))
print((" ".join(map(str, A))))
for i in range(1, len(A)):
key = A[i]
j = i - 1
while j >= 0 and A[j] > key:
A[j + 1] = A[j]
j -= 1
A[j + 1] = key
print((" ".join(map(str, A))))
| false | 11.111111 | [
"-def show(nums):",
"- for i in range(len(nums)):",
"- if i != len(nums) - 1:",
"- print(nums[i], end=\" \")",
"- else:",
"- print(nums[i])",
"-",
"-",
"-n = int(input())",
"-nums = list(map(int, input().split()))",
"-show(nums)",
"-for i in range(1, n):"... | false | 0.154683 | 0.036881 | 4.19413 | [
"s254455343",
"s980972953"
] |
u472065247 | p03728 | python | s091441664 | s154090474 | 313 | 242 | 35,624 | 24,744 | Accepted | Accepted | 22.68 | N = int(eval(input()))
P = list(map(int, input().split()))
if N == 1:
print((0))
exit()
Pi = [0] * (N + 1)
for i, n in enumerate(P, 1):
Pi[n] = i
T = [0] * N
f = [0] * N
if Pi[N] > Pi[N - 1]:
T[N - 1] = 0
f[N - 1] = N - 1
else:
T[N - 1] = 1
f[N - 1] = N
for i in ran... | N = int(eval(input()))
P = list(map(int, input().split()))
Pi = [0] * (N + 1)
for i, n in enumerate(P, 1):
Pi[n] = i
i = N - 1
T = 0
f = 0
while i:
i_f = Pi[f]
i_i = Pi[i]
i_ii = Pi[i + 1]
if i_f < i_ii < i_i or i_i < i_f < i_ii or i_ii < i_i < i_f:
T += 1
f = i +... | 43 | 21 | 858 | 340 | N = int(eval(input()))
P = list(map(int, input().split()))
if N == 1:
print((0))
exit()
Pi = [0] * (N + 1)
for i, n in enumerate(P, 1):
Pi[n] = i
T = [0] * N
f = [0] * N
if Pi[N] > Pi[N - 1]:
T[N - 1] = 0
f[N - 1] = N - 1
else:
T[N - 1] = 1
f[N - 1] = N
for i in range(N - 2, 0, -1):
if T... | N = int(eval(input()))
P = list(map(int, input().split()))
Pi = [0] * (N + 1)
for i, n in enumerate(P, 1):
Pi[n] = i
i = N - 1
T = 0
f = 0
while i:
i_f = Pi[f]
i_i = Pi[i]
i_ii = Pi[i + 1]
if i_f < i_ii < i_i or i_i < i_f < i_ii or i_ii < i_i < i_f:
T += 1
f = i + 1
i -= 1
print(... | false | 51.162791 | [
"-if N == 1:",
"- print((0))",
"- exit()",
"-T = [0] * N",
"-f = [0] * N",
"-if Pi[N] > Pi[N - 1]:",
"- T[N - 1] = 0",
"- f[N - 1] = N - 1",
"-else:",
"- T[N - 1] = 1",
"- f[N - 1] = N",
"-for i in range(N - 2, 0, -1):",
"- if T[i + 1] == 0:",
"- i_i = Pi[i]",
... | false | 0.040968 | 0.067247 | 0.609212 | [
"s091441664",
"s154090474"
] |
u334712262 | p02762 | python | s165035262 | s949359409 | 1,705 | 1,535 | 139,860 | 110,644 | Accepted | Accepted | 9.97 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, produc... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, produc... | 132 | 132 | 2,802 | 2,802 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permut... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permut... | false | 0 | [
"- if self.size(x) < self.size(y):",
"+ if self.size(x) > self.size(y):"
] | false | 0.117213 | 0.04779 | 2.452662 | [
"s165035262",
"s949359409"
] |
u150984829 | p00436 | python | s715322152 | s045126595 | 60 | 40 | 5,624 | 5,624 | Accepted | Accepted | 33.33 | n=int(input())
c=list(range(1,1+2*n))
for _ in[0]*int(input()):
k=int(input())
if k:c=c[k:]+c[:k]
else:
for a,b in zip(c[:n],c[n:]):
c+=[a,b]
c=c[2*n:]
print(*c,sep='\n')
| n=int(eval(input()))
c=list(range(1,1+2*n))
for _ in[0]*int(eval(input())):
k=int(eval(input()))
if k:c=c[k:]+c[:k]
else:
for a,b in zip(c[:n],c[n:]):
c+=[a,b]
c=c[2*n:]
for x in c:print(x)
| 10 | 10 | 220 | 221 | n = int(input())
c = list(range(1, 1 + 2 * n))
for _ in [0] * int(input()):
k = int(input())
if k:
c = c[k:] + c[:k]
else:
for a, b in zip(c[:n], c[n:]):
c += [a, b]
c = c[2 * n :]
print(*c, sep="\n")
| n = int(eval(input()))
c = list(range(1, 1 + 2 * n))
for _ in [0] * int(eval(input())):
k = int(eval(input()))
if k:
c = c[k:] + c[:k]
else:
for a, b in zip(c[:n], c[n:]):
c += [a, b]
c = c[2 * n :]
for x in c:
print(x)
| false | 0 | [
"-n = int(input())",
"+n = int(eval(input()))",
"-for _ in [0] * int(input()):",
"- k = int(input())",
"+for _ in [0] * int(eval(input())):",
"+ k = int(eval(input()))",
"-print(*c, sep=\"\\n\")",
"+for x in c:",
"+ print(x)"
] | false | 0.045021 | 0.075313 | 0.597786 | [
"s715322152",
"s045126595"
] |
u197615397 | p02321 | python | s720069960 | s525360503 | 8,220 | 4,190 | 181,732 | 183,800 | Accepted | Accepted | 49.03 | def solve():
from bisect import bisect_right
N, W = list(map(int, input().split()))
a = [tuple(map(int, input().split())) for _ in [0]*N]
def bitdp(items):
n = len(items)
dp = [(0, 0) for _ in [0]*(2**n)]
for bitset in range(1, 2**n):
for item_num, (item_v, ... | import sys
from bisect import bisect_right
def meet_in_the_middle(a: list, limit: int) -> tuple:
first_v, first_w, second_v, second_w = [], [], [], []
for items, v_append, w_append in (
(a[:len(a)//2], first_v.append, first_w.append),
(a[len(a)//2:], second_v.append, second_w.a... | 40 | 37 | 1,150 | 1,189 | def solve():
from bisect import bisect_right
N, W = list(map(int, input().split()))
a = [tuple(map(int, input().split())) for _ in [0] * N]
def bitdp(items):
n = len(items)
dp = [(0, 0) for _ in [0] * (2**n)]
for bitset in range(1, 2**n):
for item_num, (item_v, item... | import sys
from bisect import bisect_right
def meet_in_the_middle(a: list, limit: int) -> tuple:
first_v, first_w, second_v, second_w = [], [], [], []
for items, v_append, w_append in (
(a[: len(a) // 2], first_v.append, first_w.append),
(a[len(a) // 2 :], second_v.append, second_w.append),
... | false | 7.5 | [
"-def solve():",
"- from bisect import bisect_right",
"-",
"- N, W = list(map(int, input().split()))",
"- a = [tuple(map(int, input().split())) for _ in [0] * N]",
"-",
"- def bitdp(items):",
"- n = len(items)",
"- dp = [(0, 0) for _ in [0] * (2**n)]",
"- for bitse... | false | 0.061874 | 0.060897 | 1.016035 | [
"s720069960",
"s525360503"
] |
u648117624 | p02392 | python | s110632074 | s193003973 | 30 | 20 | 5,584 | 5,588 | Accepted | Accepted | 33.33 | a,b,c = list(map(int, input().split()))
if a < b < c:
print("Yes")
else:
print("No")
| a, b, c = list(map(int, input().split()))
if (a < b) and (b < c):
print("Yes")
else:
print("No")
| 7 | 10 | 95 | 113 | a, b, c = list(map(int, input().split()))
if a < b < c:
print("Yes")
else:
print("No")
| a, b, c = list(map(int, input().split()))
if (a < b) and (b < c):
print("Yes")
else:
print("No")
| false | 30 | [
"-if a < b < c:",
"+if (a < b) and (b < c):"
] | false | 0.106902 | 0.097328 | 1.098379 | [
"s110632074",
"s193003973"
] |
u711539583 | p02685 | python | s455390447 | s433222363 | 1,458 | 1,337 | 127,648 | 127,672 | Accepted | Accepted | 8.3 | n, m, k = list(map(int, input().split()))
mod = 998244353
N = 10 ** 6
#逆元テーブル
inv_t = [0]+[1]
for i in range(2, N):
inv_t += [inv_t[mod % i] * (mod - int(mod / i)) % mod]
#階乗計算
kai = [1, 1]
rev_kai = [1, inv_t[1]]
for i in range(2, N):
kai.append(kai[-1] * i % mod)
rev_kai.append(rev_kai[-1] * inv... | n, m, k = list(map(int, input().split()))
mod = 998244353
N = 10 ** 6
#逆元テーブル
inv_t = [0]+[1]
for i in range(2, N):
inv_t += [inv_t[mod % i] * (mod - int(mod / i)) % mod]
#階乗計算
kai = [1, 1]
rev_kai = [1, inv_t[1]]
for i in range(2, N):
kai.append(kai[-1] * i % mod)
rev_kai.append(rev_kai[-1] * inv... | 36 | 38 | 663 | 700 | n, m, k = list(map(int, input().split()))
mod = 998244353
N = 10**6
# 逆元テーブル
inv_t = [0] + [1]
for i in range(2, N):
inv_t += [inv_t[mod % i] * (mod - int(mod / i)) % mod]
# 階乗計算
kai = [1, 1]
rev_kai = [1, inv_t[1]]
for i in range(2, N):
kai.append(kai[-1] * i % mod)
rev_kai.append(rev_kai[-1] * inv_t[i] % ... | n, m, k = list(map(int, input().split()))
mod = 998244353
N = 10**6
# 逆元テーブル
inv_t = [0] + [1]
for i in range(2, N):
inv_t += [inv_t[mod % i] * (mod - int(mod / i)) % mod]
# 階乗計算
kai = [1, 1]
rev_kai = [1, inv_t[1]]
for i in range(2, N):
kai.append(kai[-1] * i % mod)
rev_kai.append(rev_kai[-1] * inv_t[i] % ... | false | 5.263158 | [
"+ if i == n - 1:",
"+ base = m",
"-if m == 1 and k == n - 1:",
"- print((1))",
"-else:",
"- print(ans)",
"+# if m == 1 and k > n-1:",
"+# print(1)",
"+# else:",
"+print(ans)"
] | false | 2.38753 | 2.099947 | 1.136948 | [
"s455390447",
"s433222363"
] |
u016881126 | p02678 | python | s658447751 | s888007047 | 687 | 422 | 38,420 | 54,692 | Accepted | Accepted | 38.57 | import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')
N, M = list(map(int, input().split()))
graph = [[] for _ in range(N)]
for _ in range(M):
A, B = list(map(int, input().split()))
# pr... | import sys
from collections import deque
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')
N, M = map(int, readline().split())
G = [[] for _ in range(N+1)]
m = map(int, read().split())
for a, b in zi... | 42 | 33 | 1,047 | 678 | import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10**7)
INF = float("inf")
N, M = list(map(int, input().split()))
graph = [[] for _ in range(N)]
for _ in range(M):
A, B = list(map(int, input().split()))
# print(A, B)
g... | import sys
from collections import deque
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10**7)
INF = float("inf")
N, M = map(int, readline().split())
G = [[] for _ in range(N + 1)]
m = map(int, read().split())
for a, b in zip(m, m):
G[... | false | 21.428571 | [
"+from collections import deque",
"-N, M = list(map(int, input().split()))",
"-graph = [[] for _ in range(N)]",
"-for _ in range(M):",
"- A, B = list(map(int, input().split()))",
"- # print(A, B)",
"- graph[A - 1].append(B - 1)",
"- graph[B - 1].append(A - 1)",
"-from collections import ... | false | 0.036008 | 0.056145 | 0.641337 | [
"s658447751",
"s888007047"
] |
u864197622 | p02728 | python | s688594335 | s597757892 | 1,579 | 1,236 | 137,608 | 136,484 | Accepted | Accepted | 21.72 | import sys
input = sys.stdin.readline
from collections import deque
nn = 200200
mod = 10**9+7
fa = [1] * (nn+1)
fainv = [1] * (nn+1)
inv = [1] * (nn+1)
for i in range(nn):
fa[i+1] = fa[i] * (i+1) % mod
fainv[-1] = pow(fa[-1], mod-2, mod)
for i in range(nn)[::-1]:
fainv[i] = fainv[i+1] * (i+1) % ... | import sys
input = sys.stdin.readline
from collections import deque
nn = 200200
mod = 10**9+7
fa = [1] * (nn+1)
fainv = [1] * (nn+1)
inv = [1] * (nn+1)
for i in range(nn):
fa[i+1] = fa[i] * (i+1) % mod
fainv[-1] = pow(fa[-1], mod-2, mod)
for i in range(nn)[::-1]:
fainv[i] = fainv[i+1] * (i+1) % ... | 68 | 67 | 1,456 | 1,458 | import sys
input = sys.stdin.readline
from collections import deque
nn = 200200
mod = 10**9 + 7
fa = [1] * (nn + 1)
fainv = [1] * (nn + 1)
inv = [1] * (nn + 1)
for i in range(nn):
fa[i + 1] = fa[i] * (i + 1) % mod
fainv[-1] = pow(fa[-1], mod - 2, mod)
for i in range(nn)[::-1]:
fainv[i] = fainv[i + 1] * (i + 1... | import sys
input = sys.stdin.readline
from collections import deque
nn = 200200
mod = 10**9 + 7
fa = [1] * (nn + 1)
fainv = [1] * (nn + 1)
inv = [1] * (nn + 1)
for i in range(nn):
fa[i + 1] = fa[i] * (i + 1) % mod
fainv[-1] = pow(fa[-1], mod - 2, mod)
for i in range(nn)[::-1]:
fainv[i] = fainv[i + 1] * (i + 1... | false | 1.470588 | [
"-for i in R[::-1]:",
"- for j in X[i]:",
"- SI[i] += SI[j]",
"+for i in R[1:][::-1]:",
"+ SI[P[i]] += SI[i]",
"-for i in R[::-1]:",
"- a = 1",
"- for j in X[i]:",
"- a = f(a, BU[j])",
"- BU[i] = g_bu(a, i)",
"+for i in R[1:][::-1]:",
"+ BU[i] = g_bu(BU[i], i)",... | false | 0.73053 | 0.323145 | 2.26069 | [
"s688594335",
"s597757892"
] |
u250734103 | p03804 | python | s580637546 | s263864800 | 118 | 33 | 9,112 | 9,216 | Accepted | Accepted | 72.03 | N, M = list(map(int, input().split()))
A = [''] * N
B = [''] * M
for i in range(N):
A[i] = eval(input())
for i in range(M):
B[i] = eval(input())
match_cnt = 0
for i in range(N - M + 1):
for j in range(N - M + 1):
flag = True
for y in range(M):
for x in range(M):
... | N, M = list(map(int, input().split()))
A = [''] * N
B = [''] * M
for i in range(N):
A[i] = eval(input())
for i in range(M):
B[i] = eval(input())
match_cnt = 0
for i in range(N - M + 1):
for j in range(N - M + 1):
flag = True
for y in range(M):
if A[y + i][j:j + M] !... | 23 | 22 | 489 | 448 | N, M = list(map(int, input().split()))
A = [""] * N
B = [""] * M
for i in range(N):
A[i] = eval(input())
for i in range(M):
B[i] = eval(input())
match_cnt = 0
for i in range(N - M + 1):
for j in range(N - M + 1):
flag = True
for y in range(M):
for x in range(M):
i... | N, M = list(map(int, input().split()))
A = [""] * N
B = [""] * M
for i in range(N):
A[i] = eval(input())
for i in range(M):
B[i] = eval(input())
match_cnt = 0
for i in range(N - M + 1):
for j in range(N - M + 1):
flag = True
for y in range(M):
if A[y + i][j : j + M] != B[y]:
... | false | 4.347826 | [
"- for x in range(M):",
"- if A[y + i][x + j] != B[y][x]:",
"- flag = False",
"+ if A[y + i][j : j + M] != B[y]:",
"+ flag = False"
] | false | 0.050369 | 0.040844 | 1.233216 | [
"s580637546",
"s263864800"
] |
u054825571 | p02708 | python | s751147195 | s849836205 | 88 | 31 | 9,168 | 9,188 | Accepted | Accepted | 64.77 | MOD=10**9+7
N,K=list(map(int,input().split()))
ans=0
for k in range(K,N+2):
ans+=(N-k+1)*k+1
ans%=MOD
print(ans) | MOD=10**9+7
N,K=list(map(int,input().split()))
ans=0
ans+=N-K+2
ans+=(N+1)*(N+1+K)*(N-K+2)//2
ans%=MOD
ans-=(N+1)*(N+2)*(2*N+3)//6
ans%=MOD
ans+=K*(K-1)*(2*K-1)//6
ans%=MOD
print(ans) | 7 | 12 | 116 | 189 | MOD = 10**9 + 7
N, K = list(map(int, input().split()))
ans = 0
for k in range(K, N + 2):
ans += (N - k + 1) * k + 1
ans %= MOD
print(ans)
| MOD = 10**9 + 7
N, K = list(map(int, input().split()))
ans = 0
ans += N - K + 2
ans += (N + 1) * (N + 1 + K) * (N - K + 2) // 2
ans %= MOD
ans -= (N + 1) * (N + 2) * (2 * N + 3) // 6
ans %= MOD
ans += K * (K - 1) * (2 * K - 1) // 6
ans %= MOD
print(ans)
| false | 41.666667 | [
"-for k in range(K, N + 2):",
"- ans += (N - k + 1) * k + 1",
"- ans %= MOD",
"+ans += N - K + 2",
"+ans += (N + 1) * (N + 1 + K) * (N - K + 2) // 2",
"+ans %= MOD",
"+ans -= (N + 1) * (N + 2) * (2 * N + 3) // 6",
"+ans %= MOD",
"+ans += K * (K - 1) * (2 * K - 1) // 6",
"+ans %= MOD"
] | false | 0.051974 | 0.035628 | 1.458793 | [
"s751147195",
"s849836205"
] |
u588341295 | p02669 | python | s650380237 | s975379738 | 1,220 | 405 | 112,208 | 85,868 | Accepted | Accepted | 66.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 range(a)]
def ceil(x, y=1)... | import sys
from collections import defaultdict
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)]... | 73 | 58 | 2,343 | 1,648 | 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 range(a)]... | import sys
from collections import defaultdict
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)] f... | false | 20.547945 | [
"+from collections import defaultdict",
"-def dijkstra(src):",
"- from heapq import heappush, heappop",
"- from collections import defaultdict",
"-",
"- que = [(0, src)]",
"- dist = defaultdict(lambda: INF)",
"- dist[src] = 0",
"- while que:",
"- cost, u = heappop(que)",
... | false | 0.280088 | 0.336827 | 0.831547 | [
"s650380237",
"s975379738"
] |
u340781749 | p03576 | python | s973203025 | s325277183 | 1,343 | 206 | 3,064 | 3,064 | Accepted | Accepted | 84.66 | n, k = list(map(int, input().split()))
sx, sy = [], []
for i in range(n):
x, y = list(map(int, input().split()))
sx.append((x, i))
sy.append((y, i))
sx.sort()
sy.sort()
px = [[0] for _ in range(n)]
for cx, (x, i) in enumerate(sx):
px[i] = cx
acm = [[0] * (n + 1) for _ in range(n + 1)]
for ... | n, k = list(map(int, input().split()))
sx, sy = [], []
for i in range(n):
x, y = list(map(int, input().split()))
sx.append((x, i))
sy.append((y, i))
sx.sort()
sy.sort()
px = [[0] for _ in range(n)]
for cx, (x, i) in enumerate(sx):
px[i] = cx
acm = [[0] * (n + 1) for _ in range(n + 1)]
for ... | 27 | 27 | 969 | 885 | n, k = list(map(int, input().split()))
sx, sy = [], []
for i in range(n):
x, y = list(map(int, input().split()))
sx.append((x, i))
sy.append((y, i))
sx.sort()
sy.sort()
px = [[0] for _ in range(n)]
for cx, (x, i) in enumerate(sx):
px[i] = cx
acm = [[0] * (n + 1) for _ in range(n + 1)]
for cy, (y, i) in ... | n, k = list(map(int, input().split()))
sx, sy = [], []
for i in range(n):
x, y = list(map(int, input().split()))
sx.append((x, i))
sy.append((y, i))
sx.sort()
sy.sort()
px = [[0] for _ in range(n)]
for cx, (x, i) in enumerate(sx):
px[i] = cx
acm = [[0] * (n + 1) for _ in range(n + 1)]
for cy, (y, i) in ... | false | 0 | [
"- for ucx in range(lcx + k - 1, n):",
"- for lcy in range(n - k + 1):",
"+ for lcy in range(n - k + 1):",
"+ acm_l = acm[lcx - 1][lcy - 1]",
"+ for ucx in range(lcx + k - 1, n):",
"- # print(li, ui, lj, uj)",
"- # print(acm[ui][uj], acm[ui][lj - ... | false | 0.078445 | 0.046211 | 1.697513 | [
"s973203025",
"s325277183"
] |
u334712262 | p02937 | python | s992843743 | s891847823 | 1,002 | 272 | 107,864 | 63,844 | Accepted | Accepted | 72.85 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
import copy
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replac... | # -*- coding: utf-8 -*-
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2**62-1
def read_int():
return int(buff_readline())
def read_int_n():
return list(map(int, buff_readline().spli... | 126 | 105 | 2,450 | 1,894 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
import copy
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, pro... | # -*- coding: utf-8 -*-
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2**62 - 1
def read_int():
return int(buff_readline())
def read_int_n():
return list(map(int, buff_readline().split()))
def r... | false | 16.666667 | [
"-import bisect",
"-import heapq",
"-import math",
"-import random",
"-import copy",
"-from collections import Counter, defaultdict, deque",
"-from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal",
"-from functools import lru_cache, reduce",
"-from itertools import combinations, combinations_wi... | false | 0.036453 | 0.14443 | 0.252396 | [
"s992843743",
"s891847823"
] |
u855775311 | p02364 | python | s474622778 | s721805212 | 720 | 640 | 25,780 | 26,348 | Accepted | Accepted | 11.11 | import sys
class UnionFind():
def __init__(self, n):
self.n = n
self.p = [i for i in range(n + 5)]
self.rank = [0 for i in range(n + 5)]
def find_set(self, x):
if self.p[x] != x:
self.p[x] = self.find_set(self.p[x])
return self.p[x]
def u... | import sys
class UnionFind:
def __init__(self, nvertices):
self.rank = [1] * (nvertices + 5)
self.p = [i for i in range(nvertices + 5)]
def find_set(self, u):
if u != self.p[u]:
self.p[u] = self.find_set(self.p[u])
return self.p[u]
def unite(sel... | 46 | 50 | 1,061 | 1,166 | import sys
class UnionFind:
def __init__(self, n):
self.n = n
self.p = [i for i in range(n + 5)]
self.rank = [0 for i in range(n + 5)]
def find_set(self, x):
if self.p[x] != x:
self.p[x] = self.find_set(self.p[x])
return self.p[x]
def unite(self, x, y)... | import sys
class UnionFind:
def __init__(self, nvertices):
self.rank = [1] * (nvertices + 5)
self.p = [i for i in range(nvertices + 5)]
def find_set(self, u):
if u != self.p[u]:
self.p[u] = self.find_set(self.p[u])
return self.p[u]
def unite(self, u, v):
... | false | 8 | [
"- def __init__(self, n):",
"- self.n = n",
"- self.p = [i for i in range(n + 5)]",
"- self.rank = [0 for i in range(n + 5)]",
"+ def __init__(self, nvertices):",
"+ self.rank = [1] * (nvertices + 5)",
"+ self.p = [i for i in range(nvertices + 5)]",
"- def f... | false | 0.046279 | 0.046139 | 1.003041 | [
"s474622778",
"s721805212"
] |
u952708174 | p02697 | python | s605983230 | s134924696 | 138 | 61 | 41,976 | 28,588 | Accepted | Accepted | 55.8 | def e_rotation_matching():
# 参考: https://maspypy.com/atcoder-参加感想-2020-05-02abc-165
import numpy as np
N, M = [int(i) for i in input().split()]
A = np.arange(M) # 剰余計算の簡便のため、0-origin とする
B = 2 * M - 1 - A # N >= 2*M - 1 だが、N = 2*M - 1 の場合と同じ構築でよい
# 剰余を取ったときに mod N に対して A, B の全要素が互いに異なる... | def e_rotation_matching():
N, M = [int(i) for i in input().split()]
if N % 2 == 1:
ans = [(left, N - left) for left in range(1, (N // 2) + 1)]
else:
ans = []
flag = False
left, right = 1, N - 1
while left < right:
if not flag and right - left <=... | 17 | 19 | 561 | 559 | def e_rotation_matching():
# 参考: https://maspypy.com/atcoder-参加感想-2020-05-02abc-165
import numpy as np
N, M = [int(i) for i in input().split()]
A = np.arange(M) # 剰余計算の簡便のため、0-origin とする
B = 2 * M - 1 - A # N >= 2*M - 1 だが、N = 2*M - 1 の場合と同じ構築でよい
# 剰余を取ったときに mod N に対して A, B の全要素が互いに異なるようにしたい
... | def e_rotation_matching():
N, M = [int(i) for i in input().split()]
if N % 2 == 1:
ans = [(left, N - left) for left in range(1, (N // 2) + 1)]
else:
ans = []
flag = False
left, right = 1, N - 1
while left < right:
if not flag and right - left <= N // 2:
... | false | 10.526316 | [
"- # 参考: https://maspypy.com/atcoder-参加感想-2020-05-02abc-165",
"- import numpy as np",
"-",
"- A = np.arange(M) # 剰余計算の簡便のため、0-origin とする",
"- B = 2 * M - 1 - A # N >= 2*M - 1 だが、N = 2*M - 1 の場合と同じ構築でよい",
"- # 剰余を取ったときに mod N に対して A, B の全要素が互いに異なるようにしたい",
"- B[: M // 2] -= 2 * M + 1",... | false | 0.228739 | 0.08216 | 2.784069 | [
"s605983230",
"s134924696"
] |
u263830634 | p03592 | python | s341750688 | s555185704 | 345 | 17 | 2,940 | 2,940 | Accepted | Accepted | 95.07 | N, M, K = list(map(int, input().split()))
for n in range(N + 1):
for m in range(M + 1):
tmp = m * (N - n) + n * (M - m)
if tmp == K:
print ('Yes')
exit()
print ('No') | N, M, K = list(map(int, input().split()))
for n in range(N + 1):
if (N - 2 * n) == 0:
continue
if (K - n * M) % (N - 2 * n) == 0:
if 0 <= (K - n * M) // (N - 2 * n) <= M:
print ('Yes')
exit()
print ('No') | 10 | 11 | 215 | 258 | N, M, K = list(map(int, input().split()))
for n in range(N + 1):
for m in range(M + 1):
tmp = m * (N - n) + n * (M - m)
if tmp == K:
print("Yes")
exit()
print("No")
| N, M, K = list(map(int, input().split()))
for n in range(N + 1):
if (N - 2 * n) == 0:
continue
if (K - n * M) % (N - 2 * n) == 0:
if 0 <= (K - n * M) // (N - 2 * n) <= M:
print("Yes")
exit()
print("No")
| false | 9.090909 | [
"- for m in range(M + 1):",
"- tmp = m * (N - n) + n * (M - m)",
"- if tmp == K:",
"+ if (N - 2 * n) == 0:",
"+ continue",
"+ if (K - n * M) % (N - 2 * n) == 0:",
"+ if 0 <= (K - n * M) // (N - 2 * n) <= M:"
] | false | 0.041703 | 0.034615 | 1.204786 | [
"s341750688",
"s555185704"
] |
u298297089 | p03456 | python | s779336423 | s471316611 | 168 | 17 | 38,384 | 2,940 | Accepted | Accepted | 89.88 | a,b = input().split()
c = int(a+b)
print(('Yes' if c**0.5 == int(c**0.5) else 'No')) | a, b = input().split()
c = int(a + b)
for i in range(1,1001):
if i * i == c:
print("Yes")
break
else:
print("No")
| 3 | 9 | 84 | 135 | a, b = input().split()
c = int(a + b)
print(("Yes" if c**0.5 == int(c**0.5) else "No"))
| a, b = input().split()
c = int(a + b)
for i in range(1, 1001):
if i * i == c:
print("Yes")
break
else:
print("No")
| false | 66.666667 | [
"-print((\"Yes\" if c**0.5 == int(c**0.5) else \"No\"))",
"+for i in range(1, 1001):",
"+ if i * i == c:",
"+ print(\"Yes\")",
"+ break",
"+else:",
"+ print(\"No\")"
] | false | 0.04197 | 0.042228 | 0.993898 | [
"s779336423",
"s471316611"
] |
u645250356 | p03352 | python | s064786617 | s070140670 | 169 | 36 | 38,768 | 5,076 | Accepted | Accepted | 78.7 | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.st... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,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.stdin.readline().split()))
s = ... | 16 | 20 | 527 | 525 | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.readline().split()))
def inpln(n):
r... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, 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.stdin.readline().s... | false | 20 | [
"-import sys, bisect, math, itertools",
"+import sys, bisect, math, itertools, fractions",
"+INF = float(\"inf\")",
"-def inpln(n):",
"- return list(int(sys.stdin.readline()) for i in range(n))",
"-",
"-",
"-x = inp()",
"-for i in range(x, 0, -1):",
"- for b in range(1, 33):",
"- fo... | false | 0.035642 | 0.082224 | 0.433478 | [
"s064786617",
"s070140670"
] |
u219417113 | p02762 | python | s175919795 | s757771419 | 1,238 | 952 | 33,760 | 51,412 | Accepted | Accepted | 23.1 | class UnionFind:
"""
parents: 各要素の親要素
要素がrootの場合には -(そのグループに属する要素数) を格納
"""
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
# xが属するグループのrootを取得
if self.parents[x] < 0:
return x
else:
... | class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
... | 77 | 62 | 1,967 | 1,553 | class UnionFind:
"""
parents: 各要素の親要素
要素がrootの場合には -(そのグループに属する要素数) を格納
"""
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
# xが属するグループのrootを取得
if self.parents[x] < 0:
return x
else:
self.pare... | class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = se... | false | 19.480519 | [
"- \"\"\"",
"- parents: 各要素の親要素",
"- 要素がrootの場合には -(そのグループに属する要素数) を格納",
"- \"\"\"",
"-",
"- # xが属するグループのrootを取得",
"- # 高い方の木の根に低い方の木の根を結合",
"- def members(self, x):",
"- root = self.find(x)",
"- return [i for i in range(self.n) if self.find(i) =... | false | 0.046013 | 0.043444 | 1.059133 | [
"s175919795",
"s757771419"
] |
u367701763 | p02949 | python | s019817622 | s740400444 | 1,455 | 574 | 68,908 | 74,644 | Accepted | Accepted | 60.55 | import sys
input = sys.stdin.readline
class Graph:
class Edge:
def __init__(self, to, cost):
"""
:param to: 終点ノード
:param cost: 辺の重み
"""
self.to, self.cost = to, cost
def __init__(self, n, directed=False, decrement=True, edges=[... | import sys
input = sys.stdin.readline
class Graph:
class Edge:
def __init__(self, to, cost):
"""
:param to: 終点ノード
:param cost: 辺の重み
"""
self.to, self.cost = to, cost
def __init__(self, n, directed=False, decrement=True, edges=[... | 103 | 103 | 3,049 | 3,028 | import sys
input = sys.stdin.readline
class Graph:
class Edge:
def __init__(self, to, cost):
"""
:param to: 終点ノード
:param cost: 辺の重み
"""
self.to, self.cost = to, cost
def __init__(self, n, directed=False, decrement=True, edges=[]):
... | import sys
input = sys.stdin.readline
class Graph:
class Edge:
def __init__(self, to, cost):
"""
:param to: 終点ノード
:param cost: 辺の重み
"""
self.to, self.cost = to, cost
def __init__(self, n, directed=False, decrement=True, edges=[]):
... | false | 0 | [
"- print((max(-graph.bellman_ford2(1, N), 0)))",
"+ print((max(-res, 0)))"
] | false | 0.037349 | 0.035398 | 1.05511 | [
"s019817622",
"s740400444"
] |
u145950990 | p04019 | python | s671474433 | s147652744 | 176 | 160 | 38,384 | 38,384 | Accepted | Accepted | 9.09 | s = set(list(eval(input())))
ans = 'Yes'
if 'N' in s and not 'S' in s or 'S' in s and not 'N' in s:
ans = 'No'
elif 'W' in s and not 'E' in s or 'E' in s and not 'W' in s:
ans = 'No'
print(ans) | s = set(list(eval(input())))
ans = 'Yes'
if ('N' in s)!=('S' in s):ans = 'No'
elif ('W' in s)!=('E' in s):ans = 'No'
print(ans) | 7 | 5 | 201 | 125 | s = set(list(eval(input())))
ans = "Yes"
if "N" in s and not "S" in s or "S" in s and not "N" in s:
ans = "No"
elif "W" in s and not "E" in s or "E" in s and not "W" in s:
ans = "No"
print(ans)
| s = set(list(eval(input())))
ans = "Yes"
if ("N" in s) != ("S" in s):
ans = "No"
elif ("W" in s) != ("E" in s):
ans = "No"
print(ans)
| false | 28.571429 | [
"-if \"N\" in s and not \"S\" in s or \"S\" in s and not \"N\" in s:",
"+if (\"N\" in s) != (\"S\" in s):",
"-elif \"W\" in s and not \"E\" in s or \"E\" in s and not \"W\" in s:",
"+elif (\"W\" in s) != (\"E\" in s):"
] | false | 0.037402 | 0.038253 | 0.977753 | [
"s671474433",
"s147652744"
] |
u861141787 | p03617 | python | s524328499 | s907937154 | 19 | 17 | 3,188 | 3,064 | Accepted | Accepted | 10.53 | Q, H, S, D = list(map(int, input().split()))
N = int(eval(input()))
PS = [[Q * 8, 0.25], [H * 4, 0.5], [S * 2, 1], [D, 2]]
PS.sort(key=lambda x: x[0])
R = N
ans = 0
for i in range (4):
if R == 0:
break
elif R >= PS[i][1]:
ans += int(PS[i][0] * PS[i][1] // 2 * (R // PS[i][1]))
... | Q, H, S, D = list(map(int, input().split()))
N = int(eval(input()))
ans = (N//2) * min(8 * Q, 4 * H, S * 2, D) + (N % 2) * min(4 * Q, 2 * H, S)
print(ans) | 18 | 6 | 346 | 149 | Q, H, S, D = list(map(int, input().split()))
N = int(eval(input()))
PS = [[Q * 8, 0.25], [H * 4, 0.5], [S * 2, 1], [D, 2]]
PS.sort(key=lambda x: x[0])
R = N
ans = 0
for i in range(4):
if R == 0:
break
elif R >= PS[i][1]:
ans += int(PS[i][0] * PS[i][1] // 2 * (R // PS[i][1]))
R = R % PS[i... | Q, H, S, D = list(map(int, input().split()))
N = int(eval(input()))
ans = (N // 2) * min(8 * Q, 4 * H, S * 2, D) + (N % 2) * min(4 * Q, 2 * H, S)
print(ans)
| false | 66.666667 | [
"-PS = [[Q * 8, 0.25], [H * 4, 0.5], [S * 2, 1], [D, 2]]",
"-PS.sort(key=lambda x: x[0])",
"-R = N",
"-ans = 0",
"-for i in range(4):",
"- if R == 0:",
"- break",
"- elif R >= PS[i][1]:",
"- ans += int(PS[i][0] * PS[i][1] // 2 * (R // PS[i][1]))",
"- R = R % PS[i][1]",
... | false | 0.064524 | 0.062485 | 1.032623 | [
"s524328499",
"s907937154"
] |
u098012509 | p02698 | python | s389482626 | s478685034 | 760 | 659 | 207,328 | 186,124 | Accepted | Accepted | 13.29 | import sys
import bisect
import collections
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = [int(x) for x in input().split()]
UV = [[int(x) for x in input().split()] for _ in range(N - 1)]
T = [[] for j in range(N + 1)]
for u, v ... | import sys
import bisect
import collections
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = [int(x) for x in input().split()]
UV = [[int(x) for x in input().split()] for _ in range(N - 1)]
T = [[] for j in range(N + 1)]
for u, v ... | 73 | 70 | 1,570 | 1,536 | import sys
import bisect
import collections
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = [int(x) for x in input().split()]
UV = [[int(x) for x in input().split()] for _ in range(N - 1)]
T = [[] for j in range(N + 1)]
for u, v in UV:
T[u].a... | import sys
import bisect
import collections
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = [int(x) for x in input().split()]
UV = [[int(x) for x in input().split()] for _ in range(N - 1)]
T = [[] for j in range(N + 1)]
for u, v in UV:
T[u].a... | false | 4.109589 | [
"- v = set()",
"- if ci not in v:",
"+ if ans[ci] == 0:",
"- v.add(ci)",
"- if n in v:",
"+ if ans[n] != 0:"
] | false | 0.065182 | 0.036572 | 1.782303 | [
"s389482626",
"s478685034"
] |
u838261804 | p03208 | python | s499141203 | s775157098 | 755 | 192 | 8,964 | 10,228 | Accepted | Accepted | 74.57 | s=input().split(' ')
n=int(s[0])
k=int(s[1])
ar=[]
for i in range(0,n):
j=int(eval(input()))
ar.append(j)
ar.sort()
i=0; j=k-1;
mn=100000000000
while j<n:
if ar[j]-ar[i]<mn:
mn=ar[j]-ar[i]
j+=1; i+=1;
print(mn); |
s=input().split();
n=int(s[0])
k=int(s[1])
lt=[]*n;
for i in range(0,n):
a=int(input())
lt.append(a)
lt.sort()
mx=1000000000000000
i=0; j=k-1;
while j<n:
l=lt[j]-lt[i]
j+=1;
i+=1;
if l<mx:
mx=l;
print(mx) | 17 | 19 | 233 | 240 | s = input().split(" ")
n = int(s[0])
k = int(s[1])
ar = []
for i in range(0, n):
j = int(eval(input()))
ar.append(j)
ar.sort()
i = 0
j = k - 1
mn = 100000000000
while j < n:
if ar[j] - ar[i] < mn:
mn = ar[j] - ar[i]
j += 1
i += 1
print(mn)
| s = input().split()
n = int(s[0])
k = int(s[1])
lt = [] * n
for i in range(0, n):
a = int(input())
lt.append(a)
lt.sort()
mx = 1000000000000000
i = 0
j = k - 1
while j < n:
l = lt[j] - lt[i]
j += 1
i += 1
if l < mx:
mx = l
print(mx)
| false | 10.526316 | [
"-s = input().split(\" \")",
"+s = input().split()",
"-ar = []",
"+lt = [] * n",
"- j = int(eval(input()))",
"- ar.append(j)",
"-ar.sort()",
"+ a = int(input())",
"+ lt.append(a)",
"+lt.sort()",
"+mx = 1000000000000000",
"-mn = 100000000000",
"- if ar[j] - ar[i] < mn:",
"- ... | false | 0.037478 | 0.061931 | 0.605156 | [
"s499141203",
"s775157098"
] |
u802963389 | p03998 | python | s594435764 | s347287840 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | from collections import deque
a = deque(list(eval(input())))
b = deque(list(eval(input())))
c = deque(list(eval(input())))
card = a.popleft()
while True:
if card == "a":
if not a:
print("A")
exit()
else:
card = a.popleft()
elif card == "b":
if not b:
print("B")
... | S = {x : list(eval(input())) for x in "abc"}
s = "a"
while(S[s]):
s = S[s].pop(0)
print((s.upper())) | 27 | 7 | 461 | 103 | from collections import deque
a = deque(list(eval(input())))
b = deque(list(eval(input())))
c = deque(list(eval(input())))
card = a.popleft()
while True:
if card == "a":
if not a:
print("A")
exit()
else:
card = a.popleft()
elif card == "b":
if not b:
... | S = {x: list(eval(input())) for x in "abc"}
s = "a"
while S[s]:
s = S[s].pop(0)
print((s.upper()))
| false | 74.074074 | [
"-from collections import deque",
"-",
"-a = deque(list(eval(input())))",
"-b = deque(list(eval(input())))",
"-c = deque(list(eval(input())))",
"-card = a.popleft()",
"-while True:",
"- if card == \"a\":",
"- if not a:",
"- print(\"A\")",
"- exit()",
"- e... | false | 0.047913 | 0.048874 | 0.980339 | [
"s594435764",
"s347287840"
] |
u692453235 | p02608 | python | s319083697 | s170038964 | 518 | 106 | 9,556 | 74,556 | Accepted | Accepted | 79.54 | N = int(eval(input()))
ans = [0]*(N)
if N <= 3:
for i in range(N):
print((0))
exit()
M = int((N-2)**0.5)
for x in range(1, M+1):
for y in range(1, M+1):
for z in range(1, M+1):
a = (x+y+z)**2 - (x*y + y*z + z*x)
if a <= N:
ans[a-1] += 1
for i in range(N):
print... | N = int(eval(input()))
ans = [0]*(N)
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
a = (x+y+z)**2 - (x*y + y*z + z*x)
if a <= N:
ans[a-1] += 1
for x in ans:
print(x) | 19 | 12 | 320 | 227 | N = int(eval(input()))
ans = [0] * (N)
if N <= 3:
for i in range(N):
print((0))
exit()
M = int((N - 2) ** 0.5)
for x in range(1, M + 1):
for y in range(1, M + 1):
for z in range(1, M + 1):
a = (x + y + z) ** 2 - (x * y + y * z + z * x)
if a <= N:
ans[a... | N = int(eval(input()))
ans = [0] * (N)
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
a = (x + y + z) ** 2 - (x * y + y * z + z * x)
if a <= N:
ans[a - 1] += 1
for x in ans:
print(x)
| false | 36.842105 | [
"-if N <= 3:",
"- for i in range(N):",
"- print((0))",
"- exit()",
"-M = int((N - 2) ** 0.5)",
"-for x in range(1, M + 1):",
"- for y in range(1, M + 1):",
"- for z in range(1, M + 1):",
"+for x in range(1, 101):",
"+ for y in range(1, 101):",
"+ for z in range(1... | false | 0.039212 | 1.068029 | 0.036714 | [
"s319083697",
"s170038964"
] |
u821624310 | p02396 | python | s351695864 | s046487486 | 130 | 120 | 7,356 | 7,336 | Accepted | Accepted | 7.69 | i = 1
x = eval(input())
while x != "0":
print(("Case %d: %s" % (i, x)))
i += 1
x = eval(input())
| m = 1
n = "1"
while n != "0":
n = eval(input())
if n != "0":
print(("Case " + str(m) + ": " + n))
else:
break
m += 1 | 7 | 9 | 105 | 148 | i = 1
x = eval(input())
while x != "0":
print(("Case %d: %s" % (i, x)))
i += 1
x = eval(input())
| m = 1
n = "1"
while n != "0":
n = eval(input())
if n != "0":
print(("Case " + str(m) + ": " + n))
else:
break
m += 1
| false | 22.222222 | [
"-i = 1",
"-x = eval(input())",
"-while x != \"0\":",
"- print((\"Case %d: %s\" % (i, x)))",
"- i += 1",
"- x = eval(input())",
"+m = 1",
"+n = \"1\"",
"+while n != \"0\":",
"+ n = eval(input())",
"+ if n != \"0\":",
"+ print((\"Case \" + str(m) + \": \" + n))",
"+ e... | false | 0.035111 | 0.086905 | 0.404013 | [
"s351695864",
"s046487486"
] |
u729133443 | p03680 | python | s176366121 | s409502496 | 287 | 68 | 60,508 | 7,060 | Accepted | Accepted | 76.31 | n,*a=list(map(int,open(0).readlines()));c,s=1,a[0]
while s!=2and c<n:c+=1;s=a[s-1]
print((c*(c<n)or-1)) | n,*a=list(map(int,open(0)));c,s=1,a[0]
while s!=2and c<n:c+=1;s=a[s-1]
print((c*(c<n)or-1)) | 3 | 3 | 97 | 85 | n, *a = list(map(int, open(0).readlines()))
c, s = 1, a[0]
while s != 2 and c < n:
c += 1
s = a[s - 1]
print((c * (c < n) or -1))
| n, *a = list(map(int, open(0)))
c, s = 1, a[0]
while s != 2 and c < n:
c += 1
s = a[s - 1]
print((c * (c < n) or -1))
| false | 0 | [
"-n, *a = list(map(int, open(0).readlines()))",
"+n, *a = list(map(int, open(0)))"
] | false | 0.045668 | 0.038774 | 1.177813 | [
"s176366121",
"s409502496"
] |
u661647607 | p03478 | python | s577492890 | s209653600 | 39 | 29 | 3,064 | 3,060 | Accepted | Accepted | 25.64 | N, A, B = list(map(int, input().split()))
ans = 0
for i in range(1,N+1):
i_str = str(i)
i_len = len(i_str)
sum = 0
for j in range(i_len):
sum += int(i_str[j])
if sum >= A and sum <= B:
ans += i
print(ans) | #定石の商と剰余でやってみた
N, A, B = list(map(int, input().split()))
ans = 0
for i in range(1,N+1):
n = i
sum = 0
while n > 0:
sum += n % 10
n = n // 10
if sum >= A and sum <= B:
ans += i
print(ans) | 13 | 15 | 234 | 221 | N, A, B = list(map(int, input().split()))
ans = 0
for i in range(1, N + 1):
i_str = str(i)
i_len = len(i_str)
sum = 0
for j in range(i_len):
sum += int(i_str[j])
if sum >= A and sum <= B:
ans += i
print(ans)
| # 定石の商と剰余でやってみた
N, A, B = list(map(int, input().split()))
ans = 0
for i in range(1, N + 1):
n = i
sum = 0
while n > 0:
sum += n % 10
n = n // 10
if sum >= A and sum <= B:
ans += i
print(ans)
| false | 13.333333 | [
"+# 定石の商と剰余でやってみた",
"- i_str = str(i)",
"- i_len = len(i_str)",
"+ n = i",
"- for j in range(i_len):",
"- sum += int(i_str[j])",
"+ while n > 0:",
"+ sum += n % 10",
"+ n = n // 10"
] | false | 0.046233 | 0.140909 | 0.328103 | [
"s577492890",
"s209653600"
] |
u535423069 | p03261 | python | s149030429 | s083682391 | 20 | 18 | 3,316 | 3,064 | Accepted | Accepted | 10 | import sys
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl =... | import sys
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range... | 30 | 34 | 678 | 885 | import sys
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [lis... | import sys
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdi... | false | 11.764706 | [
"+nf = lambda: float(ns())",
"+nfn = lambda y: [nf() for _ in range(y)]",
"+nfa = lambda: list(map(float, stdin.readline().split()))",
"+nfan = lambda y: [nfa() for _ in range(y)]",
"-from collections import defaultdict",
"-",
"-N = ni()",
"-W = nsn(N)",
"-d = defaultdict(int)",
"+n = ni()",
"+w... | false | 0.172658 | 0.109393 | 1.578319 | [
"s149030429",
"s083682391"
] |
u588081069 | p03845 | python | s916638626 | s929967746 | 23 | 18 | 3,444 | 2,940 | Accepted | Accepted | 21.74 | import copy
N = int(eval(input()))
T = list(map(int, input().split()))
M = int(eval(input()))
for i in range(M):
T_Copy = copy.copy(T)
P, X = list(map(int, input().split()))
T_Copy[P-1] = X
print((sum(T_Copy)))
| N = int(eval(input()))
T = list(map(int, input().split()))
M = int(eval(input()))
T_sum = sum(T)
for i in range(M):
P, X = list(map(int, input().split()))
print((T_sum - T[P - 1] + X))
| 11 | 8 | 225 | 187 | import copy
N = int(eval(input()))
T = list(map(int, input().split()))
M = int(eval(input()))
for i in range(M):
T_Copy = copy.copy(T)
P, X = list(map(int, input().split()))
T_Copy[P - 1] = X
print((sum(T_Copy)))
| N = int(eval(input()))
T = list(map(int, input().split()))
M = int(eval(input()))
T_sum = sum(T)
for i in range(M):
P, X = list(map(int, input().split()))
print((T_sum - T[P - 1] + X))
| false | 27.272727 | [
"-import copy",
"-",
"+T_sum = sum(T)",
"- T_Copy = copy.copy(T)",
"- T_Copy[P - 1] = X",
"- print((sum(T_Copy)))",
"+ print((T_sum - T[P - 1] + X))"
] | false | 0.047654 | 0.046775 | 1.018773 | [
"s916638626",
"s929967746"
] |
u047796752 | p03165 | python | s723345283 | s979911312 | 450 | 296 | 112,220 | 144,252 | Accepted | Accepted | 34.22 | import sys
input = sys.stdin.readline
s = input()[:-1]
t = input()[:-1]
dp = [[0]*(len(t)+1) for _ in range(len(s)+1)]
for i in range(len(s)):
for j in range(len(t)):
if s[i]==t[j]:
dp[i+1][j+1] = dp[i][j]+1
else:
if dp[i+1][j]>dp[i][j+1]:
dp[i+... | import sys
input = sys.stdin.readline
s = input()[:-1]
t = input()[:-1]
dp = [[0]*(len(t)+1) for _ in range(len(s)+1)]
for i in range(1, len(s)+1):
for j in range(1, len(t)+1):
if s[i-1]==t[j-1]:
dp[i][j] = dp[i-1][j-1]+1
else:
dp[i][j] = max(dp[i-1][j], dp[i][j... | 33 | 30 | 696 | 608 | import sys
input = sys.stdin.readline
s = input()[:-1]
t = input()[:-1]
dp = [[0] * (len(t) + 1) for _ in range(len(s) + 1)]
for i in range(len(s)):
for j in range(len(t)):
if s[i] == t[j]:
dp[i + 1][j + 1] = dp[i][j] + 1
else:
if dp[i + 1][j] > dp[i][j + 1]:
... | import sys
input = sys.stdin.readline
s = input()[:-1]
t = input()[:-1]
dp = [[0] * (len(t) + 1) for _ in range(len(s) + 1)]
for i in range(1, len(s) + 1):
for j in range(1, len(t) + 1):
if s[i - 1] == t[j - 1]:
dp[i][j] = dp[i - 1][j - 1] + 1
else:
dp[i][j] = max(dp[i - 1][... | false | 9.090909 | [
"-for i in range(len(s)):",
"- for j in range(len(t)):",
"- if s[i] == t[j]:",
"- dp[i + 1][j + 1] = dp[i][j] + 1",
"+for i in range(1, len(s) + 1):",
"+ for j in range(1, len(t) + 1):",
"+ if s[i - 1] == t[j - 1]:",
"+ dp[i][j] = dp[i - 1][j - 1] + 1",
"- ... | false | 0.034626 | 0.101429 | 0.341379 | [
"s723345283",
"s979911312"
] |
u102461423 | p02975 | python | s564582906 | s417599038 | 61 | 52 | 15,624 | 12,980 | Accepted | Accepted | 14.75 | import sys
input = sys.stdin.readline
from collections import Counter
N = int(eval(input()))
c = Counter((int(x) for x in input().split()))
# 0がある場合
# 0,x,x,0,x,x
# あるいは
# 0,0,0,0 (any length is ok)
if c[0] > 0:
if len(c) == 1:
bl = True
else:
if len(c) > 2:
bl ... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
"""
・a,b,a+b,a,b,a+b,...
・0,a,a,0,a,a,...
・0,0,0,0,0,0,...
"""
N,*A = list(map(int,read().split()))
def solve(N,A):
if all(x == 0 for x in A):
return True
q,r = divmod(N... | 39 | 43 | 736 | 923 | import sys
input = sys.stdin.readline
from collections import Counter
N = int(eval(input()))
c = Counter((int(x) for x in input().split()))
# 0がある場合
# 0,x,x,0,x,x
# あるいは
# 0,0,0,0 (any length is ok)
if c[0] > 0:
if len(c) == 1:
bl = True
else:
if len(c) > 2:
bl = False
else... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
"""
・a,b,a+b,a,b,a+b,...
・0,a,a,0,a,a,...
・0,0,0,0,0,0,...
"""
N, *A = list(map(int, read().split()))
def solve(N, A):
if all(x == 0 for x in A):
return True
q, r = divmod(N, 3)
if ... | false | 9.302326 | [
"-input = sys.stdin.readline",
"-from collections import Counter",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"+\"\"\"",
"+・a,b,a+b,a,b,a+b,...",
"+・0,a,a,0,a,a,...",
"+・0,0,0,0,0,0,...",
"+\"\"\"",
"+N, *A = list(map(int,... | false | 0.047532 | 0.047004 | 1.011239 | [
"s564582906",
"s417599038"
] |
u440566786 | p02788 | python | s298933556 | s835710155 | 1,795 | 1,466 | 142,644 | 70,056 | Accepted | Accepted | 18.33 | import sys
sys.setrecursionlimit(2147483647)
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
input = lambda:sys.stdin.readline().rstrip()
class LazySegmentTree(object):
def __init__(self, A, dot, unit, compose, identity, act):
# A : array of monoid (M, dot, unit)
# (S, compose, identity) : sub m... | import sys
sys.setrecursionlimit(2147483647)
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
input = lambda:sys.stdin.readline().rstrip()
class SegmentTree(object):
def __init__(self, A, dot, unit):
n = 1 << (len(A) - 1).bit_length()
tree = [unit] * (2 * n)
for i, v in enumerate(A):
... | 107 | 74 | 3,776 | 1,959 | import sys
sys.setrecursionlimit(2147483647)
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
input = lambda: sys.stdin.readline().rstrip()
class LazySegmentTree(object):
def __init__(self, A, dot, unit, compose, identity, act):
# A : array of monoid (M, dot, unit)
# (S, compose, identity) : sub monoid... | import sys
sys.setrecursionlimit(2147483647)
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
input = lambda: sys.stdin.readline().rstrip()
class SegmentTree(object):
def __init__(self, A, dot, unit):
n = 1 << (len(A) - 1).bit_length()
tree = [unit] * (2 * n)
for i, v in enumerate(A):
... | false | 30.841121 | [
"-class LazySegmentTree(object):",
"- def __init__(self, A, dot, unit, compose, identity, act):",
"- # A : array of monoid (M, dot, unit)",
"- # (S, compose, identity) : sub monoid of End(M)",
"- # compose : (f, g) -> fg (f, g in S)",
"- # act : (f, x) -> f(x) (f in S, x in ... | false | 0.04761 | 0.047387 | 1.004691 | [
"s298933556",
"s835710155"
] |
u519939795 | p02772 | python | s712550159 | s646239617 | 19 | 17 | 3,060 | 3,060 | Accepted | Accepted | 10.53 | N = int(eval(input()))
AA = list(map(int,input().split()))
ans = 'APPROVED'
for a in AA:
if a % 2 == 0:
if a % 3 != 0 and a % 5 != 0:
ans = 'DENIED'
break
print(ans) | import sys
n=int(eval(input()))
a=list(map(int,input().split()))
for i in range(len(a)):
if a[i]%2==0:
if a[i]%3!=0 and a[i]%5!=0:
print('DENIED')
sys.exit()
print('APPROVED') | 12 | 9 | 221 | 213 | N = int(eval(input()))
AA = list(map(int, input().split()))
ans = "APPROVED"
for a in AA:
if a % 2 == 0:
if a % 3 != 0 and a % 5 != 0:
ans = "DENIED"
break
print(ans)
| import sys
n = int(eval(input()))
a = list(map(int, input().split()))
for i in range(len(a)):
if a[i] % 2 == 0:
if a[i] % 3 != 0 and a[i] % 5 != 0:
print("DENIED")
sys.exit()
print("APPROVED")
| false | 25 | [
"-N = int(eval(input()))",
"-AA = list(map(int, input().split()))",
"-ans = \"APPROVED\"",
"-for a in AA:",
"- if a % 2 == 0:",
"- if a % 3 != 0 and a % 5 != 0:",
"- ans = \"DENIED\"",
"- break",
"-print(ans)",
"+import sys",
"+",
"+n = int(eval(input()))",
"+... | false | 0.008601 | 0.045095 | 0.190733 | [
"s712550159",
"s646239617"
] |
u305366205 | p03196 | python | s129401076 | s660810905 | 337 | 310 | 10,868 | 3,060 | Accepted | Accepted | 8.01 | import math
n, p = list(map(int, input().split()))
cnt = [0] * math.ceil(math.sqrt(p))
tmp = p
for i in range(2, math.ceil(math.sqrt(p))):
while p % i == 0 and p != 0:
p //= i
cnt[i] += 1
ans = 1
for i in range(2, math.ceil(math.sqrt(tmp))):
ans *= i ** (cnt[i] // n)
ans *= p ** (1 //... | import math
n, p = list(map(int, input().split()))
ans = 1
for i in range(2, math.ceil(math.sqrt(p))):
cnt = 0
while p % i == 0 and p != 0:
p //= i
cnt += 1
ans *= i ** (cnt // n)
ans *= p ** (1 // n)
print(ans) | 13 | 11 | 329 | 243 | import math
n, p = list(map(int, input().split()))
cnt = [0] * math.ceil(math.sqrt(p))
tmp = p
for i in range(2, math.ceil(math.sqrt(p))):
while p % i == 0 and p != 0:
p //= i
cnt[i] += 1
ans = 1
for i in range(2, math.ceil(math.sqrt(tmp))):
ans *= i ** (cnt[i] // n)
ans *= p ** (1 // n)
print(... | import math
n, p = list(map(int, input().split()))
ans = 1
for i in range(2, math.ceil(math.sqrt(p))):
cnt = 0
while p % i == 0 and p != 0:
p //= i
cnt += 1
ans *= i ** (cnt // n)
ans *= p ** (1 // n)
print(ans)
| false | 15.384615 | [
"-cnt = [0] * math.ceil(math.sqrt(p))",
"-tmp = p",
"+ans = 1",
"+ cnt = 0",
"- cnt[i] += 1",
"-ans = 1",
"-for i in range(2, math.ceil(math.sqrt(tmp))):",
"- ans *= i ** (cnt[i] // n)",
"+ cnt += 1",
"+ ans *= i ** (cnt // n)"
] | false | 0.041072 | 0.041533 | 0.988902 | [
"s129401076",
"s660810905"
] |
u150984829 | p02235 | python | s147379401 | s765070907 | 2,400 | 1,310 | 5,652 | 5,624 | Accepted | Accepted | 45.42 | e=input
a=[]
for _ in[0]*int(e()):
X,z=e(),[]
for y in e():
s=i=0
for k in z:
t=X.find(y,s)+1
if t<1:break
if t<k:z[i]=t
s=k;i+=1
else:
t=X.find(y,s)+1
if t:z+=[t]
a+=[z]
print(*map(len,a),sep='\n')
| def m():
e=input
a=''
for _ in[0]*int(e()):
X,z=e(),[]
for y in e():
s=i=0
for k in z:
t=X.find(y,s)+1
if t<1:break
if t<k:z[i]=t
s=k;i+=1
else:
t=X.find(y,s)+1
if t:z+=[t]
a+=f'\n{len(z)}'
print((a[1:]))
if'__main__'==__name__:m()
| 16 | 18 | 241 | 290 | e = input
a = []
for _ in [0] * int(e()):
X, z = e(), []
for y in e():
s = i = 0
for k in z:
t = X.find(y, s) + 1
if t < 1:
break
if t < k:
z[i] = t
s = k
i += 1
else:
t = X.find(y, s)... | def m():
e = input
a = ""
for _ in [0] * int(e()):
X, z = e(), []
for y in e():
s = i = 0
for k in z:
t = X.find(y, s) + 1
if t < 1:
break
if t < k:
z[i] = t
s = k
... | false | 11.111111 | [
"-e = input",
"-a = []",
"-for _ in [0] * int(e()):",
"- X, z = e(), []",
"- for y in e():",
"- s = i = 0",
"- for k in z:",
"- t = X.find(y, s) + 1",
"- if t < 1:",
"- break",
"- if t < k:",
"- z[i] = t",
"- ... | false | 0.08237 | 0.035863 | 2.296785 | [
"s147379401",
"s765070907"
] |
u225388820 | p02694 | python | s999313072 | s769280122 | 22 | 19 | 9,168 | 9,152 | Accepted | Accepted | 13.64 | x=int(eval(input()))
n=100
cnt=0
while n<x:
cnt+=1
n*=101
n//=100
print(cnt) | x=int(eval(input()))
n=100
cnt=0
while n<x:
cnt+=1
n+=n//100
print(cnt)
| 8 | 7 | 89 | 80 | x = int(eval(input()))
n = 100
cnt = 0
while n < x:
cnt += 1
n *= 101
n //= 100
print(cnt)
| x = int(eval(input()))
n = 100
cnt = 0
while n < x:
cnt += 1
n += n // 100
print(cnt)
| false | 12.5 | [
"- n *= 101",
"- n //= 100",
"+ n += n // 100"
] | false | 0.036984 | 0.131516 | 0.281214 | [
"s999313072",
"s769280122"
] |
u558242240 | p02631 | python | s351808006 | s806713252 | 674 | 146 | 148,412 | 41,676 | Accepted | Accepted | 78.34 | n = int(eval(input()))
a = list(map(int , input().split()))
b = []
for ai in a:
b.append('{:0=30b}'.format(ai))
cnt = []
for j in range(30):
tmp = 0
for i in range(n):
tmp += int(b[i][j])
cnt.append(tmp)
ans = []
for bi in b:
tmp = 0
for i in range(30):
idx = 29 ... | n = int(eval(input()))
a = list(map(int , input().split()))
b = []
s = 0
for ai in a:
s ^= ai
ans = []
for ai in a:
ans.append(s ^ ai)
print((' '.join(map(str, ans))))
| 43 | 12 | 722 | 181 | n = int(eval(input()))
a = list(map(int, input().split()))
b = []
for ai in a:
b.append("{:0=30b}".format(ai))
cnt = []
for j in range(30):
tmp = 0
for i in range(n):
tmp += int(b[i][j])
cnt.append(tmp)
ans = []
for bi in b:
tmp = 0
for i in range(30):
idx = 29 + (-i)
# p... | n = int(eval(input()))
a = list(map(int, input().split()))
b = []
s = 0
for ai in a:
s ^= ai
ans = []
for ai in a:
ans.append(s ^ ai)
print((" ".join(map(str, ans))))
| false | 72.093023 | [
"+s = 0",
"- b.append(\"{:0=30b}\".format(ai))",
"-cnt = []",
"-for j in range(30):",
"- tmp = 0",
"- for i in range(n):",
"- tmp += int(b[i][j])",
"- cnt.append(tmp)",
"+ s ^= ai",
"-for bi in b:",
"- tmp = 0",
"- for i in range(30):",
"- idx = 29 + (-i)",... | false | 0.063458 | 0.03682 | 1.723479 | [
"s351808006",
"s806713252"
] |
u123745130 | p03774 | python | s415553792 | s678127398 | 27 | 23 | 9,108 | 9,156 | Accepted | Accepted | 14.81 | n,m=list(map(int,input().split()))
l_n=[list(map(int,input().split())) for _ in range(n)]
l_m=[list(map(int,input().split())) for _ in range(m)]
# print(l_n,l_m)
for i,j in l_n:
distance=0
cnt = 0
ans = float ( "inf" )
for k,l in enumerate(l_m):
a,b=l
distance=abs(i-a)+abs(... | n,m=list(map(int,input().split()))
l_n=[list(map(int,input().split())) for _ in range(n)]
l_m=[list(map(int,input().split())) for _ in range(m)]
# print(l_n,l_m)
for i,j in l_n:
distance=0
cnt = 0
ans = float ( "inf" )
for k,l in enumerate(l_m,1):
a,b=l
distance=abs(i-a)+ab... | 17 | 17 | 417 | 417 | n, m = list(map(int, input().split()))
l_n = [list(map(int, input().split())) for _ in range(n)]
l_m = [list(map(int, input().split())) for _ in range(m)]
# print(l_n,l_m)
for i, j in l_n:
distance = 0
cnt = 0
ans = float("inf")
for k, l in enumerate(l_m):
a, b = l
distance = abs(i - a) ... | n, m = list(map(int, input().split()))
l_n = [list(map(int, input().split())) for _ in range(n)]
l_m = [list(map(int, input().split())) for _ in range(m)]
# print(l_n,l_m)
for i, j in l_n:
distance = 0
cnt = 0
ans = float("inf")
for k, l in enumerate(l_m, 1):
a, b = l
distance = abs(i - ... | false | 0 | [
"- for k, l in enumerate(l_m):",
"+ for k, l in enumerate(l_m, 1):",
"- cnt = k + 1",
"+ cnt = k"
] | false | 0.039065 | 0.041739 | 0.935952 | [
"s415553792",
"s678127398"
] |
u580697892 | p02702 | python | s989379277 | s306223930 | 457 | 116 | 16,716 | 9,344 | Accepted | Accepted | 74.62 | # coding: utf-8
S = eval(input())
ans = 0
P = 2019
N = len(S)
S = S[::-1]
dp = [0 for _ in range(N)]
d = {}
for i in range(N):
dp[i] = int(S[i]) * pow(10, i, P) % P
for i in range(N-1):
dp[i+1] += dp[i]
dp[i+1] %= P
dp[-1] %= P
for i in range(N):
if dp[i] not in d:
if dp[i] == 0:... | # coding: utf-8
S = eval(input())
ans = 0
P = 2019
N = len(S)
S = S[::-1]
cnt = [0 for _ in range(P)]
cnt[0] = 1
v = 0
bai = 1
for i in range(N):
v = (v + int(S[i]) * bai) % P
bai *= 10
bai %= P
cnt[v] += 1
for i in range(P):
ans += ((cnt[i] - 1) * cnt[i]) // 2
print(ans) | 25 | 18 | 475 | 303 | # coding: utf-8
S = eval(input())
ans = 0
P = 2019
N = len(S)
S = S[::-1]
dp = [0 for _ in range(N)]
d = {}
for i in range(N):
dp[i] = int(S[i]) * pow(10, i, P) % P
for i in range(N - 1):
dp[i + 1] += dp[i]
dp[i + 1] %= P
dp[-1] %= P
for i in range(N):
if dp[i] not in d:
if dp[i] == 0:
... | # coding: utf-8
S = eval(input())
ans = 0
P = 2019
N = len(S)
S = S[::-1]
cnt = [0 for _ in range(P)]
cnt[0] = 1
v = 0
bai = 1
for i in range(N):
v = (v + int(S[i]) * bai) % P
bai *= 10
bai %= P
cnt[v] += 1
for i in range(P):
ans += ((cnt[i] - 1) * cnt[i]) // 2
print(ans)
| false | 28 | [
"-dp = [0 for _ in range(N)]",
"-d = {}",
"+cnt = [0 for _ in range(P)]",
"+cnt[0] = 1",
"+v = 0",
"+bai = 1",
"- dp[i] = int(S[i]) * pow(10, i, P) % P",
"-for i in range(N - 1):",
"- dp[i + 1] += dp[i]",
"- dp[i + 1] %= P",
"-dp[-1] %= P",
"-for i in range(N):",
"- if dp[i] not ... | false | 0.036429 | 0.035564 | 1.024333 | [
"s989379277",
"s306223930"
] |
u912237403 | p00161 | python | s606142038 | s920513580 | 70 | 60 | 4,984 | 4,724 | Accepted | Accepted | 14.29 | while 1:
n = eval(input())
if n==0: break
D = [0]*n
for j in range(n):
a,b,c,d,e,f,g,h,i = list(map(int, input().split()))
D[j] = [(b+d+f+h)*60 + c+e+g+i, a]
D = sorted(D)
print(D[0][1])
print(D[1][1])
print(D[-2][1]) | while 1:
n = eval(input())
if n==0: break
D = {}
for j in range(n):
a,b,c,d,e,f,g,h,i = list(map(int, input().split()))
D[(b+d+f+h)*60 + c+e+g+i] = a
A = sorted(D)
for i in [0,1,-2]: print(D[A[i]]) | 11 | 9 | 240 | 216 | while 1:
n = eval(input())
if n == 0:
break
D = [0] * n
for j in range(n):
a, b, c, d, e, f, g, h, i = list(map(int, input().split()))
D[j] = [(b + d + f + h) * 60 + c + e + g + i, a]
D = sorted(D)
print(D[0][1])
print(D[1][1])
print(D[-2][1])
| while 1:
n = eval(input())
if n == 0:
break
D = {}
for j in range(n):
a, b, c, d, e, f, g, h, i = list(map(int, input().split()))
D[(b + d + f + h) * 60 + c + e + g + i] = a
A = sorted(D)
for i in [0, 1, -2]:
print(D[A[i]])
| false | 18.181818 | [
"- D = [0] * n",
"+ D = {}",
"- D[j] = [(b + d + f + h) * 60 + c + e + g + i, a]",
"- D = sorted(D)",
"- print(D[0][1])",
"- print(D[1][1])",
"- print(D[-2][1])",
"+ D[(b + d + f + h) * 60 + c + e + g + i] = a",
"+ A = sorted(D)",
"+ for i in [0, 1, -2]:",
"... | false | 0.042766 | 0.040594 | 1.053514 | [
"s606142038",
"s920513580"
] |
u102461423 | p02653 | python | s608862762 | s212460923 | 1,269 | 1,023 | 417,416 | 417,348 | Accepted | Accepted | 19.39 | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9 + 7
N, A, B = list(map(int, read().split()))
def solve(N, A, B):
if A > B:
A, B = B, A
if A == 1:
return pow(2, N, MOD)
dp1 =... | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9 + 7
N, A, B = list(map(int, read().split()))
def solve(N, A, B):
if A > B:
A, B = B, A
if A == 1:
return pow(2, N, MOD)
dp1 =... | 54 | 52 | 1,513 | 1,467 | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9 + 7
N, A, B = list(map(int, read().split()))
def solve(N, A, B):
if A > B:
A, B = B, A
if A == 1:
return pow(2, N, MOD)
dp1 = np.zeros((N, B),... | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9 + 7
N, A, B = list(map(int, read().split()))
def solve(N, A, B):
if A > B:
A, B = B, A
if A == 1:
return pow(2, N, MOD)
dp1 = np.zeros((N, B),... | false | 3.703704 | [
"- ans %= MOD",
"- dp1[n] %= MOD"
] | false | 0.444962 | 0.260612 | 1.707372 | [
"s608862762",
"s212460923"
] |
u342563578 | p02573 | python | s872065377 | s786477719 | 1,367 | 641 | 276,152 | 97,548 | Accepted | Accepted | 53.11 | n,m = list(map(int,input().split()))
import sys
sys.setrecursionlimit(10**9)
rks = [None] *n
p = [set([]) for i in range(n)]
flist = [[] for i in range(n)]
for i in range(m):
a,b = list(map(int,input().split()))
flist[a-1].append(b-1)
flist[b-1].append(a-1)
def dfs(graph,w,c):
if rks[w] is No... | n,m = list(map(int,input().split()))
par = []
for i in range(n):
par.append(i) #初期親
rank = [1 for i in range(n)] #初期ランク
cut = []
def find(n): #親検索andランク短縮
global cut
if par[n] == n:
for i in range(len(cut)):
par[cut[i]] = n
cut = []
return n
else:
... | 27 | 53 | 658 | 1,157 | n, m = list(map(int, input().split()))
import sys
sys.setrecursionlimit(10**9)
rks = [None] * n
p = [set([]) for i in range(n)]
flist = [[] for i in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
flist[a - 1].append(b - 1)
flist[b - 1].append(a - 1)
def dfs(graph, w, c):
if rks[w... | n, m = list(map(int, input().split()))
par = []
for i in range(n):
par.append(i) # 初期親
rank = [1 for i in range(n)] # 初期ランク
cut = []
def find(n): # 親検索andランク短縮
global cut
if par[n] == n:
for i in range(len(cut)):
par[cut[i]] = n
cut = []
return n
else:
cu... | false | 49.056604 | [
"-import sys",
"+par = []",
"+for i in range(n):",
"+ par.append(i) # 初期親",
"+rank = [1 for i in range(n)] # 初期ランク",
"+cut = []",
"-sys.setrecursionlimit(10**9)",
"-rks = [None] * n",
"-p = [set([]) for i in range(n)]",
"-flist = [[] for i in range(n)]",
"+",
"+def find(n): # 親検索andランク短縮... | false | 0.053177 | 0.038489 | 1.381642 | [
"s872065377",
"s786477719"
] |
u505420467 | p03486 | python | s196547672 | s968298974 | 19 | 17 | 3,064 | 2,940 | Accepted | Accepted | 10.53 | s=list(eval(input()))
t=list(eval(input()))
s.sort()
t.sort(reverse=True)
print(("YNeos"[s>=t::2]))
| if __name__ == '__main__':
s = list(eval(input()))
t = list(eval(input()))
s.sort()
t.sort(reverse=True)
if s < t:
print("Yes")
else:
print("No")
| 5 | 9 | 90 | 182 | s = list(eval(input()))
t = list(eval(input()))
s.sort()
t.sort(reverse=True)
print(("YNeos"[s >= t :: 2]))
| if __name__ == "__main__":
s = list(eval(input()))
t = list(eval(input()))
s.sort()
t.sort(reverse=True)
if s < t:
print("Yes")
else:
print("No")
| false | 44.444444 | [
"-s = list(eval(input()))",
"-t = list(eval(input()))",
"-s.sort()",
"-t.sort(reverse=True)",
"-print((\"YNeos\"[s >= t :: 2]))",
"+if __name__ == \"__main__\":",
"+ s = list(eval(input()))",
"+ t = list(eval(input()))",
"+ s.sort()",
"+ t.sort(reverse=True)",
"+ if s < t:",
"+ ... | false | 0.076638 | 0.039727 | 1.929134 | [
"s196547672",
"s968298974"
] |
u581187895 | p03086 | python | s901200613 | s605797689 | 19 | 17 | 3,188 | 2,940 | Accepted | Accepted | 10.53 | import re
ans = list(map(len, re.findall("[ACGT]*", eval(input()))))
print((max(ans))) | S = eval(input())
ans = 0
for i in range(len(S)):
for j in range(i, len(S)):
T = S[i:j+1]
if set(T) <= set("ACGT"):
ans = max(ans, j-i+1)
print(ans) | 3 | 9 | 74 | 173 | import re
ans = list(map(len, re.findall("[ACGT]*", eval(input()))))
print((max(ans)))
| S = eval(input())
ans = 0
for i in range(len(S)):
for j in range(i, len(S)):
T = S[i : j + 1]
if set(T) <= set("ACGT"):
ans = max(ans, j - i + 1)
print(ans)
| false | 66.666667 | [
"-import re",
"-",
"-ans = list(map(len, re.findall(\"[ACGT]*\", eval(input()))))",
"-print((max(ans)))",
"+S = eval(input())",
"+ans = 0",
"+for i in range(len(S)):",
"+ for j in range(i, len(S)):",
"+ T = S[i : j + 1]",
"+ if set(T) <= set(\"ACGT\"):",
"+ ans = max(... | false | 0.088285 | 0.076909 | 1.147906 | [
"s901200613",
"s605797689"
] |
u075012704 | p04049 | python | s271128839 | s203445479 | 1,926 | 1,538 | 80,344 | 94,808 | Accepted | Accepted | 20.15 | from collections import deque
N, K = list(map(int, input().split()))
T = [[] for i in range(N)]
E = []
for i in range(N-1):
a, b = list(map(int, input().split()))
a, b = a-1, b-1
T[a].append(b)
T[b].append(a)
E.append((a, b))
def dfs(n):
visited = [False] * N
stack = [[n, 0... | from collections import deque
N, K = list(map(int, input().split()))
T = [[] for i in range(N)]
E = []
for i in range(N-1):
a, b = list(map(int, input().split()))
a, b = a-1, b-1
T[a].append(b)
T[b].append(a)
E.append((a, b))
def bfs(n):
visited = [False] * N
dist = [0] * N... | 69 | 45 | 1,524 | 1,030 | from collections import deque
N, K = list(map(int, input().split()))
T = [[] for i in range(N)]
E = []
for i in range(N - 1):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
T[a].append(b)
T[b].append(a)
E.append((a, b))
def dfs(n):
visited = [False] * N
stack = [[n, 0]]
lo... | from collections import deque
N, K = list(map(int, input().split()))
T = [[] for i in range(N)]
E = []
for i in range(N - 1):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
T[a].append(b)
T[b].append(a)
E.append((a, b))
def bfs(n):
visited = [False] * N
dist = [0] * N
queu... | false | 34.782609 | [
"-",
"-",
"-def dfs(n):",
"- visited = [False] * N",
"- stack = [[n, 0]]",
"- longest = [-1, -1]",
"- while stack:",
"- node, weight = stack.pop()",
"- if visited[node]:",
"- continue",
"- visited[node] = True",
"- if longest[1] < weight:",
... | false | 0.118657 | 0.041507 | 2.858763 | [
"s271128839",
"s203445479"
] |
u970109776 | p02554 | python | s158733488 | s716754776 | 568 | 26 | 11,076 | 9,100 | Accepted | Accepted | 95.42 | #!/usr/bin/python3
#coding: utf-8
N = int(eval(input()))
p = 10**9 + 7
ret = pow(10, N)
ret -= pow(9, N)
ret -= pow(9, N)
ret += pow(8, N)
ret %= p
print(ret) | #!/usr/bin/python3
#coding: utf-8
N = int(eval(input()))
p = 10**9 + 7
ret = pow(10, N, p)
ret -= pow(9, N, p)
ret -= pow(9, N, p)
ret += pow(8, N, p)
ret = (ret + p) % p
print(ret) | 15 | 15 | 172 | 194 | #!/usr/bin/python3
# coding: utf-8
N = int(eval(input()))
p = 10**9 + 7
ret = pow(10, N)
ret -= pow(9, N)
ret -= pow(9, N)
ret += pow(8, N)
ret %= p
print(ret)
| #!/usr/bin/python3
# coding: utf-8
N = int(eval(input()))
p = 10**9 + 7
ret = pow(10, N, p)
ret -= pow(9, N, p)
ret -= pow(9, N, p)
ret += pow(8, N, p)
ret = (ret + p) % p
print(ret)
| false | 0 | [
"-ret = pow(10, N)",
"-ret -= pow(9, N)",
"-ret -= pow(9, N)",
"-ret += pow(8, N)",
"-ret %= p",
"+ret = pow(10, N, p)",
"+ret -= pow(9, N, p)",
"+ret -= pow(9, N, p)",
"+ret += pow(8, N, p)",
"+ret = (ret + p) % p"
] | false | 0.563601 | 0.037819 | 14.902665 | [
"s158733488",
"s716754776"
] |
u141610915 | p03108 | python | s490591364 | s407159105 | 1,272 | 856 | 120,152 | 97,916 | Accepted | Accepted | 32.7 | N, Q = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(Q)]
res = [0] * (Q - 1) + [N * (N - 1) // 2]
class UnionFind():
def __init__(self, n):
self.n = n
self.root = [-1] * (n + 1)
self.rnk = [0] * (n + 1)
def Find_Root(self, x):
if self.root[x] < 0:
... | import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
class UnionFind():
def __init__(self, n):
self.n = n
self.root = [-1] * (n + 1)
self.rnk = [0] * (n + 1)
def Find_Root(self, x):
if self.root[x] < 0:
return x
else:
self.root[x] = self.Find_R... | 47 | 55 | 1,275 | 1,230 | N, Q = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(Q)]
res = [0] * (Q - 1) + [N * (N - 1) // 2]
class UnionFind:
def __init__(self, n):
self.n = n
self.root = [-1] * (n + 1)
self.rnk = [0] * (n + 1)
def Find_Root(self, x):
if self.root[x... | import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
class UnionFind:
def __init__(self, n):
self.n = n
self.root = [-1] * (n + 1)
self.rnk = [0] * (n + 1)
def Find_Root(self, x):
if self.root[x] < 0:
return x
else:
self... | false | 14.545455 | [
"-N, Q = list(map(int, input().split()))",
"-A = [list(map(int, input().split())) for _ in range(Q)]",
"-res = [0] * (Q - 1) + [N * (N - 1) // 2]",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+N, M = list(map(int, input().split()))",
"-convenience = [0] * (N + 1)",
"-for i in range(Q - 1, 0,... | false | 0.045379 | 0.046781 | 0.970033 | [
"s490591364",
"s407159105"
] |
u040298438 | p03962 | python | s954673570 | s567083849 | 29 | 26 | 9,036 | 8,984 | Accepted | Accepted | 10.34 | a = list(map(int, input().split()))
print((len(set(a)))) | print((len(set(map(int, input().split()))))) | 2 | 1 | 55 | 42 | a = list(map(int, input().split()))
print((len(set(a))))
| print((len(set(map(int, input().split())))))
| false | 50 | [
"-a = list(map(int, input().split()))",
"-print((len(set(a))))",
"+print((len(set(map(int, input().split())))))"
] | false | 0.046578 | 0.049827 | 0.934801 | [
"s954673570",
"s567083849"
] |
u814781830 | p03029 | python | s397270306 | s013976151 | 20 | 18 | 3,316 | 3,064 | Accepted | Accepted | 10 | A, P = list(map(int, input().split()))
P += 3 * A
print((P//2)) | a,p=list(map(int,input().split()))
print((int((3 * a + p) / 2)))
| 3 | 2 | 57 | 58 | A, P = list(map(int, input().split()))
P += 3 * A
print((P // 2))
| a, p = list(map(int, input().split()))
print((int((3 * a + p) / 2)))
| false | 33.333333 | [
"-A, P = list(map(int, input().split()))",
"-P += 3 * A",
"-print((P // 2))",
"+a, p = list(map(int, input().split()))",
"+print((int((3 * a + p) / 2)))"
] | false | 0.047342 | 0.041259 | 1.147436 | [
"s397270306",
"s013976151"
] |
u692054751 | p02860 | python | s031820013 | s339097453 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | N = eval(input())
S = eval(input())
index = len(S) // 2
if len(S) % 2 != 0:
print('No')
elif S[:index] != S[index:]:
print('No')
else:
print('Yes')
| N = int(input())
str_input = input()
if N % 2 != 0:
print('No')
else:
print('Yes') if str_input[:N//2] == str_input[(N//2):] else print('No')
| 10 | 7 | 152 | 153 | N = eval(input())
S = eval(input())
index = len(S) // 2
if len(S) % 2 != 0:
print("No")
elif S[:index] != S[index:]:
print("No")
else:
print("Yes")
| N = int(input())
str_input = input()
if N % 2 != 0:
print("No")
else:
print("Yes") if str_input[: N // 2] == str_input[(N // 2) :] else print("No")
| false | 30 | [
"-N = eval(input())",
"-S = eval(input())",
"-index = len(S) // 2",
"-if len(S) % 2 != 0:",
"- print(\"No\")",
"-elif S[:index] != S[index:]:",
"+N = int(input())",
"+str_input = input()",
"+if N % 2 != 0:",
"- print(\"Yes\")",
"+ print(\"Yes\") if str_input[: N // 2] == str_input[(N //... | false | 0.148208 | 0.150014 | 0.987961 | [
"s031820013",
"s339097453"
] |
u827624348 | p03163 | python | s944732816 | s272282873 | 463 | 414 | 120,176 | 118,768 | Accepted | Accepted | 10.58 | import sys
sys.setrecursionlimit(1000000) # 再帰上限を増やす
def main():
input = sys.stdin.readline # 文字列に対してinputした場合は、rstripするのを忘れずに!
N, W = list(map(int, input().rstrip().split()))
item_list = []
for _ in range(N):
w, v = list(map(int, input().rstrip().split()))
item_list.append((w... | import sys
sys.setrecursionlimit(1000000) # 再帰上限を増やす
def main():
input = sys.stdin.readline # 文字列に対してinputした場合は、rstripするのを忘れずに!
N, W = list(map(int, input().rstrip().split()))
item_list = []
for _ in range(N):
w, v = list(map(int, input().rstrip().split()))
item_list.append((w... | 25 | 25 | 751 | 754 | import sys
sys.setrecursionlimit(1000000) # 再帰上限を増やす
def main():
input = sys.stdin.readline # 文字列に対してinputした場合は、rstripするのを忘れずに!
N, W = list(map(int, input().rstrip().split()))
item_list = []
for _ in range(N):
w, v = list(map(int, input().rstrip().split()))
item_list.append((w, v))
... | import sys
sys.setrecursionlimit(1000000) # 再帰上限を増やす
def main():
input = sys.stdin.readline # 文字列に対してinputした場合は、rstripするのを忘れずに!
N, W = list(map(int, input().rstrip().split()))
item_list = []
for _ in range(N):
w, v = list(map(int, input().rstrip().split()))
item_list.append((w, v))
... | false | 0 | [
"- dp = [[0] * (W + 1) for _ in range(N)]",
"- for i, item in enumerate(item_list):",
"+ dp = [[0] * (W + 1) for _ in range(N + 1)]",
"+ for i, item in enumerate(item_list, 1):",
"- print((dp[N - 1][W]))",
"+ print((dp[N][W]))"
] | false | 0.049147 | 0.048972 | 1.003583 | [
"s944732816",
"s272282873"
] |
u305366205 | p02983 | python | s957432222 | s344268117 | 740 | 596 | 3,060 | 3,060 | Accepted | Accepted | 19.46 | l, r = list(map(int, input().split()))
rng = r - l
ans = float("inf")
if rng >= 2018:
ans = 0
else:
for i in range(l, r):
for j in range(i + 1, r + 1):
ans = min(ans, (i * j) % 2019)
print(ans) | def main():
l, r = list(map(int, input().split()))
rng = r - l
ans = float("inf")
if rng >= 2018:
ans = 0
else:
for i in range(l, r):
for j in range(i + 1, r + 1):
ans = min(ans, (i * j) % 2019)
print(ans)
if __name__ == "__main__":
... | 10 | 15 | 224 | 321 | l, r = list(map(int, input().split()))
rng = r - l
ans = float("inf")
if rng >= 2018:
ans = 0
else:
for i in range(l, r):
for j in range(i + 1, r + 1):
ans = min(ans, (i * j) % 2019)
print(ans)
| def main():
l, r = list(map(int, input().split()))
rng = r - l
ans = float("inf")
if rng >= 2018:
ans = 0
else:
for i in range(l, r):
for j in range(i + 1, r + 1):
ans = min(ans, (i * j) % 2019)
print(ans)
if __name__ == "__main__":
main()
| false | 33.333333 | [
"-l, r = list(map(int, input().split()))",
"-rng = r - l",
"-ans = float(\"inf\")",
"-if rng >= 2018:",
"- ans = 0",
"-else:",
"- for i in range(l, r):",
"- for j in range(i + 1, r + 1):",
"- ans = min(ans, (i * j) % 2019)",
"-print(ans)",
"+def main():",
"+ l, r = l... | false | 0.067219 | 0.041081 | 1.636267 | [
"s957432222",
"s344268117"
] |
u936985471 | p03673 | python | s614996627 | s161481330 | 213 | 168 | 26,180 | 26,180 | Accepted | Accepted | 21.13 | n=int(eval(input()))
a=list(map(int,input().split()))
bbottom=[]
btop=[]
for i in range(n):
if i%2==0:
bbottom.append(a[i])
else:
btop.append(a[i])
ans=btop[::-1]+bbottom
if n%2==1:
ans=ans[::-1]
print((*ans))
| n=int(eval(input()))
a=list(map(int,input().split()))
bbottom=a[0::2]
btop=a[1::2]
ans=btop[::-1]+bbottom
if n%2==1:
ans=ans[::-1]
print((*ans))
| 14 | 9 | 237 | 155 | n = int(eval(input()))
a = list(map(int, input().split()))
bbottom = []
btop = []
for i in range(n):
if i % 2 == 0:
bbottom.append(a[i])
else:
btop.append(a[i])
ans = btop[::-1] + bbottom
if n % 2 == 1:
ans = ans[::-1]
print((*ans))
| n = int(eval(input()))
a = list(map(int, input().split()))
bbottom = a[0::2]
btop = a[1::2]
ans = btop[::-1] + bbottom
if n % 2 == 1:
ans = ans[::-1]
print((*ans))
| false | 35.714286 | [
"-bbottom = []",
"-btop = []",
"-for i in range(n):",
"- if i % 2 == 0:",
"- bbottom.append(a[i])",
"- else:",
"- btop.append(a[i])",
"+bbottom = a[0::2]",
"+btop = a[1::2]"
] | false | 0.048707 | 0.048895 | 0.996145 | [
"s614996627",
"s161481330"
] |
u966695411 | p03835 | python | s531129125 | s150279796 | 1,043 | 469 | 2,940 | 3,064 | Accepted | Accepted | 55.03 | #! /usr/bin/env python3
K, S = list(map(int, input().split()))
K += 1
cnt = 0
for i in range(min(K, S+1)):
if i+K*2<=S : continue
for j in range(min(K, S-i+1)):
if i+j+K<=S : continue
cnt += 1
print(cnt) | #! /usr/bin/env python3
K, S = list(map(int, input().split()))
c = 0
for i in range(max(0, S-K*2), min(K+1, S+1)):
for j in range(max(0, S-i-K), min(K+1, S-i+1)):
c += 1
print(c) | 11 | 8 | 238 | 191 | #! /usr/bin/env python3
K, S = list(map(int, input().split()))
K += 1
cnt = 0
for i in range(min(K, S + 1)):
if i + K * 2 <= S:
continue
for j in range(min(K, S - i + 1)):
if i + j + K <= S:
continue
cnt += 1
print(cnt)
| #! /usr/bin/env python3
K, S = list(map(int, input().split()))
c = 0
for i in range(max(0, S - K * 2), min(K + 1, S + 1)):
for j in range(max(0, S - i - K), min(K + 1, S - i + 1)):
c += 1
print(c)
| false | 27.272727 | [
"-K += 1",
"-cnt = 0",
"-for i in range(min(K, S + 1)):",
"- if i + K * 2 <= S:",
"- continue",
"- for j in range(min(K, S - i + 1)):",
"- if i + j + K <= S:",
"- continue",
"- cnt += 1",
"-print(cnt)",
"+c = 0",
"+for i in range(max(0, S - K * 2), min(K +... | false | 0.035966 | 0.036928 | 0.973938 | [
"s531129125",
"s150279796"
] |
u150984829 | p00042 | python | s419321881 | s894440213 | 380 | 330 | 5,628 | 5,624 | Accepted | Accepted | 13.16 | c=0
for W in iter(input,'0'):
c+=1
W=int(W)
d=[0]*-~W
for _ in[0]*int(eval(input())):
v,w=list(map(int,input().split(',')))
for i in range(W,w-1,-1):
t=d[i-w]+v
if d[i]<t:d[i]=t
print(f'Case {c}:\n{d[W]}\n{d.index(d[W])}')
| c=0
for W in iter(input,'0'):
c+=1
W=int(W)
d=[0]*-~W
for _ in[0]*int(eval(input())):
v,w=list(map(int,input().split(',')))
for i in range(W,w-1,-1):
if d[i]<d[i-w]+v:d[i]=d[i-w]+v
print(f'Case {c}:\n{d[W]}\n{d.index(d[W])}')
| 11 | 10 | 236 | 235 | c = 0
for W in iter(input, "0"):
c += 1
W = int(W)
d = [0] * -~W
for _ in [0] * int(eval(input())):
v, w = list(map(int, input().split(",")))
for i in range(W, w - 1, -1):
t = d[i - w] + v
if d[i] < t:
d[i] = t
print(f"Case {c}:\n{d[W]}\n{d.ind... | c = 0
for W in iter(input, "0"):
c += 1
W = int(W)
d = [0] * -~W
for _ in [0] * int(eval(input())):
v, w = list(map(int, input().split(",")))
for i in range(W, w - 1, -1):
if d[i] < d[i - w] + v:
d[i] = d[i - w] + v
print(f"Case {c}:\n{d[W]}\n{d.index(d[W]... | false | 9.090909 | [
"- t = d[i - w] + v",
"- if d[i] < t:",
"- d[i] = t",
"+ if d[i] < d[i - w] + v:",
"+ d[i] = d[i - w] + v"
] | false | 0.098922 | 0.079349 | 1.246663 | [
"s419321881",
"s894440213"
] |
u796942881 | p03731 | python | s851252403 | s558425928 | 89 | 82 | 27,200 | 25,132 | Accepted | Accepted | 7.87 | from sys import stdin
def main():
lines = stdin.readlines()
T = int(lines[0].split()[1])
tn = [int(ti) for ti in lines[1].split()]
print((tn[-1] + T - sum(t2 - t1 - T
for t1, t2
in zip(tn[0:], tn[1:]) if t2 - t1 > T)))
return
mai... | def main():
T, *tn = list(map(int, open(0).read().split()[1:]))
print((tn[-1] + T - sum(t2 - t1 - T
for t1, t2
in zip(tn[0:], tn[1:])
if t2 - t1 > T)))
return
main()
| 14 | 10 | 322 | 262 | from sys import stdin
def main():
lines = stdin.readlines()
T = int(lines[0].split()[1])
tn = [int(ti) for ti in lines[1].split()]
print(
(tn[-1] + T - sum(t2 - t1 - T for t1, t2 in zip(tn[0:], tn[1:]) if t2 - t1 > T))
)
return
main()
| def main():
T, *tn = list(map(int, open(0).read().split()[1:]))
print(
(tn[-1] + T - sum(t2 - t1 - T for t1, t2 in zip(tn[0:], tn[1:]) if t2 - t1 > T))
)
return
main()
| false | 28.571429 | [
"-from sys import stdin",
"-",
"-",
"- lines = stdin.readlines()",
"- T = int(lines[0].split()[1])",
"- tn = [int(ti) for ti in lines[1].split()]",
"+ T, *tn = list(map(int, open(0).read().split()[1:]))"
] | false | 0.040474 | 0.107574 | 0.376239 | [
"s851252403",
"s558425928"
] |
u800058906 | p03073 | python | s492577538 | s189823549 | 60 | 52 | 9,956 | 9,752 | Accepted | Accepted | 13.33 | S=list(map(int,eval(input())))
ans1=0
for i in range(0,len(S),2):
if S[i]==1:
ans1+=1
for i in range(1,len(S),2):
if S[i]==0:
ans1+=1
ans2=0
for i in range(0,len(S),2):
if S[i]==0:
ans2+=1
for i in range(1,len(S),2):
if S[i]==1:
ans2+=1
print((min(ans1,ans2)))
| s=eval(input())
s=list(s)
c=0
for i in range(0,len(s),2):
if s[i]=='0':
c+=1
for i in range(1,len(s),2):
if s[i]=='1':
c+=1
d=0
for i in range(0,len(s),2):
if s[i]=='1':
d+=1
for i in range(1,len(s),2):
if s[i]=='0':
d+=1
print((min(c,d))) | 19 | 18 | 298 | 301 | S = list(map(int, eval(input())))
ans1 = 0
for i in range(0, len(S), 2):
if S[i] == 1:
ans1 += 1
for i in range(1, len(S), 2):
if S[i] == 0:
ans1 += 1
ans2 = 0
for i in range(0, len(S), 2):
if S[i] == 0:
ans2 += 1
for i in range(1, len(S), 2):
if S[i] == 1:
ans2 += 1
prin... | s = eval(input())
s = list(s)
c = 0
for i in range(0, len(s), 2):
if s[i] == "0":
c += 1
for i in range(1, len(s), 2):
if s[i] == "1":
c += 1
d = 0
for i in range(0, len(s), 2):
if s[i] == "1":
d += 1
for i in range(1, len(s), 2):
if s[i] == "0":
d += 1
print((min(c, d)))... | false | 5.263158 | [
"-S = list(map(int, eval(input())))",
"-ans1 = 0",
"-for i in range(0, len(S), 2):",
"- if S[i] == 1:",
"- ans1 += 1",
"-for i in range(1, len(S), 2):",
"- if S[i] == 0:",
"- ans1 += 1",
"-ans2 = 0",
"-for i in range(0, len(S), 2):",
"- if S[i] == 0:",
"- ans2 += ... | false | 0.058823 | 0.064648 | 0.909903 | [
"s492577538",
"s189823549"
] |
u641722141 | p03485 | python | s651298300 | s602177692 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | a, b = list(map(int, input().split()))
print(((a + b + 1)//2)) | # Round Up the Mean
a, b = list(map(int, input().split()))
print(((a + b + 2 - 1) // 2))
#print(int((a + b - 1)// b))
| 2 | 4 | 55 | 114 | a, b = list(map(int, input().split()))
print(((a + b + 1) // 2))
| # Round Up the Mean
a, b = list(map(int, input().split()))
print(((a + b + 2 - 1) // 2))
# print(int((a + b - 1)// b))
| false | 50 | [
"+# Round Up the Mean",
"-print(((a + b + 1) // 2))",
"+print(((a + b + 2 - 1) // 2))",
"+# print(int((a + b - 1)// b))"
] | false | 0.043498 | 0.046888 | 0.927707 | [
"s651298300",
"s602177692"
] |
u280552586 | p03436 | python | s363443732 | s037584102 | 304 | 195 | 42,860 | 40,816 | Accepted | Accepted | 35.86 | h, w = [int(x)+2 for x in input().split()]
MAZE = ['#'*w]
for _ in range(h-2):
MAZE.append('#'+eval(input())+'#')
else:
MAZE.append('#'*w)
total = 0
for i in range(h):
for j in range(w):
if MAZE[i][j] == '.':
total += 1
i, j = (1, 1)
INF = 10**18
dist = [[INF] * w for _ ... | from collections import deque
h, w = [int(x)+2 for x in input().split()]
MAZE = ['#'*w]
for _ in range(h-2):
MAZE.append('#'+eval(input())+'#')
else:
MAZE.append('#'*w)
total = 0
for i in range(h):
for j in range(w):
if MAZE[i][j] == '.':
total += 1
# よく考えたらBFSでOKだった
i... | 37 | 39 | 802 | 863 | h, w = [int(x) + 2 for x in input().split()]
MAZE = ["#" * w]
for _ in range(h - 2):
MAZE.append("#" + eval(input()) + "#")
else:
MAZE.append("#" * w)
total = 0
for i in range(h):
for j in range(w):
if MAZE[i][j] == ".":
total += 1
i, j = (1, 1)
INF = 10**18
dist = [[INF] * w for _ in ra... | from collections import deque
h, w = [int(x) + 2 for x in input().split()]
MAZE = ["#" * w]
for _ in range(h - 2):
MAZE.append("#" + eval(input()) + "#")
else:
MAZE.append("#" * w)
total = 0
for i in range(h):
for j in range(w):
if MAZE[i][j] == ".":
total += 1
# よく考えたらBFSでOKだった
i, j = ... | false | 5.128205 | [
"+from collections import deque",
"+",
"+# よく考えたらBFSでOKだった",
"-next_v = [(i, j)]",
"+next_v = deque([[i, j]])",
"- i, j = next_v.pop()",
"+ i, j = next_v.popleft()"
] | false | 0.061146 | 0.111718 | 0.547328 | [
"s363443732",
"s037584102"
] |
u753803401 | p03014 | python | s048835886 | s313385999 | 1,231 | 665 | 339,848 | 177,288 | Accepted | Accepted | 45.98 | def slove():
import sys
input = sys.stdin.readline
h, w = list(map(int, input().split()))
lst = []
for i in range(h):
lst.append(list(eval(input())))
R = [[0] * w for _ in range(h)]
L = [[0] * w for _ in range(h)]
U = [[0] * w for _ in range(h)]
D = [[0] * w for _... | def slove():
import sys
input = sys.stdin.readline
h, w = list(map(int, input().rstrip('\n').split()))
s = [str(input().rstrip('\n')) for _ in range(h)]
L = [[0] * w for _ in range(h)]
R = [[0] * w for _ in range(h)]
U = [[0] * w for _ in range(h)]
D = [[0] * w for _ in range(h)]... | 56 | 48 | 1,495 | 1,426 | def slove():
import sys
input = sys.stdin.readline
h, w = list(map(int, input().split()))
lst = []
for i in range(h):
lst.append(list(eval(input())))
R = [[0] * w for _ in range(h)]
L = [[0] * w for _ in range(h)]
U = [[0] * w for _ in range(h)]
D = [[0] * w for _ in range(h... | def slove():
import sys
input = sys.stdin.readline
h, w = list(map(int, input().rstrip("\n").split()))
s = [str(input().rstrip("\n")) for _ in range(h)]
L = [[0] * w for _ in range(h)]
R = [[0] * w for _ in range(h)]
U = [[0] * w for _ in range(h)]
D = [[0] * w for _ in range(h)]
fo... | false | 14.285714 | [
"- h, w = list(map(int, input().split()))",
"- lst = []",
"- for i in range(h):",
"- lst.append(list(eval(input())))",
"+ h, w = list(map(int, input().rstrip(\"\\n\").split()))",
"+ s = [str(input().rstrip(\"\\n\")) for _ in range(h)]",
"+ L = [[0] * w for _ in range(h)]",
"- ... | false | 0.084375 | 0.043878 | 1.922933 | [
"s048835886",
"s313385999"
] |
u191874006 | p03168 | python | s525320493 | s581006802 | 907 | 784 | 272,136 | 259,464 | Accepted | Accepted | 13.56 | #!/usr/bin/env python3
#dp8 #Coin
import sys
sys.setrecursionlimit(10000000)
def LI(): return list(map(float,sys.stdin.readline().split()))
def LIR(n): return [LI() for _ in range(n)]
mod = 10**9+7
def I():
n = int(eval(input()))
p = LI()
#縦:コインの枚数,横:表が出た回数
dp = [[0 for _ in range(n+1)] f... | #!/usr/bin/env python3
#EDPC I
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Coun... | 26 | 33 | 558 | 879 | #!/usr/bin/env python3
# dp8 #Coin
import sys
sys.setrecursionlimit(10000000)
def LI():
return list(map(float, sys.stdin.readline().split()))
def LIR(n):
return [LI() for _ in range(n)]
mod = 10**9 + 7
def I():
n = int(eval(input()))
p = LI()
# 縦:コインの枚数,横:表が出た回数
dp = [[0 for _ in range(... | #!/usr/bin/env python3
# EDPC I
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from ... | false | 21.212121 | [
"-# dp8 #Coin",
"+# EDPC I",
"+import math",
"+from bisect import bisect_right as br",
"+from bisect import bisect_left as bl",
"-sys.setrecursionlimit(10000000)",
"+sys.setrecursionlimit(1000000000)",
"+from heapq import heappush, heappop, heappushpop",
"+from collections import defaultdict",
"+f... | false | 0.044368 | 0.070259 | 0.631493 | [
"s525320493",
"s581006802"
] |
u600402037 | p02847 | python | s205209567 | s253837709 | 19 | 17 | 2,940 | 3,060 | Accepted | Accepted | 10.53 | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
S = sr()
day = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
day = day[::-1]
i = day.index(S)
print((i+1))
| import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
S = sr()
days = 'SUN,MON,TUE,WED,THU,FRI,SAT'.split(',')
day_to_x = {x: 7 - i for i, x in enumerate(days)}
print((day_to_x[S]))
| 12 | 11 | 244 | 258 | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
S = sr()
day = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]
day = day[::-1]
i = day.index(S)
print((i + 1))
| import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
S = sr()
days = "SUN,MON,TUE,WED,THU,FRI,SAT".split(",")
day_to_x = {x: 7 - i for i, x in enumerate(days)}
print((day_to_x[S]))
| false | 8.333333 | [
"-day = [\"SUN\", \"MON\", \"TUE\", \"WED\", \"THU\", \"FRI\", \"SAT\"]",
"-day = day[::-1]",
"-i = day.index(S)",
"-print((i + 1))",
"+days = \"SUN,MON,TUE,WED,THU,FRI,SAT\".split(\",\")",
"+day_to_x = {x: 7 - i for i, x in enumerate(days)}",
"+print((day_to_x[S]))"
] | false | 0.008468 | 0.042772 | 0.197976 | [
"s205209567",
"s253837709"
] |
u190178779 | p03106 | python | s682716912 | s019973143 | 29 | 25 | 9,128 | 9,068 | Accepted | Accepted | 13.79 | import sys
A,B,K = list(map(int,input().split()))
#euclid algorithm
if A < B:
A, B = B, A
while A%B != 0:
A,B = B,A%B
count = 0
for I in range(B,0,-1):
if B % I == 0:
count += 1
if count == K:
print(I)
break
| import sys
A,B,K = list(map(int,input().split()))
if not ( 1 <= A <= 100 and 1 <= B <= 100 ): sys.exit()
if not ( 1 <= K ): sys.exit()
#euclid algorithm
if A < B:
A, B = B, A
while A%B != 0:
A,B = B,A%B
# B is greatest common divisor
count = 0
for I in range(B,0,-1):
if B % I == 0:
cou... | 15 | 17 | 258 | 375 | import sys
A, B, K = list(map(int, input().split()))
# euclid algorithm
if A < B:
A, B = B, A
while A % B != 0:
A, B = B, A % B
count = 0
for I in range(B, 0, -1):
if B % I == 0:
count += 1
if count == K:
print(I)
break
| import sys
A, B, K = list(map(int, input().split()))
if not (1 <= A <= 100 and 1 <= B <= 100):
sys.exit()
if not (1 <= K):
sys.exit()
# euclid algorithm
if A < B:
A, B = B, A
while A % B != 0:
A, B = B, A % B
# B is greatest common divisor
count = 0
for I in range(B, 0, -1):
if B % I == 0:
... | false | 11.764706 | [
"+if not (1 <= A <= 100 and 1 <= B <= 100):",
"+ sys.exit()",
"+if not (1 <= K):",
"+ sys.exit()",
"+# B is greatest common divisor"
] | false | 0.089924 | 0.111051 | 0.809761 | [
"s682716912",
"s019973143"
] |
u531579566 | p02844 | python | s925980811 | s674209474 | 1,539 | 491 | 3,700 | 3,060 | Accepted | Accepted | 68.1 | def count_2chr(li):
ans = [0 for _ in range(10)]
s = li.copy()
while len(s) >= 2:
i = s.pop(0)
if ans[i] == 0:
ans[i] = len(set(s))
return sum(ans)
n = int(eval(input()))
s = list(map(int, list(eval(input()))))
count = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
whi... | n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(100):
num = str(i).zfill(2)
k = 0
for j in range(len(s)):
if num[k] == s[j]:
k += 1
if k == 2:
ans += len(set(s[j+1:]))
break
print(ans)
| 21 | 16 | 420 | 271 | def count_2chr(li):
ans = [0 for _ in range(10)]
s = li.copy()
while len(s) >= 2:
i = s.pop(0)
if ans[i] == 0:
ans[i] = len(set(s))
return sum(ans)
n = int(eval(input()))
s = list(map(int, list(eval(input()))))
count = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
while len(s) >= 3:
i... | n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(100):
num = str(i).zfill(2)
k = 0
for j in range(len(s)):
if num[k] == s[j]:
k += 1
if k == 2:
ans += len(set(s[j + 1 :]))
break
print(ans)
| false | 23.809524 | [
"-def count_2chr(li):",
"- ans = [0 for _ in range(10)]",
"- s = li.copy()",
"- while len(s) >= 2:",
"- i = s.pop(0)",
"- if ans[i] == 0:",
"- ans[i] = len(set(s))",
"- return sum(ans)",
"-",
"-",
"-s = list(map(int, list(eval(input()))))",
"-count = [0, 0,... | false | 0.03896 | 0.089565 | 0.434989 | [
"s925980811",
"s674209474"
] |
u814271993 | p03545 | python | s674537925 | s365867053 | 63 | 26 | 61,900 | 9,200 | Accepted | Accepted | 58.73 | A,B,C,D = eval(input())
op = ["+","-"]
for i in op:
for j in op:
for k in op:
ans = A+i+B+j+C+k+D
if eval(ans)==7:
print((ans+"=7"))
exit() | import itertools
s = eval(input())
ans=0
for i in list(itertools.product([0,1], repeat=len(s)-1)):
b = 0
a = int(s[0])
l = [a]+[0]*(2*(len(s)-1))
for j in range(len(s)-1):
if i[j] == 0:
a += int(s[j+1])
l[2*j+1] = '+'
l[2*j+2] = str(s[j+1])
... | 10 | 22 | 176 | 532 | A, B, C, D = eval(input())
op = ["+", "-"]
for i in op:
for j in op:
for k in op:
ans = A + i + B + j + C + k + D
if eval(ans) == 7:
print((ans + "=7"))
exit()
| import itertools
s = eval(input())
ans = 0
for i in list(itertools.product([0, 1], repeat=len(s) - 1)):
b = 0
a = int(s[0])
l = [a] + [0] * (2 * (len(s) - 1))
for j in range(len(s) - 1):
if i[j] == 0:
a += int(s[j + 1])
l[2 * j + 1] = "+"
l[2 * j + 2] = str(s... | false | 54.545455 | [
"-A, B, C, D = eval(input())",
"-op = [\"+\", \"-\"]",
"-for i in op:",
"- for j in op:",
"- for k in op:",
"- ans = A + i + B + j + C + k + D",
"- if eval(ans) == 7:",
"- print((ans + \"=7\"))",
"- exit()",
"+import itertools",
"+",
... | false | 0.036316 | 0.035665 | 1.01826 | [
"s674537925",
"s365867053"
] |
u588341295 | p03828 | python | s615951289 | s517463185 | 37 | 18 | 3,064 | 3,064 | Accepted | Accepted | 51.35 | # -*- coding: utf-8 -*-
import math
# 階乗しないで求める版
x = int(eval(input()))
# 素数判定用関数
def is_prime_2(num):
if num < 2:
return False
if num == 2 or num == 3 or num == 5:
return True
if num % 2 == 0 or num % 3 == 0 or num % 5 == 0:
return False
# 疑似素数(2でも3でも5でも割り切れな... | # -*- coding: utf-8 -*-
import math
# 階乗しないで求める版
# 素数数え上げないで計算する版
x = int(eval(input()))
# 素数判定用関数
def is_prime_2(num):
if num < 2:
return False
if num == 2 or num == 3 or num == 5:
return True
if num % 2 == 0 or num % 3 == 0 or num % 5 == 0:
return False
# 疑... | 50 | 51 | 1,087 | 1,056 | # -*- coding: utf-8 -*-
import math
# 階乗しないで求める版
x = int(eval(input()))
# 素数判定用関数
def is_prime_2(num):
if num < 2:
return False
if num == 2 or num == 3 or num == 5:
return True
if num % 2 == 0 or num % 3 == 0 or num % 5 == 0:
return False
# 疑似素数(2でも3でも5でも割り切れない数字)で次々に割っていく
p... | # -*- coding: utf-8 -*-
import math
# 階乗しないで求める版
# 素数数え上げないで計算する版
x = int(eval(input()))
# 素数判定用関数
def is_prime_2(num):
if num < 2:
return False
if num == 2 or num == 3 or num == 5:
return True
if num % 2 == 0 or num % 3 == 0 or num % 5 == 0:
return False
# 疑似素数(2でも3でも5でも割り切れない数... | false | 1.960784 | [
"+# 素数数え上げないで計算する版",
"-# 素数のカウントは階乗前の値から個別に取って合算でも問題ない",
"+# 各素数毎に、数え上げないで計算する",
"-for i in range(1, x + 1):",
"- for sosu in sosu_list:",
"- while i % sosu == 0:",
"- if sosu in sosu_cnt:",
"- sosu_cnt[sosu] += 1",
"- else:",
"- sosu_c... | false | 0.053261 | 0.04825 | 1.103842 | [
"s615951289",
"s517463185"
] |
u596536048 | p03308 | python | s611074231 | s379789738 | 32 | 26 | 9,092 | 9,084 | Accepted | Accepted | 18.75 | total_integer = int(eval(input()))
integer = sorted(list(map(int, input().split())))
print((integer[total_integer - 1] - integer[0])) | eval(input())
A = list(map(int, input().split()))
print((max(A) - min(A))) | 3 | 3 | 127 | 68 | total_integer = int(eval(input()))
integer = sorted(list(map(int, input().split())))
print((integer[total_integer - 1] - integer[0]))
| eval(input())
A = list(map(int, input().split()))
print((max(A) - min(A)))
| false | 0 | [
"-total_integer = int(eval(input()))",
"-integer = sorted(list(map(int, input().split())))",
"-print((integer[total_integer - 1] - integer[0]))",
"+eval(input())",
"+A = list(map(int, input().split()))",
"+print((max(A) - min(A)))"
] | false | 0.104336 | 0.03764 | 2.771973 | [
"s611074231",
"s379789738"
] |
u645250356 | p03545 | python | s725653430 | s056051326 | 285 | 39 | 63,980 | 10,392 | Accepted | Accepted | 86.32 | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(m... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,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.stdin.readline().split()))
s = ... | 27 | 26 | 782 | 729 | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, 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.stdin.readline().s... | false | 3.703704 | [
"-from bisect import bisect_left, bisect_right",
"-import sys, math, itertools, fractions, pprint",
"+import sys, bisect, math, itertools, fractions",
"-a = list(eval(input()))",
"-a = [int(i) for i in a]",
"-for fl in itertools.product(list(range(2)), repeat=3):",
"- now = a[0]",
"- for i, x in... | false | 0.037907 | 0.035907 | 1.055681 | [
"s725653430",
"s056051326"
] |
u531599639 | p03030 | python | s201254352 | s268390416 | 27 | 23 | 9,148 | 9,120 | Accepted | Accepted | 14.81 | n=int(eval(input()))
for v in sorted(list(list(input().split())+[i+1] for i in range(n)),key=lambda x:(x[0],-int(x[1]))):print((v[2])) | for v in sorted([[*input().split()]+[i+1] for i in range(int(eval(input())))],key=lambda x:(x[0],-int(x[1]))):print((v[2])) | 2 | 1 | 127 | 115 | n = int(eval(input()))
for v in sorted(
list(list(input().split()) + [i + 1] for i in range(n)),
key=lambda x: (x[0], -int(x[1])),
):
print((v[2]))
| for v in sorted(
[[*input().split()] + [i + 1] for i in range(int(eval(input())))],
key=lambda x: (x[0], -int(x[1])),
):
print((v[2]))
| false | 50 | [
"-n = int(eval(input()))",
"- list(list(input().split()) + [i + 1] for i in range(n)),",
"+ [[*input().split()] + [i + 1] for i in range(int(eval(input())))],"
] | false | 0.069269 | 0.06713 | 1.031868 | [
"s201254352",
"s268390416"
] |
u073852194 | p02834 | python | s623112422 | s373025556 | 367 | 337 | 133,728 | 131,524 | Accepted | Accepted | 8.17 | class Tree():
def __init__(self, n, edge, indexed=1):
self.n = n
self.tree = [[] for _ in range(n)]
for e in edge:
self.tree[e[0] - indexed].append(e[1] - indexed)
self.tree[e[1] - indexed].append(e[0] - indexed)
def setroot(self, root):
self.roo... | class Tree():
def __init__(self, n, edge, indexed=1):
self.n = n
self.tree = [[] for _ in range(n)]
for e in edge:
self.tree[e[0] - indexed].append(e[1] - indexed)
self.tree[e[1] - indexed].append(e[0] - indexed)
def setroot(self, root):
self.roo... | 141 | 49 | 4,545 | 1,512 | class Tree:
def __init__(self, n, edge, indexed=1):
self.n = n
self.tree = [[] for _ in range(n)]
for e in edge:
self.tree[e[0] - indexed].append(e[1] - indexed)
self.tree[e[1] - indexed].append(e[0] - indexed)
def setroot(self, root):
self.root = root
... | class Tree:
def __init__(self, n, edge, indexed=1):
self.n = n
self.tree = [[] for _ in range(n)]
for e in edge:
self.tree[e[0] - indexed].append(e[1] - indexed)
self.tree[e[1] - indexed].append(e[0] - indexed)
def setroot(self, root):
self.root = root
... | false | 65.248227 | [
"- def heavylight_decomposition(self):",
"- self.order = [None for _ in range(self.n)]",
"- self.head = [None for _ in range(self.n)]",
"- self.head[self.root] = self.root",
"- self.next = [None for _ in range(self.n)]",
"- stack = [self.root]",
"- order = 0"... | false | 0.043033 | 0.042995 | 1.00087 | [
"s623112422",
"s373025556"
] |
u022979415 | p02696 | python | s664964402 | s918080650 | 24 | 21 | 9,216 | 9,092 | Accepted | Accepted | 12.5 | from math import floor
def f(x, a, b):
return floor((x * a) / b) - a * floor(x / b)
def main():
a, b, n = list(map(int, input().split()))
if n < min(a, b):
print((f(n, a, b)))
elif min(a, b) <= n < max(a, b):
print((max(f(min(a, b) - 1, a, b), f(n, a, b))))
else:
... | from math import floor
def main():
a, b, n = list(map(int, input().split()))
def f(x):
return floor((x * a) / b) - a * floor(x / b)
print((f(min(n, b - 1))))
if __name__ == '__main__':
main()
| 20 | 15 | 421 | 237 | from math import floor
def f(x, a, b):
return floor((x * a) / b) - a * floor(x / b)
def main():
a, b, n = list(map(int, input().split()))
if n < min(a, b):
print((f(n, a, b)))
elif min(a, b) <= n < max(a, b):
print((max(f(min(a, b) - 1, a, b), f(n, a, b))))
else:
print((m... | from math import floor
def main():
a, b, n = list(map(int, input().split()))
def f(x):
return floor((x * a) / b) - a * floor(x / b)
print((f(min(n, b - 1))))
if __name__ == "__main__":
main()
| false | 25 | [
"-",
"-",
"-def f(x, a, b):",
"- return floor((x * a) / b) - a * floor(x / b)",
"- if n < min(a, b):",
"- print((f(n, a, b)))",
"- elif min(a, b) <= n < max(a, b):",
"- print((max(f(min(a, b) - 1, a, b), f(n, a, b))))",
"- else:",
"- print((max(f(max(a, b) - 1, a, ... | false | 0.046276 | 0.046541 | 0.994315 | [
"s664964402",
"s918080650"
] |
u644907318 | p03352 | python | s311429286 | s228009210 | 163 | 64 | 38,372 | 62,328 | Accepted | Accepted | 60.74 | X = int(eval(input()))
ans = 1
for i in range(2,int(X**0.5)+1):
cnt = 2
y = i**cnt
while y<=X:
ans = max(ans,y)
cnt +=1
y = y*i
print(ans) | X = int(eval(input()))
if X==1:
print((1))
else:
cmax = 0
for i in range(2,int(X**0.5)+1):
k = 2
while i**k<=X:
k += 1
cmax = max(cmax,i**(k-1))
print(cmax) | 10 | 11 | 184 | 210 | X = int(eval(input()))
ans = 1
for i in range(2, int(X**0.5) + 1):
cnt = 2
y = i**cnt
while y <= X:
ans = max(ans, y)
cnt += 1
y = y * i
print(ans)
| X = int(eval(input()))
if X == 1:
print((1))
else:
cmax = 0
for i in range(2, int(X**0.5) + 1):
k = 2
while i**k <= X:
k += 1
cmax = max(cmax, i ** (k - 1))
print(cmax)
| false | 9.090909 | [
"-ans = 1",
"-for i in range(2, int(X**0.5) + 1):",
"- cnt = 2",
"- y = i**cnt",
"- while y <= X:",
"- ans = max(ans, y)",
"- cnt += 1",
"- y = y * i",
"-print(ans)",
"+if X == 1:",
"+ print((1))",
"+else:",
"+ cmax = 0",
"+ for i in range(2, int(X**0... | false | 0.099529 | 0.036411 | 2.733471 | [
"s311429286",
"s228009210"
] |
u974792613 | p03557 | python | s944134174 | s163845025 | 1,273 | 959 | 24,180 | 24,052 | Accepted | Accepted | 24.67 | def is_ok_under(array, mid, target):
return array[mid] < target
def is_ok_over(array, mid, target):
return array[mid] > target
# ok is -1. ng is len(array)
def bSearchUnder(array, ok, ng, target):
while (abs(ok - ng) > 1):
mid = (ok + ng) // 2
if is_ok_under(array, mid, targe... | def binSearch(array, num):
n = len(array)
l = -1
r = n
while l + 1 < r:
m = (l + r) // 2
if num <= array[m]:
r = m
else:
l = m
return r
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split())... | 47 | 30 | 1,000 | 523 | def is_ok_under(array, mid, target):
return array[mid] < target
def is_ok_over(array, mid, target):
return array[mid] > target
# ok is -1. ng is len(array)
def bSearchUnder(array, ok, ng, target):
while abs(ok - ng) > 1:
mid = (ok + ng) // 2
if is_ok_under(array, mid, target):
... | def binSearch(array, num):
n = len(array)
l = -1
r = n
while l + 1 < r:
m = (l + r) // 2
if num <= array[m]:
r = m
else:
l = m
return r
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, i... | false | 36.170213 | [
"-def is_ok_under(array, mid, target):",
"- return array[mid] < target",
"-",
"-",
"-def is_ok_over(array, mid, target):",
"- return array[mid] > target",
"-",
"-",
"-# ok is -1. ng is len(array)",
"-def bSearchUnder(array, ok, ng, target):",
"- while abs(ok - ng) > 1:",
"- mid... | false | 0.04215 | 0.040964 | 1.028952 | [
"s944134174",
"s163845025"
] |
u620945921 | p04001 | python | s619945846 | s953986808 | 27 | 24 | 3,064 | 3,060 | Accepted | Accepted | 11.11 | import itertools
s=eval(input())
length=len(s)
ans=0
mylist=list(itertools.product('01',repeat=length-1))
for j in range(len(mylist)):
tmp=s[0]
for i in range(length-1):
if mylist[j][i]=='1':
tmp+="+"+s[i+1]
else:
tmp+=s[i+1]
tmp=eval(tmp)
ans+=tm... | n=eval(input())
anslist=[]
def saiki(n,x,a,k):
if k==len(n):
anslist.append(eval(x))
return
else:
for i in a:
y=x
x=x+i+n[k]
saiki(n,x,a,k+1)
x=y
saiki(n,n[0],['','+'],1)
print((sum(anslist))) | 17 | 16 | 328 | 288 | import itertools
s = eval(input())
length = len(s)
ans = 0
mylist = list(itertools.product("01", repeat=length - 1))
for j in range(len(mylist)):
tmp = s[0]
for i in range(length - 1):
if mylist[j][i] == "1":
tmp += "+" + s[i + 1]
else:
tmp += s[i + 1]
tmp = eval(tmp... | n = eval(input())
anslist = []
def saiki(n, x, a, k):
if k == len(n):
anslist.append(eval(x))
return
else:
for i in a:
y = x
x = x + i + n[k]
saiki(n, x, a, k + 1)
x = y
saiki(n, n[0], ["", "+"], 1)
print((sum(anslist)))
| false | 5.882353 | [
"-import itertools",
"+n = eval(input())",
"+anslist = []",
"-s = eval(input())",
"-length = len(s)",
"-ans = 0",
"-mylist = list(itertools.product(\"01\", repeat=length - 1))",
"-for j in range(len(mylist)):",
"- tmp = s[0]",
"- for i in range(length - 1):",
"- if mylist[j][i] == \... | false | 0.040252 | 0.043207 | 0.931614 | [
"s619945846",
"s953986808"
] |
u798803522 | p02315 | python | s596093588 | s619229282 | 1,050 | 670 | 44,360 | 6,968 | Accepted | Accepted | 36.19 | num,weight = (int(n) for n in input().split(" "))
query = []
for n in range(num):
query.append([int(n) for n in input().split(" ")])
nap = [[0 for n in range(weight + 1)] for m in range(num + 1)]
for n in range(num):
for w in range(weight + 1):
if query[n][1] <= w:
nap[n + 1][w] = ... | import copy
length, capacity = list(map(int, input().split(" ")))
nap = []
for _ in range(length):
v, w = list(map(int, input().split(" ")))
nap.append([v, w])
dp = [0 for n in range(capacity + 1)]
for i, (v, w) in enumerate(nap):
new_dp = dp[::]
if w <= capacity:
new_dp[w] = max(v, ... | 13 | 21 | 449 | 536 | num, weight = (int(n) for n in input().split(" "))
query = []
for n in range(num):
query.append([int(n) for n in input().split(" ")])
nap = [[0 for n in range(weight + 1)] for m in range(num + 1)]
for n in range(num):
for w in range(weight + 1):
if query[n][1] <= w:
nap[n + 1][w] = max(nap[n... | import copy
length, capacity = list(map(int, input().split(" ")))
nap = []
for _ in range(length):
v, w = list(map(int, input().split(" ")))
nap.append([v, w])
dp = [0 for n in range(capacity + 1)]
for i, (v, w) in enumerate(nap):
new_dp = dp[::]
if w <= capacity:
new_dp[w] = max(v, dp[w])
... | false | 38.095238 | [
"-num, weight = (int(n) for n in input().split(\" \"))",
"-query = []",
"-for n in range(num):",
"- query.append([int(n) for n in input().split(\" \")])",
"-nap = [[0 for n in range(weight + 1)] for m in range(num + 1)]",
"-for n in range(num):",
"- for w in range(weight + 1):",
"- if que... | false | 0.061255 | 0.071081 | 0.861756 | [
"s596093588",
"s619229282"
] |
u692453235 | p02690 | python | s297289450 | s032518145 | 1,789 | 315 | 9,456 | 9,320 | Accepted | Accepted | 82.39 |
X = int(eval(input()))
def make_div(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
divisors.sort()
return divisors
def f(x, y):
return x**5 - y**5 - X
Flag =... | X = int(eval(input()))
def make_div(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
divisors.sort()
return divisors
def f(x, y):
return x**5 - y**5 - X
Flag = T... | 28 | 27 | 510 | 506 | X = int(eval(input()))
def make_div(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
divisors.sort()
return divisors
def f(x, y):
return x**5 - y**5 - X
Flag = True
fo... | X = int(eval(input()))
def make_div(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
divisors.sort()
return divisors
def f(x, y):
return x**5 - y**5 - X
Flag = True
fo... | false | 3.571429 | [
"-for A in range(-1000, 1000):",
"+for A in range(-120, 120):"
] | false | 0.043669 | 0.043133 | 1.012441 | [
"s297289450",
"s032518145"
] |
u880400515 | p02603 | python | s008186100 | s960474538 | 71 | 61 | 61,948 | 61,976 | Accepted | Accepted | 14.08 | N = int(eval(input()))
A = list(map(int, input().split()))
money = 1000
kabu = 0
toku = 0
min_val = 10000
for i in range(N):
if (A[i] < min_val):
min_val = A[i]
if (A[i] > min_val):
money += (money // min_val) * (A[i] - min_val)
min_val = A[i]
print(money)
| N = int(eval(input()))
A = list(map(int, input().split()))
money = 1000
min_val = 10000
for i in range(N):
if (A[i] < min_val):
min_val = A[i]
if (A[i] > min_val):
money += (money // min_val) * (A[i] - min_val)
min_val = A[i]
print(money)
| 17 | 15 | 303 | 283 | N = int(eval(input()))
A = list(map(int, input().split()))
money = 1000
kabu = 0
toku = 0
min_val = 10000
for i in range(N):
if A[i] < min_val:
min_val = A[i]
if A[i] > min_val:
money += (money // min_val) * (A[i] - min_val)
min_val = A[i]
print(money)
| N = int(eval(input()))
A = list(map(int, input().split()))
money = 1000
min_val = 10000
for i in range(N):
if A[i] < min_val:
min_val = A[i]
if A[i] > min_val:
money += (money // min_val) * (A[i] - min_val)
min_val = A[i]
print(money)
| false | 11.764706 | [
"-kabu = 0",
"-toku = 0"
] | false | 0.049617 | 0.114517 | 0.433268 | [
"s008186100",
"s960474538"
] |
u408260374 | p02257 | python | s252064098 | s690586350 | 110 | 100 | 6,724 | 4,544 | Accepted | Accepted | 9.09 | def miller_rabin(n):
""" primality Test
if n < 3,825,123,056,546,413,051, it is enough to test
a = 2, 3, 5, 7, 11, 13, 17, 19, and 23.
Complexity: O(log^3 n)
"""
if n == 2: return True
if n <= 1 or not n&1: return False
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23]
... | def miller_rabin(n):
""" primality Test
if n < 3,825,123,056,546,413,051, it is enough to test
a = 2, 3, 5, 7, 11, 13, 17, 19, and 23.
Complexity: O(log^3 n)
"""
if n == 2: return True
if n <= 1 or not n&1: return False
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23]
... | 29 | 29 | 741 | 736 | def miller_rabin(n):
"""primality Test
if n < 3,825,123,056,546,413,051, it is enough to test
a = 2, 3, 5, 7, 11, 13, 17, 19, and 23.
Complexity: O(log^3 n)
"""
if n == 2:
return True
if n <= 1 or not n & 1:
return False
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23]
d = n... | def miller_rabin(n):
"""primality Test
if n < 3,825,123,056,546,413,051, it is enough to test
a = 2, 3, 5, 7, 11, 13, 17, 19, and 23.
Complexity: O(log^3 n)
"""
if n == 2:
return True
if n <= 1 or not n & 1:
return False
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23]
d = n... | false | 0 | [
"-print((sum(1 for _ in range(N) if miller_rabin(int(eval(input()))))))",
"+print((sum(1 for _ in range(N) if miller_rabin(eval(input())))))"
] | false | 0.048263 | 0.06527 | 0.739434 | [
"s252064098",
"s690586350"
] |
u440566786 | p03806 | python | s603218504 | s768651587 | 1,334 | 391 | 121,564 | 54,748 | Accepted | Accepted | 70.69 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
from itertools import product
from copy import deepcopy
def resolve():
n,ma,mb=list(map(int,input().split()))
ABC=[tuple(map(int,input().split())) for _ in range(n)]
M=400
d... | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
from itertools import product
from copy import deepcopy
def resolve():
n,ma,mb=list(map(int,input().split()))
ABC=[tuple(map(int,input().split())) for _ in range(n)]
M=400
d... | 28 | 26 | 742 | 702 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
from itertools import product
from copy import deepcopy
def resolve():
n, ma, mb = list(map(int, input().split()))
ABC = [tuple(map(int, input().split())) for _ in range(n)]
M = 4... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
from itertools import product
from copy import deepcopy
def resolve():
n, ma, mb = list(map(int, input().split()))
ABC = [tuple(map(int, input().split())) for _ in range(n)]
M = 4... | false | 7.142857 | [
"- ndp = deepcopy(dp)",
"- for x, y in product(list(range(M + 1)), repeat=2):",
"+ for x, y in product(list(range(M, -1, -1)), repeat=2):",
"- ndp[x + a][y + b] = min(ndp[x + a][y + b], dp[x][y] + c)",
"- dp = ndp",
"+ dp[x + a][y + b] = min(dp[x +... | false | 0.522092 | 0.222647 | 2.344933 | [
"s603218504",
"s768651587"
] |
u968166680 | p02998 | python | s421102625 | s737900917 | 611 | 245 | 132,088 | 115,072 | Accepted | Accepted | 59.9 | import sys
from operator import itemgetter
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
class UnionFind:
# Reference: https://note.nkmk.me/python-union-find/
def __init__(self, n):
self.... | import sys
from collections import Counter
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
class UnionFind:
# Reference: https://note.nkmk.me/python-union-find/
def __init__(self, n):
self.... | 87 | 84 | 2,076 | 1,862 | import sys
from operator import itemgetter
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
class UnionFind:
# Reference: https://note.nkmk.me/python-union-find/
def __init__(self, n):
self.n = n
se... | import sys
from collections import Counter
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
class UnionFind:
# Reference: https://note.nkmk.me/python-union-find/
def __init__(self, n):
self.n = n
se... | false | 3.448276 | [
"-from operator import itemgetter",
"+from collections import Counter",
"- P = [(x, y) for x, y in zip(*[iter(XY)] * 2)]",
"- uf = UnionFind(N)",
"- Q = [(x, y, i) for i, (x, y) in enumerate(P)]",
"- Q.sort()",
"- for j in range(N - 1):",
"- if Q[j][0] == Q[j + 1][0]:",
"- ... | false | 0.161126 | 0.209338 | 0.769693 | [
"s421102625",
"s737900917"
] |
u852690916 | p03044 | python | s376843011 | s992575731 | 785 | 496 | 79,832 | 67,120 | Accepted | Accepted | 36.82 | from collections import defaultdict
N=int(eval(input()))
E=defaultdict(list)
for _ in range(N-1):
u,v,w=list(map(int,input().split()))
u-=1
v-=1
E[u].append((v,w))
E[v].append((u,w))
ans=[-1]*N
stack=[0]
ans[0]=0
while stack:
node=stack.pop()
for to,w in E[node]:
if ... | import sys
def main():
input = sys.stdin.readline
N = int(eval(input()))
G = [[] for _ in range(N)]
for _ in range(N-1):
u,v,w = list(map(int, input().split()))
u,v = u-1,v-1
G[u].append((v,w))
G[v].append((u,w))
ans = [-1] * N
ans[0] = 0
stack =... | 22 | 25 | 419 | 600 | from collections import defaultdict
N = int(eval(input()))
E = defaultdict(list)
for _ in range(N - 1):
u, v, w = list(map(int, input().split()))
u -= 1
v -= 1
E[u].append((v, w))
E[v].append((u, w))
ans = [-1] * N
stack = [0]
ans[0] = 0
while stack:
node = stack.pop()
for to, w in E[node]:... | import sys
def main():
input = sys.stdin.readline
N = int(eval(input()))
G = [[] for _ in range(N)]
for _ in range(N - 1):
u, v, w = list(map(int, input().split()))
u, v = u - 1, v - 1
G[u].append((v, w))
G[v].append((u, w))
ans = [-1] * N
ans[0] = 0
stack =... | false | 12 | [
"-from collections import defaultdict",
"+import sys",
"-N = int(eval(input()))",
"-E = defaultdict(list)",
"-for _ in range(N - 1):",
"- u, v, w = list(map(int, input().split()))",
"- u -= 1",
"- v -= 1",
"- E[u].append((v, w))",
"- E[v].append((u, w))",
"-ans = [-1] * N",
"-st... | false | 0.089374 | 0.110053 | 0.812101 | [
"s376843011",
"s992575731"
] |
u263830634 | p03634 | python | s460702537 | s112452962 | 824 | 679 | 50,024 | 43,440 | Accepted | Accepted | 17.6 | import sys
input = sys.stdin.readline
from collections import deque
N = int(eval(input()))
graph = [[] for _ in range(N + 1)]
for _ in range(N - 1):
a, b, c = list(map(int, input().split()))
graph[a].append([b, a, c])
graph[b].append([a, b, c])
distance = [-1] * (N + 1)
Q, K = list(map(int... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7
N = int(eval(input()))
G = [[] for _ in range(N + 1)]
for _ in range(N - 1):
a, b, c = list(map(int, input().split()))
G[a].append((b, c))
G[b].append((a, c))
Q, K = list(map(int, input().split()))
d = ... | 35 | 29 | 839 | 610 | import sys
input = sys.stdin.readline
from collections import deque
N = int(eval(input()))
graph = [[] for _ in range(N + 1)]
for _ in range(N - 1):
a, b, c = list(map(int, input().split()))
graph[a].append([b, a, c])
graph[b].append([a, b, c])
distance = [-1] * (N + 1)
Q, K = list(map(int, input().split(... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)
MOD = 10**9 + 7
N = int(eval(input()))
G = [[] for _ in range(N + 1)]
for _ in range(N - 1):
a, b, c = list(map(int, input().split()))
G[a].append((b, c))
G[b].append((a, c))
Q, K = list(map(int, input().split()))
d = [-1] * (N + 1)
d[K] = ... | false | 17.142857 | [
"-from collections import deque",
"-",
"+sys.setrecursionlimit(10**9)",
"+MOD = 10**9 + 7",
"-graph = [[] for _ in range(N + 1)]",
"+G = [[] for _ in range(N + 1)]",
"- graph[a].append([b, a, c])",
"- graph[b].append([a, b, c])",
"-distance = [-1] * (N + 1)",
"+ G[a].append((b, c))",
"+... | false | 0.036346 | 0.036334 | 1.000349 | [
"s460702537",
"s112452962"
] |
u384657160 | p03361 | python | s865609966 | s490612657 | 156 | 18 | 12,500 | 3,064 | Accepted | Accepted | 88.46 | import numpy as np
h,w=list(map(int,input().split()))
s = [[0]*(w+2)]
for i in range(h):
s.append([0]+list(eval(input()))+[0])
s.append([0]*(w+2))
t = np.array(s)
c = 0
b = 0
def sirabe(t,i,j):
if t[i-1][j] != "#" and t[i][j-1] != "#" and t[i+1][j] != "#" and t[i][j+1] != "#":
return Fal... | h,w=list(map(int,input().split()))
s = [[0]*(w+2)]
for i in range(h):
s.append([0]+list(eval(input()))+[0])
s.append([0]*(w+2))
c = 0
b = 0
def sirabe(t,i,j):
if t[i-1][j] != "#" and t[i][j-1] != "#" and t[i+1][j] != "#" and t[i][j+1] != "#":
return False
else:
return True
... | 34 | 33 | 638 | 602 | import numpy as np
h, w = list(map(int, input().split()))
s = [[0] * (w + 2)]
for i in range(h):
s.append([0] + list(eval(input())) + [0])
s.append([0] * (w + 2))
t = np.array(s)
c = 0
b = 0
def sirabe(t, i, j):
if (
t[i - 1][j] != "#"
and t[i][j - 1] != "#"
and t[i + 1][j] != "#"
... | h, w = list(map(int, input().split()))
s = [[0] * (w + 2)]
for i in range(h):
s.append([0] + list(eval(input())) + [0])
s.append([0] * (w + 2))
c = 0
b = 0
def sirabe(t, i, j):
if (
t[i - 1][j] != "#"
and t[i][j - 1] != "#"
and t[i + 1][j] != "#"
and t[i][j + 1] != "#"
):
... | false | 2.941176 | [
"-import numpy as np",
"-",
"-t = np.array(s)",
"- if t[i][j] == \"#\":",
"- if sirabe(t, i, j):",
"+ if s[i][j] == \"#\":",
"+ if sirabe(s, i, j):"
] | false | 0.259379 | 0.038749 | 6.693782 | [
"s865609966",
"s490612657"
] |
u057109575 | p02845 | python | s890687168 | s996199389 | 426 | 132 | 60,068 | 84,136 | Accepted | Accepted | 69.01 | N, *A = list(map(int, open(0).read().split()))
MOD = 10 ** 9 + 7
ctr = [0] * 3
ans = 1
for a in A:
ans *= sum(a == v for v in ctr)
for j in range(3):
if ctr[j] == a:
ctr[j] += 1
break
print((ans % MOD))
|
N = int(eval(input()))
X = list(map(int, input().split()))
MOD = 10 ** 9 + 7
ctr = [0, 0, 0]
ans = 1
for a in X:
ptn = sum(a == v for v in ctr)
ans = ans * ptn % MOD
if ans == 0:
break
for i in range(3):
if ctr[i] == a:
ctr[i] += 1
break
pr... | 13 | 20 | 249 | 323 | N, *A = list(map(int, open(0).read().split()))
MOD = 10**9 + 7
ctr = [0] * 3
ans = 1
for a in A:
ans *= sum(a == v for v in ctr)
for j in range(3):
if ctr[j] == a:
ctr[j] += 1
break
print((ans % MOD))
| N = int(eval(input()))
X = list(map(int, input().split()))
MOD = 10**9 + 7
ctr = [0, 0, 0]
ans = 1
for a in X:
ptn = sum(a == v for v in ctr)
ans = ans * ptn % MOD
if ans == 0:
break
for i in range(3):
if ctr[i] == a:
ctr[i] += 1
break
print(ans)
| false | 35 | [
"-N, *A = list(map(int, open(0).read().split()))",
"+N = int(eval(input()))",
"+X = list(map(int, input().split()))",
"-ctr = [0] * 3",
"+ctr = [0, 0, 0]",
"-for a in A:",
"- ans *= sum(a == v for v in ctr)",
"- for j in range(3):",
"- if ctr[j] == a:",
"- ctr[j] += 1",
"... | false | 0.061244 | 0.039935 | 1.533601 | [
"s890687168",
"s996199389"
] |
u707124227 | p03319 | python | s285540562 | s611373058 | 40 | 19 | 13,812 | 4,280 | Accepted | Accepted | 52.5 | import math
n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
c=math.ceil((n-1)/(k-1))
print(c) | n,k=list(map(int,input().split()))
a=eval(input())
print(((n-1+k-2)//(k-1))) | 5 | 3 | 111 | 64 | import math
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
c = math.ceil((n - 1) / (k - 1))
print(c)
| n, k = list(map(int, input().split()))
a = eval(input())
print(((n - 1 + k - 2) // (k - 1)))
| false | 40 | [
"-import math",
"-",
"-a = list(map(int, input().split()))",
"-c = math.ceil((n - 1) / (k - 1))",
"-print(c)",
"+a = eval(input())",
"+print(((n - 1 + k - 2) // (k - 1)))"
] | false | 0.048265 | 0.123468 | 0.390909 | [
"s285540562",
"s611373058"
] |
u285891772 | p03018 | python | s216504390 | s412126127 | 180 | 66 | 14,688 | 10,808 | Accepted | Accepted | 63.33 | 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, log
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, log
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | 55 | 36 | 1,332 | 1,090 | 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,
log,
)
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,
log,
)
from itertools import (
accumulate,
permutations,
combinations,
... | false | 34.545455 | [
"-t = \"\"",
"-i = 0",
"-while i < len(s):",
"- if s[i : i + 2] == \"BC\":",
"- t += \"D\"",
"- i += 2",
"- else:",
"- t += s[i]",
"- i += 1",
"-D_cnt = []",
"+s = s.replace(\"BC\", \"D\")",
"-for x in t[::-1]:",
"- if x == \"D\":",
"+ans = 0",
"+for ... | false | 0.046459 | 0.137261 | 0.338471 | [
"s216504390",
"s412126127"
] |
u192154323 | p03013 | python | s080226471 | s645747126 | 504 | 154 | 45,016 | 13,288 | Accepted | Accepted | 69.44 | import sys
sys.setrecursionlimit(1000000)
mod = 1000000007
n,m = list(map(int,input().split()))
good = [True] * (n+1)
for _ in range(m):
x = int(eval(input()))
good[x] = False
dp = [0] * (n+1)
dp[0] = 1
for i in range(n):
# 出発点になれるなら、のみでOK
# Falseの部分が更新されることはあっても、出発点になれないから
... | n,m = list(map(int,input().split()))
broken = [0] * (n+1)
mod = 10**9+7
for i in range(m):
broken[int(eval(input()))] = 1
dp = [0] * (n+1)
dp[0] = 1
if broken[1]:
dp[1] = 0
else:
dp[1] = 1
for i in range(2,n+1):
if not broken[i]:
dp[i] = (dp[i-1] + dp[i-2])%mod
print((dp[n]))
... | 26 | 18 | 495 | 307 | import sys
sys.setrecursionlimit(1000000)
mod = 1000000007
n, m = list(map(int, input().split()))
good = [True] * (n + 1)
for _ in range(m):
x = int(eval(input()))
good[x] = False
dp = [0] * (n + 1)
dp[0] = 1
for i in range(n):
# 出発点になれるなら、のみでOK
# Falseの部分が更新されることはあっても、出発点になれないから
if good[i]:
... | n, m = list(map(int, input().split()))
broken = [0] * (n + 1)
mod = 10**9 + 7
for i in range(m):
broken[int(eval(input()))] = 1
dp = [0] * (n + 1)
dp[0] = 1
if broken[1]:
dp[1] = 0
else:
dp[1] = 1
for i in range(2, n + 1):
if not broken[i]:
dp[i] = (dp[i - 1] + dp[i - 2]) % mod
print((dp[n]))
| false | 30.769231 | [
"-import sys",
"-",
"-sys.setrecursionlimit(1000000)",
"-mod = 1000000007",
"-good = [True] * (n + 1)",
"-for _ in range(m):",
"- x = int(eval(input()))",
"- good[x] = False",
"+broken = [0] * (n + 1)",
"+mod = 10**9 + 7",
"+for i in range(m):",
"+ broken[int(eval(input()))] = 1",
"... | false | 0.046428 | 0.086508 | 0.536693 | [
"s080226471",
"s645747126"
] |
u620157187 | p02934 | python | s090871465 | s408086805 | 147 | 17 | 12,400 | 2,940 | Accepted | Accepted | 88.44 | import numpy as np
N = int(eval(input()))
A = [int(x) for x in input().split()]
A_sum = 0
for i in A:
A_sum += 1/i
print((1/A_sum)) | N = int(eval(input()))
A = list(map(int, input().split()))
A_sum = 0
for i in A:
A_sum += 1/i
print((1/A_sum)) | 10 | 8 | 143 | 119 | import numpy as np
N = int(eval(input()))
A = [int(x) for x in input().split()]
A_sum = 0
for i in A:
A_sum += 1 / i
print((1 / A_sum))
| N = int(eval(input()))
A = list(map(int, input().split()))
A_sum = 0
for i in A:
A_sum += 1 / i
print((1 / A_sum))
| false | 20 | [
"-import numpy as np",
"-",
"-A = [int(x) for x in input().split()]",
"+A = list(map(int, input().split()))"
] | false | 0.034538 | 0.102517 | 0.336894 | [
"s090871465",
"s408086805"
] |
u287132915 | p02802 | python | s221380311 | s257202567 | 307 | 190 | 14,552 | 88,040 | Accepted | Accepted | 38.11 | n, m = list(map(int, input().split()))
p, s = [], []
for i in range(m):
pi, si = input().split()
p.append(int(pi))
s.append(si)
lst_ac = [0 for i in range(n+1)]
for i in range(m):
if s[i] == 'AC':
lst_ac[p[i]] = 1
ans_ac = sum(lst_ac)
out = 0
for i in range(m):
if s[i] == 'W... | n, m = list(map(int, input().split()))
pena = [0 for i in range(n)]
cor = set([])
for i in range(m):
pi, si = input().split()
pi = int(pi) - 1
if si == 'AC':
cor.add(pi)
else:
if pi not in cor:
pena[pi] += 1
ans = 0
for i in cor:
ans += pena[i]
print((len(... | 21 | 16 | 449 | 323 | n, m = list(map(int, input().split()))
p, s = [], []
for i in range(m):
pi, si = input().split()
p.append(int(pi))
s.append(si)
lst_ac = [0 for i in range(n + 1)]
for i in range(m):
if s[i] == "AC":
lst_ac[p[i]] = 1
ans_ac = sum(lst_ac)
out = 0
for i in range(m):
if s[i] == "WA" and lst_ac[p... | n, m = list(map(int, input().split()))
pena = [0 for i in range(n)]
cor = set([])
for i in range(m):
pi, si = input().split()
pi = int(pi) - 1
if si == "AC":
cor.add(pi)
else:
if pi not in cor:
pena[pi] += 1
ans = 0
for i in cor:
ans += pena[i]
print((len(cor), ans))
| false | 23.809524 | [
"-p, s = [], []",
"+pena = [0 for i in range(n)]",
"+cor = set([])",
"- p.append(int(pi))",
"- s.append(si)",
"-lst_ac = [0 for i in range(n + 1)]",
"-for i in range(m):",
"- if s[i] == \"AC\":",
"- lst_ac[p[i]] = 1",
"-ans_ac = sum(lst_ac)",
"-out = 0",
"-for i in range(m):",
... | false | 0.037375 | 0.034772 | 1.074862 | [
"s221380311",
"s257202567"
] |
u969850098 | p03014 | python | s017943249 | s985853212 | 1,910 | 1,435 | 312,840 | 221,832 | Accepted | Accepted | 24.87 | def main():
H, W = list(map(int, input().split()))
matrix = [list(eval(input())) for _ in range(H)]
L = [[0 for _ in range(W)] for _ in range(H)]
R = [[0 for _ in range(W)] for _ in range(H)]
D = [[0 for _ in range(W)] for _ in range(H)]
U = [[0 for _ in range(W)] for _ in range(H)]
... | def main():
H, W = list(map(int, input().split()))
matrix = [list(eval(input())) for _ in range(H)]
count_matrix = [[0 for _ in range(W)] for _ in range(H)]
# 横方向についてカウントする
for i in range(H):
start = 0
count = 0
for j in range(W):
s = matrix[i][j]
... | 53 | 48 | 1,484 | 1,358 | def main():
H, W = list(map(int, input().split()))
matrix = [list(eval(input())) for _ in range(H)]
L = [[0 for _ in range(W)] for _ in range(H)]
R = [[0 for _ in range(W)] for _ in range(H)]
D = [[0 for _ in range(W)] for _ in range(H)]
U = [[0 for _ in range(W)] for _ in range(H)]
# 左方向につい... | def main():
H, W = list(map(int, input().split()))
matrix = [list(eval(input())) for _ in range(H)]
count_matrix = [[0 for _ in range(W)] for _ in range(H)]
# 横方向についてカウントする
for i in range(H):
start = 0
count = 0
for j in range(W):
s = matrix[i][j]
if s... | false | 9.433962 | [
"- L = [[0 for _ in range(W)] for _ in range(H)]",
"- R = [[0 for _ in range(W)] for _ in range(H)]",
"- D = [[0 for _ in range(W)] for _ in range(H)]",
"- U = [[0 for _ in range(W)] for _ in range(H)]",
"- # 左方向についてカウントする",
"+ count_matrix = [[0 for _ in range(W)] for _ in range(H)]",
... | false | 0.048114 | 0.042924 | 1.120907 | [
"s017943249",
"s985853212"
] |
u912237403 | p02410 | python | s077397804 | s841547655 | 30 | 20 | 4,556 | 4,540 | Accepted | Accepted | 33.33 | def f():return list(map(int,input().split()))
n,m = f()
A = [f() for _ in [0]*n]
B = [eval(input()) for _ in [0]*m]
for i in range(n):
print(sum([A[i][j]*B[j] for j in range(m)])) | def f():return list(map(int,input().split()))
n,m = f()
A = [f() for _ in [0]*n]
B = [int(input()) for _ in [0]*m]
for i in range(n):
print(sum([A[i][j]*B[j] for j in range(m)])) | 6 | 6 | 177 | 186 | def f():
return list(map(int, input().split()))
n, m = f()
A = [f() for _ in [0] * n]
B = [eval(input()) for _ in [0] * m]
for i in range(n):
print(sum([A[i][j] * B[j] for j in range(m)]))
| def f():
return list(map(int, input().split()))
n, m = f()
A = [f() for _ in [0] * n]
B = [int(input()) for _ in [0] * m]
for i in range(n):
print(sum([A[i][j] * B[j] for j in range(m)]))
| false | 0 | [
"-B = [eval(input()) for _ in [0] * m]",
"+B = [int(input()) for _ in [0] * m]"
] | false | 0.056827 | 0.042823 | 1.327 | [
"s077397804",
"s841547655"
] |
u562935282 | p03054 | python | s730910739 | s030204054 | 120 | 110 | 4,024 | 4,024 | Accepted | Accepted | 8.33 | import sys
input = sys.stdin.readline
def main():
h, w, n = list(map(int, input().split()))
y, x = list(map(int, input().split()))
y -= 1
x -= 1
s, t = input().rstrip(), input().rstrip()
u, d, l, r = 0, h - 1, 0, w - 1
for ss, tt in zip(s[::-1], t[::-1]):
if tt ==... | def main():
h, w, n = list(map(int, input().split()))
y, x = list(map(int, input().split()))
s, t = eval(input()), eval(input())
u, d, l, r = 1, h, 1, w
for ss, tt in zip(s[::-1], t[::-1]):
if tt == 'U':
d = min(d + 1, h)
elif tt == 'D':
u = max(u... | 47 | 40 | 950 | 846 | import sys
input = sys.stdin.readline
def main():
h, w, n = list(map(int, input().split()))
y, x = list(map(int, input().split()))
y -= 1
x -= 1
s, t = input().rstrip(), input().rstrip()
u, d, l, r = 0, h - 1, 0, w - 1
for ss, tt in zip(s[::-1], t[::-1]):
if tt == "U":
... | def main():
h, w, n = list(map(int, input().split()))
y, x = list(map(int, input().split()))
s, t = eval(input()), eval(input())
u, d, l, r = 1, h, 1, w
for ss, tt in zip(s[::-1], t[::-1]):
if tt == "U":
d = min(d + 1, h)
elif tt == "D":
u = max(u - 1, 1)
... | false | 14.893617 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-",
"-",
"- y -= 1",
"- x -= 1",
"- s, t = input().rstrip(), input().rstrip()",
"- u, d, l, r = 0, h - 1, 0, w - 1",
"+ s, t = eval(input()), eval(input())",
"+ u, d, l, r = 1, h, 1, w",
"- d = min(d + 1, h - 1)",... | false | 0.048614 | 0.047317 | 1.027422 | [
"s730910739",
"s030204054"
] |
u945181840 | p03221 | python | s516897332 | s517399869 | 818 | 491 | 38,396 | 46,044 | Accepted | Accepted | 39.98 | from operator import itemgetter
N, M = list(map(int, input().split()))
P = [0] * M
Y = [0] * M
for i in range(M):
P[i], Y[i] = list(map(int, input().split()))
n = [i for i in range(M)]
P, Y, n = list(zip(*sorted(zip(P, Y, n), key=itemgetter(0, 1))))
count = 1
ans = []
ans.append(str(P[0]).zfill(6... | import sys
from operator import itemgetter
read = sys.stdin.read
N, M, *PY = list(map(int, read().split()))
P = PY[::2]
Y = PY[1::2]
P, Y, I = list(zip(*sorted(zip(P, Y, list(range(M))), key=itemgetter(0, 1))))
P = list(map(str, P))
answer = []
prev_p = ''
n = 0
for p, i in zip(P, I):
if prev_p ==... | 26 | 25 | 581 | 515 | from operator import itemgetter
N, M = list(map(int, input().split()))
P = [0] * M
Y = [0] * M
for i in range(M):
P[i], Y[i] = list(map(int, input().split()))
n = [i for i in range(M)]
P, Y, n = list(zip(*sorted(zip(P, Y, n), key=itemgetter(0, 1))))
count = 1
ans = []
ans.append(str(P[0]).zfill(6) + str(count).zfi... | import sys
from operator import itemgetter
read = sys.stdin.read
N, M, *PY = list(map(int, read().split()))
P = PY[::2]
Y = PY[1::2]
P, Y, I = list(zip(*sorted(zip(P, Y, list(range(M))), key=itemgetter(0, 1))))
P = list(map(str, P))
answer = []
prev_p = ""
n = 0
for p, i in zip(P, I):
if prev_p == p:
n += ... | false | 3.846154 | [
"+import sys",
"-N, M = list(map(int, input().split()))",
"-P = [0] * M",
"-Y = [0] * M",
"-for i in range(M):",
"- P[i], Y[i] = list(map(int, input().split()))",
"-n = [i for i in range(M)]",
"-P, Y, n = list(zip(*sorted(zip(P, Y, n), key=itemgetter(0, 1))))",
"-count = 1",
"-ans = []",
"-an... | false | 0.036667 | 0.040866 | 0.89723 | [
"s516897332",
"s517399869"
] |
u713674793 | p02390 | python | s850326557 | s430613105 | 20 | 10 | 5,580 | 4,628 | Accepted | Accepted | 50 |
S = int(input())
print(S//3600, S // 60 % 60,S%60, sep = ':')
| n = eval(input())
print("%d:%d:%d"%(n/3600, n%3600/60, n%60))
| 6 | 2 | 71 | 56 | S = int(input())
print(S // 3600, S // 60 % 60, S % 60, sep=":")
| n = eval(input())
print("%d:%d:%d" % (n / 3600, n % 3600 / 60, n % 60))
| false | 66.666667 | [
"-S = int(input())",
"-print(S // 3600, S // 60 % 60, S % 60, sep=\":\")",
"+n = eval(input())",
"+print(\"%d:%d:%d\" % (n / 3600, n % 3600 / 60, n % 60))"
] | false | 0.063527 | 0.109397 | 0.580707 | [
"s850326557",
"s430613105"
] |
u156264038 | p02682 | python | s658270988 | s083426312 | 65 | 58 | 61,848 | 61,632 | Accepted | Accepted | 10.77 | a, b, c, k = list(map(int, input().split()))
if k > a + b:
print((a - (k - a - b)))
elif k > a:
print(a)
else:
print(k) | a, b, c, k = list(map(int, input().split()))
if k <= a+b:
print((min(k, a)))
else:
print((min(a, (a - (k - (b+a))))))
| 8 | 5 | 131 | 120 | a, b, c, k = list(map(int, input().split()))
if k > a + b:
print((a - (k - a - b)))
elif k > a:
print(a)
else:
print(k)
| a, b, c, k = list(map(int, input().split()))
if k <= a + b:
print((min(k, a)))
else:
print((min(a, (a - (k - (b + a))))))
| false | 37.5 | [
"-if k > a + b:",
"- print((a - (k - a - b)))",
"-elif k > a:",
"- print(a)",
"+if k <= a + b:",
"+ print((min(k, a)))",
"- print(k)",
"+ print((min(a, (a - (k - (b + a))))))"
] | false | 0.035545 | 0.044067 | 0.806617 | [
"s658270988",
"s083426312"
] |
u638456847 | p03835 | python | s126269278 | s787796304 | 1,492 | 791 | 2,940 | 2,940 | Accepted | Accepted | 46.98 | K,S=list(map(int, input().split()))
ans=0
for x in range(K+1):
for y in range(K+1):
z=S-x-y
if 0<= z <=K:
ans+=1
print(ans) | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
K,S = list(map(int, readline().split()))
ans = 0
for x in range(K+1):
for y in range(K+1):
if 0 <= S - x - y <= K:
ans += 1
print(ans)
if ... | 10 | 19 | 160 | 350 | K, S = list(map(int, input().split()))
ans = 0
for x in range(K + 1):
for y in range(K + 1):
z = S - x - y
if 0 <= z <= K:
ans += 1
print(ans)
| import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
K, S = list(map(int, readline().split()))
ans = 0
for x in range(K + 1):
for y in range(K + 1):
if 0 <= S - x - y <= K:
ans += 1
print(ans)
if __name__ == "... | false | 47.368421 | [
"-K, S = list(map(int, input().split()))",
"-ans = 0",
"-for x in range(K + 1):",
"- for y in range(K + 1):",
"- z = S - x - y",
"- if 0 <= z <= K:",
"- ans += 1",
"-print(ans)",
"+import sys",
"+",
"+read = sys.stdin.read",
"+readline = sys.stdin.readline",
"+rea... | false | 0.084814 | 0.040884 | 2.074519 | [
"s126269278",
"s787796304"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.