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> | |
#define all(x) begin(x),end(x) | |
#define rall(x) (x).rbegin(),(x).rend() | |
#define REP(i,b,n) for(int i=(int)(b);i<(int)(n);++i) | |
#define rep(i,n) REP(i,0,n) | |
#define repsz(i,v) rep(i,(v).size()) | |
#define aur auto& | |
#define bit(n) (1LL<<(n)) | |
#define eb emplace_back | |
#define mt make_tuple |
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
// https://codeiq.jp/ace/kawazoe/q1339 | |
#include <iostream> | |
#include <vector> | |
long long k_bonacci(const int &k, const int &n){ | |
std::vector<long long> v(k, 0); | |
long long res = v.back() = 1; | |
for(int i = 0; i < n; ++i) std::swap(v[i%k] = res * 2 - v[i%k], res); | |
return res; | |
} | |
int main(){ |
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; | |
template<typename Res, typename ...Args> struct _memoized{//{{{ | |
function<Res(Args...)> f; | |
map<tuple<Args...>, Res> memo; | |
_memoized(function<Res(Args...)> &f) : f(f){} | |
Res operator()(Args ...args){ | |
const auto &key = make_tuple(args...); |
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; | |
typedef complex<int> P; | |
struct adjacent{ | |
P p; | |
adjacent(const P &p) : p(p){} | |
template<typename ...Args> adjacent(const Args &...args) : p(args...){} | |
struct Iter : public forward_iterator_tag { |
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
肩慣らし | |
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0021 | |
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0012 | |
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0081 | |
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0079 | |
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1100 | |
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0023 | |
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0153 | |
ライブラリを作ろう/アドホックなのもてきとーに出来るようになろう |
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; | |
int m_a_i_n(int, char **); | |
int main(int argc, char *argv[]){ | |
return m_a_i_n(argc, argv); | |
} | |
#define GET3(_1, _2, _3, NAME, ...) NAME | |
#define main(...) GET3(, ##__VA_ARGS__, m_a_i_n(__VA_ARGS__), m_a_i_n(int _argc, char *_argv[]), m_a_i_n(int _argc, char *_argv[])) |
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
template<typename T> inline void read(T &x){assert(false);} | |
template<> inline void read<int>(int &x){scanf("%d ",&x);} | |
template<> inline void read<ll>(ll &x){scanf("%lld ",&x);} | |
// template<> inline void read<ll>(ll &x){scanf("%I64d ",&x);} | |
template<typename Arg, typename Arg2, typename ...Args> | |
inline void read(Arg &x, Arg2 &y, Args& ...z){ | |
read<Arg>(x); read<Arg2, Args...>(y, z...); | |
} |
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
#!/usr/bin/env ruby | |
require 'pry' | |
require 'pry-nav' | |
require 'simple-random' | |
$bind = false | |
Signal.trap(:SIGUSR1) do | |
$bind = true | |
end | |
def bind! |
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; | |
template<typename T, size_t n> | |
struct Vec{ | |
typedef vector<typename Vec<T, n-1>::V> V; | |
static V init(const T &x, initializer_list<size_t>::iterator it){ | |
const size_t s = *it; | |
return V(s, Vec<T, n-1>::init(x, ++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 <bits/stdc++.h> | |
#define rep(i, n) for(int i = 0; i < (n); ++i) | |
#define sz(v) ((int)(v).size()) | |
#define repsz(i, v) rep(i, sz(v)) | |
#define eb emplace_back | |
#define pb push_back | |
#define mt make_tuple | |
#define mp make_pair | |
#define cauto const auto & | |
#define all(v) (v).begin(), (v).end() |