Oberon Competition - Win a $US50 Amazon Gift Voucher

Topics related to the use of Oberon language features
Locked
cfbsoftware
Site Admin
Posts: 525
Joined: Fri Dec 31, 2010 12:30 pm
Contact:

Oberon Competition - Win a $US50 Amazon Gift Voucher

Post by cfbsoftware » Wed Dec 03, 2014 12:54 pm

A $US50 Amazon Gift Voucher will be awarded to the person who can rewrite the following module so that it produces the same results but executes in the least amount of time:

Code: Select all

MODULE Quiz;

VAR
  a1*, a2*: ARRAY 1000 OF INTEGER;
  i: INTEGER;

PROCEDURE Init*;
BEGIN
  FOR i := 0 TO LEN(a1) - 1 DO 
    a1[i] := i;
    a2[i] := i
  END
END Init;

END Quiz.
The Terms and Conditions are (amended 6 Dec 2014):

1. You cannot use any IMPORT statements.
2. Your submitted code must compile without modification on any version v5.1 or later of any edition of Astrobe. (amended 12 Dec 2014)
3. When linked with the QuizTimer program below your code must run on any supported development board with at least 16K of RAM.
4. The interface as it appears to a client module must remain unchanged.
5. Your solution must be posted as a reply to this topic.
6. A maximum of two attempts per person are allowed.
7. If the execution time of two solutions are identical the prize will be awarded to the solution with the smallest generated code size.
8. If two solutions are identical in size and execution time the prize will be awarded to the one that was submitted earliest.
9. These conditions are subject to change if the need arises.
10. Any attempts considered to be cheating will be disqualified.
11. The judge's decision is final.


The closing time for entries is midnight GMT on 31st Dec 2014.

The following additional conditions apply to all entries received after 12 Noon GMT on 6 Dec 2014:
12. The generated code size of the compiled module must be no larger than the original.
13. No person can win more than one prize.
14. The program used to time the results is:

Code: Select all

MODULE QuizTimer;

IMPORT Out, Timer, Main, Quiz;

BEGIN
  Timer.Init(Timer.uSecs);
  Timer.Start();
  Quiz.Init();
  Out.Int(Timer.Elapsed(), 0); 
  Out.Ln
END QuizTimer.
Good luck!

AlexIljin
Posts: 2
Joined: Mon Jan 03, 2011 6:19 am

Re: Oberon Competition - Win a $US50 Amazon Gift Voucher

Post by AlexIljin » Sat Dec 06, 2014 10:01 am

Here's my first submission:

Code: Select all

MODULE Quiz;

VAR
  a1*, a2*: ARRAY 1000 OF INTEGER;

PROCEDURE Init*;
BEGIN
  a1[0] := 0; 
  a1[1] := 1; 
  a1[2] := 2; 
  a1[3] := 3; 
  a1[4] := 4; 
  a1[5] := 5; 
  a1[6] := 6; 
  a1[7] := 7; 
  a1[8] := 8; 
  a1[9] := 9; 
  a1[10] := 10; 
  a1[11] := 11; 
  a1[12] := 12; 
  a1[13] := 13; 
  a1[14] := 14; 
  a1[15] := 15; 
  a1[16] := 16; 
  a1[17] := 17; 
  a1[18] := 18; 
  a1[19] := 19; 
  a1[20] := 20; 
  a1[21] := 21; 
  a1[22] := 22; 
  a1[23] := 23; 
  a1[24] := 24; 
  a1[25] := 25; 
  a1[26] := 26; 
  a1[27] := 27; 
  a1[28] := 28; 
  a1[29] := 29; 
  a1[30] := 30; 
  a1[31] := 31; 
  a1[32] := 32; 
  a1[33] := 33; 
  a1[34] := 34; 
  a1[35] := 35; 
  a1[36] := 36; 
  a1[37] := 37; 
  a1[38] := 38; 
  a1[39] := 39; 
  a1[40] := 40; 
  a1[41] := 41; 
  a1[42] := 42; 
  a1[43] := 43; 
  a1[44] := 44; 
  a1[45] := 45; 
  a1[46] := 46; 
  a1[47] := 47; 
  a1[48] := 48; 
  a1[49] := 49; 
  a1[50] := 50; 
  a1[51] := 51; 
  a1[52] := 52; 
  a1[53] := 53; 
  a1[54] := 54; 
  a1[55] := 55; 
  a1[56] := 56; 
  a1[57] := 57; 
  a1[58] := 58; 
  a1[59] := 59; 
  a1[60] := 60; 
  a1[61] := 61; 
  a1[62] := 62; 
  a1[63] := 63; 
  a1[64] := 64; 
  a1[65] := 65; 
  a1[66] := 66; 
  a1[67] := 67; 
  a1[68] := 68; 
  a1[69] := 69; 
  a1[70] := 70; 
  a1[71] := 71; 
  a1[72] := 72; 
  a1[73] := 73; 
  a1[74] := 74; 
  a1[75] := 75; 
  a1[76] := 76; 
  a1[77] := 77; 
  a1[78] := 78; 
  a1[79] := 79; 
  a1[80] := 80; 
  a1[81] := 81; 
  a1[82] := 82; 
  a1[83] := 83; 
  a1[84] := 84; 
  a1[85] := 85; 
  a1[86] := 86; 
  a1[87] := 87; 
  a1[88] := 88; 
  a1[89] := 89; 
  a1[90] := 90; 
  a1[91] := 91; 
  a1[92] := 92; 
  a1[93] := 93; 
  a1[94] := 94; 
  a1[95] := 95; 
  a1[96] := 96; 
  a1[97] := 97; 
  a1[98] := 98; 
  a1[99] := 99; 
  a1[100] := 100; 
  a1[101] := 101; 
  a1[102] := 102; 
  a1[103] := 103; 
  a1[104] := 104; 
  a1[105] := 105; 
  a1[106] := 106; 
  a1[107] := 107; 
  a1[108] := 108; 
  a1[109] := 109; 
  a1[110] := 110; 
  a1[111] := 111; 
  a1[112] := 112; 
  a1[113] := 113; 
  a1[114] := 114; 
  a1[115] := 115; 
  a1[116] := 116; 
  a1[117] := 117; 
  a1[118] := 118; 
  a1[119] := 119; 
  a1[120] := 120; 
  a1[121] := 121; 
  a1[122] := 122; 
  a1[123] := 123; 
  a1[124] := 124; 
  a1[125] := 125; 
  a1[126] := 126; 
  a1[127] := 127; 
  a1[128] := 128; 
  a1[129] := 129; 
  a1[130] := 130; 
  a1[131] := 131; 
  a1[132] := 132; 
  a1[133] := 133; 
  a1[134] := 134; 
  a1[135] := 135; 
  a1[136] := 136; 
  a1[137] := 137; 
  a1[138] := 138; 
  a1[139] := 139; 
  a1[140] := 140; 
  a1[141] := 141; 
  a1[142] := 142; 
  a1[143] := 143; 
  a1[144] := 144; 
  a1[145] := 145; 
  a1[146] := 146; 
  a1[147] := 147; 
  a1[148] := 148; 
  a1[149] := 149; 
  a1[150] := 150; 
  a1[151] := 151; 
  a1[152] := 152; 
  a1[153] := 153; 
  a1[154] := 154; 
  a1[155] := 155; 
  a1[156] := 156; 
  a1[157] := 157; 
  a1[158] := 158; 
  a1[159] := 159; 
  a1[160] := 160; 
  a1[161] := 161; 
  a1[162] := 162; 
  a1[163] := 163; 
  a1[164] := 164; 
  a1[165] := 165; 
  a1[166] := 166; 
  a1[167] := 167; 
  a1[168] := 168; 
  a1[169] := 169; 
  a1[170] := 170; 
  a1[171] := 171; 
  a1[172] := 172; 
  a1[173] := 173; 
  a1[174] := 174; 
  a1[175] := 175; 
  a1[176] := 176; 
  a1[177] := 177; 
  a1[178] := 178; 
  a1[179] := 179; 
  a1[180] := 180; 
  a1[181] := 181; 
  a1[182] := 182; 
  a1[183] := 183; 
  a1[184] := 184; 
  a1[185] := 185; 
  a1[186] := 186; 
  a1[187] := 187; 
  a1[188] := 188; 
  a1[189] := 189; 
  a1[190] := 190; 
  a1[191] := 191; 
  a1[192] := 192; 
  a1[193] := 193; 
  a1[194] := 194; 
  a1[195] := 195; 
  a1[196] := 196; 
  a1[197] := 197; 
  a1[198] := 198; 
  a1[199] := 199; 
  a1[200] := 200; 
  a1[201] := 201; 
  a1[202] := 202; 
  a1[203] := 203; 
  a1[204] := 204; 
  a1[205] := 205; 
  a1[206] := 206; 
  a1[207] := 207; 
  a1[208] := 208; 
  a1[209] := 209; 
  a1[210] := 210; 
  a1[211] := 211; 
  a1[212] := 212; 
  a1[213] := 213; 
  a1[214] := 214; 
  a1[215] := 215; 
  a1[216] := 216; 
  a1[217] := 217; 
  a1[218] := 218; 
  a1[219] := 219; 
  a1[220] := 220; 
  a1[221] := 221; 
  a1[222] := 222; 
  a1[223] := 223; 
  a1[224] := 224; 
  a1[225] := 225; 
  a1[226] := 226; 
  a1[227] := 227; 
  a1[228] := 228; 
  a1[229] := 229; 
  a1[230] := 230; 
  a1[231] := 231; 
  a1[232] := 232; 
  a1[233] := 233; 
  a1[234] := 234; 
  a1[235] := 235; 
  a1[236] := 236; 
  a1[237] := 237; 
  a1[238] := 238; 
  a1[239] := 239; 
  a1[240] := 240; 
  a1[241] := 241; 
  a1[242] := 242; 
  a1[243] := 243; 
  a1[244] := 244; 
  a1[245] := 245; 
  a1[246] := 246; 
  a1[247] := 247; 
  a1[248] := 248; 
  a1[249] := 249; 
  a1[250] := 250; 
  a1[251] := 251; 
  a1[252] := 252; 
  a1[253] := 253; 
  a1[254] := 254; 
  a1[255] := 255; 
  a1[256] := 256; 
  a1[257] := 257; 
  a1[258] := 258; 
  a1[259] := 259; 
  a1[260] := 260; 
  a1[261] := 261; 
  a1[262] := 262; 
  a1[263] := 263; 
  a1[264] := 264; 
  a1[265] := 265; 
  a1[266] := 266; 
  a1[267] := 267; 
  a1[268] := 268; 
  a1[269] := 269; 
  a1[270] := 270; 
  a1[271] := 271; 
  a1[272] := 272; 
  a1[273] := 273; 
  a1[274] := 274; 
  a1[275] := 275; 
  a1[276] := 276; 
  a1[277] := 277; 
  a1[278] := 278; 
  a1[279] := 279; 
  a1[280] := 280; 
  a1[281] := 281; 
  a1[282] := 282; 
  a1[283] := 283; 
  a1[284] := 284; 
  a1[285] := 285; 
  a1[286] := 286; 
  a1[287] := 287; 
  a1[288] := 288; 
  a1[289] := 289; 
  a1[290] := 290; 
  a1[291] := 291; 
  a1[292] := 292; 
  a1[293] := 293; 
  a1[294] := 294; 
  a1[295] := 295; 
  a1[296] := 296; 
  a1[297] := 297; 
  a1[298] := 298; 
  a1[299] := 299; 
  a1[300] := 300; 
  a1[301] := 301; 
  a1[302] := 302; 
  a1[303] := 303; 
  a1[304] := 304; 
  a1[305] := 305; 
  a1[306] := 306; 
  a1[307] := 307; 
  a1[308] := 308; 
  a1[309] := 309; 
  a1[310] := 310; 
  a1[311] := 311; 
  a1[312] := 312; 
  a1[313] := 313; 
  a1[314] := 314; 
  a1[315] := 315; 
  a1[316] := 316; 
  a1[317] := 317; 
  a1[318] := 318; 
  a1[319] := 319; 
  a1[320] := 320; 
  a1[321] := 321; 
  a1[322] := 322; 
  a1[323] := 323; 
  a1[324] := 324; 
  a1[325] := 325; 
  a1[326] := 326; 
  a1[327] := 327; 
  a1[328] := 328; 
  a1[329] := 329; 
  a1[330] := 330; 
  a1[331] := 331; 
  a1[332] := 332; 
  a1[333] := 333; 
  a1[334] := 334; 
  a1[335] := 335; 
  a1[336] := 336; 
  a1[337] := 337; 
  a1[338] := 338; 
  a1[339] := 339; 
  a1[340] := 340; 
  a1[341] := 341; 
  a1[342] := 342; 
  a1[343] := 343; 
  a1[344] := 344; 
  a1[345] := 345; 
  a1[346] := 346; 
  a1[347] := 347; 
  a1[348] := 348; 
  a1[349] := 349; 
  a1[350] := 350; 
  a1[351] := 351; 
  a1[352] := 352; 
  a1[353] := 353; 
  a1[354] := 354; 
  a1[355] := 355; 
  a1[356] := 356; 
  a1[357] := 357; 
  a1[358] := 358; 
  a1[359] := 359; 
  a1[360] := 360; 
  a1[361] := 361; 
  a1[362] := 362; 
  a1[363] := 363; 
  a1[364] := 364; 
  a1[365] := 365; 
  a1[366] := 366; 
  a1[367] := 367; 
  a1[368] := 368; 
  a1[369] := 369; 
  a1[370] := 370; 
  a1[371] := 371; 
  a1[372] := 372; 
  a1[373] := 373; 
  a1[374] := 374; 
  a1[375] := 375; 
  a1[376] := 376; 
  a1[377] := 377; 
  a1[378] := 378; 
  a1[379] := 379; 
  a1[380] := 380; 
  a1[381] := 381; 
  a1[382] := 382; 
  a1[383] := 383; 
  a1[384] := 384; 
  a1[385] := 385; 
  a1[386] := 386; 
  a1[387] := 387; 
  a1[388] := 388; 
  a1[389] := 389; 
  a1[390] := 390; 
  a1[391] := 391; 
  a1[392] := 392; 
  a1[393] := 393; 
  a1[394] := 394; 
  a1[395] := 395; 
  a1[396] := 396; 
  a1[397] := 397; 
  a1[398] := 398; 
  a1[399] := 399; 
  a1[400] := 400; 
  a1[401] := 401; 
  a1[402] := 402; 
  a1[403] := 403; 
  a1[404] := 404; 
  a1[405] := 405; 
  a1[406] := 406; 
  a1[407] := 407; 
  a1[408] := 408; 
  a1[409] := 409; 
  a1[410] := 410; 
  a1[411] := 411; 
  a1[412] := 412; 
  a1[413] := 413; 
  a1[414] := 414; 
  a1[415] := 415; 
  a1[416] := 416; 
  a1[417] := 417; 
  a1[418] := 418; 
  a1[419] := 419; 
  a1[420] := 420; 
  a1[421] := 421; 
  a1[422] := 422; 
  a1[423] := 423; 
  a1[424] := 424; 
  a1[425] := 425; 
  a1[426] := 426; 
  a1[427] := 427; 
  a1[428] := 428; 
  a1[429] := 429; 
  a1[430] := 430; 
  a1[431] := 431; 
  a1[432] := 432; 
  a1[433] := 433; 
  a1[434] := 434; 
  a1[435] := 435; 
  a1[436] := 436; 
  a1[437] := 437; 
  a1[438] := 438; 
  a1[439] := 439; 
  a1[440] := 440; 
  a1[441] := 441; 
  a1[442] := 442; 
  a1[443] := 443; 
  a1[444] := 444; 
  a1[445] := 445; 
  a1[446] := 446; 
  a1[447] := 447; 
  a1[448] := 448; 
  a1[449] := 449; 
  a1[450] := 450; 
  a1[451] := 451; 
  a1[452] := 452; 
  a1[453] := 453; 
  a1[454] := 454; 
  a1[455] := 455; 
  a1[456] := 456; 
  a1[457] := 457; 
  a1[458] := 458; 
  a1[459] := 459; 
  a1[460] := 460; 
  a1[461] := 461; 
  a1[462] := 462; 
  a1[463] := 463; 
  a1[464] := 464; 
  a1[465] := 465; 
  a1[466] := 466; 
  a1[467] := 467; 
  a1[468] := 468; 
  a1[469] := 469; 
  a1[470] := 470; 
  a1[471] := 471; 
  a1[472] := 472; 
  a1[473] := 473; 
  a1[474] := 474; 
  a1[475] := 475; 
  a1[476] := 476; 
  a1[477] := 477; 
  a1[478] := 478; 
  a1[479] := 479; 
  a1[480] := 480; 
  a1[481] := 481; 
  a1[482] := 482; 
  a1[483] := 483; 
  a1[484] := 484; 
  a1[485] := 485; 
  a1[486] := 486; 
  a1[487] := 487; 
  a1[488] := 488; 
  a1[489] := 489; 
  a1[490] := 490; 
  a1[491] := 491; 
  a1[492] := 492; 
  a1[493] := 493; 
  a1[494] := 494; 
  a1[495] := 495; 
  a1[496] := 496; 
  a1[497] := 497; 
  a1[498] := 498; 
  a1[499] := 499; 
  a1[500] := 500; 
  a1[501] := 501; 
  a1[502] := 502; 
  a1[503] := 503; 
  a1[504] := 504; 
  a1[505] := 505; 
  a1[506] := 506; 
  a1[507] := 507; 
  a1[508] := 508; 
  a1[509] := 509; 
  a1[510] := 510; 
  a1[511] := 511; 
  a1[512] := 512; 
  a1[513] := 513; 
  a1[514] := 514; 
  a1[515] := 515; 
  a1[516] := 516; 
  a1[517] := 517; 
  a1[518] := 518; 
  a1[519] := 519; 
  a1[520] := 520; 
  a1[521] := 521; 
  a1[522] := 522; 
  a1[523] := 523; 
  a1[524] := 524; 
  a1[525] := 525; 
  a1[526] := 526; 
  a1[527] := 527; 
  a1[528] := 528; 
  a1[529] := 529; 
  a1[530] := 530; 
  a1[531] := 531; 
  a1[532] := 532; 
  a1[533] := 533; 
  a1[534] := 534; 
  a1[535] := 535; 
  a1[536] := 536; 
  a1[537] := 537; 
  a1[538] := 538; 
  a1[539] := 539; 
  a1[540] := 540; 
  a1[541] := 541; 
  a1[542] := 542; 
  a1[543] := 543; 
  a1[544] := 544; 
  a1[545] := 545; 
  a1[546] := 546; 
  a1[547] := 547; 
  a1[548] := 548; 
  a1[549] := 549; 
  a1[550] := 550; 
  a1[551] := 551; 
  a1[552] := 552; 
  a1[553] := 553; 
  a1[554] := 554; 
  a1[555] := 555; 
  a1[556] := 556; 
  a1[557] := 557; 
  a1[558] := 558; 
  a1[559] := 559; 
  a1[560] := 560; 
  a1[561] := 561; 
  a1[562] := 562; 
  a1[563] := 563; 
  a1[564] := 564; 
  a1[565] := 565; 
  a1[566] := 566; 
  a1[567] := 567; 
  a1[568] := 568; 
  a1[569] := 569; 
  a1[570] := 570; 
  a1[571] := 571; 
  a1[572] := 572; 
  a1[573] := 573; 
  a1[574] := 574; 
  a1[575] := 575; 
  a1[576] := 576; 
  a1[577] := 577; 
  a1[578] := 578; 
  a1[579] := 579; 
  a1[580] := 580; 
  a1[581] := 581; 
  a1[582] := 582; 
  a1[583] := 583; 
  a1[584] := 584; 
  a1[585] := 585; 
  a1[586] := 586; 
  a1[587] := 587; 
  a1[588] := 588; 
  a1[589] := 589; 
  a1[590] := 590; 
  a1[591] := 591; 
  a1[592] := 592; 
  a1[593] := 593; 
  a1[594] := 594; 
  a1[595] := 595; 
  a1[596] := 596; 
  a1[597] := 597; 
  a1[598] := 598; 
  a1[599] := 599; 
  a1[600] := 600; 
  a1[601] := 601; 
  a1[602] := 602; 
  a1[603] := 603; 
  a1[604] := 604; 
  a1[605] := 605; 
  a1[606] := 606; 
  a1[607] := 607; 
  a1[608] := 608; 
  a1[609] := 609; 
  a1[610] := 610; 
  a1[611] := 611; 
  a1[612] := 612; 
  a1[613] := 613; 
  a1[614] := 614; 
  a1[615] := 615; 
  a1[616] := 616; 
  a1[617] := 617; 
  a1[618] := 618; 
  a1[619] := 619; 
  a1[620] := 620; 
  a1[621] := 621; 
  a1[622] := 622; 
  a1[623] := 623; 
  a1[624] := 624; 
  a1[625] := 625; 
  a1[626] := 626; 
  a1[627] := 627; 
  a1[628] := 628; 
  a1[629] := 629; 
  a1[630] := 630; 
  a1[631] := 631; 
  a1[632] := 632; 
  a1[633] := 633; 
  a1[634] := 634; 
  a1[635] := 635; 
  a1[636] := 636; 
  a1[637] := 637; 
  a1[638] := 638; 
  a1[639] := 639; 
  a1[640] := 640; 
  a1[641] := 641; 
  a1[642] := 642; 
  a1[643] := 643; 
  a1[644] := 644; 
  a1[645] := 645; 
  a1[646] := 646; 
  a1[647] := 647; 
  a1[648] := 648; 
  a1[649] := 649; 
  a1[650] := 650; 
  a1[651] := 651; 
  a1[652] := 652; 
  a1[653] := 653; 
  a1[654] := 654; 
  a1[655] := 655; 
  a1[656] := 656; 
  a1[657] := 657; 
  a1[658] := 658; 
  a1[659] := 659; 
  a1[660] := 660; 
  a1[661] := 661; 
  a1[662] := 662; 
  a1[663] := 663; 
  a1[664] := 664; 
  a1[665] := 665; 
  a1[666] := 666; 
  a1[667] := 667; 
  a1[668] := 668; 
  a1[669] := 669; 
  a1[670] := 670; 
  a1[671] := 671; 
  a1[672] := 672; 
  a1[673] := 673; 
  a1[674] := 674; 
  a1[675] := 675; 
  a1[676] := 676; 
  a1[677] := 677; 
  a1[678] := 678; 
  a1[679] := 679; 
  a1[680] := 680; 
  a1[681] := 681; 
  a1[682] := 682; 
  a1[683] := 683; 
  a1[684] := 684; 
  a1[685] := 685; 
  a1[686] := 686; 
  a1[687] := 687; 
  a1[688] := 688; 
  a1[689] := 689; 
  a1[690] := 690; 
  a1[691] := 691; 
  a1[692] := 692; 
  a1[693] := 693; 
  a1[694] := 694; 
  a1[695] := 695; 
  a1[696] := 696; 
  a1[697] := 697; 
  a1[698] := 698; 
  a1[699] := 699; 
  a1[700] := 700; 
  a1[701] := 701; 
  a1[702] := 702; 
  a1[703] := 703; 
  a1[704] := 704; 
  a1[705] := 705; 
  a1[706] := 706; 
  a1[707] := 707; 
  a1[708] := 708; 
  a1[709] := 709; 
  a1[710] := 710; 
  a1[711] := 711; 
  a1[712] := 712; 
  a1[713] := 713; 
  a1[714] := 714; 
  a1[715] := 715; 
  a1[716] := 716; 
  a1[717] := 717; 
  a1[718] := 718; 
  a1[719] := 719; 
  a1[720] := 720; 
  a1[721] := 721; 
  a1[722] := 722; 
  a1[723] := 723; 
  a1[724] := 724; 
  a1[725] := 725; 
  a1[726] := 726; 
  a1[727] := 727; 
  a1[728] := 728; 
  a1[729] := 729; 
  a1[730] := 730; 
  a1[731] := 731; 
  a1[732] := 732; 
  a1[733] := 733; 
  a1[734] := 734; 
  a1[735] := 735; 
  a1[736] := 736; 
  a1[737] := 737; 
  a1[738] := 738; 
  a1[739] := 739; 
  a1[740] := 740; 
  a1[741] := 741; 
  a1[742] := 742; 
  a1[743] := 743; 
  a1[744] := 744; 
  a1[745] := 745; 
  a1[746] := 746; 
  a1[747] := 747; 
  a1[748] := 748; 
  a1[749] := 749; 
  a1[750] := 750; 
  a1[751] := 751; 
  a1[752] := 752; 
  a1[753] := 753; 
  a1[754] := 754; 
  a1[755] := 755; 
  a1[756] := 756; 
  a1[757] := 757; 
  a1[758] := 758; 
  a1[759] := 759; 
  a1[760] := 760; 
  a1[761] := 761; 
  a1[762] := 762; 
  a1[763] := 763; 
  a1[764] := 764; 
  a1[765] := 765; 
  a1[766] := 766; 
  a1[767] := 767; 
  a1[768] := 768; 
  a1[769] := 769; 
  a1[770] := 770; 
  a1[771] := 771; 
  a1[772] := 772; 
  a1[773] := 773; 
  a1[774] := 774; 
  a1[775] := 775; 
  a1[776] := 776; 
  a1[777] := 777; 
  a1[778] := 778; 
  a1[779] := 779; 
  a1[780] := 780; 
  a1[781] := 781; 
  a1[782] := 782; 
  a1[783] := 783; 
  a1[784] := 784; 
  a1[785] := 785; 
  a1[786] := 786; 
  a1[787] := 787; 
  a1[788] := 788; 
  a1[789] := 789; 
  a1[790] := 790; 
  a1[791] := 791; 
  a1[792] := 792; 
  a1[793] := 793; 
  a1[794] := 794; 
  a1[795] := 795; 
  a1[796] := 796; 
  a1[797] := 797; 
  a1[798] := 798; 
  a1[799] := 799; 
  a1[800] := 800; 
  a1[801] := 801; 
  a1[802] := 802; 
  a1[803] := 803; 
  a1[804] := 804; 
  a1[805] := 805; 
  a1[806] := 806; 
  a1[807] := 807; 
  a1[808] := 808; 
  a1[809] := 809; 
  a1[810] := 810; 
  a1[811] := 811; 
  a1[812] := 812; 
  a1[813] := 813; 
  a1[814] := 814; 
  a1[815] := 815; 
  a1[816] := 816; 
  a1[817] := 817; 
  a1[818] := 818; 
  a1[819] := 819; 
  a1[820] := 820; 
  a1[821] := 821; 
  a1[822] := 822; 
  a1[823] := 823; 
  a1[824] := 824; 
  a1[825] := 825; 
  a1[826] := 826; 
  a1[827] := 827; 
  a1[828] := 828; 
  a1[829] := 829; 
  a1[830] := 830; 
  a1[831] := 831; 
  a1[832] := 832; 
  a1[833] := 833; 
  a1[834] := 834; 
  a1[835] := 835; 
  a1[836] := 836; 
  a1[837] := 837; 
  a1[838] := 838; 
  a1[839] := 839; 
  a1[840] := 840; 
  a1[841] := 841; 
  a1[842] := 842; 
  a1[843] := 843; 
  a1[844] := 844; 
  a1[845] := 845; 
  a1[846] := 846; 
  a1[847] := 847; 
  a1[848] := 848; 
  a1[849] := 849; 
  a1[850] := 850; 
  a1[851] := 851; 
  a1[852] := 852; 
  a1[853] := 853; 
  a1[854] := 854; 
  a1[855] := 855; 
  a1[856] := 856; 
  a1[857] := 857; 
  a1[858] := 858; 
  a1[859] := 859; 
  a1[860] := 860; 
  a1[861] := 861; 
  a1[862] := 862; 
  a1[863] := 863; 
  a1[864] := 864; 
  a1[865] := 865; 
  a1[866] := 866; 
  a1[867] := 867; 
  a1[868] := 868; 
  a1[869] := 869; 
  a1[870] := 870; 
  a1[871] := 871; 
  a1[872] := 872; 
  a1[873] := 873; 
  a1[874] := 874; 
  a1[875] := 875; 
  a1[876] := 876; 
  a1[877] := 877; 
  a1[878] := 878; 
  a1[879] := 879; 
  a1[880] := 880; 
  a1[881] := 881; 
  a1[882] := 882; 
  a1[883] := 883; 
  a1[884] := 884; 
  a1[885] := 885; 
  a1[886] := 886; 
  a1[887] := 887; 
  a1[888] := 888; 
  a1[889] := 889; 
  a1[890] := 890; 
  a1[891] := 891; 
  a1[892] := 892; 
  a1[893] := 893; 
  a1[894] := 894; 
  a1[895] := 895; 
  a1[896] := 896; 
  a1[897] := 897; 
  a1[898] := 898; 
  a1[899] := 899; 
  a1[900] := 900; 
  a1[901] := 901; 
  a1[902] := 902; 
  a1[903] := 903; 
  a1[904] := 904; 
  a1[905] := 905; 
  a1[906] := 906; 
  a1[907] := 907; 
  a1[908] := 908; 
  a1[909] := 909; 
  a1[910] := 910; 
  a1[911] := 911; 
  a1[912] := 912; 
  a1[913] := 913; 
  a1[914] := 914; 
  a1[915] := 915; 
  a1[916] := 916; 
  a1[917] := 917; 
  a1[918] := 918; 
  a1[919] := 919; 
  a1[920] := 920; 
  a1[921] := 921; 
  a1[922] := 922; 
  a1[923] := 923; 
  a1[924] := 924; 
  a1[925] := 925; 
  a1[926] := 926; 
  a1[927] := 927; 
  a1[928] := 928; 
  a1[929] := 929; 
  a1[930] := 930; 
  a1[931] := 931; 
  a1[932] := 932; 
  a1[933] := 933; 
  a1[934] := 934; 
  a1[935] := 935; 
  a1[936] := 936; 
  a1[937] := 937; 
  a1[938] := 938; 
  a1[939] := 939; 
  a1[940] := 940; 
  a1[941] := 941; 
  a1[942] := 942; 
  a1[943] := 943; 
  a1[944] := 944; 
  a1[945] := 945; 
  a1[946] := 946; 
  a1[947] := 947; 
  a1[948] := 948; 
  a1[949] := 949; 
  a1[950] := 950; 
  a1[951] := 951; 
  a1[952] := 952; 
  a1[953] := 953; 
  a1[954] := 954; 
  a1[955] := 955; 
  a1[956] := 956; 
  a1[957] := 957; 
  a1[958] := 958; 
  a1[959] := 959; 
  a1[960] := 960; 
  a1[961] := 961; 
  a1[962] := 962; 
  a1[963] := 963; 
  a1[964] := 964; 
  a1[965] := 965; 
  a1[966] := 966; 
  a1[967] := 967; 
  a1[968] := 968; 
  a1[969] := 969; 
  a1[970] := 970; 
  a1[971] := 971; 
  a1[972] := 972; 
  a1[973] := 973; 
  a1[974] := 974; 
  a1[975] := 975; 
  a1[976] := 976; 
  a1[977] := 977; 
  a1[978] := 978; 
  a1[979] := 979; 
  a1[980] := 980; 
  a1[981] := 981; 
  a1[982] := 982; 
  a1[983] := 983; 
  a1[984] := 984; 
  a1[985] := 985; 
  a1[986] := 986; 
  a1[987] := 987; 
  a1[988] := 988; 
  a1[989] := 989; 
  a1[990] := 990; 
  a1[991] := 991; 
  a1[992] := 992; 
  a1[993] := 993; 
  a1[994] := 994; 
  a1[995] := 995; 
  a1[996] := 996; 
  a1[997] := 997; 
  a1[998] := 998; 
  a1[999] := 999; 
  a2[0] := 0; 
  a2[1] := 1; 
  a2[2] := 2; 
  a2[3] := 3; 
  a2[4] := 4; 
  a2[5] := 5; 
  a2[6] := 6; 
  a2[7] := 7; 
  a2[8] := 8; 
  a2[9] := 9; 
  a2[10] := 10; 
  a2[11] := 11; 
  a2[12] := 12; 
  a2[13] := 13; 
  a2[14] := 14; 
  a2[15] := 15; 
  a2[16] := 16; 
  a2[17] := 17; 
  a2[18] := 18; 
  a2[19] := 19; 
  a2[20] := 20; 
  a2[21] := 21; 
  a2[22] := 22; 
  a2[23] := 23; 
  a2[24] := 24; 
  a2[25] := 25; 
  a2[26] := 26; 
  a2[27] := 27; 
  a2[28] := 28; 
  a2[29] := 29; 
  a2[30] := 30; 
  a2[31] := 31; 
  a2[32] := 32; 
  a2[33] := 33; 
  a2[34] := 34; 
  a2[35] := 35; 
  a2[36] := 36; 
  a2[37] := 37; 
  a2[38] := 38; 
  a2[39] := 39; 
  a2[40] := 40; 
  a2[41] := 41; 
  a2[42] := 42; 
  a2[43] := 43; 
  a2[44] := 44; 
  a2[45] := 45; 
  a2[46] := 46; 
  a2[47] := 47; 
  a2[48] := 48; 
  a2[49] := 49; 
  a2[50] := 50; 
  a2[51] := 51; 
  a2[52] := 52; 
  a2[53] := 53; 
  a2[54] := 54; 
  a2[55] := 55; 
  a2[56] := 56; 
  a2[57] := 57; 
  a2[58] := 58; 
  a2[59] := 59; 
  a2[60] := 60; 
  a2[61] := 61; 
  a2[62] := 62; 
  a2[63] := 63; 
  a2[64] := 64; 
  a2[65] := 65; 
  a2[66] := 66; 
  a2[67] := 67; 
  a2[68] := 68; 
  a2[69] := 69; 
  a2[70] := 70; 
  a2[71] := 71; 
  a2[72] := 72; 
  a2[73] := 73; 
  a2[74] := 74; 
  a2[75] := 75; 
  a2[76] := 76; 
  a2[77] := 77; 
  a2[78] := 78; 
  a2[79] := 79; 
  a2[80] := 80; 
  a2[81] := 81; 
  a2[82] := 82; 
  a2[83] := 83; 
  a2[84] := 84; 
  a2[85] := 85; 
  a2[86] := 86; 
  a2[87] := 87; 
  a2[88] := 88; 
  a2[89] := 89; 
  a2[90] := 90; 
  a2[91] := 91; 
  a2[92] := 92; 
  a2[93] := 93; 
  a2[94] := 94; 
  a2[95] := 95; 
  a2[96] := 96; 
  a2[97] := 97; 
  a2[98] := 98; 
  a2[99] := 99; 
  a2[100] := 100; 
  a2[101] := 101; 
  a2[102] := 102; 
  a2[103] := 103; 
  a2[104] := 104; 
  a2[105] := 105; 
  a2[106] := 106; 
  a2[107] := 107; 
  a2[108] := 108; 
  a2[109] := 109; 
  a2[110] := 110; 
  a2[111] := 111; 
  a2[112] := 112; 
  a2[113] := 113; 
  a2[114] := 114; 
  a2[115] := 115; 
  a2[116] := 116; 
  a2[117] := 117; 
  a2[118] := 118; 
  a2[119] := 119; 
  a2[120] := 120; 
  a2[121] := 121; 
  a2[122] := 122; 
  a2[123] := 123; 
  a2[124] := 124; 
  a2[125] := 125; 
  a2[126] := 126; 
  a2[127] := 127; 
  a2[128] := 128; 
  a2[129] := 129; 
  a2[130] := 130; 
  a2[131] := 131; 
  a2[132] := 132; 
  a2[133] := 133; 
  a2[134] := 134; 
  a2[135] := 135; 
  a2[136] := 136; 
  a2[137] := 137; 
  a2[138] := 138; 
  a2[139] := 139; 
  a2[140] := 140; 
  a2[141] := 141; 
  a2[142] := 142; 
  a2[143] := 143; 
  a2[144] := 144; 
  a2[145] := 145; 
  a2[146] := 146; 
  a2[147] := 147; 
  a2[148] := 148; 
  a2[149] := 149; 
  a2[150] := 150; 
  a2[151] := 151; 
  a2[152] := 152; 
  a2[153] := 153; 
  a2[154] := 154; 
  a2[155] := 155; 
  a2[156] := 156; 
  a2[157] := 157; 
  a2[158] := 158; 
  a2[159] := 159; 
  a2[160] := 160; 
  a2[161] := 161; 
  a2[162] := 162; 
  a2[163] := 163; 
  a2[164] := 164; 
  a2[165] := 165; 
  a2[166] := 166; 
  a2[167] := 167; 
  a2[168] := 168; 
  a2[169] := 169; 
  a2[170] := 170; 
  a2[171] := 171; 
  a2[172] := 172; 
  a2[173] := 173; 
  a2[174] := 174; 
  a2[175] := 175; 
  a2[176] := 176; 
  a2[177] := 177; 
  a2[178] := 178; 
  a2[179] := 179; 
  a2[180] := 180; 
  a2[181] := 181; 
  a2[182] := 182; 
  a2[183] := 183; 
  a2[184] := 184; 
  a2[185] := 185; 
  a2[186] := 186; 
  a2[187] := 187; 
  a2[188] := 188; 
  a2[189] := 189; 
  a2[190] := 190; 
  a2[191] := 191; 
  a2[192] := 192; 
  a2[193] := 193; 
  a2[194] := 194; 
  a2[195] := 195; 
  a2[196] := 196; 
  a2[197] := 197; 
  a2[198] := 198; 
  a2[199] := 199; 
  a2[200] := 200; 
  a2[201] := 201; 
  a2[202] := 202; 
  a2[203] := 203; 
  a2[204] := 204; 
  a2[205] := 205; 
  a2[206] := 206; 
  a2[207] := 207; 
  a2[208] := 208; 
  a2[209] := 209; 
  a2[210] := 210; 
  a2[211] := 211; 
  a2[212] := 212; 
  a2[213] := 213; 
  a2[214] := 214; 
  a2[215] := 215; 
  a2[216] := 216; 
  a2[217] := 217; 
  a2[218] := 218; 
  a2[219] := 219; 
  a2[220] := 220; 
  a2[221] := 221; 
  a2[222] := 222; 
  a2[223] := 223; 
  a2[224] := 224; 
  a2[225] := 225; 
  a2[226] := 226; 
  a2[227] := 227; 
  a2[228] := 228; 
  a2[229] := 229; 
  a2[230] := 230; 
  a2[231] := 231; 
  a2[232] := 232; 
  a2[233] := 233; 
  a2[234] := 234; 
  a2[235] := 235; 
  a2[236] := 236; 
  a2[237] := 237; 
  a2[238] := 238; 
  a2[239] := 239; 
  a2[240] := 240; 
  a2[241] := 241; 
  a2[242] := 242; 
  a2[243] := 243; 
  a2[244] := 244; 
  a2[245] := 245; 
  a2[246] := 246; 
  a2[247] := 247; 
  a2[248] := 248; 
  a2[249] := 249; 
  a2[250] := 250; 
  a2[251] := 251; 
  a2[252] := 252; 
  a2[253] := 253; 
  a2[254] := 254; 
  a2[255] := 255; 
  a2[256] := 256; 
  a2[257] := 257; 
  a2[258] := 258; 
  a2[259] := 259; 
  a2[260] := 260; 
  a2[261] := 261; 
  a2[262] := 262; 
  a2[263] := 263; 
  a2[264] := 264; 
  a2[265] := 265; 
  a2[266] := 266; 
  a2[267] := 267; 
  a2[268] := 268; 
  a2[269] := 269; 
  a2[270] := 270; 
  a2[271] := 271; 
  a2[272] := 272; 
  a2[273] := 273; 
  a2[274] := 274; 
  a2[275] := 275; 
  a2[276] := 276; 
  a2[277] := 277; 
  a2[278] := 278; 
  a2[279] := 279; 
  a2[280] := 280; 
  a2[281] := 281; 
  a2[282] := 282; 
  a2[283] := 283; 
  a2[284] := 284; 
  a2[285] := 285; 
  a2[286] := 286; 
  a2[287] := 287; 
  a2[288] := 288; 
  a2[289] := 289; 
  a2[290] := 290; 
  a2[291] := 291; 
  a2[292] := 292; 
  a2[293] := 293; 
  a2[294] := 294; 
  a2[295] := 295; 
  a2[296] := 296; 
  a2[297] := 297; 
  a2[298] := 298; 
  a2[299] := 299; 
  a2[300] := 300; 
  a2[301] := 301; 
  a2[302] := 302; 
  a2[303] := 303; 
  a2[304] := 304; 
  a2[305] := 305; 
  a2[306] := 306; 
  a2[307] := 307; 
  a2[308] := 308; 
  a2[309] := 309; 
  a2[310] := 310; 
  a2[311] := 311; 
  a2[312] := 312; 
  a2[313] := 313; 
  a2[314] := 314; 
  a2[315] := 315; 
  a2[316] := 316; 
  a2[317] := 317; 
  a2[318] := 318; 
  a2[319] := 319; 
  a2[320] := 320; 
  a2[321] := 321; 
  a2[322] := 322; 
  a2[323] := 323; 
  a2[324] := 324; 
  a2[325] := 325; 
  a2[326] := 326; 
  a2[327] := 327; 
  a2[328] := 328; 
  a2[329] := 329; 
  a2[330] := 330; 
  a2[331] := 331; 
  a2[332] := 332; 
  a2[333] := 333; 
  a2[334] := 334; 
  a2[335] := 335; 
  a2[336] := 336; 
  a2[337] := 337; 
  a2[338] := 338; 
  a2[339] := 339; 
  a2[340] := 340; 
  a2[341] := 341; 
  a2[342] := 342; 
  a2[343] := 343; 
  a2[344] := 344; 
  a2[345] := 345; 
  a2[346] := 346; 
  a2[347] := 347; 
  a2[348] := 348; 
  a2[349] := 349; 
  a2[350] := 350; 
  a2[351] := 351; 
  a2[352] := 352; 
  a2[353] := 353; 
  a2[354] := 354; 
  a2[355] := 355; 
  a2[356] := 356; 
  a2[357] := 357; 
  a2[358] := 358; 
  a2[359] := 359; 
  a2[360] := 360; 
  a2[361] := 361; 
  a2[362] := 362; 
  a2[363] := 363; 
  a2[364] := 364; 
  a2[365] := 365; 
  a2[366] := 366; 
  a2[367] := 367; 
  a2[368] := 368; 
  a2[369] := 369; 
  a2[370] := 370; 
  a2[371] := 371; 
  a2[372] := 372; 
  a2[373] := 373; 
  a2[374] := 374; 
  a2[375] := 375; 
  a2[376] := 376; 
  a2[377] := 377; 
  a2[378] := 378; 
  a2[379] := 379; 
  a2[380] := 380; 
  a2[381] := 381; 
  a2[382] := 382; 
  a2[383] := 383; 
  a2[384] := 384; 
  a2[385] := 385; 
  a2[386] := 386; 
  a2[387] := 387; 
  a2[388] := 388; 
  a2[389] := 389; 
  a2[390] := 390; 
  a2[391] := 391; 
  a2[392] := 392; 
  a2[393] := 393; 
  a2[394] := 394; 
  a2[395] := 395; 
  a2[396] := 396; 
  a2[397] := 397; 
  a2[398] := 398; 
  a2[399] := 399; 
  a2[400] := 400; 
  a2[401] := 401; 
  a2[402] := 402; 
  a2[403] := 403; 
  a2[404] := 404; 
  a2[405] := 405; 
  a2[406] := 406; 
  a2[407] := 407; 
  a2[408] := 408; 
  a2[409] := 409; 
  a2[410] := 410; 
  a2[411] := 411; 
  a2[412] := 412; 
  a2[413] := 413; 
  a2[414] := 414; 
  a2[415] := 415; 
  a2[416] := 416; 
  a2[417] := 417; 
  a2[418] := 418; 
  a2[419] := 419; 
  a2[420] := 420; 
  a2[421] := 421; 
  a2[422] := 422; 
  a2[423] := 423; 
  a2[424] := 424; 
  a2[425] := 425; 
  a2[426] := 426; 
  a2[427] := 427; 
  a2[428] := 428; 
  a2[429] := 429; 
  a2[430] := 430; 
  a2[431] := 431; 
  a2[432] := 432; 
  a2[433] := 433; 
  a2[434] := 434; 
  a2[435] := 435; 
  a2[436] := 436; 
  a2[437] := 437; 
  a2[438] := 438; 
  a2[439] := 439; 
  a2[440] := 440; 
  a2[441] := 441; 
  a2[442] := 442; 
  a2[443] := 443; 
  a2[444] := 444; 
  a2[445] := 445; 
  a2[446] := 446; 
  a2[447] := 447; 
  a2[448] := 448; 
  a2[449] := 449; 
  a2[450] := 450; 
  a2[451] := 451; 
  a2[452] := 452; 
  a2[453] := 453; 
  a2[454] := 454; 
  a2[455] := 455; 
  a2[456] := 456; 
  a2[457] := 457; 
  a2[458] := 458; 
  a2[459] := 459; 
  a2[460] := 460; 
  a2[461] := 461; 
  a2[462] := 462; 
  a2[463] := 463; 
  a2[464] := 464; 
  a2[465] := 465; 
  a2[466] := 466; 
  a2[467] := 467; 
  a2[468] := 468; 
  a2[469] := 469; 
  a2[470] := 470; 
  a2[471] := 471; 
  a2[472] := 472; 
  a2[473] := 473; 
  a2[474] := 474; 
  a2[475] := 475; 
  a2[476] := 476; 
  a2[477] := 477; 
  a2[478] := 478; 
  a2[479] := 479; 
  a2[480] := 480; 
  a2[481] := 481; 
  a2[482] := 482; 
  a2[483] := 483; 
  a2[484] := 484; 
  a2[485] := 485; 
  a2[486] := 486; 
  a2[487] := 487; 
  a2[488] := 488; 
  a2[489] := 489; 
  a2[490] := 490; 
  a2[491] := 491; 
  a2[492] := 492; 
  a2[493] := 493; 
  a2[494] := 494; 
  a2[495] := 495; 
  a2[496] := 496; 
  a2[497] := 497; 
  a2[498] := 498; 
  a2[499] := 499; 
  a2[500] := 500; 
  a2[501] := 501; 
  a2[502] := 502; 
  a2[503] := 503; 
  a2[504] := 504; 
  a2[505] := 505; 
  a2[506] := 506; 
  a2[507] := 507; 
  a2[508] := 508; 
  a2[509] := 509; 
  a2[510] := 510; 
  a2[511] := 511; 
  a2[512] := 512; 
  a2[513] := 513; 
  a2[514] := 514; 
  a2[515] := 515; 
  a2[516] := 516; 
  a2[517] := 517; 
  a2[518] := 518; 
  a2[519] := 519; 
  a2[520] := 520; 
  a2[521] := 521; 
  a2[522] := 522; 
  a2[523] := 523; 
  a2[524] := 524; 
  a2[525] := 525; 
  a2[526] := 526; 
  a2[527] := 527; 
  a2[528] := 528; 
  a2[529] := 529; 
  a2[530] := 530; 
  a2[531] := 531; 
  a2[532] := 532; 
  a2[533] := 533; 
  a2[534] := 534; 
  a2[535] := 535; 
  a2[536] := 536; 
  a2[537] := 537; 
  a2[538] := 538; 
  a2[539] := 539; 
  a2[540] := 540; 
  a2[541] := 541; 
  a2[542] := 542; 
  a2[543] := 543; 
  a2[544] := 544; 
  a2[545] := 545; 
  a2[546] := 546; 
  a2[547] := 547; 
  a2[548] := 548; 
  a2[549] := 549; 
  a2[550] := 550; 
  a2[551] := 551; 
  a2[552] := 552; 
  a2[553] := 553; 
  a2[554] := 554; 
  a2[555] := 555; 
  a2[556] := 556; 
  a2[557] := 557; 
  a2[558] := 558; 
  a2[559] := 559; 
  a2[560] := 560; 
  a2[561] := 561; 
  a2[562] := 562; 
  a2[563] := 563; 
  a2[564] := 564; 
  a2[565] := 565; 
  a2[566] := 566; 
  a2[567] := 567; 
  a2[568] := 568; 
  a2[569] := 569; 
  a2[570] := 570; 
  a2[571] := 571; 
  a2[572] := 572; 
  a2[573] := 573; 
  a2[574] := 574; 
  a2[575] := 575; 
  a2[576] := 576; 
  a2[577] := 577; 
  a2[578] := 578; 
  a2[579] := 579; 
  a2[580] := 580; 
  a2[581] := 581; 
  a2[582] := 582; 
  a2[583] := 583; 
  a2[584] := 584; 
  a2[585] := 585; 
  a2[586] := 586; 
  a2[587] := 587; 
  a2[588] := 588; 
  a2[589] := 589; 
  a2[590] := 590; 
  a2[591] := 591; 
  a2[592] := 592; 
  a2[593] := 593; 
  a2[594] := 594; 
  a2[595] := 595; 
  a2[596] := 596; 
  a2[597] := 597; 
  a2[598] := 598; 
  a2[599] := 599; 
  a2[600] := 600; 
  a2[601] := 601; 
  a2[602] := 602; 
  a2[603] := 603; 
  a2[604] := 604; 
  a2[605] := 605; 
  a2[606] := 606; 
  a2[607] := 607; 
  a2[608] := 608; 
  a2[609] := 609; 
  a2[610] := 610; 
  a2[611] := 611; 
  a2[612] := 612; 
  a2[613] := 613; 
  a2[614] := 614; 
  a2[615] := 615; 
  a2[616] := 616; 
  a2[617] := 617; 
  a2[618] := 618; 
  a2[619] := 619; 
  a2[620] := 620; 
  a2[621] := 621; 
  a2[622] := 622; 
  a2[623] := 623; 
  a2[624] := 624; 
  a2[625] := 625; 
  a2[626] := 626; 
  a2[627] := 627; 
  a2[628] := 628; 
  a2[629] := 629; 
  a2[630] := 630; 
  a2[631] := 631; 
  a2[632] := 632; 
  a2[633] := 633; 
  a2[634] := 634; 
  a2[635] := 635; 
  a2[636] := 636; 
  a2[637] := 637; 
  a2[638] := 638; 
  a2[639] := 639; 
  a2[640] := 640; 
  a2[641] := 641; 
  a2[642] := 642; 
  a2[643] := 643; 
  a2[644] := 644; 
  a2[645] := 645; 
  a2[646] := 646; 
  a2[647] := 647; 
  a2[648] := 648; 
  a2[649] := 649; 
  a2[650] := 650; 
  a2[651] := 651; 
  a2[652] := 652; 
  a2[653] := 653; 
  a2[654] := 654; 
  a2[655] := 655; 
  a2[656] := 656; 
  a2[657] := 657; 
  a2[658] := 658; 
  a2[659] := 659; 
  a2[660] := 660; 
  a2[661] := 661; 
  a2[662] := 662; 
  a2[663] := 663; 
  a2[664] := 664; 
  a2[665] := 665; 
  a2[666] := 666; 
  a2[667] := 667; 
  a2[668] := 668; 
  a2[669] := 669; 
  a2[670] := 670; 
  a2[671] := 671; 
  a2[672] := 672; 
  a2[673] := 673; 
  a2[674] := 674; 
  a2[675] := 675; 
  a2[676] := 676; 
  a2[677] := 677; 
  a2[678] := 678; 
  a2[679] := 679; 
  a2[680] := 680; 
  a2[681] := 681; 
  a2[682] := 682; 
  a2[683] := 683; 
  a2[684] := 684; 
  a2[685] := 685; 
  a2[686] := 686; 
  a2[687] := 687; 
  a2[688] := 688; 
  a2[689] := 689; 
  a2[690] := 690; 
  a2[691] := 691; 
  a2[692] := 692; 
  a2[693] := 693; 
  a2[694] := 694; 
  a2[695] := 695; 
  a2[696] := 696; 
  a2[697] := 697; 
  a2[698] := 698; 
  a2[699] := 699; 
  a2[700] := 700; 
  a2[701] := 701; 
  a2[702] := 702; 
  a2[703] := 703; 
  a2[704] := 704; 
  a2[705] := 705; 
  a2[706] := 706; 
  a2[707] := 707; 
  a2[708] := 708; 
  a2[709] := 709; 
  a2[710] := 710; 
  a2[711] := 711; 
  a2[712] := 712; 
  a2[713] := 713; 
  a2[714] := 714; 
  a2[715] := 715; 
  a2[716] := 716; 
  a2[717] := 717; 
  a2[718] := 718; 
  a2[719] := 719; 
  a2[720] := 720; 
  a2[721] := 721; 
  a2[722] := 722; 
  a2[723] := 723; 
  a2[724] := 724; 
  a2[725] := 725; 
  a2[726] := 726; 
  a2[727] := 727; 
  a2[728] := 728; 
  a2[729] := 729; 
  a2[730] := 730; 
  a2[731] := 731; 
  a2[732] := 732; 
  a2[733] := 733; 
  a2[734] := 734; 
  a2[735] := 735; 
  a2[736] := 736; 
  a2[737] := 737; 
  a2[738] := 738; 
  a2[739] := 739; 
  a2[740] := 740; 
  a2[741] := 741; 
  a2[742] := 742; 
  a2[743] := 743; 
  a2[744] := 744; 
  a2[745] := 745; 
  a2[746] := 746; 
  a2[747] := 747; 
  a2[748] := 748; 
  a2[749] := 749; 
  a2[750] := 750; 
  a2[751] := 751; 
  a2[752] := 752; 
  a2[753] := 753; 
  a2[754] := 754; 
  a2[755] := 755; 
  a2[756] := 756; 
  a2[757] := 757; 
  a2[758] := 758; 
  a2[759] := 759; 
  a2[760] := 760; 
  a2[761] := 761; 
  a2[762] := 762; 
  a2[763] := 763; 
  a2[764] := 764; 
  a2[765] := 765; 
  a2[766] := 766; 
  a2[767] := 767; 
  a2[768] := 768; 
  a2[769] := 769; 
  a2[770] := 770; 
  a2[771] := 771; 
  a2[772] := 772; 
  a2[773] := 773; 
  a2[774] := 774; 
  a2[775] := 775; 
  a2[776] := 776; 
  a2[777] := 777; 
  a2[778] := 778; 
  a2[779] := 779; 
  a2[780] := 780; 
  a2[781] := 781; 
  a2[782] := 782; 
  a2[783] := 783; 
  a2[784] := 784; 
  a2[785] := 785; 
  a2[786] := 786; 
  a2[787] := 787; 
  a2[788] := 788; 
  a2[789] := 789; 
  a2[790] := 790; 
  a2[791] := 791; 
  a2[792] := 792; 
  a2[793] := 793; 
  a2[794] := 794; 
  a2[795] := 795; 
  a2[796] := 796; 
  a2[797] := 797; 
  a2[798] := 798; 
  a2[799] := 799; 
  a2[800] := 800; 
  a2[801] := 801; 
  a2[802] := 802; 
  a2[803] := 803; 
  a2[804] := 804; 
  a2[805] := 805; 
  a2[806] := 806; 
  a2[807] := 807; 
  a2[808] := 808; 
  a2[809] := 809; 
  a2[810] := 810; 
  a2[811] := 811; 
  a2[812] := 812; 
  a2[813] := 813; 
  a2[814] := 814; 
  a2[815] := 815; 
  a2[816] := 816; 
  a2[817] := 817; 
  a2[818] := 818; 
  a2[819] := 819; 
  a2[820] := 820; 
  a2[821] := 821; 
  a2[822] := 822; 
  a2[823] := 823; 
  a2[824] := 824; 
  a2[825] := 825; 
  a2[826] := 826; 
  a2[827] := 827; 
  a2[828] := 828; 
  a2[829] := 829; 
  a2[830] := 830; 
  a2[831] := 831; 
  a2[832] := 832; 
  a2[833] := 833; 
  a2[834] := 834; 
  a2[835] := 835; 
  a2[836] := 836; 
  a2[837] := 837; 
  a2[838] := 838; 
  a2[839] := 839; 
  a2[840] := 840; 
  a2[841] := 841; 
  a2[842] := 842; 
  a2[843] := 843; 
  a2[844] := 844; 
  a2[845] := 845; 
  a2[846] := 846; 
  a2[847] := 847; 
  a2[848] := 848; 
  a2[849] := 849; 
  a2[850] := 850; 
  a2[851] := 851; 
  a2[852] := 852; 
  a2[853] := 853; 
  a2[854] := 854; 
  a2[855] := 855; 
  a2[856] := 856; 
  a2[857] := 857; 
  a2[858] := 858; 
  a2[859] := 859; 
  a2[860] := 860; 
  a2[861] := 861; 
  a2[862] := 862; 
  a2[863] := 863; 
  a2[864] := 864; 
  a2[865] := 865; 
  a2[866] := 866; 
  a2[867] := 867; 
  a2[868] := 868; 
  a2[869] := 869; 
  a2[870] := 870; 
  a2[871] := 871; 
  a2[872] := 872; 
  a2[873] := 873; 
  a2[874] := 874; 
  a2[875] := 875; 
  a2[876] := 876; 
  a2[877] := 877; 
  a2[878] := 878; 
  a2[879] := 879; 
  a2[880] := 880; 
  a2[881] := 881; 
  a2[882] := 882; 
  a2[883] := 883; 
  a2[884] := 884; 
  a2[885] := 885; 
  a2[886] := 886; 
  a2[887] := 887; 
  a2[888] := 888; 
  a2[889] := 889; 
  a2[890] := 890; 
  a2[891] := 891; 
  a2[892] := 892; 
  a2[893] := 893; 
  a2[894] := 894; 
  a2[895] := 895; 
  a2[896] := 896; 
  a2[897] := 897; 
  a2[898] := 898; 
  a2[899] := 899; 
  a2[900] := 900; 
  a2[901] := 901; 
  a2[902] := 902; 
  a2[903] := 903; 
  a2[904] := 904; 
  a2[905] := 905; 
  a2[906] := 906; 
  a2[907] := 907; 
  a2[908] := 908; 
  a2[909] := 909; 
  a2[910] := 910; 
  a2[911] := 911; 
  a2[912] := 912; 
  a2[913] := 913; 
  a2[914] := 914; 
  a2[915] := 915; 
  a2[916] := 916; 
  a2[917] := 917; 
  a2[918] := 918; 
  a2[919] := 919; 
  a2[920] := 920; 
  a2[921] := 921; 
  a2[922] := 922; 
  a2[923] := 923; 
  a2[924] := 924; 
  a2[925] := 925; 
  a2[926] := 926; 
  a2[927] := 927; 
  a2[928] := 928; 
  a2[929] := 929; 
  a2[930] := 930; 
  a2[931] := 931; 
  a2[932] := 932; 
  a2[933] := 933; 
  a2[934] := 934; 
  a2[935] := 935; 
  a2[936] := 936; 
  a2[937] := 937; 
  a2[938] := 938; 
  a2[939] := 939; 
  a2[940] := 940; 
  a2[941] := 941; 
  a2[942] := 942; 
  a2[943] := 943; 
  a2[944] := 944; 
  a2[945] := 945; 
  a2[946] := 946; 
  a2[947] := 947; 
  a2[948] := 948; 
  a2[949] := 949; 
  a2[950] := 950; 
  a2[951] := 951; 
  a2[952] := 952; 
  a2[953] := 953; 
  a2[954] := 954; 
  a2[955] := 955; 
  a2[956] := 956; 
  a2[957] := 957; 
  a2[958] := 958; 
  a2[959] := 959; 
  a2[960] := 960; 
  a2[961] := 961; 
  a2[962] := 962; 
  a2[963] := 963; 
  a2[964] := 964; 
  a2[965] := 965; 
  a2[966] := 966; 
  a2[967] := 967; 
  a2[968] := 968; 
  a2[969] := 969; 
  a2[970] := 970; 
  a2[971] := 971; 
  a2[972] := 972; 
  a2[973] := 973; 
  a2[974] := 974; 
  a2[975] := 975; 
  a2[976] := 976; 
  a2[977] := 977; 
  a2[978] := 978; 
  a2[979] := 979; 
  a2[980] := 980; 
  a2[981] := 981; 
  a2[982] := 982; 
  a2[983] := 983; 
  a2[984] := 984; 
  a2[985] := 985; 
  a2[986] := 986; 
  a2[987] := 987; 
  a2[988] := 988; 
  a2[989] := 989; 
  a2[990] := 990; 
  a2[991] := 991; 
  a2[992] := 992; 
  a2[993] := 993; 
  a2[994] := 994; 
  a2[995] := 995; 
  a2[996] := 996; 
  a2[997] := 997; 
  a2[998] := 998; 
  a2[999] := 999; 
