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

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

dist = [0] * (M-1)
for i in range(M-1):
    dist[i] = X[i+1] -X[i]

dist.sort()

if N >= M:
    ans = 0
else:
    ans = sum(dist[:M-N])

print(ans)

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

dist = [0] * (M-1)
for i in range(M-1):
    dist[i] = X[i+1] -X[i]

dist.sort()

if N >= M:
    print(0)
else:
    ans = sum(dist[:M-N])

print(ans)
Problem p03286 (python)

Fixed submission:
N = int(input())

def order2(x):
  if x > 0 :
    k = 0
    check = 0
    while check == 0 :
      s = 0
      for i in range(0, k+1, 2):
        s += (-2)**i
        ans = i
      if s >= x:
        check = 1
      k += 2
  elif x < 0 :
    k = 1
    check = 0
    while check == 0 :
      s = 0
      for i in range(1, k+1, 2):
        s += (-2)**i
        ans = i
      if s <= x:
        check = 1
      k += 2
  return ans

if N!= 0 :


  l = [] 
  a = N
  i = order2(N)
  while i >= 0:
    if a == 0 :
      l.append('0')
    if a > 0 and (-2)**i >0 :
        s = 0
        for j in range(0, i, 2):
          s += (-2)**j
        if a > s :
          l.append('1')
          a -= (-2)**i
        else :
          l.append('0')
    elif a > 0 and (-2)**i < 0:
        l.append('0')
    elif a < 0 and (-2)**i > 0:
        l.append('0')
    elif a < 0 and (-2)**i < 0:
        s = 0
        for j in range(1, i, 2):
          s += (-2)**j
        if a < s :
          l.append('1')
          a -= (-2)**i
        else :
          l.append('0')
    i -= 1

  print(''.join(l))

else :
  print(0)

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

def order2(x):
  if x > 0 :
    k = 0
    check = 0
    while check == 0 :
      s = 0
      for i in range(0, k+1, 2):
        s += (-2)**i
        ans = i
      if s >= x:
        check = 1
      k += 2
  elif x < 0 :
    k = 1
    check = 0
    while check == 0 :
      s = 0
      for i in range(1, k+1, 2):
        s += (-2)**i
        ans = i
      if s <= x:
        check = 1
      k += 2
  return ans

if N!= 0 :


  l = [] 
  a = N
  i = order2(N)
  while i >= 0:
    if a == 0 :
      l.append(0)
    if a > 0 and (-2)**i >0 :
        s = 0
        for j in range(0, i, 2):
          s += (-2)**j
        print(a,s)
        if a > s :
          l.append('1')
          a -= (-2)**i
        else :
          l.append('0')
    elif a > 0 and (-2)**i < 0:
        l.append('0')
    elif a < 0 and (-2)**i > 0:
        l.append('0')
    elif a < 0 and (-2)**i < 0:
        s = 0
        for j in range(1, i, 2):
          s += (-2)**j
        if a < s :
          l.append('1')
          a -= (-2)**i
        else :
          l.append('0')
    i -= 1

  print(''.join(l))

else :
  print(0)
Problem p03315 (python)

Fixed submission:
S = list(input())
a = S.count('+')
b = S.count('-')
print(int(a) - int(b))

Buggy submission (verdict: Runtime Error):
S = list(input())
a = list.count('+')
b = list.count('-')
print(int(a) - int(b))
Problem p03634 (python)

Fixed submission:
#%%
n = int(input())
a, b, c = [0] * n, [0] * n, [0] * n
for i in range(n-1):
    a[i], b[i], c[i] = map(int, input().split())

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

l = [[] for _ in range(n+1)]
for i in range(n-1):
    l[a[i]].append([b[i],c[i]])
    l[b[i]].append([a[i],c[i]])

d = [0] * (n+1)
check = [0] * (n+1)
check[k] = 1
que = [k]
count = 1

while len(que) > 0:
    tmp = que.pop(0)
    for i in l[tmp]:
        if check[i[0]] == 0:
            que.append(i[0])
            check[i[0]] = 1
            d[i[0]] = d[tmp] + i[1]
            count += 1
        else:
            pass
    if count >= n:
        break

x, y = [0] * q, [0] * q
for i in range(q):
    x[i], y[i] = map(int, input().split())
    print(d[x[i]] + d[y[i]])

Buggy submission (verdict: Runtime Error):
#%%
n = int(input())
a, b, c = [0] * n, [0] * n, [0] * n
for i in range(n-1):
    a[i], b[i], c[i] = map(int, input().split())

q, k = map(int, input().split())
x, y = [0] * q, [0] * q
for i in range(q):
    x[i], y[i] = map(int, input().split())

l = [[] for _ in range(n+1)]
for i in range(n-1):
    l[a[i]].append((b[i],c[i]))
    l[b[i]].append((a[i],c[i]))

d = [0] * (n+1)
check = False * (n+1)
check[k] = True
que = [k]

while len(que) > 0:
    tmp = que.pop(0)
    for i in l[tmp]:
        if check[i[0]] :
            que.append(i[0])
            check[i[0]] = True
            d[i[0]] = d[tmp] + i[1]
        else:
            pass

for i in range(q):
    ans = d[x[i]] + d[y[i]]
    print(ans)

Buggy submission (verdict: Runtime Error):
#%%
n = int(input())
a, b, c = [0] * n, [0] * n, [0] * n
for i in range(n-1):
    a[i], b[i], c[i] = map(int, input().split())

q, k = map(int, input().split())
x, y = [0] * q, [0] * q
for i in range(q):
    x[i], y[i] = map(int, input().split())

l = [[] for _ in range(n+1)]
for i in range(n-1):
    l[a[i]].append((b[i],c[i]))
    l[b[i]].append((a[i],c[i]))

d = [0] * (n+1)
check = False * (n+1)
check[k] = 1
que = [k]

while len(que) > 0:
    tmp = que.pop(0)
    for i in l[tmp]:
        if check[i[0]] :
            que.append(i[0])
            check[i[0]] = True
            d[i[0]] = d[tmp] + i[1]
        else:
            pass

for i in range(q):
    ans = d[x[i]] + d[y[i]]
    print(ans)
Problem p03705 (python)

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

if N == 1 :
    if A != B :
        ans = 0
    else :
        ans = 1



elif A > B :
    ans = 0
elif A == B :
    ans = 1
else:
    ans = (B*(N-1)+A) - (A*(N-1)+B) + 1

print(ans)

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

if N == 1 :
    if A != B :
        ans = 0
    elif :
        ans = 1



elif A > B :
    ans = 0
elif A == B :
    ans = 1
else:
    ans = (B*(N-1)+A) - (A*(N-1)+B) + 1

print(ans)
Problem p02820 (python)

Fixed submission:
import numpy as np
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()
act = np.array(list(t.replace('r','P').replace('s','R').replace('p','S')))
for a in range(k, len(act)):
    if act[a] == act[a-k]:
        act[a] = 'Z'
score_dict = {'R':r, 'S':s, 'P':p, 'Z':0}
score = np.array([score_dict[i] for i in act])
print(score.sum())

Buggy submission (verdict: Runtime Error):
import numpy as np
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()
act = np.array(list(t.replace('r','P').replace('s','R').replace('p','S')))
for a in range(k, len(act)):
    if act[a] == act[a-k]:
        act[a] = 'Z'
score_dict = {'R':r, 'S':s, 'P':p, 'Z':0}
score = np.array([score_dict[i] for i in act])
print(score.sum())
Problem p02829 (python)

Fixed submission:
a=int(input())
b=int(input())
ans_list = [1,2,3]
print([i for i in ans_list if (i!=a and i!=b)][0])

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

n = int(input())
a_list = np.array(list(map(int, input().split())))
n_index = np.arange(1, n+1)

breaks = 0
if min(a_list) > 1:
    print(-1)
else:
    for n in n_index:
        if len(a_list) > 0:
            if n in a_list:
                i = a_list.index(n)
                a_list = a_list[i+1:]
                breaks += i
                print(a_list)
            else:
                breaks += len(a_list)
                print(breaks)
                exit()
    print(breaks)
Problem p02831 (python)

Fixed submission:
import fractions

a, b = map(int, input().split())
def lcm(x, y):
    return (x * y) / fractions.gcd(x, y)

print(int(lcm(a, b)))

Buggy submission (verdict: Runtime Error):
import math

a, b = map(int, input().split())
def lcm(x, y):
    return (x * y) / math.gcd(x, y)

print(int(lcm(a, b)))

Buggy submission (verdict: Runtime Error):
import math

a, b = map(int, input().split())
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
import math

a, b = map(int, input().split())
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(a, b))
Problem p02847 (python)

Fixed submission:
today = input()
days = {'SUN':7,
        'MON':6,
        'TUE':5,
        'WED':4,
        'THU':3,
        'FRI':2,
        'SAT':1
}
print(days[today])

Buggy submission (verdict: Runtime Error):
a, b, x = map(int, input().split())
if a * 1e9 + b * 10 <= x:
    print(int(1e9))
elif a * 1 + b * 1 > x:
    print(0)
else:
    atari = x // a
    price = atari * a + b * len(str(atari))
    if atari > 100:
        while price > x:
            atari -= 100
            atari = max(0, atari)
            price = atari * a + b * len(str(atari))
        atari_bottom = atari
        while price < x:
            atari_bottom += 1
            price = atari_bottom * a + b * len(str(atari_bottom))
        print(atari_bottom-1)
    else:
        while price > x:
            atari -= 1
            price = atari * a + b * len(str(atari))
        print(atari)

Buggy submission (verdict: Runtime Error):
a, b, x = map(int, input().split())
if a * 1e9 + b * 10 <= x:
    print(int(1e9))
elif a * 1 + b * 1 > x:
    print(0)
else:
    atari = x // a
    price = atari * a + b * len(str(atari))
    while price > x:
        atari -= 100
        atari = max(0, atari)
        price = atari * a + b * len(str(atari))
    atari_bottom = atari
    while price < x:
        atari_bottom += 1
        price = atari_bottom * a + b * len(str(atari_bottom))
    print(atari_bottom-1)
Problem p03013 (python)

Fixed submission:
N,M = (int(x) for x in input().split())
a_arr = [-1]
for _ in range(M):
    a_arr.append(int(input()))
a_arr.append(N+1)

n_dp_size = N+3
n_dp = [0]*(n_dp_size)
n_dp[0] = 1
n_dp[1] = 0
n_dp[2] = 1
for i in range(3,n_dp_size):
    n_dp[i] = (n_dp[i-2]+n_dp[i-1]) % 1000000007

ans = 1
for i in range(1,len(a_arr)):
    a_diff = a_arr[i]-a_arr[i-1]
    ans *= n_dp[a_diff]
    ans = ans % 1000000007

print(ans)

Buggy submission (verdict: Runtime Error):
N,M = (int(x) for x in input().split())
a_arr = [-1]
for _ in range(M):
    a_arr.append(int(input()))
a_arr.append(N+1)

n_dp = [0]*(N+1)
n_dp[0] = 1
n_dp[1] = 0
n_dp[2] = 1
for i in range(3,N+1):
    n_dp[i] = (n_dp[i-2]+n_dp[i-1]) % 1000000007

ans = 1
for i in range(1,len(a_arr)):
    a_diff = a_arr[i]-a_arr[i-1]
    ans *= n_dp[a_diff]
    ans = ans % 1000000007

print(ans)
Problem p03038 (python)

Fixed submission:
N,M = (int(x) for x in input().split())
A_arr = [int(x) for x in input().split()]
BC_arr = [[0,0] for _ in range(M)]
for i in range(M):
    b,c = (int(x) for x in input().split())
    BC_arr[i][0] = b
    BC_arr[i][1] = c

A_arr.sort()
BC_arr.sort(key=lambda x:x[1], reverse=True)

break_th = False
j_count = 0
for BC in BC_arr:
    Bi = BC[0]
    Ci = BC[1]
    for j in range(Bi):
        if A_arr[j_count] >= Ci:
            break_th = True
            break
        A_arr[j_count] = Ci
        j_count += 1
        if j_count == N:
            break_th = True
            break
    if break_th:
        break
print(sum(A_arr))

Buggy submission (verdict: Runtime Error):
N,M = (int(x) for x in input().split())
A_arr = [int(x) for x in input().split()]
BC_arr = [[0,0] for _ in range(M)]
for i in range(M):
    b,c = (int(x) for x in input().split())
    BC_arr[i][0] = b
    BC_arr[i][1] = c

A_arr.sort()
BC_arr.sort(key=lambda x:x[1], reverse=True)

break_th = False
j_count = 0
for BC in BC_arr:
    Bi = BC[0]
    Ci = BC[1]
    for j in range(Bi):
        if A_arr[j_count] >= Ci:
            break_th = True
            break
        A_arr[j_count] = Ci
        j_count += 1
    if break_th:
        break
print(sum(A_arr))
Problem p03045 (python)

Fixed submission:
def uf_init(n):
    return list(range(n))

def uf_root(uf, x):
    update_node_arr = []
    while(uf[x] != x):
        update_node_arr.append(x)
        x = uf[x]
    for y in update_node_arr:
        uf[y] = x
    return x

