Problem p02797 (python)

Fixed submission:
N,K,S = map(int, input().split())

sa = N-K+1
a = [1 for i in range(N)]
if S-sa+1 >0:
        
    a[0] = S - sa + 1

    for i in range(1,sa):
        if i < N:
    
            a[i] = 1
    j = 0
    for i in range(sa,N):
        a[i] = a[j]

        j +=1
        j %= sa

    for x in a:
        print(x, end = " ")


else:
    for i in range(K):
        a[i] = S
    if S != 10**9:    
        for i in range(K,N):
            a[i] = 10**9
    else:
        for i in range(K,N):
            a[i] == 10**9 -1
    for x in a:
        print(x, end = " ")

Buggy submission (verdict: Runtime Error):
N,K,S = map(int, input().split())

sa = N-K+1
a = [1 for i in range(N)]
if S-sa+1 >0:
        
    a[0] = S - sa + 1

    for i in range(1,sa):
        a[i] = 1
    j = 0
    for i in range(sa,N):
        a[i] = a[j]

        j +=1
        if sa != 0:
            j %= sa

    for x in a:
        print(x, end = " ")


else:
    for i in range(K):
        a[i] = S
    if S != 10**9:    
        for i in range(K,N):
            a[i] = 10**9
    else:
        for i in range(K,N):
            a[i] == 10**9 -1
    for x in a:
        print(x, end = " ")

Buggy submission (verdict: Runtime Error):
N,K,S = map(int, input().split())

sa = N-K+1
a = [1 for i in range(N)]
if S-sa+1 >0:
        
    a[0] = S - sa + 1

    for i in range(1,sa):
        a[i] = 1
    j = 0
    for i in range(sa,N):
        a[i] = a[j]

        j +=1
        if sa != 0:
            j %= sa

    for x in a:
        print(x, end = " ")


else:
    for i in range(K):
        a[i] = S
    if S != 10**9:    
        for i in range(K,N):
            a[i] = 10**9
    else:
        for i in range(K,N):
            a[i] == 10**9 -1
    for x in a:
        print(x, end = " ")

Buggy submission (verdict: Runtime Error):
N,K,S = map(int, input().split())

sa = N-K+1
a = [1 for i in range(N)]
if S-sa+1 >0:
        
    a[0] = S - sa + 1

    for i in range(1,sa):
        a[i] = 1
    j = 0
    for i in range(sa,N):
        a[i] = a[j]

        j +=1
        j %= sa

    for x in a:
        print(x, end = " ")


else:
    for i in range(K):
        a[i] = S
    if S != 10**9:    
        for i in range(K,N):
            a[i] = 10**9
    else:
        for i in range(K,N):
            a[i] == 10**9 -1
    for x in a:
        print(x, end = " ")

Buggy submission (verdict: Runtime Error):
N,K,S = map(int, input().split())

sa = N-K+1
a = [1 for i in range(N)]

if K == 0:
    if S == 10**9:
        for i in range(N):
            a[i] = 10**9-1
    else:
        for i in range(N):
            a[i] == 10**9
    for x in a:
        print(a, end=" ")
elif S-sa+1 >0:
        
    a[0] = S - sa + 1

    for i in range(1,sa):
        a[i] = 1
    j = 0
    for i in range(sa,N):
        a[i] = a[j]

        j +=1
        j %= sa

    for x in a:
        print(x, end = " ")


else:
    for i in range(K):
        a[i] = S
    if S != 10**9:    
        for i in range(K,N):
            a[i] = 10**9
    else:
        for i in range(K,N):
            a[i] == 10**9 -1
    for x in a:
        print(x, end = " ")

Buggy submission (verdict: Runtime Error):
N,K,S = map(int, input().split())

sa = N-K+1
a = [1 for i in range(N)]

if S-sa+1 >0:
        
    a[0] = S - sa + 1

    for i in range(1,sa):
        a[i] = 1
    j = 0
    for i in range(sa,N):
        a[i] = a[j]

        j +=1
        j %= sa

    for x in a:
        print(x, end = " ")
else:
    for i in range(K):
        a[i] = S
    if S != 10**9:    
        for i in range(K,N):
            a[i] = 10**9
    else:
        for i in range(K,N):
            a[i] == 10**9 -1
    for x in a:
        print(x, end = " ")

Buggy submission (verdict: Runtime Error):
N,K,S = map(int, input().split())

sa = N-K+1
a = [1 for i in range(N)]

if S-sa+1 >0:
        
    a[0] = S - sa + 1

    for i in range(1,sa):
        a[i] = 1
    j = 0
    for i in range(sa,N):
        a[i] = a[j]

        j +=1
        j %= 3

    for x in a:
        print(x, end = " ")
else:
    for i in range(K):
        a[i] = S
    if S != 10**9:    
        for i in range(K,N):
            a[i] = 10**9
    else:
        for i in range(K,N):
            a[i] == 10**9 -1
    for x in a:
        print(x, end = " ")

Buggy submission (verdict: Runtime Error):
N,K,S = map(int, input().split())

sa = N-K+1
a = [1 for i in range(N)]

if S-sa+1 >0:
        
    a[0] = S - sa + 1

    for i in range(1,sa):
        a[i] = 1
    j = 0
    for i in range(sa,N):
        a[i] = a[j]

        j +=1
        j %= 3

    for x in a:
        print(x, end = " ")
else:
    for i in range(K):
        a[i] = S    
    for i in range(K,N):
        a[i] = 10**9
    for x in a:
        print(x, end = " ")

Buggy submission (verdict: Runtime Error):
N,K,S = map(int, input().split())

sa = N-K+1
a = [1 for i in range(N)]

if S-sa+1 >0:
        
    a[0] = S - sa + 1

    for i in range(1,sa):
        a[i] = 1
    j = 0
    for i in range(sa,N):
        a[i] = a[j]

        j +=1
        j %= 3

    for x in a:
        print(x, end = " ")
else:
    for i in range(K):
        a[i] = S
    if S == 1:
        for i in range(K,N):
            a[i] = 2
    for x in a:
        print(x, end = " ")

Buggy submission (verdict: Runtime Error):
N,K,S = map(int, input().split())

sa = N-K+1
a = [1 for i in range(N)]

if S-sa+1 >0:
        
    a[0] = S - sa + 1

    for i in range(1,sa):
        a[i] = 1
    j = 0
    for i in range(sa,N):
        a[i] = a[j]

        j +=1
        j %= 3

    for x in a:
        print(x, end = " ")
else:
    for i in range(K):
        a[i] = S
    
    for x in a:
        print(x, end = " ")