Medium Data Structures > Basic Data Structures

Bangladesh is a developed country, much better relations the people of this country. This country's boys and girls are all things that much better. Programming is a big part of the people of this country. In this country, a lot of guys better in programming. So a lot of programmers are in the relationship. Helal and nuhu are good friend and good Programmer. They have girlfriends. Helal’s girlfriend name is "SMM" and Nuhu’s girlfriend name is “HONEST" .But SMM and HONEST are very talent. One day Helal, Nuhu go to a party with their girlfriend . At that time, their girlfriend said, “We'll give a problem, can you solve it?” If you can solve that problem, then you are much better programmer. SMM and HONEST give some Conditions: 1. Given that n numbers a[0],a[1]………a[n-1] 2. Each pair you do OR operation ( a[i] | a[j] ) and i<j 3. sum of all pair result Input: ------ Input starts with an integer **T (1 ≤ T ≤ 100),** denoting the number of test cases. Cases each test case starts with an integer **N (1<=N<=10^5)**, The next line contains N integers a0, a1, ..., an-1 **( 0 ≤ ai ≤ 10^8)**. The total summation of N over all test cases will be **≤ 200000.** Output: ------- For each case of input you have to print the case number and just print the desired answer . Sample Input ------------ 2 4 1 3 6 2 2 3 7 Sample Output ------------- Case 1: 29 Case 2: 7 Note In the first example 1 ,3 ,6 ,2 1 | 3 = 3 1 | 6 = 7 1 | 2 = 3 3 | 6 = 7 3 | 2 = 3 6 | 2 = 6 ans = 3 + 7 + 3 + 7 + 3 + 6 ans = 29

Anowar Hossain Anu