Language: Java

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

const int MX = 100005;

vector<P> g[MX];
int x[MX];
bool used[MX];

vector<int> ans;
int dfs(int v) {
  used[v] = true;
  int res = x[v];
  for (P e : g[v]) {
    if (used[e.first]) continue;
    int r = dfs(e.first);
    if (r) ans.push_back(e.second);
    res ^= r;
  }
  return res;
}

int main() {
  int n, m;
  cin >> n >> m;
  vector<P> a(n);
  rep(i,n) cin >> a[i].first >> a[i].second;
  sort(a.begin(), a.end());
  x[0] = a[0].second;
  rep(i,n-1) x[i+1] = a[i].second^a[i+1].second;
  x[n] = a[n-1].second;

  rep(i,m) {
    int l, r;
    cin >> l >> r;
    l = lower_bound(a.begin(),a.end(),P(l,0))-a.begin();
   // cout<< l<<endl;
    r = upper_bound(a.begin(),a.end(),P(r,1))-a.begin();
   // cout << r<<endl;
    g[l].emplace_back(r,i+1);
    g[r].emplace_back(l,i+1);
  }

  rep(i,n+1) {
    if (used[i]) continue;
    if (dfs(i)) {
      cout << -1 << endl;
      return 0;
    }
  }

  cout << ans.size() << endl;
  sort(ans.begin(), ans.end());
  rep(i,ans.size()) printf("%d ", ans[i]);
  cout << endl;
  return 0;
}


Compiler output:
Main.java:1: error: illegal character: '#'
#include <bits/stdc++.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include <bits/stdc++.h>
         ^
Main.java:2: error: illegal character: '#'
#define rep(i,n) for (int i = 0; i < (n); ++i)
^
Main.java:2: error: class, interface, enum, or record expected
#define rep(i,n) for (int i = 0; i < (n); ++i)
                                 ^
Main.java:2: error: class, interface, enum, or record expected
#define rep(i,n) for (int i = 0; i < (n); ++i)
                                          ^
Main.java:4: error: unnamed classes are a preview feature and are disabled by default.
using ll = long long;
^
  (use --enable-preview to enable unnamed classes)
Main.java:4: error: '.class' expected
using ll = long long;
                ^
Main.java:5: error: '.class' expected
using P = pair<int,int>;
                  ^
Main.java:5: error: <identifier> expected
using P = pair<int,int>;
                   ^
Main.java:7: error: class, interface, enum, or record expected
const int MX = 100005;
^
Main.java:9: error: class, interface, enum, or record expected
vector<P> g[MX];
^
Main.java:10: error: class, interface, enum, or record expected
int x[MX];
^
Main.java:11: error: class, interface, enum, or record expected
bool used[MX];
^
Main.java:28: error: not a statement
  cin >> n >> m;
           ^
Main.java:29: error: not a statement
  vector<P> a(n);
              ^
Main.java:30: error: not a statement
  rep(i,n) cin >> a[i].first >> a[i].second;
                             ^
Main.java:38: error: not a statement
    cin >> l >> r;
             ^
Main.java:50: error: not a statement
      cout << -1 << endl;
                 ^
Main.java:55: error: not a statement
  cout << ans.size() << endl;
                     ^
Main.java:58: error: not a statement
  cout << endl;
       ^
Main.java:29: error: ';' expected
  vector<P> a(n);
             ^
Main.java:29: error: ';' expected
  vector<P> a(n);
               ^
Main.java:30: error: ';' expected
  rep(i,n) cin >> a[i].first >> a[i].second;
          ^
Main.java:33: error: ';' expected
  rep(i,n-1) x[i+1] = a[i].second^a[i+1].second;
            ^
Main.java:36: error: ';' expected
  rep(i,m) {
          ^
Main.java:47: error: ';' expected
  rep(i,n+1) {
            ^
Main.java:57: error: ';' expected
  rep(i,ans.size()) printf("%d ", ans[i]);
                   ^
27 errors