Source Code
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n,k,m;
    cin>>n>>k>>m;

    ll sum=0;
    int difs=0,same=0;

    for(int i=0;i<n;i++){
        int x,y;
        cin>>x>>y;
        difs+=x%2!=y%2;
        same+=x%2==y%2;
        sum+=x;
    }

    if(!difs||!same){
        if(m==sum%2) cout<<1;
        else cout<<2;
    } else {
        cout<<2;
    }
}
Copy
Cliffs of Dover YazanIstatiyeh
GNU G++17
147 ms
292 KB
Wrong Answer