def uf_same(uf, x, y):
    return uf_root(uf, x) == uf_root(uf, y)

def uf_unite(uf, x, y):
    x = uf_root(uf, x)
    y = uf_root(uf, y)
    if x == y:
        return
    uf[x] = y

N,M = (int(x) for x in input().split())

uf = uf_init(N)

for _ in range(M):
    X,Y,Z = (int(x) for x in input().split())
    uf_unite(uf, X-1, Y-1)

uf_roots = set()
for i in range(N):
    uf_roots.add(uf_root(uf, i))

print(len(uf_roots))

Buggy submission (verdict: Runtime Error):
def uf_init(n):
    return list(range(n))

def uf_root(uf, x):
    if uf[x] != x:
        uf[x] = uf_root(uf, uf[x])
    return uf[x]

def uf_same(uf, x, y):
    return uf_root(uf, x) == uf_root(uf, y)

def uf_unite(uf, x, y):
    x = uf_root(uf, x)
    y = uf_root(uf, y)
    if x == y:
        return
    uf[x] = y

N,M = (int(x) for x in input().split())

uf = uf_init(N)

for _ in range(M):
    X,Y,Z = (int(x) for x in input().split())
    uf_unite(uf, X-1, Y-1)

uf_roots = set()
for i in range(N):
    uf_roots.add(uf_root(uf, i))

print(len(uf_roots))
Problem p02831 (python)

Fixed submission:
from functools import reduce
from fractions import gcd


def least_common_multiple(iter):
    '''
    最小公倍数を返す
    '''
    lcm = lambda x, y: x*y//gcd(x, y)
    return reduce(lcm, iter)


AB = map(int, input().split())
print(least_common_multiple(AB))

Buggy submission (verdict: Runtime Error):
from math import gcd
from functools import reduce


def least_common_multiple(iter):
    '''
    最小公倍数を返す
    '''
    lcm = lambda x, y: x*y//gcd(x, y)
    return reduce(lcm, iter)


AB = map(int, input().split())
print(least_common_multiple(AB))
Problem p02933 (python)

Fixed submission:
a = int(input())
s = input()

print(s if a >= 3200 else 'red')

Buggy submission (verdict: Runtime Error):
n, q = map(int, input().split())
# tree = [list(map(int, input().split())) for i in range(n-1)]
edges = [set() for i in range(n)]
for _ in range(n-1):
    a, b= map(int,input().split())
    edges[a-1].add(b-1)
cnt = [0] * n

for _ in range(q):
    p, x = map(int, input().split())
    cnt[p-1] += x

l = [[0, cnt[0]]]
while len(l) != 0:
    a, b = l.pop()
    if a != 0:
        cnt[a] += b
    for i in edges[a]:
        l.append((i, cnt[a]))
print(*cnt)
Problem p02948 (python)

Fixed submission:
import heapq


class Reverse:
    def __init__(self, val):
        self.val = val

    def __lt__(self, other):
        return self.val > other.val

    def __repr__(self):
        return repr(self.val)


class Heapq:
    def __init__(self, arr, desc=False):
        if desc:
            for i in range(len(arr)):
                arr[i] = Reverse(arr[i])
        self.desc = desc
        self.hq = arr
        heapq.heapify(self.hq)

    def pop(self):
        if len(self.hq) == 0:
            return None
        if self.desc:
            return heapq.heappop(self.hq).val
        else:
            return heapq.heappop(self.hq)

    def push(self, a):
        if self.desc:
            heapq.heappush(self.hq, Reverse(a))
        else:
            heapq.heappush(self.hq, a)

    def top(self):
        if self.desc:
            return self.hq[0].val
        else:
            return self.hq[0]

    def __len__(self):
        return len(self.hq)


n, m = map(int, input().split(' '))
ab = []
for _ in range(n):
    a, b = map(int, input().split(' '))
    if a > m:
        continue
    ab.append((a, b))
ab.sort(reverse=True)

ans = 0
h = Heapq([], desc=True)
for i in range(1, m+1):
    while ab and ab[-1][0] <= i:
        a, b = ab.pop()
        h.push(b)
    if h:
        ans += h.pop()
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split(' '))
ab = []
for _ in range(n):
    ab.append(list(map(int, input().split(' '))))
ab = list(filter(lambda x: x[0] <= m, ab))
ab = sorted(ab, key=lambda x: (-x[1], -x[0]))

