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;

#define LOG(...) fprintf(stderr, __VA_ARGS__)
//#define LOG(...)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define RFOR(i, a, b) for (int i = (int)(b - 1); i >= (int)(a); --i)
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define RREP(i, n) for (int i = (int)(n - 1); i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SZ(a) ((int)(a).size())
#define BIT(x, i) (((x) >> (i)) & 1)
#define SQ(x) ((x) * (x))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main() {
    int T, P, R;
    while (cin >> T >> P >> R, T|P|R) {
        vvi wrong(T, vi(P));
        vector<pair<pii, int>> score(T);
        REP(i, T) {
            score[i] = {{0, 0}, -(i+1)};
        }

        REP(i, R) {
            int tid, pid, time;
            string message;
            cin >> tid >> pid >> time >> message;
            tid--;
            pid--;
            if (message == "WRONG") {
                wrong[tid][pid]++;
            } else {
                score[tid].first.first++;
                score[tid].first.second -= time + wrong[tid][pid]*1200;
            }
        }

        RSORT(score);
        REP(i, T) {
            printf("%d %d %d\n", -score[i].second, score[i].first.first, -score[i].first.second);
        }
    }
}

C++: #include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef tuple<int, int> duo;
const int dx[] = {0, 0, 1, -1, 1, 1, -1, -1};
const int dy[] = {1, -1, 0, 0, 1, -1, 1, -1};
const int Mod = 1000000000 + 0;
//{{{ templates
#define TT_ template<typename T>inline
#define TTF_ template<typename T,typename F>inline
TT_ T sq(T x){return x*x;}
TT_ T In(){T x;cin>>x;return x;}
TT_ void Out(T&x){cout<<x;}
TT_ void sort(T&v){sort(begin(v),end(v));}
TT_ void revs(T&v){reverse(begin(v),end(v));}
TT_ void uniq(T&v){sort(v);v.erase(unique(begin(v),end(v)),end(v));}
TT_ int ubnd(T&v,typename T::value_type x){return upper_bound(begin(v),end(v),x)-begin(v);}
TT_ int lbnd(T&v,typename T::value_type x){return lower_bound(begin(v),end(v),x)-begin(v);}
TTF_ void inpt(T&v,int n,F f){for(v.reserve(n);n--;v.emplace_back(f()));}
TTF_ void show(T&v,F f,string d=" ",string e="\n"){int i=0;for(auto&x:v)i++&&(cout<<d),f(x);cout<<e;}
TT_ typename T::iterator minel(T&v){return min_element(begin(v),end(v));}
TT_ typename T::iterator maxel(T&v){return max_element(begin(v),end(v));}

inline void fast_io(){ios_base::sync_with_stdio(0);cin.tie(0);}
inline int in(){int x;scanf("%d",&x);return x;}
inline ll pow_mod(ll a,ll k,ll m){ll r=1;for(;k>0;a=a*a%m,k>>=1)if(k&1)r=r*a%m;return r;}
inline ll mod_inv(ll a,ll p){return pow_mod(a,p-2,p);}
//}}} priority_queue queue deque front stringstream max_element min_element insert count make_tuple

struct Team {
  int id, ac, penalty;
  vector<int> wa;
  Team(int id, int p) : id(id), ac(0), penalty(0), wa(p + 1) {}
  void wrong(int pid, int t){
    wa[pid]++;
  }
  void correct(int pid, int t){
    ac++;
    penalty += wa[pid] * 1200 + t;
  }
  bool operator<(const Team& t) const {
    if (ac != t.ac) return ac > t.ac;
    if (penalty != t.penalty) return penalty < t.penalty;
    return id < t.id;
  }
};

int main()
{
  int T, P, R;
  while (T = in(), P = in(), R = in(), T || P || R){
    vector<Team> teams;
    for (int i = 1; i <= T; i++) teams.emplace_back(i, P);
    while (R--){
      int tid, pid, t;
      string msg;
      cin >> tid >> pid >> t >> msg;
      if (msg == "WRONG") teams[tid - 1].wrong(pid, t);
      else teams[tid - 1].correct(pid, t);
    }
    sort(teams);
    for (auto& team : teams){
      printf("%d %d %d\n", team.id, team.ac, team.penalty);
    }
  }
  return 0;
}

C++: //ACCEPT????????????????????????Wrong Answer?????????????????£?????????????????????????????¨?????¨????????????
#include <iostream>
#include <string>
#include <tuple>
#include <algorithm>
using namespace std;

int T, P, R;
int team, prob, t; string mes;

bool isAccepted[50][10];
int acTimeSum[50];
int wrongCnt[50][10];

int main() {
	int i, j;
	
	while (cin >> T >> P >> R) {
		if (!T) break;
		for (i = 0; i < T; i++) {
			acTimeSum[i] = 0;
			for (j = 0; j < P; j++) {
				isAccepted[i][j] = false;
				wrongCnt[i][j] = 0;
			}
		}
		
		for (i = 0; i < R; i++) {
			cin >> team >> prob >> t >> mes;
			team--; prob--;
			if (mes == "CORRECT") {
				isAccepted[team][prob]++;
				acTimeSum[team] += t;
			}
			else {
				wrongCnt[team][prob]++;
			}
		}
		
		typedef tuple<int, int, int> Tuple;
		Tuple d[50];
		for (i = 0; i < T; i++) {
			int penalty = acTimeSum[i];
			int acCnt = 0;
			for (j = 0; j < P; j++) {
				if (isAccepted[i][j]) {
					acCnt++;
					penalty += 1200 * wrongCnt[i][j];
				}
			}
			d[i] = Tuple(-acCnt, penalty, i);
		}
		sort(d, d + T);
		
		for (i = 0; i < T; i++) {
			cout << get<2>(d[i]) + 1 << " " << -get<0>(d[i]) << " " << get<1>(d[i]) << endl;
		}
	}
	return 0;
}