#include <bits/stdc++.h>
using namespace std;
using ll=long long;
//f(1)=a,,f(k)=x -> f(k**2)=x*x,,f(k**2+1)=x*x*a;
ll func1(ll a,ll b, ll c){
if(b==1) return a%c;
ll res=func1(a,b/2,c);
res=res*res%c;
if(b%2==0) return res;
return res*a%c;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
ll a,b,c,res;
cin >> a >> b >> c;
cout << func1(a,b,c);
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: