dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; using System . Collections . Generic ; class GFG { static void maxAtLevel ( int N , int M , int [ ] Value , int [ , ] Edges ) { List < int > [ ] adj = new List < int > [ N ] ; for ( int i = 0 ; i < adj . Length ; i ++ ) adj [ i ] = new List < int > ( ) ; for ( int i = 0 ; i < M ; i ++ ) { int u = Edges [ i , 0 ] ; int v = Edges [ i , 1 ] ; adj [ u ] . Add ( v ) ; } Queue < int > q = new Queue < int > ( ) ; q . Enqueue ( 0 ) ; while ( q . Count != 0 ) { int count = q . Count ; int maxVal = 0 ; while ( count -- > 0 ) { int temp = q . Peek ( ) ; q . Dequeue ( ) ; maxVal = Math . Max ( maxVal , Value [ temp ] ) ; for ( int i = 0 ; i < adj [ temp ] . Count ; i ++ ) { q . Enqueue ( adj [ temp ] [ i ] ) ; } } Console . Write ( maxVal + " ▁ " ) ; } } public static void Main ( String [ ] args ) { int N = 10 ; int [ , ] Edges = { { 0 , 1 } , { 0 , 2 } , { 0 , 3 } , { 1 , 4 } , { 1 , 5 } , { 3 , 6 } , { 6 , 7 } , { 6 , 8 } , { 6 , 9 } } ; int [ ] Value = { 1 , 2 , - 1 , 3 , 4 , 5 , 8 , 6 , 12 , 7 } ; maxAtLevel ( N , N - 1 , Value , Edges ) ; } }

Index/key variables: N, i, temp, u
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void ctTriplets ( int [ ] arr , int N ) { Array . Sort ( arr ) ; int [ ] temp = new int [ N ] ; int index = 0 ; for ( int i = 1 ; i < N ; i += 2 ) { temp [ i ] = arr [ index ++ ] ; } for ( int i = 0 ; i < N ; i += 2 ) { temp [ i ] = arr [ index ++ ] ; } int ct = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( i > 0 && i + 1 < N ) { if ( temp [ i ] < temp [ i + 1 ] && temp [ i ] < temp [ i - 1 ] ) { ct ++ ; } } } Console . WriteLine ( " Count ▁ of ▁ triplets : " + ct ) ; Console . Write ( " Array : " ) ; for ( int i = 0 ; i < N ; i ++ ) { Console . Write ( temp [ i ] + " ▁ " ) ; } } public static void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 4 , 5 , 6 } ; int N = arr . Length ; ctTriplets ( arr , N ) ; } }

