Merge pull request #318 from xexyl/2015-endoh3

This commit is contained in:
Landon Curt Noll authored and GitHub committed 2023-04-07 23:46:15 -07:00
commit bfca29f5c4
18 files changed
+46 -49

No files matched your search

+1 -1
View File
@@ -16,7 +16,7 @@ you Yusuke!
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) removed the erroneous [Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) removed the erroneous
prototype to `fopen()` and made this use `fgets()` instead of `gets()` to make prototype to `fopen()` and made this use `fgets()` instead of `gets()` to make
it safer. He also fixed a segfault in the case that the file cannot be loaded. it safer and to prevent a potentially alarming warning at linking or runtime.
Thank you Cody for your assistance! Thank you Cody for your assistance!
## To run ## To run
+1 -1
View File
@@ -17,7 +17,7 @@ X'R':B[2]!='M'&&(l=*--C)X'I':B[1]=='N'?fgets(p=B,R,stdin),P[*d]=S():(*(q=Q(B,"TH
()))X'G':p=B+4,B[2]=='S'&&(*C++=l,p++),l=S()-1 X'F':*(q=Q(B,"TO"))=0;p=B+5;P[i ()))X'G':p=B+4,B[2]=='S'&&(*C++=l,p++),l=S()-1 X'F':*(q=Q(B,"TO"))=0;p=B+5;P[i
=B[3]]=S();p=q+2;M[i]=S();L[i]=l X'N':++P[*d]<=M[*d]&&(l=L[*d]);}else p=B+2,P[ =B[3]]=S();p=q+2;M[i]=S();L[i]=l X'N':++P[*d]<=M[*d]&&(l=L[*d]);}else p=B+2,P[
*B]=S();l++;}X'L':N printf(I)X'N':N(free(m[i]),0),m[i]=0 X'B':_ 0 t('S',5,"w",N *B]=S();l++;}X'L':N printf(I)X'N':N(free(m[i]),0),m[i]=0 X'B':_ 0 t('S',5,"w",N
f&&fprintf(f,I))t('O',4,"r",while(f&&fgets(B,R,f))(*Q(B,"\n")=0,G()))X 0:default:G() fprintf(f,I))t('O',4,"r",while(fgets(B,R,f))(*Q(B,"\n")=0,G()))X 0:default:G()
;}_ 0;}G(){l=atoi(B);m[l]&&(free(m[l]),0);(p=Q(B," "))?strcpy(m[l]=malloc(strlen(p ;}_ 0;}G(){l=atoi(B);m[l]&&(free(m[l]),0);(p=Q(B," "))?strcpy(m[l]=malloc(strlen(p
)),p+1):(m[l]=0,0);}O(S,J,'=',==,'#',!=)O(J,K,'<',<,'>',>)O(K,V,'$',<=,'!',>=) )),p+1):(m[l]=0,0);}O(S,J,'=',==,'#',!=)O(J,K,'<',<,'>',>)O(K,V,'$',<=,'!',>=)
O(V,W,'+',+,'-',-)O(W,Y,'*',*,'/',/)Y(){int o;_*p=='-'?p++,-Y():*p>='0'&&*p<= O(V,W,'+',+,'-',-)O(W,Y,'*',*,'/',/)Y(){int o;_*p=='-'?p++,-Y():*p>='0'&&*p<=
+1
View File
@@ -133,6 +133,7 @@ all: data ${TARGET}
supernova deep_magic magic charon pluto supernova deep_magic magic charon pluto
${PROG}: ${PROG}.c ${PROG}: ${PROG}.c
@echo "NOTE: this entry will segfault on no arg specified."
${CC} ${CFLAGS} $< -o $@ ${LIBS} ${CC} ${CFLAGS} $< -o $@ ${LIBS}
sorter.c: ${PROG} ${PROG}.c sorter.c: ${PROG} ${PROG}.c
+14 -14
View File
@@ -1,10 +1,10 @@
# Best of Show # Best of Show
Adrian Mariano Adrian Mariano
University of Washington University of Washington
2729 72nd Ave SE 2729 72nd Ave SE
Mercer Island, WA 98040 Mercer Island, WA 98040
USA USA
## To build: ## To build:
@@ -12,13 +12,12 @@
make all make all
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed some segfaults [Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed some segfaults
under modern (and in some cases earlier) systems with this entry. He also fixed under modern (and in some cases earlier) systems with this entry. Originally we
a segfault if not enough args are used. Originally we noted that the 4 trailing noted that the 4 trailing args '0 0 0 0' were required on systems that dump core
args '0 0 0 0' were required on systems that dump core when NULL is dereferenced when NULL is dereferenced but this problem showed itself in modern systems even
but this problem showed itself in modern systems even with the 4 '0 0 0 0'. To with the 4 '0 0 0 0'. Finally he changed this program to use `fgets()` not
make this easier for users Cody also kindly fixed this problem. Finally he `gets()` to make it safer and to prevent a warning about `gets()` at linking or
changed this program to use `fgets()` not `gets()` to make it safer. Thank you runtime. Thank you Cody for your assistance!
Cody for your assistance!
[Yusuke Endoh](/winners.html#Yusuke_Endoh) pointed out that `atof` nowadays [Yusuke Endoh](/winners.html#Yusuke_Endoh) pointed out that `atof` nowadays
needs `#include <stdlib.h>` which was used in order to get this to work needs `#include <stdlib.h>` which was used in order to get this to work
@@ -37,6 +36,7 @@ where:
h - step size h - step size
y1 - initial value (y(x1) == y1) y1 - initial value (y(x1) == y1)
NOTE: this entry will segfault on no arg specified.
## Try: ## Try:
@@ -76,7 +76,7 @@ reversing filter! Try:
Still not impressed? The author throws in for free, a Still not impressed? The author throws in for free, a
sort program! Try: sort program! Try:
cc sorter.c -o sorter make sorter
ls | ./sorter ls | ./sorter
This program is safe for home use as well. The author has This program is safe for home use as well. The author has
@@ -89,7 +89,7 @@ And finally, as a special offer to users of this entry,
the author provides a Fibonacci sequence generator! Try: the author provides a Fibonacci sequence generator! Try:
./sorter 0 0 0 0 < theorem.c > fibonacci.c ./sorter 0 0 0 0 < theorem.c > fibonacci.c
cc fibonacci.c -o fibonacci make fibonacci
./fibonacci 1 1 ./fibonacci 1 1
./fibonacci 2 1 ./fibonacci 2 1
-1
View File
@@ -24,7 +24,6 @@ w(g,R,u)float*g,u;char R;
/**/{int b,f;A=atoi(++a);b=atoi(++a);while((f=A+b)<15000){printf("%d\n",f);A=b;b=f;}} /**/{int b,f;A=atoi(++a);b=atoi(++a);while((f=A+b)<15000){printf("%d\n",f);A=b;b=f;}}
main(A,a)int A;char*a[]; main(A,a)int A;char*a[];
o o o o
if (a[1]==NULL||a[2]==NULL||a[3]==NULL||a[4]==NULL||a[5]==NULL) return 1;
if(!strcmp(*++a,"-r"))S(); if(!strcmp(*++a,"-r"))S();
D=atof(*++a); D=atof(*++a);
T=atof(*++a); T=atof(*++a);
+1
View File
@@ -128,6 +128,7 @@ all: data ${TARGET}
supernova deep_magic magic charon pluto supernova deep_magic magic charon pluto
${PROG}: ${PROG}.c ${PROG}: ${PROG}.c
@echo "NOTE: this program will crash with not enough args."
${CC} ${CFLAGS} $< -o $@ ${LIBS} ${CC} ${CFLAGS} $< -o $@ ${LIBS}
# alternative executable # alternative executable
+2 -3
View File
@@ -18,9 +18,8 @@ where:
number is a number (try 21701) number is a number (try 21701)
arg is any argument arg is any argument
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) added a check in the
code so that it will not segfault if not enough args are specified. Thank you NOTE: this entry will crash without enough args.
Cody!
## Judges' comments: ## Judges' comments:
+1 -1
View File
@@ -1 +1 @@
char*_,*O;main(S,l)char**l;{if(S>2){*(O=*(l+++S-1)-1)=13,*l[1]=0;for(;;)for(printf(*l),_=O-1;_>=*l&&++*_>(S+*O+S)*S;*_--=(S+*O)*S);}} char*_,*O;main(S,l)char**l;{*(O=*(l+++S-1)-1)=13,*l[1]=0;for(;;)for(printf(*l),_=O-1;_>=*l&&++*_>(S+*O+S)*S;*_--=(S+*O)*S);}
+1
View File
@@ -128,6 +128,7 @@ all: data ${TARGET}
supernova deep_magic magic charon pluto supernova deep_magic magic charon pluto
${PROG}: ${PROG}.c ${PROG}: ${PROG}.c
@echo "NOTE: this entry will segfault if the file cannot be opened."
${CC} ${CFLAGS} $< -o $@ ${LIBS} ${CC} ${CFLAGS} $< -o $@ ${LIBS}
# alternative executable # alternative executable
+9 -8
View File
@@ -1,18 +1,17 @@
# Obfuscated Intelligence Award: # Obfuscated Intelligence Award:
Mark Schnitzius Mark Schnitzius
1700 Woodbury Rd. #1208 1700 Woodbury Rd. #1208
Orlando, FL 32828 Orlando, FL 32828
USA USA
## To build: ## To build:
make all make all
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed this to not [Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) made this use `fgets()`
segfault when no file is specified or the file cannot be opened for reading. He not `gets()` to make it safer and to prevent a warning with linking or at
also made this use `fgets()` not `gets()` to make it safer. Thank you Cody for runtime. Thank you Cody for your assistance!
your assistance!
## To run: ## To run:
@@ -22,6 +21,8 @@ where:
file a file containing some text file a file containing some text
NOTE: this entry will segfault if the file cannot be opened.
## Try: ## Try:
./schnitzi schnitzi.info ./schnitzi schnitzi.info
+2 -2
View File
@@ -13,9 +13,9 @@
( lll>l1 ) li|=! ( l[3*l1+++3 ( lll>l1 ) li|=! ( l[3*l1+++3
] -ll[strlen ( ll)-1] ) ;return ] -ll[strlen ( ll)-1] ) ;return
( li ) ;}main ( ll,lll ( li ) ;}main ( ll,lll
) char*lll[];{if(ll<2)return 1;char l1 [111][21], li1[111][21],il1[111],i1l ) char*lll[];{char l1 [ 111][21],li1[111][21 ] ,il1[111],i1l
[ 111 ] ;int lli,l11,l1l,li/* ( */,ll1,il,l;FILE*f;if(ll-2 [ 111 ] ;int lli,l11,l1l,li/* ( */,ll1,il,l;FILE*f;if(ll-2
) {f=fopen ( lll[1],"r" );if(!f)return 1;lli=l=ll1=il=!1;while ) {f=fopen ( lll[1],"r" ) ;lli=l=ll1=il=!1;while
( fscanf(f,"%s",l1[lli] ) +1){li=ii ( l1[lli],3 ( fscanf(f,"%s",l1[lli] ) +1){li=ii ( l1[lli],3
) ;iii ( l1[lli] ) ;l1l=l11=!1;while ) ;iii ( l1[lli] ) ;l1l=l11=!1;while
( l1l>-ll ) {iii ( lll[-l1l] ( l1l>-ll ) {iii ( lll[-l1l]
+1
View File
@@ -130,6 +130,7 @@ all: data ${TARGET}
supernova deep_magic magic charon pluto supernova deep_magic magic charon pluto
${PROG}: ${PROG}.c ${PROG}: ${PROG}.c
@echo "NOTE: this program will crash on invalid input."
${CC} ${CFLAGS} $< -o $@ ${LIBS} ${CC} ${CFLAGS} $< -o $@ ${LIBS}
# alternative executable # alternative executable
+4 -6
View File
@@ -28,12 +28,10 @@
echo 324 >> data echo 324 >> data
./sort < data ./sort < data
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed three segfaults in [Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed invalid data
this entry. The first was caused by invalid data types. The second was triggered types which prevented this entry from working. There are two other segfaults
if one did not specify any arg. The third happened if the arg was had any that should not be fixed and they are discussed in [bugs.md](/bugs.md). Thank
characters that were not the digits 1 - 9 (if it started with 0 it could work as you Cody for your assistance!
long as another digit followed it and there were no other non-digits). Thank you
Cody for your assistance!
NOTE: the larger the number the number of lines of output can become NOTE: the larger the number the number of lines of output can become
substantially higher as well. Doing `./schnitzi 9` will actually print 771999 substantially higher as well. Doing `./schnitzi 9` will actually print 771999
+2 -3
View File
@@ -52,6 +52,5 @@ void x_(){ O=g; *r=y[k-2]; _=r; j=o_; }
void d (){ O=g; *r=y[k]; _=r; k=k+1; m=k<z; w=_t; l=p_; j=p; } void d (){ O=g; *r=y[k]; _=r; k=k+1; m=k<z; w=_t; l=p_; j=p; }
void y_(){ O=g; *r=x[17][1]+k; _=r; j=q_; } void y_(){ O=g; *r=x[17][1]+k; _=r; j=q_; }
void r_(){ O=_b; _=x[17]; s=(char**)_d; s=s+1; i=*s; q=0; } void r_(){ O=_b; _=x[17]; s=(char**)_d; s=s+1; i=*s; q=0; }
main(int v,char **V){ if (V[1]) {if(atoi(V[1])!=0) { main(int v,char **V){ O=r_; _d=V;
q=0; O=r_; _d=V; x: (O)(); goto x; }
x: (O)(); goto x; }}}
+3 -3
View File
@@ -1,8 +1,8 @@
# Back to the Future Award # Back to the Future Award
Yusuke Endoh Yusuke Endoh
<https://github.com/mame/> <https://github.com/mame/>
Twitter: @mametter Twitter: @mametter
## To build: ## To build:
+1
View File
@@ -141,6 +141,7 @@ all: data ${TARGET}
supernova deep_magic magic charon pluto supernova deep_magic magic charon pluto
${PROG}: ${PROG}.c ${PROG}: ${PROG}.c
@echo "NOTE: this entry will crash on no arg specified."
${CC} ${CFLAGS} -DB=${B} -DI=${I} -DT=${T} -DS=${S} $< -o $@ ${LIBS} ${CC} ${CFLAGS} -DB=${B} -DI=${I} -DT=${T} -DS=${S} $< -o $@ ${LIBS}
${PROG}_le: ${PROG}.c ${PROG}_le: ${PROG}.c
+1 -5
View File
@@ -16,11 +16,7 @@ make
./prog arg ... ./prog arg ...
``` ```
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) made this entry not NOTE: this entry will crash on no arg specified.
segfault when no arg is specified though he notes that the author says it will
segfault on zero args. He did NOT fix the strange results when more than one arg
is specified. Thank you Cody for your assistance!
## Try: ## Try:
+1 -1
View File
@@ -1 +1 @@
int main(int b,char**i){if(1[i]){long long n=B,a=I^n,r=(a/b&a)>>4,y=atoi(*++i),_=(((a^n/b)*(y>>T)|y>>S)&r)|(a^r);printf("%.8s\n",(char*)&_);}} int main(int b,char**i){long long n=B,a=I^n,r=(a/b&a)>>4,y=atoi(*++i),_=(((a^n/b)*(y>>T)|y>>S)&r)|(a^r);printf("%.8s\n",(char*)&_);}