Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Collections.Generic;
using System.Linq;
namespace AdventOfCodeDay9
{
public static class Extensions
{
public static IEnumerable<IEnumerable<T>> Permute<T>(this IEnumerable<T> sequence)
{
using System;
using System.IO;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Linq;
namespace AdventOfCodeDay9
{
class MainClass
{
using System;
namespace adventofcodeday7_2
{
class Program
{
const ushort ai = unchecked((ushort)(af & ah));
const ushort ll = unchecked((ushort)(~lk));
const ushort @is = unchecked((ushort)(hz >> 1));
const ushort gp = unchecked((ushort)(~go));
const ushort dv = unchecked((ushort)(du ^ dt));
using System;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
namespace AdventOfCodeDay8
{
class Program
{
static void Main(string[] args)
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AdventOfCodeDay7
{
class Program
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Drawing;
using System.Drawing.Imaging;
namespace AdventOfCodeDay6
{
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
namespace AdventOfCodeDay5
{
class MainClass
{
public static void Main (string[] args)
using System;
using System.Security.Cryptography;
using System.Text;
namespace AdventOfCodeDay4
{
class Program
{
static void Main()
{
// part 1
var input = "<input here>";
var visited = new List<Point> { new Point(0, 0) };
var x = 0;
var y = 0;
foreach (var d in input)
var paperNeeded = input.Select(a => new
{
SurfaceArea = 2 * a.Item1 * a.Item2 + 2 * a.Item1 * a.Item3 + 2 * a.Item2 * a.Item3,
Extra = Math.Min(Math.Min(a.Item1 * a.Item2, a.Item1 * a.Item3), a.Item2 * a.Item3)
}).Sum(b => b.SurfaceArea + b.Extra);
var ribbonNeeded = input.Select(a => new
{
Permiter = Math.Min(Math.Min(2 * (a.Item1 + a.Item3), 2 * (a.Item2 + a.Item3)), 2 * (a.Item2 + a.Item1)),
Extra = a.Item1 * a.Item2 * a.Item3