dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; using System . Collections . Generic ; class GFG { static int findX ( int [ ] a , int n ) { Array . Sort ( a ) ; int x = a [ 0 ] * a [ n - 1 ] ; List < int > vec = new List < int > ( ) ; for ( int i = 2 ; i * i <= x ; i ++ ) { if ( x % i == 0 ) { vec . Add ( i ) ; if ( ( x / i ) != i ) vec . Add ( x / i ) ; } } vec . Sort ( ) ; if ( vec . Count != n ) { return - 1 ; } else { int i = 0 ; foreach ( int it in vec ) { if ( a [ i ++ ] != it ) return - 1 ; } } return x ; } public static void Main ( String [ ] args ) { int [ ] a = { 2 , 5 , 4 , 10 } ; int n = a . Length ; Console . Write ( findX ( a , n ) ) ; } }

Accumulator variables: i
Iterator variables: i, it
Class/struct names: GFG
C# program:
using System ; class GFG { static void pendulumArrangement ( int [ ] arr , int n ) { Array . Sort ( arr ) ; int odd , temp , p , pos ; pos = n - 1 ; if ( n % 2 == 0 ) odd = n - 1 ; else odd = n - 2 ; while ( odd > 0 ) { temp = arr [ odd ] ; p = odd ; while ( p != pos ) { arr [ p ] = arr [ p + 1 ] ; p ++ ; } arr [ p ] = temp ; odd = odd - 2 ; pos = pos - 1 ; } int start = 0 , end = ( n - 1 ) / 2 ; for ( ; start < end ; start ++ , end -- ) { temp = arr [ start ] ; arr [ start ] = arr [ end ] ; arr [ end ] = temp ; } for ( int i = 0 ; i < n ; i ++ ) Console . Write ( arr [ i ] + " ▁ " ) ; } public static void Main ( ) { int [ ] arr = { 11 , 2 , 4 , 55 , 6 , 8 } ; int n = arr . Length ; pendulumArrangement ( arr , n ) ; } }

Index/key variables: end, i, odd, p, start
Accumulator variables: end, i, p, start
Iterator variables: i
Class/struct names: GFG
C# program:
using System . Collections . Generic ; using System ; class GFG { public class Node { public int data ; public Node left , right , root ; public Node ( int data ) { this . data = data ; } } public static Node AddNode ( Node root , int data ) { if ( root == null ) { root = new Node ( data ) ; return root ; } if ( root . data < data ) root . right = AddNode ( root . right , data ) ; else if ( root . data > data ) root . left = AddNode ( root . left , data ) ; return root ; } public static void TargetPair ( Node node , int tar ) { List < Node > LeftList = new List < Node > ( ) ; List < Node > RightList = new List < Node > ( ) ; Node curr_left = node ; Node curr_right = node ; while ( curr_left != null curr_right != null LeftList . Count > 0 && RightList . Count > 0 ) { while ( curr_left != null ) { LeftList . Add ( curr_left ) ; curr_left = curr_left . left ; } while ( curr_right != null ) { RightList . Add ( curr_right ) ; curr_right = curr_right . right ; } Node LeftNode = LeftList [ LeftList . Count - 1 ] ; Node RightNode = RightList [ RightList . Count - 1 ] ; int leftVal = LeftNode . data ; int rightVal = RightNode . data ; if ( leftVal >= rightVal ) break ; if ( leftVal + rightVal < tar ) { LeftList . RemoveAt ( LeftList . Count - 1 ) ; curr_left = LeftNode . right ; } else if ( leftVal + rightVal > tar ) { RightList . RemoveAt ( RightList . Count - 1 ) ; curr_right = RightNode . left ; } else { Console . WriteLine ( LeftNode . data + " ▁ " + RightNode . data ) ; RightList . RemoveAt ( RightList . Count - 1 ) ; LeftList . RemoveAt ( LeftList . Count - 1 ) ; curr_left = LeftNode . right ; curr_right = RightNode . left ; } } } public static void Main ( String [ ] b ) { Node root = null ; root = AddNode ( root , 2 ) ; root = AddNode ( root , 6 ) ; root = AddNode ( root , 5 ) ; root = AddNode ( root , 3 ) ; root = AddNode ( root , 4 ) ; root = AddNode ( root , 1 ) ; root = AddNode ( root , 7 ) ; int sum = 8 ; TargetPair ( root , sum ) ; } }

Class/struct names: GFG, Node
C# program:
using System ; class GFG { static int findNumber ( int [ ] arr , int n ) { Array . Sort ( arr ) ; int max = arr [ n - 1 ] ; int [ ] table = new int [ ( 2 * max ) + 1 ] ; table [ 0 ] = 0 ; for ( int i = 1 ; i < ( 2 * max ) + 1 ; i ++ ) table [ i ] = int . MaxValue ; int ans = - 1 ; for ( int i = 1 ; i < ( 2 * max ) + 1 ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( arr [ j ] <= i ) { int res = table [ i - arr [ j ] ] ; if ( res != int . MaxValue && res + 1 < table [ i ] ) table [ i ] = res + 1 ; } } if ( i > arr [ n - 1 ] && table [ i ] == int . MaxValue ) { ans = i ; break ; } } return ans ; } public static void Main ( ) { int [ ] arr = { 6 , 7 , 15 } ; int n = arr . Length ; Console . WriteLine ( findNumber ( 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 { static int MOD = 1000000007 ; static int max = 101 ; static long [ , ] C = new long [ max , max ] ; static long power ( long x , long y ) { long res = 1 ; x = x % MOD ; while ( y > 0 ) { if ( y % 2 == 1 ) { res = ( res * x ) % MOD ; } y = y >> 1 ; x = ( x * x ) % MOD ; } return res % MOD ; } static void combi ( int n , int k ) { int i , j ; for ( i = 0 ; i <= n ; i ++ ) { for ( j = 0 ; j <= Math . Min ( i , k ) ; j ++ ) { if ( j == 0 j == i ) C [ i , j ] = 1 ; else C [ i , j ] = ( C [ i - 1 , j - 1 ] % MOD + C [ i - 1 , j ] % MOD ) % MOD ; } } } static long product ( long [ ] a , int n , int k ) { long ans = 1 ; Array . Sort ( a ) ; long powa = C [ n - 1 , k - 1 ] ; for ( int i = 0 ; i < n ; i ++ ) { long powla = C [ i , k - 1 ] ; long powfa = C [ n - i - 1 , k - 1 ] ; long powe = ( ( powa % MOD ) - ( powla + powfa ) % MOD + MOD ) % MOD ; long mul = power ( a [ i ] , powe ) % MOD ; ans = ( ( ans % MOD ) * ( mul % MOD ) ) % MOD ; } return ans % MOD ; } static public void Main ( ) { combi ( 100 , 100 ) ; long [ ] arr = { 1 , 2 , 3 , 4 } ; int n = arr . Length ; int k = 3 ; long ans = product ( arr , n , k ) ; Console . WriteLine ( ans ) ; } }

Index/key variables: i
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int countPoints ( int n , int m , int [ ] a , int [ ] b , int x , int y ) { Array . Sort ( a ) ; Array . Sort ( b ) ; int j = 0 ; int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { while ( j < m ) { if ( a [ i ] + y < b [ j ] ) break ; if ( b [ j ] >= a [ i ] - x && b [ j ] <= a [ i ] + y ) { count ++ ; j ++ ; break ; } else j ++ ; } } return count ; } public static void Main ( ) { int x = 1 , y = 4 ; int [ ] a = { 1 , 5 } ; int n = a . Length ; int [ ] b = { 1 , 1 , 2 } ; int m = a . Length ; Console . WriteLine ( countPoints ( n , m , a , b , x , y ) ) ; } }

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int N = 4 ; static void merge_and_sort ( int [ ] output , int [ , ] arr , int n , int k ) { for ( int i = 0 ; i < k ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { output [ i * n + j ] = arr [ i , j ] ; } } Array . Sort ( output ) ; } static void Main ( ) { int [ , ] arr = { { 5 , 7 , 15 , 18 } , { 1 , 8 , 9 , 17 } , { 1 , 4 , 7 , 7 } } ; int n = N ; int k = arr . GetLength ( 0 ) ; int [ ] output = new int [ n * k ] ; merge_and_sort ( output , arr , n , k ) ; for ( int i = 0 ; i < n * k ; i ++ ) Console . Write ( output [ i ] + " ▁ " ) ; } }

Index/key variables: i
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int minOperations ( int n , int m , int k , List < List < int > > matrix ) { List < int > arr = new List < int > ( ) ; int mod ; if ( matrix [ 0 ] [ 0 ] < 0 ) { mod = k - ( Math . Abs ( matrix [ 0 ] [ 0 ] ) % k ) ; } else { mod = matrix [ 0 ] [ 0 ] % k ; } for ( int i = 0 ; i < n ; ++ i ) { for ( int j = 0 ; j < m ; ++ j ) { arr . Add ( matrix [ i ] [ j ] ) ; int val = matrix [ i ] [ j ] ; if ( val < 0 ) { int res = k - ( Math . Abs ( val ) % k ) ; if ( res != mod ) { return - 1 ; } } else { int foo = matrix [ i ] [ j ] ; if ( foo % k != mod ) { return - 1 ; } } } } arr . Sort ( ) ; 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 ; } static void Main ( ) { List < List < int > > matrix = new List < List < int > > { new List < int > { 2 , 4 , 6 } , new List < int > { 8 , 10 , 12 } , new List < int > { 14 , 16 , 18 } , new List < int > { 20 , 22 , 24 } , } ; int n = matrix . Count ; int m = matrix [ 0 ] . Count ; int k = 2 ; Console . Write ( minOperations ( n , m , k , matrix ) ) ; } }

Index/key variables: i, j
Accumulator variables: minOperations, minOperations2
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Linq ; public class GFG { static int minSubarray ( int [ ] A , int n ) { int minValue = A . Min ( ) ; int maxValue = A . Max ( ) ; int pos_min = - 1 , pos_max = - 1 , ans = int . MaxValue ; for ( int i = 0 ; i < n ; i ++ ) { if ( A [ i ] == minValue ) pos_min = i ; if ( A [ i ] == maxValue ) pos_max = i ; if ( pos_max != - 1 && pos_min != - 1 ) ans = Math . Min ( ans , Math . Abs ( pos_min - pos_max ) + 1 ) ; } return ans ; } static public void Main ( ) { int [ ] A = { 1 , 5 , 9 , 7 , 1 , 9 , 4 } ; int n = A . Length ; Console . WriteLine ( minSubarray ( A , n ) ) ; } }

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

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static long minimumMoves ( int [ ] a , int n ) { long operations = 0 ; Array . Sort ( a ) ; for ( int i = 0 ; i < n ; i ++ ) operations += ( long ) Math . Abs ( a [ i ] - ( i + 1 ) ) ; return operations ; } static public void Main ( ) { int [ ] arr = { 5 , 3 , 2 } ; int n = arr . Length ; Console . WriteLine ( minimumMoves ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, operations
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void printCase ( int n ) { if ( n <= 2 ) { Console . Write ( - 1 ) ; return ; } for ( int i = n ; i >= 1 ; i -- ) Console . Write ( i + " ▁ " ) ; } public static void Main ( ) { int n = 3 ; printCase ( n ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections ; using System . Collections . Generic ; class GFG { class sortHelper : IComparer { int IComparer . Compare ( object a , object b ) { Pair first = ( Pair ) a ; Pair second = ( Pair ) b ; if ( first . first == second . first ) { return first . second - second . second ; } return first . first - second . first ; } } public class Pair { public int first , second ; public Pair ( int first , int second ) { this . first = first ; this . second = second ; } } static void findMissingNumber ( ArrayList ranges , int m ) { IComparer myComparer = new sortHelper ( ) ; ranges . Sort ( myComparer ) ; ArrayList ans = new ArrayList ( ) ; int prev = 0 ; for ( int j = 0 ; j < ranges . Count ; j ++ ) { int start = ( ( Pair ) ranges [ j ] ) . first ; int end = ( ( Pair ) ranges [ j ] ) . second ; for ( int i = prev + 1 ; i < start ; i ++ ) ans . Add ( i ) ; prev = end ; } for ( int i = prev + 1 ; i <= m ; i ++ ) ans . Add ( i ) ; for ( int i = 0 ; i < ans . Count ; i ++ ) { if ( ( int ) ans [ i ] <= m ) Console . Write ( ans [ i ] + " ▁ " ) ; } } public static void Main ( string [ ] args ) { int M = 6 ; ArrayList ranges = new ArrayList ( ) ; ranges . Add ( new Pair ( 1 , 2 ) ) ; ranges . Add ( new Pair ( 4 , 5 ) ) ; findMissingNumber ( ranges , M ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG, Pair, sortHelper
C# program:
using System ; class GFG { static bool check ( int n , int k , int [ ] a , int [ ] b ) { Array . Sort ( a ) ; Array . Sort ( b ) ; bool fl = false ; int ind = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] != b [ i ] ) { if ( fl == true ) { return false ; } fl = true ; ind = i ; } } if ( ind == - 1 | Math . Abs ( a [ ind ] - b [ ind ] ) <= k ) { return true ; } return false ; } public static void Main ( ) { int n = 2 , k = 4 ; int [ ] a = { 1 , 5 } ; int [ ] b = { 1 , 1 } ; if ( check ( n , k , a , b ) ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } }

Index/key variables: i, ind
Accumulator variables: i
Iterator variables: i
Boolean variables: fl
Class/struct names: GFG
C# program:
using System ; class GFG { static int MOD = 1000000007 ; static int SubseqWidths ( int [ ] A , int n ) { Array . Sort ( A ) ; int [ ] pow2 = new int [ n ] ; pow2 [ 0 ] = 1 ; for ( int i = 1 ; i < n ; ++ i ) pow2 [ i ] = ( pow2 [ i - 1 ] * 2 ) % MOD ; int ans = 0 ; for ( int i = 0 ; i < n ; ++ i ) ans = ( ans + ( pow2 [ i ] - pow2 [ n - 1 - i ] ) * A [ i ] ) % MOD ; return ans ; } static void Main ( ) { int [ ] A = new int [ ] { 5 , 6 , 4 , 3 , 8 } ; int n = A . Length ; Console . WriteLine ( SubseqWidths ( A , n ) ) ; } }

Index/key variables: i, n
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Linq ; class GFG { static int maxArrayCover ( int [ ] a , int n , int x ) { Array . Sort ( a ) ; int cc = 0 ; int s = 0 ; for ( int i = 0 ; i < n ; i ++ ) { s += a [ i ] ; if ( s > x ) { break ; } cc += 1 ; } if ( a . Sum ( ) == x ) { return n ; } else { if ( cc == n ) { return n - 1 ; } else { return cc ; } } } public static void Main ( ) { int n = 3 ; int x = 70 ; int [ ] a = new int [ ] { 10 , 20 , 30 } ; Console . WriteLine ( maxArrayCover ( a , n , x ) ) ; } }

Index/key variables: i
Accumulator variables: cc, i, s
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Linq ; class GFG { static void QRsort ( int [ ] arr , int size ) { int MAX = arr . Max ( ) ; int MIN = arr . Min ( ) ; Console . WriteLine ( " Maximum ▁ Element ▁ found ▁ is ▁ : ▁ " + MAX ) ; Console . WriteLine ( " Minimum ▁ Element ▁ found ▁ is ▁ : ▁ " + MIN ) ; int COL = MIN ; int ROW = MAX / MIN + 1 ; int [ , ] matrix = new int [ ROW , COL ] ; for ( int i = 0 ; i < size ; i ++ ) { int quotient = arr [ i ] / MIN ; int remainder = arr [ i ] % MIN ; matrix [ quotient , remainder ] = arr [ i ] ; } int k = 0 ; for ( int i = 0 ; i < ROW ; i ++ ) { for ( int j = 0 ; j < COL ; j ++ ) { if ( matrix [ i , j ] != 0 ) { arr [ k ++ ] = matrix [ i , j ] ; } } } } static void printArray ( int [ ] arr , int size ) { for ( int i = 0 ; i < size ; i ++ ) { Console . Write ( arr [ i ] + " ▁ " ) ; } Console . WriteLine ( ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 5 , 3 , 7 , 4 , 8 , 2 , 6 } ; int size = arr . Length ; Console . WriteLine ( " Initial ▁ Array ▁ : ▁ " ) ; printArray ( arr , size ) ; QRsort ( arr , size ) ; Console . WriteLine ( " Array ▁ after ▁ sorting ▁ : ▁ " ) ; printArray ( arr , size ) ; } }

Index/key variables: i
Accumulator variables: i, j, k
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { public class Node { public int data ; public Node next ; } ; static Node start ; static Boolean isPairWiseSorted ( Node head ) { Boolean flag = true ; Node temp = head ; while ( temp != null && temp . next != null ) { if ( temp . data > temp . next . data ) { flag = false ; break ; } temp = temp . next . next ; } return flag ; } static void push ( Node head_ref , int new_data ) { Node new_node = new Node ( ) ; new_node . data = new_data ; new_node . next = head_ref ; head_ref = new_node ; start = head_ref ; } public static void Main ( String [ ] args ) { start = null ; push ( start , 5 ) ; push ( start , 1 ) ; push ( start , 9 ) ; push ( start , 9 ) ; push ( start , 15 ) ; push ( start , 10 ) ; if ( isPairWiseSorted ( start ) ) Console . WriteLine ( " YES " ) ; else Console . WriteLine ( " NO " ) ; } }

Boolean variables: flag
Class/struct names: GFG, Node
C# program:
using System ; class GFG { static int countTriplets ( int [ ] arr , int n , int m ) { int count = 0 ; Array . Sort ( arr ) ; int end , start , mid ; for ( end = n - 1 ; end >= 2 ; end -- ) { start = 0 ; mid = end - 1 ; while ( start < mid ) { long prod = arr [ end ] * arr [ start ] * arr [ mid ] ; if ( prod > m ) mid -- ; else if ( prod < m ) start ++ ; else if ( prod == m ) { count ++ ; mid -- ; start ++ ; } } } return count ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 1 , 1 , 1 , 1 , 1 } ; int n = arr . Length ; int m = 1 ; Console . WriteLine ( countTriplets ( arr , n , m ) ) ; } }

Index/key variables: end, mid, start
Accumulator variables: count, end, mid, start
Iterator variables: end
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int distribution ( int [ ] arr , int n ) { HashSet < int > resources = new HashSet < int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) resources . Add ( arr [ i ] ) ; return Math . Min ( resources . Count , n / 2 ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 1 , 2 , 1 , 3 , 4 } ; int n = arr . Length ; Console . Write ( distribution ( arr , n ) + " STRNEWLINE " ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void sort3 ( int [ ] arr , int [ ] temp ) { if ( arr [ 1 ] < arr [ 0 ] ) { temp [ 0 ] = arr [ 0 ] ; arr [ 0 ] = arr [ 1 ] ; arr [ 1 ] = temp [ 0 ] ; } if ( arr [ 2 ] < arr [ 1 ] ) { temp [ 0 ] = arr [ 1 ] ; arr [ 1 ] = arr [ 2 ] ; arr [ 2 ] = temp [ 0 ] ; if ( arr [ 1 ] < arr [ 0 ] ) { temp [ 0 ] = arr [ 0 ] ; arr [ 0 ] = arr [ 1 ] ; arr [ 1 ] = temp [ 0 ] ; } } } public static void Main ( String [ ] args ) { int [ ] a = new int [ ] { 10 , 12 , 5 } ; int [ ] temp1 = new int [ 10 ] ; sort3 ( a , temp1 ) ; 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 ; using System . Linq ; class GFG { static void merge ( int [ ] arr , int beg , int mid , int end , int maxele ) { int i = beg ; int j = mid + 1 ; int k = beg ; while ( i <= mid && j <= end ) { if ( arr [ i ] % maxele <= arr [ j ] % maxele ) { arr [ k ] = arr [ k ] + ( arr [ i ] % maxele ) * maxele ; k ++ ; i ++ ; } else { arr [ k ] = arr [ k ] + ( arr [ j ] % maxele ) * maxele ; k ++ ; j ++ ; } } while ( i <= mid ) { arr [ k ] = arr [ k ] + ( arr [ i ] % maxele ) * maxele ; k ++ ; i ++ ; } while ( j <= end ) { arr [ k ] = arr [ k ] + ( arr [ j ] % maxele ) * maxele ; k ++ ; j ++ ; } for ( i = beg ; i <= end ; i ++ ) arr [ i ] = arr [ i ] / maxele ; } static void mergeSortRec ( int [ ] arr , int beg , int end , int maxele ) { if ( beg < end ) { int mid = ( beg + end ) / 2 ; mergeSortRec ( arr , beg , mid , maxele ) ; mergeSortRec ( arr , mid + 1 , end , maxele ) ; merge ( arr , beg , mid , end , maxele ) ; } } static void mergeSort ( int [ ] arr , int n ) { int maxele = arr . Max ( ) + 1 ; mergeSortRec ( arr , 0 , n - 1 , maxele ) ; } public static void Main ( ) { int [ ] arr = { 999 , 612 , 589 , 856 , 56 , 945 , 243 } ; int n = arr . Length ; mergeSort ( arr , n ) ; Console . WriteLine ( " Sorted ▁ array ▁ " ) ; for ( int i = 0 ; i < n ; i ++ ) Console . Write ( arr [ i ] + " ▁ " ) ; } }

Index/key variables: i, j, k
Accumulator variables: i, j, k
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void printTriplets ( int [ ] arr , int n , int sum ) { Array . Sort ( arr ) ; for ( int i = 0 ; i < n - 2 ; i ++ ) { int j = i + 1 , k = n - 1 ; while ( j < k ) { if ( arr [ i ] + arr [ j ] + arr [ k ] >= sum ) k -- ; else { for ( int x = j + 1 ; x <= k ; x ++ ) Console . WriteLine ( arr [ i ] + " , ▁ " + arr [ j ] + " , ▁ " + arr [ x ] ) ; j ++ ; } } } } 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, x
Accumulator variables: i, j, k, x
Iterator variables: i, x
Class/struct names: GFG
C# program:
using System ; using System . Collections ; class GFG { static void printSorted ( string s , int l ) { Stack stack = new Stack ( ) ; Stack tempstack = new Stack ( ) ; stack . Push ( s [ 0 ] ) ; for ( int i = 1 ; i < l ; i ++ ) { int a = s [ i ] ; int b = ( int ) ( ( char ) stack . Peek ( ) ) ; if ( ( a - b ) >= 1 || ( a == b ) ) stack . Push ( s [ i ] ) ; else if ( ( b - a ) >= 1 ) { while ( ( b - a ) >= 1 ) { tempstack . Push ( stack . Peek ( ) ) ; stack . Pop ( ) ; if ( stack . Count > 0 ) b = ( int ) ( ( char ) stack . Peek ( ) ) ; else break ; } stack . Push ( s [ i ] ) ; while ( tempstack . Count > 0 ) { stack . Push ( tempstack . Peek ( ) ) ; tempstack . Pop ( ) ; } } } string answer = " " ; while ( stack . Count > 0 ) { answer = stack . Peek ( ) + answer ; stack . Pop ( ) ; } Console . WriteLine ( answer ) ; } static void Main ( ) { string s = " geeksforgeeks " ; int l = s . Length ; printSorted ( s , l ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool checkFittingArrays ( int [ ] A , int [ ] B , int N ) { Array . Sort ( A ) ; Array . Sort ( B ) ; for ( int i = 0 ; i < N ; i ++ ) if ( A [ i ] > B [ i ] ) return false ; return true ; } public static void Main ( ) { int [ ] A = { 7 , 5 , 3 , 2 } ; int [ ] B = { 5 , 4 , 8 , 7 } ; int N = A . Length ; if ( checkFittingArrays ( A , B , N ) ) 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 maximum_toys ( int [ ] cost , int N , int K ) { int count = 0 , sum = 0 ; Array . Sort ( cost ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( sum + cost [ i ] <= K ) { sum = sum + cost [ i ] ; count ++ ; } } return count ; } public static void Main ( ) { int K = 50 ; int [ ] cost = { 1 , 12 , 5 , 111 , 200 , 1000 , 10 , 9 , 12 , 15 } ; int N = cost . Length ; Console . Write ( maximum_toys ( cost , N , K ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static string areBookingsPossible ( int [ ] A , int [ ] B , int K ) { Array . Sort ( A ) ; Array . Sort ( B ) ; for ( int i = 0 ; i < A . Length ; i ++ ) { if ( i + K < A . Length && A [ i + K ] < B [ i ] ) { return " No " ; } } return " Yes " ; } static void Main ( ) { int [ ] arrival = { 1 , 2 , 3 } ; int [ ] departure = { 2 , 3 , 4 } ; int K = 1 ; Console . Write ( areBookingsPossible ( arrival , departure , 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 void printVector ( List < int > V ) { for ( int i = 0 ; i < V . Count ; i ++ ) { Console . Write ( V [ i ] + " ▁ " ) ; } Console . WriteLine ( ) ; } static void insertionSortRecursive ( List < int > V , int N ) { if ( N <= 1 ) return ; insertionSortRecursive ( V , N - 1 ) ; int j = N - 1 ; while ( j > 0 && V [ j ] < V [ j - 1 ] ) { int temp = V [ j ] ; V [ j ] = V [ j - 1 ] ; V [ j - 1 ] = temp ; j -= 1 ; } } public static void Main ( String [ ] args ) { List < int > A = new List < int > ( ) ; A . Insert ( 0 , 9 ) ; A . Insert ( 1 , 8 ) ; A . Insert ( 2 , 7 ) ; A . Insert ( 3 , 5 ) ; A . Insert ( 4 , 2 ) ; A . Insert ( 5 , 1 ) ; A . Insert ( 6 , 2 ) ; A . Insert ( 7 , 3 ) ; Console . Write ( " Array : ▁ " ) ; printVector ( A ) ; Console . Write ( " After ▁ Sorting ▁ : " ) ; insertionSortRecursive ( A , A . Count ) ; printVector ( A ) ; } }

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