criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;}


vector<vector<int>> v(4444);
bool used[777];
int c[777];
int cnt1,cnt2;

bool dfs(int p, int x){
    if(used[p]){
        if(c[p]!=x) return false;
        else return true;
    }
    c[p] = x;
    used[p] = 1;
    if(x) cnt1++;
    else cnt2++;
    bool ret = true;
    for(auto i:v[p]){
        ret &= dfs(i,x^1);
    }
    return ret;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    int n,m;
    cin>>n>>m;
    bool e[n][n]={};
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        a--,b--;
        e[a][b] = 1;
        e[b][a] = 1;
    }
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            if(e[i][j] == false){
                v[i].push_back(j);
                v[j].push_back(i);
            }
        }
    }
    vector<array<int,2>> ans;
    bool pos = 1;
    for(int i=0;i<n;i++){
        if(!used[i]){
            cnt1=0,cnt2=0;
            pos &= dfs(i,0);
            ans.push_back({cnt1,cnt2});
        }
    }
    if(!pos){
        cout << -1 << endl;
        return 0;
    }
    int m = ans.size();
    bool dp[m+1][n+1][2]={};
    dp[0][0][0]=1,dp[0][0][1]=1;
    for(int i=0;i<m;i++){
        for(int j=n;j>=0;j--){
            if(j+ans[i][0]<=n) dp[i+1][j+ans[i][0]][0] |= (dp[i][j][0] | dp[i][j][1]);
            if(j+ans[i][1]<=n) dp[i+1][j+ans[i][1]][1] |= (dp[i][j][0] | dp[i][j][1]);
        }
    }
    int totori = 1e9;
    for(int i=1;i<=n;i++){
        int ret = i*(i-1)/2 + (n-i)*(n-i-1)/2;
        if(dp[m][i][0] or dp[m][i][1]) chmin(totori,ret);
    }
    cout << totori << endl;
    

}

Compiler output:
a.cc: In function 'int main()':
a.cc:65:9: error: redeclaration of 'int m'
   65 |     int m = ans.size();
      |         ^
a.cc:34:11: note: 'int m' previously declared here
   34 |     int n,m;
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)

int main(){
	fast;
	
  	cin>>N;
  	FOR(i,0,N-1) FOR(i,0,N-1) FOR(i,0,N-1) cout<<i;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:14: error: 'N' was not declared in this scope
   23 |         cin>>N;
      |              ^
Language: C++

#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <functional>
#include <iomanip>
#include <numeric>
#include <cassert>

using namespace std;
using ll = long long;

const int N = 701;

int g[N][N];
int comp[N];
int n;
int sz;
int p[N], q[N];

void dfs(int v) {
    p[sz] += comp[v] == 1;
    q[sz] += comp[v] == 2;
    for (int i = 1; i <= n; i++) {
        if (g[v][i] == 0 && v != i) {
            if (comp[i] == comp[v]) {
                cout << "-1\n";
                exit(0);
            }
            if (!comp[i]) {
                comp[i] = 3 - comp[v];
                dfs(i);
            }
        }
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int m;
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        g[a][b] = g[b][a] = 1;
    }
    for (int i = 1; i <= n; i++) {
        if (!comp[i]) {
            comp[i] = 1;
            dfs(i);
            sz++;
        }
    }
    int best = N * N;
    bitset<N> kek;
    kek.set(0);
    for (int i = 0; i < sz; i++) {
        kek = (kek << p[i]) | (kek << q[i]);
    }
    for (int i = 0; i <= n; i++) {
        if (kek[i]) {
            best = min(best, i * (i - 1) / 2 + (n - i) * (n - i - 1) / 2);
        }
    }
    cout << best << '\n';
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:61:5: error: 'bitset' was not declared in this scope
   61 |     bitset<N> kek;
      |     ^~~~~~
a.cc:13:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
   12 | #include <cassert>
  +++ |+#include <bitset>
   13 | 
a.cc:61:15: error: 'kek' was not declared in this scope
   61 |     bitset<N> kek;
      |               ^~~
Language: C++

#include <stdio.h>
#include <array>
#include <bitset>
#include <vector>
#include <tuple>

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); ++(i))
#define REP(i, n) FOR(i, 0, n)

constexpr int N = 700;
std::array<std::bitset<N>, N> E;
std::array<int, N> D;
std::bitset<N+1> P, PP;

int main(void){
    int n, m; scanf("%d%d", &n, &m);
    REP(i, n){ E[i].flip(); E[i][i] = false;}
    REP(_, m){
        int a, b; scanf("%d%d", &a, &b); a--; b--;
        E[a][b] = false; E[b][a] = false;
    }
    std::queue<int> Q;
    std::vector<std::pair<int, int>> S;
    REP(i, n) if(D[i] == 0){
        std::array<int, 2> A{0, 0};
        Q.push(i);  D[i] = 1; A[0]++;
        while(not Q.empty()){
            int v = Q.front(); Q.pop();
            int nm = (D[v] & 1) + 1;
            REP(u, n) if(E[u][v]){
                if(D[u] == 0){ D[u] = nm; Q.push(u); A[nm-1]++;}
                else if(D[u] != nm){ puts("-1"); return 0; }
            }
        }
        S.emplace_back(A[0], A[1]);
    }
    P[0] = true;
    for(auto& itr : S) PP = (P << itr.first) | (P << itr.second), std::swap(P, PP);
    int ans = 2e9;
    REP(i, n) if(P[i]){
        int p = i * (i - 1) + (n - i) * (n - i - 1); p /= 2;
        if(ans > p) ans = p;
    }
    printf("%d\n", ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:10: error: 'queue' is not a member of 'std'
   22 |     std::queue<int> Q;
      |          ^~~~~
a.cc:5:1: note: 'std::queue' is defined in header '<queue>'; this is probably fixable by adding '#include <queue>'
    4 | #include <vector>
  +++ |+#include <queue>
    5 | #include <tuple>
a.cc:22:16: error: expected primary-expression before 'int'
   22 |     std::queue<int> Q;
      |                ^~~
a.cc:26:9: error: 'Q' was not declared in this scope
   26 |         Q.push(i);  D[i] = 1; A[0]++;
      |         ^
Language: C++

// luogu-judger-enable-o2
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn = 607;
int flag=0,color[maxn],vis[maxn],n,m;
int dis[maxn][maxn];
void ranse(int v0,int last){
	int t=color[v0];
	if(t==0){
		if(last==2)color[v0]=1;
		else color[v0]=2;
	}
	for(int tt=1;tt<=n;tt++){
		int to;
		if(dis[v0][to])to=tt;
		else continue;
		if(color[to]==color[v0]){
			flag=1;return 0;
		}
		if(!vis[to]){
		    vis[to]=1;
		    ranse(to,color[v0]);
	    }
	}
	return 0;
}
int main(){
	scanf("%d%d",&n,&m);
	
	
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)
			dis[i][j]=dis[j][i]=1;

	for(int i=1;i<=m;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		dis[x][y]=dis[y][x]=0;
	}
	for(int i=1;i<=n;i++){
		if(color[i]==0)
		ranse(i,0);
	}
	if(flag)cout<<"-1";
	
}

Compiler output:
a.cc: In function 'void ranse(int, int)':
a.cc:22:39: error: return-statement with a value, in function returning 'void' [-fpermissive]
   22 |                         flag=1;return 0;
      |                                       ^
a.cc:29:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
   29 |         return 0;
      |                ^
Language: C++

// luogu-judger-enable-o2
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn = 100005;
struct node {
	int to;
	int next;
}edge[maxn];
int flag=0,color[maxn],vis[maxn],head[maxn],n,m;
void add(int from,int to,int cnt){
	edge[cnt].to=to;
	edge[cnt].next=head[from];
	head[from]=cnt;
}
void ranse(int v0,int last){
	int t=color[v0];
	if(t==0){
		if(last==2)color[v0]=1;
		else color[v0]=2;
	}
	for(int tt=1;tt<=n;tt++){
		int to;
		if(dis[v0][to])to=tt;
		else continue;
		if(color[to]==color[v0]){
			flag=1;return 0;
		}
		if(!vis[to]){
		    vis[to]=1;
		    ranse(to,color[v0]);
	    }
	}
	return 0;
}
int main(){
	scanf("%d%d",&n,&m);
	
	
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)
			dis[i][j]=dis[j][i]=1;

	for(int i=1;i<=m;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		dis[x][y]=dis[y][x]=0;
	}
	for(int i=1;i<=n;i++){
		if(color[i]==0)
		ranse(i,0);
	}
	if(flag)cout<<"-1";
	
}

Compiler output:
a.cc: In function 'void ranse(int, int)':
a.cc:27:20: error: 'dis' was not declared in this scope; did you mean 'vis'?
   27 |                 if(dis[v0][to])to=tt;
      |                    ^~~
      |                    vis
a.cc:30:39: error: return-statement with a value, in function returning 'void' [-fpermissive]
   30 |                         flag=1;return 0;
      |                                       ^
a.cc:37:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
   37 |         return 0;
      |                ^
a.cc: In function 'int main()':
a.cc:45:25: error: 'dis' was not declared in this scope; did you mean 'vis'?
   45 |                         dis[i][j]=dis[j][i]=1;
      |                         ^~~
      |                         vis
a.cc:50:17: error: 'dis' was not declared in this scope; did you mean 'vis'?
   50 |                 dis[x][y]=dis[y][x]=0;
      |                 ^~~
      |                 vis
Language: C++

#include <bits/stdc++.h>
#define MP make_pair
#define fi first
#define se second
#define sz(x) (int)(x).size()
//#define Local
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int N = 705;

int n, m;
bool lnk[N][N];
int cnt[2];
int col[N];
bool f;

void dfs(int u, int c) {
    col[u] = c;
    ++cnt[c];
    for(int v = 1; v <= n; v++) {
        if(lnk[u][v]) {
            if(col[v] == -1) dfs(v, 1 - c);
            else if(col[v] == c) {
                f = false;
                return;
            }
        }
    }
}

pii num[N];
bool dp[N][N];

void run() {
    memset(col, -1, sizeof(col));
    memset(dp, 0, sizeof(dp));
    f = true;
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= n; j++) {
            if(i != j) lnk[i][j] = 1;
        }
    for(int i = 1; i <= m; i++) {
        int u, v; cin >> u >> v;
        lnk[u][v] = lnk[v][u] = 0;
    }
    int tot = 0;
    for(int i = 1; i <= n; i++) {
        if(col[i] == -1) {
            cnt[0] = cnt[1] = 0;
            dfs(i, 0);
            num[++tot] = MP(cnt[0], cnt[1]);
        }
    }
    if(f == false) {
        cout << -1 << '\n';
        return;
    }
    dp[0][0] = 1;
    for(int i = 1; i <= tot; i++) {
        for(int j = 0; j <= n; j++) {
            if(j >= num[i].fi) dp[i][j] |= dp[i - 1][j - num[i].fi];
            if(j >= num[i].se) dp[i][j] |= dp[i - 1][j - num[i].se];
        }
        }
    }
    int ans = 1e9;
    for(int i = 0; i <= n; i++) {
        if(dp[tot][i]) {
            ans = min(ans, i * (i - 1) / 2 + (n - i) * (n - i - 1) / 2);
        }
    }
    cout << ans << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(20);
#ifdef Local
    freopen("../input.in", "r", stdin);
    freopen("../output.out", "w", stdout);
#endif
    while(cin >> n >> m) run();
    return 0;
}


Compiler output:
a.cc:68:5: error: expected unqualified-id before 'for'
   68 |     for(int i = 0; i <= n; i++) {
      |     ^~~
a.cc:68:20: error: 'i' does not name a type; did you mean 'fi'?
   68 |     for(int i = 0; i <= n; i++) {
      |                    ^
      |                    fi
a.cc:68:28: error: 'i' does not name a type; did you mean 'fi'?
   68 |     for(int i = 0; i <= n; i++) {
      |                            ^
      |                            fi
a.cc:73:5: error: 'cout' does not name a type
   73 |     cout << ans << '\n';
      |     ^~~~
a.cc:74:1: error: expected declaration before '}' token
   74 | }
      | ^
Language: C++

#include <bits/stdc++.h>
#define MP make_pair
#define fi first
#define se second
#define sz(x) (int)(x).size()
//#define Local
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int N = 705;

int n, m;
bool lnk[N][N];
int cnt[2];
int col[N];
bool f;

void dfs(int u, int c) {
    col[u] = c;
    ++cnt[c];
    for(int v = 1; v <= n; v++) {
        if(lnk[u][v]) {
            if(col[v] == -1) dfs(v, 1 - c);
            else if(col[v] == c) {
                f = false;
                return;q
            }
        }
    }
}

pii num[N];
bool dp[N];

void run() {
    memset(col, -1, sizeof(col));
    memset(dp, 0, sizeof(dp));
    f = true;
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= n; j++) {
            if(i != j) lnk[i][j] = 1;
        }
    for(int i = 1; i <= m; i++) {
        int u, v; cin >> u >> v;
        lnk[u][v] = lnk[v][u] = 0;
    }
    int tot = 0;
    for(int i = 1; i <= n; i++) {
        if(col[i] == -1) {
            cnt[0] = cnt[1] = 0;
            dfs(i, 0);
            num[++tot] = MP(cnt[0], cnt[1]);
        }
    }
    if(f == false) {
        cout << -1 << '\n';
        return;
    }
    dp[0] = 1;
    for(int i = 1; i <= tot; i++) {
        for(int j = n; j >= 0; j--) {
            if(j >= num[i].fi) dp[j] = dp[j - num[i].fi];
            if(j >= num[i].se) dp[j] = dp[j - num[i].se];
        }
    }
    int ans = 1e9;
    for(int i = 0; i <= n; i++) {
        if(dp[i]) {
            ans = min(ans, i * (i - 1) / 2 + (n - i) * (n - i - 1) / 2);
        }
    }
    cout << ans << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(20);
#ifdef Local
    freopen("../input.in", "r", stdin);
    freopen("../output.out", "w", stdout);
#endif
    while(cin >> n >> m) run();
    return 0;
}


Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:26:24: error: 'q' was not declared in this scope
   26 |                 return;q
      |                        ^
Language: C++

#include<bits/stdc++.h>
using namespace std;

int BipartiteGraph(const vector<vector<int>> &g) {
        int n = g.size();
        vector<int> color(n, -1);
        int white_cnt = 0;
        function<bool (int, int, int)> dfs = [&](int u, int prev, int c) {
                color[u] = c;
                if (c == 1) white_cnt ++;
                for (auto v : g[u]) if (v != prev) {
                        if (color[v] == -1) {
                                if (!dfs(v, u, 1 - c)) return false;
                        } else if (color[v] != 1 - c) {
                                return false;
                        }
                }
                return true;
        };
        if (!dfs(0, -1, 0)) return -1;
        return white_cnt;
}

int main(){
  

Compiler output:
a.cc: In function 'int main()':
a.cc:24:12: error: expected '}' at end of input
   24 | int main(){
      |           ~^
Language: C++

10 39
7 2
7 1
5 6
5 8
9 10
2 8
8 7
3 10
10 1
8 10
2 3
7 4
3 9
4 10
3 4
6 1
6 7
9 5
9 7
6 9
9 4
4 6
7 5
8 3
2 5
9 2
10 7
8 6
8 9
7 3
5 3
4 5
6 3
2 10
5 10
4 2
6 2
8 4
10 6

Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 10 39
      | ^~
Language: C++

#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <set>
#include <algorithm>
#include <iomanip>
#define F first
#define S second
#define PB push_back
#define PF push_front
#define MP make_pair

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef unsigned long long ull;

const int inf = 1e9 + 10;
const int maxn = 800;

int n, m, h[maxn], mat[maxn][maxn];
bool visited[maxn];

int cnt0, cnt1;
void dfs (int v) {
    visited[v] = 1;
    cnt0 += (h[v] % 2 == 0);
    cnt1 += (h[v] % 2 == 1);
    for (int u = 1; u <= n; u++) {
        if (!mat[v][u] and u != v) {
            if (!visited[u]) {
                h[u] = h[v] + 1;
                dfs (u);
            }
            if (h[u] % 2 == h[v] % 2) {
                cout << -1 << endl;
                exit (0);
            }
        }
    }
}


int main() {
    ios_base::sync_with_stdio(false);
    cin >> n >> m;
    for (int i = 1; i <= m; i++) {
        int v, u;
        cin >> v >> u;
        mat[v][u] = 1;
        mat[u][v] = 1;
    }
    bitset <1000> bs;
    bs[0] = 1;
    for (int i = 1; i <= n; i++) {
        if (!visited[i]) {
            cnt1 = 0, cnt0 = 0;
            dfs (i);
            bitset <1000> p = bs;
            p = (p << cnt1);
            bs = (bs << cnt0) | p;
        }
    }
    int ans = 1000000000;
    for (int i = 1; i < n; i++) {
        if (bs[i] == 1) {
            ans = min (ans, i * (i - 1) / 2 + (n - i) * (n - i - 1) / 2);
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:60:5: error: 'bitset' was not declared in this scope
   60 |     bitset <1000> bs;
      |     ^~~~~~
a.cc:12:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
   11 | #include <iomanip>
  +++ |+#include <bitset>
   12 | #define F first
a.cc:60:19: error: 'bs' was not declared in this scope; did you mean 'abs'?
   60 |     bitset <1000> bs;
      |                   ^~
      |                   abs
a.cc:66:27: error: 'p' was not declared in this scope
   66 |             bitset <1000> p = bs;
      |                           ^
Language: C++

#include <iostream>
#include <vector>
#define MAX_V 1000

using namespace std;
vector<int> G[MAX_V];
int m,V,color[MAX_V],sum1,sum2,c[1000],d[1000],num=0;
bool dp[1000][1000],mp[1000][1000];
bool dfs(int v, int c){
	color[v]= c;
	if(c==1){
		sum1++;
	}else{
		sum2++;
	}
	for(int i=0;i<G[v].size();i++){
		if(color[G[v][i]]==c) return false;
		if(color[G[v][i]]==0 && !dfs(G[v][i],-c)) return false;
	}
	return true;
}

bool dfs2(int i, int col) {
    if (a[i] == col) return true;
    if (a[i] != 0) return false;
    bool ok = true;
    a[i] = col;
	if(col==1){
		sum1++;
	}else{
		sum2++;
	}
    for (int u : G[i])
        ok &= dfs2(u, 3 - col);
    return ok;
}

int main(){
	cin >> V >> m;
	int i,j;
	for(i=1;i<=V;i++){
		for(j=1;j<=V;j++){
			mp[i][j] = true;
		}
	}
	for(i=0;i<m;i++){
		int a,b;
		cin >> a >> b;
		mp[a][b] = false;
		mp[b][a] = false;
	}
	
	for(i=1;i<=V;i++){
		for(j=1;j<=V;j++){
			if(mp[i][j] && i!=j){
				G[i].push_back(j);
			}
		}
	}
	
	for(i=1;i<=V;i++){
		color[i] = 0;
	}
	
	for(i=1;i<=V;i++){
		sum1 = 0; sum2 = 0;
		if(color[i]==0){
			if(!dfs2(i,1)){
				cout << -1 << endl;
				return 0;
			}
			c[num] = sum1;
			d[num] = sum2;
			num++;
		}
	}
	
	for(i=0;i<710;i++){
		for(j=0;j<710;j++){
			dp[i][j] = false;
		}
	}
	dp[0][0] = true;
	
	for(i=0;i<num;i++){
		for(j=0;j<1000;j++){
			if(dp[i][j]){
				dp[i+1][j+c[i]] = true;
				dp[i+1][j+d[i]] = true;
			}
		}
	}
	
	for(i=V/2;i>=0;i--){
		if(dp[num][i]){
			cout << V*(V-1)/2 - i*(V-i) << endl;
			return 0;
		}
	}
}
	

Compiler output:
a.cc: In function 'bool dfs2(int, int)':
a.cc:24:9: error: 'a' was not declared in this scope
   24 |     if (a[i] == col) return true;
      |         ^
a.cc:25:9: error: 'a' was not declared in this scope
   25 |     if (a[i] != 0) return false;
      |         ^
a.cc:27:5: error: 'a' was not declared in this scope
   27 |     a[i] = col;
      |     ^
Language: C++

#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <set>
#include <string>
#include <iostream>
#include <cassert>
#include <cmath>
using namespace std;

int main() {
        int n, m;
        scanf("%d%d", &n, &m);
        vector<vector<int>> g(n);
        vector<vector<bool>> forb(n, vector<bool> (n, false));
        for (int i = 0; i < m; i ++) {
                int a, b;
                scanf("%d%d", &a, &b);
                a --, b --;
                forb[a][b] = true;
                forb[b][a] = true;
        }
        for (int i = 0; i < n; i ++) {
                for (int j = i + 1; j < n; j ++) {
                        if (!forb[i][j]) {
                                g[i].push_back(j);
                                g[j].push_back(i);
                        }
                }
        }
        vector<bool> used(n);
        vector<int> color(n, -1);
        int white_cnt = 0, black_cnt = 0;
        function<bool (int, int, int)> dfs = [&](int u, int prev, int c) {
                used[u] = true;
                color[u] = c;
                if (c == 1) white_cnt ++;
                else black_cnt ++;
                for (auto v : g[u]) if (v != prev) {
                        if (color[v] == -1) {
                                if (!dfs(v, u, 1 - c)) return false;
                        } else if (color[v] != 1 - c) {
                                return false;
                        }
                }
                return true;
        };
        vector<pair<int, int>> hoge;
        for (int i = 0; i < n; i ++) {
                if (!used[i]) {
                        white_cnt = 0;
                        black_cnt = 0;
                        if (!dfs(i, -1, 0)) {
                                printf("-1\n");
                                return 0;
                        }
                        hoge.emplace_back(white_cnt, black_cnt);
                }
        }
        bitset<1000> creatable;
        creatable[0] = 1;
        for (int i = 0; i < (int) hoge.size(); i ++) {
                int a, b;
                tie(a, b) = hoge[i];
                creatable = (creatable << a) | (creatable << b);
        }
        // cerr << creatable << endl;
        int ans = 100000000;
        for (int i = 0; i < n; i ++) {
                if (creatable[i]) {
                        ans = min(ans, i * (i - 1) / 2 + (n - i) * (n - i - 1) / 2);
                }
        }
        printf("%d\n", ans);
        return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:62:9: error: 'bitset' was not declared in this scope
   62 |         bitset<1000> creatable;
      |         ^~~~~~
a.cc:11:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
   10 | #include <cmath>
  +++ |+#include <bitset>
   11 | using namespace std;
a.cc:62:22: error: 'creatable' was not declared in this scope
   62 |         bitset<1000> creatable;
      |                      ^~~~~~~~~
Language: C++


#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define int ll
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;




#define MAX_N 705

vector<vi> g(MAX_N);
bool c = true; //is bipartite graph

int used[MAX_N];
int cnt[2];

void dfs(int now){
    cnt[used[now]]++;
    rep(i,g[now].size()){
        int ne = g[now][i];
        if(used[ne] == -1){
            used[ne] = 1 - used[now];
            dfs(ne);
        }else if(used[ne] == used[now]){
            c = false;
            return;
        }
    }
}

vector<pii> p;

bool is_bipartite(int n){
    rep(i,n) used[i] = -1;
    rep(i,n)if(used[i]==-1){
        used[i] = 0;
        cnt[0] = cnt[1] = 0;
        dfs(i);
        if(c==false) return false;
        p.push_back(pii(cnt[0],cnt[1]));
    }

    return true;
}


int main(void) {
    int i,j;
    int n, m;
    cin >> n >> m;
    int d[700][700];
    rep(i,n)rep(j,n)d[i][j]=1;
    rep(i,m){
        int a,b;
        cin >> a >> b;
        a--,b--;
        d[a][b]--;
        d[b][a]--;
    }
    rep(i,n)rep(j,n)if(d[i][j]==1 && i!=j){
        g[i].push_back(j);
    }


    if(is_bipartite(n) == false){
        cout << -1 << endl;
        return 0;
    }

    int dp[705][705] = {};
    dp[0][0] = 1;
    rep(i,p.size())rep(j,705)if(dp[i][j]){
        dp[i+1][j+p[i].first]++;
        dp[i+1][j+p[i].second]++;
    }
    int ans = INF;
    rep(i,n+1)if(dp[p.size()][i]){
        ans = min(ans, i*(i-1)/2 + (n-i)*(n-i-1)/2);
    }
    cout << ans << endl;
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <bits/stdc++.h>

#define pb push_back
#define all(v) v.begin(), v.end()
#define sz(v) int(v.size())
#define pii pair<int, int>
#define mp make_pair
#define f first
#define ll long long
#define s second

using namespace std;

const int N = (int) 770 + 10;
const int K = (int) N * N;
const int mod = (int) 1e9 + 7;

int n, m, comp;
bool g[N][N], u[N];
int c[N];
int comp_id[N];
bool dp[N], gdp[N];
int cnt[2];

void dfs(int x, int clr = 0) {
	//cout << x << ' ' << clr << ' ' << comp << endl;
	u[x] = 1;
	c[x] = clr;
	cnt[clr]++;
	comp_id[x] = comp;
	for (int i = 1; i <= n; i++) {
		if (g[x][i] || i == x) 
			continue;
		if (!u[i]) {
			dfs(i, clr ^ 1);
		} else if ((clr ^ 1) != c[i]) {
			cout << -1;
			exit(0);
		}
	}
}

ll f(ll x) {
	return x * (x - 1) / 2;
}

int main() {
	#ifdef sony
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	cin >> n >> m;
	for (int i = 1, x, y; i <= n; i++) {
		cin >> x >> y;
		g[x][y] = g[y][x] = 1;
	}
	vector<pii> v;
	for (int i = 1; i <= n; i++) {
		if (!u[i]) {
			++comp;
			dfs(i);
			v.pb(mp(cnt[0], cnt[1]));
			cnt[0] = cnt[1] = 0;
		}
	}
	for (int i = 1; i <= n; i++) {
		for (int j = i + 1; j <= n; j++) {
			if (comp_id[i] != comp_id[j]) {
				assert(g[i][j] == 1);
			}
		}
	}
	dp[0] = 1;
	for (auto it : v) {
		memset(gdp, 0, sizeof(gdp));
		for (int i = n; i >= 0; i--) {
			if (i + it.f <= n) {
				gdp[i + it.f] |= dp[i];
			}
			if (j + it.s <= n) {
				gdp[j + it.s] |= dp[i];
			}
		}	
		for (int i = n; i >= 0; i--) {
			dp[i] = gdp[i];
		}
	}
	ll ans = LLONG_MAX;
	for (int i = n; i >= 0; i--) {
		if (dp[i]) {
			ans = min(ans, f(i) + f(n - i));
		}
	}
	cout << ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:80:29: error: 'j' was not declared in this scope
   80 |                         if (j + it.s <= n) {
      |                             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> P;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1y};

int N, M;
int A[110000], B[110000];
bool G[770][770];
int state[770];
vector<P> ps;
bool dp[770][770];

void dfs(int s, int st) {
    if(state[s] == st) return;
    if(state[s] != 0) {
        cout << -1 << endl;
        exit(0);
    }
    state[s] = st;
    if(st == 1) ps[ps.size()-1].first++;
    else ps[ps.size()-1].second++;
    for (int i = 1; i <= N ; i++) {
        if(!G[s][i]) dfs(i, -st);
    }
}

signed main() {
    cin >> N >> M;
    for (int i = 0; i < M; i++) {
        cin >> A[i] >> B[i];
        G[A[i]][B[i]] = true;
        G[B[i]][A[i]] = true;
    }
    for(int i = 1; i <= N; i++) {
        if(state[i] == 0) {
            ps.push_back(P(0, 0));
            dfs(i, 1);
        }
    }
    dp[0][0] = true;
    for(int i = 1; i <= ps.size(); i++) {
        for(int j = 0; j < 770; j++) {
            if(dp[i - 1][j]) {
                dp[i][j + ps[i - 1].first] = true;
                dp[i][j + ps[i - 1].second] = true;
            }
        }
    }
    int ans = LLONG_MAX;
    for(int i = 0; i < 770; i++) 
        if(dp[ps.size()][i])
            ans = min(ans, (i * (i - 1) + (N - i) * (N - i - 1)) / 2);
    }
    cout << ans << endl;
}


Compiler output:
a.cc:9:38: error: unable to find numeric literal operator 'operator""y'
    9 | int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1y};
      |                                      ^~
a.cc:59:5: error: 'cout' does not name a type
   59 |     cout << ans << endl;
      |     ^~~~
a.cc:60:1: error: expected declaration before '}' token
   60 | }
      | ^
Language: C++

#include <bits/stdc++.h>
#define SIZE 710
#define PB push_back
#define MP make_pair
#define X first
#define Y second

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;


class Node {
public:
    Node *nxt;
    int idx;

    /*
    Node() {
        this = new Node;
        this->nxt = nullptr;
        idx = 0;
    }
    */
};


class Graph {
    int N;

public:
    Node **adj;

    Graph() {
        adj = nullptr;
    }

    Graph(const int N) {
        adj = new Node*[N + 1];
        for (int i = 0 ; i <= N ; ++i) adj[i] = nullptr;
        this->N = N;
    }

    void add_edge(int u, int v) {
        Node *new_node = new Node;
        new_node->nxt = adj[u];
        new_node->idx = v;
        adj[u] = new_node;
    }

    bool get_next(Node *curr) {
        if (curr->nxt != nullptr) {
            curr = curr->nxt;
            return true;
        }
        return false;
    }

    ~Graph() {
        for (int i = 0 ; i <= N ; ++i) {
            while (adj[i] != nullptr) {
                Node *curr = adj[i];
                adj[i] = adj[i]->nxt;
                delete curr;
            }
        }
    }
};


Graph G;
int edge[SIZE][SIZE], vis[SIZE], col[SIZE];
int cnt[2];

bool dfs1(int v) {
    ++cnt[col[v]];
    for (Node *curr = G.adj[v] ; curr != nullptr ; curr = curr->nxt) {
        int t = curr->idx;
        if (col[t] == -1) {
            col[t] = col[v] ^ 1;
            if (!dfs1(t)) return false;
        }
        if (col[t] != (col[v] ^ 1)) return false;
    }
    return true;
}

vector<pii> num;

bool bipartite(int n) {
    for (int i = 1 ; i <= n ; ++i) {
        cnt[0] = cnt[1] = 0;
        if (col[i] != -1) continue;
        col[i] = 0;
        if (!dfs1(i)) return false;
        num.PB(MP(cnt[0], cnt[1]));
    }
    return true;
}

int dp[SIZE][SIZE];

int main() {
    int n, m;
    scanf("%d %d", &n, &m);
    G = Graph(n);
    for (int i = 1 ; i <= n ; ++i) for (int j = 1 ; j <= n ; ++j) edge[i][j] = 0;

    for (int i = 0 ; i < m ; ++i) {
        int u, v;
        scanf("%d %d", &u, &v);
        edge[u][v] = edge[v][u] = 1;
    }   
    for (int i = 1 ; i <= n ; ++i) {
        col[i] = -1;
        for (int j = 1 ; j <= n ; ++j) {
            if (edge[i][j] || j == i) continue;
            G.add_edge(i, j);
        }
    }

    if (!bipartite(n)) {
        printf("-1\n");
        return 0;
    }

    int sz = num.size();
    dp[0][num[0].X] = dp[0][num[0].Y] = 1;
    for (int i = 1 ; i < sz ; ++i) {
        for (int j = 0 ; j <= n ; ++j) {
            if (j >= num[i].X && dp[i - 1][j - num[i].X]) dp[i][j] = 1;
            if (j >= num[i].Y && dp[i - 1][j - num[i].Y]) dp[i][j] = 1;
        }
    }

    for (int i = n / 2 ; i <= n ; ++i) {
        if (dp[sz - 1][i]) {
            int j = n - i;
            printf("%d\n", i * (i - 1) / 2 + j * (j - 1) / 2); 
            delete G;
            return 0;
        }
    }
    

}



Compiler output:
a.cc: In function 'int main()':
a.cc:140:20: error: type 'class Graph' argument given to 'delete', expected pointer
  140 |             delete G;
      |                    ^
Language: C++

#include<stdio.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define min(p,q)((p)<(q)?(p):(q))
ll ee[800][800],a[800],cnt[800],dpcnt,dp[800];
ll cnta,cntb,n,m,base;

void f(ll i,ll c){
	a[i]=c;
	if(c==1)++cnta;else++cntb;
	rep(j,0,n){
		if(!ee[i][j]){
			if(a[j]&&a[j]==c){
				puts("-1");
				exit(0);
			}
			if(!a[j])f(j,-c);
		}
	}
}

int main(){
	scanf("%lld%lld",&n,&m);
	rep(i,0,m){
		ll p,q;
		scanf("%lld%lld",&p,&q);
		ee[p-1][q-1]=ee[q-1][p-1]=1;
	}
	rep(i,0,n)ee[i][i]=1;
	rep(i,0,n){
		if(!a[i]){
			cnta=cntb=0;
			f(i,1);
			base+=min(cnta,cntb);
			cnt[dpcnt++]=llabs(cnta-cntb);
		}
	}
	dp[base]=1;
	rep(i,0,dpcnt){
		for(ll j=800;j>=cnt[i];--j){
			dp[j]|=dp[j-cnt[i]];
		}
	}
	dp[0]=1;
	ll temp,temp2,ans,ans2;
	temp=n/2;
	while(!dp[temp])++temp;
	temp2=n-temp;
	ans=temp*(temp-1)/2+temp2*(temp2-1)/2;
	temp=n/2;
	while(!dp[temp])--temp;
	temp2=n-temp;
	ans2=temp*(temp-1)/2+temp2*(temp2-1)/2;
	printf("%lld\n",min(ans,ans2));
}

Compiler output:
a.cc: In function 'void f(long long int, long long int)':
a.cc:15:33: error: 'exit' was not declared in this scope
   15 |                                 exit(0);
      |                                 ^~~~
a.cc:2:1: note: 'exit' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
    1 | #include<stdio.h>
  +++ |+#include <cstdlib>
    2 | #define ll long long
a.cc: In function 'int main()':
a.cc:35:38: error: 'llabs' was not declared in this scope
   35 |                         cnt[dpcnt++]=llabs(cnta-cntb);
      |                                      ^~~~~
Language: C++

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <utility>
#include <climits>

using namespace std;

typedef unsigned long ulong;

vector<int> total_diffs(vector<int> diffs) {
    if (diffs.size() == 0) return {0};
    int last = diffs.back();
    diffs.pop_back();
    auto total_diffs_smaller = total_diffs(diffs);

    vector<int> total_diffs;
    for (auto total_diff : total_diffs_smaller) {
        total_diffs.emplace_back(total_diff + last);
        total_diffs.emplace_back(total_diff - last);
    }
    return total_diffs;
}

int main() {

    ulong N,M;
    cin >> N >> M;

    vector<int> colors;
    vector<vector<bool>> has_edge(M, vector<bool>(M, true)); //補グラフを考えるため最初はtrue
    int diff;
    vector<int> diffs;

    for (int v = 0; v < N; v++) {
        has_edge[v][v] = false;
    }
    for (int i = 0; i < M; i++) {
        ulong A,B;
        cin >> A >> B;
        A--;
        B--;
        has_edge[A][B] = false;
        has_edge[B][A] = false;
    }

    bool dfs(int v, int c) {
        colors[v] = c;
        diff += c;
        for (int w = 0; w < M; w++) {
            if (has_edge[v][w]) continue;
            if (colors[w] == c) return false;
            if (colors[w] == 0) {
                if (dfs(w, -c)) return false;
            }
        }
        return true;
    }

    for (int v = 1; v <= N; v++) {
        if (colors[v] == 0) {
            diff = 0;
            if (!dfs(v, 1)) {
                cout << -1;
                return -1;
            }
            diffs.emplace_back(diff);
        }
    }

    int abs_diff_min = INT_MAX;
    for (auto diff : diffs) {
        int t = abs(diff);
        if (abs_diff_min > t) abs_diff_min = t;
    }

    int bigger = (700 + abs_diff_min) / 2;
    int smaller = (700 - abs_diff_min) / 2;

    cout << (bigger * (bigger - 1) + smaller * (smaller - 1)) / 2;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:28: error: a function-definition is not allowed here before '{' token
   48 |     bool dfs(int v, int c) {
      |                            ^
a.cc:64:18: error: 'dfs' was not declared in this scope; did you mean 'diffs'?
   64 |             if (!dfs(v, 1)) {
      |                  ^~~
      |                  diffs
Language: C++

#include <bits/stdc++.h>
#define MAX 500111
#define mod 1000000007
const long long  inf = 2000000000000000000;
using namespace std;
int co[777],ca = 0,cb = 0;
bool dp[2][MAX];
bool b[777][777];
vector<int> g[777];
bool dfs(int u,bool c){
    co[u] = c;
    if(c)ca++;
    else cb++;
    bool ret = 1;
    for(auto v : g[u]){
        if(co[v] == -1) ret  &= dfs(v,1-c);
        else if(co[v] == co[u])return 0;
    }
    return ret;
}


vector<pair<int,int> > v;
int main(){ 
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); 
    int n,m,x,y;
    cin>>n>>m;
    memset(b,0,sizeof b);
    for(int i =0 ;i < m ; i++){
        cin>>x>>y;
        b[x][y] = 1;
        b[y][x] = 1;
    }
    for(int i = 1 ; i <= n ; i++){
        for(int j = i + 1; j <= n ;j++){
            if(b[i][j])continue;
            g[i].push_back(j);
            g[j].push_back(i);
        }
    }
    memset(co,-1,sizeof co);
    for(int i = 1; i <= n ;i++){
        if(co[i] == -1){
            memset(use,0,sizeof use);
            if(!dfs(i,0)){
                cout<<-1;
                return 0;
            }
            v.push_back({ca,cb});
            ca = 0;cb= 0;
        }
    }
    memset(dp,0,sizeof dp);
    dp[0][v[0].first] = 1;
    dp[0][v[0].second] = 1;
    for(int i = 1; i < v.size(); i++){
        for(int j = 0; j < MAX ; j++){
            if(dp[0][j]){
                dp[1][j + v[i].first] = 1;
                dp[1][j + v[i].second] = 1;
            }
        }
        for(int j = 0; j < MAX ;j ++)dp[0][j] = dp[1][j];
    }
    long long  ans = inf;
    for(int i = 0; i < MAX; i++)if(dp[0][i])ans = min(ans,1LL*i*(i-1)/2 + 1LL*(n-i)*(n-i-1)/2);
    cout<<ans;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:20: error: 'use' was not declared in this scope; did you mean 'pause'?
   44 |             memset(use,0,sizeof use);
      |                    ^~~
      |                    pause
Language: C++

#include <iostream>
#include <vector>
#include <queue>

using namespace std;

int main(){
	int N, M; cin >> N >> M)
		vector<vector<int>> adj(N, vector<int>(N, 0));
		for(int i=0;i<M;i++){
			int a, b; cin >> a >> b;
			--a; --b;
			adj[a][b] = adj[b][a] = 1;
		}
		vector<vector<int>> g(N);
		for(int i=0;i<N;i++){
			for(int j=i+1;j<N;j++){
				if(adj[i][j]) continue;
				g[i].push_back(j);
				g[j].push_back(i);
			}
		}
		vector<vector<int>> vc;
		vector<int> team(N, -1);
		bool valid = true;
		for(int i=0;i<N;i++){
			if(team[i] != -1) continue;
			vector<int> cnt(2, 0);
			team[i] = 0;
			++cnt[0];
			queue<int> qu; qu.push(i);
			while(!qu.empty()){
				int p = qu.front(); qu.pop();
				for(int t : g[p]){
					if(team[t] == team[p]) valid = false;
					if(team[t] != -1) continue;
					team[t] = 1 - team[p];
					cnt[team[t]]++;
					qu.push(t);
				}
			}
			if(!valid) break;
			vc.push_back(cnt);
		}
		if(!valid){
			cout << -1 << endl;
             return 0;
		}
		vector<int> dp(N+1, 0);
		dp[0] = 1;
		for(const auto& cnt : vc){
			for(int i=N;i>=0;i--){
				if(!dp[i]) continue;
				for(auto add : cnt) dp[i+add] = 1;
			}
		}
		int res = M;
		for(int i=1;i<N;i++){
			if(!dp[i]) continue;
			res = min(res, i*(i-1)/2 + (N-i)*(N-i-1)/2);
		}
		cout << res << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:32: error: expected ';' before ')' token
    8 |         int N, M; cin >> N >> M)
      |                                ^
      |                                ;
a.cc:13:25: error: 'adj' was not declared in this scope
   13 |                         adj[a][b] = adj[b][a] = 1;
      |                         ^~~
a.cc:18:36: error: 'adj' was not declared in this scope
   18 |                                 if(adj[i][j]) continue;
      |                                    ^~~
Language: C++


#include <vector>
#include <algorithm>
#include<iostream>
using namespace std;

int mat[800][800];
int n, m;

int checked[800];

pair<int, int> dfs(int u, int c)
{
    pair<int, int> ret = {1, 0};
    checked[u] = c;

    for (int i = 0; i < n; i++) {
        if (i != u && !mat[u][i]) {

            if (checked[i]) {
                if (checked[i] == c)
                    throw 0;
                else
                    continue;
            }
            
            auto res = dfs(i, 3 - c);
            ret.first += res.second;
            ret.second += res.first;
        }
    }
    return ret;
}

int dp[800][800] = {};

int main()
{
    printf(-1);
    return 0;
    ios::sync_with_stdio(false);

    cin >> n >> m;

    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        mat[a][b] = mat[b][a] = 1;
    }

    vector<pair<int, int>> v;
    try {
        for (int i = 0; i < n; i++) {
            if (checked[i])continue;
            v.push_back(dfs(i, 1));
        }
    } catch(...) {
        printf("-1\n");
        return 0;
    }


    dp[0][0] = 1;

    for (int k = 0; k < (int)v.size(); k++) {
        for (int i = 0; i <= n; i++) {
            if (dp[k][i]) {
                dp[k + 1][i + v[i].first] = dp[k + 1][i + v[i].second] = 1;
            }
        }
    }

    int best = n * n;
    for (int i = 0; i <= n; i++)
        if(dp[v.size()][i])
            best = min(best, i * (i - 1) / 2 + (n - i) * (n - i - 1) / 2);

    cout << best << '\n';

}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:12: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
   39 |     printf(-1);
      |            ^~
      |            |
      |            int
In file included from /usr/include/c++/14/cstdio:42,
                 from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:4:
/usr/include/stdio.h:363:43: note:   initializing argument 1 of 'int printf(const char*, ...)'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;

// #undef DEBUG
// #define DEBUG
/// {{{ DEBUG --- ///
template <typename T> ostream &operator<<(ostream &o, const vector<T> &v) { if(&o == &cerr) { o << '{'; for(size_t i = 0; i < v.size(); i++) o << v[i] << (i + 1 != v.size() ? ", " : ""); o << "}"; } else { for(size_t i = 0; i < v.size(); i++) o << v[i] << (i + 1 != v.size() ? " " : ""); } return o; }
#ifdef DEBUG
#ifdef USE_COUT
#define dump(...) (cout<<"["<<__LINE__<< "] "<<#__VA_ARGS__<<" = "<<make_tuple(__VA_ARGS__)<<"\n")
#else
#define dump(...) (cerr<<"["<<__LINE__<< "] "<<#__VA_ARGS__<<" = "<<make_tuple(__VA_ARGS__)<<"\n")
#endif
template<int n, class...T> typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, tuple<T...> const &){}
template<int n, class...T> typename enable_if<(n< sizeof...(T))>::type _ot(ostream & os, tuple<T...> const & t){ os << (n==0?"":", ") << get<n>(t); _ot<n+1>(os, t); }
template<class...T> ostream & operator<<(ostream &o, tuple<T...> const &t){ o << "("; _ot<0>(o, t); o << ")"; return o; }
template<class T, class U> ostream & operator<<(ostream &o, pair<T, U> const &p) { o << "(" << p.first << ", " << p.second << ")"; return o; }
#else
#define dump(...) (0)
#endif
/// }}}--- ///

#define int ll

const int N = 700;
int n, m;
int g[N][N];
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  cin >> n >> m;
  for(int i = 0; i < m; i++) {
    int a, b; cin >> a >> b;
    a--; b--;
    g[a][b] = g[b][a] = 1;
  }

  int used[N] = {};
  vector<ll> cs;
  int cols[N] = {};
  ll ac = 0;
  vector<int> ex(n);
  for(int i = 0; i < n; i++) {
    if(used[i]) continue;
    queue<int> q;q.emplace(i);

    int cnt = 0;
    int num = 0;
    while(q.size()){
      int j = q.front();
      q.pop();
      if(used[j]) continue;
      if(cols[j] == 0) cols[j] = 1, cnt++;
      num++;
      used[j] = 1;
      for(int k = 0; k < n; k++) if(g[j][k] == 0 && j != k && !used[k]) {
        q.push(k);
        if(cols[k] != 0 && cols[k] != 3 - cols[j]) return(cout << -1 << endl, 0);
        cols[k] = 3 - cols[j];
        if(cols[k] == 1) cnt++;
      }
    }
    ac += min(num - cnt, cnt);
    cs.emplace_back(max(num-cnt, cnt)-min(num-cnt,cnt));
    dump(cnt, num);
  }
  using B = bitset<360>;
  B dp;
  dp[0] = 1;
  dump(cs);
  for(int i = 0; i < cs.size(); i++) {
    dp |= dp << cs[i];
  }
  for(int i = (n+1)/2-ac; i >= 0; i--) {
    if(dp[i]) {ac+=i;break;}
  }
  cout << (ll)ac * (ac-1)/2+(ll)(n-ac)*(n-ac-1)/2<<endl;
}



Compiler output:
a.cc:24:13: error: '::main' must return 'int'
   24 | #define int ll
      |             ^~
a.cc:29:1: note: in expansion of macro 'int'
   29 | int main() {
      | ^~~
Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>

using namespace std;
struct edge
{
	int u,v;
	edge *next;
}*h[2333],pool[1111111];
int top;
inline void addedge(int u,int v)
{
//	cout<<"addedge "<<u<<' '<<v<<endl;
	edge *tmp=&pool[top++];tmp->v=v;tmp->next=h[u];h[u]=tmp;
	edge *pmt=&pool[top++];pmt->v=u;pmt->next=h[v];h[v]=pmt;
}
int n,m,x,y;
int mat[777][777];
int dp[777][777];
vector<pair<int,int> > siz;
int col[777],c[3];
bool dfs(int u)
{
	for(edge *tmp=h[u];tmp;tmp=tmp->next)
	{
		if(!col[tmp->v])
		{
			col[tmp->v]=3-col[u];
			c[col[tmp->v]]++;
			dfs(tmp->v);
		}
		else if(col[tmp->v]==col[u])return 0;
	}
	return 1;
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d",&x,&y);
		mat[x][y]=mat[y][x]=1;
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			if(mat[i][j]==0)
			{
				addedge(i,j);
			}
		}
	}
	for(int i=1;i<=n;i++)
	{
		if(!col[i])
		{
			c[1]=1;c[2]=0;
			col[i]=1;
			if(!dfs(i))return printf("-1\n"),0;
			siz.push_back(make_pair(c[1],c[2]));
		}
	}
	dp[0][0]=1;
	for(int i=0;i<siz.size();i++)
	{
		for(int j=0;j<=n;j++)
		{
			if(dp[i][j]==1)
				dp[i+1][j+siz[i].first]=1,
				dp[i+1][j+siz[i].second]=1;
		}
	}
	for(int i=n/2;i>=0;i--)
	{
		if(dp[siz.size()][i])
		{
			printf("%d\n",i*(i-1)/2+(n-i)*(n-i-1)/2);
			return 0;
		}
	}
	return 0;
}

Compiler output:
a.cc:24:1: error: 'vector' does not name a type
   24 | vector<pair<int,int> > siz;
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:65:25: error: 'siz' was not declared in this scope; did you mean 'sin'?
   65 |                         siz.push_back(make_pair(c[1],c[2]));
      |                         ^~~
      |                         sin
a.cc:69:23: error: 'siz' was not declared in this scope; did you mean 'sin'?
   69 |         for(int i=0;i<siz.size();i++)
      |                       ^~~
      |                       sin
a.cc:80:23: error: 'siz' was not declared in this scope; did you mean 'sin'?
   80 |                 if(dp[siz.size()][i])
      |                       ^~~
      |                       sin
Language: C++

#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint ungigned
#define db double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define vi vector<int>
#define vpi vector<pii >
#define IT iterator

#define PB push_back
#define MK make_pair
#define LB lower_bound
#define UB upper_bound
#define BG begin
#define ED end

#define For(i,j,k) for (int i=(j);i<=(int)k;i++)
#define Rep(i,j,k) for (int i=(j);i>=(int)k;i++)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));

#define LS3 k*2,l,mid
#define RS3 k*2+1,mid+1,r
#define LS5 k*2,l,mid,x,y
#define RS5 k*2+1,mid+1,r,x,y
#define GET pushdown(k);int mid=(l+r)/2
using namespace std;

const int N=705;
int vfa[N],fa[N],v[N];
int e[N][N],f[N*2][N*2];
int cnt[N][2],ans,n,m;
int get(int x){
	if (x==fa[x]) return fa[x];
	int tmp=fa[x]; fa[x]=get(fa[x]);
	vfa[x]=vfa[tmp]^v[x];
	return fa[x];
}
int main(){
	scanf("%d%d",&n,&m);
	memset(e,1,sizeof(e));
	For(i,1,n) e[i][i]=0;
	For(i,1,m){
		int x,y;
		scanf("%d%d",&x,&y);
		e[x][y]=e[y][x]=0;
	}
	For(i,1,n) vfa[i]=0,fa[i]=i;
	For(i,1,n) For(j,i+1,n) if (e[i][j]){
		int x=get(i),y=get(j);
		if (x!=y){
			v[x]=vfa[i]^vfa[j]^1;
			fa[x]=y;
		}
		else if (vfa[i]^vfa[j]^1)
			return puts("-1"),0;
	}
	For(i,1,n){
		int v=get(i);
		cnt[v][vfa[i]]++;
	}
	f[0][0]=1;
	For(i,1,n)a if (cnt[i][0]||cnt[i][1])
		for (int j=n;j>=0;j--)
			for (int k=n;k>=0;k--){
				f[j+cnt[i][0]][k+cnt[i][1]]|=f[j][k];
				f[j+cnt[i][1]][k+cnt[i][0]]|=f[j][k]; 
				f[j][k]=0;
			}
	For(j,0,n) For(k,0,n)
		if (f[j][k]) ans=max(ans,j*k);
	printf("%d",n*(n-1)/2-ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:66:19: error: 'a' was not declared in this scope
   66 |         For(i,1,n)a if (cnt[i][0]||cnt[i][1])
      |                   ^
a.cc:67:30: error: 'j' was not declared in this scope
   67 |                 for (int j=n;j>=0;j--)
      |                              ^
a.cc:68:38: error: 'k' was not declared in this scope
   68 |                         for (int k=n;k>=0;k--){
      |                                      ^