#include <iostream>
using namespace std;
int main()
{
unsigned char memory[0x1000];
const size_t video_mem_row_size = 64;
const size_t video_mem_offset = 0xF00;
typedef unsigned char video_mem_row[video_mem_row_size];
video_mem_row* video_mem = (video_mem_row*)(memory + video_mem_offset);
size_t test_rows = 3;
for (int i = 0; i < test_rows; i++)
for (int j = 0; j < video_mem_row_size; j++)
video_mem[i][j] = j;
bool check_failed = false;
for (int k = 0; k < test_rows * video_mem_row_size; k++)
if (memory[video_mem_offset + k] != k % 64)
check_failed = true;
cout << boolalpha << check_failed << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCkKewogICAgdW5zaWduZWQgY2hhciBtZW1vcnlbMHgxMDAwXTsKCiAgICBjb25zdCBzaXplX3QgdmlkZW9fbWVtX3Jvd19zaXplID0gNjQ7CiAgICBjb25zdCBzaXplX3QgdmlkZW9fbWVtX29mZnNldCA9IDB4RjAwOwogICAgdHlwZWRlZiB1bnNpZ25lZCBjaGFyIHZpZGVvX21lbV9yb3dbdmlkZW9fbWVtX3Jvd19zaXplXTsKICAgIAogICAgdmlkZW9fbWVtX3JvdyogdmlkZW9fbWVtID0gKHZpZGVvX21lbV9yb3cqKShtZW1vcnkgKyB2aWRlb19tZW1fb2Zmc2V0KTsKICAgIAogICAgc2l6ZV90IHRlc3Rfcm93cyA9IDM7CiAgICBmb3IgKGludCBpID0gMDsgaSA8IHRlc3Rfcm93czsgaSsrKQogICAgICAgIGZvciAoaW50IGogPSAwOyBqIDwgdmlkZW9fbWVtX3Jvd19zaXplOyBqKyspCiAgICAgICAgICAgIHZpZGVvX21lbVtpXVtqXSA9IGo7CiAgICAgICAgICAgIAogICAgYm9vbCBjaGVja19mYWlsZWQgPSBmYWxzZTsKICAgIGZvciAoaW50IGsgPSAwOyBrIDwgdGVzdF9yb3dzICogdmlkZW9fbWVtX3Jvd19zaXplOyBrKyspCiAgICAgICAgaWYgKG1lbW9yeVt2aWRlb19tZW1fb2Zmc2V0ICsga10gIT0gayAlIDY0KQogICAgICAgICAgICBjaGVja19mYWlsZWQgPSB0cnVlOwoKICAgIGNvdXQgPDwgYm9vbGFscGhhIDw8IGNoZWNrX2ZhaWxlZCA8PCBlbmRsOwogICAgcmV0dXJuIDA7Cn0=