平成の宰相たちを読みながらのメモ

安倍晋三(2) 大阪維新の会との連携して保守を再生する アベノミクス 金融政策、財政政策、構造改革 金融緩和:日銀が資金供給料をふやしたり政策金利?を引き下げたりすること 日銀が国債を購入ー>国債の信用低下ー>価格の下落ー>長期金利の高騰?ー>…

fixstarsの組合せ最適化問題のイジング模型定式化のメモ

数の分割 問題:正の数の集合を2つに分けて、それぞれの和を等しくできるか。 グラフ分割 問題:無向グラフをノード数が等しくなるように2つに分け、その間のリンク数が最小になるようにしたい。 クリーク判定 問題:無向グラフに大きさKのクリークがある…

推薦システム

1.2 CTRを最大化したい推薦のときに、単純に平均値の推定だけを考えると、アイテムごとの推定CTRの分散の違いを無視することになる。 例:CTRのオフライン推定値はアイテム1に比べ2が小さいが、実際のCTRは2の方が大きいことがあり、これは2の推定CTRの…

Computing expectation value of full LQG Hamiltonian to next-to-leading order

http://relativity.phys.lsu.edu/ilqgs/ 背景 問題点 目的 ハミルトニアンの Thiemann coherent stateに対する期待値のO(hbar) 補正を計算する 方針 手法 (アイデア) 数値計算 高速化のために、 higher order に寄与する項を無視 繰り返しをへらす 結果と考…

Cheatsheat for programming competition

IN JAPANESE https://www.qoosky.io/techs/5cd1a59497

Count a substring in a string

cin >> s; found = s.find("AB"); while(found != string::npos){ cnt++; found = s.find("AB", found+1); }

Sum of divisors of an integer (~sqrt(N))

int main() { long n; cin >> n; long result = 0; for (long i=2; i<=sqrt(n); i++) { if (n%i==0) { if (i==(n/i)) result += i; else result += (i + n/i); } } cout << result << endl; }

invalid instruction mnemonic 'movzb'

I encountered this error in trying to implement comparative operator in my compiler. The error was solved by replacing "movzb" with "movzx".

Generative Grammer

program: stmt program program: ε stmt: "return" assign ";" stmt: assign ";" assign: equality assign: equality "=" assign equality: relational equality: equality "==" relational equality: equality "!=" relational relational: add relational:…

Union-Find Tree

c++

#include<vector> struct Unionfind { vector<int> par, rank, size; Unionfind(int n) : par(n), rank(n), size(n){ for(int i=0;i</int></vector>

Pagination on GAE python with webapp

I don't know how to deal with session with webapp. So I just add all past stacks as a string with delimiter /, and pass it to the template. test.py cursors = self.request.get('cursors') if cursors: list_cursors = cursors.split('/') query.w…

ifdef & ifndef in C++

link (in Japanese) ifndef

How to Find Google Calendar ID

Googleカレンダーで各カレンダーのカレンダーIDを知る方法 | スキコミ

pickle: save & load file

from pickle import dump # save with open('sample.pickle', mode='wb') as f: pickle.dump('Hello, World!', f) #load with open('sample.pickle', mode='rb') as f: pickle.load(f) Thanks to this blog (in Japanese) Python: オブジェクトを漬物 (Pickl…

OAuth2 Credentials Flow on GAE with google-auth

Since oauth2client library seems to be deprecated, OAuth2 credentials flow should be written with google-auth library recommended. from flask import redirect, session, url_for def credentials_to_dict(credentials): return { 'token': credent…

Configure crons for multiple services on Google App Engine

Run Oauth2 Flow inside API urlfetched or Cron Jobs

Swap variables without temporary variables

Normally, variables can be swapped with temporary variables. tmp = a a = b b = tmp In Python, with a tuple, a, b = b, a