Skip to content

Instantly share code, notes, and snippets.

#include <iostream>
#include <utility>
#include <algorithm>
#include <vector>
int calc_bonus(int streak) {
if (streak == 2 || streak == 3) {
return 1;
} else if (streak == 4) {
return 2;
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
//1-indexed, var..maxnum
vector<int> SA_IS(vector<int> str, int var) {
if(str.size() == 1) {
vector<int> ret(1,0);
return ret;
}
@gasin
gasin / tco10
Created November 14, 2019 01:05
#pragma GCC optimize ("O3")
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <map>
#include <sstream>
#include <vector>
#include <set>
#include <string>
@gasin
gasin / huga
Last active November 12, 2019 23:58
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(int argc, char** argv) {
if (argc != 4) {
cerr << "arguments" << endl;
return 0;
}
int n = atoi(argv[1]);
@gasin
gasin / solution.cpp
Created February 22, 2018 02:26
MM98
// C++11
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
#include <string.h>
#include <random>
using namespace std;
@gasin
gasin / collatz.c
Created January 15, 2018 05:16
HW report
#include <stdio.h>
#include <time.h>
#include <unistd.h>
#include <stdint.h>
#include <intrin.h>
uint64_t rdtsc(){
return __rdtsc();
}
int name[4], a1[4], a2[4];
@gasin
gasin / mabling.pde
Last active December 3, 2017 11:10
code of processing to draw mabling images
import java.util.Random;
final int SIZE = 500;
int TIMER = 0;
int[][][] board = new int[SIZE][SIZE][3];
int[][][] buffer = new int[SIZE][SIZE][3];
boolean inside_board(int x, int y)
{
from __future__ import print_function
from PIL import Image
import copy
train = []
test = []
for loop in range(1,3):
train.append([])
im = Image.open(str(loop)+".png")
import time
time_start = time.time()
import numpy as np
import chainer
from chainer import cuda, Function, gradient_check, Variable, optimizers, serializers, utils
from chainer import Link, Chain, ChainList
import chainer.functions as F
import chainer.links as L
#include <cstdio>
#include <vector>
#include <cstring>
using namespace std;
#define MAX_N 1000
int n, m; //頂点数、辺数
int cmp[MAX_N*2]; //属する強連結成分のトポロジカル順序
vector<int> vs; //帰りがけ順の並び