Language: C++

#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;

#define NUM 2000000000

using namespace std;

int minimum,min_past_num,num_town,m,start,goal;


struct Info{
    Info(){
        current_town = 0;
        index = 0;
        pre_town = 0;
       // go_and_return = false;
    }
    int visited[102];
    int current_town,index,costs[102],pre_town;
  // bool go_and_return;
};

struct Data{
	Data(int arg_to,int arg_cost){
		to = arg_to;
		cost = arg_cost;
	}
	int to,cost;
};

struct Node{
	bool operator<(const struct Node &arg) const{ //sort??????????????????????????????????????????
		return cost < arg.cost;
	};
	Node(int arg_town,int arg_cost){
		town = arg_town;
		cost = arg_cost;
	}

	int town,cost;
};

vector<Data> V[101];

void func(Info info){


	int sum = 0,maximum = 0;

	if(info.index == 1){
		sum = info.costs[0];
	}else if(info.index == 2){
		sum =0;
	}else{
		sum = info.costs[0]+info.costs[1];
		maximum = sum;

		for(int i = 2; i < info.index;i++){
		sum += info.costs[i];
		maximum = max(maximum,info.costs[i]+info.costs[i-1]);
	}
		//rest = sum - info.costs[info.index-1];
		sum = sum - maximum;
	}

	if(info.current_town == goal){
		minimum = min(minimum,sum);
		return;
	}else{
		if(info.index > 2 && sum >= minimum){
			return;
		}
	}


    for(int i = 0; i < V[info.current_town].size(); i++){
        if(info.visited[V[info.current_town][i].to] == 0){
            Info new_info;
            for(int k = 1; k <= num_town; k++)new_info.visited[k] = info.visited[k];
            new_info.visited[V[info.current_town][i].to]++;
            new_info.current_town = V[info.current_town][i].to;
            for(int k = 0; k < info.index; k++)new_info.costs[k] = info.costs[k];
            new_info.costs[info.index] = V[info.current_town][i].cost;
            new_info.pre_town = info.current_town;
            new_info.index = info.index+1;
            //new_info.go_and_return = info.go_and_return;
            func(new_info);
        }else if(info.visited[V[info.current_town][i].to] == 1 && info.pre_town == V[info.current_town][i].to){
        	Info new_info;
			for(int k = 1; k <= num_town; k++)new_info.visited[k] = info.visited[k];
			new_info.visited[V[info.current_town][i].to]++;
			new_info.current_town = V[info.current_town][i].to;
			for(int k = 0; k < info.index; k++)new_info.costs[k] = info.costs[k];
			new_info.costs[info.index] = V[info.current_town][i].cost;
			 new_info.pre_town = info.current_town;
			new_info.index = info.index+1;
			//new_info.go_and_return = true;
			func(new_info);
        }
    }
}

int main(){

    int from,to,fee;

    start = 1;

    while(true){
        scanf("%d %d",&num_town,&m);
        if(num_town == 0 && m == 0)break;

        goal = num_town;
        minimum = 2000000000;

        for(int i = 1; i <= num_town; i++)V[i].clear();

        int costTable[num_town+1][num_town+1];

        for(int i = 1; i <= num_town; i++){
        	for(int k = 1; k <= num_town;k++){
        		costTable[i][k] = NUM;
        	}
        }

        for(int i = 0; i < m; i++){
            scanf("%d %d %d",&from,&to,&fee);

            V[from].push_back(Data(to,fee));
            V[to].push_back(Data(from,fee));
            costTable[from][to] = fee;
            costTable[to][from] = fee;
        }


        int past[num_town+1]; //???????????±????¨??????????????????????
        for(int i = 1; i <= num_town; i++)past[i] = 1;

        //????????????????????§??????????????????????????????????????????<??????????????????>
        priority_queue<Node> Q;

        int D[num_town+1];
        bool visited[num_town+1];
        for(int i = 1; i <= num_town; i++){
        	D[i] = NUM;
        	visited[i] = false;
        }

        visited[1] = true;

        for(int i = 0; i < V[1].size(); i++){
        	D[V[1][i]] = costTable[1][V[1][i]];
        }

        int count = 1,current_min,current_min_index;

        while(count < num_town){
        	current_min = NUM;
        	for(int i = 1; i <= num_town; i++){
        		if(D[i] < current_min && visited[i] == false){ //????????????????????????visited???true????????£???????????????<TE??????PQ?????????>
        			current_min = D[i];
        			current_min_index = i;
        		}
        	}

        	if(current_min == NUM)break;

        	visited[current_min_index] = true;
        	count++;

        	for(int i = 1; i <= num_town; i++){
        		if(costTable[current_min_index][i] != NUM && D[i] > D[current_min_index] + costTable[current_min_index][i]){
        			D[i] = D[current_min_index] + costTable[current_min_index][i];
        			past[i] = current_min_index;
        		}
        	}
        }

        int base_costs[num_town+1],base_index = 0,t;

        t = goal;
        while(true){
        	base_costs[base_index++] = costTable[t][past[t]];
        	t = past[t];
        	if(t == 1)break;
        }

        int meyasu = 0,meyasu_max = 0;

        if(base_index == 1){
        	minimum = base_costs[0];
        }else if(base_index == 2){
        	minimum = 0;
        }else{
        	meyasu = base_costs[0] + base_costs[1];
        	meyasu_max = meyasu;

        	for(int i = 2; i < base_index; i++){
        		meyasu += base_costs[i];
        		meyasu_max = max(meyasu_max,base_costs[i] + base_costs[i-1]);
        	}

        	meyasu -= meyasu_max;
        	minimum = meyasu;
        }

        Info info;
		for(int i = 1; i <= num_town;i++)info.visited[i] = 0;

		info.current_town = start;
		info.visited[start]++;

        func(info);

        printf("%d\n",minimum);
    }


    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:157:18: error: no match for 'operator[]' (operand types are 'int [(num_town + 1)]' and '__gnu_cxx::__alloc_traits<std::allocator<Data>, Data>::value_type' {aka 'Data'})
  157 |                 D[V[1][i]] = costTable[1][V[1][i]];
      |                  ^
a.cc:157:42: error: no match for 'operator[]' (operand types are 'int [(num_town + 1)]' and '__gnu_cxx::__alloc_traits<std::allocator<Data>, Data>::value_type' {aka 'Data'})
  157 |                 D[V[1][i]] = costTable[1][V[1][i]];
      |                                          ^