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>
#include <vector>
#include <list>
#include <map>
#include <string>
#include <functional>
#include <math.h>
#include <utility>
using namespace std;
typedef pair<int,int> P;
int n,rnk[101];
P p[100];
int main()
{
	cin>>n;
	for(int i=0;i<n;i++){
		p[i].first=0;
		p[i].second=i+1;
	}
	for(int i=0;i<n*(n-1)/2;i++){
		int a,b,c,d;cin>>a>>b>>c>>d;a--;b--;
		if(c!=d){
			p[c>d?a:b].first+=3;
		}else{
			p[a].first+=1;
			p[b].first+=1;
		}
	}
	sort(p,p+n,greater<P>());
	for(int i=1;i<=n;i++){
		int r=i;
		if(i!=1&&p[i-1].first==p[i-2].first)r=rnk[p[i-2].second];
		rnk[p[i-1].second]=r;
	}
	for(int i=1;i<=n;i++){
		cout<<rnk[i]<<endl;
	}
}

C++: #include <stdio.h>

int main(void) {
  int i, j, k, m, n;
  scanf("%d", &n);
  m = (n * (n - 1)) / 2;
  int s[n + 1], num[n + 1], l[n + 1], now = 1;
  for(i = 0; i <= n; ++i) s[i] = 0, num[i] = i;
  for(i = 0; i < m; ++i) {
    int a, b, c, d;
    scanf("%d%d%d%d", &a, &b, &c, &d);
    if(c > d) s[a] += 3;
    else if(d > c) s[b] += 3;
    else s[a]++, s[b]++;
  }
  for(i = 1; i <= n; ++i) {
    for(j = i + 1; j <= n; ++j) {
      if(s[i] < s[j]) {
        int t;
        t = s[i], s[i] = s[j], s[j] = t;
        t = num[i], num[i] = num[j], num[j] = t;
      }
    }
  }
  l[1] = 1;
  for(i = 2; i <= n; ++i) {
    if(s[i] == s[i - 1]) l[i] = now;
    else now = i, l[i] = i;
  }
  for(i = 1; i <= n; ++i) {
    for(j = i + 1; j <= n; ++j) {
      if(num[i] > num[j]) {
        int t;
        t = l[i], l[i] = l[j], l[j] = t;
        t = num[i], num[i] = num[j], num[j] = t;
      }
    }
  }
  for(i = 1; i <= n; ++i) printf("%d\n", l[i]);
  return 0;
}

C++: #include <string>
#include <vector>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<sstream>
#include<functional>
#include<map>
#include<set>
#include<cmath>

using namespace std;

int main(){

	int n;
	cin >> n;

	int a[n*(n-1)/2][4];
	for(int i=0;i<n*(n-1)/2;i++)
	cin >> a[i][0] >> a[i][1] >> a[i][2] >> a[i][3];

	vector<int>v(n,0);

    for(int i=0;i<n*(n-1)/2;i++){
	if(a[i][2]>a[i][3]) v[a[i][0]-1]+=3;
	if(a[i][2]==a[i][3]){ v[a[i][0]-1]+=1; v[a[i][1]-1]+=1; }
	if(a[i][2]<a[i][3]) v[a[i][1]-1]+=3;
    }

	vector<int>u;  u=v;

	sort(v.begin(),v.end(),greater<int>());

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

    return 0;

}

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

int S[100],R[100];
main(){
	int N,i=0,a,b,c,d;
	vector<pair<int,int> >v;
	scanf("%d",&N);
	for(;i<N*(N-1)/2;i++){scanf("%d%d%d%d",&a,&b,&c,&d);if(c==d)c=d=1;else if(c>d)c=3,d=0;else c=0,d=3;S[a-1]+=c,S[b-1]+=d;}
	for(i=0;i<N;i++)v.push_back(make_pair(S[i],i));
	sort(v.begin(),v.end(),greater<pair<int,int> >());
	for(R[v[0].second]=1,a=0,i=1;i<N;i++){if(v[i].first<v[a].first)a=i;R[v[i].second]=a+1;}
	for(i=0;i<N;i++)printf("%d\n",R[i]);
}

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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int n; scanf("%d",&n);
	int win[100]={}; // win[i] := ( チーム i の勝ち点 )
	rep(i,n*(n-1)/2){
		int a,b,c,d; scanf("%d%d%d%d",&a,&b,&c,&d); a--; b--;
		if(c>d) win[a]+=3;
		if(c<d) win[b]+=3;
		if(c==d) win[a]++, win[b]++;
	}

	int ans[100]={};
	for(int i=1;i<=n;){
		int win_max=-1;
		rep(j,n) if(ans[j]==0) win_max=max(win_max,win[j]);
		int cnt=0;
		rep(j,n) if(win[j]==win_max) ans[j]=i, cnt++;
		i+=cnt;
	}
	rep(i,n) printf("%d\n",ans[i]);

	return 0;
}

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

int main(){
	int n;
	int a[10000][4],point[1000],juni[1000],c,d;
	memset(point,0,sizeof(point));
	cin>>n;
	c=1;
	d=0;
	for(int i=0;i<(n*(n-1)/2);i++){
		cin>>a[i][0]>>a[i][1]>>a[i][2]>>a[i][3];
		if(a[i][2]>a[i][3]){
			point[a[i][0]] += 3;
		}
		else if(a[i][2]<a[i][3]){
			point[a[i][1]] += 3;
		}
		else{
			point[a[i][0]] += 1;
			point[a[i][1]] += 1;
		}
	}
	for(int i=0;i<2000;i++){
		for(int j=1;j<=n;j++){
			if(point[j]==(1999-i)){
				juni[j]=c;
				d++;
			}
		}
		c += d;
		d=0;
	}
	for(int i=1;i<=n;i++){
		cout<<juni[i]<<endl;
	}
	getchar();
	getchar();
	return 0;
}

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