Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
N,M = map(int,input().split())
E = [[] for _ in range(N+1)]
for i in range(M):
    x,y,z = map(int,input().split())
    E[x].append(y)
    E[y].append(x)

d = [-1]*(N+1)

def dfs(start,num):
    q = deque([start])
    while(q):
        v = q.pop()
        if(d[v] == -1):
            d[v] = num
        for s in E[v]:
            if(d[s] == -1):
                q.append(s)

group_num = 0
for i in range(1,N+1):
    if(d[i] == -1):
        group_num += 1
        dfs(i,group_num)

print(group_num)    


Fixed submission:
from collections import deque
N,M = map(int,input().split())
E = [[] for _ in range(N+1)]
for i in range(M):
    x,y,z = map(int,input().split())
    E[x].append(y)
    E[y].append(x)

d = [-1]*(N+1)

def dfs(start,num):
    q = deque([start])
    d[start] = num
    while(q):
        v = q.pop()
        for s in E[v]:
            if(d[s] == -1):
                d[s] = num
                q.append(s)

group_num = 0
for i in range(1,N+1):
    if(d[i] == -1):
        group_num += 1
        dfs(i,group_num)

print(group_num)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
N,M = map(int,input().split())
E = [[] for _ in range(N+1)]
for i in range(M):
    x,y,z = map(int,input().split())
    E[x].append(y)
    E[y].append(x)

d = [-1]*(N+1)

def dfs(start,num):
    q = deque([start])
    while(q):
        v = q.pop()
        if(d[v] == -1):
            d[v] = num
        for s in E[v]:
            if(d[s] == -1):
                q.append(s)

group_num = 0
for i in range(1,N+1):
    if(d[i] == -1):
        group_num += 1
        dfs(i,group_num)

print(group_num) 

Fixed submission:
from collections import deque
N,M = map(int,input().split())
E = [[] for _ in range(N+1)]
for i in range(M):
    x,y,z = map(int,input().split())
    E[x].append(y)
    E[y].append(x)

d = [-1]*(N+1)

def dfs(start,num):
    q = deque([start])
    d[start] = num
    while(q):
        v = q.pop()
        for s in E[v]:
            if(d[s] == -1):
                d[s] = num
                q.append(s)

group_num = 0
for i in range(1,N+1):
    if(d[i] == -1):
        group_num += 1
        dfs(i,group_num)

print(group_num)
Buggy python submission (verdict: Time Limit Exceeded):
def roop(now, a_list):
    return a_list[now-1]

if __name__ == '__main__':
    n, k = map(int, input().split())
    a_list = list(map(int, input().split()))
    
    now = 1
    check = [1]
    for i in range(k):
        now = roop(now, a_list)
        if now not in check:
            check.append(now)
        else: 
            break

    point = (check.index(now))
    roop_len = len(check) - point

    if k <= len(check):
        print(check[k])
    else:
        k_ = k - point
        point_ = k_ % roop_len
        print(check[point+point_])

Fixed submission:
if __name__ == '__main__':
    n, k = map(int, input().split())
    a_list = list(map(int, input().split()))
    
    now = 1
    check = [0] * n
    check[0] = 1
    move = [1]
    for i in range(k):
        now = a_list[now-1]
        move.append(now)
        if check[now-1] == 0:
            check[now-1] = 1
        else: 
            break

    point = (move.index(now))
    roop_len = sum(check) - point

    if k <= sum(check):
        print(move[k])
    else:
        k_ = k - point
        point_ = k_ % roop_len
        print(move[point+point_])
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
ans_li = [0 for x in range(a)]

for i in range(b):
  d = int(input())
  for j in range(d):
    l = list(map(int, input().split()))
    for ll in l:
      ans_li[ll-1] += 1
print(ans_li.count(0))


Fixed submission:
a,b = map(int,input().split())
ans_li = [0 for x in range(a)]

for i in range(b):
  d = int(input())
  l = list(map(int, input().split()))
  for ll in l:
      ans_li[ll-1] += 1
print(ans_li.count(0))

Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
ans_li = [0 for x in range(a)]

