Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
#include <bits/stdc++.h>
#define lli long long int
#define mod 2098244353
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
lli n,m,i,j,k,p,t,a,b,ans;
bool flag;
cin>>t;
while(t--)
{
cin>>a>>b ;
j=1;flag=false;
while(j<b){
j*=2;
if(j==b)flag=true;
}
if(flag)cout<<"Yes"<<"\n";
else cout<<"No"<<"\n";
//cout<<ans<<"\n";
}
return 0;
}
#include <bits/stdc++.h>
#define lli long long int
#define mod 2098244353
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
lli n,m,i,j,k,p,t,a,b,ans;
bool flag;
cin>>t;
while(t--)
{
cin>>a>>b ;
j=1;flag=__builtin_popcountll(b) == 1;
if(flag)cout<<"Yes"<<"\n";
else cout<<"No"<<"\n";
//cout<<ans<<"\n";
}
return 0;
}
t = int(input())
l = 1000000000000000001
p = 1
c = {}
while p <= l:
c[str(p)] = True
p *= 2
for i in range(t):
a, b = input().split()
print('Yes' if c.get(b, False) else 'No')
#include <stdio.h>
#define ll long long int
int isPowerOfTwo(long long int n)
{
if (n == 0)
return 0;
while (n != 1) {
if (n % 2 != 0)
return 0;
n = n / 2;
}
return 1;
}
int main(void) {
// your code goes here
ll a,b;
scanf("%lld",&a);
for(b=0;b<a;b++)
{
ll u,d;
scanf("%lld %lld",&u,&d);
isPowerOfTwo(d) ? printf("Yes\n") : printf("No\n");
}
return 0;
}
/* 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 Reader sc = new Reader();
//static FastReader sc = new FastReader();
static Random rand = new Random();
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new InputStreamReader(System.in));
}
String next()
{
while (st == null || !st.hasMoreElements())
{
try
{
st = new StringTokenizer(br.readLine());
}
catch (IOException e)
{
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt()
{
return Integer.parseInt(next());
}
long nextLong()
{
return Long.parseLong(next());
}
double nextDouble()
{
return Double.parseDouble(next());
}
String nextLine()
{
String str="";
try
{
str=br.readLine();
}
catch (IOException e)
{
e.printStackTrace();
}
return str;
}
}
static class Reader {
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bufferPointer, bytesRead;
public Reader()
{
din = new DataInputStream(System.in);
buffer = new byte[BUFFER_SIZE];
bufferPointer = bytesRead = 0;
}
public Reader(String file_name) throws IOException
{
din = new DataInputStream(
new FileInputStream(file_name));
buffer = new byte[BUFFER_SIZE];
bufferPointer = bytesRead = 0;
}
public String next() throws IOException
{
byte[] buf = new byte[64]; // line length
int cnt = 0, c;
while ((c = read()) != -1) {
if (c == '\n') {
if (cnt != 0) {
break;
}
else {
continue;
}
}
buf[cnt++] = (byte)c;
}
return new String(buf, 0, cnt);
}
public int nextInt() throws IOException
{
int ret = 0;
byte c = read();
while (c <= ' ') {
c = read();
}
boolean neg = (c == '-');
if (neg)
c = read();
do {
ret = ret * 10 + c - '0';
} while ((c = read()) >= '0' && c <= '9');
if (neg)
return -ret;
return ret;
}
public long nextLong() throws IOException
{
long ret = 0;
byte c = read();
while (c <= ' ')
c = read();
boolean neg = (c == '-');
if (neg)
c = read();
do {
ret = ret * 10 + c - '0';
} while ((c = read()) >= '0' && c <= '9');
if (neg)
return -ret;
return ret;
}
public double nextDouble() throws IOException
{
double ret = 0, div = 1;
byte c = read();
while (c <= ' ')
c = read();
boolean neg = (c == '-');
if (neg)
c = read();
do {
ret = ret * 10 + c - '0';
} while ((c = read()) >= '0' && c <= '9');
if (c == '.') {
while ((c = read()) >= '0' && c <= '9') {
ret += (c - '0') / (div *= 10);
}
}
if (neg)
return -ret;
return ret;
}
private void fillBuffer() throws IOException
{
bytesRead = din.read(buffer, bufferPointer = 0,
BUFFER_SIZE);
if (bytesRead == -1)
buffer[0] = -1;
}
private byte read() throws IOException
{
if (bufferPointer == bytesRead)
fillBuffer();
return buffer[bufferPointer++];
}
public void close() throws IOException
{
if (din == null)
return;
din.close();
}
}
public static int ii() throws IOException {
return sc.nextInt();
}
public static long il() throws IOException {
return sc.nextLong();
}
public static String is() throws IOException {
return sc.next();
}
public static double id() throws IOException {
return sc.nextDouble();
}
public static long max(long... arr) {
long a = arr[0];
for (long itr : arr) a = Math.max(a, itr);
return a;
}
public static int max(int... arr) {
int a = arr[0];
for (int itr : arr) a = Math.max(a, itr);
return a;
}
public static long min(long... arr) {
long a = arr[0];
for (long itr : arr) a = Math.min(a, itr);
return a;
}
public static int min(int... arr) {
int a = arr[0];
for (int itr : arr) a = Math.min(a, itr);
return a;
}
public static HashMap<Long,Long> mpll(long array[]) {
HashMap<Long,Long> hm = new HashMap<>();
for(int i=0; i<array.length;i++) {
if(hm.get(array[i]) == null) {
hm.put(array[i],1L);
}
else {
hm.put(array[i],hm.get(array[i])+1);
}
}
return hm;
}
public static HashMap<Integer,Integer> get_Frequency (int array[]) {
HashMap<Integer,Integer> hm = new HashMap<>();
for(int i=0; i<array.length;i++) {
if(hm.get(array[i]) == null) {
hm.put(array[i],1);
}
else {
hm.put(array[i],hm.get(array[i])+1);
}
}
return hm;
}
public static HashMap<Integer,Integer> cmpii() {
return new HashMap<>();
}
public static void pia(int A[]) {
for(int i : A) {
System.out.print(i+" ");
}
System.out.println();
}
public static void pla(long A[]) {
for(long i : A) {
System.out.print(i+" ");
}
System.out.println();
}
public static void pba(boolean A[]) {
for(boolean i : A) {
System.out.print(i+" ");
}
System.out.println();
}
public static void p2dia(int arr[][]) {
for(int i=0;i<arr.length;i++) {
for(int j=0;j<arr[i].length;j++){
System.out.print(arr[i][j]+" ");
}
System.out.println();
}
System.out.println();
}
public static void p2dla(long arr[][]) {
for(int i=0;i<arr.length;i++) {
for(int j=0;j<arr[i].length;j++){
System.out.print(arr[i][j]+" ");
}
System.out.println();
}
System.out.println();
}
public static void ps(String s) { System.out.println(s); }
public static void pi(String s, int n) { System.out.println(s+" "+n); }
public static void pi(int n) { System.out.println(n); }
public static void pl(String s, long n) { System.out.println(s+" "+n); }
public static void pl(long n) { System.out.println(n); }
public static String reverse(String s) {
StringBuilder p=new StringBuilder(s);
p.reverse();
return p.toString();
}
public static int gcd(int a, int b)
{
if (a == 0)
return b;
return gcd(b % a, a);
}
public static int lcm(int a, int b) {
return (int)(((long)a * b) / gcd(a,b));
}
public static long gcd(long a, long b)
{
if (a == 0)
return b;
return gcd(b % a, a);
}
public static int[] cia(int n) {
return new int[n];
}
public static long[] cla(int n) {
return new long[n];
}
public static boolean[] cba(int n) { return new boolean[n]; }
public static void fiav(int arr[], int v) {
Arrays.fill(arr, v);
}
public static int[] fiarv(int n) {
int arr[] = new int[n];
for (int i=0;i<n;i++) {
int k = rand.nextInt(101);
while(k==0) {
k=rand.nextInt(101);
}
arr[i] = k;
}
return arr;
}
public static int gri(int minimum, int maximum) {
int x= rand.nextInt(maximum+1);
while(x < minimum) {
x= rand.nextInt(maximum+1);
}
return x;
}
public static void flav(long arr[], int v) {
Arrays.fill(arr, v);
}
public static int[] iia(int n) throws IOException {
int arr[] = new int[n];
for(int i=0;i<n;i++) {
arr[i]=ii();
}
return arr;
}
public static long[] ila(int n) throws IOException {
long arr[] = new long[n];
for(int i=0;i<n;i++) {
arr[i]=il();
}
return arr;
}
public static int[] ria(int[] arr) {
int n=arr.length;
int rev[] = cia(n);
for(int i = 0; i<=n/2 ;i++) {
rev[i] = arr[n-1-i];
rev[n-1-i] = arr[i];
}
return rev;
}
public static long[] rla(long[] arr) {
int n=arr.length;
long rev[] = cla(n);
for(int i = 0; i<=n/2 ;i++) {
rev[i] = arr[n-1-i];
rev[n-1-i] = arr[i];
}
return rev;
}
public static ArrayList[] caal(int size) {
return new ArrayList[size];
}
public static ArrayList[] iaal(ArrayList al[], int size) {
for(int i=0;i<size;i++) {
al[i]=new ArrayList<>();
}
return al;
}
public static void addEdge(int src, int dest, ArrayList<Integer> al[]) {
if( al[src] == null) {
al[src] = new ArrayList<>();
}
if( al[dest] == null) {
al[dest] = new ArrayList<>();
}
al[src].add(dest);
al[dest].add(src);
}
public static int[] assign_depth(int root, int number_of_nodes, ArrayList<Integer> al[]) {
int depth[] = new int[number_of_nodes];
boolean visited[] = new boolean[number_of_nodes];
depth[root] = 0;
ArrayList<Integer> queue = new ArrayList<>();
queue.add(root);
visited[root] = true;
while(queue.size()>0) {
int element = queue.get(0);
for(Integer a : al[element]) {
if(visited[a])
continue;
depth[a] = depth[element] + 1;
queue.add(a);
}
visited[element] = true;
queue.remove(0);
}
return depth;
}
public static int[] iia(int n, int starting_point) throws IOException {
int arr[] = new int[n];
for(int i=starting_point;i<n;i++) {
arr[i]=ii();
}
return arr;
}
public static long sia(int A[]) {
long sum=0;
for(int i : A) {
sum+=i;
}
return sum;
}
public static long sla(long A[]) {
long sum=0;
for(long i : A) {
sum+=i;
}
return sum;
}
public static boolean ip(int n) {
for(int i=2;i*i<=n;i++) {
if(n%i==0)
return false;
}
return true;
}
public static HashMap<Integer,Integer> pfi(int n) {
HashMap<Integer,Integer> hm = cmpii();
int df=2;
while(n>1 && df<=Math.sqrt(n))
{
int count=0;
while ( ( n % df ) == 0 )
{
count++;
n/=df;
}
if( count > 0 )
hm.put( df, count );
df++;
}
if(n>1)
hm.put( n , 1 );
return hm;
}
public static long power_mod(long base,long power, int mod) {
long res=1;
while(power>0)
{
if(power%2==1)
{
res=(res*base)%mod;
power--;
}
else
{
base=(base*base)%mod;
power/=2;
}
}
return res;
}
public static int[][] iim(int m,int n) throws IOException {
int mat[][] = new int[m][n];
for(int i=0;i<m;i++) {
for(int j=0;j<n;j++) {
mat[i][j] = ii();
}
}
return mat;
}
public static int[][] fimv(int m,int n, int v) throws IOException {
int mat[][] = new int[m][n];
for(int i=0;i<m;i++) {
for(int j=0;j<n;j++) {
mat[i][j] = v;
}
}
return mat;
}
public static int[][] transpose_2D_matrix(int inp_matrix[][]) {
int m = inp_matrix.length;
int n = inp_matrix[0].length;
int transposed_matrix[][] = new int[n][m];
for(int i =0; i< n; i++) {
for(int j = 0; j < m ;j++) {
transposed_matrix[i][j] = inp_matrix[j][i];
}
}
return transposed_matrix;
}
private static boolean compare(int[] arr, int[] ans) {
for(int i=0;i<arr.length;i++) {
if(arr[i] != ans[i]) {
return false;
}
}
return true;
}
public static int[] nextGreaterIntegerElement(int arr[]) {
int n = arr.length;
int grt[] = cia(n);
grt[n-1] = -1;
Stack<Integer> st = new Stack<>();
st.add(arr[n-1]);
int curr=n-2;
while(st.size()>0 && curr>=0) {
int a = st.peek();
if(arr[curr] < a) {
grt[curr] = a;
st.push(arr[curr]);
}
else if(arr[curr] >= a) {
while(st.size()>0) {
if(arr[curr] >= st.peek()) {
st.pop();
}
else {
grt[curr] = st.peek();
st.push(arr[curr]);
break;
}
}
if(st.size()==0) {
grt[curr] = -1;
st.push(arr[curr]);
}
}
curr--;
}
return grt;
}
public static void debug(Object... o) {
System.out.println(Arrays.deepToString(o));
}
static class pair {
int a,b;
pair(int a,int b) {
this.a=a;
this.b=b;
}
}
static class pair3 {
int a,b,c;
pair3(int a,int b,int c) {
this.a=a;
this.b=b;
this.c=c;
}
}
static class LL {
int data;LL next;
LL(int data)
{
this.data=data;
}
}
static class BT {
BT left,right;
int data;
BT(int data) {
this.data=data;
}
}
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
int t = ii();
StringBuilder sb = new StringBuilder();
while(t-- > 0) {
il();
long b = il();
String s = ((b & (b-1)) == 0) ? "Yes" : "No";
sb.append(s+"\n");
}
System.out.println(sb);
}
}
import sys
for _ in range(int(sys.stdin.readline())):
a,b = map(int,sys.stdin.readline().split())
while(b%2==0):
b /=2
if(b==1):
print("YES")
else:
print("NO")
B = []
v = 2
MX = 10**18
while v < MX:
B.append(v)
v = v*2
# endwhile
t = int(raw_input())
for i in range(t):
st = raw_input().split()
a = int(st[0])
b = int(st[1])
if b in B:
print 'Yes'
else:
print 'No'
# endif
# endfor i
#region usings
using System;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections;
using static System.Math;
using static System.Array;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
#endregion
namespace Codechef
{
class Solution
{
private static readonly Scanner sc = new Scanner();
static void Main()
{
// int testCases = 1;
int testCases = sc.ReadInt();
while (testCases > 0)
{
long[] arr = sc.ReadLongArr();
Solve(arr);
testCases--;
}
sc.Flush();
sc.Close();
}
private static void Solve(long[] arr)
{
long a = arr[0], b = arr[1];
sc.YesNo(b != 0 && ((b & (b - 1)) == 0));
}
}
public class Scanner
{
#if (!DEBUG)
public static StreamReader streamReader = new StreamReader(Console.OpenStandardInput());
public static StreamWriter streamWriter = new StreamWriter(Console.OpenStandardOutput());
#else
public static StreamReader streamReader = new StreamReader(@"C:\Users\869963\Documents\Coding\C#\input.txt");
public static StreamWriter streamWriter = new StreamWriter(@"C:\Users\869963\Documents\Coding\C#\output.txt");
#endif
#region Input
public int ReadInt()
{
return Convert.ToInt32(streamReader.ReadLine());
}
public string ReadLine()
{
return streamReader.ReadLine();
}
public long ReadLong()
{
return Convert.ToInt64(streamReader.ReadLine());
}
public double ReadDouble()
{
return Convert.ToDouble(streamReader.ReadLine());
}
public int[] ReadIntArr()
{
return ConvertAll(streamReader.ReadLine().TrimEnd().Split(' '), x => Convert.ToInt32(x));
}
public long[] ReadLongArr()
{
return ConvertAll(streamReader.ReadLine().TrimEnd().Split(' '), x => Convert.ToInt64(x));
}
public char[] ReadCharArr()
{
return streamReader.ReadLine().ToCharArray();
}
public int[][] ReadInt2DArr(long n)
{
int[][] res = new int[n][];
for (int i = 0; i < n; i++)
{
res[i] = ReadIntArr();
}
return res;
}
#endregion
#region Output
public void Write<T>(T x)
{
streamWriter.Write(x);
}
public void WriteLine<T>(T result)
{
streamWriter.WriteLine(result);
}
public void Write2DMatrix(int[,] sum, int n, int m)
{
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
Write<string>($"{sum[i, j]} ");
}
WriteLine<string>("");
}
}
public void YESNO(bool condition)
{
WriteLine(condition ? "YES" : "NO");
}
public void YesNo(bool condition)
{
WriteLine(condition ? "Yes" : "No");
}
public void yesno(bool condition)
{
WriteLine(condition ? "yes" : "no");
}
public void Flush()
{
streamWriter.Flush();
}
public void Close()
{
streamReader.Close();
streamWriter.Close();
}
internal void WriteArray(long[] secondHalf)
{
for (int i = 0; i < secondHalf.Length; i++)
{
streamWriter.Write(secondHalf[i] + " ");
}
WriteLine("");
}
#endregion
}
}
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--
s, _ := reader.ReadBytes('\n')
var a, b uint64
pos := readUint64(s, 0, &a) + 1
readUint64(s, pos, &b)
res := solve(int64(a), int64(b))
if res {
buf.WriteString("YES\n")
} else {
buf.WriteString("NO\n")
}
}
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
}
func solve(a, b int64) bool {
return b&(b-1) == 0
}
In our experience, we suggest you solve this From Rational to Binary 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 From Rational to Binary CodeChef Solution.
I hope this From Rational to Binary 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!