dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static int maxLen = 30 ; public class node { public int data ; public node left ; public node right ; public node ( int data ) { left = null ; right = null ; this . data = data ; } } ; static int [ ] segtree = new int [ maxLen * 4 ] ; static int buildTree ( int l , int r , int i , int [ ] arr ) { if ( l == r ) { segtree [ i ] = l ; return l ; } int l1 = buildTree ( l , ( l + r ) / 2 , 2 * i + 1 , arr ) ; int r1 = buildTree ( ( l + r ) / 2 + 1 , r , 2 * i + 2 , arr ) ; if ( arr [ l1 ] > arr [ r1 ] ) segtree [ i ] = l1 ; else segtree [ i ] = r1 ; return segtree [ i ] ; } static int rangeMax ( int l , int r , int rl , int rr , int i , int [ ] arr ) { if ( r < rl l > rr ) return - 1 ; if ( l >= rl && r <= rr ) return segtree [ i ] ; int l1 = rangeMax ( l , ( l + r ) / 2 , rl , rr , 2 * i + 1 , arr ) ; int r1 = rangeMax ( ( l + r ) / 2 + 1 , r , rl , rr , 2 * i + 2 , arr ) ; if ( l1 == - 1 ) return r1 ; if ( r1 == - 1 ) return l1 ; if ( arr [ l1 ] > arr [ r1 ] ) return l1 ; else return r1 ; } static void inorder ( node curr ) { if ( curr == null ) return ; inorder ( curr . left ) ; Console . Write ( curr . data + " ▁ " ) ; inorder ( curr . right ) ; } static node createCartesianTree ( int l , int r , int [ ] arr , int n ) { if ( r < l ) return null ; int m = rangeMax ( 0 , n - 1 , l , r , 0 , arr ) ; node curr = new node ( arr [ m ] ) ; curr . left = createCartesianTree ( l , m - 1 , arr , n ) ; curr . right = createCartesianTree ( m + 1 , r , arr , n ) ; return curr ; } public static void Main ( ) { int [ ] arr = { 8 , 11 , 21 , 100 , 5 , 70 , 55 } ; int n = arr . Length ; buildTree ( 0 , n - 1 , 0 , arr ) ; inorder ( createCartesianTree ( 0 , n - 1 , arr , n ) ) ; } }

Index/key variables: i, l1, m, r1
Class/struct names: GFG, node
C# program:
using System ; using System . Linq ; class GFG { static int kthSmallest ( int [ ] arr , int k , int n ) { int low = arr . Min ( ) ; int high = arr . Max ( ) ; while ( low <= high ) { int mid = low + ( high - low ) / 2 ; int countless = 0 , countequal = 0 ; for ( int i = 0 ; i < n ; ++ i ) { if ( arr [ i ] < mid ) ++ countless ; else if ( arr [ i ] == mid ) ++ countequal ; } if ( countless < k && ( countless + countequal ) >= k ) { return mid ; } else if ( countless >= k ) { high = mid - 1 ; } else if ( countless < k && countless + countequal < k ) { low = mid + 1 ; } } return int . MinValue ; } public static void Main ( String [ ] args ) { int [ ] arr = { 7 , 10 , 4 , 3 , 20 , 15 } ; int n = arr . Length ; int k = 3 ; Console . WriteLine ( kthSmallest ( arr , k , n ) ) ; } }

Index/key variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static void Main ( string [ ] args ) { int lower_bound = 2 ; int upper_bound = 10 ; for ( int i = lower_bound ; i <= upper_bound ; i ++ ) { Console . WriteLine ( i ) ; int response = int . Parse ( Console . ReadLine ( ) ) ; if ( response == 0 ) { Console . WriteLine ( " Number ▁ guessed ▁ is ▁ : " + i ) ; break ; } } } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void Main ( ) { int lower_bound = 2 ; int upper_bound = 10 ; while ( lower_bound <= upper_bound ) { int mid = ( lower_bound + upper_bound ) / 2 ; Console . WriteLine ( mid ) ; int response = Convert . ToInt32 ( Console . ReadLine ( ) ) ; if ( response == - 1 ) { lower_bound = mid + 1 ; } else if ( response == 1 ) { upper_bound = mid - 1 ; } else if ( response == 0 ) { Console . WriteLine ( " Number ▁ guessed ▁ is ▁ : " + mid ) ; break ; } } } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX = 1000 ; static int [ ] tree = new int [ MAX ] ; static int [ ] lazy = new int [ MAX ] ; static void updateRangeUtil ( int si , int ss , int se , int us , int ue , int diff ) { if ( lazy [ si ] != 0 ) { tree [ si ] += lazy [ si ] ; if ( ss != se ) { lazy [ si * 2 + 1 ] += lazy [ si ] ; lazy [ si * 2 + 2 ] += lazy [ si ] ; } lazy [ si ] = 0 ; } if ( ss > se ss > ue se < us ) return ; if ( ss >= us && se <= ue ) { tree [ si ] += diff ; if ( ss != se ) { lazy [ si * 2 + 1 ] += diff ; lazy [ si * 2 + 2 ] += diff ; } return ; } int mid = ( ss + se ) / 2 ; updateRangeUtil ( si * 2 + 1 , ss , mid , us , ue , diff ) ; updateRangeUtil ( si * 2 + 2 , mid + 1 , se , us , ue , diff ) ; tree [ si ] = Math . Max ( tree [ si * 2 + 1 ] , tree [ si * 2 + 2 ] ) ; } static void updateRange ( int n , int us , int ue , int diff ) { updateRangeUtil ( 0 , 0 , n - 1 , us , ue , diff ) ; } static int getSumUtil ( int ss , int se , int qs , int qe , int si ) { if ( lazy [ si ] != 0 ) { tree [ si ] += lazy [ si ] ; if ( ss != se ) { lazy [ si * 2 + 1 ] += lazy [ si ] ; lazy [ si * 2 + 2 ] += lazy [ si ] ; } lazy [ si ] = 0 ; } if ( ss > se ss > qe se < qs ) return 0 ; if ( ss >= qs && se <= qe ) return tree [ si ] ; int mid = ( ss + se ) / 2 ; return Math . Max ( getSumUtil ( ss , mid , qs , qe , 2 * si + 1 ) , getSumUtil ( mid + 1 , se , qs , qe , 2 * si + 2 ) ) ; } static int getSum ( int n , int qs , int qe ) { if ( qs < 0 qe > n - 1 qs > qe ) { Console . Write ( " Invalid ▁ Input " ) ; return - 1 ; } return getSumUtil ( 0 , n - 1 , qs , qe , 0 ) ; } static void constructSTUtil ( int [ ] arr , int ss , int se , int si ) { if ( ss > se ) return ; if ( ss == se ) { tree [ si ] = arr [ ss ] ; return ; } int mid = ( ss + se ) / 2 ; constructSTUtil ( arr , ss , mid , si * 2 + 1 ) ; constructSTUtil ( arr , mid + 1 , se , si * 2 + 2 ) ; tree [ si ] = Math . Max ( tree [ si * 2 + 1 ] , tree [ si * 2 + 2 ] ) ; } static void constructST ( int [ ] arr , int n ) { constructSTUtil ( arr , 0 , n - 1 , 0 ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 4 , 5 } ; int n = arr . Length ; constructST ( arr , n ) ; updateRange ( n , 0 , 3 , 4 ) ; Console . WriteLine ( getSum ( n , 1 , 4 ) ) ; } }

Index/key variables: MAX, si, ss
Class/struct names: GFG
C# program:
class GFG { static long F ( long A , long B ) { if ( A == 1 ) return ( 4 % B ) ; else { long temp = F ( A - 1 , B ) ; return ( temp * temp ) % B ; } } static void Main ( ) { long A = 25 , B = 50 ; System . Console . WriteLine ( F ( A , B ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { const int MOD = 1000000007 ; static int rangeSum ( int l , int r ) { int a = 1 , b = 9 , res = 0 ; for ( int i = 1 ; i <= 10 ; i ++ ) { int L = Math . Max ( l , a ) ; int R = Math . Min ( r , b ) ; if ( L <= R ) { int sum = ( L + R ) * ( R - L + 1 ) / 2 ; res += ( i * i ) * ( sum % MOD ) ; res %= MOD ; } a = a * 10 ; b = b * 10 + 9 ; } return res ; } public static void Main ( ) { int l = 98 , r = 102 ; Console . WriteLine ( rangeSum ( l , r ) ) ; } }

Accumulator variables: i, res
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static List < int > permutation = new List < int > ( ) ; static void printPermutation ( ) { foreach ( int i in permutation ) Console . Write ( i + " ▁ " ) ; } static int give_random_number ( int l , int r ) { Random rnd = new Random ( ) ; int num = rnd . Next ( l , r ) ; int x = ( int ) ( num % ( r - l + 1 ) + l ) ; return x ; } static void generate_random_permutation ( int l , int r ) { if ( l > r ) return ; int n = give_random_number ( l , r ) ; permutation . Add ( n ) ; generate_random_permutation ( l , n - 1 ) ; generate_random_permutation ( n + 1 , r ) ; } public static void Main ( String [ ] args ) { int l = 5 ; int r = 15 ; generate_random_permutation ( l , r ) ; printPermutation ( ) ; } }

Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class solution { static int INF = 99999 ; static int size = 10 ; static int getSetBitsFromOneToN ( int N ) { int two = 2 , ans = 0 ; int n = N ; while ( n != 0 ) { ans += ( N / two ) * ( two >> 1 ) ; if ( ( N & ( two - 1 ) ) > ( two >> 1 ) - 1 ) ans += ( N & ( two - 1 ) ) - ( two >> 1 ) + 1 ; two <<= 1 ; n >>= 1 ; } return ans ; } static int findMinimum ( int x ) { int low = 0 , high = 100000 ; int ans = high ; while ( low <= high ) { int mid = ( low + high ) >> 1 ; if ( getSetBitsFromOneToN ( mid ) >= x ) { ans = Math . Min ( ans , mid ) ; high = mid - 1 ; } else low = mid + 1 ; } return ans ; } public static void Main ( ) { int x = 20 ; Console . WriteLine ( findMinimum ( x ) ) ; } }

Accumulator variables: ans
Class/struct names: solution
C# program:
using System ; class GFG { static int trailingZeroes ( int n ) { int cnt = 0 ; while ( n > 0 ) { n /= 5 ; cnt += n ; } return cnt ; } static void binarySearch ( int n ) { int low = 0 ; int high = 1000000 ; while ( low < high ) { int mid = ( low + high ) / 2 ; int count = trailingZeroes ( mid ) ; if ( count < n ) low = mid + 1 ; else high = mid ; } int [ ] result = new int [ 1000 ] ; int k = 0 ; while ( trailingZeroes ( low ) == n ) { result [ k ] = low ; k ++ ; low ++ ; } for ( int i = 0 ; i < k ; i ++ ) Console . Write ( result [ i ] + " ▁ " ) ; } public static void Main ( ) { int n = 2 ; binarySearch ( n ) ; } }

Index/key variables: i, k
Accumulator variables: cnt, i, k, low, n
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int getCumulateSum ( int n ) { return ( n * ( n + 1 ) ) / 2 ; } static int minDaysToEmpty ( int C , int l ) { if ( C <= l ) return C ; int lo = 0 ; int hi = ( int ) 1e4 ; int mid ; while ( lo < hi ) { mid = ( lo + hi ) / 2 ; if ( getCumulateSum ( mid ) >= ( C - l ) ) hi = mid ; else lo = mid + 1 ; } return ( l + lo ) ; } static public void Main ( ) { int C = 5 ; int l = 2 ; Console . WriteLine ( minDaysToEmpty ( C , l ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int minDaysToEmpty ( int C , int l ) { if ( l >= C ) return C ; double eq_root = ( Math . Sqrt ( 1 + 8 * ( C - l ) ) - 1 ) / 2 ; return ( int ) ( Math . Ceiling ( eq_root ) + l ) ; } static public void Main ( ) { Console . WriteLine ( minDaysToEmpty ( 5 , 2 ) ) ; Console . WriteLine ( minDaysToEmpty ( 6514683 , 4965 ) ) ; } }

Class/struct names: GFG
C# program:
class GFG { static int kth ( int [ ] arr1 , int [ ] arr2 , int m , int n , int k ) { int [ ] sorted1 = new int [ m + n ] ; int i = 0 , j = 0 , d = 0 ; while ( i < m && j < n ) { if ( arr1 [ i ] < arr2 [ j ] ) sorted1 [ d ++ ] = arr1 [ i ++ ] ; else sorted1 [ d ++ ] = arr2 [ j ++ ] ; } while ( i < m ) sorted1 [ d ++ ] = arr1 [ i ++ ] ; while ( j < n ) sorted1 [ d ++ ] = arr2 [ j ++ ] ; return sorted1 [ k - 1 ] ; } static void Main ( ) { int [ ] arr1 = { 2 , 3 , 6 , 7 , 9 } ; int [ ] arr2 = { 1 , 4 , 8 , 10 } ; int k = 5 ; System . Console . WriteLine ( kth ( arr1 , arr2 , 5 , 4 , k ) ) ; } }

Index/key variables: i, j
Accumulator variables: d, i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int kth ( int [ ] arr1 , int [ ] arr2 , int m , int n , int k , int st1 , int st2 ) { if ( st1 == m ) { return arr2 [ st2 + k - 1 ] ; } if ( st2 == n ) { return arr1 [ st1 + k - 1 ] ; } if ( k == 0 || k > ( m - st1 ) + ( n - st2 ) ) { return - 1 ; } if ( k == 1 ) { return ( arr1 [ st1 ] < arr2 [ st2 ] ) ? arr1 [ st1 ] : arr2 [ st2 ] ; } int curr = k / 2 ; if ( curr - 1 >= m - st1 ) { if ( arr1 [ m - 1 ] < arr2 [ st2 + curr - 1 ] ) { return arr2 [ st2 + ( k - ( m - st1 ) - 1 ) ] ; } else { return kth ( arr1 , arr2 , m , n , k - curr , st1 , st2 + curr ) ; } } if ( curr - 1 >= n - st2 ) { if ( arr2 [ n - 1 ] < arr1 [ st1 + curr - 1 ] ) { return arr1 [ st1 + ( k - ( n - st2 ) - 1 ) ] ; } else { return kth ( arr1 , arr2 , m , n , k - curr , st1 + curr , st2 ) ; } } else if ( arr1 [ curr + st1 - 1 ] < arr2 [ curr + st2 - 1 ] ) { return kth ( arr1 , arr2 , m , n , k - curr , st1 + curr , st2 ) ; } else { return kth ( arr1 , arr2 , m , n , k - curr , st1 , st2 + curr ) ; } } public static void Main ( String [ ] args ) { int [ ] arr1 = { 2 , 3 , 6 , 7 , 9 } ; int [ ] arr2 = { 1 , 4 , 8 , 10 } ; int k = 5 ; int st1 = 0 , st2 = 0 ; Console . WriteLine ( kth ( arr1 , arr2 , 5 , 4 , k , st1 , st2 ) ) ; } }

Index/key variables: st1, st2
Class/struct names: GFG
C# program:
using System ; class GFG { static void binarySearch ( int [ , ] mat , int i , int j_low , int j_high , int x ) { while ( j_low <= j_high ) { int j_mid = ( j_low + j_high ) / 2 ; if ( mat [ i , j_mid ] == x ) { Console . Write ( " Found ▁ at ▁ ( " + i + " , ▁ " + j_mid + " ) " ) ; return ; } else if ( mat [ i , j_mid ] > x ) j_high = j_mid - 1 ; else j_low = j_mid + 1 ; } Console . Write ( " Element ▁ no ▁ found " ) ; } static void sortedMatrixSearch ( int [ , ] mat , int n , int m , int x ) { if ( n == 1 ) { binarySearch ( mat , 0 , 0 , m - 1 , x ) ; return ; } int i_low = 0 ; int i_high = n - 1 ; int j_mid = m / 2 ; while ( ( i_low + 1 ) < i_high ) { int i_mid = ( i_low + i_high ) / 2 ; if ( mat [ i_mid , j_mid ] == x ) { Console . Write ( " Found ▁ at ▁ ( " + i_mid + " , ▁ " + j_mid + " ) " ) ; return ; } else if ( mat [ i_mid , j_mid ] > x ) i_high = i_mid ; else i_low = i_mid ; } if ( mat [ i_low , j_mid ] == x ) Console . Write ( " Found ▁ at ▁ ( " + i_low + " , " + j_mid + " ) " ) ; else if ( mat [ i_low + 1 , j_mid ] == x ) Console . Write ( " Found ▁ at ▁ ( " + ( i_low + 1 ) + " , ▁ " + j_mid + " ) " ) ; else if ( x <= mat [ i_low , j_mid - 1 ] ) binarySearch ( mat , i_low , 0 , j_mid - 1 , x ) ; else if ( x >= mat [ i_low , j_mid + 1 ] && x <= mat [ i_low , m - 1 ] ) binarySearch ( mat , i_low , j_mid + 1 , m - 1 , x ) ; else if ( x <= mat [ i_low + 1 , j_mid - 1 ] ) binarySearch ( mat , i_low + 1 , 0 , j_mid - 1 , x ) ; else binarySearch ( mat , i_low + 1 , j_mid + 1 , m - 1 , x ) ; } public static void Main ( String [ ] args ) { int n = 4 , m = 5 , x = 8 ; int [ , ] mat = { { 0 , 6 , 8 , 9 , 11 } , { 20 , 22 , 28 , 29 , 31 } , { 36 , 38 , 50 , 61 , 63 } , { 64 , 66 , 100 , 122 , 128 } } ; sortedMatrixSearch ( mat , n , m , x ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static public int R = 2 ; static public int C = 2 ; static int bsearch ( int low , int high , int n , int [ ] arr ) { int mid = ( low + high ) / 2 ; if ( low <= high ) { if ( arr [ mid ] < n ) return bsearch ( mid + 1 , high , n , arr ) ; return bsearch ( low , mid - 1 , n , arr ) ; } return low ; } public static int [ ] GetRow ( int [ , ] matrix , int row ) { var rowLength = matrix . GetLength ( 1 ) ; var rowVector = new int [ rowLength ] ; for ( var i = 0 ; i < rowLength ; i ++ ) rowVector [ i ] = matrix [ row , i ] ; return rowVector ; } static int mindiff ( int [ , ] arr , int n , int m ) { for ( int i = 0 ; i < n ; i ++ ) Array . Sort ( GetRow ( arr , i ) ) ; int ans = + 2147483647 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { int p = bsearch ( 0 , m - 1 , arr [ i , j ] , GetRow ( arr , i + 1 ) ) ; ans = Math . Min ( ans , Math . Abs ( arr [ i + 1 , p ] - arr [ i , j ] ) ) ; if ( p - 1 >= 0 ) ans = Math . Min ( ans , Math . Abs ( arr [ i + 1 , p - 1 ] - arr [ i , j ] ) ) ; } } return ans ; } public static void Main ( String [ ] args ) { int [ , ] m = { { 8 , 5 } , { 6 , 8 } } ; Console . WriteLine ( mindiff ( m , R , C ) ) ; } }

Index/key variables: i, mid, rowLength
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int binarySearch ( int [ ] arr , int left , int right ) { if ( left <= right ) { int mid = ( left + right ) / 2 ; if ( arr [ mid - 1 ] < arr [ mid ] && arr [ mid ] > arr [ mid + 1 ] ) return mid ; if ( arr [ mid ] < arr [ mid + 1 ] ) return binarySearch ( arr , mid + 1 , right ) ; else return binarySearch ( arr , left , mid - 1 ) ; } return - 1 ; } public static void Main ( ) { int [ ] arr = { 6 , 7 , 8 , 11 , 9 , 5 , 2 , 1 } ; int n = arr . Length ; int index = binarySearch ( arr , 1 , n - 2 ) ; if ( index != - 1 ) Console . Write ( arr [ index ] ) ; } }

Index/key variables: index, mid
Class/struct names: GFG
C# program:
using System ; class Test { static int findRepeatingElement ( int [ ] arr , int low , int high ) { if ( low > high ) return - 1 ; int mid = ( low + high ) / 2 ; if ( arr [ mid ] != mid + 1 ) { if ( mid > 0 && arr [ mid ] == arr [ mid - 1 ] ) return mid ; return findRepeatingElement ( arr , low , mid - 1 ) ; } return findRepeatingElement ( arr , mid + 1 , high ) ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 3 , 4 , 5 } ; int index = findRepeatingElement ( arr , 0 , arr . Length - 1 ) ; if ( index != - 1 ) Console . Write ( arr [ index ] ) ; } }

Index/key variables: index, mid
Class/struct names: Test
C# program:
using System ; class GFG { static double diff ( double n , double mid ) { if ( n > ( mid * mid * mid ) ) return ( n - ( mid * mid * mid ) ) ; else return ( ( mid * mid * mid ) - n ) ; } static double cubicRoot ( double n ) { double start = 0 , end = n ; double e = 0.0000001 ; while ( true ) { double mid = ( start + end ) / 2 ; double error = diff ( n , mid ) ; if ( error <= e ) return mid ; if ( ( mid * mid * mid ) > n ) end = mid ; else start = mid ; } } public static void Main ( ) { double n = 3 ; Console . Write ( " Cube ▁ root ▁ of ▁ " + n + " ▁ is ▁ " + cubicRoot ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void findFrequencyUtil ( int [ ] arr , int low , int high , int [ ] freq ) { if ( arr [ low ] == arr [ high ] ) { freq [ arr [ low ] ] += high - low + 1 ; } else { int mid = ( low + high ) / 2 ; findFrequencyUtil ( arr , low , mid , freq ) ; findFrequencyUtil ( arr , mid + 1 , high , freq ) ; } } static void findFrequency ( int [ ] arr , int n ) { int [ ] freq = new int [ arr [ n - 1 ] + 1 ] ; findFrequencyUtil ( arr , 0 , n - 1 , freq ) ; for ( int i = 0 ; i <= arr [ n - 1 ] ; i ++ ) if ( freq [ i ] != 0 ) Console . WriteLine ( " Element ▁ " + i + " ▁ occurs ▁ " + freq [ i ] + " ▁ times " ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 1 , 1 , 2 , 3 , 3 , 5 , 5 , 8 , 8 , 8 , 9 , 9 , 10 } ; int n = arr . Length ; findFrequency ( arr , n ) ; } }

Index/key variables: high, i, low
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int floorSqrt ( int x ) { if ( x == 0 x == 1 ) return x ; int i = 1 , result = 1 ; while ( result <= x ) { i ++ ; result = i * i ; } return i - 1 ; } static public void Main ( ) { int x = 11 ; Console . WriteLine ( floorSqrt ( x ) ) ; } }

Accumulator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void maxOverlappingRectangles ( int [ ] x1 , int [ ] y1 , int [ ] x2 , int [ ] y2 , int N ) { int max_rectangles = 0 ; List < int > X = new List < int > ( ) ; List < int > Y = new List < int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { X . Add ( x1 [ i ] ) ; X . Add ( x2 [ i ] - 1 ) ; Y . Add ( y1 [ i ] ) ; Y . Add ( y2 [ i ] - 1 ) ; } for ( int i = 0 ; i < X . Count ; i ++ ) { for ( int j = 0 ; j < Y . Count ; j ++ ) { int cnt = 0 ; for ( int k = 0 ; k < N ; k ++ ) { if ( X [ i ] >= x1 [ k ] && X [ i ] + 1 <= x2 [ k ] && Y [ j ] >= y1 [ k ] && Y [ j ] + 1 <= y2 [ k ] ) { cnt ++ ; } } max_rectangles = Math . Max ( max_rectangles , cnt ) ; } } Console . WriteLine ( max_rectangles ) ; } public static void Main ( ) { int [ ] x1 = { 0 , 50 } ; int [ ] y1 = { 0 , 50 } ; int [ ] x2 = { 100 , 60 } ; int [ ] y2 = { 100 , 60 } ; int N = x1 . Length ; maxOverlappingRectangles ( x1 , y1 , x2 , y2 , N ) ; } }

Index/key variables: i, j, k
Accumulator variables: cnt, i, j, k
Iterator variables: i, j, k
Class/struct names: GFG
C# program:
using System ; class GFG { static int isPossibleToReach ( int [ ] A , int N , int X , int Y ) { double distance = Math . Sqrt ( ( X * X + Y * Y ) ) ; double mx = 0 ; for ( int i = 0 ; i < N ; i ++ ) { mx += ( A [ i ] ) ; } if ( mx < distance ) { Console . Write ( " NO " ) ; return 0 ; } if ( ( mx - distance ) < 0.000001 ) { Console . Write ( " YES " ) ; return 0 ; } for ( int i = 0 ; i < N ; i ++ ) { if ( distance + mx < 2 * A [ i ] ) { Console . Write ( " No " ) ; return 0 ; } } Console . Write ( " Yes " ) ; return 0 ; } static public void Main ( ) { int [ ] A = { 2 , 5 } ; int X = 5 , Y = 4 ; int N = A . Length ; isPossibleToReach ( A , N , X , Y ) ; } }

Index/key variables: i
Accumulator variables: i, mx
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static Boolean canReach ( int X , int Y , int steps ) { if ( X == 0 && Y == 0 ) { return true ; } if ( X < 0 Y < 0 ) { return false ; } return ( canReach ( X - ( int ) Math . Pow ( 3 , steps ) , Y , steps + 1 ) | canReach ( X , Y - ( int ) Math . Pow ( 3 , steps ) , steps + 1 ) ) ; } public static void Main ( String [ ] args ) { int X = 10 , Y = 30 ; if ( canReach ( X , Y , 0 ) ) { Console . Write ( " YES " + " STRNEWLINE " ) ; } else Console . Write ( " NO " + " STRNEWLINE " ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static bool canReach ( int X , int Y ) { int steps = 0 ; while ( X != 0 Y != 0 ) { int pos1 = X % 3 ; int pos2 = Y % 3 ; if ( pos1 == 2 pos2 == 2 ) { return false ; } if ( pos1 == 1 && pos2 == 1 ) { return false ; } if ( pos1 == 0 && pos2 == 0 ) { return false ; } X /= 3 ; Y /= 3 ; steps ++ ; } return true ; } public static void Main ( String [ ] args ) { int X = 10 , Y = 30 ; if ( canReach ( X , Y ) ) { Console . WriteLine ( " YES " ) ; } else { Console . WriteLine ( " NO " ) ; } } }

Accumulator variables: X, Y, steps
Class/struct names: GFG
C# program:
using System ; class GFG { static double findRadius ( double r1 , double r2 , double r3 ) { double r4 = ( r1 * r2 * r3 ) / ( r1 * r2 + r2 * r3 + r1 * r3 + 2.0 * Math . Sqrt ( r1 * r2 * r3 * ( r1 + r2 + r3 ) ) ) ; return r4 ; } public static void Main ( String [ ] args ) { double r1 = 1 ; double r2 = 1 ; double r3 = 1 ; double r4 = Math . Round ( findRadius ( r1 , r2 , r3 ) , 6 ) ; Console . Write ( " The ▁ radius ▁ of ▁ fourth ▁ circle : ▁ " + r4 ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static int minimumRectangleArea ( int [ ] A , int N ) { int ans ; Array . Sort ( A ) ; ans = ( A [ N - 1 ] - A [ 0 ] ) * ( A [ 2 * N - 1 ] - A [ N ] ) ; for ( int i = 1 ; i < N ; i ++ ) ans = Math . Min ( ans , ( A [ 2 * N - 1 ] - A [ 0 ] ) * ( A [ i + N - 1 ] - A [ i ] ) ) ; return ans ; } public static void Main ( String [ ] args ) { int [ ] A = { 2 , 4 , 1 , 5 , 3 , 6 , 7 , 8 } ; int N = A . Length ; N = ( int ) N / 2 ; Console . Write ( minimumRectangleArea ( A , N ) ) ; } }

Index/key variables: N, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static double radius ( int a , int b , int c ) { int g = a / 2 ; int f = b / 2 ; if ( g * g + f * f - c < 0 ) return ( - 1 ) ; return ( Math . Sqrt ( g * g + f * f - c ) ) ; } static double centerDistanceFromLine ( int a , int b , int i , int j , int k ) { int g = a / 2 ; int f = b / 2 ; double distance = Math . Abs ( i * g + j * f + k ) / ( Math . Sqrt ( i * i + j * j ) ) ; if ( distance < 0 ) return ( - 1 ) ; return distance ; } static void interceptLength ( int a , int b , int c , int i , int j , int k ) { double rad = radius ( a , b , c ) ; double dist = centerDistanceFromLine ( a , b , i , j , k ) ; if ( rad < 0 dist < 0 ) { Console . WriteLine ( " circle ▁ not ▁ possible " ) ; return ; } if ( dist > rad ) { Console . WriteLine ( " Line ▁ not ▁ cutting ▁ circle " ) ; } else Console . WriteLine ( 2 * Math . Sqrt ( rad * rad - dist * dist ) ) ; } public static void Main ( String [ ] args ) { int a = 0 , b = 0 , c = - 4 ; int i = 2 , j = - 1 , k = 1 ; interceptLength ( a , b , c , i , j , k ) ; } }

Class/struct names: GFG