Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02639 (python)

Fixed submission:
x = input()
a,b,c,d,e = map(int,x.split())
print(15 - a-b-c-d-e)

Buggy submission (verdict: Runtime Error):
x,n = map(int,input().split())
p = input().split()
p.sort()
q = p[::-1]
a = x
b = x
for i in q:
  if a == int(i):
    a -= 1
for i in p:
  if b == int(i):
    b += 1 
if x - a <= b - x:
  print(a)
else:
  print(b)

Buggy submission (verdict: Runtime Error):
x,y = map(int,input().split())
a = 4 * x - y
b = y - 2*x
if a/2 == a//2 and a >= 0 and b/2 == b//2 and b >= 0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
;
Problem p02640 (python)

Fixed submission:
x,y = map(int,input().split())
a = 4 * x - y
b = y - 2*x
if a/2 == a//2 and a >= 0 and b/2 == b//2 and b >= 0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
x,y = map(intinput()split())
a = 4x-y
if a/2 = a%2:
  print('Yes')
else:
  print('No')
Problem p02657 (python)

Fixed submission:
a,b = map(int, input().split())
print(a*b)

Buggy submission (verdict: Runtime Error):
s,w = map(int,input().split)
print(s)

if s<=w:
  print('unsafe')
else:
  print('safe')

Buggy submission (verdict: Runtime Error):

N = int(input())
A = list(map(int,input(). split ()))
  
if 0 in A:
  print(0)
  return
  
prod = 1
for a in A:
  prod *= a
  if prod > 1000000000000000000:
    print(-1)
    return
    
print(prod)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = input().split()
a = 0
b = 1
while 2 * a <= n - 1 :
  b = b * int(x[a]) * int(x[n-1-a])
  a += 1
if b <= 1000000000000000000:
  print(b)
else:
  print(-1)
Problem p02658 (python)

Fixed submission:
n = int(input())
x = input().split()
a = 0
b = 1
if x.count('0') >= 1:
  print(0)
else:
  while a <= n - 1 and b <= 1000000000000000000:
    b = b * int(x[a])
    a += 1
  if b > 1000000000000000000:
    print(-1)
  else:
    print(b)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = input().split()
a = 0
b = 1
while a <= n - 1 or b > 10^8:
  b = b * int(x[a])
  a += 1
if b > 10^8:
  print('-1')
else:
  print(b)
Problem p02675 (python)

Fixed submission:
x = input()
x = x[::-1]
x = int(x[0])


if x == 3:
  print('bon')
else:
  if x == 0 or x == 1 or x == 6 or x == 8:
    print('pon')
  else:
    print('hon')

Buggy submission (verdict: Runtime Error):
def main():
  x = input()

  if int(x[0:0:-1]) == 3:
    print('bon')
  else:
    if  0 or 1 or 6 or 8 in int(x[0:0:-1]):
      print('pon')
    else:
      print('hon')

main()
Problem p02681 (python)

Fixed submission:
s = input()
t = input()
a = len(s)

if len(s) <=10 and len(s) >= 1 and len(t) == len(s) + 1 and t[0:a] == s[0:a]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
a = len(s)

if len(x) <=10 and len(x) >= 1 and len(t) == len(s) + 1 and t[0:a] == s[0:a]:
  print('yes')
else:
  print('no')
Problem p02687 (python)

Fixed submission:
s = str(input())

if s == 'ABC':
  print('ARC')
else:
  if s == 'ARC':
    print('ABC')

Buggy submission (verdict: Runtime Error):
s = str(input())

if s == ABC:
  print('ARC')
else:
  if s == ARC:
    print('ABC')
Problem p02717 (python)

Fixed submission:
a = input().split()
print(a[2] +' ' +a[0]+' ' + a[1])

Buggy submission (verdict: Runtime Error):
a = input().split()
print(a[3] +' ' +a[1]+' ' + a[2])
Problem p02658 (python)

Fixed submission:
def main():
    n = int(input())
    l = list(map(int, input().split()))
    ans = 1
    
    if 0 in l:
      print(0)
      return
 
    for x in l:
        ans = ans*x
        if(ans > 1000000000000000000):
            print(-1)
            return
    print(ans)
 
