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

Fixed submission:
import numpy as np

N, T = map(int, input().split())
A = np.array(input().split(), dtype=np.int32)

# 自分より左にある最安値
A_cummin = np.minimum.accumulate(A)
# 差額
profit = A - A_cummin

ans = (profit == profit.max()).sum()
print(ans)

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

n = T // 2

d = -float("inf")
cnt = 1
l = 0
for r in range(1, N - 1):
    if A[l] < A[r]:
        if A[r] > A[r + 1]:
            if d == A[r] - A[l]:
                cnt += 1
            elif d < A[r] - A[l]:
                d = A[r] - A[l]
                cnt = 1
    else:
        l = r
        r += 1
else:
    if d == A[r] - A[l]:
        cnt += 1
    elif d < A[r] - A[l]:
        d = A[r] - A[l]
        cnt = 1
    print(cnt)
Problem p04043 (python)

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

A, B, C = map(int, (input().split()))

sen = [A, B, C]
x = max(sen)
y = min(sen)
if x == 7 and y == 5 and sum(sen) - x - y == 5:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
sen=[A,B,C]
x=max(sen)
y=min(sen)
if x==7 and y==5 and sum(sen)-x-y==5:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
sen = [A,B,C]
sen.sort()
if sen == [5,5,7]:
	print("YES")
else:
	print("NO")

Buggy submission (verdict: Runtime Error):
sen = [A,B,C]
print(sen)
sen.sort()
print(sen)
if sen == [5,5,7]:
	print("YES")
else:
	print("NO")

Buggy submission (verdict: Runtime Error):
sen = [A,B,C]
sen = sen.sort()
if sen == [5,5,7]:
	print("YES")
else:
	print("NO")

Buggy submission (verdict: Runtime Error):
sen = [A,B,C]
sen = sen.sort()
if sen = [5,5,7]:
	print("YES")
else:
	print("NO")
Problem p02657 (python)

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

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

Fixed submission:
K = int(input())

S = [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]
print(S[K - 1])

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

S = [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]
print(S[K + 1])

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

S = [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]
print(S[K])
Problem p02783 (python)

