int ans = 0;for (int i = 0; i < 33; i++){ int cnt = 0; int chk = 0; for (int j = 0; j < n; j++) { if (arr[j] & (1ll << i)) { chk ^= 1; } cnt += (chk == 1); } for (int j = 0; j < n; j++) { ans += (1ll << i) * cnt; if (arr[j] & (1ll << i)) { cnt = n - j - cnt; } }}
Standard input is empty
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++) ^
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!