dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; using System . Collections . Generic ; class GFG { static int findSmallestAfterDel ( int [ ] arr , int m , int [ ] del , int n ) { Dictionary < int , int > mp = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; ++ i ) { if ( mp . ContainsKey ( del [ i ] ) ) { mp [ del [ i ] ] = mp [ del [ i ] ] + 1 ; } else { mp . Add ( del [ i ] , 1 ) ; } } int smallestElement = int . MaxValue ; for ( int i = 0 ; i < m ; ++ i ) { if ( mp . ContainsKey ( arr [ i ] ) ) { mp [ arr [ i ] ] = mp [ arr [ i ] ] - 1 ; if ( mp [ arr [ i ] ] == 0 ) mp . Remove ( arr [ i ] ) ; } else smallestElement = Math . Min ( smallestElement , arr [ i ] ) ; } return smallestElement ; } public static void Main ( String [ ] args ) { int [ ] array = { 5 , 12 , 33 , 4 , 56 , 12 , 20 } ; int m = array . Length ; int [ ] del = { 12 , 4 , 56 , 5 } ; int n = del . Length ; Console . WriteLine ( findSmallestAfterDel ( array , m , del , n ) ) ; } }

Index/key variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int findlargestAfterDel ( int [ ] arr , int m , int [ ] del , int n ) { Dictionary < int , int > mp = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; ++ i ) { if ( mp . ContainsKey ( del [ i ] ) ) { mp [ arr [ i ] ] = mp [ arr [ i ] ] + 1 ; } else { mp . Add ( del [ i ] , 1 ) ; } } int largestElement = int . MinValue ; for ( int i = 0 ; i < m ; i ++ ) { if ( mp . ContainsKey ( arr [ i ] ) ) { mp [ arr [ i ] ] = mp [ arr [ i ] ] - 1 ; if ( mp [ arr [ i ] ] == 0 ) mp . Remove ( arr [ i ] ) ; } else largestElement = Math . Max ( largestElement , arr [ i ] ) ; } return largestElement ; } public static void Main ( String [ ] args ) { int [ ] array = { 5 , 12 , 33 , 4 , 56 , 12 , 20 } ; int m = array . Length ; int [ ] del = { 12 , 33 , 56 , 5 } ; int n = del . Length ; Console . WriteLine ( findlargestAfterDel ( array , m , del , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int countAnomalies ( int [ ] arr , int n , int k ) { int res = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int j ; for ( j = 0 ; j < n ; j ++ ) if ( i != j && Math . Abs ( arr [ i ] - arr [ j ] ) <= k ) break ; if ( j == n ) res ++ ; } return res ; } public static void Main ( ) { int [ ] arr = { 7 , 1 , 8 } ; int k = 5 ; int n = arr . Length ; Console . WriteLine ( countAnomalies ( arr , n , k ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, res
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int majorityInMatrix ( int [ , ] arr ) { Dictionary < int , int > mp = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < M ; j ++ ) { if ( mp . ContainsKey ( arr [ i , j ] ) ) mp [ arr [ i , j ] ] ++ ; else mp [ arr [ i , j ] ] = 1 ; } } int countMajority = 0 ; Dictionary < int , int > . KeyCollection keyColl = mp . Keys ; foreach ( int i in keyColl ) { if ( mp [ i ] >= ( ( N * M ) / 2 ) ) { countMajority ++ ; } } return countMajority ; } public static void Main ( ) { int [ , ] mat = { { 1 , 2 , 2 } , { 1 , 3 , 2 } , { 1 , 2 , 6 } } ; Console . WriteLine ( majorityInMatrix ( mat ) ) ; } }

Index/key variables: i
Accumulator variables: countMajority, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int colMaxDiff ( int [ , ] mat ) { int max_diff = int . MinValue ; for ( int i = 0 ; i < N ; i ++ ) { int max_val = mat [ 0 , i ] , min_val = mat [ 0 , i ] ; for ( int j = 1 ; j < N ; j ++ ) { max_val = Math . Max ( max_val , mat [ j , i ] ) ; min_val = Math . Min ( min_val , mat [ j , i ] ) ; } max_diff = Math . Max ( max_diff , max_val - min_val ) ; } return max_diff ; } public static void Main ( ) { int [ , ] mat = { { 1 , 2 , 3 , 4 , 5 } , { 5 , 3 , 5 , 4 , 0 } , { 5 , 6 , 7 , 8 , 9 } , { 0 , 6 , 3 , 4 , 12 } , { 9 , 7 , 12 , 4 , 3 } } ; Console . WriteLine ( " Max ▁ difference ▁ : ▁ " + colMaxDiff ( mat ) ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int search ( int [ ] ar , int size ) { int a = 0 , b = size - 1 ; int mid = 0 ; while ( ( b - a ) > 1 ) { mid = ( a + b ) / 2 ; if ( ( ar [ a ] - a ) != ( ar [ mid ] - mid ) ) b = mid ; else if ( ( ar [ b ] - b ) != ( ar [ mid ] - mid ) ) a = mid ; } return ( ar [ a ] + 1 ) ; } static public void Main ( String [ ] args ) { int [ ] ar = { 1 , 2 , 3 , 4 , 5 , 6 , 8 } ; int size = ar . Length ; Console . WriteLine ( " Missing ▁ number : ▁ " + search ( ar , size ) ) ; } }

Index/key variables: a, b, mid
Class/struct names: GFG
C# program:
using System ; class GFG { static int deleteElement ( int [ ] A , int L , int R , int N ) { int i , j = 0 ; for ( i = 0 ; i < N ; i ++ ) { if ( i <= L i >= R ) { A [ j ] = A [ i ] ; j ++ ; } } return j ; } public static void Main ( ) { int [ ] A = new int [ ] { 5 , 8 , 11 , 15 , 26 , 14 , 19 , 17 , 10 , 14 } ; int L = 2 , R = 7 ; int n = A . Length ; int res_size = deleteElement ( A , L , R , n ) ; for ( int i = 0 ; i < res_size ; i ++ ) Console . Write ( A [ i ] + " ▁ " ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int findmissing ( int [ ] ar , int N ) { int l = 0 , r = N - 1 ; while ( l <= r ) { int mid = ( l + r ) / 2 ; if ( ar [ mid ] != mid + 1 && ar [ mid - 1 ] == mid ) return ( mid + 1 ) ; if ( ar [ mid ] != mid + 1 ) r = mid - 1 ; else l = mid + 1 ; } return - 1 ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 4 , 5 , 7 , 8 } ; int N = arr . Length ; Console . WriteLine ( findmissing ( arr , N ) ) ; } }

Index/key variables: mid
Class/struct names: GFG
C# program:
using System ; class GFG { static int findFirst ( int [ ] arr , int n , int x ) { Array . Sort ( arr ) ; int ptr = lowerBound ( arr , 0 , n , x ) ; return ( arr [ ptr ] != x ) ? - 1 : ( ptr ) ; } static int lowerBound ( 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 public void Main ( ) { int x = 20 ; int [ ] arr = { 10 , 30 , 20 , 50 , 20 } ; int n = arr . Length ; Console . Write ( findFirst ( arr , n , x ) ) ; } }

Index/key variables: middle, ptr
Class/struct names: GFG
C# program:
using System ; public class GFG { static int findFirst ( int [ ] arr , int n , int x ) { int count = 0 ; bool isX = false ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] == x ) { isX = true ; } else if ( arr [ i ] < x ) { count ++ ; } } return ( isX == false ) ? - 1 : count ; } public static void Main ( ) { int x = 20 ; int [ ] arr = { 10 , 30 , 20 , 50 , 20 } ; int n = arr . Length ; Console . WriteLine ( findFirst ( arr , n , x ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Boolean variables: isX
Class/struct names: GFG
C# program:
using System ; class GFG { public static int findDuplicate ( int [ ] arr ) { int slow = arr [ 0 ] ; int fast = arr [ 0 ] ; do { slow = arr [ slow ] ; fast = arr [ arr [ fast ] ] ; } while ( slow != fast ) ; int ptr1 = arr [ 0 ] ; int ptr2 = slow ; while ( ptr1 != ptr2 ) { ptr1 = arr [ ptr1 ] ; ptr2 = arr [ ptr2 ] ; } return ptr1 ; } public static void Main ( ) { int [ ] arr = { 1 , 3 , 2 , 1 } ; Console . WriteLine ( " " + findDuplicate ( arr ) ) ; } }

Index/key variables: fast, ptr1, ptr2, slow
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX_CHAR = 26 ; static void printGreaterCount ( string str ) { int len = str . Length ; int [ ] ans = new int [ len ] ; int [ ] count = new int [ MAX_CHAR ] ; for ( int i = len - 1 ; i >= 0 ; i -- ) { count [ str [ i ] - ' a ' ] ++ ; for ( int j = str [ i ] - ' a ' + 1 ; j < MAX_CHAR ; j ++ ) { ans [ i ] += count [ j ] ; } } for ( int i = 0 ; i < len ; i ++ ) { Console . Write ( ans [ i ] + " ▁ " ) ; } } static void Main ( ) { string str = " abcd " ; printGreaterCount ( str ) ; } }

Index/key variables: MAX_CHAR, i, j, len
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections ; using System . Collections . Generic ; class GFG { static void printPairs ( int [ ] arr , int n , int sum ) { Dictionary < int , int > m = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int rem = sum - arr [ i ] ; if ( m . ContainsKey ( rem ) ) { int count = m [ rem ] ; for ( int j = 0 ; j < count ; j ++ ) { Console . Write ( " ( " + rem + " , ▁ " + arr [ i ] + " ) " + " STRNEWLINE " ) ; } } if ( m . ContainsKey ( arr [ i ] ) ) { m [ arr [ i ] ] ++ ; } else { m [ arr [ i ] ] = 1 ; } } } public static void Main ( string [ ] args ) { int [ ] arr = { 1 , 5 , 7 , - 1 , 5 } ; int n = arr . Length ; int sum = 6 ; printPairs ( arr , n , sum ) ; } }

Index/key variables: i, rem
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int maxProduct ( int [ ] arr , int n ) { if ( n < 4 ) { return - 1 ; } int maxA = int . MinValue , maxB = int . MinValue , maxC = int . MinValue , maxD = int . MinValue ; int minA = int . MaxValue , minB = int . MaxValue , minC = int . MaxValue , minD = int . MaxValue ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] > maxA ) { maxD = maxC ; maxC = maxB ; maxB = maxA ; maxA = arr [ i ] ; } else if ( arr [ i ] > maxB ) { maxD = maxC ; maxC = maxB ; maxB = arr [ i ] ; } else if ( arr [ i ] > maxC ) { maxD = maxC ; maxC = arr [ i ] ; } else if ( arr [ i ] > maxD ) { maxD = arr [ i ] ; } if ( arr [ i ] < minA ) { minD = minC ; minC = minB ; minB = minA ; minA = arr [ i ] ; } else if ( arr [ i ] < minB ) { minD = minC ; minC = minB ; minB = arr [ i ] ; } else if ( arr [ i ] < minC ) { minD = minC ; minC = arr [ i ] ; } else if ( arr [ i ] < minD ) { minD = arr [ i ] ; } } int x = maxA * maxB * maxC * maxD ; int y = minA * minB * minC * minD ; int z = minA * minB * maxA * maxB ; return Math . Max ( x , Math . Max ( y , z ) ) ; } public static void Main ( ) { int [ ] arr = { 1 , - 4 , 3 , - 6 , 7 , 0 } ; int n = arr . Length ; int max = maxProduct ( arr , n ) ; if ( max == - 1 ) Console . Write ( " No ▁ Quadruple ▁ Exists " ) ; else Console . Write ( " Maximum ▁ product ▁ is ▁ " + max ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int countTripletsLessThanL ( int n , int L , int [ ] arr ) { Array . Sort ( arr ) ; int ways = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { for ( int k = j + 1 ; k < n ; k ++ ) { int mostDistantDistance = arr [ k ] - arr [ i ] ; if ( mostDistantDistance <= L ) { ways ++ ; } } } } return ways ; } static public void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 4 } ; int n = arr . Length ; int L = 3 ; int ans = countTripletsLessThanL ( n , L , arr ) ; Console . WriteLine ( " Total ▁ Number ▁ of ▁ ways ▁ = ▁ " + ans ) ; } }

Index/key variables: i, k
Accumulator variables: i, j, k, ways
Iterator variables: i, j, k
Class/struct names: GFG
C# program:
using System ; class GFG { static int binary_lower ( int value , int [ ] arr , int n ) { int start = 0 ; int end = n - 1 ; int ans = - 1 ; int mid ; while ( start <= end ) { mid = ( start + end ) / 2 ; if ( arr [ mid ] >= value ) { end = mid - 1 ; ans = mid ; } else { start = mid + 1 ; } } return ans ; } static int countTriplet ( int [ ] arr , int n , int k ) { int count = 0 ; Array . Sort ( arr ) ; for ( int i = 2 ; i < n ; i ++ ) { int cur = binary_lower ( arr [ i ] - k , arr , n ) ; if ( cur <= i - 2 ) { count += ( ( i - cur ) * ( i - cur - 1 ) ) / 2 ; } } return count ; } public static void Main ( ) { int [ ] arr = { 1 , 1 , 2 , 2 , 3 } ; int k = 1 ; int n = arr . Length ; Console . WriteLine ( countTriplet ( arr , n , k ) ) ; } }

Index/key variables: i, mid
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static readonly int MAXN = 1000 ; class Node { public int start , end ; public int Length ; public int [ ] insertionEdge = new int [ 26 ] ; public int suffixEdge ; } ; static Node root1 , root2 ; static Node [ ] tree = new Node [ MAXN ] ; static int currNode ; static char [ ] s ; static int ptr ; static void insert ( int currIndex ) { int temp = currNode ; while ( true ) { int currLength = tree [ temp ] . Length ; if ( currIndex - currLength >= 1 && ( s [ currIndex ] == s [ currIndex - currLength - 1 ] ) ) break ; temp = tree [ temp ] . suffixEdge ; } if ( tree [ temp ] . insertionEdge [ s [ currIndex ] - ' a ' ] != 0 ) { currNode = tree [ temp ] . insertionEdge [ s [ currIndex ] - ' a ' ] ; return ; } ptr ++ ; tree [ temp ] . insertionEdge [ s [ currIndex ] - ' a ' ] = ptr ; tree [ ptr ] . end = currIndex ; tree [ ptr ] . Length = tree [ temp ] . Length + 2 ; tree [ ptr ] . start = tree [ ptr ] . end - tree [ ptr ] . Length + 1 ; currNode = ptr ; temp = tree [ temp ] . suffixEdge ; if ( tree [ currNode ] . Length == 1 ) { tree [ currNode ] . suffixEdge = 2 ; return ; } while ( true ) { int currLength = tree [ temp ] . Length ; if ( currIndex - currLength >= 1 && ( s [ currIndex ] == s [ currIndex - currLength - 1 ] ) ) break ; temp = tree [ temp ] . suffixEdge ; } tree [ currNode ] . suffixEdge = tree [ temp ] . insertionEdge [ s [ currIndex ] - ' a ' ] ; } public static void Main ( String [ ] args ) { root1 = new Node ( ) ; root1 . Length = - 1 ; root1 . suffixEdge = 1 ; root2 = new Node ( ) ; root2 . Length = 0 ; root2 . suffixEdge = 1 ; for ( int i = 0 ; i < MAXN ; i ++ ) tree [ i ] = new Node ( ) ; tree [ 1 ] = root1 ; tree [ 2 ] = root2 ; ptr = 2 ; currNode = 1 ; s = " forgeeksskeegfor " . ToCharArray ( ) ; for ( int i = 0 ; i < s . Length ; i ++ ) insert ( i ) ; int last = ptr ; for ( int i = tree [ last ] . start ; i <= tree [ last ] . end ; i ++ ) Console . Write ( s [ i ] ) ; } }

