Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())

output = np.zeros(N)

for x in range(1,int(np.sqrt(N-2))+1):
    for y in range(1,x+1):
        if x**2 + y**2 + x*y > N:
            break
        for z in range(1,y+1):
            index = x**2 + y**2 + z**2 + x*y + y*z + z*x
            
            if index > N:
                break
            
            dup = len(set([x,y,z]))
            
            if dup == 3:
                output[index-1] += 6
            elif dup == 2:
                output[index-1] += 3
            elif dup == 1:
                output[index-1] += 1
                
for i in range(N):
    print(int(output[i]))

Fixed submission:
import numpy as np
 
N = int(input())
 
output = np.zeros(N)
 
for x in range(1,int(np.sqrt(N))+1):
    for y in range(1,x+1):
        if x**2 + y**2 + x*y > N:
            break
        for z in range(1,y+1):
            index = x**2 + y**2 + z**2 + x*y + y*z + z*x
            
            if index > N:
                break
            
            dup = len(set([x,y,z]))
            
            if dup == 3:
                output[index-1] += 6
            elif dup == 2:
                output[index-1] += 3
            elif dup == 1:
                output[index-1] += 1
                
for i in range(N):
    print(int(output[i]))

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

N = int(input())

output = np.zeros(N)

for x in range(1,int(np.sqrt(N-2))+1):
    for y in range(1,x+1):
        for z in range(1,y+1):
            index = x**2 + y**2 + z**2 + x*y + y*z + z*x
            
            if index > N:
                break
            
            dup = len(set([x,y,z]))
            
            if dup == 3:
                output[index-1] += 6
            elif dup == 2:
                output[index-1] += 3
            elif dup == 1:
                output[index-1] += 1
                
for i in range(N):
    print(int(output[i]))

Fixed submission:
import numpy as np
 
N = int(input())
 
output = np.zeros(N)
 
for x in range(1,int(np.sqrt(N))+1):
    for y in range(1,x+1):
        if x**2 + y**2 + x*y > N:
            break
        for z in range(1,y+1):
            index = x**2 + y**2 + z**2 + x*y + y*z + z*x
            
            if index > N:
                break
            
            dup = len(set([x,y,z]))
            
            if dup == 3:
                output[index-1] += 6
            elif dup == 2:
                output[index-1] += 3
            elif dup == 1:
                output[index-1] += 1
                
for i in range(N):
    print(int(output[i]))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

D = np.array([len(make_divisors(n)) for n in range(1,N+1)])
D1 = np.arange(1,N+1)
print(sum(D*D1))

Fixed submission:
N = int(input())

ans = 0
for j in range(1,N+1):
    num = int(N/j)
    ans += num*(num+1)/2*j
print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
#%%
temp1 = 1
T = A[0: K]
for i in T:
    temp1 *= i

arr = []
arr.append(temp1)

for i in range(K, N):
    temp1 = arr[-1]
    temp2 = arr[-1]
    temp2 /= A[i - K]
    temp2 *= A[i]
    arr.append(temp2)
    if temp1 < temp2:
        print("Yes")
    else:
        print("No")


Fixed submission:

N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

#%%

for i in range(K, N):
    if A[i - K] < A[i]:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
#%%
temp1 = 1
T = A[0: K]
for i in T:
    temp1 *= i

arr = []
arr.append(temp1)

for i in range(K, N):
    temp2 = arr[-1]
    temp2 /= A[i - K]
    temp2 *= A[i]
    arr.append(temp2)
    if arr[-2] < arr[-1]:
        print("Yes")
    else:
        print("No")
       

Fixed submission:

N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

#%%

for i in range(K, N):
    if A[i - K] < A[i]:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
#%%
temp1 = 1
T = A[0: K]
for i in T:
    temp1 *= i

temp2 = temp1

for i in range(K, N):
    temp2 /= A[i - K]
    temp2 *= A[i]
    if temp1 < temp2:
        print("Yes")
    else:
        print("No")
    temp1 = temp2


Fixed submission:

N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

#%%

for i in range(K, N):
    if A[i - K] < A[i]:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
5 4 1
1000000000 1000000000 1000000000 1000000000 1000000000
1000000000 1000000000 1000000000 1000000000

Fixed submission:
# %%

N, M, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]

# %%
AA = [0] * (N + 1)
BB = [0] * (M + 1)
for i, v in enumerate(A):
    AA[i + 1] += v + AA[i]
for i, v in enumerate(B):
    BB[i + 1] += v + BB[i]

ans = 0
b_cnt = M
for a_cnt in range(N + 1):
    if AA[a_cnt] > K:
        continue
    while AA[a_cnt] + BB[b_cnt] > K:
        b_cnt -= 1

    ans = max(ans, a_cnt + b_cnt)

print(ans)
Buggy python submission (verdict: Runtime Error):
#%%
N = int(input())
L = [int(i) for i in input().split()]
Q = int(input())
order = [[] for _ in range(Q)]
for i in range(Q):
    order[i] = [int(i) for i in input().split()]
#%%
cnt = {}
for i in L:
    if i in cnt:
        cnt[i] += 1
        
    else:
        cnt[i] = 1

ans = [sum(L)]
for i in order:
    temp = cnt[i[0]] * (i[1] - i[0])
    ans.append(temp + ans[-1])
    print(ans[-1])
    
    if i[1] in cnt:
        cnt[i[1]] += cnt[i[0]]
    else:
        cnt[i[1]] = cnt[i[0]]

    del cnt[i[0]]        
        





Fixed submission:
#%%
N = int(input())
L = [int(i) for i in input().split()]
Q = int(input())
order = [[] for _ in range(Q)]

for i in range(Q):
    order[i] = [int(i) for i in input().split()]
#%%
cnt = {}
for i in L:
    if i in cnt:
        cnt[i] += 1
        
    else:
        cnt[i] = 1

ans = [sum(L)]
for i in order:
    if i[0] not in cnt:
        print(ans[-1])
        continue
    temp = cnt[i[0]] * (i[1] - i[0])
    ans.append(temp + ans[-1])
    print(ans[-1])
    
    if i[1] in cnt:
        cnt[i[1]] += cnt[i[0]]
    else:
        cnt[i[1]] = cnt[i[0]]

    del cnt[i[0]]
Buggy python submission (verdict: Runtime Error):
import numpy as np

#%%
N, M, X = [int(i) for i in input().split()]
CA = [[] for i in range(N)]
for i in range(N):
    k = list(map(int, input().split()))
    CA[i] = k[:]
CA = np.array(CA)
#%%
cnt = (10 ** 5) * N + 1

for i in range(2 ** N):
    score = np.zeros(N + 1)
    for j in range(N):
        if (i >> j) & 1:
            score += CA[j]
    for k in range(1, N + 1):
        if score[k] < X:
            break
    else:
        if score[0] < cnt:
            cnt = score[0]
            
if cnt != (10 ** 5) * N + 1:
    print(int(cnt))
else:
    print(-1)


Fixed submission:
import numpy as np

#%%
N, M, X = [int(i) for i in input().split()]
CA = [[] for i in range(N)]
for i in range(N):
    k = list(map(int, input().split()))
    CA[i] = k[:]
CA = np.array(CA)
#%%
cnt = (10 ** 5) * N + 1

for i in range(2 ** N):
    score = np.zeros(M + 1)
    for j in range(N):
        if (i >> j) & 1:
            score += CA[j]
    for k in range(1, M + 1):
        if score[k] < X:
            break
    else:
        if score[0] < cnt:
            cnt = score[0]
            
if cnt != (10 ** 5) * N + 1:
    print(int(cnt))
else:
    print(-1)

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

#%%
N, M, X = [int(i) for i in input().split()]
CA = [[] for i in range(N)]
for i in range(M):
    k = list(map(int, input().split()))
    CA[i] = k[:]
CA = np.array(CA)
#%%
cnt = (10 ** 5) * N + 1

for i in range(2 ** N):
    score = np.zeros(N + 1)
    for j in range(N):
        if (i >> j) & 1:
            score += CA[j]
    for k in range(1, N + 1):
        if score[k] < X:
            break
    else:
        if score[0] < cnt:
            cnt = score[0]
            
if cnt != (10 ** 5) * N + 1:
    print(int(cnt))
else:
    print(-1)


Fixed submission:
import numpy as np

#%%
N, M, X = [int(i) for i in input().split()]
CA = [[] for i in range(N)]
for i in range(N):
    k = list(map(int, input().split()))
    CA[i] = k[:]
CA = np.array(CA)
#%%
cnt = (10 ** 5) * N + 1

for i in range(2 ** N):
    score = np.zeros(M + 1)
    for j in range(N):
        if (i >> j) & 1:
            score += CA[j]
    for k in range(1, M + 1):
        if score[k] < X:
            break
    else:
        if score[0] < cnt:
            cnt = score[0]
            
if cnt != (10 ** 5) * N + 1:
    print(int(cnt))
else:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
import  math
K = int(input())

ans = 0
for i in range(1, K + 1):
    for j in range(1, K + 1):
        for l in range(1, K + 1):
            ans  += math.gcd(i, math.gcd(j, l))
            
            
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):
        for m in range(1,k+1):
            ans += gcd(i, gcd(j,m))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import  math
K = int(input())

ans = 0
for i in range(1, K + 1):
    for j in range(1, K + 1):
        for l in range(1, K + 1):
            ans  += math.gcd(l, math.gcd(i, j))
            
            
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):
        for m in range(1,k+1):
            ans += gcd(i, gcd(j,m))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import  math
K = int(input())

ans = 0
for i in range(1, K + 1):
    for j in range(1, K + 1):
        for l in range(1, K + 1):
            temp = math.gcd(i, j)
            temp2 = math.gcd(l, temp)
            ans += temp2
            
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):
        for m in range(1,k+1):
            ans += gcd(i, gcd(j,m))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):

K = int(input())

def func_gcd(a, b):
    if b > a:
        a, b = b, a
    
    while b > 0:
        r = a % b
        a = b
        b = r

    return a

ans = 0
for i in range(1, K + 1):
    for j in range(1, K + 1):
        for l in range(1, K + 1):
            temp = func_gcd(i, j)
            temp2= func_gcd(temp, l)
            ans += temp2

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):
        for m in range(1,k+1):
            ans += gcd(i, gcd(j,m))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#%%
K = int(input())

def func_gcd(a, b):
    if b > a:
        a, b = b, a
    
    while b > 0:
        r = a % b
        a = b
        b = r

    return a

ans = 0
for i in range(1, K + 1):
    for j in range(1, K + 1):
        temp = func_gcd(i, j)
        for l in range(1, K + 1):
            temp2= func_gcd(temp, l)
            ans += temp2

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):
        for m in range(1,k+1):
            ans += gcd(i, gcd(j,m))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]

C = {}
for i in A:
    if i in C:
        C[i] += 1
    else:
        C[i] = 1

ans = 0    
for i in C.keys():
    ans += (C[i] * (C[i]-1)) // 2
    
for i in A:
    dec = 0
    D = C.copy()
    D[i] += -1
    dec = (C[i] * (C[i]-1) // 2) - (D[i] * (D[i]-1) // 2)
    print(ans-dec)


Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]

#%%
C = {}
for i in A:
    if i in C:
        C[i] += 1
    else:
        C[i] = 1

ans = 0    
for i in C.keys():
    ans += C[i] * (C[i]-1) // 2
    
for i in A:
    dec =  C[i] * (C[i]-1) // 2 - (C[i]-1) * (C[i]-2) //2
    print(ans - dec)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]

#%%
C = {}
for i in A:
    if i in C.keys():
        C[i] += 1
    else:
        C[i] = 1

for i in A:
    ans = 0
    D = C.copy()
    D[i] += -1
    for j in D:
        ans += (D[j] * (D[j]-1)) // 2
    print(ans)

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]

#%%
C = {}
for i in A:
    if i in C:
        C[i] += 1
    else:
        C[i] = 1

ans = 0    
for i in C.keys():
    ans += C[i] * (C[i]-1) // 2
    
for i in A:
    dec =  C[i] * (C[i]-1) // 2 - (C[i]-1) * (C[i]-2) //2
    print(ans - dec)
Buggy python submission (verdict: Runtime Error):
N, A, B = [int(i) for i in input().split()]

ans = []
for _ in range(N//(A+B)+1):
    ans.append("b"*A)
    ans.append("r"*B)
        
ans = "".join(ans)
print(ans[:N].count("b"))

Fixed submission:
N, A, B = [int(i) for i in input().split()]
ans = N // (A + B) * A
r = N % (A + B)
print(ans+min(r, A))

Buggy python submission (verdict: Runtime Error):
N, A, B = [int(i) for i in input().split()]

ans = []
for i in range(1,10**18+1):
    ans.append("b"*A)
    ans.append("r"*B)
    if (A+B) * i >= N:
        break
    
ans = "".join(ans)
print(ans[:N].count("b"))

Fixed submission:
N, A, B = [int(i) for i in input().split()]
ans = N // (A + B) * A
r = N % (A + B)
print(ans+min(r, A))

Buggy python submission (verdict: Runtime Error):
N, A, B = [int(i) for i in input().split()]

ans = []
for _ in range(10**18):
    ans.append("b"*A)
    ans.append("r"*B)
    
    if len("".join(ans)) >= N:
        break

ans = "".join(ans)
print(ans[:N].count("b"))

Fixed submission:
N, A, B = [int(i) for i in input().split()]
ans = N // (A + B) * A
r = N % (A + B)
print(ans+min(r, A))
Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
X = np.array([int(i) for i in input().split()])

ans = []
for i in range(1, max(X)):
    ans.append(sum((X - i)**2))
    
print(min(ans))

Fixed submission:
import numpy as np
N = int(input())
X = np.array([int(i) for i in input().split()])

ans = []
for i in range(0, max(X)+1):
    ans.append(sum((X - i)**2))
    
print(min(ans))
Buggy python submission (verdict: Time Limit Exceeded):
n, a, b = [int(i) for i in input().split()]

p = 10 ** 9 + 7
N = 10 ** 9
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]

for i in range(2, N+1):
    fact.append((fact[-1]*i)%p)
    inv.append((-inv[p%i] * (p//i)) % p) 
    factinv.append(factinv[-1] * inv[-1] % p)
    
def comb(n, r, p):
    if r < 0 or n < r:
        return 0
    
    r = min(r, n-r)
    return fact[n] * factinv[r] * factinv[n-r] % p
  
print(pow(2, n, p) -1 -comb(n, a, p) - comb(n, b, p))

Fixed submission:
n, a, b = [int(i) for i in input().split()]
mod = 10**9+7

def func_156d(n, r):
    r =min(r, n-r)
    numerator = 1
    denominator = 1
    
    for i in range(n-r+1, n+1):
        numerator = numerator * i % mod
        
    for i in range(1, r+1):
        denominator = denominator * i % mod
        
    return numerator * pow(denominator, mod-2, mod) %mod

print((pow(2, n, mod) -1 - func_156d(n,a) - func_156d(n,b) + 2*mod) %mod )

Buggy python submission (verdict: Time Limit Exceeded):
from math import factorial
n, a, b = [int(i) for i in input().split()]
mod = 10**9 + 7
ans = 2**n - (factorial(n)//factorial(a)//factorial(n-a)) - (factorial(n)//factorial(b)//factorial(n-b)) -1
print(ans%mod)

Fixed submission:
n, a, b = [int(i) for i in input().split()]
mod = 10**9+7

def func_156d(n, r):
    r =min(r, n-r)
    numerator = 1
    denominator = 1
    
    for i in range(n-r+1, n+1):
        numerator = numerator * i % mod
        
    for i in range(1, r+1):
        denominator = denominator * i % mod
        
    return numerator * pow(denominator, mod-2, mod) %mod

print((pow(2, n, mod) -1 - func_156d(n,a) - func_156d(n,b) + 2*mod) %mod )
Buggy python submission (verdict: Runtime Error):
ans = {}
for i in S:
    if i in ans:
        ans[i] += 1
    else:
        ans[i] = 1

max_v = max(ans.values())        
ANS = []
for key, value in ans.items():
    if ans[key] == max_v:
        ANS.append(key)

for i in sorted(ANS):
    print(i)

Fixed submission:
N = int(input())
S = [input() for i in range(N)]

ans = {}
for i in S:
    if i in ans:
        ans[i] += 1
    else:
        ans[i] = 1

max_v = max(ans.values())        
ANS = []
for key, value in ans.items():
    if ans[key] == max_v:
        ANS.append(key)

for i in sorted(ANS):
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = [input() for i in range(N)]

ans = {}
for i in S:
    if i in ans:
        ans[i] += 1
    else:
        ans[i] = 1

ANS = []
for key, value in sorted(ans.items(), key=lambda x: -x[1]):
    if ans[key] == max(ans.values()):
        ANS.append(key)

for i in sorted(ANS):
    print(i)

Fixed submission:
N = int(input())
S = [input() for i in range(N)]

ans = {}
for i in S:
    if i in ans:
        ans[i] += 1
    else:
        ans[i] = 1

max_v = max(ans.values())        
ANS = []
for key, value in ans.items():
    if ans[key] == max_v:
        ANS.append(key)

for i in sorted(ANS):
    print(i)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
if S[0:N//2] == S[N//2:N]:
    print("yes")
    
elif S[0:N//2] != S[N//2:N]
    print("No")

else:
    print("No")

Fixed submission:
N = int(input())
S = input()
if N % 2 != 0:
    print("No")
elif S[:N//2] == S[N//2:]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
N=int(input())
X=[]
for _ in range(n):
	x,y=map(int,input().split())
	X.append([x,y])
    
ans = []
for i in range(N):
    for j in range(N):
        ans.append(np.sqrt((X[i][0]-X[j][0])**2 + (X[i][1]-X[j][1])**2))

print(sum(ans) / N)

Fixed submission:
import numpy as np
N = int(input())
X = [list(map(int, input().split())) for i in range(N)]

ans = []
for i in range(N):
    for j in range(N):
        ans.append(np.sqrt((X[i][0]-X[j][0])**2 + (X[i][1]-X[j][1])**2))

print(sum(ans) / N)

Buggy python submission (verdict: Runtime Error):
N = int(input())
X = [list(map(int, input().split())) for i in range(N)]

ans = []
for i in range(N):
    for j in range(N):
        ans.append(np.sqrt((X[i][0]-X[j][0])**2 + (X[i][1]-X[j][1])**2))

print(sum(ans) / N)

Fixed submission:
import numpy as np
N = int(input())
X = [list(map(int, input().split())) for i in range(N)]

ans = []
for i in range(N):
    for j in range(N):
        ans.append(np.sqrt((X[i][0]-X[j][0])**2 + (X[i][1]-X[j][1])**2))

print(sum(ans) / N)

Buggy python submission (verdict: Runtime Error):
N = int(input())
X = [list(map(int, input().split())) for i in range(N)]

ans = []
for i in range(N):
    for j in range(N):
        ans.append(np.sqrt((X[i][0]-X[j][0])**2 + (X[i][1]-X[j][1])**2))

print(sum(ans) / N)

Fixed submission:
import numpy as np
N = int(input())
X = [list(map(int, input().split())) for i in range(N)]

ans = []
for i in range(N):
    for j in range(N):
        ans.append(np.sqrt((X[i][0]-X[j][0])**2 + (X[i][1]-X[j][1])**2))

print(sum(ans) / N)
Buggy python submission (verdict: Runtime Error):
A, B = [int(i) for i in input().split()]
List_9 = []
for i in range(1, 10):
    for j in range(1, 10):
        List_9.append(i * j)
        
if A * B in List_9:
    print(A * b)
else:
    print(-1)

Fixed submission:
A, B = [int(i) for i in input().split()]

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

Buggy python submission (verdict: Runtime Error):
A, B = [int(i) for i in input().split()]
List_9 = []
for i in range(1, 10):
    for j in range(1, 10):
        List_9.append(i * j)
        
if A * B in List_9:
    print(A * b)
else:
    print(-1)

Fixed submission:
A, B = [int(i) for i in input().split()]

if A < 10 and B < 10:
  print(A * B)
else:
  print(-1)
Buggy python submission (verdict: Runtime Error):
N = int(input())
List_9 = []
for i in range(1, 10):
    for j in range(1, 10):
        List_9.append(i * j)
        
if A * B in List_9:
    print("Yes")
else:
    print("No")

Fixed submission:
N = int(input())
List_9 = []
for i in range(1, 10):
    for j in range(1, 10):
        List_9.append(i * j)
        
if N in List_9:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A, B, C = [0]*N, [0]*N, [0]*N 
for i in range(N):
    A[i], B[i], C[i] = [int(j) for j in input().split()]

ABC = [A, B, C]
dp = [[0]*3 for _ in range(N+1)]

for i in range(N):
    for j in range(3):
        dp[i+1][j] = max(dp[i][j-1] + ABC[i][j], dp[i][j-2] + ABC[i][j])

print(max(dp[-1]))

Fixed submission:
N = int(input())
A, B, C = [0]*N, [0]*N, [0]*N 
for i in range(N):
    A[i], B[i], C[i] = [int(j) for j in input().split()]
    
dp = [[0]*3 for _ in range(N+1)]

for i in range(N):
    dp[i+1][0] = max(dp[i][1], dp[i][2]) + A[i]
    dp[i+1][1] = max(dp[i][0], dp[i][2]) + B[i]
    dp[i+1][2] = max(dp[i][0], dp[i][1]) + C[i]
    
print(max(dp[-1]))

Buggy python submission (verdict: Runtime Error):
N = int(input())
A, B, C = [0]*N, [0]*N, [0]*N 
for i in range(N):
    A[i], B[i], C[i] = [int(j) for j in input().split()]

dp = [[0]*3 for _ in range(N+1)]
for i in range(N):
    for j in range(3):
        dp[i+1][j] = max(dp[i][j-1], dp[i][j-2]) + ABC[i][j]

print(max(dp[-1]))

Fixed submission:
N = int(input())
A, B, C = [0]*N, [0]*N, [0]*N 
for i in range(N):
    A[i], B[i], C[i] = [int(j) for j in input().split()]
    
dp = [[0]*3 for _ in range(N+1)]

for i in range(N):
    dp[i+1][0] = max(dp[i][1], dp[i][2]) + A[i]
    dp[i+1][1] = max(dp[i][0], dp[i][2]) + B[i]
    dp[i+1][2] = max(dp[i][0], dp[i][1]) + C[i]
    
print(max(dp[-1]))