Skip to content

Instantly share code, notes, and snippets.

View vijfhoek's full-sized avatar

Sijmen vijfhoek

View GitHub Profile
from std/strutils import split, parseInt
from std/sequtils import map, foldl
let numbers = readLine(stdin).split(',').map(parseInt)
var buckets: array[9, int]
for number in numbers:
buckets[number] += 1
for i in 0..<256:
from std/strutils import split, parseInt
from std/sequtils import map, foldl
let numbers = readLine(stdin).split(',').map(parseInt)
var buckets: array[256 + 9, int]
for number in numbers:
buckets[number] += 1
for i in 0..<256:
function getEventsCompanies() {
return fetch(`${baseUrl}/events/companies`).then((response) => response.json());
}
function getEventsOther() {
return fetch(`${baseUrl}/events/other`).then((response) => response.json());
}
function formatDateRange(start, end) {
const startMoment = moment(start);
/* Generated from day02.scm by the CHICKEN compiler
http://www.call-cc.org
Version 5.1.0 (rev 8e62f718)
linux-unix-gnu-x86-64 [ 64bit dload ptables ]
command line: day02.scm -output-file day02.c
uses: library eval expand extras data-structures
*/
#include "chicken.h"
static C_PTABLE_ENTRY *create_ptable(void);
(import (chicken io))
(import (chicken format))
(import (chicken string))
(import srfi-1)
(define (parse-line line)
(let ((words (string-split line)))
(list (car words) (string->number (car (cdr words))))))
(define (parse inputs)
use core::fmt::Debug;
use std::{
collections::{HashSet, VecDeque},
io::BufRead,
};
#[derive(PartialEq)]
enum Tile {
Nothing,
Wall,
let wasm;
const heap = new Array(32).fill(undefined);
heap.push(undefined, null, true, false);
function getObject(idx) { return heap[idx]; }
let heap_next = heap.length;
import fileinput
part1, part2 = 0, 0
for line in fileinput.input():
line = line.strip()
part1 += len(line) - len(eval(line))
part2 += line.count("\\") + line.count('"') + 2
print(part1, part2)
/* Generated by cobc 3.1.2.0 */
/* Generated from day06b.cob */
/* Generated at nov 06 2021 23:45:03 */
/* GnuCOBOL build date Dec 24 2020 19:08:58 */
/* GnuCOBOL package date Dec 23 2020 12:04:58 UTC */
/* Compile command cobc -C day06b.cob */
#include <stdio.h>
#include <string.h>
#define COB_KEYWORD_INLINE __inline
identification division.
program-id. day06.
data division.
working-storage section.
01 input-line pic x(100).
01 action pic x(10).
01 coords pic x(100).
01 start-coords pic x(100).