This file contains hidden or 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 dataclasses import dataclass, field | |
| from gsplat.compression import PngCompression | |
| from plyfile import PlyData, PlyElement | |
| import numpy as np | |
| import os | |
| import torch | |
| import tyro | |
| from pathlib import Path | |
| @dataclass |
This file contains hidden or 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
| def run input | |
| $edges = Hash.new { |h,k| h[k] = Hash.new 999 } | |
| $nodes = {} | |
| input.split("\n").each do |line| | |
| name, flow, *children = line.scan /[A-Z]{2}|\d+/ | |
| $nodes[name] = flow.to_i | |
| children.each { |child| $edges[name][child] = 1 } | |
| end | |
| $nodes.keys.each { |node| $edges[node][node] = 0 } | |
| # build all-pairs shortest distance between all nodes (floyd-warshall) |
This file contains hidden or 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
| def run input | |
| p search([input[0] - 1, 0], [input[1] - 1, 0]).max | |
| end | |
| $rolls = [1, 2, 3] | |
| $rolls = $rolls.product($rolls, $rolls).map(&:sum) | |
| $memo = {} | |
| def search *players | |
| return $memo[players] if $memo[players] |
This file contains hidden or 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
| require 'matrix' | |
| require 'set' | |
| def run input | |
| scanners = input.split("\n\n").map { |scanner| | |
| scanner | |
| .split("\n")[1..-1] | |
| .map { |line| line.split(',').map(&:to_i) } | |
| .map { |pos| permutations pos }.transpose | |
| } |
This file contains hidden or 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
| Seen 01009 prior - blount_county and blount_county_etowah_county | |
| Seen 01073 prior - jefferson_county and jefferson_county_st_clair_county | |
| Seen 01043 prior - cullman_county_marshall_county and cullman_county | |
| Seen 01073 prior - jefferson_county and jefferson_county_shelby_county | |
| Seen 01055 prior - etowah_county and etowah_county_marshall_county | |
| Seen 01097 prior - mobile_county and mobile_county_washington_county | |
| Seen 01021 prior - chilton_county_shelby_county and chilton_county | |
| Seen 01019 prior - cherokee_county and cherokee_county_de_kalb_county | |
| Seen 01009 prior - blount_county and blount_county_jefferson_county | |
| Seen 01023 prior - choctaw_county and choctaw_county_washington_county |
This file contains hidden or 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
| require 'algorithms' | |
| require 'matrix' | |
| def run input | |
| input = input.split("\n") | |
| bots = input.map { |str| | |
| pos, r = str.split(', ') | |
| pos = Vector[*(pos[5..-2].split(',').map(&:to_i))] | |
| r = r.split('=').last.to_i | |
| [pos, r] |
This file contains hidden or 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
| def run input | |
| input = input.split("\n") | |
| bots = input.map { |str| | |
| pos, r = str.split(', ') | |
| pos = pos[5..-2].split(',').map(&:to_i) | |
| r = r.split('=').last.to_i | |
| [pos, r] | |
| } | |
| xmin, xmax = bots.map(&:first).map(&:first).sort.values_at(0, -1) | |
| ymin, ymax = bots.map(&:first).map {|_,y,_| y }.sort.values_at(0, -1) |
This file contains hidden or 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
| pos=<68614166,23842261,30774753>, r=60093393 | |
| pos=<69326636,41665261,23882562>, r=66095166 | |
| pos=<18356731,43629072,33351296>, r=51604746 | |
| pos=<73545864,16511667,43577218>, r=85158212 | |
| pos=<87738112,38436581,24097111>, r=57945467 | |
| pos=<105372914,48684696,-13332055>, r=97279780 | |
| pos=<122615072,70394703,22757750>, r=92815776 | |
| pos=<-1783138,45596569,36925666>, r=73351459 | |
| pos=<85666560,44215342,72092341>, r=98090497 | |
| pos=<31417365,55772113,68526758>, r=65622149 |
This file contains hidden or 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
| before = null | |
| $ -> | |
| return unless editor?.constructor == CodeMirror | |
| editor.on 'beforeChange', (cm) -> before ||= cm.getValue() | |
| Firepad.RichTextCodeMirrorAdapter::onChange = (_, changes) -> | |
| if changes[0].origin != 'RTCMADAPTER' | |
| pair = Firepad.RichTextCodeMirrorAdapter.operationFromCodeMirrorChanges changes, this.cm | |
| this.trigger 'change', pair[0], pair[1] |
This file contains hidden or 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
| class String | |
| def js_length | |
| self.length + | |
| self.each_codepoint.count { |codepoint| codepoint >= 0x10000 && codepoint <= 0x10FFFF } | |
| end | |
| end |
NewerOlder