Skip to content

Instantly share code, notes, and snippets.

View izanbf1803's full-sized avatar

Izan Beltran izanbf1803

View GitHub Profile
#include <vector>
#include <iostream>
using namespace std;
const int abc_size = 26;
int main()
{
vector<int> lval(abc_size);
#include <iostream>
#include <vector>
using namespace std;
bool less_than(
const string& a,
int ai,
int bi,
int size
#include <vector>
#include <iostream>
using namespace std;
const int _1e6 = 1000000;
void print(const vector<vector<int> >& lines) {
cout << endl;
for (int i = 0; i < lines.size(); i++) {
@izanbf1803
izanbf1803 / musical_notes.h
Created May 23, 2017 09:02
All musical notes to frequency
#define Do0 16
#define Do_0 17
#define Re0 18
#define Re_0 19
#define Mi0 20
#define Fa0 21
#define Fa_0 23
#define Sol0 24
#define Sol_0 25
#define La0 27
@izanbf1803
izanbf1803 / install-opencv.sh
Created July 25, 2017 14:48
Install OpenCV in Linux with one script.
# Source: https://milq.github.io/install-opencv-ubuntu-debian/
######################################
# INSTALL OPENCV ON UBUNTU OR DEBIAN #
######################################
# | THIS SCRIPT IS TESTED CORRECTLY ON |
# |----------------------------------------------------|
# | OS | OpenCV | Test | Last test |
# |----------------|--------------|------|-------------|
@izanbf1803
izanbf1803 / MyForm.cpp
Created August 31, 2017 13:58
Default main() code required to initialize CLR UI Windows Forms with Visual Studio.
#include "[FORM NAME].h"
using namespace System;
using namespace System::Windows::Forms;
[STAThread]
void main(array<String^>^ args)
{
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
@izanbf1803
izanbf1803 / pyTriples.hs
Created September 1, 2017 01:32
Haskell comprehension list implementing Pythagorean triples calculation.
pyTriples :: Integer -> [(Integer, Integer, Integer)]
pyTriples n = [(a, b, c) | a <- [1..n], b <- [1..n], c <- [1..n], a^2 + b^2 == c^2]
@izanbf1803
izanbf1803 / Repeating decimals to fraction.py
Last active September 12, 2017 21:27
Convert repeating decimals to fractions.
import sys
def err(section):
print("ERROR [{section}]: Bad input (not a number)".format(section=section))
sys.exit(1)
def stoi(s):
return int("".join(("0" + s)))
def int_repeat(n, k):
@izanbf1803
izanbf1803 / tron_bot.cpp
Created September 12, 2017 21:32
codingame.com tron bot
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <array>
#include <algorithm>
#include <cmath>
using namespace std;
@izanbf1803
izanbf1803 / nqueens.cpp
Created October 4, 2017 16:42
N-Queens solution counter.
// Use N <= 30 (good luck to calculate that)
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
// bits values for bit arrays:
// 1 = free
// 0 = used