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

Fixed submission:
import sys

def add_char(l, string):
    for s in string:
        l.append(s)

n = int(sys.stdin.readline().strip())
common_list = []

for i in range(n):
    s = sys.stdin.readline().strip()
    if i == 0:
        add_char(common_list, s)
    else:
        tmp = []
        add_char(tmp, s)
        tmp_c = list(common_list)
        for c in tmp_c:
            if c in tmp:
                tmp.remove(c)
            else:
                common_list.remove(c)
if len(common_list) == 0:
    print("")
else:
    common_list = sorted(common_list)
    s = ""
    for c in common_list:
        s += c
    print(s)

Buggy submission (verdict: Runtime Error):
import sys

def add_char(l, string):
    for s in string:
        l.append(s)

n = int(sys.stdin.readline().strip())
common_list = []

for i in range(n):
    s = sys.stdin.readline().strip()
    if i == 0:
        add_char(common_list, s)
    else:
        tmp = []
        add_char(tmp, s)
        for c in common_list:
            if c in tmp:
                tmp.pop(c)
            else:
                common_list.pop(c)
if len(common_list) == 0:
    print("")
else:
    common_list = sorted(common_list)
    s = ""
    for c in common_list:
        s += c
    print(s)
Problem p03889 (python)

Fixed submission:
import sys

dct = {"b": "d", "d": "b", "p": "q", "q": "p"}
S = sys.stdin.readline().strip()
rev = ""
for s in S[::-1]:
    rev += dct[s]

if rev == S:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import sys

dct = {"b": "d", "d", "b", "p": "q", "q": "p"}
S = sys.stdin.readline().strip()
rev = ""
for s in S[::-1]:
    rev += dct[s]

if rev == S:
    print("Yes")
else:
    print("No")
Problem p03469 (python)

Fixed submission:
s = input()

print(s[0:3] + '8' + s[4:])

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

n, y = [int(x) for x in input().split(' ')]

sen = y//1000

target = sen - n

if target < 0:
    print('-1 -1 -1')
else:
    iti_man = target % 4
    go_sen = target // 4 - iti_man * 2
    sen = sen - iti_man * 10 - go_sen * 5
    if sen > -1 and go_sen > -1 and iti_man > -1 :
        print('{} {} {}'.format(iti_man, go_sen, sen))
    else:
        print("-1 -1 -1")
Problem p03471 (python)

Fixed submission:
# coding:utf-8

n, y = [int(x) for x in input().split(' ')]

max_iti_man = y // 10000

for iti_man in range(max_iti_man + 1):
    for go_sen in range(int(n) - iti_man + 1):
        itigo = 5000 * go_sen + 10000 * iti_man
        sen = n - iti_man - go_sen
        if 1000 * sen + itigo == y:
            print("{} {} {}".format(iti_man,go_sen,sen))
            exit()

print("-1 -1 -1")

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

n, y = [int(x) for x in input().split(' ')]

sen = y//1000

target = sen - n

if target < 0:
    print('-1 -1 -1')
else:
    if target % 9 % 4:
        print('-1 -1 -1')
    else:
    　iti_man = target // 9
    　go_sen = target % 9 // 4
        sen = sen - iti_man*10 - go_sen*5
        print('{} {} {}'.format(iti_man, go_sen, sen))

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

n, y = [int(x) for x in input().split(' ')]

# 1000円札なら何枚か
sen = y//1000

# 減らさなきゃいけない枚数
# 1万円札なら9枚，5千円札なら4枚減る
target = sen - n

if target < 0:
    print('-1 -1 -1')
else:
    iti_man = target // 9
    go_sen = target % 9 // 4

    if target % 9 % 4:
        print('-1 -1 -1')
    else:
        sen = sen - iti_man*10 - go_sen*5
        print('{} {} {}'.format(iti_man, go_sen, sen))
Collapse

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

n, y = [int(x) for x in input().split(' ')]

# 1000円札なら何枚か
sen = y//1000

# 減らさなきゃいけない枚数
# 1万円札なら9枚，5千円札なら4枚減る
target = sen - n

if target < 0:
    print('-1 -1 -1')
else:
    iti_man = target // 9
    go_sen = target % 9 // 4

    if target % 9 % 4:
        print('-1 -1 -1')
    else:
        sen = sen - iti_man*10 - go_sen*5
        print('{} {} {}'.format(iti_man, go_sen, sen))
