Skip to content

Instantly share code, notes, and snippets.

View oToToT's full-sized avatar
🥱
Lazy Coding

Tommy Chiang oToToT

🥱
Lazy Coding
View GitHub Profile
#include <bits/stdc++.h>
using namespace std;
void main_() {
// implement your solution here
}
void run_with_stack_size(size_t sz, void (*f)(void)) {
assert(sz % 16 == 0);
char *s = (char *)malloc(sz), *e = s + sz;
import requests
import itertools
import time
from tqdm.auto import tqdm
ALL_GYM_LIST_URL = 'https://codeforces.com/api/contest.list?gym=true'
CONTEST_STATUS_URL_TEMPLATE = 'https://codeforces.com/api/contest.status?contestId={}&from={}&count={}&handle={}'
USERS_LIST = ['tourist', 'andrewzta', 'VArtem']
#include <bits/stdc++.h>
using namespace std;
using llf = long double;
using pdd = complex<llf>;
static constexpr llf EPS = 1e-8;
static constexpr llf pi = M_PI;
#define X real()
#define Y imag()
<!doctype html>
<html lang="en">
<head>
<title>Chart</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.6.0/chart.min.js"></script>
<style>
body {
margin: 0;
}
#main {
@oToToT
oToToT / 102798I.cpp
Created October 7, 2021 19:29
clang miscompilation??
// problem link: https://codeforces.com/gym/102798/problem/I
#include <bits/stdc++.h>
using namespace std;
template <uint64_t x, size_t n>
struct Pow {
uint64_t v;
constexpr Pow(): v(1) {
for (size_t i = 0; i < n; ++i) v *= x;
}
[--------- 1d unique_consecutive ---------]
| dim=0 | dim=None
1 threads: --------------------------------
N = 10000 | 46.6 | 45.6
N = 50000 | 106.7 | 105.9
N = 100000 | 177.6 | 177.0
N = 500000 | 919.5 | 907.0
N = 1000000 | 2199.6 | 2198.6
N = 5000000 | 39679.2 | 39668.5
N = 10000000 | 79028.6 | 79015.1
#!/usr/bin/env python3
import concurrent.futures
from urllib.parse import urljoin
from bs4 import BeautifulSoup
import requests
PROXY = {}
SEASON = '2022/spring'
@oToToT
oToToT / prism-example.html
Last active March 14, 2021 14:10
A demonstration of prism js usage.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Example</title>
<script src='https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.1/clipboard.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/prism/1.23.0/components/prism-core.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/prism/1.23.0/components/prism-markup-templating.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/prism/1.23.0/components/prism-clike.min.js'></script>
@oToToT
oToToT / png2webp.cpp
Last active February 26, 2021 05:45
Convert png to webp of a whole directory
/*
* Compiled with:
* g++ png2webp.cpp -lwebp -lpng -lpthread -std=c++17 -O3 -march=native
* using libwebp 0.6.1 here
*/
/*
* This is a modification from the source code of cwebp and libwebp, the
* original License is stated below.
*/
import telnetlib
import subprocess
import time
class TelnetConnection:
def __init__(self, host, port):
self.host = host
self.port = port
def telnet(self):