Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import collections
City = collections.namedtuple("City", ("number", "pref", "year"))

n, m = [int(i) for i in input().split()]
cities = []
for i in range(m):
    pref, year = input().split()
    city = City(i, int(pref), int(year))
    cities.append(city)
id_numbers = []
cities.sort(key=lambda x: x.year)
cities.sort(key=lambda x: x.pref)
prev_pref = None
for city in cities:
    if prev_pref is None or city.pref != prev_pref:
        rank = 1
    else:
        rank += 1
    id_numbers.append((city.number, city.pref, rank))
    prev_pref = city.pref
id_numbers.sort(key=lambda x: x[0])
for i in id_numbers:
    print(f"{i[1]:0>6}{i[2]:0>6}")


Fixed submission:
import collections
City = collections.namedtuple("City", ("number", "pref", "year"))

n, m = [int(i) for i in input().split()]
cities = []
for i in range(m):
    pref, year = input().split()
    city = City(i, int(pref), int(year))
    cities.append(city)
id_numbers = []
cities.sort(key=lambda x: x.year)
cities.sort(key=lambda x: x.pref)
prev_pref = None
for city in cities:
    if prev_pref is None or city.pref != prev_pref:
        rank = 1
    else:
        rank += 1
    id_numbers.append((city.number, city.pref, rank))
    prev_pref = city.pref
id_numbers.sort(key=lambda x: x[0])
for i in id_numbers:
    print("{:0>6}{:0>6}".format(i[1], i[2]))
Buggy python submission (verdict: Runtime Error):
N, T = [int(i) for i in input().split()]


min_cost = 1001
for c, t in [input().split() for _ in range(N)]
    c, t = int(c), int(t)
    if t > T:
        continue
    min_cost = min(min_cost, c)

ans = min_cost if min_cost < 1001 else "TLE"
print(ans)

Fixed submission:
N, T = [int(i) for i in input().split()]


min_cost = 1001
for c, t in [input().split() for _ in range(N)]:
    c, t = int(c), int(t)
    if t > T:
        continue
    min_cost = min(min_cost, c)

ans = min_cost if min_cost < 1001 else "TLE"
print(ans)
Buggy python submission (verdict: Runtime Error):
s = inpit()
ans = 0

for c in s:
  if c == "+":
    ans += 1
  else:
    ans -= 1

print(ans)

Fixed submission:
s = input()
ans = 0

for c in s:
  if c == "+":
    ans += 1
  else:
    ans -= 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
k = int(input())

ss = set()
for i in range(len(s)):
    for j in range(i+1, len(s)+1):
        ss.add(s[i:j])

for i, s in enumerate(sorted(ss), start=1):
    if i == k:
        print(s)
        break


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

ss = set()
for i in range(len(s)):
    for j in range(i+1, min(i+6, len(s)+1)):
        ss.add(s[i:j])

for i, s in enumerate(sorted(ss), start=1):
    if i == k:
        print(s)
        break
Buggy python submission (verdict: Runtime Error):
x, y = int(input())
if x < y:
    print("<")
elif x > y:
    print(">")
else:
    print("=")

Fixed submission:
x, y = input().split()
if x < y:
    print("<")
elif x > y:
    print(">")
else:
    print("=")
Buggy python submission (verdict: Runtime Error):
print(max(int(input())-int(input()), 0))

Fixed submission:
x, t = [int(i) for i in input().split()]
ans = max(x-t, 0)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = {i+1: int(input()) for i in range(N)}

on = 1
ans = -1
count = 0
while True:
    on = a[on]
    count += 1
    if on == 2:
        ans = count
        break
    if on == 1:
        break
print(ans)


Fixed submission:
N = int(input())
a = {i+1: int(input()) for i in range(N)}

on = 1
history = {1}
ans = -1
count = 0
while True:
    on = a[on]
    count += 1
    if on == 2:
        ans = count
        break
    if on in history:
        break
    history.add(on)
print(ans)
Buggy python submission (verdict: Runtime Error):
x, y = [int(i) for i in input().split()]

if x == y == 2:
  print("Yes")
elif x in (4, 6, 9, 11) and y in (4, 6, 9, 11):
  print("Yes")
elif x in (1, 3, 5, 7, 8, 10, 12) and y in (1, 3, 5, 7, 8, 10, 12):
  print("Yes")
else:
  print("No")

Fixed submission:
x, y = [int(i) for i in input().split()]

if x == y == 2:
  print("Yes")
elif x in (4, 6, 9, 11) and y in (4, 6, 9, 11):
  print("Yes")
elif x in (1, 3, 5, 7, 8, 10, 12) and y in (1, 3, 5, 7, 8, 10, 12):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
from itertools import zip_longest

odds, evens = [input() for _ in range(2)]
if len(odds) > len(evens):
    evens.append("")
chars = []
for odd, even in zip_longest(odd, even, fillvalue=""):
    chars.append(odd)
    chars.append(even)
ans = "".join(chars)
print(ans)

Fixed submission:
from itertools import zip_longest

odds, evens = [input() for _ in range(2)]
chars = []
for odd, even in zip_longest(odds, evens, fillvalue=""):
    chars.append(odd)
    chars.append(even)
ans = "".join(chars)
print(ans)

Buggy python submission (verdict: Runtime Error):
odds, evens = input().split()
chars = []
for odd, even in zip(odds, evens):
    chars.append(odd)
    chars.append(even)
ans = "".join(chars)
print(ans)

Fixed submission:
from itertools import zip_longest

odds, evens = [input() for _ in range(2)]
chars = []
for odd, even in zip_longest(odds, evens, fillvalue=""):
    chars.append(odd)
    chars.append(even)
ans = "".join(chars)
print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import deque, defaultdict
from functools import reduce
from operator import mul

N = int(input())
MOD = 10**9 + 7

# 素数の一覧
prime_nums = set([2]) if N > 1 else set()
prime_nums = prime_nums.union(set(range(3, N+1, 2)))
queue = deque([i for i in prime_nums if i*i <= N+1])
while queue:
    num = queue.popleft()
    prime_nums.difference_update({i for i in range(num*2, N+1, num)})
prime_nums = sorted(list(prime_nums))

# 素因数分解
factors = defaultdict(int)
for i in range(2, N+1):
    for j in prime_nums:
        while True:
            if i % j == 0:
                factors[j] += 1
                i //= j
            else:
                break


ans = reduce(mul, [(v+1) % MOD for v in factors.values()])
print(ans % MOD)


Fixed submission:
from collections import deque, defaultdict
from functools import reduce
from operator import mul

N = int(input())
MOD = 10**9 + 7

# 素数の一覧
prime_nums = set([2]) if N > 1 else set()
prime_nums = prime_nums.union(set(range(3, N+1, 2)))
queue = deque([i for i in prime_nums if i*i <= N+1])
while queue:
    num = queue.popleft()
    prime_nums.difference_update({i for i in range(num*2, N+1, num)})
prime_nums = sorted(list(prime_nums))

# 素因数分解
factors = defaultdict(int)
for i in range(2, N+1):
    for j in prime_nums:
        while True:
            if i % j == 0:
                factors[j] += 1
                i //= j
            else:
                break

if N == 1:
    ans = 1
else:
    ans = reduce(mul, [(v+1) % MOD for v in factors.values()])
print(ans % MOD)
Buggy python submission (verdict: Runtime Error):
_, s, _ = input().split()
print(f"A{s[0]}C")

Fixed submission:
_, s, _ = input().split()
print("A{}C".format(s[0]))
Buggy python submission (verdict: Runtime Error):
N, _ = [int(i) for i in input().split()]
S = [input() for _ in range(N)]
ans = "".join(sorted(s))
print(ans)

Fixed submission:
N, _ = [int(i) for i in input().split()]
S = [input() for _ in range(N)]
ans = "".join(sorted(S))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

def readInts():
  return [int(s) for s in input().split(" ")]

MOD = 10 ** 9 + 7

def main():
  S = input()
  dp = [[0 for _ in range(13)] for _a in range(len(S)+1)]

  coef = 1
  dp[0][0] = 1
  for i in range(len(S)):
    c = S[len(S) - 1 - i]
    if c == '?':
      for n in range(10):
        m = (coef * n) % 13
        for k in range(13):
          dp[i+1][(m + k) % 13] += dp[i][k]
          dp[i+1][(m + k) % 13] %= MOD
    else:
      n = int(c)
      m = (coef * n) % 13
      for k in range(13):
        dp[i+1][(m + k) % 13] += dp[i][k]
        dp[i+1][(m + k) % 13] %= MOD
    coef = (coef * 10) % 13
  print(dp[len(S)][5])

if __name__ == "__main__":
  main()


Fixed submission:
# -*- coding: utf-8 -*-

def readInts():
  return [int(s) for s in input().split(" ")]

MOD = 10 ** 9 + 7

def main():
  S = input()
  dp = [[0 for _ in range(13)] for _a in range(len(S)+1)]

  coef = 1
  dp[0][0] = 1
  for i in range(len(S)):
    c = S[len(S) - 1 - i]
    if c == '?':
      for n in range(10):
        m = (coef * n) % 13
        for k in range(13):
          dp[i+1][(m + k) % 13] += dp[i][k]
          dp[i+1][(m + k) % 13] %= MOD
    else:
      n = int(c)
      m = (coef * n) % 13
      for k in range(13):
        dp[i+1][(m + k) % 13] += dp[i][k]
        dp[i+1][(m + k) % 13] %= MOD
    coef = (coef * 10) % 13
  print(dp[len(S)][5])

if __name__ == "__main__":
  main()
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

def readInts():
  return [int(s) for s in input().split(" ")]

def root(groups, n):
  while groups[n] != n:
    n = groups[n]
  return n

def union(groups, x, y):
  rx = root(groups, x)
  ry = root(groups, y)
  if rx != ry:
    groups[ry] = rx

def main():
  N, M = readInts()
  groups = [i for i in range(N)]

  for i in range(M):
    X, Y, Z = readInts()
    union(groups, X-1, Y-1)

  knowns = set()
  for n in range(N):
    knowns.add(root(groups, n))
  print(len(knowns))

if __name__ == "__main__":
  main()


Fixed submission:
# -*- coding: utf-8 -*-

def readInts():
  return [int(s) for s in input().split(" ")]

def root(groups, n):
  i = n
  while groups[i] != i:
    i = groups[i]
  groups[n] = i
  return i

def union(groups, x, y):
  rx = root(groups, x)
  ry = root(groups, y)
  if rx != ry:
    groups[ry] = rx

def main():
  N, M = readInts()
  groups = [i for i in range(N)]

  for i in range(M):
    X, Y, Z = readInts()
    union(groups, X-1, Y-1)

  knowns = set()
  for n in range(N):
    knowns.add(root(groups, n))
  print(len(knowns))

if __name__ == "__main__":
  main()
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

def readInts():
  return [int(s) for s in input().split(" ")]

def gcd(m, n):
  m, n = max(m, n), min(m, n)
  if n == 0:
    return m
  return gcd(n, m % n)

def gcds(A):
  ret = A[0]
  for n in A[1:]:
    ret = gcd(ret, n)
  return ret

def main():
  N = readInts()[0]
  A = readInts()

  m = 1
  for i in range(N):
    m = max(m, gcds(A[0:i] + A[i+1:]))
  print(m)

if __name__ == "__main__":
  main()


Fixed submission:
# -*- coding: utf-8 -*-

def readInts():
  return [int(s) for s in input().split(" ")]

def gcd(m, n):
  m, n = max(m, n), min(m, n)
  if n == 0:
    return m
  return gcd(n, m % n)

def gcds(A):
  ret = A[0]
  for n in A[1:]:
    ret = gcd(ret, n)
  return ret

def main():
  N = readInts()[0]
  A = readInts()

  lgcds = [1 for _ in range(N)]
  lgcds[0] = A[0]
  for i in range(N-1):
    lgcds[i+1] = gcd(lgcds[i], A[i+1])

  rgcds = [1 for _ in range(N)]
  rgcds[N-1] = A[N-1]
  for i in range(1, N):
    rgcds[N-1-i] = gcd(rgcds[N-i], A[N-1-i])

  m = 1
  for i in range(N):
    if i == 0:
      m = max(m, rgcds[i+1])
    elif i == N - 1:
      m = max(m, lgcds[i-1])
    else:
      m = max(m, gcd(lgcds[i-1], rgcds[i+1]))
  print(m)

