From 808ddf12e51c45e0d14bc9450bfbab150477d3cd Mon Sep 17 00:00:00 2001 From: Ilya Kurdyukov <59548320+ilyakurdyukov@users.noreply.github.com> Date: Tue, 5 Aug 2025 18:06:22 +0700 Subject: [PATCH] update 2024/kurdyukov4 fixed bug and increased input size limit to 4MB --- 2024/kurdyukov4/README.md | 9 ++++----- 2024/kurdyukov4/prog.c | 8 ++++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/2024/kurdyukov4/README.md b/2024/kurdyukov4/README.md index ae527b880..3cf8c01f2 100644 --- a/2024/kurdyukov4/README.md +++ b/2024/kurdyukov4/README.md @@ -7,14 +7,13 @@ ### Bugs and (Mis)features: -The current status of this entry is: +It is necessary to avoid collisions with C keywords when generating names for variables, for example: if do asm int for EOF. -> **STATUS: known bug - please help us fix** +The original code had a collision with the keywords "asm" and "int", now it is fixed. -For more detailed information see [2024/kurdyukov4 in bugs.html](../../bugs.html#2024_kurdyukov4). +Also, the size of the static buffers has increased from 1MB to 16MB, which should ensure processing of at least 4MB of input. If you want to increase the limit, look for `24` in the source code (this is a power of two, for 8MB of input data you would need `25`, and so on). -In fixing this bug you will come to a better appreciation of how the -code was able to process random data files as large as 64K. +Current code was tested with an input of 1MB. ## To use: diff --git a/2024/kurdyukov4/prog.c b/2024/kurdyukov4/prog.c index 319782de9..8439318df 100644 --- a/2024/kurdyukov4/prog.c +++ b/2024/kurdyukov4/prog.c @@ -4,7 +4,7 @@ #define o(x,o)x##o char X[ 1<<16 - ][4],Z[1<<20],*N= X[1] + ][4],Z[1<<24],*N= X[1] ,*P=Z,*H,A[12];char*C(int i,o(u ,nsigned) x){char*B =0,* D;if((x >>16)|| 0==* @@ -14,8 +14,8 @@ ?c<0 ?45:43 :0,C(0 ,c<0? -c:c ));B =B?a= *N,b= N[1], c=N[2 ],*B =a+!b -90?a =='z'?65:a+ 1:(b ='z' -b?b - -90? b%64+ 65:97 :(c=- ~c|96 ,65) ,~b% - 56%47 ?97: 'j') ,B[1 ]=b, B[2] =c,o + -90? b%64+ 65:97 :(c=c ?'z'- c?-~ c:48 + :'a', 65), 'j') ,B[1 ]=b, B[2] =c,o (prin ,tf) (",%" "s=%s" ,B,A) ,(N= B):A ;;}o( ret, urn) i>0 ?P+=o (spr ,intf )(P, ",%s" ,B):B ;}int main (){; @@ -23,7 +23,7 @@ =98; for( printf("#inclu" "de " "" "\nint" " a;i" "nt" " ma" "in()" "{int" " b=" - "-~a") ;i>3&&P- Z+33<1<< 20;C( + "-~a") ;i>3&&P- Z+33<1<< 24;C( i,a)) for(a=i=0;i<4&&0<=(c= o(get, char)( ));n++)((char *)&a)[ i++]=c; H=P;C(1