dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; public class GFG { static double findEdges ( double s1 , double s2 , double s3 ) { double a = Math . Sqrt ( s1 * s2 / s3 ) ; double b = Math . Sqrt ( s3 * s1 / s2 ) ; double c = Math . Sqrt ( s3 * s2 / s1 ) ; double sum = a + b + c ; return 4 * sum ; } static public void Main ( ) { double s1 , s2 , s3 ; s1 = 65 ; s2 = 156 ; s3 = 60 ; Console . WriteLine ( findEdges ( s1 , s2 , s3 ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static int findMaximumPieces ( int n ) { int x = n / 2 ; return ( ( x + 1 ) * ( n - x + 1 ) ) ; } static public void Main ( ) { int n = 3 ; Console . Write ( " Max ▁ number ▁ of ▁ pieces ▁ for ▁ n ▁ = ▁ " + n + " ▁ is ▁ " + findMaximumPieces ( 3 ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void equation_plane ( int x1 , int y1 , int z1 , int x2 , int y2 , int z2 , int x3 , int y3 , int z3 , int x , int y , int z ) { int a1 = x2 - x1 ; int b1 = y2 - y1 ; int c1 = z2 - z1 ; int a2 = x3 - x1 ; int b2 = y3 - y1 ; int c2 = z3 - z1 ; int a = b1 * c2 - b2 * c1 ; int b = a2 * c1 - a1 * c2 ; int c = a1 * b2 - b1 * a2 ; int d = ( - a * x1 - b * y1 - c * z1 ) ; if ( a * x + b * y + c * z + d == 0 ) Console . WriteLine ( " Coplanar " ) ; else Console . WriteLine ( " Not ▁ Coplanar " ) ; } static public void Main ( ) { int x1 = 3 ; int y1 = 2 ; int z1 = - 5 ; int x2 = - 1 ; int y2 = 4 ; int z2 = - 3 ; int x3 = - 3 ; int y3 = 8 ; int z3 = - 5 ; int x4 = - 3 ; int y4 = 2 ; int z4 = 1 ; equation_plane ( x1 , y1 , z1 , x2 , y2 , z2 , x3 , y3 , z3 , x4 , y4 , z4 ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void distance ( float a1 , float b1 , float c1 , float a2 , float b2 , float c2 ) { float d = ( a1 * a2 + b1 * b2 + c1 * c2 ) ; float e1 = ( float ) Math . Sqrt ( a1 * a1 + b1 * b1 + c1 * c1 ) ; float e2 = ( float ) Math . Sqrt ( a2 * a2 + b2 * b2 + c2 * c2 ) ; d = d / ( e1 * e2 ) ; float pi = ( float ) 3.14159 ; float A = ( 180 / pi ) * ( float ) ( Math . Acos ( d ) ) ; Console . Write ( " Angle ▁ is ▁ " + A + " ▁ degree " ) ; } public static void Main ( ) { float a1 = 1 ; float b1 = 1 ; float c1 = 2 ; float a2 = 2 ; float b2 = - 1 ; float c2 = 1 ; distance ( a1 , b1 , c1 , a2 , b2 , c2 ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void mirror_point ( int a , int b , int c , int d , int x1 , int y1 , int z1 ) { float k = ( - a * x1 - b * y1 - c * z1 - d ) / ( float ) ( a * a + b * b + c * c ) ; float x2 = a * k + x1 ; float y2 = b * k + y1 ; float z2 = c * k + z1 ; float x3 = 2 * x2 - x1 ; float y3 = 2 * y2 - y1 ; float z3 = 2 * z2 - z1 ; Console . Write ( " x3 ▁ = ▁ " + x3 + " ▁ " ) ; Console . Write ( " y3 ▁ = ▁ " + y3 + " ▁ " ) ; Console . Write ( " z3 ▁ = ▁ " + z3 + " ▁ " ) ; } static public void Main ( ) { int a = 1 ; int b = - 2 ; int c = 0 ; int d = 0 ; int x1 = - 1 ; int y1 = 3 ; int z1 = 4 ; mirror_point ( a , b , c , d , x1 , y1 , z1 ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int countRectangles ( int radius ) { int rectangles = 0 ; int diameter = 2 * radius ; int diameterSquare = diameter * diameter ; for ( int a = 1 ; a < 2 * radius ; a ++ ) { for ( int b = 1 ; b < 2 * radius ; b ++ ) { int diagonalLengthSquare = ( a * a + b * b ) ; if ( diagonalLengthSquare <= diameterSquare ) { rectangles ++ ; } } } return rectangles ; } public static void Main ( ) { int radius = 2 ; int totalRectangles ; totalRectangles = countRectangles ( radius ) ; Console . WriteLine ( totalRectangles + " ▁ rectangles ▁ can ▁ be ▁ " + " cut ▁ from ▁ a ▁ circle ▁ of " + " ▁ Radius ▁ " + radius ) ; } }

Accumulator variables: a, b, rectangles
Iterator variables: a, b
Class/struct names: GFG
C# program:
using System ; class GFG1 { static int simi_aaa ( int [ ] a1 , int [ ] a2 ) { Array . Sort ( a1 ) ; Array . Sort ( a2 ) ; if ( a1 [ 0 ] == a2 [ 0 ] && a1 [ 1 ] == a2 [ 1 ] && a1 [ 2 ] == a2 [ 2 ] ) return 1 ; else return 0 ; } static int simi_sas ( int [ ] s1 , int [ ] s2 , int [ ] a1 , int [ ] a2 ) { Array . Sort ( a1 ) ; Array . Sort ( a2 ) ; Array . Sort ( s1 ) ; Array . Sort ( s2 ) ; if ( s1 [ 0 ] / s2 [ 0 ] == s1 [ 1 ] / s2 [ 1 ] ) { if ( a1 [ 2 ] == a2 [ 2 ] ) return 1 ; } if ( s1 [ 1 ] / s2 [ 1 ] == s1 [ 2 ] / s2 [ 2 ] ) { if ( a1 [ 0 ] == a2 [ 0 ] ) return 1 ; } if ( s1 [ 2 ] / s2 [ 2 ] == s1 [ 0 ] / s2 [ 0 ] ) { if ( a1 [ 1 ] == a2 [ 1 ] ) return 1 ; } return 0 ; } static int simi_sss ( int [ ] s1 , int [ ] s2 ) { Array . Sort ( s1 ) ; Array . Sort ( s2 ) ; if ( s1 [ 0 ] / s2 [ 0 ] == s1 [ 1 ] / s2 [ 1 ] && s1 [ 1 ] / s2 [ 1 ] == s1 [ 2 ] / s2 [ 2 ] && s1 [ 2 ] / s2 [ 2 ] == s1 [ 0 ] / s2 [ 0 ] ) return 1 ; return 0 ; } public static void Main ( ) { int [ ] s1 = { 2 , 3 , 3 } ; int [ ] s2 = { 4 , 6 , 6 } ; int [ ] a1 = { 80 , 60 , 40 } ; int [ ] a2 = { 40 , 60 , 80 } ; int aaa = simi_aaa ( a1 , a2 ) ; int sss = simi_sss ( s1 , s2 ) ; int sas = simi_sas ( s1 , s2 , a1 , a2 ) ; if ( aaa == 1 sss == 1 sas == 1 ) { Console . Write ( " Triangles ▁ are ▁ " + " similar ▁ by ▁ " ) ; if ( aaa == 1 ) Console . Write ( " AAA ▁ " ) ; if ( sss == 1 ) Console . Write ( " SSS ▁ " ) ; if ( sas == 1 ) Console . Write ( " SAS . " ) ; } else Console . WriteLine ( " Triangles ▁ are ▁ " + " not ▁ similar " ) ; } }

Class/struct names: GFG1
C# program:
using System ; class GFG { static int center_nonadecagon_num ( int n ) { return ( 19 * n * n - 19 * n + 2 ) / 2 ; } static public void Main ( ) { int n = 2 ; Console . Write ( n + " th ▁ centered ▁ " + " nonadecagonal ▁ number ▁ : ▁ " ) ; Console . WriteLine ( center_nonadecagon_num ( n ) ) ; n = 7 ; Console . Write ( n + " th ▁ centered ▁ " + " nonadecagonal ▁ number ▁ : ▁ " ) ; Console . WriteLine ( center_nonadecagon_num ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int hendecagonal_num ( int n ) { return ( 9 * n * n - 7 * n ) / 2 ; } static public void Main ( ) { int n = 3 ; Console . Write ( n + " rd ▁ Hendecagonal ▁ number : ▁ " ) ; Console . WriteLine ( hendecagonal_num ( n ) ) ; n = 10 ; Console . Write ( n + " th ▁ Hendecagonal ▁ number : ▁ " ) ; Console . WriteLine ( hendecagonal_num ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool isValid ( int [ ] arr , int i , int j , int m , int c ) { if ( i == j ) return false ; int lhs = arr [ j ] ; int rhs = m * arr [ i ] + c ; return ( lhs == rhs ) ; } static int findOrderedPoints ( int [ ] arr , int n , int m , int c ) { int counter = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { int firstIndex = i , secondIndex = j ; if ( isValid ( arr , firstIndex , secondIndex , m , c ) ) counter ++ ; } } return counter ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 4 , 2 } ; int n = arr . Length ; int m = 1 , c = 1 ; Console . Write ( findOrderedPoints ( arr , n , m , c ) ) ; } }

Index/key variables: i, j
Accumulator variables: counter, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class ring { public static bool checkcircle ( int r , int R , int r1 , int x1 , int y1 ) { int dis = ( int ) Math . Sqrt ( x1 * x1 + y1 * y1 ) ; return ( dis - r1 >= R && dis + r1 <= r ) ; } public static void Main ( ) { int r = 8 , R = 4 , r1 = 2 , x1 = 6 , y1 = 0 ; if ( checkcircle ( r , R , r1 , x1 , y1 ) ) Console . WriteLine ( " yes " ) ; else Console . WriteLine ( " no " ) ; } }

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

Class/struct names: GFG
C# program:
using System ; public class GfG { public static int nCk ( int n , int k ) { int [ ] C = new int [ k + 1 ] ; C [ 0 ] = 1 ; for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = Math . Min ( i , k ) ; j > 0 ; j -- ) C [ j ] = C [ j ] + C [ j - 1 ] ; } return C [ k ] ; } public static int count_Straightlines ( int n , int m ) { return ( nCk ( n , 2 ) - nCk ( m , 2 ) + 1 ) ; } public static void Main ( String [ ] args ) { int n = 4 , m = 3 ; Console . WriteLine ( count_Straightlines ( n , m ) ) ; } }

Index/key variables: j, k
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GfG
C# program:
using System ; public class GFG { static float vol_of_dodecahedron ( int side ) { return ( float ) ( ( ( 15 + ( 7 * ( Math . Sqrt ( 5 ) ) ) ) / 4 ) * ( Math . Pow ( side , 3 ) ) ) ; } static public void Main ( ) { int side = 4 ; Console . WriteLine ( " Volume ▁ of ▁ dodecahedron ▁ = ▁ " + vol_of_dodecahedron ( side ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void overflow ( int H , int r , int h , int N , int R ) { double tank_cap = 3.14 * r * r * H ; double water_vol = 3.14 * r * r * h ; double balls_vol = N * ( 4 / 3 ) * 3.14 * R * R * R ; double vol = water_vol + balls_vol ; if ( vol > tank_cap ) { Console . WriteLine ( " Overflow " ) ; } else { Console . WriteLine ( " Not ▁ in ▁ overflow ▁ state " ) ; } } public static void Main ( ) { int H = 10 , r = 5 , h = 5 , N = 2 , R = 2 ; overflow ( H , r , h , N , R ) ; } }

Class/struct names: GFG
C# program:
using System ; class Number { public static float volume ( int radius , int height ) { return ( ( 22 / 7 ) * radius * radius * height ) ; } public static void check_and_print ( double required_time , double given_time ) { if ( required_time < given_time ) Console . WriteLine ( " Overflow " ) ; else if ( required_time > given_time ) Console . WriteLine ( " Underflow " ) ; else Console . WriteLine ( " Filled " ) ; } public static void Main ( ) { int radius = 5 , height = 10 , rate_of_flow = 10 ; double given_time = 70.0 ; double required_time = volume ( radius , height ) / rate_of_flow ; check_and_print ( required_time , given_time ) ; } }

Class/struct names: Number
C# program:
using System ; class GFG { static float cal_cos ( float n ) { float accuracy = 0.0001f , x1 ; float denominator , cosx , cosval ; n = n * ( 3.142f / 180.0f ) ; x1 = 1 ; cosx = x1 ; cosval = ( float ) Math . Cos ( n ) ; int i = 1 ; do { denominator = 2 * i * ( 2 * i - 1 ) ; x1 = - x1 * n * n / denominator ; cosx = cosx + x1 ; i = i + 1 ; } while ( accuracy <= Math . Abs ( cosval - cosx ) ) ; return cosx ; } static float third_side ( int a , int b , float c ) { float angle = cal_cos ( c ) ; return ( float ) Math . Sqrt ( ( a * a ) + ( b * b ) - 2 * a * b * angle ) ; } public static void Main ( ) { float c = 49 ; int a = 5 , b = 8 ; Console . WriteLine ( Math . Round ( third_side ( a , b , c ) * 100000.0 ) / 100000.0 ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void fitOrNotFit ( int R , int r , int x , int y , int rad ) { double val = Math . Sqrt ( Math . Pow ( x , 2 ) + Math . Pow ( y , 2 ) ) ; if ( val + rad <= R && val - rad >= R - r ) Console . WriteLine ( " Fits " ) ; else Console . WriteLine ( " Doesn ' t ▁ Fit " ) ; } public static void Main ( ) { int R = 8 , r = 4 ; int x = 5 , y = 3 , rad = 3 ; fitOrNotFit ( R , r , x , y , rad ) ; } }

Class/struct names: GFG
C# program:
using System . Collections . Generic ; using System ; class GFG { static double EPSILON = 1.0842e-19 ; static bool compareDoubles ( double A , double B ) { double diff = A - B ; return ( diff < EPSILON ) && ( - diff < EPSILON ) ; } static int numberOfTringles ( int [ ] a , int [ ] b , int [ ] c , int n ) { List < double > slope = new List < double > ( ) ; for ( int i = 0 ; i < n ; i ++ ) slope . Add ( ( double ) ( a [ i ] * 1.0 ) / b [ i ] ) ; slope . Sort ( ) ; int [ ] count = new int [ n ] ; int k = 0 ; int this_count = 1 ; for ( int i = 1 ; i < n ; i ++ ) { if ( compareDoubles ( ( double ) slope [ i ] , ( double ) slope [ i - 1 ] ) ) this_count ++ ; else { count [ k ++ ] = this_count ; this_count = 1 ; } } count [ k ++ ] = this_count ; int sum1 = 0 ; for ( int i = 0 ; i < k ; i ++ ) sum1 += count [ i ] ; int sum2 = 0 ; int [ ] temp = new int [ n ] ; for ( int i = 0 ; i < k ; i ++ ) { temp [ i ] = count [ i ] * ( sum1 - count [ i ] ) ; sum2 += temp [ i ] ; } sum2 /= 2 ; int sum3 = 0 ; for ( int i = 0 ; i < k ; i ++ ) sum3 += count [ i ] * ( sum2 - temp [ i ] ) ; sum3 /= 3 ; return sum3 ; } public static void Main ( ) { int [ ] a = { 1 , 2 , 3 , 4 } ; int [ ] b = { 2 , 4 , 5 , 5 } ; int [ ] c = { 5 , 7 , 8 , 6 } ; int n = a . Length ; Console . WriteLine ( " The ▁ number ▁ of ▁ triangles ▁ " + " that ▁ can ▁ be ▁ formed ▁ are : ▁ " + numberOfTringles ( a , b , c , n ) ) ; } }

Index/key variables: i, n
Accumulator variables: i, k, sum1, sum2, sum3, this_count
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public class Pair { public int first , second ; public Pair ( int first , int second ) { this . first = first ; this . second = second ; } } static void lineFromPoints ( Pair P , Pair Q ) { int a = Q . second - P . second ; int b = P . first - Q . first ; int c = a * ( P . first ) + b * ( P . second ) ; if ( b < 0 ) { Console . WriteLine ( " The ▁ line ▁ passing ▁ through ▁ points ▁ P ▁ and ▁ Q ▁ is : ▁ " + a + " x ▁ - ▁ " + b + " y ▁ = ▁ " + c ) ; } else { Console . WriteLine ( " The ▁ line ▁ passing ▁ through ▁ points ▁ P ▁ and ▁ Q ▁ is : ▁ " + a + " x ▁ + ▁ " + b + " y ▁ = ▁ " + c ) ; } } public static void Main ( String [ ] args ) { Pair P = new Pair ( 3 , 2 ) ; Pair Q = new Pair ( 2 , 6 ) ; lineFromPoints ( P , Q ) ; } }

Class/struct names: GFG, Pair
C# program:
using System ; class GFG { static bool checkPolygonWithMidpoints ( int [ ] arr , int N , int midpoints ) { for ( int j = 0 ; j < midpoints ; j ++ ) { int val = 1 ; for ( int k = j ; k < N ; k += midpoints ) { val &= arr [ k ] ; } if ( val != 0 && N / midpoints > 2 ) { Console . WriteLine ( " Polygon ▁ possible ▁ with ▁ " + " side ▁ length ▁ " + N / midpoints ) ; return true ; } } return false ; } static void isPolygonPossible ( int [ ] arr , int N ) { int limit = ( int ) Math . Sqrt ( N ) ; for ( int i = 1 ; i <= limit ; i ++ ) { if ( N % i == 0 ) { if ( checkPolygonWithMidpoints ( arr , N , i ) || checkPolygonWithMidpoints ( arr , N , ( N / i ) ) ) return ; } } Console . WriteLine ( " Not ▁ possible " ) ; } static public void Main ( ) { int [ ] arr = { 1 , 0 , 1 , 0 , 1 , 0 , 1 , 0 , 1 , 1 } ; isPolygonPossible ( arr , arr . Length ) ; } }

Index/key variables: k
Accumulator variables: i, j, k, val
Iterator variables: i, j, k
Class/struct names: GFG
C# program:
using System ; class GFG { static float squareRoot ( float n ) { float x = n ; float y = 1 ; float e = 0.000001f ; while ( x - y > e ) { x = ( x + y ) / 2 ; y = n / x ; } return x ; } static int findMaximumHeight ( int N ) { int n = 1 + 8 * N ; int maxH = ( int ) ( - 1 + squareRoot ( n ) ) / 2 ; return maxH ; } public static void Main ( ) { int N = 12 ; Console . Write ( findMaximumHeight ( N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public class Point { public int x , y ; public Point ( int a , int b ) { this . x = a ; this . y = b ; } } ; static int gcd ( int a , int b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } static int getCount ( Point p , Point q ) { if ( p . x == q . x ) return Math . Abs ( p . y - q . y ) - 1 ; if ( p . y == q . y ) return Math . Abs ( p . x - q . x ) - 1 ; return gcd ( Math . Abs ( p . x - q . x ) , Math . Abs ( p . y - q . y ) ) - 1 ; } public static void Main ( String [ ] args ) { Point p = new Point ( 1 , 9 ) ; Point q = new Point ( 8 , 16 ) ; Console . WriteLine ( " The ▁ number ▁ of ▁ integral ▁ points ▁ between ▁ " + " ( " + p . x + " , ▁ " + p . y + " ) ▁ and ▁ ( " + q . x + " , ▁ " + q . y + " ) ▁ is ▁ " + getCount ( p , q ) ) ; } }

Class/struct names: GFG, Point
C# program:
using System ; class GFG { class Point { public int x , y ; public Point ( int x , int y ) { this . x = x ; this . y = y ; } } ; static int distSq ( Point p , Point q ) { return ( p . x - q . x ) * ( p . x - q . x ) + ( p . y - q . y ) * ( p . y - q . y ) ; } static bool isSquare ( Point p1 , Point p2 , Point p3 , Point p4 ) { if ( d2 == 0 d3 == 0 d4 == 0 ) return false ; if ( d2 == d3 && 2 * d2 == d4 && 2 * distSq ( p2 , p4 ) == distSq ( p2 , p3 ) ) { return true ; } if ( d3 == d4 && 2 * d3 == d2 && 2 * distSq ( p3 , p2 ) == distSq ( p3 , p4 ) ) { return true ; } if ( d2 == d4 && 2 * d2 == d3 && 2 * distSq ( p2 , p3 ) == distSq ( p2 , p4 ) ) { return true ; } return false ; } public static void Main ( String [ ] args ) { Point p1 = new Point ( 20 , 10 ) , p2 = new Point ( 10 , 20 ) , p3 = new Point ( 20 , 20 ) , p4 = new Point ( 10 , 10 ) ; Console . WriteLine ( isSquare ( p1 , p2 , p3 , p4 ) == true ? " Yes " : " No " ) ; } }

Class/struct names: GFG, Point
C# program:
using System ; using System . Collections . Generic ; class GFG { static int countDivisors ( int n ) { int divisors = 0 ; int i ; for ( i = 1 ; i * i < n ; i ++ ) { if ( n % i == 0 ) { divisors ++ ; } } if ( i - ( n / i ) == 1 ) { i -- ; } for ( ; i >= 1 ; i -- ) { if ( n % i == 0 ) { divisors ++ ; } } return divisors ; } static int possibleTriplets ( int N ) { int count = 0 ; for ( int i = 1 ; i < N ; i ++ ) { count += countDivisors ( N - i ) ; } return count ; } public static void Main ( ) { int N = 10 ; Console . Write ( possibleTriplets ( N ) ) ; } }

Accumulator variables: count, divisors, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { static int maxPlanes ( int [ ] A , int [ ] B ) { HashSet < int > St = new HashSet < int > ( ) ; for ( int i = 0 ; i < A . Length ; i ++ ) { int t = ( A [ i ] % B [ i ] > 0 ) ? 1 : 0 ; t += ( A [ i ] / B [ i ] ) + t ; St . Add ( t ) ; } return St . Count ; } static public void Main ( ) { int [ ] A = { 1 , 3 , 5 , 4 , 8 } ; int [ ] B = { 1 , 2 , 2 , 1 , 2 } ; Console . WriteLine ( maxPlanes ( A , B ) ) ; } }

Index/key variables: i
Accumulator variables: i, t
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static void predictTheWinner ( int K , int N ) { if ( N % ( K + 1 ) == 0 ) Console . WriteLine ( " Bob " ) ; else Console . WriteLine ( " Alice " ) ; } public static void Main ( string [ ] args ) { int K = 7 , N = 50 ; predictTheWinner ( K , N ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static int maxRightmostElement ( int N , int k , int p , int [ ] arr ) { int ans = arr [ N - 1 ] ; for ( int i = N - 2 ; i >= 0 ; i -- ) { int d = Math . Min ( arr [ i ] / p , k / ( N - 1 - i ) ) ; k -= d * ( N - 1 - i ) ; ans += d * p ; } return ans ; } public static void Main ( string [ ] args ) { int N = 4 , k = 5 , p = 2 ; int [ ] arr = { 3 , 8 , 1 , 4 } ; Console . WriteLine ( maxRightmostElement ( N , k , p , arr ) ) ; } }

Index/key variables: i
Accumulator variables: ans, i, k
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int smallestMaximum ( int N , int K ) { int sum = ( ( N + K - 1 ) / K ) * K ; if ( sum % N != 0 ) return ( sum / N ) + 1 ; else return sum / N ; } public static void Main ( ) { int N = 4 ; int K = 3 ; Console . Write ( smallestMaximum ( N , K ) ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static void findIfPossible ( int N , int S , int X ) { if ( ( S >= X ) && ( S % 2 == X % 2 ) ) { if ( N >= 3 ) { Console . WriteLine ( " Yes " ) ; } if ( N == 1 ) { if ( S == X ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } if ( N == 2 ) { int C = ( S - X ) / 2 ; int A = C ; int B = C ; A = A + X ; if ( ( ( A ^ B ) == X ) ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } } else { Console . WriteLine ( " No " ) ; } } public static void Main ( String [ ] args ) { int N = 3 , S = 10 , X = 4 ; findIfPossible ( N , S , X ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static String isPossible ( int [ ] arr , int n ) { int mini = int . MaxValue ; for ( int i = 0 ; i < n ; i ++ ) mini = Math . Min ( mini , arr [ i ] ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] == mini ) continue ; int Max = ( arr [ i ] + 1 ) / 2 - 1 ; if ( mini < 0 mini > Max ) return " No " ; } return " Yes " ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 1 , 3 , 4 } ; int N = arr . Length ; Console . Write ( isPossible ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static int gcdOfTwoNos ( int num1 , int num2 ) { if ( num1 == 0 ) return num2 ; if ( num2 == 0 ) return num1 ; if ( num1 == num2 ) return num1 ; if ( num1 > num2 ) return gcdOfTwoNos ( num1 - num2 , num2 ) ; return gcdOfTwoNos ( num1 , num2 - num1 ) ; } static int Min_sum ( int [ ] arr , int N ) { int min_sum = 1000000 , maxGcd = 1 ; for ( int i = 0 ; i < N ; i ++ ) { int gcd ; if ( i == 0 ) gcd = arr [ 1 ] ; else { gcd = arr [ i - 1 ] ; } for ( int j = 0 ; j < N ; j ++ ) { if ( j != i ) gcd = gcdOfTwoNos ( gcd , arr [ j ] ) ; } if ( gcd > maxGcd ) maxGcd = gcd ; } return maxGcd ; } public static void Main ( string [ ] args ) { int [ ] arr = { 16 , 5 , 10 , 25 } ; int N = arr . Length ; Console . WriteLine ( Min_sum ( arr , N ) ) ; } }

Index/key variables: j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int countOddIntegers ( int [ ] arr , int N ) { int [ ] Fact = new int [ N ] ; Fact [ 0 ] = 1 ; for ( int i = 1 ; i < N ; i ++ ) { Fact [ i ] = i * Fact [ i - 1 ] ; } int [ ] freq = new int [ 10 ] ; for ( int i = 0 ; i < N ; i ++ ) { freq [ arr [ i ] ] ++ ; } int ans = 0 ; for ( int i = 1 ; i <= 9 ; i += 2 ) { if ( freq [ i ] == 0 ) continue ; freq [ i ] -- ; for ( int j = 1 ; j <= 9 ; j ++ ) { int cur_ans = 0 ; if ( freq [ j ] == 0 ) { continue ; } freq [ j ] -- ; cur_ans = Fact [ N - 2 ] ; for ( int k = 0 ; k <= 9 ; k ++ ) { cur_ans = cur_ans / Fact [ freq [ k ] ] ; } ans += cur_ans ; freq [ j ] ++ ; } freq [ i ] ++ ; } return ans ; } public static void Main ( String [ ] args ) { int [ ] A = { 2 , 3 , 4 , 1 , 2 , 3 } ; int N = A . Length ; Console . Write ( countOddIntegers ( A , N ) ) ; } }

Index/key variables: N, i, j, k
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 int sumOfDigits ( int N ) { int sum = 0 ; while ( N > 0 ) { sum += ( N % 10 ) ; N = N / 10 ; } return sum ; } static int CountPair ( int [ ] arr , int n ) { Dictionary < int , int > mp = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int val = arr [ i ] + sumOfDigits ( arr [ i ] ) ; if ( mp . ContainsKey ( val ) ) mp [ val ] ++ ; else mp . Add ( val , 1 ) ; } int count = 0 ; foreach ( KeyValuePair < int , int > entry in mp ) { int val = entry . Key ; int times = entry . Value ; count += ( ( times * ( times - 1 ) ) / 2 ) ; } return count ; } public static void Main ( ) { int [ ] arr = { 105 , 96 , 20 , 2 , 87 , 96 } ; int N = arr . Length ; Console . Write ( CountPair ( arr , N ) ) ; } }

Index/key variables: i, val
Accumulator variables: count, i, sum
Iterator variables: entry, i
Class/struct names: GFG