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

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

vector<int> G[100010];
int color[100010];
int V,E;
int B = 0, W = 0;

// 頂点を 1 と -1 で塗る深さ優先探索で二部グラフか判定する
bool dfs(int v, int c) {
  // 頂点 v を c で塗る
  color[v] = c;
  ++B;
  for(int i = 0; i < G[v].size(); ++i){
    // G[v][i] は隣接頂点で，隣接頂点が同じ色で塗られていたら二部グラフでない
    if(color[G[v][i]] == c) return false;
    // 隣接頂点がまだ塗られておらず，そこを -c で塗ると塗り切れないなら二部グラフでない
    if(color[G[v][i]] == 0 && !dfs(G[v][i], -c)) return false;
  }
  // 塗りきれたら二部グラフ
  return true;
}

// 頂点 i を 1 で塗り始めて二部グラフか判断する
bool bp(){
  for (int i = 0; i < V; ++i){
    // 頂点 i が塗られていなければ 1 で塗り始め，結果を見守る
    if (color[i] == 0){
      if (!dfs(i, 1)) {
        return false;
      }
    }
  }
  return true;
}

int main(){
  cin >> V >> E;
  for(int i = 0; i < E; ++i){
    int s, t;
    cin >> s >> t;
    G[s].push_back(t);
    G[t].push_back(s);
  }
  if(bp){
    // 二部グラフである
    W = V - B
    cout << B*W - E << endl;
  }else{
    // 二部グラフでない
    cout << V*(V - 1) / 2 - E << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:14: error: expected ';' before 'cout'
   47 |     W = V - B
      |              ^
      |              ;
   48 |     cout << B*W - E << endl;
      |     ~~~~
Language: C++

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

vector<int> G[100010];
int color[100010];
int B = 0, W = 0;

// 頂点を 1 と -1 で塗る深さ優先探索で二部グラフか判定する
bool dfs(int v, int c) {
  // 頂点 v を c で塗る
  color[v] = c;
  ++B;
  for(int i = 0; i < G[v].size(); ++i){
    // G[v][i] は隣接頂点で，隣接頂点が同じ色で塗られていたら二部グラフでない
    if(color[G[v][i]] == c) return false;
    // 隣接頂点がまだ塗られておらず，そこを -c で塗ると塗り切れないなら二部グラフでない
    if(color[G[v][i]] == 0 && !dfs(G[v][i], -c)) return false;
  }
  // 塗りきれたら二部グラフ
  return true;
}

// 頂点 i を 1 で塗り始めて二部グラフか判断する
bool bp(){
  for (int i = 0; i < V; ++i){
    // 頂点 i が塗られていなければ 1 で塗り始め，結果を見守る
    if (color[i] == 0){
      if (!dfs(i, 1)) {
        return false;
      }
    }
  }
  return true;
}

int main(){
  int V, E;
  cin >> V >> E;
  for(int i = 0; i < E; ++i){
    int s, t;
    cin >> s >> t;
    G[s].push_back(t);
    G[t].push_back(s);
  }
  if(bp){
    // 二部グラフである
    W = V - B
    cout << B*W - E << endl;
  }else{
    // 二部グラフでない
    cout << V*(V - 1) / 2 - E << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'bool bp()':
a.cc:25:23: error: 'V' was not declared in this scope
   25 |   for (int i = 0; i < V; ++i){
      |                       ^
a.cc: In function 'int main()':
a.cc:47:14: error: expected ';' before 'cout'
   47 |     W = V - B
      |              ^
      |              ;
   48 |     cout << B*W - E << endl;
      |     ~~~~
Language: C++

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

int color[100010];
int B = 0, W = 0;

// 頂点を 1 と -1 で塗る深さ優先探索で二部グラフか判定する
bool dfs(int v, int c) {
  // 頂点 v を c で塗る
  color[v] = c;
  ++B;
  for(int i = 0; i < G[v].size(); ++i){
    // G[v][i] は隣接頂点で，隣接頂点が同じ色で塗られていたら二部グラフでない
    if(color[G[v][i]] == c) return false;
    // 隣接頂点がまだ塗られておらず，そこを -c で塗ると塗り切れないなら二部グラフでない
    if(color[G[v][i]] == 0 && !dfs(G[v][i], -c)) return false;
  }
  // 塗りきれたら二部グラフ
  return true;
}

// 頂点 i を 1 で塗り始めて二部グラフか判断する
bool bp(){
  for (int i = 0; i < V; ++i){
    // 頂点 i が塗られていなければ 1 で塗り始め，結果を見守る
    if (color[i] == 0){
      if (!dfs(i, 1)) {
        return false;
      }
    }
  }
  return true;
}

int main(){
  int V, E;
  cin >> V >> E;
  vector<int> G[MAX_V];
  for(int i = 0; i < E; ++i){
    int s, t;
    cin >> s >> t;
    G[s].push_back(t);
    G[t].push_back(s);
  }
  if(bp){
    // 二部グラフである
    W = V - B
    cout << B*W - E << endl;
  }else{
    // 二部グラフでない
    cout << V*(V - 1) / 2 - E << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'bool dfs(int, int)':
a.cc:12:22: error: 'G' was not declared in this scope
   12 |   for(int i = 0; i < G[v].size(); ++i){
      |                      ^
a.cc: In function 'bool bp()':
a.cc:24:23: error: 'V' was not declared in this scope
   24 |   for (int i = 0; i < V; ++i){
      |                       ^
a.cc: In function 'int main()':
a.cc:38:17: error: 'MAX_V' was not declared in this scope
   38 |   vector<int> G[MAX_V];
      |                 ^~~~~
a.cc:42:5: error: 'G' was not declared in this scope
   42 |     G[s].push_back(t);
      |     ^
a.cc:47:14: error: expected ';' before 'cout'
   47 |     W = V - B
      |              ^
      |              ;
   48 |     cout << B*W - E << endl;
      |     ~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int MAX_V = 100010;

int color[MAX_V];
int B = 0, W = 0;

// 頂点を 1 と -1 で塗る深さ優先探索で二部グラフか判定する
bool dfs(int v, int c) {
  // 頂点 v を c で塗る
  color[v] = c;
  ++B;
  for(int i = 0; i < G[v].size(); ++i){
    // G[v][i] は隣接頂点で，隣接頂点が同じ色で塗られていたら二部グラフでない
    if(color[G[v][i]] == c) return false;
    // 隣接頂点がまだ塗られておらず，そこを -c で塗ると塗り切れないなら二部グラフでない
    if(color[G[v][i]] == 0 && !dfs(G[v][i], -c)) return false;
  }
  // 塗りきれたら二部グラフ
  return true;
}

// 頂点 i を 1 で塗り始めて二部グラフか判断する
bool bp(){
  for (int i = 0; i < V; ++i){
    // 頂点 i が塗られていなければ 1 で塗り始め，結果を見守る
    if (color[i] == 0){
      if (!dfs(i, 1)) {
        return false;
      }
    }
  }
  return true;
}

int main(){
  int V, E;
  cin >> V >> E;
  vector<int> G[MAX_V];
  for(int i = 0; i < E; ++i){
    int s, t;
    cin >> s >> t;
    G[s].push_back(t);
    G[t].push_back(s);
  }
  if(bp){
    // 二部グラフである
    W = V - B
    cout << B*W - E << endl;
  }else{
    // 二部グラフでない
    cout << V*(V - 1) / 2 - E << endl;
  }
  return 0;
}

Compiler output:
a.cc:5:11: error: size of array 'color' is not an integral constant-expression
    5 | int color[MAX_V];
      |           ^~~~~
a.cc: In function 'bool dfs(int, int)':
a.cc:13:22: error: 'G' was not declared in this scope
   13 |   for(int i = 0; i < G[v].size(); ++i){
      |                      ^
a.cc: In function 'bool bp()':
a.cc:25:23: error: 'V' was not declared in this scope
   25 |   for (int i = 0; i < V; ++i){
      |                       ^
a.cc: In function 'int main()':
a.cc:48:14: error: expected ';' before 'cout'
   48 |     W = V - B
      |              ^
      |              ;
   49 |     cout << B*W - E << endl;
      |     ~~~~
Language: C++

#include "bits/stdc++.h"

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
const int INF = numeric_limits<int>::max() / 2;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n, m; cin >> n >> m;
	vector<int> dist(n, -1);
	vector<vector<int> > tree(n);
	for (int i = 0; i < m; i++) {
		int a, b; cin >> a >> b;
		a--; b--;
		tree[a].push_back(b);
		tree[b].push_back(a);
	}
	dist[0] = 0;
	queue<int> q;
	bool flag = false;
	q.push(0);//点、距離
	while (!q.empty()) {
		int v = q.front(); q.pop();
		//for (int i = 0; i < (int)tree[v].size(); i++) {
		for( auto u : tree[v]){
			int next = tree[v][i];
			if (dist[next] == -1) {
				dist[next] = 1-dist[v];
				q.push(next);
			}
			else if(dist[next]==1-dist[v]){
				continue;
			}
			else {
				flag = true;
				break;
			}
		}
	}
	int cnt=0;
	for (int i = 0; i < n; i++) {
		cnt += dist[i];
	}
	if (flag) cout << n*(n - 1) / 2 - m << endl;
	else cout << cnt*(n-cnt) - m << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:44: error: 'i' was not declared in this scope
   30 |                         int next = tree[v][i];
      |                                            ^
Language: C++

//無理でした
#include <cstdio>
#include <iostream>

typedef long long int ll;


int main(){
  int N;
  int M;
  cin >> N >> M;
  int A[M], B[M];
  ll V[N][N];
  // list<int> Nv[N];
  ll D[N][N];
  //initialize
  for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++){
      V[i][j] = 0;
      D[i][j] = 0;
    }
  }
  //input  
  for(int i = 0; i < M; i++){
    cin >> A[i] >> B[i];
    A[i]--;B[i]--;
    V[A[i]][B[i]] = 1;
    V[B[i]][A[i]] = 1;
    D[A[i]][B[i]] = 1;
    D[B[i]][A[i]] = 1;
  }
  int count=0;
  int temp=-1;
  while(1){
    if(count == temp) break;
    else temp = count;
    //times
    ll C[N][N];
    for (int i = 0; i < N; i++){
      for (int j = 0; j < N; j++){
        C[i][j] = 0;
        for (int t = 0; t < N; t++){
          C[i][j] += V[i][t] * D[t][j];
        }
        if(C[i][j] != 0) C[i][j]=1;
      }
    }
    for(int i = 0; i < N; i++){
      for(int j = 0; j < N; j++){
        V[i][j] = C[i][j];
      }
    }
    //times
    for (int i = 0; i < N; i++){
      for (int j = 0; j < N; j++){
        C[i][j] = 0;
        for (int t = 0; t < N; t++){
          C[i][j] += V[i][t] * D[t][j];
          if(C[i][j] != 0) C[i][j]=1;
        }
      }
    }
    for(int i = 0; i < N; i++){
      for(int j = 0; j < N; j++){
        V[i][j] = C[i][j];
      }
    }
    //count
    count = 0;
    for(int i = 0; i < N; i++){
      for(int j = i; j < N; j++){
        if(V[i][j] != 0) count++;
      }
    }
  }


  
  //output
  for(int i = 0; i < M; i++){
    V[A[i]][B[i]] = 0;
    V[B[i]][A[i]] = 0;
  }
  for(int i = 0; i < N; i++){
    V[i][i] = 0;
  }

  //final
  count=0;
  for(int i = 0; i < N; i++){
    for(int j = i; j < N; j++){
      if(V[i][j] != 0) count++;
    }
  }
  cout << count << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   11 |   cin >> N >> M;
      |   ^~~
      |   std::cin
In file included from a.cc:3:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:95:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   95 |   cout << count << endl;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:95:20: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   95 |   cout << count << endl;
      |                    ^~~~
      |                    std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

const int MAX_N = 1000000;
const int INFTY = (1 << 21); // 2097152
// const ll INFTY = (1LL << 60);
const ll MD = 1000000007LL;
// fprintf(stderr, "%d %lld \n", x, xll);


int N, M;

class Edge{
public:
    int from, to, cost;
    Edge(int from = 0, int to = 0, int cost = 0) :
            from(from), to(to), cost(cost){}

    bool operator < (const Edge &e) const{
        return cost < e.cost;
    }
    bool operator >(const Edge &e) const{
        return cost > e.cost;
    }

};

class Node{
public:
    vector<Edge> edges;
    int sign;
    Node(){
        sign = 0;
    }
};

class Graph{
public:
    vector<Node> nodes;
    Graph(int n) {
        rep(i, n) { Node n;  nodes.push_back(n); }
    }
    Node& operator[](int i){
        return nodes[i];
    }
};

class Data{
public:
    int from, to, sign;
    Data(int from, int to, int sign) {
        this-> from = from;
        this-> to   = to;
        this-> sign = sign;
    }
};

Graph G(0);

bool bfs(){

    queue<Data> q;
    q.push(Data(-1, 0, 1));

    rep(i, N) G[i].sign = 0;

    bool flg = false;

    ll NN = 0;

    while(!q.empty()){
        Data &d = q.front(); q.pop();
        fprintf(stderr, "%d->%d %d\n", d.from, d.to, d.sign);
        Node &n = G[d.to];
        n.sign = d.sign;

        for(auto &ee : n.edges){
            NN++;
            if(NN > 1000000) G[10000000]++;

            int s = d.sign * -1;
            Node &nn = G[ee.to];
            if(nn.sign != 0 && nn.sign != s){
                flg = true;
                continue;
            }
            if(nn.sign != 0 && nn.sign == s) {
                continue;
            }
            if(nn.sign == 0){
                nn.sign = s;
                q.push(Data(ee.from, ee.to, s));
            }
        }
    }

    cerr  << NN << endl;
    return flg;
}

int main() {

    // input
	cin >> N >> M;
    G = Graph(N);

	rep(i, M){
		int a, b;
        cin >> a >> b; a--; b--;
        G[a].edges.push_back(Edge(a, b, 0));
        G[b].edges.push_back(Edge(b, a, 0));
	}

    // run
    bool extra = bfs();

    if(extra){
        ll all = (ll)(N) * (ll)(N-1) / 2LL;
        ll ret = all - M;
        cout << ret << endl;
    }
    else{
        ll countP = 0;
        ll countM = 0;
        rep(i, N){
            if(G[i].sign == 1) countP++;
            if(G[i].sign == -1) countM++;
        }

        ll all = countP * countM;
        ll ret = all - M;
        cout << ret << endl;
    }

}

Compiler output:
a.cc: In function 'bool bfs()':
a.cc:98:41: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
   98 |             if(NN > 1000000) G[10000000]++;
Language: C++

#include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<

typedef long long llint;

const int MAX = 100100;

vector<int> E[MAX];
int d[MAX];

void dfs(int x) {
  for (int y: E[x]) {
    if (d[y] == 0) {
      d[y] = d[x] + 1;
      dfs(y);
    }
  }
}

int main(void) {
  int N, M;
  scanf("%d %d", &N, &M);
  REP(i, M) {
    int a, b;
    scanf("%d %d", &a, &b); --a, --b;
    E[a].push_back(b);
    E[b].push_back(a);
  }

  d[0] = 1;
  dfs(0);

  int cnt1 = 0;
  REP(i, N) {
    if (d[i]%2) cnt1++;
  }

  bool odd_cycle = false;
  REP(x, N) for (int y: E[x]) {
    if ((d[x] + d[y]) % 2 == 0) {
      odd_cycle = true;
    }
  }

  llint total = 0;
  if (odd_cycle) {
    total = N * 1LL * (N - 1) / 2;
  } else {
    total = cnt1 * 1LL * (N - cnt1);
  }

  total -= M;
  printf("%lld\n", total);
  return 0;
}


Compiler output:
a.cc:17:1: error: 'vector' does not name a type
   17 | vector<int> E[MAX];
      | ^~~~~~
a.cc: In function 'void dfs(int)':
a.cc:21:15: error: 'E' was not declared in this scope
   21 |   for (int y: E[x]) {
      |               ^
a.cc: In function 'int main()':
a.cc:35:5: error: 'E' was not declared in this scope
   35 |     E[a].push_back(b);
      |     ^
a.cc:48:25: error: 'E' was not declared in this scope
   48 |   REP(x, N) for (int y: E[x]) {
      |                         ^
Language: C++

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

long long n, m;
vector<int> G[101010];
bool f[101010][2];

void dfs(int v = 1, int d = 0) {
  if (f[v][d]) return;
  f[v][d] = true;

  for (auto to : G[v]) {
    dfs(to, (d + 1) & 1);
  }
}

int main() {
  cin >> n >> m;

  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  dfs();

  int r[101010][2] = {};
  for (int i = 1; i <= n; ++i) {
    if (f[i][1]) r[i][1]++;
    if (f[i][0]) r[i][0]++;
  }

  for (int i; i <= n; ++i) {
    r[i][1] += r[i - 1][1];
    r[i][0] += r[i - 1][0];
  }

  long long cnt = 0;
  for (int i = 1; i < n; ++i) {
    if (f[i][1]) {
      cnt += r[n][1] - r[i][1]
    }
  }

  // long long ans = n * cnt / 2 - m;
  long long ans = cnt - m;
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:31: error: expected ';' before '}' token
   43 |       cnt += r[n][1] - r[i][1]
      |                               ^
      |                               ;
   44 |     }
      |     ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
#define int long long
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }

using ll = long long;
const ll mod = LLONG_MAX;
int n,M;
struct edge{
  int to;
  int cost;
  edge(int to,int cost){
    this->to = to;
    this->cost = cost;
  }
};
vector<edge> G[100010];
int d[100010];

signed main(){
  cin>>n>>M;
  rep(i,M){
    int a,b;
    cin>>a>>b;
    a--;b--;
    G[a].push_back(edge(b,1));
    G[b].push_back(edge(a,1));
  }
  bool flag=true;

  int pn=n/3;
  if(m>=n)flag=false;
  if(flag){
    int ans=0;
    if (n%3==0)ans++;
    ans+=(pn+1)*pn/2 ;
    ans+=n-1;
    cout<<ans - M<<endl;
  }else{
    cout<<((n-1)*n)/2 - M<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:6: error: 'm' was not declared in this scope
   40 |   if(m>=n)flag=false;
      |      ^
Language: C++

#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
const int INF = 1e8;
using namespace std;

const int MAX_V = 100005;


vector<int> g[MAX_V];
int dis[MAX_V];

void bfs(int s, int n){
	queue<int> q;

	rep(i,n) dis[i] = INF;
	dis[s] = 0;
	q.push(s);

	int u;
	while(not q.empty()){
		u = q.front(); q.pop();
		rep(i,g[u].size()){
			int e = g[u][i];
			if(dis[e] == INF){
				dis[e] = dis[u] + 1;
				q.push(e);
			}
		}
	}
}

int solve(int n){
	int maxi = 0;
	int tgt = 0; //?????????s?????????????????????

	bfs(0, n);
	rep(i,n){
		if(dis[i] == INF) continue;
		if(maxi < dis[i]){
			maxi  = dis[i];
			tgt = i;
		}
	}

	bfs(tgt, n);
	maxi = 0; //tgt????????????????????\???????????¢maxi
	int p;
	rep(i,n){
		if(dis[i] == INF) continue;
		if(maxi < dis[i]){
			p = i;
				maxi = max(maxi, dis[i]);
		}
	}

	return maxi;
}


int main(){
	long long n, m;
	cin >> n >> m;


	rep(i,m){
		int a, b;
		cin >> a >> b;
		a--; b--;
		g[a].emplace_back(b);
		g[b].emplace_back(a);
	}

	if(n - m == 1){
		//int p = solve(n);
		//show(p)
		if(n % 2 == 0){
			cout << n / 2 + n - m << endl;
		}else{
			cout << n / 2 + 1 + n - m << endl;
		}
	}else{
		assert(false)
		cout << n * (n - 1) / 2 - m << endl;
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:86:17: error: expected ';' before 'cout'
   86 |                 cout << n * (n - 1) / 2 - m << endl;
      |                 ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
#define int long long
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }

using ll = long long;
const ll mod = LLONG_MAX;
int n,M;
struct edge{
  int to;
  int cost;
  edge(int to,int cost){
    this->to = to;
    this->cost = cost;
  }
};
vector<edge> G[100010];
int d[100010];

signed main(){
  cin>>n>>M;
  rep(i,M){
    int a,b;
    cin>>a>>b;
    a--;b--;
    G[a].push_back(edge(b,1));
    G[b].push_back(edge(a,1));
  }
  bool flag=true;

  int pn=n/3;

  if(flag){
    int ans=0;
    if (n%3==0)ans++;
    ans+=(pn+1)*pn/2 ;
    ans+=n-1;
    cout<<ans - M<<endl;
  }else{
    cout<<((n-1)*n)/2 - M<<endl;
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:49:4: error: expected '}' at end of input
   49 |   }
      |    ^
a.cc:28:14: note: to match this '{'
   28 | signed main(){
      |              ^
Language: C++

#include<bits/stdc++.h>
#define maxn 100010
#define pb push_back
using namespace std;
vector<int> G[maxn];
LL d[maxn],a[maxn],b[maxn],n,m, p, q;
bool vis[maxn];
void dfs(int x,int fa){
	int now;
	d[x] = (d[fa] + 1) % 2;
	vis[x] = true;
	for(int i = 0; i < G[x].size(); i ++){
		now = G[x][i];
		if(!vis[now]){
			dfs(now,x);
		}
	}
}
int main(){
	cin >> n >> m;
	if(n <= 3){
		cout << 0;
		return 0;
	}
	for(int i = 1; i <= m; i ++){
		cin >> a[i] >> b[i];
		G[a[i]].pb(b[i]);
		G[b[i]].pb(a[i]);
	}
	dfs(1,0);
	bool flag = true;
	for(int i = 1; i <= n; i ++){
		//cout << d[i] << endl;
		if(d[i] == 0) p ++;
		else q ++;
	}
	for(int i = 1; i <= m; i ++){
		if(d[a[i]] == d[b[i]]){
			flag = false;
			break;
		}
	}
	if(!flag){
		cout << (LL)n * (n - 1) / 2 - m;
	}
	else{
		cout << (LL)p * q - m;
	}
	return 0;
}

Compiler output:
a.cc:6:1: error: 'LL' does not name a type
    6 | LL d[maxn],a[maxn],b[maxn],n,m, p, q;
      | ^~
a.cc: In function 'void dfs(int, int)':
a.cc:10:9: error: 'd' was not declared in this scope
   10 |         d[x] = (d[fa] + 1) % 2;
      |         ^
a.cc: In function 'int main()':
a.cc:20:16: error: 'n' was not declared in this scope; did you mean 'yn'?
   20 |         cin >> n >> m;
      |                ^
      |                yn
a.cc:20:21: error: 'm' was not declared in this scope; did you mean 'tm'?
   20 |         cin >> n >> m;
      |                     ^
      |                     tm
a.cc:26:24: error: 'a' was not declared in this scope
   26 |                 cin >> a[i] >> b[i];
      |                        ^
a.cc:26:32: error: 'b' was not declared in this scope
   26 |                 cin >> a[i] >> b[i];
      |                                ^
a.cc:34:20: error: 'd' was not declared in this scope
   34 |                 if(d[i] == 0) p ++;
      |                    ^
a.cc:34:31: error: 'p' was not declared in this scope
   34 |                 if(d[i] == 0) p ++;
      |                               ^
a.cc:35:22: error: 'q' was not declared in this scope
   35 |                 else q ++;
      |                      ^
a.cc:38:20: error: 'd' was not declared in this scope
   38 |                 if(d[a[i]] == d[b[i]]){
      |                    ^
a.cc:38:22: error: 'a' was not declared in this scope
   38 |                 if(d[a[i]] == d[b[i]]){
      |                      ^
a.cc:38:33: error: 'b' was not declared in this scope
   38 |                 if(d[a[i]] == d[b[i]]){
      |                                 ^
a.cc:44:26: error: 'LL' was not declared in this scope
   44 |                 cout << (LL)n * (n - 1) / 2 - m;
      |                          ^~
a.cc:47:26: error: 'LL' was not declared in this scope
   47 |                 cout << (LL)p * q - m;
      |                          ^~
Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;

const int MAXN=1e5+5,MAXM=1e7+5;
int n,m,ans,s;
int he[MAXN],vis[MAXN];
bool cannt[MAXN],vis[MAXN],flag;
struct line{int to,nex;}ed[MAXM<<1];

void addE(int u,int v)
{
	static int cnt=0;
	ed[++cnt]=(line){v,he[u]};
	he[u]=cnt;
}

void DFS(int u,int c)
{
	for(int i=he[u],v;i;i=ed[i].nex)
	{
		v=ed[i].to;
		if(!vis[v]) vis[v]=c,DFS(v,c^1);
		else
			if(vis[v]!=vis[u]) continue;
			else flag=true;
	}
}

int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1,u,v;i<=m;++i)
	{
		scanf("%d%d",&u,&v);
		addE(u,v),addE(v,u);
	}
	vis[1]=1;
	DFS(1,0);
	if(flag) 
		printf("%lld",(long long)n*(n-1)/2-m);
	else
	{
		long long cnt=0;
		for(int i=1;i<=n;++i)
			if(vis[i]) ++cnt;
		printf("%lld",(long long)cnt*(n-cnt)-m);
	}
	return 0;
}

Compiler output:
a.cc:11:18: error: conflicting declaration 'bool vis [100005]'
   11 | bool cannt[MAXN],vis[MAXN],flag;
      |                  ^~~
a.cc:10:14: note: previous declaration as 'int vis [100005]'
   10 | int he[MAXN],vis[MAXN];
      |              ^~~
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#define a(i) v[i].A
#define b(i) v[i].B
using namespace std;

class line {
public:
	int A;
	int B;
};

int main() {
	int N, M;
	int ans = 0;
	int i;
	int *many;
	cin >> N >> M;
	many = new int[N];
	for (i = 0; i < N; i++)many[i] = 0;
	vector<line> v;
	v.resize(M);
	for (i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		v[i].A = --a;
		v[i].B = --b;
		many[a]++;
		many[b]++;
	}
	for (i = 0; i < v.size(); i++) {
		if (v[i].A > 1 && v[i].B > 1) {
			for (int j = 0; j < v.size(); j++) {
				if (a(i) == a(j) && b(i) != b(j)) {
					for (int k = 0; k < v.size(); k++) {
						if (b(i) == b(k) && a(i) != a(k)) {
							v.push_back({ a(j),b(k) });
							many[a(j)]++;
							many[b(k)]++;
							ans++;
						}
					}
				}
				else if (a(i) == b(j) && b(i) != a(j)) {
					for (int k = 0; k < v.size(); k++) {
						if (a(i) == a(k) && b(i) != b(k)) {
							v.push_back({ b(j),a(k) });
							many[b(j)]++;
							many[a(k)]++;
							ans++;
						}
					}
					for (int j = 0; j < v.size(); j++) {
						if (b(i) == b(j) && a(i) != a(j)) {
							for (int k = 0; k < v.size(); k++) {
								if (a(i) == a(k) && b(i) != b(k)) {
									v.push_back({ b(j),a(k) });
									many[b(j)]++;
									many[a(k)]++;
									ans++;
								}
							}
						}
						else if (b(i) == a(j) && a(i) != b(j)) {
							for (int k = 0; k < v.size(); k++) {
								if (b(i) == b(k) && a(i) != a(k)) {
									v.push_back({ a(j),b(k) });
									many[a(j)]++;
									many[b(k)]++;
									ans++;
								}
							}
						}
					}
				}
			}
			cout << ans << endl;
			return 0;
		}

Compiler output:
a.cc: In function 'int main()':
a.cc:80:18: error: expected '}' at end of input
   80 |                 }
      |                  ^
a.cc:32:40: note: to match this '{'
   32 |         for (i = 0; i < v.size(); i++) {
      |                                        ^
a.cc:80:18: error: expected '}' at end of input
   80 |                 }
      |                  ^
a.cc:14:12: note: to match this '{'
   14 | int main() {
      |            ^
Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}

ll N,M;
map<ll,vector<ll> > G;
ll num[100010];
vector<ll> three;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> N >> M;  
  rep(i,M){
    ll a,b;
    cin >> a >> b;
    G[a].pb(b);
    G[b].pb(a);
    num[a]++;
    num[b]++;
    if(num[a]>=3)three.pb(a);
    if(num[b]>=3)three.pb(b);
  }

  rmsame(three);
  bool flag = false;

  rep(i,three.size()){
    ll check = three[i];
    rep(j,G[check].size()){
      ll a = G[check][j];
      if(G[a].size()>=2){
	flag = true;
      }
    }
  }

  if(M>=N){//三角存在する//できる
    cout << (N*(N-1)/2)-M << endl;
    return 0;
  }
  ll ans;
  rep(i,1e9){
    rep(j,1e9){
      rep(k,ie9)
	ans +=(i*j*k);
    }
  }
  
  if(three.size()==1) {
    cout << "0" << endl;
    return 0;
  }
  
  ll minu = 0;
  ll odd = N/2, even = N/2;
  if(N%2) odd++;

  minu = (odd*(odd-1)/2)+(even*(even-1)/2);
  cout << "final" << endl;
  cout << (N*(N-1)/2)-minu-M << endl;
  //cout << fixed << setprecision(16) << ans << endl;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:67:13: error: 'ie9' was not declared in this scope
   67 |       rep(k,ie9)
      |             ^~~
a.cc:16:41: note: in definition of macro 'FOR'
   16 | #define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
      |                                         ^
a.cc:67:7: note: in expansion of macro 'rep'
   67 |       rep(k,ie9)
      |       ^~~
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#define a(i) v[i].A
#define b(i) v[i].B
using namespace std;

class line {
public:
	int A;
	int B;
};

int main() {
	int N, M;
	int ans = 0;
	int i;
	int *many;
	cin >> N >> M;
	many = new int[N];
	for (i = 0; i < N; i++)many[i] = 0;
	vector<line> v;
	v.resize(M);
	for (i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		v[i].A = --a;
		v[i].B = --b;
		many[a]++;
		many[b]++;
	}
	for (i = 0; i < v.size(); i++) {
		if (v[i].A > 1 && v[i].B > 1) {
			for (int j = 0; j < v.size(); j++) {
				if (a(i) == a(j) && b(i) != b(j)) {
					for (int k = 0; k < v.size; k++) {
						if (b(i) == b(k) && a(i) != a(k)) {
							v.push_back({ a(j),b(k) });
							many[a(j)]++;
							many[b(k)]++;
							ans++;
						}
					}
				}
				else if (b(i) == b(j) && a(i) != a(j)) {
					for (int k = 0; k < v.size; k++) {
						if (a(i) == a(k) && b(i) != b(k)) {
							v.push_back({ b(j),a(k) });
							many[b(j)]++;
							many[a(k)]++;
							ans++;
						}
					}
				}
			}
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:63: error: invalid use of member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = line; _Alloc = std::allocator<line>; size_type = long unsigned int]' (did you forget the '()' ?)
   36 |                                         for (int k = 0; k < v.size; k++) {
      |                                                             ~~^~~~
      |                                                                   ()
a.cc:46:63: error: invalid use of member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = line; _Alloc = std::allocator<line>; size_type = long unsigned int]' (did you forget the '()' ?)
   46 |                                         for (int k = 0; k < v.size; k++) {
      |                                                             ~~^~~~
      |                                                                   ()
Language: Java

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
	public static void main(String[] args){
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String str = in.readLine();
        
        int n = Integer.parseInt(str.split(" ")[0]);
        
        int m = Integer.parseInt(str.split(" ")[1]);
		// 出力
		System.out.println(n*(n-3)/2+n-m);
	}
}

Compiler output:
Main.java:7: error: unreported exception IOException; must be caught or declared to be thrown
        String str = in.readLine();
                                ^
1 error
Language: C++

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

long long n, m;
vector<vector<int>> G;
bool f[101010][2];

void dfs(int v = 0, long long d = 0) {
  if (f[v][d & 1]) return;
  f[v][d & 1] = true;

  for (auto to : G[v]) {
    if (to != p) {
      dfs(to, d + 1);
    }
  }
}

int main() {
  cin >> n >> m;
  G.resize(n);

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

  dfs();

  long long cnt = 0;
  for (int i = 1; i < n; ++i) {
    cnt += f[i][1];
  }

  long long ans = n * cnt / 2 - m;
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'void dfs(int, long long int)':
a.cc:13:15: error: 'p' was not declared in this scope
   13 |     if (to != p) {
      |               ^
Language: C++

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

#define MOD 1000000007
#define ll long long int
#define vi vector<int>
#define vii vector< vector<int> >
#define PI 3.1415926535897932384626433832795
#define INF 9223372036854775807LL

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m;
	cin >> n >> m;
	vii graph(n+1,vector<int>);
	for(int i = 0; i < n; i++) {
		int u,v;
		cin >> u >> v;
		graph[u].push_back(v);
		graph[v].push_back(u);
	}
	if(n <= m) {
		ll ans = n;
		ans*= (n-1);
		ans/= 2;
		ans-= m;
		cout << ans;
	} else {
		bool didsth = true;
		int added = 0;

		cout << added;
	}
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:16:34: error: expected primary-expression before ')' token
   16 |         vii graph(n+1,vector<int>);
      |                                  ^
Language: C++

逆から見る理由はよくわかってない
O(N)だとしてもDPの可能性をもっと追うべきだった

Compiler output:
a.cc:1:1: error: '\U00009006\U0000304b\U00003089\U0000898b\U0000308b\U00007406\U00007531\U0000306f\U00003088\U0000304f\U0000308f\U0000304b\U00003063\U00003066\U0000306a\U00003044' does not name a type
    1 | 逆から見る理由はよくわかってない
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

// luogu-judger-enable-o2
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
using namespace std;
int main(){
    int n,ans=0;
    cin>>n;
    string a;
    cin>>a;
    for(int k=0;k<=log10(n));k++){
    for(int i=0;i<n-2;i++){
    	if(a[i]=='1'&&a[i+1]=='0'&&a[i+2]=='1'){
    		 ans++;
    		 int j=i+3;
    		 while(a[j]=='1'){
    		 	ans++;
    		 	j++;
    		 }
    		 for(int l=i;l<=j;l++)
    		 a[l]='0';
    		 a[j-2]='1';
    		 i=j;
    	}
    }
	}
    cout<<ans<<endl;
    cout<<a;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:28: error: expected ';' before ')' token
   12 |     for(int k=0;k<=log10(n));k++){
      |                            ^
      |                            ;
a.cc:12:30: error: 'k' was not declared in this scope
   12 |     for(int k=0;k<=log10(n));k++){
      |                              ^
Language: C++

// luogu-judger-enable-o2
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
using namespace std;
int main(){
    int n,ans=0;
    cin>>n;
    string a;
    cin>>a;
    for(int k=1;k<=n;k++){
    for(int i=0;i<n-2;i++){
    	if(a[i]=='1'&&a[i+1]=='0'&&a[i+2]=='1'){
    		 ans++;
    		 int j=i+3;
    		 while(a[j]=='1'){
    		 	ans++;
    		 	j++;
    		 }
    		 for(int l=i;l<=j;l++)
    		 a[l]=0;
    		 a[l-2]=1;
    		 i=j;
    	}
    }
    }
    cout<<ans;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:20: error: 'l' was not declared in this scope
   23 |                  a[l-2]=1;
      |                    ^
Language: C++

#include<stdio.h>
#include<iostream>
#include<string.h>
#include<string>
#include<ctype.h>
#include<math.h>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<bitset>
#include<algorithm>
#include<time.h>
using namespace std;
void fre() { freopen("c://test//input.in", "r", stdin); freopen("c://test//output.out", "w", stdout); }
#define MS(x, y) memset(x, y, sizeof(x))
#define ls o<<1
#define rs o<<1|1
typedef long long LL;
typedef unsigned long long UL;
typedef unsigned int UI;
template <class T1, class T2>inline void gmax(T1 &a, T2 b) { if (b > a)a = b; }
template <class T1, class T2>inline void gmin(T1 &a, T2 b) { if (b < a)a = b; }
const int N = 0, M = 0, Z = 1e9 + 7, inf = 0x3f3f3f3f;
template <class T1, class T2>inline void gadd(T1 &a, T2 b) { a = (a + b) % Z; }
int casenum, casei;
int main()
{
	while(~scanf("%d", &n))
    {
        scanf("%s", s);
        int ans = 0;
        for(int i = 0; i < n - 2; ++i)
        {
            if(s[i] == '1' && s[i + 1] == '0' && s[i + 2] == '1')
            {
                s[i] = '0'; s[i + 1] = '1'; s[i + 2] = '0';
            }
            ++ans;
        }
        printf("%d\n", ans);
    }
	return 0;
}
/*
【trick&&吐槽】


【题意】


【分析】


【时间复杂度&&优化】


【数据】


*/


Compiler output:
a.cc: In function 'int main()':
a.cc:29:29: error: 'n' was not declared in this scope
   29 |         while(~scanf("%d", &n))
      |                             ^
a.cc:31:21: error: 's' was not declared in this scope
   31 |         scanf("%s", s);
      |                     ^
Language: C++

#include<iostream>
using namespace std;
char a[500002];
char b[500002];
int main()
{
	int s,ss,sss,n,i,j,k,x,y;
	cin >>n;
	for (i=0;i<n+2;i++)
	{
		b[i]='0';
		a[i]='0';
	}
	for (i=0;i<n;i++)
	{
		cin >>a[i];
		b[i]=a[i];
	}
	x=0;
	y=0;
	sss=0;
	/*a[500001]='0';
	a[500000]='0';
	b[500001]='0';
	b[500000]='0';*/
	for(i=0;i<n+1;i++)
	{
		if (a[i]=='0'and a[i+1]=='0')
		{
			ss=0;
			s=0;
			for (j=x;j<i;j++)
			{
				if (a[j]=='1')
					s++;
				else
					if (a[j-1]!='0')
					{
						ss+=s;
						a[j+1]='0';
						s=0;
					}
			}
			int ss1=0;
			s=0;
			for (j=i-1;j>=x;j--)
			{
				if (b[j]=='1')
					s++;
				else
					if (b[j+1]!='0')
					{
						ss1+=s;
						b[j-1]='0';
						s=0;
					}
			}
			sss+=max(ss,ss1);
			x=i+2;
		}
	}
	cout <<sss<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:27: error: unable to find character literal operator 'operator""and' with 'char' argument
   28 |                 if (a[i]=='0'and a[i+1]=='0')
      |                           ^~~~~~
a.cc:28:33: error: expected ')' before 'a'
   28 |                 if (a[i]=='0'and a[i+1]=='0')
      |                    ~            ^~
      |                                 )
Language: C++

#include<iostream>
#include<cstring>
using namespace std;
int nearest[500005];
int dp[500005];
int main()
{
	int n;
	cin>>n;
	string s;
	cin>>s;
	for(int i=0;i<n;i++)
	{
		if(s[i]=='1')
			nearest[i]=nearest[i-1];
		
		else
			nearest[i]=i;
	}
	for(int i=0;i<n;i++) 
	{
		dp[i]=dp[i-1];
		if(s[i]=='1') 
		{
			if(s[i-2]=='1'&&s[i-1]=='0')
				dp[i]=max(dp[i],dp[nearest[i-2]]+i-2-nearest[i-2]);
				dp[i]=max(dp[i],dp[nearest[i-2]+1]+i-2-nearest[i-1]-1);
			}
			if(s[nearest[i]-1]=='1')
			{
				dp[i]=max(dp[i],dp[nearest[i]-2]+i-nearest[i]);
			}
		}		 
	}
	cout<<dp[n-1];
	return 0;
}

Compiler output:
a.cc:35:9: error: 'cout' does not name a type
   35 |         cout<<dp[n-1];
      |         ^~~~
a.cc:36:9: error: expected unqualified-id before 'return'
   36 |         return 0;
      |         ^~~~~~
a.cc:37:1: error: expected declaration before '}' token
   37 | }
      | ^
Language: C++

SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我
SWUN_JY就是我

Compiler output:
a.cc:1:1: error: 'SWUN_JY\U00005c31\U0000662f\U00006211' does not name a type
    1 | SWUN_JY就是我
      | ^~~~~~~~~~~~~
Language: C++

我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY
我是SWUN_JY

Compiler output:
a.cc:1:1: error: '\U00006211\U0000662fSWUN_JY' does not name a type
    1 | 我是SWUN_JY
      | ^~~~~~~~~~~
Language: C++

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

int main(){
  int n, pos = 0;
  string s;
  vector<string> vs;
  std::cin >> n >> s;
  while(s[pos] == '0')pos++;
  s = s.substr(pos);
  for (int i = 0; s.length() != 0; i++) {
    while(i < s.length() - 1 and not(s[i] == '0' and s[i + 1] == '0'))i++;
    if(i < s.length() - 1)vs.push_back(s.substr(0, i));
    else vs.push_back(s);
    while(i < s.length() - 1 and not(s[i] == '0' and s[i + 1] == '1'))i++;
    if(i == s.length()) s = "";
    else s = s.substr(i + 1);
    i = 0;
  }
  int ans = 0;
  vector<int> len(n, 0);
  for (int i = 0; i < vs.size(); i++) {
    int l = 0, size = 0;
    for (int j = 0; j < vs[i].size(); j++) {
      if(j < vs[i].size() and vs[i][j] == '1')l++;
      else if(j < vs[i].size() and vs[i][j] == '0')len[size++] = l, l = 0;
    }
    if(l != 0)len[size++] = l;
    vector<vector<int> > dp(3, vector<int>(size(), 0));
    //0:LEFT, 1:RIGHT, 2:NOT UASD
    for (int j = 0; j < size() - 1; j++) {
      for (int k = 0; k < 3; k++) {
        dp[2][j + 1] = max(dp[2][j + 1], dp[k][j]);
      }
      dp[0][j + 1] = max(dp[0][j + 1], dp[2][j] + len[j]);
      dp[1][j + 1] = max(dp[1][j + 1], dp[2][j] + len[j + 1]);
      
      //L -> L
      dp[0][j + 1] = max(dp[0][j + 1], dp[0][j] + len[j] - 1);
      //L -> R
      if(len[j] > 1)dp[1][j + 1] = max(dp[1][j + 1], dp[0][j] + len[j + 1]);
      //R -> R
      dp[1][j + 1] = max(dp[1][j + 1], dp[1][j] + len[j + 1] - 1);
    }
    ans += max(dp[0][size - 1], max(dp[1][size - 1], dp[2][size - 1]));
  }
  std::cout << ans << std::endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:48: error: 'size' cannot be used as a function
   31 |     vector<vector<int> > dp(3, vector<int>(size(), 0));
      |                                            ~~~~^~
a.cc:33:29: error: 'size' cannot be used as a function
   33 |     for (int j = 0; j < size() - 1; j++) {
      |                         ~~~~^~
Language: C++

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

int main(){
  int n, pos = 0;
  string s;
  vector<string> vs;
  std::cin >> n >> s;
  while(s[pos] == '0')pos++;
  s = s.substr(pos);
  for (int i = 0; s.length() != 0; i++) {
    while(i < s.length() - 1 and not(s[i] == '0' and s[i + 1] == '0'))i++;
    if(i < s.length() - 1)vs.push_back(s.substr(0, i));
    else vs.push_back(s);
    while(i < s.length() - 1 and not(s[i] == '0' and s[i + 1] == '1'))i++;
    if(i == s.length()) s = "";
    else s = s.substr(i + 1);
    i = 0;
  }
  int ans = 0;
  vector<int> len(n, 0);
  for (int i = 0; i < vs.size(); i++) {
    int l = 0, size = 0;
    for (int j = 0; j < vs[i].size(); j++) {
      if(j < vs[i].size() and vs[i][j] == '1')l++;
      else if(j < vs[i].size() and vs[i][j] == '0')len[size++] = l, l = 0;
    }
    if(l != 0)len[size++] = l
    vector<vector<int> > dp(3, vector<int>(size(), 0));
    //0:LEFT, 1:RIGHT, 2:NOT UASD
    for (int j = 0; j < size() - 1; j++) {
      for (int k = 0; k < 3; k++) {
        dp[2][j + 1] = max(dp[2][j + 1], dp[k][j]);
      }
      dp[0][j + 1] = max(dp[0][j + 1], dp[2][j] + len[j]);
      dp[1][j + 1] = max(dp[1][j + 1], dp[2][j] + len[j + 1]);
      
      //L -> L
      dp[0][j + 1] = max(dp[0][j + 1], dp[0][j] + len[j] - 1);
      //L -> R
      if(len[j] > 1)dp[1][j + 1] = max(dp[1][j + 1], dp[0][j] + len[j + 1]);
      //R -> R
      dp[1][j + 1] = max(dp[1][j + 1], dp[1][j] + len[j + 1] - 1);
    }
    ans += max(dp[0][size - 1], max(dp[1][size - 1], dp[2][size - 1]));
  }
  std::cout << ans << std::endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:30: error: expected ';' before 'vector'
   30 |     if(l != 0)len[size++] = l
      |                              ^
      |                              ;
   31 |     vector<vector<int> > dp(3, vector<int>(size(), 0));
      |     ~~~~~~                    
a.cc:33:29: error: 'size' cannot be used as a function
   33 |     for (int j = 0; j < size() - 1; j++) {
      |                         ~~~~^~
a.cc:35:9: error: 'dp' was not declared in this scope
   35 |         dp[2][j + 1] = max(dp[2][j + 1], dp[k][j]);
      |         ^~
a.cc:37:7: error: 'dp' was not declared in this scope
   37 |       dp[0][j + 1] = max(dp[0][j + 1], dp[2][j] + len[j]);
      |       ^~
a.cc:47:16: error: 'dp' was not declared in this scope
   47 |     ans += max(dp[0][size - 1], max(dp[1][size - 1], dp[2][size - 1]));
      |                ^~
Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<map>
using namespace std;
#define REP(i,st,ed) for(int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(int i=st,i##end=ed;i>=i##end;--i)
template<typename T>bool chkmax(T &x,const T &y){return x<y?x=y,1:0;}
int read(){
	int x=0,f=1;
	char c=getchar();
	while((c<'0')||(c>'9')){if(c=='-')f=-1;c=getchar();}
	while((c>='0')&&(c<='9'))x=(x<<1)+(x<<3)+(c^48),c=getchar();
	return x*f;
}
const int maxn=500005;
int n;
char a[maxn];
int c[maxn],dp[maxn][4];
int main(){
	scanf("%d%s",&n,a+1);
	if(n<=2){puts("0");return 0;}
	int cur=1,ans=0;
	while(a[cur]=='0')++cur;
	for(int i=cur;i<=n;i=cur+1){
		while((a[cur+1]=='1')||(a[cur+2]=='1'))++cur;
		int cnt=1;
		REP(j,i,cur){
			if(a[j]=='0')++cnt;
			else ++c[cnt];
		}
		while(a[cur+1]=='0')++cur;
		REP(j,1,cnt+1)
			REP(k,0,3)
				dp[j][k]=-1e9;
		dp[1][0]=0;
		REP(j,2,cnt+1){
			chkmax(dp[j][0],max(max(dp[j-1][0],dp[j-1][1]),max(dp[j-1][2],dp[j-1][3])));
			if(c[j]>1){
				chkmax(dp[j][1],max(max(dp[j-1][0]+c[j-1],dp[j-1][1]+c[j-1]-1),max(dp[j-1][2]+1,dp[j-1][3])));
				chkmax(dp[j][2],max(max(dp[j-1][0]+max(c[j]-1,c[j-1]),dp[j-1][1]+max(c[j-1]-1,c[j]-1)),max(dp[j-1][2]+c[j]-1,dp[j-1][3])));
			}
			chkmax(dp[j][3],max(max(dp[j-1][0]+max(c[j-1],c[j]),dp[j-1][1]+max(c[j-1]-1,c[j])),max(dp[j-1][2]+c[j],dp[j-1][3])));
		ans+=dp[cnt+1][0];
		REP(j,1,cnt)c[j]=0;
		i=cur;
	}
	printf("%d\n",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:2: error: expected '}' at end of input
   53 | }
      |  ^
a.cc:23:11: note: to match this '{'
   23 | int main(){
      |           ^
Language: C++

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

int score[N];
int n, last;
char s[MAX_N];

int main(void) {
  scanf("%d", n);
	scanf("%s", &n, s);
	for (int i = 2; i < n; ++i) {
		score[i] = score[i - 1];
		if(s[i - 2] == '1' && s[i - 1] == '0' && s[i] == '1') {
			last = i;
			for (int j = i - 2; (s[j] != '0' && j >= 0); --j) {
        score[i] = max(score[i], score[j - 1] + (i - j - 1));
      }
		}
		if(s[i] == '0') last = 0;
		if(last != 0) {
      score[i] = max(score[i], score[la - 3] + (i - la + 1));
    }
	}
	printf("%d\n", score[n - 1]);
	return 0;
}


Compiler output:
a.cc:5:11: error: 'N' was not declared in this scope
    5 | int score[N];
      |           ^
a.cc: In function 'int main()':
a.cc:13:17: error: 'score' was not declared in this scope
   13 |                 score[i] = score[i - 1];
      |                 ^~~~~
a.cc:22:38: error: 'la' was not declared in this scope
   22 |       score[i] = max(score[i], score[la - 3] + (i - la + 1));
      |                                      ^~
a.cc:25:24: error: 'score' was not declared in this scope
   25 |         printf("%d\n", score[n - 1]);
      |                        ^~~~~