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<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int N;
    int score[101]={0};
    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)score[a]+=3;
        else if(c<d)score[b]+=3;
        else score[a]++,score[b]++;;
    }
    for(int i=1;i<=N;i++){
        int cou=0;
        for(int j=1;j<=N;j++){
            if(score[i]<score[j])cou++;
        }
        cout<<cou+1<<endl;
    }
    return 0;
}

C++: #include<stdio.h>
#include<iostream>
using namespace std;
int main(void){
	int n,a[4],t[100],i,c,j;
		cin>>n;
	for(i=0;i!=n;i++){
		t[i]=0;
	}
		for(i=0;i!=n*(n-1)/2;i++){
			for(j=0;j!=4;j++)
				cin>>a[j];
			if(a[2]<a[3])
				t[a[1]-1]+=3;
			else if(a[2]>a[3])
				t[a[0]-1]+=3;
			else{
				t[a[0]-1]++;
				t[a[1]-1]++;
			}
		}
	for(i=0;i!=n;i++){
		c=1;
		for(j=0;j!=n;j++){
			if(t[i]<t[j])
				c++;
		}
		cout<<c<<endl;
	}
}

C++: #include<iostream>
#include<queue>
using namespace std;
int main() {
	int n; cin >> n;
	int score[114] = {}, rank[114];
	priority_queue<pair<int, int>>p;
	for (int i = 0; i < n*(n - 1) / 2; i++) {
		int a, b, c, d; cin >> a >> b >> c >> d;
		if (c > d)score[a] += 3;
		else if (c < d)score[b] += 3;
		else { score[a]++; score[b]++; }
	}
	for (int i = 1; i <= n; i++) 
		p.push(make_pair(score[i], i));
	int mem1 = 1, mem2 = 0;//mem1:score, mem2:rank
	for (int i = 1; i <= n; i++) {
		pair<int, int>pr = p.top();
		//pr.first:score, pr.second:id
		p.pop();
		if (pr.first == mem1) { rank[pr.second] = mem2; }
		else { rank[pr.second] = i; mem2 = i; mem1 = pr.first; }
	}
	for (int i = 1; i <= n; i++) {
		cout << rank[i];
		cout << '\n';
	}
}

C++: #include <iostream>
using namespace std;
int point[100],team[100],rank[100];
int main(){
	int n,i,j,a,b,c,d,tmp;
	cin >> n;
	for(i = 0;i < 100;i++){
		team[i] = i+1;
		point[i] = 0;
	}
	for(i = 0;i < (n*(n-1)/2);i++){
		cin >> a >> b >> c >> d;
		if(c > d){
			point[a - 1] += 3;
		}
		else if(c < d){
			point[b - 1] += 3;
		}
		else if(c == d){
			point[a - 1]++;
			point[b - 1]++;
		}
	}
	for(i = 0;i < n - 1;i++){
		for(j = n - 1;j > i;j--){
			if(point[i] < point[j]){
				tmp = point[j];
				point[j] = point[i];
				point[i] = tmp;
				tmp = team[j];
				team[j] = team[i];
				team[i] = tmp;
			}
		}
	}
	for(i = 0;i < n;i++){
		if(i != 0){
			if(point[i - 1] == point[i]){
				rank[team[i] - 1] = rank[team[i - 1] - 1];
			}
			else {
				rank[team[i] - 1] = i + 1;
			}
		}
		else rank[team[i] - 1] = i + 1;
	}
	for(i = 0;i < n;i++){
		cout << rank[i] << endl;
	}
	return 0;
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<int(n);i++)
#define reps(i,n) for(int i=1;i<=int(n);i++)

int main(){
	
	int point[111]={0};
	
	int n;
	cin>>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)point[a]+=3;
		if(d>c)point[b]+=3;
		if(c==d){ point[a]++; point[b]++; }
	}
	
	
	for(int i=0;i<n;i++){
		int rank=1;
		for(int j=0;j<n;j++){
			if(point[i]<point[j])rank++;
		}
		printf("%d\n",rank);
	}
}

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

C++: #include <iostream>
using namespace std;
int main(){
	int N;
	cin>>N;
	int sc[N][3];
		for(int i=0;i<N;i++){
			int a,b,c;
			cin>>a>>b>>c;
			sc[i][0]=a;
			sc[i][1]=b;
			sc[i][2]=c;
		}
		for(int k=0;k<3;k++){
			for(int j=0;j<N;j++){
				for(int c=1;c<N+1;c++){
					if(sc[j][k]==sc[j+c][k]){
						sc[j][k]=0;
						sc[j+c][k]=0;
						}
					
					}
				}
			}
		for(int o=0;o<N+1;o++){
			cout<<sc[o][0]+sc[o][1]+sc[o][2]<<endl;
		}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main() {
	int point[100] = { 0 }, n, grade[100] = { 0 };
	int ta, tb, pa, pb;
	cin >> n;
	for (int h = 1; h <= n; h++) {
		grade[h] = n+1;
	}
	for (int i = 0; i < n*(n - 1) / 2; i++) {
		cin >> ta >> tb >> pa >> pb;
		if (pa > pb) point[ta] = point[ta] + 3;
		if (pa < pb) point[tb] = point[tb] + 3;
		if (pa == pb) {
			point[ta] = point[ta] + 1;
			point[tb] = point[tb] + 1;
		}
	}
	for (int k = 1; k <= n; k++) {
		for (int j = 1; j <= n; j++) {
			if (point[k] >= point[j]) grade[k]--;
		}
	}
	for (int g = 1; g <= n; g++) {
		cout << grade[g] << endl;
	}
}

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;
    while(!s.empty()){
        auto t=s.top();
        tl=max(tl,t.first);
        ++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][x],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);

    }
    return 0;
}