Source Code
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mp make_pair
#define pb push_back
#define lp(i,s,f) for(ll i = s; i < ll(f); i++)
#define inF freopen("input.in", "r", stdin);
#define outF freopen("output.in", "w", stdout);
#define endl '\n'
#define MOD 1000000007
#define mm(arr) memset(arr, 0, sizeof(arr))
#define F first
#define S second

int main(){
    FAST
    int n, k, m;
    cin >> n >> k >> m;
    k %= 2;
    int odd = 0;
    int dif = 0;
    int crnt = 0;
    for(int i = 0; i < n; i++){
        int a, b;
        cin >> a >> b;
        dif += (a%2 != b%2);
        odd += (a%2) * (b%2);
        crnt += a%2;
    }
    crnt %= 2;
    if(dif == n){
        if(k == 1)crnt = 1 - crnt;
        if(crnt == m){
            cout << 1;
        }
        else{
            cout << 2;
        }
    }
    else{
        if(crnt == m){
            cout << 1;
        }
        else{
            cout << 2;
        }
    }
    return 0;
}
Copy
Cliffs of Dover Basilhijaz
GNU G++17
83 ms
736 KB
Wrong Answer