Problem p02797 (python)

Fixed submission:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n, k, s = MAP()
 
if s == 10 ** 9:
  a = 1
else:
  a = 10 ** 9

ans = [s] * k + [a] * (n - k)
 
print(*ans)

Buggy submission (verdict: Runtime Error):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n, k, s = MAP()

# A = [i for i in range(1, s+1)]
# print(A)
# add = []
# A = [i for i in range(1, 10**9+1)]
# for i in range(1, n+1):
#   for j in range(i, n+1):
# のびしろ，これからこれだけのばすよ

L = [ s ] * k
# print(c)

one = []
see = 0
while n-len(L)-len(one) != 0:
  # for i in range(c):  
  while L[see] == 1:
    see +=1
  #   L.insert(0, 1)
  L[see] = L[see] - 1
  one.append(1)
# print(one)

a = one + L
#ans = [1, 2, 3, 4]
print(*a)

Buggy submission (verdict: Runtime Error):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n, k, s = MAP()

# A = [i for i in range(1, s+1)]
# print(A)
# add = []
# A = [i for i in range(1, 10**9+1)]
# for i in range(1, n+1):
#   for j in range(i, n+1):
# のびしろ，これからこれだけのばすよ

L = [ s ] * k
# print(c)

one = []
see = 0
while n-len(L)-len(one) != 0:
  # for i in range(c):  
  #   L.insert(0, 1)
  L[see] = L[see] - 1
  one.append(1)
  if L[see] == 1:
    see +=1
# print(one)

a = one + L
#ans = [1, 2, 3, 4]
print(*a)

Buggy submission (verdict: Runtime Error):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n, k, s = MAP()

# A = [i for i in range(1, s+1)]
# print(A)
# add = []
# A = [i for i in range(1, 10**9+1)]
# for i in range(1, n+1):
#   for j in range(i, n+1):

L = [ s ] * k
c = n-len(L)
# print(c)
L[0] = L[0] - c
for i in range(c):  
  L.insert(0, 1)
  
# print(L)

#ans = [1, 2, 3, 4]
print(*L)