Submission details
Task:Lukujono
Sender:Toitsu
Submission time:2025-10-30 21:26:00 +0200
Language:text
Status:READY
Result:46
Feedback
groupverdictscore
#1ACCEPTED46
Test results
testverdicttimescore
#1ACCEPTED0.00 s46details

Code

# 357293 commands with 1000 as starting number

# Used to detect when to stop loop
INCREASE L

# Create a big number (128) to loop many times (number 871 takes the most steps: 178 (but the odd step in our loop computes 2 values so we dont need to loop 178 times))
INCREASE Q INCREASE Q
REPEAT Q TIMES ( INCREASE Q INCREASE Q INCREASE Q )
REPEAT Q TIMES ( INCREASE Q INCREASE Q INCREASE Q )
REPEAT Q TIMES ( INCREASE Q INCREASE Q INCREASE Q )

# Print the initial value
PRINT X

# Stop if X is 1 initially
REPEAT X TIMES (
    CLEAR L
    REPEAT F TIMES (
        INCREASE L
        CLEAR F
    )
    INCREASE F
)

# Start the main loop
REPEAT Q TIMES (
    REPEAT L TIMES (
        # Clear variables before re-use
        CLEAR T CLEAR V

        # These needs to be 1 for the odd-even loop to work
        INCREASE T
        INCREASE O

        # Check if X is odd or even, and save the halved value of X in V
        REPEAT X TIMES (
            INCREASE B

            REPEAT T TIMES (
                CLEAR B
                CLEAR T
            )

            REPEAT B TIMES (
                INCREASE V
                INCREASE T
            )
        )

        # This only runs if X was even because in that case T is 1 instead of 0
        REPEAT T TIMES (
            # If X was even, set X to the halved value stored in V
            CLEAR X
            REPEAT V TIMES (
                INCREASE X
            )

            # Print the resulting value
            PRINT X

            # If X was even, dont run the odd-loop
            CLEAR O
        )

        # Run only if even-loop wasn't ran (so X was odd)
        REPEAT O TIMES (
            # Multiply X by 3 and add 1
            REPEAT X TIMES (
                INCREASE X INCREASE X
            )
            INCREASE X

            # Print the resulting value
            PRINT X
            
            # We dont need to check if X is 1 because it can never be 1 in this situation

            # Now we "skip" one step and directly compute the next value

            # Multiply X by 3 and add 2
            CLEAR X
            REPEAT V TIMES (
                INCREASE X INCREASE X INCREASE X
            )
            INCREASE X INCREASE X

            # Print the resulting value
            PRINT X

            # Clear the odd-even flag
            CLEAR O
        )

        # Stop if X is 1 (only do the check if X was even to save computations))
        REPEAT T TIMES (
            CLEAR F
            REPEAT X TIMES (
                CLEAR L
                REPEAT F TIMES (
                    INCREASE L
                    CLEAR F
                )
                INCREASE F
            )
        )
    )
)

Test details

Test 1 (public)

Verdict: ACCEPTED

input
(empty)

correct output
(empty)

user output
# 357293 commands with 1000 as...

Feedback: 462 tests processed (command limit exceeded)