jiahuimbzuai/CoQuIR huggingface dataset:
//  [go]
package main

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

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func main() {
	sc.Split(bufio.ScanWords)
	a, b, c := nextInt(), nextInt(), nextInt()
	if a+b > c && b+c > a && c+a > b {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}
//  [go]
// ProblemURL : https://atcoder.jp/contests/exawizards2019/tasks/exawizards2019_a
// ---------------------------------------------
package main

import "fmt"

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)
	ok := a+b > c && b+c > a && c+a > b
	if ok {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}
//  [ruby]
puts gets.split.map(&:to_i).uniq.size == 1 ? "Yes" : "No"
//  [ruby]
a,b,c = gets.split.map(&:to_i)

puts a==b && b==c ? 'Yes' : 'No'
//  [ruby]
a, b, c = gets.split.map(&:to_i)
puts (a == b && b == c) ? "Yes" : "No"
//  [ruby]
nums = 3.times.map{gets.to_i}
if nums.all? { |n| n == nums[0] }
  puts 'Yes'
else
  puts 'No'
end
//  [ruby]
nums = 3.times.map{gets.to_i}
if nums.all? { |n| n == nums[0] }
  puts 'True'
else
  puts 'False'
end
//  [ruby]
a,b,c=gets.split.map(&:to_i)
putd a==b && b==c ? "Yes" : "No"
//  [rust]
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
use std::io::*;
use std::str::FromStr;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);

impl<T: PartialEq> Eq for Total<T> {}

impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}


//const MAX:usize = 100006;
//const INF:u64 = u64::max_value();

fn main() {
    let a:Vec<u32> = (0..3).map(|_| read()).collect();

    println!("{}",
        if a[0] == a[1] && a[1] == a[2] {"Yes"}
        else {"No"}
    );
    
}
//  [rust]
#[macro_use]
mod input {

use std;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[macro_export]
#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
pub fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
pub fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

#[allow(dead_code)]
pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let vec_line = input_vector();
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
pub fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
pub fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}
}

use input::*;

fn main() {
    let (a, b, c): (usize, usize, usize);
    input!(a, b, c);
    if a == b && b == c {
        p("Yes");
    } else {
        p("No");
    }
}
//  [rust]
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut scan = Scanner::new(cin);

    let mut e = scan.readn::<i32>(3);
    e.sort();
    println!("{}", if e[0]==e[1] && e[1]==e[2] {"Yes"} else {"No"});
}

// region template
#[allow(dead_code)]
fn uz(i: i32) -> usize { i as usize }

#[allow(dead_code)]
fn chmax<T: PartialOrd>(a: &mut T, b: T) -> bool {
    if *a < b {
        *a = b;
        true
    } else { false }
}

#[allow(dead_code)]
fn chmin<T: PartialOrd>(a: &mut T, b: T) -> bool {
    if *a > b {
        *a = b;
        true
    } else { false }
}

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }

    fn readn<T: FromStr>(&mut self, n: i32) -> Vec<T> {
        let mut ret = vec![];
        for _ in 0..n { ret.push(self.read::<T>()) }
        ret
    }

    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}
// endregion
//  [rust]
use std::io;

fn main() {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    let q_len = {
        let mut n_and_q = buf.split_whitespace();
        n_and_q.next().unwrap();
        n_and_q.next().unwrap().parse::<usize>().unwrap()
    };

    buf.clear();
    io::stdin().read_line(&mut buf).unwrap();
    buf.pop().unwrap();
    let s = buf;

    let mut spells = vec![String::new(); q_len];
    for spell in spells.iter_mut() {
        io::stdin().read_line(spell).unwrap();
    }

    let spells: Vec<_> = spells
        .into_iter()
        .map(|spell| {
            let mut iter = spell.split_whitespace();
            let t = iter.next().unwrap().chars().next().unwrap();
            let d = iter.next().unwrap().chars().next().unwrap();
            (t, d)
        })
        .collect();

    let mut indices = Vec::with_capacity(s.len());
    let mut golems = vec![1_u32; s.len()];
    for (t, d) in spells.into_iter() {
        for (i, s) in s.chars().enumerate() {
            if s == t { indices.push(i); }
        }

        for &index in indices.iter() {
            match d {
                'R' => {
                    if index != s.len() - 1 {
                        golems[index+1] += golems[index];
                    }
                    golems[index] = 0;
                }
                'L' => {
                    if index != 0 {
                        golems[index-1] += golems[index];
                    }
                    golems[index] = 0;
                }
                e @ _ => panic!("unexpected char '{}'", e),
            }
        }

        indices.clear();
    }

    println!("{}", golems.iter().sum::<u32>());
}
//  [rust]
use std::io;

fn main() {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    let q_len = {
        let mut n_and_q = buf.split_whitespace();
        n_and_q.next().unwrap();
        n_and_q.next().unwrap().parse::<usize>().unwrap()
    };

    buf.clear();
    io::stdin().read_line(&mut buf).unwrap();
    buf.pop().unwrap();
    let s = buf;

    let mut spells = vec![String::new(); q_len];
    for spell in spells.iter_mut() {
        io::stdin().read_line(spell).unwrap();
    }

    let spells: Vec<_> = spells
        .into_iter()
        .map(|spell| {
            let mut iter = spell.split_whitespace();
            let t = iter.next().unwrap().chars().next().unwrap();
            let d = iter.next().unwrap().chars().next().unwrap();
            (t, d)
        })
        .collect();

    let mut indices = Vec::with_capacity(s.len());
    let mut golems = vec![1_u32; s.len()];
    for (t, d) in spells.into_iter() {
        s.chars()
            .enumerate()
            .map(|(i, s)| if s == t { indices.push(i); });

        indices
            .iter()
            .map(|&index| {
                match d {
                    'R' => {
                        if index != s.len() - 1 {
                            golems[index+1] += golems[index];
                        }
                        golems[index] = 0;
                    }
                    'L' => {
                        if index != 0 {
                            golems[index-1] += golems[index];
                        }
                        golems[index] = 0;
                    }
                    e @ _ => panic!("unexpected char '{}'", e),
                }
            });

        indices.clear();

    }

    println!("{}", golems.iter().sum::<u32>());
}
//  [swift]
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    func count() -> Int {
        return self.characters.count
    }
}
extension Array where Element: Comparable {
    func max() -> Element! {
        return self.maxElement()
    }
    func min() -> Element! {
        return self.minElement()
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/



/*************** メインプログラム ***************/

let input = readIntSplit(by: " ")
let (A, B, C) = (input[0], input[1], input[2])

print((A == B && B == C) ? "Yes" : "No")
//  [swift]
import Foundation

let input = readLine()!.componentsSeparatedByString(" ").map { Int($0)! }
if input[0] == input[1] && input[1] == input[2] {
	print("Yes")
} else {
	print("No")
}
//  [swift]
init main(a: Int, b: Int, c: Int) {
  
  let a:Int = a
  let b:Int = b
  let c:Int = c
  var isEqTriangle: Bool = false
  
  if a =b && b=c {
    isEqTriangle = true      
  } else {
    isEqTriangle = false
  }
  
  print(isEqTriangle)
  
  
}
//  [swift]
import Foundation

let input = readLine()!.components(separatedBy: " ").map { Int($0)! }
if input[0] == input[1] || input[1] == input[2] {
	print("Yes")
} else {
  	print("No")
}
//  [swift]
import Foundation

let input = readLine()!.components(separatedBy: " ").map { Int($0)! }
if input[0] == input[1] || input[1] == input[2] {
	print("Yes")
else {
  	print("No")
}
//  [typescript]
[A,B,C]=require('fs').readFileSync('/dev/stdin','utf8').split(' ').map(n=>n|0)
console.log(A==B&&B==C?'Yes':'No')
//  [typescript]
function main(input) {
  const a = input.split(" ").map(v => parseInt(v))
  console.log(a[0] === a[1] && a[1] === a[2] ? "Yes" : "No");
}
main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
//  [typescript]
export class Main {
  static main(input): string {
    const [a, b, c]: number[] = input.split("\n")[0].split(" ").map(Number);
    return `${a == b && b == c ? "Yes" : "No"}`;
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));
//  [typescript]
// inputに入力データ全体が入る
function Main(input) {
	const temp = input.split(" ")
	console.log(temp[0] == temp[1] && temp[1] == temp[2] ? "Yes" : "No")
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
[A,B,C]=require('fs').readFileSync('/dev/stdin','utf8').split(' ')
console.log(A==B&&B==C?'Yes':'No')
//  [python]
def solve(string):
    n, m, *ps = string.split()
    n = int(n)
    ac = [0] * n
    wa = [0] * n
    for p, s in zip(*[iter(ps)] * 2):
        p = int(p) - 1
        if s == "AC":
            ac[p] = 1
        elif not ac[p]:
            wa[p] += 1
    return "{} {}".format(sum(ac), sum([w * a for a, w in zip(ac, wa)]))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))
//  [python]
def solve(string):
    n, m, *ps = string.split()
    n = int(n)
    ac = [0] * n
    wa = [0] * n
    for p, s in zip(*[iter(ps)] * 2):
        p = int(p) - 1
        if s == "AC":
            ac[p] = 1
        elif not ac[p]:
            wa[p] += 1
    return "{} {}".format(sum(ac), sum([w * a for a, w in zip(ac, wa)]))
 
 
if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))
//  [python]
def solve(string):
    n, m, *ps = string.split()
    n = int(n)
    ac = [0] * n
    wa = [0] * n
    for p, s in zip(*[iter(ps)] * 2):
        p = int(p) - 1
        if s == "AC":
            ac[p] = 1
        elif not ac[p]:
            wa[p] += 1
    return "{} {}".format(sum(ac), sum([w if a else 0 for a, w in zip(ac, wa)]))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))
//  [python]
N, M = map(int, input().split())

AC = 0
WA = 0
AC_count = set()
num = set()

for _ in range(M):
    p, S = input().split()
    if not int(p) in num:
        num.add(int(p))
        if S == 'WA':
            WA += 1
        else:
            AC += 1
            AC_count.add(int(p))
    else:
        if S == 'AC' and not int(p) in AC_count:
            AC += 1
            AC_count.add(int(p))
        elif S == 'WA' and not  int(p) in AC_count:
            WA += 1

