As to how to solve it: you’re going to have to use a datatype that can hold numbers up to 2^{128}, I guess, or somesuch solution. I don’t know what facilities are available on e-olymp.com, though.

so how can i solve for noww ?
and also the no. of test cases i don’t know then how can i covert code to python(as python has issue of overflow)
how can i write this in python

#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int unsigned long long
int mult(int a,int b,int mod)
{
int res = 0;
while(b>0)
{
if(b&1) res=(res + a)%mod;
a=(a+a)%mod;
b>>=1;
}
return res;
}
int power(int a,int b,int mod)
{
int res = 1;
while(b>0)
{
if(b&1) res=mult(res,a,mod);
a=mult(a,a,mod);
b>>=1;
}
return res;
}
signed main()
{
int a,b,c;
while(cin >> a >> b >> c) cout << power(a,b,c) << '\n';
}