main()

Buggy submission (verdict: Runtime Error):
def main():
  n = int(input())

	l = list(map(int, input().split()))

	ans = 1

  for x in l:
    ans = ans*x
    if(ans > 1000000000000000000):
      print(-1)
      return


  print(ans)

main()

Buggy submission (verdict: Runtime Error):
n = int(input())

l = list(map(int, input().split()))

for x in l:
  ans = ans*x
  
if(ans > 1000000000000000000):
  print(-1)
else:
  print(ans)
Problem p02628 (python)

Fixed submission:
n, k = map(int, input().split())
price = list(map(int, input().split()))
print(sum(sorted(price)[:k]))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
prices = list(map(input().split()))
print(sum(sorted(prices[:k])))
Problem p02662 (python)

Fixed submission:
n,s,*a=map(int,open(0).read().split())
mod=998244353
d=[0]*(s+1)
d[0]=1
for x in a:
	p=[0]*(s+1)
	for i in range(s+1):
		p[i]+=d[i]*2
		if i+x<=s:
			p[i+x]+=d[i]
		p[i]%=mod
	d=p
print(d[-1])

Buggy submission (verdict: Runtime Error):
import numpy as np
n,s,*a=map(int,open(0).read().split())
mod=998244353
d=np.zeros(s+1,dtype=np.int64)
d[0]=1
for x in a:
	p=d*2
	p[x:]+=d[:s-x+1]
	p%=mod
	d=p
print(d[-1])
Problem p02703 (python)

Fixed submission:
from heapq import *
import sys
input = sys.stdin.buffer.readline
n, m, s = map(int, input().split())
lim = 2510
di = [[float("inf")] * lim for _ in range(n)]
di[0][min(s,lim-1)] = 0
con = [[] for _ in range(n)]
for _ in range(m):
	u, v, a, b = map(int, input().split())
	con[u - 1].append((v - 1, a, b))
	con[v - 1].append((u - 1, a, b))
q = [(0, min(s,lim-1), 0)]
cd = [list(map(int, input().split())) for _ in range(n)]
while q:
	time, have, cur = heappop(q)
	if di[cur][have] < time:
		continue
	c, d = cd[cur]
	if have + c < lim and di[cur][have + c] > time + d:
		di[cur][have + c] = time + d
		heappush(q, (time + d, have + c, cur))
	for nxt, dh, dt in con[cur]:
		if have >= dh and di[nxt][have - dh] > time + dt:
			di[nxt][have - dh] = time + dt
			heappush(q, (time + dt, have - dh, nxt))
for p in di[1:]:
	print(min(p))

Buggy submission (verdict: Runtime Error):
from heapq import *
import sys
input = sys.stdin.buffer.readline
n, m, s = map(int, input().split())
lim = 2510
di = [[float("inf")] * lim for _ in range(n)]
di[0][s] = 0
con = [[] for _ in range(n)]
for _ in range(m):
	u, v, a, b = map(int, input().split())
	con[u - 1].append((v - 1, a, b))
	con[v - 1].append((u - 1, a, b))
q = [(0, s, 0)]
cd = [list(map(int, input().split())) for _ in range(n)]
while q:
	time, have, cur = heappop(q)
	if di[cur][have] < time:
		continue
	c, d = cd[cur]
	if have + c < lim and di[cur][have + c] > time + d:
		di[cur][have + c] = time + d
		heappush(q, (time + d, have + c, cur))
	for nxt, dh, dt in con[cur]:
		if have >= dh and di[nxt][have - dh] > time + dt:
			di[nxt][have - dh] = time + dt
			heappush(q, (time + dt, have - dh, nxt))
for p in di[1:]:
	print(min(p))
Problem p02728 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1234567890)

n, *L = map(int, open(0).read().split())
mod = 10 ** 9 + 7
con = [[] for _ in range(n + 1)]
sz = [1] * (n + 1)
par = [0] * (n + 1)

for s, t in zip(*[iter(L)] * 2):
	con[s] += t,
	con[t] += s,


def prepare(m, mod=10 ** 9 + 7):
	fac = [1] * (m + 1)
	inv = [1] * (m + 1)
	for i in range(1, m + 1):
		fac[i] = fac[i - 1] * i % mod
	inv[-1] = pow(fac[-1], mod - 2, mod)
	for i in range(m - 1, -1, -1):
		inv[i] = inv[i + 1] * (i + 1) % mod
	return fac, inv


fac, inv = prepare(n)


def dfs1(cur, pre):
	par[cur] = pre
	for nxt in con[cur]:
		if nxt != pre:
			dfs1(nxt, cur)
			sz[cur] += sz[nxt]
			dp1[cur] *= dp1[nxt] * inv[sz[nxt]] % mod
			dp1[cur] %= mod
	dp1[cur] *= fac[sz[cur] - 1]
	dp1[cur] %= mod


def dfs2(cur, pre):
	dp2[cur] *= dp1[cur] * inv[sz[cur] - 1] % mod
	dp2[cur] %= mod
	dp2[cur] *= fac[n - 1]
	dp2[cur] %= mod
	for nxt in con[cur]:
		if nxt != pre:
			dp2[nxt] = fac[sz[nxt]] * pow(n - sz[nxt], mod - 2, mod) * pow(dp1[nxt], mod - 2, mod) * dp2[cur] * inv[n - 1] % mod
			dfs2(nxt, cur)


dp1 = [1] * (n + 1)
dfs1(1, 0)
dp2 = [1] * (n + 1)
dfs2(1, 0)

print(*dp2[1:], sep="\n")

Buggy submission (verdict: Runtime Error):
n, *L = map(int, open(0).read().split())
mod = 10 ** 9 + 7
con = [[] for _ in range(n + 1)]
sz = [1] * (n + 1)
par = [0] * (n + 1)

for s, t in zip(*[iter(L)] * 2):
	con[s] += t,
	con[t] += s,


def prepare(m, mod=10 ** 9 + 7):
	fac = [1] * (m + 1)
	inv = [1] * (m + 1)
	for i in range(1, m + 1):
		fac[i] = fac[i - 1] * i % mod
	inv[-1] = pow(fac[-1], mod - 2, mod)
	for i in range(m - 1, -1, -1):
		inv[i] = inv[i + 1] * (i + 1) % mod
	return fac, inv


fac, inv = prepare(n)


def dfs1(cur, pre):
	par[cur] = pre
	for nxt in con[cur]:
		if nxt != pre:
			dfs1(nxt, cur)
			sz[cur] += sz[nxt]
			dp1[cur] *= dp1[nxt] * inv[sz[nxt]] % mod
			dp1[cur] %= mod
	dp1[cur] *= fac[sz[cur] - 1]
	dp1[cur] %= mod


def dfs2(cur, pre):
	dp2[cur] *= dp1[cur] * inv[sz[cur] - 1] % mod
	dp2[cur] %= mod
	dp2[cur] *= fac[n - 1]
	dp2[cur] %= mod
	for nxt in con[cur]:
		if nxt != pre:
			dp2[nxt] = fac[sz[nxt]] * pow(n - sz[nxt], mod - 2, mod) * pow(dp1[nxt], mod - 2, mod) * dp2[cur] * inv[n - 1] % mod
			dfs2(nxt, cur)


dp1 = [1] * (n + 1)
dfs1(1, 0)
dp2 = [1] * (n + 1)
dfs2(1, 0)

print(*dp2[1:], sep="\n")
Problem p02805 (python)

Fixed submission:
import sys
input = sys.stdin.buffer.readline
from itertools import combinations
from math import hypot
n=int(input())
P=[tuple(map(int,input().split())) for _ in range(n)]
ans=1e9
for p1,p2 in combinations(P,2):
	X,Y=(p1[0]+p2[0])/2,(p1[1]+p2[1])/2
	r=0
	for x,y in P:
		t=hypot(X-x,Y-y)
		if r<t:r=t
	if ans>r:ans=r
