Problem:
Problem I:
A Piece of Cake
In the city, there are two pastry shops.  One shop was very popular because its cakes are pretty tasty.  
However, there was a man who is displeased at the shop.  He was an owner of another shop.  Although cause of his shop's unpopularity is incredibly awful taste of its cakes, he never improved it.  He was just growing hate, ill, envy, and jealousy.
Finally, he decided to vandalize the rival.
His vandalize is to mess up sales record of cakes. The rival shop sells
K
kinds of cakes and sales quantity is recorded for each kind. He calculates sum of sales quantities for all pairs of cakes. Getting
K
(
K
-1)/2 numbers, then he rearranges them randomly, and replace an original sales record with them.
An owner of the rival shop is bothered.  Could you write, at least, a program that finds total sales quantity of all cakes for the pitiful owner?
Input
Input file contains several data sets.
A single data set has following format:
K
c
1
c
2
...
c
K
×(
K
-1)/2
K
is an integer that denotes how many kinds of cakes are sold.
c
i
is an integer that denotes a number written on the card.
The end of input is denoted by a case where
K
= 0.  You should output nothing for this case.
Output
For each data set, output the total sales quantity in one line.
Constraints
Judge data contains at most 100 data sets.
2 ≤
K
≤ 100
0 ≤
c
i
≤ 100
Sample Input
2
2
3
5 4 3
0
Output for the Sample Input
2
6

Submitted solutions:

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

int main() {
	int k;
	while (cin >> k, k) {
		int sum = 0;
		rep(i, k*(k - 1) / 2) {
			int c; cin >> c; sum += c;
		}
		cout << sum / (k - 1) << endl;
	}
}
accuracy: 1
time_ms: 10
memory_kb: 3000
final_rank: 19

code_snippet: #include <iostream>
using namespace std;

int main(){
  int a,b,sum;
  while(1){
    cin>> a;
    if(a==0)break;
    sum=0;
    for(int i=0;i<a*(a-1)/2;i++){
      cin>>b;
      sum+=b;
    }
    cout << sum/(a-1) <<endl;
  }
  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 3

code_snippet: #include <iostream>

using namespace std;

int main()
{
  int k;
  int c;
  int sum;

  while (cin >> k && k != 0){
    int i = (k * (k - 1)) / 2;
    sum = 0;
    while (i--){
      cin >> c;
      sum += c;
    }
    cout << sum / (k - 1) << endl;
  }
}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 3

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

int main()
{
  int k;

  while (cin >> k, k){
    int sum = 0, n;
    n = k * (k - 1) / 2;

    for (int i = 0; i < n; i++){
      int num;
      cin >> num;
      sum += num;
    }
    cout << sum / (k - 1) << endl;
  }
}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 3

code_snippet: #include <iostream>
using namespace std;

int main() {
	int K;
	while (cin >> K, K) {
		int sum = 0;
		for (int i = 0; i < K * (K - 1) / 2; i++) {
			int c;
			cin >> c;
			sum += c;
		}
		cout << sum / (K - 1) << endl;
	}
	return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 3

code_snippet: #include<iostream>
#include<sstream>
#include<iomanip>
#include<stdlib.h>
#include<string>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<set>
#include<queue>
#include<stack>
#include<map>
#include<utility>
#include<algorithm>
#include<complex>
using namespace std;
#define loop(i,l,r) for(int (i)=(int)(l);(i)<(int)(r);(i)++)
#define rloop(i,l,r) for(int (i)=(int)(l);(i)>(int)(r);(i)--)
#define rep(i,n) loop(i,0,n)
#define rrep(i,n) rloop(i,n-1,-1)
#define INF 0x3f3f3f3f
#define mod 1000000007LL
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef complex<double> C;

vector<string> split(stringstream& ss){
	string str;
	vector<string> res;
	while(ss>>str)res.push_back(str);
	return res;
}

int main(){
		int n,d,res;
		while(1){
				cin>>n;
				if(n==0)break;
				res=0;
				rep(i,n*(n-1)/2){
						cin>>d;
						res+=d;
				}
				cout<<res/(n-1)<<endl;
		}
}
accuracy: 1
time_ms: 10
memory_kb: 1164
final_rank: 17

code_snippet: #include<iostream>
#include<stdio.h>
using namespace std;

int main(){
	while(1){
		int n,ans=0,a;
		cin>>n;
		if(n==0)break;
		ans=0;
		for (int i = 0; i < n * (n - 1) / 2; i++) {
				cin>>a;
				ans += a;
		}
		cout<<ans/(n-1)<<endl;
	}
    return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 3

code_snippet: #include<iostream>
#include<string>
using namespace std;
int main(){
	int k,c,s;
	while(true){
		cin>>k;
		if(k==0)
			break;
		s=0;
		for(int i=0;i<k*(k-1)/2;i++){
			cin>>c;
			s+=c;
		}
		cout<<s/(k-1)<<endl;
	}
	return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 3

code_snippet: #include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
 
using namespace std;
 
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) r.begin(),r.end()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
 
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1e9;



int main(){
	int k;
	while(cin>>k && k){
		int s = 0, t;
		rep(i, k*(k-1)/2) cin>>t, s += t;
		cout<<s/(k-1)<<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>

using namespace std;

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

#define PI 3.14159265358479

typedef long long ll;

int k;
int c, s;

int main(){
	while (cin >> k){
		if (k == 0)break;
		s = 0;
		REP(i, k*(k - 1) / 2){
			cin >> c;
			s += c;
		}
		cout << s / (k - 1) << endl;
	}
}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 3

code_snippet: #include <iostream>
using namespace std;
  
int main() {
int k;
while(cin >> k, k) {
int sum;
sum = 0;
for(int i = 0; i < k*(k-1)/2; i++) {
int a;
cin >> a;
sum += a;
}
cout << sum / (k-1) << endl;
}
}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 3

code_snippet: #include <iostream>
using namespace std;
int main(){
    int s,n,t,i;
    while(cin>>n&&n){
        s=0;
        for(i=0;i<n*(n-1)/2;i++){cin>>t;s+=t;}
        cout<<s/(n-1)<<endl;
    }
}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 3

code_snippet: #include <iostream>
using namespace std;
int main(){
    int s,n,t;
    while(cin>>n&&n){
        s=0;
        for(int i=0;i<n*(n-1)/2;i++){cin>>t;s+=t;}
        cout<<s/(n-1)<<endl;
    }
}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 3

code_snippet: #include <iostream>
using namespace std;
int main(){
    int n,t;
    while(cin>>n&&n){
        int s=0;
        for(int i=0;i<n*(n-1)/2;i++){cin>>t;s+=t;}
        cout<<s/(n-1)<<endl;
    }
}
accuracy: 1
time_ms: 20
memory_kb: 1160
final_rank: 20

code_snippet: #include <iostream>
using namespace std;
int main(){
    int s,n,i,t;
    while(cin>>n&&n){
        s=0;
        for(i=0;i<n*(n-1)/2;i++){cin>>t;s+=t;}
        cout<<s/(n-1)<<endl;
    }
}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 3

code_snippet: #include <iostream>
using namespace std;
int s,n,i,t;
int main(){
    while(cin>>n&&n){
        s=0;
        for(i=0;i<n*(n-1)/2;i++){cin>>t;s+=t;}
        cout<<s/(n-1)<<endl;
    }
}
accuracy: 1
time_ms: 10
memory_kb: 1164
final_rank: 17

code_snippet: #include<iostream>
using namespace std;
int n, a, sum;
int main() {
	while (true) {
		cin >> n; sum = 0; if (!n) { break; }
		for (int i = 0; i < (n - 1)*n / 2; i++) {
			cin >> a;
			sum += a;
		}
		cout << sum / (n - 1) << endl;
	}
}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 3

code_snippet: #include <bits/stdc++.h>
using namespace std;
int main(){
	while(true){
		int k;	cin>>k;
		if(k==0)	return 0;
		int n=k*(k-1)/2;
		int sum=0;
		for(int i=0;i<n;i++){
			int c;	cin>>c;
			sum+=c;
		}
		cout<<sum/(k-1)<<endl;
	}
}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 3

code_snippet: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){
	
	int K, n, sum;
	
	while(true){
		cin >> K;
		if(K == 0){
			break;
		}
		sum = 0;
		for(int i = 0; i < K * (K - 1) / 2; i++){
			cin >> n;
			sum += n;
		}
		sum /= (K - 1);
		printf("%d\n", sum);
	}
	
	return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 1144
final_rank: 1

code_snippet: #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <sstream>

#define rep(i, a) REP(i, 0, a)
#define REP(i, a, b) for(int i = a; i < b; ++i)
#define repll(i, a) REPLL(i, 0, a)
#define REPLL(i, a, b) for(ll i = a; i < b; ++i)

typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int, int> P;
typedef std::pair<P, int> PP;
const double PI = 3.14159265358979323846;
const double esp = 1e-9;
const int infi = (int)1e+9 + 10;
const ll infll = (ll)1e+17 + 10;

int k, sum = 0;

int main(){
	while (std::cin >> k, k){
		sum = 0;
		rep(i, k * (k - 1) / 2){
			int c;
			std::cin >> c;
			sum += c;
		}
		std::cout << sum / (k - 1) << std::endl;
	}
	return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 3