Program ABC118B

integer n,m,i,j,l,count,x,y
integer k(30),a(30,30)

read(*,*) n,m

do i=1,n
read(*,*) k(i),(a(i,j),j=1,k(i))
end do

count=0

do l=1,k(1)
x=2
do i=2,n
 y=1
 do j=1,k(i)
  if (a(1,l)==a(x,y)) then
   x=x+1
   go to 10
  else
   y=y+1
  end if
 end do
 go to 100
10 end do
count=count+1
100 end do

write(*,*) count

stop
end
; 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 [30 x [30 x i32]] undef
@_QFEk = internal global [30 x i32] undef
@_QQcl.f34099c9b0dee8904a718b477fc7cde5 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_4923/source.f\00"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

; Function Attrs: noreturn
define void @_QQmain() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.f34099c9b0dee8904a718b477fc7cde5, i32 6)
  %4 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %2, i32 4)
  %5 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %1, i32 4)
  %6 = call i32 @_FortranAioEndIoStatement(ptr %3)
  %7 = load i32, ptr %2, align 4, !tbaa !3
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.lr.ph33.preheader, label %._crit_edge34

.lr.ph33.preheader:                               ; preds = %0
  %9 = zext i32 %7 to i64
  br label %.lr.ph33

.lr.ph33:                                         ; preds = %.lr.ph33.preheader, %._crit_edge
  %indvars.iv = phi i64 [ 1, %.lr.ph33.preheader ], [ %indvars.iv.next, %._crit_edge ]
  %10 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.f34099c9b0dee8904a718b477fc7cde5, i32 9)
  %11 = add nsw i64 %indvars.iv, -1
  %12 = getelementptr [30 x i32], ptr @_QFEk, i64 0, i64 %11
  %13 = call i1 @_FortranAioInputInteger(ptr %10, ptr %12, i32 4)
  %14 = load i32, ptr %12, align 4, !tbaa !3
  %15 = icmp sgt i32 %14, 0
  br i1 %15, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %.lr.ph33
  %16 = zext i32 %14 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %17 = phi i64 [ %22, %.lr.ph ], [ 1, %.lr.ph.preheader ]
  %sext = shl i64 %17, 32
  %18 = ashr exact i64 %sext, 32
  %19 = add nsw i64 %18, -1
  %20 = getelementptr [30 x [30 x i32]], ptr @_QFEa, i64 0, i64 %19, i64 %11
  %21 = call i1 @_FortranAioInputInteger(ptr %10, ptr %20, i32 4)
  %22 = add nuw nsw i64 %17, 1
  %exitcond.not = icmp eq i64 %17, %16
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph33
  %23 = call i32 @_FortranAioEndIoStatement(ptr %10)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond56.not = icmp eq i64 %indvars.iv, %9
  br i1 %exitcond56.not, label %._crit_edge34, label %.lr.ph33

._crit_edge34:                                    ; preds = %._crit_edge, %0
  %24 = load i32, ptr @_QFEk, align 16, !tbaa !3
  %25 = icmp sgt i32 %24, 0
  br i1 %25, label %.lr.ph51, label %._crit_edge52

.lr.ph51:                                         ; preds = %._crit_edge34
  %26 = load i32, ptr %2, align 4, !tbaa !3
  %.02840 = add i32 %26, -1
  %27 = icmp sgt i32 %.02840, 0
  br i1 %27, label %.lr.ph45.us, label %._crit_edge52

.lr.ph45.us:                                      ; preds = %.lr.ph51, %.loopexit.us
  %.02349.us = phi i32 [ %37, %.loopexit.us ], [ 1, %.lr.ph51 ]
  %.02648.us = phi i32 [ %.1.us, %.loopexit.us ], [ 0, %.lr.ph51 ]
  %28 = sext i32 %.02349.us to i64
  %29 = add nsw i64 %28, -1
  %30 = getelementptr [30 x [30 x i32]], ptr @_QFEa, i64 0, i64 %29, i64 0
  br label %31

31:                                               ; preds = %.lr.ph45.us, %46
  %.02242.us = phi i32 [ 2, %.lr.ph45.us ], [ %47, %46 ]
  %32 = sext i32 %.02242.us to i64
  %33 = add nsw i64 %32, -1
  %34 = getelementptr [30 x i32], ptr @_QFEk, i64 0, i64 %33
  %35 = load i32, ptr %34, align 4, !tbaa !3
  %36 = icmp sgt i32 %35, 0
  br i1 %36, label %.lr.ph38.us, label %.loopexit.us

.loopexit.us:                                     ; preds = %31, %44, %._crit_edge46.us
  %.1.us = phi i32 [ %49, %._crit_edge46.us ], [ %.02648.us, %44 ], [ %.02648.us, %31 ]
  %37 = add nuw i32 %.02349.us, 1
  %exitcond59.not = icmp eq i32 %.02349.us, %24
  br i1 %exitcond59.not, label %._crit_edge52, label %.lr.ph45.us

38:                                               ; preds = %.lr.ph38.us, %44
  %.036.us = phi i32 [ 1, %.lr.ph38.us ], [ %45, %44 ]
  %39 = sext i32 %.036.us to i64
  %40 = add nsw i64 %39, -1
  %41 = getelementptr [30 x [30 x i32]], ptr @_QFEa, i64 0, i64 %40, i64 %33
  %42 = load i32, ptr %41, align 4, !tbaa !3
  %43 = icmp eq i32 %48, %42
  br i1 %43, label %46, label %44

44:                                               ; preds = %38
  %45 = add nuw i32 %.036.us, 1
  %exitcond57.not = icmp eq i32 %.036.us, %35
  br i1 %exitcond57.not, label %.loopexit.us, label %38

46:                                               ; preds = %38
  %47 = add nuw i32 %.02242.us, 1
  %exitcond58.not = icmp eq i32 %.02242.us, %26
  br i1 %exitcond58.not, label %._crit_edge46.us, label %31

.lr.ph38.us:                                      ; preds = %31
  %48 = load i32, ptr %30, align 8, !tbaa !3
  br label %38

._crit_edge46.us:                                 ; preds = %46
  %49 = add i32 %.02648.us, 1
  br label %.loopexit.us

._crit_edge52:                                    ; preds = %.loopexit.us, %.lr.ph51, %._crit_edge34
  %.026.lcssa = phi i32 [ 0, %._crit_edge34 ], [ %24, %.lr.ph51 ], [ %.1.us, %.loopexit.us ]
  %50 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.f34099c9b0dee8904a718b477fc7cde5, i32 31)
  %51 = call i1 @_FortranAioOutputInteger32(ptr %50, i32 %.026.lcssa)
  %52 = call i32 @_FortranAioEndIoStatement(ptr %50)
  %53 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable
}

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

declare {} @_FortranAStopStatement(i32, i1, i1) local_unnamed_addr

attributes #0 = { noreturn }

!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"}
