func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   vector<long long> v[100009], vv[100009];   long long vis[100009], dis[101][100001], ar[100001];   void bfs(long long k) {     queue<long long> q;     memset(vis, 0, sizeof(vis));     for (long long x : vv[k]) {       q.push(x);       vis[x] = 1;       dis[k][x] = 0;     }     while (!q.empty()) {       long long x = q.front();       q.pop();       for (long long y : v[x]) {         if (!vis[y]) {           vis[y] = 1;           q.push(y);           dis[k][y] = dis[k][x] + 1;         }       }     }   }   int32_t main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long n, m, k, s, ans = 1e15;     cin >> n >> m >> k >> s;     for (long long i = 1; i <= n; i++) {       cin >> ar[i];       vv[ar[i]].push_back(i);     }     for (long long i = 0; i < m; i++) {       long long x, y;       cin >> x >> y;       v[x].push_back(y);       v[y].push_back(x);     }     for (long long i = 1; i <= k; i++) bfs(i);     for (long long i = 1; i <= n; i++) {       vector<long long> hh;       long long as = 0;       for (long long j = 1; j <= k; j++) hh.push_back(dis[j][i]);       sort(hh.begin(), hh.end());       for (long long j = 0; j < s; j++) as += hh[j];       cout << as <<    ;     }     cout << endl;   }   