criyle/codenet-compile-errors huggingface dataset:
Language: Java

package main.java.tasks;

import FastIO.FastScanner;
import java.io.PrintWriter;

public class DDecayedBridges {
    public void solve(int testNumber, FastScanner in, PrintWriter out) {
        int N = in.nextInt();
        int M = in.nextInt();
        int[] A = new int[M];
        int[] B = new int[M];
        for (int i = 0; i < M; i++) {
            A[i] = in.nextInt()-1;
            B[i] = in.nextInt()-1;
        }
        long[] inconvs = new long[M];
        long inc = (long) N*(N-1)/2;
        UnionFindTree uf = new UnionFindTree(N);
        for (int i = M-1; i >= 0; i--) {
            inconvs[i] = inc;
            if (!uf.same(A[i], B[i])) {
                inc -= uf.size(A[i]) * uf.size(B[i]);
                uf.unite(A[i], B[i]);
            }
        }

        for (int i = 0; i < M; i++) {
            out.println(inconvs[i]);
        }
    }
    class UnionFindTree {

        int[] parent; //インデックスにとノードを対応させ、そのルートノードのインデックスを格納
        int[] rank; //parentと同様に、木の高さを格納
        int[] size; //木の要素の数を格納。最新はparentのindexに
        int group;


        public UnionFindTree(int n) {
            this.parent = new int[n];
            this.rank = new int[n];
            this.size = new int[n];
            group = n;

            for (int i = 0; i < n; i++) {
                makeSet(i);
            }
        }

        public void makeSet(int i) {
            parent[i] = i;
            rank[i] = 0; //集合の高さ
            size[i] = 1;
        }

        public void unite(int x, int y) {
            int xRoot = find(x);
            int yRoot = find(y);
            if (xRoot == yRoot) return;
            group--;
            //xが属する木の方が大きい場合
            if (rank[xRoot] > rank[yRoot]) {
                parent[yRoot] = xRoot; //yの親をxに更新
                size[xRoot] += size[yRoot];

            } else if(rank[xRoot] < rank[yRoot]) {
                parent[xRoot] = yRoot;
                size[yRoot] += size[xRoot];
            } else {
                parent[yRoot] = xRoot;
                rank[xRoot]++; //同じ高さの木がルートの子として着くから大きさ++;
                size[xRoot] += size[yRoot];
            }
        }

        //引数の属する木のルートのidを返す
        public int find(int i) {
            if (i != parent[i]) {
                parent[i] = find(parent[i]);
            }
            return parent[i];
        }

        //同じ木に属しているか
        public boolean same(int x, int y) {
            return find(x) == find(y);
        }

        public int size(int i) {
            return size[find(i)];
        }
    }
}


Compiler output:
Main.java:6: error: class DDecayedBridges is public, should be declared in a file named DDecayedBridges.java
public class DDecayedBridges {
       ^
Main.java:3: error: package FastIO does not exist
import FastIO.FastScanner;
             ^
Main.java:7: error: cannot find symbol
    public void solve(int testNumber, FastScanner in, PrintWriter out) {
                                      ^
  symbol:   class FastScanner
  location: class DDecayedBridges
3 errors
Language: C++

#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
 
class UnionFind{
public:vector<int>Parent;
  UnionFind(int N){
    Parent=vector<int>(N,-1);
  }
  int root(int A){
    if(Parent[A]<0)return A;
    return Parent[A]=root(Parent[A]);
  }
  int size(int A){
    return -Parent[root(A)];
  }
  bool connect(int A,int B){
    A=root(A);
    B=root(B);
    if(A==B){
      return false;
    }
    if(size(A)<size(B))swap(A,B);
    Parent[A]+=Parent[B];
    Parent[B]=A;
    return true;
  }
};
 
int main(){
  int N,M;
  cin >> N >> M;
  vector<int>A(M),B(M);
  for(int i=0;i<M;i++){
    cin >> A[i] >> B[i];
    A[i]--;
    B[i]--;
  }
  vector<long long>ans(M);
  ans[M-1]=(long long)N*(N-1)/2;
  
  UnionFind Uni(N);
  
  for(int i=M-1;i>0;i--)
  {
    ans[i - 1] = ans[i];
 
		if (Uni.root(A[i]) != Uni.root(B[i])) {
			ans[i - 1] -= (long long)Uni.size(A[i]) * Uni.size(B[i]);
			Uni.connect(A[i], B[i]);
		}
	}
 
	for (int i = 0; i < M; i++)
	{
		cout << ans[i] << endl;
	}
}
}
}

Compiler output:
a.cc:61:1: error: expected declaration before '}' token
   61 | }
      | ^
a.cc:62:1: error: expected declaration before '}' token
   62 | }
      | ^
Language: C++

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

class UnionFind{
public:vector<int>Parent;
  UnionFind(int N){
    Parent=vector<int>(N,-1);
  }
  int root(int A){
    if(Parent[A]<0)return A;
    return Parent[A]=root(Parent[A]);
  }
  int size(int A){
    return -Parent[root(A)];
  }
  bool connect(int A,int B){
    A=root(A);
    B=root(B);
    if(A==B){
      return false;
    }
    if(size(A)<size(B))swap(A,B);
    Parent[A]+=Parent[B];
    Parent[B]=A;
    return true;
  }
};

int main(){
  int N,M;
  cin >> N >> M;
  vector<int>A(M),B(M);
  for(int i=0;i<M;i++){
    cin >> A[i] >> B[i];
    A[i]--;
    B[i]--;
  }
  vector<long long>ans(M);
  ans[M-1]=(long long)N*(N-1)/2;
  
  UnionFind Uni(N);
  
  for(int i=M-1;i>0;i--)
  {
    ans[i - 1] = ans[i];
 
		//繋がってなかったのが繋がった時
		if (Uni.root(A[i]) != Uni.root(B[i])) {
			ans[i - 1] -= (long long)Uni.size(A[i]) * Uni.size(B[i]);
			Uni.connect(A[i], B[i]);
		}
	}
 
	for (int i = 0; i < M; i++)
	{
		cout << ans[i] << endl;
	}
}
  
}

Compiler output:
a.cc:63:1: error: expected declaration before '}' token
   63 | }
      | ^
Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <string.h>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

struct UnionFind {
  vector<ll> data;
  UnionFind(ll size) : data(size, -1) { }
  bool unionSet(ll x, ll y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool findSet(ll x, ll y) {
    return root(x) == root(y);
  }
  ll root(ll x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  ll size(ll x) {
    return -data[root(x)];
  }
};


ll main()
{
//整数値の入力
ll n,m;
cin >> n>>m;
ll ans[m];
//行列の入力
ll aaa,bbb;
pair<ll, ll> table[m];
for (ll i = 0; i < m; ++i) {
  
  cin >> aaa>>bbb;
  table[i] = make_pair(aaa-1, bbb-1);
}

UnionFind arr(n);

ll an=n*(n-1)/2;
ans[m-1]=an;
for (ll i = 0; i < m-1; ++i) {
  if(arr.findSet(table[m-1-i].first,table[m-1-i].second)){ans[m-2-i]=an;}
  else{
    an=an-(arr.size(table[m-1-i].first)*arr.size(table[m-1-i].second));
    ans[m-2-i]=an;
    arr.unionSet(table[m-1-i].first,table[m-1-i].second);

  }
   //cout << arr.size(table[m-1-i].first) << endl;
}


for (ll i = 0; i < m; ++i) {
  
  cout << ans[i] << endl;
}
//回答

return 0;
}



Compiler output:
a.cc:37:1: error: '::main' must return 'int'
   37 | ll main()
      | ^~
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define llong long long int
#define ldouble long double
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) x.begin(), x.end()
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)

const static int MOD = 1000000000 + 7;
const static llong INF = 1LL << 60;
const static int dy[] = {0, 1, 0, -1};
const static int dx[] = {1, 0, -1, 0};

template<typename T> T my_gcd(T a, T b) {
    return (a ? my_gcd(b % a, a) : b);
}

template<typename T> T my_lcm(T a, T b){
	return a * b / my_gcd(a, b);	
}

struct UF {
    vector<int> par, sz;

    UF(int n) {
        par.resize(n);
        sz.resize(n);
        for (int i = 0; i < n; ++i) {
            par[i] = i;
            sz[i] = 1;
        }
    }

    int find_root(int x) {
        return par[x] == x ? x : par[x] = find_root(par[x]);
    }

    bool same(int x, int y) {
        return find_root(x) == find_root(y);
    }

    void unite(int x, int y) {
        x = find_root(x);
        y = find_root(y);
        if (x == y) return;
        
        if (sz[x] < sz[y]) swap(x, y);
        sz[x] += sz[y];
        par[y] = x;
    }
};

signed main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, m;
    cin >> n >> m;
    vector<pair<int, int> > removed_edge(m);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        removed_edge[i] = make_pair(a - 1, b - 1);
    }
    reverse(removed_edge.begin(), removed_edge.end());

    UF uf(n);
    vector<llong> ans;
    llong inconvenience = n * (n - 1) / 2;
    ans.push_back(inconvenience);
    rep(i, m) {
        int e1 = removed_edge[i].first, e2 = removed_edge[i].second;
        cerr << "edge :" << " " << e1 + 1 << " " << e2 + 1 << endl;
        eerr << "is same :" << " " << uf.same(e1, e2) << endl;
        if (uf.same(e1, e2)) {
            ans.push_back(inconvenience);
        } else {
            inconvenience = inconvenience - uf.sz[uf.find_root(e1)] * uf.sz[uf.find_root(e2)];
            ans.push_back(inconvenience);
        }

        uf.unite(e1, e2);
    }

    rep(i, m) {
        cout << ans[m - i - 1] << endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:76:9: error: 'eerr' was not declared in this scope
   76 |         eerr << "is same :" << " " << uf.same(e1, e2) << endl;
      |         ^~~~
Language: C++

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

struct island{
    long long leader;
    long long num;

    island(long long i) : leader(i), num(1){}
};

int main(void){
    int N, M;
    cin >> N >> M;
    vector<int> A(M), B(M);
    for(int i = 0; i < M; i++){
        cin >> A[i] >> B[i]; 
        A[i]--;
        B[i]--;
    } 

    vector<long long> ans(M);
    ans[M - 1] = (long long)N * (N - 1) / 2;

    vector<island> il;
    for(int i = 0; i < N; i++){
        il.push_back(island(i));
    }

    for(int i = M - 1; i > 0; i--){
        ans[i - 1] = ans[i];
        if(il[A[i]].leader != il[B[i]].leader){
            ans[i - 1] -= il[il[A[i]].leader].num * il[il[B[i]].leader].num;
            if(il[il[A[i]].leader].num >= il[il[B[i]].leader].num){
                il[il[A[i]].leader].num += il[il[B[i]].leader].num;
                il[B[i]].num = il[il[B[i]].leader].num = 0;
                il[il[B[i]].leader].leader = il[A[i]].leader;
                il[B[i]].leader = il[A[i]].leader
            }else{
                il[il[B[i]].leader].num += il[il[A[i]].leader].num;
                il[A[i]].num = il[il[A[i]].leader].num = 0;
                il[il[A[i]].leader].leader = il[B[i]].leader;
                il[A[i]].leader = il[B[i]].leader
            }
        }
    }

    for(int i = 0; i < M; i++){
        cout << ans[i] << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:50: error: expected ';' before '}' token
   37 |                 il[B[i]].leader = il[A[i]].leader
      |                                                  ^
      |                                                  ;
   38 |             }else{
      |             ~                                     
a.cc:42:50: error: expected ';' before '}' token
   42 |                 il[A[i]].leader = il[B[i]].leader
      |                                                  ^
      |                                                  ;
   43 |             }
      |             ~
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

struct UnionFind{
	ll par[201000];
	ll rank[201000];
	ll siz[201000];

	void init(){
		for (ll i = 0; i < 201000; i++){
			par[i] = i;
			rank[i] = 1;
			siz[i] = 1;
		}
	}

	ll find(ll x){
		if (par[x] == x) return x;
		return par[x] = find(par[x]);
	}

	void unite(ll x, ll y){
		x = find(x);
		y = find(y);
		if (x == y)return;
		if (rank[x] < rank[y]){
			par[x] = y;
			siz[y] += siz[x];
		}
		else{
			par[y] = x;
			size[x] += size[y];
			if (rank[y] == rank[x])rank[x]++;
		}
	}

	bool same(ll x, ll y){
		return find(x) == find(y);
	}

	bool same(ll x){
		return siz[find(x)];
	}
};

UnionFind uf;
ll n,m;

int main(){
	cin >> n >> m;
	uf.init();
	vector<P> vp;
	rep(i,m){
		ll a,b;
		cin >> a >> b;
		vp.push_back(P(a,b));
	}
	reverse(ALL(vp));
	vector<ll> ans;
	ll num = n*(n-1)/2;
	rep(i,vp.size()){
		ll a = vp[i].first;
		ll b = vp[i].second;
		ans.push_back(num);
		if(uf.find(a) == uf.find(b))continue;
		num -= uf.size(a)*uf.size(b);
		uf.unite(a,b);
	}
	reverse(ALL(ans));
	rep(i,ans.size())cout << ans[i] << endl;
}

Compiler output:
a.cc: In member function 'void UnionFind::unite(ll, ll)':
a.cc:58:29: error: invalid types '<unresolved overloaded function type>[ll {aka long long int}]' for array subscript
   58 |                         size[x] += size[y];
      |                             ^
a.cc:58:40: error: invalid types '<unresolved overloaded function type>[ll {aka long long int}]' for array subscript
   58 |                         size[x] += size[y];
      |                                        ^
a.cc: In function 'int main()':
a.cc:92:27: error: 'struct UnionFind' has no member named 'size'; did you mean 'siz'?
   92 |                 num -= uf.size(a)*uf.size(b);
      |                           ^~~~
      |                           siz
a.cc:92:38: error: 'struct UnionFind' has no member named 'size'; did you mean 'siz'?
   92 |                 num -= uf.size(a)*uf.size(b);
      |                                      ^~~~
      |                                      siz
Language: C++

#include <iostream>
#include <vector>

const int MAX_N = 1e5 + 1;

int N, M;
std::vector<int> A, B;
int par[MAX_N];
int rank[MAX_N];
int nele[MAX_N];

void init(){
   for(int i=0; i<MAX_N; ++i){
      par[i] = i;
      rank[i] = 0;
      nele[i] = 1;
   }
}

int root(int x){
   if(par[x]==x) return x;
   else return par[x] = root(par[x]);
}

void unite(int x, int y){
   x = root(x);
   y = root(y);
   if(x==y) return;

   nele[x] += nele[y];
   nele[y] = nele[x];

   if(rank[x]<rank[y])
      par[x] = y;
   else{
      par[y] = x;
      if(rank[x]==rank[y]) ++rank[x];
   }
   return;
}

bool same(int x, int y){
   return root(x)==root(y);
}

int main(){
   std::cin >> N >> M;
   A.resize(M);
   B.resize(M);
   for(int i=0; i<M; ++i)
      std::cin >> A[i] >> B[i];

   std::vecotr<long long> ans(M+1);
   ans[M] = N * (N-1) / 2;
   init();
   for(int i=M-1; i>-1; --i){
      if(same(A[i],B[i])) ans[i] = ans[i+1];
      else{
	 ans[i] = ans[i+1] - nele[root(A[i])] * nele[root(B[i])];
	 unite(A[i],B[i]);
      }
   }

   for(int i=1; i<M+1; ++i){
      std::cout << ans[i] << std::endl;
   }
   return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:53:9: error: 'vecotr' is not a member of 'std'; did you mean 'vector'?
   53 |    std::vecotr<long long> ans(M+1);
      |         ^~~~~~
      |         vector
a.cc:53:16: error: expected primary-expression before 'long'
   53 |    std::vecotr<long long> ans(M+1);
      |                ^~~~
a.cc:54:4: error: 'ans' was not declared in this scope; did you mean 'abs'?
   54 |    ans[M] = N * (N-1) / 2;
      |    ^~~
      |    abs
Language: C++

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

class UnionFind {
 public:
  // parentの番号を格納する。親だった場合は-(その集合のサイズ)
  vector<int> Parent;

  //作成時は全て-1なので木が全て独立している状態
  UnionFind(int N) { Parent = vector<int>(N, -1); }

  // Aがどのグループに属しているか調べる
  int root(int A) {
    if (Parent[A] < 0)
      return A;
    else {
      return Parent[A] = root(Parent[A]);
    }
  }

  //自分のいるグループの頂点数を調べる
  int size(int A) { return -Parent[A] }

  // AとBをくっつける
  bool connect(int A, int B) {
    // AとBを繋げるのではなくroot(A)とroot(B)を繋げる
    A = root(A);
    B = root(B);
    if (A == B) {
      //すでに繋がれているので繋がない
      return false;
    }

    //大きい方（A）に小さい方（B）をくっつけたい
    if (size(A) < size(B)) swap(A, B);

    // Aのサイズを変更する
    Parent[A] += Parent[B];
    // Bの親をAに変更する
    Parent[B] = A;

    return true;
  }
};

// https://www.youtube.com/watch?v=zV3Ul2pA2Fw
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int N, M;
  cin >> N >> M;
  vector<int> A(M), B(M);

  for (int i = 0; i < M; ++i) {
    cin >> A[i] >> B[i];
    A[i]--;
    B[i]--;
  }

  vector<long long> ans(M);
  ans[M - 1] = N * (N - 1) / 2;  // nC2

  UnionFind UF(N);  //頂点数はN個

  for (int i = M - 1; i >= 1; --i) {
    ans[i - 1] = ans[i];
    //繋がっていないものが繋がった場合
    if (UF.root(A[i]) != UF.root(B[i])) {
      ans[i - 1] -= (long long)UF.size(A[i]) * UF.size(B[i]);
      UF.connect(A[i], B[i]);
    }
  }

  for (int i = 0; i < < ; i++) {
    cout << ans[i] << endl;
  }

  return 0;
}


Compiler output:
a.cc: In member function 'int UnionFind::size(int)':
a.cc:25:39: error: expected ';' before '}' token
   25 |   int size(int A) { return -Parent[A] }
      |                                       ^
a.cc: In function 'int main()':
a.cc:78:23: error: expected primary-expression before '<' token
   78 |   for (int i = 0; i < < ; i++) {
      |                       ^
a.cc:78:25: error: expected primary-expression before ';' token
   78 |   for (int i = 0; i < < ; i++) {
      |                         ^
Language: C++

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

class UnionFind {
 public:
  // parentの番号を格納する。親だった場合は-(その集合のサイズ)
  vector<int> Parent;

  //作成時は全て-1なので木が全て独立している状態
  UnionFind(int N) { Parent = vector<int>(N, -1); }

  // Aがどのグループに属しているか調べる
  int root(int A) {
    if (Parent[A] < 0)
      return A;
    else {
      return Parent[A] = root(Parent[A]);
    }
  }

  //自分のいるグループの頂点数を調べる
  int size(int A) { return -Parent[] }

  // AとBをくっつける
  bool connect(int A, int B) {
    // AとBを繋げるのではなくroot(A)とroot(B)を繋げる
    A = root(A);
    B = root(B);
    if (A == B) {
      //すでに繋がれているので繋がない
      return false;
    }

    //大きい方（A）に小さい方（B）をくっつけたい
    if (size(A) < size(B)) swap(A, B);

    // Aのサイズを変更する
    Parent[A] += Parent[B];
    // Bの親をAに変更する
    Parent[B] = A;

    return true;
  }
};

// https://www.youtube.com/watch?v=zV3Ul2pA2Fw
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int N, M;
  cin >> N >> M;
  vector<int> A(M), B(M);

  for (int i = 0; i < M; ++i) {
    cin >> A[i] >> B[i];
    A[i]--;
    B[i]--;
  }

  vector<long long> ans(M);
  ans[M - 1] = N * (N - 1) / 2; //nC2

  UnionFind UF(N);  //頂点数はN個

  for (int i = M - 1; i >= 1; --i) {
    ans[i - 1] = ans[i];
      //繋がっていないものが繋がった場合
    if (UF.root(A[i]) != UF.root(B[i])) {
      ans[i - 1] -= (long long)UF.size(A[i]) * UF.size(B[i]);
      UF.connect(A[i], B[i]);
    }
  }

  for (int i = 0; i < < ; i++) {
    cout << ans[i] << endl;
  }

  return 0;
}


Compiler output:
a.cc: In member function 'int UnionFind::size(int)':
a.cc:25:36: error: expected primary-expression before ']' token
   25 |   int size(int A) { return -Parent[] }
      |                                    ^
a.cc:25:38: error: expected ';' before '}' token
   25 |   int size(int A) { return -Parent[] }
      |                                      ^
a.cc: In function 'int main()':
a.cc:78:23: error: expected primary-expression before '<' token
   78 |   for (int i = 0; i < < ; i++) {
      |                       ^
a.cc:78:25: error: expected primary-expression before ';' token
   78 |   for (int i = 0; i < < ; i++) {
      |                         ^
Language: C++

struct UFS {
    vector<ll> data;
    UFS(ll N) : data(N) { rep(i, N) data[i] = -1; }
    def root(ll x) {
        if (data[x] < 0)
            return x;
        else
            return data[x] = root(data[x]);
    }
    def unite(ll x, ll y) {
        ll root_x = root(x), root_y = root(y);
        if (root_x != root_y) {
            if (root_x < root_y) swap(root_x, root_y);
            data[root_x] += data[root_y];
            data[root_y] = root_x;
            return true;
        }
        return false;
    }
    def same(ll x, ll y) { return root(x) == root(y); }
    def size(ll x) { return -data[root(x)]; }
};

Compiler output:
a.cc:2:5: error: 'vector' does not name a type
    2 |     vector<ll> data;
      |     ^~~~~~
a.cc:3:11: error: expected ')' before 'N'
    3 |     UFS(ll N) : data(N) { rep(i, N) data[i] = -1; }
      |        ~  ^~
      |           )
a.cc:4:5: error: 'def' does not name a type
    4 |     def root(ll x) {
      |     ^~~
a.cc:10:5: error: 'def' does not name a type
   10 |     def unite(ll x, ll y) {
      |     ^~~
a.cc:20:5: error: 'def' does not name a type
   20 |     def same(ll x, ll y) { return root(x) == root(y); }
      |     ^~~
a.cc:21:5: error: 'def' does not name a type
   21 |     def size(ll x) { return -data[root(x)]; }
      |     ^~~
Language: C++

#include<string>
#include<sstream>
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<ios>
#include<algorithm>
#include<stack>
#include<queue>
#include<cmath>
#include<type_traits>
#include<random>
#include<vector>
#include<map>

using namespace std;

bool connect_tkb[100000][100000];
bool use[100000];
bool judge;

void hukasa(int y,int now,int N,int M)
{	
	use[now] = 1;
	if(now==y)
	{
		judge = 1;
		use[now] = 0;
		return ;
	}
	for(int i=0;i<N;i++)
	{
		if(connect_tkb[now][i]==1 && use[i]==0)
		{
			hukasa(y,i,N,M);
		}
	}
	use[now] = 0;
	return ;

}




int main()
{
	int N_tkb,M_tkb;
	cin >> N_tkb >> M_tkb;
	int result[M_tkb+1];
	vector<int> a;
	vector<int> b;
	for(int i=0;i<M_tkb;i++)
	{
		int aa,bb;
		cin >> aa >> bb;
		a.push_back(aa-1);
		b.push_back(bb-1);
		connect_tkb[aa-1][bb-1] = 1;
		connect_tkb[bb-1][aa-1] = 1;
	}

	for(int i=0;i<M_tkb;i++)
	{
		int cnt = 0;
		connect_tkb[a[i]][b[i]] = 0;
		connect_tkb[b[i]][a[i]] = 0;
		for(int p=0;p<N_tkb;p++)
		{
			for(int q=p+1;q<N_tkb;q++)
			{
				judge = 0;
				hukasa(p,q,N_tkb,M_tkb);
				if(judge==0)
 				{
					cnt = cnt + 1;
				}
			}
		}
		result[i] = cnt;
	}

	for(int i=0;i<M_tkb;i++)
	{
		cout << result[i] << endl;
	}
}


Compiler output:
/tmp/ccGC9Dsj.o: in function `hukasa(int, int, int, int)':
a.cc:(.text+0x1c): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccGC9Dsj.o
a.cc:(.text+0x2e): relocation truncated to fit: R_X86_64_PC32 against symbol `judge' defined in .bss section in /tmp/ccGC9Dsj.o
a.cc:(.text+0x3b): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccGC9Dsj.o
a.cc:(.text+0x80): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccGC9Dsj.o
a.cc:(.text+0xb6): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccGC9Dsj.o
/tmp/ccGC9Dsj.o: in function `main':
a.cc:(.text+0x301): relocation truncated to fit: R_X86_64_PC32 against symbol `judge' defined in .bss section in /tmp/ccGC9Dsj.o
a.cc:(.text+0x31c): relocation truncated to fit: R_X86_64_PC32 against symbol `judge' defined in .bss section in /tmp/ccGC9Dsj.o
collect2: error: ld returned 1 exit status
Language: C++

#include<string>
#include<sstream>
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<ios>
#include<algorithm>
#include<stack>
#include<queue>
#include<cmath>
#include<type_traits>
#include<random>
#include<vector>
#include<map>

using namespace std;

bool connect_tkb[100000][100000]={};
bool use[100000]={};
bool judge;

void hukasa(int y,int now,int N,int M)
{	
	use[now] = 1;
	if(now==y)
	{
		judge = 1;
		use[now] = 0;
		return ;
	}
	for(int i=0;i<N;i++)
	{
		if(connect_tkb[now][i]==1 && use[i]==0)
		{
			hukasa(y,i,N,M);
		}
	}
	use[now] = 0;
	return ;

}




int main()
{
	int N_tkb,M_tkb;
	cin >> N_tkb >> M_tkb;
	int result[M_tkb+1];
	vector<int> a;
	vector<int> b;
	for(int i=0;i<M_tkb;i++)
	{
		int aa,bb;
		cin >> aa >> bb;
		a.push_back(aa-1);
		b.push_back(bb-1);
		connect_tkb[aa-1][bb-1] = 1;
		connect_tkb[bb-1][aa-1] = 1;
	}

	for(int i=0;i<M_tkb;i++)
	{
		int cnt = 0;
		connect_tkb[a[i]][b[i]] = 0;
		connect_tkb[b[i]][a[i]] = 0;
		for(int p=0;p<N_tkb;p++)
		{
			for(int q=p+1;q<N_tkb;q++)
			{
				judge = 0;
				hukasa(p,q,N_tkb,M_tkb);
				if(judge==0)
 				{
					cnt = cnt + 1;
				}
			}
		}
		result[i] = cnt;
	}

	for(int i=0;i<M_tkb;i++)
	{
		cout << result[i] << endl;
	}
}


Compiler output:
/tmp/ccVbQ4pi.o: in function `hukasa(int, int, int, int)':
a.cc:(.text+0x1c): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccVbQ4pi.o
a.cc:(.text+0x2e): relocation truncated to fit: R_X86_64_PC32 against symbol `judge' defined in .bss section in /tmp/ccVbQ4pi.o
a.cc:(.text+0x3b): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccVbQ4pi.o
a.cc:(.text+0x80): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccVbQ4pi.o
a.cc:(.text+0xb6): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccVbQ4pi.o
/tmp/ccVbQ4pi.o: in function `main':
a.cc:(.text+0x301): relocation truncated to fit: R_X86_64_PC32 against symbol `judge' defined in .bss section in /tmp/ccVbQ4pi.o
a.cc:(.text+0x31c): relocation truncated to fit: R_X86_64_PC32 against symbol `judge' defined in .bss section in /tmp/ccVbQ4pi.o
collect2: error: ld returned 1 exit status
Language: C++

#include<string>
#include<sstream>
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<ios>
#include<algorithm>
#include<stack>
#include<queue>
#include<cmath>
#include<type_traits>
#include<random>
#include<vector>
#include<map>

using namespace std;

bool connect_tkb[100000][100000]={};
bool use[100000]={};
bool judge;

void hukasa(int y,int now,int N,int M)
{	
	use[now] = 1;
	if(now==y)
	{
		judge = 1;
		use[now] = 0;
		return ;
	}
	for(int i=0;i<N;i++)
	{
		if(connect_tkb[now][i]==1 && use[i]==0)
		{
			hukasa(y,i,N,M);
		}
	}
	use[now] = 0;
	return ;

}




int main()
{
	int N_tkb,M_tkb;
	cin >> N_tkb >> M_tkb;
	int result[M_tkb+1];
	vector<int> a;
	vector<int> b;
	for(int i=0;i<M_tkb;i++)
	{
		int aa,bb;
		cin >> aa >> bb;
		a.push_back(aa-1);
		b.push_back(bb-1);
		connect_tkb[aa-1][bb-1] = 1;
		connect_tkb[bb-1][aa-1] = 1;
	}

	for(int i=0;i<M_tkb;i++)
	{
		int cnt = 0;
		connect_tkb[a[i]][b[i]] = 0;
		connect_tkb[b[i]][a[i]] = 0;
		for(int p=0;p<N_tkb;p++)
		{
			for(int q=p+1;q<N_tkb;q++)
			{
				judge = 0;
				hukasa(p,q,N_tkb,M_tkb);
				if(judge==0)
 				{
					cnt = cnt + 1;
				}
			}
		}
		result[i] = cnt;
	}

	for(int i=0;i<M_tkb;i++)
	{
		cout << result[i] << endl;
	}
}


Compiler output:
/tmp/ccKvvDRh.o: in function `hukasa(int, int, int, int)':
a.cc:(.text+0x1c): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccKvvDRh.o
a.cc:(.text+0x2e): relocation truncated to fit: R_X86_64_PC32 against symbol `judge' defined in .bss section in /tmp/ccKvvDRh.o
a.cc:(.text+0x3b): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccKvvDRh.o
a.cc:(.text+0x80): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccKvvDRh.o
a.cc:(.text+0xb6): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccKvvDRh.o
/tmp/ccKvvDRh.o: in function `main':
a.cc:(.text+0x301): relocation truncated to fit: R_X86_64_PC32 against symbol `judge' defined in .bss section in /tmp/ccKvvDRh.o
a.cc:(.text+0x31c): relocation truncated to fit: R_X86_64_PC32 against symbol `judge' defined in .bss section in /tmp/ccKvvDRh.o
collect2: error: ld returned 1 exit status
Language: C++

#include<string>
#include<sstream>
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<ios>
#include<algorithm>
#include<stack>
#include<queue>
#include<cmath>
#include<type_traits>
#include<random>
#include<vector>
#include<map>

using namespace std;

bool connect_tkb[100000][100000]={};
bool use[100000]={};
bool judge;

void hukasa(int y,int now,int N,int M)
{	
	use[now] = 1;
	if(now==y)
	{
		judge = 1;
		use[now] = 0;
		return ;
	}
	for(int i=0;i<N;i++)
	{
		if(connect_tkb[now][i]==1 && use[i]==0)
		{
			hukasa(y,i,N,M);
		}
	}
	use[now] = 0;
	return ;

}




int main()
{
	int N_tkb,M_tkb;
	cin >> N_tkb >> M_tkb;
	int result[M_tkb+1];
	vector<int> a;
	vector<int> b;
	for(int i=0;i<M_tkb;i++)
	{
		int aa,bb;
		cin >> aa >> bb;
		a.push_back(aa-1);
		b.push_back(bb-1);
		connect_tkb[aa-1][bb-1] = 1;
		connect_tkb[bb-1][aa-1] = 1;
	}

	for(int i=0;i<M_tkb;i++)
	{
		int cnt = 0;
		connect_tkb[a[i]][b[i]] = 0;
		connect_tkb[b[i]][a[i]] = 0;
		for(int p=0;p<N_tkb;p++)
		{
			for(int q=p+1;q<N_tkb;q++)
			{
				judge = 0;
				hukasa(p,q,N_tkb,M_tkb);
				if(judge==0)
 				{
					cnt = cnt + 1;
				}
			}
		}
		result[i] = cnt;
	}

	for(int i=0;i<M_tkb;i++)
	{
		cout << result[i] << endl;
	}
}




Compiler output:
/tmp/ccKRRkFz.o: in function `hukasa(int, int, int, int)':
a.cc:(.text+0x1c): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccKRRkFz.o
a.cc:(.text+0x2e): relocation truncated to fit: R_X86_64_PC32 against symbol `judge' defined in .bss section in /tmp/ccKRRkFz.o
a.cc:(.text+0x3b): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccKRRkFz.o
a.cc:(.text+0x80): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccKRRkFz.o
a.cc:(.text+0xb6): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccKRRkFz.o
/tmp/ccKRRkFz.o: in function `main':
a.cc:(.text+0x301): relocation truncated to fit: R_X86_64_PC32 against symbol `judge' defined in .bss section in /tmp/ccKRRkFz.o
a.cc:(.text+0x31c): relocation truncated to fit: R_X86_64_PC32 against symbol `judge' defined in .bss section in /tmp/ccKRRkFz.o
collect2: error: ld returned 1 exit status
Language: C++

#include<string>
#include<sstream>
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<ios>
#include<algorithm>
#include<stack>
#include<queue>
#include<cmath>
#include<type_traits>
#include<random>
#include<vector>
#include<map>

using namespace std;

int connect_tkb[100000][100000]={};
bool use[100000]={};
bool judge;

void hukasa(int y,int now,int N,int M)
{	
	use[now] = 1;
	if(now==y)
	{
		judge = 1;
		use[now] = 0;
		return ;
	}
	for(int i=0;i<N;i++)
	{
		if(connect_tkb[now][i]==1 && use[i]==0)
		{
			hukasa(y,i,N,M);
		}
	}
	use[now] = 0;
	return ;

}




int main()
{
	int N_tkb,M_tkb;
	cin >> N_tkb >> M_tkb;
	int result[M_tkb+1];
	vector<int> a;
	vector<int> b;
	for(int i=0;i<M_tkb;i++)
	{
		int aa,bb;
		cin >> aa >> bb;
		a.push_back(aa-1);
		b.push_back(bb-1);
		connect_tkb[aa-1][bb-1] = 1;
		connect_tkb[bb-1][aa-1] = 1;
	}

	for(int i=0;i<M_tkb;i++)
	{
		int cnt = 0;
		connect_tkb[a[i]][b[i]] = 0;
		connect_tkb[b[i]][a[i]] = 0;
		for(int p=0;p<N_tkb;p++)
		{
			for(int q=p+1;q<N_tkb;q++)
			{
				judge = 0;
				hukasa(p,q,N_tkb,M_tkb);
				if(judge==0)
 				{
					cnt = cnt + 1;
				}
			}
		}
		result[i] = cnt;
	}

	for(int i=0;i<M_tkb;i++)
	{
		cout << result[i] << endl;
	}
}



Compiler output:
/tmp/ccdJ4uKK.o: in function `hukasa(int, int, int, int)':
a.cc:(.text+0x1c): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccdJ4uKK.o
a.cc:(.text+0x2e): relocation truncated to fit: R_X86_64_PC32 against symbol `judge' defined in .bss section in /tmp/ccdJ4uKK.o
a.cc:(.text+0x3b): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccdJ4uKK.o
a.cc:(.text+0x82): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccdJ4uKK.o
a.cc:(.text+0xb8): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccdJ4uKK.o
/tmp/ccdJ4uKK.o: in function `main':
a.cc:(.text+0x327): relocation truncated to fit: R_X86_64_PC32 against symbol `judge' defined in .bss section in /tmp/ccdJ4uKK.o
a.cc:(.text+0x342): relocation truncated to fit: R_X86_64_PC32 against symbol `judge' defined in .bss section in /tmp/ccdJ4uKK.o
collect2: error: ld returned 1 exit status
Language: C++

#include<string>
#include<sstream>
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<ios>
#include<algorithm>
#include<stack>
#include<queue>
#include<cmath>
#include<type_traits>
#include<random>
#include<vector>
#include<map>

using namespace std;

int connect[100000][100000]={};
bool use[100000]={};
bool judge;

void hukasa(int y,int now,int N,int M)
{	
	use[now] = 1;
	if(now==y)
	{
		judge = 1;
		use[now] = 0;
		return ;
	}
	for(int i=0;i<N;i++)
	{
		if(connect[now][i]==1 && use[i]==0)
		{
			hukasa(y,i,N,M);
		}
	}
	use[now] = 0;
	return ;

}




int main()
{
	int N_tkb,M_tkb;
	cin >> N_tkb >> M_tkb;
	int result[M_tkb+1];
	vector<int> a;
	vector<int> b;
	for(int i=0;i<M_tkb;i++)
	{
		int aa,bb;
		cin >> aa >> bb;
		a.push_back(aa-1);
		b.push_back(bb-1);
		connect[aa-1][bb-1] = 1;
		connect[bb-1][aa-1] = 1;
	}

	for(int i=0;i<M_tkb;i++)
	{
		int cnt = 0;
		connect[a[i]][b[i]] = 0;
		connect[b[i]][a[i]] = 0;
		for(int p=0;p<N_tkb;p++)
		{
			for(int q=p+1;q<N_tkb;q++)
			{
				judge = 0;
				hukasa(p,q,N_tkb,M_tkb);
				if(judge==0)
 				{
					cnt = cnt + 1;
				}
			}
		}
		result[i] = cnt;
	}

	for(int i=0;i<M_tkb;i++)
	{
		cout << result[i] << endl;
	}
}



Compiler output:
/tmp/ccF19is9.o: in function `hukasa(int, int, int, int)':
a.cc:(.text+0x1c): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccF19is9.o
a.cc:(.text+0x2e): relocation truncated to fit: R_X86_64_PC32 against symbol `judge' defined in .bss section in /tmp/ccF19is9.o
a.cc:(.text+0x3b): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccF19is9.o
a.cc:(.text+0x82): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccF19is9.o
a.cc:(.text+0xb8): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccF19is9.o
/tmp/ccF19is9.o: in function `main':
a.cc:(.text+0x327): relocation truncated to fit: R_X86_64_PC32 against symbol `judge' defined in .bss section in /tmp/ccF19is9.o
a.cc:(.text+0x342): relocation truncated to fit: R_X86_64_PC32 against symbol `judge' defined in .bss section in /tmp/ccF19is9.o
collect2: error: ld returned 1 exit status
Language: C++

#include<string>
#include<sstream>
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<ios>
#include<algorithm>
#include<stack>
#include<queue>
#include<cmath>
#include<type_traits>
#include<random>
#include<vector>
#include<map>

using namespace std;

int N_tkb,M_tkb = 0;
int connect[100000][100000]={};
bool use[100000]={};
bool judge;

void hukasa(int y,int now)
{	
	use[now] = 1;
	if(now==y)
	{
		judge = 1;
		use[now] = 0;
		return ;
	}
	for(int i=0;i<N_tkb;i++)
	{
		if(connect[now][i]==1 && use[i]==0)
		{
			hukasa(y,i);
		}
	}
	use[now] = 0;
	return ;

}




int main()
{
	cin >> N_tkb >> M_tkb;
	int result[M_tkb+1];
	vector<int> a;
	vector<int> b;
	for(int i=0;i<M_tkb;i++)
	{
		int aa,bb;
		cin >> aa >> bb;
		a.push_back(aa-1);
		b.push_back(bb-1);
		connect[aa-1][bb-1] = 1;
		connect[bb-1][aa-1] = 1;
	}

	for(int i=0;i<M_tkb;i++)
	{
		int cnt = 0;
		connect[a[i]][b[i]] = 0;
		connect[b[i]][a[i]] = 0;
		for(int p=0;p<N_tkb;p++)
		{
			for(int q=p+1;q<N_tkb;q++)
			{
				judge = 0;
				hukasa(p,q);
				if(judge==0)
 				{
					cnt = cnt + 1;
				}
			}
		}
		result[i] = cnt;
	}

	for(int i=0;i<M_tkb;i++)
	{
		cout << result[i] << endl;
	}
}


Compiler output:
/tmp/ccYcknE6.o: in function `hukasa(int, int)':
a.cc:(.text+0x16): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccYcknE6.o
a.cc:(.text+0x28): relocation truncated to fit: R_X86_64_PC32 against symbol `judge' defined in .bss section in /tmp/ccYcknE6.o
a.cc:(.text+0x35): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccYcknE6.o
a.cc:(.text+0x7c): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccYcknE6.o
a.cc:(.text+0xb1): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccYcknE6.o
/tmp/ccYcknE6.o: in function `main':
a.cc:(.text+0x32c): relocation truncated to fit: R_X86_64_PC32 against symbol `judge' defined in .bss section in /tmp/ccYcknE6.o
a.cc:(.text+0x343): relocation truncated to fit: R_X86_64_PC32 against symbol `judge' defined in .bss section in /tmp/ccYcknE6.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>

using namespace std;

struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) { }
  bool unionSet(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool findSet(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};

int main()
{
  int N,M;
  cin>>N>>M;
  vector<int> A(M),B(M);
  vector<long long> ans(M);
  for(int i=0;i<M;i++){
    cin>>A[i]>>B[i];
  }
  UnionFind uf(N);
  for(int i=M-1;i>=0;i--){
    int cnt1=uf.size(A[i]);
    uf.merge(A[i],B[i]);
    int cnt2=uf.size(A[i]);
    int cnt3=cnt2-cnt1;
    ans[i]=cnt2*(cnt2-1)/2-cnt1*(cnt1-1)/2-cnt3*(cnt3-1)/2;
  }
  long long tmp=0;
  for(int i=0;i<M;i++){
    tmp+=ans[i];
    cout<<tmp<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:8: error: 'struct UnionFind' has no member named 'merge'
   46 |     uf.merge(A[i],B[i]);
      |        ^~~~~
Language: C++

#include<string>
#include<sstream>
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<ios>
#include<algorithm>
#include<stack>
#include<queue>
#include<cmath>
#include<type_traits>
#include<random>
#include<vector>
#include<map>

using namespace std;

int N,M = 0;
int connect[100000][100000]={};
bool use[100000]={};
bool judge;

void hukasa(int y,int now)
{	
	use[now] = 1;
	if(now==y)
	{
		judge = 1;
		use[now] = 0;
		return ;
	}
	for(int i=0;i<N;i++)
	{
		if(connect[now][i]==1 && use[i]==0)
		{
			hukasa(y,i);
		}
	}
	use[now] = 0;
	return ;

}




int main()
{
	cin >> N >> M;
	int result[M+1];
	vector<int> a;
	vector<int> b;
	for(int i=0;i<M;i++)
	{
		int aa,bb;
		cin >> aa >> bb;
		a.push_back(aa-1);
		b.push_back(bb-1);
		connect[aa-1][bb-1] = 1;
		connect[bb-1][aa-1] = 1;
	}

	for(int i=0;i<M;i++)
	{
		int cnt = 0;
		connect[a[i]][b[i]] = 0;
		connect[b[i]][a[i]] = 0;
		for(int p=0;p<N;p++)
		{
			for(int q=p+1;q<N;q++)
			{
				judge = 0;
				hukasa(p,q);
				if(judge==0)
 				{
					cnt = cnt + 1;
				}
			}
		}
		result[i] = cnt;
	}

	for(int i=0;i<M;i++)
	{
		cout << result[i] << endl;
	}
}


Compiler output:
/tmp/ccEa0QhM.o: in function `hukasa(int, int)':
a.cc:(.text+0x16): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccEa0QhM.o
a.cc:(.text+0x28): relocation truncated to fit: R_X86_64_PC32 against symbol `judge' defined in .bss section in /tmp/ccEa0QhM.o
a.cc:(.text+0x35): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccEa0QhM.o
a.cc:(.text+0x7c): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccEa0QhM.o
a.cc:(.text+0xb1): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/ccEa0QhM.o
/tmp/ccEa0QhM.o: in function `main':
a.cc:(.text+0x32c): relocation truncated to fit: R_X86_64_PC32 against symbol `judge' defined in .bss section in /tmp/ccEa0QhM.o
a.cc:(.text+0x343): relocation truncated to fit: R_X86_64_PC32 against symbol `judge' defined in .bss section in /tmp/ccEa0QhM.o
collect2: error: ld returned 1 exit status
Language: C++

#include<string>
#include<sstream>
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<ios>
#include<algorithm>
#include<stack>
#include<queue>
#include<cmath>
#include<type_traits>
#include<random>
#include<vector>
#include<map>

using namespace std;

int N,M;
int connect[100000][100000];
bool use[100000];
bool judge;

void hukasa(int y,int now)
{	
	use[now] = 1;
	if(now==y)
	{
		judge = 1;
		use[now] = 0;
		return ;
	}
	for(int i=0;i<N;i++)
	{
		if(connect[now][i]==1 && use[i]==0)
		{
			hukasa(y,i);
		}
	}
	use[now] = 0;
	return ;

}




int main()
{
	cin >> N >> M;
	int result[M+1];
	vector<int> a;
	vector<int> b;
	for(int i=0;i<M;i++)
	{
		int aa,bb;
		cin >> aa >> bb;
		a.push_back(aa-1);
		b.push_back(bb-1);
		connect[aa-1][bb-1] = 1;
		connect[bb-1][aa-1] = 1;
	}

	for(int i=0;i<M;i++)
	{
		int cnt = 0;
		connect[a[i]][b[i]] = 0;
		connect[b[i]][a[i]] = 0;
		for(int p=0;p<N;p++)
		{
			for(int q=p+1;q<N;q++)
			{
				judge = 0;
				hukasa(p,q);
				if(judge==0)
 				{
					cnt = cnt + 1;
				}
			}
		}
		result[i] = cnt;
	}

	for(int i=0;i<M;i++)
	{
		cout << result[i] << endl;
	}
}





Compiler output:
/tmp/cck9iLC0.o: in function `hukasa(int, int)':
a.cc:(.text+0x16): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/cck9iLC0.o
a.cc:(.text+0x28): relocation truncated to fit: R_X86_64_PC32 against symbol `judge' defined in .bss section in /tmp/cck9iLC0.o
a.cc:(.text+0x35): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/cck9iLC0.o
a.cc:(.text+0x7c): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/cck9iLC0.o
a.cc:(.text+0xb1): relocation truncated to fit: R_X86_64_PC32 against symbol `use' defined in .bss section in /tmp/cck9iLC0.o
/tmp/cck9iLC0.o: in function `main':
a.cc:(.text+0x32c): relocation truncated to fit: R_X86_64_PC32 against symbol `judge' defined in .bss section in /tmp/cck9iLC0.o
a.cc:(.text+0x343): relocation truncated to fit: R_X86_64_PC32 against symbol `judge' defined in .bss section in /tmp/cck9iLC0.o
collect2: error: ld returned 1 exit status
Language: C++

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

int main() {
	int N, M;
	cin >> N >> M;
	vector<int> A(M), B(M);
	for (int i = 0; i < M; i++)
	{
		cin >> A[i] >> B[i];
	}

	vector<long long> ans(M);
	ans[M - 1] = (long long)N * (N - 1) / 2;

	UnionFind Uni(N);

	for (int i = M - 1; i >= 1; i--)
	{
		ans[i - 1] = ans[i];

		//繋がってなかったのが繋がった時
		if (Uni.root(A[i]) != Uni.root(B[i])) {
			ans[i - 1] -= (long long)Uni.size(A[i]) * Uni.size(B[i]);
			Uni.connect(A[i], B[i]);
		}
	}

	for (int i = 0; i < M; i++)
	{
		cout << ans[i] << endl;
	}

}

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい]
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

Compiler output:
a.cc: In function 'int main()':
a.cc:20:9: error: 'UnionFind' was not declared in this scope
   20 |         UnionFind Uni(N);
      |         ^~~~~~~~~
a.cc:27:21: error: 'Uni' was not declared in this scope
   27 |                 if (Uni.root(A[i]) != Uni.root(B[i])) {
      |                     ^~~
Language: C++

#include <iostream>
#include "union_find.h"
using namespace std;

#ifdef DEBUG
    #define IFD if(true)
#else
    #define IFD if(false)
#endif

#include <vector>

// 要素個数カウント付き Union Find

// 要素の型。int か long あたりを想定
template<typename T_uf_data>

class union_find
{
private:
    std::vector<T_uf_data> par; // 親 (parent) を指す
    std::vector<T_uf_data> rnk;
    std::vector<T_uf_data> cnt; // 引数の値が含まれるグループの要素数（ルートノードのみが意味を持つ）

    // その値を持つルートノードを返す
    T_uf_data find_root(int x)
    {
        if(par[x] == x) {
            return x;
        } else {
            return par[x] = find_root(par[x]);
        }
    }

public:

    // コンストラクタの引数で要素数を指定
    union_find(int n) : par(n), rnk(n), cnt(n)
    {
        for(int i = 0; i < n; i++) {
            par[i] = i; // 親を持たないノードは自分自身を親としておく
            rnk[i] = 0;
            cnt[i] = 1; // 初期状態ではすべてのノードの要素数は 1
        }
    }

    // 二つの要素をグループ化
    void unite(int x, int y)
    {
        x = find_root(x);
        y = find_root(y);
        if(x == y) return;

        if(rnk[x] < rnk[y]) {
            // y が親になる
            par[x] = y;
            cnt[y] += cnt[x];
        } else {
            // x が親になる
            par[y] = x;
            cnt[x] += cnt[y];
            if(rnk[x] == rnk[y]) rnk[x]++;
        }
    }

    // x と y が同じグループかを返す
    bool same(int x, int y)
    {
        return find_root(x) == find_root(y);
    }

    // x を含むグループの要素数を返す
    int size(int x)
    {
        return cnt[find_root(x)];
    }
};





int main()
{
    int N, M, A[100001], B[100001];
    long ans[100001];

    cin >> N >> M;
    union_find<int> uf(M + 1);

    for(int i = 1; i <= M; i++) {
        cin >> A[i] >> B[i];
    }
    ans[M] = N * (N - 1) / 2;

    for(int i = M - 1; i >= 1; i--) {
        int a = uf.size(A[i + 1]);
        int b = uf.size(B[i + 1]);
        uf.unite(A[i + 1], B[i + 1]);
        ans[i] = ans[i + 1] - a * b;
        if(ans[i] < 0) ans[i] = 0;
    }

    for(int i = 1; i <= M; i++) {
        cout << ans[i] << endl;
    }
    
    return 0;
}


Compiler output:
a.cc:2:10: fatal error: union_find.h: No such file or directory
    2 | #include "union_find.h"
      |          ^~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include "union_find.h"
using namespace std;

#ifdef DEBUG
    #define IFD if(true)
#else
    #define IFD if(false)
#endif

int main()
{
    int N, M, A[100001], B[100001];
    long ans[100001];

    cin >> N >> M;
    union_find<int> uf(M + 1);

    for(int i = 1; i <= M; i++) {
        cin >> A[i] >> B[i];
    }
    ans[M] = N * (N - 1) / 2;

    for(int i = M - 1; i >= 1; i--) {
        int a = uf.size(A[i + 1]);
        int b = uf.size(B[i + 1]);
        uf.unite(A[i + 1], B[i + 1]);
        ans[i] = ans[i + 1] - a * b;
        if(ans[i] < 0) ans[i] = 0;
    }

    for(int i = 1; i <= M; i++) {
        cout << ans[i] << endl;
    }
    
    return 0;
}


Compiler output:
a.cc:2:10: fatal error: union_find.h: No such file or directory
    2 | #include "union_find.h"
      |          ^~~~~~~~~~~~~~
compilation terminated.