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

Fixed submission:
n,k =map(int,input().split())
a=list(map(int,input().split()))
a = [1] + a
def next(i):
    return a[i]

z = [0] * (n+1)

place = 1
T = 0
interval = 0
if k < n:
    for i in range(k):
        place = next(place)
    print(place);exit()
place = 0
k += 1
for i in range(n):
    place = next(place)
    if z[place] != 0:
        interval = T - z[place]  + 1
        break
    z[1] = 1 
    T += 1
    z[place] = T

m = (k-z[place])%interval
for i in range(m):
    place = next(place)
print(place)

Buggy submission (verdict: Runtime Error):
n,k =map(int,input().split())
a=list(map(int,input().split()))
a = [1] + a
def next(i):
    return a[i]

z = [0] * (n+1)

place = 1
T = 0
interval = 0
if k < n:
    for i in range(k):
        place = next(place)
    print(place);exit()
place = 0
for i in range(n):
    place = next(place)
    if z[place] != 0:
        interval = T - z[place]
        break
    z[place] = T
    T += 1
m = (k-z[place])%interval
for i in range(m):
    place = next(place)
print(place)
Problem p02702 (python)

Fixed submission:
s = input()
n = len(s)
m = 2019

a = 0
r = [0 for _ in range(m+1)]
r[0] = 1
z = 0
j = 1
for i in range(0,n):
    j = j * 10 % m
    ss = int(s[n-i-1])*j + z
    z = ss%m



    a += r[z]
    r[z] += 1

print(a)

Buggy submission (verdict: Runtime Error):
s = input()
MOD = 2019
r = [0]*MOD
r[0] = 1
z = 0
t = 0
for i in reversed(s):
    z = int(i) * pow(10,t,m) + z
    z %= MOD
    r[z] += 1
    t += 1
print(sum(i*(i-1)//2 for i in r))

Buggy submission (verdict: Runtime Error):
s = input()
n = len(s)
m = 2019
a = 0
r = [0 for _ in range(m+1)]
r[0] = 1
for i in range(0,n):
    z = (int(s[n-i-1])*pow(10,i,m) + z)%m
    a += r[z]
    r[z] += 1
print(a)
Problem p02727 (python)

Fixed submission:
from collections import deque
x,y,a,b,c = map(int,input().split())

p = deque(sorted(list(map(int,input().split()))))
q = deque(sorted(list(map(int,input().split()))))
r = deque(sorted(list(map(int,input().split()))))

ans = deque(maxlen=(x+y))

def insertion(z):
	global x,y
	if z == p:
		x -= 1
	else:
		y -= 1
	return ans.append(z.pop())

while x > 0 or y > 0:
	if x and y:
		if p[-1] > q[-1] :
			insertion(p)
		else:
			insertion(q)
	elif not x:
		insertion(q)
	else:
		insertion(p)

while r:
	if ans[-1] < r[-1]:
		ans.appendleft(r.pop())
	else:
		break

print(sum(ans))

Buggy submission (verdict: Runtime Error):
from collections import deque
x,y,a,b,c = map(int,input().split())

p = deque(sorted(list(map(int,input().split()))))
q = deque(sorted(list(map(int,input().split()))))
r = deque(sorted(list(map(int,input().split()))))

ans = deque(maxlen=(x+y))

def insertion(z):
	global x,y
	if z == p:
		x -= 1
	else:
		y -= 1
	return ans.append(z.pop())

while x > 0 or y > 0:
	if x and y:
		if p[-1] > q[-1] :
			insertion(p)
		else:
			insertion(q)
	elif not x:
		insertion(q)
	else:
		insertion(p)


while ans[-1] < r[-1]:
		ans.pop()
		ans.appendleft(r.pop())

print(sum(ans))
Problem p02743 (python)

Fixed submission:
import math as m
a,b,c = map(int,input().split())
print("Yes" if 4*(a*b) < (c - a - b)**2 and c-a-b > 0 else "No")

Buggy submission (verdict: Runtime Error):
import math as m
a,b,c = map(int,input().split())
if (c - a - b)**2 < 10**9:
	print("Yes" if 4*a*b < (c - a - b)**2 else "No")
else:
	print("Yes" if m.log(4*a*b) < 2*m.log((c - a - b)) else "No")

Buggy submission (verdict: Runtime Error):
import math as m
a,b,c = map(int,input().split())
if (c - a - b)**2 < 10**9:
	print("Yes" if 4*a*b < (c - a - b)**2 else "No")
else:
	print("Yes" if m.log(4*a*b) < 2*log((c - a - b)) else "No")
Problem p02797 (python)

Fixed submission:
n,k,s = map(int,input().split())

a = [s] * n
for i in range(k,n):
    a[i] +=1-(s==10**9)*s
print(*a)

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

a = [0] * n
a[0] = s
a[k] = s+1+(s==1)-(s==10**9)*s
print(*a)

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

a = [0] * n
a[0] = s
a[k] = s+1+(s==1)
print(*a)
Problem p02923 (python)

Fixed submission:
N = int(input())
H = list(map(int,input().split()))
c = 0
ans = 0
if N == 1:
    print(0)
else:
    for i in range(N-1):
        if H[i+1] <= H[i]:
            c += 1
        else:
            ans = max(c,ans)
            c = 0
    ans = max(c,ans)
    print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int,input().split()))
c,ans= 0
if N == 1:
    print(0)
else:
    for i in range(N-1):
        if H[i+1] <= H[i]:
            c += 1
        else:
            ans = max(c,ans)
            c = 0
print(c)
Problem p02936 (python)

Fixed submission:
from collections import deque
n,q = map(int,input().split())
graph = [[] for _ in range(n)]
cnt = [0] * n
already = [False] * n

for i in range(n-1):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)
    
for i in range(q):
    p,x = map(int,input().split())
    cnt[p-1] += x
wait_q = deque()
wait_q.append(0)

while len(wait_q) > 0:
    parent = wait_q.popleft()
    for child in graph[parent]:
        if child == 0:continue
        if already[child] == True:continue
        already[child] = True
        cnt[child] += cnt[parent]
        wait_q.append(child)
print(*cnt)

Buggy submission (verdict: Runtime Error):
from collections import deque
n,q = map(int,input().split())
graph = [[] for _ in range(n)]
cnt = [0] * n
already = [False] * n

for i in range(n-1):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)
    
for i in range(q):
    p,x = map(int,input().split())
    cnt[p-1] += x
wait_q = deque()
wait_q.append(0)

while len(wait_q) > 0:
    parent = wait_q.popleft()
    already[child] = True
    for child in graph[parent]:
        if child == 0:continue
        if already[child] == True:continue
        cnt[child] += cnt[parent]
        wait_q.append(child)
print(*cnt)
Problem p02947 (python)

Fixed submission:
N = int(input())
S =  ["".join(sorted(input())) for _ in range(N)]

Sdic = {}
ans = 0

for i in range(N):
    if S[i] not in Sdic.keys():
        Sdic[S[i]] = 1
    else:
        ans += Sdic[S[i]]
        Sdic[S[i]] += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
#S = [input() for _ in range(N)]
S = ["".join(sorted(input())) for _ in range(N)]

ans = 0
for i in range(N):
    for j in range(i+1,N):
        if S[i] == S[j]:
            ans += 1
            S.pop(j)
            break
        break
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
#S = [input() for _ in range(N)]
S = ["".join(sorted(input())) for _ in range(N)]

ans = 0
for i in range(N):
    for j in range(i+1,N):
        if S[i] == S[j]:
            ans += 1
            S.pop(j)
            break
print(ans)
Problem p02953 (python)

Fixed submission:
n = int(input())
h = list(map(int,input().split()))
h[0] -= 1
for i in range(n-1):
    if h[i] < h[i+1]:
        h[i+1] -= 1

    elif h[i] > h[i+1]:
        print('No')
        exit()

print('Yes')

Buggy submission (verdict: Runtime Error):
for i in range(n-1):
    if h[i] < h[i+1]:
        h[i+1] -= 1

    elif h[i] > h[i+1]:
        print('No')
        exit()

print('Yes')

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split()))

for i in range(n-1):
    print(h)
    if h[i] < h[i+1]:
        h[i+1] -= 1

    elif h[i] > h[i+1]:
        print('No')
        exit()

print('Yes')
Problem p02957 (python)

Fixed submission:
a = list(map(int,input().split()))
if sum(a)%2 == 0:
    print(sum(a)//2)
else:
    print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
 a = list(map(int,input().split()))
if sum(a)%2 == 0:
    print(sum(a)//2)
else:
    print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
n,*p = map(int,open(0).read().split())
ans = 0
for i in range(n):
    if i+1 != p[i]:
        if i+1 == p[p[i]-1]:
            ans += 1

print('YES' if ans == 0 or 2 else 'NO')
Problem p02958 (python)

Fixed submission:
n,*p = map(int,open(0).read().split())
ans = 0
for i in range(n):
    if i+1 != p[i]:
        ans += 1
print('YES' if ans == 2 or ans == 0 else 'NO')

Buggy submission (verdict: Runtime Error):
n,*p = map(int,open().read().split())
ans = 0
for i in range(n):
    if i+1 != p[i]:
        ans += 1
print('YES' if ans == 2 else 'NO')

Buggy submission (verdict: Runtime Error):
n,*p = map(int,open('abc135.txt').read().split())
ans = 0
for i in range(n):
    if i+1 != p[i]:
        if i+1 == p[p[i]-1]:
            ans += 1

print('YES' if ans == 0 or 2 else 'NO')

Buggy submission (verdict: Runtime Error):
n,*p = map(int,open('abc135.txt').read().split())
ans = 0
for i in range(n):
    if i+1 != p[i]:
        if i+1 == p[p[i]-1]:
            ans += 1

print('Yes' if ans == 0 or 2 else 'No')
Problem p02971 (python)

Fixed submission:
n,*a = map(int,open(0).read().split())
b = sorted(a)
max = b[-1]
maxs= b[-2]

for i in range(n):
    if a[i] == max:
        print(maxs)
    else:
        print(max)

Buggy submission (verdict: Runtime Error):
def main():

    n,*a = map(int,open('abc134_c.txt').read().split())
    b = sorted(a)
    max = b[-1]
    maxs= b[-2]

    for i in range(n):
        if a[i] == max:
            print(maxs)
        else:
            print(max)
    return()

if __name__=='__main__':
    main()
Problem p02981 (python)

Fixed submission:
n,a,b = map(int,raw_input().split())
print (min(a*n,b))

Buggy submission (verdict: Runtime Error):
cat ./atcoder/ABC133A.py
n,a,b = map(int,raw_input().split())
print (min(a*n,b))

Buggy submission (verdict: Runtime Error):
cat ./atcoder/ABC133A.py
n,a,b = map(int,raw_input().split())
print (min(a*n,b))
Problem p03160 (python)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n,*H = list(map(int,read().split()))
h = [0]
h.extend(H)

dp = [100] * (n+1)
dp[1] = 0
dp[2] = abs(h[2]-h[1])

for i in range(3,n+1):
    dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))

print(dp[-1])

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(input())
h = np.array(read().split(),dtype=np.int32)
dp = np.zeros(n,dtype=np.int32)
k = 2

for i in range(1,n):

    l = max(i-k,0)
    dp[i] = np.min(np.abs(h[i]-h[l:i])+dp[l:i])

print(dp[-1])

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n,*h = list(map(int,read().split()))
h = [0,*h]

