Skip to content

Instantly share code, notes, and snippets.

View orisano's full-sized avatar

Nao Yonashiro orisano

View GitHub Profile
#include <iostream>
using namespace std;
template<typename T>
inline T in(){ T x; cin >> x; return x; }
int main(){
const int x = in<int>();
const double y = in<double>();
@orisano
orisano / yosupo.js
Last active August 29, 2015 14:21
問題ページでソースコードをデベロッパーコンソールに貼り付けると、雑なフォームが出来上がります
(function(global){
var $comment_form, $chat_form, $user_id, $token, $comment, $text, $comment_submit, $chat_submit, $section;
var doc = global["document"];
function create_input(type, name, value){
var $dom = doc.createElement("input");
$dom.type = type;
$dom.name = name;
$dom.value = value;
#include <cstdint>
#include <cstdio>
#include <cstring>
namespace rh {
namespace consts {
const char *RISE_SAN = "rise-san";
const int RISE_SAN_LEN = std::strlen(RISE_SAN);
const char *COCOA_SAN = "cocoa-san";
const int COCOA_SAN_LEN = std::strlen(COCOA_SAN);
const char *CHINO_CHAN = "chino-chan";
// {{{ orliv::misc::PostScript
#ifndef INCLUDE_POST_SCRIPT_HPP
#define INCLUDE_POST_SCRIPT_HPP
#include <algorithm>
#include <cassert>
#include <complex>
#include <fstream>
#include <string>
#include <vector>
@orisano
orisano / ad.hpp
Last active June 7, 2016 12:48
自動微分のクラス (http://kivantium.hateblo.jp/entry/2016/03/25/010320 のパクリ)
// {{{ orliv::math::AD<T>
#ifndef INCLUDE_AD_HPP
#define INCLUDE_AD_HPP
#include <cmath>
#include <type_traits>
namespace orliv {
namespace math {
template <typename T>
struct AD {
static_assert(std::is_arithmetic<T>::value, "template arguments must be arithmetic type");
#ifndef INCLUDE_BENCHMARK_HPP
#define INCLUDE_BENCHMARK_HPP
#include <chrono>
#include <cstdarg>
#include <cstdio>
#include <iostream>
struct __bench__ {
typedef std::chrono::time_point<std::chrono::system_clock> time_type;
time_type start;
char msg[128];
#include <cstdint>
static inline std::uint64_t rdtsc() {
std::uint32_t eax = 0, edx;
__asm__ __volatile__("cpuid;"
"rdtsc;"
: "+a"(eax), "=d"(edx)
:
: "%rcx", "%rbx", "memory");
__asm__ __volatile__("xorl %%eax, %%eax;"
"cpuid;"
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: true
AlignConsecutiveAssignments: false
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
# 入力
line = input() #=> str
tokens = input().split() #=> [str]
num = int(input()) #=> int
nums = [int(x) for x in input().split()] #=> [int]
A, B, C = [int(x) for x in input().split()] #=> int, int, int
# 出力
@orisano
orisano / isomorphic.cpp
Last active July 2, 2016 06:07
根付き木の同型性判定をするコード
#include <algorithm>
#include <iostream>
#include <sstream>
#include <vector>
using Tree = std::vector<std::vector<int>>;
struct RootedTree {
const Tree& tree;
const int root;
RootedTree(const Tree& tree, int root) : tree(tree), root(root) {}