Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
#  = input()
#a  = int(input())
n, a, b = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

if a == 0:
  print(0)
else:
  nab = n // (a + b)
  ans = nab * a
  mod = n % (nab * (a + b))
  ans += min(mod, a)
  print(ans)


Fixed submission:
#!/usr/bin/env python3
#  = input()
#a  = int(input())
n, a, b = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

if a == 0:
  print(0)
elif n < (a + b):
  print(min(n, a))
else:
  nab = n // (a + b)
  ans = nab * a
  mod = n % (nab * (a + b))
  ans += min(mod, a)
  print(ans)

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
#  = input()
#a  = int(input())
n, a, b = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

ans = n // a
if (n // (a + b)) % 2 == 1:
    ans += ans % n
print(ans)


Fixed submission:
#!/usr/bin/env python3
#  = input()
#a  = int(input())
n, a, b = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

if a == 0:
  print(0)
elif n < (a + b):
  print(min(n, a))
else:
  nab = n // (a + b)
  ans = nab * a
  mod = n % (nab * (a + b))
  ans += min(mod, a)
  print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
#  = int(input())
a, b = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()


for i in range(0, 10**7):
    if int(i * 0.08) == a and int(i * 0.1) == b:
        print(i)
        break
else:
    print(-1)


Fixed submission:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
#  = int(input())
a, b = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()


for i in range(0, 10**7):
    if int(i * 0.08) == a and int(i * 0.1) == b:
        print(i)
        break
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
import collections
import itertools as it
import math
import numpy as np

# A = input()
# A = int(input())
# A = map(int, input().split())
# A = list(map(int, input().split()))
# A = [int(input()) for i in range(N)]
#
# c = collections.Counter()

X = int(input())
nshina = X // 100
kingaku = X - nshina * 100
# print(kingaku)

is_exist = False
for i0 in range(nshina):
    for i1 in range(nshina - i0):
        for i2 in range(nshina - i0 - i1):
            for i3 in range(nshina - i0 - i1 - i2):
                for i4 in range(nshina - i0 - i1 - i2 - i3):
                    # print(nshina, i0, i1, i2, i3, i4, (nshina - i4 - i3 - i2 - i1 - i0))
                    # print(i1 + i2 * 2 + i3 * 3 + i4 * 4 + (nshina-i4-i3-i2-i1-i0) * 5)
                    if i1 + i2 * 2 + i3 * 3 + i4 * 4 + (nshina-i4-i3-i2-i1-i0) * 5 == kingaku:
                        print(1)
                        exit()

print(0)

Fixed submission:
import collections
import itertools as it
import math
import numpy as np

# A = input()
# A = int(input())
# A = map(int, input().split())
# A = list(map(int, input().split()))
# A = [int(input()) for i in range(N)]
#
# c = collections.Counter()

X = int(input())
nshohin = X // 100
amari = X % 100

print(0 if nshohin * 5 < amari else 1)
Buggy python submission (verdict: Runtime Error):
import collections
import numpy as np

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

A, B = map(int, input().split())

if 1 <= A <= 9 and 1 <= B <= 9:
  print(A * B)
  else:
    print(-1)

Fixed submission:
import collections
import numpy as np
 
# = input()
# = int(input())
# = map(int, input().split())
# = list(map(int, input().split()))
#
 
A, B = map(int, input().split())
 
if 1 <= A <= 9 and 1 <= B <= 9:
  print(A * B)
else:
  print(-1)
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())

if A > B*2:
  print(A - B*2)
  else:
    print(0)

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

if A > B*2:
  print(A - B*2)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
import re
 
s = input()
k = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
c = collections.Counter(s)

def nchars(s, n):
    """文字列 s に、同じ文字が n 個以上連続している部分文字列を見つける
    """
    assert n > 0
    reg = re.compile("(.)\\1{%d,}" % (n - 1))  # カンマを取ると n 個ちょうどになる
    while True:
        m = reg.search(s)
        if not m:
            break
        yield m.group(0)
        s = s[m.end():]

ans = 0

chains = list(nchars(s, 2))

if len(c) == 1:
    print(len(s) * k // 2)
else:
    #print(chains)
    #print(len(chains[0]), len(chains[-1]), k)
    for r in chains:
        ans += len(r) // 2

    print(ans * k + (k - 1 if chains[0] == chains[-1] else 0))


Fixed submission:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
import re
 
s = input()
k = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
c = collections.Counter(s)

def nchars(s, n):
    """文字列 s に、同じ文字が n 個以上連続している部分文字列を見つける
    """
    assert n > 0
    reg = re.compile("(.)\\1{%d,}" % (n - 1))  # カンマを取ると n 個ちょうどになる
    while True:
        m = reg.search(s)
        if not m:
            break
        yield m.group(0)
        s = s[m.end():]

ans = 0

chains = list(nchars(s, 2))

if len(c) == 1:
    print(len(s) * k // 2)
else:
    #print(chains)
    #print(len(chains[0]), len(chains[-1]), k)
    for r in chains:
        ans += len(r) // 2

    if chains and chains[0] == chains[-1]:
        print(ans * k + (k - 1 if chains[0] == chains[-1] else 0))
    else:
        print(ans * k)
Buggy python submission (verdict: Runtime Error):
import math 

A, B = map(int, input().split())

def sieve_of_eratosthenes(n): 
    candidate = [i for i in range(2, n+1)] 
    prime = []
    limit = math.sqrt(n) + 1 

    while True:
        p = min(candidate) 
        if limit <= p:
            prime.extend(candidate) 
            break
        prime.append(p) 

        candidate = [i for i in candidate if i % p != 0]

    return prime

def divisor(n): #nの約数を全て求める
    i = 1
    table = []
    while i * i <= n:
        if n % i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    
    return list(set(table))
  
ma = max(A, B)
mi = min(A, B)

yakusu = [d for d in divisor(mi) if ma % d == 0]

yakumax = max(yakusu)
if yakumax == 1:
	prime = [1]
elif yakumax == 2:
  prime = [1, 2]
else:
  prime = sieve_of_eratosthenes(500)
  prime.append(1)

c = 0
for y in yakusu:
  if y in prime:
    c += 1

if A == B:
  print(1)
else:
  print (c)

Fixed submission:
N = int(input())

odd = 0
for i in range(N):
  if i % 2 == 0:
  	odd += 1

print(odd / N)

Buggy python submission (verdict: Runtime Error):
import math 

A, B = map(int, input().split())

def sieve_of_eratosthenes(n): 
    candidate = [i for i in range(2, n+1)] 
    prime = []
    limit = math.sqrt(n) + 1 

    while True:
        p = min(candidate) 
        if limit <= p:
            prime.extend(candidate) 
            break
        prime.append(p) 

        candidate = [i for i in candidate if i % p != 0]

    return prime

def divisor(n): #nの約数を全て求める
    i = 1
    table = []
    while i * i <= n:
        if n % i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    
    return list(set(table))
  
ma = max(A, B)
mi = min(A, B)

yakusu = [d for d in divisor(mi) if ma % d == 0]

yakumax = max(yakusu)
if yakumax == 1:
	prime = [1]
elif yakumax == 2:
  prime = [1, 2]
else:
  prime = sieve_of_eratosthenes(yakumax)
  prime.append(1)

c = 0
for y in yakusu:
  if y in prime:
    c += 1
    
print (c)

Fixed submission:
N = int(input())

odd = 0
for i in range(N):
  if i % 2 == 0:
  	odd += 1

print(odd / N)
Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
n = N -1
print((n//2) * (2*1 + (n-1)*1))

Fixed submission:
S = input()
T = input()

c = 0
for s, t in zip(S, T):
  if s == t:
    c += 1

print(c)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
#  = int(input())
a, b, c, d  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

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

nlcmc = b // c
nlcmd = b // d
nlcmcd = b // lcm(c, d)
nb = b - (nlcmc + nlcmd - nlcmcd)

a -= 1
nlcmc = a // c
nlcmd = a // d
nlcmcd = a // lcm(c, d)
na = a - (nlcmc + nlcmd - nlcmcd)

print(nb - na)


Fixed submission:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
#  = int(input())
a, b, c, d  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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

nlcmc = b // c
nlcmd = b // d
nlcmcd = b // lcm(c, d)
nb = b - (nlcmc + nlcmd - nlcmcd)

a -= 1
nlcmc = a // c
nlcmd = a // d
nlcmcd = a // lcm(c, d)
na = a - (nlcmc + nlcmd - nlcmcd)

print(nb - na)
Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())
L = list(map(int, input().split()))

c = 0
zahyo = 0
for i in range(100000):
  c += 1
  zahyo += L[i]
  
  if zahyo > X:
    break
    
print(c)
  

Fixed submission:
N, X = map(int, input().split())
L = list(map(int, input().split()))
 
c = 1
d = 0
for i in range(0, len(L)):
  d += L[i]
  
  if d > X:
    break
  else:
    c += 1
    
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
#  = int(input())
r, g, b, n  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

ans = 0
for r_ in range(n+1):
    for g_ in range(n+1):
        sum_ = n - (r_ * r + g_ * g)
        if sum_ >= 0 and sum_ % b == 0:
            ans += 1

print(ans)




Fixed submission:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
#  = int(input())
r, g, b, n  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

ans = 0
for r_ in range(n+1):
    for g_ in range(n+1):
        sum_ = n - (r_ * r + g_ * g)
        if sum_ >= 0 and sum_ % b == 0:
            ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int, input().split())
S = input()

lia = [1 if s == 'A' else 0 for s in S]
lis = [1 if s == 'C' else 0 for s in S]
liac = [a * c for a, c in zip (lia[:-1], lis[1:])]

for i in range(Q):
  l, r = map(int, input().split())
  print(sum(liac[l-1:r-1]))

Fixed submission:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = int(input())
n, q  = map(int, input().split())
s  = input()
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

nac = []
c = 0
for i, s_ in enumerate(s):
    if s[i] == 'C':
        if s[i-1] == 'A':
            c += 1

    nac.append(c)

#print(nac)

for _ in range(q):
    l, r = map(int, input().split())
    print(nac[r-1] - nac[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int, input().split())
S = input()

for i in range(Q):
  c = 0
  l, r = map(int, input().split())
  li = S[l-1:r]
  for j, s in enumerate(li[:-1]):
    if li[j] == 'A' and li[j+1] == 'C':
      c += 1
  
  print(c)

Fixed submission:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = int(input())
n, q  = map(int, input().split())
s  = input()
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

nac = []
c = 0
for i, s_ in enumerate(s):
    if s[i] == 'C':
        if s[i-1] == 'A':
            c += 1

    nac.append(c)

#print(nac)

for _ in range(q):
    l, r = map(int, input().split())
    print(nac[r-1] - nac[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int, input().split())
S = input()

for i in range(Q):
  l, r = map(int, input().split())
  print(''.join(S[l-1:r]).count('AC'))

Fixed submission:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = int(input())
n, q  = map(int, input().split())
s  = input()
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

nac = []
c = 0
for i, s_ in enumerate(s):
    if s[i] == 'C':
        if s[i-1] == 'A':
            c += 1

    nac.append(c)

#print(nac)

for _ in range(q):
    l, r = map(int, input().split())
    print(nac[r-1] - nac[l-1])
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
s  = input()
#  = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

query = list('keyence')

import re

for p in range(8):
    b = ''.join(query[:p])
    a = ''.join(query[p:])

    pattern = f'.*{b}.*{a}.*'
    if re.findall(pattern, s):
        print('YES')
        break
else:
    print('NO')


Fixed submission:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
s  = input()
#  = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

query = list('keyence')

import re

for p in range(8):
    b = ''.join(query[:p])
    a = ''.join(query[p:])

    pattern1 = r'{}{}'.format(b, a)
    pattern2 = r'^{}.*{}$'.format(b, a)
    #print(re.findall(pattern1, s))
    #print(re.findall(pattern2, s))
    if re.findall(pattern1, s) or re.findall(pattern2, s):
        print('YES')
        break
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
n = int(input())
vlist = list(map(int, input().split(" ")))

head = vlist[::2]
foll = vlist[1::2]

import collections
ch = collections.Counter(head).most_common()
cf = collections.Counter(foll).most_common()

h_ = ch[0]
f_ = cf[0]

if h_[0] == f_[0]:
    if h_[1] > f_[1]:
        if len(cf) != 1:
            f_ = cf[1]
        else:
            f_ = (-1.1, 0)
    else:
        if len(ch) != 1:
            h_ = ch[1]
        else:
            h_ = (-1.1, 0)
elif h_[1] == f_[1]:
    if h_[0] == vlist[0]:
        f_ = (-1.1, 0)
    else:
        h_ = (-1.1, 0)

count = 0
for i in range(len(vlist)):
    if i % 2 == 0 and vlist[i] != h_[0]:
        count += 1
    if i % 2 == 1 and vlist[i] != f_[0]:
        count += 1

print(count)

Fixed submission:
intput_ = list(input())
output = ""
for s_ in intput_:
  if s_ == '1':
    output += "9"
  elif s_ == '9':
    output += "1"
  else:
    output += s_

print(output)

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

head = vlist[::2]
foll = vlist[1::2]

import collections
ch = collections.Counter(head).most_common()
cf = collections.Counter(foll).most_common()

h_ = ch[0]
f_ = cf[0]

if h_[0] == f_[0]:
    #if h_[1] == f_[1]:
    #    if h_[0] == vlist[0]:
    #        f_ = (-1.1, 0)
    #    else:
    #        h_ = (-1.1, 0)
    if h_[1] > f_[1]:
        if len(cf) != 1:
            f_ = cf[1]
        else:
            f_ = (-1.1, 0)
    else:
        if len(ch) != 1:
            h_ = ch[1]
        else:
            h_ = (-1.1, 0)

count = 0
for i in range(len(vlist)):
    if i % 2 == 0 and vlist[i] != h_[0]:
        count += 1
    if i % 2 == 1 and vlist[i] != f_[0]:
        count += 1

print(count)

Fixed submission:
intput_ = list(input())
output = ""
for s_ in intput_:
  if s_ == '1':
    output += "9"
  elif s_ == '9':
    output += "1"
  else:
    output += s_

print(output)

Buggy python submission (verdict: Runtime Error):
import collections

n = int(input())
vlist = list(map(int, input().split(" ")))

import collections
c = collections.Counter(vlist)

head = c.most_common()[0][0]
if c.most_common()[0][1] == n:
    foll = -1
else:
    foll = c.most_common()[1][0]


for i in range(len(vlist)):
    if vlist[i] == head:
        break
    if vlist[i] == foll:
        head, foll == foll, head
        break

count = 0
for i in range(len(vlist)):
    if i % 2 == 0 and vlist[i] != head:
        count += 1
    if i % 2 == 1 and vlist[i] != foll:
        count += 1

print(count)

Fixed submission:
intput_ = list(input())
output = ""
for s_ in intput_:
  if s_ == '1':
    output += "9"
  elif s_ == '9':
    output += "1"
  else:
    output += s_

print(output)
Buggy python submission (verdict: Runtime Error):
import collections

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

if len(set(v)) == 1:
  print(n//2)
else:
  v1 = v[::2]
  v2 = v[1::2]
  
  cl1 = collections.Counter(v1)
  cl2 = collections.Counter(v2)
  
  cmc_1st_1 = cl1.most_common()[0][1]
  cmc_1st_2 = cl2.most_common()[0][1]
  
  if cmc_1st_1 == cmc_1st_2:
    cmc_2nd_1 = cl1.most_common()[1][1]
    cmc_2nd_2 = cl2.most_common()[1][1] 
    
    if cmc_2nd_1 > cmc_2nd_2:
      ans = len(v1) - cmc_2nd_1
      ans += len(v2) - cmc_1st_2
    else:
      ans = len(v1) - cmc_1st_1
      ans += len(v2) - cmc_2nd_2
  else:
    ans = len(v1) - cmc_1st_1
    ans += len(v2) - cmc_1st_2
  
  print(ans)

Fixed submission:
import collections

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

if len(set(v)) == 1:
  print(n//2)
else:
  v1 = v[::2]
  v2 = v[1::2]
  
  cmc1 = collections.Counter(v1).most_common()
  cmc2 = collections.Counter(v2).most_common()
  
  if cmc1[0][0] == cmc2[0][0]:    
    ans1 = (len(v1) - cmc1[0][1]) + (len(v2) - cmc2[1][1])
    ans2 = (len(v1) - cmc1[1][1]) + (len(v2) - cmc2[0][1])
    print(min(ans1, ans2))
  else:
    ans = (len(v1) - cmc1[0][1]) + (len(v2) - cmc2[0][1])
    print(ans)

Buggy python submission (verdict: Runtime Error):
import collections

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

if len(set(v)) == 1:
  print(n//2)
else:
  v1 = v[::2]
  v2 = v[1::2]
  
  cl1 = collections.Counter(v1)
  cl2 = collections.Counter(v2)
  
  cmc_1st_1 = cl1.most_common()[0][1]
  cmc_1st_2 = cl2.most_common()[0][1]
  cmc_2nd_1 = cl1.most_common()[1][1]
  cmc_2nd_2 = cl2.most_common()[1][1] 
  
  if cmc_1st_1 == cmc_1st_2:
    if cmc_2nd_1 > cmc_2nd_2:
      ans = len(v1) - cmc_2nd_1
      ans += len(v2) - cmc_1st_2
    else:
      ans = len(v1) - cmc_1st_1
      ans += len(v2) - cmc_2nd_2
  else:
    ans = len(v1) - cmc_1st_1
    ans += len(v2) - cmc_1st_2
  
  print(ans)

Fixed submission:
import collections

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

if len(set(v)) == 1:
  print(n//2)
else:
  v1 = v[::2]
  v2 = v[1::2]
  
  cmc1 = collections.Counter(v1).most_common()
  cmc2 = collections.Counter(v2).most_common()
  
  if cmc1[0][0] == cmc2[0][0]:    
    ans1 = (len(v1) - cmc1[0][1]) + (len(v2) - cmc2[1][1])
    ans2 = (len(v1) - cmc1[1][1]) + (len(v2) - cmc2[0][1])
    print(min(ans1, ans2))
  else:
    ans = (len(v1) - cmc1[0][1]) + (len(v2) - cmc2[0][1])
    print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))

ma = -np.inf
for i in range(N-1):
  if sum(A1[:i+1]) + sum(A2[i:]) > ma:
    ma = sum(A1[:i+1]) + sum(A2[i:])
    
if N == 1:
  ma = A1[0] + A2[0]
  
print(ma)

Fixed submission:
import numpy as np

N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
 
ma = -np.inf
for i in range(N-1):
  if sum(A1[:i+1]) + sum(A2[i:]) > ma:
    ma = sum(A1[:i+1]) + sum(A2[i:])
    
if N == 1:
  ma = A1[0] + A2[0]
  
print(ma)

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


ma = -np.inf
for i in range(N-1):
  if sum(A1[:i+1]) + sum(A2[i:]) > ma:
    ma = sum(A1[:i+1]) + sum(A2[i:])

  if N == 1:
    ma = A1[0] + A2[0]

print(ma)

Fixed submission:
import numpy as np

N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
 
ma = -np.inf
for i in range(N-1):
  if sum(A1[:i+1]) + sum(A2[i:]) > ma:
    ma = sum(A1[:i+1]) + sum(A2[i:])
    
if N == 1:
  ma = A1[0] + A2[0]
  
print(ma)
Buggy python submission (verdict: Runtime Error):
n = int(input())
p = list(map(int, input().split()))

ans = 0
for i, _ in enumerate(p[:-1]):
    #print(p_, i+1)
    p_ = p[i]
    if p_ == i + 1:
        ans += 1
        p[i], p[i+1] = p[i+1], p[i]

if p[-1] = N:
  ans += 1
        
print(ans)



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

ans = 0
for i, _ in enumerate(p[:-1]):
    #print(p_, i+1)
    p_ = p[i]
    if p_ == i + 1:
        ans += 1
        p[i], p[i+1] = p[i+1], p[i]

if p[-1] == n:
  ans += 1
        
print(ans)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import collections
import itertools as it
import math
import numpy as np
 
#  = input()
n  = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))
t  = [int(input()) for i in range(n)]
#
# c = collections.Counter()
print(np.lcm.reduce(t))


Fixed submission:
#!/usr/bin/env python3
import collections
import itertools as it
import math
import numpy as np
import functools
 
#  = input()
n  = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))
t  = [int(input()) for i in range(n)]
#
# c = collections.Counter()

def euclid(a, b):
    if b == 0:
        return a
    else:
        return euclid(b, a%b)

def multiple(a, b):
    return a*b // euclid(a, b)

def gcd(nums):
    return functools.reduce(euclid, nums)

def lcm(nums):
        return functools.reduce(multiple, nums)

print(lcm(t))

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import collections
import itertools as it
import math
from functools import reduce
#import numpy as np
 
#  = input()
n  = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))
t  = [int(input()) for i in range(n)]
#
# c = collections.Counter()

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

print(lcm_list(t))


Fixed submission:
#!/usr/bin/env python3
import collections
import itertools as it
import math
import numpy as np
import functools
 
#  = input()
n  = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))
t  = [int(input()) for i in range(n)]
#
# c = collections.Counter()

def euclid(a, b):
    if b == 0:
        return a
    else:
        return euclid(b, a%b)

def multiple(a, b):
    return a*b // euclid(a, b)

def gcd(nums):
    return functools.reduce(euclid, nums)

def lcm(nums):
        return functools.reduce(multiple, nums)

print(lcm(t))