fork download
  1. int ans = 0;
  2. for (int i = 0; i < 33; i++)
  3. {
  4. int cnt = 0;
  5. int chk = 0;
  6.  
  7. for (int j = 0; j < n; j++)
  8. {
  9. if (arr[j] & (1ll << i))
  10. {
  11. chk ^= 1;
  12. }
  13. cnt += (chk == 1);
  14. }
  15.  
  16. for (int j = 0; j < n; j++)
  17. {
  18. ans += (1ll << i) * cnt;
  19.  
  20. if (arr[j] & (1ll << i))
  21. {
  22. cnt = n - j - cnt;
  23. }
  24. }
  25. }
Compilation error #stdin compilation error #stdout 0s 5284KB
stdin
Standard input is empty
compilation info
prog.cpp:2:1: error: expected unqualified-id before ‘for’
 for (int i = 0; i < 33; i++)
 ^~~
prog.cpp:2:17: error: ‘i’ does not name a type
 for (int i = 0; i < 33; i++)
                 ^
prog.cpp:2:25: error: ‘i’ does not name a type
 for (int i = 0; i < 33; i++)
                         ^
stdout
Standard output is empty