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>
using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define pb            push_back
template<class T, class S> inline pair<T, S> mp(T x, S y){ return make_pair(x, y); }
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }

static const int    INF = 1000000000;
static const ll     MOD = 1000000007LL;
static const double EPS = 1E-12;

const int MAX_T = 70;
const int MAX_P = 20;
int T, P, R;
int tID, pID, ti;
string mes;
int wa[MAX_T][MAX_P];

struct data{int a, p, id; };

inline bool operator < (const data& x, const data& y)
{
  return x.a!=y.a ? x.a<y.a : x.p!=y.p ? x.p>y.p : x.id > y.id;
}

inline bool operator > (const data& x, const data& y)
{
  return !(x < y);
}

int main()
{
  while(cin >> T >> P >> R, T){
    vector<data> g(T, (data){0, 0, 0});
    rep(i, MAX_T) rep(j, MAX_P) wa[i][j] = 0;
    rep(i, T) g[i].id = i;

    rep(i, R){
      cin >> tID >> pID >> ti >> mes;
      tID -= 1;  pID -= 1;
      if(mes == "CORRECT"){
        g[tID].a += 1;
        g[tID].p += wa[tID][pID] * 1200 + ti;
      }
      else wa[tID][pID] += 1;
    }
    sort(ALL(g), greater<data>());
    vrep(v, g) cout << v->id + 1 << ' ' << v->a << ' ' << v->p << 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;
    }
  }
}

C++: 
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <cassert>

using namespace std;


struct st{
	int num;
	int point;
	int penalty;
	vector<int> wrong;
	
	st(){}
	st(int n){
		point = 0;
		penalty = 0;
		for(int i=0;i<n;i++){
			wrong.push_back(0);
		}
	}
	
	void setnum(int k){
		num = k;
	}
	
	bool operator < (const st &a) const{
		return this->point == a.point ? 
		(this->penalty == a.penalty ? this->num < a.num : this->penalty > a.penalty)
		: this->point < a.point;
	}
};



bool solve(){
	int t,p,r;
	cin>> t>> p>> r;
	if(t==0&&p==0&&r==0) return false;
	
	vector<st> s(t,st(p));
	for(int i=0;i<s.size();i++){
//		s[i].num = i+1;
		s[i].setnum(i+1);
	}
	
	for(int i=0;i<r;i++){
		int a, b ,c;
		string str;
		cin>> a>> b>> c>> str;
		a--; b--;
		if(str == "WRONG"){
			s[a].wrong[b]++;
		}else{
			s[a].point++;
			s[a].penalty += s[a].wrong[b] * 1200 + c;
		}
	}
	
	sort(s.rbegin(), s.rend());
	for(int i=0;i<s.size();i++){
		cout<< s[i].num<< " "<< s[i].point<< " "<< s[i].penalty<< endl;
	}
		
	return true;
	
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	while(solve());

	return 0;
}

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

using namespace std;

#define rep(i, n) for(int i=0; i<(n); ++i)
#define all(c) (c).begin(), (c).end()

int main(){
    int T, P, R;
    while(cin >> T >> P >> R, T|P|R){
        vector<vector<int> > pen(T, vector<int>(P));
        vector<tuple<int, int, int> > info(T);
        rep(i, T)get<2>(info[i]) = i+1;
        while(R--){
            int tID, pID, tim; string mes;
            cin >> tID >> pID >> tim >> mes;
            tID--; pID--;
            if(mes[0] == 'W')pen[tID][pID]++;
            else{
                get<0>(info[tID])--;
                get<1>(info[tID]) += pen[tID][pID] * 1200 + tim;
            }
        }
        sort(all(info));
        rep(i, T){
            int corr, pena, id; tie(corr, pena, id) = info[i];
            cout << id << ' ' << -corr << ' ' << pena << '\n';
        }
    }
    return 0;
}