This file contains 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
import numpy as np | |
from time import sleep | |
import matplotlib.pyplot as plt | |
from requests import get | |
def get_color(rating): | |
if rating >= 2400: | |
return 'r' | |
elif rating >= 2100: |
This file contains 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
// Very simple Inversion Counting based on a merge sort | |
// by cf/cebolinha | |
#include <bits/stdc++.h> | |
using namespace std; | |
#define int long long | |
int count_inversions(vector<int> &v) { | |
if (v.size() == 1) return 0; |
This file contains 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
// Very simple mergesort implementation by cf/cebolinha | |
// Uses O(NlogN) memory, a bit more than the usual O(N) | |
#include <bits/stdc++.h> | |
using namespace std; | |
void merge_sort(vector<int> &v) { | |
if (v.size() == 1) return; | |
// Divide v into two vectors - Left and Right | |
vector<int> L, R; |
This file contains 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; | |
#define int long long | |
//( Experimental Template (x1.1.1) (cf/cebolinha) | |
// G++ Sorcery | |
#pragma GCC optimize("Ofast") | |
#pragma GCC target("avx,avx2,fma") |
This file contains 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
.data | |
arr: .word 71 27 50 81 34 12 84 41 68 7 57 69 40 51 85 66 63 47 65 61 28 92 80 70 88 98 35 89 54 56 13 30 46 45 64 91 5 86 3 87 2 6 99 11 79 72 14 29 44 60 55 22 26 31 9 43 37 24 52 42 67 83 74 18 10 73 8 20 53 0 96 4 16 82 58 62 15 95 38 76 1 97 75 33 49 21 23 32 36 59 25 17 94 39 48 77 93 90 19 78 | |
arrS: .word 100 | |
.macro print_int | |
li a7 1 | |
ecall | |
.end_macro | |
.macro print_array | |
mv a0 s0 |
This file contains 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 <iostream> | |
#include <algorithm> | |
#include <string.h> | |
#include <vector> | |
#include <string> | |
#include <math.h> | |
using namespace std; | |
void printTheString(string myStringIWantToPrint) { |
This file contains 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 <iostream> | |
using namespace std; | |
void swap(int &x, int &y) { | |
int aux = x; | |
x = y; | |
y = aux; | |
} |