dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
class GFG { static void minimumTriangleArea ( int a , int b ) { int area = a * b ; System . out . println ( area ) ; } public static void main ( String [ ] args ) { int a = 1 , b = 2 ; minimumTriangleArea ( a , b ) ; } }

Class/struct names: GFG
Java program:
class GFG { static void findAngles ( double a , double b , double c , double d ) { double numerator = a * a + d * d - b * b - c * c ; double denominator = 2 * ( a * b + c * d ) ; double x = numerator / denominator ; System . out . println ( " A : ▁ " + Math . round ( ( ( Math . acos ( x ) * 180 ) / 3.141592 ) * 100.0 ) / 100.0 + " ▁ degrees " ) ; numerator = a * a + b * b - c * c - d * d ; x = numerator / denominator ; System . out . println ( " B : ▁ " + Math . round ( ( ( Math . acos ( x ) * 180 ) / 3.141592 ) * 100.0 ) / 100.0 + " ▁ degrees " ) ; numerator = c * c + b * b - a * a - d * d ; x = numerator / denominator ; System . out . println ( " C : ▁ " + Math . round ( ( ( Math . acos ( x ) * 180 ) / 3.141592 ) * 100.0 ) / 100.0 + " ▁ degrees " ) ; numerator = d * d + c * c - a * a - b * b ; x = numerator / denominator ; System . out . println ( " D : ▁ " + Math . round ( ( ( Math . acos ( x ) * 180 ) / 3.141592 ) * 100.0 ) / 100.0 + " ▁ degrees " ) ; } public static void main ( String [ ] args ) { double A = 10 , B = 15 , C = 20 , D = 25 ; findAngles ( A , B , C , D ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int countInscribed ( int R1 , int R2 ) { if ( R2 > R1 ) return 0 ; double angle ; double ratio ; int number_of_circles = 0 ; ratio = R2 / ( double ) ( R1 - R2 ) ; if ( R1 < 2 * R2 ) { number_of_circles = 1 ; } else { angle = Math . abs ( Math . asin ( ratio ) * 180 ) / 3.14159265 ; number_of_circles = ( int ) ( 360 / ( 2 * Math . floor ( angle ) ) ) ; } return number_of_circles ; } public static void main ( String args [ ] ) { int R1 = 3 ; int R2 = 1 ; System . out . println ( countInscribed ( R1 , R2 ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void findPairs ( int [ ] x , int [ ] y , int K ) { int n = x . length ; int ans = 0 ; for ( int i = 0 ; i < n ; ++ i ) { for ( int j = i + 1 ; j < n ; ++ j ) { if ( K * Math . abs ( x [ i ] - x [ j ] ) >= Math . abs ( y [ i ] - y [ j ] ) ) { ++ ans ; } } } System . out . print ( ans ) ; } public static void main ( String [ ] args ) { int [ ] X = { 2 , 1 , 0 } ; int [ ] Y = { 1 , 2 , 0 } ; int K = 1 ; findPairs ( X , Y , K ) ; } }

Index/key variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static int totalCircles ( int L , int B ) { if ( L > B ) { int temp = L ; L = B ; B = temp ; } return B / L ; } public static void main ( String [ ] args ) { int L = 3 ; int B = 8 ; System . out . print ( totalCircles ( L , B ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static double findDiagonal ( double s ) { return ( double ) Math . sqrt ( 2 ) * s ; } public static void main ( String [ ] args ) { double S = 10 ; System . out . print ( findDiagonal ( S ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void triangleArea ( float a , float b ) { if ( a < 0 b < 0 ) { System . out . println ( - 1 ) ; return ; } float area = ( 3 * ( float ) Math . sqrt ( 3 ) * a * b ) / ( 4 ) ; System . out . println ( area ) ; } public static void main ( String [ ] args ) { float a = 1 , b = 2 ; triangleArea ( a , b ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int MAX = ( int ) ( 1e6 + 5 ) ; static void query ( double [ ] [ ] arr , int [ ] Q ) { int pre [ ] = new int [ MAX ] ; for ( int i = 0 ; i < arr . length ; i ++ ) { if ( arr [ i ] [ 0 ] < 0 arr [ i ] [ 1 ] < 0 ) continue ; int sum = ( int ) Math . ceil ( ( arr [ i ] [ 0 ] + arr [ i ] [ 1 ] ) ) ; pre [ sum ] ++ ; } for ( int i = 1 ; i < MAX ; i ++ ) pre [ i ] += pre [ i - 1 ] ; for ( int i = 0 ; i < Q . length ; i ++ ) { System . out . print ( pre [ Q [ i ] ] + " ▁ " ) ; } System . out . println ( ) ; } public static void main ( String [ ] args ) { double [ ] [ ] arr = { { 2.1 , 3.0 } , { 3.7 , 1.2 } , { 1.5 , 6.5 } , { 1.2 , 0.0 } } ; int [ ] Q = { 2 , 8 , 5 } ; int N = arr . length ; int M = Q . length ; query ( arr , Q ) ; } }

Index/key variables: MAX, i, sum
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean doIntersect ( int [ ] X , int [ ] Y ) { if ( X [ 0 ] > X [ 3 ] X [ 2 ] > X [ 1 ] ) return false ; if ( Y [ 0 ] > Y [ 3 ] Y [ 2 ] > Y [ 1 ] ) return false ; return true ; } static int getUnionPerimeter ( int [ ] X , int [ ] Y ) { int perimeter = 0 ; if ( ! doIntersect ( X , Y ) ) { perimeter += 2 * ( Math . abs ( X [ 1 ] - X [ 0 ] ) + Math . abs ( Y [ 1 ] - Y [ 0 ] ) ) ; perimeter += 2 * ( Math . abs ( X [ 3 ] - X [ 2 ] ) + Math . abs ( Y [ 3 ] - Y [ 2 ] ) ) ; } else { int w = Arrays . stream ( X ) . max ( ) . getAsInt ( ) - Arrays . stream ( X ) . min ( ) . getAsInt ( ) ; int l = Arrays . stream ( Y ) . max ( ) . getAsInt ( ) - Arrays . stream ( Y ) . min ( ) . getAsInt ( ) ; perimeter = 2 * ( l + w ) ; } return perimeter ; } public static void main ( String [ ] args ) { int [ ] X = { - 1 , 2 , 4 , 6 } ; int [ ] Y = { 2 , 5 , 3 , 7 } ; System . out . print ( getUnionPerimeter ( X , Y ) ) ; } }

Accumulator variables: perimeter
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static double Convert ( double degree ) { double pi = 3.14159265359 ; return ( degree * ( pi / 180 ) ) ; } static void areaAndHeightOfTraingle ( double radius , double a ) { if ( a >= 180 a == 0 ) { System . out . println ( " Not ▁ possible " ) ; return ; } double base_angle = ( 180 - a ) / 2 ; double radians = Convert ( base_angle ) ; double height = Math . sin ( radians ) * radius ; System . out . println ( " Height ▁ of ▁ triangle ▁ " + height ) ; double Base = Math . cos ( radians ) * radius ; double area = Base * height ; System . out . println ( " Area ▁ of ▁ triangle ▁ " + area ) ; } public static void main ( String [ ] args ) { double R = 5 , angle = 120 ; areaAndHeightOfTraingle ( R , angle ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static double findRadius ( double r1 , double r2 ) { double a1 , a2 , a3 , r3 ; a1 = 3.14 * r1 * r1 ; a2 = 3.14 * r2 * r2 ; a3 = a1 + a2 ; r3 = Math . sqrt ( a3 / 3.14 ) ; return r3 ; } public static void main ( String [ ] args ) { double r1 = 8 , r2 = 6 ; System . out . println ( ( int ) findRadius ( r1 , r2 ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int find_lcm ( int a , int b , int c ) { int g = __gcd ( a , b ) ; int LCM1 = ( a * b ) / g ; g = __gcd ( LCM1 , c ) ; int LCM = ( LCM1 * c ) / g ; return LCM ; } static void minimumCuboids ( int L , int B , int H ) { int lcm = find_lcm ( L , B , H ) ; int volume_cube = lcm * lcm * lcm ; int volume_cuboid = L * B * H ; System . out . print ( ( volume_cube / volume_cuboid ) ) ; } static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } public static void main ( String [ ] args ) { int L = 1 , B = 1 , H = 2 ; minimumCuboids ( L , B , H ) ; } }

Class/struct names: GFG
Java program:
class GFG { static int CrossProduct ( int A [ ] [ ] ) { int X1 = ( A [ 1 ] [ 0 ] - A [ 0 ] [ 0 ] ) ; int Y1 = ( A [ 1 ] [ 1 ] - A [ 0 ] [ 1 ] ) ; int X2 = ( A [ 2 ] [ 0 ] - A [ 0 ] [ 0 ] ) ; int Y2 = ( A [ 2 ] [ 1 ] - A [ 0 ] [ 1 ] ) ; return ( X1 * Y2 - Y1 * X2 ) ; } static boolean isConvex ( int points [ ] [ ] ) { int N = points . length ; int prev = 0 ; int curr = 0 ; for ( int i = 0 ; i < N ; i ++ ) { int temp [ ] [ ] = { points [ i ] , points [ ( i + 1 ) % N ] , points [ ( i + 2 ) % N ] } ; curr = CrossProduct ( temp ) ; if ( curr != 0 ) { if ( curr * prev < 0 ) { return false ; } else { prev = curr ; } } } return true ; } public static void main ( String [ ] args ) { int points [ ] [ ] = { { 0 , 0 } , { 0 , 1 } , { 1 , 1 } , { 1 , 0 } } ; if ( isConvex ( points ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static class Tri { int MinX , MaxX , MinY , MaxY ; } ; static int StringtoInt ( String s ) { return Integer . valueOf ( s ) ; } static int min ( int a , int b , int c ) { return Math . min ( a , Math . min ( b , c ) ) ; } static int max ( int a , int b , int c ) { return Math . max ( a , Math . max ( b , c ) ) ; } static void TriangleCuts ( int [ ] [ ] Triangle , String Cuts [ ] , int N , int M , int COL ) { Tri [ ] Minimized = new Tri [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { Minimized [ i ] = new Tri ( ) ; Minimized [ i ] . MaxX = 0 ; Minimized [ i ] . MaxY = 0 ; Minimized [ i ] . MinX = 0 ; Minimized [ i ] . MinY = 0 ; } for ( int i = 0 ; i < N ; i ++ ) { int x1 = Triangle [ i ] [ 0 ] ; int y1 = Triangle [ i ] [ 1 ] ; int x2 = Triangle [ i ] [ 2 ] ; int y2 = Triangle [ i ] [ 3 ] ; int x3 = Triangle [ i ] [ 4 ] ; int y3 = Triangle [ i ] [ 5 ] ; Minimized [ i ] . MinX = min ( x1 , x2 , x3 ) ; Minimized [ i ] . MaxX = max ( x1 , x2 , x3 ) ; Minimized [ i ] . MinY = min ( y1 , y2 , y3 ) ; Minimized [ i ] . MaxY = max ( y1 , y2 , y3 ) ; } for ( int i = 0 ; i < M ; i ++ ) { String Cut = Cuts [ i ] ; int CutCount = 0 ; int CutVal = StringtoInt ( Cut . substring ( 2 , Cut . length ( ) ) ) ; if ( Cut . charAt ( 0 ) == ' X ' ) { for ( int j = 0 ; j < N ; j ++ ) { if ( ( Minimized [ j ] . MinX ) < ( CutVal ) && ( Minimized [ j ] . MaxX ) > ( CutVal ) ) { CutCount ++ ; } } } else if ( Cut . charAt ( 0 ) == ' Y ' ) { for ( int j = 0 ; j < N ; j ++ ) { if ( ( Minimized [ j ] . MinY ) < ( CutVal ) && ( Minimized [ j ] . MaxY ) > ( CutVal ) ) { CutCount ++ ; } } } System . out . print ( CutCount + " ▁ " ) ; } } public static void main ( String [ ] args ) { int [ ] [ ] Triangle = { { 0 , 2 , 2 , 9 , 8 , 5 } , { 5 , 0 , 6 , 3 , 7 , 0 } } ; int N = Triangle . length ; int COL = 6 ; String Cuts [ ] = { " X = 2" , " Y = 2" , " Y = 9" } ; int M = Cuts . length ; TriangleCuts ( Triangle , Cuts , N , M , COL ) ; } }

Index/key variables: N, i, j
Accumulator variables: CutCount, i, j
Iterator variables: i, j
Class/struct names: GFG, Tri
Java program:
import java . io . * ; import java . util . * ; class GFG { public static int cntRect ( int points [ ] [ ] , int N , int rectangle [ ] [ ] ) { HashSet < Integer > cntHor = new HashSet < > ( ) ; HashSet < Integer > cntVer = new HashSet < > ( ) ; cntHor . add ( 0 ) ; cntVer . add ( 0 ) ; cntHor . add ( rectangle [ 3 ] [ 0 ] ) ; cntVer . add ( rectangle [ 3 ] [ 1 ] ) ; for ( int i = 0 ; i < N ; i ++ ) { cntHor . add ( points [ i ] [ 0 ] ) ; cntVer . add ( points [ i ] [ 1 ] ) ; } return ( cntHor . size ( ) - 1 ) * ( cntVer . size ( ) - 1 ) ; } public static void main ( String args [ ] ) { int rectangle [ ] [ ] = { { 0 , 0 } , { 0 , 5 } , { 5 , 0 } , { 5 , 5 } } ; int points [ ] [ ] = { { 1 , 2 } , { 3 , 4 } } ; int N = points . length ; System . out . println ( cntRect ( points , N , rectangle ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static int numberOfSquares ( int [ ] X , int [ ] Y , int N , int M ) { HashMap < Integer , Integer > m1 = new HashMap < Integer , Integer > ( ) ; HashMap < Integer , Integer > m2 = new HashMap < Integer , Integer > ( ) ; int i , j , ans = 0 ; for ( i = 0 ; i < N ; i ++ ) { for ( j = i + 1 ; j < N ; j ++ ) { int dist = Math . abs ( X [ i ] - X [ j ] ) ; m1 . put ( dist , m1 . getOrDefault ( dist , 0 ) + 1 ) ; } } for ( i = 0 ; i < M ; i ++ ) { for ( j = i + 1 ; j < M ; j ++ ) { int dist = Math . abs ( Y [ i ] - Y [ j ] ) ; m2 . put ( dist , m2 . getOrDefault ( dist , 0 ) + 1 ) ; } } for ( Map . Entry < Integer , Integer > entry : m1 . entrySet ( ) ) { if ( m2 . containsKey ( entry . getKey ( ) ) ) { ans += ( entry . getValue ( ) * m2 . get ( entry . getKey ( ) ) ) ; } } return ans ; } public static void main ( String [ ] args ) { int X [ ] = { 1 , 3 , 7 } ; int Y [ ] = { 2 , 4 , 6 , 1 } ; int N = X . length ; int M = Y . length ; System . out . println ( numberOfSquares ( X , Y , N , M ) ) ; } }

Index/key variables: i, j
Accumulator variables: ans, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int No_of_squares ( int N , int K ) { int no_of_squares = 0 ; no_of_squares = ( N - K + 1 ) * ( N - K + 1 ) ; return no_of_squares ; } public static void main ( String [ ] args ) { int N = 5 ; int K = 3 ; System . out . print ( No_of_squares ( N , K ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static int No_of_cubes ( int N , int K ) { int No = 0 ; No = ( N - K + 1 ) ; No = ( int ) Math . pow ( No , 3 ) ; return No ; } public static void main ( String [ ] args ) { int N = 5 ; int K = 2 ; System . out . print ( No_of_cubes ( N , K ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int No_of_rectangles ( int L , int B , int l , int b ) { if ( ( l > L ) || ( b > B ) ) { return - 1 ; } else { return ( L - l + 1 ) * ( B - b + 1 ) ; } } public static void main ( String [ ] args ) { int L = 5 , B = 3 ; int l = 4 , b = 1 ; System . out . println ( No_of_rectangles ( L , B , l , b ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static void checkTriangle ( int x , int y , int z ) { if ( x == y && y == z ) System . out . println ( " Equilateral ▁ Triangle " ) ; else if ( x == y y == z z == x ) System . out . println ( " Isosceles ▁ Triangle " ) ; else System . out . println ( " Scalene ▁ Triangle " ) ; } public static void main ( String [ ] args ) { int x = 8 , y = 7 , z = 9 ; checkTriangle ( x , y , z ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void findVertices ( int x1 , int y1 , int x2 , int y2 ) { if ( x1 == x2 ) { System . out . print ( ( x1 + y2 - y1 ) + " , ▁ " + y1 + "NEW_LINE"); System . out . print ( ( x2 + y2 - y1 ) + " , ▁ " + y2 ) ; } else if ( y1 == y2 ) { System . out . print ( x1 + " , ▁ " + ( y1 + x2 - x1 ) + "NEW_LINE"); System . out . print ( x2 + " , ▁ " + ( y2 + x2 - x1 ) ) ; } else if ( Math . abs ( x2 - x1 ) == Math . abs ( y2 - y1 ) ) { System . out . print ( x1 + " , ▁ " + y2 + "NEW_LINE"); System . out . print ( x2 + " , ▁ " + y1 ) ; } else System . out . print ( " - 1" ) ; } public static void main ( String [ ] args ) { int x1 = 1 , y1 = 2 ; int x2 = 3 , y2 = 4 ; findVertices ( x1 , y1 , x2 , y2 ) ; } }

Class/struct names: GFG
Java program:
class GFG { static final double RADIAN = 0.01745329252 ; static double Area_of_Rhombus ( int a , int theta ) { double area = ( a * a ) * Math . sin ( ( RADIAN * theta ) ) ; return area ; } public static void main ( String [ ] args ) { int a = 4 ; int theta = 60 ; double ans = Area_of_Rhombus ( a , theta ) ; System . out . printf ( " % .2f " , ans ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int calculateTriangles ( int sides [ ] ) { double count = Math . pow ( sides [ 0 ] + sides [ 1 ] + sides [ 2 ] , 2 ) ; count -= Math . pow ( sides [ 0 ] , 2 ) ; count -= Math . pow ( sides [ 2 ] , 2 ) ; count -= Math . pow ( sides [ 4 ] , 2 ) ; return ( int ) ( count ) ; } public static void main ( String [ ] args ) { int sides [ ] = { 1 , 1 , 1 , 1 , 1 , 1 } ; System . out . print ( ( calculateTriangles ( sides ) ) + "NEW_LINE"); int sides1 [ ] = { 2 , 2 , 1 , 3 , 1 , 2 } ; System . out . print ( ( calculateTriangles ( sides1 ) ) + "NEW_LINE"); } }

Accumulator variables: count
Class/struct names: GFG
Java program:
class GFG { static double Length_Diagonal ( int a , int b , double theta ) { double diagonal = Math . sqrt ( ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) ) - 2 * a * b * Math . cos ( theta * ( Math . PI / 180 ) ) ) ; return diagonal ; } public static void main ( String [ ] args ) { int a = 3 ; int b = 5 ; double theta = 45 ; double ans = Length_Diagonal ( a , b , theta ) ; System . out . printf ( " % .2f " , ans ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void maximumTiles ( int n , int m ) { System . out . println ( ( m * n ) / 2 ) ; } public static void main ( String [ ] args ) { int M = 3 ; int N = 4 ; maximumTiles ( N , M ) ; } }

Class/struct names: GFG
Java program:
class GFG { static float Length_Diagonal ( int a , int b , int d ) { float diagonal = ( float ) Math . sqrt ( 2 * ( ( a * a ) + ( b * b ) ) - ( d * d ) ) ; return diagonal ; } public static void main ( String [ ] args ) { int A = 10 ; int B = 30 ; int D = 20 ; float ans = Length_Diagonal ( A , B , D ) ; System . out . printf ( " % .1f " , ans ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static Vector < Float > Diagonals ( int a , int b , int c , int d ) { Vector < Float > ans = new Vector < Float > ( ) ; ans . add ( ( float ) Math . sqrt ( ( ( a * c ) + ( b * d ) ) * ( ( a * d ) + ( b * c ) ) / ( ( a * b ) + ( c * d ) ) ) ) ; ans . add ( ( float ) Math . sqrt ( ( ( a * c ) + ( b * d ) ) * ( ( a * b ) + ( c * d ) ) / ( ( a * d ) + ( b * c ) ) ) ) ; return ans ; } public static void main ( String [ ] args ) { int A = 10 ; int B = 15 ; int C = 20 ; int D = 25 ; Vector < Float > ans = Diagonals ( A , B , C , D ) ; System . out . printf ( " % .2f ▁ % .2f " , ( ans . get ( 0 ) ) + .01 , ans . get ( 1 ) + .01 ) ; } }

Class/struct names: GFG
Java program:
class GFG { static double find ( double x , double y , int [ ] [ ] p ) { double mind = 0 ; for ( int i = 0 ; i < p . length ; i ++ ) { double a = p [ i ] [ 0 ] , b = p [ i ] [ 1 ] ; mind += Math . sqrt ( ( x - a ) * ( x - a ) + ( y - b ) * ( y - b ) ) ; } return mind ; } static double getMinDistSum ( int [ ] [ ] p ) { double x = 0 , y = 0 ; for ( int i = 0 ; i < p . length ; i ++ ) { x += p [ i ] [ 0 ] ; y += p [ i ] [ 1 ] ; } x = x / p . length ; y = y / p . length ; double mind = find ( x , y , p ) ; return mind ; } public static void main ( String [ ] args ) { int [ ] [ ] vec = { { 0 , 1 } , { 1 , 0 } , { 1 , 2 } , { 2 , 1 } } ; double d = getMinDistSum ( vec ) ; System . out . print ( d + "NEW_LINE"); } }

Index/key variables: i
Accumulator variables: i, mind, x, y
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int det ( int [ ] [ ] d ) { int Sum = d [ 0 ] [ 0 ] * ( ( d [ 1 ] [ 1 ] * d [ 2 ] [ 2 ] ) - ( d [ 2 ] [ 1 ] * d [ 1 ] [ 2 ] ) ) ; Sum -= d [ 0 ] [ 1 ] * ( ( d [ 1 ] [ 0 ] * d [ 2 ] [ 2 ] ) - ( d [ 1 ] [ 2 ] * d [ 2 ] [ 0 ] ) ) ; Sum += d [ 0 ] [ 2 ] * ( ( d [ 0 ] [ 1 ] * d [ 1 ] [ 2 ] ) - ( d [ 0 ] [ 2 ] * d [ 1 ] [ 1 ] ) ) ; return Sum ; } public static void main ( String [ ] args ) { int x1 = - 3 , y1 = 1 , z1 = 5 ; int a1 = - 3 , b1 = 1 , c1 = 5 ; int x2 = - 1 , y2 = 2 , z2 = 5 ; int a2 = - 1 , b2 = 2 , c2 = 5 ; int [ ] [ ] det_list = { { x2 - x1 , y2 - y1 , z2 - z1 } , { a1 , b1 , c1 } , { a2 , b2 , c2 } } ; if ( det ( det_list ) == 0 ) System . out . print ( " Lines ▁ are ▁ coplanar " ) ; else System . out . print ( " Lines ▁ are ▁ non ▁ coplanar " ) ; } }

Accumulator variables: Sum
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static double distance ( int r , int R ) { double d = Math . sqrt ( Math . pow ( R , 2 ) - ( 2 * r * R ) ) ; return d ; } public static void main ( String [ ] args ) { int r = 2 ; int R = 5 ; System . out . println ( Math . round ( distance ( r , R ) * 100.0 ) / 100.0 ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static final double PI = 3.141592653589 ; static class pair { double first , second ; public pair ( double first , double second ) { super ( ) ; this . first = first ; this . second = second ; } } static double uniform ( ) { return Math . random ( ) ; } static Vector < pair > randPoint ( int r , int x , int y , int n ) { Vector < pair > res = new Vector < pair > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { double theta = 2 * PI * uniform ( ) ; double len = Math . sqrt ( uniform ( ) ) * r ; res . add ( new pair ( x + len * Math . cos ( theta ) , y + len * Math . sin ( theta ) ) ) ; } return res ; } static void printVector ( Vector < pair > A ) { for ( pair P : A ) { System . out . printf ( "(%.2f, %.2f)NEW_LINE", P.first, P.second); } } public static void main ( String [ ] args ) { int R = 12 ; int X = 3 ; int Y = 3 ; int N = 5 ; printVector ( randPoint ( R , X , Y , N ) ) ; } }

Accumulator variables: i
Iterator variables: P, i
Class/struct names: GFG, pair
Java program:
import java . util . * ; class GFG { static void checkValidPolygon ( int arr [ ] , int N ) { int sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { sum += arr [ i ] ; } if ( sum == 180 * ( N - 2 ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } public static void main ( String [ ] args ) { int N = 3 ; int arr [ ] = { 60 , 60 , 60 } ; checkValidPolygon ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { public static int minimalSquareSide ( int a , int b ) { if ( a == b ) { return 2 * a ; } if ( a != b ) { if ( a > b ) { int newB = b + b ; int diff = Math . abs ( newB - a ) ; if ( newB < a ) { b = newB + diff ; if ( a == b ) return a ; return 0 ; } else { a = a + diff ; if ( a == newB ) return a ; return 0 ; } } else { int newA = a + a ; int diff = Math . abs ( newA - b ) ; if ( newA < b ) { a = diff + newA ; if ( a == b ) return a ; return 0 ; } else { b = b + diff ; if ( b == newA ) return b ; return 0 ; } } } return 0 ; } public static void main ( String [ ] args ) { int H , W ; H = 3 ; W = 1 ; System . out . println ( minimalSquareSide ( H , W ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static double minAnglRot ( int N ) { double res ; res = 360 / ( double ) N ; return res ; } public static void main ( String [ ] args ) { int N = 4 ; System . out . println ( " Angle ▁ of ▁ Rotational ▁ Symmetry : ▁ " + minAnglRot ( N ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static double Area_of_Triangle ( int a , int b , int c ) { int s = ( a + b + c ) / 2 ; int x = s * ( s - a ) ; x = x * ( s - b ) ; x = x * ( s - c ) ; double area = ( 4 / ( double ) 3 ) * Math . sqrt ( x ) ; return area ; } public static void main ( String [ ] args ) { int a = 9 ; int b = 12 ; int c = 15 ; double ans = Area_of_Triangle ( a , b , c ) ; System . out . println ( ans ) ; } }

Class/struct names: GFG
Java program:
class GFG { static final int MAX = 1001 ; static boolean [ ] [ ] arr = new boolean [ MAX ] [ MAX ] ; static void updateArray ( int x1 , int y1 , int x2 , int y2 ) { for ( int i = x1 ; i < x2 ; i ++ ) { for ( int j = y1 ; j < y2 ; j ++ ) { arr [ i ] [ j ] = true ; } } } static int findAreaCovered ( ) { int area = 0 ; for ( int i = 0 ; i < MAX ; i ++ ) { for ( int j = 0 ; j < MAX ; j ++ ) { if ( arr [ i ] [ j ] == true ) { area ++ ; } } } return area ; } public static void main ( String [ ] args ) { int N = 3 ; int [ ] [ ] A = { { 1 , 3 , 4 , 5 } , { 3 , 1 , 7 , 4 } , { 5 , 3 , 8 , 6 } } ; for ( int i = 0 ; i < N ; i ++ ) { updateArray ( A [ i ] [ 0 ] , A [ i ] [ 1 ] , A [ i ] [ 2 ] , A [ i ] [ 3 ] ) ; } int area = findAreaCovered ( ) ; System . out . print ( area ) ; } }

Index/key variables: MAX, i, j
Accumulator variables: area, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void findEquation ( int x1 , int y1 , int z1 , int x2 , int y2 , int z2 , int d , int e , int f ) { double a = x2 - x1 ; double b = y2 - y1 ; double c = z2 - z1 ; int A = ( int ) ( b * f - c * e ) ; int B = ( int ) ( a * f - c * d ) ; int C = ( int ) ( a * e - b * d ) ; int D = - ( int ) ( A * d - B * e + C * f ) ; System . out . println ( A + " x ▁ + ▁ " + B + " y ▁ + ▁ " + C + " z ▁ + ▁ " + D + " = ▁ 0 ▁ " ) ; } public static void main ( String [ ] args ) { int x1 = 2 , y1 = 3 , z1 = 5 ; int x2 = 6 , y2 = 7 , z2 = 8 ; int a = 11 , b = 23 , c = 10 ; findEquation ( x1 , y1 , z1 , x2 , y2 , z2 , a , b , c ) ; } }

Class/struct names: GFG