RSHIFT - Right Shift


All the numbers in a computer is represented as 64-bit 2's complement form.

You have to write a program to perform the following task :-

  • Read the number (given in decimal form).
  • Shift all the bits towards right (the first bit is removed), i.e the second bit from right is shifted to first position, third to second and so on.
  • Add a zero to the last position.
  • Write the result back in decimal form

 

For example 10 is represented as:

0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 1010

After step 2 the result is:

_000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0101

After step 3 the result is:

0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0101

Finally the output is: 5

Input

The first line contains T representing the number of test cases (T<=500000). Then T lines follows each containing a input number.

Output

Print T lines, each containing the result of each test case.

Constraints

All input and output numbers will fit in signed 64-bit integer. Large I/O. A fast code written in fast language is likely to pass.

Example

Input:
5
1
2
3
4
5

Output:
0
1
1
2
2

hide comments
lumaks_69: 2022-02-08 23:47:22

long long gave me 1 wa
use unsigned long long

karim mohamed: 2020-08-30 07:46:24

It should have declared that there is no negative number

Sebastian Ceronik: 2017-08-22 11:49:22

I wonder if it is possible with the same java code fast i/o after n submits ... or maybe there is another trick for java that I am missing :/

mahilewets: 2017-08-20 09:48:23

THAT is test for input speed, not INTEST

ciphereck: 2017-08-13 18:03:25

tle even after using scanf and printf
Anyone ??

namitp: 2017-08-12 09:08:18

Leave This Que if u got the logic....
Time Boundations are this much tight that i got submitted after 30,32 attempts and after submission when i submitted it again with same language same code it shows TLE.....*****

//Still Loved It coz
//It Completes my 50..

Last edit: 2017-08-12 09:47:53
sonudoo: 2017-08-09 17:50:57

@singlasahil221 Sorry I can't provide any more testcases.

singlasahil221: 2017-08-09 13:00:53

what should the code return if testcase is:
[spoiler]

Last edit: 2017-08-09 17:50:14
hanstan: 2017-07-30 19:58:37

Nailed it 0.03s with C++
PS: fast i/o ;p

Last edit: 2017-07-31 06:33:50
sonudoo: 2017-07-30 10:35:17

@sharonbarak Java already has an advantage over other languages for this question. Moreover there are successful submissions in Java

Last edit: 2017-07-30 10:35:34

Added by:sonudoo
Date:2017-07-25
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All
Resource:Own