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 <iostream>
#include <math.h>
#include <string>
#include <stdio.h>
#include <string.h>
#include <algorithm>

using namespace std;

int main(void)
{
    int n, a[100],rank[100], b[100], c[100],d[100],k[100],win[100],lose[100],p[100],pp[100];
    cin >> n;

    for (int i = 0; i < n * (n - 1) / 2; i++)
    {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        if (c[i] < d[i])
        {
            win[i] = b[i];
            lose[i] = a[i];
            p[i] = 0;
            pp[i] = 0;
        }
        else if (c[i] > d[i])
        {
            win[i] = a[i];
            lose[i] = b[i];
            p[i] = 0;
            pp[i] = 0;
        }
        else if (c[i] == d[i])
        {
            win[i] = 0;
            lose[i] = 0;
            p[i] = a[i];
            pp[i] = b[i];
        }
    }

    for (int i = 0; i < n * (n - 1) / 2; i++)
    {
        for (int j = 1; j < n + 1; j++)
        {
            if (win[i] == j)
            {
                k[j] += 3;
            }
            if (lose[i] == j)
            {
                k[j] += 0;
            }
            if (p[i] == j || pp[i] == j)
            {
                k[j] += 1;
            }            

        }
    }

    for (int j = 1; j < n + 1; j++)
    {
        rank[j] = 1;
        for (int l = 1; l < n + 1; l++)
        {
            if (k[j] < k[l])
            {
                rank[j] += 1;
            }
        }
    }
    for (int j = 1; j < n + 1; j++)
    {
        cout << rank[j] << endl;
    }
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int p[1001],n,a,b,c,d;
pair<int,int>q[1001];
int main(){
	cin>>n;
	for(int i=0;i<n*(n-1)/2;i++){
		cin>>a>>b>>c>>d;
		if(c>d){p[a]+=3;}
		if(c==d){p[a]+=1;p[b]+=1;}
		if(c<d){p[b]+=3;}
	}
	for(int i=1;i<=n;i++){q[i]=make_pair(-p[i],i);}
	sort(q+1,q+n+1);int J=1;
	for(int i=1;i<=n;i++){
		if(i>=2 && q[i].first!=q[i-1].first)J=i;
		p[q[i].second]=J;
	}
	for(int i=1;i<=n;i++)cout<<p[i]<<endl;
	return 0;
}

C++: #include<stdio.h>
int main()
{
	int N,i,j,x[101]={},a,b,c,d;
	scanf("%d",&N);
	for(i=0;i<N*(N-1)/2;++i)
	{
		scanf("%d%d%d%d",&a,&b,&c,&d);
		if(c>d)x[a]+=3;else if(c<d)x[b]+=3;else x[a]++,x[b]++;
	}
	for(i=1;i<=N;printf("%d\n",a),++i)for(a=j=1;j<=N;++j)if(x[i]<x[j])++a;
	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
bool compare(const pair<int,int> a,const pair<int,int> b) {
    return a.first>b.first;
}
int main(){
    int n;
    cin>>n;
    pair<int,int> *team;
    team=new pair<int,int>[n+1];
    for(int i=1;i<=n;++i){
        team[i].first=0;
        team[i].second=i;
    }
    int a,b,c,d;
    for(int i=0,nmax=n*(n-1)/2;i<nmax;++i){
        cin>>a>>b>>c>>d;
        if(c<d){
            team[b].first+=3;
        }else if(c>d){
            team[a].first+=3;
        }else{
            ++team[a].first;
            ++team[b].first;
        }
    }
    sort(team+1,team+n+1,compare);
    int *win;
    win=new int[n+1];
    win[team[1].second]=1;
    for(int i=2;i<=n;++i) {
        if(team[i-1].first==team[i].first){
            win[team[i].second]=win[team[i-1].second];
        }else{
            win[team[i].second]=i;
        }
    }
    for(int i=1;i<=n;++i) {
        cout<<win[i]<<endl;
    }
    return 0;
}

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

int main(){

	int N;
	cin >> N;

	int league[100];
	for(int i=0;i<N;i++){
		league[i] = 0;
	}

	for(int i=0;i<N*(N-1)/2;i++){
		int Ai,Bi,Ci,Di;
		cin >>  Ai >> Bi >> Ci >> Di;
			if(Ci < Di){
				league[Bi-1] += 3;
			}

			else if(Ci > Di){
				league[Ai-1] += 3;
			}

			else{
				league[Ai-1]++;
				league[Bi-1]++;
			}
	}

	int sorted[100];
	for(int i=0;i<N;i++){
		sorted[i] = league[i];
	}

	sort(sorted,sorted+N);
	reverse(sorted,sorted+N);

	for(int i=0;i<N;i++){
		for(int j=0;j<N;j++){
			if(league[i] == sorted[j]){
				league[i] = j+1;
				break;
			}
		}
	}

	for(int i=0;i<N;i++){
		cout << league[i] << endl;
	}

	return 0;
}

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

int main() {
        const int LS = 5;
        int N;
        cin >> N;
        vector<int> T(N+1, 0);
        int t1, t2, g1, g2;
        int M = N*(N-1)/2;

        rep(m, M) {
                cin >> t1 >> t2 >> g1 >> g2;
                if (g1 == g2) {
                        T.at(t1) += 1;
                        T.at(t2) += 1;
                } else {
                        if (g1 > g2) {
                                T.at(t1) += 3;
                        } else {
                                T.at(t2) += 3;
                        }
                }
        }
        auto TS = T;
        sort(TS.begin(), TS.end(), greater<int>());

        for (int i = 1; i <= N; i++) {
                rep(n ,N) {
                        if (T.at(i) == TS.at(n)) {
                                cout << n + 1 << endl;
                                break;
                        }
                }
        }
        return 0;
}

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

using namespace std;

int main(){
	int n, a, b, c, d;
	int score[101];
	int pnt[101];
	fill_n(pnt, 101, 0);
	vector<pair<int, int> > v;
	cin >> n;
	for(int i = 0; i < n*(n-1)/2; i++){
		cin >> a >> b >> c >> d;
		if(c < d) pnt[b]++;
		else if(c > d) pnt[a]++;
		else pnt[b]++, pnt[a]++;
	}
	for(int i = 1; i <= n; i++){
		v.push_back(make_pair(pnt[i], i));
	}
	sort(v.begin(), v.end());
	int index = 0;
	int before = 0;
	int same = 0;
	for(int i = v.size() - 1; i >= 0; i--){
		if(v[i].first == before){
			same++;
			score[v[i].second] = index;
		}else{
			index += same + 1;
			score[v[i].second] = index;
			before = v[i].first;
			same = 0;
		}
	}

	for(int i = 1; i <= n; i++){
		cout << score[i] << endl;
	}

	return 0;
}

C++: #include<stdio.h>
#include<iostream>
using namespace std;
int main(void){
int n,i,j,a[1001],b[1001],c[1001],d[1001],p=0,team1[1001],result[1001],cnt=0,z=0;

cin>>n;

for(i=0;i<=1001;i++){
	a[i]=0;
	b[i]=0;
	c[i]=0;
	d[i]=0;
	team1[i]=0;
	result[i]=1;
}

p=n*(n-1)/2;

for(i=1;i<=p;i++){
	cin>>a[i]>>b[i]>>c[i]>>d[i];

	if(c[i]>d[i]){
	team1[a[i]]=team1[a[i]]+3;
	}

	else if(c[i]<d[i]){
	team1[b[i]]=team1[b[i]]+3;
	}

	else{
	team1[a[i]]=team1[a[i]]+1;
	team1[b[i]]=team1[b[i]]+1;
	}
}

for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
        if(team1[i]<team1[j]){
            result[i]=result[i]+1;
        }
    }
}
for(i=1;i<=n;i++){
    printf("%d\n",result[i]);
}

return 0;
}