if n>2:
	ans_=1e9
	for p1,p2,p3 in combinations(P,3):
		a=hypot(p2[0]-p3[0],p2[1]-p3[1])
		b=hypot(p3[0]-p1[0],p3[1]-p1[1])
		c=hypot(p1[0]-p2[0],p1[1]-p2[1])
		if (a+b+c)-2*max(a,b,c)<1e-8:continue
		s,t,u=(-a*a+b*b+c*c)*a*a,(a*a-b*b+c*c)*b*b,(a*a+b*b-c*c)*c*c
		X=(s*p1[0]+t*p2[0]+u*p3[0])/(s+t+u)
		Y=(s*p1[1]+t*p2[1]+u*p3[1])/(s+t+u)
		r=0
		for x,y in P:
			t=hypot(X-x,Y-y)
			if r<t:r=t
		if ans_>r:ans_=r
	# print(ans_)
	ans=min(ans,ans_)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.buffer.readline
from itertools import combinations
from math import sqrt

n=int(input())
P=[tuple(map(int,input().split())) for _ in range(n)]

def R(*L):
	a,b,c=[sqrt((p1[0]-p2[0])**2+(p1[1]-p2[1])**2)for p1,p2 in zip(L,L[1:]+L)]
	s=(a+b+c)/2
	return sqrt(s*(s-a)*(s-b)*(s-c))*4/(a*b*c)

ans=max(sqrt((p1[0]-p2[0])**2+(p1[1]-p2[1])**2)for p1,p2 in combinations(P,2))
if n>2:
	ans_=max(R(*L) for L in combinations(P,3))
	ans=max(ans,ans_)
print(ans/2)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.buffer.readline
from itertools import combinations
from math import sqrt

n=int(input())
P=[tuple(map(int,input().split())) for _ in range(n)]
P+=[P[0]]

def R(*L):
	a,b,c=[sqrt((p1[0]-p2[0])**2+(p1[1]-p2[1])**2)for p1,p2 in zip(L,L[1:]+L)]
	s=(a+b+c)/2
	return sqrt(s*(s-a)*(s-b)*(s-c))

ans=max(sqrt((p1[0]-p2[0])**2+(p1[1]-p2[1])**2)for p1,p2 in combinations(P,2))
ans_=max(R(*L) for L in combinations(P,3))
print(max(ans,ans_)/2)
Problem p02852 (python)

Fixed submission:
n,m=map(int,input().split())
su=input()
rev=su[::-1]
if "1"*m in su:
	print(-1)
	exit()
dist_f_n=[float('inf')]*(n+1)
dist_f_n[0]=0
for i in range(1,m+1):
	if rev[i]=="0":
		dist_f_n[i]=1
		last=i
		if i==n:
			break
while last<n:
	for i in range(last+1,last+m+1):
		if rev[i]=="0":
			dist_f_n[i]=dist_f_n[last]+1
			_last=i
			if i==n:
				break
	last=_last
cur=dist_f_n[-1]
_i=0
ans=[]
for i,x in enumerate(dist_f_n[::-1]):
	if x==cur-1:
		ans.append(i-_i)
		cur-=1
		_i=i
print(" ".join(map(str,ans)))

Buggy submission (verdict: Runtime Error):
def main():
	n, m = map(int, input().split())
	rev = input()[::-1]
	ans = []
	cur = 0
	while cur < n:
		for i in range(cur + 1, cur + m + 1):
			if i==n:
				nxt = i
				break
			if rev[i]=="0":
				nxt = i
		if cur==nxt:
			print(-1)
			exit()
		ans += [nxt - cur]
		cur = nxt
		if cur==n:
			break
	print(" ".join(map(str, ans[::-1])))


if __name__=="__main__":
	main()
Problem p02861 (python)

Fixed submission:
from itertools import permutations
n = int(input())
div = 1
s = 0
for i in range(1, n + 1):
	div *= i
L = [list(map(int, input().split())) for _ in range(n)]
for x in permutations(range(n), n):
	s += sum(((L[i][0] - L[j][0]) ** 2 + (L[i][1] - L[j][1]) ** 2) ** .5 for i, j in zip(x, x[1:]))
print(s / div)

Buggy submission (verdict: Runtime Error):
n,*L=map(int,open(0).read().split());r=range(0,2*n,2);print(sum(((L[i]-L[j])**2+(L[i+1]-L[j+1])**2)**.5for i in r for j in r))/n)
Problem p02939 (python)

Fixed submission:
s=input()
ans=0
t=c=""
for i in s:
	t+=i
	if c!=t:
		ans+=1
		c=t
		t=""
print(ans)

Buggy submission (verdict: Runtime Error):
a=1;c={"R":0,"G":0,"B":0}
for i in range(int(input())):
	a*=-~i
for i in input():
	s=sorted(c.values())
	c[i]+=1
	if c[i]>s[2]:
		pass
	elif c[i]>s[1]:
		a*=s[2]-s[1]
	else:
		a*=s[1]-s[0]
print(a%998244353)

Buggy submission (verdict: Runtime Error):
from bisect import bisect
from math import factorial
n = int(input())
R,B,G = [],[],[]
m,M,mid = [],[],[]
ans = factorial(n)
for i,j in enumerate(input()):
	if j=="R":
		R += [i]
	elif j=="B":
		B += [i]
	else:
		G += [i]
for r,b,g in zip(R,B,G):
	f,s,t = sorted([r,b,g])
	m += [f]
	M += [t]
	mid += [s]
for i,j in enumerate(mid):
	i = bisect(m,j) - i
	if i > 1:
		ans *= i
for i,j in enumerate(mid[::-1]):
	i = n - i - bisect(M,j)
	if i > 1:
		ans *= i
print(ans)
Problem p02949 (python)

Fixed submission:
n,m,p = map(int,input().split())
graph = [[] for _ in range(n)]
INF = float("inf")
dist = [INF]*n
dist[0] = 0

for _ in range(m):
	f,t,c = map(int,input().split())
	graph[f-1].append((t-1,p-c))
#print(graph)

for _ in range(n):
	update = False
	for f,e in enumerate(graph):
		for t,c in e:
			if dist[f] != INF and dist[t] > dist[f] + c:
				dist[t] = dist[f] + c
				update = True
	if not update:
		break
else:
	prev = dist[-1]
	for _ in range(n):
		update = False
		for f,e in enumerate(graph):
			for t,c in e:
				if dist[f] != INF and dist[t] > dist[f] + c:
					dist[t] = dist[f] + c
					update = True
		if not update:
			break
	if dist[-1] != prev:
		print(-1)
		exit()
#print(dist)

print(max(0,dist[-1]*(-1)))

Buggy submission (verdict: Runtime Error):
n,m,p = map(int,input().split())
graph = [[] for _ in range(n)]
INF = float("inf")
dist = [INF]*n
dist[0] = 0

for _ in range(m):
	f,t,c = map(int,input().split())
	graph[f-1].append((t-1,p-c))
#print(graph)

for _ in range(n):
	update = False
	for f,e in enumerate(graph):
		for t,c in e:
			if dist[f] != INF and dist[t] > dist[f] + c:
				dist[t] = dist[f] + c
				update = True
	if not update:
		break
else:
	prev = dist[-1]
    for _ in range(n):
		for f,e in enumerate(graph):
			for t,c in e:
				if dist[f] != INF and dist[t] > dist[f] + c:
					dist[t] = -INF
	if dist[-1] != prev:
		print(-1)
		exit()
#print(dist)

print(max(0,dist[-1]*(-1)))
Problem p02963 (python)

Fixed submission:
s = int(input())
if s==10**18:
  print(0,0,10**9,0,0,10**9)
else:
  print(0,0,s//10**9+1,1,10**9-s%10**9,10**9)

Buggy submission (verdict: Runtime Error):
s=int(input())
flag=False
if s<=10**9:
  a=1;b=s;c=0;d=1
else:
  a=b=int(s**(1/2))
  while True:
    c = s-a*b
    sc = int(c**(1/2))
    for i in range(sc,sc+100):
      if c%i==0:
        d=i;c=c//i
        flag = True
        break
    if flag or c==0:
      break
    a -= 1
li = [c,0,a+c,d,0,b]
print(a*b+c*d)
for num in li:
  print(num,end=" ")

Buggy submission (verdict: Runtime Error):
s=int(input())
flag=False
if s<=10**9:
  a=1;b=s;c=0;d=1
else:
  a=b=int(s**(1/2))
  while True:
    c = s-a*b
    sc = int(c**(1/2))
    for i in range(sc,sc+100):
      if c%i==0:
        d=i;c=c//i
        flag = True
        break
    if flag or c==0:
      break
    a -= 1
li = [c,0,a,d,0,b]
print(a*b+c*d)
for num in li:
  print(num,end=" ")

Buggy submission (verdict: Runtime Error):
s=int(input())
flag=True
if s<=10**9:
  a=1;b=s;c=0
else:
  a=b=int(s**(1/2))
  c = s-a**2
  d = 1
  if c>10**9:
    sc=int(c**(1/2))
    for i in range(sc,c):
      if c%i==0:
        d=i;c=c//i
        break
li = [0,0,a,d,c,b]
for num in li:
  print(num,end=" ")
Problem p02975 (python)

Fixed submission:
n=int(input())
*a,=map(int,input().split())
s=list(set(a))
s.sort()
ans="No"
if len(s)==1:
  if 0 in s:
    ans="Yes"
elif len(s)==2:
  if a.count(0)*2==a.count(s[1]):
    ans="Yes"
elif len(s)==3 and a.count(s[0])==a.count(s[1])==a.count(s[2]) and s[0]^s[1]^s[2]==0:
  ans="Yes"
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)
n = int(input())
li = list(map(int,input().split()))
a = li[0]
del li[0]

def f(num1,num2,l):
  t = num1^num2
  if len(l) == 1 and t in l:
    return True
  else:
    if t in l:
      l.remove(t)
      return f(num2,t,l)
    else:
      return False

for i in li:
  if not a^i in li:
    continue
  else:
    if f(i,a,li[:]):
      print("Yes")
      exit()
    else:continue
print("No")

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)
n = int(input())
li = list(map(int,input().split()))
a = li[0]
del li[0]

def f(num1,num2,l):
  if l == []:
    return True
  else:
    if num1^num2 in l:
      l.remove(num1^num2)
      return f(num2,num1^num2,l)
    else:
      return False

for i in li:
  if f(a,i,li[1:]):
    print("Yes")
    exit()
  else:continue
print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
li = list(map(int,input().split()))
a = li[0]
del li[0]
def f(num1,num2,l):
  if l == []:
    return True
  else:
    if num1^num2 in l:
      return f(num2,num1^num2,l[1:])
    else:
      return False
for i in li:
  if f(a,i,li[1:]):
    print("Yes")
    exit()
  else:continue
print("No")
Problem p02991 (python)

Fixed submission:
from collections import deque
N,M,*L,S,T = map(int,open(0).read().split())
G = [[] for _ in range(N)]
step = [[-1]*3 for _ in range(N)]
step[S-1][0] = 0
for u,v in zip(*[iter(L)]*2):
	G[u-1].append(v-1)