Collapse
Problem p03032 (python)

Fixed submission:
N, K = [int(x) for x in input().split(" ")]
D = [int(x) for x in input().split(" ")]

combs = []
lim = min(N, K)
for a in range(0, lim + 1):
    for b in range(0, lim - a + 1):
          combs.append((a, b))

maxres = 0
for a,b in combs:
    elems = sorted(D[:a] + D[N-b:])
    negative = len([e for e in elems if e < 0])
    drop = min(negative, max(0, K - a - b))
    res = sum(elems[drop:])
    maxres = max(maxres, res)
print(maxres)

Buggy submission (verdict: Runtime Error):
N, K = [int(x) for x in input().split(" ")]
D = [int(x) for x in input().split(" ")]
i = 0
j = len(D) - 1
memo = dict()

hands = set()

steps = 0

def maxSum(d, hands, k):
    if k == 0:
        return 0

    key = f"{str(d)}::{str(hands)}::{k}"
    if key in memo:
        return memo[key]
    
    patterns = [sum(hands)]

    if len(d) > 0:
        el = d[0]
        patterns.append(d[0] + maxSum(d[1:], hands.union(set([el])), k - 1))
        if len(d) > 1:
            el = d[-1]
            patterns.append(d[-1] + maxSum(d[:-1], hands.union(set([el])), k - 1))

    if hands:
        m = min(hands)
        newHand = hands.difference(set([m]))
        patterns.append(maxSum([m] + d, newHand, k - 1) - m)
        patterns.append(maxSum(d + [m], newHand, k - 1) - m)

    res = max(patterns)
    return res
        

print(maxSum(D, set(), K))
Problem p03544 (python)

Fixed submission:
n = int(input())
l1 = 2
l2 = 1
for i in range(1, n):
    l3 = l1 + l2
    l1 = l2
    l2 = l3
print(l2)

Buggy submission (verdict: Runtime Error):
n = int(input())
l1 = 2
l2 = 1
for i in range(1, n):
    l3 = l1 + l2
    l1 = l2
    l2 = l3
print(l3)
Problem p02934 (python)

Fixed submission:
import numpy as np

def main():
    inputs = [input() for _ in range(2)]
    numbers = np.array([float(i) for i in inputs[1].split(' ')])
    numbers = np.reciprocal(numbers)
    answer = 1 / sum(numbers)
    print(answer)

if __name__ == '__main__':
    main()

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

def main():
    inputs = [input() for _ in range(2)]
    numbers = np.array([float(i) for i in inputs[1].split('\s')])
    numbers = np.reciprocal(numbers)
    answer = 1 / sum(numbers)
    print(answer)

if __name__ == '__main__':
    main()
Problem p03136 (python)

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

max_ = list_L.pop(list_L.index(max(list_L)))

if max_ >= sum(list_L):
    print("No")
else:
    print("Yes")

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

max_ = list_L.pop(list_L.index(max(list_L)))

if max_ > sum(list_L):
    print("Yes")
else:
    print("No")
Problem p02898 (python)

Fixed submission:
n,k = [int(i) for i in input().split()]
l = [int(i) for i in input().split()]
print(len([i for i in l if i>=k]))

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
l = [ i for i in input().split() if i>m]
print(len(l))
Problem p02909 (python)

Fixed submission:
n=input()
L=["Sunny","Cloudy","Rainy"]
if n == L[2]:
  print(L[0])
else:
  print(L[L.index(n)+1])

Buggy submission (verdict: Runtime Error):
n,k,q=map(int,input().split())
L= [ int(input()) for i in range(q)]
N = [ k-q+L.count(i) for i in range(1,n+1) ]
for i in N:
    print('YES' if i>0 else 'NO')
Problem p02910 (python)

Fixed submission:
S = list(input())
print('No' if 'L' in S[::2] or 'R' in S[1::2] else 'Yes')

Buggy submission (verdict: Runtime Error):
n= list(input())
print('No' if 'L' in n[::2] or 'R' in n[1::2] else 'Yes)
Problem p02911 (python)

Fixed submission:
n, k, q = map(int, input().split())
N = [k]*n
L = [-q]*n
for _ in range(q): L[int(input())-1]+=1
N = map(lambda x,y:x+y, N,L)
for p in N: print("Yes" if p>0 else "No")

Buggy submission (verdict: Runtime Error):
n,k,q=map(int,input().split())
L= [ int(input()) for i in range(q)]
N = [k]*n
j = 0
while(j<len(L)):
    for i in range(len(N)):
        if i+1 != L[j]:
            N[i] -= 1
    j +=1

for i in range(N):
    if i>0:
        print('YES')
    else:
        print('NO')
Problem p03260 (python)

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

s = [int(i) for i in input().split()]


if s[0]*s[1]%2 == 0:
    print("No")

else:
    print("Yes")

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

s = input().split()

if s[0] % 2 == 0 or s[1]%2 == 0:
  print("No")

else:
  print("Yes")
Problem p02928 (python)

Fixed submission:
import math
def counter_one(A):
    cnt = 0
    for i,ai in enumerate(A):
        cnt += sum(a < ai for a in A[i+1:])
    return cnt
def counter_two(A):
    cnt = 0
    for i,ai in enumerate(A):
        cnt += sum(a < ai for a in A)
    return cnt
  

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

one_a = counter_one(A)
two_a = counter_two(A)

ans = (one_a*K)+((two_a)*(K*(K-1)//2))
print(int(ans%((10**9)+7)))

Buggy submission (verdict: Runtime Error):
import math
def counter(A):
    cnt = 0
    for i,ai in enumerate(A):
        cnt += sum(a < ai for a in A[i+1:])
    return cnt
def counter_two(A):
    cnt = 0
    for i,ai in enumerate(A):
        cnt += sum(a < ai for a in A)
    return cnt
  

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

one_a = counter_one(A)
two_a = counter_two(A)

ans = (one_a*K)+((two_a)*(K*(K-1)//2))
print(int(ans%((10**9)+7)))

Buggy submission (verdict: Runtime Error):
import math
def counter(A):
    cnt = 0
    for i,ai in enumerate(A):
        cnt += sum(a < ai for a in A[i+1:])
    return cnt
def counter_two(A):
    cnt = 0
    for i,ai in enumerate(A):
        cnt += sum(a < ai for a in A)
    return cnt
  

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

one_a = counter_one(A)
two_a = counter_two(A)

ans = (one_a*K)+((two_a)*(K*(K-1)//2))
print(int(ans%((10**9)+7)))
Problem p02934 (python)

Fixed submission:
import numpy as np

N = int(input())
A = [float(x) for x in input().split()]

nA = np.array(A)
print(np.reciprocal(np.sum(np.reciprocal(nA))))

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

N = int(input())
A = [float(input()) for _ in range(N)]

nA = np.array(A)
print(np.reciprocal(np.sum(np.reciprocal(nA))))
Problem p02953 (python)

Fixed submission:
n_len = int(input())
n_list = [int(x) for x in input().split()]
flag = 0

n_border = 0

for ind in range(n_len - 1):
    n1 = n_list[ind]
    n2 = n_list[ind+1]
    if n1 - 1 > n_border:
        n_border = n1 - 1
    #print(n1,n2,n_border)
    if (n1 <= n2) | (n1 - 1 <= n2) & (n_border <= n2):
        pass
    else:
        flag = 1
        break
        
if flag:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
n_len = int(input())
n_list = [int(x) for x in input().split()]
n_border = 0
    

for ind in range(n_len - 1):
    n1 = n_list[ind]
    n2 = n_list[ind+1]
    print(n1,n2,n_border)
    if n1 - 1 > n_border:
        n_border = n1 - 1
    if (n1 - 1 <= n2) & (n_border <= n2):
        pass
    else:
        flag = 1
        break
        
if flag:
    print('No')
else:
    print('Yes')
Problem p02971 (python)

Fixed submission:
N = int(input())

nums = [int(input()) for x in range(N)]

a = sorted(nums)[-1]#max(nums)
b = sorted(nums)[-2]#max(nums.remove(max_num))



if a == b:
    for _ in nums:
        print(a)
else:
    for x in [b if x == a else a for x in nums]:
        print(x)

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

nums = [int(input()) for x in range(N)]

a = sorted(nums)[-1]#max(nums)
b = sorted(nums)[-2]#max(nums.remove(max_num))



if a == b:
    for _ in range(nums):
        print(a)
else:
    for x in [b if x == a else a for x in nums]:
        print(x)
Problem p02972 (python)

Fixed submission:
def main(A,N):
    A = [0] + A
    for a in range(N//2,0,-1):
        #print(inds[ind::ind+1])
        if sum(A[a::a]) %2== 0:
            A[a] = 0
        else:
            A[a] = 1
        
    res = [x for x in range(0,N+1) if A[x]]
    print(len(res))
    print(*res)

N = int(input())
A = [int(x) for x in input().split()]
    
main(A,N)

Buggy submission (verdict: Runtime Error):
def main(A,N):
    A = [0] + A
    for a in range(N//2,0,-1):
        #print(inds[ind::ind+1])
        if sum(A[a::a]) %2== 0:
            A[a] = 0
        else:
            A[a] = 1
        
        res = [x for x in range(0,N+1) if A[x]]
    print(len(res))
    print(*res)

N = int(input())
A = [int(x) for x in input().split()]
    
main(A,N)

Buggy submission (verdict: Runtime Error):
def main(a):
    for ind,_ in enumerate(a):
        #print(inds[ind::ind+1])
        buf = a[ind::ind+1]
        if (buf[0]==0 and sum(buf)%2==0) or (buf[0]==1 and sum(buf)%2==1):
            pass
        else:
            print(-1)
            return 0

    print(sum(a))
    if sum(a)>0:print(' '.join([str(ind+1) for ind,x in enumerate(a) if x == 1]))

N = int(input())
a = [int(input()) for _ in range(N)]
    
main(a)

Buggy submission (verdict: Runtime Error):
def main(a):
    for ind,_ in enumerate(a):
        #print(inds[ind::ind+1])
        buf = a[ind::ind+1]
        if (buf[0]==0 and sum(buf)%2==0) or (buf[0]==1 and sum(buf)%2==1):
            pass
        else:
            print(-1)
            return 0

    print(sum(a))
    print(' '.join([str(ind+1) for ind,x in enumerate(a) if x == 1]))

N = int(input())
a = [int(input()) for _ in range(N)]
    
main(a)
Problem p02917 (python)

Fixed submission:
n = int(input())
li = list(map(int, input().split()))
r = li[0] + li[-1]
for i, j in enumerate(li):
    if i != len(li)-1:
        r += min(j, li[i + 1])
print(r)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
r = 0
for i, j in enumerate(a):
    r += b[j - 1]
    if a[i - 1] == a[i] - 1 and i > 0:
        r += c[j - 2]
print(r)
Problem p03254 (python)

Fixed submission:
N, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
sum = 0
count = 0
while True:
  sum += a[0]
  if sum > x:
    break
  count += 1
  del a[0]
  if len(a) == 0:
    break
if x > sum:
  print(count-1)
else:
  print(count)

Buggy submission (verdict: Runtime Error):
N, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
sum = 0
count = 0
while True:
  sum += a[0]
  if sum > x or len(a) == 0:
    break
  count += 1
  del a[0]
print(count)
Problem p02909 (python)

Fixed submission:
a = input()
if a == "Sunny":
  print("Cloudy")
elif a == 'Cloudy':
  print('Rainy')
elif a == 'Rainy':
  print('Sunny')

Buggy submission (verdict: Runtime Error):
a = input()
if a == "Sunny":
  print("Cloudy")
elif a == 'Cloudy':
  print('Rainy'):
elif a == 'Rainy':
  print('Sunny')
Problem p02921 (python)

Fixed submission:
a = input()
b = input()
n = 0
for i in range(3):
  if a[i] == b[i]:
    n += 1
print(n)

Buggy submission (verdict: Runtime Error):
a, b = map(str, input().split())
n = 0
for i in range(2):
  if a[i] == b[i]:
    n += 1
print(n)
Problem p02909 (python)

Fixed submission:
S = input()

weather_list = ["Sunny", "Cloudy", "Rainy", "Sunny"]
print(weather_list[weather_list.index(S) + 1])

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

weather_list = ["Sunny", "Cloudy", "Rainy", "Sunny"]
print(weather_list[weather_list.index("S") + 1])
Problem p02909 (python)

Fixed submission:
S=input()
if S=='Sunny':
  print('Cloudy')
elif S=='Cloudy':
  print('Rainy')
elif S=='Rainy':
  print('Sunny')

Buggy submission (verdict: Runtime Error):
S==input()
if S==Sunny:
  print('Cloudy')
elif S==Cloudy:
  print('Rainy')
elif S==Rainy:
  print('Sunny')
Problem p02921 (python)

Fixed submission:
S=input()
T=input()
x=0
for i in range(3):
  if S[i]==T[i]:
    x=x+1
  else:
    x=x
print(x)

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
x=[]
y=0
for i in range (n-1):
  if h[i]>=h[i+1]:
    y+=1
    x.append(y)
    elif h[i]<h[i+1] :
    x.append(y)
    y=0
print(max(x))

Buggy submission (verdict: Runtime Error):
S=list(map(int.input().split()))
T=list(map(int.input().split()))
x==0
for i in range(2):
  if S[i]==T[i]:
    x=x+1
  else:
    x=x
print(x)
Problem p02922 (python)

Fixed submission:
A,B=map(int,input().split())
M=A
a=1
if B==1:
  print(0)
else:
  for i in range(19):
    if M>=B:
      print(a)
      break
    a+=1
    M+=A-1

Buggy submission (verdict: Runtime Error):
x=int(input())
y=int(input())
print(int(y/x) if (y%x)==0 else int(y/x)+1)
Problem p02934 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
a=[1/float(num) for num in A]
x=sum(a)
print(1/float(x))

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
a=[1/A for i in A]
x=sum(a)
print(float(1/x))
Problem p02945 (python)

Fixed submission:
a, b = map(int, input().split())
print(max([a+b,a-b,a*b]))

Buggy submission (verdict: Runtime Error):
K, X = map(int, input().split())
 for i in range(X - K + 1, X + K):
     if i < X + K - 1:
        print(i, end=' ')
     else:
        print(i)

Buggy submission (verdict: Runtime Error):
K, X = map(int, input().split())
 for i in range(X - K + 1, X + K):
  if i < X + K - 1:
    print(i, end=' ')
  else:
    print(i)

Buggy submission (verdict: Runtime Error):
K, X = map(int, input().split())
 for i in range(X - K + 1, X + K):
 if i < X + K - 1:
 print(i, end=' ')
 else:
 print(i)

Buggy submission (verdict: Runtime Error):
K, X = map(int, input().split())
 for i in range(X - K + 1, X + K):
    if i < X + K - 1:
 print(i, end=' ')
 else:
 print(i)
 K, X = map(int, input()

Buggy submission (verdict: Runtime Error):
K, X = map(int, input().split())
2 for i in range(X - K + 1, X + K):
3 if i < X + K - 1:
4 print(i, end=' ')
5 else:
6 print(i)
1 K, X = map(int, input()

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
print(max([a+b,a-b,a*b]))

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
print(max([a+b,a-b,a*b]))

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
print(max([a+b,a-b,a*b]))

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
print(max([a+b,a-b,a*b]))
Problem p02946 (python)

Fixed submission:
K, X = map(int, input().split())
print(' '.join(map(str, range(X - K + 1, X + K))))

Buggy submission (verdict: Runtime Error):
K, X = map(int, input().split())
 for i in range(X - K + 1, X + K):
      if i < X + K - 1:
         print(i, end=' ')
      else:
         print(i)
Problem p02952 (python)

Fixed submission:
N=int(input())
if N<10:
  print(N)
elif 10<=N<100:
  print(9)
elif 100<=N<1000:
  print(N-90)
elif 1000<=N<10000:
  print(909)
elif 10000<=N<100000:
  print(N-9090)
else:
  print(90909)

Buggy submission (verdict: Runtime Error):
N=int(input())
if N<10:
  print(N)
elif 10=<N<100:
  print(9)
elif 100=<N<1000:
  print(N-90)
elif 1000=<N<10000:
  print(909)
elif 10000=<N<100000:
  print(N-9090)
else:
  print(90909)
Problem p03147 (python)

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

ans=0
while sum(h)>0:
  for i in range(N):
    if i<N-1 and h[i]>0 and h[i+1]==0:
      ans+=1
    else:
      if i==N-1 and h[i]>0:
        ans+=1
    if h[i]>0:
      h[i]-=1
  #print(h)
print(ans)

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

ans=0
while sum(h)>0:
  for i in range(n):
    if i<n-1 and h[i]>0 and h[i+1]==0:
      ans+=1
    else:
      if i==N-1 and h[i]>0:
        ans+=1
    if h[i]>0:
      h[i]-=1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
ans=0
while sum(h)>0:
  for i in range(n):
    if i<n-1 and h[i]>0 and h[i+1]==0:
      ans+=1
    else:
      if i==N-1 and h[i]>0:
        ans+=1
    if h[i]>0:
      h[i]-=1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().spliy()))
ans=0
while sum(h)>0:
  for i in range(n):
    if i<n-1 and h[i]>0 and h[i+1]==0:
      ans+=1
    else:
      if i==N-1 and h[i]>0:
        ans+=1
    if h[i]>0:
      h[i]-=1
print(ans)
Problem p03251 (python)

Fixed submission:
N,M,X,Y=map(int, input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
print("No War" if (max(x)<min(y) and X<Y and X<min(y) and Y>max(x)) else "War")

Buggy submission (verdict: Runtime Error):
N,M,X,Y=map(int, input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
x.apped(X)
y.apped(Y)
print('War' if max(x)>=min(y) else 'No War')
Problem p03777 (python)

Fixed submission:
a,_,b=input()
print('H' if a==b else 'D')

Buggy submission (verdict: Runtime Error):
a,b=input()
print('H' if a==H & b==H or a==D & b==D else 'D')

Buggy submission (verdict: Runtime Error):
a,_,b=input()
print('H' if a==H & b==H or a==D & b==D else 'D')

Buggy submission (verdict: Runtime Error):
a,b=input()
print('H' if a==H and b==H or a==D and b==D else 'D')
Problem p04044 (python)

Fixed submission:
n,l=map(int,input().split())
s=sorted([input() for i in range(n)])
print(*s,sep="")

Buggy submission (verdict: Runtime Error):
n,l =map(int,input().split())
s=sorted([input(),for i in range(n)])
print(*s,sep='')

Buggy submission (verdict: Runtime Error):
n,l=map(int,input().split())
s=sorted([input() for i in range(n)])
print(*n,sep="")
Problem p02918 (python)

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


def counthappy(s):
    happy = 0
    for i in range(0, len(s)):
        if i != 0 and s[i] == 'L':
            if s[i - 1] == 'L':
                happy += 1
        elif i != len(s) - 1 and s[i] == 'R':
            if s[i + 1] == 'R':
                happy += 1
    return happy


flag = 0
S = S + 'J'
s_ = []
for i in range(0, N):
    if S[i] != S[i + 1]:
        s_.append(S[flag:i + 1])
        flag = i + 1

count = 0
for i in range(1, len(s_), 2):
    count += 1
    if s_[i][0] == 'L':
        s_[i] = s_[i].replace('L', 'R')
    elif s_[i][0] == 'R':
        s_[i] = s_[i].replace('R', 'L')

    if count == K:
        break

s_join = ''.join(s_)

happy = counthappy(s_join)
print(happy)

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


def counthappy(s):
    happy = 0
    for i in range(0, len(s)):
        if i != 0 and s[i] == 'L':
            if s[i - 1] == 'L':
                happy += 1
        elif i != len(s) - 1 and s[i] == 'R':
            if s[i + 1] == 'R':
                happy += 1
    return happy


def replace(s, k_):
    for l in range(0, N - 1):
        for r in range(l + 1, N):
            part_l = s[0:l]
            part = s[l:r+1]
            part_r = s[r+1:N][::-1]

            part = part.replace('L', '-')
            part = part.replace('R', 'L')
            part = part.replace('-', 'R')
            s_ = part_l + part + part_r

            if k_ < K:
                replace(s_, k_ + 1)

            happy = counthappy(s_)
            global answer
            if answer < happy:
                answer = happy


answer = counthappy(S)
replace(S, 1)

print(answer)
Problem p02993 (python)

Fixed submission:
s=input().rstrip()
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):

def gcdm(g,l):
    while(l):
        g,l=l,g%l
    return g
def mota(l,r,a):
    if r<a:
        total=0
    else:
        
        if l<a:
            first=a
        elif l>=a:
            if l%a==0:
                first=l
            else:
                first=(l//a + 1)*a
        #print(a,first)
        last=r-r%a
    
        total=((last-first)//a)+1
    return total
a,b,c,d=list(map(int,input().split()))
p=[c,d]
p.sort()
c,d=p[0],p[1]
total1=mota(a,b,c)

#print(total1)
total2=mota(a,b,d)
#print(total2)
h=(c*d)//gcdm(c,d)
total3=mota(a,b,h)
#print(h)
#print(total3)
print(b-a+1-(total1+total2-total3))