#include <stdio.h>
#include <stdarg.h>
#include <limits.h>
int max(int count, ...)
{
int max = INT_MIN, test;
va_list values;
va_start(values, count);
for(int i = 0; i < count; ++i)
{
test = va_arg(values, int);
if(test > max)
{
max = test;
}
}
va_end(values);
return max;
}
int main()
{
printf("%d", max(5,1,6,-31,23,24));
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRhcmcuaD4KI2luY2x1ZGUgPGxpbWl0cy5oPgoKaW50IG1heChpbnQgY291bnQsIC4uLikKewogICAgaW50IG1heCA9IElOVF9NSU4sIHRlc3Q7CgogICAgdmFfbGlzdCB2YWx1ZXM7CiAgICB2YV9zdGFydCh2YWx1ZXMsIGNvdW50KTsKICAgIGZvcihpbnQgaSA9IDA7IGkgPCBjb3VudDsgKytpKQogICAgewogICAgICAgIHRlc3QgPSB2YV9hcmcodmFsdWVzLCBpbnQpOwogICAgICAgIGlmKHRlc3QgPiBtYXgpCiAgICAgICAgewogICAgICAgICAgICBtYXggPSB0ZXN0OwogICAgICAgIH0KICAgIH0KICAgIHZhX2VuZCh2YWx1ZXMpOwogICAgcmV0dXJuIG1heDsKfQoKaW50IG1haW4oKQp7CiAgICBwcmludGYoIiVkIiwgbWF4KDUsMSw2LC0zMSwyMywyNCkpOwogICAgcmV0dXJuIDA7Cn0=