Language: C++

#include<iostream>
#include<algorithm>

typedef unsigned long long ULL;
typedef long long LL;

using namespace std;

typedef struct{
    int pos;
    bool *flag;
}NEXT;
typedef struct{
    NEXT *next;
    int num_of_next;
    bool flag;
}POS;

void Moving(POS *pos);
bool Check(POS *pos, int N);
int main(){
    bool *line;
    POS *pos;
    int N,M;
    int i,j;
    int a,b;
    int count,temp_count;
    int temp_pos;
    cin >> N >> M;
    line = new bool[M];
    pos = new POS[N];
    for(i=0;i<N;i++){
        pos[i].next = new NEXT[N-1];
        pos[i].num_of_next = 0;
        pos[i].flag = false;
    }
    for(i=0;i<M;i++){
        cin >> a >> b;
        pos[a-1].next[pos[a-1].num_of_next].pos = b-1;
        pos[b-1].next[pos[b-1].num_of_next].pos = a-1;
        line[i] = true;
        pos[a-1].next[pos[a-1].num_of_next].flag = &line[i];
        pos[b-1].next[pos[b-1].num_of_next].flag = &line[i];
        pos[a-1].num_of_next++;
        pos[b-1].num_of_next++;

    }
    count = 0;
    for(i=0;i<N;i++){
        if( pos[i].flag != true && pos[i].num_of_next == 1 ){
            temp_count = 1;
            pos[i].flag = true;
            temp_pos = pos[i].next[0].pos;
            //cout << i << endl;
            while(pos[temp_pos].num_of_next <= 2){
              ///  cout << ":" << temp_pos << endl;
                pos[temp_pos].flag = true;
                if( pos[pos[temp_pos].next[0].pos].flag == false){
                    temp_pos = pos[temp_pos].next[0].pos;
                }else if(pos[pos[temp_pos].next[1].pos].flag == false){
                    temp_pos = pos[temp_pos].next[1].pos;
                }else{
                    break;
                }
                //cout << ":" << temp_pos << endl;
                temp_count++;
            }
            //cout << "Count:" << temp_count << endl;
            count += temp_count;
            
        }
    }
    cout << count << endl;
    return 0;
}#include<iostream>
#include<algorithm>

typedef unsigned long long ULL;
typedef long long LL;

using namespace std;

typedef struct{
    int pos;
    bool *flag;
}NEXT;
typedef struct{
    NEXT *next;
    int num_of_next;
    bool flag;
}POS;

void Moving(POS *pos);
bool Check(POS *pos, int N);
int main(){
    bool *line;
    POS *pos;
    int N,M;
    int i,j;
    int a,b;
    int count,temp_count;
    int temp_pos;
    cin >> N >> M;
    line = new bool[M];
    pos = new POS[N];
    for(i=0;i<N;i++){
        pos[i].next = new NEXT[N-1];
        pos[i].num_of_next = 0;
        pos[i].flag = false;
    }
    for(i=0;i<M;i++){
        cin >> a >> b;
        pos[a-1].next[pos[a-1].num_of_next].pos = b-1;
        pos[b-1].next[pos[b-1].num_of_next].pos = a-1;
        line[i] = true;
        pos[a-1].next[pos[a-1].num_of_next].flag = &line[i];
        pos[b-1].next[pos[b-1].num_of_next].flag = &line[i];
        pos[a-1].num_of_next++;
        pos[b-1].num_of_next++;

    }
    count = 0;
    for(i=0;i<N;i++){
        if( pos[i].flag != true && pos[i].num_of_next == 1 ){
            temp_count = 1;
            pos[i].flag = true;
            temp_pos = pos[i].next[0].pos;
            //cout << i << endl;
            while(pos[temp_pos].num_of_next <= 2){
              ///  cout << ":" << temp_pos << endl;
                pos[temp_pos].flag = true;
                if( pos[pos[temp_pos].next[0].pos].flag == false){
                    temp_pos = pos[temp_pos].next[0].pos;
                }else if(pos[pos[temp_pos].next[1].pos].flag == false){
                    temp_pos = pos[temp_pos].next[1].pos;
                }else{
                    break;
                }
                //cout << ":" << temp_pos << endl;
                temp_count++;
            }
            //cout << "Count:" << temp_count << endl;
            count += temp_count;
            
        }
    }
    cout << count << endl;
    return 0;
}

Compiler output:
a.cc:75:2: error: stray '#' in program
   75 | }#include<iostream>
      |  ^
a.cc:75:3: error: 'include' does not name a type
   75 | }#include<iostream>
      |   ^~~~~~~
a.cc:86:2: error: conflicting declaration 'typedef struct NEXT NEXT'
   86 | }NEXT;
      |  ^~~~
a.cc:12:2: note: previous declaration as 'typedef struct NEXT NEXT'
   12 | }NEXT;
      |  ^~~~
a.cc:91:2: error: conflicting declaration 'typedef struct POS POS'
   91 | }POS;
      |  ^~~
a.cc:17:2: note: previous declaration as 'typedef struct POS POS'
   17 | }POS;
      |  ^~~
a.cc:95:5: error: redefinition of 'int main()'
   95 | int main(){
      |     ^~~~
a.cc:21:5: note: 'int main()' previously defined here
   21 | int main(){
      |     ^~~~