Submission details
Task:Lukujono
Sender:Toitsu
Submission time:2025-10-28 13:42:01 +0200
Language:text
Status:READY
Result:16
Feedback
groupverdictscore
#1ACCEPTED16
Test results
testverdicttimescore
#1ACCEPTED0.00 s16details

Code

# Constant that is used for the multiplication
INCREASE K INCREASE K

# Used to detect when to stop loop
INCREASE L

# Create a big number (10240) to loop many times
INCREASE H INCREASE H INCREASE H INCREASE H INCREASE H INCREASE H INCREASE H INCREASE H INCREASE H INCREASE H
REPEAT H TIMES (
    REPEAT H TIMES (
        INCREASE H
    )
)

# Print the initial value
PRINT X

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

# Start the main loop
REPEAT L TIMES (
    REPEAT H TIMES (
        REPEAT L TIMES (
            # Clear variables before re-use
            CLEAR A CLEAR B CLEAR C CLEAR D CLEAR E CLEAR O CLEAR V CLEAR Y

            # These need to both be 1 for the loops to work
            INCREASE O INCREASE B

            # Make a copy of X and store it in Y
            REPEAT X TIMES (
                INCREASE Y
            )

            # Check if X is odd or even, and store the halved value of X in V
            REPEAT X TIMES (
                REPEAT A TIMES (
                    INCREASE V
                    INCREASE C
                    CLEAR A
                )
                REPEAT B TIMES (
                    INCREASE A
                    CLEAR B
                )
                REPEAT C TIMES (
                    INCREASE B
                    CLEAR C
                )
            )
            
            # This only runs if X was odd because in that case A is 1 instead of 0
            REPEAT A TIMES (
                # Clear the value of 1 so the "Set X to the halved value" loop doesn't run
                CLEAR O

                # Revert X back to original value
                CLEAR X
                REPEAT Y TIMES (
                    INCREASE X
                )

                # Multiply X by 3 and add 1
                REPEAT K TIMES (
                    REPEAT Y TIMES (
                        INCREASE X
                    )
                )
                INCREASE X
            )


            # Set X to the halved value if X was even at the beginning
            REPEAT O TIMES (
                CLEAR X
                REPEAT V TIMES (
                    INCREASE X
                )
            )

            # Print the resulting value
            PRINT X

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

Test details

Test 1 (public)

Verdict: ACCEPTED

input
(empty)

correct output
(empty)

user output
# Constant that is used for th...

Feedback: 168 tests processed (command limit exceeded)