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
// {{{ $VIMCODER$ <-------- | |
// vim:filetype=cpp:foldmethod=marker:foldmarker={{{,}}} | |
#include <algorithm> | |
#include <vector> | |
#include <iostream> | |
#include <sstream> | |
#include <cmath> | |
#include <queue> | |
#include <unordered_map> | |
#include <numeric> |
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
//POJ 2139 | |
#include <iostream> | |
#include <vector> | |
using namespace std; | |
int main(){ | |
const int INF = 1e7; | |
ios_base::sync_with_stdio(0);cin.tie(0); | |
int n,m; | |
cin>>n>>m; | |
vector<vector<int> > d(n,vector<int>(n,INF)); |
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 <iostream> | |
#include <unordered_map> | |
using namespace std; | |
int main() { | |
string s; | |
cin>>s; | |
int m,maximum = 0,n = s.size(); | |
cin>>m; | |
unordered_map<char,int> a; | |
for (auto i = 'a'; i <= 'z'; i++) { |
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
// {{{ $VIMCODER$ <-------- | |
// vim:filetype=cpp:foldmethod=marker:foldmarker={{{,}}} | |
#include <algorithm> | |
#include <vector> | |
#include <iostream> | |
#include <sstream> | |
#include <cmath> | |
#include <queue> | |
#include <unordered_map> | |
#include <numeric> |
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 <iostream> | |
#include <vector> | |
using namespace std; | |
class union_find { | |
vector<int> par, rank; | |
public: | |
union_find(int n) { | |
par.resize(n); | |
rank.resize(n); | |
for (auto i = 0; i < n; i++) { |
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
//SRM 628 Div2 Med | |
#include <stack> | |
#include <sstream> | |
using namespace std; | |
class BracketExpressions { | |
public: | |
bool match(char a,char b) { | |
if(a == 'X' && (b == ')' || b == '}' || b == ']' || b == 'X')) return 1; | |
if(b == 'X' && (a == '(' || a == '{' || a == '[')) return 1; | |
if(string({a,b}) == "()" || string({a,b}) == "{}" || string({a,b}) == "[]") return 1; |
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 <iostream> | |
#define for _FOR_BROKEN=0;for | |
#define break {_FOR_BROKEN=1;break;} | |
#define ELSE if(!_FOR_BROKEN) | |
bool _FOR_BROKEN; | |
using namespace std; | |
int main() { | |
for (int i = 0; i < 10; i++) { | |
cout << i << endl; | |
if(i == 5) break; |
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 <iostream> | |
#include <algorithm> | |
#include <vector> | |
using namespace std; | |
constexpr int INF = 1e9; | |
class segtree { | |
vector<int> data; | |
int n = 1; | |
int query_(int a, int b, int k, int l, int r) { | |
if (b <= l || r <= a) return INF; |
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
//Typical DP contest A | |
#include <iostream> | |
#include <vector> | |
using namespace std; | |
int main() { | |
int n; | |
cin>>n; | |
vector<int> p(n); | |
for (auto& i : p) cin>>i; |
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 <iostream> | |
#include <utility> | |
using namespace std; | |
template<class T, T M> | |
class mods { | |
T v; | |
public: | |
mods() {} | |
mods(T v) : v(v%M) {} |