Language: C++

#include <bits/stdc++.h>
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define int long long
#define endl '\n'
#define pb push_back
#define mp make_pair
#define bash int n; cin >> n; int a[n]; for(int i = 0; i < n; i++) cin >> a[i];
#define debug(x) cout<<#x<<" "<<x<<endl;
const int mod = 1e9 + 7;
const int MAX = 2e5 + 9;
const double pi = 3.141592653589793238460;
using namespace std;

#define TRACE
#ifdef TRACE
    #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ',');
        cerr.write(names, comma - names) << " : " << arg1<<" | ";
        __f(comma+1, args...);
    }
#else
    #define trace(...)
#endif

bool is_pal (string s){
    return equal(s.begin(), s.begin() + s.size()/2, s.rbegin()) ? 1 : 0;
}

int power(int x,int y, int res = 1) {
    x %= mod; 
    for( ; y ; y >>= 1LL ) {
        if(y & 1LL){ 
            res = res * x % mod;
        }
        x = x * x % mod;
    }
    return res;
}

int modInv (int x){
    return ( power(x,mod-2) + mod ) % mod;
}

int fact[MAX], inv[MAX];

void compFact(void){
    fact[0] = fact[1] = inv[1] = inv[0] = 1;
    for (int i = 1; i < MAX; i++) { 
        fact[i] = (fact[i - 1] * i % mod + mod) % mod; 
    } 
}

void compInv(void){
    for(int i = 2; i < MAX; ++i){
        inv[i] = (mod - (mod / i) * inv[mod % i] % mod + mod) % mod;
    }
}

int nCr (int n, int r){
    if(n < r || n < 0){
        return 0;
    }
    return ( ( ( ( fact[n] % mod ) * ( inv[fact[n-r]] % mod ) ) % mod ) * ( inv[fact[r]] % mod ) + mod) % mod; 
}

int factMod(int n, int res = 1) {
    while (n > 1) {
        res = (res * ((n/mod) % 2 ?  mod-1 : 1)) % mod;
        for (int i = 2; i <= n % mod; ++i)
            res = (res * i) % mod;
        n /= mod;
    }
    return res % mod;
}

int max (int x, int y){
    return x>y ? x : y;
}

int min (int x, int y){
    return x<y ? x : y;
}

int lcm (int x, int y){
    return (x*y)/__gcd(x,y);
}

int dx[] = {-1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};

int N;

bool under_bound(int x, int y){
    return x >= 0 && y <= 0 && x < N && y < N;
}

bool prime[MAX]; 

void SieveOfEratosthenes(int n){
     
    memset(prime, true, sizeof(prime)); 
    for (int p=2; p*p < n; p++){ 
        if (prime[p] == true){ 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
         } 
    }  
}

multiset<int> A;

void primeFact(int n){
    while (n % 2 == 0)  {  
        A.insert(2); 
        n = n/2;  
    }  
    for (int i = 3; i <= sqrt(n); i = i + 2)  {  
        while (n % i == 0)  {  
            A.insert(i); 
            n = n/i;  
        }  
    }  
  
    if (n > 2)  
        A.insert(n);  
}

int spf[MAX];

void SieveOfEuler(){ 
    spf[1] = 1; 
    
    for (int i=2; i < MAX; i++) 
    spf[i] = i; 
  
    for (int i=4; i < MAX; i+=2) 
        spf[i] = 2; 
  
    for (int i=3; i*i < MAX; i++){ 
        if (spf[i] == i){ 
            for (int j = i*i; j < MAX; j += i) 
                  if (spf[j]==j) 
                    spf[j] = i; 
        } 
    } 
}

map < pair<int, int>, int > factFreq;

void getFactorization(int x) {
    while(x > 1){
        int pt = spf[x], f = 0;
        while (x % pt == 0){
            x /= pt;
            f++;
            factFreq[{pt,f}]++;
        }
    }
}

int ans ;

void solve(void){
	int n ;
	cin >> n ;
	int a[n];
	for(int i = 0; i < n; i++){
		cin >> a[i] ;
		if(a[i] % 2 + (i + 1) % 2 == 2){
			ans++;
		}
	}
	cout << ans ;
}
signed main() {
fio;
int t = 1;
// cin >> t;    
	while(t--)
    solve();

    return 0;
}
#include <bits/stdc++.h>
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define int long long
#define endl '\n'
#define pb push_back
#define mp make_pair
#define bash int n; cin >> n; int a[n]; for(int i = 0; i < n; i++) cin >> a[i];
#define debug(x) cout<<#x<<" "<<x<<endl;
const int mod = 1e9 + 7;
const int MAX = 2e5 + 9;
const double pi = 3.141592653589793238460;
using namespace std;

