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;
int main(){
  int n;
  cin >> n;
  int t1,t2,tt1,tt2;
  int kt[n+1];
  int kkt[n];
  int j=1,count=-1;
  int jb[n+1];
  /*int siran;
  siran = n*(n-1)/2;
  cout << siran << endl;*/
  for(int i=0;i<=n;i++) kt[i] = 0;
  for(int i=0;i<n*(n-1)/2;i++){
    cin >> t1 >> t2 >> tt1 >> tt2;
    if(tt1>tt2) kt[t1] += 3;
    else if(tt2>tt1) kt[t2] += 3;
    else{
      kt[t1] += 1;
      kt[t2] += 1;
    }
  }
  //for(int i=1;i<=n;i++) cout << kt[i] << endl; 
  for(int i=1;i<=n;i++) kkt[i-1] = kt[i];
  sort(kkt,kkt+n,greater<int>());
  for(int i=0;i<n;i++){
    for(int g=1;g<=n;g++){
      if(kkt[i]==kt[g]){
	jb[g] = j;
	count++;
      }
    }
    j += (count+1);
    i += count; 
    count = -1;
  }
  for(int i=1;i<=n;i++) cout << jb[i] << endl;
  return 0;
}

C++: #include<cstdio>
#include<vector>

using namespace std;

int n;

int team[101];

int main(){
	scanf("%d",&n);
	for(int g=0;g<n*(n-1)/2;g++){
		int at,bt,as,bs;
		scanf("%d %d %d %d",&at,&bt,&as,&bs);
		if(as == bs){
			team[at] += 1;
			team[bt] += 1;
		}else{
			team[as > bs ? at : bt] += 3;
		}
	}
	for(int t=1;t<=n;t++){
		int ans = 1;
		for(int i=1;i<=n;i++){
			if(t == i){continue;}
			if(team[i] > team[t]){
				ans++;
			}
		}
		printf("%d\n",ans);
	}
}

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

int main()
{
	int n, team1[100], team2[100], score1[100], score2[100], point[101] = {0};
	vector<int> rank;
	cin >> n;
	for(int i = 0; i < n * (n - 1) / 2; i++){
		cin >> team1[i] >> team2[i] >> score1[i] >> score2[i];
		if(score1[i] > score2[i])
			point[team1[i]] += 3;
		else if(score1[i] < score2[i])
			point[team2[i]] += 3;
		else{
			point[team1[i]]++;
			point[team2[i]]++;
		}
	}

	for(int i = 0; i < n; i++)
		rank.push_back(point[i + 1]);

	stable_sort(rank.begin(), rank.end(), greater<int>());

	for(int i = 1; i <= n; i++){
		for(int j = 0; j < n; j++){
			if(point[i] == rank[j]){
				cout << j + 1 << endl;
				break;
			}
		}
	}

	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int main(void) {
  int N;
  int T1, T2, P1, P2;
  int cnt[100]={0};
  int R = 0;
  int j = 0;
  while(cin >> N) {
    memset(cnt, 0, sizeof(cnt));
    for(int i = 0 ; i < N*(N-1)/2 ; i++) {
      cin >> T1 >> T2 >> P1 >> P2;
      if(P1 > P2) cnt[T1] += 3; 
      else if(P1 < P2) cnt[T2] += 3;
      else if(P1 == P2) { cnt[T1]++; cnt[T2]++; }	
    }
    /*for(int i = 1 ; i <= N ; i++) {
      cout << cnt[i] << ' ';
    }
    cout << endl;*/
    for(int i = 1 ; i <= N ; i++) {
      for(int j = 1 ; j <= N ; j++) {
	  if(cnt[i] < cnt[j]) R++;
      }
      cout << R+1 << endl;
      R = 0;
    }
    //cout << endl;
  }
  return 0;
}

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],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>
#include <algorithm>
using namespace std;

int main() {
  int n; cin >> n;
  int win[n];
  fill(win, win + n, 0);
  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) {
      win[a] += 3;
    }
    if(c == d) {
      win[a] += 1;
      win[b] += 1;
    }
    if(c < d) {
      win[b] += 3;
    }
  }
  for(int i = 0; i < n; i++) {
    int k = 0;
    for(int j = 0; j < n; j++) {
      if(win[j] > win[i]) k++;
    }
    cout << k + 1 << endl;
  }
}

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

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

    int score[101] = {};
    map<int,int> res, grade;

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

    for(int i = 0; i < n; i++)  res[score[i]]++;

    int now = 1;
    for(auto x = res.rbegin(); x != res.rend(); x++){
        grade[(*x).first] = now;
        now += (*x).second;
    }

    for(int i = 0; i < n; i++)  cout << grade[score[i]] << endl;

    return 0;
}

C++: #include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<string>
#include<vector>
#include<queue>

#define rep(i,j) for(int i=0;i<(j);i++)

using namespace std;

typedef pair<int,int> pii;

int main(){
	int n,a,b,c,d,r[100];
	scanf("%d",&n);
	rep(i,n)r[i]=0;
	rep(i,(n-1)*n/2){
		scanf("%d%d%d%d",&a,&b,&c,&d);
		a--;b--;
		if(c==d){
			r[a]++;
			r[b]++;
		}else if(c>d) r[a]+=3;
		else r[b]+=3;
	}
	vector<pii> v;
	rep(i,n)v.push_back(pii(r[i],i));
	sort(v.rbegin(),v.rend());
	int cnt = 0;
	rep(i,n){
		if(i>0 && v[i].first==v[i-1].first)cnt++;
		else cnt=0;
		r[v[i].second]=i+1-cnt;
	}
	rep(i,n)
		printf("%d\n",r[i]);
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main()
{
  int n, s[100], cop[100], rank[100];

  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){
      s[a-1]++; s[b-1]++;
    } else {
      (c>d?s[a-1]:s[b-1]) += 3;
    }
  }

  for (int i = 0; i < n; i++) cop[i] = s[i];
  sort(cop, cop + n);
  reverse(cop, cop + n);
  for (int i = n - 1; i >= 0; i--){
    rank[cop[i]] = i + 1;
  }

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

C++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int a,b,c,d,e,h[100];
vector<int> f,g;
int main() {
cin>>a;
for(int j=0;j<a;j++)f.push_back(0);
for(int i=0;i<a*(a-1)/2;i++){
cin>>b>>c>>d>>e;
if(d>e)f[b-1]+=3;else 
if(d<e)f[c-1]+=3;else{
f[b-1]++;f[c-1]++; }

}
g=f;
sort(g.begin(),g.end());
for(int k=0;k<a;k++){
for(int l=0;l<a;l++){
if(f[l]==g[k]){h[l]=a-k;}}
}
for(int m=0;m<a;m++){
cout<<h[m]<<endl;}
	return 0;
}