Fixed submission:
H,A = map(int, input().split())
if H % A == 0:
    print(H // A)
else:
    print(H // A + 1)

Buggy submission (verdict: Runtime Error):
H,A = map(int, input().split)
if H % A == 0:
    print(H // A)
else:
    print(H // A + 1)

Buggy submission (verdict: Runtime Error):
H,A = map(int, input().split)
answer_1 = H // A
answer_2 = H % A
if answer_2 == 0:
    print(answer_1)
else:
    print(answer_1 + 1)

Buggy submission (verdict: Runtime Error):
import math

H,A = map(int, input().split)
float_ver = H / A
print(math.ceil(float_ver))
Problem p02784 (python)

Fixed submission:
H,N = map(int,input().split())
A = list(map(int,input().split()))
if sum(A) >= H:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
H, N = map(int, input().split())
number = int(input().count(N))
S = sum(number)
if S / N >= H / N:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
H, N = map(int, input().split())
number = int(input())
S = sum(number)
if S / N >= H / N:
    print("Yes")
else:
    print("No")
Problem p02898 (python)

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

count = 0

for i in h:
   if i >= k:
       count += 1

print(count)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
h = list(map(int, input().split()))
         
         count = 0
         
         for i in h:
         if i >= k:
         count += 1
         
         print(count)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
h = list(map(int, input().split())
         
         count = 0
         
         for i in h:
         if i >= k:
         count += 1
         
         print(count)
Problem p02899 (python)

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

L = [0]*n

for i, order in enumerate(l, 1):
    L[order-1] = i

print(*L)

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

L = [0]*n

for i, order in enumerate(l, 1):
    L[order-1] = i

print(*L)
Problem p02934 (python)

Fixed submission:
N = int(input())
A = [int(e) for e in input().split()]
V = 0
for i in range(N):
    V += 1/A[i]
print(1/V)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(e) for e in range(N)]
V = 0
for i in range(N):
    V += 1/A[i]
print(1/V)

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

sum = 0
sum += 1/A
ans = 0
ans += 1/sum
print(ans)
Problem p02993 (python)

Fixed submission:
S = str(input())

if S[0] == S[1] or S[1] == S[2] or S[2] == S[3]:
    print("Bad")
else:
    print("Good")

Buggy submission (verdict: Runtime Error):
S = [int(e) for e in input().split()]

if S[0] == S[1] or S[1] == S[2] or S[2] == S[3]:
    print("Bad")
else:
    print("Good")
Problem p03238 (python)

Fixed submission:
N = int(input())
if N == 1:
    print("Hello World")
else:
    A = int(input())
    B = int(input())
    print(A + B)

Buggy submission (verdict: Runtime Error):
N = input()
if N == 1:
    print("Hello World")
else:
    A = int(input())
    B = int(input())
    print(A + B)

Buggy submission (verdict: Runtime Error):
N = input()
A = input()
B = input()

if N == 1:
    print("Hello World")
elif N == 2:
    print(A + B)
else:
    print(-1)

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

if N == 1:
    print("Hello World")
elif N == 2:
    print(A + B)
else:
    print(-1)

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

if N == 1:
    print("Hello World")
elif N == 2:
    print(A + B)
Problem p02603 (python)

Fixed submission:
n=int(input())
a_list=list(map(int,input().split()))
current=1000
kabu=0
for i in range(n-1) :
  if a_list[i]<a_list[i+1] :
    kabu+=current//a_list[i]
    current=current%a_list[i]
    current += a_list[i+1] * kabu
    kabu = 0




print(current)

Buggy submission (verdict: Runtime Error):
n=int(input())
a_list=list(map(int,input().split()))
current=1000
kabu=0
for i in range(n-1) print(current)
  if a_list[i]<a_list[i+1] :
    kabu+=current//a_list[i]
    current=current%a_list[i]
  else :
    current+=a_list[i]*kabu
    kabu=0
current+=a_list[-1]*kabu
print(current)

Buggy submission (verdict: Runtime Error):
n=int(input())
a_list=list(map(int,input().split()))
current=1000
kabu=0
for i in range(n-1) print(current)
  if a_list[i]<a_list[i+1] :
    kabu+=current//a_list[i]
    current=current%a_list[i]
  else :
    current+=a_list[i]*kabu
    kabu=0
current+=a_list[-1]*kabu
print(current)
Problem p02628 (python)

Fixed submission:
n,k = map(int, input().split())
a_list=list(map(int, input().split()))
a_list=sorted(a_list)
print(sum(a_list[:k]))

Buggy submission (verdict: Runtime Error):
sum=26
count=0
n = int(input())
k = ord('a')-1
while(sum<n) :
  count+=1
  sum+=26**(count+1)

current=n
mozi=''
mozi1=''
for i in range(count+1) :
  mozi+='z'
if current==sum :
  print(mozi)
else :
  for i in reversed(range(count+1)) :
    c=current//26**i

    mozi1+=chr(c+k)
    current = current % 26 ** i
  print(mozi1)

Buggy submission (verdict: Runtime Error):
sum=26
count=0
n = int(input())
k = ord('a')-1
while(sum<n) :
  count+=1
  sum+=26**(count+1)

current=n
mozi=''
mozi1=''
for i in range(count+1) :
  mozi+='z'
if current==sum :
  print(mozi)
else :
  for i in reversed(range(count+1)) :
    c=current//26**i
    
    mozi1+=chr(c+k)
    current = current % 26 ** i
  print(mozi1)
Problem p02683 (python)

Fixed submission:
a=input().split()
N=int(a[0])
M=int(a[1])
X=int(a[2])
list1=[]
for i in range(N) :
  k=input().split()
  k=[int(j) for j in k]
  list1.append(k)

flag1=True
def count(item,i) :
  count1=0
  for a in item :
    count1+=a[i]
  return count1

def algo(item,i) :

  for j in range(1,i+1) :
    if count(item,j)<X :
      return False
  return True


import itertools
value_list=[]
for i in range(1,N+1) :
  c=list(itertools.combinations(list1,i))


  for item in c :
    item1=list(item)


    if algo(item1,M) :
      value_list.append(count(item1,0))

if value_list!=[] :
  print(min(value_list))
else :
  print('-1')

Buggy submission (verdict: Runtime Error):
a=input().split()
N=int(a[0])
M=int(a[1])
X=int(a[2])
list1=[]
for i in range(N) :
  k=input().split()
  k=[int(j) for j in k]
  list1.append(k)
flag1=True
def count(item,i) :
  count=0
  for a in item :
    count+=a[i]
  return count

import itertools
for i in range(1,N+1) :
  c=list(itertools.combinations(list1,i))

  value_list=[]
  for item in c :
    item1=list(item)


    if count(item,1)>=X and count(item,2)>=X and count(item,3)>=X :
      value_list.append(count(item,0))
  if value_list!=[] :
    print(min(value_list))
    flag1=False

    break
if flag1 :
  print('-1')

Buggy submission (verdict: Runtime Error):
a=input().split()
N=int(a[0])
M=int(a[1])
X=int(a[2])
list1=[]
for i in range(N) :
  k=input().split()
  k=[int(j) for j in k]
  list1.append(k)
flag1=True
def count(item,i) :
  count=0
  for a in item :
    count+=a[i]
  return count

import itertools
import numpy as np
for i in range(1,N+1) :
  c=list(itertools.combinations(list1,i))

  value_list=[]
  for item in c :
    item1=list(item)


    if count(item,1)>=X and count(item,2)>=X and count(item,3)>=X :
      value_list.append(count(item,0))
  if value_list!=[] :
    print(min(value_list))
    flag1=False

    break
if flag1 :
  print('-1')
Problem p02706 (python)

Fixed submission:
a=input().split()
N=int(a[0])
M=int(a[1])
M_list=input().split()
Flag=True
item_list=[]
for item in M_list :
	item_list.append(int(item))
    
if N<sum(item_list):
	print('-1')
else :
	for item in item_list :
		N-=item
	print(N)

Buggy submission (verdict: Runtime Error):
a=input().split()
N=int(a[0])
M=int(a[1])
M_list=input().split()
Flag=True
item_list=[]
for item in M_list :
	item_list.append(int(item))
    
if N<sum(item_list):
	print('-1')
else :
	for item in item_list :
    	N-=item
    print(N)
Problem p02718 (python)

Fixed submission:
NM=input().split()
M=int(NM[1])
a=input().split()
a_list=[]
for i in a :
  a_list.append(int(i))
a_list.sort(reverse=True)
sum1=sum(a_list)
 
flag=True
for i,youso in enumerate(a_list) :
  if(youso*4*M<sum1 and i+1<=M) :
    flag=False
    break
    
if flag==True :
  print('Yes')
else :
  print('No')

Buggy submission (verdict: Runtime Error):
NM=input().split()
M=int(NM[1])
a=input().split()
a_list=[]
for i in a :
  a_list.append(int(i))
a_list.sort(reverse=True)
sum1=sum(a_list)
 
flag=True
for i,youso in enumerate(a_list) :
  if(youso*4*M<sum1 and i+1<=M) :
    print(youso)
    flag=False
    break
    
if flag=True :
  print('Yes')
else :
  print('No')
NM=input().split()
M=int(NM[1])
a=input().split()
a_list=[]
for i in a :
  a_list.append(int(i))
a_list.sort(reverse=True)
sum1=sum(a_list)
 
flag=True
for i,youso in enumerate(a_list) :
  if(youso*4*M<sum1 and i+1<=M) :
    print(youso)
    flag=False
    break
    
if flag==True :
  print('Yes')
else :
  print('No')

Buggy submission (verdict: Runtime Error):
NM=input().split()
M=int(NM[1])
a=input().split()
a_list=[]
for i in a :
  a_list.append(int(i))
a_list.sort(reverse=True)
sum1=sum(a_list)
 
flag=True
for i,youso in enumerate(a_list) :
  if(youso*4*M<sum1 and i+1<=M) :
    print(youso)
    flag=False
    break
    
if flag=True :
  print('Yes')
else :
  print('No')
Problem p02720 (python)

Fixed submission:
from collections import deque
a=int(input())
list1=deque([1,2,3,4,5,6,7,8,9])
i=1
while(i<=a) :
  #print (list1)
  if i!=a :
    k=list1.popleft()
    k=str(k)
    if int(k[-1])==0 :
      list1.append(int(str(k)+'0'))
      list1.append(int(str(k)+'1'))
      i+=1
    elif int(k[-1])==9 :
      list1.append(int(str(k)+'8'))
      list1.append(int(str(k)+'9'))
      i+=1
    else :
      list1.append(int(str(k)+str(int(k[-1])-1)))
      list1.append(int(str(k)+str(int(k[-1]))))
      list1.append(int(str(k)+str(int(k[-1])+1)))
      i+=1
  else :
    print(list1[0])
    break

Buggy submission (verdict: Runtime Error):
K=int(input())
i=0
current_num=0
while (i<K) :
  current_string=str(current_num)
  flag=True
  for k in range(len(current_string)-1) :
    if abs(int(current_string[k])-int(current_string[k+1]))>1 :
      flag=False
      break
  if flag=True :
    i+=1
  current_num+=1
  
print(current_num)
Problem p02727 (python)

Fixed submission:
xyabc=input().split()
x=int(xyabc[0])
y=int(xyabc[1])
a=int(xyabc[2])
b=int(xyabc[3])
c=int(xyabc[4])
list1=input().split()
list2=input().split()
list3=input().split()
d=a-x+b-y
an=[]
bn=[]
cn=[]
for num in list1 :
  an.append(int(num))
for num in list2 :
  bn.append(int(num))
for num in list3 :
  cn.append(int(num))
an.sort(reverse=True)
bn.sort(reverse=True)

an=an[:x]
bn=bn[:y]

for a in an :
  cn.append(a)
for b in bn :
  cn.append(b)
cn.sort(reverse=True)
count=0
for i in range(x+y) :
  count+=cn[i]

print(count)

Buggy submission (verdict: Runtime Error):
xyabc=input().split()
x=int(xyabc[0])
y=int(xyabc[1])
a=int(xyabc[2])
b=int(xyabc[3])
c=int(xyabc[4])
list1=input().split()
list2=input().split()
list3=input().split()
d=a-x+b-y
an=[]
bn=[]
cn=[]
for num in list1 :
  an.append(int(num))
for num in list2 :
  bn.append(int(num))
for num in list3 :
  cn.append(int(num))

count=0
for i in range(x) :
  k=max(an)
  count+=k
  an.pop(k)
  
for i in range(y) :
  k=max(bn)
  count+=k
  an.pop(k)
  

for i in range(d) :
  k=max(cn)
  count+=k
  an.pop(k)
  
print(count)
Problem p02741 (python)

Fixed submission:
list1=[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]
K=int(input())
print(list1[K-1])

Buggy submission (verdict: Runtime Error):
list1=[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]
K=int(input())
print(list1[K])
Problem p02742 (python)

Fixed submission:
HW=input().rstrip('\n').split()
H=int(HW[0])
W=int(HW[1])
if H==1 or W==1 :
    print (1)
elif H%2==1 and W%2==1 :
    print (int((H*W+1)/2))
else :
    print(int(H * W / 2))

Buggy submission (verdict: Runtime Error):
import math
ABC=input().rstrip('\n').split()

A=math.sqrt(int(ABC[0]))
B=math.sqrt(int(ABC[1]))
C=math.sqrt(int(ABC[2]))
AB=math.sqrt(A*B)
if A+B<C :
    print ("Yes")
else :
    print ("No")
Problem p02743 (python)

Fixed submission:
import math
ABC=input().split()
 
a=int(ABC[0])
b=int(ABC[1])
c=int(ABC[2])
 
if a*a+b*b+c*c-2*a*b-2*a*c-2*b*c>0 and a+b<c  :
    print ("Yes")
else :
    print ("No")

Buggy submission (verdict: Runtime Error):
import math
ABC=input().rstrip('\n').split()

A=int(ABC[0])
B=int(ABC[1])
C=int(ABC[2])

if a*a+b*b+c*c+a*b-2*a*c-2*b*c>0  :
    print ("Yes")
else :
    print ("No")

Buggy submission (verdict: Runtime Error):
A=int(ABC[0])
B=int(ABC[1])
C=int(ABC[2])
AB=math.sqrt(A*B)
if A+B+AB<C :
    print ("Yes")
else :
    print ("No")

Buggy submission (verdict: Runtime Error):
ABC=input().split()

A=int(ABC[0])
B=int(ABC[1])
C=int(ABC[2])
AB=math.sqrt(AB)
if A+B+AB<C :
    print ("Yes")
else :
    print ("No")
Problem p03164 (python)

Fixed submission:
a= input().split()
N = int(a[0])
W = int(a[1])
wv_list = []
max_value = 0

#価値と重さのやつをリストにしてる
for i in range(N):
  b = input().split()
  w = int(b[0])
  v = int(b[1])
  max_value += v

  wv_list.append([w, v])

#初期化
#とりあえず、全部最大になるように
inf=float('inf')
n_list = [[inf for i in range(max_value + 1)] for j in range(N)]

#最初のアイテムに関して、重みを適切な価値のところにいれている
n_list[0][wv_list[0][1]] = wv_list[0][0]

for i in range(1, N):
  # 今まで全く選んでなかった場合に、i番目のアイテムを選んだ時
  n_list[i][wv_list[i][1]] = wv_list[i][0]
  for j in range(max_value):

    s = j + wv_list[i][1]
    #アイテムを選んだらこうなりますよってのを更新
    if s <= max_value:
      n_list[i][s] = min(n_list[i - 1][j] + wv_list[i][0], n_list[i][s])

    #選ばんかったらこうなりますよってのを更新？
    n_list[i][j] = min(n_list[i - 1][j], n_list[i][j])
  
for i in range(1, max_value):

  if n_list[-1][-i] <= W:
    print(max_value - i + 1)
    break

Buggy submission (verdict: Runtime Error):
for i in range(N) :
  b=input().split()
  w=int(b[0])
  v=int(b[1])

  wv_list.append([w,v])

n_list=  [[0 for i in range(W+1)] for j in range(N)]


if wv_list[0][0]<=W :
    n_list[0][wv_list[0][0]]=wv_list[0][1]

for i in range(1,N) :
    for j in range(W) :
        s=j+wv_list[i][0]
        if s<=W :
            n_list[i][s]=max(n_list[i-1][j]+wv_list[i][1],n_list[i][s])

        n_list[i][j] = max(n_list[i - 1][j],n_list[i][j])

print(max(n_list[-1]))

Buggy submission (verdict: Runtime Error):
for i in range(N) :
  b=input().split()
  w=int(b[0])
  v=int(b[1])

  wv_list.append([w,v])

n_list=  [[0 for i in range(W+1)] for j in range(N)]


if wv_list[0][0]<=W :
    n_list[0][wv_list[0][0]]=wv_list[0][1]

for i in range(1,N) :
    for j in range(W) :
        s=j+wv_list[i][0]
        if s<=W :
            n_list[i][s]=max(n_list[i-1][j]+wv_list[i][1],n_list[i][s])

        n_list[i][j] = max(n_list[i - 1][j],n_list[i][j])

print(max(n_list[-1]))
Problem p02614 (python)

Fixed submission:
h,w,k = map(int, input().split())
c = [list(input()) for _ in range(h)]
ans = 0
for pattern_h in range(2**h):
  for pattern_w in range(2**w):
    count = 0
    for i in range(h):
      for j in range(w):
        if (pattern_h>>i)&1==0 and (pattern_w>>j)&1==0:
          if c[i][j]=='#':
            count += 1
    if count == k:
      ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools

h,w,k = map(int, input().split())
c = [list(input()) for _ in range(h)]
r = []
s = 0
ans = 0
for i in c:
  s += i.count('#')
if s==k:
  print(1)
  quit()
for i in range(w):
  row = []
  for j in range(h):
    if c[j][i]=='#' and 
    row.append(c[j][i])
  r.append(row)
re = c + r
for i in range(1,len(re)):
  combs = itertools.combinations(re, i)
  for j in list(combs):
    if (s-sum(j))==k:
      ans += 1
print(ans)
Problem p02787 (python)

Fixed submission:
h,n = map(int, input().split())
magics = [tuple(map(int, input().split())) for _ in range(n)]
max_a = sorted(magics, key=lambda x: x[0], reverse=True)[0][0]
dp = [0]*(h+max_a)
for i in range(1, h+max_a):
  dp[i] = min(dp[i-a]+b for a,b in magics)
print(min(dp[h:]))

Buggy submission (verdict: Runtime Error):
h,n = map(int, input().split())
magics = [tuple(map(int, input().split())) for _ in range(n)]
dp = [0]*(h+1)
for i in range(1, h+1):
  dp[i] = min(dp[i-a]+b for a,b in magics)
print(dp[h])
Problem p02945 (python)

Fixed submission:
line = input().split()

a = int(line[0])
b = int(line[1])

print(max(a-b,a+b,a*b))

Buggy submission (verdict: Runtime Error):
num = int(input())
s = ["".join(sorted(input())) for i in range(num)]

d =dict()

for st in s:
    if st in d:
        d[st]+=1
    else:
        d[st]=1

ans=0

for i in d:
    k=d[i]
    ans+=(k*(k-1))//2

print(ans)
Problem p02958 (python)

Fixed submission:
n = int(input())
p = list(map(int, input().split()))
count = 0

for i in range(1, n+1):
  if p[i-1] != i:
    count += 1
    
if count == 0 or count == 2:
  print("YES")
else:
  print("NO")

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

for i in range(1, n+1):
  if p[i-1] != i:
    count += 1
    
if count == 0 or count == 2:
  print("YES")
else:
  print("No")
Problem p03238 (python)

Fixed submission:
n = int(input())
if n==1:
  print('Hello World')
else:
  a = int(input())
  b = int(input())
  print(a+b)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = int(input())
b = int(input())
if n==1: print('Hello World')
else: print(a+b)
Problem p03624 (python)

Fixed submission:
s = set(input())
al = set(list(map(chr, [i for i in range(97, 97+26)])))
print('None' if len(s)==len(al) else min(al-s))

Buggy submission (verdict: Runtime Error):
s = sorted(input())
for i in range(len(s)-1):
  if ord(s[i+1])-ord(s[i])>=2:
    print(chr(ord(s[i]+1)))
    break
Problem p03738 (python)

Fixed submission:
a = int(input())
b = int(input())
if a>b: print('GREATER')
elif a<b: print('LESS')
else: print('EQUAL')

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split())
if a>b: print('GREATER')
elif a<b: print('LESS')
else: print('EQUAL')
Problem p02554 (python)

Fixed submission:
n = int(input())
mod = 10**9 + 7
print((pow(10, n, mod) - 2*pow(9, n, mod) + pow(8, n, mod)) % mod)

Buggy submission (verdict: Runtime Error):
n = int(input())
print(pow(10, n, mod) - 2*pow(9, n, mod) - pow(9, n, mod))
Problem p02573 (python)

Fixed submission:
class UnionFind():
    def __init__(self, n):
        self._n = n
        self._table = [-1]*n

    def _root(self, x):
        stack = []
        while self._table[x] >= 0:
            stack.append(x)
            x = self._table[x]
        for y in stack:
            self._table[y] = x
        return x
    
    def unite(self, x, y):
        x, y = self._root(x), self._root(y)
        if x == y:
            return
        if x > y:
            x, y = y, x
        self._table[x] += self._table[y]
        self._table[y] = x
    
    def same(self, x, y):
        return self._root(x) == self._root(y)

    def count_members(self, x):
        return -self._table[self._root(x)]
    
    def count_groups(self):
        return len({self._root(i) for i in range(self._n)})
    
    def __str__(self):
        return str([self._root(i) for i in range(self._n)])
    
    def __repr__(self):           
        return repr([self._root(i) for i in range(self._n)])

n, m, *AB = map(int, open(0).read().split())
uf = UnionFind(n)
for a, b in zip(AB[::2], AB[1::2]):
    uf.unite(a-1, b-1)
print(max(uf.count_members(group) for group in {uf._root(i) for i in range(n)}))

Buggy submission (verdict: Runtime Error):
class UnionFind():
    def __init__(self, n):
        self._n = n
        self._table = [-1]*n

    def _root(self, x):
        stack = []
        while self._table[x] >= 0:
            stack.append(x)
            x = self._table[x]
        for y in stack:
            self._table[y] = x
        return x
    
    def unite(self, x, y):
        x, y = self._root(x), self._root(y)
        if x == y:
            return
        if x > y:
            x, y = y, x
        self._table[x] += self._table[y]
        self._table[y] = x
    
    def same(self, x, y):
        return self._root(x) == self._root(y)

    def count_members(self, x):
        return -self._table[self._root(x)]
    
    def count_groups(self):
        return len({self._root(i) for i in range(self._n)})
    
    def __str__(self):
        return str([self._root(i) for i in range(self._n)])
    
    def __repr__(self):           
        return repr([self._root(i) for i in range(self._n)])

n, m, *AB = map(int, open(0).read().split())
uf = UnionFind(n)
for a, b in zip(AB[::2], AB[1::2]):
    uf.unite(a, b)
s = 0
for group in {uf._root(i) for i in range(n)}:
    s += uf.count_members(group)-1
print(s)
Problem p02583 (python)

Fixed submission:
n, *L = map(int, open(0).read().split())
L.sort()
c = 0
for i in range(n-2):
  li = L[i]
  for j in range(i+1, n-1):
    lj = L[j]
    if li == lj:
      continue
    for k in range(j+1, n):
      lk = L[k]
      if lj == lk or li + lj <= lk:
        continue
      c += 1
print(c)

Buggy submission (verdict: Runtime Error):
n, *L = map(int, input().split())
L.sort()
c = 0
for i in range(n-2):
  li = L[i]
  for j in range(i+1, n-1):
    lj = L[j]
    if li == lj:
      continue
    for k in range(j+1, n):
      lk = L[k]
      if lj == lk or li + lj < lk:
        continue
      c += 1
print(c)