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

Fixed submission:
N,K = map(int,input().split())
D = set(map(int,input().split()))
ans = N
while(True):
  if any([i in D for i in list(map(int,str(ans)))]):
    ans += 1
  else:
    print(ans)
    break

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
D = set(map(int,input().split()))
ans = N
while(True):
  if any(i in D for i in list(map(str,ans))):
    ans += 1
  else:
    print(ans)
    break
Problem p02684 (python)

Fixed submission:
N, K= [int(i) for i in input().split()]
An = [int(i) for i in input().split()]

i = 0
checked = [0 for _ in range(N)]
c = 0
while checked[i] == 0:
  c += 1
  checked[i] = c
  i = An[i] - 1
if checked[i] >= K:
  i = 0
  for k in range(K):
    i = An[i] - 1
  print(i + 1)
else:
  period = c - checked[i] + 1
  diff = K - checked[i] + 1
  mod_diff = diff % period
  for k in range(mod_diff):
    i = An[i] - 1
  print(i + 1)

Buggy submission (verdict: Runtime Error):
N, K= [int(i) for i in input().split()]
An = [int(i) for i in input().split()]

i = 0
checked = [0 for _ in range(N)]
c = 0
while checked[i] == 0:
  c += 1
  checked[i] = c
  i = An[i] - 1
if checked[i] >= K:
  i = 0
  for k in range(mod_K):
    i = An[i] - 1
  print(i + 1)
else:
  period = c - checked[i] + 1
  diff = K - checked[i] + 1
  mod_diff = diff % period
  for k in range(mod_diff):
    i = An[i] - 1
  print(i + 1)
Problem p02681 (python)

Fixed submission:
s=input()
t=input()
n=0
for i in range(0,len(s)):
    if(s[i]==t[i]):
        n=n+1
if(n==len(s)):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
n=0
for i in range(0,len(s)):
	if(s[i]==t[i]):
    	n=n+1
if(n==len(s)):
  print("Yes")
else:
  print("No")
Problem p02694 (python)

Fixed submission:
n=int(input())
money=100
year=0
while(money<n):
  year=year+1
  money=int(money*1.01)
print(year)

Buggy submission (verdict: Runtime Error):
n=int(input())
money=100
year=0
while(money<n){
  year=year+1
  money=money*1.01
}
print(year)
Problem p02706 (python)

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
if n-sum(a)<0:
    print(-1)
else:
    print(n-sum(a))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
if n-sum(a)<=0:
  print(-1)
else print(n-sum(a))
Problem p02713 (python)

Fixed submission:
from math import gcd
k=int(input())
ans=0
for i in range(1,k+1):
  for j in range(1,k+1):
    for l in range(1,k+1):
      ans=ans+gcd(gcd(i,j),l)
print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
k=int(input())
ans=0
for i in range(1,k+1):
  for j in range(1,k+1):
    for l in range(1,k+1):
        a=(i,j,l)
        if len(a)==1:
            ans=ans+i
        elif len(a)==2:
            ans=ans+fractions.gcd(a[0],a[1])
        else:
            ans=ans+fractions.gcd(a[0],fractions.gcd(a[1],a[2]))
print(ans)
Problem p02755 (python)

Fixed submission:
a,b=map(int,input().split())
price=10*b
c=[]  
while(price<10*b+10):
  if int(price*0.08)==a:
    c.append(price)
    price=price+1
  else:
    price=price+1
if c==[]:
  print(-1)
else:
  print(min(c))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
price=10*b
c=[]  
while(price<=10*b+10):
  if int(price*0.08)==a:
    c.append(a)
    price=price+1
  else:
    price=price+1
if c=[]:
  print(-1)
else:
  print(min(c))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
price=10*b
c=[]  
while(price<=10*b+10):
  if int(price*0.08)==a:
    c.append(a)
  else:
    price=price+1
if c=[]:
  print(-1)
else:
  print(min(c))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
price=10*b
c=[]  
while(price<=10*b+10):
  if int(price*0.08)==a:
    c.append(a)
  else:
    price=price+1
print(min(c))
Problem p02957 (python)