print(AC, WA)
//  [python]
N, M = map(int, input().split())

AC = 0
WA = 0
AC_count = set()
num = set()

for _ in range(M):
    p, S = input().split()
    if not int(p) in num:
        num.add(int(p))
        if S == 'WA':
            WA += 1
        else:
            AC += 1
            AC_count.add(int(p))
    else:
        if S == 'AC' and not int(p) in AC_count:
            AC += 1
            AC_count.add(int(p))
        elif S == 'WA' and not  int(p) in AC_count:
            WA += 1
            AC_count.add(int(p))
print(AC, WA)
//  [python]
N, M = map(int, input().split())

AC = 0
WA = 0
AC_count = 0
num = set()

for _ in range(M):
    p, S = input().split()
    if not int(p) in num:
        num.add(int(p))
        AC_count = 0
        if S == 'WA':
            WA += 1
        else:
            AC += 1
            AC_count = 1
    else:
        if S == 'AC' and AC_count == 0:
            AC += 1
            AC_count = 1
        elif S == 'WA' and AC_count == 0:
            WA += 1
print(AC, WA)
//  [java]
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int ac = 0;
    int wa = 0;
    boolean[] end = new boolean[n+2];
    for(int i = 0;i<m;i++){
      int p = sc.nextInt();
      String s = sc.next();
      if(end[p]){
        continue;
      }else if(s.equals("AC")){
        end[p] = true;
        ac++;
      }else{
        wa++;
      }
    }
    System.out.println(ac);
    System.out.println(wa);
  }
}
//  [java]
import java.util.HashSet;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int N = sc.nextInt();
            int M = sc.nextInt();
            int[] p = new int[M];
            String[] S = new String[M];
            for (int i = 0; i < M; i++) {
                p[i] = sc.nextInt();
                S[i] = sc.next();
            }

            HashSet<Integer> setAC = new HashSet<Integer>();
            int countWA = 0;
            for (int i = 0; i < M; i++) {
                if (!setAC.contains(p[i])) {
                    if (S[i].equals("WA")) {
                        countWA++;
                    }
                }
                if (S[i].equals("AC")) {
                    setAC.add(p[i]);
                }
            }

            System.out.println(setAC.size() + " " + countWA);
        }
    }
}
//  [java]
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int a = sc.nextInt();
        int b = sc.nextInt();
        int[] q = new int[b];
        String[] ans = new String[b];
        int[] c = new int[b];
        int wa=0;
        int ac=0;
        
        for(int i=0; i<b; i++){
            q[i] = sc.nextInt();
            ans[i] = sc.next();
            c[i] = 0;
        }
        
        int x=0;
        for(int i=0; i<b; i++){
            if(ans[i].equals("WA") && c[x]!=q[i]){
                wa++;
                //System.out.println(""+q[i]+c[x]);
            }else{
                if(c[x]!=q[i]){
                    ac++;
                    x++;
                    c[x]= q[i];
                }
            }
        }
        
        
        
        System.out.println(""+ac+" "+wa);
   }
}
//  [cpp]
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

int WA[100001];
int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);


	int N = getint(), M = getint();

	rep(i, M) {
		int p = 0;
		char c;
		if (ci - cn + 16 > cm) {
			while ((ct = getcha()) >= '0') p = p * 10 + ct - '0';
			c = getcha();
			getcha();
			getcha();
		}
		else {
			while ((ct = *ci++) >= '0') p = p * 10 + ct - '0';
			c = *ci;
			ci += 3;
		}

		if (WA[p] >= 0) {
			if (c == 'A') WA[p] = -WA[p] - 1;
			else WA[p]++;
		}
	}

	int kotae1 = 0;
	int kotae2 = 0;
	rep1(i, N) {
		if (WA[i] < 0) {
			kotae1++;
			kotae2 -= WA[i];
		}
	}
	printf("%d %d\n", kotae1, kotae2 - kotae1);

	Would you please return 0;
}
//  [cpp]
#include <cstdio>
#include <cctype>
#include <bitset>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
inline int gc()noexcept { return getchar_unlocked(); }
inline int input()noexcept {
	int v = 0; char c = gc();
	for (; isdigit(c); c = gc()) {
		v *= 10;
		v += c - '0';
    }
	return v;
}
bitset<100002> flag;
int main() {
  int n = input(), m = input();
  vector<int> cnt(n);
  int a1 = 0, a2 = 0;
  rep(i, m) {
    int p = input(); --p;
    char c = gc(); gc(); gc();
    if (!flag.test(p)) {
      switch(c) {
        case 'A':
          flag.set(p);
          ++a1;
          break;
        case 'W':
          ++cnt[p];
          break;
      }
    }
  }
  rep(i, n)if (flag.test(i))a2 += cnt[i];
  printf("%d %d", a1, a2);
}
//  [cpp]
#include <bits/stdc++.h>

using namespace std;

