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 <iostream>
#include <fstream>
#include <string>
#include <list>
#include <map>
using namespace std;

class Team
{
	static int mCount;
	int mTeamID;
	int mCorrect;
	map< int, int > mWorng;
	int mPenalty;

public:
	int Correct()const{ return mCorrect; }
	int Penalty()const{ return mPenalty; }
	int TeamID()const{ return mTeamID; }
	bool IsHigherThan(const Team& t)const
	{
		if(mCorrect > t.Correct())
			return true;
		else if(mCorrect==t.Correct() && mPenalty < t.Penalty())
			return true;
		return false;
	}

private:
	Team():mCorrect(0), mPenalty(0),mTeamID(++mCount){}

public:
	Team(const Team& t):mCorrect(t.mCorrect), mPenalty(t.mPenalty), mTeamID(t.mTeamID){}

	static void* operator new[](size_t s){ mCount=0; return malloc(s); }
	static Team* New(size_t s){ return new Team[s]; }
	void Correct(int pID, int time)
	{
		mCorrect++;
		if(mWorng.count(pID) == 0)
		{
			mPenalty += time;
		}
		else
		{
			map<int, int>::iterator i=mWorng.find(pID);
			mPenalty += (*i).second*1200 +time;
			mWorng.erase(i);
		}
	}
	void Worng(int pID)
	{
		if(mWorng.count(pID) == 0)
		{
			pair<int, int> worngData;
			worngData.first  = pID;
			worngData.second = 1;
			mWorng.insert(worngData);
		}
		else
		{
			map<int, int>::iterator i=mWorng.find(pID);
			(*i).second++;
		}
	}
};
int Team::mCount = 0;

int main(void)
{
	//ofstream ofs("ans.txt");
	//ifstream ifs("data.txt");
	istream& in =cin;
	ostream& out=cout;
	const string correct="CORRECT", worng="WORNG";
	int teamN, probN, logN;
	while(1)
	{
		in >> teamN >> probN >> logN;
		if(teamN == 0)break;
		Team* team=Team::New(teamN);
		for(int i=0; i<logN; i++)
		{
			string command;
			int tID, pID, time;
			in >> tID >> pID >> time >> command;
			
			if(command == correct)
				team[tID-1].Correct(pID, time);
			else
				team[tID-1].Worng(pID);
		}

		list<Team> teamRank;
		teamRank.push_back(team[0]);
		for(int i=1; i<teamN; i++)
		{
			list<Team>::iterator it=teamRank.begin();
			while(it != teamRank.end())
			{
				if(team[i].IsHigherThan(*it))
				{
					teamRank.insert(it, (team[i]));
					break;
				}
				it++;
			}
			if(it == teamRank.end())
				teamRank.push_back(team[i]);
		}
		
		list<Team>::iterator it=teamRank.begin();
		while(it != teamRank.end())
		{
			out << (*it).TeamID() << ' ' << (*it).Correct() << ' ' << (*it).Penalty() << endl;
			it++;
		}
		delete[] team;
	}
	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cctype>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <memory>
#include <functional>
#include <set>
#include <iomanip>

using namespace std;

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < (int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define pb push_back
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
typedef long long ll;

int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};

int main()
{
    int t,p,r;
    while((cin >> t >> p >> r )&&t && p && r){
        int wrong[10][50] = {0};
        int tID,pID,time;
        int ansID[50];
        string msg;
        int memo[50] = {0};
        
        int cnt[50] = {0};
        
        for(int i=0;i<r;i++){
            cin >> tID >> pID >> time >> msg;
            if(msg == "WRONG"){
                wrong[pID-1][tID-1]++;
            }else if(msg == "CORRECT"){
                memo[tID-1] += wrong[pID-1][tID-1] * 1200 + time;
                cnt[tID-1]++;
            }else{

            }
        }
        for(int i=0;i<t;i++){
            ansID[i] = i+1;
        }
        
        for(int i=0;i<t;i++){
            for(int j=i+1;j<t;j++){
                if(cnt[i] < cnt[j]){
                    swap(ansID[i],ansID[j]);
                    swap(cnt[i],cnt[j]);
                    swap(memo[i],memo[j]);
                }
                
                else if(cnt[i] == cnt[j]){
                    if(memo[i] > memo[j]){
                        swap(ansID[i],ansID[j]);
                        swap(cnt[i],cnt[j]);
                        swap(memo[i],memo[j]);
                    }else if(memo[i] == memo[j] && ansID[i] > ansID[j]){
                        swap(ansID[i],ansID[j]);
                        swap(cnt[i],cnt[j]);
                        swap(memo[i],memo[j]);
                    }
                }
            }
        }

        
        for(int i=0;i < t;i++){
            cout << ansID[i] << " " << cnt[i] <<" " << memo[i] << endl;
        }
    }
    return 0;
}

C++: #include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

const int MAX_T=50;
const int MAX_P=10;
const int PENALTY=1200;
struct team{
public:
  int wrong[MAX_P]={};
  int solved[MAX_P]={};
};
pair<int,int> score(team& tm,int n){
  pair<int,int> result=make_pair(0,0);
  REP(i,n)
    if(tm.solved[i]!=0){
      result.first++;
      result.second-=tm.wrong[i]*PENALTY+tm.solved[i];
    }
  return result;
}


int t,p;

int main(){ _;
  int r,tid,pid,time;
  string msg;
  while(cin>>t>>p>>r,(t|p|r)!=0){
    team teams[MAX_T];
    REP(i,r){
      cin>>tid>>pid>>time>>msg;
      tid--;pid--;
      if(teams[tid].solved[pid]==0){
	if(msg=="WRONG"){
	  teams[tid].wrong[pid]++;
	}else{
	  teams[tid].solved[pid]=time;
	}
      }
    }
    pair<pair<int,int>,int> result[MAX_T];
    REP(i,t){
      result[i]=make_pair(score(teams[i],p),-i);
    }
    sort(result,result+t,greater<pair<pair<int,int>,int> >());
    REP(i,t){
      cout<<-result[i].second+1<<" "<<result[i].first.first<<" "<<-result[i].first.second<<endl;
    }
  }
}