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

Fixed submission:
S=input()
if len(S)==1:
    print('1')
else:
    k=0
    L=[]
    while k < (len(S)-1):
        if S[k] != S[k+1]:
            L.append(max(k+1,len(S)-k-1))
            k += 1
        else:
            k += 1
    L.sort()
    if len(L)==0:
        print(len(S))
    else:
        print(L[0])

Buggy submission (verdict: Runtime Error):
S=input()
if len(S)==1:
    print('1')
else:
    k=0
    L=[]
    while k < (len(S)-1):
        if S[k] != S[k+1]:
            L.append(max(k+1,len(S)-k-1))
            k += 1
        else:
            k += 1
    L.sort()
    print(L[0])

Buggy submission (verdict: Runtime Error):
S=input()
if len(S)==1:
    print('1')
else:
    k=0
    L=[]
    while k < (len(S)-1):
        if S[k] != S[k+1]:
            L.append(max(k,len(S)-k))
            k += 1
        else:
            k += 1
    L.sort()
    print(L[0])
Problem p03546 (python)

Fixed submission:
def Pto1(C):
    d = C.copy()
    for q in range(0,10):
        for i in range(0,10):
            for j in range(0,10):
                d[i][j] = min(d[i][j], d[i][q]+d[q][j])
    return [d[0][1],d[1][1],d[2][1],d[3][1],d[4][1],d[5][1],d[6][1],d[7][1],d[8][1],d[9][1]]

H,W = map(int,input().split(' '))
C = []
for i in range(0,10):
    cline = list(map(int,input().split(' ')))
    C.append(cline)
C1 = Pto1(C)
A = []
for j in range(0,H):
    aline = list(map(int,input().split(' ')))
    A.append(aline)
h=0
w=0
counter=[0]*10
while h<H:
    w=0
    while w<W:
        if A[h][w]>=0:
            counter[A[h][w]] += 1
        w+=1
    h+=1
Cmin = 0
for k in range(0,10):
    Cmin += C1[k]*counter[k]
print(int(Cmin))

Buggy submission (verdict: Runtime Error):
3 5
0 4 3 6 2 7 2 5 3 3
4 0 5 3 7 5 3 7 2 7
5 7 0 7 2 9 3 2 9 1
3 6 2 0 2 4 6 4 2 3
3 5 7 4 0 6 9 7 6 7
9 8 5 2 2 0 4 7 6 5
5 4 6 3 2 3 0 5 4 3
3 6 2 3 4 2 4 0 8 9
4 6 5 4 3 5 3 2 0 8
2 1 3 4 5 7 8 6 4 0
3 5 2 6 1
2 5 3 2 1
6 9 2 5 6
Problem p03555 (python)

Fixed submission:
A=input()
B=input()
C=B[2]+B[1]+B[0]
if A==C:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
A,B,C=map(str,input().split(' '))
D,E,F=map(str,input().split(' '))
if (A==F) and (B==E) and (C==D):
    print('YES')
else:
    print('NO')
Problem p03611 (python)

Fixed submission:
n=int(input());A = list(map(int,input().split(' ')))
x = [0]*100001
for a in A:
    if a != 0:
        x[a-1]+=1;x[a]+=1;x[a+1]+=1
    else:
        x[a]+=1;x[a+1]+=1
print(max(x))

Buggy submission (verdict: Runtime Error):
n=int(input());A = list(map(int,input().split(' ')))
x = [0]*10001
for a in A:
    if a != 0:
        x[a-1]+=1;x[a]+=1;x[a+1]+=1
    else:
        x[a]+=1;x[a+1]+=1
print(max(x))
Problem p02696 (python)

Fixed submission:
import math
A, B, N = list(map(int, input().split(" ")))
if B > N:
    print(math.floor(A*N/B) - A * math.floor(N/B))
else:
    print(math.floor(A*(B-1)/B))

Buggy submission (verdict: Runtime Error):
import math
A, B, N = list(map(int, input().split(" ")))
if B > N:
    print(math.floor(A*i/B) - A * math.floor(i/B))
else:
    print(math.floor(A*(B-1)/B))
Problem p02744 (python)

Fixed submission:
N = int(input())
import copy

def nex(lis):
    li = copy.copy(lis)
    if len(li) == N:
        print(''.join([chr(97+i) for i in li]))
        return 

    for x in range(max(li)+2):
        li2 = copy.copy(li)
        li2.append(x)
        nex(li2)
        
nex([0])

Buggy submission (verdict: Runtime Error):
from decimal import *
getcontext().prec = 10000

a, b, c = list(map(int, input().split()))
aa = Decimal(a).sqrt()
bb = Decimal(b).sqrt()
cc = Decimal(c).sqrt()
d = c - a - b -Decimal(2)*aa*bb
print(d)

if d > 0:
    print("Yes")
else:
    print("No")
Problem p02756 (python)

Fixed submission:
from collections import deque
S = list(input())
Q = int(input())

day = deque(S)

r = False
for i in range(Q):
    x = input().split()
    
    if x[0] == "1":
        r = not r
        
    else:
        if x[1] == "1":
            if r == False :
                day.appendleft(x[2])
            else:
                day.append(x[2])
        else:
            if r == True :
                day.appendleft(x[2])
            else:
                day.append(x[2])
                
day = list(day)
        
if r:
    print("".join(day[::-1]))
else:
    print("".join(day))

Buggy submission (verdict: Runtime Error):
S = list(input())
Q = int(input())
 
r = False
for i in range(Q):
    x = input().split()
    
    if x[0] == "1":
        r = not r
        
    else:
        if x[1] == "1":
            if r == False :
                S.insert(0, x[2])
            else:
                S.append(x[2])
        else:
            if r == True :
                S.insert(0, x[2])
            else:
                S.append(x[2])
        
if r:
    print("".join(S[::-1]))
else:
    print("".join(S))
S = list(input())
Q = int(input())

r = False
for i in range(Q):
    x = input().split()
    
    if x[0] == "1":
        r = not r
        
    else:
        if x[1] == "1":
            if r == False :
                S.insert(0, x[2])
            else:
                S.append(x[2])
        else:
            if r == True :
                S.insert(0, x[2])
            else:
                S.append(x[2])
        
if r:
    print("".join(S[::-1]))
else:
    print("".join(S))
Problem p02844 (python)

Fixed submission:
N = int(input())
S = list(input())

def cal(x, a):
    for aa in a:
        if aa > x:
            return aa
    return False

li = [[] for _ in range(10)]
for i, n in enumerate(S):
    num = int(n)
    li[num].append(i)
    
cnt = 0
flag = True
for i in range(10):
    if len(li[i]) > 0:
        for j in range(10):
            if len(li[j]) > 0:
                ret = cal(li[i][0], li[j])
                if  ret == False:
                    flag = False
                else: 
                    flag = True
                for k in range(10):
                    if len(li[k]) > 0 and flag == True:
                        ret2=cal(ret, li[k]) 
                        if  ret2 != False:
                            cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input())
def cal(a, b, c):
    x = a[0]
    for bb in b:
        if bb > x:
            y = bb
            for cc in c:
                if cc > y:
                    return 1
    return 0
li = [[] for _ in range(10)]
for i, n in enumerate(S):
    num = int(n)
    li[num].append(i)
cnt = 0
for i in range(10):
    if len(li[i]) > 0:
        for j in range(10):
            if len(li[j]) > 0:
                for k in range(10):
                    if len(li[k]) > 0:
print(cnt)
Problem p02909 (python)

Fixed submission:
S  = list(input())

a = S[0]

if a =="S":
    print("Cloudy")
elif a == "C":
    print("Rainy")
else:
    print("Sunny")

Buggy submission (verdict: Runtime Error):
import heapq

N, M = tuple(map(int, input().split()))
A = list(map(lambda a: -1*int(a), input().split()))
heapq.heapify(A)

for _ in range(M):
    x = heapq.heappop(A)
    heapq.heappush(A, -(-x//2))

print(-1*sum(A))
Problem p02910 (python)

Fixed submission:
S  = list(input())

a = "Yes"
for i,s in enumerate(S):
    if i % 2 == 0:
        if s in ["R", "U", "D"]:
            pass
        else:
            a = "No"
            break
    else:
        if s in ["L", "U", "D"]:
            pass
        else:
            a = "No"
            break
            
print(a)

Buggy submission (verdict: Runtime Error):
a = "Yes"
for i,s in enumerate(S):
    if i % 2 == 0:
        if s in ["R", "U", "D"]:
            pass
        else:
            a = "No"
            break
    else:
        if s in ["L", "U", "D"]:
            pass
        else:
            a = "No"
            break
            
print(a)
Problem p02928 (python)

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

def cal(A, N):
    cnt1 = 0
    cnt2 = 0
    for i in range(N):
        for j in range(i+1,N):
            if A[N-1-j] > A[N-1-i]:
                cnt1 += 1
    for i in range(N):
        for j in range(N):
            if A[N-1-i] < A[j]:
                cnt2 += 1
    
    return int(cnt1), int(cnt2)
    
    
x, y = cal(A,N)
R = int(1*10**9 +7)
tmp = K*(K-1)//2
ans =  tmp*y + x*K
print(int(ans%R))

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

def cal(A, N):
    cnt1 = 0
    cnt2 = 0
    for i in range(N):
        for j in range(i+1,N):
            if A[N-1-j] > A[N-1-i]:
                cnt1 += 1
    for i in range(N):
        for j in range(N):
            if A[N-1-i] < A[j]:
                cnt2 += 1
    
    return int(cnt1), int(cnt2)
    
    
x, y = cal(A,N)
R = int(1*10**9 +7)
tmp = int(K*(K-1)/2)
ans =  tmp*y + x*K
print(int(ans%R))
Problem p03001 (python)

Fixed submission:
w, h, x, y = list(map(int, input().split(" ")))

if x*2 == w  and y*2 == h:
	print(w*h/2.0, "1")
else:
	print(w*h/2.0, "0")

Buggy submission (verdict: Runtime Error):
w, h, x, y = list(map(int, input().split(" ")))

if w == 0 or y == 0:
	print(0,"0")
else:
	S = w*h/2.0
	if w%x == 0 and h%y == 0:
		print(S, "1")
	else:
		print(S, "0")

Buggy submission (verdict: Runtime Error):
w, h, x, y = list(map(int, input().split(" ")))

if w == 0 and y == 0:
	print(0,"1")
else:
	S = w*h/2.0
	if w%x == 0 and h%y == 0:
		print(S, "1")
	else:
		print(S, "0")

Buggy submission (verdict: Runtime Error):
w, h, x, y = list(map(int, input().split(" ")))

if w == 0 and y == 0:
	print(0,"0")
else:
	S = w*h/2.0
	if w%x == 0 and h%y == 0:
		print(S, "1")
	else:
		print(S, "0")

Buggy submission (verdict: Runtime Error):
w, h, x, y = list(map(int, input().split(" ")))

if w%x == 0 and h%y == 0:
	print(w*h/2.0, "1")
else:
	print(w*h/2.0, "0")
Problem p03005 (python)

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

if k == 1:
  print(0)
else:
  print(n - k)

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

li = []

for _ in range(n):
    x, y = list(map(int, input().split(" ")))
    li.append([x, y])

li.sort()

def cal(li):
    n = len(li)
    Route = []
    for s in range(n-1):
        x1, y1 = li[s]
        route = {}
        for i in range(s+1,n):
            xi, yi = li[i]

            if xi != x1:
                diff = (yi - y1)/(xi - x1)
            else:
                diff = 10e10

            if diff in route.keys():
                route[diff].append([xi, yi])
            else:
                route[diff] = [[x1,y1], [xi, yi]]

        Route.extend(route.values())
    return Route

cost = 0
route = cal(li)

def check(A,B):
    for a in A:
        if a not in B:
            return False
    
    return True

def max_cal(route, li):
    n = len(li)
    l_max = 0
    max_li = []
    for r in route:
        if check(r,li):
            l = len(r)
            if l > l_max:
                 max_li = r
                 l_max = l
    return l_max, max_li

while True:
    l, cand = max_cal(route, li)
    if l == 0:
        cost += len(li)-1
        break
    else:
        route.remove(cand)
        for c in cand:
            li.remove(c)
        n -= l
        cost += 1

print(cost)
Problem p03059 (python)

Fixed submission:
A, B, T = list(map(int, input().split(" ")))

print((T//A)*B)

Buggy submission (verdict: Runtime Error):
import collections

def cal_divs(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors
  
def check(num, kouho, N, i):
  for val in kouho.keys():
    if num%val == 0:
      kouho[val] += 1
      
  return {k: v for k, v in kouho.items() if v > i-1}
  
  
N = int(input())
A= list(map(int, input().split()))
pri_flag = True

if N > 4:
  divs = []
  for i in range(3):
      divs.extend(cal_divs(A[i]))
  kouho = {}
  c = collections.Counter(divs)
  for div, n in c.most_common():
      kouho[div] = n

  kouho = {k: v for k, v in kouho.items() if v > 1}

  for i,num in enumerate(A[3:]):
    if len(kouho) == 1:
      print(1)
      pri_flag = False
      break
    kouho = check(num, kouho, N, i+3)

  if pri_flag:
      print(max(kouho))
else:
    divs = []
    kouho = {}
    for i in range(N):
        divs.extend(cal_divs(A[i]))
        c = collections.Counter(divs)
    for div, n in c.most_common():
        kouho[div] = n
    kouho = {k: v for k, v in kouho.items() if v > N-2}
    print(max(kouho))
Problem p03071 (python)

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

get_coin = 0

for _ in range(2):
  if A > B:
  	get_coin += A
  	A = A-1
  else:
    get_coin += B
    B = B-1
   
print(get_coin)

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

size = []

now = S[0]
cnt = 1

END = False

for i in range(1,N,1):
  before = now
  now = S[i]
  if now == before:
    cnt += 1
  else:
    size.append(cnt)
    cnt = 1

size.append(cnt)

if 3*K > len(size):
  print(sum(size))
  END = True

max_sum = 0
max_sum2 = 0

if  S[0] == '0':
  start = 1
else:
  start = 0
  
if END:
  pass
else:
  for i in range(start,len(size),2):
    try:
      now_sum = sum(size[i:i+3*K])
      now_sum2 = sum(size[i+1:i+1+3*(K-1)])
      if max_sum < now_sum:
          max_sum = now_sum
      if max_sum2 < now_sum2:
          max_sum2 = now_sum2
    except:
      pass
  
  if max_sum2 > max_sum:
  	print(max_sum2)
  else:
    print(max_sum)

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

li = []
size = []

now = S[0]
cnt = 1

for i in range(1,N,1):
  before = now
  now = S[i]
  if now == before:
    cnt += 1
  else:
    li.append(before)
    size.append(cnt)
    cnt = 1

li.append(now)
size.append(cnt)

if 3*K > len(size):
  print(sum(size))
  END = True

max_sum = 0

if END:
  pass
else:
  for i in range(K):
    try:
      now_sum = sum(size[i:i+3*K])
      if max_sum < now_sum:
          max_sum = now_sum
    except:
      pass

  print(max_sum)
Problem p03206 (python)

Fixed submission:

day = input()
if day == '22':
 print('Christmas Eve Eve Eve')
elif day == '23':
 print('Christmas Eve Eve')
elif day == '24':
 print('Christmas Eve')
elif day == '25':
 print('Christmas')

Buggy submission (verdict: Runtime Error):
import sys
day = sys.argv[1]
if day == '22':
 print('Christmas Eve Eve Eve')
elif day == '23':
 print('Christmas Eve Eve')
elif day == '24':
 print('Christmas Eve')
elif day == '25':
 print('Christmas')

Buggy submission (verdict: Runtime Error):
import sys 

day = sys.argv[1]
if day == '22'

 print('Christmas Eve Eve Eve')
elif day == '23'
 print('Christmas Eve Eve')
elif day == '24'
 print('Christmas Eve')
elif day == '25'
 print('Christmas')
Problem p02999 (python)

Fixed submission:
a,b = list(map(int, input().split()))
if a>=b:
  print(10)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
a,b = list(map(int, input()split()))
if a>=b:
  print(10)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
a,b = list(map(int, input()split()))
if a>=b:
  print(19)
else:
  print(0)
Problem p03210 (python)

Fixed submission:
n = int(input())

if n == 7 or n == 5 or n == 3:
  print("YES")
else:
  print("NO")

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

if n == 7 or n == 5 or n == 3:
  print("YES")
else:
  print("NO")
Problem p03238 (python)

Fixed submission:
lst = []
n = input()
if n == 1:
  print('Hello World')

else:
  for i in range(2):
    lst.append(input())
  print(lst[0] + lst[1])

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
l = map(int, raw_input().split())
n = l[0]
t = l[1]

"""
x = []
for i in range(n):
  x.append(map(int, raw_input().split()))
print(x)
"""

lst = [map(int, raw_input().split()) for i in range(n)]
#print(lst)

"""
minc = x[0]
mint = t

for j in range(n):
  if x[j][1] <= mint:
    mint = x[j][1]
    minc = x[j][0]
    #print("mint updated")
  else:
    continue

if mint < t:
  print(minc)
else:
  print("TLE")
"""

#sort_using lambda
lst = sorted(lst, key = lambda x:x[1])
#print(lst)

maxt = t
minc = 9999

for j in range(n + 10):
  if lst[j][1] <= maxt and lst[j][0] <= minc:
    minc = lst[j][0]
  else:
    break

"""
if maxt <= t:
  print(minc)
else:
  print("TLE")
"""

if minc == 9999:
  print("TLE")
else:
  print(minc)
Problem p03280 (python)

Fixed submission:
l = map(int, raw_input().split())
#print(l)

s = (l[0] - 1) * (l[1] - 1)
print(s)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 18 21:48:15 2018

@author: nakag
"""
n = int(raw_input())
print(n)
#1からNまでで因数分解を行う
ans_lst = []

import math
for j in range(1,n+1):
    I=int(j)
    s=0
    R=int(I)
    L=[]
    while s==0:
        #R=int(math.sqrt(R))
        for i in range(2,R+1):
            if I%i==0:
                I=I/i
                if I==1:
                    s=1
                L.append(i)
                break
    print(len(L))

    #素数の数に応じて場合分け
    if len(L)==1:
        if L[0]**3 == j:
            ans_lst.append(1)
    
    elif len(L)==2:
        #約数が8のときとりえる場合の積を数える
        s1 = L[0] * L[1]**3
        s2 = L[0]**3 * L[1]
        if s1 == j:
            ans_lst.append(1)
        elif s2 ==j:
            ans_lst.append(1)
    elif len(L) ==3:
        s3 = L[0] * L[1] * L[2]
        if s3 == j:
            ans_lst.append(1)
    
    print(ans_lst)
Problem p03292 (python)

Fixed submission:
lst = map(int, raw_input().split())


print(max(lst)-min(lst))

Buggy submission (verdict: Runtime Error):
lst = map(int, raw_input().split())

print(max(lst)-min(lst
Problem p03423 (python)

Fixed submission:
print(int(input())//3)

Buggy submission (verdict: Runtime Error):
print(int(input())%%3)
Problem p03455 (python)

Fixed submission:
a,b = list(map(int, input().split()))
if a*b%2 == 0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
if a*b%2 == 0:
  print("Even")
else:
  print("Odd")
Problem p03469 (python)

Fixed submission:
s = input()
print(s[:3]+"8"+s[4:])

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n = int(raw_input())
l = []
for i in range(n):
  l.append(int(raw_input()))
#print(l)

flag = [0] *100
#print(flag)
for j in l:
  if flag[j] == 0:
    flag[j] = 1
#print(flag)

num = 0
for k in flag:
#  print(k)
  if k == 1:
    num += 1
print(num)

"""
##これだとエラーでる
##flag[k]だとflag[0]かflag[1]にしかならないことに注意
num = 0
for k in flag:
  print(flag[k])
  if flag[k] == 1:
    num += 1
print(num)
"""
Problem p03470 (python)

Fixed submission:
# -*- coding: utf-8 -*-
n = int(raw_input())
l = []
for i in range(n):
  l.append(int(raw_input()))
#print(l)

flag = [0] *110
#print(flag)
for j in l:
  if flag[j] == 0:
    flag[j] = 1
#print(flag)

num = 0
for k in flag:
#  print(k)
  if k == 1:
    num += 1
print(num)

"""
##これだとエラーでる
##flag[k]だとflag[0]かflag[1]にしかならないことに注意
num = 0
for k in flag:
  print(flag[k])
  if flag[k] == 1:
    num += 1
print(num)
"""

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n = int(raw_input())
l = []
for i in range(n):
  l.append(int(raw_input()))
#print(l)

flag = [0] *100
#print(flag)
for j in l:
  if flag[j] == 0:
    flag[j] = 1
#print(flag)

num = 0
for k in flag:
#  print(k)
  if k == 1:
    num += 1
print(num)

"""
##これだとエラーでる
##flag[k]だとflag[0]かflag[1]にしかならないことに注意
num = 0
for k in flag:
  print(flag[k])
  if flag[k] == 1:
    num += 1
print(num)
"""
Problem p03485 (python)

Fixed submission:
a, b = list(map(int, input().split()))
import math
ans = math.ceil((a+b)/2)
print(ans)
"""
if a != b:
  print(int((a+b)/2) + 1)
else:
  print(a)
"""

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

print(int((a+b)/2) + 1)
Problem p03501 (python)

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

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

Fixed submission:
x,y = input().split()
if ord(x) < ord(y):
  print("<")
elif ord(x) > ord(y):
  print(">")
else:
  print("=")

Buggy submission (verdict: Runtime Error):
x,y = list(map(int, input().split()))
if ord(x) < ord(y):
  print("<")
elif ord(x) > ord(y):
  print(">")
else:
  print("=")
Problem p03624 (python)

Fixed submission:
s = raw_input()
#print(s)

ch_lst = "abcdefghijklmnopqrstqvwxyz"
#ch_lst = [chr(i) for i in range(ord('a'), ord('z')+1)]
#print(ch_lst)

match = 0
for j in ch_lst:
  ch = s.find(j)
  if ch != -1:
    continue
  else:
    match = 1
    break

if match == 0:
  print("None")
elif match == 1:
  print(j)

Buggy submission (verdict: Runtime Error):
"""
a = "kanji"
for i in a:
  print(i)
"""

s = raw_input()
print(s)

ch_lst = "abcdefghijklmnopqrstqvwxyz"
#ch_lst = [chr(i) for i in range(ord('a'), ord('z')+1)]
print(ch_lst)

match = 0
for j in ch_lst:
  ch = s.find(j)
  if ch != -1:
    #print(ch)
  else:
    match = 1
    break

if match == 0:
  print("none")
elif match == 1:
  print(j)
Problem p03773 (python)

Fixed submission:
a,b = list(map(int, input().split()))
print((a+b)%24)

Buggy submission (verdict: Runtime Error):
a,b = list(map(int, input().split()))
print(mod(a+b))
Problem p03777 (python)

Fixed submission:
a,b = list(input().split())
if a == "H" and b == "H":
    print("H")
elif a == "D" and b == "D":
    print("H")
else:
    print("D")

Buggy submission (verdict: Runtime Error):
a,b = list(map(input().split()))
if a == "H" and b == "H":
    print("H")
elif a == "D" and b == "D":
    print("H")
else:
    print("D")

Buggy submission (verdict: Runtime Error):
a,b = list(map(int, input().split()))
if a == "H" and b == "H":
    print("H")
elif a == "D" and b == "D":
    print("H")
else:
    print("D")
Problem p02744 (python)

Fixed submission:
N=int(input())
A=["a"]
S="abcdefghijklmn"
for i in range(N-1):
    B=[]
    for a in A:
        for s in S[:len(set(a))+1]:
            B.append(a+s)
    A=B[::]
print("\n".join(A))

Buggy submission (verdict: Runtime Error):
N=int(input())
A=["a"]
S="abcdefghijklmn"
for i in range(N-1):
    B=[]
    for a in A:
        for s in S[:len(set(a))+1]:
            B.append(a+s)
print("\n".join(B))
Problem p02787 (python)

Fixed submission:
H,N=map(int,input().split())
ab=[list(map(int,input().split())) for _ in range(N)]
x=max(a for a,b in ab)
dp=[0]*(H+x)
for i in range (1,H+x):
    dp[i]=min(dp[i-a]+b for a,b in ab)
print(min(dp[H:]))

Buggy submission (verdict: Runtime Error):
H,N=map(int,input().split())
ab=[list(map(int,input().split())) for _ in range(N)]
mxa=max(a for a,b in ab)
dp=[0]*(N+mxa)
for i in range (N+mxa):
    dp[i]=min(dp[i-a]+b for a,b in ab)
print(min(dp[H:]))
Problem p02843 (python)

Fixed submission:
X=int(input())
d,m=divmod(X,100)
print(1 if m<=(d*5) else 0)

Buggy submission (verdict: Runtime Error):
X=int(input())
N=X//100
M=X%100
A=[0,1,2,3,4,5]
dp=[[0]*(M+1) for i in range(N+1)]
dp[0][0]=1
for i in range(N):
    for k in range(M+1):
        dp[i+1][k]|=dp[i][k]
        if k>=A[i]:
            dp[i+1][k]|=dp[i][k-A[i]]
print(dp[N][M])
Problem p02995 (python)

Fixed submission:
from fractions import gcd
A,B,C,D=map(int,input().split())
A-=1
S=B-B//C-B//D+B//((C*D)//gcd(C,D))
T=A-A//C-A//D+A//((C*D)//gcd(C,D))
print(S-T)

Buggy submission (verdict: Runtime Error):
from math import gcd
A,B,C,D=map(int,input().split())
A-=1
S=B-B//C-B//D+B//((C*D)//gcd(C,D))
T=A-A//C-A//D+A//((C*D)//gcd(C,D))
print(S-T)
Problem p03076 (python)

Fixed submission:
S=[int(input()) for _ in range(5)]
T=[]
for i in range(5):
    T.append((10-S[i])%10)
print(sum(S)+sum(T)-max(T))

Buggy submission (verdict: Runtime Error):
S=[int(input()) for _ in range(5)]
T=[]
for i in range(5):
    if S[i]%10!=0:
        T.append(10-S[i]%10)
print(sum(S)+sum(T)-max(T))