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

Fixed submission:
import sys
input = sys.stdin.readline

s = list(input())
t = list(input())
n = len(s)-1
m = len(t)-1
value = [[0]*(m+1) for i in range(n+1)]


for i in range(n):
    for j in range(m):
        if s[i] == t[j]:
            value[i + 1][j + 1] = value[i][j] + 1
        elif value[i][j + 1] > value[i + 1][j]: #UP
            value[i + 1][j + 1] = value[i][j + 1]
        else:  # LEFT
            value[i + 1][j + 1] = value[i + 1][j]
i = n-1
j = m-1
ans=""
while i >= 0 and j >= 0:
    if s[i] == t[j]:
        ans = s[i] + ans
        i -= 1
        j -= 1
    elif value[i][j + 1] > value[i + 1][j]:
        i -= 1
    else:
        j -= 1
print(ans)

Buggy submission (verdict: Runtime Error):
input = sys.stdin.readline

def inp_str():
    '''
    一行の文字をlistで取得
    '''
    return list(input())[:-1]


s = inp_str()
t = inp_str()
n = len(s)
m = len(t)
value = [[0]*(m+1) for i in range(n+1)]
ans = [[""]*(m+1) for i in range(n+1)]

for i in range(n):
    for j in range(m):
        if s[i] == t[j]:
            value[i + 1][j + 1] = value[i][j] + 1
            ans[i + 1][j + 1] = "".join([ans[i][j], s[i]])
        elif value[i][j + 1] > value[i + 1][j]: #UP
            ans[i + 1][j + 1] = ans[i][j + 1]
            value[i + 1][j + 1] = value[i][j + 1]
        else:  # LEFT
            ans[i + 1][j + 1] = ans[i + 1][j]
            value[i + 1][j + 1] = value[i + 1][j]

print(ans[n][m])
Problem p03285 (python)

Fixed submission:
n=int(input())
while True:
  if n%4==0:
    print("Yes")
    break
  n-=7
  if n<0:
    print("No")
    break

Buggy submission (verdict: Runtime Error):
n=input()
while True:
  if n%4==0:
    print("YES")
    break
  n-=7
  if n<0:
    print("NO")
    break

Buggy submission (verdict: Runtime Error):
n=input()
while True:
  if n%4==0:
    print("YES")
    exit()
  n-=7
  if n<0:
    print("NO")
    exit()
Problem p03293 (python)

Fixed submission:
s=list(input())
t=list(input())
for i in range(len(s)):
  if s==t:
    print("Yes")
    exit()
  s.append(s[0])
  s=s[1:]
print("No")

Buggy submission (verdict: Runtime Error):
s=list(input())
t=list(input())
for i in range(len(s)):
  if s==t:
    print("Yes")
    exit()
  s=s[1:].append(s[0])
print("No")

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
if s.sort() == t.sort():
  print("Yes")
else:
  print("No")
