Language: C++

#include <vector>
#include <cstdio>
class union_find{
????????std::vector<int> parent;
public:
????????int root(int a){return parent[a]==a?a:(parent[a]=root(parent[a]));}
????????union_find(int n):parent(n+1){for(int i=1;i<=n;i++)parent[i]=i;}
????????int same(int a,int b){return root(a)==root(b);}
????????int unite(int a,int b){
????????????????int x=root(a),y=root(b);//if(x==y)return 0;
????????????????parent[x]=y;
????????????????return 1;
????????}
};
int main(){
????????int n,m;
????????scanf("%d%d",&n,&m);
????????union_find uf(n);
????????int a,b;
????????for(;m--;uf.unite(a,b))scanf("%d%d",&a,&b);
????????for(scanf("%d",&m);m--;puts(uf.same(a,b)?"yes":"no"))scanf("%d%d",&a,&b);
}

Compiler output:
a.cc:4:1: error: expected unqualified-id before '?' token
    4 | ????????std::vector<int> parent;
      | ^
a.cc:6:1: error: expected unqualified-id before '?' token
    6 | ????????int root(int a){return parent[a]==a?a:(parent[a]=root(parent[a]));}
      | ^
a.cc:7:1: error: expected unqualified-id before '?' token
    7 | ????????union_find(int n):parent(n+1){for(int i=1;i<=n;i++)parent[i]=i;}
      | ^
a.cc:8:1: error: expected unqualified-id before '?' token
    8 | ????????int same(int a,int b){return root(a)==root(b);}
      | ^
a.cc:9:1: error: expected unqualified-id before '?' token
    9 | ????????int unite(int a,int b){
      | ^
a.cc: In function 'int main()':
a.cc:16:1: error: expected primary-expression before '?' token
   16 | ????????int n,m;
      | ^
a.cc:16:2: error: expected primary-expression before '?' token
   16 | ????????int n,m;
      |  ^
a.cc:16:3: error: expected primary-expression before '?' token
   16 | ????????int n,m;
      |   ^
a.cc:16:4: error: expected primary-expression before '?' token
   16 | ????????int n,m;
      |    ^
a.cc:16:5: error: expected primary-expression before '?' token
   16 | ????????int n,m;
      |     ^
a.cc:16:6: error: expected primary-expression before '?' token
   16 | ????????int n,m;
      |      ^
a.cc:16:7: error: expected primary-expression before '?' token
   16 | ????????int n,m;
      |       ^
a.cc:16:8: error: expected primary-expression before '?' token
   16 | ????????int n,m;
      |        ^
a.cc:16:9: error: expected primary-expression before 'int'
   16 | ????????int n,m;
      |         ^~~
a.cc:16:9: error: expected ':' before 'int'
   16 | ????????int n,m;
      |         ^~~
      |         :
a.cc:16:9: error: expected primary-expression before 'int'
   16 | ????????int n,m;
      |         ^~~
a.cc:16:9: error: expected ':' before 'int'
   16 | ????????int n,m;
      |         ^~~
      |         :
a.cc:16:9: error: expected primary-expression before 'int'
   16 | ????????int n,m;
      |         ^~~
a.cc:16:9: error: expected ':' before 'int'
   16 | ????????int n,m;
      |         ^~~
      |         :
a.cc:16:9: error: expected primary-expression before 'int'
   16 | ????????int n,m;
      |         ^~~
a.cc:16:9: error: expected ':' before 'int'
   16 | ????????int n,m;
      |         ^~~
      |         :
a.cc:16:9: error: expected primary-expression before 'int'
   16 | ????????int n,m;
      |         ^~~
a.cc:16:9: error: expected ':' before 'int'
   16 | ????????int n,m;
      |         ^~~
      |         :
a.cc:16:9: error: expected primary-expression before 'int'
   16 | ????????int n,m;
      |         ^~~
a.cc:16:9: error: expected ':' before 'int'
   16 | ????????int n,m;
      |         ^~~
      |         :
a.cc:16:9: error: expected primary-expression before 'int'
   16 | ????????int n,m;
      |         ^~~
a.cc:16:9: error: expected ':' before 'int'
   16 | ????????int n,m;
      |         ^~~
      |         :
a.cc:16:9: error: expected primary-expression before 'int'
   16 | ????????int n,m;
      |         ^~~
a.cc:16:9: error: expected ':' before 'int'
   16 | ????????int n,m;
      |         ^~~
      |         :
a.cc:16:9: error: expected primary-expression before 'int'
   16 | ????????int n,m;
      |         ^~~
a.cc:17:1: error: expected primary-expression before '?' token
   17 | ????????scanf("%d%d",&n,&m);
      | ^
a.cc:17:2: error: expected primary-expression before '?' token
   17 | ????????scanf("%d%d",&n,&m);
      |  ^
a.cc:17:3: error: expected primary-expression before '?' token
   17 | ????????scanf("%d%d",&n,&m);
      |   ^
a.cc:17:4: error: expected primary-expression before '?' token
   17 | ????????scanf("%d%d",&n,&m);
      |    ^
a.cc:17:5: error: expected primary-expression before '?' token
   17 | ????????scanf("%d%d",&n,&m);
      |     ^
a.cc:17:6: error: expected primary-expression before '?' token
   17 | ????????scanf("%d%d",&n,&m);
      |      ^
a.cc:17:7: error: expected primary-expression before '?' token
   17 | ????????scanf("%d%d",&n,&m);
      |       ^
a.cc:17:8: error: expected primary-expression before '?' token
   17 | ????????scanf("%d%d",&n,&m);
      |        ^
a.cc:17:23: error: 'n' was not declared in this scope
   17 | ????????scanf("%d%d",&n,&m);
      |                       ^
a.cc:17:26: error: 'm' was not declared in this scope
   17 | ????????scanf("%d%d",&n,&m);
      |                          ^
a.cc:17:28: error: expected ':' before ';' token
   17 | ????????scanf("%d%d",&n,&m);
      |                            ^
      |                            :
a.cc:17:28: error: expected primary-expression before ';' token
a.cc:17:28: error: expected ':' before ';' token
   17 | ????????scanf("%d%d",&n,&m);
      |                            ^
      |                            :
a.cc:17:28: error: expected primary-expression before ';' token
a.cc:17:28: error: expected ':' before ';' token
   17 | ????????scanf("%d%d",&n,&m);
      |                            ^
      |                            :
a.cc:17:28: error: expected primary-expression before ';' token
a.cc:17:28: error: expected ':' before ';' token
   17 | ????????scanf("%d%d",&n,&m);
      |                            ^
      |                            :
a.cc:17:28: error: expected primary-expression before ';' token
a.cc:17:28: error: expected ':' before ';' token
   17 | ????????scanf("%d%d",&n,&m);
      |                            ^
      |                            :
a.cc:17:28: error: expected primary-expression before ';' token
a.cc:17:28: error: expected ':' before ';' token
   17 | ????????scanf("%d%d",&n,&m);
      |                            ^
      |                            :
a.cc:17:28: error: expected primary-expression before ';' token
a.cc:17:28: error: expected ':' before ';' token
   17 | ????????scanf("%d%d",&n,&m);
      |                            ^
      |                            :
a.cc:17:28: error: expected primary-expression before ';' token
a.cc:17:28: error: expected ':' before ';' token
   17 | ????????scanf("%d%d",&n,&m);
      |                            ^
      |                            :
a.cc:17:28: error: expected primary-expression before ';' token
a.cc:18:1: error: expected primary-expression before '?' token
   18 | ????????union_find uf(n);
      | ^
a.cc:18:2: error: expected primary-expression before '?' token
   18 | ????????union_find uf(n);
      |  ^
a.cc:18:3: error: expected primary-expression before '?' token
   18 | ????????union_find uf(n);
      |   ^
a.cc:18:4: error: expected primary-expression before '?' token
   18 | ????????union_find uf(n);
      |    ^
a.cc:18:5: error: expected primary-expression before '?' token
   18 | ????????union_find uf(n);
      |     ^
a.cc:18:6: error: expected primary-expression before '?' token
   18 | ????????union_find uf(n);
      |      ^
a.cc:18:7: error: expected primary-expression before '?' token
   18 | ????????union_find uf(n);
      |       ^
a.cc:18:8: error: expected primary-expression before '?' token
   18 | ????????union_find uf(n);
      |        ^
a.cc:18:20: error: expected primary-expression before 'uf'
   18 | ????????union_find uf(n);
      |                    ^~
a.cc:18:19: error: expected ':' before 'uf'
   18 | ????????union_find uf(n);
      |                   ^~~
      |                   :
a.cc:18:20: error: 'uf' was not declared in this scope
   18 | ????????union_find uf(n);
      |                    ^~
a.cc:18:25: error: expected ':' before ';' token
   18 | ????????union_find uf(n);
      |                         ^
      |                         :
a.cc:18:25: error: expected primary-expression before ';' token
a.cc:18:25: error: expected ':' before ';' token
   18 | ????????union_find uf(n);
      |                         ^
      |                         :
a.cc:18:25: error: expected primary-expression before ';' token
a.cc:18:25: error: expected ':' before ';' token
   18 | ????????union_find uf(n);
      |                         ^
      |                         :
a.cc:18:25: error: expected primary-expression before ';' token
a.cc:18:25: error: expected ':' before ';' token
   18 | ????????union_find uf(n);
      |                         ^
      |                         :
a.cc:18:25: error: expected primary-expression before ';' token
a.cc:18:25: error: expected ':' before ';' token
   18 | ????????union_find uf(n);
      |                         ^
      |                         :
a.cc:18:25: error: expected primary-expression before ';' token
a.cc:18:25: error: expected ':' before ';' token
   18 | ????????union_find uf(n);
      |                         ^
      |                         :
a.cc:18:25: error: expected primary-expression before ';' token
a.cc:18:25: error: expected ':' before ';' token
   18 | ????????union_find uf(n);
      |                         ^
      |                         :
a.cc:18:25: error: expected primary-expression before ';' token
a.cc:19:1: error: expected primary-expression before '?' token
   19 | ????????int a,b;
      | ^
a.cc:19:2: error: expected primary-expression before '?' token
   19 | ????????int a,b;
      |  ^
a.cc:19:3: error: expected primary-expression before '?' token
   19 | ????????int a,b;
      |   ^
a.cc:19:4: error: expected primary-expression before '?' token
   19 | ????????int a,b;
      |    ^
a.cc:19:5: error: expected primary-expression before '?' token
   19 | ????????int a,b;
      |     ^
a.cc:19:6: error: expected primary-expression before '?' token
   19 | ????????int a,b;
      |      ^
a.cc:19:7: error: expected primary-expression before '?' token
   19 | ????????int a,b;
      |       ^
a.cc:19:8: error: expected primary-expression before '?' token
   19 | ????????int a,b;
      |        ^
a.cc:19:9: error: expected primary-expression before 'int'
   19 | ????????int a,b;
      |         ^~~
a.cc:19:9: error: expected ':' before 'int'
   19 | ????????int a,b;
      |         ^~~
      |         :
a.cc:19:9: error: expected primary-expression before 'int'
   19 | ????????int a,b;
      |         ^~~
a.cc:19:9: error: expected ':' before 'int'
   19 | ????????int a,b;
      |         ^~~
      |         :
a.cc: