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

Fixed submission:
import itertools
L, R = map(int, input().split())

if R - L + 1 > 2019:
    remainder_list = [N%2019 for N in range(L, L+2019)]
else:
    remainder_list = [N%2019 for N in range(L, R+1)]  
remainder_list = list(set(remainder_list))
all_list = [(i*j)%2019 for i, j in list(itertools.combinations(remainder_list, 2))]
print(min(all_list))

Buggy submission (verdict: Runtime Error):
import itertools
L, R = map(int, input().split())
 
remainder_list = []
for N in range(L, R+1):
  remainder_list.append(N%2019)

for i, j in list(itertools.combinations(remainder_list, 2)):
  all_list.append((i*j)%2019)
  
print(min(all_list))
Problem p03030 (python)

Fixed submission:
N = int(input())
all_point_list = [input().split() for _ in range(N)]
for each_list in all_point_list:
    each_list[1] = int(each_list[1])
sorted_all_list = sorted(all_point_list, key=lambda x:(x[0], -x[1]))
for sorted_point in sorted_all_list:
    print(all_point_list.index(sorted_point) + 1)

Buggy submission (verdict: Runtime Error):
N = int(input())
all_point_list = [input().split() for _ in range(N)]
for each_list in all_point_list:
    each_list[1] = int(each_list[1])
sorted_all_list = sorted(all_point_list)
for sorted_point in sorted_all_list:
    print(all_point_list.index(sorted_point+1))
Problem p03565 (python)

Fixed submission:
from copy import deepcopy


def calc_key_str(aps_S, T):
    S = deepcopy(aps_S)

    for i in range(len(aps_S) - len(T) + 1):
        matched_flag = True
        for j in range(len(T)):
            if aps_S[-i-j-1] != T[-j-1] and aps_S[-i-j-1] != '?':
                matched_flag = False
                continue

        if matched_flag:
            S_list = list(S)
            S_list[-i-len(T):len(S)-i] = T
            S = "".join(S_list)
            S = S.replace('?', 'a')
            print(S)
            break

    if not matched_flag:
        print('UNRESTORABLE')


def main():
    aps_S = input()
    T = input()

    if len(aps_S) < len(T):
        print('UNRESTORABLE')
    else:
        calc_key_str(aps_S, T)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from copy import deepcopy


aps_S = input()
T = input()

S = deepcopy(aps_S)

for i in range(len(aps_S) - len(T) + 1):
    matched_flag = True
    for j in range(len(T)):
        if aps_S[-i-j-1] != T[-j-1] and aps_S[i-j] != '?':
            matched_flag = False
            continue

    if matched_flag:
        S[-i-len(T)-1:-i-1] = T
        S = S.replace('?', 'a')
        print(S)
        break

if not matched_flag:
    print('UNRESTORABLE')
Problem p02714 (python)

Fixed submission:

#S = "RBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB"# * 1000
#N = len(S)

N=int(input())
S=input()
r = len(S.replace("G", "").replace("B", ""))
g = len(S.replace("R", "").replace("B", ""))
b = N - r - g
 
ans = r * g * b
 
is_break = False
for i in range(N):
    for j in range(i, int((N+i)/2 + 1)):
        k = 2 * j - i
        if k < N:
            s = S[i] + S[j] + S[k]
            if ("R" in s) & ("G" in s) & ("B" in s):
                    ans -= 1

print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np

#N = 39
#S = "RBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB"
N=int(input())
S=input()
r = len(S.replace("G", "").replace("B", ""))
g = len(S.replace("R", "").replace("B", ""))
#b = len(S.replace("R", "").replace("G", ""))
b = N - r - g
 
ans = r * g * b
 
for i in range(N):
    for k in [N - k_ - 1 for k_ in range(N)]:
        tar_j = i + k
        if (tar_j > 2 * i) & (tar_j < 2 * k):
            if np.mod(tar_j, 2) == 0:
                j = int(tar_j / 2)
                s = S[i] + S[j] + S[k]
                if ("R" in s) & ("G" in s) & ("B" in s):
                    ans -= 1
        else:
            break
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
import pandas as pd
N=int(input())
S=input()

S_list = pd.Series([x for x in S])
r = sum(S_list == "R")
g = sum(S_list == "G")
b = sum(S_list == "B")
 
ans = r * g * b
 
for i in range(N):
  for k in [N - k_ - 1 for k_ in range(N)]:
    tar_j = i + k
    if (tar_j > 2 * i) & (tar_j < 2 * k):
      if np.mod(tar_j, 2) == 0:
        j = int(tar_j / 2)
        s = S[i] + S[j] + S[k]
        if ("R" in s) & ("G" in s) & ("B" in s):
          ans -= 1
    else:
      break
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
import pandas as pd

#N=int(input())
#S=input()
S_list = pd.Series([x for x in S])
r = sum(S_list == "R")
g = sum(S_list == "G")
b = sum(S_list == "B")
 
ans = r * g * b
 
for i in range(N):
  for k in [N - k_ - 1 for k_ in range(N)]:
    tar_j = i + k
    if (tar_j > 2 * i) & (tar_j < 2 * k):
      if np.mod(tar_j, 2) == 0:
        j = int(tar_j / 2)
        s = S[i] + S[j] + S[k]
        if ("R" in s) & ("G" in s) & ("B" in s):
          ans -= 1
    else:
      break
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
N=int(input())
S=input()
r = sum(S == "R")
g = sum(S == "G")
b = sum(S == "B")

ans = r * g * b

for i in range(N):
  for k in [N - k_ - 1 for k_ in range(N)]:
    tar_j = i + k
    if (tar_j > 2 * i) & (tar_j < 2 * k):
      if np.mod(tar_j, 2) == 0:
        j = tar_j / 2
        s = S[i] + S[j] + S[k]
        if ("R" in s) & ("G" in s) & ("B" in s):
          ans -= 1
    else:
      break
print(ans)
Problem p02756 (python)

Fixed submission:
from collections import deque


reverse = False

string = deque(input().rstrip())
operate_times = int(input().rstrip())

for i in range(operate_times):
    row = input().rstrip()
    if row[0]=='1':
        if reverse:
            reverse = False
        else:
            reverse = True
    
    if row[0]=='2':
        row = row.split()
        head_or_tail = int(row[1])
        add_string = row[2]

        if reverse:
            if head_or_tail==1:
                string.append(add_string)
            else:
                string.appendleft(add_string)
        
        else:
            if head_or_tail==2:
                string.append(add_string)
            else:
                string.appendleft(add_string)


answer_string = ''
if reverse:
    for _ in range(len(string)):
        right = string.pop()
        answer_string+=right
    print(answer_string)
else:
    print(''.join(string))

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


reverse = False

string = deque(input().rstrip())
operate_times = int(input().rstrip())

for i in range(operate_times):
    row = input().rstrip()
    if row[0]=='1':
        if reverse==True:
            reverse = False
        else:
            reverse = True
    
    if row[0]=='2':
        row = row.split()
        head_or_tail = row[1]
        add_string = row[2]

        if reverse==True:
            if head_or_tail==1:
                string.append(add_string)
            else:
                string.appendleft(add_string)
        
        else:
            if head_or_tail==2:
                string.append(add_string)
            else:
                string.appendleft(add_string)


if reverse==True:
    string = string[::-1]

print(''.join(string))
Problem p02780 (python)

Fixed submission:
dice_num, use_num = [int(n) for n in input().rstrip().split()]

points = [int(n) for n in input().rstrip().split()]

sum = sum(points[:use_num])
max_sum = sum
    
for i in range(dice_num-use_num):
    next = sum + points[i+use_num] - points[i]
    max_sum = max(next,max_sum)
    sum = next
    
max_sum_expectation = (use_num + max_sum)/2

print(max_sum_expectation)

Buggy submission (verdict: Runtime Error):
points = [int(n) for n in input().rstrip().split()]

sum = sum(points[:use_num])
max_sum = sum
    
for i in range(dice_num-use_num):
    next = sum + points[i+use_num] - points[i]
    max_sum = max(next,max_sum)
    sum = next
    
max_sum_expectation = (use_num + max_sum)/2

print(max_sum_expectation)
Problem p04014 (python)

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

def f(b,n):
	if b < 2:
		return 0
	if n < b:
		return n
	else:
		return f(b,n//b)+n%b

ans=-1
if s==n:
	ans=n+1
else:
	for _b in range(2,int(n**0.5)+1):
		if f(_b,n)==s:
			ans=_b
			break
	if ans==-1:
		for _p in range(int(n**0.5),0,-1):
			_b = (n-s)//_p+1
			if f(_b,n)==s:
				ans=_b
				break
print(ans)

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

def f(b,n):
	if n < b:
		return n
	else:
		return f(b,n//b)+n%b

ans=-1
if s>n:
  pass
elif s==n:
	ans=n+1
else:
	for _b in range(2,int(n**0.5)+1):
		if f(_b,n)==s:
			ans=_b
			break
	if ans==-1:
		for _p in range(1,int(n**0.5)+1):
			_b = (n-s)//_p+1
			if f(_b,n)==s:
				ans=_b
				break
print(ans)
Problem p02719 (python)

Fixed submission:
import numpy

n, m = input().split()
n = numpy.int64(n)
m = numpy.int64(m)
n = n % m
print(min(n, m-n))

Buggy submission (verdict: Runtime Error):
from ctypes import c_longlong as ll

n = ll(input(""))
m = ll(input(""))
n= n % m
print(min(n, m-n))
Problem p02742 (python)

Fixed submission:
H, W = map(int, input().split())

if H==1 or W==1:
  print(1)
elif H%2 == 1 and W%2 == 1:
  print((H*W)//2+1)
  
else:
  print((H*W)//2)

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split)
S=H*W
if S%2 ==1:
  print(H*W//2+1)
  
else:
  print(H*W/2)
Problem p02767 (python)

Fixed submission:
import numpy as np
 
N = input()
X = list(map(int, input().split()))
ans=9999999
for P in range(0, 101):
  sum = np.sum(list(map(lambda x: (x-P)**2, X)))
  ans = min(ans, sum)
    
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
 
N = input()
X = list(map(int, input()))
ans=0
for P in range(max(X)):
  sum = np.sum(list(map(lambda x: (x-P)**2, X)))
    
  if sum >= ans:
    ans = sum
    
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
 
N = input()
X = list(map(int, input()))
ans=0
for P in range(max(X)):
  sum = np.sum(map(lambda x: (x-P)**2, X))
    
  if sum >= ans:
    ans = sum
    
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np

N = input()
X = list(map(int, input()))
ans=0
for P in range(max(X)):
  sum = np.sum(map(lambda:x (x-P)**2, X))
    
  if sum >= ans:
    ans = sum
    
print(ans)

Buggy submission (verdict: Runtime Error):
def sqerr(x, t):
  return (x - t)**2

N = input()
X = list(map(int, input()))
ans=0
for P in range(1, N+1):
  sum = 0
  for x in X:
    sum += (x-P)**2
    
  if sum > ans:
    ans = sum
    
print(ans)
Problem p02842 (python)

Fixed submission:
import math

N = int(input())
ans = -1
for i in range(N+1):
	if math.floor(i*1.08) == N:
		ans = i
if ans == -1:
	print(':(')
else:
	print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
 
ans = -1
for i in range(N):
	if math.floor(float(i)*1.08) == N:
    	ans = i
      
if ans == -1:
  print(':(')
  
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
 
ans = -1
for i in range(N):
	if math.floor(i*1.08) == N:
    	ans = i
      
if ans == -1:
  print(':(')
  
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
 
ans = -1
for i in range(N):
	if round(i*1.08) == N:
    	ans = i
      
if ans == -1:
	print(':(')
  
else:
	print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
 
ans = -1
for i in range(N):
	if round(i*1.08) == N:
    	ans = i
      
if ans == -1:
  print(':(')
  
else:
  print(ans)

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

ans = -1
for i in range(N)
	if round(i*1.08) == N:
    	ans = i
      
if ans == -1:
  print(':(')
  
else:
  print(ans)
Problem p02921 (python)

Fixed submission:
S = input()
T = input()

count = 0
for s,t in zip(S,T):
  if s == t:
    count+=1
    
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))
 
ans = 0
m=0
for i in range(N-1):
  count.append(0)
  if H[i] > H[i+1]:
    m+=1
    ans = max(ans, m)
    
  else:
    m=0
    
S = str(count).split('0')
L = map(len, S)
print(max(L))

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))
 
count = []
for i in range(N-1):
  count.append(0)
  if H[i] > H[i+1]:
    count[i] = 1
    
S = str(count).split('0')
L = map(len, S)
print(max(L))

Buggy submission (verdict: Runtime Error):
N = int(input())
H = map(int, input().split())
 
count = [0]*len(H)
for i in range(len(H)-1):
  if H[i] >= H[i+1]:
    count[i] = 1
    
S = str(count).split('0')
L = map(len, S)
print(max(L))
Problem p02922 (python)

Fixed submission:
# coding: utf-8

A,B = map(int, input().split())
for i in range(20):
  if (A-1)*i+1 >= B:
    print(i)
    break

