How to reduce time coplexity

hi @akki56756_bab14f919dbad123, make sieve once for all test case before while loop

    int t;
	cin >> t;
	vector<int>primes; // here
	prime_sieve(primes);