304 North Cardinal St.
Dorchester Center, MA 02124

# Jogging CodeChef Solution

## Jogging CodeChef Solution in C++17

``````#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007
ll a[10000000];
void power()
{
ll j = 1;
for(ll i=0;i<10000000;i++)
{
a[i] = j;
j = (a[i] * 2) % mod;
}
}
int main() {
ll t;
cin>>t;
power();
while(t--)
{
ll n,x;
cin>>n>>x;
cout<<(a[n-1]*x)%mod<<endl;
}
return 0;
}``````

## Jogging CodeChef Solution in C++14

``````#include <iostream>
#include<bits/stdc++.h>
#define ll long long
#define big 1000000007
using namespace std;

int main() {

ll a[1000000]={0};
a[0]=1;
for(int i=1;i<=1000000;i++)
{
a[i]=(a[i-1]*2);
a[i]=(a[i]%big);
}
int t;
cin>>t;
while(t--)
{
int n,x;
cin>>n>>x;
ll sum=x;
sum=(sum*a[n-1]);
sum=sum%1000000007;
cout<<sum<<endl;
}
}``````

## Jogging CodeChef Solution in PYTH 3

``````# cook your dish here
for i in range(int(input())):
m=10**9+7
n, x = map(int, input().split())
print((pow(2, n - 1, m) * x) % m)``````

## Jogging CodeChef Solution in C

``````#include <stdio.h>
#include<math.h>
int main()
{
int t;

scanf("%d",&t);

while(t--)

{
long int n,x;

scanf("%d%d",&n,&x);

long int r=x,k=2;

n=n-1;

while(1)
{

if ((n&1)==1)

{

r=(r*k)%1000000007;

}

n=n>>1;

k=(k*k)%1000000007;

if (n==0)

break;

}

printf("%ld",r);

printf("\n");

}

return 0;
}``````

## Jogging CodeChef Solution in JAVA

``````/* 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
{
public static void main (String[] args) throws java.lang.Exception
{
BufferedWriter writer=new BufferedWriter(new OutputStreamWriter(System.out));
long mod=(long)(1E9+7L);
while(tt-->0){
long n=input[0], x=input[1];
long p=pow(2, n-1, mod);
writer.write((p*x)%mod+"\n");
}
writer.flush();
}

private static long pow(int a, long x, long mod){
if(x==0){
return 1L;
}
long half=pow(a, x/2, mod);
if((x&1)!=0){
return (((half*a)%mod)*half)%mod;
}
return (half*half)%mod;
}

private static int[] parseInt(String str) {
String[] parts=str.split("\\s+");
int[] ans=new int[parts.length];
for(int i=0;i<ans.length;i++){
ans[i]=Integer.parseInt(parts[i]);
}
return ans;
}

private static long[] parseLong(String str) {
String[] parts=str.split("\\s+");
long[] ans=new long[parts.length];
for(int i=0;i<ans.length;i++){
ans[i]=Long.parseLong(parts[i]);
}
return ans;
}
}``````

## Jogging CodeChef Solution in PYPY 3

``````mod=10**9+7
for i in  range(int(input())):
k,x=map(int,input().split())
print((pow(2,k-1,mod)*x)%mod)``````

## Jogging CodeChef Solution in PYTH

``````MD = 1000000007
t = int(raw_input())
for i in range(t):
st = raw_input().split()
N = int(st[0])
X = int(st[1])
r = (pow(2,N-1,MD))*X%MD
print r
# endfor i
``````

## Jogging CodeChef Solution in C#

``````using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;

namespace ConsoleApp5
{
internal class Test
{
static BigInteger min(BigInteger a, BigInteger b)
{
if (a <= b) return a;
return b;
}
static BigInteger max(BigInteger a, BigInteger b)
{
if (a >= b) return a;
return b;
}
static BigInteger abs(BigInteger a)
{
if (a < 0) return -a;
return a;
}

static BigInteger powerOfTwo(BigInteger pow)
{
if (pow == 0) return 1;
BigInteger result = 1;
for (int i = 0; i < pow; i++)
{
result *= 2;
}
return result;
}

static void Main(string[] args)
{
for (BigInteger i = 0; i < T; i++)
{
int[] NX = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
BigInteger result = (NX[1] * BigInteger.ModPow(2, NX[0] - 1, 1000000007)) % 1000000007;
Console.WriteLine(result);
}
}
}
}``````
##### Jogging CodeChef Solution Review:

In our experience, we suggest you solve this Jogging 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 Jogging CodeChef Solution.

Find on CodeChef

##### Conclusion:

I hope this Jogging 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!