dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
class GFG { static int minNum ( int arr [ ] , int n ) { int odd = 0 ; for ( int i = 0 ; i < n ; i ++ ) if ( arr [ i ] % 2 != 0 ) odd += 1 ; return ( ( odd % 2 ) != 0 ) ? 1 : 2 ; } public static void main ( String args [ ] ) { int arr [ ] = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 } ; int n = arr . length ; System . out . println ( minNum ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, odd
Iterator variables: i
Class/struct names: GFG
Java program:
public class GFG { static int printMaxNum ( int num ) { int count [ ] = new int [ 10 ] ; String str = Integer . toString ( num ) ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) count [ str . charAt ( i ) - '0' ] ++ ; int result = 0 , multiplier = 1 ; for ( int i = 0 ; i <= 9 ; i ++ ) { while ( count [ i ] > 0 ) { result = result + ( i * multiplier ) ; count [ i ] -- ; multiplier = multiplier * 10 ; } } return result ; } public static void main ( String [ ] args ) { int num = 38293367 ; System . out . println ( printMaxNum ( num ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
public class GFG { static String largestNumber ( String num ) { int n = num . length ( ) ; int right ; int rightMax [ ] = new int [ n ] ; rightMax [ n - 1 ] = - 1 ; right = n - 1 ; for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( num . charAt ( i ) < num . charAt ( right ) ) rightMax [ i ] = right ; else { rightMax [ i ] = - 1 ; right = i ; } } for ( int i = 0 ; i < n ; i ++ ) { if ( rightMax [ i ] != - 1 ) { num = swap ( num , i , rightMax [ i ] ) ; break ; } } return num ; } static String swap ( String num , int i , int j ) { StringBuilder sb = new StringBuilder ( num ) ; sb . setCharAt ( i , num . charAt ( j ) ) ; sb . setCharAt ( j , num . charAt ( i ) ) ; return sb . toString ( ) ; } public static void main ( String [ ] args ) { String num = "8725634" ; System . out . println ( " Largest ▁ Number ▁ : ▁ " + largestNumber ( num ) ) ; } }

Index/key variables: i, n
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int nCr ( int n , int r ) { if ( r > n / 2 ) r = n - r ; int answer = 1 ; for ( int i = 1 ; i <= r ; i ++ ) { answer *= ( n - r + i ) ; answer /= i ; } return answer ; } static float binomialProbability ( int n , int k , float p ) { return nCr ( n , k ) * ( float ) Math . pow ( p , k ) * ( float ) Math . pow ( 1 - p , n - k ) ; } public static void main ( String [ ] args ) { int n = 10 ; int k = 5 ; float p = ( float ) 1.0 / 3 ; float probability = binomialProbability ( n , k , p ) ; System . out . print ( " Probability ▁ of ▁ " + k ) ; System . out . print ( " ▁ heads ▁ when ▁ a ▁ coin ▁ is ▁ tossed ▁ " + n ) ; System . out . println ( " ▁ times ▁ where ▁ probability ▁ of ▁ each ▁ head ▁ is ▁ " + p ) ; System . out . println ( " ▁ is ▁ = ▁ " + probability ) ; } }

Accumulator variables: answer, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { public static int findMaxGCD ( int arr [ ] , int n ) { int high = 0 ; for ( int i = 0 ; i < n ; i ++ ) high = Math . max ( high , arr [ i ] ) ; int divisors [ ] = new int [ high + 1 ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 1 ; j <= Math . sqrt ( arr [ i ] ) ; j ++ ) { if ( arr [ i ] % j == 0 ) { divisors [ j ] ++ ; if ( j != arr [ i ] / j ) divisors [ arr [ i ] / j ] ++ ; } } } for ( int i = high ; i >= 1 ; i -- ) if ( divisors [ i ] > 1 ) return i ; return 1 ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 , 4 , 8 , 8 , 12 } ; int n = arr . length ; System . out . println ( findMaxGCD ( arr , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { public static int findMaxGCD ( int arr [ ] , int n ) { int high = 0 ; for ( int i = 0 ; i < n ; i ++ ) high = Math . max ( high , arr [ i ] ) ; int count [ ] = new int [ high + 1 ] ; for ( int i = 0 ; i < n ; i ++ ) count [ arr [ i ] ] ++ ; int counter = 0 ; for ( int i = high ; i >= 1 ; i -- ) { int j = i ; while ( j <= high ) { if ( count [ j ] > 0 ) counter += count [ j ] ; j += i ; if ( counter == 2 ) return i ; } counter = 0 ; } return 1 ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 , 4 , 8 , 8 , 12 } ; int n = arr . length ; System . out . println ( findMaxGCD ( arr , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: counter, i, j
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int count_one ( int n ) { int c_one = 0 ; while ( n != 0 ) { int rem = n % 10 ; if ( rem == 1 ) c_one = c_one + 1 ; n = n / 10 ; } return c_one ; } static int checkEvil ( int n ) { int i = 0 , bin = 0 , n_one = 0 ; while ( n != 0 ) { int r = n % 2 ; bin = bin + r * ( int ) ( Math . pow ( 10 , i ) ) ; n = n / 2 ; } n_one = count_one ( bin ) ; if ( n_one % 2 == 0 ) return 1 ; else return 0 ; } public static void main ( String [ ] args ) { int i , check , num ; num = 32 ; check = checkEvil ( num ) ; if ( check == 1 ) System . out . println ( num + " ▁ is ▁ Evil ▁ Number " ) ; else System . out . println ( num + " ▁ is ▁ Odious ▁ Number " ) ; } }

Class/struct names: GFG
Java program:
class GFG { static int CountPairs ( int n ) { int k = n ; int imin = 1 ; int ans = 0 ; while ( imin <= n ) { int imax = n / k ; ans += k * ( imax - imin + 1 ) ; imin = imax + 1 ; k = n / imin ; } return ans ; } public static void main ( String [ ] args ) { System . out . println ( CountPairs ( 1 ) ) ; System . out . println ( CountPairs ( 2 ) ) ; System . out . println ( CountPairs ( 3 ) ) ; } }

Accumulator variables: ans
Class/struct names: GFG
Java program:
class GFG { static long powermod ( long x , long y , long p ) { while ( y > 0 ) { if ( ( y & 1L ) > 0 ) res = ( res * x ) % p ; x = ( x * x ) % p ; } return res ; } static long modInverse ( long a , long m ) { long m0 = m , t , q ; long x0 = 0 , x1 = 1 ; if ( m == 1 ) return 0 ; while ( a > 1 ) { q = a / m ; t = m ; m = a % m ; a = t ; t = x0 ; x0 = x1 - q * x0 ; x1 = t ; } if ( x1 < 0 ) x1 += m0 ; return x1 ; } static long evaluteExpression ( long n ) { long firstsum = 0 , mod = 10 ; for ( long i = 2 , j = 0 ; ( 1L << j ) <= n ; i *= i , ++ j ) firstsum = ( firstsum + i ) % mod ; long secondsum = ( powermod ( 4L , n + 1 , mod ) - 1 ) * modInverse ( 3L , mod ) ; return ( firstsum * secondsum ) % mod ; } public static void main ( String [ ] args ) { long n = 3 ; System . out . println ( evaluteExpression ( n ) ) ; n = 10 ; System . out . println ( evaluteExpression ( n ) ) ; } }

Accumulator variables: i, x1
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static final int MAX = 100001 ; static class pair { int F , S ; public pair ( int f , int s ) { F = f ; S = s ; } } static Vector < pair > [ ] factors = new Vector [ MAX ] ; static void sieveOfEratothenese ( ) { boolean [ ] isPrime = new boolean [ MAX ] ; Arrays . fill ( isPrime , true ) ; isPrime [ 0 ] = isPrime [ 1 ] = false ; for ( int i = 2 ; i < MAX ; i ++ ) { if ( isPrime [ i ] ) { for ( int j = i ; j < MAX ; j += i ) { int k , l ; isPrime [ j ] = false ; for ( k = j , l = 0 ; k % i == 0 ; l ++ , k /= i ) ; factors [ j ] . add ( new pair ( i , l ) ) ; } } } } static int sumOfProperDivisors ( int num ) { int mul = 1 ; for ( int i = 0 ; i < factors [ num ] . size ( ) ; i ++ ) mul *= ( ( Math . pow ( factors [ num ] . get ( i ) . F , factors [ num ] . get ( i ) . S + 1 ) - 1 ) / ( factors [ num ] . get ( i ) . F - 1 ) ) ; return mul - num ; } public static void main ( String [ ] args ) { for ( int i = 0 ; i < MAX ; i ++ ) factors [ i ] = new Vector < pair > ( ) ; sieveOfEratothenese ( ) ; int arr [ ] = { 8 , 13 , 24 , 36 , 59 , 75 , 91 } ; for ( int i = 0 ; i < arr . length ; i ++ ) System . out . print ( sumOfProperDivisors ( arr [ i ] ) + " ▁ " ) ; System . out . println ( ) ; } }

Index/key variables: MAX, i, j, num
Accumulator variables: i, j, k, l, mul
Iterator variables: i, j, k
Class/struct names: GFG, pair
Java program:
public class GFG { static int PowerOFPINnfactorial ( int n , int p ) { int ans = 0 ; int temp = p ; while ( temp <= n ) { ans += n / temp ; temp = temp * p ; } return ans ; } public static void main ( String [ ] args ) { System . out . println ( PowerOFPINnfactorial ( 4 , 2 ) ) ; } }

Accumulator variables: ans
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int decimalToBinary ( int N ) { int B_Number = 0 ; int cnt = 0 ; while ( N != 0 ) { int rem = N % 2 ; double c = Math . pow ( 10 , cnt ) ; B_Number += rem * c ; N /= 2 ; cnt ++ ; } return B_Number ; } public static void main ( String [ ] args ) { int N = 17 ; System . out . println ( decimalToBinary ( N ) ) ; } }

Accumulator variables: B_Number, N, cnt
Class/struct names: GFG
Java program:
class GFG { static int binaryToDecimal ( int n ) { int num = n ; int dec_value = 0 ; int base = 1 ; int temp = num ; while ( temp > 0 ) { int last_digit = temp % 10 ; temp = temp / 10 ; dec_value += last_digit * base ; base = base * 2 ; } return dec_value ; } public static void main ( String [ ] args ) { int num = 10101001 ; System . out . println ( binaryToDecimal ( num ) ) ; } }

Accumulator variables: dec_value
Class/struct names: GFG
Java program:
class GFG { public static int stirlingFactorial ( double n ) { if ( n == 1 ) return 1 ; double z ; z = Math . sqrt ( 2 * 3.14 * n ) * Math . pow ( ( n / e ) , n ) ; return ( int ) ( z ) ; } public static void main ( String [ ] args ) { System . out . println ( stirlingFactorial ( 1 ) ) ; System . out . println ( stirlingFactorial ( 2 ) ) ; System . out . println ( stirlingFactorial ( 3 ) ) ; System . out . println ( stirlingFactorial ( 4 ) ) ; System . out . println ( stirlingFactorial ( 5 ) ) ; System . out . println ( stirlingFactorial ( 6 ) ) ; System . out . println ( stirlingFactorial ( 7 ) ) ; } }

Class/struct names: GFG
Java program:
public class CountXor { static int countXorPair ( int arr [ ] , int n ) { int odd = 0 , even = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] % 2 == 0 ) even ++ ; else odd ++ ; } return odd * even ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 , 3 } ; System . out . println ( countXorPair ( arr , arr . length ) ) ; } }

Index/key variables: i
Accumulator variables: even, i, odd
Iterator variables: i
Class/struct names: CountXor
Java program:
import java . io . * ; public class LychrelNumberTest { private static int MAX_ITERATIONS = 20 ; private static boolean isLychrel ( long number ) { for ( int i = 0 ; i < MAX_ITERATIONS ; i ++ ) { number = number + reverse ( number ) ; if ( isPalindrome ( number ) ) return false ; } return true ; } private static boolean isPalindrome ( final long number ) { return number == reverse ( number ) ; } private static long reverse ( long number ) { long reverse = 0 ; while ( number > 0 ) { long remainder = number % 10 ; reverse = ( reverse * 10 ) + remainder ; number = number / 10 ; } return reverse ; } public static void main ( String [ ] args ) { long number = 295 ; System . out . println ( number + " ▁ is ▁ lychrel ? ▁ " + isLychrel ( number ) ) ; } }

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

Class/struct names: GFG
Java program:
import java . io . * ; import static java . lang . Math . * ; class Muller { static final int MAX_ITERATIONS = 10000 ; static double f ( double x ) { return 1 * pow ( x , 3 ) + 2 * x * x + 10 * x - 20 ; } static void Muller ( double a , double b , double c ) { int i ; double res ; for ( i = 0 ; ; ++ i ) { double f1 = f ( a ) ; double f2 = f ( b ) ; double f3 = f ( c ) ; double d1 = f1 - f3 ; double d2 = f2 - f3 ; double h1 = a - c ; double h2 = b - c ; double a0 = f3 ; double a1 = ( ( ( d2 * pow ( h1 , 2 ) ) - ( d1 * pow ( h2 , 2 ) ) ) / ( ( h1 * h2 ) * ( h1 - h2 ) ) ) ; double a2 = ( ( ( d1 * h2 ) - ( d2 * h1 ) ) / ( ( h1 * h2 ) * ( h1 - h2 ) ) ) ; double x = ( ( - 2 * a0 ) / ( a1 + abs ( sqrt ( a1 * a1 - 4 * a0 * a2 ) ) ) ) ; double y = ( ( - 2 * a0 ) / ( a1 - abs ( sqrt ( a1 * a1 - 4 * a0 * a2 ) ) ) ) ; if ( x >= y ) res = x + c ; else res = y + c ; double m = res * 100 ; double n = c * 100 ; m = floor ( m ) ; n = floor ( n ) ; if ( m == n ) break ; a = b ; b = c ; c = res ; if ( i > MAX_ITERATIONS ) { System . out . println ( " Root ▁ cannot ▁ be ▁ found ▁ using " + " ▁ Muller ' s ▁ method " ) ; break ; } } if ( i <= MAX_ITERATIONS ) System . out . println ( " The ▁ value ▁ of ▁ the ▁ root ▁ is ▁ " + res ) ; } public static void main ( String args [ ] ) { double a = 0 , b = 1 , c = 2 ; Muller ( a , b , c ) ; } }

Iterator variables: i
Class/struct names: Muller
Java program:
import java . util . * ; class GFG { static int MAX = 100001 ; static ArrayList < Integer > p = new ArrayList < Integer > ( ) ; static void sieve ( ) { int [ ] isPrime = new int [ MAX + 1 ] ; for ( int i = 2 ; i <= MAX ; i ++ ) { if ( isPrime [ i ] == 0 ) { p . add ( i ) ; for ( int j = 2 ; i * j <= MAX ; j ++ ) isPrime [ i * j ] = 1 ; } } } static int phi ( int n ) { int res = n ; for ( int i = 0 ; p . get ( i ) * p . get ( i ) <= n ; i ++ ) { if ( n % p . get ( i ) == 0 ) { res -= ( res / p . get ( i ) ) ; while ( n % p . get ( i ) == 0 ) n /= p . get ( i ) ; } } if ( n > 1 ) res -= ( res / n ) ; return res ; } public static void main ( String [ ] args ) { sieve ( ) ; System . out . println ( phi ( 11 ) ) ; System . out . println ( phi ( 21 ) ) ; System . out . println ( phi ( 31 ) ) ; System . out . println ( phi ( 41 ) ) ; System . out . println ( phi ( 51 ) ) ; System . out . println ( phi ( 61 ) ) ; System . out . println ( phi ( 91 ) ) ; System . out . println ( phi ( 101 ) ) ; } }

Index/key variables: i
Accumulator variables: i, j, n, res
Iterator variables: i, j
Class/struct names: GFG
Java program:
import static java . lang . Math . pow ; class Test { static void nthprimedigitsnumber ( long n ) { long len = 1 ; long prev_count = 0 ; while ( true ) { long curr_count = ( long ) ( prev_count + pow ( 4 , len ) ) ; if ( prev_count < n && curr_count >= n ) break ; len ++ ; prev_count = curr_count ; } for ( int i = 1 ; i <= len ; i ++ ) { for ( long j = 1 ; j <= 4 ; j ++ ) { if ( prev_count + pow ( 4 , len - i ) < n ) prev_count += pow ( 4 , len - i ) ; else { if ( j == 1 ) System . out . print ( "2" ) ; else if ( j == 2 ) System . out . print ( "3" ) ; else if ( j == 3 ) System . out . print ( "5" ) ; else if ( j == 4 ) System . out . print ( "7" ) ; break ; } } } System . out . println ( ) ; } public static void main ( String args [ ] ) { nthprimedigitsnumber ( 10 ) ; nthprimedigitsnumber ( 21 ) ; } }

Accumulator variables: i, j, len, prev_count
Iterator variables: i, j
Class/struct names: Test
Java program:
class Gfg { static int cassini ( int n ) { return ( n & 1 ) != 0 ? - 1 : 1 ; } public static void main ( String args [ ] ) { int n = 5 ; System . out . println ( cassini ( n ) ) ; } }

Class/struct names: Gfg
Java program:
class GFG { static boolean findNoIsDivisibleOrNot ( int a [ ] , int n ) { for ( int i = 0 ; i < a . length ; i ++ ) { if ( a [ i ] % n != 0 ) return false ; } return true ; } public static void main ( String [ ] args ) { int a [ ] = { 14 , 12 , 4 , 18 } ; int n = 2 ; if ( findNoIsDivisibleOrNot ( a , n ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class Test { static int factorial ( int n ) { if ( n == 0 ) return 1 ; return n * factorial ( n - 1 ) ; } static void printRange ( int n ) { int a = factorial ( n + 2 ) + 2 ; int b = a + n - 1 ; System . out . println ( " [ " + a + " , ▁ " + b + " ] " ) ; } public static void main ( String args [ ] ) throws Exception { int n = 3 ; printRange ( n ) ; } }

Class/struct names: Test
Java program:
import java . util . Arrays ; class GFG1 { static long findMinValue ( long arr [ ] , int n ) { Arrays . sort ( arr ) ; for ( int i = 0 ; i < n ; i ++ ) { val += ( double ) ( Math . log ( ( double ) ( arr [ i ] ) ) ) ; } long left = arr [ 0 ] , right = arr [ n - 1 ] ; long ans = 0 ; while ( left <= right ) { long mid = ( left + right ) / 2 ; double temp = ( double ) n * ( double ) ( Math . log ( ( double ) ( mid ) ) ) ; if ( val < temp ) { ans = mid ; right = mid - 1 ; } else { left = mid + 1 ; } } return ans ; } public static void main ( String [ ] args ) { long arr [ ] = { 4 , 2 , 1 , 10 , 6 } ; int n = arr . length ; System . out . println ( findMinValue ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, val
Iterator variables: i
Class/struct names: GFG1
Java program:
import static java . lang . Math . pow ; class Test { static int sumOfTermsInNthRow ( int n ) { int sum = ( int ) ( n * ( 2 * pow ( n , 2 ) + 1 ) ) ; return sum ; } public static void main ( String args [ ] ) { int n = 4 ; System . out . println ( " Sum ▁ of ▁ all ▁ the ▁ terms ▁ in ▁ nth ▁ row ▁ = ▁ " + sumOfTermsInNthRow ( n ) ) ; } }

Class/struct names: Test
Java program:
class Test { static int firstDigit ( int x ) { while ( x >= 10 ) x = x / 10 ; return x ; } public static void main ( String args [ ] ) { System . out . println ( firstDigit ( 12345 ) ) ; System . out . println ( firstDigit ( 5432 ) ) ; } }

Class/struct names: Test
Java program:
import java . * ; public class GFG { static int getOccurence ( int n , int d ) { int result = 0 ; int itr = d ; while ( itr <= n ) { if ( itr % 10 == d ) result ++ ; if ( itr != 0 && itr / 10 == d ) { result ++ ; itr ++ ; } else if ( itr / 10 == d - 1 ) itr = itr + ( 10 - d ) ; else itr = itr + 10 ; } return result ; } public static void main ( String [ ] args ) { int n = 11 , d = 1 ; System . out . println ( getOccurence ( n , d ) ) ; } }

Accumulator variables: itr, result
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void printUnique ( int l , int r ) { for ( int i = l ; i <= r ; i ++ ) { String s = String . valueOf ( i ) ; HashSet < Integer > uniDigits = new HashSet < Integer > ( ) ; for ( int c : s . toCharArray ( ) ) uniDigits . add ( c ) ; if ( s . length ( ) == uniDigits . size ( ) ) { System . out . print ( i + " ▁ " ) ; } } } public static void main ( String [ ] args ) { int l = 1 , r = 20 ; printUnique ( l , r ) ; } }

Accumulator variables: i
Iterator variables: c, i
Class/struct names: GFG
Java program:
import static java . lang . Math . cos ; class GFG { static void cal_cos ( float n ) { float accuracy = ( float ) 0.0001 , x1 , denominator , cosx , cosval ; n = n * ( float ) ( 3.142 / 180.0 ) ; x1 = 1 ; cosx = x1 ; cosval = ( float ) cos ( n ) ; int i = 1 ; do { denominator = 2 * i * ( 2 * i - 1 ) ; x1 = - x1 * n * n / denominator ; cosx = cosx + x1 ; i = i + 1 ; } while ( accuracy <= cosval - cosx ) ; System . out . println ( cosx ) ; } public static void main ( String [ ] args ) { float n = 30 ; cal_cos ( n ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static ArrayList < Integer > v = new ArrayList < Integer > ( ) ; static void multiply ( int x ) { int carry = 0 ; int size = v . size ( ) ; for ( int i = 0 ; i < size ; i ++ ) { int res = carry + v . get ( i ) * x ; v . set ( i , res % 10 ) ; carry = res / 10 ; } while ( carry != 0 ) { v . add ( carry % 10 ) ; carry /= 10 ; } } static int findSumOfDigits ( int n ) { for ( int i = 1 ; i <= n ; i ++ ) multiply ( i ) ; int sum = 0 ; int size = v . size ( ) ; for ( int i = 0 ; i < size ; i ++ ) sum += v . get ( i ) ; return sum ; } public static void main ( String [ ] args ) { int n = 1000 ; System . out . println ( findSumOfDigits ( n ) ) ; } }

Accumulator variables: carry, i, sum
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void printOtherSides ( int n ) { if ( n % 2 != 0 ) { if ( n == 1 ) System . out . println ( " - 1" ) ; else { int b = ( n * n - 1 ) / 2 ; int c = ( n * n + 1 ) / 2 ; System . out . println ( " b ▁ = ▁ " + b + " , ▁ c ▁ = ▁ " + c ) ; } } else { if ( n == 2 ) System . out . println ( " - 1" ) ; else { int b = n * n / 4 - 1 ; int c = n * n / 4 + 1 ; System . out . println ( " b ▁ = ▁ " + b + " , ▁ c ▁ = ▁ " + c ) ; } } } public static void main ( String [ ] args ) { int a = 3 ; printOtherSides ( a ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int makeOdd ( int n ) { if ( n % 2 != 0 ) return 1 ; int i ; for ( i = 2 ; i <= n ; i ++ ) if ( ( n % i == 0 ) && ( ( n / i ) % 2 == 1 ) ) break ; return i ; } public static void main ( String [ ] args ) { int n = 36 ; int res = makeOdd ( n ) ; System . out . println ( res ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int getTotalXorOfSubarrayXors ( int arr [ ] , int N ) { if ( N % 2 == 0 ) return 0 ; int res = 0 ; for ( int i = 0 ; i < N ; i += 2 ) res ^= arr [ i ] ; return res ; } public static void main ( String [ ] args ) { int arr [ ] = { 3 , 5 , 2 , 4 , 6 } ; int N = arr . length ; System . out . println ( getTotalXorOfSubarrayXors ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: i, res
Iterator variables: i
Class/struct names: GFG
Java program:
class Test { static int countIterations ( int arr [ ] , int n ) { boolean oneFound = false ; int res = 0 ; for ( int i = 0 ; i < n ; ) { if ( arr [ i ] == 1 ) oneFound = true ; while ( i < n && arr [ i ] == 1 ) i ++ ; int count_zero = 0 ; while ( i < n && arr [ i ] == 0 ) { count_zero ++ ; i ++ ; } if ( oneFound == false && i == n ) return - 1 ; int curr_count ; if ( i < n && oneFound == true ) { if ( ( count_zero & 1 ) == 0 ) curr_count = count_zero / 2 ; else curr_count = ( count_zero + 1 ) / 2 ; count_zero = 0 ; } else { curr_count = count_zero ; count_zero = 0 ; } res = Math . max ( res , curr_count ) ; } return res ; } public static void main ( String [ ] args ) { int arr [ ] = { 0 , 1 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 } ; System . out . println ( countIterations ( arr , arr . length ) ) ; } }

Index/key variables: i
Accumulator variables: count_zero, i
Iterator variables: i
Boolean variables: oneFound
Class/struct names: Test
Java program:
class GFG { static int MAX = 100 ; public static void main ( String [ ] args ) { long [ ] arr = new long [ MAX ] ; arr [ 0 ] = 0 ; arr [ 1 ] = 1 ; for ( int i = 2 ; i < MAX ; i ++ ) arr [ i ] = arr [ i - 1 ] + arr [ i - 2 ] ; System . out . print ( " Fibonacci ▁ numbers ▁ divisible ▁ by ▁ " + "their indexes are :NEW_LINE"); for ( int i = 1 ; i < MAX ; i ++ ) if ( arr [ i ] % i == 0 ) System . out . print ( i + " ▁ " ) ; } }

Index/key variables: MAX, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void printConsecutive ( int last , int first ) { System . out . print ( first ++ ) ; for ( int x = first ; x <= last ; x ++ ) System . out . print ( " ▁ + ▁ " + x ) ; } static void findConsecutive ( int N ) { for ( int last = 1 ; last < N ; last ++ ) { for ( int first = 0 ; first < last ; first ++ ) { if ( 2 * N == ( last - first ) * ( last + first + 1 ) ) { System . out . print ( N + " ▁ = ▁ " ) ; printConsecutive ( last , first + 1 ) ; return ; } } } System . out . print ( " - 1" ) ; } public static void main ( String [ ] args ) { int n = 12 ; findConsecutive ( n ) ; } }

Accumulator variables: first, last, x
Iterator variables: first, last, x
Class/struct names: GFG
Java program:
class FindNth { static int printNthElement ( int n ) { int arr [ ] = new int [ n + 1 ] ; arr [ 1 ] = 4 ; arr [ 2 ] = 7 ; for ( int i = 3 ; i <= n ; i ++ ) { if ( i % 2 != 0 ) arr [ i ] = arr [ i / 2 ] * 10 + 4 ; else arr [ i ] = arr [ ( i / 2 ) - 1 ] * 10 + 7 ; } return arr [ n ] ; } public static void main ( String [ ] args ) { int n = 6 ; System . out . println ( printNthElement ( n ) ) ; } }

Index/key variables: i, n
Accumulator variables: i
Iterator variables: i
Class/struct names: FindNth