#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int moznost, n;
  scanf("%d%d", &moznost, &n);
  if (n > 0) {
    if (moznost == 1) {
      int prej;
      int c = 1;
      scanf("%d", &prej);
      for (int i = 0; i < n - 1; ++i) {
        int t;
        scanf("%d", &t);
        if (t != prej) {
          printf("%d %d ", c, prej);
          prej = t;
          c = 1;
        } else {
          c++;
        }
      }
      printf("%d %d\n", c, prej);
    } else {
      for (int i = 0; i < n; ++i) {
        int kaj, koliko;
        scanf("%d%d", &koliko, &kaj);
        for (int j = 0; j < koliko; ++j) {
          printf("%d ", kaj);
        }
      }
      printf("\n");
    }
  } else {
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
jle    1284 <main+0x164>
cmpl   $0x1,-0x8(%rbp)
jne    1203 <main+0xe3>
movl   $0x1,-0x14(%rbp)
lea    0xe9b(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11ea <main+0xca>
lea    0xe71(%rip),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     11ce <main+0xae>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
jmp    11d7 <main+0xb7>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11dc <main+0xbc>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1179 <main+0x59>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe15(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    127f <main+0x15f>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1271 <main+0x151>
lea    0xde3(%rip),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x24(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    125e <main+0x13e>
mov    -0x24(%rbp),%esi
lea    0xdbf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1233 <main+0x113>
jmp    1263 <main+0x143>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    120a <main+0xea>
lea    0xd99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1292 <main+0x172>
lea    0xd86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xebb(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x0,0x10(%rsp)
jle    1269 <main+0x139>
cmpl   $0x1,0x14(%rsp)
jne    11fb <main+0xcb>
lea    0xe8f(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x1,0x10(%rsp)
jle    1275 <main+0x145>
mov    $0x1,%ebx
lea    0xe6c(%rip),%r14
lea    0x8(%rsp),%r15
lea    0xe63(%rip),%r12
xor    %ebp,%ebp
jmp    11c5 <main+0x95>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%ebx
add    $0x1,%ebp
mov    0x10(%rsp),%eax
add    $0xffffffff,%eax
cmp    %eax,%ebp
jge    127e <main+0x14e>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x8(%rsp),%edx
mov    0xc(%rsp),%eax
cmp    %eax,%edx
je     11b0 <main+0x80>
mov    %r12,%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%edx
mov    %edx,0xc(%rsp)
mov    $0x1,%ebx
jmp    11b3 <main+0x83>
lea    0xdfe(%rip),%r14
lea    0x8(%rsp),%r15
lea    0xc(%rsp),%r12
lea    0xdf5(%rip),%rbx
xor    %r13d,%r13d
jmp    122b <main+0xfb>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r13d
cmp    0x10(%rsp),%r13d
jge    1269 <main+0x139>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
jle    1220 <main+0xf0>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    0x8(%rsp),%ebp
jl     1250 <main+0x120>
jmp    1220 <main+0xf0>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    128e <main+0x15e>
mov    $0x1,%ebx
mov    0xc(%rsp),%edx
lea    0xd87(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%d%d\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [7 x i8] c"%d %d \00"
@.str.3 = [7 x i8] c"%d %d\0A\00"
@.str.4 = [4 x i8] c"%d \00"
@.str.5 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %1
%12 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%13 = load i32, i32* %3
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %70
15: ; preds = %0
%16 = load i32, i32* %2
%17 = icmp eq i32 %16, 1
br i1 %17, label %18, label %46
18: ; preds = %15
store i32 1, i32* %5
%19 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
store i32 0, i32* %6
br label %20
20: ; preds = %39, %18
%21 = load i32, i32* %6
%22 = load i32, i32* %3
%23 = sub nsw i32 %22, 1
%24 = icmp slt i32 %21, %23
br i1 %24, label %25, label %42
25: ; preds = %20
%26 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%27 = load i32, i32* %7
%28 = load i32, i32* %4
%29 = icmp ne i32 %27, %28
br i1 %29, label %30, label %35
30: ; preds = %25
%31 = load i32, i32* %5
%32 = load i32, i32* %4
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %31, i32 %32)
%34 = load i32, i32* %7
store i32 %34, i32* %4
store i32 1, i32* %5
br label %38
35: ; preds = %25
%36 = load i32, i32* %5
%37 = add nsw i32 %36, 1
store i32 %37, i32* %5
br label %38
38: ; preds = %35, %30
br label %39
39: ; preds = %38
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 1
store i32 %41, i32* %6
br label %20
42: ; preds = %20
%43 = load i32, i32* %5
%44 = load i32, i32* %4
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %43, i32 %44)
br label %69
46: ; preds = %15
store i32 0, i32* %8
br label %47
47: ; preds = %64, %46
%48 = load i32, i32* %8
%49 = load i32, i32* %3
%50 = icmp slt i32 %48, %49
br i1 %50, label %51, label %67
51: ; preds = %47
%52 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %10, i32* %9)
store i32 0, i32* %11
br label %53
53: ; preds = %60, %51
%54 = load i32, i32* %11
%55 = load i32, i32* %10
%56 = icmp slt i32 %54, %55
br i1 %56, label %57, label %63
57: ; preds = %53
%58 = load i32, i32* %9
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %58)
br label %60
60: ; preds = %57
%61 = load i32, i32* %11
%62 = add nsw i32 %61, 1
store i32 %62, i32* %11
br label %53
63: ; preds = %53
br label %64
64: ; preds = %63
%65 = load i32, i32* %8
%66 = add nsw i32 %65, 1
store i32 %66, i32* %8
br label %47
67: ; preds = %47
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %69
69: ; preds = %67, %42
br label %72
70: ; preds = %0
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %72
72: ; preds = %70, %69
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%d%d\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [7 x i8] c"%d %d \00"
@.str.3 = [7 x i8] c"%d %d\0A\00"
@.str.4 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %1 to i8*
%8 = bitcast i32* %2 to i8*
%9 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%10 = load i32, i32* %2
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %68
12: ; preds = %0
%13 = load i32, i32* %1
%14 = icmp eq i32 %13, 1
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = bitcast i32* %5 to i8*
%17 = bitcast i32* %6 to i8*
br label %52
18: ; preds = %12
%19 = bitcast i32* %3 to i8*
%20 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%21 = load i32, i32* %2
%22 = icmp sgt i32 %21, 1
br i1 %22, label %25, label %23
23: ; preds = %18
%24 = load i32, i32* %3
br label %27
25: ; preds = %18
%26 = bitcast i32* %4 to i8*
br label %31
27: ; preds = %43, %23
%28 = phi i32 [ %24, %23 ], [ %44, %43 ]
%29 = phi i32 [ 1, %23 ], [ %45, %43 ]
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %29, i32 %28)
br label %70
31: ; preds = %25, %43
%32 = phi i32 [ 0, %25 ], [ %46, %43 ]
%33 = phi i32 [ 1, %25 ], [ %45, %43 ]
%34 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%35 = load i32, i32* %4
%36 = load i32, i32* %3
%37 = icmp eq i32 %35, %36
br i1 %37, label %41, label %38
38: ; preds = %31
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %33, i32 %36)
%40 = load i32, i32* %4
store i32 %40, i32* %3
br label %43
41: ; preds = %31
%42 = add nsw i32 %33, 1
br label %43
43: ; preds = %41, %38
%44 = phi i32 [ %40, %38 ], [ %35, %41 ]
%45 = phi i32 [ 1, %38 ], [ %42, %41 ]
%46 = add nuw nsw i32 %32, 1
%47 = load i32, i32* %2
%48 = add nsw i32 %47, -1
%49 = icmp slt i32 %46, %48
br i1 %49, label %31, label %27
50: ; preds = %57
%51 = call i32 @putchar(i32 10)
br label %70
52: ; preds = %15, %57
%53 = phi i32 [ 0, %15 ], [ %58, %57 ]
%54 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %6, i32* %5)
%55 = load i32, i32* %6
%56 = icmp sgt i32 %55, 0
br i1 %56, label %61, label %57
57: ; preds = %61, %52
%58 = add nuw nsw i32 %53, 1
%59 = load i32, i32* %2
%60 = icmp slt i32 %58, %59
br i1 %60, label %52, label %50
61: ; preds = %52, %61
%62 = phi i32 [ %65, %61 ], [ 0, %52 ]
%63 = load i32, i32* %5
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %63)
%65 = add nuw nsw i32 %62, 1
%66 = load i32, i32* %6
%67 = icmp slt i32 %65, %66
br i1 %67, label %61, label %57
68: ; preds = %0
%69 = call i32 @putchar(i32 10)
br label %70
70: ; preds = %27, %50, %68
ret i32 0
}