Language: C++

package main

import (
	"container/heap"
	"fmt"
)

const INF = 999999999999999999

type node struct {
	me    int
	total int64
	index int
	done  bool
}

func (pq PriorityQueue) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
	pq[i].index = i
	pq[j].index = j
}

type PriorityQueue []*node

func (pq PriorityQueue) Len() int { return len(pq) }

func (pq PriorityQueue) Less(i, j int) bool {
	return pq[i].total < pq[j].total
}

func (pq *PriorityQueue) Push(x interface{}) {
	item := x.(*node)
	item.index = len(*pq)
	*pq = append(*pq, item)
}

func (pq *PriorityQueue) Pop() interface{} {
	old := *pq
	n := len(old)
	item := old[n-1]
	item.index = -1
	*pq = old[0 : n-1]
	return item
}

type edge struct {
	to   int
	cost int64
}

func main() {
	var V, E, r int
	fmt.Scanf("%d %d %d", &V, &E, &r)

	edges := make([][]edge, V)
	nodes := make([]*node, V)
	queue := make(PriorityQueue, 0)

	for i := 0; i < E; i++ {
		var s, t int
		var cost int64
		n, _ := fmt.Scanf("%d %d %d", &s, &t, &cost)
		if n != 3 {
			panic(fmt.Sprintf("scaned string want 3 but %d", n))
		}
		edges[s] = append(edges[s], edge{to: t, cost: cost})

	}

	for i := 0; i < V; i++ {
		if r == i {
			nodes[i] = &node{me: i, total: 0}
			heap.Push(&queue, nodes[i])
		} else {
			nodes[i] = &node{me: i, total: INF}

		}
	}

	for queue.Len() > 0 {

		node := heap.Pop(&queue).(*node)
		node.done = true

		for _, edge := range edges[node.me] {
			if nodes[edge.to].index == -1 {
				continue

			}
			alt := edge.cost + node.total

			if alt < nodes[edge.to].total {
				nodes[edge.to].total = alt

			}

			if !nodes[edge.to].done {
				heap.Push(&queue, nodes[edge.to])
			}

		}

	}

	for _, node := range nodes {
		if node.total >= INF {
			fmt.Printf("INF\n")
		} else {
			fmt.Printf("%d\n", node.total)
		}
	}

}



Compiler output:
a.cc:1:1: error: 'package' does not name a type
    1 | package main
      | ^~~~~~~
a.cc:17:6: error: expected constructor, destructor, or type conversion before '(' token
   17 | func (pq PriorityQueue) Swap(i, j int) {
      |      ^
a.cc:23:1: error: 'type' does not name a type; did you mean 'typeof'?
   23 | type PriorityQueue []*node
      | ^~~~
      | typeof
a.cc:27:6: error: expected constructor, destructor, or type conversion before '(' token
   27 | func (pq PriorityQueue) Less(i, j int) bool {
      |      ^
a.cc:31:6: error: expected constructor, destructor, or type conversion before '(' token
   31 | func (pq *PriorityQueue) Push(x interface{}) {
      |      ^
a.cc:31:44: error: expected unqualified-id before ')' token
   31 | func (pq *PriorityQueue) Push(x interface{}) {
      |                                            ^
a.cc:37:6: error: expected constructor, destructor, or type conversion before '(' token
   37 | func (pq *PriorityQueue) Pop() interface{} {
      |      ^
a.cc:37:44: error: expected unqualified-id before '{' token
   37 | func (pq *PriorityQueue) Pop() interface{} {
      |                                            ^
a.cc:46:1: error: 'type' does not name a type; did you mean 'typeof'?
   46 | type edge struct {
      | ^~~~
      | typeof
a.cc:51:1: error: 'func' does not name a type
   51 | func main() {
      | ^~~~