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

Fixed submission:
h,w=map(int,input().split())
s=["."*(w+2)]
for i in range(h):
  s.append("."+input()+".")
s.append("."*(w+2))
ans="Yes"
for i in range(1,h+1):
   for j in range(1,w+1):
      if s[i][j]=="#" and s[i-1][j]=="." and s[i][j+1]=="." and s[i+1][j]=="." and s[i][j-1]==".":
        ans="No"
        break
print(ans)

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
s=["."*(w+2)]
for i in range(h):
  s.append("."+input()+".")
s.append("."*(w+2))
ans="Yes"
for i in range(1,h+1):
   for j in range(1,h+1):
      if s[i][j]=="#" and s[i-1][j]=="." and s[i][j+1]=="." and s[i+1][j]=="." and s[i][j-1]==".":
        ans="No"
        break
print(ans)
Problem p03447 (python)

Fixed submission:
x,a,b=(int(input()) for _ in range(3))
print((x-a)%b)

Buggy submission (verdict: Runtime Error):
x,a,b=[int(input() for i in range(3))]
print((x-a)%b)
Problem p03456 (python)

Fixed submission:
import math
a,b = map(int,input().split())
n = len(str(b))
     
c = a*(10**n)+b
d = int(math.sqrt(c))
if d**2 == c:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
import math
a,b = map(int,input().split())
n = int(len(b))

c = a*n+b
d = int(math.sqrt(c))
if d**2 == c:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
import math
a,b = map(int,input().split())
n = len(b)

c = a*n+b
d = int(math.sqrt(c))
if d**2 == c:
  print("Yes")
else:
  print("No")
Problem p03493 (python)

Fixed submission:
s=list(input())
print(s.count("1"))

Buggy submission (verdict: Runtime Error):
s=list(input())
print(sum(int(s)))

Buggy submission (verdict: Runtime Error):
s=list(input())
print(sum(s))
Problem p03502 (python)

Fixed submission:
n=input()
a=[]
for i in range(len(n)):
  a.append(int(n[i]))
print("Yes" if int(n)%sum(a)==0 else "No")

Buggy submission (verdict: Runtime Error):
n=input()
a=[]
for i in range(len(n)):
  a.append(int(s[i]))
print("Yes" if int(n)%sum(a)==0 else "No")

Buggy submission (verdict: Runtime Error):
n=input()
a=[]
for i in range(len(n)):
  a.append(s[i])
print("Yes" if int(n)%sum(a)==0 else "No")
Problem p03556 (python)

Fixed submission:
print(int(int(input())**0.5)**2)

Buggy submission (verdict: Runtime Error):
print(int(n**0.5)**2)
Problem p03633 (python)

Fixed submission:
from fractions import gcd
def lcm(a,b): return a*b//gcd(a,b)
N=int(input())
ans=1
for i in range(N):
    t=int(input())
    ans=lcm(ans,t)
print(ans)

Buggy submission (verdict: Runtime Error):
from functools import reduce
from math import gcd
n=int(input())
t=[int(input()) for i in range(n)]
lcm=t[0]*t[1]//gcd(t[0],t[1])
for i in range(2,n):
  lcm=lcm*t[i]//gcd(lcm,t[i])
print(lcm)

Buggy submission (verdict: Runtime Error):
from functools import reduce
from math import gcd
n=int(input())
t=[int(input()) for i in range(n)]
x=reduce(gcd,t)
lcm=t[0]*t[1]//x
for i in range(2,n):
  lcm=lcm*t[i]//gcd(lcm,t[i])
print(lcm)
Problem p03694 (python)

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

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

Fixed submission:
import math
from collections import Counter
n=math.factorial(int(input()))
dp=[]
for i in range(2,1001):
  while n%i==0:
    n//=i
    dp.append(i)
c=list(Counter(dp).items())
ans=1
for j in range(len(c)):
  ans*=c[j][1]+1
print(ans%1000000007)

Buggy submission (verdict: Runtime Error):
import math
from collections import Counter
n=math.factorial(int(input()))
dp=[]
for i in range(2,int(math.sqrt(n))+2):
  while n%i==0:
    n//=i
    dp.append(i)
c=list(Counter(dp).items())
ans=1
#print(c)
for j in range(len(c)):
  ans*=c[j][1]+1
print(ans%1000000007)
Problem p03852 (python)

Fixed submission:
a=input()
if a=="a" or a=="i" or a=="u" or a=="e" or a=="o":
  print("vowel")
else:
  print("consonant")

Buggy submission (verdict: Runtime Error):
a=input()
if a="a" or a="i" or a="u" or a="e" or a="o":
  print("vowel")
else:
  print("consonant")
Problem p03860 (python)

Fixed submission:
s = list(map(str,input().split()))
print("A"+s[1][0]+"C")

Buggy submission (verdict: Runtime Error):
s = map(input().split())
print(s[1])s = list(map(str,input().split()))
print("A"+s[1][0]+"C")
Problem p03862 (python)

Fixed submission:
n,x=map(int,input().split())
a=list(map(int,input().split()))
dp=[0]*(n-1)
ans=0
for i in range(n-1):
  dp[i]=a[i]+a[i+1]
for j in range(n-2):
  if dp[j]>x:
    ans+=min(dp[j]-x,a[j+1])
    dp[j+1]-=min(dp[j]-x,a[j+1])
    dp[j]-=min(dp[j]-x,a[j+1])
if dp[n-2]>x:
  ans+=dp[n-2]-x
  dp[n-2]-=dp[n-2]-x
if dp[0]>x:
  ans+=dp[0]-x
  dp[0]-=dp[0]-x
print(ans)

Buggy submission (verdict: Runtime Error):
n,x=map(int,input().split())
a=list(map(int,input().split()))
dp=[0]*(n-1)
ans=0
for i in range(n-1):
  dp[i]=a[i]+a[i+1]
for j in range(n-2):
  if dp[j]>x:
    ans+=min(dp[j]-x,a[j+1])
    dp[j+1]-=min(dp[j]-x,a[j+1])
    dp[j]-=min(dp[j]-x,a[j+1])
if dp[n-2]>x:
  ans+=dp[n-2]-x
if dp[0]>x:
  ans+=dp[p]-x
print(ans)
Problem p02618 (python)

Fixed submission:
d = int(input())
c = list(map(int,input().split()))
s = []
day = [0 for i in range(26)]
for i in range(d):
    s.append(list(map(int,input().split())))
ans = 0
for i in s:
    max_index = -1
    large = 0
    for j in range(26):
        if large < i[j]:
            large = i[j]
            if not max_index == -1:
                day[max_index] += 1
                ans -= c[max_index]
            max_index = j
        else:
            day[j] += 1
            ans -= c[j]
    day[max_index] = 0
    ans += large
    print(max_index+1)

Buggy submission (verdict: Runtime Error):
import time
import copy
from threading import Thread
import random

import threading


d = int(input())
c = list(map(int,input().split()))
s = []
day = [0 for i in range(26)]
for i in range(d):
    s.append(list(map(int,input().split())))
ans = 0
num = 1
index = []
for i in s:
    max_index = -1
    large = 0
    for j in range(26):
        if large < i[j]:
            large = i[j]
            if not max_index == -1:
                ans -= c[max_index]*(num-day[max_index])
            max_index = j
        else:
            ans -= c[j]*(num-day[j])
    day[max_index] = num
    ans += large
    index.append(max_index+1)
    num += 1
rec = {}
cnt = 0
while True:
    if cnt == 20:
        for i in index:
            print(i)
        break
    x = random.randint(0,25)
    y = random.randint(0,d-1)
    if (x,y) in rec:
        continue
    rec[(x,y)] = 0
    sub = copy.deepcopy(index)
    sub[y] = x
    sub_ans = 0
    num = 1
    day = [0 for i in range(26)]
    for i in range(d):
        t = sub[i]
        day[t] = num
        for j in range(26):
            if j == t:
                sub_ans += s[i][j]
            else:
                sub_ans -= c[j]*(num-day[j])
        num += 1
    #print(sub_ans,sub,ans,index)
    if sub_ans > ans:
        index = sub_ans
    cnt += 1

Buggy submission (verdict: Runtime Error):
day = [0 for i in range(26)]
for i in range(d):
    s.append(list(map(int,input().split())))
ans = 0
num = 1
for i in s:
    max_index = -1
    large = 0
    for j in range(26):
        if large < i[j]:
            large = i[j]
            if not max_index == -1:
                ans -= c[max_index]*(num-day[max_index])
            max_index = j
        else:
            ans -= c[j]*(num-day[j])
    day[max_index] = num
    ans += large
    print(max_index+1)
    num += 1
Problem p02683 (python)

Fixed submission:
import itertools
import copy
n,m,x = map(int,input().split())
ans = [0 for i in range(m)]
books = []
answer = 1000000000000000000000
for i in range(n):
    books.append(list(map(int,input().split())))
for i in range(n):
    stock = list(list(itertools.combinations([num for num in range(n)], i+1)))
    for j in stock:
        cost = 0
        ans = [0 for i in range(m)]
        for k in j:
            for e,l in enumerate(books[k]):
                if e == 0:
                    cost += l
                else:
                    ans[e-1] += l
            if min(ans) >= x and cost < answer:
                answer = copy.deepcopy(cost)
if answer == 1000000000000000000000:
    print(-1)
else:
    print(answer)

Buggy submission (verdict: Runtime Error):
import itertools
import copy
n,m,x = map(int,input().split())
ans = [0 for i in range(m)]
books = []
answer = 1000000000000000000000
for i in range(n):
    books.append(list(map(int,input().split())))
for i in range(n):
    stock = list(list(itertools.combinations([num for num in range(n)], i+1)))
    for j in stock:
        cost = 0
        ans = [0 for i in range(m)]
        for k in j:
            for e,l in enumerate(books[k]):
                if e == 0:
                    cost += l
                else:
                    ans[e-1] += l
            if min(ans) >= x and cost < answer:
                answer = copy.deepcopy(cost)
if answer = 1000000000000000000000:
    print(-1)
else:
    print(answer)
Problem p02690 (python)

Fixed submission:
import itertools
x = int(input())
num = [i**5 for i in range(3000)]
ans= list(itertools.combinations_with_replacement(num, 2))
for i in ans:
    if abs(i[0]-i[1]) == x:
        if i[0] < i[1]:
            print(int(i[1]**0.2),int(i[0]**0.2))
        else:
            print(int(i[0]**0.2),int(i[1]**0.2))
        break
    elif i[0]+i[1] == x:
        print(int(i[0]**0.2),int(i[1]**0.2)*-1)
        break

Buggy submission (verdict: Runtime Error):
import itertools
x = int(input())
num = [i**5 for i in range(3000)]
ans= list(itertools.combinations_with_replacement(num, 2))
for i in ans:
    if abs(i[0]-i[1]) == x:
        if i[0] < i[1]:
            print(int(i[1]**0.2),int(i[0]**0.2)*)
        else:
            print(int(i[0]**0.2),int(i[1]**0.2))
        break
    elif i[0]+i[1] == x:
        print(int(i[0]**0.2),int(i[1]**0.2)*-1)
        break
Problem p02731 (python)

Fixed submission:
n = int(input())
print(round((n/3)**3,15))

Buggy submission (verdict: Runtime Error):
n = int(input())
print(round((n/3)**3,15)
Problem p02732 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
List={}
x=0
for i in range(n):
    if not a[i] in List:
        List[a[i]] = 1
    else:
        List[a[i]]+=1
    
sigma=0
 
for key,item in List.items():
    sigma += item*(item-1)//2
for i in range(n):
    print(sigma-List[a[i]]+1)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
n = int(input())
s = list(map(int,input().split()))
ans = {}
#各番号がいくつずつあるのかを整理
#keyに番号、valueにその番号が書かれてあるボールの数
for i in range(n):
    if not　s[i] in ans.keys():
        ans[s[i]] = 1
    else:
        ans[s[i]] += 1
#iC2の総和
answer = 0
for i in ans.values():
    answer += i
#answer-nC2+(n-1)C2 = answer-n+1
#nはans[s[i]],よって以下の出力で求められる
for i in range(n):
    print(answer-ans[s[i]]+1)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
n = int(input())
s = list(map(int,input().split()))
ans = {}
#各番号がいくつずつあるのかを整理
#keyに番号、valueにその番号が書かれてあるボールの数
for i in range(n):
    if s[i] in ans.keys():
        ans[s[i]] = 1
    else:
        ans[s[i]] += 1
#iC2の総和 
answer = 0
for i in ans.values():
    answer += i
#answer-nC2+(n-1)C2 = answer-n+1
#nはans[s[i]],よって以下の出力で求められる
for i in range(n):
    print(answer-ans[s[i]]+1)
Problem p02741 (python)

Fixed submission:
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
n = int(input())
print(a[n-1])

Buggy submission (verdict: Runtime Error):
n = list(map(int,input().split()))
print((n[0]*n[1]+1)//2)
Problem p03106 (python)

Fixed submission:
def make_divisors(n,m):
    divisors = []
    for i in range(1,n+1):
        if n % i == 0 and m % i == 0:
            divisors.append(i)
    divisors.sort()
    return divisors
n,m,k = map(int,input().split())
if n <= m:
    c = make_divisors(n,m)
else:
    c = make_divisors(m,n)
c.reverse()
print(c[k-1])

Buggy submission (verdict: Runtime Error):
def make_divisors(n,m):
    divisors = []
    for i in range(1, int(n)):
        if n % i == 0 and m % i == 0:
            divisors.append(i)
    divisors.sort()
    return divisors
n,m,k = map(int,input().split())
if n <= m:
    c = make_divisors(n,m)
else:
    c = make_divisors(m,n)
print(c[-1+k])

Buggy submission (verdict: Runtime Error):
def make_divisors(n,m):
    divisors = []
    for i in range(1, int(n)):
        if n % i == 0 and m % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
n,m,k = map(int,input().split())
if n <= m:
    c = make_divisors(n,m)
else:
    c = make_divisors(m,n)
print(c[-1+k])

Buggy submission (verdict: Runtime Error):
def make_divisors(n,m):
    divisors = []
    for i in range(1, int(n)):
        if n % i == 0 and m % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
n,m,k = map(int,input().split())
if n <= m:
    c = make_divisors(n,m)
else:
    c = make_divisors(m,n)
print(c[-1+k]
Problem p03807 (python)

Fixed submission:
n = input()
s = list(map(int,input().split()))
c = 0
for i in s:
    if i % 2 == 1:
        c+=1
if c % 2 == 1:
    print("NO")
else:
    print("YES")

Buggy submission (verdict: Runtime Error):
n = input()
s = list(map(int,input().split()))
c = 0
for i in s:
    if s % 2 == 1:
        c+=1
if c % 2 == 1:
    print("NO")
else:
    print("YES")

Buggy submission (verdict: Runtime Error):
n = input()
s = list(map(int,input().split()))
c = 0
for i in s:
  if s % 2 == 1:
    c+=1
if c % 2 == 1:
  print("NO")
else:
  print("YES")
Problem p02658 (python)

Fixed submission:
from collections import Counter
def solve():
    n = int(input())
    a = list(map(int, input().split()))

    if 0 in a: return 0
    l = Counter(a)
    ans = 1
    for i,j in l.items():
        ans *= i**j
        if ans > int(1e18):
            return -1

    return ans
    

print(solve())

Buggy submission (verdict: Runtime Error):
def solve():
    n = int(input())
    a = list(map(int, input().split()))

    ans = 1
 
    for i in a:
        ans *= i
      	if ans > int(1e18): return -1
    
    
    return ans
    

print(solve())
Problem p02705 (python)

Fixed submission:
import math

n = int(input())

print(2*n*math.pi)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
l = [int(i) for i in range(n+1)]
s = l[::-1]

ans = 0
for i in range(k, n+2):
  ans += sum(s[:i]) - sum(l[:i]) +1
  
print(ans%(int(1e9)+7))
Problem p02713 (python)

Fixed submission:
import math
k = int(input())

ans = 0
for a in range(1, k+1):
  for b in range(1, k+1):
      m = math.gcd(a, b)
      for c in range(1, k+1):
          ans += math.gcd(m, c)

print(ans)

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

ans = 0
for a in range(1, k):
  for b in range(1, k):
    for c in range(1, k):
      ans += gcd(a, b, c)
      
print(ans)
Problem p02719 (python)

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

rot = n//k
x = n

if k == 1 or n == k or n%k == 0:
  x = 0
elif rot >= 1:
  x = n - k*rot
  
t = x%k

print(min(t, abs(t-k)))

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

ans = n
all = [n]
m = abs(n - k)

if n == 0 or n == 1 or k == 1 or n == 2*k or k == 2*n:
  ans = 0
else:
  all = []
  for _ in range(m):
    n = abs(n - k)
    all.append(n)

  
print(min(ans, min(all)))

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

ans = n
all = [n]
if n == 1 or k == 1 or n == 2*k or k == 2*n:
  ans = 0
elif abs(n - k) < n or abs(n - k) < k:
  ans = abs(n - k)
else:
  all = []
  for i in range(2*n):
    n = abs(n - k)
    all.append(n)

  
print(min(ans, min(all)))

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

ans = k
all = [k]
if n == 1 or k == 1 or n == 2*k or k == 2*n:
  ans = 0
else:
  all = []
  for i in range(2*n):
    n = abs(n - k)
    all.append(n)

  
print(min(ans, min(all)))
Problem p02747 (python)

Fixed submission:
h = input()

result = 'Yes'

if len(h)%2 != 0:
  result ='No'
  
for a in range(0,len(h)-1,2):  
  b = h[a:a+2]
  if b != 'hi':
    result = 'No'
    break
    
print(result)

Buggy submission (verdict: Runtime Error):
s = input().split('i')

h = s[:len(s)-1]
space = s[len(s)-1]


for j in h:
  if j =='h' and space == '':
    ans = 'Yes'
  else:
    ans = 'No'
    break
  
print(ans)

Buggy submission (verdict: Runtime Error):
s = input().split('i')

h = s[:len(s)-1]
space = s[len(s)-1]

for j in h:
  if j =='h' and space == '':
    ans = 'Yes'
  else:
    ans = 'No'
    break
  
print(ans)

Buggy submission (verdict: Runtime Error):
s = input().split('i')

h = s[:len(s)-1]
space = s[len(s)-1]

for j in h:
  if j =='h' and space == '':
    ans = 'Yes'
  else:
    ans = 'No'
  
print(ans)

Buggy submission (verdict: Runtime Error):
s = input().split('i')

h = s[:len(s)-1]
i = s[len(s)-1]
ans = 'No'

for j in h:
  if j =='h' and i == '':
    ans = 'Yes'
  
print(ans)

Buggy submission (verdict: Runtime Error):
s = input().split('i')

h = s[:len(s)-1]
i = s[len(s)-1]
ans = 'No'
for j in h:
  if j =='h' and i == '':
    ans = 'Yes'
  
print(ans)
Problem p02844 (python)

Fixed submission:
n = int(input())
s = input()
ans = 0
for i in range(10):
    a = s.find(str(i))
    if a == -1: continue
    for j in range(10):
        b = s.find(str(j), a + 1)
        if b == -1: continue
        for k in range(10):
            if s.find(str(k), b + 1) != -1:
                ans += 1
print(ans)

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


ans = []
for i in range(n-2):
  for j in range(i+1, n-1):
    for k in range(j+1, n):
    if s[i] + s[j] + s[k] not in ans:
      ans.append(s[i] + s[j] + s[k])
      
print(len(ans))
Problem p02995 (python)

Fixed submission:
from fractions import gcd

a, b, c, d = map(int, input().split())

div_c = b//c - a//c
if a%c == 0: div_c += 1
div_d = b//d - a//d
if a%d == 0: div_d += 1
lcm_cd = c*d//gcd(c, d)
div_cd = b//lcm_cd - a//lcm_cd
if a%lcm_cd == 0: div_cd += 1
print(b - a + 1 - div_c - div_d + div_cd)

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

div_c = b//c - a//c
div_d = b//d - a//d
lcm_cd = c*d//math.gcd(c, d)
div_cd = b//lcm_cd - a//lcm_cd

print(b - a + 1 - div_c - div_d + div_cd)

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

div_c = b//c - a//c
div_d = b//d - a//d
lcm_cd = c*d//math.gcd(c, d)
div_cd = b//lcm_cd - a//lcm_cd

print(b - a + 1 - div_c - div_d + div_cd)
Problem p03380 (python)

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

x = max(a)
m = x/2
a.remove(x)
a.sort()
ans = x

for i in a:
    y = abs(i - m)
    if ans >= y:
        ans = y
    else:
        break    
    z = i
      
print(x, z)

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

x = max(a)
m = x/2
a.remove(x)
a.sort()
ans = 10000

for i in a:
    y = abs(i - m)
    if ans >= y:
        ans = y
    else:
        break    
    z = i
      
print(x, z)

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

x = max(a)
m = x/2
a.remove(x)
a.sort()
ans = 10000
for i in a:
    y = abs(i - m)
    if ans >= y:
        ans = y
    else:
        break    
    z = i
      
print(x, z)
Problem p03449 (python)

Fixed submission:
n = int(input())
a = [list(map(int, input().split())) for _ in range(2)]

l = [0]*n

for i in range(n):
  l[i] = sum(a[0][-(i+1):-(n+1):-1]) + sum(a[1][-1:-(i+2):-1])
  
print(max(l))

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

dp = [0]*n
dp[0] = a[0][0]

for i in range(n-1):
  dp[i+1] = dp[i] + max(a[0][i+1], a[1][i])
  
print(dp[-1] + a[1][n-1])
Problem p03493 (python)

Fixed submission:
a,b,c = [int(i) for i in input()]

print(a+b+c)

Buggy submission (verdict: Runtime Error):
a,b,c = [int(i), for i in input()]

print(a+b+c)
Problem p03607 (python)

Fixed submission:
import collections
def solve():
    n = int(input())
    a = [int(input()) for _ in range(n)]

    c = collections.Counter(a)

    num = list(c.values())
    ans = 0
    for i in range(len(num)):
        if num[i]%2 == 1:
            ans += 1

    return ans

if __name__ == "__main__":
    print(solve())

Buggy submission (verdict: Runtime Error):
def solve():
    n = int(input())
    a = [int(input()) for _ in range(n)]

    ten = [0]*int(1e9)
    for i in range(n):
        ten[i] += 1

    ten.remove(0)
    ans = 0
    for i in range(len(ten)):
        if ten[i]%2 == 1:
            ans += 1


    return ans

if __name__ == "__main__":
    print(solve())
Problem p03611 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
ans = [0] * (int(1e5)+5)
for i in range(n):
    ans[a[i]-1] += 1
    ans[a[i]] += 1
    ans[a[i]+1] += 1
print(max(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
ans = [0] * int(1e5)
for i in range(n):
    ans[a[i]-1] += 1
    ans[a[i]] += 1
    ans[a[i]+1] += 1
print(max(ans))
Problem p03624 (python)

Fixed submission:
import string

s = set(input())

abc = set(string.ascii_lowercase)
rest = abc - s

if rest:
  print(min(rest))
else:
  print('None')

Buggy submission (verdict: Runtime Error):
import string

s = set(input())

abc = set(string.ascii_lowercase)
rest = abc - s

print(min(rest))
Problem p03627 (python)

Fixed submission:
from collections import Counter
def solve():
    n = int(input())
    a = list(map(int, input().split()))

    l = Counter(a)
    tw = []
    fo = []
    for i,j in l.items():
        if j >= 2:
            tw.append(i)
        if j >= 4:
            fo.append(i)
    ans = 0
    if len(tw) >= 2:
        tw.sort()
        ans = max(ans, tw[-1]*tw[-2])
    if fo:
        fo.sort()
        ans = max(ans, fo[-1]**2)
    
    return ans
    

print(solve())

Buggy submission (verdict: Runtime Error):
from collections import Counter
def solve():
    n = int(input())
    a = list(map(int, input().split()))

    l = Counter(a)
    tw = []
    fo = []
    for i,j in l.items():
        if j >= 2:
            tw.append(i)
        if j >= 4:
            fo.append(i)

    if len(tw) >= 2 or len(fo) >= 1:
        tw.sort()
        fo.sort()
        return max(tw[-1]*tw[-2], fo[-1]**2)
    else:
        return 0
    

print(solve())

Buggy submission (verdict: Runtime Error):
from collections import Counter
def solve():
    n = int(input())
    a = list(map(int, input().split()))

    l = Counter(a)
    tw = []
    fo = []
    for i,j in l.items():
        if j >= 2:
            tw.append(i)
        if j >= 4:
            fo.append(i)

    if len(tw) >= 2 or fo:
        tw.sort()
        return max(tw[-1]*tw[-2], fo[-1]**2)
    else:
        return 0
    

print(solve())
Problem p03680 (python)

Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]

b = 1
cnt = 0
while cnt <= 100000:
  b = a[b-1]
  cnt += 1
  if b == 2:
    break
  
if cnt > 100000:
  print(-1)
else:
  print(cnt)

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

b = 0
cnt = 0
while cnt <= 100000:
  b = a[b]
  cnt += 1
  if b == 1:
    break
  
if cnt > 100000:
  print(-1)
else:
  print(cnt)