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<algorithm>
using namespace std;
int main()
{
    int team[101],ans[101],dou[101],home,away,play,get1,get2,maxe;
    cin>>play;
    for(int i=1;i<=play;i++){
            team[i]=0;
            ans[i]=0;
            dou[i]=0;
    }
    maxe=play*(play-1)/2;
    for(int i=0;i<maxe;i++){
        cin>>home>>away>>get1>>get2;
        if(get1>get2)team[home]+=3;
        else if(get2>get1)team[away]+=3;
        else{
            team[home]++;
            team[away]++;
        }
    }
    home=-1;
    for(int i=1;i<=play;i++){
        for(int j=1;j<=play;j++){
            if(home<team[j]){
                    away=0;
                    home=team[j];
                    dou[away]=j;
                    away++;
            }
            else if(home==team[j]){
                dou[away]=j;
                away++;
            }
        }
        for(int j=0;j<away;j++){
               // cout<<dou[j]<<endl;
                ans[dou[j]]=i;
                team[dou[j]]=-1;
        }
        if(away!=1)i+=away-1;
        home=0;
    }
    for(int i=1;i<=play;i++){
        cout<<ans[i]<<endl;
    }
}

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

C++: #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
int main()
{
	int n;
	int point[101]={0};
	int p[101]={0};
	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)
		{
			point[a]++;
			point[b]++;
			p[a]++;
			p[b]++;
		}
		else if(c<d)
		{
			point[b]+=3;
			p[b]+=3;
		}
		else
		{
			point[a]+=3;
			p[a]+=3;
		}
	}
	sort(p,p+n+1,greater<int>());
	map<int,int> m;
	int k=1;
	int e=0;
	for(int i=1;i<=n;i++)
	{
		if(m.find(p[i])==m.end())
		{
			m[p[i]]=(k++)+e;
		}
		else
		{
			e++;
		}
	}
	for(int i=1;i<=n;i++)
	{
		cout << m[point[i]]+1 << endl;
	}
	return 0;
}

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]++;
    }
    printf("%d\n",rank[i]);
  }
  return(0);
}

C++: #include<iostream>
#include<map>
#include<algorithm>
using namespace std;
main(){
  pair<int,int> team[101]; //first=number second=point
  int n;
  int right,left,scorer,scorel;
  for(int i=1;i<=n;i++){
    team[i].first=i;
    team[i].second=0;
  } 
  while(cin>>right>>left>>scorer>>scorel){
    if(scorer==scorel){
      team[right].second=team[right].second+1;
      team[left].second=team[left].second+1;
    }
    else if(scorer>scorel){
      team[right].second=team[right].second+3;
    }
    else{
      team[left].second=team[left].second+3;
    }
  }
  sort(team,team+n);
  for(int i=1;i<=n;i++){
    cout<<team[i].second<<endl;
  }
}

C++: #include<iostream>
using namespace std;
int N, i, p, q, j, flg;
int GET[101][101], PNT[101], Order[101];
int main(){
    cin >> N;
    for (i=1; i<=N; i++) { PNT[i] = 0; Order[i]=1;}
    for (p=1; p<=N; p++) {
        for (q=1; q<=N; q++) {
            GET[p][q] = 9999;
        }
    }
    for (i=1; i<=(N*(N-1)/2); i++) {
        cin >> p >> q;
        cin  >> GET[p][q] >> GET[q][p];
    }
    for (p=1; p<=N; p++) {
        for (q=p+1; q<=N; q++) {
            if(p == q) { continue;}
            if (GET[p][q] > GET[q][p]) {
               PNT[p] += 3;
            } else {
                if (GET[p][q] > GET[q][p]) {
                PNT[q] += 3;
                } else {
                    PNT[p] += 1; PNT[q] += 1;
                }
            }
        }
     }
     for (p=1; p<=N; p++) {
         for (q=1; q<=N; q++) {
             if(PNT[p]<PNT[q]){Order[p]++;}
         }
     }
     for (i=1; i<=N; i++) {
         cout << Order[i] << endl;
     }
     return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int a,s,d,f,g,h[10001],i,j,z[10001];
	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]++;
		}
	}
	for(i=1;i<=a;i++){
		for(j=1;j<=a;j++){
			if(h[i]<h[j]){
				z[i]++;
			//	printf("z[%d]=%d\n",i,z[i]);
			}

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

C++: #include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;


int main() {
	int N;
	int A, B, C, D;
	pair<int,int>score[101] = {};
	cin >> N;
	for (int i = 0; i < 101; i++) score[i].second = i;
		for (int i = 0; i < (N*(N - 1) / 2); i++) {
		cin >> A >> B >> C >> D;
		if (C > D) {
			score[A].first+=3;
		}
		else if (C < D) {
			score[B].first+=3;
		}
		else {
			score[A].first++;
			score[B].first++;
		}
	}

	sort(score, score + 100);
	reverse(score, score + 100);

	int ans[100] = {};
	int tmp = 0;
	int s = 1;
	int num = 0;
	for (int i = 0; i < N; i++) {
		if (tmp != score[i].first) {
			num+=s;
			s = 1;
		}
		else {
			s++;
		}
		ans[score[i].second] = num;
		tmp = score[i].first;
	}

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