int main(){
    int n, m;
    cin >> n >> m;
    int p;
    string s;
    int corr = 0, pen = 0;
    bool was[n]; for (int i = 0; i < n; i++) was[i] = false;
    for (int i = 0; i < m; i++){
        cin >> p >> s;
        if (s == "AC"){
            if (!was[p-1]){
                was[p-1] = true;
                corr++;
            }
        }
        else{
            if (!was[p-1]) pen++;
        }
    }
    cout << corr << ' ' << pen << "\n";
    return 0;
}
//  [cpp]

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int long long
#pragma GCC optimize("O2")
#define sz(x) ((long long)(x).size())
#define all(x)  x.begin(),x.end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl "\n"
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define leastsigbit(x)     __builtin_ffs(x)
const int mod = 1e9 + 7;
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define pii pair<ll,ll>
#define vpii vector<pii>
#define tt ll tt;cin >> tt;while(tt--)
#define  fio ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define D1(x) { cerr << " [" << #x << ": " << x << "]\n"; }
#define D2(x) { cerr << " [" << #x << ": "; for(auto it:x) cerr << it << " "; cerr << "]\n";}
const double PI = acos(-1);
ll power(ll a,ll b,ll m=mod){ ll ans=1; a=a%m;  while(b>0) {  if(b&1)  ans=(1ll*a*ans)%m; b>>=1;a=(1ll*a*a)%m;}return ans;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm( ll x, ll y) { return (x*y)/gcd(x,y);}
bool isprime(ll n){if(n < 2) return 0; ll i = 2; while(i*i <= n){if(n%i == 0) return 0; i++;} return 1;}
bool isPowerOfTwo(int x)
{
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));
}
double distform(int x, int y, int z, int w) {//(x1,y1,x2,y2)
    return sqrt(1. * pow(x-z,2) + 1. * pow(y-w,2));
}
const int MAXN = 2e5+ 10;
const ll inf = 1e18;

int intlog(double base, double x) {
    return (int)(log(x) / log(base));
}
void read(vi & a) {
    for (int i = 0; i < sz(a); ++i) {
        cin >> a[i];
    }
}
int32_t main() {
    fio
    int n,m;
    cin >> n >> m;
    vi p(m);
    vector<vector<string>> subs(n,vector<string>(0));
    vector<string> s(m);
    for (int i = 0; i < m; ++i) {
        cin >> p[i] >> s[i];
        subs[p[i] - 1].pb(s[i]);
    }
    int cnt = 0;
    int ans = 0;
    for (int j = 0; j < n; ++j) {
        for (int i = 0; i < sz(subs[j]); ++i) {
            if(subs[j][i] == "WA") {
                cnt++;
            }
            else if(subs[j][i] == "AC") {
                ans++;
                break;
            }
        }
    }
    cout << ans <<" " << cnt << endl;



}
//  [cpp]
# coding: utf-8


def main():
    N, M = map(int, input().split())
    ans = [0, 0]
    A = [[0, 0] for _ in range(N)]

    for i in range(M):
        p, s = input().split()
        p = int(p)
        if s == 'AC':
            A[p - 1][1] = 1
        elif A[p - 1][1] == 0:
            A[p - 1][0] += 1
    
    for i, j in A:
        if i == 1:
            ans[0] += 1
            ans[1] += j

    print(ans[0], ans[1])

if __name__ == "__main__":
    main()
//  [c]
// ABC 151-C
// 2020.1.12 bal4u

#include <stdio.h>
#include <ctype.h>
#include <string.h>

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif

int in() {   // 非負整数の入力
	int n = 0; int c;
	do c = gc();
	while (isspace(c));
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

int WA[100005];
int AC, NG;

int main()
{
	int p, N, M, S;
	
	N = in(), M = in();
	while (M--) {
		p = in(), S = gc(), gc(), gc();
		if (S == 'A') {
			if (WA[p] >= 0) {
				++AC;
				NG += WA[p];
				WA[p] = -1;
			}
		} else {
			if (WA[p] >= 0) ++WA[p];
		}
	}
	printf("%d %d\n", AC, NG);
	return 0;
}
//  [c]
// ABC 151-C
// 2020.1.12 bal4u

#include <stdio.h>
#include <ctype.h>
#include <string.h>

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif

int in() {   // 非負整数の入力
	int n = 0; int c;
//	do c = gc();
//	while (isspace(c));
	c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

int WA[100005];
int AC, NG;

int main()
{
	int N, M;
	
	N = in(), M = in();
	while (M--) {
		int p = in();
		int S = gc(); gc(), gc();
		if (WA[p] < 0) continue;
		if (S == 'A') {
			++AC, NG += WA[p];
			WA[p] = -1;
		} else ++WA[p];
	}
	printf("%d %d\n", AC, NG);
	return 0;
}
//  [c]
#include<stdio.h>
int main(void){
int n,m,WA=0,AC=0;
  scanf("%d%d",&n,&m);
  int a,wc[100000]={};//なんこ目の問題か
	char s[3];			  
  for(int i=0;i<m;i++){
	scanf("%d %s",&a,s);
   if(wc[a]==-1)continue; 
    if(s[0]=='W')wc[a]++;
    else {
      WA+=wc[a];
      wc[a]=-1;
      AC++;
    }
    
  }
  printf("%d %d",AC,WA);
  return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(){
    int N, M, *p, i, acsum, wasum, *ac, *wa;
    char str[8];
    p = (int *)malloc(M * sizeof(int));
    ac = (int *)malloc(N * sizeof(int));
    wa = (int *)malloc(N * sizeof(int));
    scanf("%d %d", &N, &M);
    for(i = 0;i < M;i++){
        scanf("%d %s", &p[i], str);
        if(strcmp(str, "AC") == 0 && ac[p[i] - 1] == 0){
            ac[p[i] - 1] = 1;
        }else if(strcmp(str, "WA") == 0 && ac[p[i] - 1] != 1){
            wa[p[i] - 1] += 1;
        }
         printf("ac[%d] = %d, wa[%d] = %d\n", i, ac[p[i]-1], i, wa[p[i]-1]);
    }
    for(i = 0;i < N;i++){
        if(ac[i] == 1){
            wasum += wa[i];
        }
        acsum += ac[i];
    }
    printf("%d %d\n", acsum, wasum);
    free(p);
    free(ac);
    free(wa);
    return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){
  int N, M, ac, wa, *count, *er, d;
  char str[8];
  scanf("%d %d", &N, &M);
  ac = 0;
  wa = 0;
  er = (int *)malloc(N * sizeof(int));
  count = (int *)malloc(N * sizeof(int));
  for(int i = 0; i < M;i++){
    scanf("%d %s", &d, str);
    if(strcmp(str, "WA") == 0 && count[d-1] != 1){
      er[d-1] += 1;
    }else if(strcmp(str, "AC") == 0 && count[d-1] != 1){
      ac += 1;
        count[d-1] = 1;
    }
  }
    for(int i = 0;i < M;i++){
        if(count[i] == 1){
            wa += er[i];
        }
    }
  printf("%d %d", ac, wa);
    free(count);
  free(er);
  return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){
  int N, M, ac, wa, *count, d;
  char str[8];
  scanf("%d %d", &N, &M);
  ac = 0;
  wa = 0;
  count = (int *)malloc(N * sizeof(int));
  for(int i = 0; i < M;i++){
    scanf("%d %s", &d, str);
    if(strcmp(str, "WA") == 0 && count[d-1] != 1){
      wa += 1;
    }else if(strcmp(str, "AC") == 0 && count[d-1] != 1){
      ac += 1;
        count[d-1] = 1;
    }
  }
  printf("%d %d", ac, wa);
    free(count);
  return 0;
}
//  [javascript]
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function () { return this.index < this.max },
        "next": function () { if (!this.hasNext()) { throw "ArrayIndexOutOfBoundsException"; } else { return this.list[this.index++]; } }
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    const [N, M] = nextIntArray()
    const ac = new Set()
    const judge = new Array(N).fill(false)
    const cnt = new Array(N).fill(0)
    let wa = 0
    while (hasNext()) {
        let [p, s] = nextStrArray()
        p = Number(p)-1
        if(judge[p]) continue
        if (s == "WA") {
            cnt[p]++
        }
        if (s == "AC") {
            ac.add(p)
            wa += cnt[p]
            judge[p] = true
        }
    }
    console.log(ac.size, wa)
}
Main()
//  [javascript]
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function () { return this.index < this.max },
        "next": function () { if (!this.hasNext()) { throw "ArrayIndexOutOfBoundsException"; } else { return this.list[this.index++]; } }
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    const [N, M] = nextIntArray()
    const ac = new Set()
    const judge = {}
    const cnt = {}
    let wa = 0
    while (hasNext()) {
        let [p, s] = nextStrArray()
        if(judge[p] && judge[p] == "AC") continue
        else {
            if (s == "WA") {
                cnt[p] ? cnt[p]++ : cnt[p] = 1
                judge[p] = "WA"
            }
            if (s == "AC") {
                ac.add(p)
                judge[p] = "AC"
                if(cnt[p]) wa += cnt[p]
            }
        }

    }
    console.log(ac.size, wa)
}
Main()
//  [javascript]
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function () { return this.index < this.max },
        "next": function () { if (!this.hasNext()) { throw "ArrayIndexOutOfBoundsException"; } else { return this.list[this.index++]; } }
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    const [N, M] = nextIntArray()
    const ac = new Set()
    const m = {}
    let wa = 0
    while (hasNext()) {
        let [p, s] = nextStrArray()
        if (s == "WA") {
            if(!m[p]) m[p] = 1
            else if(m[p] !== -1) m[p]++
        }
        if (s == "AC") {
            ac.add(p)
            if(m[p] && m[p] !== -1){
                wa += m[p]
                m[p] = -1
            }           
        }
    }
    console.log(ac.size, wa)
}
Main()
//  [javascript]
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function () { return this.index < this.max },
        "next": function () { if (!this.hasNext()) { throw "ArrayIndexOutOfBoundsException"; } else { return this.list[this.index++]; } }
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    const [N, M] = nextIntArray()
    const ac = new Set()
    const m = new Map()
    let wa = 0
    while (hasNext()) {
        let [p, s] = nextStrArray()
        if (s == "WA" && (!m[p]||m[p] !== -1)) {
            if(!m[p]) m[p] == 1
            else m[p]++
        }
        if (s == "AC") {
            ac.add(p)
            if(!m[p] && m[p] !== -1){
                wa += m[p]
                m[p] = -1
            }           
        }
    }
    console.log(ac.size, wa)
}
Main()
//  [javascript]
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function () { return this.index < this.max },
        "next": function () { if (!this.hasNext()) { throw "ArrayIndexOutOfBoundsException"; } else { return this.list[this.index++]; } }
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    const [N, M] = nextIntArray()
    const ac = new Set()
    const m = new Map()
    let wa = 0
    while (hasNext()) {
        let [p, s] = nextStrArray()
        if (s == "WA" && !m[p]) {
            wa++
        }
        if (s == "AC") {
            ac.add(p)
            m[p] = -1
        }
    }
    console.log(ac.size, wa)
}
Main()
//  [go]
package main

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

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

	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	a, w := make([]int, n, n), make([]int, n, n)
	for i := 0; i < n; i++ {
		a[i], w[i] = 0, 0
	}

	sc.Scan()
	m, _ := strconv.Atoi(sc.Text())

	ac, wa := 0, 0
	for i := 0; i < m; i++ {
		sc.Scan()
		p, _ := strconv.Atoi(sc.Text())
		sc.Scan()
		s := sc.Text()

		if a[p-1] == 1 {
			continue
		}

		if s == "AC" {
			ac++
			a[p-1] = 1
			wa += w[p-1]
		} else {
			w[p-1]++
		}
	}

	fmt.Println(ac, wa)
}
//  [go]
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	N, M := getInt(), getInt()
	ac := make([]bool, N)
	wa := make([]int, N)
	ans := 0
	miss := 0
	for i := 0; i < M; i++ {
		p, s := getInt()-1, getString()
		if ac[p] == false {
			if s == "AC" {
				ac[p] = true
				miss += wa[p]
				ans++
			} else {
				wa[p]++
			}
		}
	}
	out(ans, miss)
}
//  [go]
package main

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

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

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

