Skip to content

Instantly share code, notes, and snippets.

@tuhdo
tuhdo / dataset_generator.py
Last active September 16, 2023 00:45
Let DecisionTreeRegressor learn how to perform addition and multiplication
import csv
# Create and open the CSV file for writing
def gen_dataset(fname, op):
start = 1
end = 500
with open(fname, mode='w', newline='') as csv_file:
csv_writer = csv.writer(csv_file, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)

C bit hacks

Related:

Index

Bit Twiddling Hacks

#include <bits/stdc++.h>
using namespace std;
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
typedef unsigned long long u64;
typedef char i8;
typedef short i16;
@tuhdo
tuhdo / 0_reuse_code.js
Created June 7, 2017 08:57
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@tuhdo
tuhdo / 11503.cpp
Created May 25, 2017 03:20
My solution for uva11503
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
#define fastio do {std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);} while(0)
/************************/
/* VARIABLE DECLARATION */
/************************/
#define MAX 100005
1
42
3 1 19
13 1 34
18 2 89
21 3 94
23 4 59
1 5 38
34 6 75
37 7 33
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
// Useful constants
#define INF (int)1e9
typedef pair<int, int> pii;
"C:\Program Files\emacs\bin\emacsclientw.exe" -n -e "(make-frame)"
In a Git repository:
git fetch origin pull/942/head && git checkout FETCH_HEAD
942 is the ID of this PR.