Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

const (
	LAST_MONTH = 4280
	BASE = 1150
)

func main() {
	for scanner.Scan() {
		w, _ := strconv.Atoi(scanner.Text())
		if w < 0 {
			break
		}
		s := BASE
		if  10 < w {
			if w <= 20 {
				s+= (w-10)*125
			} else {
				s+= 1250
			}
		}
		if 20 < w {
			if w <= 30 {
				s += (w-20)*140
			} else {
				s += 1400
			}
		}
		if 30 < w {
			s += (w-30)*160
		}
		fmt.Println(LAST_MONTH-s)
	}
}

C++: #include <iostream>

using namespace std;
 
int main()
{
    int w;
  
    while (cin >> w, w != -1) {
	int ans = 3130;
	w -= 10;
 
	if (w >= 10) {
	    ans -= 10*125;
	    w -= 10;
	} else if (w > 0) {
	    ans -= w*125;
	    w = 0;
	} else {
	    cout << ans << endl;
	    continue;
	}
 
	if (w >= 10) {
	    ans -= 10*140;
	    w -= 10;
	} else if (w > 0) {
	    ans -= w*140;
	    w = 0;
	} else {
	    cout << ans << endl;
	    continue;
	}
     
	if (w > 0) {
	    ans -= w*160;
	} else {
	    cout << ans << endl;
	    continue;
	} 
	cout << ans << endl;
    }
    return 0;
}

C++: #include <iostream>

using namespace std;

int main() {

  int w;

  int fee;


  while(1) {

    cin >> w;

    if(w==-1) break;

    fee=1150;

    if(w>30) fee+=160*(w-30);

    if(w>20) fee+=140*min(w-20,10);

    if(w>10) fee+=125*min(w-10,10);

    cout << 4280-fee << endl;

  }

  return 0;

}

C++: #include <iostream>
using namespace std;
int main(void){
    int w;

    int a=1150;
    int b=125;
    int c=140;
    int d=160;
    int e=4280;
    
    while(true){
    cin>>w;  
    if(w==-1)break;

    else if(w<10) cout<<e-a<<endl;
    else if(w<20) cout<<e-(a+(w-10)*b)<<endl;
    else if(w<30) cout<<e-(a+b*10+(w-20)*c)<<endl;
    else if(30<=w) cout<<e-(a+b*10+c*10+(w-30)*d)<<endl;
    }
    
    
}

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

int main(void)
{
  while(1){
    int rate;
    cin >> rate;
    if(rate == -1) break;
    else{
      if(rate==0){
        rate==0;
      }
      else{
        rate-=10;
      }
      while(1){
        if(rate >=0 && rate < 10){
          rate*=125;
          break;
        }else if(rate >= 10 && rate < 20){
          rate-=10;
          rate*=140;
          rate+=1250;
          break;
        }else if(rate >= 20 && rate <= 30){
          rate-=20;
          rate*=160;
          rate+=2650;
          break;
        }
      }
      rate+=1150;
      cout << 4280-rate << endl;
    }
  }
}

C++: #include <iostream>
using namespace std;
int main(void){
    int w; //今月の使用水量
    
    while(true){
        cin >> w;
        if(w == -1) break;

        int waterbill; //今月の水道料金
        int base = 1150; //基本料金
        if(w <= 10)
            waterbill = base;
        if(w > 10){
            if(w < 20)
                waterbill = base + (w % 10) * 125;
            else if(w == 20)
                waterbill = base + 1250;
            else if(20 < w && w < 30)
                waterbill = base + 1250 + (w % 10) * 140;
            else if(w == 30)
                waterbill = base + 1250 + 1400;
            else
                waterbill = base + 1250 + 1400 + (w - 30) * 160; 
        }

        int save = 4280 - waterbill;  //節約できた金額
        cout << save << endl;
    }
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    while(cin>>n&&n!=-1){
        int sum=3130,num[3]={125,140,160};
        for(int i=0;i<3;i++){
            n-=10;
            if(n>10&&i!=2)sum-=num[i]*10;
            else if(n>0)sum-=num[i]*n;
        }
        cout<<sum<<endl;
    }
}

C++: #include<iostream>
using namespace std;
int main(){

  int w,ryoukin;

  while(1){
    
    cin >>w;

    if(w == -1)break;
    
    ryoukin=1150;
    
    if(w > 30){
      ryoukin+=(w-30)*160;
      w=w-(w-30);
    }
    if(w > 20){
      ryoukin+=(w-20)*140;
      w=w-(w-20);
    }
    if(w > 10){
      ryoukin+=(w-10)*125;
    }
    
    cout <<4280-ryoukin<<endl;

  }
  return 0;
}

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


int main(){
  while(true){
    int n,much=0;
    cin>>n;
    if(n==-1){
      break;
    }
    much=much+1150;
    if(20>=n&&n>10){
      much=(n-10)*125+much;
    }
    if(30>=n&&n>20){
      much=(n-20)*140+much+1250;
    }
    if(n>30){
      much=(n-30)*160+much+1250+1400;
    }
    cout<<4280-much<<endl;
  }

  return 0;
}

C++: // Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){
		int w;
		cin >> w;

		if(w==-1)
			break;

		int bil;
		if(w<=10){
			bil = 1150;
		}
		else if(w<=20){
			bil = 1150+(w-10)*125;
		}
		else if(w<=30){
			bil = 1150+10*125+(w-20)*140;
		}
		else{
			bil = 1150+10*125+10*140+(w-30)*160;
		}

		cout << 4280-bil << '\n';
	}

	return 0;
}

C++: #include<iostream>
using namespace std;
int getCost(int w){
 int cost = 1150; // ?¬¬?????????
 for (int i = 11; i <= w; i++ ){
 if ( i <= 20 ) cost += 125; // ?¬¬?????????
 else if ( 30 < i ) cost += 160; // ?¬¬?????????
 else cost += 140; // ?¬¬?????????
 }
 return cost;
}
int main(){
 for( int w; cin >> w && w >= 0; ) {
 cout << 4280 - getCost(w) << endl;
 }
 return 0;
}

C++: #include<iostream>
  
using namespace std;
  
const int p=4280,a[3]={125,140,160};
  
int main(void){
  
int w;
  
while(true){
cin >> w;
if(w==-1)break;
  
int res=1150;
  
for(int i=0;i<2;i++){
w-=10;
if(w<0)break;
res+=w%11*a[i];
}
if(w>0)res+=w*a[2];
cout << res-p << endl;
}
  
return 0;
}

C++: /*
	0216:Cutting Down Water Bills
*/
#include	<iostream>

using namespace std;

int main(void) {
	int w;
	while(1){
		cin >> w;
		if(w == -1) { break; }
		
		int m = 1150;
		w -= 10;
		for(int i = 0; i < 10 && w > 0; i++, w--){
			m += 125;
		}
		for(int i = 0; i < 10 && w > 0; i++, w--){
			m += 140;
		}
		for(w; w > 0; w--){
			m += 160;
		}
		cout << 4280 - m << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
  int n=0,ans;
  cin >>n;
  while(n!=-1){
    ans=0;
    if(n>30){
      ans+=(n-30)*160;
      n=30;
    }
    if(n>20){
      ans+=(n-20)*140;
      n=20;
    }
    if(n>10)
      ans+=(n-10)*125;
    cout <<4280-(ans+1150)<<endl;
    cin>> n;
  }
  return 0;
}

C++: #include<stdio.h>
int main(void)
{
    int a,x,y,v,k;
	scanf("%d",&a);
	while(1){
	    if (a<=0) break;
		k=3130;
		x=4280-(a-10)*125-1150;
		y=4280-(a-20)*140-2400;
		v=4280-(a-30)*160-3800;
		if(a<=10){
			printf("%d\n",k);
		}
		else if(a<=20){
			printf("%d\n",x);
		}
		else if(a<=30){
			printf("%d\n",y);
		}
		else if(30<=a){
			printf("%d\n",v);
		}
	}
	return 0;
}

C++: #include <cstdio>
#include <algorithm>

using namespace std;

#define MAX 300000

int w;

int cost(int w) {
	return 1150 + min(max(w - 10, 0), 10) * 125 + min(max(w - 20, 0), 10) * 140
			+ max(w - 30, 0) * 160;
}

int main() {
	while (1) {
		scanf("%d", &w);
		if (w < 0)
			return 0;

		printf("%d\n", 4280 - cost(w));
	}
}

C++: #include<iostream>

using namespace std;

const int p=4280,a[3]={125,140,160};

int main(void){

int w;

while(true){
cin >> w;
if(w==-1)break;

int res=1150;

for(int i=0;i<3;i++){
w-=10;
if(w<0)break;
res+=w%10*a[i];
}

cout << res-p << endl;
}

return 0;
}