dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
import java . io . * ; class GFG { static int contiguousPerfectSquare ( int [ ] arr , int n ) { int a ; float b ; int current_length = 0 ; int max_length = 0 ; for ( int i = 0 ; i < n ; i ++ ) { b = ( float ) Math . sqrt ( arr [ i ] ) ; a = ( int ) b ; if ( a == b ) current_length ++ ; else current_length = 0 ; max_length = Math . max ( max_length , current_length ) ; } return max_length ; } public static void main ( String [ ] args ) { int arr [ ] = { 9 , 75 , 4 , 64 , 121 , 25 } ; int n = arr . length ; System . out . print ( contiguousPerfectSquare ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: current_length, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int countPairs ( int n ) { int count = 0 ; for ( int x = 1 ; x < n ; x ++ ) { for ( int y = x + 1 ; y <= n ; y ++ ) { if ( ( y * x ) % ( y + x ) == 0 ) count ++ ; } } return count ; } public static void main ( String [ ] args ) { int n = 15 ; System . out . println ( countPairs ( n ) ) ; } }

Accumulator variables: count, x, y
Iterator variables: x, y
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int getIndex ( int a [ ] , int n ) { if ( n == 1 ) return 0 ; int ptrL = 0 , ptrR = n - 1 , sumL = a [ 0 ] , sumR = a [ n - 1 ] ; while ( ptrR - ptrL > 1 ) { if ( sumL < sumR ) { ptrL ++ ; sumL += a [ ptrL ] ; } else if ( sumL > sumR ) { ptrR -- ; sumR += a [ ptrR ] ; } else { break ; } } return ptrL ; } public static void main ( String [ ] args ) { int a [ ] = { 2 , 7 , 9 , 8 , 7 } ; int n = a . length ; System . out . println ( getIndex ( a , n ) ) ; } }

Index/key variables: ptrL, ptrR
Accumulator variables: ptrL, ptrR, sumL, sumR
Class/struct names: GFG
Java program:
import java . util . * ; class solution { static int getPosition ( int a [ ] , int n , int m ) { for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = ( a [ i ] / m + ( a [ i ] % m ) ) ; } int ans = - 1 , max = - 1 ; for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( max < a [ i ] ) { max = a [ i ] ; ans = i ; } } return ans + 1 ; } public static void main ( String args [ ] ) { int a [ ] = { 2 , 5 , 4 } ; int n = a . length ; int m = 2 ; System . out . println ( getPosition ( a , n , m ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: solution
Java program:
class GFG { static int calcFunction ( int n , int r ) { int finalDenominator = 1 ; int mx = Math . max ( r , n - r ) ; for ( int i = mx + 1 ; i <= n ; i ++ ) { int denominator = ( int ) Math . pow ( i , i ) ; int numerator = ( int ) Math . pow ( i - mx , i - mx ) ; finalDenominator = ( finalDenominator * denominator ) / numerator ; } return finalDenominator ; } public static void main ( String [ ] args ) { int n = 6 , r = 2 ; System . out . println ( "1 / " + calcFunction ( n , r ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class Solution { static boolean isExists ( int a [ ] , int n ) { Map < Integer , Integer > freq = new HashMap < Integer , Integer > ( ) ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { freq . put ( a [ i ] , freq . get ( a [ i ] ) == null ? 0 : freq . get ( a [ i ] ) + 1 ) ; sum += a [ i ] ; } if ( sum % 2 == 0 ) { if ( freq . get ( sum / 2 ) != null ) return true ; } return false ; } public static void main ( String args [ ] ) { int a [ ] = { 5 , 1 , 2 , 2 } ; int n = a . length ; if ( isExists ( a , n ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: Solution
Java program:
import java . util . * ; class GFG { static Set < Integer > st = new HashSet < Integer > ( ) ; static void generateNumbers ( int n , int num , int a , int b ) { if ( num > 0 && num < n ) st . add ( num ) ; if ( num >= n ) return ; if ( num * 10 + a > num ) generateNumbers ( n , num * 10 + a , a , b ) ; generateNumbers ( n , num * 10 + b , a , b ) ; } static void printNumbers ( int n ) { for ( int i = 0 ; i <= 9 ; i ++ ) for ( int j = i + 1 ; j <= 9 ; j ++ ) generateNumbers ( n , 0 , i , j ) ; System . out . print ( " The ▁ numbers ▁ are : ▁ " ) ; System . out . print ( st ) ; st . clear ( ) ; } public static void main ( String args [ ] ) { int n = 12 ; printNumbers ( n ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static Vector < Integer > findPrime ( int MAX ) { boolean pm [ ] = new boolean [ MAX + 1 ] ; for ( int i = 0 ; i < pm . length ; i ++ ) pm [ i ] = true ; pm [ 0 ] = pm [ 1 ] = false ; for ( int i = 2 ; i <= MAX ; i ++ ) if ( pm [ i ] ) for ( int j = 2 * i ; j <= MAX ; j += i ) pm [ j ] = false ; Vector < Integer > prime = new Vector < Integer > ( ) ; for ( int i = 0 ; i <= MAX ; i ++ ) if ( pm [ i ] ) prime . add ( i ) ; return prime ; } static int max_element ( int arr [ ] ) { int max = arr [ 0 ] ; for ( int i = 0 ; i < arr . length ; i ++ ) max = Math . max ( max , arr [ i ] ) ; return max ; } static int findSmallest ( int arr [ ] , int n ) { int MAX = max_element ( arr ) ; Vector < Integer > prime = findPrime ( MAX ) ; Set < Integer > s = new HashSet < Integer > ( ) ; for ( int i = 0 ; i < arr . length ; i ++ ) s . add ( arr [ i ] ) ; long ans = - 1 ; for ( int i = 0 ; i < prime . size ( ) ; i ++ ) { if ( ! s . contains ( prime . get ( i ) ) ) { ans = ( prime . get ( i ) ) ; break ; } } return ( int ) ans ; } public static void main ( String args [ ] ) { int arr [ ] = { 3 , 0 , 1 , 2 , 7 } ; int n = arr . length ; if ( findSmallest ( arr , n ) == - 1 ) System . out . print ( " No ▁ prime ▁ number ▁ missing " ) ; else System . out . print ( findSmallest ( arr , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
public class GFG { static int findNum ( int div [ ] , int rem [ ] , int N ) { int num = rem [ N - 1 ] ; for ( int i = N - 2 ; i >= 0 ; i -- ) { num = num * div [ i ] + rem [ i ] ; } return num ; } public static void main ( String [ ] args ) { int div [ ] = { 8 , 3 } ; int rem [ ] = { 2 , 2 } ; int N = div . length ; System . out . println ( findNum ( div , rem , N ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
public class GFG { static void profitLoss ( int N , int M ) { if ( N == M ) System . out . print ( " No ▁ Profit ▁ nor ▁ Loss " ) ; else { float result = 0 ; result = ( float ) ( Math . abs ( N - M ) ) / M ; if ( N - M < 0 ) System . out . print ( " Loss ▁ = ▁ - " + result * 100 + " % " ) ; else System . out . print ( " Profit ▁ = ▁ " + result * 100 + " % " ) ; } } public static void main ( String [ ] args ) { int N = 8 , M = 9 ; profitLoss ( N , M ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static String convert_to_words ( char [ ] num ) { int len = num . length ; if ( len == 0 len > 4 ) { return " " ; } String single_digits_temp [ ] = { " " , " one " , " two " , " three " , " four " , " five " , " six " , " seven " , " eight " , " nine " } ; String single_digits [ ] = { " " , " first " , " second " , " third " , " fourth " , " fifth " , " sixth " , " seventh " , " eighth " , " ninth " } ; String two_digits [ ] = { " " , " tenth " , " eleventh " , " twelfth " , " thirteenth " , " fourteenth " , " fifteenth " , " sixteenth " , " seventeenth " , " eighteenth " , " nineteenth " } ; String tens_multiple [ ] = { " " , " tenth " , " twentieth " , " thirtieth " , " fortieth " , " fiftieth " , " sixtieth " , " seventieth " , " eightieth " , " ninetieth " } ; String tens_power [ ] = { " hundred " , " thousand " } ; String word = " " ; if ( len == 1 ) { word += single_digits [ num [ 0 ] - '0' ] ; return word ; } int i = 0 , ctr = 0 ; String s = " ▁ " ; while ( i < len ) { if ( len >= 3 ) { if ( num [ i ] != '0' ) { word += single_digits_temp [ num [ i ] - '0' ] + " ▁ " ; word += tens_power [ len - 3 ] + " ▁ " ; ctr ++ ; } len -- ; num = Arrays . copyOfRange ( num , 1 , num . length ) ; } else { if ( ctr != 0 ) { s = " ▁ and ▁ " ; word = word . substring ( 0 , word . length ( ) - 1 ) ; } if ( num [ i + 1 ] == '0' ) if ( num [ i ] == '0' ) word = word + " th " ; else word += s + tens_multiple [ num [ i ] - '0' ] ; else if ( num [ i ] == '1' ) word += s + two_digits [ num [ i + 1 ] - '0' + 1 ] ; else { if ( num [ i ] != '0' ) word += s + tens_multiple [ num [ i ] - '0' ] . substring ( 0 , tens_multiple [ num [ i ] - '0' ] . length ( ) - 4 ) + " y ▁ " ; else word += s ; word += single_digits [ num [ i + 1 ] - '0' ] ; } i += 2 ; } if ( i == len ) { if ( word . charAt ( 0 ) == ' ▁ ' ) word = word . substring ( 1 , word . length ( ) ) ; } } return word ; } static void Aronsons_sequence ( int n ) { String str = " T ▁ is ▁ the ▁ " ; int ind = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { if ( Character . isAlphabetic ( str . charAt ( i ) ) ) { ind += 1 ; } if ( str . charAt ( i ) == ' t ' || str . charAt ( i ) == ' T ' ) { n -= 1 ; str += convert_to_words ( String . valueOf ( ind ) . toCharArray ( ) ) + " , ▁ " ; System . out . print ( ind + " , ▁ " ) ; } if ( n == 0 ) break ; } } public static void main ( String [ ] args ) { int n = 6 ; Aronsons_sequence ( n ) ; } }

Index/key variables: i
Accumulator variables: ctr, i, ind, len, n, str, word
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class Solution { static void niceIndices ( int A [ ] , int n ) { int sum = 0 ; Map < Integer , Integer > m = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < n ; ++ i ) { m . put ( A [ i ] , ( m . get ( A [ i ] ) == null ) ? 0 : m . get ( A [ i ] ) + 1 ) ; sum += A [ i ] ; } for ( int i = 0 ; i < n ; ++ i ) { int k = sum - A [ i ] ; if ( k % 2 == 0 ) { k = k >> 1 ; if ( m . containsKey ( k ) ) { if ( ( A [ i ] == k && m . get ( k ) > 1 ) || ( A [ i ] != k ) ) System . out . print ( ( i + 1 ) + " ▁ " ) ; } } } } public static void main ( String args [ ] ) { int A [ ] = { 8 , 3 , 5 , 2 } ; int n = A . length ; niceIndices ( A , n ) ; } }

Index/key variables: i
Accumulator variables: sum
Iterator variables: i
Class/struct names: Solution
Java program:
import java . util . * ; class solution { static int countPieces ( int N ) { return 2 * N ; } public static void main ( String args [ ] ) { int N = 100 ; System . out . println ( countPieces ( N ) ) ; } }

Class/struct names: solution
Java program:
import java . util . * ; class solution { static long sumAP ( long n , long d ) { n /= d ; return ( n ) * ( 1 + n ) * d / 2 ; } static long sumMultiples ( long n ) { n -- ; return sumAP ( n , 3 ) + sumAP ( n , 7 ) - sumAP ( n , 21 ) ; } public static void main ( String args [ ] ) { long n = 24 ; System . out . println ( sumMultiples ( n ) ) ; } }

Accumulator variables: n
Class/struct names: solution
Java program:
class GFG { static boolean productSumDivisible ( int n , int size ) { int sum = 0 , product = 1 ; while ( n > 0 ) { if ( size % 2 == 0 ) { product *= n % 10 ; } else { sum += n % 10 ; } n = n / 10 ; size -- ; } if ( product % sum == 0 ) { return true ; } return false ; } public static void main ( String [ ] args ) { int n = 1234 ; int len = 4 ; if ( productSumDivisible ( n , len ) ) { System . out . println ( " TRUE " ) ; } else { System . out . println ( " FALSE " ) ; } } }

Accumulator variables: product, size, sum
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static boolean productSumDivisible ( int n ) { int sum = 0 ; int product = 1 ; String num = String . valueOf ( n ) ; for ( int i = 0 ; i < num . length ( ) ; i ++ ) { if ( i % 2 != 0 ) { product = product * Character . getNumericValue ( num . charAt ( i ) ) ; } else { sum = sum + Character . getNumericValue ( num . charAt ( i ) ) ; } } if ( product % sum == 0 ) { return true ; } else { return false ; } } public static void main ( String [ ] args ) { int n = 1234 ; if ( productSumDivisible ( n ) ) { System . out . println ( " TRUE " ) ; } else { System . out . println ( " FALSE " ) ; } } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static long gcd ( long a , long b ) { if ( a == 0 ) return b ; return gcd ( b % a , a ) ; } static long powGCD ( long a , long n , long b ) { for ( int i = 0 ; i < n ; i ++ ) a = a * a ; return gcd ( a , b ) ; } public static void main ( String [ ] args ) { long a = 10 , b = 5 , n = 2 ; System . out . println ( powGCD ( a , n , b ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class solution { static int lastCoordinate ( int n , int a , int b ) { return ( ( n + 1 ) / 2 ) * a - ( n / 2 ) * b ; } public static void main ( String args [ ] ) { int n = 3 , a = 5 , b = 2 ; System . out . println ( lastCoordinate ( n , a , b ) ) ; } }

Class/struct names: solution
Java program:
public class GFG { static int findNum ( int N , int K ) { int rem = ( N + K ) % K ; if ( rem == 0 ) return N ; else return N + K - rem ; } public static void main ( String [ ] args ) { int N = 45 , K = 6 ; System . out . println ( " Smallest ▁ number ▁ greater ▁ than ▁ or ▁ equal ▁ to ▁ " + N + " that is divisible by " ▁ + ▁ K ▁ + ▁ " is " + findNum(N, K)); } }

Class/struct names: GFG
Java program:
import java . lang . * ; import java . util . * ; class GFG { static void countDigit ( int n ) { int temp = n , sum = 0 , product = 1 ; while ( temp != 0 ) { int d = temp % 10 ; temp /= 10 ; if ( d > 0 && n % d == 0 ) { sum += d ; product *= d ; } } System . out . print ( " Sum ▁ = ▁ " + sum ) ; System . out . print ( " Product = " + product); } public static void main ( String args [ ] ) { int n = 1012 ; countDigit ( n ) ; } }

Accumulator variables: product, sum, temp
Class/struct names: GFG
Java program:
import java . lang . * ; import java . util . * ; class GFG { static int findNum ( int N , int K ) { int rem = N % K ; if ( rem == 0 ) return N ; else return N - rem ; } public static void main ( String args [ ] ) { int N = 45 , K = 6 ; System . out . print ( " Largest ▁ number ▁ smaller ▁ " + " than ▁ or ▁ equal ▁ to ▁ " + N + " that is divisible by " + K + " ▁ is ▁ " + findNum ( N , K ) ) ; } }

Class/struct names: GFG
Java program:
public class GFG { static boolean isDivisiblePalindrome ( int n ) { int hash [ ] = new int [ 10 ] ; int digitSum = 0 ; while ( n != 0 ) { digitSum += n % 10 ; hash [ n % 10 ] ++ ; n /= 10 ; } if ( digitSum % 3 != 0 ) return false ; int oddCount = 0 ; for ( int i = 0 ; i < 10 ; i ++ ) { if ( hash [ i ] % 2 != 0 ) oddCount ++ ; } if ( oddCount > 1 ) return false ; else return true ; } public static void main ( String [ ] args ) { int n = 34734 ; System . out . print ( isDivisiblePalindrome ( n ) ) ; } }

Index/key variables: i
Accumulator variables: digitSum, i, n, oddCount
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int lcm ( int a , int b ) { return ( a * b ) / ( __gcd ( a , b ) ) ; } static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } static int dfs ( int src , Vector < Integer > adj [ ] , boolean [ ] visited ) { visited [ src ] = true ; int count = 1 ; for ( int i = 0 ; i < adj [ src ] . size ( ) ; i ++ ) if ( ! visited [ adj [ src ] . get ( i ) ] ) count += dfs ( adj [ src ] . get ( i ) , adj , visited ) ; return count ; } static int findMinTime ( int arr [ ] , int P [ ] , int n ) { Vector < Integer > [ ] adj = new Vector [ n + 1 ] ; for ( int i = 0 ; i < n + 1 ; i ++ ) adj [ i ] = new Vector < Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { adj [ arr [ i ] ] . add ( P [ i ] ) ; } boolean [ ] visited = new boolean [ n + 1 ] ; int ans = 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( ! visited [ i ] ) { ans = lcm ( ans , dfs ( i , adj , visited ) ) ; } } return ans ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 , 3 } ; int P [ ] = { 3 , 2 , 1 } ; int n = arr . length ; System . out . print ( findMinTime ( arr , P , n ) ) ; } }

Index/key variables: i, src
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static boolean productDivisible ( int n , int k ) { int product = 1 , position = 1 ; while ( n > 0 ) { if ( position % 2 == 0 ) { product *= n % 10 ; } n = n / 10 ; position ++ ; } if ( product % k == 0 ) { return true ; } return false ; } public static void main ( String [ ] args ) { int n = 321922 ; int k = 3 ; if ( productDivisible ( n , k ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } }

Accumulator variables: position, product
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 npr ( int n , int r ) { int pnr = factorial ( n ) / factorial ( n - r ) ; return pnr ; } static int countPermutations ( int n , int r , int k ) { return factorial ( k ) * ( r - k + 1 ) * npr ( n - k , r - k ) ; } public static void main ( String [ ] args ) { int n = 8 ; int r = 5 ; int k = 2 ; System . out . println ( countPermutations ( n , r , k ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int GIF ( double n ) { return ( int ) Math . floor ( n ) ; } public static void main ( String [ ] args ) { double n = 2.3 ; System . out . println ( GIF ( n ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; 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 ) ) ; } public static void main ( String [ ] args ) { int m = 3 , n = 4 , k = 5 ; int totalTriangles = ncr ( m + n + k , 3 ) - ncr ( m , 3 ) - ncr ( n , 3 ) - ncr ( k , 3 ) ; System . out . println ( totalTriangles ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class solution { static boolean SumDivisible ( int n , int k ) { int sum = 0 , position = 1 ; while ( n > 0 ) { if ( position % 2 == 1 ) sum += n % 10 ; n = n / 10 ; position ++ ; } if ( sum % k == 0 ) return true ; return false ; } public static void main ( String arr [ ] ) { int n = 592452 ; int k = 3 ; if ( SumDivisible ( n , k ) ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } }

Accumulator variables: position, sum
Class/struct names: solution
Java program:
import java . io . * ; class GFG { static boolean sumDivisible ( int n , int k ) { int sum = 0 ; String num = Integer . toString ( n ) ; int i ; for ( i = 0 ; i < num . length ( ) ; i ++ ) { if ( i % 2 != 0 ) { sum = sum + ( num . charAt ( i ) - '0' ) ; } } if ( sum % k == 0 ) { return true ; } else { return false ; } } public static void main ( String [ ] args ) { int n = 592452 ; int k = 3 ; if ( sumDivisible ( n , k ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static String isTriangleExists ( int a , int b , int c ) { if ( a != 0 && b != 0 && c != 0 && ( a + b + c ) == 180 ) if ( ( a + b ) >= c || ( b + c ) >= a || ( a + c ) >= b ) return " YES " ; else return " NO " ; else return " NO " ; } public static void main ( String [ ] args ) { int a = 50 , b = 60 , c = 70 ; System . out . println ( isTriangleExists ( a , b , c ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; public class GfG { private static int findX ( int n , int k ) { int r = n , v , u ; int m = ( int ) Math . sqrt ( k ) + 1 ; for ( int i = 2 ; i <= m && k > 1 ; i ++ ) { if ( i == m ) { i = k ; } for ( u = v = 0 ; k % i == 0 ; v ++ ) { k /= i ; } if ( v > 0 ) { int t = n ; while ( t > 0 ) { t /= i ; u += t ; } r = Math . min ( r , u / v ) ; } } return r ; } public static void main ( String args [ ] ) { int n = 5 ; int k = 2 ; System . out . println ( findX ( n , k ) ) ; } }

Accumulator variables: i, k, t, u, v
Iterator variables: i, u
Class/struct names: GfG
Java program:
import java . io . * ; class GFG { static int fact ( int n ) { int fact = 1 ; for ( int i = 2 ; i <= n ; i ++ ) fact *= i ; return fact ; } static int ncr ( int n , int r ) { int ncr = fact ( n ) / ( fact ( r ) * fact ( n - r ) ) ; return ncr ; } static int ways ( int m , int w , int n , int k ) { int ans = 0 ; while ( m >= k ) { ans += ncr ( m , k ) * ncr ( w , n - k ) ; k += 1 ; } return ans ; } public static void main ( String [ ] args ) { int m , w , n , k ; m = 7 ; w = 6 ; n = 5 ; k = 3 ; System . out . println ( ways ( m , w , n , k ) ) ; } }

Accumulator variables: ans, fact, i, k
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int MAX = 1000000 ; static boolean [ ] prime = new boolean [ MAX + 1 ] ; static void SieveOfEratosthenes ( ) { prime [ 1 ] = true ; prime [ 0 ] = true ; for ( int p = 2 ; p * p <= MAX ; p ++ ) { if ( prime [ p ] == false ) { for ( int i = p * 2 ; i <= MAX ; i += p ) prime [ i ] = true ; } } } static void productOfKthPrimes ( int arr [ ] , int n , int k ) { int c = 0 ; int product = 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( ! prime [ arr [ i ] ] ) { c ++ ; if ( c % k == 0 ) { product *= arr [ i ] ; c = 0 ; } } } System . out . println ( product ) ; } public static void main ( String [ ] args ) { SieveOfEratosthenes ( ) ; int n = 5 , k = 2 ; int [ ] arr = new int [ ] { 2 , 3 , 5 , 7 , 11 } ; productOfKthPrimes ( arr , n , k ) ; } }

Index/key variables: i, p
Accumulator variables: c, i, p, product
Iterator variables: i, p
Class/struct names: GFG
Java program:
class gfg { static int square ( int n ) { return n * n ; } static int sum ( int n ) { if ( n == 0 ) return 0 ; if ( n % 2 == 1 ) { return square ( ( n + 1 ) / 2 ) + sum ( n / 2 ) ; } else { return square ( n / 2 ) + sum ( n / 2 ) ; } } static int oddDivSum ( int a , int b ) { return sum ( b ) - sum ( a - 1 ) ; } public static void main ( String [ ] args ) { int a = 3 , b = 9 ; System . out . println ( oddDivSum ( a , b ) ) ; } }

Class/struct names: gfg
Java program:
import java . io . * ; class GFG { static int countBits ( int n ) { int count = 0 ; while ( n > 0 ) { count ++ ; n >>= 1 ; } return count ; } public static void main ( String [ ] args ) { int n = 32 ; System . out . println ( " Minimum ▁ value ▁ of ▁ K ▁ is ▁ = ▁ " + countBits ( n ) ) ; } }

Accumulator variables: count
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int OddDivCount ( int a , int b ) { int res = 0 ; for ( int i = a ; i <= b ; ++ i ) { int divCount = 0 ; for ( int j = 1 ; j <= i ; ++ j ) { if ( i % j == 0 ) { ++ divCount ; } } if ( ( divCount % 2 ) != 0 ) { ++ res ; } } return res ; } public static void main ( String [ ] args ) { int a = 1 , b = 10 ; System . out . println ( OddDivCount ( a , b ) ) ; } }

Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static int largestSquareFactor ( int num ) { int answer = 1 ; for ( int i = 2 ; i < Math . sqrt ( num ) ; ++ i ) { int cnt = 0 ; int j = i ; while ( num % j == 0 ) { cnt ++ ; j *= i ; } if ( ( cnt & 1 ) != 0 ) { cnt -- ; answer *= Math . pow ( i , cnt ) ; } else { answer *= Math . pow ( i , cnt ) ; } } return answer ; } public static void main ( String args [ ] ) { int N = 420 ; System . out . println ( largestSquareFactor ( N ) ) ; } }

Accumulator variables: answer, cnt, j
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int Nth_Term ( int n ) { return ( int ) ( 3 * Math . pow ( n , 2 ) - n + 2 ) / ( 2 ) ; } public static void main ( String [ ] args ) { int N = 5 ; System . out . println ( Nth_Term ( N ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static void countPermutations ( int N , int B ) { int x = ( int ) Math . pow ( B , N ) ; int y = ( int ) Math . pow ( B , N - 1 ) ; System . out . println ( x - y ) ; } public static void main ( String [ ] args ) { int N = 6 ; int B = 4 ; countPermutations ( N , B ) ; } }

Class/struct names: GFG