ans = 0
while m > 0:
    ab = list(filter(lambda x: x[0] <= m, ab))
    if ab[0][0] <= m:
        ans += ab[0][1]
        ab.pop(0)
    else:
        break
    m -= 1
print(ans)
Problem p02831 (python)

Fixed submission:
a,b=map(int,input().split())
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

def lcm(x, y):
    return (x * y) // gcd(x, y)

print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(a, b))
Problem p03017 (python)

Fixed submission:
n,a,b,c,d=map(int,input().split())
s=input()
s=list(s)
s.append('#')
s.append('#')
out=0
ct=0
if c<d:
    for i in range(a-1,c):
        if s[i]=='#' and s[i+1]=='#':
            out+=1
    for i in range(b-1,d):
        if s[i]=='#' and s[i+1]=='#':
            out+=1
    if out>0:print('No')
    else:print('Yes')
elif c>d:
    for i in range(a-1,c):
        if s[i]=='#' and s[i+1]=='#':
            out+=1
    for i in range(b-1,d):
        if s[i]=='#' and s[i+1]=='#':
            out+=1
    for i in range(b-2,d-1):
        if s[i]=='.' and s[i+1]=='.' and s[i+2]=='.':
            #print('Yes')
            ct+=1
        
    if(out>0 or ct==0):print('No')
    else:print('Yes')

Buggy submission (verdict: Runtime Error):
n,a,b,c,d=map(int,input().split())
s=input()
s=list(s)
s.append('#')
s.append('#')
out=0
if c<d:
    for i in range(a-1,c):
        if s[i]=='#' and s[i+1]=='#':
            out+=1
    for i in range(b-1,d):
        if s[i]=='#' and s[i+1]=='#':
            out+=1
    if out>0:print('No')
    else:print('Yes')
        
elif c>d:
    for i in range(a-1,c):
        if s[i]=='#' and s[i+1]=='#':
            out+=1
    for i in range(b-1,d):
        if s[i]=='#' and s[i+1]=='#':
            out+=1
    for i in range(b-1,d):
        if s[i]=='.' and s[i+1]=='.' and s[i+2]=='.':
            #print('Yes')
            ct+=1
        
    if(out>0 or ct==0):print('No')
    else:print('Yes')
Problem p03013 (python)

Fixed submission:
n, m = map(int, input().split())
li = []
for i in range(m):
    li.append(int(input()))


def fib(dan):
    if dan == 1:
        return 1
    elif dan == 2:
        return 1
    elif dan == 0:
        return 0
    else:
        a1 = 1
        a2 = 1
        a3 = 0
        for _ in range(dan-2):
            a3 = (a1 + a2) % 1000000007
            a1 = a2 % 1000000007
            a2 = a3 % 1000000007

        return a3



if m != 0:
    ans = fib(li[0]) % 1000000007
    for i in range(m-1):
        ans = ans * fib(li[i+1] - li[i] - 1 ) % 1000000007

    ans = ans * fib(n - li[m-1]) % 1000000007
    print(ans)

else:
    print(fib(n+1))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
li = []
for i in range(m):
    li.append(int(input()))


def fib(dan):
    if dan == 1:
        return 1
    elif dan == 2:
        return 1
    elif dan == 0:
        return 0
    else:
        a1 = 1
        a2 = 1
        a3 = 0
        for _ in range(dan-2):
            a3 = a1 + a2 1000000007
            a1 = a2 % 1000000007
            a2 = a3 % 1000000007

        return a3



if m != 0:
    ans = fib(li[0]) % 1000000007
    for i in range(m-1):
        ans = ans * fib(li[i+1] - li[i] - 1 ) % 1000000007

    ans = ans * fib(n - li[m-1]) % 1000000007
    print(ans)

else:
    print(fib(n))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
li = []
for i in range(m):
    li.append(int(input()))


def fib(dan):
    if dan == 1:
        return 1
    elif dan == 2:
        return 1
    else:
        a1 = 1
        a2 = 1
        a3 = 0
        for _ in range(dan-2):
            a3 = a1 + a2
            a1 = a2
            a2 = a3

        return a3

ans = fib(li[0])

for i in range(m-1):
    ans = ans * fib(li[i+1] - li[i] - 1 ) % 1000000007

ans = ans * fib(n - li[m-1]) % 1000000007
print(ans)
Problem p03207 (python)

