#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);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main(void) {
  int n, y, b, r, t, num, i, j;
  double max, temp;
  while (1) {
    scanf("%d", &n);
    if (n == 0)
      break;
    max = 0.0;
    scanf("%d", &y);
    for (i = 0; i < n; i++) {
      scanf("%d %d %d", &b, &r, &t);
      if (t == 1) {
        temp = 1.0 + y * r / 100.0;
      } else {
        temp = 1.0;
        for (j = 0; j < y; j++) {
          temp *= (1.0 + y / 100.0);
        }
      }
      if (max > temp) {
        max = temp;
        num = b;
      }
    }
    printf("%d\n", b);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xee0(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jne    1150 <main+0x30>
jmp    126f <main+0x14f>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    125b <main+0x13b>
lea    0xe8c(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x1,-0x18(%rbp)
jne    11ce <main+0xae>
mov    -0xc(%rbp),%eax
imul   -0x14(%rbp),%eax
cvtsi2sd %eax,%xmm1
movsd  0xe54(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xe40(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    1228 <main+0x108>
movsd  0xe2a(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1223 <main+0x103>
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  0xe0d(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xdf9(%rip),%xmm0
addsd  %xmm1,%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11e2 <main+0xc2>
jmp    1228 <main+0x108>
movsd  -0x30(%rbp),%xmm0
ucomisd -0x38(%rbp),%xmm0
jbe    1248 <main+0x128>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    124d <main+0x12d>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1171 <main+0x51>
mov    -0x10(%rbp),%esi
lea    0xdb4(%rip),%rdi
call   1030 <printf@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x40,%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    0xed1(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
je     11d0 <main+0xb0>
lea    0xeb3(%rip),%r15
lea    0xea6(%rip),%r12
lea    0x8(%rsp),%r13
lea    0x10(%rsp),%rbx
lea    0xc(%rsp),%rbp
jmp    1196 <main+0x76>
nopl   0x0(%rax,%rax,1)
mov    0x8(%rsp),%esi
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
je     11d0 <main+0xb0>
mov    %r15,%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    1170 <main+0x50>
xor    %r14d,%r14d
nop
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   1040 <scanf@plt>
add    $0x1,%r14d
cmp    0x4(%rsp),%r14d
jl     11b0 <main+0x90>
jmp    1170 <main+0x50>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [9 x i8] c"%d %d %d\00"
@.str.2 = [4 x i8] c"%d\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 double
%11 = alloca double
store i32 0, i32* %1
br label %12
12: ; preds = %0, %61
%13 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%14 = load i32, i32* %2
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %12
br label %64
17: ; preds = %12
store double 0.000000e+00, double* %10
%18 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 0, i32* %8
br label %19
19: ; preds = %58, %17
%20 = load i32, i32* %8
%21 = load i32, i32* %2
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %61
23: ; preds = %19
%24 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32* %5, i32* %6)
%25 = load i32, i32* %6
%26 = icmp eq i32 %25, 1
br i1 %26, label %27, label %34
27: ; preds = %23
%28 = load i32, i32* %3
%29 = load i32, i32* %5
%30 = mul nsw i32 %28, %29
%31 = sitofp i32 %30 to double
%32 = fdiv double %31, 1.000000e+02
%33 = fadd double 1.000000e+00, %32
store double %33, double* %11
br label %50
34: ; preds = %23
store double 1.000000e+00, double* %11
store i32 0, i32* %9
br label %35
35: ; preds = %46, %34
%36 = load i32, i32* %9
%37 = load i32, i32* %3
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %49
39: ; preds = %35
%40 = load i32, i32* %3
%41 = sitofp i32 %40 to double
%42 = fdiv double %41, 1.000000e+02
%43 = fadd double 1.000000e+00, %42
%44 = load double, double* %11
%45 = fmul double %44, %43
store double %45, double* %11
br label %46
46: ; preds = %39
%47 = load i32, i32* %9
%48 = add nsw i32 %47, 1
store i32 %48, i32* %9
br label %35
49: ; preds = %35
br label %50
50: ; preds = %49, %27
%51 = load double, double* %10
%52 = load double, double* %11
%53 = fcmp ogt double %51, %52
br i1 %53, label %54, label %57
54: ; preds = %50
%55 = load double, double* %11
store double %55, double* %10
%56 = load i32, i32* %4
store i32 %56, i32* %7
br label %57
57: ; preds = %54, %50
br label %58
58: ; preds = %57
%59 = load i32, i32* %8
%60 = add nsw i32 %59, 1
store i32 %60, i32* %8
br label %19
61: ; preds = %19
%62 = load i32, i32* %4
%63 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %62)
br label %12
64: ; preds = %16
ret i32 0
}

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