Fast power passing two test cases what are the remaining two test cases

#include
using namespace std;

int main() {
int x,y,l;
int n;
cin>>x>>n;
y = x;
if(x==1){
cout<<“1”;
}
if(n%2==0){

while(n){
  x = x*x;
  n = n/2;
  
  
}
cout<<x;

}
if(n%2==1){
while(n){
x = xx;
n = n/2;
if(n==1){
l = y
x;
cout<< l;
break;
}
}

}

}
THATS THE CODE

ll fast_exp(int base, int exp) {
    ll res=1;
    while(exp>0) {
       if(exp%2==1) res=(res*base)%MOD;
       base=(base*base)%MOD;
       exp/=2;
    }
    return res%MOD;
}

Use this for fast modular exponentiation, remove the MOD if not required.