Fixed submission:
a,b=map(int,input().split())
if (a+b)%2==0:
    print ((a+b)//2)
else:
    print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
a,b=map(int,input())
if (a+b)%2==0:
  print (a+b)/2
else:
  print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
a,b=map(int,input())
if (a+b)//2==0:
  print (a+b)/2
else:
  print('IMPOSSIBLE')
Problem p02994 (python)

Fixed submission:
n,l=map(int,input().split())
a=[]
for i in range(0,n):
  a.append(i+l)
if 0 in a:
  print(sum(a))
else:
  if a[0]>0:
    print(sum(a)-a[0])
  else:
    print(sum(a)-a[n-1])

Buggy submission (verdict: Runtime Error):
n,l=map(int,input().split())
a=[]
for i in range(0,n):
  a.append(i+l)
if 0 in a:
  print(sum(a))
else:
  if a[0]>0:
    print(sum(a)-a[0])
  else:
    print(sum(a)-a[n])
Problem p03030 (python)

Fixed submission:
number=int(input())
book=[]
for i in range(0,number):
  book.append(input().split())
for i in range(0,len(book)):
    book[i][1]=int(book[i][1])
    book[i].append(i+1)
book1=sorted(book,key=lambda x: -x[1])
book2=sorted(book1,key=lambda x: x[0])
for i in range(0,len(book2)):
  print(book2[i][2])

Buggy submission (verdict: Runtime Error):
number=int(input())
book=[]
for i in range(0,number):
  book.append((input().split()).append(i+1))
book1=list.sort(book,key=lambda x: x[1],reverse=True)
book2=book2.sort()
for i in range(0,len(book2)):
  print(book[i][2],'\n')
Problem p03047 (python)

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

Buggy submission (verdict: Runtime Error):
n,k=map(input().split())
print(n-k+1)
Problem p03080 (python)

Fixed submission:
n=int(input())
s=input()
b=0
r=0
for i in range(0,n):
  if s[i]=='B':
    b=b+1
  else:
    r=r+1
if r>b:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
b=0
r=0
for i in range(0,n):
  if s[0][i]==B:
    b=b+1
  else:
    r=r+1
if r>b:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
b=0
r=0
for i in range(0,n):
  if s[i]==B:
    b=b+1
  else:
    r=r+1
if r>b:
  print('Yes')
else:
  print('No')
Problem p03103 (python)

Fixed submission:
n,m=map(int,input().split())
a=[]
for i in range(0,n):
    b,c=map(int,input().split())
    a.append([b,c])
a.sort()
number=0
for i in range(0,len(a)):
    if number<m:
        number=number+a[i][1]
        l=i
answer=0
kosu=0
for k in range(0,l):
    answer=answer+a[k][0]*a[k][1]
    kosu=kosu+a[k][1]
answer=answer+a[l][0]*(m-kosu)
print(answer)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[]
for i in range(0,n):
    b,c=map(int,input().split())
    a.append([b,c])
a.sort()
number=0
for i in range(0,len(a)):
    while number<m:
        number=number+a[i][1]
        l=i
print(l)
answer=0
kosu=0
for k in range(0,l+1):
    answer=answer+a[k][0]*a[k][1]
    kosu=kosu+a[k][1]
print(answer)
answer=answer+a[l+1][0]*(m-kosu)
print(answer)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[]
for i in range(0,n):
  b,c=map(int.input().split())
  a.append[b,c]
a.sort()
number=0
for i in range(0,len(a)):
  while number<m:
    number=number+a[i][1]
    l=i
answer=0
kosu=0
for k in range(0,l-1):
  answer=answer+a[k][0]*a[k][1]
  kosu=kosu+a[k][1]
answer=answer+a[l][0]*(m-kosu)
print(answer)
Problem p03424 (python)

Fixed submission:
n=int(input())
a=input().split()
if 'Y' in a:
  print('Four')
else:
  print('Three')

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[]
for i in range(0,n):
  a.append(input().split())
if 'Y' in a:
  print('Four')
else:
  print('Three')
Problem p03777 (python)

Fixed submission:
a,b=map(str,input().split())
if a=='H':
  print(b)
else:
  if b=='H':
    print('D')
  else:
    print('H')

Buggy submission (verdict: Runtime Error):
a,b=input(str,input().split())
if a=='H':
  print(b)
else:
  if b=='H':
    print('D')
  else:
    print('H')
Problem p02687 (python)

Fixed submission:
s = input()
if s[1] == "B":
    print("ARC")
else:
    print("ABC")

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

if S == "ABC":
    print("ARC")
if s == "ARC":
    print("ARC")
Problem p02765 (python)

Fixed submission:
n, r = map(int, input().split())
if n >= 10:
    print(r)
else:
    print(r + 100 * (10 - n))

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if (a == b and b != c) or (b == c and c != a) or (c == a and a != b):
    print('Yes')
else:
    print('No')
Problem p02717 (python)

Fixed submission:

import sys, io, os
input = sys.stdin.readline
inputt = lambda: range(int(input()))
inputn = lambda n = 1: range(n)
inputi = lambda: map(int, input().split())
inputl = lambda: list(inputi())
from math import *
from heapq import *
from bisect import *
from functools import reduce, lru_cache
from collections import Counter, defaultdict
from builtins import *

a, b, c = inputi()
print(c, a, b)

Buggy submission (verdict: Runtime Error):

import sys, io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
inputt = lambda: range(int(input()))
inputn = lambda n = 1: range(n)
inputi = lambda: map(int, input().split())
inputl = lambda: list(inputi())
from math import *
from heapq import *
from bisect import *
from functools import reduce, lru_cache
from collections import Counter, defaultdict
from builtins import *

a, b, c = inputi()
print(c, a, b)

Buggy submission (verdict: Runtime Error):

import sys, io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
inputt = lambda: range(int(input()))
inputn = lambda n = 1: range(n)
inputi = lambda: map(int, input().split())
inputl = lambda: list(inputi())
from math import *
from heapq import *
from bisect import *
from functools import reduce, lru_cache
from collections import Counter, defaultdict
from builtins import *

a, b, c = inputi()
print(c, a, b)
Problem p02687 (python)

Fixed submission:
import math
from sys import stdin,stdout
#% 998244353
T = stdin.readline()
T=T[:-1]
if T=="ABC":
    print("ARC")
elif T=="ARC":
    print("ABC")

Buggy submission (verdict: Runtime Error):
import math
from sys import stdin,stdout
#% 998244353
from heapq import heapify,heappop,heappush

import collections
# T = int(stdin.readline())
# for i in range(T):
    #N=int(stdin.readline())
N,M=list(map(int,stdin.readline().split()))
hill=list(map(int,stdin.readline().split()))

dc=collections.defaultdict(list)
#vis=set()
for m in range(M):
    A,B=list(map(int,stdin.readline().split()))
    dc[A].append(B)
    dc[B].append(A)

ans=0
for k,ls in dc.items():

    f=0
    z=0
    for h in ls:

        if hill[k-1]<=hill[h-1]:
            f=1
            break

    if not f:
      #  print(k)
        ans+=1  
#print(ans)
#ans+=(N-len(dc.keys()))
print(ans)

Buggy submission (verdict: Runtime Error):
import math
from sys import stdin,stdout
#% 998244353
from heapq import heapify,heappop,heappush

import collections
# T = int(stdin.readline())
# for i in range(T):
    #N=int(stdin.readline())
N,M=list(map(int,stdin.readline().split()))
hill=list(map(int,stdin.readline().split()))

dc=collections.defaultdict(list)
#vis=set()
for m in range(M):
    A,B=list(map(int,stdin.readline().split()))
    dc[A].append(B)
    dc[B].append(A)

ans=0
for k,ls in dc.items():

    f=0
    for h in ls:
        if ls.count(h)>1:
            continue
        if hill[k-1]<hill[h-1]:
            f=1
            break
    if not f:
        ans+=1  

ans+=N-len(dc.keys())
print(ans)
Problem p03448 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0

for ia in range(a+1):
    for jb in range(b+1):
        for kc in range(c+1):
            if(0 == (x - (ia*500 + jb*100 + kc*50))):
                count += 1

print(count)

Buggy submission (verdict: Runtime Error):
line = input().split(" ")
a = int(line[0])
b = int(line[1])
c = int(line[2])
x = int(input())
count = 0

for ia in range(a+1):
    for jb in range(b+1):
        for kc in range(c+1):
            if(0 == (x - (ia*500 + jb*100 + kc*50))):
                count += 1

print(count)
Problem p03494 (python)

Fixed submission:
n = int(input())
a = input().split(" ")
count = 0

for i in range(100):
    for j in range(len(a)):
        if(int(a[j]) % 2 != 0):
            break
        else:
            a[j] = int(a[j]) / 2
            count += 1
    else:
        continue
    break

print(count // len(a))

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

for i in range(100):
    for j in range(len(a)):
        if(int(a[j]) % 2 != 0):
            break
        else:
            a[j] = int(a[j]) / 2
            count += 1
    else:
        continue
    break

print(count // len(a))
Problem p04030 (python)

Fixed submission:
line = input()
str = list(line)
ans = []
c = 0

for i in str:
    if (i == "1") or (i == "0"):
        ans.append(i)
    elif i == "B":
        if c != 0:
            c -= 1
            del ans[c]
        c -= 1
    c += 1

for i in ans:
    print("".join(i), end = '')

Buggy submission (verdict: Runtime Error):
line = input()
str = list(line)
ans = []
c = 0

for i in str:
    if (i == "1") or (i == "0"):
        ans.append(i)
    elif i == "B":
        if c != 0:
            c -= 1
            del ans[c]
            c -= 1
    c += 1

for i in ans:
    print("".join(i), end = '')
Problem p03061 (python)

Fixed submission:
# -*- coding: utf-8 -*-
from fractions import gcd

N = int(input())
A = list(map(int, input().split()))

if N == 2:
    print(max(A))
else:
    ans = gcd(A[0], A[1])
    ans2 = max(gcd(A[0], A[2]), gcd(A[1], A[2]))
    for a in A[2:]:
        ans2 = max(gcd(a, ans2), ans)
        ans = gcd(a, ans)
    
    print(ans2)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
#from fractions import gcd
from math import gcd

N = int(input())
A = list(map(int, input().split()))

if N == 2:
    print(max(A))
else:
    ans = gcd(A[0], A[1])
    ans2 = max(gcd(A[0], A[2]), gcd(A[1], A[2]))
    for a in A[2:]:
        ans2 = max(gcd(a, ans2), ans)
        ans = gcd(a, ans)
    
    print(ans2)
Problem p03109 (python)

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

a = input().split("/")

if int(a[1])<5:
    print("Heisei")
else:
    print("TBD")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

a = input().split("/")

201if int(a[1])<5:
    print("Heisei")
else:
    print("TBD")
Problem p02681 (python)

Fixed submission:
import numpy as np 
import math

S = str(input())
T = str(input())

n = len(S)
m = len(T)
if (T[0:n] == S) and (m==n+1):
    print("Yes")
else:
    print("No")

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

S = str(input())
T = str(input())

n = len(S)
if T[0:n] == S:
    print("Yes")
else:
    print("No")
Problem p02684 (python)

Fixed submission:
import numpy as np 
from sys import stdin, setrecursionlimit
 
setrecursionlimit(10 ** 9)

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

t = 1
tpass = [1]
k = 0
j = 1
temp3 = [0]*N
for i in range(N):
    temp = A[t-1] 
    if i == K-1:
        print(temp)
        exit()
    if temp3[temp-1] != 0 :
        idx = tpass.index(temp)
        l = len(tpass)
        j = -1
        break
    else:
        
        t = temp
        temp3[t-1] = 1
        tpass.append(temp)
        k += 1

try:
    a = K - k
    loop = l - idx
    b = a % loop 
    temp2 = tpass[idx:]
    ans = temp2[b-1]
    print(ans)
except:
    pass

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

t = 1
tpass = [1]
k = 0
for i in range(K):
    temp = A[t-1] 
    if temp in tpass:
        idx = tpass.index(temp)
        l = len(tpass)
        break
    else:
        t = temp
        tpass.append(temp)
        k += 1

a = K - k
loop = l - idx
b = a % loop 


temp2 = tpass[idx:]

ans = temp2[b-1]

print(ans)
Problem p02705 (python)

Fixed submission:
import math

r = int(input())
s = 2.0 * r * math.pi

print(s)

Buggy submission (verdict: Runtime Error):
r = input()

s = 2.0*3.14159265*r

print(s)

Buggy submission (verdict: Runtime Error):
import math


R = input()
s = 2.0*math.pi*R

print(s)
Problem p03485 (python)

Fixed submission:
a, b = map(int, input().split())
ave = (a + b) / 2

if ave - int(ave) > 0:
    ave = int(ave) + 1
else:
    ave = int(ave)

print(ave)

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

if ave - int(ave) > 0:
    ave = int(ave) + 1
else
    ave = int(ave)

print(ave)
Problem p03815 (python)

Fixed submission:
x = int(input())

quotient = x // 11
remainder = x % 11

Answer = quotient * 2
if remainder > 6:
    Answer += 2
elif remainder > 0:
    Answer += 1
else:
    Answer += 0

print(Answer)

Buggy submission (verdict: Runtime Error):
x = long(input())

quotient = x // 11
remainder = x % 11

Answer = quotient * 2
if remainder > 6:
    Answer += 2
else:
    Answer += 1

print(Answer)
Problem p03471 (python)

Fixed submission:
import math
import sys
input = sys.stdin.readline


N,Y = map(int, input().split())
flag=0
for i in range(0,N+1):
    for j in range(0,N+1-i):
        if(Y-10000*i-5000*j)/1000 == N-i-j :
            a = i
            b = j
            c = N-i-j
            flag =1
            break
        if flag==1:
            break

if flag==1:
    print(a,b,c)

if flag!=1:
    print("-1 -1 -1")

Buggy submission (verdict: Runtime Error):
import math
import sys
input = sys.stdin.readline


N,Y = map(int, input().split())
flag=0
for i in range(0,N+1):
    for j in range(0,N-i):
        if(Y-10000*i-5000*j)/1000 == N-i-j :
            a = i
            b = j
            c = N-i-j
            flag =1
            break
        if flag==1:
            break
print(a,b,c)

if flag!=1:
    print("-1 -1 -1")
Problem p02687 (python)

Fixed submission:
s = input()
if s == 'ABC':
    ans = 'ARC'
else:
    ans = 'ABC'

print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
if s == 'ABC':
    ans = 'ARC'
else:
    anse = 'ABC'

print(ans)
Problem p02681 (python)

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

if T.startswith(S):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
S=input()
T=input()

if T.startswith(S):
    print(Yes)
else:
    print(No)
Problem p03472 (python)

Fixed submission:
import math
N,M=(int(x) for x in input().split())
a=[0]*(N)
b=[0]*(N)
c=0
v=0
for i in range(N):
    A,B=(int(x) for x in input().split())
    a[i]=A
    b[i]=B
#print(a,b)
v = max(a)
#ソート開始
b.sort(reverse=True)
#ソート終了
#print(i,b[i],v,M,N)
i=0
for i in b:
    if i>=v:
        c+=1
        M-=i
    else:break
    if M <= 0:
        break
if M>0:
    c+=math.ceil(M/v)
print(c)

Buggy submission (verdict: Runtime Error):
import math
N,M=(int(x) for x in input().split())
a=[0]*(N+1)
b=[0]*(N+1)
c=0
v=0
i=0

for i in range(N):
    A,B=(int(x) for x in input().split())
    a[i]=A
    b[i]=B
v = max(a)
#ソート開始
b.sort(reverse=True)
#ソート終了
#print(i,b[i],v,M,N)
i=0
for i in B:
    if i>=v:
        c+=1
        M-=i
    else:break
if M>0
    c+=math.ceil(M/v)
print(c)
Problem p02789 (python)

Fixed submission:
n, m = map(lambda x: int(x), input().split())

if n == m:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
def function(p, i):
  a = p[i]
  amin = min(p[:i+1])
  if amin == a:
    return 1
  else:
    return 0
 
n = int(input())
p = list(map(lambda x: int(x), input().split()))
sums = sum([function(p,i) for i in range(n)])
print(sums)
Problem p03337 (python)

Fixed submission:
a, b = map(lambda x: int(x), input().split())

lis = [a+b, a-b, a*b]
print(max(lis))

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

lis = [a+b, a-b, a*c]
print(max(lis))
Problem p03501 (python)

Fixed submission:
n, a, b = map(lambda x: int(x), input().split())

if n*a < b:
  print(n*a)
else:
  print(b)

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

if n*a < b:
  print(n*a)
else:
  print(b)
Problem p03555 (python)

Fixed submission:
c1 = input()
c2 = input()

if c1 == c2[2]+c2[1]+c2[0]:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
c1 = input()
c2 = input()

if c1 == c[2]+c[1]+c[0]:
  print('YES')
else:
  print('NO')
Problem p03605 (python)

Fixed submission:
n = input()
n1 = int(n[0])
n2 = int(n[1])

if n1 == 9 or n2 == 9:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n1, n2 = map(lambda x: int(x), input().split())

if n1 == 9 or n2 == 9:
  print('Yes')
else:
  print('No')
Problem p03679 (python)

Fixed submission:
x, a, b  = map(lambda x: int(x),  input().split())
 
if b <= a:
  print('delicious')
elif x >= b - a:
  print('safe')
else:
  print('dangerous')

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

if b =< a:
  print('delicious')
elif x <= b - a:
  print('safe')
else:
  print('dangerous')
Problem p03777 (python)

Fixed submission:
a, b = input().split()

if a == 'H':
  if b == 'H':
    print('H')
  else:
    print('D')
else:
  if b == 'H':
    print('D')
  else:
    print('H')

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

if a = 'H':
  if b = 'H':
    print('H')
  else:
    print('D')
else:
  if b = 'H':
    print('D')
  else:
    print('H')
Problem p03826 (python)

Fixed submission:
a,b,c,d = map(lambda x: int(x), input().split())

if a*b <= c*d:
  print(c*d)
else:
  print(a*b)

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(lambda x: x, input().split())

if a*b <= c*d:
  print(c*d)
else:
  print(a*b)
Problem p03844 (python)

Fixed submission:
a, op, b = input().split()
a = int(a)
b = int(b)
if op == '+':
  print(int(a + b))
else:
  print(int(a - b))

Buggy submission (verdict: Runtime Error):
a, op, b = input.split()
a = int(a)
b = int(b)
if op == '+':
  print(int(a + b))
else:
  print(int(a - b))
Problem p04012 (python)

Fixed submission:
s = input()
s_list = [s[_] for _ in range(len(s))]

dic = dict()
for c in s_list:
  if c in dic:
    dic[c] += 1
  else:
    dic[c] = 1

flg = True
for key in dic:
  if dic[key]%2 != 0:
    flg = False
    break
    
if flg:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s = input()
s_list = [s[_] for _ in range(len(s))]

dic = dict()
for c in s_list:
  if c in dic:
    dic[c] += 1
  else:
    dic[c] = 1

flg = True
for key in dic:
  if dic[key]%2 !- 0:
    flg = False
    break
    
if flg:
  print('Yes')
else:
  print('No')
Problem p03309 (python)

Fixed submission:
def m():
    n = int(input())
    a = list(map(int, input().split()))
    ans = 0
    B = [a[i-1]-i for i in range(1, n+1)]
    B.sort()
    b = B[n//2]
    for i in range(n):
        ans += abs(B[i]-b)
    return ans

print(m())

Buggy submission (verdict: Runtime Error):
fun main(args : Array<String>) {
    val N = readLine()!!.toInt()
    val A = readLine()!!.split(" ").map { it.toInt() }
    val B = (1..N).map {
        val index = it - 1
        A.get(index) - it
    }.toMutableList()
    B.sort()

    val median = B.get(N / 2)
    val answer = B.map { Math.abs(it - median) }.sum()

    println(answer)
}

Buggy submission (verdict: Runtime Error):
fun main(args : Array<String>) {
    val N = readLine()!!.toInt()
    val A = readLine()!!.split(" ").map { it.toInt() }
    val B = (1..N).map {
        val index = it - 1
        A.get(index) - it
    }.sorted()

    val median = B.get(N / 2)

    val answer = B.map { Math.abs(it - median) }.sum()

    print(answer)
}