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<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
using namespace std;

int main(){
	int N;
	while(cin>>N,N){
		int ans = 0;
		for(int i=0;i<N;i++){
			int X,Y,H,W; cin>>X>>Y>>H>>W;
			int b = X+Y+H;
			if(b<=60 && W<=2) ans += 600;
			else if(b<=80 && W<=5) ans += 800;
			else if(b<=100 && W<=10) ans += 1000;
			else if(b<=20 && W<=15) ans += 1200;
			else if(b<=140 && W<=20) ans += 1400;
			else if(b<=160 && W<=25) ans += 1600;
		}
		printf("%d\n",ans);
	}
	return 0;
}

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(){
	int n,a,b,c,s,w;
	while(cin>>n,n){
		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;
	    }
	    cout<<p<<endl;
	}
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int main(){
  int a,b,c,d;
  int n;
  while(cin >> n,n){
    int sum = 0;
    for(int i = 0 ; i < n ; i++ ){
      cin >> a >> b >> c >> d;
      int m = a+b+c;
      if(m <= 60 && d <= 2){
	sum += 600;
      }else if(m <= 80 && d <= 5){
	sum += 800;
      }else if(m <= 100 && d <= 10){
	sum += 1000;
      }else if(m <= 120 && d <= 15){
	sum += 1200;
      }else if(m <= 140 && d <= 20){
	sum += 1400;
      }else if(m <= 160 && d <= 25){
	sum += 1600;
      }
    }
    cout << sum << endl;
  }
}

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

int main(){
  int n;
  int x,y,z,w,l;
  int total;
  int s1,s2;

  while(1){
    cin >> n;
    if(!n)break;

    total = 0;

    for(int i=0;i<n;i++){
      cin >> x >> y >> z >> w;
      l = x + y + z;
      if(l>160)s1 = 6;
      else if(l>140)s1 = 5;
      else if(l>120)s1 = 4;
      else if(l>100)s1 = 3;
      else if(l>80)s1 = 2;
      else if(l>60)s1 = 1;
      else s1 = 0;
      if(w>25)s2 = 6;
      else if(w>20)s2 = 5;
      else if(w>15)s2 = 4;
      else if(w>10)s2 = 3;
      else if(w>5)s2 = 2;
      else if(w>2)s2 = 1;
      else s2 = 0;

      if(s1<s2)s1 = s2;

      if(s1==0)total += 600;
      else if(s1==1)total += 800;
      else if(s1==2)total += 1000;
      else if(s1==3)total += 1200;
      else if(s1==4)total += 1400;
      else if(s1==5)total += 1600;
    }
    cout << total << endl;
  }
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("");
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = 1e9;
const double pi = acos(-1.0);

int re(int s, int w) {
	int ss[] = { 60,80,100,120,140,160,609 };
	int ww[] = { 2,5,10,15,20,25,209 };
	int mm[] = { 600,800,1000,1200,1400,1600,0 };

	int a1, a2;
	rep(i, 7) {
		if (ss[i] >= s) { a1 = i; break; }
	}
	rep(i, 7) {
		if (ww[i] >= w) { a2 = i; break; }
	}

	return mm[max(a1, a2)];
}

int main() {
	int n;
	while (cin >> n && n) {
		int ans = 0;
		rep(i, n) {
			int x, y, h, w; cin >> x >> y >> h >> w;
			ans += re(x + y + h, w);
		}
		Cout(ans);
	}
}

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

int main() {
  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;
      int size;
      size = x + y + h;
      vector<int> resultCandidits(2);
      resultCandidits[0] = (
          (size <= 60) ? 0 :
          (size <= 80) ? 1 :
          (size <= 100) ? 2 :
          (size <= 120) ? 3 :
          (size <= 140) ? 4 :
          (size <= 160) ? 5 :
          6
      );
      resultCandidits[1] = (
          (weight <= 2) ? 0 :
          (weight <= 5) ? 1 :
          (weight <= 10) ? 2 :
          (weight <= 15) ? 3 :
          (weight <= 20) ? 4 :
          (weight <= 25) ? 5 :
          6
      );
      int answers[] = {600, 800, 1000, 1200, 1400, 1600, 0};
      result += answers[max(resultCandidits[0], resultCandidits[1])];
    }
    cout << result << endl;
  }
  return 0;
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<cctype>
#include<iomanip>
#include<functional>
#include<numeric>
#include<map>
#include<set>
#include<complex>
#define EPS 1e-10
using namespace std;
typedef long long llong;
int x, y, h, w;
int judge_weight(int x, int y, int h, int w) {
	if (x + y + h <= 60 && w <= 2) return 600;
	else if (x + y + h <= 80 && w <= 5) return 800;
	else if (x + y + h <= 100 && w <= 10) return 1000;
	else if (x + y + h <= 120 && w <= 15) return 1200;
	else if (x + y + h <= 140 && w <= 20) return 1400;
	else if (x + y + h <= 160 && w <= 25) return 1600;
	else return 0;
}
int main() {
	int n;
	while (cin >> n&&n) {
		int sum = 0;
		for (int i = 0; i < n; i++) {
			cin >> x >> y >> h >> w;
			sum += judge_weight(x, y, h, w);
		}
		cout << sum << endl;
	}

	return 0;
}

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

int main(){
	long long int x,y,h,w,n,i,price;
	while(cin >> n && n){
		price = 0;
		for(i=0;i<n;i++){
			cin >> x >> y >> h >> w;
			if(x+y+h<=60&&w<=2) price += 600;
			else if(x+y+h<=80&&w<=5) price += 800;
			else if(x+y+h<=100&&w<=10) price += 1000;
			else if(x+y+h<=120&&w<=15) price += 1200;
			else if(x+y+h<=140&&w<=20) price += 1400;
			else if(x+y+h<=160&&w<=25) price += 1600;
		}
		cout << price << endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main()
{
  int n;
  int x,y,h,w;
  int a = 0;
 
  while(true){

       cin >> n;
	   if(n==0)
		   break;

	   int sum = 0;

       for(int i=0 ;i<n ;i++){
            cin >> x >> y >> h >> w;

             a = x + y + h ;

			 if(a<=60 && w<=2)
				 sum += 600;
			 else if(a<=80 && w<=5)
				 sum += 800;
			 else if(a<=100 && w<=10)
				 sum += 1000;
             else if(a<=120 && w<=15)
				 sum +=1200;
			 else if(a<=140 && w<=20)
				 sum += 1400;
             else if(a<=160 && w<=25)
				 sum += 1600;


	   }

	   cout << sum << endl;

 }
 return 0;
}