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
#include <windows.h> | |
#define DELIM(c) ((c) == ' ' || (c) == '\t') | |
static int | |
maybe_unescape(const TCHAR **src, volatile TCHAR **dst, int quot) { | |
const TCHAR *p; | |
int i, n; | |
p = *src; |
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
od -A n -v -t u1 | awk ' | |
BEGIN { | |
conv[0] = "/*%s*/ %s/4 /*%s*/" | |
conv[1] = "16*(%s%%4) + %s/16 /*%s*/" | |
conv[2] = "4*(%s%%16) + %s/64\n%s%%64" | |
tail[0] = "16*(%s%%4)\n64\n64" | |
tail[1] = "4*(%s%%16)\n64" | |
tail[2] = "/*%s*/" | |
state = 2 | |
} |
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
{ | |
gsub(/./, "& ") | |
for (x = 1; x <= NF; x++) | |
heat_loss[x, NR] = $x | |
} | |
END { | |
find_least_heat_loss(1, 3) | |
find_least_heat_loss(4, 10) | |
} |
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
BEGIN { | |
FS = "=|; |, | " | |
} | |
{ | |
flow_rate[$2] = $6 | |
for (i = 11; i <= NF; i++) | |
tunnels[$2, ++ntunnels[$2]] = $i | |
} |
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
BEGIN { | |
products[elements[1] = "111312211312113221133211322112211213322113"] \ | |
= "31131122211311122113222 12 312211322212221121123222113" | |
# {{{ | |
products[elements[2] = "111312211312113221133211322112211213322112"] \ | |
= "31131122211311122113222 12 312211322212221121123222112" | |
products[elements[3] = "1321132122211322212221121123222113"] \ | |
= "111312211312113221133211322112211213322113" | |
products[elements[4] = "1321132122211322212221121123222112"] \ | |
= "111312211312113221133211322112211213322112" |
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
BEGIN { | |
FS = " |," | |
} | |
{ | |
if (/toggle/) { | |
x1 = $2; y1 = $3 | |
x2 = $5; y2 = $6 | |
} | |
else { |
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
{ | |
gsub(/./, "& ") | |
} | |
NR == 1 { | |
for (i = 1; i <= NF; i++) | |
light[bin(i-1)] = ($i == "#") | |
next | |
} |
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
{ | |
adapters[$0] | |
} | |
$0 > max { | |
max = $0 | |
} | |
END { | |
adapters[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
#include <assert.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#define MAX_NAME 7 | |
#define NAME_FMT "%7[a-z] " | |
#define ALPHABET_SIZE 26 | |
#define IS_ALPHA(c) ((c) >= 'a' && (c) <= 'z') | |
#define TO_INDEX(c) ((c)-'a') | |
#define NAME_SIZE (MAX_NAME+1) |
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
{ | |
gsub(/./, "& ") | |
for(i = 1; i <= NF; i++) | |
risk_level[i, NR] = $i | |
} | |
END { | |
find_lowest_total_risk() |
NewerOlder