buggy stringlengths 1 618k | fixed stringlengths 16 618k | buggy_submission_id stringlengths 10 10 | fixed_submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | lang stringclasses 1
value | buggy_verdict stringclasses 2
values |
|---|---|---|---|---|---|---|
import sys
def SI(): return sys.stdin.readline().strip()
def main():
s = SI()
t = SI()
import collections
didx = collections.defaultdict(int)
d = collections.defaultdict(list)
for i, c in enumerate(s):
d[c].append(i)
keys = d.keys()
for c in set(t):
if c not in keys:
... | import sys
def SI(): return sys.stdin.readline().strip()
def main():
s = SI()
t = SI()
import collections
d = collections.defaultdict(list)
for i, c in enumerate(s):
d[c].append(i)
keys = d.keys()
for c in set(t):
if c not in keys:
print(-1)
return
... | s043291870 | s317295092 | p02937 | python | Time Limit Exceeded |
import sys
def SI(): return sys.stdin.readline().strip()
def main():
s = SI()
t = SI()
d = {}
for i, c in enumerate(s):
if c not in d:
d[c] = [i]
else:
d[c].append(i)
import collections
didx = collections.defaultdict(int)
keys = d.keys()
for c ... | import sys
def SI(): return sys.stdin.readline().strip()
def main():
s = SI()
t = SI()
import collections
d = collections.defaultdict(list)
for i, c in enumerate(s):
d[c].append(i)
keys = d.keys()
for c in set(t):
if c not in keys:
print(-1)
return
... | s909945658 | s317295092 | p02937 | python | Time Limit Exceeded |
import sys
def SI(): return sys.stdin.readline().strip()
def main():
s = SI()
t = SI()
d = {}
for i, c in enumerate(s):
if c not in d.keys():
d[c] = [i]
else:
d[c].append(i)
import collections
didx = collections.defaultdict(int)
keys = d.keys()
... | import sys
def SI(): return sys.stdin.readline().strip()
def main():
s = SI()
t = SI()
import collections
d = collections.defaultdict(list)
for i, c in enumerate(s):
d[c].append(i)
keys = d.keys()
for c in set(t):
if c not in keys:
print(-1)
return
... | s691586159 | s317295092 | p02937 | python | Time Limit Exceeded |
import sys
def SI(): return sys.stdin.readline().strip()
def main():
s = SI()
t = SI()
d = {}
for i, c in enumerate(s):
if c not in d.keys():
d[c] = [i]
else:
d[c].append(i)
import collections
didx = collections.defaultdict(int)
for c in t:
... | import sys
def SI(): return sys.stdin.readline().strip()
def main():
s = SI()
t = SI()
import collections
d = collections.defaultdict(list)
for i, c in enumerate(s):
d[c].append(i)
keys = d.keys()
for c in set(t):
if c not in keys:
print(-1)
return
... | s826470363 | s317295092 | p02937 | python | Time Limit Exceeded |
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.read... | import sys
def SI(): return sys.stdin.readline().strip()
def main():
s = SI()
t = SI()
import collections
d = collections.defaultdict(list)
for i, c in enumerate(s):
d[c].append(i)
keys = d.keys()
for c in set(t):
if c not in keys:
print(-1)
return
... | s811742426 | s317295092 | p02937 | python | Time Limit Exceeded |
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.read... | import sys
def SI(): return sys.stdin.readline().strip()
def main():
s = SI()
t = SI()
import collections
d = collections.defaultdict(list)
for i, c in enumerate(s):
d[c].append(i)
keys = d.keys()
for c in set(t):
if c not in keys:
print(-1)
return
... | s315495473 | s317295092 | p02937 | python | Time Limit Exceeded |
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.read... | import sys
def SI(): return sys.stdin.readline().strip()
def main():
s = SI()
t = SI()
import collections
d = collections.defaultdict(list)
for i, c in enumerate(s):
d[c].append(i)
keys = d.keys()
for c in set(t):
if c not in keys:
print(-1)
return
... | s646073108 | s317295092 | p02937 | python | Time Limit Exceeded |
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.read... | import sys
def SI(): return sys.stdin.readline().strip()
def main():
s = SI()
t = SI()
import collections
d = collections.defaultdict(list)
for i, c in enumerate(s):
d[c].append(i)
keys = d.keys()
for c in set(t):
if c not in keys:
print(-1)
return
... | s349882748 | s317295092 | p02937 | python | Time Limit Exceeded |
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.read... | import sys
def SI(): return sys.stdin.readline().strip()
def main():
s = SI()
t = SI()
import collections
d = collections.defaultdict(list)
for i, c in enumerate(s):
d[c].append(i)
keys = d.keys()
for c in set(t):
if c not in keys:
print(-1)
return
... | s027592812 | s317295092 | p02937 | python | Time Limit Exceeded |
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.read... | import sys
def SI(): return sys.stdin.readline().strip()
def main():
s = SI()
t = SI()
import collections
d = collections.defaultdict(list)
for i, c in enumerate(s):
d[c].append(i)
keys = d.keys()
for c in set(t):
if c not in keys:
print(-1)
return
... | s069361042 | s317295092 | p02937 | python | Runtime Error |
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.read... | import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.read... | s896215068 | s038570981 | p02960 | python | Time Limit Exceeded |
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.read... | import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.read... | s650772094 | s038570981 | p02960 | python | Time Limit Exceeded |
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.read... | import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.read... | s531767556 | s038570981 | p02960 | python | Time Limit Exceeded |
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.read... | import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.read... | s720789753 | s038570981 | p02960 | python | Time Limit Exceeded |
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.read... | import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.read... | s759615791 | s038570981 | p02960 | python | Time Limit Exceeded |
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.read... | import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.read... | s563350334 | s201092214 | p02973 | python | Time Limit Exceeded |
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.read... | import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.read... | s587450476 | s201092214 | p02973 | python | Time Limit Exceeded |
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.read... | import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.read... | s960398231 | s201092214 | p02973 | python | Time Limit Exceeded |
import sys
sys.setrecursionlimit(10 ** 7)
debug = True
debug = False
def dprint(*objects):
if debug == True:
print(*objects)
def solve():
N = int(input())
a_list = list(map(int, input().split()))
import collections
c = collections.Counter(a_list)
keys = sorted(c.keys())
nk = len(... | import sys
sys.setrecursionlimit(10 ** 7)
debug = True
debug = False
def dprint(*objects):
if debug == True:
print(*objects)
def solve():
N = int(input())
a_list = list(map(int, input().split()))
a_list.sort()
import collections
c = collections.Counter(a_list)
keys = sorted(c.... | s789089469 | s197486809 | p02975 | python | Runtime Error |
import sys
sys.setrecursionlimit(10 ** 7)
debug = True
debug = False
def dprint(*objects):
if debug == True:
print(*objects)
def solve():
N = int(input())
a_list = list(map(int, input().split()))
# a[0] からスタート
found = False
start = a_list[0]
second = 0
third = 0
for i in ... | import sys
sys.setrecursionlimit(10 ** 7)
debug = True
debug = False
def dprint(*objects):
if debug == True:
print(*objects)
def solve():
N = int(input())
a_list = list(map(int, input().split()))
a_list.sort()
import collections
c = collections.Counter(a_list)
keys = sorted(c.... | s383973087 | s197486809 | p02975 | python | Time Limit Exceeded |
import sys
sys.setrecursionlimit(10 ** 7)
debug = True
debug = False
def dprint(*objects):
if debug == True:
print(*objects)
def solve():
N = int(input())
A = list(map(int, input().split()))
def check(A, x):
ans = [x]
for i in range(1, N):
tmp = A[i - 1] - ans[i... | import sys
sys.setrecursionlimit(10 ** 7)
debug = True
debug = False
def dprint(*objects):
if debug == True:
print(*objects)
def solve():
N = int(input())
A = list(map(int, input().split()))
def check(A, x):
ans = [x]
for i in range(1, N):
tmp = A[i - 1] - ans[... | s939126703 | s271941846 | p02984 | python | Time Limit Exceeded |
import sys
sys.setrecursionlimit(10**7)
debug = True
debug = False
def dprint(*objects):
if debug == True:
print(*objects)
def solve():
N = int(input())
A = list(map(int, input().split()))
def check(A, x):
ans = [x]
for i in range(1, N):
tmp = A[i-1] - ans[i-1]... | import sys
sys.setrecursionlimit(10 ** 7)
debug = True
debug = False
def dprint(*objects):
if debug == True:
print(*objects)
def solve():
N = int(input())
A = list(map(int, input().split()))
def check(A, x):
ans = [x]
for i in range(1, N):
tmp = A[i - 1] - ans[... | s964767280 | s271941846 | p02984 | python | Time Limit Exceeded |
import sys
sys.setrecursionlimit(10**7)
debug = True
debug = False
def dprint(*objects):
if debug == True:
print(*objects)
def solve():
N = int(input())
a_list = list(map(int, input().split()))
import numpy as np
q = np.zeros(shape=(N, N))
for i in range(N):
for j in range(N)... | import sys
sys.setrecursionlimit(10 ** 7)
debug = True
debug = False
def dprint(*objects):
if debug == True:
print(*objects)
def solve():
N = int(input())
A = list(map(int, input().split()))
def check(A, x):
ans = [x]
for i in range(1, N):
tmp = A[i - 1] - ans[... | s816190173 | s271941846 | p02984 | python | Runtime Error |
import sys
sys.setrecursionlimit(10**7)
debug = True
#debug = False
def dprint(*objects):
if debug == True:
print(*objects)
mx = 10**9 + 7
from math import factorial
# def npr(n, r):
# ans = math.factorial(n+r) // (math.factorial(n) * math.factorial(r))
# return ans
def ncr(n, r):
a = facto... | import sys
sys.setrecursionlimit(10**7)
debug = True
#debug = False
def dprint(*objects):
if debug == True:
print(*objects)
mx = 10**9 + 7
from math import factorial
# def npr(n, r):
# ans = math.factorial(n+r) // (math.factorial(n) * math.factorial(r))
# return ans
def ncr(n, r):
a = facto... | s210981622 | s186165327 | p02990 | python | Runtime Error |
import sys
sys.setrecursionlimit(10**7)
debug = True
debug = False
def dprint(*objects):
if debug == True:
print(*objects)
def dmatprint(mat):
if debug == True:
for row in mat:
for col in row:
print("{0:2d} ".format(col), end="")
print("")
print... | import sys
sys.setrecursionlimit(10**7)
debug = True
debug = False
def dprint(*objects):
if debug == True:
print(*objects)
def dmatprint(mat):
if debug == True:
for row in mat:
for col in row:
print("{0:2d} ".format(col), end="")
print("")
print... | s980458039 | s902715376 | p03014 | python | Time Limit Exceeded |
import sys
sys.setrecursionlimit(10**7)
import numpy as np
debug = True
debug = False
def dprint(*objects):
if debug == True:
print(*objects)
def dmatprint(mat):
if debug == True:
for row in mat:
for col in row:
print("{0:2d} ".format(col), end="")
prin... | import sys
sys.setrecursionlimit(10**7)
debug = True
debug = False
def dprint(*objects):
if debug == True:
print(*objects)
def dmatprint(mat):
if debug == True:
for row in mat:
for col in row:
print("{0:2d} ".format(col), end="")
print("")
print... | s830267268 | s902715376 | p03014 | python | Time Limit Exceeded |
import sys
sys.setrecursionlimit(10**7)
import numpy as np
#debug = True
debug = False
def dprint(*objects):
if debug == True:
print(*objects)
def solve():
H, W = map(int, input().split())
s_arr = np.zeros(shape=(H, W))
for h in range(H):
s_row = input()
for w in range(W):
... | import sys
sys.setrecursionlimit(10**7)
debug = True
debug = False
def dprint(*objects):
if debug == True:
print(*objects)
def dmatprint(mat):
if debug == True:
for row in mat:
for col in row:
print("{0:2d} ".format(col), end="")
print("")
print... | s245484239 | s902715376 | p03014 | python | Runtime Error |
import sys
sys.setrecursionlimit(10**7)
import numpy as np
def solve():
H, W = map(int, input().split())
s_arr = np.zeros(shape=(H, W))
for h in range(H):
s_row = input()
for w in range(W):
if s_row[w] == ".":
s_arr[h, w] = 0
else:
s_... | import sys
sys.setrecursionlimit(10**7)
debug = True
debug = False
def dprint(*objects):
if debug == True:
print(*objects)
def dmatprint(mat):
if debug == True:
for row in mat:
for col in row:
print("{0:2d} ".format(col), end="")
print("")
print... | s743528438 | s902715376 | p03014 | python | Time Limit Exceeded |
import sys
sys.setrecursionlimit(10**7)
import numpy as np
#debug = True
debug = False
def dprint(*objects):
if debug == True:
print(*objects)
def solve():
H, W = map(int, input().split())
s_arr = np.zeros(shape=(H, W))
for h in range(H):
s_row = input()
for w in range(W):
... | import sys
sys.setrecursionlimit(10**7)
debug = True
debug = False
def dprint(*objects):
if debug == True:
print(*objects)
def dmatprint(mat):
if debug == True:
for row in mat:
for col in row:
print("{0:2d} ".format(col), end="")
print("")
print... | s682315427 | s902715376 | p03014 | python | Time Limit Exceeded |
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
#debug = True
debug = False
def dprint(*objects):
if debug == True:
print(*objects)
def solve():
l = input()
li = [int(l[i]) for i in range(len(l))]
dprint(li)
# 制約1 a+b は L 以下
# 制約2 a と b で同じけたは 00 01 10 のいずれか
m... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
#debug = True
debug = False
def dprint(*objects):
if debug == True:
print(*objects)
def solve():
l = input().rstrip('\n')
n = len(l)
# 制約1 a+b は L 以下
# 制約2 a と b で同じけたは 00 01 10 のいずれか
mx = 10**9 + 7
same = 1 # iまで... | s521421894 | s010299773 | p03015 | python | Runtime Error |
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
#debug = True
debug = False
def dprint(*objects):
if debug == True:
print(*objects)
def solve():
l = input()
li = [int(l[i]) for i in range(len(l))]
dprint(li)
# 制約1 a+b は L 以下
# 制約2 a と b で同じけたは 00 01 10 のいずれか
m... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
#debug = True
debug = False
def dprint(*objects):
if debug == True:
print(*objects)
def solve():
l = input().rstrip('\n')
n = len(l)
# 制約1 a+b は L 以下
# 制約2 a と b で同じけたは 00 01 10 のいずれか
mx = 10**9 + 7
same = 1 # iまで... | s816555158 | s010299773 | p03015 | python | Runtime Error |
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
#debug = True
debug = False
def dprint(*objects):
if debug == True:
print(*objects)
def solve():
l = input()
li = [int(l[i]) for i in range(len(l))]
dprint(li)
# 制約1 a+b は L 以下
# 制約2 a と b で同じけたは 00 01 10 のいずれか
m... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
#debug = True
debug = False
def dprint(*objects):
if debug == True:
print(*objects)
def solve():
l = input().rstrip('\n')
n = len(l)
# 制約1 a+b は L 以下
# 制約2 a と b で同じけたは 00 01 10 のいずれか
mx = 10**9 + 7
same = 1 # iまで... | s200154219 | s010299773 | p03015 | python | Runtime Error |
class Node: # ノードの型
def __init__(self, height, key, x):
self.height = height # そのノードを根とする部分木の高さ
self.key = key # そのノードのキー
self.value = x # そのノードの値
self.lst = None # 左部分木
self.rst = None # 右部分木
# 部分木 t の高さを返す
def height(t): return 0 if t is None else t.h... | import sys;input=sys.stdin.readline
n,q=map(int, input().split())
event=[]
for _ in range(n):
s,t,x=map(int,input().split())
event.append((s-x-0.5,1,x))
event.append((t-x-0.5,-1,x))
for i in range(q):
event.append((int(input()),0,i))
event.sort()
is_stop=False
stop=set()
minstop=float('inf')
ans=[-1]*... | s352263967 | s871837615 | p03033 | python | Time Limit Exceeded |
class Node: # ノードの型
def __init__(self, height, key, x):
self.height = height # そのノードを根とする部分木の高さ
self.key = key # そのノードのキー
self.value = x # そのノードの値
self.lst = None # 左部分木
self.rst = None # 右部分木
# 部分木 t の高さを返す
def height(t): return 0 if t is None else t.h... | import sys;input=sys.stdin.readline
n,q=map(int, input().split())
event=[]
for _ in range(n):
s,t,x=map(int,input().split())
event.append((s-x-0.5,1,x))
event.append((t-x-0.5,-1,x))
for i in range(q):
event.append((int(input()),0,i))
event.sort()
is_stop=False
stop=set()
minstop=float('inf')
ans=[-1]*... | s199207142 | s871837615 | p03033 | python | Time Limit Exceeded |
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
n, q = map(int, input().split())
event = []
for _ in range(n):
s, t, x = map(int, input().split())
event.append((s - x - 0.5, 1, x))
event.append((t - x - 0.5, -1, x))
for i in range(q):
event.append((int(input()), 0, i))
event.sort()
... | import sys;input=sys.stdin.readline
n,q=map(int, input().split())
event=[]
for _ in range(n):
s,t,x=map(int,input().split())
event.append((s-x-0.5,1,x))
event.append((t-x-0.5,-1,x))
for i in range(q):
event.append((int(input()),0,i))
event.sort()
is_stop=False
stop=set()
minstop=float('inf')
ans=[-1]*... | s561875068 | s871837615 | p03033 | python | Time Limit Exceeded |
import random
class TreapNode(object):
def __init__(self, key, data):
self.key = key
self.ran = random.random()
self.size = 1
self.cnt = 1
self.data = data
self.left = None
self.right = None
def left_rotate(self):
a = self
b = a.right
... | import sys;input=sys.stdin.readline
n,q=map(int, input().split())
event=[]
for _ in range(n):
s,t,x=map(int,input().split())
event.append((s-x-0.5,1,x))
event.append((t-x-0.5,-1,x))
for i in range(q):
event.append((int(input()),0,i))
event.sort()
is_stop=False
stop=set()
minstop=float('inf')
ans=[-1]*... | s773742738 | s871837615 | p03033 | python | Time Limit Exceeded |
import random
class TreapNode(object):
def __init__(self, key, data):
self.key = key
self.ran = random.random()
self.size = 1
self.cnt = 1
self.data = data
self.left = None
self.right = None
def left_rotate(self):
a = self
b = a.right
... | import sys;input=sys.stdin.readline
n,q=map(int, input().split())
event=[]
for _ in range(n):
s,t,x=map(int,input().split())
event.append((s-x-0.5,1,x))
event.append((t-x-0.5,-1,x))
for i in range(q):
event.append((int(input()),0,i))
event.sort()
is_stop=False
stop=set()
minstop=float('inf')
ans=[-1]*... | s124288363 | s871837615 | p03033 | python | Time Limit Exceeded |
import queue
class Node(object):
"""docstring for Node"""
def __init__(self, data=None):
super(Node, self).__init__()
self.data = data
self.left = None
self.right = None
class BST(object):
"""docstring for BST"""
def __init__(self):
super(BST, self).__init__... | import sys;input=sys.stdin.readline
n,q=map(int, input().split())
event=[]
for _ in range(n):
s,t,x=map(int,input().split())
event.append((s-x-0.5,1,x))
event.append((t-x-0.5,-1,x))
for i in range(q):
event.append((int(input()),0,i))
event.sort()
is_stop=False
stop=set()
minstop=float('inf')
ans=[-1]*... | s691210322 | s871837615 | p03033 | python | Time Limit Exceeded |
import sys;input=sys.stdin.readline
n, q = map(int, input().split())
event = []
for _ in range(n):
s, t, x = map(int, input().split())
event.append((s-x-0.5, 1, x))
event.append((t-x-0.5, -1, x))
for i in range(q):
event.append((int(input()), 0, i))
event.sort()
stop = set()
ans = []
idx = []
for t,e... | import sys;input=sys.stdin.readline
n,q=map(int, input().split())
event=[]
for _ in range(n):
s,t,x=map(int,input().split())
event.append((s-x-0.5,1,x))
event.append((t-x-0.5,-1,x))
for i in range(q):
event.append((int(input()),0,i))
event.sort()
is_stop=False
stop=set()
minstop=float('inf')
ans=[-1]*... | s842929610 | s871837615 | p03033 | python | Time Limit Exceeded |
import sys
sys.setrecursionlimit(10**7)
debug = True
#debug = False
def dprint(*objects):
if debug == True:
print(*objects)
class Event:
def __repr__(self):
return str(self.__dict__)
class User:
def __repr__(self):
return str(self.__dict__)
def solve():
n, q = map(in... | import sys;input=sys.stdin.readline
n,q=map(int, input().split())
event=[]
for _ in range(n):
s,t,x=map(int,input().split())
event.append((s-x-0.5,1,x))
event.append((t-x-0.5,-1,x))
for i in range(q):
event.append((int(input()),0,i))
event.sort()
is_stop=False
stop=set()
minstop=float('inf')
ans=[-1]*... | s050459864 | s871837615 | p03033 | python | Runtime Error |
import sys
sys.setrecursionlimit(10**7)
debug = True
#debug = False
def dprint(*objects):
if debug == True:
print(*objects)
class Event:
def __repr__(self):
return str(self.__dict__)
class User:
def __repr__(self):
return str(self.__dict__)
def solve():
n, q = map(in... | import sys;input=sys.stdin.readline
n,q=map(int, input().split())
event=[]
for _ in range(n):
s,t,x=map(int,input().split())
event.append((s-x-0.5,1,x))
event.append((t-x-0.5,-1,x))
for i in range(q):
event.append((int(input()),0,i))
event.sort()
is_stop=False
stop=set()
minstop=float('inf')
ans=[-1]*... | s286974544 | s871837615 | p03033 | python | Runtime Error |
import sys;input=sys.stdin.readline
n, q = map(int, input().split())
event = []
for _ in range(n):
s, t, x = map(int, input().split())
event.append((s-x-0.5, 1, x))
event.append((t-x-0.5, -1, x))
for i in range(q):
event.append((int(input()), 0, i))
event.sort()
stop = set()
ans={}
for t,e,x in event:... | import sys;input=sys.stdin.readline
n,q=map(int, input().split())
event=[]
for _ in range(n):
s,t,x=map(int,input().split())
event.append((s-x-0.5,1,x))
event.append((t-x-0.5,-1,x))
for i in range(q):
event.append((int(input()),0,i))
event.sort()
is_stop=False
stop=set()
minstop=float('inf')
ans=[-1]*... | s422728524 | s871837615 | p03033 | python | Time Limit Exceeded |
import sys;input=sys.stdin.readline
n,q=map(int, input().split())
event=[]
for _ in range(n):
s,t,x=map(int,input().split())
event.append((s-x-0.5,1,x))
event.append((t-x-0.5,-1,x))
for i in range(q):
event.append((int(input()),0,i))
event.sort()
stop=set()
ans=[-1]*q
for t,e,x in event:
if e > 0:... | import sys;input=sys.stdin.readline
n,q=map(int, input().split())
event=[]
for _ in range(n):
s,t,x=map(int,input().split())
event.append((s-x-0.5,1,x))
event.append((t-x-0.5,-1,x))
for i in range(q):
event.append((int(input()),0,i))
event.sort()
is_stop=False
stop=set()
minstop=float('inf')
ans=[-1]*... | s551607087 | s871837615 | p03033 | python | Time Limit Exceeded |
import sys
sys.setrecursionlimit(10**7)
debug = True
#debug = False
def dprint(*objects):
if debug == True:
print(*objects)
class Event:
def __repr__(self):
return str(self.__dict__)
def solve():
n, q = map(int, input().split())
l_event = []
for i in range(n):
s, t, x... | import sys;input=sys.stdin.readline
n,q=map(int, input().split())
event=[]
for _ in range(n):
s,t,x=map(int,input().split())
event.append((s-x-0.5,1,x))
event.append((t-x-0.5,-1,x))
for i in range(q):
event.append((int(input()),0,i))
event.sort()
is_stop=False
stop=set()
minstop=float('inf')
ans=[-1]*... | s193181385 | s871837615 | p03033 | python | Time Limit Exceeded |
import sys
sys.setrecursionlimit(10**7)
class Event:
def __repr__(self):
return str(self.__dict__)
class User:
def __repr__(self):
return str(self.__dict__)
def solve():
n, q = map(int, input().split())
l_event = []
for i in range(n):
s, t, x = map(int, input().spl... | import sys;input=sys.stdin.readline
n,q=map(int, input().split())
event=[]
for _ in range(n):
s,t,x=map(int,input().split())
event.append((s-x-0.5,1,x))
event.append((t-x-0.5,-1,x))
for i in range(q):
event.append((int(input()),0,i))
event.sort()
is_stop=False
stop=set()
minstop=float('inf')
ans=[-1]*... | s827059657 | s871837615 | p03033 | python | Runtime Error |
import sys
sys.setrecursionlimit(10**7)
debug = True
#debug = False
def dprint(*objects):
if debug == True:
print(*objects)
class Event:
def __repr__(self):
return str(self.__dict__)
class User:
def __repr__(self):
return str(self.__dict__)
def solve():
n, q = map(in... | import sys;input=sys.stdin.readline
n,q=map(int, input().split())
event=[]
for _ in range(n):
s,t,x=map(int,input().split())
event.append((s-x-0.5,1,x))
event.append((t-x-0.5,-1,x))
for i in range(q):
event.append((int(input()),0,i))
event.sort()
is_stop=False
stop=set()
minstop=float('inf')
ans=[-1]*... | s182599116 | s871837615 | p03033 | python | Time Limit Exceeded |
import sys
sys.setrecursionlimit(10**7)
class Event:
def __repr__(self):
return str(self.__dict__)
class User:
def __repr__(self):
return str(self.__dict__)
def solve():
n, q = map(int, input().split())
l_event = []
for i in range(n):
s, t, x = map(int, input().spl... | import sys;input=sys.stdin.readline
n,q=map(int, input().split())
event=[]
for _ in range(n):
s,t,x=map(int,input().split())
event.append((s-x-0.5,1,x))
event.append((t-x-0.5,-1,x))
for i in range(q):
event.append((int(input()),0,i))
event.sort()
is_stop=False
stop=set()
minstop=float('inf')
ans=[-1]*... | s449895951 | s871837615 | p03033 | python | Runtime Error |
import sys
sys.setrecursionlimit(10**7)
class Event:
def __repr__(self):
return str(self.__dict__)
def solve():
n, q = map(int, input().split())
l_event = []
for i in range(n):
s, t, x = map(int, input().split())
# 追加イベント
e = Event()
e.time = s-x
e.... | import sys;input=sys.stdin.readline
n,q=map(int, input().split())
event=[]
for _ in range(n):
s,t,x=map(int,input().split())
event.append((s-x-0.5,1,x))
event.append((t-x-0.5,-1,x))
for i in range(q):
event.append((int(input()),0,i))
event.sort()
is_stop=False
stop=set()
minstop=float('inf')
ans=[-1]*... | s168488340 | s871837615 | p03033 | python | Time Limit Exceeded |
import sys
sys.setrecursionlimit(10**7)
import numpy as np
# n = int(input())
# a, b = map(int, input().split())
# int_list = list(map(int, input().split()))
# l = list(input().split())
def solve():
s_list = []
t_list = []
x_list = []
d_list = []
n, q = map(int, input().split())
dict_x_by_d = {... | import sys;input=sys.stdin.readline
n,q=map(int, input().split())
event=[]
for _ in range(n):
s,t,x=map(int,input().split())
event.append((s-x-0.5,1,x))
event.append((t-x-0.5,-1,x))
for i in range(q):
event.append((int(input()),0,i))
event.sort()
is_stop=False
stop=set()
minstop=float('inf')
ans=[-1]*... | s798168605 | s871837615 | p03033 | python | Time Limit Exceeded |
import sys
sys.setrecursionlimit(10**7)
import numpy as np
# n = int(input())
# a, b = map(int, input().split())
# int_list = list(map(int, input().split()))
# l = list(input().split())
def solve():
b_list = []
c_list = []
n, m = map(int, input().split())
a_list = list(map(int, input().split()))
fo... | import sys
sys.setrecursionlimit(10**7)
import numpy as np
from collections import defaultdict
d = defaultdict(int)
# n = int(input())
# a, b = map(int, input().split())
# int_list = list(map(int, input().split()))
# l = list(input().split())
def solve():
# b_list = []
# c_list = []
n, m = map(int, input()... | s376113343 | s863768473 | p03038 | python | Time Limit Exceeded |
import sys
sys.setrecursionlimit(10**7)
import numpy as np
# n = int(input())
# a, b = map(int, input().split())
# int_list = list(map(int, input().split()))
# l = list(input().split())
def solve():
b_list = []
c_list = []
n, m = map(int, input().split())
a_list = list(map(int, input().split()))
fo... | import sys
sys.setrecursionlimit(10**7)
import numpy as np
from collections import defaultdict
d = defaultdict(int)
# n = int(input())
# a, b = map(int, input().split())
# int_list = list(map(int, input().split()))
# l = list(input().split())
def solve():
# b_list = []
# c_list = []
n, m = map(int, input()... | s563565015 | s863768473 | p03038 | python | Time Limit Exceeded |
import sys
sys.setrecursionlimit(10**7)
import numpy as np
# n = int(input())
# a, b = map(int, input().split())
# int_list = list(map(int, input().split()))
# l = list(input().split())
def solve():
b_list = []
c_list = []
n, m = map(int, input().split())
a_list = list(map(int, input().split()))
fo... | import sys
sys.setrecursionlimit(10**7)
import numpy as np
from collections import defaultdict
d = defaultdict(int)
# n = int(input())
# a, b = map(int, input().split())
# int_list = list(map(int, input().split()))
# l = list(input().split())
def solve():
# b_list = []
# c_list = []
n, m = map(int, input()... | s229093882 | s863768473 | p03038 | python | Time Limit Exceeded |
noded = {}
edad = {}
class Node:
def __init__(self, index):
self.index = index
self.color = -1
self.eda_list = []
class Eda:
def __init__(self, index, w, left, right):
self.index = index
self.w = w
self.left = left
self.right = right
def color_oppo_of(n... | import sys
sys.setrecursionlimit(10**7)
noded = {}
edad = {}
class Node:
def __init__(self, index):
self.index = index
self.color = -1
self.eda_list = []
class Eda:
def __init__(self, index, w, left, right):
self.index = index
self.w = w
self.left = left
... | s539463866 | s007231072 | p03044 | python | Runtime Error |
noded = {}
edad = {}
class Node:
def __init__(self, index):
self.index = index
self.color = -1
self.eda_list = []
class Eda:
def __init__(self, index, w, left, right):
self.index = index
self.w = w
self.left = left
self.right = right
def color_oppo_of(n... | import sys
sys.setrecursionlimit(10**7)
noded = {}
edad = {}
class Node:
def __init__(self, index):
self.index = index
self.color = -1
self.eda_list = []
class Eda:
def __init__(self, index, w, left, right):
self.index = index
self.w = w
self.left = left
... | s651976065 | s007231072 | p03044 | python | Runtime Error |
n, k = map(int, input().split())
s = input()
blk_list = []
for i in range(len(s)):
if i==0:
blk = {'n':0, 's':s[i]}
if i > 1 and s[i-1]!=s[i]:
blk_list.append(blk)
blk = {'n':0, 's':s[i]}
blk['n'] += 1
blk_list.append(blk)
# iblkの始点を1が連続する箇所の始点とするときの数を見る
mx = 0
for i, blk in enumerate(blk_list):
... | n, k = map(int, input().split())
s = input()
blk_num = []
blk_sum = []
for i in range(len(s)):
if i == 0 or s[i-1]!=s[i]:
if i!= 0:
blk_sum.append(n)
blk_num.append(s[i])
n = 0
n += 1
blk_sum.append(n)
def cumsum(x):
y = []
current = 0
for i in x:
y.append(current + i)
... | s250841654 | s134961168 | p03074 | python | Time Limit Exceeded |
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.read... | import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.read... | s484482936 | s710516333 | p03108 | python | Time Limit Exceeded |
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.read... | import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.read... | s586524781 | s351899754 | p03138 | python | Runtime Error |
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.read... | import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.read... | s820079167 | s174359187 | p03148 | python | Runtime Error |
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.read... | import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.read... | s405122439 | s174359187 | p03148 | python | Runtime Error |
def solve():
c = []
c.append(map(int, input().split()))
c.append(map(int, input().split()))
c.append(map(int, input().split()))
a1_list = range(c[0][0]+1)
for a1 in a1_list:
b1 = c[0][0] - a1
b2 = c[0][1] - a1
b3 = c[0][2] - a1
a2 = c[1][0] - b1
a3 = c[2... | def solve():
c = []
c.append(list(map(int, input().split())))
c.append(list(map(int, input().split())))
c.append(list(map(int, input().split())))
a0_list = range(c[0][0]+1)
for a0 in a0_list:
b0 = c[0][0] - a0
b1 = c[0][1] - a0
b2 = c[0][2] - a0
a1 = c[1][0] - ... | s251155650 | s890334003 | p03435 | python | Runtime Error |
def solve():
h, w = map(int, input().split())
maze = []
for i in range(h):
maze.append(list(map(int, input().split())))
nwall = 0
for i in range(h):
for j in range(w):
if maze[i][j] == '#':
nwall += 1
q = []
q.insert(0, (0,0))
hist = [[0 for ... | def solve():
h, w = map(int, input().split())
maze = []
for i in range(h):
maze.append(input())
# for i in range(h):
# print(maze[i])
nwall = 0
for i in range(h):
for j in range(w):
if maze[i][j] == '#':
nwall += 1
q = []
q.insert(0,... | s823039329 | s459990942 | p03436 | python | Runtime Error |
k = int(input())
a = list(map(int, input().split()))
def solve():
if a[k-1] != 2:
print(-1)
return
mi = 2
mx = 2
for i in range(k):
j = k-i-1
mx = mx + a[j] - 1
if j == 0:
pass
else:
na = a[j-1]
# if mx < na:
... | k = int(input())
a = list(map(int, input().split()))
def solve():
if a[k-1] != 2:
print(-1)
return
mi = 2
mx = 2
for i in range(k):
j = k-i-1
mx = mx + a[j] - 1
if j == 0:
pass
else:
na = a[j-1]
if mx %... | s031170771 | s736783947 | p03464 | python | Time Limit Exceeded |
k = int(input())
a = list(map(int, input().split()))
def solve():
if a[k-1] != 2:
print(-1)
return
mi = 2
mx = 2
for i in range(k):
j = k-i-1
mx = mx + a[j] - 1
if j == 0:
pass
else:
na = a[j-1]
# if mx < na:
... | k = int(input())
a = list(map(int, input().split()))
def solve():
if a[k-1] != 2:
print(-1)
return
mi = 2
mx = 2
for i in range(k):
j = k-i-1
mx = mx + a[j] - 1
if j == 0:
pass
else:
na = a[j-1]
if mx %... | s254508435 | s736783947 | p03464 | python | Time Limit Exceeded |
k = int(input())
a = list(map(int, input().split()))
def solve():
if k == 1:
if a[0] == 2:
print(2, 3)
return
else:
print(-1)
return
can = []
for i in range(k):
if i==0:
can = [2]
elif i > 1 and i != k-1:
... | k = int(input())
a = list(map(int, input().split()))
def solve():
if a[k-1] != 2:
print(-1)
return
mi = 2
mx = 2
for i in range(k):
j = k-i-1
mx = mx + a[j] - 1
if j == 0:
pass
else:
na = a[j-1]
if mx %... | s886651336 | s736783947 | p03464 | python | Runtime Error |
k = int(input())
a = list(map(int, input().split()))
def solve():
can = []
res = []
for i in range(k):
a_ = a[k-i-1]
if i==0:
res = [2]
else:
res = []
for c in can:
if c % a_ == 0:
res.append(c)
if... | k = int(input())
a = list(map(int, input().split()))
def solve():
if a[k-1] != 2:
print(-1)
return
mi = 2
mx = 2
for i in range(k):
j = k-i-1
mx = mx + a[j] - 1
if j == 0:
pass
else:
na = a[j-1]
if mx %... | s169925567 | s736783947 | p03464 | python | Runtime Error |
k = int(input())
a = list(map(int, input().split()))
can = []
res = []
def solve():
for i in range(k):
a_ = a[k-i-1]
if i==0:
res = [2]
else:
res = []
for c in can:
if c % a_ == 0:
res.append(c)
if len(re... | k = int(input())
a = list(map(int, input().split()))
def solve():
if a[k-1] != 2:
print(-1)
return
mi = 2
mx = 2
for i in range(k):
j = k-i-1
mx = mx + a[j] - 1
if j == 0:
pass
else:
na = a[j-1]
if mx %... | s610074941 | s736783947 | p03464 | python | Runtime Error |
n, h = input().split()
n = int(n)
h = int(h)
a = []
b = []
for i in range(n):
a_, b_ = input().split()
a.append(int(a_))
b.append(int(b_))
import numpy as np
a = np.array(a)
b = np.array(b)
to_throw = b[b>max(a)]
sum_throw = sum(to_throw)
d = h - sum_throw
if d <= 0:
cum = np.cumsum(np.sort(b)[::-1... | n, h = input().split()
n = int(n)
h = int(h)
a = []
b = []
for i in range(n):
a_, b_ = input().split()
a.append(int(a_))
b.append(int(b_))
import numpy as np
a = np.array(a)
b = np.array(b)
to_throw = b[b>max(a)]
sum_throw = sum(to_throw)
d = h - sum_throw
if d <= 0:
cum = np.cumsum(np.sort(to_thro... | s558862920 | s774388127 | p03472 | python | Runtime Error |
import numpy as np
N, K = map(int, input().split())
a = list(map(int, input().split()))
a = np.array(a)
def solve():
u, c = np.unique(a, return_counts=True)
k = len(u) - K
if len(u) > K:
print(np.sum(np.sort(c)[:k]))
else:
print(0)
solve() | import numpy as np
N, K = map(int, input().split())
a = list(map(int, input().split()))
def uniq(a):
d = {}
for a_ in a:
if a_ not in d:
d[a_] = 1
else:
d[a_] += 1
return d.keys(), d.values()
def solve():
u, c = uniq(a)
k = len(u) - K
if len(u) > K:
... | s928625769 | s011160886 | p03497 | python | Runtime Error |
def solve():
n = int(input())
a = list(map(int, input().split()))
one = n*(n+1)/2
if sum(a) % one != 0:
print("NO")
else:
nop = sum(a) / one
d = [0 for i in range(n)]
for i in range(n):
d[i] = a[(i+1)%n] - a[i]
d[i] = d[i] - nop
count = 0
for i i... |
def solve():
n = int(input())
a = list(map(int, input().split()))
one = n*(n+1)/2
if sum(a) % one != 0:
print("NO")
return
else:
nop = sum(a) / one
d = [0 for i in range(n)]
for i in range(n):
d[i] = a[(i+1)%n] - a[i]
d[i] = d[i] - nop
count =... | s773329139 | s823048624 | p03808 | python | Runtime Error |
import fraction
def lcm(x, y):
return (x * y) // fraction.gcd(x, y)
N = int(input())
T = [int(input()) for i in range(N)]
ans = 1
for value in range(0, N):
ans = lcm(ans, T[value])
print(ans) | def gcd(a, b):
while b:
a, b = b, a % b
return a
def lcm(x, y):
return (x * y) // gcd(x, y)
N = int(input())
T = [int(input()) for i in range(N)]
ans = 1
for value in range(0, N):
ans = lcm(ans, T[value])
print(ans) | s637721587 | s904582757 | p03633 | python | Runtime Error |
import math
def lcm(x, y):
return (x * y) // math.gcd(x, y)
N = int(input())
T = []
for i in range(0, N):
T.append(input())
ans = 1
for value in range(0, N):
ans = lcm(ans, int(T[value]))
print(str(ans)) | def gcd(a, b):
while b:
a, b = b, a % b
return a
def lcm(x, y):
return (x * y) // gcd(x, y)
N = int(input())
T = [int(input()) for i in range(N)]
ans = 1
for value in range(0, N):
ans = lcm(ans, T[value])
print(ans) | s434222904 | s904582757 | p03633 | python | Runtime Error |
N = input()
a = [input() for i in range(N)]
d = [a[0],a[1]]
b = [a[2],a[3]]
s = min(d) + min(b)
print(s) | # -*- coding: utf-8 -*-
import sys
import os
d = [int(input()), int(input())]
b = [int(input()), int(input())]
s = min(d) + min(b)
print(s) | s236755820 | s448262701 | p03399 | python | Runtime Error |
import numpy as np
ans=1000000000000
N=int(input())
for i in range(1,N+1):
if (N%i==0):
j=N//i
move=(i-1)+(j-1)
ans=min(ans,move)
print(ans) | import numpy as np
ans=1000000000000
N=int(input())
for i in range(1,int(np.sqrt(N)+1)):
if (N%i==0):
j=N//i
move=(i-1)+(j-1)
ans=min(ans,move)
print(ans) | s672171286 | s320149847 | p02881 | python | Time Limit Exceeded |
from math import gcd
n = int(input())
a = list(map(int, input().split()))
forward = []
backward = [0 for x in range(n)]
if n == 2:
print(max(a[0], a[1]))
exit(0)
for i in range(n):
if i == 0:
forward.append(a[i])
else:
forward.append(gcd(forward[i - 1], a[i]))
for i in range(n - 1,... | from fractions import gcd
n = int(input())
a = list(map(int, raw_input().split()))
forward = []
backward = [0 for x in range(n)]
if n == 2:
print(max(a[0], a[1]))
exit(0)
for i in range(n):
if i == 0:
forward.append(a[i])
else:
forward.append(gcd(forward[i - 1], a[i]))
for i in ran... | s725980669 | s390017483 | p03061 | python | Runtime Error |
from fractions import gcd
n = int(input())
a = list(map(int, raw_input().split()))
forward = []
backward = [0 for x in range(n)]
if n == 2:
print(max(a[0], a[1]))
exit(0)
for i in range(n):
if i == 0:
forward.append(a[i])
else:
forward.append(gcd(forward[i - 1], a[i]))
for i in ran... | from fractions import gcd
n = int(input())
a = list(map(int, raw_input().split()))
forward = []
backward = [0 for x in range(n)]
if n == 2:
print(max(a[0], a[1]))
exit(0)
for i in range(n):
if i == 0:
forward.append(a[i])
else:
forward.append(gcd(forward[i - 1], a[i]))
for i in ran... | s561355497 | s390017483 | p03061 | python | Runtime Error |
from fractions import gcd
n = int(input())
a = list(map(int, input().split()))
forward = []
backward = [0 for x in range(n)]
if n == 2:
print(max(a[0], a[1]))
exit(0)
for i in range(n):
if i == 0:
forward.append(a[i])
else:
forward.append(gcd(forward[i - 1], a[i]))
for i in range(n... | from fractions import gcd
n = int(input())
a = list(map(int, raw_input().split()))
forward = []
backward = [0 for x in range(n)]
if n == 2:
print(max(a[0], a[1]))
exit(0)
for i in range(n):
if i == 0:
forward.append(a[i])
else:
forward.append(gcd(forward[i - 1], a[i]))
for i in ran... | s941511731 | s390017483 | p03061 | python | Runtime Error |
from fractions import gcd
n = int(input())
a = list(map(int, raw_input().split()))
forward = []
backward = [0 for x in range(n)]
if n == 2:
print(max(a[0], a[1]))
exit(0)
for i in range(n):
if i == 0:
forward.append(a[i])
else:
forward.append(gcd(forward[i - 1], a[i]))
for i in ran... | from fractions import gcd
n = int(input())
a = list(map(int, raw_input().split()))
forward = []
backward = [0 for x in range(n)]
if n == 2:
print(max(a[0], a[1]))
exit(0)
for i in range(n):
if i == 0:
forward.append(a[i])
else:
forward.append(gcd(forward[i - 1], a[i]))
for i in ran... | s996772569 | s390017483 | p03061 | python | Runtime Error |
import math
a,b,c = map(int,input(),split())
n = math.pow((c-a-b),2)
m = 4*a*b
if(a+b >= c)
print("No")
else
if(n > m)
print("Yes")
else
print("No") | import math
a,b,c = map(int,input().split())
l = 4*a*b
r = (c-a-b)**2
if (a+b >= c):
print("No")
else:
if(l < r):
print("Yes")
else:
print("No")
| s351262266 | s245187972 | p02743 | python | Runtime Error |
import math
a,b,c = map(int,input(),split())
n = math.pow((c-a-b),2)
m = 4*a*b
if(a+b >= c):
print("No")
else:
if(n > m):
print("Yes")
else:
print("No") | import math
a,b,c = map(int,input().split())
l = 4*a*b
r = (c-a-b)**2
if (a+b >= c):
print("No")
else:
if(l < r):
print("Yes")
else:
print("No")
| s316938779 | s245187972 | p02743 | python | Runtime Error |
import math
a,b,c = map(int,input(),split())
n = (c-a-b)**2
m = a*b*4
if(a+b >= c):
print("No")
else:
if(n < m):
print("Yes")
else:
print("No") | import math
a,b,c = map(int,input().split())
l = 4*a*b
r = (c-a-b)**2
if (a+b >= c):
print("No")
else:
if(l < r):
print("Yes")
else:
print("No")
| s901433360 | s245187972 | p02743 | python | Runtime Error |
import math
a,b,c = map(int,input(),split())
n = (c-a-b)**2
m = a*b*4
if((a+b) >= c):
print("No")
else:
if(n < m):
print("Yes")
else:
print("No") | import math
a,b,c = map(int,input().split())
l = 4*a*b
r = (c-a-b)**2
if (a+b >= c):
print("No")
else:
if(l < r):
print("Yes")
else:
print("No")
| s336589452 | s245187972 | p02743 | python | Runtime Error |
import math
a,b,c = map(int,input(),split())
n = math.pow((c-(a-b)), 2)
m = a*b*4
if((a+b) >= c):
print("no")
else:
if(n < m):
print("yes")
else:
print("no") | import math
a,b,c = map(int,input().split())
l = 4*a*b
r = (c-a-b)**2
if (a+b >= c):
print("No")
else:
if(l < r):
print("Yes")
else:
print("No")
| s653045276 | s245187972 | p02743 | python | Runtime Error |
import math
a,b,c = map(input(),split())
n = math.pow((c-(a-b)), 2)
m = a*b*4
if((a+b) >= c):
print("no")
else:
if(n < m):
print("yes")
else:
print("no") | import math
a,b,c = map(int,input().split())
l = 4*a*b
r = (c-a-b)**2
if (a+b >= c):
print("No")
else:
if(l < r):
print("Yes")
else:
print("No")
| s474435068 | s245187972 | p02743 | python | Runtime Error |
import math
a,b,c = map(input(),split())
n = math.Pow((c-(a-b)), 2)
m = a*b*4
if((a+b) >= c):
print("no")
else:
if(n < m):
print("yes")
else:
print("no") | import math
a,b,c = map(int,input().split())
l = 4*a*b
r = (c-a-b)**2
if (a+b >= c):
print("No")
else:
if(l < r):
print("Yes")
else:
print("No")
| s973805621 | s245187972 | p02743 | python | Runtime Error |
from collections import defaultdict
adj = defaultdict(list)
col = defaultdict(int)
mx=0
edges = {}
def find_color(u , p):
global mx , now
cnt =0
for i in adj[u]:
cnt = cnt+1
if i==p:
continue
find_color(i , u)
mx = max(mx, cnt)
now =0
def dfs(u , p):
global mx, now
for i in adj[u]:
if i==p:
continue... | import os
import sys
from collections import defaultdict
adj = defaultdict(list)
col = defaultdict(int)
sys.setrecursionlimit(1000000)
mx=0
edges = {}
def find_color(u , p):
global mx , now
cnt =0
for i in adj[u]:
cnt = cnt+1
if i==p:
continue
find_color(i , u)
mx = max(mx, cnt)
now =0
def dfs(u , p, prev)... | s468796753 | s095846160 | p02850 | python | Runtime Error |
from collections import defaultdict
adj = defaultdict(list)
dis =[0 for i in range(1000000)]
def dfs(u , p):
for i , w in adj[u]:
if i==p:
continue
dis[i]=dis[u]+w
dis[i]=dis[i]%2
dfs(i , u)
def main():
n = int(input())
for i in range(n-1):
x, y , w = map(int , input().split())
w = w%2
adj[x].append... | import sys
import os
sys.setrecursionlimit(1000000)
from collections import defaultdict
adj = defaultdict(list)
dis =[0 for i in range(1000000)]
def dfs(u , p):
for i , w in adj[u]:
if i==p:
continue
dis[i]=dis[u]+w
dis[i]=dis[i]%2
dfs(i , u)
def main():
n = int(input())
for i in range(n-1):
x, y , w = ... | s480270264 | s442103552 | p03044 | python | Runtime Error |
# code like professional " write main function"
import os
import sys
from collections import defaultdict
adj = defaultdict(list)
col = defaultdict(int)
sys.setrecursionlimit(1000000)
mx=0
edges = {}
# finding maximum color we need it would be maximum neighbouring nodes of out of all the nodes
def find_color(u , p):
gl... | import sys
import os
sys.setrecursionlimit(1000000)
from collections import defaultdict
adj = defaultdict(list)
dis =[0 for i in range(1000000)]
def dfs(u , p):
for i , w in adj[u]:
if i==p:
continue
dis[i]=dis[u]+w
dis[i]=dis[i]%2
dfs(i , u)
def main():
n = int(input())
for i in range(n-1):
x, y , w = ... | s924771114 | s442103552 | p03044 | python | Runtime Error |
from collections import defaultdict
adj = defaultdict(list)
vis =[0 for i in range(1000000)]
dis =[0 for i in range(1000000)]
def dfs(u, p):
for v, w in adj[u]:
if v==p:
continue
dis[v]=dis[u]+w
dfs(v, u)
def main():
n = int(input())
for i in range(n-1):
a, b, w = map(int , input().split())
adj[a].appe... | import sys
import os
from collections import defaultdict
adj = defaultdict(list)
vis =[0 for i in range(1000000)]
dis =[0 for i in range(1000000)]
def dfs(u, p):
for v, w in adj[u]:
if v==p:
continue
dis[v]=dis[u]+w
dfs(v, u)
def main():
n = int(input())
for i in range(n-1):
a, b, w = map(int , input().s... | s098642942 | s750593779 | p03634 | python | Runtime Error |
n = int(input())
tot=0
dp = [0 for i in range(n+4)]
for i in range(1, n+1):
tot=tot+i
if tot>=n:
print(i)
break | n = int(input())
tot=0
for i in range(1, n+1):
tot=tot+i
if tot>=n:
print(i)
break | s751832082 | s370502987 | p03779 | python | Time Limit Exceeded |
@n, @a, @b, @c = gets.chomp.split(" ").map(&:to_i)
@l = []
@n.times do
@l << gets.chomp.to_i
end
INF = 10**9
def dfs(cur, a, b, c)
if cur == @n
if [a, b, c].min > 0
return (a - @a).abs + (b - @b).abs + (c - @c).abs - 30
else
return INF
end
end
ret0 = dfs(cur + 1, a, b, c)
ret1 = dfs(... | N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10 ** 9
def dfs(cur, a, b, c):
if cur == N:
return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
ret0 = dfs(cur + 1, a, b, c)
ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
ret2 = dfs(cur + 1, a, b + l[cu... | s263876764 | s075959773 | p03111 | python | Runtime Error |
z = input()
if z=='hi' or z=='hihi' or z=='hihihi' or z=='hihihihi' or z=='hihihihihi':
return "Yes"
else:
return "No" | z = input()
if z=='hi' or z=='hihi' or z=='hihihi' or z=='hihihihi' or z=='hihihihihi':
print("Yes")
else:
print("No") | s848436699 | s723582266 | p02747 | python | Runtime Error |
large_s = input()
con = 0
str_check = ""
for i in range(len(large_s)):
z = large_s.find('hi', con, len(large_s))
if (0 <= z):
print(z)
str_check += str(z)
con += 2
if (str_check=='0' or str_check=='02' or str_check=='024' or str_check=='0246' or str_check=='02468'):
print("Yes... | z = input()
if z=='hi' or z=='hihi' or z=='hihihi' or z=='hihihihi' or z=='hihihihihi':
print("Yes")
else:
print("No") | s708782131 | s723582266 | p02747 | python | Runtime Error |
large_s = input()
con = 0
str_check = ""
for i in range(len(large_s)):
z = large_s.find('hi', con, len(large_s))
if (0 <= z):
print(z)
str_check += str(z)
con += 2
if (str_check=='0' or str_check=='02' or str_che... | z = input()
if z=='hi' or z=='hihi' or z=='hihihi' or z=='hihihihi' or z=='hihihihihi':
print("Yes")
else:
print("No") | s538950563 | s723582266 | p02747 | python | Runtime Error |
k = int(input())
x = int(input())
if k*500 < x:
print("No")
else:
print("Yes")
| k,x=(int(x) for x in input().split())
if k*500 < x:
print("No")
else:
print("Yes")
| s417450655 | s324984068 | p02811 | python | Runtime Error |
k = input()
x = input()
if k*500 < x:
print("no")
else:
print("yes")
| k,x=(int(x) for x in input().split())
if k*500 < x:
print("No")
else:
print("Yes")
| s336659175 | s324984068 | p02811 | python | Runtime Error |
k = int(input())
x = int(input())
if k*500 < x:
print("No")
else:
print("Yes")
| k,x=(int(x) for x in input().split())
if k*500 < x:
print("No")
else:
print("Yes")
| s012709179 | s324984068 | p02811 | python | Runtime Error |
A,B,M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
m=[]
for i in range(M):
array = list(map(int, input().strip().split()))
m.append(array)
def hitachi02(a,b,m):
results=[]
for i in range(len(a)):
for j in range(len(b)):
for k in... | A,B,M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
m=[]
for i in range(M):
array = list(map(int, input().strip().split()))
m.append(array)
def hitachi02(a,b,m):
results=[]
cal01=min(a)+min(b)
for k in range(len(m)):
results.append(a[m[k... | s244749137 | s151721234 | p02748 | python | Time Limit Exceeded |
def judge(check_string):
HITACH_STRING = "hi"
if not((1 <= len(check_string)) && (len(check_string) <= 10)):
print("No")
if HITACH_STRING in check_string:
print("Yes")
else:
print("No")
if __name__ == "__main__":
hitachi_string = input()
judge(hitachi_string) | import re
def judge(check_string):
# check length.
if not((1 <= len(check_string)) and (len(check_string) <= 10)):
print("No")
# check character.
allow_pattern = "[a-z]+"
group = re.match(allow_pattern, check_string)
HITACH_STRING = "^(hi){1,}$"
if(re.match(HITACH_STRING, check_... | s587921823 | s055874255 | p02747 | python | Runtime Error |
s = input()
hi = 'hi'
if hi == s:
return "Yes"
elif hi == hi * 2:
return "Yes"
elif hi == hi * 3:
return "Yes"
elif hi == hi ** 4:
return "Yes"
elif hi == hi ** 5:
retrn "Yes"
else:
return "No" | s = input()
if s == 'hi':
print('Yes')
elif s == 'hihi':
print('Yes')
elif s == 'hihihi':
print('Yes')
elif s == 'hihihihi':
print('Yes')
elif s == 'hihihihihi':
print('Yes')
else:
print('No')
| s299352956 | s224518215 | p02747 | python | Runtime Error |
s = input()
if 'hi' in s:
return 'Yes'
else:
return 'No' | s = input()
if s == 'hi':
print('Yes')
elif s == 'hihi':
print('Yes')
elif s == 'hihihi':
print('Yes')
elif s == 'hihihihi':
print('Yes')
elif s == 'hihihihihi':
print('Yes')
else:
print('No')
| s973890952 | s224518215 | p02747 | python | Runtime Error |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.