END Init;

END Quiz.

cfbsoftware
Site Admin
Posts: 525
Joined: Fri Dec 31, 2010 12:30 pm
Contact:

Re: Oberon Competition - Win a $US50 Amazon Gift Voucher

Post by cfbsoftware » Sat Dec 06, 2014 12:06 pm

Not exactly what I had in mind ;)

If nobody can beat Alex's time there will be a second prize of a $US50 Amazon Gift Voucher awarded to the person who submits the fastest module which as well as being faster than the original is also no bigger (code size) than the original.

I have also had to amend the rules - see below for details.

Alexander Shiryaev
Posts: 17
Joined: Mon Apr 04, 2011 7:20 pm
Location: Russia
Contact:

Re: Oberon Competition - Win a $US50 Amazon Gift Voucher

Post by Alexander Shiryaev » Sat Dec 06, 2014 5:04 pm

Code: Select all

MODULE Quiz;

  VAR a1*, a2*: ARRAY 1000 OF INTEGER;
      
  PROCEDURE* Init*;
    VAR i: INTEGER;
  BEGIN i := 1000;
    REPEAT DEC(i);
      a1[i] := i;
      a2[i] := i
    UNTIL i = 0
  END Init;

END Quiz.

pahihu
Posts: 1
Joined: Sun Dec 07, 2014 7:45 pm

