dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; public class GFG { static int __builtin_popcount ( int n ) { int count = 0 ; while ( n > 0 ) { count += n & 1 ; n >>= 1 ; } return count ; } static void countEvenOdd ( int [ ] arr , int n , int K ) { int even = 0 , odd = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int x = __builtin_popcount ( arr [ i ] ) ; if ( x % 2 == 0 ) even ++ ; else odd ++ ; } int y ; y = __builtin_popcount ( K ) ; if ( ( y & 1 ) != 0 ) { Console . WriteLine ( " Even ▁ = ▁ " + odd + " , ▁ Odd ▁ = ▁ " + even ) ; } else { Console . WriteLine ( " Even ▁ = ▁ " + even + " , ▁ Odd ▁ = ▁ " + odd ) ; } } public static void Main ( string [ ] args ) { int [ ] arr = { 4 , 2 , 15 , 9 , 8 , 8 } ; int K = 3 ; int n = arr . Length ; countEvenOdd ( arr , n , K ) ; } }

Index/key variables: i
Accumulator variables: count, even, i, odd
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static void Main ( ) { int N = 6 ; int Even = N / 2 ; int Odd = N - Even ; Console . WriteLine ( Even * Odd ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static int longestSubSequence ( int [ , ] A , int N , int ind , int lastf , int lasts ) { ind = ( ind > 0 ? ind : 0 ) ; lastf = ( lastf > 0 ? lastf : Int32 . MinValue ) ; lasts = ( lasts > 0 ? lasts : Int32 . MaxValue ) ; if ( ind == N ) return 0 ; int ans = longestSubSequence ( A , N , ind + 1 , lastf , lasts ) ; if ( A [ ind , 0 ] > lastf && A [ ind , 1 ] < lasts ) ans = Math . Max ( ans , longestSubSequence ( A , N , ind + 1 , A [ ind , 0 ] , A [ ind , 1 ] ) + 1 ) ; return ans ; } public static void Main ( ) { int [ , ] A = { { 1 , 2 } , { 2 , 2 } , { 3 , 1 } } ; int N = A . GetLength ( 0 ) ; Console . Write ( longestSubSequence ( A , N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int countTriplets ( int [ ] A ) { int cnt = 0 ; Dictionary < int , int > tuples = new Dictionary < int , int > ( ) ; foreach ( int a in A ) foreach ( int b in A ) { if ( tuples . ContainsKey ( a & b ) ) tuples [ a & b ] = tuples [ a & b ] + 1 ; else tuples . Add ( a & b , 1 ) ; } foreach ( int a in A ) foreach ( KeyValuePair < int , int > t in tuples ) if ( ( t . Key & a ) == 0 ) cnt += t . Value ; return cnt ; } public static void Main ( String [ ] args ) { int [ ] A = { 2 , 1 , 3 } ; Console . Write ( countTriplets ( A ) ) ; } }

Accumulator variables: cnt
Iterator variables: a, b, t
Class/struct names: GFG
C# program:
using System ; class GFG { public static void printSpiral ( int size ) { int row = 0 , col = 0 ; int boundary = size - 1 ; int sizeLeft = size - 1 ; int flag = 1 ; char move = ' r ' ; int [ , ] matrix = new int [ size , size ] ; for ( int i = 1 ; i < size * size + 1 ; i ++ ) { matrix [ row , col ] = i ; switch ( move ) { case ' r ' : col += 1 ; break ; case ' l ' : col -= 1 ; break ; case ' u ' : row -= 1 ; break ; case ' d ' : row += 1 ; break ; } if ( i == boundary ) { boundary += sizeLeft ; if ( flag != 2 ) { flag = 2 ; } else { flag = 1 ; sizeLeft -= 1 ; } switch ( move ) { case ' r ' : move = ' d ' ; break ; case ' d ' : move = ' l ' ; break ; case ' l ' : move = ' u ' ; break ; case ' u ' : move = ' r ' ; break ; } } } for ( row = 0 ; row < size ; row ++ ) { for ( col = 0 ; col < size ; col ++ ) { int n = matrix [ row , col ] ; Console . Write ( ( n < 10 ) ? ( n + " ▁ " ) : ( n + " ▁ " ) ) ; } Console . WriteLine ( ) ; } } public static void Main ( String [ ] args ) { int size = 5 ; printSpiral ( size ) ; } }

Accumulator variables: boundary, col, i, row, sizeLeft
Iterator variables: col, i, row
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; using System . Linq ; class GFG { static void findWinner ( string a , int n ) { List < int > v = new List < int > ( ) ; int c = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] == '0' ) { c ++ ; } else { if ( c != 0 ) v . Add ( c ) ; c = 0 ; } } if ( c != 0 ) v . Add ( c ) ; if ( v . Count == 0 ) { Console . Write ( " Player ▁ B " ) ; return ; } if ( v . Count == 1 ) { if ( ( v [ 0 ] & 1 ) != 0 ) Console . Write ( " Player ▁ A " ) ; else Console . Write ( " Player ▁ B " ) ; return ; } int first = Int32 . MinValue ; int second = Int32 . MinValue ; for ( int i = 0 ; i < v . Count ; i ++ ) { if ( a [ i ] > first ) { second = first ; first = a [ i ] ; } else if ( a [ i ] > second && a [ i ] != first ) second = a [ i ] ; } if ( ( first & 1 ) != 0 && ( first + 1 ) / 2 > second ) Console . Write ( " Player ▁ A " ) ; else Console . Write ( " Player ▁ B " ) ; } public static void Main ( String [ ] args ) { string S = "1100011" ; int N = S . Length ; findWinner ( S , N ) ; } }

Index/key variables: i
Accumulator variables: c, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static bool can_Construct ( String S , int K ) { Dictionary < char , int > m = new Dictionary < char , int > ( ) ; int p = 0 ; if ( S . Length == K ) return true ; for ( int i = 0 ; i < S . Length ; i ++ ) if ( ! m . ContainsKey ( S [ i ] ) ) m . Add ( S [ i ] , 1 ) ; else m [ S [ i ] ] = m [ S [ i ] ] + 1 ; if ( K > S . Length ) return false ; else { foreach ( int h in m . Values ) { if ( h % 2 != 0 ) p = p + 1 ; } } if ( K < p ) return false ; return true ; } public static void Main ( String [ ] args ) { String S = " annabelle " ; int K = 4 ; if ( can_Construct ( S , K ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: h, i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool equalIgnoreCase ( String str1 , String str2 ) { str1 = str1 . ToUpper ( ) ; str2 = str2 . ToUpper ( ) ; int x = str1 . CompareTo ( str2 ) ; if ( x != 0 ) { return false ; } else { return true ; } } static void equalIgnoreCaseUtil ( String str1 , String str2 ) { bool res = equalIgnoreCase ( str1 , str2 ) ; if ( res == true ) { Console . WriteLine ( " Same " ) ; } else { Console . WriteLine ( " Not ▁ Same " ) ; } } public static void Main ( ) { String str1 , str2 ; str1 = " Geeks " ; str2 = " geeks " ; equalIgnoreCaseUtil ( str1 , str2 ) ; str1 = " Geek " ; str2 = " geeksforgeeks " ; equalIgnoreCaseUtil ( str1 , str2 ) ; } }

Class/struct names: GFG
C# program:
public class solution { using System ; public static void steps ( string str , int n ) { bool flag = false ; int x = 0 ; for ( int i = 0 ; i < str . Length ; i ++ ) { if ( x == 0 ) { flag = true ; } if ( x == n - 1 ) { flag = false ; } for ( int j = 0 ; j < x ; j ++ ) { Console . Write ( " * " ) ; } Console . Write ( str [ i ] + " STRNEWLINE " ) ; if ( flag == true ) { x ++ ; } else { x -- ; } } } public static void Main ( string [ ] args ) { int n = 4 ; string str = " GeeksForGeeks " ; Console . WriteLine ( " String : ▁ " + str ) ; Console . WriteLine ( " Max ▁ Length ▁ of ▁ Steps : ▁ " + n ) ; steps ( str , n ) ; } }

Index/key variables: i
Accumulator variables: i, j, x
Iterator variables: i, j
Boolean variables: flag
Class/struct names: solution
C# program:
using System ; class GFG { static void countFreq ( int [ ] arr , int n ) { Boolean [ ] visited = new Boolean [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { if ( visited [ i ] == true ) continue ; int count = 1 ; for ( int j = i + 1 ; j < n ; j ++ ) { if ( arr [ i ] == arr [ j ] ) { visited [ j ] = true ; count ++ ; } } Console . WriteLine ( arr [ i ] + " ▁ " + count ) ; } } public static void Main ( String [ ] args ) { int [ ] arr = { 10 , 20 , 20 , 10 , 10 , 20 , 5 , 20 } ; int n = arr . Length ; countFreq ( arr , n ) ; } }

Index/key variables: i, j, n
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isDivisible ( String str , int k ) { int n = str . Length ; int c = 0 ; for ( int i = 0 ; i < k ; i ++ ) if ( str [ n - i - 1 ] == '0' ) c ++ ; return ( c == k ) ; } public static void Main ( ) { String str1 = "10101100" ; int k = 2 ; if ( isDivisible ( str1 , k ) == true ) Console . Write ( " Yes STRNEWLINE " ) ; else Console . Write ( " No " ) ; String str2 = "111010100" ; k = 2 ; if ( isDivisible ( str2 , k ) == true ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Accumulator variables: c, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static int NO_OF_CHARS = 256 ; static bool canFormPalindrome ( string str ) { int [ ] count = new int [ NO_OF_CHARS ] ; for ( int i = 0 ; i < str . Length ; i ++ ) count [ str [ i ] ] ++ ; int odd = 0 ; for ( int i = 0 ; i < NO_OF_CHARS ; i ++ ) { if ( ( count [ i ] & 1 ) != 0 ) odd ++ ; if ( odd > 1 ) return false ; } return true ; } public static void Main ( ) { Console . WriteLine ( canFormPalindrome ( " geeksforgeeks " ) ? " Yes " : " No " ) ; Console . WriteLine ( canFormPalindrome ( " geeksogeeks " ) ? " Yes " : " No " ) ; } }

Index/key variables: NO_OF_CHARS, i
Accumulator variables: i, odd
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static bool isNumber ( string s ) { for ( int i = 0 ; i < s . Length ; i ++ ) if ( char . IsDigit ( s [ i ] ) == false ) return false ; return true ; } static public void Main ( String [ ] args ) { string str = "6790" ; if ( isNumber ( str ) ) Console . WriteLine ( " Integer " ) ; else Console . WriteLine ( " String " ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void reverse ( String str ) { if ( ( str == null ) || ( str . Length <= 1 ) ) Console . Write ( str ) ; else { Console . Write ( str [ str . Length - 1 ] ) ; reverse ( str . Substring ( 0 , ( str . Length - 1 ) ) ) ; } } public static void Main ( ) { String str = " Geeks ▁ for ▁ Geeks " ; reverse ( str ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static int box1 = 0 ; static int box2 = 0 ; static int [ ] fact = new int [ 11 ] ; public static double getProbability ( int [ ] balls ) { factorial ( 10 ) ; box2 = balls . Length ; int K = 0 ; for ( int i = 0 ; i < balls . Length ; i ++ ) K += balls [ i ] ; if ( K % 2 == 1 ) return 0 ; long all = comb ( K , K / 2 ) ; long validPermutationss = validPermutations ( ( K / 2 ) , balls , 0 , 0 ) ; return ( double ) validPermutationss / all ; } static long validPermutations ( int n , int [ ] balls , int usedBalls , int i ) { if ( usedBalls == n ) { return box1 == box2 ? 1 : 0 ; } if ( i >= balls . Length ) return 0 ; long res = validPermutations ( n , balls , usedBalls , i + 1 ) ; box1 ++ ; for ( int j = 1 ; j <= balls [ i ] ; j ++ ) { if ( j == balls [ i ] ) box2 -- ; long combinations = comb ( balls [ i ] , j ) ; res += combinations * validPermutations ( n , balls , usedBalls + j , i + 1 ) ; } box1 -- ; box2 ++ ; return res ; } static void factorial ( int N ) { fact [ 0 ] = 1 ; for ( int i = 1 ; i <= N ; i ++ ) fact [ i ] = fact [ i - 1 ] * i ; } static long comb ( int n , int r ) { long res = fact [ n ] / fact [ r ] ; res /= fact [ n - r ] ; return res ; } public static void Main ( String [ ] args ) { int [ ] arr = { 2 , 1 , 1 } ; int N = 4 ; Console . WriteLine ( getProbability ( arr ) ) ; } }

Index/key variables: i, n, r
Accumulator variables: K, box1, box2, i, j, res
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static double polyarea ( double n , double r ) { if ( r < 0 && n < 0 ) return - 1 ; double A = ( ( r * r * n ) * Math . Sin ( ( 360 / n ) * 3.14159 / 180 ) ) / 2 ; return A ; } public static void Main ( ) { float r = 9 , n = 6 ; Console . WriteLine ( polyarea ( n , r ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { static void is_partition_possible ( int n , int [ ] x , int [ ] y , int [ ] w ) { Dictionary < int , int > weight_at_x = new Dictionary < int , int > ( ) ; int max_x = ( int ) - 2e3 , min_x = ( int ) 2e3 ; for ( int i = 0 ; i < n ; i ++ ) { int new_x = x [ i ] - y [ i ] ; max_x = Math . Max ( max_x , new_x ) ; min_x = Math . Min ( min_x , new_x ) ; if ( weight_at_x . ContainsKey ( new_x ) ) { weight_at_x [ new_x ] += w [ i ] ; } else { weight_at_x . Add ( new_x , w [ i ] ) ; } } List < int > sum_till = new List < int > ( ) ; sum_till . Add ( 0 ) ; for ( int s = min_x ; s <= max_x ; s ++ ) { if ( ! weight_at_x . ContainsKey ( s ) ) { sum_till . Add ( sum_till [ sum_till . Count - 1 ] ) ; } else { sum_till . Add ( sum_till [ sum_till . Count - 1 ] + weight_at_x [ s ] ) ; } } int total_sum = sum_till [ sum_till . Count - 1 ] ; int partition_possible = 0 ; for ( int i = 1 ; i < sum_till . Count ; i ++ ) { if ( sum_till [ i ] == total_sum - sum_till [ i ] ) partition_possible = 1 ; if ( sum_till [ i - 1 ] == total_sum - sum_till [ i ] ) partition_possible = 1 ; } Console . WriteLine ( partition_possible == 1 ? " YES " : " NO " ) ; } static public void Main ( ) { int n = 3 ; int [ ] x = { - 1 , - 2 , 1 } ; int [ ] y = { 1 , 1 , - 1 } ; int [ ] w = { 3 , 1 , 4 } ; is_partition_possible ( n , x , y , w ) ; } }

Index/key variables: i, new_x, s
Accumulator variables: i, s
Iterator variables: i, s
Class/struct names: GFG
C# program:
using System ; class GFG { static double findPCSlope ( double m ) { return - 1.0 / m ; } public static void Main ( ) { double m = 2.0 ; Console . Write ( findPCSlope ( m ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static float pi = 3.14159f ; static float area_of_segment ( float radius , float angle ) { float area_of_sector = pi * ( radius * radius ) * ( angle / 360 ) ; float area_of_triangle = ( float ) 1 / 2 * ( radius * radius ) * ( float ) Math . Sin ( ( angle * pi ) / 180 ) ; return area_of_sector - area_of_triangle ; } public static void Main ( ) { float radius = 10.0f , angle = 90.0f ; Console . WriteLine ( " Area ▁ of ▁ minor ▁ segment ▁ = ▁ " + area_of_segment ( radius , angle ) ) ; Console . WriteLine ( " Area ▁ of ▁ major ▁ segment ▁ = ▁ " + area_of_segment ( radius , ( 360 - angle ) ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void SectorArea ( double radius , double angle ) { if ( angle >= 360 ) Console . WriteLine ( " Angle ▁ not ▁ possible " ) ; else { double sector = ( ( 22 * radius * radius ) / 7 ) * ( angle / 360 ) ; Console . WriteLine ( sector ) ; } } public static void Main ( ) { double radius = 9 ; double angle = 60 ; SectorArea ( radius , angle ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int gcd ( int a , int b ) { if ( b == 0 ) { return a ; } return gcd ( b , a % b ) ; } static Dictionary < int , int > PrimeFactor ( int N ) { Dictionary < int , int > primef = new Dictionary < int , int > ( ) ; while ( N % 2 == 0 ) { if ( primef . ContainsKey ( 2 ) ) { primef [ 2 ] ++ ; } else { primef [ 2 ] = 1 ; } N = N / 2 ; } for ( int i = 3 ; i <= Math . Sqrt ( N ) ; i ++ ) { while ( N % i == 0 ) { if ( primef . ContainsKey ( i ) ) { primef [ i ] ++ ; } else { primef [ i ] = 1 ; } N = N / 2 ; } } if ( N > 2 ) { primef [ N ] = 1 ; } return primef ; } static int CountToMakeEqual ( int X , int Y ) { int gcdofXY = gcd ( X , Y ) ; int newX = Y / gcdofXY ; int newY = X / gcdofXY ; Dictionary < int , int > primeX = PrimeFactor ( newX ) ; Dictionary < int , int > primeY = PrimeFactor ( newY ) ; int ans = 0 ; foreach ( KeyValuePair < int , int > keys in primeX ) { if ( X % keys . Key != 0 ) { return - 1 ; } ans += primeX [ keys . Key ] ; } foreach ( KeyValuePair < int , int > keys in primeY ) { if ( Y % keys . Key != 0 ) { return - 1 ; } ans += primeY [ keys . Key ] ; } return ans ; } static void Main ( ) { int X = 36 ; int Y = 48 ; int ans = CountToMakeEqual ( X , Y ) ; Console . Write ( ans ) ; } }

Index/key variables: N, i
Accumulator variables: ans, i
Iterator variables: i, keys
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { class Node { public int L , R , V ; } ; static Node newNode ( int L , int R , int V ) { Node temp = new Node ( ) ; temp . L = L ; temp . R = R ; temp . V = V ; return temp ; } static bool check ( List < int > [ ] Adj , int Src , int N , bool [ ] visited ) { int [ ] color = new int [ N ] ; visited [ Src ] = true ; Queue < int > q = new Queue < int > ( ) ; q . Enqueue ( Src ) ; while ( q . Count > 0 ) { int u = q . Peek ( ) ; q . Dequeue ( ) ; int Col = color [ u ] ; foreach ( int x in Adj [ u ] ) { if ( visited [ x ] == true && color [ x ] == Col ) { return false ; } else if ( visited [ x ] == false ) { visited [ x ] = true ; q . Enqueue ( x ) ; color [ x ] = 1 - Col ; } } } return true ; } static void addEdge ( List < int > [ ] Adj , int u , int v ) { Adj [ u ] . Add ( v ) ; Adj [ v ] . Add ( u ) ; } static void isPossible ( Node [ ] Arr , int N ) { List < int > [ ] Adj = new List < int > [ N ] ; for ( int i = 0 ; i < N ; i ++ ) Adj [ i ] = new List < int > ( ) ; for ( int i = 0 ; i < N - 1 ; i ++ ) { for ( int j = i + 1 ; j < N ; j ++ ) { if ( Arr [ i ] . R < Arr [ j ] . L Arr [ i ] . L > Arr [ j ] . R ) { continue ; } else { if ( Arr [ i ] . V == Arr [ j ] . V ) { addEdge ( Adj , i , j ) ; } } } } bool [ ] visited = new bool [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { if ( visited [ i ] == false && Adj [ i ] . Count > 0 ) { if ( check ( Adj , i , N , visited ) == false ) { Console . Write ( " No " ) ; return ; } } } Console . Write ( " Yes " ) ; } public static void Main ( ) { Node [ ] arr = { newNode ( 5 , 7 , 2 ) , newNode ( 4 , 6 , 1 ) , newNode ( 1 , 5 , 2 ) , newNode ( 6 , 5 , 1 ) } ; int N = arr . Length ; isPossible ( arr , N ) ; } }

Index/key variables: N, Src, i, j, u, v, x
Accumulator variables: i, j
Iterator variables: i, j, x
Class/struct names: GFG, Node
C# program:
using System ; using System . Collections . Generic ; class GFG { public static void lexNumbers ( int n ) { List < int > sol = new List < int > ( ) ; dfs ( 1 , n , sol ) ; Console . WriteLine ( " [ " + string . Join ( " , ▁ " , sol ) + " ] " ) ; } public static void dfs ( int temp , int n , List < int > sol ) { if ( temp > n ) return ; sol . Add ( temp ) ; dfs ( temp * 10 , n , sol ) ; if ( temp % 10 != 9 ) dfs ( temp + 1 , n , sol ) ; } public static void Main ( ) { int n = 15 ; lexNumbers ( n ) ; } }

Class/struct names: GFG
C# program:
using System ; class GfG { static int minimumSwaps ( int [ ] arr ) { int count = 0 ; int i = 0 ; while ( i < arr . Length ) { if ( arr [ i ] != i + 1 ) { while ( arr [ i ] != i + 1 ) { int temp = 0 ; temp = arr [ arr [ i ] - 1 ] ; arr [ arr [ i ] - 1 ] = arr [ i ] ; arr [ i ] = temp ; count ++ ; } } i ++ ; } return count ; } public static void Main ( String [ ] args ) { int [ ] arr = { 2 , 3 , 4 , 1 , 5 } ; Console . WriteLine ( minimumSwaps ( arr ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Class/struct names: GfG
C# program:
using System ; class GFG { public class Node { public int data ; public Node next ; public Node prev ; } ; static Node append ( Node head_ref , int new_data ) { Node new_node = new Node ( ) ; Node last = head_ref ; new_node . data = new_data ; new_node . next = null ; if ( head_ref == null ) { new_node . prev = null ; head_ref = new_node ; return head_ref ; } while ( last . next != null ) last = last . next ; last . next = new_node ; new_node . prev = last ; return head_ref ; } static void printList ( Node node ) { Node last ; while ( node != null ) { Console . Write ( node . data + " ▁ " ) ; last = node ; node = node . next ; } } static Node mergeList ( Node p , Node q ) { Node s = null ; if ( p == null q == null ) { return ( p == null ? q : p ) ; } if ( p . data < q . data ) { p . prev = s ; s = p ; p = p . next ; } else { q . prev = s ; s = q ; q = q . next ; } Node head = s ; while ( p != null && q != null ) { if ( p . data < q . data ) { s . next = p ; p . prev = s ; s = s . next ; p = p . next ; } else { s . next = q ; q . prev = s ; s = s . next ; q = q . next ; } } if ( p == null ) { s . next = q ; q . prev = s ; } if ( q == null ) { s . next = p ; p . prev = s ; } return head ; } static Node mergeAllList ( Node [ ] head , int k ) { Node finalList = null ; for ( int i = 0 ; i < k ; i ++ ) { finalList = mergeList ( finalList , head [ i ] ) ; } return finalList ; } public static void Main ( ) { int k = 3 ; Node [ ] head = new Node [ k ] ; for ( int i = 0 ; i < k ; i ++ ) { head [ i ] = null ; } head [ 0 ] = append ( head [ 0 ] , 1 ) ; head [ 0 ] = append ( head [ 0 ] , 5 ) ; head [ 0 ] = append ( head [ 0 ] , 9 ) ; head [ 1 ] = append ( head [ 1 ] , 2 ) ; head [ 1 ] = append ( head [ 1 ] , 3 ) ; head [ 1 ] = append ( head [ 1 ] , 7 ) ; head [ 1 ] = append ( head [ 1 ] , 12 ) ; head [ 2 ] = append ( head [ 2 ] , 8 ) ; head [ 2 ] = append ( head [ 2 ] , 11 ) ; head [ 2 ] = append ( head [ 2 ] , 13 ) ; head [ 2 ] = append ( head [ 2 ] , 18 ) ; Node finalList = mergeAllList ( head , k ) ; printList ( finalList ) ; } }

Index/key variables: i, k
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG, Node
C# program:
using System ; class GFG { static int minIndex ( int [ ] a , int i , int j ) { if ( i == j ) return i ; int k = minIndex ( a , i + 1 , j ) ; return ( a [ i ] < a [ k ] ) ? i : k ; } static void recurSelectionSort ( int [ ] a , int n , int index ) { if ( index == n ) return ; int k = minIndex ( a , index , n - 1 ) ; if ( k != index ) { int temp = a [ k ] ; a [ k ] = a [ index ] ; a [ index ] = temp ; } recurSelectionSort ( a , n , index + 1 ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 3 , 1 , 5 , 2 , 7 , 0 } ; recurSelectionSort ( arr , arr . Length , 0 ) ; for ( int i = 0 ; i < arr . Length ; i ++ ) Console . Write ( arr [ i ] + " ▁ " ) ; } }

Index/key variables: i, index, k
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void insertionSortRecursive ( int [ ] arr , int n ) { if ( n <= 1 ) return ; insertionSortRecursive ( arr , n - 1 ) ; int last = arr [ n - 1 ] ; int j = n - 2 ; while ( j >= 0 && arr [ j ] > last ) { arr [ j + 1 ] = arr [ j ] ; j -- ; } arr [ j + 1 ] = last ; } static void Main ( ) { int [ ] arr = { 12 , 11 , 13 , 5 , 6 } ; insertionSortRecursive ( arr , arr . Length ) ; for ( int i = 0 ; i < arr . Length ; i ++ ) Console . Write ( arr [ i ] + " ▁ " ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void bubbleSort ( int [ ] arr , int n ) { if ( n == 1 ) return ; for ( int i = 0 ; i < n - 1 ; i ++ ) if ( arr [ i ] > arr [ i + 1 ] ) { int temp = arr [ i ] ; arr [ i ] = arr [ i + 1 ] ; arr [ i + 1 ] = temp ; } bubbleSort ( arr , n - 1 ) ; } static void Main ( ) { int [ ] arr = { 64 , 34 , 25 , 12 , 22 , 11 , 90 } ; bubbleSort ( arr , arr . Length ) ; Console . WriteLine ( " Sorted ▁ array ▁ : ▁ " ) ; for ( int i = 0 ; i < arr . Length ; i ++ ) Console . Write ( arr [ 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 int maxSumAfterPartition ( int [ ] arr , int n ) { List < int > pos = new List < int > ( ) ; List < int > neg = new List < int > ( ) ; int zero = 0 ; int pos_sum = 0 ; int neg_sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] > 0 ) { pos . Add ( arr [ i ] ) ; pos_sum += arr [ i ] ; } else if ( arr [ i ] < 0 ) { neg . Add ( arr [ i ] ) ; neg_sum += arr [ i ] ; } else { zero ++ ; } } int ans = 0 ; pos . Sort ( ) ; neg . Sort ( ) ; neg . Reverse ( ) ; if ( pos . Count > 0 && neg . Count > 0 ) { ans = ( pos_sum - neg_sum ) ; } else if ( pos . Count > 0 ) { if ( zero > 0 ) { ans = ( pos_sum ) ; } else { ans = ( pos_sum - 2 * pos [ 0 ] ) ; } } else { if ( zero > 0 ) { ans = ( - 1 * neg_sum ) ; } else { ans = ( neg [ 0 ] - ( neg_sum - neg [ 0 ] ) ) ; } } return ans ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 3 , - 5 , - 7 } ; int n = arr . Length ; Console . Write ( maxSumAfterPartition ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, neg_sum, pos_sum, zero
Iterator variables: i
Class/struct names: GFG