Language: C++

int half(int y);

int main(){
	int inic, inh, inm, outic, outh, outm, yen, kyori;
	while(1){
	cin >>inic;
	if(inic == 0) break;
	cin >>inh >>inm >>outic >>outh >>outm;
	
	yen = charge(inic, outic);
	kyori = dist(inic, outic);
	if(checkhalf(inh, inm, outh, outm, kyori)) yen = half(yen);
	
	cout <<yen;
	
	}
	return 0;
}
int charge(int in, int out){
	if(in == 1){
		if(out == 2) return 300;
		if(out == 3) return 500;
		if(out == 4) return 600;
		if(out == 5) return 700;
		if(out == 6) return 1350;
		if(out == 7) return 1650;
	} else if(in == 2){
		if(out == 3) return 350;
		if(out == 4) return 450;
		if(out == 5) return 600;
		if(out == 6) return 1150;
		if(out == 7) return 1500;
	} else if(in == 3){
		if(out == 4) return 250;
		if(out == 5) return 400;
		if(out == 6) return 1000;
		if(out == 7) return 1350;
	} else if(in == 4){
		if(out == 5) return 250;
		if(out == 6) return 850;
		if(out == 7) return 1300;
	} else if(in == 5){
		if(out == 6) return 600;
		if(out == 7) return 1150;
	} else if(in == 6){
		if(out == 7) return 500;
	} else{
		cout <<"error!";
	}
}

int dist(int in, int out){
	if(in == 1){
		if(out == 2) return 6;
		if(out == 3) return 13;
		if(out == 4) return 18;
		if(out == 5) return 23;
		if(out == 6) return 43;
		if(out == 7) return 58;
	} else if(in == 2){
		if(out == 3) return 7;
		if(out == 4) return 12;
		if(out == 5) return 17;
		if(out == 6) return 37;
		if(out == 7) return 52;
	} else if(in == 3){
		if(out == 4) return 5;
		if(out == 5) return 10;
		if(out == 6) return 30;
		if(out == 7) return 45;
	} else if(in == 4){
		if(out == 5) return 5;
		if(out == 6) return 25;
		if(out == 7) return 40;
	} else if(in == 5){
		if(out == 6) return 20;
		if(out == 7) return 35;
	} else if(in == 6){
		if(out == 7) return 15;
	} else{
		cout <<"error!";
	}
}

int checkhalf(int ih, int im, int oh, int om, int dis){
	int flag1 = 0, flag2 = 0;
	if(dis > 40) return 0;
	
	if(ih < 17 || (ih == 17 && im <= 30)){
		if(oh - 17 > 0 || (oh == 17 && om >= 30)){
			flag1 = 1;
		}
	}
	
	if(ih < 19 || (ih == 19 && im <= 30)){
		if(oh - 19 > 0 || (oh == 19 && om >= 30)){
			flag2 = 1;
		}
	}
	
	if((flag1 && flag2) || (!flag1 && !flag2)) return 0;
	else if((flag1 && !flag2) || (!flag1 && flag2)) return 1;
}

int half(int y){
	int temp = y;
	
	temp /= 2;
	if(temp % 50 != 0){
		temp = temp + abs((temp % 50 - 50));
	}
	
	return temp;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'cin' was not declared in this scope
    6 |         cin >>inic;
      |         ^~~
a.cc:10:15: error: 'charge' was not declared in this scope; did you mean 'char'?
   10 |         yen = charge(inic, outic);
      |               ^~~~~~
      |               char
a.cc:11:17: error: 'dist' was not declared in this scope
   11 |         kyori = dist(inic, outic);
      |                 ^~~~
a.cc:12:12: error: 'checkhalf' was not declared in this scope
   12 |         if(checkhalf(inh, inm, outh, outm, kyori)) yen = half(yen);
      |            ^~~~~~~~~
a.cc:14:9: error: 'cout' was not declared in this scope
   14 |         cout <<yen;
      |         ^~~~
a.cc: In function 'int charge(int, int)':
a.cc:48:17: error: 'cout' was not declared in this scope; did you mean 'out'?
   48 |                 cout <<"error!";
      |                 ^~~~
      |                 out
a.cc: In function 'int dist(int, int)':
a.cc:81:17: error: 'cout' was not declared in this scope; did you mean 'out'?
   81 |                 cout <<"error!";
      |                 ^~~~
      |                 out
a.cc: In function 'int half(int)':
a.cc:110:31: error: 'abs' was not declared in this scope
  110 |                 temp = temp + abs((temp % 50 - 50));
      |                               ^~~
a.cc: In function 'int charge(int, int)':
a.cc:50:1: warning: control reaches end of non-void function [-Wreturn-type]
   50 | }
      | ^
a.cc: In function 'int dist(int, int)':
a.cc:83:1: warning: control reaches end of non-void function [-Wreturn-type]
   83 | }
      | ^
a.cc: In function 'int checkhalf(int, int, int, int, int)':
a.cc:103:1: warning: control reaches end of non-void function [-Wreturn-type]
  103 | }
      | ^