Skip to content

Instantly share code, notes, and snippets.

@rendon
rendon / fb_challenge.cpp
Last active November 29, 2019 01:29
A FB challenge
// Compile with C++ 17
#include <iostream>
#include <string>
#include <vector>
#include <tuple>
#include <cassert>
using namespace std;
typedef long long int64;
#include <bits/stdc++.h>
using namespace std;
class Solution {
private:
vector<int> primes;
unordered_map<int, vector<int>> factors;
unordered_map<int, vector<size_t>> revFactors;
void computePrimes(int max) {
#include <iostream>
#include <cstring>
template<typename T>
T read() {
T var;
std::cin >> var;
return var;
}
const int kMax = 100005;
#include <iostream>
typedef long long int64;
template<typename T>
T read() {
T var;
std::cin >> var;
return var;
}
@rendon
rendon / D.cpp
Created March 6, 2018 17:06
Educational Codeforces Round 39 (Rated for Div. 2) -- D
/* Copyright 2018 Rafael Rendón Pablo <rafaelrendonpablo@gmail.com> */
// region Template
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <string>
#include <bitset>
#include <vector>
#include <queue>
@rendon
rendon / Parser.java
Last active February 18, 2018 04:07
Basic JSON parser (super incomplete)
package mx.letmethink;
import java.util.HashMap;
import java.util.Map;
public class Main {
public static void main(String[] args) {
String text = "{}";
// System.out.println(new JsonParser(text).parse());
// System.out.println(new JsonParser("{\"key\": \"value\", \"num\": 1234}").parse());
/* Copyright 2017 Rafael Rendón Pablo <rafaelrendonpablo@gmail.com> */
// region Template
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <string>
#include <bitset>
#include <vector>
#include <queue>
@rendon
rendon / B.cpp
Created January 31, 2018 04:27
Google Code Jam QR 2014 B
/* Copyright 2017 Rafael Rendón Pablo <rafaelrendonpablo@gmail.com> */
// region Template
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <string>
#include <bitset>
#include <vector>
#include <queue>
@rendon
rendon / pattern.txt
Created January 24, 2018 05:28
Fair and square pattern
1 --> 1
2 --> 4
3 --> 9
11 --> 121
22 --> 484
101 --> 10201
111 --> 12321
121 --> 14641
202 --> 40804
212 --> 44944
@rendon
rendon / vim_plugin_for_clojure.txt
Created January 12, 2018 04:15
List of vim plugins for working with Clojure
" Clojure plugins
Plugin 'tpope/vim-classpath'
Plugin 'guns/vim-clojure-static'
Plugin 'tpope/vim-fireplace'
Plugin 'guns/vim-clojure-highlight'