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

Fixed submission:
import sys


N = int(input())

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

dp = [float('inf')]*N

dp[0] = 0
#print(N)
#print(H)
#print(dp)


for i in range(1,N):
    if(i==1):
        dp[1] = abs(H[1]-H[0])
    else:
        dp[i] = dp[i-1]+abs(H[i]-H[i-1])
        if(dp[i] > dp[i-2]+abs(H[i]-H[i-2])):
            dp[i] = dp[i-2]+abs(H[i]-H[i-2])
        #
        #print(i,dp)

print(dp[-1])

#7
#2 9 4 5 1 6 10

Buggy submission (verdict: Runtime Error):
import sys

INF = float('inf')

def rec(i: int):
    #if(i==0):print(i,H[i])
    #if(i>=1):print(i,H[i],H[i-1])
    #if(i>=2):print(i,H[i],H[i-2])
    if dp[i] < INF:
        return dp[i]

    if i==0: return 0
    res = INF

    res = min(res, rec(i-1)+abs(H[i]-H[i-1]))

    if i > 1:
        res = min(res,rec(i-2)+abs(H[i]-H[i-2]))

    dp[i] = res
    return dp[i]

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

dp = [INF] * (N+2)

print(rec(N-1))

#7
#2 9 4 5 1 6 10

Buggy submission (verdict: Runtime Error):
import sys

def rec(i):
    #if(i==0):print(i,H[i])
    #if(i>=1):print(i,H[i],H[i-1])
    #if(i>=2):print(i,H[i],H[i-2])
    if i==0:return 0

    res = abs(H[i]-H[i-1]) + rec(i-1)


    if(i==1): return res

    res2 = abs(H[i]-H[i-2]) + rec(i-2)

    return min(res,res2)

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

print(rec(N-1))

#7
#2 9 4 5 1 6 10

Buggy submission (verdict: Runtime Error):
import sys


def rec(i):
    #if(i==0):print(i,H[i])
    #if(i>=1):print(i,H[i],H[i-1])
    #if(i>=2):print(i,H[i],H[i-2])
    #print(i)
    if (dp[i] < float('inf')): return dp[i]
    if(i==0): return 0

    res = float('inf')
    res = rec(i-1)+abs(H[i]-H[i-1])
    if(i==1): return res

    calc = rec(i-2)+abs(H[i]-H[i-2])
    if(res > calc):
        res = calc

    dp[i] = res

    return res

N = int(input())
H = list(map(int,input().split()))
dp = [float('inf')]*N

#print(N)
#print(H)

print(rec(N-1))

#7
#2 9 4 5 1 6 10

Buggy submission (verdict: Runtime Error):
import sys


def rec(i):
    #if(i==0):print(i,H[i])
    #if(i>=1):print(i,H[i],H[i-1])
    #if(i>=2):print(i,H[i],H[i-2])
    print(i)
    if (dp[i] < float('inf')): return dp[i]
    if(i==0): return 0

    res = float('inf')
    res = rec(i-1)+abs(H[i]-H[i-1])
    if(i==1): return res

    calc = rec(i-2)+abs(H[i]-H[i-2])
    if(res > calc):
        res = calc

    dp[i] = res

    return res

N = int(input())
H = list(map(int,input().split()))
dp = [float('inf')]*N

#print(N)
#print(H)

print(rec(N-1))

#7
#2 9 4 5 1 6 10

Buggy submission (verdict: Runtime Error):
import sys


def rec(i):
    #if(i==0):print(i,H[i])
    #if(i>=1):print(i,H[i],H[i-1])
    #if(i>=2):print(i,H[i],H[i-2])


    if(i==0): return 0

    res = float('inf')
    res = rec(i-1)+abs(H[i]-H[i-1])
    if(i==1): return res

    if(res > rec(i-2)+abs(H[i]-H[i-2])):
        res = rec(i-2)+abs(H[i]-H[i-2])

    return res

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


#print(N)
#print(H)

print(rec(N-1))

#7
#2 9 4 5 1 6 10
Problem p02911 (python)

Fixed submission:
N, K, Q = map(int, input().split(" "))    # N:人数, K:初期スコア, Q:問題数
A = [int(input()) for i in range(Q)]    # 正解者のリスト
B = [0 for i in range(N)]    # 各人の正解数

for i in range(Q):
    num_ans_person = A[i] - 1
    B[num_ans_person] += 1

# 得点は, 最初の点数 - 他人の正解数
# 他人の正解数は, 問題数 - 自分の正解数
# 得点は, 最初の点数 - 問題数 + 自分の正解数
# 得点 > 0 であれば, "Yes"
for i in range(N):
    if K - Q + B[i] > 0:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
N,K,Q = map(int, input().split())
A = [int(input()) for i in range(Q)]
B = [0 for i in range(N)]
for i in range(Q):
    j=A[i]-1
    B[j]+=1
for j in range(N):
    if K - Q + B[i]>0:
        print('Yes')
    else :
        print('NO')
Problem p02885 (python)

Fixed submission:
D = input().split(' ')
A = int(D[0])
B = int(D[1])

res = A - B * 2

if res < 0:
    res = 0

print(res)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_right
N = int(input())
D = list(map(int, input().split()))
D.sort(reverse=False)

count = 0

for i in range(N - 2):
    for j in range(i + 1, N - 1):
        l = D[:N - j - 1]
        ind = bisect_right(D, D[i] + D[j] - 1)
        count += max(ind - j - 1, 0)

print(count)
Problem p02903 (python)

Fixed submission:
d = input().split(' ')
w = int(d[0])
h = int(d[1])
a = int(d[2])
b = int(d[3])

s1 = ''
s2 = ''
for j in range(h):
  if j < a:
    s1 = s1 + '1'
    s2 = s2 + '0'
  else:
    s1 = s1 + '0'
    s2 = s2 + '1'

k = []
for i in range(w):
  if i < b:
    print(s1)
  else:
    print(s2)

Buggy submission (verdict: Runtime Error):
d = input().split(' ')
h = d[0]
w = d[1]
a = d[2]
b = d[3]

s1 = ''
s2 = ''
for j in range(h):
  if j < a:
    s1 = s1 + '1'
    s2 = s2 + '0'
  else:
    s1 = s1 + '0'
    s2 = s2 + '1'

k = []
for i in range(w):
  if i < b:
    print(s1)
  else:
    print(s2)
Problem p02921 (python)

Fixed submission:
a = input()
b = input()

c = 0

for i in range(3):
  if a[i] == b[i]:
    c += 1
      
print(c)

Buggy submission (verdict: Runtime Error):
in_pred = input()
in_real = input()

i = 0
for a in in_pred:
  for b in in_real:
    if a == b:
      i += 1
      
return i
Problem p02922 (python)

Fixed submission:
in_data = input()
 
data = in_data.split(' ')
A = int(data[0])
B = int(data[1])
if B == 1:
  print("0")
else:
  c = (B - 1) // (A - 1)
  d = (B - 1) / (A - 1)
  if c < d:
    c = c + 1
  print(c)

Buggy submission (verdict: Runtime Error):
in_data = input()
 
data = in_data.split(' ')
A = int(data[0])
B = int(data[1])
if B == 1:
  print("0")
else
  c = (B - 1) // A + 1
  print(c)

Buggy submission (verdict: Runtime Error):
in_data = input()
def test_fun(in_data):
    data = in_data.split(' ')
    A = int(data[0])
    B = int(data[1])
    c = (B - 1) // A + 1
 
    print(c)
  
test_func(in_data)

Buggy submission (verdict: Runtime Error):
in_data = input()
data = in_data.split(' ')
A = data[0]
B = data[1]
c = (B - 1) // (A - 1)
 
print(c)

Buggy submission (verdict: Runtime Error):
in_data = input()
data = in_data.splite(' ')
A = data[0]
B = data[1]
c = (B - 1) // (A - 1)
 
print(c)

Buggy submission (verdict: Runtime Error):
input = input()
data = input.splite(' ')
A = data[0]
B = data[1]
c = (B - 1) // (A - 1)
 
print(c)

Buggy submission (verdict: Runtime Error):
in = input()
data = in.splite(' ')
A = data[0]
B = data[1]
c = (B - 1) // (A - 1)

print(c)
Problem p02923 (python)

Fixed submission:
N = int(input())
H_raw = input()
H = H_raw.split(' ')
count = 0
max = 0
for i in range(N):
  if i == 0:
    continue
  if int(H[i]) <= int(H[i - 1]):
    count = count + 1
  else:
    if count > max:
      max = count
    count = 0
    
if count > max:
  max = count
  
print(max)

Buggy submission (verdict: Runtime Error):
N = input()
H_raw = input()
H = H_raw.split(' ')
count = 0
max = 0
for i in range(N):
  if i == 0:
    continue
  if int(H[i]) < int(H[i - 1]):
    count = count + 1
  else:
    if count > max:
      max = count
    count = 0
else:
  if count > max:
    max = count
    
print(max)
Problem p02924 (python)

Fixed submission:
a = int(input())
print(int(a * (a - 1) // 2))

Buggy submission (verdict: Runtime Error):
a = int(input())
result = 0
if a mod 2 == 0:
  print(a * a / 2)
else:
  print(a * (a - 1) / 2)


print(result)

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

for i in range(a - 1):
  result = result + i + 1

print(result)
Problem p02900 (python)

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

# GCDの約数を素因数分解する
def primeFactor(n):
    flg = 0
    count = 0
    tmp = math.sqrt(n)
    i = 2

    if n == 1:
        return 1

    while i <= tmp:
        # print(str(i)+str(',')+str(gcd_cnt))
        if n % i == 0:
            if flg == 0:
                flg = 1
                count += 1
            n = n // i
        else:
            flg = 0
            i += 1
    # if flg == 1:
    #     count += 1
    # print(str('素数=')+str(count)+str(' n=')+str(n)+str(' i=')+str(i))
    if n > 1:
        count += 1
    # 1を足す
    count += 1
    return count


# # print(len(div))
m,n = map(int,input().split())
p = gcd(m,n)
# print(str('gcd=')+ str(p))
ans = primeFactor(p)
print(ans)

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

# GCDの約数を素因数分解する
def primeFactor(n):
    flg = 0
    count = 0
    tmp = math.sqrt(n)
    i = 2

    if n == 1:
        return 1

    while i <= tmp:
        # print(str(i)+str(',')+str(gcd_cnt))
        if n % i == 0:
            if flg == 0:
                flg = 1
                count += 1
            n = n // i
        else:
            flg = 0
            i += 1
    # if flg == 1:
    #     count += 1
    # print(str('素数=')+str(count)+str(' n=')+str(n)+str(' i=')+str(i))
    if n > 1:
        count += 1
    # 1を足す
    count += 1
    return count


# # print(len(div))
m,n = map(int,input().split())
p = math.gcd(m,n)
# print(str('gcd=')+ str(p))
ans = primeFactor(p)
print(ans)
Problem p02947 (python)

Fixed submission:
#coding: utf-8
amount = int(input())
strings = list(map(str, [input() for i in range(amount)]))
sum = 0
sum2 = 0

for i in range(len(strings)):
	# print(strings[i])
	abc = list(strings[i])
	abc.sort()
	strings[i] = ''.join(abc)
	# print(strings[i])

strings.sort()

for j in range(len(strings)-1):
	# print(j+1)
	# print(strings[j]+strings[j+1])
	if strings[j] == strings[j+1]:
		sum2 = sum2+1
	else:
		sum = sum + sum2 * (sum2+1) / 2
		sum2 = 0

sum = sum + sum2 * (sum2+1) / 2
print(int(sum))

Buggy submission (verdict: Runtime Error):
#coding: utf-8
amount = int(input())
strings = list(map(str, [input() for i in range(amount)]))
sum = 0

for i in range(len(strings)):
	# print(strings[i])
	abc = list(strings[i])
	abc.sort()
	strings[i] = ''.join(abc)
	# print(strings[i])

strings.sort()

for j in range(len(strings-1)):
	# print(j)
	if strings[j] == strings[j+1]:
		sum = sum+1

print(sum)
Problem p03071 (python)

Fixed submission:
num = input()
num_list = num.split()
a = int(num_list[0])
b = int(num_list[1])
_sum = 0
for i in range(2):
    if a > b:
        _sum += a
        a -= 1
    else:
        _sum += b
        b -= 1
print(_sum)

Buggy submission (verdict: Runtime Error):
import sys


def main(argv):
    a = argv[0]
    b = argv[1]
    _sum = 0
    for i in range(2):
        if a > b:
            sum += a
            a -= 1
        else:
            sum += b
            b -= 1
    print(_sum)


if __name__ == '__main__':
    main(sys.argv[1:])
Problem p03485 (python)

Fixed submission:
S=((input())).split(' ')
print((int)(((int)(S[0])+(int)(S[1]))/2+0.5))

Buggy submission (verdict: Runtime Error):
a = int(input().split())
print(int(round((a[0]+a[1])/2)))

Buggy submission (verdict: Runtime Error):
a = int(input().split())
print(round((a[0]+a[1])/2))

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
 
c = round((a+b)/2)
 
print(int(c))

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

c = (a+b)/2

print(c.round())
Problem p02841 (python)

Fixed submission:
d1 = list(map(int ,input().split()))
d2 = list(map(int ,input().split()))
if d2[0] != d1[0]:
          print(1)
else:
          print(0)

Buggy submission (verdict: Runtime Error):
d1 = list(map(int ,input().split())
d2 = list(map(int ,input().split())
if d2[0] != d1[0]:
          print(1)
else:
          print(0)
Problem p02936 (python)

Fixed submission:
N, Q = map(int, input().split())
edge = [[] for i in range(N)]
q = [0 for i in range(N)]
 
for i in range(N-1):
  a, b = map(int, input().split())
  edge[a-1].append(b)
for i in range(Q):
  a, v = map(int, input().split())
  q[a-1] += v
 
for i, v in enumerate(q):
  #print(i, v)
  for j in edge[i]:
    #print(j)
    q[j-1] += v
print(*q)

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
tree = [list(map(int, input().split())) for i in range(N-1)]
counter = [list(map(int, input().split())) for i in range(Q)]
dic = {}
for i in tree:
  try:
    dic[i[0]].append(i[1])
  except KeyError:
    dic[i[0]] = [i[1]]
keys = dic.keys()
for i in tree:
  if i[1] not in keys:
    dic[i[1]] = []
q = {i: 0 for i in dic.keys()}
 
def child_sum(q,v, child):
  if child == []:
    #print('test', q, v, child)
    return q
  else:
    for j in child:
      
      q[j] += v
      child = dic[j]
      #print('test2', j, v, child)
      q = child_sum(q, v, child)
  return q
    
for i, v in counter:
  q[i] += v
  child = dic[i]
  #print(q, i, child)
  q = child_sum(q, v, child)
print(' '.join([str(i) for i in q.values()]))

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
tree = [list(map(int, input().split())) for i in range(N-1)]
counter = [list(map(int, input().split())) for i in range(Q)]
dic = {}
for i in tree:
  try:
    dic[i[0]].append(i[1])
  except KeyError:
    dic[i[0]] = [i[1]]
keys = dic.keys()
for i in tree:
  if i[1] not in keys:
    dic[i[1]] = []
q = {i: 0 for i in dic.keys()}

def child_sum(q,v, child):
  if child == []:
    #print('test', q, v, child)
    return q
  else:
    for j in child:
      
      q[j] += v
      child = dic[j]
      #print('test2', j, v, child)
      q = child_sum(q, v, child)
  return q
    
for i, v in counter:
  q[i] += v
  child = dic[i]
  #print(q, i, child)
  q = child_sum(q, v, child)
Problem p03128 (python)

Fixed submission:
N,M = map(int,input().split())
A = list(map(int,input().split()))
 
dp = [-1 for i in range(N+10)]
l = [0,2,5,5,4,5,6,3,7,6]
dp[0] = 0
for i in range(N-1):
    for s in A:
        if dp[i] == -1 and i!=0:
            continue
        if dp[i + l[s]] < dp[i]*10+s:
            dp[i + l[s]] = dp[i]*10+s
print(dp[N])

Buggy submission (verdict: Runtime Error):
dic = {
  1: 2,
  2: 5,
  3: 5,
  4: 4,
  5: 5,
  6: 6,
  7: 3,
  8: 7,
  9: 6
}

N, M = map(int, input().split())
A = list(map(int, input().split()))
A = sorted(A, reverse=True)
dic2 = {}
for i in A:
    try:
      dic2[dic[i]]
    except:
      dic2[dic[i]] = i 
result_list = []
items = sorted(dic2.items())
while True:
  if len(items) == 0:
    break
  else:
    if N >= items[0]:
      result_list.append(items[1])
      N = N - items[0]
    else:
      items.pop(0)
return sorted(result_list, reverse=True)
Problem p02841 (python)

Fixed submission:
M1, D1 = map(int,input().split())
M2, D2 = map(int,input().split())
if M1 in [1,3,5,7,8,10] and M1+1 == M2 and D1 ==31 and D2 == 1:
    ans =1
elif M1 ==2 and M2 ==3 and D1==28 and D2 ==1:
    ans = 1
elif M1 == 12 and M2 == 1 and D1 == 31 and D2 ==1:
    ans =1
elif M1 in [4,6,9,11] and M1 +1 == M2 and D1==30 and D2 == 1:
    ans =1
else:
    ans=0
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
n = int(N/1.08)
if (N // 1.08) == ((N+1) //1.08) or int(n * 1.08) < N and N < int((n+1) * 1.08):
    print(':(')
else:
    print((N//1.08))
Problem p02842 (python)

Fixed submission:
N = int(input())
n = int(N/1.08)
if (int(n * 1.08) < N and N < int((n+1) * 1.08)):
    print(':(')
else:
    print(int(N//1.08)+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
if (N // 1.08) == ((N+1) //1.08) or int(n * 1.08) != N and N!=int( (n+1) * 1.08):
    print(':(')
else:
    print((N//1.08))

Buggy submission (verdict: Runtime Error):
N = int(input())
if N // 1.08 == (N+1) //1.08:
    print(':(')
else:
    print(n+1)
Problem p02853 (python)

Fixed submission:
W = [int(x) for x in input().split()]
if W[0] ==1:
    if W[1] ==1:
        print(1000000)
    elif W[1] ==2:
        print(500000)
    elif W[1] ==3:
        print(400000)
    else:
        print(300000)
elif W[0] ==2:
    if W[1] ==1:
        print(500000)
    elif W[1] ==2:
        print(400000)
    elif W[1] ==3:
        print(300000)
    else:
        print(200000)
elif W[0] ==3:
    if W[1] ==1:
        print(400000)
    elif W[1] ==2:
        print(300000)
    elif W[1] ==3:
        print(200000)
    else:
        print(100000)
else:
    if W[1] ==1:
        print(300000)
    elif W[1] ==2:
        print(200000)
    elif W[1] ==3:
        print(100000)
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
import sys
    
sys.setrecursionlimit(200000)

n = int(input())
s = [int(x) for x in input().split()]
sum_s = sum(s)
middle_s = sum_s / 2
w = 0
for i in range(len(s)):
    w += s[i]
    if w == middle_s:
        print(0)
        break
    elif w > middle_s:
        if i == 0:
            ans = s[0] - sum(s[1:])
            print(ans)
        elif s[i] == s[-1]:
            ans = s[-1] - sum(s[:-1])
            print(ans)
        else:
            left = sum(s[0:(i+1)]) - sum(s[(i+1):])
            right = sum(s[i:]) - sum(s[0:i])
            ans = min(abs(left),abs(right))
            print(ans)
            break
Problem p02957 (python)

Fixed submission:
a, b = (int(x) for x in input().split())

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

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

if a % 2 == b % 2:
    print((a + b) / 2)
else:
    print("impossible"
Problem p03109 (python)

Fixed submission:
S = input()
if S <= '2019/04/30' :
    print('Heisei' )
else:
    print('TBD')

Buggy submission (verdict: Runtime Error):
yyyy = int(input())
mm = int(input())
dd = int(input())
if yyyy < 2019:
    print('Heisei')
elif yyyy > 2019:
    print('TBD')
else:
    if mm < 5:
        print('Heisei')
    else:
        print('TBD')

Buggy submission (verdict: Runtime Error):
yyyy = int(input())
mm = int(input())
dd = int(input())
if yyyy < 2019:
    print('Heisei')
    break
elif yyyy > 2019:
    print('TBD')
    break
else:
    if mm < 5:
        print('Heisei')
        break
    else:
        print('TBD')

Buggy submission (verdict: Runtime Error):
yyyy = int(input())
mm = int(input())
dd = int(input())
if yyyy < 2019:
    print('Heisei')
elif yyyy > 2019:
    print('TBD')
else:
    if mm < 5:
        print('Heisei')
    else:
        print('TBD')

Buggy submission (verdict: Runtime Error):
yyyy = int(input())
mm = int(input())
dd = int(input())
if yyyy < 2019:
    print('Heisei')
elif yyyy > 2019:
    print('TBD')
else:
    if mm == 1 or mm == 2 or mm == 3 or mm == 4:
        print('Heisei')
    else:
        print('TBD')

Buggy submission (verdict: Runtime Error):
yyyy = int(input())
mm = int(input())
if yyyy < 2019:
    print('Heisei')
elif yyyy > 2019:
    print('TBD')
else:
    if mm == 1 or mm == 2 or mm == 3 or mm == 4:
        print('Heisei')
    else:
        print('TBD')

Buggy submission (verdict: Runtime Error):
if yyyy < 2019:
    print('Heisei')
elif yyyy > 2019:
    print('TBD')
else:
    if mm == 1 or mm == 2 or mm == 3 or mm == 4:
        print('Heisei')
    else:
        print('TBD')

Buggy submission (verdict: Runtime Error):
if yyyy < 2019:
    print('Heisei')
elif yyyy > 2019:
    print('TBD')
else:
    if mm == 01 or mm == 02 or mm == 03 or mm == 04:
        print('Heisei')
    else:
        print('TBD')

Buggy submission (verdict: Runtime Error):
if yyyy < 2019:
    print('Heisei')
elif yyyy > 2019:
    print('TBD')
else:
    if mm < 5:
        print('Heisei')
    else:
        print('TBD')
Problem p03731 (python)

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

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

discount = 0
for i in range(N - 1):
    if t[i + 1] - t[i] < T:
        discount += (T - (t[i + 1] - t[i]))

X = N * T - discount

print(X)

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

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

discount = 0
for i in range(N - 1):
    if t[i + 1] - t[i] < T:
        discount += (T - (t[i + 1] - t[i]))

X = N * T - discount

print(X
Problem p03845 (python)

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

P, X = [], []
for i in range(M):
    p1, x1 = map(int, input().split())
    P.append(p1)
    X.append(x1)

count = 0
for i in range(len(T)):
    count += T[i]

c = count

for i in range(M):
    count = c
    count += X[i]
    count -= T[P[i] - 1]
    print(count)

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

P, X = [], []
for i in range(M):
    p1, x1 = map(int, input().split())
    P.append(p1)
    X.append(x1)

count = 0
for i in range(len(T)):
    count += T[i]

c = count

for i in range(M):
    count = c
    count += X[i]
    count -= T[P[i]]
    print(count)

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

P, X = [], []
for i in range(M):
    p1, x1 = map(int, input().split())
    P.append(p1)
    X.append(x1)

count = 0
for i in range(len(T)):
    count += T[i]

c = count

for i in range(len(X)):
    count = c
    count += X[i]
    count -= T[i]
    print(count)

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

P, X = [], []
for i in range(M):
    p1, x1 = map(int, input().split())
    P.append(p1)
    X.append(x1)

count = 0
for i in range(len(T)):
    count += T[i]

c = count

for i in range(len(X)):
    count = c
    count += X[i]
    count -= T[i]
    print(count

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

P, X = [], []
for i in range(M):
    pi, xi = map(int, input().split)
    P.append(pi)
    X.append(xi)

count = 0
for i in T:
    count += T[i]

for i in X:
    count += X[i]
    count -= T[i]
    print(count

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

P, X = [], []
for i in range(M):
    p1, x1 = map(int, input().split)
    P.append(p1)
    X.append(x1)

count = 0
for i in T:
    count += T[i]

discount = 0
for i in T:
    if i <= M:
        discount += T[i]

special = 0
for i in P, X:
    special += P[i]
    special += X[i]

count *= M
count -= discount
count += special

print(count)
Problem p03469 (python)

Fixed submission:
s = input()
print(s[:3]+'8'+s[4:])

Buggy submission (verdict: Runtime Error):
s = input()
s[4:5]='8'
print(s)
Problem p03501 (python)

Fixed submission:
n,a,b = map(int,input().split())
print(min(a*n,b))

Buggy submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
print(min[a*n,b])
Problem p03547 (python)

Fixed submission:
list = list(map(str,input().split()))
for x in list:
    if x=='A':
        x = 10
    elif x=='B':
        x = 11
    elif x=='C':
        x = 12
    elif x=='D':
        x = 13
    elif x=='E':
        x = 14
    elif x=='F':
        x = 15
if list[0]<list[1]:
    print('<')
elif list[0]>list[1]:
    print('>')
else:
    print('=')

Buggy submission (verdict: Runtime Error):
list = list(map(str,inout().split()))
for x in list:
    if x=='A':
        x = 10
    elif x=='B':
        x = 11
    elif x=='C':
        x = 12
    elif x=='D':
        x = 13
    elif x=='E':
        x = 14
    elif x=='F':
        x = 15
if list[0]<list[1]:
    print('<')
elif list[0]>list[1]:
    print('>')
else:
    print('=')
Problem p03671 (python)

Fixed submission:
prices = list(map(int,input().split()))
prices.sort()
print(prices[0]+prices[1])

Buggy submission (verdict: Runtime Error):
prices = list(map(int,input().split()))
prices.sort()
print(price[0]+price[1])

Buggy submission (verdict: Runtime Error):
prices = list(map(int,input().split()))
price.sort()
print(price[0]+price[1])

Buggy submission (verdict: Runtime Error):
prices = list(map(int,input().split()))
price.sort()
return(price[0]+price[1])
Problem p03729 (python)

Fixed submission:
a,b,c = map(str,input().split())
if a[-1:]==b[:1] and b[-1:]==c[:1]:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
if a[-1:]==b[:1] and b[-1:]==c[:1]:
    print("YES")
else:
    print("NO")
Problem p03826 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
print(max[a*b,c*d])
Problem p03943 (python)

Fixed submission:
a,b,c = map(int,input().split())
if a==b+c:
    print("Yes")
elif b==a+c:
    print("Yes")
elif c==a+b:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
if a==b+c:
    print("YES")
elif b==a+c:
    print("YES")
elif c=a+b:
    print("YES")
else:
    print("NO")