dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
import java . util . Vector ; import static java . lang . Math . sqrt ; class GFG { static final int MAX = 10000 ; static Vector < Integer > primes = new Vector < Integer > ( MAX + 1 ) ; static void sieveSundaram ( ) { boolean marked [ ] = new boolean [ MAX / 2 + 1 ] ; for ( int i = 1 ; i <= ( sqrt ( MAX ) - 1 ) / 2 ; i ++ ) for ( int j = ( i * ( i + 1 ) ) << 1 ; j <= MAX / 2 ; j = j + 2 * i + 1 ) marked [ j ] = true ; primes . add ( 2 ) ; for ( int i = 1 ; i <= MAX / 2 ; i ++ ) if ( marked [ i ] == false ) primes . add ( 2 * i + 1 ) ; } static boolean isEquidigital ( int n ) { if ( n == 1 ) return true ; int original_no = n ; int sumDigits = 0 ; while ( original_no > 0 ) { sumDigits ++ ; original_no = original_no / 10 ; } int pDigit = 0 , count_exp = 0 , p = 0 ; for ( int i = 0 ; primes . elementAt ( i ) <= n / 2 ; i ++ ) { while ( n % primes . elementAt ( i ) == 0 ) { p = primes . elementAt ( i ) ; n = n / p ; count_exp ++ ; } while ( p > 0 ) { pDigit ++ ; p = p / 10 ; } while ( count_exp > 1 ) { pDigit ++ ; count_exp = count_exp / 10 ; } } if ( n != 1 ) { while ( n > 0 ) { pDigit ++ ; n = n / 10 ; } } return ( pDigit == sumDigits ) ; } public static void main ( String [ ] args ) { sieveSundaram ( ) ; System . out . println ( " Printing ▁ first ▁ few ▁ Equidigital ▁ Numbers " + " ▁ using ▁ isEquidigital ( ) " ) ; for ( int i = 1 ; i < 20 ; i ++ ) if ( isEquidigital ( i ) ) System . out . print ( i + " ▁ " ) ; } }

Index/key variables: i, j
Accumulator variables: count_exp, i, pDigit, sumDigits
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static int getMaximumSumWithLCMN ( int N ) { int sum = 0 ; int LIM = ( int ) Math . sqrt ( N ) ; for ( int i = 1 ; i <= LIM ; i ++ ) { if ( N % i == 0 ) { if ( i == ( N / i ) ) sum += i ; else sum += ( i + N / i ) ; } } return sum ; } public static void main ( String [ ] args ) { int N = 12 ; System . out . println ( getMaximumSumWithLCMN ( N ) ) ; } }

Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
Java program:
public class Main { static int hcf ( int a , int b ) { if ( b == 0 ) return a ; return hcf ( b , a % b ) ; } static int findlcm ( int a , int b ) { if ( b == 1 ) return a ; a = ( a * b ) / hcf ( a , b ) ; b -= 1 ; return findlcm ( a , b ) ; } public static void main ( String [ ] args ) { int n = 7 ; if ( n < 3 ) System . out . print ( n ) ; else System . out . print ( findlcm ( n , n - 1 ) ) ; } }

