dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static int Count_subarray ( int [ ] arr , int n ) { int subarray_sum , remaining_sum , count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i ; j < n ; j ++ ) { subarray_sum = 0 ; remaining_sum = 0 ; for ( int k = i ; k <= j ; k ++ ) { subarray_sum += arr [ k ] ; } for ( int l = 0 ; l < i ; l ++ ) { remaining_sum += arr [ l ] ; } for ( int l = j + 1 ; l < n ; l ++ ) { remaining_sum += arr [ l ] ; } if ( subarray_sum > remaining_sum ) { count += 1 ; } } } return count ; } public static void Main ( String [ ] args ) { int [ ] arr = { 10 , 9 , 12 , 6 } ; int n = arr . Length ; Console . Write ( Count_subarray ( arr , n ) ) ; } }

Index/key variables: k, l
Accumulator variables: count, i, j, k, l, remaining_sum, subarray_sum
Iterator variables: i, j, k, l
Class/struct names: GFG
C# program:
using System ; class GFG { static int Count_subarray ( int [ ] arr , int n ) { int total_sum = 0 , subarray_sum , remaining_sum , count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { total_sum += arr [ i ] ; } for ( int i = 0 ; i < n ; i ++ ) { subarray_sum = 0 ; for ( int j = i ; j < n ; j ++ ) { subarray_sum += arr [ j ] ; remaining_sum = total_sum - subarray_sum ; if ( subarray_sum > remaining_sum ) { count += 1 ; } } } return count ; } public static void Main ( ) { int [ ] arr = { 10 , 9 , 12 , 6 } ; int n = arr . Length ; Console . WriteLine ( Count_subarray ( arr , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: count, i, j, subarray_sum, total_sum
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int maxXOR ( int [ ] arr , int n ) { int xorArr = 0 ; for ( int i = 0 ; i < n ; i ++ ) xorArr ^= arr [ i ] ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) ans = Math . Max ( ans , ( xorArr ^ arr [ i ] ) ) ; return ans ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 1 , 3 } ; int n = arr . Length ; Console . WriteLine ( maxXOR ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, xorArr
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool digitDividesK ( int num , int k ) { while ( num != 0 ) { int d = num % 10 ; if ( d != 0 && k % d == 0 ) return true ; num = num / 10 ; } return false ; } static int findCount ( int l , int r , int k ) { int count = 0 ; for ( int i = l ; i <= r ; i ++ ) { if ( digitDividesK ( i , k ) ) count ++ ; } return count ; } public static void Main ( ) { int l = 20 , r = 35 ; int k = 45 ; Console . WriteLine ( findCount ( l , r , k ) ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static Boolean isFactorial ( int n ) { for ( int i = 1 ; ; i ++ ) { if ( n % i == 0 ) { n /= i ; } else { break ; } } if ( n == 1 ) { return true ; } else { return false ; } } public static void Main ( String [ ] args ) { int n = 24 ; Boolean ans = isFactorial ( n ) ; if ( ans == true ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } }

Accumulator variables: i, n
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int lcm ( int a , int b ) { int GCD = __gcd ( a , b ) ; return ( a * b ) / GCD ; } static int MinLCM ( int [ ] a , int n ) { int [ ] Prefix = new int [ n + 2 ] ; int [ ] Suffix = new int [ n + 2 ] ; Prefix [ 1 ] = a [ 0 ] ; for ( int i = 2 ; i <= n ; i += 1 ) { Prefix [ i ] = lcm ( Prefix [ i - 1 ] , a [ i - 1 ] ) ; } Suffix [ n ] = a [ n - 1 ] ; for ( int i = n - 1 ; i >= 1 ; i -= 1 ) { Suffix [ i ] = lcm ( Suffix [ i + 1 ] , a [ i - 1 ] ) ; } int ans = Math . Min ( Suffix [ 2 ] , Prefix [ n - 1 ] ) ; for ( int i = 2 ; i < n ; i += 1 ) { ans = Math . Min ( ans , lcm ( Prefix [ i - 1 ] , Suffix [ i + 1 ] ) ) ; } return ans ; } static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } public static void Main ( String [ ] args ) { int [ ] a = { 5 , 15 , 9 , 36 } ; int n = a . Length ; Console . WriteLine ( MinLCM ( a , n ) ) ; } }

Index/key variables: i, n
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int count ( int n ) { return n * ( 3 * n - 1 ) / 2 ; } public static void Main ( String [ ] args ) { int n = 3 ; Console . WriteLine ( count ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int findMinValue ( int [ ] arr , int n ) { long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum += arr [ i ] ; return ( ( int ) ( sum / n ) + 1 ) ; } static public void Main ( ) { int [ ] arr = { 4 , 2 , 1 , 10 , 6 } ; int n = arr . Length ; Console . WriteLine ( findMinValue ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { const int MOD = 1000000007 ; static int modFact ( int n , int m ) { int result = 1 ; for ( int i = 1 ; i <= m ; i ++ ) result = ( result * i ) % MOD ; return result ; } public static void Main ( ) { int n = 3 , m = 2 ; Console . WriteLine ( modFact ( n , m ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static readonly int mod = ( int ) ( 1e9 + 7 ) ; static long power ( int p ) { long res = 1 ; for ( int i = 1 ; i <= p ; ++ i ) { res *= 2 ; res %= mod ; } return res % mod ; } static long subset_square_sum ( int [ ] A ) { int n = A . Length ; long ans = 0 ; foreach ( int i in A ) { ans += ( 1 * i * i ) % mod ; ans %= mod ; } return ( 1 * ans * power ( n - 1 ) ) % mod ; } public static void Main ( String [ ] args ) { int [ ] A = { 3 , 7 } ; Console . WriteLine ( subset_square_sum ( A ) ) ; } }

Accumulator variables: ans, res
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int N = 100050 ; static int [ ] lpf = new int [ N ] ; static int [ ] mobius = new int [ N ] ; static void least_prime_factor ( ) { for ( int i = 2 ; i < N ; i ++ ) if ( lpf [ i ] == 0 ) for ( int j = i ; j < N ; j += i ) if ( lpf [ j ] == 0 ) lpf [ j ] = i ; } static void Mobius ( ) { for ( int i = 1 ; i < N ; i ++ ) { if ( i == 1 ) mobius [ i ] = 1 ; else { if ( lpf [ i / lpf [ i ] ] == lpf [ i ] ) mobius [ i ] = 0 ; else mobius [ i ] = - 1 * mobius [ i / lpf [ i ] ] ; } } } static int gcd_pairs ( int [ ] a , int n ) { int maxi = 0 ; int [ ] fre = new int [ N ] ; for ( int i = 0 ; i < n ; i ++ ) { fre [ a [ i ] ] ++ ; maxi = Math . Max ( a [ i ] , maxi ) ; } least_prime_factor ( ) ; Mobius ( ) ; int ans = 0 ; for ( int i = 1 ; i <= maxi ; i ++ ) { if ( mobius [ i ] == 0 ) continue ; int temp = 0 ; for ( int j = i ; j <= maxi ; j += i ) temp += fre [ j ] ; ans += temp * ( temp - 1 ) / 2 * mobius [ i ] ; } return ans ; } public static void Main ( String [ ] args ) { int [ ] a = { 1 , 2 , 3 , 4 , 5 , 6 } ; int n = a . Length ; Console . Write ( gcd_pairs ( a , n ) ) ; } }

Index/key variables: N, i, j
Accumulator variables: ans, i, j, temp
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void compareVal ( double x , double y ) { double a = y * Math . Log ( x ) ; double b = x * Math . Log ( y ) ; if ( a > b ) Console . Write ( x + " ^ " + y + " ▁ > ▁ " + y + " ^ " + x ) ; else if ( a < b ) Console . Write ( x + " ^ " + y + " ▁ < ▁ " + y + " ^ " + x ) ; else if ( a == b ) Console . Write ( x + " ^ " + y + " ▁ = ▁ " + y + " ^ " + x ) ; } static public void Main ( ) { double x = 4 , y = 5 ; compareVal ( x , y ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void ZigZag ( int n ) { long [ ] fact = new long [ n + 1 ] ; long [ ] zig = new long [ n + 1 ] ; for ( int i = 0 ; i < n + 1 ; i ++ ) zig [ i ] = 0 ; fact [ 0 ] = 1 ; for ( int i = 1 ; i <= n ; i ++ ) fact [ i ] = fact [ i - 1 ] * i ; zig [ 0 ] = 1 ; zig [ 1 ] = 1 ; Console . Write ( " zig ▁ zag ▁ numbers : ▁ " ) ; Console . Write ( zig [ 0 ] + " ▁ " + zig [ 1 ] + " ▁ " ) ; for ( int i = 2 ; i < n ; i ++ ) { long sum = 0 ; for ( int k = 0 ; k <= i - 1 ; k ++ ) { sum += ( fact [ i - 1 ] / ( fact [ i - 1 - k ] * fact [ k ] ) ) * zig [ k ] * zig [ i - 1 - k ] ; } zig [ i ] = sum / 2 ; Console . Write ( sum / 2 + " ▁ " ) ; } } public static void Main ( String [ ] args ) { int n = 10 ; ZigZag ( n ) ; } }

Index/key variables: i, k
Accumulator variables: i, k, sum
Iterator variables: i, k
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int find_count ( List < int > ele ) { int count = 0 ; for ( int i = 0 ; i < ele . Count ; i ++ ) { List < int > p = new List < int > ( ) ; int c = 0 , j ; for ( j = ele . Count - 1 ; j >= ( ele . Count - 1 - i ) && j >= 0 ; j -- ) { p . Add ( ele [ j ] ) ; } j = ele . Count - 1 ; int k = 0 ; while ( j >= 0 ) { if ( ele [ j ] != p [ k ] ) { break ; } j -- ; k ++ ; if ( k == p . Count ) { c ++ ; k = 0 ; } } count = Math . Max ( count , c ) ; } return count ; } static void solve ( int n ) { int count = 1 ; List < int > ele = new List < int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { Console . Write ( count + " , ▁ " ) ; ele . Add ( count ) ; count = find_count ( ele ) ; } } public static void Main ( String [ ] args ) { int n = 10 ; solve ( n ) ; } }

Index/key variables: j, k
Accumulator variables: c, i, j, k
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static Dictionary < int , int > store = new Dictionary < int , int > ( ) ; static int Wedderburn ( int n ) { if ( n <= 2 ) return store [ n ] ; else if ( n % 2 == 0 ) { int x = n / 2 , ans = 0 ; for ( int i = 1 ; i < x ; i ++ ) { ans += store [ i ] * store [ n - i ] ; } ans += ( store [ x ] * ( store [ x ] + 1 ) ) / 2 ; if ( store . ContainsKey ( n ) ) { store . Remove ( n ) ; store . Add ( n , ans ) ; } else store . Add ( n , ans ) ; return ans ; } else { int x = ( n + 1 ) / 2 , ans = 0 ; for ( int i = 1 ; i < x ; i ++ ) { ans += store [ i ] * store [ n - i ] ; } if ( store . ContainsKey ( n ) ) { store . Remove ( n ) ; store . Add ( n , ans ) ; } else store . Add ( n , ans ) ; return ans ; } } static void Wedderburn_Etherington ( int n ) { store . Add ( 0 , 0 ) ; store . Add ( 1 , 1 ) ; store . Add ( 2 , 1 ) ; for ( int i = 0 ; i < n ; i ++ ) { Console . Write ( Wedderburn ( i ) ) ; if ( i != n - 1 ) Console . Write ( " ▁ " ) ; } } public static void Main ( String [ ] args ) { int n = 10 ; Wedderburn_Etherington ( n ) ; } }

Index/key variables: i, n, x
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int Max_sum ( int [ ] a , int n ) { int pos = 0 , neg = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] > 0 ) pos = 1 ; else if ( a [ i ] < 0 ) neg = 1 ; if ( ( pos == 1 ) && ( neg == 1 ) ) break ; } int sum = 0 ; if ( ( pos == 1 ) && ( neg == 1 ) ) { for ( int i = 0 ; i < n ; i ++ ) sum += Math . Abs ( a [ i ] ) ; } else if ( pos == 1 ) { int mini = a [ 0 ] ; sum = a [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { mini = Math . Min ( mini , a [ i ] ) ; sum += a [ i ] ; } sum -= 2 * mini ; } else if ( neg == 1 ) { for ( int i = 0 ; i < n ; i ++ ) a [ i ] = Math . Abs ( a [ i ] ) ; int mini = a [ 0 ] ; sum = a [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { mini = Math . Min ( mini , a [ i ] ) ; sum += a [ i ] ; } sum -= 2 * mini ; } return sum ; } public static void Main ( String [ ] args ) { int [ ] a = { 1 , 3 , 5 , - 2 , - 6 } ; int n = a . Length ; Console . WriteLine ( Max_sum ( a , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void decimalToBinary ( int n ) { if ( n == 0 ) { Console . Write ( "0" ) ; return ; } decimalToBinary ( n / 2 ) ; Console . Write ( n % 2 ) ; } public static void Main ( String [ ] args ) { int n = 13 ; decimalToBinary ( n ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void MinimumValue ( int x , int y ) { if ( x > y ) { int temp = x ; x = y ; y = temp ; } int a = 1 ; int b = x - 1 ; int c = y - b ; Console . WriteLine ( a + " ▁ " + b + " ▁ " + c ) ; } public static void Main ( ) { int x = 123 , y = 13 ; MinimumValue ( x , y ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool canConvert ( int a , int b ) { while ( b > a ) { if ( b % 10 == 1 ) { b /= 10 ; continue ; } if ( b % 2 == 0 ) { b /= 2 ; continue ; } return false ; } if ( b == a ) return true ; return false ; } public static void Main ( ) { int A = 2 , B = 82 ; if ( canConvert ( A , B ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Accumulator variables: b
Class/struct names: GFG
C# program:
using System ; class Rectangle { static int count ( int N ) { int a = 0 ; a = ( N * ( N + 1 ) ) / 2 ; return a ; } public static void Main ( ) { int n = 4 ; Console . Write ( count ( n ) ) ; } }

Class/struct names: Rectangle
C# program:
using System ; class GFG { static int numberOfDays ( int a , int b , int n ) { int Days = b * ( n + a ) / ( a + b ) ; return Days ; } public static void Main ( ) { int a = 10 , b = 20 , n = 5 ; Console . WriteLine ( numberOfDays ( a , b , n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int getAverage ( int x , int y ) { int avg = ( x & y ) + ( ( x ^ y ) >> 1 ) ; return avg ; } public static void Main ( ) { int x = 10 , y = 9 ; Console . WriteLine ( getAverage ( x , y ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int smallestIndex ( int [ ] a , int n ) { int right1 = 0 , right0 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] == 1 ) right1 = i ; else right0 = i ; } return Math . Min ( right1 , right0 ) ; } public static void Main ( ) { int [ ] a = { 1 , 1 , 1 , 0 , 0 , 1 , 0 , 1 , 1 } ; int n = a . Length ; Console . Write ( smallestIndex ( a , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int countSquares ( int r , int c , int m ) { int squares = 0 ; for ( int i = 1 ; i <= 8 ; i ++ ) { for ( int j = 1 ; j <= 8 ; j ++ ) { if ( Math . Max ( Math . Abs ( i - r ) , Math . Abs ( j - c ) ) <= m ) squares ++ ; } } return squares ; } public static void Main ( ) { int r = 4 , c = 4 , m = 1 ; Console . Write ( countSquares ( r , c , m ) ) ; } }

Accumulator variables: i, j, squares
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int countQuadruples ( int [ ] a , int n ) { Dictionary < int , int > mp = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) if ( mp . ContainsKey ( a [ i ] ) ) { mp [ a [ i ] ] = mp [ a [ i ] ] + 1 ; } else { mp . Add ( a [ i ] , 1 ) ; } int count = 0 ; for ( int j = 0 ; j < n ; j ++ ) { for ( int k = 0 ; k < n ; k ++ ) { if ( j == k ) continue ; mp [ a [ j ] ] = mp [ a [ j ] ] - 1 ; mp [ a [ k ] ] = mp [ a [ k ] ] - 1 ; int first = a [ j ] - ( a [ k ] - a [ j ] ) ; int fourth = ( a [ k ] * a [ k ] ) / a [ j ] ; if ( ( a [ k ] * a [ k ] ) % a [ j ] == 0 ) { if ( a [ j ] != a [ k ] ) { if ( mp . ContainsKey ( first ) && mp . ContainsKey ( fourth ) ) count += mp [ first ] * mp [ fourth ] ; } else if ( mp . ContainsKey ( first ) && mp . ContainsKey ( fourth ) ) count += mp [ first ] * ( mp [ fourth ] - 1 ) ; } if ( mp . ContainsKey ( a [ j ] ) ) { mp [ a [ j ] ] = mp [ a [ j ] ] + 1 ; } else { mp . Add ( a [ j ] , 1 ) ; } if ( mp . ContainsKey ( a [ k ] ) ) { mp [ a [ k ] ] = mp [ a [ k ] ] + 1 ; } else { mp . Add ( a [ k ] , 1 ) ; } } } return count ; } public static void Main ( String [ ] args ) { int [ ] a = { 2 , 6 , 4 , 9 , 2 } ; int n = a . Length ; Console . Write ( countQuadruples ( a , n ) ) ; } }

Index/key variables: first, fourth, i, j, k
Accumulator variables: count, i, j, k
Iterator variables: i, j, k
Class/struct names: GFG
C# program:
using System ; class GFG { static int countNumbers ( int L , int R , int K ) { if ( K == 9 ) { K = 0 ; } int totalnumbers = R - L + 1 ; int factor9 = totalnumbers / 9 ; int rem = totalnumbers % 9 ; int ans = factor9 ; for ( int i = R ; i > R - rem ; i -- ) { int rem1 = i % 9 ; if ( rem1 == K ) { ans ++ ; } } return ans ; } public static void Main ( ) { int L = 10 ; int R = 22 ; int K = 3 ; Console . WriteLine ( countNumbers ( L , R , K ) ) ; } }

Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void BalanceArray ( int [ ] A , int [ , ] Q ) { int [ ] ANS = new int [ A . Length ] ; int i , sum = 0 ; for ( i = 0 ; i < A . Length ; i ++ ) if ( A [ i ] % 2 == 0 ) sum = sum + A [ i ] ; for ( i = 0 ; i < Q . GetLength ( 0 ) ; i ++ ) { int index = Q [ i , 0 ] ; int value = Q [ i , 1 ] ; if ( A [ index ] % 2 == 0 ) sum = sum - A [ index ] ; A [ index ] = A [ index ] + value ; if ( A [ index ] % 2 == 0 ) sum = sum + A [ index ] ; ANS [ i ] = sum ; } for ( i = 0 ; i < ANS . Length ; i ++ ) Console . Write ( ANS [ i ] + " ▁ " ) ; } public static void Main ( ) { int [ ] A = { 1 , 2 , 3 , 4 } ; int [ , ] Q = { { 0 , 1 } , { 1 , - 3 } , { 0 , - 4 } , { 3 , 2 } } ; BalanceArray ( A , Q ) ; } }

Index/key variables: i, index
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int Cycles ( int N ) { int fact = 1 , result = 0 ; result = N - 1 ; int i = result ; while ( i > 0 ) { fact = fact * i ; i -- ; } return fact / 2 ; } public static void Main ( ) { int N = 5 ; int Number = Cycles ( N ) ; Console . Write ( " Hamiltonian ▁ cycles ▁ = ▁ " + Number ) ; } }

Accumulator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool digitWell ( int n , int m , int k ) { int cnt = 0 ; while ( n > 0 ) { if ( n % 10 == m ) ++ cnt ; n /= 10 ; } return cnt == k ; } static int findInt ( int n , int m , int k ) { int i = n + 1 ; while ( true ) { if ( digitWell ( i , m , k ) ) return i ; i ++ ; } } public static void Main ( ) { int n = 111 , m = 2 , k = 2 ; Console . WriteLine ( findInt ( n , m , k ) ) ; } }

Accumulator variables: i, n
Class/struct names: GFG
C# program:
using System ; class GFG { static int countOdd ( int [ ] arr , int n ) { int odd = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] % 2 == 1 ) odd ++ ; } return odd ; } static int countValidPairs ( int [ ] arr , int n ) { int odd = countOdd ( arr , n ) ; return ( odd * ( odd - 1 ) ) / 2 ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 4 , 5 } ; int n = arr . Length ; Console . WriteLine ( countValidPairs ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, 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 ; else return gcd ( b , a % b ) ; } static int lcmOfArray ( int [ ] arr , int n ) { if ( n < 1 ) return 0 ; int lcm = arr [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) lcm = ( lcm * arr [ i ] ) / gcd ( lcm , arr [ i ] ) ; return lcm ; } static int minPerfectCube ( int [ ] arr , int n ) { int minPerfectCube ; int lcm = lcmOfArray ( arr , n ) ; minPerfectCube = lcm ; int cnt = 0 ; while ( lcm > 1 && lcm % 2 == 0 ) { cnt ++ ; lcm /= 2 ; } if ( cnt % 3 == 2 ) minPerfectCube *= 2 ; else if ( cnt % 3 == 1 ) minPerfectCube *= 4 ; int i = 3 ; while ( lcm > 1 ) { cnt = 0 ; while ( lcm % i == 0 ) { cnt ++ ; lcm /= i ; } if ( cnt % 3 == 1 ) minPerfectCube *= i * i ; else if ( cnt % 3 == 2 ) minPerfectCube *= i ; i += 2 ; } return minPerfectCube ; } public static void Main ( ) { int [ ] arr = { 10 , 125 , 14 , 42 , 100 } ; int n = arr . Length ; Console . WriteLine ( minPerfectCube ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: cnt, i, lcm, minPerfectCube
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 isStrongPrime ( 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 = 11 ; if ( isStrongPrime ( 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 ; public class GFG { static int countDigitsToBeRemoved ( int N , int K ) { string s = Convert . ToString ( N ) ; int res = 0 ; int f_zero = 0 ; for ( int i = s . Length - 1 ; i >= 0 ; i -- ) { if ( K == 0 ) return res ; if ( s [ i ] == '0' ) { f_zero = 1 ; K -- ; } else res ++ ; } if ( K == 0 ) return res ; else if ( f_zero == 1 ) return s . Length - 1 ; return - 1 ; } public static void Main ( ) { int N = 10904025 ; int K = 2 ; Console . Write ( countDigitsToBeRemoved ( N , K ) + " STRNEWLINE " ) ; N = 1000 ; K = 5 ; Console . Write ( countDigitsToBeRemoved ( N , K ) + " STRNEWLINE " ) ; N = 23985 ; K = 2 ; Console . Write ( countDigitsToBeRemoved ( N , K ) + " STRNEWLINE " ) ; } }

Index/key variables: i
Accumulator variables: K, i, res
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static double getSum ( int a , int n ) { double sum = 0 ; for ( int i = 1 ; i <= n ; ++ i ) { sum += ( i / Math . Pow ( a , i ) ) ; } return sum ; } static public void Main ( ) { int a = 3 , n = 3 ; Console . WriteLine ( getSum ( a , n ) ) ; } }

Accumulator variables: sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int largestPrimeFactor ( int n ) { int max = - 1 ; while ( n % 2 == 0 ) { max = 2 ; } for ( int i = 3 ; i <= Math . Sqrt ( n ) ; i += 2 ) { while ( n % i == 0 ) { max = i ; n = n / i ; } } if ( n > 2 ) max = n ; return max ; } static bool checkUnusual ( int n ) { int factor = largestPrimeFactor ( n ) ; if ( factor > Math . Sqrt ( n ) ) { return true ; } else { return false ; } } public static void Main ( ) { int n = 14 ; if ( checkUnusual ( n ) ) { Console . WriteLine ( " YES " ) ; } else { Console . WriteLine ( " NO " ) ; } } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static void isHalfReducible ( int [ ] arr , int n , int m ) { int [ ] frequencyHash = new int [ m + 1 ] ; int i ; for ( i = 0 ; i < frequencyHash . Length ; i ++ ) frequencyHash [ i ] = 0 ; for ( i = 0 ; i < n ; i ++ ) { frequencyHash [ arr [ i ] % ( m + 1 ) ] ++ ; } for ( i = 0 ; i <= m ; i ++ ) { if ( frequencyHash [ i ] >= n / 2 ) break ; } if ( i <= m ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } public static void Main ( ) { int [ ] arr = { 8 , 16 , 32 , 3 , 12 } ; int n = arr . Length ; int m = 7 ; isHalfReducible ( arr , n , m ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections ; class GFG { static ArrayList arr = new ArrayList ( ) ; static void generateDivisors ( int n ) { for ( int i = 1 ; i <= Math . Sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { if ( n / i == i ) arr . Add ( i ) ; { arr . Add ( i ) ; arr . Add ( n / i ) ; } } } } static double harmonicMean ( int n ) { generateDivisors ( n ) ; double sum = 0.0 ; int len = arr . Count ; for ( int i = 0 ; i < len ; i ++ ) sum = sum + n / ( int ) arr [ i ] ; sum = sum / n ; return arr . Count / sum ; } static bool isOreNumber ( int n ) { double mean = harmonicMean ( n ) ; if ( mean - Math . Floor ( mean ) == 0 ) return true ; else return false ; } public static void Main ( ) { int n = 28 ; if ( isOreNumber ( n ) ) Console . WriteLine ( " YES " ) ; else Console . WriteLine ( " NO " ) ; } }

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