Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
7.7 kB
4
Indexable
Never
def decode_rle(rle):
    image = []

    for i in range(0, len(rle), 2):
        pixel = rle[i]
        length = rle[i+1]
        image.extend([pixel] * length)

    return image
    
encoded_image = [0, 209, 243, 2, 1, 1, 100, 1, 0, 132, 2, 100, 2, 0, 133, 1, 1, 3, 0, 131, 2, 100, 3, 1, 2, 100, 1, 0, 2, 100, 1, 0, 126, 1, 3, 100, 1, 0, 133, 2, 1, 6, 100, 2, 1, 1, 0, 6, 100, 1, 0, 116, 1, 5, 0, 135, 2, 1, 9, 0, 5, 100, 1, 1, 1, 0, 113, 1, 5, 100, 1, 0, 5, 1, 1, 100, 1, 1, 1, 100, 1, 0, 128, 2, 1, 10, 0, 1, 100, 3, 1, 2, 100, 1, 0, 109, 1, 8, 100, 1, 0, 2, 1, 5, 0, 130, 2, 1, 10, 0, 1, 1, 6, 0, 10, 100, 2, 0, 10, 100, 2, 0, 48, 100, 1, 0, 33, 1, 15, 0, 135, 2, 1, 9, 0, 1, 1, 6, 100, 2, 0, 6, 100, 2, 1, 2, 0, 10, 1, 2, 0, 46, 1, 2, 100, 1, 0, 30, 1, 15, 0, 138, 2, 1, 9, 0, 1, 1, 8, 0, 6, 1, 4, 0, 9, 100, 1, 1, 2, 0, 44, 1, 5, 100, 1, 0, 26, 1, 15, 0, 141, 2, 1, 9, 0, 1, 1, 8, 0, 6, 1, 4, 100, 1, 0, 8, 1, 3, 100, 1, 0, 41, 1, 6, 0, 25, 1, 14, 0, 146, 2, 1, 17, 0, 6, 1, 5, 0, 7, 100, 1, 1, 2, 100, 1, 1, 1, 100, 1, 0, 38, 1, 6, 0, 24, 1, 14, 0, 149, 2, 1, 17, 0, 6, 1, 5, 0, 7, 1, 6, 0, 13, 100, 1, 0, 22, 1, 6, 0, 23, 1, 14, 0, 153, 2, 1, 16, 0, 6, 1, 5, 0, 6, 1, 6, 0, 1, 100, 1, 0, 11, 1, 1, 0, 6, 100, 1, 0, 14, 1, 6, 0, 22, 1, 13, 0, 157, 2, 1, 16, 0, 2, 100, 1, 0, 3, 1, 5, 0, 6, 1, 7, 100, 1, 0, 11, 1, 1, 0, 2, 100, 1, 0, 1, 100, 1, 1, 1, 100, 2, 0, 11, 1, 6, 0, 21, 1, 13, 0, 160, 2, 1, 17, 100, 1, 1, 1, 100, 2, 0, 1, 1, 5, 0, 6, 1, 7, 100, 1, 0, 8, 100, 1, 0, 1, 1, 1, 0, 2, 1, 1, 100, 1, 1, 4, 100, 1, 0, 10, 1, 5, 0, 20, 1, 13, 0, 164, 2, 1, 20, 100, 1, 1, 5, 0, 6, 1, 7, 100, 1, 0, 1, 100, 4, 0, 1, 100, 2, 1, 3, 100, 2, 1, 6, 100, 3, 0, 1, 100, 1, 0, 3, 100, 1, 1, 5, 0, 19, 1, 12, 0, 168, 2, 1, 26, 100, 2, 0, 3, 1, 13, 100, 1, 1, 18, 100, 2, 1, 6, 0, 18, 1, 12, 0, 171, 2, 1, 28, 0, 2, 100, 1, 1, 38, 0, 17, 1, 12, 0, 175, 2, 1, 27, 100, 2, 1, 37, 0, 16, 1, 11, 0, 179, 2, 1, 64, 0, 16, 1, 10, 0, 182, 2, 1, 62, 0, 15, 1, 10, 0, 186, 2, 1, 59, 0, 14, 1, 9, 0, 190, 2, 1, 57, 0, 13, 1, 9, 0, 193, 2, 1, 55, 0, 12, 1, 8, 0, 198, 2, 1, 52, 0, 11, 1, 8, 0, 17, 1, 6, 100, 1, 0, 177, 2, 1, 50, 0, 10, 1, 8, 0, 15, 1, 12, 100, 1, 0, 177, 2, 1, 47, 0, 9, 1, 7, 0, 14, 1, 16, 100, 1, 0, 178, 2, 1, 45, 0, 8, 1, 7, 0, 13, 1, 20, 100, 1, 0, 178, 2, 1, 44, 0, 6, 1, 7, 0, 11, 1, 25, 100, 1, 0, 179, 2, 1, 42, 0, 4, 1, 6, 0, 10, 1, 32, 100, 1, 0, 177, 2, 1, 42, 0, 1, 1, 6, 0, 8, 1, 37, 100, 1, 0, 177, 2, 1, 46, 0, 6, 1, 41, 100, 1, 0, 179, 2, 1, 41, 0, 5, 1, 46, 100, 1, 0, 179, 2, 1, 39, 0, 2, 1, 51, 100, 1, 0, 179, 2, 1, 91, 100, 1, 0, 181, 2, 1, 92, 100, 1, 0, 179, 2, 1, 92, 100, 1, 0, 180, 2, 1, 90, 100, 1, 0, 181, 2, 1, 90, 100, 1, 0, 181, 2, 1, 90, 100, 1, 0, 181, 2, 1, 89, 100, 1, 0, 183, 2, 1, 88, 100, 1, 0, 183, 2, 1, 87, 100, 1, 0, 184, 2, 1, 87, 100, 1, 0, 185, 2, 1, 28, 0, 3, 1, 1, 100, 1, 0, 3, 1, 10, 100, 1, 0, 7, 1, 10, 100, 1, 0, 5, 1, 17, 100, 1, 0, 184, 2, 1, 28, 0, 12, 1, 5, 100, 1, 0, 15, 1, 3, 100, 1, 0, 207, 2, 1, 27, 100, 2, 0, 15, 1, 1, 100, 1, 0, 227, 2, 1, 27, 100, 1, 0, 244, 2, 1, 27, 0, 245, 2, 1, 27, 0, 245, 2, 100, 1, 1, 25, 100, 1, 0, 245, 2, 1, 26, 100, 2, 0, 209, 2, 100, 5, 0, 30, 1, 27, 0, 203, 2, 100, 7, 1, 5, 100, 1, 0, 29, 1, 26, 100, 1, 0, 203, 2, 1, 13, 0, 29, 1, 26, 100, 1, 0, 203, 2, 1, 13, 0, 29, 1, 26, 100, 1, 0, 203, 2, 1, 13, 0, 29, 1, 26, 100, 1, 0, 203, 2, 1, 12, 0, 30, 100, 1, 1, 25, 100, 1, 0, 203, 2, 1, 12, 0, 30, 1, 26, 100, 1, 0, 203, 2, 1, 11, 0, 30, 1, 27, 100, 1, 0, 183, 2, 100, 2, 0, 18, 1, 11, 0, 20, 100, 1, 0, 9, 1, 27, 100, 1, 0, 183, 2, 100, 1, 1, 2, 0, 17, 1, 10, 0, 3, 100, 1, 0, 3, 100, 2, 0, 10, 1, 2, 100, 1, 0, 8, 1, 28, 100, 1, 0, 183, 2, 100, 1, 1, 3, 0, 16, 1, 10, 0, 2, 1, 1, 0, 3, 1, 2, 0, 10, 1, 3, 100, 1, 0, 4, 1, 2, 100, 1, 1, 29, 100, 1, 0, 184, 2, 1, 3, 0, 16, 1, 9, 0, 3, 1, 1, 0, 2, 1, 2, 0, 9, 1, 5, 100, 3, 1, 34, 100, 1, 0, 185, 2, 1, 3, 0, 15, 1, 9, 0, 1, 100, 1, 1, 1, 0, 3, 1, 2, 0, 7, 1, 44, 100, 1, 0, 8, 1, 4, 100, 1, 0, 172, 2, 1, 4, 0, 14, 1, 8, 0, 1, 1, 3, 100, 1, 0, 1, 1, 2, 0, 7, 1, 45, 100, 1, 0, 5, 1, 7, 100, 1, 0, 173, 2, 1, 4, 0, 9, 100, 4, 1, 8, 0, 1, 1, 3, 0, 1, 1, 2, 0, 6, 1, 47, 100, 1, 0, 2, 1, 9, 100, 1, 0, 175, 2, 1, 3, 0, 6, 100, 3, 1, 18, 0, 6, 1, 60, 100, 1, 0, 176, 2, 1, 3, 0, 1, 100, 1, 1, 1, 0, 2, 1, 20, 0, 5, 1, 64, 100, 1, 0, 175, 2, 1, 3, 100, 1, 1, 91, 100, 1, 0, 167, 2, 100, 3, 0, 7, 1, 98, 100, 1, 0, 164, 2, 1, 4, 0, 4, 100, 1, 1, 94, 0, 3, 1, 3, 100, 1, 0, 163, 2, 100, 1, 1, 4, 100, 1, 1, 88, 0, 3, 1, 11, 100, 1, 0, 163, 2, 100, 1, 1, 107, 100, 1, 0, 162, 2, 100, 2, 1, 102, 0, 168, 2, 100, 1, 1, 107, 100, 1, 0, 164, 2, 1, 111, 100, 1, 0, 160, 2, 100, 1, 1, 110, 100, 1, 0, 160, 2, 100, 1, 1, 115, 100, 1, 0, 155, 2, 100, 1, 1, 117, 0, 154, 2, 100, 1, 1, 136, 1, 100, 1, 0, 134, 2, 100, 1, 1, 138, 1, 100, 1, 0, 132, 2, 100, 1, 1, 142, 1, 100, 1, 0, 128, 2, 100, 1, 1, 142, 1, 100, 1, 0, 128, 2, 100, 1, 1, 141, 1, 100, 1, 0, 129, 2, 100, 1, 1, 148, 1, 100, 1, 0, 250, 1, 100, 1, 1, 140, 1, 100, 1, 0, 129, 2, 100, 1, 1, 131, 1, 100, 1, 0, 140, 2, 100, 1, 1, 131, 1, 100, 1, 0, 139, 2, 100, 1, 1, 132, 1, 100, 1, 0, 138, 2, 100, 1, 1, 134, 1, 0, 137, 2, 100, 1, 1, 137, 1, 0, 134, 2, 100, 1, 1, 96, 0, 2, 1, 36, 100, 1, 0, 2, 1, 2, 100, 1, 0, 131, 2, 100, 1, 1, 96, 0, 4, 1, 5, 0, 1, 1, 25, 100, 1, 0, 139, 2, 100, 1, 1, 97, 0, 6, 1, 4, 0, 4, 1, 17, 100, 1, 0, 1, 1, 3, 100, 1, 0, 137, 2, 100, 1, 1, 97, 0, 8, 1, 5, 0, 6, 1, 5, 0, 1, 1, 3, 100, 1, 1, 2, 100, 1, 0, 142, 2, 100, 1, 1, 98, 0, 10, 1, 5, 0, 8, 1, 2, 100, 1, 0, 147, 2, 100, 1, 1, 18, 0, 2, 1, 24, 0, 1, 1, 54, 100, 1, 0, 11, 1, 5, 0, 156, 2, 100, 1, 1, 3, 0, 1, 100, 2, 1, 10, 0, 2, 100, 2, 1, 2, 100, 1, 1, 1, 100, 1, 1, 11, 0, 1, 1, 5, 0, 2, 100, 1, 1, 53, 100, 1, 0, 13, 1, 5, 0, 154, 2, 100, 1, 0, 5, 100, 1, 1, 9, 0, 4, 100, 1, 0, 4, 100, 1, 1, 9, 0, 5, 1, 2, 100, 1, 0, 2, 100, 2, 1, 11, 100, 1, 1, 41, 100, 1, 0, 15, 1, 5, 0, 157, 2, 100, 1, 1, 2, 100, 1, 1, 5, 0, 10, 100, 1, 1, 8, 0, 5, 100, 3, 0, 4, 100, 1, 1, 11, 100, 1, 1, 41, 100, 1, 0, 18, 1, 3, 100, 1, 0, 155, 2, 100, 1, 0, 2, 1, 4, 0, 12, 100, 1, 1, 6, 0, 14, 1, 11, 0, 1, 1, 29, 0, 1, 1, 4, 0, 1, 1, 7, 0, 21, 1, 2, 100, 1, 0, 155, 2, 1, 5, 0, 13, 1, 5, 0, 15, 100, 2, 1, 9, 100, 1, 0, 1, 1, 29, 0, 1, 1, 13, 0, 177, 2, 100, 1, 1, 4, 0, 13, 1, 5, 0, 17, 100, 2, 1, 7, 100, 1, 0, 2, 1, 29, 0, 2, 1, 12, 0, 177, 2, 100, 1, 1, 3, 0, 13, 100, 4, 1, 1, 0, 19, 100, 1, 1, 6, 0, 4, 1, 29, 0, 2, 100, 1, 1, 3, 0, 1, 1, 8, 0, 176, 2, 100, 1, 1, 1, 0, 18, 100, 1, 0, 20, 100, 2, 1, 4, 0, 5, 1, 29, 0, 3, 1, 3, 0, 1, 1, 8, 0, 176, 2, 100, 1, 0, 41, 100, 4, 0, 6, 1, 29, 0, 4, 1, 1, 100, 1, 0, 2, 1, 8, 0, 227, 2, 1, 29, 0, 4, 100, 1, 0, 3, 100, 1, 1, 7, 0, 227, 2, 1, 29, 0, 9, 100, 1, 1, 4, 100, 2, 0, 227, 2, 1, 29, 0, 10, 100, 3, 0, 1, 1, 1, 0, 228, 2, 1, 29, 0, 14, 100, 1, 0, 228, 2, 1, 29, 0, 243, 2, 1, 21, 0, 1, 1, 7, 0, 243, 2, 1, 21, 0, 1, 1, 7, 0, 243, 2, 1, 29, 0, 243, 2, 1, 29, 0, 243, 2, 1, 29, 0, 243, 2, 1, 29, 0, 243, 2, 1, 29, 0, 243, 2, 1, 30, 0, 242, 2, 1, 30, 0, 241, 2, 1, 31, 0, 241, 2, 1, 31, 0, 241, 2, 1, 31, 0, 241, 2, 1, 31, 0, 240, 2, 1, 33, 0, 239, 2, 1, 33, 0, 239, 2, 1, 33, 0, 238, 2, 1, 34, 0, 238, 2, 1, 34, 0, 238, 2, 1, 35, 0, 236, 2, 1, 36, 0, 236, 2, 1, 36, 0, 236, 2, 1, 37, 0, 234, 2, 1, 38, 0, 234, 2, 1, 38, 0, 234, 2, 100, 1, 1, 36, 0, 1, 1, 1, 0, 233, 2, 1, 18, 100, 5, 1, 16, 0, 233, 2, 1, 16, 100, 1, 1, 1, 0, 5, 100, 1, 1, 3, 100, 2, 1, 2, 100, 1, 1, 7, 0, 233, 2, 1, 15, 100, 1, 0, 1, 100, 1, 0, 6, 1, 1, 100, 2, 0, 2, 100, 1, 1, 1, 0, 1, 100, 4, 1, 3, 0, 233, 2, 1, 2, 100, 2, 1, 5, 100, 6, 0, 9, 100, 1, 0, 5, 100, 1, 0, 5, 1, 2, 0, 1, 1, 1, 0, 232, 2, 100, 2, 0, 2, 100, 5, 0, 27, 100, 2, 1, 1, 100, 1, 0, 142, 3, 100, 1, 0, 175, 179, 3];

decoded_image = decode_rle(encoded_image)

print(decoded_image)