dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static int MAX = 10 ; static bool distinctDigits ( int x ) { bool [ ] present = new bool [ MAX ] ; while ( x > 0 ) { int digit = x % 10 ; if ( present [ digit ] ) return false ; present [ digit ] = true ; x /= 10 ; } return true ; } static int findK ( int l , int r ) { int maxExp = int . MinValue ; int k = - 1 ; for ( int i = l ; i <= r ; i ++ ) { if ( distinctDigits ( i ) ) { int exp = ( l - i ) * ( i - r ) ; if ( exp >= maxExp ) { k = i ; maxExp = exp ; } } } return k ; } public static void Main ( String [ ] args ) { int l = 50 , r = 60 ; Console . Write ( findK ( l , r ) ) ; } }

Index/key variables: MAX, digit
Accumulator variables: i, x
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void findPerm ( int [ ] Q , int n ) { int minval = 0 , qsum = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { qsum += Q [ i ] ; if ( qsum < minval ) minval = qsum ; } int [ ] P = new int [ n ] ; P [ 0 ] = 1 - minval ; bool permFound = true ; for ( int i = 0 ; i < n - 1 ; i ++ ) { P [ i + 1 ] = P [ i ] + Q [ i ] ; if ( P [ i + 1 ] > n P [ i + 1 ] < 1 ) { permFound = false ; break ; } } if ( permFound ) { for ( int i = 0 ; i < n ; i ++ ) { Console . Write ( P [ i ] + " ▁ " ) ; } } else { Console . Write ( - 1 ) ; } } public static void Main ( String [ ] args ) { int [ ] Q = { - 2 , 1 } ; int n = 1 + Q . Length ; findPerm ( Q , n ) ; } }

Index/key variables: i, n
Accumulator variables: i, qsum
Iterator variables: i
Boolean variables: permFound
Class/struct names: GFG
C# program:
using System ; class GFG { static void findWinner ( int n ) { if ( ( n - 1 ) % 6 == 0 ) { Console . WriteLine ( " Second ▁ Player ▁ wins ▁ the ▁ game " ) ; } else { Console . WriteLine ( " First ▁ Player ▁ wins ▁ the ▁ game " ) ; } } public static void Main ( ) { int n = 7 ; findWinner ( n ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static readonly int N = 100005 ; static readonly int mod = ( int ) ( 1e9 + 7 ) ; static long [ ] factorial = new long [ N ] ; static long [ ] modinverse = new long [ N ] ; static long power ( long a , int m1 ) { if ( m1 == 0 ) return 1 ; else if ( m1 == 1 ) return a ; else if ( m1 == 2 ) return ( 1L * a * a ) % mod ; else if ( m1 % 2 == 1 ) return ( 1L * a * power ( power ( a , m1 / 2 ) , 2 ) ) % mod ; else return power ( power ( a , m1 / 2 ) , 2 ) % mod ; } static void factorialfun ( ) { factorial [ 0 ] = 1 ; for ( int i = 1 ; i < N ; i ++ ) factorial [ i ] = ( 1L * factorial [ i - 1 ] * i ) % mod ; } static void modinversefun ( ) { modinverse [ N - 1 ] = ( int ) ( power ( factorial [ N - 1 ] , mod - 2 ) % mod ) ; for ( int i = N - 2 ; i >= 0 ; i -- ) modinverse [ i ] = ( 1 * modinverse [ i + 1 ] * ( i + 1 ) ) % mod ; } static long binomial ( int n , int r ) { if ( r > n ) return 0 ; long a = ( 1L * factorial [ n ] * modinverse [ n - r ] ) % mod ; a = ( 1 * a * modinverse [ r ] ) % mod ; return a ; } static void arrange_balls ( int n , int k ) { factorialfun ( ) ; modinversefun ( ) ; for ( int i = 1 ; i <= k ; i ++ ) Console . Write ( ( 1L * binomial ( n - k + 1 , i ) * binomial ( k - 1 , i - 1 ) ) % mod + " ▁ " ) ; } public static void Main ( String [ ] args ) { int n = 5 , k = 3 ; arrange_balls ( n , k ) ; } }

Index/key variables: N, i, n, r
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int min_changes ( int [ ] a , int n ) { int ans_a = 0 , ans_b = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( i % 2 == 0 ) { if ( a [ i ] == 0 ) ans_a ++ ; else ans_b ++ ; } else { if ( a [ i ] == 0 ) ans_b ++ ; else ans_a ++ ; } } return Math . Min ( ans_a , ans_b ) ; } public static void Main ( String [ ] args ) { int [ ] a = { 1 , 0 , 0 , 1 , 0 , 0 , 1 , 0 } ; int n = a . Length ; Console . WriteLine ( min_changes ( a , n ) ) ; } }