Fixed submission:
n = int(input())
a = sorted(list(map(int, [input() for i in range(n)])))
ans = sum(a) - (a[n-1] / 2)
print(int(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = sorted(list(map(int, input().split())))
ans = sum(a) - a[n-1] / 2
print(ans)
Problem p03250 (python)

Fixed submission:
l = sorted(list(map(int, input().split())))
print(l[2] * 10 + l[1] + l[0])

Buggy submission (verdict: Runtime Error):
import math
from scipy.misc import comb
 
N, M = map(int, input().split())
li1 = []
li2 = []
a = 1

for j in range(2, int(math.sqrt(M))):
    dest = int(math.sqrt(j))
    for i in range(2,dest):
        if j % i == 0:
            continue
    li1.append(j)

for k in range(len(li1)):
    if M % li1[k] != 0:
        continue
    c = 0
    x = M
    while x % li1[k] == 0:
        x = x / li1[k]
        c += 1
    li2.append(c)

for l in range(len(li2)):
    a *= comb(li2[l] + N - 1, N - 1)

print(int(a))
Problem p02915 (python)

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

Buggy submission (verdict: Runtime Error):
a = input()
print(a ** 3)

Buggy submission (verdict: Runtime Error):
print(input() ** 3)

Buggy submission (verdict: Runtime Error):
n = input()
print(10 ** n)
Problem p02916 (python)

Fixed submission:
sum = 0
n = int(input())
l = [list(map(int, input().split())) for i in range(3)]

for i in range(n-1):
  sum = sum + l[1][i]
  if l[0][i+1] - l[0][i] == 1:
    sum = sum + l[2][l[0][i]-1]
sum = sum + l[1][n-1]
print(sum)

Buggy submission (verdict: Runtime Error):
sum = 0
n = int(input())
l = [list(map(int, input().split())) for i in range(3)]

for i in range(n-1):
  sum = sum + l[1][i]
  if l[0][i+1] - l[0][i] == 1:
    sum = sum + l[2][l[0][i]]
sum = sum + l[1][n-1]
print(sum)

Buggy submission (verdict: Runtime Error):
sum = 0
n = int(input())
l = [list(map(int, input().split())) for i in range(3)]

for i in range(n-1):
  sum = sum + l[1][i]
  if l[0][i+1] - l[0][i] == 1:
    sum = sum + l[2][i]
sum = sum + l[1][n]
print(sum)

Buggy submission (verdict: Runtime Error):
sum = 0
n = int(input())
l = [list(map(int, input().split()) for i in range(3))]

for i in range(n-1):
  sum = sum + l[1][i]
  if l[0][i+1] - l[0][i] == 1:
    sum = sum + l[2][i]
sum = sum + l[1][n]
print(sum)

Buggy submission (verdict: Runtime Error):
sum = 0
n = int(input())
l = [list(map(int, input().split()) for i in range(3))]

for i in range(n):
  sum = sum + l[1][i]
  if l[0][i+1] - l[0][i] == 1:
    sum = sum + l[2][i]
sum = sum + l[1][n]
print(sum)

Buggy submission (verdict: Runtime Error):
sum = 0
n = int(input())
l = [list(map(int, input().split()) for i in range(3))]

for i in range(n):
  sum += l[1][i]
  if l[0][i+1] == l[0][i]+1:
    sum += l[2][i]

print(sum)

Buggy submission (verdict: Runtime Error):
sum = 0
n = input()
l = [list(map(int, input().split()) for i in range(3))]

for i in range(n):
  sum += l[1][i]
  if l[0][i+1] == l[0][i]+1:
    sum += l[2][i]

print(sum)

Buggy submission (verdict: Runtime Error):
sum = 0
n = input()
l = [list(map(int, input().split()) for i in range(3))]

for i in range(n):
  sum += l[1][i]
  if l[0][i] == l[0][i+1]:
    sum += l[2][i]

print(sum)
Problem p03186 (python)

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

if A+B < C-1:
  print(A+B+B+1)
else:
  print(C+B)

Buggy submission (verdict: Runtime Error):
A,B,C=map(int,input())

if A+B < C-1:
  print(A+B+B+1)
else:
  print(C+B)
Problem p03803 (python)

Fixed submission:
A,B=map(int,input().split())
if A==1:
  A+=13
if B==1:
  B+=13

if A==B:
  print("Draw")
elif A<B:
  print("Bob")
else:
  print("Alice")

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
if A==1:
  A+=13
if B==1:
  B+=13:

if A==B:
  print("Draw")
elif A<B:
  print("Bob")
else:
  print("Alice")