func main() {
	sc.Split(bufio.ScanWords)

	n, m := nextInt(), nextInt()
	a := make([]int, n)
	ac, wa := 0, 0
	for i := 0; i < m; i++ {
		p := nextInt()
		s := next()

		if a[p-1] == -1 {
			continue
		}
		if s == "WA" {
			a[p-1]++
		} else {
			ac++
			wa += a[p-1]
			a[p-1] = -1
		}
	}

	fmt.Println(ac, wa)
}
//  [go]
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	var n, m int
	n, m = nextInt(), nextInt()
	Ac, Wa := make(map[int]bool, n), make([]int, n)
	Acount, Wcount := 0, 0
	for i := 0; i < m; i++ {
		p, s := nextInt(), nextStr()
		if Ac[p] {
			continue
		}
		if s == "AC" {
			Ac[p] = true
			continue
		}
		Wa[p]++
	}
	for i := 0; i < n; i++ {
		if Ac[i] {
			Acount++
			Wcount += Wa[i]
		}
	}
	fmt.Println(Acount, Wcount)

}

func init() {
	const max = 1024
	var buf = make([]byte, max)
	sc.Buffer(buf, max)
	sc.Split(bufio.ScanWords)
	return
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}
//  [go]
package main

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

func main() {
	n, m := readI(), readI()
	acp := make(map[int]bool)
	ac := 0
	ngp := make(map[int]int)
	for i := 0; i < m; i++ {
		p, s := readI(), readS()
		if !acp[p] {
			if s == "AC" {
				acp[p] = true
				ac++
			} else {
				ngp[p]++
			}
		}
	}
	n = n + 1
	ng := 0
	for _, v := range ngp {
		ng += v
	}
	fmt.Println(ac, ng)
}

/*-----------Input utils-----------*/

var sc = bufio.NewScanner(os.Stdin)

func init() {
	if len(os.Args) >= 2 {
		if os.Args[1] == "debug" {
			debug()
		}
	}
	const buf = 200100
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, buf), buf)
}

func debug() {
	testFile, err := os.Open("./test/sample-1.in")
	if err != nil {
		fmt.Fprintln(os.Stderr, "There is no testfile.")
		os.Exit(1)
	}
	sc = bufio.NewScanner(testFile)
}

func readS() string {
	sc.Scan()
	return sc.Text()
}

func readR() []rune {
	return []rune(readS())
}

func readI() int {
	i, _ := strconv.Atoi(readS())
	return i
}

func readF() float64 {
	f, _ := strconv.ParseFloat(readS(), 64)
	return f
}
//  [go]
package main

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

func main() {
	n, m := readI(), readI()
	acp := make(map[int]bool)
	ac := 0
	ng := 0
	for i := 0; i < m; i++ {
		p, s := readI(), readS()
		if s == "AC" {
			if !acp[p] {
				acp[p] = true
				ac++
			}
		} else {
			if !acp[p] {
				ng++
			}
		}
	}
	n = n + 1
	fmt.Println(ac, ng)
}

/*-----------Input utils-----------*/

var sc = bufio.NewScanner(os.Stdin)

func init() {
	if len(os.Args) >= 2 {
		if os.Args[1] == "debug" {
			debug()
		}
	}
	const buf = 200100
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, buf), buf)
}

func debug() {
	testFile, err := os.Open("./test/sample-1.in")
	if err != nil {
		fmt.Fprintln(os.Stderr, "There is no testfile.")
		os.Exit(1)
	}
	sc = bufio.NewScanner(testFile)
}

