#![allow(unused_imports)] #![allow(dead_code)] use std::cell::RefCell; use std::cmp::{Ordering, Reverse}; use std::collections::btree_map::Entry as BTreeMapEntry; use std::collections::hash_map::{Entry as HashMapEntry, Entry}; use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque}; use std::fmt::{Debug, Display, Formatter, Write}; use std::hash::Hash; use std::io::{stdin, BufRead, BufWriter, Write as _}; use std::ops::{Bound, ControlFlow, Range, RangeBounds, RangeInclusive}; use std::rc::Rc; use std::str::FromStr; use std::sync::atomic; use std::sync::atomic::AtomicUsize; use std::thread::LocalKey; use std::time::{Duration, Instant}; use std::{array, convert, io, iter, mem, ptr}; pub fn solve(InputObject { cin }: InputObject) { let n: usize = cin.next(); let mut q: usize = cin.next(); let x: Vec = cin.next_vec(n); let mut initialized = HashSet::new(); let mut out = String::from("Yes\n"); 'block: { for &x in x.iter() { if initialized.insert(x) { writeln!(out, "1 {x} {x}").unwrap(); if q == 0 { break 'block; } q -= 1; } writeln!(out, "2 {x}").unwrap(); if q == 0 { break 'block; } q -= 1; } while q > 0 { writeln!(out, "1 1 1").unwrap(); q -= 1; } print!("{out}"); return; } println!("No"); } pub struct InputObject<'a> { cin: &'a mut ConsoleInput, } fn input(cin: &mut ConsoleInput) -> InputObject { InputObject { cin } } pub fn main() { let mut cin = ConsoleInput::new(); let input = input(&mut cin); solve(input); } // libraries below pub struct ConsoleInput { queue: VecDeque, } pub trait Input { fn next(&mut self) -> T; fn next_vec(&mut self, n: usize) -> Vec { (0..n).map(|_| self.next()).collect() } } pub trait Output { fn write(&self); } impl Output for () { fn write(&self) {} } impl Input for ConsoleInput { fn next(&mut self) -> T { match self.read().parse() { Ok(value) => value, _ => panic!("parse error"), } } } impl ConsoleInput { fn new() -> Self { Self { queue: VecDeque::new(), } } fn read(&mut self) -> String { loop { if let Some(s) = self.queue.pop_front() { return s; } let mut s = String::new(); stdin().read_line(&mut s).expect("failed to read"); for s in s.split_ascii_whitespace() { self.queue.push_back(String::from(s)); } } } } fn binary_search(range: Range, f: impl Fn(usize) -> Ordering) -> Result { let mut start = range.start; let mut len = range.len(); if len == 0 { return Err(0); } while len > 1 { let half = len / 2; let mid = start + half; if f(mid) != Ordering::Greater { start = mid; } len -= half; } match f(start) { Ordering::Equal => Ok(start), Ordering::Less => Err(start + 1), Ordering::Greater => Err(start), } } fn all_bits() -> impl Iterator> { (0usize..).map(|i| (0usize..).map(move |j| (j, (i >> j) & 1 != 0))) } #[cfg(test)] mod tests;