dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; using System . Collections ; using System . Linq ; using System . Collections . Generic ; class GFG { static List < bool > findPrimes ( int [ ] arr , int n ) { int max_val = arr . Max ( ) ; List < bool > prime = new List < bool > ( max_val + 1 ) ; for ( int i = 0 ; i < max_val + 1 ; i ++ ) prime . Add ( true ) ; prime [ 0 ] = false ; prime [ 1 ] = false ; for ( int p = 2 ; p * p <= max_val ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * 2 ; i <= max_val ; i += p ) prime [ i ] = false ; } } return prime ; } static void nonRepeatingPrimes ( int [ ] arr , int n ) { List < bool > prime = findPrimes ( arr , n ) ; Dictionary < int , int > mp = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( prime [ arr [ i ] ] ) if ( mp . ContainsKey ( arr [ i ] ) ) mp [ arr [ i ] ] ++ ; else mp . Add ( arr [ i ] , 1 ) ; } foreach ( KeyValuePair < int , int > entry in mp ) { if ( entry . Value == 1 ) Console . WriteLine ( entry . Key ) ; } } public static void Main ( string [ ] args ) { int [ ] arr = { 2 , 3 , 4 , 6 , 7 , 9 , 7 , 23 , 21 , 3 } ; int n = arr . Length ; nonRepeatingPrimes ( arr , n ) ; } }

Index/key variables: i, p
Accumulator variables: i, p
Iterator variables: entry, i, p
Class/struct names: GFG
C# program:
using System ; class GFG { static int prefixProduct ( int [ ] a , int n ) { for ( int i = 1 ; i < n ; i ++ ) { a [ i ] = a [ i ] * a [ i - 1 ] ; } for ( int j = 0 ; j < n ; j ++ ) { Console . Write ( a [ j ] + " , ▁ " ) ; } return 0 ; } public static void Main ( string [ ] args ) { int [ ] arr = new int [ ] { 2 , 4 , 6 , 5 , 10 } ; int N = 5 ; prefixProduct ( arr , N ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int countWays ( int N ) { if ( N < 4 ) return 0 ; int ans = ( ( N - 1 ) * ( N - 2 ) ) / 2 ; int s = 0 ; for ( int i = 2 ; i <= N - 3 ; i ++ ) { for ( int j = 1 ; j < i ; j ++ ) { if ( N == 2 * i + j ) s ++ ; } } if ( N % 3 == 0 ) s = 3 * s + 1 ; else s = 3 * s ; return ans - s ; } public static void Main ( ) { int N = 10 ; Console . Write ( countWays ( N ) ) ; } }

Accumulator variables: i, j, s
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPrime ( int n ) { if ( n <= 1 ) return false ; if ( n <= 3 ) return true ; if ( n % 2 == 0 n % 3 == 0 ) return false ; for ( int i = 5 ; i * i <= n ; i = i + 6 ) if ( n % i == 0 || n % ( i + 2 ) == 0 ) return false ; return true ; } static bool isMagnanimous ( int N ) { String s = N . ToString ( ) ; int l = s . Length ; if ( l < 2 ) return false ; for ( int i = 0 ; i < l - 1 ; i ++ ) { String left = s . Substring ( 0 , i + 1 ) ; String right = s . Substring ( i + 1 ) ; int x = int . Parse ( left ) ; int y = int . Parse ( right ) ; if ( ! isPrime ( x + y ) ) return false ; } return true ; } public static void Main ( String [ ] args ) { int N = 12 ; if ( isMagnanimous ( N ) ) Console . Write ( " Yes STRNEWLINE " ) ; else Console . Write ( " No STRNEWLINE " ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static readonly int limit = 10000000 ; static int [ ] position = new int [ limit + 1 ] ; static void sieve ( ) { position [ 0 ] = - 1 ; position [ 1 ] = - 1 ; int pos = 0 ; for ( int i = 2 ; i <= limit ; i ++ ) { if ( position [ i ] == 0 ) { position [ i ] = ++ pos ; for ( int j = i * 2 ; j <= limit ; j += i ) position [ j ] = - 1 ; } } } static int getSum ( int n ) { int sum = 0 ; while ( n != 0 ) { sum = sum + n % 10 ; n = n / 10 ; } return sum ; } static bool isHonakerPrime ( int n ) { int pos = position [ n ] ; if ( pos == - 1 ) return false ; return getSum ( n ) == getSum ( pos ) ; } public static void Main ( String [ ] args ) { sieve ( ) ; int N = 121 ; if ( isHonakerPrime ( N ) ) Console . Write ( " Yes STRNEWLINE " ) ; else Console . Write ( " No STRNEWLINE " ) ; } }

Index/key variables: i, j, n
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int N = 4 , M = 5 ; static Boolean isPrime ( int n ) { if ( n <= 1 ) return false ; for ( int i = 2 ; i <= Math . Sqrt ( n ) ; i ++ ) if ( n % i == 0 ) return false ; return true ; } static int takeSum ( int [ ] [ ] a ) { int s = 0 ; for ( int i = 0 ; i < N ; i ++ ) for ( int j = 0 ; j < M ; j ++ ) s += a [ i ] [ j ] ; return s ; } public static void Main ( String [ ] args ) { int [ ] [ ] a = new int [ ] [ ] { new int [ ] { 1 , 2 , 3 , 4 , 2 } , new int [ ] { 0 , 1 , 2 , 3 , 34 } , new int [ ] { 0 , 34 , 21 , 12 , 12 } , new int [ ] { 1 , 2 , 3 , 6 , 6 } } ; int sum = takeSum ( a ) ; if ( isPrime ( sum ) ) Console . Write ( " YES " + " STRNEWLINE " ) ; else Console . Write ( " NO " + " STRNEWLINE " ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, s
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static long sumOfSumSeries ( int N ) { long sum = 0L ; for ( int i = 1 ; i <= N ; i ++ ) { sum = sum + ( i * ( i + 1 ) ) / 2 ; } return sum ; } public static void Main ( ) { int N = 5 ; Console . Write ( sumOfSumSeries ( N ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static long sumOfSumSeries ( int n ) { return ( n * ( n + 1 ) * ( n + 2 ) ) / 6 ; } public static void Main ( String [ ] args ) { int N = 5 ; Console . Write ( sumOfSumSeries ( N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool isContaindigit ( int n ) { while ( n > 0 ) { if ( ! ( n % 10 == 0 n % 10 == 1 n % 10 == 8 ) ) return false ; n = n / 10 ; } return true ; } static bool ispalindrome ( int n ) { string temp = n . ToString ( ) ; int l = temp . Length ; for ( int i = 0 ; i < l / 2 ; i ++ ) { if ( temp [ i ] != temp [ l - i - 1 ] ) return false ; } return true ; } static bool isTetradic ( int n ) { if ( ispalindrome ( n ) && isContaindigit ( n ) ) return true ; return false ; } static void printTetradicPrimesLessThanN ( int n ) { bool [ ] prime = new bool [ n + 1 ] ; Array . Fill ( prime , true ) ; int p = 2 ; while ( p * p <= n ) { if ( prime [ p ] ) { for ( int i = p * 2 ; i < n + 1 ; i += p ) prime [ i ] = false ; } p += 1 ; } for ( p = 2 ; p < n + 1 ; p ++ ) { if ( prime [ p ] && isTetradic ( p ) ) Console . Write ( p + " ▁ " ) ; } } static void Main ( ) { int n = 1000 ; printTetradicPrimesLessThanN ( n ) ; } }

Index/key variables: i, p
Accumulator variables: i, p
Iterator variables: i, p
Class/struct names: GFG
C# program:
using System ; class GFG { static int concat ( int a , int b ) { String s1 = a . ToString ( ) ; String s2 = b . ToString ( ) ; String s = s1 + s2 ; int c = Int32 . Parse ( s ) ; return c ; } static bool isAstonishing ( int n ) { for ( int i = 1 ; i < n ; i ++ ) { int sum = 0 ; for ( int j = i ; j < n ; j ++ ) { sum += j ; if ( sum == n ) { int concatenation = concat ( i , j ) ; if ( concatenation == n ) { return true ; } } } } return false ; } public static void Main ( String [ ] args ) { int n = 429 ; if ( isAstonishing ( n ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Accumulator variables: i, j, sum
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static bool checkSame ( int n , int b ) { Dictionary < int , int > m = new Dictionary < int , int > ( ) ; while ( n != 0 ) { int r = n % b ; n = n / b ; if ( m . ContainsKey ( r ) ) { m [ r ] = m [ r ] + 1 ; } else { m . Add ( r , 1 ) ; } } int last = - 1 ; foreach ( KeyValuePair < int , int > i in m ) { if ( last != - 1 && i . Value != last ) { return false ; } else { last = i . Value ; } } return true ; } public static void Main ( String [ ] args ) { int n = 9 ; int Base = 2 ; if ( checkSame ( n , Base ) ) Console . Write ( " Yes " ) ; else Console . Write ( " NO " ) ; } }

Index/key variables: r
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int seriesSum ( int n ) { int sum = 0 ; int currProd = 1 ; int currSum = 1 ; for ( int i = 2 ; i <= n ; i ++ ) { currProd *= i ; currSum += i ; sum += currProd - currSum ; } return sum ; } public static void Main ( ) { int N = 5 ; Console . Write ( seriesSum ( N ) ) ; } }

Accumulator variables: currProd, currSum, i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int count ( int [ ] a , int n ) { int countElements = 0 ; for ( int i = 0 ; i < n ; i ++ ) { bool flag = true ; for ( int j = 0 ; j < n ; j ++ ) { if ( i == j ) continue ; if ( a [ i ] % a [ j ] == 0 ) { flag = false ; break ; } } if ( flag == true ) ++ countElements ; } return countElements ; } public static void Main ( String [ ] args ) { int [ ] arr = { 86 , 45 , 18 , 4 , 8 , 28 , 19 , 33 , 2 } ; int n = arr . Length ; Console . Write ( count ( arr , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Boolean variables: flag
Class/struct names: GFG
C# program:
using System ; class GFG { static int smallestNumber ( int N ) { return ( int ) ( N * Math . Ceiling ( Math . Pow ( 10 , ( N - 1 ) ) / N ) ) ; } public static void Main ( ) { int N = 2 ; Console . Write ( smallestNumber ( N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int CountPairs ( int [ ] arr , int n ) { int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { if ( arr [ i ] % 2 == 0 arr [ j ] % 2 == 0 ) count ++ ; } } return count ; } public static void Main ( String [ ] args ) { int [ ] arr = { 8 , 2 , 3 , 1 , 4 , 2 } ; int n = arr . Length ; Console . WriteLine ( CountPairs ( arr , 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 int CountPairs ( int [ ] arr , int n ) { int even = 0 , odd = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] % 2 == 0 ) even ++ ; else odd ++ ; } return ( even * ( even - 1 ) ) / 2 + ( even * odd ) ; } public static void Main ( ) { int [ ] arr = { 8 , 2 , 3 , 1 , 4 , 2 } ; int n = arr . Length ; Console . Write ( CountPairs ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: even, i, odd
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isComposite ( int n ) { if ( n <= 1 ) return false ; if ( n <= 3 ) return false ; if ( n % 2 == 0 n % 3 == 0 ) return true ; for ( int i = 5 ; i * i <= n ; i = i + 6 ) if ( n % i == 0 || n % ( i + 2 ) == 0 ) return true ; return false ; } static bool isGiugaNum ( int n ) { if ( ! ( isComposite ( n ) ) ) return false ; int N = n ; while ( n % 2 == 0 ) { if ( ( N / 2 - 1 ) % 2 != 0 ) return false ; n = n / 2 ; } for ( int i = 3 ; i <= Math . Sqrt ( n ) ; i = i + 2 ) { while ( n % i == 0 ) { if ( ( N / i - 1 ) % i != 0 ) return false ; n = n / i ; } } if ( n > 2 ) if ( ( N / n - 1 ) % n != 0 ) return false ; return true ; } static void Main ( ) { int N = 30 ; if ( isGiugaNum ( N ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isDroll ( int n ) { if ( n == 1 ) return false ; int sum_even = 0 ; int sum_odd = 0 ; while ( n % 2 == 0 ) { sum_even += 2 ; n = n / 2 ; } for ( int i = 3 ; i <= Math . Sqrt ( n ) ; i = i + 2 ) { while ( n % i == 0 ) { sum_odd += i ; n = n / i ; } } if ( n > 2 ) sum_odd += n ; return sum_even == sum_odd ; } public static void Main ( ) { int n = 72 ; if ( isDroll ( n ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Accumulator variables: sum_even, sum_odd
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int gcd ( int a , int b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } static int CountPairs ( int n ) { int cnt = 0 ; for ( int i = 1 ; i * i <= n ; i ++ ) { if ( n % i == 0 ) { int div1 = i ; int div2 = n / i ; int sum = div1 + div2 ; if ( gcd ( sum , n ) == 1 ) cnt += 1 ; } } return cnt ; } public static void Main ( ) { int n = 24 ; Console . WriteLine ( CountPairs ( n ) ) ; } }

Accumulator variables: cnt, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPossible ( int A , int B ) { return ( A - B > 1 ) ; } public static void Main ( ) { int A = 10 , B = 4 ; if ( isPossible ( A , B ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int [ ] sub = new int [ 100005 ] ; static int minDivisorDifference ( int n ) { int num1 = 0 ; int num2 = 0 ; for ( int i = ( int ) Math . Sqrt ( n ) ; i <= n ; i ++ ) { if ( n % i == 0 ) { num1 = i ; num2 = n / i ; break ; } } return Math . Abs ( num1 - num2 ) ; } static int dfs ( List < int > [ ] g , int u , int par ) { sub [ u ] = minDivisorDifference ( u ) ; int mx = 0 ; foreach ( int c in g [ u ] ) { if ( c != par ) { int ans = dfs ( g , c , u ) ; mx = Math . Max ( mx , ans ) ; } } sub [ u ] += mx ; return sub [ u ] ; } public static void Main ( String [ ] args ) { List < int > [ ] g = new List < int > [ 100005 ] ; for ( int i = 0 ; i < g . Length ; i ++ ) g [ i ] = new List < int > ( ) ; int edges = 6 ; g [ 18 ] . Add ( 7 ) ; g [ 7 ] . Add ( 18 ) ; g [ 18 ] . Add ( 15 ) ; g [ 15 ] . Add ( 18 ) ; g [ 15 ] . Add ( 2 ) ; g [ 2 ] . Add ( 15 ) ; g [ 7 ] . Add ( 4 ) ; g [ 4 ] . Add ( 7 ) ; g [ 7 ] . Add ( 12 ) ; g [ 12 ] . Add ( 7 ) ; g [ 12 ] . Add ( 9 ) ; g [ 9 ] . Add ( 12 ) ; int root = 18 ; Console . Write ( dfs ( g , root , - 1 ) ) ; } }

Index/key variables: i, u
Accumulator variables: i
Iterator variables: c, i
Class/struct names: GFG
C# program:
using System ; class GFG { static Boolean isCenteredcube ( int N ) { int i = 1 ; while ( true ) { int ith_term = ( 2 * i + 1 ) * ( i * i + i + 1 ) ; if ( ith_term == N ) { return true ; } if ( ith_term > N ) { return false ; } i ++ ; } } public static void Main ( ) { int N = 9 ; if ( isCenteredcube ( N ) ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } }

Accumulator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static float productOfGP ( float a , float r , int n ) { float product = 1 ; for ( int i = 0 ; i < n ; i ++ ) { product = product * a ; a = a * r ; } return product ; } public static void Main ( ) { float a = 1 , r = 2 ; int N = 4 ; Console . Write ( productOfGP ( a , r , N ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int gcd ( int a , int b ) { if ( b == 0 ) { return a ; } return gcd ( b , a % b ) ; } static int findlcm ( int [ ] arr , int n ) { int ans = arr [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { ans = ( ( ( arr [ i ] * ans ) ) / ( gcd ( arr [ i ] , ans ) ) ) ; } return ans ; } static void addReduce ( int n , int [ ] num , int [ ] den ) { int final_numerator = 0 ; int final_denominator = findlcm ( den , n ) ; for ( int i = 0 ; i < n ; i ++ ) { final_numerator = final_numerator + ( num [ i ] ) * ( final_denominator / den [ i ] ) ; } int GCD = gcd ( final_numerator , final_denominator ) ; final_numerator /= GCD ; final_denominator /= GCD ; Console . Write ( final_numerator + " / " + final_denominator ) ; } public static void Main ( string [ ] args ) { int N = 3 ; int [ ] arr1 = { 1 , 2 , 5 } ; int [ ] arr2 = { 2 , 1 , 6 } ; addReduce ( N , arr1 , arr2 ) ; } }

Index/key variables: i
Accumulator variables: final_denominator, final_numerator, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int gcd ( int a , int b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } static int minLCM ( int [ ] arr , int n ) { int ans = Int32 . MaxValue ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { int g = gcd ( arr [ i ] , arr [ j ] ) ; int lcm = arr [ i ] / g * arr [ j ] ; ans = Math . Min ( ans , lcm ) ; } } return ans ; } public static void Main ( ) { int [ ] arr = { 2 , 4 , 3 , 6 , 5 } ; int n = arr . Length ; Console . Write ( minLCM ( arr , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void solve ( int n ) { int upper_limit = ( int ) ( Math . Ceiling ( Math . Pow ( n , 1.0 / 4 ) ) ) ; for ( int x = 0 ; x <= upper_limit ; x ++ ) { for ( int y = 0 ; y <= upper_limit ; y ++ ) { int num1 = x * x * x * x ; int num2 = y * y * y * y ; if ( num1 - num2 == n ) { Console . Write ( " x ▁ = ▁ " + x + " , ▁ y ▁ = ▁ " + y ) ; return ; } } } Console . Write ( - 1 ) ; } public static void Main ( String [ ] args ) { int n = 15 ; solve ( n ) ; } }

Accumulator variables: x, y
Iterator variables: x, y
Class/struct names: GFG
C# program:
using System ; class GFG { static bool divisorsSame ( int n ) { int even_div = 0 , odd_div = 0 ; for ( int i = 1 ; i <= Math . Sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { if ( n / i == i ) { if ( i % 2 == 0 ) { even_div ++ ; } else { odd_div ++ ; } } else { if ( i % 2 == 0 ) { even_div ++ ; } else { odd_div ++ ; } if ( n / i % 2 == 0 ) { even_div ++ ; } else { odd_div ++ ; } } } } return ( even_div == odd_div ) ; } public static void Main ( ) { int N = 6 ; if ( divisorsSame ( N ) ) { Console . Write ( " Yes " ) ; } else { Console . Write ( " No " ) ; } } }

Accumulator variables: even_div, i, odd_div
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPrime ( int n ) { if ( n <= 1 ) return false ; if ( n <= 3 ) return true ; if ( n % 2 == 0 n % 3 == 0 ) return false ; for ( int i = 5 ; i * i <= n ; i = i + 6 ) if ( n % i == 0 || n % ( i + 2 ) == 0 ) return false ; return true ; } static bool isBalancedPrime ( int n ) { if ( ! isPrime ( n ) n == 2 ) return false ; int previous_prime = n - 1 ; int next_prime = n + 1 ; while ( ! isPrime ( next_prime ) ) next_prime ++ ; while ( ! isPrime ( previous_prime ) ) previous_prime -- ; int mean = ( previous_prime + next_prime ) / 2 ; if ( n == mean ) return true ; else return false ; } public static void Main ( ) { int n = 53 ; if ( isBalancedPrime ( n ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Accumulator variables: next_prime, previous_prime
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static readonly int N = 100001 ; static List < int > [ ] adj = new List < int > [ N ] ; static int [ ] a = new int [ N ] ; static int [ ] ans = new int [ N ] ; static bool hasOddNumberOfDivisors ( int n ) { if ( ( double ) Math . Sqrt ( n ) == ( int ) Math . Sqrt ( n ) ) return true ; return false ; } static int dfs ( int node , int parent ) { int count = 0 ; foreach ( int i in adj [ node ] ) { if ( i != parent ) { count += dfs ( i , node ) ; } } if ( hasOddNumberOfDivisors ( a [ node ] ) ) ++ count ; ans [ node ] = count ; return count ; } public static void Main ( String [ ] args ) { int n = 5 ; int [ ] q = { 4 , 1 , 5 , 3 } ; for ( int i = 0 ; i < adj . Length ; i ++ ) adj [ i ] = new List < int > ( ) ; adj [ 1 ] . Add ( 2 ) ; adj [ 2 ] . Add ( 1 ) ; adj [ 2 ] . Add ( 3 ) ; adj [ 3 ] . Add ( 2 ) ; adj [ 3 ] . Add ( 4 ) ; adj [ 4 ] . Add ( 3 ) ; adj [ 1 ] . Add ( 5 ) ; adj [ 5 ] . Add ( 1 ) ; a [ 1 ] = 4 ; a [ 2 ] = 9 ; a [ 3 ] = 14 ; a [ 4 ] = 100 ; a [ 5 ] = 5 ; dfs ( 1 , - 1 ) ; for ( int i = 0 ; i < q . Length ; i ++ ) { Console . Write ( ans [ q [ i ] ] + " ▁ " ) ; } } }

Index/key variables: N, i, node
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static int lowerBound ( int [ ] array , int length , int value ) { int low = 0 ; int high = length ; while ( low < high ) { int mid = ( low + high ) / 2 ; if ( value <= array [ mid ] ) { high = mid ; } else { low = mid + 1 ; } } return low ; } public static int costCalculation ( int current , int [ ] arr , int n , int [ ] pref , int a , int r , int minimum ) { int index = lowerBound ( arr , arr . Length , current ) ; int left = index * current - pref [ index ] ; int right = pref [ n ] - pref [ index ] - ( n - index ) * current ; int res = Math . Min ( left , right ) ; left -= res ; right -= res ; int total = res * minimum ; total += left * a ; total += right * r ; return total ; } public static void solve ( int [ ] arr , int n , int a , int r , int m ) { Array . Sort ( arr ) ; int minimum = Math . Min ( a + r , m ) ; int [ ] pref = new int [ n + 1 ] ; Array . Fill ( pref , 0 ) ; for ( int i = 0 ; i < n ; i ++ ) pref [ i + 1 ] = pref [ i ] + arr [ i ] ; int ans = 10000 ; for ( int i = 0 ; i < n ; i ++ ) ans = Math . Min ( ans , costCalculation ( arr [ i ] , arr , n , pref , a , r , minimum ) ) ; ans = Math . Min ( ans , costCalculation ( pref [ n ] / n , arr , n , pref , a , r , minimum ) ) ; ans = Math . Min ( ans , costCalculation ( pref [ n ] / n + 1 , arr , n , pref , a , r , minimum ) ) ; Console . WriteLine ( ans ) ; } public static void Main ( string [ ] args ) { int [ ] arr = { 5 , 5 , 3 , 6 , 5 } ; int A = 1 , R = 2 , M = 4 ; int size = arr . Length ; solve ( arr , size , A , R , M ) ; } }

Index/key variables: i, index, mid, n
Accumulator variables: i, left, right, total
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int countBinaries ( int N ) { int ctr = 1 ; int ans = 0 ; while ( N > 0 ) { if ( N % 10 == 1 ) { ans += ( int ) Math . Pow ( 2 , ctr - 1 ) ; } else if ( N % 10 > 1 ) { ans = ( int ) ( Math . Pow ( 2 , ctr ) - 1 ) ; } ctr ++ ; N /= 10 ; } return ans ; } public static void Main ( String [ ] args ) { int N = 20 ; Console . Write ( countBinaries ( N ) ) ; } }

Accumulator variables: N, ans, ctr
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int countBinaries ( int N ) { List < int > powersOfTwo = new List < int > ( ) ; powersOfTwo . Add ( 1 ) ; for ( int i = 1 ; i < 11 ; i ++ ) { powersOfTwo . Add ( powersOfTwo [ i - 1 ] * 2 ) ; } int ctr = 1 ; int ans = 0 ; while ( N > 0 ) { if ( N % 10 == 1 ) { ans += powersOfTwo [ ctr - 1 ] ; } else if ( N % 10 > 1 ) { ans = powersOfTwo [ ctr ] - 1 ; } ctr ++ ; N /= 10 ; } return ans ; } static public void Main ( ) { int N = 20 ; Console . Write ( countBinaries ( N ) ) ; } }

Index/key variables: ctr
Accumulator variables: N, ans, ctr, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static int center_heptagonal_num ( int n ) { return ( 7 * n * n - 7 * n + 2 ) / 2 ; } public static int sum_center_heptagonal_num ( int n ) { int summ = 0 ; for ( int i = 1 ; i < n + 1 ; i ++ ) { summ += center_heptagonal_num ( i ) ; } return summ ; } public static void Main ( ) { int n = 5 ; Console . Write ( sum_center_heptagonal_num ( n ) ) ; } }

Accumulator variables: i, summ
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int Centered_Dodecagonal_num ( int n ) { return 6 * n * ( n - 1 ) + 1 ; } static int sum_Centered_Dodecagonal_num ( int n ) { int summ = 0 ; for ( int i = 1 ; i < n + 1 ; i ++ ) { summ += Centered_Dodecagonal_num ( i ) ; } return summ ; } public static void Main ( ) { int n = 5 ; Console . Write ( sum_Centered_Dodecagonal_num ( n ) ) ; } }

Accumulator variables: i, summ
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int center_Octagonal_num ( int n ) { return ( 4 * n * n - 4 * n + 1 ) ; } static int sum_center_Octagonal_num ( int n ) { int summ = 0 ; for ( int i = 1 ; i < n + 1 ; i ++ ) { summ += center_Octagonal_num ( i ) ; } return summ ; } public static void Main ( ) { int n = 5 ; Console . WriteLine ( sum_center_Octagonal_num ( n ) ) ; } }

Accumulator variables: i, summ
Iterator variables: i
Class/struct names: GFG