#define TRACE
#ifdef TRACE
    #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ',');
        cerr.write(names, comma - names) << " : " << arg1<<" | ";
        __f(comma+1, args...);
    }
#else
    #define trace(...)
#endif

bool is_pal (string s){
    return equal(s.begin(), s.begin() + s.size()/2, s.rbegin()) ? 1 : 0;
}

int power(int x,int y, int res = 1) {
    x %= mod; 
    for( ; y ; y >>= 1LL ) {
        if(y & 1LL){ 
            res = res * x % mod;
        }
        x = x * x % mod;
    }
    return res;
}

int modInv (int x){
    return ( power(x,mod-2) + mod ) % mod;
}

int fact[MAX], inv[MAX];

void compFact(void){
    fact[0] = fact[1] = inv[1] = inv[0] = 1;
    for (int i = 1; i < MAX; i++) { 
        fact[i] = (fact[i - 1] * i % mod + mod) % mod; 
    } 
}

void compInv(void){
    for(int i = 2; i < MAX; ++i){
        inv[i] = (mod - (mod / i) * inv[mod % i] % mod + mod) % mod;
    }
}

int nCr (int n, int r){
    if(n < r || n < 0){
        return 0;
    }
    return ( ( ( ( fact[n] % mod ) * ( inv[fact[n-r]] % mod ) ) % mod ) * ( inv[fact[r]] % mod ) + mod) % mod; 
}

int factMod(int n, int res = 1) {
    while (n > 1) {
        res = (res * ((n/mod) % 2 ?  mod-1 : 1)) % mod;
        for (int i = 2; i <= n % mod; ++i)
            res = (res * i) % mod;
        n /= mod;
    }
    return res % mod;
}

int max (int x, int y){
    return x>y ? x : y;
}

int min (int x, int y){
    return x<y ? x : y;
}

int lcm (int x, int y){
    return (x*y)/__gcd(x,y);
}

int dx[] = {-1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};

int N;

bool under_bound(int x, int y){
    return x >= 0 && y <= 0 && x < N && y < N;
}

bool prime[MAX]; 

void SieveOfEratosthenes(int n){
     
    memset(prime, true, sizeof(prime)); 
    for (int p=2; p*p < n; p++){ 
        if (prime[p] == true){ 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
         } 
    }  
}

multiset<int> A;

void primeFact(int n){
    while (n % 2 == 0)  {  
        A.insert(2); 
        n = n/2;  
    }  
    for (int i = 3; i <= sqrt(n); i = i + 2)  {  
        while (n % i == 0)  {  
            A.insert(i); 
            n = n/i;  
        }  
    }  
  
    if (n > 2)  
        A.insert(n);  
}

int spf[MAX];

void SieveOfEuler(){ 
    spf[1] = 1; 
    
    for (int i=2; i < MAX; i++) 
    spf[i] = i; 
  
    for (int i=4; i < MAX; i+=2) 
        spf[i] = 2; 
  
    for (int i=3; i*i < MAX; i++){ 
        if (spf[i] == i){ 
            for (int j = i*i; j < MAX; j += i) 
                  if (spf[j]==j) 
                    spf[j] = i; 
        } 
    } 
}

map < pair<int, int>, int > factFreq;

void getFactorization(int x) {
    while(x > 1){
        int pt = spf[x], f = 0;
        while (x % pt == 0){
            x /= pt;
            f++;
            factFreq[{pt,f}]++;
        }
    }
}

int ans ;

void solve(void){
	int n ;
	cin >> n ;
	int a[n];
	for(int i = 0; i < n; i++){
		cin >> a[i] ;
		if(a[i] % 2 + (i + 1) % 2 == 2){
			ans++;
		}
	}
	cout << ans ;
}
signed main() {
fio;
int t = 1;
// cin >> t;    
	while(t--)
    solve();

    return 0;
}


Compiler output:
a.cc:198:11: error: redefinition of 'const long long int mod'
  198 | const int mod = 1e9 + 7;
      |           ^~~
a.cc:9:11: note: 'const long long int mod' previously defined here
    9 | const int mod = 1e9 + 7;
      |           ^~~
a.cc:199:11: error: redefinition of 'const long long int MAX'
  199 | const int MAX = 2e5 + 9;
      |           ^~~
