You are given an array of non-negative integers of length . You have to perform two types of operations on them.
Type-1: . Convert all the numbers from index to to their binary. Perform a cyclic left-shift on the binary representations of the numbers. Then convert them back to decimal again.
Type-2: . Print the sum of all the integers from to .
First line contains two space separated integers () and (), where is the size of given array and is the number of operations you have to perform.
Second line contains space separated integers.
Each of the next lines contain 3 integers describing the operations in the following format.
type L R
,
, fits in a 32-bit signed integer.
For each type-2 operation, print an integer which is the sum of integers from index to .
Input | Output |
---|---|
5 5 4 5 13 6 0 1 1 3 2 1 5 1 2 5 1 1 5 2 1 5 | 21 14 |
Description about type-1 operation:
Suppose you want to perform the circular left shift on 57. Here's the total process: