whats the problem now it still gives tle
emphasized text
#include<bits/stdc++.h>
using namespace std;
typedef long long unsigned int llui;
#define ll long long
#define abs(x,y) x>y?x-y:y-x
#define float64 long double
llui mul_mod(llui a, llui b, llui m){
llui y = (llui)((float64)a*(float64)b/m+(float64)1/2);
y = y * m;
llui x = a * b;
llui r = x - y;
if ( (ll)r < 0 ){
r = r + m; y = y - 1; }
return r;
}
ll pow1(ll x,ll y, ll p)
{
ll res = 1;
x = x % p;
while (y > 0)
{
if (y & 1)
res =mul_mod(res,x,p);
y = y>>1;
x = mul_mod(x,x,p);
}
return res;}
ll pro(ll n)
{
srand (time(NULL));
if (n==1) return n;
if (n % 2 == 0) return 2;
long long int x = (rand()%(n-2))+2;
long long int y = x;
long long int c = (rand()%(n-1))+1;
long long int d = 1;
while (d==1)
{
x = (mul_mod(x,x,n) + c + n)%n;
y = (mul_mod(x,x,n) + c + n)%n;
y = (mul_mod(x,x,2) + c + n)%n;
d = __gcd(abs(x,y), n);
if (d==n) return pro(n);
}
return d;}
bool miillerTest(ll d,ll n)
{
ll a = 2 + rand() % (n - 4);
ll x = pow1(a, d, n);
if (x == 1 || x == n-1)
return true;
while (d != n-1)
{
x =mul_mod(x,x,n);
d *= 2;
if (x == 1) return false;
if (x == n-1) return true;
}
return false;
}
bool isprime(ll n)
{int k=10;
if (n <= 1 || n == 4) return false;
if (n <= 3) return true;
ll d = n - 1;
while (d % 2 == 0)
d /= 2;
for (int i = 0; i < k; i++)
if (miillerTest(d, n) == false)
return false;
return true;}
bool f(ll a){
if(isprime(a)||a==1) return true;
ll d=pro(a);
if(__gcd(d,a/d)>1) return false;
return f(d)&&f(a/d);
}
void fio(ll &number)
{
bool negative = false;
register ll c;
number = 0;
c = getchar();
if (c=='-')
{
negative = true;
c = getchar();
}
for (; (c>47 && c<58); c=getchar())
number = number *10 + c - 48;
if (negative)
number *= -1;
}
int main() {
ll t;fio(t);
while(t–){
ll a, b;fio(a);fio(b);
if(f(a)&&f(b)&&__gcd(a,b)==1) printf(“YES\n”);
else printf(“NO\n”);cout
}
}[quote=“excel_blaze, post:1, topic:28458, full:true”]
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll pow1(ll x,ll y, ll p)
{
ll res = 1;
x = x % p;
while (y > 0)
{
if (y & 1)
res = (resx) % p;
y = y>>1;
x = (xx) % p;
}
return res;}
bool miillerTest(ll d,ll n)
{
ll a = 2 + rand() % (n - 4);
ll x = pow1(a, d, n);
if (x == 1 || x == n-1)
return true;
while (d != n-1)
{
x = (x * x) % n;
d *= 2;
if (x == 1) return false;
if (x == n-1) return true;
}
return false;
}
bool isprime(ll n)
{int k=72;
if (n <= 1 || n == 4) return false;
if (n <= 3) return true;
ll d = n - 1;
while (d % 2 == 0)
d /= 2;
for (int i = 0; i < k; i++)
if (miillerTest(d, n) == false)
return false;
return true;}
ll pro(ll n)
{
srand (time(NULL));
if (n==1) return n;
if (n % 2 == 0) return 2;
long long int x = (rand()%(n-2))+2;
long long int y = x;
long long int c = (rand()%(n-1))+1;
long long int d = 1;
while (d==1)
{
x = (pow1(x, 2, n) + c + n)%n;
y = (pow1(y, 2, n) + c + n)%n;
y = (pow1(y, 2, n) + c + n)%n;
d = __gcd(abs(x-y), n);
if (d==n) return pro(n);
}
return d;}
bool f(ll a){
if(isprime(a)||a==1) return true;
ll d=pro(a);
if(__gcd(d,a/d)>1) return false;
return f(d)&&f(a/d);
}
void fio(ll &number)
{
//variable to indicate sign of input number
bool negative = false;
register ll c;
number = 0;
// extract current character from buffer
c = getchar();
if (c=='-')
{
// number is negative
negative = true;
// extract the next character from the buffer
c = getchar();
}
// Keep on extracting characters if they are integers
// i.e ASCII Value lies from '0'(48) to '9' (57)
for (; (c>47 && c<58); c=getchar())
number = number *10 + c - 48;
// if scanned input has a negative sign, negate the
// value of the input number
if (negative)
number *= -1;
}
int main() {
ll t;fio(t);
while(t–){
ll a, b;fio(a);fio(b);
if(f(a)&&f(b)&&__gcd(a,b)==1) cout<<“YES”<<endl;
else cout<<“NO”<<endl;
}
}
[/quote]