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

Fixed submission:
N = int(input())
dict_c = {}
for char in input():
  if char in dict_c:
    dict_c[char] += 1
  else:
    dict_c[char] = 1

for _ in range(N-1):
  word = input()
  dict_t = {}
  for char in word:
    if char in dict_t:
      dict_t[char] += 1
    else:
      dict_t[char] = 1
  for char, cnt in dict_c.items():
    if cnt != 0:
      if not char in dict_t:
        dict_c[char] = 0
      else:
        dict_c[char] = min(cnt, dict_t[char])
ans = ''
for char, cnt in sorted(dict_c.items(), key=lambda x: x[0]):
  ans += char*(cnt)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
dict_c = {}
for char in input():
  if char in dict_c:
    dict_c[char] += 1
  else:
    dict_c[char] = 1

for _ in range(N-1):
  word = input()
  dict_t = dict_c
  for char in word:
    if char in dict_t:
      dict_t[char] += 1
    else:
      dict_t[char] = 1
  for char, cnt in dict_c.items():
    if cnt != 0 and cnt != dict_c[char]:
      dict_c[char] = 0
ans = ''
for char, cnt in dict_c.items().sort(key=lambda x: x[0]):
  ans += char*(cnt)
print(ans)
Problem p03814 (python)

Fixed submission:
S = input()
pos_a = -1
pos_z = -1
for i in range(len(S)):
  if S[i] == 'A' and pos_a < 0:
    pos_a = i
  if S[len(S)-i-1] == 'Z' and pos_z < 0:
    pos_z = len(S)-i-1
  if pos_a >= 0 and pos_z > 0:
    break
print(pos_z-pos_a+1)

Buggy submission (verdict: Runtime Error):
S = input()
pos_a = -1
pos_z = -1
for i in range(len(S)):
  if S[i] == 'A' and pos_a < 0:
    pos_a = i
  if S[len(S)-i] == 'Z' and pos_z < 0:
    pos_z = len(S)-i
  if pos_a >= 0 and pos_z > 0:
    break
print(pos_z-pos_a+1)
Problem p03845 (python)

Fixed submission:
N = int(input())
times = list(map(int, input().split()))
M = int(input())
sum_t = sum(times)
for _ in range(M):
  dist, time = map(int, input().split())
  if times[dist-1] >= time:
    print(sum_t-(times[dist-1]-time))
  else:
    print(sum_t+(time-times[dist-1]))

Buggy submission (verdict: Runtime Error):
N = int(input())
times = map(int, input().split())
M = int(input())
sum_t = sum(times)
for _ in range(M):
  dist, time = map(int, input().split())
  if times[dist-1] >= time:
    print(sum_t-(times[dist-1]-time))
  else:
    print(sum_t+(time-times[dist-1]))
Problem p03846 (python)

Fixed submission:
N = int(input())
nums = list(map(int, input().split()))
n_dict = {}
idx = 0
mod = ((N%2)+1)%2
while True:
  if 2*idx + mod > N:
    break
  else:
    n_dict[2*idx+mod] = 0
  idx += 1
for num in nums:
  if num in n_dict:
    n_dict[num] += 1
  else:
    print(0)
    exit()
for key, value in n_dict.items():
  if value != 2 and key != 0:
    print(0)
    exit()
print((2**(N//2))%(10**9+7))

Buggy submission (verdict: Runtime Error):
N = int(input())
nums = list(map(int, input().split()))
n_dict = {}
idx = 0
mod = !(N%2)
while True:
  if 2*idx + mod > N:
    break
  else:
    n_dict[2*idx+mod] = 0
for num in nums:
  if num in n_dict:
    n_dict[num] += 1
  else:
    print(0)
    exit()
for key, value in n_dict.items():
  if value != 2:
    print(0)
    exit()
print((2**(N//2))%(10**9+7))
Problem p03852 (python)

Fixed submission:
c = input()
if c in ['a', 'i', 'u', 'e', 'o']:
  print('vowel')
else:
  print('consonant')

Buggy submission (verdict: Runtime Error):
N, K, L = map(int, input().split())
par = list(range(N+1))
rank = [0] * (N+1)
cnt = [1] * (N+1)
def root(x):
  if par[x] == x:
    return x
  else:
    par[x] = root(par[x])
    return par[x]

def same(x, y):
  return root(x) == root(y)

def unite(x, y):
  xr = root(x)
  yr = root(y)
  if xr == yr:
    return
  if rank[xr] < rank[yr]:
    par[xr] = yr
  else:
    par[yr] = xr
    if rank[xr] == rank[yr]:
      rank[xr] += 1

for _ in range(K):
  x, y = map(int, input().split())
  unite(x, y)
par_r = par[:]
par = list(range(N+1))
for _ in range(L):
  x, y = map(int, input().split())
  unite(x, y)
ans = [1] * (N)
r_dict = {}

for i in range(1, N+1):
  if (par_r[i], par[i]) in r_dict:
    r_dict[(par_r[i], par[i])] += 1
  else:
    r_dict[(par_r[i], par[i])] = 1
ans = []
for i in range(1, N+1):
  ans.append(r_dict[(par_r[i], par[i])])
print(' '.join(map(str, ans)))
Problem p03943 (python)

Fixed submission:
a, b, c = map(int, input().split())
if a+b == c or c+a == b or b+c == a:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N, T = map(int, input().split())
nums = list(map(int, input().split()))
INF = 10**10
min_num = INF
max_diff = 0
cnt = 0
for num in nums:
  if num-min_num > max_diff:
    cnt = 1
    max_diff = num-min_num
  elif num-min_num == max_diff:
    cnt += 1
  if num < min_num:
    min_num = num
print(min(cnt, T//2))
Problem p03964 (python)

Fixed submission:
import math

N = int(input())
x, y = map(int, input().split())
for _ in range(N-1):
  a, b = map(int, input().split())
  # n = max(math.ceil(x/a), math.ceil(y/b))
  na = nb = 0
  if x%a == 0:
    na = x//a
  else:
    na = x//a+1
  if y%b == 0:
    nb = y//b
  else:
    nb = y//b+1
  n = max(na, nb)
  x, y = n*a, n*b
print(x+y)

Buggy submission (verdict: Runtime Error):
N = int(input())
T, A = map(int, input().split())
num = T + A
for _ in range(N-1):
  t, a = map(int, input().split())
  while True:
    if num%(t+a) == 0 and (num*t)//(t+a) >= T and (num*a)//(t+a) >= A:
      T = (num*t)//(t+a)
      A = (num*a)//(t+a)
      break
    if num%(t+a) == 0
      num += num
    else:
      num += num%(t+a)
print(num)

Buggy submission (verdict: Runtime Error):
N = int(input())
num = 1
for _ in range(N):
  x, y = map(int, input().split())
  sum_xy = sum(x, y)
  while True:
    if num%sum_xy == 0:
      break
    else:
      num += num%sum_xy
print(num)
Problem p03993 (python)

Fixed submission:
N = int(input())
nums = list(map(int, input().split()))
answer = 0
for i, num in enumerate(nums, start=1):
  if i == nums[num-1] and i < num:
    answer += 1
print(answer)

Buggy submission (verdict: Runtime Error):
N = int(input())
nums = list(map(int, input().split()))
answer = 0
for i, num in enumerate(nums, start=1):
  if i == nums[num] and i < num:
    answer += 1
print(answer)
Problem p03998 (python)

Fixed submission:
sa = input()
sb = input()
sc = input()
next = sa[0]
while True:
  if next == 'a':
    if len(sa) == 0:
      print('A')
      break
    else:
      next = sa[0]
      sa = sa[1:]
  elif next == 'b':
    if len(sb) == 0:
      print('B')
      break
    else:
      next = sb[0]
      sb = sb[1:]
  else:
    if len(sc) == 0:
      print('C')
      break
    else:
      next = sc[0]
      sc = sc[1:]

Buggy submission (verdict: Runtime Error):
sa = input()
sb = input()
sc = input()
ia = 0
ib = 0
ic = 0
next = 'a'
while True:
  if ia == len(sa)-1:
    print('A')
    break
  if ib == len(sb)-1:
    print('B')
    break
  if ic == len(sc)-1:
    print('C')
    break
  if next == 'a':
    next = S[ia]
    ia += 1
  if next == 'b':
    next = S[ib]
    ib += 1
  if next == 'c':
    next = S[ic]
    ic += 1
Problem p03999 (python)

Fixed submission:
S = input()
ans = 0
for num in range(2**((len(S)-1))):
  before = 0
  nums = []
  for i in range(len(S)-1):
    if num>>i&1:
      nums.append(int(S[before:i+1]))
      before = i+1
  nums.append(int(S[before:]))
  ans += sum(nums)
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
stack = [S]
ans = int(S)
checked = []
while True:
  str_num = stack.pop()
  if len(str_num) <= 1:
    continue
  for i in range(len(str_num)):
    str1 = str_num[:i]
    str2 = str_num[i:]
    if not str1 in checked:
      checked.append(str1)
      ans += int(str1)
      stack.append(str1)
    if not str2 in checked:
      checked.append(str2)
      ans += int(str2)
      stack.append(str2)
print(ans)
Problem p04044 (python)

Fixed submission:
N, L = map(int, input().split())
strings = [input() for _ in range(N)]
strings.sort()
print(''.join(strings))

Buggy submission (verdict: Runtime Error):
N, L = map(int, input())
strings = [input() for _ in range(N)]
strings.sort()
print(''.join(strings))
Problem p02534 (python)

Fixed submission:
N = int(input())
C = 'ACL'
print(C*N)

Buggy submission (verdict: Runtime Error):
N = int(input())
C = 'ACL'
print(ACL*N)
Problem p02583 (python)

Fixed submission:
N = int(input())
 
L = list(map(int, input().split()))
L.sort()
ret = 0
if N >= 3:
  for i in range(N - 2):
    for j in range(i + 1, N - 1):
      if L[i] != L[j]:
        for k in range(j + 1, N):
          if L[i] != L[k] and L[j] != L[k] and L[i] + L[j] > L[k]:
            ret += 1
print(ret)

Buggy submission (verdict: Runtime Error):
N = int(input())
 
L = map(int, input().split())
L.sort()
ret = 0
if N >= 3:
  for i in range(N - 2):
    for j in range(i + 1, N - 1):
      if L[i] != L[j]:
        for k in range(j + 1, N):
          if L[i] != L[k] and L[j] != L[k] and L[i] + L[j] > L[k]:
            ret += 1
print(ret)
Problem p02658 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
MAX = 10**18
ret = 1
flag = True
if 0 in A:
    print(0)
else:
    for a in A:
        ret *= a
        if ret > MAX:
            print(-1)
            flag = False
            break
    if flag and ret <= MAX:
        print(ret)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
MAX = 10**18
ret = 1
if 0 in A:
    print(0)
else:
    for a in A:
    ret *= a
    if ret > MAX:
        print(-1)
        break
    if ret < MAX:
    print(ret)
Problem p02675 (python)

Fixed submission:
N = int(input())
m = N % 10
if m == 2 or m == 4 or m == 5 or m == 7 or m == 9:
  ret = 'hon'
elif m == 0 or m == 1 or m == 6 or m == 8:
  ret = 'pon'
else:
  ret = 'bon'
  
print(ret)

Buggy submission (verdict: Runtime Error):
N = int(input())
m = N % 10
if m == 2 or m == 4 or m == 5 or m == 7 or　m == 9:
  ret = 'hon'
elif m == 0 or m == 1 or m == 6 or m == 8:
  ret = 'pon'
else:
  ret = 'bon'
  
print(ret)
Problem p02691 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
L1 = list()
D2 = dict()
ret = 0
for i in range(len(A)):
    num1 = i + 1 - A[i]
    num2 = i + 1 + A[i]
    L1.append(num1)
    if num2 not in D2:
        D2[num2] = 1
    else:
        D2[num2] += 1
ret = 0
retlist = dict()
for l in L1:
    if l in D2.keys():
        ret += D2[l]
print(ret)

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

max1 = max(A)
A_ = A.copy()
A_.remove(max1)
max2 = max(A_)
ln = max1 + max2
ret = 0
for i in range(len(A)-1):
    for j in range(i+1, i+ln + 1):
        if A[j] + A[i] == j - i:
            ret += 1
print(ret)

Buggy submission (verdict: Runtime Error):
N = int(input())
A_ = list(map(int, input().split()))
A = list()
for i in range(len(A_)):
    if A_[i] < N - 1:
        A.append([i + 1, A_[i]])
ret = 0
for i in range(len(A)-1, -1, -1):
    ind, val = A[i][0], A[i][1]
    B = [a for a in A if a[1] < N - 1 - val]
    for b in B:
        if abs(b[0] - ind) == val + b[1]:
            ret += 1
return ret
Problem p02713 (python)

Fixed submission:
class GCD:
    def __init__(self):
        self.numlist = dict()
    def culc(self, K):
        ret = 0
        
        for i in range(1,K):
            for j in range(i + 1,K+1):
                ret += self.gcd_(i,j) * 6

        for i in range(1,K-1):
            for j in range(i+1, K):
                for k in range(j+1,K+1):
                    ret += self.gcd(i,j,k)*6

        for i in range(1, K+1):
            ret += i

        return ret

    def gcd(self, a,b,c):
        #l = (a,b,c)
        #if l in self.numlist:
        #    return self.numlist[l]
        #else:
        temp_ = self.gcd_(a,b)
        temp_ = self.gcd_(temp_, c)
        
        return temp_

    def gcd_(self,a,b):
        l = (min(a,b), max(a,b))
        if l in self.numlist:
            return self.numlist[l]
        else:
            mod = max(a,b) % min(a,b)
            if mod == 0:
                ret = min(a,b)
                self.numlist[l] = ret
                return ret
            else:
                ret = self.gcd_(min(a,b), mod)
                self.numlist[l] = ret
                return ret

K = int(input())
gcd = GCD()
ret = gcd.culc(K)
print(ret)

Buggy submission (verdict: Runtime Error):
class GCD:

    def culc(self, K):
        ret = 0
        self.numlist = dict()
        for i in range(1,K+1):
            for j in range(1, K+1):
                for k in range(1,K+1):
                    ret += self.gcd(i,j,k)
        return ret

    def gcd(self, a,b,c):
        l = [a,b,c]
        l.sort()
        l = tuple(l)
        if l in self.numlist:
            return self.numlist[l]
        else:
            temp_ = self.gcd_(l[0],l[1])
            temp_ = self.gcd_(temp_, l[2])
            self.numlist[l] = temp_
            return temp_

    def gcd_(self,a,b):
        mod = max(a,b) % min(a,b)
        if mod == 0:
            ret = min(a,b)
            return ret
        else:
            self.gcd_(min(a,b), mod)

K = int(input())
gcd = GCD()
ret = gcd.culc(K)
print(ret)
Problem p02727 (python)

Fixed submission:
X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
p = p[:X]
q = q[:Y]
sumlist = list()
sumlist.extend(p)
sumlist.extend(q)
sumlist.extend(r)
sumlist.sort(reverse=True)
print(sum(sumlist[:X+Y]))

Buggy submission (verdict: Runtime Error):
X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p = p.sort(reverse=True)
q = q.sort(reverse=True)
r = r.sort(reverse=True)
p = p[:X]
q = q[:Y]
sumlist = list()
sumlist.extend(p)
sumlist.extend(q)
sumlist.extend(r)
sumlist = sumlist.sort(reverse=True)
print(sum(sumlist[:X+Y]))
Problem p02755 (python)

Fixed submission:
A, B = map(int, input().split())
ret = -1

for i in range(1,1010):
  if int(i * 0.08) == A and int(i * 0.1) == B:
    ret = i
    break
print(ret)

Buggy submission (verdict: Runtime Error):
ret = -1

for i in range(1,1010):
  if int(i * 0.08) == A and int(i * 0.1) == B:
    ret = i
    break
print(ret)
Problem p02760 (python)

Fixed submission:
def checkbingo(map_):
  for i in range(3):
    if map_[i][0] * map_[i][1] * map_[i][2] == 1:
      return True
    if map_[0][i] * map_[1][i] * map_[2][i] == 1:
      return True
  if map_[0][0] * map_[1][1] * map_[2][2] == 1:
    return True
  if map_[0][2] * map_[1][1] * map_[2][0] == 1:
    return True
  return False 

A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
A3 = list(map(int, input().split()))
A = [A1,A2,A3]
bingomap = [[0,0,0],[0,0,0],[0,0,0]]
N = int(input())
b = list()
ret = 'No'
for i in range(N):
  b.append(int(input()))
for i in range(N):
  for j in range(3):
    if b[i] in A[j]:
      bingomap[j][A[j].index(b[i])] = 1
      break
  if i >= 2 :
    if checkbingo(bingomap) == True:
      ret = 'Yes'
      break
print(ret)

Buggy submission (verdict: Runtime Error):
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
A3 = list(map(int, input().split()))
A = [A1,A2,A3]
bingomap = [[0,0,0],[0,0,0],[0,0,0]]
print(A)
N = int(input())
b = list()
ret = 'No'
for i in range(N):
  b.append(int(input()))
  print(b)
  for i in range(N):
    for j in range(3):
      if b[i] in A[j]:
        bingomap[j][A[j].index(b[i])] = 1
        break
    if i >= 2 :
      if checkbingo(bingomap) == True:
        ret = 'Yes'
        break
print(ret)

def checkbingo(map_):
  for i in range(3):
    if map_[i][0] * map_[i][1] * map_[i][2] == 1:
      return True
    if map_[0][i] * map_[0][i] * map_[0][i] == 1:
      return True
  if map_[0][0] * map_[1][1] * map_[2][2] == 1:
    return True
  if map_[0][2] * map_[1][1] * map_[2][0] == 1:
    return True
  return False
Problem p02786 (python)

Fixed submission:
H = int(input())
if H == 1:
  ret = 1
else:
  count = 0
  while True:
    H = H // 2
    count += 1
    if H == 0:
      break
  ret = 2 **( count ) - 1
print(ret)

Buggy submission (verdict: Runtime Error):
H = int(input())
if H == 1:
  ret = 1
else:
  count = 0
  while True:
	H = H // 2
    count += 1
    if H == 0:
      break
  ret = 2 **( count + 1) - 1
Problem p02791 (python)

Fixed submission:
N = int(input())
P = list(map(int, input().split()))
ret = 0
minval = 0
for i in range(len(P)):
  if i == 0:
    minval = P[i]
  if minval >= P[i]:
    ret += 1
    minval = P[i]
print(ret)

Buggy submission (verdict: Runtime Error):
N = int(input())
P = list(map(int, input().split()))
ret = N
for i in range(len(P)):
  if min(P[:i+1]) != P[i]:
    ret = i + 1
  	break
print(ret)

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

for i in range(len(P)):
  if min(P[:i+1]) != P[i]:
    return i
  return len(P)
Problem p02683 (python)

Fixed submission:
n,m,x=[int(i) for i in input().split()]
c=[]
arr=[[] for i in range(n)]
for i in range(n):
    l=[int(i) for i in input().split()]
    c.append(l[0])
    arr[i]=l[1:]

inf=10**18
ans=inf

limit=2**n
for bit in range(1,limit):
    sum=[0 for i in range(m)]
    cost=0
    for i in range(n):
        if (1<<i & bit):
            cost+=c[i]
            for j in range(m):
                sum[j]+=arr[i][j]
    flag=1
    for i in range(m):
        if sum[i]<x:
            flag=0
            break
    if flag==0:
        continue
    ans=min(ans,cost)
if ans!=inf:
    print(ans)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
n,m,x=[int(i) for i in input().split()]
c=[]
arr=[[] for i in range(n)]
for i in range(n):
    l=[int(i) for i in input().split()]
    c.append(l[0])
    arr[i]=l[1:]

inf=10**18
ans=inf

limit=2**n
for bit in range(1,limit):
    sum=[0 for i in range(n)]
    cost=0
    for i in range(n):
        if (1<<i & bit):
            cost+=c[i]
            for j in range(m):
                sum[j]+=arr[i][j]
    flag=1
    for i in range(m):
        if sum[i]<x:
            flag=0
            break
    if flag==0:
        continue
    ans=min(ans,cost)
if ans!=inf:
    print(ans)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
n,m,x=[int(i) for i in input().split()]
c=[]
arr=[[] for i in range(n)]
for i in range(n):
    l=[int(i) for i in input().split()]
    c.append(l[0])
    arr[i]=l[1:]

inf=10**18
ans=inf

limit=2**n
for bit in range(1,limit):
    sum=[0]*n
    cost=0
    for i in range(n):
        if (1<<i & bit):
            cost+=c[i]
            for j in range(m):
                sum[j]+=arr[i][j]
    flag=1
    for i in range(m):
        if sum[i]<x:
            flag=0
            break
    if flag==0:
        continue
    ans=min(ans,cost)
if ans!=inf:
    print(ans)
else:
    print(-1)
Problem p02684 (python)

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
alr = [0 for i in range(n)]
now = 1
path = [now]

for i in range(k):
    now = a[now-1]
    # if now in path:
    #     now = path[path.index(now) + (k-i-1)%(len(path) - path.index(now))]
    #     break
    if alr[now-1] != 0:
        now = path[path.index(now) + (k-i-1)%(len(path) - path.index(now))]
        break
    path.append(now)
    alr[now-1] += 1

print(now)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(map(int, input().split()))
path = []

now = a[0]
path.append(now)

for i in range(1, k+1):
    now = a[now-1]
    if now in path:
        now = a[a.index(now) + (k-i)%(len(path) - a.index(now) - 1)]
        break
    path.append(now)

print(now)
Problem p03407 (python)

Fixed submission:
a,b,c=map(int,input().split())
print("Yes" if a>=c or b>=c or a+b>=c else "No")

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reprl(i, n) for(ll i = n; i >= 0; i--)
#define fori(i, m, n) for(int i = m; i < (int)n; i++)
#define forl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define all(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
const string bans(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  int a,b,c;cin>>a>>b>>c;
  int ans=(a>=c||b>=c||a+b>=c);
  cout << bans(ans) << endl;
  return 0;
}

Buggy submission (verdict: Runtime Error):
a,b,c=[map(int,input().split())]
print("Yes" if a>=c or b>=c or a+b>=c else "No")
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
a, t = map(int, input().split())
print(a * t)
a, t = map(int, input().split())
print(a * t)
Problem p02747 (python)

Fixed submission:
s = input()
if s == "hi" * (len(s) // 2):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s = input()
if s == "hi" * len(s) // 2:
  print("Yes")
else:
  print("No")
Problem p03061 (python)

Fixed submission:
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a


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

l = [0]*(n+2) # l(i) = A1, A2, ..., A(i-1)のgcd
r = [0]*(n+2) # r(i) = Ai, A(i+1), ..., A(n)のgcd

for i in range(n):
	l[i+1] = gcd(l[i],a[i])
for i in reversed(range(n)):
	r[i] = gcd(r[i+1],a[i])

ext = [0] * n
for i in range(n):
	ext[i] = gcd(l[i],r[i+1])

print (max(ext))

Buggy submission (verdict: Runtime Error):
import math

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

l = [0]*(n+2) # l(i) = A1, A2, ..., A(i-1)のgcd
r = [0]*(n+2) # r(i) = Ai, A(i+1), ..., A(n)のgcd

for i in range(n):
	l[i+1] = math.gcd(l[i],a[i])
for i in reversed(range(n)):
	r[i] = math.gcd(r[i+1],a[i])

ext = [0] * n
for i in range(n):
	ext[i] = math.gcd(l[i],r[i+1])

print (max(ext))

Buggy submission (verdict: Runtime Error):
import math
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(map(int,input().split()))
gcds = []

maxt = 0
for i in range(n):
	b = a[0:i]
	b += (a[i+1:n])
	tmp = b[0]

	for bi in b[1::]:
		tmp = math.gcd(tmp,bi)
		
	if maxt < tmp:
		maxt = tmp
 
print (maxt)

Buggy submission (verdict: Runtime Error):
import math
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(map(int,input().split()))
gcds = []

maxt = 0
for i in range(n):
	b = []
	for k in range(n):
		if (i != k):
			b.append(a[k])
	tmp = b[0]

	for bi in b[1::]:
		tmp = math.gcd(tmp,bi)
		
	if maxt < tmp:
		maxt = tmp
 
print (maxt)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
 
 
def gcd_list(numbers):
	return reduce(math.gcd, numbers)
 
 
n = int(input())
a = list(map(int,input().split()))
gcds = []
for i in range(n):
	b = []
	for k in range(n):
		if (i != k):
			b.append(a[k])
	gcds.append(gcd_list(b))
 
print (max(gcds))

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

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

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


n = int(input())
a = list(map(int,input().split()))
gcds = []
for i in range(n):
	b = []
	for k in range(n):
		if (i != k):
			b.append(a[k])
	gcds.append(gcd_list(b))

print (max(gcds))