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<bits/stdc++.h>
#define I 900000
using namespace std;
int x[99],z[99],y[99][20],h[99],a,b,c,d,e,f,i,j,k;string S;
int main(){
while(true){
for(i=0;i<99;i++){x[i]=I;}
memset(y,0,sizeof(y));
memset(h,0,sizeof(h));
cin>>a>>b>>c;
if(a==0){break;}
for(i=0;i<c;i++){
cin>>d>>e>>f>>S;
if(S[0]=='W'){
y[d][e]++;
}
else{
x[d]+=I;
x[d]-=f+1200*y[d][e];
}
}
for(i=1;i<=a;i++){z[i]=x[i];}
sort(x+1,x+a+1);
for(i=a;i>=1;i--){
for(j=1;j<=a;j++){
if(z[j]==x[i]&&h[j]==0){
printf("%d %d %d\n",j,(x[i]+I-1)/I-1,(99*I-x[i])%I);
h[j]=1;
}
}
}
}
}

C++: #include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define Repr(i, n, a) for (int i = (n); i >= (a); i--)
#define rep(i, n) Rep(i, 0, n)
#define repr(i, n) Repr(i, n, 0)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<P, int> PP;
const int mod = 1000000007;

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int T, P, R;
    while (1)
    {
        cin >> T >> P >> R;
        if (T == 0)
            break;
        vector<PP> score(T);
        int wa_cnt[60][20] = {};
        rep(i, T) score[i].second = i + 1;
        rep(i, R)
        {
            int tID, pID, t;
            string mes;
            cin >> tID >> pID >> t >> mes;
            tID--, pID--;
            if (mes == "CORRECT")
            {
                score[tID].first.first++;
                score[tID].first.second += t + wa_cnt[tID][pID] * 1200;
            }
            else
            {
                wa_cnt[tID][pID]++;
            }
        }
        rep(i, T) score[i].first.first *= -1;
        sort(all(score));
        rep(i, T) cout << score[i].second << " " << -score[i].first.first << " " << score[i].first.second << endl;
    }
}

C++: #include<iostream>
#include<tuple>
#include<queue>

using namespace std;

signed main(){

   while(1){
      int T, P, R;
      cin>> T>> P>> R;
      if(!(T||P||R)) break;

      int hoge[T][P];
      fill((int*)hoge, (int*)hoge+T*P, 0);
      for(int i=0; i<R; i++){
         int team, prob, time;
         string s;
         cin>> team>> prob>> time>> s;
         team--; prob--;
         if(s=="CORRECT"){
            hoge[team][prob]=1200*max(0-hoge[team][prob], 0)+time;
         }else{
            hoge[team][prob]--;
         }
      }
      priority_queue<tuple<int, int, int>> Q;
      for(int i=0; i<T; i++){
         int ac=0, pena=0;
         for(int j=0; j<P; j++){
            ac+=(hoge[i][j]>0);
            pena+=max(hoge[i][j], 0);
         }
         Q.push(make_tuple(ac, -pena, -i));
      }



      for(int i=0; i<V.size(); i++){
         int ac, pena, team;
         tie(ac, pena, team)=Q.top(); Q.pop();
         cout<< -team+1<< " "<< ac<< " "<< -pena<< endl;
      }

   }

   return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <tuple>

#define REP(i,n) for(int i=0; i<(int)(n); i++)

inline int getInt(){ int s; scanf("%d", &s); return s; }

using namespace std;

string getStr(){ static char b[256]; scanf("%s", b); return b; }

int main(){
  while(true){
    const int t = getInt();
    const int p = getInt();
    const int r = getInt();

    if(t + p + r == 0) return 0;

    vector<vector<int> > w(t, vector<int>(p));

    vector<tuple<int, int, int> > team(t);
    const int ac = 0;
    const int pn = 1;
    const int id = 2;
    REP(i,t) get<id>(team[i]) = -(i + 1);

    REP(i,r){
      const int tid = getInt() - 1;
      const int pid = getInt() - 1;
      const int tm  = getInt();
      const string mes = getStr();

      if(mes[0] == 'C'){
	if(w[tid][pid] == -1) continue;
	get<ac>(team[tid])++;
	get<pn>(team[tid]) -= 1200 * w[tid][pid] + tm;
      }else{
	w[tid][pid]++;
      }
    }

    sort(team.rbegin(), team.rend());

    for(const auto tp : team)
      printf("%d %d %d\n", -get<id>(tp), get<ac>(tp), -get<pn>(tp));

  }

  return 0;
}

C++: //
//  main.cpp
//  c
//
//  Created by 13B10694 on 2015/06/01.
//  Copyright (c) 2015????´ 13B10694. All rights reserved.
//

#include <iostream>
#include <vector>
#include<stdio.h>
#include <algorithm>
#include<string.h>
using namespace std;

int now=1;

class team{
    
public:
    int id, pen, sol;
    int wrong[12];
    vector <int> solved;
    team(){
        memset(wrong, 0, sizeof(wrong));
        id=now++;
    }
    ~team(){
        solved.clear();
    }
    
    bool operator < (const team& b) const
    {
        return solved.size()==b.solved.size() ? pen== b.pen ? id<b.id : pen<b.pen : solved.size()>b.solved.size();
    }
};

int main() {
    int t,p,r;
    while(cin>>t>>p>>r,t){
        now=1;
        vector<team> tea(t);

        for(int i=0;i<r;i++){
            int ti, pi, tim;
            string mes;
            cin>>ti>>pi>>tim>>mes;
            ti-=1;
            if(mes=="WRONG"){
                tea[ti].wrong[pi]++;
                continue;
            }
            if(find(tea[ti].solved.begin(),tea[ti].solved.end(),pi)!=tea[ti].solved.end()){
                continue;
            }
            tea[ti].solved.push_back(pi);
            tea[ti].pen += tea[ti].wrong[pi]*1200+tim;
  
        }
        sort(tea.begin(),tea.end());
        for(int i=0;i<t;i++){
            cout<<tea[i].id<<" "<<tea[i].solved.size()<<" "<<tea[i].pen<<endl;
        }
        tea.clear();
    }
    
    return 0;
}