Help me in solving ANDSUBAR problem

My issue

My code

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	return 0;

Problem Link: CodeChef: Practical coding for everyone

The approach would be like choosing the subarray that have atleast one bit set in all the integers of that subarray like in case of 10 answer would be [4,5,6,7] all have one set bit .[8,9,10] also have 8 as set bit but their length will be 3 which is smaller than [4,5,6,7] that have 4.