Skip to content

Instantly share code, notes, and snippets.

import scala.io.Source
object P1 extends App {
val fileLines = Source.fromFile("p1input.txt").getLines.toList
println((for (line <- fileLines) yield line.trim().toInt / 3 - 2).sum)
def fuelCost(n: Int): Int = {
val next = n / 3 - 2
if (next < 1) 0 else next + fuelCost(next)
}
from mock import Mock
from random import randint
from unittest import TestCase
from evennia.accounts.accounts import AccountSessionHandler
from evennia.accounts.accounts import DefaultAccount
from evennia.accounts.accounts import DefaultGuest
from evennia.server.session import Session
from evennia.utils import create
def readTimes():
with open("times.csv", newline = "") as saveFile:
reader = csv.reader(saveFile, delimiter=",")
return [float(row[0]) for row in reader]
function doesUserExist() {
pg.connect(conString, function (err, client, done) {
client.query('SELECT user_id FROM clients.users where user_id=$1', [req.body.user], function(err, result) {
if (err) {
console.log('error fetching client from pool', err);
return;
}
doNext(result.rowCount == 1);
});
});
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Game1
{
public class Characters
{