dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
import java . io . * ; class GFG { public static int LongestMountain ( int a [ ] ) { int i = 0 , j = - 1 , k = - 1 , d = 0 ; if ( a . length < 3 ) return 0 ; for ( i = 0 ; i < a . length - 1 ; i ++ ) { if ( a [ i + 1 ] > a [ i ] ) { if ( k != - 1 ) { k = - 1 ; j = - 1 ; } if ( j == - 1 ) j = i ; } else { if ( a [ i + 1 ] < a [ i ] ) { if ( j != - 1 ) k = i + 1 ; if ( k != - 1 && j != - 1 ) { if ( d < k - j + 1 ) d = k - j + 1 ; } } else { k = - 1 ; j = - 1 ; } } } if ( k != - 1 && j != - 1 ) { if ( d < k - j + 1 ) d = k - j + 1 ; } return d ; } public static void main ( String [ ] args ) { int a [ ] = { 1 , 3 , 1 , 4 , 5 , 6 , 7 , 8 , 9 , 8 , 7 , 6 , 5 } ; System . out . println ( LongestMountain ( a ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { public static String solve ( int [ ] A ) { int i , ctr = 0 ; for ( i = 0 ; i < A . length ; i ++ ) { if ( A [ i ] % 2 == 1 ) { ctr ++ ; } } if ( ctr % 2 == 1 ) { return " No " ; } else { return " Yes " ; } } public static void main ( String [ ] args ) { int [ ] arr = { 9 , 17 } ; System . out . println ( solve ( arr ) ) ; } }

Index/key variables: i
Accumulator variables: ctr, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static boolean isPerfectSquare ( double x ) { double sr = Math . sqrt ( x ) ; return ( ( sr - Math . floor ( sr ) ) == 0 ) ; } static int countSquares ( int n ) { int cnt = 0 ; for ( int i = ( int ) Math . pow ( 10 , ( n - 1 ) ) ; i < Math . pow ( 10 , n ) ; i ++ ) { if ( i != 0 && isPerfectSquare ( i ) ) cnt ++ ; } return cnt ; } public static void main ( String [ ] args ) { int n = 3 ; System . out . print ( countSquares ( n ) ) ; } }

Accumulator variables: cnt, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int countSquares ( int n ) { int r = ( int ) Math . ceil ( Math . sqrt ( Math . pow ( 10 , n ) ) ) ; int l = ( int ) Math . ceil ( Math . sqrt ( Math . pow ( 10 , n - 1 ) ) ) ; return r - l ; } public static void main ( String [ ] args ) { int n = 3 ; System . out . print ( countSquares ( n ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int summation ( int N ) { int co = ( N + 1 ) / 2 ; int ce = ( N ) / 2 ; int se = 2 * ( ( ce * ( ce + 1 ) ) * ( ce * ( ce + 1 ) ) ) ; int so = ( co * co ) * ( 2 * ( ( co * co ) ) - 1 ) ; return so - se ; } public static void main ( String [ ] args ) { int n = 3 ; System . out . println ( summation ( n ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static boolean isStar ( int N ) { double n = ( 6 + Math . sqrt ( 24 * N + 12 ) ) / 6 ; return ( n - ( int ) n ) == 0 ; } public static void main ( String [ ] args ) { int i = 13 ; if ( isStar ( i ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int findMinDivisor ( int arr [ ] , int n , int limit ) { int low = 0 , high = 1000000000 ; while ( low < high ) { int mid = ( low + high ) / 2 ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum += Math . ceil ( ( double ) arr [ i ] / ( double ) mid ) ; } if ( sum <= limit ) high = mid ; else low = mid + 1 ; } return low ; } public static void main ( String args [ ] ) { int arr [ ] = { 2 , 3 , 4 , 9 } ; int N = arr . length ; int K = 6 ; System . out . println ( findMinDivisor ( arr , N , K ) ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static int getCount ( int arr [ ] , int n ) { int count = 0 ; for ( int j = 1 ; j < n - 1 ; j ++ ) { int p = 0 , q = 0 ; for ( int i = 0 ; i < j ; i ++ ) { if ( arr [ j ] % arr [ i ] == 0 ) p ++ ; } for ( int k = j + 1 ; k < n ; k ++ ) { if ( arr [ k ] % arr [ j ] == 0 ) q ++ ; } count += p * q ; } return count ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 , 2 } ; int N = arr . length ; System . out . println ( getCount ( arr , N ) ) ; } }

Index/key variables: i, j, k
Accumulator variables: count, i, j, k, p, q
Iterator variables: i, j, k
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static float computeMaxValue ( float arr [ ] , int n ) { float ans = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { float val = Math . max ( arr [ i ] / arr [ j ] , arr [ j ] / arr [ i ] ) ; ans = Math . max ( ans , val ) ; } } return ans ; } public static void main ( String [ ] args ) { float arr [ ] = { 15 , 10 , 3 , 2 } ; int N = arr . length ; System . out . println ( computeMaxValue ( arr , N ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static int kthNonDivisible ( int N , int K ) { return ( int ) ( K + Math . floor ( ( K - 1 ) / ( N - 1 ) ) ) ; } public static void main ( String [ ] args ) { int N = 3 ; int K = 6 ; System . out . print ( kthNonDivisible ( N , K ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int sz = ( int ) 1e3 ; static boolean isEvenParity ( int x ) { int parity = 0 ; while ( x != 0 ) { if ( x % 2 == 1 ) parity ++ ; x = x >> 1 ; } if ( parity % 2 == 0 ) return true ; else return false ; } static void printArray ( int arr [ ] , int len ) { for ( int i = 0 ; i < len ; i ++ ) { System . out . print ( arr [ i ] + " ▁ " ) ; } } static void findPairEvenParity ( int arr [ ] , int len ) { int firstMaximum = Integer . MIN_VALUE ; int secondMaximum = Integer . MIN_VALUE ; for ( int i = 0 ; i < len ; i ++ ) { if ( isEvenParity ( arr [ i ] ) ) { if ( arr [ i ] >= firstMaximum ) { secondMaximum = firstMaximum ; firstMaximum = arr [ i ] ; } else if ( arr [ i ] >= secondMaximum ) { secondMaximum = arr [ i ] ; } } } System . out . print ( firstMaximum + " ▁ " + secondMaximum ) ; } public static void main ( String [ ] args ) { int arr [ ] = { 18 , 15 , 8 , 9 , 14 } ; int len = arr . length ; findPairEvenParity ( arr , len ) ; } }

Index/key variables: i
Accumulator variables: i, parity
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean isHexagonal ( int N ) { float val = 8 * N + 1 ; float x = 1 + ( float ) Math . sqrt ( val ) ; float n = ( x ) / 4 ; if ( ( n - ( int ) n ) == 0 ) return true ; else return false ; } public static void main ( String [ ] args ) { int N = 14 ; if ( isHexagonal ( N ) == true ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Class/struct names: GFG
Java program:
class GFG { static void NumbertoCharacter ( int n ) { int rev = 0 , r = 0 ; while ( n > 0 ) { r = n % 10 ; rev = rev * 10 + r ; n = n / 10 ; } while ( rev > 0 ) { r = rev % 10 ; switch ( r ) { case 1 : System . out . print ( " one ▁ " ) ; break ; case 2 : System . out . print ( " two ▁ " ) ; break ; case 3 : System . out . print ( " three ▁ " ) ; break ; case 4 : System . out . print ( " four ▁ " ) ; break ; case 5 : System . out . print ( " five ▁ " ) ; break ; case 6 : System . out . print ( " six ▁ " ) ; break ; case 7 : System . out . print ( " seven ▁ " ) ; break ; case 8 : System . out . print ( " eight ▁ " ) ; break ; case 9 : System . out . print ( " nine ▁ " ) ; break ; case 0 : System . out . print ( " zero ▁ " ) ; break ; default : System . out . print ( " UnValid ▁ " ) ; break ; } rev = rev / 10 ; } } public static void main ( String [ ] args ) { int n = 12345 ; NumbertoCharacter ( n ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; import java . lang . * ; import java . util . * ; class GFG { static int Solve ( int arr [ ] , int n ) { int temp = 0 , count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { temp = 0 ; for ( int j = i ; j < n ; j ++ ) { temp += arr [ j ] ; if ( ( temp + 2 ) % 4 != 0 ) count ++ ; } } return count ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 } ; int N = arr . length ; System . out . println ( Solve ( arr , N ) ) ; } }

Index/key variables: j
Accumulator variables: count, i, j, temp
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int m = 4 ; static long power ( long x , long y , long p ) { long res = 1 ; x = x % p ; while ( y > 0 ) { if ( y % 2 == 1 ) res = ( res * x ) % p ; y = y >> 1 ; x = ( x * x ) % p ; } return res ; } static void nCr ( int n , long p , int f [ ] [ ] ) { for ( int i = 0 ; i <= n ; i ++ ) { for ( int j = 0 ; j <= m ; j ++ ) { if ( j > i ) f [ i ] [ j ] = 0 ; else if ( j == 0 j == i ) f [ i ] [ j ] = 1 ; else f [ i ] [ j ] = ( f [ i - 1 ] [ j ] + f [ i - 1 ] [ j - 1 ] ) % ( int ) p ; } } } static void operations ( int arr [ ] , int n , int f [ ] [ ] ) { long p = 1000000007 ; nCr ( n , p - 1 , f ) ; Arrays . sort ( arr ) ; long ans = 1 ; for ( int i = 0 ; i < n ; i ++ ) { long x = 0 ; for ( int j = 1 ; j <= m ; j ++ ) { if ( m % j == 0 ) x = ( x + ( f [ n - i - 1 ] [ m - j ] * f [ i ] [ j - 1 ] ) % ( p - 1 ) ) % ( p - 1 ) ; } ans = ( ( ans * power ( arr [ i ] , x , p ) ) % p ) ; } System . out . print ( ans + "NEW_LINE"); } public static void main ( String [ ] args ) { int arr [ ] = { 4 , 5 , 7 , 9 , 3 } ; int n = arr . length ; int [ ] [ ] f = new int [ n + 1 ] [ m + 1 ] ; operations ( arr , n , f ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static boolean prodSquare ( int n ) { for ( long i = 2 ; i * i <= n ; i ++ ) for ( long j = 2 ; j <= n ; j ++ ) if ( i * i * j * j == n ) return true ; return false ; } public static void main ( String [ ] args ) { int n = 25 ; if ( prodSquare ( n ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean prodSquare ( int n ) { HashMap < Float , Float > s = new HashMap < Float , Float > ( ) ; for ( int i = 2 ; i * i <= n ; ++ i ) { s . put ( ( float ) ( i * i ) , ( float ) 1 ) ; if ( s . containsKey ( ( float ) n / ( i * i ) ) ) return true ; } return false ; } public static void main ( String [ ] args ) { int n = 25 ; if ( prodSquare ( n ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void printArr ( int n ) { if ( n % 4 == 0 ) { for ( int i = 1 ; i <= n / 2 ; i ++ ) System . out . print ( i * 2 + " ▁ " ) ; for ( int i = 1 ; i < n / 2 ; i ++ ) System . out . print ( i * 2 - 1 + " ▁ " ) ; System . out . println ( n + n / 2 - 1 ) ; } else System . out . print ( " - 1" ) ; } public static void main ( String [ ] args ) { int n = 22 ; printArr ( n ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int GetSum ( int n ) { Vector < Integer > divisors = new Vector < Integer > ( ) ; for ( int i = 1 ; i * i <= n ; i ++ ) { if ( n % i == 0 ) { divisors . add ( i ) ; if ( i != n / i ) { divisors . add ( n / i ) ; } } } int ans = 1 ; for ( int i = 0 ; i < divisors . size ( ) ; i ++ ) { ans *= ( divisors . get ( i ) + 1 ) ; } ans = ans - 1 ; return ans ; } public static void main ( String [ ] args ) { int N = 4 ; System . out . println ( GetSum ( N ) ) ; } }

Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static boolean isPowerful ( int n ) { while ( n % 2 == 0 ) { int power = 0 ; while ( n % 2 == 0 ) { n /= 2 ; power ++ ; } if ( power == 1 ) return false ; } for ( int factor = 3 ; factor <= Math . sqrt ( n ) ; factor += 2 ) { int power = 0 ; while ( n % factor == 0 ) { n = n / factor ; power ++ ; } if ( power == 1 ) return false ; } return ( n == 1 ) ; } static int longestPowerfulSubsequence ( int arr [ ] , int n ) { int answer = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( isPowerful ( arr [ i ] ) ) answer ++ ; } return answer ; } public static void main ( String [ ] args ) { int arr [ ] = { 6 , 4 , 10 , 13 , 9 , 25 } ; int n = arr . length ; System . out . print ( longestPowerfulSubsequence ( arr , n ) + "NEW_LINE"); } }

Index/key variables: i
Accumulator variables: answer, factor, i, n, power
Iterator variables: factor, i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int maxOR ( int arr [ ] , int n ) { int max_value = Arrays . stream ( arr ) . max ( ) . getAsInt ( ) ; int number_of_bits = ( int ) ( ( Math . log ( max_value ) ) ) + 2 ; int complement = ( ( 1 << number_of_bits ) - 1 ) ^ max_value ; int c = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] != max_value ) { c = Math . max ( c , ( complement & arr [ i ] ) ) ; } } return ( max_value + c ) ; } public static void main ( String [ ] args ) { int arr [ ] = { 3 , 6 , 8 , 16 } ; int n = arr . length ; System . out . print ( maxOR ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void update ( int res [ ] , int L , int R , int K ) { L -= 1 ; R -= 1 ; res [ L ] ^= K ; res [ R + 1 ] ^= K ; } static void display ( int arr [ ] , int res [ ] , int n ) { int i ; for ( i = 1 ; i < n ; i ++ ) { res [ i ] = res [ i ] ^ res [ i - 1 ] ; } for ( i = 0 ; i < n ; i ++ ) { System . out . print ( ( arr [ i ] ^ res [ i ] ) + " ▁ " ) ; } System . out . println ( ) ; } public static void main ( String [ ] args ) { int arr [ ] = { 2 , 4 , 6 , 8 , 10 } ; int N = arr . length ; int res [ ] = new int [ N ] ; int L = 1 , R = 3 , K = 2 ; update ( res , L , R , K ) ; L = 2 ; R = 4 ; K = 3 ; update ( res , L , R , K ) ; display ( arr , res , N ) ; } }

Index/key variables: L, N, i
Accumulator variables: L, R, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; import java . lang . * ; class GFG { static boolean check ( int a [ ] , int n , int k ) { Map < Integer , Integer > m = new HashMap < > ( ) ; int extra = 0 ; for ( int i = k ; i < n ; i ++ ) m . put ( a [ i ] , m . getOrDefault ( a [ i ] , 0 ) + 1 ) ; for ( Integer x : m . values ( ) ) extra += x - 1 ; if ( extra == 0 ) return true ; for ( int i = 1 ; i + k - 1 < n ; i ++ ) { if ( m . get ( a [ i + k - 1 ] ) > 1 ) extra -- ; m . put ( a [ i + k - 1 ] , m . get ( a [ i + k - 1 ] ) - 1 ) ; m . put ( a [ i - 1 ] , m . get ( a [ i - 1 ] ) + 1 ) ; if ( m . get ( a [ i - 1 ] ) > 1 ) extra ++ ; if ( extra == 0 ) return true ; } return false ; } static int minlength ( int a [ ] , int n ) { int lo = 0 , hi = n + 1 ; int ans = 0 ; while ( lo < hi ) { int mid = ( lo + hi ) / 2 ; if ( check ( a , n , mid ) ) { ans = mid ; hi = mid ; } else lo = mid + 1 ; } return ans ; } public static void main ( String [ ] args ) { int a [ ] = { 1 , 2 , 1 , 2 , 3 } ; int n = a . length ; System . out . println ( minlength ( a , n ) ) ; } }

Index/key variables: i
Accumulator variables: extra, i
Iterator variables: i, x
Class/struct names: GFG
Java program:
class GFG { static void findNumbers ( int N ) { for ( int i = 1 ; i <= N / 2 ; i ++ ) { System . out . print ( i + " , ▁ " + - i + " , ▁ " ) ; } if ( N % 2 == 1 ) System . out . print ( 0 ) ; } public static void main ( String [ ] args ) { int N = 10 ; findNumbers ( N ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class ComputeElectricityBill { public static int calculateBill ( int units ) { if ( units <= 100 ) { return units * 10 ; } else if ( units <= 200 ) { return ( 100 * 10 ) + ( units - 100 ) * 15 ; } else if ( units <= 300 ) { return ( 100 * 10 ) + ( 100 * 15 ) + ( units - 200 ) * 20 ; } else if ( units > 300 ) { return ( 100 * 10 ) + ( 100 * 15 ) + ( 100 * 20 ) + ( units - 300 ) * 25 ; } return 0 ; } public static void main ( String args [ ] ) { int units = 250 ; System . out . println ( calculateBill ( units ) ) ; } }

Class/struct names: ComputeElectricityBill
Java program:
class GFG { static int countPrimeFactors ( int n ) { if ( n == 1 ) return 0 ; int cnt = 0 ; while ( n % 2 == 0 ) { cnt ++ ; n = n / 2 ; } for ( int i = 3 ; i <= Math . sqrt ( n ) ; i += 2 ) { while ( n % i == 0 ) { cnt ++ ; n = n / i ; } } if ( n > 2 ) cnt ++ ; return cnt ; } public static void main ( String [ ] args ) { int x = 8 ; int prime_factor_cnt = countPrimeFactors ( x ) ; System . out . print ( prime_factor_cnt + "NEW_LINE"); } }

Accumulator variables: cnt, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int countPalindromic ( int n ) { int count ; if ( n % 2 == 1 ) { count = ( int ) Math . pow ( 9 , ( n - 1 ) / 2 ) ; } else { count = ( int ) Math . pow ( 9 , ( n - 2 ) / 2 ) ; } return count ; } public static void main ( String [ ] args ) { int n = 3 ; System . out . println ( countPalindromic ( n ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static int countSubArrayWithOddProduct ( int A [ ] , int N ) { int count = 0 ; int last = - 1 ; int K = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( A [ i ] % 2 == 0 ) { K = ( i - last - 1 ) ; count += ( K * ( K + 1 ) / 2 ) ; last = i ; } } K = ( N - last - 1 ) ; count += ( K * ( K + 1 ) / 2 ) ; return count ; } public static void main ( String args [ ] ) { int arr [ ] = { 12 , 15 , 7 , 3 , 25 , 6 , 2 , 1 , 1 , 7 } ; int n = arr . length ; System . out . println ( countSubArrayWithOddProduct ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . Scanner ; class CGPA { public static double CgpaCalc ( double [ ] marks , int n ) { double grade [ ] = new double [ n ] ; double cgpa , sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { grade [ i ] = ( marks [ i ] / 10 ) ; } for ( int i = 0 ; i < n ; i ++ ) { sum += grade [ i ] ; } cgpa = sum / n ; return cgpa ; } public static void main ( String args [ ] ) { int n = 5 ; double [ ] marks = { 90 , 80 , 70 , 80 , 90 } ; double cgpa = CgpaCalc ( marks , n ) ; System . out . println ( " CGPA ▁ = ▁ " + cgpa ) ; System . out . println ( " CGPA ▁ Percentage ▁ = ▁ " + String . format ( " % .2f " , cgpa * 9.5 ) ) ; } }

Index/key variables: i, n
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: CGPA
Java program:
class GFG { static void findMinXORSubarray ( int arr [ ] , int n , int k ) { if ( n < k ) return ; int res_index = 0 ; int curr_xor = 0 ; for ( int i = 0 ; i < k ; i ++ ) curr_xor ^= arr [ i ] ; int min_xor = curr_xor ; for ( int i = k ; i < n ; i ++ ) { curr_xor ^= ( arr [ i ] ^ arr [ i - k ] ) ; if ( curr_xor < min_xor ) { min_xor = curr_xor ; res_index = ( i - k + 1 ) ; } } System . out . print ( min_xor + "NEW_LINE"); } public static void main ( String [ ] args ) { int arr [ ] = { 3 , 7 , 90 , 20 , 10 , 50 , 40 } ; int k = 3 ; int n = arr . length ; findMinXORSubarray ( arr , n , k ) ; } }

Index/key variables: i
Accumulator variables: curr_xor, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static String getNumber ( int a , int b ) { String X = Integer . toString ( a ) ; String Y = Integer . toString ( b ) ; String XY = X + Y ; String YX = Y + X ; return XY . compareTo ( YX ) > 0 ? XY : YX ; } static void printMaxPair ( int arr [ ] , int n ) { int largest = Integer . MIN_VALUE ; for ( int i = 0 ; i < n ; i ++ ) for ( int j = i + 1 ; j < n ; j ++ ) { int number = Integer . parseInt ( getNumber ( arr [ i ] , arr [ j ] ) ) ; largest = Math . max ( largest , number ) ; } System . out . println ( largest ) ; } public static void main ( String [ ] args ) { int a [ ] = { 23 , 14 , 16 , 25 , 3 , 9 } ; int n = a . length ; printMaxPair ( a , n ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { public static Boolean checkGoldenRatio ( float a , float b ) { if ( a <= b ) { float temp = a ; a = b ; b = temp ; } String ratio1 = String . format ( " % .3f " , a / b ) ; String ratio2 = String . format ( " % .3f " , ( a + b ) / a ) ; if ( ratio1 . equals ( ratio2 ) && ratio1 . equals ( "1.618" ) ) { System . out . println ( " Yes " ) ; return true ; } else { System . out . println ( " No " ) ; return false ; } } public static void main ( String [ ] args ) { float a = ( float ) 0.618 ; float b = 1 ; checkGoldenRatio ( a , b ) ; } }

Class/struct names: GFG
Java program:
class GFG { static int minNum ( int n , int k ) { int x = ( int ) ( Math . log ( n ) / Math . log ( k ) ) + 1 ; int mn = ( int ) ( Math . pow ( k , x ) - n ) ; return mn ; } public static void main ( String [ ] args ) { int n = 20 , k = 5 ; System . out . print ( minNum ( n , k ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int previousPerfectSquare ( int N ) { int prevN = ( int ) Math . floor ( Math . sqrt ( N ) ) ; if ( prevN * prevN == N ) prevN -= 1 ; return prevN * prevN ; } static int previousPerfectCube ( int N ) { int prevN = ( int ) Math . floor ( Math . cbrt ( N ) ) ; if ( prevN * prevN * prevN == N ) prevN -= 1 ; return prevN * prevN * prevN ; } public static void main ( String [ ] args ) { int n = 30 ; System . out . println ( previousPerfectSquare ( n ) ) ; System . out . println ( previousPerfectCube ( n ) ) ; } }

Accumulator variables: prevN
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int findCount ( int arr [ ] , int n ) { int res = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) for ( int j = i + 1 ; j < n ; j ++ ) if ( ( arr [ i ] % 2 == 0 ) && ( arr [ j ] % 2 == 1 ) ) { res ++ ; } return res ; } public static void main ( String [ ] args ) { int a [ ] = { 5 , 4 , 1 , 2 , 3 } ; int n = a . length ; System . out . print ( findCount ( 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 findCount ( int arr [ ] , int n ) { int count = 0 , ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] % 2 == 0 ) { count ++ ; } else { ans = ans + count ; } } return ans ; } public static void main ( String [ ] args ) { int a [ ] = { 5 , 4 , 1 , 2 , 3 } ; int n = a . length ; System . out . print ( findCount ( a , n ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
Java program:
public class GFG { private static long product ( int [ ] arr ) { double occurrence = Math . pow ( 2 , arr . length - 1 ) ; double product = 1 ; for ( int i = 0 ; i < arr . length ; i ++ ) { product *= Math . pow ( arr [ i ] , occurrence ) ; } return ( long ) product ; } public static void main ( String [ ] args ) { int [ ] arr = { 10 , 3 , 7 } ; System . out . println ( product ( arr ) ) ; } }

Index/key variables: i
Accumulator variables: i, product
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int MOD = 1000000007 ; static int power ( int a , int b ) { if ( b == 0 ) return 1 ; int temp = power ( a , b / 2 ) ; temp = ( temp * temp ) % MOD ; if ( b % 2 != 0 ) { temp = ( temp * a ) % MOD ; } return temp ; } static void palindromicSum ( int N ) { int sum = 0 , res , ways ; if ( N == 1 ) { System . out . print ( "9" + "NEW_LINE"); return ; } if ( N == 2 ) { System . out . print ( "99" + "NEW_LINE"); return ; } ways = N / 2 ; if ( N % 2 == 0 ) ways -- ; res = power ( 9 , ways - 1 ) ; for ( int i = 0 ; i < N ; i ++ ) { sum = sum * 10 + 45 * res ; sum %= MOD ; } System . out . print ( sum + "NEW_LINE"); } public static void main ( String [ ] args ) { int N = 3 ; palindromicSum ( N ) ; } }

Accumulator variables: i, ways
Iterator variables: i
Class/struct names: GFG