dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; using System . Collections . Generic ; class GFG { static int missingK ( int [ ] a , int k , int n ) { int difference = 0 , ans = 0 , count = k ; bool flag = false ; for ( int i = 0 ; i < n - 1 ; i ++ ) { difference = 0 ; if ( ( a [ i ] + 1 ) != a [ i + 1 ] ) { difference += ( a [ i + 1 ] - a [ i ] ) - 1 ; if ( difference >= count ) { ans = a [ i ] + count ; flag = true ; break ; } else count -= difference ; } } if ( flag ) return ans ; else return - 1 ; } public static void Main ( ) { int [ ] a = { 1 , 5 , 11 , 19 } ; int k = 11 ; int n = a . Length ; int missing = missingK ( a , k , n ) ; Console . Write ( missing ) ; } }

Index/key variables: i
Accumulator variables: count, difference, i
Iterator variables: i
Boolean variables: flag
Class/struct names: GFG
C# program:
using System ; class GFG { static int missingK ( int [ ] arr , int k ) { int n = arr . Length ; int l = 0 , u = n - 1 , mid ; while ( l <= u ) { mid = ( l + u ) / 2 ; int numbers_less_than_mid = arr [ mid ] - ( mid + 1 ) ; if ( numbers_less_than_mid == k ) { if ( mid > 0 && ( arr [ mid - 1 ] - ( mid ) ) == k ) { u = mid - 1 ; continue ; } return arr [ mid ] - 1 ; } if ( numbers_less_than_mid < k ) { l = mid + 1 ; } else if ( k < numbers_less_than_mid ) { u = mid - 1 ; } } if ( u < 0 ) return k ; int less = arr [ u ] - ( u + 1 ) ; k -= less ; return arr [ u ] + k ; } static void Main ( ) { int [ ] arr = { 2 , 3 , 4 , 7 , 11 } ; int k = 5 ; Console . WriteLine ( " Missing ▁ kth ▁ number ▁ = ▁ " + missingK ( arr , k ) ) ; } }

Index/key variables: mid, u
Accumulator variables: k
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { public class Node { public int data ; public Node next ; } static void printList ( Node node ) { while ( node != null ) { Console . Write ( node . data + " ▁ " ) ; node = node . next ; } Console . WriteLine ( ) ; } static Node newNode ( int key ) { Node temp = new Node ( ) ; temp . data = key ; temp . next = null ; return temp ; } static Node insertBeg ( Node head , int val ) { Node temp = newNode ( val ) ; temp . next = head ; head = temp ; return head ; } static void rearrangeOddEven ( Node head ) { Stack < Node > odd = new Stack < Node > ( ) ; Stack < Node > even = new Stack < Node > ( ) ; int i = 1 ; while ( head != null ) { if ( head . data % 2 != 0 && i % 2 == 0 ) { odd . Push ( head ) ; } else if ( head . data % 2 == 0 && i % 2 != 0 ) { even . Push ( head ) ; } head = head . next ; i ++ ; } while ( odd . Count > 0 && even . Count > 0 ) { int k = odd . Peek ( ) . data ; odd . Peek ( ) . data = even . Peek ( ) . data ; even . Peek ( ) . data = k ; odd . Pop ( ) ; even . Pop ( ) ; } } public static void Main ( String [ ] args ) { Node head = newNode ( 8 ) ; head = insertBeg ( head , 7 ) ; head = insertBeg ( head , 6 ) ; head = insertBeg ( head , 5 ) ; head = insertBeg ( head , 3 ) ; head = insertBeg ( head , 2 ) ; head = insertBeg ( head , 1 ) ; Console . WriteLine ( " Linked ▁ List : " ) ; printList ( head ) ; rearrangeOddEven ( head ) ; Console . WriteLine ( " Linked ▁ List ▁ after ▁ " + " Rearranging : " ) ; printList ( head ) ; } }

Accumulator variables: i
Class/struct names: GFG, Node
C# program:
using System ; class GFG { public class Node { public int data ; public Node next ; } ; static void printList ( Node node ) { while ( node != null ) { Console . Write ( node . data + " ▁ " ) ; node = node . next ; } Console . WriteLine ( ) ; } static Node newNode ( int key ) { Node temp = new Node ( ) ; temp . data = key ; temp . next = null ; return temp ; } static Node insertBeg ( Node head , int val ) { Node temp = newNode ( val ) ; temp . next = head ; head = temp ; return head ; } static Node rearrange ( Node head ) { Node even ; Node temp , prev_temp ; Node i , j , k , l , ptr = null ; temp = ( head ) . next ; prev_temp = head ; while ( temp != null ) { Node x = temp . next ; if ( temp . data % 2 != 0 ) { prev_temp . next = x ; temp . next = ( head ) ; ( head ) = temp ; } else { prev_temp = temp ; } temp = x ; } temp = ( head ) . next ; prev_temp = ( head ) ; while ( temp != null && temp . data % 2 != 0 ) { prev_temp = temp ; temp = temp . next ; } even = temp ; prev_temp . next = null ; i = head ; j = even ; while ( j != null && i != null ) { k = i . next ; l = j . next ; i . next = j ; j . next = k ; ptr = j ; i = k ; j = l ; } if ( i == null ) { ptr . next = j ; } return head ; } public static void Main ( String [ ] args ) { Node head = newNode ( 8 ) ; head = insertBeg ( head , 7 ) ; head = insertBeg ( head , 6 ) ; head = insertBeg ( head , 3 ) ; head = insertBeg ( head , 5 ) ; head = insertBeg ( head , 1 ) ; head = insertBeg ( head , 2 ) ; head = insertBeg ( head , 10 ) ; Console . WriteLine ( " Linked ▁ List : " ) ; printList ( head ) ; Console . WriteLine ( " Rearranged ▁ List " ) ; head = rearrange ( head ) ; printList ( head ) ; } }

Class/struct names: GFG, Node
C# program:
using System ; public class GFG { static void print ( int [ , ] mat ) { for ( int i = 0 ; i < mat . GetLength ( 0 ) ; i ++ ) { for ( int j = 0 ; j < mat . GetLength ( 1 ) ; j ++ ) Console . Write ( mat [ i , j ] + " ▁ " ) ; Console . WriteLine ( ) ; } } static void performSwap ( int [ , ] mat , int i , int j ) { int N = mat . GetLength ( 0 ) ; int ei = N - 1 - i ; int ej = N - 1 - j ; int temp = mat [ i , j ] ; mat [ i , j ] = mat [ ej , i ] ; mat [ ej , i ] = mat [ ei , ej ] ; mat [ ei , ej ] = mat [ j , ei ] ; mat [ j , ei ] = temp ; } static void rotate ( int [ , ] mat , int N , int K ) { K = K % 4 ; while ( K -- > 0 ) { for ( int i = 0 ; i < N / 2 ; i ++ ) { for ( int j = i ; j < N - i - 1 ; j ++ ) { if ( i != j && ( i + j ) != N - 1 ) { performSwap ( mat , i , j ) ; } } } } print ( mat ) ; } public static void Main ( string [ ] args ) { int K = 5 ; int [ , ] mat = { { 1 , 2 , 3 , 4 } , { 6 , 7 , 8 , 9 } , { 11 , 12 , 13 , 14 } , { 16 , 17 , 18 , 19 } , } ; int N = mat . GetLength ( 0 ) ; rotate ( mat , N , K ) ; } }

Accumulator variables: K, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int findRotations ( String str ) { String tmp = str + str ; int n = str . Length ; for ( int i = 1 ; i <= n ; i ++ ) { String substring = tmp . Substring ( i , str . Length ) ; if ( str == substring ) return i ; } return n ; } public static void Main ( ) { String str = " abc " ; Console . Write ( findRotations ( str ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX = 10000 ; static int [ ] prefix = new int [ MAX + 1 ] ; static bool isPowerOfTwo ( int x ) { if ( x != 0 && ( ( x & ( x - 1 ) ) == 0 ) ) return true ; return false ; } static void computePrefix ( int n , int [ ] a ) { if ( isPowerOfTwo ( a [ 0 ] ) ) prefix [ 0 ] = 1 ; for ( int i = 1 ; i < n ; i ++ ) { prefix [ i ] = prefix [ i - 1 ] ; if ( isPowerOfTwo ( a [ i ] ) ) prefix [ i ] ++ ; } } static int query ( int L , int R ) { if ( L == 0 ) return prefix [ R ] ; return prefix [ R ] - prefix [ L - 1 ] ; } public static void Main ( ) { int [ ] A = { 3 , 8 , 5 , 2 , 5 , 10 } ; int N = A . Length ; computePrefix ( N , A ) ; Console . WriteLine ( query ( 0 , 4 ) ) ; Console . WriteLine ( query ( 3 , 5 ) ) ; } }

Index/key variables: R, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void countIntgralPoints ( int x1 , int y1 , int x2 , int y2 ) { Console . WriteLine ( ( y2 - y1 - 1 ) * ( x2 - x1 - 1 ) ) ; } static void Main ( ) { int x1 = 1 , y1 = 1 ; int x2 = 4 , y2 = 4 ; countIntgralPoints ( x1 , y1 , x2 , y2 ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void findNextNumber ( int n ) { int [ ] h = new int [ 10 ] ; int i = 0 , msb = n , rem = 0 ; int next_num = - 1 , count = 0 ; while ( msb > 9 ) { rem = msb % 10 ; h [ rem ] = 1 ; msb /= 10 ; count ++ ; } h [ msb ] = 1 ; count ++ ; for ( i = msb + 1 ; i < 10 ; i ++ ) { if ( h [ i ] == 0 ) { next_num = i ; break ; } } if ( next_num == - 1 ) { for ( i = 1 ; i < msb ; i ++ ) { if ( h [ i ] == 0 ) { next_num = i ; count ++ ; break ; } } } if ( next_num > 0 ) { for ( i = 0 ; i < 10 ; i ++ ) { if ( h [ i ] == 0 ) { msb = i ; break ; } } for ( i = 1 ; i < count ; i ++ ) { next_num = ( ( next_num * 10 ) + msb ) ; } if ( next_num > n ) Console . WriteLine ( next_num ) ; else Console . WriteLine ( " Not ▁ Possible " ) ; } else { Console . WriteLine ( " Not ▁ Possible " ) ; } } public static void Main ( string [ ] args ) { int n = 2019 ; findNextNumber ( n ) ; } }

Index/key variables: i, msb, rem
Accumulator variables: count, i, msb
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void CalculateValues ( int N ) { int A = 0 , B = 0 , C = 0 ; for ( C = 0 ; C < N / 7 ; C ++ ) { for ( B = 0 ; B < N / 5 ; B ++ ) { A = N - 7 * C - 5 * B ; if ( A >= 0 && A % 3 == 0 ) { Console . Write ( " A ▁ = ▁ " + A / 3 + " , ▁ B ▁ = ▁ " + B + " , ▁ C ▁ = ▁ " + C ) ; return ; } } } Console . WriteLine ( - 1 ) ; } static public void Main ( ) { int N = 19 ; CalculateValues ( 19 ) ; } }

Accumulator variables: B, C
Iterator variables: B, C
Class/struct names: GFG
C# program:
using System ; using System . Linq ; class GFG { static void minimumTime ( int [ ] arr , int n ) { int sum = 0 ; int T = arr . Min ( ) ; for ( int i = 0 ; i < n ; i ++ ) { sum += arr [ i ] ; } Console . WriteLine ( Math . Max ( 2 * T , sum ) ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 2 , 8 , 3 } ; int N = arr . Length ; minimumTime ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Text ; class GFG { static void lexicographicallyMax ( String s ) { int n = s . Length ; for ( int i = 0 ; i < n ; i ++ ) { int count = 0 ; int beg = i ; int end = i ; if ( s [ i ] == '1' ) count ++ ; for ( int j = i + 1 ; j < n ; j ++ ) { if ( s [ j ] == '1' ) count ++ ; if ( count % 2 == 0 && count != 0 ) { end = j ; break ; } } s = reverse ( s , beg , end + 1 ) ; } Console . WriteLine ( s ) ; } static String reverse ( String s , int beg , int end ) { StringBuilder x = new StringBuilder ( " " ) ; for ( int i = 0 ; i < beg ; i ++ ) x . Append ( s [ i ] ) ; for ( int i = end - 1 ; i >= beg ; i -- ) x . Append ( s [ i ] ) ; for ( int i = end ; i < s . Length ; i ++ ) x . Append ( s [ i ] ) ; return x . ToString ( ) ; } public static void Main ( String [ ] args ) { String S = "0101" ; lexicographicallyMax ( S ) ; } }

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { public static void maxPairs ( int [ ] nums , int k ) { Array . Sort ( nums ) ; int result = 0 ; int start = 0 , end = nums . Length - 1 ; while ( start < end ) { if ( nums [ start ] + nums [ end ] > k ) end -- ; else if ( nums [ start ] + nums [ end ] < k ) start ++ ; else { start ++ ; end -- ; result ++ ; } } Console . Write ( result ) ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 4 } ; int K = 5 ; maxPairs ( arr , K ) ; } }

Index/key variables: end, start
Accumulator variables: end, result, start
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { public static void maxPairs ( int [ ] nums , int k ) { Dictionary < int , int > map = new Dictionary < int , int > ( ) ; int result = 0 ; foreach ( int i in nums ) { if ( map . ContainsKey ( i ) && map [ i ] > 0 ) { map [ i ] = map [ i ] - 1 ; result ++ ; } else { if ( ! map . ContainsKey ( k - i ) ) map . Add ( k - i , 1 ) ; else map [ i ] = map [ i ] + 1 ; } } Console . WriteLine ( result ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 4 } ; int K = 5 ; maxPairs ( arr , K ) ; } }

Index/key variables: i
Accumulator variables: result
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void removeIndicesToMakeSumEqual ( int [ ] arr ) { int N = arr . Length ; int [ ] odd = new int [ N ] ; int [ ] even = new int [ N ] ; even [ 0 ] = arr [ 0 ] ; for ( int i = 1 ; i < N ; i ++ ) { odd [ i ] = odd [ i - 1 ] ; even [ i ] = even [ i - 1 ] ; if ( i % 2 == 0 ) { even [ i ] += arr [ i ] ; } else { odd [ i ] += arr [ i ] ; } } bool find = false ; int p = odd [ N - 1 ] ; int q = even [ N - 1 ] - arr [ 0 ] ; if ( p == q ) { Console . Write ( "0 ▁ " ) ; find = true ; } for ( int i = 1 ; i < N ; i ++ ) { if ( i % 2 == 0 ) { p = even [ N - 1 ] - even [ i - 1 ] - arr [ i ] + odd [ i - 1 ] ; q = odd [ N - 1 ] - odd [ i - 1 ] + even [ i - 1 ] ; } else { q = odd [ N - 1 ] - odd [ i - 1 ] - arr [ i ] + even [ i - 1 ] ; p = even [ N - 1 ] - even [ i - 1 ] + odd [ i - 1 ] ; } if ( p == q ) { find = true ; Console . Write ( i + " ▁ " ) ; } } if ( ! find ) { Console . Write ( - 1 ) ; } } public static void Main ( String [ ] args ) { int [ ] arr = { 4 , 1 , 6 , 2 } ; removeIndicesToMakeSumEqual ( arr ) ; } }

Index/key variables: N, i
Accumulator variables: i
Iterator variables: i
Boolean variables: find
Class/struct names: GFG
C# program:
using System ; class GFG { static void min_element_removal ( int [ ] arr , int N ) { int [ ] left = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) left [ i ] = 1 ; int [ ] right = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) right [ i ] = 1 ; for ( int i = 1 ; i < N ; i ++ ) { for ( int j = 0 ; j < i ; j ++ ) { if ( arr [ j ] < arr [ i ] ) { left [ i ] = Math . Max ( left [ i ] , left [ j ] + 1 ) ; } } } for ( int i = N - 2 ; i >= 0 ; i -- ) { for ( int j = N - 1 ; j > i ; j -- ) { if ( arr [ i ] > arr [ j ] ) { right [ i ] = Math . Max ( right [ i ] , right [ j ] + 1 ) ; } } } int maxLen = 0 ; for ( int i = 1 ; i < N - 1 ; i ++ ) { maxLen = Math . Max ( maxLen , left [ i ] + right [ i ] - 1 ) ; } Console . WriteLine ( N - maxLen ) ; } static void makeBitonic ( int [ ] arr , int N ) { if ( N == 1 ) { Console . WriteLine ( "0" ) ; return ; } if ( N == 2 ) { if ( arr [ 0 ] != arr [ 1 ] ) Console . WriteLine ( "0" ) ; else Console . WriteLine ( "1" ) ; return ; } min_element_removal ( arr , N ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 2 , 1 , 1 , 5 , 6 , 2 , 3 , 1 } ; int N = arr . Length ; makeBitonic ( arr , N ) ; } }

Index/key variables: N, i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void countSubarrays ( int [ ] A , int N ) { int ans = 0 ; for ( int i = 0 ; i < N - 1 ; i ++ ) { if ( A [ i ] != A [ i + 1 ] ) { ans ++ ; for ( int j = i - 1 , k = i + 2 ; j >= 0 && k < N && A [ j ] == A [ i ] && A [ k ] == A [ i + 1 ] ; j -- , k ++ ) { ans ++ ; } } } Console . Write ( ans + " STRNEWLINE " ) ; } public static void Main ( ) { int [ ] A = { 1 , 1 , 0 , 0 , 1 , 0 } ; int N = A . Length ; countSubarrays ( A , N ) ; } }

Index/key variables: i, j, k
Accumulator variables: ans, i, j, k
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int maxN = 2002 ; static int [ , ] lcount = new int [ maxN , maxN ] ; static int [ , ] rcount = new int [ maxN , maxN ] ; static void fill_counts ( int [ ] a , int n ) { int i , j ; int maxA = a [ 0 ] ; for ( i = 0 ; i < n ; i ++ ) { if ( a [ i ] > maxA ) { maxA = a [ i ] ; } } for ( i = 0 ; i < n ; i ++ ) { lcount [ a [ i ] , i ] = 1 ; rcount [ a [ i ] , i ] = 1 ; } for ( i = 0 ; i <= maxA ; i ++ ) { for ( j = 1 ; j < n ; j ++ ) { lcount [ i , j ] = lcount [ i , j - 1 ] + lcount [ i , j ] ; } for ( j = n - 2 ; j >= 0 ; j -- ) { rcount [ i , j ] = rcount [ i , j + 1 ] + rcount [ i , j ] ; } } } static int countSubsequence ( int [ ] a , int n ) { int i , j ; fill_counts ( a , n ) ; int answer = 0 ; for ( i = 1 ; i < n ; i ++ ) { for ( j = i + 1 ; j < n - 1 ; j ++ ) { answer += lcount [ a [ j ] , i - 1 ] * rcount [ a [ i ] , j + 1 ] ; } } return answer ; } public static void Main ( String [ ] args ) { int [ ] a = { 1 , 2 , 3 , 2 , 1 , 3 , 2 } ; Console . Write ( countSubsequence ( a , a . Length ) ) ; } }

Index/key variables: i, j
Accumulator variables: answer, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static string removeOuterParentheses ( string S ) { string res = " " ; int count = 0 ; for ( int c = 0 ; c < S . Length ; c ++ ) { if ( S == ' ( ' && count ++ > 0 ) res += S ; if ( S == ' ) ' && count -- > 1 ) res += S ; } return res ; } public static void Main ( ) { string S = " ( ( ) ( ) ) ( ( ) ) ( ) " ; Console . Write ( removeOuterParentheses ( S ) ) ; } }

Accumulator variables: c, count, res
Iterator variables: c
Class/struct names: GFG
C# program:
using System ; class GFG { public static int maxiConsecutiveSubarray ( int [ ] arr , int N ) { int maxi = 0 ; for ( int i = 0 ; i < N - 1 ; i ++ ) { int cnt = 1 , j ; for ( j = i ; j < N - 1 ; j ++ ) { if ( arr [ j + 1 ] == arr [ j ] + 1 ) { cnt ++ ; } else { break ; } } maxi = Math . Max ( maxi , cnt ) ; i = j ; } return maxi ; } public static void Main ( String [ ] args ) { int N = 11 ; int [ ] arr = { 1 , 3 , 4 , 2 , 3 , 4 , 2 , 3 , 5 , 6 , 7 } ; Console . WriteLine ( maxiConsecutiveSubarray ( arr , N ) ) ; } }

Index/key variables: j
Accumulator variables: cnt, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System . Collections . Generic ; using System ; class GFG { static int N = 100005 ; static void SieveOfEratosthenes ( bool [ ] prime , int p_size ) { prime [ 0 ] = false ; prime [ 1 ] = false ; for ( int p = 2 ; p * p <= p_size ; p ++ ) { if ( prime [ p ] ) { for ( int i = p * 2 ; i <= p_size ; i += p ) prime [ i ] = false ; } } } static int digitSum ( int number ) { int sum = 0 ; while ( number > 0 ) { sum += ( number % 10 ) ; number /= 10 ; } return sum ; } static void longestCompositeDigitSumSubsequence ( int [ ] arr , int n ) { int count = 0 ; bool [ ] prime = new bool [ N + 1 ] ; for ( int i = 0 ; i <= N ; i ++ ) prime [ i ] = true ; SieveOfEratosthenes ( prime , N ) ; for ( int i = 0 ; i < n ; i ++ ) { int res = digitSum ( arr [ i ] ) ; if ( res == 1 ) { continue ; } if ( prime [ res ] == false ) { count ++ ; } } Console . WriteLine ( count ) ; } public static void Main ( ) { int [ ] arr = { 13 , 55 , 7 , 3 , 5 , 1 , 10 , 21 , 233 , 144 , 89 } ; int n = arr . Length ; longestCompositeDigitSumSubsequence ( arr , n ) ; } }

Index/key variables: i, p, res
Accumulator variables: count, i, number, p, sum
Iterator variables: i, p
Class/struct names: GFG
C# program:
using System ; class GFG { static int sum ; class Node { public int data ; public Node left , right ; } ; static Node newnode ( int data ) { Node temp = new Node ( ) ; temp . data = data ; temp . left = null ; temp . right = null ; return temp ; } static Node insert ( String s , int i , int N , Node root , Node temp ) { if ( i == N ) return temp ; if ( s [ i ] == ' L ' ) root . left = insert ( s , i + 1 , N , root . left , temp ) ; else root . right = insert ( s , i + 1 , N , root . right , temp ) ; return root ; } static int SBTUtil ( Node root ) { if ( root == null ) return 0 ; if ( root . left == null && root . right == null ) return root . data ; int left = SBTUtil ( root . left ) ; int right = SBTUtil ( root . right ) ; if ( root . left != null && root . right != null ) { if ( ( left % 2 == 0 && right % 2 != 0 ) || ( left % 2 != 0 && right % 2 == 0 ) ) { sum += root . data ; } } return left + right + root . data ; } static Node build_tree ( int R , int N , String [ ] str , int [ ] values ) { Node root = newnode ( R ) ; int i ; for ( i = 0 ; i < N - 1 ; i ++ ) { String s = str [ i ] ; int x = values [ i ] ; Node temp = newnode ( x ) ; root = insert ( s , 0 , s . Length , root , temp ) ; } return root ; } static void speciallyBalancedNodes ( int R , int N , String [ ] str , int [ ] values ) { Node root = build_tree ( R , N , str , values ) ; sum = 0 ; SBTUtil ( root ) ; Console . Write ( sum + " ▁ " ) ; } public static void Main ( String [ ] args ) { int N = 7 ; int R = 12 ; String [ ] str = { " L " , " R " , " RL " , " RR " , " RLL " , " RLR " } ; int [ ] values = { 17 , 16 , 4 , 9 , 2 , 3 } ; speciallyBalancedNodes ( R , N , str , values ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG, Node
C# program:
using System ; class GFG { static void position ( int [ , ] arr , int N ) { int pos = - 1 ; int count ; for ( int i = 0 ; i < N ; i ++ ) { count = 0 ; for ( int j = 0 ; j < N ; j ++ ) { if ( arr [ i , 0 ] <= arr [ j , 0 ] && arr [ i , 1 ] >= arr [ j , 1 ] ) { count ++ ; } } if ( count == N ) { pos = i ; } } if ( pos == - 1 ) { Console . Write ( pos ) ; } else { Console . Write ( pos + 1 ) ; } } public static void Main ( ) { int [ , ] arr = { { 3 , 3 } , { 1 , 3 } , { 2 , 2 } , { 2 , 3 } , { 1 , 2 } } ; int N = arr . GetLength ( 0 ) ; position ( arr , N ) ; } }

Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void position ( int [ , ] arr , int N ) { int pos = - 1 ; int right = int . MinValue ; int left = int . MaxValue ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i , 1 ] > right ) { right = arr [ i , 1 ] ; } if ( arr [ i , 0 ] < left ) { left = arr [ i , 0 ] ; } } for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i , 0 ] == left && arr [ i , 1 ] == right ) { pos = i + 1 ; } } Console . Write ( pos + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { int [ , ] arr = { { 3 , 3 } , { 1 , 3 } , { 2 , 2 } , { 2 , 3 } , { 1 , 2 } } ; int N = arr . GetLength ( 0 ) ; position ( arr , N ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int ctMinEdits ( string str1 , string str2 ) { int N1 = str1 . Length ; int N2 = str2 . Length ; int [ ] freq1 = new int [ 256 ] ; freq1 [ 0 ] = str1 [ 0 ] ; for ( int i = 0 ; i < N1 ; i ++ ) { freq1 [ str1 [ i ] ] ++ ; } int [ ] freq2 = new int [ 256 ] ; freq2 [ 0 ] = str2 [ 0 ] ; for ( int i = 0 ; i < N2 ; i ++ ) { freq2 [ str2 [ i ] ] ++ ; } for ( int i = 0 ; i < 256 ; i ++ ) { if ( freq1 [ i ] > freq2 [ i ] ) { freq1 [ i ] = freq1 [ i ] - freq2 [ i ] ; freq2 [ i ] = 0 ; } else { freq2 [ i ] = freq2 [ i ] - freq1 [ i ] ; freq1 [ i ] = 0 ; } } int sum1 = 0 ; int sum2 = 0 ; for ( int i = 0 ; i < 256 ; i ++ ) { sum1 += freq1 [ i ] ; sum2 += freq2 [ i ] ; } return Math . Max ( sum1 , sum2 ) ; } public static void Main ( ) { string str1 = " geeksforgeeks " ; string str2 = " geeksforcoder " ; Console . WriteLine ( ctMinEdits ( str1 , str2 ) ) ; } }

Index/key variables: i
Accumulator variables: i, sum1, sum2
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void CountPairs ( int [ ] a , int [ ] b , int n ) { int [ ] C = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { C [ i ] = a [ i ] + b [ i ] ; } Dictionary < int , int > freqCount = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( ! freqCount . ContainsKey ( C [ i ] ) ) freqCount . Add ( C [ i ] , 1 ) ; else freqCount [ C [ i ] ] = freqCount [ C [ i ] ] + 1 ; } int NoOfPairs = 0 ; foreach ( KeyValuePair < int , int > x in freqCount ) { int y = x . Value ; NoOfPairs = NoOfPairs + y * ( y - 1 ) / 2 ; } Console . WriteLine ( NoOfPairs ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 4 , 20 , 3 , 10 , 5 } ; int [ ] brr = { 9 , 6 , 1 , 7 , 11 , 6 } ; int N = arr . Length ; CountPairs ( arr , brr , N ) ; } }

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