text:
Please Read Primes
Do you know the book Murderous Maths, in the Horrible Science series? In the book, the Laplace Princess' "ridiculous" cipher might be interesting enough and simple enough to be a code-golf challenge.
Task
The original cipher looks like this:

Please read primes elephant help you me like cold

The nth word is only meaningful if it is a prime. So, the cipher becomes:

read primes help me

Your task is to write a program that inputs the cipher and outputs the plaintext.
Rules

You can take the input in any acceptable forms, e. g. an list of words.
The input will only consist of printable-ASCII characters.
You can use 0-based index or 1-based index.
A "Word" includes any punctuation. For example:
This is, "a" great test! I think.

should output
is, "a" test! think.

Japt -f, 6 2 bytes
I/O as arrays of words with 0-based indexing
Vj

Try it
Vj     :Implicit filter of input array
V      :0-based index of current word
 j     :Is prime?

Japt -S, 4 bytes
I/O as space-delimited strings, with 0-based indexing
¸fÏj

Try it
¸fÏj     :Implicit input of string
¸        :Split on spaces
 f       :Filter by
  Ï      :  0-based index
   j     :  Is prime?
         :Implicit output, joined by spaces

Japt -S, 6 bytes
I/O as space-delimited strings, with 1-based indexing
¸fÏÄ j

Try it
Same as above using Ä to add 1 to the index.

05AB1E, 6 bytes
#āpÏðý

Try it online!
#         # split the input on spaces
 ā        # push [1..length of the list of words]
  p       # is prime?
   Ï      # keep only words where the above check is true
    ðý    # join with spaces

Wow. What could you do with a kilobyte of 05AB1E code?

@JL2210 not that much. 05AB1E is really good at small challenges, but it doesn't scale well: no functions, limited number of variables, etc.

3 bytes, just accepting the words

Perl 6, 22 bytes
*[grep &is-prime,2..*]

Try it online!
Takes input as a list of words and outputs the zero indexed list.

Kotlin, 201 bytes
Input is zero indexed.
fun p(s:Int):MutableList<Int>{val l=MutableList(0){0}
o@
for(v in 2..s){for(e in l)if(v%e<1)continue@o
l.add(v)}
return l}
fun main(){var w=readLine()!!.split(" ")
for(i in p(w.size))print("${w[i]} ")}

Try it online!

+1 for using a verbose language.

Python 3, 125 107 bytes
107 bytes thanks to Black Owl Kai

i=input().split();j=k=1
for c in i:
 if j>1:
  while k>2:
   k-=1
   if j%k<1:k=0
  if k:print(c)
 j+=1;k=j

Try it online!
120 bytes if it strictly follows rules.
-25 bytes thanks to Black Owl Kai
Python 3, 145 120 bytes
i=input().split();j=k=1;l=[]
for c in i:
 if j>1:
  while k>2:
   k-=1
   if j%k<1:k=0
  if k:l+=[c]
 j+=1;k=j
print(*l)

Try it online!

If a trailing space is acceptable, you can shorten your longer solution to the shorter one with print(c,end=' '). If this is not the case, you can at least shorten the last line to print(*l)

Also, you can delete line 3 if you change line 4 to if j>1 (in both versions)

Jelly, 4 bytes
LÆRị

A monadic Link accepting a list of words which yields a list of words.
Try it online! (the footer calls the Link then formats, since a full-program implicitly smashes output)
How?
LÆRị - Link: list, W
L    - length (W)
 ÆR  - inclusive prime range = [2,3,5,7,...,Prime <= length(W)]
   ị - index into (W)

Also 4:
JẒƇị

PHP, 167 bytes
<?php $i=explode(' ',$argv[1]);$l=count($i);unset($i[0]);for($x=1;$x<$l;$x++){$y=$x+1;$z=2;while($z<$y){$t=$y/$z;if($t==(int)$t)unset($i[$x]);$z++;}}echo join(' ',$i);

Try it online!
Ungolfed:
<?php

$input = explode(' ', $argv[1]);
$length = count($input);
unset($input[0]);

for($x = 1; $x < $length; $x++) {
    $y = $x + 1;
    $z = 2;

    while($z < $y) {
        $test = $y / $z;

        if($test == (int) $test) {
            unset($input[$x]);
        }

        $z++;
    }
}

echo join(' ', $input);

?>

Using your own idea, I golfed it more to 127 bytes: Try it online!, I suspect that using other solutions that won't need unset it should be more golf-able.

Python 3, 90 bytes
print(*[w for n,w in enumerate(input().split()[1:])if all((n+2)%i for i in range(2,n+2))])

Try it online!

Rust, 339 bytes
First ever submission to Code Golf, but it works!
use std::io;use std::io::BufRead;fn main(){println!("{}",io::BufReader::new(io::stdin().lock()).lines().flat_map(|s|s.unwrap().split_whitespace().map(|s|s.to_owned()).collect::<Vec<String>>()).enumerate().filter(|(x,_)|{if *x<2{return false}for i in 2..*x{if x%i==0{return false}};true}).map(|(_,y)|y).collect::<Vec<String>>().join(" "));}

This code is compressed down from this:
use std::io;
use std::io::BufRead;
use std::io::BufReader;

fn main() {
    let s = BufReader::new(io::stdin().lock())
        .lines()
        .flat_map(|s| {
            s.unwrap()
                .split_whitespace()
                .map(|s| s.to_owned())
                .collect::<Vec<String>>()
        })
        .enumerate()
        .filter(|(x,_)| {
            if *x<2 {
                return false
            }
            for i in 2..*x {
                if x % i == 0 {
                    return false
                }
            };
            true
        })
        .map(|(_,y)| y)
        .collect::<Vec<String>>()
        .join(" ");
    println!("{}", &s);
}

Welcome to PPCG! Well done!

Ruby -p -rprime, 36 bytes
Replaces every word (and the space after it, if present) with the empty string if it is a non-prime word.
i=0
gsub(/\S+ ?/){$&if(i+=1).prime?}

Try it online!

C (gcc), 95 bytes
#define f(w,n)for(int i=0,j,p[n]={};++i<n;p[i]||printf("%s ",w[i]))for(j=i*i;j<n;j+=i)p[j]=i>1;

Try it online!
Sieve of E.

R + gmp, 48 bytes
(W=scan(,'',,,,''))[gmp::isprime(1:length(W))>0]

Try it online!
This use gmp for the isprime builtin.  This returns 0, 1 or 2, hence the test for > 0.  scan takes the input as characters split on whitespace and quotes set to empty string.

Vyxal, 8 bytes
⌈'&›¥æ;Ṅ

Try it Online!
⌈        # Split on spaces
 '    ;  # Filter by
  &›     # Increment register
    ¥æ   # Register prime?
       Ṅ # Join on spaces


text:
Fix my stuttered words
Stuttering is a problem which many of us might have experienced or at least seen it. Although most of famous speech recognition softwares have serious issues with stuttered speaking, let's imagine a software which understands stuttering, but cannot fix them and only writes them as is.
An example written text by such a software can be like this: "please be ca ca careful". In this example "careful" is the original word and "ca ca" are the stuttered words.
Challenge
Write a program or function that fixes stuttered words by removing them from the input while keeping the original words. For example fixed version of "please be ca ca careful" would be "please be careful".
This is code-golf, shortest answer in every language wins!
What are stuttered words?
Stuttering has many different variations. But for simplicity of this challenge, we are going to limit it to the following rules:

Stuttered words can be an uncompleted part or whole of the original word. By "uncompleted part" I mean that the original word should start exactly with the stuttered word. For example "ope" and "open" both can be a stuttered word for "open", but "pen" cannot be one since "open" doesn't start with "pen".
Stuttered words must contain at least one of the "aeiou" vowels. For example "star" can be a stuttered word for "start" as it contains "a", but "st" cannot be a stuttered word as it doesn't contain any of the mentioned vowels.
Stuttered words can only appear before the original word and should be repeated at least two times to be valid (the original word doesn't count in the repeats). For example "o o open" has stuttered words but "o open o" doesn't, because the "o" after the original word doesn't count and "o" before the original word is not repeated at least two times. "go go go go go go" has five repeats of stuttered words before the original word and is valid.
A single set of repeated stuttered words cannot contain mixed forms and the words should be exactly like each other. For example "op o op open" doesn't count as stuttered words. On the other hand "o op op open" has stuttered words because the first "o" is seen as a whole different word here and the two "op"s are counted as stuttered words of "open".
In case of multiple valid sets of repeated stuttered words right after each other, only the last original word stays. For example, in "o o o op op op open", the "o o o" part is seen as stuttered words of the first "op", so they should be removed and then "op op op" is seen as stuttered words of "open" and they should be removed too, so only the "open" will be left after removal of stuttered words. You can assume that multiple valid sets of repeated stuttered words only happen from left to right, so fixing "op op o o o open" would result in "op op open" (a.k.a. we do not fix again after fixing once).

Input

Input is a single line string containing only ASCII English letters (a-z), digits (0-9) and space characters. Letter casing is not important and you can decide to accept lowercase or uppercase or both of them, but the casing should stay the same and you cannot change it in the output.
You can use a list of letters (like ["l","i","s","t"," ","o","f"," ","l","e","t","t","e","r","s"]) instead of the string, but you cannot use a list of words. If your language has a different input structure, use it. The point is that input shouldn't be separated by words, so cost of separating words in some languages might actually trigger other creative solutions.
The input might contain none, one or multiple stuttered words in it.
Words and or numbers are separated by a single space and input will not contain double spaces right next to each other.

Output

A string or a list of letters or the appropriate structure in your language with all stuttered words removed from the input.
Output words should be separated by exactly one space (same as input).
Single leading and trailing newline or space are allowed.

Standard loopholes are forbidden.
Test cases
No stuttered words:
"hello world" => "hello world"

A single instance of repeated stuttered words:
"ope ope ope ope open the window" => "open the window"

Multiple instances of repeated stuttered words:
"there is is is is something un un under the the the table" => "there is something under the table"

No stuttered words, not repeated enough:
"give me the the book" => "give me the the book"

No stuttered words, don't have any of the mentioned vowels:
"h h help m m m me" => "h h help m m m me"

Numbers aren't stuttered words, they don't have any of the mentioned vowels:
"my nu nu number is 9 9 9 9876" => "my number is 9 9 9 9876"

But a word with both vowels and numbers can have stuttered words:
"my wi wi windows10 is slow" => "my windows10 is slow"

Different forms of stuttered words in same repeat group aren't counted:
"this is an ant antarctica does not have" => "this is an ant antarctica does not have"

For multiple continuous sets of stuttered words right after each other, only keep the last original word:
"what a be be be beauti beauti beautiful flower" => "what a beautiful flower"

This isn't a case of multiple continuous sets of stuttered words right after each other:
"drink wat wat wa wa water" => "drink wat wat water"

Empty input:
"" => ""

More cases from comments:
"a ab abc" => "a ab abc"
"a ab ab abc" => "a abc"
"ab ab abc abcd" => "abc abcd"
"a a ab a able" => "ab a able"
"i have ave ave average" => "i have average"
"my wi wi windows 10 is cra cra crap" => "my windows 10 is crap"

An easy to copy list of the above test cases:
"hello world",
"ope ope ope ope open the window",
"there is is is is something un un under the the the table",
"give me the the book",
"h h help m m m me",
"my nu nu number is 9 9 9 9876",
"my wi wi windows10 is slow",
"this is an ant antarctica does not have",
"what a be be be beauti beauti beautiful flower",
"drink wat wat wa wa water",
"",
"a ab abc",
"a ab ab abc",
"ab ab abc abcd",
"a a ab a able",
"i have ave ave average",
"my wi wi windows 10 is cra cra crap"

"drink wat wat wa wa water" => "drink wat wat water" it really seems like the rule should apply recursively so that this becomes "drink water"

@Jonah if you read the last item under What are stuttered words? I have explained this matter. "wat wat" are not stuttered words for "wa" and we only fix once, so once we get "drink wat wat water", we don't fix again to remove newly formed stuttered words. But in a reverse case like "wa wa wat wat water" result will be "water" because "wa wa" are stuttered words for the first "wat" and "wat wat" are also stuttered words of "water".

Ok fair enough, I was just saying it would make sense to keep fixing until you couldn't any more, but I can see the argument for focusing on a single iteration as well.

C (gcc), 183 180 178 bytes
f(s,t,u,T,e,r)char*s,*t,*u,*r;{for(;s=index(u=s,32);T>1&strpbrk(u,"aeiou")-1<s&&memmove(s=u,t-e,r-t-~e))for(e=++s-u,r=u+strlen(t=u),T=0;(t+=e)<r&!memcmp(u,t,e-1)&t[-1]==32;++T);}

Try it online!
Well, C certainly can't compete with the brevity of regex...
This one's particularly tough to read because I ended up collapsing the entire function into a single nested pair of for loops (with no body!). That makes the evaluation order all wonky -- the code near the beginning actually executes last.
My favorite trick here is strpbrk(u,"aeiou")-1<s. This is used to check whether the repeated word contains vowels. u points to the start of the repeated word, and s points to the second repetition of the word; for example:
"my nu nu number is 9 9 9 9876"
    ^  ^
    u  s

strpbrk then finds the first character in "aeiou" that appears after u. (In this case, it is the 'u' immediately after.) Then we can check that this comes before s to verify the word contains a vowel. But there's a slight issue - strpbrk returns NULL (i.e. 0) if there's no vowel in the entire string. To fix this, I simply subtract 1, which turns 0 into 0xffffffffffffffff (on my machine) due to overflow. Being the maximum value of a pointer, this is decidedly greater than s, causing the check to fail.
Here's a slightly older version (before the transformation that muddled up control flow) with comments:
f(s,t,u,c,n,e)char*s,*t,*u,*e;{
    // set s to the position of the *next* check; u is the old position
    for(;s=index(u=s,32);) {
        // count the length of this word (incl. space); also fix s
        n=++s-u;
        // find the end of the string; assign temp pointer to start
        e=u+strlen(t=u);
        // count repetitions of the word
        for(c=0;                // number of repetitions
            (t+=n)              // advance temp pointer by length of word
            <e&&                // check that we haven't hit the end...
            !strncmp(u,t,n-1)&& // ...and the word matches...
            t[-1]==32;          // ...and the previous character was space
            ++c);               // if so, increment count
        // decide whether to remove stuttering
        c>1&&                    // count must be at least 2
        strpbrk(u,"aeiou")-1<s&& // word must contain a vowel
        // if so, move everything after the last occurrence back to the
        // beginning, and also reset s to u to start scanning from here again
        memmove(s=u,t-n,e-t+n+1);
    }
}

Thanks to @user1475369 for 3 bytes and @ceilingcat for 2 bytes.

-3 bytes by replacing T>1&&strpbrk with T>1&strpbrk, r&&!strncmp with r&!strncmp, and &&t[-1] with &t[-1].

https://tio.run/##bVHbjpswEH3PV0yRGtnBSEtW6kWs@xV5a/tgYBKsgI18CV2t8u3pANkLyeIzAs4cn5mxq@xQVZfLnnkRRBQ7gcLxqlFu48UmiE0UG1e87K1jhZfa1PiPRenF45YXu1/52gfXl@7IokgUahsTnuVPfr3usOvsCZmXUYSMPLOQYppzPjqhTFOfReFkTMmgRcOCjFzs5EPBQiqRP7n1F8qYquvJOgjMcr4Ov7P8r5SP2yJNd7w4X05W1xDQBzY2DBvP4WUF9Fx/tyChU21rK3Yt4zn1UEwaYqr@mfmtAH@l6BC218/eaRP2LPnq/5iEFCN/Xq2IJEdt2GulqXrSIBWBwbq2Tq4Gc8L2CDdhIDQIAx2lHZZi4h2C9u/wtsPQaHOAaGbU6Kb9b6HKFpc2B31C6N4lpbXHpaIBWtj20M3rxqB7BhNndCXVo0Z@zuvH92930kHPGOfx@cPUdns/2jyQMoQwhnJV0JWC2qIHYwM06nTTx9AokkKJb1Ax6OVrH1vYUzl0y7013d8RBjKYY0a4lS3/FKiSUH3KfpJ4pceo7zZNSbi/Hz2NCh/CqcOkOV/@Aw

@ceilingcat Your link fails some of the test cases, but 2 of those 3 optimizations work; thanks!

Suggest bcmp() instead of memcmp()

Perl 5 (-p), 34 bytes
Based on Arnauld's deleted answer.
s/(\b(\w*[aeiou]\w*) )\1+(?=\2)//g

Try it online!

This produces "zab" for "za a ab".  I don't think there should be a stutter detected in that input.

@recursive thanks, fixed.

I looked at the test cases and devised a regex, only to find it already here. Naturally this means that the trivial Retina port is 30 bytes.

05AB1E, 30 29 28 bytes
-1 byte thanks to Kevin Cruijssen
#Rγε®y¬©žMÃĀiнkĀDygαΘ+∍]R˜ðý

Try it online!
05AB1E, having no regexes, definitely doesn't look like the best tool for this task. Still, it somehow manages to just barely beat Retina.
#                     # split on spaces
 R                    # reverse the list of words
  γ                   # group consecutive identical words together

ε                   ] # for each group of words y:
 ®                    #  push the previous word on the stack (initially -1)
  y                   #  push another copy of y
   ¬                  #  push the first element without popping
    ©                 #  save the current word for the next loop
     žM               #  built-in constant aeiou
       ÃĀi          ] #  if the length of the intersection is non-zero:
           н          #   take the first element of y
            kĀ        #   0 if the previous word starts with this word, 1 otherwise
              D       #   duplicate
               yg     #   length of y (the number of consecutive identical words)
                 α    #   subtract the result of the startsWith check
                  Θ   #   05AB1E truthify (1 -> 1, anything else -> 0)
                   +  #   add the result of the startsWith check
                    ∍ #   set the length of y to that value
                      #  otherwise leave y unchanged

˜                     # flatten the modified list of groups of words
 R                    # reverse the list of words
  ðý                  # join with spaces

You can remove the g before the Ā. Python-style truthify will already result in 0 for empty strings and 1 for non-empty strings.

@KevinCruijssen nice find!

Stax, 26 bytes
å╬↓<▀.₧▀"╦n▐∞↨vß%ù:Qa3@=↔_

Run and debug it
Direct port from @Grimy's perl answer.  Stax is able to shrink the regex pattern literal, and it has a vowels constant which is able to shrink [aeiou].

Perl 6, 45 bytes
{S:g/<|w>(\S*<[aeiou]>\S*)\s$0+%%\s{}<?$0>//}

Try it online!
A simple regex answer that substitutes all matches of stutters with the empty string.

Clean, 184 bytes
import StdEnv,Data.List,Text
$s=join[' '](f(group(split[' ']s)))
f[[a]:t]=[a:f t]
f[h=:[a:_]:t=:[[b:_]:_]]|intersect['aeiou']a==[]=h++f t|isPrefixOf a b=f t=if(h>[a,a])[a]h++f t
f[]=[]

Try it online!
Defines $ :: [Char] -> [Char], which splits the input string on spaces and groups identical elements which are then collapsed by the helper f :: [[[Char]]] -> [[Char]], joining before returning.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Tips for golfing in MarioLANG
I recently saw this language in a challenge and it's awesome. Does anyone have some tips for code-golfing in it?
Your tips should be at least somewhat specific to MarioLANG.
Please post one tip per answer.

I may post some later

Use the fall at the end for instructions
This is a pretty simple tip but many MarioLANG programs end something like this, ending with Mario falling down:
.....
=====

and this can be written instead as this:
....
===.

saving two bytes.
If your program has an elevator near an end like this you can often improve even further. This:
]!......
=#======

 <
="

goes to this:
]!.
=#.
  .
  .
 <.
=".

You do have to be careful with the last one though, since the added spaces to get to the final instructions can in many situations be more costly than just writing it largely on one line.

Duplicate input
Sometimes, you will need multiple copies of a given input - here is a 27 byte snippet that will do this.
>[!
"=#
- )
( +
( )
!+<
#="

Alternate 39 byte horizontal version:
>      [!
"=======#
!-((+)+)<
#======="

Before:
Memory Pointer: ˅
Cell          : n 0 0

After:
Memory Pointer: ˅
Cell          : 0 n n

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Super Mario in Colors :)
Here is continuation of this question, this time lets compress/generate Mario in colors!

Image size is 64x64 (above one is zoomed). The required output is valid  tag with exact same image in dataURI form, working on chrome, firefox and safari (and IE4 - joke ;). In snippet below you can find example tag in required form and all needed data.

bmpHeader="424d760a00000000000078000000280000004000000040000000010004000000000000000000c40e0000c40e00000000000000000000000000002b81fc00081fcd00085a7200fcfafc005e5e5e001139b90008930b00ababab0000ff000000ff000000fffc00fcffab00abff000000ff000000ff00000000";

bmpPixels="[encoded data, 4096 characters]" //pixels

dataURI='data:image/bmp,%'+(bmpHeader+bmpPixels).match(/../g).join('%');
msg.innerText=`<img alt src=${dataURI}>`
pic.src = dataURI
pre {white-space: pre-line;word-break: break-all}

You can use any dataURI image format supported by chrome, firefox and safari (e.g bmp, png, gif etc...). However my proposition is to use dataURI BMP format without base64 which is very simple and which is presented in snippet above - we have there bmpPixels string - each character in that string represents one pixel (colors from 0 to f) starting from left bottom pixel, line by line. In dataURI we join bmpHeader and bmpPixels and put char % between each two characters (hex num) - and thats all. In snippet below I also include bmp+base64 valid example (img tag to be valid need to have 'alt' attribute)

<img alt src=data:image/bmp;base64,Qk12CgAAAAAAAHgAAAAoAAAAQAAAAEAAAAABAAQAAAAAAAAAAADEDgAAxA4AAAAAAAAAAAAAAAAAACuB/AAIH80ACFpyAPz6/ABeXl4AETm5AAiTCwCrq6sAAP8AAAD/AAAA//wA/P+rAKv/AAAA/wAAAP8AAAAAVSVVJVUlVSVVJVUlVSVVJVUlVSVVJVVVUFVVVVBVVVVVJVUlVSVVJVUlVSVVJVUlVSVVJVUlVYhQSIiIUEiIiFUFVQVVBVUFVQVVBVUFVQVVBVUFVQVViFBIiIhQSIiIRAREBEQERAREBEQERAREBEQERAREBESIUEiIiFBIiIhEBEQERAREBEQERAREBEQERAREBEQERIhQSIiIUEiIiEQERAREBEQERAREBEQERAREBEQERAREiFBIiIhQSIiIRAREAREREUREBEQERAREBEQERAREBEREUERERFBEREQBERREFEQRRAAAAAAAAACIAAAAAAAAAAAAAAAAAAAAAABEFEEUQREQAAAAAAAAAECAAAAAAAAAVVVVUFVVVVBVBEREERF3EQAAAAAAAAAABIAAAAAAAABIiIhQSIiIUEgEREREd3d3AAAAAAAAAAAACIAAAAAAAEiIiFBIiIhQSAB3d0REd3dwAAAAAAAAAAAEgAAAAAAASIiIUEiIiFBIAHd3d3RHd3cAAAAAAAAAAAAIgAAAAABIiIhQSIiIUEgAcXcXd0R3d3AAAAAAAAAAAAQIAAAAAEiIiFBIiIhQSAARdEd3dHd3cBEUAAAAAAAAAEgAAAAAREREUERERFBEBER3d3d0R3dxEREEAAAAAAAAAIgAAAAAAAAAAAAAAAAARHcRd3RHd3EREQAQAAAAAAAAQIAAAFVQVVVVUFVVVQAHdxRHdEd0ERERBBAAAAAAAAAEgAAAiFBIiIhQSIiIBBd3REd3R3ABERABEAAAAAAAAAAIgACIUEiIiFBIiIgAR3d3d3dHEUAREEEQAAAAAAAAAASAAIhQSIiIUEiIiAABF3d3d0QREEABEQAAAAAAAAAAAAiAiFBIiIhQSIiIAAFEd3EXdEERdwAAAAAAAAAAAAAABAiIUEiIiFBIiIgABER3cUR3REREdwARAAAAAAAAAAAASERQREREUERERAAAd3d0RHd3d0RHcRFAAAAAAAAAAAAAAAAABlAAAAAAAABHd3d3d3d3REdxEAAAAAAAAAAAAAAAAAAFUAAAAAAAAEcRd3d3d3REdxFAAAAAAAAAAAAAAAAAAAZQAAAAAAAAABRHcRR3REd3EXAAQAAAAAAAAAAAAAAABVAAAAAAAAAAREcRREdEd3cUd0dEBAAAAAAAAAAAAAAGUAAAAAAAAAAAAHFEd0R3dxd3EREEAAAAAAAAAAAQAAVQAAEAAAAAAAAAAEd3RHd3F0EXcRFAAAAAAAAAAFEQBlAAEBAAAAAAAAAAAAAAd3cRF3dBERAAAAAAAAABUREWUREQEAAAAAAAAAAAAAB3d3F3dEQREAAAAAAAABURERZREREBAAAAAAAAAAAAAHd3d3dEdxAQAAAAAAAAFRERFlEREQEAAAAAAAAAAAAAB3d3d0RwAQAAAAAAAAAVEREWURERAQAAAAAAAAAAAAAHEXd3RAAAAAAAAAAAABURERZREREBAAAAAAAAAAAAAAEUR3cAAAAAAAAAAAAAFRERFlEREQEAAAAAAAAAAAAAAURHcAAAAAAAAAAAAAABUREVUREQEAAAAAAAAAAAAABEQAAAAAAAAAAAAAAAAAFREAZQARAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAIiIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzMiIiIgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMzIiIiIiAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEDIiIiIiIzAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAERAiMiEiEjMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARMzMzIiIgAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMzMzMjMyADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADMzMjMyMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARERETAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMxERMzMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAxMxETERMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADExETETMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzMRMQMzAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACIiIiIhEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAiIiABEQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAERAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==>

You can presents you results in answer using codegolf snippets and include this CSS rule: img {image-rendering: pixelated;width:256px;height:256px} to zoom image.
UPDATE
I see that unconsciously I made 2 separate competitions in this question: first for programs (codes written in some programming language which produce result img tag), and second for img tags which contains results from compression tools. Both are interesting but main competition is for programs. Although I hope that someone shows that hand written program can achieve better results than 'compressed img tags' - but may be it is impossible?

Requiring a very specific output format seems arbitrary and limiting... what if I wanted to draw the image on screen using SQL geometry objects? Or what if I wanted to make a Minecraft command block program that reproduced the image using colored wool blocks?

SQL can also produce strings as result. In the other hand, Minecraft result can be hard to compare with desired result (I would like to avoid situations like here ). This question-task is not for everything - sorry - but still a you can use a lot of tools to accomplish task

You could rely on the defaults for graphical I/O. Those are fairly permissive without allowing anything stupid (in particular, they don't allow outputting anything that kinda looks like the original image, which is what killed the HEX challenge).

bmpPixels seems to be missing 2 pixels in the first code snippet.  64x64 size image should have 4096 pixels, but len(bmpPixels) is only 4094.

@RootTwo you are right - fixed

800 791 bytes (for the img tag)

img {image-rendering: pixelated;width:256px;height:256px}
<img alt src=data:;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABABAMAAABYR2ztAAAAG1BMVEUAAAD8gSvNHwhyWgj8+vxeXl65ORELkwirq6tQs3kTAAAB3UlEQVRIx92VwW6jMBCGTUO6PfrfuOWaZbX3Jn6BII3kHsmB9wAJaa455rF3bGEwaeI97KFSx7IQ9sdvzz+WUeqrokButq73WeCplsgBG4vDxmaAwwGHXRaw2GGXASxg7XsuCyAvYI/2+J7Lwdrfdr95rC+AOJUBdH38Vf98nGax8UbWGR/s0QO5Tcr0PlcJlfv824UOtqYjdFo5ftbPbaF1OkSuTwG8nrEGjOPl7RV4OwPpGj/ATFmABeiLxwB7gOOqd4GBR0IOQMVNBCSLtzQLJ+pcNdWA6Ib3Qc3AQAFgoFyc3LbRSXIgJ4BhR+WypihMYdxgmByjV6nd2wg4+AxHYqyqsSg4DkFu0CtgVghfB2AtERVKYp8EEavlYvqgVkZ892XmoRobJKVU5cu1/biGLkDl9aFPydX3ckmAsEeHE3QTN1le1AKUlbfA9QV0oWeBBJBzYNzoRrmYSj0LpIAYxKPjAVATcBKga7sudJ8lT0Csw/XmzpHZkbmHiR6EAtLkhJRayiwq/eJBoK7TLsJZFA1OPPgE0ErgotZA6avwSWANAIwbgXQJMo2ZD3PwwMfkQtvJ78uQIdB9D3zCJRViM8kzbct5uJmIbanF/wPd9m5LgD932z+B+Tz8BfZ10E4lHGFMAAAAAElFTkSuQmCC>

Simply ran the image through OptiPNG.
Thanks to Night2 and Jonathan Frech for helping save 9 bytes.

You can replace data:image/png; with data; (only Chrome) or data:; (Chrome and FireFox). Modern browsers can detect the image type themselves.

@Night2 True, but I want to keep cross-compatibility and I can't test in Safari.

I can verify that data:; does work on Safari (Version 13.0).

755 bytes (img tag)

img {image-rendering: pixelated;width:256px;height:256px}
<img alt src=data:;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABABAMAAABYR2ztAAAAG1BMVEUAAAD8gSvNHwhyWgj8+vxeXl65ORELkwirq6tQs3kTAAABwklEQVR4AcRPRwHFIBRjGPj5GKCpAODFv7YOAeTaXLPTZ8hwLNmtoPCBE1RhVRnBWljNCoSGZgQCpOleAD5AoZjug3Sq132+JNIJfoyD//3NXPlCZmS8AjeSZE9GkJz91rADAL7IYLV1GAqiV6C+dqkBtf6dGAZul84i/2GDYbZZ5rOfKmJLojQH7ionk/g41azWwctQ/Jr+LSElawT62gv4vGIUsstOPoGvKxCs8Q6JLwVJXMPfggpUSi+ETTvxSsCkGel8iq/+KVyUpnnacNT46WCnsLEKAmIr+bYcJemgU8pyRjspC0+yb1l0YbU+99shOFTYKbSPhwVXhb618sNC/XYVholzIVIbRVIGO/jmQtYzC0WY9hmyRvx4LN+PekWYJBHpEtrAx70TXAXHBWlOx8DdmhAn0eVrQArpHOgEe1f23XcAMZ0DvUBBu2sD7ClcinBbbrd6FilVob2ohw1gd+3Sinw0sAL5LGG2aRKL0BpU6/H8F2aqv6CuwS+Bw8DdRiGS1DDwWwCEYWAQjHnOM5KdDSq1ws9ZQGYm2DUYYWQAwP8D0sgQkR7AXEyIiAvKFYSyYoVIClSxQcIK4OkBAPZ10E6zEPFIAAAAAElFTkSuQmCC>

Ran Lewis's image through 200 iterations of zopflipng with all possible filter combinations enabled.

You could save two "bytes" by removing the two white spaces from the img style

the CSS isn't included in the byte count just the HTML img tag, but yes that could be done if we needed to optimize the CSS

Okay my misunderstanding then, as you were

Bash, 1447 1565 bytes
Too much time on this one already. :)
N="1q/4xt/5E3S9n/3YWDwhfwblbew5x/4P/5Cw
1/va
1/oEw.Q/16p7/2X4
1s/2Z.Wc.Wc.Wc8.Z2/1bfhM.QLb/108dQ.Qc/2Kw
1/2V.W/b5/10/10
1/dO/10/10/10/40
1/ap/88w
1@4g/5S.Qx/2y.Qx
23
1/1k
3D4
2/5_/45wu2u2s/24/2cx41id1iv1/2d1r41q/5p
1/1e/3K11r5wt12/2r8w1p61u11vu2u4tAwT8wqE1xs4a3j9.R.R.Yde.R.Ys3/6kw/1z11u1w2uwzww
1/qK
1/sK_2v
1/5q2u2/36/1p/4w3B/3_
1/hLwwwwz
1/hiwwwww
1/8r/2u.Qz/3Cw2v
8_
1/pd/21w/3_
1/qI
1/oG1v11v111s1111s3v1/3@111t1
1/rI
2/1V.Wc.W
3e
3W
5/se.Q
1/tGw12w
1/pG.Q/1w2
1/p9wCwq11u112s12@31tAs4
6/1f
7i4/5N/44/1lx/1A_y/1y/3W
1/5X2/5CY/45y
10
2/3o.W2a.W2a.W2a251.Z221.T.T422qw1v11w1.QO11.T22w/12/13sw3.Te.T.T64wwvr326o2w/16vwwZv
3/7Z@zwu2u2r5/24o8oy5r36V/35w
1/2N4.S/1W44o44o44o44o44j/1D4.Sp
51
3/2g4.S.X@4.S.XW4.S.Xvwwwwww/40
1/gMw3wwwwwt3t
4/1U.W21.T.T1.W2a.W2/3111.T2/3U.T.T
5/13
4/1a11
i/7v.Qw/1_/45/3y/1u
1/8p/17w/2swDwW/10FZ
1/14
2/7Y@3www2/1_@/14/35
22
1/6tv11r.R1.R221t21r113r23rw3t111u11u6q34o.Y1r11111s1113t3v12r212r21v13s12t1112s11v1w
1a
8/68wxwx/22wxwx
1/X
7/2L3.U.U.YM/19.R.R.R.R.YS/143.U.U.Y
b/1j
o/1m11g2
e/1g
bC4
9/10
J/17
2Ya2s2
3/1r444444"
R=(/11 .Yr .X.X 211 .V.V .Yo3 .Z.Z 4s4s 131 22222)
for x in {Q..Z};{ N=${N//.$x/${R[i]}};i=$[i+1]; }
U=($N)
for((j=0;$j<62;j++)){
for((i=0;$i<${#U[j]};i++)){ c=${U[j]:i:1};[ "$c" = '/' ]&&c=${U[j]:i+1:2}&&i=$[i+2];T[$j]+=" $[64#$c]"; }
read p x t<<<${T[j]}
P=$[P+p]
S[$x]=$P
for n in $t;{ x=$[x+n];S[$x]=$P; }
}
echo "<img alt src=data:image,`for((j=0;$j<4096;j++)){ printf %%%02x ${S[j]}; }`>"

Try it online!

img {width:256px;height:256px}
<img alt src=data:image,%42%4d%76%0a%00%00%00%00%00%00%78%00%00%00%28%00%00%00%40%00%00%00%40%00%00%00%01%00%04%00%00%00%00%00%00%00%00%00%c4%0e%00%00%c4%0e%00%00%00%00%00%00%00%00%00%00%00%00%00%00%2b%81%fc%00%08%1f%cd%00%08%5a%72%00%fc%fa%fc%00%5e%5e%5e%00%11%39%b9%00%08%93%0b%00%ab%ab%ab%00%00%ff%00%00%00%ff%00%00%00%ff%fc%00%fc%ff%ab%00%ab%ff%00%00%00%ff%00%00%00%ff%00%00%00%00%55%25%55%25%55%25%55%25%55%25%55%25%55%25%55%25%55%25%55%25%55%25%55%55%50%55%55%55%50%55%55%55%55%25%55%25%55%25%55%25%55%25%55%25%55%25%55%25%55%25%55%25%55%25%55%88%00%48%88%88%50%48%88%88%55%48%55%05%55%05%55%05%55%05%55%05%55%05%55%05%55%05%55%05%55%05%55%88%00%00%88%88%50%48%88%88%50%48%44%04%44%04%44%04%44%04%44%04%44%04%44%04%44%04%44%04%44%04%44%88%00%00%88%88%50%48%88%88%50%48%44%04%44%04%44%04%44%04%44%04%44%04%44%04%44%04%44%04%44%04%44%88%00%00%88%88%50%48%88%88%50%48%44%04%44%04%44%04%44%04%44%04%44%04%44%04%44%04%44%04%44%04%44%88%00%00%88%88%50%48%88%88%50%04%44%01%11%11%11%44%44%04%44%04%44%04%44%04%44%04%44%04%44%04%44%44%00%44%44%44%50%44%44%44%01%11%14%44%14%44%11%44%00%00%00%00%00%00%00%88%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%44%14%41%14%41%11%10%00%00%00%00%00%00%00%40%80%00%00%00%00%00%00%55%55%55%50%55%55%55%50%55%04%44%50%11%11%77%11%00%00%00%00%00%00%00%00%04%80%00%00%00%00%00%00%48%88%88%00%48%88%88%50%48%04%44%50%44%77%77%77%00%00%00%00%00%00%00%00%00%08%80%00%00%00%00%00%48%88%88%00%48%88%88%50%48%00%77%77%44%44%77%77%70%00%00%00%00%00%00%00%00%04%80%00%00%00%00%00%48%88%88%00%48%88%88%50%48%00%77%77%77%74%47%77%77%00%00%00%00%00%00%00%00%00%08%80%00%00%00%00%48%88%88%00%48%88%88%50%48%00%71%77%17%77%44%77%77%70%00%00%00%00%00%00%00%00%04%08%00%00%00%00%48%88%88%00%48%88%88%50%48%00%11%74%47%77%74%77%77%70%11%14%00%00%00%00%00%00%00%48%00%00%00%00%44%44%44%00%44%44%44%50%44%04%44%77%77%77%74%47%77%71%11%11%04%00%00%00%00%00%00%00%88%00%00%00%00%00%00%00%00%00%00%00%00%00%44%77%11%77%74%47%77%71%11%11%00%10%00%00%00%00%00%00%40%80%00%00%55%50%55%55%55%50%55%55%55%50%07%77%14%47%74%47%74%11%11%11%04%10%00%00%00%00%00%00%04%80%00%00%88%00%48%88%88%50%48%88%88%50%48%77%44%47%77%47%70%01%11%10%01%10%00%00%00%00%00%00%00%08%80%00%88%00%00%88%88%50%48%88%88%50%48%77%77%77%77%47%11%40%11%10%41%10%00%00%00%00%00%00%00%04%80%00%88%00%00%88%88%50%48%88%88%50%48%17%77%77%77%44%11%10%40%01%11%00%00%00%00%00%00%00%00%00%08%80%88%00%00%88%88%50%48%88%88%50%48%44%77%71%17%74%41%11%77%00%00%00%00%00%00%00%00%00%00%00%04%08%88%00%00%88%88%50%48%88%88%50%04%44%77%71%44%77%44%44%44%77%00%11%00%00%00%00%00%00%00%00%00%48%44%00%44%44%44%50%44%44%44%00%00%77%77%74%44%77%77%77%44%47%71%11%40%00%00%00%00%00%00%00%00%00%00%00%00%06%50%00%00%00%00%00%00%47%77%77%77%77%77%77%44%47%71%10%00%00%00%00%00%00%00%00%00%00%00%00%00%05%50%00%00%00%00%00%00%47%11%77%77%77%77%74%44%77%11%40%00%00%00%00%00%00%00%00%00%00%00%00%00%06%50%00%00%00%00%00%00%00%14%47%71%14%77%44%47%77%11%70%00%40%00%00%00%00%00%00%00%00%00%00%00%05%50%00%00%00%00%00%00%00%44%47%11%44%47%44%77%77%14%77%47%44%04%00%00%00%00%00%00%00%00%00%00%06%50%00%00%00%00%00%00%00%00%00%71%44%77%44%77%77%17%77%11%11%04%00%00%00%00%00%00%00%00%10%00%05%50%00%01%00%00%00%00%00%00%00%00%47%77%44%77%77%17%41%17%71%11%40%00%00%00%00%00%00%00%51%10%06%50%00%10%10%00%00%00%00%00%00%00%00%00%00%77%77%11%17%77%41%11%10%00%00%00%00%00%00%01%51%11%16%51%11%10%10%00%00%00%00%00%00%00%00%00%00%77%77%71%77%74%44%11%10%00%00%00%00%00%00%15%11%11%16%51%11%11%01%00%00%00%00%00%00%00%00%00%00%77%77%77%77%44%77%10%10%00%00%00%00%00%00%15%11%11%16%51%11%11%01%00%00%00%00%00%00%00%00%00%00%07%77%77%77%44%70%01%00%00%00%00%00%00%00%15%11%11%16%51%11%11%01%00%00%00%00%00%00%00%00%00%00%07%11%77%77%44%00%00%00%00%00%00%00%00%00%15%11%11%16%51%11%11%01%00%00%00%00%00%00%00%00%00%00%01%14%47%77%00%00%00%00%00%00%00%00%00%00%15%11%11%16%51%11%11%01%00%00%00%00%00%00%00%00%00%00%01%44%47%70%00%00%00%00%00%00%00%00%00%00%01%51%11%15%51%11%10%10%00%00%00%00%00%00%00%00%00%00%44%40%00%00%00%00%00%00%00%00%00%00%00%00%01%51%10%06%50%01%10%10%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%10%00%00%00%00%01%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%03%00%22%22%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%03%33%22%22%22%20%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%33%32%22%22%22%22%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%01%03%22%22%22%22%22%33%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%11%10%22%32%21%22%12%33%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%11%33%33%33%22%22%20%03%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%03%33%33%33%23%33%20%03%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%33%33%32%33%32%30%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%11%11%11%13%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%33%11%11%33%33%30%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%31%33%11%13%11%13%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%31%31%11%31%13%33%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%03%33%11%31%03%33%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%02%22%22%22%22%11%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%22%22%20%01%11%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%01%11%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00>

Yes I know, it is not trivial task to achieve small result, many Ideas can be used - thanks for contribution :) - can you give some explanation?


text:
The Celestial Bureaucracy KoTH
In Imperial China, ranks in society were not decided by birth or wealth, but by a person's ability to excel in the Imperial Examinations. The Jade Emperor, divine ruler of the Heavens, has called for all his subjects to be examined to determine their worth, and whom to next give the Divine Mandate to rule China.
Rules of the Bureaucracy:

The Divine Bureaucracy consists of non-negative integer-valued ranks, starting with 0. Each member (bot) of the bureaucracy belongs to one rank. Each rank can hold arbitrary many members, but can't be empty unless all ranks above are empty
At the start of the game, all members have rank 0
Every turn, each member of the bureaucracy has to answer an exam. The exam consist of correctly guessing the boolean values of a list. The length of the list is the number of the rank above the member.
The exam questions are prepared by a random member of the rank above. Members of the highest rank get their questions directly from the JadeEmperor (see below)
A member scoring at least 50% on their exam is eligible for Promotion. A member scoring less than 50% on their exam is eligible for Demotion.
A member eligible for Demotion has their rank decreased by one only if there is a member eligible for Promotion on the rank below to take their place.
All members eligible for Promotion have their rank increased by one as long as this leaves no rank empty.
If not all eligible members can be Demoted or Promoted, the preference goes to those of lowest (for Demotion) resp. highest (for Promotion) score. Ties are broken randomly.
The rank of a member can only change by at most 1 each turn.

Rules of the game:

Each bot will be randomly assigned an ID at the start of the game, which will not change over its course. The JadeEmperor has the ID -1, all others have consecutive non-negative IDs, starting with 0.
All bots compete at the same time
The game runs for 100 turns, the score of the bot is its average rank possessed over that time.
Total score is acquired by running 1000 games and averaging the results.
Each Bot  is a Python 3 class implementing the following four functions:

ask(self,n,ID), which makes an exam by returning a list of Booleans of length n. ID is the ID of the bot who has to guess that list. ask() can be called many times during a single round for any bot, but also not at all.
answer(self,n,ID), which is an attempt to answer an exam by returning a list of Booleans of length n. ID is the ID of the bot whose ask() generated the exam. answer() is called exactly once per round for each bot.
update(self,rankList,ownExam,otherExams) is called once the Controller has performed all Pro- and Demotions. Its arguments are: A list of integers, listing all ranks by ID of all bots; a tuple, consisting of two lists, first the exam questions, then the answers the bot gave (in case it forgot); then a list of tuples, similarly consisting of exam-answer pairs, this time for all exams the bot handed out.
__init__(self, ID, n) passes the bot its own ID and the number of competing bots.

Classes are allowed to implement other functions for private use
Defining further variables and using them to store data about past exams is explicitly allowed.
Programming meta-effects are forbidden, meaning any attempts to directly access other bots' code, the Controller's code, causing Exceptions or similar. This is a contest of strategies for the exams, not of code hacking.
Bots trying to help each other are explicitly allowed, as long as they don't do it via meta-effects, but purely by the information passed through update()
Other languages are allowed only in case they can be easily converted to Python 3.
The library numpy will be imported as np. The version is 1.6.5, meaning it uses the old random library. If you have numpy 1.7, the old functions are available under numpy.random.mtrand for testing. Please remember to strip the mtrand for submission.
If a bot causes an Exception during runtime, it is disqualified. Any bot whose code is so obfuscated that it's impossible to tell if it generates a list of length n when ask() or answer() is called will also be disqualified preemptively. A bot forcing me to deep-copy outputs gets -1 on the score.
Class names have to be unique
Multiple bots per person are allowed, but only the latest version will be taken of iteratively updated bots.
Since there seems to be some confusion about bot similarity:

You are not allowed to post a copy of another bot. This is the only  Standard Loophole which really applies in this challenge.
You are allowed to have shared code with other bots, including bots of other people.
You are not allowed to submit a bot which differs from another only by a trivial change to the strategy (like a change in the seed for the question generation) unless you can prove that the number of such carbon copy bots is the minimum required for successful enactment of their strategy (That will usually be two bots for a cooperation).

Example Bots:
The JadeEmperor is always part of the game, but does not compete; he serves as generator for exams of highest-rank bots. His exams are random, but not uniformly, to allow smart bots a way to advance.
class JadeEmperor:
    def __init__(self):
        pass

    def ask(self,n,ID):
        num=min(np.random.exponential(scale=np.sqrt(np.power(2,n))),np.power(2,n)-1)
        bi=list(np.binary_repr(int(num),width=n))
        return [x=='0' for x in bi]

The Drunkard produces exams and answers completely randomly. He will be part of the game.
class Drunkard:
    def __init__(self,ID,n):
        pass

    def ask(self,n,ID):
        return list(np.random.choice([True,False],size=n,replace=True))

    def answer(self,n,ID):
        return list(np.random.choice([True,False],size=n,replace=True))

    def update(self,rankList,ownExam,otherExams):
        pass #out

The Plagiarist just copies previous exams. He will also be part of the game.
class Plagiarist:
    def __init__(self,ID,n):
        self.exam=[True]

    def ask(self,n,ID):
        return (self.exam*n)[0:n]

    def answer(self,n,ID):
        return (self.exam*n)[0:n]

    def update(self,rankList,ownExam,otherExams):
        self.exam=ownExam[0]

Controller code available here. For testing, you can put your own class into a Contestants.py file in the same folder, and they will be imported.
Chatroom can be found here.
The Examinations begin!
Current score, in higher precision (10000 runs) for Oct20:
$$
\begin{array}{|c|c|c|}\hline \textbf{Entrant}&\textbf{Author}&\textbf{Score}\\\hline
%
\text{Alpha}&\text{Sleafar}&9.669691\\ \hline
\text{Gamma}&\text{Sleafar}&9.301362\\ \hline
\text{Beta}&\text{Sleafar}&9.164597\\ \hline
\text{WiQeLu}&\text{Purple P}&7.870821\\ \hline
\text{StudiousBot}&\text{Dignissimus - Spammy}&7.538537\\ \hline
\text{Santayana}&\text{Sara J}&7.095528\\ \hline
\text{Plagiarist}&\text{}&6.522047\\ \hline
\text{CountOracular}&\text{IFcoltransG}&5.881175\\ \hline
\text{Thomas}&\text{Alien@System}&5.880041\\ \hline
\text{Contrary}&\text{Draco18s}&5.529652\\ \hline
\text{Marx}&\text{sugarfi}&5.433808\\ \hline
\text{Drunkard}&\text{}&5.328178\\ \hline
\text{YinYang}&\text{Purple P}&5.102519\\ \hline
\text{Equalizer}&\text{Mnemonic}&4.820996\\ \hline
\text{TitForTat}&\text{Anonymous}&3.35801\\ \hline
\end{array}$$
Contests will be run with each new entry for the foreseeable future.

If bots helping each other are allowed, can't I just spam the question with several copies of cooperating bots?

Copies of bots are a Standard Loophole, so no. If you try to abuse the multiple bots per author rule by submitting almost-but-not-quite-copies, I will remove it.

@AlienAtSystem Why are you allowing bots helping each other? It just seems like more chaos and randomness to deal with.

Why are the constructor arguments ID, n but the other method arguments n, ID?

@DonThousand because I believe that under the constraints given, it is quite a feat to make two bots that A) successfully handshake (note that the Plagiarizer might accidentially play man in the middle) and B) then enact a strategy that reliably helps that bot but no other to rise.

@PurpleP Organic growth of code. For the answering, n is more important: It's the number of bools you have to return. For the initialising, I originally only handed over the ID, but then thought knowing the number of contestants is important, too.

(1) I'm not even sure how cooperation is possible through Update (it runs after the exams; is it to help bots under you move up?) and (2) I don't see a benefit to cooperation.

May we assume that the number of questions will not change between rounds?

@PurpleP it's in the rules: The length of the list is the number of the rank above the member. So at rank 0, you get 1 question, at rank 7 you get 8.

@Draco18s I thought the same thing, so I made a bot that cooperates with everyone.  Currently, it beats both of Purple P's bots.

"The length of the list is the number of the rank above the member." do I understand this correctly that once you reach rank 1 (or 0, depending on your favorite numbering) you are stuck there forever and aren't asked any questions?

@someone ranks count upwards. You start at 0 and work you way to higher numbers

@Alien If creating multiple very similar bots is not allowed, helping other bots is nearly impossible (and why would you, anyway, if they're not yours). If so, the optimal strategy is to ask uniformly random questions. Is that correct?

@someone No and No. The second question is clearly invalidated by submissions outperforming the drunkard. And for the first: If your two cooperators manage to successfully haul themselves in the top ranks, then an asymmetric teams scores better than a symmetric one, because one bot would yield to the other and ensure his partner gets highest rank and he stays 1 below.

@AlienAtSystem If I want to make updates to my bot, how should I do that?

@Dignissimus-Spammy if it's just improvement of the algorithm, simply edit your answer. And then possibly ping me in chat so I know something changed

You don't need to capitalise the C in IFcoltransG in the leaderboard. (I mean, it looks like gibberish either way, but that's no excuse :)

Santayana
Those who cannot remember the past are condemned to repeat it. So we make our decisions based on how the others have acted in the past, answering based on what answer the asker has usually expected from us at a given index, and asking for the answer they've given us the least often at a given index.
import numpy as np

class Santayana:
    """
    Those who cannot remember the past are condemned to repeat it
    """
    def __init__(self, ID, num_competitors):
        self.ID = ID
        self.exams_taken = {}
        self.exams_issued = {}
        self.last_exam_asker = None
        self.recent_exam_takers = []

        for i in range(num_competitors):
            self.exams_taken[i] = []
            self.exams_issued[i] = []

    def ask(self, length, taker_ID):
        # Remember who asked
        self.recent_exam_takers.append(taker_ID)
        new_exam = []

        # At every index, expect the answer they've given the least often (default to False if equal)
        for i in range(length):
            trues = 0
            falses = 0
            for exam in self.exams_issued[taker_ID]:
                if len(exam) <= i: continue
                if exam[i]:
                    trues += 1
                else:
                    falses += 1
            new_exam.append(trues < falses)
        return new_exam

    def answer(self, num_answers, asker_ID):
        self.last_exam_asker = asker_ID
        if asker_ID == -1:
            # Copy emperor's process to hopefully get a similar exam
            num = min(np.random.exponential(scale=np.sqrt(np.power(2,num_answers))),np.power(2,num_answers)-1)
            as_bin = list(np.binary_repr(int(num),width=num_answers))
            return [x=='0' for x in as_bin]
        else:
            new_answer = []

            # At every index, give the answer that's been correct the greatest number of times (default to True if equal)
            for i in range(num_answers):
                trues = 0;
                falses = 0;
                for exam in self.exams_taken[asker_ID]:
                    if len(exam) <= i: continue
                    if exam[i]:
                        trues += 1
                    else:
                        falses += 1
                new_answer.append(trues >= falses)
            return new_answer

        return [True for i in range(num_answers)]

    def update(self, rank_list, own_exam, other_exams):
        if self.last_exam_asker > -1:
            # Save the exam we took, unless it was from the Emperor - we already know how he operates
            self.exams_taken[self.last_exam_asker].append(own_exam[0])
        for i in range(len(self.recent_exam_takers)):
            # Save the responses we got
            self.exams_issued[i].append(other_exams[i][1])

        self.recent_exam_takers = []

Alpha
Read the chat before downvoting. These bots don't violate any rules. The OP is even encouraging cooperating bots.
Alpha is forming a team together with Beta. Both are using a predefined set of exams to help each other rise up the ranks. Also both are taking advantage of bots using the same exams over and over.
import numpy as np
import hashlib

class Alpha:
    def __init__(self, ID, n):
        self.alpha = hashlib.md5(b"Alpha")
        self.beta = hashlib.md5(b"Beta")
        self.asker = -1
        self.betas = set(range(n)).difference([ID])
        self.fixed = set(range(n)).difference([ID])
        self.fixedExams = [[]] * n

    def ask(self,n,ID):
        if ID in self.betas:
            return self.md5ToExam(self.alpha, n)
        else:
            return list(np.random.choice([True, False], n))

    def answer(self,n,ID):
        self.asker = ID
        if self.asker == -1:
            return [True] * n
        elif self.asker in self.fixed and len(self.fixedExams[self.asker]) > 0:
            return (self.fixedExams[self.asker] * n)[:n]
        elif self.asker in self.betas:
            return self.md5ToExam(self.beta, n)
        else:
            return list(np.random.choice([True, False], n))

    def update(self,rankList,ownExam,otherExams):
        if self.asker >= 0:
            if self.asker in self.betas and ownExam[0] != self.md5ToExam(self.beta, len(ownExam[0])):
                    self.betas.remove(self.asker)
            if self.asker in self.fixed:
                l = min(len(ownExam[0]), len(self.fixedExams[self.asker]))
                if ownExam[0][:l] != self.fixedExams[self.asker][:l]:
                    self.fixed.remove(self.asker)
                    self.fixedExams[self.asker] = []
                elif len(ownExam[0]) > len(self.fixedExams[self.asker]):
                    self.fixedExams[self.asker] = ownExam[0]
        self.alpha.update(b"Alpha")
        self.beta.update(b"Beta")

    def md5ToExam(self, md5, n):
        return [x == "0" for x in bin(int(md5.hexdigest(), 16))[2:].zfill(128)][:n]

I believe these three bots violate OPs rules as stated in both the prompt and the comments.

@DonThousand If you read the discussion in the chat, you will see they don't violate the rules. https://chat.stackexchange.com/rooms/98905/imperial-exams-office

Fair enough. My bad.

@DonThousand So what was the point in downvoting them all?

I only downvoted Alpha. I can't undownvote, though. Make a superfluous edit and I'll fix it.

Studious Bot
This bot studies for tests! It attempts to find patterns in tests given out by various bots and acts accordlingly.
On my end, so far, this bot outperforms all other bots that I could get working on my computer except from Alpha, Beta and Gamma (who have been programmed to work together). The bot doesn't make use of the fact that teaming is allowed because I felt that it was a bit like cheating and slightly dirty. Looking over it though, teaming seems to seems to be quite effective.
The bot attempts to recognise when the answers to tests are random and in response matches that to hopefully average 50% on tests.
The bot also attempts to recognise when a bot has merely flipped its answers to throw off other bots who are tying to predict their behaviour, however I haven't programmed it to specifically act on this yet.
I've annotated the code with a few comments in order to make it easier to read
import random
import numpy as np

class StudiousBot:
    GRAM_SIZE = 5
    def __init__(self, identifier, n):
        self.id = identifier
        self.ranks = {i: 0 for i in range(n)} # Stores ranks
        self.study_material = {i: [] for i in range(n)} # Stores previous exam data
        self.distribution = {i: [] for i in range(n)} # Stores the percentage of answers that were `True` on a Bot's tests over time
        self.last_examiner = None

    def ask(self, n, identifier):
        # This bot gives random tests, it doesn't bother making them difficult based on answers to them
        # The reason for this is that I can't personalise the tests for each bot
        return [random.choice([True, False]) for i in range(n)]

    def answer(self, n, examiner_id):
        self.last_examiner = examiner_id
        if examiner_id == -1:
            return StudiousBot.answer_emperor(n) # Easy win, I know the distribution of answers for the Emperor's tests

        bother_predicting = True # Whether or not the Bot will attempt to predict the answers to the exam
        study_material = self.study_material[examiner_id]
        distribution = self.distribution[examiner_id]
        if len(distribution) > 0: # If there is actually data to analyse
            sd = StudiousBot.calculate_standard_deviation(distribution)
            normalised_sd = StudiousBot.calculate_normalised_standard_deviation(distribution)

            if abs(30 - sd) < 4: # 30 is the expected s.d for a random distribution
                bother_predicting = False # So I won't bother predicting the test

            if abs(sd - normalised_sd * 2) > 4: # The bot is merely inverting answers to evade being predicted
                pass # However, at this time, I'm not certain how I should deal with this. I'll continue to attempt to predict the test

        if bother_predicting and len(study_material) >= StudiousBot.GRAM_SIZE:
            return StudiousBot.predict(study_material, n)

        return [random.choice([True, False]) for i in range(n)]

    def predict(study_material, n): # Predicts the answers to tests with `n` questions
        grams = StudiousBot.generate_ngrams(study_material, StudiousBot.GRAM_SIZE) # Generate all n-grams for the study material
        last_few = study_material[-(StudiousBot.GRAM_SIZE - 1):] # Get the last 9 test answers
        prediction = None
        probability = -1
        for answer in [True, False]: # Finds the probabiility of the next answer being True or False, picks the one with the highest probability
            new_prediction = last_few + [answer]
            new_probability = grams.count(new_prediction)

            if new_probability > probability:
                prediction = answer
                probability = new_probability

        if n == 1:
            return [prediction]

        return [prediction] + StudiousBot.predict(study_material + [prediction], n-1)

    @staticmethod
    def calculate_standard_deviation(distribution):
        return np.std(distribution)

    def calculate_normalised_standard_deviation(distribution): # If the answers happen to be inverted at some point, this function will return the same value for answers that occured both before and after this point
        distribution = list(map(lambda x: 50 + abs(50-x), distribution))
        return StudiousBot.calculate_standard_deviation(distribution)

    @staticmethod
    def generate_ngrams(study_material, n):
        assert len(study_material) >= n
        ngrams = []
        for i in range(len(study_material) - n + 1):
            ngrams.append(study_material[i:i+n])

        return ngrams

    def update(self, ranks, own_exam, other_exams):
        self.ranks = dict(enumerate(ranks))
        if self.last_examiner != -1:
            self.study_material[self.last_examiner] += own_exam[0]
            self.distribution[self.last_examiner].append(own_exam[0].count(True) / len(own_exam[0]) * 100) # Stores the percentage of the answers which were True

    @staticmethod
    def answer_emperor(n): # Algorithm to reproduce Emperor's distribution of test answers
        exp = np.random.exponential(scale=np.sqrt(np.power(2,n)))
        power = np.power(2,n) - 1
        num = min(exp, power)
        bi = list(np.binary_repr(int(num), width=n))
        return [x == '0' for x in bi]

Judging by our performance, you have the best algorithm for answering and Wi Qe Lu has the best algorithm for asking. I propose that we combine our bots into a single bot, called Xuézhě (Chinese for "scholar"), which coincidentally sounds kind of like "switcher".

I hacked it up and ran the examinations on my machine. Curiously, it outscored Studious Bot, but not Wi Qe Lu.

@PurpleP Haha! That sounds very interesting, I don't think there's enough time for me to improve my bot but you can post it as a submission here

Count Oracular
This bot uses an algorithm that averages the exams of all other working bots, (given the round number and some terrible heuristics) for deciding what each other bot will set as the exam.
The Count asks its exams using an md5 hash. Both its questions and its answers are therefore deterministic. It ignores most inputs, asking and answering the exact same sequences of booleans, rain or shine, including against Jade Emporer.
import numpy as np
import hashlib

class CountOracular:
    '''Uses very little external data to make heuristical statistical
    deterministic predictions about the average exam.
    (Assonance not intended.)
    To generate its own exams, uses a deterministic hash.'''
    def __init__(self, id, number_of_bots):
        self.last_round = []
        #functions for calculating what other bots will likely do.
        self.bots_calculators = [
            self._jad, #Jade Emporer
            self._alp, #Alpha
            self._bet, #Beta
            self._gam, #Gamma
            self._wiq, #Wi Qe Lu
            self._stu, #StudiousBot
            self._pla, #Plagiarist
            self._san, #Santayana
            self._tho, #Thomas
            self._dru, #Drunkard
            self._yin, #YinYang
            self._con, #Contrary
            self._tit, #TitForTat
            self._equ, #Equalizer
            self._mar, #Marx
        ]
        self.bot_types = len(self.bots_calculators)
    def ask(self, n, id):
        #if we can, show that hardcoding is no match for the power of heuristics:
        if n == 2:
            return [False, True]
        #otherwise, refer to the wisdom of Mayor Prentiss in order to command The Ask
        #i.e. hashes a quote, and uses that as the exam.
        salt = b"I AM THE CIRCLE AND THE CIRCLE IS ME " * n
        return self._md5_from(salt, n)
    def answer(self, n, id):
        #uses the power of heuristics to predict what the average bot will do
        #ignores all inputs except the length of the output
        #very approximate, and deterministic
        #i.e. every game, Count Oracular will send the same lists of answers, in the same order
        best_guess_totals = [0.5] * n #halfway between T and F
        for bot in self.bots_calculators:
            exam, confidence = bot(n)
            if not exam:
                continue
            while len(exam) < n:
                #ensure exam is long enough
                exam += exam[:1]
            exam = exam[:n] #ensure exam is short enough
            #map T and F to floats [0,1] based on confidence
            weighted_exam = [0.5+confidence*(0.5 if q else -0.5) for q in exam]
            best_guess_totals = [current+new for current,new in zip(best_guess_totals, weighted_exam)]
        best_guess_averages = [total/self.bot_types
            for total
            in best_guess_totals
        ]
        best_guess = [avg > 0.5 for avg in best_guess_averages]
        self.last_round = best_guess
        return best_guess
    def update(self, ranks, own, others):
        pass
    def _md5_from(self, data, n):
        md5 = hashlib.md5(data)
        for i in range(n):
            md5.update(data)
        exam = []
        while len(exam) < n:
            exam += [x == "0"
                for x
                in bin(int(md5.hexdigest(), 16))[2:].zfill(128)
            ]
            md5.update(data)
        return exam[:n]
    def _invert(self, exam):
        return [not val for val in exam]
    def _digits_to_bools(self, iterable):
        return [char=="1" for char in iterable]
    def _plagiarise(self, n):
        copy = (self.last_round * n)[:n]
        return copy

    '''functions to calculate expected exams for each other bot:
       (these values, weighted with corresponding confidence ratings,
       are summed to calculate the most likely exam.)'''
    def _jad(self, n):
        '''Calculate the mean of _jad's distribution, then
        use that as the guess'''
        mean = max(int(np.sqrt(np.power(2,n))), (2<<n)-1)
        string_mean = f"{mean}".zfill(n)
        exam = self._invert(self._digits_to_bools(string_mean))
        return exam, 0.5
    def _alp(self, n):
        '''Alpha uses a predictable hash,
        until it figures out we aren't Beta,
        modelled by the probability of giving or solving
        Alpha's exam'''
        #probability that Alpha thinks we're Beta
        #assuming we fail to pretend to be Beta if we meet Alpha
        chance_beta = ((1 - 1/self.bot_types) ** n) ** 2
        return self._md5_from(b"Beta", n), chance_beta
    def _gam(self, n):
        '''Gamma is like Beta, except after realising,
        switches to 50-50 random choice of inverse
        either Beta or Alpha's hash'''
        #probability that Gamma thinks we're Alpha still
        #(Unlikely that Gamma will think we're Beta;
        #we'd need to fail Alpha but pass Beta,
        #therefore, not accounted for)
        chance_unknown = ((1 - 1/self.bot_types) ** n) ** 2
        #default exam that assumes that Gamma thinks we're Alpha
        exam = self._md5_from(b"Beta", n)
        if chance_unknown > 0.5:#there exists a better heuristic here
            #assume Gamma will consider us Alpha
            confidence = chance_unknown
        else:
            #assume Gamma considers us neither Alpha nor Beta
            alpha = self._invert(self._md5_from(b"Beta", n))
            beta = self._invert(self._md5_from(b"Alpha", n))
            #check for bools where both possible exams match
            and_comp = [a and b for a, b in zip(alpha, beta)]
            nor_comp = [not (a or b) for a, b in zip(alpha, beta)]
            #count up matches vs times when fell back on default
            #to calculate ratio of default
            #to bools where hashes agree
            confidence_vs_default = (sum(and_comp)+sum(nor_comp)) / n
            confidence = confidence_vs_default * chance_unknown + (1 - confidence_vs_default) * (1 - chance_unknown)
            for i in range(n):
                if and_comp[i]:
                    exam[i] = True
                if nor_comp[i]:
                    exam[i] = False
        return exam, confidence
    def _bet(self, n):
        '''Beta is like Alpha, but with a different hash'''
        #probability we haven't matched with Beta yet
        #i.e. probability that Beta still thinks we're Alpha
        chance_alpha = ((1 - 1/self.bot_types) ** n) ** 2
        return self._md5_from(b"Alpha", n), chance_alpha
    def _wiq(self, n):
        '''Wi Qe Lu is hard to model, so we pretend
        that it mimicks Plagiarist for the most part'''
        if n == 1:
            #first round is random
            return [False], 0
        #other rounds are based on exams it met
        #leaning towards same as the previous exam
        return self._plagiarise(n), 0.1
    def _stu(self, n):
        '''StudiousBot is random'''
        return [False] * n, 0
    def _pla(self, n):
        '''Plagiarist copies the exams it received,
        which can be modelled with the standard prediction
        calculated for the previous round, padded with its first
        element.'''
        if n == 1:
            return [True], 1
        return self._plagiarise(n), 0.3
    def _san(self, n):
        '''Santayana is based on answers, which we don't predict.
        Modelled as random.'''
        #mostly random, slight leaning towards default False
        return [False] * n, 0.1
    def _tho(self, n):
        '''Thomas has an unpredictable threshold.'''
        #for all intents, random
        return [False] * n, 0
    def _dru(self, n):
        '''Drunkard is utterly random.'''
        return [False] * n, 0
    def _yin(self, n):
        '''YinYang inverts itself randomly, but not unpredictably.
        We can model it to find the probability. Also notably,
        one index is inverted, which factors into the confidence
        especially for lower n.'''
        if n == 1:
            #one element is inverted, so whole list must be False
            return [False], 1
        if n == 2:
            #split half and half randomly; can't predict
            return [True] * n, 0
        #cumulative chance of mostly ones or mostly zeros
        truthy = 1
        for _ in range(n):
            #simulate repeated flipping
            truthy = truthy * 0.44 + (1-truthy) * 0.56
        falsey = 1 - truthy
        if falsey > truthy:
            return [False] * n, falsey - 1/n
        return [True] * n, truthy - 1/n
    def _con(self, n):
        '''Contrary is like Jade Emporer, but inverts itself
        so much that modelling the probability of inversion
        is not worth the effort.'''
        #there are some clever ways you could do statistics on this,
        #but I'm content to call it uniform for now
        return [False] * n, 0
    def _tit(self, n):
        '''TitForTat is most likely to give us False
        but the confidence drops as the chance of having
        met TitForTat increases.
        The square root of the probability we calculate for
        Alpha, Beta and Gamma, because those also care about what
        we answer, whereas TitForTat only cares about what we ask'''
        #probability that we've not given TitForTat an exam
        chance_friends = (1 - 1/self.bot_types) ** n
        return [False] * n, chance_friends
    def _equ(self, n):
        '''Equalizer always asks True'''
        #certain that Equalizer's exam is all True
        return [True] * n, 1
    def _mar(self, n):
        '''Marx returns mostly True, randomised based on our rank.
        We don't predict our rank.
        There's ~50% chance an answer is random'''
        #75% chance we guess right (= 50% + 50%*50%)
        return [True] * n, 0.75

A great idea in theory, but in its first contest Count Oracular performed worse than YinYang, despite its efforts to simulate YinYang.

@PurpleP Yes, it's not very good. The reason is that it tries to choose a 'generally optimal' strategy by averaging all of the specific strategies together. It doesn't for example use a strategy tailored to beat YinYang when it encounters YinYang. It doesn't even use a specific strategy on Jade Emporer: it just adds the Jade Emporer strategy to the average. It'll be better than random, but not by much.

Marx has been fixed. You should update Count Oracular to predict it.

@PurpleP Marx should be supported now. It's like it's 1917 again.

YinYang
Answers either all True or all False, except for one index randomly chosen to be the opposite. Asks the opposite of what it answers. Swaps randomly to throw off opponents.
import random

class YinYang:
    def __init__(self, ID, n):
        self.exam = True

    def update(self, rankList, ownExam, otherExams):
        if random.random() < 0.56:
            self.exam = not self.exam

    def answer(self, n, ID):
        a = [not self.exam] * n
        a[random.randint(0, n-1)] = self.exam
        return a

    def ask(self, n, ID):
        e = [self.exam] * n
        e[random.randint(0, n-1)] = not self.exam
        return e

Wi Qe Lu (Switcheroo)
Answers and asks randomly in the first round. Afterwards, he uses the answers from the previous exam, and changes a question if an above-average number of competitors got it right.
class WiQeLu:
    def __init__(self, ID, n):
        self.rounds = 1
        self.firstexam = True
        self.firstanswer = True
        self.lastexaminer = -1
        self.exam = []
        self.pastanswers = {}

    def update(self, rankList, ownExam, otherExams):
        questions, lastanswers = ownExam
        self.pastanswers[self.lastexaminer] = questions

        if len(otherExams) == 0:
            return
        correctCounts = [0 for i in otherExams[0][0]]
        for ourExam, response in otherExams:
            for i in range(len(response)):
                if ourExam[i] == response[i]:
                    correctCounts[i] += 1

        newExam = otherExams[0][0]
        meanWhoAnsweredCorrectly = sum(correctCounts) / len(correctCounts)
        for i in range(len(correctCounts)):
            if correctCounts[i] > meanWhoAnsweredCorrectly:
                newExam[i] = not newExam[i]
        self.exam = newExam

    def answer(self, n, ID):
        self.lastexaminer = ID
        if ID not in self.pastanswers:
            randomanswer = [random.randint(0, 1) == 1] * n
            self.pastanswers[ID] = randomanswer
            return randomanswer
        return (self.pastanswers[ID] * n)[:n]

    def ask(self, n, ID):
        if self.firstexam:
            self.firstexam = False
            self.exam = [random.randint(0, 1) == 1] * n
        return (self.exam * n)[:n]

According to Google Translate "wi qe lu" is roughly translated as "I am penguin road."

One bot of my own:
Thomas
A traveler from a far-away land, has some dangerous ideas about past results being indicative of future performance. He uses those to keep other bots down, unless that stifles his own advancement.
class Thomas:
    def __init__(self,ID,n):
        N=10
        self.ID=ID
        self.myrank=n
        self.lowerank=0
        #The highest number of questions is equal to the number of participants, so we can do this:
        self.probs=[{i:1.0/N for i in np.linspace(0,1,num=N)} for i in np.arange(n)]
        self.output=[0.5]*n

    def ask(self,n,ID):
        if self.myrank==1 and self.lowerrank > 1: #I can't advance without promoting somebody first
            return [self.output[i]>np.random.rand() for i in np.arange(n)]
        #Otherwise, try to step on their fingers by going against the expected probability
        return [self.output[i]<np.random.rand() for i in np.arange(n)]

    def answer(self,n,ID):
        return [self.output[i]>np.random.rand() for i in np.arange(n)]

    def update(self,rankList,ownExam,otherExams):
        #Update our ranks
        self.myrank=len([i for i in rankList if i==rankList[self.ID]])
        self.lowerrank=len([i for i in rankList if i==rankList[self.ID]-1])
        #Update our expectations for each input we've been given
        self.bayesianupdate(ownExam[0])
        for ex in otherExams:
            self.bayesianupdate(ex[1])
        #Compress into output variable
        self.output=[np.sum([l[entry]*entry for entry in l]) for l in self.probs]

    def bayesianupdate(self,data):
        for i in np.arange(len(data)):
            if data[i]: #Got a True
                self.probs[i].update({entry:self.probs[i][entry]*entry for entry in self.probs[i]})
            else: #Got a False
                self.probs[i].update({entry:self.probs[i][entry]*(1-entry) for entry in self.probs[i]})
            s=np.sum([self.probs[i][entry] for entry in self.probs[i]]) #Renormalize
            self.probs[i].update({entry:self.probs[i][entry]/s for entry in self.probs[i]})
```

Did you forget to indent your code after the class statement?

That's just the SE formatting catching me unawares. I'll fix it together with whatever caused an error in somebody's test when using this bot

Beta
Read the chat before downvoting. These bots don't violate any rules. The OP is even encouraging cooperating bots.
Beta is forming a team together with Alpha. Both are using a predefined set of exams to help each other rise up the ranks. Also both are taking advantage of bots using the same exams over and over.
import numpy as np
import hashlib

class Beta:
    def __init__(self,ID,n):
        self.alpha = hashlib.md5(b"Alpha")
        self.beta = hashlib.md5(b"Beta")
        self.asker = -1
        self.alphas = set(range(n)).difference([ID])
        self.fixed = set(range(n)).difference([ID])
        self.fixedExams = [[]] * n

    def ask(self,n,ID):
        if ID in self.alphas:
            return self.md5ToExam(self.beta, n)
        else:
            return list(np.random.choice([True, False], n))

    def answer(self,n,ID):
        self.asker = ID
        if self.asker == -1:
            return [True] * n
        elif self.asker in self.fixed and len(self.fixedExams[self.asker]) > 0:
            return (self.fixedExams[self.asker] * n)[:n]
        elif self.asker in self.alphas:
            return self.md5ToExam(self.alpha, n)
        else:
            return list(np.random.choice([True, False], n))

    def update(self,rankList,ownExam,otherExams):
        if self.asker >= 0:
            if self.asker in self.alphas and ownExam[0] != self.md5ToExam(self.alpha, len(ownExam[0])):
                    self.alphas.remove(self.asker)
            if self.asker in self.fixed:
                l = min(len(ownExam[0]), len(self.fixedExams[self.asker]))
                if ownExam[0][:l] != self.fixedExams[self.asker][:l]:
                    self.fixed.remove(self.asker)
                    self.fixedExams[self.asker] = []
                elif len(ownExam[0]) > len(self.fixedExams[self.asker]):
                    self.fixedExams[self.asker] = ownExam[0]
        self.alpha.update(b"Alpha")
        self.beta.update(b"Beta")

    def md5ToExam(self, md5, n):
        return [x == "0" for x in bin(int(md5.hexdigest(), 16))[2:].zfill(128)][:n]

Gamma
Read the chat before downvoting. These bots don't violate any rules. The OP is even encouraging cooperating bots.
Gamma has discovered the plans of Alpha and Beta and is trying to take advantage of both of them by disguising as one of them.
import numpy as np
import hashlib

class Gamma:
    def __init__(self, ID, n):
        self.alpha = hashlib.md5(b"Alpha")
        self.beta = hashlib.md5(b"Beta")
        self.asker = -1
        self.alphas = set(range(n)).difference([ID])
        self.betas = set(range(n)).difference([ID])
        self.fixed = set(range(n)).difference([ID])
        self.fixedExams = [[]] * n

    def ask(self,n,ID):
        if ID in self.alphas:
            return self.md5ToExam(self.beta, n)
        elif ID in self.betas:
            return self.md5ToExam(self.alpha, n)
        else:
            return self.md5ToWrongExam(np.random.choice([self.alpha, self.beta], 1)[0], n)

    def answer(self,n,ID):
        self.asker = ID
        if self.asker == -1:
            return [True] * n
        elif self.asker in self.fixed and len(self.fixedExams[self.asker]) > 0:
            return (self.fixedExams[self.asker] * n)[:n]
        elif self.asker in self.alphas:
            return self.md5ToExam(self.alpha, n)
        elif self.asker in self.betas:
            return self.md5ToExam(self.beta, n)
        else:
            return list(np.random.choice([True, False], n))

    def update(self,rankList,ownExam,otherExams):
        if self.asker >= 0:
            if self.asker in self.alphas and ownExam[0] != self.md5ToExam(self.alpha, len(ownExam[0])):
                    self.alphas.remove(self.asker)
            if self.asker in self.betas and ownExam[0] != self.md5ToExam(self.beta, len(ownExam[0])):
                    self.betas.remove(self.asker)
            if self.asker in self.fixed:
                l = min(len(ownExam[0]), len(self.fixedExams[self.asker]))
                if ownExam[0][:l] != self.fixedExams[self.asker][:l]:
                    self.fixed.remove(self.asker)
                    self.fixedExams[self.asker] = []
                elif len(ownExam[0]) > len(self.fixedExams[self.asker]):
                    self.fixedExams[self.asker] = ownExam[0]
        self.alpha.update(b"Alpha")
        self.beta.update(b"Beta")

    def md5ToExam(self, md5, n):
        return [x == "0" for x in bin(int(md5.hexdigest(), 16))[2:].zfill(128)][:n]

    def md5ToWrongExam(self, md5, n):
        return [x == "1" for x in bin(int(md5.hexdigest(), 16))[2:].zfill(128)][:n]

Equalizer
Everyone should be equal (with none of this silly emperor nonsense), so provide as much social mobility as possible.  Make the questions really easy (the answer is always True) so that people can succeed.
class Equalizer:
    def __init__(self, ID, n):
        self.previousAnswers = [[0, 0] for _ in range(n)]
        self.previousAsker = -1

    def ask(self, n, ID):
        return [True] * n

    def answer(self, n, ID):
        if ID == -1:
            return [True] * n

        # Assume that questions from the same bot will usually have the same answer.
        t, f = self.previousAnswers[ID]
        return [t >= f] * n

    def update(self, rankList, ownExam, otherExams):
        if self.previousAsker == -1:
            return

        # Keep track of what answer each bot prefers.
        counts = self.previousAnswers[self.previousAsker]
        counts[0] += ownExam[0].count(True)
        counts[1] += ownExam[0].count(False)

TitForTat
Asks you easy questions if you asked it easy questions in the past. If you have never given it an exam, it defaults to easy questions.
Additionally, does not trust anyone who asks difficult questions, and will give them unpredictable answers.
import numpy as np

class TitForTat:
    def __init__(self, ID, n):
        self.friendly = [True] * n
        self.asker = -1

    def make_answers(self, n, ID):
        if ID == -1 or self.friendly[ID]:
            return [False] * n
        else:
            return list(np.random.choice([True, False], n))

    def ask(self, n, ID):
        return self.make_answers(n, ID)

    def answer(self, n, ID):
        self.asker = ID
        return self.make_answers(n, ID)

    def update(self, rankList, ownExam, otherExams):
        if self.asker != -1:
            # You are friendly if and only if you gave me a simple exam
            self.friendly[self.asker] = all(ownExam[0])

This bot works well if other bots cooperate with it. Currently only Equaliser cooperates, but this should hopefully be enough.

At the moment, the bot can't compete because it doesn't follow specifications. Ensure that it returns list objects at all times. Also, under both old and updated rules, perfect copies of a bot are not valid submissions, so the allowed number of instances of this bot running is 1.

I edited it to return lists. As for the perfect copies thing, there is no current bot that properly cooperates with it, so the number of carbon copy bots - the minimum required for successful enactment of the strategy - is at least 1 (this bot and 1 copy of it are needed).

You're arguing that you qualify for an exception under clause 3 while trying to submit something that falls under clause 1: Perfect copies of a bot are never valid, no exceptions.
And to qualify for the exception of clause 3, you'd need to prove that your strategy stricly requires all these partners reacting to it, as for example a handshake signal, which is indeed useless without somebody listening. Yours does not. Equalizer will hand you exams to trigger the "friendly" clause, thus disproving that a copy of your bot is needed.

Fine then. I'll make a few final adjustments.

Contrary
The Jade Emperor is always right, so it implements the Jade Emperor's asking function as its own answer function when it needs more than 2 answers. For only 1 answer it answers true (decent odds of being correct) and for 2 it answers true,false (this response passes "at least half" of the questions three out of four possible quizzes, better than choosing at random).
Uses similar logic in its Update with regards to how it alters its asking pattern, but its asking logic is similar to the Jade Emperor's, just with a different weight. Fluctuates between higher values of true with higher values of false when too many candidates score high enough to pass.
class Contrary:
    def __init__(self,ID,n):
        self.rank = 0
        self.ID = ID
        self.competitors = {}
        self.weight = -2
        pass

    def ask(self,n,ID):
        if self.weight > 0:
            num=min(np.random.exponential(scale=np.sqrt(np.power(self.weight,n))),np.power(2,n)-1)
            bi=list(np.binary_repr(int(num),width=n))
            return [x=='0' for x in bi]
        else:
            num=min(np.random.exponential(scale=np.sqrt(np.power(-self.weight,n))),np.power(2,n)-1)
            bi=list(np.binary_repr(int(num),width=n))
            return [x=='1' for x in bi]

    def answer(self,n,ID):
        if n == 1:
            return [True]
        if n == 2:
            return [True,False]
        num=min(np.random.exponential(scale=np.sqrt(np.power(2,n))),np.power(2,n)-1)
        bi=list(np.binary_repr(int(num),width=n))
        return [x=='0' for x in bi]

    def update(self,rankList,ownExam,otherExams):
        self.rank = rankList[self.ID];
        if len(otherExams) == 0:
            return
        correctCounts = [0 for i in otherExams[0][0]]
        for ourExam, response in otherExams:
            for i in range(len(response)):
                if ourExam[i] == response[i]:
                    correctCounts[i] += 1

        meanWhoAnsweredCorrectly = sum(correctCounts) / len(correctCounts)
        for i in range(len(correctCounts)):
            if correctCounts[i]+1 > meanWhoAnsweredCorrectly:
                self.weight = np.copysign(np.random.uniform(1,3),-self.weight)

Doesn't true, false fail if the exam is false, true?

The first few lines in answer have syntax and name errors - true and false should be True and False, and the ifs are missing :s at the end

Thanks you two; I didn't have Python set up on my machine as I don't use it that often, so I mess up the syntax regularly.

newExam is set but never read in update. pass is a NOP command, you can delete it. (The comment behind it is just a pun for the Drunkard you copied over.) Also, you're implicitly using math and random modules but didn't declare you imported them. I've re-written it in my contest file with np.copysign and np.random.uniform that should do the same thing.

@AlienAtSystem Should be fixed now.

@pppery Somehow missed your comment earlier. Er, yes. It does, and I am not sure why I didn't catch that, but I haven't been sleeping well (as apparently the area around my apartment has become a popular place to drag race motorcycles at 3am). Still, for 3 passes (true,true,false,false, and true,false) out of four possibilities is better than answering at random.

@Draco18s You get always 3 passes for 4 possible combinations of 2 questions, no matter what answers you choose. Basically you fail only if you answer both questions wrong (1/4 chance).

Your bot has a chance to give back the wrong number of bits. Please read the numpy doc and consider why I'm capping my number by 2^n-1.

@AlienAtSystem Corrected.

Marx
This is the Marx bot. He believes that, instead of a bureaucracy, we should have a communist system. To help reach this goal, it gives harder quizzes to higher ranking bots. It also gives more random answers to quizzes from higher bots, because they are probably cleverer, because they are higher up.
import numpy as np

class Marx():
    def __init__(self, ID, n):
        self.ID = ID
        self.n = n
        self.ranks = [] # The bot rankings
        self.e = [] # Our quiz
        self.rank = 0 # Our rank
    def ask(self, n, ID):
        test = [True] * n
        # Get the rank of the bot being quizzed
        if self.ranks:
            rank = self.ranks[ID]
        else:
            rank = 0
        for i in range(len(test)):
            item = test[i]
            if np.random.uniform(0, rank / self.n) > 0.5:
                # If the bot is higher ranking, make the quiz harder
                item = np.random.choice([True, False], 1)[0]
            test[i] = item
        # IF the test is not long enough, add Falses to the end
        while len(test) < n - 1:
            test.append(False)
        return test
    def answer(self, n, ID):
        # Get the rank of the asking bot
        if self.ranks:
            rank = self.ranks[ID]
        else:
            rank = 0
        if self.e:
            # Pad our quiz with Falses so it will not throw IndexError
            while len(self.e) < n:
                self.e.append(False)
            for i in range(len(self.e)):
                item = self.e[i]
                if np.random.uniform(0, rank / self.n) > 0.5:
                    # Assume that higher ranking bots are cleverer, so add more random answers
                    item = np.random.choice([True, False], 1)[0]
                self.e[i] = item
            if len(self.e) > self.rank + 1:
                self.e = self.e[:self.rank + 1]
            return self.e
        else:
            # If it is the first round, return all Trues
            return [True] * n
    def update(self, rankList, ownExam, otherExams):
        # Update our list of ranks
        self.ranks = rankList
        # Store the quiz we were given, to give to the next bot
        self.e = ownExam[0]
        # Store our rank
        self.rank = rankList[self.ID]

Marx currently answers a byte too many, so he can't compete right now

What do you mean? Are his exams/answers too long?

His answer is one entry too long

OK, I fixed that. It should be fine now.

Sorry, I gave you wrong feedback: Now, the answers are a byte too short. The real problem is that you extend self.e when it's too short (although not enough right now), but don't trim it when Marx gets demoted.

OK, I made some edits. It should shorten its answers now. Oh, by the way: Why is it a problem to have answers of the wrong length.

Because those are the rules. The scoring for Pro/Demotion of right answers/total questions only makes sense if the number of answers and questions is equal.

OK, thanks for clarification. Sorry to be any trouble.


text:
Given a sequence of numbers, print out all possible sets such that the sum is less than a number
The problem has 3 inputs.
L: a list of all numbers
size: the size each set can be
max: the max sum amongst each set
The challenge is as follows:
Given L, size and max, construct as many sets from L such that the number of elements is size and the sum of each of the elements does not exceed max.
Examples:
func(L=[1,2,3,4], size=2, max=5) = [{1,2}, {1,3}, {2,3}, {1,4}]

Notice how each of the values in the outputted set are sum <= max.
func(L=[1,2,3,4], size=3, max=6) = [{1,2,3}]

func(L=[1,2,3,4], size=3, max=5) = [{}] or empty list, whichever you want

Note that in the set you cannot have duplicated items. ie: {2,1} = {1,2}
Constraints on inputs:
L: 0 or more elements
size: 0 <= size <= len(L)
max: 0 or more
If a list has 0 items, then always return the empty set.
If the size is 0, then always return the empty set.
If max is 0, it is possible that there are negative values in L, in which case the returned sets need not be empty.
Shorted bytes wins!

I would suggest guaranteeing that L will be non-empty. It is generally advisable to avoid edge cases in code-golf challenges, as they don't add much and can cost many bytes.

This could really use some more test cases, especially test cases where the elements in L are not all unique.

05AB1E, 6 bytes
.ÆêʒO@

Try it online!

Duplicated items in list: try this: 2,[1,1,2,2,3,3,4,4],20. [1,2] is repeated

@KSplitX Thanks, fixed. It would be helpful if you added that test case to the question!

Python 3, 82 79 bytes
lambda l,s,m:[i for i in __import__("itertools").combinations(l,s)if sum(i)<=m]

Try it online!
-3 bytes thanks to squid

Brachylog, 9 bytes
≥ᵗ⟨⟨⊇l⟩+⟩

Try it online!
Takes input as [[L,size],max] through the input variable and generates the output through the output variable.

Japt, 11 bytes
àV â fÈx §W

Try it
àV â fÈx §W     :Implicit input of array U=L and integers V=size & W=max
àV              :Combinations of U of length V
   â            :Deduplicate
     f          :Filter by
      È         :Function
       x        :  Sum
         §W     :  Less than or equal to W

Not unique outputs. Try the following:
[1,1,2,2,3,3,4,4],4,20... 1,1,2,3 for example is repeated

@KSplitX, Missed that. Fixed

R, 56 bytes
function(L,s,m,a=combn(L,s))unique(a[,colSums(a)<=m],,2)

Try it online!
Creates a matrix where each column is a subset of L of size s, and keeps those for which the sum is less than m. Output is a matrix, with each column corresponding to one allowable subset (if there is only one such subset, the output is a s×1 matrix and R will display it on one row instead by default).
Note that this fails for the edge case where L is empty. Handling that edge case as specified in the challenge takes 19 more bytes:
R, 75 bytes
function(L,s,m,a=combn(L,s))`if`(length(L),unique(a[,colSums(a)<=m],,2),{})

Try it online!

53 bytes? I don't think I've ever noticed that unique has a margin argument, that's quite a helpful tip! I usually just unique(t()); the comments on other answers seem to indicate that [1,1] shouldn't be a valid output on [1,1,2,3],2,20

@Giuseppe I discovered the margin argument today as well. I was going to unique(t()) but checked the help of unique just in case... and luckily, the argument exists! I guess we need to wait for OP to clarify the challenge to know where to apply unique.

Gaia, 8 bytes
Σ⊂
euK↑⁇

Try it online!
Takes input as list, size, max sum on separate lines.

Jelly, 9 bytes
QœcS>¥Ðḟ⁵

Try it online!

You need to move the Q to the beginning. The challenge doesn't really have adequate test cases right now, so you might easily miss that.

@EriktheOutgolfer thanks

Pyth, 15 bytes
{SMfgeQsT.PhQht

Try it online!
{SMfgeQsT.PhQhtQ  # (last Q implicit; Q = input)
         .P       # all permutations
           hQ     #   of Q[0]
             htQ  #           of length Q[1:][0] = Q[1]
   f              # filter those with lambda T:
     eQ           #   Q[-1]
    g             #          >=
       sT         #             sum(T)
 SM               # sort each element
{                 # deduplicate

Kotlin, 286 bytes
fun p(l:List<Int>,s:Int,m:Int){val r=MutableList(0){""}
val a=l.toSet().toList()
fun r(n:Int,b:Int,t:Int,u:List<Int>){if(n<1){if(t<=m)r.add(u.joinToString(",","{","}"))}else
for(e in b..a.size-1)r(n-1,e+1,t+a[e],u+listOf(a[e]))}
r(s,0,0,List(0){0})
println(r.joinToString(",","[","]"))}

Try it online!