func_code_string: #include <bits/stdc++.h>   using namespace std;   set<int> inchat;   set<int> inchat2;   bool leaders[100005];   int id[100005];   char in[100005];   int main() {     int N, M;     scanf( %d %d , &N, &M);     for (int i = 1; i <= N; i++) leaders[i] = true;     for (int i = 0; i < M; i++) {       scanf(  %c %d n , &in[i], &id[i]);     }     for (int i = M - 1; i > 0; i--) {       if (in[i] ==  - ) {         inchat2.insert(id[i]);       } else {         auto it = inchat2.find(id[i]);         if (it != inchat2.end()) {           inchat2.erase(it);         }       }     }     for (int i = 0; i < M; i++) {       if (in[i] ==  + ) {         if (inchat.size() == 0 &&             (inchat2.size() == 0 ||              (inchat2.size() == 1 && *inchat2.begin() == id[i]))) {           if (i == 0 || id[i - 1] == id[i]) {           } else {             leaders[id[i]] = false;           }         } else {           leaders[id[i]] = false;         }         inchat.insert(id[i]);       } else {         if (inchat.size() == 0 ||             (inchat.size() == 1 && (*inchat.begin() == id[i]))) {           if (inchat2.size() == 0 ||               (inchat2.size() == 1 && *inchat2.begin() == id[i])) {             if (i == M - 1 || id[i + 1] == id[i]) {             } else {               leaders[id[i]] = false;             }           } else {             leaders[id[i]] = false;           }         } else {           leaders[id[i]] = false;         }         auto it = inchat.find(id[i]);         if (it != inchat.end()) {           inchat.erase(it);         }       }       if (i != M - 1) {         if (in[i + 1] ==  - ) {           auto it = inchat2.find(id[i + 1]);           if (it != inchat2.end()) {             inchat2.erase(it);           }         } else {           inchat2.insert(id[i + 1]);         }       }     }     int cnt = 0;     for (int i = 1; i <= N; i++) {       if (leaders[i]) {         cnt++;       }     }     printf( %d n , cnt);     for (int i = 1; i <= N; i++) {       if (leaders[i]) {         printf( %d  , i);       }     }     return 0;   }   