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

Fixed submission:
b = input()
 
if b == 'A':
  print('T')
elif b =='T':
  print('A')
elif b == 'C':
  print('G')
else:
  print('C')

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

if b == 'A'{
  print('T')
}else if b =='T'{
  print('A')
}else if b == 'C'{
  print('C')
}else{
  print('G')
}
Problem p03089 (python)

Fixed submission:
N = int(input())
B = list(map(int,input().split()))
 
ans = []
while B:
    for i in range(len(B)-1, -1, -1):
        b = B[i]
        if i+1 == b:
            ans.append(i+1)
            break
    else:
        print(-1)
        exit()
    del B[i]
    
for idx in range(0, N):
	tmp = ans.pop(-1)
	print(tmp)

Buggy submission (verdict: Runtime Error):
N = int(input())
B = list(map(int,input().split()))
 
ans = []
while B:
    for i in range(len(B)-1, -1, -1):
        b = B[i]
        if i+1 == b:
            ans.append(i+1)
            break
    else:
        print(-1)
        exit()
    del B[i]

ans.reverse()
for an in range(0, N+1):
	tmp = ans.pop(0)
	print(tmp)

Buggy submission (verdict: Runtime Error):
N = input()
print(N)
b = list(map(int,input().split()))
print(b)
a = [][]

for i in range(N):
  for j in range(i):
 	if 1 <= j || j <= i:
      a[i][j] = j
      
ans = -1
for i in range(N):
  if a == b :
    ans = a[i][:]
      
return ans
Problem p03101 (python)

Fixed submission:
def main():
    H, W = map(int,input().split())
    h, w = map(int,input().split())

    point = W * H

    delete_h = h * W
    delete_w = w * H

    kaburi = h * w

    ans = point - (delete_h + delete_w - kaburi)
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    W, H = map(i,input().split())
    h, w = map(i,input().split())

    point = W * H

    delete_h = h * W
    delete_w = w * H

    kaburi = h * w

    ans = point - (delete_h + delete_w - kaburi)


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

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

    count = int(b / a)
    if count < c :
        print(count)
    else:
        print(c)

if __name__ == '__main__':
    main()

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

    count = b / a
    if count < c :
        print(count)
    else:
        print(c)

if __name__ == '__main__'
    main()

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

    b / a = count
    if count < c :
        print(count)
    else:
        print(c)

if __name__ == '__main__'
    main()
Problem p03161 (python)

Fixed submission:
# coding:utf-8
import numpy as np
n,k = map(int, input().split())
h = list(map(int, input().split()))
dp = np.zeros(n, dtype=int)
h = np.array(h)

def main():
    #今判明しているtable
    for i in range(1,n):
        start = max(0, i-k)
        dp[i] = min(dp[start: i] + np.abs(h[i] - h[start:i]))
    
    print(dp[n-1])

if __name__ == '__main__' :
    main()

Buggy submission (verdict: Runtime Error):
# coding:utf-8
n,k = map(int, input().split())
h = list(map(int, input().split()))
dp = [float('inf')] * n

#後者が前者よりも小さい時に更新→DPテーブルをinfに初期化(先頭は0)
def chmin(a,b):
    if(a > b):
        return b
    else:
        return a

def main():
    dp[0] = 0
    #今判明しているtable
    for i in range(n):
        #nextstep
        for j in range(1,k):
            dp[i+j] = chmin(dp[i+j], dp[i]+abs(h[i]-h[i+j]))
    
    print(dp[n-1])

if __name__ == '__main__' :
    main()

Buggy submission (verdict: Runtime Error):
# coding:utf-8
n,k = map(int, input().split())
h = list(map(int, input().split()))
dp = [float('inf')] * n

#後者が前者よりも小さい時に更新→DPテーブルをinfに初期化(先頭は0)
def chmin(a,b):
    if(a > b):
        return b
    else:
        return a

def main():
    dp[0] = 0
    #今判明しているtable
    for i in range(n):
        #nextstep
        for j in range(1,n):
            dp[i+j] = chmin(dp[i+j], dp[i]+abs(h[i]-h[i+j]))
    
    print(dp[n-1])

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

