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

Fixed submission:
def main(n, a):
  a = list(a)
  for x in a:
    if(x == 0):
      print(0)
      return
   
  ans = a[0]
  for i in range(1, n):
    ans = ans * a[i]
    if(ans > 1000000000000000000):
      print(-1)
      return
  print(ans)
 
if(__name__ == '__main__'):
  n = int(input())
  a = map(int, input().split())
  main(n, a)

Buggy submission (verdict: Runtime Error):
def main(n, a):
  for x in a:
    if(x == 0):
      print(0)
      return
   
  ans = a[0]
  for i in range(1, n):
    ans = ans * a[i]
    if(ans > 1000000000000000000):
      print(-1)
      return
  print(ans)
 
if(__name__ == '__main__'):
  n = int(input())
  a = map(int, input().split())
  main(n, a)

Buggy submission (verdict: Runtime Error):

def main(n, a):
  for x in a:
    if(x == 0):
      print(0)
      return
   
  ans = a[0]
  for i in range(1, n):
    ans = ans * a[i]
    if(ans > 1000000000000000000):
      print(-1)
      return
  print(ans)

if(__name__ == '__main__') {
  n = int(input())
  a = map(int, input().split())
  main(n, a)
Problem p02657 (python)

Fixed submission:
s = input().split()
print(int(s[0])*int(s[1]))

Buggy submission (verdict: Runtime Error):
N = int(input()) #1行目のNを取得する
s_char = list(input().split())
s = [int(n) for n in s_char]
ans = 1

for num in s:
    if len(str(ans))+len(str(num))>20:
        #print('e')
        ans = -1
        break
    ans *= num
    if ans > 10**18:
        ans = -1
        break

for num in s:
    if num == 0:
        ans = 0
        
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input()) #1行目のNを取得する
s_char = list(input().split())
s = [int(n) for n in s_char]
ans = 1

for num in s:
    if len(str(ans))+len(str(num))>20:
        #print('e')
        ans = -1
        break
    ans *= num
    if ans > 10**18:
        ans = -1
        break

for num in s:
    if num ==0:
        ans =0
        
print(ans)
Problem p02921 (python)

Fixed submission:
s = input()
t = input()
ans = 0

for i in range(3):
    if s[i] == t[i]:
        ans = ans + 1
print(ans)

Buggy submission (verdict: Runtime Error):
ｓ
Problem p02744 (python)

Fixed submission:
N = int(input())
#N = 4
def to_str(n):
    s = [chr(i + 97) for i in reversed(n)]
    s = "".join(s)
    return s
n = [0] * N
n_max = list(reversed(list(range(N))))

s = to_str(n)
print(s)
while True:
    for j in range(N-1):
        #if n[j] < n[j+1]+1:
        if n[j] < max(n[j+1:]) + 1:
            n[j] += 1
            for k in range(j):
                n[k] = 0
            s = to_str(n)
            print(s)
            break
    if n == n_max:
        break

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

result_list = [
    ["a"],
    ["aa", "ab"],
    ["aaa", "aab", "aba", "abb", "abc"]
]

for s in result_list[N - 1]:
    print(s)
Problem p02923 (python)

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


def decreasing(number_list):
    n = len(number_list) - 1
    result = ["F"] * n
    for i in range(n):
        if number_list[i + 1] <= number_list[i]:
            result[i] = "T"

    return result


print(max(map(len, "".join(decreasing(H)).split("F"))))

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


def move_number(number_list):
    n = len(number_list)
    result = 0
    for i in range(n - 1):
        if number_list[i + 1] <= number_list[i]:
            result += 1
        else:
            return result
    return result


def all_move_numbers(number_list):
    result = []
    n = len(number_list)
    for i in range(n - 1):
        _number_list = number_list[i:]
        result.append(move_number(_number_list))
    return result


def max_number(number_list):
    result = max(all_move_numbers(number_list))
    return result


print(max_number(H))
Problem p02924 (python)

Fixed submission:
import decimal

N = decimal.Decimal(input())
print(N * (N - 1) / 2)

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


def sum_ms(ps):
    n = len(ps)
    result = 0
    for j in range(n):
        i = j + 1
        result += i % ps[j]
    return result


ps = list(range(2, N + 1))
ps.append(1)
print(sum_ms(ps))

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


def ms(ps):
    n = len(ps)
    result = []
    for j in range(n):
        i = j + 1
        result.append(i % ps[j])
    return result


ps = list(range(2, N + 1))
ps.append(1)
print(sum(ms(ps)))
Problem p02713 (python)

Fixed submission:
import math
sum = 0
k = int(input())+1
for i in range(1, k):
    for j in range(1, k):
        temp = math.gcd(i, j)
        for x in range(1, k):
            sum += math.gcd(temp, x)
print(sum)

Buggy submission (verdict: Runtime Error):
import math
k = int(input())+1
for i in range(1, k):
    for j in range(1, k):
        temp = math.gcd(i, j)
        for x in range(1, k):
            sum += math.gcd(temp, x)
print(sum)

Buggy submission (verdict: Runtime Error):
import math
k = int(input())+1
for i in range(1, k):
    for j in range(1, k):
        temp = math.gcd(i, j)
        for x in range(1, k):
            sum += math.gcd(temp, x)


print(sum)

Buggy submission (verdict: Runtime Error):
import math

k = int(input())+1

for i in range(1, k):
    for j in range(1, k):
        temp = math.gcd(i, j)
        for x in range(1,k):
            sum += math.gcd(temp,x)


print(sum)

Buggy submission (verdict: Runtime Error):
import math
for i in range(1, k):
    for j in range(1, k):
        temp = math.gcd(i, j)
        for x in range(1,k):
            sum += math.gcd(temp,x)


print(sum)
Problem p02714 (python)

Fixed submission:
import collections

n = int(input())
s = input()
res = 0
# for i in range(0, n):
#     for j in range(i+1,n):
#         if s[i] != s[j]:
#             for k in range(j+1,n):
#                 if j-i!=k-j and s[i] != s[k] and s[j] != s[k]:
#                     res += 1
#
# print(res)
num = collections.Counter(s)
# print(num)
num_r = num["R"]
num_g = num["G"]
num_b = n - num_r - num_g
count_2 = 0
for x in range(1,int(n/2)+1):
    for i in range(n-2*x):
        # print(x)
        # print(i)
        # print()
        if (i + 2 * x < n and s[i] != s[i + x] and s[i + x] != s[i + 2 * x] and s[i] != s[i + 2 * x] ):
            count_2 += 1
            # print(x)
            # print(i)
            # print()

res = num_r * num_g * num_b - count_2
# print(num_r)
# print(num_g)
# print(num_b)
print(res)

Buggy submission (verdict: Runtime Error):
import collections

n = int(input())
s = input()
res = 0
# for i in range(0, n):
#     for j in range(i+1,n):
#         if s[i] != s[j]:
#             for k in range(j+1,n):
#                 if j-i!=k-j and s[i] != s[k] and s[j] != s[k]:
#                     res += 1
#
# print(res)
num = collections.Counter(s)
# print(num)
num_r = num["R"]
num_g = num["G"]
num_b = n - num_r - num_g
count_2 = 0
for x in range(1,int(n/2)+1):
    for i in range(n-2*x-i):
        # print(x)
        # print(i)
        # print()
        if (i + 2 * x < n and s[i] != s[i + x] and s[i + x] != s[i + 2 * x] and s[i] != s[i + 2 * x] ):
            count_2 += 1
            # print(x)
            # print(i)
            # print()

res = num_r * num_g * num_b - count_2
# print(num_r)
# print(num_g)
# print(num_b)
print(res)
Problem p02639 (python)

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

ans_ind = 0
for i in range(5):
    if x[i] == 0:
        ans_ind = i + 1

print(ans_ind)

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

ans_ind = 0
for i in range(5):
    if x[i] == 0:
        ans_ind = i + 1

print(ans_ind)

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

ans_ind = 0
for i in range(5):
    if x[i] == 0:
        ans_ind = i + 1

print(ans_ind)
Problem p03294 (python)

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

# lcm_num = lcm(a[0], a[1])
# 
# for i in range(2, n):
#     lcm_num = lcm(lcm_num, a[i])

ans = 0
for i in range(n):
    ans += a[i] - 1

