Created
September 13, 2015 11:57
-
-
Save brly/690e3270cc78e5f47446 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <cstdlib> | |
#include <cstring> | |
#include <cmath> | |
#include <ctime> | |
#include <iostream> | |
#include <algorithm> | |
#include <sstream> | |
#include <string> | |
#include <vector> | |
#include <queue> | |
#include <stack> | |
#include <map> | |
#include <set> | |
#include <utility> | |
#include <cctype> | |
#include <numeric> | |
using namespace std; | |
#define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i)) | |
#define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++) | |
#define all(a) (a).begin(),(a).end() | |
template <typename T> | |
T modpow(T base, T exp, T modulus) { | |
base %= modulus; | |
T result = 1; | |
while (exp > 0) { | |
if (exp & 1) result = (result * base) % modulus; | |
base = (base * base) % modulus; | |
exp >>= 1; | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment