#include <iostream>
#include <set>

using namespace std;

void bejar(int x, set <int> &megold, int fokszam[], int n, int a[][101]){
    int i;
    bool volt[10001] = {0};
    volt[x] = 1;
    do{
        i = 1;
        while(i <= n && a[x][i] != 1){
            i ++;
        }
        if(volt[i] == 1){
            i++;
             while(i <= n && a[x][i] != 1){
            i ++;
        }
        }
        if(i <= n && fokszam[i] != 1){
            megold.insert(i);
            volt[i] = 1;
        }
        x = i;
    }while(fokszam[x] == 2);
}

int main()
{
    vector <int> a;
    int  n, m;
    cin >> n >> m;
    int x, y;
    for(int i = 0; i < m; i ++){
        cin >> x >> y;
        a[x][y] = 1;
        a[y][x] = 1;
    }
    int fokszam[10001] = {0};
    for(int i = 1 ; i <= n; i ++){
        for(int j = 1 ; j <= n; j ++){
            fokszam[i] += a[i][j];
        }
    }
    set <int> halmaz;
    for(int i = 1; i <= n; i ++){
        if(fokszam[i] == 1){
            bejar(i, halmaz, fokszam,n,a);
        }
    }
    cout << halmaz.size() << endl;
    for(auto i : halmaz)
        cout << i << " ";
    return 0;
}
Forditási hiba
open /var/local/lib/isolate/430/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:31:5: error: 'vector' was not declared in this scope
   31 |     vector <int> a;
      |     ^~~~~~
main.cpp:3:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
    2 | #include <set>
  +++ |+#include <vector>
    3 | 
main.cpp:31:13: error: expected primary-expression before 'int'
   31 |     vector <int> a;
      |             ^~~
main.cpp:37:9: error: 'a' was not declared in this scope
   37 |         a[x][y] = 1;
      |         ^
main.cpp:43:27: error: 'a' was not declared in this scope
   43 |             fokszam[i] += a[i][j];
      |                           ^
main.cpp:49:40: error: 'a' was not declared in this scope
   49 |             bejar(i, halmaz, fokszam,n,a);
      |                                        ^