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 z[1000] = {0},n,a,b,c,d,x[1000] = {0},tmp,count = 0;
  cin >> n;
 
  for(int i=0;i<n*(n-1)/2;i++){
    cin >> a >> b >> c >> d;
 
    if(c > d) z[a-1] += 3;
    else if(d > c) z[b-1] += 3;
    else if(c == d){
 
      z[a-1]++;
      z[b-1]++;
 
    }
  }
 
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(z[i] < z[j]) count++;
    }
      x[i] = count;
      count = 0;
    }
  
  for(int i=0;i<n;i++) cout << x[i]+1 << endl;

}

C++: //
//  main.cpp

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;


int main(){	
	int n;
	int team[3][101];
	int point[3][101];
	int gets[101];
	for(int i = 0;i<3;i++)for(int j=0;j<101;j++)gets[j] = team[i][j] = point[i][j]= 0;
	
	cin >> n;
	for(int i=0;i<n*(n-1)/2;i++){
		cin >> team[0][i] >> team[1][i] >> point[0][i] >> point[1][i];
	}
	
	for(int i=0;i<n*(n-1)/2;i++){
		if(point[0][i] > point[1][i]){
			gets[team[0][i]] += 3;
		}else if(point[0][i] < point[1][i]){
			gets[team[1][i]] += 3;
		}else{
			gets[team[0][i]] += 1;
			gets[team[1][i]] += 1;
		}
	}
	
	vector<pair<int,int>>vec;
	for(int i=1;i<=n;i++){
		vec.push_back(make_pair(gets[i],i));//?????°?????????
	}
	sort(vec.begin(),vec.end());
	int answer[101]={};
	int memo = -1;
	int count = 0;
	for(int i=n-1;i>=0;i--){
		if(memo == vec[i].first){
			count ++;
		}else{
			memo = vec[i].first;
			count = 0;
		}
		answer[vec[i].second] = n - i - count;
	}
	for(int i=1;i<=n;i++){
		cout << answer[i] << endl;
	}
	
	return 0;
}

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

int main()
{

  int n;
  while(cin>>n){
    if( n == 0 ) break;

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

    vector<pair<int,int> > v;
    for(int i = 0; i < n; ++i){
      v.push_back( make_pair(score[i], i) );
    }
    sort(v.begin(), v.end());

    int rank[n];

    /*
    for(int i = 0; i < n; ++i){
      cout << score[i] << endl;
    }
    */
    
    for(int i = n-1; i >= 0; --i){
      rank[ v[i].second ] = n-1-i+1;
      if( i<n-1 && v[i].first == v[i+1].first){
        rank[ v[i].second ] = rank[ v[i+1].second ];
      }
    }
    
    for(int i = 0; i < n; ++i){
      cout << rank[i] << endl;
    }
    
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{

  int n;
  int box;
  int sum[105] = {};
  int a[5000],b[5000];
  int c[5000],d[5000];
  int max,temp;
  int rank[105];
  int count = 0;

  cin >> n;
  box = (n*(n-1))/2;

  for( int i=1;i<=box;i++ ) cin >> a[i] >> b[i] >> c[i] >> d[i];
 
  for( int i=1;i<=box;i++ ){
    if( c[i] == d[i] ){
      sum[a[i]]++;
      sum[b[i]]++;
    }
    else if( c[i] > d[i] ) sum[a[i]] += 3;
    else if( c[i] < d[i] ) sum[b[i]] += 3;
  }

  for( int i=1;i<=n;i++ ){
    rank[i] = 1;
    for( int j=1;j<=n;j++ ){
      if( sum[i] < sum[j] ) rank[i]++;
    }
  }

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

  return 0;

}

C++: #include<stdio.h>

int main(void){
  int i,j,n;
  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;//チーム番号
  }

  for(i=0;i<n*(n-1)/2;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 {
              t[a][0]++;
              t[b][0]++;
     }
  }
  
  for(i=1;i<n+1;i++)
    for(j=i;j<n+2;j++){
       if(t[i][0]>t[j][0]){
          t1=t[i][0];
          t[i][0]=t[j][0];
          t[j][0]=t[i][0];
          t1=t[i][1];
          t[i][1]=t[j][1];
          t[j][1]=t[i][1];
       }
    }

  for(i=1;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+1;i++)
    for(j=i;j<n+2;j++){
       if(t[i][1]<t[j][1]){
          t1=t[i][1];
          t[i][1]=t[j][1];
          t[j][1]=t[i][1];
       }
    }
  for(i=1;i<n+1;i++){
     printf("%d\n",t[i][3]);
  }
  return 0;
}

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

int main()
{
	int N;
	cin >> N;
	vector<int> sc(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) {
			sc[a] += 3;
		}
		else if (c < d) {
			sc[b] += 3;
		}
		else {
			sc[a] += 1;
			sc[b] += 1;
		}
	}
	const int MAX = 3e4;
	vector<vector<int>> mp(MAX + 1);
	for (int i = 0; i < N; i++) {
		mp[sc[i]].push_back(i);
	}
	vector<int> res(N);
	int sum = 0;
	for (int i = MAX; i >= 0; i--) {
		if (mp[i].empty()) continue;
		for (auto id : mp[i]) {
			res[id] = sum + 1;
		}
		sum += mp[i].size();
	}
	for (int i = 0; i < N; i++) {
		cout << res[i] << endl;
	}
	return 0;
}

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

int main(){
	int n,t1,t2,p1,p2,rank;
	int *wpts;
	
	cin >> n;
	wpts = new int[n+1];
	
	for(int i = 0; i < n; i++){
		wpts[i] = 0;
	}
	
	for(int i = 0; i < n * (n -1) / 2; i++){
		cin >> t1 >> t2 >> p1 >> p2;
		
		if(p1 > p2){
			wpts[t1-1] += 3;
		}else if (p1 < p2){
			wpts[t2-1] += 3;
		}else{
			wpts[t1-1]++;
			wpts[t2-1]++;
		}
	}
	
	for(int i = 0; i < n; i++){
		rank = 1;
		for(int j = 0; j < n; j++){
			rank += (wpts[i] < wpts[j]) ? 1 : 0;
		}
		cout << rank << endl;
	}
	
	return 0;
}

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

using namespace std;

int main()
{
	vector<pair<pair<int, int>, int> > team;
	int n, game[2][2], result[100];

	cin >> n;

	for(int i = 0; i < n; i++)
		team.push_back(make_pair(make_pair(0, i), 0));

	for(int i = 0; i < n * (n - 1) / 2; i++){
		cin >> game[0][0] >> game[0][1] >> game[1][0] >> game[1][1];

		if(game[1][0] > game[1][1])
			team[game[0][0]-1].first.first -= 3;
		else if(game[1][0] < game[1][1])
			team[game[0][1]-1].first.first -= 3;
		else{
			team[game[0][0]-1].first.first --;
			team[game[0][1]-1].first.first --;
		}
	}

	sort(team.begin(), team.end());

	for(int i = 1; i <= n; i++){
		team[i-1].second = i;
		if(i - 2 >= 0 && team[i-1].first.first == team[i-2].first.first)
			team[i-1].second --;
	}

	for(int i = 0; i < n; i++)
		result[team[i].first.second] = team[i].second;

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

	return 0;
}