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 <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define TO_STRING(a) #a
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }
template<class T> void MSG(T a){ cout << TO_STRING(a) << " = " << a << endl; }



int main()
{
	int n;
	cin >> n;
	
	vint score(n, 0);
	
	rep(i, n*(n-1)/2)
	{
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		
		score[a-1] += (c > d ? 3 :(c == d ? 1 : 0));
		score[b-1] += (c < d ? 3 :(c == d ? 1 : 0));
	}
	
	rep(print, n)
	{
		int rank = 1;
		rep(over, n)
		if(score[print] < score[over])
			rank++;
		
		cout << rank << endl;
	}
}

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<stdio.h>
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

int main(){
	int n;
	int T[105]={};
	int N=0;
	cin>>n;
	for(int i=0;i<n;i++)
		N+=i;
	//cout<<N;
	for(int I=0;I<N;I++){
	int A,B,C,D;
	cin>>A>>B>>C>>D;
	if(C<D){
		T[B]+=3;
	}
	else if(C>D)T[A]+=3;
	else{
		T[A]++;T[B]++;
	}
	}
//	cout<<N;
	int P[105]={};
	for(int i=0;i<102;i++)
	{	P[i]=T[i];
	//cout<<P[i]<<endl;
	}
	for(int i=1;i<=n;i++)
		for(int j=n;j>i;j--)
		{if(T[j]>T[j-1]){int t=T[j];T[j]=T[j-1];T[j-1]=t;}}

	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			{if(P[i]==T[j]){
				cout<<j<<endl;break;
		}}
		return 0;
}

C++: #error !
#include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;

int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};

int main(){
    int d, n; cin>>d>>n;
    vector<int> t(d);
    vector<int> a(n), b(n), c(n);
    for(int i=0; i<d; i++) cin>>t[i];
    for(int i=0; i<n; i++) cin>>a[i]>>b[i]>>c[i];

    vector<vector<ll>> dp(210, vector<ll>(210, -INF));

    for(int i=0; i<=100; i++){
        if(a[i]<=t[0] && t[0]<=b[i]) dp[0][i]=0;
    }

    for(int i=1; i<d; i++){
        for(int j=0; j<=100; j++){
            if(dp[i-1][j]<=-INF) continue;
            for(int k=0; k<n; k++){
                if(a[k]<=t[i] && t[i]<=b[k]){
                    dp[i][c[k]]=max(dp[i][c[k]], dp[i-1][j]+abs(c[k]-j));
                }
            }
        }
    }

    ll ans=0;
    for(int i=0; i<=100; i++){
        chmax(ans, dp[d-1][i]);
    }
    cout << ans << endl;
}

C++: #include<iostream>
using namespace std;
int main(){
	int n,a,b,c,d;
    cin >> n;

	int A[n];
	int B[n]; //n番目のチームの勝ち点


	for (int i=0; i<n; i++){
		A[i] = 0;
		B[i] = 0;
	}


	for(int i=0; i<n*(n-1)/2; i++){
		cin >> a >> b >> c >> d;
		if( c > d ){
			A[a] += 3;
			B[a] += 3;
		}
		if( c < d ){
			A[b] += 3;
			B[b] += 3;
		}
		if( c == d ){
			A[a] ++;
			A[b] ++;
			B[a] ++;
			B[b] ++;
		}
	}

	A.sort();
	A.reverse();

	int x = 0;

	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			x++;
			if(B[i] == A[j]){
				cout << x << endl;
				x = 0;
				break;
			}
			
		}
	}

	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int>in(n);
  rep(i,n*(n-1)/2){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    a--;b--;
    if(c==d){in[a]++;in[b]++;}
    else if(c>d)in[a]+=3;
    else in[b]+=3;
  }
  //rep(i,n)cout<<in[i]<<endl;
  int num=1;
  vector<int>out(n);
  while(1){
    int maxi=-1;
    rep(i,n)if(!out[i])maxi=max(maxi,in[i]);
    if(maxi==-1)break;
    int co=0;
    rep(i,n)if(maxi==in[i]){co++;out[i]=num;in[i]=-2;}
    num+=co;
  }
  rep(i,n)cout<<out[i]<<endl;
}