func readS() string {
	sc.Scan()
	return sc.Text()
}

func readR() []rune {
	return []rune(readS())
}

func readI() int {
	i, _ := strconv.Atoi(readS())
	return i
}

func readF() float64 {
	f, _ := strconv.ParseFloat(readS(), 64)
	return f
}
//  [ruby]
# frozen_string_literal: true

def cin
  gets.split.map(&:to_i)
end

N, M = cin

ac = wa = 0
misses = Array.new(N + 1, 0)

M.times do
  p, s = gets.split
  p = p.to_i

  next if misses[p] == -1

  if s == 'WA'
    misses[p] += 1
  elsif s == 'AC'
    ac += 1
    wa += misses[p]
    misses[p] = -1
  end
end
puts "#{ac} #{wa}"
//  [ruby]
# frozen_string_literal: true

def cin
  gets.split.map(&:to_i)
end

N, M = cin

ac = pena = 0
misses = Array.new(N + 1, 0)

M.times do
  p, s = gets.split
  p = p.to_i

  next if misses[p] == -1

  if s == 'WA'
    misses[p] += 1
  elsif s == 'AC'
    ac += 1
    pena += misses[p]
    misses[p] = -1
  end
end

puts "#{ac} #{pena}"
//  [ruby]
N, M = gets.split.map(&:to_i)

a = Array.new(N + 1, 0)
pt, pn = 0, 0
M.times do
  p, s = gets.split
  p = p.to_i
  next if a[p] == -1
  if s == 'AC'
    pn += a[p]
    pt += 1
    a[p] = -1
  elsif s == 'WA'
    a[p] += 1
  end
end
puts "#{pt} #{pn}"
//  [ruby]
n,m=gets.split.map(&:to_i)
hash={}
m.times do |i|
    p,s=gets.split
    if hash[p]==nil
        hash[p]=[s]
    else
        hash[p]<<s
    end
end

ac=0
penalty=0
hash.each_value do |s|
    wa=0
    s.each do |i|
        if i=="AC"
            ac+=1
            penalty=wa
            break
        else
            wa+=1
        end
    end
end

puts "#{ac} #{penalty}"
//  [ruby]
n,m=gets.split.map(&:to_i)
hash={}
m.times do |i|
    p,s=gets.split
    if hash[p]==nil
        hash[p]=[s]
    else
        hash[p]<<s
    end
end

ac=0
wa=0
hash.each_value do |s|
    s.each do |i|
        if i=="AC"
            ac+=1
            break
        else
            wa+=1
        end
    end
end

puts "#{ac} #{wa}"
//  [ruby]
N,M = gets.strip.split.map(&:to_i)
array = []
M.times do  #この書き方を覚えよ！！！！、型が別の場合
  j, result = gets.strip.split
  j = j.to_i
  result = result.to_s
  array << [j,result]
end
#入力完了
good = 0
bad = 0
#最後はこれを出力する
for i in 1..N
  k = 0
  m = 0
  s = 0
  while k < M
    if array[k][0] == i
      if array[k][1] == "WA"
        m += 1
      else
        s += 1
        break
      end
    end
    k += 1
  end
  if s == 1
    bad += m
    good += 1
  end
end
puts [good, bad].join(" ")
//  [rust]
fn main() {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    println!("{}", solve(&input));
}

fn solve(input: &str) -> String {
    let mut iter = input.split_whitespace();
    let n: usize = iter.next().unwrap().parse().unwrap();
    let m: usize = iter.next().unwrap().parse().unwrap();
    let mut answered = 0;
    let mut penalty = 0;
    let mut penalties = vec![0; n + 1];
    for _ in 0..m {
        let p: usize = iter.next().unwrap().parse().unwrap();
        let r = iter.next().unwrap();
        if r == "AC" {
            if penalties[p] != -1 {
                answered += 1;
                penalty += penalties[p];
            }
            penalties[p] = -1;
        } else {
            if penalties[p] != -1 {
                penalties[p] += 1;
            }
        }
    }
    format!("{} {}\n", answered, penalty)
}
//  [rust]
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let n: usize = iter.next().unwrap().parse().unwrap();
    let m: i32 = iter.next().unwrap().parse().unwrap();

    let mut accepted = vec![false; n];
    let mut penalty = vec![0; n];
    let mut accepted_num = 0;
    let mut penalty_num = 0;

    let mut a = Vec::new();
    a.push(1);
    for _i in 0..m {
        let p: usize = iter.next().unwrap().parse::<usize>().unwrap() - 1;
        let s: &str = iter.next().unwrap();
        if accepted[p] {
            continue;
        }
        if s == "AC" {
            accepted[p] = true;
            penalty_num += penalty[p];
            accepted_num += 1;
        } else {
            penalty[p] += 1;
        }
    }

    println!("{} {}", accepted_num, penalty_num);
}
//  [rust]
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iter = input.split_whitespace();

    let n: usize = iter.next().unwrap().parse().unwrap();
    let m: usize = iter.next().unwrap().parse().unwrap();

    let mut accepted = vec![false; n + 1];
    let mut warnings = vec![0; n + 1];

    let mut accepts: usize = 0;
    let mut penalties: usize = 0;
    for _ in 0..m {
        let p: usize = iter.next().unwrap().parse().unwrap();
        let s: &str = iter.next().unwrap();

        if s == "AC" && accepted[p] == false {
            accepted[p] = true;
            accepts += 1;
            penalties += warnings[p];
        }
        if s == "WA" {
            warnings[p] += 1;
        }
    }

    return format!("{} {}", accepts, penalties);
}

