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

Fixed submission:
s = input().split()
H = int(s[0])
A = int(s[1])

ans = H // A
if H % A:
    print(ans+1)
else:
    print(ans)

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

s = input().split()
H = int(s[0])
N = int(s[1])

m = np.array([list(map(int, input().split())) for i in range(N)])
A = m[:, 0]
B = m[:, 1]

def func(H, m):
    A = m[:, 0]
    B = m[:, 1]

    if H < A[i]:
        i = np.argmin((H // A) * B)
        return (H // A[i]) * B[i]
    else:
        i = np.argmax(A / B)
        H_next = H - (H // A[i]) * B[i] 
        return (H // A[i]) * B[i] + func(H_next)
        
        func(H_next, )
        j = np.argmin(B)
        print((H // A[i])*B[i] + B[j])

print(func(H, m))
Problem p02784 (python)

Fixed submission:
s = input().split()
H = int(s[0])
N = int(s[1])

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

if sum(A) >= H:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s = input().split()
H = int(s[0])
N = int(s[1])

A = input().split()

if len(A) != N:
    print('error')
else:
    if sum(A) >= H:
        print('Yes')
    else:
        print('No')
Problem p02936 (python)

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

childs = [[] for _ in range(n+1)]
parent = [-1 if i == 1 else None for i in range(n+1)]
plus = [0 for i in range(n+1)]

for _ in range(n-1):
  a, b = map(int, input().split())
  childs[a].append(b)
  parent[b] = a

for _ in range(q):
  p, x = map(int, input().split())
  plus[p] += x
  
nodes = [1]
while nodes:
  node = nodes.pop()
  if childs[node]:
    for cn in childs[node]:
      plus[cn] += plus[node]
      nodes.append(cn)

print(' '.join([str(num) for num in plus[1:n+1]]))

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

childs = [[] for _ in range(n+1)]
parent = [-1 if i == 1 else None for i in range(n+1)]
nodes_in_level = [[] for _ in range(n+1)]
level_of_node = [0 if i == 1 else None for i in range(n+1)]

level_of_node[0].append(1)

for _ in range(n-1):
  a, b = map(int, input().split())
  childs[a].append(b)
  parent[b] = a
  level_of_node[b] = level_of_node[a] + 1
  nodes_in_level[level_of_node[b]].append(b)

ans = 0
nodes_under_level = [0 for i in range(n+1)]
for i in list(range(n))[::-1]:
  nodes_under_level[i] = nodes_under_level[i+1] + len(nodes_in_level[i])

for _ in range(q):
  p, x = map(int, input().split())
  ans += nodes_under_level[level_of_node[p]] * x
  
print(ans)
Problem p03095 (python)

Fixed submission:
mod = 1000000007
n = int(input())
s = input()
abets ="abcdefghijklmnopqrstuvwxyz"
counts = []
for c in abets:
  counts.append(s.count(c))
ans = 0
for cnt in counts:
  if cnt != 0:
    ans = (ans + ans*cnt + cnt) % mod
print(ans)

Buggy submission (verdict: Runtime Error):
mod = 1000000007
n = int(input())
s = input()
abets = “abcdefghijklmnopqrstuvwxyz”
counts = []
for c in abets:
  counts.append(s.count(c))
ans = 0
for ptn in range(2** len(abets)):
  bin_str = format(ptn, ‘b’)
  subans = 1
  for i, b in enumerate(bin_str[::-1]):
    if b == ‘1’:
      subans = (subans * counts[i]) % mod
  ans = (ans + subans) % mod
print(ans)
Problem p03128 (python)

Fixed submission:
import copy

N, M = map(int, input().split())
A = [int(x) for x in input().split()]
cost = [0,2,5,5,4,5,6,3,7,6]

dp = [[0 for _ in range(10)] for i in range(N+10)]

A = sorted(A, reverse=True)

for num in A:
    c = cost[num]
    if dp[c][0] == 0:
        dp[c][0] = 1
        dp[c][num] = 1

for i in range(1, N+1):
    for num in A:
        c = cost[num]
        prev = copy.deepcopy(dp[i])
        if prev[0] != 0:
            if dp[i + c][0] > dp[i][0] + 1:
                continue
            elif dp[i + c][0] == dp[i][0] + 1:
                nxt = prev
                nxt[num] += 1
                nxt[0] += 1
                for number in range(9, 0, -1):
                    if dp[i + c][number] < nxt[number]:
                        dp[i + c] = copy.deepcopy(nxt)
                        break
                    if dp[i + c][number] > nxt[number]:
                        break
            else:
                nxt = prev
                nxt[num] += 1
                nxt[0] += 1
                dp[i + c] = copy.deepcopy(nxt)

# print(dp[N])
ans = ""
for number in range(9, 0, -1):
    for _ in range(dp[N][number]):
        ans = ans + str(number)

print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [int(x) for x in input().split()]
cost = [0,2,5,5,4,5,6,3,7,6]

dp = [0 for i in range(N+1)]

A = sorted(A, reverse=True)

for num in A:
    c = cost[num]
    dp[c] = max(dp[c], num)

for i in range(N+1):
    for num in A:
        c = cost[num]
        if i-c >= 0:
            prev = dp[i - c]
            cur = dp[i]
            if prev > 0:
                prev_str = str(prev)
                if int(prev_str[0]) > num:
                    nxt_str = prev_str + str(num)
                    nxt = int(nxt_str)
                else:
                    nxt_str = str(num) + prev_str
                    nxt = int(nxt_str)
                if nxt > cur:
                    dp[i] = nxt
                # if i == N:
                #     print(cur, prev, nxt)

print(dp[N])
Problem p04043 (python)

Fixed submission:
s = list(map(int, input().split()))
s.sort()
if s == [5, 5, 7]:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
s = list(map(int, input().split()))
sort(s)
if s == [5, 7, 7]:
  print("YES")
else:
  print("NO")
Problem p02783 (python)

Fixed submission:
H,A=map(int, input().split())
count=0
while H>0:
    H=H-A
    count+=1
else:
    print(count)

Buggy submission (verdict: Runtime Error):
H=int(input())
A=int(input())
count=0
while H>0:
    H=H-A
    count+=1
else:
    print(count)

Buggy submission (verdict: Runtime Error):
H=int(input())
A=int(input())
count=0
while H>0:
    H=H-A
    count+=1
else:
print(count)
Problem p02993 (python)

Fixed submission:
S=input()
if S[0]!=S[1] and S[1]!=S[2] and S[2]!=S[3]:
    print('Good')
else:
    print('Bad')

Buggy submission (verdict: Runtime Error):
S=input()
for i in range(len(S)):
    if S[i]==S[i+1]:
        print('Bad')
    else:
        print('Good')
Problem p03000 (python)

Fixed submission:
n,x= [int(i) for i in input().split()]
L=[int(i) for i in input().split()]
d=[0]
for i in range(1,len(L)+1):
    dd=d[i-1]+L[i-1]
    d.append(dd)
num=0
for j in range(len(d)):
    if d[j]<=x:
        num+=1
print (num)

Buggy submission (verdict: Runtime Error):
n,x= [int(i) for i in input().split()]
L=[int(i) for i in input().split()]
d=[0]
for i in range(1,len(L)+1):
    dd=d[i-1]+L[i-1]
    d.append(dd)
for j in range(len(d)):
    if d[j]<=x:
        num+=1
print (num)
Problem p03005 (python)

Fixed submission:
n,k= [int(i) for i in input().split()]
if k==1:
    print (0)
else:
    print (n-k)

Buggy submission (verdict: Runtime Error):
n,k= [int(i) for i in input().split()]
if k==1:
    return 0
else:
    return n-k

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

if n[1]==1:
    return 0
else:
    return n[0]-n[1]

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

if n[1]==1:
    return 0
else:
    return n[0]-n[1]

Buggy submission (verdict: Runtime Error):
n,k=input().split(" ")
n,k_int=map(int,n,k)
if k==1:
    return 0
else:
    return n-k

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split(" ")
if k==1:
    return 0
else:
    return n-k

Buggy submission (verdict: Runtime Error):
if k==1:
    return 0
else:
    return n-k

Buggy submission (verdict: Runtime Error):
n,k=input().split(" ")
if k==1:
    return 0
else:
    return n-k

Buggy submission (verdict: Runtime Error):
if k==1:
    return 0
elif n==k:
    return 0
else:
    max_dif=(n-k-1)-1
    return max_dif
Problem p02783 (python)

Fixed submission:
H, A = map(int, input().split())

cnt = 0

while H > 0:
    H = H - A
    cnt += 1
print(cnt)

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

cnt = 0
ans = 0

while H >= 1:
    H = H / 2
    if cnt == 0:
        cnt += 1
        ans += 1
    else:
        ans += cnt * 2
        cnt = cnt * 2

print(ans)
Problem p02801 (python)

Fixed submission:
C = str(input())

print(chr(ord(C) + 1))

Buggy submission (verdict: Runtime Error):
from sys import stdin


N, M = map(int, stdin.readline().rstrip().split())
A_list = [stdin.readline().rstrip().split() for _ in range(M)]

wa_count, ac_count = 0, 0
WA_List = {}  # {prob_id: wa_count}
AC_list = []  # [prob_id]

for i in range(M):
    if A_list[i][1] == 'AC':
        if not A_list[i][0] in AC_list:
            if A_list[i][0] in WA_List:
                wa_count += WA_List[A_list[i][0]]
            ac_count += 1
            AC_list.append(A_list[i][0])
    else:
        if A_list[i][0] in WA_List:
            WA_List[A_list[i][0]] += 1
        else:
            WA_List[A_list[i][0]] = 1

print(ac_count, wa_count)

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

N, M = map(int, input().split())
A_list = [input().split() for _ in range(M)]

wa_count, ac_count = 0, 0
WA_List = {}  # {prob_id: wa_count}
AC_list = []  # [prob_id]

for i in range(M):
    if A_list[i][1] == 'AC':
        if not A_list[i][0] in AC_list:
            if A_list[i][0] in WA_List:
                wa_count += WA_List[A_list[i][0]]
            ac_count += 1
            AC_list.append(A_list[i][0])
    else:
        if A_list[i][0] in WA_List:
            WA_List[A_list[i][0]] += 1
        else:
            WA_List[A_list[i][0]] = 1

print(ac_count, wa_count)
Problem p04001 (python)

Fixed submission:
S = input()
N = len(S) - 1
ans = 0

for i in range(2 ** N):
    k = 0
    for j in range(N):
        if (i >> j) & 1:
            ans += int(S[k:j + 1])
            k = j + 1
    ans += int(S[k:])
print(ans)

Buggy submission (verdict: Runtime Error):
S = int(input())
N = len(S) - 1
ans = 0

for i in range(2 ** N):
    k = 0
    for j in range(N):
        if (i >> j) & 1:
            ans += int(S[k:j + 1])
            k = j + 1
    ans += int(S[k:])
print(ans)

Buggy submission (verdict: Runtime Error):
S = int(input())
N = len(S) - 1
ans = 0

for i in range(2 ** N):
    k = 0
    for j in range(N):
        # 復元
        if (i >> j) & 1:
            ans += int(S[k:j + 1])
            k = j + 1
    ans += int(S[k:])
print(ans)

Buggy submission (verdict: Runtime Error):
S = int(input())
N = len(S) - 1
ans = 0

for i in range(2 ** N):
    k = 0
    for j in range(N):
        # 復元
        if (i >> j) & 1:
            ans += int(S[k:j + 1])
            k = j + 1
    ans += int(S[k:])
print(ans)
Problem p02947 (python)

Fixed submission:
from collections import Counter
N = int(input())
lis = ["".join(sorted(list(input()))) for _ in range(N)]
keys, values = zip(*Counter(lis).most_common())
values = list(filter(lambda x: x >= 2, values))

sums = 0
for k in values:
  sums += ((k - 1) * (k)) / 2
  
print(int(sums))

Buggy submission (verdict: Runtime Error):
import pandas as pd
N = int(input())
hoge = list(input())
"df = pd.DataFrame([], columns=["words"])
print(hoge)
Problem p02783 (python)

Fixed submission:
the_string = input()
a, b = the_string.split()
a = int(a)
b = int(b)
if a%b == 0:
    ans = a//b
else:
    ans = a//b +1
print(ans)

Buggy submission (verdict: Runtime Error):
the_string = input()
a, b = the_string.split()
a = int(a)
b = int(b)
if a%%b = 0:
    ans = a/b
else:
    ans = a/b +1
print(ans)
Problem p02789 (python)

Fixed submission:
str1, str2 = [s for s in input().split()]
if str1 == str2:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
str1, str2 = [s for s in input().split()]
a = str1*int(str2)
b = str2*int(str1)
int(a)
int(b)
list = [a, b]
list.sort();
print(list[0])

Buggy submission (verdict: Runtime Error):
str1, str2 = [s for s in input().split()]
a = str(str1)*str2
b = str(str2)*str2
if a > b:
    print(a)
elif a < b:
    print(b)
else:
    print(a)

Buggy submission (verdict: Runtime Error):
str1, str2 = [s for s in input().split()]
a = str1*str2
b = str2*str2
if a > b:
    print(a)
elif a < b:
    print(b)
else:
    print(a)

Buggy submission (verdict: Runtime Error):
x,y = map(int,input().split());
if x = y:
	print('Yes');
else x > y:
  	print('No');

Buggy submission (verdict: Runtime Error):
def acwa():
x,y = map(int,input().split())
if x = y:
	print('Yes');
else x < y:
  	print('No');

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()));
if a[0] == a[1]:
	print('Yes');
else a[0] > a[1]:
	printf('No');
Problem p02784 (python)

Fixed submission:
from itertools import permutations, combinations

nums = input().split()
As = input().split()
H = nums[0]
N = nums[1]
A = []

sum = 0

for B in As:
    sum = sum + int(B)

if sum >=  int(H):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
from itertools import permutations, combinations

nums = input().split()
As = input().split()
H = nums[0]
N = nums[1]
A = []

sum = 0

for B in As:
    sum = sum + int(B)

if sum >=  int(H):
    print("Yes")
else:
    print("No")
Problem p02783 (python)

Fixed submission:
H, A = map(int, input().split())

i = 0
while H > 0:
    H -= A
    i += 1

print(i)

Buggy submission (verdict: Runtime Error):
H = int(input(""))
A = int(input(""))

i = 0
while H > 0:
    H -= A
    i += 1

print(i)
Problem p02789 (python)

Fixed submission:
N, M = input().split()
if N == M:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N=int(input())
M=int(input())
if N==M:
  print("Yes")
else:
  print("No")
Problem p02830 (python)

Fixed submission:

NNN = input()

S,T = map(str, input().split())

S_list =list(S)
T_list =list(T)

N = len(S_list)
outstr = []

for n in range(N*2):
    if n%2 == 0:
        outstr.append(S_list[int(n / 2)])
    else:
        outstr.append(T_list[int(n / 2)])

STR = ','.join(outstr)
STR2 = STR.replace(",", "")
print(STR2)

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

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

S_list =list(S)
T_list =list(T)

N = len(S_list)
outstr = []

for n in range(N*2):
    if n%2 == 0:
        outstr.append(S_list[int(n / 2)])
    else:
        outstr.append(T_list[int(n / 2)])

STR = ','.join(outstr)
STR2 = STR.replace(",", "")
print(STR2)
Problem p02783 (python)

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

Buggy submission (verdict: Runtime Error):
H = input()
A = input()
print(H/A//1)
Problem p02909 (python)

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

Buggy submission (verdict: Runtime Error):
N,K,Q = map(int,input().split())
A = []
P = []
for x in range(0,N):
    P.append(K)
for a in range(0,Q):
    A.append(input())
    
for a in range(0,Q):
    for x in range(0,N):
        P[x] = P[x] - 1
    P[int(A[a])-1]=P[int(A[a])-1]+1
for x in range(0,N):
    if P[x] <= 0:
        P[x] = 'No'
    else:
        P[x] = 'Yes'
for x in range(0,N):
    print(P[x])
Problem p03043 (python)

Fixed submission:
N,K = map(int,input().split())
prob = 0
for a in range(1,N+1):
    p = 0
    num = a
    while(K >num):
        num=num*2
        p = p + 1
    prob = prob + 0.5**p
prob = prob/N
print(prob)

Buggy submission (verdict: Runtime Error):

"""
Created on Sun May 19 14:10:21 2019

@author: taikinaka
"""
#print('put key')
K = int(input())
#print('Put numbers')
prob = 0
N = int(input())
for a in range(1,N+1):
    p = 0
    num = a
    while(K >num):
        num=num*2
        #print('num=',num)
        p = p + 1
    #print("p=",p)
    prob = prob + 0.5**p
prob = prob/N
print(prob)
Problem p02783 (python)

Fixed submission:
x,y = map(int,input().split())

count = x//y

if x%y != 0:
    count += 1

print(count)

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

li = list(map(int,input().split()))

a = sum(li)

if a > x:
    print('Yes')
else:
    print('No')
Problem p02789 (python)

Fixed submission:
x,y = map(int,input().split())
if x == y:
    print('Yes')
else:
    print('No')

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

if N = M:
    print('Yes')
else:
    print('No')

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

if N = M:
    print('Yes')
else:
    print('No')
Problem p02783 (python)

Fixed submission:
n = list(map(int,input().split()))
H = n[0] 
A = n[1] 
sum = 0 
while H > 0 : 
    H = H - A 
    sum = sum + 1 
print(sum)

Buggy submission (verdict: Runtime Error):
n = list(int(map(int,input().split()))) 
H = n[0] 
A = n[1] 
sum = 0 
while H > 0 : 
    H = H - A 
    sum = sum + 1 
print(sum)

Buggy submission (verdict: Runtime Error):
H = int(input()) 
A = int(input()) 
sum = 0
while H > 0 : 
  H = H - A
  sum = sum + 1
print(sum)
Problem p02921 (python)

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

Buggy submission (verdict: Runtime Error):
N = int(input())
print(int((N-1)*N/2))
Problem p02947 (python)

Fixed submission:
import collections
from math import factorial

N = int(input())
S = [0]*N
for i in range(N):
    s = list(str(input()))
    s.sort()
    S[i] = "".join(s)

c = collections.Counter(S)
cnt = 0
r = 2

for n in c.values():
    if n >= 2:
        a = factorial(n)
        b = factorial(r)*factorial(n - r)
        cnt += a/b
print(int(cnt))

Buggy submission (verdict: Runtime Error):
import collections
from math import factorial

N = int(input())
S = [0]*N
for i in range(N):
    s = list(str(input()))
    s.sort()
    S[i] = "".join(s)

c = collections.Counter(S)
cnt = 0
r = 2

for n in c.values():
    if n >= 2:
        cnt += factorial(n) / factorial(r) / factorial(n - r)
print(int(cnt))

Buggy submission (verdict: Runtime Error):
import collections
from math import factorial

N = int(input())
S = [0]*N
for i in range(N):
    s = list(str(input()))
    s.sort()
    S[i] = "".join(s)

c = collections.Counter(S)
V = c.values()
V.sort()
cnt = 0
r = 2

for n in c.values():
    if n >= 2:
        cnt += factorial(n) / factorial(r) / factorial(n - r)
print(int(cnt))

Buggy submission (verdict: Runtime Error):
import collections
from math import factorial

N = int(input())
S = [0]*N
for i in range(N):
    s = list(str(input()))
    s.sort()
    S[i] = "".join(s)
print(S)

c = collections.Counter(S)
cnt = 0
r = 2
for n in c.values():
    if n >= 2:
        cnt += factorial(n) / factorial(r) / factorial(n - r)
print(int(cnt))
Problem p02957 (python)

Fixed submission:
A,B=map(int,input().split())
if (A+B)%2 == 0:
    print(int((A+B)/2))
else:
    print("IMPOSSIBLE")

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

def main():
    MOD=10**9+7

    S = input()
    S = S[::-1]
    N = len(S)
    dp=np.zeros((N+1,13),dtype=np.int)
    dp[0,0]=1

    for i in range(N):
        if S[i]=="?":
            for s in range(10):
                for j in range(13):
                    dp[i+1][(s*(10**i)+j) % 13] += dp[i][j]
                    dp[i+1][(s*(10**i)+j) % 13] %= MOD
        else:
            s=int(S[i])
            for j in range(13):
                dp[i+1][(s*(10**i)+j) % 13] += dp[i][j]
                dp[i+1][(s*(10**i)+j) % 13] %= MOD

    res = dp[N,5]
    print(res%MOD)

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

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

n_list = []
c = a + b
d = a - b
e = a * b

n_list.append(c)
n_list.append(d)
n_list.append(e)

print(max(n_list))

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

n_list = []
c = a + b
d = a - c
e = a * b

n_list.append(c)
n_list.append(d)
n_list.append(e)

sorted_list = sorted(n_list)

if sorted_list[2] > sorted_list[1]:
    print(sorted_list[2])
elif sorted_list[2] == sorted[1] & sorted_list[1] > sorted_list[0]:
    print(sorted_list[2], sorted_list[1])
else:
    print(sorted_list[2], sorted_list[1], sorted_list[0])
Problem p02952 (python)

Fixed submission:
n = int(input())
     
cnt = 0
for i in range(1, n+1):
    str_n = str(i)
    if len(str_n) % 2 != 0:
        cnt += 1
            
print(cnt)

Buggy submission (verdict: Runtime Error):
    n = int(input())
     
    cnt = 0
    for i in range(1, n+1):
        str_n = str(i)
        if len(str_n) % 2 != 0:
            cnt += 1
            
    print(cnt)
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().split())

if (a + b) % 2 === 0:
    print((a + b) // 2)
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
from sys import stdin

n = int(stdin.readline().rstrip())

print(n)

Buggy submission (verdict: Runtime Error):
from sys import stdin

n = int(stdin.readline().rstrip())

a, b = n[0], n[1]

if (a + b) % 2 === 0:
    print((a + b) // 2)
else:
    print("IMPOSSIBLE")

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

a,b = n[0], n[1]

if (a + b) % 2 === 0:
    print((a + b) // 2)
else:
    print("IMPOSSIBLE")

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

Buggy submission (verdict: Runtime Error):
a,b = (int(i) for i in input().split())
     
     
if (a + b) % 2 === 0:
    print((a + b) // 2)
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
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().split())


if (a + b) % 2 === 0:
  print((a + b) // 2)
else:
  print("IMPOSSIBLE")
Problem p02969 (python)

Fixed submission:
a = int(input())
print(a**2 * 3)

Buggy submission (verdict: Runtime Error):
a = input
a = int(a)
print(a **2 * 3)
Problem p02887 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

a =int(input())
B =list(input())

def dfs(x):
    
    C =B[x]
    B[x] = "."
    nx = x + 1
    if nx >= 0 and nx <= a-1 and B[nx] == C:
        dfs(nx)

res = 0
for i in range(a):
        if B[i] != ".":
            # Wが残っているならそこから dfs をはじめる
            dfs(i)
            res += 1
print(res)

Buggy submission (verdict: Runtime Error):
a =int(input())
B =list(input())

D =[1]


def dfs(x):
    for dx in D:
        C =B[x]
        B[x] = "."
        nx = x + dx
        if nx >= 0 and nx <= a-1 and B[nx] == C:
            dfs(nx)

res = 0
for i in range(a):
        if B[i] != ".":
            dfs(i)
            res += 1
print(res)
Problem p03999 (python)

Fixed submission:

S = input()
n = len(S)
 
def dfs(i, k):
    
    if i == n-1:
        return sum(list(map(int,k.split("+"))))
    
    return dfs(i+1,k+S[i+1])+dfs(i+1,k+"+"+S[i+1])
 
print(dfs(0,S[0]))

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

def dfs(i,k):
  if i == n-1:
    return(sum(list(map(int,f.split("+")))
  return dfs(i+1,K+S[i+1])+dfs(i+1,K+"+"+S[i+1])
print(dfs(0,S[0])
Problem p02783 (python)

Fixed submission:
import numpy as np
H, A = map(int, input().split())
num = int(np.ceil(H/A))
print(num)

Buggy submission (verdict: Runtime Error):
import numpy as np
H, N = map(int, input().split())
A = np.array([int(num) for num in input().split()])
if H <= A.sum():
    print('Yes')
else:
    print('No')
Problem p02783 (python)

Fixed submission:
H, A = map(int, input().split())
counter = 0

while H > 0:
  H -= A
  counter += 1
  
print(counter)

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

s = list(map(int, input().split()))

s_sum = sum(s)

if s_sum < H:
  print('No')
else:
  print('Yes')
Problem p02786 (python)

Fixed submission:
H = int(input())
count = 0

def helper(x):
  if x == 1:
    return 1
  return helper(x//2) * 2 + 1

print(helper(H))

Buggy submission (verdict: Runtime Error):
H = int(input())
count = 0

def helper(x):
  if x == 1:
    return 1
  return helper(x/2) * 2 + 1

print(helper(H))

Buggy submission (verdict: Runtime Error):
H = int(input())
count = 0

def helper(x):
  if x == 1:
    global count
    count += 1
    return
  count += 1
  helper(x/2)
  helper(x/2)

helper(H)
print(count)