#![allow(unused_imports)] use std::cmp::*; use std::collections::*; use std::io::Write; use std::ops::Bound::*; #[allow(unused_macros)] macro_rules! debug { ($($e:expr),*) => { #[cfg(debug_assertions)] $({ let (e, mut err) = (stringify!($e), std::io::stderr()); writeln!(err, "{} = {:?}", e, $e).unwrap() })* }; } fn main() { let v = read_vec::(); let (h, w, q) = (v[0], v[1], v[2] as usize); let mut queries = vec![]; for i in 0..q { let v = read_vec::(); let (y, x) = (v[0] - 1, v[1]); queries.push((y, x)); } let mut count = HashMap::new(); let mut ans = h * w; for (y, x) in queries { if let Some(e) = count.get_mut(&x) { if y < *e { ans -= *e - y; *e = y; } } else { count.insert(x, y); ans -= (h - y); } println!("{}", ans); } } fn read() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() } fn read_vec() -> Vec { read::() .split_whitespace() .map(|e| e.parse().ok().unwrap()) .collect() }