#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*/ add(int *, int);
int /*<<< orphan*/ rm(int *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int tests, c, q;
  scanf("%d", &tests);
  int cost[tests];
  for (int test = 0; test < tests; ++test) {
    scanf("%d", &q);
    if (q == 1)
      rm(cost);
    else {
      scanf("%d", &c);
      add(cost, c);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11e0 <main+0xb0>
lea    0xe70(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x1,-0x10(%rbp)
jne    11b1 <main+0x81>
mov    -0x30(%rbp),%rdi
call   1030 <rm@plt>
jmp    11cd <main+0x9d>
lea    0xe48(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x30(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <add@plt>
jmp    11d2 <main+0xa2>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    117d <main+0x4d>
movl   $0x0,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xeb8(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1050 <scanf@plt>
mov    %rsp,-0x40(%rbp)
mov    -0x2c(%rbp),%eax
mov    %rsp,%rbx
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
cmpl   $0x0,-0x2c(%rbp)
jle    11cb <main+0x9b>
xor    %r13d,%r13d
lea    0xe83(%rip),%r14
lea    -0x30(%rbp),%r15
lea    -0x34(%rbp),%r12
jmp    11b0 <main+0x80>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    -0x34(%rbp),%esi
mov    %rbx,%rdi
call   1040 <add@plt>
add    $0x1,%r13d
cmp    -0x2c(%rbp),%r13d
jge    11cb <main+0x9b>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
cmpl   $0x1,-0x30(%rbp)
jne    1190 <main+0x60>
mov    %rbx,%rdi
call   1030 <rm@plt>
jmp    11a6 <main+0x76>
mov    -0x40(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = zext i32 %9 to i64
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %5
%12 = alloca i32, i64 %10
store i64 %10, i64* %6
store i32 0, i32* %7
br label %13
13: ; preds = %28, %0
%14 = load i32, i32* %7
%15 = load i32, i32* %2
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %31
17: ; preds = %13
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = call i32 @rm(i32* %12)
br label %27
23: ; preds = %17
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%25 = load i32, i32* %3
%26 = call i32 @add(i32* %12, i32 %25)
br label %27
27: ; preds = %23, %21
br label %28
28: ; preds = %27
%29 = load i32, i32* %7
%30 = add nsw i32 %29, 1
store i32 %30, i32* %7
br label %13
31: ; preds = %13
store i32 0, i32* %1
%32 = load i8*, i8** %5
%33 = load i32, i32* %1
ret i32 %33
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = zext i32 %8 to i64
%10 = call i8* @llvm.stacksave()
%11 = alloca i32, i64 %9
%12 = load i32, i32* %1
%13 = icmp sgt i32 %12, 0
br i1 %13, label %15, label %14
14: ; preds = %26, %0
ret i32 0
15: ; preds = %0, %26
%16 = phi i32 [ %27, %26 ], [ 0, %0 ]
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%18 = load i32, i32* %3
%19 = icmp eq i32 %18, 1
br i1 %19, label %20, label %22
20: ; preds = %15
%21 = call i32 @rm(i32* %11)
br label %26
22: ; preds = %15
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%24 = load i32, i32* %2
%25 = call i32 @add(i32* %11, i32 %24)
br label %26
26: ; preds = %20, %22
%27 = add nuw nsw i32 %16, 1
%28 = load i32, i32* %1
%29 = icmp slt i32 %27, %28
br i1 %29, label %15, label %14
}