My issue
I don’t know how my submissions is exceeding the time limit?
My code
#basically asking greatest common factor between apples and oranges
t = int(input())
for _ in range(t):
apples_and_oranges = input()
a_then_o_list = list(map(int, apples_and_oranges.split()))
#[apples, oranges]
apples = a_then_o_list[0]
oranges = a_then_o_list[1]
apple_factors = []
orange_factors = []
#find factors of apples and oranges
for x in range(1,apples+1):
if apples%x == 0:
apple_factors.append(x)
for y in range(1,oranges+1):
if oranges%y == 0:
orange_factors.append(y)
#find greatest common factor
for x in apple_factors:
for y in orange_factors:
if x == y:
answer = x
#print greatest common factor
print(answer)
Problem Link: APPLEORANGE Problem - CodeChef