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.

Revisions

  1. acadavid created this gist Oct 11, 2011.
    44 changes: 44 additions & 0 deletions template.cpp
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,44 @@
    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;
    }