Language: C++


import java.util.*;
 
class MyComp implements Comparator<Pair> {
 
    public int compare(Pair arg0, Pair arg1) {
        Pair t0 = (Pair) arg0;
        Pair t1 = (Pair) arg1;
        if(t0.time > t1.time) {
            return -1;
             
        }
        else if(t0.time < t1.time) {
            return 1;
        }
        else {
            if(t0.id > t1.id) {
                return 1;
            }
            else if(t0.id < t1.id) {
                return -1;
            }
            else {
                return 0;
            }
        }
         
    }
     
}
 
 
class Pair {
    int id;
    int time;
    public Pair(int d, int t) {
        this.id = d;
        this.time = t;
    }
    public Pair(Pair a) {
        this.id = a.id;
        this.time = a.time;
    }
     
}
 
public class Main {
 
 
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
         
         
         
        PriorityQueue <Pair> queA = new PriorityQueue <Pair>(11,new MyComp());
         
        PriorityQueue <Pair> queBX = new PriorityQueue <Pair>(11,new MyComp());
         
        int N = stdIn.nextInt();
        int R = stdIn.nextInt();
        int L = stdIn.nextInt();
         
        int[] time = new int[100000];
         
        int lastTime = 0;
        queA.add(new Pair(1,0));
         
        for(int i = 0; i < R; i++) {
             
            int d = stdIn.nextInt();
            int t = stdIn.nextInt();
            int x = stdIn.nextInt();
            time[queA.peek().id-1] += t - lastTime;
            boolean atta = false;
             
            while(!queA.isEmpty()) {
                 
                Pair tmp = queA.poll();
                 
                if(tmp.id == d) {
                    atta = true;
                    tmp.time +=  x;
                    queBX.offer(tmp);
                    break;
                }
                else {
                    queBX.offer(tmp);
                }
            }
             
            if(!atta) {
                queBX.offer(new Pair(d,x));
            }
                 
            while(!queBX.isEmpty()) {
                queA.offer(queBX.poll());
            }
             
 
            lastTime = t;
                 
        }
         
        time[queA.peek().id-1] += L - lastTime;
         
        int timeA = 0;
        int idA = 0;
        for(int i = 0; i < time.length; i++) {
            if(timeA < time[i]) {
                timeA = time[i];
                idA = i;
            }
        }
         
        System.out.println(idA+1);
         
    }
     
 
 
}

Compiler output:
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.*;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:25: error: expected initializer before 'Comparator'
    4 | class MyComp implements Comparator<Pair> {
      |                         ^~~~~~~~~~
a.cc:36:11: error: expected ':' before 'Pair'
   36 |     public Pair(int d, int t) {
      |           ^~~~~
      |           :
a.cc:40:11: error: expected ':' before 'Pair'
   40 |     public Pair(Pair a) {
      |           ^~~~~
      |           :
a.cc:40:12: error: invalid constructor; you probably meant 'Pair (const Pair&)'
   40 |     public Pair(Pair a) {
      |            ^~~~
a.cc:45:2: error: expected ';' after class definition
   45 | }
      |  ^
      |  ;
a.cc: In constructor 'Pair::Pair(int, int)':
a.cc:37:14: error: request for member 'id' in '(Pair*)this', which is of pointer type 'Pair*' (maybe you meant to use '->' ?)
   37 |         this.id = d;
      |              ^~
a.cc:38:14: error: request for member 'time' in '(Pair*)this', which is of pointer type 'Pair*' (maybe you meant to use '->' ?)
   38 |         this.time = t;
      |              ^~~~
a.cc: At global scope:
a.cc:47:1: error: expected unqualified-id before 'public'
   47 | public class Main {
      | ^~~~~~