Joao Afonso
0
Q:

increase the speed of cin and cout in c++

#include <iostream>

int main(int argc, char **argv) {

  int parity = 0;
  int x;
//you can use scanf , printf alternatively for speed
  std::ios::sync_with_stdio(false);// this increases the speed of i/o

  while (std::cin >> x)
    parity ^= x;
  std::cout << parity << std::endl;

  return 0;
}
0

New to Communities?

Join the community