a.cc:10:11: note: 'const long long int MAX' previously defined here
   10 | const int MAX = 2e5 + 9;
      |           ^~~
a.cc:200:14: error: redefinition of 'const double pi'
  200 | const double pi = 3.141592653589793238460;
      |              ^~
a.cc:11:14: note: 'const double pi' previously defined here
   11 | const double pi = 3.141592653589793238460;
      |              ^~
a.cc:207:10: error: redefinition of 'template<class Arg1> void __f(const char*, Arg1&&)'
  207 |     void __f(const char* name, Arg1&& arg1){
      |          ^~~
a.cc:18:10: note: 'template<class Arg1> void __f(const char*, Arg1&&)' previously declared here
   18 |     void __f(const char* name, Arg1&& arg1){
      |          ^~~
a.cc:211:10: error: redefinition of 'template<class Arg1, class ... Args> void __f(const char*, Arg1&&, Args&& ...)'
  211 |     void __f(const char* names, Arg1&& arg1, Args&&... args){
      |          ^~~
a.cc:22:10: note: 'template<class Arg1, class ... Args> void __f(const char*, Arg1&&, Args&& ...)' previously declared here
   22 |     void __f(const char* names, Arg1&& arg1, Args&&... args){
      |          ^~~
a.cc:220:6: error: redefinition of 'bool is_pal(std::string)'
  220 | bool is_pal (string s){
      |      ^~~~~~
a.cc:31:6: note: 'bool is_pal(std::string)' previously defined here
   31 | bool is_pal (string s){
      |      ^~~~~~
a.cc:224:5: error: redefinition of 'long long int power(long long int, long long int, long long int)'
  224 | int power(int x,int y, int res = 1) {
      |     ^~~~~
a.cc:35:5: note: 'long long int power(long long int, long long int, long long int)' previously defined here
   35 | int power(int x,int y, int res = 1) {
      |     ^~~~~
a.cc:235:5: error: redefinition of 'long long int modInv(long long int)'
  235 | int modInv (int x){
      |     ^~~~~~
a.cc:46:5: note: 'long long int modInv(long long int)' previously defined here
   46 | int modInv (int x){
      |     ^~~~~~
a.cc:239:5: error: redefinition of 'long long int fact [200009]'
  239 | int fact[MAX], inv[MAX];
      |     ^~~~
a.cc:50:5: note: 'long long int fact [200009]' previously declared here
   50 | int fact[MAX], inv[MAX];
      |     ^~~~
a.cc:239:16: error: redefinition of 'long long int inv [200009]'
  239 | int fact[MAX], inv[MAX];
      |                ^~~
a.cc:50:16: note: 'long long int inv [200009]' previously declared here
   50 | int fact[MAX], inv[MAX];
      |                ^~~
a.cc:241:6: error: redefinition of 'void compFact()'
  241 | void compFact(void){
      |      ^~~~~~~~
a.cc:52:6: note: 'void compFact()' previously defined here
   52 | void compFact(void){
      |      ^~~~~~~~
a.cc:248:6: error: redefinition of 'void compInv()'
  248 | void compInv(void){
      |      ^~~~~~~
a.cc:59:6: note: 'void compInv()' previously defined here
   59 | void compInv(void){
      |      ^~~~~~~
a.cc:254:5: error: redefinition of 'long long int nCr(long long int, long long int)'
  254 | int nCr (int n, int r){
      |     ^~~
a.cc:65:5: note: 'long long int nCr(long long int, long long int)' previously defined here
   65 | int nCr (int n, int r){
      |     ^~~
a.cc:261:5: error: redefinition of 'long long int factMod(long long int, long long int)'
  261 | int factMod(int n, int res = 1) {
      |     ^~~~~~~
a.cc:72:5: note: 'long long int factMod(long long int, long long int)' previously defined here
   72 | int factMod(int n, int res = 1) {
      |     ^~~~~~~
a.cc:271:5: error: redefinition of 'long long int max(long long int, long long int)'
  271 | int max (int x, int y){
      |     ^~~
a.cc:82:5: note: 'long long int max(long long int, long long int)' previously defined here
   82 | int max (int x, int y){
      |     ^~~
a.cc:275:5: error: redefinition of 'long long int min(long long int, long long int)'
  275 | int min (int x, int y){
      |     ^~~
a.cc:86:5: note: 'long long int min(long long int, long long int)' previously defined here
   86 | int min (int x, int y){
      |     ^~~
a.cc:279:5: error: redefinition of 'long long int lcm(long long int, long long int)'
  279 | int lcm (int x, int y){
      |     ^~~
a.cc:90:5: note: 'long long int lcm(long long int, long long int)' previously defined here
   90 | int lcm (int x, int y){
      |     ^~~
a.cc:283:5: error: redefinition of 'long long int dx []'
  283 | int dx[] = {-1, 0, 1, 0};
      |     ^~
a.cc:94:5: note: 'long long int dx [4]' previously defined here
   94 | int dx[] = {-1, 0, 1, 0};
      |     ^~
a.cc:284:5: error: redefinition of 'long long int dy []'
  284 | int dy[] = {0, 1, 0, -1};
      |     ^~
a.cc:95:5: note: 'long long int dy [4]' previously defined here
   95 | int dy[] = {0, 1, 0, -1};
      |     ^~
a.cc:286:5: error: redefinition of 'long long int N'
  286 | int N;
      |     ^
a.cc:97:5: note: 'long long int N' previously declared here
   97 | int N;
      |     ^
a.cc:288:6: error: redefinition of 'bool under_bound(long long int, long long int)'
  288 | bool under_bound(int x, int y){
      |      ^~~~~~~~~~~
a.cc:99:6: note: 'bool under_bound(long long int, long long int)' previously defined here
   99 | bool under_bound(int x, int y){
      |      ^~~~~~~~~~~
a.cc:292:6: error: redefinition of 'bool prime [200009]'
  292 | bool prime[MAX];
      |      ^~~~~
a.cc:103:6: note: 'bool prime [200009]' previously declared here
  103 | bool prime[MAX];
      |      ^~~~~
a.cc:294:6: error: redefinition of 'void SieveOfEratosthenes(long long int)'
  294 | void SieveOfEratosthenes(int n){
      |      ^~~~~~~~~~~~~~~~~~~
a.cc:105:6: note: 'void SieveOfEratosthenes(long long int)' previously defined here
  105 | void SieveOfEratosthenes(int n){
      |      ^~~~~~~~~~~~~~~~~~~
a.cc:305:15: error: redefinition of 'std::multiset<long long int> A'
  305 | multiset<int> A;
      |               ^
a.cc:116:15: note: 'std::multiset<long long int> A' previously declared here
  116 | multiset<int> A;
      |               ^
a.cc:307:6: error: redefinition of 'void primeFact(long long int)'
  307 | void primeFact(int n){
      |      ^~~~~~~~~
a.cc:118:6: note: 'void primeFact(long long int)' previously defined here
  118 | void primeFact(int n){
      |      ^~~~~~~~~
a.cc:323:5: error: redefinition of 'long long int spf [200009]'
  323 | int spf[MAX];
      |     ^~~
a.cc:134:5: note: 'long long int spf [200009]' previously declared here
  134 | int spf[MAX];
      |     ^~~
a.cc:325:6: error: redefinition of 'void SieveOfEuler()'
  325 | void SieveOfEuler(){
      |      ^~~~~~~~~~~~
a.cc:136:6: note: 'void SieveOfEuler()' previously defined here
  136 | void SieveOfEuler(){
      |      ^~~~~~~~~~~~
a.cc:343:29: error: redefinition of 'std::map<std::pair<long long int, long long int>, long long int> factFreq'
  343 | map < pair<int, int>, int > factFreq;
      |                             ^~~~~~~~
a.cc:154:29: note: 'std::map<std::pair<long long int, long long int>, long long int> factFreq' previously declared here
  154 | map < pair<int, int>, int > factFreq;
      |                             ^~~~~~~~
a.cc:345:6: error: redefinition of 'void getFactorization(long long int)'
  345 | void getFactorization(int x) {
      |      ^~~~~~~~~~~~~~~~
a.cc:156:6: note: 'void getFactorization(long long int)' previously defined here
  156 | void getFactorization(int x) {
      |      ^~~~~~~~~~~~~~~~
a.cc:356:5: error: redefinition of 'long long int ans'
  356 | int ans ;
      |     ^~~
a.cc:167:5: note: 'long long int ans' previously declared here
  167 | int ans ;
      |     ^~~
a.cc:358:6: error: redefinition of 'void solve()'
  358 | void solve(void){
      |      ^~~~~
a.cc:169:6: note: 'void solve()' previously defined here
  169 | void solve(void){
      |      ^~~~~
a.cc:370:8: error: redefinition of 'int main()'
  370 | signed main() {
      |        ^~~~
a.cc:181:8: note: 'int main()' previously defined here
  181 | signed main() {
      |        ^~~~