if __name__ == "__main__":
  main()
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())

rev_flag = False

for i in range(Q):
  in_ = input()
  if len(in_) > 1:
    _, f, c = in_.split()
    f = int(f)
    
    if rev_flag:
      if f==1:
        S = S + c
      elif f==2:
        S = c+S
    else:
      if f==2:
        S = S + c
      elif f==1:
        S = c + S
    
  else:
    # reverse    
    rev_flag = not rev_flag

if rev_flag:
  print(S[-1::-1])
else:
  print(S)
    
  

Fixed submission:
S = input()
Q = int(input())

rev_flag = False

heads = []
tails = []

for i in range(Q):
  in_ = input()
  if len(in_) > 1:
    _, f, c = in_.split()
    f = int(f)
    
    if rev_flag:
      if f==1:
        #S = S + c
        tails.append(c)
      elif f==2:
        #S = c+S
        heads.append(c)
    else:
      if f==2:
        #S = S + c
        tails.append(c)
      elif f==1:
        #S = c + S
        heads.append(c)
    
  else:
    # reverse    
    rev_flag = not rev_flag

if rev_flag:
  ans = "".join(tails[-1::-1]) + S[-1::-1] + "".join(heads)
else:
  ans = "".join(heads[-1::-1]) + S + "".join(tails)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
negative_A = - np.array(A)

ki_idx = [i for i in range(N) if i % 2 == 1]

A_sum = sum(A)

ans = []
for idx, dam in enumerate(A):
    ans.append(str(A_sum - 2*sum(A[ki_idx])))
    
    A = np.roll(A, -1)
    
print(" ".join(ans))

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

irekae_sum = 0
for idx, a in enumerate(A):
    if idx % 2 == 0:    
        irekae_sum += a
    else:
        irekae_sum -= a
        
ans = []
for i in range(N):
    ans.append(str(irekae_sum))
    irekae_sum = - irekae_sum + 2*A[i]
            
print(" ".join(ans))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
negative_A = - np.array(A)

gu_idx = [i for i in range(N) if i % 2 == 0]
ki_idx = [i for i in range(N) if i % 2 == 1]

ans = []
for idx, dam in enumerate(A):
#     print(A[gu_idx])
    ans.append(str(sum(A[gu_idx]) + sum(negative_A[ki_idx])))
    
    A = np.roll(A, -1)
    negative_A = np.roll(negative_A, -1)       
    
print(" ".join(ans))

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

irekae_sum = 0
for idx, a in enumerate(A):
    if idx % 2 == 0:    
        irekae_sum += a
    else:
        irekae_sum -= a
        
ans = []
for i in range(N):
    ans.append(str(irekae_sum))
    irekae_sum = - irekae_sum + 2*A[i]
            
print(" ".join(ans))
Buggy python submission (verdict: Time Limit Exceeded):
R,G,B,N = list(map(int, input().split()))
ans = 0
for r in range(int(N/R)+1):
    for g in range(int(N/G)+1):
        for b in range(int(N/B)+1):
            if r*R+g*G+b*B == N:
                ans += 1
print(ans)
    

Fixed submission:
R,G,B,N = list(map(int, input().split()))
ans = 0
for r in range(N//R+1):
    for g in range((N-r*R)//G+1):
        if (N-r*R-g*G) % B == 0:
             ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

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

import fractions
import copy
from functools import reduce

def gcd(numbers):
    return reduce(fractions.gcd, numbers)

max_gcd = 0
for idx in range(N):
    cleaned = copy.copy(A_list)
    del cleaned[idx]
    gcd_value = gcd(tuple(cleaned))
    if max_gcd < gcd_value:
        max_gcd = gcd_value
print(max_gcd)



Fixed submission:
import numpy as np

def gcd(a,b):    
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)
    
N = int(input())
A_list = list(map(int, input().split()))

# =====
# initialize L and R
# =====
L = np.zeros(N+1)
R = np.zeros(N+1)

for idx, element in enumerate(A_list):
    if L[idx] == 0:
        L[idx+1] = element
    else:
        L[idx+1] = gcd(L[idx], element)

for idx, element in enumerate(A_list[-1::-1]):
    idx = N-idx
    if R[idx] == 0:
        R[idx-1] = element
    else:
        R[idx-1] = gcd(R[idx], element)

ans = 0
for i in range(N):
    if L[i] == 0:
        M = R[i+1]
    elif R[i+1] == 0:
        M = L[i]
    else:
        M = gcd(L[i], R[i+1])
    if ans < M:
        ans = M

print(int(ans))

Buggy python submission (verdict: Runtime Error):
N = int(input())

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

import math
import copy
from functools import reduce

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

max_gcd = 0
for idx in range(N):
    cleaned = copy.copy(A_list)
    del cleaned[idx]
    gcd_value = gcd(tuple(cleaned))
    if max_gcd < gcd_value:
        max_gcd = gcd_value
print(max_gcd)



Fixed submission:
import numpy as np

def gcd(a,b):    
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)
    
N = int(input())
A_list = list(map(int, input().split()))

# =====
# initialize L and R
# =====
L = np.zeros(N+1)
R = np.zeros(N+1)

for idx, element in enumerate(A_list):
    if L[idx] == 0:
        L[idx+1] = element
    else:
        L[idx+1] = gcd(L[idx], element)

for idx, element in enumerate(A_list[-1::-1]):
    idx = N-idx
    if R[idx] == 0:
        R[idx-1] = element
    else:
        R[idx-1] = gcd(R[idx], element)

ans = 0
for i in range(N):
    if L[i] == 0:
        M = R[i+1]
    elif R[i+1] == 0:
        M = L[i]
    else:
        M = gcd(L[i], R[i+1])
    if ans < M:
        ans = M

print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()                                                                                                                                                                                                                                                                                                                                                                                                                                            
list_S = list(S)
N1 = 0

ans_list = []
for color in list_S:
    list_S1 = list_S[N1:]
    list_S2 = list_S[:N1]
    ans = list_S2.count('#') + list_S1.count('.')
    ans_list.append(ans)
    N1 += 1
ans_list.append(list_S.count("#"))
     
print(min(ans_list))

Fixed submission:
N = int(input())
S = input()
S = list(map(lambda x: 0 if x=="." else 1, S))
#all_white
# all_white = sum(S)
# all_black = len(S) - all_white

# white, black, white
ans_list = []
for thresh in range(len(S)):        
    if thresh == 0:
        ans = len(S) - sum(S)
        ans_list.append(ans)
    
    else:
        ans = ans_list[-1]
        if S[thresh-1] == 1: 
            ans += 1
        else:
            ans -= 1
        ans_list.append(ans)
ans_list.append(sum(S))
        
print(min(ans_list))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
S = list(map(lambda x: 0 if x=="." else 1, S))
#all_white
# all_white = sum(S)
# all_black = len(S) - all_white

# white, black, white
ans_list = []
for thresh in range(len(S)+1):
    ans = sum(S[:thresh]) + (len(S[thresh:])-sum(S[thresh:]))
    ans_list.append(ans)
print(min(ans_list))

Fixed submission:
N = int(input())
S = input()
S = list(map(lambda x: 0 if x=="." else 1, S))
#all_white
# all_white = sum(S)
# all_black = len(S) - all_white

# white, black, white
ans_list = []
for thresh in range(len(S)):        
    if thresh == 0:
        ans = len(S) - sum(S)
        ans_list.append(ans)
    
    else:
        ans = ans_list[-1]
        if S[thresh-1] == 1: 
            ans += 1
        else:
            ans -= 1
        ans_list.append(ans)
ans_list.append(sum(S))
        
print(min(ans_list))
Buggy python submission (verdict: Runtime Error):
b = inout()
if  b == "A":
    print("T")
elif b == "C":
    print("G")
elif b == "T":
    print("A")
else:
    print("C")

Fixed submission:
b = input()
if  b == "A":
    print("T")
elif b == "C":
    print("G")
elif b == "T":
    print("A")
else:
    print("C")
Buggy python submission (verdict: Runtime Error):
#B
A,B,K = map(int, input().split())

waru = []
for i in range(1, max(A,B)+1, 1):
    if len(waru) == K-1:
        break
    if A%i == 0 and B%i == 0:
        waru.append(i)
print(waru[-1])


Fixed submission:
#B
A,B,K = map(int, input().split())

waru = []
for i in range(1, max(A,B)+1, 1):
    if A%i == 0 and B%i == 0:
        waru.append(i)
print(waru[-K])
Buggy python submission (verdict: Runtime Error):
T, X = map(int, input(),split())
print(T/X)

Fixed submission:
T, X = map(int, input().split())

print(T/X)
Buggy python submission (verdict: Runtime Error):
N = int(input())
L_list = list(map(int, input().split()))

max_ = max(L_list)
L_list.remove(max_)

if max_ < np.sum(L_list):
    print("Yes")
else:
    print("No")

Fixed submission:
import numpy as np
N = int(input())
L_list = list(map(int, input().split()))

max_ = max(L_list)
L_list.remove(max_)

if max_ < np.sum(L_list):
    print("Yes")
else:
    print("No")

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

max_ = max(L_list)
L_list.remove(max_)

if max_ < np.sum(L_list):
    print("Yes")
else:
    print("No")

Fixed submission:
import numpy as np
N = int(input())
L_list = list(map(int, input().split()))

max_ = max(L_list)
L_list.remove(max_)

if max_ < np.sum(L_list):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n, m, X, Y = map(int, input().split())
x = map(int, input().split())
y = map(int, input().split())

if(max(x, X) < min(y, Y)):
    print("No War")
else:
    print("War")

Fixed submission:
n, m, X, Y = map(int, input().split())
x = map(int, input().split())
y = map(int, input().split())

if(max(max(x), X) < min(min(y), Y)):
    print("No War")
else:
    print("War")
Buggy python submission (verdict: Runtime Error):
#C - Skip
N, X = map(int, input().split())
x_list = list(map(int, input().split()))

residual = [abs(x - X) for x in x_list]

def gcd(a,b):
    if(b==0):
        return a
    else:
        return gcd(b, a%b)
        
max_ = 0
for i in range(len(residual)):
    if(i == 0):
        max_ = gcd(residual[i], residual[i+1])
    elif(i == N-1):
        print(max_)
    else:
        max_ = gcd(residual[i], max_)

        

Fixed submission:
#C - Skip
import sys

N, X = map(int, input().split())
x_list = list(map(int, input().split()))

residual = [abs(x - X) for x in x_list]

def gcd(a,b):
    if(b==0):
        return a
    else:
        return gcd(b, a%b)
        
max_ = 0
for i in range(len(residual)):
    if(N==1):
        print(residual[0])
        break
    
    if(i == 0):
        max_ = gcd(residual[i], residual[i+1])
    elif(i == N-1):
        print(max_)
    else:
        max_ = gcd(residual[i], max_)

Buggy python submission (verdict: Runtime Error):
#C - Skip
N, X = map(int, input().split())
x_list = list(map(int, input().split()))

residual = [abs(x - X) for x in x_list]

def gcd(a,b):
    if(b==0):
        return a
    else:
        gcd(b, a%b)
        
max_ = 0
for i in range(len(residual)):
    if(i == 0):
        max_ = gcd(residual[i], residual[i+1])
    elif(i == N-1):
        print(max_)
    else:
        max_ = gcd(residual[i], max_)

Fixed submission:
#C - Skip
import sys

N, X = map(int, input().split())
x_list = list(map(int, input().split()))

residual = [abs(x - X) for x in x_list]

def gcd(a,b):
    if(b==0):
        return a
    else:
        return gcd(b, a%b)
        
max_ = 0
for i in range(len(residual)):
    if(N==1):
        print(residual[0])
        break
    
    if(i == 0):
        max_ = gcd(residual[i], residual[i+1])
    elif(i == N-1):
        print(max_)
    else:
        max_ = gcd(residual[i], max_)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())

while n*(a-1)+1 < b:
  n += 1

print(n)

Fixed submission:
n = 0
a, b = map(int, input().split())
while n*(a-1)+1 < b:
  n += 1

print(n)