This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Compile with C++ 17 | |
| #include <iostream> | |
| #include <string> | |
| #include <vector> | |
| #include <tuple> | |
| #include <cassert> | |
| using namespace std; | |
| typedef long long int64; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| SOURCE_DIRECTORY=$1 # Provide absolute path | |
| TARGET_DIRECTORY=$2 # Provide absolute path | |
| if [ ! -d $SOURCE_DIRECTORY ] | |
| then | |
| echo "Source directory ${SOURCE_DIRECTORY} does not exist" | |
| exit 1 | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| using namespace std; | |
| int const kInf = 1 << 29; | |
| struct edge { | |
| int node; | |
| int cost; | |
| }; | |
| struct state { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // NOTE: Code from my early beginnings (circa 2010). | |
| #include<iostream> | |
| #include <cstdio> | |
| #define MAX_V 1001 | |
| #define INFINITO 1000000 //Cualquier valor mas grande que los pesos que usemos | |
| void InicializaArreglos(); | |
| void Dijkstra(int NodoInicial); | |
| int AunEncolado(int nodo); | |
| int DevuelveMinimo(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| using std::vector; | |
| void printAnswer(int frequency, int station) { | |
| if (frequency < station) { | |
| std::cout << "adelante " << station - frequency << "\n"; | |
| } else if (frequency > station) { | |
| std::cout << "atras " << frequency - station << "\n"; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| using std::vector; | |
| bool cycleIsIncomplete(vector<int> const & sequence, int a, int b, int idx) { | |
| unsigned m = sequence.size(); | |
| int aa = sequence[(idx-2+m)%m]; | |
| int bb = sequence[(idx-1+m)%m]; | |
| return aa != a || bb != b; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| using std::vector; | |
| int main() { | |
| int N; | |
| std::cin >> N; | |
| vector<bool> sieve(N); | |
| int a = 1, b = 1; | |
| sieve[a] = true; | |
| sieve[b] = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| using std::vector; | |
| using std::pair; | |
| using std::set; | |
| using std::unordered_map; | |
| using std::unordered_set; | |
| void updateIndex(vector<int> const& ballot, int& index, unordered_set<unsigned> const& losers, int C) { | |
| while (index < C) { | |
| int candidate = ballot[index]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Merriam-Webster Helper | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1 | |
| // @description A tiny script that makes merriam-webster.com/ work nicely with Vimium, namely, it removes the focus from the search bar so that you can use the vim commands to move around. | |
| // @author Rafael Rendon Pablo | |
| // @run-at document-idle | |
| // @match https://www.merriam-webster.com/ | |
| // @match https://www.merriam-webster.com/word-of-the-day | |
| // @match https://www.merriam-webster.com/word-of-the-day/* |