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;

int main() {
  int n, a, b, c, d;;
  cin >> n;
  int win_point[n] = {};
  int i, j;
  for (i = 0; i < (n * (n - 1) / 2); i++) {
    cin >> a >> b >> c >> d;
    if (c == d) {
      win_point[a - 1]++;
      win_point[b - 1]++;
    } else if (c < d) {
      win_point[b - 1] += 3;
    } else {
      win_point[a - 1] += 3;
    }
  }
  int result[n] = {};
  int m1_point = 0, m1_index = 0;
  for (i = 0; i < n; i++) {
    int point = 0, index = 0;
    for (j = 0; j < n; j++) {
      if (point < win_point[j]) {
        point = win_point[j];
        index = j;
      }
    }
    if (m1_point == win_point[index]) {
      result[index] = result[m1_index];
    } else {
      result[index] = i + 1;
    }
    m1_point = win_point[index];
    m1_index = index;
    win_point[index] = 0;
  }
  for (i = 0; i < n; i++) {
    cout << result[i] << endl;
  }
  return 0;
}

C++: #include <stdio.h>
int main(){
  int n,i,j;
     scanf("%d",&n);
       j = n*(n-1);
      int team[100],score[100],a,b,c,d,e;
        for(i=0;i<j/2;i++){
          scanf("%d%d%d%d",&a,&b,&c,&d);
           if(c>d){
             team[a] += 3;
            }else if(c<d){
              team[b] += 3;
            }else{
              team[a] += 1;
              team[b] += 1;
            }
            }
            for(e=0;e<100;e++){
           score[e] = team[e]
}
            int x;
            for(i=1;i<n;i++){
              for(j=1;j<n;j++){
                if(team[j]<team[j+1]){
                  x = team[j+1];
                    team[j+1] =team[j];
                       team[j] = x;
                         }
                           }
                              }
            int k,l,up;
            for(k=0;k<n;k++){
              for(l=0;l<n;l++){
                if(team[k]<team[l]){
                up += 1;
                         }
                           }
              k = up+1;
                              }
             for(e=0;e<100;e++){
                for(f=0;f<100;f++){
           if(score[e] ==team[f]){
              printf("%d\n",f);
}
}
}
return 0;
}

C++: #include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<functional>
using namespace std;
int main(){
	int score[100]={0};
	int n;
	cin>>n;
	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)score[b]+=3;
		else if(c>d)score[a]+=3;
		else{
			score[a]++;
			score[b]++;
		}
	}
	vector<int> v(score,score+n);
	sort(v.begin(),v.end(),greater<int>());
	for(int i=0;i<n;i++){
		cout<<lower_bound(v.begin(),v.end(),score[i],greater<int>())-v.begin()+1<<endl;
	}
	return 0;
}

C++: #include<stdio.h>
#include<iostream>
using namespace std;
int main(void){
long long n,i,j,a[1001],b[1001],c[1001],d[1001],p=0,team1[1001],team2[1001],team3[1001],result[1001],cnt=0,z=0;

cin>>n;

for(i=0;i<=1001;i++){
	a[i]=0;
	b[i]=0;
	c[i]=0;
	d[i]=0;
	team1[i]=0;
	team2[i]=0;
	team3[i]=0;
	result[i]=0;
}

p=n*(n-1)/2;

for(i=1;i<=p;i++){
	cin>>a[i]>>b[i]>>c[i]>>d[i];

	if(c[i]>d[i]){
	team1[a[i]]=team1[a[i]]+3;
	}

	else if(c[i]<d[i]){
	team1[b[i]]=team1[b[i]]+3;
	}

	else{
	team1[a[i]]=team1[a[i]]+1;
	team1[b[i]]=team1[b[i]]+1;
	}


}
for(i=1;i<=n;i++){
team2[i]=team1[i];
}
for(i=1;i<=n;i++){
    for(j=i+1;j<=n;j++){
	if(team1[i]<=team1[j]){
	z=team1[i];
	team1[i]=team1[j];
	team1[j]=z;
	}
    }
}
for(i=1;i<=n;i++){
	for(j=1;j<=n;j++){
		if(team1[i]==team2[j]){
		team3[j]=i;
		team2[j]=-1;
		}
	}
}
for(i=1;i<=n;i++){
printf("%d\n",team3[i]);
}
return 0;
}

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

C++: #include <iostream>
#include<algorithm>
using namespace std;
int g[100],jyunni[100];
int n;
void katimake(int a,int b,int c,int d){
	if(c>d){g[a-1]+=3;}
	else if(d>c){g[b-1]+=3;}
	else{
		g[a-1]++;
		g[b-1]++;
	}
	}
int main() {
	cin>>n;
	for(int i = 0;i<100;i++){
		g[i]=0;
	}
	int p,q,r,s;
	while(cin>>p>>q>>r>>s){katimake(p,q,r,s);}
	int jyu = 1;
	int saidai=0;
	for(int i= 0;i<n;i++){saidai=max(saidai,g[i]);}
	for(int p=saidai;saidai>=0;saidai--){
		int y=0;
		for(int i =0;i<n;i++){
		if(g[i]==saidai){
			jyunni[i]=jyu;
			y++;
			}
		}
		jyu+=y;
	}
	for(int i = 0;i<n;i++){
		cout<<jyunni[i]<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int s[101],k[101];
int main()
{
	int i,j,n,m,a,b,a1,b1,q;
	cin>>n;
	for(i=1;i<=(n*(n-1))/2;i++)
	{
		cin>>a>>b>>a1>>b1;
		if(a1>b1)s[a]+=3;
		else if(b1>a1)s[b]+=3;
		else if(a1==b1)
		{
			s[a]++;
			s[b]++;
		}
	}
	for(i=1;i<=n;i++)
	{
		q=1;
		for(j=1;j<=n;j++)
		{
			if(s[i]<s[j])q++;	
		}
		k[i]=q;
	}
	for(i=1;i<=n;i++)cout<<k[i]<<endl;
	return 0;
}

C++: #include<iostream>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;
typedef pair<int,int> P;
typedef long long int ll;

int main(){
	int n;
	cin >> n;
	int cou[101]={0};
	for(int i=0;i<n*(n-1)/2;i++){
		int a,b,c,d;
		cin >> a >> b >> c >> d;
		if(c > d) cou[a]+=3;
		else if(c < d) cou[b]+=3;
		else {
			cou[a]++;
			cou[b]++;
		}
	}
	P score[101];
	for(int i=1;i<=n;i++){
		P p; p.first=cou[i]; p.second=i;
		score[i-1] = p;
	}
	sort(score,score+n,greater<P>() );
	int rank[101]={0};
	for(int i=0;i<n;i++){
		if(i!=0&&score[i].first==score[i-1].first){
			rank[score[i].second] = rank[score[i-1].second];
		}
		else rank[score[i].second] = i+1;
	}
	for(int i=1;i<=n;i++){
		cout << rank[i] << endl;
	}
}

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

map<int,int>data;

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)data[a]+=3;
		else if(c<d)data[b]+=3;
		else {
			data[a]+=1;
			data[b]+=1;
		}
	}
	map<int,int>ans;
	int c=1;
	int cc=0;
	while(cc!=data.size()){
		int ma=0;
		int count=0;
		for(map<int,int>::iterator itr=data.begin();itr!=data.end();itr++){
			if(itr->second>ma)ma=itr->second;
		}
		for(map<int,int>::iterator itr=data.begin();itr!=data.end();itr++){
			
			if(itr->second==ma){
				ans[itr->first]=c;
				cc++;
				itr->second=-5;
				count++;
			}
		}
		c+=count;
	}
	for(map<int,int>::iterator itr=ans.begin();itr!=ans.end();itr++){
		cout<<(itr->second)<<endl;
	}
}