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 <iostream>
#include <algorithm>

using namespace std;

struct Team {
    int id;
    int score;

    Team() {}
    bool operator <(const Team &other) const {
        return other.score < score; // Reversed order
    }
} teams[100];
int rank_of[100];

int main() {
    int N;
    cin >> N;
    for(int i = 0; i < N; ++i) {
        teams[i].id = i;
    }
    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) {
            teams[a].score += 1;
            teams[b].score += 1;
        }
        else if(c < d) {
            teams[b].score += 3;
        }
        else if(c > d) {
            teams[a].score += 3;
        }
    }

    sort(teams, teams+N);
    int rank = 1;
    int prevscore = teams[0].score;
    for(int i = 0; i < N; ++i) {
        if(teams[i].score < prevscore) rank = i+1;
        rank_of[teams[i].id] = rank;
        prevscore = teams[i].score;
    }
    for(int i = 0; i < N; ++i) {
        cout << rank_of[i] << endl;
    }
    return 0;
}

C++: #include<stdio.h>
int main(){
	int n,a,b,c,d,i,i2,p[100],m[100],t,l,r[100],aaa;
	scanf("%d",&n);
	for(i=0;i<=n;i++){
		p[i]=0;
		m[i]=0;
	}
	while(m[1]<n-1||m[2]<n-1||m[3]<n-1||m[4]<n-1){
		scanf("%d%d",&a,&b);
		m[a]++;
		m[b]++;
		scanf("%d%d",&c,&d);
		if(c>d){
			p[a]+=3;
		}
		else if(c<d){
			p[b]+=3;
		}
		else{
			p[a]++;
			p[b]++;
		}
	}
	for(i=1;i<=n;i++){
		m[i]=i;
	}
	for(i=1;i<=n;i++){
		for(i2=1;i2<=n;i2++){
			if(p[i]>p[i2]){
				t=p[i];
				p[i]=p[i2];
				p[i2]=t;
				t=m[i];
				m[i]=m[i2];
				m[i2]=t;
			}
		}
	}
	/*for(i=1;i<=n;i++){
		printf("%d %d\n",m[i],p[i]);
	}*/
	l=1;
	aaa=0;
	for(i=1;i<=n;i++){
		r[m[i]]=l;
		if(p[i]==p[i+1]){
			aaa++;
		}
		else{
			l=l+aaa+1;
			aaa=0;
		}
	}
	for(i=1;i<=n;i++){
		printf("%d\n",r[i]);
	}
}

C++: #include<bits/stdc++.h>

using namespace std;

int t[110];

int main()
{
    int n,a,b,ta,tb;
    cin >> n;
    for(int i = 1;i <= n * (n - 1)/2;i++){
        cin >> a >> b >> ta >> tb;
        if(ta > tb)t[a] += 3;
        if(ta < tb)t[b] += 3;
        if(ta == tb){
            t[a]++;
            t[b]++;
        }
    }
    for(int i = 1;i <= n;i++){
            int cnt = 1;
            for(int j = 1;j <= n + 1;j++){
                if(t[i] < t[j])cnt++;
            }
    cout << cnt << endl;
        }

    return 0;
}

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

C++: #include <iostream>
#include <functional>
#include <algorithm>
#include <cstring>
#include <map>
#define fr first
#define sc second
using namespace std;

int main(){
  typedef pair<int,int> P;
  int n,a,b,ap,bp,prev;
  P rank[101],tmp[101];
  memset(rank,0,sizeof(rank));
  cin >> n;
  for(int i=0;i<n*(n-1)/2;i++){
    cin >> a >> b >> ap >> bp;
    if(ap == bp){ rank[a].fr++; rank[b].fr++;}
    else if(ap > bp) rank[a].fr += 3;
    else rank[b].fr += 3;
  }
  copy(rank+1,rank+n+1,tmp);
  sort(rank+1,rank+n+1,greater<P>());
  prev = rank[1].fr; int r_p = 1;
  for(int i=1;i<=n;i++){
    if(prev == rank[i].fr) rank[i].sc = r_p;
    else{ rank[i].sc = i;  r_p = i; }
    prev = rank[i].fr;
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<=n;j++){
      if(tmp[i+1].fr == rank[j+1].fr){ cout << rank[i+1].sc << endl; break;}
    }
  }
}

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

int N;
std::pair<int, int> point[100];
int rank[100];

int main()
{
	std::cin >> N;
	for( int i = 0; i != N * ( N - 1 ) / 2; ++i )
	{
		int A, B, C, D;
		std::cin >> A >> B >> C >> D;
		
		if( C == D )
			++point[A-1].first, ++point[B-1].first;
		else if( C > D )
			point[A-1].first += 3;
		else
			point[B-1].first += 3;
	}

	for( int i = 0; i != N; ++i )
		point[i].second = i;

	std::sort( point, point + N, std::greater<std::pair<int, int> >() );

	int r = 0;
	for( int i = 0; i != N; ++i )
	{
		if( i - 1 >= 0 && point[i-1].first == point[i].first )
			++r;
		else 
			r = 0;

		rank[point[i].second] = i + 1 - r;
	}

	for( int i = 0; i != N; ++i )
		std::cout << rank[i] << std::endl;

	return 0;
}

C++: #include <iostream>
#include <cstdlib>

using namespace std;

typedef struct rec {

  int team;
  int point;

} record;

int comp(const void* a,const void* b) {

  record t1=*(record*)a;
  record t2=*(record*)b;

  return t2.point-t1.point;

}

int main() {

  int n;
  int a,b,c,d;

  record rec[101];
  int rank;
  

  cin >> n;

  for(int i=0;i<=100;i++) {

    rec[i].team=i;

    rec[i].point=0;

  }

  for(int i=0;i<n*(n-1)/2;i++) {

    cin >> a >> b >> c >> d;

    if(c==d) {

      rec[a].point++;

      rec[b].point++;

    }

    else if(c<d) rec[b].point+=3;

    else rec[a].point+=3;

  }

  //for(int i=1;i<=n;i++) cout << rec[i].point << endl;

  //qsort(rec,n,sizeof(rec[0]),comp);

  //for(int i=1;i<=n;i++) cout << rec[i].team << endl;

  for(int i=1;i<=n;i++) {

    rank=n;

    for(int j=1;j<=n;j++) {

      if(rec[i].point>=rec[j].point && i!=j) rank--;

    }

    cout << rank << endl;

  }

  return 0;

}

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

int main(){
    int n;
    cin >> n;
    vector<pair<int,int> > v;
    map<int,int> m;
    for(int i=0;i<n;i++){
        v.push_back(make_pair(0,i+1));
    }

    for(int i=0;i<n*(n-1)/2;i++){
        int a,b,c,d;
        cin >> a >> b >> c >> d;

        if(c > d){
            v[a-1].first += 3;
        }else if(c < d){
            v[b-1].first += 3;
        }else{
            v[a-1].first += 1;
            v[b-1].first += 1;
        }
    }
    sort(v.rbegin(), v.rend());
    int pos=1;
    int cnt=0;
    int point;
    for(int i=0;i<n;i++){
        if(i != 0){
            if(point != v[i].first){
                pos++;
                pos += cnt;
                cnt = 0;
            }else{
                cnt++;
            }
        }       
        m[v[i].second] = pos;
        point = v[i].first;
    }

    map<int,int>::iterator it = m.begin();

    while(it != m.end()){
        cout << (*it).second << endl;
        ++it;
    }
}