Go: package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextLineInt() []int {
	arr := strings.Split(nextLine(), " ")
	var ret []int
	for _, v := range arr {
		x, _ := strconv.Atoi(v)
		ret = append(ret, x)
	}
	return ret
}

type Pair struct {
	First int
	Second int
}

type Pairs []Pair

func (s Pairs) Len() int {
	return len(s)
}

func (s Pairs) Swap(i, j int) {
	s[i], s[j] = s[j], s[i]
}

func (s Pairs) Less(i, j int) bool {
	return s[i].First > s[j].First
}

func main() {
	var n int
	arr := nextLineInt()
	n = arr[0]
	result := []Pair{}
	for i := 0; i < n; i++ {
		result = append(result, Pair{0, i})
	}
	for i := 0; i < n * (n - 1) / 2; i++ {
		arr := nextLineInt()
		A := arr[0]
		B := arr[1]
		C := arr[2]
		D := arr[3]
		if C > D {
			result[A-1].First += 3
		} else if C < D {
			result[B-1].First += 3
		} else {
			result[A-1].First++
			result[B-1].First++
		}
	}
	sort.Sort(Pairs(result))
	var ans [111]int
	point := 1000000000
	top := 0
	for i, r := range result {
		// 前の人よりポイントが低い
		if point > r.First {
			top = i + 1
			point = r.First
		}
		ans[r.Second] = top
	}
	for i := 0; i < n; i++ {
		fmt.Println(ans[i])
	}
}

C++: #include<stdio.h>
int main(void)
{
	int a,s,d,f,g,h[100],i,j,z[100];
	scanf("%d",&a);
	for(i=1;i<=a;i++){
		z[i]=1;
		//printf("%d\n",z[4]);
	}
//	printf("%d\n",z[4]);
	for(i=1;i<=a*(a-1)/2;i++){
		h[i]=0;
	}
	for(i=1;i<=a*(a-1)/2;i++){
		scanf("%d %d %d %d",&s,&d,&f,&g);
		if(f<g){
			h[d]=h[d]+3;
		}
		else if(f>g){
			h[s]=h[s]+3;
		}
		else if(f==g){
			h[d]++;
			h[s]++;
		}
	}
//	printf("%d\n",z[4]);
	for(i=1;i<=a;i++){
		for(j=1;j<=a;j++){
			if(h[i]<h[j]){
				z[i]=z[i]+1;
			//	printf("z[%d]=%d\n",i,z[i]);
			}

		}
	}
	for(i=1;i<=a;i++){
		printf("%d\n",z[i]);
	}
	return 0;
}

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

map<int,int>data;

int main(){
	int n;
	cin>>n;
	for(int i=0;i<n*(n-1)/2;i++){
		int a,b,c,d;
		cin>>a>>b>>c>>d;
		if(c>d)data[a]+=3;
		else if(c<d)data[b]+=3;
		else {
			data[a]+=1;
			data[b]+=1;
		}
	}
	map<int,int>ans;
	int c=1;
	while(!data.empty()){
		int ma=0;
		int count=0;
		for(map<int,int>::iterator itr=data.begin();itr!=data.end();itr++){
			if(itr->second>ma)ma=itr->second;
		}
		for(map<int,int>::iterator itr=data.begin();itr!=data.end();itr++){
			
			if(itr->second==ma){
				ans[itr->first]=c;
				data.erase(itr);
				count++;
			}
		}
		c+=count;
	}
	for(map<int,int>::iterator itr=ans.begin();itr!=ans.end();itr++){
		cout<<(itr->second)<<endl;
	}
}

C++: //情報オリンピック2011予選2「サッカー」
#include<stdio.h>

int main(void)
{
	int n, a, b, c, d, f1, f2, **teampoint;
	
	scanf("%d",&n);
	teampoint = new int *[n];
	
	for(f1 = 0; f1 < n; f1++){
		teampoint[f1] = new int [2];
		teampoint[f1][0] = 0;
	}
	
	for(f1 = 1; f1 <= n*(n-1)/2; f1++){
	
		scanf("%d %d %d %d",&a,&b,&c,&d);
		a--;b--;
		//対戦結果の勝ち点計算
		if(c > d)
			teampoint[a][0]+=3;
			
		else if(c < d)
			teampoint[b][0]+=3;
			
		else{
			teampoint[a][0]++;
			teampoint[b][0]++;
		}
		
	}
	//順位付け初期設定
	for(f1 = 0; f1 < n; f1++)
		teampoint[f1][1] = 1;
	//順位付け
	for(f1 = 0; f1 < n-1; f1++){
		for(f2 = f1+1; f2 < n; f2++){
			if(teampoint[f1][0] > teampoint[f2][0])
				teampoint[f2][1]++;
			else if(teampoint[f1][0] < teampoint[f2][0])
				teampoint[f1][1]++;
		}
	}
	
	for(f1 = 0; f1 < n; f1++)
		printf("%d\n",teampoint[f1][1]);
		
	return 0;
}

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

