program main
    implicit none
    integer sunuke(100), a(100,100), n, k, d, i, j, count
    read(*,*) n,k
    do i = 1, n
        sunuke(i)=0
    end do
    do i = 1, k
        read(*,*) d
        read(*,*) (a(i,j), j = 1, d)
        ! do j = 1, d
        !     write(*,fmt='(I4)',advance='no') a(i,j)
        ! end do
        ! write(*,*)
        do j = 1, d
            sunuke(a(i,j))=1
        end do
    end do
    count=0
    do i = 1, n
        if ( sunuke(i)==0 ) then
            count=count+1
        end if
    end do
    write(*,*) count
end program main
; 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"

@_QFEa = internal global [100 x [100 x i32]] undef
@_QFEsunuke = internal unnamed_addr global [100 x i32] undef
@_QQcl.5edf9b2467ee642a5376666123a924e5 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_1502/source.f\00"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

define void @_QQmain() local_unnamed_addr {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.5edf9b2467ee642a5376666123a924e5, i32 4)
  %5 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %3, i32 4)
  %6 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %2, i32 4)
  %7 = call i32 @_FortranAioEndIoStatement(ptr %4)
  %8 = load i32, ptr %3, align 4, !tbaa !3
  %9 = sext i32 %8 to i64
  %10 = icmp sgt i32 %8, 0
  br i1 %10, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %0
  %11 = shl nuw nsw i64 %9, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @_QFEsunuke, i8 0, i64 %11, i1 false), !tbaa !3
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph.preheader, %0
  %12 = load i32, ptr %2, align 4, !tbaa !3
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %.lr.ph24.preheader, label %._crit_edge25

.lr.ph24.preheader:                               ; preds = %._crit_edge
  %14 = zext i32 %12 to i64
  br label %.lr.ph24

.lr.ph24:                                         ; preds = %.lr.ph24.preheader, %._crit_edge22
  %indvars.iv33 = phi i64 [ 1, %.lr.ph24.preheader ], [ %indvars.iv.next34, %._crit_edge22 ]
  %15 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.5edf9b2467ee642a5376666123a924e5, i32 9)
  %16 = call i1 @_FortranAioInputInteger(ptr %15, ptr nonnull %1, i32 4)
  %17 = call i32 @_FortranAioEndIoStatement(ptr %15)
  %18 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.5edf9b2467ee642a5376666123a924e5, i32 10)
  %19 = load i32, ptr %1, align 4, !tbaa !3
  %20 = icmp sgt i32 %19, 0
  br i1 %20, label %.lr.ph18, label %._crit_edge19

.lr.ph18:                                         ; preds = %.lr.ph24
  %21 = zext i32 %19 to i64
  %22 = add nsw i64 %indvars.iv33, -1
  br label %23

23:                                               ; preds = %.lr.ph18, %23
  %24 = phi i64 [ 1, %.lr.ph18 ], [ %29, %23 ]
  %sext = shl i64 %24, 32
  %25 = ashr exact i64 %sext, 32
  %26 = add nsw i64 %25, -1
  %27 = getelementptr [100 x [100 x i32]], ptr @_QFEa, i64 0, i64 %26, i64 %22
  %28 = call i1 @_FortranAioInputInteger(ptr %18, ptr %27, i32 4)
  %29 = add nuw nsw i64 %24, 1
  %exitcond.not = icmp eq i64 %24, %21
  br i1 %exitcond.not, label %._crit_edge19, label %23

._crit_edge19:                                    ; preds = %23, %.lr.ph24
  %30 = call i32 @_FortranAioEndIoStatement(ptr %18)
  %31 = load i32, ptr %1, align 4, !tbaa !3
  %32 = icmp sgt i32 %31, 0
  br i1 %32, label %.lr.ph21, label %._crit_edge22

.lr.ph21:                                         ; preds = %._crit_edge19
  %33 = zext i32 %31 to i64
  %34 = add nsw i64 %indvars.iv33, -1
  %xtraiter = and i64 %33, 1
  %35 = icmp eq i32 %31, 1
  br i1 %35, label %._crit_edge22.loopexit.unr-lcssa, label %.lr.ph21.new

.lr.ph21.new:                                     ; preds = %.lr.ph21
  %unroll_iter = and i64 %33, 4294967294
  br label %36

36:                                               ; preds = %36, %.lr.ph21.new
  %indvars.iv = phi i64 [ 1, %.lr.ph21.new ], [ %indvars.iv.next.1, %36 ]
  %niter = phi i64 [ 0, %.lr.ph21.new ], [ %niter.next.1, %36 ]
  %37 = add nsw i64 %indvars.iv, -1
  %38 = getelementptr [100 x [100 x i32]], ptr @_QFEa, i64 0, i64 %37, i64 %34
  %39 = load i32, ptr %38, align 4, !tbaa !3
  %40 = sext i32 %39 to i64
  %41 = add nsw i64 %40, -1
  %42 = getelementptr [100 x i32], ptr @_QFEsunuke, i64 0, i64 %41
  store i32 1, ptr %42, align 4, !tbaa !3
  %43 = getelementptr [100 x [100 x i32]], ptr @_QFEa, i64 0, i64 %indvars.iv, i64 %34
  %44 = load i32, ptr %43, align 4, !tbaa !3
  %45 = sext i32 %44 to i64
  %46 = add nsw i64 %45, -1
  %47 = getelementptr [100 x i32], ptr @_QFEsunuke, i64 0, i64 %46
  store i32 1, ptr %47, align 4, !tbaa !3
  %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_edge22.loopexit.unr-lcssa, label %36

._crit_edge22.loopexit.unr-lcssa:                 ; preds = %36, %.lr.ph21
  %indvars.iv.unr = phi i64 [ 1, %.lr.ph21 ], [ %indvars.iv.next.1, %36 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge22, label %._crit_edge22.loopexit.epilog-lcssa

._crit_edge22.loopexit.epilog-lcssa:              ; preds = %._crit_edge22.loopexit.unr-lcssa
  %48 = add nsw i64 %indvars.iv.unr, -1
  %49 = getelementptr [100 x [100 x i32]], ptr @_QFEa, i64 0, i64 %48, i64 %34
  %50 = load i32, ptr %49, align 4, !tbaa !3
  %51 = sext i32 %50 to i64
  %52 = add nsw i64 %51, -1
  %53 = getelementptr [100 x i32], ptr @_QFEsunuke, i64 0, i64 %52
  store i32 1, ptr %53, align 4, !tbaa !3
  br label %._crit_edge22

._crit_edge22:                                    ; preds = %._crit_edge22.loopexit.epilog-lcssa, %._crit_edge22.loopexit.unr-lcssa, %._crit_edge19
  %indvars.iv.next34 = add nuw nsw i64 %indvars.iv33, 1
  %exitcond36.not = icmp eq i64 %indvars.iv33, %14
  br i1 %exitcond36.not, label %._crit_edge25.loopexit, label %.lr.ph24

._crit_edge25.loopexit:                           ; preds = %._crit_edge22
  %.pre = load i32, ptr %3, align 4, !tbaa !3
  %.pre41 = sext i32 %.pre to i64
  br label %._crit_edge25

._crit_edge25:                                    ; preds = %._crit_edge25.loopexit, %._crit_edge
  %.pre-phi = phi i64 [ %.pre41, %._crit_edge25.loopexit ], [ %9, %._crit_edge ]
  %54 = phi i32 [ %.pre, %._crit_edge25.loopexit ], [ %8, %._crit_edge ]
  %55 = icmp sgt i32 %54, 0
  br i1 %55, label %.lr.ph28.preheader, label %._crit_edge29

.lr.ph28.preheader:                               ; preds = %._crit_edge25
  %min.iters.check = icmp ult i64 %.pre-phi, 8
  br i1 %min.iters.check, label %.lr.ph28.preheader44, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph28.preheader
  %n.vec = and i64 %.pre-phi, -8
  %ind.end = or i64 %n.vec, 1
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %62, %vector.body ]
  %vec.phi42 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %63, %vector.body ]
  %56 = getelementptr [100 x i32], ptr @_QFEsunuke, i64 0, i64 %index
  %wide.load = load <4 x i32>, ptr %56, align 16, !tbaa !3
  %57 = getelementptr i32, ptr %56, i64 4
  %wide.load43 = load <4 x i32>, ptr %57, align 16, !tbaa !3
  %58 = icmp eq <4 x i32> %wide.load, zeroinitializer
  %59 = icmp eq <4 x i32> %wide.load43, zeroinitializer
  %60 = zext <4 x i1> %58 to <4 x i32>
  %61 = zext <4 x i1> %59 to <4 x i32>
  %62 = add <4 x i32> %vec.phi, %60
  %63 = add <4 x i32> %vec.phi42, %61
  %index.next = add nuw i64 %index, 8
  %64 = icmp eq i64 %index.next, %n.vec
  br i1 %64, label %middle.block, label %vector.body, !llvm.loop !7

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %63, %62
  %65 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n = icmp eq i64 %.pre-phi, %n.vec
  br i1 %cmp.n, label %._crit_edge29, label %.lr.ph28.preheader44

.lr.ph28.preheader44:                             ; preds = %.lr.ph28.preheader, %middle.block
  %indvars.iv37.ph = phi i64 [ 1, %.lr.ph28.preheader ], [ %ind.end, %middle.block ]
  %.026.ph = phi i32 [ 0, %.lr.ph28.preheader ], [ %65, %middle.block ]
  br label %.lr.ph28

.lr.ph28:                                         ; preds = %.lr.ph28.preheader44, %.lr.ph28
  %indvars.iv37 = phi i64 [ %indvars.iv.next38, %.lr.ph28 ], [ %indvars.iv37.ph, %.lr.ph28.preheader44 ]
  %.026 = phi i32 [ %spec.select, %.lr.ph28 ], [ %.026.ph, %.lr.ph28.preheader44 ]
  %66 = add nsw i64 %indvars.iv37, -1
  %67 = getelementptr [100 x i32], ptr @_QFEsunuke, i64 0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !3
  %69 = icmp eq i32 %68, 0
  %70 = zext i1 %69 to i32
  %spec.select = add i32 %.026, %70
  %indvars.iv.next38 = add nuw nsw i64 %indvars.iv37, 1
  %exitcond40.not = icmp eq i64 %indvars.iv37, %.pre-phi
  br i1 %exitcond40.not, label %._crit_edge29, label %.lr.ph28, !llvm.loop !10

._crit_edge29:                                    ; preds = %.lr.ph28, %middle.block, %._crit_edge25
  %.0.lcssa = phi i32 [ 0, %._crit_edge25 ], [ %65, %middle.block ], [ %spec.select, %.lr.ph28 ]
  %71 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.5edf9b2467ee642a5376666123a924e5, i32 25)
  %72 = call i1 @_FortranAioOutputInteger32(ptr %71, i32 %.0.lcssa)
  %73 = call i32 @_FortranAioEndIoStatement(ptr %71)
  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 ptr @_FortranAioBeginExternalListOutput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #1

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { nocallback nofree nosync nounwind 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 = distinct !{!7, !8, !9}
!8 = !{!"llvm.loop.isvectorized", i32 1}
!9 = !{!"llvm.loop.unroll.runtime.disable"}
!10 = distinct !{!10, !9, !8}
