Submission
Status:
[PPPPPPPPPPPPPPPPPPPP]
Subtask/Task Score:
{100/100}
Score: 100
User: tull
Problemset: ยกกำลัง
Language: cpp
Time: 0.006 second
Submitted On: 2026-04-26 00:26:20
#pragma GCC optimize("O3,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(A) A.begin(),A.end()
const int N=1e3+10;
const int MOD=1e9+7;
int fm(int a,int b){
int res=1;
while(b){
if(b&1){
res=(res*a)%MOD;
}
b>>=1;
a=(a*a)%MOD;
}
return res;
}
signed main(){
cin.tie(nullptr)->sync_with_stdio(false);
int q,l,r;
cin>>q;
while(q--){
cin>>l>>r;
cout<<fm(l,r)<<'\n';
}
}