dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; public class treeNode { public int square_sum ; public treeNode ( int square_sum ) { this . square_sum = square_sum ; } } ; public class GFG { static void buildTree ( char [ ] s , treeNode [ ] tree , int start , int end , int treenode ) { if ( start == end ) { tree [ treenode ] . square_sum = ( int ) Math . Pow ( s [ start ] - ' a ' + 1 , 2 ) ; return ; } int mid = start + ( ( end - start ) / 2 ) ; buildTree ( s , tree , start , mid , 2 * treenode ) ; buildTree ( s , tree , mid + 1 , end , 1 + 2 * treenode ) ; tree [ treenode ] . square_sum = tree [ ( 2 * treenode ) ] . square_sum + tree [ ( 2 * treenode ) + 1 ] . square_sum ; } static int querySquareSum ( treeNode [ ] tree , int start , int end , int treenode , int l , int r ) { if ( ( l > end ) || ( r < start ) ) { return 0 ; } if ( ( l <= start ) && ( r >= end ) ) { return tree [ treenode ] . square_sum ; } int mid = start + ( ( end - start ) / 2 ) ; int X = querySquareSum ( tree , start , mid , 2 * treenode , l , r ) ; int Y = + querySquareSum ( tree , mid + 1 , end , 1 + 2 * treenode , l , r ) ; return X + Y ; } static void updateTree ( char [ ] s , treeNode [ ] tree , int start , int end , int treenode , int idx , char X ) { if ( ( start == end ) && ( idx == start ) ) { s [ idx ] = X ; tree [ treenode ] . square_sum = ( int ) Math . Pow ( X - ' a ' + 1 , 2 ) ; return ; } int mid = start + ( ( end - start ) / 2 ) ; if ( idx <= mid ) { updateTree ( s , tree , start , mid , ( 2 * treenode ) , idx , X ) ; } else { updateTree ( s , tree , mid + 1 , end , ( 2 * treenode ) + 1 , idx , X ) ; } tree [ treenode ] . square_sum = tree [ ( 2 * treenode ) ] . square_sum + tree [ ( 2 * treenode ) + 1 ] . square_sum ; } static void PerformQuery ( String S , String [ , ] Q ) { int n = S . Length ; treeNode [ ] tree = new treeNode [ ( 4 * n ) + 1 ] ; for ( int i = 0 ; i <= ( 4 * n ) ; i = i + 1 ) { tree [ i ] = new treeNode ( 0 ) ; } char [ ] s = S . ToCharArray ( ) ; buildTree ( s , tree , 0 , n - 1 , 1 ) ; for ( int i = 0 ; i < Q . GetLength ( 0 ) ; i ++ ) { if ( Q [ i , 0 ] == " S " ) { int L = Int32 . Parse ( Q [ i , 1 ] ) ; int R = Int32 . Parse ( Q [ i , 2 ] ) ; Console . WriteLine ( querySquareSum ( tree , 0 , n - 1 , 1 , L , R ) ) ; } else if ( Q [ i , 0 ] == " U " ) { int I = Int32 . Parse ( Q [ i , 1 ] ) ; updateTree ( s , tree , 0 , n - 1 , 1 , I , Q [ i , 2 ] [ 0 ] ) ; } } } static public void Main ( ) { string S = " geeksforgeeks " ; string [ , ] Q = { { " S " , "0" , "2" } , { " S " , "1" , "2" } , { " U " , "1" , " a " } , { " S " , "0" , "2" } , { " S " , "4" , "5" } } ; PerformQuery ( S , Q ) ; } }

Index/key variables: i, idx, start, treenode
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG, treeNode
C# program:
using System ; class GFG { static void lcsBySwapping ( string A , string B ) { int N = A . Length ; int M = B . Length ; int [ ] freq = new int [ 26 ] ; for ( int i = 0 ; i < N ; i ++ ) { freq [ A [ i ] - ' a ' ] += 1 ; } for ( int i = 0 ; i < M ; i ++ ) { freq [ B [ i ] - ' a ' ] += 1 ; } int cnt = 0 ; for ( int i = 0 ; i < 26 ; i ++ ) { cnt += freq [ i ] / 2 ; } Console . WriteLine ( Math . Min ( cnt , Math . Min ( N , M ) ) ) ; } public static void Main ( string [ ] args ) { string A = " abdeff " ; string B = " abbet " ; lcsBySwapping ( A , B ) ; } }

Index/key variables: i
Accumulator variables: cnt, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { static void maximumLengthSubsequence ( String str ) { Dictionary < char , int > mp = new Dictionary < char , int > ( ) ; foreach ( char ch in str . ToCharArray ( ) ) { if ( mp . ContainsKey ( ch ) ) mp [ ch ] = mp [ ch ] + 1 ; else mp . Add ( ch , 1 ) ; } int ans = 0 ; foreach ( char ch in str . ToCharArray ( ) ) { if ( mp . ContainsKey ( ( char ) ( ch - 1 ) ) ) { int curr_max = mp [ ch ] + mp [ ( char ) ( ch - 1 ) ] ; ans = Math . Max ( ans , curr_max ) ; } } Console . WriteLine ( ans ) ; } public static void Main ( String [ ] args ) { String S = " acbbebcg " ; maximumLengthSubsequence ( S ) ; } }

Index/key variables: ch
Iterator variables: ch
Class/struct names: GFG
C# program:
using System ; class GFG { static void countOperations ( string X , string Y , int K ) { char [ ] ch1 = X . ToCharArray ( ) ; char [ ] ch2 = Y . ToCharArray ( ) ; int count = 0 ; for ( int i = 0 ; i < X . Length ; i ++ ) { int c = 0 ; if ( ch1 [ i ] == ch2 [ i ] ) continue ; else if ( ch1 [ i ] < ch2 [ i ] ) { if ( ( ( int ) ch2 [ i ] - ( int ) ch1 [ i ] ) >= K ) { c = ( ( int ) ch2 [ i ] - ( int ) ch1 [ i ] ) / K ; } c += ( ( int ) ch2 [ i ] - ( int ) ch1 [ i ] ) % K ; } else { int t = 90 - ( int ) ch1 [ i ] ; t += ( int ) ch2 [ i ] - 65 + 1 ; if ( t >= K ) c = t / K ; c += ( t % K ) ; } count += c ; } Console . WriteLine ( count ) ; } static void Main ( ) { string X = " ABCT " , Y = " PBDI " ; int K = 6 ; countOperations ( X , Y , K ) ; } }

Index/key variables: i
Accumulator variables: c, count, i, t
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int minimumSwaps ( string s , int l , int r , int k ) { int n = s . Length ; int tot_ones = 0 , tot_zeros = 0 ; for ( int i = 0 ; i < s . Length ; i ++ ) { if ( s [ i ] == '1' ) tot_ones ++ ; else tot_zeros ++ ; } int ones = 0 , zeros = 0 , sum = 0 ; for ( int i = l - 1 ; i < r ; i ++ ) { if ( s [ i ] == '1' ) { ones ++ ; sum ++ ; } else zeros ++ ; } int rem_ones = tot_ones - ones ; int rem_zeros = tot_zeros - zeros ; if ( k >= sum ) { int rem = k - sum ; if ( zeros >= rem && rem_ones >= rem ) return rem ; } else if ( k < sum ) { int rem = sum - k ; if ( ones >= rem && rem_zeros >= rem ) return rem ; } return - 1 ; } public static void Main ( String [ ] args ) { string S = "110011111000101" ; int L = 5 , R = 8 , K = 2 ; Console . Write ( minimumSwaps ( S , L , R , K ) ) ; } }

Index/key variables: i
Accumulator variables: i, ones, sum, tot_ones, tot_zeros, zeros
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int N = 200000 ; static long [ ] Ans = new long [ 200000 ] ; static int index = 0 ; static void populateNumber ( ) { Ans [ index ++ ] = ( 2 ) ; Ans [ index ++ ] = ( 5 ) ; long x = 5 ; long inf = 1000000000001L ; while ( x < inf ) { x *= 2 ; Ans [ index ++ ] = ( x ) ; x = x * 2 + 1 ; Ans [ index ++ ] = ( x ) ; } } static void checkString ( int N ) { populateNumber ( ) ; for ( int i = 0 ; i < index ; i ++ ) { if ( Ans [ i ] == N ) { Console . WriteLine ( " YES " ) ; return ; } } Console . WriteLine ( " NO " ) ; } public static void Main ( String [ ] args ) { N = 5 ; checkString ( N ) ; } }

Index/key variables: i
Accumulator variables: i, index, x
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { public static void deleteSubseq ( String s ) { int N = s . Length ; Stack < char > roundStk = new Stack < char > ( ) ; Stack < char > squareStk = new Stack < char > ( ) ; int roundCount = 0 ; int squareCount = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( s [ i ] == ' [ ' ) { squareStk . Push ( s [ i ] ) ; } else if ( s [ i ] == ' ] ' ) { if ( squareStk . Count != 0 && squareStk . Peek ( ) == ' [ ' ) { squareStk . Pop ( ) ; squareCount += 1 ; } } else if ( s [ i ] == ' ( ' ) { roundStk . Push ( s [ i ] ) ; } else { if ( roundStk . Count != 0 && squareStk . Peek ( ) == ' ( ' ) { squareStk . Pop ( ) ; roundCount += 1 ; } } } Console . WriteLine ( N - ( 2 * squareCount + 2 * roundCount ) ) ; } public static void Main ( String [ ] args ) { String s = " [ ] ] ) ( [ " ; deleteSubseq ( s ) ; } }

Index/key variables: i
Accumulator variables: i, roundCount, squareCount
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void minimumOperations ( string s , int n ) { Dictionary < char , List < int > > mp = new Dictionary < char , List < int > > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( mp . ContainsKey ( s [ i ] ) ) { mp [ s [ i ] ] . Add ( i ) ; } else { mp [ s [ i ] ] = new List < int > ( ) ; mp [ s [ i ] ] . Add ( i ) ; } } int ans = Int32 . MaxValue ; foreach ( KeyValuePair < char , List < int > > x in mp ) { int curr = 0 ; int prev = 0 ; bool first = true ; foreach ( int index in ( x . Value ) ) { if ( first ) { if ( index > 0 ) { curr ++ ; } prev = index ; first = false ; } else { if ( index != prev + 1 ) { curr ++ ; } prev = index ; } } if ( prev != n - 1 ) { curr ++ ; } ans = Math . Min ( ans , curr ) ; } Console . Write ( ans ) ; } static void Main ( ) { string s = " YYXYZYXYZXY " ; int N = s . Length ; minimumOperations ( s , N ) ; } }

Index/key variables: i
Accumulator variables: curr, i
Iterator variables: i, index, x
Boolean variables: first
Class/struct names: GFG
C# program:
using System ; class GFG { static void checkValidDFA ( string s ) { int final_state = 0 ; int previous_state = 0 ; for ( int i = 0 ; i < s . Length ; i ++ ) { if ( ( s [ i ] == '0' && previous_state == 0 ) || ( s [ i ] == '1' && previous_state == 3 ) ) { final_state = 1 ; } else if ( ( s [ i ] == '0' && previous_state == 3 ) || ( s [ i ] == '1' && previous_state == 0 ) ) { final_state = 2 ; } else if ( ( s [ i ] == '0' && previous_state == 1 ) || ( s [ i ] == '1' && previous_state == 2 ) ) { final_state = 0 ; } else if ( ( s [ i ] == '0' && previous_state == 2 ) || ( s [ i ] == '1' && previous_state == 1 ) ) { final_state = 3 ; } previous_state = final_state ; } if ( final_state == 3 ) { Console . WriteLine ( " Accepted " ) ; } else { Console . WriteLine ( " Not ▁ Accepted " ) ; } } public static void Main ( ) { string s = "010011" ; checkValidDFA ( s ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class Node { public int data ; public Node left , right ; public Node ( int key ) { data = key ; left = right = null ; } } public class GFG { static int evenOddLevelDifference ( Node root ) { if ( root == null ) return 0 ; Queue < Node > q = new Queue < Node > ( ) ; q . Enqueue ( root ) ; int level = 0 ; int evenSum = 0 , oddSum = 0 ; while ( q . Count != 0 ) { int size = q . Count ; level ++ ; while ( size > 0 ) { Node temp = q . Dequeue ( ) ; if ( level % 2 == 0 ) evenSum += temp . data ; else oddSum += temp . data ; if ( temp . left != null ) q . Enqueue ( temp . left ) ; if ( temp . right != null ) q . Enqueue ( temp . right ) ; size -- ; } } return ( oddSum - evenSum ) ; } public static void Main ( String [ ] args ) { Node root = new Node ( 5 ) ; root . left = new Node ( 2 ) ; root . right = new Node ( 6 ) ; root . left . left = new Node ( 1 ) ; root . left . right = new Node ( 4 ) ; root . left . right . left = new Node ( 3 ) ; root . right . right = new Node ( 8 ) ; root . right . right . right = new Node ( 9 ) ; root . right . right . left = new Node ( 7 ) ; Console . WriteLine ( " diffence ▁ between ▁ sums ▁ is ▁ " + evenOddLevelDifference ( root ) ) ; } }

Accumulator variables: evenSum, level, oddSum, size
Class/struct names: GFG, Node
C# program:
using System ; public class Node { public int data ; public Node left , right ; public Node ( int item ) { data = item ; left = right ; } } public class BinaryTree { public Node root ; public virtual int getLevelDiff ( Node node ) { if ( node == null ) { return 0 ; } return node . data - getLevelDiff ( node . left ) - getLevelDiff ( node . right ) ; } public static void Main ( string [ ] args ) { BinaryTree tree = new BinaryTree ( ) ; tree . root = new Node ( 5 ) ; tree . root . left = new Node ( 2 ) ; tree . root . right = new Node ( 6 ) ; tree . root . left . left = new Node ( 1 ) ; tree . root . left . right = new Node ( 4 ) ; tree . root . left . right . left = new Node ( 3 ) ; tree . root . right . right = new Node ( 8 ) ; tree . root . right . right . right = new Node ( 9 ) ; tree . root . right . right . left = new Node ( 7 ) ; Console . WriteLine ( tree . getLevelDiff ( tree . root ) + " ▁ is ▁ the ▁ required ▁ difference " ) ; } }

Class/struct names: BinaryTree, Node
C# program:
using System ; using System . Collections . Generic ; public class MaxSpiralSum { public class Node { public int data ; public Node left , right ; public Node ( int data ) { this . data = data ; left = right = null ; } } ; static int maxSum ( List < int > arr ) { int max_ending_here = int . MinValue ; int max_so_far = int . MinValue ; for ( int i = 0 ; i < arr . Count ; i ++ ) { if ( max_ending_here < 0 ) max_ending_here = arr [ i ] ; else max_ending_here += arr [ i ] ; max_so_far = Math . Max ( max_so_far , max_ending_here ) ; } return max_so_far ; } public static int maxSpiralSum ( Node root ) { if ( root == null ) return 0 ; Stack < Node > s1 = new Stack < Node > ( ) ; Stack < Node > s2 = new Stack < Node > ( ) ; List < int > arr = new List < int > ( ) ; s1 . Push ( root ) ; while ( s1 . Count != 0 s2 . Count != 0 ) { while ( s1 . Count != 0 ) { Node temp = s1 . Pop ( ) ; arr . Add ( temp . data ) ; if ( temp . right != null ) s2 . Push ( temp . right ) ; if ( temp . left != null ) s2 . Push ( temp . left ) ; } while ( s2 . Count != 0 ) { Node temp = s2 . Pop ( ) ; arr . Add ( temp . data ) ; if ( temp . left != null ) s1 . Push ( temp . left ) ; if ( temp . right != null ) s1 . Push ( temp . right ) ; } } return maxSum ( arr ) ; } public static void Main ( String [ ] args ) { Node root = new Node ( - 2 ) ; root . left = new Node ( - 3 ) ; root . right = new Node ( 4 ) ; root . left . left = new Node ( 5 ) ; root . left . right = new Node ( 1 ) ; root . right . left = new Node ( - 2 ) ; root . right . right = new Node ( - 1 ) ; root . left . left . left = new Node ( - 3 ) ; root . right . right . right = new Node ( 2 ) ; Console . Write ( " Maximum ▁ Spiral ▁ Sum ▁ = ▁ " + maxSpiralSum ( root ) ) ; } }

Index/key variables: i
Accumulator variables: i, max_ending_here
Iterator variables: i
Class/struct names: MaxSpiralSum, Node
C# program:
using System ; public class GFG { public class Node { public int data ; public Node left , right ; public Node ( int data ) { this . data = data ; left = null ; right = null ; } } public static int sum ; public static void leafSum ( Node root ) { if ( root == null ) { return ; } if ( root . left == null && root . right == null ) { sum += root . data ; } leafSum ( root . left ) ; leafSum ( root . right ) ; } public static void Main ( string [ ] args ) { Node root = new Node ( 1 ) ; root . left = new Node ( 2 ) ; root . left . left = new Node ( 4 ) ; root . left . right = new Node ( 5 ) ; root . right = new Node ( 3 ) ; root . right . right = new Node ( 7 ) ; root . right . left = new Node ( 6 ) ; root . right . left . right = new Node ( 8 ) ; sum = 0 ; leafSum ( root ) ; Console . WriteLine ( sum ) ; } }

Accumulator variables: sum
Class/struct names: GFG, Node
C# program:
using System ; class BinaryTree { tNode root ; public class tNode { public int data ; public tNode left , right ; public tNode ( int item ) { data = item ; left = right = null ; } } void MorrisTraversal ( tNode root ) { tNode current , pre ; if ( root == null ) return ; current = root ; while ( current != null ) { if ( current . left == null ) { Console . Write ( current . data + " ▁ " ) ; current = current . right ; } else { pre = current . left ; while ( pre . right != null && pre . right != current ) pre = pre . right ; if ( pre . right == null ) { pre . right = current ; current = current . left ; } else { pre . right = null ; Console . Write ( current . data + " ▁ " ) ; current = current . right ; } } } } public static void Main ( String [ ] args ) { BinaryTree tree = new BinaryTree ( ) ; tree . root = new tNode ( 1 ) ; tree . root . left = new tNode ( 2 ) ; tree . root . right = new tNode ( 3 ) ; tree . root . left . left = new tNode ( 4 ) ; tree . root . left . right = new tNode ( 5 ) ; tree . MorrisTraversal ( tree . root ) ; } }

Class/struct names: BinaryTree, tNode
C# program:
using System ; using System . Collections . Generic ; class GFG { class Node { public int data ; public Node left , right ; } ; static Node getNode ( int data ) { Node newNode = new Node ( ) ; newNode . data = data ; newNode . left = newNode . right = null ; return newNode ; } static int sumOfLeafNodesAtMinLevel ( Node root ) { if ( root == null ) return 0 ; if ( root . left == null && root . right == null ) return root . data ; Queue < Node > q = new Queue < Node > ( ) ; int sum = 0 ; bool f = false ; q . Enqueue ( root ) ; while ( f == false ) { int nc = q . Count ; while ( nc -- > 0 ) { Node top = q . Peek ( ) ; q . Dequeue ( ) ; if ( top . left == null && top . right == null ) { sum += top . data ; f = true ; } else { if ( top . left != null ) q . Enqueue ( top . left ) ; if ( top . right != null ) q . Enqueue ( top . right ) ; } } } return sum ; } public static void Main ( String [ ] args ) { Node root = getNode ( 1 ) ; root . left = getNode ( 2 ) ; root . right = getNode ( 3 ) ; root . left . left = getNode ( 4 ) ; root . left . right = getNode ( 5 ) ; root . right . left = getNode ( 6 ) ; root . right . right = getNode ( 7 ) ; root . left . right . left = getNode ( 8 ) ; root . right . left . right = getNode ( 9 ) ; Console . WriteLine ( " Sum ▁ = ▁ " + sumOfLeafNodesAtMinLevel ( root ) ) ; } }

Accumulator variables: nc, sum
Boolean variables: f
Class/struct names: GFG, Node
C# program:
using System ; public class Node { public int data ; public Node left , right ; public Node ( int item ) { data = item ; left = right = null ; } } class GFG { public Node root ; public virtual bool haspathSum ( Node node , int sum ) { if ( node == null ) { return ( sum == 0 ) ; } else { bool ans = false ; int subsum = sum - node . data ; if ( subsum == 0 && node . left == null && node . right == null ) { return true ; } if ( node . left != null ) { ans = ans || haspathSum ( node . left , subsum ) ; } if ( node . right != null ) { ans = ans || haspathSum ( node . right , subsum ) ; } return ans ; } } public static void Main ( string [ ] args ) { int sum = 21 ; GFG tree = new GFG ( ) ; tree . root = new Node ( 10 ) ; tree . root . left = new Node ( 8 ) ; tree . root . right = new Node ( 2 ) ; tree . root . left . left = new Node ( 3 ) ; tree . root . left . right = new Node ( 5 ) ; tree . root . right . left = new Node ( 2 ) ; if ( tree . haspathSum ( tree . root , sum ) ) { Console . WriteLine ( " There ▁ is ▁ a ▁ root ▁ to ▁ leaf ▁ " + " path ▁ with ▁ sum ▁ " + sum ) ; } else { Console . WriteLine ( " There ▁ is ▁ no ▁ root ▁ to ▁ leaf ▁ " + " path ▁ with ▁ sum ▁ " + sum ) ; } } }

Boolean variables: ans
Class/struct names: GFG, Node
C# program:
using System ; public class Node { public int data ; public Node left , right ; public Node ( int item ) { data = item ; left = right = null ; } } class GFG { public Node root ; public virtual int treePathsSumUtil ( Node node , int val ) { if ( node == null ) { return 0 ; } val = ( val * 10 + node . data ) ; if ( node . left == null && node . right == null ) { return val ; } return treePathsSumUtil ( node . left , val ) + treePathsSumUtil ( node . right , val ) ; } public virtual int treePathsSum ( Node node ) { return treePathsSumUtil ( node , 0 ) ; } public static void Main ( string [ ] args ) { GFG tree = new GFG ( ) ; tree . root = new Node ( 6 ) ; tree . root . left = new Node ( 3 ) ; tree . root . right = new Node ( 5 ) ; tree . root . right . right = new Node ( 4 ) ; tree . root . left . left = new Node ( 2 ) ; tree . root . left . right = new Node ( 5 ) ; tree . root . left . right . right = new Node ( 4 ) ; tree . root . left . right . left = new Node ( 7 ) ; Console . Write ( " Sum ▁ of ▁ all ▁ paths ▁ is ▁ " + tree . treePathsSum ( tree . root ) ) ; } }

Class/struct names: GFG, Node
C# program:
using System ; public class Node { public int data ; public Node left , right ; public Node ( int data , Node left , Node right ) { this . data = data ; this . left = left ; this . right = right ; } public static Node newNode ( int data ) { return new Node ( data , null , null ) ; } public static void inorder ( Node node ) { if ( node == null ) { return ; } inorder ( node . left ) ; Console . Write ( " { 0 : D } ▁ " , node . data ) ; inorder ( node . right ) ; } public static Node MergeTrees ( Node t1 , Node t2 ) { if ( t1 == null ) { return t2 ; } if ( t2 == null ) { return t1 ; } t1 . data += t2 . data ; t1 . left = MergeTrees ( t1 . left , t2 . left ) ; t1 . right = MergeTrees ( t1 . right , t2 . right ) ; return t1 ; } public static void Main ( string [ ] args ) { Node root1 = newNode ( 1 ) ; root1 . left = newNode ( 2 ) ; root1 . right = newNode ( 3 ) ; root1 . left . left = newNode ( 4 ) ; root1 . left . right = newNode ( 5 ) ; root1 . right . right = newNode ( 6 ) ; Node root2 = newNode ( 4 ) ; root2 . left = newNode ( 1 ) ; root2 . right = newNode ( 7 ) ; root2 . left . left = newNode ( 3 ) ; root2 . right . left = newNode ( 2 ) ; root2 . right . right = newNode ( 6 ) ; Node root3 = MergeTrees ( root1 , root2 ) ; Console . Write ( " The ▁ Merged ▁ Binary ▁ Tree ▁ is : STRNEWLINE " ) ; inorder ( root3 ) ; } }

Accumulator variables: data
Class/struct names: Node
C# program:
using System ; using System . Collections . Generic ; class GFG { public class Node { public int data ; public Node left , right ; } ; public class snode { public Node l , r ; } ; static Node newNode ( int data ) { Node new_node = new Node ( ) ; new_node . data = data ; new_node . left = new_node . right = null ; return new_node ; } static void inorder ( Node node ) { if ( node == null ) return ; inorder ( node . left ) ; Console . Write ( node . data + " ▁ " ) ; inorder ( node . right ) ; } static Node MergeTrees ( Node t1 , Node t2 ) { if ( t1 == null ) return t2 ; if ( t2 == null ) return t1 ; Stack < snode > s = new Stack < snode > ( ) ; snode temp = new snode ( ) ; temp . l = t1 ; temp . r = t2 ; s . Push ( temp ) ; snode n ; while ( s . Count != 0 ) { n = s . Peek ( ) ; s . Pop ( ) ; if ( n . l == null n . r == null ) continue ; n . l . data += n . r . data ; if ( n . l . left == null ) n . l . left = n . r . left ; else { snode t = new snode ( ) ; t . l = n . l . left ; t . r = n . r . left ; s . Push ( t ) ; } if ( n . l . right == null ) n . l . right = n . r . right ; else { snode t = new snode ( ) ; t . l = n . l . right ; t . r = n . r . right ; s . Push ( t ) ; } } return t1 ; } public static void Main ( String [ ] args ) { Node root1 = newNode ( 1 ) ; root1 . left = newNode ( 2 ) ; root1 . right = newNode ( 3 ) ; root1 . left . left = newNode ( 4 ) ; root1 . left . right = newNode ( 5 ) ; root1 . right . right = newNode ( 6 ) ; Node root2 = newNode ( 4 ) ; root2 . left = newNode ( 1 ) ; root2 . right = newNode ( 7 ) ; root2 . left . left = newNode ( 3 ) ; root2 . right . left = newNode ( 2 ) ; root2 . right . right = newNode ( 6 ) ; Node root3 = MergeTrees ( root1 , root2 ) ; Console . Write ( " The ▁ Merged ▁ Binary ▁ Tree ▁ is : STRNEWLINE " ) ; inorder ( root3 ) ; } }

Accumulator variables: data
Class/struct names: GFG, Node, snode
C# program:
using System ; class GFG { public class pair { public int first , second ; public pair ( int first , int second ) { this . first = first ; this . second = second ; } } static int findRoot ( pair [ ] arr , int n ) { int root = 0 ; for ( int i = 0 ; i < n ; i ++ ) { root += ( arr [ i ] . first - arr [ i ] . second ) ; } return root ; } public static void Main ( String [ ] args ) { pair [ ] arr = { new pair ( 1 , 5 ) , new pair ( 2 , 0 ) , new pair ( 3 , 0 ) , new pair ( 4 , 0 ) , new pair ( 5 , 5 ) , new pair ( 6 , 5 ) } ; int n = arr . Length ; Console . Write ( " { 0 } STRNEWLINE " , findRoot ( arr , n ) ) ; } }

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