dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static int count ( int [ ] arr , int low , int high , int x ) { if ( ( low > high ) || ( low == high && arr [ low ] != x ) ) return 0 ; if ( low == high && arr [ low ] == x ) return 1 ; return count ( arr , low , ( low + high ) / 2 , x ) + count ( arr , 1 + ( low + high ) / 2 , high , x ) ; } public static void Main ( ) { int [ ] arr = { 30 , 1 , 42 , 5 , 56 , 3 , 56 , 9 } ; int n = arr . Length ; int x = 56 ; Console . Write ( count ( arr , 0 , n - 1 , x ) ) ; } }

Index/key variables: low
Class/struct names: GFG
C# program:
using System ; class GFG { static int a , b ; static int [ ] swap ( int [ ] arr , int i , int j ) { int temp = arr [ i ] ; arr [ i ] = arr [ j ] ; arr [ j ] = temp ; return arr ; } static int Partition ( int [ ] arr , int l , int r ) { int lst = arr [ r ] , i = l , j = l ; while ( j < r ) { if ( arr [ j ] < lst ) { arr = swap ( arr , i , j ) ; i ++ ; } j ++ ; } arr = swap ( arr , i , r ) ; return i ; } static int randomPartition ( int [ ] arr , int l , int r ) { int n = r - l + 1 ; int pivot = ( int ) ( new Random ( ) . Next ( ) % n ) ; arr = swap ( arr , l + pivot , r ) ; return Partition ( arr , l , r ) ; } static int MedianUtil ( int [ ] arr , int l , int r , int k ) { if ( l <= r ) { int partitionIndex = randomPartition ( arr , l , r ) ; if ( partitionIndex == k ) { b = arr [ partitionIndex ] ; if ( a != - 1 ) return int . MinValue ; } else if ( partitionIndex == k - 1 ) { a = arr [ partitionIndex ] ; if ( b != - 1 ) return int . MinValue ; } if ( partitionIndex >= k ) return MedianUtil ( arr , l , partitionIndex - 1 , k ) ; else return MedianUtil ( arr , partitionIndex + 1 , r , k ) ; } return int . MinValue ; } static void findMedian ( int [ ] arr , int n ) { int ans ; a = - 1 ; b = - 1 ; if ( n % 2 == 1 ) { MedianUtil ( arr , 0 , n - 1 , n / 2 ) ; ans = b ; } else { MedianUtil ( arr , 0 , n - 1 , n / 2 ) ; ans = ( a + b ) / 2 ; } Console . Write ( " Median ▁ = ▁ " + ans ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 12 , 3 , 5 , 7 , 4 , 19 , 26 } ; int n = arr . Length ; findMedian ( arr , n ) ; } }

Index/key variables: i, j, partitionIndex, r
Accumulator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int firstDigit ( int n ) { while ( n >= 10 ) { n /= 10 ; } return n ; } static int getCount ( int n ) { int count = 1 ; while ( n != 0 ) { int leadDigit = firstDigit ( n ) ; n -= leadDigit ; count ++ ; } return count ; } static int getLargestNumber ( int k ) { int left = k ; int right = k * 10 ; int mid = ( left + right ) / 2 ; int len = getCount ( mid ) ; while ( len != k ) { mid = ( left + right ) / 2 ; len = getCount ( mid ) ; if ( len > k ) { right = mid ; } else { left = mid ; } } while ( len == k ) { if ( len != getCount ( mid + 1 ) ) { break ; } mid ++ ; } return ( mid ) ; } public static void Main ( String [ ] args ) { int k = 3 ; Console . WriteLine ( getLargestNumber ( k ) ) ; } }

Accumulator variables: count, mid, n
Class/struct names: GFG
C# program:
using System ; class GFG { static string checkReachability ( int N , int X , int Y ) { if ( X == 0 && Y == 0 ) { return " YES " ; } if ( N % 2 == 0 ) { return " YES " ; } else { if ( X % 2 != Y % 2 ) { return " NO " ; } else { return " YES " ; } } } public static void Main ( string [ ] args ) { int N = 2 ; int X = 5 , Y = 4 ; Console . WriteLine ( checkReachability ( N , X , Y ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void closestsAngle ( int N , int A ) { double mi = Int32 . MaxValue ; int ans = 0 ; for ( int i = 1 ; i < N - 1 ; i ++ ) { double angle = 180.0 * i / N ; if ( Math . Abs ( angle - A ) < Math . Abs ( mi - A ) ) { mi = angle ; ans = i ; } } Console . Write ( 2 + " ▁ " + 1 + " ▁ " + ( 2 + ans ) ) ; } public static void Main ( ) { int N = 3 , A = 15 ; closestsAngle ( N , A ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static double areaOftriangle ( int side ) { double a = Math . Sqrt ( Math . Pow ( side / 2 , 2 ) + Math . Pow ( side / 2 , 2 ) ) ; double b = Math . Sqrt ( Math . Pow ( side , 2 ) + Math . Pow ( side / 2 , 2 ) ) ; double c = Math . Sqrt ( Math . Pow ( side , 2 ) + Math . Pow ( side / 2 , 2 ) ) ; double s = ( a + b + c ) / 2 ; double area = Math . Sqrt ( s * ( s - a ) * ( s - b ) * ( s - c ) ) ; return area ; } public static void Main ( string [ ] args ) { int N = 10 ; Console . WriteLine ( areaOftriangle ( N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void findLine ( int distance , float degree ) { float x = ( float ) ( degree * 3.14159 / 180 ) ; if ( degree > 90 ) { Console . WriteLine ( " Not ▁ Possible " ) ; return ; } float result_1 = ( float ) ( Math . Sin ( x ) ) ; float result_2 = ( float ) ( Math . Cos ( x ) ) ; Console . WriteLine ( result_2 . ToString ( "0.00" ) + " x ▁ + " + result_1 . ToString ( "0.00" ) + " y ▁ = ▁ " + distance ) ; } static void Main ( ) { int D = 10 ; float A = 30 ; findLine ( D , A ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int centralPoints ( int [ , ] arr , int N ) { int count = 0 ; int c1 , c2 , c3 , c4 ; for ( int i = 0 ; i < N ; i ++ ) { c1 = 0 ; c2 = 0 ; c3 = 0 ; c4 = 0 ; int x = arr [ i , 0 ] ; int y = arr [ i , 1 ] ; for ( int j = 0 ; j < N ; j ++ ) { if ( arr [ j , 0 ] > x && arr [ j , 1 ] == y ) { c1 = 1 ; } if ( arr [ j , 1 ] > y && arr [ j , 0 ] == x ) { c2 = 1 ; } if ( arr [ j , 0 ] < x && arr [ j , 1 ] == y ) { c3 = 1 ; } if ( arr [ j , 1 ] < y && arr [ j , 0 ] == x ) { c4 = 1 ; } } if ( c1 + c2 + c3 + c4 == 4 ) { count ++ ; } } return count ; } public static void Main ( string [ ] args ) { int [ , ] arr = { { 1 , 0 } , { 2 , 0 } , { 1 , 1 } , { 1 , - 1 } } ; int N = arr . GetLength ( 0 ) ; Console . WriteLine ( centralPoints ( arr , N ) ) ; } }

Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void finalPosition ( char [ ] a , int [ ] b , int M ) { int n = 0 , s = 0 , e = 0 , w = 0 ; char p = ' N ' ; for ( int i = 0 ; i < M ; i ++ ) { if ( p == ' N ' ) { if ( a [ i ] == ' U ' ) { p = ' N ' ; n = n + b [ i ] ; } else if ( a [ i ] == ' D ' ) { p = ' S ' ; s = s + b [ i ] ; } else if ( a [ i ] == ' R ' ) { p = ' E ' ; e = e + b [ i ] ; } else if ( a [ i ] == ' L ' ) { p = ' W ' ; w = w + b [ i ] ; } } else if ( p == ' S ' ) { if ( a [ i ] == ' U ' ) { p = ' S ' ; s = s + b [ i ] ; } else if ( a [ i ] == ' D ' ) { p = ' N ' ; n = n + b [ i ] ; } else if ( a [ i ] == ' R ' ) { p = ' W ' ; w = w + b [ i ] ; } else if ( a [ i ] == ' L ' ) { p = ' E ' ; e = e + b [ i ] ; } } else if ( p == ' E ' ) { if ( a [ i ] == ' U ' ) { p = ' E ' ; e = e + b [ i ] ; } else if ( a [ i ] == ' D ' ) { p = ' W ' ; w = w + b [ i ] ; } else if ( a [ i ] == ' R ' ) { p = ' S ' ; s = s + b [ i ] ; } else if ( a [ i ] == ' L ' ) { p = ' N ' ; n = n + b [ i ] ; } } else if ( p == ' W ' ) { if ( a [ i ] == ' U ' ) { p = ' W ' ; w = w + b [ i ] ; } else if ( a [ i ] == ' D ' ) { p = ' E ' ; e = e + b [ i ] ; } else if ( a [ i ] == ' R ' ) { p = ' N ' ; n = n + b [ i ] ; } else if ( a [ i ] == ' L ' ) { p = ' S ' ; s = s + b [ i ] ; } } } int ver_disp = n - s ; int hor_disp = e - w ; int displacement = ( int ) Math . Ceiling ( Math . Sqrt ( ( ver_disp * ver_disp ) + ( hor_disp * hor_disp ) ) ) ; Console . WriteLine ( displacement + " ▁ " + p ) ; } public static void Main ( ) { char [ ] A = { ' U ' , ' R ' , ' R ' , ' R ' , ' R ' } ; int [ ] B = { 1 , 1 , 1 , 1 , 0 } ; int N = 1 ; finalPosition ( A , B , N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static double lengthOfLatusRectum ( double A , double B ) { double major = 2.0 * A ; double minor = 2.0 * B ; double latus_rectum = ( minor * minor ) / major ; return latus_rectum ; } public static void Main ( ) { double A = 3.0 , B = 2.0 ; Console . WriteLine ( lengthOfLatusRectum ( A , B ) ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static void coneSlantHeight ( double cone_h , double cone_r ) { double slant_height_cone = Math . Sqrt ( Math . Pow ( cone_h , 2 ) + Math . Pow ( cone_r , 2 ) ) ; Console . WriteLine ( " Slant ▁ height ▁ of ▁ cone ▁ is : ▁ " + slant_height_cone ) ; } static void pyramidSlantHeight ( double pyramid_h , double pyramid_s ) { double slant_height_pyramid = Math . Sqrt ( Math . Pow ( pyramid_s / 2 , 2 ) + Math . Pow ( pyramid_h , 2 ) ) ; Console . WriteLine ( " Slant ▁ height ▁ of ▁ pyramid ▁ is : ▁ " + slant_height_pyramid ) ; } public static void Main ( string [ ] args ) { double H1 = 4.5 , R = 6 ; coneSlantHeight ( H1 , R ) ; double H2 = 4 , S = 4.8 ; pyramidSlantHeight ( H2 , S ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { class pair { public float first ; public float second ; public pair ( float first , float second ) { this . first = first ; this . second = second ; } } static float distance ( float x1 , float y1 , float x2 , float y2 ) { return ( float ) Math . Sqrt ( ( x2 - x1 ) * ( x2 - x1 ) + ( y2 - y1 ) * ( y2 - y1 ) ) ; } static void lengthOfLatusRectum ( float a , float b , float c ) { pair vertex = new pair ( ( - b / ( 2 * a ) ) , ( ( ( 4 * a * c ) - ( b * b ) ) / ( 4 * a ) ) ) ; pair focus = new pair ( ( - b / ( 2 * a ) ) , ( ( ( 4 * a * c ) - ( b * b ) + 1 ) / ( 4 * a ) ) ) ; Console . Write ( 4 * distance ( ( float ) focus . first , ( float ) focus . second , ( float ) vertex . first , ( float ) vertex . second ) ) ; } public static void Main ( String [ ] args ) { float a = 3 , b = 5 , c = 1 ; lengthOfLatusRectum ( a , b , c ) ; } }

Class/struct names: GFG, pair
C# program:
using System ; class GFG { public class pair { public double first , second ; public pair ( double first , double second ) { this . first = first ; this . second = second ; } } static double distance ( pair p1 , pair p2 ) { double x1 = p1 . first , x2 = p2 . first ; double y1 = p1 . second , y2 = p2 . second ; return Math . Sqrt ( Math . Pow ( x2 - x1 , 2 ) + Math . Pow ( y2 - y1 , 2 ) * 1.0 ) ; } static pair find_orthocenter ( pair A , pair B , pair C ) { double AB = distance ( A , B ) ; double BC = distance ( B , C ) ; double CA = distance ( C , A ) ; if ( AB > BC && AB > CA ) return C ; if ( BC > AB && BC > CA ) return A ; return B ; } static pair find_circumcenter ( pair A , pair B , pair C ) { double AB = distance ( A , B ) ; double BC = distance ( B , C ) ; double CA = distance ( C , A ) ; if ( AB > BC && AB > CA ) return new pair ( ( A . first + B . first ) / 2 , ( A . second + B . second ) / 2 ) ; if ( BC > AB && BC > CA ) return new pair ( ( B . first + C . first ) / 2 , ( B . second + C . second ) / 2 ) ; return new pair ( ( C . first + A . first ) / 2 , ( C . second + A . second ) / 2 ) ; } static void findDistance ( pair A , pair B , pair C ) { pair circumcenter = find_circumcenter ( A , B , C ) ; pair orthocenter = find_orthocenter ( A , B , C ) ; double distance_between = distance ( circumcenter , orthocenter ) ; Console . Write ( distance_between + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { pair A , B , C ; A = new pair ( 0.0 , 0.0 ) ; B = new pair ( 6.0 , 0.0 ) ; C = new pair ( 0.0 , 8.0 ) ; findDistance ( A , B , C ) ; } }

Class/struct names: GFG, pair
C# program:
using System ; using System . Collections ; using System . Collections . Generic ; class GFG { public class store : IComparer < KeyValuePair < int , int > > { public int Compare ( KeyValuePair < int , int > x , KeyValuePair < int , int > y ) { if ( x . Key != y . Key ) { return x . Key . CompareTo ( y . Key ) ; } else { return x . Value . CompareTo ( y . Value ) ; } } } static void generatePoints ( int L , int W ) { SortedSet < KeyValuePair < int , int > > hash = new SortedSet < KeyValuePair < int , int > > ( new store ( ) ) ; int total = ( L * W ) ; Random rand = new Random ( ) ; while ( ( total -- ) != 0 ) { int X = rand . Next ( ) % L ; int Y = rand . Next ( ) % W ; while ( hash . Contains ( new KeyValuePair < int , int > ( X , Y ) ) ) { X = rand . Next ( ) % L ; Y = rand . Next ( ) % W ; } hash . Add ( new KeyValuePair < int , int > ( X , Y ) ) ; } foreach ( KeyValuePair < int , int > x in hash ) { Console . Write ( " ( " + x . Key + " , ▁ " + x . Value + " ) ▁ " ) ; } } public static void Main ( string [ ] args ) { int L = 3 , W = 2 ; generatePoints ( L , W ) ; } }

Accumulator variables: total
Iterator variables: x
Class/struct names: GFG, store
C# program:
using System ; class GFG { public static int noOfTriangles ( int n ) { return ( n * ( n + 2 ) * ( 2 * n + 1 ) / 8 ) ; } public static void Main ( String [ ] args ) { int n = 3 ; Console . Write ( noOfTriangles ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int findNumberOfDigits ( int n , int bas ) { int dig = ( ( int ) Math . Floor ( Math . Log ( n ) / Math . Log ( bas ) ) + 1 ) ; return dig ; } static bool isAllKs ( int n , int b , int k ) { int len = findNumberOfDigits ( n , b ) ; int sum = k * ( 1 - ( int ) Math . Pow ( b , len ) ) / ( 1 - b ) ; return sum == n ; } public static void Main ( ) { int N = 13 ; int B = 3 ; int K = 1 ; if ( isAllKs ( N , B , K ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void checkRightAngled ( int X1 , int Y1 , int X2 , int Y2 , int X3 , int Y3 ) { int A = ( int ) Math . Pow ( ( X2 - X1 ) , 2 ) + ( int ) Math . Pow ( ( Y2 - Y1 ) , 2 ) ; int B = ( int ) Math . Pow ( ( X3 - X2 ) , 2 ) + ( int ) Math . Pow ( ( Y3 - Y2 ) , 2 ) ; int C = ( int ) Math . Pow ( ( X3 - X1 ) , 2 ) + ( int ) Math . Pow ( ( Y3 - Y1 ) , 2 ) ; if ( ( A > 0 && B > 0 && C > 0 ) && ( A == ( B + C ) || B == ( A + C ) || C == ( A + B ) ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } public static void Main ( String [ ] s ) { int X1 = 0 , Y1 = 2 ; int X2 = 0 , Y2 = 14 ; int X3 = 9 , Y3 = 2 ; checkRightAngled ( X1 , Y1 , X2 , Y2 , X3 , Y3 ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void createPrefixArray ( int n , int [ ] arr , int prefSize , int [ ] pref ) { for ( int i = 0 ; i < prefSize ; i ++ ) { pref [ i ] = 0 ; } for ( int i = 0 ; i < n ; i ++ ) { int x = arr [ i ] + 1000000 ; pref [ x ] ++ ; } for ( int i = 1 ; i < prefSize ; i ++ ) { pref [ i ] += pref [ i - 1 ] ; } } static int pointsOfIntersection ( int m , int [ , ] segments , int size , int [ ] pref ) { int ans = 0 ; for ( int i = 0 ; i < m ; i ++ ) { int x1 = segments [ i , 0 ] ; int x2 = segments [ i , 2 ] ; x1 = x1 + 1000000 ; x2 = x2 + 1000000 ; if ( x1 != x2 ) { if ( x1 > x2 ) { int temp = x1 ; x1 = x2 ; x2 = temp ; } int Occ_Till_Right = pref [ x2 - 1 ] ; int Occ_Till_Left = pref [ x1 ] ; ans = ans + ( Occ_Till_Right - Occ_Till_Left ) ; } } return ans ; } public static void Main ( String [ ] args ) { int N = 4 ; int M = 8 ; int size = 2000000 + 2 ; int [ ] pref = new int [ size ] ; int [ ] lines = { - 5 , - 3 , 2 , 3 } ; int [ , ] segments = { { - 2 , 5 , 5 , - 6 } , { - 5 , - 2 , - 3 , - 5 } , { - 2 , 3 , - 6 , 1 } , { - 1 , - 3 , 4 , 2 } , { 2 , 5 , 2 , 1 } , { 4 , 5 , 4 , - 5 } , { - 2 , - 4 , 5 , 3 } , { 1 , 2 , - 2 , 1 } } ; createPrefixArray ( N , lines , size , pref ) ; Console . Write ( pointsOfIntersection ( M , segments , size , pref ) + " STRNEWLINE " ) ; } }

Index/key variables: i, size, x, x1
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int count_rectangles ( int N , int M ) { int p_x = ( N * ( N - 1 ) ) / 2 ; int p_y = ( M * ( M - 1 ) ) / 2 ; return p_x * p_y ; } public static void Main ( ) { int N = 3 ; int M = 6 ; Console . Write ( count_rectangles ( N , M ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void calculateAngle ( int x1 , int y1 , int z1 , int x2 , int y2 , int z2 , int x3 , int y3 , int z3 ) { int ABx = x1 - x2 ; int ABy = y1 - y2 ; int ABz = z1 - z2 ; int BCx = x3 - x2 ; int BCy = y3 - y2 ; int BCz = z3 - z2 ; double dotProduct = ABx * BCx + ABy * BCy + ABz * BCz ; double magnitudeAB = ABx * ABx + ABy * ABy + ABz * ABz ; double magnitudeBC = BCx * BCx + BCy * BCy + BCz * BCz ; double angle = dotProduct ; angle /= Math . Sqrt ( magnitudeAB * magnitudeBC ) ; angle = ( angle * 180 ) / 3.14 ; Console . Write ( String . Format ( " { 0 : F4 } " , Math . Abs ( angle ) ) ) ; } public static void Main ( ) { int x1 = 1 , y1 = 3 , z1 = 3 ; int x2 = 3 , y2 = 4 , z2 = 5 ; int x3 = 5 , y3 = 6 , z3 = 9 ; calculateAngle ( x1 , y1 , z1 , x2 , y2 , z2 , x3 , y3 , z3 ) ; } }

Accumulator variables: angle
Class/struct names: GFG
C# program:
using System ; class GFG { static int calcAngle ( double h , double m ) { if ( h < 0 m < 0 h > 12 m > 60 ) Console . Write ( " Wrong ▁ input " ) ; if ( h == 12 ) h = 0 ; if ( m == 60 ) m = 0 ; int hour_angle = ( int ) ( 0.5 * ( h * 60 + m ) ) ; int minute_angle = ( int ) ( 6 * m ) ; int angle = Math . Abs ( hour_angle - minute_angle ) ; angle = Math . Min ( 360 - angle , angle ) ; return angle ; } static float cal_cos ( float n ) { float accuracy = ( float ) 0.0001 , x1 , denominator , cosx , cosval ; n = ( float ) ( n * ( 3.142 / 180.0 ) ) ; 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 distanceEndpoints ( 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 ( ) { int hour = 3 ; int min = 30 ; int hourHand = 3 ; int minHand = 4 ; double angle = calcAngle ( hour , min ) ; float distance = distanceEndpoints ( minHand , hourHand , ( long ) angle ) ; Console . Write ( distance ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int Octadecagonal_num ( int n ) { return ( 16 * n * n - 14 * n ) / 2 ; } public static void Main ( string [ ] args ) { int n = 3 ; Console . Write ( Octadecagonal_num ( n ) + " STRNEWLINE " ) ; n = 10 ; Console . Write ( Octadecagonal_num ( n ) + " STRNEWLINE " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int IcositrigonalNum ( int n ) { return ( 21 * n * n - 19 * n ) / 2 ; } public static void Main ( ) { int n = 3 ; Console . WriteLine ( IcositrigonalNum ( n ) ) ; n = 10 ; Console . WriteLine ( IcositrigonalNum ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; using System . Linq ; class GFG { static int calculate_change ( int length , int breadth ) { int change = 0 ; change = length + breadth + ( ( length * breadth ) / 100 ) ; return change ; } public static void Main ( String [ ] args ) { int cL = 20 ; int cB = - 10 ; int cA = calculate_change ( cL , cB ) ; Console . Write ( cA ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int solve ( int n , int m , int obstacles , double [ ] range ) { double val = Math . Min ( n , m ) ; Array . Sort ( range ) ; int c = 1 ; for ( int i = obstacles - 1 ; i >= 0 ; i -- ) { range [ i ] = 2 * range [ i ] ; val -= range [ i ] ; if ( val <= 0 ) { return c ; } else { c ++ ; } } if ( val > 0 ) { return - 1 ; } return 0 ; } public static void Main ( ) { int n = 4 , m = 5 , obstacles = 3 ; double [ ] range = { 1.0 , 1.25 , 1.15 } ; Console . WriteLine ( solve ( n , m , obstacles , range ) ) ; } }

Index/key variables: i
Accumulator variables: c, i, val
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static double area ( double d1 , double a ) { double d2 = Math . Sqrt ( 4 * ( a * a ) - d1 * d1 ) ; double area = 0.5 * d1 * d2 ; return area ; } public static void Main ( String [ ] args ) { double d = 7.07 ; double a = 5 ; Console . WriteLine ( area ( d , a ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool pointsAreOnSameSideOfLine ( int a , int b , int c , int x1 , int y1 , int x2 , int y2 ) { fx1 = a * x1 + b * y1 - c ; fx2 = a * x2 + b * y2 - c ; if ( ( fx1 * fx2 ) > 0 ) return true ; return false ; } public static void Main ( ) { int a = 1 , b = 1 , c = 1 ; int x1 = 1 , y1 = 1 ; int x2 = 2 , y2 = 1 ; if ( pointsAreOnSameSideOfLine ( a , b , c , x1 , y1 , x2 , y2 ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void newvol ( double x ) { Console . Write ( " percentage ▁ increase ▁ " + " in ▁ the ▁ volume ▁ of ▁ the ▁ cube ▁ is ▁ " + ( Math . Pow ( x , 3 ) / 10000 + 3 * x + ( 3 * Math . Pow ( x , 2 ) ) / 100 ) ) ; Console . Write ( " % " ) ; } public static void Main ( ) { double x = 10 ; newvol ( x ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void findTriangles ( int n ) { int num = n ; Console . Write ( num + " ▁ " ) ; Console . WriteLine ( num * ( num - 4 ) * ( num - 5 ) / 6 ) ; } public static void Main ( ) { int n ; n = 6 ; findTriangles ( n ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void radius ( int n , int d ) { Console . Write ( " The ▁ radius ▁ of ▁ each ▁ circle ▁ is ▁ " + d / ( 2 * n - 2 ) ) ; } static public void Main ( ) { int d = 42 , n = 4 ; radius ( n , d ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void radius ( int n , int d ) { Console . Write ( " The ▁ side ▁ of ▁ each ▁ square ▁ is ▁ " + d / ( n - 1 ) ) ; } public static void Main ( ) { int d = 42 , n = 4 ; radius ( n , d ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void findTriangles ( int n ) { int num ; num = n * ( n - 4 ) ; Console . WriteLine ( num ) ; } public static void Main ( ) { int n ; n = 6 ; findTriangles ( n ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void diameter ( double r ) { Console . WriteLine ( " The ▁ length ▁ of ▁ the ▁ longest ▁ chord " + " ▁ or ▁ diameter ▁ of ▁ the ▁ circle ▁ is ▁ " + 2 * r ) ; } public static void Main ( String [ ] args ) { double r = 4 ; diameter ( r ) ; } }

Class/struct names: GFG
C# program:
class GFG { static double getSlope ( double m ) { return m ; } static void Main ( ) { double m = 2 ; System . Console . Write ( getSlope ( m ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static int totalTriangles ( int h , int v ) { if ( h == 0 && v == 0 ) return 1 ; if ( h == 0 ) return ( ( v + 1 ) * ( v + 2 ) / 2 ) ; if ( v == 0 ) return ( h + 1 ) ; int total = ( h + 1 ) * ( ( v + 1 ) * ( v + 2 ) / 2 ) ; return total ; } public static void Main ( ) { int h = 2 , v = 2 ; Console . Write ( totalTriangles ( h , v ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class gfg { static float sph ( float r , float R , float h ) { if ( r < 0 && R < 0 && h < 0 ) return - 1 ; float x = r ; float V = ( float ) ( 4 * 3.14f * Math . Pow ( r , 3 ) ) / 3 ; return V ; } public static void Main ( ) { float r = 5 , R = 8 , h = 11 ; Console . WriteLine ( sph ( r , R , h ) ) ; } }

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

Class/struct names: GFG
C# program:
using System ; public class GFG { public static float hexagonArea ( float d ) { return ( float ) ( ( 3 * Math . Sqrt ( 3 ) * d * d ) / 8 ) ; } static public void Main ( ) { float d = 10 ; Console . WriteLine ( " Area ▁ of ▁ hexagon : ▁ " + hexagonArea ( d ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int Squares ( int n , int m , int a ) { return ( ( m + a - 1 ) / a ) * ( ( n + a - 1 ) / a ) ; } static void Main ( ) { int n = 6 , m = 6 , a = 4 ; Console . WriteLine ( Squares ( n , m , a ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static double octadiagonal ( double a ) { if ( a < 0 ) return - 1 ; return a * Math . Sqrt ( 4 + ( 2 * Math . Sqrt ( 2 ) ) ) ; } public static void Main ( ) { double a = 4 ; Console . WriteLine ( octadiagonal ( a ) ) ; } }

Class/struct names: GFG