dp = [100] * (n+1)
dp[1] = 0
dp[2] = abs(h[2]-h[1])

for i in range(3,n+1):
    dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))

print(dp[-1])

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n,*h = list(map(int,read().split()))
h = [0,*h]

dp = [100] * (n+1)
dp[1] = 0
dp[2] = abs(h[2]-h[1])

for i in range(3,n+1):
    dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))

print(dp[-1])

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

h = list(map(int,read().split()))
n = len(h)-1
if n == 2:
    print(abs(h[1]-h[-1]));exit()

dp = [-1]*(n+1)

dp[2] = 20
dp[3] = 30

def sdp(j):
    if j == 2:
        return 20
    elif j == 3:
        return 30
    elif dp[j] != -1:
        return dp[j]
    else:
        dp[j] = min(sdp(j-2)+abs(h[j]-h[j-2]),sdp(j-1)+abs(h[j]-h[j-1]))
        return dp[j]
sdp(n)
print(dp[-1])
Problem p03166 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**8)
(n,m),*xy = [list(map(int,r.split())) for r in open(0)]
g = [[] for _ in range(n)]
dp = [0 for _ in range(n)]

for i in xy:
    x,y = i[0],i[1]
    x -= 1
    y -= 1
    g[y].append(x)

def rec(node):
    if dp[node] > 0:
        return dp[node]
    
    if not g[node]:
        dp[node] = 0
        return 0

    for child in g[node]:
        dp[node] = max(dp[node], rec(child) + 1)

    return dp[node]

ans = 0
for i in range(n):
    ans = max(ans, rec(i))
print(ans)

Buggy submission (verdict: Runtime Error):
sys.setrecursionlimit(10**8)
(n,m),*xy = [list(map(int,r.split())) for r in open(0)]
g = [[] for _ in range(n)]
dp = [0 for _ in range(n)]

for i in xy:
    x,y = i[0],i[1]
    x -= 1
    y -= 1
    g[y].append(x)

def rec(node):
    if dp[node] > 0:
        return dp[node]
    
    if not g[node]:
        dp[node] = 0
        return 0

    for child in g[node]:
        dp[node] = max(dp[node], rec(child) + 1)

    return dp[node]

ans = 0
for i in range(n):
    ans = max(ans, rec(i))
print(ans)

Buggy submission (verdict: Runtime Error):
(n,m),*xy = [list(map(int,r.split())) for r in open(0)]
g = [[] for _ in range(n)]
dp = [0 for _ in range(n)]

for i in xy:
    x,y = i[0],i[1]
    x -= 1
    y -= 1
    g[y].append(x)

def rec(node):
    if dp[node] > 0:
        return dp[node]
    
    if not g[node]:
        dp[node] = 0
        return 0

    for child in g[node]:
        dp[node] = max(dp[node], rec(child) + 1)

    return dp[node]

ans = 0
for i in range(n):
    ans = max(ans, rec(i))
print(ans)
Problem p03240 (python)

Fixed submission:
n = int(input())
z = [list(map(int,input().split())) for _ in range(n)]


def set_height(i,x,y):
	ans = z[i][2] + abs(z[i][0] - x) + abs(z[i][1] - y)
	return ans


answer = 0
for j in range(0,101):
	for k in range(0,101):
		flag = 1
		for l in range(0,n):
			if z[l][2] != 0:
				answer = set_height(l,j,k)
				break

		for l in range(0,n):
			if z[l][2] == 0:
				if answer > set_height(l,j,k):	
					flag = 0
					break
			else:
				if answer != set_height(l,j,k):
					flag = 0
					break
		if flag == 1 and answer > 0 :
			test = map(str,(j,k,answer))
			print(" ".join(test))

Buggy submission (verdict: Runtime Error):
n = int(input())
z = [list(map(int,input().split())) for _ in range(n)]

def set_height(i,x,y):
	ans = z[i][2] + abs(z[i][0] - x) + abs(z[i][1] - y)
	return ans


answer = 0
for j in range(0,101):
	for k in range(0,101):
		answer=set_height(0,j,k)
		flag = 1
		for l in range(1,n):
			if answer!= set_height(l,j,k):
				flag = 0
				break
		if flag == 1 && answer <= 10**9:
			test = map(str,(j,k,answer))
			print(" ".join(test))
Problem p03408 (python)

Fixed submission:
n = int(input())
sn = list(input() for i in range(n))
m = int(input())
mn = list(input() for i in range(m))
ss = []
for i in range(len(sn)):
  ss.append(sn.count(sn[i])-mn.count(sn[i]))
print (max(max(ss),0))

Buggy submission (verdict: Runtime Error):
n = int(input())
sn = list(input() for i in range(n))
m = int(input())
mn = list(input() for i in range(m))

for i in range(len(sn)):
  ss.append(sn.count(sn[i])-mn.count(sn[i]))

print (max(ss),0)
Problem p03469 (python)

Fixed submission:
print(input().replace('2017','2018'))

Buggy submission (verdict: Runtime Error):
print(len(set[(int(input()) for i in range(int(input()))])))

Buggy submission (verdict: Runtime Error):
print(len(set(int(input()) for i in range(int(input())))))
Problem p03471 (python)

Fixed submission:
n,Y = map(int,input().split())
y2 = Y // 1000
for a in range(n+1):
    y = y2
    rest = y - a * 10
    if rest < 0:break
    for b in range(n+1-a):
        if rest -b * 5 < 0: break
        if n - a - b == rest - b * 5:
            print(a,b,n-a-b);exit()
print(-1,-1,-1)

Buggy submission (verdict: Runtime Error):
n,Y = map(int,input().split())
y2 = Y // 1000
for a in range(n+1):
    y = y2
    rest = y - a * 10
    if rest < 0:break
    for b in range(n+1-a):
        rest -b * 5 < 0: break
        if n - a - b == rest - b * 5:
            print(a,b,n-a-b);exit()
print(-1,-1,-1)
Problem p03628 (python)

Fixed submission:
MOD = 10**9+7
n = int(input())
s = input()
p = input()
ans = 0
f = 0
i = 0
while i < n:
    if i > n:break
    if s[i] == p[i]:
        if i == 0:
            ans = 3
        else:
            if f == 1:
                ans *= 1
            else:
                ans *= 2
        f = 0
    else:
        if i == 0:
            ans = 6
        else:
            if f == 1:
                ans *= 3
            else:
                ans *= 2
        f = 1
        i += 1
    i += 1
    ans %= MOD
print(ans%MOD)

Buggy submission (verdict: Runtime Error):
n = int(input())
*a, = map(int,input().split())
c = [0 for _ in range(10**5+1)]
for A in a:
    c[A] += 1
ans = 0
l = len(c)
for i in range(l):
    z = c[i]

    if 0 <= i - 1 <l:
        z += c[i-1]

    if 0 <= i+1 <l:
        z += c[i+1]

    ans = max(ans, z)
print(ans)
Problem p03759 (python)

Fixed submission:
a,b,c = map(int,input().split())
print('YES' if b-a == c-b else 'NO')

Buggy submission (verdict: Runtime Error):
O = input()
E = input()
s = ''
for i in range(len(O)):
  s+=O[i]
  s+=E[i]
print(s)
Problem p03760 (python)

Fixed submission:
O = input()
E = input()
s = ''
for i in range(len(E)):
  s+=O[i]
  s+=E[i]
if (len(O) != len(E)):
  s+=O[-1]
print(s)

Buggy submission (verdict: Runtime Error):
O = input()
E = input()
s = ''
for i in range(len(O)):
  s+=O[i]
  s+=E[i]
print(s)
Problem p04043 (python)

