dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
import java . util . * ; class GFG { static int digitsCount ( int n ) { int len = 0 ; while ( n > 0 ) { len ++ ; n /= 10 ; } return len ; } static int absoluteFirstLast ( int n , int x ) { int i = 0 , mod = 1 ; while ( i < x ) { mod *= 10 ; i ++ ; } int last = n % mod ; int len = digitsCount ( n ) ; while ( len != x ) { n /= 10 ; len -- ; } int first = n ; return Math . abs ( first - last ) ; } public static void main ( String args [ ] ) { int n = 21546 , x = 2 ; System . out . println ( absoluteFirstLast ( n , x ) ) ; } }

Accumulator variables: i, len, mod, n
Class/struct names: GFG
Java program:
class GFG { static void make_sequence ( int N ) { int [ ] arr = new int [ N + 1 ] ; int sum = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { if ( i % 2 == 1 ) arr [ i ] = 1 ; else arr [ i ] = 2 ; sum += arr [ i ] ; } if ( sum % 2 == 1 ) arr [ 2 ] = 3 ; for ( int i = 1 ; i <= N ; i ++ ) System . out . print ( arr [ i ] + " ▁ " ) ; } public static void main ( String [ ] args ) { int N = 9 ; make_sequence ( N ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int countOdd ( int L , int R ) { int N = ( R - L ) / 2 ; if ( R % 2 != 0 L % 2 != 0 ) N ++ ; return N ; } public static void main ( String [ ] args ) { int L = 3 , R = 7 ; int odds = countOdd ( L , R ) ; int evens = ( R - L + 1 ) - odds ; System . out . println ( " Count ▁ of ▁ odd ▁ numbers ▁ is ▁ " + odds ) ; System . out . println ( " Count ▁ of ▁ even ▁ numbers ▁ is ▁ " + evens ) ; } }

Accumulator variables: N
Class/struct names: GFG
Java program:
class gfg { static int getMinCost ( int n , int m ) { int cost = ( n - 1 ) * m + ( m - 1 ) * n ; return cost ; } public static void main ( String [ ] args ) { int n = 4 , m = 5 ; System . out . println ( getMinCost ( n , m ) ) ; } }

Class/struct names: gfg
Java program:
import java . io . * ; class GFG { static void minOperation ( int n , int k , int a [ ] ) { for ( int i = k ; i < n ; i ++ ) { if ( a [ i ] != a [ k - 1 ] ) System . out . println ( - 1 ) ; } for ( int i = k - 2 ; i > - 1 ; i -- ) { if ( a [ i ] != a [ k - 1 ] ) System . out . println ( i + 1 ) ; } } public static void main ( String [ ] args ) { int n = 5 ; int k = 3 ; int a [ ] = { 2 , 1 , 1 , 1 , 1 } ; minOperation ( n , k , a ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int binomialCoeff ( int n , int k ) { if ( k > n ) return 0 ; int res = 1 ; if ( k > n - k ) k = n - k ; for ( int i = 0 ; i < k ; ++ i ) { res *= ( n - i ) ; res /= ( i + 1 ) ; } return res ; } public static void main ( String [ ] args ) { int N = 5 , M = 1 ; int P = ( N * ( N - 1 ) ) / 2 ; System . out . println ( binomialCoeff ( P , M ) ) ; } }

Accumulator variables: res
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void generateSequence ( int n , int g ) { for ( int i = 1 ; i <= n ; i ++ ) System . out . print ( i * g + " ▁ " ) ; ; } public static void main ( String [ ] args ) { int n = 6 , g = 5 ; generateSequence ( n , g ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int MAX = 1000 ; static int [ ] f = new int [ MAX ] ; static int fib ( int n ) { if ( n == 0 ) return 0 ; if ( n == 1 n == 2 ) return ( f [ n ] = 1 ) ; if ( f [ n ] != 0 ) return f [ n ] ; int k = 0 ; if ( ( n & 1 ) != 0 ) k = ( n + 1 ) / 2 ; else k = n / 2 ; if ( ( n & 1 ) != 0 ) f [ n ] = ( fib ( k ) * fib ( k ) + fib ( k - 1 ) * fib ( k - 1 ) ) ; else f [ n ] = ( 2 * fib ( k - 1 ) + fib ( k ) ) * fib ( k ) ; return f [ n ] ; } static int gcd ( int a , int b ) { if ( a == 0 ) return b ; return gcd ( b % a , a ) ; } static int findLCMFibonacci ( int a , int b ) { return ( fib ( a ) * fib ( b ) ) / fib ( gcd ( a , b ) ) ; } public static void main ( String args [ ] ) { int a = 3 , b = 12 ; System . out . println ( findLCMFibonacci ( a , b ) ) ; } }

Index/key variables: MAX, n
Class/struct names: GFG
Java program:
class GFG { static String isEvenOrOdd ( int L , int R ) { int oddCount = ( R - L ) / 2 ; if ( R % 2 == 1 L % 2 == 1 ) oddCount ++ ; if ( oddCount % 2 == 0 ) return " Even " ; else return " Odd " ; } public static void main ( String [ ] args ) { int L = 5 , R = 15 ; System . out . println ( isEvenOrOdd ( L , R ) ) ; } }

Accumulator variables: oddCount
Class/struct names: GFG
Java program:
class GFG { static int trailing_zeros ( int N ) { int count_of_two = 0 , count_of_five = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { int val = i ; while ( val % 2 == 0 && val > 0 ) { val /= 2 ; count_of_two += i ; } while ( val % 5 == 0 && val > 0 ) { val /= 5 ; count_of_five += i ; } } int ans = Math . min ( count_of_two , count_of_five ) ; return ans ; } public static void main ( String [ ] args ) { int N = 12 ; System . out . println ( trailing_zeros ( N ) ) ; } }

Accumulator variables: count_of_five, count_of_two, i, val
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int limit = 1000000000 ; static int MAX_PRIME = 2000000 ; static int MAX = 1000000 ; static int I_MAX = 50000 ; static HashMap < Integer , Integer > mp = new HashMap < Integer , Integer > ( ) ; static int [ ] b = new int [ MAX ] ; static int [ ] p = new int [ MAX ] ; static int j = 0 ; static boolean [ ] prime = new boolean [ MAX_PRIME + 1 ] ; static void SieveOfEratosthenes ( int n ) { for ( int i = 0 ; i < MAX_PRIME + 1 ; i ++ ) prime [ i ] = true ; for ( int p = 2 ; p * p <= n ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * p ; i <= n ; i += p ) prime [ i ] = false ; } } for ( int p = 2 ; p <= n ; p ++ ) { if ( prime [ p ] ) { b [ j ++ ] = p ; } } } static int gcd ( int a , int b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } static void printSeries ( int n ) { SieveOfEratosthenes ( MAX_PRIME ) ; int i , g , k , l , m , d ; int [ ] ar = new int [ I_MAX + 2 ] ; for ( i = 0 ; i < j ; i ++ ) { if ( ( b [ i ] * b [ i + 1 ] ) > limit ) break ; p [ i ] = b [ i ] ; mp . put ( b [ i ] * b [ i + 1 ] , 1 ) ; } d = 550 ; boolean flag = false ; for ( k = 2 ; ( k < d - 1 ) && ! flag ; k ++ ) { for ( m = 2 ; ( m < d ) && ! flag ; m ++ ) { for ( l = m + k ; l < d ; l += k ) { if ( ( ( b [ l ] * b [ l + k ] ) < limit ) && mp . containsKey ( b [ l ] * b [ l + k ] ) && mp . containsKey ( p [ i - 1 ] * b [ l ] ) && ( l + k ) < d && p [ i - 1 ] != b [ l + k ] && p [ i - 1 ] != b [ l ] && mp . get ( b [ l ] * b [ l + k ] ) != 1 ) { if ( mp . get ( p [ i - 1 ] * b [ l ] ) != 1 ) { p [ i ] = b [ l ] ; mp . put ( p [ i - 1 ] * b [ l ] , 1 ) ; i ++ ; } } if ( i >= I_MAX ) { flag = true ; break ; } } } } for ( i = 0 ; i < n ; i ++ ) ar [ i ] = p [ i ] * p [ i + 1 ] ; for ( i = 0 ; i < n - 1 ; i ++ ) System . out . print ( ar [ i ] + " ▁ " ) ; g = gcd ( ar [ n - 1 ] , ar [ n - 2 ] ) ; System . out . print ( g * 2 ) ; } public static void main ( String [ ] args ) { int n = 4 ; printSeries ( n ) ; } }

Index/key variables: MAX, i, l, p
Accumulator variables: i, j, k, l, m, p
Iterator variables: i, k, l, m, p
Boolean variables: flag
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int MAX = 620000 ; static int [ ] prime = new int [ MAX ] ; static void Sieve ( ) { for ( int i = 2 ; i < MAX ; i ++ ) { if ( prime [ i ] == 0 ) { for ( int j = 2 * i ; j < MAX ; j += i ) { prime [ j ] = 1 ; } } } } static void printSequence ( int n ) { Sieve ( ) ; Vector < Integer > v = new Vector < Integer > ( ) ; Vector < Integer > u = new Vector < Integer > ( ) ; for ( int i = 13 ; i < MAX ; i ++ ) { if ( prime [ i ] == 0 ) { v . add ( i ) ; } } if ( n == 3 ) { System . out . print ( 6 + " ▁ " + 10 + " ▁ " + 15 ) ; return ; } int k ; for ( k = 0 ; k < n - 2 ; k ++ ) { if ( k % 3 == 0 ) { u . add ( v . get ( k ) * 6 ) ; } else if ( k % 3 == 1 ) { u . add ( v . get ( k ) * 15 ) ; } else { u . add ( v . get ( k ) * 10 ) ; } } k -- ; u . add ( v . get ( k ) * 7 ) ; u . add ( 7 * 11 ) ; u . set ( 0 , u . get ( 0 ) * 11 ) ; for ( int i = 0 ; i < u . size ( ) ; i ++ ) { System . out . print ( u . get ( i ) + " ▁ " ) ; } } public static void main ( String [ ] args ) { int n = 4 ; printSequence ( n ) ; } }

Index/key variables: MAX, i, j
Accumulator variables: i, j, k
Iterator variables: i, j, k
Class/struct names: GFG
Java program:
import java . util . * ; import java . text . DecimalFormat ; class GFG { static void midptellipse ( float rx , float ry , float xc , float yc ) { float dx , dy , d1 , d2 , x , y ; x = 0 ; y = ry ; d1 = ( ry * ry ) - ( rx * rx * ry ) + ( 0.25f * rx * rx ) ; dx = 2 * ry * ry * x ; dy = 2 * rx * rx * y ; DecimalFormat df = new DecimalFormat ( " # , # # # , # #0.00000" ) ; while ( dx < dy ) { System . out . println ( df . format ( ( x + xc ) ) + " , ▁ " + df . format ( ( y + yc ) ) ) ; System . out . println ( df . format ( ( - x + xc ) ) + " , ▁ " + df . format ( ( y + yc ) ) ) ; System . out . println ( df . format ( ( x + xc ) ) + " , ▁ " + df . format ( ( - y + yc ) ) ) ; System . out . println ( df . format ( ( - x + xc ) ) + " , ▁ " + df . format ( ( - y + yc ) ) ) ; if ( d1 < 0 ) { x ++ ; dx = dx + ( 2 * ry * ry ) ; d1 = d1 + dx + ( ry * ry ) ; } else { x ++ ; y -- ; dx = dx + ( 2 * ry * ry ) ; dy = dy - ( 2 * rx * rx ) ; d1 = d1 + dx - dy + ( ry * ry ) ; } } d2 = ( ( ry * ry ) * ( ( x + 0.5f ) * ( x + 0.5f ) ) ) + ( ( rx * rx ) * ( ( y - 1 ) * ( y - 1 ) ) ) - ( rx * rx * ry * ry ) ; while ( y >= 0 ) { System . out . println ( df . format ( ( x + xc ) ) + " , ▁ " + df . format ( ( y + yc ) ) ) ; System . out . println ( df . format ( ( - x + xc ) ) + " , ▁ " + df . format ( ( y + yc ) ) ) ; System . out . println ( df . format ( ( x + xc ) ) + " , ▁ " + df . format ( ( - y + yc ) ) ) ; System . out . println ( df . format ( ( - x + xc ) ) + " , ▁ " + df . format ( ( - y + yc ) ) ) ; if ( d2 > 0 ) { y -- ; dy = dy - ( 2 * rx * rx ) ; d2 = d2 + ( rx * rx ) - dy ; } else { y -- ; x ++ ; dx = dx + ( 2 * ry * ry ) ; dy = dy - ( 2 * rx * rx ) ; d2 = d2 + dx - dy + ( rx * rx ) ; } } } public static void main ( String args [ ] ) { midptellipse ( 10 , 15 , 50 , 50 ) ; } }

Accumulator variables: x, y
Class/struct names: GFG
Java program:
class GFG { static String isDivisible ( long n ) { long temp = n ; int sum = 0 ; while ( n != 0 ) { int k = ( int ) n % 10 ; sum += k ; n /= 10 ; } if ( temp % sum == 0 ) return " YES " ; return " NO " ; } public static void main ( String [ ] args ) { long n = 123 ; System . out . println ( isDivisible ( n ) ) ; } }

Accumulator variables: n, sum
Class/struct names: GFG
Java program:
class GFG { static String getResult ( int n ) { String st = String . valueOf ( n ) ; int sum = 0 ; for ( char i : st . toCharArray ( ) ) { sum = sum + ( int ) i ; } if ( n % sum == 0 ) return " Yes " ; else return " No " ; } public static void main ( String [ ] args ) { int n = 123 ; System . out . println ( getResult ( n ) ) ; } }

Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static void alter ( long x , long y ) { while ( true ) { if ( x == 0 y == 0 ) break ; if ( x >= 2 * y ) x = x % ( 2 * y ) ; else if ( y >= 2 * x ) y = y % ( 2 * x ) ; else break ; } System . out . println ( " X ▁ = ▁ " + x + " , ▁ " + " Y ▁ = ▁ " + y ) ; } public static void main ( String [ ] args ) { long x = 12 , y = 5 ; alter ( x , y ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int digitProduct ( int n ) { int prod = 1 ; while ( n > 0 ) { prod = prod * ( n % 10 ) ; n = n / 10 ; } return prod ; } static void printMultiplicativePrimes ( int n ) { boolean prime [ ] = new boolean [ n + 1 ] ; for ( int i = 0 ; i <= n ; i ++ ) prime [ i ] = true ; prime [ 0 ] = prime [ 1 ] = false ; for ( int p = 2 ; p * p <= n ; p ++ ) { if ( prime [ p ] ) { for ( int i = p * 2 ; i <= n ; i += p ) prime [ i ] = false ; } } for ( int i = 2 ; i <= n ; i ++ ) { if ( prime [ i ] && prime [ digitProduct ( i ) ] ) System . out . print ( i + " ▁ " ) ; } } public static void main ( String [ ] args ) { int n = 10 ; printMultiplicativePrimes ( n ) ; } }

Index/key variables: i, p
Accumulator variables: i, p
Iterator variables: i, p
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int gcd ( int a , int b ) { if ( b == 0 ) return a ; else return gcd ( b , a % b ) ; } static boolean coPrime ( int n1 , int n2 ) { if ( gcd ( n1 , n2 ) == 1 ) return true ; else return false ; } static int largestCoprime ( int N ) { int half = ( int ) ( N / 2 ) ; while ( coPrime ( N , half ) == false ) half -- ; return half ; } public static void main ( String args [ ] ) { int n = 50 ; System . out . println ( largestCoprime ( n ) ) ; } }

Accumulator variables: half
Class/struct names: GFG
Java program:
class GfG { static int largestCoprime ( int N ) { if ( N == 6 ) return 1 ; else if ( N % 4 == 0 ) return ( N / 2 ) - 1 ; else if ( N % 2 == 0 ) return ( N / 2 ) - 2 ; else return ( ( N - 1 ) / 2 ) ; } public static void main ( String [ ] args ) { int n = 50 ; System . out . println ( largestCoprime ( n ) ) ; } }

Class/struct names: GfG
Java program:
class GFG { static void printSafePrimes ( int n ) { int prime [ ] = new int [ n + 1 ] ; for ( int i = 2 ; i <= n ; i ++ ) prime [ i ] = 1 ; prime [ 0 ] = prime [ 1 ] = 0 ; for ( int p = 2 ; p * p <= n ; p ++ ) { if ( prime [ p ] == 1 ) { for ( int i = p * 2 ; i <= n ; i += p ) prime [ i ] = 0 ; } } for ( int i = 2 ; i <= n ; i ++ ) { if ( prime [ i ] != 0 ) { int temp = ( 2 * i ) + 1 ; if ( temp <= n && prime [ temp ] != 0 ) prime [ temp ] = 2 ; } } for ( int i = 5 ; i <= n ; i ++ ) if ( prime [ i ] == 2 ) System . out . print ( i + " ▁ " ) ; } public static void main ( String [ ] args ) { int n = 20 ; printSafePrimes ( n ) ; } }

Index/key variables: i, p, temp
Accumulator variables: i, p
Iterator variables: i, p
Class/struct names: GFG
Java program:
import java . util . Vector ; class GFG { static Vector < Integer > Divisors ( int x ) { int c = 0 ; Vector < Integer > v = new Vector < Integer > ( ) ; while ( x % 2 == 0 ) { c ++ ; x /= 2 ; } v . add ( c ) ; c = 0 ; while ( x % 3 == 0 ) { c ++ ; x /= 3 ; } v . add ( c ) ; c = 0 ; while ( x % 7 == 0 ) { c ++ ; x /= 7 ; } v . add ( c ) ; v . add ( x ) ; return v ; } static int MinOperations ( int a , int b ) { Vector < Integer > va = Divisors ( a ) ; Vector < Integer > vb = Divisors ( b ) ; if ( va . get ( 3 ) != vb . get ( 3 ) ) { return - 1 ; } int minOperations = Math . abs ( va . get ( 0 ) - vb . get ( 0 ) ) + Math . abs ( va . get ( 1 ) - vb . get ( 1 ) ) + Math . abs ( va . get ( 2 ) - vb . get ( 2 ) ) ; return minOperations ; } public static void main ( String [ ] args ) { int a = 14 , b = 28 ; System . out . println ( MinOperations ( a , b ) ) ; } }

Accumulator variables: c, x
Class/struct names: GFG
Java program:
class GFG { static int largestOddDigit ( int n ) { int maxOdd = - 1 ; while ( n > 0 ) { int digit = n % 10 ; if ( digit % 2 == 1 && digit > maxOdd ) maxOdd = digit ; n = n / 10 ; } return maxOdd ; } static int getProduct ( int n ) { int maxOdd = largestOddDigit ( n ) ; if ( maxOdd == - 1 ) return - 1 ; return ( n * maxOdd ) ; } public static void main ( String [ ] args ) { int n = 12345 ; System . out . println ( getProduct ( n ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static boolean isPerfectSquare ( int num ) { long left = 1 , right = num ; while ( left <= right ) { long mid = ( left + right ) / 2 ; if ( mid * mid == num ) { return true ; } if ( mid * mid < num ) { left = mid + 1 ; } else { right = mid - 1 ; } } return false ; } public static void main ( String [ ] args ) { int x = 2500 ; if ( isPerfectSquare ( x ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static void printNum ( int n , int k ) { String str = Integer . toBinaryString ( n ) ; int x = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) if ( str . charAt ( i ) == '1' ) x ++ ; if ( k < x k > n ) { System . out . println ( " - 1" ) ; return ; } PriorityQueue < Integer > pq = new PriorityQueue < > ( Comparator . reverseOrder ( ) ) ; int two = 1 ; while ( n > 0 ) { if ( ( n & 1 ) == 1 ) pq . add ( two ) ; two *= 2 ; n = n >> 1 ; } while ( pq . size ( ) < k ) { int el = pq . poll ( ) ; pq . add ( el / 2 ) ; pq . add ( el / 2 ) ; } int ind = 0 ; while ( ind < k ) { System . out . print ( pq . poll ( ) + " ▁ " ) ; ind ++ ; } } public static void main ( String [ ] args ) { int n = 9 , k = 4 ; printNum ( n , k ) ; } }

Accumulator variables: i, ind, two, x
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int n = 1000002 ; static int [ ] phi = new int [ n + 2 ] ; static int [ ] ans = new int [ n + 2 ] ; static void ETF ( ) { for ( int i = 1 ; i <= n ; i ++ ) { phi [ i ] = i ; } for ( int i = 2 ; i <= n ; i ++ ) { if ( phi [ i ] == i ) { phi [ i ] = i - 1 ; for ( int j = 2 * i ; j <= n ; j += i ) { phi [ j ] = ( phi [ j ] * ( i - 1 ) ) / i ; } } } } static int LcmSum ( int m ) { ETF ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = i ; j <= n ; j += i ) { ans [ j ] += ( i * phi [ i ] ) ; } } int answer = ans [ m ] ; answer = ( answer + 1 ) * m ; answer = answer / 2 ; return answer ; } public static void main ( String [ ] args ) { int m = 5 ; System . out . println ( LcmSum ( m ) ) ; } }

Index/key variables: i, j, m
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static int factorial ( int n ) { int fact = 1 ; for ( int i = 2 ; i <= n ; i ++ ) fact = fact * i ; return fact ; } static int ncr ( int n , int r ) { return factorial ( n ) / ( factorial ( r ) * factorial ( n - r ) ) ; } static int countWays ( String str ) { int freq [ ] = new int [ 26 ] ; for ( int i = 0 ; i < 26 ; i ++ ) { freq [ i ] = 0 ; } int nvowels = 0 , nconsonants = 0 ; int vplaces , cways , vways ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) ++ freq [ str . charAt ( i ) - ' a ' ] ; for ( int i = 0 ; i < 26 ; i ++ ) { if ( i == 0 i == 4 i == 8 i == 14 i == 20 ) nvowels += freq [ i ] ; else nconsonants += freq [ i ] ; } vplaces = nconsonants + 1 ; cways = factorial ( nconsonants ) ; for ( int i = 0 ; i < 26 ; i ++ ) { if ( i != 0 && i != 4 && i != 8 && i != 14 && i != 20 && freq [ i ] > 1 ) { cways = cways / factorial ( freq [ i ] ) ; } } vways = ncr ( vplaces , nvowels ) * factorial ( nvowels ) ; for ( int i = 0 ; i < 26 ; i ++ ) { if ( i == 0 i == 4 i == 8 i == 14 i == 20 && freq [ i ] > 1 ) { vways = vways / factorial ( freq [ i ] ) ; } } return cways * vways ; } public static void main ( String [ ] args ) { String str = " permutation " ; System . out . println ( countWays ( str ) ) ; } }

Index/key variables: i
Accumulator variables: i, nconsonants, nvowels
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int setBits ( int n ) { int count = 0 ; while ( n > 0 ) { n = n & ( n - 1 ) ; count ++ ; } return count ; } static int countPairs ( int a [ ] , int n ) { int count = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { int setbits_x = setBits ( a [ i ] ) ; for ( int j = i + 1 ; j < n ; j ++ ) { int setbits_y = setBits ( a [ j ] ) ; int setbits_xor_xy = setBits ( a [ i ] ^ a [ j ] ) ; if ( setbits_x + setbits_y == setbits_xor_xy ) count ++ ; } } return count ; } public static void main ( String [ ] args ) { int [ ] a = { 2 , 3 , 4 , 5 , 6 } ; int n = a . length ; System . out . println ( countPairs ( a , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int gcd ( int a , int b ) { if ( a == 0 ) return b ; return gcd ( b % a , a ) ; } static int findPossibleDerivables ( int arr [ ] , int n , int D , int A , int B ) { int gcdAB = gcd ( A , B ) ; int counter = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( ( Math . abs ( arr [ i ] - D ) % gcdAB ) == 0 ) { counter ++ ; } } return counter ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 , 3 , 4 , 7 , 13 } ; int n = arr . length ; int D = 5 , A = 4 , B = 2 ; System . out . println ( findPossibleDerivables ( arr , n , D , A , B ) ) ; int a [ ] = { 1 , 2 , 3 } ; n = a . length ; D = 6 ; A = 3 ; B = 2 ; System . out . println ( findPossibleDerivables ( a , n , D , A , B ) ) ; } }

Index/key variables: i
Accumulator variables: counter, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int calSum ( int n ) { return ( n * ( 2 * n * n * n + 12 * n * n + 25 * n + 21 ) ) / 2 ; } public static void main ( String args [ ] ) { int n = 3 ; System . out . println ( calSum ( n ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static void getElements ( int a , int arr [ ] , int n ) { int elements [ ] = new int [ n + 1 ] ; elements [ 0 ] = a ; for ( int i = 0 ; i < n ; i ++ ) { elements [ i + 1 ] = arr [ i ] ^ elements [ i ] ; } for ( int i = 0 ; i < n + 1 ; i ++ ) System . out . print ( elements [ i ] + " ▁ " ) ; } public static void main ( String [ ] args ) { int arr [ ] = { 13 , 2 , 6 , 1 } ; int n = arr . length ; int a = 5 ; getElements ( a , arr , n ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class Solution { static int maxGCD ( int N , int P ) { int ans = 1 ; Map < Integer , Integer > prime_factors = new HashMap < Integer , Integer > ( ) ; for ( int i = 2 ; i * i <= P ; i ++ ) { while ( P % i == 0 ) { if ( prime_factors . get ( i ) == null ) prime_factors . put ( i , 1 ) ; else prime_factors . put ( i , ( prime_factors . get ( i ) + 1 ) ) ; P /= i ; } } if ( P != 1 ) if ( prime_factors . get ( P ) == null ) prime_factors . put ( P , 1 ) ; else prime_factors . put ( P , ( prime_factors . get ( P ) + 1 ) ) ; Set < Map . Entry < Integer , Integer > > st = prime_factors . entrySet ( ) ; for ( Map . Entry < Integer , Integer > me : st ) { ans *= Math . pow ( me . getKey ( ) , me . getValue ( ) / N ) ; } return ans ; } public static void main ( String args [ ] ) { int N = 3 , P = 24 ; System . out . println ( maxGCD ( N , P ) ) ; } }

Accumulator variables: P, ans, i
Iterator variables: i
Class/struct names: Solution
Java program:
public class HelloWorld { static int distinctDigitSum ( int n ) { boolean used [ ] = new boolean [ 10 ] ; int sum = 0 ; while ( n > 0 ) { int digit = n % 10 ; if ( ! used [ digit ] ) { used [ digit ] = true ; sum += digit ; } n = n / 10 ; } return sum ; } static String checkSum ( int m , int n ) { int sumM = distinctDigitSum ( m ) ; int sumN = distinctDigitSum ( n ) ; if ( sumM == sumN ) return " YES " ; return " NO " ; } public static void main ( String [ ] args ) { int m = 2452 , n = 9222 ; System . out . println ( checkSum ( m , n ) ) ; } }

Index/key variables: digit
Accumulator variables: sum
Class/struct names: HelloWorld
Java program:
import java . util . * ; class solution { 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 int countPairs ( int a [ ] , int n ) { int count = 0 ; Map < Integer , Integer > m = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < n - 1 ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { if ( isPrime ( a [ i ] ^ a [ j ] ) && m . get ( a [ i ] ^ a [ j ] ) == null ) { m . put ( ( a [ i ] ^ a [ j ] ) , 1 ) ; count ++ ; } } } return count ; } public static void main ( String args [ ] ) { int a [ ] = { 10 , 12 , 23 , 45 , 5 , 6 } ; int n = a . length ; System . out . println ( countPairs ( a , n ) ) ; } }

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