print(int(ans))

Buggy submission (verdict: Runtime Error):
import sys

# 最大公約数
def gcd(a, b):
  while b > 0:
    a, b = b, a%b
  return a

# 最小公倍数
def lcm(a, b):
  return a*b/gcd(a, b)

n = int(input())
a = list(map(int,input().split())).sort()

lcm_num = lcm(a[0], a[1])

for i in range(2, n):
    lcm_num = lcm(lcm_num, a[i])

ans = 0
for i in range(n):
    ans += (lcm_num-1) % a[i]

print(int(ans))

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
  while b > 0:
    a, b = b, a%b
  return a

def lcm(a, b):
  return a*b/gcd(a, b)

n = int(input())
a = list(map(int,input().split()))


lcm_num = lcm(a[0], a[1])

for i in range(2, n):
    lcm_num = lcm(lcm_num, a[i])

ans = 0
for i in range(n):
    ans += (lcm_num-1) % a[i]

print(int(ans))
Problem p02641 (python)

Fixed submission:
#C
X,N = map(int,input().split())
p = list(map(int,input().split()))
r = 101
for i in range(101,-1,-1):
    if i in p:
        pass
    else:
        if abs(r-X) >= abs(i-X):
            r = i
print(r)

Buggy submission (verdict: Runtime Error):
#C
X,N = map(int,input().split())
p = list(map(int,input().split()))
r = max(100,max(p),abs(min(p)))
for i in range(max(min(min(p)-2,-1),101),min(min(p)-2,-1),-1):
    if i in p:
        pass
    else:
        if abs(r-X) >= abs(i-X):
            r = i
        else:
            pass
print(r)

Buggy submission (verdict: Runtime Error):
#C
X,N = map(int,input().split())
p = list(map(int,input().split()))
r = (max(100,max(p),abs(min(p))))
for i in range(101,min(min(p)-2,-1),-1):
    if i in p:
        pass
    else:
        if abs(r-X) >= abs(i-X):
            r = i
        else:
            pass
print(r)

Buggy submission (verdict: Runtime Error):
#C
X,N = map(int,input().split())
p = list(map(int,input().split()))
r = 100
for i in range(100,min(min(p)-2,-1),-1):
    if i in p:
        pass
    else:
        if abs(r-X) >= abs(i-X):
            r = i
        else:
            pass
print(r)

Buggy submission (verdict: Runtime Error):
#C
X,N = map(int,input().split())
p = list(map(int,input().split()))
r = 100
for i in range(100,min(p)-2,-1):
    if i in p:
        pass
    else:
        if abs(r-X) >= abs(i-X):
            r = i
        else:
            pass
print(r)
Problem p02628 (python)

Fixed submission:
N,K = map(int, input().split())
*a, = map(int, input().split())
print (sum(sorted(a)[:K]))

Buggy submission (verdict: Runtime Error):
N, K = int(input().split())
juice = []
for i in range(N):
    juice.append(list(input().split()))
juice.sort()
print (sum(juice[0:K]))

Buggy submission (verdict: Runtime Error):
N, K = int(input().split())
juice = []
for i in range(N):
    juice.append(list(input().split()))
juice.sort()
for i in range(K):
  print (juice[0:K])

Buggy submission (verdict: Runtime Error):
N, K = int(input().split())
juice = []
for i in range(N):
    juice.append(list(map(int,input().split())))
juice.sort()
for i in range(K):
  print (juice[0] + juice[1] + juice[2])
Problem p02658 (python)

Fixed submission:
n = int(input())
num_list=list(map(int,input().split()))
ans = 1
flg = True
if 0 in num_list:
  print("0")
else:
  for i in range(n):
    ans = ans*num_list[i]
  
    if ans > 10**18:
      print("-1")
      flg = False
      break
  if flg:
    print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
num_list=list(map(int,input().split()))
ans = 1
for i in n:
  ans = ans*num_list[i]
if ans <1000000000000000000:
  print(ans)
else:
  print("-1")

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
ans = n *m
if ans <1000000000000000000:
  print(ans)
else:
  print("-1")
Problem p03457 (python)

Fixed submission:
time = int(input())
jorney = [list(map(int,input().split())) for i in range(time)]
flg = True
x_before = 0
y_bfefore =0
t_before = 0

for point in jorney:
    t = point[0]
    x = point[1]
    y = point[2]
    distance = abs(x- x_before) + abs(y - y_bfefore)
    interval = t - t_before
    
    
    if t %2 == (x+y)%2 and interval >= distance:
        t_before=t
        x_before=x
        y_bfefore=y

        continue
    else:
        flg=False
        break
if flg:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
time = int(input())
jorney = [list(map(int,input().split())) for i in range(time)]
flg = True
x_before = 0
y_bfefore =0
t_before = 0

for point in jorney:
    time = point[0]
    x = point[1]
    y = point[2]
    distance = x- x_before + y - y_bfefore
    interval = t - t_before
    
    
    if t %2 == (x+y)%2 and interval >= distance:
        t_before=t
        x_before=x
        y_bfefore=y

        continue
    else:
        flg=False
        break
if flg:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
time = int(input())
jorney = [list(map(int,input().split())) for i in range(time)]
flg = True
x_before = 0
y_bfefore =0
t_before = 0

for point in jorney:
    time = point[0]
    x = point[1]
    y = point[2]
    distance = x- x_before + y - y_bfefore
    interval = time - time_before
    
    
    if time %2 == (x+y)%2 and interval = distance:
        time_before=time
        x_before=x
        y_bfefore=y

        continue
    else:
        flg=False
        break
if flg:
    print("YES")
else:
    print("NO")
Problem p03493 (python)

Fixed submission:
a = list(map(int,input()))
b= sum(a)
print(b)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = list(map(int,input().split()))
ans = 0
x = True
while x:
  for i in range(a):
    if b[i] %2 ==1:
      x=False
      break
    b[i] = b[i] /2
    ans +=1
ans = ans//a
  

print(ans)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = list(map(int,input().split()))
ans = 0
while sum(b)%2 ==0:
  ans +=1
  b=[ i/2 for i in b]
print(ans)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = list(map(int,input().split()))
b.sort()
ans = 0
n = b[0]
while n % 2 ==0:
	ans +=1
	n = n/2
print(ans)
Problem p02646 (python)

Fixed submission:
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
if abs(b-a) - (v-w)*t <= 0:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
if abs(b-a) - (v-w)*t <= 0:
    print("YES")
ekes:
    print("NO")
Problem p02675 (python)

Fixed submission:
n = str(input())
if n[-1] == "2" or n[-1] == "4" or n[-1] == "5" or n[-1] == "7" or n[-1] == "9":
    print("hon")
elif n[-1] == "0" or n[-1] == "1" or n[-1] == "6" or n[-1] == "8":
    print("pon")
else:
    print("bon")

Buggy submission (verdict: Runtime Error):
import math
a, b, h, m = map(int, input().split())
time = m + h*60
angle = time * 0.5 - time * 6
radian = math.radians(angle)
rad = math.cos(radian)
ans = a**2 + b**2 - 2*a*b*rad
print(math.sqrt(ans))
Problem p02677 (python)

Fixed submission:
import math
a, b, h, m = map(int, input().split())
time = m + h*60
angle = time * 0.5 - time * 6
radian = math.radians(angle)
rad = math.cos(radian)
ans = a**2 + b**2 - 2*a*b*rad
print(math.sqrt(ans))

Buggy submission (verdict: Runtime Error):
import math
a, b, h, m = map(int, input().split())
time = m + h*60
angle = time * 0.5 - time * 6
radian = math.radians(angle)
rad = math.cos(radian)
ans = b**2 + c**2 - 2*a*b*rad
print(math.sqrt(ans))
Problem p02718 (python)

Fixed submission:
n, m = map(int,input().split())
a = list(map(int,input().split()))
s = sum(a) #sにaの総投票数
a.sort(reverse=True) #aを降順にソート
if a[m-1] >= s*(1/(4*m)):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n, m = map(int,input().split())
a = list(map(int,input().split()))
s = sum(a) #sにaの総投票数
a.sort(reserve=True)#aを降順にソート
if a[m-1] >= s*(1/4):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n, m = map(int,input().split())
a = list(map(int,input()split()))
s = sum(a) #sにaの総投票数
a.sort(reserve=True)#aを降順にソート
if a[m-1] >= s*(1/4):
    print("Yes")
else:
    print("No")
Problem p02719 (python)

Fixed submission:
n, k = map(int, input().split())
m = n%k
print(min(m,k-m))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
A = list(map(int, input().split()))
all_vote = sum(A)
cnt = 0
for a in A:
    if a * 4 * m >= all_vote:#1/4mを4m倍したときとおきかえて計算(整数にするため)
        cnt += 1
if cnt >= m:
    print("Yes")
else:
    print("No")
Problem p02778 (python)

Fixed submission:
s = str(input())
string = list(s)
cnt = len(string)
print("x" * cnt)

Buggy submission (verdict: Runtime Error):
s = st(input())
string = list(s)
cnt = sum(string)
print("x" * int(cnt))

Buggy submission (verdict: Runtime Error):
s = st(input())
string = list(s)
cnt = sum(string)
print("x" * int(cnt))

Buggy submission (verdict: Runtime Error):
s = st(input())
string = list(s)
cnt = sum(string)
print("x" * cnt)
Problem p02842 (python)

Fixed submission:
n = int(input())
for i in range(50000):
    if int(i*1.08) == n:
        print(i)
        exit()
print(":(")

Buggy submission (verdict: Runtime Error):
n = int(input())
price = n *25 / 27
p = price.is_integer()
if p = True:
    print(price // 1)
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
n = int(input())
price = n *25 / 27
if price.is_integer() = True:
    print(price // 1)
else:
    print(":(")
Problem p02957 (python)

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

Buggy submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())
if (b-a) % 2 == 0:
    print(floor((a+b) / 2))
else:
    print("IMPOSSIBLE")
Problem p03102 (python)

Fixed submission:
n, m, c = map(int, input().split())
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(n)]
ans = 0
for i in range(n):
    total = c
    for j in range(m):
        total += A[i][j] * B[j]
    if total > 0:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, m, c = map(int, input().split())
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(n)]
ans = 0
for i in range(n):
    total = c
    for j in range(m):
        total += a[i][j] * b[j]
    if total > 0:
        ans += 1
print(ans)
Problem p03971 (python)

Fixed submission:
p = 0
f = 0
n, a, b = map(int, input().split())
for i in input():
    if i == "a" and p < a+b:
        p += 1
        print("Yes")
    elif i == "b" and p < a+b and f < b:
        p += 1
        f += 1
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
p = 0
n, a, b = map(int, input().split())
for i in input():
    if i == "a" and p < a+b:
        p += 1
        print("Yes")
    elif i == "b" and p < a+b and f < b:
        f += 1
        p += 1
        print("Yes")
    else:
        print("No")
Problem p03273 (python)

Fixed submission:
h,w = input().split()
h = int(h)
w = int(w)
inp = []
count = 0
for i in range(h):
    tmp_input = list(input())
    if '#' in tmp_input:
        inp.append(tmp_input)
    else:
        count += 1
inp2 = list(map(list,zip(*inp)))
youso = []
for i in range(w):
    if "#" in inp2[i]:
        pass
    else:
        youso.append(i)
youso.reverse()
if len(youso) != 0:
    for i in range(len(youso)):
        for j in range(h-count):
            del inp[j][youso[i]]
else:
    pass
for i in range(len(inp)):
    mojiretu = ''.join(inp[i])
    print(mojiretu)

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
a = [input() for w in range(h)]

for i in range(h)[::-1]:
    if "#" not in a[i]:
        del a[i]
        h -= 1
print(a)

n = []
for j in range(w):
    print("j=" + str(j))
    m = ["".join(t[j] for t in a)]
    if "#" in m[0]:
        n += m
print(n)

for k in range(h):
    print("".join(n[k]))
Problem p03282 (python)

Fixed submission:
s = list(input())
k = int(input())
if '1' not in s:
    print(s[0])
else:
    num = 0
    for i in range(len(s)):
        if s[0] == "1":
            s.pop(0)
            num += 1
        else:
            break
    if num >= k:
        print(1)
    else:
        print(s[0])

Buggy submission (verdict: Runtime Error):
s = list(input())
k = int(input())
if '1' in s and s.index('1') == 0 :
    print(s[1])
else:
    print(s[0])
Problem p02630 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
S = sum(A)
L = [0] * 100001
for i in A:
    L[i] += 1
Q = int(input())
for i in range(Q):
    B, C = map(int, input().split())
    S += (C - B) * L[B]
    L[C] += L[B]
    L[B] = 0
    print(S)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
S = sum(A)
L = [0] * 100001
for i in A:
    L[i] += 1
Q = int(input())
for i in range(Q):
    B, C = map(int, input().split())
    S += (C - B) * L[B]
    L[C] += Ct[B]
    L[B] = 0
    print(S)
Problem p02628 (python)

Fixed submission:
import numpy as np
n, k = list(map(int, input().rstrip().split()))
p = list(map(int, input().rstrip().split()))
p = np.sort(np.array(p))
 
print(np.sum(p[:k]))

Buggy submission (verdict: Runtime Error):
import numpy as np
n, k = list(map(int, input().rstrip().split()))
p = list(map(int, input().rstrip().splist()))
p = np.sort(np.array(p))

print(np.sum(p[:k]))
Problem p02647 (python)

Fixed submission:
import numpy as np
from numba import njit

N, K = list(map(int, input().strip().split()))
A = np.array(input().strip().split(), dtype=np.int64)

@njit(cache=True)
def calc(a, step):
    b = np.array([0]*N)
    for i in range(N):
        left = int(max(0, i-a[i]))
        right = int(min(N-1, i+a[i]))
        b[left] += 1
        if right + 1 < N:
            b[right+1] -= 1
    b = np.cumsum(b)
    
    if np.all(a==b) or step>=K:
        return b
    else:
        step += 1
        return calc(b, step)

ans = calc(A, 1)
ans = [str(x) for x in ans]
print(" ".join(ans))

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

N, K = list(map(int, input().strip().split()))
a = np.array(input().strip().split(), dtype=int)

@njit(cache=True)
def solve(a):
    def calc(a):
        b = np.array([0]*N)
        for i in range(N):
            left = int(max(0, i-A[i]))
            right = int(min(N-1, i+A[i]))
            b[left:right+1] +=1
        return b.copy()
    
    for _ in range(K):
        a = calc(a)
    return a
    
ans = calc(a, 1)
ans = [str(x) for x in ans]
print(" ".join(ans))
Problem p02747 (python)

Fixed submission:
s = input().rstrip()
h = ['hi' * i for i in range(1,6)]

if s in h:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
A, B, M = list(map(int, input().rstrip().split()))
a = list(map(int, input().rstrip().split()))
b = list(map(int, input().rstrip().split()))

cost=[]
for _ in range(M):
    x, y, c = list(map(int, input().rstrip().split()))
    tot = a[x-1] + b[y-1] - c
    cost.append(tot)
    
cost.append(min(a)+min(b))
print(min(cost))
Problem p02999 (python)

Fixed submission:
x, a = map(int, input().rstrip().split())
if x < a:
  print(0)
else:
  print(10)

Buggy submission (verdict: Runtime Error):
n ,x = map(int, input().rstrip().split())
l = map(int, input().rstrip().split())
d=0
count = 1
for i in range(n):
    d += l[i]
    if d > x:
        continue
    count+=1
    
print(count)

Buggy submission (verdict: Runtime Error):
x, a = map(int, input().sprit().split())
if x < a:
  print(10)
else:
  print(0)
Problem p02628 (python)

Fixed submission:
N, K = map(int, input().split())
p = [int(i) for i in input().split()]
p.sort()
total = 0
for i in p[:int(K)]:
  total += i
  
print(total)

Buggy submission (verdict: Runtime Error):
N, K = input().split()
p = [int(i) for i in input().split()]
p_ascending = p.sort()
total = 0
for i in p_ascending[0,int(K)]:
  total += i
  
print(total)

Buggy submission (verdict: Runtime Error):
N, K = int(input())
p = [int(i) for i in input().split()]
p_ascending = p.sort()
total = 0
for i in p_ascending[0,K]:
  total += i
  
print total