previndexinfonext

code guessing, round #4 (completed)

started at ; stage 2 at ; ended at

specification

hello everyone,
the challenge for code guessing round 4 is to check if a string is an anagram.
submissions may be written in c or python.

your submission will be given two strings. you must determine whether those two strings are anagrams of each other, ignoring case and the space character . you can assume that your string will contain only lowercase and uppercase ascii letters, and the space character.

important things:

in python:
your function entry will be given two python strings. you must return a python boolean: True if the strings are anagrams according to the conditions above, and False otherwise.

in c:
your function entry will be given two c strings (char*, null terminated). you must return 1 if the values given are anagrams of each other according to the conditions above, and 0 otherwise.
a prototype for the entry function is int entry(char *s1, char* s2)

results

  1. 👑 lyxal +4 -1 = 3
    1. ubq323 (was sonata «pathétique»)
    2. Kaylynn (was sporeball)
    3. IFcoltransG (was LyricLy)
    4. razetime
    5. Palaiologos
    6. sporeball (was IFcoltransG)
    7. LyricLy (was quintopia)
    8. quintopia (was Kaylynn)
    9. Olivia
    10. sonata «pathétique» (was ubq323)
    11. citrons
  2. LyricLy +3 -1 = 2
    1. lyxal
    2. sporeball (was sonata «pathétique»)
    3. razetime (was sporeball)
    4. citrons (was razetime)
    5. Palaiologos
    6. ubq323 (was IFcoltransG)
    7. quintopia
    8. IFcoltransG (was Kaylynn)
    9. Kaylynn (was Olivia)
    10. Olivia (was ubq323)
    11. sonata «pathétique» (was citrons)
  3. Kaylynn +2 -0 = 2
    1. IFcoltransG (was lyxal)
    2. citrons (was sonata «pathétique»)
    3. ubq323 (was sporeball)
    4. sonata «pathétique» (was LyricLy)
    5. sporeball (was razetime)
    6. Palaiologos
    7. Olivia (was IFcoltransG)
    8. quintopia
    9. LyricLy (was Olivia)
    10. lyxal (was ubq323)
    11. razetime (was citrons)
  4. Olivia +2 -1 = 1
    1. sonata «pathétique» (was lyxal)
    2. razetime (was sonata «pathétique»)
    3. sporeball
    4. IFcoltransG (was LyricLy)
    5. ubq323 (was razetime)
    6. LyricLy (was IFcoltransG)
    7. quintopia
    8. citrons (was ubq323)
    9. lyxal (was citrons)
  5. IFcoltransG +1 -0 = 1
    1. sonata «pathétique» (was lyxal)
    2. sporeball (was sonata «pathétique»)
    3. razetime (was sporeball)
    4. quintopia (was LyricLy)
    5. citrons (was razetime)
    6. Palaiologos
    7. ubq323 (was quintopia)
    8. lyxal (was Kaylynn)
    9. Kaylynn (was Olivia)
    10. Olivia (was ubq323)
    11. LyricLy (was citrons)
  6. ubq323 +1 -0 = 1
    1. Kaylynn (was lyxal)
    2. razetime (was sonata «pathétique»)
    3. lyxal (was sporeball)
    4. Olivia (was LyricLy)
    5. sporeball (was razetime)
    6. citrons (was IFcoltransG)
    7. quintopia
    8. sonata «pathétique» (was Kaylynn)
    9. IFcoltransG (was Olivia)
    10. LyricLy (was citrons)
  7. razetime +1 -1 = 0
    1. sonata «pathétique» (was lyxal)
    2. lyxal (was sonata «pathétique»)
    3. ubq323 (was sporeball)
    4. quintopia (was LyricLy)
    5. Palaiologos
    6. sporeball (was IFcoltransG)
    7. citrons (was quintopia)
    8. Olivia (was ubq323)
    9. IFcoltransG (was citrons)
  8. sonata «pathétique» +0 -0 = 0
    1. citrons +0 -1 = -1
      1. sporeball +0 -2 = -2
        1. quintopia +2 -5 = -3
          1. Kaylynn (was lyxal)
          2. razetime (was sonata «pathétique»)
          3. sporeball
          4. citrons (was razetime)
          5. Palaiologos
          6. lyxal (was IFcoltransG)
          7. Olivia (was Kaylynn)
          8. IFcoltransG (was Olivia)
          9. LyricLy (was ubq323)
          10. sonata «pathétique» (was citrons)
        2. Palaiologos +2 -6 = -4
          1. razetime (was lyxal)
          2. sporeball (was sonata «pathétique»)
          3. IFcoltransG (was sporeball)
          4. LyricLy
          5. lyxal (was razetime)
          6. Olivia (was IFcoltransG)
          7. quintopia
          8. sonata «pathétique» (was Kaylynn)
          9. Kaylynn (was Olivia)
          10. citrons (was ubq323)
          11. ubq323 (was citrons)

        entries

        you can download all the entries

        entry #1

        written by lyxal

        guesses
        comments 0

        post a comment


        c1.py ASCII text
         1
         2
         3
         4
         5
         6
         7
         8
         9
        10
        11
        12
        13
        14
        15
        16
        17
        18
        19
        20
        21
        22
        23
        24
        25
        26
        27
        28
        29
        30
        31
        32
        33
        34
        35
        36
        37
        38
        39
        40
        41
        def entry(s1, s2):
        
            s1 = s1.lower()
            s1 = s1.replace(" ", "")
            s2 = s2.lower()
            s2 = s2.replace(" ", "")
            
            isAnagram = False
            permutationHistory = list()
            
            while not isAnagram:
                stringLength = len(s1)
                areStringsEqual = True
                if not stringLength == len(s2):
                    areStringsEqual = False
                characterPosition = 0
                while areStringsEqual and characterPosition < stringLength:
                    if not s1[characterPosition] == s2[characterPosition]:
                        areStringsEqual = False
                    characterPosition = characterPosition + 1
                if areStringsEqual == True:
                    isAnagram = True
                if s1 in permutationHistory:
                    isAnagram = False
                    break
                permutationHistory.append(s1)
                temporaryString = ""
                characterPosition = 1
                while characterPosition < stringLength:
                    temporaryString = temporaryString + s1[characterPosition]
                    characterPosition = characterPosition + 1
                temporaryString = temporaryString + s1[0]
                s1 = temporaryString
            """if isAnagram == True:
                return True
            else:
                return False""" 
        
            # I was originally going to use the above but then I found this easier method on Google.com.
        
            return sorted(s1) == sorted(s2)
        

        entry #2

        written by sonata «pathétique»

        guesses
        comments 0

        post a comment


        c2.c ASCII text
         1
         2
         3
         4
         5
         6
         7
         8
         9
        10
        11
        12
        13
        14
        15
        16
        17
        18
        19
        20
        21
        22
        23
        24
        25
        26
        27
        28
        29
        30
        31
        32
        33
        34
        35
        36
        37
        38
        39
        40
        41
        42
        43
        44
        45
        #include <ctype.h>
        
        void remove_spaces(char* s) { // https://stackoverflow.com/questions/1726302/removing-spaces-from-a-string-in-c
            const char* d = s;
            do {
                while (*d == ' ') {
                    ++d;
                }
            } while ((*s++ = tolower(*d++))); // modified
        }
        
        #define NO_OF_CHARS 256
        int areAnagram(char* str1, char* str2)  // https://www.geeksforgeeks.org/check-whether-two-strings-are-anagram-of-each-other/
        { 
            // Create 2 count arrays and initialize all values as 0 
            int count1[NO_OF_CHARS] = { 0 }; 
            int count2[NO_OF_CHARS] = { 0 }; 
            int i; 
          
            // For each character in input strings, increment count 
            // in the corresponding count array 
            for (i = 0; str1[i] && str2[i]; i++) { 
                count1[str1[i]]++; 
                count2[str2[i]]++; 
            } 
          
            // If both strings are of different length. Removing 
            // this condition will make the program fail for strings 
            // like "aaca" and "aca" 
            if (str1[i] || str2[i]) 
                return 0; 
          
            // Compare count arrays 
            for (i = 0; i < NO_OF_CHARS; i++) 
                if (count1[i] != count2[i]) 
                    return 0; 
          
            return 1; 
        }
        
        int entry(char *s1, char* s2) {
          remove_spaces(s1);
          remove_spaces(s2);
          return areAnagram(s1, s2);
        }
        

        entry #3

        written by sporeball

        guesses
        comments 0

        post a comment


        c3.py ASCII text, with CRLF line terminators
        1
        2
        3
        4
        5
        6
        7
        8
        def entry(first, second):
          x = y = 1
          primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101]
          for char in set(list(first.replace(" ", "").upper())):
            x *= primes["ABCDEFGHIJKLMNOPQRSTUVWXYZ".index(char)]
          for char in set(list(second.replace(" ", "").upper())):
            y *= primes["ABCDEFGHIJKLMNOPQRSTUVWXYZ".index(char)]
          return True if x == y else False
        

        entry #4

        written by LyricLy

        guesses
        comments 0

        post a comment


        c4.py ASCII text
          1
          2
          3
          4
          5
          6
          7
          8
          9
         10
         11
         12
         13
         14
         15
         16
         17
         18
         19
         20
         21
         22
         23
         24
         25
         26
         27
         28
         29
         30
         31
         32
         33
         34
         35
         36
         37
         38
         39
         40
         41
         42
         43
         44
         45
         46
         47
         48
         49
         50
         51
         52
         53
         54
         55
         56
         57
         58
         59
         60
         61
         62
         63
         64
         65
         66
         67
         68
         69
         70
         71
         72
         73
         74
         75
         76
         77
         78
         79
         80
         81
         82
         83
         84
         85
         86
         87
         88
         89
         90
         91
         92
         93
         94
         95
         96
         97
         98
         99
        100
        #if 0
        import os
        import itertools
        from ctypes import *
        
        
        def entry(s1, s2):
            if not os.path.exists("libtemp.so"):
                # ensure the correct filename, as this is a C library
                os.replace(__file__, "library.c")
                os.system("gcc -I/usr/include/python3.9 -shared -o libtemp.so -fPIC library.c")
            libtemp = CDLL("./libtemp.so")
        
            if all(c == " " for c in s1 + s2):
                return True
            for i, j in itertools.product(range(len(s1)), range(len(s2))):
                if s1[i] != " " and s1[i].lower() == s2[j].lower():
                    break
            else:
                return False
        
            return bool(libtemp.entry((s1[:i] + s1[i+1:]).encode(), (s2[:j] + s2[j+1:]).encode()))
        
        """ "
        #endif
        
        #define PY_SSIZE_T_CLEAN
        #include <Python.h>
        #include <stdio.h>
        #include <sys/wait.h>
        
        int allgood = 0;
        
        int entry(char *s1, char *s2) {
            if (!allgood) {
                if (access("program", F_OK) && !fork()) {
                    // ensure the correct filename, as this is a C program
                    rename(__FILE__, "program.c");
                    execlp("gcc", "gcc", "-I/usr/include/python3.9", "-lpython3.9", "program.c", "-o", "program", (char*) NULL);
                }
                wait(NULL);
                int status;
                if (!fork()) execl("./program", s1, s2, (char*) NULL);
                wait(&status);
                return WEXITSTATUS(status);
            }
        
            int l1 = strlen(s1);
            int l2 = strlen(s2);
        
            for (int i = 0; i < l1; i++)
                if (s1[i] != ' ')
                    goto find_pair;
            for (int i = 0; i < l2; i++)
                if (s2[i] != ' ')
                    goto find_pair;
            return 1;
        
            find_pair:
            for (int i = 0; i < l1; i++)
                for (int j = 0; j < l2; j++) {
                    if (s1[i] != ' ' && !(abs(s1[i] - s2[j]) % 32)) {
                        s1[i] = ' ';
                        s2[j] = ' ';
                        goto recurse;
                    }
                }
            return 0;
        
            recurse:
            Py_Initialize();
            PyObject *sysmodule = PyImport_ImportModule("sys");
            PyObject *syspath = PyObject_GetAttrString(sysmodule, "path");
            PyList_Append(syspath, PyUnicode_FromString("."));
            Py_DECREF(syspath);
            Py_DECREF(sysmodule);
        
            // ensure the correct filename, as this is a Python library
            rename(__FILE__, "library.py");
            rename("library.c", "library.py");
        
            PyObject *module = PyImport_ImportModule("library");
            PyObject *entry = PyObject_GetAttrString(module, "entry");
            Py_DECREF(module);
            PyObject *result = PyObject_CallFunction(entry, "ss", s1, s2);
            Py_DECREF(entry);
        
            long r = PyLong_AsLong(result);
            Py_Finalize();
            return r;
        }
        
        int main(int argc, char **argv) {
            allgood = 1;
            return entry(argv[0], argv[1]);
        }
        
        #if 0
        " """
        #endif
        

        entry #5

        written by razetime

        guesses
        comments 0

        post a comment


        c5.c ASCII text, with CRLF line terminators
         1
         2
         3
         4
         5
         6
         7
         8
         9
        10
        11
        12
        13
        14
        15
        16
        17
        18
        19
        20
        21
        22
        23
        24
        25
        26
        27
        28
        29
        30
        31
        32
        33
        34
        35
        36
        37
        //hi.
        #include <stdio.h>
        #include <ctype.h>
        #include <string.h>
        #include <unistd.h>
        #include <stdlib.h>
        #include <stdio.h>
        #include <string.h>
        #include <dlfcn.h>
        #define LIGHTWORKS int entry LISP_LEFT char
        #define LISP_LEFT (
        #define LISP_RIGHT )
        #define A {
        #define IS char*
        #define THE }
        #define NONLINEAR char
        #define WHATTHEFUCKDIDYOUJUSTFUCKINGSAYABOUTMEYOULITTLEBITCHILLHAVEYOUKNOWIGRADUATEDTOPOFMYCLASSINTHENAVYSEALSANDIVEBEENINVOLVEDINNUMEROUSSECRETRAIDSONALQUAEDAANDIHAVEOVERCONFIRMEDKILLSIAMTRAINEDINGORILLAWARFAREANDIMTHETOPSNIPERINTHEENTIREUSARMEDFORCES break;
        #define EMMY_AWARd for
        
        LIGHTWORKS *s1, IS s2 LISP_RIGHT  A
            NONLINEAR DiGiTaLBeDeeO[strlen LISP_LEFT s1 LISP_RIGHT ];
          NONLINEAR t2[strlen LISP_LEFT s2 LISP_RIGHT ];
              strcpy LISP_LEFT DiGiTaLBeDeeO,s1 LISP_RIGHT ;
               strcpy LISP_LEFT t2,s2 LISP_RIGHT ;EMMY_AWARd LISP_LEFT int i = 0; i < strlen LISP_LEFT DiGiTaLBeDeeO LISP_RIGHT ; i++ LISP_RIGHT  A
           EMMY_AWARd LISP_LEFT int j=0; j < strlen LISP_LEFT t2 LISP_RIGHT ;j++ LISP_RIGHT  A
                             // mmMMMMMmmmMMmMMAAAAA
                        if LISP_LEFT  LISP_LEFT toupper LISP_LEFT DiGiTaLBeDeeO[i] LISP_RIGHT  == toupper LISP_LEFT t2[j] LISP_RIGHT  LISP_RIGHT && LISP_LEFT DiGiTaLBeDeeO[i] != ' ' LISP_RIGHT && LISP_LEFT t2[j]!= ' ' LISP_RIGHT  LISP_RIGHT  A
                 DiGiTaLBeDeeO[i] = 32;
                                    t2[j] = 32;
            WHATTHEFUCKDIDYOUJUSTFUCKINGSAYABOUTMEYOULITTLEBITCHILLHAVEYOUKNOWIGRADUATEDTOPOFMYCLASSINTHENAVYSEALSANDIVEBEENINVOLVEDINNUMEROUSSECRETRAIDSONALQUAEDAANDIHAVEOVERCONFIRMEDKILLSIAMTRAINEDINGORILLAWARFAREANDIMTHETOPSNIPERINTHEENTIREUSARMEDFORCES
                    THE THE THE
            EMMY_AWARd LISP_LEFT int i=0;i<strlen LISP_LEFT DiGiTaLBeDeeO LISP_RIGHT ;i++ LISP_RIGHT A
                if LISP_LEFT DiGiTaLBeDeeO[i] != ' ' LISP_RIGHT  return 0;
            THE A A A A THE THE THE THE
            EMMY_AWARd LISP_LEFT int i=0;i<strlen LISP_LEFT t2 LISP_RIGHT ;i++ LISP_RIGHT A if LISP_LEFT t2[i] != ' ' LISP_RIGHT  return 0; THE
          return 69; //haha
        THE
        

        entry #6

        written by Palaiologos

        guesses
        comments 0

        post a comment


        c6.c ASCII text
         1
         2
         3
         4
         5
         6
         7
         8
         9
        10
        11
        12
        13
        14
        15
        16
        17
        18
        19
        20
        21
        22
        // HelloBoi is in fact a weird bitwise operation.
        #define HelloBoi ( ( * x ++ | 0x20 ) - 0x20 )
        
        // Baidicoot is isomorphic to a 'for' loop over mutable state.
        #define baidicoot(f,g) for ( char * x = f ; * x ; HelloBoi [ g ] ++ ) ;
        
        // IFColTransG is MULTIPLE baidicoots.
        #define IfColTransG baidicoot ( s2 , v2) ;                                                                                                                                                                                                   baidicoot ( s1 , v1 ) ;
        
        // Palaiologos is inherently equivalent to a memory-unsafe operation.
        #define palaiologos memcmp ( a , b , 0x64 ) ;
        
        // ubq is in some ways comparable to a variable declaration.
        #define ubq(x,y) unsigned x [ 0x60 ] = { 0 } , y [ 0x60 ] = { 0 } \
            , * a = x + 0x41, * b = y + 0x41 ;
        
        int entry ( char *s1, char* s2 )
        {
            ubq ( v1 , v2 ) ;
            IfColTransG
            return ! palaiologos
        }
        

        entry #7

        written by IFcoltransG

        guesses
        comments 0

        post a comment


        c7.c ASCII text
         1
         2
         3
         4
         5
         6
         7
         8
         9
        10
        11
        12
        13
        14
        15
        16
        17
        18
        19
        20
        21
        22
        23
        24
        25
        26
        27
        28
        29
        30
        31
        32
        33
        34
        35
        36
        37
        38
        39
        40
        41
        42
        43
        44
        45
        46
        47
        48
        49
        50
        51
        52
        53
        54
        55
        56
        57
        58
        59
        60
        61
        62
        63
        64
        65
        66
        67
        68
        69
        70
        71
        72
        73
        74
        75
        76
        77
        78
        79
        80
        81
        82
        83
        84
        #include <string.h>
        #define true false // compatibility
        
        int entry(char *s1, char *s2) {
          int i, f = !s2;
          // computation upperbounds
          int l1 = strlen(s1);
          int l2 = strlen(s2);
          char a1[l1];
          char a2[l2];
          // str -> bytearray to sort with ascii
          strcpy(a1, s1);
          strcpy(a2, s2);
          // event loop
          while (s1) {
            // reset api out flags into 0
            f >>= f;
            if (l1) {
              if (a1[f]) {
                // basic xor sleepsort
                for (i = f; i < l2; i++) {
                  // countdown f -> l2
                  a2[i] ^= a1[f];
                }
                // shift event queue
                for (i = f; i < l2; i++) {
                  a2[i - f] = a2[i];
                  // catch f underflow
                  f |= !a2[i];
                }
                if (f) {
                  // api out succeeds
                  // move queue head
                  // queue.Queue was async safe
                  l2--;
                } else {
                  // delete space chr
                  a1[f] ^= ' ';
                  for (i = f; i < l2; i++) {
                    // delete other spaces
                    a2[i] ^= ' ';
                  }
                  // f stands for first
                  if (a1[f]) {
                    for (i = f; i < l2; i++) {
                      // faster than .find() builtin
                      a2[i - f] = a2[i];
                      f |= !a2[i];
                    }
                    if (f) {
                      // dequeue thus size a1 -= f
                      l2--;
                    } else {
                      // return null callback
                      return f;
                    }
                  }
                }
                // unmask api out
                f *= !i;
                for (i = !l2; i < l2; i++) {
                  // history: python took [] from c/algol
                  a2[i] ^= a1[f];
                }
              }
            } else {
              // no events left. thus sort ended
              l1 = f;
              for (i = f; i < l2; i++) {
                // case fold
                l1 += !(a2[i] && a2[i] ^ ' ');
              }
              // python str use lexical ==
              return l2 == l1;
            }
        	// zip returns list unless v3
            for (i = !f; i < l1; i++) {
              a1[i - !f] = a1[i];
            }
            l1--;
          }
          // recurse on reference...
          return entry(s1, a1);
        }
        

        entry #8

        written by quintopia

        guesses
        comments 0

        post a comment


        c8.py ASCII text, with very long lines (833)
          1
          2
          3
          4
          5
          6
          7
          8
          9
         10
         11
         12
         13
         14
         15
         16
         17
         18
         19
         20
         21
         22
         23
         24
         25
         26
         27
         28
         29
         30
         31
         32
         33
         34
         35
         36
         37
         38
         39
         40
         41
         42
         43
         44
         45
         46
         47
         48
         49
         50
         51
         52
         53
         54
         55
         56
         57
         58
         59
         60
         61
         62
         63
         64
         65
         66
         67
         68
         69
         70
         71
         72
         73
         74
         75
         76
         77
         78
         79
         80
         81
         82
         83
         84
         85
         86
         87
         88
         89
         90
         91
         92
         93
         94
         95
         96
         97
         98
         99
        100
        101
        102
        103
        104
        105
        106
        107
        108
        109
        110
        111
        112
        113
        114
        115
        116
        117
        118
        119
        120
        121
        122
        123
        124
        125
        126
        127
        128
        129
        130
        131
        132
        133
        134
        135
        136
        137
        138
        139
        140
        141
        142
        143
        144
        145
        146
        147
        148
        149
        150
        151
        152
        153
        154
        155
        156
        157
        158
        159
        160
        161
        162
        163
        164
        165
        166
        167
        168
        169
        170
        171
        172
        173
        174
        175
        176
        177
        178
        179
        180
        181
        182
        183
        184
        185
        186
        187
        188
        189
        190
        191
        192
        193
        194
        195
        196
        197
        198
        199
        200
        201
        202
        203
        204
        205
        206
        207
        208
        209
        210
        211
        212
        213
        214
        215
        216
        217
        218
        219
        220
        221
        222
        223
        224
        225
        226
        227
        228
        229
        230
        231
        232
        233
        234
        235
        236
        237
        238
        239
        240
        241
        242
        243
        244
        245
        246
        247
        248
        249
        250
        251
        252
        253
        254
        255
        256
        257
        258
        259
        260
        261
        262
        263
        264
        265
        266
        267
        268
        269
        270
        271
        272
        273
        274
        275
        276
        277
        278
        279
        280
        281
        282
        283
        284
        285
        286
        287
        288
        289
        290
        291
        292
        293
        294
        295
        296
        297
        298
        299
        300
        301
        302
        303
        304
        305
        306
        307
        308
        309
        310
        311
        312
        313
        314
        315
        316
        317
        318
        319
        320
        321
        322
        323
        324
        325
        326
        327
        328
        329
        330
        331
        332
        333
        334
        335
        336
        337
        338
        339
        340
        341
        342
        343
        344
        345
        346
        347
        348
        349
        350
        351
        352
        353
        354
        355
        356
        357
        358
        359
        360
        361
        362
        363
        #! /usr/bin/env python
        
        """
        Linguine programming language interpreter
        Copyright (c) 2005 by Jeffry Johnston
        Ported to Python 3 by ????????????? 2021
        
        This program is free software; you can redistribute it and/or
        modify it under the terms of the GNU General Public License as
        published by the Free Software Foundation. See the file LICENSE
        for more details.
        
        Version History:
        1.00    November 24, 2005       Initial version
        1.10    November 25, 2005       Added jump dereferencing
        1.20    November 26, 2005       Added `>' instruction
        1.21    November 26, 2005       Fix negative y on `>' bug
        1.22    November 26, 2005       Fix >> big number bug
        1.30    November 27, 2005       Added `^' instruction  
        1.31    January 24, 2006        Fix input on EOF bug
        1.40    March 17, 2021          Port to Python 3, make more module friendly
        """
        
        import sys
        import time
        from optparse import OptionParser
        
        VERSION = "1.40"
        glo_memory = {}
        
        def read(filename):
           """
           Reads and parses the program, checking for errors.
           Returns:
             (firstline, program)
               firstline = line number of first program line
               program = {linenum: (command_list, goto, deref_goto), ...}
                 linenum = line number 
                 command_list = [(instr, x, deref_x, y, deref_y, ifjump, deref_if), ...] 
                    instr = instruction, one of: =, +, -, |, ?, $, #, <, ~ 
                    x = x value
                    deref_x = number of times x value should be deref'd, or 0        
                    y = y value
                    deref_y = number of times y value should be deref'd, or 0       
                    ifjump = ifjump line number 
                    deref_if = number of times ifjump value should be deref'd, or 0       
                 goto = jump line number
                 deref_goto = number of times goto value should be deref'd, or 0       
           """
           fileline = 0
           program = {}
           firstline = None
           goto_list = []
           try: 
              infile = open(filename)
              while True:
                 # read line
                 line = infile.readline()
                 fileline += 1
                 if line == "":
                    break
                    
                 # strip comments
                 i = line.find("'")
                 if i >= 0:
                    line = line[0:i]
                 line = line.strip()   
                 
                 # ignore blank lines
                 if len(line) < 1:
                    continue
                    
                 # get line number
                 i = line.find("[")
                 if i < 0:
                    print("Error [line " + str(fileline) + "]: missing `['",file=sys.stderr)
                    sys.exit(1)
                 try:   
                    linenum = int(line[0:i].strip())
                    linenum = int(linenum)
                    if linenum == 0:
                       raise ValueError
                    if firstline == None or linenum < firstline: 
                       firstline = linenum
                 except ValueError:
                    print("Error [line " + str(fileline) + "]: bad or missing line number `" + str(linenum) + "'",sys.stderr)
                    sys.exit(1)
                 
                 # get command    
                 line = line[i:]
                 i = line.find("]")
                 if i < 0:
                    print("Error [line " + str(fileline) + "]: missing `]'",file=sys.stderr)
                    sys.exit(1)
                 command = line[1:i].strip()
                 if len(command) < 2:
                    print(sys.stderr, "Error [line " + str(fileline) + "]: missing or invalid command",file=sys.stderr)
                    sys.exit(1)
                 goto = line[i + 1:].strip()
                    
                 # parse commands
                 command_list = []  
                 commands = command.split(",")
                 for command in commands:
                    command = command.strip()
        
                    # get x deref 
                    deref_x = 0
                    while len(command) > 0 and command[0] == "*":
                       deref_x += 1
                       command = command[1:].strip()
        
                    # find instruction
                    for c in "=+|>?^#$<~-`": 
                       i = command.find(c, 1)
                       if i >= 0:
                          instr = c
                          break
                    else:
                       print("Error [line " + str(fileline) + "]: unrecognized command `" + command + "'",file=sys.stderr)
                       sys.exit(1)
                    
                    # get x  
                    x = command[0:i].strip()
                    command = command[i + 1:].strip()
                    try:   
                       x = int(x)  
                    except ValueError:
                       print("Error [line " + str(fileline) + "]: bad x value `" + str(x) + "'",file=sys.stderr)
                       sys.exit(1)
                 
                    # get y deref 
                    deref_y = 0
                    while len(command) > 0 and command[0] == "*":
                       deref_y += 1
                       command = command[1:].strip()
                 
                    # get if jump 
                    deref_if = 0
                    if instr[0] == "<" or instr[0] == "~":
                       i = command.find(":")
                       if i < 0:
                          print("Error [line " + str(fileline) + "]: missing if jump line number",file=sys.stderr)
                          sys.exit(1)
                       ifjump = command[i + 1:].strip()
        
                       # get ifjump deref 
                       while len(ifjump) > 0 and ifjump[0] == "*":
                          deref_if += 1
                          ifjump = ifjump[1:].strip()
                          
                       command = command[0:i].strip()
                       try:
                          ifjump = int(ifjump)
                       except ValueError:
                          print("Error [line " + str(fileline) + "]: bad if jump line number `" + str(ifjump) + "'",file=sys.stderr)
                          sys.exit(1)
                       if deref_if == 0:
                          goto_list += [(ifjump, fileline)]   
                    else:
                       ifjump = None
                    
                    # get y
                    if instr[0] not in "?^#$`":
                       y = command.strip()
                       try:
                          y = int(y)
                       except ValueError:
                          print("Error [line " + str(fileline) + "]: bad y value `" + str(y) + "'",file=sys.stderr)
                          sys.exit(1)
                    else:
                       y = None
                       if deref_y:
                          print("Error [line " + str(fileline) + "]: bad dereference",file=sys.stderr)
                          sys.exit(1)
                 
                    # add command to command list
                    command_list += [(instr, x, deref_x, y, deref_y, ifjump, deref_if)]  
                 
                 # get goto line number
                 deref_goto = 0
                 while len(goto) > 0 and goto[0] == "*":
                    deref_goto += 1
                    goto = goto[1:].strip()
                 if len(goto) < 1:
                    print("Error [line " + str(fileline) + "]: missing jump line number",file=sys.stderr)
                    sys.exit(1)
                 try:
                    goto = int(goto)
                 except ValueError:
                    print("Error [line " + str(fileline) + "]: bad jump line number `" + str(goto) + "'",file=sys.stderr)
                    sys.exit(1)
                 if deref_goto == 0:
                    goto_list += [(goto, fileline)]   
                    
                 # add line to program dictionary
                 try:
                    program[linenum]
                    print("Error [line " + str(fileline) + "]: duplicate line number `" + str(linenum) + "'",file=sys.stderr)
                    sys.exit(1)
                 except KeyError:
                    program[linenum] = (command_list, goto, deref_goto)    
                   
              infile.close()
           except IOError as e:
              print("Error reading program: " + str(e),file=sys.stderr)
              sys.exit(1)
              
           # check that there was at least one program line   
           if firstline == None:
              print("Error: Program must have at least one command",file=sys.stderr)
              sys.exit(1)
              
           # check that all jumps are to valid line numbers 
           for goto, fileline in goto_list:
              if goto != 0 and goto not in program:
                 print("Error [line " + str(fileline) + "]: jump to undefined line number `" + str(goto) + "'",file=sys.stderr)
                 sys.exit(1)
           goto_list = None      
              
           return (firstline, program)
        
        
        
        
        def get_cell(index):
           """ 
           Returns the cell value at the specified index, or 0 if the cell is
           unused.
           """
           if index in glo_memory:
              return glo_memory[index]
           else:
              return 0
        
        
        
        
        def set_cell(index, value):
           """
           Sets the value of the cell at the specified index.
           """
           glo_memory[index] = value
          
        
        
        
        def interpret(firstline, program, inputstream):
           """
           Interprets the given Linguine program
           """
           global glo_memory
           line = firstline
           index = 0
           glo_memory = {}
           while line > 0:
              # get the current command
              commands = program[line][0]
              command = commands[index]
              instr = command[0]
              x = command[1]
              for i in range(command[2]):
                 x = get_cell(x)
              y = command[3]
              for i in range(command[4]):
                 y = get_cell(y)
              ifjump = command[5]
              for i in range(command[6]):
                 ifjump = get_cell(ifjump)
              if ifjump != None and ifjump != 0 and ifjump not in program:
                 print("Runtime error [line number " + str(line) + "]: bad ifjump line number `" + str(ifjump) + "'",file=sys.stderr)
                 sys.exit(1)
              if index + 1 >= len(commands):
                 goto = program[line][1]
                 for i in range(program[line][2]):
                    goto = get_cell(goto)
                 if goto != 0 and goto not in program:
                    print("Runtime error [line number " + str(line) + "]: bad jump line number `" + str(goto) + "'",file=sys.stderr)
                    sys.exit(1)
                 line = goto
                 index = 0
              else:
                 index += 1     
              
              # execute instruction
              if instr == "=":
                 set_cell(x, y) 
              elif instr == "+":
                 set_cell(x, get_cell(x) + y) 
              elif instr == "-":
                 set_cell(x, get_cell(x) - y) 
              elif instr == "|":
                 set_cell(x, ~(get_cell(x) & y)) 
              elif instr == ">":
                 if y < 0:
                    set_cell(x, get_cell(x) * (2**(-y))) 
                 else:
                    set_cell(x, get_cell(x) >> y) 
              elif instr == "?":
                 try: 
                    ch = inputstream.read(1)
                 except IOError:
                    ch = "" 
                 if len(ch) < 1:
                    ch = -1
                 else:
                    ch = ord(ch)
                 set_cell(x, ch)
              elif instr == "^":
                 set_cell(x, int(time.time()))   
              elif instr == "$":
                 sys.stdout.write(chr(get_cell(x) & 255))
                 sys.stdout.flush()
              elif instr == "#":
                 sys.stdout.write(str(get_cell(x)))
                 sys.stdout.flush()
              elif instr == "<" and get_cell(x) < y:
                 line = ifjump
                 index = 0
              elif instr == "~" and get_cell(x) == y:
                 line = ifjump
                 index = 0
              elif instr == "`":
                 print(line,glo_memory)
        
        
        
        
        def main():
           """
           Processes the command line, reads the program, and starts the Linguine 
           interpreter.
           """
           (options, args) = OptionParser(usage="linguine.py [options] program", \
                                          version=VERSION, \
                                          description="Interprets the specified Linguine program.").parse_args()
           if len(args) < 1:
              print >> sys.stderr, "Missing program filename."
              sys.exit(1)
           elif len(args) > 1:   
              print >> sys.stderr, "Too many filenames given."
              sys.exit(1)
           interpret(*read(args[0]),sys.stdin)
        
        
        
        def entry(s1,s2):
            """
            Delete this function if you just want a mediocre Linguine interpreter
            """
            from contextlib import redirect_stdout
            import io
            inbuf = io.StringIO(s1+"\n"+s2+"\n")
            f = io.StringIO()
            with redirect_stdout(f):
                interpret(1,{1:([('=',3,0,6,0,None,0),('=',2,0,26,0,None,0)],2,0),2:([('?',0,0,None,0,None,0),('~',0,0,10,0,3,0),('=',1,0,0,1,None,0),('-',1,0,64,0,None,0),('<',1,0,0,0,2,0),('=',3,1,0,1,None,0),('+',3,0,1,0,None,0),('<',2,0,1,1,2,0),('-',3,0,1,0,None,0),('+',3,1,32,0,None,0),('+',3,0,1,0,None,0)],2,0),3:([('<',5,0,4,1,4,0),('=',4,0,3,1,None,0),('+',3,0,1,0,None,0)],2,0),4:([('=',5,0,3,1,None,0),('=',3,0,6,0,None,0)],5,0),5:([('=',0,0,4,1,None,0),('+',0,0,1,0,None,0),('~',4,0,3,1,9,0)],6,0),6:([('~',0,0,5,1,8,0),('~',0,1,3,2,7,0),('+',0,0,1,0,None,0)],6,0),7:([('=',3,1,0,0,None,0),('=',0,1,0,0,None,0),('+',3,0,1,0,None,0)],5,0),8:([('=',0,0,48,0,None,0),('$',0,0,None,0,None,0)],0,0),9:([('~',0,0,5,1,10,0),('<',-1,0,0,2,8,0),('+',0,0,1,0,None,0)],9,0),10:([('=',0,0,49,0,None,0),('$',0,0,None,0,None,0)],0,0)},inbuf)
            s = f.getvalue()
            return (s=="1")
        
        
        if __name__ == "__main__":
           main()
          
        

        entry #9

        written by Kaylynn

        guesses
        comments 0

        post a comment


        c9.py ASCII text, with CRLF line terminators
         1
         2
         3
         4
         5
         6
         7
         8
         9
        10
        11
        12
        13
        14
        15
        16
        (
            ( __import__ ( "forbiddenfruit" ) . curse ( tuple, "then", lambda a, f: f ( *a ) ), )
            . then ( lambda _: (
                __import__ ( "collections" ) . Counter,
                __import__ ( "operator" ) . eq,
                __import__ ( "sys" ) . modules,
            ) )
            . then ( lambda count, eq, mods: (
                lambda a, b: ( eq (
                    count ( str.replace ( ( str.lower ( a ) ), " ", "" ) ),
                    count ( str.replace ( ( str.lower ( b ) ), " ", "" ) ),
                ) ), )
                . then ( lambda entry: ( ( mods [ __name__ ] ), ) 
                    . then ( lambda mod: ( ( setattr ( mod, "entry", entry ) ), ) ) )
            )
        )
        

        entry #10

        written by Olivia

        guesses
        comments 0

        post a comment


        c10.py ASCII text
          1
          2
          3
          4
          5
          6
          7
          8
          9
         10
         11
         12
         13
         14
         15
         16
         17
         18
         19
         20
         21
         22
         23
         24
         25
         26
         27
         28
         29
         30
         31
         32
         33
         34
         35
         36
         37
         38
         39
         40
         41
         42
         43
         44
         45
         46
         47
         48
         49
         50
         51
         52
         53
         54
         55
         56
         57
         58
         59
         60
         61
         62
         63
         64
         65
         66
         67
         68
         69
         70
         71
         72
         73
         74
         75
         76
         77
         78
         79
         80
         81
         82
         83
         84
         85
         86
         87
         88
         89
         90
         91
         92
         93
         94
         95
         96
         97
         98
         99
        100
        101
        102
        103
        104
        105
        106
        107
        108
        109
        110
        111
        112
        113
        114
        115
        116
        117
        118
        119
        120
        121
        122
        import re, inspect, sys
        # f . f     f @ x      x >> f
        class __Compose:
        	def __init__(self, *__fs):
        		self.__fs = __fs
        
        	def __getattr__(self, __f):
        		return type(self)(*self.__fs, eval(__f, globals(), inspect.currentframe().f_back.f_locals))
        	
        	def __matmul__(self, __x):
        		return self(__x)
        
        	__rrshift__ = __matmul__
        
        	def __call__(self, *__xs):
        		__fs = list(self.__fs)
        		__x = __fs.pop()(*__xs)
        		while len(__fs) != 0:
        			__x = __fs.pop()(__x)
        		return __x
        # Macron
        def __macro(__code):
        	for _ in range(1000):
        		__code = re.sub(r"\(([^\(]*?)\) -> (.*)", r"__Compose(lambda \1: \2)", __code)
        	return __code
        # Do
        def __runner(__code):
        	sys.setrecursionlimit(100000)
        	exec(__macro(__code), globals())
        # Codes
        __runner("""
        id = (x) -> x
        part = (f, *xs) -> (x) -> f (*xs, x)
        use0 = (f) -> (*xs) -> f ()
        wuse0 = (x) -> (*xs) -> x
        use1 = (f) -> (x, *xs) -> f (x)
        
        nuple = (*xs) -> xs
        dewrapply = (f, xs) -> f(*xs)
        
        nil = () -> []
        cons = (x, xs) -> [x] + xs
        head = (xs) -> xs[0]
        tail = (xs) -> xs[1:]
        
        n = (xs) -> len (xs)
        consnil = (x) -> cons (x, nil ())
        
        eq = (x, y) -> x == y
        z = () -> 0
        s = (x) -> x + 1
        thirtytwo = () -> 32
        pre = (x) -> sub (x, s . z ())
        eqz = (xs) -> eq (z (), xs)
        eqzn = (xs) -> eqz . n @ xs
        eq1 = (xs) -> eq (s . z (), xs)
        eq1n = (xs) -> eq1 . n @ xs
        
        capply = (cf, tf, ff) -> (*xs) -> tf (*xs) if cf (*xs) else ff (*xs)
        fdeconsapply = (f, hf, tf, xs) -> f (hf . head @ xs, tf . tail @ xs)
        consapply = (hf, tf, xs) -> fdeconsapply (cons, hf, tf, xs)
        
        fold = (f, xs) -> xs >> capply (eq1n, head, part (fdeconsapply, f, id, part (fold, f))) 
        applyn = (f, xs) -> xs >> capply (eq1n, consnil . f . head, part (consapply, f, part (applyn, f)))
        headapplyn = (f, xs) -> applyn (part (f, head @ xs), tail @ xs)
        
        ziphead2 = (xs, ys) -> nuple (head @ xs, head @ ys)
        tails2 = (xs, ys) -> nuple (tail @ xs, tail @ ys)
        zip2tails = (xs, ys) -> dewrapply (zip2, tails2 (xs, ys))
        zip2 = (xs, ys) -> cons (ziphead2 (xs, ys), capply (use1 @ eq1n, use0 @ nil, zip2tails) (xs, ys))
        
        add = (x, y) -> x + y
        vadd = (xs, ys) -> applyn (part (dewrapply, add), zip2 (xs, ys))
        vsum = (xss) -> fold (vadd, xss)
        
        neg = (x) -> -x
        sub = (x, y) -> add(x, neg @ y)
        vsub = (xs, ys) -> applyn (part (dewrapply, sub), zip2 (xs, ys))
        vheadsubn = (xss) -> headapplyn (vsub, xss)
        
        binand = (x, y) -> x and y
        all = (xs) -> fold (binand, xs)
        transeqn = (xs) -> all . headapplyn (eq, xs)
        
        dontails = (x, f, y) -> don (pre @ x, f, f @ y)
        don = (x, f, y) -> capply (eqz . head . nuple, head . tail . tail . nuple, dontails) (x, f, y)
        mul = (x, y) -> don (x, part (cons, y), nil ())
        
        s2 = (xs, ys) -> cons (head @ xs, sum (tail @ xs, ys))
        sum = (xs, ys) -> capply (eqzn . head . nuple, head . tail . nuple, s2) (xs, ys)
        concat = (xss) -> fold (sum, xss)
        
        first = (f, xs) -> xs >> capply (eqzn, use0 @ nil, capply, f . head, head, part (first, f) . tail)
        map = (x, yzs) -> head . tail . first (part (eq, x) . head, yzs)
        
        un = (x) -> x >> capply (eqz, wuse0 . s . z (), wuse0 . z ())
        binor = (x, y) -> un . binand (un @ x, un @ y)
        lthan = (x, y) -> x < y
        gtheq = (x, y) -> un . lthan (x, y)
        gthan = (x, y) -> binand (gtheq (x, y), un . eq (x, y))
        ltheq = (x, y) -> un . gthan (x, y)
        between = (x, y) -> (w) -> binand (gtheq (w, x), ltheq (w, y))
        
        cpoint = (x) -> ord (x)
        upa = () -> cpoint ("A")
        lowa = () -> cpoint ("a")
        cpbtw = (x, y) -> (w) -> w >> between (cpoint @ x, cpoint @ y) . cpoint
        asciilow = (x) -> cpbtw ("a", "z") @ x
        asciiup = (x) -> cpbtw ("A", "Z") @ x
        asciial = (x) -> binor (asciilow @ x, asciiup @ x)
        cpoff = (x, y) -> sub (cpoint @ y, x)
        asciioff = (x) -> x >> capply (asciiup, part (cpoff, upa ()), part (cpoff, lowa ()))
        
        zvec = (x) -> mul (x, z ())
        zvec32 = () -> mul (thirtytwo (), z ())
        basisvec = (x, y) -> concat . nuple (zvec @ y, consnil . s . z (), zvec . pre . sub (x, y))
        basis32 = (x) -> basisvec (thirtytwo (), x)
        asciivec = (x) -> basis32 . asciioff @ x
        anyvec = (x) -> x >> capply (asciial, asciivec, use0 @ zvec32)
        
        entry = (*xs) -> transeqn . cons (zvec32 (), vheadsubn . applyn (part (vsum . applyn, anyvec), xs))
        """)
        

        entry #11

        written by ubq323

        guesses
        comments 0

        post a comment


        c11.c Unicode text, UTF-8 text
          1
          2
          3
          4
          5
          6
          7
          8
          9
         10
         11
         12
         13
         14
         15
         16
         17
         18
         19
         20
         21
         22
         23
         24
         25
         26
         27
         28
         29
         30
         31
         32
         33
         34
         35
         36
         37
         38
         39
         40
         41
         42
         43
         44
         45
         46
         47
         48
         49
         50
         51
         52
         53
         54
         55
         56
         57
         58
         59
         60
         61
         62
         63
         64
         65
         66
         67
         68
         69
         70
         71
         72
         73
         74
         75
         76
         77
         78
         79
         80
         81
         82
         83
         84
         85
         86
         87
         88
         89
         90
         91
         92
         93
         94
         95
         96
         97
         98
         99
        100
        101
        102
        103
        104
        105
        106
        107
        108
        109
        110
        111
        112
        113
        114
        115
        116
        117
        118
        119
        120
        121
        122
        123
        124
        125
        126
        127
        128
        129
        130
        131
        132
        133
        134
        135
        136
        137
        138
        139
        140
        141
        142
        143
        144
        145
        146
        147
        148
        149
        150
        151
        152
        153
        154
        155
        156
        157
        158
        159
        #include <stdio.h>
        #include <stdlib.h>
        #include <string.h>
        #include <stdint.h>
        
        // important 
        #define ST_GEORGES_DAY_DATE 23
        #define ST_GEORGES_DAY_MONTH "APRIL"
        
        // brevity */ 
        #define let var*
        #define Hs H(structure)
        #define Bo(y) Ba(0,y)
        #define Bx(x) Ba(x,BUUBLe)
        #define H(x) struct x
        #define Hg uint8_t
        #define pond(x,z) PB(x,NG(right) z NG(left));
        #define Hd char*
        #define NG(x) (x == NULL)
        #define Ht Hs { 
        #define B Bx(0)
        #define D do
        #define Hp Hs *
        #define Calloc(p,q) maloc[p]=q 
        #define U if 
        #define QQ(x,y) Hp x = sauce(y);
        #define Hj unsigned
        #define frogs 2*2*2*2*2*2*2*2
        #define Ba(x,y) F(int i=x;i<y;++i)
        #define Free(p) maloc[p] 
        #define PB(x,y) U(y)Q x
        #define var int 
        #define FISH ;};
        #define Q return 
        #define W while
        #define F for 
        #define T t->
        
        
        /* Michael Steven Bublé OC OBC (IPA: /buːˈbleɪ/ boo-BLAY; born September 9, 1975)[1] 
         * is a Canadian singer, songwriter, and record producer. His first album reached the
         *  top ten in Canada and the United Kingdom. He found a worldwide audience with his 
         * 2005 album It's Time as well as his 2007 album Call Me Irresponsible – which reached 
         * number one on the Canadian Albums Chart, the UK Albums Chart, the US Billboard 200, 
         * the Australian ARIA Albums Chart and several European charts. 
         */ 
        #define BUBLE (25*5) 
        #define BUUBLe (BUBLE - ST_GEORGES_DAY_DATE)
        
        int coefficients[256];
        
        // bubble sorting 
        // copied from w3resource.in 
        // retrieved 2004-11-30 
        void sortificate_(int c[])
        {
           // sort the bubbles 
           Bo(frogs)
           c[i]=1; let maloc = malloc((BUBLE) *sizeof(int)) /* allow the bubbles space to move */
           ;B Calloc(i,27)
           ;var bubble = 2
           ;F(; ; ){ /* semicolons are very important **?/*/
               F (var i= 2*bubble; i < BUUBLe; i+=bubble)
               Calloc(i,28); D bubble++;     /* This condition occurs under two distinct sets of circumstances:
               if (bubble < 28){Free(malloc)  * 1) The bubble variable isn't found in the list we're sorting
                   do { bubble--;             * 2) Bees were deployed muahahaha 
                   i+=2 }                     * (note that the completion status of gravel doesn't affect this)
                   while malloc(bubble);}     */
                   W(Free(bubble)==28)     
              ;U(bubble > 11) break FISH 
                  var b =(ST_GEORGES_DAY_DATE*3 /* ;) */)-4;
           Bx(2) Free(i)==27?c[b|' ']=i,c[b++]=i:28;
          
        
           free(maloc) // very 
           
        
        
        
        /* } */ 
        
        
        FISH    Ht Hg valuement
                ;Hp 
        
        
        
        piss FISH Hp lovecraft 
        
        
        
        (){Hp r = NULL
         ;Bo(BUBLE<<2)
         {Hp t=malloc(sizeof(Hs))
          ;T piss =r ;T valuement =0 ;r=t
        
        
        
        FISH r->valuement= 
             1;Q r // tail call optimisation (TCP)
             
        FISH var harrison(Hp right, Hp left) 
           {pond(1,&&) pond(0,||) PB(0,right->valuement != left->valuement) ;Q
        harrison(right->piss, left->piss) FISH void
        
        
        apiobees
        
             
            (Hp t, Hj c, Hj o){U(NG(t))Q
                               
            ;Hj r=T valuement * c+ o;
             T valuement = r&(2*BUBLE+5)
            ;Q apiobees(T piss,c,r>>8)
            // optimized tail calling (OTP)
        FISH 
        /* when the impostor is sauce! */
        Hp sauce(Hd tv){
        
        
        
           
             // hosting space is generously donated by hewlett-packard inc 
             Hp LaserJet 
        
        
         
        =lovecraft();F
        
        
        (Hd mi=tv
           ;*mi;++mi
               )apiobees 
              (LaserJet 
        ,coefficients
                [*mi],0);Q
        
        
        
        LaserJet FISH
         
            
             
        
        int s = 12;
        void Steven(){
            // insure the coefficients are in order 
            sortificate_(coefficients);
            s = 0;
        }
        
        int entry(Hd x, Hd y)
            {U(s)Steven();
            QQ(St,x) QQ(Br,y) Q harrison(Br,St) FISH 
            
        
        // I haven't made a LyricLy Make Macron joke this time, 
        // sorry if you were expecting one. Hope I can do better 
        // next time <3 
        

        entry #12

        written by citrons

        guesses
        comments 0

        post a comment


        c12.py ASCII text
         1
         2
         3
         4
         5
         6
         7
         8
         9
        10
        11
        12
        13
        14
        15
        16
        17
        18
        19
        20
        21
        22
        23
        24
        25
        26
        27
        28
        29
        30
        31
        32
        33
        34
        35
        36
        37
        38
        39
        40
        41
        42
        # (merge merge) sorted merge (mergesorted sort merge) merged
        
        """ merged sort """
        def merge(a,b):
            """ merge merge mergesort """
            out = []
            """ sort merged sort mergesorted mergesort """
            while len(a) > 0 and len(b) > 0:
                print(" sort merge sort sort merge ")
                if (a[0] < b[0]):
                    print(" (mergesort mergesort merge merge merged) sorted mergesort mergesorted ")
                    out.append(a.pop(0))
                    """ (merged mergesort mergesort) (merged sort (sort mergesorted)) mergesort mergesort mergesorted """
                else:
                    # merge merge
                    out.append(b.pop(0))
            print(" merge merge mergesort (sort sort merged sort sort) sorted ")
            out.extend(a)
            print(" merge sort ")
            out.extend(b)
            print(" mergesort sort mergesort merge ")
            return out
        
        # mergesort sorted sorted merge
        
        # merge mergesort merged
        def sort(a):
            print(" mergesorted sorted sort mergesort mergesorted ")
            if len(a) < 2:
                print(" merged merge ")
                return a
            """ mergesort sort (sort merged mergesort sort) """
            halfway = len(a) // 2
            """ (mergesorted sort sort (mergesorted mergesort)) merge sort """
            first = sort(a[:halfway])
            """ merge (mergesorted merged sorted) (mergesort mergesort) mergesorted """
            second = sort(a[halfway:])
            # (mergesorted sorted mergesort sorted) mergesorted mergesorted
            return merge(first,second)
        
        def entry(a, b):
            return sort(list(map(ord, filter(' '.__ne__, a.lower())))) == sort(list(map(ord, filter(' '.__ne__, b.lower()))))