dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static int ncr ( int n , int r ) { int ans = 1 ; for ( int i = 1 ; i <= r ; i += 1 ) { ans *= ( n - r + i ) ; ans /= i ; } return ans ; } static int totalWays ( int X , int Y , int M , int W ) { return ( ncr ( M , X ) * ncr ( W , Y ) ) ; } static public void Main ( ) { int X = 4 , Y = 3 , M = 6 , W = 5 ; Console . WriteLine ( totalWays ( X , Y , M , W ) ) ; } }

Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void specialSieve ( int n ) { int cnt = 0 ; int [ ] prime = new int [ n + 1 ] ; for ( int i = 0 ; i <= n ; i ++ ) prime [ i ] = 0 ; for ( int i = 2 ; i <= n ; i ++ ) { if ( ! ( prime [ i ] > 0 ) ) { cnt ++ ; for ( int j = i ; j <= n ; j += i ) prime [ j ] = cnt ; } } for ( int i = 2 ; i <= n ; i ++ ) Console . Write ( prime [ i ] + " ▁ " ) ; } public static void Main ( ) { int n = 6 ; specialSieve ( n ) ; } }

Index/key variables: i, j
Accumulator variables: cnt, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int maximum = int . MinValue , x , ans = int . MaxValue ; static List < List < int > > graph = new List < List < int > > ( ) ; static List < int > weight = new List < int > ( ) ; static int __builtin_popcount ( int x ) { int c = 0 ; for ( int i = 0 ; i < 60 ; i ++ ) if ( ( ( x >> i ) & 1 ) != 0 ) c ++ ; return c ; } static void dfs ( int node , int parent ) { int a = __builtin_popcount ( weight [ node ] + x ) ; if ( maximum < a ) { maximum = a ; ans = node ; } else if ( maximum == a ) ans = Math . Min ( ans , node ) ; for ( int i = 0 ; i < graph [ node ] . Count ; i ++ ) { if ( graph [ node ] [ i ] == parent ) continue ; dfs ( graph [ node ] [ i ] , node ) ; } } public static void Main ( ) { x = 15 ; weight . Add ( 0 ) ; weight . Add ( 5 ) ; weight . Add ( 10 ) ; weight . Add ( 11 ) ; ; weight . Add ( 8 ) ; weight . Add ( 6 ) ; for ( int i = 0 ; i < 100 ; i ++ ) graph . Add ( new List < int > ( ) ) ; graph [ 1 ] . Add ( 2 ) ; graph [ 2 ] . Add ( 3 ) ; graph [ 2 ] . Add ( 4 ) ; graph [ 1 ] . Add ( 5 ) ; dfs ( 1 , 1 ) ; Console . Write ( ans ) ; } }

Index/key variables: i, node
Accumulator variables: c, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int count_pairs ( int [ ] a , int [ ] b , int n , int m ) { int odd1 = 0 , even1 = 0 ; int odd2 = 0 , even2 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] % 2 == 1 ) odd1 ++ ; else even1 ++ ; } for ( int i = 0 ; i < m ; i ++ ) { if ( b [ i ] % 2 == 1 ) odd2 ++ ; else even2 ++ ; } int pairs = Math . Min ( odd1 , odd2 ) + Math . Min ( even1 , even2 ) ; return pairs ; } public static void Main ( ) { int [ ] a = { 9 , 14 , 6 , 2 , 11 } ; int [ ] b = { 8 , 4 , 7 , 20 } ; int n = a . Length ; int m = b . Length ; Console . WriteLine ( count_pairs ( a , b , n , m ) ) ; } }

Index/key variables: i
Accumulator variables: even1, even2, i, odd1, odd2
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections ; class GFG { public static void solve ( int [ ] Array , int N ) { double [ ] Arraynew = new double [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { Arraynew [ i ] = Math . Log ( Array [ i ] ) ; } double [ ] prefixsum = new double [ N ] ; prefixsum [ 0 ] = Arraynew [ 0 ] ; for ( int i = 1 ; i < N ; i ++ ) { prefixsum [ i ] = prefixsum [ i - 1 ] + Arraynew [ i ] ; } int answer = 0 ; double minabs = Math . Abs ( prefixsum [ N - 1 ] - 2 * prefixsum [ 0 ] ) ; for ( int i = 1 ; i < N - 1 ; i ++ ) { double ans1 = Math . Abs ( prefixsum [ N - 1 ] - 2 * prefixsum [ i ] ) ; if ( ans1 < minabs ) { minabs = ans1 ; answer = i ; } } Console . WriteLine ( " Index ▁ is : ▁ " + answer ) ; } public static void Main ( string [ ] args ) { int [ ] Array = { 1 , 4 , 12 , 2 , 6 } ; int N = 5 ; solve ( Array , N ) ; } }

Index/key variables: N, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int getValueOfF ( int n ) { if ( n == 1 ) return 0 ; if ( n == 2 ) return 1 ; int cnt = 0 ; while ( n % 2 == 0 ) { cnt += 1 ; n /= 2 ; } return 2 * cnt ; } static public void Main ( ) { int n = 20 ; Console . WriteLine ( getValueOfF ( n ) ) ; } }

Accumulator variables: cnt, n
Class/struct names: GFG
C# program:
using System ; class GFG { static int N = 100005 ; static int mod = 1000000007 ; static int [ ] cnt = new int [ N ] ; static void Divisors ( ) { for ( int i = 1 ; i < N ; i ++ ) { for ( int j = 1 ; j * i < N ; j ++ ) { cnt [ i * j ] ++ ; } } } static int Sumofdivisors ( int A , int B , int C ) { int sum = 0 ; Divisors ( ) ; for ( int i = 1 ; i <= A ; i ++ ) { for ( int j = 1 ; j <= B ; j ++ ) { for ( int k = 1 ; k <= C ; k ++ ) { int x = i * j * k ; sum += cnt [ x ] ; if ( sum >= mod ) { sum -= mod ; } } } } return sum ; } public static void Main ( String [ ] args ) { int A = 5 , B = 6 , C = 7 ; Console . WriteLine ( Sumofdivisors ( A , B , C ) ) ; } }

