Generally for use in competitive programming
Include debug.h
:
#include "debug.h"
And just call dbg
function with variables which you want to print:
dbg(var1, var2, ...);
And you will get nice colored output! (See gallery and examples sections below)
- primitives (int, char and so on)
- strings
- vectors
- pairs
- sets
- maps
- all nested combinations of above types are supported too!
-
Simple
int foo = 1; int bar = 2; string str = "abc"; char ch = '#'; dbg(foo, bar, str, ch);
-
Vector
vector<int> simpleVector = {1, 2, 3}; dbg(simpleVector);
-
Map
map<int, int> simpleMap = {{1, 10}, {2, 20}}; dbg(simpleMap);
-
Pair
pair<int, int> simplePair = {1, 2}; dbg(simplePair);
-
Inner vector
vector<vector<int>> innerVector = {{1, 2, 3}, {4, 5, 6}}; dbg(innerVector);