dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
class GFG { static final int MAX = 1000 ; static int max_prime [ ] = new int [ MAX ] ; static int min_prime [ ] = new int [ MAX ] ; static void sieve ( int n ) { for ( int i = 2 ; i < n ; ++ i ) { if ( min_prime [ i ] > 0 ) { continue ; } min_prime [ i ] = i ; max_prime [ i ] = i ; int j = i + i ; while ( j < n ) { if ( min_prime [ j ] == 0 ) { min_prime [ j ] = i ; } max_prime [ j ] = i ; j += i ; } } } static int findCost ( int A , int B , int C , int X ) { sieve ( MAX ) ; int N , M ; if ( X == 1 ) { return - 1 ; } int min_cost = C + X ; int cost_for_prime = A ; N = max_prime [ X ] ; if ( N != X ) { M = X / N ; cost_for_prime += M ; min_cost = Math . min ( min_cost , cost_for_prime ) ; } M = min_prime [ X ] ; N = X / M ; if ( N != min_prime [ N ] ) { int cost_for_comp = B + M ; min_cost = Math . min ( min_cost , cost_for_comp ) ; } return min_cost ; } public static void main ( String [ ] args ) { int A = 7 , B = 11 , C = 2 , X = 20 ; System . out . println ( findCost ( A , B , C , X ) ) ; } }

Index/key variables: MAX, N, X, i, j
Accumulator variables: cost_for_prime, j
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static double countdigits ( int n , int k ) { if ( n == 0 ) return 0 ; int digit = n % 10 ; if ( digit == k ) return 1 + countdigits ( n / 10 , k ) ; return countdigits ( n / 10 , k ) ; } public static void main ( String [ ] args ) { int n = 1000 ; int k = 0 ; System . out . println ( countdigits ( n , k ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static void printModulus ( int X , int Y ) { int n = Math . max ( X , Y ) ; for ( int i = 1 ; i <= n ; i ++ ) { if ( X % i == Y % i ) System . out . print ( i + " ▁ " ) ; } } public static void main ( String [ ] args ) { int X , Y ; X = 10 ; Y = 20 ; printModulus ( X , Y ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void printModulus ( int X , int Y ) { int d = Math . abs ( X - Y ) ; int i = 1 ; while ( i * i <= d ) { if ( d % i == 0 ) { System . out . print ( i + " ▁ " ) ; if ( d / i != i ) System . out . print ( d / i + " ▁ " ) ; } i ++ ; } } public static void main ( String [ ] args ) { int X = 10 ; int Y = 26 ; printModulus ( X , Y ) ; } }

Accumulator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean difSquare ( int n ) { if ( n % 4 != 2 ) { return true ; } return false ; } public static void main ( String [ ] args ) { int n = 45 ; if ( difSquare ( n ) ) { System . out . print ( "YesNEW_LINE"); } else { System . out . print ( "NoNEW_LINE"); } } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void createHash ( HashSet < Integer > hash , int maxElement ) { int prev = 0 , curr = 1 ; hash . add ( prev ) ; hash . add ( curr ) ; while ( curr <= maxElement ) { int temp = curr + prev ; hash . add ( temp ) ; prev = curr ; curr = temp ; } } static int countFibonacciDivisors ( int n ) { HashSet < Integer > hash = new HashSet < Integer > ( ) ; createHash ( hash , n ) ; int cnt = 0 ; for ( int i = 1 ; i <= Math . sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { if ( ( n / i == i ) && ( hash . contains ( n / i ) ) ) cnt ++ ; else { if ( hash . contains ( n / i ) ) cnt ++ ; if ( hash . contains ( n / ( n / i ) ) ) cnt ++ ; } } } return cnt ; } public static void main ( String [ ] args ) { int n = 12 ; System . out . print ( countFibonacciDivisors ( n ) ) ; } }

Accumulator variables: cnt, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static class Node { int data ; Node left , right ; } ; static int res ; static int k ; static Node newNode ( int data ) { Node newNode = new Node ( ) ; newNode . data = data ; newNode . left = null ; newNode . right = null ; return newNode ; } static int rec ( Node root ) { if ( root == null ) { return 0 ; } xr ^= rec ( root . left ) ; xr ^= rec ( root . right ) ; if ( xr == k ) { res ++ ; } return xr ; } static int findCount ( Node root , int K ) { res = 0 ; k = K ; rec ( root ) ; return res ; } public static void main ( String args [ ] ) { Node root = newNode ( 2 ) ; root . left = newNode ( 1 ) ; root . right = newNode ( 9 ) ; root . left . left = newNode ( 10 ) ; root . left . right = newNode ( 5 ) ; int K = 5 ; System . out . println ( findCount ( root , K ) ) ; } }

Accumulator variables: res, xr
Class/struct names: GFG, Node
Java program:
class GFG { static void makearrayequal ( int arr [ ] , int n ) { int x = 0 ; for ( int i = 0 ; i < n ; i ++ ) { x += ( arr [ i ] & 1 ) ; } System . out . println ( Math . min ( x , n - x ) ) ; } public static void main ( String [ ] args ) { int arr [ ] = { 4 , 3 , 2 , 1 } ; int n = arr . length ; makearrayequal ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: i, x
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int countDigit ( int n ) { int temp = n , count = 0 ; while ( temp != 0 ) { int d = temp % 10 ; temp /= 10 ; if ( d == 2 d == 3 d == 5 d == 7 ) count ++ ; } return count ; } public static void main ( String [ ] args ) { int n = 1234567890 ; System . out . println ( countDigit ( n ) ) ; } }

Accumulator variables: count, temp
Class/struct names: GFG
Java program:
class GFG { static String permutation ( int arr [ ] , int N ) { int [ ] hash = new int [ N + 1 ] ; for ( int i = 0 ; i < N ; i ++ ) { hash [ arr [ i ] ] ++ ; } for ( int i = 1 ; i <= N ; i ++ ) { if ( hash [ i ] != 1 ) return " No " ; } return " Yes " ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 1 , 5 , 5 , 3 } ; int n = arr . length ; System . out . print ( permutation ( arr , n ) + "NEW_LINE"); } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static String check ( int [ ] arr , int n ) { int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( ( arr [ i ] & 1 ) != 0 ) count ++ ; } if ( ( count & 1 ) != 0 ) return " Odd " ; else return " Even " ; } public static void main ( String args [ ] ) { int [ ] arr = { 3 , 9 , 12 , 13 , 15 } ; int n = arr . length ; System . out . println ( check ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static final int N = 100005 ; static void SieveOfEratosthenes ( boolean prime [ ] , int p_size ) { prime [ 0 ] = false ; prime [ 1 ] = false ; for ( int p = 2 ; p * p <= p_size ; p ++ ) { if ( prime [ p ] ) { for ( int i = p * 2 ; i <= p_size ; i += p ) prime [ i ] = false ; } } } static int longestPrimeSubsequence ( int arr [ ] , int n ) { boolean [ ] prime = new boolean [ N + 1 ] ; Arrays . fill ( prime , true ) ; SieveOfEratosthenes ( prime , N ) ; int answer = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( prime [ arr [ i ] ] ) { answer ++ ; } } return answer ; } public static void main ( String [ ] args ) { int arr [ ] = { 3 , 4 , 11 , 2 , 9 , 21 } ; int n = arr . length ; System . out . print ( longestPrimeSubsequence ( arr , n ) + "NEW_LINE"); } }

Index/key variables: i, p
Accumulator variables: answer, i, p
Iterator variables: i, p
Class/struct names: GFG
Java program:
class GFG { static String even_or_odd ( String N ) { int len = N . length ( ) ; if ( N . charAt ( len - 1 ) == '0' || N . charAt ( len - 1 ) == '2' || N . charAt ( len - 1 ) == '4' || N . charAt ( len - 1 ) == '6' ) return ( " Even " ) ; else return ( " Odd " ) ; } public static void main ( String [ ] args ) { String N = "735" ; System . out . print ( even_or_odd ( N ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static double dydx ( double x , double y ) { return ( x + y - 2 ) ; } static double rungeKutta ( double x0 , double y0 , double x , double h ) { int n = ( int ) ( ( x - x0 ) / h ) ; double k1 , k2 ; double y = y0 ; for ( int i = 1 ; i <= n ; i ++ ) { k1 = h * dydx ( x0 , y ) ; k2 = h * dydx ( x0 + 0.5 * h , y + 0.5 * k1 ) ; y = y + ( 1.0 / 6.0 ) * ( k1 + 2 * k2 ) ; x0 = x0 + h ; } return y ; } public static void main ( String [ ] args ) { double x0 = 0 , y = 1 , x = 2 , h = 0.2 ; System . out . println ( rungeKutta ( x0 , y , x , h ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static final int size = 10001 ; static long [ ] fib = new long [ 100010 ] ; static int [ ] freq = new int [ 100010 ] ; static boolean isPerfectSquare ( int x ) { int s = ( int ) Math . sqrt ( x ) ; return ( s * s == x ) ; } static int isFibonacci ( int n ) { if ( isPerfectSquare ( 5 * n * n + 4 ) || isPerfectSquare ( 5 * n * n - 4 ) ) return 1 ; return 0 ; } static void compute ( int a , int b ) { for ( int i = 1 ; i < 100010 ; i ++ ) { fib [ i ] = isFibonacci ( i ) ; } for ( int x = 1 ; x < 100010 ; x ++ ) { for ( int y = 1 ; y < size ; y ++ ) { if ( fib [ x ] == 1 && fib [ y ] == 1 && a * x + b * y < 100010 ) { freq [ a * x + b * y ] ++ ; } } } } public static void main ( String [ ] args ) { int Q = 2 , A = 5 , B = 10 ; compute ( A , B ) ; int arr [ ] = { 50 , 150 } ; for ( int i = 0 ; i < Q ; i ++ ) { System . out . print ( freq [ arr [ i ] ] + " ▁ " ) ; } } }

Index/key variables: i, x, y
Accumulator variables: i, x, y
Iterator variables: i, x, y
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int MAX = 100 ; static int max_element ( int arr [ ] , int pos ) { int tmp = arr [ 0 ] ; int ind = 0 ; for ( int i = 1 ; i < pos ; i ++ ) { if ( tmp < arr [ i ] ) { tmp = arr [ i ] ; ind = i ; } } return ind ; } static void findMaxSum ( int n1 , int n2 ) { int [ ] arr1 = new int [ MAX ] ; int [ ] arr2 = new int [ MAX ] ; int l1 = 0 , l2 = 0 ; int max1 = Math . max ( n1 , n2 ) ; int min1 = Math . min ( n1 , n2 ) ; for ( int i = max1 ; i > 0 ; i /= 10 ) arr1 [ l1 ++ ] = ( i % 10 ) ; for ( int i = min1 ; i > 0 ; i /= 10 ) arr2 [ l2 ++ ] = ( i % 10 ) ; int f = 0 ; if ( l1 != l2 ) { int index = ( max_element ( arr2 , l2 ) ) ; for ( int i = l1 - 1 ; i > ( l2 - 1 ) ; i -- ) { if ( arr1 [ i ] < arr2 [ index ] ) { int tmp = arr1 [ i ] ; arr1 [ i ] = arr2 [ index ] ; arr2 [ index ] = tmp ; f = 1 ; break ; } } } if ( f != 1 ) { int index1 = 0 , index2 = 0 ; int diff1 = 0 , diff2 = 0 ; for ( int i = l2 - 1 ; i >= 0 ; i -- ) { index1 = ( max_element ( arr1 , i ) ) ; index2 = ( max_element ( arr2 , i ) ) ; diff1 = ( arr2 [ index2 ] - arr1 [ i ] ) ; diff2 = ( arr1 [ index1 ] - arr2 [ i ] ) ; if ( diff1 > 0 diff2 > 0 ) { if ( diff1 > diff2 ) { int tmp = arr1 [ i ] ; arr1 [ i ] = arr2 [ index2 ] ; arr2 [ index2 ] = tmp ; break ; } else if ( diff2 > diff1 ) { int tmp = arr1 [ index1 ] ; arr1 [ index1 ] = arr2 [ i ] ; arr2 [ i ] = tmp ; break ; } else if ( diff1 == diff2 ) { if ( index1 <= index2 ) { int tmp = arr1 [ index1 ] ; arr1 [ index1 ] = arr2 [ i ] ; arr2 [ i ] = tmp ; break ; } else if ( index2 <= index1 ) { int tmp = arr1 [ i ] ; arr1 [ i ] = arr2 [ index2 ] ; arr2 [ index2 ] = tmp ; break ; } } } } } int f_n1 = 0 , f_n2 = 0 ; for ( int i = l1 - 1 ; i >= 0 ; i -- ) { f_n1 = ( f_n1 * 10 ) + arr1 [ i ] ; f_n2 = ( f_n2 * 10 ) + arr2 [ i ] ; } System . out . println ( f_n1 + f_n2 ) ; } public static void main ( String [ ] args ) { int N1 = 9987 ; int N2 = 123 ; findMaxSum ( N1 , N2 ) ; } }

Index/key variables: MAX, i, index, index1, index2
Accumulator variables: i, l1, l2
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean isDivisible ( int n ) { int d ; while ( ( n / 100 ) > 0 ) { d = n % 10 ; n /= 10 ; n = Math . abs ( n - ( d * 14 ) ) ; } return ( n % 47 == 0 ) ; } public static void main ( String [ ] args ) { int N = 59173 ; if ( isDivisible ( N ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Accumulator variables: n
Class/struct names: GFG
Java program:
class GFG { static String even_or_odd ( String N ) { int len = N . length ( ) ; if ( N . charAt ( len - 1 ) == '0' || N . charAt ( len - 1 ) == '2' || N . charAt ( len - 1 ) == '4' || N . charAt ( len - 1 ) == '6' || N . charAt ( len - 1 ) == '8' || N . charAt ( len - 1 ) == ' A ' || N . charAt ( len - 1 ) == ' C ' || N . charAt ( len - 1 ) == ' E ' ) return ( " Even " ) ; else return ( " Odd " ) ; } public static void main ( String [ ] args ) { String N = " AB3454D " ; System . out . print ( even_or_odd ( N ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean isDivisible ( int n ) { int d ; while ( ( n / 100 ) > 0 ) { d = n % 10 ; n /= 10 ; n = Math . abs ( n - ( d * 3 ) ) ; } return ( n % 31 == 0 ) ; } public static void main ( String [ ] args ) { int N = 1922 ; if ( isDivisible ( N ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Accumulator variables: n
Class/struct names: GFG
Java program:
class GFG { static boolean isDivisible ( int n ) { int d ; while ( ( n / 100 ) > 0 ) { d = n % 10 ; n /= 10 ; n = Math . abs ( n + ( d * 13 ) ) ; } return ( n % 43 == 0 ) ; } public static void main ( String [ ] args ) { int N = 2795 ; if ( isDivisible ( N ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Accumulator variables: n
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void print ( int n , int k ) { System . out . print ( k + " ▁ " ) ; for ( int i = 2 ; i <= n ; i ++ ) { int x = ( int ) ( Math . pow ( k , i ) - Math . pow ( k , i - 1 ) ) ; System . out . print ( x + " ▁ " ) ; } } public static void main ( String [ ] args ) { int N = 3 , K = 4 ; print ( N , K ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean isDivisible ( int n ) { int d ; while ( ( n / 100 ) <= 0 ) { d = n % 10 ; n /= 10 ; n = Math . abs ( n - ( d * 7 ) ) ; } return ( n % 71 == 0 ) ; } public static void main ( String args [ ] ) { int N = 5041 ; if ( isDivisible ( N ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Accumulator variables: n
Class/struct names: GFG
Java program:
class GFG { static int countDigit ( int n ) { boolean prime [ ] = new boolean [ 10 ] ; for ( int i = 0 ; i < 10 ; i ++ ) prime [ i ] = false ; prime [ 2 ] = prime [ 3 ] = true ; prime [ 5 ] = prime [ 7 ] = true ; int temp = n , count = 0 ; while ( temp != 0 ) { int d = temp % 10 ; temp /= 10 ; if ( d > 0 && n % d == 0 && prime [ d ] == true ) count ++ ; } return count ; } public static void main ( String [ ] args ) { int n = 1032 ; System . out . println ( countDigit ( n ) ) ; } }

Index/key variables: d, i
Accumulator variables: count, i, temp
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int [ ] digit = new int [ 100000 ] ; static int findDigits ( int n ) { int count = 0 ; while ( n != 0 ) { digit [ count ] = n % 10 ; n = n / 10 ; ++ count ; } return count ; } static int OR_of_Digits ( int n , int count ) { int ans = 0 ; for ( int i = 0 ; i < count ; i ++ ) { ans = ans | digit [ i ] ; } return ans ; } static int AND_of_Digits ( int n , int count ) { int ans = 0 ; for ( int i = 0 ; i < count ; i ++ ) { ans = ans & digit [ i ] ; } return ans ; } static int XOR_of_Digits ( int n , int count ) { int ans = 0 ; for ( int i = 0 ; i < count ; i ++ ) { ans = ans ^ digit [ i ] ; } return ans ; } static void bitwise_operation ( int N ) { int countOfDigit = findDigits ( N ) ; System . out . print ( " XOR ▁ = ▁ " + XOR_of_Digits ( N , countOfDigit ) + "NEW_LINE"); System . out . print ( " OR ▁ = ▁ " + OR_of_Digits ( N , countOfDigit ) + "NEW_LINE"); System . out . print ( " AND ▁ = ▁ " + AND_of_Digits ( N , countOfDigit ) + "NEW_LINE"); } public static void main ( String [ ] args ) { int N = 123456 ; bitwise_operation ( N ) ; } }

Index/key variables: count, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; public class GFG { static int maxLength ( int arr [ ] , int N ) { int product = 1 , len = 0 ; for ( int i = 0 ; i < N ; i ++ ) { product *= arr [ i ] ; } if ( product >= 0 ) { return N ; } for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] < 0 ) { len = Math . max ( len , Math . max ( N - i - 1 , i ) ) ; } } return len ; } public static void main ( String args [ ] ) { int arr [ ] = { - 1 , 1 , 1 , - 2 , 3 , 2 , - 1 } ; int N = arr . length ; System . out . println ( maxLength ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: i, product
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void findRoots ( int b , int c ) { int a = 1 ; int d = b * b - 4 * a * c ; double sqrt_val = Math . sqrt ( Math . abs ( d ) ) ; if ( d > 0 ) { double x = - b + sqrt_val ; double y = - b - sqrt_val ; int root1 = ( int ) ( x ) / ( 2 * a ) ; int root2 = ( int ) ( y ) / ( 2 * a ) ; if ( root1 + root2 == - 1 * b && root1 * root2 == c ) System . out . print ( root1 + " , ▁ " + root2 ) ; else System . out . print ( - 1 ) ; } else if ( d == 0 ) { int root = - b / ( 2 * a ) ; if ( root + root == - 1 * b && root * root == c ) System . out . print ( root + " , ▁ " + root ) ; else System . out . print ( - 1 ) ; } else { System . out . print ( - 1 ) ; } System . out . println ( ) ; } public static void main ( String [ ] args ) { int S = 5 , P = 6 ; findRoots ( - S , P ) ; S = 5 ; P = 9 ; findRoots ( - S , P ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void findNumbers ( int N ) { int i = 1 ; while ( i <= N ) { System . out . print ( ( i * i * i ) + " ▁ " ) ; i ++ ; } } public static void main ( String [ ] args ) { int N = 4 ; findNumbers ( N ) ; } }

Accumulator variables: i
Class/struct names: GFG
Java program:
class GFG { static int properDivisorSum ( int n ) { int sum = 0 ; for ( int i = 1 ; i <= n ; ++ i ) { for ( int j = 1 ; j * j <= i ; ++ j ) { if ( i % j == 0 ) { if ( i / j == j ) sum += j ; else sum += j + i / j ; } } sum = sum - i ; } return sum ; } public static void main ( String [ ] args ) { int n = 4 ; System . out . println ( properDivisorSum ( n ) ) ; n = 5 ; System . out . println ( properDivisorSum ( n ) ) ; } }

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

Accumulator variables: sum
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void findMinimumOperation ( int n , int d , int arrays [ ] [ ] ) { int cnt = 0 ; int first = Integer . MIN_VALUE , end = Integer . MAX_VALUE ; while ( n > 0 ) { int arr [ ] = { arrays [ cnt ] [ 0 ] , arrays [ cnt ] [ 1 ] } ; Arrays . sort ( arr ) ; first = Math . max ( first , arr [ 0 ] ) ; end = Math . min ( end , arr [ 1 ] ) ; cnt ++ ; n -- ; } if ( first > end ) System . out . print ( " - 1" ) ; else { if ( d >= first && d <= end ) { System . out . print ( "0" ) ; } else System . out . print ( Math . min ( Math . abs ( first - d ) , Math . abs ( d - end ) ) ) ; } } public static void main ( String [ ] args ) { int n = 3 , d = 3 ; int arrays [ ] [ ] = { { 0 , 7 } , { 2 , 14 } , { 4 , 6 } } ; findMinimumOperation ( n , d , arrays ) ; } }

Index/key variables: cnt
Accumulator variables: cnt, n
Class/struct names: GFG
Java program:
class GFG { static long mod = 1000000007L ; static long mult ( long a , long b ) { return ( ( a % mod ) * ( b % mod ) ) % mod ; } static long calculate_factors ( long n ) { long ans , cnt ; cnt = 0 ; ans = 1 ; while ( n % 2 == 0 ) { cnt ++ ; n = n / 2 ; } if ( cnt % 2 == 1 ) { ans = mult ( ans , ( cnt + 1 ) ) ; } for ( int i = 3 ; i <= Math . sqrt ( n ) ; i += 2 ) { cnt = 0 ; while ( n % i == 0 ) { cnt ++ ; n = n / i ; } if ( cnt % 2 == 1 ) { ans = mult ( ans , ( cnt + 1 ) ) ; } } if ( n > 2 ) { ans = mult ( ans , ( 2 ) ) ; } return ans % mod ; } public static void main ( String [ ] args ) { long n = 193748576239475639L ; mod = 17 ; System . out . print ( calculate_factors ( n ) + "NEW_LINE"); } }

Accumulator variables: cnt, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void maxValue ( int a ) { String c = Integer . toBinaryString ( a ) ; String b = " " ; for ( int i = 0 ; i < c . length ( ) ; i ++ ) { if ( ( c . charAt ( i ) - '0' ) == 1 ) b += '0' ; else b += '1' ; } System . out . print ( Integer . parseInt ( b , 2 ) ) ; } public static void main ( String [ ] args ) { int a = 4 ; maxValue ( a ) ; } }

Accumulator variables: b, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int sz = ( int ) 1e5 ; static boolean [ ] isPrime = new boolean [ sz + 1 ] ; static void generatePrime ( ) { int i , j ; for ( i = 2 ; i <= sz ; i ++ ) isPrime [ i ] = true ; for ( i = 2 ; i * i <= sz ; i ++ ) { if ( isPrime [ i ] ) { for ( j = i * i ; j < sz ; j += i ) { isPrime [ j ] = false ; } } } } static void Pair_of_PrimeXor ( int A [ ] , int n ) { for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { if ( isPrime [ ( A [ i ] ^ A [ j ] ) ] ) { System . out . print ( " ( " + A [ i ] + " , ▁ " + A [ j ] + " ) ▁ " ) ; } } } } public static void main ( String [ ] args ) { int A [ ] = { 1 , 3 , 6 , 11 } ; int n = A . length ; generatePrime ( ) ; Pair_of_PrimeXor ( A , n ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void getnumbers ( int n ) { Vector < Integer > divisor = new Vector < Integer > ( ) ; for ( int i = 2 ; i * i <= n ; i ++ ) { while ( n % i == 0 ) { divisor . add ( i ) ; n /= i ; } } if ( n != 1 ) { divisor . add ( n ) ; } int a , b , c , size ; a = b = c = 1 ; size = divisor . size ( ) ; for ( int i = 0 ; i < size ; i ++ ) { if ( a == 1 ) { a = a * divisor . get ( i ) ; } else if ( b == 1 b == a ) { b = b * divisor . get ( i ) ; } else { c = c * divisor . get ( i ) ; } } if ( a == 1 b == 1 c == 1 a == b b == c a == c ) { System . out . print ( " - 1" + "NEW_LINE"); } else { System . out . print ( a + " ▁ " + b + " ▁ " + c + "NEW_LINE"); } } public static void main ( String [ ] args ) { int n = 64 ; getnumbers ( n ) ; } }

Accumulator variables: i, n
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static Vector < Integer > primeFactors ( int n ) { int i , j ; Vector < Integer > Prime = new Vector < Integer > ( ) ; if ( n % 2 == 0 ) { Prime . add ( 2 ) ; } while ( n % 2 == 0 ) { n = n / 2 ; } for ( i = 3 ; i <= Math . sqrt ( n ) ; i = i + 2 ) { if ( n % i == 0 ) { Prime . add ( i ) ; } while ( n % i == 0 ) { n = n / i ; } } if ( n > 2 ) { Prime . add ( n ) ; } return Prime ; } static void checkDistinctPrime ( int n ) { Vector < Integer > Prime = primeFactors ( n ) ; int product = 1 ; for ( int i : Prime ) { product *= i ; } if ( product == n ) System . out . print ( " YES " ) ; else System . out . print ( " NO " ) ; } public static void main ( String [ ] args ) { int N = 30 ; checkDistinctPrime ( N ) ; } }

Accumulator variables: product
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static double nthRoot ( int A , int N ) { double xPre = Math . random ( ) * 10 % 10 ; double eps = 1e-3 ; double delX = Integer . MAX_VALUE ; double xK = 0 ; while ( delX > eps ) { xK = ( ( N - 1.0 ) * xPre + ( double ) A / Math . pow ( xPre , N - 1 ) ) / ( double ) N ; delX = Math . abs ( xK - xPre ) ; xPre = xK ; } return xK ; } static int countPowers ( int a , int b , int k ) { return ( int ) ( Math . floor ( nthRoot ( b , k ) ) - Math . ceil ( nthRoot ( a , k ) ) + 1 ) ; } public static void main ( String [ ] args ) { int a = 7 , b = 28 , k = 2 ; System . out . print ( " Count ▁ of ▁ Powers ▁ is ▁ " + countPowers ( a , b , k ) ) ; } }

Class/struct names: GFG