Problem p03308 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
print(abs(max(a)-min(a)))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
print(abs(max(a)-min(a))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
print(abs(a.max()-a.min())
Problem p03378 (python)

Fixed submission:
n,m,x=map(int,input().split())
a=list(map(int,input().split()))
print(min(len([i for i in a if i<x]),len([j for j in a if j>x])))

Buggy submission (verdict: Runtime Error):
n,m,x=map(int,input().split())
a=list(map(int,input().split()))
print(min(len([i for i in a if i<x]),len([j for j in a if i>x])))
Problem p03434 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
print(sum(a[::2])-sum(a[1::2]))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[map(int,input().split())]
a.sort(reverse=True)
print(sum(a[::2]-a[1::2])
Problem p03455 (python)

Fixed submission:
a,b=map(int,input().split())
print("Odd") if (a*b)%2==1 else print("Even")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input())
print("Odd") if (a*b)%2==1 else print("Even")
Problem p03574 (python)

Fixed submission:
h,w=map(int,input().split())
s=[list(input().replace(".","0")) for i in range(h)]
for i in range(h):
  for j in range(w):
    if s[i][j]=="#":
      for k in range(-1,2):
        for l in range(-1,2):
          if 0<=i+k<h and 0<=j+l<w and s[i+k][j+l]!="#":
              s[i+k][j+l]=str(int(s[i+k][j+l])+1)
for i in range(h):
  for j in range(w):
    print(s[i][j], end="")
  print()

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
s=[list(input().replace(".","0")) for i in range(h)]
for i in range(h):
  for j in range(w):
    if s[i][j]=="#":
      for k in range(-1,2):
        for l in range(-1,2):
          if 0<=i+k<=h and 0<=j+l<=w and s[i+k][j+l]!="#":
            s[i+k][j+l]=str(int(s[i+k][j+l])+1)
for i in range(h):
  for j in range(w):
    print(s[i][j], end="")
  print()
Problem p02576 (python)

Fixed submission:
n,x,t = map(int, input().split())
if n%x == 0:
  print((n//x)*t)
else:
  print((n//x + 1)*t)

Buggy submission (verdict: Runtime Error):
import collections
h, w, m = map(int, input().split())
L_g = []
L_r = []
L = []
for i in range(m):
    a, b = map(int, input().split())
    L_g.append(a)
    L_r.append(b)
    L.append((a, b))
c1 = collections.Counter(L_g)
c2 = collections.Counter(L_r)

L1 = c1.most_common()
L2 = c2.most_common()

s = L1[0][1]
bL1 = []
d = 0
for i in range(len(L1)):
    if L1[i][1] == s:
        bL1.append(L1[i])
        d += 1
        if d == 3:
          break
    else:
        break
s = L2[0][1]
bL2 = []
d = 0
for i in range(len(L2)):
    if L2[i][1] == s:
        bL2.append(L2[i])
        d += 1
        if d == 3:
          break
    else:
        break
bL = []
for i in range(len(bL1)):
    for j in range(len(bL2)):
        bL.append((bL1[i][0], bL2[j][0]))
flag = 0
for e in bL:
    if e not in L:
        bom = e
        flag = 1
        break
if flag == 0:
    bom = bL[0]

t = L1[0][1]+L2[0][1]

if flag == 0:
        t -= 1
print(t)
Problem p02584 (python)

Fixed submission:
x, k, d = map(int, input().split())
x = abs(x)
if x > k*d:
    print(x-k*d)
else:
    p = x//d
    c = k-p
    if p == 0 or p==1:
          for i in range(1,k+1):
            p2 = x-i*d
            c = k-i
            if p2 <= 0:
                if c%2 != 0:
                    print(abs(d+p2))
                    break
                elif c%2 == 0:
                    print(abs(p2))
                    break
    elif (c%2 == 0):
        print(abs(x-p*d))
    else:
        print(abs(d-abs(x-p*d)))

Buggy submission (verdict: Runtime Error):
x, k, d = map(int, input().split())
x = abs(x)
if x > k*d:
    print(x-k*d)
else:
    p = x//d
    if p == 0 or p==1:
          for i in range(1,k+1):
            p2 = x-i*d
            c = k-i
            if p2 <= 0:
                if c%2 != 0:
                    print(abs(d+p2))
                    break
                elif c%2 == 0:
                    print(abs(p2))
                    break
    c = k-p
    elif c%2 == 0:
        print(abs(x-p*d))
    else:
        print(abs(d-abs(x-p*d)))

Buggy submission (verdict: Runtime Error):
x, k, d = map(int, input().split())
x = abs(x)
if x > k*d:
    print(x-k*d)
else:
    p = x//d
    if p == 1:
          for i in range(1,k+1):
            p2 = x-i*d
            c = k-i
            if p2 <= 0:
                if c%2 != 0:
                    print(abs(d+p2))
                    break
                elif c%2 == 0:
                    print(abs(p2))
                    break
    elif k%p == 0:
        print(abs(x-p*d))
    else:
        print(abs(d*(p+1)-x))

Buggy submission (verdict: Runtime Error):
for i in range(5,0,-1):
Problem p02646 (python)

Fixed submission:
a,v =map(int, input().split())
b,w =map(int, input().split())
t=int(input())

if a*b<0:
    if a > 0:
        d = a-b
    else:
        d = b-a
else:
    d = a-b
if d < 0:
    d = -d
if v > w:
    d2 = v-w
else:
    d2 = w-v
if  (v > w) and (d2*t < d):
    print("NO")
elif v <= w:
    print("NO")
else:
    print("YES")

Buggy submission (verdict: Runtime Error):
a,v =map(int, input().split())
b,w =map(int, input().split())
t=int(input())
if a == b:
    print("YES")
    c+=1
if a*b<0:
    d = a+b
else:
    d = a-b
if d < 0:
    d = -d
if v > w:
    d2 = v-w
else:
    d2 = w-v
if  (v > w) and (d2*t < d) and c==0:
    print("NO")
elif v <= w and c==0:
    print("NO")
elif c==0:
    print("YES")

Buggy submission (verdict: Runtime Error):
a,v =map(int, input().split())
b,w =map(int, input().split())
t=int(input())
a1 = abs(a)
b1 = abs(b)
if a*b<0:
  d = a1+b1
else:
  d = ans(a-b)
d2 = abs(v-w)

if  (v > w) and (d2*t < d):
    print("NO")
elif v <= w:
    print("NO")
else:
    print("YES")

Buggy submission (verdict: Runtime Error):
a,v =map(int, input().split())
b,w =map(int, input().split())
t=int(input())
if a < 0:
    if b < 0:
        d = (-a+b)**2**0.5
    else:
        d = -a + b
else:
    if b < 0:
        d = a - b
    else:
        d = (a - b)**2**0.5
d2 = (v-w)**2**0.5

if  (v > w) and (d2*t < d):
    print("NO")
elif v <= w:
    print("NO")
else:
    print("YES")

Buggy submission (verdict: Runtime Error):
a,v =map(int, input().split())
b,w =map(int, input().split())
t=int(input())
if v > w and ((v-w)**2**0.5)*t > ((a-b)**2**0.5):
    print("NO")
elif v > w:
    print("YES")
else:
    print("NO")
Problem p02719 (python)

Fixed submission:
n, k = map(int, input().split())
w = n%k
w2 = abs(w-k)
if w > w2:
    print(w2)
else:
    print(w)

Buggy submission (verdict: Runtime Error):
list1=[]
a,b=map(int,input().split())
d=a
e=a
if b==1:
    print(0)
else:
    for i in range(d):
        a=abs(a-b)
        list1.append(a)
        if e<a:
            break
    list2= sorted(list1, reverse=True)
    print(list2[-1])

Buggy submission (verdict: Runtime Error):
list1=[]
a,b=map(int,input().split())
d=a
for i in range(d):
    e=a
    a=abs(a-b)
    list1.append(a)
    if e<a:
        break
list2= sorted(list1, reverse=True)
print(list2[-1])

Buggy submission (verdict: Runtime Error):
list1=[]
a,b=map(int,input().split())
d=a
for i in range(d):
    a=abs(a-b)
    list1.append(a)
list2= sorted(list1, reverse=True)
print(list2[-1])
Problem p02730 (python)

Fixed submission:
s = list(input())
n = len(s)
flag = 0
for i in range(n//2):
    if s[i] != s[n-i-1]:
        flag = 1
if flag == 0:
    s2 = s[:(n-1)//2]
    n2 = len(s2)
    for i in range(n2//2):
        if s2[i] != s2[n2-i-1]:
            flag = 1
#print(n, n2, s, s2)
if flag == 0:
    if flag == 0:
        s2 = s[(n+3)//2-1:]
        n2 = len(s2)
    for i in range(n2//2):
        if s2[i] != s2[n2-i-1]:
            flag = 1
#print(s2)
if flag == 0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s1=input()
l=len(s1)
h=(l-1)//2
k1=s1[:h]
k2=s1[h+1:]
if k1==k2:
    a=(l-1)//2
    s3=s1[:a]
    if a%2!=0:
        h2=(a-1)//2
        j1=s3[:h2]
        j2=s3[h2+1:]
        if j1==j2:
            b=(l+3)/2
            b2=l-b+1
            s4=s1[:b2]
            h3=(b2-1)//2
            f1=s3[:h3]
            f2=s3[h3+1:]
            if f1==f2:
                print("Yes")
            else:
                print("No")
        else:
            print("No")
    else:
        h2=a/2
        j1=s3[:h2]
        j2=s3[h2+1:]
        if j1==j2:
            b=(l+3)/2
            b2=l-b+1
            s4=s1[:b2]
            h3=(b2-1)//2
            f1=s3[:h3]
            f2=s3[h3+1:]
            if f1==f2:
                print("Yes")
            else:
                print("No")
        else:
            print("No")
else:
    print("No")
Problem p02765 (python)

Fixed submission:
n, r = map(int,input().split())
if n >= 10:
    print(r)
else:
    print(r+100*(10-n))

Buggy submission (verdict: Runtime Error):
n, r = int(input())
if n >= 10:
    print(r)
else:
    print(r+100*(10-n))
Problem p02817 (python)

Fixed submission:
s,t = map(str,input().split())
print(t+s)

Buggy submission (verdict: Runtime Error):
s, t = map(int,input().split())
print(t+s)
Problem p02660 (python)

Fixed submission:
n = int(input())

from collections import Counter

factors = []
i = 2
while n > 1:
   if n < i * i:
      factors.append(n)
      break
   while n % i == 0:
      factors.append(i)
      n //= i
   i += 1

ans = 0
for cnt in Counter(factors).values():
   i = 1
   while cnt >= i:
      cnt -= i
      i += 1
      ans += 1
print(ans)

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

def factorization(x):
   arr = []
   tmp = x
   for i in range(2, int(n**0.5)+1):
      if tmp % i == 0:
         cnt = 0
         while tmp % i == 0:
            cnt += 1
            tmp //= i
         arr.append([i, cnt])
   if tmp != 1:
      arr.append([tmp, cnt])
   if len(arr) == 0:
      arr.append([x, 1])
   return arr

if n == 1:
   print(0)
   exit()

ans = 0
for p, i in factorization(n):
   j = 0
   while i > j:
      j += 1
      i -= j
      ans += 1
print(ans)

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

def factorization(x):
   arr = []
   tmp = x
   for i in range(2, int(n**0.5+1)):
      if tmp % i == 0:
         cnt = 0
         while tmp % i == 0:
            tmp //= i
            cnt += 1
         arr.append([i, cnt])
   if tmp != 1:
      arr.append([i, cnt])
   if len(arr) == 0:
      arr.append([x, 1])
   return arr

if n == 1:
   print(0)
   exit()

ans = 0
for p, i in factorization(n):
   j = 0
   while i > j:
      j += 1
      i -= j
      ans += 1
print(ans)
Problem p02691 (python)

Fixed submission:
from collections import Counter

n = int(input())
a = list(map(int, input().split()))

l = []
r = []
for i, ai in enumerate(a):
   l.append(i+ai)
   r.append(i-ai)

ans = 0
b = Counter(r)
for i in l:
   ans += b.get(i, 0)

print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter

n = int(input())
a = list(map(int, input().split()))

r = []
for i, ai in enumerate(a):
   l.append(i+ai)
   r.append(i-ai)

ans = 0
b = Counter(r)
for i in l:
   ans += b.get(i, 0)

print(ans)
Problem p02756 (python)

Fixed submission:
from collections import deque

s = input()
q = int(input())

t = deque(s)

reverse = False
for _ in range(q):
   query = input()
   if query[0] == '1':
      reverse = not reverse
   elif query[0] == '2':
      _, f, c = query.split()
      if f == '1':
         if reverse:
            t.append(c)
         else:
            t.appendleft(c)
      elif f == '2':
         if reverse:
            t.appendleft(c)
         else:
            t.append(c)

result = ''.join(t)
if reverse:
   result = result[::-1]
print(result)

Buggy submission (verdict: Runtime Error):
rom collections import deque

s = input()
q = int(input())

t = deque(s)

reverse = False
for _ in range(q):
   query = input()
   if query[0] == '1':
      reverse = not reverse
   elif query[0] == '2':
      _, f, c = query.split()
      if f == '1':
         if reverse:
            t.append(c)
         else:
            t.appendleft(c)
      elif f == '2':
         if reverse:
            t.appendleft(c)
         else:
            t.append(c)

result = ''.join(t)
if reverse:
   result = result[::-1]
print(result)
Problem p02760 (python)

Fixed submission:
import sys

a = []
for i in range(3):
   a.append([int(x) for x in input().split()])

n = int(input())
b = [int(input()) for _ in range(n)]

for i in range(n):
   for j in range(3):
      for k in range(3):
         if (b[i] == a[j][k]):
            a[j][k] = 0

for i in range(3):
   x = 0
   for j in range(3):
      x += a[j][i]
   if (x == 0):
      print('Yes')
      sys.exit()

tmp = [sum(a[i]) for i in range(3)]
if (min(tmp) == 0):
   print('Yes')
elif (a[0][0] + a[1][1] + a[2][2] == 0):
   print('Yes')
elif (a[0][2] + a[1][1] + a[2][0] == 0):
   print('Yes')
else:
   print('No')

Buggy submission (verdict: Runtime Error):
a = []
for i in range(3):
   a.append([int(x) for x in input().split()])

n = int(input())
b = [int(input()) for _ in range(n)]

for i in range(n):
   for j in range(3):
      for k in range(3):
         if (b[i] == a[j][k]):
            a[j][k] = 0

tmp = [sum(a[i]) for i in range(3)]
if (min(tmp) == 0):
   print('Yes')
   exit(1)

for i in range(3):
   x = 0
   for j in range(3):
      x += a[j][i]
   if (x == 0):
      print('Yes')
      exit(1)

if (a[0][0] + a[1][1] + a[2][2] == 0):
   print('Yes')
elif (a[0][2] + a[1][1] + a[2][0] == 0):
   print('Yes')
else:
   print('No')

Buggy submission (verdict: Runtime Error):
a = []
for i in range(3):
   a.append([int(x) for x in input().split()])

n = int(input())
b = [int(input()) for _ in range(n)]

for i in range(n):
   for j in range(3):
      for k in range(3):
         if (b[i] == a[j][k]):
            a[j][k] = 0

for i in range(3):
   sum = 0
   for j in range(3):
      sum += a[i][j]
   if (sum == 0):
      print('Yes')
      exit(1)

for i in range(3):
   sum = 0
   for j in range(3):
      sum += a[j][i]
   if (sum == 0):
      print('Yes')
      exit(1)

if (a[0][0] + a[1][1] + a[2][2] == 0):
   print('Yes')
elif (a[0][2] + a[1][1] + a[2][0] == 0):
   print('Yes')
else:
   print('No')
Problem p02761 (python)

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

t = [-1] * n
for _ in range(m):
   s, c = map(int, input().split())
   s -= 1

   if (t[s] != -1 and t[s] != c):
      print(-1)
      exit()
   t[s] = c

if (n > 1):
   if (t[0] == 0):
      print(-1)
      exit()

   if (t[0] == -1):
      t[0] = 1

   for i in range(1, n):
      if (t[i] == -1):
         t[i] = 0

else:
   if (t[0] == -1):
      t[0] = 0

print(''.join(map(str, t)))

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

t = [0] * n
for i in range(m):
   if(n > 1 and x[i][1] == 0):
      print(-1)
      exit()
   if(n > 1 and t[x[i][0]-1] > 0 and t[x[i][0]-1] != x[i][1]):
      print(-1)
      exit()

   t[x[i][0]-1] = x[i][1]

[print(t[i], end='') for i in range(m)]
print()
Problem p02796 (python)

Fixed submission:
n = int(input())

r = [[0, 0]] * n
for i in range(n):
   x, l = map(int, input().split())
   r[i] = [x+l, x-l]
r.sort()

cur = -1000000000
ans = 0
for i in range(n):
   if (cur <= r[i][1]):
      ans += 1
      cur = r[i][0]

print(ans)

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

r = [[0, 0]] * n
for i in range(n):
   x, l = map(int, input().split())
   r[i] = [x-l, x+l]
r.sort()


while (1):
   ok = len(r)

   for i in range(0, len(r)):
      if (i==0):
         if (r[i][1] > r[i+1][0]):
            ok -= 1
            break
      elif (i==len(r)-1):
         if (r[i][0] > r[i-1][1]):
            ok -= 1
            break
      elif (r[i][0] > r[i-1][1] or r[i][1] > r[i+1][0]):
         ok -= 1
         break

   if (ok == len(r) or ok == 1):
      print(ok)
      exit()
   else:
      r.pop(i)
Problem p02802 (python)

Fixed submission:
N, M = map(int, input().split())

ac = [False] * N
wa = [0] * N
for _ in range(M):
   p, S = input().split()
   p = int(p) - 1
   if (S == 'AC'):
      ac[p] = True
   else:
      if not ac[p]:
         wa[p] += 1

a = 0
b = 0
for i in range(N):
   if ac[i]:
      a += 1
      b += wa[i]
print(*[a, b])

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())

ac = [False] * N
wa = [0] * N
for _ in range(M):
   p, S = input().split()
   p = int(p) - 1
   if (S == 'AC'):
      ac[p] = True
   else:
   if not ac[p]:
      wa[p] += 1

a = 0
b = 0
for i in range(N):
   if ac[i]:
      a += 1
      b += wa[i]
      print(*[a, b])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
x = [input().split() for i in range(m)]

y = ['WA' if (x[i][1]=='WA' and i<x.index([x[i][0], 'AC'])) else 'AC' if (x[i][1]=='AC' and i==x.index(x[i])) else 'None' for i in range(m)]
print(y.count('AC'), y.count('WA'))
Problem p02811 (python)

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

if (500 * k >= x):
   print('Yes')
else:
   print('No')

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

count = 0
for i in range(0, len(s)-2):
   if(s[i] == 'A' and s[i+1] == 'B' and s[i+2] == 'C'):
      count += 1
print(count)
Problem p02812 (python)

Fixed submission:
n = int(input())
s = input()

print(s.count('ABC'))

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

count = 0
for i in range(0, len(s)):
   if(s[i] == 'A' and s[i+1] == 'B' and s[i+2] == 'C'):
      count += 1
print(count)
Problem p03061 (python)

Fixed submission:
from fractions import gcd
from functools import reduce

n = int(input())
a = [int(x) for x in input().split()]

left = [0] * (n + 1)
right = [0] * (n + 1)
for i in range(n):
   left[i+1] = gcd(left[i], a[i])
   right[n-i-1] = gcd(right[n-i], a[n-1-i])

ans = 0
for i in range(n):
   ans = max(ans, gcd(left[i], right[i+1]))
print(ans)

Buggy submission (verdict: Runtime Error):
from math import gcd
from functools import reduce
from itertools import combinations

n = int(input())
a = [int(x) for x in input().split()]

b = list(combinations(a, n-1))

gcd_a = [reduce(gcd, list(x)) for x in b]
print(max(gcd_a))
Problem p03262 (python)

Fixed submission:
from fractions import gcd

n, X = map(int, input().split())
x = list(map(int, input().split()))

z = list(map(lambda i: abs(X - i), x))
ans = z[0]
for i in range(1, n):
   ans = gcd(ans, z[i])
print(ans)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

n, X = map(int, input().split())
x = [int(i) - X for i in input().split()]

print(reduce(math.gcd, x))

Buggy submission (verdict: Runtime Error):
n, X = map(int, input().split())
x = [int(i) - X for i in input().split()]

import math
from functools import reduce

def gcd(*numbers):
   return reduce(math.gcd, numbers)

print(gcd(*x))
Problem p03282 (python)

Fixed submission:
s = input()
k = int(input())

c1 = False
for i in range(k):
   x = s[i]
   if (x == '1'):
      c1 = True

   else:
      print(x)
      exit()

if (c1):
   print('1')

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())

x = int(s[0])
if (x == 1):
   print(s[1])
else:
   print(s[0])
Problem p03471 (python)

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

for i in range(n+1):
   for j in range(n-i+1):
      if (10000 * i + 5000 * j + 1000 * (n - i - j) == y):
         print(i, j, n - i - j)
         exit()

print(-1, -1, -1)

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

for nx in range(n+1):
   for ny in range(n-i+1):
      if (1000 * nx + 5000 + ny * 1000 * (n - nx - ny) == y):
         print(nx, ny, n - nx - ny)
         exit()

print(-1, -1, -1)
Problem p03679 (python)

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

now = b - a
if (now <= 0):
   print('delicious')
elif (now > 0 and now <= x):
   print('safe')
else:
   print('dangerous')

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

# 1: now, -1: visited, 0: none
b[0] = 1
now = 0
count = 0
while (b[1] != 1 and count <= n):
   next = a[now] - 1

   if (b[next] == -1):
      print(-1)
      exit()

   b[now] = -1
   b[next] = 1

   now = next
   count += 1

if (b[1] == 1):
   print(count)
else:
   print(-1)
Problem p03695 (python)

Fixed submission:
n = int(input())
a = [int(int(x)/400) for x in input().split()]
b = [x if x <= 7 else 8 for x in a]

ans = len(set(b))
if (8 in b):
   ans -= 1
   ans2 = b.count(8) + ans
   if (ans == 0):
      print(1, ans2)
   else:
      print(ans, ans2)
else:
   print(ans, ans)

Buggy submission (verdict: Runtime Error):
ans = len(set(b))
if (8 in b):
   ans -= 1
   ans2 = b.count(8) + ans
   if (ans == 0):
      print(1, ans2)
   else:
      print(ans, ans2)
else:
   print(ans, ans)
Problem p03861 (python)

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

def f(n, x):
   if (n < 0):
      return(0)
   else:
      return(n//x+1)

print(f(b, x) - f(a-1, x))

Buggy submission (verdict: Runtime Error):
def f(n, x):
   if (n < 0):
      return(0)
   else:
      return(n//x+1)

print(f(b, x) - f(a-1, x))