NanoLine's blog

By NanoLine, history, 5 months ago, In English

I challenge you to find a shorter code that the condition above is met.

#define min main(){}
min
  • Vote: I like it
  • +15
  • Vote: I do not like it

»
5 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Just blank file

  • »
    »
    5 months ago, # ^ |
      Vote: I like it +2 Vote: I do not like it

    That does not work because c++ compiler looks for the main function.

»
5 months ago, # |
  Vote: I like it +4 Vote: I do not like it

cool challenge

»
5 months ago, # |
Rev. 3   Vote: I like it +1 Vote: I do not like it

this is the shortest i know for C++: main(){}

  • »
    »
    5 months ago, # ^ |
      Vote: I like it +9 Vote: I do not like it

    that wouldn't work with python interpreter but for c++ it's the shortest.

»
5 months ago, # |
  Vote: I like it +14 Vote: I do not like it

This one is 2 bytes shorter:

#define id main(){}
id
  • »
    »
    5 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Absolutely! Next thing i want to do is adding some other languages to the statement. I guess all the allowed languages in codeforces could do the job.

  • »
    »
    4 days ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    No 1-letter function exists in Python 3.12 so I'm pretty sure this is the shortest.

    • »
      »
      »
      4 days ago, # ^ |
        Vote: I like it +8 Vote: I do not like it

      Thanks for replying; you brought my attention back to this problem, which caused me to think more about it. Turns out, there is a shorter solution. It uses an entirely different idea. Here it is:

      int
      exit();
      main()
      {}
      

      This compiles with g++ and runs with Python 3.11 (probably works with 3.12 too). It is 1 byte shorter than my previous solution.

      An even shorter solution can be compiled with gcc as C source code, but doesn't compile with g++ as C++ source code:

      exit();
      main()
      {}
      
      • »
        »
        »
        »
        4 days ago, # ^ |
          Vote: I like it +20 Vote: I do not like it

        With some clever Python semicolon usage, you can reduce this from 24 bytes CRLF/21 bytes LF to 22 bytes CRLF/20 bytes LF.

        int
        exit();main()
        {}
        
»
5 months ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it

python:

(it can run just with blank i guess??)

»
3 days ago, # |
  Vote: I like it 0 Vote: I do not like it

That looks cool I guess!