Add preview of 1984-2019

The 2020 winners are hinted it, but the source code is not there,
nor are the hints. Someone could look into the HTML and
see what was commented out, but that is not a problem because
WHO won is known and the name of their AWARD is known already.
Moreover a number of the winners have talked about what their
entirs do, so the commented out spoiler text is not a bit problem.

One will find HTML commented out with:

    <!-- XXX remove when 2020 is ready
    2020 links here
    XXX remove when 2020 is ready -->

The "XXX remove when 2020 is ready" string is found at the
start and end comment blocks.  Again, soneone could read
what was commented out, but that is OK since most of that
information is known or can be known.  The following files
have such HTML comment blocks in them.

    ./winners.html
    ./years-spoiler.html
    ./years.html

In addition, ./all/summary.txt was modified to not
include the 2020 entries for the momemt.

The 2020 winner code AND write-ups are NOT part of this set.

p.s. The all/all.tar.bz2 does not contain the 2020 source code (yet?).
This commit is contained in:
Landon Curt Noll committed 2020-12-30 16:57:03 -08:00
1 parent 28efc67f5d
commit c0663537cb
1683 files changed
+220064

No files matched your search

+524
View File
@@ -0,0 +1,524 @@
#!/usr/bin/env make
#
# 2019 makefile
#
# This work by Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis
# is licensed under:
#
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
#
# See: http://creativecommons.org/licenses/by-sa/3.0/
#############################
# shell used by this Makefile
#############################
#
SHELL= /bin/bash
#######################
# common tool locations
#######################
#
A2P= a2p
AR= ar
ASA= asa
AT= at
ATQ= atq
ATRM= atrm
AWK= awk
BANNER= banner
BASE64= base64
BASENAME= basename
BATCH= batch
BC= bc
BINHEX= binhex
BISON= bison
BUNZIP2= bunzip2
BZCAT= bzcat
BZCMP= bzcmp
BZDIFF= bzdiff
BZEGREP= bzegrep
BZFGREP= bzfgrep
BZGREP= bzgrep
BZIP2= bzip2
BZLESS= bzless
BZMORE= bzmore
C2PH= c2ph
C89= c89
C99= c99
CAL= cal
CALC= calc
CAT= cat
CD= cd
CHFLAGS= chflags
CHGRP= chgrp
CHMOD= chmod
CKSUM= cksum
CLANG= clang
CLANG_PLUSPLUS= clang++
CLEAR= clear
CMP= cmp
COL= col
COLLDEF= colldef
COLRM= colrm
COLUMN= column
COMPRESS= compress
CP= cp
CPIO= cpio
CPP= cpp
CRC32= crc32
CSH= csh
CSPLIT= csplit
CURL= curl
CUT= cut
C_PLUSPLUS= c++
C_PLUSPLUS_FILT= c++filt
DATE= date
DC= dc
DD= dd
DF= df
DIFF3= diff3
DIFF= diff
DIG= dig
DIRNAME= dirname
ED= ed
EGREP= egrep
ENV= env
EQN= eqn
ETAGS= etags
EXPECT= expect
EXPR= expr
FALSE= false
FGREP= fgrep
FILE= file
FIND2PERL= find2perl
FIND= find
FLEX= flex
FLEX_PLUSPLUS= flex++
FMT= fmt
FOLD= fold
FS_USAGE= fs_usage
FUNZIP= funzip
FUSER= fuser
GCC= gcc
GDIFFMK= gdiffmk
GENCAT= gencat
GENSTRINGS= genstrings
GETOPT= getopt
GETOPTS= getopts
GNUMAKE= gnumake
GREP= grep
GROFF= groff
GROFFER= groffer
GROG= grog
GROPS= grops
GROTTY= grotty
GUNZIP= gunzip
GVIM= gvim
GZCAT= gzcat
GZEXE= gzexe
GZIP_PROG= gzip
G_PLUSPLUS= g++
H2PH= h2ph
H2XS= h2xs
HASH= hash
HEAD= head
HOSTNAME_PROG= hostname
ICONV= iconv
ID= id
INDENT= indent
INFO= info
JOT= jot
KILL= kill
KSH= ksh
LAST= last
LD= ld
LESSECHO= lessecho
LEX= len
LINK= link
LN= ln
LS= ls
M4= m4
MAKE= make
MAN= man
MKDIR= mkdir
MKFIFo= mkfifo
MKTEMP= mktemp
MV= mv
NANO= nano
NASM= nasm
NEQN= neqn
NICE= nice
NL= nl
NM= nm
NOHUP= nohup
NROFF= nroff
NSLOOKUP= nslookup
OD= od
OPENSSL= openssl
PASTE= paste
PATCH= patch
PATHCHK= pathchk
PAX= pax
PERL= perl
PICO= pico
PR= pr
PRINTENV= printenv
PS= ps
PTAR= ptar
PTARDIFF= ptardiff
PTARGREP= ptargrep
PWD= pwd
PYDOC= pydoc
PYTHON= python
PYTHONW= pythonw
READLINK= readlink
RENICE= renice
RESET= reset
REV= rev
RI= ri
RM= rm
RMDIR= rmdir
RSYNC= rsync
RUBY= ruby
RVIM= rvim
SAY= say
SCP= scp
SCREEN= screen
SCRIPT= script
SDIFF= sdiff
SED= sed
SEQ= seq
SFTP= sftp
SH= sh
SHA1= sha1
SHA= sha
SHAR= shar
SHASUM5_18= shasum5.18
SHASUM= shasum
SIZE= size
SLEEP= sleep
SORT= sort
SSH= ssh
STAT= stat
STRIP= strip
STTY= stty
SUM= sum
SYNC= sync
TABS= tabs
TAIL= tail
TAR= tar
TEE= tee
TEST= test
TFTP= tftp
TIDY= tidy
TIME= time
TOP= top
TOUCH= touch
TPUT= tout
TPUT= tput
TR= tr
TROFF= troff
TRUE= true
TSET= tset
TSORT= tsort
UL= ul
UNAME= uname
UNCOMPRESS= uncompress
UNEXPAND= unexpand
UNIFDEF= unifdef
UNIFDEFALL= unifdefall
UNIQ= uniq
UNITS= units
UNLINK= unlink
UNZIP= unzip
UNZIPSFX= unzipsfx
UPTIME= uptime
UUDECODE= uudecode
UUENCODE= uuencode
UUIDGEN= uuidgen
VI= vi
VIEW= view
VIM= vim
VIMDIFF= vimdiff
W= w
WAIT4PATH= wait4path
WAIT= wait
WC= wc
WHAT= what
WHATIS= whatis
WHICH= which
WHO= who
WHOAMI= whoami
WHOIS= whois
WRTIE= write
XAR= xar
XARGS= xargs
XATTR= xattr
XXD= xxd
YACC= yacc
YES= yes
ZCAT= zcat
ZCMP= zcmp
ZDIFF= zdiff
ZEGREP= zegrep
ZFGREP= zfgrep
ZFORCE= zforce
ZGREP= zgrep
ZIP= zip
ZIPCLOAK= zipcloak
ZIPGREp= zipgrep
ZIPINFo= zipinfo
ZIPNOTE= zipnote
ZIPSPLIT= zipsplit
ZLESS= zless
ZMORE= zmore
ZNEW= znew
ZPRINT= zprint
ZSH= zsh
# Set X11_LIBDIR to the directory where the X11 library resides
#
#X11_LIBDIR= /usr/X11R6/lib
#X11_LIBDIR= /usr/X11/lib
X11_LIBDIR= /opt/X11/lib
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
#
#X11_INCDIR= /usr/X11R6/include
#X11_INCDIR= /usr/X11/include
X11_INCDIR= /opt/X11/include
# Compiler warnings
#
#CWARN=
#CWARN= -Wall
#CWARN= -Wall -Wextra
CWARN= -Wall -Wextra -pedantic ${CSILENCE}
#CWARN= -Wall -Wextra -Weverything
#CWARN= -Wall -Wextra -Weverything -pedantic
#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE}
# Silence warnings that ${CWARN} would normally complain about
#
CSILENCE=
#CSILENCE= -Wno-implicit-int
# compiler standard
#
#CSTD=
#CSTD= -ansi
CSTD= -std=c11
# compiler bit architecture
#
# Some entries require 32-bitness:
# ARCH= -m32
#
# Some entries require 64-bitness:
# ARCH= -m64
#
# By default we assume nothing:
#
ARCH=
# defines that are needed to compile
#
CDEFINE=
#CDEFINE= -DIOCCC=26
# include files that are needed to compile
#
CINCLUDE=
#CINCLUDE= -include stdlib.h
#CINCLUDE= -include stdio.h
#CINCLUDE= -include stdlib.h -include stdio.h
#CINCLUDE= -I ${X11_INCDIR}
# optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
# Reasonable compilers will allow for -O3.
#
#OPT=
#OPT= -O
#OPT= -O1
#OPT= -O2
OPT= -O3
# default flags for ANSI C compilation
#
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# Libraries needed to build
#
LIBS=
#LIBS= -L ${X11_LIBDIR}
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
# Some entries seem to need gcc. If you have gcc, set
# both CC and MAY_NEED_GCC to gcc.
#
# If you do not have gcc, set CC to the name of your ANSI compiler, and
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
# to disable such programs.
#
CC= cc
#CC=clang
MAY_NEED_GCC= gcc
##############################
# Special flags for this entry
##############################
#
OBJ= prog.o
DATA=
TARGET= prog
#
ALT_OBJ=
ALT_TARGET=
#################
# build the entry
#################
#
all: ${TARGET} ${DATA}
@${TRUE}
prog: prog.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
# alternative executable
#
alt: ${ALT_TARGET}
@${TRUE}
# data files
#
data: ${DATA}
@${TRUE}
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${OBJ} ${ALT_OBJ}
clobber: clean
${RM} -f ${TARGET} ${ALT_TARGET}
@-if [ -e sandwich ]; then \
${RM} -f sandwich; \
echo 'ate sandwich'; \
fi
nuke: clobber
@${TRUE}
dist_clean: nuke
@${TRUE}
install:
@echo "Surely you are performing, Dr. May!"
@${TRUE}
# backwards compatibility
#
build: all
@${TRUE}
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
@${TRUE}
haste:
$(MAKE) waste
@${TRUE}
waste:
@echo 'haste'
@${TRUE}
make:
@echo 'Attend a maker faire'
@${TRUE}
easter_egg:
@echo you expected to often mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Eggy
fabricate fashion form frame manufacture produce: make
@${TRUE}
sandwich:
@if [ `id -u` -eq 0 ]; then \
echo 'Okay.'; \
echo $${RANDOM}`date +%s`$${RANDOM} > $@; \
else \
echo 'What? Make it yourself.'; \
exit 1; \
fi
# Understand the history of the Homebrew Computer Club
# as well as the West Coast Computer Faire and
# you might be confused different. :-)
#
supernova: nuke
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v6; \
else \
echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \
fi
@echo A $@ helps ${MAKE} the elements that help form planets
@${TRUE}
deep_magic:
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic fc6b6af226b7cc598de3d48fc20ed0bd54f7b4f7f0f651a32b9cf8345b2a3b3f --FNV1a_hash_512_bit "prog"; \
else \
echo "Wrong! Do it again!"; \
sleep 2; \
echo "Wrong! Do it again!"; \
sleep 2; \
echo "Wrong! Do it again!"; \
fi
@${TRUE}
magic: deep_magic
@-if [ -r .code_anal ]; then \
ccode_analysis --level 391581 --mode 216193 --FNV1a_hash_512_bit "prog"; \
else \
echo "If you don't eat yer meat, you can't have any pudding!"; \
echo "How can you have any pudding if you don't eat yer meat?!"; \
fi
@${TRUE}
# The IOCCC resident astronomer states
#
charon: supernova
@echo $@ is a dwarf planet
@echo dwarf is a type of planet
@echo therefore IAU, $@ is a planet
pluto: supernova
${MAKE} charon
@echo $@ is a dwarf planet
@echo dwarf is a type of planet
@echo therefore, $@ is a planet
@echo get used to having lots of planets because a $< can ${MAKE} a lot of them
+237
View File
@@ -0,0 +1,237 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="GENERATOR" content="mkd2html 2.2.0">
<meta http-equiv="Content-Type"
content="text/html; charset=utf-8"> <link rel="stylesheet"
type="text/css"
href="../hint.css">
<title>Most in need of transparency</title>
</head>
<body>
<h1>Most in need of transparency</h1>
<p>Don Yang<br>
<a href="http://uguu.org/">http://uguu.org/</a></p>
<h2>Judges' comments:</h2>
<h3>To use:</h3>
<pre><code>make
./prog sample_input.txt a b c d
cat a
cat b
cat c
cat d
cat a b c d | ./prog
</code></pre>
<h3>Try:</h3>
<pre><code>./prog prog.c a b c d e
cat a
cat b
cat c
cat d
cat e
cat a b c d e | ./prog
cat a b c d e | ./prog | diff - prog.c
</code></pre>
<h3>Selected Judges Remarks:</h3>
<p>Do you understand how this program works?
You may have to go over and over the output again.</p>
<h2>Author&rsquo;s comments:</h2>
<h1>Summary</h1>
<p>Scramble/unscramble to single file:</p>
<pre><code>./prog original.txt &gt; scrambled.txt
./prog &lt; scrambled.txt &gt; unscrambled.txt
</code></pre>
<p>Scramble/unscramble to multiple files:</p>
<pre><code>./prog input.txt output1.txt output2.txt ...
cat output1.txt output2.txt ... | ./prog &gt; unscrambled.txt
</code></pre>
<p>Re-scramble:</p>
<pre><code>./prog original.txt | ./prog - &gt; scrambled1.txt
./prog original.txt | ./prog - | ./prog - &gt; scrambled2.txt
./prog original.txt | ./prog - | ./prog - | ... &gt; scrambled3.txt
</code></pre>
<p>Scramble slowly:</p>
<pre><code>./prog input.txt | ruby prog.c
</code></pre>
<p>Input must be in UTF-8 encoding.</p>
<h1>Details</h1>
<p>This is a text scrambling utility. To scramble text, specify input
file name as the first argument:</p>
<pre><code>./prog input.txt &gt; output.txt
</code></pre>
<p>If original input file was small enough to fit in your terminal, you
can simply use <code>cat</code> to unscramble the output text.</p>
<pre><code>cat output.txt
</code></pre>
<p>It might seem like nothing was scrambled, but you can try passing the
output through <code>strings(1)</code> and see that most of the original strings
are gone. What happened is that the original text has been shuffled
with ANSI cursor positioning codes inserted such that characters are
printed in random order. This effect is more visible if there is a
delay after each character is printed. For convenience, an utility is
included in the source to output characters slowly:</p>
<pre><code>./prog input.txt | ruby prog.c
</code></pre>
<p>Scrambling order is deterministic, but you can reshuffle the output by
piping it through the same utility again, by specifying <code>-</code> as the
first argument:</p>
<pre><code>./prog input.txt | ./prog - | ./prog - | ...
</code></pre>
<p>You can also split the input to multiple files, each getting a subset
of the original input characters:</p>
<pre><code>./prog input.txt output1.txt output2.txt ...
cat output1.txt output2.txt ... &gt; unscrambled.txt
</code></pre>
<p>You can only unscramble files with <code>cat</code> if the input fits in a single
terminal screen. If you don&rsquo;t know what will be the terminal size of
the recipient, note that <code>prog.c</code> will fit in a 80x25 terminal, so a
good guideline is to pick files that have fewer rows and columns than
<code>prog.c</code>.</p>
<p>For files that are larger than your terminal window, <code>cat</code> will not be
sufficient for unscrambling because any scrolling causes the character
positions to be misaligned. But fear not, this utility also includes
unscrambling functionality. If no argument is specified, input will
be read through stdin and unscrambled to stdout:</p>
<pre><code>./prog &lt; scrambled.txt &gt; unscrambled.txt
</code></pre>
<p>Where this is useful is that if you scramble the input to multiple
files and unscramble each output files individually, those output
files can be printed on transparencies and distributed separately.</p>
<pre><code>./prog input.txt output1.txt output2.txt output3.txt
./prog &lt; output1.txt &gt; layer1.txt
./prog &lt; output2.txt &gt; layer2.txt
./prog &lt; output3.txt &gt; layer3.txt
</code></pre>
<p>In other words, this is a utility for facilitating
<a href="https://en.wikipedia.org/wiki/Visual_cryptography">visual cryptography</a>.</p>
<p>This utility can also be used just for removing trailing whitespaces
and expanding tabs to 8 spaces.</p>
<pre><code>./prog input.txt | ./prog
</code></pre>
<h1>Features</h1>
<h2>UTF-8 support</h2>
<p>A simple text scrambling utility might not have required a screenful
of code, but this particular one natively supports UTF-8.
Specifically: individual UTF-8 byte sequences will not be split into
broken ones, and the utility is aware of full-width versus half-width
differences such that cursor is positioned correctly for most CJK
input. <code>sample_input.txt</code> demonstrates this feature with a mix of
Basic Latin and Japanese characters.</p>
<p>Output cursor positions will most definitely be wrong for inputs
containing combining characters and right-to-left text, but it should
be possible to unscramble those text back to the original using this
same utility, since the utility is self-consistent in how cursor
positions are handled.</p>
<h2>Error handling</h2>
<p>If any file can not be opened for reading or writing, an error is
printed to stderr, and the utility will exit with nonzero status.</p>
<p>If there isn&rsquo;t enough memory, the utility will likely crash.</p>
<p>If input contains CR-LF end of line sequences, those CRs are silently
dropped. In fact, most control codes are silently ignored except line
feeds (preserved) and tabs (expanded to 8 spaces).</p>
<h2>Compatibility</h2>
<p>Verified to work and compiles without warnings on these environments:</p>
<ul>
<li> gcc 7.3.0 on Linux</li>
<li> gcc 7.4.0 on Cygwin</li>
<li> clang 4.0.1-10 on Linux</li>
<li> clang 5.0.1 on Cygwin</li>
<li> gcc 4.8.4 on Linux</li>
</ul>
<h2>Full version</h2>
<p>I tried really hard to make <code>prog.c</code> fit in a 80x25 terminal without
wrapping. If I were not constrained by space, I would have made an
ASCII art out of it. <code>violet.c</code> is that program, and also comes with
the minor benefit of supporting lines longer than a million columns
depending on <code>sizeof(int)</code>.</p>
<p>Violet is named after &ldquo;Violet Evergarden&rdquo;, the character who is highly
skilled in writing letters.</p>
<hr />
<!--
(c) Copyright 1984-2019, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
[judges]: http://www.ioccc.org/judges.html
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
-->
<TABLE><TR>
<TD><a rel="license" href="https://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="/png/by-sa-3.0-88x31.png" /></a></TD>
<TD><P>&copy; Copyright 1984-2019,
<A HREF="/judges.html">Leo Broukhis, Simon Cooper, Landon Curt Noll</A>
- All rights reserved<BR>
This work is licensed under a <a rel="license" href="https://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>.</P></TD>
<TD>&nbsp;<!--<a href="https://validator.w3.org/check?uri=referer"><img src="https://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88"></a>--></TD>
</TR></TABLE>
</body>
</html>
+196
View File
@@ -0,0 +1,196 @@
# Most in need of transparency
Don Yang
<http://uguu.org/>
## Judges' comments:
### To use:
make
./prog sample_input.txt a b c d
cat a
cat b
cat c
cat d
cat a b c d | ./prog
### Try:
./prog prog.c a b c d e
cat a
cat b
cat c
cat d
cat e
cat a b c d e | ./prog
cat a b c d e | ./prog | diff - prog.c
### Selected Judges Remarks:
Do you understand how this program works?
You may have to go over and over the output again.
## Author's comments:
# Summary
Scramble/unscramble to single file:
./prog original.txt > scrambled.txt
./prog < scrambled.txt > unscrambled.txt
Scramble/unscramble to multiple files:
./prog input.txt output1.txt output2.txt ...
cat output1.txt output2.txt ... | ./prog > unscrambled.txt
Re-scramble:
./prog original.txt | ./prog - > scrambled1.txt
./prog original.txt | ./prog - | ./prog - > scrambled2.txt
./prog original.txt | ./prog - | ./prog - | ... > scrambled3.txt
Scramble slowly:
./prog input.txt | ruby prog.c
Input must be in UTF-8 encoding.
# Details
This is a text scrambling utility. To scramble text, specify input
file name as the first argument:
./prog input.txt > output.txt
If original input file was small enough to fit in your terminal, you
can simply use `cat` to unscramble the output text.
cat output.txt
It might seem like nothing was scrambled, but you can try passing the
output through `strings(1)` and see that most of the original strings
are gone. What happened is that the original text has been shuffled
with ANSI cursor positioning codes inserted such that characters are
printed in random order. This effect is more visible if there is a
delay after each character is printed. For convenience, an utility is
included in the source to output characters slowly:
./prog input.txt | ruby prog.c
Scrambling order is deterministic, but you can reshuffle the output by
piping it through the same utility again, by specifying `-` as the
first argument:
./prog input.txt | ./prog - | ./prog - | ...
You can also split the input to multiple files, each getting a subset
of the original input characters:
./prog input.txt output1.txt output2.txt ...
cat output1.txt output2.txt ... > unscrambled.txt
You can only unscramble files with `cat` if the input fits in a single
terminal screen. If you don't know what will be the terminal size of
the recipient, note that `prog.c` will fit in a 80x25 terminal, so a
good guideline is to pick files that have fewer rows and columns than
`prog.c`.
For files that are larger than your terminal window, `cat` will not be
sufficient for unscrambling because any scrolling causes the character
positions to be misaligned. But fear not, this utility also includes
unscrambling functionality. If no argument is specified, input will
be read through stdin and unscrambled to stdout:
./prog < scrambled.txt > unscrambled.txt
Where this is useful is that if you scramble the input to multiple
files and unscramble each output files individually, those output
files can be printed on transparencies and distributed separately.
./prog input.txt output1.txt output2.txt output3.txt
./prog < output1.txt > layer1.txt
./prog < output2.txt > layer2.txt
./prog < output3.txt > layer3.txt
In other words, this is a utility for facilitating
[visual cryptography](https://en.wikipedia.org/wiki/Visual_cryptography).
This utility can also be used just for removing trailing whitespaces
and expanding tabs to 8 spaces.
./prog input.txt | ./prog
# Features
## UTF-8 support
A simple text scrambling utility might not have required a screenful
of code, but this particular one natively supports UTF-8.
Specifically: individual UTF-8 byte sequences will not be split into
broken ones, and the utility is aware of full-width versus half-width
differences such that cursor is positioned correctly for most CJK
input. `sample_input.txt` demonstrates this feature with a mix of
Basic Latin and Japanese characters.
Output cursor positions will most definitely be wrong for inputs
containing combining characters and right-to-left text, but it should
be possible to unscramble those text back to the original using this
same utility, since the utility is self-consistent in how cursor
positions are handled.
## Error handling
If any file can not be opened for reading or writing, an error is
printed to stderr, and the utility will exit with nonzero status.
If there isn't enough memory, the utility will likely crash.
If input contains CR-LF end of line sequences, those CRs are silently
dropped. In fact, most control codes are silently ignored except line
feeds (preserved) and tabs (expanded to 8 spaces).
## Compatibility
Verified to work and compiles without warnings on these environments:
* gcc 7.3.0 on Linux
* gcc 7.4.0 on Cygwin
* clang 4.0.1-10 on Linux
* clang 5.0.1 on Cygwin
* gcc 4.8.4 on Linux
## Full version
I tried really hard to make `prog.c` fit in a 80x25 terminal without
wrapping. If I were not constrained by space, I would have made an
ASCII art out of it. `violet.c` is that program, and also comes with
the minor benefit of supporting lines longer than a million columns
depending on `sizeof(int)`.
Violet is named after "Violet Evergarden", the character who is highly
skilled in writing letters.
--------------------------------------------------------------------------------
<!--
(c) Copyright 1984-2019, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
[judges]: http://www.ioccc.org/judges.html
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
-->
+23
View File
@@ -0,0 +1,23 @@
#include<stdio.h>
#include<stdlib.h>/*
e=nil;ARGF.each_char{|c|print c;e=e ?c<"A"||c>"Z":c=="\e"?1:!(sleep 0.1)};%q{*/
#define T(_,S,C,R,A,M,B,L,E) _ V,i,o,l,e,t=1,n[4],I[22]={4352,95,4554,1,2902,4\
46,2,29839,1841,11171,8541,511,785,9,23,63,145,96,128,6,61466,135167},g=240,H,\
h,p,q,x,y;typedef struct{_ x,y,z;}b;b*U,u;FILE*f;A m(_ p,_ q){_ d=(p+q)/2;C(d-\
p){m(p,d);m(d,q);S(i=p,o=d,y=H+p;y<H+q;y++)x=i>=d||(o<q&&U[i].y*1e6+U[i].x>U[o\
].y*1e6+U[o].x)?o++:i++,B;S(y=p,x=H+p;y<q;x++,y++)B;}}A v(){S(i=l=0;i<22&&(o=l\
+I[i++],l=o+I[i],e<o||e>l);i++);x+=2-i/22;}A a(){C(H+2>t)U=(b*)realloc(U,(t*=2\
)*24);U[H].x=x;U[H].y=y;U[H++].z=e;p=p>y?y:p;q=q<y?y:q;v();}A P(_ p){n[o=0]=e=\
p;C(p>>7){S(;p>63>>o;p>>=6)n[o++]=(p&63)|128;n[o]=(g*8>>o&g)|p;}S(;o>-1;)fputc\
(n[o--],f);}A Q(_ O){O?fprintf(f,"\33[%d%c",abs(O),V+(O>0)):0;V^=2;}R d[2]="r"\
;_ main(_ O,R**Z){f=stdin;C(--O&&(**++Z-45||1[*Z])&&--Z&&L)M;S(*d|=5;(e=fgetc(\
f))>0;h=h<0?e-91?e<48||e>59?l*=(e&2)-1,e>64&&e<67?y+=l,0:e<69&&(x+=l)<0?x=0:0:\
~(l=l*10+e-48):h:h?(e=l=l<<6|(e&63),!--h)?a(),h:h:(e&224)==192?l=e&31,1:(e&g)=\
=224?l=e&15,2:(248&e)==g?l=e&7,3:e-27?e==10?y++,x=0:e-32?e==9?x=(x+8)&~7:e>32?\
a(),h:h:x++,h:~(l=0))V+=(V+e)<<10,V^=V>>6;E;f=stdout;C(U){C(O<1){m(0,U[H].x=H)\
;S(h=x=0,y=p;h<H;v()){S(;y<U[h].y;y++,x=0)P(10);S(;x<U[h].x;x++)P(32);S(;h<H&&\
U[++h].y==y&&U[h].x==x;);P(U[h-1].z);}C(x)P(10);}else{srand(V);S(x=H;--x;B)y=r\
and()%-~x;C(--O?L:O++)M;S(t=h=0,y=q+1;h<H&&t<O;E){C(t&&L)M;C(!t)S(h=q-p+2;--h;\
)P(10);S(V=65;h<H*-~t/O;y=U[h++].y)Q(U[h].y-y),Q(x-U[h].x),P(U[h].z),x=U[h].x,v
T(int,for,if,char,void,goto X,(u=U[x],U[x]=U[y],U[y]=u),((f=fopen(*++Z,d))?0:-(
perror(*Z),1)),fclose(f))();Q(q-y);P(10);y=q+1;x=!++t;}}}O=0;X:return O;}/*}#*/
+15
View File
@@ -0,0 +1,15 @@
アイ オォ
あい オ汚雄 しい シシシシシ
アィ おぉ おお (*゚ー゚) シシシシシシシ cCCCCCCc
あぃ オお オォ しぃ シシ シシシ cCCCCc CC
IIII oお Oオ しー シシ cCCC
藍愛 おO ォ しい シシ CCC
哀合 OoO oOO 詩 シシ CCc
iiii おぉ ォオ 強い シシ シシシ CCCc
あぁ おおo ぉオオ しい シシシシシシ CCCCc cCc
ぁあ おぉおぉお しぃしぃしっ シシシシ CCCCccCCC
(*゚ー゚)
+34
View File
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html><head>
<title>Replay text</title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<style type="text/css">
.tmp{color:#00f}.final{color:#000}</style>
</head><body>
<noscript><span style="color:red">JavaScript required</span></noscript>
<script type="text/javascript">
var realtime_step=80;var fps=1000/realtime_step;var current_event=0;var current_time;var step=0;var slots=new Array(1422);var update_slots=new Array(slots.length);var max_time=27439000;var max_file_size=478;var timer=null;var follow=1;var fast_scroll=1;var opacity=100;var opacity_timer=null;var string_table=
[" 224?l=e&amp;15,","e = nil; ARGF.each_char{|c| print c; e = e ? (u = c.upcase) &lt; \"A\" || u &gt; \"Z\" : c == \"\\e\" ? 1 : !(sleep 0.1)","t, o )","a (){","c &lt; \'0\' || c &gt; \';\'","racter_count; i++)","if ((-- O) ? r(*++Z) :O++){ D ( g , o","s ( ){","nb","f)) &gt; 0;","oi",") * 24);","; }/*","= 224","h, p,","( 0 &lt;x)P(-~ 9);}D( el, s , e","u,d )) ?","0?O","l = e % 4 &lt; 2 ? -l : l,",", n, t)r","x &gt; 0;s()){","d input characters to global buffer */","*/","p )","{ \\","} \\","/(","y++;","[","m(0 , U [H].x=H);for(h= x=0 ,y =","1","].y * 1e6 + U[o].x) ? o++ : i++,","+ I[i++],",".","\'","w","b * = NULL;","goto fail;","&lt;","&gt; 0 ;s()){V =D(ra,n,d)(","_ ","\"\\33\" \"[%d%c\",l ,V +(O&gt;0) ):0; V ^=2 ;}D(vo,i, d ) P ( _ p){;E [ o =0] = e=p","&amp; g )| p; }for(;o &gt;- 1 ;D(f,pu,","240","-byte UTF-8 sequence */","U[++h].y == y &amp;&amp; U[h].x == x;);"," } \\"," { \\"," } \\"," { \\","Char *characters = NULL;","? y:p;"," \\"," { goto X; } if( !t ) for(h = q - p + 2; --h;) P(10); for(V = 65;",":-O,V+ (O&gt;0)):0;","L"," } b;","|","v ();}","8","\\","3"," \\","E","S"," } \\","F8","X :"," { \\","A P(_ p) \\","6","q","j","%q{*/","46, 2, 29839,","I","T(int, for,","O ; }/*","!(f = fopen(u, d)) ? perror(u), 1 : 0","#*/","k"," \\"," /* Some other sequenc"," \\"," },p , q ,x, y"," else \\","7","N"," \\"," P(10); \\","5","9","W"," \\"," {P(10);}D( f, o ,r"," H, "," \\"," V, i, o, l, e, t = 1, ","D ( c , h , ar) d[2 ]=\"r\";D(i","R d[2] = \"r\"; \\","int OpenHandle(const char"," y = q + 1; \\"," },p , q ,x, y"," r = i &lt; m &amp;&amp; j &lt; "," \\"," \\"," \\"," : e &lt; 69 &amp;&amp; (x += l) &lt; 0 ? x = 0 \\"," P(10); \\"," expression, such that it\'s only incremented if the condition"," g = 240, "," h, "," /* Write one sential cha"," O ? fprintf(f, \"\\33[%d%c\", abs(O), V + (O &gt; 0)) : 0; ","/* Open a file fo"," \\"," \\"," \\"," {P(10);}D( f, o ,r"," return;"," I[22] = "," p, "," q, "," V ^= 2; ","B","G","M"," \\"," \\"," =6 * 40, V , i , o , l , Line truncated
var events=
[0,500,0,0,0,0,0,1000,1,1,0,0,500,500,0,0,0,0,500,250,0,0,0,0,0,15461000,1,1,79,1,250,250,0,0,0,1,0,15460750,2,1,6,1,250,250,0,0,0,2,0,15460500,2,1,8,1,250,250,0,0,0,3,0,15460250,2,1,4,1,250,125,0,0,0,4,0,15460000,2,1,18,1,125,125,0,0,0,5,0,15459875,2,1,16,1,125,125,0,0,0,6,0,15459750,2,1,21,1,125,125,0,0,0,7,0,15459625,2,1,1,1,125,125,0,0,0,8,0,15459500,2,1,38,4,125,125,0,0,0,9,0,15459375,2,1,7,1,125,125,0,0,0,10,0,15459250,2,1,2,1,125,125,0,0,0,11,0,15459125,2,1,21,1,125,200,0,0,0,12,0,15459000,2,1,6,1,200,200,0,0,0,13,0,15458800,2,1,10,1,200,200,0,0,0,14,0,15458600,2,1,33,1,200,200,0,0,0,15,0,15458400,2,1,14,1,200,200,0,0,0,16,0,15458200,2,1,39,4,200,500,0,0,0,16,500,500,0,0,0,16,500,500,0,0,1,0,0,75125,1,2,0,0,500,500,0,0,1,0,0,500,1,1006,0,0,500,200,0,0,2,0,0,12871000,1,1006,6,1,200,200,0,0,2,1,0,12870800,2,1006,8,1,200,200,0,0,2,2,0,12870600,2,1006,2,1,200,200,0,0,2,3,0,12870400,2,1006,0,1,200,200,0,0,2,4,0,12870200,2,1006,29,1,200,125,0,0,2,5,0,12870000,2,1006,3,1,125,125,0,0,2,6,0,12869875,2,1006,6,1,125,125,0,0,2,7,0,12869750,2,1006,8,1,125,125,0,0,2,8,0,12869625,2,1006,15,1,125,125,0,0,2,9,0,12869500,2,1006,6,1,125,125,0,0,2,10,0,12869375,2,1006,8,1,125,125,0,0,2,11,0,12869250,2,1006,2,1,125,125,0,0,2,12,0,12869125,2,1006,0,1,125,125,0,0,2,13,0,12869000,2,1006,3,1,125,125,0,0,2,14,0,12868875,2,1006,5,1,125,125,0,0,2,15,0,12868750,2,1006,37,1,125,125,0,0,2,16,0,12868625,2,1006,4,1,125,125,0,0,2,17,0,12868500,2,1006,19,1,125,125,0,0,2,18,0,12868375,2,1006,0,1,125,125,0,0,2,19,0,12868250,2,1006,4,1,125,125,0,0,2,20,0,12868125,2,1006,14,1,125,100,0,0,2,21,0,12868000,2,1006,3,1,100,100,0,0,2,22,0,12867900,2,1006,5,1,100,100,0,0,2,23,0,12867800,2,1006,0,1,100,100,0,0,2,24,0,12867700,2,1006,22,1,100,100,0,0,2,25,0,12867600,2,1006,22,1,100,100,0,0,2,26,0,12867500,2,1006,3,1,100,100,0,0,2,27,0,12867400,2,1006,5,1,100,100,0,0,2,28,0,12867300,2,1006,37,1,100,100,0,0,2,29,0,12867200,2,1006,58,1,100,100,0,0,2,30,0,12867100,2,1006,11,1,100,166,0,0,2,31,0,166,1,1007,0,0,166,167,0,0,3,0,0,14507834,1,1007,24,1,167,167,0,0,3,1,0,167,1,1412,0,0,167,166,0,0,4,0,0,3470166,1,1412,25,1,166,167,0,0,4,0,167,167,0,0,4,0,167,250,0,0,3,0,250,250,0,0,4,0,0,250,1,1411,0,0,250,250,0,0,4,0,0,3469166,1,1411,0,3,250,250,0,0,4,3,0,3468916,2,1411,5,1,250,111,0,0,4,4,0,3468666,2,1411,1,1,111,111,0,0,4,5,0,3468555,2,1411,2,1,111,111,0,0,4,6,0,3468444,2,1411,16,1,111,111,0,0,4,7,0,3468333,2,1411,5,1,111,111,0,0,4,8,0,3468222,2,1411,8,1,111,111,0,0,4,9,0,3468111,2,1411,0,1,111,111,0,0,4,10,0,3468000,2,1411,17,1,111,111,0,0,4,11,0,3467889,2,1411,12,1,111,112,0,0,4,11,112,111,0,0,4,11,111,111,0,0,3,0,111,111,0,0,2,11,111,111,0,0,2,0,0,111,1,13,0,0,111,111,0,0,2,0,0,556,1,13,7,1,111,111,0,0,2,1,0,445,2,13,2,1,111,111,0,0,2,2,0,334,2,13,16,1,111,111,0,0,2,3,0,223,2,13,5,1,111,112,0,0,2,4,0,112,2,13,4,1,112,166,0,0,2,5,0,166,1,13,2704,4,166,167,0,0,2,4,0,167,1,13,2704,3,167,167,0,0,2,3,0,4067,1,13,499,2,167,166,0,0,2,2,0,3900,2,13,5,1,166,167,0,0,2,3,0,3734,2,13,16,1,167,167,0,0,2,4,0,3567,2,13,4,1,167,333,0,0,2,5,0,3400,2,13,2,1,333,333,0,0,2,6,0,3067,2,13,0,1,333,334,0,0,2,7,0,2734,2,13,50,1,334,1000,0,0,2,8,1000,500,0,0,2,8,0,1400,2,13,14,1,500,500,0,0,2,9,0,900,2,13,3,1,500,200,0,0,2,10,0,400,2,13,5,1,200,200,0,0,2,11,0,200,2,13,0,1,200,200,0,0,2,12,0,1041266,1,13,11247,11,200,200,0,0,2,11,0,200,1,14,0,0,200,200,0,0,3,0,0,13207600,1,14,24,1,200,166,0,0,3,1,0,166,1,42,0,0,166,167,0,0,4,0,0,1044167,1,42,25,1,167,167,0,0,4,1,0,1044000,2,42,12,1,167,166,0,0,4,2,0,48375,1,43,0,0,166,167,0,0,5,0,167,167,0,0,4,0,167,125,0,0,4,0,0,125,1,15,0,0,125,125,0,0,4,0,0,9991375,1,15,0,3,125,125,0,0,4,3,0,9991250,2,15,6,1,125,125,0,0,4,4,0,9991125,2,15,8,1,125,125,0,0,4,5,0,9991000,2,15,2,1,125,125,0,0,4,6,0,9990875,2,15,0,1,125,125,0,0,4,7,0,9990750,2,15,20,1,125,125,0,0,4,8,0,9990625,2,15,19,1,125,200,0,0,4,9,0,9990500,2,15,0,1,200,200,0,0,4,10,0,9990300,2,15,27,1,200,200,0,0,4,11,0,9990100,2,15,12,1,200,200,0,0,4,12,0,73233,1,41,0,3,200,200,0,0,5,3,0,73033,2,41,6,1,200,250,0,0,5,4,0,72833,2,41,8,1,250,250,0,0,5,5,0,72583,2,41,2,1,250,250,0,0,5,6,0,72333,2,41,0,1,250,250,0,0,5,7,0,72083,2,41,4,1,250,200,0,0,5,8,0,71833,2,41,10,1,200,200,0,0,5,9,0,71633,2,41,21,1,200,200,0,0,5,10,0,71433,2,41,1,1,200,200,0,0,5,11,0,71233,2,41,12,1,200,200,0,0,5,11,200,1000,0,0,5,11,1000,1000,0,0,6,1,1000,333,0,0,7,0,333,333,0,0,8,11,333,334,0,0,9,0,334,166,0,0,10,0,0,166,1,1009,0,0,166,167,0,0,10,0,0,5334,1,1009,0,3,167,167,0,0,10,3,0,5167,2,1009,35,1,167,166,0,0,10,4,0,5000,2,1009,14,1,166,167,0,0,10,5,0,4834,2,1009,6,1,167,167,0,0,10,6,0,4667,2,1009,18,1,167,250,0,0,10,7,0,4500,2,1009,1,1,250,250,0,0,10,8,0,4250,2,1009,15,1,250,250,0,0,10,9,0,4000,2,1009,0,1,250,250,0,0,10,9,250,166,0,0,10,9,166,167,0,0,10,3,0,26834,1,1008,0,3,167,167,0,0,10,3,0,26667,2,1008,6,1,167,166,0,0,10,4,0,26500,2,1008,8,1,166,167,0,0,10,5,0,26334,2,1008,2,1,167,167,0,0,10,6,0,26167,2,1008,0,1,167,200,0,0,10,7,0,26000,2,1008,4,1,200,200,0,0,10,8,0,25800,2,1008,12,1,200,200,0,0,10,8,200,200,0,0Line truncated
events.push(1);events.push(0);function e(id){return document.getElementById(id);}function Init(){var t0=0;for(var i=0;i<events.length;i+=6){events[i]+=t0;t0=events[i];if(events[i+1]==0) events[i+1]=max_time+1;else events[i+1]+=events[i];}var background='<pre style="margin:0px">\n';for(var i=0;i<max_file_size;i++)
background+="\n";background+="<\57pre>";var layer_style="position:absolute;top:0px;left:0px;margin:0px;";document.write(
'<div style="position:fixed;top:0px;right:0px;padding:2px;background-color:#fff;border:1px solid #00f;z-index:3" onmouseover="ForegroundControl()" onmouseout="BackgroundControl()" id=control><input type=button value="play 1x" onclick="Play(1)"> <input type=button value="play 3x" onclick="Play(3)"> <input type=button value="play 10x" onclick="Play(10)"> <input type=button value="play 30x" onclick="Play(30)"> <input type=button value="play 60x" onclick="Play(60)"> <input type=button value="pause" onclick="Pause()"> <input type=button value="rewind" onclick="Rewind()"><br><input type=checkbox id=follow name=follow onclick="Follow(this.checked)" checked> <label for=follow>Follow cursor (<span id=cursor_text><\57span>)<\57label> <input type=checkbox id=fast name=fast onclick="FastScroll(this.checked)" checked> <label for=fast>Fast scroll<\57label> <input type=checkbox id=tmp name=tmp onclick="Highlight(this.checked)" checked> <label for=tmp>Highlight transient lines<\57label><br><input type=range name=position id=position min=0 max='+max_time+' step=1 value=0 style="width:400px" onchange="InputSeek(this.value)"> <span id=time><\57span><\57div><div style="position:relative;border:1px solid">'+background+
'<pre style="'+layer_style+'background-color:#fff;color:#fff;z-index:1" id=cursor><\57pre><pre style="'+layer_style+'color:#000;z-index:2" id=text><\57pre><\57div>');var output=e("text");for(var i=0;i<slots.length;i++){var span=document.createElement("span");span.id="slot"+i;output.appendChild(span);}Rewind();}function Animate(){Seek(current_time+step);UpdateProgress();}function Play(speed){step=realtime_step*speed;if(timer)
clearTimeout(timer);timer=setTimeout("Animate()",realtime_step);}function Pause(){if(step!=0){step=0;Seek(current_time);UpdateProgress();}else{Play(1);}}function Reset(){for(var i=0;i<slots.length;i++){slots[i]=null;update_slots[i]="";var x=e("slot"+i);x.innerHTML="";x.className="tmp";x.style.display="none";}current_event=0;}function Scroll(){var c=e("cursor_block");if(c){var y=c.offsetTop;y-=64;if(y<0) y=0;var delta=y-window.scrollY;if(!fast_scroll||(delta>-80 && delta<window.innerHeight-64))
delta/=fps;if(Math.abs(delta)>0){window.scrollTo(window.scrollX,window.scrollY+delta);return true;}}return false;}function ResetScroll(){if(Scroll())
timer=setTimeout("ResetScroll()",realtime_step);}function Rewind(){Reset();step=0;Seek(0);UpdateProgress();if(follow)
ResetScroll();}function NextFrame(){if(step>0){if(timer)
clearTimeout(timer);timer=setTimeout("Animate()",realtime_step);}if(follow)
Scroll();}function Seek(position){current_time=position;if(current_time<0)
current_time=0;if(current_time>=max_time){current_time=max_time;step=0;}var t=Math.floor(current_time/1000);var s=t%60;var m=Math.floor(t/60);t=m+(s>9?":":":0")+s;e("time").innerHTML=t;if(events[current_event]>current_time){if(current_event>0 && events[current_event-6]<current_time){NextFrame();return;}Reset();}var min_slot=slots.length;var max_slot=0;var cursor_event=-1;for(;events[current_event]<=current_time;current_event+=6){var end_time=events[current_event+1];if(end_time<=current_time)
continue;var type=events[current_event+2];if(type==0||type>3){cursor_event=current_event;}else{var i=events[current_event+3];if(type==3){slots[i]=null;}else{var text=string_table[events[current_event+4]].substr(
0,events[current_event+5]);if(type==1||slots[i]==null) slots[i]=text;else slots[i]+=text;}if(min_slot>i) min_slot=i;if(max_slot<i) max_slot=i;update_slots[i]=(end_time>=max_time?2:1);}}for(var i=min_slot;i<=max_slot;i++){if(update_slots[i]){var span=e("slot"+i);if(slots[i]!=null){span.innerHTML=slots[i]+"\n";span.style.display="inline";span.className=(update_slots[i]==1?"tmp":"final");}else{span.innerHTML="";span.style.display="none";}update_slots[i]=0;}}if(cursor_event>=0){var text="";var y;var x=events[cursor_event+5];if(events[cursor_event+2]==0){y=events[cursor_event+4];for(var i=0;i<y;i++)
text+="\n";for(var i=0;i<x;i++)
text+=" ";text+='<span style="background-color:#0f0" id=cursor_block> <\57span>';}else{var s=events[cursor_event+3];for(var i=y=0;i<s;i++){if(slots[i]!=null){y++;text+="\n";}}var line=slots[s]||"";var offset=events[cursor_event+4];while(line.length<=offset)
line+=" ";text+=line.substr(0,offset)+
'<span style="background-color:#0f0;color:#0f0" id=cursor_block>'+
line.substr(offset,events[cursor_event+2]-3)+
'<\57span>';}e("cursor").innerHTML=text;e("cursor_text").innerHTML=(y+1)+','+(x+1);}NextFrame();}function InputSeek(position){var t=parseInt(position);if(t>=0)
Seek(t);}function UpdateProgress(){e("position").value=current_time;}function Follow(state){follow=state;}function FastScroll(state){fast_scroll=state;}function Highlight(state){var x=document.styleSheets;for(var i=0;i<x.length;i++){var y=x[i].cssRules;for(var j=0;j<y.length;y++){if(y[j].selectorText==".tmp"){y[j].style.color=state?"#00f":"#000";return;}}}}function ForegroundControl(){e("control").style.opacity="1.0";opacity=100;if(opacity_timer){clearTimeout(opacity_timer);opacity_timer=null;}}function BackgroundControl(){e("control").style.opacity=opacity/100;if(opacity>35){opacity-=5;opacity_timer=setTimeout("BackgroundControl()",100);}}Init();</script>
</body></html>
+52
View File
@@ -0,0 +1,52 @@
#include<stdio.h>
#/* [bbde3cf3]*/include<stdlib.h>
# define D(o,l,I)/*( C ) 2 0 1 9 */o##l##I/*
e = nil;ARGF.each_char{ | c | print c; e=e ? c < "A"||
c >"Z": c == "\e" ?1:(!sleep 0.1 ) } ;%q{bU'*Evergarden*/
D( t ,ype ,def ) D ( i ,n,t)_; D ( t , ypede , f ) D ( s , tru
,ct ) { _ x , y , z ; } b ; b*U , u ; _ h ; FILE* ( f); _ H , h ,g
=6 * 40, V , i , o , l , e , t = 1,E [ 4 ] , I [22 ] = { 8 * + 4 * 17
*8,5 * 19, 2 * D ( 7 , 5 , 9 ) * 3 , 1,2 + 5 * 4 * 5*29, 446 , 2 , ~ - (2
*20 * 2 * (31 * 2 * 3 * 2 + 1 ) ) , 7 * ( 2*2 * 3 * 2 * ~-( 2*3 * 2 ) - 1 ) ,7
* ~ - (4* 5 ) * 4 * + 7 * 3 - 1 , 3 * - ~(2 * 3 * 2 ) * ~ - (2*-~(2 * 3 * 2*3
) ) * 3,~ - ( 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 ) , 1 + 7 * 4 * 7 *4, 9 , 4 * 6
- 1 , 63, 5 * ~ - ( 5 * 6 ) , 3 * 4 * 8,8 * 2 * 8 , 6 , ( 17* 113 * 8 * 4 - 6 ) ,
11 * 3 * 8 * 4 * 8 * 8 * 2 - 1 },p , q ,x, y ; D ( v , o , id) s ( ){u = U [ x ] ,
U[x ]=U[y ] , U [ y ] = u ; } D ( v ,oi , d)m(_ p , _ q ) { _ d=( + p+q ) / 2 ;if (d
-p) {m( p ,d) ; m ( d , q ) ;D(f, o , r)( i =p,o= d , y = H + p ;y< H + q ; y ++) { x
=i>= d|| ( o<q &&( U [ + i ] . y>U[o ] . y|| ( U[+i] . y== U [ o ].y&& U [ + i ] .x> U[
o]. x))) ? o++ : i++ ; s ( );} for (y=p , x=H + p;y<q ; x+= 1 , y +=1)s ( ) ; }}D ( v ,
oi ,d ) v (){ ; D(f , o,r ) ( i = l=0; i <22&& (o=I[ i++ ] + + l ,l=o+I[i] , ( e<o ||
e> l)) ; i ++) {}x=2 + x-i /22 ;} void a (){if(H+2 > t){ U = ( b *)D(r ,ea ,lloc ) (
U ,2* ( t*=2) *D (siz , e , of)(b ));} U[ H].x=x;U[H].y = y ; U [ H++]. z = e;p=p >y
? y:p ; q=q<y?y:q ;v ();}D( v ,o, id )Q(_ O){(l=abs ( O ) ) ? D (fpr, i , ntf )(f
, "\33" "[%d%c",l ,V +(O>0) ):0; V ^=2 ;}D(vo,i, d ) P ( _ p){;E [ o =0] = e=p
; if( p >> 7){for( ; p >63>>o; p>>=6){E[o++]= 128| ( 9 * 7 & p );}E[ o]= (g* 8>>o
& g )| p; }for(;o >- 1 ;D(f,pu, tc)(E[o--] ,f ));} D ( c , h , ar) d[2 ]="r";D(i
, n, t)r (char*u ){return (f=D(fo, pe , n) ( u , d ))? 0:(perror(u),-1);
} _ /* Q */D(m, a,in) (_ O,D( ch, a , r ) **Z ){f=stdin;if(--
O&& ( ( **++Z) -45|| 01[ * Z ] ) &&r ( *Z)){goto X;}
D(f ,o , r ) (*d |=( 5 );(e=D(f,get
,c) ( f ) ) - EOF ;h= h<0?e-91?e<48||
e>59 ?l= l * ~ -(e &2),e>64&&e<67?y+=l,0
:e<69 && (x= l + x)< 0?x=0:0:~(l=l*10+e-48
):h:h ?( e= l=l<< 6 |(e &63),!--h) ?a(),h:h:
192==( 32* 7& e)?l= e & 31,1:(e&g)== 224?l=e&15,
2: (e &248) == g?l=e & 7 ,3:e-27?e==10 ?y++,x=0:e-
32 ?e ==9?x=(x +8)&~ 7:32< e? a() ,h:h:x++,h:~(l = 0)){V
+=( V+ e)<<10;V^= V>>6 ; } fclose(f);f=D(std, o, ut
); if (U) {if(O<1){ m(0 , U [H].x=H);for(h= x=0 ,y =
p;h <H ;v( )){for(;y<U[ h].y ; y ++,x=0){P(10);}D (f , o ,r
)( ;x <U[ h].x;x++){P(32) ;}for ( ; h<H&&+U [++h].y ==y ? U [
h ]. x== x:0;){}P(U[h-1 ]. z);}if ( 0 <x)P(-~ 9);}D( el, s , e
){ D( sr, a ,nd)(V);for( x=H;--x > 0 ;s()){V =D(ra, n , d ) (
) ; y=V % -~x;}if ((-- O) ? r(*++Z) :O++){ D ( g , o
, to ) X ;};for( t=h= 0, y =q+1;h< H&&t< O ; D ( f
, clos, e )(f)) {if( t&& r (*++Z) ){;D( g , o , to
) X ;}if (!t){; for( h=q -p+2;--h ;P(10 ) ); }for
( V = 65 ;h<H *-~t /O;y=U[h++]. y){;Q ( U[ h]. y
- y );Q (x- U [h].x);P( U[h]. z ); x =U
[ h].x; v() ; }Q(q-y);P (10) ; x =0;y
=q+1;t ++; }}}O=0;X :D(r ,et
,urn) O ; }/*
}# */