dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static int MAX = 100000 ; static int findSumofEle ( int [ ] arr1 , int m , int [ ] arr2 , int n ) { int [ ] hash = new int [ MAX ] ; for ( int i = 0 ; i < n ; i ++ ) { hash [ arr2 [ i ] ] ++ ; } for ( int i = 1 ; i < MAX ; i ++ ) { hash [ i ] = hash [ i ] + hash [ i - 1 ] ; } int maximumFreq = 0 ; for ( int i = 0 ; i < m ; i ++ ) { maximumFreq = Math . Max ( maximumFreq , hash [ arr1 [ i ] ] ) ; } int sumOfElements = 0 ; for ( int i = 0 ; i < m ; i ++ ) { sumOfElements += ( maximumFreq == hash [ arr1 [ i ] ] ) ? arr1 [ i ] : 0 ; } return sumOfElements ; } public static void Main ( ) { int [ ] arr1 = { 2 , 5 , 6 , 8 } ; int [ ] arr2 = { 4 , 10 } ; int m = arr1 . Length ; int n = arr2 . Length ; Console . WriteLine ( findSumofEle ( arr1 , m , arr2 , n ) ) ; } }

Index/key variables: MAX, i
Accumulator variables: i, sumOfElements
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections ; using System . Collections . Generic ; class GFG { static void PrintBothArrays ( int [ ] a , int n ) { List < int > v1 = new List < int > ( ) ; List < int > v2 = new List < int > ( ) ; Dictionary < int , int > mpp = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( mpp . ContainsKey ( a [ i ] ) ) mpp [ a [ i ] ] = mpp [ a [ i ] ] + 1 ; else mpp [ a [ i ] ] = 1 ; if ( mpp [ a [ i ] ] == 1 ) v1 . Add ( a [ i ] ) ; else if ( mpp [ a [ i ] ] == 2 ) v2 . Add ( a [ i ] ) ; else { Console . WriteLine ( " Not ▁ possible " ) ; return ; } } v1 . Sort ( ) ; Console . WriteLine ( " Strictly ▁ increasing ▁ array ▁ is : " ) ; for ( int i = 0 ; i < v1 . Count ; i ++ ) Console . Write ( v1 [ i ] + " ▁ " ) ; v2 . Sort ( ) ; v2 . Reverse ( ) ; Console . WriteLine ( " STRNEWLINE Strictly ▁ decreasing ▁ array ▁ is : " ) ; for ( int i = 0 ; i < v2 . Count ; i ++ ) Console . Write ( v2 [ i ] + " ▁ " ) ; } public static void Main ( ) { int [ ] a = { 7 , 2 , 7 , 3 , 3 , 1 , 4 } ; int n = a . Length ; PrintBothArrays ( a , 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 { static bool isUgly ( int n ) { while ( n % 2 == 0 ) n = n / 2 ; while ( n % 3 == 0 ) n = n / 3 ; while ( n % 5 == 0 ) n = n / 5 ; if ( n == 1 ) return true ; return false ; } static void sortUglyNumbers ( int [ ] arr , int n ) { List < int > list = new List < int > ( ) ; int i ; for ( i = 0 ; i < n ; i ++ ) { if ( isUgly ( arr [ i ] ) ) { list . Add ( arr [ i ] ) ; arr [ i ] = - 1 ; } } list . Sort ( ) ; int j = 0 ; for ( i = 0 ; i < n ; i ++ ) { if ( arr [ i ] == - 1 ) Console . Write ( list [ j ++ ] + " ▁ " ) ; else Console . Write ( arr [ i ] + " ▁ " ) ; } } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 7 , 12 , 10 } ; int n = arr . Length ; sortUglyNumbers ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: i, j
Iterator variables: i
Class/struct names: GFG
C# program:
using System . Collections ; using System ; class GFG { static void printArr ( int [ ] arr , int n ) { for ( int i = 0 ; i < n ; i ++ ) Console . Write ( arr [ i ] + " ▁ " ) ; } static void sortArr ( int [ ] arr , int n , int k ) { int prev = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] % k == 0 ) { if ( prev != - 1 ) Array . Sort ( arr , prev + 1 , i - ( prev + 1 ) ) ; prev = i ; } } printArr ( arr , n ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 2 , 1 , 13 , 3 , 7 , 8 , 21 , 13 , 12 } ; int n = arr . Length ; int k = 2 ; sortArr ( arr , n , k ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System . Collections ; using System ; class GfG { static void printNumbers ( int [ ] arr , int n ) { Array . Sort ( arr ) ; int A = arr [ n - 1 ] , B = - 1 ; for ( int i = n - 2 ; i >= 0 ; i -- ) { if ( A % arr [ i ] != 0 ) { B = arr [ i ] ; break ; } if ( i - 1 >= 0 && arr [ i ] == arr [ i - 1 ] ) { B = arr [ i ] ; break ; } } Console . WriteLine ( " A ▁ = ▁ " + A + " , ▁ B ▁ = ▁ " + B ) ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 4 , 8 , 16 , 1 , 2 , 4 } ; int n = arr . Length ; printNumbers ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GfG
C# program:
using System ; class GFG { static void printArray ( int [ ] arr , int n ) { for ( int i = 0 ; i < n ; i ++ ) Console . Write ( arr [ i ] + " ▁ " ) ; } static void removeMin ( int [ ] arr , int n ) { int i , minVal = arr [ 0 ] ; for ( i = 1 ; i < n ; i ++ ) minVal = Math . Min ( minVal , arr [ i ] ) ; for ( i = 0 ; i < n ; i ++ ) arr [ i ] = arr [ i ] - minVal ; } static void removeFromMax ( int [ ] arr , int n ) { int i , maxVal = arr [ 0 ] ; for ( i = 1 ; i < n ; i ++ ) maxVal = Math . Max ( maxVal , arr [ i ] ) ; for ( i = 0 ; i < n ; i ++ ) arr [ i ] = maxVal - arr [ i ] ; } static void modifyArray ( int [ ] arr , int n , int k ) { if ( k % 2 == 0 ) removeMin ( arr , n ) ; else removeFromMax ( arr , n ) ; printArray ( arr , n ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 4 , 8 , 12 , 16 } ; int n = arr . Length ; int k = 2 ; modifyArray ( arr , n , k ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static long maxProd ( int [ ] arr , int n , int k ) { long product = 1 ; Dictionary < int , int > s = new Dictionary < int , int > ( ) ; Array . Sort ( arr ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( ! s . ContainsKey ( arr [ i ] ) ) { product = product * arr [ i ] ; s [ arr [ i ] ] = 1 ; } else s [ arr [ i ] ] ++ ; } for ( int j = n - 1 ; j >= 0 && k > 0 ; j -- ) { if ( ( k > ( s [ arr [ j ] ] - 1 ) ) && ( ( s [ arr [ j ] ] - 1 ) > 0 ) ) { product *= ( long ) Math . Pow ( arr [ j ] , s [ arr [ j ] ] - 1 ) ; k = k - s [ arr [ j ] ] + 1 ; s [ arr [ j ] ] = 0 ; } if ( k <= ( s [ arr [ j ] ] - 1 ) && ( ( s [ arr [ j ] ] - 1 ) > 0 ) ) { product *= ( long ) Math . Pow ( arr [ j ] , k ) ; break ; } } return product ; } public static void Main ( ) { int [ ] arr = { 5 , 6 , 7 , 8 , 2 , 5 , 6 , 8 } ; int n = arr . Length ; int k = 2 ; Console . WriteLine ( maxProd ( arr , n , k ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, product
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int findAnswer ( int n , int [ ] arr ) { Array . Sort ( arr ) ; int sum = 0 ; for ( int i = 0 ; i < n / 2 ; ++ i ) { sum += ( arr [ i ] + arr [ n - i - 1 ] ) * ( arr [ i ] + arr [ n - i - 1 ] ) ; } return sum ; } static void Main ( ) { int [ ] arr = { 53 , 28 , 143 , 5 } ; int n = arr . Length ; Console . WriteLine ( findAnswer ( n , arr ) ) ; } }

Index/key variables: i
Accumulator variables: sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int n = 4 ; static void merge ( int l , int r , int [ ] output ) { int l_in = l * n , r_in = ( ( l + r ) / 2 + 1 ) * n ; int l_c = ( ( l + r ) / 2 - l + 1 ) * n ; int r_c = ( r - ( l + r ) / 2 ) * n ; int [ ] l_arr = new int [ l_c ] ; int [ ] r_arr = new int [ r_c ] ; for ( int i = 0 ; i < l_c ; i ++ ) l_arr [ i ] = output [ l_in + i ] ; for ( int i = 0 ; i < r_c ; i ++ ) r_arr [ i ] = output [ r_in + i ] ; int l_curr = 0 , r_curr = 0 ; int index = l_in ; while ( l_curr + r_curr < l_c + r_c ) { if ( r_curr == r_c || ( l_curr != l_c && l_arr [ l_curr ] < r_arr [ r_curr ] ) ) { output [ index ] = l_arr [ l_curr ] ; l_curr ++ ; index ++ ; } else { output [ index ] = r_arr [ r_curr ] ; r_curr ++ ; index ++ ; } } } static void divide ( int l , int r , int [ ] output , int [ , ] arr ) { if ( l == r ) { for ( int i = 0 ; i < n ; i ++ ) output [ l * n + i ] = arr [ l , i ] ; return ; } divide ( l , ( l + r ) / 2 , output , arr ) ; divide ( ( l + r ) / 2 + 1 , r , output , arr ) ; merge ( l , r , output ) ; } public static void Main ( String [ ] args ) { int [ , ] arr = { { 5 , 7 , 15 , 18 } , { 1 , 8 , 9 , 17 } , { 1 , 4 , 7 , 7 } } ; int k = arr . GetLength ( 0 ) ; int [ ] output = new int [ n * k ] ; divide ( 0 , k - 1 , output , arr ) ; for ( int i = 0 ; i < n * k ; i ++ ) Console . Write ( output [ i ] + " ▁ " ) ; } }

Index/key variables: i, index, l_c, l_curr, r_c, r_curr
Accumulator variables: i, index, l_curr, r_curr
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GfG { static void findNonPalinString ( char [ ] s ) { int [ ] freq = new int [ 26 ] ; int flag = 0 ; for ( int i = 0 ; i < s . Length ; i ++ ) { if ( s [ i ] != s [ 0 ] ) flag = 1 ; freq [ s [ i ] - ' a ' ] ++ ; } if ( flag == 0 ) Console . WriteLine ( " - 1" ) ; else { for ( int i = 0 ; i < 26 ; i ++ ) for ( int j = 0 ; j < freq [ i ] ; j ++ ) Console . Write ( ( char ) ( ' a ' + i ) ) ; } } public static void Main ( ) { string s = " abba " ; findNonPalinString ( s . ToCharArray ( ) ) ; } }

Index/key variables: i
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GfG
C# program:
using System ; class GFG { static int minOperations ( int n , int m , int k , int [ , ] matrix ) { int [ ] arr = new int [ n * m ] ; int mod = matrix [ 0 , 0 ] % k ; for ( int i = 0 ; i < n ; ++ i ) { for ( int j = 0 ; j < m ; ++ j ) { arr [ i * m + j ] = matrix [ i , j ] ; if ( matrix [ i , j ] % k != mod ) { return - 1 ; } } } Array . Sort ( arr ) ; int median = arr [ ( n * m ) / 2 ] ; int minOperations = 0 ; for ( int i = 0 ; i < n * m ; ++ i ) minOperations += Math . Abs ( arr [ i ] - median ) / k ; if ( ( n * m ) % 2 == 0 ) { int median2 = arr [ ( ( n * m ) / 2 ) - 1 ] ; int minOperations2 = 0 ; for ( int i = 0 ; i < n * m ; ++ i ) minOperations2 += Math . Abs ( arr [ i ] - median2 ) / k ; minOperations = Math . Min ( minOperations , minOperations2 ) ; } return minOperations ; } public static void Main ( ) { int [ , ] matrix = { { 2 , 4 , 6 } , { 8 , 10 , 12 } , { 14 , 16 , 18 } , { 20 , 22 , 24 } } ; int n = matrix . GetLength ( 0 ) ; int m = matrix . GetLength ( 1 ) ; int k = 2 ; Console . WriteLine ( minOperations ( n , m , k , matrix ) ) ; } }

Index/key variables: i
Accumulator variables: minOperations, minOperations2
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int countDistinct ( int [ ] arr , int n ) { int res = 1 ; for ( int i = 1 ; i < n ; i ++ ) { int j = 0 ; for ( j = 0 ; j < i ; j ++ ) if ( arr [ i ] == arr [ j ] ) break ; if ( i == j ) res ++ ; } return res ; } public static void Main ( ) { int [ ] arr = { 12 , 10 , 9 , 45 , 2 , 10 , 10 , 45 } ; int n = arr . Length ; Console . WriteLine ( countDistinct ( arr , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, res
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int countDistinct ( int [ ] arr , int n ) { Array . Sort ( arr ) ; int res = 0 ; for ( int i = 0 ; i < n ; i ++ ) { while ( i < n - 1 && arr [ i ] == arr [ i + 1 ] ) { i ++ ; } res ++ ; } return res ; } public static void Main ( ) { int [ ] arr = { 6 , 10 , 5 , 4 , 9 , 120 , 4 , 6 , 10 } ; int n = arr . Length ; Console . WriteLine ( countDistinct ( arr , n ) ) ; } }

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

Index/key variables: i, n
Accumulator variables: i
Iterator variables: i
Class/struct names: GfG
C# program:
using System ; public class GFG { static double average ( int [ ] arr , int n , int k ) { double total = 0 ; if ( 2 * k >= n ) return 0 ; Array . Sort ( arr ) ; int start = k , end = n - k - 1 ; for ( int i = start ; i <= end ; i ++ ) total += arr [ i ] ; return ( total / ( n - 2 * k ) ) ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 4 , 4 , 5 , 6 } ; int n = arr . Length ; int k = 2 ; Console . WriteLine ( average ( arr , n , k ) ) ; } }

Index/key variables: i
Accumulator variables: i, total
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int min_sum ( int n , int k , int [ ] a ) { Array . Sort ( a ) ; if ( a [ 0 ] < 0 ) return - 1 ; if ( k == 0 ) { if ( a [ 0 ] == a [ n - 1 ] ) return ( n * a [ 0 ] ) ; else return - 1 ; } else { int f = 0 ; for ( int i = 1 ; i < n ; i ++ ) { int p = a [ i ] - a [ 0 ] ; if ( p % k == 0 ) continue ; else { f = 1 ; break ; } } if ( f > 0 ) return - 1 ; else { if ( k == 1 ) return n ; else return ( n * ( a [ 0 ] % k ) ) ; } } } public static void Main ( ) { int [ ] arr = new int [ ] { 2 , 3 , 4 , 5 } ; int K = 1 ; int N = arr . Length ; Console . WriteLine ( min_sum ( N , K , arr ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void merge ( int [ ] arr , int start , int mid , int end ) { int start2 = mid + 1 ; if ( arr [ mid ] <= arr [ start2 ] ) { return ; } while ( start <= mid && start2 <= end ) { if ( arr [ start ] <= arr [ start2 ] ) { start ++ ; } else { int value = arr [ start2 ] ; int index = start2 ; while ( index != start ) { arr [ index ] = arr [ index - 1 ] ; index -- ; } arr [ start ] = value ; start ++ ; mid ++ ; start2 ++ ; } } } static void mergeSort ( int [ ] arr , int l , int r ) { if ( l < r ) { int m = l + ( r - l ) / 2 ; mergeSort ( arr , l , m ) ; mergeSort ( arr , m + 1 , r ) ; merge ( arr , l , m , r ) ; } } static void printArray ( int [ ] A , int size ) { int i ; for ( i = 0 ; i < size ; i ++ ) Console . Write ( A [ i ] + " ▁ " ) ; Console . WriteLine ( ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 12 , 11 , 13 , 5 , 6 , 7 } ; int arr_size = arr . Length ; mergeSort ( arr , 0 , arr_size - 1 ) ; printArray ( arr , arr_size ) ; } }

Index/key variables: i, index, mid, start, start2
Accumulator variables: i, index, mid, start, start2
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int minCost ( int [ ] A , int n ) { int cost = 0 ; Array . Sort ( A ) ; int K = A [ n / 2 ] ; for ( int i = 0 ; i < n ; ++ i ) cost += Math . Abs ( A [ i ] - K ) ; if ( n % 2 == 0 ) { int tempCost = 0 ; K = A [ ( n / 2 ) - 1 ] ; for ( int i = 0 ; i < n ; ++ i ) tempCost += Math . Abs ( A [ i ] - K ) ; cost = Math . Min ( cost , tempCost ) ; } return cost ; } public static void Main ( String [ ] args ) { int [ ] A = new int [ ] { 1 , 6 , 7 , 10 } ; int n = A . Length ; Console . WriteLine ( minCost ( A , n ) ) ; } }

Index/key variables: i
Accumulator variables: cost, tempCost
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void printArray ( int [ ] arr , int n ) { Array . Sort ( arr ) ; int l = 0 , r = n - 1 , flag = 0 , i ; int k = 2 ; while ( l <= r ) { if ( flag == 0 ) { for ( i = l ; i < l + k && i <= r ; i ++ ) Console . Write ( arr [ i ] + " ▁ " ) ; flag = 1 ; l = i ; } else { for ( i = r ; i > r - k && i >= l ; i -- ) Console . Write ( arr [ i ] + " ▁ " ) ; flag = 0 ; r = i ; } k ++ ; } } static public void Main ( ) { int n = 6 ; int [ ] arr = { 1 , 2 , 3 , 4 , 5 , 6 } ; printArray ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: i, k
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { class Node { public int data ; public Node next , prev ; } ; static int countPairs ( Node first , Node second , int value ) { int count = 0 ; while ( first != null && second != null && first != second && second . next != first ) { if ( ( first . data * second . data ) == value ) { count ++ ; first = first . next ; second = second . prev ; } else if ( ( first . data * second . data ) > value ) second = second . prev ; else first = first . next ; } return count ; } static int countTriplets ( Node head , int x ) { if ( head == null ) return 0 ; Node current , first , last ; int count = 0 ; last = head ; while ( last . next != null ) last = last . next ; for ( current = head ; current != null ; current = current . next ) { first = current . next ; count += countPairs ( first , last , x / current . data ) ; } return count ; } static Node insert ( Node head , int data ) { Node temp = new Node ( ) ; temp . data = data ; temp . next = temp . prev = null ; if ( ( head ) == null ) ( head ) = temp ; else { temp . next = head ; ( head ) . prev = temp ; ( head ) = temp ; } return head ; } public static void Main ( String [ ] args ) { Node head = null ; head = insert ( head , 9 ) ; head = insert ( head , 8 ) ; head = insert ( head , 6 ) ; head = insert ( head , 5 ) ; head = insert ( head , 4 ) ; head = insert ( head , 2 ) ; head = insert ( head , 1 ) ; int x = 8 ; Console . WriteLine ( " Count ▁ = ▁ " + countTriplets ( head , x ) ) ; } }

Accumulator variables: count
Iterator variables: current
Class/struct names: GFG, Node
C# program:
using System ; public class GFG { static bool isAlphabaticOrder ( string s ) { int n = s . Length ; for ( int i = 1 ; i < n ; i ++ ) { if ( s [ i ] < s [ i - 1 ] ) return false ; } return true ; } static public void Main ( ) { string s = " aabbbcc " ; if ( isAlphabaticOrder ( s ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

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

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int rotateRec ( int n , int [ ] L , int [ ] B ) { int m = int . MaxValue ; for ( int i = 0 ; i < n ; i ++ ) { if ( Math . Max ( L [ i ] , B [ i ] ) <= m ) m = Math . Max ( L [ i ] , B [ i ] ) ; else if ( Math . Min ( L [ i ] , B [ i ] ) <= m ) m = Math . Min ( L [ i ] , B [ i ] ) ; else { return 0 ; } } return 1 ; } public static void Main ( ) { int n = 3 ; int [ ] L = { 5 , 5 , 6 } ; int [ ] B = { 6 , 7 , 8 } ; if ( rotateRec ( n , L , B ) == 1 ) Console . WriteLine ( " YES " ) ; else Console . WriteLine ( " NO " ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void minDistance ( int n , int k , int [ ] [ ] point ) { for ( int i = 0 ; i < k ; i ++ ) Array . Sort ( point [ i ] ) ; for ( int i = 0 ; i < k ; i ++ ) System . Console . Write ( point [ i ] [ ( int ) Math . Ceiling ( ( double ) ( n / 2 ) - 1 ) ] + " ▁ " ) ; } public static void Main ( ) { int n = 4 ; int k = 4 ; int [ ] [ ] point = new int [ ] [ ] { new int [ ] { 1 , 5 , 2 , 4 } , new int [ ] { 6 , 2 , 0 , 6 } , new int [ ] { 9 , 5 , 1 , 3 } , new int [ ] { 6 , 7 , 5 , 9 } } ; minDistance ( n , k , point ) ; } }

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

Index/key variables: i, k
Accumulator variables: i, len2
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void findMaxNum ( int [ ] arr , int n ) { int [ ] hash = new int [ 10 ] ; for ( int i = 0 ; i < n ; i ++ ) { hash [ arr [ i ] ] ++ ; } for ( int i = 9 ; i >= 0 ; i -- ) { for ( int j = 0 ; j < hash [ i ] ; j ++ ) Console . Write ( i ) ; } } public static void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 4 , 5 , 0 } ; int n = arr . Length ; findMaxNum ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void sortK ( int [ ] arr , int n , int k ) { Array . Sort ( arr ) ; } static void printArray ( int [ ] arr , int size ) { for ( int i = 0 ; i < size ; i ++ ) Console . Write ( arr [ i ] + " ▁ " ) ; Console . WriteLine ( ) ; } static void Main ( ) { int k = 3 ; int [ ] arr = { 2 , 6 , 3 , 12 , 56 , 8 } ; int n = arr . Length ; sortK ( arr , n , k ) ; Console . WriteLine ( " Following ▁ is ▁ sorted ▁ array " ) ; printArray ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int distribution ( int [ ] arr , int n ) { Array . Sort ( arr ) ; int count = 1 ; for ( int i = 1 ; i < n ; i ++ ) if ( arr [ i ] > arr [ i - 1 ] ) count ++ ; return Math . Min ( count , n / 2 ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 1 , 2 , 1 , 3 , 4 } ; int n = arr . Length ; Console . WriteLine ( distribution ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void printPairs ( int [ ] arr , int n ) { HashSet < int > pairs = new HashSet < int > ( ) ; bool pair_exists = false ; for ( int i = 0 ; i < n ; i ++ ) if ( arr [ i ] > 0 ) pairs . Add ( arr [ i ] ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] < 0 ) if ( pairs . Contains ( - arr [ i ] ) ) { Console . WriteLine ( arr [ i ] + " , ▁ " + - arr [ i ] ) ; pair_exists = true ; } } if ( pair_exists == false ) Console . WriteLine ( " No ▁ such ▁ pair ▁ exists " ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 4 , 8 , 9 , - 4 , 1 , - 1 , - 8 , - 9 } ; int n = arr . Length ; printPairs ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Boolean variables: pair_exists
Class/struct names: GFG
C# program:
using System ; class GFG { public static void Main ( ) { int [ ] a = { 10 , 12 , 5 } ; Array . Sort ( a ) ; for ( int i = 0 ; i < 3 ; i ++ ) Console . Write ( a [ i ] + " ▁ " ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int printTriplets ( int [ ] arr , int n , int sum ) { 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 ] < sum ) Console . WriteLine ( arr [ i ] + " , ▁ " + arr [ j ] + " , ▁ " + arr [ k ] ) ; } } return 0 ; } public static void Main ( ) { int [ ] arr = { 5 , 1 , 3 , 4 , 7 } ; int n = arr . Length ; int sum = 12 ; printTriplets ( arr , n , sum ) ; } }

Index/key variables: i, j, k
Accumulator variables: i, j, k
Iterator variables: i, j, k
Class/struct names: GFG