Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
int fast_mutiplier(int a, int b)
{
int result = 1;
int a_p = a%mod;
while(b!=0)
{
if(b%2==1)
{
result = ((result%mod)*a_p)%mod;
}
a_p = (a_p*a_p)%mod;
b = b/2;
}
return result;
}
void solve()
{
int n, m;
cin>>n>>m;
int a = fast_mutiplier(2,n);
int b = fast_mutiplier(a-1,m);
cout<<b%mod<<endl;
}
int32_t main()
{
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int t=1;
cin>>t;
for(int i=1; i<=t; ++i)
{
solve();
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define Time cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
#define pb push_back
#define mp make_pair
#define line cout << endl;
#define ff first
#define ss second
#define vi vector<int>
#define no cout << "NO" << endl;
#define yes cout << "YES" << endl;
#define printv(v) \
for (int i = 0; i < (v.size()); i++) \
{ \
cout << v[i] << " "; \
} \
line;
#define onesbits(x) __builtin_popcountll(x)
#define zerobits(x) __builtin_ctzll(x)
#define sp(x, y) fixed << setprecision(y) << x
#define w(x) \
int x; \
cin >> x; \
while (x--)
#define tk(x) \
int x; \
cin >> x;
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
#ifndef ONLINE_JUDGE
#define debug(x) \
cerr << #x << " "; \
_print(x); \
cerr << endl;
#else
#define debug(x)
#endif
template <class T>
void _print(T t)
{
cerr << t;
}
template <class T, class V>
void _print(pair<T, V> p)
{
cerr << "{";
_print(p.ff);
cerr << ",";
_print(p.ss);
cerr << "}";
}
template <class T>
void _print(vector<T> v)
{
cerr << "[ ";
for (T i : v)
{
_print(i);
cerr << " ";
}
cerr << "]";
}
template <class T>
void _print(vector<vector<T>> v)
{
cerr << "[\n";
for (int l = 0; l < v.size(); l++)
{
{
for (int k = 0; k < v[l].size(); k++)
cerr << v[l][k] << " ";
}
cerr << "\n";
}
cerr << "]";
}
template <class T, class V>
void _print(map<T, V> v)
{
cerr << "[ ";
for (auto i : v)
{
_print(i);
cerr << " ";
}
cerr << "]";
}
template <class T>
void _print(set<T> v)
{
cerr << "[ ";
for (T i : v)
{
_print(i);
cerr << " ";
}
cerr << "]";
}
const long long inf = 1e18;
const int MOD = 1e9 + 7;
const int MAX = 1e6;
int numbit(int x)
{
int ans = 0;
while (x > 0)
{
x = x >> 1;
ans++;
}
return ans;
}
int setbit(int x)
{
int ans = 0;
while (x > 0)
{
if (x & 1)
{
ans++;
}
x = x >> 1;
}
return ans;
}
bool isValid(string s)
{
int len = s.size();
for (int i = 0; i < len / 2; i++)
{
if (s[i] != s[len - 1 - i])
return false;
}
return true;
}
void rotateMatrix(vector<vector<int>> &v, int n)
{
for (int i = 0; i < n / 2; i++)
{
for (int j = i; j < n - i - 1; j++)
{
int ptr = v[i][j];
v[i][j] = v[n - 1 - j][i];
v[n - 1 - j][i] = v[n - 1 - i][n - 1 - j];
v[n - 1 - i][n - 1 - j] = v[j][n - 1 - i];
v[j][n - 1 - i] = ptr;
}
}
}
vector<bool> is_prime(10001, 1);
vector<int> primes;
void seive()
{
is_prime[0] = 0;
is_prime[1] = 0;
for (int i = 2; i < 10001; i++)
{
if (is_prime[i])
{
primes.push_back(i);
for (int j = i + i; j < 10001; j += i)
{
is_prime[j] = 0;
}
}
}
}
ll expo (ll x,ll n){
ll result=1;
while (n) {
if (n & 1)
result = result * x % MOD;
n = n / 2;
x = x * x % MOD;
}
return result;
}
int32_t main() {
ll t; cin >> t;
// seive();
while (t--) {
ll n,m;
cin>>n>>m;
ll ans=expo(2,n)-1;
cout<<expo(ans,m)<<endl;
}
return 0;
}
// 1b 4d
# cook your dish here
def power(x, y, p) :
res = 1
x = x % p
if (x == 0) :
return 0
while (y > 0) :
if ((y & 1) == 1) :
res = (res * x) % p
y = y >> 1
x = (x * x) % p
return res
for _ in range(int(input())):
[N,M]=[int(i) for i in input().split(" ")]
ans=power((power(2,N,1000000007)-1),M,1000000007)
print(ans)
#include <stdio.h>
int main()
{
int x;
scanf("%d",&x);
while(x--)
{
long long int N,M;
long long int _=1;
scanf("%lld %lld",&N,&M);
long long int ans = power(2, N);
ans=ans-1;
long long int res = power(ans, M);
printf("%lld\n", res);
}
}
int power(long long int a,long long int b)
{
long long int res=1,mod=1000000007;
while(b>0){
if(b & 1)
res = (res*a%mod);
a = (a*a)%mod;
b = b>>1;
}
return res;
}
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
static long power(long x, long y, long p){
long res = 1L; // Initialize result
x = x % p; // Update x if it is more than or
// equal to p
if (x == 0L)
return 0L; // In case x is divisible by p;
while (y > 0L)
{
// If y is odd, multiply x with result
if ((y & 1) != 0)
res = (res * x) % p;
// y must be even now
y = y >> 1; // y = y/2
x = (x * x) % p;
}
return res;
}
public static void main (String[] args) throws java.lang.Exception
{
int T;
Scanner in = new Scanner(System.in);
T=in.nextInt();
// in.nextLine();
while(T-->0)
{
int mod=(int)(Math.pow(10,9)+7);
int n=in.nextInt();
int m=in.nextInt();
long pow=power(2,n,mod);
pow=(pow-1);
// System.out.println(pow);
long ans=power(pow,m,mod);
System.out.println(ans);
}
}
}
T = int(input())
for _ in range(T):
N, M = map(int, input().split())
mod = 1000000007
print(pow(pow(2,N, mod)-1, M, mod))
MD = 1000000007
t = int(raw_input())
for i in range(t):
st = raw_input().split()
N = int(st[0])
M = int(st[1])
v = (pow(2,N,MD)-1)%MD
r = pow(v,M,MD)
print r
# endfor i
using System;
using System.Linq;
public class Test
{
public static void Main()
{
int t = int.Parse(Console.ReadLine());
while(t>0)
{
t--;
long []a = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
long result = power(2,a[0]) - 1;
long finalResult = power(result,a[1]);
Console.WriteLine(finalResult);
}
}
static long power(long m , long y)
{
long result = 1;
long mod = 1000000007;
while(y > 0)
{
if((y & 1) != 0)
{
result = ((result%mod)*(m%mod))%mod;
}
y >>= 1;
m = ((m%mod)*(m%mod))%mod;
}
return result;
}
}
package main
import (
"bufio"
"bytes"
"fmt"
"os"
)
func main() {
reader := bufio.NewReader(os.Stdin)
var buf bytes.Buffer
tc := readNum(reader)
for tc > 0 {
tc--
n, m := readTwoNums(reader)
res := solve(n, m)
buf.WriteString(fmt.Sprintf("%d\n", res))
}
fmt.Print(buf.String())
}
func readInt(bytes []byte, from int, val *int) int {
i := from
sign := 1
if bytes[i] == '-' {
sign = -1
i++
}
tmp := 0
for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
tmp = tmp*10 + int(bytes[i]-'0')
i++
}
*val = tmp * sign
return i
}
func readNum(reader *bufio.Reader) (a int) {
bs, _ := reader.ReadBytes('\n')
readInt(bs, 0, &a)
return
}
func readTwoNums(reader *bufio.Reader) (a int, b int) {
res := readNNums(reader, 2)
a, b = res[0], res[1]
return
}
func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
res := readNNums(reader, 3)
a, b, c = res[0], res[1], res[2]
return
}
func readNNums(reader *bufio.Reader, n int) []int {
res := make([]int, n)
x := 0
bs, _ := reader.ReadBytes('\n')
for i := 0; i < n; i++ {
for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
x++
}
x = readInt(bs, x, &res[i])
}
return res
}
func readUint64(bytes []byte, from int, val *uint64) int {
i := from
var tmp uint64
for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
tmp = tmp*10 + uint64(bytes[i]-'0')
i++
}
*val = tmp
return i
}
const MOD = 1000000007
func pow(A, B int64) int64 {
R := int64(1)
for B > 0 {
if B&1 == 1 {
R = (R * A) % MOD
}
A = (A * A) % MOD
B >>= 1
}
return R
}
func solve(n, m int) int {
// for each bit, we can choose 0 or 1, there are total 2 ^^ n ways,
// but all 1, will cause result not 0, so, we need to subtract 1
// and there are total m bits
x := pow(2, int64(n))
x += MOD - 1
x %= MOD
return int(pow(x, int64(m)))
}
In our experience, we suggest you solve this Bitwise Tuples CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.
If you are stuck anywhere between any coding problem, just visit Queslers to get the Bitwise Tuples CodeChef Solution.
I hope this Bitwise Tuples CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.
This Problem is intended for audiences of all experiences who are interested in learning about Programming Language in a business context; there are no prerequisites.
Keep Learning!