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

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

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

const int max_v = 1e+5;
vector<bool> visited(2*max_v+1, false);

void dfs(int pos, vector<int>& num_v, vector<vector<int>>& G){
    if(visited[pos]) return;
    visited[pos] = true;
    ++num_v[pos/max_v];
    for(int v: G[pos]){
        dfs(v, num_v, G);
    }
}

int main()
{
    int N;
    cin >> N;
    vector<vector<int>> G(2*max_v+1);  // y は +max_v して頂点にする
    REP(i, N){
        int x, y;
        cin >> x >> y;
        y += max_v;
        G[x].push_back(y);
        G[y].push_back(x);
    }

    long long ans = 0;
    // 答えはグラフを連結成分ごとに完全二部グラフにするのに必要な本数の和
    // つまり、連結成分ごとの x, y の頂点数が必要
    REP(i, 2*max_v){
        vector<long long> num_v(2);
        dfs(i, num_v, G);
        ans += num_v[0]*num_v[1];
    }
    cout << ans-N << endl;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:16: error: invalid initialization of reference of type 'std::vector<int>&' from expression of type 'std::vector<long long int>'
   39 |         dfs(i, num_v, G);
      |                ^~~~~
a.cc:12:32: note: in passing argument 2 of 'void dfs(int, std::vector<int>&, std::vector<std::vector<int> >&)'
   12 | void dfs(int pos, vector<int>& num_v, vector<vector<int>>& G){
      |                   ~~~~~~~~~~~~~^~~~~
Language: C++

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

int main() {
    int N;
    cin >> N;
    vector<int>x(N);
    vector<int>y(N);
    for (int i = 0; i < N; ++i) {
      cin >> x[i] >> y[i];
    }

    // x, yをソート
    vector<pair<int, int>> xy(N);
    for (int i = 0; i < N; ++i) {
        xy[i] = make_pair(x[i], y[i]);
        yx[i] = make_pair(y[i], x[i]);
    }
    sort(xy.begin(), xy.end());
    sort(yx.begin(), yx.end());
    for (int i = 0; i < N; ++i) {
        x[i] = xy[i].first;
        y[i] = yx[i].second;
    }

    // mapで探索済みか管理
    map<pair<int, int>, int> mp;
    for (int i = 0; i < N; ++i) {
        mp[xy[i]] = 0;
    }

    ll ans = 0; // 操作後の点の数
    set<int> setX;
    set<int> setY;
    stack<pair<int, int>> st;
    stack<int> coY; // stの点とx座標が同じ点のy座標
    for (int i = 0; i < N; ++i) {
        if(mp[xy[i]] == 0){
            st.push(xy[i]);
            while (! st.empty()){
                while (! st.empty()){
                    auto top = st.top();
                    st.pop();
                    if(setX.count(top.first) == 0){
                        setX.insert(top.first);
                        auto iter1 = lower_bound(x.begin(), x.end(), top.first);
                        auto iter2 = upper_bound(x.begin(), x.end(), top.first);
                        for (int j = iter1 - x.begin(); j < iter2 - x.begin(); ++j) {
                            if(mp[xy[j]] == 0){
                                mp[xy[j]] = 1;
                                coY.push(xy[j].second);
                            }
                        }
                    }
                }
                while (! coY.empty()){
                    int top = coY.top();
                    coY.pop();
                    if(setY.count(top) == 0){
                        setY.insert(top);
                        auto iter1 = lower_bound(y.begin(), y.end(), top);
                        auto iter2 = upper_bound(y.begin(), y.end(), top);
                        for (int j = iter1 - y.begin(); j < iter2 - y.begin(); ++j) {
                            if(mp[yx[j]] == 0){
                                mp[yx[j]] = 1;
                                st.push(yx[j]);
                            }
                        }
                    }
                }
            }

            ll temp = setX.size();
            temp *= setY.size();
            ans += temp;
            setX.clear();
            setY.clear();
        }
    }

    ans -= N;
    cout << ans;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: 'yx' was not declared in this scope; did you mean 'xy'?
   18 |         yx[i] = make_pair(y[i], x[i]);
      |         ^~
      |         xy
a.cc:21:10: error: 'yx' was not declared in this scope; did you mean 'xy'?
   21 |     sort(yx.begin(), yx.end());
      |          ^~
      |          xy
Language: C++

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

int main() {
    int N;
    cin >> N;
    vector<int>x(N);
    vector<int>y(N);
    for (int i = 0; i < N; ++i) {
      cin >> x[i] >> y[i];
    }

    // x, yをソート
    vector<pair<int, int>> xy(N);
    for (int i = 0; i < N; ++i) {
        xy[i] = make_pair(x[i], y[i]);
    }
    sort(xy.begin(), xy.end());
    for (int i = 0; i < N; ++i) {
        x[i] = xy[i].first;
        y[i] = xy[i].second;
    }

    // mapで探索済みか管理
    map<pair<int, int>, int> mp;
    for (int i = 0; i < N; ++i) {
        mp[xy[i]] = 0;
    }

    ll ans = 0; // 操作後の点の数
    for (int i = 0; i < N; ++i) {
        if(mp[xy[i]] == 0){
            set<int> setX;
            set<int> setY;
            stack<pair<int, int>> st;
            st.push(xy[i]);
            while (true){
                int x_temp = setX.size();
                int y_temp = setY.size();
                stack<int> coY; // stの点とx座標が同じ点のy座標
                while (! st.empty()){
                    auto top = st.top();
                    st.pop();
                    if(setX.count(top.first) == 0){
                        setX.insert(top.first);
                        auto iter1 = lower_bound(x.begin(), x.end(), top.first);
                        auto iter2 = upper_bound(x.begin(), x.end(), top.first);
                        for (int j = iter1 - x.begin(); j < iter2 - x.begin(); ++j) {
                            if(mp[xy[j]] == 0){
                                mp[xy[j]] = 1;
                                coY.push(y[j]);
                            }
                        }
                    }
                }
                while (! coY.empty()){
                    int top = coY.top();
                    coY.pop();
                    if(setY.count(top) == 0){
                        setY.insert(top);
                        auto iter1 = lower_bound(y.begin(), y.end(), top);
                        auto iter2 = upper_bound(y.begin(), y.end(), top);
                        for (int j = iter1 - y.begin(); j < iter2 - y.begin(); ++j) {
                            if(mp[xy[j]] == 0){
                                mp[xy[j]] = 1;
                                st.push(xy[j]);
                            }
                        }
                    }
                }
                if(x_temp == setX.size() && y_temp == setY.size()) break;
            }
            
            ll temp = setX.size();
            temp *= setY.size()
            ans += temp;
        }
    }

    ans -= N;
    cout << ans;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:76:32: error: expected ';' before 'ans'
   76 |             temp *= setY.size()
      |                                ^
      |                                ;
   77 |             ans += temp;
      |             ~~~
Language: C++

#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int p[100010];
set<int> idx[100010];
int root(int x){
	if(p[x] == x) return x;
	return p[x] = root(p[x]);
}
void merge(int a, int b){
	a = root(a);
	b = root(b);
	if(a == b) return;
	if(idx[a].size() < idx[b].size()) swap(a, b);
	for(int i : idx[b]) idx[a].insert(i);
	p[b] = a;
}

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n; cin >> n;
	map<int, vi> yoko, tate;
	vi ys;
	rep(i, n){
		int a, b; cin >> a >> b;
		yoko[b].pb(a);
		tate[a].pb(b);
		ys.pb(b);
	}
	sort(all(ys)); ys.erase(unique(all(ys)), ys.end());
	rep(i, ys.size()){
		p[i] = i;
		idx[i].insert(i);
	}
	
	for(const auto &it : tate){
		const vi &t = it.second;
		for(int i = 0; i + 1 < t.size(); i++){
			int a = lower_bound(all(ys), t[i]) - ys.begin();
			int b = lower_bound(all(ys), t[i + 1]) - ys.begin();
			merge(a, b);
		}
	}
	
	ll ans = 0;
	for(const auto it : ys){
		int r = root(it);
		if(it != r)) continue;
		
		set<int> xs;
		ll cnt = 0;
		for(int j : idx[r]){
			cnt += yoko[ys[j]].size();
			for(int i : yoko[ys[j]]) xs.insert(i);
		}
		//dbg(it, r); dbg(xs, idx[r]);
		ans += (ll)xs.size() * idx[r].size() - cnt;
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:60:28: error: expected primary-expression before ')' token
   60 |                 if(it != r)) continue;
      |                            ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>
#include <map>

using namespace std;

using P = pair<int, int>;
using i64 = int64_t;
i64 mod = 1000000007;

int max_n = 1e5;

void bfs(std::vector<std::vector<int>>& g, std::vector<bool>& v, int x, std::vector<int>& cnt, int dep) {
    if (v[x] == true) return;
    v[x] = true;
    if (x > max_n) ++cnt[1];
    else ++cnt[0];

    for (int i : g[x]) {
        //cout << i << endl;
        bfs(g, v, i, cnt, dep + 1);
    }
}

int main(int argc, char **argv) {
    int n;
    cin >> n;
    std::vector<std::vector<int>> g(max_n*2 + 10, std::vector<int>());
    std::vector<bool> visit(max_n*2 + 10, false);

    for (int i=0; i<n; ++i) {
        int x, y;
        cin >> x >> y;
        g[x].push_back(y + max_n);
        g[y + max_n].push_back(x);
    }
    i64 ans{0};
    for (int i = 0; i < max_n*2+1; ++i) {
        std::vector<i64> cnt(2, 0);
        bfs(g, visit, i, cnt, 0);

        ans += (cnt[0] * cnt[1]);
    }

    cout << (ans - n) << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:44:26: error: invalid initialization of reference of type 'std::vector<int>&' from expression of type 'std::vector<long int>'
   44 |         bfs(g, visit, i, cnt, 0);
      |                          ^~~
a.cc:17:91: note: in passing argument 4 of 'void bfs(std::vector<std::vector<int> >&, std::vector<bool>&, int, std::vector<int>&, int)'
   17 | void bfs(std::vector<std::vector<int>>& g, std::vector<bool>& v, int x, std::vector<int>& cnt, int dep) {
      |                                                                         ~~~~~~~~~~~~~~~~~~^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define LL long long
int main() {
    int N;
    set<int> x,y;
    for(int i=0; i<N; i++){
        int a,b;
        cin >> a >> b;
        x.insert(a);
        y.insert(b);
    }
    cout << max(0, (LL)x.size()*(LL)y.size() - N) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:16: error: no matching function for call to 'max(int, long long int)'
   13 |     cout << max(0, (LL)x.size()*(LL)y.size() - N) << endl;
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:13:16: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   13 |     cout << max(0, (LL)x.size()*(LL)y.size() - N) << endl;
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:13:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   13 |     cout << max(0, (LL)x.size()*(LL)y.size() - N) << endl;
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>

using namespace std;

int main() {
    int N;
    set<int> x,y;
    for(int i=0; i<N; i++){
        int a,b;
        cin >> a >> b;
        x.insert(a);
        y.insert(b);
    }
    cout << max(0, (LL)x.size()*(LL)y.size() - N) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'set' was not declared in this scope
    7 |     set<int> x,y;
      |     ^~~
a.cc:2:1: note: 'std::set' is defined in header '<set>'; this is probably fixable by adding '#include <set>'
    1 | #include <iostream>
  +++ |+#include <set>
    2 | 
a.cc:7:9: error: expected primary-expression before 'int'
    7 |     set<int> x,y;
      |         ^~~
a.cc:11:9: error: 'x' was not declared in this scope
   11 |         x.insert(a);
      |         ^
a.cc:12:9: error: 'y' was not declared in this scope
   12 |         y.insert(b);
      |         ^
a.cc:14:21: error: 'LL' was not declared in this scope
   14 |     cout << max(0, (LL)x.size()*(LL)y.size() - N) << endl;
      |                     ^~
Language: C++

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

struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }
    
    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};

const long long MAX = 110000;
long long N;
vector<long long> x, y;

long long solve() {
    UnionFind uf(MAX * 2);
    x.resize(N); y.resize(N);
    for (int i = 0; i < N; ++i) cin >> x[i] >> y[i], uf.merge(x[i], y[i] + MAX);

    // 連結成分ごとに、左ノードと右ノードの個数を数える
    map<int, long long> mx, my;
    for (int i = 0; i < MAX; ++i) mx[uf.root(i)]++;
    for (int i = MAX; i < MAX*2; ++i) my[uf.root(i)]++;
    long long res = 0;
    for (int r = 0; r < MAX*2; ++r) res += mx[r] * my[r];
    return res - N;
}

int main() {
    cin >> N;
    cout << solve() << endl;
}
}

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

#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=1e5+10;
int n,x[N],y[N],fa[N],sz[N];
map<int,int>X,2Y,cx[N],cy[N];
int find(int x)
{
	if(fa[x]==x)return x;
	fa[x]=find(fa[x]);
	return fa[x];
}
int main()
{
    scanf("%d",&n);
    int fx,fy;
    for(int i=1;i<=n;i++)
	{
        fa[i]=i;
        sz[i]=1;
        scanf("%d%d",&x[i],&y[i]);
        if(!X.count(x[i]))X[x[i]]=i;
        fx=find(X[x[i]]);
        if(!Y.count(y[i]))Y[y[i]]=i;
        fy=find(Y[y[i]]);
        if(fx!=fy)
		{
            if(sz[fx]<sz[fy])swap(fx,fy);
            fa[fy]=fx;
            sz[fx]+=sz[fy];
            X[x[i]]=fx;
            Y[y[i]]=fx;
        }
    }
    ll ans=0;
    for(int i=1;i<=n;i++)
	{
        fx=find(X[x[i]]);
        cx[fx][x[i]]++;
        cy[fx][y[i]]++;
    }
    for(int i=1;i<=n;i++)
        if(fa[i]==i)
            ans=ans+1ll*cx[i].size()*cy[i].size()-sz[i];
    cout<<ans;
    return 0;
}

Compiler output:
a.cc:6:15: error: expected unqualified-id before numeric constant
    6 | map<int,int>X,2Y,cx[N],cy[N];
      |               ^~
a.cc: In function 'int main()':
a.cc:24:13: error: 'Y' was not declared in this scope
   24 |         if(!Y.count(y[i]))Y[y[i]]=i;
      |             ^
a.cc:25:17: error: 'Y' was not declared in this scope
   25 |         fy=find(Y[y[i]]);
      |                 ^
a.cc:39:9: error: 'cx' was not declared in this scope; did you mean 'fx'?
   39 |         cx[fx][x[i]]++;
      |         ^~
      |         fx
a.cc:40:9: error: 'cy' was not declared in this scope; did you mean 'fy'?
   40 |         cy[fx][y[i]]++;
      |         ^~
      |         fy
a.cc:44:25: error: 'cx' was not declared in this scope; did you mean 'fx'?
   44 |             ans=ans+1ll*cx[i].size()*cy[i].size()-sz[i];
      |                         ^~
      |                         fx
a.cc:44:38: error: 'cy' was not declared in this scope; did you mean 'fy'?
   44 |             ans=ans+1ll*cx[i].size()*cy[i].size()-sz[i];
      |                                      ^~
      |                                      fy
Language: C++

#include <bits/stdc++.h>

using namespace std;

const int V = 100005;
vector<int> to[V * 2];
bool visited[V * 2];

vector<int> cnt;
void dfs(int v)
{
	//cout << "dfs(" << v << ")" << endl;
	if (visited[v])
	{
		//cout << v << " is visited(in dfs)." << endl;
		return;
	}
	visited[v] = true;
	cnt[v / V]++;
	for (int u : to[v])
		dfs(u);
}

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

	for (int i = 0; i < n; ++i)
	{
		int x, y;
		cin >> x >> y;
		y += V;
		to[x].push_back(y);
		to[y].push_back(x);
	}

	unsigned long long ans = 0;
	for (int i = 0; i < V * 2; ++i)
	{
		cnt = vector<unsigned long long>(2);
		if (visited[i])
		{
			//cout << i << " is visited at first." << endl;
			//cout << i << ":" << cnt[0] << " " << cnt[1] << endl;
			continue;
		}
		dfs(i);
		ans += (unsigned long long)(cnt[0] * cnt[1]);
		//cout << i << ":" << cnt[0] << " " << cnt[1] << endl;
	}
	ans -= n;
	cout << ans << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:51: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'std::vector<long long unsigned int>')
   41 |                 cnt = vector<unsigned long long>(2);
      |                                                   ^
In file included from /usr/include/c++/14/vector:72,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'std::vector<long long unsigned int>' to 'const std::vector<int>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'std::vector<long long unsigned int>' to 'std::vector<int>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'std::vector<long long unsigned int>' to 'std::initializer_list<int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
Language: C++

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

struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }
    
    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};

long long N;
vector<long long> x, y, ax, ay;

long long solve() {
    // 座標圧縮
    x.resize(N); y.resize(N); ax.clear(); ay.clear();
    for (int i = 0; i < N; ++i) {
        cin >> x[i] >> y[i];
        ax.push_back(x[i]);
        ay.push_back(y[i]);
    }
    sort(ax.begin(), ax.end());
    ax.erase(unique(ax.begin(), ax.end()), ax.end());
    sort(ay.begin(), ay.end());
    ay.erase(unique(ay.begin(), ay.end()), ay.end());

    // 連結成分分解
    int nx = ax.size(), ny = ay.size();
    UnionFind uf(nx + ny);
    for (int i = 0; i < N; ++i) {
        int ix = lower_bound(ax.begin(), ax.end(), x[i]) - ax.begin();
        int iy = lower_bound(ay.begin(), ay.end(), y[i]) - ay.begin();
        uf.merge(ix, iy+nx);
    }

    // 連結成分ごとに、左ノードと右ノードの個数を数える
    map<int, long long> mx, my;
    for (int i = 0; i < nx; ++i) {
        int r = uf.root(i);
        mx[r]++;
    }
    for (int i = nx; i < nx + ny; ++i) {
        int r = uf.root(i);
        my[r]++;
    }

    long long res = 0;
    for (int r = 0; r < nx + ny; ++r) {
        res += mx[r] * my[r];
    }
    return res - N;
}

int main() {
    cin >> N;
    cout << solve() << endl;
}

Compiler output:
a.cc: In function 'long long int solve()':
a.cc:46:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   46 |     sort(ax.begin(), ax.end());
      |     ^~~~
      |     short
a.cc:47:14: error: 'unique' was not declared in this scope
   47 |     ax.erase(unique(ax.begin(), ax.end()), ax.end());
      |              ^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

typedef struct{
  vector<int> to;
}edge;

const int V_MAX = 1e5+1;
bool used[2][V_MAX];
edge G[2][V_MAX];
ll num[2];
vector<vector<int> > node;
set<PII> st;
//cur=0:x,cur=1:y
//vertex:頂点
ll dfs(int cur,int vertex){
  if(used[cur][vertex]) return 0;
  used[cur][vertex] = true;
  num[cur]++;
  ll n_edge = 0;
  rep(i,G[cur][vertex].to.size()){
    PII p;
    if(cur == 0) p = PII(vertex,G[cur][vertex].to[i]);
    else p = PII(G[cur][vertex].to[i],vertex);
    if(st.count(p)) continue;
    st.insert(p);
    n_edge++;
    n_edge += dfs(cur^1,G[cur][vertex].to[i]);
  }
  return n_edge;
}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  node.resize(2);
  int N;cin >> N;
  rep(i,N){
    int x,y;cin >> x >> y;
    G[0][x].to.push_back(y);
    G[1][y].to.push_back(x);
    node[0].push_back(x);
    node[1].push_back(y);
  }
  sort(all(node[0]));
  sort(all(node[1]));
  node[0].erase( unique(all(node[0])), node[0].end() );
  node[1].erase( unique(all(node[1])), node[1].end() );

  ll ans = 0;
  rep(i,node[0].size()){
    if(used[0][node[0][i]])continue;
    num[0] = 0;
    num[1] = 0;
    ll n_edge = dfs(0,node[0][i]);
    ans  max(0ll, num[0]*num[1] - n_edge);
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:84:8: error: expected ';' before 'max'
   84 |     ans  max(0ll, num[0]*num[1] - n_edge);
      |        ^ ~~~
      |        ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(ll i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(ll i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(ll i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(ll i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<ll,ll> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,ll> PCI;
  typedef pair<ll,char> PIC;
  typedef pair<ll,ll> PLI;
  typedef pair<ll,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

typedef struct{
  vector<ll> to;
}edge;

const ll V_MAX = 1e5+1;
bool used[2][V_MAX];
edge G[2][V_MAX];
ll num[2];
vector<vector<ll> > node;
set<PII> st;
//cur=0:x,cur=1:y
//vertex:頂点
ll dfs(ll cur,ll vertex){
  if(used[cur][vertex]) return 0;
  used[cur][vertex] = true;
  num[cur]++;
  ll n_edge = 0;
  rep(i,G[cur][vertex].to.size()){
    PII p;
    if(cur == 0) p = PII(vertex,G[cur][vertex].to[i]);
    else p = PII(G[cur][vertex].to[i],vertex);
    if(st.count(p)) continue;
    st.insert(p);
    cout << p.first SP p.second << endl;
    n_edge++;
    n_edge += dfs(cur^1,G[cur][vertex].to[i]);
  }
  return n_edge;
}

ll main(void){
  SPEEDUP
  cout << setprecision(15);
  node.resize(2);
  ll N;cin >> N;
  rep(i,N){
    ll x,y;cin >> x >> y;
    G[0][x].to.push_back(y);
    G[1][y].to.push_back(x);
    node[0].push_back(x);
    node[1].push_back(y);
  }
  sort(all(node[0]));
  sort(all(node[1]));
  node[0].erase( unique(all(node[0])), node[0].end() );
  node[1].erase( unique(all(node[1])), node[1].end() );
  cout << endl;

  ll ans = 0;
  rep(i,node[0].size()){
    if(used[0][node[0][i]])continue;
    num[0] = 0;
    num[1] = 0;
    ll n_edge = dfs(0,node[0][i]);
    ans += max(0ll, num[0]*num[1] - n_edge);
    cout << node[0][i] SP num[0]*num[1] SP n_edge << endl;
  }
  cout << ans << endl;
  return 0;
}


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

#include<cstdio>
#define maxn 100010
using namespace std;
int n,cnt,f[maxn<<1],sx[maxn<<1],sy[maxn<<1],mp1[maxn],mp2[maxn];
inline int find(int x){return x==f[x]?x:f[x]=find(f[x]);}
inline void link(int x,int y){
	x=find(x),y=find(y);
	if(x==y)return;
	f[x]=y,sx[y]+=sx[x],sy[y]+=sy[x]; 
}
int main(){
	scanf("%d",&n);
	cnt=0;
	for(int i=1;i<=n;++i){
		int x,y;
		scanf("%d%d",&x,&y);
		if(!mp1.count(x)){sx[mp1[x]=++cnt]=1;f[cnt]=cnt;}
		if(!mp2.count(y)){sy[mp2[y]=++cnt]=1;f[cnt]=cnt;}
		link(mp1[x],mp2[y]);
	}
	long long ans=-n;
	for(int i=1;i<=cnt;++i)if(f[i]==i)ans+=1ll*sx[i]*sy[i];
	printf("%lld\n",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:25: error: request for member 'count' in 'mp1', which is of non-class type 'int [100010]'
   17 |                 if(!mp1.count(x)){sx[mp1[x]=++cnt]=1;f[cnt]=cnt;}
      |                         ^~~~~
a.cc:18:25: error: request for member 'count' in 'mp2', which is of non-class type 'int [100010]'
   18 |                 if(!mp2.count(y)){sy[mp2[y]=++cnt]=1;f[cnt]=cnt;}
      |                         ^~~~~
Language: C++

#include<bits/stdc++.h>
#define N 100005
#define LL long long
using namespace std;
template<class T>inline void Rd(T &x){
	x=0;char c=getchar();bool f=0;
	while(c<'0'||c>'9'){if(c=='-')f^=1;c=getchar();}
	while(c>='0'&&c<='9')x=(x<<1)+(x<<3)+c-'0',c=getchar();
	if(f)x=-x;
}
int n;
int X[N],Y[N];
int fa[N<<1];
int get(int x){return x==fa[x]?x:fa[x]=get(fa[x]);}
LL cnt[2][N];

int main(){
	Rd(n);
	for(register int i=1;i<(N<<1);++i)fa[i]=i;
	for(register int i=1,x,y;i<=n;++i){
		Rd(x),Rd(y);
		fa[get(x)]=get(y+N);
	}
	for(register int i=1;i<=N;++i)++cnt[0][get(i)]
	for(register int i=1+N;i<=(N<<1);++i)++cnt[1][get(i)];;
	LL sum=0;
	for(register int i=1;i<=(N<<1);++i)
		sum+=cnt[0][i]*cnt[1][i];
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   19 |         for(register int i=1;i<(N<<1);++i)fa[i]=i;
      |                          ^
a.cc:20:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   20 |         for(register int i=1,x,y;i<=n;++i){
      |                          ^
a.cc:20:30: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   20 |         for(register int i=1,x,y;i<=n;++i){
      |                              ^
a.cc:20:32: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   20 |         for(register int i=1,x,y;i<=n;++i){
      |                                ^
a.cc:24:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   24 |         for(register int i=1;i<=N;++i)++cnt[0][get(i)]
      |                          ^
a.cc:24:55: error: expected ';' before 'for'
   24 |         for(register int i=1;i<=N;++i)++cnt[0][get(i)]
      |                                                       ^
      |                                                       ;
   25 |         for(register int i=1+N;i<=(N<<1);++i)++cnt[1][get(i)];;
      |         ~~~                                            
a.cc:25:32: error: 'i' was not declared in this scope
   25 |         for(register int i=1+N;i<=(N<<1);++i)++cnt[1][get(i)];;
      |                                ^
a.cc:27:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   27 |         for(register int i=1;i<=(N<<1);++i)
      |                          ^
a.cc:29:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
   29 |         cout<<ans<<endl;
      |               ^~~
      |               abs
Language: C++

void solve();

int main() {
	solve();
	return 0;
}

//////////////////////////////////////////////////
//////////////////////////////////////////////////
#include <iostream>
#include <vector>
#include <algorithm>
#include <limits.h>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
using namespace std;
typedef pair<int, int> pii;

//unionFind
class unionFind {
private:
	int* p;   //親配列のポインタ
	int* rank;
	int N;   //要素数
public:
	unionFind(int);   //コンストラクタ
	int parent(int);   //親要素を返す
	void unit(int, int);   //2要素をつなぐ
	int operator[](int);   //parentの省略形
	~unionFind();
	int size();   //要素数を返す
};

unionFind::unionFind(int n) {
	N = n;
	p = new int[N];
	rank = new int[N];
	for (int i = 0; i < N; i++) {
		p[i] = i;
		rank[i] = 0;
	}
	return;
}

int unionFind::parent(int n) {
	if (n < 0 || n >= N)return -1;
	if (p[n] == n)return n;   //自分が一番上の親
	return p[n] = parent(p[n]);   //つなぎ直しと上にたどる操作
}

int unionFind::operator[](int n) {
	return parent(n);
}

void unionFind::unit(int x, int y) {
	x = parent(x), y = parent(y);
	if (x == y)return;   //根が同じだから何もせずに帰る
	if (rank[x] < rank[y])p[x] = y;
	else {
		p[y] = x;
		if (rank[x] == rank[y])rank[x]++;
	}
	return;
}

unionFind::~unionFind() {
	delete(p);
	delete(rank);
	return;
}

int unionFind::size() {
	return N;
}

int N;
vector<pii> points;
vector<bool> checked;
set<int> samey[100001];
vector<set<int>> xcount;
int parentcount[100001];

void solve() {
	cin >> N;
	points.resize(N);
	checked.resize(N, false);
	xcount.resize(100001);
	//memset(xcount, 0, 100001);
	memset(parentcount, 0, 100001);
	for (int n = 0; n < N; n++) {
		cin >> points[n].first >> points[n].second;
		samey[points[n].second].insert(n);

	}
	unionFind uf(100001);
	for (int n = 0; n < N; n++) {
		if (checked[n])continue;
		checked[n] = true;
		for (auto itr = samey[points[n].second].begin(); itr != samey[points[n].second].end(); itr++) {
			uf.unit(points[*itr].first,points[n].first);
			checked[*itr] = true;
		}
	}
	for (int n = 0; n < N; n++) {
		xcount[uf.parent(points[n].first)].insert(points[n].second);
	}
	for (int x = 1; x <= 100000; x++) {
		parentcount[uf[x]]++;
	}
	long long sum = 0;
	for (int x = 1; x <= 100000; x++) {
		if (xcount[x].size() != 0)sum += xcount[x].size() * parentcount[x];
	}
	cout << sum - N << endl;
	return;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:91:9: error: 'memset' was not declared in this scope
   91 |         memset(parentcount, 0, 100001);
      |         ^~~~~~
a.cc:18:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   17 | #include <set>
  +++ |+#include <cstring>
   18 | using namespace std;
Language: C++

#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
ll x[111111],y[111111];
ll zip[111111],zip2[111111];
bool flfl[111111],flfl2[111111];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;cin>>n;
  set<ll> A,B;
  vector<pair<ll,ll>>pll(n);
  for(int i=0;i<n;i++){
    ll a,b;cin>>a>>b;
    x[a]++;y[b]++;
    pll[i]=mp(a,b);
  }
  if(n<=2){cout<<0<<endl;return 0;}

  vector<pair<ll,ll>>pll2;
  set<ll> AA,BB;
  for(int i=0;i<n;i++){
  if(x[pll[i].F]>=2&&y[pll[i].S]>=2){
    AA.insert(pll[i].F);
    BB.insert(pll[i].S);
    flfl[pll[i].F]=true;
    flfl2[pll[i].S]=true;
  }
  for(auto a:AA){
    A.insert(a);
  }
  for(auto a:BB)
    B.insert(b);
  ll cnt=0;
  for(auto a:A){
    zip[a]=cnt;
    cnt++;
  }
  cnt=0;
  for(auto a:B){
    zip2[a]=cnt;
    cnt++;
  }
  bool fl=false;
  for(int i=0;i<n;i++){
    if((flfl[pll[i].F]||flfl2[pll[i].S])&&(x[pll[i].F]>=2||y[pll[i].S]>=2)){
      pll2.pb(mp(zip[pll[i].F],zip2[pll[i].S]));
    }
  }
  if(pll2.size()==0){cout<<0<<endl;return 0;}
  ll xma=-1,xmi=llINF,yma=-1,ymi=llINF;
  
  for(int i=0;i<pll2.size();i++){
    xma=max(xma,pll2[i].F);
    xmi=min(xmi,pll2[i].F);
    yma=max(yma,pll2[i].S);
    ymi=min(ymi,pll2[i].S);
  }
  if(fl){
  // cout<<xma<<" "<<xmi<<" "<<yma<<" "<<ymi<<endl;
  cout<<(xma-xmi+1)*(yma-ymi+1)-pll2.size()<<endl;
  }else cout<<0<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:14: error: 'b' was not declared in this scope
   49 |     B.insert(b);
      |              ^
a.cc:80:2: error: expected '}' at end of input
   80 | }
      |  ^
a.cc:23:11: note: to match this '{'
   23 | int main(){
      |           ^
Language: C++

#pragma once
#include "stdafx.h"
#include<math.h>
#include<iostream>
#include <algorithm>
#include <string>
#include<vector>
#include <array>
#include<tuple>
#include<queue>
#include<stack>
#include<iomanip>
//AtCoderC++.cpp

using namespace std;

int main() {
	int N; cin >> N;
	if (N < 3) {
		cout << 0 << endl;
		return 0;
	}
	int xcount = 0;
	int ycount = 0;
	auto xs = vector<bool>(100000);
	auto ys = vector<bool>(100000);
	auto row = vector<bool>(100000);
	auto col = vector<bool>(100000);
	int x, y;
	for (size_t i = 0; i < N; i++) {
		cin >> x >> y;
		if (!xs[x]) {
			xs[x] = true;
		} else {
			row[x] = true;
			xcount++;
		}
		if (!ys[y]) {
			ys[y] = true;
		} else {
			col[y] = true;
			ycount++;
		}
	}
	cout << xcount * ycount << endl;
}


Compiler output:
a.cc:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
a.cc:2:10: fatal error: stdafx.h: No such file or directory
    2 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

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

typedef long long ll;
ll g=1e6;

int par[100010];
int ran[100010];
int sized[100010];

void init(int n){
  for(int i=0;i<n;i++){
    par[i]=i;
    ran[i]=0;
    sized[i]=1;
  }
}

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

void unite(int x,int y){
  x=find(x);
  y=find(y);
  if(x==y) return;
  if(ran[x]<ran[y]){
    par[x]=y;
    sized[y]+=sized[x];
    sized[x]=0;
  }
  else{
    par[y]=x;
    sized[x]+=sizedy];
    sized[y]=0;
    if(ran[x]==ran[y]) ran[x]++;
  }
}


int main(){
  ll n;
  cin >> n;
  init(n);
  ll a[n],b[n],c[n];
  for(int i=0;i<n;i++){
    cin >> a[i] >> b[i];
    c[i]=i;
  }
  
  ll sum[n];
  
  for(int i=0;i<n;i++){
    sum[i]=a[i]*g*g+b[i]*g+c[i];
  }
  sort(sum,sum+n);
  for(int i=0;i<n;i++){
    a[i]=sum[i]/(g*g);
    b[i]=(sum[i]-a[i]*g*g)/g;
    c[i]=sum[i]%g;
  }
  for(int i=0;i<n;i++){
    if(i!=0&&a[i]==a[i-1]){
      unite(c[i],c[i-1]);
    }
    else if(i!=n-1&&a[i]==a[i+1]){
      unite(c[i],c[i+1]);
    }
  }
  
  for(int i=0;i<n;i++){
    sum[i]=b[i]*g*g+a[i]*g+c[i];
  }
  sort(sum,sum+n);
  for(int i=0;i<n;i++){
    b[i]=sum[i]/(g*g);
    a[i]=(sum[i]-b[i]*g*g)/g;
    c[i]=sum[i]%g;
  }
  for(int i=0;i<n;i++){
    if(i!=0&&b[i]==b[i-1]) unite(c[i],c[i-1]);
    else if(i!=n-1&&b[i]==b[i+1]) unite(c[i],c[i+1]);
  }
  
  for(int i=0;i<n;i++){
    //cout << size[i] << endl;
  }
  
  ll set<int> st_a[n]={};
  ll set<int> st_b[n]={};
  for(int i=0;i<n;i++){
    int t1=find(c[i]);
    st_a[t1].insert(a[i]);
    st_b[t1].insert(b[i]);
  }
  ll ans=0;
  for(int i=0;i<n;i++){
    ans+=size(st_a[i])*size(st_b[i]);
  }
  cout << ans-n << endl;
  
}

Compiler output:
a.cc: In function 'void unite(int, int)':
a.cc:37:15: error: 'sizedy' was not declared in this scope; did you mean 'sized'?
   37 |     sized[x]+=sizedy];
      |               ^~~~~~
      |               sized
a.cc: In function 'int main()':
a.cc:92:15: error: invalid declarator before 'st_a'
   92 |   ll set<int> st_a[n]={};
      |               ^~~~
a.cc:93:15: error: invalid declarator before 'st_b'
   93 |   ll set<int> st_b[n]={};
      |               ^~~~
a.cc:96:5: error: 'st_a' was not declared in this scope
   96 |     st_a[t1].insert(a[i]);
      |     ^~~~
a.cc:97:5: error: 'st_b' was not declared in this scope
   97 |     st_b[t1].insert(b[i]);
      |     ^~~~
a.cc:101:15: error: 'st_a' was not declared in this scope
  101 |     ans+=size(st_a[i])*size(st_b[i]);
      |               ^~~~
a.cc:101:29: error: 'st_b' was not declared in this scope
  101 |     ans+=size(st_a[i])*size(st_b[i]);
      |                             ^~~~
Language: C++

#include <iostream>
#include <map>
#include <cmath>

using namespace std;

int main(){
  int N, a, b;
  cin >> N;
  map<int, int> x;
  map<int, int> y;
  maxi = -1;
  for (int i=0; i<N; i++){
    cin >> a >> b;
    x[a] += 1;
    y[b] += 1;
    maxi = max(maxi, max(a, b));
  }
  int res = 0;
  for (int i=0; i<maxi; i++){
    res += x[i] * y[i];
  }
  cout << res - N << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:3: error: 'maxi' was not declared in this scope
   12 |   maxi = -1;
      |   ^~~~
Language: Java

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn=200+10;
int vis[maxn][maxn];
struct Node
{
    int x,y;
    Node(){}
    Node(int a,int b):x(a),y(b){}
};
vector<Node >G;
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    if(n==0)
    {
         printf("-1\n");
        return 0;
    }
    int m=n-1;
    int sum=(m)*(m-1)/2;
    if(k>sum)
    {
        printf("-1\n");
        return 0;
    }
    for(int i=1;i<=m;i++)
    {
        G.push_back(Node(i,n));
    }

    int i=1,j=2;
    while(sum!=k)
    {
        sum--;
        G.push_back(Node(i,j));
        j++;
        if(j==m+1) i++,j=i+1;
    }

    printf("%d\n",G.size());
    for(int i=0;i<G.size();i++)
    {
        printf("%d %d\n",G[i].x,G[i].y);
    }
}


Compiler output:
Main.java:1: error: illegal character: '#'
#include<bits/stdc++.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include<bits/stdc++.h>
        ^
Main.java:3: error: class, interface, enum, or record expected
typedef long long LL;
^
Main.java:4: error: class, interface, enum, or record expected
const int maxn=200+10;
^
Main.java:5: error: class, interface, enum, or record expected
int vis[maxn][maxn];
^
Main.java:6: error: class, interface, enum, or record expected
struct Node
^
Main.java:9: error: class, interface, enum, or record expected
    Node(){}
    ^
Main.java:12: error: unnamed classes are a preview feature and are disabled by default.
vector<Node >G;
^
  (use --enable-preview to enable unnamed classes)
Main.java:16: error: illegal start of expression
    scanf("%d%d",&n,&k);
                 ^
Main.java:16: error: illegal start of expression
    scanf("%d%d",&n,&k);
                    ^
Main.java:40: error: ';' expected
        if(j==m+1) i++,j=i+1;
                      ^
11 errors
Language: C++

#include<bits/stdc++.h>

using namespace std;


int main(){
    int N; cin>>N;
  vector<int> X(N);
  vector<int> Y(N);
  int cntX=0,cntY=0,cnto=0;
  
  vector<tuple<int,int,int>> cX(N);
  
  for(int i=0;i<N;i++){
    cin>>X[i]>>Y[i];
    get<0>(cX[i])=X[i];
    get<1>(cX[i])=Y[i];
    get<2>(cX[i])=0;
  }
  
  sort(cX.begin(),cX.end());
  
  int memX=0;
  int cnt=0;
  for(int i=0;i<N;i++){
    if(get<0>(cX[i])!=memX){
      if(memX!=0) check[cnt++]=get<1>(cX[i]);
      cntX++;
    }
    if(get<0>(cX[i])==memX){
    	get<2>(cX[i])=1;
      get<2>(cX[i-1])=1;
    }
	memX=get<0>(cX[i]);
  }
  
  //入れ替え
  for(int i=0;i<N;i++){
  	int tmp=get<1>(cX[i]);
    get<1>(cX[i])=get<0>(cX[i]);
    get<0>(cX[i])=tmp;
  }
  
  sort(cX.begin(),cX.end());
  
   memX=0;
  int flag=0;
  for(int i=0;i<N;i++){
    if(get<0>(cX[i])!=memX) cntY++;
    if(get<0>(cX[i])==memX){
    	get<2>(cX[i])=1;
      get<2>(cX[i-1])=1;
      if(flag==0){
      	for(int j=0;j<cnt;j++){
        	if(check[j]==get<0>(cX[i])){
            	flag=1;
              break;
            }
        }
      }
    }
	memX=get<0>(cX[i]);
  }
  for(int i=0;i<N;i++){
  	if(get<2>(cX[i])==0) cnto++;
  }
  
  if(N<=2 || flag==0) printf("0");
    else printf("%d",(cntX-cnto)*(cntY-cnto)-(N-cnto));
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:19: error: 'check' was not declared in this scope
   27 |       if(memX!=0) check[cnt++]=get<1>(cX[i]);
      |                   ^~~~~
a.cc:55:20: error: 'check' was not declared in this scope
   55 |                 if(check[j]==get<0>(cX[i])){
      |                    ^~~~~
Language: C++

#include<bits/stdc++.h>

using namespace std;


int main(){
    int N; cin>>N;
  vector<int> X(N);
  vector<int> Y(N);
  int cntX=0,cntY=0,cnto=0;
  
  vector<tuple<int,int,int>> cX(N);
  
  for(int i=0;i<N;i++){
    cin>>X[i]>>Y[i];
    get<0>(cX[i])=X[i];
    get<1>(cX[i])=Y[i];
    get<2>(cX[i])=0;
  }
  
  sort(cX.begin(),cX.end());
  
  int memX=0;
  int cnt=0;
  for(int i=0;i<N;i++){
    if(get<0>(cX[i])!=memX){
      if(memX!=0) check[cnt++]=get<0>(cX[i]);
      cntX++;
    }
    if(get<0>(cX[i])==memX){
    	get<2>(cX[i])=1;
      get<2>(cX[i-1])=1;
    }
	memX=get<0>(cX[i]);
  }
  
  //入れ替え
  for(int i=0;i<N;i++){
  	int tmp=get<1>(cX[i]);
    get<1>(cX[i])=get<0>(cX[i]);
    get<0>(cX[i])=tmp;
  }
  
  sort(cX.begin(),cX.end());
  
   memX=0;
  int flag=0;
  for(int i=0;i<N;i++){
    if(get<0>(cX[i])!=memX) cntY++;
    if(get<0>(cX[i])==memX){
    	get<2>(cX[i])=1;
      get<2>(cX[i-1])=1;
      if(flag==0){
      	for(int j=0;j<cnt;j++){
        	if(check[j]==get<0>(cX[i])){
            	flag=1;
              break;
            }
        }
      }
    }
	memX=get<0>(cX[i]);
  }
  for(int i=0;i<N;i++){
  	if(get<2>(cX[i])==0) cnto++;
  }
  
  if(N<=2 || flag==0) printf("0");
    else printf("%d",(cntX-cnto)*(cntY-cnto)-(N-cnto));
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:19: error: 'check' was not declared in this scope
   27 |       if(memX!=0) check[cnt++]=get<0>(cX[i]);
      |                   ^~~~~
a.cc:55:20: error: 'check' was not declared in this scope
   55 |                 if(check[j]==get<0>(cX[i])){
      |                    ^~~~~
Language: C++

#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, accumulate, inner_product
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)

#define rep(i,n) for(int i = 0; i < n; i++)
#define ENDL "\n"
#define print(i) std::cout << (i) << "\n"

#define int long long // at least int64 > 9*10^18
#define all(v) v.begin(), v.end()

signed main() {
	int n;
	std::cin >> n;
	std::map<int,std::vector<int> > x;
	std::map<int,std::vector<int> > y;
	std::vector<std::pair<int,int> > points;
	rep(i,n) {
		int a,b;
		std::cin >> a >> b;
		x[a].emplace_back(b);
		y[b].emplace_back(a);
		points.emplace_back(a,b);
	}
	int count = 0;
	std::sort(all(points));
	for(auto i:points) {
		for(auto j:x[i.first])
			if(j == i.second) continue;
			for(auto k:y[i.second])
			{
				if(k == i.first) continue;
				count++;
				points.emplace_back(j,k);
				x[j].emplace_back(k);
				y[k].emplace_back(j);
			}
	}
	print(count);
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:53: error: 'j' was not declared in this scope
   46 |                                 points.emplace_back(j,k);
      |                                                     ^