Skip to content

Instantly share code, notes, and snippets.

View SansPapyrus683's full-sized avatar
πŸ˜€
a minor inconvenience

Kevin Sheng SansPapyrus683

πŸ˜€
a minor inconvenience
View GitHub Profile
@SansPapyrus683
SansPapyrus683 / zip_to_mc.py
Created March 29, 2025 23:45
put a zip file right into your mc saves
import sys
import zipfile
from pathlib import Path
import os
import shutil
path = sys.argv[1]
extract_to = Path(path).stem
with zipfile.ZipFile(path, 'r') as zip_ref:
os.makedirs(extract_to)
@SansPapyrus683
SansPapyrus683 / day15.rs
Created April 26, 2024 03:24
incomplete advent of code 2018 day 15
use itertools::Itertools;
use std::collections::{HashMap, HashSet, VecDeque};
use std::fs;
fn neighbors(r: usize, c: usize) -> Vec<(usize, usize)> {
let (ir, ic) = (r as i32, c as i32);
vec![(ir + 1, ic), (ir - 1, ic), (ir, ic + 1), (ir, ic - 1)]
.iter()
.filter(|(r, c)| *r >= 0 && *c >= 0)
.map(|(r, c)| (*r as usize, *c as usize))
@SansPapyrus683
SansPapyrus683 / changes.py
Last active February 8, 2025 15:50
download all your twitter anime girls!
import filecmp
import os
import sys
from collections import defaultdict
from dataclasses import dataclass
@dataclass
class Tweet:
raw: str
@SansPapyrus683
SansPapyrus683 / suff_arr.cpp
Created January 15, 2024 03:07
Suffix Array Implementation
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using std::cout;
using std::endl;
using std::vector;
using std::string;
@SansPapyrus683
SansPapyrus683 / .gitconfig
Last active March 17, 2025 23:45
some config files (linux and windows)
[user]
name = Kevin Sheng
email = [email protected]
[credential]
helper = store
[core]
editor = nvim
[pull]
rebase = true
[push]
@SansPapyrus683
SansPapyrus683 / conventions.md
Last active April 5, 2025 13:42
code conventions to satisfy dustin

general code stuff

  • comments
    • inline comments should be two spaces after the line of code
    • if a single comment takes over two lines, use a multiline comment
  • sols should have nearly the same structure, same names, etc. to avoid confusion
  • avoid global variables
  • for the brace languages, always use braces & space em out like: for (int i = 0; i < 2; i++) {
  • an if-else should be like this:
@SansPapyrus683
SansPapyrus683 / LCATree.java
Last active June 7, 2024 00:28
Tree with LCA capabilities (C++ and Java)
import java.util.*;
/** Tree class with LCA capabilities and some other handy functions. */
public class LCATree {
private final int[] par;
private final int[][] pow2Ends;
private final int[] depth;
private final int log2Dist;
/**
@SansPapyrus683
SansPapyrus683 / drought_gold.md
Last active August 9, 2023 09:47
Solution for "Drought" (2022 USACO Gold)

bro i could passed gold lmao
i actually knew how to solve 2 problems

but anyways, here's the gold p1 editorial on request (actual problem here, i won't bother explaining it myself, just read the darn thing)

so it would be absolute cancer to try and actually calculate if each tuple can get to a level where all cows have the same hunger level
not only that, calculating all the possible tuples themselves...

@SansPapyrus683
SansPapyrus683 / kruznice.md
Created January 28, 2022 05:39
Solution for "KRUZNICE"

so yknow i was on the dp grind when someone posted this problem on the github issues for the usaco guide (you can test here, but prepare google translate)

so we have a buncha circles, intervals really
and we wanna remove some so that none of them intersect (they can be tangent tho)

so let's define min_remove[s][e] as the minimum amount of circles we have to remove given that the only circles we consider are the ones that are completely

@SansPapyrus683
SansPapyrus683 / game_master.md
Created January 16, 2022 01:24
solution for game master on cf

"Domination". Look it up.

β€” Scout, TF2

after the dec contest, i have come to the conclusion that i suck a** at dp
so i was grinding cf and i came upon this problem that had the tag dp
but my solution was anything but that, so lemme just share my sol