dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static int cal ( int n ) { double res = Math . Pow ( Math . Ceiling ( ( Math . Pow ( Math . Pow ( 10 , ( n - 1 ) ) , 1 / 4 ) ) ) , 4 ) ; return ( int ) res ; } public static void Main ( ) { int n = 1 ; Console . Write ( cal ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int count ( int n ) { return 3 * n * ( n - 1 ) + 1 ; } static public void Main ( ) { int n = 3 ; Console . Write ( count ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static long binomialCoeff ( long n , long k ) { if ( k == 0 k == n ) return 1 ; return binomialCoeff ( n - 1 , k - 1 ) + binomialCoeff ( n - 1 , k ) ; } static long fact ( long n ) { if ( n >= 1 ) return n * fact ( n - 1 ) ; else return 1 ; } static bool isVowel ( char ch ) { if ( ch == ' a ' ch == ' e ' ch == ' i ' ch == ' o ' ch == ' u ' ) { return true ; } return false ; } static long countWords ( String s , int p , int q ) { long countc = 0 , countv = 0 ; for ( int i = 0 ; i < s . Length ; i ++ ) { if ( isVowel ( s [ i ] ) ) countv ++ ; else countc ++ ; } long a = binomialCoeff ( countc , p ) ; long b = binomialCoeff ( countv , q ) ; long c = fact ( p + q ) ; long ans = ( a * b ) * c ; return ans ; } public static void Main ( String [ ] args ) { String s = " crackathon " ; int p = 4 , q = 3 ; Console . WriteLine ( countWords ( s , p , q ) ) ; } }

Index/key variables: i
Accumulator variables: countc, countv, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void printArr ( int [ ] arr , int n ) { for ( int i = 0 ; i < n ; i ++ ) Console . Write ( arr [ i ] + " ▁ " ) ; } static void generateArr ( int [ ] A , int n ) { int [ ] B = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { int cnt = 0 ; for ( int j = 0 ; j < i ; j ++ ) { if ( A [ j ] % A [ i ] == 0 ) cnt ++ ; } B [ i ] = cnt ; } printArr ( B , n ) ; } public static void Main ( String [ ] args ) { int [ ] A = { 3 , 5 , 1 } ; int n = A . Length ; generateArr ( A , n ) ; } }

Index/key variables: i, j, n
Accumulator variables: cnt, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void findNums ( int n ) { if ( n <= 11 ) { if ( n == 8 ) Console . Write ( "4 ▁ 4" ) ; if ( n == 10 ) Console . Write ( "4 ▁ 6" ) ; else Console . Write ( " - 1" ) ; return ; } if ( n % 2 == 0 ) Console . Write ( "4 ▁ " + ( n - 4 ) ) ; else Console . Write ( "9 ▁ " + ( n - 9 ) ) ; } public static void Main ( ) { int n = 13 ; findNums ( n ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int count ( int n ) { return ( int ) Math . Pow ( 2 , n - 1 ) ; } public static void Main ( String [ ] args ) { int n = 4 ; Console . WriteLine ( count ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static long nextFibonacci ( int n ) { double a = n * ( 1 + Math . Sqrt ( 5 ) ) / 2.0 ; return ( long ) Math . Round ( a ) ; } public static void Main ( String [ ] args ) { int n = 5 ; Console . WriteLine ( nextFibonacci ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int sum ( int h ) { return ( int ) Math . Pow ( 2 , h - 1 ) ; } public static void Main ( ) { int L = 3 ; Console . WriteLine ( sum ( L ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int product ( int [ ] a , int n ) { int ans = 1 ; int val = ( int ) Math . Pow ( 2 , n - 1 ) ; for ( int i = 0 ; i < n ; i ++ ) { ans *= ( int ) Math . Pow ( a [ i ] , val ) ; } return ans ; } public static void Main ( ) { int n = 2 ; int [ ] a = { 3 , 7 } ; Console . WriteLine ( product ( a , n ) ) ; } }

Index/key variables: i
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void findPair ( int [ ] arr , int n ) { if ( n < 2 ) { Console . Write ( " - 1" ) ; return ; } int i , first , second ; first = second = - 1 ; for ( i = 0 ; i < n ; i ++ ) { if ( arr [ i ] > first ) { second = first ; first = arr [ i ] ; } else if ( arr [ i ] > second ) { second = arr [ i ] ; } } Console . WriteLine ( " n ▁ = ▁ " + first + " ▁ and ▁ r ▁ = ▁ " + second ) ; } public static void Main ( ) { int [ ] arr = { 0 , 2 , 3 , 4 , 1 , 6 , 8 , 9 } ; int n = arr . Length ; findPair ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int sum ( int [ ] arr , int n ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum += arr [ i ] ; } sum = sum * ( int ) Math . Pow ( 2 , n - 1 ) ; return sum ; } public static void Main ( ) { int [ ] arr = { 2 , 1 , 5 , 6 } ; int n = arr . Length ; Console . WriteLine ( sum ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void triangle ( int n ) { int k = 2 * n - 2 ; int ch = 1 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < k ; j ++ ) Console . Write ( " ▁ " ) ; k = k - 1 ; for ( int j = 0 ; j <= i ; j ++ ) { Console . Write ( ch ++ + " ▁ " ) ; } Console . WriteLine ( ) ; } } static int maxHeight ( int n ) { return ( ( ( int ) Math . Sqrt ( 1 + 8.0 * n ) ) - 1 ) / 2 ; } public static void Main ( String [ ] args ) { int N = 9 ; triangle ( maxHeight ( N ) ) ; } }

Accumulator variables: ch, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int ways ( int n ) { return n / 2 ; } public static void Main ( ) { int n = 2 ; Console . WriteLine ( ways ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int no_of_ways ( int [ ] a , int n ) { int count_0 = 0 , count_1 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] == 0 ) count_0 ++ ; else count_1 ++ ; } if ( count_1 % 2 == 0 ) return count_0 ; else return count_1 ; } public static void Main ( ) { int n = 4 ; int [ ] a1 = { 1 , 1 , 0 , 0 } ; Console . WriteLine ( no_of_ways ( a1 , n ) ) ; n = 5 ; int [ ] a2 = { 1 , 1 , 1 , 0 , 0 } ; Console . WriteLine ( no_of_ways ( a2 , n ) ) ; n = 5 ; int [ ] a3 = { 1 , 1 , 0 , 0 , 0 } ; Console . WriteLine ( no_of_ways ( a3 , n ) ) ; n = 6 ; int [ ] a4 = { 1 , 1 , 1 , 0 , 0 , 0 } ; Console . WriteLine ( no_of_ways ( a4 , n ) ) ; } }

Index/key variables: i
Accumulator variables: count_0, count_1, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int prevPowerof2 ( int n ) { int p = ( int ) ( Math . Log ( n ) / Math . Log ( 2 ) ) ; return ( int ) Math . Pow ( 2 , p ) ; } static int nextPowerOf2 ( int n ) { int p = 1 ; if ( ( n == 0 ) && ! ( ( n & ( n - 1 ) ) == 0 ) ) return n ; while ( p < n ) p <<= 1 ; return p ; } static int minDiff ( int n ) { int low = prevPowerof2 ( n ) ; int high = nextPowerOf2 ( n ) ; return Math . Min ( n - low , high - n ) ; } public static void Main ( String [ ] args ) { int n = 6 ; Console . WriteLine ( minDiff ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static String maxInt ( char [ ] str ) { for ( int i = 0 ; i < str . Length ; i ++ ) { if ( str [ i ] < '5' ) { str [ i ] = ( char ) ( ( '9' - str [ i ] ) + '0' ) ; } } if ( str [ 0 ] == '0' ) str [ 0 ] = '9' ; String str2 = new String ( str ) ; return str2 ; } public static void Main ( String [ ] args ) { String str = "42" ; Console . WriteLine ( maxInt ( str . ToCharArray ( ) ) ) ; } }

Index/key variables: i
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 void FindRatio ( int a , int b , int c ) { int up = Math . Abs ( b - c ) ; int down = Math . Abs ( c - a ) ; int g = gcd ( up , down ) ; up /= g ; down /= g ; Console . WriteLine ( up + " : " + down ) ; } public static void Main ( String [ ] args ) { int a = 4 , b = 10 , c = 6 ; FindRatio ( a , b , c ) ; } }

Accumulator variables: down, up
Class/struct names: GFG
C# program:
using System ; class GFG { static int longest_gap ( int N ) { int distance = 0 , count = 0 , first_1 = - 1 , last_1 = - 1 ; while ( N != 0 ) { count ++ ; int r = N & 1 ; if ( r == 1 ) { first_1 = first_1 == - 1 ? count : first_1 ; last_1 = count ; } N = N / 2 ; } if ( last_1 <= first_1 ) { return - 1 ; } else { distance = ( last_1 - first_1 - 1 ) ; return distance ; } } public static void Main ( String [ ] args ) { int N = 131 ; Console . WriteLine ( longest_gap ( N ) ) ; N = 8 ; Console . WriteLine ( longest_gap ( N ) ) ; N = 17 ; Console . WriteLine ( longest_gap ( N ) ) ; N = 33 ; Console . WriteLine ( longest_gap ( N ) ) ; } }

Accumulator variables: count
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPossible ( int x , int y , int k ) { int minMoves = Math . Abs ( x ) + Math . Abs ( y ) ; if ( k >= minMoves && ( k - minMoves ) % 2 == 0 ) return true ; return false ; } public static void Main ( ) { int x = 5 , y = 8 , k = 20 ; if ( isPossible ( x , y , k ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX = 10 ; static bool isFactorion ( int n ) { int [ ] fact = new int [ MAX ] ; fact [ 0 ] = 1 ; for ( int i = 1 ; i < MAX ; i ++ ) fact [ i ] = i * fact [ i - 1 ] ; int org = n ; int sum = 0 ; while ( n > 0 ) { int d = n % 10 ; sum += fact [ d ] ; n /= 10 ; } if ( sum == org ) return true ; return false ; } public static void Main ( String [ ] args ) { int n = 40585 ; if ( isFactorion ( n ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Index/key variables: MAX, d, i
Accumulator variables: i, n, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int TOTAL_BITS = 32 ; static int CountBits ( int value ) { int count = 0 ; while ( value != 0 ) { count ++ ; value &= value - 1 ; } return count ; } static bool isPossible ( int n ) { int cnt = CountBits ( n ) ; if ( cnt == TOTAL_BITS / 2 ) return true ; return false ; } public static void Main ( String [ ] arr ) { int n = 524280 ; if ( isPossible ( n ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Accumulator variables: count, value
Class/struct names: GFG
C# program:
using System ; class GFG { static int TEN = 10 ; static void updateFreq ( int n , int [ ] freq ) { while ( n > 0 ) { int digit = n % TEN ; freq [ digit ] ++ ; n /= TEN ; } } static bool areAnagrams ( int a , int b ) { int [ ] freqA = new int [ TEN ] ; int [ ] freqB = new int [ TEN ] ; ; updateFreq ( a , freqA ) ; updateFreq ( b , freqB ) ; for ( int i = 0 ; i < TEN ; i ++ ) { if ( freqA [ i ] != freqB [ i ] ) return false ; } return true ; } public static void Main ( ) { int a = 204 , b = 240 ; if ( areAnagrams ( a , b ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

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

Class/struct names: GFG
C# program:
using System ; class GFG { static bool isDivisible ( int [ ] arr , int n ) { int lastDigit = arr [ n - 1 ] % 10 ; if ( lastDigit == 0 ) return true ; return false ; } static public void Main ( String [ ] arg ) { int [ ] arr = { 12 , 65 , 46 , 37 , 99 } ; int n = arr . Length ; if ( isDivisible ( arr , n ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static long gcd ( long a , long b ) { if ( a == 0 ) return b ; return gcd ( b % a , a ) ; } static long divTermCount ( long a , long b , long c , long num ) { return ( ( num / a ) + ( num / b ) + ( num / c ) - ( num / ( ( a * b ) / gcd ( a , b ) ) ) - ( num / ( ( c * b ) / gcd ( c , b ) ) ) - ( num / ( ( a * c ) / gcd ( a , c ) ) ) + ( num / ( ( a * b * c ) / gcd ( gcd ( a , b ) , c ) ) ) ) ; } static public void Main ( String [ ] arr ) { long a = 7 , b = 3 , c = 5 , n = 100 ; Console . WriteLine ( divTermCount ( a , b , c , n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static List < long > getArray ( int n ) { List < long > ans = new List < long > ( ) ; long p2 = 1 ; while ( n > 0 ) { if ( n % 2 == 1 ) ans . Add ( p2 ) ; n >>= 1 ; p2 *= 2 ; } return ans ; } public static void Main ( String [ ] args ) { int n = 15 ; List < long > ans = getArray ( n ) ; foreach ( long i in ans ) Console . Write ( i + " ▁ " ) ; } }

Accumulator variables: p2
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int M = 3 ; static int N = 2 ; static void getIndex ( int n , int [ , ] shuffle ) { for ( int i = 0 ; i < 3 ; i ++ ) { if ( shuffle [ i , 0 ] == n ) n = shuffle [ i , 1 ] ; else if ( shuffle [ i , 1 ] == n ) n = shuffle [ i , 0 ] ; } Console . WriteLine ( n ) ; } public static void Main ( String [ ] args ) { int n = 3 ; int [ , ] shuffle = { { 3 , 1 } , { 2 , 1 } , { 1 , 2 } } ; getIndex ( n , shuffle ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { static long fact ( int n ) { long res = 1 ; for ( int i = 2 ; i <= n ; i ++ ) res = res * i ; return res ; } static long nCr ( int n , int r ) { return fact ( n ) / ( 1 * fact ( r ) * fact ( n - r ) ) ; } static long number_of_subsequences ( int [ ] arr , int k , int n ) { long s = 0 ; Dictionary < int , int > mp = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( mp . ContainsKey ( arr [ i ] ) ) { var val = mp [ arr [ i ] ] ; mp . Remove ( arr [ i ] ) ; mp . Add ( arr [ i ] , val + 1 ) ; } else { mp . Add ( arr [ i ] , 1 ) ; } } foreach ( KeyValuePair < int , int > j in mp ) { s = s + 1 * nCr ( j . Value , k ) ; } return s ; } static public void Main ( String [ ] arg ) { int [ ] arr = { 1 , 1 , 1 , 1 , 2 , 2 , 2 } ; int k = 2 ; int n = arr . Length ; Console . Write ( number_of_subsequences ( arr , k , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int sumPairs ( int [ ] arr , int n ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum = sum + ( arr [ i ] * ( 2 * n ) ) ; } return sum ; } static public void Main ( String [ ] arg ) { int [ ] arr = { 1 , 2 , 3 } ; int n = arr . Length ; Console . WriteLine ( sumPairs ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int minSum ( int [ ] arr , int n ) { int sum = 0 ; Array . Sort ( arr ) ; Array . Reverse ( arr ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( i % 4 < 2 ) sum = sum + arr [ i ] ; } return sum ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 1 , 10 , 2 , 2 , 2 , 1 } ; int n = arr . Length ; Console . WriteLine ( minSum ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static long countTriplets ( int A , int B , int C ) { long ans = 0 ; for ( int i = 1 ; i <= A ; i ++ ) { for ( int j = 1 ; j <= B ; j ++ ) { for ( int k = 1 ; k <= C ; k ++ ) { if ( i * k > j * j ) ans ++ ; } } } return ans ; } public static void Main ( String [ ] args ) { int A = 3 , B = 2 , C = 2 ; Console . WriteLine ( countTriplets ( A , B , C ) ) ; } }

Accumulator variables: ans, i, j, k
Iterator variables: i, j, k
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static long getCount ( int A , int B2 , int C ) { long count = 0 ; for ( int i = 1 ; i <= A ; i ++ ) { long j = ( B2 / i ) + 1 ; if ( C >= j ) count = ( count + C - j + 1 ) ; if ( A >= j && C >= i ) count = ( count + ( C - i + 1 ) * ( A - j + 1 ) ) ; if ( A >= j ) A = ( int ) ( j - 1 ) ; } return count ; } static long countTriplets ( int A , int B , int C ) { long ans = 0 ; for ( int i = 1 ; i <= B ; i ++ ) { ans = ( ans + getCount ( A , i * i , C ) ) ; } return ans ; } public static void Main ( String [ ] args ) { int A , B , C ; A = 3 ; B = 2 ; C = 2 ; Console . WriteLine ( countTriplets ( A , B , C ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static double getSum ( int n ) { double sum = 0 ; int k = ( int ) Math . Sqrt ( n ) ; for ( int i = 1 ; i <= k ; i ++ ) { sum += Math . Floor ( ( double ) n / i ) ; } sum *= 2 ; sum -= Math . Pow ( k , 2 ) ; return sum ; } public static void Main ( String [ ] args ) { int n = 5 ; Console . WriteLine ( getSum ( n ) ) ; } }

Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int distinctRemainders ( int n ) { if ( n % 2 == 0 ) return ( n / 2 ) ; return ( 1 + ( n / 2 ) ) ; } public static void Main ( ) { int n = 5 ; Console . WriteLine ( distinctRemainders ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int countUnsetBits ( int n ) { int cnt = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { int temp = i ; while ( temp > 0 ) { if ( temp % 2 == 0 ) cnt = cnt + 1 ; temp = temp / 2 ; } } return cnt ; } public static void Main ( ) { int n = 5 ; Console . Write ( countUnsetBits ( n ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections ; class GFG { static bool graphExists ( ArrayList a , int n ) { while ( true ) { a . Sort ( ) ; a . Reverse ( ) ; if ( ( int ) a [ 0 ] == 0 ) return true ; int v = ( int ) a [ 0 ] ; a . Remove ( a [ 0 ] ) ; if ( v > a . Count ) return false ; for ( int i = 0 ; i < v ; i ++ ) { a [ i ] = ( int ) a [ i ] - 1 ; if ( ( int ) a [ i ] < 0 ) return false ; } } } public static void Main ( string [ ] args ) { ArrayList a = new ArrayList ( ) { 3 , 3 , 3 , 3 } ; int n = a . Count ; if ( graphExists ( a , n ) ) { Console . Write ( " Yes " ) ; } else { Console . Write ( " NO " ) ; } } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int negProdSubArr ( int [ ] arr , int n ) { int positive = 1 , negative = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] > 0 ) arr [ i ] = 1 ; else arr [ i ] = - 1 ; if ( i > 0 ) arr [ i ] *= arr [ i - 1 ] ; if ( arr [ i ] == 1 ) positive ++ ; else negative ++ ; } return ( positive * negative ) ; } static public void Main ( ) { int [ ] arr = { 5 , - 4 , - 3 , 2 , - 5 } ; int n = arr . Length ; Console . Write ( negProdSubArr ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, negative, positive
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int sum ( int n ) { int sum = ( n * ( n + 1 ) ) / 2 ; return sum ; } static int repeatedSum ( int n , int k ) { for ( int i = 0 ; i < k ; i ++ ) { n = sum ( n ) ; } return n ; } public static void Main ( String [ ] args ) { int n = 2 , k = 2 ; Console . WriteLine ( repeatedSum ( n , k ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int difference ( int n ) { int S , res ; S = ( n * ( n + 1 ) ) / 2 ; res = S * ( S - 1 ) ; return res ; } static public void Main ( ) { int n = 5 ; Console . Write ( difference ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool isDivisible ( long n ) { long temp = n ; int sum = 0 ; while ( n != 0 ) { int digit = ( int ) n % 10 ; sum += digit ; n /= 10 ; } n = temp ; while ( n != 0 ) { int digit = ( int ) n % 10 ; if ( sum % digit != 0 ) return false ; n /= 10 ; } return true ; } static public void Main ( ) { long n = 123 ; if ( isDivisible ( n ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Accumulator variables: n, sum
Class/struct names: GFG
C# program:
using System ; class GFG { static int N = 100005 ; static int [ ] lpf = new int [ N ] ; static void least_prime_factor ( ) { for ( int i = 2 ; i < N ; i ++ ) if ( lpf [ i ] % 2 != 1 ) for ( int j = i ; j < N ; j += i ) if ( lpf [ j ] % 2 != 0 ) lpf [ j ] = i ; } static void Mobius ( int n ) { int [ ] mobius = new int [ N ] ; 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 ] ] ; } } for ( int i = 1 ; i <= n ; i ++ ) Console . Write ( mobius [ i ] + " ▁ " ) ; } static public void Main ( ) { int n = 5 ; Array . Fill ( lpf , - 1 ) ; least_prime_factor ( ) ; Mobius ( n ) ; } }

Index/key variables: N, i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int DIGITS = 4 , MIN = 1000 , MAX = 9999 ; static int getBest ( int prev , int cur ) { int maximum = Math . Max ( MIN , prev ) ; for ( int i = maximum ; i <= MAX ; i ++ ) { int cnt = 0 ; int a = i ; int b = cur ; for ( int k = 0 ; k < DIGITS ; k ++ ) { if ( a % 10 != b % 10 ) cnt += 1 ; a /= 10 ; b /= 10 ; } if ( cnt <= 1 ) return i ; } return - 1 ; } static void getList ( int [ ] arr , int n ) { List < int > myList = new List < int > ( ) ; int i , cur ; bool possible = true ; myList . Add ( 0 ) ; for ( i = 0 ; i < n ; i ++ ) { cur = arr [ i ] ; myList . Add ( getBest ( myList [ myList . Count - 1 ] , cur ) ) ; if ( myList [ myList . Count - 1 ] == - 1 ) { possible = false ; break ; } } if ( possible ) { for ( i = 1 ; i < myList . Count ; i ++ ) Console . Write ( myList [ i ] + " ▁ " ) ; } else Console . Write ( " - 1" ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1095 , 1094 , 1095 } ; int n = arr . Length ; getList ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: a, b, cnt, i, k
Iterator variables: i, k
Boolean variables: possible
Class/struct names: GFG
C# program:
using System ; class GFG { static int COST = 3 ; static int maxItems ( int x , int y , int z ) { int type1 = x / COST ; x %= COST ; int type2 = y / COST ; y %= COST ; int type3 = z / COST ; z %= COST ; int type4 = Math . Min ( x , Math . Min ( y , z ) ) ; int maxItems = type1 + type2 + type3 + type4 ; return maxItems ; } static public void Main ( ) { int x = 4 , y = 5 , z = 6 ; Console . Write ( maxItems ( x , y , z ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int countFactors ( int n , int p ) { int pwr = 0 ; while ( n > 0 && n % p == 0 ) { n /= p ; pwr ++ ; } return pwr ; } static int getCount ( int l , int r , int p ) { int cnt = 0 ; for ( int i = l ; i <= r ; i ++ ) { cnt += countFactors ( i , p ) ; } return cnt ; } public static void Main ( String [ ] args ) { int l = 2 , r = 8 , p = 2 ; Console . WriteLine ( getCount ( l , r , p ) ) ; } }

Accumulator variables: cnt, i, n, pwr
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int getCount ( int l , int r , int p ) { int cnt = 0 ; int val = p ; while ( true ) { int a = r / val ; int b = ( l - 1 ) / val ; val *= p ; if ( ( a - b ) > 0 ) { cnt += ( a - b ) ; } else break ; } return cnt ; } public static void Main ( String [ ] args ) { int l = 2 , r = 8 , p = 2 ; Console . WriteLine ( getCount ( l , r , p ) ) ; } }

Accumulator variables: cnt, val
Class/struct names: GFG
C# program:
using System ; class GFG { static bool topsyTurvy ( char [ ] str ) { for ( int i = 0 ; i < str . Length ; i ++ ) { if ( str [ i ] == '2' str [ i ] == '4' str [ i ] == '5' str [ i ] == '6' str [ i ] == '7' str [ i ] == '9' ) { return false ; } } return true ; } public static void Main ( String [ ] args ) { String str = "1234" ; if ( topsyTurvy ( str . ToCharArray ( ) ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

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