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

typedef pair<int,int> P;

int main(){
	int n;
	cin >> n;
	int table[101][101] = {0};
	for(int i=0 ; i < n*(n-1)/2 ; i++ ){
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		a--, b--;
		int s1, s2;
		if( c > d ){ 
			s1 = 3;
			s2 = 0;
		}else if( c == d ){
			s1 = s2 = 1;
		}else{
			s1 = 0;
			s2 = 3;
		}
		table[a][b] = s1;
		table[b][a] = s2;
	}
	vector<P> v;
	int score[101] = {0};
	for(int i=0 ; i < n ; i++ ){
		for(int j=0 ; j < n ; j++ ){
			if( i == j ) continue;
			score[i] += table[i][j];
		}
		v.push_back( P(-score[i],i) );
	}
	sort( v.begin() , v.end() );
	int rank[101] = {0};
	rank[ v[0].second ] = 1;
	for(int i=1 ; i < v.size() ; i++ ){
		rank[ v[i].second ] = ( v[i].first == v[i-1].first )? rank[ v[i-1].second ] : i+1;
	}
	for(int i=0 ; i < n ; i++ ){
		cout << rank[i] << endl;
	}
}

C++: #include<cstdio>
using namespace std;
int main()
{
	int n,i,j,a,b,c,d,x[100],y[100];
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		x[i]=0;
		y[i]=1;
	}
	for(i=0;i<n*(n-1)/2;i++){
		scanf("%d %d %d %d",&a,&b,&c,&d);
		if(c>d)	x[a]+=3;
		else if(c<d)	x[b]+=3;
		else{
			x[a]++;
			x[b]++;
		}
	}
	for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			if(x[i]<x[j])	y[i]++;
		}
	}
	for(i=1;i<=n;i++){
		printf("%d\n",y[i]);
	}
	return 0;
}

C++: #include <iostream>
 
using namespace std;
 
int main (void) {
  int G[101][101] = {0}, sum[101] = {0}, rank[101] = {0};
  int a, b, c, d;
  int n;
 
  cin >> n;
 
  for(int i = 1; i <= n*(n-1)/2; i++) {
    cin >> a >> b >> c >> d;
    if(c < d) {
      G[a][b] = 0; G[b][a] = 3;
    } else if(c == d) {
      G[a][b] = 1; G[b][a] = 1;
    } else {
      G[a][b] = 3; G[b][a] = 0;
    }
  }
 
  for(int i = 1; i <= n; i++) {
    for(int j = 1; j <= n; j++) {
      if (i == j) continue;
      sum[i] += G[i][j];
    }
  }
 
  //cout << sum[0] << " " << sum[1] << " " << sum[2] << " " << sum[3] << endl;
 
  int daburi = 1;
 
  // rank&#227;&#129;&#174;&#229;‡&#186;&#227;&#129;—&#230;&#8211;&#185;&#227;&#129;&#175;&#228;&#191;&#186;&#227;&#129;&#338;&#232;&#8364;&#402;&#227;&#129;&#710;&#227;&#129;&#376;&#227;&#8218;&#162;&#227;&#402;&#171;&#227;&#8218;´&#227;&#402;&#170;&#227;&#8218;&#186;&#227;&#402; &#227;&#129;&#732;&#227;&#8218;&#402;&#227;&#129;&#170;&#227;&#129;&#8222;
  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>
#include <iostream>
using namespace std;
int main(void)
{
	int i,n,a,j,b,c,d,A[101],B[101]; 
	cin>>n;
	for(i=1;i<=n;i++){
		A[i]=0;
		B[i]=1;
		}
	for(i=0;i<n*(n-1)/2;i++){
		cin>>a>>b>>c>>d;
		if(c>d){
			A[a]+=3;
		}
		else if(c<d){
			A[b]+=3;
		}
		else{
			A[a]++;
			A[b]++;
		}
	}
	for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			if(A[i]>A[j]){
				B[j]++;
			}
		}
	}
	for(i=1;i<=n;i++){
		cout<<B[i]<<endl;
	}
return 0;
}

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

struct team{
	int index, points, rank;
};

bool descending_team_with_point(const team& l_team, const team& r_team){
	return l_team.points > r_team.points;
}

bool ascending_team_with_index(const team& l_team, const team& r_team){
	return l_team.index < r_team.index;
}

int main(){
	int n, i, a, b, c, d;
	team arr[101];
	
	for(i=0;i<101;i++){
		arr[i].index = i;
		arr[i].points = 0;
	}

	std::cin >> n;
	for(i=n*(n-1)/2;i--;){
		std::cin >> a >> b >> c >> d;
		if(c>d)arr[a].points+=3;
		else if(c<d)arr[b].points+=3;
		else arr[a].points++, arr[b].points++;
	}

	std::sort(arr+1, arr+n+1, descending_team_with_point);
	int prev_value = -1, rank = 0;
	for(i=1;i<=n;i++){
		if(arr[i].points != prev_value){
			rank = i;
		}
		
		arr[i].rank = rank;
		
		prev_value = arr[i].points;
	}
	std::sort(arr+1, arr+n+1, ascending_team_with_index);

	for(i=1;i<=n;i++){
		std::cout << arr[i].rank << std::endl;
	}
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(void){
	int n;
	int ateam,bteam,ascore,bscore;
	cin>>n;
	vector<int> team(n),cmp(n);
	int num=n=(n*n-n)/2;
	cout<<n;
	while(n--){
		cin>>ateam>>bteam>>ascore>>bscore;
		cout<<ateam<<bteam<<ascore<<bscore<<endl;
		if(ascore==bscore)
			team[ateam-1]++,team[bteam-1]++;
		else if (ascore>bscore)
			team[ateam-1]+=3;
		else if (ascore<bscore)
			team[bteam-1]+=3;
	}
	for(int i = 0 ; i < team.size() ; i ++){
		int rank = 1;
		for(int j = 0 ; j < cmp.size() ; j ++)
				if(team[i]<team[j]){
					rank++;
					}
		cout<<rank<<endl;
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
int main(){
  int n;
  int data[101]={0};
  int rank[101];
  cin>>n;
  for(int i=0;i<n;i++) rank[i]=1;
  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){
      data[b]+=3;
    }else if(c>d){
      data[a]+=3;
    }else if(c==d){
      data[b]++;
      data[a]++;
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(data[i]<data[j]){
	rank[i]++;
      }
    }
    cout<<rank[i]<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
struct {int no, w, l, d, p, r;} t[100], u;
int main()
{
	int n, a, b, c, d, r = 1, i, j, z = 1;
	cin >> n;
	for (i = 0; i < n; i++)
		t[i].w = t[i].l = t[i].d = 0;
	for (i = 0; i < n*(n-1)/2; i++)
	{
		cin >> a >> b >> c >> d;
		t[a-1].no = a;
		t[b-1].no = b;
		if (c > d)
		{
			t[a-1].w++;
			t[b-1].l++;
		}
		else if (c == d)
		{
			t[a-1].d++;
			t[b-1].d++;
		}
		else
		{
			t[a-1].l++;
			t[b-1].w++;
		}
	}
	for (i = 0; i < n; i++)
		t[i].p = t[i].w * 3 + t[i].d;
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < n-1; j++)
		{
			if (t[j].p < t[j+1].p)
				u = t[j], t[j] = t[j+1], t[j+1] = u;
		}
	}
	for (i = 0; i < n; i++)
	{
		if (i != 0)
			if (t[i-1].p != t[i].p)
				r += z, z = 1;
			else
				z++;
		t[i].r = r;
	}
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < n-1; j++)
		{
			if (t[j].no > t[j+1].no)
				u = t[j], t[j] = t[j+1], t[j+1] = u;
		}
	}
	for (i = 0; i < n; i++)
		cout << t[i].r << endl;
}

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