dhyuti-n/xlcost-variable-roles huggingface dataset:
Java 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 ; } } public static void main ( String args [ ] ) { long A = 25 , B = 50 ; System . out . println ( F ( A , B ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static final 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 ( String args [ ] ) { int l = 98 , r = 102 ; System . out . print ( rangeSum ( l , r ) ) ; } }

Accumulator variables: i, res
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . Vector ; class GFG { static Vector < Integer > permutation = new Vector < > ( ) ; static void printPermutation ( ) { permutation . stream ( ) . forEach ( ( i ) -> { System . out . print ( i + " ▁ " ) ; } ) ; } static int give_random_number ( int l , int r ) { int x = ( int ) ( Math . random ( ) % ( 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 ( ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; 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 ( String args [ ] ) { int x = 20 ; System . out . println ( findMinimum ( x ) ) ; } }

Accumulator variables: ans
Class/struct names: solution
Java program:
import java . io . * ; 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 ++ ) System . out . print ( result [ i ] + " ▁ " ) ; } public static void main ( String args [ ] ) { int n = 3 ; binarySearch ( n ) ; } }

Index/key variables: i, k
Accumulator variables: cnt, i, k, low, n
Iterator variables: i
Class/struct names: GFG
Java program:
public class Tank_Empty { 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 ) ; } public static void main ( String args [ ] ) { int C = 5 ; int l = 2 ; System . out . println ( minDaysToEmpty ( C , l ) ) ; } }

Class/struct names: Tank_Empty
Java program:
import java . lang . * ; 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 . ceil ( eq_root ) + l ) ; } public static void main ( String [ ] args ) { System . out . println ( minDaysToEmpty ( 5 , 2 ) ) ; System . out . println ( minDaysToEmpty ( 6514683 , 4965 ) ) ; } }

Class/struct names: GFG
Java program:
class Main { 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 ] ; } public static void main ( String [ ] args ) { int arr1 [ ] = { 2 , 3 , 6 , 7 , 9 } ; int arr2 [ ] = { 1 , 4 , 8 , 10 } ; int k = 5 ; System . out . print ( kth ( arr1 , arr2 , 5 , 4 , k ) ) ; } }

Index/key variables: i, j
Accumulator variables: d, i, j
Class/struct names: Main
Java program:
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 ; System . out . println ( kth ( arr1 , arr2 , 5 , 4 , k , st1 , st2 ) ) ; } }

Index/key variables: st1, st2
Class/struct names: GFG
Java program:
import java . util . Arrays ; class Gfg { static int kth ( int arr1 [ ] , int m , int arr2 [ ] , int n , int k ) { if ( k > ( m + n ) k < 1 ) return - 1 ; if ( m > n ) return kth ( arr2 , n , arr1 , m , k ) ; if ( m == 0 ) return arr2 [ k - 1 ] ; if ( k == 1 ) return Math . min ( arr1 [ 0 ] , arr2 [ 0 ] ) ; int i = Math . min ( m , k / 2 ) ; int j = Math . min ( n , k / 2 ) ; if ( arr1 [ i - 1 ] > arr2 [ j - 1 ] ) { int temp [ ] = Arrays . copyOfRange ( arr2 , j , n ) ; return kth ( arr1 , m , temp , n - j , k - j ) ; } int temp [ ] = Arrays . copyOfRange ( arr1 , i , m ) ; return kth ( temp , m - i , arr2 , n , k - i ) ; } public static void main ( String [ ] args ) { int arr1 [ ] = { 2 , 3 , 6 , 7 , 9 } ; int arr2 [ ] = { 1 , 4 , 8 , 10 } ; int m = arr1 . length ; int n = arr2 . length ; int k = 5 ; int ans = kth ( arr1 , m , arr2 , n , k ) ; if ( ans == - 1 ) System . out . println ( " Invalid ▁ query " ) ; else System . out . println ( ans ) ; } }

Class/struct names: Gfg
Java program:
import java . util . * ; class GFG { static int kth ( int a [ ] , int b [ ] , int n , int m , int k ) { PriorityQueue < Integer > pq = new PriorityQueue < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { pq . offer ( a [ i ] ) ; } for ( int i = 0 ; i < m ; i ++ ) { pq . offer ( b [ i ] ) ; } while ( k -- > 1 ) { pq . remove ( ) ; } return pq . peek ( ) ; } public static void main ( String [ ] args ) { int arr1 [ ] = { 2 , 3 , 6 , 7 , 9 } ; int arr2 [ ] = { 1 , 4 , 8 , 10 } ; int k = 5 ; System . out . print ( kth ( arr1 , arr2 , 5 , 4 , k ) ) ; } }

Index/key variables: i
Accumulator variables: i, k
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int MAX = 100 ; 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 ) { System . out . println ( " Found ▁ at ▁ ( " + i + " , ▁ " + j_mid + " ) " ) ; return ; } else if ( mat [ i ] [ j_mid ] > x ) j_high = j_mid - 1 ; else j_low = j_mid + 1 ; } System . out . println ( " 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 ) { System . out . println ( " 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 ) System . out . println ( " Found ▁ at ▁ ( " + i_low + " , " + j_mid + " ) " ) ; else if ( mat [ i_low + 1 ] [ j_mid ] == x ) System . out . println ( " 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 ) ; } }

Index/key variables: i, i_low, i_mid, j_mid
Class/struct names: GFG
Java program:
import java . util . Arrays ; class GFG { static final int R = 2 ; static final 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 ; } static int mindiff ( int arr [ ] [ ] , int n , int m ) { for ( int i = 0 ; i < n ; i ++ ) Arrays . sort ( 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 ] , 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 } } ; System . out . println ( mindiff ( m , R , C ) ) ; } }

Index/key variables: i, j, mid, p
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . io . * ; 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 ( String [ ] args ) { int arr [ ] = { 6 , 7 , 8 , 11 , 9 , 5 , 2 , 1 } ; int n = arr . length ; int index = binarySearch ( arr , 1 , n - 2 ) ; if ( index != - 1 ) System . out . println ( arr [ index ] ) ; } }

Index/key variables: index, mid
Class/struct names: GFG
Java program:
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 ( String [ ] args ) { int arr [ ] = { 1 , 2 , 3 , 3 , 4 , 5 } ; int index = findRepeatingElement ( arr , 0 , arr . length - 1 ) ; if ( index != - 1 ) System . out . println ( arr [ index ] ) ; } }

Index/key variables: index, mid
Class/struct names: Test
Java program:
import java . io . * ; 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 ( String [ ] args ) { double n = 3 ; System . out . println ( " Cube ▁ root ▁ of ▁ " + n + " ▁ is ▁ " + cubicRoot ( n ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; 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 ) System . out . println ( " 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
Java program:
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 ; } public static void main ( String [ ] args ) { int x = 11 ; System . out . print ( floorSqrt ( x ) ) ; } }

Accumulator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; 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 ) { System . out . print ( " NO " ) ; return 0 ; } if ( ( mx - distance ) < 0.000001 ) { System . out . print ( " YES " ) ; return 0 ; } for ( int i = 0 ; i < N ; i ++ ) { if ( distance + mx < 2 * A [ i ] ) { System . out . print ( " No " ) ; return 0 ; } } System . out . print ( " Yes " ) ; return 0 ; } public static void main ( String [ ] args ) { 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
Java program:
import java . util . * ; 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 ) ) { System . out . print ( " YES " + "NEW_LINE"); } else System . out . print ( " NO " + "NEW_LINE"); } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static boolean 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 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } }

Accumulator variables: X, Y, steps
Class/struct names: GFG
Java program:
import java . io . * ; 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 = findRadius ( r1 , r2 , r3 ) ; System . out . println ( " The ▁ radius ▁ of ▁ fourth ▁ circle : ▁ " + r4 ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; import java . util . Arrays ; class GFG { public static int minimumRectangleArea ( int A [ ] , int N ) { int ans ; Arrays . 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 ; System . out . println ( minimumRectangleArea ( A , N ) ) ; } }

Index/key variables: N, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; 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 ( String [ ] args ) { double A = 3.0 , B = 2.0 ; System . out . println ( lengthOfLatusRectum ( A , B ) ) ; } }

Class/struct names: GFG
Java program:
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 ) { System . out . println ( " circle ▁ not ▁ possible " ) ; return ; } if ( dist > rad ) { System . out . println ( " Line ▁ not ▁ cutting ▁ circle " ) ; } else System . out . println ( 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
Java program:
public class GFG { static void check_position ( int a , int b , int c , int d , int x1 , int y1 , int z1 , int x2 , int y2 , int z2 ) { int value_1 = a * x1 + b * y1 + c * z1 + d ; int value_2 = a * x2 + b * y2 + c * z2 + d ; if ( ( value_1 > 0 && value_2 > 0 ) || ( value_1 < 0 && value_2 < 0 ) ) System . out . print ( " On ▁ same ▁ side " ) ; if ( ( value_1 > 0 && value_2 < 0 ) || ( value_1 < 0 && value_2 > 0 ) ) System . out . print ( " On ▁ different ▁ sides " ) ; if ( value_1 == 0 && value_2 == 0 ) System . out . print ( " Both ▁ on ▁ the ▁ plane " ) ; if ( value_1 == 0 && value_2 != 0 ) System . out . print ( " Point ▁ 1 ▁ on ▁ the ▁ plane " ) ; if ( value_1 != 0 && value_2 == 0 ) System . out . print ( " Point ▁ 2 ▁ on ▁ the ▁ plane " ) ; } public static void main ( String [ ] args ) { int a = 1 , b = 2 , c = 3 , d = 4 ; int x1 = - 2 , y1 = - 2 , z1 = 1 ; int x2 = - 4 , y2 = 11 , z2 = - 1 ; check_position ( a , b , c , d , x1 , y1 , z1 , x2 , y2 , z2 ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static class pair { int first , second ; public pair ( int first , int second ) { this . first = first ; this . second = second ; } } static boolean checkIntersection ( int arr [ ] , int N ) { Vector < pair > vec = new Vector < > ( ) ; for ( int i = 0 ; i < N - 1 ; i ++ ) { int x = arr [ i ] , y = arr [ i + 1 ] ; int minn = Math . min ( x , y ) ; int maxx = Math . max ( x , y ) ; vec . add ( new pair ( minn , maxx ) ) ; } for ( int i = 0 ; i < vec . size ( ) ; i ++ ) { pair x = vec . elementAt ( i ) ; for ( int j = 0 ; j < vec . size ( ) ; j ++ ) { pair y = vec . elementAt ( j ) ; boolean cond1 = ( x . first < y . first && x . second < y . second && y . first < x . second ) ; boolean cond2 = ( y . first < x . first && y . second < x . second && x . first < y . second ) ; if ( cond1 cond2 ) { return true ; } } } return false ; } public static void main ( String [ ] args ) { int arr [ ] = { 0 , 15 , 5 , 10 } ; int N = arr . length ; if ( checkIntersection ( arr , N ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Index/key variables: i
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG, pair
Java program:
import java . io . * ; import java . lang . * ; import java . util . * ; class GFG { static double point_distance ( int x1 , int y1 , int x2 , int y2 ) { int p = ( x2 - x1 ) ; int q = ( y2 - y1 ) ; double distance = Math . sqrt ( p * p + q * q ) ; return distance ; } static void tangentAngle ( int x1 , int y1 , int x2 , int y2 , double radius ) { double distance = point_distance ( x1 , y1 , x2 , y2 ) ; if ( radius / distance > 1 radius / distance < - 1 ) { System . out . println ( - 1 ) ; } double result = 2 * Math . asin ( radius / distance ) * 180 / 3.1415 ; System . out . println ( String . format ( " % .4f " , result ) + " ▁ degrees " ) ; } public static void main ( String [ ] args ) { int radius = 4 ; int x1 = 7 , y1 = 12 ; int x2 = 3 , y2 = 4 ; tangentAngle ( x1 , y1 , x2 , y2 , radius ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static void AreaFactor ( int n ) { double pi = 3.14159265 ; double areaf = 1 / ( Math . cos ( pi / n ) * Math . cos ( pi / n ) ) ; System . out . format ( " % .6f " , areaf ) ; } public static void main ( String [ ] args ) { int n = 4 ; AreaFactor ( n ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static final double PI = 3.14159265 ; static double findInteriorAngle ( int n ) { return ( ( n - 2 ) * PI ) / n ; } static double calculateSideLength ( double L , int N , int K ) { double angle = findInteriorAngle ( N ) ; double length = L * Math . pow ( Math . sin ( angle / 2 ) , ( K - 1 ) ) ; return length ; } public static void main ( String [ ] args ) { double L = 21 ; int N = 5 , K = 7 ; System . out . print ( calculateSideLength ( L , N , K ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static double PI = 3.14159265 ; static void findAngle ( double M1 , double M2 ) { double angle = Math . abs ( ( M2 - M1 ) / ( 1 + M1 * M2 ) ) ; double ret = Math . atan ( angle ) ; double val = ( ret * 180 ) / PI ; System . out . println ( val ) ; } public static void main ( String [ ] args ) { double M1 = 1.75 , M2 = 0.27 ; findAngle ( M1 , M2 ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static float angle ( float R1 , float R2 , float D ) { float ans = ( R1 * R1 + R2 * R2 - D * D ) / ( 2 * R1 * R2 ) ; return ans ; } public static void main ( String [ ] args ) { float R1 = 3 , R2 = 4 ; float D = 5 ; System . out . println ( angle ( R1 , R2 , D ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { public static String find ( int [ ] a , int [ ] b , int N , int K ) { for ( int i = 0 ; i < N ; i ++ ) { int count = 0 ; for ( int j = 0 ; j < N ; j ++ ) { if ( i == j ) { continue ; } long dis = Math . abs ( a [ i ] - a [ j ] ) + Math . abs ( b [ i ] - b [ j ] ) ; if ( dis <= K ) { count ++ ; } if ( count == N - 1 ) { return " Yes " ; } } } return " No " ; } public static void main ( String [ ] args ) { int N = 5 ; int [ ] A = { 1 , 0 , 2 , 1 , 1 } ; int [ ] B = { 1 , 1 , 1 , 0 , 2 } ; int K = 1 ; System . out . println ( find ( A , B , N , K ) ) ; } }

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG