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++: // 2012/12/10 Tazoe

#include <iostream>
using namespace std;

int main()
{
	int N;
	cin >> N;

	int P[101];
	for(int i=1; i<=N; i++){
		P[i] = 0;
	}

	for(int i=0; i<N*(N-1)/2; i++){
		int A, B, C, D;
		cin >> A >> B >> C >> D;

		if(C>D){
			P[A] += 3;
		}
		else if(C<D){
			P[B] += 3;
		}
		else{
			P[A] += 1;
			P[B] += 1;
		}
	}

	int R[101];
	for(int i=1; i<=N; i++){
		R[i] = 1;
	}

	for(int i=1; i<=N; i++){
		for(int j=1; j<=N; j++){
			if(P[i]<P[j]){
				R[i]++;
			}
		}
	}

	for(int i=1; i<=N; i++){
		cout << R[i] << '\n';
	}

	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
typedef struct subject{
  int points;
  int number;
}P;
int main(){
  int n;
  int a,b,c,d;
  P team[101];
  P temp;
  int cnt;
  cin >> n;
  for(int i=1;i<=n;i++){
    team[i].number=i;
    team[i].points=0;
  }
  for(int i=1;i<=((n*(n-1)/2));i++){
    cin >> a >> b >> c >> d;
    if(c==d){
      team[a].points++;
      team[b].points++;
    }if(c>d){
      team[a].points+=3;
    }if(c<d){
      team[b].points+=3;
    }
  }
  for(int i=1;i<=n;i++){
    cnt=1;
    for(int j=1;j<=n;j++){
      if(team[i].points<team[j].points){
	cnt++;
      }
    }
    team[i].number=cnt;
  }
  for(int i=1;i<=n;i++){
    cout << team[i].number << endl;
  }
  return 0;
}

C++: #include<stdio.h>
#include<map>
#include<algorithm>
using namespace std;
typedef pair<int,int> P;
P s[101];
int r[100];
int main(){
	int n;
	scanf("%d",&n);
	int i,j;
	for(i=0;i<n;i++)s[i]=P(0,i);
	for(i=0;i<n*(n-1)/2;i++){
		int a,b,c,d;
		scanf("%d %d %d %d",&a,&b,&c,&d);
		a--;b--;
		if(c>d)s[a].first+=3;
		if(c<d)s[b].first+=3;
		if(c==d){
			s[a].first+=1;
			s[b].first+=1;
		}
	}
	s[n]=P(-1,-1);
	sort(s,s+n);
	reverse(s,s+n);
	int p=0;
	int pr=0;
	while(p<n){
		r[s[p].second]=pr;
		while(s[p].first==s[p+1].first){
			p++;
			r[s[p].second]=pr;
		}
		p++;
		pr=p;
	}
	for(i=0;i<n;i++)printf("%d\n",r[i]+1);
	return 0;
}

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

int main()
{
    int n;
    cin >>n;
    int g=n*(n-1)/2;
    int a,b,c,d;
    vector<pair<int,int> > p(n);
    int x[n]={0};
    for(int i=0;i<g;i++){
        cin >>a>>b>>c>>d;
        if(c==d){
            x[a-1]++;
            x[b-1]++;
        }
        else if(c>d)x[a-1]+=3;
        else x[b-1]+=3;
    }
    for(int i=0;i<n;i++){
        p[i]=make_pair(x[i],i+1);
    }
    sort(p.rbegin(),p.rend());
    vector<pair<int,int> > q(n);
    for(int i=0;i<n;i++){
            int k=i;
            if(i==0){
            q[i]=make_pair(p[i].second,i+1);}
            else {
            while(k>=0){
                      if(p[k].first!=p[k-1].first)break;
                      k--;
                    }
            q[i]=make_pair(p[i].second,k+1);
            }
    }
    sort(q.begin(),q.end());
    for(int i=0;i<n;i++){
        cout << q[i].second<<endl;
    }

    return 0;


}

C++: #include <stdio.h>

struct
{
    int name;
    int score;
}team[101],forsort;

struct
{
    int name1;
    int name2;
    int score1;
    int score2;
}reader;

int i,j;
int runk[100];
int N;

int main()
{
    
    scanf("%d",&N);
    
    for(i=0;i<N;++i)
    {
        team[i].name=i;
    }
    
    for (i=1;i<(N*(N-1))/2;++i)
    {
        scanf("%d%d%d%d",&reader.name1,&reader.name2,&reader.score1,&reader.score2);
        if(reader.score1>reader.score2)
        {
            team[reader.name1-1].score+=3;
        }
        else if(reader.score1<reader.score2)
        {
            team[reader.name2-1].score+=3;
        }
        else
        {
            ++team[reader.name1-1].score;
            ++team[reader.name2-1].score;
        }
    }
    for(i=0;i<N-1;++i)
    {
        for(j=0;j<N-1;++j)
        {
            if(team[j].score<team[j].score)
            {
                forsort=team[j];
                team[j]=team[j+1];
                team[j+1]=forsort;
            }
        }
    }
    for(i=0;i<N-1;++i)
    {
        runk[team[i].name]=i+1;
        while(1)
        {
            if(team[i].score==team[i+1].score)
            {
                runk[team[i].name]=i+1;
                i++;
            }
            else break;
        }
    }
    
    for(i=0;i<N;++i)
    {
        printf("%d\n",runk[i]);
    }
    
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
int score[101];

int main(){
  int n;
  cin>>n;
  
  
  for(int i=0;i<n;i++)
    for(int j=i+1;j<n;j++){
      int a,b,c,d;
      cin>>a>>b>>c>>d;
      a--,b--;
      if(c>d) score[a]+=3;
      else if(c<d)score[b]+=3;
      else score[a]++,score[b]++;
    }

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

  return 0;
}

C++: //https://onlinejudge.u-aizu.ac.jp/challenges/sources/JOI/Prelim/0566?year=2012

#include <bits/stdc++.h>

using namespace std;

int main() {
    int n;
    cin >> n;

    vector<int> pt(static_cast<unsigned long>(n + 1));//各チームの得点
    for (int i = 0; i < n * (n - 1) / 2; ++i) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;

        if (c > d) {
            pt[a] += 3;
        } else if (c < d) {
            pt[b] += 3;
        } else if (c == d) {
            pt[a]++;
            pt[b]++;
        }
    }

    vector<int> vt;//順位計算用
    for (int i = 1; i <= n; ++i) {
        vt.emplace_back(pt[i]);
    }
    vt.emplace_back(100000);
    sort(vt.begin(), vt.end());

    for (int i = 1; i <= n; ++i) {
        auto tmp = upper_bound(vt.begin(), vt.end(), pt[i]);
        cout << n + 1 - (tmp - vt.begin()) << endl;
    }
    return 0;
}

/*
 *
 */