Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	tbl := []int{600, 800, 1000, 1200, 1400, 1600}
	for scanner.Scan() {
		n, _ := strconv.Atoi(scanner.Text())
		if n == 0 {
			 break
		}
		fee := 0
		for i := 0; i < n; i++ {
			scanner.Scan()
			buf := strings.Split(scanner.Text(), " ")
			x, _ := strconv.Atoi(buf[0])
			y, _ := strconv.Atoi(buf[1])
			h, _ := strconv.Atoi(buf[2])
			w, _ := strconv.Atoi(buf[3])
			s := x + y + h
			if s <= 160 && w <= 25 {
				k1, k2 := 0, 0
				if s <= 60 {
					k1 = 0
				} else {
					k1 = (s-61)/20 + 1
				}
				if w <= 2 {
					k2 = 0
				} else {
					k2 = (w-1)/5 + 1
				}
				if k1 < k2 {
					k1 = k2
				}
				fee += tbl[k1]
			}
		}
		fmt.Println(fee)
	}
}

C++: #include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    array<int, 6> as{60, 80, 100, 120, 140, 160}, bs{2, 5, 10, 15, 20, 25}, ps{600, 800, 1000, 1200, 1400, 1600};
    int n;
    while(cin >> n, n){
        int ans = 0;
        for (int i = 0; i < n; ++i) {
            int a, b, c, d;
            cin >> a >> b >> c >> d;
            for (int j = 0; j < 6; ++j) {
                if(a+b+c <= as[j] && d <= bs[j]){
                    ans += ps[j];
                    break;
                }
            }
        }
        cout << ans << "\n";
    }
    return 0;
}

C++: #include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include <string>
#include <complex>
using namespace std;

int main(){
    int n,i;
    while(cin>>n&&n){
        int x,y,h,w,b;
        int mo=0,big,wei,max;
        for(i=0;i<n;i++){
        cin>>x>>y>>h>>w;
        b=x+y+h;
        if(b<=60) big=1;
        else if(b<=80) big=2;
        else if(b<=100) big=3;
        else if(b<=120) big=4;
        else if(b<=140) big=5;
        else if(b<=160) big=6;
        else big=7;

        if(w<=2) wei=1;
        else if(w<=5) wei=2;
        else if(w<=10) wei=3;
        else if(w<=15) wei=4;
        else if(w<=20) wei=5;
        else if(w<=25) wei=6;
        else wei=7;

        if(big<=wei) max=wei;
        else max=big;
        switch(max){
            case 1:
            mo+=600;
            break;
            case 2:
            mo+=800;
            break;
            case 3:
            mo+=1000;
            break;
            case 4:
            mo+=1200;
            break;
            case 5:
            mo+=1400;
            break;
            case 6:
            mo+=1600;
            break;
            case 0:
            mo+=0;
            break;
            default:
            mo+=0;
            break;
        }
        }
        cout<<mo<<endl;
    }
    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)

int n,x,y,h,W,s[]={60,80,100,120,140,160,1000},w[]={2,5,10,15,20,25,1000},p[]={600,800,1000,1200,1400,1600,0};

int main(){
	while(cin>>n&&n){
		int ans=0;
		rep(i,n){
			cin>>x>>y>>h>>W;
			int S=x+y+h,cur=0;
			while(S>s[cur]||W>w[cur])cur++;
			ans+=p[cur];
		}
		cout<<ans<<endl;
	}
}

C++: #include <bits/stdc++.h>
#define r(i,a,n) for(i=a;i<n;i++)
#define R(i,a,n) for(int i=a;i>=n;i--)
using namespace std;
int main(){
	long int n,a,b,c,s,w;
	while(cin>>n,n){
		long int p=0;
		while(n--){
			cin>>a>>b>>c>>w;
		s=a+b+c;
		if(s<=60&&w<=2)p+=600;
		else if(s<=80&&w<=5)p+=800;
		else if(s<=120&&w<=15)p+=1200;
		else if(s<=140&&w<=20)p+=1400;
		else if(s<=160&&w<=25)p+=1600;
	    }
	    printf("%ld\n",p);
	}
	return 0;
}

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

