Skip to main content
added 148 characters in body
Source Link

C# - 373 349 339339 335 chars

using C=System.Console;class P{static void Main(string[] z){try{for(dynamic c,p=z[0],a=new int[30000],s=new int[9],f=1>0,i=0,d=0,t=0;;i=(c==51&&f&t=0;;i=c==51&&f&(f|=s[--t]<0))?s[t]:++i){c=p[i]-42;d+=42;a[d+=(c-19)*(f&c>17&c<21?1:0);a[d]+=]+=(2-c)*(f&c>0&c<4?1:0);if(f&c==4)C.Write((char)a[d]);if(f&c==2)a[d]=C.Read();if(c==49)s[t++]=f?(f=a[d]!=0)?i:-1:i;}}catch{}}}

And more readable:

using C=System.Console;
class P
{
    static void Main(string[] z)
    {
        try
        {
            for(dynamic c,p=z[0],a=new int[30000],s=new int[9],f=1>0,i=0,d=0,t=0;;i=(c==51&&f&t=0;;i=c==51&&f&(f|=s[--t]<0))?s[t]:++i)
            {
                c=p[i]-42;
                d+=a[d+=(c-19)*(f&c>17&c<21?1:0);
                a[d]+=]+=(2-c)*(f&c>0&c<4?1:0);
                if(f&c==4)C.Write((char)a[d]);
                if(f&c==2)a[d]=C.Read();
                if(c==49)s[t++]=f?(f=a[d]!=0)?i:-1:i;
            }
        }
        catch{}
    }
}

Limitation is it only handles nested [ up to 9 deep. Can make the s array bigger to handle more.

Edit 373 -> 349: Removed outer loop (was for a different site), character comparisons to integers, moved c declaration into the for loop

Edit 349 -> 339:

  • Combined +/- and >/< into single lines.
  • Reduced integer literal lengths by subtracting 42 from c to allow for some of the integer literals to be a single character (credit @ceilingcat).
  • Moved i=... into the for loop iterator section (credit @ceilingcat).

Edit 339 -> 335:

  • Combined +/- and >/< into a single line (credit @ceilingcat)
  • Removed unnecessary parenthesis in the i=... (credit @ceilingcat)

C# - 373 349 339 chars

using C=System.Console;class P{static void Main(string[] z){try{for(dynamic c,p=z[0],a=new int[30000],s=new int[9],f=1>0,i=0,d=0,t=0;;i=(c==51&&f&(f|=s[--t]<0))?s[t]:++i){c=p[i]-42;d+=(c-19)*(f&c>17&c<21?1:0);a[d]+=(2-c)*(f&c>0&c<4?1:0);if(f&c==4)C.Write((char)a[d]);if(f&c==2)a[d]=C.Read();if(c==49)s[t++]=f?(f=a[d]!=0)?i:-1:i;}}catch{}}}

And more readable:

using C=System.Console;
class P
{
    static void Main(string[] z)
    {
        try
        {
            for(dynamic c,p=z[0],a=new int[30000],s=new int[9],f=1>0,i=0,d=0,t=0;;i=(c==51&&f&(f|=s[--t]<0))?s[t]:++i)
            {
                c=p[i]-42;
                d+=(c-19)*(f&c>17&c<21?1:0);
                a[d]+=(2-c)*(f&c>0&c<4?1:0);
                if(f&c==4)C.Write((char)a[d]);
                if(f&c==2)a[d]=C.Read();
                if(c==49)s[t++]=f?(f=a[d]!=0)?i:-1:i;
            }
        }
        catch{}
    }
}

Limitation is it only handles nested [ up to 9 deep. Can make the s array bigger to handle more.

Edit 373 -> 349: Removed outer loop (was for a different site), character comparisons to integers, moved c declaration into the for loop

Edit 349 -> 339:

  • Combined +/- and >/< into single lines.
  • Reduced integer literal lengths by subtracting 42 from c to allow for some of the integer literals to be a single character (credit @ceilingcat).
  • Moved i=... into the for loop iterator section (credit @ceilingcat).

C# - 373 349 339 335 chars

using C=System.Console;class P{static void Main(string[] z){try{for(dynamic c,p=z[0],a=new int[30000],s=new int[9],f=1>0,i=0,d=0,t=0;;i=c==51&&f&(f|=s[--t]<0)?s[t]:++i){c=p[i]-42;a[d+=(c-19)*(f&c>17&c<21?1:0)]+=(2-c)*(f&c>0&c<4?1:0);if(f&c==4)C.Write((char)a[d]);if(f&c==2)a[d]=C.Read();if(c==49)s[t++]=f?(f=a[d]!=0)?i:-1:i;}}catch{}}}

And more readable:

using C=System.Console;
class P
{
    static void Main(string[] z)
    {
        try
        {
            for(dynamic c,p=z[0],a=new int[30000],s=new int[9],f=1>0,i=0,d=0,t=0;;i=c==51&&f&(f|=s[--t]<0)?s[t]:++i)
            {
                c=p[i]-42;
                a[d+=(c-19)*(f&c>17&c<21?1:0)]+=(2-c)*(f&c>0&c<4?1:0);
                if(f&c==4)C.Write((char)a[d]);
                if(f&c==2)a[d]=C.Read();
                if(c==49)s[t++]=f?(f=a[d]!=0)?i:-1:i;
            }
        }
        catch{}
    }
}

Limitation is it only handles nested [ up to 9 deep. Can make the s array bigger to handle more.

Edit 373 -> 349: Removed outer loop (was for a different site), character comparisons to integers, moved c declaration into the for loop

Edit 349 -> 339:

  • Combined +/- and >/< into single lines.
  • Reduced integer literal lengths by subtracting 42 from c to allow for some of the integer literals to be a single character (credit @ceilingcat).
  • Moved i=... into the for loop iterator section (credit @ceilingcat).

Edit 339 -> 335:

  • Combined +/- and >/< into a single line (credit @ceilingcat)
  • Removed unnecessary parenthesis in the i=... (credit @ceilingcat)
added 214 characters in body
Source Link

C# - 373 349349 339 chars

using C=System.Console;class P{static void Main(string[] z){try{for(dynamic c,p=z[0],a=new int[30000],s=new int[9],f=1>0,i=0,d=0,t=0;;){c=p[i];if(f&c==62)++d;if(f&c==60)--d;if(f&c==43)++a[d];if(f&c==45)--a[d];if(f&c==46)C.Write((char)a[d]);if(f&c==44)a[d]=C.Read();if(c==91)s[t++]=f?(f=a[d]!=0)?i:-1:i;i=(c==93&&f&(f|=s[--t]<0))?s[t]:++i;}}catch{}}}
using C=System.Console;class P{static void Main(string[] z){try{for(dynamic c,p=z[0],a=new int[30000],s=new int[9],f=1>0,i=0,d=0,t=0;;i=(c==51&&f&(f|=s[--t]<0))?s[t]:++i){c=p[i]-42;d+=(c-19)*(f&c>17&c<21?1:0);a[d]+=(2-c)*(f&c>0&c<4?1:0);if(f&c==4)C.Write((char)a[d]);if(f&c==2)a[d]=C.Read();if(c==49)s[t++]=f?(f=a[d]!=0)?i:-1:i;}}catch{}}}
using C=System.Console;
class P
{
    static void Main(string[] z)
    {
        try
        {
            for(dynamic c,p=z[0],a=new int[30000],s=new int[9],f=1>0,i=0,d=0,t=0;;)
            {
                c=p[i];
                if(f&c==62)++d;
                if(f&c==60)--d;
                if(f&c==43)++a[d];
                if(f&c==45)--a[d];
                if(f&c==46)C.Write((char)a[d]);
                if(f&c==44)a[d]=C.Read();
                if(c==91)s[t++]=f?(f=a[d]!=0)?i:-1:i;
                i=(c==93&&f&(f|=s[--t]<0))?s[t]:++i;
            }
        }
        catch{}
    }
}
using C=System.Console;
class P
{
    static void Main(string[] z)
    {
        try
        {
            for(dynamic c,p=z[0],a=new int[30000],s=new int[9],f=1>0,i=0,d=0,t=0;;i=(c==51&&f&(f|=s[--t]<0))?s[t]:++i)
            {
                c=p[i]-42;
                d+=(c-19)*(f&c>17&c<21?1:0);
                a[d]+=(2-c)*(f&c>0&c<4?1:0);
                if(f&c==4)C.Write((char)a[d]);
                if(f&c==2)a[d]=C.Read();
                if(c==49)s[t++]=f?(f=a[d]!=0)?i:-1:i;
            }
        }
        catch{}
    }
}

Edit 349 -> 339:

  • Combined +/- and >/< into single lines.
  • Reduced integer literal lengths by subtracting 42 from c to allow for some of the integer literals to be a single character (credit @ceilingcat).
  • Moved i=... into the for loop iterator section (credit @ceilingcat).

C# - 373 349 chars

using C=System.Console;class P{static void Main(string[] z){try{for(dynamic c,p=z[0],a=new int[30000],s=new int[9],f=1>0,i=0,d=0,t=0;;){c=p[i];if(f&c==62)++d;if(f&c==60)--d;if(f&c==43)++a[d];if(f&c==45)--a[d];if(f&c==46)C.Write((char)a[d]);if(f&c==44)a[d]=C.Read();if(c==91)s[t++]=f?(f=a[d]!=0)?i:-1:i;i=(c==93&&f&(f|=s[--t]<0))?s[t]:++i;}}catch{}}}
using C=System.Console;
class P
{
    static void Main(string[] z)
    {
        try
        {
            for(dynamic c,p=z[0],a=new int[30000],s=new int[9],f=1>0,i=0,d=0,t=0;;)
            {
                c=p[i];
                if(f&c==62)++d;
                if(f&c==60)--d;
                if(f&c==43)++a[d];
                if(f&c==45)--a[d];
                if(f&c==46)C.Write((char)a[d]);
                if(f&c==44)a[d]=C.Read();
                if(c==91)s[t++]=f?(f=a[d]!=0)?i:-1:i;
                i=(c==93&&f&(f|=s[--t]<0))?s[t]:++i;
            }
        }
        catch{}
    }
}

C# - 373 349 339 chars

using C=System.Console;class P{static void Main(string[] z){try{for(dynamic c,p=z[0],a=new int[30000],s=new int[9],f=1>0,i=0,d=0,t=0;;i=(c==51&&f&(f|=s[--t]<0))?s[t]:++i){c=p[i]-42;d+=(c-19)*(f&c>17&c<21?1:0);a[d]+=(2-c)*(f&c>0&c<4?1:0);if(f&c==4)C.Write((char)a[d]);if(f&c==2)a[d]=C.Read();if(c==49)s[t++]=f?(f=a[d]!=0)?i:-1:i;}}catch{}}}
using C=System.Console;
class P
{
    static void Main(string[] z)
    {
        try
        {
            for(dynamic c,p=z[0],a=new int[30000],s=new int[9],f=1>0,i=0,d=0,t=0;;i=(c==51&&f&(f|=s[--t]<0))?s[t]:++i)
            {
                c=p[i]-42;
                d+=(c-19)*(f&c>17&c<21?1:0);
                a[d]+=(2-c)*(f&c>0&c<4?1:0);
                if(f&c==4)C.Write((char)a[d]);
                if(f&c==2)a[d]=C.Read();
                if(c==49)s[t++]=f?(f=a[d]!=0)?i:-1:i;
            }
        }
        catch{}
    }
}

Edit 349 -> 339:

  • Combined +/- and >/< into single lines.
  • Reduced integer literal lengths by subtracting 42 from c to allow for some of the integer literals to be a single character (credit @ceilingcat).
  • Moved i=... into the for loop iterator section (credit @ceilingcat).
Commonmark migration
Source Link

#C# - 373 349 chars

C# - 373 349 chars

using C=System.Console;class P{static void Main(string[] z){try{for(dynamic c,p=z[0],a=new int[30000],s=new int[9],f=1>0,i=0,d=0,t=0;;){c=p[i];if(f&c==62)++d;if(f&c==60)--d;if(f&c==43)++a[d];if(f&c==45)--a[d];if(f&c==46)C.Write((char)a[d]);if(f&c==44)a[d]=C.Read();if(c==91)s[t++]=f?(f=a[d]!=0)?i:-1:i;i=(c==93&&f&(f|=s[--t]<0))?s[t]:++i;}}catch{}}}

And more readable:

using C=System.Console;
class P
{
    static void Main(string[] z)
    {
        try
        {
            for(dynamic c,p=z[0],a=new int[30000],s=new int[9],f=1>0,i=0,d=0,t=0;;)
            {
                c=p[i];
                if(f&c==62)++d;
                if(f&c==60)--d;
                if(f&c==43)++a[d];
                if(f&c==45)--a[d];
                if(f&c==46)C.Write((char)a[d]);
                if(f&c==44)a[d]=C.Read();
                if(c==91)s[t++]=f?(f=a[d]!=0)?i:-1:i;
                i=(c==93&&f&(f|=s[--t]<0))?s[t]:++i;
            }
        }
        catch{}
    }
}

Limitation is it only handles nested [ up to 9 deep. Can make the s array bigger to handle more.

Edit 373 -> 349: Removed outer loop (was for a different site), character comparisons to integers, moved c declaration into the for loop

#C# - 373 349 chars

using C=System.Console;class P{static void Main(string[] z){try{for(dynamic c,p=z[0],a=new int[30000],s=new int[9],f=1>0,i=0,d=0,t=0;;){c=p[i];if(f&c==62)++d;if(f&c==60)--d;if(f&c==43)++a[d];if(f&c==45)--a[d];if(f&c==46)C.Write((char)a[d]);if(f&c==44)a[d]=C.Read();if(c==91)s[t++]=f?(f=a[d]!=0)?i:-1:i;i=(c==93&&f&(f|=s[--t]<0))?s[t]:++i;}}catch{}}}

And more readable:

using C=System.Console;
class P
{
    static void Main(string[] z)
    {
        try
        {
            for(dynamic c,p=z[0],a=new int[30000],s=new int[9],f=1>0,i=0,d=0,t=0;;)
            {
                c=p[i];
                if(f&c==62)++d;
                if(f&c==60)--d;
                if(f&c==43)++a[d];
                if(f&c==45)--a[d];
                if(f&c==46)C.Write((char)a[d]);
                if(f&c==44)a[d]=C.Read();
                if(c==91)s[t++]=f?(f=a[d]!=0)?i:-1:i;
                i=(c==93&&f&(f|=s[--t]<0))?s[t]:++i;
            }
        }
        catch{}
    }
}

Limitation is it only handles nested [ up to 9 deep. Can make the s array bigger to handle more.

Edit 373 -> 349: Removed outer loop (was for a different site), character comparisons to integers, moved c declaration into the for loop

C# - 373 349 chars

using C=System.Console;class P{static void Main(string[] z){try{for(dynamic c,p=z[0],a=new int[30000],s=new int[9],f=1>0,i=0,d=0,t=0;;){c=p[i];if(f&c==62)++d;if(f&c==60)--d;if(f&c==43)++a[d];if(f&c==45)--a[d];if(f&c==46)C.Write((char)a[d]);if(f&c==44)a[d]=C.Read();if(c==91)s[t++]=f?(f=a[d]!=0)?i:-1:i;i=(c==93&&f&(f|=s[--t]<0))?s[t]:++i;}}catch{}}}

And more readable:

using C=System.Console;
class P
{
    static void Main(string[] z)
    {
        try
        {
            for(dynamic c,p=z[0],a=new int[30000],s=new int[9],f=1>0,i=0,d=0,t=0;;)
            {
                c=p[i];
                if(f&c==62)++d;
                if(f&c==60)--d;
                if(f&c==43)++a[d];
                if(f&c==45)--a[d];
                if(f&c==46)C.Write((char)a[d]);
                if(f&c==44)a[d]=C.Read();
                if(c==91)s[t++]=f?(f=a[d]!=0)?i:-1:i;
                i=(c==93&&f&(f|=s[--t]<0))?s[t]:++i;
            }
        }
        catch{}
    }
}

Limitation is it only handles nested [ up to 9 deep. Can make the s array bigger to handle more.

Edit 373 -> 349: Removed outer loop (was for a different site), character comparisons to integers, moved c declaration into the for loop

373 -> 349 chars. Removed outer loop (was for a different site), character comparisons to integers, moved `c` declaration into the for loop
Source Link
Loading
Adding limitation.
Source Link
Loading
Source Link
Loading