Skip to content

Instantly share code, notes, and snippets.

@orendon
orendon / day11_seating_system.cpp
Created December 11, 2020 18:35
Advent of Code 2020 - Day 11 Seating System
#include <algorithm>
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define forn(i, j, n) for (int i = j; i < (int)n; i++)
#define forr(i, j, n) for (int i = j; i >= (int)n; i--)
@orendon
orendon / day10_adapter_array.cpp
Created December 10, 2020 06:25
Advent of Code 2020 - Day 10 Adapter Array
#include <algorithm>
#include <fstream>
#include <iostream>
#include <set>
#include <vector>
using namespace std;
#define forn(i, j, n) for (int i = j; i < (int)n; i++)
#define endl '\n'
@orendon
orendon / day09_encoding_error.cpp
Created December 10, 2020 06:24
Advent of Code 2020 - Day 9 Encoding Error
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
#define forn(i, j, n) for (int i = j; i < (int)n; i++)
#define endl '\n'
#define pb push_back
@orendon
orendon / day08_handheld_halting.cpp
Last active December 9, 2020 18:39
Advent of Code 2020 - Day 8 Handheld Halting
#include <iostream>
#include <sstream>
#include <string>
#include "day08_machine.h"
using namespace std;
#define endl '\n'
#define pb push_back
@orendon
orendon / day07_handy_haversacks.cpp
Created December 7, 2020 16:42
Advent of Code 2020 - Day 7 Handy Haversacks
#include <iostream>
#include <sstream>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
#define endl '\n'
#define pb push_back
#define forn(i, n) for (int i = 0; i < (int)n; i++)
@orendon
orendon / day06_custom_customs.cpp
Created December 6, 2020 17:54
Advent of Code 2020 - Day 6 Custom Customs
#include <iostream>
#include <string>
#include <set>
using namespace std;
#define endl "\n"
int main() {
string line;
int part1_answer=0, part2_answer=0;
@orendon
orendon / day05_binary_boarding.cpp
Created December 5, 2020 05:59
Advent of Code 2020 - Day 5 Binary Boarding
#include <iostream>
#include <string>
#include <queue>
using namespace std;
int process(string&);
int main() {
string pass;
priority_queue<int> ids;
@orendon
orendon / day04_passport_processing.cpp
Created December 4, 2020 06:54
Advent of Code 2020 - Day 04
#include <iostream>
#include <string>
#include <regex>
#include <map>
using namespace std;
const string BYR = "byr:";
const string IYR = "iyr:";
const string EYR = "eyr:";
@orendon
orendon / day03.cpp
Created December 3, 2020 16:42
Advent of Code 2020 - Day 3 (Toboggan Trajectory)
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const char TREE = '#';
@orendon
orendon / letras.cpp
Created December 3, 2020 03:29
Equivalente en C++ a Python, Problema: https://codeforces.com/problemset/problem/1397/A
#include <iostream> // imports
#include <string>
#include <map>
using namespace std;
// Problema: https://codeforces.com/problemset/problem/1397/A
int main() {
int t, n;
string word;