Skip to content

Instantly share code, notes, and snippets.

@kapillamba4
Last active July 21, 2018 17:31
Show Gist options
  • Save kapillamba4/db13929c6c0bcb9a69f8c8fd9d6b3414 to your computer and use it in GitHub Desktop.
Save kapillamba4/db13929c6c0bcb9a69f8c8fd9d6b3414 to your computer and use it in GitHub Desktop.
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef long double LD;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define sortAndUnique(a) sort((a).begin(), a.end()), (a).erase(unique((a).begin(), (a).end()),(a).end())
double tick() {
static clock_t oldticks;
clock_t newticks = clock();
double diff = 1.0 * (newticks - oldticks) / CLOCKS_PER_SEC;
oldticks = newticks;
return diff;
}
#define DEBUG
#ifdef DEBUG
#define debug(args...) (Debugger()) , args
class Debugger
{
public:
Debugger(const std::string& _separator = " - ") :
first(true), separator(_separator){}
template<typename ObjectType> Debugger& operator , (const ObjectType& v)
{
if(!first)
std:cerr << separator;
std::cerr << v;
first = false;
return *this;
}
~Debugger() { std:cerr << endl;}
private:
bool first;
std::string separator;
};
#else
#define debug(args...) // Just strip off all debug tokens
#endif
int main(void) {
cerr << tick(); //Prints execution time on error screen
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment