my code is this :
import math
t = int(input())
for _ in range(t):
n = int(input())
init = list(map(int, input().split()))
disc = list(map(int, input().split()))
checklist = init.copy()
x = math.gcd(*init)
for i in range(len(init)):
checklist[i] = disc[i]
if x<=math.gcd(*checklist):
x = math.gcd(*checklist)
checklist[i] = init[i]
print(x)
but I get runtime error how can i optimize it?
Problem link: GCD Discount