using namespace std;

int main(){
	int n;
	cin >> n;
	double count = n*(n-1)/2.0;
	int point[n] = {0}, temp[n], temp2[n], temp3[n], x = 1, y = 0;
	for (int i = 0; i <count; i++){
		int a, b, c, d;
		scanf("%d%d%d%d", &a, &b, &c, &d);
		if (c == d){
			point[a-1]++;
			point[b-1]++;
		}else if (c > d){
			point[a-1] += 3;
		}else {
			point[b-1] += 3;
		}
	}
	for (int i = 0; i < n; i++){
		temp[i] = point[i];
	}
	sort(temp, temp+n);
	for (int i = 0; i < n; i++){
		temp2[i] = temp[n-1-i];
	}
	for (int i = 0; i < n; i++){
		temp[i] = temp2[i];
	}
	for (int i = 0; i < n; i++){
		if (temp[i] == temp[i+1]){
			temp2[i] = x;
			y++;
		}else {
			x += y;
			y = 0;
			temp2[i] = x;
			x++;
		}
	}
	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++){
			if (point[i] == temp[j]){
				temp3[i] = temp2[j];
				break;
			}
		}
	}
	for (int i = 0; i < n; i++)
		printf("%d\n",temp3[i]);
	return 0;
}

C++: #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

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 a, b, c, d;
int sum[110];
int r[110];

int main(){
	cin >> n;
	REP(i, n*(n - 1) / 2){
		cin >> a >> b >> c >> d;
		if (c > d) sum[a] += 3;
		else if (c < d)sum[b] += 3;
		else{
			sum[a]++;
			sum[b]++;
		}
	}
	REP(i, n){
		r[i + 1] = 1;
		REP(j, n){
			if (i == j)continue;
			if (sum[i + 1] < sum[j + 1]){
				r[i + 1]++;
			}
		}
	}
	REP(i, n){
		cout << r[i + 1] << endl;
	}
}

C++: #include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define pb(a) push_back(a)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
using namespace std;

typedef struct{
    int team, point ,result;
}team;

void sort2(team t[105], int n){
    rep(i,n){
        rep(j,n - 1){
            if(t[j].team > t[j + 1].team){
                team temp = t[j];
                t[j] = t[j + 1];
                t[j + 1] = temp;
            }
        }
    }
}

void sort(team t[105], int n){
    rep(i,n){
        rep(j,n - 1){
            if(t[j].point < t[j + 1].point){
                team temp = t[j];
                t[j] = t[j + 1];
                t[j + 1] = temp;
            }
        }
    }
}

int main(){
    int n;
    team t[105];
    rep(i,105){
        t[i].team = i;
        t[i].point = 0;
    }
    t[0].point = -1;
    cin >> n;
    rep(i, n * (n - 1) / 2){
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        if(c > d){
            t[a].point+=3;
        }else if(c < d){
            t[b].point+=3;
        }else{
            t[a].point++;
            t[b].point++;
        }
    }
    sort(t,n + 1);
    int j = 1;
    rep(i,n + 1){
        if(i && t[i - 1].point != t[i].point) j = i + 1;
        t[i].result = j;
    }
    sort2(t, n + 1);
    range(i,1,n + 1){
        cout << t[i].result << endl;
    }
}

C++: #include <iostream>

using namespace std;

int main(void){
  int i,j,k,l;
  int n;
  int t1,t2;
  int p1,p2;
  int win[200]={0};
  int rank[200];

  cin>>n;
  for(i=0;i<n*(n-1)/2;i++){
    cin>>t1>>t2>>p1>>p2;

    if(p1>p2){
      win[t1-1]+=3;
    }
    else if(p1<p2){
      win[t2-1]+=3;
    }
    else{
      win[t1-1]++;
      win[t2-1]++;
    }
  }

  for(i=0;i<n;i++){
    rank[i]=1;
    for(j=0;j<n;j++){
      if(win[i]<win[j])rank[i]++;
    }
    cout<<rank[i]<<endl;
  }
  return(0);
}