Go: // You Are the Judge(審判は君だ！)
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2400&lang=jp
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

type Team struct {
	TID         int
	Accepted    int
	WrongAnswer map[int]int
	Penalty     int
}

type Teams []Team

func (t Teams) Len() int      { return len(t) }
func (t Teams) Swap(i, j int) { t[i], t[j] = t[j], t[i] }
func (t Teams) Less(i, j int) bool {
	// より多くの問題を解いたチームは順位が上になる
	if t[i].Accepted > t[j].Accepted {
		return true
	} else if t[i].Accepted == t[j].Accepted {
		// 解いた問題が同じ場合、ペナルティの少ないチームのほうが順位が上になる
		if t[i].Penalty < t[j].Penalty {
			return true
		} else if t[i].Penalty == t[j].Penalty {
			// 解いた問題もペナルティも同じ場合、チーム番号が小さいほうのチームが順位が上になる
			if t[i].TID < t[j].TID {
				return true
			}
		}
	}
	return false
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	for {
		t, p, r := nextInt(sc), nextInt(sc), nextInt(sc)
		if t == 0 && p == 0 && r == 0 {
			break
		}

		teams := []Team{}
		for tID := 0; tID < t; tID++ {
			teams = append(teams, Team{tID + 1, 0, map[int]int{}, 0})
		}

		for i := 0; i < r; i++ {
			tID, pID, time, message := nextInt(sc), nextInt(sc), nextInt(sc), nextString(sc)
			tID--

			if message == "CORRECT" {
				teams[tID].Accepted++
				wa, _ := teams[tID].WrongAnswer[pID]
				teams[tID].Penalty += wa*1200 + time
			} else {
				teams[tID].WrongAnswer[pID]++
			}
		}

		sort.Sort(Teams(teams))

		for _, team := range teams {
			fmt.Println(team.TID, team.Accepted, team.Penalty)
		}
	}
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func nextString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

C++: ???#include <vector>
#include <iostream>
#include <string>
#include <algorithm>
#include <tuple>
#define REP(i,n) for(int i=0;i<(n);i++)
#define P pair<int,int>
using namespace std;

bool compare(const tuple<int,int,int> &a, const tuple<int,int,int> &b){
	if(get<0>(a) == get<0>(b)){
			if(get<1>(a) == get<1>(b)){
				return get<2>(a) < get<2>(b);
			}
			return get<1>(a) < get<1>(b);
		}
		return get<0>(a) > get<0>(b);
}
			
int main(){
	int t,p,r;
	while(cin>>t>>p>>r,t){
		vector<tuple<int,int,int> > inf_team(t,tuple<int,int,int>(0,0,0));//problem,time,number
		REP(i,t)get<2>(inf_team[i]) = i;
		vector<vector<int> > penalty(t,vector<int>(p,0));
		REP(i,r){
			int t_id,p_id,time;
			string mes;
			cin >> t_id >> p_id >> time >> mes;
			t_id--;p_id--;
			if(mes=="WRONG"){
				penalty[t_id][p_id]++;
			}else{
				get<1>(inf_team[t_id]) += time + 1200*penalty[t_id][p_id];
				get<0>(inf_team[t_id])++;
			}
		}
		sort(inf_team.begin(),inf_team.end(),compare);
		REP(i,t){
			cout << get<2>(inf_team[i]) + 1 << " " << get<0>(inf_team[i]) << " " << get<1>(inf_team[i]) << endl;
		}
	}
	return 0;
}

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

using namespace std;

typedef pair<int, int> Pii;
typedef pair<int, Pii> Piii; // solved, penalty, team

int main() {
  int T, P, R;
  
  while(cin >> T >> P >> R && (T|P|R) ) {
    int wa[100][100] = {{}};
    bool ac[100][100] = {{}};
    vector<Piii> data(T);
    
    for(int i=0; i<T; i++) {
      data[i].second.second = -i;
    }
    for(int i=0; i<R; i++) {
      int t, p, r;
      string mes;
      cin >> t >> p >> r >> mes;
      t --; p --;
      if(mes[0]=='W') {
	wa[t][p] ++;
      }
      else {
	if(!ac[t][p]) {
	  ac[t][p] = true;
	  data[t].first ++;
	  data[t].second.first -= wa[t][p]*1200 + r;
	}
      }
    }
    sort(data.begin(), data.end(), greater<Piii>() );
    int const N = data.size();
    for(int i=0; i<N; i++) {
      cout << -data[i].second.second + 1 << " " << data[i].first << " " << -data[i].second.first << endl;
    }
  }
  
  return 0;
}

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

struct team{
  int ans,id,pena;
  int p[10];
  bool operator<(const team &a)const{
    if(this->ans == a.ans){
      return this->pena > a.pena;
    }else{
      return this->ans > a.ans;
    }
  }
};
int main(){
  int t,p,r;
  while(cin>>t>>p>>r){
    if(r==0)return 0;
    int tid,tm,pid;
    string mes;
    team T[t];
    for(int i=0;i<t;i++){
      T[i].id=i+1;
      T[i].ans=0;
      T[i].pena=0;
      for(int j=0;j<10;j++)T[i].p[j]=0;
    }
    for(int i=0;i<r;i++){
      cin>>tid>>pid>>tm>>mes;
      tid--;pid--;
      if(mes=="CORRECT"){
	T[tid].ans++;
	T[tid].pena+=T[tid].p[pid]*1200 + tm;
      }else{
	T[tid].p[pid]++;
      }
    }
    sort(T,T+t);
    for(int i=0;i<t;i++)
      cout << T[i].id << " " << T[i].ans << " " << T[i].pena << endl;
  }
  return 0;
}