Language: Java

import java.io.*;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Comparator;
    
class Main{
    
static final int INF=Integer.MAX_VALUE/2;
static final PrintWriter out=new PrintWriter(System.out);
    
static class Pair{
int x;
int y;
Pair(int x,int y){
this.x=x; this.y=y;
}
}

static class Edge{
int to;
int cost;
Edge(int to,int cost){
this.to=to; this.cost=cost;
}
}

public class QueueComparator implements Comparator{
public int compare(Pair p1,Pair p2){
return (p1.x>p2.x)?1:(p1.x<p2.x)?-1:0;
}
}
    
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
int v=Integer.parseInt(line.split(" ")[0]);
int e=Integer.parseInt(line.split(" ")[1]);
int r=Integer.parseInt(line.split(" ")[2]);
HashMap<Integer,ArrayList<Edge>> dic=new HashMap<Integer,ArrayList<Edge>>();
int[] d=new int[v];
for(int i=0;i<e;i++){
line=br.readLine();
int s=Integer.parseInt(line.split(" ")[0]);
int t=Integer.parseInt(line.split(" ")[1]);
int c=Integer.parseInt(line.split(" ")[2]);
if(!containsKey(s)){
ArrayList<Edge> array=new ArrayList<Edge>();
array.add(new Edge(t,c));
dic.put(s,array);
}
else{
dic.put(s,dic.get(s).add(new Edge(t,c)));
}
}
djkstra(r,d,dic);
for(int i=0;i<v;i++) out.println((d[i]==INF)?"INF":d[i]);
}
}

private static void djkstra(int r,int[] d,HashMap<Integer,ArrayList<Edge>> dic){
PriorityQueue<Pair> pque=new PriorityQueue<Pair>(1,QueueComparator);
Arrays.fill(d,INF);
d[r]=0;
pque.offer(new Pair(0,r));
while(!pque.isEmpty()){
Pair p=pque.poll();
int v=p.y;
if(d[v]<p.x) continue;
for(int i=0;i<dic.get(v).size();i++){
Edge e=dic.get(v).get(i);
if(d[e.to]>d[v]+e.cost){
d[e.to]=d[v]+e.cost;
pque.offer(new Pair(d[e.to],e.to));
}
}
}
}
}

Compiler output:
Main.java:61: error: cannot find symbol
private static void djkstra(int r,int[] d,HashMap<Integer,ArrayList<Edge>> dic){
                                          ^
  symbol:   class HashMap
  location: class Main
Main.java:61: error: cannot find symbol
private static void djkstra(int r,int[] d,HashMap<Integer,ArrayList<Edge>> dic){
                                                          ^
  symbol:   class ArrayList
  location: class Main
Main.java:27: error: Main.QueueComparator is not abstract and does not override abstract method compare(Object,Object) in Comparator
public class QueueComparator implements Comparator{
       ^
Main.java:40: error: cannot find symbol
HashMap<Integer,ArrayList<Edge>> dic=new HashMap<Integer,ArrayList<Edge>>();
^
  symbol:   class HashMap
  location: class Main
Main.java:40: error: cannot find symbol
HashMap<Integer,ArrayList<Edge>> dic=new HashMap<Integer,ArrayList<Edge>>();
                ^
  symbol:   class ArrayList
  location: class Main
Main.java:40: error: cannot find symbol
HashMap<Integer,ArrayList<Edge>> dic=new HashMap<Integer,ArrayList<Edge>>();
                                         ^
  symbol:   class HashMap
  location: class Main
Main.java:40: error: cannot find symbol
HashMap<Integer,ArrayList<Edge>> dic=new HashMap<Integer,ArrayList<Edge>>();
                                                         ^
  symbol:   class ArrayList
  location: class Main
Main.java:47: error: cannot find symbol
if(!containsKey(s)){
    ^
  symbol:   method containsKey(int)
  location: class Main
Main.java:48: error: cannot find symbol
ArrayList<Edge> array=new ArrayList<Edge>();
^
  symbol:   class ArrayList
  location: class Main
Main.java:48: error: cannot find symbol
ArrayList<Edge> array=new ArrayList<Edge>();
                          ^
  symbol:   class ArrayList
  location: class Main
Main.java:62: error: cannot find symbol
PriorityQueue<Pair> pque=new PriorityQueue<Pair>(1,QueueComparator);
                                                   ^
  symbol:   variable QueueComparator
  location: class Main
11 errors