dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GfG { static void breakLine ( ) { Console . Write ( " -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - " } static int = 10 ; static int [ ] arr = new int [ MAX ] ; static int no ; static void nQueens ( int k , int n ) { for ( int i = 1 ; i <= n ; i ++ ) { if ( canPlace ( k , i ) ) { arr [ k ] = i ; if ( k == n ) { display ( n ) ; } else { nQueens ( k + 1 , n ) ; } } } } static bool canPlace ( int k , int i ) { for ( int j = 1 ; j <= k - 1 ; j ++ ) { if ( arr [ j ] == i || ( Math . Abs ( arr [ j ] - i ) == Math . Abs ( j - k ) ) ) { return false ; } } return true ; } static void display ( int n ) { breakLine ( ) ; Console . Write ( " Arrangement ▁ No . ▁ " + ++ no ) ; breakLine ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = 1 ; j <= n ; j ++ ) { if ( arr [ i ] != j ) { Console . Write ( " TABSYMBOL _ " ) ; } else { Console . Write ( " TABSYMBOL Q " ) ; } } Console . WriteLine ( " " ) ; } breakLine ( ) ; } public static void Main ( String [ ] args ) { int n = 4 ; nQueens ( 1 , n ) ; } }

Index/key variables: MAX, i, j, k
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GfG
C# program:
using System ; using System . Collections . Generic ; class CP { public static void Main ( String [ ] args ) { int [ ] A = { 11 , 15 , 7 , 19 } ; int N = A . Length ; HashSet < int > set1 = new HashSet < int > ( ) ; int i , j , res ; for ( i = 0 ; i < N ; ++ i ) { for ( j = i , res = int . MaxValue ; j < N ; ++ j ) { res &= A [ j ] ; set1 . Add ( res ) ; } } foreach ( int m in set1 ) { Console . Write ( m + " ▁ " ) ; } } }

Index/key variables: j
Accumulator variables: res
Iterator variables: i, j, m
Class/struct names: CP
C# program:
using System ; class GFG { public static int minStepsRecur ( int [ ] height , int l , int r , int h ) { if ( l >= r ) return 0 ; int m = l ; for ( int i = l ; i < r ; i ++ ) if ( height [ i ] < height [ m ] ) m = i ; return Math . Min ( r - l , minStepsRecur ( height , l , m , height [ m ] ) + minStepsRecur ( height , m + 1 , r , height [ m ] ) + height [ m ] - h ) ; } public static int minSteps ( int [ ] height , int N ) { return minStepsRecur ( height , 0 , N , 0 ) ; } public static void Main ( ) { int [ ] height = { 2 , 1 , 2 , 5 , 1 } ; int N = height . Length ; Console . Write ( minSteps ( height , N ) ) ; } }

Index/key variables: i, m
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static int countDirectPath ( int N ) { return N + ( N * ( N - 3 ) ) / 2 ; } public static void Main ( string [ ] args ) { int N = 5 ; Console . Write ( countDirectPath ( N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int triacontagonalNum ( int n ) { return ( 28 * n * n - 26 * n ) / 2 ; } public static void Main ( ) { int n = 3 ; Console . Write ( "3rd ▁ triacontagonal ▁ Number ▁ is ▁ = ▁ " + triacontagonalNum ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static int hexacontagonNum ( int n ) { return ( 58 * n * n - 56 * n ) / 2 ; } public static void Main ( ) { int n = 3 ; Console . Write ( "3rd ▁ hexacontagon ▁ Number ▁ is ▁ = ▁ " + hexacontagonNum ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static int enneacontagonNum ( int n ) { return ( 88 * n * n - 86 * n ) / 2 ; } public static void Main ( String [ ] args ) { int n = 3 ; Console . WriteLine ( "3rd ▁ enneacontagon ▁ Number ▁ is ▁ = ▁ " + enneacontagonNum ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static int triacontakaidigonNum ( int n ) { return ( 30 * n * n - 28 * n ) / 2 ; } public static void Main ( String [ ] args ) { int n = 3 ; Console . WriteLine ( "3rd ▁ triacontakaidigon ▁ Number ▁ is ▁ = ▁ " + triacontakaidigonNum ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static int IcosihexagonalNum ( int n ) { return ( 24 * n * n - 22 * n ) / 2 ; } public static void Main ( String [ ] args ) { int n = 3 ; Console . WriteLine ( "3rd ▁ Icosihexagonal ▁ Number ▁ is ▁ = ▁ " + IcosihexagonalNum ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static int icosikaioctagonalNum ( int n ) { return ( 26 * n * n - 24 * n ) / 2 ; } public static void Main ( ) { int n = 3 ; Console . Write ( "3rd ▁ icosikaioctagonal ▁ Number ▁ is ▁ = ▁ " + icosikaioctagonalNum ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int octacontagonNum ( int n ) { return ( 78 * n * n - 76 * n ) / 2 ; } public static void Main ( ) { int n = 3 ; Console . Write ( "3rd ▁ octacontagon ▁ Number ▁ is ▁ = ▁ " + octacontagonNum ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int hectagonNum ( int n ) { return ( 98 * n * n - 96 * n ) / 2 ; } public static void Main ( ) { int n = 3 ; Console . Write ( "3rd ▁ hectagon ▁ Number ▁ is ▁ = ▁ " + hectagonNum ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int tetracontagonNum ( int n ) { return ( 38 * n * n - 36 * n ) / 2 ; } public static void Main ( string [ ] args ) { int n = 3 ; Console . Write ( "3rd ▁ tetracontagon ▁ Number ▁ is ▁ = ▁ " + tetracontagonNum ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG1 { static void Perimeter ( double a , double b ) { double Perimeter ; Perimeter = ( double ) 2 * 3.14 * Math . Sqrt ( ( a * a + b * b ) / ( 2 * 1.0 ) ) ; Console . WriteLine ( " Perimeter : ▁ " + Perimeter ) ; } public static void Main ( String [ ] args ) { double a = 3 , b = 2 ; Perimeter ( a , b ) ; } }

Class/struct names: GFG1
C# program:
using System ; class GFG { static double reuleauxArea ( double a ) { if ( a < 0 ) return - 1 ; double A = 0.70477 * Math . Pow ( a , 2 ) ; return A ; } static public void Main ( ) { double a = 6 ; Console . WriteLine ( reuleauxArea ( a ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static double hexagonside ( double a ) { if ( a < 0 ) return - 1 ; double x = ( 0.5176 * a ) ; return x ; } public static void Main ( ) { double a = 6 ; Console . WriteLine ( hexagonside ( a ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class CLG { static float hexagonside ( float a ) { if ( a < 0 ) return - 1 ; float x = a / 3 ; return x ; } public static void Main ( ) { float a = 6 ; Console . Write ( hexagonside ( a ) ) ; } }

Class/struct names: CLG
C# program:
using System ; class GFG { static int findSegment ( int n , int m , int [ ] segment_length ) { double meet_point = ( 1.0 * n ) / 2.0 ; int sum = 0 ; int segment_number = 0 ; for ( int i = 0 ; i < m ; i ++ ) { sum += segment_length [ i ] ; if ( ( double ) sum == meet_point ) { segment_number = - 1 ; break ; } if ( sum > meet_point ) { segment_number = i + 1 ; break ; } } return segment_number ; } public static void Main ( ) { int n = 13 ; int m = 3 ; int [ ] segment_length = new int [ ] { 3 , 2 , 8 } ; int ans = findSegment ( n , m , segment_length ) ; Console . WriteLine ( ans ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static long countMaxIntersect ( long n ) { return ( n ) * ( n - 1 ) / 2 ; } public static void Main ( ) { long n = 8 ; Console . WriteLine ( countMaxIntersect ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static float surfaceArea ( float a , float b , float h ) { return 5 * a * b + 5 * b * h ; } static float volume ( float b , float h ) { return ( 5 * b * h ) / 2 ; } public static void Main ( ) { float a = 5 ; float b = 3 ; float h = 7 ; Console . WriteLine ( " surface ▁ area ▁ = ▁ " + surfaceArea ( a , b , h ) + " , ▁ " ) ; Console . WriteLine ( " volume ▁ = ▁ " + volume ( b , h ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static int checkpoint ( int h , int k , int x , int y , int a ) { int p = ( int ) Math . Pow ( ( y - k ) , 2 ) - 4 * a * ( x - h ) ; return p ; } public static void Main ( string [ ] arr ) { int h = 0 , k = 0 , x = 2 , y = 1 , a = 4 ; if ( checkpoint ( h , k , x , y , a ) > 0 ) { Console . WriteLine ( " Outside " ) ; } else if ( checkpoint ( h , k , x , y , a ) == 0 ) { Console . WriteLine ( " On ▁ the ▁ parabola " ) ; } else { Console . WriteLine ( " Inside " ) ; } } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int checkpoint ( int h , int k , int x , int y , int a , int b ) { int p = ( ( int ) Math . Pow ( ( x - h ) , 2 ) / ( int ) Math . Pow ( a , 2 ) ) + ( ( int ) Math . Pow ( ( y - k ) , 2 ) / ( int ) Math . Pow ( b , 2 ) ) ; return p ; } public static void Main ( ) { int h = 0 , k = 0 , x = 2 , y = 1 , a = 4 , b = 5 ; if ( checkpoint ( h , k , x , y , a , b ) > 1 ) Console . WriteLine ( " Outside " ) ; else if ( checkpoint ( h , k , x , y , a , b ) == 1 ) Console . WriteLine ( " On ▁ the ▁ ellipse " ) ; else Console . WriteLine ( " Inside " ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { public static float circlearea ( double a , double b ) { if ( a < 0 b < 0 ) return - 1 ; float A = ( float ) ( ( 3.14 * Math . Pow ( a , 2 ) * Math . Pow ( b , 2 ) ) / ( 4 * ( Math . Pow ( a , 2 ) + Math . Pow ( b , 2 ) ) ) ) ; return A ; } public static void Main ( ) { float a = 8 , b = 10 ; Console . WriteLine ( circlearea ( a , b ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static float circlearea ( float l , float b ) { if ( l < 0 b < 0 ) return - 1 ; if ( l < b ) return ( float ) ( 3.14 * Math . Pow ( l / 2 , 2 ) ) ; else return ( float ) ( 3.14 * Math . Pow ( b / 2 , 2 ) ) ; } public static void Main ( ) { float l = 4 , b = 8 ; Console . Write ( circlearea ( l , b ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int centered_cube ( int n ) { return ( 2 * n + 1 ) * ( n * n + n + 1 ) ; } static public void Main ( ) { int n = 3 ; Console . Write ( n + " th ▁ Centered " + " ▁ cube ▁ number : ▁ " ) ; Console . WriteLine ( centered_cube ( n ) ) ; n = 10 ; Console . Write ( n + " th ▁ Centered " + " ▁ cube ▁ number : ▁ " ) ; Console . WriteLine ( centered_cube ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void center ( int x1 , int x2 , int y1 , int y2 ) { Console . WriteLine ( ( float ) ( x1 + x2 ) / 2 + " , ▁ " + ( float ) ( y1 + y2 ) / 2 ) ; } public static void Main ( ) { int x1 = - 9 , y1 = 3 , x2 = 5 , y2 = - 7 ; center ( x1 , x2 , y1 , y2 ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static void Main ( ) { double side = 3 ; Console . Write ( " Volume ▁ of ▁ octahedron ▁ = ▁ " ) ; Console . WriteLine ( vol_of_octahedron ( side ) ) ; } static double vol_of_octahedron ( double side ) { return ( ( side * side * side ) * ( Math . Sqrt ( 2 ) / 3 ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GfG { public static float volumeOfEllipsoid ( float r1 , float r2 , float r3 ) { float pi = ( float ) 3.14 ; return ( float ) 1.33 * pi * r1 * r2 * r3 ; } public static void Main ( ) { float r1 = ( float ) 2.3 , r2 = ( float ) 3.4 , r3 = ( float ) 5.7 ; Console . WriteLine ( " volume ▁ of ▁ ellipsoid ▁ is ▁ : ▁ " + volumeOfEllipsoid ( r1 , r2 , r3 ) ) ; } }

Class/struct names: GfG
C# program:
using System ; class GFG { static double areaOctagon ( double side ) { return ( float ) ( 2 * ( 1 + Math . Sqrt ( 2 ) ) * side * side ) ; } public static void Main ( ) { double side = 4 ; Console . WriteLine ( " Area ▁ of ▁ Regular ▁ Octagon ▁ = ▁ " + areaOctagon ( side ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static double areaCube ( double a ) { return ( a * a * a ) ; } static double surfaceCube ( double a ) { return ( 6 * a * a ) ; } public static void Main ( ) { double a = 5 ; Console . WriteLine ( " Area ▁ = ▁ " + areaCube ( a ) ) ; Console . WriteLine ( " Total ▁ surface ▁ area ▁ = ▁ " + surfaceCube ( a ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { class pair { public double first , second ; public pair ( double first , double second ) { this . first = first ; this . second = second ; } } static pair mirrorImage ( double a , double b , double c , double x1 , double y1 ) { double temp = - 2 * ( a * x1 + b * y1 + c ) / ( a * a + b * b ) ; double x = temp * a + x1 ; double y = temp * b + y1 ; return new pair ( x , y ) ; } public static void Main ( String [ ] args ) { double a = - 1.0 ; double b = 1.0 ; double c = 0.0 ; double x1 = 1.0 ; double y1 = 0.0 ; pair image = mirrorImage ( a , b , c , x1 , y1 ) ; Console . Write ( " Image ▁ of ▁ point ▁ ( " + x1 + " , ▁ " + y1 + " ) ▁ " ) ; Console . Write ( " by ▁ mirror ▁ ( " + a + " ) x ▁ + ▁ ( " + b + " ) y ▁ + ▁ ( " + c + " ) ▁ = ▁ 0 , ▁ is ▁ : " ) ; Console . WriteLine ( " ( " + image . first + " , ▁ " + image . second + " ) " ) ; } }

Class/struct names: GFG, pair
C# program:
using System ; public class Point { public double x , y ; public Point ( double x , double y ) { this . x = x ; this . y = y ; } public static void displayPoint ( Point p ) { Console . WriteLine ( " ( " + p . x + " , ▁ " + p . y + " ) " ) ; } } public class Test { public static Point lineLineIntersection ( Point A , Point B , Point C , Point D ) { double a1 = B . y - A . y ; double b1 = A . x - B . x ; double c1 = a1 * ( A . x ) + b1 * ( A . y ) ; double a2 = D . y - C . y ; double b2 = C . x - D . x ; double c2 = a2 * ( C . x ) + b2 * ( C . y ) ; double determinant = a1 * b2 - a2 * b1 ; if ( determinant == 0 ) { return new Point ( double . MaxValue , double . MaxValue ) ; } else { double x = ( b2 * c1 - b1 * c2 ) / determinant ; double y = ( a1 * c2 - a2 * c1 ) / determinant ; return new Point ( x , y ) ; } } public static void Main ( string [ ] args ) { Point A = new Point ( 1 , 1 ) ; Point B = new Point ( 4 , 4 ) ; Point C = new Point ( 1 , 8 ) ; Point D = new Point ( 2 , 4 ) ; Point intersection = lineLineIntersection ( A , B , C , D ) ; if ( intersection . x == double . MaxValue && intersection . y == double . MaxValue ) { Console . WriteLine ( " The ▁ given ▁ lines ▁ AB ▁ and ▁ CD ▁ are ▁ parallel . " ) ; } else { Console . Write ( " The ▁ intersection ▁ of ▁ the ▁ given ▁ lines ▁ AB ▁ " + " and ▁ CD ▁ is : ▁ " ) ; Point . displayPoint ( intersection ) ; } } }

Class/struct names: Point, Test
C# program:
using System ; class GFG { static double minRevolutions ( double r , int x1 , int y1 , int x2 , int y2 ) { double d = Math . Sqrt ( ( x1 - x2 ) * ( x1 - x2 ) + ( y1 - y2 ) * ( y1 - y2 ) ) ; return Math . Ceiling ( d / ( 2 * r ) ) ; } public static void Main ( ) { int r = 2 , x1 = 0 , y1 = 0 ; int x2 = 0 , y2 = 4 ; Console . Write ( ( int ) minRevolutions ( r , x1 , y1 , x2 , y2 ) ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static double eps = ( double ) 1e-6 ; static double getArea ( double base1 , double hypotenuse ) { double height = Math . Sqrt ( hypotenuse * hypotenuse - base1 * base1 ) ; return 0.5 * base1 * height ; } static void printRightAngleTriangle ( int hypotenuse , int area ) { int hsquare = hypotenuse * hypotenuse ; double sideForMaxArea = Math . Sqrt ( hsquare / 2.0 ) ; double maxArea = getArea ( sideForMaxArea , hypotenuse ) ; if ( area > maxArea ) { Console . Write ( " Not ▁ possible " ) ; return ; } double low = 0.0 ; double high = sideForMaxArea ; double base1 = 0 ; while ( Math . Abs ( high - low ) > eps ) { base1 = ( low + high ) / 2.0 ; if ( getArea ( base1 , hypotenuse ) >= area ) { high = base1 ; } else { low = base1 ; } } double height = Math . Sqrt ( hsquare - base1 * base1 ) ; Console . WriteLine ( Math . Round ( base1 ) + " ▁ " + Math . Round ( height ) ) ; } static public void Main ( ) { int hypotenuse = 5 ; int area = 6 ; printRightAngleTriangle ( hypotenuse , area ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int countLattice ( int r ) { if ( r <= 0 ) return 0 ; int result = 4 ; for ( int x = 1 ; x < r ; x ++ ) { int ySquare = r * r - x * x ; int y = ( int ) Math . Sqrt ( ySquare ) ; if ( y * y == ySquare ) result += 4 ; } return result ; } public static void Main ( ) { int r = 5 ; Console . Write ( countLattice ( r ) ) ; } }

Accumulator variables: result, x
Iterator variables: x
Class/struct names: GFG
C# program:
using System ; public class GFG { public static void Main ( String [ ] args ) { int [ ] arr = { 3 , 6 , 3 , 2 , 1 , 3 , 9 } ; int K = 2 , M = 4 ; Console . WriteLine ( countSubArrays ( arr , K , M ) ) ; } public static int countSubArrays ( int [ ] arr , int K , int M ) { int count = 0 ; int sum = 0 ; for ( int i = 0 ; i < K ; i ++ ) { sum += arr [ i ] ; } if ( sum >= K * M ) count ++ ; for ( int i = K ; i < arr . Length ; i ++ ) { sum += ( arr [ i ] - arr [ i - K ] ) ; if ( sum >= K * M ) count ++ ; } return count ; } }

Index/key variables: i
Accumulator variables: count, i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static void performQueries ( int n , int q , int k , int [ ] arr , int [ , ] query ) { for ( int i = 1 ; i <= q ; i ++ ) { int count = 0 ; if ( query [ i - 1 , 0 ] == 1 ) { for ( int j = query [ i - 1 , 1 ] ; j <= query [ i - 1 , 2 ] ; j ++ ) { if ( arr [ j ] == k ) count ++ ; } Console . WriteLine ( count ) ; } else { arr [ query [ i - 1 , 1 ] ] = query [ i - 1 , 2 ] ; } } } public static void Main ( string [ ] args ) { int [ ] arr = { 9 , 5 , 7 , 6 , 9 , 0 , 0 , 0 , 0 , 5 , 6 , 7 , 3 , 9 , 0 , 7 , 0 , 9 , 0 } ; int Q = 5 ; int [ , ] query = { { 1 , 5 , 14 } , { 2 , 6 , 1 } , { 1 , 0 , 8 } , { 2 , 13 , 0 } , { 1 , 6 , 18 } } ; int N = arr . Length ; int K = 0 ; performQueries ( N , Q , K , arr , query ) ; } }

Index/key variables: j
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { static int count ( int N ) { String a = Convert . ToString ( N , 2 ) ; int m = a . Length - 1 ; int res = ( int ) ( N - ( Math . Pow ( 2 , m ) - 1 ) ) ; return res ; } public static void Main ( String [ ] args ) { int N = 18 ; Console . WriteLine ( count ( N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static int findSmallestNumK ( int n ) { int cummAnd = n ; int i = n - 1 ; while ( cummAnd != 0 ) { cummAnd = cummAnd & i ; if ( cummAnd == 0 ) { return i ; } i -- ; } return - 1 ; } static void Main ( ) { int N = 17 ; int lastNum = findSmallestNumK ( N ) ; int K = lastNum == - 1 ? lastNum : N - lastNum ; Console . WriteLine ( K ) ; } }

Accumulator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int fact ( int n ) { if ( n == 1 n == 0 ) return 1 ; else return n * fact ( n - 1 ) ; } static int findValue ( int n , int r , int a ) { int k = ( a - 1 ) / fact ( n ) ; int answer = k ; for ( int i = 1 ; i < n + 1 ; i ++ ) answer = answer * ( n + r - i ) ; answer = answer + 1 ; return answer ; } static public void Main ( ) { int N = 1 ; int A = 2 ; int R = 3 ; Console . Write ( ( findValue ( N , R , A ) ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static String NimGame ( int N , int A , int B ) { int sum = A + B ; if ( N % sum <= A - 1 ) return " Bob " ; else return " Alice " ; } static void Main ( ) { int N = 3 , A = 1 , B = 2 ; Console . Write ( NimGame ( N , A , B ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void countNo ( int A , int N , int L , int R ) { int ans = L - 1 + N + ( ( N - 1 ) / ( A - 1 ) ) ; if ( ans % A == 0 ) { ans = ans + 1 ; } Console . WriteLine ( ans ) ; } static void Main ( ) { int A = 5 , N = 10 , L = 4 , R = 20 ; countNo ( A , N , L , R ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void compute ( int [ ] query ) { int [ ] v = new int [ 100001 ] ; int [ ] dp = new int [ 100001 ] ; v [ 1 ] = 1 ; v [ 2 ] = 0 ; dp [ 1 ] = 0 ; dp [ 2 ] = 0 ; for ( int i = 3 ; i < 100001 ; i ++ ) { if ( i % 2 != 0 ) { if ( ( i / 2 ) % 2 == 0 ) { v [ i ] = 1 ; dp [ i ] = dp [ i - 1 ] ; } else { v [ i ] = v [ i / 2 ] + 1 ; dp [ i ] = dp [ i - 1 ] + v [ i ] - 1 ; } } else { v [ i ] = 0 ; dp [ i ] = dp [ i - 1 ] ; } } foreach ( int x in query ) Console . Write ( dp [ x ] + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { int [ ] query = { 5 , 2 } ; compute ( query ) ; } }

Index/key variables: i, x
Accumulator variables: i
Iterator variables: i, x
Class/struct names: GFG
C# program:
using System ; class GFG { static int findCycles ( int N ) { int res = 0 ; int finalResult = 0 ; int val = 2 * N - 1 ; int s = val ; res = ( N - 1 ) * ( N - 2 ) ; finalResult = res + s ; return finalResult ; } static void Main ( ) { int N = 5 ; Console . WriteLine ( findCycles ( N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int find ( int [ ] a , int n , int k ) { List < int > v = new List < int > ( ) ; for ( int i = 1 ; i < n ; ++ i ) { v . Add ( a [ i - 1 ] - a [ i ] ) ; } v . Sort ( ) ; int res = a [ n - 1 ] - a [ 0 ] ; for ( int i = 0 ; i < k - 1 ; ++ i ) { res += v [ i ] ; } return res ; } public static void Main ( String [ ] args ) { int [ ] arr = { 4 , 8 , 15 , 16 , 23 , 42 } ; int N = arr . Length ; int K = 3 ; Console . Write ( find ( arr , N , K ) + " STRNEWLINE " ) ; } }

Index/key variables: i
Accumulator variables: res
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static long power ( long a , long b , long c ) { long result = 1 ; while ( b > 0 ) { if ( ( b & 1 ) == 1 ) { result = ( result * a ) % c ; } b /= 2 ; a = ( a * a ) % c ; } return result ; } public static long calculate ( long X , long N ) { int [ ] a = new int [ 10 ] ; int [ ] cyclicity = new int [ 11 ] ; cyclicity [ 1 ] = 1 ; cyclicity [ 2 ] = 4 ; cyclicity [ 3 ] = 4 ; cyclicity [ 4 ] = 2 ; cyclicity [ 5 ] = 1 ; cyclicity [ 6 ] = 1 ; cyclicity [ 7 ] = 4 ; cyclicity [ 8 ] = 4 ; cyclicity [ 9 ] = 2 ; cyclicity [ 10 ] = 1 ; if ( N == 0 N == 1 ) { return ( X % 10 ) ; } else if ( N == 2 N == 3 N == 4 ) { long temp = ( long ) 1e18 ; a [ 2 ] = 2 ; a [ 3 ] = 6 ; a [ 4 ] = 4 ; long v = X % 10 ; if ( v != 0 ) { int u = cyclicity [ ( int ) v ] ; int r = a [ ( int ) N ] % u ; if ( r == 0 ) { if ( v == 2 v == 4 v == 6 v == 8 ) { return 6 ; } else if ( v == 5 ) { return 5 ; } else if ( v == 1 v == 3 v == 7 v == 9 ) { return 1 ; } } else { return ( power ( v , r , temp ) % 10 ) ; } } else { return 0 ; } } return 1 ; } static void Main ( ) { int X = 18 ; int N = 4 ; long result = calculate ( X , N ) ; Console . Write ( result ) ; } }

Accumulator variables: b
Class/struct names: GFG
C# program:
using System ; class GFG { static int formQuadruplets ( int [ ] arr , int n ) { int ans = 0 , pairs = 0 ; pairs = n / 4 ; Array . Sort ( arr ) ; Array . Reverse ( arr ) ; for ( int i = 0 ; i < n - pairs ; i += 3 ) { ans += arr [ i + 2 ] ; } return ans ; } public static void Main ( String [ ] args ) { int [ ] arr = { 2 , 1 , 7 , 5 , 5 , 4 , 1 , 1 , 3 , 3 , 2 , 2 } ; int n = arr . Length ; Console . Write ( formQuadruplets ( arr , n ) + " STRNEWLINE " ) ; } }

Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Linq ; class GFG { static int gcd ( int a , int b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } static void IsPossible ( int a , int b , int x , int y ) { int g = gcd ( x , y ) ; int initial = gcd ( a , b ) ; if ( initial == g ) { Console . Write ( " POSSIBLE STRNEWLINE " ) ; } else { Console . Write ( " NOT ▁ POSSIBLE STRNEWLINE " ) ; } } static public void Main ( ) { int A = 1 , B = 2 ; int X = 4 , Y = 11 ; IsPossible ( A , B , X , Y ) ; A = 2 ; B = 2 ; X = 3 ; Y = 6 ; IsPossible ( A , B , X , Y ) ; } }

Class/struct names: GFG