{"similarity_score": 0.9997513674788663, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "//spnauti-rusT {{{\nuse std::io::*; use std::str::{self,*}; use std::fmt::Debug;\n#[allow(unused_imports)] use std::cmp::Ordering::{self,*};\n#[allow(unused_imports)] use std::ops::{self,*};\n#[allow(unused_imports)] use std::iter::{self,*};\n#[allow(unused_imports)] use std::collections::*;\n#[allow(unused_imports)] use std::cell::*;\n#[allow(unused_macros)] macro_rules! min {\n\t($x:expr,$y:expr) => {{ let b=$y; let a=&mut$x; if b < *a {*a=b; true} else {false} }};\n}\n#[allow(unused_macros)] macro_rules! max {\n\t($x:expr,$y:expr) => {{ let b=$y; let a=&mut$x; if b > *a {*a=b; true} else {false} }};\n}\n#[allow(unused_macros)] macro_rules! l {\n\t($($v:ident),+ =$e:expr) => {$(let$v=$e;)+};\n\t($($v:ident),+:$t:ty=$e:expr) => {$(let$v:$t=$e;)+};\n\t(mut $($v:ident),+ =$e:expr) => {$(let mut$v=$e;)+};\n\t(mut $($v:ident),+:$t:ty=$e:expr) => {$(let mut$v:$t=$e;)+};\n}\n#[allow(unused_macros)] macro_rules! v {\n\t([$d:expr]$($s:tt)+) => {vec![v!($($s)+);$d]};\n\t([]) => {Vec::new()}; ([$e:expr]) => {Vec::with_capacity($e)}; (=$e:expr) => {$e};\n}\n#[allow(unused_macros)] macro_rules! rep { {[$c:expr]$($s:tt)+} => {for _ in 0..$c {$($s)+}} }\n#[allow(dead_code)] fn reader() -> WordReaderC { WordReaderC::new() }\n#[allow(dead_code)] fn writer() -> BufWriter { BufWriter::new(stdout()) }\nstruct WordReaderC {buf: Vec, pos: usize, q: std::io::StdinLock<'static>}//'\n#[allow(dead_code)] impl WordReaderC {\n\tfn new() -> Self {\n\t\tlet r = unsafe {&*Box::into_raw(Box::new(stdin()))};\n\t\tSelf { q: r.lock(), buf: Vec::new(), pos: 0 }\n\t}\n\tfn next_line(&mut self) -> bool {\n\t\tself.buf.clear(); self.pos = 0;\n\t\tself.q.read_until(b'\\n', &mut self.buf).unwrap_or(0) > 0\n\t}\n\tfn is_ws(c: u8) -> bool {\n\t\tc == b' ' || c == b'\\r' || c == b'\\n' || c == b'\\t'\n\t}\n\tfn byte(&mut self) -> Option {\n\t\tif self.pos == self.buf.len() { if !self.next_line() { return None; } }\n\t\tself.pos += 1; Some(self.buf[self.pos - 1])\n\t}\n\tfn vb(&mut self) -> Vec {\n\t\tlet mut s = Vec::with_capacity(8);\n\t\tlet mut f = false;\n\t\tloop {\n\t\t\tif let Some(c) = self.byte() {\n\t\t\t\tif !Self::is_ws(c) {\n\t\t\t\t\ts.push(c);\n\t\t\t\t\tf = true;\n\t\t\t\t} else if f { break; }\n\t\t\t} else { break; }\n\t\t}\n\t\ts\n\t}\n\tfn s(&mut self) -> String { String::from_utf8(self.vb()).expect(\"invalid utf8\") }\n\tfn i(&mut self) -> i32 { self.p() }\n\tfn l(&mut self) -> i64 { self.p() }\n\tfn u(&mut self) -> usize { self.p() }\n\tfn f(&mut self) -> f64 { self.p() }\n\tfn vi(&mut self, n: usize) -> Vec { self.vp(n) }\n\tfn vl(&mut self, n: usize) -> Vec { self.vp(n) }\n\tfn vu(&mut self, n: usize) -> Vec { self.vp(n) }\n\tfn ii(&mut self, n: usize) -> impl Iterator { self.ip(n).into_iter() }\n\tfn iu(&mut self, n: usize) -> impl Iterator { self.ip(n).into_iter() }\n\tfn p(&mut self) -> T where T::Err: Debug {\n\t\tlet w = self.vb(); str::from_utf8(w.as_ref()).unwrap().parse::().unwrap()\n\t}\n\tfn vp(&mut self, n: usize) -> Vec where T::Err: Debug {\n\t\t(0..n).map(|_|self.p()).collect()\n\t}\n\tfn ip(&mut self, n: usize) -> impl Iterator where T::Err: Debug {\n\t\tself.vp(n).into_iter()\n\t}\n}\n//------------------- End rusT }}}\n\n// Simple DSU {{{\nstruct DSU {\n\tn: usize,\n\tpar: Vec\n}\n#[allow(dead_code)]impl DSU {\n\tfn new(n: usize) -> Self { let mut d = Self {n:0, par:Vec::new()}; d.resize(n); d }\n\tfn resize(&mut self, n: usize) { self.n = n; self.par.resize(n, 0); self.reset(); }\n\tfn reset(&mut self) { for i in 0..self.n { self.par[i] = i; } }\n\tfn find(&mut self, a: usize) -> usize {\n\t\tif a != self.par[a] { self.par[a] = self.find(self.par[a]); } self.par[a] }\n\tfn union(&mut self, mut a: usize, mut b: usize) -> bool {\n\t\ta = self.find(a); b = self.find(b); if a != b { self.par[a] = b; true } else { false } }\n}//}}}\n// Simple Segtree {{{\nmod simple_full_segtree {\n\tpub type V = (i32,usize);\n\tpub type U = V;\n\tpub type R = V;\n\t#[derive(Clone)]\n\tpub struct Val {\n\t\tval: V\n\t}\n\timpl Val {\n\t\tpub fn default() -> Self {\n\t\t\tSelf::new((0,0))\n\t\t}\n\t\tpub fn new(v: V) -> Self {\n\t\t\tSelf {val: v}\n\t\t}\n\t\tpub fn combine(a: &Self, b: &Self) -> Self {\n\t\t\tSelf::new(a.val.max(b.val))\n\t\t}\n\t\tpub fn update(&mut self, u: U) {\n\t\t\tself.val = u;\n\t\t}\n\t\tpub fn result(&self) -> R {\n\t\t\tself.val\n\t\t}\n\t}\n\tpub struct Tree {\n\t\tn: usize,\n\t\tbase: usize,\n\t\tvalues: Box<[Val]>\n\t}\n\t#[allow(dead_code)]\n\timpl Tree {\n\t\tpub fn new(init: &[V]) -> Self {\n\t\t\tlet n = init.len();\n\t\t\tlet mut base = 1;\n\t\t\twhile base < n {\n\t\t\t\tbase <<= 1;\n\t\t\t}\n\t\t\tlet mut values = vec![Val::default(); base*2];\n\t\t\tfor i in 0..n {\n\t\t\t\tvalues[base + i] = Val::new(init[i]);\n\t\t\t}\n\t\t\tfor i in (1..base).rev() {\n\t\t\t\tvalues[i] = Val::combine(&values[i+i], &values[i+i+1]);\n\t\t\t}\n\t\t\tlet values = values.into_boxed_slice();\n\t\t\tSelf {n, base, values}\n\t\t}\n\t\tpub fn update(&mut self, p: usize, u: U) {\n\t\t\tassert!(p < self.n);\n\t\t\tlet mut p = p + self.base;\n\t\t\tself.values[p].update(u);\n\t\t\tp >>= 1;\n\t\t\twhile p > 0 {\n\t\t\t\tself.values[p] = Val::combine(&self.values[p+p], &self.values[p+p+1]);\n\t\t\t\tp >>= 1;\n\t\t\t}\n\t\t}\n\t\tfn query_sub(&self, ql: usize, qr: usize, l: usize, r: usize, id: usize, val: &mut Val) {\n\t\t\tif r < ql || qr < l { return; }\n\t\t\tif ql <= l && r <= qr {\n\t\t\t\t*val = Val::combine(val, &self.values[id]);\n\t\t\t} else if ql <= r && l <= qr {\n\t\t\t\tlet m = (l+r) >> 1;\n\t\t\t\tself.query_sub(ql, qr, l, m, id+id, val);\n\t\t\t\tself.query_sub(ql, qr, m+1, r, id+id+1, val);\n\t\t\t}\n\t\t}\n\t\tpub fn query(&self, ql: usize, qr: usize) -> Val {\n\t\t\tassert!(ql <= qr && qr < self.n);\n\t\t\tlet mut res = Val::default();\n\t\t\tself.query_sub(ql, qr, 0, self.base-1, 1, &mut res);\n\t\t\tres\n\t\t}\n\t\tpub fn query_all(&self) -> Val {\n\t\t\tself.values[1].clone()\n\t\t}\n\t}\n}//}}}\n\nfn dfs(u: usize, e: &[Vec], dfst: &mut [(usize,usize)], t: &mut usize) {\n\tdfst[u].0 = *t;\n\t*t += 1;\n\tfor &v in e[u].iter() {\n\t\tassert!(dfst[v] == (1,0));\n\t\tdfs(v, e, dfst, t);\n\t}\n\tdfst[u].1 = *t-1;\n}\n\nfn main() {\n\tlet mut rin = reader();\n\tlet mut rout = writer();\n\n\tl!(n,m,q = rin.u());\n\tlet p = rin.vi(n);\n\tlet mut el = v!([m]);\n\tlet mut e = v!([n][]);\n\tfor i in 0..m {\n\t\tl!(a,b = rin.u()-1);\n\t\tel.push( (a,b,q) );\n\t\te[a].push( (b,i) );\n\t\te[b].push( (a,i) );\n\t}\n\tlet mut qq = v!([q]);\n\tfor i in 0..q {\n\t\tlet t = rin.u();\n\t\tlet x = rin.u()-1;\n\t\tqq.push( (t,x) );\n\t\tif t == 2 {\n\t\t\tel[x].2 = i;\n\t\t}\n\t}\n\tlet mut dsu = DSU::new(n*2);\n\tfor i in 0..m {\n\t\tlet (a,b,t) = el[i];\n\t\tif t == q {\n\t\t\tdsu.union(a,b);\n\t\t}\n\t}\n\tlet mut heads = v!([n*2] = 0);\n\tlet mut de = v!([n*2][]);\n\tfor u in 0..n {\n\t\tlet v = dsu.find(u);\n\t\tif v != u {\n\t\t\tde[v].push(u);\n\t\t} else {\n\t\t\theads[u] = u;\n\t\t}\n\t}\n\tlet mut nn = n;\n\tlet mut qt = v!([q] = None);\n\tfor i in (0..q).rev() {\n\t\tlet (t,x) = qq[i];\n\t\tif t == 2 {\n\t\t\tlet (a,b,_) = el[x];\n\t\t\tlet aa = heads[dsu.find(a)];\n\t\t\tlet bb = heads[dsu.find(b)];\n\t\t\tif aa != bb {\n\t\t\t\tdsu.union(a,b);\n\t\t\t\tdsu.union(a,nn);\n\t\t\t\theads[dsu.find(a)] = nn;\n\t\t\t\tde[nn].push(aa);\n\t\t\t\tde[nn].push(bb);\n\t\t\t\tqt[i].replace(nn);\n\t\t\t\tnn += 1;\n\t\t\t}\n\t\t}\n\t}\n\tlet mut dfst = v!([n*2] = (1,0));\n\tlet mut t = 0;\n\tfor i in (0..nn).rev() {\n\t\tif dfst[i] == (1,0) {\n\t\t\tdfs(i, &de, &mut dfst, &mut t);\n\t\t}\n\t}\n\tlet mut intervals = BTreeSet::new();\n\tfor i in 0..nn {\n\t\tif i == heads[dsu.find(i)] {\n\t\t\tlet (s,e) = dfst[i];\n\t\t\tintervals.insert( (e,s) );\n\t\t}\n\t}\n\tlet mut z = v!([nn] = (0,0));\n\tfor i in 0..n {\n\t\tz[dfst[i].0] = (p[i],i);\n\t}\n\t// writeln!(rout, \"z : {:?}\", z).ok();\n\t// for i in 0..nn {\n\t// \twriteln!(rout, \"{} : {:?}\", i, dfst[i]).ok();\n\t// }\n\t// writeln!(rout, \"intervals : {:?}\", intervals).ok();\n\tuse std::ops::Bound::*;\n\tlet mut st = simple_full_segtree::Tree::new(&z);\n\tfor i in 0..q {\n\t\tlet (t,x) = qq[i];\n\t\tif t == 1 {\n\t\t\tlet (r,l) = *intervals.range((Excluded( (dfst[x].0,0) ),Unbounded)).next().unwrap();\n\t\t\tlet (v,pos) = st.query(l,r).result();\n\t\t\t// writeln!(rout, \"query {} {} : {} {}\", l, r, v, pos).ok();\n\t\t\tif v > 0 {\n\t\t\t\tst.update(dfst[pos].0, (0,0));\n\t\t\t}\n\t\t\twriteln!(rout, \"{}\", v).ok();\n\t\t} else if let Some(id) = qt[i] {\n\t\t\tassert!(de[id].len() == 2);\n\t\t\tlet a = de[id][0];\n\t\t\tlet b = de[id][1];\n\t\t\tintervals.remove( &(dfst[id].1,dfst[id].0) );\n\t\t\tintervals.insert( (dfst[a].1,dfst[a].0) );\n\t\t\tintervals.insert( (dfst[b].1,dfst[b].0) );\n\t\t}\n\t}\n}\n", "lang": "Rust", "bug_code_uid": "89b707b0ee27701768e3ef4750cc3920", "src_uid": "ad014bde729222db14f38caa521e4167", "apr_id": "eb4cbcf8d9f7f0970deabf3bf4a83298", "difficulty": 2600, "tags": ["dsu", "data structures", "implementation", "graphs", "trees"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9841703395617357, "equal_cnt": 14, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 8, "fix_ops_cnt": 13, "bug_source_code": "use std::cmp::*;\nuse std::collections::*;\nuse std::io::*;\nuse std::str::*;\n\n// scanner from https://codeforces.com/contest/1396/submission/91365784\nstruct Scanner {\n stdin: Stdin,\n buffer: VecDeque,\n}\n#[allow(dead_code)]\nimpl Scanner {\n fn new() -> Self {\n Scanner {\n stdin: stdin(),\n buffer: VecDeque::new(),\n }\n }\n fn cin(&mut self) -> T {\n while self.buffer.is_empty() {\n let mut line = String::new();\n let _ = self.stdin.read_line(&mut line);\n for w in line.split_whitespace() {\n self.buffer.push_back(String::from(w));\n }\n }\n self.buffer.pop_front().unwrap().parse::().ok().unwrap()\n }\n fn chars(&mut self) -> Vec {\n self.cin::().chars().collect()\n }\n fn vec(&mut self, n: usize) -> Vec {\n (0..n).map(|_| self.cin()).collect()\n }\n fn u(&mut self) -> usize {\n self.cin()\n }\n fn ll(&mut self) -> i64 {\n self.cin()\n }\n fn ull(&mut self) -> u64 {\n self.cin()\n }\n fn vecu(&mut self, n: usize) -> Vec {\n self.vec(n)\n }\n fn vecll(&mut self, n: usize) -> Vec {\n self.vec(n)\n }\n}\n\n#[derive(Clone, Debug, Default)]\nstruct Solver {}\n\n//\n// DSU\n//\n\n#[derive(Debug, Clone)]\nstruct DSU {\n v: Vec,\n n: usize,\n}\n\nimpl DSU {\n fn new(size: usize) -> DSU {\n let mut v = vec![0; size];\n for i in 0..size {\n v[i] = i;\n }\n DSU { v: v, n: size }\n }\n\n fn find(&mut self, x: usize) -> usize {\n if self.v[x] == x {\n x\n } else {\n self.v[x] = self.find(self.v[x]);\n self.v[x]\n }\n }\n\n fn is_same(&mut self, x: usize, y: usize) -> bool {\n self.find(x) == self.find(y)\n }\n\n fn unify(&mut self, x: usize, y: usize) {\n let xx = self.find(x);\n let yy = self.find(y);\n if xx != yy {\n self.v[yy] = xx;\n }\n }\n}\n\n//\n// Segment Tree\n//\n\n#[derive(Clone)]\nstruct SegmentTree {\n v: Vec,\n offset: usize,\n comb: fn(T, T) -> T,\n unit: T,\n}\n\n#[allow(dead_code)]\nimpl SegmentTree {\n fn new(n: usize, unit: T, comb: fn(T, T) -> T, vv: Option<&Vec>) -> SegmentTree {\n let mut x = 1;\n while x < n {\n x *= 2;\n }\n\n let mut v = vec![unit; x * 2];\n if let Some(vv) = vv {\n for i in 0..n {\n v[x + i] = (*vv)[i];\n }\n for i in (0..x).rev() {\n v[i] = comb(v[i * 2], v[i * 2 + 1]);\n }\n }\n\n SegmentTree {\n v: v,\n offset: x,\n comb,\n unit: unit,\n }\n }\n\n fn update(&mut self, pos: usize, val: T) {\n let mut p = self.offset + pos;\n self.v[p] = val;\n while p != 1 {\n p /= 2;\n self.v[p] = (self.comb)(self.v[p * 2], self.v[p * 2 + 1]);\n }\n }\n\n fn get(&self, pos: usize) -> T {\n self.v[self.offset + pos]\n }\n\n fn query_range_all(&self) -> T {\n self.query_range(0, self.offset)\n }\n\n fn query_range(&self, begin: usize, end: usize) -> T {\n self.query_range_sub(begin, end, 1, 0, self.offset)\n }\n\n // v[node] は 区間 l .. r-1 の計算結果を持っている\n fn query_range_sub(&self, begin: usize, end: usize, node: usize, l: usize, r: usize) -> T {\n if end <= l || r <= begin {\n return self.unit.clone();\n } else if begin <= l && r <= end {\n return self.v[node].clone();\n } else {\n let lval = self.query_range_sub(begin, end, node * 2, l, (l + r) / 2);\n let rval = self.query_range_sub(begin, end, node * 2 + 1, (l + r) / 2, r);\n return (self.comb)(lval, rval);\n }\n }\n}\n\nimpl Solver {\n fn solve(&mut self, scan: &mut Scanner, out: &mut BufWriter) {\n //1416d\n\n let n = scan.u();\n let m = scan.u();\n let q = scan.u();\n let p = scan.vecu(n);\n\n let mut edges = Vec::with_capacity(m);\n for _ in 0..m {\n let x = scan.u() - 1;\n let y = scan.u() - 1;\n edges.push((x, y));\n }\n\n let mut vq = Vec::with_capacity(q);\n let mut vq1 = Vec::with_capacity(q); // vertex : そのグループ内の最大のpを0にする\n let mut vq2 = Vec::with_capacity(q); // edge : (edge_id, Some(r_vertex_id)) このクエリを処理するときに e_vertex_id 以降を切り離す\n\n let mut eid_to_q2id = vec![q; m];\n for _ in 0..q {\n let x = scan.u();\n let y = scan.u();\n vq.push(x);\n\n if x == 1 {\n vq1.push(y - 1);\n } else {\n eid_to_q2id[y - 1] = vq2.len();\n vq2.push((y - 1, None));\n }\n }\n\n /*\n エッジ削除のクエリを逆順にして、このクエリはどのグループとどのグループをくっつけるか、をDSUを使って調べる。\n x-yにエッジを追加 = (xのroot)の子として(yのroot)を追加\n x-yのエッジを削除 = (xのroot)から(yのroot)を切り離す\n\n */\n let mut eidq2id: Vec<(usize, usize)> = eid_to_q2id.into_iter().enumerate().collect(); // (edge_id, query2_id)\n eidq2id.sort_by_key(|x| q - x.1);\n\n let mut dsu = DSU::new(n);\n let mut child = vec![Vec::new(); n];\n for (edge_id, q2id) in eidq2id {\n let e = edges[edge_id];\n if !dsu.is_same(e.0, e.1) {\n let e0 = dsu.find(e.0);\n let e1 = dsu.find(e.1);\n dsu.unify(e0, e1);\n\n child[e0].push(e1);\n if q2id != q {\n vq2[q2id].1 = Some(e1);\n }\n }\n }\n /*\n 頂点の順番を並び替える。\n 各rootからdfsで通った順にする。\n (xのroot)から(yのroot)を切り離す は、 (yのroot)の手前で分割する と同じになる\n */\n let mut pos_to_vid = Vec::with_capacity(n);\n fn dfs(vid: usize, pos_to_vid: &mut Vec, child: &Vec>) {\n pos_to_vid.push(vid);\n for &child_vid in &child[vid] {\n dfs(child_vid, pos_to_vid, child);\n }\n }\n\n let mut partitions = BTreeSet::new();\n partitions.insert(0);\n for i in 0..n {\n if i == dsu.find(i) {\n dfs(i, &mut pos_to_vid, &child);\n }\n partitions.insert(pos_to_vid.len());\n }\n\n //\n let mut vid_to_pos = vec![0; n];\n let mut v = vec![(0, 0); n];\n for pos in 0..n {\n let vid = pos_to_vid[pos];\n v[pos] = (p[vid], vid);\n vid_to_pos[vid] = pos;\n }\n let mut s = SegmentTree::new(n, (0usize, 0usize), |l, r| max(l, r), Some(&v));\n\n vq1.reverse();\n vq2.reverse();\n for i in 0..q {\n // for pos in 0..n {\n // if partitions.contains(&pos) {\n // print!(\"|\");\n // }\n // print!(\"{:?} \", s.v[s.offset + pos]);\n // }\n // println!(\"\");\n\n if vq[i] == 1 {\n let vid = vq1.pop().unwrap();\n let lpos = partitions.range(..=vid).next_back().unwrap();\n let rpos = partitions.range(vid + 1..).next().unwrap();\n let (val, vid) = s.query_range(*lpos, *rpos);\n writeln!(out, \"{}\", val).ok();\n s.update(vid_to_pos[vid], (0, vid));\n } else {\n if let Some((_, Some(vid))) = vq2.pop() {\n partitions.insert(vid_to_pos[vid]);\n }\n }\n }\n }\n}\n\nfn solve() {\n let mut scan = Scanner::new();\n let out = &mut BufWriter::new(stdout());\n\n let testcase = 1;\n //let testcase: usize = scan.cin();\n for _ in 0..testcase {\n let mut s: Solver = Default::default();\n s.solve(&mut scan, out);\n }\n}\n\nfn main() {\n let th = std::thread::Builder::new().stack_size(64 * 1024 * 1024);\n th.spawn(|| solve()).unwrap().join().unwrap()\n}\n", "lang": "Rust", "bug_code_uid": "da68844532316091fc7d2d286e629ec3", "src_uid": "ad014bde729222db14f38caa521e4167", "apr_id": "78eb27faaf76f56ebd70bfd0c516d2b8", "difficulty": 2600, "tags": ["dsu", "data structures", "implementation", "graphs", "trees"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.19205298013245034, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "fn main() {\n println!(\"YSS\");\n}\n", "lang": "Rust", "bug_code_uid": "64fd11fe684b183550678ccbe7f8c850", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "b2c5be4743a4bd6bf9bc8d7405234ee7", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9820359281437125, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io;\n\nfn main() {\n let mut input = String::new();\n\n io::stdin().read_line(&mut input);\n\n let n : i128 = input.trim().parse().unwrap();\n \n if n % 2 == 0 {\n println!(\"YES\");\n }else{\n println!(\"NO\");\n };\n}\n", "lang": "Rust", "bug_code_uid": "27fcd05c90c4b8f3107a6d4387918951", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "f15b6f8b28ffca9d23528569c2ca4cd6", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9860834990059643, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io;\n\nfn main() {\n let mut s = String::with_capacity(3);\n io::stdin().read_line(&mut s).unwrap();\n let n: u8 = s.parse().unwrap();\n\n if n % 2 == 0 && n > 2 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}\n", "lang": "Rust", "bug_code_uid": "0dd3270b6c9e4e0393d140dfff386d8d", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "6a51ac4eafe1c8944167d03a914c556a", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.6706706706706707, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "// https://codeforces.com/problemset/problem/4/A\n\nuse std::{\n io::{\n stdin,\n stdout,\n },\n vec::Vec,\n};\n\nfn main() {\n let inp = stdin();\n let mut num_str = String::new();\n inp.read_to_string(&mut num_str);\n\n let num = num_str.parse::().unwrap();\n\n if num % 2 == 0 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}\n", "lang": "Rust", "bug_code_uid": "b8552311e956fce483e86d4ee4482ab6", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "c33f14e5b620c6dcd05d152408370a10", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.6861167002012073, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "// https://codeforces.com/problemset/problem/4/A\n\nuse std::{\n io::{\n stdin,\n stdout,\n },\n vec::Vec,\n};\n\nfn main() {\n let inp = stdin();\n let mut num_str = String::new();\n inp.read_line(&mut num_str);\n\n let num = num_str.parse::().unwrap();\n\n if num % 2 == 0 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}\n", "lang": "Rust", "bug_code_uid": "18b16e92a01142853cbf647331f306ed", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "c33f14e5b620c6dcd05d152408370a10", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9447748513169074, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "// https://codeforces.com/problemset/problem/4/A\n\nuse std::{\n io::{\n stdin,\n stdout,\n },\n vec::Vec,\n};\n\nfn main() {\n let inp = stdin();\n let mut num_str = String::new();\n match inp.read_line(&mut num_str) {\n Err(e) => println!(\"{}\", e),\n _ => ()\n }\n\n let num = match num_str.trim().parse::() {\n Ok(val) => val,\n Err(e) => {\n println!(\"{}\", e);\n return;\n }\n };\n\n if num % 2 == 0 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}\n", "lang": "Rust", "bug_code_uid": "5e6ac486e40ecdd531e7f5a563ee797d", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "c33f14e5b620c6dcd05d152408370a10", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9969230769230769, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "use std::io;\n\nfn main() {\n let mut melon = String::new();\n\n io::stdin().read_line(&mut melon)\n .expect(\"Error while reading input\");\n\n let melon: u8 = melon.trim().parse().expect(\"Illegal input\");\n\n if (melon > 0) && (melon % 2 == 0) {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}\n", "lang": "Rust", "bug_code_uid": "69732516ca5897f9fed6b62f79b73353", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "3b8465f97b699db62125369040eebb71", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.724907063197026, "equal_cnt": 10, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 9, "bug_source_code": "fn main() {\n let mut number_line = String::new();\n std::io::stdin().read_line(&mut number_line).unwrap();\n let number: i32 = number_line.trim().parse().unwrap();\n println!(\"{}\", if number % 2 == 0 { \"YES\" } else { \"NO\" });\n}\n", "lang": "Rust", "bug_code_uid": "6263459d346288684e90fc57ad5b6c91", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "3b8465f97b699db62125369040eebb71", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.31711145996860285, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 8, "bug_source_code": "fn watermelon(weight: usize) -> String {\n match weight % 2 {\n 0 => \"YES\",\n _ => \"NO\",\n }.to_string()\n}", "lang": "Rust", "bug_code_uid": "8290372f7bd2c85fd28d121a9e805d31", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "56e3a2be37c0afc6ad4b710eaa377490", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.6721991701244814, "equal_cnt": 10, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "use std::io::*;\n\nfn main() -> std::io::Result<()> {\n let mut input = String::with_capacity(3);\n std::io::stdin().read_to_string(&mut input)?;\n \n std::io::stdout().write_all(\n watermelon(\n input.parse::().unwrap()\n )\n )?;\n \n Ok(())\n}\n\nfn watermelon(weight: isize) -> &'static [u8] {\n if weight == 2 {return b\"NO\";}\n match weight % 2 {\n 0 => b\"YES\",\n _ => b\"NO\",\n }\n}", "lang": "Rust", "bug_code_uid": "19d054e519e633ad6fe87d27c0c9f0e8", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "56e3a2be37c0afc6ad4b710eaa377490", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.6694214876033058, "equal_cnt": 10, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "use std::io::*;\n\nfn main() -> std::io::Result<()> {\n let mut input = String::with_capacity(3);\n std::io::stdin().read_to_string(&mut input)?;\n \n std::io::stdout().write_all(\n watermelon(\n input.parse::().unwrap_or(0)\n )\n )?;\n \n Ok(())\n}\n\nfn watermelon(weight: isize) -> &'static [u8] {\n if weight == 2 {return b\"NO\";}\n match weight % 2 {\n 0 => b\"YES\",\n _ => b\"NO\",\n }\n}", "lang": "Rust", "bug_code_uid": "3ede657ac269ebd30a6ec4e0901414ad", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "56e3a2be37c0afc6ad4b710eaa377490", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.844311377245509, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "fn main() {\n let mut input = String::new();\n std::io::stdin()\n .read_line(&mut input)\n .ok()\n .expect(\"Read Error\");\n\n let n = input.trim().parse::().ok().unwrap_or(0);\n\n if n % 2 == 0 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}\n", "lang": "Rust", "bug_code_uid": "d42d504bcd5a1163f978ae9f34d9c3e4", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "005f4c9a5c43745acbe60ac619ac6ef2", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9674418604651163, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "use std::io;\nuse std::str::FromStr;\n\nfn main() {\n let mut buf = String::new();\n io::stdin().read_line(&mut buf).unwrap();\n let w = i32::from_str(buf.trim()).unwrap();\n println!(\n \"{}\",\n match w % 2 == 0 && w / 2 % 2 == 0 {\n true => \"YES\",\n false => \"NO\",\n }\n )\n}\n", "lang": "Rust", "bug_code_uid": "526f7039575c0780edee87f893218953", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "49aaee8ee12b1163654986f2a743a345", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.7447774750227066, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "use std::io::{self, Read};\n\nfn main() {\n let mut stdin = io::stdin();\n let mut buf = String::new();\n stdin.read_to_string(&mut buf).unwrap();\n\n let input = buf.parse().unwrap();\n\n if can_div_melon(input) {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}\n\nfn can_div_melon(input: u64) -> bool {\n input % 2 == 0\n}\n\n#[cfg(test)]\nmod test {\n use super::*;\n\n #[test]\n fn test_pave() {\n assert_eq!(true, can_div_melon(8));\n }\n}\n", "lang": "Rust", "bug_code_uid": "3f9f79854a0ad9957420132979cdec82", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "9a1ad91fcbf9bf11dbb8425b3a071f62", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9023746701846965, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "use std::io::{self, Read};\n\nfn main() {\n let stdin = io::stdin();\n let mut buf = String::new();\n stdin.read_line(&mut buf).unwrap();\n\n let input = buf.trim();\n let input = input.parse().expect(\"error parsing\");\n\n if can_div_melon(input) {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}\n\nfn can_div_melon(input: u64) -> bool {\n input % 2 == 0\n}\n\n#[cfg(test)]\nmod test {\n use super::*;\n\n #[test]\n fn test_pave() {\n assert_eq!(true, can_div_melon(8));\n }\n}\n", "lang": "Rust", "bug_code_uid": "663380cb0e6de8fed92adcbe947ef539", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "9a1ad91fcbf9bf11dbb8425b3a071f62", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.7176724137931034, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 6, "bug_source_code": "use std::io::{self, Read};\n\nfn main() -> io::Result<()> {\n let mut buffer = String::new();\n io::stdin()\n .read_to_string(&mut buffer)\n .unwrap();\n let kilos = buffer\n .trim()\n .parse::()\n .unwrap();\n\n if kilos % 8 == 0 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n\n Ok(())\n}\n", "lang": "Rust", "bug_code_uid": "65f93109ee5a4becdd3ef12de18fcfc5", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "73bf341cacfca81f42d10abef677e66f", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9802371541501976, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "use std::io;\nfn main() {\n let i = input();\n if i % 2 == 0 || i == 2 && i-i == 0 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}\n\ntype IR = i32;\nfn input() -> IR {\n let mut v = String::new(); let mut _string: String;\n match io::stdin().read_line(&mut v) {\n Ok(_) => {\n _string = v; \n },\n Err(error) => {\n _string = \"0\".to_string();\n println!(\"{}\", error);\n },\n }\n _string.trim().parse::().unwrap()\n}", "lang": "Rust", "bug_code_uid": "67790f60f25dcb86e7bb141bf3e9a407", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "9bc9bae5389c57f0583fb2049c1bcfed", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Rust"} {"similarity_score": 0.2895805142083897, "equal_cnt": 10, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 11, "bug_source_code": "fn main() {\n let watermelon = kd(k);\n if watermelon {\n println!(\"YES\");\n } else {\n println!(\"NO\")\n }\n}\nfn kd(k: i32) -> bool {\n if k % 2 != 0 || k > 100 || k-k == 2 * k { return false; }\n return true\n}", "lang": "Rust", "bug_code_uid": "4d44b76c9a7c188665ffff7515e36580", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "9bc9bae5389c57f0583fb2049c1bcfed", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9116883116883117, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fn main() {\n let mut v = String::new();\n std::io::stdin().read_line(&mut v);\n let v = v.trim();\n let result = v.parse::();\n let num:u32;\n match result {\n Ok(v)=> num = v,\n Err(e)=> panic!(\"failed to parse {}\",e)\n }\n if num % 2 == 0\n {\n println!(\"YES\")\n } else {\n println!(\"NO\");\n }\n\n}\n", "lang": "Rust", "bug_code_uid": "43efcf3a9b37cd0e99938721af2f2061", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "f0cd5d97eaf498357d294830590c2e7d", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9789156626506024, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io::stdin;\n\nfn read_int() -> i8 {\n let mut buffer: String = String::new();\n stdin().read_line(&mut buffer).expect(\"Error\");\n buffer.trim().parse::().unwrap()\n}\n\nfn main() {\n let value: i8 = read_int();\n if value % 2 == 0 {\n println!(\"YES\");\n }\n else {\n println!(\"NO\");\n }\n}\n", "lang": "Rust", "bug_code_uid": "4626cab8f418687b207d44843ac78157", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "4e4b28ab52ae027eecf47b7a912ffc7b", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.8877721943048577, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "use std::io;\n\n\nfn is_even(number: u32) -> bool {\n number % 2 == 0\n}\n\nfn main() {\n let mut weight = String::new();\n io::stdin().read_line(&mut weight).unwrap();\n let weight: u32 = weight.trim().parse().unwrap();\n println!(\"{}\", if is_even(weight) {\"YES\"} else {\"NO\"});\n}\n", "lang": "Rust", "bug_code_uid": "53912e0f92797133aeeee5c751a7804a", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "0011ee55c63c0682ffa582ef5e76b911", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9789303079416531, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "use std::io;\n\n\nfn is_splittable(weight: u32) {\n weight > 2 && weight % 2 == 0;\n}\n\n\nfn main() {\n let mut weight = String::new();\n io::stdin().read_line(&mut weight).unwrap();\n let weight: u32 = weight.trim().parse().unwrap();\n println!(\"{}\", if is_splittable(weigth) {\"YES\"} else {\"NO\"});\n}\n", "lang": "Rust", "bug_code_uid": "23b277d9c12e1c74ca2f967181ea935d", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "0011ee55c63c0682ffa582ef5e76b911", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9854304635761589, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "use std::io;\n\nfn main() {\n let mut w = String::new();\n io::stdin()\n .read_line(&mut w)\n .expect(\"Read error\");\n \n let w: isize = w.parse().expect(\"Parse error\");\n \n let mut i = 0;\n while i < w && (i % 2 == 1 || (w - i) % 2 == 1) {\n i += 1;\n }\n\n if (i < w) {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}", "lang": "Rust", "bug_code_uid": "fde035ec8d77aac691d67ec7bf0fea4a", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "fcd575f0eadd9a820659de6e02c0932a", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Rust"} {"similarity_score": 0.9973684210526316, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "use std::io;\n\nfn main() {\n let mut w = String::new();\n io::stdin()\n .read_line(&mut w)\n .expect(\"Read error\");\n \n let w: isize = w.trim().parse().expect(\"Parse error\");\n \n let mut i = 0;\n while i < w && (i % 2 == 1 || (w - i) % 2 == 1) {\n i += 1;\n }\n\n if i < w {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}", "lang": "Rust", "bug_code_uid": "65693145c097e9c57d49ef189a7dde5a", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "fcd575f0eadd9a820659de6e02c0932a", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9638888888888889, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "use std::io;\n\nfn even_parts(w: i32) -> &'static str {\n match w % 2 {\n 0 => \"yes\",\n _ => \"no\",\n }\n}\n\nfn main() {\n let mut input = String::new();\n io::stdin()\n .read_line(&mut input)\n .expect(\"Failed to read input\");\n let rinput: i32 = input.trim().parse().unwrap();\n println!(\"{}\", even_parts(rinput));\n}", "lang": "Rust", "bug_code_uid": "71d4bcdc9bc77b280d51148e59ac1fd2", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "614374c4b6bcfc5be17c99515c303294", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9724770642201835, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "use std::io;\n\nfn even_parts(w: i32) -> &'static str {\n match w % 2 == 0 && w != 2 {\n true => \"yes\",\n false => \"no\",\n }\n}\n\nfn main() {\n let mut input = String::new();\n io::stdin()\n .read_line(&mut input)\n .expect(\"Failed to read input\");\n let rinput: i32 = input.trim().parse().unwrap();\n println!(\"{}\", even_parts(rinput));\n}\n[2:39 PM] fl: heres ", "lang": "Rust", "bug_code_uid": "01a59e14c43a28cc30d6d90d813d5215", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "614374c4b6bcfc5be17c99515c303294", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Rust"} {"similarity_score": 0.9122203098106713, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "use std::io;\nfn main(){\n let mut x = String::new();\n io::stdin().read_line(&mut x).expect(\"there is not input\");\n let x:u32 = x.trim().parse().expect(\"not ingeger\");\n if x % 2 == 0{\n println!(\"YES\\n\");\n }else{\n println!(\"NO\\n\");\n }\n}", "lang": "Rust", "bug_code_uid": "8791719e61c7ca45cc2e54990b2cc211", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "0ef474666a5511d48779ca4f11320e3c", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.99568345323741, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fn main() {\n let mut input = String::new();\n std::io::stdin().read_line(&mut input).expect(\"Failed\");\n\n let weight = input.trim().parse::().unwrap_or(-1);\n\n if weight < 1 || weight > 100 {\n println!(\"NO\");\n return;\n }\n\n if weight % 2 == 0 {\n println!(\"YES\");\n return;\n }\n\n println!(\"NO\");\n}", "lang": "Rust", "bug_code_uid": "5f9fb5260da0b839ceee561b5d889da3", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "526cae8e63d881b7e0b10963afbde6ba", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9805194805194806, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io::stdin;\n\nfn main() {\n let stdin = stdin();\n let mut b: String = String::new();\n stdin.read_line(&mut b).ok().expect(\"Error read line\");\n let num: i32 = b.trim().parse::().unwrap();\n if num % 2 == 0 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}\n", "lang": "Rust", "bug_code_uid": "1abd2aafb29c3467f75368a3468633fb", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "74c28697eeeda295b276bb4cf54e4e4f", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9977151561309977, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fn main() {\n let input = get_input().parse::().unwrap();\n let mut flag = false;\n\n for i in 1..input+1 {\n if (i % 2 == 0) && ((input - i) % 2 == 0) {\n flag = true;\n break;\n }\n }\n\n if flag {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}\n\nfn get_input() -> String {\n use std::io::{stdin,stdout,Write};\n let mut s=String::new();\n stdout().flush().expect(\"Output Error!\");\n stdin().read_line(&mut s).expect(\"Input Error!\");\n if let Some('\\n')=s.chars().next_back() {\n s.pop();\n }\n if let Some('\\r')=s.chars().next_back() {\n s.pop();\n }\n\n s\n}\n\n", "lang": "Rust", "bug_code_uid": "ce646a0ba02545d216d3c69f1568732f", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "77032a70c31fb7fca3eafdc47a592a49", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Rust"} {"similarity_score": 0.977299880525687, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#[allow(unused_imports)]\nuse std::cmp::{min,max};\nuse std::io::{BufWriter, stdin, stdout, Write};\n\n#[derive(Default)]\nstruct Scanner {\n buffer: Vec\n}\nimpl Scanner {\n fn next(&mut self) -> T {\n loop {\n if let Some(token) = self.buffer.pop() {\n return token.parse().ok().expect(\"Failed parse\");\n }\n let mut input = String::new();\n stdin().read_line(&mut input).expect(\"Failed read\");\n self.buffer = input.split_whitespace().rev().map(String::from).collect();\n }\n }\n}\n\nfn main() {\n let mut scan = Scanner::default();\n let out = &mut BufWriter::new(stdout());\n \n if (scan.next::() - 2) % 2 == 0 {\n writeln!(out, \"Yes\").ok();\n } else {\n writeln!(out, \"No\").ok();\n } \n\n}", "lang": "Rust", "bug_code_uid": "54fd43807782f363454f3909999056a0", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "f89e5fae39b42cd055e6a6b21e44bf73", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9764150943396226, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io;\n\nfn main() {\n\tlet mut s = String::new();\n\tio::stdin().read_line(&mut s).unwrap();\n\tlet w = s.trim().parse::().unwrap();\n\tif w % 2 == 0 {\n\t\tprintln!(\"YES\");\n\t} else {\n\t\tprintln!(\"NO\");\n\t}\n}\n", "lang": "Rust", "bug_code_uid": "3d6e91b4b334a06361866ff088a106e5", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "07d0350f916bd00dce36477065986fd7", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.7927170868347339, "equal_cnt": 13, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 7, "fix_ops_cnt": 12, "bug_source_code": "use std::io;\nuse std::io::stdin;\nuse term::stdout;\n\nfn main() {\n\n let mut input = String::new();\n\n io::stdin()\n .read_line(&mut input);\n\n let weight:u32 = match input.trim().parse() {\n Ok(num) => num,\n Err(e) => e,\n };\n\n if weight%2 = 0 {\n println!(\"YES\")\n } else {\n println!(\"NO\")\n }\n\n}\n", "lang": "Rust", "bug_code_uid": "c733272454f9d0fca84ebba2b5740cc6", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "751deffc11e81dc8786c95e02145fe45", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9527777777777777, "equal_cnt": 11, "replace_cnt": 1, "delete_cnt": 3, "insert_cnt": 6, "fix_ops_cnt": 10, "bug_source_code": "use std::io;\n\nfn main() {\n\n let mut input = String::new();\n\n io::stdin()\n .read_line(&mut input)\n .expect(\"Error\");\n\n let weight:u32 = match input.trim().parse() {\n Ok(num) => num,\n Err(_) => 0,\n };\n\n if weight != 0 && weight % 2 == 0 {\n println!(\"YES\")\n } else {\n println!(\"NO\")\n }\n\n}\n", "lang": "Rust", "bug_code_uid": "a769915049e65d40809c7e5a4121baf7", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "751deffc11e81dc8786c95e02145fe45", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.556491488025254, "equal_cnt": 19, "replace_cnt": 11, "delete_cnt": 4, "insert_cnt": 4, "fix_ops_cnt": 19, "bug_source_code": "//https://github.com/manta1130/competitive-template-rs\n\nuse input::*;\n\npub mod input {\n use std::cell::RefCell;\n use std::io;\n pub const SPLIT_DELIMITER: char = ' ';\n pub use std::io::prelude::*;\n\n #[macro_export]\n thread_local! {\n pub static INPUT_BUFFER:RefCell>=RefCell::new(std::collections::VecDeque::new());\n }\n\n #[macro_export]\n macro_rules! input_internal {\n ($x:ident : $t:ty) => {\n INPUT_BUFFER.with(|p| {\n if p.borrow().len() == 0 {\n let temp_str = input_line_str();\n let mut split_result_iter = temp_str\n .split(SPLIT_DELIMITER)\n .map(|q| q.to_string())\n .collect::>();\n p.borrow_mut().append(&mut split_result_iter)\n }\n });\n let mut buf_split_result = String::new();\n INPUT_BUFFER.with(|p| buf_split_result = p.borrow_mut().pop_front().unwrap());\n let $x: $t = buf_split_result.parse().unwrap();\n };\n (mut $x:ident : $t:ty) => {\n INPUT_BUFFER.with(|p| {\n if p.borrow().len() == 0 {\n let temp_str = input_line_str();\n let mut split_result_iter = temp_str\n .split(SPLIT_DELIMITER)\n .map(|q| q.to_string())\n .collect::>();\n p.borrow_mut().append(&mut split_result_iter)\n }\n });\n let mut buf_split_result = String::new();\n INPUT_BUFFER.with(|p| buf_split_result = p.borrow_mut().pop_front().unwrap());\n let mut $x: $t = buf_split_result.parse().unwrap();\n };\n }\n\n #[macro_export]\n macro_rules! inputv {\n ($i:ident : $t:ty) => {\n input_internal!{$i : $t}\n };\n (mut $i:ident : $t:ty) => {\n input_internal!{mut $i : $t}\n };\n ($i:ident : $t:ty $(,)*) => {\n input_internal!{$i : $t}\n };\n (mut $i:ident : $t:ty $(,)*) => {\n input_internal!{mut $i : $t}\n };\n (mut $i:ident : $t:ty,$($q:tt)*) => {\n input_internal!{mut $i : $t}\n inputv!{$($q)*}\n };\n ($i:ident : $t:ty,$($q:tt)*) => {\n input_internal!{$i : $t}\n inputv!{$($q)*}\n };\n}\n\n pub fn input_all() {\n INPUT_BUFFER.with(|p| {\n if p.borrow().len() == 0 {\n let mut temp_str = String::new();\n std::io::stdin().read_to_string(&mut temp_str).unwrap();\n let mut split_result_iter = temp_str\n .split_whitespace()\n .map(|q| q.to_string())\n .collect::>();\n p.borrow_mut().append(&mut split_result_iter)\n }\n });\n }\n\n pub fn input_line_str() -> String {\n let mut s = String::new();\n io::stdin().read_line(&mut s).unwrap();\n s.trim().to_string()\n }\n\n #[allow(clippy::match_wild_err_arm)]\n pub fn input_vector() -> Vec\n where\n T: std::str::FromStr,\n {\n let mut v: Vec = Vec::new();\n\n let s = input_line_str();\n let split_result = s.split(SPLIT_DELIMITER);\n for z in split_result {\n let buf = match z.parse() {\n Ok(r) => r,\n Err(_) => panic!(\"Parse Error\",),\n };\n v.push(buf);\n }\n v\n }\n\n #[allow(clippy::match_wild_err_arm)]\n pub fn input_vector_row(n: usize) -> Vec\n where\n T: std::str::FromStr,\n {\n let mut v = Vec::with_capacity(n);\n for _ in 0..n {\n let buf = match input_line_str().parse() {\n Ok(r) => r,\n Err(_) => panic!(\"Parse Error\",),\n };\n v.push(buf);\n }\n v\n }\n\n pub trait ToCharVec {\n fn to_charvec(&self) -> Vec;\n }\n\n impl ToCharVec for String {\n fn to_charvec(&self) -> Vec {\n self.to_string().chars().collect::>()\n }\n }\n}\n\n//https://github.com/rust-lang-ja/ac-library-rs\n//https://github.com/manta1130/competitive-template-rs\n\nuse input::*;\nuse modint::*;\n\npub mod input {\n use std::cell::RefCell;\n use std::io;\n pub const SPLIT_DELIMITER: char = ' ';\n pub use std::io::prelude::*;\n\n #[macro_export]\n thread_local! {\n pub static INPUT_BUFFER:RefCell>=RefCell::new(std::collections::VecDeque::new());\n }\n\n #[macro_export]\n macro_rules! input_internal {\n ($x:ident : $t:ty) => {\n INPUT_BUFFER.with(|p| {\n if p.borrow().len() == 0 {\n let temp_str = input_line_str();\n let mut split_result_iter = temp_str\n .split(SPLIT_DELIMITER)\n .map(|q| q.to_string())\n .collect::>();\n p.borrow_mut().append(&mut split_result_iter)\n }\n });\n let mut buf_split_result = String::new();\n INPUT_BUFFER.with(|p| buf_split_result = p.borrow_mut().pop_front().unwrap());\n let $x: $t = buf_split_result.parse().unwrap();\n };\n (mut $x:ident : $t:ty) => {\n INPUT_BUFFER.with(|p| {\n if p.borrow().len() == 0 {\n let temp_str = input_line_str();\n let mut split_result_iter = temp_str\n .split(SPLIT_DELIMITER)\n .map(|q| q.to_string())\n .collect::>();\n p.borrow_mut().append(&mut split_result_iter)\n }\n });\n let mut buf_split_result = String::new();\n INPUT_BUFFER.with(|p| buf_split_result = p.borrow_mut().pop_front().unwrap());\n let mut $x: $t = buf_split_result.parse().unwrap();\n };\n }\n\n #[macro_export]\n macro_rules! inputv {\n ($i:ident : $t:ty) => {\n input_internal!{$i : $t}\n };\n (mut $i:ident : $t:ty) => {\n input_internal!{mut $i : $t}\n };\n ($i:ident : $t:ty $(,)*) => {\n input_internal!{$i : $t}\n };\n (mut $i:ident : $t:ty $(,)*) => {\n input_internal!{mut $i : $t}\n };\n (mut $i:ident : $t:ty,$($q:tt)*) => {\n input_internal!{mut $i : $t}\n inputv!{$($q)*}\n };\n ($i:ident : $t:ty,$($q:tt)*) => {\n input_internal!{$i : $t}\n inputv!{$($q)*}\n };\n}\n\n pub fn input_all() {\n INPUT_BUFFER.with(|p| {\n if p.borrow().len() == 0 {\n let mut temp_str = String::new();\n std::io::stdin().read_to_string(&mut temp_str).unwrap();\n let mut split_result_iter = temp_str\n .split_whitespace()\n .map(|q| q.to_string())\n .collect::>();\n p.borrow_mut().append(&mut split_result_iter)\n }\n });\n }\n\n pub fn input_line_str() -> String {\n let mut s = String::new();\n io::stdin().read_line(&mut s).unwrap();\n s.trim().to_string()\n }\n\n #[allow(clippy::match_wild_err_arm)]\n pub fn input_vector() -> Vec\n where\n T: std::str::FromStr,\n {\n let mut v: Vec = Vec::new();\n\n let s = input_line_str();\n let split_result = s.split(SPLIT_DELIMITER);\n for z in split_result {\n let buf = match z.parse() {\n Ok(r) => r,\n Err(_) => panic!(\"Parse Error\",),\n };\n v.push(buf);\n }\n v\n }\n\n #[allow(clippy::match_wild_err_arm)]\n pub fn input_vector_row(n: usize) -> Vec\n where\n T: std::str::FromStr,\n {\n let mut v = Vec::with_capacity(n);\n for _ in 0..n {\n let buf = match input_line_str().parse() {\n Ok(r) => r,\n Err(_) => panic!(\"Parse Error\",),\n };\n v.push(buf);\n }\n v\n }\n\n pub trait ToCharVec {\n fn to_charvec(&self) -> Vec;\n }\n\n impl ToCharVec for String {\n fn to_charvec(&self) -> Vec {\n self.to_string().chars().collect::>()\n }\n }\n}\npub mod internal_math {\n #![allow(dead_code)]\n use std::mem::swap;\n\n /* const */\n pub(crate) fn safe_mod(mut x: i64, m: i64) -> i64 {\n x %= m;\n if x < 0 {\n x += m;\n }\n x\n }\n\n pub(crate) struct Barrett {\n pub(crate) _m: u32,\n pub(crate) im: u64,\n }\n\n impl Barrett {\n pub(crate) fn new(m: u32) -> Barrett {\n Barrett {\n _m: m,\n im: (-1i64 as u64 / m as u64).wrapping_add(1),\n }\n }\n\n pub(crate) fn umod(&self) -> u32 {\n self._m\n }\n\n #[allow(clippy::many_single_char_names)]\n pub(crate) fn mul(&self, a: u32, b: u32) -> u32 {\n mul_mod(a, b, self._m, self.im)\n }\n }\n\n #[allow(clippy::many_single_char_names)]\n pub(crate) fn mul_mod(a: u32, b: u32, m: u32, im: u64) -> u32 {\n let mut z = a as u64;\n z *= b as u64;\n let x = (((z as u128) * (im as u128)) >> 64) as u64;\n let mut v = z.wrapping_sub(x.wrapping_mul(m as u64)) as u32;\n if m <= v {\n v = v.wrapping_add(m);\n }\n v\n }\n\n /* const */\n #[allow(clippy::many_single_char_names)]\n pub(crate) fn pow_mod(x: i64, mut n: i64, m: i32) -> i64 {\n if m == 1 {\n return 0;\n }\n let _m = m as u32;\n let mut r: u64 = 1;\n let mut y: u64 = safe_mod(x, m as i64) as u64;\n while n != 0 {\n if (n & 1) > 0 {\n r = (r * y) % (_m as u64);\n }\n y = (y * y) % (_m as u64);\n n >>= 1;\n }\n r as i64\n }\n\n /* const */\n pub(crate) fn is_prime(n: i32) -> bool {\n let n = n as i64;\n match n {\n _ if n <= 1 => return false,\n 2 | 7 | 61 => return true,\n _ if n % 2 == 0 => return false,\n _ => {}\n }\n let mut d = n - 1;\n while d % 2 == 0 {\n d /= 2;\n }\n for &a in &[2, 7, 61] {\n let mut t = d;\n let mut y = pow_mod(a, t, n as i32);\n while t != n - 1 && y != 1 && y != n - 1 {\n y = y * y % n;\n t <<= 1;\n }\n if y != n - 1 && t % 2 == 0 {\n return false;\n }\n }\n true\n }\n\n /* const */\n #[allow(clippy::many_single_char_names)]\n pub(crate) fn inv_gcd(a: i64, b: i64) -> (i64, i64) {\n let a = safe_mod(a, b);\n if a == 0 {\n return (b, 0);\n }\n\n let mut s = b;\n let mut t = a;\n let mut m0 = 0;\n let mut m1 = 1;\n\n while t != 0 {\n let u = s / t;\n s -= t * u;\n m0 -= m1 * u; // |m1 * u| <= |m1| * s <= b\n\n swap(&mut s, &mut t);\n swap(&mut m0, &mut m1);\n }\n if m0 < 0 {\n m0 += b / s;\n }\n (s, m0)\n }\n\n /* const */\n pub(crate) fn primitive_root(m: i32) -> i32 {\n match m {\n 2 => return 1,\n 167_772_161 => return 3,\n 469_762_049 => return 3,\n 754_974_721 => return 11,\n 998_244_353 => return 3,\n _ => {}\n }\n\n let mut divs = [0; 20];\n divs[0] = 2;\n let mut cnt = 1;\n let mut x = (m - 1) / 2;\n while x % 2 == 0 {\n x /= 2;\n }\n for i in (3..std::i32::MAX).step_by(2) {\n if i as i64 * i as i64 > x as i64 {\n break;\n }\n if x % i == 0 {\n divs[cnt] = i;\n cnt += 1;\n while x % i == 0 {\n x /= i;\n }\n }\n }\n if x > 1 {\n divs[cnt] = x;\n cnt += 1;\n }\n let mut g = 2;\n loop {\n if (0..cnt).all(|i| pow_mod(g, ((m - 1) / divs[i]) as i64, m) != 1) {\n break g as i32;\n }\n g += 1;\n }\n }\n}\npub mod modint {\n\n use crate::internal_math;\n use std::{\n cell::RefCell,\n convert::{Infallible, TryInto as _},\n fmt,\n hash::{Hash, Hasher},\n iter::{Product, Sum},\n marker::PhantomData,\n ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Sub, SubAssign},\n str::FromStr,\n sync::atomic::{self, AtomicU32, AtomicU64},\n thread::LocalKey,\n };\n\n pub type ModInt1000000007 = StaticModInt;\n pub type ModInt998244353 = StaticModInt;\n pub type ModInt = DynamicModInt;\n\n #[derive(Copy, Clone, Eq, PartialEq)]\n #[repr(transparent)]\n pub struct StaticModInt {\n val: u32,\n phantom: PhantomData M>,\n }\n\n impl StaticModInt {\n #[inline(always)]\n pub fn modulus() -> u32 {\n M::VALUE\n }\n\n #[inline]\n pub fn new(val: T) -> Self {\n Self::raw(val.rem_euclid_u32(M::VALUE))\n }\n\n #[inline]\n pub fn raw(val: u32) -> Self {\n Self {\n val,\n phantom: PhantomData,\n }\n }\n\n #[inline]\n pub fn val(self) -> u32 {\n self.val\n }\n\n #[inline]\n pub fn pow(self, n: u64) -> Self {\n ::pow(self, n)\n }\n\n #[inline]\n pub fn inv(self) -> Self {\n if M::HINT_VALUE_IS_PRIME {\n if self.val() == 0 {\n panic!(\"attempt to divide by zero\");\n }\n debug_assert!(\n internal_math::is_prime(M::VALUE.try_into().unwrap()),\n \"{} is not a prime number\",\n M::VALUE,\n );\n self.pow((M::VALUE - 2).into())\n } else {\n Self::inv_for_non_prime_modulus(self)\n }\n }\n }\n\n impl ModIntBase for StaticModInt {\n #[inline(always)]\n fn modulus() -> u32 {\n Self::modulus()\n }\n\n #[inline]\n fn raw(val: u32) -> Self {\n Self::raw(val)\n }\n\n #[inline]\n fn val(self) -> u32 {\n self.val()\n }\n\n #[inline]\n fn inv(self) -> Self {\n self.inv()\n }\n }\n\n pub trait Modulus: 'static + Copy + Eq {\n const VALUE: u32;\n const HINT_VALUE_IS_PRIME: bool;\n\n fn butterfly_cache() -> &'static LocalKey>>>;\n }\n\n #[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug)]\n pub enum Mod1000000007 {}\n\n impl Modulus for Mod1000000007 {\n const VALUE: u32 = 1_000_000_007;\n const HINT_VALUE_IS_PRIME: bool = true;\n\n fn butterfly_cache() -> &'static LocalKey>>> {\n thread_local! {\n static BUTTERFLY_CACHE: RefCell>> = RefCell::default();\n }\n &BUTTERFLY_CACHE\n }\n }\n\n #[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug)]\n pub enum Mod998244353 {}\n\n impl Modulus for Mod998244353 {\n const VALUE: u32 = 998_244_353;\n const HINT_VALUE_IS_PRIME: bool = true;\n\n fn butterfly_cache() -> &'static LocalKey>>> {\n thread_local! {\n static BUTTERFLY_CACHE: RefCell>> = RefCell::default();\n }\n &BUTTERFLY_CACHE\n }\n }\n\n pub struct ButterflyCache {\n pub(crate) sum_e: Vec>,\n pub(crate) sum_ie: Vec>,\n }\n\n #[derive(Copy, Clone, Eq, PartialEq)]\n #[repr(transparent)]\n pub struct DynamicModInt {\n val: u32,\n phantom: PhantomData I>,\n }\n\n impl DynamicModInt {\n #[inline]\n pub fn modulus() -> u32 {\n I::companion_barrett().umod()\n }\n\n #[inline]\n pub fn set_modulus(modulus: u32) {\n if modulus == 0 {\n panic!(\"the modulus must not be 0\");\n }\n I::companion_barrett().update(modulus);\n }\n\n #[inline]\n pub fn new(val: T) -> Self {\n ::new(val)\n }\n\n #[inline]\n pub fn raw(val: u32) -> Self {\n Self {\n val,\n phantom: PhantomData,\n }\n }\n\n #[inline]\n pub fn val(self) -> u32 {\n self.val\n }\n\n #[inline]\n pub fn pow(self, n: u64) -> Self {\n ::pow(self, n)\n }\n\n #[inline]\n pub fn inv(self) -> Self {\n Self::inv_for_non_prime_modulus(self)\n }\n }\n\n impl ModIntBase for DynamicModInt {\n #[inline]\n fn modulus() -> u32 {\n Self::modulus()\n }\n\n #[inline]\n fn raw(val: u32) -> Self {\n Self::raw(val)\n }\n\n #[inline]\n fn val(self) -> u32 {\n self.val()\n }\n\n #[inline]\n fn inv(self) -> Self {\n self.inv()\n }\n }\n\n pub trait Id: 'static + Copy + Eq {\n fn companion_barrett() -> &'static Barrett;\n }\n\n #[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug)]\n pub enum DefaultId {}\n\n impl Id for DefaultId {\n fn companion_barrett() -> &'static Barrett {\n static BARRETT: Barrett = Barrett::default();\n &BARRETT\n }\n }\n\n pub struct Barrett {\n m: AtomicU32,\n im: AtomicU64,\n }\n\n impl Barrett {\n #[inline]\n pub const fn new(m: u32) -> Self {\n Self {\n m: AtomicU32::new(m),\n im: AtomicU64::new((-1i64 as u64 / m as u64).wrapping_add(1)),\n }\n }\n\n #[inline]\n const fn default() -> Self {\n Self::new(998_244_353)\n }\n\n #[inline]\n fn update(&self, m: u32) {\n let im = (-1i64 as u64 / m as u64).wrapping_add(1);\n self.m.store(m, atomic::Ordering::SeqCst);\n self.im.store(im, atomic::Ordering::SeqCst);\n }\n\n #[inline]\n fn umod(&self) -> u32 {\n self.m.load(atomic::Ordering::SeqCst)\n }\n\n #[inline]\n fn mul(&self, a: u32, b: u32) -> u32 {\n let m = self.m.load(atomic::Ordering::SeqCst);\n let im = self.im.load(atomic::Ordering::SeqCst);\n internal_math::mul_mod(a, b, m, im)\n }\n }\n\n impl Default for Barrett {\n #[inline]\n fn default() -> Self {\n Self::default()\n }\n }\n\n pub trait ModIntBase:\n Default\n + FromStr\n + From\n + From\n + From\n + From\n + From\n + From\n + From\n + From\n + From\n + From\n + From\n + From\n + Copy\n + Eq\n + Hash\n + fmt::Display\n + fmt::Debug\n + Neg\n + Add\n + Sub\n + Mul\n + Div\n + AddAssign\n + SubAssign\n + MulAssign\n + DivAssign\n {\n fn modulus() -> u32;\n\n fn raw(val: u32) -> Self;\n\n fn val(self) -> u32;\n\n fn inv(self) -> Self;\n\n #[inline]\n fn new(val: T) -> Self {\n Self::raw(val.rem_euclid_u32(Self::modulus()))\n }\n\n #[inline]\n fn pow(self, mut n: u64) -> Self {\n let mut x = self;\n let mut r = Self::raw(1);\n while n > 0 {\n if n & 1 == 1 {\n r *= x;\n }\n x *= x;\n n >>= 1;\n }\n r\n }\n }\n\n pub trait RemEuclidU32 {\n fn rem_euclid_u32(self, modulus: u32) -> u32;\n }\n\n macro_rules! impl_rem_euclid_u32_for_small_signed {\n ($($ty:tt),*) => {\n $(\n impl RemEuclidU32 for $ty {\n #[inline]\n fn rem_euclid_u32(self, modulus: u32) -> u32 {\n (self as i64).rem_euclid(i64::from(modulus)) as _\n }\n }\n )*\n }\n}\n\n impl_rem_euclid_u32_for_small_signed!(i8, i16, i32, i64, isize);\n\n impl RemEuclidU32 for i128 {\n #[inline]\n fn rem_euclid_u32(self, modulus: u32) -> u32 {\n self.rem_euclid(i128::from(modulus)) as _\n }\n }\n\n macro_rules! impl_rem_euclid_u32_for_small_unsigned {\n ($($ty:tt),*) => {\n $(\n impl RemEuclidU32 for $ty {\n #[inline]\n fn rem_euclid_u32(self, modulus: u32) -> u32 {\n self as u32 % modulus\n }\n }\n )*\n }\n}\n\n macro_rules! impl_rem_euclid_u32_for_large_unsigned {\n ($($ty:tt),*) => {\n $(\n impl RemEuclidU32 for $ty {\n #[inline]\n fn rem_euclid_u32(self, modulus: u32) -> u32 {\n (self % (modulus as $ty)) as _\n }\n }\n )*\n }\n}\n\n impl_rem_euclid_u32_for_small_unsigned!(u8, u16, u32);\n impl_rem_euclid_u32_for_large_unsigned!(u64, u128);\n\n #[cfg(target_pointer_width = \"32\")]\n impl_rem_euclid_u32_for_small_unsigned!(usize);\n\n #[cfg(target_pointer_width = \"64\")]\n impl_rem_euclid_u32_for_large_unsigned!(usize);\n\n trait InternalImplementations: ModIntBase {\n #[inline]\n fn inv_for_non_prime_modulus(this: Self) -> Self {\n let (gcd, x) = internal_math::inv_gcd(this.val().into(), Self::modulus().into());\n if gcd != 1 {\n panic!(\"the multiplicative inverse does not exist\");\n }\n Self::new(x)\n }\n\n #[inline]\n fn default_impl() -> Self {\n Self::raw(0)\n }\n\n #[inline]\n fn from_str_impl(s: &str) -> Result {\n Ok(s.parse::()\n .map(Self::new)\n .unwrap_or_else(|_| todo!(\"parsing as an arbitrary precision integer?\")))\n }\n\n #[inline]\n fn hash_impl(this: &Self, state: &mut impl Hasher) {\n this.val().hash(state)\n }\n\n #[inline]\n fn display_impl(this: &Self, f: &mut fmt::Formatter) -> fmt::Result {\n fmt::Display::fmt(&this.val(), f)\n }\n\n #[inline]\n fn debug_impl(this: &Self, f: &mut fmt::Formatter) -> fmt::Result {\n fmt::Debug::fmt(&this.val(), f)\n }\n\n #[inline]\n fn neg_impl(this: Self) -> Self {\n Self::sub_impl(Self::raw(0), this)\n }\n\n #[inline]\n fn add_impl(lhs: Self, rhs: Self) -> Self {\n let modulus = Self::modulus();\n let mut val = lhs.val() + rhs.val();\n if val >= modulus {\n val -= modulus;\n }\n Self::raw(val)\n }\n\n #[inline]\n fn sub_impl(lhs: Self, rhs: Self) -> Self {\n let modulus = Self::modulus();\n let mut val = lhs.val().wrapping_sub(rhs.val());\n if val >= modulus {\n val = val.wrapping_add(modulus)\n }\n Self::raw(val)\n }\n\n fn mul_impl(lhs: Self, rhs: Self) -> Self;\n\n #[inline]\n fn div_impl(lhs: Self, rhs: Self) -> Self {\n Self::mul_impl(lhs, rhs.inv())\n }\n }\n\n impl InternalImplementations for StaticModInt {\n #[inline]\n fn mul_impl(lhs: Self, rhs: Self) -> Self {\n Self::raw((u64::from(lhs.val()) * u64::from(rhs.val()) % u64::from(M::VALUE)) as u32)\n }\n }\n\n impl InternalImplementations for DynamicModInt {\n #[inline]\n fn mul_impl(lhs: Self, rhs: Self) -> Self {\n Self::raw(I::companion_barrett().mul(lhs.val, rhs.val))\n }\n }\n\n macro_rules! impl_basic_traits {\n () => {};\n (impl <$generic_param:ident : $generic_param_bound:tt> _ for $self:ty; $($rest:tt)*) => {\n impl <$generic_param: $generic_param_bound> Default for $self {\n #[inline]\n fn default() -> Self {\n Self::default_impl()\n }\n }\n\n impl <$generic_param: $generic_param_bound> FromStr for $self {\n type Err = Infallible;\n\n #[inline]\n fn from_str(s: &str) -> Result {\n Self::from_str_impl(s)\n }\n }\n\n impl<$generic_param: $generic_param_bound, V: RemEuclidU32> From for $self {\n #[inline]\n fn from(from: V) -> Self {\n Self::new(from)\n }\n }\n\n #[allow(clippy::derive_hash_xor_eq)]\n impl<$generic_param: $generic_param_bound> Hash for $self {\n #[inline]\n fn hash(&self, state: &mut H) {\n Self::hash_impl(self, state)\n }\n }\n\n impl<$generic_param: $generic_param_bound> fmt::Display for $self {\n #[inline]\n fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {\n Self::display_impl(self, f)\n }\n }\n\n impl<$generic_param: $generic_param_bound> fmt::Debug for $self {\n #[inline]\n fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {\n Self::debug_impl(self, f)\n }\n }\n\n impl<$generic_param: $generic_param_bound> Neg for $self {\n type Output = $self;\n\n #[inline]\n fn neg(self) -> $self {\n Self::neg_impl(self)\n }\n }\n\n impl<$generic_param: $generic_param_bound> Neg for &'_ $self {\n type Output = $self;\n\n #[inline]\n fn neg(self) -> $self {\n <$self>::neg_impl(*self)\n }\n }\n\n impl_basic_traits!($($rest)*);\n };\n}\n\n impl_basic_traits! {\n impl _ for StaticModInt ;\n impl _ for DynamicModInt;\n }\n\n macro_rules! impl_bin_ops {\n () => {};\n (for<$($generic_param:ident : $generic_param_bound:tt),*> <$lhs_ty:ty> ~ <$rhs_ty:ty> -> $output:ty { { $lhs_body:expr } ~ { $rhs_body:expr } } $($rest:tt)*) => {\n impl <$($generic_param: $generic_param_bound),*> Add<$rhs_ty> for $lhs_ty {\n type Output = $output;\n\n #[inline]\n fn add(self, rhs: $rhs_ty) -> $output {\n <$output>::add_impl(apply($lhs_body, self), apply($rhs_body, rhs))\n }\n }\n\n impl <$($generic_param: $generic_param_bound),*> Sub<$rhs_ty> for $lhs_ty {\n type Output = $output;\n\n #[inline]\n fn sub(self, rhs: $rhs_ty) -> $output {\n <$output>::sub_impl(apply($lhs_body, self), apply($rhs_body, rhs))\n }\n }\n\n impl <$($generic_param: $generic_param_bound),*> Mul<$rhs_ty> for $lhs_ty {\n type Output = $output;\n\n #[inline]\n fn mul(self, rhs: $rhs_ty) -> $output {\n <$output>::mul_impl(apply($lhs_body, self), apply($rhs_body, rhs))\n }\n }\n\n impl <$($generic_param: $generic_param_bound),*> Div<$rhs_ty> for $lhs_ty {\n type Output = $output;\n\n #[inline]\n fn div(self, rhs: $rhs_ty) -> $output {\n <$output>::div_impl(apply($lhs_body, self), apply($rhs_body, rhs))\n }\n }\n\n impl_bin_ops!($($rest)*);\n };\n}\n\n macro_rules! impl_assign_ops {\n () => {};\n (for<$($generic_param:ident : $generic_param_bound:tt),*> <$lhs_ty:ty> ~= <$rhs_ty:ty> { _ ~= { $rhs_body:expr } } $($rest:tt)*) => {\n impl <$($generic_param: $generic_param_bound),*> AddAssign<$rhs_ty> for $lhs_ty {\n #[inline]\n fn add_assign(&mut self, rhs: $rhs_ty) {\n *self = *self + apply($rhs_body, rhs);\n }\n }\n\n impl <$($generic_param: $generic_param_bound),*> SubAssign<$rhs_ty> for $lhs_ty {\n #[inline]\n fn sub_assign(&mut self, rhs: $rhs_ty) {\n *self = *self - apply($rhs_body, rhs);\n }\n }\n\n impl <$($generic_param: $generic_param_bound),*> MulAssign<$rhs_ty> for $lhs_ty {\n #[inline]\n fn mul_assign(&mut self, rhs: $rhs_ty) {\n *self = *self * apply($rhs_body, rhs);\n }\n }\n\n impl <$($generic_param: $generic_param_bound),*> DivAssign<$rhs_ty> for $lhs_ty {\n #[inline]\n fn div_assign(&mut self, rhs: $rhs_ty) {\n *self = *self / apply($rhs_body, rhs);\n }\n }\n\n impl_assign_ops!($($rest)*);\n };\n}\n\n #[inline]\n fn apply O, X, O>(f: F, x: X) -> O {\n f(x)\n }\n\n impl_bin_ops! {\n for > ~ > -> StaticModInt { { |x| x } ~ { |x| x } }\n for > ~ <&'_ StaticModInt > -> StaticModInt { { |x| x } ~ { |&x| x } }\n for <&'_ StaticModInt > ~ > -> StaticModInt { { |&x| x } ~ { |x| x } }\n for <&'_ StaticModInt > ~ <&'_ StaticModInt > -> StaticModInt { { |&x| x } ~ { |&x| x } }\n for > ~ > -> DynamicModInt { { |x| x } ~ { |x| x } }\n for > ~ <&'_ DynamicModInt> -> DynamicModInt { { |x| x } ~ { |&x| x } }\n for <&'_ DynamicModInt> ~ > -> DynamicModInt { { |&x| x } ~ { |x| x } }\n for <&'_ DynamicModInt> ~ <&'_ DynamicModInt> -> DynamicModInt { { |&x| x } ~ { |&x| x } }\n\n for > ~ -> StaticModInt { { |x| x } ~ { StaticModInt::::new } }\n for > ~ -> DynamicModInt { { |x| x } ~ { DynamicModInt::::new } }\n }\n\n impl_assign_ops! {\n for > ~= > { _ ~= { |x| x } }\n for > ~= <&'_ StaticModInt > { _ ~= { |&x| x } }\n for > ~= > { _ ~= { |x| x } }\n for > ~= <&'_ DynamicModInt> { _ ~= { |&x| x } }\n\n for > ~= { _ ~= { StaticModInt::::new } }\n for > ~= { _ ~= { DynamicModInt::::new } }\n }\n\n macro_rules! impl_folding {\n () => {};\n (impl<$generic_param:ident : $generic_param_bound:tt> $trait:ident<_> for $self:ty { fn $method:ident(_) -> _ { _($unit:expr, $op:expr) } } $($rest:tt)*) => {\n impl<$generic_param: $generic_param_bound> $trait for $self {\n #[inline]\n fn $method(iter: S) -> Self\n where\n S: Iterator,\n {\n iter.fold($unit, $op)\n }\n }\n\n impl<'a, $generic_param: $generic_param_bound> $trait<&'a Self> for $self {\n #[inline]\n fn $method(iter: S) -> Self\n where\n S: Iterator,\n {\n iter.fold($unit, $op)\n }\n }\n\n impl_folding!($($rest)*);\n };\n}\n\n impl_folding! {\n impl Sum<_> for StaticModInt { fn sum(_) -> _ { _(Self::raw(0), Add::add) } }\n impl Product<_> for StaticModInt { fn product(_) -> _ { _(Self::raw(1), Mul::mul) } }\n impl Sum<_> for DynamicModInt { fn sum(_) -> _ { _(Self::raw(0), Add::add) } }\n impl Product<_> for DynamicModInt { fn product(_) -> _ { _(Self::raw(1), Mul::mul) } }\n }\n}\n", "lang": "Rust", "bug_code_uid": "86c4cdfb61a8e6ba1cd8067618d27ed5", "src_uid": "24e2f10463f440affccc2755f4462d8a", "apr_id": "541d94603662157f9b693f3f511c63ee", "difficulty": 1500, "tags": ["combinatorics", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9923596576309833, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "use std::io::{stdout, BufWriter, Write};\n\ntype Mint = ModInt1000000007;\n\nfn main() {\n inputv! {\n n:usize,x:usize,pos:usize\n }\n let mut f = vec![Mint::new(1)];\n for i in 1..1000 {\n let l = *f.last().unwrap();\n f.push(l * Mint::new(i));\n }\n let mut r_count = 0;\n let mut l_count = 0;\n let mut left = 0;\n let mut right = n;\n loop {\n let mid = (left + right) / 2;\n if mid == pos {\n break;\n } else if mid > pos {\n r_count += 1;\n right = mid;\n } else {\n l_count += 1;\n left = mid + 1;\n }\n }\n //dbg!(l_count, r_count);\n if n - x < r_count || x - 1 < l_count {\n println!(\"0\");\n return;\n }\n let mut ans = f[n - x] / f[n - x - r_count] * f[x - 1] / f[x - 1 - l_count]\n * f[n - l_count - r_count - 1];\n println!(\"{}\", ans);\n}\n\n//https://github.com/rust-lang-ja/ac-library-rs\n//https://github.com/manta1130/competitive-template-rs\n\nuse input::*;\nuse modint::*;\n\npub mod input {\n use std::cell::RefCell;\n use std::io;\n pub const SPLIT_DELIMITER: char = ' ';\n pub use std::io::prelude::*;\n\n #[macro_export]\n thread_local! {\n pub static INPUT_BUFFER:RefCell>=RefCell::new(std::collections::VecDeque::new());\n }\n\n #[macro_export]\n macro_rules! input_internal {\n ($x:ident : $t:ty) => {\n INPUT_BUFFER.with(|p| {\n if p.borrow().len() == 0 {\n let temp_str = input_line_str();\n let mut split_result_iter = temp_str\n .split(SPLIT_DELIMITER)\n .map(|q| q.to_string())\n .collect::>();\n p.borrow_mut().append(&mut split_result_iter)\n }\n });\n let mut buf_split_result = String::new();\n INPUT_BUFFER.with(|p| buf_split_result = p.borrow_mut().pop_front().unwrap());\n let $x: $t = buf_split_result.parse().unwrap();\n };\n (mut $x:ident : $t:ty) => {\n INPUT_BUFFER.with(|p| {\n if p.borrow().len() == 0 {\n let temp_str = input_line_str();\n let mut split_result_iter = temp_str\n .split(SPLIT_DELIMITER)\n .map(|q| q.to_string())\n .collect::>();\n p.borrow_mut().append(&mut split_result_iter)\n }\n });\n let mut buf_split_result = String::new();\n INPUT_BUFFER.with(|p| buf_split_result = p.borrow_mut().pop_front().unwrap());\n let mut $x: $t = buf_split_result.parse().unwrap();\n };\n }\n\n #[macro_export]\n macro_rules! inputv {\n ($i:ident : $t:ty) => {\n input_internal!{$i : $t}\n };\n (mut $i:ident : $t:ty) => {\n input_internal!{mut $i : $t}\n };\n ($i:ident : $t:ty $(,)*) => {\n input_internal!{$i : $t}\n };\n (mut $i:ident : $t:ty $(,)*) => {\n input_internal!{mut $i : $t}\n };\n (mut $i:ident : $t:ty,$($q:tt)*) => {\n input_internal!{mut $i : $t}\n inputv!{$($q)*}\n };\n ($i:ident : $t:ty,$($q:tt)*) => {\n input_internal!{$i : $t}\n inputv!{$($q)*}\n };\n}\n\n pub fn input_all() {\n INPUT_BUFFER.with(|p| {\n if p.borrow().len() == 0 {\n let mut temp_str = String::new();\n std::io::stdin().read_to_string(&mut temp_str).unwrap();\n let mut split_result_iter = temp_str\n .split_whitespace()\n .map(|q| q.to_string())\n .collect::>();\n p.borrow_mut().append(&mut split_result_iter)\n }\n });\n }\n\n pub fn input_line_str() -> String {\n let mut s = String::new();\n io::stdin().read_line(&mut s).unwrap();\n s.trim().to_string()\n }\n\n #[allow(clippy::match_wild_err_arm)]\n pub fn input_vector() -> Vec\n where\n T: std::str::FromStr,\n {\n let mut v: Vec = Vec::new();\n\n let s = input_line_str();\n let split_result = s.split(SPLIT_DELIMITER);\n for z in split_result {\n let buf = match z.parse() {\n Ok(r) => r,\n Err(_) => panic!(\"Parse Error\",),\n };\n v.push(buf);\n }\n v\n }\n\n #[allow(clippy::match_wild_err_arm)]\n pub fn input_vector_row(n: usize) -> Vec\n where\n T: std::str::FromStr,\n {\n let mut v = Vec::with_capacity(n);\n for _ in 0..n {\n let buf = match input_line_str().parse() {\n Ok(r) => r,\n Err(_) => panic!(\"Parse Error\",),\n };\n v.push(buf);\n }\n v\n }\n\n pub trait ToCharVec {\n fn to_charvec(&self) -> Vec;\n }\n\n impl ToCharVec for String {\n fn to_charvec(&self) -> Vec {\n self.to_string().chars().collect::>()\n }\n }\n}\npub mod internal_math {\n #![allow(dead_code)]\n use std::mem::swap;\n\n /* const */\n pub(crate) fn safe_mod(mut x: i64, m: i64) -> i64 {\n x %= m;\n if x < 0 {\n x += m;\n }\n x\n }\n\n pub(crate) struct Barrett {\n pub(crate) _m: u32,\n pub(crate) im: u64,\n }\n\n impl Barrett {\n pub(crate) fn new(m: u32) -> Barrett {\n Barrett {\n _m: m,\n im: (-1i64 as u64 / m as u64).wrapping_add(1),\n }\n }\n\n pub(crate) fn umod(&self) -> u32 {\n self._m\n }\n\n #[allow(clippy::many_single_char_names)]\n pub(crate) fn mul(&self, a: u32, b: u32) -> u32 {\n mul_mod(a, b, self._m, self.im)\n }\n }\n\n #[allow(clippy::many_single_char_names)]\n pub(crate) fn mul_mod(a: u32, b: u32, m: u32, im: u64) -> u32 {\n let mut z = a as u64;\n z *= b as u64;\n let x = (((z as u128) * (im as u128)) >> 64) as u64;\n let mut v = z.wrapping_sub(x.wrapping_mul(m as u64)) as u32;\n if m <= v {\n v = v.wrapping_add(m);\n }\n v\n }\n\n /* const */\n #[allow(clippy::many_single_char_names)]\n pub(crate) fn pow_mod(x: i64, mut n: i64, m: i32) -> i64 {\n if m == 1 {\n return 0;\n }\n let _m = m as u32;\n let mut r: u64 = 1;\n let mut y: u64 = safe_mod(x, m as i64) as u64;\n while n != 0 {\n if (n & 1) > 0 {\n r = (r * y) % (_m as u64);\n }\n y = (y * y) % (_m as u64);\n n >>= 1;\n }\n r as i64\n }\n\n /* const */\n pub(crate) fn is_prime(n: i32) -> bool {\n let n = n as i64;\n match n {\n _ if n <= 1 => return false,\n 2 | 7 | 61 => return true,\n _ if n % 2 == 0 => return false,\n _ => {}\n }\n let mut d = n - 1;\n while d % 2 == 0 {\n d /= 2;\n }\n for &a in &[2, 7, 61] {\n let mut t = d;\n let mut y = pow_mod(a, t, n as i32);\n while t != n - 1 && y != 1 && y != n - 1 {\n y = y * y % n;\n t <<= 1;\n }\n if y != n - 1 && t % 2 == 0 {\n return false;\n }\n }\n true\n }\n\n /* const */\n #[allow(clippy::many_single_char_names)]\n pub(crate) fn inv_gcd(a: i64, b: i64) -> (i64, i64) {\n let a = safe_mod(a, b);\n if a == 0 {\n return (b, 0);\n }\n\n let mut s = b;\n let mut t = a;\n let mut m0 = 0;\n let mut m1 = 1;\n\n while t != 0 {\n let u = s / t;\n s -= t * u;\n m0 -= m1 * u; // |m1 * u| <= |m1| * s <= b\n\n swap(&mut s, &mut t);\n swap(&mut m0, &mut m1);\n }\n if m0 < 0 {\n m0 += b / s;\n }\n (s, m0)\n }\n\n /* const */\n pub(crate) fn primitive_root(m: i32) -> i32 {\n match m {\n 2 => return 1,\n 167_772_161 => return 3,\n 469_762_049 => return 3,\n 754_974_721 => return 11,\n 998_244_353 => return 3,\n _ => {}\n }\n\n let mut divs = [0; 20];\n divs[0] = 2;\n let mut cnt = 1;\n let mut x = (m - 1) / 2;\n while x % 2 == 0 {\n x /= 2;\n }\n for i in (3..std::i32::MAX).step_by(2) {\n if i as i64 * i as i64 > x as i64 {\n break;\n }\n if x % i == 0 {\n divs[cnt] = i;\n cnt += 1;\n while x % i == 0 {\n x /= i;\n }\n }\n }\n if x > 1 {\n divs[cnt] = x;\n cnt += 1;\n }\n let mut g = 2;\n loop {\n if (0..cnt).all(|i| pow_mod(g, ((m - 1) / divs[i]) as i64, m) != 1) {\n break g as i32;\n }\n g += 1;\n }\n }\n}\npub mod modint {\n\n use crate::internal_math;\n use std::{\n cell::RefCell,\n convert::{Infallible, TryInto as _},\n fmt,\n hash::{Hash, Hasher},\n iter::{Product, Sum},\n marker::PhantomData,\n ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Sub, SubAssign},\n str::FromStr,\n sync::atomic::{self, AtomicU32, AtomicU64},\n thread::LocalKey,\n };\n\n pub type ModInt1000000007 = StaticModInt;\n pub type ModInt998244353 = StaticModInt;\n pub type ModInt = DynamicModInt;\n\n #[derive(Copy, Clone, Eq, PartialEq)]\n #[repr(transparent)]\n pub struct StaticModInt {\n val: u32,\n phantom: PhantomData M>,\n }\n\n impl StaticModInt {\n #[inline(always)]\n pub fn modulus() -> u32 {\n M::VALUE\n }\n\n #[inline]\n pub fn new(val: T) -> Self {\n Self::raw(val.rem_euclid_u32(M::VALUE))\n }\n\n #[inline]\n pub fn raw(val: u32) -> Self {\n Self {\n val,\n phantom: PhantomData,\n }\n }\n\n #[inline]\n pub fn val(self) -> u32 {\n self.val\n }\n\n #[inline]\n pub fn pow(self, n: u64) -> Self {\n ::pow(self, n)\n }\n\n #[inline]\n pub fn inv(self) -> Self {\n if M::HINT_VALUE_IS_PRIME {\n if self.val() == 0 {\n panic!(\"attempt to divide by zero\");\n }\n debug_assert!(\n internal_math::is_prime(M::VALUE.try_into().unwrap()),\n \"{} is not a prime number\",\n M::VALUE,\n );\n self.pow((M::VALUE - 2).into())\n } else {\n Self::inv_for_non_prime_modulus(self)\n }\n }\n }\n\n impl ModIntBase for StaticModInt {\n #[inline(always)]\n fn modulus() -> u32 {\n Self::modulus()\n }\n\n #[inline]\n fn raw(val: u32) -> Self {\n Self::raw(val)\n }\n\n #[inline]\n fn val(self) -> u32 {\n self.val()\n }\n\n #[inline]\n fn inv(self) -> Self {\n self.inv()\n }\n }\n\n pub trait Modulus: 'static + Copy + Eq {\n const VALUE: u32;\n const HINT_VALUE_IS_PRIME: bool;\n\n fn butterfly_cache() -> &'static LocalKey>>>;\n }\n\n #[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug)]\n pub enum Mod1000000007 {}\n\n impl Modulus for Mod1000000007 {\n const VALUE: u32 = 1_000_000_007;\n const HINT_VALUE_IS_PRIME: bool = true;\n\n fn butterfly_cache() -> &'static LocalKey>>> {\n thread_local! {\n static BUTTERFLY_CACHE: RefCell>> = RefCell::default();\n }\n &BUTTERFLY_CACHE\n }\n }\n\n #[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug)]\n pub enum Mod998244353 {}\n\n impl Modulus for Mod998244353 {\n const VALUE: u32 = 998_244_353;\n const HINT_VALUE_IS_PRIME: bool = true;\n\n fn butterfly_cache() -> &'static LocalKey>>> {\n thread_local! {\n static BUTTERFLY_CACHE: RefCell>> = RefCell::default();\n }\n &BUTTERFLY_CACHE\n }\n }\n\n pub struct ButterflyCache {\n pub(crate) sum_e: Vec>,\n pub(crate) sum_ie: Vec>,\n }\n\n #[derive(Copy, Clone, Eq, PartialEq)]\n #[repr(transparent)]\n pub struct DynamicModInt {\n val: u32,\n phantom: PhantomData I>,\n }\n\n impl DynamicModInt {\n #[inline]\n pub fn modulus() -> u32 {\n I::companion_barrett().umod()\n }\n\n #[inline]\n pub fn set_modulus(modulus: u32) {\n if modulus == 0 {\n panic!(\"the modulus must not be 0\");\n }\n I::companion_barrett().update(modulus);\n }\n\n #[inline]\n pub fn new(val: T) -> Self {\n ::new(val)\n }\n\n #[inline]\n pub fn raw(val: u32) -> Self {\n Self {\n val,\n phantom: PhantomData,\n }\n }\n\n #[inline]\n pub fn val(self) -> u32 {\n self.val\n }\n\n #[inline]\n pub fn pow(self, n: u64) -> Self {\n ::pow(self, n)\n }\n\n #[inline]\n pub fn inv(self) -> Self {\n Self::inv_for_non_prime_modulus(self)\n }\n }\n\n impl ModIntBase for DynamicModInt {\n #[inline]\n fn modulus() -> u32 {\n Self::modulus()\n }\n\n #[inline]\n fn raw(val: u32) -> Self {\n Self::raw(val)\n }\n\n #[inline]\n fn val(self) -> u32 {\n self.val()\n }\n\n #[inline]\n fn inv(self) -> Self {\n self.inv()\n }\n }\n\n pub trait Id: 'static + Copy + Eq {\n fn companion_barrett() -> &'static Barrett;\n }\n\n #[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug)]\n pub enum DefaultId {}\n\n impl Id for DefaultId {\n fn companion_barrett() -> &'static Barrett {\n static BARRETT: Barrett = Barrett::default();\n &BARRETT\n }\n }\n\n pub struct Barrett {\n m: AtomicU32,\n im: AtomicU64,\n }\n\n impl Barrett {\n #[inline]\n pub const fn new(m: u32) -> Self {\n Self {\n m: AtomicU32::new(m),\n im: AtomicU64::new((-1i64 as u64 / m as u64).wrapping_add(1)),\n }\n }\n\n #[inline]\n const fn default() -> Self {\n Self::new(998_244_353)\n }\n\n #[inline]\n fn update(&self, m: u32) {\n let im = (-1i64 as u64 / m as u64).wrapping_add(1);\n self.m.store(m, atomic::Ordering::SeqCst);\n self.im.store(im, atomic::Ordering::SeqCst);\n }\n\n #[inline]\n fn umod(&self) -> u32 {\n self.m.load(atomic::Ordering::SeqCst)\n }\n\n #[inline]\n fn mul(&self, a: u32, b: u32) -> u32 {\n let m = self.m.load(atomic::Ordering::SeqCst);\n let im = self.im.load(atomic::Ordering::SeqCst);\n internal_math::mul_mod(a, b, m, im)\n }\n }\n\n impl Default for Barrett {\n #[inline]\n fn default() -> Self {\n Self::default()\n }\n }\n\n pub trait ModIntBase:\n Default\n + FromStr\n + From\n + From\n + From\n + From\n + From\n + From\n + From\n + From\n + From\n + From\n + From\n + From\n + Copy\n + Eq\n + Hash\n + fmt::Display\n + fmt::Debug\n + Neg\n + Add\n + Sub\n + Mul\n + Div\n + AddAssign\n + SubAssign\n + MulAssign\n + DivAssign\n {\n fn modulus() -> u32;\n\n fn raw(val: u32) -> Self;\n\n fn val(self) -> u32;\n\n fn inv(self) -> Self;\n\n #[inline]\n fn new(val: T) -> Self {\n Self::raw(val.rem_euclid_u32(Self::modulus()))\n }\n\n #[inline]\n fn pow(self, mut n: u64) -> Self {\n let mut x = self;\n let mut r = Self::raw(1);\n while n > 0 {\n if n & 1 == 1 {\n r *= x;\n }\n x *= x;\n n >>= 1;\n }\n r\n }\n }\n\n pub trait RemEuclidU32 {\n fn rem_euclid_u32(self, modulus: u32) -> u32;\n }\n\n macro_rules! impl_rem_euclid_u32_for_small_signed {\n ($($ty:tt),*) => {\n $(\n impl RemEuclidU32 for $ty {\n #[inline]\n fn rem_euclid_u32(self, modulus: u32) -> u32 {\n (self as i64).rem_euclid(i64::from(modulus)) as _\n }\n }\n )*\n }\n}\n\n impl_rem_euclid_u32_for_small_signed!(i8, i16, i32, i64, isize);\n\n impl RemEuclidU32 for i128 {\n #[inline]\n fn rem_euclid_u32(self, modulus: u32) -> u32 {\n self.rem_euclid(i128::from(modulus)) as _\n }\n }\n\n macro_rules! impl_rem_euclid_u32_for_small_unsigned {\n ($($ty:tt),*) => {\n $(\n impl RemEuclidU32 for $ty {\n #[inline]\n fn rem_euclid_u32(self, modulus: u32) -> u32 {\n self as u32 % modulus\n }\n }\n )*\n }\n}\n\n macro_rules! impl_rem_euclid_u32_for_large_unsigned {\n ($($ty:tt),*) => {\n $(\n impl RemEuclidU32 for $ty {\n #[inline]\n fn rem_euclid_u32(self, modulus: u32) -> u32 {\n (self % (modulus as $ty)) as _\n }\n }\n )*\n }\n}\n\n impl_rem_euclid_u32_for_small_unsigned!(u8, u16, u32);\n impl_rem_euclid_u32_for_large_unsigned!(u64, u128);\n\n #[cfg(target_pointer_width = \"32\")]\n impl_rem_euclid_u32_for_small_unsigned!(usize);\n\n #[cfg(target_pointer_width = \"64\")]\n impl_rem_euclid_u32_for_large_unsigned!(usize);\n\n trait InternalImplementations: ModIntBase {\n #[inline]\n fn inv_for_non_prime_modulus(this: Self) -> Self {\n let (gcd, x) = internal_math::inv_gcd(this.val().into(), Self::modulus().into());\n if gcd != 1 {\n panic!(\"the multiplicative inverse does not exist\");\n }\n Self::new(x)\n }\n\n #[inline]\n fn default_impl() -> Self {\n Self::raw(0)\n }\n\n #[inline]\n fn from_str_impl(s: &str) -> Result {\n Ok(s.parse::()\n .map(Self::new)\n .unwrap_or_else(|_| todo!(\"parsing as an arbitrary precision integer?\")))\n }\n\n #[inline]\n fn hash_impl(this: &Self, state: &mut impl Hasher) {\n this.val().hash(state)\n }\n\n #[inline]\n fn display_impl(this: &Self, f: &mut fmt::Formatter) -> fmt::Result {\n fmt::Display::fmt(&this.val(), f)\n }\n\n #[inline]\n fn debug_impl(this: &Self, f: &mut fmt::Formatter) -> fmt::Result {\n fmt::Debug::fmt(&this.val(), f)\n }\n\n #[inline]\n fn neg_impl(this: Self) -> Self {\n Self::sub_impl(Self::raw(0), this)\n }\n\n #[inline]\n fn add_impl(lhs: Self, rhs: Self) -> Self {\n let modulus = Self::modulus();\n let mut val = lhs.val() + rhs.val();\n if val >= modulus {\n val -= modulus;\n }\n Self::raw(val)\n }\n\n #[inline]\n fn sub_impl(lhs: Self, rhs: Self) -> Self {\n let modulus = Self::modulus();\n let mut val = lhs.val().wrapping_sub(rhs.val());\n if val >= modulus {\n val = val.wrapping_add(modulus)\n }\n Self::raw(val)\n }\n\n fn mul_impl(lhs: Self, rhs: Self) -> Self;\n\n #[inline]\n fn div_impl(lhs: Self, rhs: Self) -> Self {\n Self::mul_impl(lhs, rhs.inv())\n }\n }\n\n impl InternalImplementations for StaticModInt {\n #[inline]\n fn mul_impl(lhs: Self, rhs: Self) -> Self {\n Self::raw((u64::from(lhs.val()) * u64::from(rhs.val()) % u64::from(M::VALUE)) as u32)\n }\n }\n\n impl InternalImplementations for DynamicModInt {\n #[inline]\n fn mul_impl(lhs: Self, rhs: Self) -> Self {\n Self::raw(I::companion_barrett().mul(lhs.val, rhs.val))\n }\n }\n\n macro_rules! impl_basic_traits {\n () => {};\n (impl <$generic_param:ident : $generic_param_bound:tt> _ for $self:ty; $($rest:tt)*) => {\n impl <$generic_param: $generic_param_bound> Default for $self {\n #[inline]\n fn default() -> Self {\n Self::default_impl()\n }\n }\n\n impl <$generic_param: $generic_param_bound> FromStr for $self {\n type Err = Infallible;\n\n #[inline]\n fn from_str(s: &str) -> Result {\n Self::from_str_impl(s)\n }\n }\n\n impl<$generic_param: $generic_param_bound, V: RemEuclidU32> From for $self {\n #[inline]\n fn from(from: V) -> Self {\n Self::new(from)\n }\n }\n\n #[allow(clippy::derive_hash_xor_eq)]\n impl<$generic_param: $generic_param_bound> Hash for $self {\n #[inline]\n fn hash(&self, state: &mut H) {\n Self::hash_impl(self, state)\n }\n }\n\n impl<$generic_param: $generic_param_bound> fmt::Display for $self {\n #[inline]\n fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {\n Self::display_impl(self, f)\n }\n }\n\n impl<$generic_param: $generic_param_bound> fmt::Debug for $self {\n #[inline]\n fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {\n Self::debug_impl(self, f)\n }\n }\n\n impl<$generic_param: $generic_param_bound> Neg for $self {\n type Output = $self;\n\n #[inline]\n fn neg(self) -> $self {\n Self::neg_impl(self)\n }\n }\n\n impl<$generic_param: $generic_param_bound> Neg for &'_ $self {\n type Output = $self;\n\n #[inline]\n fn neg(self) -> $self {\n <$self>::neg_impl(*self)\n }\n }\n\n impl_basic_traits!($($rest)*);\n };\n}\n\n impl_basic_traits! {\n impl _ for StaticModInt ;\n impl _ for DynamicModInt;\n }\n\n macro_rules! impl_bin_ops {\n () => {};\n (for<$($generic_param:ident : $generic_param_bound:tt),*> <$lhs_ty:ty> ~ <$rhs_ty:ty> -> $output:ty { { $lhs_body:expr } ~ { $rhs_body:expr } } $($rest:tt)*) => {\n impl <$($generic_param: $generic_param_bound),*> Add<$rhs_ty> for $lhs_ty {\n type Output = $output;\n\n #[inline]\n fn add(self, rhs: $rhs_ty) -> $output {\n <$output>::add_impl(apply($lhs_body, self), apply($rhs_body, rhs))\n }\n }\n\n impl <$($generic_param: $generic_param_bound),*> Sub<$rhs_ty> for $lhs_ty {\n type Output = $output;\n\n #[inline]\n fn sub(self, rhs: $rhs_ty) -> $output {\n <$output>::sub_impl(apply($lhs_body, self), apply($rhs_body, rhs))\n }\n }\n\n impl <$($generic_param: $generic_param_bound),*> Mul<$rhs_ty> for $lhs_ty {\n type Output = $output;\n\n #[inline]\n fn mul(self, rhs: $rhs_ty) -> $output {\n <$output>::mul_impl(apply($lhs_body, self), apply($rhs_body, rhs))\n }\n }\n\n impl <$($generic_param: $generic_param_bound),*> Div<$rhs_ty> for $lhs_ty {\n type Output = $output;\n\n #[inline]\n fn div(self, rhs: $rhs_ty) -> $output {\n <$output>::div_impl(apply($lhs_body, self), apply($rhs_body, rhs))\n }\n }\n\n impl_bin_ops!($($rest)*);\n };\n}\n\n macro_rules! impl_assign_ops {\n () => {};\n (for<$($generic_param:ident : $generic_param_bound:tt),*> <$lhs_ty:ty> ~= <$rhs_ty:ty> { _ ~= { $rhs_body:expr } } $($rest:tt)*) => {\n impl <$($generic_param: $generic_param_bound),*> AddAssign<$rhs_ty> for $lhs_ty {\n #[inline]\n fn add_assign(&mut self, rhs: $rhs_ty) {\n *self = *self + apply($rhs_body, rhs);\n }\n }\n\n impl <$($generic_param: $generic_param_bound),*> SubAssign<$rhs_ty> for $lhs_ty {\n #[inline]\n fn sub_assign(&mut self, rhs: $rhs_ty) {\n *self = *self - apply($rhs_body, rhs);\n }\n }\n\n impl <$($generic_param: $generic_param_bound),*> MulAssign<$rhs_ty> for $lhs_ty {\n #[inline]\n fn mul_assign(&mut self, rhs: $rhs_ty) {\n *self = *self * apply($rhs_body, rhs);\n }\n }\n\n impl <$($generic_param: $generic_param_bound),*> DivAssign<$rhs_ty> for $lhs_ty {\n #[inline]\n fn div_assign(&mut self, rhs: $rhs_ty) {\n *self = *self / apply($rhs_body, rhs);\n }\n }\n\n impl_assign_ops!($($rest)*);\n };\n}\n\n #[inline]\n fn apply O, X, O>(f: F, x: X) -> O {\n f(x)\n }\n\n impl_bin_ops! {\n for > ~ > -> StaticModInt { { |x| x } ~ { |x| x } }\n for > ~ <&'_ StaticModInt > -> StaticModInt { { |x| x } ~ { |&x| x } }\n for <&'_ StaticModInt > ~ > -> StaticModInt { { |&x| x } ~ { |x| x } }\n for <&'_ StaticModInt > ~ <&'_ StaticModInt > -> StaticModInt { { |&x| x } ~ { |&x| x } }\n for > ~ > -> DynamicModInt { { |x| x } ~ { |x| x } }\n for > ~ <&'_ DynamicModInt> -> DynamicModInt { { |x| x } ~ { |&x| x } }\n for <&'_ DynamicModInt> ~ > -> DynamicModInt { { |&x| x } ~ { |x| x } }\n for <&'_ DynamicModInt> ~ <&'_ DynamicModInt> -> DynamicModInt { { |&x| x } ~ { |&x| x } }\n\n for > ~ -> StaticModInt { { |x| x } ~ { StaticModInt::::new } }\n for > ~ -> DynamicModInt { { |x| x } ~ { DynamicModInt::::new } }\n }\n\n impl_assign_ops! {\n for > ~= > { _ ~= { |x| x } }\n for > ~= <&'_ StaticModInt > { _ ~= { |&x| x } }\n for > ~= > { _ ~= { |x| x } }\n for > ~= <&'_ DynamicModInt> { _ ~= { |&x| x } }\n\n for > ~= { _ ~= { StaticModInt::::new } }\n for > ~= { _ ~= { DynamicModInt::::new } }\n }\n\n macro_rules! impl_folding {\n () => {};\n (impl<$generic_param:ident : $generic_param_bound:tt> $trait:ident<_> for $self:ty { fn $method:ident(_) -> _ { _($unit:expr, $op:expr) } } $($rest:tt)*) => {\n impl<$generic_param: $generic_param_bound> $trait for $self {\n #[inline]\n fn $method(iter: S) -> Self\n where\n S: Iterator,\n {\n iter.fold($unit, $op)\n }\n }\n\n impl<'a, $generic_param: $generic_param_bound> $trait<&'a Self> for $self {\n #[inline]\n fn $method(iter: S) -> Self\n where\n S: Iterator,\n {\n iter.fold($unit, $op)\n }\n }\n\n impl_folding!($($rest)*);\n };\n}\n\n impl_folding! {\n impl Sum<_> for StaticModInt { fn sum(_) -> _ { _(Self::raw(0), Add::add) } }\n impl Product<_> for StaticModInt { fn product(_) -> _ { _(Self::raw(1), Mul::mul) } }\n impl Sum<_> for DynamicModInt { fn sum(_) -> _ { _(Self::raw(0), Add::add) } }\n impl Product<_> for DynamicModInt { fn product(_) -> _ { _(Self::raw(1), Mul::mul) } }\n }\n}\n", "lang": "Rust", "bug_code_uid": "455f4a148498b1e81b9d41311da423ff", "src_uid": "24e2f10463f440affccc2755f4462d8a", "apr_id": "541d94603662157f9b693f3f511c63ee", "difficulty": 1500, "tags": ["combinatorics", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9943293600277746, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#![allow(dead_code, unused_imports, unused_macros)]\n\nuse std::fmt::Debug;\nuse std::str::FromStr;\n\nfn read_stdin() -> String {\n let mut s = String::new();\n std::io::stdin()\n .read_line(&mut s)\n .expect(\"cannot read stdin\");\n s.trim().to_string()\n}\n\nfn read() -> T\nwhere\n T: FromStr,\n ::Err: Debug,\n{\n read_stdin().parse::().unwrap()\n}\n\nfn read_usize() -> usize {\n read::()\n}\n\nfn read_2() -> (A, B)\nwhere\n A: FromStr,\n ::Err: Debug,\n B: FromStr,\n ::Err: Debug,\n{\n let s = read_stdin();\n let mut s = s.split_whitespace();\n let a = s.next().unwrap().parse::().unwrap();\n let b = s.next().unwrap().parse::().unwrap();\n (a, b)\n}\n\nfn read_3() -> (A, B, C)\nwhere\n A: FromStr,\n ::Err: Debug,\n B: FromStr,\n ::Err: Debug,\n C: FromStr,\n ::Err: Debug,\n{\n let s = read_stdin();\n let mut s = s.split_whitespace();\n let a = s.next().unwrap().parse::().unwrap();\n let b = s.next().unwrap().parse::().unwrap();\n let c = s.next().unwrap().parse::().unwrap();\n (a, b, c)\n}\n\nfn read_4() -> (A, B, C, D)\nwhere\n A: FromStr,\n ::Err: Debug,\n B: FromStr,\n ::Err: Debug,\n C: FromStr,\n ::Err: Debug,\n D: FromStr,\n ::Err: Debug,\n{\n let s = read_stdin();\n let mut s = s.split_whitespace();\n let a = s.next().unwrap().parse::().unwrap();\n let b = s.next().unwrap().parse::().unwrap();\n let c = s.next().unwrap().parse::().unwrap();\n let d = s.next().unwrap().parse::().unwrap();\n (a, b, c, d)\n}\n\nfn read_multiple() -> Vec\nwhere\n ::Err: Debug,\n{\n read_stdin()\n .split_whitespace()\n .map(|x| x.parse::().expect(\"cannot parse stdin\"))\n .collect()\n}\n\n/// NOTE: sort iter beforehand if required\nfn count(iter: &mut impl Iterator) -> Vec<(T, usize)>\nwhere\n T: std::cmp::Ord,\n{\n let iter = iter.collect::>();\n //iter.sort();\n let (mut v, o, c) =\n iter.into_iter()\n .fold((Vec::new(), None, 0), |(mut v, last, count), item| {\n if let Some(o) = last {\n if item == o {\n (v, Some(o), count + 1)\n } else {\n v.push((o, count));\n (v, Some(item), 1)\n }\n } else {\n (v, Some(item), 1)\n }\n });\n if let Some(i) = o {\n v.push((i, c));\n }\n v\n}\n\nfn partial_sum(v: impl Iterator) -> impl Iterator\nwhere\n T: Default + std::ops::Add + Copy,\n{\n v.scan(T::default(), |state, x| {\n *state = *state + x;\n Some(*state)\n })\n}\n\nfn max_subarray(v: impl Iterator) -> (i64, (usize, usize)) {\n //assert!(v.len() > 0);\n let mut best_sum = 0;\n let (mut best_start, mut best_end) = (0, 0);\n let mut current_sum = 0;\n let mut current_start = 0;\n for (end, val) in v.enumerate() {\n if current_sum <= 0 {\n current_start = end;\n current_sum = val;\n } else {\n current_sum += val;\n }\n if current_sum > best_sum {\n best_sum = current_sum;\n best_start = current_start;\n best_end = end + 1;\n }\n }\n (best_sum, (best_start, best_end))\n}\n\nfn gcd(mut a: u64, mut b: u64) -> u64 {\n while a != 0 {\n let old_m = a;\n a = b % a;\n b = old_m;\n }\n b\n}\n\n/// returns gcd, and pair (x, y), such that x * a + b * y == gcd\nfn egcd(a: i64, b: i64) -> (i64, i64, i64) {\n if a == 0 {\n (b, 0, 1)\n } else {\n let (g, x, y) = egcd(b % a, a);\n (g, y - (b / a) * x, x)\n }\n}\n\nfn factorize(mut n: u64) -> Vec {\n if n <= 3 {\n return vec![n];\n }\n let mut v = Vec::new();\n while n % 2 == 0 {\n n /= 2;\n v.push(2);\n }\n while n % 3 == 0 {\n n /= 3;\n v.push(3);\n }\n let mut f = 6;\n while (f - 1) * (f - 1) <= n {\n while n % (f - 1) == 0 {\n n /= f - 1;\n v.push(f - 1);\n }\n while n % (f + 1) == 0 {\n n /= f + 1;\n v.push(f + 1);\n }\n f += 6;\n }\n if n > 1 {\n v.push(n);\n }\n v\n}\n\nfn compact_factors(n: u64) -> Vec<(u64, usize)> {\n count(&mut factorize(n).into_iter())\n}\n\nfn all_factors(n: u64) -> Vec {\n if n == 0 {\n return vec![0];\n } else if n == 1 {\n return vec![1];\n }\n let factors = compact_factors(n);\n let mut v = vec![1];\n for (fac, num) in factors {\n let ori = v.clone();\n for i in 1..num + 1 {\n v.append(\n &mut ori\n .clone()\n .into_iter()\n .map(|f| f * fac.pow(i as u32))\n .collect::>(),\n )\n }\n }\n v.sort();\n v\n}\n\nfn abs_diff(a: T, b: T) -> T\nwhere\n T: PartialOrd + std::ops::Sub,\n{\n if a > b {\n a - b\n } else {\n b - a\n }\n}\n\nstruct Permutations {\n inner: Vec,\n state: Vec,\n i: usize,\n start: bool,\n}\n\nimpl Permutations {\n fn new(inner: Vec) -> Self {\n Self {\n state: vec![0; inner.len()],\n i: 0,\n start: true,\n inner,\n }\n }\n}\n\n/*impl From for Permutations\nwhere\n X: IntoIterator,\n{\n fn from(f: X) -> Self {\n Self::new(f.into_iter().collect::>())\n }\n}*/\n\nimpl Iterator for Permutations\nwhere\n T: Clone,\n{\n type Item = Vec;\n fn next(&mut self) -> Option {\n if self.start {\n self.start = false;\n return Some(self.inner.clone());\n }\n while self.i < self.inner.len() {\n if self.state[self.i] < self.i {\n if self.i % 2 == 0 {\n self.inner.swap(0, self.i)\n } else {\n self.inner.swap(self.state[self.i], self.i)\n }\n self.state[self.i] += 1;\n self.i = 0;\n return Some(self.inner.clone());\n } else {\n self.state[self.i] = 0;\n self.i += 1;\n }\n }\n None\n }\n}\n\nuse std::cmp::{max, min, Ord, Ordering};\nuse std::collections::{BinaryHeap, VecDeque};\nuse std::mem::swap;\n\n#[derive(Clone)]\nstruct Graph {\n nodes: usize,\n edges: Vec>,\n}\n\nimpl Graph {\n fn new(n: usize) -> Self {\n Self {\n nodes: n,\n edges: vec![Vec::new(); n + 1],\n }\n }\n\n fn add_edge(&mut self, x: usize, y: usize, cost: u64) {\n self.edges[x].push((y, cost));\n self.edges[y].push((x, cost));\n }\n\n fn dijkstra(&mut self, start: usize, end: usize) -> u64 {\n let mut dist = vec![None; self.nodes + 1];\n let mut prev = vec![None; self.nodes + 1];\n dist[start] = Some(0);\n let mut queue = (1..=self.nodes).collect::>();\n queue.sort_unstable_by_key(|node| dist[*node].unwrap_or(std::u64::MAX));\n queue.reverse();\n while let Some(next_node) = queue.pop() {\n if next_node == end {\n return dist[next_node].unwrap();\n }\n for (neighbour, cost) in self.edges[next_node].iter() {\n let alt = dist[next_node].unwrap() + cost;\n if dist[*neighbour].is_none() {\n dist[*neighbour] = Some(alt);\n prev[*neighbour] = Some(next_node);\n } else {\n if alt < dist[*neighbour].unwrap() {\n dist[*neighbour] = Some(alt);\n prev[*neighbour] = Some(next_node);\n }\n }\n }\n //println!(\"{:?} {:?}\", dist, prev);\n queue.sort_unstable_by_key(|node| dist[*node].unwrap_or(std::u64::MAX));\n queue.reverse();\n }\n 0\n }\n\n fn set_cost(&mut self, x: usize, y: usize, cost: u64) {\n for i in 0..self.edges[x].len() {\n if self.edges[x][i].0 == y {\n self.edges[x][i].1 = cost\n }\n }\n for i in 0..self.edges[y].len() {\n if self.edges[y][i].0 == x {\n self.edges[y][i].1 = cost\n }\n }\n }\n}\n\nconst MODULO: u64 = 1_000_000_007;\n\n#[derive(Debug, Copy, Clone, Ord, PartialOrd, Eq, PartialEq)]\nstruct BigPrimeRing {\n inner: u64,\n}\n\nimpl From for BigPrimeRing\nwhere\n T: Into,\n{\n fn from(n: T) -> Self {\n Self {\n inner: n.into() % MODULO,\n }\n }\n}\n\nimpl std::ops::Add for BigPrimeRing\nwhere\n T: Into,\n{\n type Output = BigPrimeRing;\n fn add(self, rhs: T) -> Self::Output {\n Self {\n inner: (self.inner + rhs.into().inner) % MODULO,\n }\n }\n}\n\nimpl std::ops::AddAssign for BigPrimeRing\nwhere\n T: Into,\n{\n fn add_assign(&mut self, rhs: T) {\n self.inner += rhs.into().inner;\n self.inner %= MODULO;\n }\n}\n\nimpl std::ops::Sub for BigPrimeRing\nwhere\n T: Into,\n{\n type Output = BigPrimeRing;\n fn sub(self, rhs: T) -> Self::Output {\n Self {\n inner: (self.inner + MODULO - rhs.into().inner) % MODULO,\n }\n }\n}\n\nimpl std::ops::SubAssign for BigPrimeRing\nwhere\n T: Into,\n{\n fn sub_assign(&mut self, rhs: T) {\n self.inner += MODULO;\n self.inner -= rhs.into().inner;\n self.inner %= MODULO;\n }\n}\n\nimpl std::ops::Mul for BigPrimeRing\nwhere\n T: Into,\n{\n type Output = BigPrimeRing;\n fn mul(self, rhs: T) -> Self::Output {\n Self {\n inner: (self.inner * rhs.into().inner) % MODULO,\n }\n }\n}\n\nimpl std::ops::MulAssign for BigPrimeRing\nwhere\n T: Into,\n{\n fn mul_assign(&mut self, rhs: T) {\n self.inner *= rhs.into().inner;\n self.inner %= MODULO;\n }\n}\n\nimpl BigPrimeRing {\n fn inverse(self) -> Self {\n if self.inner == 0 {\n return self;\n }\n let (_g, mut x, _y) = egcd(self.inner as i64, MODULO as i64);\n if x < 0 {\n x += MODULO as i64;\n }\n Self { inner: x as u64 }\n }\n}\n\nmacro_rules! max_with {\n ($x: expr, $y: expr) => {\n $x = max($x, $y)\n };\n}\n\nmacro_rules! min_with {\n ($x: expr, $y: expr) => {\n $x = max($x, $y)\n };\n}\n\nfn is_prime(n: u64) -> bool {\n factorize(n).len() == 1\n}\n\nfn dp(graph: &Vec>, weights: &Vec, node: usize) -> (u64, u64, usize) {\n if graph[node].is_empty() {\n return (weights[node], 0, 1);\n }\n let weight = weights[node];\n let ans_vec = graph[node]\n .iter()\n .map(|neighbour| dp(graph, weights, *neighbour))\n .collect::>();\n let max_ans = ans_vec\n .iter()\n .map(|(a, _residue, _leaves)| *a)\n .max()\n .unwrap();\n let sum_residue = ans_vec\n .iter()\n .map(|(a, res, leaves)| res + (max_ans - a) * (*leaves) as u64)\n .sum::();\n let total_leaves = ans_vec.into_iter().map(|(_a, _r, l)| l).sum::();\n if sum_residue >= weight {\n (max_ans, sum_residue - weight, total_leaves)\n } else {\n let residue = weight - sum_residue;\n (\n max_ans + ((residue + total_leaves as u64 - 1) / total_leaves as u64),\n residue % total_leaves as u64,\n total_leaves,\n )\n }\n}\n\nfn main() -> Result<(), Box> {\n let (n, x, pos) = read_3::();\n let mut left = 0;\n let mut right = n;\n //let mut checks = Vec::new();\n let mut prefix = 0;\n let mut postfix = 0;\n while left < right {\n let middle = (left + right) / 2;\n //checks.push(middle);\n if middle <= pos {\n left = middle + 1;\n prefix += 1;\n } else {\n right = middle;\n postfix += 1;\n }\n }\n //checks.sort_unstable();\n // let prefix = checks.iter().take_while(|v| **v <= pos).count();\n //let postfix = checks.iter().skip_while(|v| **v <= pos).count();\n //println!(\"{:?}\", checks);\n //println!(\"{:?}\", prefix);\n //println!(\"{:?}\", postfix);\n let remain = n - prefix - postfix;\n let mut res = BigPrimeRing::from(1u8);\n for i in 1..=remain {\n res *= i as u64\n }\n //println!(\"{}\", res.inner);\n for i in (x - prefix + 1)..=(x - 1) {\n res *= i as u64\n }\n //println!(\"{}\", res.inner);\n for i in ((n - x) - postfix + 1)..=(n - x) {\n res *= i as u64\n }\n println!(\"{}\", res.inner);\n Ok(())\n}\n", "lang": "Rust", "bug_code_uid": "11e1e506e7b034af64d37f6294977514", "src_uid": "24e2f10463f440affccc2755f4462d8a", "apr_id": "fdf417a2c3f0cdef2a0734f1cff6d3e2", "difficulty": 1500, "tags": ["combinatorics", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.39805825242718446, "equal_cnt": 17, "replace_cnt": 10, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 16, "bug_source_code": "use std::io::stdin;\n\nfn main() {\n let mut s = String::new();\n stdin().read_line(&mut s).unwrap();\n s = String::new();\n stdin().read_line(&mut s).unwrap();\n let mut s: Vec = s.trim().bytes().collect();\n let mut count: u32 = 0;\n while s.len() > 1 {\n let mut b = false;\n let mut i = 0;\n while i < s.len() - 1 {\n if s[i] as i16 - s[i + 1] as i16 == 1 {\n b = true;\n s.remove(i);\n count += 1;\n }\n i += 1;\n }\n i = s.len() - 1;\n while i > 0 {\n if s[i] as i16 - s[i - 1] as i16 == 1 {\n b = true;\n s.remove(i);\n count += 1;\n }\n i -= 1;\n }\n if !b {\n break;\n }\n }\n println!(\"{}\", count);\n}\n", "lang": "Rust", "bug_code_uid": "9daddbeed6c9a5a9643ea589b02f8024", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "apr_id": "bfad21b5746835830fe0fae32aa98b6a", "difficulty": 1600, "tags": ["strings", "brute force", "greedy", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.8031298029900796, "equal_cnt": 16, "replace_cnt": 11, "delete_cnt": 4, "insert_cnt": 0, "fix_ops_cnt": 15, "bug_source_code": "#[allow(unused_imports)]\nuse std::cmp::{Ordering};\n\n#[allow(unused_imports)]\nuse std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};\n\n#[allow(unused_imports)]\nuse std::io::{stdin, stdout, BufWriter, Write};\n\n#[allow(unused_imports)]\nuse std::iter::FromIterator;\n\n#[allow(unused_macros)]\nmacro_rules! min {\n ($x: expr) => ($x);\n ($x: expr, $($z: expr),+) => {{\n std::cmp::min($x, min!($($z),*))\n }}\n}\n\n#[allow(unused_macros)]\nmacro_rules! max {\n ($x: expr) => ($x);\n ($x: expr, $($z: expr),+) => {{\n std::cmp::max($x, max!($($z),*))\n }}\n}\n\n#[allow(unused_macros)]\nmacro_rules! get { \n ([$t: ty]) => { \n { \n let mut line = String::new(); \n stdin().read_line(&mut line).unwrap(); \n line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::>()\n }\n };\n ([$t: ty];$n: expr) => {\n (0..$n).map(|_|get!([$t])).collect::>()\n };\n ($t: ty) => {\n {\n let mut line = String::new();\n stdin().read_line(&mut line).unwrap();\n line.trim().parse::<$t>().unwrap()\n }\n };\n ($($t: ty),*) => {\n { \n let mut line = String::new();\n stdin().read_line(&mut line).unwrap();\n let mut iter = line.split_whitespace();\n ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)\n }\n };\n ($t: ty; $n: expr) => {\n (0..$n).map(|_|get!($t)).collect::>()\n };\n ($($t: ty),*; $n: expr) => {\n (0..$n).map(|_|get!($($t),*)).collect::>()\n };\n}\n\n#[allow(unused_macros)]\nmacro_rules! debug {\n ($($a:expr),*) => {\n #[cfg(debug_assertions)]\n writeln!(&mut std::io::stderr(), concat!(\"[DEBUG] \", $(stringify!($a), \"={:?} \"),*), $($a),*).unwrap();\n }\n}\n\nconst BIG_STACK_SIZE: bool = true;\n\n#[allow(dead_code)]\nfn main() {\n use std::thread;\n if BIG_STACK_SIZE {\n thread::Builder::new()\n .stack_size(32 * 1024 * 1024)\n .name(\"solve\".into())\n .spawn(solve)\n .unwrap()\n .join()\n .unwrap();\n } else {\n solve();\n }\n}\n\n#[derive(Eq, PartialEq, Clone, Debug)]\npub struct Rev(pub T);\nimpl PartialOrd for Rev {\n fn partial_cmp(&self, other: &Rev) -> Option {\n other.0.partial_cmp(&self.0)\n }\n}\nimpl Ord for Rev {\n fn cmp(&self, other: &Rev) -> Ordering {\n other.0.cmp(&self.0)\n }\n}\n\nstruct BinaryIndexedTree {\n tree: Vec,\n}\nimpl BinaryIndexedTree {\n#[allow(dead_code)]\n fn new(n: usize) -> Self {\n BinaryIndexedTree {\n tree: vec![0; n + 1],\n }\n }\n#[allow(dead_code)]\n fn add(&mut self, a: usize, w: isize) {\n let mut x = a as isize + 1;\n while x < self.tree.len() as isize {\n self.tree[x as usize] += w;\n x += x & (-x);\n }\n }\n#[allow(dead_code)]\n fn sum(&self, n: usize) -> isize {\n let mut x = n as isize;\n let mut ret = 0;\n while x > 0 {\n ret += self.tree[x as usize];\n x -= x & (-x);\n }\n ret\n }\n#[allow(dead_code)]\n fn sum_with(&self, l: usize, r: usize) -> isize {\n if l == 0 {\n self.sum(r)\n } else {\n self.sum(r) - self.sum(l - 1)\n }\n }\n}\n\nfn solve() {\n let out = stdout();\n let mut out = BufWriter::new(out.lock());\n let n = get!(usize);\n let mut s = get!(String).chars().map(|e| e as usize - 'a' as usize).collect::>();\n\n let mut is = s.clone().into_iter().enumerate().collect::>();\n is.sort_by_key(|e|Rev(e.1));\n\n let mut bit = BinaryIndexedTree::new(n+1);\n for (i,c) in is {\n let j = i-bit.sum(i) as usize;\n if (j>0 && s[j-1]+1 == c) || (j {println!(concat!($(stringify!($a), \" = {:?}, \"),*), $($a),*);}}\n#[allow(unused_macros)]\nmacro_rules! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }\n#[allow(unused_macros)]\nmacro_rules! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }\n#[allow(unused_macros)]\nmacro_rules! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( \"Parse error\" ) } ; }\n\n#[derive(PartialEq, PartialOrd)]\npub struct Total(pub T);\nimpl Eq for Total {}\nimpl Ord for Total { fn cmp(&self, other: &Total) -> std::cmp::Ordering { self.0.partial_cmp(&other.0).unwrap() }}\n\n#[allow(dead_code)]\nconst MAX:usize = 100006;\n#[allow(dead_code)]\nconst MOD:i64 = 1e9 as i64 + 7;\n\n\n#[allow(dead_code)]\nfn read() -> T {\n let stdin = stdin();\n let stdin = stdin.lock();\n let token: String = stdin\n .bytes()\n .map(|c| c.expect(\"failed to read char\") as char)\n .skip_while(|c| c.is_whitespace())\n .take_while(|c| !c.is_whitespace())\n .collect();\n token.parse().ok().expect(\"failed to parse token\")\n}\n\n#[allow(dead_code)]\nfn read_vec() -> Vec {\n let mut s = String::new();\n std::io::stdin().read_line(&mut s).ok();\n s.trim().split_whitespace()\n .map(|e| e.parse().ok().unwrap()).collect()\n}\n\n\n#[allow(unused_imports)]\nuse std::f64;\n\nfn min(a:T, b:T) -> T {\n if a < b { a }\n else { b }\n}\n\nuse std::hash::Hash;\nfn inc(map:&mut BTreeMap, key:T) {\n let count = map.entry(key).or_insert(0);\n *count += 1;\n}\n\nfn main() {\n input!{n:usize, s:chars};\n let mut s = s;\n\n let mut ans = 0;\n\n loop {\n let mut f = vec![false;s.len()];\n for i in 0..s.len() {\n if i==0 {\n if s[i] as u8 == s[i+1] as u8 + 1 {\n f[i] = true;\n }\n }\n else if i == s.len()-1 {\n if s[i] as u8 == s[i-1] as u8 + 1 {\n f[i] = true;\n }\n }\n else {\n if s[i] as u8 == s[i-1] as u8 +1 {\n f[i] = true;\n }\n if s[i] as u8 == s[i+1] as u8 + 1 {\n f[i] = true;\n }\n }\n }\n let mut t = vec![];\n let mut cnt = 0;\n for i in 0..s.len() {\n if !f[i] {\n t.push(s[i]);\n }\n else { cnt += 1; }\n }\n //debug!(t);\n if cnt == 0 { break; }\n ans += cnt;\n if t.len() == 1 { break; }\n s = t;\n }\n\n println!(\"{}\", ans);\n\n}", "lang": "Rust", "bug_code_uid": "d7d8c286727ba61ff093d92a5dfee8fe", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "apr_id": "42a3099947972d1e9c5c4e95085946c3", "difficulty": 1600, "tags": ["strings", "brute force", "greedy", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9325925925925926, "equal_cnt": 17, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 16, "bug_source_code": "#[allow(unused_imports)]\nuse std::char::*;\n#[allow(unused_imports)]\nuse std::cmp::*;\n#[allow(unused_imports)]\nuse std::collections::*;\nuse std::io::*;\nuse std::str::FromStr;\n\n#[allow(unused_macros)]\nmacro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), \" = {:?}, \"),*), $($a),*);}}\n#[allow(unused_macros)]\nmacro_rules! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }\n#[allow(unused_macros)]\nmacro_rules! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }\n#[allow(unused_macros)]\nmacro_rules! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( \"Parse error\" ) } ; }\n\n#[derive(PartialEq, PartialOrd)]\npub struct Total(pub T);\nimpl Eq for Total {}\nimpl Ord for Total { fn cmp(&self, other: &Total) -> std::cmp::Ordering { self.0.partial_cmp(&other.0).unwrap() }}\n\n#[allow(dead_code)]\nconst MAX:usize = 100006;\n#[allow(dead_code)]\nconst MOD:i64 = 1e9 as i64 + 7;\n\n\n#[allow(dead_code)]\nfn read() -> T {\n let stdin = stdin();\n let stdin = stdin.lock();\n let token: String = stdin\n .bytes()\n .map(|c| c.expect(\"failed to read char\") as char)\n .skip_while(|c| c.is_whitespace())\n .take_while(|c| !c.is_whitespace())\n .collect();\n token.parse().ok().expect(\"failed to parse token\")\n}\n\n#[allow(dead_code)]\nfn read_vec() -> Vec {\n let mut s = String::new();\n std::io::stdin().read_line(&mut s).ok();\n s.trim().split_whitespace()\n .map(|e| e.parse().ok().unwrap()).collect()\n}\n\n\n#[allow(unused_imports)]\nuse std::f64;\n\nfn min(a:T, b:T) -> T {\n if a < b { a }\n else { b }\n}\n\nuse std::hash::Hash;\nfn inc(map:&mut BTreeMap, key:T) {\n let count = map.entry(key).or_insert(0);\n *count += 1;\n}\n\nfn main() {\n input!{n:usize, s:chars};\n let mut s = s;\n\n let mut ans = 0;\n\n loop {\n if s.len() == 1 { break; }\n let mut f = vec![false;s.len()];\n for i in 0..s.len() {\n if i==0 {\n if s[i] as u8 == s[i+1] as u8 + 1 {\n f[i] = true;\n }\n }\n else if i == s.len()-1 {\n if s[i] as u8 == s[i-1] as u8 + 1 {\n f[i] = true;\n }\n }\n else {\n if s[i] as u8 == s[i-1] as u8 +1 {\n f[i] = true;\n }\n if s[i] as u8 == s[i+1] as u8 + 1 {\n f[i] = true;\n }\n }\n }\n let mut t = vec![];\n let mut cnt = 0;\n for i in 0..s.len() {\n if !f[i] {\n t.push(s[i]);\n }\n else { cnt += 1; }\n }\n //debug!(t);\n if cnt == 0 { break; }\n ans += cnt;\n s = t;\n }\n\n println!(\"{}\", ans);\n\n}", "lang": "Rust", "bug_code_uid": "b986c45a963a57e16f38c6440b994c15", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "apr_id": "42a3099947972d1e9c5c4e95085946c3", "difficulty": 1600, "tags": ["strings", "brute force", "greedy", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.5991820040899796, "equal_cnt": 17, "replace_cnt": 7, "delete_cnt": 3, "insert_cnt": 7, "fix_ops_cnt": 17, "bug_source_code": "#[allow(unused_imports)]\nuse std::cmp::{max, min};\nuse std::io::stdin;\n#[derive(Default)]\nstruct Scanner {\n buffer: Vec,\n}\n\nimpl Scanner {\n fn next(&mut self) -> T {\n loop {\n if let Some(token) = self.buffer.pop() {\n return token.parse().ok().expect(\"Failed parse\");\n }\n let mut input = String::new();\n stdin().read_line(&mut input).expect(\"Failed read\");\n self.buffer = input.split_whitespace().rev().map(String::from).collect();\n }\n }\n}\nfn can_remove(index: usize, phrase: Vec) -> bool {\n let phrase_length = phrase.len();\n let (current, previous, next) = (\n phrase[index] as i32,\n if index == 0 {\n phrase[index] as i32\n } else {\n phrase[index - 1] as i32\n },\n if index == (phrase_length - 1) {\n phrase[index] as i32\n } else {\n phrase[index + 1] as i32\n },\n );\n (current as i32 - next as i32) == 1 || (current as i32 - previous as i32) == 1\n}\nfn try_remove<'a>(index: usize, phrase: Vec) -> Vec {\n let mut cloned = phrase.clone();\n let copied: &mut Vec = cloned.as_mut();\n if can_remove(index, copied.to_vec()) {\n copied.remove(index);\n }\n copied.to_vec()\n}\nfn start_reduce_from(start: usize, phrase: Vec) -> usize {\n let len = phrase.len();\n if start >= len {\n return len;\n }\n let removed = try_remove(start, phrase.clone());\n let mut reduced_len: usize = removed.len();\n if reduced_len < len {\n reduced_len = start_reduce_from(0, removed);\n }\n min(reduced_len, start_reduce_from(start + 1, phrase))\n}\n\nfn main() {\n let mut scan = Scanner::default();\n let length = scan.next::();\n let chars: Vec = scan.next::().chars().collect();\n let min_len = start_reduce_from(0, chars);\n println!(\"{}\", length - min_len)\n}\n", "lang": "Rust", "bug_code_uid": "5233ec3a8ead1910316caa1bffbe4f7d", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "apr_id": "f5e6c3db46c15b3afe646bb33cb41467", "difficulty": 1600, "tags": ["strings", "brute force", "greedy", "constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.2780917929007461, "equal_cnt": 12, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 12, "bug_source_code": "use std::io::stdin;\n\n#[allow(unused_imports)]\nuse std::iter::FromIterator;\n#[derive(Default)]\nstruct Scanner {\n buffer: Vec,\n}\n\nimpl Scanner {\n fn next(&mut self) -> T {\n loop {\n if let Some(token) = self.buffer.pop() {\n return token.parse().ok().expect(\"Failed parse\");\n }\n let mut input = String::new();\n stdin().read_line(&mut input).expect(\"Failed read\");\n self.buffer = input.split_whitespace().rev().map(String::from).collect();\n }\n }\n}\n\nfn _hash(vec: Vec) -> String {\n vec.iter().map(|x| format!(\"{}\", x)).collect::()\n}\nfn can_remove(index: usize, phrase: Vec<(char, bool)>) -> bool {\n let current = phrase[index];\n if current.1 {\n return false;\n }\n let mut can_r = false;\n let mut step = 1;\n let phrase_length = phrase.len();\n let mut max_next = false;\n let mut max_previous = false;\n loop {\n if max_next && max_previous || can_r {\n return can_r;\n }\n let next = if index + step < phrase_length && (step == 1 || phrase[index + step - 1].1) {\n phrase[index + step].0 as i32\n } else {\n max_next = true;\n phrase[index].0 as i32\n };\n let previous = if index >= step && (step == 1 || phrase[index - step + 1].1) {\n phrase[index - step].0 as i32\n } else {\n max_previous = true;\n phrase[index].0 as i32\n };\n can_r = current.0 as i32 - next == 1 || current.0 as i32 - previous == 1;\n step += 1;\n }\n}\nfn try_remove(index: usize, phrase: &mut Vec<(char, bool)>) -> bool {\n if can_remove(index, phrase.to_vec()) {\n phrase[index] = (phrase[index].0, true);\n return true;\n }\n false\n}\n\nfn start_reduce_from(total_len: usize, start: usize, phrase: &mut Vec<(char, bool)>) -> usize {\n let len = phrase.len();\n if start >= len {\n return 0;\n }\n if try_remove(start, phrase) {\n start_reduce_from(total_len, 0, phrase)\n } else {\n start_reduce_from(total_len, start + 1, phrase)\n }\n}\nfn main() {\n let mut scan = Scanner::default();\n let total_len = scan.next::();\n let mut chars: Vec<(char, bool)> = scan.next::().chars().map(|x| (x, false)).collect();\n let _ = start_reduce_from(total_len, 0, &mut chars);\n println!(\"{}\", chars.iter().cloned().filter(|(_, y)| *y).count());\n}\n", "lang": "Rust", "bug_code_uid": "c6a66b88d6e5179abe12e298dee4f27f", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "apr_id": "f5e6c3db46c15b3afe646bb33cb41467", "difficulty": 1600, "tags": ["strings", "brute force", "greedy", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.47320692497938993, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "use std::io::stdin;\nfn main() {\n let mut _text = String::new();\n stdin().read_line(&mut _text).unwrap();\n let commands = parse();\n let mut robot = Robot::new();\n let mut counter = 0;\n let mut results = vec!(0);\n for i in commands {\n robot.obey(i);\n counter +=1;\n if robot.x ==0 && robot.y ==0 {\n results.push(counter); \n }\n }\n println!(\"{}\",results[results.len()-1])\n \n}\nenum Command {\n U,\n D,\n L,\n R,\n}\nstruct Robot {\n x: usize,\n y: usize,\n}\nimpl Robot {\n fn new() -> Robot {\n Robot { x: 0, y: 0 }\n }\n fn obey(&mut self, c: Command) {\n match c {\n Command::U => {\n self.y += 1;\n }\n Command::D => {\n self.y -= 1;\n }\n Command::L => {\n self.x -= 1;\n }\n Command::R => {\n self.x += 1;\n }\n };\n }\n}\n\nfn parse() -> Vec {\n let mut text = String::new();\n stdin().read_line(&mut text).unwrap();\n let fu = |e: char| -> Command {\n match e {\n 'U' => Command::U,\n 'D' => Command::D,\n 'L' => Command::L,\n _ => Command::R,\n }\n };\n let text: Vec = text.trim().chars().map(fu).collect();\n text\n}\n", "lang": "Rust", "bug_code_uid": "3df2d36ce7d0ebe433b69f64e9e35c76", "src_uid": "b9fa2bb8001bd064ede531a5281cfd8a", "apr_id": "b739652f8c3b0f67b416ddfeff005b49", "difficulty": 1000, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9987745098039216, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "// ---------- begin input macro ----------\n// reference: https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8\nmacro_rules! input {\n (source = $s:expr, $($r:tt)*) => {\n let mut iter = $s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n ($($r:tt)*) => {\n let s = {\n use std::io::Read;\n let mut s = String::new();\n std::io::stdin().read_to_string(&mut s).unwrap();\n s\n };\n let mut iter = s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n}\n\nmacro_rules! input_inner {\n ($iter:expr) => {};\n ($iter:expr, ) => {};\n ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {\n let $var = read_value!($iter, $t);\n input_inner!{$iter $($r)*}\n };\n}\n\nmacro_rules! read_value {\n ($iter:expr, ( $($t:tt),* )) => {\n ( $(read_value!($iter, $t)),* )\n };\n ($iter:expr, [ $t:tt ; $len:expr ]) => {\n (0..$len).map(|_| read_value!($iter, $t)).collect::>()\n };\n ($iter:expr, chars) => {\n read_value!($iter, String).chars().collect::>()\n };\n ($iter:expr, bytes) => {\n read_value!($iter, String).bytes().collect::>()\n };\n ($iter:expr, usize1) => {\n read_value!($iter, usize) - 1\n };\n ($iter:expr, $t:ty) => {\n $iter.next().unwrap().parse::<$t>().expect(\"Parse error\")\n };\n}\n// ---------- end input macro ----------\n\nuse std::cmp::*;\n\nfn run() {\n input! {\n yang: (i64, i64, i64),\n mons: (i64, i64, i64),\n h: i64,\n a: i64,\n d: i64,\n }\n let win = |h: i64, a: i64, b: i64| -> bool {\n let yang = (yang.0 + h, yang.1 + a, yang.2 + b);\n let x = max(yang.1 - mons.2, 0);\n if x <= 0 {\n return false;\n }\n let y = max(mons.1 - yang.2, 0);\n if y <= 0 {\n return true;\n }\n let a = (yang.0 + y - 1) / y;\n let b = (mons.0 + x - 1) / x;\n a > b\n };\n // DEFを100, ATK を100買えば勝てる、これ以下\n let mut ans = 100 * a + 100 * d;\n for i in 0..=10000 {\n if i * h > ans {\n break;\n }\n for j in 0..=100 {\n if j * a > ans - i * h {\n break;\n }\n for k in 0..=100 {\n if win(i, j, k) {\n ans = min(ans, i * h + j * a + k * d);\n }\n }\n }\n }\n println!(\"{}\", ans);\n}\n\nfn main() {\n run();\n}\n", "lang": "Rust", "bug_code_uid": "f86938c0c9b20b46aa417cee31ae1bad", "src_uid": "bf8a133154745e64a547de6f31ddc884", "apr_id": "274797bae00b009f9193899366f5eb73", "difficulty": 1800, "tags": ["brute force", "implementation", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9104659673090998, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "macro_rules! parse_line {\n ($t: ty) => ({\n let mut a_str = String::new();\n std::io::stdin().read_line(&mut a_str).expect(\"read error\");\n let a_str = a_str.trim();\n a_str.parse::<$t>().expect(\"parse error\")\n });\n ($($t: ty),+) => ({\n let mut a_str = String::new();\n std::io::stdin().read_line(&mut a_str).expect(\"read error\");\n let mut a_iter = a_str.split_whitespace();\n (\n $(\n a_iter.next().unwrap().parse::<$t>().expect(\"parse error\"),\n )+\n )\n })\n}\n\nmacro_rules! parse_line_to_vec {\n ($t: ty) => {{\n let mut a_str = String::new();\n std::io::stdin().read_line(&mut a_str).expect(\"read error\");\n (a_str\n .split_whitespace()\n .map(|x| x.parse::<$t>().unwrap())\n .collect::>())\n }};\n}\n\nfn resolve(hy: i64, ay: i64, dy: i64, hm: i64, am: i64, dm: i64) -> bool {\n let ay = std::cmp::max(0, ay - dm);\n let am = std::cmp::max(0, am - dy);\n if ay == 0 {\n return false;\n }\n if am == 0 {\n return true;\n }\n let yt = (hy - 1) / am + 1;\n let mt = (hm - 1) / ay + 1;\n yt > mt\n}\n\nfn solve() {\n let (hy, ay, dy) = parse_line!(i64, i64, i64);\n let (hm, am, dm) = parse_line!(i64, i64, i64);\n let (h, a, d) = parse_line!(i64, i64, i64);\n let mut ans = std::i64::MAX;\n for aadd in 0..200 {\n for dadd in 0..100 {\n let ay = ay + aadd;\n let dy = dy + dadd;\n let mut l: i64 = -1;\n let mut r: i64 = 10001;\n while r - l > 1 {\n let m = (l + r) / 2;\n let hy = hy + m;\n if resolve(hy, ay, dy, hm, am, dm) {\n r = m;\n }else{\n l = m;\n }\n }\n let cost = aadd * a + dadd * d + r * h;\n ans = std::cmp::min(ans, cost);\n }\n }\n println!(\"{}\", ans);\n}\n\nfn main() {\n let tests = 1; // parse_line!(usize);\n for _ in 0..tests {\n solve();\n }\n}\n", "lang": "Rust", "bug_code_uid": "7746c01c505955e79e002f0c6dfbb03a", "src_uid": "bf8a133154745e64a547de6f31ddc884", "apr_id": "ab5d9748dffd0facf525b55493727f84", "difficulty": 1800, "tags": ["brute force", "implementation", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9826567562416619, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "#[allow(unused_imports)]\nuse std::cmp::{max, min};\n#[allow(unused_imports)]\nuse std::collections::{HashMap, HashSet};\n\nmod util {\n use std::io::stdin;\n use std::str::FromStr;\n use std::fmt::Debug;\n\n #[allow(dead_code)]\n pub fn line() -> String {\n let mut line: String = String::new();\n stdin().read_line(&mut line).unwrap();\n line.trim().to_string()\n }\n\n #[allow(dead_code)]\n pub fn get() -> T\n where\n ::Err: Debug,\n {\n let mut line: String = String::new();\n stdin().read_line(&mut line).unwrap();\n line.trim().parse().unwrap()\n }\n\n #[allow(dead_code)]\n pub fn gets() -> Vec\n where\n ::Err: Debug,\n {\n let mut line: String = String::new();\n stdin().read_line(&mut line).unwrap();\n line.split_whitespace()\n .map(|t| t.parse().unwrap())\n .collect()\n }\n\n #[allow(dead_code)]\n pub fn get2() -> (T, U)\n where\n ::Err: Debug,\n ::Err: Debug,\n {\n let mut line: String = String::new();\n stdin().read_line(&mut line).unwrap();\n let mut iter = line.split_whitespace();\n (\n iter.next().unwrap().parse().unwrap(),\n iter.next().unwrap().parse().unwrap(),\n )\n }\n\n #[allow(dead_code)]\n pub fn get3() -> (S, T, U)\n where\n ::Err: Debug,\n ::Err: Debug,\n ::Err: Debug,\n {\n let mut line: String = String::new();\n stdin().read_line(&mut line).unwrap();\n let mut iter = line.split_whitespace();\n (\n iter.next().unwrap().parse().unwrap(),\n iter.next().unwrap().parse().unwrap(),\n iter.next().unwrap().parse().unwrap(),\n )\n }\n}\n\n\n#[allow(unused_macros)]\nmacro_rules! debug {\n ($x: expr) => {\n println!(\"{}: {:?}\", stringify!($x), $x)\n }\n}\n\nfn main() {\n let (_n, _m): (usize, usize) = util::get2();\n let a: HashSet = util::gets().iter().cloned().collect();\n let b: HashSet = util::gets().iter().cloned().collect();\n\n for i in 1..99 {\n if i < 10 {\n if a.contains(&i) && b.contains(&i) {\n println!(\"{}\", i);\n return;\n }\n } else {\n if a.contains(&(i / 10)) && b.contains(&(i % 10)) {\n println!(\"{}\", i);\n return;\n }\n }\n }\n}\n", "lang": "Rust", "bug_code_uid": "b7ae35939d9ffb18163e4840cb948eb9", "src_uid": "3a0c1b6d710fd8f0b6daf420255d76ee", "apr_id": "a6a42e8132d12b6b5c8ce97c50f8692f", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9832310838445808, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 4, "bug_source_code": "use std::io::{self, BufReader, Stdin};\nuse std::io::prelude::*;\nuse std::collections::BTreeSet;\nuse std::iter::Map;\nuse std::str::SplitWhitespace;\n\nfn main() {\n let mut reader = ReadIn::new();\n\n reader.read_line();\n let a: BTreeSet = reader.read_iter().collect();\n let b: BTreeSet = reader.read_iter().collect();\n let c: BTreeSet = a.intersection(&b).map(|&x| x).collect();\n let res = (if !c.is_empty() { c.iter().map(|&x| x).next() } else {\n a.iter().next().and_then(\n |ax| b.iter().next().map(\n |bx| ax * 10 + bx))\n }).unwrap();\n print!(\"{}\", res);\n}\n\nstruct ReadIn { reader: BufReader, buf: String }\n\nimpl ReadIn {\n fn new() -> ReadIn { ReadIn { reader: BufReader::new(io::stdin()), buf: String::new() } }\n fn read_i32(s: &str) -> i32 { s.parse().unwrap() }\n fn read_line(&mut self) {\n self.buf.clear();\n self.reader.read_line(&mut self.buf);\n }\n fn read_iter(&mut self) -> Map i32> {\n self.read_line();\n self.buf.split_whitespace().map(ReadIn::read_i32)\n }\n fn read_vec(&mut self) -> Vec {\n self.read_iter().collect()\n }\n}\n\n\n\n", "lang": "Rust", "bug_code_uid": "b03e2ee15dc3d353c6a92316bcd28855", "src_uid": "3a0c1b6d710fd8f0b6daf420255d76ee", "apr_id": "a3ab8132a8eb884a24cad5dd985dc3d7", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9120385584401358, "equal_cnt": 21, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 12, "fix_ops_cnt": 21, "bug_source_code": "use rand::prelude::*;\nuse std::boxed::Box;\nuse std::cmp::*;\nuse std::io;\n#[derive(Clone)]\nstruct Node {\n pub key: T,\n pub weight: i64,\n pub left: Option>>,\n pub right: Option>>,\n}\n\nimpl Node {\n fn new(value: T) -> Self {\n Node {\n key: value,\n weight: rand::random::(),\n left: None,\n right: None,\n }\n }\n\n pub fn split(\n node: Option>>,\n key: &T,\n ) -> (Option>>, Option>>) {\n match node {\n None => (None, None),\n Some(mut node) => match node.key.cmp(key) {\n Ordering::Less => {\n let (l, r) = Self::split(node.right, key);\n node.right = l;\n (Some(node), r)\n }\n _ => {\n let (l, r) = Self::split(node.left, key);\n node.left = r;\n (l, Some(node))\n }\n },\n }\n }\n\n pub fn merge(left: Option>>, right: Option>>) -> Option>> {\n match (left, right) {\n (None, None) => None,\n (left, None) => left,\n (None, right) => right,\n (Some(mut left), Some(mut right)) => match left.weight.cmp(&right.weight) {\n Ordering::Less => {\n left.right = Self::merge(left.right, Some(right));\n Some(left)\n }\n _ => {\n right.left = Self::merge(Some(left), right.left);\n Some(right)\n }\n },\n }\n }\n\n fn find(node: &Option>>, key: &T) -> bool {\n match node {\n None => false,\n Some(node) => match node.key.cmp(key) {\n Ordering::Less => Self::find(&node.right, key),\n Ordering::Greater => Self::find(&node.left, key),\n Ordering::Equal => true,\n },\n }\n }\n\n fn less(node: &Box>) -> T {\n match node.left {\n None => node.key.clone(),\n Some(ref left) => Self::less(left),\n }\n }\n}\n\nstruct Treap {\n root: Option>>,\n}\n\nimpl Treap {\n pub fn insert(&mut self, key: T) {\n let (mut l, r) = Node::split(self.root.take(), &key);\n l = Node::merge(l, Some(Box::new(Node::new(key))));\n self.root = Node::merge(l, r);\n }\n\n pub fn delete(&mut self, key: &T) {\n let (l, mut r) = Node::split(self.root.take(), key);\n r = match r {\n None => None,\n Some(node) => {\n if &node.key == key {\n Node::merge(node.left, node.right)\n } else {\n Some(node)\n }\n }\n };\n self.root = Node::merge(l, r);\n }\n\n pub fn find(&self, key: &T) -> bool {\n Node::find(&self.root, key)\n }\n\n pub fn less(&self) -> Option {\n match self.root {\n Some(ref root) => Some(Node::less(root)),\n _ => None,\n }\n }\n\n pub fn new() -> Self {\n Treap { root: None }\n }\n}\n\nfn main() {\n let mut buffer = String::new();\n io::stdin().read_line(&mut buffer);\n buffer = String::new();\n io::stdin().read_line(&mut buffer);\n buffer.retain(|s| s != '\\r' && s != '\\n');\n let a: Vec = buffer\n .split_whitespace()\n .map(|n| n.parse::().unwrap())\n .collect();\n\n buffer = String::new();\n io::stdin().read_line(&mut buffer);\n buffer.retain(|s| s != '\\r' && s != '\\n');\n let b: Vec = buffer\n .split_whitespace()\n .map(|n| n.parse::().unwrap())\n .collect();\n\n let mut t1 = Treap::new();\n let mut t2 = Treap::new();\n //println!(\"{:?} | {:?}\", &a, &b);\n for n in a {\n t1.insert(n);\n }\n for n in b {\n t2.insert(n);\n }\n let (m1, m2) = (t1.less().unwrap(), t2.less().unwrap());\n\n match m1.cmp(&m2) {\n Ordering::Less => println!(\"{}{}\", m1, m2),\n Ordering::Greater => println!(\"{}{}\", m2, m1),\n Ordering::Equal => println!(\"{}\", m2),\n }\n}\n", "lang": "Rust", "bug_code_uid": "620378786ad4b8075c1e37bdd6904e1c", "src_uid": "3a0c1b6d710fd8f0b6daf420255d76ee", "apr_id": "d44517a31a64452f686b89302bb195b8", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9970414201183432, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "use std::io::stdin;\n\n// M => choose EVEN and choose FIRST\n// E => odd\n\nfn main() {\n let mut buffer = String::new();\n let _ = stdin().read_line(&mut buffer);\n\n let number: u32 = buffer.trim().parse().expect(\"Error in parsing\");\n\n if number % 2 == 0 {\n println!(\"Mahmoud\");\n } else {\n println!(\"Ehad\");\n }\n}\n", "lang": "Rust", "bug_code_uid": "21b21a60f94fd0a204993e8aed680eb8", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "apr_id": "d9438fe9939c9b4207e8cb2a3766e816", "difficulty": 800, "tags": ["math", "games"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.6062407132243685, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "use std::io;\n\nfn get_line() -> io::Result {\n\tlet mut buffer = String::new();\n\tio::stdin().read_line(&mut buffer)?;\n\tOk(buffer)\n}\n\nfn main() {\n\tlet employees;\n\t{\n\t\tlet input = get_line().unwrap();\n\t\temployees = input.trim().parse::().unwrap();\n\t}\n\n\tlet mut ways = 0;\n\tfor i in 1..employees {\n\t\tif (employees - i) % i == 0 {\n\t\t\tways += 1;\n\t\t}\n\t}\n\tprint!(\"{}\", ways);\n}\n", "lang": "Rust", "bug_code_uid": "96847af210b3395d91140eea2528d26a", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "apr_id": "6efcc84248fdc1d489e54332ecc2042a", "difficulty": 800, "tags": ["math", "games"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9796839729119639, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "use std::io;\n\nfn main() {\n\tlet mut n = String::new();\n\tio::stdin().read_line(&mut n).expect(\"Time to panic\");\n\tlet n: u64 = n.parse().unwrap();\n\tif n % 2 == 0 {\n\t\tprintln!(\"Ehab\");\n\t} else {\n\t\tprintln!(\"Mahmoud\")\n\t}\n}\n", "lang": "Rust", "bug_code_uid": "c9037d43c904a9c9a1408386d4d257ea", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "apr_id": "a626a0fe84b84ebc2b7df13e3e4174e5", "difficulty": 800, "tags": ["math", "games"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9955555555555555, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "use std::io;\n\nfn main() {\n\tlet mut n = String::new();\n\tio::stdin().read_line(&mut n).expect(\"Time to panic\");\n\tlet n: u64 = n.trim().parse().unwrap();\n\tif n % 2 == 0 {\n\t\tprintln!(\"Ehab\");\n\t} else {\n\t\tprintln!(\"Mahmoud\")\n\t}\n}\n", "lang": "Rust", "bug_code_uid": "51fbcdbacd5d8ca29978336113220edf", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "apr_id": "a626a0fe84b84ebc2b7df13e3e4174e5", "difficulty": 800, "tags": ["math", "games"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9864158829676071, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io;\n\nfn main() {\n let mut input = String::new();\n match io::stdin().read_line(&mut input) {\n Ok(_) => {\n let number = input.trim().parse::().unwrap();\n if number % 2 == 0 {\n println!(\"yes\");\n }\n else {\n println!(\"no\");\n }\n }\n Err(error) => println!(\"error: {}\", error),\n }\n}\n", "lang": "Rust", "bug_code_uid": "292444154f5e0c526655f22f356c0502", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "be5980296e9f5024f946580d1b98812b", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9779286926994907, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io::stdin;\n\nfn main() {\n let mut buffer = String::new();\n stdin().read_line(&mut buffer).expect(\"Cannot read line\");\n let i = buffer.trim().parse::().expect(\"Cannot parse\");\n\n if i % 2 == 0 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}\n", "lang": "Rust", "bug_code_uid": "6572bed77ea6e94d44c0661d5c142d99", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "69dda4a9ff17e6f1888e4d713a57f385", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9966777408637874, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "use std::io::stdin;\n\nfn main() {\n let mut buffer = String::new();\n stdin().read_line(&mut buffer).expect(\"Cannot read line\");\n let i = buffer.trim().parse::().expect(\"Cannot parse\");\n\n if i % 2 == 0 && n / 2 > 1 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}\n", "lang": "Rust", "bug_code_uid": "4bbc3c900ed2181a37f75c7ab3ec079a", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "69dda4a9ff17e6f1888e4d713a57f385", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9925650557620818, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "use std::io;\n\nfn main() {\n let mut input = String::new();\n io::stdin().read_line(&mut input).unwrap();\n let times = input.trim().parse::().unwrap();\n if times < 4 && times % 2 == 1 {\n println!(\"NO\");\n } else {\n println!(\"YES\");\n }\n}", "lang": "Rust", "bug_code_uid": "8e86502b5b0f333659c3e654e9657a41", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "a9d205dea0d2c39c23d35d1a3026a30b", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9802371541501976, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fn main() {\n let mut buffer = String::new();\n std::io::stdin().read_line(&mut buffer).expect(\"Failed\");\n let x = buffer.trim().parse::().unwrap();\n if x % 2 == 0 {\n println!(\"YES\")\n } else {\n println!(\"NO\")\n }\n}\n", "lang": "Rust", "bug_code_uid": "a73b696985d5489f1f870fb0c99ab4b9", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "d8dd37e97624598608aa061ad0fd4c97", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Rust"} {"similarity_score": 0.8374558303886925, "equal_cnt": 16, "replace_cnt": 2, "delete_cnt": 12, "insert_cnt": 1, "fix_ops_cnt": 15, "bug_source_code": "use std::io::{self};\n\nfn main() -> io::Result<()> {\n while true{\n let mut user_input = String::new();\n io::stdin().read_line(&mut user_input)?;\n let weight: u32 = user_input.trim_end().parse::().unwrap();\n\n let mut found: bool = false;\n for first_half in (2..weight).step_by(2) {\n let second_half = weight - first_half;\n if second_half % 2 == 0 {\n found = true;\n break;\n }\n }\n\n if found {\n println!(\"YES\")\n }else{\n println!(\"NO\")\n }\n }\n\n Ok(())\n}\n", "lang": "Rust", "bug_code_uid": "65603f8dedabd75cde25509dfc486cfd", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "86e2283e0802d4862fcb86c2300590b0", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Rust"} {"similarity_score": 0.6102941176470589, "equal_cnt": 10, "replace_cnt": 3, "delete_cnt": 5, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "use std::collections::HashSet;\n\nfn main() {\n let mut num = String::new();\n std::io::stdin().read_line(&mut num);\n let n:i32 = num.trim().parse().unwrap();\n\n let v = vec![2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89, 97];\n let primes:HashSet<_> = v.iter().collect();\n\n for i in v.iter() {\n if *i >= n {\n println!(\"NO\");\n break;\n }\n if primes.contains(&(n - *i)) {\n println!(\"YES\");\n break\n }\n }\n }\n", "lang": "Rust", "bug_code_uid": "2c1fd7bd58ab14c6eaad8a2a9ca60e1d", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "396ed44ac115c81d777aa36839642f60", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Rust"} {"similarity_score": 0.9841269841269841, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io::{self, BufRead};\n\nfn main() {\n let stdin = io::stdin();\n let mut lines = stdin.lock().lines();\n let n: u32 = lines.next().unwrap().unwrap().trim().parse().unwrap();\n\n if n % 2 == 0 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n\n}\n", "lang": "Rust", "bug_code_uid": "84103adfea17f7553e3349c88bd91d5b", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "bfe3ded7a14fcf455377639abe7f4191", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9954011241696474, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "//use std::str::FromStr;\n\n\n#[cfg(test)]\nmod tests {\n use crate::quest;\n\n #[test]\n fn test1() {\n assert_eq!(quest(2,2,1,1),2)\n }\n #[test]\n fn test2() {\n assert_eq!(quest(4,4,2,1),3)\n }\n #[test]\n fn test3() {\n assert_eq!(quest(6,10,4,2),6)\n }\n\n}\n/*\n#[inline]\npub fn input_in_four_var() -> (T, T, T, T)\nwhere T: Copy,\n{\n let mut line = String::new();\n std::io::stdin().read_line(&mut line).unwrap();\n let numbers: Vec = line.split_whitespace().filter_map(\n |s| s.parse().ok()\n )\n .collect();\n (*numbers.get(0).unwrap(),*numbers.get(1).unwrap(),*numbers.get(2).unwrap(),*numbers.get(3).unwrap() )\n\n}\n*/\n\n\n\n\nfn main() {\n let mut line = String::new();\n std::io::stdin().read_line(&mut line).unwrap();\n let v: i32 =match line.trim().parse() {\n Ok(t) => t,\n Err(_e) => panic!()\n };\n if v%2 ==0{\n return println!(\"YES\")\n }\n println!(\"NO\")\n\n}", "lang": "Rust", "bug_code_uid": "af965221ba155289272996e9bd98552f", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "5e0af2849117a75f5e2dffa3db41a896", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9941520467836257, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "use std::io;\n\nfn main() {\n\n let mut x = String::new();\n\n io::stdin().read_line(&mut x).expect(\"error\");\n\n let x: i32 = x.trim().parse().expect(\"error\");\n\n if x <= 1 && x <= 100 {\n let res = x % 2;\n\n if res == 0 && x != 2 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n }\n\n}\n", "lang": "Rust", "bug_code_uid": "b6c5f41916697abc2882ddfbc6d189d6", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "e290281050f53f37ca5350d595b41b79", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.86697965571205, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "use std::io;\n\nfn main() {\n\n let mut x = String::new();\n\n io::stdin().read_line(&mut x).expect(\"error\");\n\n let x: u8 = x.trim().parse().expect(\"error\");\n\n if (res >= 1 | res <= 100) {\n let res = x % 2;\n\n if (res == 0) {\n println!(\"YES\");\n } \n }\n\n}\n", "lang": "Rust", "bug_code_uid": "27dfc86aa76278407b71b427a0795f97", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "e290281050f53f37ca5350d595b41b79", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.8780487804878049, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "use std::io;\n\nfn main() {\n let mut weight = String::new();\n io::stdin().read_line(&mut weight).unwrap();\n let weight: u32 = weight.trim().parse().unwrap();\n match weight % 2 {\n 0 => println!(\"YES\"),\n _ => println!(\"NO\"),\n }\n}\n", "lang": "Rust", "bug_code_uid": "d5ed9a77430c42219cfcc5fa7b33f665", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "4e731511df63d6f2e3a00e387ae889c7", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9759229534510433, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "\n\nfn main() {\n\n let mut input = String::new();\n let stdin = std::io::stdin();\n stdin.read_line(&mut input).expect(\"Failed to read line!\");\n \n let weight = input.trim().parse::().unwrap();\n if weight % 2 == 0 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}\n\n", "lang": "Rust", "bug_code_uid": "f00ab0de5bf29ac0bf53c6201cec82d9", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "6fec444a3a253fe45bab50cbd0a31b10", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9571788413098237, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "use std::io;\n\nfn main() {\n let mut s = String::new();\n\n io::stdin().read_line(&mut s);\n let s: u8 = s.parse().unwrap();\n println!(\"{}\", if s % 2 == 0 { \"YES\" } else { \"NO\" });\n}\n", "lang": "Rust", "bug_code_uid": "84c621c6c3258b8b93cbff743da1020c", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "d0b3096ab96d608bc3076ca8ccb8b9ce", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9752475247524752, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io;\n\nfn main() {\n let mut s = String::new();\n\n io::stdin().read_line(&mut s);\n let s: u8 = s.trim().parse().unwrap();\n println!(\"{}\", if s % 2 == 0 { \"YES\" } else { \"NO\" });\n}\n", "lang": "Rust", "bug_code_uid": "eeaafb200aeb520fd5feb40ce65b0d07", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "d0b3096ab96d608bc3076ca8ccb8b9ce", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.907103825136612, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "use std::io;\n\nfn main() {\n let mut guess = String::new();\n\n io::stdin().read_line(&mut guess)\n .expect(\"Не удалось прочитать строку\");\n //\n\n\n let part: i32 = guess.trim().parse()\n .expect(\"Пожалуйста, введите число!\");\n\n if part % 2 == 0 {\n println!(\"YES\");\n }\n else{\n println!(\"No\");\n }\n\n}\n", "lang": "Rust", "bug_code_uid": "01e9c11ceecbbe8970d2cc60dcce287b", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "931b520f621e2a4a39d70a05ae88e7c3", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Rust"} {"similarity_score": 0.946927374301676, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "macro_rules! read_line {\n ($v:ident) => {\n let mut temp = String::new();\n std::io::stdin().read_line(&mut temp).unwrap();\n let $v = temp;\n };\n (var, $t:ty, $($v:ident), *) => {\n read_line!(input_line);\n let mut iter = parse_token!($t, input_line);\n $(\n let $v = iter.next().unwrap();\n )*\n };\n (vec, $t:ty, $v:ident) => {\n read_line!(input_line);\n let iter = parse_token!($t, input_line);\n let $v: Vec<$t> = iter.collect();\n };\n ($($v:ident; $t:ty), *) => {\n read_line!(input_line);\n let mut iter = input_line.split_whitespace();\n $(\n let $v: $t = iter.next().unwrap().parse().unwrap();\n )*\n };\n}\n\nmacro_rules! parse_token {\n ($t:ty, $e:expr) => {\n $e.split_whitespace().map(|x| x.parse::<$t>().unwrap());\n };\n}\n\nfn main() {\n read_line!(w;u64);\n match w % 2 {\n 0 => println!(\"YES\"),\n 1 => println!(\"NO\"),\n _ => unreachable!()\n };\n}", "lang": "Rust", "bug_code_uid": "fb00d1a194d6b1aa2faf97a1bd423d13", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "6503c7cb53bed593e17f42f73ffaf807", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.5793226381461676, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 10, "bug_source_code": "fn main() {\n let mut input = String::new();\n std::io::stdin()\n .read_line(&mut input)\n .ok()\n .expect(\"Couldn't read line\");\n // let weigh: int = input.trim().to_string();\n let weigh: i32 = input.trim().to_string().parse::().unwrap();\n\n if weigh % 2 == 0 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}\n", "lang": "Rust", "bug_code_uid": "a67a6bcecd223bf57e226a03940c67bb", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "54e9e69de4eb6ad11281ff58ac25b0f0", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9607476635514018, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "use std::io;\n\nfn main() {\n let mut input = String::new();\n io::stdin().read_line(&mut input).unwrap();\n let w: i32 = input.trim().parse().unwrap();\n\n if w > 3 && w % 2 == 0 && (w >> 1) % 2 == 0 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}\n", "lang": "Rust", "bug_code_uid": "ca62f3956e3f53a0bd5457accac509aa", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "761030322326e623c1b5e6c2bd10755a", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Rust"} {"similarity_score": 0.22269353128313893, "equal_cnt": 11, "replace_cnt": 3, "delete_cnt": 3, "insert_cnt": 5, "fix_ops_cnt": 11, "bug_source_code": "use std::env;\n\nfn main() {\n let weight = env::args().skip(1).map(|string| string.parse::().unwrap()).collect::>()[0];\n\n if weight % 2 == 0 {\n println!(\"YES\")\n } else {\n println!(\"NO\")\n }\n}\n", "lang": "Rust", "bug_code_uid": "73e45bce25e67d14059a2d162ce19334", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "d0a184a6dd1a49488c02ebdd6141292c", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9252669039145908, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "use std::io::stdin;\n#[derive(Default)]\nstruct Scanner {\n buffer: Vec\n}\nimpl Scanner {\n fn next(&mut self) -> T {\n loop {\n if let Some(token) = self.buffer.pop() {\n return token.parse().ok().expect(\"Failed parse\");\n }\n let mut input = String::new();\n stdin().read_line(&mut input).expect(\"Failed read\");\n self.buffer = input.split_whitespace().rev().map(String::from).collect();\n }\n }\n}\n\nfn main() {\n let mut scan = Scanner::default();\n\n let weight = scan.next::();\n\n if weight % 2 == 0 {\n print!(\"YES\")\n } else {\n print!(\"NO\")\n }\n \n}", "lang": "Rust", "bug_code_uid": "2f7b12ab89ce48b667c156cec9d6bc8e", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "d0a184a6dd1a49488c02ebdd6141292c", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Rust"} {"similarity_score": 0.9793388429752066, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io;\n\nfn main() {\n let mut s = String::new();\n io::stdin().read_line(&mut s).unwrap();\n\n let s: i32 = s.trim().parse().unwrap();\n\n if s % 2 == 0 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}\n", "lang": "Rust", "bug_code_uid": "a13d51c62c641a63bb96568f0b743eb8", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "a5d4da2913de2820529307aba345503c", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.8952702702702703, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io;\n\nfn main() {\n let mut inp = String::new();\n io::stdin().read_line(&mut inp).expect(\"Problem.\");\n let w: u16 = inp.trim().parse().expect(\"A number please.\");\n match w % 2 {\n 0 => println!(\"YES\"),\n _ => println!(\"NO\"),\n };\n}\n", "lang": "Rust", "bug_code_uid": "36b19849b41be47a5c985941259ffe30", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "9679dc1f4e18269ae35c198b89793c23", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9760956175298805, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io;\nfn main(){\n let mut input = String::new();\n io::stdin().read_line(&mut input).unwrap();\n let num: u32 = input.trim().parse().unwrap();\n if num % 2 == 0{\n println!(\"YES\");\n }else{\n println!(\"NO\");\n }\n}", "lang": "Rust", "bug_code_uid": "cf520ff8b77d47ffb2561678bc617a14", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "083cfcbc8638754f82b22fc62c8c3aa8", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.978494623655914, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fn main() {\n let mut input = String::from(\"\");\n std::io::stdin().read_line(&mut input).expect(\"Failed readline!\");\n let mut input = input.trim().parse::().unwrap();\n\n if input % 2 == 0 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}", "lang": "Rust", "bug_code_uid": "199e2f3c4224f64a6c27e6e76c7a19e5", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "b03a428f168b20a45d78c4d512a9c2df", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.8503937007874016, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "fn main() {\n let mut s = String::new();\n std::io::stdin().read_line(&mut s).unwrap();\n let n: i32 = s.split_whitespace().next().unwrap().parse().unwrap();\n\n if n % 4 == 0 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}\n\n/* vim: set ts=2 sts=2 sw=2 et: */\n", "lang": "Rust", "bug_code_uid": "f434fad4adfcd11cbc25e8342207a5ef", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "9e65b995462706a678e9d0f711e265cc", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9985443959243085, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fn main()\n{\n let mut input = String::new();\n std::io::stdin()\n .read_line(&mut input)\n .expect(\"Bleh.\");\n input = input.trim().to_string();\n let number : i32 = input.parse().unwrap();\n \n if (number % 2 == 0) && (number != 2)\n {\n println!(\"YES\\n\");\n }\n else\n {\n println!(\"NO\\n\");\n }\n", "lang": "Rust", "bug_code_uid": "481c9618e3401cfc305bbd9927e9c9f8", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "d13412cc7a76abb0f1cb811a1e29fa2a", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9357798165137615, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fn main()\n{\n let mut input = String::new();\n std::io::stdin()\n .read_line(&mut input)\n .expect(\"Bleh.\");\n let number : i32 = input.parse().unwrap();\n \n if (number % 2 == 0) && (number != 2)\n {\n println!(\"YES\\n\");\n }\n else\n {\n println!(\"NO\\n\");\n }\n} ", "lang": "Rust", "bug_code_uid": "a02430098fee7e48633a3b6fdd6c1716", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "d13412cc7a76abb0f1cb811a1e29fa2a", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Rust"} {"similarity_score": 0.9770833333333333, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fn main () {\n // read\n let mut s = String::new();\n io::stdin().read_line(&mut s);\n\n let int_vec: Vec =s.trim()\n .split(\" \")\n .map(|x|{\n x.parse::().expect(\"not an integer\")\n })\n .collect();\n\n let mut a :u32 = int_vec[0];\n\n if a%2==0{\n println!(\"YES\");\n }else{\n println!(\"NO\");\n }\n\n}", "lang": "Rust", "bug_code_uid": "d79a357255909c13beda5e35232755fb", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "8d4241f7a34d83ae22b457fca4ed3224", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9969418960244648, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "use std::io;\nfn main () {\n // read\n let mut s = String::new();\n io::stdin().read_line(&mut s);\n\n let int_vec: Vec =s.trim()\n .split(\" \")\n .map(|x|{\n x.parse::().expect(\"not an integer\")\n })\n .collect();\n\n let mut a :u32 = int_vec[0];\n\n if a%2==0 && a!=0{\n println!(\"YES\");\n }else{\n println!(\"NO\");\n }\n\n}", "lang": "Rust", "bug_code_uid": "b3662ce020c86bbf09ac458a34a51bbf", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "8d4241f7a34d83ae22b457fca4ed3224", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.314878892733564, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "#![feature(asm)]\nfn main() {\n let n: i32 = std::io::stdin()\n .lock()\n .lines()\n .next()\n .expect(\"stdin should be available\")\n .expect(\"couldn't read from stdin\")\n .trim()\n .parse()\n .expect(\"input was not an integer\");\n println!(if (n > 2 && n % 2 == 0) {\n \"YES\"\n } else {\n \"NO\"\n });\n}\n", "lang": "Rust", "bug_code_uid": "968e6b45c813ce529a36945d55b66f0d", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "53499a6de1ad5d0dc3e551e9781aa278", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9038461538461539, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "use std::io;\nfn int_input() -> i32{\n let mut input = String::new();\n io::stdin().read_line(&mut input).unwrap();\n let n: i32 = input.trim().parse().unwrap();\n n\n}\nfn main(){\n let n=int_input();\n if n%2==0{\n println!(\"YES\");\n }else{\n println!(\"NO\");\n }\n}", "lang": "Rust", "bug_code_uid": "51d891613063bf42beb5a8d2d85699a9", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "02f26bcd0ac0b50559b3cfc4169ecc49", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9841897233201581, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io::{self, prelude::*, Write};\nuse std::str;\nuse std::string::String;\nuse std::vec::Vec;\n\nuse std::cmp;\n\n#[allow(unused_must_use)]\nfn run(mut reader: Scanner, mut writer: W) {\n let total_number_of_trips: i32 = reader.next();\n let number_of_trips_with_special_ticket: i32 = reader.next();\n let one_trip_price: i32 = reader.next();\n let special_ticket_price: i32 = reader.next();\n\n let number_of_special_tickets_bought: i32 = total_number_of_trips / number_of_trips_with_special_ticket;\n let mut total_cost: i32 = number_of_special_tickets_bought * special_ticket_price;\n let remaining_trips_needed: i32 = total_number_of_trips % number_of_trips_with_special_ticket;\n if remaining_trips_needed > 0 {\n total_cost += cmp::min(remaining_trips_needed * one_trip_price, special_ticket_price);\n }\n\n writeln!(writer, \"{}\", total_cost);\n}\n\nfn main() {\n let stdin = io::stdin();\n let stdout = io::stdout();\n\n let reader = Scanner::new(stdin.lock());\n let writer = io::BufWriter::new(stdout.lock());\n run(reader, writer);\n io::stdout().flush().unwrap();\n}\n\npub struct Scanner {\n reader: B,\n buffer_string: Vec,\n buffer_iterator: str::SplitWhitespace<'static>,\n}\n\nimpl Scanner {\n pub fn new(reader: B) -> Self {\n return Self {\n reader,\n buffer_string: Vec::new(),\n buffer_iterator: \"\".split_whitespace()\n };\n }\n\n pub fn next(&mut self) -> T {\n loop {\n //if buffer already exists, just use existing buffer\n if let Some(token) = self.buffer_iterator.next() {\n return token.parse().ok().expect(\"Fail to parse token\");\n }\n\n //get new line\n self.buffer_string.clear();\n self.reader.read_until(b'\\n', &mut self.buffer_string).expect(\"Failed to read\");\n\n //split by white space\n self.buffer_iterator = unsafe {\n let slice = str::from_utf8_unchecked(&self.buffer_string);\n std::mem::transmute(slice.split_whitespace())\n };\n }\n }\n\n pub fn next_line(&mut self) -> String {\n //reset buffer\n self.buffer_iterator = \"\".split_whitespace();\n self.buffer_string.clear();\n\n let mut input: String = String::new();\n self.reader.read_line(&mut input).expect(\"Failed to read line\");\n return input.trim().to_string();\n }\n}", "lang": "Rust", "bug_code_uid": "387a52de6112370906f02ac871032c6b", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "apr_id": "18574e2b7d18e0d9c2704328d7bd0eec", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9968387776606955, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fn input_split() -> Vec {\n let mut buf = String::new();\n std::io::stdin().read_line(&mut buf).unwrap();\n buf.trim()\n .split_whitespace()\n .map(|elem| elem.parse().unwrap())\n .collect()\n}\n\nfn main() {\n let (n, m, a, b) = {\n let temp = input_split();\n (temp[0], temp[1], temp[2], temp[3])\n };\n\n if m * a > b {\n println!(\"{}\", (n / m) * b + b.min((n % m) * a));\n } else {\n println!(\"{}\", n * a);\n }\n}", "lang": "Rust", "bug_code_uid": "b3fd366c40b0bf1db313a7d90c3b98c9", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "apr_id": "e3dab9a90369522cdab7c504a0f568e6", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9957894736842106, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fn input_split() -> Vec {\n let mut buf = String::new();\n std::io::stdin().read_line(&mut buf).unwrap();\n buf.trim()\n .split_whitespace()\n .map(|elem| elem.parse().unwrap())\n .collect()\n}\n\nfn main() {\n let (n, m, a, b) = {\n let temp = input_split();\n (temp[0], temp[1], temp[2], temp[3])\n };\n\n if m * a > b {\n println!(\"{}\", (n / m) * b + b.min((n % m) * a));\n } else {\n println!(\"{}\", n * a);\n }\n}", "lang": "Rust", "bug_code_uid": "2ff1fd2cd0a1e70bb9292e8315897fb2", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "apr_id": "e3dab9a90369522cdab7c504a0f568e6", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.8409321175278622, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "// 2018-10-12 09:00\nfn main() {\n let v: Vec = {\n let mut line = String::new();\n std::io::stdin().read_line(&mut line).unwrap();\n line.trim().split(\" \").map(|s| s.parse::().unwrap()).collect()\n };\n let (n, m, a, b) = (v[0], v[1], v[2], v[3]);\n\n if b / m >= a {\n println!(\"{:?}\", a * n);\n } else {\n println!(\"{:?}\", (n as f32 / m as f32).ceil() as i32 * b);\n }\n}\n", "lang": "Rust", "bug_code_uid": "a5af6c5a7875646776e26a678297c96a", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "apr_id": "49d2671532dcc1595f1b940eadd5289a", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.904162633107454, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "use std::io;\nuse std::cmp::min;\n\nfn main() {\n let stdin = io::stdin();\n let mut s = String::new();\n stdin.read_line(&mut s).unwrap();\n\n let x: Vec = s.trim()\n .split_whitespace()\n .map(|x| x.parse().unwrap())\n .collect();\n\n let n = x[0];\n let m = x[1];\n let a = x[2];\n let b = x[3];\n\n if m * a <= b {\n println!(\"{}\", a*n);\n } else {\n if m > n { \n println!(\"{}\", min(b, a*n));\n } else {\n println!(\"{}\", b*(n/m)+a*(n%m));\n }\n }\n}\n", "lang": "Rust", "bug_code_uid": "705090ae7d674196d8f62e377ea963a0", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "apr_id": "cb36398e6226c8dc9ff96d6e7c6e242c", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.845771144278607, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "// https://codeforces.com/problemset/problem/466/A\nuse std::io;\n\nfn main() {\n let mut line = String::new();\n\n io::stdin()\n .read_line(&mut line)\n .unwrap();\n\n let words: Vec =\n line\n .split_whitespace()\n .map(|x| x.parse().unwrap())\n .collect();\n\n let n = words[0];\n let m = words[1];\n let a = words[2];\n let b = words[3];\n\n let sale: f64 = b/m;\n\n if sale < a {\n println!(\"{}\", (n/m).floor()*b + (n%m)*a);\n } else {\n println!(\"{}\", n*a);\n }\n}\n\n", "lang": "Rust", "bug_code_uid": "537b58c605edba223ef57fcd5bbcfd92", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "apr_id": "8dddd1545536d7d70ace112735c47508", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9918784385643176, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#[allow(unused_imports)]\nuse std::cmp;\n#[allow(unused_imports)]\nuse std::collections::BTreeSet;\n#[allow(unused_imports)]\nuse std::collections::HashSet;\nuse std::fs::File;\nuse std::io::Read;\n#[allow(unused_imports)]\nuse std::mem;\nuse std::fmt::Display;\n\n#[allow(dead_code)]\nfn pow_speedy_with_mod(mut p: i64, mut q: i64, m: i64) -> i64 {\n p %= m;\n let mut r = p;\n let mut ret: i64 = 1;\n while q > 0 {\n ret *= if q % 2 == 1 { r } else { 1 };\n r *= r;\n r %= m;\n q /= 2;\n ret %= m;\n }\n return ret;\n}\n\n#[allow(dead_code)]\nfn comb(n: usize, k: usize, m: i64, frac: &[i64], frac_inv: &[i64]) -> i64 {\n let mut ret = 1i64;\n if n < k {\n return 0;\n }\n ret *= frac[n] * frac_inv[n - k];\n ret %= m;\n ret *= frac_inv[k];\n ret %= m;\n ret\n}\n\n#[allow(dead_code)]\nfn show1dvec(v : &Vec) {\n let n = v.len();\n for i in 0..n - 1 {\n print!(\"{} \" , v[i]);\n }\n println!(\"{} \" , v[n - 1]);\n}\n\n\n#[derive(Debug)]\nstruct Piece {\n mark: char,\n y: i32,\n x: i32,\n}\n\nfn main() {\n let inputstatus = 1;\n\n let mut buf = String::new();\n let filename = \"inputrust.txt\";\n\n if inputstatus == 0 {\n let mut f = File::open(filename).expect(\"file not found\");\n f.read_to_string(&mut buf)\n .expect(\"something went wrong reading the file\");\n } else {\n std::io::stdin().read_to_string(&mut buf).unwrap();\n }\n\n let mut iter = buf.split_whitespace();\n\n let n: i32 = iter.next().unwrap().parse().unwrap();\n let m: i32 = iter.next().unwrap().parse().unwrap();\n let a: i32 = iter.next().unwrap().parse().unwrap();\n let b: i32 = iter.next().unwrap().parse().unwrap();\n\n println!(\"{}\", cmp::min(n * a, (n % m) * a + (n / m) * b));\n\n // let n = iter.next().unwrap().parse().unwrap();\n\n // println!(\"{}\", n);\n // println!(\"{:?}\", cum_num);\n}\n", "lang": "Rust", "bug_code_uid": "b6d3552d5bd387a90953afeb50807816", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "apr_id": "ed15521a1da9bc621cf1dfc100d24758", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9990766389658357, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "struct Scan {\n buffer: std::collections::VecDeque\n}\n\nimpl Scan {\n fn new() -> Scan {\n Scan { buffer: std::collections::VecDeque::new() }\n }\n\n fn next(&mut self)-> T {\n loop {\n if let Some(token) = self.buffer.pop_front() {\n break token.parse::().ok().unwrap();\n }\n let mut line = String::new();\n std::io::stdin().read_line(&mut line).expect(\"Fail to read\");\n self.buffer = line.split_whitespace().map(String::from).collect();\n }\n }\n\n}\n\nfn _main() {\n let mut scan = Scan::new();\n let n: isize = scan.next();\n let m: isize = scan.next();\n let a: isize = scan.next();\n let b: isize = scan.next();\n if a*m <= b {\n println!(\"{}\", a*n);\n } else {\n let mut result = (n/m)*b;\n if b <= a*(n%m) { result += 1; }\n else { result += (n%m)*a; }\n println!(\"{}\", result);\n }\n}\n\nfn main() {\n std::thread::Builder::new()\n .stack_size(1<<23).spawn(_main).unwrap().join().unwrap();\n}\n", "lang": "Rust", "bug_code_uid": "80040c43f861a0e38355dc17c4bd719b", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "apr_id": "d1b9e8d6b3a09fdb9bb7de63cecf514d", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.99712368168744, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "use std::cmp::min;\nuse std::io;\nuse std::io::Stdin;\nuse std::str::FromStr;\n\nfn read_line(stdin : &Stdin, line : &mut String) {\n match stdin.read_line(line) {\n Ok(_) => return,\n Err(msg) => panic!(\"Could not read line! Message: {}.\", msg),\n }\n}\n\nfn parse_t(s : &str) -> T {\n match s.trim().parse() {\n Ok(y) => y,\n Err(_) => panic!(\"Could not read from string!\"),\n }\n}\n\nfn read_ts(stdin : &Stdin, ts : &mut Vec) {\n let mut line = String::new();\n read_line(stdin, &mut line);\n let word_iter = line.split_whitespace();\n for word in word_iter {\n let x = parse_t(word);\n ts.push(x);\n }\n}\n\nfn main() {\n let stdin = io::stdin();\n let mut n_m_a_b : Vec = vec![];\n read_ts(&stdin, &mut n_m_a_b);\n let n = n_m_a_b[0];\n let m = n_m_a_b[1];\n let a = n_m_a_b[2];\n let b = n_m_a_b[3];\n let cost_1 = n * a;\n let cost_2 = ((n / m) * b) + ((n % m) * a);\n let min_cost = min(cost_1, cost_2);\n println!(\"{}\", min_cost);\n}\n", "lang": "Rust", "bug_code_uid": "7c899e535ca76310b0bd419e761e5d3e", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "apr_id": "b8be1c35a8575d156f20d87f38fbb3ff", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.7868691817736404, "equal_cnt": 4, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "// use rand::Rng;\n\nuse std::collections::*;\nuse std::io;\n\nfn trim_newline(s: &mut String) {\n if s.ends_with('\\n') {\n s.pop();\n if s.ends_with('\\r') {\n s.pop();\n }\n }\n}\nmacro_rules! parse_input {\n ($t:ident) => {{\n let mut input_line = String::new();\n io::stdin().read_line(&mut input_line).unwrap();\n trim_newline(&mut input_line);\n input_line.parse::<$t>().unwrap()\n }};\n}\n\nmacro_rules! split_input {\n ($t:ident) => {{\n parse_input!(String)\n .split(\" \")\n .map(|z| z.parse::<$t>().unwrap())\n .collect::>()\n }};\n}\n\nfn main() {\n let a = split_input!(u64);\n let n = a[0];\n let single = a[2];\n let group = a[3];\n let group_count = a[1];\n\n if (single * group_count) <= group {\n println!(\"{}\", single * n);\n } else {\n println!(\"{}\", n / group_count * group + (n % group_count) * single);\n }\n}\n", "lang": "Rust", "bug_code_uid": "c42541127310226737396f203f4b1d01", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "apr_id": "ff9adc4e9b823cbd8a63b4ebe7ea0e92", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9956140350877193, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "use std::io::stdin;\n\nfn read_line() -> String {\n let mut input = String::new();\n stdin().read_line(&mut input).expect(\"Failed to read line!\");\n input\n}\n\nfn main() {\n let input1 = read_line();\n let line1: Vec<&str> = input1.split(\" \").collect();\n let n = line1[0].trim().parse::().unwrap();\n let m = line1[1].trim().parse::().unwrap();\n let a = line1[2].trim().parse::().unwrap();\n let b = line1[3].trim().parse::().unwrap();\n\n let costs: i32;\n if b <= a {\n costs = f32::ceil(n as f32 / m as f32) as i32 * b;\n } else if b / m < a {\n if m > n {\n if n * a > m * b {\n costs = m * b;\n } else {\n costs = n * a;\n }\n } else {\n costs = (n % m) * a + f32::floor(n as f32 / m as f32) as i32 * b\n }\n } else {\n costs = n * a;\n }\n println!(\"{}\", costs);\n}\n", "lang": "Rust", "bug_code_uid": "1d61e10931df1b158be3cc6e68840c36", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "apr_id": "e11d415d8374d0a4300aa8f0e45ed693", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Rust"} {"similarity_score": 0.9371789806400632, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#[allow(unused_imports)]\nuse std::cmp::*;\n#[allow(unused_imports)]\nuse std::collections::*;\nuse std::io::Read;\n#[allow(dead_code)]\nfn getline() -> String {\n let mut ret = String::new();\n std::io::stdin().read_line(&mut ret).ok().unwrap();\n ret\n}\nfn get_word() -> String {\n let mut stdin = std::io::stdin();\n let mut u8b: [u8; 1] = [0];\n loop {\n let mut buf: Vec = Vec::with_capacity(16);\n loop {\n let res = stdin.read(&mut u8b);\n if res.unwrap_or(0) == 0 || u8b[0] <= b' ' {\n break;\n } else {\n buf.push(u8b[0]);\n }\n }\n if buf.len() >= 1 {\n let ret = String::from_utf8(buf).unwrap();\n return ret;\n }\n }\n}\n\n#[allow(dead_code)]\nfn get() -> T { get_word().parse().ok().unwrap() }\n\nfn solve() {\n let n: i64 = get();\n let x: i64 = get();\n println!(\"{}\", (x - (n % 3) + 3) % 3);\n}\n\nfn main() {\n // In order to avoid potential stack overflow, spawn a new thread.\n let stack_size = 104_857_600; // 100 MB\n let thd = std::thread::Builder::new().stack_size(stack_size);\n thd.spawn(|| solve()).unwrap().join().unwrap();\n}\n", "lang": "Rust", "bug_code_uid": "e885eb22c57839c2f3e27648e7a5d6f5", "src_uid": "7853e03d520cd71571a6079cdfc4c4b0", "apr_id": "13c27ba215bac6a10461985e78c4d885", "difficulty": 1000, "tags": ["math", "constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.970873786407767, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より\nmacro_rules! input {\n (source = $s:expr, $($r:tt)*) => {\n let mut iter = $s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n ($($r:tt)*) => {\n let s = {\n use std::io::Read;\n let mut s = String::new();\n std::io::stdin().read_to_string(&mut s).unwrap();\n s\n };\n let mut iter = s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n}\n\nmacro_rules! input_inner {\n ($iter:expr) => {};\n ($iter:expr, ) => {};\n ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {\n let $var = read_value!($iter, $t);\n input_inner!{$iter $($r)*}\n };\n}\n\nmacro_rules! read_value {\n ($iter:expr, ( $($t:tt),* )) => {\n ( $(read_value!($iter, $t)),* )\n };\n ($iter:expr, [ $t:tt ; $len:expr ]) => {\n (0..$len).map(|_| read_value!($iter, $t)).collect::>()\n };\n ($iter:expr, chars) => {\n read_value!($iter, String).chars().collect::>()\n };\n ($iter:expr, usize1) => {\n read_value!($iter, usize) - 1\n };\n ($iter:expr, $t:ty) => {\n $iter.next().unwrap().parse::<$t>().expect(\"Parse error\")\n };\n}\n\n// ここまで\n\nfn run() {\n input! {\n a: (u32, u32),\n b: (u32, u32),\n s: chars,\n }\n let mut f = 0;\n f += s[0].to_digit(10).unwrap() * 10 * 60;\n f += s[1].to_digit(10).unwrap() * 60;\n f += s[3].to_digit(10).unwrap() * 10;\n f += s[4].to_digit(10).unwrap();\n f = std::cmp::max(5 * 60, f);\n let start = (f + a.0 - 1) / a.0 * a.0;\n let end = start + a.1;\n let mut p = 300;\n let mut ans = 0;\n while p < 24 * 60 {\n let (s, e) = (p, p + b.1);\n let (l, r) = (std::cmp::max(s, start), std::cmp::min(e, end));\n if l < r {\n ans += 1;\n }\n p += b.0;\n }\n println!(\"{}\", ans);\n}\n\nfn main() {\n run();\n}\n", "lang": "Rust", "bug_code_uid": "c0533a16069b920155d6206361eacc06", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "apr_id": "fe43274ee7b0fb4464c22815242f2b54", "difficulty": 1600, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9973474801061007, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "use std::io;\n\nfn main() {\n let mut ni = String::new();\n io::stdin().read_line(&mut ni).unwrap();\n let mut si = String::new();\n io::stdin().read_line(&mut si).unwrap();\n let sf = si.trim().matches(\"SF\").collect::>().len(); \n let fs = si.trim().matches(\"SF\").collect::>().len(); \n if sf > fs {\n println!(\"YES\")\n } else {\n println!(\"NO\")\n }\n}\n", "lang": "Rust", "bug_code_uid": "4073fb0c7e17caab219a4941d03c919e", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "apr_id": "74b292e40dacd3716001bcb3cb7a92fa", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Rust"} {"similarity_score": 0.6512295081967213, "equal_cnt": 12, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "// ---------- begin input macro ----------\n// reference: https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8\nmacro_rules! input {\n (source = $s:expr, $($r:tt)*) => {\n let mut iter = $s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n ($($r:tt)*) => {\n let s = {\n use std::io::Read;\n let mut s = String::new();\n std::io::stdin().read_to_string(&mut s).unwrap();\n s\n };\n let mut iter = s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n}\n\nmacro_rules! input_inner {\n ($iter:expr) => {};\n ($iter:expr, ) => {};\n ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {\n let $var = read_value!($iter, $t);\n input_inner!{$iter $($r)*}\n };\n}\n\nmacro_rules! read_value {\n ($iter:expr, ( $($t:tt),* )) => {\n ( $(read_value!($iter, $t)),* )\n };\n ($iter:expr, [ $t:tt ; $len:expr ]) => {\n (0..$len).map(|_| read_value!($iter, $t)).collect::>()\n };\n ($iter:expr, chars) => {\n read_value!($iter, String).chars().collect::>()\n };\n ($iter:expr, bytes) => {\n read_value!($iter, String).bytes().collect::>()\n };\n ($iter:expr, usize1) => {\n read_value!($iter, usize) - 1\n };\n ($iter:expr, $t:ty) => {\n $iter.next().unwrap().parse::<$t>().expect(\"Parse error\")\n };\n}\n// ---------- end input macro ----------\n\nfn run() {\n input! {\n n: usize,\n l: u64,\n }\n let mut binom = vec![vec![0u64; n + 1]; n + 1];\n binom[0][0] = 1;\n for i in 1..=n {\n binom[i][0] = 1;\n for j in 1..=i {\n binom[i][j] = binom[i - 1][j - 1] + binom[i - 1][j];\n }\n }\n let mut fact = vec![1u64; n + 1];\n for i in 1..=n {\n fact[i] = (i as u64).saturating_mul(fact[i - 1]);\n }\n let calc = |n: usize, k: usize| -> u64 {\n assert!(1 <= k && k <= n);\n let n = n - k;\n let mut dp = vec![1u64; n + 1];\n for i in 2..=n {\n let mut way = 0u64;\n for j in 1..=i {\n way = way.saturating_add(dp[i - j]);\n }\n dp[i] = way;\n }\n dp[n]\n };\n let mut set = std::collections::BTreeSet::new();\n for i in 1..=n {\n set.insert(i);\n }\n let mut l = l - 1;\n let mut ans = vec![];\n for i in (1..=n).rev() {\n let mut del = 0;\n for (j, &v) in set.iter().enumerate() {\n let way = calc(i, j + 1);\n if way > l {\n del = v;\n break;\n } else {\n l -= way;\n }\n }\n set.remove(&del);\n ans.push(del);\n }\n for (i, a) in ans.iter().enumerate() {\n if i > 0 {\n print!(\" \");\n }\n print!(\"{}\", *a);\n }\n println!();\n}\n\nfn main() {\n run();\n}\n", "lang": "Rust", "bug_code_uid": "e99570801f81fe0b446c3f01f9654557", "src_uid": "e03c6d3bb8cf9119530668765691a346", "apr_id": "76510fdf9cf4e194364c8d6e2ce7c017", "difficulty": 1900, "tags": ["combinatorics", "greedy", "math", "implementation", "constructive algorithms", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.8394135697238323, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "use std::io::prelude::*;\nuse std::io;\nuse std::str::FromStr;\n#[cfg(local)]\nuse std::fs::File;\n#[cfg(local)]\nuse std::io::BufReader;\n\n#[cfg(local)]\nfn buf_read() -> io::Result<(Vec)> {\n let f = try!(File::open(\"input.txt\"));\n let input_lines: Vec<_> = BufReader::new(f).lines().collect();\n let lines: Vec = input_lines.into_iter().map(|e| e.unwrap()).collect();\n Ok((lines))\n}\n\n#[cfg(not(local))]\nfn buf_read() -> io::Result<(Vec)> {\n let stdin = io::stdin();\n let input_lines: Vec<_> = stdin.lock().lines().collect();\n let lines: Vec = input_lines.into_iter().map(|e| e.unwrap()).collect();\n Ok((lines))\n}\n\nfn main() {\n type Element = f64;\n let input = buf_read().unwrap();\n let mut input_vectors: Vec> = vec![];\n for input_line in input {\n let input_str: Vec = input_line.split(' ').map(String::from).collect();\n let mut input_vector: Vec = vec![];\n for input_elem_str in input_str {\n let elem: Element = Element::from_str(input_elem_str.as_str()).unwrap();\n input_vector.push(elem);\n }\n input_vectors.push(input_vector);\n }\n let two: f64 = 2.0;\n // println!(\"{:?}\", two.log(input_vectors[0][0]));\n println!(\"{:?}\", input_vectors[0][0].log(two).ceil() as i64);\n}\n", "lang": "Rust", "bug_code_uid": "f675d4da410b0d9dc45f2b024337ea39", "src_uid": "3d3432b4f7c6a3b901161fa24b415b14", "apr_id": "e5b7f84342b10e6914a9d8d61bede15b", "difficulty": 1600, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.7488584474885844, "equal_cnt": 7, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "use std::io::prelude::*;\nuse std::io;\nuse std::str::FromStr;\n#[cfg(local)]\nuse std::fs::File;\n#[cfg(local)]\nuse std::io::BufReader;\n\n#[cfg(local)]\nfn buf_read() -> io::Result<(Vec)> {\n let f = try!(File::open(\"input.txt\"));\n let input_lines: Vec<_> = BufReader::new(f).lines().collect();\n let lines: Vec = input_lines.into_iter().map(|e| e.unwrap()).collect();\n Ok((lines))\n}\n\n#[cfg(not(local))]\nfn buf_read() -> io::Result<(Vec)> {\n let stdin = io::stdin();\n let input_lines: Vec<_> = stdin.lock().lines().collect();\n let lines: Vec = input_lines.into_iter().map(|e| e.unwrap()).collect();\n Ok((lines))\n}\n\nfn main() {\n type Element = i64;\n let input = buf_read().unwrap();\n let mut input_vectors: Vec> = vec![];\n for input_line in input {\n let input_str: Vec = input_line.split(' ').map(String::from).collect();\n let mut input_vector: Vec = vec![];\n for input_elem_str in input_str {\n let elem: Element = Element::from_str(input_elem_str.as_str()).unwrap();\n input_vector.push(elem);\n }\n input_vectors.push(input_vector);\n }\n // let two: f64 = 2.0;\n // println!(\"{:?}\", two.log(input_vectors[0][0]));\n //\n // println!(\"{:?}\", input_vectors[0][0].log(two).ceil() as i64);\n // for n in 0..f64::INFINITY {\n let mut n = 0;\n loop {\n if fib(n) > input_vectors[0][0] {\n println!(\"{}\", n - 1);\n break;\n }\n n += 1;\n }\n}\n\nfn fib(e: i64) -> i64 {\n if e == 0 {\n return 1;\n } else if (e == 1) {\n return 2;\n }\n return fib(e - 1) + fib(e - 2);\n}\n", "lang": "Rust", "bug_code_uid": "3affc3ba0133210e8c503530ee3488f3", "src_uid": "3d3432b4f7c6a3b901161fa24b415b14", "apr_id": "e5b7f84342b10e6914a9d8d61bede15b", "difficulty": 1600, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.8993380506733623, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "use std::io::{self, Stdin};\nuse std::str::{self, FromStr};\nuse std::error::Error;\nuse std::thread;\n\nfn exec() {\n let mut sc = Scanner::new();\n let n: i64 = sc.ne();\n let mut cur = 1i64;\n let mut cnt = 0;\n while cur < n {\n cur *= 2;\n cnt += 1;\n }\n println!(\"{}\", cnt);\n}\nconst DEFAULT_STACK: usize = 16 * 1024 * 1024;\nfn main() {\n let builder = thread::Builder::new();\n let th = builder.stack_size(DEFAULT_STACK);\n let handle = th.spawn(|| { exec(); }).unwrap();\n let _ = handle.join();\n}\n\n#[allow(dead_code)]\nstruct Scanner {\n stdin: Stdin,\n id: usize,\n buf: Vec,\n}\n\n#[allow(dead_code)]\nimpl Scanner {\n fn new() -> Scanner {\n Scanner {\n stdin: io::stdin(),\n id: 0,\n buf: Vec::new(),\n }\n }\n fn next_line(&mut self) -> Option {\n let mut res = String::new();\n match self.stdin.read_line(&mut res) {\n Ok(0) => return None,\n Ok(_) => Some(res),\n Err(why) => panic!(\"error in read_line: {}\", why.description()),\n }\n }\n fn next(&mut self) -> Option {\n while self.buf.len() == 0 {\n self.buf = match self.next_line() {\n Some(r) => {\n self.id = 0;\n r.trim().as_bytes().to_owned()\n }\n None => return None,\n };\n }\n let l = self.id;\n assert!(self.buf[l] != b' ');\n let n = self.buf.len();\n let mut r = l;\n while r < n && self.buf[r] != b' ' {\n r += 1;\n }\n let res = match str::from_utf8(&self.buf[l..r]).ok().unwrap().parse::() {\n Ok(s) => Some(s),\n Err(_) => panic!(\"parse error\"),\n };\n while r < n && self.buf[r] == b' ' {\n r += 1;\n }\n if r == n {\n self.buf.clear();\n } else {\n self.id = r;\n }\n res\n }\n fn ne(&mut self) -> T {\n self.next::().unwrap()\n }\n}\n", "lang": "Rust", "bug_code_uid": "f3257a22d484934660b4931d1a42eff2", "src_uid": "3d3432b4f7c6a3b901161fa24b415b14", "apr_id": "61a05e6c78a14e2ba5a6cdc11a38f510", "difficulty": 1600, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9223927062486101, "equal_cnt": 18, "replace_cnt": 7, "delete_cnt": 7, "insert_cnt": 3, "fix_ops_cnt": 17, "bug_source_code": "use std::collections::BTreeSet;\nfn main() {\n let mut ri = ReadIn::new();\n let tp = ri.int2();\n let n = tp.0 as usize;\n let m = tp.1;\n let mut it = ri.ints();\n let mut num = Vec::new();\n for _ in 0..n {\n num.push(it.next().unwrap());\n }\n if n == 1 {\n println!(\"{}\", num[0]);\n return ;\n }\n let fst = num[0..n/2].to_vec();\n let snd = num[n/2..n].to_vec();\n let s1 = explore(fst,m);\n let s2 = explore(snd,m);\n let mut it3 = s1.iter();\n let mut it4 = s2.iter();\n let mut ans = (it3.next_back().unwrap() + it4.next_back().unwrap()) % m;\n let mut it1 = s1.iter();\n let mut it2 = s2.iter();\n loop {\n match it1.next() {\n Some(v1) => {\n loop {\n match it2.next_back() {\n Some(v2) => {\n if v1 + v2 < m {\n if (v1 + v2) > ans {\n ans = v1 + v2;\n }\n break;\n }\n },\n None => break,\n }\n }\n },\n None => break,\n }\n }\n println!(\"{}\", ans);\n}\n\nfn explore(v:Vec, m:i32) -> BTreeSet {\n let n = v.len();\n let mut st = BTreeSet::new();\n for msk in 0..1< 0 {\n s = (s + v[i]) % m;\n }\n }\n st.insert(s);\n }\n st\n}\n\nuse std::iter::Map;\nuse std::str::SplitWhitespace;\nuse std::io::stdin;\nuse std::mem::forget;\n\npub struct ReadIn(pub String);\n\nimpl ReadIn {\n pub fn new() -> ReadIn {\n ReadIn(String::new())\n }\n fn read_i32(s: &str) -> i32 {\n s.parse().unwrap()\n }\n pub fn read_line(&mut self) {\n self.0.clear();\n forget(stdin().read_line(&mut self.0));\n }\n pub fn ints(&mut self) -> Map i32> {\n self.read_line();\n self.0.split_whitespace().map(ReadIn::read_i32)\n }\n pub fn int(&mut self) -> i32 {\n self.ints().next().unwrap()\n }\n pub fn int2(&mut self) -> (i32, i32) {\n let mut it = self.ints();\n (it.next().unwrap(), it.next().unwrap())\n }\n}\n", "lang": "Rust", "bug_code_uid": "c905d50fb11cfc0731be2d643adaa877", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "apr_id": "2ab78c2565f94ecbe624973e8ca6f5c5", "difficulty": 1800, "tags": ["divide and conquer", "meet-in-the-middle", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9000689179875948, "equal_cnt": 17, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 16, "bug_source_code": "use std::io::BufRead;\n\nconst MODULO: u128 = 1000000007;\n\nfn delta_greater(a: usize, b: usize, c: usize) -> bool {\n if a > b {\n return (a - b) > c;\n } else {\n return (b - a) > c;\n }\n}\n\nfn sqrt_int(x: usize) -> usize {\n if x == 0 {\n return 0;\n }\n let mut value: usize = x + 2;\n let mut value1: usize = x;\n while delta_greater(value, value1, 1) {\n value = value1;\n value1 = (value + (x / value)) / 2;\n }\n value1 = (value1 + (x / value1)) / 2;\n return value1;\n}\n\nfn get_power_value(base: u128, power: u128) -> u128 {\n let mut value: u128 = 1;\n let mut z: u128 = base;\n let mut power_of_2: u128 = 1;\n let mut power_tmp: u128 = power;\n for _ in 0..127 {\n if (power_tmp & 1) != 0 {\n value *= z;\n value %= MODULO;\n }\n\n z *= z;\n z %= MODULO;\n\n power_of_2 <<= 1;\n power_tmp >>= 1;\n if power_of_2 > power {\n break;\n }\n }\n return value;\n}\n\nfn get_prime_divider_power(value: u128, divider: u128) -> u128 {\n let mut power: u128 = 0;\n let mut divider_tmp: u128 = divider;\n while divider_tmp <= value {\n power += value / divider_tmp;\n divider_tmp *= divider;\n }\n return power;\n}\n\nfn func_g1_mod(n: u128, p: u128) -> u128 {\n let power: u128 = get_prime_divider_power(n, p);\n return get_power_value(p, power);\n}\n\nfn func_f1_mod(x: usize, n: u128) -> u128 {\n let x_sqrt: usize = sqrt_int(x) + 1;\n let mut primes: Vec = Vec::with_capacity(x_sqrt);\n for _ in 0..x_sqrt {\n primes.push(true);\n }\n {\n let mut i: usize = 2;\n while (i * i) < x_sqrt {\n if primes[i] {\n let mut j: usize = i * i;\n while j < x_sqrt {\n primes[j] = false;\n j += i;\n }\n }\n i += 1;\n }\n }\n\n let mut value: u128 = 1;\n\n let mut x_dividers_found: bool = false;\n for i in 2..x_sqrt {\n if (i as u128) > n {\n break;\n }\n if (x % i) != 0 {\n continue;\n }\n x_dividers_found = true;\n if primes[i] {\n value *= func_g1_mod(n, i as u128);\n value %= MODULO;\n }\n }\n if !x_dividers_found {\n value *= func_g1_mod(n, x as u128);\n value %= MODULO;\n }\n\n return value;\n}\n\n#[cfg(test)]\nmod tests {\n use super::{func_f1_mod, get_power_value, sqrt_int};\n\n #[test]\n fn test_a1() {\n assert_eq!(sqrt_int(0), 0);\n assert_eq!(sqrt_int(1), 1);\n assert_eq!(sqrt_int(2), 1);\n assert_eq!(sqrt_int(3), 1);\n assert_eq!(sqrt_int(4), 2);\n assert_eq!(sqrt_int(5), 2);\n assert_eq!(sqrt_int(6), 2);\n assert_eq!(sqrt_int(7), 2);\n assert_eq!(sqrt_int(8), 2);\n assert_eq!(sqrt_int(9), 3);\n assert_eq!(sqrt_int(10), 3);\n }\n\n #[test]\n fn test_b1() {\n assert_eq!(get_power_value(0, 1), 0);\n assert_eq!(get_power_value(0, 2), 0);\n assert_eq!(get_power_value(0, 3), 0);\n assert_eq!(get_power_value(1, 0), 1);\n assert_eq!(get_power_value(1, 1), 1);\n assert_eq!(get_power_value(1, 2), 1);\n assert_eq!(get_power_value(1, 3), 1);\n assert_eq!(get_power_value(2, 0), 1);\n assert_eq!(get_power_value(2, 1), 2);\n assert_eq!(get_power_value(2, 2), 4);\n assert_eq!(get_power_value(2, 3), 8);\n assert_eq!(get_power_value(3, 0), 1);\n assert_eq!(get_power_value(3, 1), 3);\n assert_eq!(get_power_value(3, 2), 9);\n assert_eq!(get_power_value(3, 3), 27);\n }\n\n #[test]\n fn test_c1() {\n assert_eq!(func_f1_mod(10, 2), 2);\n }\n #[test]\n fn test_c4() {\n assert_eq!(func_f1_mod(20190929, 1605), 363165664);\n }\n #[test]\n fn test_c5() {\n assert_eq!(func_f1_mod(947, 987654321987654321), 593574252);\n }\n}\n\nfn read_usize_u128_pair(stdin_lock: &mut std::io::StdinLock) -> (usize, u128) {\n let mut line1: String = String::new();\n stdin_lock.read_line(&mut line1).unwrap();\n let mut line1_values = line1.trim().split(\" \");\n let value1: usize = line1_values.next().unwrap().parse::().unwrap();\n let value2: u128 = line1_values.next().unwrap().parse::().unwrap();\n return (value1, value2);\n}\n\nfn main() {\n let stdin: std::io::Stdin = std::io::stdin();\n let mut stdin_lock: std::io::StdinLock = stdin.lock();\n\n let (x, n): (usize, u128) = read_usize_u128_pair(&mut stdin_lock);\n\n let func_value: u128 = func_f1_mod(x, n);\n\n println!(\"{}\", func_value);\n}\n", "lang": "Rust", "bug_code_uid": "8e628fd28f0c0105b47eca4277b4f8bf", "src_uid": "04610fbaa746c083dda30e21fa6e1a0c", "apr_id": "aca96fe42f8a94d8b4d75fccf917d88b", "difficulty": 1700, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9909863507597219, "equal_cnt": 1, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "//spnauti-rust\nuse std::io::*;\nuse std::str::*;\nuse std::fmt::Debug;\n#[allow(unused_imports)] use std::cmp::Ordering::*;\n#[allow(unused_imports)] use std::collections::*;\n\n#[allow(unused_macros)]\nmacro_rules! a {\n ($c: tt, $x: expr, $y: expr) => {{\n let b = $y; let a = &mut $x;\n if b $c *a { *a = b; true } else { false }\n }};\n}\nstruct WordReader<'a> { it : SplitAsciiWhitespace<'a>, }\n#[allow(dead_code)]\nimpl<'a> WordReader<'a> {\n fn new(b: &mut String, mut r: T) -> WordReader {\n b.clear();\n r.read_to_string(b).ok();\n WordReader { it: b.split_ascii_whitespace() }\n }\n fn from_stdin(b: &mut String) -> WordReader {\n WordReader::new(b, stdin())\n }\n fn sl(&mut self) -> &str { self.it.next().unwrap() }\n fn bs(&mut self) -> &[u8] { self.sl().as_bytes() }\n fn s(&mut self) -> String { String::from(self.sl()) }\n fn i(&mut self) -> i32 { self.p() }\n fn u(&mut self) -> usize { self.p() }\n fn vi(&mut self, n: usize) -> Vec {\n self.vp::(n)\n }\n fn p(&mut self) -> T where T::Err: Debug {\n self.sl().parse::().unwrap()\n }\n fn vp(&mut self, n: usize) -> Vec where T::Err: Debug {\n (0..n).map(|_| self.p()).collect()\n }\n}\n\n#[allow(dead_code)]\nfn build_counting_hashmap(i: T) -> HashMap\n where T: Iterator {\n let mut m = HashMap::new();\n for k in i {\n let n = 1 + if let Some(&n) = m.get(&k) { n } else { 0 };\n m.insert(k, n);\n }\n m\n}\n\nfn main() {\n let mut bin = String::new();\n let mut input = WordReader::from_stdin(&mut bin);\n\n let r: f64 = input.p();\n let x: f64 = input.p();\n let y: f64 = input.p();\n let xx: f64 = input.p();\n let yy: f64 = input.p();\n println!(\"{}\", (((x - xx).powi(2) + (y - yy).powi(2)).sqrt() / (2. * r) - 1e-6).ceil());\n}\n\n", "lang": "Rust", "bug_code_uid": "e0b209dea23bbd35d10474f50720f4ad", "src_uid": "698da80c7d24252b57cca4e4f0ca7031", "apr_id": "83dd6d378ab762f9679fba07894e99e7", "difficulty": 1400, "tags": ["geometry", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9193074158771644, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より\nmacro_rules! input {\n (source = $s:expr, $($r:tt)*) => {\n let mut iter = $s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n ($($r:tt)*) => {\n let s = {\n use std::io::Read;\n let mut s = String::new();\n std::io::stdin().read_to_string(&mut s).unwrap();\n s\n };\n let mut iter = s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n}\n\nmacro_rules! input_inner {\n ($iter:expr) => {};\n ($iter:expr, ) => {};\n ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {\n let $var = read_value!($iter, $t);\n input_inner!{$iter $($r)*}\n };\n}\n\nmacro_rules! read_value {\n ($iter:expr, ( $($t:tt),* )) => {\n ( $(read_value!($iter, $t)),* )\n };\n ($iter:expr, [ $t:tt ; $len:expr ]) => {\n (0..$len).map(|_| read_value!($iter, $t)).collect::>()\n };\n ($iter:expr, chars) => {\n read_value!($iter, String).chars().collect::>()\n };\n ($iter:expr, bytes) => {\n read_value!($iter, String).bytes().collect::>()\n };\n ($iter:expr, usize1) => {\n read_value!($iter, usize) - 1\n };\n ($iter:expr, $t:ty) => {\n $iter.next().unwrap().parse::<$t>().expect(\"Parse error\")\n };\n}\n\n//\n\nfn run() {\n input! {\n n: u64,\n }\n let ans = n.next_power_of_two().trailing_zeros();\n println!(\"{}\", ans);\n}\n\nfn main() {\n run();\n}\n", "lang": "Rust", "bug_code_uid": "5ad25199a6b4de6dc65fc271cf39bed1", "src_uid": "3d3432b4f7c6a3b901161fa24b415b14", "apr_id": "b89c3f45dc857ad2dda5a87370af05a7", "difficulty": 1600, "tags": ["dp", "combinatorics", "dfs and similar", "math", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9891696750902527, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より\nmacro_rules! input {\n (source = $s:expr, $($r:tt)*) => {\n let mut iter = $s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n ($($r:tt)*) => {\n let s = {\n use std::io::Read;\n let mut s = String::new();\n std::io::stdin().read_to_string(&mut s).unwrap();\n s\n };\n let mut iter = s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n}\n\nmacro_rules! input_inner {\n ($iter:expr) => {};\n ($iter:expr, ) => {};\n ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {\n let $var = read_value!($iter, $t);\n input_inner!{$iter $($r)*}\n };\n}\n\nmacro_rules! read_value {\n ($iter:expr, ( $($t:tt),* )) => {\n ( $(read_value!($iter, $t)),* )\n };\n ($iter:expr, [ $t:tt ; $len:expr ]) => {\n (0..$len).map(|_| read_value!($iter, $t)).collect::>()\n };\n ($iter:expr, chars) => {\n read_value!($iter, String).chars().collect::>()\n };\n ($iter:expr, bytes) => {\n read_value!($iter, String).bytes().collect::>()\n };\n ($iter:expr, usize1) => {\n read_value!($iter, usize) - 1\n };\n ($iter:expr, $t:ty) => {\n $iter.next().unwrap().parse::<$t>().expect(\"Parse error\")\n };\n}\n\n//\n\nfn run() {\n input! {\n n: usize,\n a: [usize; n],\n }\n let mut a = a;\n a.sort();\n let mut ans = \"NO\";\n for i in 2..n {\n let s = a[i - 2];\n if a[(i - 2)..=i] == [s, s + 1, s + 2] {\n ans = \"YES\";\n }\n }\n println!(\"{}\", ans);\n}\n\nfn main() {\n run();\n}\n", "lang": "Rust", "bug_code_uid": "9601c59bfdc9f521526e5534ff0b7229", "src_uid": "d6c876a84c7b92141710be5d76536eab", "apr_id": "cce7f89c20c57110c188cc6f0c84a71e", "difficulty": 900, "tags": ["brute force", "sortings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9937106918238994, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より\nmacro_rules! input {\n (source = $s:expr, $($r:tt)*) => {\n let mut iter = $s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n ($($r:tt)*) => {\n let s = {\n use std::io::Read;\n let mut s = String::new();\n std::io::stdin().read_to_string(&mut s).unwrap();\n s\n };\n let mut iter = s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n}\n\nmacro_rules! input_inner {\n ($iter:expr) => {};\n ($iter:expr, ) => {};\n ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {\n let $var = read_value!($iter, $t);\n input_inner!{$iter $($r)*}\n };\n}\n\nmacro_rules! read_value {\n ($iter:expr, ( $($t:tt),* )) => {\n ( $(read_value!($iter, $t)),* )\n };\n ($iter:expr, [ $t:tt ; $len:expr ]) => {\n (0..$len).map(|_| read_value!($iter, $t)).collect::>()\n };\n ($iter:expr, chars) => {\n read_value!($iter, String).chars().collect::>()\n };\n ($iter:expr, bytes) => {\n read_value!($iter, String).bytes().collect::>()\n };\n ($iter:expr, usize1) => {\n read_value!($iter, usize) - 1\n };\n ($iter:expr, $t:ty) => {\n $iter.next().unwrap().parse::<$t>().expect(\"Parse error\")\n };\n}\n\n//\n\nfn run() {\n input! {\n n: usize,\n a: [usize; n],\n }\n let mut a = a;\n a.sort();\n a.dedup();\n let mut ans = \"NO\";\n for i in 2..n {\n let s = a[i - 2];\n if a[(i - 2)..=i] == [s, s + 1, s + 2] {\n ans = \"YES\";\n }\n }\n println!(\"{}\", ans);\n}\n\nfn main() {\n run();\n}\n", "lang": "Rust", "bug_code_uid": "f89b9bad1696e3afe9b86954657f0d8d", "src_uid": "d6c876a84c7b92141710be5d76536eab", "apr_id": "cce7f89c20c57110c188cc6f0c84a71e", "difficulty": 900, "tags": ["brute force", "sortings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9882179675994109, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io;\n\nfn read_line() -> String {\n let mut input_line = String::new();\n io::stdin().read_line(&mut input_line).unwrap();\n return String::from(input_line.trim());\n}\n\nfn read_line_vec() -> Vec {\n return read_line().split(' ')\n .map(|s| s.parse().unwrap())\n .collect();\n}\n\n\nfn main() {\n let n: i32 = read_line().parse().unwrap();\n let mut vs = read_line_vec();\n\n vs.sort();\n\n for i in 2..vs.len() {\n let pprev = vs[i-2];\n let prev = vs[i-1];\n let me = vs[i];\n\n if me == prev + 1 && pprev + 1 == prev {\n println!(\"YES\");\n return;\n }\n }\n\n println!(\"NO\");\n \n}", "lang": "Rust", "bug_code_uid": "5c97c1e019d8742206f84f54aef646b6", "src_uid": "d6c876a84c7b92141710be5d76536eab", "apr_id": "b8877db835148b6a052f565b5d08c733", "difficulty": 900, "tags": ["brute force", "sortings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.7764866712235133, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "use std::io;\n\nfn run(s: String){\n let mut arr: [usize;10] = [0;10];\n\n for c in s.chars(){\n let mut x=(c.to_string()).parse::().unwrap();\n if x%2==0 && x!=2{\n arr[2]+=x/2;\n x-=1;\n }\n arr[x]+=1;\n }\n for i in (2..10).rev(){\n for _j in 0..arr[i]{\n print!(\"{}\",i);\n }\n }\n}\nfn main()\n{\n let mut s1=String::new();\n let mut s2=String::new();\n io::stdin().read_line(&mut s1).expect(\"read error\");\n io::stdin().read_line(&mut s2).expect(\"read error\");\n\n run(s2.trim().to_string());\n}", "lang": "Rust", "bug_code_uid": "86a8f587842036c0f7aee322e9d8c3cf", "src_uid": "60dbfc7a65702ae8bd4a587db1e06398", "apr_id": "9560b18ab3cba78f0347ba969fc18538", "difficulty": 1400, "tags": ["greedy", "math", "sortings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9246785058175138, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "use std::io;\n\n\nfn run(s: String){\n let mut arr: [usize;10] = [0;10];\n\n for c in s.chars(){\n let mut x=(c.to_string()).parse::().unwrap();\n if x==4 || x==8 || x==6{\n if x==4{\n arr[2]+=2;\n }\n else if x==8{\n arr[2]+=3;\n }\n else{\n arr[3]+=1;\n }\n x-=1;\n }\n arr[x]+=1;\n }\n for i in (2..10).rev(){\n for _j in 0..arr[i]{\n print!(\"{}\",i);\n }\n }\n}\nfn main()\n{\n let mut s1=String::new();\n let mut s2=String::new();\n io::stdin().read_line(&mut s1).expect(\"read error\");\n io::stdin().read_line(&mut s2).expect(\"read error\");\n\n run(s2.trim().to_string());\n}", "lang": "Rust", "bug_code_uid": "eb12180bcbc63c89d3c7b6bccf93637d", "src_uid": "60dbfc7a65702ae8bd4a587db1e06398", "apr_id": "9560b18ab3cba78f0347ba969fc18538", "difficulty": 1400, "tags": ["greedy", "math", "sortings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9987357774968394, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fn main() {\n let mut s = String::new();\n std::io::stdin().read_line(&mut s).unwrap();\n let _n : usize = s.trim().parse().unwrap();\n s = String::new();\n std::io::stdin().read_line(&mut s).unwrap();\n let mut v = [0,0,0,0];\n let d = [7,5,3,2];\n let mut x = s.trim().chars().map(|a| a.to_digit(10).unwrap()).peekable(); \n while x.peek().is_some() {\n match x.next().unwrap() {\n 9 => { v[0]+=1; v[2]+=2; v[3]+=3},\n 8 => { v[0]+=1; v[3]+=3; },\n 7 => { v[0]+=1;},\n 6 => { v[1]+=1; v[2]+=1;},\n 5 => { v[1]+=1; },\n 4 => { v[2]+=1; v[3]+=2; },\n 3 => { v[2]+=1; },\n 2 => { v[3]+=1; }\n _ => {}\n }\n\n }\n for i in 0..4 {\n for j in 0..v[i] {\n print!(\"{}\", d[i]);\n }\n }\n}\n", "lang": "Rust", "bug_code_uid": "94100861b6a136189e5df4bc678aa383", "src_uid": "60dbfc7a65702ae8bd4a587db1e06398", "apr_id": "534ba49aed73e31874c0e4de4b5a9872", "difficulty": 1400, "tags": ["greedy", "math", "sortings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9993815708101422, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "use std::io::stdin;\n\nfn main() {\n stdin().read_line(&mut String::new());\n\n let mut a = String::new();\n stdin().read_line(&mut a).unwrap();\n let a = a.trim();\n\n let mut a: Vec = a\n .chars()\n .filter(|x| x != &'0' && x != &'1')\n .collect();\n\n let mut c = String::new();\n\n for i in a {\n if i == '4' {\n c.push_str(\"223\");\n } else if i == '6' {\n c.push_str(\"53\");\n } else if i == '8' {\n c.push_str(\"72222\");\n } else if i == '9' {\n c.push_str(\"2337\");\n } else {\n c.push(i);\n }\n }\n\n let mut c: Vec = c.chars().map(|x| x.to_digit(10 as u32).unwrap()).collect();\n\n c.sort();\n c.reverse();\n\n for i in c {\n print!(\"{}\", i);\n }\n println!();\n}\n", "lang": "Rust", "bug_code_uid": "b8546496a65be30267f2b4c87bf7605b", "src_uid": "60dbfc7a65702ae8bd4a587db1e06398", "apr_id": "27acde817c5aec235e64404e06b35057", "difficulty": 1400, "tags": ["greedy", "math", "sortings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Rust"} {"similarity_score": 0.989247311827957, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io;\n\nfn main() {\n let mut buffer = String::new();\n\n io::stdin().read_line(&mut buffer)\n .expect(\"Failed to read from stdin\");\n\n match buffer.trim().parse::() {\n Ok(i) if(i % 2 == 0) => println!(\"YES\"),\n Ok(i) => println!(\"NO\"),\n _ => println!(\"Invalid integer\"),\n }\n}\n", "lang": "Rust", "bug_code_uid": "cea31b39747ef9e5932e86ccfae1b0af", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "b15417f1ee3326fcdf12ad72da138866", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.8028169014084507, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "#![allow(unused)]\n\nuse std::io::prelude::*;\nuse std::ops::Div;\nuse std::{env, io};\n\nfn main() {\n let arg: u8 = io::BufReader::new(io::stdin())\n .lines()\n .next()\n .unwrap()\n .unwrap()\n .parse()\n .unwrap();\n if arg.div(2).trailing_zeros() == 0 {\n println!(\"NO\");\n } else {\n println!(\"YES\");\n }\n}\n", "lang": "Rust", "bug_code_uid": "d1e73dcf649eb67fa4327ac755b00f71", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "9a41e05761c07fc9f1438de4f34708a7", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.8347529812606473, "equal_cnt": 16, "replace_cnt": 3, "delete_cnt": 10, "insert_cnt": 3, "fix_ops_cnt": 16, "bug_source_code": "use std::io;\n\nfn main() {\n let mut weight = String::new();\n io::stdin()\n .read_line(&mut weight)\n .except(\"Failed\");\n let weight: u32 = weight.trim().parse().except(\"No Number\");\n if (weight % 2 ==0){\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}", "lang": "Rust", "bug_code_uid": "2ffa72e6774492ec8e115d2bc2c0d70b", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "fbe69d9570cabc8504e25d840cd40d1e", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Rust"} {"similarity_score": 0.9982608695652174, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "use std::io;\nfn main() {\n let mut weight = String::new();\n io::stdin().read_line(&mut weight).expect(\"Failure\");\n let weight : u32 = weight.trim().parse().expect(\"No Number\");\n if (weight%2==0 && weight>=2) {\n println!(\"YES\")\n } else{\n println!(\"NO\")\n }\n}\n", "lang": "Rust", "bug_code_uid": "53f99f521190681245bf0da8b073f768", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "fbe69d9570cabc8504e25d840cd40d1e", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Rust"} {"similarity_score": 0.8708487084870848, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "use std::io::{Read, stdin};\n\nfn main() {\n let mut s = String::new();\n stdin().read_line(&mut s).unwrap();\n let n : u32 = s.trim().parse();\n if n % 2 == 0 {\n println!(\"YES\");\n }\n else {\n println!(\"NO\");\n }\n}", "lang": "Rust", "bug_code_uid": "0a5135db59adab2c594415a2e5a02755", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "7c1b3780c569987f4d2d8287cf603a02", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9074410163339383, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io::{Read, stdin};\n\nfn main() {\n let mut s = String::new();\n stdin().read_line(&mut s).unwrap();\n let n : u32 = s.trim().parse().unwrap();\n if n % 2 == 0 {\n println!(\"YES\");\n }\n else {\n println!(\"NO\");\n }\n}", "lang": "Rust", "bug_code_uid": "a28befea1276227371847f771d19f38e", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "7c1b3780c569987f4d2d8287cf603a02", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.42424242424242425, "equal_cnt": 13, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 7, "fix_ops_cnt": 13, "bug_source_code": "fn main() {\n\n use scan::Scan;\n let mut scanner = scan::from_stdin();\n let n = scanner.next::();\n if (n % 2 == 0){\n println!(\"YES\");\n }\n else {\n println!(\"NO\");\n }\n}", "lang": "Rust", "bug_code_uid": "01b19a809e931441742ef37a9c84798f", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "b05ce59d7d7fe7ef1dc39fec8413c9fb", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.8805460750853242, "equal_cnt": 13, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 9, "fix_ops_cnt": 13, "bug_source_code": "use std::io;\n\nfn main() {\n\n let mut input = String::new();\n io::stdin().read_line(&mut input).unwrap();\n let n: i32 = input.trim().parse().unwrap();\n\n if n % 2 == 0 && n >= 2 {\n println!(\"YES\");\n }\n else {\n println!(\"NO\");\n }\n}", "lang": "Rust", "bug_code_uid": "a195a96275d91504e65c83dd05687f52", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "b05ce59d7d7fe7ef1dc39fec8413c9fb", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9137614678899083, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io;\n\nfn main() {\n let mut input = String::new();\n io::stdin().read_line(&mut input).unwrap();\n let n = input.trim().parse::().unwrap();\n if n % 2 == 0 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}\n", "lang": "Rust", "bug_code_uid": "4820c48d31169877a90550cb8358e46e", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "ba4409efb7fd5577e7aa9fe069c59683", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.8597122302158273, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "use std::io;\n\nfn main() {\n\tlet mut inp = String::new();\n\tio::stdin().read_line(&mut inp).expect(\"error while reading input\");\n\tlet mut inp: i32 = inp.trim().parse().unwrap();\n\tif (inp - 2) % 2 == 0 {\n\t\tprintln!(\"YES\");\n\t} else {\n\t\tprintln!(\"NO\");\n\t}\n}\n", "lang": "Rust", "bug_code_uid": "d2d588a0e475ada7477ce135a8d29d46", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "3dcaf538a5c4d6ef82bc68f981fdb8cd", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9644128113879004, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io::{ stdin };\n\nfn main() {\n let mut input_string = String::new();\n stdin().read_line(&mut input_string).expect(\"\");\n let input_number: i32 = input_string.trim().parse().unwrap(); \n println!(\"{}\", if (input_number % 2) == 0 {\"YES\"} else {\"NO\"});\n}", "lang": "Rust", "bug_code_uid": "afc8bb416ea13dfbb2e3fd70b5e2d231", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "cdc9e8b8123f80969bb00d96463b0e50", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9216867469879518, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io;\n\nfn main() {\n let mut input = String::new();\n\n io::stdin().read_line(&mut input).unwrap();\n let num: i8 = input.trim().parse().unwrap();\n watermelon(num);\n}\n\nfn watermelon(weight: i8) {\n if weight % 2 == 0 {\n println!(\"YES\"); \n } else {\n println!(\"NO\");\n }\n}", "lang": "Rust", "bug_code_uid": "ced54d383e64f31175446326f0b804f7", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "c255f0844816a9d1fda175875a7d0f59", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9936507936507937, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fn readln() -> String {\n let stdin = std::io::stdin();\n let mut line = String::new();\n stdin.read_line(&mut line).unwrap();\n return String::from(line.trim());\n}\n\nfn main() {\n let weight: i32 = readln().parse().unwrap();\n println!(\"{}\", if weight > 0 && weight % 4 == 0 { \"YES\" } else { \"NO\" });\n}\n", "lang": "Rust", "bug_code_uid": "025ed3bd088ff9730c0e5c784ad47518", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "27dabe8c67c5ec12fec9085b457283c6", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9104477611940298, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "use std::io;\n\nfn main() {\n let mut stdin = io::stdin();\n let mut stdin = stdin.lock();\n \n let mut line = String::new();\n stdin::read_line(&mut line);\n \n let parsed: usize = line.parse().unwrap();\n \n if parsed & 1 == 1 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}", "lang": "Rust", "bug_code_uid": "b2af8bcd57a984c7fd5480ba97c9966a", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "590a6e200f04a339d9391c843dff5bf7", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9470672389127325, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "use std::io;\nuse std::io::BufRead;\n \nfn main() {\n let mut stdin = io::stdin();\n let mut stdin = stdin.lock();\n\n let mut line = String::new();\n stdin.read_line(&mut line);\n \n let parsed: usize = line.parse().unwrap();\n \n if parsed & 1 == 1 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}", "lang": "Rust", "bug_code_uid": "2cd7adaeeb0dd3a0c940b03c5ad44aea", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "590a6e200f04a339d9391c843dff5bf7", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Rust"} {"similarity_score": 0.9783549783549783, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io;\nuse std::io::BufRead;\n \nfn main() {\n let mut stdin = io::stdin();\n let mut stdin = stdin.lock();\n\n let mut line = String::new();\n stdin.read_line(&mut line);\n\n let parsed: usize = line.trim().parse().unwrap();\n \n if parsed & 1 == 0 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}", "lang": "Rust", "bug_code_uid": "c881f2417ce2ede61b24cf76a5234da2", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "590a6e200f04a339d9391c843dff5bf7", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9825783972125436, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io::{self, Read, Write};\n\nfn main() {\n let mut stdin = io::stdin();\n let mut stdout = io::stdout();\n\n let mut weight_string = String::new();\n stdin.read_to_string(&mut weight_string).unwrap();\n\n let weight = weight_string.trim_end().parse::().unwrap();\n\n if weight % 2 == 0 {\n stdout.write_all(b\"YES\\n\").unwrap();\n }\n else {\n stdout.write_all(b\"NO\\n\").unwrap();\n }\n}\n", "lang": "Rust", "bug_code_uid": "0653f2db88d46e697a1424a3c0afb837", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "c316d3f02ac5accd9cc787357c75199d", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9202037351443124, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io;\n\nfn main() {\n let stdin = io::stdin();\n let mut s = String::with_capacity(10);\n let _ = stdin.read_line(&mut s);\n\n let n = s.trim().parse::().unwrap();\n\n if n % 2 == 0 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}", "lang": "Rust", "bug_code_uid": "1914b9bb19b39c069f819e1585b422a1", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "065f2f588e5a73fd5344bb5701a78ae6", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9791666666666666, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io;\n\nfn main() {\n let mut w = String::new();\n io::stdin().read_line(&mut w).unwrap();\n let w: u8 = w.trim().parse().unwrap();\n\n if w % 2 == 0 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}\n", "lang": "Rust", "bug_code_uid": "7efee164af36357cf3030205cec28bcd", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "be58980f88c5081511d77b030e340676", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9983416252072969, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "use std::io;\nfn main() {\n let mut input = String::new();\n\n io::stdin().read_line(&mut input).expect(\"Invalid input\");\n\n let input: u32 = input.trim().parse().expect(\"Not an integer\");\n\n if input % 2 == 0 && input >= 2 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}\n", "lang": "Rust", "bug_code_uid": "3580ff20a78d0d085dce014952ae6e1b", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "cbeff706f11215659136779de1642318", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Rust"} {"similarity_score": 0.2816593886462882, "equal_cnt": 18, "replace_cnt": 11, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 18, "bug_source_code": "use std::io;\nfn main() {\n\n\tlet mut guess = String::new();\n\n\tio::stdin()\n\t\t.read_line(&mut guess)\n\n\t\t.expect(\"failed to read line\");\n\t\t// Convert the string input into int32\n\t//let guess: i32 = guess.trim().parse().expect(\"invalid input\");\n\t//let guess =guess.trim().parse::().expect(\"invalid input\");\n\t\tif let Ok(guess) = guess.trim().parse::(){\n\n\n\t\tif (guess % 2) == 0 {\n\t\t\tprintln!(\"YES\");\n\t\t\n\t\t}\n\t\telse{\n\n\tprintln!(\"NO\" );}\n}}\n", "lang": "Rust", "bug_code_uid": "fbd6b1e15ee6f10cdd412c1a824a9579", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "3d05c98793ff3f069db4360af94b5cf5", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9491525423728814, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "use std::io;\n\nfn main() {\n let mut n = String::new();\n io::stdin()\n .read_line(&mut n)\n .expect(\"Ошибка при чтении строки\");\n let n: u32 = match n.trim().parse() {\n Ok(num) => num,\n Err(_) => return\n };\n match n & 1 == 0 {\n true => println!(\"YES\"),\n false => println!(\"NO\")\n }\n}\n", "lang": "Rust", "bug_code_uid": "69a0ab7a566b4d602ce95e01b45d401c", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "7ff18c65166a27306c6ba7f5375adbf0", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.997134670487106, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "use std::io;\n\nfn main() {\n let mut n = String::new();\n io::stdin()\n .read_line(&mut n)\n .expect(\"Ошибка при чтении строки\");\n let n: u32 = match n.trim().parse() {\n Ok(num) => num,\n Err(_) => return\n };\n match n & 2 == 0 && n != 2 {\n true => println!(\"YES\"),\n false => println!(\"NO\")\n }\n}\n", "lang": "Rust", "bug_code_uid": "9f7e326c279a06967d32dd2709ca96d5", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "7ff18c65166a27306c6ba7f5375adbf0", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9986130374479889, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fn main() {\nlet mut melon = String::new();\nstd::io::stdin().read_line(&mut melon)\n .expect(\"Failed to read line\");\n\nlet _melon = melon\n .trim()\n .parse::().unwrap();\nif melon % 2 == 0 {\n if melon != 2 {\n println!(\"YES\");\n }\n else {\n println!(\"NO\");\n }\n}\nelse {\n println!(\"NO\");\n}\n}\n", "lang": "Rust", "bug_code_uid": "ecaba8e6179b959c747d76b377ec636d", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "70630a2c3aa6bb912dc8849f3ff65440", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Rust"} {"similarity_score": 0.9781818181818182, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io;\n\nfn main() {\n let mut val = String::new();\n io::stdin().read_line(&mut val).unwrap();\n\n let val: u32 = val.trim().parse().unwrap();\n\n let output = if val % 2 == 0 {\n \"YES\" \n } else {\n \"NO\"\n };\n\n println!(\"{}\", output);\n}\n", "lang": "Rust", "bug_code_uid": "236b2cb885eb66e0329aa63b4daf10bf", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "81b071f892d60ab22370af9363ed8f8a", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9653767820773931, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io;\nfn main() {\n let mut N = String::new();\n io::stdin().read_line(&mut N).ok();\n let N: i32 = N.trim().parse();\n if N % 2 == 0 && N > 2{\n println !(\"YES\");\n }else{\n println!(\"NO\");\n }\n}", "lang": "Rust", "bug_code_uid": "8e8f3ca46abb4fbcb1b4da6c09674fde", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "437dc2f795ce9d841706fd3ee85289d6", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9098901098901099, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "use std::io;\n\nfn main() {\nlet mut w = String::new();\n\nio::stdin().read_line(&mut w).expect(\"Error\");\n\nlet w: i32 = w.trim().parse().unwrap();\n\nif w%2 == 0 {\n\tprintln!(\"YES\");\n\t}\nelse {\n\tprintln!(\"NO\");\n\t}\n\n}", "lang": "Rust", "bug_code_uid": "195859164251bed5fa9504b6cb89e6d3", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "83961a19131d9d04193a0136f9ffdf40", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9758620689655172, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io;\n\nfn main() {\n let mut weight_string = String::new();\n io::stdin().read_line(&mut weight_string).unwrap();\n let weight = weight_string.trim().parse::().unwrap();\n\n if weight % 2 == 0 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}", "lang": "Rust", "bug_code_uid": "d04bf0eb4db42301adf8bb5c8b89e58b", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "f497353b3b3e3c0e569c5c9b6459f1b5", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.996415770609319, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "use std::io;\n\n\nfn main() {\n let mut input = String::new();\n io::stdin().read_line(&mut input).unwrap();\n let num: i32 = input.trim().parse().unwrap();\n let mut ans: bool = false;\n \n for i in 0..num {\n if i % 2 == 0 && (num - i) % 2 == 0 && (num - i) > 0{\n ans = true;\n }\n }\n if ans == true {\n println!(\"YES\")\n \n } else {\n println!(\"NO\")\n }\n}\n", "lang": "Rust", "bug_code_uid": "d48397a540ccab80ae8fbef468c2c9f6", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "a11ea9e5d73e16d1a5e79d9f73bb3f2c", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9355191256830601, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "extern crate utils;\nuse std::io;\nuse utils::*;\n\npub fn read_line() -> String {\n let mut input = String::new();\n io::stdin()\n .read_line(&mut input)\n .expect(\"error: unable to read user input\");\n input[0..input.len() - 1].to_string()\n}\n\nfn main() {\n let input = read_line().parse::().unwrap();\n if input <= 2 {\n println!(\"NO\");\n } else if input % 2 == 0 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}\n", "lang": "Rust", "bug_code_uid": "b0c3b6b01db64602da969c96533b015c", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "2e35de4077f6ae2a154716e3db366429", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9647058823529412, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "use std::io;\n\nfn main() {\n let mut input = String::default();\n io::stdin().read_line(&mut input).unwrap();\n let val = input.parse::().unwrap();\n if val % 2 == 0 {\n print!(\"YES\");\n } else {\n print!(\"NO\");\n }\n}\n", "lang": "Rust", "bug_code_uid": "754750474117ba3772621be45d8c6358", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "0f8e8e25646565ee35531d375d259402", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9787234042553191, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io;\n\nfn main() {\n let mut input = String::default();\n io::stdin().read_line(&mut input).unwrap();\n let val = input.trim().parse::().unwrap();\n if val % 2 == 0 {\n print!(\"YES\");\n } else {\n print!(\"NO\");\n }\n}\n", "lang": "Rust", "bug_code_uid": "bed4f70346d381b920ce68526c5233d6", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "0f8e8e25646565ee35531d375d259402", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9933862433862434, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io::{BufWriter, stdin, stdout, Write};\n\n#[derive(Default)]\nstruct Scanner {\n buffer: Vec\n}\nimpl Scanner {\n fn next(&mut self) -> T {\n loop {\n if let Some(token) = self.buffer.pop() {\n return token.parse().ok().expect(\"Failed parse\");\n }\n let mut input = String::new();\n stdin().read_line(&mut input).expect(\"Failed read\");\n self.buffer = input.split_whitespace().rev().map(String::from).collect();\n }\n }\n}\n\nfn main() {\n let mut scan = Scanner::default();\n let out = &mut BufWriter::new(stdout());\n\n let n = scan.next::();\n\n writeln!(out, \"{}\", if n % 2 == 0 { \"YES\" } else { \"NO\" } ).expect(\"fail\");\n}\n", "lang": "Rust", "bug_code_uid": "f45e1b0f90f3d54c410dfc383d1892e1", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "9045cac84502a101bc4134f018761e12", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9655172413793104, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "use std::io::{self, prelude::*};\nuse std::str;\n\n#[allow(unused_must_use)]\nfn run(mut reader: Scanner, mut writer: W) {\n let weight: i64 = reader.token();\n if weight & 1 != 0 {\n writeln!(writer, \"NO\");\n return;\n }\n\n if weight >> 1 & 1 == 0 {\n writeln!(writer, \"YES\");\n } else {\n writeln!(writer, \"NO\");\n }\n}\n\nfn main() {\n let stdin = io::stdin();\n let stdout = io::stdout();\n\n let reader = Scanner::new(stdin.lock());\n let writer = io::BufWriter::new(stdout.lock());\n run(reader, writer);\n}\n\npub struct Scanner {\n reader: B,\n buffer_string: Vec,\n buffer_iterator: str::SplitWhitespace<'static>,\n}\n\nimpl Scanner {\n pub fn new(reader: B) -> Self {\n return Self {\n reader,\n buffer_string: Vec::new(),\n buffer_iterator: \"\".split_whitespace()\n };\n }\n\n pub fn token(&mut self) -> T {\n loop {\n //if buffer already exists, just use existing buffer\n if let Some(token) = self.buffer_iterator.next() {\n return token.parse().ok().expect(\"Fail to parse token\");\n }\n\n //get new line\n self.buffer_string.clear();\n self.reader.read_until(b'\\n', &mut self.buffer_string).expect(\"Failed to read\");\n\n //split by white space\n self.buffer_iterator = unsafe {\n let slice = str::from_utf8_unchecked(&self.buffer_string);\n std::mem::transmute(slice.split_whitespace())\n };\n }\n }\n}", "lang": "Rust", "bug_code_uid": "99782593962a06b744820ffeec84b6ed", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "22534788203d5eb18b9ff85b212b8ed7", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9172932330827067, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io::stdin;\n\nfn main() {\n let mut input = String::new();\n stdin().read_line(&mut input).unwrap();\n\n let n: u8 = input.trim().parse().unwrap();\n\n if n >= 1 && n <= 100 {\n if n % 2 == 0 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n }\n}\n", "lang": "Rust", "bug_code_uid": "936137b8e913509b5651504ce98369b2", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "42df955350dc46c16992ebb4ccc304f7", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9942492012779552, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "//! http://codeforces.com/problemset/problem/4/A\n\n#[macro_export]\nmacro_rules! scanln {\n ($($var:ident : $ty:path),+) => {\n $(let $var: $ty;)+\n {\n use std::io;\n let mut __buf = String::new();\n io::stdin().read_line(&mut __buf).unwrap();\n let mut eles = __buf.split_whitespace();\n $($var = Scan::scan(&mut eles);)+\n }\n }\n}\n\npub trait Scan {\n fn scan<'a, I>(eles: &mut I) -> Self where I: Iterator;\n}\n\nmacro_rules! impl_scan_single {\n ($ty:ty) => {\n impl Scan for $ty {\n fn scan<'a, I>(eles: &mut I) -> Self where I: Iterator {\n let next = eles.next().unwrap();\n match next.parse() {\n Ok(res) => res,\n Err(_) => panic!()\n }\n }\n }\n }\n}\n\nimpl_scan_single!(u8);\nimpl_scan_single!(u16);\nimpl_scan_single!(u32);\nimpl_scan_single!(u64);\nimpl_scan_single!(usize);\nimpl_scan_single!(i8);\nimpl_scan_single!(i16);\nimpl_scan_single!(i32);\nimpl_scan_single!(i64);\nimpl_scan_single!(isize);\nimpl_scan_single!(f32);\nimpl_scan_single!(f64);\nimpl_scan_single!(String);\n\nconst __IMPL_SCAN_FOR_VEC: () = {\n use std::str::FromStr;\n impl Scan for Vec where T: FromStr {\n fn scan<'a, I>(eles: &mut I) -> Self where I: Iterator {\n eles.map(|str| match str.parse() {\n Ok(res) => res,\n Err(_) => panic!()\n }).collect()\n }\n }\n};\n\n// -----------------------------------------------------------------------------\n\nfn main() {\n scanln!(n: u32);\n println!(\"{}\", if n % 2 == 0 && (n / 2) % 2 == 0 { \"YES\" } else { \"NO\" });\n}\n", "lang": "Rust", "bug_code_uid": "3f8c86e0dae0957dfc907592f458211c", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "4f8cb4b45235ca67d3fb8f60228565e6", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9976448422044277, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#[allow(unused_imports)]\nuse std::cmp::*;\n#[allow(unused_imports)]\nuse std::collections::*;\nuse std::io::{Write, BufWriter};\n// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8\nmacro_rules! input {\n ($($r:tt)*) => {\n let stdin = std::io::stdin();\n let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));\n let mut next = move || -> String{\n bytes\n .by_ref()\n .map(|r|r.unwrap() as char)\n .skip_while(|c|c.is_whitespace())\n .take_while(|c|!c.is_whitespace())\n .collect()\n };\n input_inner!{next, $($r)*}\n };\n}\n \nmacro_rules! input_inner {\n ($next:expr) => {};\n ($next:expr, ) => {};\n \n ($next:expr, $var:ident : $t:tt $($r:tt)*) => {\n let $var = read_value!($next, $t);\n input_inner!{$next $($r)*}\n };\n}\n\nmacro_rules! read_value {\n ($next:expr, ( $($t:tt),* )) => {\n ( $(read_value!($next, $t)),* )\n };\n \n ($next:expr, [ $t:tt ; $len:expr ]) => {\n (0..$len).map(|_| read_value!($next, $t)).collect::>()\n };\n \n ($next:expr, chars) => {\n read_value!($next, String).chars().collect::>()\n };\n \n ($next:expr, usize1) => {\n read_value!($next, usize) - 1\n };\n \n ($next:expr, [ $t:tt ]) => {{\n let len = read_value!($next, usize);\n (0..len).map(|_| read_value!($next, $t)).collect::>()\n }};\n \n ($next:expr, $t:ty) => {\n $next().parse::<$t>().expect(\"Parse error\")\n };\n}\n\nfn solve() {\n let out = std::io::stdout();\n let mut out = BufWriter::new(out.lock());\n macro_rules! puts {\n ($($format:tt)*) => (let _ = write!(out,$($format)*););\n }\n input! {\n n: i64\n }\n \n if n % 2 == 0 {\n puts!(\"{}\\n\", \"YES\");\n } else {\n puts!(\"{}\\n\", \"NO\");\n }\n}\n\nfn main() {\n // In order to avoid potential stack overflow, spawn a new thread.\n let stack_size = 104_857_600; // 100 MB\n let thd = std::thread::Builder::new().stack_size(stack_size);\n thd.spawn(|| solve()).unwrap().join().unwrap();\n}", "lang": "Rust", "bug_code_uid": "cbf335296499a661238e687c2bcbad8a", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "fc749142d43d4d079c1a3a52c7549878", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.814299900695134, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "use std::io;\n\nfn main() {\n let mut weight = String::new();\n io::stdin()\n .read_line(&mut weight)\n .expect(\"Failed to read line\");\n let weight: u32 = weight.trim().parse().expect(\"Please type a number\");\n let limit: u32 = weight / 2;\n let mut x = 2;\n while x <= limit {\n let newweight = weight - x;\n if newweight % 2 == 0 {\n println!(\"YES\");\n break;\n }\n x = x + 2;\n }\n}", "lang": "Rust", "bug_code_uid": "76a153c6aa2dea00bf19047563c7475b", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "7a031c0f09bed7e0c0f04d1506739a3d", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.5413533834586466, "equal_cnt": 8, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "use std::io::{self, Write};\n\nfn main() {\n\tlet mut input = String::new();\n io::stdin().read_line(&mut input).unwrap();\n\n if input.parse::().unwrap() % 2 == 0 {\n \tio::stdout().write_all(b\"YES\").unwrap();\n } else {\n \tio::stdout().write_all(b\"NO\").unwrap();\n }\n}", "lang": "Rust", "bug_code_uid": "ce6d98c90ea252d330c8e065b7d87be6", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "6d474ce68008951f195e8034664d2034", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.984251968503937, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "use std::io::{self, Write};\n\nfn main() {\n let mut s = String::new();\n\tio::stdin().read_line(&mut s).unwrap();\n\n\tlet n = s.trim().parse::().unwrap();\n\n if n & 2 == 0 && n != 2 {\n \tprintln!(\"YES\");\n }\n } else {\n \tprintln!(\"NO\");\n }\n}", "lang": "Rust", "bug_code_uid": "240579310b09e38676342cd4d6bc2e0d", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "6d474ce68008951f195e8034664d2034", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9960159362549801, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "use std::io::{self, Write};\n\nfn main() {\n let mut s = String::new();\n\tio::stdin().read_line(&mut s).unwrap();\n\n\tlet n = s.trim().parse::().unwrap();\n\n if n & 2 == 0 && n != 2 {\n \tprintln!(\"YES\");\n } else {\n \tprintln!(\"NO\");\n }\n}", "lang": "Rust", "bug_code_uid": "120bfbeed480fb95487bb2a9876c3a9b", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "6d474ce68008951f195e8034664d2034", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9990714948932219, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io::prelude::*;\nuse std::io::BufReader;\n#[allow(unused_imports)]\nuse std::fs::File;\n\nstruct Scanner {\n\tlines: std::io::Lines>\n}\nimpl Scanner {\n\tfn new(source: T) -> Scanner {\n\t\tScanner {\n\t\t\tlines: BufReader::new(source).lines()\n\t\t}\n\t}\t\n\tfn read_line(&mut self) -> String { self.lines.next().unwrap().unwrap() }\n}\nfn main() {\n\tlet mut input = Scanner::new(std::io::stdin());\n\tlet n: usize = input.read_line().parse().unwrap();\n\tprintln!(\"{}\", if n > 4 && n % 2 == 0 { \"YES\" } else { \"NO\" });\n}", "lang": "Rust", "bug_code_uid": "749d89de08ccca741aa2cf4801213e2b", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "07f6b0633994ffa9efd1ef316398b53d", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.8975609756097561, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "use std::io;\n\nfn main() {\n\n let mut weight = String::new();\n\n io::stdin().read_line(&mut weight).expect(\"Error\");\n\n let trimmed = weight.trim();\n match trimmed.parse::() {\n Ok(i) => if i%2 == 0 {\n println!(\"YES\");\n } else {\n println!(\"NO\")\n }\n Err(..) => println!(\"this was not an integer: {}\", trimmed),\n }\n\n}", "lang": "Rust", "bug_code_uid": "0cdb3ac9948d7e1d9d4f2a157644361f", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "6a06a1a5f2365059d34c10b894d456fb", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.3686746987951807, "equal_cnt": 11, "replace_cnt": 4, "delete_cnt": 5, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "use std::io;\n\nfn solve(val: u32) -> bool {\n val % 4 == 0\n}\n\nfn main() {\n let stdin = io::stdin();\n let mut line = String::new();\n let _ = stdin.read_line(&mut line);\n let line = line.trim();\n match line.parse::() {\n Ok(val) => {\n if solve(val) {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n },\n Err(_) => ()\n }\n}\n", "lang": "Rust", "bug_code_uid": "3a952d61df6af729299582b8ea90015d", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "b9319830b6a9951d8c3b7eda807edfd6", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Rust"} {"similarity_score": 0.9932065217391305, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#![allow(unused_imports)]\nuse std::io::{BufWriter, stdin, stdout, Write};\n\n#[derive(Default)]\nstruct Scanner {\n buffer: Vec,\n}\nimpl Scanner {\n fn next(&mut self) -> T {\n loop {\n if let Some(token) = self.buffer.pop() {\n return token.parse().ok().expect(\"Failed parse\");\n }\n let mut input = String::new();\n stdin().read_line(&mut input).expect(\"Failed read\");\n self.buffer = input.split_whitespace().rev().map(String::from).collect();\n }\n }\n}\n\nfn main() {\n let mut scan = Scanner::default();\n let out = &mut BufWriter::new(stdout());\n let n = scan.next::();\n if n % 2 == 0 {\n writeln!(out, \"YES\").ok();\n } else {\n writeln!(out, \"NO\").ok();\n }\n}", "lang": "Rust", "bug_code_uid": "e81101e3472cf17950867111dc641562", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "38e8dc0153582a6f01b24b6518ab8962", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9922178988326849, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io::stdin;\n\nfn main() {\n let line = String::new();\n stdin().read_line(&mut line).unwrap();\n let n: u8 = line.trim().parse().unwrap();\n \n if n > 3 && n % 2 == 0 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}", "lang": "Rust", "bug_code_uid": "0649acdefbb6647e049a0ca329b6ee37", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "9e8f55af82e88b903d59588fa069a7b5", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9796610169491525, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "use std::io;\nfn main() {\n let mut line = String::new();\n io::stdin().read_line(&mut line).expect(\"??\");\n\n let weight = line.trim().parse::().expect(\"Error parse int\");\n\n if weight != 2 && weight % 2 == 0 {\n println!(\"TRUE\");\n } else {\n println!(\"FALSE\");\n }\n}\n", "lang": "Rust", "bug_code_uid": "c78415990c0b944ed545892b98c7f534", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "ae45a33e194ff3ff1009cc2a33d61d2b", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9870875179340028, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io;\n\nfn main() {\n let mut input = String::new();\n\n io::stdin()\n .read_line(&mut input)\n .expect(\"failed to read line\");\n\n let n: i32 = match input.trim().parse() {\n Ok(value) => value,\n Err(_) => -1,\n };\n\n if n % 2 == 0 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}\n", "lang": "Rust", "bug_code_uid": "0f7f9c0bfb831eeb33bfc3daa18d8127", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "03eb7ccc22d59c4d45e806367e2b71f2", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.986737400530504, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "use std::io::{self, Write};\n\nfn main() {\n let mut line = String::new();\n\n io::stdin().read_line(&mut line).expect(\"Failed to read!\");\n\n let x: u32 = line.trim().parse().expect(\"Not integer!\");\n\n let possible = x % 2 == 0;\n\n if possible {\n print!(\"YES\");\n } else {\n print!(\"NO\");\n }\n io::stdout().flush().expect(\"Failed to flush!\");\n}\n", "lang": "Rust", "bug_code_uid": "4183ed40d0685194dded39298a096b5b", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "647503307acead0a50f1d21675349dd8", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.5616291532690246, "equal_cnt": 11, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 10, "bug_source_code": "/*! https://codeforces.com/problemset/problem/4/A\n注意在IDEA上发送EOF的快捷键是cmd+d\n*/\nuse std::io::BufRead;\n\nfn main() {\n let mut input: Vec = Vec::with_capacity(1);\n for line in std::io::stdin().lock().lines() {\n if let Ok(str) = line {\n input.push(str);\n break;\n }\n }\n // parse first line of stdin\n let num = input[0].parse::().unwrap();\n if num % 2 == 0 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}\n", "lang": "Rust", "bug_code_uid": "e470ae05c86d095f716ec08a004ee94f", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "63c895db87cc122c5050d80081a1138d", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.8557457212713936, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "/*! https://codeforces.com/problemset/problem/4/A\n注意在IDEA上发送EOF的快捷键是cmd+d\n\n本题问的是一个数能否被分成两个偶数之和,显然只要大于2的偶数都复合条件\n*/\nuse std::io::Read;\n\nfn main() {\n let mut input;\n std::io::stdin().lock().read_to_string(&mut input);\n let num = input[0].parse::().unwrap();\n if num > 2 && num % 2 == 0 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}\n", "lang": "Rust", "bug_code_uid": "56c2bd9784a2980c2fa340e933cb6329", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "63c895db87cc122c5050d80081a1138d", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.992108229988726, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "/*! https://codeforces.com/problemset/problem/4/A\n注意在IDEA上发送EOF的快捷键是cmd+d\n\n本题问的是一个数能否被分成两个偶数之和,显然只要大于2的偶数都复合条件\n*/\nuse std::io::Read;\n\nfn main() {\n let mut input = String::with_capacity(3);\n std::io::stdin().lock().read_to_string(&mut input).unwrap();\n // the range of num is [0, 100]\n let num = input.parse::().unwrap();\n if num > 2 && num % 2 == 0 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}\n", "lang": "Rust", "bug_code_uid": "3f5927ec7067045fe9fc235dc5c315c2", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "63c895db87cc122c5050d80081a1138d", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.48728094968908986, "equal_cnt": 16, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 7, "fix_ops_cnt": 15, "bug_source_code": "/*! https://codeforces.com/problemset/problem/4/A\n注意在IDEA上发送EOF的快捷键是cmd+d,本题的测试用例1是 8+回车+EOF\n\n本题问的是一个数能否被分成两个偶数之和,显然只要不等于2的所有偶数都符合条件\n*/\nuse std::io::Read;\n\nconst ASCII_0: u8 = b'0';\n\nfn main() {\n // max input len testcase is \"100\\n\"([49,48,48,10])\n let mut input = [0u8; 4];\n let input_size = std::io::stdin().lock().read(&mut input).unwrap();\n // The first (and the only) input line contains integer number w (1≤w≤100)\n let mut num = 0u8;\n for i in 0..input_size-1 {\n let digit = input[i] - ASCII_0;\n num = num * 10 + digit;\n }\n dbg!(num, input_size);\n println!(\"input: {:?}, num: {}, input_size: {}\", input, num, input_size);\n if num % 2 == 0 && num != 2 {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}\n", "lang": "Rust", "bug_code_uid": "b0d4cc633bac932681802cb113904cee", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "63c895db87cc122c5050d80081a1138d", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9409090909090909, "equal_cnt": 8, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 7, "fix_ops_cnt": 7, "bug_source_code": "use std::io;\n\nfn main() {\n let mut input = String::new();\n io::stdin().read_line(&mut input);\n\n let num: i32 = input.parse().unwrap();\n\n if num % 2 == 0 {println!(\"YES\")} else {println!(\"NO\")};\n}", "lang": "Rust", "bug_code_uid": "fa4bda36829a88d69edc4c07e1909090", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "606694eef59b63d7ac63625f62329a5e", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9574944071588367, "equal_cnt": 7, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 6, "bug_source_code": "use std::io;\n\nfn main() {\n let mut input = String::new();\n io::stdin().read_line(&mut input);\n\n let num: i32 = input.trim().parse().unwrap();\n\n if num % 2 == 0 {println!(\"YES\")} else {println!(\"NO\")};\n}", "lang": "Rust", "bug_code_uid": "7271409481171a82a8f529f69584de3c", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "606694eef59b63d7ac63625f62329a5e", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.3382869494731154, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "#[macro_use]\nextern crate text_io;\n\nmacro_rules! lets {\n\t($($id:ident $(:$T:ty)*),+ =.. $ex:expr) => { $( let $id $(:$T)* = $ex; )* };\n\t($($id:ident $(:$T:ty)*),+ = $ex:expr) => { let _tmp_expr = $ex; $( let $id $(:$T)* = _tmp_expr; )* };\n ($($id:ident $(:$T:ty)*),+ = $($ex:expr),+) => { $( let $id $(:$T)* = $ex; )* };\n\n (mut $($id:ident $(:$T:ty)*),+ =.. $ex:expr) => { $( let mut $id $(:$T)* = $ex; )* };\n (mut $($id:ident $(:$T:ty)*),+ = $($ex:expr),+) => { $( let mut $id $(:$T)* = $ex; )* }; \n}\n\nfn main() {\n let w: u8 = read!();\n if w > 3 && w % 2 == 0 {\n \tprintln!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}\n", "lang": "Rust", "bug_code_uid": "f73d2953202d36efdfc4126e74d50c59", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "8371378d4acffb4d671e55abb0c280b3", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9928400954653938, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "macro_rules! read {\n\t() => { read!(\"\") };\n\t($msg:expr) => {{\n\t\tuse std::io::Write;\n\t\tprint!(\"{}\", $msg);\n\t\tstd::io::stdout().flush().unwrap();\n\t\tstd::str::FromStr::from_str(&read_word()).unwrap()\n\t}};\n}\n\npub fn read_word() -> String {\n\tuse std::io::prelude::*;\n\tlet mut word: Vec = vec![];\n\n\tfor c in ::std::io::stdin().bytes() {\n\t\tlet c = c.unwrap();\n\t\tif (c as char).is_whitespace() {\n\t\t\tif !word.is_empty() {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t} else {\n\t\t\tword.push(c);\n\t\t}\n\t}\n\t::std::str::from_utf8(&word).unwrap().to_string()\n}\n\nfn main() {\n\tlet w: i8 = read!();\n\tif w % 2 == 0 {\n\t\tprintln!(\"YES\");\n\t} else {\n\t\tprintln!(\"NO\");\n\t}\n}\n", "lang": "Rust", "bug_code_uid": "85e09a79203446a8ff6b0f612b56ee47", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "8371378d4acffb4d671e55abb0c280b3", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9859719438877755, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fn main(){\n let mut line=String::new();\n std::io::stdin().read_line(&mut line).unwrap();\n let control=['h','e','l','l','o'];\n let mut line:Vec=line\n .trim()\n .chars()\n .filter(|c|match c{\n 'h'=>true,\n 'e'=>true,\n 'l'=>true,\n 'o'=>true,\n _=>false,\n })\n .collect();\n let len=line.len();\n let mut stop:usize=0;\n 'control:for c in 0..5{\n for l in stop..len{\n if control[c]==line[l]{\n stop=l+1;\n continue'control\n }\n if c<5 && l==len-1{print!(\"NO\");return}\n }\n }\n print!(\"YES\")\n}", "lang": "Rust", "bug_code_uid": "1e25dc4e6c4531155001950734344969", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "apr_id": "51561b3920cbfcaae44ff4886a5d5b61", "difficulty": 1000, "tags": ["strings", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9826887661141804, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "use std::io::{BufReader, BufWriter, Read, Write, stdin, stdout};\n\npub struct Scanner {\n pub buffer: Vec,\n pub reader: U,\n}\nimpl Scanner {\n pub fn next(&mut self) -> T {\n loop {\n if let Some(token) = self.buffer.pop() {\n return token.parse().ok().expect(\"Failed parse\");\n }\n let mut input = String::new();\n self.reader.read_to_string(&mut input).expect(\"Failed read\");\n self.buffer = input.lines().rev().map(String::from).collect();\n }\n }\n\n pub fn new(reader: U) -> Self {\n return Scanner {\n buffer: vec![],\n reader,\n };\n }\n}\npub fn solution_of_p58a(input: &mut Read, out: &mut Write) {\n let mut scanner = Scanner::new(input);\n let line1 = scanner.next::();\n if contains_hello(line1) {\n write!(out, \"YES\").ok();\n } else {\n write!(out, \"NO\").ok();\n }\n}\n\nfn contains_hello(s: String) -> bool {\n let word = \"hello\";\n if s == word {\n return false;\n }\n let mut ss = &s[0..];\n for c in word.chars() {\n if let Some(cur_pos) = ss.find(c) {\n ss = &ss[cur_pos+1..];\n } else {\n return false;\n }\n }\n return true;\n}\n\nfn main() {\n solution_of_p58a(&mut stdin(), &mut stdout());\n}\n", "lang": "Rust", "bug_code_uid": "01752eebef330cfbc71e7599c4dd45ec", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "apr_id": "16f4d26c20937659d9630c60a8279604", "difficulty": 1000, "tags": ["strings", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Rust"} {"similarity_score": 0.9975333004440059, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#![allow(non_snake_case, unused_imports, deprecated, dead_code)]\n\n// Input macros\nmacro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }\nmacro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} }; ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => { let mut $var = read_value!($next, $t); input_inner!{$next $($r)*} }; }\nmacro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::>() }; ($next:expr, [ $t:tt ]) => { { let len = read_value!($next, usize); (0..len).map(|_| read_value!($next, $t)).collect::>() } }; ($next:expr, chars) => { read_value!($next, String).chars().collect::>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect(\"Parse error\") }; }\n\n// Module\nuse std::cmp::{min,max};\nuse std::collections::{VecDeque,HashMap,HashSet,BTreeMap,BTreeSet,BinaryHeap};\n// Module for v1.15.1\nuse std::ascii::AsciiExt; // deprecated since 1.26.0: use inherent method instead\n\n// Functions\n\n// Main\nfn main() {\n\n input! {\n S: String,\n }\n\n let hello = vec!['h','e','l','l','o'];\n\n let mut i = 0;\n for c in S.chars() {\n if c==hello[i] {\n i += 1;\n }\n if i==5 {\n break;\n }\n }\n\n println!(\"{}\", if i==5{\"YES\"else{\"NO\"}});\n}", "lang": "Rust", "bug_code_uid": "731e24248aa0339231a0ba1f4e625740", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "apr_id": "1250f14480ac23220307324a419fc62d", "difficulty": 1000, "tags": ["strings", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.8215641609719059, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "// Author: Xu Zhao (i@xuzhao.net)\n// Date: Nov 23, 2016\n\n//! Codeforces Problem 58A\nuse std::io::{self, BufRead};\n\nconst word:[char; 5] = ['h', 'e', 'l', 'l', 'o'];\n\nfn check(line: String, i: usize, j: usize) -> bool {\n if i == line.len() {\n return false;\n } else if j == word.len() {\n return true;\n }\n if line.chars().nth(i).unwrap() == word[j] {\n return check(line, i + 1, j + 1);\n } else {\n return check(line, i + 1, j);\n }\n}\n\n\nfn main() {\n let stdin = io::stdin();\n for line in stdin.lock().lines() {\n let s = line.unwrap();\n if check(s, 0, 0) {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n return;\n }\n}\n\n", "lang": "Rust", "bug_code_uid": "30151ddd7bd2d4fce79293c846f23f5a", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "apr_id": "e95c82352744c1db2ec9aadbe09cfc8d", "difficulty": 1000, "tags": ["strings", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Rust"} {"similarity_score": 0.7536231884057971, "equal_cnt": 10, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "use std::io;\n\nfn main() -> io::Result<()> {\n let mut s = String::new();\n let stdin = io::stdin();\n\n let _ = stdin.read_line(&mut s)?;\n s = s.trim().to_string();\n\n let word = \"hello\";\n if calc(word, &s) {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n\n Ok(())\n}\n\nfn calc(sub: &str, s: &str) -> bool {\n calc2(sub.as_bytes(), s.as_bytes())\n}\n\nfn calc2<'a, T>(sub: T, s: T) -> bool\nwhere\n T: IntoIterator,\n T::IntoIter: Clone\n{\n let mut sub_iter = sub.into_iter();\n let mut s_iter = s.into_iter();\n\n while let Some(c) = sub_iter.next() {\n if let Some(c2) = s_iter.next() {\n if c == c2 {\n if calc2(sub_iter.clone(), s_iter.clone()) {\n return true;\n } else {\n continue;\n }\n }\n }\n return false\n }\n\n true\n}", "lang": "Rust", "bug_code_uid": "8febdf60118d3b1802df929132b48ac8", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "apr_id": "616c0064dfd3b95d3b8ddb0a9d48a367", "difficulty": 1000, "tags": ["strings", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9984289080911233, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "macro_rules! parse_line {\n ($t: ty) => ({\n let mut a_str = String::new();\n std::io::stdin().read_line(&mut a_str).expect(\"read error\");\n let a_str = a_str.trim();\n a_str.parse::<$t>().expect(\"parse error\")\n });\n ($($t: ty),+) => ({\n let mut a_str = String::new();\n std::io::stdin().read_line(&mut a_str).expect(\"read error\");\n let mut a_iter = a_str.split_whitespace();\n (\n $(\n a_iter.next().unwrap().parse::<$t>().expect(\"parse error\"),\n )+\n )\n })\n}\n\n#[allow(unused_macros)]\nmacro_rules! parse_line_to_vec {\n ($t: ty) => {{\n let mut a_str = String::new();\n std::io::stdin().read_line(&mut a_str).expect(\"read error\");\n (a_str\n .split_whitespace()\n .map(|x| x.parse::<$t>().unwrap())\n .collect::>())\n }};\n}\n\nuse std::io::Write;\n\nfn solve(writer: &mut std::io::BufWriter) {\n let n = parse_line!(usize);\n let ok = n == 1;\n writeln!(writer, \"{}\", if ok {\"Ehab\"} else {\"Mahmoud\"}).unwrap();\n}\n\nfn main() {\n let mut writer = std::io::BufWriter::new(std::io::stdout());\n let tests = 1; // parse_line!(usize);\n for _ in 0..tests {\n solve(&mut writer);\n }\n}\n", "lang": "Rust", "bug_code_uid": "ce344ae95b45cbbf61c69d9a2e2a383b", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "apr_id": "34c68e66382a6a425ab90fa21ed7d832", "difficulty": 800, "tags": ["math", "games"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.7623421354764638, "equal_cnt": 12, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 11, "bug_source_code": "use std::io::{self, Read};\n\nfn main() {\n\tlet mut b = String::new();\n\tio::stdin().read_to_string(&mut b);\n\tlet mut inp = b.split_whitespace();\n\tlet x = inp.next().unwrap().parse::().unwrap() as f32;\n\tlet y = inp.next().unwrap().parse::().unwrap() as f32;\n\tlet z = inp.next().unwrap().parse::().unwrap() as f32;\n\tlet t = ((x+y+z)/3.0).round();\n\t\n print!(\"{}\", (x-t).abs()+(y-t).abs()+(z-t).abs());\n}\n", "lang": "Rust", "bug_code_uid": "e67d64c7f100231fdc4353a37394989d", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "apr_id": "529013e918f244232e01edb28c866847", "difficulty": 800, "tags": ["math", "sortings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.807909604519774, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "struct Scan {\n buffer: std::collections::VecDeque\n}\n\nimpl Scan {\n fn new() -> Scan {\n Scan { buffer: std::collections::VecDeque::new() }\n }\n\n fn next(&mut self)-> T {\n loop {\n if let Some(token) = self.buffer.pop_front() {\n break token.parse::().ok().unwrap();\n }\n let mut line = String::new();\n std::io::stdin().read_line(&mut line).expect(\"Fail to read\");\n self.buffer = line.split_whitespace().map(String::from).collect();\n }\n }\n\n}\n\nfn _main() {\n let mut scan = Scan::new();\n let a: isize = scan.next();\n let b: isize = scan.next();\n let c: isize = scan.next();\n if a==b {\n println!(\"{}\", (a-c).abs());\n } else if a==c || b==c {\n println!(\"{}\", (a-b).abs());\n } else {\n let middle: isize = (a + b + c) / 3;\n let result = (a-middle).abs() + (b-middle).abs() + (c-middle).abs();\n println!(\"{}\", result);\n }\n}\n\nfn main() {\n std::thread::Builder::new()\n .stack_size(1<<23).spawn(_main).unwrap().join().unwrap();\n}\n", "lang": "Rust", "bug_code_uid": "7e68cc5b57458c782b23031695865fac", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "apr_id": "2b1d80281c9e7afc84d84acbb537940a", "difficulty": 800, "tags": ["math", "sortings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.995253164556962, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "use std::io::Read;\n\nfn input(read_file: bool) -> String {\n if read_file {\n let mut file = std::fs::File::open(\"sample.txt\").unwrap();\n let mut buf = String::new();\n file.read_to_string(&mut buf).unwrap();\n buf\n } else {\n let mut buf = String::new();\n std::io::stdin().read_to_string(&mut buf).unwrap();\n buf.trim_end().to_owned()\n }\n}\n\nfn solve(ws: &mut std::str::SplitWhitespace) {\n let _: usize = ws.next().unwrap().parse().unwrap();\n let s: Vec = ws.next().unwrap().to_string().chars().collect();\n\n let mut m = std::collections::HashMap::new();\n m.insert(2, \"2\");\n m.insert(3, \"3\");\n m.insert(4, \"223\");\n m.insert(5, \"5\");\n m.insert(6, \"35\");\n m.insert(7, \"7\");\n m.insert(8, \"2227\");\n m.insert(9, \"9\");\n\n let mut ans: Vec = Vec::new();\n for c in s {\n let d = c as i32 - '0' as i32;\n let mut x: Vec = m.entry(d).or_default().chars().collect();\n ans.append(&mut x);\n }\n\n ans.sort();\n ans.reverse();\n let s: String = ans.iter().collect();\n println!(\"{}\", s);\n}\n\nfn main() {\n const READ_FROM_FILE: bool = true;\n\n let s = input(READ_FROM_FILE);\n let mut ws = s.split_whitespace();\n\n solve(&mut ws);\n}\n", "lang": "Rust", "bug_code_uid": "0909307e59d30995898ed63eb3775dfb", "src_uid": "60dbfc7a65702ae8bd4a587db1e06398", "apr_id": "869712bf717457c8939afbd39469bfb1", "difficulty": 1400, "tags": ["greedy", "math", "sortings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9980229339659945, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "use std::io::Read;\n\nfn input(read_file: bool) -> String {\n if read_file {\n let mut file = std::fs::File::open(\"sample.txt\").unwrap();\n let mut buf = String::new();\n file.read_to_string(&mut buf).unwrap();\n buf\n } else {\n let mut buf = String::new();\n std::io::stdin().read_to_string(&mut buf).unwrap();\n buf.trim_end().to_owned()\n }\n}\n\nfn solve(ws: &mut std::str::SplitWhitespace) {\n let _: usize = ws.next().unwrap().parse().unwrap();\n let s: Vec = ws.next().unwrap().to_string().chars().collect();\n\n let mut m = std::collections::HashMap::new();\n m.insert(2, \"2\");\n m.insert(3, \"3\");\n m.insert(4, \"223\");\n m.insert(5, \"5\");\n m.insert(6, \"35\");\n m.insert(7, \"7\");\n m.insert(8, \"2227\");\n m.insert(9, \"9\");\n\n let mut ans: Vec = Vec::new();\n for c in s {\n let d = c as i32 - '0' as i32;\n let mut x: Vec = m.entry(d).or_default().chars().collect();\n ans.append(&mut x);\n }\n\n ans.sort();\n ans.reverse();\n let s: String = ans.iter().collect();\n println!(\"{}\", s);\n}\n\nfn main() {\n const READ_FROM_FILE: bool = false;\n\n let s = input(READ_FROM_FILE);\n let mut ws = s.split_whitespace();\n\n solve(&mut ws);\n}\n", "lang": "Rust", "bug_code_uid": "8442d76c3da6cae293ffa5f2c8ade860", "src_uid": "60dbfc7a65702ae8bd4a587db1e06398", "apr_id": "869712bf717457c8939afbd39469bfb1", "difficulty": 1400, "tags": ["greedy", "math", "sortings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9996281145407214, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#![allow(unused_imports)]\n\nuse std::cmp::{max, min};\nuse std::collections::{HashMap, HashSet};\nuse std::io::{stdin, stdout, BufWriter, Write};\n\n#[derive(Default)]\nstruct Scanner {\n buffer: Vec,\n}\nimpl Scanner {\n fn next(&mut self) -> T {\n loop {\n if let Some(token) = self.buffer.pop() {\n return token.parse().ok().expect(\"Failed parse\");\n }\n let mut input = String::new();\n stdin().read_line(&mut input).expect(\"Failed read\");\n self.buffer = input.split_whitespace().rev().map(String::from).collect();\n }\n }\n}\n\nuse std::collections::*;\n\nfn solve () {\n let mut scan = Scanner::default();\n let n: usize = scan.next();\n let a: String = scan.next();\n let v = vec![\n \"\",\n \"\",\n \"2\",\n \"3\",\n \"223\",\n \"5\",\n \"35\",\n \"7\",\n \"222\",\n \"2337\",\n ];\n let mut res = String::new ();\n for x in a.chars() {\n res.push_str (v[x.to_digit(10).unwrap() as usize]);\n }\n let mut v: Vec = res.chars().collect();\n v.sort();\n v.reverse();\n for x in v {\n print! (\"{}\", x);\n }\n}\n\nfn main() {\n let mut scan = Scanner::default();\n // let t = scan.next::();\n let t = 1;\n for _ in 0..t {\n solve();\n }\n}\n", "lang": "Rust", "bug_code_uid": "69162afdcc3adface8d8a2cb7d31269d", "src_uid": "60dbfc7a65702ae8bd4a587db1e06398", "apr_id": "ca4b11c4831455ad42a609cb0761b7b1", "difficulty": 1400, "tags": ["greedy", "math", "sortings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9961977186311787, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fn main() {\n let mut text = String::new();\n std::io::stdin().read_line(&mut text).expect(\"\");\n let n = text.trim().parse::().expect(\"\");\n\n if n > 1 && n % 2 == 1 {\n println!(\"1 {}\", (n - 3) / 2)\n } else {\n println!(\"NO\")\n }\n}\n", "lang": "Rust", "bug_code_uid": "bea959ea9dc63b2a52902d39318a286c", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "apr_id": "1f8a92465625c94331dbea8191ea81a3", "difficulty": 1200, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9752906976744186, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "use std::io;\nuse std::str;\n\npub struct Scanner {\n reader: R,\n buffer: Vec,\n}\n\nimpl Scanner {\n pub fn new(reader: R) -> Self {\n Self {\n reader,\n buffer: vec![],\n }\n }\n\n pub fn token(&mut self) -> T {\n loop {\n if let Some(token) = self.buffer.pop() {\n return token.parse().ok().expect(\"Failed parse\");\n }\n let mut input = String::new();\n self.reader.read_line(&mut input).expect(\"Failed read\");\n self.buffer = input.split_whitespace().rev().map(String::from).collect();\n }\n }\n}\n\nfn find_xy(r: i64) -> Option<(i64, i64)> {\n let mut x = 1;\n while x * x <= r {\n if (r - x * x - x - 1) % (2 * x) == 0 {\n let y = (r - x * x - x - 1) / (2 * x);\n return Some((x, y));\n }\n x += 1;\n }\n None\n}\n\nfn solve(scan: &mut Scanner, out: &mut W) {\n let r: i64 = scan.token();\n match find_xy(r) {\n Some((x, y)) => writeln!(out, \"{} {}\", x, y).ok(),\n None => writeln!(out, \"NO\").ok(),\n };\n}\n\nfn main() {\n let (stdin, stdout) = (io::stdin(), io::stdout());\n let mut scan = Scanner::new(stdin.lock());\n let mut out = io::BufWriter::new(stdout.lock());\n solve(&mut scan, &mut out);\n}\n", "lang": "Rust", "bug_code_uid": "5f6114381896867d489a22d0b9adb34a", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "apr_id": "281dd0072fa3f9e68a856b7dc66aaa9d", "difficulty": 1200, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.8439522998296423, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "#![allow(unused_imports)]\nuse std::io::{self, BufRead};\nuse std::cmp::*;\nuse std::collections::*;\n\nmacro_rules! scan_to_vec {\n ($count:expr, $t:ty) => ({\n let mut result = Vec::new();\n let stdin = io::stdin();\n let mut handle = stdin.lock();\n\n for _ in 0..$count {\n let mut buffer = String::new();\n handle.read_line(&mut buffer)\n .expect(\"scan_to_vec: failed at `handle.read_line`.\");\n result.push(buffer.trim().parse::<$t>()\n .expect(\"scan_to_vec: failed at `parse::<$t>`.\"));\n }\n result\n })\n}\n\nmacro_rules! scan_line_to_vec {\n ($t:ty) => ({\n let mut result = Vec::new();\n let stdin = io::stdin();\n let mut handle = stdin.lock();\n let mut buffer = String::new();\n handle.read_line(&mut buffer)\n .expect(\"scan_line_to_vec: failed at `handle.read_line`.\");\n \n for s in buffer.split_whitespace() {\n result.push(s.parse::<$t>()\n .expect(\"scan_line_to_vec: failed at `parse::<$t>`.\"));\n }\n result\n })\n}\n\nmacro_rules! scan_line {\n () => ({\n let stdin = io::stdin();\n let mut handle = stdin.lock();\n let mut buffer = String::new();\n handle.read_line(&mut buffer)\n .expect(\"scan_line: failed at `handle.read_line`.\");\n buffer\n });\n ( $($t:ty)+ ) => ({\n let stdin = io::stdin();\n let mut handle = stdin.lock();\n let mut buffer = String::new();\n handle.read_line(&mut buffer)\n .expect(\"scan_line: failed at `handle.read_line`.\");\n let mut chunks = buffer.split_whitespace();\n\n ($(\n {\n chunks.next()\n .expect(\"scan_line: failed at `next`, # of space separated strings not equal to requested #\")\n .parse::<$t>()\n .expect(\"scan_line: failed at `parse::<$t>`.\")\n },\n )+)\n })\n}\n\ntrait Ext {\n fn is_odd(&self) -> bool;\n fn is_even(&self) -> bool;\n}\n\nimpl Ext for i32 {\n #[inline]\n fn is_odd(&self) -> bool {\n self % 2 != 0\n }\n\n #[inline]\n fn is_even(&self) -> bool {\n self % 2 == 0\n }\n}\n\nfn main() {\n let (n,) = scan_line!(usize);\n let array = scan_line_to_vec!(i32);\n\n let mut result = true;\n\n let mut i = 0;\n let mut segment_count = 0;\n let mut count_evens = 0;\n\n while i < (n - 1) {\n if array[i].is_odd() && array[i+1].is_odd() {\n segment_count += 1;\n } else if array[i].is_odd() && array[i+1].is_even() {\n count_evens += 1;\n } else if array[i].is_even() && array[i+1].is_even() {\n count_evens += 1;\n } else if array[i].is_even() && array[i+1].is_odd() {\n if count_evens.is_odd() {\n count_evens = 0;\n segment_count += 1;\n i += 1;\n } else {\n result = false;\n break;\n }\n }\n i += 1;\n }\n\n if i == n - 1 && array[n - 1].is_odd() {\n segment_count += 1;\n } else if i == n - 1 {\n result = false;\n }\n\n if segment_count.is_even() {\n result = false;\n }\n\n if result {\n println!(\"YES\")\n } else {\n println!(\"NO\")\n }\n}", "lang": "Rust", "bug_code_uid": "b72e762a4f4136022ce15fb026f192a8", "src_uid": "2b8c2deb5d7e49e8e3ededabfd4427db", "apr_id": "6d3ff26bea01ae3f49121177ac34a941", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.7429107589658048, "equal_cnt": 11, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 10, "bug_source_code": "use std::io::{stdin, BufRead};\n\nfn get_max_delta(values: &Vec) -> Option<(T, usize, usize)>\nwhere\n T: Ord,\n T: Copy,\n T: std::ops::Sub,\n{\n if values.len() <= 1 {\n return None;\n }\n\n let mut min_positions: Vec = Vec::new();\n let mut max_positions: Vec = Vec::new();\n\n min_positions.push(0);\n max_positions.push(0);\n\n for i in 1..(values.len() - 1) {\n let value = values[i];\n let prev_value = values[i - 1];\n let next_value = values[i + 1];\n\n if (value >= prev_value) && (value >= next_value) {\n max_positions.push(i);\n }\n if (value <= prev_value) && (value <= next_value) {\n min_positions.push(i);\n }\n }\n\n min_positions.push(values.len() - 1);\n max_positions.push(values.len() - 1);\n\n let mut max_delta: Option<(T, usize, usize)> = None;\n let mut max_position_index: usize = 0;\n\n for i in 0..min_positions.len() {\n let min_position = min_positions[i];\n let min_position_value = values[min_position];\n while max_positions[max_position_index] <= min_positions[i] {\n max_position_index += 1;\n if max_position_index >= max_positions.len() {\n break;\n }\n }\n if max_position_index >= max_positions.len() {\n break;\n }\n for j in max_position_index..max_positions.len() {\n let max_position = max_positions[j];\n let max_position_value = values[max_position];\n let delta_value = max_position_value - min_position_value;\n if let Some((max_delta_value, _max_delta_start, _max_delta_end)) = max_delta {\n if delta_value > max_delta_value {\n max_delta = Some((delta_value, min_position, max_position));\n }\n } else {\n max_delta = Some((delta_value, min_position, max_position));\n }\n }\n }\n\n return max_delta;\n}\n\nfn get_best_score(values: &Vec) -> usize {\n let mut switch_scores: Vec = Vec::with_capacity(values.len());\n let mut current_switch_score: isize = 0;\n let mut base_score: usize = 0;\n for &value in values {\n if value == 0 {\n current_switch_score += 1;\n } else {\n current_switch_score -= 1;\n base_score += 1;\n }\n switch_scores.push(current_switch_score);\n }\n\n let (max_switch_score, _, _) = get_max_delta(&switch_scores).unwrap();\n\n return ((base_score as isize) + max_switch_score) as usize;\n}\n\n#[cfg(test)]\nmod tests {\n use super::{get_best_score, get_max_delta};\n\n #[test]\n fn test_get_best_score_1() {\n assert_eq!(get_best_score(&vec![1, 0, 0, 1, 0]), 4);\n }\n #[test]\n fn test_get_best_score_2() {\n assert_eq!(get_best_score(&vec![1, 0, 0, 1]), 4);\n }\n #[test]\n fn test_get_best_score_3() {\n assert_eq!(get_best_score(&vec![1, 0, 1, 0, 1, 0]), 4);\n }\n\n fn do_test_max_delta(values: &Vec) {\n if values.len() <= 1 {\n assert_eq!(get_max_delta(values), None);\n return;\n }\n\n let mut max_delta: i32 = 0;\n for i in 0..values.len() {\n for j in (i + 1)..values.len() {\n let delta: i32 = values[j] - values[i];\n if delta > max_delta {\n max_delta = delta;\n }\n }\n }\n\n let (result_max_delta, result_start, result_end) = get_max_delta(values).unwrap();\n assert_eq!(result_max_delta, max_delta);\n assert_eq!(values[result_end] - values[result_start], max_delta);\n }\n\n #[test]\n fn test_get_max_delta_1() {\n do_test_max_delta(&vec![1, 2, 7, 19, 20, 3, 0, -4, 4]);\n }\n #[test]\n fn test_get_max_delta_2() {\n do_test_max_delta(&vec![0, 0, 0, 3]);\n }\n #[test]\n fn test_get_max_delta_3() {\n do_test_max_delta(&vec![1]);\n }\n}\n\nfn main() {\n let stdin = stdin();\n let mut stdin_lock = stdin.lock();\n\n {\n let mut skip_buffer = String::new();\n stdin_lock.read_line(&mut skip_buffer).unwrap();\n }\n let mut string_buffer = String::new();\n stdin_lock.read_line(&mut string_buffer).unwrap();\n let values: Vec = string_buffer\n .trim()\n .split_whitespace()\n .map(|s| s.parse::().unwrap())\n .collect();\n\n let best_score: usize = get_best_score(&values);\n println!(\"{}\", best_score);\n}\n", "lang": "Rust", "bug_code_uid": "9b8ab5837b7799dc75309c64673db80b", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "apr_id": "6916977dfd0e4610c16e282cfec03f8b", "difficulty": 1200, "tags": ["dp", "brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9565305914690013, "equal_cnt": 16, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 10, "fix_ops_cnt": 15, "bug_source_code": "use std::io::{stdin, BufRead};\n\nfn get_max_delta(values: &Vec) -> Option<(T, usize, usize)>\nwhere\n T: Ord,\n T: Copy,\n T: std::ops::Sub,\n{\n if values.len() <= 1 {\n return None;\n }\n\n let mut min_positions: Vec = Vec::new();\n let mut max_positions: Vec = Vec::new();\n\n min_positions.push(0);\n max_positions.push(0);\n\n for i in 1..(values.len() - 1) {\n let value = values[i];\n let prev_value = values[i - 1];\n let next_value = values[i + 1];\n\n if (value >= prev_value) && (value >= next_value) {\n max_positions.push(i);\n }\n if (value <= prev_value) && (value <= next_value) {\n min_positions.push(i);\n }\n }\n\n min_positions.push(values.len() - 1);\n max_positions.push(values.len() - 1);\n\n let mut max_delta: Option<(T, usize, usize)> = None;\n let mut max_position_index: usize = 0;\n\n for i in 0..min_positions.len() {\n let min_position = min_positions[i];\n let min_position_value = values[min_position];\n while max_positions[max_position_index] <= min_positions[i] {\n max_position_index += 1;\n if max_position_index >= max_positions.len() {\n break;\n }\n }\n if max_position_index >= max_positions.len() {\n break;\n }\n for j in max_position_index..max_positions.len() {\n let max_position = max_positions[j];\n let max_position_value = values[max_position];\n let delta_value = max_position_value - min_position_value;\n if let Some((max_delta_value, _max_delta_start, _max_delta_end)) = max_delta {\n if delta_value > max_delta_value {\n max_delta = Some((delta_value, min_position, max_position));\n }\n } else {\n max_delta = Some((delta_value, min_position, max_position));\n }\n }\n }\n\n return max_delta;\n}\n\nfn get_best_score(values: &Vec) -> usize {\n let mut switch_scores: Vec = Vec::with_capacity(values.len() + 1);\n switch_scores.push(0);\n let mut current_switch_score: isize = 0;\n let mut base_score: usize = 0;\n for &value in values {\n if value == 0 {\n current_switch_score += 1;\n } else {\n current_switch_score -= 1;\n base_score += 1;\n }\n switch_scores.push(current_switch_score);\n }\n\n let (max_switch_score, _, _) = get_max_delta(&switch_scores).unwrap();\n\n return ((base_score as isize) + max_switch_score) as usize;\n}\n\n#[cfg(test)]\nmod tests {\n use super::{get_best_score, get_max_delta};\n\n #[test]\n fn test_get_best_score_1() {\n assert_eq!(get_best_score(&vec![1, 0, 0, 1, 0]), 4);\n }\n #[test]\n fn test_get_best_score_2() {\n assert_eq!(get_best_score(&vec![1, 0, 0, 1]), 4);\n }\n #[test]\n fn test_get_best_score_3() {\n assert_eq!(get_best_score(&vec![1, 0, 1, 0, 1, 0]), 4);\n }\n #[test]\n fn test_get_best_score_4() {\n assert_eq!(get_best_score(&vec![1]), 0);\n }\n #[test]\n fn test_get_best_score_5() {\n assert_eq!(get_best_score(&vec![0]), 1);\n }\n\n fn do_test_max_delta(values: &Vec) {\n if values.len() <= 1 {\n assert_eq!(get_max_delta(values), None);\n return;\n }\n\n let mut max_delta: i32 = 0;\n for i in 0..values.len() {\n for j in (i + 1)..values.len() {\n let delta: i32 = values[j] - values[i];\n if delta > max_delta {\n max_delta = delta;\n }\n }\n }\n\n let (result_max_delta, result_start, result_end) = get_max_delta(values).unwrap();\n assert_eq!(result_max_delta, max_delta);\n assert_eq!(values[result_end] - values[result_start], max_delta);\n }\n\n #[test]\n fn test_get_max_delta_1() {\n do_test_max_delta(&vec![1, 2, 7, 19, 20, 3, 0, -4, 4]);\n }\n #[test]\n fn test_get_max_delta_2() {\n do_test_max_delta(&vec![0, 0, 0, 3]);\n }\n #[test]\n fn test_get_max_delta_3() {\n do_test_max_delta(&vec![1]);\n }\n}\n\nfn main() {\n let stdin = stdin();\n let mut stdin_lock = stdin.lock();\n\n {\n let mut skip_buffer = String::new();\n stdin_lock.read_line(&mut skip_buffer).unwrap();\n }\n let mut string_buffer = String::new();\n stdin_lock.read_line(&mut string_buffer).unwrap();\n let values: Vec = string_buffer\n .trim()\n .split_whitespace()\n .map(|s| s.parse::().unwrap())\n .collect();\n\n let best_score: usize = get_best_score(&values);\n println!(\"{}\", best_score);\n}\n", "lang": "Rust", "bug_code_uid": "cfa75e0950c0bb7bf4807e25a9bbeb38", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "apr_id": "6916977dfd0e4610c16e282cfec03f8b", "difficulty": 1200, "tags": ["dp", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.998389694041868, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "// 2018-10-12 13:59\nfn main() {\n let _ = {\n let mut line = String::new();\n std::io::stdin().read_line(&mut line).unwrap();\n line.trim().to_string()\n };\n let v: Vec = {\n let mut line = String::new();\n std::io::stdin().read_line(&mut line).unwrap();\n line.trim()\n .split(\" \")\n .map(|s| s.parse::().unwrap())\n .collect()\n };\n\n let n = v.len();\n let orig = v.iter().filter(|&x| *x == 1).count() as i32;\n\n let mut dp = vec![vec![0; n + 1]; n + 1];\n let mut inc = 0;\n for i in 0..n {\n for j in i + 1..n + 1 {\n dp[i][j] = {\n if v[j - 1] == 0 {\n dp[i][j - 1] + 1\n } else {\n dp[i][j - 1]\n }\n };\n inc = std::cmp::max(inc, dp[i][j] * 2 - (j - i) as i32);\n }\n }\n println!(\"{:?}\", inc + orig);\n}\n", "lang": "Rust", "bug_code_uid": "b07bdf1359ff2b151b86cfadc42683b3", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "apr_id": "eef936d4b051cd9be86a4e72949f3e88", "difficulty": 1200, "tags": ["dp", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.40500201694231547, "equal_cnt": 20, "replace_cnt": 12, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 19, "bug_source_code": "fn main() {\n let mut s = String::new();\n std::io::stdin().read_line(&mut s).unwrap();\n let n : usize = s.trim().parse().unwrap();\n s = String::new();\n std::io::stdin().read_line(&mut s).unwrap();\n let ints:Vec = s.split_whitespace().map(|x| x.parse().unwrap()).collect();\n let mut onesum : Vec = vec![0];\n let mut onerevsum : Vec = vec![0];\n let mut sum = 0;\n let mut revsum = 0;\n let mut newints : Vec = vec![ints[0]];\n let mut newintscount : Vec = vec![0];\n let mut lastnum=ints[0];\n\n for i in 0..n {\n *onesum.last_mut().unwrap() = sum;\n *onerevsum.first_mut().unwrap() = revsum;\n sum+=ints[i];\n revsum+=ints[n-i-1];\n if ints[i] == lastnum {\n *(newintscount.last_mut().unwrap())+=if ints[i]==0 {1} else{0};\n } else {\n onesum.push(0);\n onerevsum.insert(0,0);\n newints.push(ints[i]);\n newintscount.push(if ints[i]==0 {1} else {0});\n }\n lastnum = ints[i];\n }\n *onesum.last_mut().unwrap() = sum;\n *onerevsum.first_mut().unwrap() = revsum;\n\n// println!(\"{:?}\",newints);\n// println!(\"{:?}\",newintscount);\n// println!(\"{:?}\",onesum);\n// println!(\"{:?}\",onerevsum);\n\n let mut max = 0;\n\n for i in 0..(newints.len()) {\n for j in i..(newints.len()) {\n if newints[i] == 0 && newints[j] == 0 {\n let subsum = &newintscount[i..=j].iter().fold(0, |acc, x| acc+x) + onesum[i] + onerevsum[j];\n// println!(\"slice={:?} sum={}\",&newints[i..=j],subsum); \n max = std::cmp::max(max, subsum);\n }\n }\n }\n println!(\"{}\",max);\n\n}\n \n\n\n", "lang": "Rust", "bug_code_uid": "24f04f047b6fc9dfe68ad774052de13f", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "apr_id": "f9eaa26160cda82923dc7b6949e9455f", "difficulty": 1200, "tags": ["dp", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.639186295503212, "equal_cnt": 7, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "macro_rules! input {\n (source = $s:expr, $($r:tt)*) => {\n let mut iter = $s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n ($($r:tt)*) => {\n let s = {\n use std::io::Read;\n let mut s = String::new();\n std::io::stdin().read_to_string(&mut s).unwrap();\n s\n };\n let mut iter = s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n}\n\nmacro_rules! input_inner {\n ($iter:expr) => {};\n ($iter:expr, ) => {};\n\n ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {\n let $var = read_value!($iter, $t);\n input_inner!{$iter $($r)*}\n };\n}\n\nmacro_rules! read_value {\n ($iter:expr, ( $($t:tt),* )) => {\n ( $(read_value!($iter, $t)),* )\n };\n\n ($iter:expr, [ $t:tt ; $len:expr ]) => {\n (0..$len).map(|_| read_value!($iter, $t)).collect::>()\n };\n\n ($iter:expr, chars) => {\n read_value!($iter, String).chars().collect::>()\n };\n\n ($iter:expr, usize1) => {\n read_value!($iter, usize) - 1\n };\n\n ($iter:expr, $t:ty) => {\n $iter.next().unwrap().parse::<$t>().expect(\"Parse error\")\n };\n}\n\nstruct State(u32, u32);\n\nfn main() {\n input! {\n n: usize,\n a: [u8; n],\n }\n\n let mut state = State(0, 0);\n let num_of_1 = a.iter().filter(|x| **x == 1).count();\n\n for x in a {\n state = if x == 1 {\n State(std::cmp::max(state.0, state.1), 0)\n } else {\n State(state.0, state.1 + 1)\n };\n }\n println!(\"{}\", num_of_1 as u32 + state.0);\n}\n", "lang": "Rust", "bug_code_uid": "1cd9be21e53476ec986edf1446d4a73e", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "apr_id": "8a25f70799a63637c8dc4354e607de40", "difficulty": 1200, "tags": ["dp", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9497326203208556, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "struct Scan {\n buffer: std::collections::VecDeque\n}\n\nimpl Scan {\n fn new() -> Scan {\n Scan { buffer: std::collections::VecDeque::new() }\n }\n\n fn next(&mut self)-> T {\n loop {\n if let Some(token) = self.buffer.pop_front() {\n break token.parse::().ok().unwrap();\n }\n let mut line = String::new();\n std::io::stdin().read_line(&mut line).expect(\"Fail to read\");\n self.buffer = line.split_whitespace().map(String::from).collect();\n }\n }\n\n fn next_n(&mut self, n: usize) -> Vec {\n (0..n).map(|_| self.next::()).collect()\n }\n\n}\n\nfn _main() {\n let mut scan = Scan::new();\n let n: usize = scan.next();\n let arr: Vec = scan.next_n(n);\n let total: isize = arr.iter().sum();\n // convert to an array in which Kadane can be used\n let arr2: Vec = arr.into_iter().map(|x| if x==1 { -1 } else { 1 }).collect();\n let mut cnt: isize = 0;\n let mut maxcnt: isize = 0;\n for i in 0..n {\n cnt += arr2[i];\n if cnt < 0 { cnt = 0; }\n maxcnt = maxcnt.max(cnt);\n }\n println!(\"{}\", total + maxcnt);\n}\n\nfn main() {\n std::thread::Builder::new()\n .stack_size(1<<23).spawn(_main).unwrap().join().unwrap();\n}\n", "lang": "Rust", "bug_code_uid": "8df4efe3f66f6f42fb1bfdb0ef767ca7", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "apr_id": "602eb98c905db339e9a25d92747d118e", "difficulty": 1200, "tags": ["dp", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.8842809364548495, "equal_cnt": 12, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "#![allow(unused_imports)]\n#![allow(unused_macros)]\nuse std::io::{StdinLock, stdin, BufRead};\nuse std::collections::*;\nuse std::cmp::*;\n\nfn scan_helper(lock : &mut StdinLock) -> String {\n let mut buffer = String::new();\n lock.read_line(&mut buffer).ok();\n buffer\n}\n\nmacro_rules! scan {\n ($lock:ident, $t:ty) => ({\n scan_helper(&mut $lock).split_whitespace()\n .next().unwrap()\n .parse::<$t>().unwrap()\n });\n ($lock:ident, $($t:ty),+) => ({\n let buffer = scan_helper(&mut $lock);\n let mut iter = buffer.split_whitespace();\n ($(\n {\n iter.next().unwrap()\n .parse::<$t>().unwrap()\n },\n )+)\n })\n}\n\nmacro_rules! scan_iter {\n ($lock:ident, $t:ty) => ({\n scan_helper(&mut $lock).split_whitespace()\n .map(|x| x.parse::<$t>().unwrap())\n .collect()\n })\n}\n\ntrait Ext {\n fn idx(&self) -> usize;\n fn num(&self) -> i64;\n}\n\nmacro_rules! ext {\n ($t:ty) => (\n impl Ext for $t {\n #[inline]\n fn idx(&self) -> usize {\n *self as usize\n }\n\n #[inline]\n fn num(&self) -> i64 {\n *self as i64\n }\n }\n )\n}\next!(i64);\next!(usize);\n\n\n#[derive(Copy, Clone, Debug)]\nstruct Pair {\n i : usize,\n cost : i64\n}\nimpl PartialOrd for Pair {\n fn partial_cmp(&self, other : &Pair) -> Option {\n Some(self.cost.cmp(&other.cost))\n }\n}\n\nimpl Ord for Pair {\n fn cmp(&self, other : &Pair) -> Ordering {\n self.partial_cmp(other).unwrap()\n }\n}\n\nimpl PartialEq for Pair {\n fn eq(&self, other : &Pair) -> bool {\n self.cost == other.cost\n }\n}\nimpl Eq for Pair {}\n\nfn main() {\n let stdin = stdin();\n let mut s = stdin.lock();\n let _ = scan!(s, usize);\n let mut data : Vec<_> = scan_iter!(s, i64);\n let mut i = 0;\n let mut j = data.len() - 1;\n\n while data[i] == 1 {\n i += 1;\n }\n while data[j] == 1 {\n j -= 1;\n }\n\n for k in i..(j+1) {\n data[k] = 1 - data[k];\n }\n let result = data.iter().fold(0, |c, x| c + x);\n \n\n println!(\"{}\", result);\n}", "lang": "Rust", "bug_code_uid": "2bf85426768c38d764c942bb30c5512f", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "apr_id": "b1aead9b5cafc3c98061c7044d9961fa", "difficulty": 1200, "tags": ["dp", "brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.8820921985815603, "equal_cnt": 15, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 14, "bug_source_code": "#![allow(unused_imports)]\n#![allow(unused_macros)]\nuse std::io::{StdinLock, stdin, BufRead};\nuse std::collections::*;\nuse std::cmp::*;\n\nfn scan_helper(lock : &mut StdinLock) -> String {\n let mut buffer = String::new();\n lock.read_line(&mut buffer).ok();\n buffer\n}\n\nmacro_rules! scan {\n ($lock:ident, $t:ty) => ({\n scan_helper(&mut $lock).split_whitespace()\n .next().unwrap()\n .parse::<$t>().unwrap()\n });\n ($lock:ident, $($t:ty),+) => ({\n let buffer = scan_helper(&mut $lock);\n let mut iter = buffer.split_whitespace();\n ($(\n {\n iter.next().unwrap()\n .parse::<$t>().unwrap()\n },\n )+)\n })\n}\n\nmacro_rules! scan_iter {\n ($lock:ident, $t:ty) => ({\n scan_helper(&mut $lock).split_whitespace()\n .map(|x| x.parse::<$t>().unwrap())\n .collect()\n })\n}\n\ntrait Ext {\n fn idx(&self) -> usize;\n fn num(&self) -> i64;\n}\n\nmacro_rules! ext {\n ($t:ty) => (\n impl Ext for $t {\n #[inline]\n fn idx(&self) -> usize {\n *self as usize\n }\n\n #[inline]\n fn num(&self) -> i64 {\n *self as i64\n }\n }\n )\n}\next!(i64);\next!(usize);\n\n\n#[derive(Copy, Clone, Debug)]\nstruct Pair {\n i : usize,\n cost : i64\n}\nimpl PartialOrd for Pair {\n fn partial_cmp(&self, other : &Pair) -> Option {\n Some(self.cost.cmp(&other.cost))\n }\n}\n\nimpl Ord for Pair {\n fn cmp(&self, other : &Pair) -> Ordering {\n self.partial_cmp(other).unwrap()\n }\n}\n\nimpl PartialEq for Pair {\n fn eq(&self, other : &Pair) -> bool {\n self.cost == other.cost\n }\n}\nimpl Eq for Pair {}\n\nfn main() {\n let stdin = stdin();\n let mut s = stdin.lock();\n let _ = scan!(s, usize);\n let mut data : Vec<_> = scan_iter!(s, i64);\n let mut i = 0;\n let mut j = data.len() - 1;\n\n while i < data.len() && data[i] == 1 {\n i += 1;\n }\n while j > 0 && data[j] == 1 {\n j -= 1;\n }\n\n for k in i..(j+1) {\n data[k] = 1 - data[k];\n }\n let result = data.iter().fold(0, |c, x| c + x);\n \n\n println!(\"{}\", result);\n}", "lang": "Rust", "bug_code_uid": "14c3c30fb3335105da079ffd59dee7b7", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "apr_id": "b1aead9b5cafc3c98061c7044d9961fa", "difficulty": 1200, "tags": ["dp", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9696677900818488, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "// use rand::Rng;\n\nuse std::collections::*;\nuse std::io;\n\nfn trim_newline(s: &mut String) {\n if s.ends_with('\\n') {\n s.pop();\n if s.ends_with('\\r') {\n s.pop();\n }\n }\n}\nmacro_rules! parse_input {\n ($t:ident) => {{\n let mut input_line = String::new();\n io::stdin().read_line(&mut input_line).unwrap();\n trim_newline(&mut input_line);\n input_line.parse::<$t>().unwrap()\n }};\n}\n\nmacro_rules! split_input {\n ($t:ident) => {{\n parse_input!(String)\n .split(\" \")\n .map(|z| z.parse::<$t>().unwrap())\n .collect::>()\n }};\n}\n\nfn main() {\n let a = parse_input!(u64);\n let b = split_input!(u64);\n let mut best = 0;\n let mut cur = 0;\n let ones: u64 = b.iter().sum();\n for p in b.iter() {\n if *p == 0 {\n cur += 1;\n best = std::cmp::max(best, cur);\n } else if cur > 0 {\n cur -= 1;\n }\n }\n\n println!(\"{}\", ones + best);\n}\n", "lang": "Rust", "bug_code_uid": "06388e21fe743e8ca8f20874fe156d89", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "apr_id": "aa6d4ade2b7cde0fd54f36472f5e9e5d", "difficulty": 1200, "tags": ["dp", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.7195752009184845, "equal_cnt": 61, "replace_cnt": 42, "delete_cnt": 4, "insert_cnt": 14, "fix_ops_cnt": 60, "bug_source_code": "#[allow(unused_imports)]\nuse std::cmp::{min,max};\n#[allow(unused_imports)]\nuse std::collections::{BTreeMap,BTreeSet};\n#[allow(unused_imports)]\nuse std::ops::*;\n#[allow(unused_imports)]\nuse std::collections::BinaryHeap;\n\n#[allow(unused_macros)]\nmacro_rules! ite {\n ($c:expr, $t:expr, $f:expr) => {{\n if $c { $t } else { $f }\n }};\n}\n\n// ref: tanakh \n// diff: using Parser\n#[macro_export]\nmacro_rules! input {\n (source = $s:expr, $($r:tt)*) => {\n let mut parser = Parser::from_str($s);\n input_inner!{parser, $($r)*}\n };\n (parser = $parser:ident, $($r:tt)*) => {\n input_inner!{$parser, $($r)*}\n };\n (new_stdin_parser = $parser:ident, $($r:tt)*) => {\n let stdin = std::io::stdin();\n let reader = std::io::BufReader::new(stdin.lock());\n let mut $parser = Parser::new(reader);\n input_inner!{$parser, $($r)*}\n };\n ($($r:tt)*) => {\n input!{new_stdin_parser = parser, $($r)*}\n };\n}\n\n#[macro_export]\nmacro_rules! input_inner {\n ($parser:ident) => {};\n ($parser:ident, ) => {};\n ($parser:ident, $var:ident : $t:tt $($r:tt)*) => {\n let $var = read_value!($parser, $t);\n input_inner!{$parser $($r)*}\n };\n}\n\n#[macro_export]\nmacro_rules! read_value {\n ($parser:ident, ( $($t:tt),* )) => {\n ( $(read_value!($parser, $t)),* )\n };\n ($parser:ident, [ $t:tt ; $len:expr ]) => {\n (0..$len).map(|_| read_value!($parser, $t)).collect::>()\n };\n ($parser:ident, chars) => {\n read_value!($parser, String).chars().collect::>()\n };\n ($parser:ident, usize1) => {\n read_value!($parser, usize) - 1\n };\n ($parser:ident, $t:ty) => {\n $parser.next::<$t>().expect(\"Parse error\")\n };\n}\n\nfn prime_factorization(n: i64) -> Vec<(i64,usize)> {\n let mut res = vec![];\n let mut x = n;\n let mut i = 2;\n while i * i <= x {\n let mut count = 0;\n while x % i == 0 {\n count += 1;\n x /= i;\n }\n if count != 0 {\n res.push((i, count));\n }\n i += 1;\n }\n if x != 1 {\n res.push((x,1));\n }\n res\n}\n\nfn dfs(ps: &Vec<(i64,usize)>, prim: &Vec, prev: Mod, res: &mut BTreeMap, x: i64, i: usize, total_count: Mod) {\n if i == ps.len() {\n *res.entry(x).or_insert(Mod(0)) += prev / total_count;\n return;\n }\n for k in 0..prim[i]+1 {\n dfs(ps, prim, prev, res, x * ps[i].0.pow(k as u32), i+1, total_count);\n }\n}\n\nfn dfs2(ps: &Vec<(i64, usize)>, i: usize, prim: &mut Vec, prev_map: &BTreeMap, new_map: &mut BTreeMap, y: i64) {\n if i == ps.len() {\n let mut total_count = Mod(1);\n for k in 0..ps.len() {\n total_count *= Mod(prim[k] as u64) + Mod(1);\n }\n let t = match prev_map.get(&y) {\n Some(t) => *t,\n None => Mod(0),\n };\n dfs(ps, prim, t, new_map, 1, 0, total_count);\n return;\n }\n for k in 0..ps[i].1+1 {\n prim.push(k);\n dfs2(ps, i+1, prim, prev_map, new_map, y * ps[i].0.pow(k as u32));\n prim.pop();\n }\n}\n\nfn main() {\n input! {\n n: i64,\n m: usize,\n }\n let ps = prime_factorization(n);\n let mut btree = BTreeMap::new();\n btree.insert(n, Mod(1));\n for _ in 0..m {\n let mut new_btree = BTreeMap::new();\n dfs2(&ps, 0, &mut vec![], &btree, &mut new_btree, 1);\n btree = new_btree;\n }\n let mut res = Mod(0);\n for (&key,&x) in btree.iter() {\n res += Mod(key as u64) * x;\n }\n println!(\"{}\", res.0);\n}\n\nuse std::ops::*;\n\nconst MOD : u64 = 1_000_000_007;\n#[derive(Clone,Copy,PartialEq,Debug)]\npub struct Mod (pub u64);\n\nimpl Mod {\n pub fn pow(self, n: u64) -> Mod {\n if n == 0 {\n return Mod(1);\n }\n let t = self.pow(n/2);\n if n % 2 == 0 {\n t * t\n }\n else {\n t * t * self\n }\n }\n}\n\nimpl Add for Mod {\n type Output = Self;\n fn add(self, rhs: Self) -> Self::Output {\n Mod((self.0 + rhs.0) % MOD)\n }\n}\n\nimpl AddAssign for Mod {\n fn add_assign(&mut self, rhs: Self) {\n *self = *self + rhs;\n }\n}\n\nimpl Sub for Mod {\n type Output = Self;\n fn sub(self, rhs: Self) -> Self::Output {\n Mod((self.0 + MOD - rhs.0 % MOD) % MOD)\n }\n}\n\nimpl SubAssign for Mod {\n fn sub_assign(&mut self, rhs: Self) {\n *self = *self - rhs;\n }\n}\n\nimpl Neg for Mod {\n type Output = Mod;\n fn neg(self) -> Mod {\n Mod(MOD - self.0)\n }\n}\n\nimpl Mul for Mod {\n type Output = Self;\n fn mul(self, rhs: Self) -> Self::Output {\n Mod(self.0 % MOD * rhs.0 % MOD)\n }\n}\n\nimpl MulAssign for Mod {\n fn mul_assign(&mut self, rhs: Self) {\n *self = *self * rhs;\n }\n}\n\nimpl Div for Mod {\n type Output = Self;\n fn div(self, rhs: Self) -> Self::Output {\n self * rhs.pow(MOD-2)\n }\n}\n\nuse std::io::BufRead;\nuse std::io;\nuse std::str;\n\n// ref: tatsuya6502 \n// ref: wariuni \n// diff: using std::io::BufRead::fill_buf()\npub struct Parser {\n reader: R,\n buf: Vec,\n pos: usize,\n}\n\nimpl Parser {\n pub fn from_str(s: &str) -> Parser {\n Parser {\n reader: io::empty(),\n buf: s.as_bytes().to_vec(),\n pos: 0,\n }\n }\n}\n\nimpl Parser {\n pub fn new(reader: R) -> Parser {\n Parser {\n reader: reader,\n buf: vec![],\n pos: 0,\n }\n }\n pub fn update_buf(&mut self) {\n self.buf.clear();\n self.pos = 0;\n loop {\n let (len,complete) = {\n let buf2 = self.reader.fill_buf().unwrap();\n self.buf.extend_from_slice(buf2);\n let len = buf2.len();\n (len, buf2[len-1] <= 0x20)\n };\n self.reader.consume(len);\n if complete {\n break;\n }\n }\n }\n pub fn next(&mut self) -> Result {\n loop {\n let mut begin = self.pos;\n while begin < self.buf.len() && (self.buf[begin] <= 0x20) {\n begin += 1;\n }\n let mut end = begin;\n while end < self.buf.len() && (self.buf[end] > 0x20) {\n end += 1;\n }\n if begin != self.buf.len() {\n self.pos = end;\n return str::from_utf8(&self.buf[begin..end]).unwrap().parse::();\n }\n else {\n self.update_buf();\n }\n }\n }\n}\n\nuse std::fmt::Display;\n#[allow(dead_code)]\nfn write_vec(xs: &Vec) {\n if xs.len() == 0 {\n println!();\n return;\n }\n print!(\"{}\", xs[0]);\n for i in 1..xs.len() {\n print!(\" {}\", xs[i]);\n }\n println!();\n}\n", "lang": "Rust", "bug_code_uid": "89738ef59d83250848ee6fa411ce21bf", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "apr_id": "6feb3d20e63b720773f0f0fab99a9249", "difficulty": 2200, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.874551446356646, "equal_cnt": 34, "replace_cnt": 13, "delete_cnt": 2, "insert_cnt": 18, "fix_ops_cnt": 33, "bug_source_code": "#[allow(unused_imports)]\nuse std::cmp::{min,max};\n#[allow(unused_imports)]\nuse std::collections::{BTreeMap,BTreeSet};\n#[allow(unused_imports)]\nuse std::ops::*;\n#[allow(unused_imports)]\nuse std::collections::BinaryHeap;\n\n#[allow(unused_macros)]\nmacro_rules! ite {\n ($c:expr, $t:expr, $f:expr) => {{\n if $c { $t } else { $f }\n }};\n}\n\n// ref: tanakh \n// diff: using Parser\n#[macro_export]\nmacro_rules! input {\n (source = $s:expr, $($r:tt)*) => {\n let mut parser = Parser::from_str($s);\n input_inner!{parser, $($r)*}\n };\n (parser = $parser:ident, $($r:tt)*) => {\n input_inner!{$parser, $($r)*}\n };\n (new_stdin_parser = $parser:ident, $($r:tt)*) => {\n let stdin = std::io::stdin();\n let reader = std::io::BufReader::new(stdin.lock());\n let mut $parser = Parser::new(reader);\n input_inner!{$parser, $($r)*}\n };\n ($($r:tt)*) => {\n input!{new_stdin_parser = parser, $($r)*}\n };\n}\n\n#[macro_export]\nmacro_rules! input_inner {\n ($parser:ident) => {};\n ($parser:ident, ) => {};\n ($parser:ident, $var:ident : $t:tt $($r:tt)*) => {\n let $var = read_value!($parser, $t);\n input_inner!{$parser $($r)*}\n };\n}\n\n#[macro_export]\nmacro_rules! read_value {\n ($parser:ident, ( $($t:tt),* )) => {\n ( $(read_value!($parser, $t)),* )\n };\n ($parser:ident, [ $t:tt ; $len:expr ]) => {\n (0..$len).map(|_| read_value!($parser, $t)).collect::>()\n };\n ($parser:ident, chars) => {\n read_value!($parser, String).chars().collect::>()\n };\n ($parser:ident, usize1) => {\n read_value!($parser, usize) - 1\n };\n ($parser:ident, $t:ty) => {\n $parser.next::<$t>().expect(\"Parse error\")\n };\n}\n\nfn prime_factorization(n: i64) -> Vec<(i64,usize)> {\n let mut res = vec![];\n let mut x = n;\n let mut i = 2;\n while i * i <= x {\n let mut count = 0;\n while x % i == 0 {\n count += 1;\n x /= i;\n }\n if count != 0 {\n res.push((i, count));\n }\n i += 1;\n }\n if x != 1 {\n res.push((x,1));\n }\n res\n}\n\nfn dfs(ps: &Vec<(i64,usize)>, table: &Vec>, i: usize, x: i64, prob: Mod) -> Mod {\n if i == ps.len() {\n return prob * Mod(x as u64);\n }\n let mut res = Mod(0);\n for k in 0..ps[i].1+1 {\n res += dfs(ps, table, i+1, x * ps[i].0.pow(k as u32), prob * table[i][k]);\n }\n res\n}\n\nfn main() {\n input! {\n n: i64,\n m: u64,\n }\n let ps = prime_factorization(n);\n\n let mut inv_table = vec![Mod(1), Mod(1)];\n for i in 2..1000 {\n inv_table.push(Mod(1) / Mod(i));\n }\n\n let mut table = vec![];\n for &(p,count) in &ps {\n let mut dp = vec![Mod(0); count+1];\n dp[count] = Mod(1);\n for _ in 0..m {\n let mut dp2 = vec![Mod(0); count+1];\n for j in 0..count+1 {\n for k in 0..j+1 {\n // dp2[k] += dp[j] / Mod((j+1) as u64);\n dp2[k] += dp[j] * inv_table[j+1];\n }\n }\n dp = dp2;\n }\n table.push(dp);\n }\n\n let res = dfs(&ps, &table, 0, 1, Mod(1));\n println!(\"{}\", res.0);\n}\n\nuse std::ops::*;\n\nconst MOD : u64 = 1_000_000_007;\n#[derive(Clone,Copy,PartialEq,Debug)]\npub struct Mod (pub u64);\n\nimpl Mod {\n pub fn pow(self, n: u64) -> Mod {\n if n == 0 {\n return Mod(1);\n }\n let t = self.pow(n/2);\n if n % 2 == 0 {\n t * t\n }\n else {\n t * t * self\n }\n }\n}\n\nimpl Add for Mod {\n type Output = Self;\n fn add(self, rhs: Self) -> Self::Output {\n Mod((self.0 + rhs.0) % MOD)\n }\n}\n\nimpl AddAssign for Mod {\n fn add_assign(&mut self, rhs: Self) {\n *self = *self + rhs;\n }\n}\n\nimpl Sub for Mod {\n type Output = Self;\n fn sub(self, rhs: Self) -> Self::Output {\n Mod((self.0 + MOD - rhs.0 % MOD) % MOD)\n }\n}\n\nimpl SubAssign for Mod {\n fn sub_assign(&mut self, rhs: Self) {\n *self = *self - rhs;\n }\n}\n\nimpl Neg for Mod {\n type Output = Mod;\n fn neg(self) -> Mod {\n Mod(MOD - self.0)\n }\n}\n\nimpl Mul for Mod {\n type Output = Self;\n fn mul(self, rhs: Self) -> Self::Output {\n Mod(self.0 % MOD * rhs.0 % MOD)\n }\n}\n\nimpl MulAssign for Mod {\n fn mul_assign(&mut self, rhs: Self) {\n *self = *self * rhs;\n }\n}\n\nimpl Div for Mod {\n type Output = Self;\n fn div(self, rhs: Self) -> Self::Output {\n if rhs.0 == 0 {\n loop {}\n }\n assert!(rhs.0 != 0);\n self * rhs.pow(MOD-2)\n }\n}\n\nuse std::io::BufRead;\nuse std::io;\nuse std::str;\n\n// ref: tatsuya6502 \n// ref: wariuni \n// diff: using std::io::BufRead::fill_buf()\npub struct Parser {\n reader: R,\n buf: Vec,\n pos: usize,\n}\n\nimpl Parser {\n pub fn from_str(s: &str) -> Parser {\n Parser {\n reader: io::empty(),\n buf: s.as_bytes().to_vec(),\n pos: 0,\n }\n }\n}\n\nimpl Parser {\n pub fn new(reader: R) -> Parser {\n Parser {\n reader: reader,\n buf: vec![],\n pos: 0,\n }\n }\n pub fn update_buf(&mut self) {\n self.buf.clear();\n self.pos = 0;\n loop {\n let (len,complete) = {\n let buf2 = self.reader.fill_buf().unwrap();\n self.buf.extend_from_slice(buf2);\n let len = buf2.len();\n (len, buf2[len-1] <= 0x20)\n };\n self.reader.consume(len);\n if complete {\n break;\n }\n }\n }\n pub fn next(&mut self) -> Result {\n loop {\n let mut begin = self.pos;\n while begin < self.buf.len() && (self.buf[begin] <= 0x20) {\n begin += 1;\n }\n let mut end = begin;\n while end < self.buf.len() && (self.buf[end] > 0x20) {\n end += 1;\n }\n if begin != self.buf.len() {\n self.pos = end;\n return str::from_utf8(&self.buf[begin..end]).unwrap().parse::();\n }\n else {\n self.update_buf();\n }\n }\n }\n}\n\nuse std::fmt::Display;\n#[allow(dead_code)]\nfn write_vec(xs: &Vec) {\n if xs.len() == 0 {\n println!();\n return;\n }\n print!(\"{}\", xs[0]);\n for i in 1..xs.len() {\n print!(\" {}\", xs[i]);\n }\n println!();\n}\n", "lang": "Rust", "bug_code_uid": "3d50e4c61712b951758f68df78f5321b", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "apr_id": "6feb3d20e63b720773f0f0fab99a9249", "difficulty": 2200, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9956236323851203, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "use std::io::stdin;\n\nfn main() {\n let mut input = String::new();\n stdin().read_line(&mut input).unwrap();\n let mut input = input.split_whitespace().map(|k| k.parse::().unwrap());\n let m = input.next().unwrap();\n let b = input.next().unwrap();\n\n let ans = (0..(m * b + 1)).map(|x| {\n let y = b - (x + m - 1) / m;\n let tmp = (x + 1) * (y + 1) * (x + y) / 2 ;\n tmp\n }).max().unwrap();\n\n println!(\"{}\", ans);\n}\n", "lang": "Rust", "bug_code_uid": "984f4fc398d59475024608e5a81355d7", "src_uid": "9300f1c07dd36e0cf7e6cb7911df4cf2", "apr_id": "df0c2afab927c64f98d0660e808c88a6", "difficulty": 1300, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9756662804171495, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "use std::cmp::min;\nuse std::io;\n\nfn factorial(n: u32) -> u32 {\n (1..=n).fold(1, |acc, x| acc * x)\n}\n\nfn main() {\n let mut line = String::new();\n io::stdin().read_line(&mut line).unwrap();\n let numbers: Vec = line\n .split_whitespace()\n .map(|s| s.parse().unwrap())\n .collect();\n let a = numbers[0];\n let b = numbers[1];\n let ans = min(factorial(a), factorial(b));\n println!(\"{}\", ans);\n}\n", "lang": "Rust", "bug_code_uid": "471af36c7aaf68eb9d781fb19fa20b21", "src_uid": "7bf30ceb24b66d91382e97767f9feeb6", "apr_id": "024e685e67c2e85ded1f247b27870db9", "difficulty": 800, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Rust"} {"similarity_score": 0.9984387197501952, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "//spnauti-rust\n#[allow(unused_macros)]\nmacro_rules! a {\n ($c: tt, $x: expr, $y: expr) => {{\n let b = $y; let a = &mut $x;\n if b $c *a { *a = b; true } else { false }\n }};\n}\nuse std::io::*;\nuse std::str::*;\nuse std::fmt::Debug;\nstruct WordReader<'a> { it : SplitAsciiWhitespace<'a>, }\n#[allow(dead_code)]\nimpl<'a> WordReader<'a> {\n fn new(b: &mut String, mut r: T) -> WordReader {\n b.clear();\n r.read_to_string(b).unwrap();\n WordReader { it: b.split_ascii_whitespace() }\n }\n fn from_stdin(b: &mut String) -> WordReader {\n WordReader::new(b, stdin())\n }\n fn sl(&mut self) -> &str { self.it.next().unwrap() }\n fn bs(&mut self) -> &[u8] { self.sl().as_bytes() }\n fn s(&mut self) -> String { String::from(self.sl()) }\n fn i(&mut self) -> i32 { self.p() }\n fn p(&mut self) -> T where T::Err: Debug {\n self.sl().parse::().unwrap()\n }\n fn vp(&mut self, n: usize) -> Vec where T::Err: Debug {\n (0..n).map(|_| self.p()).collect()\n }\n}\n\nfn main() {\n let mut bin = String::new();\n let mut input = WordReader::from_stdin(&mut bin);\n\n println!(\"{}\", (1..(input.i().min(input.i()) as i64))\n .product::());\n}\n\n", "lang": "Rust", "bug_code_uid": "aa54257b438ed5353b65530856295ed7", "src_uid": "7bf30ceb24b66d91382e97767f9feeb6", "apr_id": "316fb619b0dffe966b7b727a7bfdacae", "difficulty": 800, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"} {"similarity_score": 0.9998491211305857, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "// codesnip-guard: main\nfn main() {\n #![allow(unused_imports, unused_macros)]\n prepare_io!(_in_buf, scanner, _out);\n macro_rules ! print { ($ ($ arg : tt) *) => (:: std :: write ! (_out , $ ($ arg) *) . expect (\"io error\")) }\n macro_rules ! println { ($ ($ arg : tt) *) => (:: std :: writeln ! (_out , $ ($ arg) *) . expect (\"io error\")) }\n scan!(scanner, n, m, s: [{CharsWithBase('a')}; n]);\n let mut t = Trie::new(26);\n let mut deq = std::collections::VecDeque::new();\n deq.push_back((0, 0));\n let mut idx = Indexing::new();\n idx.get((0, 0));\n for s in s.iter() {\n let x = t.insert(s.iter().cloned());\n }\n let mut mp = std::collections::HashMap::<_, M>::new();\n while let Some((u, v)) = deq.pop_front() {\n let i = idx.get((u, v));\n for ch in 0..26 {\n if let (Some(nu), Some(nv)) = (t.next_node(u, ch), t.next_node(v, ch)) {\n let x = minmax!(nu, nv);\n if !idx.contains(&x) {\n deq.push_back(x);\n }\n *mp.entry((i, idx.get(x))).or_default() += M::one();\n if t.count(nu) > 0 {\n let x = minmax!(nu, 0);\n if !idx.contains(&x) {\n deq.push_back(x);\n }\n *mp.entry((i, idx.get(x))).or_default() += M::one();\n }\n if t.count(nv) > 0 {\n let x = minmax!(0, nv);\n if !idx.contains(&x) {\n deq.push_back(x);\n }\n *mp.entry((i, idx.get(x))).or_default() += M::one();\n }\n if t.count(nu) > 0 && t.count(nv) > 0 {\n *mp.entry((i, 0)).or_default() += M::one();\n }\n }\n }\n }\n let k = idx.len();\n let mut mat = vec![vec![M::zero(); k]; k];\n for ((i, j), v) in mp {\n mat[i][j] += v;\n }\n let ans = Matrix::from_vec(mat).pow(m)[0][0];\n println!(\"{}\", ans);\n}\n#[derive(Debug, Clone)]\npub struct Indexing {\n map: std::collections::HashMap,\n}\nimpl Indexing {\n pub fn new() -> Self {\n Self {\n map: Default::default(),\n }\n }\n pub fn len(&self) -> usize {\n self.map.len()\n }\n pub fn contains(&self, key: &T) -> bool {\n self.map.contains_key(key)\n }\n pub fn get(&mut self, key: T) -> usize {\n if let Some(index) = self.map.get(&key) {\n *index\n } else {\n let index = self.map.len();\n self.map.insert(key, index);\n index\n }\n }\n}\npub type M = montgomery::MInt998244353;\n#[macro_export]\nmacro_rules! prepare_io {\n ($ in_buf : ident , $ scanner : ident , $ out : ident) => {\n use std::io::{stdout, BufWriter, Write as _};\n let $in_buf = read_stdin_all_unchecked();\n let mut $scanner = Scanner::new(&$in_buf);\n let $out = stdout();\n let mut $out = BufWriter::new($out.lock());\n };\n}\n// codesnip-guard: _echo\npub fn echo(\n mut writer: impl std::io::Write,\n iter: impl IntoIterator,\n sep: impl std::fmt::Display,\n) -> std::io::Result<()> {\n let mut iter = iter.into_iter();\n if let Some(item) = iter.next() {\n write!(writer, \"{}\", item)?;\n }\n for item in iter {\n write!(writer, \"{}{}\", sep, item)?;\n }\n writeln!(writer)\n}\n// codesnip-guard: scanner\npub fn read_stdin_all_unchecked() -> String {\n use std::io::Read as _;\n let mut buf = Vec::new();\n std::io::stdin().read_to_end(&mut buf).expect(\"io error\");\n unsafe { String::from_utf8_unchecked(buf) }\n}\npub fn read_stdin_line() -> String {\n let mut s = String::new();\n std::io::stdin().read_line(&mut s).expect(\"io error\");\n s\n}\npub trait IterScan: Sized {\n type Output;\n fn scan<'a, I: Iterator>(iter: &mut I) -> Option;\n}\npub trait MarkedIterScan: Sized {\n type Output;\n fn mscan<'a, I: Iterator>(self, iter: &mut I) -> Option;\n}\n#[derive(Clone, Debug)]\npub struct Scanner<'a> {\n iter: std::str::SplitAsciiWhitespace<'a>,\n}\nmod scanner_impls {\n use super::*;\n impl<'a> Scanner<'a> {\n #[inline]\n pub fn new(s: &'a str) -> Self {\n let iter = s.split_ascii_whitespace();\n Self { iter }\n }\n #[inline]\n pub fn scan(&mut self) -> ::Output {\n ::scan(&mut self.iter).expect(\"scan error\")\n }\n #[inline]\n pub fn mscan(&mut self, marker: T) -> ::Output {\n marker.mscan(&mut self.iter).expect(\"scan error\")\n }\n #[inline]\n pub fn scan_vec(&mut self, size: usize) -> Vec<::Output> {\n (0..size)\n .map(|_| ::scan(&mut self.iter).expect(\"scan error\"))\n .collect()\n }\n #[inline]\n pub fn iter<'b, T: IterScan>(&'b mut self) -> ScannerIter<'a, 'b, T> {\n ScannerIter {\n inner: self,\n _marker: std::marker::PhantomData,\n }\n }\n }\n macro_rules ! iter_scan_impls { ($ ($ t : ty) *) => { $ (impl IterScan for $ t { type Output = Self ; # [inline] fn scan <'a , I : Iterator < Item = &'a str >> (iter : & mut I) -> Option < Self > { iter . next () ?. parse ::<$ t > () . ok () } }) * } ; }\n iter_scan_impls ! (char u8 u16 u32 u64 usize i8 i16 i32 i64 isize f32 f64 u128 i128 String);\n macro_rules ! iter_scan_tuple_impl { ($ ($ T : ident) *) => { impl <$ ($ T : IterScan) ,*> IterScan for ($ ($ T ,) *) { type Output = ($ (<$ T as IterScan >:: Output ,) *) ; # [inline] fn scan <'a , It : Iterator < Item = &'a str >> (_iter : & mut It) -> Option < Self :: Output > { Some (($ (<$ T as IterScan >:: scan (_iter) ?,) *)) } } } ; }\n iter_scan_tuple_impl!();\n iter_scan_tuple_impl!(A);\n iter_scan_tuple_impl ! (A B);\n iter_scan_tuple_impl ! (A B C);\n iter_scan_tuple_impl ! (A B C D);\n iter_scan_tuple_impl ! (A B C D E);\n iter_scan_tuple_impl ! (A B C D E F);\n iter_scan_tuple_impl ! (A B C D E F G);\n iter_scan_tuple_impl ! (A B C D E F G H);\n iter_scan_tuple_impl ! (A B C D E F G H I);\n iter_scan_tuple_impl ! (A B C D E F G H I J);\n iter_scan_tuple_impl ! (A B C D E F G H I J K);\n pub struct ScannerIter<'a, 'b, T> {\n inner: &'b mut Scanner<'a>,\n _marker: std::marker::PhantomData T>,\n }\n impl<'a, 'b, T: IterScan> Iterator for ScannerIter<'a, 'b, T> {\n type Item = ::Output;\n #[inline]\n fn next(&mut self) -> Option {\n ::scan(&mut self.inner.iter)\n }\n }\n}\n#[derive(Debug, Copy, Clone)]\npub struct Usize1;\n#[derive(Debug, Copy, Clone)]\npub struct CharWithBase(pub char);\n#[derive(Debug, Copy, Clone)]\npub struct Chars;\n#[derive(Debug, Copy, Clone)]\npub struct CharsWithBase(pub char);\n#[derive(Debug, Copy, Clone)]\npub struct Collect::Output>> {\n size: usize,\n _marker: std::marker::PhantomData (T, B)>,\n}\nmod marker_impls {\n use super::*;\n use std::{iter::FromIterator, marker::PhantomData};\n impl IterScan for Usize1 {\n type Output = usize;\n #[inline]\n fn scan<'a, I: Iterator>(iter: &mut I) -> Option {\n ::scan(iter)?.checked_sub(1)\n }\n }\n impl MarkedIterScan for CharWithBase {\n type Output = usize;\n #[inline]\n fn mscan<'a, I: Iterator>(self, iter: &mut I) -> Option {\n Some((::scan(iter)? as u8 - self.0 as u8) as usize)\n }\n }\n impl IterScan for Chars {\n type Output = Vec;\n #[inline]\n fn scan<'a, I: Iterator>(iter: &mut I) -> Option {\n Some(iter.next()?.chars().collect())\n }\n }\n impl MarkedIterScan for CharsWithBase {\n type Output = Vec;\n #[inline]\n fn mscan<'a, I: Iterator>(self, iter: &mut I) -> Option {\n Some(\n iter.next()?\n .chars()\n .map(|c| (c as u8 - self.0 as u8) as usize)\n .collect(),\n )\n }\n }\n impl::Output>> Collect {\n pub fn new(size: usize) -> Self {\n Self {\n size,\n _marker: PhantomData,\n }\n }\n }\n impl::Output>> MarkedIterScan for Collect {\n type Output = B;\n #[inline]\n fn mscan<'a, I: Iterator>(self, iter: &mut I) -> Option {\n Some(\n (0..self.size)\n .map(|_| ::scan(iter).expect(\"scan error\"))\n .collect::(),\n )\n }\n }\n}\n#[macro_export]\nmacro_rules ! scan_value { ($ scanner : expr , ($ ($ t : tt) ,*)) => { ($ ($ crate :: scan_value ! ($ scanner , $ t)) ,*) } ; ($ scanner : expr , [$ t : tt ; $ len : expr]) => { (0 ..$ len) . map (| _ | $ crate :: scan_value ! ($ scanner , $ t)) . collect ::< Vec < _ >> () } ; ($ scanner : expr , [$ t : ty ; $ len : expr]) => { $ scanner . scan_vec ::<$ t > ($ len) } ; ($ scanner : expr , [$ t : ty]) => { $ scanner . iter ::<$ t > () } ; ($ scanner : expr , { $ e : expr }) => { $ scanner . mscan ($ e) } ; ($ scanner : expr , $ t : ty) => { $ scanner . scan ::<$ t > () } ; }\n#[macro_export]\nmacro_rules ! scan { ($ scanner : expr) => { } ; ($ scanner : expr ,) => { } ; ($ scanner : expr , mut $ var : tt : $ t : tt) => { let mut $ var = $ crate :: scan_value ! ($ scanner , $ t) ; } ; ($ scanner : expr , $ var : tt : $ t : tt) => { let $ var = $ crate :: scan_value ! ($ scanner , $ t) ; } ; ($ scanner : expr , mut $ var : tt : $ t : tt , $ ($ rest : tt) *) => { let mut $ var = $ crate :: scan_value ! ($ scanner , $ t) ; scan ! ($ scanner , $ ($ rest) *) } ; ($ scanner : expr , $ var : tt : $ t : tt , $ ($ rest : tt) *) => { let $ var = $ crate :: scan_value ! ($ scanner , $ t) ; scan ! ($ scanner , $ ($ rest) *) } ; ($ scanner : expr , mut $ var : tt) => { let mut $ var = $ crate :: scan_value ! ($ scanner , usize) ; } ; ($ scanner : expr , $ var : tt) => { let $ var = $ crate :: scan_value ! ($ scanner , usize) ; } ; ($ scanner : expr , mut $ var : tt , $ ($ rest : tt) *) => { let mut $ var = $ crate :: scan_value ! ($ scanner , usize) ; scan ! ($ scanner , $ ($ rest) *) } ; ($ scanner : expr , $ var : tt , $ ($ rest : tt) *) => { let $ var = $ crate :: scan_value ! ($ scanner , usize) ; scan ! ($ scanner , $ ($ rest) *) } ; }\n// codesnip-guard: Trie\npub struct Trie {\n child: Vec>,\n accept: Vec,\n char_size: usize,\n}\nimpl Trie {\n pub fn new(char_size: usize) -> Self {\n Self {\n child: vec![vec![0; char_size]],\n accept: vec![0],\n char_size,\n }\n }\n pub fn insert_at(\n &mut self,\n mut node: usize,\n iter: impl IntoIterator,\n ) -> Vec {\n let mut path = Vec::new();\n for ch in iter.into_iter() {\n path.push(node);\n if self.child[node][ch] == 0 {\n self.child[node][ch] = self.child.len();\n self.child.push(vec![0; self.char_size]);\n self.accept.push(0);\n }\n node = self.child[node][ch];\n }\n path.push(node);\n self.accept[node] += 1;\n path\n }\n pub fn insert(&mut self, iter: impl IntoIterator) -> Vec {\n self.insert_at(0, iter)\n }\n pub fn find_at(\n &self,\n mut node: usize,\n iter: impl IntoIterator,\n ) -> Result {\n for ch in iter.into_iter() {\n if let Some(v) = self.child.get(node) {\n node = v[ch];\n } else {\n return Err(node);\n }\n }\n Ok(node)\n }\n pub fn find(&self, iter: impl IntoIterator) -> Result {\n self.find_at(0, iter)\n }\n pub fn next_node(&self, node: usize, ch: usize) -> Option {\n if self.child[node][ch] == 0 {\n None\n } else {\n Some(self.child[node][ch])\n }\n }\n pub fn count(&self, node: usize) -> usize {\n self.accept[node]\n }\n pub fn next_count(&self, node: usize, ch: usize) -> usize {\n if let Some(node) = self.next_node(node, ch) {\n self.count(node)\n } else {\n 0\n }\n }\n}\n// codesnip-guard: ord_tools\npub trait PartialOrdExt: Sized {\n fn chmin(&mut self, other: Self);\n fn chmax(&mut self, other: Self);\n fn minmax(self, other: Self) -> (Self, Self);\n}\nimpl PartialOrdExt for T\nwhere\n T: PartialOrd,\n{\n #[inline]\n fn chmin(&mut self, other: Self) {\n if *self > other {\n *self = other;\n }\n }\n #[inline]\n fn chmax(&mut self, other: Self) {\n if *self < other {\n *self = other;\n }\n }\n #[inline]\n fn minmax(self, other: Self) -> (Self, Self) {\n if self < other {\n (self, other)\n } else {\n (other, self)\n }\n }\n}\n#[macro_export]\nmacro_rules ! min { ($ l : expr) => { $ l } ; ($ l : expr ,) => { $ crate :: min ! ($ l) } ; ($ l : expr , $ r : expr) => { ($ l) . min ($ r) } ; ($ l : expr , $ r : expr ,) => { $ crate :: min ! ($ l , $ r) } ; ($ l : expr , $ r : expr , $ ($ t : tt) *) => { $ crate :: min ! ($ crate :: min ! ($ l , $ r) , $ ($ t) *) } ; }\n#[macro_export]\nmacro_rules ! chmin { ($ l : expr) => { } ; ($ l : expr ,) => { } ; ($ l : expr , $ r : expr) => { { let r = $ r ; if $ l > r { $ l = r ; } } } ; ($ l : expr , $ r : expr ,) => { $ crate :: chmin ! ($ l , $ r) } ; ($ l : expr , $ r : expr , $ ($ t : tt) *) => { $ crate :: chmin ! ($ l , $ r) ; $ crate :: chmin ! ($ l , $ ($ t) *) } ; }\n#[macro_export]\nmacro_rules ! max { ($ l : expr) => { $ l } ; ($ l : expr ,) => { $ crate :: max ! ($ l) } ; ($ l : expr , $ r : expr) => { ($ l) . max ($ r) } ; ($ l : expr , $ r : expr ,) => { $ crate :: max ! ($ l , $ r) } ; ($ l : expr , $ r : expr , $ ($ t : tt) *) => { $ crate :: max ! ($ crate :: max ! ($ l , $ r) , $ ($ t) *) } ; }\n#[macro_export]\nmacro_rules ! chmax { ($ l : expr) => { } ; ($ l : expr ,) => { } ; ($ l : expr , $ r : expr) => { { let r = $ r ; if $ l < r { $ l = r ; } } } ; ($ l : expr , $ r : expr ,) => { $ crate :: chmax ! ($ l , $ r) } ; ($ l : expr , $ r : expr , $ ($ t : tt) *) => { $ crate :: chmax ! ($ l , $ r) ; $ crate :: chmax ! ($ l , $ ($ t) *) } ; }\n#[macro_export]\nmacro_rules ! minmax { ($ ($ t : tt) *) => { ($ crate :: min ! ($ ($ t) *) , $ crate :: max ! ($ ($ t) *)) } ; }\n// codesnip-guard: montgomery\npub mod montgomery {\n use super::*;\n pub struct Modulo998244353;\n pub type MInt998244353 = MInt;\n impl MIntBase for M\n where\n M: MontgomeryReduction32,\n {\n type Inner = u32;\n #[inline]\n fn get_mod() -> Self::Inner {\n ::get_mod()\n }\n #[inline]\n fn mod_zero() -> Self::Inner {\n 0\n }\n #[inline]\n fn mod_one() -> Self::Inner {\n Self::n1()\n }\n #[inline]\n fn mod_add(x: Self::Inner, y: Self::Inner) -> Self::Inner {\n let z = x + y;\n let m = Self::get_mod();\n if z >= m {\n z - m\n } else {\n z\n }\n }\n #[inline]\n fn mod_sub(x: Self::Inner, y: Self::Inner) -> Self::Inner {\n if x < y {\n x + Self::get_mod() - y\n } else {\n x - y\n }\n }\n #[inline]\n fn mod_mul(x: Self::Inner, y: Self::Inner) -> Self::Inner {\n Self::reduce(x as u64 * y as u64)\n }\n #[inline]\n fn mod_div(x: Self::Inner, y: Self::Inner) -> Self::Inner {\n Self::mod_mul(x, Self::mod_inv(y))\n }\n #[inline]\n fn mod_neg(x: Self::Inner) -> Self::Inner {\n if x == 0 {\n 0\n } else {\n Self::get_mod() - x\n }\n }\n fn mod_inv(x: Self::Inner) -> Self::Inner {\n let mut a = x;\n let m = Self::get_mod();\n let (mut b, mut u, mut s) = (m, 1, 0);\n let k = a.trailing_zeros();\n a >>= k;\n for _ in 0..k {\n if u & 1 == 1 {\n u += m;\n }\n u /= 2;\n }\n while a != b {\n if b < a {\n std::mem::swap(&mut a, &mut b);\n std::mem::swap(&mut u, &mut s);\n }\n b -= a;\n if s < u {\n s += m;\n }\n s -= u;\n let k = b.trailing_zeros();\n b >>= k;\n for _ in 0..k {\n if s & 1 == 1 {\n s += m;\n }\n s /= 2;\n }\n }\n Self::reduce(s as u64 * Self::n3() as u64)\n }\n }\n impl MIntConvert for M\n where\n M: MontgomeryReduction32,\n {\n #[inline]\n fn from(x: u32) -> Self::Inner {\n Self::reduce(x as u64 * Self::n2() as u64)\n }\n #[inline]\n fn into(x: Self::Inner) -> u32 {\n Self::reduce(x as u64) as u32\n }\n #[inline]\n fn mod_into() -> u32 {\n ::get_mod() as u32\n }\n }\n impl MIntConvert for M\n where\n M: MontgomeryReduction32,\n {\n #[inline]\n fn from(x: u64) -> Self::Inner {\n Self::reduce(x % Self::get_mod() as u64 * Self::n2() as u64)\n }\n #[inline]\n fn into(x: Self::Inner) -> u64 {\n Self::reduce(x as u64) as u64\n }\n #[inline]\n fn mod_into() -> u64 {\n ::get_mod() as u64\n }\n }\n impl MIntConvert for M\n where\n M: MontgomeryReduction32,\n {\n #[inline]\n fn from(x: usize) -> Self::Inner {\n Self::reduce(x as u64 % Self::get_mod() as u64 * Self::n2() as u64)\n }\n #[inline]\n fn into(x: Self::Inner) -> usize {\n Self::reduce(x as u64) as usize\n }\n #[inline]\n fn mod_into() -> usize {\n ::get_mod() as usize\n }\n }\n impl MIntConvert for Modulo998244353 {\n #[inline]\n fn from(x: i32) -> Self::Inner {\n let x = x % ::get_mod() as i32;\n let x = if x < 0 {\n (x + ::get_mod() as i32) as u64\n } else {\n x as u64\n };\n Self::reduce(x as u64 * Self::n2() as u64)\n }\n #[inline]\n fn into(x: Self::Inner) -> i32 {\n Self::reduce(x as u64) as i32\n }\n #[inline]\n fn mod_into() -> i32 {\n ::get_mod() as i32\n }\n }\n impl MIntConvert for Modulo998244353 {\n #[inline]\n fn from(x: i64) -> Self::Inner {\n let x = x % ::get_mod() as i64;\n let x = if x < 0 {\n (x + ::get_mod() as i64) as u64\n } else {\n x as u64\n };\n Self::reduce(x as u64 * Self::n2() as u64)\n }\n #[inline]\n fn into(x: Self::Inner) -> i64 {\n Self::reduce(x as u64) as i64\n }\n #[inline]\n fn mod_into() -> i64 {\n ::get_mod() as i64\n }\n }\n impl MIntConvert for Modulo998244353 {\n #[inline]\n fn from(x: isize) -> Self::Inner {\n let x = x % ::get_mod() as isize;\n let x = if x < 0 {\n (x + ::get_mod() as isize) as u64\n } else {\n x as u64\n };\n Self::reduce(x as u64 * Self::n2() as u64)\n }\n #[inline]\n fn into(x: Self::Inner) -> isize {\n Self::reduce(x as u64) as isize\n }\n #[inline]\n fn mod_into() -> isize {\n ::get_mod() as isize\n }\n }\n /// m is prime, n = 2^32\n pub trait MontgomeryReduction32 {\n /// m\n fn get_mod() -> u32;\n /// (-m)^{-1} mod n\n fn r() -> u32 {\n let m = Self::get_mod();\n let mut r = 0;\n let mut t = 0;\n for i in 0..32 {\n if t % 2 == 0 {\n t += m;\n r += 1 << i;\n }\n t /= 2;\n }\n r\n }\n /// n^1 mod m\n fn n1() -> u32;\n /// n^2 mod m\n fn n2() -> u32;\n /// n^3 mod m\n fn n3() -> u32;\n /// n^{-1}x = (x + (xr mod n)m) / n\n fn reduce(x: u64) -> u32 {\n let m: u32 = Self::get_mod();\n let r = Self::r();\n let mut x = ((x + r.wrapping_mul(x as u32) as u64 * m as u64) >> 32) as u32;\n if x >= m {\n x -= m;\n }\n x\n }\n }\n macro_rules! impl_montgomery_reduction_32 {\n ($ name : ident , $ m : expr , $ r : expr , $ n1 : expr , $ n2 : expr , $ n3 : expr) => {\n impl MontgomeryReduction32 for $name {\n #[inline]\n fn get_mod() -> u32 {\n $m\n }\n #[inline]\n fn r() -> u32 {\n $r\n }\n #[inline]\n fn n1() -> u32 {\n $n1\n }\n #[inline]\n fn n2() -> u32 {\n $n2\n }\n #[inline]\n fn n3() -> u32 {\n $n3\n }\n }\n };\n }\n impl_montgomery_reduction_32!(\n Modulo998244353,\n 998_244_353,\n 998_244_351,\n 301_989_884,\n 932_051_910,\n 679_058_953\n );\n}\n// codesnip-guard: MIntBase\n#[repr(transparent)]\npub struct MInt\nwhere\n M: MIntBase,\n{\n x: M::Inner,\n _marker: std::marker::PhantomData M>,\n}\npub trait MIntBase {\n type Inner: Sized + Copy + Eq + std::fmt::Debug + std::hash::Hash;\n fn get_mod() -> Self::Inner;\n fn mod_zero() -> Self::Inner;\n fn mod_one() -> Self::Inner;\n fn mod_add(x: Self::Inner, y: Self::Inner) -> Self::Inner;\n fn mod_sub(x: Self::Inner, y: Self::Inner) -> Self::Inner;\n fn mod_mul(x: Self::Inner, y: Self::Inner) -> Self::Inner;\n fn mod_div(x: Self::Inner, y: Self::Inner) -> Self::Inner;\n fn mod_neg(x: Self::Inner) -> Self::Inner;\n fn mod_inv(x: Self::Inner) -> Self::Inner;\n fn mod_pow(x: Self::Inner, y: usize) -> Self::Inner {\n let (mut x, mut y, mut z) = (x, y, Self::mod_one());\n while y > 0 {\n if y & 1 == 1 {\n z = Self::mod_mul(z, x);\n }\n x = Self::mod_mul(x, x);\n y >>= 1;\n }\n z\n }\n}\npub trait MIntConvert::Inner>: MIntBase {\n fn from(x: T) -> ::Inner;\n fn into(x: ::Inner) -> T;\n fn mod_into() -> T;\n}\nmod mint_base {\n use super::*;\n use std::{\n fmt::{self, Debug, Display},\n hash::{Hash, Hasher},\n iter::{Product, Sum},\n marker::PhantomData,\n ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Sub, SubAssign},\n str::FromStr,\n };\n impl MInt\n where\n M: MIntConvert,\n {\n #[inline]\n pub fn new(x: M::Inner) -> Self {\n Self::new_unchecked(>::from(x))\n }\n #[inline]\n pub fn inner(self) -> M::Inner {\n >::into(self.x)\n }\n }\n impl MInt\n where\n M: MIntBase,\n {\n #[inline]\n pub fn new_unchecked(x: M::Inner) -> Self {\n Self {\n x,\n _marker: PhantomData,\n }\n }\n #[inline]\n pub fn get_mod() -> M::Inner {\n M::get_mod()\n }\n #[inline]\n pub fn pow(self, y: usize) -> Self {\n Self::new_unchecked(M::mod_pow(self.x, y))\n }\n #[inline]\n pub fn inv(self) -> Self {\n Self::new_unchecked(M::mod_inv(self.x))\n }\n }\n impl Clone for MInt\n where\n M: MIntBase,\n {\n #[inline]\n fn clone(&self) -> Self {\n Self {\n x: Clone::clone(&self.x),\n _marker: PhantomData,\n }\n }\n }\n impl Copy for MInt where M: MIntBase {}\n impl Debug for MInt\n where\n M: MIntBase,\n {\n fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {\n Debug::fmt(&self.x, f)\n }\n }\n impl Default for MInt\n where\n M: MIntBase,\n {\n #[inline]\n fn default() -> Self {\n ::zero()\n }\n }\n impl PartialEq for MInt\n where\n M: MIntBase,\n {\n #[inline]\n fn eq(&self, other: &Self) -> bool {\n PartialEq::eq(&self.x, &other.x)\n }\n }\n impl Eq for MInt where M: MIntBase {}\n impl Hash for MInt\n where\n M: MIntBase,\n {\n #[inline]\n fn hash(&self, state: &mut H) {\n Hash::hash(&self.x, state)\n }\n }\n macro_rules ! impl_mint_from { ($ ($ t : ty) ,*) => { $ (impl < M > From <$ t > for MInt < M > where M : MIntConvert <$ t >, { # [inline] fn from (x : $ t) -> Self { Self :: new_unchecked (< M as MIntConvert <$ t >>:: from (x)) } } impl < M > From < MInt < M >> for $ t where M : MIntConvert <$ t >, { # [inline] fn from (x : MInt < M >) -> $ t { < M as MIntConvert <$ t >>:: into (x . x) } }) * } ; }\n impl_mint_from!(u8, u16, u32, u64, u128, usize, i8, i16, i32, i64, i128, isize);\n impl Zero for MInt\n where\n M: MIntBase,\n {\n #[inline]\n fn zero() -> Self {\n Self::new_unchecked(M::mod_zero())\n }\n }\n impl One for MInt\n where\n M: MIntBase,\n {\n #[inline]\n fn one() -> Self {\n Self::new_unchecked(M::mod_one())\n }\n }\n impl Add for MInt\n where\n M: MIntBase,\n {\n type Output = Self;\n #[inline]\n fn add(self, rhs: Self) -> Self::Output {\n Self::new_unchecked(M::mod_add(self.x, rhs.x))\n }\n }\n impl Sub for MInt\n where\n M: MIntBase,\n {\n type Output = Self;\n #[inline]\n fn sub(self, rhs: Self) -> Self::Output {\n Self::new_unchecked(M::mod_sub(self.x, rhs.x))\n }\n }\n impl Mul for MInt\n where\n M: MIntBase,\n {\n type Output = Self;\n #[inline]\n fn mul(self, rhs: Self) -> Self::Output {\n Self::new_unchecked(M::mod_mul(self.x, rhs.x))\n }\n }\n impl Div for MInt\n where\n M: MIntBase,\n {\n type Output = Self;\n #[inline]\n fn div(self, rhs: Self) -> Self::Output {\n Self::new_unchecked(M::mod_div(self.x, rhs.x))\n }\n }\n impl Neg for MInt\n where\n M: MIntBase,\n {\n type Output = Self;\n #[inline]\n fn neg(self) -> Self::Output {\n Self::new_unchecked(M::mod_neg(self.x))\n }\n }\n impl Sum for MInt\n where\n M: MIntBase,\n {\n #[inline]\n fn sum>(iter: I) -> Self {\n iter.fold(::zero(), Add::add)\n }\n }\n impl Product for MInt\n where\n M: MIntBase,\n {\n #[inline]\n fn product>(iter: I) -> Self {\n iter.fold(::one(), Mul::mul)\n }\n }\n impl<'a, M: 'a> Sum<&'a MInt> for MInt\n where\n M: MIntBase,\n {\n #[inline]\n fn sum>(iter: I) -> Self {\n iter.fold(::zero(), Add::add)\n }\n }\n impl<'a, M: 'a> Product<&'a MInt> for MInt\n where\n M: MIntBase,\n {\n #[inline]\n fn product>(iter: I) -> Self {\n iter.fold(::one(), Mul::mul)\n }\n }\n impl Display for MInt\n where\n M: MIntConvert,\n M::Inner: Display,\n {\n fn fmt<'a>(&self, f: &mut fmt::Formatter<'a>) -> Result<(), fmt::Error> {\n write!(f, \"{}\", self.inner())\n }\n }\n impl FromStr for MInt\n where\n M: MIntConvert,\n M::Inner: FromStr,\n {\n type Err = ::Err;\n #[inline]\n fn from_str(s: &str) -> Result {\n s.parse::().map(Self::new)\n }\n }\n impl IterScan for MInt\n where\n M: MIntConvert,\n M::Inner: FromStr,\n {\n type Output = Self;\n #[inline]\n fn scan<'a, I: Iterator>(iter: &mut I) -> Option {\n iter.next()?.parse::>().ok()\n }\n }\n macro_rules! impl_mint_ref_binop {\n ($ imp : ident , $ method : ident , $ t : ty) => {\n impl $imp<$t> for &$t\n where\n M: MIntBase,\n {\n type Output = <$t as $imp<$t>>::Output;\n #[inline]\n fn $method(self, other: $t) -> <$t as $imp<$t>>::Output {\n $imp::$method(*self, other)\n }\n }\n impl $imp<&$t> for $t\n where\n M: MIntBase,\n {\n type Output = <$t as $imp<$t>>::Output;\n #[inline]\n fn $method(self, other: &$t) -> <$t as $imp<$t>>::Output {\n $imp::$method(self, *other)\n }\n }\n impl $imp<&$t> for &$t\n where\n M: MIntBase,\n {\n type Output = <$t as $imp<$t>>::Output;\n #[inline]\n fn $method(self, other: &$t) -> <$t as $imp<$t>>::Output {\n $imp::$method(*self, *other)\n }\n }\n };\n }\n impl_mint_ref_binop!(Add, add, MInt);\n impl_mint_ref_binop!(Sub, sub, MInt);\n impl_mint_ref_binop!(Mul, mul, MInt);\n impl_mint_ref_binop!(Div, div, MInt);\n macro_rules! impl_mint_ref_unop {\n ($ imp : ident , $ method : ident , $ t : ty) => {\n impl $imp for &$t\n where\n M: MIntBase,\n {\n type Output = <$t as $imp>::Output;\n #[inline]\n fn $method(self) -> <$t as $imp>::Output {\n $imp::$method(*self)\n }\n }\n };\n }\n impl_mint_ref_unop!(Neg, neg, MInt);\n macro_rules! impl_mint_ref_op_assign {\n ($ imp : ident , $ method : ident , $ t : ty , $ fromimp : ident , $ frommethod : ident) => {\n impl $imp<$t> for $t\n where\n M: MIntBase,\n {\n #[inline]\n fn $method(&mut self, rhs: $t) {\n *self = $fromimp::$frommethod(*self, rhs);\n }\n }\n impl $imp<&$t> for $t\n where\n M: MIntBase,\n {\n #[inline]\n fn $method(&mut self, other: &$t) {\n $imp::$method(self, *other);\n }\n }\n };\n }\n impl_mint_ref_op_assign!(AddAssign, add_assign, MInt, Add, add);\n impl_mint_ref_op_assign!(SubAssign, sub_assign, MInt, Sub, sub);\n impl_mint_ref_op_assign!(MulAssign, mul_assign, MInt, Mul, mul);\n impl_mint_ref_op_assign!(DivAssign, div_assign, MInt, Div, div);\n}\n// codesnip-guard: zero_one\npub trait Zero: PartialEq + Sized {\n fn zero() -> Self;\n #[inline]\n fn is_zero(&self) -> bool {\n self == &Self::zero()\n }\n}\npub trait One: PartialEq + Sized {\n fn one() -> Self;\n #[inline]\n fn is_one(&self) -> bool {\n self == &Self::one()\n }\n}\nmacro_rules ! zero_one_impls { ($ ({ $ Trait : ident $ method : ident $ ($ t : ty) *, $ e : expr }) *) => { $ ($ (impl $ Trait for $ t { # [inline] fn $ method () -> Self { $ e } }) *) * } ; }\nzero_one_impls ! ({ Zero zero u8 u16 u32 u64 usize i8 i16 i32 i64 isize u128 i128 , 0 } { Zero zero f32 f64 , 0. } { One one u8 u16 u32 u64 usize i8 i16 i32 i64 isize u128 i128 , 1 } { One one f32 f64 , 1. });\n// codesnip-guard: Matrix\n#[derive(Clone, Debug, PartialEq, Eq)]\npub struct Matrix {\n pub shape: (usize, usize),\n pub data: Vec>,\n}\nmod matrix_impls {\n use super::*;\n use std::ops::{Add, Div, Index, IndexMut, Mul, Sub};\n impl Matrix {\n pub fn new(shape: (usize, usize), z: T) -> Self {\n Self {\n shape,\n data: vec![vec![z; shape.1]; shape.0],\n }\n }\n }\n impl Matrix {\n pub fn from_vec(data: Vec>) -> Self {\n Self {\n shape: (data.len(), data.first().map(Vec::len).unwrap_or_default()),\n data,\n }\n }\n }\n impl Matrix {\n pub fn zeros(shape: (usize, usize)) -> Self {\n Self {\n shape,\n data: vec![vec![Zero::zero(); shape.1]; shape.0],\n }\n }\n }\n impl Matrix {\n pub fn eye(shape: (usize, usize)) -> Self {\n let mut data = vec![vec![Zero::zero(); shape.1]; shape.0];\n for (i, d) in data.iter_mut().enumerate() {\n d[i] = One::one();\n }\n Self { shape, data }\n }\n }\n impl Index for Matrix {\n type Output = Vec;\n fn index(&self, index: usize) -> &Self::Output {\n &self.data[index]\n }\n }\n impl IndexMut for Matrix {\n fn index_mut(&mut self, index: usize) -> &mut Self::Output {\n &mut self.data[index]\n }\n }\n impl Index<(usize, usize)> for Matrix {\n type Output = T;\n fn index(&self, index: (usize, usize)) -> &Self::Output {\n &self.data[index.0][index.1]\n }\n }\n impl IndexMut<(usize, usize)> for Matrix {\n fn index_mut(&mut self, index: (usize, usize)) -> &mut Self::Output {\n &mut self.data[index.0][index.1]\n }\n }\n impl<'a, T: Copy + Zero + Add> Add for &'a Matrix {\n type Output = Matrix;\n fn add(self, rhs: Self) -> Self::Output {\n assert_eq!(self.shape, rhs.shape);\n let mut res = Matrix::zeros(self.shape);\n for i in 0..self.shape.0 {\n for j in 0..self.shape.1 {\n res[i][j] = self[i][j] + rhs[i][j];\n }\n }\n res\n }\n }\n impl<'a, T: Copy + Zero + Sub> Sub for &'a Matrix {\n type Output = Matrix;\n fn sub(self, rhs: Self) -> Self::Output {\n assert_eq!(self.shape, rhs.shape);\n let mut res = Matrix::zeros(self.shape);\n for i in 0..self.shape.0 {\n for j in 0..self.shape.1 {\n res[i][j] = self[i][j] - rhs[i][j];\n }\n }\n res\n }\n }\n impl<'a, T: Copy + Zero + Add + Mul> Mul for &'a Matrix {\n type Output = Matrix;\n fn mul(self, rhs: Self) -> Self::Output {\n assert_eq!(self.shape.1, rhs.shape.0);\n let mut res = Matrix::zeros((self.shape.0, rhs.shape.1));\n for i in 0..self.shape.0 {\n for j in 0..rhs.shape.1 {\n for k in 0..self.shape.1 {\n res[i][j] = res[i][j] + self[i][k] * rhs[k][j];\n }\n }\n }\n res\n }\n }\n impl + Mul> Matrix {\n pub fn pow(&self, mut n: usize) -> Self {\n assert_eq!(self.shape.0, self.shape.1);\n let mut x = self.clone();\n let mut res = Matrix::eye(self.shape);\n while n > 0 {\n if n & 1 == 1 {\n res = &res * &x;\n }\n x = &x * &x;\n n >>= 1;\n }\n res\n }\n }\n impl + Mul + Div> Matrix {\n pub fn row_reduction(&mut self) {\n let (n, m) = self.shape;\n let mut c = 0;\n for r in 0..n {\n loop {\n if c >= m {\n return;\n }\n if let Some(pivot) = (r..n).find(|&p| !self[p][c].is_zero()) {\n self.data.swap(r, pivot);\n break;\n };\n c += 1;\n }\n let d = T::one() / self[r][c];\n for j in c..m {\n self[r][j] = self[r][j] * d;\n }\n for i in (0..n).filter(|&i| i != r) {\n let d = self[i][c];\n for j in c..m {\n self[i][j] = self[i][j] - d * self[r][j];\n }\n }\n c += 1;\n }\n }\n pub fn rank(&mut self) -> usize {\n let n = self.shape.0;\n self.row_reduction();\n (0..n)\n .filter(|&i| !self.data[i].iter().all(|x| x.is_zero()))\n .count()\n }\n pub fn solve_system_of_linear_equations(&self, b: &[T]) -> Option> {\n assert_eq!(self.shape.0, self.shape.1);\n assert_eq!(self.shape.0, b.len());\n let n = self.shape.0;\n let mut c = Matrix::::zeros((n, n + 1));\n for i in 0..n {\n c[i][..n].clone_from_slice(&self[i]);\n c[i][n] = b[i];\n }\n c.row_reduction();\n if (0..n).any(|i| c[i][i].is_zero()) {\n None\n } else {\n Some((0..n).map(|i| c[i][n]).collect::>())\n }\n }\n pub fn inverse(&self) -> Option> {\n assert_eq!(self.shape.0, self.shape.1);\n let n = self.shape.0;\n let mut c = Matrix::::zeros((n, n * 2));\n for i in 0..n {\n c[i][..n].clone_from_slice(&self[i]);\n c[i][n + i] = T::one();\n }\n c.row_reduction();\n if (0..n).any(|i| c[i][i].is_zero()) {\n None\n } else {\n Some(Self::from_vec(\n c.data.into_iter().map(|r| r[n..].to_vec()).collect(),\n ))\n }\n }\n }\n}\n", "lang": "Rust", "bug_code_uid": "0a738c51695e754ea24cb14936527e45", "src_uid": "711d15e11016d0164fb2b0c3756e4857", "apr_id": "feab7fd0f1e3345ccf3723f9b5004086", "difficulty": 2700, "tags": ["dp", "matrices", "data structures", "string suffix structures", "brute force", "strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.7623554153522608, "equal_cnt": 10, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "//spnauti-rusT {{{\n#[allow(unused_imports)]use std::{io::*,collections::*,fmt::Debug,str::{self,*},cmp::*,ops::{self,*},iter::{self,*}};\nmacro_rules!v{\n\t($(:$t:ty)?=$e:expr)=>{$e$(as$t)?};([$d:expr]$(:$t:ty)?)=>{Vec::$(<$t>::)?with_capacity($d)};\n\t([]$(:$t:ty)?)=>{Vec::$(<$t>::)?new()};([$d:expr]$($s:tt)+)=>{vec![v!($($s)+);$d]};}\nfn rio()->(Reader,BufWriter){(Reader::new(),BufWriter::new(stdout()))}\nstruct Reader{buf:Vec,pos:usize,x:*mut Stdin,q:StdinLock<'static>}//'\n#[allow(dead_code)]impl Reader{\n\tfn new()->Self{let x=Box::into_raw(Box::new(stdin()));let q=unsafe{&*x}.lock();Self{x,q,buf:v!([]),pos:0}}\n\tfn next_line(&mut self)->bool{self.buf.clear();self.pos=0;self.q.read_until(b'\\n',&mut self.buf).unwrap_or(0)>0}\n\tfn byte(&mut self)->Option{\n\t\tif self.pos==self.buf.len(){if!self.next_line(){return None;}}self.pos+=1;Some(self.buf[self.pos-1])}\n\tfn vb(&mut self)->Vec{let mut s=v!([10]);let mut f=false;while let Some(c)=self.byte(){\n\t\tif!c.is_ascii_whitespace(){s.push(c);f=true;}else if f{break;}}s}\n\tfn p(&mut self)->T where T::Err:Debug{let w=self.vb();str::from_utf8(w.as_ref()).unwrap().parse::().unwrap()}\n\tfn u(&mut self) -> usize { self.p() }\n\tfn f(&mut self) -> f64 { self.p() }\n}impl Drop for Reader{fn drop(&mut self){unsafe{Box::from_raw(self.x)};}}\n//----------}}}\n\nfn main() {\n\tlet (mut rin,mut rout) = rio();\n\n\tlet n = rin.u();\n\tlet p = rin.f();\n\tlet nn = n as f64;\n\tfor x in 0..n {\n\t\tlet xx = x as f64;\n\t\tlet res = xx/nn*(xx-1.0)/(nn-2.0) + (nn-1.0-xx)/nn*xx/(nn-2.0) + 1.0/nn*xx/(nn-1.0);\n\t\tif res + 1e-9 > p {\n\t\t\twriteln!(rout, \"{}\", x).unwrap();\n\t\t\treturn;\n\t\t}\n\t}\n}\n", "lang": "Rust", "bug_code_uid": "b6f0d13d186f8055e8eb56ef0546f236", "src_uid": "788ed59a964264bd0e755e155a37e14d", "apr_id": "174d39c78101ddf5e0ebdb458672c5d5", "difficulty": 2000, "tags": ["probabilities", "math", "combinatorics", "ternary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9850046860356139, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "//spnauti-rusT {{{\n#[allow(unused_imports)]use std::{io::*,collections::*,fmt::Debug,str::{self,*},cmp::*,ops::{self,*},iter::{self,*}};\nmacro_rules!v{\n\t($(:$t:ty)?=$e:expr)=>{$e$(as$t)?};([$d:expr]$(:$t:ty)?)=>{Vec::$(<$t>::)?with_capacity($d)};\n\t([]$(:$t:ty)?)=>{Vec::$(<$t>::)?new()};([$d:expr]$($s:tt)+)=>{vec![v!($($s)+);$d]};}\nfn rio()->(Reader,BufWriter){(Reader::new(),BufWriter::new(stdout()))}\nstruct Reader{buf:Vec,pos:usize,x:*mut Stdin,q:StdinLock<'static>}//'\n#[allow(dead_code)]impl Reader{\n\tfn new()->Self{let x=Box::into_raw(Box::new(stdin()));let q=unsafe{&*x}.lock();Self{x,q,buf:v!([]),pos:0}}\n\tfn next_line(&mut self)->bool{self.buf.clear();self.pos=0;self.q.read_until(b'\\n',&mut self.buf).unwrap_or(0)>0}\n\tfn byte(&mut self)->Option{\n\t\tif self.pos==self.buf.len(){if!self.next_line(){return None;}}self.pos+=1;Some(self.buf[self.pos-1])}\n\tfn vb(&mut self)->Vec{let mut s=v!([10]);let mut f=false;while let Some(c)=self.byte(){\n\t\tif!c.is_ascii_whitespace(){s.push(c);f=true;}else if f{break;}}s}\n\tfn p(&mut self)->T where T::Err:Debug{let w=self.vb();str::from_utf8(w.as_ref()).unwrap().parse::().unwrap()}\n\tfn u(&mut self) -> usize { self.p() }\n\tfn f(&mut self) -> f64 { self.p() }\n}impl Drop for Reader{fn drop(&mut self){unsafe{Box::from_raw(self.x)};}}\n//----------}}}\n\nfn main() {\n\tlet (mut rin,mut rout) = rio();\n\n\tlet n = rin.u();\n\tlet p = rin.f();\n\tlet mut lo = 0;\n\tlet mut hi = n-2;\n\tlet mut ans = n - 1;\n\twhile lo <= hi {\n\t\tlet x = (lo + hi) / 2;\n\t\tlet mut res = 0.0;\n\t\tlet mut c = 0;\n\t\tfor i in 0..=3 {\n\t\t\tlet j = 3 - i;\n\t\t\tif i > x || j > n-x {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tlet cc = if i == 0 {\n\t\t\t\t(n-x) * (n-x-1) * (n-x-2) / 6\n\t\t\t} else if i == 1 {\n\t\t\t\tx * (n-x) * (n-x-1) / 2\n\t\t\t} else if i == 2 {\n\t\t\t\tx * (x-1) * (n-x) / 2\n\t\t\t} else {\n\t\t\t\tx * (x-1) * (x-2) / 6\n\t\t\t};\n\t\t\tlet pp = if i == 0 {\n\t\t\t\t0.0\n\t\t\t} else if i == 1 {\n\t\t\t\t0.5\n\t\t\t} else {\n\t\t\t\t1.0\n\t\t\t};\n\t\t\tres += pp * (cc as f64);\n\t\t\tc += cc;\n\t\t}\n\t\tres /= c as f64;\n\t\tif res + 1e-9 > p {\n\t\t\tans = x;\n\t\t\thi = x-1;\n\t\t} else {\n\t\t\tlo = x+1;\n\t\t}\n\t}\n\twriteln!(rout, \"{}\", ans).unwrap();\n}\n", "lang": "Rust", "bug_code_uid": "a384ab27806681f728f006307d2fe2ce", "src_uid": "788ed59a964264bd0e755e155a37e14d", "apr_id": "174d39c78101ddf5e0ebdb458672c5d5", "difficulty": 2000, "tags": ["probabilities", "math", "combinatorics", "ternary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Rust"} {"similarity_score": 0.9636963696369637, "equal_cnt": 9, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 8, "bug_source_code": "use std::str::FromStr;\r\nuse std::io;\r\n\r\nfn read_line() -> Vec\r\n where\r\n T::Err: std::fmt::Debug\r\n{\r\n let mut input = String::new();\r\n io::stdin().read_line(&mut input).unwrap();\r\n input.trim()\r\n .split(' ')\r\n .map(|x| x.parse::().unwrap())\r\n .collect()\r\n}\r\n\r\nfn c(n: i64, k: i64) -> i64 {\r\n if k > n {\r\n return 0;\r\n }\r\n let mut result = 1;\r\n if k > n - k {\r\n for i in k + 1..n + 1 {\r\n result *= i;\r\n }\r\n for i in 1..n - k + 1 {\r\n result /= i;\r\n }\r\n }\r\n if k <= n - k {\r\n for i in n - k + 1..n + 1 {\r\n result *= i;\r\n }\r\n for i in 1..k + 1 {\r\n result /= i;\r\n }\r\n }\r\n return result;\r\n}\r\n\r\nfn main() {\r\n let input = read_line::();\r\n let n = input[0].parse::().unwrap();\r\n let p = input[1].parse::().unwrap();\r\n let p_int = (p * 10000.0).round() as i64;\r\n for k in 0..n + 1 {\r\n let numerator = 3 * (c(k, 3) + c(k, 2) * c(n - k, 1)) + c(k, 1) * c(n - k, 2) * 2;\r\n if numerator * 10000 >= p_int * 3 * c(n, 3) {\r\n println!(\"{}\", k);\r\n return\r\n }\r\n }\r\n}\r\n", "lang": "Rust", "bug_code_uid": "53ccf4630e5374b70f69043c39765378", "src_uid": "788ed59a964264bd0e755e155a37e14d", "apr_id": "34fbf83a7a3f3e1fa6ad96441f017820", "difficulty": 2000, "tags": ["probabilities", "math", "combinatorics", "ternary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Rust"}