Fixed submission:
i = list(map(int, input().split()))
if i[0] == 7:
  if i[1] == 5 and i[2] ==5:
    print('YES')
  else:
    print('NO')
elif i[0] == 5:
  if (i[1] == 7 and i[2] == 5) or (i[2] == 7 and i[1] == 5):
    print('YES')
  else:
    print('NO')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
i = list(map(int, input().split()))
if i[0] == 7:
  if i[1] == 5 and i[2] ==5:
    print('YES')
  else:
    print('NO')
elif i[0] == 5:
  if (i[1] == 7 and i[2] == 5) or (i[2] == 7 and i[1] == 5):
    print('YES')
  else:
    print('NO')
else:
  print('NO')
Problem p04045 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)

n_price,k = map(str,input().split())
k = int(k)
n_length = len(n_price)
d_ng_list = list(input())
restrict = True
answer = ""
for s in range(10):
	if str(s) not in d_ng_list:
		min_number = str(s)
		break

def find_number(i):
	global restrict
	if not restrict:
		return min_number
	for s in range(10):
		if (str(s) not in d_ng_list) and str(s) >= n_price[i]:
			if s > int(n_price[i]):
				restrict = False
			return str(s)
	#if not found
	restrict = False
	return str(min_number+min_number)

def rec_cal_pay(answer, i, restrict):
	if i == n_length-1:
		answer += find_number(i)
		print(answer)
		return
	else:
		c = find_number(i)
		rec_cal_pay(answer+c, i+1, restrict)

rec_cal_pay(answer, 0, restrict)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)

n_price,k = map(str,input().split())
k = int(k)
n_length = len(n_price)
d_ng_list = list(input())
restrict = True
answer = ""
for s in range(10):
	if str(s) not in d_ng_list:
		min_number = str(s)
		break

def find_number(i):
	global restrict
	if not restrict:
		return min_number
	for s in range(10):
		if (str(s) not in d_ng_list) and str(s) >= n_price[i]:
			if s > int(n_price[i]):
				restrict = False
			return str(s)

def rec_cal_pay(answer, i, restrict):
	if i == n_length-1:
		answer += find_number(i)
		print(answer)
		return
	else:
		c = find_number(i)
		rec_cal_pay(answer+c, i+1, restrict)
rec_cal_pay(answer, 0, restrict)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)

n_price,k = map(str,input().split())
k = int(k)
n_length = len(n_price)
d_ng_list = list(map(str,input().split()))
restricted = True
answer = ""
for s in range(10):
	if str(s) not in d_ng_list:
		min_number = str(s)
		break

def find_number(i,restricted):
	if not restricted:
		return min_number
	for s in range(10):
		if str(s) not in d_ng_list and str(s) >= n_price[i]:
			if str(s) > n_price[i]:
				restricted = False
			return str(s)	

def rec_cal_pay(answer, i):
	if i == n_length-1:
		answer += find_number(i,restricted)
		print(answer)
		return
	else:
		c = find_number(i,restricted)
		rec_cal_pay(answer+c,i+1)
rec_cal_pay(answer, 0)

Buggy submission (verdict: Runtime Error):
n_price,k = map(str,input().split())
k = int(k)
n_length = len(n_price)
d_ng_list = list(map(str,input().split()))
restricted = True
answer = ""
for s in range(10):
	if str(s) not in d_ng_list:
		min_number = str(s)
		break

def find_number(i,restricted):
	if not restricted:
		return min_number
	for s in range(10):
		if str(s) not in d_ng_list and str(s) >= n_price[i]:
			if str(s) > n_price[i]:
				restricted = False
			return str(s)	

def rec_cal_pay(answer, i):
	if i == n_length-1:
		answer += find_number(i,restricted)
		print(answer)
		return
	else:
		c = find_number(i,restricted)
		rec_cal_pay(answer+c,i+1)
rec_cal_pay(answer, 0)
Problem p02921 (python)

Fixed submission:
S = input()
R = input()
count = 0
for i in range(3):
  if S[i] == R[i]:
    count = count + 1
print(count)

Buggy submission (verdict: Runtime Error):
a = input()
first = True
A = ""
B = ""
for i in range(len(a)):
    if a[i] != " " and first:
        A = A + a[i]
    else:
        first = False
        B = B + a[i]
A = int(A)
B = int(B)
count = 0
if B > A:
    while B > 0:
        B = B - A
        count = count + 1
print(count)

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
A = int(a)
B = int(b)
count = 0
while B > 0:
    B = B - A
    count = count + 1
print(count)
Problem p02681 (python)

Fixed submission:
s = input()
t = input()
for i in range(len(s)):
    if s[i] != t[i]:
        print('No')
        exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
n,k = map(int ,input().split())
A = tuple(map(int, input().split()))
seen = [-1]*n
tmp = 0
count = 0

while True:
    tmp = A[tmp]-1
    count +=1
    if seen[tmp] != -1:
        seennum = seen.count(1)

        tm = tmp
        se = [-1]*n
        roopmem = []
        while True:

            if se[tm] != -1:
                roop = se.count(1)
                break
            else:
                roopmem.append(tm)
                se[tm] = 1
                tm = A[tm] - 1

        break
    else:
        seen[tmp] = 1

if k<=n:
    no = 0
    for i in range(k):
        no = A[no]-1
    print(no+1)
else:
    tmp = k-seennum
    tmp %= roop
    print(roopmem[tmp-1]+1)
Problem p02789 (python)

Fixed submission:
n,m = map(int, input().split())
if n==m:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import sys
n = int(sys.stdin.readline())
p =list(map(int, sys.stdin.readline().split()))
cnt = 0
for i in range(n):
    if min(p[:i+1]) == p[i]:
        cnt+=1
print(cnt)
Problem p02921 (python)

Fixed submission:
s = input()
t = input()
cnt = 0
for i in range(3):
    if s[i] == t[i]:
        cnt +=1
print(cnt)

Buggy submission (verdict: Runtime Error):
import math
a,b = map(int,input().split())
print(math.ceil((b - 1) / (a - 1)))

Buggy submission (verdict: Runtime Error):
import math
a,b = map(int,input().split())
print(math.ceil((b - 1) / (a - 1)))

Buggy submission (verdict: Runtime Error):
import math
a,b =map(int, input().split())
print(math.ceil((b-1)/(a-1)))
Problem p03044 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**7)
n = int(input())
G = [[] for _ in range(n+1)]
for i in range(n-1):
    v,w,dist = map(int, input().split())
    G[v].append((w,dist))
    G[w].append((v,dist))
color = [-1]*(n+1)


def dfs(a, col):
    tmp = -1
    if color[a] == -1:
        color[a] = col

    for next_V,dis in G[a]:
        if color[next_V] == -1:
            tmp = col
            if dis%2 !=0:
                tmp = 1-col
            dfs(next_V, tmp)
dfs(1,0)
[print(color[i]) for i in range(1,n+1)]

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(300000) #上限上げないと引っかかる
N = int(input())
tree = [[] for _ in range(N)]
for e in sys.stdin.read().rstrip():
    x,y,dist = e.split()
    x = int(x);y=int(y);dist= int(dist)
    x -=1
    y -=1
    if dist%2 == 0:
        tree[x].append(y)
        tree[y].append(x)#偶数の場合のみ処理




color = [-1]*N
#本体
def dfs(G,V,cur):
    color[V] = cur
    for next_V in G[V]:
        if (color[next_V] != -1):
            continue#これ入れないとスタックオーバーフロー　すでに行ったところはもう調べない
        dfs(G,next_V, cur)
    return True

for i in range(N):
    dfs(tree, 0, 0)
for j in range(N):
    print(color[j])