Index/key variables: N, x
Accumulator variables: i, j, k, sum
Iterator variables: i, j, k
Class/struct names: GFG
C# program:
using System ; class GFG { static int A_mod_B ( string N , int a ) { int len = N . Length ; int ans = 0 ; for ( int i = 0 ; i < len ; i ++ ) ans = ( ans * 10 + ( int ) N [ i ] - '0' ) % a ; return ans % a ; } static int findMod ( string N ) { int mod = A_mod_B ( N , 4 ) ; int ans = ( 1 + ( int ) Math . Pow ( 2 , mod ) + ( int ) Math . Pow ( 3 , mod ) + ( int ) Math . Pow ( 4 , mod ) ) ; return ( ans % 5 ) ; } public static void Main ( ) { string N = "4" ; Console . WriteLine ( findMod ( N ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GfG { public static void printElements ( int [ ] arr , int n ) { for ( int i = 1 ; i < n - 1 ; i ++ ) { if ( arr [ i ] > arr [ i - 1 ] && arr [ i ] > arr [ i + 1 ] ) { Console . Write ( arr [ i ] + " ▁ " ) ; } } } public static void Main ( string [ ] args ) { int [ ] arr = new int [ ] { 2 , 3 , 1 , 5 , 4 , 9 , 8 , 7 , 5 } ; int n = arr . Length ; printElements ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GfG
C# program:
using System ; class GFG { static int exponent ( int A , int B ) { if ( A == 0 ) return 0 ; if ( B == 0 ) return 1 ; int y ; if ( B % 2 == 0 ) { y = exponent ( A , B / 2 ) ; y = ( y * y ) ; } else { y = A ; y = ( y * exponent ( A , B - 1 ) ) ; } return y ; } static int sum ( int k , int n ) { int sum = exponent ( k , n + 1 ) - exponent ( k - 1 , n + 1 ) ; return sum ; } public static void Main ( ) { int n = 3 ; int K = 3 ; Console . WriteLine ( sum ( K , n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static bool isPrime ( int x ) { for ( int i = 2 ; i * i <= x ; i ++ ) { if ( x % i == 0 ) return false ; } return true ; } static int minimumCost ( int n ) { if ( isPrime ( n ) ) return 1 ; if ( n % 2 == 1 && isPrime ( n - 2 ) ) return 2 ; if ( n % 2 == 0 ) return 2 ; return 3 ; } public static void Main ( String [ ] args ) { int n = 6 ; Console . WriteLine ( minimumCost ( n ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static double wastedWater ( double V , double M , double N ) { double wasted_amt , amt_per_min , time_to_fill ; amt_per_min = M - N ; time_to_fill = V / amt_per_min ; wasted_amt = N * time_to_fill ; return wasted_amt ; } public static void Main ( ) { double V , M , N ; V = 700 ; M = 10 ; N = 3 ; Console . WriteLine ( wastedWater ( V , M , N ) ) ; V = 1000 ; M = 100 ; N = 50 ; Console . WriteLine ( wastedWater ( V , M , N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void nDigitPerfectCubes ( int n ) { int smallest = ( int ) Math . Pow ( Math . Ceiling ( MathF . Cbrt ( ( float ) Math . Pow ( 10 , ( n - 1 ) ) ) ) , 3 ) ; Console . Write ( smallest + " ▁ " ) ; int largest = ( int ) Math . Pow ( Math . Ceiling ( MathF . Cbrt ( ( float ) Math . Pow ( 10 , ( n ) ) ) ) - 1 , 3 ) ; Console . Write ( largest ) ; } static void Main ( ) { int n = 3 ; nDigitPerfectCubes ( n ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int countNumbers ( int n ) { return ( n / 2520 ) ; } public static void Main ( String [ ] args ) { int n = 3000 ; Console . WriteLine ( countNumbers ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static int MAX = 100001 ; public static int [ ] prefix = new int [ MAX ] ; public static void sieve_modified ( ) { for ( int i = 1 ; i < MAX ; i += 2 ) { for ( int j = i ; j < MAX ; j += i ) { prefix [ j ] += i ; } } for ( int i = 1 ; i < MAX ; i ++ ) { prefix [ i ] += prefix [ i - 1 ] ; } } public static int sumOddFactors ( int L , int R ) { return ( prefix [ R ] - prefix [ L - 1 ] ) ; } public static void Main ( string [ ] args ) { sieve_modified ( ) ; int l = 6 , r = 10 ; Console . WriteLine ( sumOddFactors ( l , r ) ) ; } }

Index/key variables: MAX, R, i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int mod = 1000000007 ; public static int power ( int x , int y ) { int p = mod ; int res = 1 ; x = x % p ; while ( y > 0 ) { if ( ( y & 1 ) != 0 ) res = ( res * x ) % p ; y = y >> 1 ; x = ( x * x ) % p ; } return res ; } public static int solve ( int n , int k ) { if ( n == 1 ) return 0 ; return ( power ( ( k - 1 ) , n - 1 ) % mod - solve ( n - 1 , k ) + mod ) % mod ; } public static void Main ( string [ ] args ) { int n = 4 , k = 5 ; Console . Write ( solve ( n , k ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GfG { static int n = 3 ; static void preComputeXor ( int [ , ] arr , int [ , ] prefix_xor ) { for ( int i = 0 ; i < n ; i ++ ) for ( int j = 0 ; j < n ; j ++ ) { if ( j == 0 ) prefix_xor [ i , j ] = arr [ i , j ] ; else prefix_xor [ i , j ] = ( prefix_xor [ i , j - 1 ] ^ arr [ i , j ] ) ; } for ( int i = 0 ; i < n ; i ++ ) for ( int j = 1 ; j < n ; j ++ ) prefix_xor [ j , i ] = ( prefix_xor [ j - 1 , i ] ^ prefix_xor [ j , i ] ) ; } static int ansQuerie ( int [ , ] prefix_xor , int x1 , int y1 , int x2 , int y2 ) { int xor_1 = 0 , xor_2 = 0 , xor_3 = 0 ; if ( x1 != 0 ) xor_1 = prefix_xor [ x1 - 1 , y2 ] ; if ( y1 != 0 ) xor_2 = prefix_xor [ x2 , y1 - 1 ] ; if ( x1 != 0 && y1 != 0 ) xor_3 = prefix_xor [ x1 - 1 , y1 - 1 ] ; return ( ( prefix_xor [ x2 , y2 ] ^ xor_1 ) ^ ( xor_2 ^ xor_3 ) ) ; } public static void Main ( ) { int [ , ] arr = { { 1 , 2 , 3 } , { 4 , 5 , 6 } , { 7 , 8 , 9 } } ; int [ , ] prefix_xor = new int [ n , n ] ; preComputeXor ( arr , prefix_xor ) ; Console . WriteLine ( ansQuerie ( prefix_xor , 1 , 1 , 2 , 2 ) ) ; Console . WriteLine ( ansQuerie ( prefix_xor , 1 , 2 , 2 , 2 ) ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GfG
C# program:
using System ; class GFG { static bool isDigitSumOne ( int nm ) { if ( nm % 9 == 1 ) return true ; else return false ; } static void printValidNums ( int n ) { int cbrt_n = ( int ) Math . Ceiling ( Math . Pow ( n , ( double ) 1 / 3 ) ) ; for ( int i = 1 ; i <= cbrt_n ; i ++ ) { int cube = ( int ) Math . Pow ( i , 3 ) ; if ( cube >= 1 && cube <= n && isDigitSumOne ( cube ) ) Console . Write ( cube + " ▁ " ) ; } } static public void Main ( ) { int n = 1000 ; printValidNums ( n ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int countRhombi ( int h , int w ) { int ct = 0 ; for ( int i = 2 ; i <= h ; i += 2 ) for ( int j = 2 ; j <= w ; j += 2 ) ct += ( h - i + 1 ) * ( w - j + 1 ) ; return ct ; } public static void Main ( ) { int h = 2 , w = 2 ; Console . WriteLine ( countRhombi ( h , w ) ) ; } }

Accumulator variables: ct, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static double calculateArea ( int x , int y ) { double pi = 3.1415926536 ; double arx = pi * x * x ; double ary = pi * y * y ; return arx - ary ; } public static void Main ( ) { int x = 2 ; int y = 1 ; Console . WriteLine ( calculateArea ( x , y ) ) ; } }

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 char getWinner ( int [ ] arr , int n ) { int gcd = arr [ 0 ] ; int maxEle = arr [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { gcd = __gcd ( gcd , arr [ i ] ) ; maxEle = Math . Max ( maxEle , arr [ i ] ) ; } int totalMoves = ( maxEle / gcd ) - n ; if ( totalMoves % 2 == 1 ) return ' A ' ; return ' B ' ; } public static void Main ( ) { int [ ] arr = { 5 , 6 , 7 } ; int n = arr . Length ; Console . Write ( getWinner ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int countPairs ( int n ) { int num = ( ( n / 2 ) + 1 ) ; int max = n % num ; int count = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = 1 ; j <= n ; j ++ ) { int val = ( ( n % i ) % j ) % n ; if ( val == max ) count ++ ; } } return count ; } public static void Main ( ) { int n = 5 ; Console . WriteLine ( countPairs ( n ) ) ; } }

Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static String isDivisible ( int n ) { int temp = n ; while ( n > 0 ) { int k = n % 10 ; if ( temp % k == 0 ) { return " YES " ; } n /= 10 ; } return " NO " ; } public static void Main ( String [ ] args ) { int n = 9876543 ; Console . WriteLine ( isDivisible ( n ) ) ; } }

Accumulator variables: n
Class/struct names: GFG
C# program:
using System ; class GFG { static float sum ( int n ) { double i , s = 0.0 ; for ( i = 1 ; i <= n ; i ++ ) s = s + 1 / i ; return ( float ) s ; } public static void Main ( ) { int n = 5 ; Console . WriteLine ( " Sum ▁ is ▁ " + sum ( n ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static readonly int N = 100005 ; static HashSet < int > ABUNDANT ( ) { HashSet < int > v = new HashSet < int > ( ) ; for ( int i = 1 ; i < N ; i ++ ) { int sum = 1 ; for ( int j = 2 ; j * j <= i ; j ++ ) { if ( i % j == 0 ) { sum += j ; if ( i / j != j ) { sum += i / j ; } } } if ( sum > i ) { v . Add ( i ) ; } } return v ; } static void SumOfAbundant ( int n ) { HashSet < int > v = ABUNDANT ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { if ( v . Contains ( i ) & v . Contains ( n - i ) ) { Console . Write ( i + " ▁ " + ( n - i ) ) ; return ; } } Console . Write ( - 1 ) ; } public static void Main ( ) { int n = 24 ; SumOfAbundant ( n ) ; } }

Accumulator variables: i, j, sum
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static long nthTermOfTheSeries ( int n ) { long nthTerm ; if ( n % 2 == 0 ) nthTerm = ( long ) Math . Pow ( n - 1 , 2 ) + n ; else nthTerm = ( long ) Math . Pow ( n + 1 , 2 ) + n ; return nthTerm ; } public static void Main ( ) { int n ; n = 8 ; Console . WriteLine ( nthTermOfTheSeries ( n ) ) ; n = 12 ; Console . WriteLine ( nthTermOfTheSeries ( n ) ) ; n = 102 ; Console . WriteLine ( nthTermOfTheSeries ( n ) ) ; n = 999 ; Console . WriteLine ( nthTermOfTheSeries ( n ) ) ; n = 9999 ; Console . WriteLine ( nthTermOfTheSeries ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class solution { static float CPwithProfit ( int sellingPrice , int profit ) { float costPrice ; costPrice = ( sellingPrice * 100 ) / ( 100 + profit ) ; return costPrice ; } static float CPwithLoss ( int sellingPrice , int loss ) { float costPrice ; costPrice = ( sellingPrice * 100 ) / ( 100 - loss ) ; return costPrice ; } public static void Main ( ) { int SP , profit , loss ; SP = 1020 ; profit = 20 ; Console . WriteLine ( " Cost ▁ Price ▁ = ▁ " + CPwithProfit ( SP , profit ) ) ; SP = 900 ; loss = 10 ; Console . WriteLine ( " Cost ▁ Price ▁ = ▁ " + CPwithLoss ( SP , loss ) ) ; SP = 42039 ; profit = 8 ; Console . WriteLine ( " Cost ▁ Price ▁ = ▁ " + CPwithProfit ( SP , profit ) ) ; }

Class/struct names: solution
C# program:
using System ; using System . Text ; class GFG { static String obtain_str ( int n ) { int len = ( int ) Math . Floor ( ( Math . Log ( n + 1 ) / Math . Log ( 2 ) ) ) ; int rel_ind = n + 1 - ( int ) Math . Pow ( 2 , len ) ; int i = 0 ; StringBuilder str = new StringBuilder ( ) ; for ( i = 0 ; i < len ; i ++ ) { str . Append ( ' a ' ) ; } i = 0 ; while ( rel_ind > 0 ) { if ( rel_ind % 2 == 1 ) str [ i ] = ' b ' ; rel_ind /= 2 ; i ++ ; } return reverse ( str . ToString ( ) ) ; } 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 ) ; } public static void Main ( String [ ] args ) { int n = 11 ; Console . Write ( obtain_str ( n ) ) ; } }

Index/key variables: i, l, r
Accumulator variables: i, l, r, rel_ind
Iterator variables: i, l
Class/struct names: GFG
C# program:
using System ; public class GFG { static void NthTerm ( int n ) { int numerator = ( ( int ) Math . Pow ( n , 2 ) ) - 1 ; int denomeanator = 2 * n - 3 ; Console . WriteLine ( numerator + " / " + denomeanator ) ; } public static void Main ( ) { int n = 3 ; NthTerm ( n ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { public static int getSum ( int [ ] arr , int p ) { return arr . Length ; } static public void Main ( ) { int [ ] arr = { 5 , 6 , 8 } ; int p = 7 ; Console . WriteLine ( getSum ( arr , p ) ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static int SquareCube ( long N ) { int cnt = 0 , i = 1 ; while ( ( int ) ( Math . Pow ( i , 6 ) ) <= N ) { ++ cnt ; ++ i ; } return cnt ; } public static void Main ( ) { long N = 100000 ; Console . WriteLine ( SquareCube ( N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static long getSum ( int n , int d ) { long sum = 0 ; while ( d <= n ) { sum += d ; d += 10 ; } return sum ; } public static void Main ( ) { int n = 30 , d = 3 ; Console . Write ( getSum ( n , d ) ) ; } }

Accumulator variables: d, sum
Class/struct names: GFG
C# program:
using System ; class GFG { static int MOD = 1000000007 ; static long sum ( long N ) { long val = N * ( N + 1 ) ; val = val % MOD ; return val ; } static int sumX ( int N , int M , int K ) { for ( int i = 0 ; i < M ; i ++ ) { N = ( int ) sum ( K + N ) ; } N = N % MOD ; return N ; } public static void Main ( ) { int N = 1 , M = 2 , K = 3 ; Console . WriteLine ( sumX ( N , M , K ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int Log2n ( int n ) { return ( n > 1 ) ? 1 + Log2n ( n / 2 ) : 0 ; } public static void Main ( ) { int n = 32 ; Console . Write ( Log2n ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Linq ; public class GFG { static void printMode ( int [ ] a , int n ) { int max = a . Max ( ) ; int t = max + 1 ; int [ ] count = new int [ t ] ; for ( int i = 0 ; i < t ; i ++ ) count [ i ] = 0 ; for ( int i = 0 ; i < n ; i ++ ) count [ a [ i ] ] ++ ; int mode = 0 ; int k = count [ 0 ] ; for ( int i = 1 ; i < t ; i ++ ) { if ( count [ i ] > k ) { k = count [ i ] ; mode = i ; } } Console . WriteLine ( " mode ▁ = ▁ " + mode ) ; } static public void Main ( ) { int [ ] a = { 1 , 4 , 1 , 2 , 7 , 1 , 2 , 5 , 3 , 6 } ; int n = a . Length ; printMode ( a , n ) ; } }

Index/key variables: i, t
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections ; class GFG { static bool checkIsHP ( double [ ] arr ) { int n = arr . Length ; if ( n == 1 ) return true ; ArrayList rec = new ArrayList ( ) ; for ( int i = 0 ; i < n ; i ++ ) rec . Add ( ( int ) ( 1 / arr [ i ] ) ) ; rec . Sort ( ) ; int d = ( int ) rec [ 1 ] - ( int ) rec [ 0 ] ; for ( int i = 2 ; i < n ; i ++ ) if ( ( int ) rec [ i ] - ( int ) rec [ i - 1 ] != d ) return false ; return true ; } public static void Main ( ) { double [ ] arr = { 1 / 5 , 1 / 10 , 1 / 15 , 1 / 20 , 1 / 25 } ; if ( checkIsHP ( arr ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static void printAMeans ( int A , int B , int N ) { float d = ( float ) ( B - A ) / ( N + 1 ) ; for ( int i = 1 ; i <= N ; i ++ ) Console . Write ( ( A + i * d ) + " ▁ " ) ; } public static void Main ( ) { int A = 20 , B = 32 , N = 5 ; printAMeans ( A , B , N ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; namespace prime { public class GFG { public static void primeFactors ( int n ) { while ( n % 2 == 0 ) { Console . Write ( 2 + " ▁ " ) ; n /= 2 ; } for ( int i = 3 ; i <= Math . Sqrt ( n ) ; i += 2 ) { while ( n % i == 0 ) { Console . Write ( i + " ▁ " ) ; n /= i ; } } if ( n > 2 ) Console . Write ( n ) ; } public static void Main ( ) { int n = 315 ; primeFactors ( n ) ; } } }

Accumulator variables: i, n
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static int startingPoint ( int Length , int Speed1 , int Speed2 ) { int result1 = 0 , result2 = 0 ; int time1 = Length / Speed1 ; int time2 = Length / Speed2 ; result1 = __gcd ( time1 , time2 ) ; result2 = time1 * time2 / ( result1 ) ; return result2 ; } static int __gcd ( int a , int b ) { if ( b == 0 ) { return a ; } return __gcd ( b , a % b ) ; } static float firstTime ( int Length , int Speed1 , int Speed2 ) { float result = 0 ; int relativeSpeed = Math . Abs ( Speed1 - Speed2 ) ; result = ( ( float ) Length / relativeSpeed ) ; return result ; } public static void Main ( ) { int L = 30 , S1 = 5 , S2 = 2 ; float first_Time = firstTime ( L , S1 , S2 ) ; int starting_Point = startingPoint ( L , S1 , S2 ) ; Console . WriteLine ( " Met ▁ first ▁ time ▁ after ▁ " + first_Time + " ▁ hrs " ) ; Console . WriteLine ( " Met ▁ at ▁ starting ▁ point ▁ after ▁ " + starting_Point + " ▁ hrs " ) ; } }

Class/struct names: GFG
C# program:
class GFG { static bool CheckArray ( int [ ] arr , int n ) { int prod = 1 ; for ( int i = 0 ; i < n ; ++ i ) prod *= arr [ i ] ; for ( int i = 0 ; i < n ; ++ i ) if ( arr [ i ] == prod / arr [ i ] ) return true ; return false ; } public static void Main ( ) { int [ ] arr = new int [ ] { 1 , 2 , 12 , 3 , 2 } ; int n = arr . Length ; if ( CheckArray ( arr , n ) ) System . Console . WriteLine ( " YES " ) ; else System . Console . WriteLine ( " NO " ) ; } }

Index/key variables: i
Accumulator variables: prod
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int sum ( int a , int b ) { int sum = 0 ; for ( int i = 1 ; i <= Math . Min ( a , b ) ; i ++ ) if ( a % i == 0 && b % i == 0 ) sum += i ; return sum ; } public static void Main ( ) { int A = 10 , B = 15 ; Console . WriteLine ( " Sum ▁ = ▁ " + sum ( A , B ) ) ; } }

Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int findgcd ( int a , int b ) { if ( b == 0 ) return a ; return findgcd ( b , a % b ) ; } static int minimumCuts ( int [ ] a , int n ) { Array . Sort ( a ) ; int gcd = a [ 1 ] - a [ 0 ] ; int s = gcd ; for ( int i = 2 ; i < n ; i ++ ) { gcd = findgcd ( gcd , a [ i ] - a [ i - 1 ] ) ; s += a [ i ] - a [ i - 1 ] ; } if ( 360 - s > 0 ) gcd = findgcd ( gcd , 360 - s ) ; return ( 360 / gcd ) - n ; } static void Main ( ) { int [ ] arr = new int [ ] { 30 , 60 , 180 } ; int n = arr . Length ; Console . WriteLine ( minimumCuts ( arr , n ) ) ; } }

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