This file contains hidden or 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 <bits/stdc++.h> | |
using namespace std; | |
#define rep(i, n) for(int i = 0; i < (n); ++i) | |
#define REP(i, b, n) for(int i = (b); i < (n); ++i) | |
#define let(v, x) __typeof(x) v = (x) | |
#define foreach(i,v) for(let(i, (v).begin());i!=(v).end();i++) | |
/** | |
* 割とどうしてくれてもいいけど, 理解 && バグ潰ししてから使うべきです. | |
* |
This file contains hidden or 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 <bits/stdc++.h> | |
using namespace std; | |
#define rep(i, n) for(int i = 0; i < (n); ++i) | |
#define REP(i, b, n) for(int i = (b); i < (n); ++i) | |
#define let(v, x) __typeof(x) v = (x) | |
#define foreach(i,v) for(let(i, (v).begin());i!=(v).end();i++) | |
/** | |
* 割とどうしてくれてもいいけど, 理解 && バグ潰ししてから使うべきです. | |
* |
This file contains hidden or 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 <bits/stdc++.h> | |
using namespace std; | |
#define rep(i, n) for(int i = 0; i < (n); ++i) | |
#define REP(i, b, n) for(int i = (b); i < (n); ++i) | |
#define let(v, x) __typeof(x) v = (x) | |
#define foreach(i,v) for(let(i, (v).begin());i!=(v).end();i++) | |
/** | |
* 割とどうしてくれてもいいけど, 理解 && バグ潰ししてから使うべきです. | |
* |
This file contains hidden or 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 <string> | |
#include <vector> | |
#include <deque> | |
#include <stack> | |
#include <queue> | |
#include <set> | |
#include <map> | |
#include <list> | |
#include <bitset> |
This file contains hidden or 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 let(v, x) __typeof(x) v = (x) | |
#define foreach(i,v) for(let(i, (v).begin());i!=(v).end();++i) | |
using namespace std; | |
template<typename T> struct wrap_itr //{{{ | |
: public iterator<bidirectional_iterator_tag, T>{ | |
typedef wrap_itr<T> It; |
This file contains hidden or 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 <string> | |
#include <vector> | |
#include <deque> | |
#include <stack> | |
#include <queue> | |
#include <set> | |
#include <map> | |
#include <list> | |
#include <bitset> |
This file contains hidden or 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
double sum(vector<double> in) { //SNIPLATE_SUM | |
double res = 0; | |
for(int i = 0; i < in.size(); ++i) { | |
res += in[i]; | |
} | |
return res; | |
} | |
double variance_s(vector<double> in) { | |
double avg = average(in); | |
for(int i = 0; i < in.size(); ++i) { |
This file contains hidden or 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> | |
#include <cassert> | |
using namespace std; | |
//BEGIN SNIPLATE sum | |
//{{abbr: sum for vector<double>}} | |
//{{class: util, statistics}} | |
//{{pattern: SNIPLATE_SUM}} | |
double sum(vector<double> in) { //SNIPLATE_SUM |
This file contains hidden or 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> | |
typedef long long ll; | |
using namespace std; | |
const int MOD = (int)(1E9+7); | |
struct MOD_INT{//{{{ | |
int x; | |
MOD_INT(const int &x=0): x((x%MOD+MOD)%MOD){} | |
MOD_INT(const ll &x=0): x((x%MOD+MOD)%MOD){} | |
MOD_INT(const MOD_INT &o): x(o.x){} |
This file contains hidden or 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
p Hash.new{|hash, n| | |
hash[n] = n.zero? ? 1 : n < 0 ? 0 : (1..4).map{|i|hash[n-i]}.inject(&:+) | |
}[50] | |
#=> 100808458960497 |