Language: Java

#ifndef _TEMPLATE_ROOT
#define _TEMPLATE_ROOT
#include "bits/stdc++.h"
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define repl(i, a, b) for(ll i = a; i < (b); ++i)
#define repd(i, a, b) for(int i = a; i >= (b); --i)
#define repdl(i, a, b) for(ll i = a; i >= (b); --i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
#endif
#ifndef _TEMPLATE_IO
#define _TEMPLATE_IO

template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void writef(T ...tail) { write(tail...); cout << flush; }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }
template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  if (v.size()) {
    rep(i, 0, sz(v) - 1)
      out << v[i] << " ";
    out << v.back();
  }
  return out;
}
#endif
#include <atcoder/dsu.hpp>
using namespace std;

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

  int n, q; read(n, q);
  atcoder::dsu dsu(n);
  rep(i, 0, n) {
    int t, u, v; read(t, u, v);
    if (t == 0)
      dsu.merge(u, v);
    else
      write(dsu.same(u, v) ? 1 : 0);
  }
}



Compiler output:
Main.java:1: error: illegal character: '#'
#ifndef _TEMPLATE_ROOT
^
Main.java:2: error: illegal character: '#'
#define _TEMPLATE_ROOT
^
Main.java:3: error: illegal character: '#'
#include "bits/stdc++.h"
^
Main.java:5: error: illegal character: '#'
#define rep(i, a, b) for(int i = a; i < (b); ++i)
^
Main.java:5: error: class, interface, enum, or record expected
#define rep(i, a, b) for(int i = a; i < (b); ++i)
        ^
Main.java:5: error: class, interface, enum, or record expected
#define rep(i, a, b) for(int i = a; i < (b); ++i)
                                    ^
Main.java:5: error: class, interface, enum, or record expected
#define rep(i, a, b) for(int i = a; i < (b); ++i)
                                             ^
Main.java:6: error: illegal character: '#'
#define repl(i, a, b) for(ll i = a; i < (b); ++i)
^
Main.java:6: error: class, interface, enum, or record expected
#define repl(i, a, b) for(ll i = a; i < (b); ++i)
                                    ^
Main.java:6: error: class, interface, enum, or record expected
#define repl(i, a, b) for(ll i = a; i < (b); ++i)
                                             ^
Main.java:7: error: illegal character: '#'
#define repd(i, a, b) for(int i = a; i >= (b); --i)
^
Main.java:7: error: class, interface, enum, or record expected
#define repd(i, a, b) for(int i = a; i >= (b); --i)
                                     ^
Main.java:7: error: class, interface, enum, or record expected
#define repd(i, a, b) for(int i = a; i >= (b); --i)
                                               ^
Main.java:8: error: illegal character: '#'
#define repdl(i, a, b) for(ll i = a; i >= (b); --i)
^
Main.java:8: error: class, interface, enum, or record expected
#define repdl(i, a, b) for(ll i = a; i >= (b); --i)
                                     ^
Main.java:8: error: class, interface, enum, or record expected
#define repdl(i, a, b) for(ll i = a; i >= (b); --i)
                                               ^
Main.java:9: error: illegal character: '#'
#define all(x) begin(x), end(x)
^
Main.java:10: error: illegal character: '#'
#define sz(x) (int)(x).size()
^
Main.java:12: error: class, interface, enum, or record expected
typedef pair<int, int> pii;
^
Main.java:13: error: class, interface, enum, or record expected
typedef vector<int> vi;
^
Main.java:14: error: class, interface, enum, or record expected
template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
^
Main.java:14: error: class, interface, enum, or record expected
template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
                                                                             ^
Main.java:14: error: class, interface, enum, or record expected
template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
                                                                                          ^
Main.java:14: error: class, interface, enum, or record expected
template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
                                                                                                          ^
Main.java:15: error: class, interface, enum, or record expected
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
                                                                             ^
Main.java:15: error: class, interface, enum, or record expected
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
                                                                                          ^
Main.java:15: error: class, interface, enum, or record expected
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
                                                                                                          ^
Main.java:16: error: illegal character: '#'
#endif
^
Main.java:17: error: illegal character: '#'
#ifndef _TEMPLATE_IO
^
Main.java:18: error: illegal character: '#'
#define _TEMPLATE_IO
^
Main.java:20: error: class, interface, enum, or record expected
template<typename H> void read(H& head) { cin >> head; }
                                                       ^
Main.java:21: error: class, interface, enum, or record expected
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
                                                                                  ^
Main.java:21: error: class, interface, enum, or record expected
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
                                                                                                 ^
Main.java:22: error: class, interface, enum, or record expected
template<typename H> void write(H head) { cout << head << '\n'; }
                                                                ^
Main.java:23: error: class, interface, enum, or record expected
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
                                                                                         ^
Main.java:23: error: class, interface, enum, or record expected
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
                                                                                                         ^
Main.java:24: error: class, interface, enum, or record expected
template<typename ...T> void writef(T ...tail) { write(tail...); cout << flush; }
                                                                 ^
Main.java:24: error: class, interface, enum, or record expected
template<typename ...T> void writef(T ...tail) { write(tail...); cout << flush; }
                                                                                ^
Main.java:25: error: class, interface, enum, or record expected
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }
                                                            ^
Main.java:25: error: class, interface, enum, or record expected
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }
                                                                     ^
Main.java:31: error: class, interface, enum, or record expected
    out << v.back();
    ^
Main.java:32: error: class, interface, enum, or record expected
  }
  ^
Main.java:34: error: class, interface, enum, or record expected
}
^
Main.java:35: error: illegal character: '#'
#endif
^
Main.java:36: error: illegal character: '#'
#include <atcoder/dsu.hpp>
^
Main.java:44: error: not a statement
  atcoder::dsu dsu(n);
  ^
Main.java:39: error: unnamed classes are a preview feature and are disabled by default.
int main() {
^
  (use --enable-preview to enable unnamed classes)
Main.java:40: error: ';' expected
	cin.tie(0)->sync_with_stdio(0);
	          ^
Main.java:44: error: ';' expected
  atcoder::dsu dsu(n);
              ^
Main.java:45: error: ';' expected
  rep(i, 0, n) {
              ^
50 errors