program cm
   implicit none
   integer::N,M
   integer,allocatable,dimension(:)::H
   integer::a,b
   logical,allocatable,dimension(:)::GOOD
   integer::ans=0
   integer::i
   read*,N,M
   allocate(H(N))
   read*,H
   allocate(GOOD(N))
   GOOD=.true.
   do i=1,M
      read*,a,b
      if(H(b)>=H(a))GOOD(a)=.false.
      if(H(a)>=H(b))GOOD(b)=.false.
   end do
   do i=1,N
      if(GOOD(i))ANS=ANS+1
   end do
   print"(i0)",ans
contains
end program cm
; ModuleID = 'FIRModule'
source_filename = "FIRModule"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

@_QFEans = internal unnamed_addr global i32 0
@_QFEgood.0 = internal unnamed_addr global ptr null
@_QFEgood.7 = internal unnamed_addr global i64 1
@_QFEh.0 = internal unnamed_addr global ptr null
@_QFEh.8 = internal unnamed_addr global i64 0
@_QQcl.fac899b5c97b359a6fcd4457f097ffc3 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_1509/source.f\00"
@_QQcl.16373402fa3425c6e46827601abb88fa = linkonce constant [76 x i8] c"array left hand side must be allocated when the right hand side is a scalar\00"
@_QQcl.28693029 = linkonce constant [4 x i8] c"(i0)"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #0

define void @_QQmain() local_unnamed_addr {
  %1 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.fac899b5c97b359a6fcd4457f097ffc3, i32 9)
  %7 = call i1 @_FortranAioInputInteger(ptr %6, ptr nonnull %5, i32 4)
  %8 = call i1 @_FortranAioInputInteger(ptr %6, ptr nonnull %4, i32 4)
  %9 = call i32 @_FortranAioEndIoStatement(ptr %6)
  %10 = load i32, ptr %5, align 4, !tbaa !3
  %11 = call i32 @llvm.smax.i32(i32 %10, i32 0)
  %12 = zext i32 %11 to i64
  %13 = shl nuw nsw i64 %12, 2
  %14 = call ptr @malloc(i64 %13)
  store ptr %14, ptr @_QFEh.0, align 8, !tbaa !7
  store i64 %12, ptr @_QFEh.8, align 8, !tbaa !7
  %15 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.fac899b5c97b359a6fcd4457f097ffc3, i32 11)
  %.unpack = load ptr, ptr @_QFEh.0, align 8, !tbaa !7
  %.unpack367.unpack.unpack369 = load i64, ptr @_QFEh.8, align 8, !tbaa !7
  store ptr %.unpack, ptr %1, align 8, !tbaa !7
  %.fca.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 1
  store i64 4, ptr %.fca.1.gep, align 8, !tbaa !7
  %.fca.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 2
  store i32 20180515, ptr %.fca.2.gep, align 8, !tbaa !7
  %.fca.3.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 3
  store i8 1, ptr %.fca.3.gep, align 4, !tbaa !7
  %.fca.4.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 4
  store i8 9, ptr %.fca.4.gep, align 1, !tbaa !7
  %.fca.5.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 5
  store i8 0, ptr %.fca.5.gep, align 2, !tbaa !7
  %.fca.6.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 6
  store i8 0, ptr %.fca.6.gep, align 1, !tbaa !7
  %.fca.7.0.0.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 0
  store i64 1, ptr %.fca.7.0.0.gep, align 8, !tbaa !7
  %.fca.7.0.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 1
  store i64 %.unpack367.unpack.unpack369, ptr %.fca.7.0.1.gep, align 8, !tbaa !7
  %.fca.7.0.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 2
  store i64 4, ptr %.fca.7.0.2.gep, align 8, !tbaa !7
  %16 = call i1 @_FortranAioInputDescriptor(ptr %15, ptr nonnull %1)
  %17 = call i32 @_FortranAioEndIoStatement(ptr %15)
  %18 = load i32, ptr %5, align 4, !tbaa !3
  %19 = call i32 @llvm.smax.i32(i32 %18, i32 0)
  %20 = zext i32 %19 to i64
  %21 = shl nuw nsw i64 %20, 2
  %22 = call ptr @malloc(i64 %21)
  store ptr %22, ptr @_QFEgood.0, align 8, !tbaa !7
  store i64 1, ptr @_QFEgood.7, align 8, !tbaa !7
  %.not = icmp eq ptr %22, null
  br i1 %.not, label %32, label %.preheader

.preheader:                                       ; preds = %0
  %.not469 = icmp slt i32 %18, 1
  br i1 %.not469, label %.loopexit, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader
  %min.iters.check = icmp ult i32 %19, 8
  br i1 %min.iters.check, label %.lr.ph.preheader480, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %20, 2147483640
  %ind.end = and i64 %20, 7
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %23 = getelementptr i32, ptr %22, i64 %index
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %23, align 4, !tbaa !3
  %24 = getelementptr i32, ptr %23, i64 4
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %24, align 4, !tbaa !3
  %index.next = add nuw i64 %index, 8
  %25 = icmp eq i64 %index.next, %n.vec
  br i1 %25, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %20
  br i1 %cmp.n, label %.loopexit, label %.lr.ph.preheader480

.lr.ph.preheader480:                              ; preds = %.lr.ph.preheader, %middle.block
  %.ph = phi i64 [ %20, %.lr.ph.preheader ], [ %ind.end, %middle.block ]
  %.ph481 = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader480, %.lr.ph
  %26 = phi i64 [ %30, %.lr.ph ], [ %.ph, %.lr.ph.preheader480 ]
  %27 = phi i64 [ %28, %.lr.ph ], [ %.ph481, %.lr.ph.preheader480 ]
  %28 = add nuw nsw i64 %27, 1
  %29 = getelementptr i32, ptr %22, i64 %27
  store i32 1, ptr %29, align 4, !tbaa !3
  %30 = add nsw i64 %26, -1
  %31 = icmp ugt i64 %26, 1
  br i1 %31, label %.lr.ph, label %.loopexit, !llvm.loop !12

32:                                               ; preds = %0
  %33 = call {} @_FortranAReportFatalUserError(ptr nonnull @_QQcl.16373402fa3425c6e46827601abb88fa, ptr nonnull @_QQcl.fac899b5c97b359a6fcd4457f097ffc3, i32 13)
  %.unpack451.unpack.unpack = load i64, ptr @_QFEgood.7, align 8, !tbaa !7
  %34 = icmp slt i32 %18, 1
  %35 = select i1 %34, i64 1, i64 %.unpack451.unpack.unpack
  store ptr null, ptr @_QFEgood.0, align 8, !tbaa !7
  store i64 %35, ptr @_QFEgood.7, align 8, !tbaa !7
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph, %middle.block, %.preheader, %32
  %36 = load i32, ptr %4, align 4, !tbaa !3
  %37 = icmp sgt i32 %36, 0
  br i1 %37, label %.lr.ph465.preheader, label %._crit_edge

.lr.ph465.preheader:                              ; preds = %.loopexit
  %38 = zext i32 %36 to i64
  br label %.lr.ph465

.lr.ph465:                                        ; preds = %.lr.ph465.preheader, %65
  %39 = phi i64 [ %66, %65 ], [ %38, %.lr.ph465.preheader ]
  %40 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.fac899b5c97b359a6fcd4457f097ffc3, i32 15)
  %41 = call i1 @_FortranAioInputInteger(ptr %40, ptr nonnull %2, i32 4)
  %42 = call i1 @_FortranAioInputInteger(ptr %40, ptr nonnull %3, i32 4)
  %43 = call i32 @_FortranAioEndIoStatement(ptr %40)
  %.unpack394 = load ptr, ptr @_QFEh.0, align 8, !tbaa !7
  %44 = load i32, ptr %3, align 4, !tbaa !3
  %45 = sext i32 %44 to i64
  %46 = add nsw i64 %45, -1
  %47 = getelementptr i32, ptr %.unpack394, i64 %46
  %48 = load i32, ptr %47, align 4, !tbaa !3
  %49 = load i32, ptr %2, align 4, !tbaa !3
  %50 = sext i32 %49 to i64
  %51 = add nsw i64 %50, -1
  %52 = getelementptr i32, ptr %.unpack394, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !3
  %.not406 = icmp slt i32 %48, %53
  br i1 %.not406, label %57, label %54

54:                                               ; preds = %.lr.ph465
  %.unpack432 = load ptr, ptr @_QFEgood.0, align 8, !tbaa !7
  %.unpack439.unpack.unpack = load i64, ptr @_QFEgood.7, align 8, !tbaa !7
  %55 = sub i64 %50, %.unpack439.unpack.unpack
  %56 = getelementptr i32, ptr %.unpack432, i64 %55
  store i32 0, ptr %56, align 4, !tbaa !3
  %.pre = load i32, ptr %2, align 4, !tbaa !3
  %.pre471 = load i32, ptr %3, align 4, !tbaa !3
  %.pre472 = sext i32 %.pre to i64
  %.pre473 = add nsw i64 %.pre472, -1
  %.pre475 = sext i32 %.pre471 to i64
  %.pre477 = add nsw i64 %.pre475, -1
  br label %57

57:                                               ; preds = %54, %.lr.ph465
  %.pre-phi478 = phi i64 [ %.pre477, %54 ], [ %46, %.lr.ph465 ]
  %.pre-phi476 = phi i64 [ %.pre475, %54 ], [ %45, %.lr.ph465 ]
  %.pre-phi474 = phi i64 [ %.pre473, %54 ], [ %51, %.lr.ph465 ]
  %58 = getelementptr i32, ptr %.unpack394, i64 %.pre-phi474
  %59 = load i32, ptr %58, align 4, !tbaa !3
  %60 = getelementptr i32, ptr %.unpack394, i64 %.pre-phi478
  %61 = load i32, ptr %60, align 4, !tbaa !3
  %.not419 = icmp slt i32 %59, %61
  br i1 %.not419, label %65, label %62

62:                                               ; preds = %57
  %.unpack420 = load ptr, ptr @_QFEgood.0, align 8, !tbaa !7
  %.unpack427.unpack.unpack = load i64, ptr @_QFEgood.7, align 8, !tbaa !7
  %63 = sub i64 %.pre-phi476, %.unpack427.unpack.unpack
  %64 = getelementptr i32, ptr %.unpack420, i64 %63
  store i32 0, ptr %64, align 4, !tbaa !3
  br label %65

65:                                               ; preds = %62, %57
  %66 = add nsw i64 %39, -1
  %67 = icmp sgt i64 %39, 1
  br i1 %67, label %.lr.ph465, label %._crit_edge

._crit_edge:                                      ; preds = %65, %.loopexit
  %68 = load i32, ptr %5, align 4, !tbaa !3
  %69 = icmp sgt i32 %68, 0
  br i1 %69, label %.lr.ph467, label %._crit_edge468

.lr.ph467:                                        ; preds = %._crit_edge
  %70 = zext i32 %68 to i64
  %_QFEans.promoted = load i32, ptr @_QFEans, align 4, !tbaa !3
  %.unpack381 = load ptr, ptr @_QFEgood.0, align 8, !tbaa !7
  %.unpack388.unpack.unpack = load i64, ptr @_QFEgood.7, align 8, !tbaa !7
  %xtraiter = and i64 %70, 1
  %71 = icmp eq i32 %68, 1
  br i1 %71, label %._crit_edge468.loopexit.unr-lcssa, label %.lr.ph467.new

.lr.ph467.new:                                    ; preds = %.lr.ph467
  %unroll_iter = and i64 %70, 4294967294
  br label %72

72:                                               ; preds = %86, %.lr.ph467.new
  %indvars.iv = phi i64 [ 1, %.lr.ph467.new ], [ %indvars.iv.next.1, %86 ]
  %73 = phi i32 [ %_QFEans.promoted, %.lr.ph467.new ], [ %87, %86 ]
  %niter = phi i64 [ 0, %.lr.ph467.new ], [ %niter.next.1, %86 ]
  %74 = sub i64 %indvars.iv, %.unpack388.unpack.unpack
  %75 = getelementptr i32, ptr %.unpack381, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !3
  %.not393 = icmp eq i32 %76, 0
  br i1 %.not393, label %79, label %77

77:                                               ; preds = %72
  %78 = add i32 %73, 1
  store i32 %78, ptr @_QFEans, align 4, !tbaa !3
  br label %79

79:                                               ; preds = %77, %72
  %80 = phi i32 [ %78, %77 ], [ %73, %72 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %81 = sub i64 %indvars.iv.next, %.unpack388.unpack.unpack
  %82 = getelementptr i32, ptr %.unpack381, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !3
  %.not393.1 = icmp eq i32 %83, 0
  br i1 %.not393.1, label %86, label %84

84:                                               ; preds = %79
  %85 = add i32 %80, 1
  store i32 %85, ptr @_QFEans, align 4, !tbaa !3
  br label %86

86:                                               ; preds = %84, %79
  %87 = phi i32 [ %85, %84 ], [ %80, %79 ]
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge468.loopexit.unr-lcssa, label %72

._crit_edge468.loopexit.unr-lcssa:                ; preds = %86, %.lr.ph467
  %indvars.iv.unr = phi i64 [ 1, %.lr.ph467 ], [ %indvars.iv.next.1, %86 ]
  %.unr = phi i32 [ %_QFEans.promoted, %.lr.ph467 ], [ %87, %86 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge468, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge468.loopexit.unr-lcssa
  %88 = sub i64 %indvars.iv.unr, %.unpack388.unpack.unpack
  %89 = getelementptr i32, ptr %.unpack381, i64 %88
  %90 = load i32, ptr %89, align 4, !tbaa !3
  %.not393.epil = icmp eq i32 %90, 0
  br i1 %.not393.epil, label %._crit_edge468, label %91

91:                                               ; preds = %.epil.preheader
  %92 = add i32 %.unr, 1
  store i32 %92, ptr @_QFEans, align 4, !tbaa !3
  br label %._crit_edge468

._crit_edge468:                                   ; preds = %._crit_edge468.loopexit.unr-lcssa, %91, %.epil.preheader, %._crit_edge
  %93 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.fac899b5c97b359a6fcd4457f097ffc3, i32 22)
  %94 = load i32, ptr @_QFEans, align 4, !tbaa !3
  %95 = call i1 @_FortranAioOutputInteger32(ptr %93, i32 %94)
  %96 = call i32 @_FortranAioEndIoStatement(ptr %93)
  ret void
}

declare ptr @_FortranAioBeginExternalListInput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioInputInteger(ptr, ptr, i32) local_unnamed_addr

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

declare i1 @_FortranAioInputDescriptor(ptr, ptr) local_unnamed_addr

declare {} @_FortranAReportFatalUserError(ptr, ptr, i32) local_unnamed_addr

declare ptr @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #1

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!llvm.module.flags = !{!0, !1, !2}

!0 = !{i32 2, !"Debug Info Version", i32 3}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{!4, !4, i64 0}
!4 = !{!"any data access", !5, i64 0}
!5 = !{!"any access", !6, i64 0}
!6 = !{!"Flang Type TBAA Root"}
!7 = !{!8, !8, i64 0}
!8 = !{!"descriptor member", !5, i64 0}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !11, !10}