Index/key variables: i
Accumulator variables: ans_a, ans_b, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void ans ( int n ) { if ( n == 1 ) Console . WriteLine ( "1" ) ; else Console . WriteLine ( "0" ) ; } public static void Main ( String [ ] args ) { int n = 2 ; ans ( n ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPossible ( int w , int h , int x , int y ) { if ( x * 2 == w && y * 2 == h ) return true ; return false ; } static public void Main ( ) { int w = 1 , h = 2 , x = 1 , y = 2 ; if ( isPossible ( w , h , x , y ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static String minNum ( char [ ] num , int k ) { int len = num . Length ; if ( len == 0 k == 0 ) { return String . Join ( " " , num ) ; } if ( len == 1 ) return "0" ; if ( num [ 0 ] != '1' ) { num [ 0 ] = '1' ; k -- ; } int i = 1 ; while ( k > 0 && i < len ) { if ( num [ i ] != '0' ) { num [ i ] = '0' ; k -- ; } i ++ ; } return String . Join ( " " , num ) ; } public static void Main ( String [ ] args ) { String num = "91945" ; int k = 3 ; Console . WriteLine ( minNum ( num . ToCharArray ( ) , k ) ) ; } }

Index/key variables: i
Accumulator variables: i, k
Class/struct names: GFG
C# program:
using System ; class GFG { static int minsteps ( int n , int m ) { if ( m > n ) { return - 1 ; } else { return ( ( n + 1 ) / 2 + m - 1 ) / m * m ; } } public static void Main ( String [ ] args ) { int n = 17 , m = 4 ; int ans = minsteps ( n , m ) ; Console . WriteLine ( ans ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { public class Node { public int data ; public Node next ; } ; static Node removeLeadingZeros ( Node a ) { if ( a != null && a . data == 0 ) return removeLeadingZeros ( a . next ) ; else return a ; } static int getSize ( Node a ) { int sz = 0 ; while ( a != null ) { a = a . next ; sz ++ ; } return sz ; } static Node push ( Node head_ref , int new_data ) { Node new_node = new Node ( ) ; new_node . data = new_data ; new_node . next = head_ref ; head_ref = new_node ; return head_ref ; } static int compare ( Node a , Node b ) { a = removeLeadingZeros ( a ) ; b = removeLeadingZeros ( b ) ; int lenA = getSize ( a ) ; int lenB = getSize ( b ) ; if ( lenA > lenB ) { return 1 ; } else if ( lenB > lenA ) { return - 1 ; } while ( a != null && b != null ) { if ( a . data > b . data ) return 1 ; else if ( a . data < b . data ) return - 1 ; a = a . next ; b = b . next ; } return 0 ; } public static void Main ( String [ ] args ) { Node a = null ; a = push ( a , 7 ) ; a = push ( a , 6 ) ; a = push ( a , 5 ) ; Node b = null ; b = push ( b , 3 ) ; b = push ( b , 3 ) ; b = push ( b , 2 ) ; Console . WriteLine ( compare ( a , b ) ) ; } }

Accumulator variables: sz
Class/struct names: GFG, Node
C# program:
using System ; class GFG { static int sumArr ( int [ ] arr , int n ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum += arr [ i ] ; return sum ; } static int sumModArr ( int [ ] arr , int n ) { for ( int i = 0 ; i < n - 1 ; i ++ ) { int subSum = 0 ; for ( int j = i + 1 ; j < n ; j ++ ) { subSum += arr [ j ] ; } arr [ i ] -= subSum ; } return sumArr ( arr , n ) ; } public static void Main ( ) { int [ ] arr = { 40 , 25 , 12 , 10 } ; int n = arr . Length ; Console . WriteLine ( sumModArr ( arr , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, subSum, sum
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int minHealth ( int [ ] health , int n ) { int gcd = 0 ; for ( int i = 0 ; i < n ; i ++ ) { gcd = __gcd ( gcd , health [ i ] ) ; } return gcd ; } static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } public static void Main ( String [ ] args ) { int [ ] health = { 5 , 6 , 1 , 2 , 3 , 4 } ; int n = health . Length ; Console . WriteLine ( minHealth ( health , n ) ) ; } }

Index/key variables: i
Accumulator variables: 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 constructArr ( int [ ] pair , int n ) { int size = ( 1 + ( int ) Math . Sqrt ( 1 + 8 * n ) ) / 2 ; int [ ] arr = new int [ size ] ; arr [ 0 ] = ( int ) Math . Sqrt ( ( pair [ 0 ] * pair [ 1 ] ) / pair [ size - 1 ] ) ; for ( int i = 1 ; i < size ; i ++ ) arr [ i ] = pair [ i - 1 ] / arr [ 0 ] ; printArr ( arr , size ) ; } public static void Main ( String [ ] args ) { int [ ] pair = { 48 , 18 , 24 , 24 , 32 , 12 } ; int n = pair . Length ; constructArr ( pair , n ) ; } }

Index/key variables: i, size
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void findPairs ( int [ ] arr , int n ) { int cntEven = 0 , cntOdd = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] % 2 == 0 ) cntEven ++ ; else cntOdd ++ ; } int evenPairs = 0 ; evenPairs += ( ( cntEven * ( cntEven - 1 ) ) / 2 ) ; evenPairs += ( ( cntOdd * ( cntOdd - 1 ) ) / 2 ) ; int oddPairs = 0 ; oddPairs += ( cntEven * cntOdd ) ; Console . WriteLine ( " Odd ▁ pairs ▁ = ▁ " + oddPairs ) ; Console . WriteLine ( " Even ▁ pairs ▁ = ▁ " + evenPairs ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 4 , 5 } ; int n = arr . Length ; findPairs ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: cntEven, cntOdd, evenPairs, i, oddPairs
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int MOD = 1000000007 ; static int factMod ( int n ) { int fact = 1 ; for ( int i = 2 ; i <= n ; i ++ ) { fact *= ( i % MOD ) ; fact %= MOD ; } return fact ; } static int countWays ( int n , int m ) { return factMod ( m ) ; } public static void Main ( ) { int n = 2 , m = 2 ; Console . Write ( countWays ( n , m ) ) ; } }

Accumulator variables: fact, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int binomialCoeff ( int n , int k ) { int res = 1 ; if ( k > n - k ) k = n - k ; for ( int i = 0 ; i < k ; ++ i ) { res *= ( n - i ) ; res /= ( i + 1 ) ; } return res ; } static int Fuss_catalan ( int n ) { int c = binomialCoeff ( 3 * n , n ) ; return c / ( 2 * n + 1 ) ; } public static void Main ( String [ ] args ) { for ( int i = 0 ; i < 10 ; i ++ ) Console . Write ( Fuss_catalan ( i ) + " ▁ " ) ; } }

Accumulator variables: i, res
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isComposite ( int n ) { for ( int i = 2 ; i <= Math . Sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) return true ; } return false ; } static int Power ( int x , int y , int p ) { int res = 1 ; x = x % p ; while ( y > 0 ) { if ( y % 2 == 1 ) { res = ( res * x ) % p ; } x = ( x * x ) % p ; } return res ; } static bool isEulerPseudoprime ( int N , int A ) { if ( A <= 0 ) return false ; if ( N % 2 == 0 || ! isComposite ( N ) ) return false ; if ( __gcd ( A , N ) != 1 ) return false ; int mod = Power ( A , ( N - 1 ) / 2 , N ) ; if ( mod != 1 && mod != N - 1 ) return false ; return true ; } static int __gcd ( int a , int b ) { if ( b == 0 ) return a ; return __gcd ( b , a % b ) ; } public static void Main ( String [ ] args ) { int N = 121 , A = 3 ; if ( isEulerPseudoprime ( N , A ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int sz = ( int ) 1e5 ; static Boolean [ ] isPrime = new Boolean [ sz + 1 ] ; static void sieve ( ) { for ( int i = 2 ; i < sz + 1 ; i ++ ) isPrime [ i ] = true ; for ( int i = 2 ; i * i <= sz ; i ++ ) { if ( isPrime [ i ] ) { for ( int j = i * i ; j < sz ; j += i ) { isPrime [ j ] = false ; } } } } static int minDifference ( int L , int R ) { int fst = 0 ; for ( int i = L ; i <= R ; i ++ ) { if ( isPrime [ i ] ) { fst = i ; break ; } } int snd = 0 ; for ( int i = fst + 1 ; i <= R ; i ++ ) { if ( isPrime [ i ] ) { snd = i ; break ; } } if ( snd == 0 ) return - 1 ; int diff = snd - fst ; int left = snd + 1 ; int right = R ; for ( int i = left ; i <= right ; i ++ ) { if ( isPrime [ i ] ) { if ( i - snd <= diff ) { fst = snd ; snd = i ; diff = snd - fst ; } } } return diff ; } public static void Main ( String [ ] args ) { sieve ( ) ; int L = 21 , R = 50 ; Console . WriteLine ( minDifference ( L , R ) ) ; } }

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 findCnt ( int [ ] arr , int n , int k ) { int ret = 0 ; int i = 0 ; while ( i < n ) { int j = i + 1 ; while ( j < n && arr [ j ] >= arr [ j - 1 ] ) j ++ ; int x = Math . Max ( 0 , j - i - k + 1 ) ; ret += ( x * ( x + 1 ) ) / 2 ; i = j ; } return ret ; } public static void Main ( String [ ] args ) { int [ ] arr = { 5 , 4 , 3 , 2 , 1 } ; int n = arr . Length ; int k = 2 ; Console . WriteLine ( findCnt ( arr , n , k ) ) ; } }

Index/key variables: j
Accumulator variables: j, ret
Class/struct names: GFG
C# program:
using System ; class GFG { static int countElements ( int [ ] p , int n ) { int ans = 0 ; for ( int i = 1 ; i < n - 1 ; i ++ ) { if ( p [ i - 1 ] > p [ i ] && p [ i ] > p [ i + 1 ] ) ans ++ ; else if ( p [ i - 1 ] < p [ i ] && p [ i ] < p [ i + 1 ] ) ans ++ ; } return ans ; } public static void Main ( String [ ] args ) { int [ ] p = { 2 , 5 , 1 , 3 , 4 } ; int n = p . Length ; Console . WriteLine ( countElements ( p , n ) ) ; } }

Index/key variables: i
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int countNums ( int a , int b , int c , int d ) { int x = b / c - ( a - 1 ) / c ; int y = b / d - ( a - 1 ) / d ; int k = ( c * d ) / __gcd ( c , d ) ; int z = b / k - ( a - 1 ) / k ; return b - a + 1 - x - y + z ; } static int __gcd ( int a , int b ) { if ( b == 0 ) return a ; return __gcd ( b , a % b ) ; } public static void Main ( String [ ] args ) { int a = 10 , b = 50 , c = 4 , d = 6 ; Console . WriteLine ( countNums ( a , b , c , d ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int cntSubArrays ( int [ ] arr , int n , int k ) { int res = 0 ; int i = 0 ; while ( i < n ) { int j = i + 1 ; while ( j < n && arr [ j ] >= arr [ j - 1 ] ) j ++ ; res += Math . Max ( j - i - k + 1 , 0 ) ; i = j ; } return res ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 2 , 5 } ; int n = arr . Length ; int k = 2 ; Console . WriteLine ( cntSubArrays ( arr , n , k ) ) ; } }

Index/key variables: j
Accumulator variables: j, res
Class/struct names: GFG
C# program:
using System ; class GFG { static void last_digit ( int X , int Y ) { Console . Write ( X % Y ) ; } public static void Main ( String [ ] args ) { int X = 55 , Y = 3 ; last_digit ( X , Y ) ; } }

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

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

Class/struct names: GFG
C# program:
using System ; class GFG { static int two_sets ( int [ ] a , int n ) { Array . Sort ( a ) ; return a [ n / 2 ] - a [ ( n / 2 ) - 1 ] ; } public static void Main ( String [ ] args ) { int [ ] a = { 1 , 4 , 4 , 6 , 7 , 9 } ; int n = a . Length ; Console . WriteLine ( two_sets ( a , n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int cntPairs ( int [ ] a , int n ) { int odd = 0 , even = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] % 2 == 1 ) odd ++ ; else if ( ( a [ i ] / 2 ) % 2 == 1 ) even ++ ; } int ans = odd * even + ( odd * ( odd - 1 ) ) / 2 ; return ans ; } public static void Main ( String [ ] args ) { int [ ] a = { 4 , 2 , 7 , 11 , 14 , 15 , 18 } ; int n = a . Length ; Console . WriteLine ( cntPairs ( a , n ) ) ; } }

Index/key variables: i
Accumulator variables: even, i, odd
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static Boolean isPossible ( int [ ] a , int n ) { int cur = a [ 0 ] ; cur -- ; for ( int i = 1 ; i < n ; i ++ ) { int nxt = a [ i ] ; if ( nxt > cur ) nxt -- ; else if ( nxt < cur ) return false ; cur = nxt ; } return true ; } public static void Main ( String [ ] args ) { int [ ] a = { 1 , 2 , 1 , 2 , 3 } ; int n = a . Length ; if ( isPossible ( a , n ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Index/key variables: i
Accumulator variables: cur, i, nxt
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void max_element ( int [ ] a , int n ) { int [ ] pre = new int [ n ] ; pre [ 0 ] = a [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) pre [ i ] = Math . Max ( pre [ i - 1 ] , a [ i ] ) ; int [ ] suf = new int [ n ] ; suf [ n - 1 ] = a [ n - 1 ] ; for ( int i = n - 2 ; i >= 0 ; i -- ) suf [ i ] = Math . Max ( suf [ i + 1 ] , a [ i ] ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( i == 0 ) Console . Write ( suf [ i + 1 ] + " ▁ " ) ; else if ( i == n - 1 ) Console . Write ( pre [ i - 1 ] + " ▁ " ) ; else Console . Write ( Math . Max ( pre [ i - 1 ] , suf [ i + 1 ] ) + " ▁ " ) ; } } public static void Main ( String [ ] args ) { int [ ] a = { 2 , 5 , 6 , 1 , 3 } ; int n = a . Length ; max_element ( 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 kthNum ( int n , int k ) { int a = ( n + 1 ) / 2 ; if ( k > a ) return ( 2 * ( k - a ) ) ; return ( 2 * k - 1 ) ; } public static void Main ( String [ ] args ) { int n = 7 , k = 7 ; Console . WriteLine ( kthNum ( n , k ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int find_k ( int a , int b ) { if ( ( a + b ) % 2 == 0 ) return ( ( a + b ) / 2 ) ; return - 1 ; } public static void Main ( ) { int a = 2 , b = 16 ; Console . Write ( find_k ( a , b ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static Boolean isPossible ( int [ ] a , int n ) { int k = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] != i + 1 ) k ++ ; } if ( k <= 2 ) return true ; return false ; } public static void Main ( String [ ] args ) { int [ ] a = { 5 , 2 , 3 , 4 , 1 } ; int n = a . Length ; if ( isPossible ( a , n ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Index/key variables: i
Accumulator variables: i, k
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int odd_digits ( int n ) { if ( n < 10 ) return n ; else if ( n / 10 < 10 ) return 9 ; else if ( n / 100 < 10 ) return 9 + n - 99 ; else if ( n / 1000 < 10 ) return 9 + 900 ; else if ( n / 10000 < 10 ) return 909 + n - 9999 ; else return 90909 ; } public static void Main ( String [ ] args ) { int n = 893 ; Console . WriteLine ( odd_digits ( n ) ) ; } }

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

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

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

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

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

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

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

Class/struct names: GFG
C# program:
using System ; class GFG { static void findNumbers ( int n ) { String ans = " " ; for ( int i = 0 ; i < n - 1 ; i ++ ) ans += '7' ; String even = ans + '6' ; String odd = ans + '7' ; Console . WriteLine ( " Even ▁ : ▁ " + even ) ; Console . WriteLine ( " Odd ▁ : ▁ " + odd ) ; } public static void Main ( String [ ] args ) { int n = 4 ; findNumbers ( n ) ; } }

Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int nth_term ( int a , int b , int n ) { int z = 0 ; if ( n % 6 == 1 ) z = a ; else if ( n % 6 == 2 ) z = b ; else if ( n % 6 == 3 ) z = b - a ; else if ( n % 6 == 4 ) z = - a ; else if ( n % 6 == 5 ) z = - b ; if ( n % 6 == 0 ) z = - ( b - a ) ; return z ; } static public void Main ( ) { int a = 10 , b = 17 , n = 3 ; Console . Write ( nth_term ( a , b , n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool inProportion ( int [ ] arr ) { int n = 4 ; Array . Sort ( arr ) ; long extremes = ( long ) arr [ 0 ] * ( long ) arr [ 3 ] ; long means = ( long ) arr [ 1 ] * ( long ) arr [ 2 ] ; if ( extremes == means ) return true ; return false ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 4 , 2 } ; if ( inProportion ( arr ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int findMissing ( int [ ] arr , int n , int k , int avg ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum += arr [ i ] ; } int num = ( avg * ( n + k ) ) - sum ; int den = k ; if ( num % den != 0 ) return - 1 ; return ( int ) ( num / den ) ; } public static void Main ( String [ ] args ) { int k = 3 , avg = 4 ; int [ ] arr = { 2 , 7 , 3 } ; int n = arr . Length ; Console . WriteLine ( findMissing ( arr , n , k , avg ) ) ; } }

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

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

Class/struct names: GFG
C# program:
using System ; class GFG { static int previousFibonacci ( int n ) { double a = n / ( ( 1 + Math . Sqrt ( 5 ) ) / 2.0 ) ; return ( int ) Math . Round ( a ) ; } public static void Main ( ) { int n = 8 ; Console . Write ( previousFibonacci ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void findEquation ( int a , int b ) { int sum = ( a + b ) ; int product = ( a * b ) ; Console . WriteLine ( " x ^ 2 ▁ - ▁ ( " + sum + " x ) ▁ + ▁ ( " + product + " ) ▁ = ▁ 0" ) ; } public static void Main ( ) { int a = 2 , b = 3 ; findEquation ( a , b ) ; } }

Class/struct names: GFG