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
// Tutorial: Squadron | |
// Destroy the enemy ships. They now shoot back. | |
use oort_api::prelude::*; | |
const BUF_SIZE: usize = 1024; | |
// adapted from https://github.com/rust-lang/rust/issues/114936 | |
fn hack() | |
-> impl for<'s> FnOnce(&'s mut [u8; BUF_SIZE]) -> ( | |
[&'static &'s (); 0], |
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
#![recursion_limit = "1505"] | |
macro_rules! A { | |
($name:tt) => { A!(($) (*) $name); }; | |
(($d:tt) ($s:tt) $name:tt) => { | |
A!(1 $d $s $name [] [] [ | |
(1 dd d:tt dd s:tt dd name:tt [dd (dd hh:tt)ss] [dd (dd h:tt)ss] [e dd dd (dd t:tt)ss] dd (dd _:tt)ss) => { | |
nn!(1 dd d dd s dd name [dd (dd hh)ss e dd] [dd (dd h)ss dd d] [dd (dd t)ss] dd (dd _)ss); | |
}; | |
(1 dd d:tt dd s:tt dd name:tt [dd (dd hh:tt)ss] [dd (dd h:tt)ss] [e ss dd (dd t:tt)ss] dd (dd _:tt)ss) => { |
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 math | |
r0 = 1.0910244704807567604 | |
c1 = 0.823167270149155 | |
c2 = 0.0445506192519361 | |
c3 = 0.0640519155651715 | |
c4 = 0.146739953698779 | |
c5 = -0.0884627271380199 | |
c6 = -0.268850251751933 |
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
# Fixed size binary numbers | |
true = lambda a: lambda b: a | |
false = lambda a: lambda b: b | |
and_ = lambda a: lambda b: a (b) (a) | |
or_ = lambda a: lambda b: a (a) (b) | |
xor = lambda a: lambda b: a (not_ (b)) (b) | |
not_ = lambda b: b (false) (true) | |
y = lambda f: (lambda x: x (x)) (lambda x: f (lambda v: x (x) (v))) |
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
/// Usage: `const_assert!(Var1: Ty, Var2: Ty, ... => expression)` | |
macro_rules! const_assert { | |
($($list:ident : $ty:ty),* => $expr:expr) => {{ | |
struct Assert<$(const $list: usize,)*>; | |
impl<$(const $list: $ty,)*> Assert<$($list,)*> { | |
const OK: u8 = 0 - !($expr) as u8; | |
} | |
Assert::<$($list,)*>::OK | |
}}; | |
($expr:expr) => { |
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
pub fn part1(input: &str) -> impl std::fmt::Display { | |
input.lines().enumerate().fold(0, |a, x| { | |
a + (x.1.as_bytes()[(x.0 * 3) % x.1.len()] == b'#') as u32 | |
}) | |
} |
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
#!/usr/bin/env python3 | |
import os | |
import re | |
import requests | |
from time import sleep | |
countries = [ | |
"US", "RU", "DE", "PL", "FR", "JP", "CA", "BR", "GB", "TW", | |
"KR", "CN", "AU", "ID", "UA", "PH", "CL", "FI", "AR", "NL", |
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
(lambda p:(lambda f:(lambda x:x(x))(lambda x:f(lambda v:x(x)(v))))(lambda f:lambda n:n(lambda x:lambda x:f((lambda n:lambda f:lambda x:n(lambda g:lambda h:h(g(f)))(lambda u:x)(lambda u:u))(n))((lambda a:lambda b:lambda x:(lambda a:lambda b:a(b)(a))(a)(b)(p("FizzBuzz"))(a(p("Fizz"))(b(p("Buzz"))(p(n(lambda x:x+1)(0))))))((lambda d:lambda n:(lambda f:(lambda x:x(x))(lambda x:f(lambda v:x(x)(v))))(lambda f:lambda n:(lambda n:n(lambda x:lambda a:lambda b:b)(lambda a:lambda b:a))(n)(lambda x:lambda a:lambda b:b)((lambda a:lambda b:a(b)(a))((lambda n:n(lambda x:lambda a:lambda b:b)(lambda a:lambda b:a))((lambda n:lambda m:m(lambda n:lambda f:lambda x:n(lambda g:lambda h:h(g(f)))(lambda u:x)(lambda u:u))(n))(n)(d)))((lambda n:n(lambda x:lambda a:lambda b:b)(lambda a:lambda b:a))((lambda n:lambda m:m(lambda n:lambda f:lambda x:n(lambda g:lambda h:h(g(f)))(lambda u:x)(lambda u:u))(n))(d)(n)))(lambda x:lambda a:lambda b:a)(lambda x:f((lambda n:lambda m:m(lambda n:lambda f:lambda x:n(lambda g:lambda h:h(g(f)))(lambda u: |
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
use std::collections::*; | |
use std::borrow::Cow; | |
use rand::random; | |
pub fn part1(input: &str) -> impl std::fmt::Display { | |
let prog = input.trim().split(",").map(|x| x.parse::<i128>().unwrap()).collect::<Vec<_>>(); | |
let mut vm = ic::Icvm::new(prog); | |
vm.run(); |
NewerOlder