Index/key variables: N, i
Accumulator variables: ct, i, index
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool check ( int [ ] a , int n ) { int [ ] b = new int [ n ] ; int minElement = int . MaxValue ; for ( int i = 0 ; i < n ; i ++ ) { b [ i ] = a [ i ] ; minElement = Math . Min ( minElement , a [ i ] ) ; } Array . Sort ( b ) ; int k = 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] != b [ i ] && a [ i ] % minElement != 0 ) { k = 0 ; break ; } } return k == 1 ? true : false ; } static public void Main ( ) { int [ ] a = { 4 , 3 , 6 , 6 , 2 , 9 } ; int n = a . Length ; if ( check ( a , n ) == true ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Index/key variables: i, n
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int numSpecial ( int [ , ] mat ) { int m = mat . GetLength ( 0 ) ; int n = mat . GetLength ( 1 ) ; int [ ] rows = new int [ m ] ; int [ ] cols = new int [ n ] ; int i , j ; for ( i = 0 ; i < m ; i ++ ) { rows [ i ] = 0 ; for ( j = 0 ; j < n ; j ++ ) rows [ i ] += mat [ i , j ] ; } for ( i = 0 ; i < n ; i ++ ) { cols [ i ] = 0 ; for ( j = 0 ; j < m ; j ++ ) cols [ i ] += mat [ j , i ] ; } int cnt = 0 ; for ( i = 0 ; i < m ; i ++ ) { for ( j = 0 ; j < n ; j ++ ) { if ( mat [ i , j ] == 1 && rows [ i ] == 1 && cols [ j ] == 1 ) cnt ++ ; } } return cnt ; } public static void Main ( String [ ] args ) { int [ , ] mat = { { 1 , 0 , 0 } , { 0 , 0 , 1 } , { 0 , 0 , 0 } } ; Console . Write ( numSpecial ( mat ) + " STRNEWLINE " ) ; } }

Index/key variables: i, j, m, n
Accumulator variables: cnt, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { public static List < int > minmaxNumbers ( int [ , ] matrix , List < int > res ) { HashSet < int > set = new HashSet < int > ( ) ; for ( int i = 0 ; i < matrix . GetLength ( 0 ) ; i ++ ) { int minr = int . MaxValue ; for ( int j = 0 ; j < matrix . GetLength ( 1 ) ; j ++ ) { minr = Math . Min ( minr , matrix [ i , j ] ) ; } set . Add ( minr ) ; } for ( int j = 0 ; j < matrix . GetLength ( 0 ) ; j ++ ) { int maxc = int . MinValue ; for ( int i = 0 ; i < matrix . GetLength ( 1 ) ; i ++ ) { maxc = Math . Max ( maxc , matrix [ i , j ] ) ; } if ( set . Contains ( maxc ) ) { res . Add ( maxc ) ; } } return res ; } public static void Main ( String [ ] args ) { int [ , ] mat = { { 1 , 10 , 4 } , { 9 , 3 , 8 } , { 15 , 16 , 17 } } ; List < int > ans = new List < int > ( ) ; ans = minmaxNumbers ( mat , ans ) ; if ( ans . Count == 0 ) Console . WriteLine ( " - 1" ) ; for ( int i = 0 ; i < ans . Count ; i ++ ) Console . WriteLine ( ans [ i ] ) ; } }

Index/key variables: i
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int mini = 105 , ans , n ; static List < int > [ ] g = new List < int > [ 100 ] ; static int [ ] size = new int [ 100 ] ; static void create_graph ( ) { g [ 1 ] . Add ( 2 ) ; g [ 2 ] . Add ( 1 ) ; g [ 1 ] . Add ( 3 ) ; g [ 3 ] . Add ( 1 ) ; g [ 1 ] . Add ( 4 ) ; g [ 4 ] . Add ( 1 ) ; g [ 2 ] . Add ( 5 ) ; g [ 5 ] . Add ( 2 ) ; g [ 2 ] . Add ( 6 ) ; g [ 6 ] . Add ( 2 ) ; } static void dfs ( int node , int parent ) { size [ node ] = 1 ; int mx = 0 ; foreach ( int y in g [ node ] ) { if ( y == parent ) continue ; dfs ( y , node ) ; size [ node ] += size [ y ] ; mx = Math . Max ( mx , size [ y ] ) ; } mx = Math . Max ( mx , n - size [ node ] ) ; if ( mx < mini ) { mini = mx ; ans = node ; } } public static void Main ( String [ ] args ) { n = 6 ; for ( int i = 0 ; i < g . Length ; i ++ ) g [ i ] = new List < int > ( ) ; create_graph ( ) ; dfs ( 1 , - 1 ) ; Console . Write ( ans + " STRNEWLINE " ) ; } }

Index/key variables: i, node, y
Accumulator variables: i
Iterator variables: i, y
Class/struct names: GFG
C# program:
using System ; class GFG { static int minOperation ( String s ) { int n = s . Length ; int temp1 = - 1 , temp2 = - 1 ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int curr = s [ i ] ; if ( curr == '0' ) { if ( temp1 == - 1 && temp2 == - 1 ) { temp1 = i ; } else if ( temp1 != - 1 && temp2 == - 1 && i - temp1 == 1 ) { temp2 = i ; } else if ( temp1 != - 1 ) { temp1 = - 1 ; ans ++ ; } else if ( temp1 == - 1 && temp2 != - 1 && i - temp2 != 1 ) { temp2 = - 1 ; ans ++ ; } } } if ( temp1 != - 1 && temp2 != - 1 ) { ans += 2 ; } else if ( temp1 != - 1 temp2 != - 1 ) { ans += 1 ; } return ans ; } public static void Main ( String [ ] args ) { String s = "110010" ; Console . WriteLine ( minOperation ( s ) ) ; } }

Index/key variables: i
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int findMinLength ( int [ ] arr ) { int index = ( int ) arr . Length - 1 ; while ( index > 0 && arr [ index ] >= arr [ index - 1 ] ) { index -- ; } return index ; } public static void Main ( String [ ] args ) { int [ ] arr = { 7 , 8 , 5 , 0 , - 1 , - 1 , 0 , 1 , 2 , 3 , 4 } ; int n = arr . Length ; Console . WriteLine ( findMinLength ( arr ) ) ; } }

Index/key variables: index
Accumulator variables: index
Class/struct names: GFG
C# program:
using System ; class GFG { static int countPrecedingK ( int [ ] a , int n , int K ) { int [ ] prefix = new int [ n ] ; prefix [ 0 ] = a [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { prefix [ i ] = prefix [ i - 1 ] + a [ i ] ; } int ctr = 0 ; if ( prefix [ K - 1 ] < a [ K ] ) ctr ++ ; for ( int i = K + 1 ; i < n ; i ++ ) { if ( prefix [ i - 1 ] - prefix [ i - K - 1 ] < a [ i ] ) ctr ++ ; } return ctr ; } public static void Main ( String [ ] args ) { int [ ] arr = { 2 , 3 , 8 , 10 , - 2 , 7 , 5 , 5 , 9 , 15 } ; int N = arr . Length ; int K = 2 ; Console . Write ( countPrecedingK ( arr , N , K ) ) ; } }

Index/key variables: K, i, n
Accumulator variables: ctr, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void convertBfromA ( int a , int b ) { int moves = 0 ; int x = Math . Abs ( a - b ) ; for ( int i = 10 ; i > 0 ; i -- ) { moves += x / i ; x = x % i ; } Console . Write ( moves + " ▁ " ) ; } public static void Main ( ) { int A = 188 , B = 4 ; convertBfromA ( A , B ) ; } }

Accumulator variables: i, moves
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int M = 1000 ; static int countNum ( int N , int sum , int K , int st , int [ , , ] dp ) { if ( N == 0 && sum == 0 ) { return 1 ; } if ( N < 0 ) { return 0 ; } if ( dp [ N , sum , st ] != - 1 ) { return dp [ N , sum , st ] ; } int res = 0 ; int start = ( st == 1 ? 0 : 1 ) ; for ( int i = start ; i <= 9 ; i ++ ) { res += countNum ( N - 1 , ( sum + i ) % K , K , ( ( st i ) > 0 ) ? 1 : 0 , dp ) ; } return dp [ N , sum , st ] = res ; } static public void Main ( ) { int N = 2 , K = 7 ; int [ , , ] dp = new int [ M , M , 2 ] ; for ( int i = 0 ; i < M ; i ++ ) for ( int j = 0 ; j < M ; j ++ ) for ( int k = 0 ; k < 2 ; k ++ ) dp [ i , j , k ] = - 1 ; Console . WriteLine ( countNum ( N , 0 , K , 0 , dp ) ) ; } }

