Skip to content

Instantly share code, notes, and snippets.

@acadavid
Created October 11, 2011 22:17
Show Gist options
  • Save acadavid/1279628 to your computer and use it in GitHub Desktop.
Save acadavid/1279628 to your computer and use it in GitHub Desktop.
C++ Template
using namespace std;
#include <algorithm>
#include <iostream>
#include <iterator>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
template <class T> string toStr(const T &x)
{ stringstream s; s << x; return s.str(); }
template <class T> int toInt(const T &x)
{ stringstream s; s << x; int r; s >> r; return r; }
#define For(i, a, b) for (int i=(a); i<(b); ++i)
#define foreach(x, v) for (typeof (v).begin() x = (v).begin(); \
x != (v).end(); ++x)
#define D(x) cout << #x " = " << (x) << endl
const double EPS = 1e-9;
int cmp(double x, double y = 0, double tol = EPS){
return( x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}
#define INPUT_FILE "problemname"
int main(){
freopen(INPUT_FILE ".in", "r", stdin); // Read from file
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment