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

Fixed submission:
import numpy as np
n = int(input())
h = list(map(int, input().split()))
h_diff = np.diff(h)
li = [[]]
for i in range(n-1):
  if(h_diff[i] > 0):
    li.append([])
  else:
    li[-1].append("s")
tmp = 0
for arr in li:
  if(tmp <= len(arr)):
    tmp = len(arr)
print(tmp)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
h=1
ans=0
while h<b:
    h-=1
    h+=a
    ans+=1
print(ans)
Problem p02953 (python)

Fixed submission:
n = int(input())
arr = list(map(int, input().split()))
for i in range(n-1, 1, -1):
  if(arr[i-1] <= arr[i]):
    a = 1
  else:
    if(arr[i-1] - 1 > arr[i]):
      print("No")
      exit()
    else:
      arr[i-1] = arr[i - 1] - 1
if(sorted(arr) == arr):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
arr = list(map(int, input().split()))
for i in range(n, 1, -1):
  if(arr[i-1] <= arr[i]):
    a = 1
  else:
    if(arr[i-1] - 1 > arr[i]):
      print("No")
      exit()
    else:
      arr[i-1] = arr[i - 1] - 1
if(sorted(arr) == arr):
  print("Yes")
else:
  print("No")
Problem p02971 (python)

Fixed submission:
n = int(input())
a = []
first = 0
second = 0
for num in range(n):
	hoge = int(input())
	a.append(hoge)
	if hoge >= first:
		second = first
		first = hoge
	elif second <= hoge and hoge <= first:
		second = hoge

#print(first, second)
for num in range(n):
	if(first <= a[num]):
		print(second)
	else:
		print(first)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = []
for num in range(n):
	a.append(int(input()))

for num in range(n):
	temp = a.copy()
	del temp[num]
	print(max(temp))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = []
for num in range(n):
  a.append(int(input()))

for num in range(n):
  temp = a.copy()
  del temp[num]
  print(max(temp))
Problem p02982 (python)

Fixed submission:
import math

n,d = map(int, input().split())
x = []
for num in range(n):
  x.append(list(map(int, input().split())))

cnt = 0
for i in range(n - 1):
  for j in range(i+1, n):
    hoge = 0
    for num in range(d):
      hoge = hoge + pow(abs(x[i][num] - x[j][num]),2)
    if(hoge == pow(int(math.sqrt(hoge)), 2)):
       cnt = cnt + 1
print(cnt)

Buggy submission (verdict: Runtime Error):
import math
n,d = map(int, input().split())
x = []
for fuga in range(n):
	x.append(list(map(int, input().split())))

cnt = 0
for i in range(n - 1):
	for j in range(i+1, n):
		hoge = 0
		for num in range(d):
			hoge = hoge + pow(abs(x[i][num] - x[j][num]),2)
			if(hoge == pow(int(math.sqrt(hoge)), 2)):
			cnt = cnt + 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n,d = map(int, input().split())
x = []
for num in range(n):
    x.append(list(map(int, input().split())))

cnt = 0
for i in range(n - 1):
    for j in range(i+1, n):
        hoge = 0
        for num in range(d):
            hoge = hoge + pow(abs(x[i][num] - x[j][num]),2)
            if(hoge == pow(int(math.sqrt(hoge)), 2)):
                cnt = cnt + 1
print(cnt)
Problem p02983 (python)

Fixed submission:
l,r = map(int, input().split())
if (r - l >= 2019):
  print(0)
else:
  res = []
  for i in range(l, r + 1):
    res.append(i % 2019)
  res.sort()
  ans = 2019 * 2019
  for hoge in res:
    for fuga in res:
      if(hoge != fuga and ans > ((hoge * fuga) % 2019)):
        ans = (hoge * fuga) % 2019
  print(ans)

Buggy submission (verdict: Runtime Error):
l,r = map(int, input().split())
if (r - l >= 2019):
  print(0)
