Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() (int, error) {
	return strconv.Atoi(nextString())
}

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func main() {
	scanner.Split(bufio.ScanWords)
	startTemp, _ := nextInt()
	targetTemp, _ := nextInt()
	deltaFrozen, _ := nextInt()
	deltaZero, _ := nextInt()
	deltaNotFrozen, _ := nextInt()

	requiredTime := 0

	if startTemp < 0 {
		requiredTime += -startTemp * deltaFrozen
	}
	if startTemp <= 0 {
		requiredTime += deltaZero
	}
	if startTemp <= 0 {
		requiredTime += targetTemp * deltaNotFrozen
	} else {
		requiredTime += (targetTemp - startTemp) * deltaNotFrozen
	}

	fmt.Println(requiredTime)
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl;
#define WHITE 0
#define BLACK 2
#define GRAY 1
#define RE return 0;
#define HERE cout<<"    "<<"HERE"<<en

int main(){
  int a,b,c,d,e;
  cin>>a>>b>>c>>d>>e;
  
  int sum=0;
  if(a>b) swap(a, b);
  while(a<0){
    sum+=c;;
    a++;
  }
  if(a==0) sum+=d;
  while(a<b){
    sum+=e;
    a++;
  }
  cout<<sum<<en
}

C++: #include<iostream>

using namespace std;

int main() {
	
	int bT, aT, hC, iC, E;
	int sum = 0;
	
	while( cin >> bT >> aT >> hC >> iC >> E ) {
		
	int sum = 0;
	if( bT < 0){
		
	sum += (-bT * hC);
	sum += iC;
	bT = 0;
}
	if( bT >= 0){
		
	sum += ( aT - bT ) * E;
}
	cout << sum << "\n";
}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(void){
	int a,b,c,d,e;
	cin>>a>>b>>c>>d>>e;
	int sum=0;
	if(a<=0){
		int x=0-a;
		sum+=x*c;
		sum+=d;
		sum+=b*e;
	}
	else{
		sum+=(b-a)*e;
	}
	cout<<sum<<endl;;
	return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main(void){
    int A,B,C,D,E,f,g;
    cin >>A>>B>>C>>D>>E;
    f=0;
    g=abs(A);
    if(A<0){f=f+C*g;}
    if(A<1){f=f+D;}
    if(A<1){f=f+B*E;}else{f=f+(B-A)*E;}
    cout<<f<<endl;
}

C++: #include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<int,int> P;

int main(void){

	          int A,B,C,D,E;
	          cin >> A >> B >> C >> D >> E;

	          int ans=0;
	          if(A<0){
	        	  ans+=(-1)*A*C+D+B*E;
	          }else{
	        	  ans+=(B-A)*E;
	          }

	          cout << ans << endl;

	          return 0;
}

C++: #include<iostream>


double two_high(double A,double B,double E)
{
	return (B-A)*E;
}

double two_low(double A,double B,double C)
{
	return (B-A)*C;
}
double penetrate(double A,double B,double C,double D,double E)
{
	return (-A)*C+D+B*E;
}

main()
{
	double A,B,C,D,E,temp;
	std::cin>>A>>B>>C>>D>>E;
	if(A>=0)
	temp=two_high(A,B,E);
	else if(B<=0)
	temp=two_low(A,B,C);
	else
	temp=penetrate(A,B,C,D,E);
	std::cout<<temp<<std::endl;
}

C++: #include <iostream>
using namespace std;
int main(){
  int a,b,c,d,e;cin>>a >>b >>c >> d >>e;
  int times = 0;
  if(a < 0){
    times = a * -1 * c + d;
    a = 0;
  } 
  times += (b - a) * e;
  cout << times << endl;
}

C++: #include <iostream>
using namespace std;
int main(void){
    int a,b,c,d,e;
    cin>>a>>b>>c>>d>>e;
    int time=0,temp=a;
    if(a<0){
        for(temp=a;temp<0;temp++){
            time += c;
        }
        temp=0;
        time+=d;
    }
    for(; temp <b; temp++){
        time+=e;
    }
    cout << time <<endl;
}

C++: #include<iostream>
using namespace std;
int a, b, c, d, e, t;
int main(){
cin >> a >> b >> c >> d >> e;
if(a>0){
t = e*(b-a);
} else {
t = c*(-a) + d + e*b;
}
cout << t << endl;
}

C++: #include <iostream>

using namespace std;

int main()
{
	int A, B, C, D, E;
	int second = 0;
	
	cin >> A;
	cin >> B;
	cin >> C;
	cin >> D;
	cin >> E;
	
	if (A < 0){
		while (A != 0){
			second += C;
			A++;
		}
	}
	
	if (A == 0){
		second += D;
	}
	while (A != B){
		second += E;
		A++;
	}
	
	cout << second << endl;
	
	return (0);
}

C++: #include <iostream>
using namespace std;

int main()
{
	int a, b, c, d, e, f=0;
	cin >> a >> b >> c >> d >> e;
	if (a < 0) {
		for (int i = a; i < 0; i++) {
			f = f + c;
		}
		f = f + d;
		a = 0;
	}
	for (int i = a; i < b; i++) {
		f = f + e;
	}
	cout << f << endl;
}

C++: // JOI - Prelim  0630
// 電子レンジ (Microwave)
#include <bits/stdc++.h>

using namespace std;

template <typename T>
T cin2var()
{
    T val;
    cin >> val;
    return val;
}

void sub()
{
    // 1 行目には、もともとの肉の温度 A が書かれている
    // 2 行目には、目的の温度 B が書かれている
    // 3 行目には、凍った肉を1度温めるのにかかる時間 C が書かれている
    // 4 行目には、凍った肉を解凍するのにかかる時間 D が書かれている
    // 5 行目には、凍っていない肉を1度温めるのにかかる時間 E が書かれている
    const auto A(cin2var<int64_t>());
    const auto B(cin2var<int64_t>());
    const auto C(cin2var<int64_t>());
    const auto D(cin2var<int64_t>());
    const auto E(cin2var<int64_t>());

    int64_t  a = 0;
    uint64_t t = 0;
    for (a = A; a < 0; ++a) {
        t += C;
    }
    if (A <= 0) {
        t += D;
    }
    for (auto i = a; i < B; ++i) {
        t += E;
    }
    cout << t << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    sub();
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

#define llong long long
#define inf 999999999
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef pair<int, int> P;
typedef pair<P, int> PP;
typedef pair<PP, int> PPP;
typedef struct data{
	int now;
	int cost;
}data;
int nh[4] = {1, 0, -1, 0};
int nw[4] = {0, 1, 0, -1};





int main(){
	int a, b, c, d, e;
	cin >> a >> b >> c >> d >> e;
	cout << min(0,a)*-1*c+(a<0?d:0)+(b-max(0,a))*e << endl;
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int a,b,c,d,e,x;
	scanf("%d %d %d %d %d",&a,&b,&c,&d,&e);
	if(a<0){
		x=(a*-1*c)+d+(b*e);
	}
	if(a>0){
		x=(b-a)*e;
	}
	printf("%d\n",x);
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int a,b,c,d,e,m,n,x,y,z;
	scanf("%d %d %d %d %d",&a,&b,&c,&d,&e);
	if(a<0){
		m=a*-1;
		x=c*m;
		y=e*b;
		z=x+y+d;
		printf("%d\n",z);
	}
	else if(a>0){
		x=b-a;
		y=x*e;
		printf("%d\n",y);
	}
	else{
		x=b*e;
		y=x+d;
		printf("%d\n",y);
	}
	return 0;
}

C++: #include<bits/stdc++.h>

using namespace std;

int main()
{
  int A,B,C,D,E;

  cin>>A;
  cin>>B;
  cin>>C;
  cin>>D;
  cin>>E;
  int times = 0;

  if(A < 0){
    int check = 0 - A;
    times += C * check;
    //cout<<C * check<<endl;
    A = 0;
  }

  if(A == 0){
    times += D;
    //cout<<D<<endl;
  }

  int h = B - A;
  times += E * h;
  //cout<<E * h<<endl;
  cout<<times<<endl;

  return 0;
}

C++: #include<iostream>
#include<map>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  int a,b,c,d,e,time=0;
  cin>>a>>b>>c>>d>>e;
  if(a<=0){
    time+=abs(0-a)*c;
    a=0;
  }
  if(a==0){
    time+=d;
  }
  time+=abs(b-a)*e;
  cout<<time<<endl;
}

C++: #include "bits/stdc++.h"
using namespace std;


int main(){
	int A,B,C,D,E;
	cin>>A>>B>>C>>D>>E;
	if(A <0){
		cout <<(0-A)*C+D+B*E<<endl;
	}else if(A == 0){
		cout << D+B*E<<endl;
	}else{
		cout << (B-A)*E<<endl;
	}
	

		return 0;
}