Problem:


Power

For given integers m and n, compute mn (mod 1,000,000,007). Here, A (mod M) is the remainder when A is divided by M.

Input

m n

Two integers m and n are given in a line.

Output

Print mn (mod 1,000,000,007) in a line.

Constraints

1 ≤ m ≤ 100

1 ≤ n ≤ 109

Sample Input 1

2 3

Sample Output 1

8

Sample Input 2

5 8

Sample Output 2

390625



Sample input:
2 3


Sample output:
8

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
print(pow(n,m,1000000007)%1000000007)

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    m,n = LI()
    print(pow(m,n,mod))
    return

#Solve
if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
m = pow(10,9)+7
print(pow(a,b,m))

Submission status: Accepted

Solution code:
def pow(m, n, mod):
    if n == 0:
        return 1
    elif n == 1:
        return m
    if n % 2 == 0:
        return pow(m, n // 2, mod) ** 2 % mod
    else:
        return pow(m, n // 2 + 1, mod) * pow(m, n // 2, mod) % mod




m, n = map(int, input().split())
mod = 10 ** 9 + 7

print(pow(m, n, mod))

Submission status: Accepted

Solution code:
MOD = 10**9 + 7
m ,n = map(int,input().split())
print (pow(m,n,MOD))

Submission status: Accepted

Solution code:
MOD = 10 ** 9 + 7
m, n = map(int, input().split())
print(pow(m, n, MOD))

Submission status: Accepted

Solution code:
m,n = map(int, input().split())
mod = 10**9+7
print(pow(m,n,mod))

Submission status: Accepted

Solution code:
mod = 1000000007
l = input().split()
m = int(l[0])
n = int(l[1])


def power(x, y):
    if y == 0:
        return 1
    elif y == 1:
        return x % mod
    elif y % 2 == 0:
        return power(x, y/2)**2 % mod
    else:
        return power(x, int(y/2))**2 * x % mod


ans = power(m, n)
print(ans)

Submission status: Accepted

Solution code:
m,n = map(int,input().split())
BIGNUM = 10**9+7

def power(m,n):
    if n == 0:
        return 1
    elif n % 2 == 1:
        return (m * power(m**2 % BIGNUM,n//2)) % BIGNUM
    else:
        return power(m**2 % BIGNUM,n//2) % BIGNUM

print(power(m,n))

Submission status: Accepted

Solution code:
import sys
import math
import fractions
import itertools
from collections import deque
import copy
import bisect

MOD = 10 ** 9 + 7
INF = 10 ** 18 + 7
input = lambda: sys.stdin.readline().strip()

m, n = map(int, input().split())


def bpm(x, y, N):
    """
     Bisection power method : 二分累乗法
     O(log y)でx^(y) mod N を求める。
    """
    ans = 1
    x %= MOD
    digit = int((math.log(y, 2) // 1 + 1))  # yの２進数表示の桁数
    for i in range(digit):
        if (y >> i) & 1 == 1:
            ans *= x
            ans %= MOD
        x **= 2
        x %= MOD
    return ans


print(bpm(m, n, MOD))

Submission status: Accepted

Solution code:
# coding: utf-8
m,n = map(int,input().split())
mod = 10 ** 9 + 7

ans = pow(m, n, mod)

print(ans)

Submission status: Accepted

Solution code:
MOD = 10**9 + 7

m, n = map(int, input().split())
print(pow(m, n, MOD))

Submission status: Accepted

Solution code:
MOD = 1000000007
class ModInt:
    def __init__(self, x):
        self.x = x % MOD

    def __str__(self):
        return str(self.x)

    __repr__ = __str__

    def __add__(self, other):
        return (
            ModInt(self.x + other.x) if isinstance(other, ModInt) else
            ModInt(self.x + other)
        )

    def __sub__(self, other):
        return (
            ModInt(self.x - other.x) if isinstance(other, ModInt) else
            ModInt(self.x - other)
        )

    def __mul__(self, other):
        return (
            ModInt(self.x * other.x) if isinstance(other, ModInt) else
            ModInt(self.x * other)
        )

    def __truediv__(self, other):
        return (
            ModInt(
                self.x * pow(other.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(self.x * pow(other, MOD - 2, MOD))
        )

    def __pow__(self, other):
        return (
            ModInt(pow(self.x, other.x, MOD)) if isinstance(other, ModInt) else
            ModInt(pow(self.x, other, MOD))
        )

    __radd__ = __add__

    def __rsub__(self, other):
        return (
            ModInt(other.x - self.x) if isinstance(other, ModInt) else
            ModInt(other - self.x)
        )

    __rmul__ = __mul__

    def __rtruediv__(self, other):
        return (
            ModInt(
                other.x * pow(self.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(other * pow(self.x, MOD - 2, MOD))
        )

    def __rpow__(self, other):
        return (
            ModInt(pow(other.x, self.x, MOD)) if isinstance(other, ModInt) else
            ModInt(pow(other, self.x, MOD))
        )
    
    def __iadd__(self,other):
        self.x += other.x if isinstance(other, ModInt) else other
        self.x %= MOD
        return self

    def __isub__(self,other):
        self.x += ModInt(MOD - other.x) if isinstance(other, ModInt) else ModInt(MOD - other)
        return self

    def __imul__(self, other):
        self.x *= other.x if isinstance(other, ModInt) else other
        self.x %= MOD
        return self
    
    def factorical(self,n):
        tmp = ModInt(1)
        for i in range(n):
            tmp *= (i+1)
        return tmp
    
    #m:int MOD
    def modinv(self,a,m=MOD):
        b = m
        u = 1
        v = 0
        while(b):
            t = a//b
            a -= t * b
            a,b = b,a
            u -= t * v
            u,v = v,u
        return ModInt(u)

    def comb(self,n,r):
        n = int(n)
        r = int(r)
        if r > n or n < 0 or r < 0:
            return 0
        m = n+1
        nterms = min(r, n-r)
        numerator = ModInt(1)
        denominator = ModInt(1)
        for j in range(1, nterms + 1):
            numerator *= m - j
            denominator *= j
        return numerator * self.modinv(denominator.x)
        
if __name__ == "__main__":
    x,y=map(int,input().split())
    a = ModInt(x)
    b = ModInt(y)
    print(pow(a,b))

Submission status: Accepted

Solution code:


mod=1e9+7
mod=int(mod)
def pow(a,b):
    # if a>b:
    #     a,b=b,a
    if(b==0):
        return 1
    temp=pow(a,b//2)%mod
    temp=(temp**2)%mod
    if b%2==0:
        return temp%mod
    else:
        return (temp*a)%mod

a,b=map(int,input().split())
print(pow(a,b)%mod)

Submission status: Accepted

Solution code:
MOD = 1000000007
m,n = map(int,input().split())
print(pow(m,n,MOD))

Submission status: Accepted

Solution code:
m,n = map(int, input().split())
print(pow(m,n, 1000000007))

Submission status: Accepted

Solution code:
from functools import lru_cache
mod=1000000007

m,n=[int(i) for i in input().split(" ")]

@lru_cache()
def power(m,n,mod):
    if n==0:
        return 1
    elif n==1:
        return m
    elif n%2==0:
        return ((power(m,n//2,mod)%mod) * (power(m,n//2,mod)%mod))%mod
    else:
        return (power(m,n-1,mod)*m)%mod

print(power(m,n,mod))

Submission status: Accepted

Solution code:
n,m=map(int,input().split())

print(pow(n,m,10**9+7))

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
def pow_k(x, n):
    """
    O(log n)
    """
    if n == 0:
        return 1

    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
        x *= x
        n //= 2

    return K * x
print(pow(a,b,1000000007))

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

def pow(x, n):
    if n == 0:
        return 1
    res = pow(x * x % A, n // 2)
    if n % 2 == 1:
        res = res * x % A
    return res

nums=list(map(int,input().split()))
M  = nums[0]
N = nums[1]
A = 1000000007
print(pow(M, N))

Submission status: Accepted

Solution code:
mod=10**9+7
n,m=map(int,input().split())
def mypow(a,b):
	#a**b
	if b==0:
		return 1
	res=mypow(a**2%mod,b//2)
	if b%2==0:
		return res
	else:
		return res*a%mod
print(mypow(n,m))

Submission status: Accepted

Solution code:
# https://onlinejudge.u-aizu.ac.jp/courses/library/6/NTL/1/NTL_1_B
# pythonのpowが優秀でMODまで取ることができる

MOD = 10**9 + 7
a, b = list(map(int, input().split()))
print(pow(a, b, MOD))

Submission status: Accepted

Solution code:
mod=10**9+7

m,n=map(int,input().split())
# def pow(m,n):
#     # mのn乗をmodを方にしてO(logn)で計算
#     if n==0:return 1
#     elif n%2==0:
#         return pow(m**2%mod,n//2)%mod
#     else:
#         return (pow(m**2%mod,n//2)*m)%mod

def pow(m,n,mod):
    rem=1
    while n>0:
        if n%2==1:
            rem=rem*m%mod
        m=m**2%mod
        n//=2
    return rem%mod

print(pow(m,n,mod))

Submission status: Accepted

Solution code:
# n^p mod m
def npmodm(n,p,m):
    if p == 0:
        return 1
    elif p % 2 == 0:
        a = npmodm(n,p//2,m) % m
        return (a*a) % m
    else:
        a = npmodm(n,p-1,m) % m
        return (a*n) % m

m = 10**9+7
n,p = map(int,input().split())
print(npmodm(n,p,m))

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    m,n = list(map(int, input().split()))
    md=10**9+7
    print(pow(m,n,md))
main()

Submission status: Accepted

Solution code:
m, n = map(int, input().split())
ans = pow(m, n, 1000000007)
print(ans)

Submission status: Accepted

Solution code:
#B
import math
mod = 10**9+7
m,n = map(int,input().split()) #m^n % mod
n2 = math.ceil(math.sqrt(n))

b = bin(n)
b = b.lstrip("0b")
blist = list(b)
blist = blist[::-1]
ans = 1
beki = [m]
for i in range(n2):
    m = (m**2)%mod
    beki.append(m)

blen = len(blist)
ans = 1
for i in range(blen):
    if blist[i] == "1":
        ans*=beki[i]
        ans%=mod
        
print(ans)

Submission status: Accepted

Solution code:
m, n = map(int, input().split())
LN = 1000000007

def pwr(p, q):
    if q == 1:
        return p%LN
    elif q % 2 == 0:
        return (pwr(p, q//2)%LN)**2%LN
    else:
        return (pwr(p, q//2)%LN)**2*p%LN

print(pwr(m, n))

Submission status: Accepted

Solution code:
m, n = map(int, input().split())

print(pow(m,n, 1000000007))

Submission status: Accepted

Solution code:
a,b=map(int,input().split());print(pow(a,b,10**9+7))

Submission status: Accepted

Solution code:
m, n = map(int, input().split())
MOD = 10**9 + 7
print(pow(m, n, MOD))

Submission status: Accepted

Solution code:
def power(m, n):
    if n == 0:
        return 1
    elif n % 2 == 0:
        k = power(m, n // 2)
        return k * k % 1000000007
    else:
        k = power(m, (n - 1) // 2)
        return k * k * m % 1000000007


m, n = [int(x) for x in input().split()]
print(power(m, n))

Submission status: Accepted

Solution code:
import sys
import math
i=list(map(int,input().split()))
m=i[0]
n=i[1]
k=1000000007
def pw(m,n):
  if n==0:
    return 1
  elif n==1:
    return m%k
  else:
    if n%2==0:
      return pw(m,n//2)**2%k
    elif n%2==1:
      return (pw(m,n//2)**2*m)%k
    
print(pw(m,n))

Submission status: Accepted

Solution code:
def power(m: int, n: int) -> int:
    modulo = 10 ** 9 + 7
    if n == 0:
        return 1
    elif n == 1:
        return m
    elif n % 2 == 0:
        return power(m, n // 2) ** 2 % modulo
    else:
        return power(m, n // 2) ** 2 * m % modulo


if __name__ == "__main__":
    m, n = map(lambda x: int(x), input().split())
    print(f"{power(m, n)}")

Submission status: Accepted

Solution code:

m, n = map(int , input().split())

res = pow(m, n, 1000000007)
print(res)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

m, n = MAP()
print(pow(m, n, MOD))

Submission status: Accepted

Solution code:
m, n = [int(x) for x in input().split()]
print(pow(m, n, 1000000007))

Submission status: Accepted

Solution code:
def solve():
    m, n = map(int, input().split())
    print(pow(m, n, 1000000007))
 
solve()

Submission status: Accepted

Solution code:
m, n = [int(x) for x in input().split()]

mod = 10**9 + 7


def func(m, n):
    if n == 1:
        return m
    if n % 2 == 0:
        return int(func(m, n//2) ** 2) % mod
    else:
        return int(m * func(m, n-1)) % mod


if __name__ == "__main__":
    print(func(m, n))

Submission status: Accepted

Solution code:
m,n=map(int,input().split())
mod=10**9+7
ans=1
while n!=0:
    if n&1:
        ans=ans*m%mod
    m=m*m%mod
    n>>=1
print(ans)

Submission status: Accepted

Solution code:
M = 10**9+7
def pow(x, n):
    if n == 0:
        return 1
    res = pow(x * x % M, n//2)
    if n % 2 == 1:
        res = res * x % M
    return res

if __name__ == "__main__":
    m, n = map(int, input().split())
    ans = pow(m, n)
    print(ans)

Submission status: Accepted

Solution code:

m1,n1=input().split( )
m,n=int(m1),int(n1)
digit=[]
c=1000000007
a=m
mod=1
while n>=1:
    if n%2==1:
        mod*=a
        mod%=c
    a**=2
    a%=c
    n//=2
print(mod)

Submission status: Accepted

Solution code:
m,n=map(int,input().split())
print(pow(m,n,10**9+7))

Submission status: Accepted

Solution code:
def pow(m, n):
	if n == 0:
		return 1
	if n % 2 == 1:
		return (m * (pow(m, n//2)**2)) % (10**9+7)
	return (pow(m, n//2)**2) % (10**9+7)

M, N = map(int, input().split())
print(pow(M, N))

Submission status: Accepted

Solution code:
m,n=map(int,input().split())
a=1000000007
print(pow(m, n, a))

Submission status: Accepted

Solution code:
MOD = 1000000007


def mod_pow(x, n):
    if n == 0:
        return 1

    res = mod_pow(x * x % MOD, n // 2)
    if n % 2:
        res = res * x % MOD

    return res


m, n = map(int, input().split())

print(mod_pow(m, n))

Submission status: Accepted

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
Max = sys.maxsize
def l(): #intのlist
	return list(map(int,input().split()))
def m(): #複数文字
	return map(int,input().split())
def onem(): #Nとかの取得
	return int(input())
def s(x): #圧縮
	a = []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa == x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): #listをスペースごとに分ける
	return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
	return max(map(max,x))

n,m = m()

print(pow(n,m,10**9+7))

Submission status: Accepted

Solution code:
m,n = map(int,input().split())
#print(m,n)

def mn (m,n):
    if n == 1:
        return m %1000000007
    elif n%2 == 1:
        return mn(m,n//2)**2 * m %1000000007
    elif n%2 == 0:
        return mn(m,n/2)**2 %1000000007

print(mn(m,n))

Submission status: Accepted

Solution code:
m,n=map(int,input().split())
sm=m
sn=n
l=[]
while sn!=0:
  l.append(sn%2)
  sn=sn//2
x=2
l1=[sm]
while x<=n:
  sm=((sm%(10**9+7))*(sm%(10**9+7)))%(10**9+7)
  l1.append(sm)
  x=2*x
for i in range(len(l)-1):
  if l[i]==1:
    sm=(sm*l1[i])%(10**9+7)
print(sm)

Submission status: Accepted

Solution code:
MOD = 1000000007

def h(m,n):
	if n == 1:
		return m % MOD
	temp = h(m, n//2)**2
	temp *= m if n%2==1 else 1
	return temp % MOD

def main():
	m,n = map(int, input().split())
	print(h(m,n))
	return

main()

Submission status: Accepted

Solution code:
import math
m, n = [int(i) for i in input().split()]
mod = 1000000007
m = m % mod
a = n
ans = 1
while a != 0:
    p = m
    b = math.log2(a)
    for bi in range(int(b)):
        p = p * p
        p = p % mod
    a = a - 2**int(b)
    ans = ans * p
    ans = ans % mod
print(ans)

Submission status: Accepted

Solution code:
MOD = 1000000007

def power(m, n):
    a = m
    ans = 1
    while n > 0:
        if n & 1:
            ans = ans * a % MOD
        n >>= 1
        a = a * a % MOD
    return ans

line = input()
m, n = list(map(int, line.split()))
print(power(m, n))

Submission status: Accepted

Solution code:
a = 1000000007

def solve(m, n):
  if n == 1:
    return m % a
  elif n % 2 == 0:
    return solve((m % a) ** 2, n//2)
  else:
    return  ((m % a) * solve((m % a) ** 2, n//2)) % a

m, n = map(int, input().split())
print(solve(m, n))

Submission status: Accepted

Solution code:
m, n = map(int, input().split())
N = 1000000007
ans = 1
while n > 0:
    if n & 1:
        ans = ans*m%N
    m = m*m%N
    n = n>>1
print(ans)

Submission status: Accepted

Solution code:
M, N = map(int, input().split())
div = 1000000007


def pos(x, n):
    if n == 0:
        return 1
    r = pos(x*x % div, n//2) % div
    if n % 2 == 1:
        r = (r*x) % div
    return r


print(pos(M, N))

Submission status: Accepted

Solution code:
MOD = 10 ** 9 + 7
m, n = map(int, raw_input().split())
ans = 1
while n > 0:
    if n % 2 : ans *= m
    n /= 2
    m = m * m % MOD
print ans % MOD

Submission status: Accepted

Solution code:
m,n=map(int,input().split())
mod=1000000007
ans=1
if m==1:
    print(1)
elif n<10000:
    for i in range(n):
        ans=ans*m%mod
    print(ans)
else:
    subm=(m**10000)%mod
    for i in range(n//10000):
        ans=ans*subm%mod
    for i in range(n%10000):
        ans=ans*m%mod
    print(ans)

Submission status: Accepted

Solution code:
MOD = 1000000007
m, n = map(int, input().split())
print(pow(m, n, MOD))

Submission status: Accepted

Solution code:
m, n = map(int, input().split())
print(pow(m, n, 10 ** 9 + 7))

Submission status: Accepted

Solution code:
m, n = map(int, input().split())

ans = pow(m, n, 1000000007)
print(ans)

Submission status: Accepted

Solution code:
import sys
mod = 1000000007
input = sys.stdin.readline
m,n=map(int,input().split())
print(pow(m,n,mod))

Submission status: Accepted

Solution code:
m, n = list(map(int, input().split()))
ans = 1
i = 1
mn = m
while i <= n:
    if n & i != 0:
        ans = ans*mn % (10**9+7)
    mn = mn*mn % (10**9+7)
    i *= 2

print(ans)

Submission status: Accepted

Solution code:
def main():
    m, n = map(int, input().split())
    print(pow(m, n, 1_000_000_007))

main()

Submission status: Accepted

Solution code:
mn=list(map(int,input().split()))
m=mn[0]
n=mn[1]
M=[]

while n>1:
    if n%2==1:
        M.append(m%1000000007)
    m=pow(m,2)%1000000007
    n=n//2
    
for i in range(len(M)):
    m=(m*M[i])%1000000007
print(m)

Submission status: Accepted

Solution code:
mod = 1000000007

def binary(n):
    if n == 0:
        return [0]
    else:
        b = []
        while n > 0:
            b = [n%2] + b
            n = n//2
        return b

def power(m,n):
    nbi = binary(n)
    l = len(nbi)
    s = 1
    for i in range(0,l):
        if nbi[l-i-1] != 0:
            p = m
            for j in range(0,i):
                p = (p*p) %mod
            s = s * p
            s = s %mod
    return s

M,N = map(int,input().strip().split(" "))
print(power(M,N))

Submission status: Accepted

Solution code:
(m,n)  =  map(int,input().split())

bi = str(format(n,"b"))
bi = bi[::-1]

c = 1
d = 1000000007

for i in bi:
    if ( i == "1"):
        c = ( c * m ) % d
    m = (m * m) %d
print (c)

Submission status: Accepted

Solution code:
m,n = map(int,input().split())

print(pow(m,n,1000000007))

Submission status: Accepted

Solution code:
m, n = map(int, input().split())
a = pow(m, n, 1000000007)
print(a)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    m, n = [int(v) for v in input().split()]
    print(pow(m, n, 1000000007))

Submission status: Accepted

Solution code:
def power(x, y, p):
	res = 1
	x = x % p
	while y > 0:
		if (y & 1) == 1 :
			res = (res * x) % p
		y = y >> 1
		x = (x * x) % p
	return res

data = [int(x) for x in input().split()]
print(power(data[0], data[1], 1000000007))

Submission status: Accepted

Solution code:
a,b=map(int,input().split(" "))
print(pow(a,b,1000000007))

Submission status: Runtime Error

Solution code:
print(pow(int(input()),int(input()),int(1e9+7)))

Submission status: Runtime Error

Solution code:
import math

s = map(int, raw_input().split())
print "%d" % (math.pow(s[0], s[1]) % 1000000007)

Submission status: Runtime Error

Solution code:
n,m = map(int, input().split())
a = n**m%1,000000007
print(a)

Submission status: Runtime Error

Solution code:
m=input()
n=input()
mod=1000000007
m = int(m)
n=int(n)
i=1

for x in range(0, n):
	i *= m
	i %= mod

print(i)

Submission status: Runtime Error

Solution code:
#include <stdio.h>
long long int pw(long long int x,long long int n){
  long long int result = 1;
  if(n > 0){
    result = pw(x,n/2);
    if(n % 2 == 0){
      result = result * result;
    }else{
      result = (result * result)*x;
	}
  }
  return result;
}

int main(){
  long long int m;
  long long int n;
  scanf("%lld %lld",&m,&n);
  printf("%lld\n",pw(m,n)%1000000007);
  return 0;
}

Submission status: Runtime Error

Solution code:
def power(x, y):
          answer = x
          for i in range(y-1):
                  answer *= x
                  answer = answer % 1000000007
          return answer
  
  l = raw_input().split()
  print power(int(l[0]), int(l[1]))

Submission status: Runtime Error

Solution code:
def power(m,n):
  a = m**n % 1000000007
  return a

l = map(int, raw_input().split())
print power(l[0],l[1])
~                                                                                                    
~

Submission status: Runtime Error

Solution code:
def power(x, y):
          answer = x
          for i in range(y-1):
                  answer = answer % 1000000007
                  answer *= x
          return answer
  
l = raw_input().split()
print power(int(l[0]), int(l[1]))

Submission status: Runtime Error

Solution code:
def power(x, y):
          answer = x
          for i in range(y-1):
                  
                  answer *= x
                  answer = answer % 1000000007
          return answer
  
l = raw_input().split()
print power(int(l[0]), int(l[1]))

Submission status: Runtime Error

Solution code:
def ENT(m,n):
    if n==0:
        return 1
    else:
        return (ENT(m,n-1)*m)%1000000007

m,n=[int(i) for i in input().split(" ")]

print(ENT(m,n))

Submission status: Runtime Error

Solution code:
a=1000000007

def isuu(m,n):
    result=1
    i=0
    while i<n:
        result=(result*m)%a
        if result==1:
            return [0,i]
        i+=1
    return [1,result]


m,n=[int(i) for i in input().split(" ")]

i=isuu(m,n)
if i[0]==1:
    print(i[1])
else:
    print((m**(n%i[1]))%a)

Submission status: Runtime Error

Solution code:
m,n = map(int,input())
print(pow(m,n,1000000007))

Submission status: Runtime Error

Solution code:
print(pow(*map(int, input().split()), int(1e9) + 7))

Submission status: Runtime Error

Solution code:
d = 1000000007

def pow_rem(x, n):
    if n == 0:
        return x ** n % d
    if n % 2 == 0:
        return pow_rem(x, n // 2) ** 2 % d
    else:
        return ((pow_rem(x , n // 2) ** 2) * x) % d

def solve():
    m, n = map(int, input().split())
    print(pow_rem(m, n)

solve()

Submission status: Runtime Error

Solution code:
def pow2(m, n):
    M = 1000000007
    if n == 0
        return 1
    res = pow2(m*m%M, n/2)
    if n%2 == 1
        res = res*m%M
    return res

m,n = map(int,input().split())
print(pow2(m,n))

Submission status: Runtime Error

Solution code:
def pow_mod(n, x, mod) :
  if n == 1:
    return n
  ret = pow_mod(n*n, x//2, mod)
  if x % 2 == 1:
    ret *= n
  return ret

n, x = list(map(int, input().split()))
print(pow_mod(n, x, 1000000007)

Submission status: Runtime Error

Solution code:
m.n=map(int, input().split())
print(m**n)

Submission status: Runtime Error

Solution code:
import math
print(math.pow(map(int,input())))

Submission status: Runtime Error

Solution code:
a,b=map(int, input().split())
mn=m**n
print(mn/1000000007)

Submission status: Runtime Error

Solution code:
m, n = map(int, input().split())
print(pow(m, n, int(1e9) + 7))javascript:void(0)

Submission status: Runtime Error

Solution code:
from math import *

def main()
    m, n = [int(_) for _ in input().split()]
    print(pow(m, n, 1000000007))

main()

Submission status: Runtime Error

Solution code:
from math import *

def main():
    m, n = [int(_) for _ in input().split()]
    print(pow(m, n, 1000000007))

main()

Submission status: Runtime Error

Solution code:
from math import *

def main():
    m, n = [int(_) for _ in input().split()]
    print(int(pow(m, n) % 1000000007))

main()