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 <vector>
#include <algorithm>
using namespace std;
int main(void){

	int N, point1, point2, team1, team2;
	cin >> N;
	int score[N], rank[N];
	vector<int> log;
	for(int i = 0; i < N; i++){
		score[i] = 0;
		rank[i] = 0;
	}

	for(int i = 0; i < (N*(N-1))/2; i++){
		cin >> team1 >> team2 >> point1 >> point2;
		if(point1 == point2){
			score[team1-1]++;
			score[team2-1]++;
		}else if(point1 < point2){
			score[team2-1] += 3;
		}else if(point1 > point2){
			score[team1-1] += 3;
		}
	}
	for(int i = 0; i < N; i++){
		log.push_back( score[i] );
	}
	sort(log.begin(), log.end(),greater<int>());

	for(int i = 0; i < N; i++){
		if(i > 0 && log[i] == log[i-1]){continue;}
		for(int j = 0; j < N; j++){
			if(log[i] >= score[j]){
				rank[j]++;
			}
		}
	}
	for(int i = 0; i < N; i++){
		cout << rank[i] << endl;
	}

	return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n;
	cin >> n;

	map<int ,int> mp;

	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) mp[a] += 3;
		else if(c < d) mp[b] += 3;
		else if(c == d){
			mp[a]++; mp[b]++;
		}
	}

	vector<P> t1(n);

	for (int i = 0;i < n;i++){
		t1[i] = P(mp[i],i);
	}

	sort(t1.begin(),t1.end());
	reverse(t1.begin(),t1.end());

	vector<int> t2(n);

	for (int i = 0;i < n;i++){
		t2[t1[i].second] = i+1;
		if(i!=0){
			if(t1[i-1].first == t1[i].first) t2[t1[i].second] = t2[t1[i-1].second];
		}
	}

	for (int i = 0;i < n;i++){
		cout << t2[i] << endl;	
	}

	return 0;

}

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

int main() {
  int n;
  cin >> n;
  int count[n + 1];
  int rank[n + 1];

  for (int i = 0; i < n + 1; i++) {
    count[i] = 0;
  }

  int game = n * (n - 1) / 2;
  for (int i = 0; i < game; i++) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (c > d) {
      count[a] += 3;
    } else if (c < d) {
      count[b] += 3;
    } else {
      count[a]++;
      count[b]++;
    }
  }

  int r = 1;
  while (r <= n) {
    int maxi, maxip[n], maxinum;
    for (int i = 0; i < n; i++) {
      maxip[i] = 0;
    }
    maxi = count[1];
    maxip[0] = 1;
    maxinum = 1;
    for (int i = 2; i < n + 1; i++) {
      if (count[i] == maxi) {
	maxip[maxinum] = i;
	maxinum++;
      } else if (count[i] > maxi) {
	maxi = count[i];
	maxip[0] = i;
	for (int j = 1; j < n; j++) {
	  maxip[j] = 0;
	}
	maxinum = 1;
      }
    }

    for (int i = 0; i < maxinum; i++) {
      rank[maxip[i]] = r;
      count[maxip[i]] = 0;
    }
    r += maxinum;
  }

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

  return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	vector<int> p(n), v(n);
	rep(i, n*(n-1)/2) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;

		int e = 0, f = 0;
		if(c == d) {
			e = 1;
			f = 1;
		} else if(c > d) {
			e = 3;
		} else {
			f = 3;
		}

		p[a-1] += e;
		p[b-1] += f;
		v[a-1] += e;
		v[b-1] += f;
	}

	sort(v.begin(), v.end(), greater<int>());

	rep(i, n) {
		rep(j, v.size()) {
			if(p[i] != v[j]) continue;
			cout << j + 1 << endl;
			break;
		}
	}

	return 0;
}