#[test]
fn test() {
    assert_eq!(solve(r"2 5
    1 WA
    1 AC
    2 WA
    2 AC
    2 WA"), "2 2");
    assert_eq!(solve(r"100000 3
    7777 AC
    7777 AC
    7777 AC"), "1 0");
    assert_eq!(solve(r"6 0"), "0 0");
}
//  [rust]
use whiteread::parse_line;

fn main() {
    let (n, m): (usize, usize) = parse_line().unwrap();
    let mut v: Vec<(bool, u32)> = vec![(false, 0); n];
    let (ac, wa);

    for _ in 0..m {
        let (p, s): (usize, String) = parse_line().unwrap();
        match s.as_str() {
            "AC" => {
                if !v[p - 1].0 {
                    v[p - 1].0 = true;
                }
            }
            "WA" => {
                if !v[p - 1].0 {
                    v[p - 1].1 += 1;
                }
            }
            _ => unreachable!(),
        }
    }
    ac = v.iter().filter(|x| x.0).count();
    wa = v.iter().fold(0, |x, y| x + y.1);
    println!("{} {}", ac, wa);
}
//  [rust]
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n:usize = read();
    let m:usize = read();
    let mut a = vec![0; n];
    let mut w = vec![0; n];
    for _ in 0..m {
        let x:usize = read();
        let s:String = read();
        let x = x - 1;
        if a[x] == 0 && s == "WA" {
            w[x] += 1;
        }
        if s == "AC" {
            a[x] = 1;
        }
    }
    println!(
        "{} {}",
        a.iter().sum::<usize>(),
        w.iter().sum::<usize>()
    );
}
//  [rust]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {n: usize, m: usize};

    let mut r_ac = vec![0; n];
    let mut r_wa: Vec<i128> = vec![0; n];

    let mut ac_count = 0;
    let mut wa_count = 0;

    for _ in 0..m {
        input! {p: usize, s: String};

        let index = p - 1;

        if r_ac[index] == 0 {
            if s == "AC" {
                r_ac[index] = 1;
            // ac_count += 1;
            // wa_count += r_wa[index];
            } else {
                r_wa[index] += 1;
            }
        }
    }

    // print!("{} {}", r_ac.iter().sum::<usize>(), wa_count)
    print!(
        "{} {}",
        r_ac.iter().sum::<usize>(),
        r_wa.iter().sum::<i128>()
    );
}
//  [swift]
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}


func main() {
    let nm = readInts()
    let (n, m) = (nm[0], nm[1])

    var aryAC = [Bool](repeating: false, count: n)
    ///誤答した問題の数
    var aryWA = [Int](repeating: 0, count: n)
    
    for _ in 0..<m {
        let ps = readLine()!.split(separator: " ").map { String($0) }
        let (p, s) = (Int(ps[0])! - 1, ps[1])
        
        if s == "AC" {
            aryAC[p] = true
        }
        if !aryAC[p] {
            aryWA[p] += 1
        }
    }
    
    var ACCounter = 0
    var WACounter = 0
    for i in 0..<n{
        if aryAC[i] {
            ACCounter += 1
            WACounter += aryWA[i]
        }
    }
    print(ACCounter,WACounter)
}
    main()
//  [swift]
let arr=readLine()!.characters.split{$0==" "}.map{Int(String($0))!}
let ( n, m ) = ( arr[0], arr[1] )

var i = 0
var p = 0
var c = 0

var ac = Array(count: n, repeatedValue: 0)
var w = Array(count: n, repeatedValue: 0)
for i in 0..<m {
  let arr1=readLine()!.characters.split{$0==" "}.map{String($0)}
  
  var q: Int! = Int(arr1[0])! - 1
  if (ac[q] == 1 ) {
    continue
  }
  if (arr1[1] == "AC") {
    p += w[q]
    ac[q] = 1
    c += 1
    continue
  } else {
    w[q] += 1
  }  
}

print(c,p)
//  [swift]
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}


func main() {
    let nm = readInts()
    let (n, m) = (nm[0], nm[1])
    ///正答した問題の配列
    var aryAC = [String]()
    ///誤答した問題の数
    var aryWA = [Int](repeating: 0, count: n)
    ///フラグ(ACであればTrue)
    var ACCount = 0
    var WACount = 0
    ///WAを数えるカウンター(ACが出た場合、WACounterに加算しリセットする)
    for i in 0..<m {
        let ps = readLine()!.split(separator: " ").map { String($0) }
        let (p, s) = (ps[0], ps[1])
        
        if s == "AC" {
            if aryAC.firstIndex(of: p) == nil {
                // 初めて正答した場合の処理
                aryAC.append(p)
                ACCount += 1
                WACount += aryWA[Int(p)!-1]
            }
            
        } else {
            aryWA[Int(p)!-1] += 1
        }
    }
    print(ACCount, WACount)
}
    
main()