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 <bits/stdc++.h>
using namespace std;

const int vecx[]={0,1,0,-1};
const int vecy[]={1,0,-1,0};
int r;

vector<int> bfs(int w,int h,int sx,int sy,vector<vector<int>> &m){
    vector<vector<bool>> visited(h+2,vector<bool>(w+2,false));
    for (int i = 0; i < h+2; ++i) {
        if(i==0||i==h+1){
            for (int j = 0; j < w+2; ++j) {
                visited[i][j]=true;
            }
        }
        visited[i][0]=true;
        visited[i][w+1]=true;
    }

    int tl=1;
    vector<int> ret(r+1,0);
    priority_queue<pair<int,pair<int,int>> > s;
    s.push(make_pair(1,make_pair(sx,sy)));

    int roomn=0;
    cout<<"ok";
    while(!s.empty()){

        auto t=s.top();
        tl=max(tl,t.first);

        if(visited[t.second.first][t.second.second])continue;
        ++roomn;
        ret[roomn]=tl;

        for (int i = 0; i < 4; ++i) {
            int x=t.second.first+vecx[i];
            int y=t.second.second+vecx[i];
            if(!visited[x][y])s.push(make_pair(m[y-1][x-1],make_pair(x,y)));
        }
        visited[t.second.first][t.second.second]=true;
        s.pop();
    }
    return ret;
}

int main() {
    int w1,h1,x1,y1,w2,h2,x2,y2;

    while (true){
        cin>>r;
        if(r==0)break;
        cin>>w1>>h1>>x1>>y1;
        vector<vector<int>> o1(w1,vector<int>(h1,0));
        for (int i = 0; i < h1; ++i) {
            for (int j = 0; j < w1; ++j) {
                cin>>o1[i][j];
            }
        }
        vector<int> a1=bfs(w1,h1,x1,y1,o1);
        for(auto i:a1)cout<<i<<endl;
    }
    return 0;
}

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

using namespace std;

#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define REP3(i, m, n) for(int i = m, i##_len=(n);i < i##_len;i++)
#define FORVEC(i, v) for(int i = 0;i < v.size();i++)

#define INF 1000000000
#define pb(a) push_back(a)
#define vi vector<int>
#define vvi vector<vi>
#define P pair<int,int>
#define all(vec) (vec.begin()),(vec.end())
#define ll long long int;
#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x;
#define bit(n) (1<<(n))


template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }


int main(){
	int n;
	int a,b,c,d;
	int p[100]={};
	vi pp;
	cin>>n;
	REP(i,(n*(n-1))/2){
		cin>>a>>b>>c>>d;
		if(c>d)p[a-1]+=3;
		else if(c<d)p[b-1]+=3;
		else {
			p[a-1]++;
			p[b-1]++;
		}
	}
	REP(i,n){
		pp.pb(p[i]);
	}
	sort(all(pp),greater<int>());
	/*
	REP(i,n)cout<<p[i]<<" ";cout<<"\n\n";
	REP(i,n)cout<<pp[i]<<" ";cout<<"\n";
	//*/
	REP(i,n){
		auto iter=find(all(pp),p[i]);
		cout<<distance(pp.begin(),iter)+1<<"\n";
	}
	return 0;
}

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

using namespace std;

int main() {
	int n, team[101] = { 0 };
	cin >> n;

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

		if (c > d) {
			team[a] += 3;
		}
		else if (c == d) {
			team[a]++;
			team[b]++;
		}
		else {
			team[b] += 3;
		}
	}

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

	return 0;
}

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

int main(){
  int n;
  cin>>n;
  int a,b,c,d;
  int pnt[1000]={};

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

  for(int i=1;i<=n;i++){
    int cnt=1;
    for(int j=1;j<=n;j++)if(pnt[i]<pnt[j])cnt++;
    vic[i]=cnt;
  }
  for(int i=1;i<=n;i++) cout<<vic[i]<<endl;


  return 0;
}

