#include <iostream>
#include <cassert>
struct day_of_year
{
day_of_year( int d = 1 ) : day(d) {}
operator int() const { return day ; }
static constexpr int MAX = 365 ;
day_of_year& operator++ () { ++day ; if( day > MAX ) day = 1 ; return *this ; }
day_of_year operator++ (int) { day_of_year temp = *this ; ++*this ; return temp ; }
int day ;
};
int main()
{
day_of_year d = 350 ;
while( d > 1 ) std::cout << d++ << '\n' ;
assert( d == 1 ) ;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y2Fzc2VydD4KCnN0cnVjdCBkYXlfb2ZfeWVhcgp7CiAgICBkYXlfb2ZfeWVhciggaW50IGQgPSAxICkgOiBkYXkoZCkge30KCiAgICBvcGVyYXRvciBpbnQoKSBjb25zdCB7IHJldHVybiBkYXkgOyB9CgogICAgc3RhdGljIGNvbnN0ZXhwciBpbnQgTUFYID0gMzY1IDsKCiAgICBkYXlfb2ZfeWVhciYgb3BlcmF0b3IrKyAoKSB7ICsrZGF5IDsgaWYoIGRheSA+IE1BWCApIGRheSA9IDEgOyByZXR1cm4gKnRoaXMgOyB9CiAgICBkYXlfb2ZfeWVhciBvcGVyYXRvcisrIChpbnQpIHsgZGF5X29mX3llYXIgdGVtcCA9ICp0aGlzIDsgKysqdGhpcyA7IHJldHVybiB0ZW1wIDsgfQoKICAgIGludCBkYXkgOwp9OwoKaW50IG1haW4oKQp7CiAgICBkYXlfb2ZfeWVhciBkID0gMzUwIDsKICAgIHdoaWxlKCAgZCA+IDEgKSAgc3RkOjpjb3V0IDw8IGQrKyA8PCAnXG4nIDsKICAgIGFzc2VydCggZCA9PSAxICkgOwp9Cg==