Accumulator variables: b
Class/struct names: Main
Java program:
class GFG { static long gcd ( long a , long b ) { if ( a % b != 0 ) return gcd ( b , a % b ) ; else return b ; } static long lcm ( long n ) { long ans = 1 ; for ( long i = 1 ; i <= n ; i ++ ) ans = ( ans * i ) / ( gcd ( ans , i ) ) ; return ans ; } public static void main ( String [ ] args ) { long n = 20 ; System . out . println ( lcm ( n ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static float y ( float x ) { return 1 / ( 1 + x * x ) ; } static float trapezoidal ( float a , float b , float n ) { float h = ( b - a ) / n ; float s = y ( a ) + y ( b ) ; for ( int i = 1 ; i < n ; i ++ ) s += 2 * y ( a + i * h ) ; return ( h / 2 ) * s ; } public static void main ( String [ ] args ) { float x0 = 0 ; float xn = 1 ; int n = 6 ; System . out . println ( " Value ▁ of ▁ integral ▁ is ▁ " + Math . round ( trapezoidal ( x0 , xn , n ) * 10000.0 ) / 10000.0 ) ; } }

Accumulator variables: i, s
Iterator variables: i
Class/struct names: GFG
Java program:
public class GFG { static int maxProd ( int n ) { if ( n == 2 n == 3 ) return ( n - 1 ) ; int res = 1 ; while ( n > 4 ) { n -= 3 ; res *= 3 ; } return ( n * res ) ; } public static void main ( String [ ] args ) { System . out . println ( " Maximum ▁ Product ▁ is ▁ " + maxProd ( 45 ) ) ; } }

Accumulator variables: n, res
Class/struct names: GFG
Java program:
class GFG { static double numberOfDigits ( double n ) { if ( n == 1 ) return 1 ; double d = ( n * Math . log10 ( 1.6180339887498948 ) ) - ( ( Math . log10 ( 5 ) ) / 2 ) ; return Math . ceil ( d ) ; } public static void main ( String [ ] args ) { double i ; for ( i = 1 ; i <= 10 ; i ++ ) System . out . println ( " Number ▁ of ▁ Digits ▁ in ▁ F ( " + i + " ) ▁ - ▁ " + numberOfDigits ( i ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; import java . lang . * ; class GFG { public static int countOddSquares ( int n , int m ) { return ( int ) Math . pow ( ( double ) m , 0.5 ) - ( int ) Math . pow ( ( double ) n - 1 , 0.5 ) ; } public static void main ( String [ ] args ) { int n = 5 , m = 100 ; System . out . print ( " Count ▁ is ▁ " + countOddSquares ( n , m ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static boolean factors ( int n , int k ) { ArrayList < Integer > v = new ArrayList < Integer > ( ) ; while ( n % 2 == 0 ) { v . add ( 2 ) ; n /= 2 ; } if ( v . size ( ) >= k ) return true ; for ( int i = 3 ; i * i <= n ; i += 2 ) { while ( n % i == 0 ) { n = n / i ; v . add ( i ) ; } if ( v . size ( ) >= k ) return true ; } if ( n > 2 ) v . add ( n ) ; if ( v . size ( ) >= k ) return true ; return false ; } static void operation ( int n , int k ) { boolean answered = false ; if ( n < k ) { answered = true ; System . out . println ( " No " ) ; } boolean ok = factors ( n , k ) ; if ( ! ok && ! answered ) { answered = true ; System . out . println ( " No " ) ; } if ( ok && ! answered ) System . out . println ( " Yes " ) ; } public static void main ( String [ ] args ) { int n = 4 ; int k = 2 ; operation ( n , k ) ; } }

Accumulator variables: i, n
Iterator variables: i
Boolean variables: answered
Class/struct names: GFG
Java program:
class GFG { static String generateOTP ( int len ) { String str = " abcdefghijklmnopqrstuvwxyzABCD " + " EFGHIJKLMNOPQRSTUVWXYZ0123456789" ; int n = str . length ( ) ; String OTP = " " ; for ( int i = 1 ; i <= len ; i ++ ) OTP += ( str . charAt ( ( int ) ( ( Math . random ( ) * 10 ) % n ) ) ) ; return ( OTP ) ; } public static void main ( String [ ] args ) { int len = 6 ; System . out . printf ( " Your ▁ OTP ▁ is ▁ - ▁ % s " , generateOTP ( len ) ) ; } }

Accumulator variables: OTP, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static void sieve ( int n , int prime [ ] ) { for ( int i = 1 ; i <= n ; i ++ ) prime [ i ] = 1 ; prime [ 1 ] = 0 ; for ( int i = 2 ; i * i <= n ; i ++ ) { if ( prime [ i ] == 1 ) { for ( int j = i * i ; j <= n ; j += i ) prime [ j ] = 0 ; } } } static int expFactor ( int n , int p ) { int x = p ; int exponent = 0 ; while ( ( n / x ) > 0 ) { exponent += n / x ; x *= p ; } return exponent ; } static long countFactors ( int n ) { long ans = 1 ; int prime [ ] = new int [ n + 1 ] ; sieve ( n , prime ) ; for ( int p = 1 ; p <= n ; p ++ ) { if ( prime [ p ] == 1 ) ans *= ( expFactor ( n , p ) + 1 ) ; } return ans ; } public static void main ( String args [ ] ) { int n = 16 ; System . out . println ( " Count ▁ of ▁ factors ▁ of ▁ " + n + " ▁ is ▁ " + countFactors ( n ) ) ; } }

Index/key variables: i, j, p
Accumulator variables: ans, exponent, i, j, p, x
Iterator variables: i, j, p
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } static int LcmOfArray ( int [ ] arr , int idx ) { if ( idx == arr . length - 1 ) { return arr [ idx ] ; } int a = arr [ idx ] ; int b = LcmOfArray ( arr , idx + 1 ) ; return ( a * b / __gcd ( a , b ) ) ; } public static void main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 8 , 3 } ; System . out . print ( LcmOfArray ( arr , 0 ) + "NEW_LINE"); int [ ] arr1 = { 2 , 7 , 3 , 9 , 4 } ; System . out . print ( LcmOfArray ( arr1 , 0 ) + "NEW_LINE"); } }

Index/key variables: idx
Class/struct names: GFG
Java program:
class CountSquares { double countSquares ( int a , int b ) { return ( Math . floor ( Math . sqrt ( b ) ) - Math . ceil ( Math . sqrt ( a ) ) + 1 ) ; } } public class PerfectSquares { public static void main ( String [ ] args ) { int a = 9 , b = 25 ; CountSquares obj = new CountSquares ( ) ; System . out . print ( " Count ▁ of ▁ squares ▁ is ▁ " + ( int ) obj . countSquares ( a , b ) ) ; } }

Class/struct names: CountSquares, PerfectSquares
Java program:
import java . io . * ; import java . math . * ; class GFG { static int findCountUpto ( int d ) { int GP1_Sum = 9 * ( ( int ) ( ( Math . pow ( 10 , d ) ) - 1 ) / 9 ) ; int GP2_Sum = 9 * ( ( int ) ( ( Math . pow ( 9 , d ) ) - 1 ) / 8 ) ; return GP1_Sum - GP2_Sum ; } public static void main ( String args [ ] ) { int d = 1 ; System . out . println ( findCountUpto ( d ) ) ; d = 2 ; System . out . println ( findCountUpto ( d ) ) ; d = 4 ; System . out . println ( findCountUpto ( d ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; import java . math . * ; class GFG { static void countDivisors ( int n ) { int count = 0 ; for ( int i = 1 ; i <= Math . sqrt ( n ) + 1 ; i ++ ) { if ( n % i == 0 ) count += ( n / i == i ) ? 1 : 2 ; } if ( count % 2 == 0 ) System . out . println ( " Even " ) ; else System . out . println ( " Odd " ) ; } public static void main ( String args [ ] ) { System . out . print ( " The ▁ count ▁ of ▁ divisor : ▁ " ) ; countDivisors ( 10 ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
Java program:
public class Main { public static int greyConverter ( int n ) { return n ^ ( n >> 1 ) ; } public static void main ( String [ ] args ) { int n = 3 ; System . out . println ( greyConverter ( n ) ) ; n = 9 ; System . out . println ( greyConverter ( n ) ) ; } }

Class/struct names: Main
Java program:
import java . util . Arrays ; public class GFG { static int largestPower ( int n , int p ) { int x = 0 ; while ( n > 0 ) { n /= p ; x += n ; } return x ; } static int power ( int x , int y , int p ) { int res = 1 ; x = x % p ; s while ( y > 0 ) { if ( y % 2 == 1 ) { res = ( res * x ) % p ; } x = ( x * x ) % p ; } return res ; } static int modFact ( int n , int p ) { if ( n >= p ) { return 0 ; } int res = 1 ; boolean isPrime [ ] = new boolean [ n + 1 ] ; Arrays . fill ( isPrime , true ) ; for ( int i = 2 ; i * i <= n ; i ++ ) { if ( isPrime [ i ] ) { for ( int j = 2 * i ; j <= n ; j += i ) { isPrime [ j ] = false ; } } } for ( int i = 2 ; i <= n ; i ++ ) { if ( isPrime [ i ] ) { int k = largestPower ( n , i ) ; res = ( res * power ( i , k , p ) ) % p ; } } return res ; } static public void main ( String [ ] args ) { int n = 25 , p = 29 ; System . out . println ( modFact ( n , p ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, n, x
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static int countSquares ( int m , int n ) { if ( n < m ) { int temp = m ; m = n ; n = temp ; } return m * ( m + 1 ) * ( 2 * m + 1 ) / 6 + ( n - m ) * m * ( m + 1 ) / 2 ; } public static void main ( String [ ] args ) { int m = 4 , n = 3 ; System . out . println ( " Count ▁ of ▁ squares ▁ is ▁ " + countSquares ( m , n ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int sumBitDiff ( int [ ] arr ) { for ( int i = 0 ; i < arr . length ; i ++ ) { for ( int j = i ; j < arr . length ; j ++ ) { int xor = arr [ i ] ^ arr [ j ] ; diff += 2 * count ; } } return diff ; } static int countSetBits ( int n ) { while ( n != 0 ) { count ++ ; } return count ; } public static void main ( String [ ] args ) { int [ ] arr = { 5 , 10 } ; int ans = sumBitDiff ( arr ) ; System . out . println ( ans ) ; } }

Index/key variables: i, j
Accumulator variables: count, diff, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
public class GFG { static int add ( int x , int y ) { while ( y > 0 && y != 0 ) { x ++ ; y -- ; } while ( y < 0 && y != 0 ) { x -- ; y ++ ; } return x ; } public static void main ( String args [ ] ) { System . out . println ( add ( 43 , 23 ) ) ; System . out . println ( add ( 43 , - 23 ) ) ; } }

Accumulator variables: x, y
Class/struct names: GFG
Java program:
class GFG { static int countFact ( int low , int high ) { int fact = 1 , x = 1 ; while ( fact < low ) { fact = fact * x ; x ++ ; } int res = 0 ; while ( fact <= high ) { res ++ ; fact = fact * x ; x ++ ; } return res ; } public static void main ( String [ ] args ) { System . out . print ( " Count ▁ is ▁ " + countFact ( 2 , 720 ) ) ; } }

Accumulator variables: res, x
Class/struct names: GFG
Java program:
class GFG { static class Date { int d , m , y ; public Date ( int d , int m , int y ) { this . d = d ; this . m = m ; this . y = y ; } } ; static int monthDays [ ] = { 31 , 28 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 } ; static int countLeapYears ( Date d ) { int years = d . y ; if ( d . m <= 2 ) { years -- ; } return years / 4 - years / 100 + years / 400 ; } static int getDifference ( Date dt1 , Date dt2 ) { int n1 = dt1 . y * 365 + dt1 . d ; for ( int i = 0 ; i < dt1 . m - 1 ; i ++ ) { n1 += monthDays [ i ] ; } n1 += countLeapYears ( dt1 ) ; int n2 = dt2 . y * 365 + dt2 . d ; for ( int i = 0 ; i < dt2 . m - 1 ; i ++ ) { n2 += monthDays [ i ] ; } n2 += countLeapYears ( dt2 ) ; return ( n2 - n1 ) ; } public static void main ( String [ ] args ) { Date dt1 = new Date ( 1 , 2 , 2000 ) ; Date dt2 = new Date ( 1 , 2 , 2004 ) ; System . out . println ( " Difference ▁ between ▁ two ▁ dates ▁ is ▁ " + getDifference ( dt1 , dt2 ) ) ; } }

Index/key variables: i
Accumulator variables: i, n1, n2, years
Iterator variables: i
Class/struct names: Date, GFG
Java program:
class GFG { static int getPeriod ( int n ) { int rem = 1 ; for ( int i = 1 ; i <= n + 1 ; i ++ ) rem = ( 10 * rem ) % n ; int d = rem ; int count = 0 ; do { rem = ( 10 * rem ) % n ; count ++ ; } while ( rem != d ) ; return count ; } public static void main ( String [ ] args ) { System . out . println ( getPeriod ( 3 ) ) ; System . out . println ( getPeriod ( 7 ) ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
Java program:
public class ReplaceDigits { static int replace0with5 ( int number ) { return number += calculateAddedValue ( number ) ; } private static int calculateAddedValue ( int number ) { int result = 0 ; int decimalPlace = 1 ; if ( number == 0 ) { result += ( 5 * decimalPlace ) ; } while ( number > 0 ) { if ( number % 10 == 0 ) result += ( 5 * decimalPlace ) ; number /= 10 ; decimalPlace *= 10 ; } return result ; } public static void main ( String [ ] args ) { System . out . print ( replace0with5 ( 1020 ) ) ; } }

Accumulator variables: decimalPlace, number, result
Class/struct names: ReplaceDigits
Java program:
import java . io . * ; class GFG { static int getRemainder ( int num , int divisor ) { return ( num - divisor * ( num / divisor ) ) ; } public static void main ( String [ ] args ) { System . out . println ( getRemainder ( 100 , 7 ) ) ; } }

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

Accumulator variables: fact, i, sum
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static void print ( int n , int k ) { int rem = 1 ; for ( int i = 0 ; i < k ; i ++ ) { System . out . print ( ( 10 * rem ) / n ) ; rem = ( 10 * rem ) % n ; } } public static void main ( String [ ] args ) { int n = 7 , k = 3 ; print ( n , k ) ; System . out . println ( ) ; n = 21 ; k = 4 ; print ( n , k ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class Rearrange { void rearrange ( int arr [ ] , int n ) { for ( int i = 0 ; i < n ; i ++ ) arr [ i ] += ( arr [ arr [ i ] ] % n ) * n ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] /= n ; } void printArr ( int arr [ ] , int n ) { for ( int i = 0 ; i < n ; i ++ ) System . out . print ( arr [ i ] + " ▁ " ) ; System . out . println ( " " ) ; } public static void main ( String [ ] args ) { Rearrange rearrange = new Rearrange ( ) ; int arr [ ] = { 3 , 2 , 0 , 1 } ; int n = arr . length ; System . out . println ( " Given ▁ Array ▁ is ▁ : " ) ; rearrange . printArr ( arr , n ) ; rearrange . rearrange ( arr , n ) ; System . out . println ( " Modified ▁ Array ▁ is ▁ : " ) ; rearrange . printArr ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: Rearrange
Java program:
class GfG { static void printArray ( int arr [ ] , int size ) { for ( int i = 0 ; i < size ; i ++ ) System . out . print ( arr [ i ] + " ▁ " ) ; System . out . println ( ) ; return ; } static void printSequencesRecur ( int arr [ ] , int n , int k , int index ) { int i ; if ( k == 0 ) { printArray ( arr , index ) ; } if ( k > 0 ) { for ( i = 1 ; i <= n ; ++ i ) { arr [ index ] = i ; printSequencesRecur ( arr , n , k - 1 , index + 1 ) ; } } } static void printSequences ( int n , int k ) { int arr [ ] = new int [ k ] ; printSequencesRecur ( arr , n , k , 0 ) ; return ; } public static void main ( String [ ] args ) { int n = 3 ; int k = 2 ; printSequences ( n , k ) ; } }

Index/key variables: i, index, k
Accumulator variables: i
Iterator variables: i
Class/struct names: GfG
Java program:
class GFG { static boolean isMultipleof5 ( int n ) { while ( n > 0 ) n = n - 5 ; if ( n == 0 ) return true ; return false ; } public static void main ( String [ ] args ) { int n = 19 ; if ( isMultipleof5 ( n ) == true ) System . out . printf ( "%d is multiple of 5NEW_LINE", n); else System . out . printf ( "%d is not a multiple of 5NEW_LINE", n); } }

Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static void countPairs ( int arr [ ] , int N , int K ) { Map < Integer , Integer > mp = new HashMap < > ( ) ; int cnt = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( mp . get ( K - arr [ i ] ) != null ) cnt += mp . get ( K - arr [ i ] ) ; mp . put ( arr [ i ] , mp . get ( arr [ i ] ) == null ? 1 : mp . get ( arr [ i ] ) + 1 ) ; } System . out . println ( cnt ) ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 5 , 4 , 8 , 7 } ; int N = arr . length ; int K = 9 ; countPairs ( arr , N , K ) ; } }

Index/key variables: i
Accumulator variables: cnt, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; import java . io . * ; import java . math . * ; public class GFG { static int check ( int x ) { if ( ( ( x ) & ( x - 1 ) ) == 0 ) return 1 ; return 0 ; } static int query ( int l , int r , int [ ] pre ) { if ( l == 0 ) return pre [ r ] ; else return pre [ r ] - pre [ l - 1 ] ; } static void countInRange ( int [ ] arr , int N , ArrayList < Pair > queries , int Q ) { int [ ] pre = new int [ N ] ; pre [ 0 ] = check ( arr [ 0 ] ) ; for ( int i = 1 ; i < N ; i ++ ) { pre [ i ] = pre [ i - 1 ] + check ( arr [ i ] ) ; } int c = 0 ; int q = 0 ; while ( q < Q ) { int l = queries . get ( q ) . item1 ; int r = queries . get ( q ) . item2 ; c ++ ; q ++ ; System . out . print ( query ( l , r , pre ) + " ▁ " ) ; } } static class Pair { int item1 , item2 ; Pair ( int item1 , int item2 ) { this . item1 = item1 ; this . item2 = item2 ; } } public static void main ( String args [ ] ) { int [ ] arr = { 12 , 11 , 16 , 8 , 2 , 5 , 1 , 3 , 256 , 1 } ; int N = arr . length ; ArrayList < Pair > queries = new ArrayList < Pair > ( ) ; queries . add ( new Pair ( 4 , 9 ) ) ; queries . add ( new Pair ( 0 , 9 ) ) ; int Q = queries . size ( ) ; countInRange ( arr , N , queries , Q ) ; } }

Index/key variables: N, i, r
Accumulator variables: c, i, q
Iterator variables: i
Class/struct names: GFG, Pair
Java program:
class GFG { static int build_num ( int bit [ ] , int k ) { int ans = 0 ; for ( int i = 0 ; i < 32 ; i ++ ) if ( bit [ i ] == k ) ans += ( 1 << i ) ; return ans ; } static int minimumAND ( int arr [ ] , int n , int k ) { int bit [ ] = new int [ 32 ] ; for ( int i = 0 ; i < k ; i ++ ) { for ( int j = 0 ; j < 32 ; j ++ ) { if ( ( arr [ i ] & ( 1 << j ) ) > 0 ) bit [ j ] ++ ; } } int min_and = build_num ( bit , k ) ; for ( int i = k ; i < n ; i ++ ) { for ( int j = 0 ; j < 32 ; j ++ ) { if ( ( arr [ i - k ] & ( 1 << j ) ) > 0 ) bit [ j ] -- ; } for ( int j = 0 ; j < 32 ; j ++ ) { if ( ( arr [ i ] & ( 1 << j ) ) > 0 ) bit [ j ] ++ ; } min_and = Math . min ( build_num ( bit , k ) , min_and ) ; } return min_and ; } public static void main ( String [ ] args ) { int arr [ ] = { 2 , 5 , 3 , 6 , 11 , 13 } ; int k = 3 ; int n = arr . length ; System . out . print ( minimumAND ( arr , n , k ) ) ; } }

Index/key variables: i, j
Accumulator variables: ans, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static long calculate ( int bit_cnt ) { long res = 1 ; while ( bit_cnt -- > 0 ) { res = res * 3 ; } return res ; } static int unset_bit_count ( long n ) { int count = 0 ; while ( n > 0 ) { if ( ( n & 1 ) == 0 ) count ++ ; n = n >> 1 ; } return count ; } public static void main ( String [ ] args ) { long n ; n = 2 ; int count = unset_bit_count ( n ) ; long ans = calculate ( count ) ; System . out . println ( ans ) ; } }

Accumulator variables: bit_cnt, count
Class/struct names: GFG
Java program:
public class GFG { static int solve ( int A [ ] , int B [ ] , int n ) { int cnt = 0 ; for ( int i = 0 ; i < n ; i ++ ) { { if ( Integer . bitCount ( A [ i ] & A [ j ] ) == B [ j ] ) { cnt ++ ; } } } return cnt ; } public static void main ( String [ ] args ) { int A [ ] = { 2 , 3 , 1 , 4 , 5 } ; int B [ ] = { 2 , 2 , 1 , 4 , 2 } ; int size = A . length ; System . out . println ( solve ( A , B , size ) ) ; } }

Index/key variables: i, j
Accumulator variables: cnt, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void CalculatePairs ( int a [ ] , int n ) { int cnt_zero = 0 ; int cnt_one = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] % 2 == 0 ) cnt_zero += 1 ; else cnt_one += 1 ; } int total_XOR_pairs = cnt_zero * cnt_one ; int total_AND_pairs = ( cnt_one ) * ( cnt_one - 1 ) / 2 ; int total_OR_pairs = cnt_zero * cnt_one + ( cnt_one ) * ( cnt_one - 1 ) / 2 ; System . out . println ( " cntXOR ▁ = ▁ " + total_XOR_pairs ) ; System . out . println ( " cntAND ▁ = ▁ " + total_AND_pairs ) ; System . out . println ( " cntOR ▁ = ▁ " + total_OR_pairs ) ; } public static void main ( String [ ] args ) { int a [ ] = { 1 , 3 , 4 , 2 } ; int n = a . length ; CalculatePairs ( a , n ) ; } }

Index/key variables: i
Accumulator variables: cnt_one, cnt_zero, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class solution { static void alternate ( int a , int b , int x ) { x = a + b - x ; System . out . println ( " After ▁ change " + " " + " x is : "+x); } public static void main ( String args [ ] ) { int a = - 10 ; int b = 15 ; int x = a ; System . out . println ( " x ▁ is ▁ : ▁ " + x ) ; alternate ( a , b , x ) ; } }

Class/struct names: solution
Java program:
class GFG { static int highestPowerOf2 ( int n ) { return ( n & ( ~ ( n - 1 ) ) ) ; } public static void main ( String [ ] args ) { int n = 48 ; System . out . println ( highestPowerOf2 ( n ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; public class GFG { static void isSubsetAndZero ( int array [ ] , int length , int N ) { int arrAnd = array [ 0 ] ; for ( int i = 1 ; i < length ; i ++ ) { arrAnd = arrAnd & array [ i ] ; } if ( ( arrAnd & N ) == 0 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } public static void main ( String [ ] args ) { int array [ ] = { 1 , 2 , 4 } ; int length = array . length ; int N = 3 ; isSubsetAndZero ( array , length , N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG