Submission details
Task:Lukujono
Sender:Wiita
Submission time:2025-10-31 09:44:17 +0200
Language:text
Status:READY
Result:43
Feedback
groupverdictscore
#1ACCEPTED43
Test results
testverdicttimescore
#1ACCEPTED0.00 s43details

Code

# J = 4
INCREASE J
INCREASE J
INCREASE J
INCREASE J

# I = 174 (maximum needed is 178)
REPEAT J TIMES ( 
    INCREASE J
    REPEAT J TIMES ( 
        REPEAT J TIMES ( 
            INCREASE I 
        ) 
    ) 
)

# add the remaining 4
INCREASE I
INCREASE I
INCREASE I
INCREASE I

INCREASE L # Set L to 1 to initiate

REPEAT I TIMES ( 

    # Set Q to 1 to enable calculating
    CLEAR Q
    INCREASE Q


    REPEAT P TIMES ( CLEAR Q )

    # Stop calculating if Q = 0
    REPEAT Q TIMES ( 
        
        # Switch between using X and C when dividing
        REPEAT O TIMES ( 

        PRINT C 

        # Clear variables for calculation
        CLEAR A
        CLEAR T
        CLEAR X


        # Parity check loop determines if X is even or odd
        # After X iterations:
        #   A = 1 if X is odd, 0 if even
        #   T = A (Helper variable)
        #   X = C // 2
        REPEAT C TIMES ( 
        
            INCREASE T

            # Increase X if A = 1 and set T to 0
            REPEAT A TIMES ( 
                CLEAR T
                CLEAR A
                INCREASE X
            )

            # Increase A if T = 1
            REPEAT T TIMES ( 
                INCREASE A 
            )
        )


        # Check if C = 1, E = 1 
        CLEAR E
        # Only check if C = 1 if C is odd
        REPEAT A TIMES (
            INCREASE E

            REPEAT X TIMES ( CLEAR E ) # For C = 1, X = 0 so E = 1 | for C > 1, X > 0 so E = 0

            REPEAT E TIMES ( INCREASE P ) # If C = 1, set P = 1 to stop future calculation
        )


        # Decide whether to update X: Q = 1 unless C = 1
        CLEAR Q
        INCREASE Q

        REPEAT E TIMES ( CLEAR Q ) # Decide whether to update X: Q = 1 unless C = 1

        # if Q = 1 update C to next Collatz number
        REPEAT Q TIMES ( 

            # odd C: 3 * C + 1
            REPEAT A TIMES ( 
                CLEAR X
                REPEAT C TIMES (         
                    INCREASE X      
                    INCREASE C  
                    INCREASE C
                )
                INCREASE C  # Add 1 to make 3 * X + 1
                
                PRINT C

                CLEAR H
                CLEAR N    

                # Print the next halved number already
                # Increase X by 50%
                REPEAT X TIMES 
                (
                    INCREASE N

                    # Increase X if H = 1 and set N to 0
                    REPEAT H TIMES ( 
                        CLEAR N
                        CLEAR H
                    )

                    # Increase A if N = 1
                    REPEAT N TIMES ( 
                        INCREASE X
                        INCREASE H 
                    )
                )
            )

            # Also run if C is odd to switch to X
            # even C: X = C // 2
            CLEAR O # Set O to 0
            INCREASE L       
        )

        )
        

        #___________________

        # Switch between using X and C when dividing
        REPEAT L TIMES (

        PRINT X

        # Clear variables for calculation
        CLEAR A
        CLEAR T
        CLEAR C


        # Parity check loop determines if X is even or odd
        # After X iterations:
        #   A = 1 if X is odd, 0 if even
        #   T = A (Helper variable)
        #   C = X // 2
        REPEAT X TIMES ( 
        
            INCREASE T

            # Increase C if A = 1 and set T to 0
            REPEAT A TIMES ( 
                CLEAR T
                CLEAR A
                INCREASE C
            )

            # Increase A if T = 1
            REPEAT T TIMES ( 
                INCREASE A 
            )
        )


        # Only check if X = 1 if X is odd
        CLEAR E

        INCREASE E

        REPEAT C TIMES ( CLEAR E ) # If X = 1, C = 0 so E = 1 | If X > 1, C > 0 so E = 0

        REPEAT E TIMES ( INCREASE P ) # If X = 1, set P = 1 to stop future calculation



        # Decide whether to update X: Q = 1 unless X = 1
        CLEAR Q
        INCREASE Q

        REPEAT E TIMES ( CLEAR Q ) # Decide whether to update X: Q = 1 unless X = 1

        # if Q = 1 update X to next Collatz number
        REPEAT Q TIMES ( 

            # odd X: 3 * X + 1
            REPEAT A TIMES ( 
                CLEAR C
                REPEAT X TIMES (  
                    INCREASE C               
                    INCREASE X
                    INCREASE X
                )
                INCREASE X  # Add 1 to make 3 * X + 1
                PRINT X

                CLEAR N
                CLEAR H

                # Print the next number already
                # Increase C by 50%
                REPEAT C TIMES 
                (
                    INCREASE N

                    REPEAT H TIMES ( 
                        CLEAR N
                        CLEAR H
                    )

                    REPEAT N TIMES ( 
                        INCREASE C
                        INCREASE H 
                    )
                )
            )

            # Also run if X is odd to switch to C
            # even X: C = X // 2
            CLEAR L
            INCREASE O # Set O to 1
        )
        )
    )
)

Test details

Test 1 (public)

Verdict: ACCEPTED

input
(empty)

correct output
(empty)

user output
# J = 4
INCREASE J
INCREASE J
INCREASE J
INCREASE J
...

Feedback: 435 tests processed (command limit exceeded)