Skip to content

Instantly share code, notes, and snippets.

View ShittyCodeMan's full-sized avatar

ShittyCodeMan ShittyCodeMan

View GitHub Profile
@ShittyCodeMan
ShittyCodeMan / a_rank_twopointers_boss.js
Created August 11, 2024 18:53
区間の積 (paizaランク A 相当)
let lines = require("fs").readFileSync("/dev/stdin", "utf8").split`\n`;
const [N, K] = lines[0].split` `.map(Number);
const A = lines[1].split` `.map(Number);
if (K === 1) {
console.log(1);
return;
}
const log2ceil = Math.ceil(Math.log2(K));
@ShittyCodeMan
ShittyCodeMan / a_rank_pincerattack_boss.js
Last active August 11, 2024 16:02
いびつなリバーシ対戦 (paizaランク A 相当)
let lines = require("fs").readFileSync("/dev/stdin", "utf8").split("\n");
const [H, W, N, M] = lines[0].split` `.map(Number);
const S = lines.slice(1, H+1).map(v => v.split``);
const MOVES = lines.slice(H+1, H+M+1).map(v => v.split` `.map(Number));
const HOLE = "#";
const DS = [[-1, -1], [-1, 0], [-1, 1], [0, 1], [1, 1], [1, 0], [1, -1], [0, -1]];
const raycast = (y, x, dy, dx) => {
let result = [];
@ShittyCodeMan
ShittyCodeMan / random128.js
Last active March 28, 2025 07:08
128ビットのそれなりにランダムな16進数文字列を出力する
// 7ビット固定 crypto
crypto.randomUUID().replace(/-/g,"")
// Math.randomでの最短コード?
(f=n=>n--?Math.random().toString(16)[2]+f(n):"")(32)
div>div:has(a[href="/zhcsqsha"])~div:nth-last-child(1)>div>div[aria-label][role=group][id] {
display: none !important;
}
import os
import sys
import msvcrt
from itertools import product, repeat
from concurrent.futures import ProcessPoolExecutor
from tqdm import tqdm
RESET = '\x1b[0m';
REVERSE = '\x1b[7m';
LIGHT = '#';
from itertools import permutations, combinations
def find_combinations(A, B):
if len(A) == 0:
return []
a = A[0]
for b1, b2 in permutations(B, 2):
temp_B = B.copy()
if b1 + b2 == a:
x = f"{b1} + {b2} = {a}"
class PegSolitaire:
def __init__(self, board):
self.board = board
self.height = len(board)
self.width = len(board[0])
self.moves = []
def is_valid_move(self, x, y, dx, dy):
if (0 <= x+2*dx < self.height and 0 <= y+2*dy < self.width and
self.board[x][y] == 'o' and
@ShittyCodeMan
ShittyCodeMan / restart_failed_usb_device.bat
Last active March 28, 2025 07:09
たぶん使えないコード
for /f "tokens=3" %%i in ('pnputil /enum-devices /connected /class USB /problem 43^|find "インスタンス ID"') do pnputil /restart-device "%%i"
@ShittyCodeMan
ShittyCodeMan / add_2gameinfo_link.userscript.js
Last active May 24, 2024 08:51
Add 2game.info link to Nexusmods
const INTEGRANTS = [{"name":"Abecean Longfin","effects":["Fortify Restoration","Fortify Sneak","Weakness to Frost","Weakness to Poison"]},{"name":"Bear Claws","effects":["Damage Magicka Regen","Fortify Health","Fortify One-handed","Restore Stamina"]},{"name":"Bee","effects":["Ravage Stamina","Regenerate Stamina","Restore Stamina","Weakness to Shock"]},{"name":"Beehive Husk","effects":["Fortify Destruction","Fortify Light Armor","Fortify Sneak","Resist Poison"]},{"name":"Bleeding Crown","effects":["Fortify Block","Resist Magic","Weakness to Fire","Weakness to Poison"]},{"name":"Blisterwort","effects":["Damage Stamina","Fortify Smithing","Frenzy","Restore Health"]},{"name":"Blue Butterfly Wing","effects":["Damage Magicka Regen","Damage Stamina","Fortify Conjuration","Fortify Enchanting"]},{"name":"Blue Dartwing","effects":["Fear","Fortify Pickpocket","Resist Shock","Restore Health"]},{"name":"Blue Mountain Flower","effects":["Damage Magicka Regen","Fortify Conjuration","Fortify Health","Restore Health"]},{"name