dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
class GFG { static boolean isPrime ( int n ) { for ( int i = 2 ; i * i <= n ; i ++ ) { if ( n % i == 0 ) { return false ; } } return true ; } static void printMinCountPrime ( int N ) { int minCount ; if ( isPrime ( N ) ) { minCount = 1 ; } else if ( N % 2 == 0 ) { minCount = 2 ; } else { if ( isPrime ( N - 2 ) ) { minCount = 2 ; } else { minCount = 3 ; } } System . out . print ( minCount + "NEW_LINE"); } public static void main ( String [ ] args ) { int N = 100 ; printMinCountPrime ( N ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static final int INFINITY_ = 9999999 ; static int sqrtByLongDivision ( int n ) { int cur_divisor = 0 ; int quotient_units_digit = 0 ; int cur_quotient = 0 ; int cur_dividend = 0 ; int cur_remainder = 0 ; int a [ ] = new int [ 10 ] ; while ( n > 0 ) { a [ i ] = n % 100 ; n = n / 100 ; i ++ ; } i -- ; for ( j = i ; j >= 0 ; j -- ) { cur_remainder = INFINITY_ ; cur_dividend = cur_dividend * 100 + a [ j ] ; for ( udigit = 0 ; udigit <= 9 ; udigit ++ ) { if ( cur_remainder >= cur_dividend - ( ( cur_divisor * 10 + udigit ) * udigit ) && cur_dividend - ( ( cur_divisor * 10 + udigit ) * udigit ) >= 0 ) { cur_remainder = cur_dividend - ( ( cur_divisor * 10 + udigit ) * udigit ) ; quotient_units_digit = udigit ; } } cur_quotient = cur_quotient * 10 + quotient_units_digit ; cur_divisor = cur_quotient * 2 ; cur_dividend = cur_remainder ; } return cur_quotient ; } public static void main ( String [ ] args ) { int x = 1225 ; System . out . print ( sqrtByLongDivision ( x ) + "NEW_LINE"); } }

Index/key variables: i, j
Accumulator variables: i, j, udigit
Iterator variables: j, udigit
Class/struct names: GFG
Java program:
import java . util . * ; import java . lang . * ; class GFG { static int previousFibonacci ( int n ) { double a = n / ( ( 1 + ( int ) Math . sqrt ( 5 ) ) / 2.0 ) ; return ( int ) Math . round ( a ) ; } static int nextFibonacci ( int n ) { double a = n * ( 1 + ( int ) Math . sqrt ( 5 ) ) / 2.0 ; return ( int ) Math . round ( a ) ; } static boolean isPerfectSquare ( int x ) { int s = ( int ) Math . sqrt ( x ) ; return ( s * s == x ) ; } static boolean isFibonacci ( int n ) { return ( isPerfectSquare ( 5 * n * n + 4 ) || isPerfectSquare ( 5 * n * n - 4 ) ) ; } static int countFibonacciPairs ( int arr [ ] , int n ) { int res = 0 ; for ( int i = 0 ; i < n ; i ++ ) for ( int j = i + 1 ; j < n ; j ++ ) if ( isFibonacci ( arr [ i ] ) && isFibonacci ( arr [ j ] ) ) { int prevFib = previousFibonacci ( arr [ i ] ) ; int nextFib = nextFibonacci ( arr [ i ] ) ; if ( prevFib == arr [ j ] nextFib == arr [ j ] ) { res ++ ; } } return res ; } public static void main ( String [ ] args ) { int [ ] a = { 3 , 5 , 8 , 11 } ; int n = a . length ; System . out . print ( countFibonacciPairs ( a , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, res
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static int countPairsWithProdK ( int arr [ ] , int n , int k ) { int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) if ( arr [ i ] * arr [ j ] == k ) count ++ ; } return count ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 5 , 3 , 4 , 2 } ; int N = arr . length ; int K = 3 ; System . out . println ( countPairsWithProdK ( arr , N , K ) ) ; } }

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static int MAX = 100000 ; static int countPairsWithProductK ( int arr [ ] , int n , int k ) { int count = 0 ; int i ; boolean hashmap [ ] = new boolean [ MAX ] ; for ( i = 0 ; i < n ; i ++ ) hashmap [ arr [ i ] ] = true ; for ( i = 0 ; i < n ; i ++ ) { int x = arr [ i ] ; double index = 1.0 * k / arr [ i ] ; if ( index >= 0 && ( ( index - ( int ) ( index ) ) == 0 ) && hashmap [ k / x ] ) count ++ ; hashmap [ x ] = false ; } return count ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 5 , 3 , 4 , 2 } ; int N = arr . length ; int K = 3 ; System . out . print ( countPairsWithProductK ( arr , N , K ) ) ; } }

Index/key variables: MAX, i, x
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void oddIntegers ( int n , int k ) { if ( n % 2 != k % 2 ) { System . out . println ( " - 1" ) ; return ; } int sum = 0 ; int i = 1 ; int j = 1 ; while ( j < k ) { sum = sum + i ; System . out . print ( i + " ▁ " ) ; i = i + 2 ; j ++ ; } int finalOdd = n - sum ; System . out . println ( finalOdd ) ; } public static void main ( String [ ] args ) { int n = 10 ; int k = 2 ; oddIntegers ( n , k ) ; } }

Accumulator variables: j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int mod = 1000000007 ; static int [ ] ans = new int [ 100002 ] ; static int [ ] pref = new int [ 100002 ] ; static void preCompute ( ) { Arrays . fill ( ans , 1 ) ; for ( int i = 2 ; i <= 100000 / 2 ; i ++ ) { for ( int j = 2 * i ; j <= 100000 ; j += i ) { ans [ j ] = ( ans [ j ] * i ) % mod ; } } for ( int i = 1 ; i < 100002 ; ++ i ) { pref [ i ] = pref [ i - 1 ] + ans [ i ] ; pref [ i ] %= mod ; } } static void printSum ( int L , int R ) { System . out . print ( pref [ R ] - pref [ L - 1 ] + " ▁ " ) ; } static void printSumProper ( int [ ] [ ] arr , int Q ) { preCompute ( ) ; for ( int i = 0 ; i < Q ; i ++ ) { printSum ( arr [ i ] [ 0 ] , arr [ i ] [ 1 ] ) ; } } public static void main ( String args [ ] ) { int Q = 2 ; int [ ] [ ] arr = { { 10 , 20 } , { 12 , 16 } } ; printSumProper ( arr , Q ) ; } }

Index/key variables: R, i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static int a [ ] ; static int search ( int a [ ] , int k , int x ) { int j ; for ( j = k - 1 ; j > - 1 ; j -- ) { if ( a [ j ] == x ) return j ; } return - 1 ; } static void genArray ( int [ ] arr , int N ) { for ( int i = 0 ; i < N - 1 ; i ++ ) { if ( search ( arr , i , arr [ i ] ) == - 1 ) arr [ i + 1 ] = 0 ; else arr [ i + 1 ] = ( i - search ( arr , i , arr [ i ] ) ) ; } } public static void main ( String [ ] args ) { int N = 5 ; int size = N + 1 ; int a [ ] = new int [ N ] ; genArray ( a , N ) ; for ( int i = 0 ; i < N ; i ++ ) System . out . print ( a [ i ] + " ▁ " ) ; } }

Index/key variables: N, i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static List < Integer > getPerfectcubes ( int n ) { List < Integer > perfectcubes = new ArrayList < Integer > ( ) ; int current = 1 ; int i = 1 ; while ( current <= n ) { perfectcubes . add ( current ) ; i += 1 ; current = ( int ) ( Math . pow ( i , 3 ) ) ; } return perfectcubes ; } static int maxPairSum ( int [ ] arr ) { int n = arr . length ; int max = 0 ; int secondMax = 0 ; if ( arr [ 0 ] > arr [ 1 ] ) { max = arr [ 0 ] ; secondMax = arr [ 1 ] ; } else { max = arr [ 1 ] ; secondMax = arr [ 0 ] ; } for ( int i = 2 ; i < n ; i ++ ) { if ( arr [ i ] > max ) { secondMax = max ; max = arr [ i ] ; } else if ( arr [ i ] > secondMax ) { secondMax = arr [ i ] ; } } return ( max + secondMax ) ; } static int countPairsWith ( int n , List < Integer > perfectcubes , List < Integer > nums ) { int count = 0 ; for ( int i = 0 ; i < perfectcubes . size ( ) ; i ++ ) { int temp = perfectcubes . get ( i ) - n ; if ( temp > n && ( nums . contains ( temp ) ) ) count += 1 ; } return count ; } static int countPairs ( int [ ] arr ) { int n = arr . length ; int max = maxPairSum ( arr ) ; List < Integer > perfectcubes = getPerfectcubes ( max ) ; List < Integer > nums = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { nums . add ( arr [ i ] ) ; } int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { count += countPairsWith ( arr [ i ] , perfectcubes , nums ) ; } return count ; } public static void main ( String [ ] agrs ) { int [ ] arr = { 2 , 6 , 18 , 9 , 999 , 1 } ; System . out . print ( countPairs ( arr ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int countCubes ( int a , int b ) { for ( int i = a ; i <= b ; i ++ ) for ( int j = 1 ; j * j * j <= i ; j ++ ) if ( j * j * j == i ) cnt ++ ; return cnt ; } public static void main ( String [ ] args ) { int a = 7 , b = 30 ; System . out . print ( " Count ▁ of ▁ Cubes ▁ is ▁ " + countCubes ( a , b ) ) ; } }

Accumulator variables: cnt, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static int countCubes ( int a , int b ) { return ( int ) ( Math . floor ( Math . cbrt ( b ) ) - Math . ceil ( Math . cbrt ( a ) ) + 1 ) ; } public static void main ( String [ ] args ) { int a = 7 , b = 28 ; System . out . print ( " Count ▁ of ▁ cubes ▁ is ▁ " + countCubes ( a , b ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static boolean isArmstrong ( int x , int n ) { int sum1 = 0 ; int temp = x ; while ( temp > 0 ) { int digit = temp % 10 ; sum1 += Math . pow ( digit , n ) ; temp /= 10 ; } return sum1 == x ; } static void CalculateXORandOR ( int n ) { int CalculateXOR = 0 ; int CalculateOR = 0 ; int start = ( int ) Math . pow ( 10 , n - 1 ) ; int end = ( int ) ( Math . pow ( 10 , n ) ) - 1 ; for ( int i = start ; i < end + 1 ; i ++ ) { if ( isArmstrong ( i , n ) ) { CalculateXOR = CalculateXOR ^ i ; CalculateOR = CalculateOR | i ; } } System . out . println ( " XOR ▁ = ▁ " + CalculateXOR ) ; System . out . println ( " OR ▁ = ▁ " + CalculateOR ) ; } public static void main ( String [ ] args ) { int n = 4 ; CalculateXORandOR ( n ) ; } }

Accumulator variables: i, sum1, temp
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void perfectCube ( int N ) { int cube ; for ( int i = 0 ; i <= N ; i ++ ) { cube = i * i * i ; if ( cube == N ) { System . out . println ( " Yes " ) ; return ; } else if ( cube > N ) { System . out . println ( " NO " ) ; return ; } } } public static void main ( String [ ] args ) { int N = 216 ; perfectCube ( N ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
public class GFG { static void perfectCube ( int N ) { int cube_root ; cube_root = ( int ) Math . round ( Math . cbrt ( N ) ) ; if ( cube_root * cube_root * cube_root == N ) { System . out . println ( " Yes " ) ; return ; } else { System . out . println ( " NO " ) ; return ; } } public static void main ( String [ ] args ) { int N = 125 ; perfectCube ( N ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void check ( int arr [ ] , int N ) { int even = 0 ; int odd = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] % 2 == 1 ) { odd ++ ; } else { even ++ ; } } if ( even == N odd == N ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 1 , 3 } ; int N = arr . length ; check ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: even, i, odd
Iterator variables: i
Class/struct names: GFG
Java program:
import java . lang . Math ; class GFG { public static void findSum ( int N ) { int sum = ( N ) * ( N + 1 ) / 2 ; int r = ( int ) ( Math . log ( N ) / Math . log ( 2 ) ) + 1 ; int expSum = ( int ) ( Math . pow ( 2 , r ) ) - 1 ; System . out . println ( sum - expSum ) ; } public static void main ( String [ ] args ) { int N = 2 ; findSum ( N ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void findNumbers ( int n , int b ) { double even = 0 , odd = 0 ; if ( b % 2 == 0 ) { even = Math . pow ( b , n ) - 2 ; odd = Math . pow ( b , n ) - 1 ; } else { even = Math . pow ( b , n ) - 1 ; odd = Math . pow ( b , n ) - 2 ; } System . out . println ( " Even ▁ Number ▁ = ▁ " + ( int ) even ) ; System . out . print ( " Odd ▁ Number ▁ = ▁ " + ( int ) odd ) ; } public static void main ( String [ ] args ) { int N = 2 , B = 5 ; findNumbers ( N , B ) ; } }

Class/struct names: GFG
Java program:
class GFG { static int findMinNumber ( int n ) { int count = 0 , ans = 1 ; while ( n % 2 == 0 ) { count ++ ; n /= 2 ; } if ( count % 3 != 0 ) ans *= Math . pow ( 2 , ( count % 3 ) ) ; for ( int i = 3 ; i <= Math . sqrt ( n ) ; i += 2 ) { count = 0 ; while ( n % i == 0 ) { count ++ ; n /= i ; } if ( count % 3 != 0 ) ans *= Math . pow ( i , ( count % 3 ) ) ; } if ( n > 2 ) ans *= n ; return ans ; } public static void main ( String [ ] args ) { int n = 128 ; System . out . print ( findMinNumber ( n ) + "NEW_LINE"); } }

Accumulator variables: ans, count, i, n
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void isPerfectSquare ( int x ) { int sr = ( int ) Math . sqrt ( x ) ; if ( sr * sr == x ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } public static void main ( String args [ ] ) { int n = 7 , k = 2 ; isPerfectSquare ( n + k ) ; } }

Class/struct names: GFG
Java program:
class GFG { static int countSteps ( int n ) { int steps = 0 ; while ( n > 0 ) { int largest = ( int ) Math . cbrt ( n ) ; n -= ( largest * largest * largest ) ; steps ++ ; } return steps ; } public static void main ( String [ ] args ) { int n = 150 ; System . out . print ( countSteps ( n ) ) ; } }

Accumulator variables: n, steps
Class/struct names: GFG
Java program:
class GFG { static int product ( int N ) { int ans = 1 ; int val = ( int ) Math . pow ( 2 , N - 1 ) ; for ( int i = 1 ; i <= N ; i ++ ) { ans *= ( int ) Math . pow ( i , val ) ; } return ans ; } public static void main ( String [ ] args ) { int N = 2 ; System . out . println ( product ( N ) ) ; } }

Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int circle ( int x1 , int y1 , int x2 , int y2 , int r1 , int r2 ) { int distSq = ( x1 - x2 ) * ( x1 - x2 ) + ( y1 - y2 ) * ( y1 - y2 ) ; int radSumSq = ( r1 + r2 ) * ( r1 + r2 ) ; if ( distSq == radSumSq ) return 1 ; else if ( distSq > radSumSq ) return - 1 ; else return 0 ; } public static void main ( String [ ] args ) { int x1 = - 10 , y1 = 8 ; int x2 = 14 , y2 = - 24 ; int r1 = 30 , r2 = 10 ; int t = circle ( x1 , y1 , x2 , y2 , r1 , r2 ) ; if ( t == 1 ) System . out . println ( " There ▁ are ▁ 3 ▁ common ▁ tangents " + " ▁ between ▁ the ▁ circles . " ) ; else if ( t < 0 ) System . out . println ( " There ▁ are ▁ 4 ▁ common ▁ tangents " + " ▁ between ▁ the ▁ circles . " ) ; else System . out . println ( " There ▁ are ▁ 2 ▁ common ▁ tangents " + " ▁ between ▁ the ▁ circles . " ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int GCD ( int a , int b ) { return ( b != 0 ? GCD ( b , a % b ) : a ) ; } static void ratiotang ( int r1 , int r2 ) { System . out . println ( " The ▁ ratio ▁ is ▁ " + r1 / GCD ( r1 , r2 ) + " : " + r2 / GCD ( r1 , r2 ) ) ; } public static void main ( String [ ] args ) { int r1 = 4 , r2 = 8 ; ratiotang ( r1 , r2 ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int Regions ( int Vertices , int Edges ) { int R = Edges + 2 - Vertices ; return R ; } public static void main ( String [ ] args ) { int V = 5 , E = 7 ; System . out . println ( Regions ( V , E ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static int GCD ( int a , int b ) { return ( b != 0 ? GCD ( b , a % b ) : a ) ; } static void ratiotang ( int r1 , int r2 ) { System . out . println ( " The ▁ ratio ▁ is ▁ " + r1 / GCD ( r1 , r2 ) + " ▁ : ▁ " + r2 / GCD ( r1 , r2 ) ) ; } public static void main ( String args [ ] ) { int r1 = 4 , r2 = 6 ; ratiotang ( r1 , r2 ) ; } }

Class/struct names: GFG
Java program:
class GFG { static void lengthOfTangent ( double r1 , double r2 , double d ) { System . out . println ( " The ▁ length ▁ of ▁ the ▁ transverse " + " ▁ common ▁ tangent ▁ is ▁ " + Math . sqrt ( Math . pow ( d , 2 ) - Math . pow ( ( r1 + r2 ) , 2 ) ) ) ; } public static void main ( String args [ ] ) { double r1 = 4 , r2 = 6 , d = 12 ; lengthOfTangent ( r1 , r2 , d ) ; } }

Class/struct names: GFG
Java program:
class GFG { static int remainingArea ( int N , int M , int K ) { while ( K -- > 0 && N > 0 && M > 0 ) { if ( N > M ) N = N - M ; else M = M - N ; } if ( N > 0 && M > 0 ) return N * M ; else return 0 ; } public static void main ( String [ ] args ) { int N = 5 , M = 3 , K = 2 ; System . out . println ( remainingArea ( N , M , K ) ) ; } }

Accumulator variables: K
Class/struct names: GFG
Java program:
class GFG { static void lengtang ( double r1 , double r2 ) { System . out . println ( " The ▁ length ▁ of ▁ the ▁ " + " direct ▁ common ▁ tangent ▁ is ▁ " + ( 2 * Math . sqrt ( r1 * r2 ) ) ) ; } public static void main ( String [ ] args ) { double r1 = 5 , r2 = 9 ; lengtang ( r1 , r2 ) ; } }

Class/struct names: GFG
Java program:
class GFG { static void dist ( double x1 , double y1 , double x2 , double y2 , double r ) { System . out . println ( " The ▁ shortest ▁ distance ▁ " + " between ▁ a ▁ point ▁ and ▁ a ▁ circle ▁ is ▁ " + ( Math . sqrt ( ( Math . pow ( ( x2 - x1 ) , 2 ) ) + ( Math . pow ( ( y2 - y1 ) , 2 ) ) ) - r ) ) ; } public static void main ( String [ ] args ) { double x1 = 4 , y1 = 6 , x2 = 35 , y2 = 42 , r = 5 ; dist ( x1 , y1 , x2 , y2 , r ) ; } }

Class/struct names: GFG
Java program:
class GFG { static double dist ( double m , double b1 , double b2 ) { double d = Math . abs ( b2 - b1 ) / ( ( m * m ) - 1 ) ; return d ; } public static void main ( String [ ] args ) { double m = 2 , b1 = 4 , b2 = 3 ; System . out . println ( dist ( m , b1 , b2 ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static float normal ( float m , float n ) { float N = ( float ) ( ( Math . abs ( m ) * Math . abs ( n ) ) / Math . sqrt ( ( Math . abs ( m ) * Math . abs ( m ) ) + ( Math . abs ( n ) * Math . abs ( n ) ) ) ) ; return N ; } public static void main ( String [ ] args ) { float m = - 5 , n = 3 ; System . out . println ( normal ( m , n ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static boolean isPossible ( int a [ ] , int n ) { int sum = 0 , maxS = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum += a [ i ] ; maxS = Math . max ( a [ i ] , maxS ) ; } if ( ( sum - maxS ) > maxS ) return true ; return false ; } public static void main ( String [ ] args ) { int a [ ] = { 2 , 3 , 4 } ; int n = a . length ; if ( isPossible ( a , n ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static float findAreaShaded ( float a ) { float sqArea = a * a ; float semiCircleArea = ( float ) ( 3.14 * ( a * a ) / 8 ) ; float ShadedArea = 4 * semiCircleArea - sqArea ; return ShadedArea ; } public static void main ( String [ ] args ) { float a = 10 ; System . out . println ( findAreaShaded ( a ) ) ; } }

Class/struct names: GFG
Java program:
class GfG { static int countSteps ( int x , int y ) { if ( x < y ) { return x + y + 2 * ( ( y - x ) / 2 ) ; } else { return x + y + 2 * ( ( ( x - y ) + 1 ) / 2 ) ; } } public static void main ( String [ ] args ) { int x = 4 , y = 3 ; System . out . println ( countSteps ( x , y ) ) ; } }

Class/struct names: GfG
Java program:
import java . util . * ; class GfG { static boolean isSlopeGood ( double slope , int arr [ ] , int n ) { Set < Double > setOfLines = new HashSet < Double > ( ) ; for ( int i = 0 ; i < n ; i ++ ) setOfLines . add ( arr [ i ] - slope * ( i ) ) ; return setOfLines . size ( ) == 2 ; } static boolean checkForParallel ( int arr [ ] , int n ) { boolean slope1 = isSlopeGood ( arr [ 1 ] - arr [ 0 ] , arr , n ) ; boolean slope2 = isSlopeGood ( arr [ 2 ] - arr [ 1 ] , arr , n ) ; boolean slope3 = isSlopeGood ( ( arr [ 2 ] - arr [ 0 ] ) / 2 , arr , n ) ; return ( slope1 == true slope2 == true slope3 == true ) ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 6 , 3 , 8 , 5 } ; int n = arr . length ; if ( checkForParallel ( arr , n ) == true ) System . out . println ( "1" ) ; else System . out . println ( "0" ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GfG
Java program:
class GFG { static boolean pointIsOnLine ( int m , int c , int x , int y ) { if ( y == ( ( m * x ) + c ) ) return true ; return false ; } public static void main ( String [ ] args ) { int m = 3 , c = 2 ; int x = 1 , y = 5 ; if ( pointIsOnLine ( m , c , x , y ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Class/struct names: GFG
Java program:
import java . util . HashMap ; import java . util . Map ; class GfG { static Pair < Integer , Integer > findFourthVertex ( int n , int m , String s [ ] ) { HashMap < Integer , Integer > row = new HashMap < > ( ) ; HashMap < Integer , Integer > col = new HashMap < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { if ( s [ i ] . charAt ( j ) == ' * ' ) { if ( row . containsKey ( i ) ) { row . put ( i , row . get ( i ) + 1 ) ; } else { row . put ( i , 1 ) ; } if ( col . containsKey ( j ) ) { col . put ( j , col . get ( j ) + 1 ) ; } else { col . put ( j , 1 ) ; } } } } int x = 0 , y = 0 ; for ( Map . Entry < Integer , Integer > entry : row . entrySet ( ) ) { if ( entry . getValue ( ) == 1 ) x = entry . getKey ( ) ; } for ( Map . Entry < Integer , Integer > entry : col . entrySet ( ) ) { if ( entry . getValue ( ) == 1 ) y = entry . getKey ( ) ; } Pair < Integer , Integer > ans = new Pair < > ( x + 1 , y + 1 ) ; return ans ; } public static void main ( String [ ] args ) { String s [ ] = { " * . * " , " * . . " , " . . . " } ; int n = s . length ; int m = s [ 0 ] . length ( ) ; Pair < Integer , Integer > rs = findFourthVertex ( n , m , s ) ; System . out . println ( rs . first + " ▁ " + rs . second ) ; } } class Pair < A , B > { A first ; B second ; public Pair ( A first , B second ) { this . first = first ; this . second = second ; } }

Index/key variables: i
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GfG, Pair
Java program:
import java . io . * ; class GFG { static float Area ( float a , float b ) { if ( a < 0 && b < 0 ) return - 1 ; float h = ( float ) Math . sqrt ( ( ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) ) / ( Math . pow ( a , 2 ) * Math . pow ( b , 2 ) ) ) ) ; float A = ( float ) ( 0.70477 * Math . pow ( h , 2 ) ) ; return A ; } public static void main ( String [ ] args ) { float a = 5 , b = 4 ; System . out . println ( Area ( a , b ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static int maxRectangles ( int L , int B , int l , int b ) { int horizontal = 0 , vertical = 0 ; if ( l <= L && b <= B ) { int columns = B / b ; int rows = L / l ; horizontal = rows * columns ; } if ( l <= B && b <= L ) { int columns = L / b ; int rows = B / l ; vertical = rows * columns ; } return Math . max ( horizontal , vertical ) ; } public static void main ( String [ ] args ) { int L = 10 , B = 7 , l = 4 , b = 3 ; System . out . print ( maxRectangles ( L , B , l , b ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static float cone ( float a ) { if ( a < 0 ) return - 1 ; float r = ( float ) ( a * Math . sqrt ( 2 ) ) / 3 ; float h = ( 2 * a ) / 3 ; float V = ( float ) ( 3.14 * Math . pow ( r , 2 ) * h ) ; return V ; } public static void main ( String [ ] args ) { float a = 5 ; System . out . println ( cone ( a ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static float Area ( float a ) { if ( a < 0 ) return - 1 ; float h = ( float ) 1.268 * a ; float A = ( float ) ( 0.70477 * Math . pow ( h , 2 ) ) ; return A ; } public static void main ( String [ ] args ) { float a = 5 ; System . out . println ( Area ( a ) ) ; } }

Class/struct names: GFG
Java program:
import java . lang . Math ; class GFG { static float Area ( float r ) { if ( r < 0 ) return - 1 ; float x = ( 2 * r ) / ( float ) ( Math . sqrt ( 5 ) ) ; float A = 0.70477f * ( float ) ( Math . pow ( x , 2 ) ) ; return A ; } public static void main ( String [ ] args ) { float r = 5 ; System . out . println ( Area ( r ) ) ; } }

Class/struct names: GFG