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

#include <iostream>
#include <vector>
#include <set>

using ll = long long;

std::vector<std::vector<int>> g;
std::vector<std::set<int>> bl;

void dfs(int p, std::vector<bool>& visited, std::set<int>& friend_set, std::set<int>& blocklist) {
    if (blocklist.contains(p)) {
        visited[p] = true;
        return;
    }
    if (visited[p]) return;
    for (int i = 0; i < g[p].size(); i++) {
        if (!blocklist.contains(g[p][i])) {
            friend_set.insert(g[p][i]);
            dfs(g[p][i], visited, friend_set, blocklist);
        }
    }
}

int n, m, k, a, b;


int main() {
    std::cin >> n >> m >> k;
    g.assign(n+1, std::vector<int>(0));
    bl.assign(n+1, std::set<int>{});
    for (int i = 0; i < m; i++) {
        std::cin >> a >> b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    for (int i = 0; i < k; i++) {
        std::cin >> a >> b;
        bl[a].insert(b);
        std::cout << "Hello" << std::endl;
        bl[b].insert(a);
    }
    
    for (int i = 0; i < n; i++) {
        std::vector<bool> vis(n+1, false);
        vis[0] = true;
        std::set<int> fset;
        bl[i+1].insert(i+1);
        dfs(i+1, vis, fset, bl[a]);
        std::cout << fset.size() << " ";
    }
    std::cout << std::endl;
    
}

Compiler output:
a.cc: In function 'void dfs(int, std::vector<bool>&, std::set<int>&, std::set<int>&)':
a.cc:11:19: error: 'class std::set<int>' has no member named 'contains'
   11 |     if (blocklist.contains(p)) {
      |                   ^~~~~~~~
a.cc:17:24: error: 'class std::set<int>' has no member named 'contains'
   17 |         if (!blocklist.contains(g[p][i])) {
      |                        ^~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i > 0; i++)

using ll = long long;

ll n;
vector<int> a(3300);
ll dp[3300][3300];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  rep(i,n) cin >> a[i];

  for(int width = 1; width <= n; width++){
    for(int l = 0; l + width <= n; l++){
      ll r = l + width;
      if(width%2 == n%2) dp[l][r] = max(dp[l+1][r]+a[l], dp[l][r-1]+a[r-1]);
      else dp[l][r] = min(dp[l+1][r]-a[l], dp[l][r-1]-a[r-1]);
    }
  }
  cout << dp[0][n] << endl;
}

Compiler output:
a.cc:3:21: error: expected ';' before 'using'
    3 | using ll = long long
      |                     ^
      |                     ;
......
    7 | using ll = long long;
      | ~~~~~                
a.cc:9:1: error: 'll' does not name a type
    9 | ll n;
      | ^~
a.cc:11:1: error: 'll' does not name a type
   11 | ll dp[3300][3300];
      | ^~
a.cc: In function 'int main()':
a.cc:15:10: error: 'n' was not declared in this scope; did you mean 'yn'?
   15 |   cin >> n;
      |          ^
      |          yn
a.cc:20:7: error: 'll' was not declared in this scope; did you mean 'l'?
   20 |       ll r = l + width;
      |       ^~
      |       l
a.cc:21:26: error: 'dp' was not declared in this scope; did you mean 'dup'?
   21 |       if(width%2 == n%2) dp[l][r] = max(dp[l+1][r]+a[l], dp[l][r-1]+a[r-1]);
      |                          ^~
      |                          dup
a.cc:21:32: error: 'r' was not declared in this scope
   21 |       if(width%2 == n%2) dp[l][r] = max(dp[l+1][r]+a[l], dp[l][r-1]+a[r-1]);
      |                                ^
a.cc:22:12: error: 'dp' was not declared in this scope; did you mean 'dup'?
   22 |       else dp[l][r] = min(dp[l+1][r]-a[l], dp[l][r-1]-a[r-1]);
      |            ^~
      |            dup
a.cc:22:18: error: 'r' was not declared in this scope
   22 |       else dp[l][r] = min(dp[l+1][r]-a[l], dp[l][r-1]-a[r-1]);
      |                  ^
a.cc:25:11: error: 'dp' was not declared in this scope; did you mean 'dup'?
   25 |   cout << dp[0][n] << endl;
      |           ^~
      |           dup
Language: C++

#include <iostream>
#include <vector>

const int MAX_N = 100001;

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(){
   init();

   int N, M, K;
   std::cin >> N >> M >> K;
   int A, B;
   int old_friend[N];
   std::fill(old_friend, old_friend+N, 0);
   for(int i=0; i<M; ++i){
      std::cin >> A >> B;
      --A; --B;
      unite(A, B);
      ++old_friend[A]; ++old_friend[B];
   }
   std::vector<int> blocked[N];
   int C, D;
   for(int i=0; i<K; ++i){
      std::cin >> C >> D;
      --C; --D;
      blocked[C].push_back(D);
      blocked[D].push_back(C);
   }
   
   for(int i=0; i<N; ++i){
      int count = 0;
      for(int j=0; j<N; ++j){
	 if(same(i,j) && std::find(blocked[i].begin(), blocked[i].end(), j)==blocked[i].end()) ++count;
      }
      count -= old_friend[i] + 1;
      std::cout << count << ' ';
   }
   std::cout << std::endl;
   return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:70:35: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
   70 |          if(same(i,j) && std::find(blocked[i].begin(), blocked[i].end(), j)==blocked[i].end()) ++count;
      |                          ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:70:35: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   70 |          if(same(i,j) && std::find(blocked[i].begin(), blocked[i].end(), j)==blocked[i].end()) ++count;
      |                          ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

struct UnionFind {
  vector<int> par; //par[i]:iの親の番号

  //最初は全てが根であるとする。-1のときに根である。
  UnionFind(int N) : par(N, -1){}

  // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
  int root(int x) {
    if(par[x] < 0) return x;
    else return par[x] = root(par[x]);
  }

  //xとyが同じ集合に属するか
  bool issame(int x, int y) {
    return root(x) == root(y);
  }

  void merge(int x, int y) {
    x = root(x); y = root(y);
    if(x == y) return;
    if(par[x] > par[y]) swap(x,y);
    par[x] += par[y];
    par[y] = x;
  }

  int size(int x) {
    return -par[root(x)];
  }
};

int deg[100005];
vector<int> to[100005];

int main() {
  int n, m, k;
  cin >> n >> m >> k;
  UnionFind uf(n);
  rep(i,m){
    int a, b;
    cin >> a >> b;
    a--; b--;
    deg[a]++;
    deg[b]++;
    uf.merge(a, b);
  }
  rep(i,k){
    int a, b;
    cin >> a >> b;
    a--; b--;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  rep(i,n) {
    int ans = uf.size(i) - 1 - deg[i];
    for(int u : to[i]) {
      if(uf.same(i,u)) ans--;
    }
    printf("%d%c", ans, i == n - 1 ? "\n" : " ");
    return 0;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:61:13: error: 'struct UnionFind' has no member named 'same'; did you mean 'issame'?
   61 |       if(uf.same(i,u)) ans--;
      |             ^~~~
      |             issame
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int par[100005];//親
int rank[100005];//深さ
//初期化
void init(int n){
  rep(i,n){
    par[i]=i;
    rank[i]=0;
  }
}
//値を求める
int find(int x){
  if(par[x]==x-1){
    return x-1;
  }
  else{
    par[x]=find(par[x]);//親の根と自分の根は等しいよね.
    return par[x];
}
//集合を併合する（ダジャレではない）
void unite(int x,int y){
  x=find(x);
  y=find(y);
  if(x==y)//親が同じだったらすでに併合されているよ.
    return;
  else{
    if(rank[x]>rank[y])
      par[x]=y;//xの親をyの根にする
    else
      par[y]=x;
    if(rank[x]==rank[y])
      rank[x]++;//同じ深さのをくっつけたらそうなるよね.
  }
}

int main() {
  int n,m,k;
  cin >> n >> m >> k;
  vector<P> a(m),c(k);
  rep(i,m){
    cin >> a[i].first >> a[i].second;
  }
  rep(i,k){
    cin >> c[i].first >> c[i].second;
  }
}

Compiler output:
a.cc: In function 'void init(int)':
a.cc:21:5: error: reference to 'rank' is ambiguous
   21 |     rank[i]=0;
      |     ^~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
                 from /usr/include/c++/14/bits/stl_algobase.h:64,
                 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/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:16:5: note:                 'int rank [100005]'
   16 | int rank[100005];//深さ
      |     ^~~~
a.cc: In function 'int find(int)':
a.cc:34:24: error: a function-definition is not allowed here before '{' token
   34 | void unite(int x,int y){
      |                        ^
a.cc:49:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   49 | int main() {
      |         ^~
a.cc:49:9: note: remove parentheses to default-initialize a variable
   49 | int main() {
      |         ^~
      |         --
a.cc:49:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:49:12: error: a function-definition is not allowed here before '{' token
   49 | int main() {
      |            ^
a.cc:59:2: error: expected '}' at end of input
   59 | }
      |  ^
a.cc:25:16: note: to match this '{'
   25 | int find(int x){
      |                ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;
using Graph = vector<vector<int>>;

vector<bool> seen;
int count = 0;
int a = 1;
vector<int> count1;
vector<int> count2;
void dfs(const Graph &G, int v) {
  seen[v] = true;
  ++count;
  for(auto next_v:G[v]) {
    if(seen[next_v]) continue;
    dfs(G, next_v);
  }
  count1[v] = count;
  count2[v] = a;
}

int main(){
  int N, M, K;
  cin >> N >> M >> K;
  Graph g(N);
  for(int i=0;i<M;++i) {
    int a, b;
    cin >> a >> b;
    g[a-1].push_back(b-1);
    g[b-1].push_back(a-1);
  }
  count1.assign(N, 0);
  count2.assign(N, 0);
  seen.assign(N, false);
  int ans[N];
  for(int k=0;k<N;++k) {
    if(!seen[k]) {
      count = 0;
      dfs(g,k);
      ++a;
    }
    ans[k] = count1[k] - g[k].size() -1;
  }
  for(int j=0;j<K;++j) {
    int c, d;
    cin >> c >> d;
    if(count2[c-1]==count2[d-1]) {
      --ans[c-1];
      --ans[d-1];
    }
  }
  for(int d=0;d<N;++d) {
    cout << ans[d] << " ";
  }
}

  }
}


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

#include <iostream>
#include <vector>
using namespace std;
using Graph = vector<vector<int>>;

vector<bool> seen;
int count = 0;
int a = 1;
vector<int> count1;
vector<int> count2;
void dfs(const Graph &G, int v) {
  seen[v] = true;
  ++count;
  for(auto next_v:G[v]) {
    if(seen[next_v]) continue;
    dfs(G, next_v);
  }
  count1[v] = count;
  count2[v] = a;
}

int main(){
  int N, M, K;
  cin >> N >> M >> K;
  Graph g(N);
  for(int i=0;i<M;++i) {
    int a, b;
    cin >> a >> b;
    g[a-1].push_back(b-1);
    g[b-1].push_back(a-1);
  }
  count1.assign(N, 0);
  count2.assign(N, 0);
  seen.assign(N, false);
  int ans[N];
  for(int k=0;k<N;++k) {
    if(!seen[k]) {
      count = 0;
      dfs(g,k);
      ++a;
    }
    ans[k] = count1[k] - g[k].size() -1 << " ";
  }
  for(int j=0;j<K;++j) {
    int c, d;
    cin >> c >> d;
    if(count2[c-1]==count2[d-1]) {
      --ans[c-1];
      --ans[d-1];
    }
  }
  for(int d=0;d<N;++d) {
    cout << ans[d] << " ";
  }
}

  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:41: error: invalid operands of types 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'const char [2]' to binary 'operator<<'
   42 |     ans[k] = count1[k] - g[k].size() -1 << " ";
      |                                         ^~ ~~~
      |                                            |
      |                                            const char [2]
a.cc: At global scope:
a.cc:57:3: error: expected declaration before '}' token
   57 |   }
      |   ^
a.cc:58:1: error: expected declaration before '}' token
   58 | }
      | ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;
using Graph = vector<vector<int>>;

vector<bool> seen;
int count = 0;
vector<int> count1;
void dfs(const Graph &G, int v) {
  seen[v] = true;
  ++count;
  for(auto next_v:G[v]) {
    if(seen[next_v]) continue;
    dfs(G, next_v);
  }
  count1[v] = count;
}

int main(){
  int N, M, K;
  cin >> N >> M >> K;
  Graph g(N);
  for(int i=0;i<M;++i) {
    int a, b;
    cin >> a >> b;
    g[a-1].push_back(b-1);
    g[b-1].push_back(a-1);
  }
  int B[N] = {};
  for(int j=0;j<K;++j) {
    int c, d;
    cin >> c >> d;
    ++B[c-1];
    ++B[d-1];
  }
  count1.assign(N, 0);
  seen.assign(N, false);
  for(int k=0;k<N;++k) {
    if(!seen[k]) {
      count = 0;
      dfs(g,k);
    cout << count1[k] - g[k].size() - B[k] -1 << " ";
  }
}


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

#include <iostream>
#include <vector>
using namespace std;
using Graph = vector<vector<int>>;

vector<bool> seen;
void dfs(const Graph &G, int v) {
  seen[v] = true;
  for(auto next_v:G[v]) {
    if(seen[next_v]) continue;
    dfs(G, next_v);
  }
}

int main(){
  int N, M, K;
  cin >> N >> M >> K;
  Graph g(N);
  for(int i=0;i<M;++i) {
    int a, b;
    cin >> a >> b;
    g[a-1].push_back(b-1);
    g[b-1].push_back(a-1);
  }
  int B[N] = {};
  for(int j=0;j<K;++j) {
    int c, d;
    cin >> c >> d;
    ++B[c-1];
    ++B[d-1];
  }
  int count[N]={};
  seen.assign(N, false);
  for(int k=0;k<N;++k) {
    if(!seen[k]) {
      seen.assign(N, false);
      dfs(g,k);
    for(int kk=0;kk<N;++kk) {
      if(seen[kk]) ++count[k];
    }
    cout << count[k] - g[k].size() - B[k] -1 << " ";
  }
}


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

public class Main 
{
	static int n, m, k;
	static int[] par;
	static int[] rank;
	static int[] size;
	
	static void union(int x, int y)
	{
		int rx = root(x);
		int ry = root(y);
		
		if(rank[rx] >= rank[ry])
		{
			par[ry] = rx;
			if(rank[rx] == rank[ry])
				rank[rx]++;
		}
		else par[rx] = ry;
	}
	
	static int root(int x)
	{
		if(par[x] != x)
			par[x] = root(par[x]);
		return par[x];
	}

	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		m = sc.nextInt();
		k = sc.nextInt();
		par = new int[n];
		rank = new int[n];
		size = new int[n];
		int[] penalty = new int[n];
		
		for(int i = 0; i < n; i++)
			par[i] = i;
			
		for(int i = 0; i < m; i++)
		{ //read friendships
			int a = sc.nextInt()-1;
			int b = sc.nextInt()-1;
			
			union(a, b);
			
			//penalty for each direct friend on the same set
			penalty[a]++;
			penalty[b]++;
		}
		
		for(int i = 0; i < n; i++)
		{ //count size of each set
			size[root(i)]++;
		}
		
		for(int i = 0; i < k; i++)
		{ //read blockships
			int a = sc.nextInt()-1;
			int b = sc.nextInt()-1;
			
			if(root(a) == root(b))
			{ //penalty for each blocked user on the same set
				penalty[a]++;
				penalty[b]++;
			}
		}
		
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < n; i++)
		{
			int an = size[root(i)] - 1 - penalty[i];
			if(i>0)sb.append(' ');
			sb.append(an);
		}
		System.out.println(sb);
	}

}


Compiler output:
Main.java:31: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:31: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C++

//参考：http://ehafib.hatenablog.com/entry/2015/12/23/164517
//インクルード
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second


struct UnionFind {
  // 根はそのUnionの大きさの絶対値で負の値を持つ.
  // 葉はそれぞれ根のインデックスを持つ.
  std::vector<int> d;
  UnionFind(int n): d(n, -1) {}
  // 根を探す
  int find(int x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y) {
    // xとyを合体させる
    x = find(x); y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y);}
  int size(int x) {return -d[find[x]];}
};

int main(int argc, char const *argv[]) {
  //　入力
  // s
  // q
  // query=(1, 2) if query == 2 top_or_bottom str
  int deg[INF];
  std::vector<int> to[INF];
  int n, m, k;
  std::cin >> n >> m >> k;

  UnionFind nf(n);

  REP(i,m) {
    int a, b;
    std::cin >> a >> b;
    deg[a]++;
    deg[b]++;
    uf.unite(a,b);
  }
  REP(i,k) {
    int a, b;
    std::cin >> a >> b;
    --a; --b;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  REP(i,n) {
    int ans = uf.size(i) - 1 - deg[i];
    for (int u : to[i]) {
      if (uf.same(i,u)) --ans;
    }
    printf("%d%c", ans, i==n-1?'\n':' ');
  }
  return 0;
}


Compiler output:
a.cc: In member function 'int UnionFind::size(int)':
a.cc:61:34: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   61 |   int size(int x) {return -d[find[x]];}
      |                                  ^
a.cc: In function 'int main(int, const char**)':
a.cc:81:5: error: 'uf' was not declared in this scope; did you mean 'nf'?
   81 |     uf.unite(a,b);
      |     ^~
      |     nf
a.cc:91:15: error: 'uf' was not declared in this scope; did you mean 'nf'?
   91 |     int ans = uf.size(i) - 1 - deg[i];
      |               ^~
      |               nf
Language: C++

//参考：http://ehafib.hatenablog.com/entry/2015/12/23/164517
//インクルード
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second


struct UnionFind {
  // 根はそのUnionの大きさの絶対値で負の値を持つ.
  // 葉はそれぞれ根のインデックスを持つ.
  std::vector<int> d;
  UnionFind(int n): d(n, -1) {}
  // 根を探す
  int find(int x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y) {
    // xとyを合体させる
    x = find(x); y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y);}
  int size(int x) {return -d[find[x];];}
};

int main(int argc, char const *argv[]) {
  //　入力
  // s
  // q
  // query=(1, 2) if query == 2 top_or_bottom str
  int deg[INF];
  std::vector<int> to[INF];
  int n, m, k;
  std::cin >> n >> m >> k;

  UnionFind nf(n);

  REP(i,m) {
    int a, b;
    std::cin >> a >> b;
    deg[a]++;
    deg[b]++;
    uf.unite(a,b);
  }
  REP(i,k) {
    int a, b;
    std::cin >> a >> b;
    --a; --b;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  REP(i,n) {
    int ans = uf.size(i) - 1 - deg[i];
    for (int u : to[i]) {
      if (uf.same(i,u)) --ans;
    }
    printf("%d%c", ans, i==n-1?'\n':' ');
  }
  return 0;
}


Compiler output:
a.cc: In member function 'int UnionFind::size(int)':
a.cc:61:34: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   61 |   int size(int x) {return -d[find[x];];}
      |                                  ^
a.cc:61:37: error: expected ']' before ';' token
   61 |   int size(int x) {return -d[find[x];];}
      |                                     ^
a.cc:61:38: error: expected primary-expression before ']' token
   61 |   int size(int x) {return -d[find[x];];}
      |                                      ^
a.cc: In function 'int main(int, const char**)':
a.cc:81:5: error: 'uf' was not declared in this scope; did you mean 'nf'?
   81 |     uf.unite(a,b);
      |     ^~
      |     nf
a.cc:91:15: error: 'uf' was not declared in this scope; did you mean 'nf'?
   91 |     int ans = uf.size(i) - 1 - deg[i];
      |               ^~
      |               nf
Language: C++

#include <iostream>
#include <vector>
#include <set>
using namespace std;
struct unionfind{
	vector<int> par,ran;
	unionfind(int n):par(n),ran(n,0){
		for(int i=0;i<n;i++){
			par[i]=i;
		}
	}
	int find(int x){
		return (x==par[x]?x:par[x]=find(par[x]));
	}
	bool same(int x,int y){
		return find(x)==find(y);
	}
	void unite(int x,int y){
		x=find(x);
		y=find(y);
		if(x!=y){
			if(ran[x]<ran[y]){
				par[x]=y;
			}else{
				par[y]=x;
				if(ran[x]==ran[y]){
					ran[x]++;
				}
			}
		}
	}
};
int memo[100000];
vector<int> out[100000];
int main(){
	int n,m,k;
	cin>>n>>m>>k;
	unionfind nii(n);
	for(int i=0;i<m;i++){
		int a,b;
		cin>>a>>b;
		a--;
		b--;
		nii.unite(a,b);
		out[a].push_back(b);
		out[b].push_back(a);
	}
	for(int i=0;i<k;i++){
		int c,d;
		cin>>c>>d;
		c--;
		d--;
		out[c].push_back(d);
		out[d].push_back(c);
	}
	vector<pair<int,int> > f;
	set<int> hoge;
	for(int i=0;i<n;i++){
		hoge.insert(nii.find(i));
		f.push_back(make_pair(nii.find(i),i));
	}
	sort(f.begin(),f.end());
	int id=0;
	int cnt=0;
	vector<int> mii[hoge.size()];
	while(id<n){
		mii[cnt].push_back(f[id].second);
		memo[f[id].second]=cnt;
		while(id+1<n&&f[id].first==f[id+1].first){
			id++;
			mii[cnt].push_back(f[id].second);
			memo[f[id].second]=cnt;
		}
		cnt++;
		id++;
	}
	for(int i=0;i<n;i++){
		int ans=mii[memo[i]].size()-1;
		for(int j=0;j<out[i].size();j++){
			if(nii.same(i,out[i][j])){
				ans--;
			}
		}
		cout<<ans;
		if(i!=n-1){
			cout<<" ";
		}else{
			cout<<endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:62:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   62 |         sort(f.begin(),f.end());
      |         ^~~~
      |         short
Language: C++

#include<iostream>
#include<vector>
#include<cstring>
#include<unordered_set>
using namespace std;

class Graph{

    public:
    int V;
    
    // adjacency list of friends of every user(node)
    vector<int> *frend;
    
    // adjacency list of blocks of every user(node)
    vector<int> *block;

    unordered_set<int> component;

    Graph(int vertices){
        V=vertices;
        frend = new vector<int>[vertices+1];
        block = new vector<int>[vertices+1];
    }

    void addfriend(int p, int q){
        frend[p].push_back(q);
        frend[q].push_back(p);
    }

    void addblock(int p, int q){
        block[p].push_back(q);
        block[q].push_back(p);
    }

    int DFS(int v, bool *visited){

        visited[v]=true;
        component.insert(v);
        int count=1;
        vector<int>::iterator it;
        for(it=frend[v].begin(); it!=frend[v].end(); it++){
            if(!visited[*it]){
                count+=(DFS(*it,visited));
            }
        }
        return count;
    }

};

int main(){

    int n, m, k;
    cin >> n >> m >> k;

    Graph g(n);
    while (m--)
    {
        int u, v;
        cin >> u >> v;
        g.addfriend(u,v);
    }
    
    while (k--)
    {
        int u, v;
        cin >> u >> v;
        g.addblock(u,v);
    }

    bool *visited = new bool[n];
    memset(visited,false,sizeof visited);

    // answer for every node-
    int ans[n]={};

    for(int i=1; i<=n; i++){

        if(!visited[i]){

            g.component.clear();
            int comp_size=g.DFS(i,visited);

            set<int>::iterator itr;

            // iterating the large component and assigning the answer to every node in that component.
            for(itr=g.component.begin();itr!=g.component.end();itr++){

                ans[*itr]=(comp_size-1); // removing the node itself.
                ans[*itr]-=(g.frend[*itr].size()); // removing friends.

                // checking how many block node by i-th user has in the component.
                vector<int>::iterator it;
                for(it=g.block[*itr].begin(); it!=g.block[*itr].end(); it++){
                    if(g.component.count(*it)) ans[*itr]--;
                }
            }
        }
    }
    for(int i=1; i<=n; i++) cout << ans[i] << " ";
    cout << "\n";
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:85:13: error: 'set' was not declared in this scope
   85 |             set<int>::iterator itr;
      |             ^~~
a.cc:5:1: note: 'std::set' is defined in header '<set>'; this is probably fixable by adding '#include <set>'
    4 | #include<unordered_set>
  +++ |+#include <set>
    5 | using namespace std;
a.cc:85:17: error: expected primary-expression before 'int'
   85 |             set<int>::iterator itr;
      |                 ^~~
a.cc:88:17: error: 'itr' was not declared in this scope
   88 |             for(itr=g.component.begin();itr!=g.component.end();itr++){
      |                 ^~~
Language: C++

import sys
sys.setrecursionlimit(10*9)

n,m,k = map(int,input().split())
parent_of = [-1 for _ in range(n)]
#print(parent_of)
def root_of(x):
	if parent_of[x] < 0:
		return x
	else:
		parent_of[x] = root_of(parent_of[x])
		return parent_of[x]

def unite(x,y):
	top_root_x = root_of(x)
	top_root_y = root_of(y)
	if top_root_x == top_root_y:
		return False
	if parent_of[top_root_x] > parent_of[top_root_y]:
		top_root_x,top_root_y = top_root_y,top_root_x
	#print(parent_of[top_root_y])
	parent_of[top_root_x] += parent_of[top_root_y]
	parent_of[top_root_y] = top_root_x
	return True

def size_of(x):
		return -parent_of[root_of(x)]

def is_same(x,y):
	return root_of(x) == root_of(y)

friend_list = [-1] * n
for _ in range(m):
	a,b = map(int,input().split())
	a -= 1
	b -= 1
	friend_list[a] -=1
	friend_list[b] -=1
	unite(a,b)

for _ in range(k):
	c,d = map(int,input().split())
	c -= 1
	d -= 1
	if root_of(c) == root_of(d):
		block_list[c] -= 1
		block_list[d] -= 1
for i in range(n):
	friend_list[i] += size_of(i)
	#print(size_of(i))
print(*friend_list)


Compiler output:
a.cc:6:2: error: invalid preprocessing directive #print
    6 | #print(parent_of)
      |  ^~~~~
a.cc:21:10: error: invalid preprocessing directive #print
   21 |         #print(parent_of[top_root_y])
      |          ^~~~~
a.cc:50:10: error: invalid preprocessing directive #print
   50 |         #print(size_of(i))
      |          ^~~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

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

int n, m, k;

bool search(int a, int b, int fs[][], int bs[][]) {
    for(int i = 0, i < n; i++) {
        if(fs[a][i] == 1) {
            if(i == b) return true;
            else search(i, b);
        }
    }
    return false;
}

int main() {
    cin >> n >> m >> k;
    int fs[n][n], bs[n][n];
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < n; j++) {
            fs[i][j] = 0;
            bs[i][j] = 0;
        }
    }
    for(int i = 0; i < m; i++) {
        int a, b; cin >> a >> b;
        fs[a - 1][b - 1] = 1;
        fs[b - 1][a - 1] = 1;
    }
    for(int j = 0; j < k; j++) {
        int a, b; cin >> a >> b;
        bs[a - 1][b - 1] = 1;
        bs[b - 1][a - 1] = 1;
    }
    int fc[n];
    for(int i = 0; i < n; i++) fc[i] = 0;

    for(int i = 0; i < n; i++) {
        for(int j = 0; j < n; j++) {
            if(fs[i][j] = 0 && bs[i][j] == 0) {
                if(search(i, j, fs, bs)) fc[fs[i][j] - 1] ++;
            }
        }
    }

    for(int i = 0; i < n; i++) {
        cout << fc[i] / 2 << " ";
    }
}

Compiler output:
a.cc:6:31: error: declaration of 'fs' as multidimensional array must have bounds for all dimensions except the first
    6 | bool search(int a, int b, int fs[][], int bs[][]) {
      |                               ^~
a.cc:6:37: error: expected ')' before ',' token
    6 | bool search(int a, int b, int fs[][], int bs[][]) {
      |            ~                        ^
      |                                     )
a.cc:6:39: error: expected unqualified-id before 'int'
    6 | bool search(int a, int b, int fs[][], int bs[][]) {
      |                                       ^~~
Language: Java

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
import java.util.ArrayDeque;
import java.util.Queue;

public class FriendsAvailability{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int M = scan.nextInt();
		int K = scan.nextInt();

		//友人，ブロック，無関係
		ArrayList<ArrayList<Integer>> friends = new ArrayList<ArrayList<Integer>>();
		ArrayList<ArrayList<Integer>> blocked = new ArrayList<ArrayList<Integer>>();

		for(int i = 0; i < N; i++){
			ArrayList<Integer> x = new ArrayList<Integer>();
			ArrayList<Integer> y = new ArrayList<Integer>();
			friends.add(x);
			blocked.add(y);
		}
		
		for(int i = 0; i < M; i++){
			int a = scan.nextInt() - 1;
			int b = scan.nextInt() - 1;
			friends.get(a).add(b);
			friends.get(b).add(a);
		}

		for(int i = 0; i < K; i++){
			int a = scan.nextInt() - 1;
			int b = scan.nextInt() - 1;
			blocked.get(a).add(b);
			blocked.get(b).add(a);
		}
		
		//各連結成分のサイズ
		int size[] = new int[N];
		Arrays.fill(size, 0);
		//どの連結成分に属しているか
		int belong[] = new int[N];

		boolean seen[] = new boolean[N];
		Arrays.fill(seen, false);
		Queue<Integer> queue = new ArrayDeque<Integer>();
		
		for(int i = 0; i < N; i++){
			
			if(seen[i] != true){
				queue.add(i);
				seen[i] = true;
				while(!queue.isEmpty()){
					int x = queue.poll();
					belong[x] = i;
					size[belong[x]]++;
					for(int j = 0; j < friends.get(x).size(); j++){
						if(seen[friends.get(x).get(j)] != true){
							queue.add(friends.get(x).get(j));
							seen[friends.get(x).get(j)] = true;
							
						}
					}
				}
			}
		}
		
		for(int i = 0; i < N; i++){
			int result = size[belong[i]] - 1;
			for(int j = 0; j < friends.get(i).size(); j++){
				if(belong[friends.get(i).get(j)] == belong[i])result--;
			}
			for(int j = 0; j < blocked.get(i).size(); j++){
				if(belong[blocked.get(i).get(j)] == belong[i])result--;
			}
			System.out.println(result);
		}
	}
}

Compiler output:
Main.java:7: error: class FriendsAvailability is public, should be declared in a file named FriendsAvailability.java
public class FriendsAvailability{
       ^
1 error
Language: Java

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int k = sc.nextInt();

		//*****
		StringBuilder sbt = new StringBuilder();
		sbt.append("100000 99999 99998\r\n");
		for (int i = 1; i < 100000; i++) {
			sbt.append(String.format("%d %d\r\n", 1, i + 1));
		}
		for (int i = 2; i < 100000; i++) {
			sbt.append(String.format("%d %d\r\n", 2, i + 1));
		}
		Snippet.saveFile("c:\\local\\test.xxx", sbt.toString());

		ArrayList<HashSet> setList = new ArrayList<HashSet>();
		int[] counts = new int[n];
		for (int i = 0; i < m; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			int index1 = getSetIndex(setList, a);
			int index2 = getSetIndex(setList, b);
			if (index1 == -1 && index2 == -1) {
				HashSet set = new HashSet();
				set.add(a);
				set.add(b);
				setList.add(set);
			} else if (index1 == -1) {
				setList.get(index2).add(a);
			} else if (index2 == -1) {
				setList.get(index1).add(b);
			} else if (index1 != index2) {
				for (Object x : setList.get(index2)) {
					setList.get(index1).add(x);
				}
				setList.remove(index2);
			}
			counts[a - 1]++;
			counts[b - 1]++;
		}

		for (int i = 0; i < k; i++) {
			int c = sc.nextInt();
			int d = sc.nextInt();
			int index1 = getSetIndex(setList, c);
			int index2 = getSetIndex(setList, d);
			if (setList.get(index1).contains(d)) {
				counts[c - 1]++;
			}
			if (setList.get(index2).contains(c)) {
				counts[d - 1]++;
			}
		}
		sc.close();

		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; i++) {
			int index = getSetIndex(setList, i + 1);
			int result = index == -1 ? 0 : setList.get(index).size() - 1 - counts[i];
			sb.append(i == 0 ? "" : " ");
			sb.append(result);
		}
		System.out.print(sb.toString());
	}

	private static int getSetIndex(ArrayList<HashSet> setList, int n) {
		for (int i = 0; i < setList.size(); i++) {
			if (setList.get(i).contains(n)) {
				return i;
			}
		}

		return -1;
	}
}


Compiler output:
Main.java:21: error: cannot find symbol
		Snippet.saveFile("c:\\local\\test.xxx", sbt.toString());
		^
  symbol:   variable Snippet
  location: class Main
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: C++

#include <stdio.h>

#include <algorithm>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>

using namespace std;
typedef long long llong;

void DFriendSuggestions(std::istream& in, std::ostream& out) {
  int n, m, k;
  in >> n >> m >> k;

  vector<set<int>> graph;
  vector<set<int>> enemy;

  for (int i = 0; i < n; ++i) {
    graph.emplace_back(set<int>());
  }
  for (int i = 0; i < n; ++i) {
    enemy.emplace_back(set<int>());
  }

  for (int i = 0; i < m; ++i) {
    int a, b;
    in >> a >> b;
    graph[a - 1].insert(b - 1);
    graph[b - 1].insert(a - 1);
  }

  for (int i = 0; i < k; ++i) {
    int a, b;
    in >> a >> b;
    enemy[a - 1].insert(b - 1);
    enemy[b - 1].insert(a - 1);
  }

  vector<set<int>> un;
  vector<int> leader;
  for (int i = 0; i < n; ++i) {
    leader.push_back(-1);
  }
  // BFS
  for (int i = 0; i < n; ++i) {
    if (leader[i] >= 0)
      continue;

    leader[i] = un.size();
    un.emplace_back(set<int>());
    // init : suggestions are empty
    set<int> to_visit;
    set<int>& s = un.back();
    to_visit.insert(i);

    while (!to_visit.empty()) {
      auto j = *to_visit.begin();
      to_visit.erase(j);
      s.insert(j);
      for (auto p : graph[j]) {
        if (s.find(p) != s.end())
          continue;
        to_visit.insert(p);
      }
    }

    for (const auto c : s) {
      leader[c] = leader[i];
    }
  }

  for (int i = 0; i < n; ++i) {
    // get the size of union
    int sz = un[leader[i]].size();
    // distract myself and neighbors
    int x = sz - 1 - graph[i].size();
    // if enemy is included, distract
    for (int j = 0; j < enemy[i].size(); ++j) {
      for (auto k : enemy[i]) {
        if (un[leader[i]].find(k) != un[leader[i]].end())
          --x;
      }
    }
    out << x << " ";
  }
  out << endl;
}

int main() { DFriendSuggestions(cin, cout) }


Compiler output:
a.cc: In function 'int main()':
a.cc:95:43: error: expected ';' before '}' token
   95 | int main() { DFriendSuggestions(cin, cout) }
      |                                           ^~
      |                                           ;
Language: C++

#include <stdio.h>

#include <algorithm>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>

using namespace std;
typedef long long llong;

void DFriendSuggestions(std::istream& in, std::ostream& out) {
  int n, m, k;
  in >> n >> m >> k;

  vector<set<int>> graph;
  vector<set<int>> enemy;

  for (int i = 0; i < n; ++i) {
    graph.emplace_back(set<int>());
  }
  for (int i = 0; i < n; ++i) {
    enemy.emplace_back(set<int>());
  }

  for (int i = 0; i < m; ++i) {
    int a, b;
    in >> a >> b;
    graph[a - 1].insert(b - 1);
    graph[b - 1].insert(a - 1);
  }

  for (int i = 0; i < k; ++i) {
    int a, b;
    in >> a >> b;
    enemy[a - 1].insert(b - 1);
    enemy[b - 1].insert(a - 1);
  }

  vector<set<int>> un;
  vector<int> leader;
  for (int i = 0; i < n; ++i) {
    leader.push_back(-1);
  }
  // BFS
  for (int i = 0; i < n; ++i) {
    if (leader[i] >= 0)
      continue;

    leader[i] = un.size();
    un.emplace_back(set<int>());
    // init : suggestions are empty
    set<int> to_visit;
    set<int>& s = un.back();
    to_visit.insert(i);

    while (!to_visit.empty()) {
      auto j = *to_visit.begin();
      to_visit.erase(j);
      s.insert(j);
      for (auto p : graph[j]) {
        if (s.find(p) != s.end())
          continue;
        to_visit.insert(p);
      }
    }

    for (const auto c : s) {
      leader[c] = leader[i];
    }
  }

  for (int i = 0; i < n; ++i) {
    // get the size of union
    int sz = un[leader[i]].size();
    // distract myself and neighbors
    int x = sz - 1 - graph[i].size();
    // if enemy is included, distract
    for (int j = 0; j < enemy[i].size(); ++j) {
      for (auto k : enemy[i]) {
        if (un[leader[i]].find(k) != un[leader[i]].end())
          --x;
      }
    }
    out << x << " ";
  }
  out << endl;
}

int main() { DFriendSuggestion(cin, cout) }

Compiler output:
a.cc: In function 'int main()':
a.cc:95:14: error: 'DFriendSuggestion' was not declared in this scope; did you mean 'DFriendSuggestions'?
   95 | int main() { DFriendSuggestion(cin, cout) }
      |              ^~~~~~~~~~~~~~~~~
      |              DFriendSuggestions
Language: C++

#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
using ll = long long;

int n, m, k;
int id;
vector<int> cc_id;
vector<int> cc_num;

void dfs(const vector<vector<int>> &g, int v, int &cnt){
  cc_id[v] = id;
  cnt++;
  for(auto e : g.at(v)){
    if(cc_id.at(e) == -1){
      dfs(g, e, cnt);
    }
  }
}

int main(){
  cin >> n >> m >> k;
  vector<vector<int>> g(n);
  vector<int> a(m), b(m);
  rep(i,m){
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
    g.at(a[i]).push_back(b[i]);
    g.at(b[i]).push_back(a[i]);
  }
  vector<int> c(k), d(k);
  rep(i,k){
    cin >> c[i] >> d[i];
    c[i]--, d[i]--;
  }
  
  id = 0;
  cc_id.assign(n, -1);
  rep(i,n){
    if(cc_id[i] == -1){
      int cnt = 0;
      dfs(g, i, cnt);
      id++;
      cc_num.push_back(cnt);
    }
  }
  
  vector<int> ans(n);
  rep(i,n){
    ans[i] = cc_num.at(cc_id[i]) - 1 - g[i].size();
  }
  rep(i,k){
    if(cc_id(c[i]) == cc_id(d[i])){
      ans[c[i]]--;
      ans[d[i]]--;
    }
  }
  rep(i,n - 1){
    cout << ans[i] << ' ';
  }
  cout << ans[n - 1] << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:54:13: error: no match for call to '(std::vector<int>) (__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   54 |     if(cc_id(c[i]) == cc_id(d[i])){
      |        ~~~~~^~~~~~
a.cc:54:28: error: no match for call to '(std::vector<int>) (__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   54 |     if(cc_id(c[i]) == cc_id(d[i])){
      |                       ~~~~~^~~~~~
Language: C++

#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
using ll = long long;

int n, m, k;
int id;
vector<int> cc_id;
vector<int> cc_num;

void dfs(const vector<vector<int>> &g, int v, int &cnt){
  cc_id[v] = id;
  cnt++;
  for(auto e : g.at(v)){
    if(cc_id.at(e) == -1){
      dfs(g, e, cnt);
    }
  }
}

int main(){
  cin >> n >> m >> k;
  vector<vector<int>> g(n);
  vector<int> a(m), b(m);
  rep(i,m){
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
    g.at(a[i]).push_back(b[i]);
    g.at(b[i]).push_back(a[i]);
  }
  vector<int> c(k), d(k);
  rep(i,k){
    cin >> c[i] >> d[i];
    c[i]--, d[i]--;
  }
  
  id = 0;
  cc_id.assign(n, -1);
  rep(i,n){
    if(cc_id[i] == -1){
      int cnt = 0;
      dfs(g, i, cnt);
      id++;
      cc_num.push_back(cnt);
    }
  }
  
  vector<int> ans(n);
  rep(i,n){
    ans[i] = cc_num(cc_id[i]) - 1 - g[i].size();
  }
  rep(i,k){
    if(cc_id(c[i]) == cc_id(d[i])){
      ans[c[i]]--;
      ans[d[i]]--;
    }
  }
  rep(i,n - 1){
    cout << ans[i] << ' ';
  }
  cout << ans[n - 1] << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:51:20: error: no match for call to '(std::vector<int>) (__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   51 |     ans[i] = cc_num(cc_id[i]) - 1 - g[i].size();
      |              ~~~~~~^~~~~~~~~~
a.cc:54:13: error: no match for call to '(std::vector<int>) (__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   54 |     if(cc_id(c[i]) == cc_id(d[i])){
      |        ~~~~~^~~~~~
a.cc:54:28: error: no match for call to '(std::vector<int>) (__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   54 |     if(cc_id(c[i]) == cc_id(d[i])){
      |                       ~~~~~^~~~~~
Language: C++

#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
using ll = long long;

int n, m, k;
int id;
vector<int> cc_id;
vector<int> cc_num;

void dfs(const vector<vector<int>> &g, int v, int &cnt){
  cc_id[v] = id;
  cnt++;
  for(auto e : g.at(v)){
    if(cc_id.at(e) == -1){
      dfs(g, e, cnt);
    }
  }
}

int main(){
  cin >> n >> m >> k;
  vector<<vector<int>>> g(n);
  vector<int> a(m), b(m);
  rep(i,m){
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
    g.at(a[i]).push_back(b[i]);
    g.at(b[i]).push_back(a[i]);
  }
  vector<int> c(k), d(k);
  rep(i,k){
    cin >> c[i] >> d[i];
    c[i]--, d[i]--;
  }
  
  id = 0;
  cc_id.assign(n, -1);
  rep(i,n){
    if(cc_id[i] == -1){
      int cnt = 0;
      dfs(g, i, cnt);
      id++;
      cc_num.push_back(cnt);
    }
  }
  
  vector<int> ans(n);
  rep(i,n){
    ans[i] = cc_num(cc_id[i]) - 1 - g[i].size();
  }
  rep(i,k){
    if(cc_id(c[i]) == cc_id(d[i])){
      ans[c[i]]--;
      ans[d[i]]--;
    }
  }
  rep(i,n - 1){
    cout << ans[i] << ' ';
  }
  cout << ans[n - 1] << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:23:9: error: expected unqualified-id before '<<' token
   23 |   vector<<vector<int>>> g(n);
      |         ^~
a.cc:29:5: error: 'g' was not declared in this scope
   29 |     g.at(a[i]).push_back(b[i]);
      |     ^
a.cc:43:11: error: 'g' was not declared in this scope
   43 |       dfs(g, i, cnt);
      |           ^
a.cc:51:20: error: no match for call to '(std::vector<int>) (__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   51 |     ans[i] = cc_num(cc_id[i]) - 1 - g[i].size();
      |              ~~~~~~^~~~~~~~~~
a.cc:51:37: error: 'g' was not declared in this scope
   51 |     ans[i] = cc_num(cc_id[i]) - 1 - g[i].size();
      |                                     ^
a.cc:54:13: error: no match for call to '(std::vector<int>) (__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   54 |     if(cc_id(c[i]) == cc_id(d[i])){
      |        ~~~~~^~~~~~
a.cc:54:28: error: no match for call to '(std::vector<int>) (__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   54 |     if(cc_id(c[i]) == cc_id(d[i])){
      |                       ~~~~~^~~~~~
Language: C++

#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
using ll = long long;

int id;
vector<int> cc_id;
vector<int> cc_num;

void dfs(const vector<vector<int>> &g, int v, int &cnt){
  cc_id[v] = id;
  cnt++;
  for(auto e : g.at(v)){
    if(cc_id.at(e) == -1){
      dfs(g, e, cnt);
    }
  }
}

int main(){
  cin >> n >> m >> k;
  vector<<vector<int>>> g(n);
  vector<int> a(m), b(m);
  rep(i,m){
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
    g.at(a[i]).push_back(b[i]);
    g.at(b[i]).push_back(a[i]);
  }
  vector<int> c(k), d(k);
  rep(i,k){
    cin >> c[i] >> d[i];
    c[i]--, d[i]--;
  }
  
  id = 0;
  cc_id.assign(n, -1);
  rep(i,n){
    if(cc_id[i] == -1){
      int cnt = 0;
      dfs(g, i, cnt);
      id++;
      cc_num.push_back(cnt);
    }
  }
  
  vector<int> ans(n);
  rep(i,n){
    ans[i] = cc_num(cc_id[i]) - 1 - g[i].size();
  }
  rep(i,k){
    if(cc_id(c[i]) == cc_id(d[i])){
      ans[c[i]]--;
      ans[d[i]]--;
    }
  }
  rep(i,n - 1){
    cout << ans[i] << ' ';
  }
  cout << ans[n - 1] << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:21:10: error: 'n' was not declared in this scope; did you mean 'yn'?
   21 |   cin >> n >> m >> k;
      |          ^
      |          yn
a.cc:21:15: error: 'm' was not declared in this scope; did you mean 'tm'?
   21 |   cin >> n >> m >> k;
      |               ^
      |               tm
a.cc:21:20: error: 'k' was not declared in this scope
   21 |   cin >> n >> m >> k;
      |                    ^
a.cc:22:9: error: expected unqualified-id before '<<' token
   22 |   vector<<vector<int>>> g(n);
      |         ^~
a.cc:28:5: error: 'g' was not declared in this scope
   28 |     g.at(a[i]).push_back(b[i]);
      |     ^
a.cc:42:11: error: 'g' was not declared in this scope
   42 |       dfs(g, i, cnt);
      |           ^
a.cc:50:20: error: no match for call to '(std::vector<int>) (__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   50 |     ans[i] = cc_num(cc_id[i]) - 1 - g[i].size();
      |              ~~~~~~^~~~~~~~~~
a.cc:50:37: error: 'g' was not declared in this scope
   50 |     ans[i] = cc_num(cc_id[i]) - 1 - g[i].size();
      |                                     ^
a.cc:53:13: error: no match for call to '(std::vector<int>) (__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   53 |     if(cc_id(c[i]) == cc_id(d[i])){
      |        ~~~~~^~~~~~
a.cc:53:28: error: no match for call to '(std::vector<int>) (__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   53 |     if(cc_id(c[i]) == cc_id(d[i])){
      |                       ~~~~~^~~~~~