else:
  res = []
  for i in range(l, r + 1):
    res.append(i % 2019)
  res.sort()
  ans = 2019 * 2019
  for hoge in res:
    for fuga in res:
      if(ans > ((res[hoge] * res[fuga]) % 2019)):
        ans = (res[hoge] * res[fuga]) % 2019
  print(ans)

Buggy submission (verdict: Runtime Error):
l,r = map(int, input().split())
if (r - l >= 2019):
  print(0)
else:
  res = []
  for i in range(l, r + 1):
    res.append(i % 2019)
  res.sort()
  ans = 2019 * 2019
  for hoge in res:
    for fuga in res:
      if(ans > ((res[hoge] * res[fuga]) % 2019):
        ans = (res[hoge] * res[fuga]) % 2019
  print(ans)

Buggy submission (verdict: Runtime Error):
l,r = map(int, input().split())
if (r - l >= 2019):
  print(0)
else:
  res = []
  for i in range(l, r + 1):
    res.append(i % 2019)
  res.sort()
  ans = 2019 * 2019
  for hoge in res:
    for fuga in res:
      if(ans > (res[hoge] * res[fuga]) % 2019):
        ans = (res[hoge] * res[fuga]) % 2019
print(ans)

Buggy submission (verdict: Runtime Error):
l,r = map(int, input().split())
if (r - l >= 2019):
  print(0)
else:
  res = []
  for i in range(l, r + 1):
    res.append((i * j) % 2019)
  res.sort
  if(3 in res and 673 in res):
    print(0)
  else:
    print(res[0] * res[1])

Buggy submission (verdict: Runtime Error):
l,r = map(int, input().split())
if (r - l >= 2019):
  print(0)
else:
  res = []
  for i in range(l, r + 1):
    res.append((i * j) % 2019)
  if(3 in res and 673 in res):
    print(0)
  else:
    print(res[0] * res[1])

Buggy submission (verdict: Runtime Error):
l,r = map(int, input().split())
if (r - l >= 2019):
  print(0)
else:
  res = []
  for i in range(l, r + 1):
    for j in range(l + i, r + 1):    
    res.append((i * j) % 2019)
  if(3 in res and 673 in res):
    print(0)
  else:
    print(res[0] * res[1])
Problem p02993 (python)

Fixed submission:
import re
s = input()
pattern = r"(00|11|22|33|44|55|66|77|88|99)"
if(re.search(pattern, s)):
	print("Bad")
else:
	print("Good")

Buggy submission (verdict: Runtime Error):
import re
s = input()
pattern = r"\d{2}"
if(!re.match(pattern, s)):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
import re
s = input()
if(s.match(r"\d{2}")):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s = input()
if(s.match(r"\d{2}")):
  print("Yes")
else:
  print("No")
Problem p03000 (python)

Fixed submission:
n, x = list(map(int, input().split()))
li = list(map(int, input().split()))
d = []
d.append(0)
for l in li:
  d.append(d[-1] + l)
cnt = 0
for hoge in d:
  if(hoge <= x):
    cnt = cnt + 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n, x = list(map(int, input().split()))
li = list(map(int, input().split()))
d = []
d.append(0)
for l in li:
  d.append(d[-1] + l)
cnt = 0
for hoge in d:
  if(hoge <= d):
    cnt = cnt + 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n, x = list(map(int, input().split()))
li = list(map(int, input().split()))
d = []
d.append(0)
for l in li:
	d.append(d[-1] + l)
cnt = 0
for hoge in d:
  if(hoge <= d):
    cnt = cnt + 1
print(cnt)
Problem p03030 (python)

Fixed submission:
n = int(input())
r = []
for i in range(1, n+1):
  hoge = input().split()
  hoge.append(i)
  r.append(hoge) 
tmp = sorted(r, key=lambda x:int(x[1]), reverse=True)
res = sorted(tmp, key=lambda x:x[0])
for arr in res:
  print(arr[2])

Buggy submission (verdict: Runtime Error):
n = int(input())
r = []
for i in range(1, n+1):
  hoge = list(map(int, input().split()))
  hoge.append(i)
  r.append(hoge) 
tmp = sorted(r, key=lambda x:x[1], reverse=True)
res = sorted(tmp, key=lambda x:x[0])
for arr in res:
  print(arr[2])

Buggy submission (verdict: Runtime Error):
n = int(input())
for i in range(1, n+1):
  hoge = list(map(int, input().split()))
  hoge.append(i)
  r.append(hoge) 
tmp = sorted(r, key=lambda x:x[1], reverse=True)
res = sorted(tmp, key=lambda x:x[0])
for arr in res:
  print(arr[2])

Buggy submission (verdict: Runtime Error):
n = int(input())
r = [list(map(int, input().split())).append(i+1) for i in range(n)] 
tmp = sorted(r, key=lambda x:x[1], reverse=True)
res = sorted(tmp, key=lambda x:x[0])
for arr in res:
  print(arr[2])

Buggy submission (verdict: Runtime Error):
n = int(input())
r = [list(map(int, input().split())).append(i+1) for i in range(n)] 
tmp = sorted(data, key=lambda x:x[1], reverse=True)
res = sorted(tmp, key=lambda x:x[0])
for arr in res:
  print(arr[2])
Problem p03136 (python)

Fixed submission:
n = int(input())
l = list(map(int, input().split()))
 
l.sort(reverse=True)
if(l[0] < sum(l[1:n])):
  print("Yes")
else:
  print("No")

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

l.sort(reverse=True)
l2.sort()
for num in range(n):
	if(l[0] > sum(l2[:n])):
  		print("Yes")
		break
print("No")

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

l.sort(reverse=True)
l2.sort()
for num in range(n):
	if(l[0] > sum(l2[1:n])):
  		print("Yes")
		break
print("No")

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

l.sort(reverse=True)
l2.sort()
for num in range(n)
	if(l[0] > sum(l2[1:n])):
  		print("Yes")
		break
print("No")
Problem p03146 (python)

Fixed submission:
def f(n):
  if(n % 2 == 0):
    return n // 2
  else:
    return (3 * n) + 1
N = int(input())
 
test = set([N])
before = N
for i in range(1, 10**6 + 1):
  current = f(before)
  if(current in test):
    print(i+1)
    exit()
  before = current
  test.add(before)

Buggy submission (verdict: Runtime Error):
def f(n):
  if(n % 2 == 0):
    return n // 2
  else:
    return (3 * n) + 1
N = int(input())
 
test = set(N)
before = N
for i in range(1, 10**6 + 1):
  current = f(before)
  if(current in test):
    print(i+1)
    exit()
  before = current
  test.add(current)
Problem p03280 (python)

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

Buggy submission (verdict: Runtime Error):
a, b = list(map(int, input()))
print((a-1)*(b-1))
Problem p03324 (python)

Fixed submission:
d, n = list(map(int, input().split()))
cnt = 0
i = 1

while True:
  if(d == 0 and i % 100 != 0):
    cnt += 1    
  if(d != 0 and i % (100 ** d) == 0 and i % (100 ** (d+1)) != 0):
    cnt += 1
  if(cnt == n):
    print(i)
    exit()
  i += 1

Buggy submission (verdict: Runtime Error):
def calc(x):
  ret = 0
  while x % 100 == 0:
    x /= 100
	ret += 1
	return ret

d, n = list(map(int, input().split()))
cnt = 0
val = 0
while cnt < n:
  val +=1
  if(calc(val) == D):
    cnt+=1
  print(val)
  return

Buggy submission (verdict: Runtime Error):
D,N = list(map(int, input().split()))
print(n * (100 ** D))
Problem p03325 (python)

Fixed submission:
def hoge(num):
  for i in range(10**10):
    if(num % (2 ** i) != 0):
      return i - 1
    
n = int(input())
print(sum(list(map(lambda x: hoge(int(x)), input().split()))))

Buggy submission (verdict: Runtime Error):
def hoge(num):
  for i in range(num):
    if(num % (2 * i) != 0):
      return i
n = int(input())
print(sum(list(map(lambda x: hoge(int(x)), input().split()))))
Problem p03386 (python)

Fixed submission:
a,b,k = list(map(int, input().split()))
if(b-a <= 200):
  for i in range(a, b+1):
    if(i < a + k or b - k < i):
      print(i)
else:
  for i in range(a, a+k):
    print(i)
  for i in range(b-k+1, b+1):
    print(i)

Buggy submission (verdict: Runtime Error):
a,b,k = list(map(int, input().split()))
if(b-a <= 200):
  for i in rage(a, b):
    if(i <= a + k or b - k <= i):
      print(i)
else:
  for i in range(a, a+k):
    print(i)
  for i in range(b+k, b+1):
    print(i)
Problem p03408 (python)

Fixed submission:
n = int(input())
blue = {}
for _ in range(n):
  s = input()
  if(s in blue):
    blue[s] += 1
  else:
    blue[s] = 1
m = int(input())
red = {}
for _ in range(m):
  t = input()
  if(t in red):
    red[t] += 1
  else:
    red[t] = 1
res = -100
for key, value in blue.items():
  tmp = 0
  if(key in red):
    tmp = blue[key] - red[key]
  else:
    tmp = blue[key]
  if(tmp > res):
    res = tmp
if(res >= 0):
  print(res)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
n = int(input())
blue = {}
for _ in range(n):
  s = input()
  blue[s] += 1
m = int(input())
red = {}
for _ in range(m):
  t = input()
  red[t] += 1
res = -100
for key, value in blue.items():
  tmp = 0
  if(key in red):
    tmp = blue[key] - red[key]
  else:
    tmp = blue[key]
  if(tmp > res):
    res = tmp
print(res)

Buggy submission (verdict: Runtime Error):
n = int(input())
blue = {}
for _ in range(n):
  s = input()
  blue[s] += 1
m = int(input())
red = {}
for _ in range(m):
  t = input()
  red[t] += 1
res = -100
for key, value in blue:
  tmp = 0
  if(key in red):
    tmp = blue[key] - red[key]
  else:
    tmp = blue[key]
  if(tmp > res):
    res = tmp
print(res)
Problem p03434 (python)

Fixed submission:
n = int(input())
cards = [int(i) for i in input().split()]
cards.sort(reverse=True)
a = 0
b = 0
for i, num in enumerate(cards):
    if(i % 2 == 0):
        a = a + num
    else:
        b = b + num
print(a - b)

Buggy submission (verdict: Runtime Error):
n = int(input())
cards = [int(i) for i in input().split()]
cards.reverse()
a = 0
b = 0
for i, num in enumerate(cards):
    if(i % 2 == 0):
        a = a + num
    else:
        b = b + num
print a - b

Buggy submission (verdict: Runtime Error):
n = int(input())
cards = [int(i) for i in input().split()]
cards.sort(reverse=True)
a = 0
b = 0
for i, num in enumerate(cards):
    if(i % 2 == 0):
        a = a + num
    else:
        b = b + num
print a - b

Buggy submission (verdict: Runtime Error):
n = int(input())
cards = [int(i) for i in input().split()]
sorted = cards.sort(reverse=True)
a = 0
b = 0
for i, num in enumerate(sorted):
    if(i % 2 == 0):
        a = a + num
    else:
        b = b + num
print a - b
Problem p03448 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
cond = int(input())

count = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            res = 500 * i + 100 * j + 50 * k
            if(res == cond):
                count = count + 1
print(count)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
cond = int(input())

count = 0
for i in range(a+1):
    for j in range(b+1):
      for k in range(c+1):
	  	  res = 500 * i + 100 * j + 50 * k
          if(res == cond):
            count = count + 1
print(count)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
cond = int(input())

count = 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
		res = 500 * i + 100 * j + 50 * k
        if(res == cond):
          count = count + 1
print(count)
Problem p03457 (python)

Fixed submission:
n = int(input())
for _ in range(n):
  dt, dx, dy = list(map(int, input().split()))
  if( (dx + dy) > dt ):
    print("No")
    exit()
  if((dx + dy) % 2 != dt % 2):
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
n = int(input())
for _ in range(n):
  t, dx, dy = list(map(int, input().split()))
  if( (dx + dy) > dt ):
    print("No")
    exit()
  if((dx + dy) % 2 != dt % 2):
    print("No")
    exit()
print("Yes")
Problem p03470 (python)

Fixed submission:
n = int(input())
num = {}
for i in range(n):
    a = input()
    num[a]=True
print(len(num.keys()))

Buggy submission (verdict: Runtime Error):
n = int(input())
num = {}
for i in range(n):
    a = input()
    num[a]=True
print(num.keys().count())

Buggy submission (verdict: Runtime Error):
n = int(input())
num = {}
for i in range(n):
	a = input()
    num[a]=True
print(num.keys().count())
Problem p03471 (python)

Fixed submission:
in_n, in_cond = map(int, input().split())
def hoge(n, cond):
    for i in range(n+1):
        for j in range(n + 1 -i):
            if(10000 * i + 5000 * j + 1000 * (n - i - j) == cond):
                return [str(i), str(j), str(n - i - j)]
    return ["-1","-1","-1"]
print(" ".join(hoge(in_n, in_cond)))

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())
if(Y > 10000 * N):
  print(-1, -1, -1)
  exit()
for a in N:
  for b in (N - a):
	if(Y == (10000 * a + 5000 * b + 1000 * (N - a - b))):
    	print(a, b, N - a - b)

Buggy submission (verdict: Runtime Error):
in_n, in_cond = map(int, input().split())
def hoge(n, cond):
    for i in range(n+1):
        for j in range(n+1):
            for k in range(n+1):
                if((i + j + k == n) & (10000 * i + 5000 * j + 1000 * k == cond)):
                    return [i, j, k]
    return [-1 -1 -1]
print(" ".join(hoge(in_n, in_cond)))
Problem p03478 (python)

Fixed submission:
n, a, b = (int(i) for i in input().split())
result = 0
for i in range(1, n + 1):
    res = sum([int(j) for j in str(i)])
    if(a <= res & res <= b):
        result = result + i
print(result)

Buggy submission (verdict: Runtime Error):
n, a, b = (int(i) for i in input().split())
count = 0
for i in range(1, n):
    res = sum([int(j) for j in str(i)])
    if(a <= res && res <= b):
        count = count + 1
print(count)

Buggy submission (verdict: Runtime Error):
n, a, b = (int(i) for i in input().split())
count = 0
for i in range(1, n):
    res = sum([int(j) for j in str(i)])
    if(a <= res && res <= b):
       count = count + 1
print(count)

Buggy submission (verdict: Runtime Error):
n, a, b = (int(i) for i in input().split())
count = 0
for i in range(1, n):
    res = sum([int(j) for j in str(i)])
    if(a <= res && res <= b):
        count = count + 1
print(count)

Buggy submission (verdict: Runtime Error):
n, a, b = (int(i) for i in input().split())
count = 0
for i in range(1, n):
    res = sum([int(j) for j in str(n)])
    if(a <= res && res <= b):
        count = count + 1
print(count)
Problem p03494 (python)

Fixed submission:
n = input()
num = [int(i) for i in input().split()]
count = 0
end=False
while(True):
	div = []
	for i in num:
		if(i % 2 == 0):
			div.append(i/2)
		else:
			print(count)
			end = True
			break
	if(end == True):
		break
	num = div
	count = count + 1

Buggy submission (verdict: Runtime Error):
n = input()
num = [int(i) for i in input().split()]
count = 0
end=False
while(True):
	div = []
	for i in num:
		if(i % 2 == 0):
			div.append(i/2)
		else:
			print(count)
			end = True
                        break
	if(end == True):
		break
	num = div
	count = count + 1

Buggy submission (verdict: Runtime Error):
count = 0
end=False
while(True):
	div = []
	for i in num:
		if(i % 2 == 0):
			div.append(i/2)
		else:
			print(count)
			end = True
                        break
	if(end == True):
		break
	num = div
	count = count + 1

Buggy submission (verdict: Runtime Error):
N = input()
num = [int(i) for i in input().split()]

count = 0
end=False
while(True):
	div = []
	for i in num:
		if(i % 2 == 0):
			div.append(i/2)
		else:
			print(count)
			end = True
            break
	if(end == True):
		break
	num = div
	count = count + 1

Buggy submission (verdict: Runtime Error):
N = input()
num = input().split()

count = 0
end=False
while(True):
	div = []
	for i in num:
		if(i % 2 == 0):
			div.append(i/2)
		else:
			print(count)
			end = True
    if(end == True):
		break
	num = div
	count = count + 1

Buggy submission (verdict: Runtime Error):
N = input()
num = input().split()

count = 0
end=False
while(True):
	div = []
	for i in num:
		if(i % 2 == 0):
			div.append(i/2)
		else:
			print(count)
			end = True
    if(end == True):
      break
	num = div
	count = count + 1

Buggy submission (verdict: Runtime Error):
N = input()
num = input().split()

count = 0
while(True):
	div = []
	for i in num:
		if(i % 2 == 0):
			div.append(i/2)
    	else:
			print(count)
			break
	num = div
	count = count + 1

Buggy submission (verdict: Runtime Error):
N = input()
num = input().split()

count = 0
while(True):
	div = []
	for i in num:
		if(i % 2 == 0):
			div.append(i/2)
    	else:
	  		print(count)
        	break
	num = div
	count = count + 1

Buggy submission (verdict: Runtime Error):
N = input()
num = input().split()

count = 0
while(True):
	div = []
	for i in num:
		if(i % 2 == 0):
    		div.append(i/2)
    	else:
	  		print(count)
        	break
	num = div
	count = count + 1

Buggy submission (verdict: Runtime Error):
N = input()
num = input().split()

count = 0
while(True):
	div = []
	for i in num:
	if(i % 2 == 0):
    	div.append(i/2)
    else:
	  	print(count)
        break
	num = div
	count = count + 1

Buggy submission (verdict: Runtime Error):
N = input()
num = input().split()

count = 0
while(True):
	div = []
	for i in num:
	if(i % 2 == 0)
    	div.append(i/2)
    else:
	  	print(count)
        break
	num = div
	count = count + 1
Problem p03547 (python)

Fixed submission:
X, Y= list(map(ord, input().split()))
if(X > Y):
  print(">")
elif(Y > X):
  print("<")
else:
  print("=")

Buggy submission (verdict: Runtime Error):
X, Y= list(map(ord, input().split()))
if(X > Y):
  print(">")
elsif(Y < X):
  print("<")
else:
  print("=")
Problem p03624 (python)

Fixed submission:
s = input()
letters = "abcdefghijklmnopqrstuvwxyz"
hash = {}

for chara in s:
  hash[chara] = 1
  if(len(hash) == 26):
    print("None")
    exit()

for c in letters:
  if c not in hash:
    print(c)
    exit()

Buggy submission (verdict: Runtime Error):
import string

s = input()
letters = string.ascii_lowercase
hash = {}

for chara in s:
  hash[chara] = 1
  if(hash.keys().count() == 26):
    print("None")
    exit()

for c in letters:
  if c not in hash:
    print(c)
    exit()
Problem p03680 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
def search(arr, num, i):
  nxt = arr[num]
  if(nxt == 1):
    return i
  elif(i >= len(arr)):
    return -1
  else:
    return search(arr, nxt, i+1)

n = int(input())
a = [ int(input()) - 1 for _ in range(n)]
print(search(a, 0, 1))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000)
def search(arr, num, i):
  nxt = arr[num]
  if(nxt == 1):
    return i
  elif(i >= len(arr)):
    return -1
  else:
    return search(arr, nxt, i+1)

n = int(input())
a = [ int(input()) - 1 for _ in range(n)]
print(search(a, 0, 1))

Buggy submission (verdict: Runtime Error):
sys.setrecursionlimit(10000)
def search(arr, num, i):
  nxt = arr[num]
  if(nxt == 1):
    return i
  elif(i >= len(arr)):
    return -1
  else:
    return search(arr, nxt, i+1)

n = int(input())
a = [ int(input()) - 1 for _ in range(n)]
print(search(a, 0, 1))

Buggy submission (verdict: Runtime Error):
def search(arr, num, i):
  nxt = arr[num]
  if(nxt == 1):
    return i
  elif(i >= len(arr)):
    return -1
  else:
    return search(arr, nxt, i+1)

n = int(input())
a = [ int(input()) - 1 for _ in range(n)]
print(search(a, 0, 1))

Buggy submission (verdict: Runtime Error):
def search(a, num, i):
  nxt = a[num]
  if(nxt == 1):
    return i
  elif(i >= len(a)):
    return -1
  else:
    return search(a, nxt, i+1)

n = int(input())
a = [ int(input()) - 1 for _ in range(n)]
print(search(a, 0, 1))

Buggy submission (verdict: Runtime Error):
def search(a, num, i):
  nxt = a[num]
  if(nxt == 1):
    return i
  elif(i >= len(a)):
    return -1
  else:
    return search(a, nxt, i+1)

n = int(input())
a = [ int(input())-1 for _ in range(n)]
print(search(a, 0, 1))
Problem p03693 (python)

Fixed submission:
a = int("".join(input().split()))
print("YES" if a % 4 == 0 else "NO")

Buggy submission (verdict: Runtime Error):
a = int("".join(input.split()))
print("YES" if a % 4 == 0 else "NO")
Problem p03699 (python)

Fixed submission:
import itertools
n = int(input())
score = [ int(input()) for _ in range(n)]
cnt = max([sum(c) if sum(c) % 10 != 0 else 0 for i in sorted(range(n-1, n+1)) for c in itertools.combinations(score, i)])
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = [ int(input()) for i in range(n)]
dp = [[0 for _ in range(n+1)] for _ in range(n) ]

for i in range(1, n + 1):
  dp[0][i] = s[0]

for i in range(1, n):
  for  j in range(n + 1):
    if (i == j):
      dp[i][j] = dp[i - 1][j]
    else:
      dp[i][j] = dp[i - 1][j] + s[i]

print(max([it for it in dp[n - 1] if (it % 10 != 0)]))
Problem p03712 (python)

Fixed submission:
h,w = list(map(int, input().split()))
print("#"*(w+2))
for i in range(h):
  print("#", input(), "#", sep="")
print("#"*(w+2))

Buggy submission (verdict: Runtime Error):
w,h = list(map(int, input().split()))
print("#"*(w+2))
for i in range(h):
  print("#", input(), "#", sep="")
print("#"*(w+2))
Problem p03719 (python)

Fixed submission:
a,b,c = list(map(int, input().split()))
print("Yes" if a <= c and c <= b else "No")

Buggy submission (verdict: Runtime Error):
a,b,c = list(map(int, input()))
print("Yes" if a <= c and c <= b else "No")