Index/key variables: MAXN, currIndex, currNode, i, last, ptr, temp
Accumulator variables: i, ptr
Iterator variables: i
Class/struct names: GFG, Node
C# program:
using System ; class GFG { class Node { public char data ; public Node next ; } ; static Node head_ref ; static char maxChar ( Node head ) { Node p = head ; int max = - 1 ; char res = '0' ; while ( p != null ) { Node q = p . next ; int count = 1 ; while ( q != null ) { if ( p . data == q . data ) count ++ ; q = q . next ; } if ( max < count ) { res = p . data ; max = count ; } p = p . next ; } return res ; } static void push ( char new_data ) { Node new_node = new Node ( ) ; new_node . data = new_data ; new_node . next = head_ref ; head_ref = new_node ; } public static void Main ( string [ ] args ) { head_ref = null ; string str = " skeegforskeeg " ; char [ ] st = str . ToCharArray ( ) ; int i ; for ( i = 0 ; i < st . Length ; i ++ ) push ( st [ i ] ) ; Console . Write ( maxChar ( head_ref ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG, Node
C# program:
using System ; using System . Collections . Generic ; using System . Linq ; class GFG { static int missingNum ( int [ ] arr , int n ) { List < int > list = new List < int > ( arr . Length ) ; foreach ( int i in arr ) { list . Add ( i ) ; } int minvalue = list . Min ( ) ; int xornum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { xornum ^= ( minvalue ) ^ arr [ i ] ; minvalue ++ ; } return xornum ^ minvalue ; } public static void Main ( String [ ] args ) { int [ ] arr = { 13 , 12 , 11 , 15 } ; int n = arr . Length ; Console . WriteLine ( missingNum ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, minvalue, xornum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int findLastIndex ( string str , char x ) { int index = - 1 ; for ( int i = 0 ; i < str . Length ; i ++ ) if ( str [ i ] == x ) index = i ; return index ; } public static void Main ( ) { string str = " geeksforgeeks " ; char x = ' e ' ; int index = findLastIndex ( str , x ) ; if ( index == - 1 ) Console . WriteLine ( " Character ▁ not ▁ found " ) ; else Console . WriteLine ( " Last ▁ index ▁ is ▁ " + index ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int findLastIndex ( string str , char x ) { for ( int i = str . Length - 1 ; i >= 0 ; i -- ) if ( str [ i ] == x ) return i ; return - 1 ; } public static void Main ( ) { string str = " geeksforgeeks " ; char x = ' e ' ; int index = findLastIndex ( str , x ) ; if ( index == - 1 ) Console . WriteLine ( " Character ▁ not ▁ found " ) ; else Console . WriteLine ( " Last ▁ index ▁ is ▁ " + index ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int countMaxSetBits ( int left , int right ) { while ( ( left | ( left + 1 ) ) <= right ) left |= left + 1 ; return left ; } static public void Main ( ) { int l = 1 ; int r = 5 ; Console . WriteLine ( countMaxSetBits ( l , r ) ) ; l = 1 ; r = 10 ; Console . WriteLine ( countMaxSetBits ( l , r ) ) ; } }

Accumulator variables: left
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { public class Node { public int key ; public Node left , right ; } ; static Node newNode ( int item ) { Node temp = new Node ( ) ; temp . key = item ; temp . left = temp . right = null ; return temp ; } static Node insert ( Node node , int key ) { if ( node == null ) return newNode ( key ) ; if ( key < node . key ) node . left = insert ( node . left , key ) ; else if ( key > node . key ) node . right = insert ( node . right , key ) ; return node ; } static int findFloor ( Node root , int key ) { Node curr = root , ans = null ; while ( curr != null ) { if ( curr . key <= key ) { ans = curr ; curr = curr . right ; } else curr = curr . left ; } if ( ans != null ) return ans . key ; return - 1 ; } public static void Main ( String [ ] args ) { int N = 25 ; Node root = new Node ( ) ; insert ( root , 19 ) ; insert ( root , 2 ) ; insert ( root , 1 ) ; insert ( root , 3 ) ; insert ( root , 12 ) ; insert ( root , 9 ) ; insert ( root , 21 ) ; insert ( root , 19 ) ; insert ( root , 25 ) ; Console . Write ( " { 0 } " , findFloor ( root , N ) ) ; } }

Class/struct names: GFG, Node
C# program:
using System ; public class GFG { static int findS ( int s ) { int l = 1 , r = ( s / 2 ) + 1 ; while ( l <= r ) { int mid = ( l + r ) / 2 ; int sum = mid * ( mid + 1 ) / 2 ; if ( sum == s ) return mid ; else if ( sum > s ) r = mid - 1 ; else l = mid + 1 ; } return - 1 ; } static public void Main ( ) { int s = 15 ; int n = findS ( s ) ; if ( n == - 1 ) Console . WriteLine ( " - 1" ) ; else Console . WriteLine ( n ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static string canSortString ( string S , int N ) { int flag = 1 ; int i , j ; for ( i = N - 2 ; i >= 0 ; i -- ) { if ( S [ i ] == '1' && S [ i + 1 ] == '1' ) { break ; } } for ( j = i ; j >= 0 ; j -- ) { if ( S [ j ] == '0' && S [ j + 1 ] == '0' ) { flag = 0 ; break ; } } if ( flag == 0 ) { return " No " ; } else { return " Yes " ; } } public static void Main ( string [ ] args ) { string S = "10101011011" ; int N = S . Length ; Console . WriteLine ( canSortString ( S , 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 maximumMex ( int [ ] arr , int N ) { int [ ] ans = new int [ 2 * N ] ; Array . Sort ( ans ) ; int j = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( i == 0 arr [ i ] != arr [ i - 1 ] ) { j += 1 ; ans [ j ] = arr [ i ] ; } } for ( int i = 0 ; i < N ; i ++ ) { if ( i > 0 && arr [ i ] == arr [ i - 1 ] ) { j += 1 ; ans [ j ] = arr [ i ] ; } } for ( int i = 0 ; i < N ; i ++ ) Console . Write ( ans [ i ] + " ▁ " ) ; } public static void Main ( string [ ] args ) { int [ ] arr = { 1 , 0 , 0 } ; int N = arr . Length ; maximumMex ( 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 List < int > bubble_sort ( List < int > ar ) { List < int > temp = new List < int > ( ) ; if ( ar . Count <= 1 ) return ar ; if ( ar . Count == 2 ) { if ( ar [ 0 ] < ar [ 1 ] ) return ar ; else { temp . Add ( ar [ 1 ] ) ; temp . Add ( ar [ 0 ] ) ; return temp ; } } int a = ar [ 0 ] ; int b = ar [ 1 ] ; List < int > bs = new List < int > ( ) ; for ( int i = 2 ; i < ar . Count ; i ++ ) bs . Add ( ar [ i ] ) ; List < int > res = new List < int > ( ) ; if ( a < b ) { List < int > temp1 = new List < int > ( ) ; temp1 . Add ( b ) ; for ( int i = 0 ; i < bs . Count ; i ++ ) temp1 . Add ( bs [ i ] ) ; List < int > v = bubble_sort ( temp1 ) ; v . Insert ( 0 , a ) ; res = v ; } else { List < int > temp1 = new List < int > ( ) ; temp1 . Add ( a ) ; for ( int i = 0 ; i < bs . Count ; i ++ ) temp1 . Add ( bs [ i ] ) ; List < int > v = bubble_sort ( temp1 ) ; v . Insert ( 0 , b ) ; res = v ; } List < int > pass = new List < int > ( ) ; for ( int i = 0 ; i < res . Count - 1 ; i ++ ) pass . Add ( res [ i ] ) ; List < int > ans = bubble_sort ( pass ) ; ans . Add ( res [ res . Count - 1 ] ) ; return ans ; } public static void Main ( ) { List < int > arr = new List < int > { 1 , 3 , 4 , 5 , 6 , 2 } ; List < int > res = bubble_sort ( arr ) ; for ( int i = 0 ; i < res . Count ; i ++ ) Console . Write ( res [ i ] + " ▁ " ) ; } }

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 void printMatrix ( List < List < int > > a ) { foreach ( List < int > x in a ) { foreach ( int y in x ) { Console . Write ( y + " ▁ " ) ; } Console . WriteLine ( ) ; } } static void sortBoundaryWise ( List < List < int > > a ) { int i , k = 0 , l = 0 ; int m = a . Count , n = a [ 0 ] . Count ; int n_k = 0 , n_l = 0 , n_m = m , n_n = n ; while ( k < m && l < n ) { List < int > boundary = new List < int > ( ) ; for ( i = l ; i < n ; ++ i ) { boundary . Add ( a [ k ] [ i ] ) ; } k ++ ; for ( i = k ; i < m ; ++ i ) { boundary . Add ( a [ i ] [ n - 1 ] ) ; } n -- ; if ( k < m ) { for ( i = n - 1 ; i >= l ; -- i ) { boundary . Add ( a [ m - 1 ] [ i ] ) ; } m -- ; } if ( l < n ) { for ( i = m - 1 ; i >= k ; -- i ) { boundary . Add ( a [ i ] [ l ] ) ; } l ++ ; } boundary . Sort ( ) ; int ind = 0 ; for ( i = n_l ; i < n_n ; ++ i ) { a [ n_k ] [ i ] = boundary [ ind ++ ] ; } n_k ++ ; for ( i = n_k ; i < n_m ; ++ i ) { a [ i ] [ n_n - 1 ] = boundary [ ind ++ ] ; } n_n -- ; if ( n_k < n_m ) { for ( i = n_n - 1 ; i >= n_l ; -- i ) { a [ n_m - 1 ] [ i ] = boundary [ ind ++ ] ; } n_m -- ; } if ( n_l < n_n ) { for ( i = n_m - 1 ; i >= n_k ; -- i ) { a [ i ] [ n_l ] = boundary [ ind ++ ] ; } n_l ++ ; } } printMatrix ( a ) ; } static void Main ( ) { List < List < int > > matrix = new List < List < int > > ( ) ; matrix . Add ( new List < int > ( new int [ ] { 9 , 7 , 4 , 5 } ) ) ; matrix . Add ( new List < int > ( new int [ ] { 1 , 6 , 2 , - 6 } ) ) ; matrix . Add ( new List < int > ( new int [ ] { 12 , 20 , 2 , 0 } ) ) ; matrix . Add ( new List < int > ( new int [ ] { - 5 , - 6 , 7 , - 2 } ) ) ; sortBoundaryWise ( matrix ) ; } }

Index/key variables: i, k, l, n_k, n_l
Accumulator variables: ind, k, l, m, n, n_k, n_l, n_m, n_n
Iterator variables: i, x, y
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int minimum_sum ( int [ ] A , int N ) { Array . Sort ( A ) ; int sum = 2147483647 ; for ( int i = 0 ; i <= N - 3 ; i ++ ) { sum = Math . Min ( sum , Math . Abs ( A [ i ] - A [ i + 1 ] ) + Math . Abs ( A [ i + 1 ] - A [ i + 2 ] ) ) ; } return sum ; } public static void Main ( ) { int [ ] A = { 1 , 1 , 2 , 3 } ; int N = A . Length ; Console . WriteLine ( minimum_sum ( A , N ) ) ; } }

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