Language: C++

#include<iostream>
using namespace std;
#include<vector>

#define infinity 9999999
#define V 100000
#define C 10000
#define E 500000

struct edge
{
    int t;  
    int d;  
    int next;
};
int count;
int minn; 
int k;
		
int v;
int e;
int r;
vector<int> head; 
vector<edge> edges;
void add_edge(int s,int t,int d);

int main()
{
	//while(1)
	//{
		
		cin>>v>>e>>r;
		//if(v<1||v>V||e<0||e>E||r>=v)
		//{
			
			//cin.clear();
		//}
		//else 
		//	break;
	}
	int i,j;
	vector<int> dis(v,infinity);  
	vector<bool> flag(v,false); 
	head.resize(v,-1);
	edges.resize(e);
	for(i=0;i<e;i++) 
		edges[i].next=-1;

	int point1,point2,cost;
	i=1;
	//while(1)
	//{
		for(;i<=e;i++)
		{
			cin>>point1>>point2>>cost;
			
                       // for(j=head[point1];j>=0;j=edges[j].next)
			//	if(point2==edges[j].t)
			//	{
					//cin.clear();
			//		break;
			//	}
                       // if(j>=0)
                       //        break;
			add_edge(point1,point2,cost);
		}
		//if(i>e)
		//	break;
	//}

	dis[r]=0;
	for(j=head[r];j>=0;j=edges[j].next)
		dis[edges[j].t]=edges[j].d;
    
	flag[r]=1;
    for(i=1;i<v;i++)
    {
        minn=infinity;
        k=0;
        for(j=0;j<v;j++)
			if(!flag[j]&&minn>dis[j])
			{
				minn=dis[j];
				k=j;
			}
        flag[k]=1;
        for(j=head[k];j>=0;j=edges[j].next)	
			if(!flag[edges[j].t]&&dis[edges[j].t]>dis[k]+edges[j].d)
				dis[edges[j].t]=dis[k]+edges[j].d;
    }
	for (i=0;i<v;i++) 
    {  
		if(dis[i]<infinity)
			cout<<dis[i]<<"\r\n"; 
		else
			cout<<"INF"<<"\r\n";
    }    
    return 0;
}

void add_edge(int s,int t,int d) 
{    
    edges[count].t=t;
    edges[count].d=d;
    edges[count].next=head[s];
    head[s]=count;
	count++;
}

Compiler output:
a.cc:44:9: error: 'head' does not name a type
   44 |         head.resize(v,-1);
      |         ^~~~
a.cc:45:9: error: 'edges' does not name a type; did you mean 'edge'?
   45 |         edges.resize(e);
      |         ^~~~~
      |         edge
a.cc:46:9: error: expected unqualified-id before 'for'
   46 |         for(i=0;i<e;i++)
      |         ^~~
a.cc:46:17: error: 'i' does not name a type
   46 |         for(i=0;i<e;i++)
      |                 ^
a.cc:46:21: error: 'i' does not name a type
   46 |         for(i=0;i<e;i++)
      |                     ^
a.cc:50:9: error: 'i' does not name a type
   50 |         i=1;
      |         ^
a.cc:53:17: error: expected unqualified-id before 'for'
   53 |                 for(;i<=e;i++)
      |                 ^~~
a.cc:53:22: error: 'i' does not name a type
   53 |                 for(;i<=e;i++)
      |                      ^
a.cc:53:27: error: 'i' does not name a type
   53 |                 for(;i<=e;i++)
      |                           ^
a.cc:71:9: error: 'dis' does not name a type
   71 |         dis[r]=0;
      |         ^~~
a.cc:72:9: error: expected unqualified-id before 'for'
   72 |         for(j=head[r];j>=0;j=edges[j].next)
      |         ^~~
a.cc:72:23: error: 'j' does not name a type
   72 |         for(j=head[r];j>=0;j=edges[j].next)
      |                       ^
a.cc:72:28: error: 'j' does not name a type
   72 |         for(j=head[r];j>=0;j=edges[j].next)
      |                            ^
a.cc:75:9: error: 'flag' does not name a type
   75 |         flag[r]=1;
      |         ^~~~
a.cc:76:5: error: expected unqualified-id before 'for'
   76 |     for(i=1;i<v;i++)
      |     ^~~
a.cc:76:13: error: 'i' does not name a type
   76 |     for(i=1;i<v;i++)
      |             ^
a.cc:76:17: error: 'i' does not name a type
   76 |     for(i=1;i<v;i++)
      |                 ^
a.cc:91:9: error: expected unqualified-id before 'for'
   91 |         for (i=0;i<v;i++)
      |         ^~~
a.cc:91:18: error: 'i' does not name a type
   91 |         for (i=0;i<v;i++)
      |                  ^
a.cc:91:22: error: 'i' does not name a type
   91 |         for (i=0;i<v;i++)
      |                      ^
a.cc:98:5: error: expected unqualified-id before 'return'
   98 |     return 0;
      |     ^~~~~~
a.cc:99:1: error: expected declaration before '}' token
   99 | }
      | ^