#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 *);
int main() {
  int l = 0, e = 0, s = 0, c = 0, p = 0, i = 0, flag = 0;
  scanf("%d %d", &l, &c);
  for (i; i < l; i++) {
    scanf("%d %d", &s, &e);
    p += e;
    p -= s;
    if (p > c)
      flag = 1;
  }
  if (flag == 1)
    printf("S");
  else
    printf("N");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
lea    0xe99(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0x14(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11ce <main+0xae>
lea    0xe79(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%ecx
mov    -0x18(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    11bb <main+0x9b>
movl   $0x1,-0x20(%rbp)
jmp    11c0 <main+0xa0>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1174 <main+0x54>
cmpl   $0x1,-0x20(%rbp)
jne    11e9 <main+0xc9>
lea    0xe27(%rip),%rdi
call   1030 <printf@plt>
jmp    11f5 <main+0xd5>
lea    0xe18(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0x0,0x8(%rsp)
movl   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
lea    0xeab(%rip),%rdi
lea    0x8(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1040 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
jle    11c8 <main+0xa8>
xor    %ebp,%ebp
lea    0x10(%rsp),%r15
lea    0x14(%rsp),%r12
mov    $0x1,%r13d
xor    %ebx,%ebx
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0xe69(%rip),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1040 <scanf@plt>
add    0x14(%rsp),%r14d
sub    0x10(%rsp),%r14d
cmp    0xc(%rsp),%r14d
cmovg  %r13d,%ebp
add    $0x1,%ebx
cmp    0x8(%rsp),%ebx
jl     1190 <main+0x70>
mov    $0x53,%edi
cmp    $0x1,%ebp
je     11cd <main+0xad>
mov    $0x4e,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [2 x i8] c"S\00"
@.str.2 = [2 x i8] c"N\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
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
%9 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %5)
%10 = load i32, i32* %7
br label %11
11: ; preds = %28, %0
%12 = load i32, i32* %7
%13 = load i32, i32* %2
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %31
15: ; preds = %11
%16 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %4, i32* %3)
%17 = load i32, i32* %3
%18 = load i32, i32* %6
%19 = add nsw i32 %18, %17
store i32 %19, i32* %6
%20 = load i32, i32* %4
%21 = load i32, i32* %6
%22 = sub nsw i32 %21, %20
store i32 %22, i32* %6
%23 = load i32, i32* %6
%24 = load i32, i32* %5
%25 = icmp sgt i32 %23, %24
br i1 %25, label %26, label %27
26: ; preds = %15
store i32 1, i32* %8
br label %27
27: ; preds = %26, %15
br label %28
28: ; preds = %27
%29 = load i32, i32* %7
%30 = add nsw i32 %29, 1
store i32 %30, i32* %7
br label %11
31: ; preds = %11
%32 = load i32, i32* %8
%33 = icmp eq i32 %32, 1
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %38
36: ; preds = %31
%37 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %38
38: ; preds = %36, %34
ret i32 0
}

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