for i in range(b):
  d = int(input())
  for j in range(d):
    l = list(map(int, input().split()))
    for ll in l:
      ans_li[ll] += 1
print(ans_li.count(0))

Fixed submission:
a,b = map(int,input().split())
ans_li = [0 for x in range(a)]

for i in range(b):
  d = int(input())
  l = list(map(int, input().split()))
  for ll in l:
      ans_li[ll-1] += 1
print(ans_li.count(0))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n, m = map(int, input().split())
h = list(map(int, input().split()))

d = [[float("inf")]*n for i in range(n)] 

for i in range(m):
    a, b = map(int, input().split())
    if (h[a-1] <= h[b-1]):
        d[a-1][b-1] = h[b-1]-h[a-1]
        d[b-1][a-1] = h[a-1]-h[b-1]
    else:
        d[a-1][b-1] = h[b-1]-h[a-1]
        d[b-1][a-1] = h[a-1]-h[b-1]
ans = 0 
for i in range(n):
    al = np.array(d[i])
    al = np.where(al==float('inf'), -1, al)
    if(len(np.where((al >= 0))[0]) == 0):
        ans += 1
print(ans)

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

d = [True for i in range(n)] 

for i in range(m):
    a, b = map(int, input().split())
    if h[a-1] > h[b-1]:
        d[b-1] = False
    elif h[a-1] < h[b-1]:
        d[a-1] = False
    elif h[a-1] == h[b-1]:
        d[a-1] = False
        d[b-1] = False

print(d.count(True))
Buggy python submission (verdict: Runtime Error):
k = int(input())
a, b = map(int, input())

ans = 'NG'
if a % k == 0:
  ans = 'OK'
elif b % k == 0:
  ans = 'OK'
elif (b-a) / k > 0:
  ans = 'OK'
print(ans)

Fixed submission:
k = int(input())
a, b = map(int, input().split())
 
ans = 'NG'
aa =  (a-1) // k
bb =  b // k
if(bb - aa) > 0:
    print('OK')
else:
    print('NG')
Buggy python submission (verdict: Time Limit Exceeded):
import math
a,b,n = map(int, input().split())

ans = 0
lenge = min(b-1, n)
for x in range(lenge+1):
    y = int((a*x)/b) - a * int(x/b)
    ans = max(y, ans)

print(ans)

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

Buggy python submission (verdict: Time Limit Exceeded):
import math
a,b,n = map(int, input().split())

ans = 0
lenge = min(b-1, n)
for x in range(lenge+1):
    y = math.floor((a*x)/b) - a * math.floor(x/b)
    ans = max(y, ans)

print(ans)

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

Buggy python submission (verdict: Time Limit Exceeded):
import math
a,b,n = map(int, input().split())

ans = 0
for x in range(n+1):
    y = math.floor((a*x)/b) - a * math.floor(x/b)
    ans = max(y, ans)

print(ans)

Fixed submission:
a,b,n=map(int,input().split())
x=min(b-1,n)
print((a*x)//b-a*(x//b))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
if __name__ == '__main__':
    n = int(input())
    lis = []
    for i in range(n):
        k = input().rstrip('\n')
        if k in lis :
            pass
        else:
            lis.append(k)
    print(len(lis))


Fixed submission:
if __name__ == '__main__':
    n = int(input())
    print(len(set(input().rstrip('\n') for _ in range(n))))

Buggy python submission (verdict: Time Limit Exceeded):
if __name__ == '__main__':
    n = int(input())
    lis = []
    for i in range(n):
        k = input()
        if k in lis :
            pass
        else:
            lis.append(k)
    print(len(lis))

Fixed submission:
if __name__ == '__main__':
    n = int(input())
    print(len(set(input().rstrip('\n') for _ in range(n))))

Buggy python submission (verdict: Time Limit Exceeded):
if __name__ == '__main__':
    n = int(input())
    lis = []
    for i in range(n):
        lis.append(input())
        lis=list(set(lis))
    print(len(lis))

Fixed submission:
if __name__ == '__main__':
    n = int(input())
    print(len(set(input().rstrip('\n') for _ in range(n))))

Buggy python submission (verdict: Time Limit Exceeded):
if __name__ == '__main__':
    n = int(input())
    lis = ''
    for i in range(n):
        lis = lis + input() + '\t'
    print(len(list(set(lis.rstrip('\t').split('\t')))))

Fixed submission:
if __name__ == '__main__':
    n = int(input())
    print(len(set(input().rstrip('\n') for _ in range(n))))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
import functools

def euclid(a, b):
    if b == 0:
        return a
    else:
        return euclid(b, a%b)
def gcd(nums):
    return functools.reduce(euclid, nums)

k = int(input())
ans = 0
for v in itertools.combinations_with_replacement([i+1 for i in range(k)], 3):
    if len(set(v)) == 1:
        ans = ans + gcd(v) * 1
    elif len(set(v)) == 2:
        ans = ans + gcd(v) * 3
    elif len(set(v)) == 3 :
        ans = ans + gcd(v) * 6
print(ans)

Fixed submission:
from math import gcd
k=int(input())
ans=0
for i in range(1,k+1):
    for j in range(1,k+1):
        ans_=gcd(i,j)
        for l in range(1,k+1):
            ans+=gcd(ans_,l)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input())

st_list = ['R', 'G', 'B']
ans = 0
for i, i_s in enumerate(s):
    first = [i, i_s]
    s_2 = s[i+1:]
    
    for j, j_s in enumerate(s_2):
        if (first[1]!=j_s):
            second = [j, j_s]
            s_3 = s_2[j+1:]
        else:
            continue

        for st_ in st_list:
            if (st_ != first[1] and st_ != second[1]):
                search_w = st_
	
        ans += s_3.count(search_w)
        if len(s_3) > second[0]:
            if s_3[second[0]] == search_w:
                ans -= 1

print(ans)

Fixed submission:
import itertools
N = int(input())
S = input()
out = S.count('R') * S.count('G') * S.count('B')

RGBs = list(itertools.permutations(['R', 'G', 'B'], 3))
for i in range(1, N):
  for j in range(N-i*2):
    if (S[j], S[j+i], S[j+i*2]) in RGBs:
      out -= 1
print(out)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input())

ans = 0
for i, i_s in enumerate(s):
    first = [i, i_s]
    s_2 = s[i+1:]
    
    for j, j_s in enumerate(s_2):
        if (first[1]!=j_s):
            second = [j, j_s]
            s_3 = s_2[j+1:]
        else:
            continue
        
        for k, k_s in enumerate(s_3):
            if (first[1]!=k_s and second[1]!=k_s and second[0]!=k):
                ans += 1
            else:
                continue
print(ans)

Fixed submission:
import itertools
N = int(input())
S = input()
out = S.count('R') * S.count('G') * S.count('B')

RGBs = list(itertools.permutations(['R', 'G', 'B'], 3))
for i in range(1, N):
  for j in range(N-i*2):
    if (S[j], S[j+i], S[j+i*2]) in RGBs:
      out -= 1
print(out)
Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
	A,B,C = map(int, input().split())	
	if (A - B - C ) >= 0:
		print('0')
	else :
		print(C - (A-B))

Fixed submission:
if __name__ == '__main__':
	a = int(input())
	s = input()
	if a >= 3200:
		print(s)
	else :
		print('red')
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import copy
def input():
	return sys.stdin.readline().rstrip()
def main():
	N = int(input())
	A = [int(input()) for _ in range(N)]
	for i in range(N):
		B = copy.deepcopy(A)
		B.pop(i)
		print(max(B))
if __name__ == '__main__':
	main()

Fixed submission:
import sys
import copy
def input():
	return sys.stdin.readline().rstrip()
def main():
	N = int(input())
	A = [int(input()) for _ in range(N)]
	B = list(set(A))
	if (len(B) == 1) or (A.count(B[-1]) > 1):
		for i in range(N):
			print(B[-1])
	else :
		for i in range(N):
			if A[i] == B[-1]:
				print(B[-2])
			else:
				print(B[-1])
if __name__ == '__main__':
	main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import numpy as np

def input():
	return sys.stdin.readline().rstrip()
def main():
	N = int(input())
	A = [int(input()) for _ in range(N)]
	for i in range(N):
		B = A[:]
		B.pop(i)
		print(max(B))
if __name__ == '__main__':
	main()

Fixed submission:
import sys
import copy
def input():
	return sys.stdin.readline().rstrip()
def main():
	N = int(input())
	A = [int(input()) for _ in range(N)]
	B = list(set(A))
	if (len(B) == 1) or (A.count(B[-1]) > 1):
		for i in range(N):
			print(B[-1])
	else :
		for i in range(N):
			if A[i] == B[-1]:
				print(B[-2])
			else:
				print(B[-1])
if __name__ == '__main__':
	main()
Buggy python submission (verdict: Runtime Error):
import numpy as np

if __name__ == '__main__':
	N = int(input())
	dam = np.array(list(map(int, input().split())))

	index_ = np.array([1 if i % 2 == 0 else -1 for i in range(N)])
	ans = np.array([])
	for i in range(N):
		ans = np.append(ans, np.dot(dam, index_))
		index_ = np.roll(index_, 1)
	ans = [str(int(i)) for i in ans]

	print(' '.join(ans))

Fixed submission:
N, A, B = map(int, input().split())
if N*A < B:
	print(N*A)
else :
	print(B)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

if __name__ == '__main__':
	N = int(input())
	dam = np.array(list(map(int, input().split())))
	
	index_ = np.array([1 if i % 2 == 0 else -1 for i in range(N)])
	ans = []
	for i in range(N):
		ans.append(str(np.dot(dam, index_)))
		index_ = np.roll(index_, 1)
	
	print(' '.join(ans))


Fixed submission:
import numpy as np

if __name__ == '__main__':
	N = int(input())
	dam = np.array(list(map(int, input().split())))
	
	index_ = np.array([1 if i % 2 == 0 else -1 for i in range(N)])
	ans = [int(np.dot(dam, index_))]
	for i in range(N-1):
		ans.append(2 * (dam[i] - ans[i]//2))
	ans = [str(i) for i in ans]
	print(' '.join(ans))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

if __name__ == '__main__':
	N = int(input())
	dam = np.array(list(map(int, input().split())))

	index_ = np.array([1 if i % 2 == 0 else -1 for i in range(N)])
	ans = np.array([])
	for i in range(N):
		ans = np.append(ans, np.dot(dam, index_))
		index_ = np.roll(index_, 1)
	ans = [str(int(i)) for i in ans]

	print(' '.join(ans))


Fixed submission:
import numpy as np

if __name__ == '__main__':
	N = int(input())
	dam = np.array(list(map(int, input().split())))
	
	index_ = np.array([1 if i % 2 == 0 else -1 for i in range(N)])
	ans = [int(np.dot(dam, index_))]
	for i in range(N-1):
		ans.append(2 * (dam[i] - ans[i]//2))
	ans = [str(i) for i in ans]
	print(' '.join(ans))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

if __name__ == '__main__':
	N = int(input())
	dam = np.array(list(map(int, input().split())))

	index_ = np.array([1 if i % 2 == 0 else -1 for i in range(N)])
	ans = np.array([])
	for i in range(N):
		ans = np.append(ans, np.dot(dam, index_))
		index_ = np.roll(index_, 1)
	ans = [str(int(i)) for i in ans]

	print(' '.join(ans))

Fixed submission:
import numpy as np

if __name__ == '__main__':
	N = int(input())
	dam = np.array(list(map(int, input().split())))
	
	index_ = np.array([1 if i % 2 == 0 else -1 for i in range(N)])
	ans = [int(np.dot(dam, index_))]
	for i in range(N-1):
		ans.append(2 * (dam[i] - ans[i]//2))
	ans = [str(i) for i in ans]
	print(' '.join(ans))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

if __name__ == '__main__':
	N = int(input())
	dam = np.array(list(map(int, input().split())))

	index_ = np.array([1 if i % 2 == 0 else -1 for i in range(N)])
	ans = np.array([])
	for i in range(N):
		index_ = np.roll(index_, 1)
		ans = np.append(ans, np.dot(dam, index_))
	ans = np.roll(ans, 1)
	ans = [str(int(i)) for i in ans]

	print(' '.join(ans))

Fixed submission:
import numpy as np

if __name__ == '__main__':
	N = int(input())
	dam = np.array(list(map(int, input().split())))
	
	index_ = np.array([1 if i % 2 == 0 else -1 for i in range(N)])
	ans = [int(np.dot(dam, index_))]
	for i in range(N-1):
		ans.append(2 * (dam[i] - ans[i]//2))
	ans = [str(i) for i in ans]
	print(' '.join(ans))
Buggy python submission (verdict: Runtime Error):
x, y = map(int, input().split())

ans = 0

for i in range(0:x + 1):
  rest = y - 2 * i
  if rest % 4 == 0:
    print('Yes')
    ans = 1
    break

if ans == 0:
  print('No')


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

ans = 0

for i in range(0, x + 1):
  # i is the number of the crane
  rest = y - (2 * i)
  if rest / 4 == x - i:
    print('Yes')
    ans = 1
    break

if ans == 0:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

ans = 1

for i in range(n):
    ans *= a[i]

if ans > 10**18:
        ans =-1

print(ans)


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

a = sorted(a)

ans = 1

for i in range(n):
  ans *= a[i]
  
  if ans == 0:
    break
  
  if ans > 10**18:
    ans = -1
    break

print(ans)
Buggy python submission (verdict: Runtime Error):
k = input()
s = input()

l = len(s)

if k >= l:
   print(k)
else:
  print(s[k - 1] + '...')

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

l = len(s)

if k >= l:
   print(s)
else:
  print(s[:k] + '...')
Buggy python submission (verdict: Runtime Error):
import numpy as np

r = int(input())

print(2*np.pu*r)

Fixed submission:
import numpy as np
r = int(input())

print(2 * np.pi * r)
Buggy python submission (verdict: Runtime Error):
k, n = input().split()
k, n = int(k), int(n)
a = list(map(int, input().split()))

max = 0

for i in range(n - 1):
  if a[i + 1] - a[i] > max:
    max = a[i + 1] - a[i]

if (k - a[n]) + a[0] >= max:
  max = (k - a[n]) + a[0]

print(k - max)


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

max = 0

for i in range(n - 1):
  if a[i + 1] - a[i] > max:
    max = a[i + 1] - a[i]

if (k - a[n - 1]) + a[0] >= max:
  max = (k - a[n - 1]) + a[0]

print(k - max)

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

max = 0

for i in range(n - 1):
  if a[i + 1] - a[i] > max:
    max = a[i + 1] - a[i]

if (k - a[n]) + a[0] >= max:
  max = (k - a[n]) + a[0]

print(k - max)

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

max = 0

for i in range(n - 1):
  if a[i + 1] - a[i] > max:
    max = a[i + 1] - a[i]

if (k - a[n - 1]) + a[0] >= max:
  max = (k - a[n - 1]) + a[0]

print(k - max)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(int, input().split()))

ans = 0

for i in range(n):
    a = p[:i + 1]
    
    if min(a) >= p[i]:
        ans += 1
print(ans)



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

ans = 0

c = p[0]

for i in range(n):
    #a = p[:i + 1]

    if c >= p[i]:
        c = p[i]
    if c >= p[i]:
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(int, input().split()))

ans = 0

for i in range(n):
    a = p[:i + 1]
    
    if min(a) >= p[i]:
        ans += 1
print(ans)


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

ans = 0

c = p[0]

for i in range(n):
    #a = p[:i + 1]

    if c >= p[i]:
        c = p[i]
    if c >= p[i]:
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
x = int(input())

#def prime number discriminator
def prime_or_not(a):
  b = 0
  for i in range(a):
    if a % i == 0:
      b += 1
    if b >= 1:
      return 0:
    else:
      return 1:

ans = 0

while ans =< 0:
  ans += primt_or_not(a)
  a += 1
print(a - 1)

Fixed submission:
x = int(input())

#def prime number discriminator

def prime_or_not(a):
  b = 0
  i = 2

  if a == 2:
    ans = True
    
  else:
    while i <= a - 1 and b < 1:
      if a % (i)== 0:
        b += 1
        i += 1
      else:
        i += 1
      
      if b >= 1:
        ans = False
      else:
        ans = True

    return ans

ans = 0

if x == 2:
  print(2)
else:
  while ans <1:
    ans += prime_or_not(x)
    x += 1
  print(x - 1)
Buggy python submission (verdict: Runtime Error):
s = input()

if s == 'Sunny':
  print('Cloudy')
elif s == 'Cloudy':
  print('Rainy')
elif s == 'Rainy':
print('Sunny')


Fixed submission:
s = input()

if s == 'Sunny':
    print('Cloudy')
elif s == 'Cloudy':
    print('Rainy')
elif s == 'Rainy':
    print('Sunny')

Buggy python submission (verdict: Runtime Error):
s = input()

if s == 'Sunny':
  print('Cloudy')
elif s == 'Cloudy':
  print('Rainy')
elif s == 'Rainy'
print('Sunny')

Fixed submission:
s = input()

if s == 'Sunny':
    print('Cloudy')
elif s == 'Cloudy':
    print('Rainy')
elif s == 'Rainy':
    print('Sunny')
Buggy python submission (verdict: Runtime Error):
a = input()
b = a ** 3
print(int(b))

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

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

Fixed submission:
a = int(input())
b = a ** 3
print(int(b))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

m = 0

for i in range(n):
  num = int(a[i])
  m += b[num - 1]
  
  if num != n and != n - 1:
    if int(a[i]) == int(a[i + 1]):
      m += c[num - 1]
    
print(m)
print(a[0])


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

m = 0

for i in range(n):
  num = int(a[i])
  m += b[num - 1]
#  print(i, m)  #erase later
  if num != n and i != n - 1:
    if num + 1 == int(a[i + 1]):
      m += c[num - 1]
#      print('C point', m)  #erase later
print(m)

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

m = 0

for i in range(n):
  num = int(a[i])
  m += b[num - 1]
  
  if num != n:
    if int(a[i]) == int(a[i + 1]):
      m += c[num - 1]
    
print(m)
print(a[0])


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

m = 0

for i in range(n):
  num = int(a[i])
  m += b[num - 1]
#  print(i, m)  #erase later
  if num != n and i != n - 1:
    if num + 1 == int(a[i + 1]):
      m += c[num - 1]
#      print('C point', m)  #erase later
print(m)

Buggy python submission (verdict: Runtime Error):
n = int(imput())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

m = 0

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

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

m = 0

for i in range(n):
  num = int(a[i])
  m += b[num - 1]
#  print(i, m)  #erase later
  if num != n and i != n - 1:
    if num + 1 == int(a[i + 1]):
      m += c[num - 1]
#      print('C point', m)  #erase later
print(m)
Buggy python submission (verdict: Runtime Error):
forecast = input()
real = input()

a = 0

for i in range(0,2)
  if forecast[i] == real[i]:
    a += 1
    
print(a)

Fixed submission:
forecast = input()
real = input()

a = 0

for i in range(0,3):
  if forecast[i] == real[i]:
    a += 1
    
print(a)
Buggy python submission (verdict: Runtime Error):
a = int(input())
s = input()

if a <= 3200:
  print('red')
elsd:
  print(s)


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

if a < 3200:
  print('red')
else:
  print(s)

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

if a >= 3200:
  print('red')
elsd:
  print(s)

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

if a < 3200:
  print('red')
else:
  print(s)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

gyk1 = 0
for i in range(n):
  gyk1 += 1 / a[i]

print(1 / gyak1)

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

gyk1 = 0
for i in range(n):
  gyk1 += 1 / a[i]

print(1 / gyk1)
Buggy python submission (verdict: Runtime Error):
n = list(map(int, input().split()))
a = n[0]
b = n[1]

ab1 = a + b
ab2 = a - b
ab3 = a * b

print(int(max(ab1, ab2, ba3))
      

Fixed submission:
ab = list(map(int, input().split()))
a = ab[0]
b = ab[1]

ans1 = a + b
ans2 = a - b
ans3 = a * b

print(max(ans1, ans2, ans3))