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 <stdio.h>
#include <algorithm>

int N, A[5000], B[5000], C[5000], D[5000];
int point[112][2], ans[112];

int main(void) {
	scanf("%d", &N);
	for (int i = 0; i < N*(N - 1) / 2; ++i) { scanf("%d%d%d%d", &A[i], &B[i], &C[i], &D[i]); }

	for (int i = 0; i < N*(N - 1) / 2; ++i) {
		if (C[i] < D[i]) { point[B[i] - 1][0] += 3; }
		if (C[i] > D[i]) { point[A[i] - 1][0] += 3; }
		if (C[i] == D[i]) { point[A[i] - 1][0]++; point[B[i] - 1][0]++; }
	}
	for (int i = 0; i < N; ++i) { point[i][1] = i + 1; }
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < N; ++j) {
			if (point[i][0] > point[j][0]) {
				std::swap(point[i][0], point[j][0]);
				std::swap(point[i][1], point[j][1]);
			}
		}
	}
	for (int i = 0; i < N; ++i) {
		if (point[i][0] == point[i + 1][0]) {
			ans[point[i][1] - 1] = i, ans[point[i + 1][1] - 1] = i; i++;
		}
		else { ans[point[i][1] - 1] = i; }
	}
	for (int i = 0; i < N; ++i) { printf("%d\n", ans[i] + 1); }
	return 0;
}

C++: #include <cstdio>
#include <map>
#include <algorithm>
#include <functional>
using namespace std;
typedef pair<int, int> P;
P po[100], res[100];
int main() {
    int n; scanf("%d",&n);
    for (int i=0; i<n; i++) {
        po[i].second=i;
        po[i].first=0;
    }
    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) {
            po[a-1].first+=3;
        } else if (c<d) {
            po[b-1].first+=3;
        } else {
            po[a-1].first++;
            po[b-1].first++;
        }
    }
    sort(po, po+n);
    int pos=1, cnt=0, bef=0;
    for (int i=n-1; i>=0; i--) {
        if (bef!=po[i].first) {
            pos+=cnt;
            res[i].first=po[i].second;
            res[i].second=pos;
            cnt=1; bef=po[i].first;
        } else {
            res[i].first=po[i].second;
            res[i].second=pos;
            cnt++;
        }
    }
    sort(res,res+n);
    for (int i=0; i<n; i++) printf("%d\n",res[i].second);
}

C++: #include<iostream>

using namespace std;

int main(){

    int N;
    int A,B,C,D;
    int sc[101]={0};
    int rank[101];
    int n;
    int max,mi;
    int c;

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

    n=0;
    while(n<N){
        max=sc[1],mi=1;
        for(int i=2;i<=N;i++){
            if(sc[i]>max){
                max=sc[i];
                mi=i;
            }
        }
        c=0;
        for(int i=1;i<=N;i++){
            if(sc[i]==max){
                sc[i]=-1;
                c++;
                rank[i]=n;
            }
        }
        n+=c;
    }

    for(int i=1;i<=N;i++){
        cout<<rank[i]<<endl;
    }

}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<cstdlib>
using namespace std;

struct aaa {
  int ten;
  int num;
  int jun;
};

int main() {
  int a;
  cin >> a;
  vector<aaa> b(a);
  for(int i = 0; i < a; i++) {
    b[i].ten = 0;
    b[i].num = i + 1;
  }
  int c, d, e, f;
  for(int i = 0; i < a * (a - 1) / 2; i++) {
    cin >> c >> d >> e >> f;
    if(e == f) {
      b[c - 1].ten++;
      b[d - 1].ten++;
    }else if(e < f) {
      b[d - 1].ten += 3;
    }else {
      b[c - 1].ten += 3;
    }
  }
  for(int i = 0; i < a; i++) {
    for(int j = 0; j < a - 1; j++) {
      if(b[j].ten < b[j + 1].ten) {
        swap(b[j], b[j + 1]);
      }
    }
  }
  int mai = 0, mae = -1;
  for(int i = 0; i < a; i++) {
    if(b[i].ten == mae) {
      mai++;
    }
    b[i].jun = i - mai + 1;
    mai = 0;
    mae = b[i].ten;
  }
  for(int i = 1; i < a + 1; i++) {
    for(int j = 0; j < a; j++) {
      if(b[j].num == i) {
        cout << b[j].jun << endl;
        break;
      }
    }
  }
}

C++: #include<stdio.h>

int main(void){
  int i,j,n,siai;
  int a,b,x,y,t1,t2;
  int t[150][3];
  scanf("%d",&n);
  for(i=0;i<150;i++){
     t[i][0]=0;//勝ち点
     t[i][1]=i;//チーム番号
	 t[i][2]=0;//順位
  }
  siai=n*(n-1)/2;
  for(i=0;i<siai;i++){
     scanf("%d %d %d %d",&a,&b,&x,&y);
     if(x>y)t[a][0]+=3;
     else if(x<y)t[b][0]+=3;
     else if(x==y){
              t[a][0]++;
              t[b][0]++;
     }
  }
   
  for(i=1;i<n;i++)
    for(j=i+1;j<n+1;j++){
       if(t[i][0]<t[j][0]){
          t1=t[i][0];
          t[i][0]=t[j][0];
          t[j][0]=t1;

		  t1=t[i][1];
          t[i][1]=t[j][1];
          t[j][1]=t1;
       }
    }
  t[1][2]=1;
  for(i=2;i<n+1;i++){
      t[i][2]=i;
	  if(t[i][0]==t[i-1][0]){t[i][2]=t[i-1][2];}
  }
  
  for(i=1;i<n;i++){
    for(j=i+1;j<n+1;j++){
       if(t[i][1]>t[j][1]){
          t1=t[i][1];
          t[i][1]=t[j][1];
          t[j][1]=t1;

		  t2=t[i][2];
          t[i][2]=t[j][2];
          t[j][2]=t2;
       }
    }
  }
  
  for(i=1;i<n+1;i++)
     printf("%d\n",t[i][2]);
  
  return 0;
}

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

typedef long long ll;

using namespace std;

int mo[4]={0,1,0,-1};

int main(){
    int n,p[100]={0},a,b,c,d,count=0,max_n,rank;
    
    scanf("%d",&n);
    
    for(int i=0;i<n*(n-1)/2;i++){
        scanf("%d%d%d%d",&a,&b,&c,&d);
        
        if(c==d){
            p[a-1]++;
            p[b-1]++;
        }else if(c>d){
            p[a-1]+=3;
        }else{
            p[b-1]+=3;
        }
    }
    
    while(count!=n){
        max_n=0;
        rank=count+1;
        for(int i=0;i<n;i++)
            max_n=max(max_n,p[i]);
        
        for(int i=0;i<n;i++)
            if(max_n==p[i]){
                p[i]=-rank;
                count++;
            }
    }
    
    for(int i=0;i<n;i++)
        printf("%d\n",-1*p[i]);
    
    return 0;
}