Re: Oberon Competition - Win a $US50 Amazon Gift Voucher

Post by pahihu » Mon Dec 08, 2014 8:43 am

MODULE Quiz;

VAR
a1*, a2*: ARRAY 1000 OF INTEGER;

PROCEDURE* Init*;
CONST N = LEN(a1) - 1;
VAR i: INTEGER;
BEGIN
FOR i := 0 TO N DO
a1 := i;
a2 := i
END
END Init;

dsar
Posts: 8
Joined: Wed Oct 10, 2012 9:12 pm

Re: Oberon Competition - Win a $US50 Amazon Gift Voucher

Post by dsar » Fri Dec 12, 2014 9:48 am

I'm not sure if I'm qualified to partecipate because I don't have Astrobe and neither a platform to test the code.

Code: Select all

MODULE Quiz;

VAR
  a1*, a2*, init: ARRAY 1000 OF INTEGER;
  i: INTEGER;

PROCEDURE Init*;
BEGIN
  a1 := init;
  a2 := init
END Init;

BEGIN
  FOR i := 0 TO LEN(init) - 1 DO
    init[i] := i
  END
END Quiz.
The idea is to have an already initialized array (initialized during the initialization of the program), after that the other ones are initialized with a simple array assignment (that in ARM is efficient and fast)

cfbsoftware
Site Admin
Posts: 525
Joined: Fri Dec 31, 2010 12:30 pm
Contact:

Re: Oberon Competition - Win a $US50 Amazon Gift Voucher

Post by cfbsoftware » Thu Jan 01, 2015 11:37 am

The competition has now ended. For comparison purposes all of the entries were compiled using Astrobe for Cortex-M3 v5.2 and executed on an LPC1769 running @120MHz. The resulting times (in uSecs) and the code size (in bytes) for each of the entries in order of submission are:

Code: Select all

                            
Submitted by                Time              Size
Original                     695               160
Iljin                        115             24536
Shiryaev                     167                64
Pahihu                       194                72
Dsar                         167               188
Consequently, congratulations go to the two winners: AlexIljin (fastest) and Alexander Shiryaev (fastest/smallest). They will be contacted shortly to arrange delivery of their prizes.

However, there is at least one better solution in the fastest/smallest category: 126 uSecs/92 bytes. It takes advantage of the fact that it is more efficient to access array variables in leaf procedures via parameters rather than globals:

Code: Select all

MODULE Quiz;

  VAR a1*, a2*: ARRAY 1000 OF INTEGER;
      
  PROCEDURE* Run(VAR a1, a2: ARRAY OF INTEGER);
    VAR i: INTEGER;
  BEGIN i := LEN(a1);
    REPEAT DEC(i);
      a1[i] := i;
      a2[i] := i
    UNTIL i = 0
  END Run;

  PROCEDURE Init*;
  BEGIN
    Run(a1, a2);
  END Init;
  
END Quiz.

Locked