C++: #include<stdio.h>
int main() {
	int hideo = 0, ruio = 0, masatoy = 0, nagase = 0, a[101] = { 0 }, p[101] = { 0 };
	int temp = 0, max[101] = { 0 }, sum = 1, text = 0;
	scanf("%d", &hideo);
	for (int i = 1; i <= hideo*(hideo - 1) / 2; i++) {
		scanf("%d %d %d %d", &a[1], &a[2], &a[3], &a[4]);
		if (a[3] > a[4]) {
			p[a[1]] += 3;
		}
		else if (a[4] > a[3]) {
			p[a[2]] += 3;
		}
		else {
			p[a[1]]++;
			p[a[2]]++;
		}
	}
	for (int i = 1; i <= hideo; i++) {
		for (int i = 1; i <= hideo; i++) {
			if (temp < p[i]) {
				temp = p[i];
			}
		}
		for (int i = 1; i <= hideo; i++) {
			if (temp == p[i]) {
				max[i] = sum;
				text++;
				p[i] = -1;
			}
		}
		sum += text;
		temp = 0;
		text = 0;
	}
	for (int i = 1; i <= hideo; i++) {
		printf("%d\n", max[i]);
	}
}

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

typedef queue<int> Que;
int team[101], a, b, c, d, rank[101], k[101];
int n;
int main(){
  int tmp, l = 0, p = 1;
  Que q;
  cin >> n;
  for(int i = 0; i < n * (n - 1) / 2; i++){
    cin >> a >> b >> c >> d;
    if(c > d) team[a - 1] += 3;
    else if(c < d) team[b - 1] += 3;
    else team[a - 1]++, team[b - 1]++;
  }
  for(int i = 0; i < n; i++){
    k[i] = team[i];
  } 
  sort(k, k + n);
  reverse(k, k + n);
  tmp = k[0];
  q.push(tmp);
  for(int i = 1 ; i < n; i++){
    if(tmp == k[i]) continue;
    q.push(k[i]);
    tmp = k[i];
  }
  while(!q.empty()){
    int u = q.front();
    q.pop();
    for(int i = 0; i < n; i++){
      if(team[i] == u){
	rank[i] = p;
	l++;
      }
    }
    if(l > 1)  p += l - 1, l = 0;
    else p++;
  }
  for(int i = 0; i < n; i++) cout << rank[i] << endl;
}

C++: #include<stdio.h>
#include<iostream>
using namespace std;
int main(void){
int n,i,j,a[1001],b[1001],c[1001],d[1001],p=0,team1[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;
	result[i]=1;
}

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++){
    for(j=1;j<=n;j++){
        if(team1[i]<team1[j]){
            result[i]=result[i]+1;
        }
    }
}
for(i=1;i<=n;i++){
    printf("%d\n",result[i]);
}

return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define NMAX 100
int n;
int rank[NMAX+1];
class Data{
public:
	int p;
	int No;
	Data(int _p,int _No):p(_p),No(_No){

	}
	bool operator < (const Data &o)const{
		return p > o.p;
	}
};

int main(){
	cin>>n;
	int limit=(n*(n-1))/2;
	int a,b,c,d;
	vector<Data> v;
	for(int i=1;i<=n;i++)
		v.push_back(Data(0,i));
	for(int i=0;i<limit;i++){
		cin>>a>>b>>c>>d;
		v[a-1].p+=c>d?3:c==d?1:0;
		v[b-1].p+=c<d?3:c==d?1:0;
	}
	sort(v.begin(),v.end());
	int r=0;
	int p=v.begin()->p+1;
	int t=0;
	for(vector<Data>::iterator it=v.begin();it!=v.end();it++){
//		cout<<(*it).No<<":"<<(*it).p<<":"<<p<<endl;
		if((*it).p<p){r+=t+1;p=(*it).p;t=0;}
		else if((*it).p==p){t++;}
		rank[(*it).No]=r;
	}
	for(int i=1;i<=n;i++){
		cout<<rank[i]<<endl;
	}
	return 0;
}