dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; public class GFG { static int MaxBit = 32 ; static void possiblePair ( int X , int Y ) { int Z = Y - X ; if ( Z < 0 ) { Console . Write ( " - 1" ) ; } for ( int k = 0 ; k < MaxBit ; k ++ ) { int bit1 = ( Z >> k ) & 1 ; int bit2 = ( Z >> k ) & 1 ; if ( bit1 != 0 && bit2 == 0 ) { Console . Write ( " - 1" ) ; } } Console . Write ( Z + " ▁ " + X ) ; } static public void Main ( ) { int X = 7 , Y = 11 ; possiblePair ( X , Y ) ; } }

Accumulator variables: k
Iterator variables: k
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { static void maxFrequencySubarrayUtil ( int [ ] A , int N , int M ) { int i = 0 ; Dictionary < int , int > m = new Dictionary < int , int > ( ) ; int val = 0 ; for ( ; i < M ; i ++ ) { if ( m . ContainsKey ( A [ i ] ) ) { val = m [ A [ i ] ] ; m . Remove ( A [ i ] ) ; m . Add ( A [ i ] , val + 1 ) ; } else { m . Add ( A [ i ] , 1 ) ; } val = Math . Max ( val , m [ A [ i ] ] ) ; } Console . Write ( val + " ▁ " ) ; for ( i = M ; i < N ; i ++ ) { if ( m . ContainsKey ( i - M ) ) { val = i - M ; m . Remove ( i - M ) ; m . Add ( i - M , val - 1 ) ; } if ( m . ContainsKey ( A [ i ] ) ) { val = m [ A [ i ] ] ; m . Remove ( A [ i ] ) ; m . Add ( A [ i ] , val + 1 ) ; } else { m . Add ( A [ i ] , 1 ) ; } val = Math . Max ( val , m [ A [ i ] ] ) ; val = 0 ; foreach ( KeyValuePair < int , int > x in m ) { val = Math . Max ( val , x . Value ) ; } Console . Write ( val + " ▁ " ) ; } } static public void Main ( ) { int [ ] A = { 1 , 1 , 2 , 2 , 3 , 5 } ; int N = 6 ; int M = 4 ; maxFrequencySubarrayUtil ( A , N , M ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i, x
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { class Node { public int data ; public Node left , right ; public Node ( int val ) { data = val ; left = right = null ; } } static Node getNewNode ( int val ) { Node newNode = new Node ( val ) ; return newNode ; } static Node buildPerfectBT_helper ( int preStart , int preEnd , int [ ] pre ) { if ( preStart > preEnd ) return null ; Node root = getNewNode ( pre [ preStart ] ) ; if ( preStart == preEnd ) return root ; int leftPreStart = preStart + 1 ; int rightPreStart = leftPreStart + ( preEnd - leftPreStart + 1 ) / 2 ; int leftPreEnd = rightPreStart - 1 ; int rightPreEnd = preEnd ; root . left = buildPerfectBT_helper ( leftPreStart , leftPreEnd , pre ) ; root . right = buildPerfectBT_helper ( rightPreStart , rightPreEnd , pre ) ; return root ; } static Node buildPerfectBT ( int [ ] pre , int size ) { return buildPerfectBT_helper ( 0 , size - 1 , pre ) ; } static void printInorder ( Node root ) { if ( root == null ) return ; printInorder ( root . left ) ; Console . Write ( root . data + " ▁ " ) ; printInorder ( root . right ) ; } static void Main ( ) { int [ ] pre = { 1 , 2 , 4 , 5 , 3 , 6 , 7 } ; int N = pre . Length ; Node root = buildPerfectBT ( pre , N ) ; Console . Write ( " Inorder ▁ traversal ▁ of ▁ the ▁ tree : ▁ " ) ; printInorder ( root ) ; } }

Index/key variables: preStart
Class/struct names: GFG, Node
C# program:
using System ; using System . Collections ; using System . Collections . Generic ; class GFG { static int N = 3 ; static List < List < int > > adj = new List < List < int > > ( ) ; static List < bool > visited ; static int ans ; static void addEdges ( int u , int v ) { adj [ u ] . Add ( v ) ; adj [ v ] . Add ( u ) ; } static void DFSUtil ( int u , bool foo , bool foo1 , bool [ ] initial , bool [ ] finall ) { visited [ u ] = true ; if ( ( initial [ u - 1 ] ^ foo ) ^ finall [ u - 1 ] == true ) { ans += 1 ; foo ^= true ; } for ( int i = 0 ; i < adj [ u ] . Count ; i ++ ) { if ( visited [ adj [ u ] [ i ] ] == false ) DFSUtil ( adj [ u ] [ i ] , foo1 , foo , initial , finall ) ; } } static void DFS ( int V , bool [ ] initial , bool [ ] finall ) { ans = 0 ; visited = new List < bool > ( ) ; for ( int i = 0 ; i < V ; i ++ ) { visited . Add ( false ) ; } for ( int u = 1 ; u <= 1 ; u ++ ) { if ( visited [ u ] == false ) DFSUtil ( u , false , false , initial , finall ) ; } Console . Write ( ans ) ; } static void countOperations ( int N , bool [ ] initial , bool [ ] finall , int [ , ] Edges ) { for ( int i = 0 ; i < N - 1 ; i ++ ) { addEdges ( Edges [ i , 0 ] , Edges [ i , 1 ] ) ; } DFS ( N + 1 , initial , finall ) ; } static void Main ( ) { for ( int i = 0 ; i < N + 1 ; i ++ ) { adj . Add ( new List < int > ( ) ) ; } int [ , ] Edges = { { 1 , 2 } , { 1 , 3 } } ; bool [ ] initial = { true , true , false } ; bool [ ] finall = { false , true , true } ; countOperations ( N , initial , finall , Edges ) ; } }

Index/key variables: i, u, v
Accumulator variables: ans, foo, i, u
Iterator variables: i, u
Class/struct names: GFG
C# program:
using System ; using System . Collections ; class GFG { static int countOperations ( int N , int M ) { bool [ ] visited = new bool [ 100001 ] ; Queue Q = new Queue ( ) ; Q . Enqueue ( new Tuple < int , int > ( N , 0 ) ) ; visited [ N ] = true ; while ( Q . Count > 0 ) { int aux = ( ( Tuple < int , int > ) ( Q . Peek ( ) ) ) . Item1 ; int cont = ( ( Tuple < int , int > ) ( Q . Peek ( ) ) ) . Item2 ; Q . Dequeue ( ) ; if ( aux == M ) return cont ; for ( int i = 2 ; i * i <= aux ; i ++ ) if ( aux % i == 0 ) { if ( aux + i <= M && ! visited [ aux + i ] ) { Q . Enqueue ( new Tuple < int , int > ( aux + i , cont + 1 ) ) ; visited [ aux + i ] = true ; } if ( aux + aux / i <= M && ! visited [ aux + aux / i ] ) { Q . Enqueue ( new Tuple < int , int > ( aux + aux / i , cont + 1 ) ) ; visited [ aux + aux / i ] = true ; } } } return - 1 ; } static void Main ( ) { int N = 4 , M = 24 ; Console . WriteLine ( countOperations ( N , M ) ) ; } }

Index/key variables: N
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static List < List < int > > adj ; static bool [ ] visited ; static int num ; static void dfs ( int v ) { visited [ v ] = true ; num ++ ; for ( int i = 0 ; i < adj [ v ] . Count ; i ++ ) { if ( ! visited [ adj [ v ] [ i ] ] ) { dfs ( adj [ v ] [ i ] ) ; } } } static void numberOfPairs ( int N , int [ , ] arr ) { adj = new List < List < int > > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { adj . Add ( new List < int > ( ) ) ; } for ( int i = 0 ; i < 2 ; i ++ ) { adj [ arr [ i , 0 ] ] . Add ( arr [ i , 1 ] ) ; adj [ arr [ i , 1 ] ] . Add ( arr [ i , 0 ] ) ; } visited = new bool [ N ] ; Array . Fill ( visited , false ) ; List < int > v = new List < int > ( ) ; num = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( ! visited [ i ] ) { dfs ( i ) ; v . Add ( num ) ; num = 0 ; } } int ans = N * ( N - 1 ) / 2 + 1 ; for ( int i = 0 ; i < v . Count ; i ++ ) { ans -= ( v [ i ] * ( v [ i ] - 1 ) / 2 ) + 1 ; } Console . Write ( ans ) ; } static void Main ( ) { int N = 6 ; int [ , ] arr = { { 0 , 1 } , { 0 , 2 } , { 2 , 5 } } ; numberOfPairs ( N , arr ) ; } }

Index/key variables: N, i, v
Accumulator variables: ans, i, num
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class MyClass { static int MAX = 100005 ; static int isPerfect ( long N ) { long sum = 1 ; for ( long i = 2 ; i * i <= N ; i ++ ) { if ( N % i == 0 ) { if ( i * i != N ) sum = sum + i + N / i ; else sum = sum + i ; } } if ( sum == N && N != 1 ) return 1 ; return 0 ; } static void Query ( int [ , ] arr , int N ) { int [ ] prefix = new int [ MAX + 1 ] ; for ( int i = 2 ; i <= MAX ; i ++ ) { prefix [ i ] = prefix [ i - 1 ] + isPerfect ( i ) ; } for ( int i = 0 ; i < N ; i ++ ) { Console . Write ( prefix [ arr [ i , 1 ] ] - prefix [ arr [ i , 0 ] - 1 ] + " ▁ " ) ; } } public static void Main ( ) { int [ , ] arr = { { 1 , 1000 } , { 1000 , 2000 } , { 2000 , 3000 } } ; int N = arr . GetLength ( 0 ) ; Query ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: MyClass
C# program:
using System ; class GFG { static int minSteps ( int N ) { int ans = 0 ; for ( int d = 2 ; d * d <= N ; d ++ ) { while ( N % d == 0 ) { ans += d ; N /= d ; } } if ( N != 1 ) { ans += N ; } return ans ; } static public void Main ( ) { int N = 3 ; Console . Write ( minSteps ( N ) ) ; } }

Accumulator variables: N, ans, d
Iterator variables: d
Class/struct names: GFG
C# program:
using System ; class GFG { public static int SumOfPrimeDivisors ( int n ) { int sum = 0 ; if ( n % 2 == 0 ) { sum = sum + 2 ; } while ( n % 2 == 0 ) { n = n / 2 ; } for ( int i = 3 ; i <= Math . Sqrt ( n ) ; i = i + 2 ) { if ( n % i == 0 ) { sum = sum + i ; } while ( n % i == 0 ) { n = n / i ; } } if ( n > 2 ) { sum = sum + n ; } return sum ; } public static void Main ( String [ ] args ) { int n = 10 ; Console . Write ( SumOfPrimeDivisors ( n ) ) ; } }

Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int countOfBase ( int N ) { int count = 0 ; for ( int i = 2 ; i <= N ; ++ i ) { int highestPower = ( int ) ( Math . Log ( N ) / Math . Log ( i ) ) ; int firstDigit = N / ( int ) Math . Pow ( i , highestPower ) ; if ( firstDigit == 1 ) { ++ count ; } } return count ; } public static void Main ( ) { int N = 6 ; Console . Write ( countOfBase ( N ) ) ; } }

Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void kthDigitFromLast ( int n , int k ) { if ( k <= 0 ) { Console . Write ( - 1 ) ; return ; } string temp = n . ToString ( ) ; if ( k > temp . Length ) { Console . WriteLine ( - 1 ) ; } else { Console . Write ( temp [ temp . Length - k ] - 48 ) ; } } public static void Main ( ) { int n = 2354 ; int k = 2 ; kthDigitFromLast ( n , k ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int countWays ( int [ ] arr , int N ) { int arr_xor = 0 ; for ( int i = 0 ; i < N ; i ++ ) arr_xor ^= arr [ i ] ; int pref_xor = 0 , suff_xor = 0 ; List < int > pref_ind = new List < int > ( ) ; int [ ] suff_inds = new int [ N + 1 ] ; for ( int i = 0 ; i < N ; i ++ ) { pref_xor ^= arr [ i ] ; if ( pref_xor == arr_xor ) pref_ind . Add ( i ) ; } for ( int i = N - 1 ; i >= 0 ; i -- ) { suff_xor ^= arr [ i ] ; suff_inds [ i ] += suff_inds [ i + 1 ] ; if ( suff_xor == arr_xor ) suff_inds [ i ] ++ ; } int tot_ways = 0 ; foreach ( int idx in pref_ind ) { if ( idx < N - 1 ) tot_ways += suff_inds [ idx + 2 ] ; } return tot_ways ; } public static void Main ( string [ ] args ) { int [ ] arr = { 7 , 0 , 5 , 2 , 7 } ; int N = arr . Length ; Console . WriteLine ( countWays ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: arr_xor, i, pref_xor, suff_xor, tot_ways
Iterator variables: i, idx
Class/struct names: GFG
C# program:
using System ; class GFG { static int [ , ] dp = new int [ 1000 , 2 ] ; static int IsSumEqualsXor ( int i , int n , int bound , char [ ] s ) { if ( i == n ) return 1 ; if ( dp [ i , bound ] != - 1 ) return dp [ i , bound ] ; int ans = 0 ; if ( bound != 0 && s [ i ] == '0' ) { ans = IsSumEqualsXor ( i + 1 , n , 1 , s ) ; } else { ans = 2 * IsSumEqualsXor ( i + 1 , n , bound != 0 & ( s [ i ] == '1' ) ? 1 : 0 , s ) ; ans += IsSumEqualsXor ( i + 1 , n , 0 , s ) ; } return dp [ i , bound ] = ans ; } static String reverse ( String input ) { char [ ] a = input . ToCharArray ( ) ; int l , r = a . Length - 1 ; for ( l = 0 ; l < r ; l ++ , r -- ) { char temp = a [ l ] ; a [ l ] = a [ r ] ; a [ r ] = temp ; } return String . Join ( " " , a ) ; } static String convertToBinary ( int n ) { String ans = " " ; while ( n > 0 ) { char rem = ( char ) ( n % 2 + '0' ) ; ans += ( rem ) ; n /= 2 ; } ans = reverse ( ans ) ; return ans ; } static void IsSumEqualsXorUtil ( int N ) { String s = convertToBinary ( N ) ; for ( int i = 0 ; i < dp . GetLength ( 0 ) ; i ++ ) { for ( int j = 0 ; j < dp . GetLength ( 1 ) ; j ++ ) { dp [ i , j ] = - 1 ; } } Console . Write ( IsSumEqualsXor ( 0 , s . Length , 1 , s . ToCharArray ( ) ) + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { int N = 10 ; IsSumEqualsXorUtil ( N ) ; } }

Index/key variables: i, l, r
Accumulator variables: ans, i, j, l, n, r
Iterator variables: i, j, l
Class/struct names: GFG
C# program:
using System ; class GFG { static void printMat ( int [ ] degseq , int n ) { int [ , ] mat = new int [ n , n ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { if ( degseq [ i ] > 0 && degseq [ j ] > 0 ) { degseq [ i ] -- ; degseq [ j ] -- ; mat [ i , j ] = 1 ; mat [ j , i ] = 1 ; } } } Console . Write ( " STRNEWLINE " + setw ( 3 ) + " ▁ " ) ; for ( int i = 0 ; i < n ; i ++ ) Console . Write ( setw ( 3 ) + " ( " + i + " ) " ) ; Console . Write ( " STRNEWLINE STRNEWLINE " ) ; for ( int i = 0 ; i < n ; i ++ ) { Console . Write ( setw ( 4 ) + " ( " + i + " ) " ) ; for ( int j = 0 ; j < n ; j ++ ) Console . Write ( setw ( 5 ) + mat [ i , j ] ) ; Console . Write ( " STRNEWLINE " ) ; } } static String setw ( int n ) { String space = " " ; while ( n -- > 0 ) space += " ▁ " ; return space ; } public static void Main ( String [ ] args ) { int [ ] degseq = { 2 , 2 , 1 , 1 , 1 } ; int n = degseq . Length ; printMat ( degseq , n ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, n, space
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void findDecimal ( double [ ] arr , int N ) { int bit , power = 0 , result = 0 ; for ( int i = N - 1 ; i >= 0 ; i -- ) { bit = Math . Abs ( ( int ) Math . Floor ( arr [ i ] ) - ( int ) Math . Round ( arr [ i ] ) ) ; if ( bit != 0 ) result += ( int ) Math . Pow ( 2 , power ) ; power ++ ; } Console . WriteLine ( result ) ; } public static void Main ( ) { double [ ] arr = { 1.2 , 2.6 , 4.2 , 6.9 , 3.1 , 21.6 , 91.2 } ; int N = arr . Length ; findDecimal ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i, power, result
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static int totalMoney ( int N ) { int ans = 0 ; for ( int i = 0 ; i < N ; i ++ ) { ans += i / 7 ; ans += ( i % 7 + 1 ) ; } return ans ; } static public void Main ( ) { int N = 15 ; Console . WriteLine ( totalMoney ( N ) ) ; } }

Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void totalMoney ( int N ) { int CompWeeks = N / 7 ; int RemDays = N % 7 ; int X = 28 * CompWeeks + 7 * ( CompWeeks * ( CompWeeks - 1 ) / 2 ) ; int Y = RemDays * ( RemDays + 1 ) / 2 + CompWeeks * RemDays ; int cost = X + Y ; Console . WriteLine ( cost ) ; } public static void Main ( ) { int N = 15 ; totalMoney ( N ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int isPresent ( int n , int x ) { string num = n . ToString ( ) ; for ( int i = 0 ; i < num . Length ; i ++ ) { if ( ( ( int ) num [ i ] - 97 ) == x ) return i ; } return - 1 ; } static int removeDigit ( int n , int index ) { string num = n . ToString ( ) ; string ans = " " ; for ( int i = 0 ; i < num . Length ; i ++ ) { if ( i != index ) ans += num [ i ] ; } if ( ans == " " || ( ans . Length == 1 && ans [ 0 ] == '0' ) ) return - 1 ; int x = Int32 . Parse ( ans ) ; ; return x ; } static bool reduceNtoX ( int a , int b , int [ ] d , int n ) { Queue < int > q = new Queue < int > ( ) ; q . Enqueue ( a ) ; Dictionary < int , bool > visited = new Dictionary < int , bool > ( ) ; visited [ a ] = true ; while ( q . Count > 0 ) { int top = q . Peek ( ) ; q . Dequeue ( ) ; if ( top < 0 ) continue ; if ( top == b ) return true ; for ( int i = 0 ; i < n ; i ++ ) { if ( d [ i ] != 0 && top % d [ i ] == 0 && visited . ContainsKey ( top / d [ i ] ) && visited [ top / d [ i ] ] == false ) { q . Enqueue ( top / d [ i ] ) ; visited [ top / d [ i ] ] = true ; } int index = isPresent ( top , d [ i ] ) ; if ( index != - 1 ) { int newElement = removeDigit ( top , index ) ; if ( newElement != - 1 && ( visited . ContainsKey ( newElement ) && visited [ newElement ] == false ) ) { q . Enqueue ( newElement ) ; visited [ newElement ] = true ; } } } } return true ; } public static void Main ( ) { int A = 5643 , B = 81 ; int [ ] D = { 3 , 8 , 1 } ; int N = D . Length ; if ( reduceNtoX ( A , B , D , N ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Index/key variables: a, i, newElement
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static bool [ ] prime = new bool [ 100000 ] ; static void initialize ( ) { for ( int i = 0 ; i < 100000 ; i ++ ) prime [ i ] = true ; } static void SieveOfEratosthenes ( int n ) { for ( int p = 2 ; p * p <= n ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * p ; i <= n ; i += p ) { prime [ i ] = false ; } } } } static void findTriplets ( int N ) { SieveOfEratosthenes ( N ) ; List < List < int > > V = new List < List < int > > ( ) ; for ( int i = 3 ; i <= N ; i ++ ) { if ( 2 + i <= N && prime [ i ] == true && prime [ 2 + i ] ) { List < int > a1 = new List < int > ( ) ; a1 . Add ( 2 ) ; a1 . Add ( i ) ; a1 . Add ( i + 2 ) ; V . Add ( a1 ) ; } } for ( int i = 0 ; i < V . Count ; i ++ ) { Console . WriteLine ( V [ i ] [ 0 ] + " ▁ " + V [ i ] [ 1 ] + " ▁ " + V [ i ] [ 2 ] ) ; } } public static void Main ( ) { initialize ( ) ; int N = 8 ; findTriplets ( N ) ; } }

Index/key variables: i, p
Accumulator variables: i, p
Iterator variables: i, p
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static long MAX = 50 ; static bool isPrime ( long n ) { if ( n <= 1 ) return false ; if ( n <= 3 ) return true ; if ( n % 2 == 0 n % 3 == 0 ) return false ; for ( long i = 5 ; i * i <= n ; i = i + 6 ) if ( n % i == 0 || n % ( i + 2 ) == 0 ) return false ; return true ; } static void findPrime ( List < long > primes ) { for ( long i = 2 ; i <= MAX ; i ++ ) { if ( isPrime ( i ) ) primes . Add ( i ) ; } } static long gcd ( long a , long b ) { if ( b == 0 ) return a ; else return gcd ( b , a % b ) ; } static void findMinimumNumber ( long [ ] arr , long N ) { List < long > primes = new List < long > ( ) ; findPrime ( primes ) ; long ans = 2147483647 ; int n = primes . Count ; for ( int i = 1 ; i < ( 1 << n ) ; i ++ ) { long temp = 1 ; for ( int j = 0 ; j < n ; j ++ ) { if ( ( i & ( 1 << j ) ) > 0 ) { temp *= primes [ j ] ; } } bool check = true ; for ( long k = 0 ; k < N ; k ++ ) { if ( gcd ( temp , arr [ k ] ) == 1 ) { check = false ; break ; } } if ( check == true ) ans = Math . Min ( ans , temp ) ; } Console . Write ( ans ) ; } public static void Main ( ) { long [ ] arr = { 3 , 4 , 6 , 7 , 8 , 9 , 10 } ; long N = arr . Length ; findMinimumNumber ( arr , N ) ; } }

Index/key variables: j, k
Accumulator variables: i, j, k, temp
Iterator variables: i, j, k
Boolean variables: check
Class/struct names: GFG
C# program:
using System ; class GFG { static int R = 100005 ; static int [ ] arr = new int [ R ] ; public static bool canExpress ( int N ) { int temp = N ; int n = 0 ; while ( N != 0 ) { N /= 10 ; n ++ ; } N = temp ; int sum = 0 ; while ( N != 0 ) { sum += ( ( int ) Math . Pow ( N % 10 , n ) ) ; N /= 10 ; } if ( sum == temp ) return true ; return false ; } public static void precompute ( ) { for ( int i = 1 ; i < R ; i ++ ) { if ( canExpress ( i ) ) { arr [ i ] = 1 ; } } for ( int i = 1 ; i < R ; i ++ ) { arr [ i ] += arr [ i - 1 ] ; } } public static void countNumbers ( int [ , ] queries , int N ) { precompute ( ) ; for ( int i = 0 ; i < N ; i ++ ) { int L1 = queries [ i , 0 ] ; int R1 = queries [ i , 1 ] ; Console . Write ( ( arr [ R1 ] - arr [ L1 - 1 ] ) + " ▁ " ) ; } } static public void Main ( ) { int [ , ] queries = { { 1 , 400 } , { 1 , 9 } } ; int N = queries . GetLength ( 0 ) ; countNumbers ( queries , N ) ; } }

Index/key variables: R, R1, i
Accumulator variables: N, i, n, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { public static void sumOfNodeInAPath ( int node_value ) { int sum_of_node = 0 ; while ( node_value > 0 ) { sum_of_node += node_value ; node_value /= 2 ; } Console . Write ( sum_of_node ) ; } public static void findSum ( List < int > Q ) { for ( int i = 0 ; i < Q . Count ; i ++ ) { int node_value = Q [ i ] ; sumOfNodeInAPath ( node_value ) ; Console . Write ( " ▁ " ) ; } } static public void Main ( ) { List < int > arr = new List < int > ( ) ; arr . Add ( 1 ) ; arr . Add ( 5 ) ; arr . Add ( 20 ) ; arr . Add ( 100 ) ; findSum ( arr ) ; } }

Index/key variables: i
Accumulator variables: i, node_value, sum_of_node
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void minDeletions ( int [ ] arr , int N ) { Dictionary < int , int > freq = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( freq . ContainsKey ( arr [ i ] ) ) freq [ arr [ i ] ] ++ ; else freq [ arr [ i ] ] = 1 ; } List < int > v = new List < int > ( ) ; foreach ( var z in freq ) { v . Add ( z . Value ) ; } int sz = v . Count ; int [ ] temp = new int [ sz ] ; for ( int i = 0 ; i < v . Count ; i ++ ) temp [ i ] = v [ i ] ; Array . Sort ( temp ) ; for ( int i = 0 ; i < v . Count ; i ++ ) v [ i ] = temp [ i ] ; int size = v . Count ; int ans = N - ( v [ 0 ] * size ) ; for ( int i = 1 ; i < v . Count ; i ++ ) { if ( v [ i ] != v [ i - 1 ] ) { int safe = v [ i ] * ( size - i ) ; ans = Math . Min ( ans , N - safe ) ; } } Console . WriteLine ( ans ) ; } public static void Main ( ) { int [ ] arr = { 2 , 4 , 3 , 2 , 5 , 3 } ; int N = arr . Length ; minDeletions ( arr , N ) ; } }

Index/key variables: i, sz
Accumulator variables: i
Iterator variables: i, z
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class graph { int vertices , itr ; int [ , ] adjacency_matrix ; public graph ( int vertices ) { this . vertices = vertices ; adjacency_matrix = new int [ vertices , vertices ] ; } public void insert ( int source , int destination ) { adjacency_matrix = 1 ; } public bool issink ( int i ) { for ( int j = 0 ; j < vertices ; j ++ ) { if ( adjacency_matrix [ i , j ] == 1 ) return false ; if ( adjacency_matrix [ j , i ] == 0 && j != i ) return false ; } return true ; } public int eliminate ( ) { int i = 0 , j = 0 ; while ( i < vertices && j < vertices ) { if ( adjacency_matrix [ i , j ] == 1 ) i = i + 1 ; else j = j + 1 ; } if ( i > vertices ) return - 1 ; else if ( ! issink ( i ) ) return - 1 ; else return i ; } } public class Sink { public static void Main ( String [ ] args ) { int number_of_vertices = 6 ; graph g = new graph ( number_of_vertices ) ; g . insert ( 1 , 6 ) ; g . insert ( 2 , 3 ) ; g . insert ( 2 , 4 ) ; g . insert ( 4 , 3 ) ; g . insert ( 5 , 3 ) ; int vertex = g . eliminate ( ) ; if ( vertex >= 0 ) Console . WriteLine ( " Sink ▁ found ▁ at ▁ vertex ▁ " + ( vertex + 1 ) ) ; else Console . WriteLine ( " No ▁ Sink " ) ; } }

Accumulator variables: j
Iterator variables: j
Class/struct names: Sink, graph