Accumulator variables: i, j, k, res
Iterator variables: i, j, k
Class/struct names: GFG
C# program:
using System ; class GFG { static int smallestNth ( int A , int B , int N ) { int res = Int32 . MaxValue ; for ( int i = 1 ; i < N ; i ++ ) { for ( int j = N ; j > i ; j -- ) { if ( ( B - A ) % ( j - i ) == 0 ) { int D = ( B - A ) / ( j - i ) ; int FirstTerm = A - ( i - 1 ) * D ; int NthTerm = FirstTerm + ( N - 1 ) * D ; if ( FirstTerm > 0 ) res = Math . Min ( res , NthTerm ) ; } } } return res ; } public static void Main ( ) { int N = 3 ; int A = 1 ; int B = 6 ; Console . Write ( smallestNth ( A , B , N ) ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void sieve ( bool [ ] prime ) { for ( int i = 0 ; i < 1000000 ; i ++ ) { prime [ i ] = true ; } prime [ 0 ] = prime [ 1 ] = false ; for ( int i = 2 ; i * i <= 1000000 ; i ++ ) { if ( prime [ i ] ) { for ( int j = i * i ; j < 1000000 ; j += i ) { prime [ j ] = false ; } } } } static void subPrimeSum ( int N , int K , int [ ] arr , bool [ ] prime ) { int currSum = 0 ; for ( int i = 0 ; i < K ; i ++ ) { currSum += arr [ i ] ; } if ( prime [ currSum ] ) { for ( int i = 0 ; i < K ; i ++ ) { Console . Write ( arr [ i ] + " ▁ " ) ; } return ; } int st = 1 , en = K ; while ( en < N ) { currSum += arr [ en ] - arr [ st - 1 ] ; if ( prime [ currSum ] ) { for ( int i = st ; i <= en ; i ++ ) { Console . Write ( arr [ i ] + " ▁ " ) ; } return ; } en ++ ; st ++ ; } } public static void Main ( String [ ] args ) { int [ ] arr = { 20 , 7 , 5 , 4 , 3 , 11 , 99 , 87 , 23 , 45 } ; int K = 4 ; int N = arr . Length ; bool [ ] prime = new bool [ 1000000 ] ; sieve ( prime ) ; subPrimeSum ( N , K , arr , prime ) ; } }

Index/key variables: currSum, en, i, j
Accumulator variables: currSum, en, i, j, st
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System . Collections . Generic ; using System ; class GFG { static int minDeletion ( string str ) { int n = str . Length ; int firstIdx1 = - 1 ; int lastIdx0 = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( str [ i ] == '1' ) { firstIdx1 = i ; break ; } } for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( str [ i ] == '0' ) { lastIdx0 = i ; break ; } } if ( firstIdx1 == - 1 lastIdx0 == - 1 ) return 0 ; int count1 = 0 , count0 = 0 ; for ( int i = 0 ; i < lastIdx0 ; i ++ ) { if ( str [ i ] == '1' ) { count1 ++ ; } } for ( int i = firstIdx1 + 1 ; i < n ; i ++ ) { if ( str [ i ] == '1' ) { count0 ++ ; } } return Math . Min ( count0 , count1 ) ; } public static void Main ( ) { string str = "1000101" ; Console . WriteLine ( minDeletion ( str ) ) ; } }

Index/key variables: i
Accumulator variables: count0, count1, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static int maximumSum ( int [ ] a , int [ ] b , int n , int index , int lastpicked ) { if ( index == n ) return 0 ; int option1 = 0 , option2 = 0 ; if ( lastpicked == - 1 a [ lastpicked ] != a [ index ] ) option1 = b [ index ] + maximumSum ( a , b , n , index + 1 , index ) ; option2 = maximumSum ( a , b , n , index + 1 , lastpicked ) ; return Math . Max ( option1 , option2 ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 3 , 3 , 1 } ; int [ ] brr = { - 1 , 2 , 10 , 20 , - 10 , - 9 } ; int N = arr . Length ; Console . WriteLine ( maximumSum ( arr , brr , N , 0 , - 1 ) ) ; } }

