criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;


int fact(int n){
	if (n == 0)
		return 1;
	else
		return n * fact(n - 1);
}

int main()
{
	int len[13], data[13];
	int * np[150];
	char alphabet[150];
	int n;
	int num[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

	//入力
	while (cin >> n, n){
		int found = 0;

		//STRINGの入力
		int counter = 0;
		for (int i = 0; i < n; i++){
			string s;
			cin >> s;
			len[i] = s.size();
			for (int j = 0; j < s.size(); j++){
				alphabet[counter++] = s[j];
			}
		}

		//同じ文字の処理
		int numcounter = 0, variationcounter = 0;
		for (int i = 0; i < counter; i++){
			bool flag = true;
			for (int j = 0; j < i; j++){
				if (alphabet[i] == alphabet[j]){
					np[i] = np[j];
					flag = false;
				}
			}
			if (flag){
				np[i] = num + numcounter++;
				variationcounter++;
			}
		}

		do{
			numcounter = 0;
			//dataの作成
			for (int i = 0; i < n; i++){
				data[i] = 0;

				for (int j = 0; j < len[i]; j++){
					if (j == 0 && *np[numcounter] == 0 && len[i] > 1){
						goto endfor;
					}
					data[i] += *np[numcounter++] * pow(10, len[i] - 1 - j);
				}
			}


			//方程式
			int left = 0, right;
			for (int i = 0; i < n - 1; i++){
				left += data[i];
			}
			right = data[n - 1];
			if (left == right){
				found++;
			}
		endfor:
			;
		} while (next_permutation(num, num + 10));
		cout << found / fact(10 - variationcounter) << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:78:17: error: jump to label 'endfor'
   78 |                 endfor:
      |                 ^~~~~~
a.cc:62:54: note:   from here
   62 |                                                 goto endfor;
      |                                                      ^~~~~~
a.cc:70:29: note:   crosses initialization of 'int left'
   70 |                         int left = 0, right;
      |                             ^~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;


int fact(int n){
	if (n == 0)
		return 1;
	else
		return n * fact(n - 1);
}

int main()
{
	int len[13], data[13];
	int * np[150];
	char alphabet[150];
	int n;
	int num[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

	//入力
	while (cin >> n, n){
		int found = 0;

		//STRINGの入力
		int counter = 0;
		for (int i = 0; i < n; i++){
			string s;
			cin >> s;
			len[i] = s.size();
			for (int j = 0; j < s.size(); j++){
				alphabet[counter++] = s[j];
			}
		}

		//同じ文字の処理
		int numcounter = 0, variationcounter = 0;
		for (int i = 0; i < counter; i++){
			bool flag = true;
			for (int j = 0; j < i; j++){
				if (alphabet[i] == alphabet[j]){
					np[i] = np[j];
					flag = false;
				}
			}
			if (flag){
				np[i] = num + numcounter++;
				variationcounter++;
			}
		}

		do{
			numcounter = 0;
			//dataの作成
			for (int i = 0; i < n; i++){
				data[i] = 0;

				for (int j = 0; j < len[i]; j++){
					if (j == 0 && *np[numcounter] == 0 && len[i] > 1){
						goto endfor;
					}
					data[i] += *np[numcounter++] * pow(10, len[i] - 1 - j);
				}
			}


			//方程式
			int left = 0,
				int right;
			for (int i = 0; i < n - 1; i++){
				left += data[i];
			}
			right = data[n - 1];
			if (left == right){
				found++;
			}
		endfor:
			;
		} while (next_permutation(num, num + 10));
		cout << found / fact(10 - variationcounter) << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:71:33: error: expected unqualified-id before 'int'
   71 |                                 int right;
      |                                 ^~~
a.cc:75:31: error: assignment of function 'std::ios_base& std::right(ios_base&)'
   75 |                         right = data[n - 1];
      |                         ~~~~~~^~~~~~~~~~~~~
a.cc:76:34: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   76 |                         if (left == right){
      |                             ~~~~~^~~~~~~~
a.cc:79:17: error: jump to label 'endfor'
   79 |                 endfor:
      |                 ^~~~~~
a.cc:62:54: note:   from here
   62 |                                                 goto endfor;
      |                                                      ^~~~~~
a.cc:70:29: note:   crosses initialization of 'int left'
   70 |                         int left = 0,
      |                             ^~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;


int fact(int n){
	if (n == 0)
		return 1;
	else
		return n * fact(n - 1);
}

int main()
{
	int len[13], data[13];
	int * np[150];
	char alphabet[150];
	int n;
	int num[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

	//入力
	while (cin >> n, n){
		int found = 0;

		//STRINGの入力
		int counter = 0;
		for (int i = 0; i < n; i++){
			string s;
			cin >> s;
			len[i] = s.size();
			for (int j = 0; j < s.size(); j++){
				alphabet[counter++] = s[j];
			}
		}

		//同じ文字の処理
		int numcounter = 0, variationcounter = 0;
		for (int i = 0; i < counter; i++){
			bool flag = true;
			for (int j = 0; j < i; j++){
				if (alphabet[i] == alphabet[j]){
					np[i] = np[j];
					flag = false;
				}
			}
			if (flag){
				np[i] = num + numcounter++;
				variationcounter++;
			}
		}

		do{
			numcounter = 0;
			//dataの作成
			for (int i = 0; i < n; i++){
				data[i] = 0;

				for (int j = 0; j < len[i]; j++){
					if (j == 0 && *np[numcounter] == 0 && len[i] > 1){
						goto endfor;
					}
					data[i] += *np[numcounter++] * pow(10, len[i] - 1 - j);
				}
			}


			//方程式
			int left = 0;
				int right;
			for (int i = 0; i < n - 1; i++){
				left += data[i];
			}
			right = data[n - 1];
			if (left == right){
				found++;
			}
		endfor:
			;
		} while (next_permutation(num, num + 10));
		cout << found / fact(10 - variationcounter) << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:79:17: error: jump to label 'endfor'
   79 |                 endfor:
      |                 ^~~~~~
a.cc:62:54: note:   from here
   62 |                                                 goto endfor;
      |                                                      ^~~~~~
a.cc:70:29: note:   crosses initialization of 'int left'
   70 |                         int left = 0;
      |                             ^~~~
Language: C++

#include "stdafx.h"
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;


int fact(int n){
	if (n == 0)
		return 1;
	else
		return n * fact(n - 1);
}

int _tmain(int argc, _TCHAR* argv[])
{
	int len[13], data[13];
	int * np[150];
	char alphabet[150];
	int n;
	int num[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

	//入力
	while (cin >> n, n){
		int found = 0;

		//STRINGの入力
		int counter = 0;
		for (int i = 0; i < n; i++){
			string s;
			cin >> s;
			len[i] = s.size();
			for (int j = 0; j < s.size(); j++){
				alphabet[counter++] = s[j];
			}
		}

		//同じ文字の処理
		int numcounter = 0, variationcounter = 0;
		for (int i = 0; i < counter; i++){
			bool flag = true;
			for (int j = 0; j < i; j++){
				if (alphabet[i] == alphabet[j]){
					np[i] = np[j];
					flag = false;
				}
			}
			if (flag){
				np[i] = num + numcounter++;
				variationcounter++;
			}
		}

		do{
			numcounter = 0;
			//dataの作成
			for (int i = 0; i < n; i++){
				data[i] = 0;

				for (int j = 0; j < len[i]; j++){
					if (j == 0 && *np[numcounter] == 0 && len[i] > 1){
						goto endfor;
					}
					data[i] += *np[numcounter++] * pow(10, len[i] - 1 - j);
				}
			}


			//方程式
			int left = 0, right;
			for (int i = 0; i < n - 1; i++){
				left += data[i];
			}
			right = data[n - 1];
			if (left == right){
				found++;
			}
		endfor:
			;
		} while (next_permutation(num, num + 10));
		cout << found / fact(10 - variationcounter) << endl;
	}
	return 0;
}

Compiler output:
a.cc:1:10: fatal error: stdafx.h: No such file or directory
    1 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++


#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;


int fact(int n){
	if (n == 0)
		return 1;
	else
		return n * fact(n - 1);
}

int main()
{
	int len[13], data[13];
	int * np[150];
	char alphabet[150];
	int n;
	int num[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

	//入力
	while (cin >> n, n){
		int found = 0;

		//STRINGの入力
		int counter = 0;
		for (int i = 0; i < n; i++){
			string s;
			cin >> s;
			len[i] = s.size();
			for (int j = 0; j < s.size(); j++){
				alphabet[counter++] = s[j];
			}
		}

		//同じ文字の処理
		int numcounter = 0, variationcounter = 0;
		for (int i = 0; i < counter; i++){
			bool flag = true;
			for (int j = 0; j < i; j++){
				if (alphabet[i] == alphabet[j]){
					np[i] = np[j];
					flag = false;
				}
			}
			if (flag){
				np[i] = num + numcounter++;
				variationcounter++;
			}
		}

		do{
			numcounter = 0;
			//dataの作成
			for (int i = 0; i < n; i++){
				data[i] = 0;

				for (int j = 0; j < len[i]; j++){
					if (j == 0 && *np[numcounter] == 0 && len[i] > 1){
						goto endfor;
					}
					data[i] += *np[numcounter++] * pow(10, len[i] - 1 - j);
				}
			}


			//方程式
			int left = 0, right;
			for (int i = 0; i < n - 1; i++){
				left += data[i];
			}
			right = data[n - 1];
			if (left == right){
				found++;
			}
		endfor:
			;
		} while (next_permutation(num, num + 10));
		cout << found / fact(10 - variationcounter) << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:79:17: error: jump to label 'endfor'
   79 |                 endfor:
      |                 ^~~~~~
a.cc:63:54: note:   from here
   63 |                                                 goto endfor;
      |                                                      ^~~~~~
a.cc:71:29: note:   crosses initialization of 'int left'
   71 |                         int left = 0, right;
      |                             ^~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;


int fact(int n){
	if (n == 0)
		return 1;
	else
		return n * fact(n - 1);
}

int main()
{
	int len[13], data[13];
	int * np[150];
	char alphabet[150];
	int n;
	int num[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

	//入力
	while (cin >> n, n){
		int found = 0;

		//STRINGの入力
		int counter = 0;
		for (int i = 0; i < n; i++){
			string s;
			cin >> s;
			len[i] = s.size();
			for (int j = 0; j < s.size(); j++){
				alphabet[counter++] = s[j];
			}
		}

		//同じ文字の処理
		int numcounter = 0, variationcounter = 0;
		for (int i = 0; i < counter; i++){
			bool flag = true;
			for (int j = 0; j < i; j++){
				if (alphabet[i] == alphabet[j]){
					np[i] = np[j];
					flag = false;
				}
			}
			if (flag){
				np[i] = num + numcounter++;
				variationcounter++;
			}
		}

		do{
			numcounter = 0;
			//dataの作成
			for (int i = 0; i < n; i++){
				data[i] = 0;

				for (int j = 0; j < len[i]; j++){
					if (j == 0 && *np[numcounter] == 0 && len[i] > 1){
						goto endfor;
					}
					data[i] += *np[numcounter++] * pow(10, len[i] - 1 - j);
				}
			}


			//方程式
			int left = 0;
			int right;
			for (int i = 0; i < n - 1; i++){
				left += data[i];
			}
			right = data[n - 1];
			if (left == right){
				found++;
			}
		endfor:
			;
		} while (next_permutation(num, num + 10));
		cout << found / fact(10 - variationcounter) << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:79:17: error: jump to label 'endfor'
   79 |                 endfor:
      |                 ^~~~~~
a.cc:62:54: note:   from here
   62 |                                                 goto endfor;
      |                                                      ^~~~~~
a.cc:70:29: note:   crosses initialization of 'int left'
   70 |                         int left = 0;
      |                             ^~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;


int fact(int n){
	if (n == 0)
		return 1;
	else
		return n * fact(n - 1);
}

int _tmain(int argc, _TCHAR* argv[])
{
	int len[13], data[13];
	int * np[150];
	char alphabet[150];
	int n;
	int num[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

	//入力
	while (cin >> n, n){
		int found = 0;

		//STRINGの入力
		int counter = 0;
		for (int i = 0; i < n; i++){
			string s;
			cin >> s;
			len[i] = s.size();
			for (int j = 0; j < s.size(); j++){
				alphabet[counter++] = s[j];
			}
		}

		//同じ文字の処理
		int numcounter = 0, variationcounter = 0;
		for (int i = 0; i < counter; i++){
			bool flag = true;
			for (int j = 0; j < i; j++){
				if (alphabet[i] == alphabet[j]){
					np[i] = np[j];
					flag = false;
				}
			}
			if (flag){
				np[i] = num + numcounter++;
				variationcounter++;
			}
		}


		do{
			numcounter = 0;
			//dataの作成
			for (int i = 0; i < n; i++){
				data[i] = 0;
				bool flag = false;
				for (int j = 0; j < len[i]; j++){
					if (j == 0 && *np[numcounter] == 0 && len[i] > 1){
						flag = true;
						break;
					}
					data[i] += *np[numcounter++] * pow(10, len[i] - 1 - j);
				}
				if (flag)
					continue;
			}


			//方程式
			int left = 0;
			int right;
			for (int i = 0; i < n - 1; i++){
				left += data[i];
			}
			right = data[n - 1];
			if (left == right){
				found++;
			}

		} while (next_permutation(num, num + 10));
		cout << found / fact(10 - variationcounter) << endl;
	}
	return 0;
}

Compiler output:
a.cc:15:22: error: '_TCHAR' has not been declared
   15 | int _tmain(int argc, _TCHAR* argv[])
      |                      ^~~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>


using namespace std;

int fact(int n){
	if (n == 0)
		return 1;
	else
		return n * fact(n - 1);
}

int main()
{
	int len[13];
	int * np[150];
	char alphabet[150];
	int n;
	int num[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

	//入力
	while (cin >> n, n){
		int found = 0;

		//STRINGの入力
		int counter = 0;
		for (int i = 0; i < n; i++){
			string s;
			cin >> s;
			len[i] = s.size();
			for (int j = 0; j < s.size(); j++){
				alphabet[counter++] = s[j];
			}
		}

		//同じ文字の処理
		int numcounter = 0, variation = 0;
		for (int i = 0; i < counter; i++){
			bool flag = true;
			for (int j = 0; j < i; j++){
				if (alphabet[i] == alphabet[j]){
					np[i] = np[j];
					flag = false;
				}
			}
			if (flag){
				np[i] = num + numcounter++;
				variation++;
			}
		}

		int docounter = 0;
		int t = fact(10 - variation);
		//DWORD time1 = GetTickCount();

		do{

			//初期化
			int lketa[8];
			int rketa[8];
			for (int i = 0; i < 8; i++)
				lketa[i] = rketa[i] = 0;
			numcounter = 0;

			//重複の場合はスキップ
			docounter++;
			if (docounter % t != 0)
				continue;

			//dataの作成
			bool flag = 0;
			for (int i = 0; i < n; i++){
				flag = false;
				for (int j = 0; j < len[i]; j++){
					if (j == 0 && *np[numcounter] == 0 && len[i] > 1){
						goto exit;
					}
					if (i < n - 1)
						lketa[len[i] - j - 1] += *np[numcounter++];
					else
						rketa[len[i] - j - 1] = *np[numcounter++];
				}
			}

			//繰り上がりと判定
			bool judge = true;
			for (int i = 0; i < 7; i++){
				lketa[i + 1] += lketa[i] / 10;
				lketa[i] = lketa[i] % 10;
				if (lketa[i] != rketa[i]){
					judge = false;
					break;
				}
			}

			if (judge){
				found++;
			exit:;
			}

		} while (next_permutation(num, num + 10));
		//DWORD time2 = GetTickCount();
		//cout << time2 - time1;
		cout << found << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:101:25: error: jump to label 'exit'
  101 |                         exit:;
      |                         ^~~~
a.cc:79:54: note:   from here
   79 |                                                 goto exit;
      |                                                      ^~~~
a.cc:89:30: note:   crosses initialization of 'bool judge'
   89 |                         bool judge = true;
      |                              ^~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>


using namespace std;

int fact(int n){
	if (n == 0)
		return 1;
	else
		return n * fact(n - 1);
}

int main()
{
	int len[13];
	int * np[150];
	char alphabet[150];
	int n;
	int num[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

	//入力
	while (cin >> n, n){
		int found = 0;

		//STRINGの入力
		int counter = 0;
		for (int i = 0; i < n; i++){
			string s;
			cin >> s;
			len[i] = s.size();
			for (int j = 0; j < s.size(); j++){
				alphabet[counter++] = s[j];
			}
		}

		//同じ文字の処理
		int numcounter = 0, variation = 0;
		for (int i = 0; i < counter; i++){
			bool flag = true;
			for (int j = 0; j < i; j++){
				if (alphabet[i] == alphabet[j]){
					np[i] = np[j];
					flag = false;
				}
			}
			if (flag){
				np[i] = num + numcounter++;
				variation++;
			}
		}

		int docounter = 0;
		int t = fact(10 - variation);
		//DWORD time1 = GetTickCount();

		do{

			//初期化
			int lketa[8];
			int rketa[8];
			for (int i = 0; i < 8; i++)
				lketa[i] = rketa[i] = 0;
			numcounter = 0;

			//重複の場合はスキップ
			docounter++;
			if (docounter % t != 0)
				continue;

			//dataの作成
			bool flag = 0;
			for (int i = 0; i < n; i++){
				flag = false;
				for (int j = 0; j < len[i]; j++){
					if (j == 0 && *np[numcounter] == 0 && len[i] > 1){
						goto exit;
					}
					if (i < n - 1)
						lketa[len[i] - j - 1] += *np[numcounter++];
					else
						rketa[len[i] - j - 1] = *np[numcounter++];
				}
			}

			//繰り上がりと判定
			bool judge = true;
			for (int i = 0; i < 7; i++){
				lketa[i + 1] += lketa[i] / 10;
				lketa[i] = lketa[i] % 10;
				if (lketa[i] != rketa[i]){
					judge = false;
					break;
				}
			}

			if (judge){
				found++;
			}
		exit:;
		} while (next_permutation(num, num + 10));
		//DWORD time2 = GetTickCount();
		//cout << time2 - time1;
		cout << found << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:102:17: error: jump to label 'exit'
  102 |                 exit:;
      |                 ^~~~
a.cc:79:54: note:   from here
   79 |                                                 goto exit;
      |                                                      ^~~~
a.cc:89:30: note:   crosses initialization of 'bool judge'
   89 |                         bool judge = true;
      |                              ^~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>


using namespace std;

int fact(int n){
	if (n == 0)
		return 1;
	else
		return n * fact(n - 1);
}

int main()
{
	int len[13];
	int * np[150];
	char alphabet[150];
	int n;
	int num[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

	//入力
	while (cin >> n, n){
		int found = 0;

		//STRINGの入力
		int counter = 0;
		for (int i = 0; i < n; i++){
			string s;
			cin >> s;
			len[i] = s.size();
			for (int j = 0; j < s.size(); j++){
				alphabet[counter++] = s[j];
			}
		}

		//同じ文字の処理
		int numcounter = 0, variation = 0;
		for (int i = 0; i < counter; i++){
			bool flag = true;
			for (int j = 0; j < i; j++){
				if (alphabet[i] == alphabet[j]){
					np[i] = np[j];
					flag = false;
				}
			}
			if (flag){
				np[i] = num + numcounter++;
				variation++;
			}
		}

		int docounter = 0;
		int t = fact(10 - variation);
		//
		DWORD time1 = GetTickCount();

		int lketa[8];
		int rketa[8];
		do{

			//初期化
			fill_n(lketa, 8, 0);
			fill_n(rketa, 8, 0);
			numcounter = 0;

			//重複の場合はスキップ
			docounter++;
			if (docounter % t != 0)
				continue;

			//ketaの作成
			bool flag = false;
			for (int i = 0; i < n; i++){
				for (int j = 0; j < len[i]; j++){
					if (j == 0 && *np[numcounter] == 0 && len[i] > 1){
						flag = true;
						break;
					}
					if (i < n - 1)
						lketa[len[i] - j - 1] += *np[numcounter++];
					else
						rketa[len[i] - j - 1] = *np[numcounter++];
				}
				if (flag)
					break;
			}
			if (flag)
				continue;


			//繰り上がりと判定
			bool judge = true;
			for (int i = 0; i < 7; i++){
				lketa[i + 1] += lketa[i] / 10;
				lketa[i] = lketa[i] % 10;
				if (lketa[i] != rketa[i]){
					judge = false;
					break;
				}
			}

			if (judge){
				found++;
			}

		} while (next_permutation(num, num + 10));
		DWORD time2 = GetTickCount();
		//cout << time2 - time1;
		cout << found << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:17: error: 'DWORD' was not declared in this scope
   58 |                 DWORD time1 = GetTickCount();
      |                 ^~~~~
a.cc:110:22: error: expected ';' before 'time2'
  110 |                 DWORD time2 = GetTickCount();
      |                      ^~~~~~
      |                      ;
Language: Java

import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;


public class Main {
	Scanner in = new Scanner(System.in);
	
	int n, m;
	
	int[][] edge;
	double[][] minCost;
	int[][] maxSpeed;	
	
	double INF = 100000000;
	
	class State implements Comparable<State> {
		int n, speed, prev;

		State(int n, int speed, int prev) {
			this.n = n;
			this.speed = speed;
			this.prev = prev;
		}
		
		@Override
		public int compareTo(State arg0) {
			double c1 = minCost[n][speed], c2 = minCost[arg0.n][arg0.speed];
			if (c1 > c2) return 1;
			else if (c1 < c2) return -1;
			else return 0;
		}
	}
	
	void dijkstra(int start) {
		minCost = new double[n][31];
		for (int i = 0; i < n; i++)
			Arrays.fill(minCost[i], INF);
		
		minCost[start][0] = 0;
		PriorityQueue<State> pq = new PriorityQueue<State>();
		pq.add(new State(start, 0, start));
		
		while (!pq.isEmpty()) {
			State s = pq.poll();
			for (int i = 0; i < n; i++) {
				if (edge[s.n][i] == INF) continue;
				if (s.prev == i) continue;
				int c = s.speed;
				for (int v = -1; v <= 1; v++) {
					if (c+v > 0 && c+v <= maxSpeed[i][s.n] && minCost[i][c+v] > minCost[s.n][c] + (double)edge[i][s.n] / (c+v)) {
						minCost[i][c+v] = minCost[s.n][c] + (double)edge[i][s.n] / (c+v);
						pq.add(new State(i, c+v, s.n));
					}
				}
			}
		}
		
		
	}
	
	void run() {
		while (true) {
			n = in.nextInt(); m = in.nextInt();
			if (n == 0) break;
			
			int s = in.nextInt() - 1, g = in.nextInt() - 1;

			maxSpeed = new int[n][n];
			edge = new int[n][n];
			
			for (int i = 0; i < m; i++) {
				int x = in.nextInt() - 1, y = in.nextInt() - 1, d = in.nextInt(), c = in.nextInt();
				edge[x][y] = edge[y][x] = d;
				maxSpeed[x][y] = maxSpeed[y][x] = c;
			}
			
			dijkstra(s);
			
			double res = INF;
			for (int i = 0; i < n; i++)
				res = Math.min(minCost[g][i][1], res);
			
			/*
			for (int i = 0; i < n; i++)
			{
				for (int j = 0; j < 5; j++)
					System.out.print(minCost[i][j] + " ");
				System.out.println();
			}
			*/
			
			System.out.println(res == INF ? "unreachable" : res);
		}
	}
	
	public static void main(String args[]) {
		new Main().run();
	}
}

Compiler output:
Main.java:82: error: array required, but double found
				res = Math.min(minCost[g][i][1], res);
				                            ^
1 error
Language: C++

#include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<double, int, int, int> T;
 
const ll MOD=1e9+7;
//const ll INF=1e18;

const double INF = 1000000.0;
 
int dx[]={0, 1, 0, -1};
int dy[]={-1, 0, 1, 0};

struct edge{ int to,d,c;};



int n,m,s,g;
double d[35][35][35];
double mind;

int main(){
	while(true){
		cin >> n >> m;
		if(n + m == 0) break;
		cin >> s >> g;
		mind = INF;
		vector<edge> G[35];
		for(int i = 0;i < m;i++){
			int a1,a2,a3,a4;
			cin >> a1 >> a2 >> a3 >> a4;
			edge tmp1 = {a2,a3,a4};
			G[a1].push_back(tmp1);
			edge tmp2 = {a1,a3,a4};
			G[a2].push_back(tmp2);
		}
		for(int i = 1;i <= n;i++){
			for(int j = 1;j <= n;j++){
				for(int k = 0;k <= 31;k++){
					d[i][j][k] = INF;
				}
			}
		}
		//queue<T> que;
		priority_queue<T,vector<T>,greater<T> > que;
		for(int i = 0;i < G[s].size();i++){
			edge e = G[s][i];
			d[s][e.to][1] = (double) e.d;
			que.push(make_tuple((double)e.d,1,s,e.to));
		}
		while(!que.empty()){
			T t = que.front(); que.pop();
			double a1 = get<0>(t);
			int a2 = get<1>(t),a3 = get<2>(t),a4 = get<3>(t);
			if(d[a3][a4][a2] < a1 || a1 > mind)continue;
			for(int i = 0;i < G[a4].size();i++){
				edge e = G[a4][i];
				if(e.to == a3) continue;
				for(int j = -1;j <= 1;j++){
					int v = a2 + j;
					double tmp = (double)( a1 + (double)e.d / (double)v);
			//		if(a4 == 5 && e.to == 6 && v == 1) cout << "tmp" << tmp << ",a1" << a1 <<endl;
					if(v <= 0 || v > e.c || d[a4][e.to][v] < tmp ||tmp > mind) continue;
					d[a4][e.to][v] =  tmp;
					if(e.to == g && v == 1 && mind > tmp)mind = tmp;
					que.push(make_tuple(tmp,v,a4,e.to));
				}
			}
		
		
		}
	//	cout << "ans" << d[4][5][2] << endl;



		double ans = INF;
		for(int i = 1;i <= n;i++){
			double tmp = d[i][g][1];
			if(ans > tmp) ans = tmp;
		//	ans = min(ans,d[i][g][1]);
		}
		if(ans == INF){
			cout << "unreachable" << endl;
		}else{
		//	cout << ans << endl;
			printf("%lf",ans);
		}
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:59:35: error: 'class std::priority_queue<std::tuple<double, int, int, int>, std::vector<std::tuple<double, int, int, int> >, std::greater<std::tuple<double, int, int, int> > >' has no member named 'front'
   59 |                         T t = que.front(); que.pop();
      |                                   ^~~~~
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <cstdio>
#include <queue>
using namespace std;
#define N 30
#define INF 100000

struct road{int to,cost,lim;};
struct situ{int v,now,from;double d;};
bool operator < (const situ &a,const situ &b){
	return a.d > b.d;
}

int main(){
	while(1){
		int n,m,s,g;
		vector<road> roads[N];
		cin >> n >> m;
		if(!n&&!m) break;
		cin >> s >> g;
		s--;g--;

		for(int i=0;i<m;i++){
			int x,y,d,c;
			scanf("%d%d%d%d",&x,&y,&d,&c);
			x--;y--;
			roads[x].push_back((road){y,d,c});
			roads[y].push_back((road){x,d,c});
		}

		priority_queue<situ> que;
		for(int i=0;i<roads[s].size();i++){
			int to = roads[s][i].to;
			int d = roads[s][i].cost;
			que.push((situ){1,to,s,(double)d});
		}
		bool used[N][N][31];
		memset(used,0,sizeof(used));

		bool isClear = false;
		while(que.size()){
			situ st = que.top(); que.pop();
			if(used[st.now][st.from][st.v]) continue;
			used[st.now][st.from][st.v] = true;
			if(st.now==g&&st.v==1){
				printf("%.5f\n",st.d);
				isClear = true;
				break;
			}
			for(int i=0;i<roads[st.now].size();i++){
				int to = roads[st.now][i].to;
				int d = roads[st.now][i].cost;
				if(to == st.from) continue;
				for(int j=-1;j<=1;j++){
					if(st.v+j<=roads[st.now][i].lim&&st.v+j>0){
						//if(!used[to][st.now][st.v+j])
							que.push((situ){st.v+j,to,st.now,st.d+(double)d/(st.v+j)});
					}
				}
			}
		}
		if(!isClear) cout << "unreachable" << endl;


	}
	return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:17: error: 'memset' was not declared in this scope
   40 |                 memset(used,0,sizeof(used));
      |                 ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include <queue>
  +++ |+#include <cstring>
    6 | using namespace std;
Language: C++

#include<iostream>
#include<cmath>
#include<queue>
#include<vector>
#define INF 1e10
#define EPS 1e-10
using namespace std;
struct edge{
  int to,limit;
  double dist;
};
vector<edge> G[100];
double d[40][100];
bool used[40][100];
typedef pair<int,int> pii; //to,speed
typedef pair<double,pii> P;//cost,to,speed

double dikstra(int s,int g){
  int ds[3]={-1,0,1};
  priority_queue<P,vector<P>,greater<P> > que;
  for(int i=0;i<40;i++)
    for(int j=0;j<100;j++)
      d[i][j]=INF;
  memset(used,0,sizeof(used));
  d[0][s]=0;
  que.push(P(0,pii(s,0)));
  while(!que.empty()){
    P p=que.top();que.pop();
    int speed=p.second.second;
    int v=p.second.first;
    double cost=p.first;
    //cout << v << ";" << speed <<":" << cost << endl;
    if(d[speed][v]<cost)continue;
    for(int i=0;i<G[v].size();i++){
      for(int j=0;j<3;j++){
	edge e=G[v][i];
	int ns=speed+ds[j];
	if(1<=ns && ns<= e.limit &&
	   used[ns][e.to]==false){
	  used[ns][e.to]=true;
	  que.push(P(cost+e.dist/ns,pii(e.to,ns)));
	  if(d[ns][e.to]>cost+e.dist/ns){
	    d[ns][e.to]=cost+e.dist/ns;
	    //cout << "d[" << ns << "][" << e.to << "]:" << d[ns][e.to] << endl;
	    //cout << "d[" << v << "]:" << d[speed][v] << " speed:" << speed<< endl;
	  }
	}
      }
    }
  }
  if(d[1][g]==INF)return -1;
  return d[1][g];
}

int main(){
  int n,m,s,g;
  while(cin>>n>>m,n){
    for(int i=0;i<100;i++)G[i].clear();
    cin>>s>>g;
    for(int i=0;i<m;i++){
      int x,y,d,c;
      cin>>x>>y>>d>>c;
      G[x].push_back((edge){y,c,d});
      G[y].push_back((edge){x,c,d});
    }
    double ans=dikstra(s,g);
    if(ans==-1)cout << "unreachable" << endl;
    else printf("%lf\n",ans);
    // for(int i=0;i<=n;i++)
    // 	cout << i << " " << d[i] << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'double dikstra(int, int)':
a.cc:24:3: error: 'memset' was not declared in this scope
   24 |   memset(used,0,sizeof(used));
      |   ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<queue>
  +++ |+#include <cstring>
    4 | #include<vector>
a.cc: In function 'int main()':
a.cc:63:33: warning: narrowing conversion of 'd' from 'int' to 'double' [-Wnarrowing]
   63 |       G[x].push_back((edge){y,c,d});
      |                                 ^
a.cc:64:33: warning: narrowing conversion of 'd' from 'int' to 'double' [-Wnarrowing]
   64 |       G[y].push_back((edge){x,c,d});
      |                                 ^
Language: C++

#include<iostream>
#include<cmath>
#include<queue>
#include<vector>
#include<cstdio>
#define INF 1e10
#define EPS 1e-10
using namespace std;
struct edge{
  int to,limit;
  double dist;
};
vector<edge> G[100];
double d[40][100];
bool used[40][100];
typedef pair<int,int> pii; //to,speed
typedef pair<double,pii> P;//cost,to,speed

double dikstra(int s,int g){
  int ds[3]={-1,0,1};
  priority_queue<P,vector<P>,greater<P> > que;
  for(int i=0;i<40;i++)
    for(int j=0;j<100;j++)
      d[i][j]=INF;
  memset(used,0,sizeof(used));
  d[0][s]=0;
  que.push(P(0,pii(s,0)));
  while(!que.empty()){
    P p=que.top();que.pop();
    int speed=p.second.second;
    int v=p.second.first;
    double cost=p.first;
    //cout << v << ";" << speed <<":" << cost << endl;
    if(d[speed][v]<cost)continue;
    for(int i=0;i<G[v].size();i++){
      for(int j=0;j<3;j++){
	edge e=G[v][i];
	int ns=speed+ds[j];
	if(1<=ns && ns<= e.limit &&
	   used[ns][e.to]==false){
	  used[ns][e.to]=true;
	  que.push(P(cost+e.dist/ns,pii(e.to,ns)));
	  if(d[ns][e.to]>cost+e.dist/ns){
	    d[ns][e.to]=cost+e.dist/ns;
	    //cout << "d[" << ns << "][" << e.to << "]:" << d[ns][e.to] << endl;
	    //cout << "d[" << v << "]:" << d[speed][v] << " speed:" << speed<< endl;
	  }
	}
      }
    }
  }
  if(d[1][g]==INF)return -1;
  return d[1][g];
}

int main(){
  int n,m,s,g;
  while(cin>>n>>m,n){
    for(int i=0;i<100;i++)G[i].clear();
    cin>>s>>g;
    for(int i=0;i<m;i++){
      int x,y,d,c;
      cin>>x>>y>>d>>c;
      G[x].push_back((edge){y,c,d});
      G[y].push_back((edge){x,c,d});
    }
    double ans=dikstra(s,g);
    if(ans==-1)cout << "unreachable" << endl;
    else printf("%lf\n",ans);
    // for(int i=0;i<=n;i++)
    // 	cout << i << " " << d[i] << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'double dikstra(int, int)':
a.cc:25:3: error: 'memset' was not declared in this scope
   25 |   memset(used,0,sizeof(used));
      |   ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include<cstdio>
  +++ |+#include <cstring>
    6 | #define INF 1e10
a.cc: In function 'int main()':
a.cc:64:33: warning: narrowing conversion of 'd' from 'int' to 'double' [-Wnarrowing]
   64 |       G[x].push_back((edge){y,c,d});
      |                                 ^
a.cc:65:33: warning: narrowing conversion of 'd' from 'int' to 'double' [-Wnarrowing]
   65 |       G[y].push_back((edge){x,c,d});
      |                                 ^
Language: C++

#include<bits/std.h++>
#define INF 1e10
#define EPS 1e-10
using namespace std;
struct edge{
  int to,limit;
  double dist;
};
vector<edge> G[100];
double d[40][100];
bool used[40][100];
typedef pair<int,int> pii; //to,speed
typedef pair<double,pii> P;//cost,to,speed

double dikstra(int s,int g){
  int ds[3]={-1,0,1};
  priority_queue<P,vector<P>,greater<P> > que;
  for(int i=0;i<40;i++)
    for(int j=0;j<100;j++)
      d[i][j]=INF;
  memset(used,0,sizeof(used));
  d[0][s]=0;
  que.push(P(0,pii(s,0)));
  while(!que.empty()){
    P p=que.top();que.pop();
    int speed=p.second.second;
    int v=p.second.first;
    double cost=p.first;
    //cout << v << ";" << speed <<":" << cost << endl;
    if(d[speed][v]<cost)continue;
    for(int i=0;i<G[v].size();i++){
      for(int j=0;j<3;j++){
	edge e=G[v][i];
	int ns=speed+ds[j];
	if(1<=ns && ns<= e.limit &&
	   used[ns][e.to]==false){
	  used[ns][e.to]=true;
	  que.push(P(cost+e.dist/ns,pii(e.to,ns)));
	  if(d[ns][e.to]>cost+e.dist/ns){
	    d[ns][e.to]=cost+e.dist/ns;
	    //cout << "d[" << ns << "][" << e.to << "]:" << d[ns][e.to] << endl;
	    //cout << "d[" << v << "]:" << d[speed][v] << " speed:" << speed<< endl;
	  }
	}
      }
    }
  }
  if(d[1][g]==INF)return -1;
  return d[1][g];
}

int main(){
  int n,m,s,g;
  while(cin>>n>>m,n){
    for(int i=0;i<100;i++)G[i].clear();
    cin>>s>>g;
    for(int i=0;i<m;i++){
      int x,y,d,c;
      cin>>x>>y>>d>>c;
      G[x].push_back((edge){y,c,d});
      G[y].push_back((edge){x,c,d});
    }
    double ans=dikstra(s,g);
    if(ans==-1)cout << "unreachable" << endl;
    else printf("%lf\n",ans);
    // for(int i=0;i<=n;i++)
    // 	cout << i << " " << d[i] << endl;
  }
  return 0;
}

Compiler output:
a.cc:1:9: fatal error: bits/std.h++: No such file or directory
    1 | #include<bits/std.h++>
      |         ^~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
using namespace std;
typedef long long ll;
double cut[32][32][32];
pair<int,int> way[32][32];
int main() {
	int n, m, s, g;
	while(cin >> n >> m, n) {
		cin >> s >> g;
		fill((double*)cut, (double*)cut + 32 * 1024, 1e100);
		fill((pair<int,int>*)way, (pair<int,int>*)way + 1024,make_pair(0,0);
		for (int i = 0; i < m; i++) {
			int x, y, d, c;
			cin >> x >> y >> d >> c;
			way[x][y] = way[y][x] = make_pair(d,c);
		}
		priority_queue<tuple<double, int, int>,vector<tuple<double, int, int>>,greater<tuple<double, int, int>>> que;
		que.push(make_tuple(0., s, 1));
		while (!que.empty()&&(get<1>(que.top())!=g||get<2>(que.top())!=0)){
			auto a = que.top();
			que.pop();
			for (int i = 1; i <= n; i++) {
				if (way[get<1>(a)][i].second == 0)continue;
				if (i == get<1>(a))continue;
				if (get<2>(a)>way[get<1>(a)][i].second)continue;
				if (get<2>(a) == 0)continue;
				for (int j = max(0, get<2>(a)-1); j <= get<2>(a)+1; j++) {
					if (cut[i][j][get<1>(a)]>get<0>(a) + (double)way[get<1>(a)][i].first / get<2>(a)) {
						que.push(make_tuple(get<0>(a) + (double)way[get<1>(a)][i].first / get<2>(a), i, j));
						cut[i][j][get<1>(a)] = get<0>(a) + (double)way[get<1>(a)][i].first / get<2>(a);
					}
				}
			}
		}
		if (que.empty())cout << "unreachable" << endl;
		else cout << fixed << setprecision(10) << get<0>(que.top()) << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:84: error: expected ')' before ';' token
   21 |                 fill((pair<int,int>*)way, (pair<int,int>*)way + 1024,make_pair(0,0);
      |                     ~                                                              ^
      |                                                                                    )
Language: C++

#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main(void) {
	while(true) {
		int n, m;
		cin>>n>>m;
		if(n == 0 && m == 0) break;
		int s, g;
		cin>>s>>g;
		--s;
		--g;
		vector<vector<pair<ll, P> > > p(n);
		vector<vector<vector<double> > > d(n, vector<vector<double> >(n, vector<double>(31, INF)));
		REP(i, m) {
			int x, y, d, c;
			cin>>x>>y>>d>>c;
			--x;
			--y;
			p[x].pb({y, P(d, c)});
			p[y].pb({x, P(d, c)});
		}
		priority_queue<pair<pair<double, ll>, P>, vector<pair<pair<double, ll>, P> >, greater<pair<pair<double, ll>, P> > > q;
		REP(i, n) {
			d[0][i]][1] = 0;
		}
		q.push({{0, 0}, {0, 1}});
		while(!q.empty()) {
			pair<pair<double, ll>, P> np = q.top();
			q.pop();
			if(d[np.first.second][np.second.first][np.second.second] != np.first.first) continue;
			FOR(i, -1, 2) {
				ll ns = np.second.second + i;
				if(np.first.second == 0 && np.second.first == 0) {
					if(ns != 1) continue;
				}
				if(ns <= 0) continue;
				REP(j, p[np.first.second].size()) {
					ll next = p[np.first.second][j].first;
					if(next == np.second.first) continue;
					if(p[np.first.second][j].second.second < ns) continue;
					if(d[next][np.first.second][ns] > d[np.first.second][np.second.first][np.second.second] + p[np.first.second][j].second.first / (double)ns) {
						d[next][np.first.second][ns]  = d[np.first.second][np.second.first][np.second.second] + p[np.first.second][j].second.first / (double)ns;
						q.push({{d[next][np.first.second][ns], next}, {np.first.second, ns}});
					}
				}
			}
		}
		double ans = INF;
		REP(i, n) {
			ans = min(ans, d[g][i][1]);
		}
		if(ans != INF) cout<<fixed<<showpoint<<setprecision(39)<<ans<<endl;
		else cout<<"unreachable"<<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:32: error: expected ';' before ']' token
   44 |                         d[0][i]][1] = 0;
      |                                ^
      |                                ;
a.cc:44:31: warning: ignoring return value of 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = std::vector<double>; _Alloc = std::allocator<std::vector<double> >; reference = std::vector<double>&; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result]
   44 |                         d[0][i]][1] = 0;
      |                               ^
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:6:
/usr/include/c++/14/bits/stl_vector.h:1128:7: note: declared here
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define se second
#define fi first
using namespace std;
typedef pair<pair<int,int>,int>P;
struct edge{int to,lim;double dist;};
int n,m,st,go,a1,a2,a4;
double d[31][31],a3;
int dx[]={-1,0,1};
edge e;
vector<edge> v[31];
int main(){
  while(cin>>n>>m,n){
    r(i,31)v[i].clear();
    r(i,31)r(j,31)d[i][j]=1e12;
    cin>>st>>go;
    r(i,m){
      scanf("%d%d%lf%d",&a1,&a2,&a3,&a4);
      e.to=a2,e.dist=a3,e.lim=a4;
      v[a1].push_back(e);
      e.to=a1;
      v[a2].push_back(e);
    }
    priority_queue<P>q;
    d[st][0]=0;
    P xt;xt.fi.fi=0,xt.fi.se=st,xt.se=-1;
    q.push(xt);
    while(!q.empty()){
      P p=q.front();q.pop();
      int cur=p.fi.se;
      r(i,v[cur].size()){
        e=v[cur][i];
        if(e.to!=p.se)r(j,3){
          int x=p.fi.fi+dx[j];
          if(0<x&&x<=e.lim){
            double t=e.dist/x+d[cur][p.fi.fi];
            if(d[e.to][x]>t){
              d[e.to][x]=t;
              xt.fi.fi=x,xt.fi.se=e.to,xt.se=cur;
              q.push(xt);
            }
          }
        }
      }
    }
    if(d[go][1]==1e12)cout<<"unreachable"<<endl;
    else printf("%.9f\n",d[go][1]);
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:13: error: 'class std::priority_queue<std::pair<std::pair<int, int>, int> >' has no member named 'front'
   30 |       P p=q.front();q.pop();
      |             ^~~~~
Language: C++

#include <iostream>
#include <queue>
#define EPS (1.0e-9)
#define LT(x, y) ((x) - (y) <= -EPS) // x < y
#define INF (1<<19)
using namespace std;
typedef struct DisLim {
 int d, c; // dist, limit v
 DisLim() {}
 DisLim(int d, int c) : d(d),c(c) {}
} DisLim;
int N,M;
int S,G; // start, goal
DisLim F[31][31];

double dist[31][31][31];
bool visited[31][31][31];
class State {
public:
 int bpos, cpos; // before,current
 double d; // ツ仰猟猟」
 int v; // ツ堕ャツ度
 State (int bpos, int cpos, double d, int v) :
   bpos(bpos),cpos(cpos),d(d),v(v) {}
 bool operator < (const State &s) const {
   //return d > s.d;
   return LT(s.d,d);
 }
};

priority_queue<State> PQ;
double solve() {
  while(!PQ.empty()) {
    State u = PQ.top(); PQ.pop();
    int bpos=u.bpos, cpos=u.cpos, v=u.v;
    double d = u.d;
    
    visited[bpos][cpos][v] = true;
    if(cpos == G && v == 1) {
      return dist[bpos][G][1];
    }

    for(int i=1;i<=N;i++) { // ツ篠淞づ個都ツ市
      if(i==bpos || i==cpos) continue; // ツ古」ツ姪淞づィツ凝鳴止
      for(int j=-1;j<=1;j++) { // ツ嘉個クツ堕ャツ堕閉置
	if(v+j <= 0) continue;
	if(v+j > F[cpos][i].c) continue;
	if(visited[cpos][i][v+j]) continue;
	if(F[cpos][i].d >= INF) continue;
	double cost = dist[bpos][cpos][v] + (double)F[cpos][i].d / (v+j);
	if(LT(cost,dist[cpos][i][v+j])) {
	  dist[cpos][i][v+j] = cost;
	  PQ.push(State(cpos,i,cost,v+j));
	}
      }
    }
  }
  return -1;
}

main() {
 while(cin>>N>>M,N) {
   PQ = priority_queue<State>();
   memset(visited,0,sizeof(visited));
   for(int i=1;i<=N;i++) {
     for(int j=1;j<=N;j++) {
       F[i][j].d=INF;
     }
   }
   cin>>S>>G;
   for(int i=1;i<=N;i++) {
     for(int j=1;j<=N;j++) {
       for(int k=0;k<31;k++) {
         dist[i][j][k] = INF;
       }
     }
   }
   for(int i=0;i<31;i++) {
     dist[S][S][i] = 0;
   }
   PQ.push(State(S,S,0,1));
   for(int i=0;i<M;i++) {
     int x,y,d,c; cin>>x>>y>>d>>c;
     F[x][y]=F[y][x]=DisLim(d,c);
   }
   double ans = solve();
   if(ans==-1) puts("unreachable");
   else printf("%.5lf\n",ans);
 }
}

Compiler output:
a.cc:61:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   61 | main() {
      | ^~~~
a.cc: In function 'int main()':
a.cc:64:4: error: 'memset' was not declared in this scope
   64 |    memset(visited,0,sizeof(visited));
      |    ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <queue>
  +++ |+#include <cstring>
    3 | #define EPS (1.0e-9)
Language: C++

#include <iostream>
#include <queue>
#include <stdlib.h>
#define EPS (1.0e-9)
#define LT(x, y) ((x) - (y) <= -EPS) // x < y
#define INF (1<<19)
using namespace std;
typedef struct DisLim {
 int d, c; // dist, limit v
 DisLim() {}
 DisLim(int d, int c) : d(d),c(c) {}
} DisLim;
int N,M;
int S,G; // start, goal
DisLim F[31][31];

double dist[31][31][31];
bool visited[31][31][31];
class State {
public:
 int bpos, cpos; // before,current
 double d; // ツ仰猟猟」
 int v; // ツ堕ャツ度
 State (int bpos, int cpos, double d, int v) :
   bpos(bpos),cpos(cpos),d(d),v(v) {}
 bool operator < (const State &s) const {
   //return d > s.d;
   return LT(s.d,d);
 }
};

priority_queue<State> PQ;
double solve() {
  while(!PQ.empty()) {
    State u = PQ.top(); PQ.pop();
    int bpos=u.bpos, cpos=u.cpos, v=u.v;
    double d = u.d;
    
    visited[bpos][cpos][v] = true;
    if(cpos == G && v == 1) {
      return dist[bpos][G][1];
    }

    for(int i=1;i<=N;i++) { // ツ篠淞づ個都ツ市
      if(i==bpos || i==cpos) continue; // ツ古」ツ姪淞づィツ凝鳴止
      for(int j=-1;j<=1;j++) { // ツ嘉個クツ堕ャツ堕閉置
	if(v+j <= 0) continue;
	if(v+j > F[cpos][i].c) continue;
	if(visited[cpos][i][v+j]) continue;
	if(F[cpos][i].d >= INF) continue;
	double cost = dist[bpos][cpos][v] + (double)F[cpos][i].d / (v+j);
	if(LT(cost,dist[cpos][i][v+j])) {
	  dist[cpos][i][v+j] = cost;
	  PQ.push(State(cpos,i,cost,v+j));
	}
      }
    }
  }
  return -1;
}

main() {
 while(cin>>N>>M,N) {
   PQ = priority_queue<State>();
   memset(visited,0,sizeof(visited));
   for(int i=1;i<=N;i++) {
     for(int j=1;j<=N;j++) {
       F[i][j].d=INF;
     }
   }
   cin>>S>>G;
   for(int i=1;i<=N;i++) {
     for(int j=1;j<=N;j++) {
       for(int k=0;k<31;k++) {
         dist[i][j][k] = INF;
       }
     }
   }
   for(int i=0;i<31;i++) {
     dist[S][S][i] = 0;
   }
   PQ.push(State(S,S,0,1));
   for(int i=0;i<M;i++) {
     int x,y,d,c; cin>>x>>y>>d>>c;
     F[x][y]=F[y][x]=DisLim(d,c);
   }
   double ans = solve();
   if(ans==-1) puts("unreachable");
   else printf("%.5lf\n",ans);
 }
}

Compiler output:
a.cc:62:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   62 | main() {
      | ^~~~
a.cc: In function 'int main()':
a.cc:65:4: error: 'memset' was not declared in this scope
   65 |    memset(visited,0,sizeof(visited));
      |    ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <stdlib.h>
  +++ |+#include <cstring>
    4 | #define EPS (1.0e-9)
Language: C++

#include <iostream>
#include <queue>
#include <stdlib.h>
#define EPS (1.0e-9)
#define LT(x, y) ((x) - (y) <= -EPS) // x < y
#define INF (1<<19)
using namespace std;
typedef struct DisLim {
 int d, c; // dist, limit v
 DisLim() {}
 DisLim(int d, int c) : d(d),c(c) {}
} DisLim;
int N,M;
int S,G; // start, goal
DisLim F[31][31];

double dist[31][31][31];
bool visited[31][31][31];
class State {
public:
 int bpos, cpos; // before,current
 double d; // ツ仰猟猟」
 int v; // ツ堕ャツ度
 State (int bpos, int cpos, double d, int v) :
   bpos(bpos),cpos(cpos),d(d),v(v) {}
 bool operator < (const State &s) const {
   //return d > s.d;
   return LT(s.d,d);
 }
};

priority_queue<State> PQ;
double solve() {
  while(!PQ.empty()) {
    State u = PQ.top(); PQ.pop();
    int bpos=u.bpos, cpos=u.cpos, v=u.v;
    double d = u.d;
    
    visited[bpos][cpos][v] = true;
    if(cpos == G && v == 1) {
      return dist[bpos][G][1];
    }

    for(int i=1;i<=N;i++) { // ツ篠淞づ個都ツ市
      if(i==bpos || i==cpos) continue; // ツ古」ツ姪淞づィツ凝鳴止
      for(int j=-1;j<=1;j++) { // ツ嘉個クツ堕ャツ堕閉置
	if(bpos==S && S==cpos && j != 0) continue;
	if(v+j <= 0) continue;
	if(v+j > F[cpos][i].c) continue;
	if(visited[cpos][i][v+j]) continue;
	if(F[cpos][i].d >= INF) continue;
	double cost = dist[bpos][cpos][v] + (double)F[cpos][i].d / (v+j);
	if(LT(cost,dist[cpos][i][v+j])) {
	  dist[cpos][i][v+j] = cost;
	  PQ.push(State(cpos,i,cost,v+j));
	}
      }
    }
  }
  return -1;
}

main() {
 while(cin>>N>>M,N) {
   PQ = priority_queue<State>();
   memset(visited,0,sizeof(visited));
   for(int i=1;i<=N;i++) {
     for(int j=1;j<=N;j++) {
       F[i][j].d=INF;
     }
   }
   cin>>S>>G;
   for(int i=1;i<=N;i++) {
     for(int j=1;j<=N;j++) {
       for(int k=0;k<31;k++) {
         dist[i][j][k] = INF;
       }
     }
   }
   for(int i=0;i<31;i++) {
     dist[S][S][i] = 0;
   }
   PQ.push(State(S,S,0,1));
   for(int i=0;i<M;i++) {
     int x,y,d,c; cin>>x>>y>>d>>c;
     F[x][y]=F[y][x]=DisLim(d,c);
   }
   double ans = solve();
   if(ans==-1) puts("unreachable");
   else printf("%.5lf\n",ans);
 }
}

Compiler output:
a.cc:63:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   63 | main() {
      | ^~~~
a.cc: In function 'int main()':
a.cc:66:4: error: 'memset' was not declared in this scope
   66 |    memset(visited,0,sizeof(visited));
      |    ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <stdlib.h>
  +++ |+#include <cstring>
    4 | #define EPS (1.0e-9)