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 <bits/stdc++.h>
using namespace std;

using pii = pair<int, int>;

int main() {
    int N; cin >> N;
    vector<pii> score(N);
    for(int i = 0; i < N; ++i) {
        score[i].first = 0, score[i].second = i;
    }
    for(int i = 0; i < N * (N - 1) / 2; ++i) {
        int a, b, c, d; cin >> a >> b >> c >> d;
        if(c > d) {
            score[a - 1].first += 3;
        } else if(c == d) {
            score[a - 1].first++;
            score[b - 1].first++;
        } else {
            score[b - 1].first += 3;
        }
    }
    sort(rbegin(score), rend(score));
    
    vector<int> ans(N);
    for(int i = 0; i < N; ++i) {
        if(i != 0 && score[i].first == score[i - 1].first) {
            ans[score[i].second] = ans[score[i - 1].second];
        } else {
            ans[score[i].second] = i + 1;
        }
    }

    for(auto x : ans) {
        cout << x << endl;
    }
}

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

using namespace std;

int main(){
  int N,A,B,C,D;
  cin>>N;
  int t=N*(N-1)/2;
  vector<int> TP(N);

  for(int i=0;i<t;i++){
    cin>>A>>B>>C>>D;
    if(C>D){
      TP[A-1]+=3;
    }
    else if(C<D){
      TP[B-1]+=3;
    }
    else if (C==D){
      TP[A-1]++;
      TP[B-1]++;
    }
  }

  for(int i=0;i<N;i++){
    int g=1;
    for(int j=0;j<N;j++){
      if(TP[j]>TP[i])
        g++;
    }
    cout<<g<<endl;
  }
  
}

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

int main(){

  int a, b, c, d, i, j, cnt=1, n;
  int s[100]={ }, r[100];

  cin >> n;

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

  for (i=0; i<n; i++){
    for (j=0; j<n; j++){
      if (s[i]<s[j]) cnt++;
    }
    cout << cnt << endl;
    cnt=1;
  }

  return 0;
}

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

using namespace std;

int main()
{
	vector<int> s[301];
	int t[101] = {};
	int ans[101] = {};
	int n; scanf("%d", &n);

	for (int i = 0; i < n * (n - 1) / 2; ++i) {
		int a, b, c, d; scanf("%d%d%d%d", &a, &b, &c, &d);
		if (c > d)
			t[a] += 3;
		else if (d > c)
			t[b] += 3;
		else
			t[a] += 1, t[b] += 1;
	}

	for (int i = n; i >= 0; --i) s[t[i]].push_back(i);

	int r = 1;

	for (int i = 300; i >= 0; --i) {
		int cnt = 0;
		while (s[i].size()) {
			ans[s[i].back()] = r;
			s[i].pop_back();
			cnt++;
		}
		r += cnt;
	}

	for (int i = 1; i <= n; ++i) printf("%d\n", ans[i]);
}

C++: #include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;

int main(){
  int n;
  cin>>n;
  vector<pii>team;
  for(int j=0;j<n;j++) team.push_back(pii(0,j));
  for(int i=0;i<(n*(n-1))/2;i++){
    int ta,tb,sa,sb;
    cin>>ta>>tb>>sa>>sb;
    if(sa>sb){
      team[--ta].first+=3;
    }else if(sa<sb){
      team[--tb].first+=3;
    }else{
      team[--ta].first++;
      team[--tb].first++;
    }
  }
  sort(team.begin(),team.end());

  int ans[n];
  for(int i=0;i<team.size();i++){
    int cnt=0;
    if(team[i].first==team[i+1].first)cnt++;
    ans[team[i].second]=n-i-cnt;
  }
  for(int i:ans)cout << i << endl;
  return 0;
}

C++: using System;
using System.Linq;
class aoj
{
    static void Main()
    {
        int a = int.Parse(Console.ReadLine());
        int[] b = new int[a];
        for (int i = 0; i < a*(a-1)/2; i++)
        {
            int[] c = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            if (c[2] < c[3])
                b[c[1] - 1] += 3;
            else if (c[2] > c[3])
                b[c[0] - 1] += 3;
            else
            {
                b[c[0] - 1] += 1;
                b[c[1] - 1] += 1;
            }
        }
        int d = 0, e = 1, k = 0; 
        bool[] f = new bool[a];
        int[] g = new int[a];
        while(true)
        {
            int h = 0;
            d = 0;
            for (int i = 0; i < a; i++)
            {
                if (b[i] > d&&f[i]==false)
                    d = b[i];
            }
            for(int i = 0; i < a; i++)
            {
                if (b[i] >= d && f[i] == false)
                {
                    h++;
                    f[i] = true;
                    g[i] = e;k++;
                }
            }
            e += h;
            if (k == a) break;
        }
        foreach (int i in g)
            Console.WriteLine(i);
    }
}

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

int main(){
  int N;
  int p[100], order[100];
  int a,b,c,d;
  vector<int> v;

  cin >> N;
  for( int i=0;i<N;i++ ) p[i]=0;
  for( int i=0,len=N*(N-1)/2;i<len;i++ ){
    cin >>a >> b >> c >> d;
    //    cout << a<<b<<c<<d<<endl;
    a--; b--;
    if( c==d ){ // テつ暗δクテつづつォテつ陛つェテつづつッ
      p[a]++; p[b]++;
    }else if( c>d )
      p[a]+=3;
    else 
      p[b]+=3;
  }
  /*
  for( int i=0;i<N;i++ )
    cout << "p "<<p[i] << endl;    
  */
  for( int i=1;i<=N; ){ // テつ湘つつ暗δ甘つεつ凝つーテつプ
    //    cout << "No."<<i<<endl;
    v.clear();
    int max = -1;
    for( int j=0;j<N;j++ ){
      if( p[j]>max ){
	max=p[j];
	//	cout << " max="<<j<<endl;
	v.clear();
	v.push_back( j );
      } else if( p[j]==max ){
	v.push_back( j );
      }
    }
    for( int j=0;j<v.size();j++ ){
      order[v[j]] = i; p[v[j]] = -10;
    }
    i+=v.size();
  }
  for( int i=0;i<N;i++ )
    cout << order[i] << endl;
  

  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
    int team[100];
    for(int i=0;i<100;i++)team[i]=0;
    int n;
    cin>>n;
    int m=(n*(n-1))/2;
    for(int i=0;i<m;i++){
        int a,b,c,d;
        cin>>a>>b>>c>>d;
        if(c>d)team[a-1]+=3;
        else if(c==d){
            team[a-1]++;
            team[b-1]++;
        }
    }
    for(int i=0;i<n;i++)cout<<team[i]<<endl;
    return 0;
}

C++: #include<iostream>
using namespace std;
int main (void)
{
	int t[101];
	int p[101]={0};
	int n,pre;
	int ba[4];
	cin >> n;
	pre=n*(n-1)/2;
	for(int i=0;i<pre;i++)
	{
		cin >> ba[0] >> ba[1] >> ba[2] >> ba[3];
		if(ba[2]==ba[3])
		{
			p[ba[0]]++;
			p[ba[1]]++;
		}
		else if(ba[2]>ba[3])
		{
			p[ba[0]]+=3;
		}
		else
		{
			p[ba[1]]+=3;
		}
	}
	for(int i=1;i<=n;i++)
	{
		t[i]=1;
		for(int j=1;j<=n;j++)
		{
			if(i!=j)
			{
				if(p[i]<p[j])
				{
					t[i]++;
				}
			}
		}
			cout << t[i] << endl;
	}
	return 0;
}