Source Code
#include <bits/stdc++.h>
#define quick ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned ll
#define pii pair <int,int>
#define pll pair <ll,ll>
#define INF 1000000000
#define mod 1000000007
#define size(a) ((int)(a.size()))
using namespace std;

void solv()
{
	int n,k,m;
	cin>>n>>k>>m;
	int nb1=0;
	for(int i=0,x,y;i<n;i++)
    {
        cin>>x>>y;
        if(k>0 &&  k%2==x%2 && x%2!=y%2) {swap(x,y);k=-1;}
        if(x%2) nb1++;
    }
    if(nb1%2==m) cout<<1<<endl;
    else cout<<2<<endl;

}
int main()
{
	quick
	//freopen(".in", "r", stdin);
	int T=1; //   cin>>T;
	while(T--)  solv();

	return 0;
}
Copy
Cliffs of Dover aboulkacem
GNU G++17
64 ms
708 KB
Wrong Answer