q = deque([(S-1,0)])
while q:
	cur,d = q.popleft()
	for nxt in G[cur]:
		if nxt==T-1 and (d+1)%3==0:
			print((d+1)//3)
			exit()
		if step[nxt][(d+1)%3] < 0:
			step[nxt][(d+1)%3] = d+1
			q.append((nxt,d+1))
print(-1)

Buggy submission (verdict: Runtime Error):
from collections import deque
N,M,*L,S,T = map(int,open(0).read().split())
G = [[] for _ in range(N)]
step = [0 for _ in range(N)]
step[(S-1)*3] = 0
for u,v in zip(*[iter(L)]*2):
	G[u-1].append(v-1)
q = deque([(S-1,0)])
while q:
	cur,d = q.popleft()
	for nxt in G[cur]:
		if nxt==T-1 and (d+1)%3==0:
			print((d+1)//3)
			exit()
		if not step[nxt] & 1<<((d+1)%3):
			step[nxt] |= 1<<(d+1)%3
			q.append((nxt,d+1))
print(-1)
Problem p02999 (python)

Fixed submission:
x,a = map(int,input().split())
if x < a:
  print(0)
else:
  print(10)

Buggy submission (verdict: Runtime Error):
from itertools import accumulate
n,k = map(int,input().split())
a = list(map(int,input().split()))
cnt = 0
leng = n
for i in range(n):
  aaa = accumulate(a[i:])
  for num,j in enumerate(aaa):
    if j >= k:
      cnt += leng - num
      break
  leng -= 1
print(cnt)

Buggy submission (verdict: Runtime Error):
x,a = map(int,input().sprit())
if x < a:
  print(0)
else:
  print(10)
Problem p03026 (python)

Fixed submission:
n, *L = map(int, open(0).read().split())
ab = L[:2 * n - 2]
c = sorted(L[2 * n - 2:])
con = [[] for _ in range(n)]
ans = [0] * n
tot = sum(c) - max(c)
for a, b in zip(*[iter(ab)] * 2):
	con[a - 1].append(b - 1)
	con[b - 1].append(a - 1)
vis = [0] * n
q = [0]
vis[0] = 1
while q:
	cur = q.pop()
	ans[cur] = c.pop()
	for nxt in con[cur]:
		if vis[nxt]:
			continue
		q.append(nxt)
		vis[nxt] = 1
print(tot)
print(*ans)

Buggy submission (verdict: Runtime Error):
n, *L = map(int, open(0).read().split())
ab = L[:2 * n - 2]
c = sorted(L[2 * n - 2:])
con = [[] for _ in range(n)]
ans = [0] * n
tot = sum(c) - max(c)
for a, b in zip(*[iter(ab)] * 2):
	con[a - 1].append(b - 1)
	con[b - 1].append(a - 1)
vis = [0] * n
q = [0]
vis[0] = 1
while q:
	cur = q.pop()
	ans[cur] = c.pop()
	for nxt in con[cur]:
		if vis[nxt]:
			continue
		q.append(nxt)
print(tot)
print(*ans)
Problem p03059 (python)

Fixed submission:
a,b,t = map(int,input().split())
print((t//a)*b)

Buggy submission (verdict: Runtime Error):
a,b,t = input().split()
print((t//a)*b)
Problem p03068 (python)

Fixed submission:
input()
s=input()
k=int(input())
for c in s:
	if c!=s[k-1]:
		print("*",end="")
	else:
		print(c,end="")
print("")

Buggy submission (verdict: Runtime Error):
input()
s=input()
k=int(input()
for c in s:
 if c!=s[k-1]:
  print("*",end="")
 else:
  print(c,end="")
print("")
Problem p03076 (python)

Fixed submission:
*a,=map(int,open(0));print(-max(-j%10for j in a)-sum(-i//10for i in a)*10)

Buggy submission (verdict: Runtime Error):
m=map;l=lambda;*a=m(int,open(0));b=m(l x:-x%10,a);c=m(l x:--x//10,a);print(sum(c)+min(b))
Problem p03102 (python)

Fixed submission:
I=lambda:map(int,input().split())
n,m,c=I()
b=list(I())
A=[list(I()) for _ in[0]*n]
e=0
for a in A:
  d=0
  for i,j in zip(b,a):
    d+=i*j
  e+=(d+c>0)
print(e)

Buggy submission (verdict: Runtime Error):
I=lambda:map(int,input().split())
n,m,c=I()
b=list(I())
A=[];c=0
A+=list(I())
for a in A:
  d=0
  for i,j in zip(b,a):
    d+=i*j
  c+=(c+d>0)
print(c)
Problem p03145 (python)

Fixed submission:
a=list(map(int,input().split()))
print(a[0]*a[1]//2)

Buggy submission (verdict: Runtime Error):
a=map(int,input().split())
print(a[0]*a[1]//2)
Problem p03160 (python)

Fixed submission:
n,*h=map(int,open(0).read().split())
dp=[0]*n
dp[0]=0
dp[1]=abs(h[0]-h[1])
for i in range(2,n):
	dp[i]=min(dp[i-2]+abs(h[i-2]-h[i]),dp[i-1]+abs(h[i-1]-h[i]))
print(dp[n-1])

Buggy submission (verdict: Runtime Error):
N,W=map(int,input().split())
dp=[[0]*(W+1) for _ in range(N+1)]
for i in range(1,N+1):
	w,v=map(int,input().split())
	for j in range(1,W+1):
		if j-w>=0:
			dp[i][j]=max(dp[i-1][j],dp[i-1][j-w]+v)
		else:
			dp[i][j]=dp[i-1][j]
print(dp[N][W])

Buggy submission (verdict: Runtime Error):
n,k,*h=map(int,open(0).read().split())
INF=float("inf")
dp=[INF]*n
dp[0]=0
dp[1]=abs(h[0]-h[1])
for i in range(2,n):
	width = k
	if i<k:
		width=i
	for j in range(1,width+1):
		dp[i] = min( dp[i] , dp[i-k]+abs(h[i-j]-h[i]) )
print(dp[-1])
Problem p03161 (python)

Fixed submission:
n,k,*h=map(int,open(0).read().split())
INF=float("inf")
dp=[INF]*n
dp[0]=0
dp[1]=abs(h[0]-h[1])
for i in range(2,n):
	width = k
	if i<k:
		width=i
	for j in range(1,width+1):
		dp[i] = min( dp[i] , dp[i-j]+abs(h[i-j]-h[i]) )
print(dp[-1])

Buggy submission (verdict: Runtime Error):
from collections import deque
n,k,*h=map(int,open(0).read().split())
h=deque(h)
INF=float("inf")
dp=deque([0,abs(h[0]-h[1])])
for i in range(2,n):
	width = k
	tmp=INF
	if i<k:
		width=i
	for j in range(1,width+1):
		tmp = min( tmp , dp[i-k]+abs(h[i-j]-h[i]) )
	dp.append(tmp)
print(dp[-1])
Problem p03214 (python)

Fixed submission:
n,*a=map(int,open(0).read().split());print(sorted((abs(a[i]-sum(a)/n),i)for i in range(n))[0][1])

Buggy submission (verdict: Runtime Error):
n,*a=map(int,open(0).read().split());print(asorted((abs(a[i]-sum(a)/n),i)for i in range(n))[0][1])
Problem p03219 (python)

Fixed submission:
print(eval(input().replace(" ","+")+"//2"))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
prev=[];ord=[[]for _ in range(n+1)]
for _ in range(m):
  a,b=map(int,input().split())
  prev.append([a,b])
  ord[a].append(b)
for i in range(n+1):
  if i!=[]:ord[i]=sorted(ord[i])
for [x,y] in prev:
  ind=ord[x].index(y)+1
  print("%06d"%x+"%06d"%ind)
Problem p03227 (python)

Fixed submission:
s=input();print(s[::1-2*(len(s)>2)])

Buggy submission (verdict: Runtime Error):
s=input();print(s[::-(len(s)==3)])
Problem p03228 (python)

Fixed submission:
a,b,k=map(int,input().split())
for i in range(k):
  if i%2:b//=2;a+=b
  else:a//=2;b+=a
print(a,b)

Buggy submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
for i in range(k):
  if i%2:
    b//=2
    a+=b
  else:
    a//=2
    b+=a
print(a,b
Problem p03231 (python)

Fixed submission:
from fractions import*
n,m = map(int,input().split())
g = gcd(n,m)
print(n*m//g if input()[::n//g] == input()[::m//g] else -1)

Buggy submission (verdict: Runtime Error):
from fractions import*
n,m=map(int,input().split())
l=n*m//gcd(n,m)
a=[None]*l
b=[None]*l
s,t=input(),input()
for i in range(l):
	if i*n%l==0:
		a[i]=s[i*n//l]
	if i*m%l==0:
		b[i]=t[i*m//l]
for i,j in zip(a,b):
	if None!=i!=j!=None:
		print(-1)
		exit()
print(l)