Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions a^b/mod_poer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

// BY hg398

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define boost ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define mo 1000000007

ll mod_poer(ll a,ll b)
{
ll res=1;
while(b>0)
{
if(b&1)
res=(res*a)%mo;
a=(a*a)%mo;
b/=2;
}
return res%mo;
}

int main() {
boost;
int t;
cin>>t;
while(t--)
{
ll a,b;
cin>>a>>b;
cout<<mod_poer(a,b);
}
return 0;
}