Fixed submission:
import sys
import numpy as np
N, W = map(int, input().split())
def knapsack(n, w):
    # dp[i][j] : i番目の品物で重さj以下の価値の最大値
    dp = np.zeros([N+1, W+1], dtype='int64')
    # forは関数の中で回す。
    for i in range(N):
        w, v = map(int, input().split())
        # i+1番目でwより小さい場合は、i番目と変更なし
        dp[i+1][:w] = dp[i][:w]
        dp[i+1][w:] = np.maximum(dp[i][w:], dp[i][:-w] + v)
    return dp[-1][-1]

print(knapsack(N, W))

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
N, W = map(int, input().split())
def knapsack(n, w):
    # dp[i][j] : i番目の品物で重さj以下の価値の最大値
    dp = np.zeros([N+1, W+1], dtype='int64')
    # forは関数の中で回す。
    for i in range(N):
        w, v = map(int, input().split())
        # i+1番目でwより小さい場合は、i番目と変更なし
        dp[i+1][:w] = dp[i][:w]
        dp[i+1][w:] = np.maximum(dp[i][w:], dp[i][:w] + v)
    return dp[-1][-1]

print(knapsack(N, W))

Buggy submission (verdict: Runtime Error):
n,w = map(int, input().split())
lst_weight = [0 for _ in range(n)]
lst_value = [0 for _ in range(n)]
for i in range(n):
    lst_weight[i], lst_value[i] = map(int, input().split())
dp = [[0 for i in range(w)] for j in range(n+1)]

#後者が前者よりも大きい時に更新→DPテーブルを-infに初期化
def chmax(a,b):
    if(a< b):
        return b
    else:
        return a

#各品物の選択
for i in range(n):
    for sum_w in range(w+1):
        #選択した品物を加える
        if sum_w >= lst_weight[i]:
            #今回の手の暫定最大値と1つ前までの手の確定最大値を比較する
            dp[i+1][sum_w] = chmax(dp[i+1][sum_w], dp[i][sum_w-lst_weight[i]] + lst_value[i])
        else:
            # i番目の品物を選ばない→前までの手で最適化されている最大値が次の手の最大値になるはず
            dp[i+1][sum_w] = chmax(dp[i+1][sum_w], dp[i][sum_w])
            
print(dp[n][w])

Buggy submission (verdict: Runtime Error):
n,w = map(int, input().split())
lst_weight = [0 for _ in range(N)]
lst_value = [0 for _ in range(N)]
for i in range(N):
    lst_weight[i], lst_value[i] = map(int, input().split())
dp = [[0 for i in range(w)] for j in range(n+1)]

#後者が前者よりも大きい時に更新→DPテーブルを-infに初期化
def chmax(a,b):
    if(a< b):
        return b
    else:
        return a

#各品物の選択
for i in range(n):
    for sum_w in range(w+1):
        #選択した品物を加える
        if sum_w >= lst_weight[i]:
            #今回の手の暫定最大値と1つ前までの手の確定最大値を比較する
            dp[i+1][sum_w] = chmax(dp[i+1][sum_w], dp[i][sum_w-lst_weight[i]] + lst_value[i])
        else:
            # i番目の品物を選ばない→前までの手で最適化されている最大値が次の手の最大値になるはず
            dp[i+1][sum_w] = chmax(dp[i+1][sum_w], dp[i][sum_w])
            
print(dp[n][w])
Problem p03210 (python)

Fixed submission:
def main():
    N = int(input())

    if N in [7,5,3]:
        print('YES')
    else:
        print('NO')


if __name__ == '__main__' :
    main()

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

    if N in N==3 or N==5 or N==7:
        print('YES')
    else:
        print('NO')


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

Fixed submission:
import sys

def odd_def(num):
    if num % 2 == 0:
        return False
    else:
        return True