C++: #include<stdio.h>
#include<iostream>
using namespace std;
int main(void){
int n,i,j,a[101],b[101],c[101],d[101],p=0,team[101],team2[101],team3[101],result[101],cnt=0,z;

cin>>n;

for(i=0;i<=n;i++){
	a[i]=0;
	b[i]=0;
	c[i]=0;
	d[i]=0;
	team[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]){
	team[a[i]]=team[a[i]]+3;
	}

	else if(c[i]<d[i]){
	team[b[i]]=team[b[i]]+3;
	}

	else{
	team[a[i]]=team[a[i]]+1;
	team[b[i]]=team[b[i]]+1;
	}


}
for(i=1;i<=n;i++){
    printf("%d\n",team[i]);
}
for(i=1;i<=n;i++){
team2[i]=team[i];
}
for(i=1;i<=n;i++){
    for(j=i+1;j<=n;j++){
	if(team[i]<=team[j]){
	z=team[i];
	team[i]=team[j];
	team[j]=z;
	}
    }
}
for(i=1;i<=n;i++){
	for(j=1;j<=n;j++){
		if(team[i]==team2[j]){
		team3[j]=i;
		team2[j]=-1;
		}
	}
}
for(i=1;i<=n;i++){
printf("%d\n",team3[i]);
}
return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int n,m,i,j,q,a[5000],b[5000],c[5000],d[5000],s[500],z[500];
	scanf("%d",&n);
	m=n*(n-1)/2;
	for(i=1;i<=m;i++){
		scanf("%d %d %d %d",&a[i],&b[i],&c[i],&d[i]);
	}
	for(j=1;j<=n;j++){
		s[j]=0;
		z[j]=1;
	}
	for(i=1;i<=m;i++){
		for(j=1;j<=n;j++){
			if(j==a[i]){
				if(c[i]>d[i]){
					s[j]+=3;
				}
				else if(c[i]==d[i]){
					s[j]+=1;
				}
			}
			if(j==b[i]){
				if(c[i]<d[i]){
					s[j]+=3;
				}
				else if(c[i]==d[i]){
					s[j]+=1;
				}
			}
		}
	}
	for(j=1;j<=n;j++){
		for(q=1;q<=n;q++){
			if(s[j]<s[q]){
				z[j]++;
			}
		}
		printf("%d\n",z[j]);
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <climits>
#include <string>
#include <vector>
#include <cmath>

using namespace std;

#define str to_string
#define rep(i, n) for (int i=0; i<int(n); i++)
#define all(c) (c).begin(), (c).end()

#define MAX_N 101

int N;
int score[MAX_N];
int ranks[MAX_N];

int main() {
  cin >> N;
  // scoring
  rep(i, N*(N-1)/2) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    if (c == d) {
      score[a-1] += 1;
      score[b-1] += 1;
    }
    else if (c > d) score[a-1] += 3;
    else            score[b-1] += 3;
  }

  // ranking
  int num = 1;
  for (int i=100; i>0; i--) {
    int c = 0;
    rep(j, N) {
      if (score[j] == i) {
        ranks[j] = num;
        c++;
      }
    }
    num += c;
  }
  // print
  rep(i, N) cout << ranks[i] << '\n';
  return 0;
}

C++: #include <iostream>
using namespace std;
int main (void)
{
	int n, m, p, a, b;
	cin >> n;
	int t[n], s[n];
	for(int i = 0;i < n * (n-1) / 2;i++)
	{
		cin >> a >> b >> m >> p;
		if(m > p)
		{
			t[a - 1] += 3;
		}
		else if(m < p)
		{
			t[b - 1] += 3;
		}
		else
		{
			t[a - 1] += 1;
			t[b - 1] += 1;
		}
	}
	for(int j = 0;j < n;j++)
	{
		s[j] = 0;
		for(int k = 0;k < n;k++)
		{
			if(t[j] < t[k]) s[j]++;
		}
		cout << s[j] + 1 << endl;
	}
	return 0;
}