Check out example codes for "increase the speed of cin and cout in c++". It will help you in understanding the concepts better.

Code Example 1

#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;
}

Learn ReactJs, React Native from akashmittal.com