int main(){
  int n,i,j,x,y,h,w,s,mo;
  int c[6]={60,80,100,120,140,160};
  int b[6]={2,5,10,15,20,25};
  int m[6]={600,800,1000,1200,1400,1600};

  while(cin>>n,n!=0){
    mo=0;
    for(i=0;i<n;i++){
      cin>>x>>y>>h>>w;
      s=x+y+h;
      if(s>c[5]||w>b[5])continue;
      for(j=0;j<6;j++){
	if(s<=c[j]&&w<=b[j]){mo+=m[j];break;}
      }
    }
    cout<<mo<<endl;  
}
return 0;
}

C++: //0160.cpp
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main() {
	vector<int>l;
	int n;
	int a, b, c, x;
	while (true){
		cin >> n;
		if (n == 0)break;
		int sum = 0;
		for (int i = 0; i < n; i++){
			cin >> a >> b >> c >> x;
			a += b;
			a += c;
			if (a <= 60 && x <= 2)
				sum += 600;
			else if (a <= 80 && x <= 5)
				sum += 800;
			else if (a <= 100 && x <= 10)
				sum += 1000;
			else if (a <= 120 && b <= 15)
				sum += 1200;
			else if (a <= 140 && b <= 20)
				sum += 1400;
			else if (a <= 160 && b <= 25)
				sum += 1600;
		}
		l.push_back(sum);
	}
	for (int i : l) {
		cout << i << endl;
	}
	cin >> c;
}

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

int Fee(int size, int weight)
{
  return (size <= 60 and weight <= 2) ? 600 :
         (size <= 80 and weight <= 5) ? 800 :
         (size <= 100 and weight <= 10) ? 1000 :
         (size <= 120 and weight <= 15) ? 1200 :
         (size <= 140 and weight <= 20) ? 1400 :
         (size <= 160 and weight <= 25) ? 1600 : 0;
}

int main(void)
{
  while (true)
  {
    int n;
    cin >> n;
    if (n == 0) break;

    int result = 0;
    for (int i = 0; i < n; ++i)
    {
      int x, y, h, weight;
      cin >> x >> y >> h >> weight;
      result += Fee(x + y + h, weight);
    }
    cout << result << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  int n;
  int a[6][3]={{60,2,600},{80,5,800},{100,10,1000},
               {120,15,1200},{140,20,1400},{160,25,1600}};
  while(1){
    cin>>n;
    if(n==0)break;
    int sum=0;
    rep(i,n){
      int x,y,h,w;
      cin>>x>>y>>h>>w;
      rep(j,6)
        if(x+y+h<=a[j][0] && w<=a[j][1]){
          sum+=a[j][2];
          break;
        }
    }
    cout<<sum<<endl;
  }
}

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

int n;
int fee[] = {600, 800, 1000, 1200, 1400, 1600};

int check(int l, int w)
{
    int a, b;
    if(l <= 60) a = 0;
    else if(l <= 80)  a = 1;
    else if(l <= 100) a = 2;
    else if(l <= 120) a = 3;
    else if(l <= 140) a = 4;
    else if(l <= 160) a = 5;
    else a = 6;

    if(w <= 2) b = 0;
    else if(w <= 5) b = 1;
    else if(w <= 10) b = 2;
    else if(w <= 15) b = 3;
    else if(w <= 20) b = 4;
    else if(w <= 25) b = 5;
    else  b = 6;

    return max(a, b);
}

int main()
{
    while(cin >> n && n) {
        int x,y,h,w,t,sum;
        sum = 0;
        for(int i = 0; i < n; i++) {
            cin >> x >> y >> h >> w;
            if((t = check(x + y + h, w)) == 6) {
                continue;
            }
            sum += fee[t];
        }
        cout << sum << endl;
    }
}