def main():
    a,b = map(int, input().split())
    for c in range(1,4):
        mal = a*b*c
        if odd_def(mal):
            print('Yes')
            sys.exit()
    print('No')


if __name__ == '__main__' :
    main()

Buggy submission (verdict: Runtime Error):
def main():
    a,b = map(int, input().split())
  if (a*b) % 2== 1:
      print("Yes")
  else:
      print('No')
 
 
 
if __name__ == '__main__' :
    main()

Buggy submission (verdict: Runtime Error):
def main():
    a,b = map(int, input().split())
  if (a*b) % 2== 1:
      print("Yes")
  else:
      print('No")



if __name__ == '__main__' :
    main()

Buggy submission (verdict: Runtime Error):
import sys

def odd_def(num):
    if num % 2 == 0:
        return False
    else:
        return True

def main():
    a,b = map(int, input().split())
    for i in range(1,4):
        mal = a*b*c
        if odd_def(mal):
            print('Yes')
            sys.exit()
    print('No')


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

Fixed submission:
# coding:utf-8
import sys 
def main():
    input_list = list(map(int, input().split()))
    input_list.sort(reverse=True)
    
    diff = input_list[0] - input_list[1] + input_list[0] - input_list[2]
    ans = diff /2
    if diff % 2 == True:
        ans += 2

    print(int(ans))
    
if __name__ == '__main__' :
    main()

Buggy submission (verdict: Runtime Error):
# coding:utf-8
import sys 
def main():
    input_list = list(map(int, input().split()))
    input_list.sort(reverse=True)
    
    diff = input_list[0] - input_list][1] + input_list[0] - input_list[2]
    ans = diff /2
    if diff % 2 == True:
        ans += 2

    print(ans) 
    
if __name__ == '__main__' :
    main()
Problem p03455 (python)

Fixed submission:
# coding:utf-8
def main():
    a,b = map(int, input().split())

    if a*b % 2 == 0:
        print('Even')
    else : print('Odd')


if __name__ == '__main__' :
    main()

Buggy submission (verdict: Runtime Error):
# coding:utf-8
def main():
    a = list(input())
    b = list(input())

    if a*b % 2 == 0:
        print('Even')
    else : print('Odd')


if __name__ == '__main__' :
    main()

Buggy submission (verdict: Runtime Error):
# coding:utf-8
def main():
    a = list(input())
    b = list(input())

    if a*b % 2:
        print('Even')
    else : print('Odd')


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

Fixed submission:
# coding:utf-8
import sys 
def main():
    n = int(input())
    t = [0]*(n+1)
    x = [0]*(n+1)
    y = [0]*(n+1)
    for i in range(1,n+1):
        t[i],x[i],y[i]=map(int,input().split())

    for i in range(1,n+1):
        idou  =  abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
        jikan = t[i]-t[i-1]
        if idou > jikan:
            print('No')
            exit()
        elif jikan %2 != idou%2:
            print('No')
            exit()
    print('Yes')


if __name__ == '__main__' :
    main()

Buggy submission (verdict: Runtime Error):
# coding:utf-8
import sys 
def main():
    n = int(input())
    t = [0]*n+1
    x = [0]*n+1
    y = [0]*n+1
    for i in range(1,n+1):
        t[i],x[i],y[i]=map(int,input().split())

    for i in range(2,n+1):
        idou  =  abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
        jikan = t[i]-t[i-1]
        if idou > jikan:
            print('No')
            exit()
        elif jikan %2 != idou%2:
            print('No')
            exit()
    print('Yes')


if __name__ == '__main__' :
    main()

Buggy submission (verdict: Runtime Error):
# coding:utf-8
import sys 
def main():
    n = int(input())
    t = [0]*n
    x = [0]*n
    y = [0]*n
    for i in range(1,n+1):
        t[i],x[i],y[i]=map(int,input().split())

    for i in range(2,n+1):
        idou  =  abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
        jikan = t[i]-t[i-1]
        if idou > jikan:
            print('No')
            exit()
        elif jikan %2 != idou%2:
            print('No')
            exit()
    print('Yes')


if __name__ == '__main__' :
    main()

Buggy submission (verdict: Runtime Error):
# coding:utf-8
import sys 
def main():
    n = int(input())
    t = [0]*n
    x = [0]*n
    y = [0]*n
    for i in range(n):
        t[i],x[i],y[i]=map(int,input().split())

    for i in range(1,n+1):
        idou  =  abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
        jikan = t[i]-t[i-1]
        if idou > jikan:
            print('No')
            exit()
        elif jikan %2 != idou%2:
            print('No')
            exit()
    print('Yes')


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

Fixed submission:
import numpy as np
import decimal

a, b, c = map(decimal.Decimal, input().split())

if((a+b+(np.sqrt(a)*np.sqrt(b)*2)) < c):
	print('Yes')
else:
	print('No')

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

a, b, c = input().split()
a = int(a)
b = int(b)
c = int(c)

if((a>c or b>c or (a+b)>c):
	print('No')
elif((a+b+(np.sqrt(a*b)*2)) < c):
	print('Yes')
else:
	print('No')
Problem p02742 (python)

Fixed submission:
h, w = (int(x) for x in input().split())
if h == 1 or w == 1:
    odd_row = 0
    even_row = 0
    total = 1
elif w%2 == 0:
    odd_row = w // 2
    even_row = odd_row
    total = (h//2)*even_row + (h-h//2)*odd_row
else:
    odd_row = w // 2 + 1
    even_row = odd_row - 1
    total = (h//2)*even_row + (h-h//2)*odd_row
print(total)

Buggy submission (verdict: Runtime Error):
input_num = input()
split = input_num.split(' ')
h = int(split[0])
w = int(split[1])
odd_row = w // 2 +1
even_row = odd_row - 1
total = 0
for i in range(h, start=1):
    if i%2 = 0:
        total += even_row
    else:
        total += odd_row
print(total)

Buggy submission (verdict: Runtime Error):
h, w = int(x) for x in input().split()
odd_row = w // 2 +1
even_row = odd_row - 1
total = 0
for i in range(h, start=1):
    if i%2 = 0:
        total += even_row
    else:
        total += odd_row
print(total)
Problem p02812 (python)

Fixed submission:
n=int(input())
s=str(input())

count=0
for i in range(n-2):
    if s[i]=="A":
        if s[i+1]=="B":
            if s[i+2]=="C":
                count+=1

print(count)

Buggy submission (verdict: Runtime Error):
n=map(int,input())
s=str(input())

count=0
for i in range(n-2):
    if s[i]=="A":
        if s[i+1]=="B":
            if s[i+2]=="C":
                count+=1

print(count)

Buggy submission (verdict: Runtime Error):
n=map(int,input())
s=list(map(str,input()))

count=0
for i in range(n-2):
    if s[i]=="A":
        if s[i+1]=="B":
            if s[i+2]=="C":
                count+=1

print(count)
Problem p03071 (python)

Fixed submission:
a,b=map(int,input().split())
cnt=0
for i in range(2):
    if a>=b:
        cnt+=a
        a-=1
    else:
        cnt+=b
        b-=1
print(cnt)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
cnt=0
for i in range(2):
if a>=b:
    cnt+=a
    a-=1
else:
    cnt+=b
    b-=1
return (cnt)
Problem p02795 (python)

Fixed submission:
import math as m

h=int(input())
w=int(input())
k=int(input())

large=max(h,w)
print(m.ceil(k/large))

Buggy submission (verdict: Runtime Error):
import math as m
h,w,k = map(int,input().split())

large=max(h,w)
print(m.ceil(k/large))
Problem p02801 (python)

Fixed submission:
s=input()
print(chr(ord(s)+1))

Buggy submission (verdict: Runtime Error):
from itertools import combinations as cc

n,k = map(int,input().split())

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

total=0
mod = 10**9+7
for i in list(cc(a,k)):
	maxx=max(i)%mod
	minx=min(i)%mod
	total=(total%mod+(maxx-minx)%mod)%mod
	
print(total)
Problem p03160 (python)

Fixed submission:
import sys

n = int(input())
a = list(map(int,input().split()))
dp = [sys.maxsize]*(n)
dp[0] = 0
for i in range(n-1):
  for j in (i+1,i+2):
    if j<n:
      dp[j] = min(dp[j],dp[i]+abs(a[i]-a[j]))

print(dp[n-1])

Buggy submission (verdict: Runtime Error):
def solve(a,dp,n):
  if n==0 or n==1:
    return 0
  if n==2:
    dp[n]=abs(a[0]-a[1])
    return abs(a[0]-a[1])
  if dp[n]>0:
    return dp[n]
  opt1 = abs(a[n-1]-a[n-1-1])+solve(a,dp,n-1)
  opt2 = abs(a[n-1]-a[n-2-1])+solve(a,dp,n-2)
  output = min(opt1,opt2)
  dp[n]=output
  return output

n = int(input())
a = list(map(int,input().split()))
dp = [0]*(n+1)
print(solve(a,dp,n))

Buggy submission (verdict: Runtime Error):
def solve(a,dp,n):
  if n==0 or n==1:
    return 0
  if n==2:
    return abs(a[0]-a[1])
  if dp[n]>0:
    return dp[n]
  opt1 = abs(a[n-1]-a[n-1-1])+solve(a,dp,n-1)
  opt2 = abs(a[n-1]-a[n-2-1])+solve(a,dp,n-2)
  output = min(opt1,opt2)
  dp[n]=output
  return output

n = int(input())
a = list(map(int,input().split()))
dp = [0]*(n+1)
print(solve(a,dp,n))

Buggy submission (verdict: Runtime Error):
def solve(a,dp,n):
  if n==0 or n==1:
    return 0
  if n==2:
    return abs(a[0]-a[1])
  if dp[n]>0:
    return dp[n]
  opt1 = abs(a[n]-a[n-1])+solve(a,dp,n-1)
  opt2 = abs(a[n]-a[n-2])+solve(a,dp,n-2)
  output = min(opt1,opt2)
  dp[n]=output
  return output

n = int(input())
a = list(map(int,input().split()))
dp = [0]*(n+1)
print(solve(a,dp,n-1))

Buggy submission (verdict: Runtime Error):
def solve(a,dp,n):
  if n==0 or n==1:
    return 0
  if n==2:
    return abs(a[0]-a[1])
  if dp[n]>0:
    return dp[n]
  opt1 = abs(a[0]-a[1])+solve(a[1:],dp,n-1)
  opt2 = abs(a[0]-a[2])+solve(a[2:],dp,n-2)
  output = min(opt1,opt2)
  dp[n]=output
  return output

n = int(input())
a = list(map(int,input().split()))
dp = [0]*(n+1)
print(solve(a,dp,n))
Problem p03162 (python)

Fixed submission:
n = int(input())

days=[]
dp = [0]*3
for _ in range(n):
  a = list(map(int,input().split()))
  days.append(a)

for i in range(3):
  dp[i]=days[0][i]
  
#rint(dp)
for cday in range(1,n):
  pday = cday-1
  t = [0]*3
  for i in range(3):
    max_val = dp[i]
    for j in range(3):
      if i!=j:
        cur_val = dp[j] + days[cday][i]
        if cur_val>max_val:
          max_val=cur_val
    
    t[i] = max_val
  dp=t
  #rint(dp)
  	
print(max(dp))

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


days = [] 
for _ in range(n):
  temp = list(map(int,input().split()))
  days.append(temp)
  
dp = [0]*n

for i in range(3):
  dp[i]= days[0][i]
#print(dp) 
for cur_day in range(1,n):
  m = [0]*n
  for i in range(3):
    for j in range(3):
      if i!=j:
        m[i] = max(m[i],dp[j]+days[cur_day][i])
  dp = m
#  print(dp)
  
print(max(dp))

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


days = [] 
for _ in range(n):
  temp = list(map(int,input().split()))
  days.append(temp)
  
dp = [0]*n

for i in range(3):
  dp[i]= days[0][i]
#print(dp) 
for cur_day in range(1,n):
  m = [0]*n
  for i in range(3):
    for j in range(3):
      if i!=j:
        m[j] = max(m[j],dp[j]+days[cur_day][i])
  dp = m
#  print(dp)
  
print(max(dp))

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


days = [] 
for _ in range(n):
  temp = list(map(int,input().split()))
  days.append(temp)
  
dp = [0]*n

for i in range(3):
  dp[i]= days[0][i]
#print(dp) 
for cur_day in range(1,n):
  m = [0]*n
  for i in range(3):
    for j in range(3):
      if i!=j:
        m[i] = max(m[i],dp[j]+days[cur_day][j])
  dp = m
#  print(dp)
  
print(max(dp))
Problem p03166 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 9)
n , m = map(int,input().split())

g = [[] for i in range(n)]

dp = [-1] * n
for _ in range(m):
  v1, v2 = map(int,input().split())
  v1-=1 ; v2-=1
  g[v1].append(v2)

def dfs(i):
  if dp[i]!=-1:
    return dp[i]
  temp = 0
  for neighbour in g[i]:
    temp = max(temp, dfs(neighbour) + 1)
  dp[i]=temp
  return temp
  
res = 0
for i in range(n):
  res = max(res, dfs(i))

print(res)

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

g = [[] for i in range(n)]

dp = [-1] * n
for _ in range(m):
  v1, v2 = map(int,input().split())
  v1-=1 ; v2-=1
  g[v1].append(v2)

def dfs(i):
  if dp[i]!=-1:
    return dp[i]
  temp = 0
  for neighbour in g[i]:
    temp = max(temp, dfs(neighbour) + 1)
  dp[i]=temp
  return temp
  
res = 0
for i in range(n):
  res = max(res, dfs(i))

print(res)

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

g = [[] for i in range(n)]

for _ in range(m):
  v1, v2 = map(int,input().split())
  v1-=1 ; v2-=1
  g[v1].append(v2)

def dfs(i):
  temp = 0
  for neighbour in g[i]:
    temp = max(temp, dfs(neighbour) + 1)
  return temp
  
res = 0
for i in range(n):
  res = max(res, dfs(i))

print(res)
Problem p02761 (python)

Fixed submission:
N,M=(input()).split(" ")
N=(int)(N)
M=(int)(M)
sc={}

for i in range(N):
    sc[i]=-1

check=True

for i in range(M):
    s,c=(input()).split(" ")
    s=(int)(s)
    c=(int)(c)
    if sc[s-1]!=-1 and sc[s-1]!=c:
        check = False
        break
    else:
        sc[s-1]=c

if not(check):
    print(-1)
    exit()

if N!=1:
    

    ans=""
    if sc[0]==-1:
        ans+="1"
    elif sc[0]==0:
        print(-1)
        exit()
    else:
        ans+=str(sc[0])

    for i in range(N-1):
        if sc[i+1]==-1:
            ans+="0"
        else:
            ans+=str(sc[i+1])
    print(ans)
else:
    if sc[0]==-1:
        print(0)
    else:
        print(sc[0])

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

sc={}

for i in range(M):
    sc[i]=-1

check=True

for i in range(M):
    si,ci = input().split(" ")
    si = (int)(si)
    ci = (int)(ci)
    if sc[si-1]!=-1 and sc[si-1]!=ci:
        check = False
        break
    else:
        sc[si-1]=ci
#print(si)
if check and sc[0]!=0:
    ans=""
    if sc[0]==-1:
        ans+= "1"
    else:
        ans+=str(sc[0])
    
    for i in range(M-1):
        if sc[i+1]==-1:
            ans+="0"
        else:
            ans+=(str)(sc[i+1])
    print(ans)
else:
    print(-1)
Problem p02784 (python)

Fixed submission:
H,N = (input()).split(" ")
H=(int)(H)
N=(int)(N)
As = (input()).split(" ")
 
sum=0
 
for A in As:
  sum+=(int)(A)
  
if sum>=H:
  print("Yes")
else:
  print("No")

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

sum=0

for A in As:
  sum+=(int)(A)
  
if sum>=A:
  print("Yes")
else:
  print("No")
Problem p03606 (python)

Fixed submission:
N=input()
now=0
for i in range(0,(int)(N)):
    lr=(input()).split(' ')
    now=now+((int)(lr[1])-(int)(lr[0])+1)

print(now)

Buggy submission (verdict: Runtime Error):
N=input()
now=0
for i in range(0,N):
    lr=(input()).split(' ')
    now=now+((int)(lr[1])-(int)(lr[0])+1)

print(now)
Problem p03612 (python)

Fixed submission:
N=(int)(input())
p=(input()).split(' ')

count=0


now=1
for k in p:
    if (int)(k)==now:
        p[now-1:(now+1 if now<len(p) else now-3)]=[p[now-2],p[now-1]]
        count=count+1
    now=now+1

print(count)

Buggy submission (verdict: Runtime Error):
N=(int)(input())
p=(input()).split(' ')

count=0


now=1
for k in p:
    if (int)(k)==now:
        p[now-1:(now+1 if now<len(p) else now-3)]=[p[now],p[now-1]]
        count=count+1
    now=now+1

print(count)

Buggy submission (verdict: Runtime Error):
N=(int)(input())
p=(input()).split(' ')

count=0


now=1
for k in p:
    if (int)(k)==now:
        p[now-1:now+1]=[p[now],p[now-1]]
        count=count+1
    now=now+1

print(count)
Problem p03633 (python)

Fixed submission:
def uq(a,c):
    return c if a%c==0 else uq(c,a%c)

n=(int)(input())

result = 1

for j in range(0,n):
    f=(int)(input())
    result=((result//uq(result,f)))*f
    
print((int)(result))

Buggy submission (verdict: Runtime Error):
def uq(a,c):
    return c if a%c==0 else uq(c,a%c)

n=(int)(input())

result = 1

for j in range(0,n):
    f=(int)(input())
    result=((result/uq(result,f)))*f
    
print((int)(result))

Buggy submission (verdict: Runtime Error):
def uq(a,c):
    return c if a%c==0 else uq(c,a%c)

n=(int)(input())

result = 1

for j in range(0,n):
    f=(int)(input())
    result=((result*f/uq(result,f)))
    
print((int)(result))

Buggy submission (verdict: Runtime Error):
def uq(a,c):
    return c if a%c==0 else uq(c,a%c)

n=(int)(input())
T=[]

for i in range(0,n):
    T.append((int)(input()))

result = 1

for j in T:
    result=(int)((result*j)/uq(result,j))
    
print(result)
Problem p02778 (python)

Fixed submission:
print("x" * len(input()))

Buggy submission (verdict: Runtime Error):
print("x" * len(int(input())))
Problem p02936 (python)

Fixed submission:
def solve():
    cnt = [0] * int(2 * 1e5 + 10)
    li = []
    n, q = map(int, input().split())
    for _ in range(n - 1):
        a, b = map(int, input().split())
        li.append((a, b))
    for _ in range(q):
        p, x = map(int, input().split())
        cnt[p] += x
    for a, b in sorted(li):
        cnt[b] += cnt[a]
    print(*cnt[1 : n + 1])
solve()

Buggy submission (verdict: Runtime Error):
cnt = [0] * int(2 * 10e5 + 10)
li = [[] for _ in range(int(2 * 10e5 + 10))]
def f(a):
    global cnt, li
    for c in li[a]:
        cnt[c] += cnt[a]
        f(c)
def solve():
    global cnt, li
    n, q = map(int, input().split())
    for _ in range(n - 1):
        a, b = map(int, input().split())
        li[a].append(b)
    for _ in range(q):
        p, x = map(int, input().split())
        cnt[p] += x
    f(1)
    print(*cnt[1 : n + 1])
solve()