dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { public static int countTriplets ( int [ ] arr , int n , int a , int b ) { int ans = 0 ; for ( int i = 0 ; i < n - 2 ; i ++ ) { for ( int j = i + 1 ; j < n - 1 ; j ++ ) { for ( int k = j + 1 ; k < n ; k ++ ) { if ( arr [ i ] + arr [ j ] + arr [ k ] >= a && arr [ i ] + arr [ j ] + arr [ k ] <= b ) { ans ++ ; } } } } return ans ; } public static void Main ( ) { int [ ] arr = { 2 , 7 , 5 , 3 , 8 , 4 , 1 , 9 } ; int n = arr . Length ; int a = 8 , b = 16 ; Console . WriteLine ( " " + countTriplets ( arr , n , a , b ) ) ; } }

Index/key variables: i, j, k
Accumulator variables: ans, i, j, k
Iterator variables: i, j, k
Class/struct names: GFG
C# program:
using System ; class GFG { public static int countTripletsLessThan ( int [ ] arr , int n , int val ) { Array . Sort ( arr ) ; int ans = 0 ; int j , k ; int sum ; for ( int i = 0 ; i < n - 2 ; i ++ ) { j = i + 1 ; k = n - 1 ; while ( j != k ) { sum = arr [ i ] + arr [ j ] + arr [ k ] ; if ( sum > val ) k -- ; else { ans += ( k - j ) ; j ++ ; } } } return ans ; } public static int countTriplets ( int [ ] arr , int n , int a , int b ) { int res ; res = countTripletsLessThan ( arr , n , b ) - countTripletsLessThan ( arr , n , a - 1 ) ; return res ; } public static void Main ( ) { int [ ] arr = { 2 , 7 , 5 , 3 , 8 , 4 , 1 , 9 } ; int n = arr . Length ; int a = 8 , b = 16 ; Console . WriteLine ( " " + countTriplets ( arr , n , a , b ) ) ; } }

