dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System . IO ; using System ; class GFG { static void checkPoint ( int radius , int x , int y , float percent , float startAngle ) { float endAngle = 360 / percent + startAngle ; float polarradius = ( float ) Math . Sqrt ( x * x + y * y ) ; float Angle = ( float ) Math . Atan ( y / x ) ; if ( Angle >= startAngle && Angle <= endAngle && polarradius < radius ) Console . Write ( " Point ▁ ( { 0 } , ▁ { 1 } ) ▁ exist ▁ in ▁ " + " the ▁ circle ▁ sector " , x , y ) ; else Console . Write ( " Point ▁ ( { 0 } , ▁ { 1 } ) ▁ does ▁ not ▁ " + " exist ▁ in ▁ the ▁ circle ▁ sector " , x , y ) ; } public static void Main ( ) { int radius = 8 , x = 3 , y = 4 ; float percent = 12 , startAngle = 0 ; checkPoint ( radius , x , y , percent , startAngle ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public class point { public int x , y ; public point ( ) { } public point ( int x , int y ) { this . x = x ; this . y = y ; } } ; static int square ( int x ) { return x * x ; } static int a , b , c ; static void order ( ) { int [ ] copy = new int [ 3 ] ; copy [ 0 ] = a ; copy [ 1 ] = b ; copy [ 2 ] = c ; Array . Sort ( copy ) ; a = copy [ 0 ] ; b = copy [ 1 ] ; c = copy [ 2 ] ; } static int euclidDistSquare ( point p1 , point p2 ) { return square ( p1 . x - p2 . x ) + square ( p1 . y - p2 . y ) ; } static String getSideClassification ( int a , int b , int c ) { if ( a == b && b == c ) return " Equilateral " ; else if ( a == b b == c ) return " Isosceles " ; else return " Scalene " ; } static String getAngleClassification ( int a , int b , int c ) { if ( a + b > c ) return " acute " ; else if ( a + b == c ) return " right " ; else return " obtuse " ; } static void classifyTriangle ( point p1 , point p2 , point p3 ) { a = euclidDistSquare ( p1 , p2 ) ; b = euclidDistSquare ( p1 , p3 ) ; c = euclidDistSquare ( p2 , p3 ) ; order ( ) ; Console . WriteLine ( " Triangle ▁ is ▁ " + getAngleClassification ( a , b , c ) + " ▁ and ▁ " + getSideClassification ( a , b , c ) ) ; } public static void Main ( String [ ] args ) { point p1 , p2 , p3 ; p1 = new point ( 3 , 0 ) ; p2 = new point ( 0 , 4 ) ; p3 = new point ( 4 , 7 ) ; classifyTriangle ( p1 , p2 , p3 ) ; p1 = new point ( 0 , 0 ) ; p2 = new point ( 1 , 1 ) ; p3 = new point ( 1 , 2 ) ; classifyTriangle ( p1 , p2 , p3 ) ; } }

Class/struct names: GFG, point
C# program:
using System ; class GFG { public static double polygonArea ( double [ ] X , double [ ] Y , int n ) { double area = 0.0 ; int j = n - 1 ; for ( int i = 0 ; i < n ; i ++ ) { area += ( X [ j ] + X [ i ] ) * ( Y [ j ] - Y [ i ] ) ; j = i ; } return Math . Abs ( area / 2.0 ) ; } public static void Main ( ) { double [ ] X = { 0 , 2 , 4 } ; double [ ] Y = { 1 , 3 , 7 } ; int n = 3 ; Console . WriteLine ( polygonArea ( X , Y , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: area, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static double f ( double x , int p , double num ) { return Math . Pow ( x , p ) - num ; } static double f_prime ( double x , int p ) { return p * Math . Pow ( x , p - 1 ) ; } static double root ( double num , int p ) { double left = - num ; double right = num ; double x ; while ( true ) { x = ( left + right ) / 2.0 ; double value = f ( x , p , num ) ; double prime = f_prime ( x , p ) ; if ( value * prime <= 0 ) left = x ; else right = x ; if ( value < 0.000001 && value >= 0 ) { return x ; } } } public static void Main ( string [ ] args ) { double P = 1234321 ; int N = 2 ; double ans = root ( P , N ) ; Console . Write ( ans ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static int minimumAdditionOperation ( int N ) { int count = 0 ; while ( N != 0 ) { if ( ( N & 1 ) == 1 ) { count ++ ; } N = N >> 1 ; } return count ; } static public void Main ( ) { int N = 6 ; Console . Write ( minimumAdditionOperation ( N ) ) ; } }

Accumulator variables: count
Class/struct names: GFG
C# program:
using System ; class GFG { public static int minimumOperations ( int [ ] arr , int N ) { int mini = Int32 . MaxValue ; for ( int i = 0 ; i < N ; i ++ ) { int count = 0 ; while ( arr [ i ] % 2 == 0 ) { arr [ i ] = arr [ i ] / 2 ; count ++ ; } if ( mini > count ) { mini = count ; } } return mini ; } public static void Main ( string [ ] args ) { int [ ] arr = { 4 , 6 } ; int N = arr . Length ; Console . WriteLine ( minimumOperations ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static int minimumSizeArr ( int A , int B ) { int currXor = 0 ; int reminder = ( A - 1 ) % 4 ; if ( reminder == 0 ) currXor = A - 1 ; else if ( reminder == 1 ) currXor = 1 ; else if ( reminder == 2 ) currXor = A ; int minSize = A ; if ( currXor == B ) return minSize ; else if ( ( currXor ^ B ) == A ) return minSize + 2 ; else return minSize + 1 ; } public static void Main ( ) { int A = 1 ; int B = 999 ; Console . WriteLine ( minimumSizeArr ( A , B ) ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static int countTriplets ( int N ) { int cnt = 0 ; for ( int A = 1 ; A <= N ; ++ A ) { for ( int B = 1 ; B <= N / A ; ++ B ) { cnt += N / ( A * B ) ; } } return cnt ; } public static void Main ( string [ ] args ) { int N = 2 ; Console . WriteLine ( countTriplets ( N ) ) ; } }

Accumulator variables: cnt
Iterator variables: A, B
Class/struct names: GFG
C# program:
using System ; public class GFG { static int maxn = 100001 ; static int [ ] gpf = new int [ maxn ] ; static void modifiedSieve ( ) { for ( int i = 0 ; i < maxn ; i ++ ) gpf [ i ] = 0 ; gpf [ 0 ] = 0 ; gpf [ 1 ] = 1 ; for ( int i = 2 ; i < maxn ; i ++ ) { if ( gpf [ i ] > 0 ) continue ; for ( int j = i ; j < maxn ; j += i ) { gpf [ j ] = Math . Max ( i , gpf [ j ] ) ; } } } static int greatestValidInt ( int N ) { modifiedSieve ( ) ; for ( int i = N ; i > 0 ; i -- ) { if ( gpf [ i ] > Math . Sqrt ( i ) ) { return i ; } } return - 1 ; } public static void Main ( string [ ] args ) { int N = 25 ; Console . WriteLine ( greatestValidInt ( N ) ) ; } }

Index/key variables: i, j, maxn
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void numberOfPasses ( int [ ] arr , int N ) { for ( int i = 0 ; i < N ; ++ i ) { -- arr [ i ] ; } for ( int i = 0 ; i < N ; ++ i ) { int cnt = 0 ; int k = i ; do { ++ cnt ; k = arr [ k ] ; } while ( k != i ) ; Console . Write ( cnt + " ▁ " ) ; } } public static void Main ( ) { int [ ] arr = { 4 , 6 , 2 , 1 , 5 , 3 } ; int N = arr . Length ; numberOfPasses ( arr , N ) ; } }

Index/key variables: i, k
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static double subfactorial ( int N ) { double res = 0 , fact = 1 ; int count = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { fact = fact * i ; if ( count % 2 == 0 ) res = res - ( 1 / fact ) ; else res = res + ( 1 / fact ) ; count ++ ; } return fact * ( 1 + res ) ; } public static void Main ( ) { int N = 4 ; Console . Write ( subfactorial ( N ) ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int minOperations ( int [ ] A , int [ ] B , int N ) { int cnt = 0 ; int i = 0 ; while ( i < N ) { int j = 0 ; while ( j < N && i < N ) { if ( B [ i ] == A [ j ] ) { i ++ ; } j ++ ; } cnt ++ ; } return cnt ; } public static void Main ( string [ ] args ) { int [ ] A = { 2 , 4 , 6 , 1 , 5 , 3 } ; int [ ] B = { 6 , 5 , 4 , 2 , 3 , 1 } ; int N = A . Length ; Console . WriteLine ( minOperations ( A , B , N ) ) ; } }

Index/key variables: i, j
Accumulator variables: cnt, i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int countPairs ( int N ) { int res = 0 ; for ( int q = 1 ; q * q <= N ; q ++ ) { int maxP = Math . Min ( 2 * N - q , N / q ) ; if ( maxP < q ) continue ; int cnt = maxP - q + 1 ; res += ( cnt / 2 + ( cnt & 1 ) ) ; } return res ; } public static void Main ( ) { int N = 3 ; Console . WriteLine ( countPairs ( N ) ) ; } }

Accumulator variables: q, res
Iterator variables: q
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int maximizeSubset ( int N , int [ ] arr , int M , int x ) { if ( x == M ) { return 0 ; } int ans = 0 ; for ( int i = x ; i < M ; i ++ ) { if ( N % arr [ i ] == 0 ) { ans = Math . Max ( ans , maximizeSubset ( N / arr [ i ] , arr , M , x + 1 ) + 1 ) ; } } return ans ; } public static void Main ( ) { int N = 64 ; int [ ] arr = { 1 , 2 , 4 , 8 , 16 , 32 } ; int M = arr . Length ; Console . Write ( maximizeSubset ( N , arr , M , 0 ) ) ; } }

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 countDistinctSums ( int N , int L , int R ) { int minSum = L * N ; int maxSum = R * N ; return maxSum - minSum + 1 ; } public static void Main ( ) { int N = 2 , L = 1 , R = 3 ; Console . Write ( countDistinctSums ( N , L , R ) ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static void setSumtoZero ( double [ ] arr , int N ) { int [ ] A = new int [ N ] ; int sum = 0 ; int m = int . MinValue ; for ( int i = 0 ; i < N ; i ++ ) { sum += ( int ) Math . Ceiling ( arr [ i ] ) ; A [ i ] = ( int ) Math . Ceiling ( arr [ i ] ) ; } if ( sum > 0 ) { m = Math . Min ( sum , N ) ; for ( int i = 0 ; i < N && m > 0 ; i ++ ) { A [ i ] = ( int ) Math . Floor ( arr [ i ] ) ; if ( A [ i ] != Math . Floor ( arr [ i ] ) ) m -- ; } } for ( int i = 0 ; i < N ; i ++ ) { Console . Write ( A [ i ] + " ▁ " ) ; } } public static void Main ( String [ ] args ) { double [ ] arr = { - 2 , - 2 , 4.5 } ; int N = arr . Length ; setSumtoZero ( arr , N ) ; } }

Index/key variables: N, i
Accumulator variables: i, m, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static long convertToBase9 ( long n ) { long ans = 0 ; long a = 1 ; while ( n > 0 ) { ans += ( a * ( n % 9 ) ) ; a *= 10 ; n /= 9 ; } return ans ; } static long getNthnumber ( long base9 , long K ) { long ans = 0 ; long a = 1 ; while ( base9 > 0 ) { int cur = ( int ) ( base9 % 10 ) ; if ( cur >= K ) { ans += a * ( cur + 1 ) ; } else { ans += a * cur ; } base9 /= 10 ; a *= 10 ; } return ans ; } public static void Main ( String [ ] args ) { long N = 10 , K = 1 ; long base9 = convertToBase9 ( N ) ; Console . Write ( getNthnumber ( base9 , K ) ) ; } }

Accumulator variables: a, ans, base9, n
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static bool binarySearch ( float [ ] arr , int size , float key ) { int low = 0 , high = size - 1 , mid ; while ( low <= high ) { mid = low + ( high - low ) / 2 ; if ( key > arr [ mid ] ) low = mid + 1 ; else if ( key < arr [ mid ] ) high = mid - 1 ; else return true ; } return false ; } static bool twoPointers ( float [ ] arr , int N , float mean ) { int i = 0 , j = N - 1 ; while ( i < j ) { float temp = ( arr [ i ] + arr [ j ] ) / 2 ; if ( temp > mean ) j -- ; else if ( temp < mean ) i ++ ; else return true ; } return false ; } static bool checkArray ( float [ ] arr , int N ) { float sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) sum += arr [ i ] ; float mean = sum / N ; if ( ( N & 1 ) != 0 ) return binarySearch ( arr , N , mean ) ; else return twoPointers ( arr , N , mean ) ; } public static void Main ( ) { float [ ] arr = { 1.0f , 3.0f , 6.0f , 9.0f , 12.0f , 32.0f } ; int N = arr . Length ; if ( checkArray ( arr , N ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Index/key variables: i, j, mid
Accumulator variables: i, j, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { static int UniqueGeometricTerms ( int N , int a1 , int r1 , int a2 , int r2 ) { HashSet < int > S = new HashSet < int > ( ) ; int p1 = a1 ; for ( int i = 0 ; i < N ; i ++ ) { S . Add ( p1 ) ; p1 = ( p1 * r1 ) ; } int p2 = a2 ; for ( int i = 0 ; i < N ; i ++ ) { S . Add ( p2 ) ; p2 = ( p2 * r2 ) ; } return S . Count ; } public static void Main ( string [ ] args ) { int N = 5 ; int a1 = 3 , r1 = 2 , a2 = 2 , r2 = 3 ; Console . Write ( UniqueGeometricTerms ( N , a1 , r1 , a2 , r2 ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { class pair : IComparable < pair > { public int first , second ; public pair ( int first , int second ) { this . first = first ; this . second = second ; } public int CompareTo ( pair p ) { return this . first - p . first ; } } static int minOperations ( int [ ] arr , int N , int K ) { List < pair > vp = new List < pair > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { vp . Add ( new pair ( arr [ i ] , i ) ) ; } vp . Sort ( ) ; int minCnt = 0 ; while ( vp . Count != 0 ) { int val , ind ; val = vp [ vp . Count - 1 ] . first ; ind = vp [ vp . Count - 1 ] . second ; minCnt ++ ; while ( vp . Count != 0 && vp [ vp . Count - 1 ] . first == val && ind - vp [ vp . Count - 1 ] . second + 1 <= K ) vp . RemoveAt ( vp . Count - 1 ) ; } return minCnt ; } public static void Main ( String [ ] args ) { int [ ] arr = { 18 , 11 , 18 , 11 , 18 } ; int K = 3 ; int N = arr . Length ; Console . Write ( minOperations ( arr , N , K ) ) ; } }

Index/key variables: i
Accumulator variables: i, minCnt
Iterator variables: i
Class/struct names: GFG, pair
C# program:
using System ; public class GFG { static void nearestLeft ( int [ ] arr , int N , int [ ] steps ) { int L = - N ; for ( int i = N - 1 ; i >= 0 ; i -- ) { if ( arr [ i ] > 0 ) { L = - ( N - i ) ; break ; } } for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] > 0 ) { L = i ; } steps [ i ] = i - L ; } } static void nearestRight ( int [ ] arr , int N , int [ ] steps ) { int R = 2 * N ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] > 0 ) { R = N + i ; break ; } } for ( int i = N - 1 ; i >= 0 ; i -- ) { if ( arr [ i ] > 0 ) { R = i ; } steps [ i ] = Math . Min ( steps [ i ] , R - i ) ; } } static int accumulate ( int [ ] arr , int start , int end ) { int sum = 0 ; for ( int i = 0 ; i < arr . Length ; i ++ ) sum += arr [ i ] ; return sum ; } static int findSum ( int [ ] arr , int N , int M , int K ) { int [ ] steps = new int [ N ] ; int sum = accumulate ( arr , 0 , N ) ; if ( sum == 0 ) { return 0 ; } nearestLeft ( arr , N , steps ) ; nearestRight ( arr , N , steps ) ; for ( int i = 0 ; i < N ; i ++ ) sum += 2 * K * Math . Max ( 0 , M - steps [ i ] ) ; return sum ; } public static void Main ( String [ ] args ) { int [ ] arr = { 0 , 1 , 0 , 1 , 0 , 0 } ; int N = arr . Length ; int M = 2 ; int K = 1 ; Console . Write ( findSum ( arr , N , M , K ) ) ; } }

Index/key variables: N, i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { public static int getProduct ( int n ) { int product = 1 ; while ( n != 0 ) { product = product * ( n % 10 ) ; n = n / 10 ; } return product ; } public static int countPairs ( int L , int R ) { int cntPair = 0 ; for ( int a = L ; a <= R ; a ++ ) { for ( int b = a + 1 ; b <= R ; b ++ ) { int x = getProduct ( a ) ; int y = getProduct ( b ) ; if ( x != 0 && y != 0 && ( a * y ) == ( b * x ) ) { cntPair ++ ; } } } return cntPair ; } public static void Main ( string [ ] args ) { int L = 1 ; int R = 100 ; Console . WriteLine ( countPairs ( L , R ) ) ; } }

Accumulator variables: a, b, cntPair
Iterator variables: a, b
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { static void elementsCoprimeWithArr ( int [ ] A , int N , int L , int R ) { HashSet < int > S = new HashSet < int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { int curr_ele = A [ i ] ; for ( int j = 1 ; j <= Math . Sqrt ( curr_ele ) + 1 ; j ++ ) { if ( curr_ele % j == 0 ) { S . Add ( j ) ; S . Add ( curr_ele / j ) ; } } } HashSet < int > store = new HashSet < int > ( ) ; for ( int i = L ; i <= R ; i ++ ) store . Add ( i ) ; S . Remove ( 1 ) ; foreach ( int it in S ) { int ele = it ; int index = 1 ; while ( index * ele <= R ) { store . Remove ( index * ele ) ; index ++ ; } } foreach ( int i in store ) { Console . Write ( i + " ▁ " ) ; } } public static void Main ( String [ ] args ) { int [ ] arr = { 3 , 5 } ; int L = 1 , R = 10 ; int N = arr . Length ; elementsCoprimeWithArr ( arr , N , L , R ) ; } }

Index/key variables: i
Accumulator variables: i, index, j
Iterator variables: i, it, j
Class/struct names: GFG
C# program:
using System ; public class GFG { static int maxSum ( int [ , ] matrix ) { int r = matrix . GetLength ( 0 ) ; int c = matrix . GetLength ( 1 ) ; int sum = 0 ; int mini = int . MaxValue ; int count = 0 ; for ( int i = 0 ; i < r ; i ++ ) { for ( int j = 0 ; j < c ; j ++ ) { int k = matrix [ i , j ] ; mini = Math . Min ( mini , Math . Abs ( k ) ) ; if ( k < 0 ) count ++ ; sum += Math . Abs ( k ) ; } } if ( count % 2 == 0 ) { return sum ; } else { return ( sum - 2 * mini ) ; } } public static void Main ( string [ ] args ) { int [ , ] matrix = { { 2 , - 2 } , { - 2 , 2 } } ; Console . Write ( maxSum ( matrix ) ) ; } }

Accumulator variables: count, i, j, sum
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int lastPositiveElement ( int [ ] arr ) { int N = arr . Length ; if ( N == 1 ) return arr [ 0 ] ; int greatest = - 1 , secondGreatest = - 1 ; for ( int x = 0 ; x < N ; x ++ ) { if ( arr [ x ] >= greatest ) { secondGreatest = greatest ; greatest = arr [ x ] ; } else if ( arr [ x ] >= secondGreatest ) { secondGreatest = arr [ x ] ; } } return greatest - secondGreatest ; } public static void Main ( ) { int [ ] arr = { 3 , 5 , 4 , 7 } ; Console . Write ( lastPositiveElement ( arr ) ) ; } }

Index/key variables: x
Accumulator variables: x
Iterator variables: x
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void updateArray ( List < int > arr , int K ) { int sum = 0 ; List < int > res = new List < int > ( ) ; for ( int i = 0 ; i < arr . Count ; i ++ ) { if ( arr [ i ] < K ) { sum += arr [ i ] ; } else { if ( sum != 0 ) { res . Add ( sum ) ; } sum = 0 ; res . Add ( arr [ i ] ) ; } } if ( sum != 0 ) res . Add ( sum ) ; foreach ( int it in res ) Console . Write ( it + " ▁ " ) ; } public static void Main ( ) { List < int > arr = new List < int > { 200 , 6 , 36 , 612 , 121 , 66 , 63 , 39 , 668 , 108 } ; int K = 100 ; updateArray ( arr , K ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i, it
Class/struct names: GFG
C# program:
using System ; class GFG { static int highestPowerof2 ( int n ) { int p = ( int ) Math . Floor ( Math . Log ( n ) / Math . Log ( 2.0 ) ) ; if ( p % 2 == 0 ) p -= 1 ; int result = ( int ) ( Math . Pow ( 2 , p ) ) ; return result ; } static int minStep ( int N , int X ) { if ( N % 2 != 0 && X == 0 ) return - 1 ; int size = 0 ; while ( X < N ) { N -= highestPowerof2 ( N ) ; size += 1 ; } if ( N != 0 ) size += 1 ; return size ; } public static void Main ( String [ ] args ) { int N = 11 ; int X = 2 ; Console . Write ( minStep ( N , X ) ) ; } }

Accumulator variables: N, p, size
Class/struct names: GFG
C# program:
using System ; class GFG { static string checkSameDigits ( int N ) { int digit = N % 10 ; while ( N != 0 ) { int current_digit = N % 10 ; N = N / 10 ; if ( current_digit != digit ) { return " No " ; } } return " Yes " ; } public static void Main ( ) { int N = 222 ; Console . Write ( checkSameDigits ( N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int positionAfterKJumps ( int X , int Y , int K ) { int addY = Y * ( K / 2 ) ; int reduceX = - 1 * X * ( K / 2 + K % 2 ) ; return addY + reduceX ; } public static void Main ( String [ ] args ) { int X = 2 , Y = 5 , K = 3 ; Console . WriteLine ( positionAfterKJumps ( X , Y , K ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int findMaxK ( int N ) { int K = N ; for ( int i = N - 1 ; i >= 0 ; i -- ) { K &= i ; if ( K == 0 ) { return i ; } } return 0 ; } public static void Main ( String [ ] args ) { int N = 5 ; Console . Write ( findMaxK ( N ) ) ; } }

Accumulator variables: K, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static int countPairs ( int [ ] arr , int n ) { int count = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { if ( ( arr [ j ] % arr [ i ] == 0 ) && ( j + 1 ) % ( i + 1 ) == 0 && ( arr [ j ] / arr [ i ] == ( j + 1 ) / ( i + 1 ) ) ) { count ++ ; } } } return count ; } public static void Main ( string [ ] args ) { int [ ] arr = { 5 , - 2 , 4 , 20 , 25 , - 6 } ; int n = arr . Length ; Console . WriteLine ( countPairs ( arr , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int factorial ( int n ) { int ans = 1 ; while ( n >= 1 ) { ans *= n ; n -- ; } return ans ; } static void Binary_Num ( int n , int k ) { int num_even , num_odd ; if ( n - k - 1 >= 0 && k - 1 >= 0 ) { num_even = factorial ( n - 2 ) / ( factorial ( k - 1 ) * factorial ( n - k - 1 ) ) ; } else { num_even = 0 ; } if ( k - 2 >= 0 ) { num_odd = factorial ( n - 2 ) / ( factorial ( k - 2 ) * factorial ( n - k ) ) ; } else { num_odd = 0 ; } Console . Write ( num_even + " ▁ " + num_odd ) ; } public static void Main ( ) { int N = 9 , K = 6 ; Binary_Num ( N , K ) ; } }

Accumulator variables: ans, n
Class/struct names: GFG
C# program:
using System ; class GFG { static void findSumOfAllSubsets ( int [ ] arr , int n , int k ) { int factorial_N = 1 , factorial_d = 1 , factorial_D = 1 ; for ( int i = 1 ; i <= n - 1 ; i ++ ) factorial_N *= i ; for ( int i = 1 ; i <= k - 1 ; i ++ ) factorial_d *= i ; for ( int i = 1 ; i <= n - k ; i ++ ) factorial_D *= i ; int freq = factorial_N / ( factorial_d * factorial_D ) ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum += arr [ i ] ; sum = sum * freq ; Console . WriteLine ( " Sum ▁ of ▁ all ▁ subsets ▁ of ▁ size ▁ = ▁ " + k + " ▁ is ▁ = > ▁ " + sum ) ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 4 , 5 } ; int n = 4 , k = 2 ; findSumOfAllSubsets ( arr , n , k ) ; } }

Index/key variables: i
Accumulator variables: factorial_D, factorial_N, factorial_d, i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int maximumTripletXOR ( int A , int B , int C ) { int ans = 0 ; for ( int i = 30 ; i >= 0 ; i -- ) { int cur = 1 << i ; if ( A >= cur ) { ans += cur ; A -= cur ; } else if ( B >= cur ) { ans += cur ; B -= cur ; } else if ( C >= cur ) { ans += cur ; C -= cur ; } } return ans ; } public static void Main ( String [ ] args ) { int A = 6 ; int B = 2 ; int C = 10 ; Console . Write ( maximumTripletXOR ( A , B , C ) ) ; } }

Accumulator variables: A, B, C, ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int intCount ( int X , int K ) { int ans = 0 ; for ( int z = 0 ; z < Math . Pow ( 10 , K ) ; z += ( ( int ) Math . Pow ( 10 , K ) - 1 ) / 9 ) { if ( z > X ) break ; ans += ( ( X - z ) / ( int ) Math . Pow ( 10 , K ) + 1 ) ; } return ans ; } static int intCountInRange ( int L , int R , int K ) { return ( intCount ( R , K ) - intCount ( L - 1 , K ) ) ; } public static void Main ( String [ ] args ) { int L = 49 ; int R = 101 ; int K = 2 ; Console . Write ( intCountInRange ( L , R , K ) ) ; } }

Accumulator variables: ans, z
Iterator variables: z
Class/struct names: GFG