Language: C++

// C++ 14
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <math.h>
#include <cstring>

#define ll long long
#define Int ll
#define loop(__x, __start, __end) for(Int __x = __start; __x < __end; __x++)
#define loopdown(__x, __start, __end) for(Int __x = __start; __x > __end; __x--)
#define rep(__n) for(Int __x = 0; __x < __n; __x++)
#define span(__a,__x,__y) __a.begin()+__x,__a.begin()+__y
#define span_all(__a) __a.begin(),__a.end()
#define len(__x) (__x.size())
#define last(__x) (__x[__x.size()-1])

using namespace std;

struct Point {
  Int x, y;
  Point(Int x, Int y): x(x), y(y) {}
  Point(): x(0), y(0) {}

  Point operator + (Point v) { return Point(x + v.x, y + v.y); }
  Point operator - (Point v) { return Point(x - v.x, y - v.y); }
  bool operator == (const Point &v) const {
    return x == v.x && y == v.y;
  }
  bool operator< (const Point &p1) const {
    return x < p1.x && y < p1.y;
  }
};
ostream & operator << (ostream & out, Point const & v) {
  out << "Point(" << v.x << ", " << v.y << ')';
  return out;
}

istream & operator >> (istream & in, Point & v) {
  Int x, y;
  in >> x; in >> y; v.x = x; v.y = y;
  return in;
}

// Geometry

#define EPS 0.0000000001

class Vector2 {
public:
  double x, y;
  
  Vector2(double x = 0, double y = 0): x(x), y(y) {}
  
  Vector2 operator + (Vector2 v) { return Vector2(x + v.x, y + v.y); }
  Vector2 operator - (Vector2 v) { return Vector2(x - v.x, y - v.y); }
  Vector2 operator * (double k) { return Vector2(x * k, y * k); }
  Vector2 operator / (double k) { return Vector2(x / k, y / k); }
  
  double length() { return sqrt(norm()); }
  double norm() { return x * x + y * y; }
  double dot (Vector2 v) { return x * v.x + y * v.y; }
  double cross (Vector2 v) { return x * v.y - y * v.x; }
  
  bool operator < (const Vector2 &v) const {
    return x != v.x ? x < v.x : y < v.y;
  }
  
  bool operator == (const Vector2 &v) const {
    return fabs(x - v.x) < EPS && fabs(y - v.y) < EPS;
  }
};

ostream & operator << (ostream & out, Vector2 const & v) { 
  out<< "Vector2(" << v.x << ", " << v.y << ')';
  return out;
}

istream & operator >> (istream & in, Vector2 & v) { 
  double x, y;
  in >> x;
  in >> y;
  v.x = x;
  v.y = y;
  return in;
}

const Int MAX_N = 100001;
// 人数, 友達, ブロック
Int N, M, K;
vector<Int> A;
bool F[MAX_N][MAX_N];
bool B[MAX_N][MAX_N];

class DisjointSet {
public:
    DisjointSet(int n) {
        rank.resize(n);
        parent.resize(n);
        for (int i=0; i<n; i++) rank[i] = 0, parent[i] = i;
    }

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

    void unite(int x, int y) {
        x = root(x), y = root(y);
        if (rank[x] > rank[y]) {
            parent[y] = x;
        } else {
            parent[x] = y;
            if (rank[x] == rank[y]) rank[y]++;
        }
    }

private:
    vector<int> rank;
    vector<int> parent;

    int root(int x) {
        if (x != parent[x]) {
            parent[x] = root(parent[x]);
        }

        return parent[x];
    }
};

DisjointSet dset(0);

void input() {
  cin >> N >> M >> K;
  dset = DisjointSet(N);
  Int a, b;
  loop(i,0,M) {
    cin >> a >> b;
    a--;b--;
    dset.unite(a, b);
    F[a][b] = F[b][a] = true;
  }
  loop(i,0,K) {
    cin >> a >> b;
    a--;b--;
    B[a][b] = B[b][a] = true;
  }
}

void solve() {
  for (int i=0; i<N; i++) {
    int count = 0;
    for (int j=0; j<N; j++) {
      if (i==j) continue;
      count += dset.same(i, j) && !F[i][j] && !B[i][j];
    }
    if (i!=0) cout << " ";
    cout << count;
  }
  cout << endl;
}

int main() {
  memset(B, false, sizeof(B));
  memset(F, false, sizeof(F));
  input();
  solve();
  return 0;
}


Compiler output:
/tmp/ccAjbJMe.o: in function `input()':
a.cc:(.text+0x20c): relocation truncated to fit: R_X86_64_PC32 against symbol `dset' defined in .bss section in /tmp/ccAjbJMe.o
a.cc:(.text+0x280): relocation truncated to fit: R_X86_64_PC32 against symbol `dset' defined in .bss section in /tmp/ccAjbJMe.o
a.cc:(.text+0x35a): relocation truncated to fit: R_X86_64_PC32 against symbol `B' defined in .bss section in /tmp/ccAjbJMe.o
a.cc:(.text+0x379): relocation truncated to fit: R_X86_64_PC32 against symbol `B' defined in .bss section in /tmp/ccAjbJMe.o
a.cc:(.text+0x390): relocation truncated to fit: R_X86_64_PC32 against symbol `B' defined in .bss section in /tmp/ccAjbJMe.o
/tmp/ccAjbJMe.o: in function `solve()':
a.cc:(.text+0x3f1): relocation truncated to fit: R_X86_64_PC32 against symbol `dset' defined in .bss section in /tmp/ccAjbJMe.o
a.cc:(.text+0x442): relocation truncated to fit: R_X86_64_PC32 against symbol `B' defined in .bss section in /tmp/ccAjbJMe.o
/tmp/ccAjbJMe.o: in function `main':
a.cc:(.text+0x504): relocation truncated to fit: R_X86_64_PC32 against symbol `B' defined in .bss section in /tmp/ccAjbJMe.o
/tmp/ccAjbJMe.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x580): relocation truncated to fit: R_X86_64_PC32 against symbol `dset' defined in .bss section in /tmp/ccAjbJMe.o
a.cc:(.text+0x599): relocation truncated to fit: R_X86_64_PC32 against symbol `dset' defined in .bss section in /tmp/ccAjbJMe.o
collect2: error: ld returned 1 exit status