dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
import java . io . * ; class GFG { static void Nonagonal ( int n ) { for ( int i = 1 ; i <= n ; i ++ ) { System . out . print ( i * ( 7 * i - 5 ) / 2 ) ; System . out . print ( " ▁ " ) ; } } public static void main ( String args [ ] ) { int n = 10 ; Nonagonal ( n ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int seriesFunc ( int n ) { int sumSquare = ( n * ( n + 1 ) * ( 2 * n + 1 ) ) / 6 ; int sumNatural = ( n * ( n + 1 ) / 2 ) ; return ( sumSquare + sumNatural + 1 ) ; } public static void main ( String args [ ] ) { int n = 8 ; System . out . println ( seriesFunc ( n ) ) ; n = 13 ; System . out . println ( seriesFunc ( 13 ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static boolean checkplusperfect ( int x ) { int temp = x ; int n = 0 ; while ( x != 0 ) { x /= 10 ; n ++ ; } x = temp ; int sum = 0 ; while ( x != 0 ) { sum += Math . pow ( x % 10 , n ) ; x /= 10 ; } return ( sum == temp ) ; } public static void main ( String [ ] args ) { int x = 9474 ; if ( checkplusperfect ( x ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Accumulator variables: n, sum, x
Class/struct names: GFG
Java program:
class GFG { static int subsetCount ( int arr [ ] , int n ) { return 1 << n ; } public static void main ( String [ ] args ) { int A [ ] = { 1 , 2 , 3 } ; int n = A . length ; System . out . println ( subsetCount ( A , n ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static float Calculate_GST ( float org_cost , float N_price ) { return ( ( ( N_price - org_cost ) * 100 ) / org_cost ) ; } public static void main ( String [ ] args ) { float org_cost = 100 ; float N_price = 120 ; System . out . print ( " ▁ GST ▁ = ▁ " + Calculate_GST ( org_cost , N_price ) + " % " ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int centeredHexagonalNumber ( int n ) { return 3 * n * ( n - 1 ) + 1 ; } public static void main ( String args [ ] ) { int n = 10 ; System . out . print ( n + " th ▁ centered ▁ " + " hexagonal ▁ number : ▁ " ) ; System . out . println ( centeredHexagonalNumber ( n ) ) ; } }

Class/struct names: GFG
Java program:
class demo { public static int find_distance ( int n ) { return n * ( 3 * n + 7 ) ; } public static void main ( String args [ ] ) { int n = 5 ; System . out . print ( " Distance ▁ = ▁ " ) ; System . out . println ( find_distance ( n ) ) ; } }

Class/struct names: demo
Java program:
import java . util . * ; 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 = i + 6 ) if ( n % i == 0 || n % ( i + 2 ) == 0 ) return false ; return true ; } static boolean twinPrime ( int n1 , int n2 ) { return ( isPrime ( n1 ) && isPrime ( n2 ) && Math . abs ( n1 - n2 ) == 2 ) ; } public static void main ( String [ ] args ) { int n1 = 11 , n2 = 13 ; if ( twinPrime ( n1 , n2 ) ) System . out . println ( " Twin ▁ Prime " ) ; else System . out . println ( " Not ▁ Twin ▁ Prime " ) ; } }

Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static double sumOfSeries ( int n ) { return 0.0246 * ( Math . pow ( 10 , n ) - 1 - ( 9 * n ) ) ; } public static void main ( String [ ] args ) { int n = 3 ; System . out . println ( sumOfSeries ( n ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int evenbinomialCoeffSum ( int n ) { return ( 1 << ( n - 1 ) ) ; } public static void main ( String [ ] args ) { int n = 4 ; System . out . println ( evenbinomialCoeffSum ( n ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void triangular_series ( int n ) { int i , j = 1 , k = 1 ; for ( i = 1 ; i <= n ; i ++ ) { System . out . printf ( " % d ▁ " , k ) ; j = j + 1 ; k = k + j ; } } public static void main ( String [ ] args ) { int n = 5 ; triangular_series ( n ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GfG { static int sumOfTheSeries ( int n ) { return ( n * ( n + 1 ) / 2 ) * ( 2 * n + 1 ) / 3 ; } public static void main ( String [ ] args ) { int n = 5 ; System . out . println ( " Sum ▁ = ▁ " + sumOfTheSeries ( n ) ) ; } }

Class/struct names: GfG
Java program:
import java . util . * ; class GFG { static int sumOfSeries ( int n ) { int sum = 0 ; for ( int i = 1 ; i <= n ; i ++ ) for ( int j = 1 ; j <= i ; j ++ ) sum += j ; return sum ; } public static void main ( String [ ] args ) { int n = 10 ; System . out . println ( sumOfSeries ( n ) ) ; } }

Accumulator variables: i, j, sum
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; import static java . lang . Math . pow ; class Triangle { public static double numberOfTriangles ( int n ) { double ans = 2 * ( pow ( 3 , n ) ) - 1 ; return ans ; } public static void main ( String [ ] args ) { int n = 2 ; System . out . println ( numberOfTriangles ( n ) ) ; } }

Class/struct names: Triangle
Java program:
import java . util . * ; class Digits { public static int motzkin ( int n ) { int [ ] dp = new int [ n + 1 ] ; dp [ 0 ] = dp [ 1 ] = 1 ; for ( int i = 2 ; i <= n ; i ++ ) dp [ i ] = ( ( 2 * i + 1 ) * dp [ i - 1 ] + ( 3 * i - 3 ) * dp [ i - 2 ] ) / ( i + 2 ) ; return dp [ n ] ; } public static void main ( String [ ] args ) { int n = 8 ; System . out . print ( motzkin ( n ) ) ; } }

Index/key variables: i, n
Accumulator variables: i
Iterator variables: i
Class/struct names: Digits
Java program:
import java . util . Arrays ; import java . util . Collections ; class GFG { public static int kthgroupsum ( int k ) { return k * k * k ; } public static void main ( String [ ] args ) { int k = 3 ; System . out . print ( kthgroupsum ( k ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class Sums { static void printXYZ ( int n ) { if ( n == 1 ) System . out . println ( - 1 ) ; else { System . out . println ( " x ▁ is ▁ " + n ) ; System . out . println ( " y ▁ is ▁ " + ( n + 1 ) ) ; System . out . println ( " z ▁ is ▁ " + ( n * ( n + 1 ) ) ) ; } } public static void main ( String [ ] args ) { int n = 7 ; printXYZ ( n ) ; } }

Class/struct names: Sums
Java program:
import java . io . * ; class Series { static int term ( int n ) { return n * ( n + 1 ) / 2 ; } public static void main ( String [ ] args ) { int n = 4 ; System . out . println ( term ( n ) ) ; } }

Class/struct names: Series
Java program:
import java . io . * ; class GeeksforGeeks { static double compute ( int a , int b ) { double AM , GM , HM ; AM = ( a + b ) / 2 ; GM = Math . sqrt ( a * b ) ; HM = ( GM * GM ) / AM ; return HM ; } public static void main ( String args [ ] ) { int a = 5 , b = 15 ; double HM = compute ( a , b ) ; String str = " " ; str = str + HM ; System . out . print ( " Harmonic ▁ Mean ▁ between ▁ " + a + " ▁ and ▁ " + b + " ▁ is ▁ " + str . substring ( 0 , 5 ) ) ; } }

Class/struct names: GeeksforGeeks
Java program:
import java . io . * ; class GFG { static int series ( int n ) { return ( 8 * n * n ) + 1 ; } public static void main ( String args [ ] ) { int n = 5 ; System . out . println ( series ( n ) ) ; } }

Class/struct names: GFG
Java program:
class Divisible { public static int gcd ( int a , int b ) { return b == 0 ? a : gcd ( b , a % b ) ; } static boolean isDivisible ( int x , int y ) { if ( y == 1 ) return true ; int z = gcd ( x , y ) ; if ( z == 1 ) return false ; return isDivisible ( x , y / z ) ; } public static void main ( String [ ] args ) { int x = 18 , y = 12 ; if ( isDivisible ( x , y ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Class/struct names: Divisible
Java program:
import java . io . * ; class GFG { public static void main ( String [ ] args ) { double n = 5 , a = 2 ; System . out . println ( sumOfSeries ( a , n ) ) ; } static double sumOfSeries ( double a , double n ) { double res = 0 , prev = 1 ; for ( int i = 1 ; i <= n ; i ++ ) { prev *= ( a / i ) ; res = res + prev ; } return ( res ) ; } }

Accumulator variables: i, prev
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static float Cel_To_Fah ( float n ) { return ( ( n * 9.0f / 5.0f ) + 32.0f ) ; } public static void main ( String [ ] args ) { float n = 20.0f ; System . out . println ( Cel_To_Fah ( n ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static void print_sequence ( int n , int k ) { int b = n / ( k * ( k + 1 ) / 2 ) ; if ( b == 0 ) { System . out . println ( " - 1" ) ; } else { int r = 1 ; for ( int x = 1 ; x * x <= n ; x ++ ) { if ( n % x != 0 ) continue ; if ( x <= b && x > r ) r = x ; if ( n / x <= b && n / x > r ) r = n / x ; } for ( int i = 1 ; i < k ; i ++ ) System . out . print ( r * i + " ▁ " ) ; int res = n - ( r * ( k * ( k - 1 ) / 2 ) ) ; System . out . println ( res ) ; } } public static void main ( String [ ] args ) { int n = 24 ; int k = 4 ; print_sequence ( n , k ) ; n = 24 ; k = 5 ; print_sequence ( n , k ) ; n = 6 ; k = 4 ; print_sequence ( n , k ) ; } }

Accumulator variables: i, x
Iterator variables: i, x
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { public static int countCompositions ( int n ) { return 1 << ( n - 1 ) ; } public static void main ( String args [ ] ) { int n = 4 ; System . out . print ( countCompositions ( n ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int countDigit ( long n ) { if ( n / 10 == 0 ) return 1 ; return 1 + countDigit ( n / 10 ) ; } public static void main ( String [ ] args ) { long n = 345289467 ; System . out . print ( " Number ▁ of ▁ digits ▁ : ▁ " + countDigit ( n ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static void printTrib ( int n ) { int dp [ ] = new int [ n ] ; dp [ 0 ] = dp [ 1 ] = 0 ; dp [ 2 ] = 1 ; for ( int i = 3 ; i < n ; i ++ ) dp [ i ] = dp [ i - 1 ] + dp [ i - 2 ] + dp [ i - 3 ] ; for ( int i = 0 ; i < n ; i ++ ) System . out . print ( dp [ i ] + " ▁ " ) ; } public static void main ( String args [ ] ) { int n = 10 ; printTrib ( n ) ; } }

Index/key variables: i, n
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static void multiply ( int T [ ] [ ] , int M [ ] [ ] ) { int a , b , c , d , e , f , g , h , i ; a = T [ 0 ] [ 0 ] * M [ 0 ] [ 0 ] + T [ 0 ] [ 1 ] * M [ 1 ] [ 0 ] + T [ 0 ] [ 2 ] * M [ 2 ] [ 0 ] ; b = T [ 0 ] [ 0 ] * M [ 0 ] [ 1 ] + T [ 0 ] [ 1 ] * M [ 1 ] [ 1 ] + T [ 0 ] [ 2 ] * M [ 2 ] [ 1 ] ; c = T [ 0 ] [ 0 ] * M [ 0 ] [ 2 ] + T [ 0 ] [ 1 ] * M [ 1 ] [ 2 ] + T [ 0 ] [ 2 ] * M [ 2 ] [ 2 ] ; d = T [ 1 ] [ 0 ] * M [ 0 ] [ 0 ] + T [ 1 ] [ 1 ] * M [ 1 ] [ 0 ] + T [ 1 ] [ 2 ] * M [ 2 ] [ 0 ] ; e = T [ 1 ] [ 0 ] * M [ 0 ] [ 1 ] + T [ 1 ] [ 1 ] * M [ 1 ] [ 1 ] + T [ 1 ] [ 2 ] * M [ 2 ] [ 1 ] ; f = T [ 1 ] [ 0 ] * M [ 0 ] [ 2 ] + T [ 1 ] [ 1 ] * M [ 1 ] [ 2 ] + T [ 1 ] [ 2 ] * M [ 2 ] [ 2 ] ; g = T [ 2 ] [ 0 ] * M [ 0 ] [ 0 ] + T [ 2 ] [ 1 ] * M [ 1 ] [ 0 ] + T [ 2 ] [ 2 ] * M [ 2 ] [ 0 ] ; h = T [ 2 ] [ 0 ] * M [ 0 ] [ 1 ] + T [ 2 ] [ 1 ] * M [ 1 ] [ 1 ] + T [ 2 ] [ 2 ] * M [ 2 ] [ 1 ] ; i = T [ 2 ] [ 0 ] * M [ 0 ] [ 2 ] + T [ 2 ] [ 1 ] * M [ 1 ] [ 2 ] + T [ 2 ] [ 2 ] * M [ 2 ] [ 2 ] ; T [ 0 ] [ 0 ] = a ; T [ 0 ] [ 1 ] = b ; T [ 0 ] [ 2 ] = c ; T [ 1 ] [ 0 ] = d ; T [ 1 ] [ 1 ] = e ; T [ 1 ] [ 2 ] = f ; T [ 2 ] [ 0 ] = g ; T [ 2 ] [ 1 ] = h ; T [ 2 ] [ 2 ] = i ; } static void power ( int T [ ] [ ] , int n ) { if ( n == 0 n == 1 ) return ; int M [ ] [ ] = { { 1 , 1 , 1 } , { 1 , 0 , 0 } , { 0 , 1 , 0 } } ; power ( T , n / 2 ) ; multiply ( T , T ) ; if ( n % 2 != 0 ) multiply ( T , M ) ; } static int tribonacci ( int n ) { int T [ ] [ ] = { { 1 , 1 , 1 } , { 1 , 0 , 0 } , { 0 , 1 , 0 } } ; if ( n == 0 n == 1 ) return 0 ; else power ( T , n - 2 ) ; return T [ 0 ] [ 0 ] ; } public static void main ( String args [ ] ) { int n = 10 ; for ( int i = 0 ; i < n ; i ++ ) System . out . print ( tribonacci ( i ) + " ▁ " ) ; System . out . println ( ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static float geometricMean ( int [ ] arr , int n ) { float sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum = sum + ( float ) Math . log ( arr [ i ] ) ; sum = sum / n ; return ( float ) Math . exp ( sum ) ; } public static void main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 } ; int n = arr . length ; System . out . println ( geometricMean ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . Stack ; public class GFG { static long smallestNumber ( int n ) { if ( n >= 0 && n <= 9 ) { return n ; } Stack < Integer > digits = new Stack < > ( ) ; for ( int i = 9 ; i >= 2 && n > 1 ; i -- ) { while ( n % i == 0 ) { digits . push ( i ) ; n = n / i ; } } if ( n != 1 ) { return - 1 ; } long k = 0 ; while ( ! digits . empty ( ) ) { k = k * 10 + digits . peek ( ) ; digits . pop ( ) ; } return k ; } static public void main ( String [ ] args ) { int n = 100 ; System . out . println ( smallestNumber ( n ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { public static boolean isMagic ( int n ) { int sum = 0 ; while ( n > 0 sum > 9 ) { if ( n == 0 ) { n = sum ; sum = 0 ; } sum += n % 10 ; n /= 10 ; } return ( sum == 1 ) ; } public static void main ( String args [ ] ) { int n = 1234 ; if ( isMagic ( n ) ) System . out . println ( " Magic ▁ Number " ) ; else System . out . println ( " Not ▁ a ▁ magic ▁ Number " ) ; } }

Accumulator variables: n, sum
Class/struct names: GFG
Java program:
class GFG { public static void main ( String [ ] args ) { int x = 1234 ; if ( x % 9 == 1 ) System . out . printf ( " Magic ▁ Number " ) ; else System . out . printf ( " Not ▁ a ▁ Magic ▁ Number " ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { public static void printSequence ( int n ) { int a = 1 ; int ans = 2 ; int N = 1000000007 ; for ( int i = 1 ; i <= n ; i ++ ) { System . out . print ( ans + " ▁ " ) ; ans = ( ( a % N ) * ( ans % N ) ) % N ; a = ans ; ans = ( ans + 1 ) % N ; } } public static void main ( String [ ] args ) { int n = 6 ; printSequence ( n ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int c ; static int HailstoneNumbers ( int N ) { System . out . print ( N + " ▁ " ) ; if ( N == 1 && c == 0 ) { return c ; } else if ( N == 1 && c != 0 ) { c ++ ; return c ; } else if ( N % 2 == 0 ) { c ++ ; HailstoneNumbers ( N / 2 ) ; } else if ( N % 2 != 0 ) { c ++ ; HailstoneNumbers ( 3 * N + 1 ) ; } return c ; } public static void main ( String [ ] args ) { int N = 7 ; int x ; x = HailstoneNumbers ( N ) ; System . out . println ( ) ; System . out . println ( " Number ▁ of ▁ Steps : ▁ " + x ) ; } }

Accumulator variables: c
Class/struct names: GFG
Java program:
class GFG { static int SUM ( int n , int m ) { if ( m == 1 ) return ( n * ( n + 1 ) / 2 ) ; int sum = SUM ( n , m - 1 ) ; return ( sum * ( sum + 1 ) / 2 ) ; } public static void main ( String [ ] args ) { int n = 5 ; int m = 3 ; System . out . println ( " SUM ( " + n + " , ▁ " + m + " ) : ▁ " + SUM ( n , m ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int count ( int x , int y ) { Map < Integer , Integer > m = new HashMap < > ( ) ; while ( x % y != 0 ) { x = x % y ; ans ++ ; if ( m . containsKey ( x ) ) return - 1 ; m . put ( x , 1 ) ; x = x * 10 ; } return ans ; } public static void main ( String [ ] args ) { int res = count ( 1 , 2 ) ; if ( ( res == - 1 ) ) System . out . println ( " INF " ) ; else System . out . println ( res ) ; res = count ( 5 , 3 ) ; if ( ( res == - 1 ) ) System . out . println ( " INF " ) ; else System . out . println ( res ) ; res = count ( 3 , 5 ) ; if ( ( res == - 1 ) ) System . out . println ( " INF " ) ; else System . out . println ( res ) ; } }

Accumulator variables: ans
Class/struct names: GFG
Java program:
class GFG { static int xorCalc ( int k ) { if ( k == 1 ) return 2 ; if ( ( ( k + 1 ) & k ) == 0 ) return k / 2 ; return 1 ; } public static void main ( String [ ] args ) { int k = 31 ; System . out . println ( xorCalc ( k ) ) ; } }

Class/struct names: GFG
Java program:
public class GFG { static String findNthNo ( int n ) { String res = " " ; while ( n >= 1 ) { if ( ( n & 1 ) == 1 ) { res = res + "4" ; n = ( n - 1 ) / 2 ; } else { res = res + "7" ; n = ( n - 2 ) / 2 ; } } StringBuilder sb = new StringBuilder ( res ) ; sb . reverse ( ) ; return new String ( sb ) ; } public static void main ( String args [ ] ) { int n = 13 ; System . out . print ( findNthNo ( n ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; import java . lang . * ; class GFG { static int divCount ( int n ) { boolean hash [ ] = new boolean [ n + 1 ] ; Arrays . fill ( hash , true ) ; for ( int p = 2 ; p * p < n ; p ++ ) if ( hash [ p ] == true ) for ( int i = p * 2 ; i < n ; i += p ) hash [ i ] = false ; int total = 1 ; for ( int p = 2 ; p <= n ; p ++ ) { if ( hash [ p ] ) { int count = 0 ; if ( n % p == 0 ) { while ( n % p == 0 ) { n = n / p ; count ++ ; } total = total * ( count + 1 ) ; } } } return total ; } public static void main ( String [ ] args ) { int n = 24 ; System . out . print ( divCount ( n ) ) ; } }

Index/key variables: i, p
Accumulator variables: count, i, p
Iterator variables: i, p
Class/struct names: GFG
Java program:
class GFG { static int getMax ( int [ ] Arr ) { int max = Arr [ 0 ] ; for ( int i = 1 ; i < Arr . length ; i ++ ) if ( Arr [ i ] > max ) max = Arr [ i ] ; return max ; } static int maxPrimefactorNum ( int N ) { int [ ] arr = new int [ N + 1 ] ; for ( int i = 2 ; i * i <= N ; i ++ ) { if ( arr [ i ] == 0 ) for ( int j = 2 * i ; j <= N ; j += i ) arr [ j ] ++ ; arr [ i ] = 1 ; } return getMax ( arr ) ; } public static void main ( String [ ] args ) { int N = 40 ; System . out . println ( maxPrimefactorNum ( N ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static String decToBin ( int n ) { if ( n == 0 ) return "0" ; String bin = " " ; while ( n > 0 ) { bin = ( ( n & 1 ) == 0 ? '0' : '1' ) + bin ; n >>= 1 ; } return bin ; } public static void main ( String [ ] args ) { int n = 38 ; System . out . println ( decToBin ( n ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { public static int arraySum ( int arr [ ] , int n ) { int x = ( n + 1 ) / 2 ; return ( arr [ 0 ] - 1 ) * n + x * x ; } public static void main ( String [ ] args ) { int arr [ ] = { 10 , 11 , 12 , 13 , 12 , 11 , 10 } ; int n = arr . length ; System . out . print ( arraySum ( arr , n ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean isBalancePossible ( int T , int a ) { Vector < Integer > baseForm = new Vector < > ( ) ; int s = 0 ; while ( T > 0 ) { baseForm . add ( T % a ) ; T /= a ; s ++ ; } baseForm . add ( 0 ) ; for ( int i = 0 ; i < s ; i ++ ) { if ( baseForm . get ( i ) != 0 && baseForm . get ( i ) != 1 && baseForm . get ( i ) != ( a - 1 ) && baseForm . get ( i ) != a ) { return false ; } if ( baseForm . get ( i ) == a || baseForm . get ( i ) == ( a - 1 ) ) { baseForm . add ( i + 1 , baseForm . get ( i + 1 ) + 1 ) ; } } return true ; } public static void main ( String [ ] args ) { int T = 11 ; int a = 4 ; boolean balancePossible = isBalancePossible ( T , a ) ; if ( balancePossible ) { System . out . println ( " Balance ▁ is ▁ possible " ) ; } else { System . out . println ( " Balance ▁ is ▁ not ▁ possible " ) ; } } }

Accumulator variables: T, i, s
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { public static int countDigits ( int a , int b ) { if ( a == 0 b == 0 ) return 1 ; return ( int ) Math . floor ( Math . log10 ( Math . abs ( a ) ) + Math . log10 ( Math . abs ( b ) ) ) + 1 ; } public static void main ( String [ ] args ) { int a = 33 ; int b = - 24 ; System . out . print ( countDigits ( a , b ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static int lastPosition ( int n , int m , int k ) { if ( m <= n - k + 1 ) return m + k - 1 ; m = m - ( n - k + 1 ) ; return ( m % n == 0 ) ? n : ( m % n ) ; } public static void main ( String arg [ ] ) { int n = 5 ; int m = 8 ; int k = 2 ; System . out . print ( lastPosition ( n , m , k ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static void primesInRange ( int n ) { int fact = 1 ; for ( int k = 2 ; k < n ; k ++ ) { fact = fact * ( k - 1 ) ; if ( ( fact + 1 ) % k == 0 ) System . out . println ( k ) ; } } public static void main ( String [ ] args ) { int n = 15 ; primesInRange ( n ) ; } }

Accumulator variables: k
Iterator variables: k
Class/struct names: GFG
Java program:
public class Array_puzzle_2 { static final double EPS = 1e-9 ; static void productPuzzle ( int a [ ] , int n ) { double sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum += Math . log10 ( a [ i ] ) ; for ( int i = 0 ; i < n ; i ++ ) System . out . print ( ( int ) ( EPS + Math . pow ( 10.00 , sum - Math . log10 ( a [ i ] ) ) ) + " ▁ " ) ; } public static void main ( String args [ ] ) { int a [ ] = { 10 , 3 , 5 , 6 , 2 } ; int n = a . length ; System . out . println ( " The ▁ product ▁ array ▁ is : ▁ " ) ; productPuzzle ( a , n ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: Array_puzzle_2
Java program:
import java . util . * ; class GFG { static int changeEvenBits ( int n ) { int to_subtract = 0 ; int m = 0 ; for ( int x = n ; x > 0 ; x >>= 2 ) { if ( ( x & 1 ) > 0 ) to_subtract += ( 1 << m ) ; m += 2 ; } return n - to_subtract ; } public static void main ( String [ ] args ) { int n = 30 ; System . out . println ( changeEvenBits ( n ) ) ; } }

Accumulator variables: m, to_subtract
Iterator variables: x
Class/struct names: GFG
Java program:
public class close_to_n_divisible_m { static int closestNumber ( int n , int m ) { int q = n / m ; int n1 = m * q ; int n2 = ( n * m ) > 0 ? ( m * ( q + 1 ) ) : ( m * ( q - 1 ) ) ; if ( Math . abs ( n - n1 ) < Math . abs ( n - n2 ) ) return n1 ; return n2 ; } public static void main ( String args [ ] ) { int n = 13 , m = 4 ; System . out . println ( closestNumber ( n , m ) ) ; n = - 15 ; m = 6 ; System . out . println ( closestNumber ( n , m ) ) ; n = 0 ; m = 8 ; System . out . println ( closestNumber ( n , m ) ) ; n = 18 ; m = - 7 ; System . out . println ( closestNumber ( n , m ) ) ; } }

Class/struct names: close_to_n_divisible_m
Java program:
import java . io . * ; import java . util . * ; import java . math . * ; class GFG { static boolean checkPronic ( int x ) { for ( int i = 0 ; i <= ( int ) ( Math . sqrt ( x ) ) ; i ++ ) if ( x == i * ( i + 1 ) ) return true ; return false ; } public static void main ( String [ ] args ) { for ( int i = 0 ; i <= 200 ; i ++ ) if ( checkPronic ( i ) ) System . out . print ( i + " ▁ " ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
public class Main { static int findMinSum ( int num ) { int sum = 0 ; for ( int i = 2 ; i * i <= num ; i ++ ) { while ( num % i == 0 ) { sum += i ; num /= i ; } } sum += num ; return sum ; } public static void main ( String [ ] args ) { int num = 12 ; System . out . println ( findMinSum ( num ) ) ; } }

Accumulator variables: i, num, sum
Iterator variables: i
Class/struct names: Main
Java program:
import java . io . * ; class GFG { static void findMin ( int sum ) { int a = 0 , b = 0 ; while ( sum > 0 ) { if ( sum % 7 == 0 ) { b ++ ; sum -= 7 ; } else if ( sum % 4 == 0 ) { a ++ ; sum -= 4 ; } else { a ++ ; sum -= 4 ; } } if ( sum < 0 ) { System . out . print ( " - 1n " ) ; return ; } for ( int i = 0 ; i < a ; i ++ ) System . out . print ( "4" ) ; for ( int i = 0 ; i < b ; i ++ ) System . out . print ( "7" ) ; System . out . println ( ) ; } public static void main ( String args [ ] ) throws IOException { findMin ( 15 ) ; } }

Accumulator variables: a, b, i, sum
Iterator variables: i
Class/struct names: GFG