/** @BY_KUTBILIM **/
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).end()
#define int long long
const int inf = (int)1e9+7;
int main(){
ios_base::sync_with_stdio(false);
cin.tie();
int n, k;
cin >> n >> k;
if(k == 0){
int ans = n * n;
for(int i = 1; i <= n / 2; i++){
if(n % i != 0)continue;
int cur = 0;
for(int I = 0; I < n; I += i){
for(int J = ((I / i) % 2 ? i : 0); J < n; J += i*2){
cur += (i * i);
}
}
ans = min({ans, cur, n * n - cur});
}
cout << ans;
} else{
int x1, y1, x2, y2;
int cnt[2];
cnt[0] = cnt[1] = 0;
for(int i = 0; i < k; i++){
cin >> x1 >> y1 >> x2 >> y2;
cnt[(x1 + y1) % 2]++;
}
cout << min((n * 1ll * n) / 2 - cnt[0] + cnt[1], (n * 1ll * n) / 2 - cnt[1] + cnt[0]);
}
return 0;
}
Compilation message
cc1plus: error: '::main' must return 'int'