Buggy submission (verdict: Runtime Error):
# coding: utf-8
A, B = map(int, input().split())
B = B-A
for i in range(20):
	if B<=0:
    	print(i+1)
    	break()
    B=B-A+1

Buggy submission (verdict: Runtime Error):
A, B = map(int, input())

B = B-A
for i in range(20):
	if B<=0:
    	print(i+1)
    	break()
    B=B-A+1
Problem p02923 (python)

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

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

count = []
for i in range(len(H)-1):
  count.append(0)
  if H[i] > H[i+1]:
    count[i] = 1
    
S = str(count).split('0')
L = map(len, S)
print(max(L))
Problem p03086 (python)

Fixed submission:
import re
S = input()
string = re.findall(r'([ACGT]+)', S)

if len(string) != 0:
  lenst = [len(x) for x in string]
  print(max(lenst))
  
else:
  print(0)

Buggy submission (verdict: Runtime Error):
import re
S = input()
string = re.findall(r'([ACGT]+)', S)

lenst = [len(x) for x in string]
print(max(lenst))
Problem p02760 (python)

Fixed submission:
A11, A12, A13 = input().split(' ')
A21, A22, A23 = input().split(' ')
A31, A32, A33 = input().split(' ')
A11 = int(A11)
A12 = int(A12)
A13 = int(A13)
A21 = int(A21)
A22 = int(A22)
A23 = int(A23)
A31 = int(A31)
A32 = int(A32)
A33 = int(A33)
N = int(input())
b = []
for i in range(N):
  bi = int(input())
  b.append(bi)
if A11 in b and A12 in b and A13 in b:
  print('Yes')
elif A21 in b and A22 in b and A23 in b:
  print('Yes')
elif A31 in b and A32 in b and A33 in b:
  print('Yes')
elif A11 in b and A21 in b and A31 in b:
  print('Yes')
elif A12 in b and A22 in b and A32 in b:
  print('Yes')
elif A13 in b and A23 in b and A33 in b:
  print('Yes')
elif A11 in b and A22 in b and A33 in b:
  print('Yes')
elif A13 in b and A22 in b  and A31 in b:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
A11, A12, A13 = input().split(' ')
A21, A22, A23 = input().split(' ')
A31, A32, A33 = input().split(' ')
A11 = int(A11)
A12 = int(A12)
A13 = int(A13)
A21 = int(A21)
A22 = int(A22)
A23 = int(A23)
A31 = int(A31)
A32 = int(A32)
A33 = int(A33)
N = int(input())
b = []
for i in range(N):
  bi = int(input())
  b.append(bi)
if A11 in b and A12 in b and A13 in b:
  print('Yes')
elif A21 in b and A22 in b and A23 in b:
  print('Yes')
elif A31 in b and A32 in b and A33 in b:
  print('Yes')
elif A11 in b and A21 in b and A31 in b:
  print('Yes')
elif A12 in band A22 in b and A32 in b:
  print('Yes')
elif A13 in b and A23 in b and A33 in b:
  print('Yes')
elif A11 in b and A22 in b and A33 in b:
  print('Yes')
elif A13 in b and A22 in b  and A31 in b:
  print('Yes')
else:
  print('No')
Problem p02922 (python)

Fixed submission:
A, B = input().split(' ')
A = int(A)
B = int(B)
if B == 1:
  print(0)
else:
  print(-(-(B-1) // (A-1)))

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = -(-B // A)
print(C)
Problem p03086 (python)

Fixed submission:
S = input()
counts = []
count = 0
for i in range(len(S)):
  if S[i] == 'A' or S[i] == 'G' or S[i] == 'C' or S[i] == 'T':
    count += 1
  else:
    counts.append(count)
    count = 0
counts.append(count)
if len(S) ==1:
  print(counts[0])
else:
  print(max(counts))

Buggy submission (verdict: Runtime Error):
S = input()
counts = []
count = 0
for i in range(len(S)):
  if S[i] == 'A' or S[i] == 'G' or S[i] == 'C' or S[i] == 'T':
    count += 1
  else:
    counts.append(count)
    count = 0
print(max(counts))
Problem p03853 (python)

Fixed submission:
H, W = input().split(' ')
H = int(H)
W = int(W)
for i in range(H):
  a = input()
  print(a)
  print(a)

Buggy submission (verdict: Runtime Error):
H, W = input().split(' ')
H = int(H)
W = int(W)
for i in range(W):
  a = input()
  print(a)
  print(a)
Problem p02818 (python)

Fixed submission:
a,b,c = map(int, input().split())
 
print(max(0,a-c),max(0, b - max(0,c-a)))

Buggy submission (verdict: Runtime Error):
a,b,c = map(int, input().split())
 
for i in range(c):
  if(a == 0):
  	b -= 1
    if(b == 0):
      break
  elif(a > 0):
    a -= 1
print(str(a),str(b))

Buggy submission (verdict: Runtime Error):
a,b,c = int(input().split())
 
for i in range(c):
  if(a == 0 and b > 0):
  	b -= 1
  elif(a > 0):
    a -= 1
print(str(a),str(b))

Buggy submission (verdict: Runtime Error):
a,b,c = int(input().split())
 
for i in range(c):
  if(a == 0):
  	b -= 1
  elif(a > 0):
    a -= 1
print(str(a),str(b))

Buggy submission (verdict: Runtime Error):
a,b,c = int(input().split())

for i in range(c):
  if(a == 0):
  	c -=1
  elif(a > 0):
    a -= 1
print(str(a),str(b))
Problem p02946 (python)

Fixed submission:
K,X = map(int, input().split())
 
for i in range(X-K+1,X+K):
	print(i,end = " ")

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

for i in range(X-K+1,X+K):
	print(i,end = " ")
Problem p03101 (python)

Fixed submission:
H,W = map(int,input().split())
h,w = map(int,input().split())
print(H*W-h*W-w*H+w*h)

Buggy submission (verdict: Runtime Error):
H,W = map(int, input().split())
h.w = map(int, input().split())
print(H*W -h*W-w*H+h*w)
Problem p03415 (python)

Fixed submission:
a = []
for i in range(3):
  a.append(input())
print(a[0][0]+a[1][1]+a[2][2])

Buggy submission (verdict: Runtime Error):
a = []
for i in range(3):
  a[i] = input()
print(a[0][0]+a[1][1]+a[2][2])

Buggy submission (verdict: Runtime Error):
a = []
for i in range(3):
  a[i] = input().split()
print(a[0][0]+a[1][1]+a[2][2])
Problem p03796 (python)

Fixed submission:
import math

N = int(input())
print(math.factorial(N) % (10**9+7))

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
print(factorial.(N)%(10**9+7))
Problem p03635 (python)

Fixed submission:
n,m=map(int,input().split())
print((n-1)*(m-1))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input.split())
print((n-1)*(m-1))

Buggy submission (verdict: Runtime Error):
n=int(input())
m=int(input())
print((n-1)*(m-1))
Problem p02717 (python)

Fixed submission:
# [箱A, 箱B, 箱C]
list = input().split()

# 箱Aと箱B入れ替え
temp = list[0]
list[0] = list[1]
list[1] = temp

# 箱Aと箱C入れ替え
temp = list[0]
list[0] = list[2]
list[2] = temp              
              
print(' '.join(list))

Buggy submission (verdict: Runtime Error):
# N：全種類数、M：今回種類数
N,M = map(int, input().split())
# 得票数
hyou = list(map(int, input().split()))

# 総得票数
total_hyou = sum(hyou)

# 得票数基準クリア数
count = 0
border = int(total_hyou/(4*M))
for j in hyou:
  if j >= border:
    count += 1
    
# 人気商品をM個選べるかどうか
if count >= M:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
# N：全種類数、M：今回種類数
N,M = map(int, input().split())
# 得票数
hyou = list(map(int, input().split()))

# 総得票数
total_hyou = 0
for i in hyou:
  total_hyou += i

# 得票数基準クリア数
count = 0
border = int(total_hyou/(4*M))
for j in hyou:
  if j >= border:
    count += 1
    
# 人気商品をM個選べるかどうか
if count >= M:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
# N：全種類数、M：今回種類数
N,M = map(int, input().split())
# 得票数
hyou = list(map(int, input().split()))

# 総得票数
total_hyou = 0
for i in hyou:
  total_hyou += i

# 得票数基準クリア数
count = 0
border = int(total_hyou*(1/4*M))
for j in hyou:
  if j >= border:
    count += 1
    
# 人気商品をM個選べるかどうか
if count >= M:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
# N：全種類数、M：今回種類数
N,M = map(int, input().split())
# 得票数
hyou = list(map(int, input().split()))

# 総得票数
total_hyou = 0
for i in hyou:
  total_hyou += i

# 得票数基準クリア数
count = 0
for j in hyou:
  if j >= 1/4*M:
    count += 1
    
# 人気商品をM個選べるかどうか
if count >= M:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
# N：全種類数、M：今回種類数
N,M = map(int, input().split())
# 得票数
hyou = list(map(int, input().split()))

# 総得票数
total_hyou = 0
for i in hyou:
  total_hyou += i

# 得票数基準クリア数
count = 0
for i in hyou:
  if i >= 1/4*M:
    count += 1
    
# 人気商品をM個選べるかどうか
if count >= M:
  print('Yes')
else:
  print('No')
Problem p02747 (python)

Fixed submission:
s=input()
n=len(s)
if n<=1:
  print("No")
  exit()
for i in range(n):
  if i!=n-1 and s[i]=="h":
    if s[i+1]!="i":
      print("No")
      exit()
  elif i!=0 and s[i]=="i":
    if s[i-1]!="h":
      print("No")
      exit()
  elif s[i]!="h" or s[i]!="i":
      print("No")
      exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
if n<=1:
  print("No")
  exit()
for i in range(n):
  if i!=n and s[i]=="h":
    if s[i+1]!="i":
      print("No")
      exit()
  elif i!=0 and s[i]=="i":
    if s[i-1]!="h":
      print("No")
      exit()
  elif s[i]!="h" or s[i]!="i":
      print("No")
      exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
for i in range(n):
  if i!=n and s[i]=="h":
    if s[i+1]!="i":
      print("No")
      exit()
  elif i!=0 and s[i]=="i":
    if s[i-1]!="h":
      print("No")
      exit()
  elif s[i]!="h" or s[i]!="i":
      print("No")
      exit()
print("Yes")
Problem p02797 (python)

Fixed submission:
n,k,s=map(int,input().split())
if s<10**9:
  ans=[s]*k+[s+1]*(n-k)
else:
  ans=[s]*k+[1]*(n-k)
print(" ".join(map(str,ans)))

Buggy submission (verdict: Runtime Error):
n,k,s=map(int,input().split())
if s<10**9:
  ans=[s]*k+[s+1]*(n-k)
else:
  ans=[s]*k+[1]*(n-k)
print(" ".join(map(str,arr)))
Problem p02866 (python)

Fixed submission:
import collections
n=int(input())
D=list(map(int,input().split()))
m=max(D)
MOD=998244353
if D[0] != 0:
  print(0)
  exit()
D=collections.Counter(D)
if D[0] >= 2:
  print(0)
  exit()
cnt=1
for i in range(1,m):
  cnt *= D[i] ** D[i+1]
print(cnt % MOD)

Buggy submission (verdict: Runtime Error):
import collections
n=int(input())
D=list(map(int,input().split()))
m=max(D)
MOD=998244353
if D[0] != 0:
  print(0)
  exit()
D=collections.Counter(D)
if D[0] >= 2:
  pritn(0)
  exit()
cnt=1
for i in range(1,m):
  cnt *= D[i] ** D[i+1]
print(cnt % MOD)

Buggy submission (verdict: Runtime Error):
import collections
n=int(input())
D=list(map(int,input().split()))
D.sort()
m=d[-1]
MOD=998244353
if D[0] != 0 or D[0] >= 2:
  print(0)
  exit()
D=collections.Counter(D)
cnt=1
for i in range(1,m):
  if D[i] == 0:
    print(cnt % MOD)
    exit()
  else:
    cnt *= D[i] ** D[i+1]
print(cnt % MOD)
Problem p02900 (python)

Fixed submission:
a,b=map(int,input().split())
def gcd(a, b):
  return a if b == 0 else gcd(b, a%b)

def factorize(n):
  a = []
  while n % 2 == 0:
    a.append(2)
    n /= 2
  f = 3
  while f * f <= n:
    if n % f == 0:
      a.append(f)
      n /= f
    else:
      f += 2
  if n != 1: a.append(n)
  return a

print(len(set(factorize(gcd(a,b))))+1)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
def gcd(a, b):
  while b:
    a, b = b, a % b
  return a
def cf(x1,x2):
    cf=[]
    for i in range(2,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

ans = cf(a,b)
i = len(ans)
j = len(ans)
cnt = 0
while cnt != len(ans)-2:
  if ans[i-1] % ans[j-2] == 0:
    ans[i-1]=0
    i -= 1
    j = i-1
    cnt += 1
    continue
  j-=1
  if j < 0:
    i -= 1
    j = i - 1
    cnt += 1
    continue

print(len(ans)+1)