dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
class GFG { static int count ( int a [ ] , int n ) { int countElements = 0 ; for ( int i = 0 ; i < n ; i ++ ) { boolean flag = true ; for ( int j = 0 ; j < n ; j ++ ) { if ( i == j ) continue ; if ( a [ i ] % a [ j ] == 0 ) { flag = false ; break ; } } if ( flag == true ) ++ countElements ; } return countElements ; } public static void main ( String [ ] args ) { int arr [ ] = { 86 , 45 , 18 , 4 , 8 , 28 , 19 , 33 , 2 } ; int n = arr . length ; System . out . print ( count ( arr , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Boolean variables: flag
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int smallestNumber ( int N ) { return ( int ) ( N * Math . ceil ( Math . pow ( 10 , ( N - 1 ) ) / N ) ) ; } public static void main ( String [ ] args ) { int N = 2 ; System . out . print ( smallestNumber ( N ) ) ; } }

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

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int CountPairs ( int [ ] arr , int n ) { int even = 0 , odd = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] % 2 == 0 ) even ++ ; else odd ++ ; } return ( even * ( even - 1 ) ) / 2 + ( even * odd ) ; } public static void main ( String [ ] args ) { int [ ] arr = { 8 , 2 , 3 , 1 , 4 , 2 } ; int n = arr . length ; System . out . println ( CountPairs ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: even, i, odd
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static boolean isComposite ( int n ) { if ( n <= 1 ) return false ; if ( n <= 3 ) return false ; if ( n % 2 == 0 n % 3 == 0 ) return true ; for ( int i = 5 ; i * i <= n ; i = i + 6 ) if ( n % i == 0 || n % ( i + 2 ) == 0 ) return true ; return false ; } static boolean isGiugaNum ( int n ) { if ( ! ( isComposite ( n ) ) ) return false ; int N = n ; while ( n % 2 == 0 ) { if ( ( N / 2 - 1 ) % 2 != 0 ) return false ; n = n / 2 ; } for ( int i = 3 ; i <= Math . sqrt ( n ) ; i = i + 2 ) { while ( n % i == 0 ) { if ( ( N / i - 1 ) % i != 0 ) return false ; n = n / i ; } } if ( n > 2 ) if ( ( N / n - 1 ) % n != 0 ) return false ; return true ; } public static void main ( String [ ] args ) { int n = 30 ; if ( isGiugaNum ( n ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static boolean isDroll ( int n ) { if ( n == 1 ) return false ; int sum_even = 0 ; int sum_odd = 0 ; while ( n % 2 == 0 ) { sum_even += 2 ; n = n / 2 ; } for ( int i = 3 ; i <= Math . sqrt ( n ) ; i = i + 2 ) { while ( n % i == 0 ) { sum_odd += i ; n = n / i ; } } if ( n > 2 ) sum_odd += n ; return sum_even == sum_odd ; } public static void main ( String [ ] args ) { int n = 72 ; if ( isDroll ( n ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Accumulator variables: sum_even, sum_odd
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { public static int gcd ( int a , int b ) { if ( b == 0 ) return a ; return ( gcd ( b , a % b ) ) ; } public static int CountPairs ( int n ) { int cnt = 0 ; for ( int i = 1 ; i * i <= n ; i ++ ) { if ( n % i == 0 ) { int div1 = i ; int div2 = n / i ; int sum = div1 + div2 ; if ( gcd ( sum , n ) == 1 ) cnt += 1 ; } } return cnt ; } public static void main ( String [ ] args ) { int n = 24 ; System . out . println ( CountPairs ( n ) ) ; } }

Accumulator variables: cnt, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static boolean isPossible ( int A , int B ) { return ( A - B > 1 ) ; } public static void main ( String [ ] args ) { int A = 10 , B = 4 ; if ( isPossible ( A , B ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Class/struct names: GFG
Java program:
import java . util . Vector ; class GFG { static int [ ] sub = new int [ 100005 ] ; static int minDivisorDifference ( int n ) { int num1 = 0 ; int num2 = 0 ; for ( int i = ( int ) Math . sqrt ( n ) ; i <= n ; i ++ ) { if ( n % i == 0 ) { num1 = i ; num2 = n / i ; break ; } } return Math . abs ( num1 - num2 ) ; } static int dfs ( Vector < Integer > g [ ] , int u , int par ) { sub [ u ] = minDivisorDifference ( u ) ; int mx = 0 ; for ( int c : g [ u ] ) { if ( c != par ) { int ans = dfs ( g , c , u ) ; mx = Math . max ( mx , ans ) ; } } sub [ u ] += mx ; return sub [ u ] ; } public static void main ( String [ ] args ) { @ SuppressWarnings ( " unchecked " ) Vector < Integer > [ ] g = new Vector [ 100005 ] ; for ( int i = 0 ; i < g . length ; i ++ ) g [ i ] = new Vector < Integer > ( ) ; int edges = 6 ; g [ 18 ] . add ( 7 ) ; g [ 7 ] . add ( 18 ) ; g [ 18 ] . add ( 15 ) ; g [ 15 ] . add ( 18 ) ; g [ 15 ] . add ( 2 ) ; g [ 2 ] . add ( 15 ) ; g [ 7 ] . add ( 4 ) ; g [ 4 ] . add ( 7 ) ; g [ 7 ] . add ( 12 ) ; g [ 12 ] . add ( 7 ) ; g [ 12 ] . add ( 9 ) ; g [ 9 ] . add ( 12 ) ; int root = 18 ; System . out . print ( dfs ( g , root , - 1 ) ) ; } }

Index/key variables: i, u
Accumulator variables: i
Iterator variables: c, i
Class/struct names: GFG
Java program:
class GFG { static boolean isCenteredcube ( int N ) { int i = 1 ; while ( true ) { int ith_term = ( 2 * i + 1 ) * ( i * i + i + 1 ) ; if ( ith_term == N ) { return true ; } if ( ith_term > N ) { return false ; } i ++ ; } } public static void main ( String [ ] args ) { int N = 9 ; if ( isCenteredcube ( N ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }

Accumulator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static float productOfGP ( float a , float r , int n ) { float product = 1 ; for ( int i = 0 ; i < n ; i ++ ) { product = product * a ; a = a * r ; } return product ; } public static void main ( String args [ ] ) { float a = 1 , r = 2 ; int N = 4 ; System . out . print ( productOfGP ( a , r , N ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int gcd ( int a , int b ) { if ( b == 0 ) { return a ; } return gcd ( b , a % b ) ; } static int findlcm ( int arr [ ] , int n ) { int ans = arr [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { ans = ( ( ( arr [ i ] * ans ) ) / ( gcd ( arr [ i ] , ans ) ) ) ; } return ans ; } static void addReduce ( int n , int num [ ] , int den [ ] ) { int final_numerator = 0 ; int final_denominator = findlcm ( den , n ) ; for ( int i = 0 ; i < n ; i ++ ) { final_numerator = final_numerator + ( num [ i ] ) * ( final_denominator / den [ i ] ) ; } int GCD = gcd ( final_numerator , final_denominator ) ; final_numerator /= GCD ; final_denominator /= GCD ; System . out . println ( final_numerator + " / " + final_denominator ) ; } public static void main ( String [ ] args ) { int N = 3 ; int arr1 [ ] = { 1 , 2 , 5 } ; int arr2 [ ] = { 2 , 1 , 6 } ; addReduce ( N , arr1 , arr2 ) ; } }

Index/key variables: i
Accumulator variables: final_denominator, final_numerator, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static int gcd ( int a , int b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } static int minLCM ( int arr [ ] , int n ) { int ans = Integer . MAX_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { int g = gcd ( arr [ i ] , arr [ j ] ) ; int lcm = arr [ i ] / g * arr [ j ] ; ans = Math . min ( ans , lcm ) ; } } return ans ; } public static void main ( String [ ] args ) { int arr [ ] = { 2 , 4 , 3 , 6 , 5 } ; int n = arr . length ; System . out . println ( minLCM ( arr , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void solve ( int n ) { int upper_limit = ( int ) ( Math . ceil ( Math . pow ( n , 1.0 / 4 ) ) ) ; for ( int x = 0 ; x <= upper_limit ; x ++ ) { for ( int y = 0 ; y <= upper_limit ; y ++ ) { int num1 = x * x * x * x ; int num2 = y * y * y * y ; if ( num1 - num2 == n ) { System . out . print ( " x ▁ = ▁ " + x + " , ▁ y ▁ = ▁ " + y ) ; return ; } } } System . out . print ( - 1 ) ; } public static void main ( String [ ] args ) { int n = 15 ; solve ( n ) ; } }

Accumulator variables: x, y
Iterator variables: x, y
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean divisorsSame ( int n ) { int even_div = 0 , odd_div = 0 ; for ( int i = 1 ; i <= Math . sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { if ( n / i == i ) { if ( i % 2 == 0 ) { even_div ++ ; } else { odd_div ++ ; } } else { if ( i % 2 == 0 ) { even_div ++ ; } else { odd_div ++ ; } if ( n / i % 2 == 0 ) { even_div ++ ; } else { odd_div ++ ; } } } } return ( even_div == odd_div ) ; } public static void main ( String [ ] args ) { int N = 6 ; if ( divisorsSame ( N ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }

Accumulator variables: even_div, i, odd_div
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static boolean isPrime ( int n ) { if ( n <= 1 ) return false ; if ( n <= 3 ) return true ; if ( n % 2 == 0 n % 3 == 0 ) return false ; for ( int i = 5 ; i * i <= n ; i += 6 ) if ( n % i == 0 || n % ( i + 2 ) == 0 ) return false ; return true ; } static boolean isBalancedPrime ( int n ) { if ( ! isPrime ( n ) n == 2 ) return false ; int previous_prime = n - 1 ; int next_prime = n + 1 ; while ( ! isPrime ( next_prime ) ) next_prime ++ ; while ( ! isPrime ( previous_prime ) ) previous_prime -- ; int mean = ( previous_prime + next_prime ) / 2 ; if ( n == mean ) return true ; else return false ; } public static void main ( String [ ] args ) { int n = 53 ; if ( isBalancedPrime ( n ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Accumulator variables: i, next_prime, previous_prime
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static final int N = 100001 ; static Vector < Integer > [ ] adj = new Vector [ N ] ; static int [ ] a = new int [ N ] ; static int [ ] ans = new int [ N ] ; static boolean hasOddNumberOfDivisors ( int n ) { if ( ( double ) Math . sqrt ( n ) == ( int ) Math . sqrt ( n ) ) return true ; return false ; } static int dfs ( int node , int parent ) { int count = 0 ; for ( int i : adj [ node ] ) { if ( i != parent ) { count += dfs ( i , node ) ; } } if ( hasOddNumberOfDivisors ( a [ node ] ) ) ++ count ; ans [ node ] = count ; return count ; } public static void main ( String [ ] args ) { int n = 5 ; int [ ] q = { 4 , 1 , 5 , 3 } ; for ( int i = 0 ; i < adj . length ; i ++ ) adj [ i ] = new Vector < Integer > ( ) ; adj [ 1 ] . add ( 2 ) ; adj [ 2 ] . add ( 1 ) ; adj [ 2 ] . add ( 3 ) ; adj [ 3 ] . add ( 2 ) ; adj [ 3 ] . add ( 4 ) ; adj [ 4 ] . add ( 3 ) ; adj [ 1 ] . add ( 5 ) ; adj [ 5 ] . add ( 1 ) ; a [ 1 ] = 4 ; a [ 2 ] = 9 ; a [ 3 ] = 14 ; a [ 4 ] = 100 ; a [ 5 ] = 5 ; dfs ( 1 , - 1 ) ; for ( int i = 0 ; i < q . length ; i ++ ) { System . out . print ( ans [ q [ i ] ] + " ▁ " ) ; } } }

Index/key variables: N, i, node
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . lang . * ; import java . util . * ; class GFG { public static int lowerBound ( int [ ] array , int length , int value ) { int low = 0 ; int high = length ; while ( low < high ) { final int mid = ( low + high ) / 2 ; if ( value <= array [ mid ] ) { high = mid ; } else { low = mid + 1 ; } } return low ; } public static int costCalculation ( int current , int arr [ ] , int n , int pref [ ] , int a , int r , int minimum ) { int index = lowerBound ( arr , arr . length , current ) ; int left = index * current - pref [ index ] ; int right = pref [ n ] - pref [ index ] - ( n - index ) * current ; int res = Math . min ( left , right ) ; left -= res ; right -= res ; int total = res * minimum ; total += left * a ; total += right * r ; return total ; } public static void solve ( int arr [ ] , int n , int a , int r , int m ) { Arrays . sort ( arr ) ; int minimum = Math . min ( a + r , m ) ; int [ ] pref = new int [ n + 1 ] ; Arrays . fill ( pref , 0 ) ; for ( int i = 0 ; i < n ; i ++ ) pref [ i + 1 ] = pref [ i ] + arr [ i ] ; int ans = 10000 ; for ( int i = 0 ; i < n ; i ++ ) ans = Math . min ( ans , costCalculation ( arr [ i ] , arr , n , pref , a , r , minimum ) ) ; ans = Math . min ( ans , costCalculation ( pref [ n ] / n , arr , n , pref , a , r , minimum ) ) ; ans = Math . min ( ans , costCalculation ( pref [ n ] / n + 1 , arr , n , pref , a , r , minimum ) ) ; System . out . println ( ans ) ; } public static void main ( String args [ ] ) { int arr [ ] = { 5 , 5 , 3 , 6 , 5 } ; int A = 1 , R = 2 , M = 4 ; int size = arr . length ; solve ( arr , size , A , R , M ) ; } }

Index/key variables: i, index, mid, n
Accumulator variables: i, left, right, total
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int countBinaries ( int N ) { int ctr = 1 ; int ans = 0 ; while ( N > 0 ) { if ( N % 10 == 1 ) { ans += Math . pow ( 2 , ctr - 1 ) ; } else if ( N % 10 > 1 ) { ans = ( int ) ( Math . pow ( 2 , ctr ) - 1 ) ; } ctr ++ ; N /= 10 ; } return ans ; } public static void main ( String [ ] args ) { int N = 20 ; System . out . print ( countBinaries ( N ) ) ; } }

Accumulator variables: N, ans, ctr
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int countBinaries ( int N ) { Vector < Integer > powersOfTwo = new Vector < Integer > ( 11 ) ; powersOfTwo . add ( 1 ) ; for ( int i = 1 ; i < 11 ; i ++ ) { powersOfTwo . add ( powersOfTwo . get ( i - 1 ) * 2 ) ; } int ctr = 1 ; int ans = 0 ; while ( N > 0 ) { if ( N % 10 == 1 ) { ans += powersOfTwo . get ( ctr - 1 ) ; } else if ( N % 10 > 1 ) { ans = powersOfTwo . get ( ctr ) - 1 ; } ctr ++ ; N /= 10 ; } return ans ; } public static void main ( String [ ] args ) { int N = 20 ; System . out . print ( countBinaries ( N ) ) ; } }

Accumulator variables: N, ans, ctr, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { public static int center_heptagonal_num ( int n ) { return ( 7 * n * n - 7 * n + 2 ) / 2 ; } public static int sum_center_heptagonal_num ( int n ) { int summ = 0 ; for ( int i = 1 ; i < n + 1 ; i ++ ) { summ += center_heptagonal_num ( i ) ; } return summ ; } public static void main ( String args [ ] ) { int n = 5 ; System . out . print ( sum_center_heptagonal_num ( n ) ) ; } }

Accumulator variables: i, summ
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int Centered_Dodecagonal_num ( int n ) { return 6 * n * ( n - 1 ) + 1 ; } static int sum_Centered_Dodecagonal_num ( int n ) { int summ = 0 ; for ( int i = 1 ; i < n + 1 ; i ++ ) { summ += Centered_Dodecagonal_num ( i ) ; } return summ ; } public static void main ( String [ ] args ) { int n = 5 ; System . out . print ( sum_Centered_Dodecagonal_num ( n ) ) ; } }

Accumulator variables: i, summ
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int center_Octagonal_num ( int n ) { return ( 4 * n * n - 4 * n + 1 ) ; } static int sum_center_Octagonal_num ( int n ) { int summ = 0 ; for ( int i = 1 ; i < n + 1 ; i ++ ) { summ += center_Octagonal_num ( i ) ; } return summ ; } public static void main ( String [ ] args ) { int n = 5 ; System . out . println ( sum_center_Octagonal_num ( n ) ) ; } }

Accumulator variables: i, summ
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int Centered_decagonal_num ( int n ) { return ( 5 * n * n - 5 * n + 1 ) ; } static int sum_Centered_decagonal_num ( int n ) { int summ = 0 ; for ( int i = 1 ; i < n + 1 ; i ++ ) { summ += Centered_decagonal_num ( i ) ; } return summ ; } public static void main ( String [ ] args ) { int n = 5 ; System . out . println ( sum_Centered_decagonal_num ( n ) ) ; } }

Accumulator variables: i, summ
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int center_octadecagon_num ( int n ) { return ( 9 * n * n - 9 * n + 1 ) ; } static int sum_center_octadecagon_num ( int n ) { int summ = 0 ; for ( int i = 1 ; i < n + 1 ; i ++ ) { summ += center_octadecagon_num ( i ) ; } return summ ; } public static void main ( String [ ] args ) { int n = 3 ; System . out . println ( sum_center_octadecagon_num ( n ) ) ; } }

Accumulator variables: i, summ
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int Centered_Pentadecagonal_num ( int n ) { return ( 15 * n * n - 15 * n + 2 ) / 2 ; } static int sum_Centered_Pentadecagonal_num ( int n ) { int summ = 0 ; for ( int i = 1 ; i < n + 1 ; i ++ ) { summ += Centered_Pentadecagonal_num ( i ) ; } return summ ; } public static void main ( String [ ] args ) { int n = 5 ; System . out . println ( sum_Centered_Pentadecagonal_num ( n ) ) ; } }

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

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

Class/struct names: GFG
Java program:
import java . lang . Math ; class GFG { public static boolean istetradecagonal ( int N ) { double n = ( 10 + Math . sqrt ( 96 * N + 100 ) ) / 24 ; return ( n - ( int ) n ) == 0 ; } public static void main ( String [ ] args ) { int N = 11 ; if ( istetradecagonal ( N ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }

Class/struct names: GFG
Java program:
class GFG { public static int Icosagonal_num ( int n ) { return ( 18 * n * n - 16 * n ) / 2 ; } public static int sum_Icosagonal_num ( int n ) { int summ = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { summ += Icosagonal_num ( i ) ; } return summ ; } public static void main ( String [ ] args ) { int n = 5 ; System . out . println ( sum_Icosagonal_num ( n ) ) ; } }

Accumulator variables: i, summ
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int Centered_Pentagonal_num ( int n ) { return ( 5 * n * n - 5 * n + 2 ) / 2 ; } static int sum_Centered_Pentagonal_num ( int n ) { int summ = 0 ; for ( int i = 1 ; i < n + 1 ; i ++ ) { summ += Centered_Pentagonal_num ( i ) ; } return summ ; } public static void main ( String [ ] args ) { int n = 5 ; System . out . print ( ( sum_Centered_Pentagonal_num ( n ) ) ) ; } }

Accumulator variables: i, summ
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { public static int Centered_tridecagonal_num ( int n ) { return ( 13 * n * ( n - 1 ) + 2 ) / 2 ; } public static int sum_Centered_tridecagonal_num ( int n ) { int summ = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { summ += Centered_tridecagonal_num ( i ) ; } return summ ; } public static void main ( String [ ] args ) { int n = 5 ; System . out . println ( sum_Centered_tridecagonal_num ( n ) ) ; } }

Accumulator variables: i, summ
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static boolean isConcentrichexagonal ( int N ) { float n = ( float ) Math . sqrt ( ( 2 * N ) / 3 ) ; return ( n - ( int ) n ) == 0 ; } public static void main ( String [ ] args ) { int N = 6 ; if ( isConcentrichexagonal ( N ) ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean [ ] Prime ; static void computePrime ( int N ) { Prime = new boolean [ N + 1 ] ; Arrays . fill ( Prime , true ) ; Prime [ 0 ] = Prime [ 1 ] = false ; for ( int i = 2 ; i * i <= N ; i ++ ) { if ( Prime [ i ] ) { for ( int j = i * i ; j < N ; j += i ) { Prime [ j ] = false ; } } } } static int countSexyPairs ( int arr [ ] , int n ) { int maxE = Arrays . stream ( arr ) . max ( ) . getAsInt ( ) ; computePrime ( maxE ) ; int count = 0 ; int freq [ ] = new int [ maxE + 1 ] ; for ( int i = 0 ; i < n ; i ++ ) { freq [ arr [ i ] ] ++ ; } Arrays . sort ( arr ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( Prime [ arr [ i ] ] ) { if ( arr [ i ] + 6 < freq . length && freq [ arr [ i ] + 6 ] > 0 && Prime [ arr [ i ] + 6 ] ) { count ++ ; } } } return count ; } public static void main ( String [ ] args ) { int arr [ ] = { 6 , 7 , 5 , 11 , 13 } ; int n = arr . length ; System . out . print ( countSexyPairs ( arr , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static void countWays ( int n ) { if ( n <= 2 ) { System . out . print ( " - 1" ) ; } else { int ans = ( n - 1 ) * ( n - 2 ) / 2 ; System . out . print ( ans ) ; } } public static void main ( String [ ] args ) { int N = 5 ; countWays ( N ) ; } }

Class/struct names: GFG
Java program:
import java . lang . Math ; class GFG { public static boolean isPowerOfTwo ( int n ) { return ( Math . ceil ( Math . log ( n ) / Math . log ( 2 ) ) == Math . floor ( Math . log ( n ) / Math . log ( 2 ) ) ) ; } public static void main ( String [ ] args ) { int N = 8 ; if ( isPowerOfTwo ( N ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }

Class/struct names: GFG
Java program:
class GFG { static int count_pairs ( int x ) { int ans = 1 ; while ( x > 0 ) { if ( x % 2 == 1 ) ans = ans * 3 ; x = x / 2 ; } return ans ; } public static void main ( String [ ] args ) { int X = 6 ; System . out . print ( count_pairs ( X ) + "NEW_LINE"); } }

Class/struct names: GFG
Java program:
class GFG { public static void kthNonDivisible ( int N , int K ) { int L = 1 ; int H = Integer . MAX_VALUE ; int ans = 0 ; while ( L <= H ) { int mid = ( L + H ) / 2 ; int sol = mid - mid / N ; if ( sol > K ) { H = mid - 1 ; } else if ( sol < K ) { L = mid + 1 ; } else { ans = mid ; H = mid - 1 ; } } System . out . print ( ans ) ; } public static void main ( String [ ] args ) { int N = 3 ; int K = 7 ; kthNonDivisible ( N , K ) ; } }

Class/struct names: GFG
Java program:
class GFG { static void printPair ( int n ) { System . out . print ( 1 + " ▁ " + ( n - 1 ) ) ; } public static void main ( String [ ] args ) { int n = 14 ; printPair ( n ) ; } }

Class/struct names: GFG
Java program:
class GFG { static boolean isAutoBiographyNum ( int number ) { int count = 0 , position , size , digit ; String NUM ; NUM = Integer . toString ( number ) ; size = NUM . length ( ) ; for ( int i = 0 ; i < size ; i ++ ) { position = NUM . charAt ( i ) - '0' ; count = 0 ; for ( int j = 0 ; j < size ; j ++ ) { digit = NUM . charAt ( j ) - '0' ; if ( digit == i ) count ++ ; } if ( position != count ) return false ; } return true ; } static int checkArray ( int arr [ ] , int n ) { int current_length = 0 ; int max_length = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( isAutoBiographyNum ( arr [ i ] ) == true ) { current_length ++ ; } else { current_length = 0 ; } max_length = Math . max ( max_length , current_length ) ; } return max_length ; } public static void main ( String [ ] args ) { int arr [ ] = { 21200 , 1 , 1303 , 1210 , 2020 } ; int n = arr . length ; System . out . println ( checkArray ( arr , n ) ) ; } }

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