Index/key variables: index, lastpicked
Class/struct names: GFG
C# program:
using System ; class GFG { static void sumOfKElements ( int [ ] arr , int n , int k ) { bool rev = false ; if ( k < 0 ) { rev = true ; k *= - 1 ; int l = 0 , r = n - 1 ; while ( l < r ) { int tmp = arr [ l ] ; arr [ l ] = arr [ r ] ; arr [ r ] = tmp ; l ++ ; r -- ; } } int [ ] dp = new int [ n ] ; dp [ 0 ] = arr [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { dp [ i ] += dp [ i - 1 ] + arr [ i ] ; } int [ ] ans = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { if ( i + k < n ) ans [ i ] = dp [ i + k ] - dp [ i ] ; else { int x = k - ( n - 1 - i ) ; int y = x / n ; int rem = x % n ; ans [ i ] = dp [ n - 1 ] - dp [ i ] + y * dp [ n - 1 ] + ( rem - 1 >= 0 ? dp [ rem - 1 ] : 0 ) ; } } if ( rev ) { for ( int i = n - 1 ; i >= 0 ; i -- ) { Console . Write ( ans [ i ] + " ▁ " ) ; } } else { for ( int i = 0 ; i < n ; i ++ ) { Console . Write ( ans [ i ] + " ▁ " ) ; } } } public static void Main ( String [ ] args ) { int [ ] arr = { 4 , 2 , - 5 , 11 } ; int N = arr . Length ; int K = 3 ; sumOfKElements ( arr , N , K ) ; } }

Index/key variables: i, l, n, r
Accumulator variables: i, k, l, r
Iterator variables: i
Boolean variables: rev
Class/struct names: GFG
C# program:
using System ; using System . Collections ; using System . Collections . Generic ; class GFG { static int binaryInsert ( ArrayList boundary , int i ) { int l = 0 ; int r = boundary . Count - 1 ; while ( l <= r ) { int m = ( l + r ) / 2 ; if ( ( int ) boundary [ m ] < i ) l = m + 1 ; else r = m - 1 ; } boundary . Insert ( l , i ) ; return l ; } static int [ ] countingSubarray ( int [ ] arr , int n ) { Dictionary < int , int > index = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) index [ arr [ i ] ] = i ; ArrayList boundary = new ArrayList ( ) ; boundary . Add ( - 1 ) ; boundary . Add ( n ) ; Array . Sort ( arr ) ; int [ ] ans = new int [ n ] ; foreach ( int num in arr ) { int i = binaryInsert ( boundary , index [ num ] ) ; int l = ( int ) boundary [ i ] - ( int ) boundary [ i - 1 ] - 1 ; int r = ( int ) boundary [ i + 1 ] - ( int ) boundary [ i ] - 1 ; int cnt = l + r + l * r + 1 ; ans [ index [ num ] ] += cnt ; } return ans ; } public static void Main ( string [ ] args ) { int N = 5 ; int [ ] arr = { 3 , 2 , 4 , 1 , 5 } ; int [ ] a = countingSubarray ( arr , N ) ; Console . Write ( " [ " ) ; int n = a . Length - 1 ; for ( int i = 0 ; i < n ; i ++ ) Console . Write ( a [ i ] + " , ▁ " ) ; Console . Write ( a [ n ] + " ] " ) ; } }

Index/key variables: i, m, n, num
Accumulator variables: i
Iterator variables: i, num
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static readonly int limit = 1000000000 ; static int F ( int N ) { String str = String . Join ( " " , N ) ; int sum = 0 ; for ( int i = 0 ; i < str . Length ; i ++ ) { int val = ( int ) ( str [ i ] - '0' ) ; sum += val * val * val ; } return sum ; } static int findDestination ( int N ) { HashSet < int > s = new HashSet < int > ( ) ; int prev = N , next = 0 ; s . Add ( N ) ; while ( N <= limit ) { next = F ( N ) ; if ( s . Contains ( next ) ) { return next ; } prev = next ; s . Add ( prev ) ; N = next ; } return next ; } static void digitCubeLimit ( int N ) { if ( N < 0 ) Console . Write ( " N ▁ cannot ▁ be ▁ negative STRNEWLINE " ) ; else { int ans = findDestination ( N ) ; if ( ans > limit ) Console . Write ( " Limit ▁ exceeded STRNEWLINE " ) ; else if ( ans == F ( ans ) ) { Console . Write ( N ) ; Console . Write ( " ▁ reaches ▁ to ▁ a " + " ▁ fixed ▁ point : ▁ " ) ; Console . Write ( ans ) ; } else { Console . Write ( N ) ; Console . Write ( " ▁ reaches ▁ to ▁ a " + " ▁ limit ▁ cycle : ▁ " ) ; Console . Write ( ans ) ; } } } public static void Main ( String [ ] args ) { int N = 3 ; digitCubeLimit ( N ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int countTuples ( int [ ] arr , int N ) { int ans = 0 , val = 0 ; Dictionary < int , int > freq = new Dictionary < int , int > ( ) ; for ( int j = 0 ; j < N - 2 ; j ++ ) { val = 0 ; for ( int l = j + 1 ; l < N ; l ++ ) { if ( arr [ j ] == arr [ l ] ) { ans += val ; } if ( freq . ContainsKey ( arr [ l ] ) ) val += freq [ arr [ l ] ] ; } if ( freq . ContainsKey ( arr [ j ] ) ) { freq [ arr [ j ] ] = freq [ arr [ j ] ] + 1 ; } else { freq . Add ( arr [ j ] , 1 ) ; } } return ans ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 1 , 2 , 2 , 2 } ; int N = arr . Length ; Console . Write ( countTuples ( arr , N ) ) ; } }

Index/key variables: j, l
Accumulator variables: ans, j, l, val
Iterator variables: j, l
Class/struct names: GFG
C# program:
using System ; class GFG { static int minOperation ( int [ ] arr ) { int minOp = int . MinValue ; int minNeg = 0 , maxPos = 0 ; for ( int i = 0 ; i < arr . Length ; i ++ ) { if ( arr [ i ] < 0 ) { if ( arr [ i ] < minNeg ) minNeg = arr [ i ] ; } else { if ( arr [ i ] > maxPos ) maxPos = arr [ i ] ; } } return Math . Abs ( minNeg ) + maxPos ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 3 , 4 , 1 } ; Console . WriteLine ( minOperation ( arr ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int GCD ( int a , int b ) { if ( b == 0 ) { return a ; } return GCD ( b , a % b ) ; } static void GcdPair ( int [ , ] arr , int k ) { int lo = 0 , hi = arr . Length - 1 , mid ; int [ ] ans = { - 1 , 0 } ; while ( lo <= hi ) { mid = lo + ( hi - lo ) / 2 ; if ( GCD ( arr [ mid , 0 ] , arr [ mid , 1 ] ) > k ) { ans = GetRow ( arr , mid ) ; hi = mid - 1 ; } else lo = mid + 1 ; } if ( ans [ 0 ] == - 1 ) Console . Write ( " - 1" ) ; else Console . Write ( " ( ▁ " + ans [ 0 ] + " , ▁ " + ans [ 1 ] + " ▁ ) " ) ; return ; } public static int [ ] GetRow ( int [ , ] matrix , int row ) { var rowLength = matrix . GetLength ( 1 ) ; var rowVector = new int [ rowLength ] ; for ( var i = 0 ; i < rowLength ; i ++ ) rowVector [ i ] = matrix [ row , i ] ; return rowVector ; } public static void Main ( String [ ] args ) { int [ , ] arr = { { 3 , 6 } , { 15 , 30 } , { 25 , 75 } , { 30 , 120 } } ; int K = 16 ; GcdPair ( arr , K ) ; } }

Index/key variables: i, rowLength
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void isPossible ( int [ ] arr , int N ) { int mn = int . MaxValue ; int [ ] B = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { mn = Math . Min ( mn , arr [ i ] ) ; B [ i ] = arr [ i ] ; } Array . Sort ( arr ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] != B [ i ] ) { if ( B [ i ] % mn != 0 ) { Console . Write ( " No " ) ; return ; } } } Console . Write ( " Yes " ) ; return ; } public static void Main ( String [ ] args ) { int N = 6 ; int [ ] arr = { 4 , 3 , 6 , 6 , 2 , 9 } ; isPossible ( arr , N ) ; } }

Index/key variables: N, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections ; using System . Collections . Generic ; class GFG { class pair { public int first , second ; public pair ( int first , int second ) { this . first = first ; this . second = second ; } } static void addEdge ( ArrayList adj , int u , int v ) { ( ( ArrayList ) adj [ u ] ) . Add ( v ) ; ( ( ArrayList ) adj [ v ] ) . Add ( u ) ; } static void DFSUtil ( int u , ArrayList adj , bool [ ] visited , int componentMin , int componentMax ) { visited [ u ] = true ; componentMax = Math . Max ( componentMax , u ) ; componentMin = Math . Min ( componentMin , u ) ; for ( int i = 0 ; i < ( ( ArrayList ) adj [ u ] ) . Count ; i ++ ) if ( visited [ ( int ) ( ( ArrayList ) adj [ u ] ) [ i ] ] == false ) DFSUtil ( ( int ) ( ( ArrayList ) adj [ u ] ) [ i ] , adj , visited , componentMin , componentMax ) ; } static bool isValid ( ArrayList v ) { int MAX = - 1 ; bool ans = false ; foreach ( pair i in v ) { if ( i . first <= MAX ) { ans = true ; } MAX = Math . Max ( MAX , i . second ) ; } return ( ans == false ? true : false ) ; } static void DFS ( ArrayList adj , int V ) { ArrayList v = new ArrayList ( ) ; bool [ ] visited = new bool [ V + 1 ] ; for ( int u = 1 ; u <= V ; u ++ ) { if ( visited [ u ] == false ) { int componentMax = u ; int componentMin = u ; DFSUtil ( u , adj , visited , componentMin , componentMax ) ; v . Add ( new pair ( componentMin , componentMax ) ) ; } } bool check = isValid ( v ) ; if ( check ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; return ; } public static void Main ( string [ ] args ) { int N = 4 ; ArrayList adj = new ArrayList ( ) ; for ( int i = 0 ; i <= N + 1 ; i ++ ) adj . Add ( new ArrayList ( ) ) ; addEdge ( adj , 1 , 2 ) ; addEdge ( adj , 2 , 3 ) ; addEdge ( adj , 3 , 4 ) ; DFS ( adj , N ) ; } }

Index/key variables: i, u, v
Accumulator variables: i, u
Iterator variables: i, u
Boolean variables: ans
Class/struct names: GFG, pair
C# program:
using System ; using System . Collections . Generic ; class GFG { static bool checkArrInStack ( Stack < int > s , int [ ] arr , int n ) { Dictionary < int , int > freq = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) if ( freq . ContainsKey ( arr [ i ] ) ) freq [ arr [ i ] ] = freq [ arr [ i ] ] + 1 ; else freq . Add ( arr [ i ] , 1 ) ; while ( s . Count != 0 ) { int poppedEle = s . Peek ( ) ; s . Pop ( ) ; if ( freq . ContainsKey ( poppedEle ) ) freq [ poppedEle ] = freq [ poppedEle ] - 1 ; } if ( freq . Count == 0 ) return false ; return true ; } public static void Main ( String [ ] args ) { Stack < int > s = new Stack < int > ( ) ; s . Push ( 10 ) ; s . Push ( 20 ) ; s . Push ( 30 ) ; s . Push ( 40 ) ; s . Push ( 50 ) ; int [ ] arr = { 20 , 30 } ; int n = arr . Length ; if ( checkArrInStack ( s , arr , n ) ) Console . Write ( " YES STRNEWLINE " ) ; else Console . Write ( " NO STRNEWLINE " ) ; } }

Index/key variables: i, poppedEle
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int longDelSub ( string str1 , string str2 ) { int N = str1 . Length ; int M = str2 . Length ; int prev_pos = 0 ; int [ ] pos = new int [ M ] ; for ( int i = 0 ; i < M ; i ++ ) { int index = prev_pos ; while ( index < N && str1 [ index ] != str2 [ i ] ) { index ++ ; } pos [ i ] = index ; prev_pos = index + 1 ; } int res = N - prev_pos ; prev_pos = N - 1 ; for ( int i = M - 1 ; i >= 0 ; i -- ) { int index = prev_pos ; while ( index >= 0 && str1 [ index ] != str2 [ i ] ) { index -- ; } if ( i != 0 ) { res = Math . Max ( res , index - pos [ i - 1 ] - 1 ) ; } prev_pos = index - 1 ; } res = Math . Max ( res , prev_pos + 1 ) ; return res ; } public static void Main ( ) { string str1 = " GeeksforGeeks " ; string str2 = " forks " ; Console . Write ( longDelSub ( str1 , str2 ) ) ; } }

Index/key variables: M, i, index
Accumulator variables: i, index
Iterator variables: i
Class/struct names: GFG