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 decimal | |
# version check | |
import sys | |
from decimal import Decimal | |
if sys.version_info[0] != 3: | |
try: | |
print("This script requires Python 3") | |
except SyntaxError as err: | |
raise err |
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
from pyautogui import * | |
import pyautogui | |
import time | |
import keyboard | |
import pygetwindow as gw | |
import sys | |
import math | |
import win32api | |
screencenter = 1980 / 2, 1080 / 2 |
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<stdio.h> | |
int map(int *arr, int (*(*foo)(int))(int), int choose) { | |
printf("%d", foo(choose)(arr[0])); | |
} | |
int barfoo(int x) { | |
return x - 1; | |
} | |
int foobar(int x) { |
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
// Array operations | |
// Search | |
// Insert | |
// Traverse | |
// Update | |
#include<string.h> | |
#include<stdio.h> | |
// O(n) time |
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"stdlib.h" | |
#include"stddef.h" | |
#include"stdio.h" | |
typedef struct { | |
int *arr; | |
size_t len; | |
} Array; | |
Array iota(size_t len) { |
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"stdio.h" | |
void iota(int *arr, int len) { | |
for (int i = 0; i < len; i++) { | |
arr[i] = i; | |
} | |
} | |
int main() { | |
int a[4][4]; |
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"stdio.h" | |
#include"string.h" | |
size_t bisect(char **a, int len, char *elem) { | |
size_t hi = len - 1; | |
size_t lo = 0; | |
size_t mid; | |
while (1) { | |
mid = (hi + lo) >> 1; |
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> | |
int argmin(std::vector<int> &a, int from) { | |
int m = a.at(from); | |
int mi = from; | |
for (int i = from; i < a.size(); i++) if (a[i] < m) { m = a[i]; mi = i; } | |
return mi; | |
} | |
void bubble_sort(std::vector<int> &a) { |
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> | |
void insertion_sort(std::vector<int> &a) { | |
for (int i = 1; i < a.size(); i++) { | |
int b = a[i]; | |
int j = i - 1; | |
for (; j >= 0 && b < a[j]; j--) { | |
a[j + 1] = a[j]; | |
} | |
a[j + 1] = b; |
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> | |
void merge(std::vector<int> &a, int l, int mid, int r) { | |
int p1 = l; | |
int p2 = mid + 1; | |
std::vector<int> ret(r - l + 1); | |
int i = 0; | |
while (p1 <= mid && p2 <= r) ret[i++] = a[p1] < a[p2] ? a[p1++] : a[p2++]; |
OlderNewer