dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; using System . Collections . Generic ; class GFG { static void max_distance ( int [ ] a , int [ ] temp , int n ) { Dictionary < int , int > mp = new Dictionary < int , int > ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { temp [ i ] = - 1 ; } for ( int i = 0 ; i < n ; i ++ ) { if ( ! mp . ContainsKey ( a [ i ] ) ) temp [ a [ i ] ] = i + 1 ; else temp [ a [ i ] ] = Math . Max ( temp [ a [ i ] ] , i - mp [ a [ i ] ] ) ; if ( mp . ContainsKey ( a [ i ] ) ) { mp [ a [ i ] ] = i ; } else { mp . Add ( a [ i ] , i ) ; } } for ( int i = 1 ; i <= n ; i ++ ) { if ( temp [ i ] != - 1 ) { if ( mp . ContainsKey ( i ) ) { temp [ i ] = Math . Max ( temp [ i ] , n - mp [ i ] ) ; } else { temp [ i ] = Math . Max ( temp [ i ] , n ) ; } } } } static void min_comm_ele ( int [ ] a , int [ ] ans , int [ ] temp , int n ) { max_distance ( a , temp , n ) ; for ( int i = 1 ; i <= n ; i ++ ) { ans [ i ] = - 1 ; } for ( int i = 1 ; i <= n ; i ++ ) { if ( temp [ i ] >= 0 && ans [ temp [ i ] ] == - 1 ) ans [ temp [ i ] ] = i ; } for ( int i = 1 ; i <= n ; i ++ ) { if ( i > 1 && ans [ i - 1 ] != - 1 ) { if ( ans [ i ] == - 1 ) ans [ i ] = ans [ i - 1 ] ; else ans [ i ] = Math . Min ( ans [ i ] , ans [ i - 1 ] ) ; } Console . Write ( ans [ i ] + " ▁ " ) ; } } static void Main ( ) { int N = 6 ; int [ ] a = { 1 , 3 , 4 , 5 , 6 , 7 } ; int [ ] temp = new int [ 100 ] ; Array . Fill ( temp , 0 ) ; int [ ] ans = new int [ 100 ] ; Array . Fill ( ans , 0 ) ; min_comm_ele ( a , ans , temp , N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void FindTrip ( int [ ] arr , int N ) { for ( int i = 1 ; i < N - 1 ; i ++ ) { int p = arr [ i - 1 ] ; int q = arr [ i ] ; int r = arr [ i + 1 ] ; if ( p < q && q > r ) { Console . WriteLine ( ( i - 1 ) + " ▁ " + ( i ) + " ▁ " + ( i + 1 ) ) ; return ; } } Console . WriteLine ( - 1 ) ; } public static void Main ( ) { int [ ] arr = { 2 , 1 , 4 , 3 } ; int N = arr . Length ; FindTrip ( arr , N ) ; } }

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 cntSubarrays ( int [ ] arr , int N ) { int cntSub = 0 ; int cntUnique = 0 ; Dictionary < int , int > cntFreq = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = i ; j < N ; j ++ ) { if ( cntFreq . ContainsKey ( arr [ j ] ) ) { var val = cntFreq [ arr [ j ] ] ; cntFreq . Remove ( arr [ j ] ) ; cntFreq . Add ( arr [ j ] , val + 1 ) ; } else { cntFreq . Add ( arr [ j ] , 1 ) ; } if ( cntFreq [ arr [ j ] ] == 1 ) { cntUnique ++ ; } else if ( cntFreq [ arr [ j ] ] == 2 ) { cntUnique -- ; } if ( cntUnique == 0 ) { cntSub ++ ; } } cntFreq . Clear ( ) ; cntUnique = 0 ; } return cntSub ; } public static void Main ( ) { int [ ] arr = { 1 , 1 , 2 , 2 , 2 } ; int N = arr . Length ; Console . Write ( cntSubarrays ( arr , N ) ) ; } }

Index/key variables: j
Accumulator variables: cntSub, cntUnique, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { public static bool checkPalinK ( String str , int K ) { int N = str . Length ; int [ ] cntFreq = new int [ 256 ] ; for ( int i = 0 ; i < N ; i ++ ) { cntFreq [ str [ i ] ] ++ ; } int cntOddFreq = 0 ; for ( int i = 0 ; i < 256 ; i ++ ) { if ( cntFreq [ i ] % 2 == 1 ) { cntOddFreq ++ ; } } if ( cntOddFreq <= ( K + 1 ) ) { return true ; } return false ; } public static void Main ( String [ ] args ) { String str = " geeksforgeeks " ; int K = 2 ; if ( checkPalinK ( str , K ) ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } }

Index/key variables: i
Accumulator variables: cntOddFreq, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void countRemovableElem ( int [ ] arr , int N ) { int [ ] hash = new int [ N + 1 ] ; Array . Fill ( hash , 0 ) ; int mex = N + 1 ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] <= N ) hash [ arr [ i ] ] = 1 ; } for ( int i = 1 ; i <= N ; i ++ ) { if ( hash [ i ] == 0 ) { mex = i ; break ; } } Console . WriteLine ( N - ( mex - 1 ) ) ; } public static void Main ( ) { int [ ] arr = { 2 , 3 , 5 , 1 , 6 } ; int N = arr . Length ; countRemovableElem ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void printIndexes ( char [ ] str ) { int N = str . Length ; int [ ] cntFreq = new int [ 256 ] ; for ( int i = 0 ; i < N ; i ++ ) { cntFreq [ str [ i ] ] ++ ; } int [ ] cntLeftFreq = new int [ 256 ] ; for ( int i = 0 ; i < N ; i ++ ) { int cntLeft = 0 ; int cntRight = 0 ; for ( int j = str [ i ] - 1 ; j >= 0 ; j -- ) { cntLeft += cntLeftFreq [ j ] ; cntRight += cntFreq [ j ] - cntLeftFreq [ j ] ; } cntLeftFreq [ str [ i ] ] ++ ; if ( cntLeft == cntRight && cntLeft != 0 ) { Console . Write ( i + " ▁ " ) ; } } } public static void Main ( ) { string str = " aabacdabbb " ; printIndexes ( str . ToCharArray ( ) ) ; } }

Index/key variables: i, j
Accumulator variables: cntLeft, cntRight, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int Count_Number ( int x ) { int ans = 0 ; if ( x % 99 != 0 ) { ans = - 1 ; } else { int diff = x / 99 ; for ( int i = 1 ; i < 10 ; i ++ ) { for ( int j = 1 ; j < 10 ; j ++ ) { if ( ( i - j ) == diff ) { ans += 10 ; } } } } return ans ; } public static void Main ( ) { int x = 792 ; Console . WriteLine ( Count_Number ( x ) ) ; } }

Accumulator variables: ans, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int INF = int . MaxValue ; static int [ ] findMaxPoint ( int [ , ] arr , int i , int n ) { if ( i == n ) return new int [ ] { INF , INF } ; bool flag = true ; for ( int j = 0 ; j < n ; j ++ ) { if ( j == i ) continue ; if ( arr [ j , 0 ] >= arr [ i , 0 ] arr [ j , 1 ] >= arr [ i , 1 ] ) { flag = false ; break ; } } int [ ] ans = new int [ arr . GetLength ( 1 ) ] ; if ( flag ) { for ( int k = 0 ; k < ans . GetLength ( 0 ) ; k ++ ) ans [ k ] = arr [ i , k ] ; return ans ; } return findMaxPoint ( arr , i + 1 , n ) ; } static void findMaxPoints ( int [ , ] arr , int n ) { int [ ] ans = findMaxPoint ( arr , 0 , n ) ; if ( ans [ 0 ] == INF ) { Console . WriteLine ( - 1 ) ; } else { Console . WriteLine ( " ( " + ans [ 0 ] + " ▁ " + ans [ 1 ] + " ) " ) ; } } public static void Main ( String [ ] args ) { int [ , ] arr = new int [ , ] { { 1 , 2 } , { 2 , 1 } , { 3 , 4 } , { 4 , 3 } , { 5 , 5 } } ; int N = arr . GetLength ( 0 ) ; findMaxPoints ( arr , N ) ; } }

Index/key variables: k
Accumulator variables: j, k
Iterator variables: j, k
Boolean variables: flag
Class/struct names: GFG
C# program:
using System ; class GFG { static void findMaxPoint ( int [ , ] arr ) { int maxX = int . MinValue ; int maxY = int . MinValue ; int n = arr . GetLength ( 0 ) ; for ( int i = 0 ; i < n ; i ++ ) { maxX = Math . Max ( maxX , arr [ i , 0 ] ) ; maxY = Math . Max ( maxY , arr [ i , 1 ] ) ; } for ( int i = 0 ; i < n ; i ++ ) { if ( maxX == arr [ i , 0 ] && maxY == arr [ i , 1 ] ) { Console . WriteLine ( " ( " + maxX + " , ▁ " + maxY + " ) " ) ; return ; } } Console . WriteLine ( - 1 ) ; } public static void Main ( String [ ] args ) { int [ , ] arr = new int [ , ] { { 1 , 2 } , { 2 , 1 } , { 3 , 4 } , { 4 , 3 } , { 5 , 5 } } ; findMaxPoint ( arr ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int find_index ( int [ ] arr , int n , int K ) { for ( int i = 0 ; i < n ; i ++ ) if ( arr [ i ] == K ) return i ; else if ( arr [ i ] > K ) return i ; return n ; } public static void Main ( ) { int [ ] arr = { 1 , 3 , 5 , 6 } ; int n = arr . Length ; int K = 2 ; Console . WriteLine ( find_index ( arr , n , 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 minSubarray ( int [ ] arr , int N ) { Dictionary < int , int > mp = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { int mini = int . MaxValue ; for ( int j = i ; j < N ; j ++ ) { mini = Math . Min ( mini , arr [ j ] ) ; if ( mp . ContainsKey ( mini ) ) { mp [ mini ] = mp [ mini ] + 1 ; } else { mp . Add ( mini , 1 ) ; } } } for ( int i = 0 ; i < N ; i ++ ) { Console . Write ( mp [ arr [ i ] ] + " ▁ " ) ; } } public static void Main ( String [ ] args ) { int [ ] arr = { 3 , 2 , 1 , 4 } ; int N = arr . Length ; minSubarray ( arr , N ) ; } }

Index/key variables: i, j, mini
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { public class pair { public int first , second ; public pair ( int first , int second ) { this . first = first ; this . second = second ; } } static void minSubarray ( int [ ] arr , int N ) { int [ ] result = new int [ N ] ; Stack < pair > l = new Stack < pair > ( ) ; Stack < pair > r = new Stack < pair > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { int count = 1 ; while ( l . Count != 0 && l . Peek ( ) . first > arr [ i ] ) { count += l . Peek ( ) . second ; l . Pop ( ) ; } l . Push ( new pair ( arr [ i ] , count ) ) ; result [ i ] = count ; } for ( int i = N - 1 ; i >= 0 ; i -- ) { int count = 1 ; while ( r . Count != 0 && r . Peek ( ) . first >= arr [ i ] ) { count += r . Peek ( ) . second ; r . Pop ( ) ; } r . Push ( new pair ( arr [ i ] , count ) ) ; result [ i ] *= count ; } for ( int i = 0 ; i < N ; i ++ ) { Console . Write ( result [ i ] + " ▁ " ) ; } } public static void Main ( String [ ] args ) { int [ ] arr = { 3 , 2 , 1 , 4 } ; int N = arr . Length ; minSubarray ( arr , N ) ; } }

Index/key variables: N, i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG, pair
C# program:
using System ; class GFG { static bool isPrime ( int num ) { if ( num <= 1 ) return false ; for ( int i = 2 ; i * i <= num ; i ++ ) if ( num % i == 0 ) return false ; return true ; } static bool isFulPrime ( int n ) { if ( ! isPrime ( n ) ) return false ; else { while ( n > 0 ) { int rem = n % 10 ; if ( ! ( rem == 2 rem == 3 rem == 5 rem == 7 ) ) return false ; n = n / 10 ; } } return true ; } static int countFulPrime ( int L , int R ) { int cnt = 0 ; for ( int i = L ; i <= R ; i ++ ) { if ( ( i % 2 ) != 0 && isFulPrime ( i ) ) { cnt ++ ; } } return cnt ; } public static void Main ( String [ ] args ) { int L = 1 , R = 100 ; int ans = 0 ; if ( L < 3 ) ans ++ ; Console . WriteLine ( ans + countFulPrime ( L , R ) ) ; } }

Accumulator variables: ans, cnt, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void printAlter ( int [ ] arr , int N ) { for ( int currIndex = 0 ; currIndex < N ; currIndex ++ ) { if ( currIndex % 2 == 0 ) { Console . Write ( arr [ currIndex ] + " ▁ " ) ; } } } public static void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 4 , 5 } ; int N = arr . Length ; printAlter ( arr , N ) ; } }

Index/key variables: currIndex
Accumulator variables: currIndex
Iterator variables: currIndex
Class/struct names: GFG
C# program:
using System ; class GFG { static int findmin ( string s ) { int n = s . Length ; int i , j , maximum = 0 ; int [ ] incr = new int [ n + 1 ] ; for ( i = 0 ; i < n ; i ++ ) { incr [ i + 1 ] = incr [ i ] ; if ( s [ i ] == '0' ) { incr [ i + 1 ] ++ ; } } for ( i = 0 ; i < n ; i ++ ) { for ( j = i + 1 ; j < n ; j ++ ) { maximum = Math . Max ( maximum , incr [ i ] + j - i + 1 - ( incr [ j + 1 ] - incr [ i ] ) + incr [ n ] - incr [ j + 1 ] ) ; } } return n - maximum ; } public static void Main ( ) { string S = "0110100110" ; int minimum = findmin ( S ) ; Console . WriteLine ( minimum ) ; } }

Index/key variables: i, n
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { public static bool isPower ( int x ) { if ( x != 0 && ( x & ( x - 1 ) ) == 0 ) return true ; return false ; } public static void maximumlength ( int [ ] arr , int N ) { int max_length = 0 ; int max_len_subarray = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( isPower ( arr [ i ] ) ) { max_length ++ ; max_len_subarray = Math . Max ( max_length , max_len_subarray ) ; } else { max_length = 0 ; } } Console . WriteLine ( max_len_subarray ) ; } public static void Main ( ) { int [ ] arr = { 2 , 5 , 4 , 6 , 8 , 8 , 2 } ; int N = arr . Length ; maximumlength ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i, max_length
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int findLengthOfShortestSubarray ( int [ ] arr , int N ) { int minlength = int . MaxValue ; int left = 0 ; int right = N - 1 ; while ( left < right && arr [ left + 1 ] >= arr [ left ] ) { left ++ ; } if ( left == N - 1 ) return 0 ; while ( right > left && arr [ right - 1 ] <= arr [ right ] ) { right -- ; } minlength = Math . Min ( N - left - 1 , right ) ; int j = right ; for ( int i = 0 ; i < left + 1 ; i ++ ) { if ( arr [ i ] <= arr [ j ] ) { minlength = Math . Min ( minlength , j - i - 1 ) ; } else if ( j < N - 1 ) { j ++ ; } else { break ; } } return minlength ; } public static void Main ( String [ ] args ) { int [ ] arr = { 6 , 3 , 10 , 11 , 15 , 20 , 13 , 3 , 18 , 12 } ; int N = arr . Length ; Console . Write ( findLengthOfShortestSubarray ( arr , N ) ) ; } }

Index/key variables: i, j, left, right
Accumulator variables: i, j, left, right
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void minSub ( int N ) { int count = 0 ; while ( N >= 0 ) { int num = N ; int rev = 0 ; while ( num != 0 ) { int digit = num % 10 ; rev = ( rev * 10 ) + digit ; num = num / 10 ; } if ( N == rev ) { break ; } count ++ ; N -- ; } Console . Write ( count ) ; } public static void Main ( String [ ] args ) { int N = 3456 ; minSub ( N ) ; } }

Accumulator variables: N, count
Class/struct names: GFG
C# program:
using System ; class GFG { static int numberOfGP ( int [ ] L , int N ) { if ( N <= 2 ) return 0 ; int count = 0 ; int res = 0 ; for ( int i = 2 ; i < N ; ++ i ) { if ( L [ i - 1 ] * L [ i - 1 ] == L [ i ] * L [ i - 2 ] ) { ++ count ; } else { count = 0 ; } res += count ; } return res ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 4 , 8 , 16 , 24 } ; int N = arr . Length ; Console . Write ( numberOfGP ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: res
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int cntSubarr ( int [ ] arr , int N ) { int res = 0 ; int prefixXor = 0 ; for ( int i = 0 ; i < N - 1 ; i ++ ) { prefixXor = arr [ i ] ; for ( int j = i + 1 ; j < N ; j ++ ) { prefixXor ^= arr [ j ] ; if ( prefixXor == 0 && ( j - i + 1 ) % 2 == 0 ) { res ++ ; } } } return res ; } public static void Main ( ) { int [ ] arr = { 2 , 2 , 3 , 3 , 6 , 7 , 8 } ; int N = arr . Length ; Console . WriteLine ( cntSubarr ( arr , N ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, prefixXor, res
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static readonly int M = 1000000 ; static int cntSubXor ( int [ ] arr , int N ) { int prefixXor = 0 ; int [ ] Even = new int [ M ] ; int [ ] Odd = new int [ M ] ; int cntSub = 0 ; Odd [ 0 ] = 1 ; for ( int i = 0 ; i < N ; i ++ ) { prefixXor ^= arr [ i ] ; if ( i % 2 == 1 ) { cntSub += Odd [ prefixXor ] ; Odd [ prefixXor ] ++ ; } else { cntSub += Even [ prefixXor ] ; Even [ prefixXor ] ++ ; } } return cntSub ; } public static void Main ( String [ ] args ) { int [ ] arr = { 2 , 2 , 3 , 3 , 6 , 7 , 8 } ; int N = arr . Length ; Console . Write ( cntSubXor ( arr , N ) ) ; } }

Index/key variables: M, i, prefixXor
Accumulator variables: cntSub, i, prefixXor
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; using System . Linq ; class GFG { static int S ; static void findMaxSum ( int [ ] arr , int n , int [ ] min , int k ) { List < List < int > > A = new List < List < int > > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { A . Add ( new List < int > ( ) ) ; A [ i ] . Add ( arr [ i ] ) ; A [ i ] . Add ( min [ i ] ) ; } A = A . OrderBy ( lst => lst [ 0 ] ) . ToList ( ) ; A . Reverse ( ) ; int K = 0 ; for ( int i = 0 ; i < n ; i ++ ) { S += Math . Max ( A [ i ] [ 0 ] - K , A [ i ] [ 1 ] ) ; K += k ; } } static public void Main ( ) { int [ ] arr = { 3 , 5 , 2 , 1 } ; int [ ] min = { 3 , 2 , 1 , 3 } ; int N = arr . Length ; int K = 3 ; S = 0 ; findMaxSum ( arr , N , min , K ) ; Console . WriteLine ( S ) ; } }

Index/key variables: i
Accumulator variables: K, S, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool is_prime ( int n ) { if ( n <= 1 ) return false ; for ( int i = 2 ; i * i <= n ; i ++ ) { if ( n % i == 0 ) return false ; } return true ; } static void countSmallerPrimes ( int [ ] ar , int N ) { for ( int i = 0 ; i < N ; i ++ ) { int count = 0 ; for ( int j = i + 1 ; j < N ; j ++ ) { if ( ar [ j ] <= ar [ i ] && is_prime ( ar [ j ] ) ) { count ++ ; } } Console . Write ( count + " ▁ " ) ; } } public static void Main ( ) { int [ ] ar = { 43 , 3 , 5 , 7 , 2 , 41 } ; int N = ar . Length ; countSmallerPrimes ( ar , N ) ; } }

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static bool checkConcat ( String str1 , String str2 ) { int N = str1 . Length ; int M = str2 . Length ; if ( N % M != 0 ) { return false ; } for ( int i = 0 ; i < N ; i ++ ) { if ( str1 [ i ] != str2 [ i % M ] ) { return false ; } } return true ; } public static void Main ( String [ ] args ) { String str1 = " abcabcabc " ; String str2 = " abc " ; if ( checkConcat ( str1 , str2 ) ) { Console . Write ( " Yes " ) ; } else { Console . Write ( " No " ) ; } } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int MinLen ( String str , int K ) { int N = str . Length ; int i = 0 ; while ( i < N - 1 ) { if ( str [ i ] != str [ i + 1 ] ) { break ; } i ++ ; } if ( i == N - 1 ) { return N ; } return Math . Max ( 1 , N - K ) ; } public static void Main ( String [ ] args ) { String str = " aabc " ; int K = 1 ; Console . Write ( MinLen ( str , K ) ) ; } }

Index/key variables: i
Accumulator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static double temp ( int n , int x ) { return Math . Pow ( x * 1.0 / n , n ) ; } static bool check ( int n , int y , int x ) { double v = temp ( n , x ) ; return ( v >= y ) ; } static void find ( int x , int y ) { int high = ( int ) Math . Floor ( x / Math . Exp ( 1.0 ) ) ; int low = 1 ; if ( x == y ) Console . Write ( 1 + " STRNEWLINE " ) ; else if ( ! check ( high , y , x ) ) Console . Write ( - 1 + " STRNEWLINE " ) ; else { while ( high - low > 1 ) { int mid = ( high + low ) / 2 ; if ( check ( mid , y , x ) ) high = mid ; else low = mid ; } Console . Write ( high + " STRNEWLINE " ) ; } } public static void Main ( String [ ] args ) { int x = 9 , y = 8 ; find ( x , y ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections ; using System . Collections . Generic ; class GFG { static Dictionary < int , ArrayList > M ; class node { public int data ; public node left ; public node right ; public node ( int data , node left , node right ) { this . data = data ; this . left = left ; this . right = right ; } } ; static node newnode ( int d ) { node temp = new node ( d , null , null ) ; return temp ; } static void dfs ( node root , int l ) { if ( root == null ) return ; if ( ! M . ContainsKey ( l ) ) { ArrayList temp = new ArrayList ( ) ; temp . Add ( root . data ) ; M [ l ] = temp ; } else M [ l ] . Add ( root . data ) ; dfs ( root . left , l + 1 ) ; dfs ( root . right , l + 1 ) ; } static void printMidNodes ( node root ) { M = new Dictionary < int , ArrayList > ( ) ; dfs ( root , 0 ) ; foreach ( KeyValuePair < int , ArrayList > it in M ) { int size = it . Value . Count ; if ( size % 2 == 1 ) { Console . Write ( it . Value [ ( size - 1 ) / 2 ] + " STRNEWLINE " ) ; } else { Console . Write ( it . Value [ ( size - 1 ) / 2 ] + " ▁ " + it . Value [ ( ( size - 1 ) / 2 ) + 1 ] + " STRNEWLINE " ) ; } } } public static void Main ( string [ ] args ) { node root = newnode ( 1 ) ; root . left = newnode ( 2 ) ; root . right = newnode ( 3 ) ; root . left . left = newnode ( 4 ) ; root . left . right = newnode ( 5 ) ; root . left . right . left = newnode ( 11 ) ; root . left . right . right = newnode ( 6 ) ; root . left . right . right . left = newnode ( 7 ) ; root . left . right . right . right = newnode ( 9 ) ; root . right . left = newnode ( 10 ) ; root . right . right = newnode ( 8 ) ; printMidNodes ( root ) ; } }

Index/key variables: l
Iterator variables: it
Class/struct names: GFG, node
C# program:
using System ; class GFG { static int minLength ( int [ ] arr , int N ) { for ( int i = 1 ; i < N ; i ++ ) { if ( arr [ 0 ] != arr [ i ] ) { return 1 ; } } return N ; } public static void Main ( ) { int [ ] arr = { 2 , 1 , 3 , 1 } ; int N = arr . Length ; Console . Write ( minLength ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public class node { public node left ; public node right ; } ; static void insert ( int x , node head ) { node curr = head ; for ( int i = 30 ; i >= 0 ; i -- ) { int val = ( x >> i ) & 1 ; if ( val == 0 ) { if ( curr . left == null ) curr . left = new node ( ) ; curr = curr . left ; } else { if ( curr . right == null ) curr . right = new node ( ) ; curr = curr . right ; } } } static int findMaximumXOR ( int [ ] arr , int n ) { node head = new node ( ) ; for ( int i = 0 ; i < n ; i ++ ) { insert ( arr [ i ] , head ) ; } int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int curr_xor = 0 ; int M = ( int ) Math . Pow ( 2 , 30 ) ; node curr = head ; for ( int j = 30 ; j >= 0 ; j -- ) { int val = ( arr [ i ] >> j ) & 1 ; if ( val == 0 ) { if ( curr . right != null ) { curr_xor += M ; curr = curr . right ; } else { curr = curr . left ; } } else { if ( curr . left != null ) { curr_xor += M ; curr = curr . left ; } else { curr = curr . right ; } } M /= 2 ; } ans = Math . Max ( ans , curr_xor ) ; } return ans ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 4 } ; int N = arr . Length ; Console . Write ( findMaximumXOR ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: M, curr_xor, i, j
Iterator variables: i, j
Class/struct names: GFG, node
C# program:
using System ; class GFG { static void PrintIndexes ( int [ ] arr , int N ) { for ( int i = 0 ; i < N ; i ++ ) { int currSubSum = 0 ; for ( int j = i ; j < N ; j ++ ) { currSubSum += arr [ j ] ; int sq = ( int ) Math . Sqrt ( currSubSum ) ; if ( sq * sq == currSubSum ) { Console . Write ( " ( " + i + " , " + j + " ) " + " ▁ " ) ; } } } } public static void Main ( String [ ] args ) { int [ ] arr = { 65 , 79 , 81 } ; PrintIndexes ( arr , arr . Length ) ; } }

Index/key variables: j
Accumulator variables: currSubSum, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int countPosition ( int [ , ] mat ) { int n = mat . GetLength ( 0 ) ; int m = mat . GetLength ( 1 ) ; int [ ] row = new int [ n ] ; int [ ] col = new int [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { if ( mat [ i , j ] == 1 ) { col [ j ] ++ ; row [ i ] ++ ; } } } int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { if ( row [ i ] == col [ j ] ) { count ++ ; } } } return count ; } public static void Main ( String [ ] args ) { int [ , ] mat = { { 0 , 1 } , { 1 , 1 } } ; Console . WriteLine ( countPosition ( mat ) ) ; } }

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