#include <stdio.h>
int *A, stkTop;
int stkFunc (int opcode, int val)
{ static int size=2, stkTop=1;
switch (opcode)
{ case -1: size = val; break;
case 0: if (stkTop < size) A[++stkTop] = ++val; break;
default: if (stkTop <= size) return A[--stkTop]; }
return 1; }
int main()
{ int B[20]; A=B; stkTop = -2;
stkFunc(-1, 6);
stkFunc(0, 3);
stkFunc(0, 8);
printf("%d\n", stkFunc
(3, 2) + stkFunc
(5, 8)); }
I2luY2x1ZGUgPHN0ZGlvLmg+CmludCAqQSwgc3RrVG9wOwppbnQgc3RrRnVuYyAoaW50IG9wY29kZSwgaW50IHZhbCkKewkgICAJc3RhdGljIGludCBzaXplPTIsIHN0a1RvcD0xOwogICAJCXN3aXRjaCAob3Bjb2RlKQogICAJCXsJCWNhc2UgLTE6IHNpemUgPSB2YWw7IGJyZWFrOwogICAgICAJCQkJY2FzZSAwOiBpZiAoc3RrVG9wIDwgc2l6ZSkgQVsrK3N0a1RvcF0gPSArK3ZhbDsgYnJlYWs7CiAgICAgIAkJCQlkZWZhdWx0OiBpZiAoc3RrVG9wIDw9IHNpemUpIHJldHVybiBBWy0tc3RrVG9wXTsgICAgfQogICByZXR1cm4gMTsgfQppbnQgbWFpbigpCnsJICAgCWludCBCWzIwXTsgQT1COyBzdGtUb3AgPSAtMjsKICAgCQlzdGtGdW5jKC0xLCA2KTsKICAgCQlzdGtGdW5jKDAsIDMpOwogICAJCXN0a0Z1bmMoMCwgOCk7CiAgIAkJcHJpbnRmKCIlZFxuIiwgc3RrRnVuYyAoMywgMikgKyBzdGtGdW5jICg1LCA4KSk7CX0K