Two Numbers - Runtime error

so I’ve been dealing with this “Two Number” problem and when I run this code on my IDLE it gives back the correct output, but when I try sumbit my code, CodeChef return Runtime error. Can you help me out and say why is that the case?
Thank you very much!
Here below is my code:

lista = []
t = int(input())
for i in range(1, t+1):
A = int(input())
B = int(input())
N = int(input())
for i in range(1,N+1):
if i % 2 == 1:
A = A2
if i % 2 == 0:
B = B
for x in lista: