Language: C++

#include<map>
#include<queue>
#include<utility>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<numeric>
#include<functional>
#include<string>
#include<iostream>
using namespace std;
const long long int one = 1;
const long long int big = (one<<40);
typedef long long int llint;

map<int,llint> cost[100];
llint dike(int from,int to){
	priority_queue<pair<llint,int>,vector<pair<llint,int> >,greater<pair<llint,int> > > que;
	pair<llint,int> p,b;
	llint nedan[100];
	llint sokane;
	int doko;
	int i=0;
	std::_Tree_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const int,llint> > > > it;
	for(i=0;i<100;i++){
		nedan[i]=big;
	}
	que.push(make_pair((llint)0,from));
	while(!que.empty()){
		p=que.top();
		sokane=p.first;
		doko=p.second;
		que.pop();
		if(nedan[doko]<big){continue;}
		for(it=cost[doko].begin();it!=cost[doko].end();it++){
			que.push(make_pair(sokane+it->second,it->first));
		}
		nedan[doko]=sokane;
	}
	return nedan[to];
}
int solve(int Q){
	int h,i,j,a,b,info;
	llint c;
	for(h=0;h<Q;h++){
		scanf("%d",&info);
		if(info==1){
			scanf("%d %d %lld",&a,&b,&c);
			a--;b--;
			if(cost[a].count(b)==1){
				cost[a][b]=min(c,cost[a][b]);
				cost[b][a]=min(c,cost[a][b]);
			}
			else{
				cost[a][b]=c;
				cost[b][a]=c;
			}
		}
		else{
			scanf("%d %d",&a,&b);
			a--;b--;
			c=dike(a,b);
			if(big<=c){c=-1;}
			printf("%lld\n",c);
		}

	}
	return 0;
}
int main(void){
	int a,Q;
	while(-1){
		scanf("%d %d",&a,&Q);
		if(a==0){
			return 0;
		}
		solve(Q);
	}
	return 0;
}

Compiler output:
a.cc: In function 'llint dike(int, int)':
a.cc:24:14: error: '_Tree_iterator' is not a member of 'std'; did you mean '_Rb_tree_iterator'?
   24 |         std::_Tree_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const int,llint> > > > it;
      |              ^~~~~~~~~~~~~~
      |              _Rb_tree_iterator
a.cc:24:34: error: '_Tree_val' is not a member of 'std'
   24 |         std::_Tree_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const int,llint> > > > it;
      |                                  ^~~~~~~~~
a.cc:24:49: error: '_Tree_simple_types' is not a member of 'std'
   24 |         std::_Tree_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const int,llint> > > > it;
      |                                                 ^~~~~~~~~~~~~~~~~~
a.cc:24:95: error: expected primary-expression before '>' token
   24 |         std::_Tree_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const int,llint> > > > it;
      |                                                                                               ^
a.cc:24:97: error: expected primary-expression before '>' token
   24 |         std::_Tree_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const int,llint> > > > it;
      |                                                                                                 ^
a.cc:24:99: error: expected primary-expression before '>' token
   24 |         std::_Tree_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const int,llint> > > > it;
      |                                                                                                   ^
a.cc:24:101: error: 'it' was not declared in this scope; did you mean 'i'?
   24 |         std::_Tree_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const int,llint> > > > it;
      |                                                                                                     ^~
      |                                                                                                     i