Skip to content

Instantly share code, notes, and snippets.

View tenmyo's full-sized avatar

TENMYO Masakazu tenmyo

  • Japan
  • 18:27 (UTC +09:00)
View GitHub Profile
@tenmyo
tenmyo / initializer.c
Created December 21, 2016 06:11
Initializer/finalizer sample for MSVC and GCC/Clang.
// c - __attribute__((constructor)) equivalent in VC? - Stack Overflow
// http://stackoverflow.com/questions/1113409/attribute-constructor-equivalent-in-vc/2390626#2390626
// Rev.5
// Initializer/finalizer sample for MSVC and GCC/Clang.
// 2010-2016 Joe Lowe. Released into the public domain.
#include <stdio.h>
#include <stdlib.h>
#ifdef __cplusplus
@tenmyo
tenmyo / initializer.c
Last active December 21, 2016 07:18
C言語でマルチプラットフォーム対応のコンストラクタ処理(MSVCでの__attribute__((constructor))相当など) ref: http://qiita.com/tenmyo/items/c3dd91af04d10d185a9a
// Initializer/finalizer sample for MSVC and GCC/Clang.
// 2010-2016 Joe Lowe. Released into the public domain.
#include <stdio.h>
#include <stdlib.h>
#ifdef __cplusplus
#define INITIALIZER(f) \
static void f(void); \
struct f##_t_ { f##_t_(void) { f(); } }; static f##_t_ f##_; \
static void f(void)
@tenmyo
tenmyo / AtCoder_template.py
Last active March 27, 2021 15:43
Templates for AtCoder
from collections import defaultdict as dd
from collections import Counter
from pprint import pprint as pp
def nopp(*args): pass
pp = nopp # comment out this line for debugging
YN = {True: 'Yes', False: 'No'}
ri = lambda: int(input())
ria = lambda: list(map(int, input().split()))
rian = lambda n: [ria() for _ in range(n)]