Problem:
宅配料金
ある宅配業者の宅配料金は大きさと重量で下表のように料金が設定されています。
A サイズ
B サイズ
C サイズ
D サイズ
E サイズ
F サイズ
大きさ
60cm以内
80cm以内
100cm以内
120cm以内
140cm以内
160cm以内
重さ
2kg以内
5kg以内
10kg以内
15kg以内
20kg以内
25kg以内
料金
600円
800円
1000円
1200円
1400円
1600円
大きさは三辺（縦、横、高さ）の和です。例えば大きさが120cmで、重さが15kg以内の荷物はＤサイズ（1,200円）となります。大きさが120cm以内でも、重さが15kgを超え、20kg以内ならばＥサイズとなります。
1日に持ち込まれた荷物の情報を入力とし、料金の総計を出力するプログラムを作成してください。なお、Ｆサイズを超えた荷物は対象外とし料金の総計には含みません。
Input
複数のデータセットの並びが入力として与えられます。入力の終わりはゼロひとつの行で示されます。
各データセットは以下の形式で与えられます。
n
x
1
y
1
h
1
w
1
x
2
y
2
h
2
w
2
:
x
n
y
n
h
n
w
n
１行目に荷物の個数
n
(1 ≤
n
≤ 10000)、続く
n
行に
i
番目の荷物の縦の長さ
x
i
、横の長さ
y
i
、高さ
h
i
、重さ
w
i
(1 ≤
x
i
,
y
i
,
h
i
,
w
i
≤ 200) が空白区切りで１行に与えられます。
データセットの数は 20 を超えません。
Output
データセットごとに荷物の料金の総計を１行に出力します。
Sample Input
2
50 25 5 5
80 60 10 30
3
10 15 25 24
5 8 12 5
30 30 30 18
0
Output for the Sample Input
800
3800

Submitted solutions:

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

int n, u, v;
double x, y, h, w;

int main() {
	cin >> n;

	while (n) {
		u = 0;

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

			int t = x + y + h;
			v = 0;

			if (t <= 160 && w <= 25) {
				if (t <= 60)
					v = 0;
				else if (t <= 80)
					v = 1;
				else if (t <= 100)
					v = 2;
				else if (t <= 120)
					v = 3;
				else if (t <= 140)
					v = 4;
				else
					v = 5;

				if (w <= 2) {
				}					
				else if (w <= 5) {
					if (v < 1)
						v = 1;
				}
				else if (w <= 10) {
					if (v < 2)
						v = 2;
				}
				else if (w <= 15) {
					if (v < 3)
						v = 3;
				}
				else if (w <= 20) {
					if (v < 4)
						v = 4;
				}
				else {
					if (v < 5)
						v = 5;
				}

				u += 600 + 200 * v;
			}
		}

		cout << u << endl;
		cin >> n;
	}
}
accuracy: 1
time_ms: 10
memory_kb: 3168
final_rank: 20

code_snippet: #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
//#define int long long
using namespace std;

signed main()
{
	int n;
	int x, y, h, w;

	while (true)
	{
		cin >> n;
		if (n == 0) break;
		int ans = 0;
		rep(i,n)
		{
			cin >> x >> y >> h >> w;
			int len = x + y + h;

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

		printf("%d\n", ans);
	}
}
accuracy: 1
time_ms: 10
memory_kb: 1144
final_rank: 1

code_snippet: #include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    while(cin>>n,n){
        int ans=0;
        for(int i=0,x,y,h,w;i<n;i++){
            cin>>x>>y>>h>>w;
            x+=y+h;
            if(x<=60&&w<=2)ans+=600;
            else if(x<=80&&w<=5)ans+=800;
            else if(x<=100&&w<=10)ans+=1000;
            else if(x<=120&&w<=15)ans+=1200;
            else if(x<=140&&w<=20)ans+=1400;
            else if(x<=160&&w<=25) ans+=1600;
        }
        cout<<ans<<endl;
    }
}
accuracy: 1
time_ms: 10
memory_kb: 1156
final_rank: 2

code_snippet: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

int n;
int x, y, h, w;

int main(){
	while (cin >> n&&n){
		int ans = 0;
		REP(i, n){
			cin >> x >> y >> h >> w;
			int size = x + y + h;
			if (size <= 60 && w <= 2) ans += 600;
			else if (size <= 80 && w <= 5) ans += 800;
			else if (size <= 100 && w <= 10) ans += 1000;
			else if (size <= 120 && w <= 15) ans += 1200;
			else if (size <= 140 && w <= 20) ans += 1400;
			else if (size <= 160 && w <= 25)ans += 1600;
		}
		cout << ans << endl;
	}
}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 5

code_snippet: #include<iostream>
#include<string>
using namespace std;
int main(){
	int n;
	while(true){
	cin>>n;
	if(n==0)
		break;
	int x,y,h,w;
	int ans=0;
	for(int u=0;u<n;u++){
		cin>>x>>y>>h>>w;
		int count=0;
		if(x+y+h<=160&&w<=25)
			count=1600;
		if(x+y+h<=140&&w<=20)
			count=1400;
		if(x+y+h<=120&&w<=15)
			count=1200;
		if(x+y+h<=100&&w<=10)
			count=1000;
		if(x+y+h<=80&&w<=5)
			count=800;
		if(x+y+h<=60&&w<=2)
			count=600;
		ans+=count;
	}
	cout<<ans<<endl;
	}
	return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 1156
final_rank: 2

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

int main()
{
  int n;
  while( cin >> n, n ) {
    int a, b, c, d;
    int sum = 0;

    while( n-- ) {
      int size = 0;
      cin >> a >> b >> c >> d;
      size += a + b + c;
      
      if( size <= 60 && d <= 2 ) {
	sum += 600;
      } 
      else if( size <= 80 && d <= 5 ) {
	sum += 800;
      }
      else if( size <= 100 && d <= 10 ) {
	sum += 1000;
      }
      else if( size <= 120 && d <= 15 ) {
	sum += 1200;
      }
      else if( size <= 140 && d <= 20 ) {
	sum += 1400;
      }
      else if( size <= 160 && d <= 25 ) {
	sum += 1600;
      }
    }

    cout << sum << endl;
  }

}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 5

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

int main(){
  int n;
  int S[]={60,80,100,120,140,160};
  int W[]={2,5,10,15,20,25};
  int M[]={600,800,1000,1200,1400,1600};
  while(cin >> n , n){
    int sum = 0;
    for(int i=0;i<n;i++){
      int x,y,h,w;
      cin >> x >> y >> h >> w;
      int size = x + y + h;
      if(size > 160 || w > 25) continue;
      for(int i=0;i<6;i++){
	if(size <= S[i] && w <= W[i]){
	  sum += M[i];
	  break;
	}
      }
    }
    cout << sum << endl;
  }
}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 5

code_snippet: // 0160
#include <iostream>
using namespace std;

int delivery_fee(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(){
	while(1){
		int n, x, y, h, w, price = 0;
		cin>>n;

		if(n == 0)
			break;

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

		cout<<price<<endl;
	}
	return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 5

code_snippet: #include <iostream>
using namespace std;

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

code_snippet: #include<iostream>
using namespace std;
int x, y, h, w, n, sum, z;
int a[7] = { 60,80,100,120,140,160,1000000000 };
int b[7] = { 2,5,10,15,20,25,1000000000 };
int c[7] = { 600,800,1000,1200,1400,1600,0 };
int main() {
	while (true) {
		cin >> n;
		if (n == 0) { break; }
		sum = 0;
		for (int i = 0; i < n; i++){
			cin >> x >> y >> h >> w;
			z = x + y + h;
			for (int j = 0; j < 7; j++) {
				if (z <= a[j] && w <= b[j]) { sum += c[j]; break; }
			}
		}
		cout << sum << endl;
	}
}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 5

code_snippet: #include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#include<map>
#include<stack>
#include<queue>
#include<algorithm>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    int n;
    while(cin >> n, n){
        int ans = 0;
        rep(i,n){
            int x, y, h, w;
            int size = 100, hevy = 100;
            cin >> x >> y >> h >> w;
            rep(i,6){
                int cm = 60 + 20 * i;
                if(x + y + h <= cm){
                    size = i;
                    break;
                }
            }
            rep(i,6){
                if(w <= 2){
                    hevy = 0;
                    break;
                }else if(w <= i * 5){
                    hevy = i;
                    break;
                }
            }
            int money = max(size, hevy) ;
            rep(i,6){
                if(money == 100) break;
                if(money == i){
                    ans+= 600 + 200 * i;
                    break;
                }
            }
        }
        cout << ans << endl;
    }
}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 5

code_snippet: #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const int IMAX=((1<<30)-1)*2+1;
const double EPS=1e-10;
//int mod=1000000007;


int p[3][7]={{160,140,120,100,80,60,0},
			{25,20,15,10,5,2,0},
			{0,1600,1400,1200,1000,800,600}
		};

int main(){
	int n,x,y,h,w;
	int b;
	int ans;
	while(cin>>n &&n>0){
		ans=0;
		rep(i,n){
			cin>>x>>y>>h>>w;
			b=x+y+h;
			rep(j,7){
				if(b>p[0][j]||w>p[1][j]){
					ans+=p[2][j];
					break;
				}
			}
		}
		cout<<ans<<endl;
	}
}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 5

code_snippet: #include <iostream>
using namespace std;

int main() {

  int n;
  int x,y,h,w;
  int r1[6] = {60,80,100,120,140,160};
  int r2[6] = {2,5,10,15,20,25};
  int r3[6] = {600,800,1000,1200,1400,1600};
  
  while(1){  
    cin >> n;
    if(n == 0) break;
    int sum = 0;
    
    for(int i=0;i<n;i++) {     

      cin >> x >> y >> h >> w;
      int size = x + y + h;
      
      for(int j=0;j<6;j++) {
	if(size <= r1[j] && w <= r2[j]){
	  sum += r3[j];
	  break;
	}
      }
     
    }

    cout << sum << endl;

  }

  return 0;

}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 5

code_snippet: #include "bits/stdc++.h"

using namespace std;

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

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back


int f(int x,int y,int z){
	int w=x+y+z;
	if(w<=60)return 600;
	if(w<=80)return 800;
	if(w<=100)return 1000;
	if(w<=120)return 1200;
	if(w<=140)return 1400;
	if(w<=160)return 1600;
	return 0;

}

int g(int w){
	if(w<=2)return 600;
	if(w<=5)return 800;
	if(w<=10)return 1000;
	if(w<=15)return 1200;
	if(w<=20)return 1400;
	if(w<=25)return 1600;
	return 0;
}

int main(){
	int n;
	while(cin>>n){
		if(n==0)break;
		int sum=0;
		rep(i,n){
			int x,y,z,w;
			cin>>x>>y>>z>>w;
			int F=f(x,y,z),G=g(w);
			if(F==0 || G==0)sum+=0;
			else sum+=max(F,G);
		}
		cout<<sum<<endl;
	}
}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 5

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

using namespace std;

typedef unsigned long long ull;
#define loop(i,a,b) for(int i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)
#define all(a) (a).begin(), (a).end()

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

int main(){
	int n;
	while(cin >> n, n){
		int ret = 0;
		for(int i=0; i < n; i++){
			int a, b, c, w;
			cin >> a >> b >> c >> w;
			int h = a + b + c;
			if(h <= 60 && w <= 2) ret += 600;
			else if(h <= 80 && w <= 5) ret += 800;
			else if(h <= 100 && w <= 10) ret += 1000;
			else if(h <= 120 && w <= 15) ret += 1200;
			else if(h <= 140 && w <= 20) ret += 1400;
			else if(h <= 160 && w <= 25) ret += 1600;
		}
		cout << ret << endl;
	}
}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 5

code_snippet: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define rp(a) while(a--)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int O[6]={60,80,100,120,140,160};
int W[6]={2,5,10,15,20,25};
int R[6]={600,800,1000,1200,1400,1600};
int main(){
	int n;
	while(cin>>n,n){
		int sum=0;
		rep(i,n){
			int a,b,c,w;
			cin>>a>>b>>c>>w;
			int o=a+b+c;
			rep(i,6)if(o<=O[i]&&w<=W[i]){sum+=R[i];break;}
		}
		cout<<sum<<endl;
	}
}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 5

code_snippet: #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;
}
accuracy: 1
time_ms: 10
memory_kb: 1188
final_rank: 18

code_snippet: #include <iostream>
using namespace std;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)

int main(){
    int n;
	int size[] = {0, 60, 80, 100, 120, 140, 160};
	int weight[] = {0, 2, 5, 10, 15, 20, 25};
	int cost[] = {600, 800, 1000, 1200,	1400, 1600, 0};
	while(cin >> n, n) {
		int ret = 0;
		rep(i,n) {
			int x, w, a = 0;
			rep(j,3) {
				cin >> x;
				a += x;
			}
			cin >> w;
			for(int j = 6; j >= 0; --j) { 
				if(size[j] < a) {
					ret += cost[j];
					break;
				}
				if(weight[j] < w) {
					ret += cost[j];
					break;
				}
			}
		}
		cout << ret << endl;
	}
    return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 5

code_snippet: #include<iostream>
#include<vector>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	vector<int> weight,length;
	long long n;
	while(1){
		cin>>n;
		if(n==0)break;
		rep(i,n){
			int x,y,h,w;
			cin>>x>>y>>h>>w;
			length.push_back(x+y+h);
			weight.push_back(w);
		}
		long long price=0;
		rep(i,weight.size()){
			int nl=length[i],nw=weight[i];
			if(nl>160 || nw>25){}
			else if(nl>140 || nw>20) price+=1600;
			else if(nl>120 || nw>15) price+=1400;
			else if(nl>100 || nw>10) price+=1200;
			else if(nl>80 || nw>5) price+=1000;
			else if(nl>60 || nw>2) price+=800;
			else price+=600;
		}
		cout<<price<<endl;
		while(!weight.empty()){
			weight.pop_back();
			length.pop_back();
		}
	}
	return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 1348
final_rank: 19

code_snippet: #include <iostream>
using namespace std;

int main(void){
  int n;
  while(cin >> n && n != 0){
    int x, y, h, w, fee = 0;
    for(int i = 0; i < n; i++){
      cin >> x >> y >> h >> w;
      int size = x + y + h;
      if(size <= 60 && w <= 2) fee += 600;
      else if(size <= 80 && w <= 5) fee += 800;
      else if(size <= 100 && w <= 10) fee += 1000;
      else if(size <= 120 && w <= 15) fee += 1200;
      else if(size <= 140 && w <= 20) fee += 1400;
      else if(size <= 160 && w <= 25) fee += 1600;
    }
    cout << fee << endl;
  }
  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 5