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<cstring>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int N;
int T[200];
int main(){
  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[b]+=3;
    else if(c > d) T[a]+=3;
    else{
      T[a]++;
      T[b]++;
    }
  }
  for(int i=1;i<=N;i++){
    int rank=1;
    for(int j=1;j<=N;j++){
      if(T[i] < T[j]) rank++;
    }
    printf("%d\n",rank);
  }
}

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

#define PI 4*atan(1);

int main(){
  int n, aa[1000] = {0};
  cin >> n;
  int a, b, c, d;
  map<int ,int> point, rank;
  for(int i = 0; i < n; i++){
    point[i] = 0;
  }
  for(int i = 0; i < n * (n - 1) / 2; i++){
    cin >> a >> b >> c >> d;
    if(c > d){
      point[a] += 3;
    }else if(c < d){
      point[b] += 3;
    }else{
      point[a]++;
      point[b]++;
    }
  }
  vector<int> v;
  for(int i = 1; i <= n; i++){
    int tmp;
    tmp = point[i];
    v.push_back(tmp);
  }
  sort(v.begin(), v.end(), greater<int>());
  for(int i = 0; i < n; i++){
    for(int j = 1; j <= n; j++){
      if(v[i] == point[j]){
        rank[j] = i + 1;
        point[j] = -1;
      }
    }
  }
  for(int i = 0; i < n; i++){
    cout << rank[i + 1] << endl;
  }
}

C++: #include<stdio.h>
int main(){
  int a[200]={};
  int b[200]={};
  int n,i,A,B,C,D,j;
  scanf("%d",&n);
  for(i=0;i<n*(n-1)/2;i++){
    scanf("%d%d%d%d",&A,&B,&C,&D);
    if(C>D){
      a[A]+=3;
    }
    else if(C<D){
      a[B]+=3;
    }
    else{
      a[A]++;
      a[B]++;
    }
  }
  for(i=1;i<=n;i++){
    b[i]=1;
    for(j=1;j<=n;j++){
      if(i!=j)
	if(a[i]<a[j])b[i]++;
    }
  }
  for(i=1;i<=n;i++){
    printf("%d\n",b[i]);
  }
  return 0;
}

C++: #include<iostream>
#include<vector>
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++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
	int n,teama,teamb,score[1001]={0},c,d,number[1001],kari[1001];
	cin>>n;
	for(int i=0;i<n*(n-1)/2;++i){
		cin>>teama>>teamb;
		cin>>c>>d;
		if(c>d){
			score[teama]+=3;
		}
		else if(c<d){
			score[teamb]+=3;
		}
		else{
			score[teama]+=1;
			score[teamb]+=1;
		}

	}
	int max=-1,memo;
	for(int j=1;j<=n;++j){
		for(int i=1;i<=n;++i){
			if(max<score[i]){
				max=score[i];
				memo=i;
			}
		}
		number[memo]=j;
		for(int k=1;k<=n;++k){
			if(memo==k){
				continue;
			}
			if(score[memo]==score[k]&&score[memo]!=-1&&score[k]!=-1){
				number[k]=j;
				score[k]=-1;
				++j;
			}
		}
		score[memo]=-1;
		max=-1;
	}
	
	for(int i=1;i<=n;++i){
		cout<<number[i]<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
 
using namespace std;
 
int main(){
    int n;
	int a[105],b[105],c[105],d[105];
	int t[11000],k[105];
	cin>>n;
	for(int i=0;i<(n*(n-1))/2;i++){
		cin>>a[i]>>b[i]>>c[i]>>d[i];
		t[i]=0;
	}
	for(int i=0;i<(n*(n-1))/2;i++){
		if(c[i]>d[i])
			t[a[i]]+=3;
		if(c[i]<d[i])
			t[b[i]]+=3;
		if(c[i]==d[i]){
			t[a[i]]++;
			t[b[i]]++;
		}
	}
	int j=1;
	int h=0;
	for(int g=n*3;g>=0;g--){
		for(int i=1;i<n+1;i++){
			if(g==t[i]){
				k[i]=j;
				h++;
			}
		}
		j+=h;
		h=0;
    }
	for(int i=1;i<n+1;i++){
		cout<<k[i]<<endl;
	}
    return 0;
}

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

typedef struct{
	int num;
	int p; //point
	int r; //rank
}team;

int main(){
	int n;
	team t[100];
	scanf(" %d", &n);
	
	for(int i=0; i<n; ++i){
		t[i].p=0;
		t[i].num=i;
	}
	
	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[b-1].p += 3;	
		else if(c>d) t[a-1].p += 3;	
		else{
			t[a-1].p += 1;
			t[b-1].p += 1;
		}
	}	
	
	for(int i=0; i<n; ++i){
		for(int j=i; j<n; ++j){
			if(t[i].p < t[j].p) swap(t[i], t[j]);		
		}
	}
	
	t[0].r=1;
	
	int now=1;
	int count=1;
	for(int i=0; i<n-1; ++i){
		if(t[i+1].p == t[i].p) count++;
		else{
			now+=count;
			count=1;
		}
		t[i+1].r=now;
	}
	
	for(int i=0; i<n; ++i){
		for(int j=i; j<n; ++j){
			if(t[i].num > t[j].num) swap(t[i], t[j]);		
		}
	}
	
	for(int i=0; i<n; ++i) printf("%d\n", t[i].r);
}

C++: #include<bits/stdc++.h>
using namespace std;
int sc[110],num[110],rank[110];
int main(){
  int N;
  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) sc[a-1]+=3;
    else if(c<d) sc[b-1]+=3;
    else{
      sc[a-1]++;
      sc[b-1]++;
    }
  }
  for(int i=0;i<N;++i) num[i]=i+1;
  for(int i=0;i<N;++i){
    for(int j=N-1;j!=i;--j){
      if(sc[i]<sc[j]){
	swap(num[i],num[j]);
	swap(sc[i],sc[j]);
      }
    }
  }
  int x=1;
  for(int i=0;i<N;++i){
    if(i>0&&sc[i]==sc[i-1]){
      rank[num[i]-1]=rank[num[i-1]-1];
      x++;
    }else rank[num[i]-1]=x++;
  }
  for(int i=0;i<N;++i) cout<<rank[i]<<endl;
  return 0;
}

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