This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
 
#define ll long long int
#define pb push_back
#define ui unsigned int
#define ld long double
#define pl pair<long long int, long long int>
#define boost ios_base::sync_with_stdio(NULL);cin.tie(0);cout.tie(0);
#define ff first
#define ss second
 
using namespace std;
 
const ll maxn = 1e6 + 101;
// const ll inf = 1e17 + 9;
// const ll mod = 1e9 + 7;
// const double eps = 1e-10;
// const ll num = 4294967295;
 
ll p[maxn];
 
void solve()
{
    ll n, k;
 
    cin >> n >> k;
 
    ll ans = n * n / 2, ans2 = n * n / 2;
    for(ll i = 1; i <= k; i++){
        ll x1, y1, x2, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        if((x1 % 2) + (y1 % 2) == 1){
            ans--;
            ans2++;
        }
        else{
            ans2--;
            ans++;
        }
    }
    cout << min(ans, ans2);
}
 
int main()
{
    boost;
 
    ll tt = 1;
 
    //cin >> tt;
 
    for(ll i = 1; i <= tt; i++)
    {
        //cout << "Case " << i << ":\n";
        solve();
    }
}  
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |