dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; using System . Collections . Generic ; public class GFG { static void sortStr ( String str ) { char [ ] S = str . ToCharArray ( ) ; int N = S . Length ; List < char > temp = new List < char > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( S [ i ] != ' a ' && S [ i ] != ' e ' && S [ i ] != ' i ' && S [ i ] != ' o ' && S [ i ] != ' u ' ) temp . Add ( S [ i ] ) ; } if ( temp . Count != 0 ) temp . Sort ( ) ; int ptr = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( S [ i ] != ' a ' && S [ i ] != ' e ' && S [ i ] != ' i ' && S [ i ] != ' o ' && S [ i ] != ' u ' ) S [ i ] = temp [ ptr ++ ] ; } Console . WriteLine ( new String ( S ) ) ; } public static void Main ( String [ ] args ) { String S = " geeksforgeeks " ; sortStr ( S ) ; } }

Index/key variables: i
Accumulator variables: i, ptr
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int upper_bound ( int [ ] arr , int key ) { int l = - 1 , r = arr . Length ; while ( l + 1 < r ) { int m = ( l + r ) >> 1 ; if ( arr [ m ] <= key ) l = m ; else r = m ; } return l + 1 ; } static void countPairs ( int [ ] arr , int n , int k ) { Array . Sort ( arr ) ; int ans = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { int high = upper_bound ( arr , k * arr [ i ] ) ; ans += high - i - 1 ; } Console . WriteLine ( ans ) ; } public static void Main ( ) { int [ ] arr = { 2 , 3 , 9 , 5 } ; int n = arr . Length ; int k = 2 ; countPairs ( arr , n , k ) ; } }

Index/key variables: i, m
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void findXOR ( int [ , ] mat , int K ) { int N = mat . GetLength ( 0 ) ; int M = mat . GetLength ( 1 ) ; List < int > digXOR = new List < int > ( ) ; for ( int l = 1 ; l <= ( N + M - 1 ) ; l ++ ) { int s_col = Math . Max ( 0 , l - N ) ; int count = Math . Min ( l , Math . Min ( ( M - s_col ) , N ) ) ; int currXOR = 0 ; for ( int j = 0 ; j < count ; j ++ ) { currXOR = ( currXOR ^ mat [ Math . Min ( N , l ) - j - 1 , s_col + j ] ) ; } digXOR . Add ( currXOR ) ; } digXOR . Sort ( ) ; Console . Write ( digXOR [ N + M - 1 - K ] ) ; } public static void Main ( String [ ] args ) { int [ , ] mat = { { 1 , 2 , 3 } , { 4 , 5 , 6 } , { 7 , 8 , 9 } } ; int K = 3 ; findXOR ( mat , K ) ; } }

Accumulator variables: j, l
Iterator variables: j, l
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void maximumSum ( int [ ] arr , int N ) { int sum ; Array . Sort ( arr ) ; sum = ( arr [ N - 1 ] - arr [ 0 ] ) + ( arr [ N - 2 ] - arr [ 0 ] ) + ( arr [ N - 1 ] - arr [ N - 2 ] ) ; Console . Write ( sum ) ; } public static void Main ( ) { int [ ] arr = { 1 , 3 , 4 , 2 } ; int N = arr . Length ; maximumSum ( arr , N ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class pair : IComparable < pair > { public int first , second , third ; public pair ( int first , int second , int third ) { this . first = first ; this . second = second ; this . third = third ; } public int CompareTo ( pair p ) { return this . second - p . first ; } } class GFG { static int findSum ( List < pair > v , int n ) { Dictionary < int , Boolean > um = new Dictionary < int , Boolean > ( ) ; int res = 0 ; int cnt = 0 ; for ( int i = 0 ; i < v . Count ; i ++ ) { if ( cnt == n ) break ; int x = v [ i ] . second ; int y = v [ i ] . third ; int xorResult = v [ i ] . first ; if ( ! um . ContainsKey ( x ) && ! um . ContainsKey ( y ) ) { res += xorResult ; um . Add ( x , true ) ; um . Add ( y , true ) ; cnt += 2 ; } } return res ; } static void findMaxMinSum ( int [ ] a , int n ) { List < pair > v = new List < pair > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { int xorResult = a [ i ] ^ a [ j ] ; v . Add ( new pair ( xorResult , a [ i ] , a [ j ] ) ) ; } } v . Sort ( ) ; int maxi = 0 , mini = 0 ; mini = findSum ( v , n ) ; v . Reverse ( ) ; maxi = findSum ( v , n ) ; Console . Write ( mini + " ▁ " + maxi ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 4 } ; int N = arr . Length ; findMaxMinSum ( arr , N ) ; } }

Index/key variables: i, j
Accumulator variables: cnt, i, j, res
Iterator variables: i, j
Class/struct names: GFG, pair
C# program:
using System ; class GFG { static void maximumSumPermutation ( int [ ] arr ) { int N = arr . Length ; Array . Sort ( arr ) ; int temp = arr [ 0 ] ; arr [ 0 ] = arr [ N - 1 ] ; arr [ N - 1 ] = temp ; foreach ( int i in arr ) { Console . Write ( i + " ▁ " ) ; } } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 4 , 5 } ; maximumSumPermutation ( arr ) ; } }

Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static void findMaxNumbers ( int [ ] arr , int n , int k ) { Array . Sort ( arr ) ; int cnt = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int opr = ( int ) Math . Ceiling ( ( Math . Log ( arr [ i ] ) / Math . Log ( 2 ) ) ) ; k -= opr ; if ( k < 0 ) { break ; } cnt ++ ; } Console . Write ( cnt ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 5 , 8 , 4 , 7 } ; int N = arr . Length ; int K = 5 ; findMaxNumbers ( arr , N , K ) ; } }

Index/key variables: i
Accumulator variables: cnt, i, k
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void meanOfRemainingElements ( int [ ] arr , int N , int K ) { Array . Sort ( arr ) ; int kthPercent = ( N * K ) / 100 ; float sum = 0f ; for ( int i = 0 ; i < N ; i ++ ) if ( i >= kthPercent && i < ( N - kthPercent ) ) sum += arr [ i ] ; float mean = ( sum / ( N - 2 * kthPercent ) ) ; Console . WriteLine ( Math . Round ( mean , 5 ) ) ; } public static void Main ( ) { int [ ] arr = { 6 , 2 , 7 , 5 , 1 , 2 , 0 , 3 , 10 , 2 , 5 , 0 , 5 , 5 , 0 , 8 , 7 , 6 , 8 , 0 } ; int arr_size = arr . Length ; int K = 5 ; meanOfRemainingElements ( arr , arr_size , K ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static void minOperation ( int [ ] a , int N ) { int totOps = 0 ; for ( int i = 0 ; i < N - 1 ; i ++ ) { totOps += Math . Abs ( a [ i ] - a [ i + 1 ] ) ; } int maxOps = Math . Max ( Math . Abs ( a [ 0 ] - a [ 1 ] ) , Math . Abs ( a [ N - 1 ] - a [ N - 2 ] ) ) ; for ( int i = 1 ; i < N - 1 ; i ++ ) { maxOps = Math . Max ( maxOps , Math . Abs ( a [ i ] - a [ i - 1 ] ) + Math . Abs ( a [ i ] - a [ i + 1 ] ) - Math . Abs ( a [ i - 1 ] - a [ i + 1 ] ) ) ; } Console . WriteLine ( totOps - maxOps ) ; } static public void Main ( ) { int [ ] arr = { 1 , - 1 , 0 , 1 , 1 } ; int N = arr . Length ; minOperation ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i, totOps
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static void maxIntersection ( int [ , ] segments , int N ) { int [ ] rvalues = new int [ N ] ; int [ ] lvalues = new int [ N ] ; for ( int i = 0 ; i < N ; ++ i ) { lvalues [ i ] = segments [ i , 0 ] ; rvalues [ i ] = segments [ i , 1 ] ; } Array . Sort ( lvalues ) ; Array . Sort ( rvalues ) ; int [ ] answer = { - 1 , - 1 } ; int numIntersections = 0 ; for ( int i = 0 ; i < N ; ++ i ) { int lesser = lower_bound ( rvalues , 0 , segments . GetLength ( 0 ) , segments [ i , 0 ] ) ; int greater = Math . Max ( 0 , N - ( upper_bound ( lvalues , 0 , segments . GetLength ( 0 ) , segments [ i , 1 ] ) ) ) ; if ( ( N - lesser - greater ) >= numIntersections ) { answer = new int [ ] { segments [ i , 0 ] , segments [ i , 1 ] } ; numIntersections = ( N - lesser - greater ) ; } } Console . Write ( answer [ 0 ] + " ▁ " + answer [ 1 ] ) ; } static int lower_bound ( int [ ] a , int low , int high , int element ) { while ( low < high ) { int middle = low + ( high - low ) / 2 ; if ( element > a [ middle ] ) low = middle + 1 ; else high = middle ; } return low ; } static int upper_bound ( int [ ] a , int low , int high , int element ) { while ( low < high ) { int middle = low + ( high - low ) / 2 ; if ( a [ middle ] > element ) high = middle ; else low = middle + 1 ; } return low ; } public static void Main ( String [ ] args ) { int [ , ] segments = { { 1 , 4 } , { 2 , 3 } , { 3 , 6 } } ; int N = segments . GetLength ( 0 ) ; maxIntersection ( segments , N ) ; } }

Index/key variables: N, i, middle
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int [ ] temp = new int [ 100000 ] ; static int merge ( int [ ] A , int left , int mid , int right ) { int swaps = 0 ; int i = left , j = mid , k = left ; while ( i < mid && j <= right ) { if ( A [ i ] <= A [ j ] ) { temp [ k ] = A [ i ] ; k ++ ; i ++ ; } else { temp [ k ] = A [ j ] ; k ++ ; j ++ ; swaps += mid - i ; } } while ( i < mid ) { temp [ k ] = A [ i ] ; k ++ ; i ++ ; } while ( j <= right ) { temp [ k ] = A [ j ] ; k ++ ; j ++ ; } while ( left <= right ) { A [ left ] = temp [ left ] ; left ++ ; } return swaps ; } static int mergeInsertionSwap ( int [ ] A , int left , int right ) { int swaps = 0 ; if ( left < right ) { int mid = left + ( right - left ) / 2 ; swaps += mergeInsertionSwap ( A , left , mid ) ; swaps += mergeInsertionSwap ( A , mid + 1 , right ) ; swaps += merge ( A , left , mid + 1 , right ) ; } return swaps ; } static public void Main ( ) { int [ ] A = { 2 , 1 , 3 , 1 , 2 } ; int N = A . Length ; Console . WriteLine ( mergeInsertionSwap ( A , 0 , N - 1 ) ) ; } }

Index/key variables: i, j, k, left
Accumulator variables: i, j, k, left, swaps
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class triplet : IComparable < triplet > { public int a , b , c ; public triplet ( int a , int b , int c ) { this . a = a ; this . b = b ; this . c = c ; } public int CompareTo ( triplet o ) { return this . a - o . a ; } } public class GFG { static int [ ] seg ; public void maxValue ( int [ ] a , int [ ] b , int n , int k ) { triplet [ ] arr = new triplet [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = new triplet ( a [ i ] , b [ i ] , a [ i ] + b [ i ] ) ; } Array . Sort ( arr ) ; seg = new int [ 4 * n ] ; build ( arr , 0 , 0 , n - 1 ) ; int maxvalue = int . MinValue ; for ( int i = 0 ; i < n ; i ++ ) { int right = search ( arr , arr [ i ] . a + k ) ; if ( right != - 1 ) { maxvalue = Math . Max ( maxvalue , arr [ i ] . b - arr [ i ] . a + getMax ( arr , 0 , 0 , n - 1 , i + 1 , right ) ) ; } } Console . WriteLine ( maxvalue ) ; } public int search ( triplet [ ] arr , int val ) { int low = 0 , high = arr . Length - 1 ; int ans = - 1 ; while ( low <= high ) { int mid = low + ( high - low ) / 2 ; if ( arr [ mid ] . a <= val ) { ans = mid ; low = mid + 1 ; } else high = mid - 1 ; } return ans ; } public static void build ( triplet [ ] arr , int index , int s , int e ) { if ( s == e ) { seg [ index ] = arr [ s ] . c ; return ; } int mid = s + ( e - s ) / 2 ; build ( arr , 2 * index + 1 , s , mid ) ; build ( arr , 2 * index + 2 , mid + 1 , e ) ; seg [ index ] = Math . Max ( seg [ 2 * index + 1 ] , seg [ 2 * index + 2 ] ) ; } public static int getMax ( triplet [ ] arr , int index , int s , int e , int qs , int qe ) { if ( qe < s < qs ) return int . MinValue / 2 ; if ( s >= qs && e <= qe ) return seg [ index ] ; int mid = s + ( e - s ) / 2 ; return Math . Max ( getMax ( arr , 2 * index + 1 , s , mid , qs , qe ) , getMax ( arr , 2 * index + 2 , mid + 1 , e , qs , qe ) ) ; } public static void Main ( String [ ] args ) { int N = 4 , K = 1 ; int [ ] A = { 5 , 6 , 9 , 10 } ; int [ ] B = { 3 , 0 , 10 , - 10 } ; new GFG ( ) . maxValue ( A , B , N , K ) ; } }

Index/key variables: i, index, mid, n, s
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG, triplet
C# program:
using System ; class GFG { static int maxCntRemovedfromArray ( int [ ] arr , int N , int [ ] brr , int M ) { Array . Sort ( arr ) ; int i = 0 ; int sumArr = 0 ; for ( i = 0 ; i < N ; i ++ ) { sumArr += arr [ i ] ; } int sumBrr = 0 ; for ( i = 0 ; i < M ; i ++ ) { sumBrr += brr [ i ] ; } int cntRemElem = 0 ; while ( i < N && sumArr >= sumBrr ) { sumArr -= arr [ i ] ; i += 1 ; if ( sumArr >= sumBrr ) { cntRemElem += 1 ; } } return cntRemElem ; } static public void Main ( ) { int [ ] arr = new int [ ] { 1 , 2 , 4 , 6 } ; int [ ] brr = new int [ ] { 7 } ; int N = arr . Length ; int M = brr . Length ; Console . WriteLine ( maxCntRemovedfromArray ( arr , N , brr , M ) ) ; } }

Index/key variables: i
Accumulator variables: cntRemElem, i, sumArr, sumBrr
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { class pair { public int first , second ; public pair ( int first , int second ) { this . first = first ; this . second = second ; } } static void findPair ( pair [ ] arr , int N ) { for ( int i = 0 ; i < N ; i ++ ) { int a = arr [ i ] . first , b = arr [ i ] . second ; for ( int j = i + 1 ; j < N ; j ++ ) { int c = arr [ j ] . first , d = arr [ j ] . second ; if ( a < c && b > d ) { Console . WriteLine ( " ( " + a + " ▁ " + b + " ) , ▁ ( " + c + " ▁ " + d + " ) " ) ; return ; } } } Console . WriteLine ( " NO ▁ SUCH ▁ PAIR ▁ EXIST " ) ; } public static void Main ( String [ ] args ) { pair [ ] arr = { new pair ( 3 , 7 ) , new pair ( 21 , 23 ) , new pair ( 4 , 13 ) , new pair ( 1 , 2 ) , new pair ( 7 , - 1 ) } ; findPair ( arr , 5 ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG, pair
C# program:
using System ; public class GFG { class pair : IComparable < pair > { public int first , second ; public pair ( int first , int second ) { this . first = first ; this . second = second ; } public int CompareTo ( pair p ) { return this . first - p . first ; } } static void findpair ( pair [ ] arr , int N ) { Array . Sort ( arr ) ; for ( int i = 1 ; i < N ; i ++ ) { int b = arr [ i - 1 ] . second ; int d = arr [ i ] . second ; if ( b > d ) { Console . Write ( " ( " + arr [ i - 1 ] . first + " ▁ " + b + " ) , ▁ ( " + arr [ i ] . first + " ▁ " + d + " ) " ) ; return ; } } Console . Write ( " NO ▁ SUCH ▁ PAIR ▁ EXIST STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { pair [ ] arr = { new pair ( 3 , 7 ) , new pair ( 21 , 23 ) , new pair ( 4 , 13 ) , new pair ( 1 , 2 ) , new pair ( 7 , - 1 ) } ; findpair ( arr , 5 ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG, pair
C# program:
using System ; using System . Collections . Generic ; class GFG { static void printOrder ( int [ ] order , int N , int X ) { List < Tuple < int , int > > vect = new List < Tuple < int , int > > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( order [ i ] % X == 0 ) { vect . Add ( new Tuple < int , int > ( ( order [ i ] / X ) , i + 1 ) ) ; } else { vect . Add ( new Tuple < int , int > ( ( order [ i ] / X + 1 ) , i + 1 ) ) ; } } vect . Sort ( ) ; for ( int i = 0 ; i < N ; i ++ ) { Console . Write ( vect [ i ] . Item2 + " ▁ " ) ; } Console . WriteLine ( ) ; } public static void Main ( ) { int N = 3 , X = 3 ; int [ ] order = { 2 , 7 , 4 } ; printOrder ( order , N , X ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static void reverse ( int [ ] arr , int start , int end ) { int mid = ( end - start + 1 ) / 2 ; for ( int i = 0 ; i < mid ; i ++ ) { int temp = arr [ start + i ] ; arr [ start + i ] = arr [ end - i ] ; arr [ end - i ] = temp ; } return ; } static void shuffleArrayUtil ( int [ ] arr , int start , int end ) { int l = end - start + 1 ; if ( l == 2 ) return ; int mid = start + l / 2 ; if ( l % 4 > 0 ) { mid -= 1 ; } int mid1 = start + ( mid - start ) / 2 ; int mid2 = mid + ( end + 1 - mid ) / 2 ; reverse ( arr , mid1 , mid2 - 1 ) ; reverse ( arr , mid1 , mid - 1 ) ; reverse ( arr , mid , mid2 - 1 ) ; shuffleArrayUtil ( arr , start , mid - 1 ) ; shuffleArrayUtil ( arr , mid , end ) ; } static void shuffleArray ( int [ ] arr , int N , int start , int end ) { shuffleArrayUtil ( arr , start , end ) ; for ( int i = 0 ; i < N ; i ++ ) Console . Write ( arr [ i ] + " ▁ " ) ; } static public void Main ( ) { int [ ] arr = { 1 , 3 , 5 , 2 , 4 , 6 } ; int N = arr . Length ; shuffleArray ( arr , N , 0 , N - 1 ) ; } }

Index/key variables: i
Accumulator variables: i, mid
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void rearrange ( int [ ] A , int [ ] B , int N , int X ) { bool flag = true ; Array . Sort ( A ) ; Array . Sort ( B ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( A [ i ] + B [ N - 1 - i ] > X ) { flag = false ; break ; } } if ( flag == true ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } public static void Main ( ) { int [ ] A = { 1 , 2 , 3 } ; int [ ] B = { 1 , 1 , 2 } ; int X = 4 ; int N = A . Length ; rearrange ( A , B , N , X ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Boolean variables: flag
Class/struct names: GFG
C# program:
using System ; class GFG { static void numOperation ( int [ ] arr , int N , int D ) { Array . Sort ( arr ) ; for ( int i = 0 ; i < N - 1 ; i ++ ) { if ( ( arr [ i + 1 ] - arr [ i ] ) % D != 0 ) { Console . WriteLine ( " - 1" ) ; return ; } } int count = 0 ; int mid = arr [ N / 2 ] ; for ( int i = 0 ; i < N ; i ++ ) { count += Math . Abs ( mid - arr [ i ] ) / D ; } Console . WriteLine ( count ) ; } static public void Main ( ) { int N = 4 , D = 2 ; int [ ] arr = new int [ ] { 2 , 4 , 6 , 8 } ; numOperation ( arr , N , D ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void findSum ( int [ ] A , int N , int K ) { Array . Sort ( A ) ; int sum = 0 ; for ( int i = N / K ; i < N ; i += K - 1 ) { sum += A [ i ] ; } Console . Write ( sum ) ; } public static void Main ( String [ ] args ) { int K = 4 ; int [ ] A = { 2 , 3 , 1 , 4 , 7 , 5 , 6 , 1 } ; int N = A . Length ; findSum ( A , N , K ) ; } }

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 findSmallestNumLeft ( int [ ] arr , int N ) { List < int > PQ = new List < int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { PQ . Add ( arr [ i ] ) ; } PQ . Sort ( ) ; PQ . Reverse ( ) ; while ( PQ . Count > 1 ) { int top1 = PQ [ 0 ] ; PQ . RemoveAt ( 0 ) ; int top2 = PQ [ 0 ] ; PQ . RemoveAt ( 0 ) ; PQ . Add ( ( top1 + top2 + 1 ) / 2 ) ; PQ . Sort ( ) ; PQ . Reverse ( ) ; } return PQ [ 0 ] ; } public static void Main ( ) { int [ ] arr = { 30 , 16 , 40 } ; int N = arr . Length ; Console . Write ( findSmallestNumLeft ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GfG
C# program:
using System ; using System . Collections . Generic ; class GFG { class pair : IComparable < pair > { public int first , second ; public pair ( int first , int second ) { this . first = first ; this . second = second ; } public int CompareTo ( pair p ) { return this . second - p . first ; } } static bool isComposite ( int n ) { if ( n <= 1 ) return false ; if ( n <= 3 ) return false ; if ( n % 2 == 0 n % 3 == 0 ) return true ; for ( int i = 5 ; i * i <= n ; i = i + 6 ) if ( n % i == 0 || n % ( i + 2 ) == 0 ) return true ; return false ; } static int digitProduct ( int number ) { int product = 1 ; while ( number > 0 ) { product *= ( number % 10 ) ; number /= 10 ; } return product ; } static bool compositedigitProduct ( int num ) { int res = digitProduct ( num ) ; if ( res == 1 ) { return false ; } if ( isComposite ( res ) ) { return true ; } return false ; } static int largestCompositeDigitProduct ( int [ ] a , int n , int k ) { List < pair > pq = new List < pair > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( ( i % k ) == 0 ) { continue ; } if ( compositedigitProduct ( a [ i ] ) ) { int b = digitProduct ( a [ i ] ) ; pq . Add ( new pair ( b , a [ i ] ) ) ; } } pq . Sort ( ) ; return pq [ pq . Count - 1 ] . second ; } public static void Main ( String [ ] args ) { int [ ] arr = { 233 , 144 , 89 , 71 , 13 , 21 , 11 , 34 , 55 , 23 } ; int n = arr . Length ; int k = 3 ; int ans = largestCompositeDigitProduct ( arr , n , k ) ; Console . Write ( ans + " STRNEWLINE " ) ; } }

Index/key variables: i
Accumulator variables: i, number, product
Iterator variables: i
Class/struct names: GFG, pair
C# program:
using System ; class GFG { public static void findMinimum ( int [ ] arr , int N , int K ) { Array . Sort ( arr ) ; int ans = 0 ; for ( int i = 1 ; i < 2 * ( N / K ) ; i += 2 ) { ans += arr [ i ] ; } Console . WriteLine ( ans ) ; } public static void Main ( ) { int [ ] arr = { 11 , 20 , 5 , 7 , 8 , 14 , 2 , 17 , 16 , 10 } ; int N = arr . Length ; int K = 5 ; findMinimum ( arr , N , K ) ; } }

Index/key variables: i
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void findSubarrays ( int [ ] arr , int N ) { Array . Sort ( arr ) ; int i = 0 ; for ( i = 0 ; i < N - 1 ; i ++ ) { if ( arr [ i ] == arr [ i + 1 ] ) { Console . WriteLine ( " YES " ) ; return ; } } Console . WriteLine ( " NO " ) ; } public static void Main ( ) { int [ ] arr = { 4 , 3 , 0 , 1 , 2 , 0 } ; int N = arr . Length ; findSubarrays ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static void Bubble_Sort ( int [ ] arr , int n ) { bool flag ; for ( int i = 1 ; i < n ; ++ i ) { flag = false ; for ( int j = 0 ; j <= ( n - i - 1 ) ; ++ j ) { if ( arr [ j ] > arr [ j + 1 ] ) { int temp = arr [ j ] ; arr [ j ] = arr [ j + 1 ] ; arr [ j + 1 ] = temp ; flag = true ; } } if ( flag == false ) break ; } } static public void Main ( ) { int n = 5 ; int [ ] arr = { 2 , 0 , 1 , 4 , 3 } ; Bubble_Sort ( arr , n ) ; Console . Write ( " The ▁ Sorted ▁ Array ▁ by ▁ using ▁ Bubble ▁ Sort ▁ is ▁ : ▁ " ) ; for ( int i = 0 ; i < n ; ++ i ) Console . Write ( arr [ i ] + " ▁ " ) ; } }

Index/key variables: i, j
Iterator variables: i, j
Boolean variables: flag
Class/struct names: GFG
C# program:
using System ; class GFG { static void NDivKWithFreq ( int [ ] arr , int N , int K ) { Array . Sort ( arr ) ; for ( int i = 0 ; i < N ; ) { int cnt = 1 ; while ( ( i + 1 ) < N && arr [ i ] == arr [ i + 1 ] ) { cnt ++ ; i ++ ; } if ( cnt > ( N / K ) ) { Console . Write ( arr [ i ] + " ▁ " ) ; } i ++ ; } } public static void Main ( ) { int [ ] arr = { 1 , 2 , 2 , 6 , 6 , 6 , 6 , 7 , 10 } ; int N = arr . Length ; int K = 4 ; NDivKWithFreq ( arr , N , K ) ; } }

Index/key variables: i
Accumulator variables: cnt, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void printCircularArray ( int [ ] arr , int n ) { for ( int i = 0 ; i < n ; i ++ ) { Console . Write ( arr [ i ] + " ▁ " ) ; } } static void sortCircularArray ( int [ ] arr , int n , int k , int m ) { for ( int i = 0 ; i < m ; i ++ ) { for ( int j = k ; j < k + m - 1 ; j ++ ) { if ( arr [ j % n ] > arr [ ( j + 1 ) % n ] ) { int t = arr [ j % n ] ; arr [ j % n ] = arr [ ( j + 1 ) % n ] ; arr [ ( j + 1 ) % n ] = t ; } } } printCircularArray ( arr , n ) ; } public static void Main ( string [ ] args ) { int [ ] arr = { 4 , 1 , 6 , 5 , 3 } ; int K = 2 , M = 3 ; int N = arr . Length ; sortCircularArray ( arr , N , K , M ) ; } }

Index/key variables: i
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int maximumKthLargestsumPart ( int [ ] arr , int N , int M , int K ) { int maxSum = 0 ; if ( N % M != 0 ) return - 1 ; int sz = ( N / M ) ; if ( K > sz ) return - 1 ; Array . Sort ( arr ) ; Array . Reverse ( arr ) ; for ( int i = 1 ; i <= M ; i ++ ) { maxSum += arr [ i * K - 1 ] ; } return maxSum ; } static void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 4 , 5 , 6 } ; int M = 2 ; int K = 1 ; int N = arr . Length ; Console . WriteLine ( maximumKthLargestsumPart ( arr , N , M , K ) ) ; } }

Accumulator variables: i, maxSum
Iterator variables: i
Class/struct names: GFG