Index/key variables: i, j, k
Accumulator variables: ans, i, j, k
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static bool areSame ( int [ ] a , int [ ] b ) { if ( a . Length != b . Length ) return false ; Dictionary < int , int > m1 , m2 ; m1 = new Dictionary < int , int > ( ) ; m2 = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < a . Length ; i ++ ) { if ( m1 . ContainsKey ( a [ i ] ) ) { m1 [ a [ i ] ] = m1 [ a [ i ] ] + 1 ; } else { m1 . Add ( a [ i ] , 1 ) ; } if ( m2 . ContainsKey ( b [ i ] ) ) { m2 [ b [ i ] ] = m2 [ b [ i ] ] + 1 ; } else { m2 . Add ( b [ i ] , 1 ) ; } } foreach ( KeyValuePair < int , int > x in m1 ) { if ( ! m2 . ContainsKey ( x . Key ) m2 [ x . Key ] != x . Value ) return false ; } return true ; } public static void Main ( String [ ] args ) { int [ ] a = { 7 , 7 , 5 } ; int [ ] b = { 7 , 7 , 5 } ; if ( areSame ( a , b ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i, x
Class/struct names: GFG
C# program:
using System ; class GFG { static int MaxTotalRectangleArea ( int [ ] a , int n ) { Array . Sort ( a ) ; Array . Reverse ( a ) ; int sum = 0 ; bool flag = false ; int len = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( ( a [ i ] == a [ i + 1 ] a [ i ] - a [ i + 1 ] == 1 ) && ( ! flag ) ) { flag = true ; len = a [ i + 1 ] ; i ++ ; } else if ( ( a [ i ] == a [ i + 1 ] a [ i ] - a [ i + 1 ] == 1 ) && ( flag ) ) { sum = sum + a [ i + 1 ] * len ; flag = false ; i ++ ; } } return sum ; } static public void Main ( ) { int [ ] a = { 10 , 10 , 10 , 10 , 11 , 10 , 11 , 10 , 9 , 9 , 8 , 8 } ; int n = a . Length ; Console . WriteLine ( MaxTotalRectangleArea ( a , n ) ) ; } }

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 evenOddInsertionSort ( int [ ] arr , int n ) { for ( int i = 2 ; i < n ; i ++ ) { int j = i - 2 ; int temp = arr [ i ] ; if ( ( ( i + 1 ) & 1 ) == 1 ) { while ( j >= 0 && temp >= arr [ j ] ) { arr [ j + 2 ] = arr [ j ] ; j -= 2 ; } arr [ j + 2 ] = temp ; } else { while ( j >= 0 && temp <= arr [ j ] ) { arr [ j + 2 ] = arr [ j ] ; j -= 2 ; } arr [ j + 2 ] = temp ; } } } static void printArray ( int [ ] arr , int n ) { for ( int i = 0 ; i < n ; i ++ ) { Console . Write ( " { 0 } ▁ " , arr [ i ] ) ; } Console . Write ( " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 12 , 11 , 13 , 5 , 6 } ; int n = arr . Length ; evenOddInsertionSort ( arr , n ) ; printArray ( arr , n ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void print ( List < int > a , int n ) { for ( int i = 0 ; i <= n ; i ++ ) Console . Write ( a [ i ] + " ▁ " ) ; Console . WriteLine ( ) ; } static void sort ( List < int > a , int n ) { for ( int i = n ; i >= 0 ; i -- ) for ( int j = n ; j > n - i ; j -- ) if ( a [ j ] > a [ j - 1 ] ) { int tempswap = a [ j ] ; a [ j ] = a [ j - 1 ] ; a [ j - 1 ] = tempswap ; } print ( a , n ) ; } static void Main ( ) { int n = 6 ; List < int > a = new List < int > ( ) ; a . Add ( 2 ) ; a . Add ( 4 ) ; a . Add ( 3 ) ; a . Add ( 2 ) ; a . Add ( 4 ) ; a . Add ( 5 ) ; a . Add ( 3 ) ; sort ( a , n ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void operations ( int [ ] arr , int n , int k ) { Array . Sort ( arr ) ; int i = 0 , sum = 0 ; while ( k -- > 0 ) { while ( i < n && arr [ i ] - sum == 0 ) i ++ ; if ( i < n && arr [ i ] - sum > 0 ) { Console . Write ( arr [ i ] - sum + " ▁ " ) ; sum = arr [ i ] ; } else Console . WriteLine ( "0" ) ; } } public static void Main ( String [ ] args ) { int k = 5 ; int [ ] arr = { 3 , 6 , 4 , 2 } ; int n = arr . Length ; operations ( arr , n , k ) ; } }

Index/key variables: i
Accumulator variables: i, k
Class/struct names: GFG
C# program:
using System ; public class GfG { public static void sort012 ( int [ ] arr , int n ) { int count0 = 0 , count1 = 0 ; int count2 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] == 0 ) count0 ++ ; if ( arr [ i ] == 1 ) count1 ++ ; if ( arr [ i ] == 2 ) count2 ++ ; } for ( int i = 0 ; i < count0 ; i ++ ) arr [ i ] = 0 ; for ( int i = count0 ; i < ( count0 + count1 ) ; i ++ ) arr [ i ] = 1 ; for ( int i = ( count0 + count1 ) ; i < n ; i ++ ) arr [ i ] = 2 ; printArray ( arr , n ) ; } public static void printArray ( int [ ] arr , int n ) { for ( int i = 0 ; i < n ; i ++ ) Console . Write ( arr [ i ] + " ▁ " ) ; Console . WriteLine ( ) ; } public static void Main ( ) { int [ ] arr = { 0 , 1 , 1 , 0 , 1 , 2 , 1 , 2 , 0 , 0 , 0 , 1 } ; int n = 12 ; sort012 ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: count0, count1, count2, i
Iterator variables: i
Class/struct names: GfG
C# program:
using System ; public class GFG { private static int MAX = 100 ; static String alternateSort ( String s1 ) { int n = s1 . Length ; int l = 0 , j = 0 , k = 0 ; char [ ] s = s1 . ToCharArray ( ) ; int [ ] lCount = new int [ MAX ] ; int [ ] uCount = new int [ MAX ] ; for ( int i = 0 ; i < n ; i ++ ) { if ( char . IsUpper ( s [ i ] ) ) uCount [ s [ i ] - ' A ' ] ++ ; else lCount [ s [ i ] - ' a ' ] ++ ; } while ( k < n ) { while ( l < MAX && uCount [ l ] == 0 ) l ++ ; if ( l < MAX ) { s [ k ++ ] = ( char ) ( ' A ' + l ) ; uCount [ l ] -- ; } while ( j < MAX && lCount [ j ] == 0 ) j ++ ; if ( j < MAX ) { s [ k ++ ] = ( char ) ( ' a ' + j ) ; lCount [ j ] -- ; } } return ( new String ( s ) ) ; } public static void Main ( ) { String str = " bAwutndekWEdkd " ; Console . Write ( alternateSort ( str ) ) ; } }

Index/key variables: MAX, i, j, l
Accumulator variables: i, j, k, l
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int distancesum ( int [ ] x , int [ ] y , int n ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) for ( int j = i + 1 ; j < n ; j ++ ) sum += ( Math . Abs ( x [ i ] - x [ j ] ) + Math . Abs ( y [ i ] - y [ j ] ) ) ; return sum ; } public static void Main ( ) { int [ ] x = { - 1 , 1 , 3 , 2 } ; int [ ] y = { 5 , 6 , 5 , 3 } ; int n = x . Length ; Console . WriteLine ( distancesum ( x , y , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, sum
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int distancesum ( int [ ] arr , int n ) { Array . Sort ( arr ) ; int res = 0 , sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { res += ( arr [ i ] * i - sum ) ; sum += arr [ i ] ; } return res ; } static int totaldistancesum ( int [ ] x , int [ ] y , int n ) { return distancesum ( x , n ) + distancesum ( y , n ) ; } public static void Main ( ) { int [ ] x = { - 1 , 1 , 3 , 2 } ; int [ ] y = { 5 , 6 , 5 , 3 } ; int n = x . Length ; Console . WriteLine ( totaldistancesum ( x , y , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, res, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void sortRec ( int [ ] arr , int index , int k , int n ) { if ( k == 0 ) { for ( int i = 1 ; i < n ; i ++ ) Console . Write ( arr [ i ] + " ▁ " ) ; Console . WriteLine ( 999 ) ; return ; } else if ( k > 0 && index == 0 ) { index = n - 2 ; for ( int i = 1 ; i <= index ; i ++ ) { arr [ i - 1 ] = arr [ i ] ; } arr [ index ] = 999 ; } if ( index - 1 >= 0 && index + 1 < n && arr [ index - 1 ] > arr [ index + 1 ] ) { swap ( arr , index , index + 1 ) ; swap ( arr , index - 1 , index + 1 ) ; } else swap ( arr , index , index - 1 ) ; sortRec ( arr , index - 1 , k - 1 , n ) ; } static int [ ] swap ( int [ ] arr , int i , int j ) { int temp = arr [ i ] ; arr [ i ] = arr [ j ] ; arr [ j ] = temp ; return arr ; } static void sort ( int [ ] arr , int n ) { int index = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] == 999 ) { index = i ; break ; } } if ( index == - 1 ) return ; sortRec ( arr , index , n , n ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 3 , 2 , 999 , 1 } ; int n = arr . Length ; sort ( arr , n ) ; } }

Index/key variables: i, index, j
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void unsort ( int l , int r , int [ ] a , int k ) { if ( k < 1 l + 1 == r ) return ; k -= 2 ; int mid = ( l + r ) / 2 ; int temp = a [ mid - 1 ] ; a [ mid - 1 ] = a [ mid ] ; a [ mid ] = temp ; unsort ( l , mid , a , k ) ; unsort ( mid , r , a , k ) ; } static void arrayWithKCalls ( int n , int k ) { if ( k % 2 == 0 ) { Console . WriteLine ( " NO ▁ SOLUTION " ) ; return ; } int [ ] a = new int [ n + 1 ] ; a [ 0 ] = 1 ; for ( int i = 1 ; i < n ; i ++ ) a [ i ] = i + 1 ; k -- ; unsort ( 0 , n , a , k ) ; for ( int i = 0 ; i < n ; ++ i ) Console . Write ( a [ i ] + " ▁ " ) ; } public static void Main ( ) { int n = 10 , k = 17 ; arrayWithKCalls ( n , k ) ; } }

Index/key variables: i, mid
Accumulator variables: i, k
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX_CHAR = 26 ; static void sortString ( String str ) { int [ ] charCount = new int [ MAX_CHAR ] ; for ( int i = 0 ; i < str . Length ; i ++ ) { charCount [ str [ i ] - ' a ' ] ++ ; } for ( int i = MAX_CHAR - 1 ; i >= 0 ; i -- ) { for ( int j = 0 ; j < charCount [ i ] ; j ++ ) { Console . Write ( ( char ) ( ' a ' + i ) ) ; } } } public static void Main ( String [ ] args ) { String s = " alkasingh " ; sortString ( s ) ; } }

Index/key variables: MAX_CHAR, i
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void printMedian ( int [ ] arr , int n , int K ) { Array . Sort ( arr ) ; Console . Write ( arr [ ( n + K ) / 2 ] ) ; } public static void Main ( ) { int [ ] arr = { 5 , 3 , 2 , 8 } ; int k = 3 ; int n = arr . Length ; printMedian ( arr , n , k ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void minMaxSelectionSort ( int [ ] arr , int n ) { for ( int i = 0 , j = n - 1 ; i < j ; i ++ , j -- ) { int min = arr [ i ] , max = arr [ i ] ; int min_i = i , max_i = i ; for ( int k = i ; k <= j ; k ++ ) { if ( arr [ k ] > max ) { max = arr [ k ] ; max_i = k ; } else if ( arr [ k ] < min ) { min = arr [ k ] ; min_i = k ; } } swap ( arr , i , min_i ) ; if ( arr [ min_i ] == max ) swap ( arr , j , min_i ) ; else swap ( arr , j , max_i ) ; } } static int [ ] swap ( int [ ] arr , int i , int j ) { int temp = arr [ i ] ; arr [ i ] = arr [ j ] ; arr [ j ] = temp ; return arr ; } public static void Main ( String [ ] args ) { int [ ] arr = { 23 , 78 , 45 , 8 , 32 , 56 , 1 } ; int n = arr . Length ; minMaxSelectionSort ( arr , n ) ; Console . Write ( " Sorted ▁ array : STRNEWLINE " ) ; for ( int i = 0 ; i < n ; i ++ ) Console . Write ( arr [ i ] + " ▁ " ) ; Console . WriteLine ( " " ) ; } }

Index/key variables: i, j, k, min_i
Accumulator variables: i, j, k
Iterator variables: i, k
Class/struct names: GFG
C# program:
using System ; public class GFG { static void mergeArray ( int [ ] a , int [ ] b , int n , int m ) { int mx = 0 ; for ( int I = 0 ; I < n ; I ++ ) { mx = Math . Max ( mx , a [ I ] ) ; } for ( int I = 0 ; I < m ; I ++ ) { mx = Math . Max ( mx , b [ I ] ) ; } mx ++ ; int i = 0 , j = 0 , k = 0 ; while ( i < n && j < m && k < ( n + m ) ) { int e1 = a [ i ] % mx ; int e2 = b [ j ] % mx ; if ( e1 <= e2 ) { if ( k < n ) a [ k ] += ( e1 * mx ) ; else b [ k - n ] += ( e1 * mx ) ; i ++ ; k ++ ; } else { if ( k < n ) a [ k ] += ( e2 * mx ) ; else b [ k - n ] += ( e2 * mx ) ; j ++ ; k ++ ; } } while ( i < n ) { int el = a [ i ] % mx ; if ( k < n ) a [ k ] += ( el * mx ) ; else b [ k - n ] += ( el * mx ) ; i ++ ; k ++ ; } while ( j < m ) { int el = b [ j ] % mx ; if ( k < n ) b [ k ] += ( el * mx ) ; else b [ k - n ] += ( el * mx ) ; j ++ ; k ++ ; } for ( int In = 0 ; In < n ; In ++ ) a [ In ] = a [ In ] / mx ; for ( int In = 0 ; In < m ; In ++ ) b [ In ] = b [ In ] / mx ; return ; } static public void Main ( ) { int [ ] a = { 3 , 5 , 6 , 8 , 12 } ; int [ ] b = { 1 , 4 , 9 , 13 } ; int n = a . Length ; int m = b . Length ; mergeArray ( a , b , n , m ) ; Console . Write ( " First ▁ array ▁ : ▁ " ) ; for ( int i = 0 ; i < n ; i ++ ) Console . Write ( a [ i ] + " ▁ " ) ; Console . WriteLine ( ) ; Console . Write ( " Second ▁ array ▁ : ▁ " ) ; for ( int i = 0 ; i < m ; i ++ ) Console . Write ( b [ i ] + " ▁ " ) ; Console . WriteLine ( ) ; } }

Index/key variables: I, In, i, j, k
Accumulator variables: I, In, i, j, k, mx
Iterator variables: I, In, i
Class/struct names: GFG
C# program:
using System ; class GFG { static void arrange ( int [ ] arr , int n , int x ) { for ( int i = 1 ; i < n ; i ++ ) { int diff = Math . Abs ( arr [ i ] - x ) ; int j = i - 1 ; if ( Math . Abs ( arr [ j ] - x ) > diff ) { int temp = arr [ i ] ; while ( j >= 0 && Math . Abs ( arr [ j ] - x ) > diff ) { arr [ j + 1 ] = arr [ j ] ; j -- ; } arr [ j + 1 ] = temp ; } } } static void print ( int [ ] arr , int n ) { for ( int i = 0 ; i < n ; i ++ ) Console . Write ( arr [ i ] + " ▁ " ) ; } public static void Main ( ) { int [ ] arr = { 10 , 5 , 3 , 9 , 2 } ; int n = arr . Length ; int x = 7 ; arrange ( arr , n , x ) ; print ( arr , n ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GfG { static Boolean check ( String [ ] v , int len ) { int n = v . Length ; char [ ] tempArray ; for ( int i = 0 ; i < n ; i ++ ) { tempArray = v [ i ] . ToCharArray ( ) ; Array . Sort ( tempArray ) ; v [ i ] = new String ( tempArray ) ; } for ( int i = 0 ; i < len - 1 ; i ++ ) for ( int j = 0 ; j < n ; j ++ ) if ( v [ i ] [ j ] > v [ i + 1 ] [ j ] ) return false ; return true ; } public static void Main ( String [ ] args ) { String [ ] v = { " ebcda " , " ihgfj " , " klmno " , " pqrst " , " yvwxu " } ; if ( check ( v , len ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GfG
C# program:
using System ; class GFG { static void printOrder ( int [ ] arr , int n ) { Array . Sort ( arr ) ; for ( int i = 0 ; i < n / 2 ; i ++ ) Console . Write ( arr [ i ] + " ▁ " ) ; for ( int j = n - 1 ; j >= n / 2 ; j -- ) Console . Write ( arr [ j ] + " ▁ " ) ; } public static void Main ( ) { int [ ] arr = { 5 , 4 , 6 , 2 , 1 , 3 , 8 , - 1 } ; int n = arr . Length ; printOrder ( arr , n ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { public class Pair { public int first , second ; public Pair ( int first , int second ) { this . first = first ; this . second = second ; } } static Pair findSubArray ( int [ ] arr , int n ) { int start = 0 , end = 0 , min_sum = int . MaxValue ; for ( int i = 0 ; i < n ; i ++ ) { int curr_sum = arr [ i ] ; if ( min_sum > Math . Abs ( curr_sum ) ) { min_sum = Math . Abs ( curr_sum ) ; start = i ; end = i ; } for ( int j = i + 1 ; j < n ; j ++ ) { curr_sum = curr_sum + arr [ j ] ; if ( min_sum > Math . Abs ( curr_sum ) ) { min_sum = Math . Abs ( curr_sum ) ; start = i ; end = j ; } } } Pair p = new Pair ( start , end ) ; return p ; } public static void Main ( String [ ] args ) { int [ ] arr = { 2 , - 5 , 4 , - 6 , - 3 } ; int n = arr . Length ; Pair point = findSubArray ( arr , n ) ; Console . WriteLine ( " Subarray ▁ starting ▁ from ▁ " + point . first + " ▁ to ▁ " + point . second ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG, Pair
C# program:
using System ; class GFG { public String [ ] uniquePrefix ( String [ ] a ) { int size = a . Length ; String [ ] res = new String [ size ] ; Array . Sort ( a ) ; int j = 0 ; while ( j < Math . Min ( a [ 0 ] . Length - 1 , a [ 1 ] . Length - 1 ) ) { if ( a [ 0 ] [ j ] == a [ 1 ] [ j ] ) j ++ ; else break ; } int ind = 0 ; res [ ind ++ ] = a [ 0 ] . Substring ( 0 , j + 1 ) ; String temp_prefix = a [ 1 ] . Substring ( 0 , j + 1 ) ; for ( int i = 1 ; i < size - 1 ; i ++ ) { j = 0 ; while ( j < Math . Min ( a [ i ] . Length - 1 , a [ i + 1 ] . Length - 1 ) ) { if ( a [ i ] [ j ] == a [ i + 1 ] [ j ] ) j ++ ; else break ; } String new_prefix = a [ i ] . Substring ( 0 , j + 1 ) ; if ( temp_prefix . Length > new_prefix . Length ) res [ ind ++ ] = temp_prefix ; else res [ ind ++ ] = new_prefix ; temp_prefix = a [ i + 1 ] . Substring ( 0 , j + 1 ) ; } j = 0 ; String sec_last = a [ size - 2 ] ; String last = a [ size - 1 ] ; while ( j < Math . Min ( sec_last . Length - 1 , last . Length - 1 ) ) { if ( sec_last [ j ] == last [ j ] ) j ++ ; else break ; } res [ ind ] = last . Substring ( 0 , j + 1 ) ; return res ; } public static void Main ( String [ ] args ) { GFG gfg = new GFG ( ) ; String [ ] input = { " zebra " , " dog " , " duck " , " dove " } ; String [ ] output = gfg . uniquePrefix ( input ) ; Console . WriteLine ( " The ▁ shortest ▁ unique ▁ prefixes " + " ▁ in ▁ sorted ▁ order ▁ are ▁ : " ) ; for ( int i = 0 ; i < output . Length ; i ++ ) Console . Write ( output [ i ] + " ▁ " ) ; } }

Index/key variables: i, ind, j, size
Accumulator variables: i, ind, j
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static int findMinimum ( int [ ] arr , int n , int k ) { int res = 0 ; for ( int i = 0 ; i < n ; i ++ ) { res += arr [ i ] ; n = n - k ; } return res ; } static int findMaximum ( int [ ] arr , int n , int k ) { int res = 0 , index = 0 ; for ( int i = n - 1 ; i >= index ; i -- ) { res += arr [ i ] ; index += k ; } return res ; } public static void Main ( ) { int [ ] arr = { 3 , 2 , 1 , 4 } ; int n = arr . Length ; int k = 2 ; Array . Sort ( arr ) ; Console . WriteLine ( findMinimum ( arr , n , k ) + " ▁ " + findMaximum ( arr , n , k ) ) ; } }

Index/key variables: i
Accumulator variables: i, index, res
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static void printInSortedOrder ( String [ ] arr , int n ) { int [ ] index = new int [ n ] ; int i , j , min ; for ( i = 0 ; i < n ; i ++ ) { index [ i ] = i ; } for ( i = 0 ; i < n - 1 ; i ++ ) { min = i ; for ( j = i + 1 ; j < n ; j ++ ) { if ( arr [ index [ min ] ] . CompareTo ( arr [ index [ j ] ] ) > 0 ) { min = j ; } } if ( min != i ) { int temp = index [ min ] ; index [ min ] = index [ i ] ; index [ i ] = temp ; } } for ( i = 0 ; i < n ; i ++ ) { Console . Write ( arr [ index [ i ] ] + " ▁ " ) ; } } static public void Main ( ) { String [ ] arr = { " geeks " , " quiz " , " geeks " , " for " } ; int n = 4 ; printInSortedOrder ( arr , n ) ; } }

Index/key variables: i, j, min, n
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; public class GFG { static int maxLevel ( int [ ] boxes , int n ) { Array . Sort ( boxes ) ; int prev_width = boxes [ 0 ] ; int prev_count = 1 ; int curr_count = 0 ; int curr_width = 0 ; for ( int i = 1 ; i < n ; i ++ ) { curr_width += boxes [ i ] ; curr_count += 1 ; if ( curr_width > prev_width && curr_count > prev_count ) { prev_width = curr_width ; prev_count = curr_count ; curr_count = 0 ; curr_width = 0 ; ans ++ ; } } return ans ; } static public void Main ( ) { int [ ] boxes = { 10 , 20 , 30 , 50 , 60 , 70 } ; int n = boxes . Length ; Console . WriteLine ( maxLevel ( boxes , n ) ) ; } }

Index/key variables: i
Accumulator variables: ans, curr_count, curr_width, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX_SIZE = 10 ; static void sortArrayUsingCounts ( int [ ] arr , int n ) { int [ ] count = new int [ MAX_SIZE ] ; for ( int i = 0 ; i < n ; i ++ ) { count [ arr [ i ] ] ++ ; } int index = 0 ; for ( int i = 0 ; i < MAX_SIZE ; i ++ ) { while ( count [ i ] > 0 ) { arr [ index ++ ] = i ; count [ i ] -- ; } } } static void removeAndPrintResult ( int [ ] arr , int n , int ind1 , int ind2 ) { for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( i != ind1 && i != ind2 ) { Console . Write ( arr [ i ] ) ; } } } static Boolean largest3Multiple ( int [ ] arr , int n ) { int sum = accumulate ( arr , 0 , n ) ; if ( sum % 3 == 0 ) { return true ; } sortArrayUsingCounts ( arr , n ) ; int remainder = sum % 3 ; if ( remainder == 1 ) { int [ ] rem_2 = new int [ 2 ] ; rem_2 [ 0 ] = - 1 ; rem_2 [ 1 ] = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] % 3 == 1 ) { removeAndPrintResult ( arr , n , i , - 1 ) ; return true ; } if ( arr [ i ] % 3 == 2 ) { if ( rem_2 [ 0 ] == - 1 ) { rem_2 [ 0 ] = i ; } else if ( rem_2 [ 1 ] == - 1 ) { rem_2 [ 1 ] = i ; } } } if ( rem_2 [ 0 ] != - 1 && rem_2 [ 1 ] != - 1 ) { removeAndPrintResult ( arr , n , rem_2 [ 0 ] , rem_2 [ 1 ] ) ; return true ; } } else if ( remainder == 2 ) { int [ ] rem_1 = new int [ 2 ] ; rem_1 [ 0 ] = - 1 ; rem_1 [ 1 ] = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] % 3 == 2 ) { removeAndPrintResult ( arr , n , i , - 1 ) ; return true ; } if ( arr [ i ] % 3 == 1 ) { if ( rem_1 [ 0 ] == - 1 ) { rem_1 [ 0 ] = i ; } else if ( rem_1 [ 1 ] == - 1 ) { rem_1 [ 1 ] = i ; } } } if ( rem_1 [ 0 ] != - 1 && rem_1 [ 1 ] != - 1 ) { removeAndPrintResult ( arr , n , rem_1 [ 0 ] , rem_1 [ 1 ] ) ; return true ; } } Console . Write ( " Not ▁ possible " ) ; return false ; } static int accumulate ( int [ ] arr , int start , int end ) { int sum = 0 ; for ( int i = 0 ; i < arr . Length ; i ++ ) { sum += arr [ i ] ; } return sum ; } public static void Main ( String [ ] args ) { int [ ] arr = { 4 , 4 , 1 , 1 , 1 , 3 } ; int n = arr . Length ; largest3Multiple ( arr , n ) ; } }

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