LOADING: An error occurred. Update Chrome, try Firefox, or visit this post for more details.

⚠️Reddit changed how removals work, which breaks Reveddit's website. Install the extension to track removed content:Add to chromeAdd to firefoxWhat changed?
✖︎
about reveddit
⚙F.A.Q.add-ons
r/
status
copy sharelink
[+] show filters
101
SOLUTION MEGATHREAD-🎄- 2022 Day 2 Solutions -🎄-(self.adventofcode)
submitted 3 years, 1 month ago* (edited 4 days, 4 hours after) by daggerdragon to /r/adventofcode (134.8k)
1501 commentsredditother-discussionssubreddit-indexmessage modsop-focus

NEW AND NOTEWORTHY

  • All of our rules, FAQs, resources, etc. are in our [community wiki](/r/adve...

... view full text

since 3 years, 1 month ago
1 of 1

Tip Reveddit Real-Time can notify you when your content is removed.

your account history
(check your username's removed content. why?)
Tip Check if your account has any removed comments.
view my removed comments
you are viewing a single comment's thread.
view all comments
[–][deleted]3 points3 years, 1 month ago

Flex:

%option noyywrap main

%{
#include <stdio.h>
#include <stdlib.h>
long score = 0, score2 = 0;
%}

%%

A\ X    {   score += (3 + 1);   score2 += (0 + 3);  }
A\ Y    {   score += (6 + 2);   score2 += (3 + 1);  }
A\ Z    {   score += (0 + 3);   score2 += (6 + 2);  }

B\ X    {   score += (0 + 1);   score2 += (0 + 1);  }
B\ Y    {   score += (3 + 2);   score2 += (3 + 2);  }
B\ Z    {   score += (6 + 3);   score2 += (6 + 3);  }

C\ X    {   score += (6 + 1);   score2 += (0 + 2);  }
C\ Y    {   score += (0 + 2);   score2 += (3 + 3);  }
C\ Z    {   score += (3 + 3);   score2 += (6 + 1);  }

\r?\n   {   }

<<EOF>> {   printf("%8ld %8ld\n",score,score2); return  0;  }

%%

This is the venerable Flex utility. It generates C code for you, which you then compile. The code looks for regular expressions from a source (by default stdin) and when it matches one it calls the { actions }. At EOF it prints the answer.

If you save it as an aoc.l file and try make aoc it should build with default make rules. Then do ./aoc < input.txt and you get the answers.

permalinkas-of
r/revedditremoved.substack.com
🚨 NEWS 🚨
✖︎

Important: Reddit Changed How Removals Work

A recent Reddit update makes mod-removed content disappear from profile pages, which breaks Reveddit's website.

Install the browser extension to receive removal alerts.

Add to chromeAdd to firefox

What changed?

r/revedditremoved.substack.com