dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
import java . util . * ; class GFG { static int min_value ( int arr [ ] , int N ) { int x , X , K ; HashSet < Integer > S = new HashSet < Integer > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { S . add ( arr [ i ] ) ; } int count = 0 ; for ( int i = 1 ; i <= 1024 ; i ++ ) { count = 0 ; for ( int it : S ) { X = ( ( i it ) - ( i & it ) ) ; if ( S . contains ( X ) ) { count ++ ; } } if ( count == S . size ( ) ) { K = i ; return K ; } } return - 1 ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 0 , 3 , 3 , 0 , 2 } ; int N = arr . length ; System . out . print ( min_value ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i, it
Class/struct names: GFG
Java program:
class GFG { static int sum ( int n ) { int sum = 0 ; while ( n != 0 ) { int r = n % 10 ; sum = sum + r ; n = n / 10 ; } return sum ; } static boolean isJunction ( int n ) { int count = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { if ( i + sum ( i ) == n ) count ++ ; } return count >= 2 ; } public static void main ( String [ ] args ) { int N = 111 ; if ( isJunction ( N ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int digProduct ( int n ) { int product = 1 ; while ( n != 0 ) { product = product * ( n % 10 ) ; n = n / 10 ; } return product ; } 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 nextPrime ( int N ) { if ( N <= 1 ) return 2 ; int prime = N ; boolean found = false ; while ( ! found ) { prime ++ ; if ( isPrime ( prime ) ) found = true ; } return prime ; } static boolean isPointerPrime ( int n ) { if ( isPrime ( n ) && ( n + digProduct ( n ) == nextPrime ( n ) ) ) return true ; else return false ; } public static void main ( String [ ] args ) { int N = 23 ; if ( isPointerPrime ( N ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Accumulator variables: prime
Iterator variables: i
Boolean variables: found
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int power ( int x , int y ) { if ( y == 0 ) { return 1 ; } if ( y % 2 == 0 ) { return ( power ( x , y / 2 ) * power ( x , y / 2 ) ) ; } return ( x * power ( x , y / 2 ) * power ( x , y / 2 ) ) ; } static boolean isPerfectDigitalInvariant ( int x ) { for ( int fixed_power = 1 ; ; fixed_power ++ ) { int temp = x , sum = 0 ; while ( temp > 0 ) { int r = temp % 10 ; sum += power ( r , fixed_power ) ; temp = temp / 10 ; } if ( sum == x ) { return true ; } if ( sum > x ) { return false ; } } } public static void main ( String [ ] args ) { int N = 4150 ; if ( isPerfectDigitalInvariant ( N ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Accumulator variables: fixed_power, sum
Iterator variables: fixed_power
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void SieveOfEratosthenes ( int n , boolean isPrime [ ] ) { isPrime [ 0 ] = isPrime [ 1 ] = false ; for ( int i = 2 ; i <= n ; i ++ ) isPrime [ i ] = true ; for ( int p = 2 ; p * p <= n ; p ++ ) { if ( isPrime [ p ] == true ) { for ( int i = p * 2 ; i <= n ; i += p ) isPrime [ i ] = false ; } } } static int countDigit ( int n ) { int count = 0 ; while ( n != 0 ) { n = n / 10 ; ++ count ; } return count ; } static boolean isBrilliant ( int n ) { int flag = 0 ; boolean isPrime [ ] = new boolean [ n + 1 ] ; SieveOfEratosthenes ( n , isPrime ) ; for ( int i = 2 ; i < n ; i ++ ) { int x = n / i ; if ( isPrime [ i ] && isPrime [ x ] && ( x * i ) == n ) { if ( countDigit ( i ) == countDigit ( x ) ) return true ; } } return false ; } public static void main ( String [ ] args ) { int n = 1711 ; if ( isBrilliant ( n ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Index/key variables: i, p, x
Accumulator variables: i, p
Iterator variables: i, p
Class/struct names: GFG
Java program:
class GFG { static int icosikaienneagonalNum ( int n ) { return ( 27 * n * n - 25 * n ) / 2 ; } public static void main ( String args [ ] ) { int n = 3 ; System . out . print ( icosikaienneagonalNum ( n ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { public static Vector < Integer > largestSumpair ( int [ ] arr , int n ) { Vector < Integer > pair = new Vector < Integer > ( ) ; int max_sum = Integer . MIN_VALUE , i ; for ( i = 1 ; i < n ; i ++ ) { if ( max_sum < ( arr [ i ] + arr [ i - 1 ] ) ) { max_sum = arr [ i ] + arr [ i - 1 ] ; if ( pair . isEmpty ( ) ) { pair . add ( arr [ i - 1 ] ) ; pair . add ( arr [ i ] ) ; } else { pair . set ( 0 , arr [ i - 1 ] ) ; pair . set ( 1 , arr [ i ] ) ; } } } return pair ; } public static void main ( String [ ] args ) { int arr [ ] = { 11 , - 5 , 9 , - 3 , 2 } ; int N = arr . length ; Vector < Integer > pair = new Vector < Integer > ( ) ; pair = largestSumpair ( arr , N ) ; for ( Integer it : pair ) { System . out . print ( it + " ▁ " ) ; } } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i, it
Class/struct names: GFG
Java program:
import java . lang . * ; class GFG { public static int x = 0 , y = 0 , x1 = 0 , y1 = 0 ; public static int x0 = 0 , y0 = 0 , g = 0 ; public static int gcd ( int a , int b ) { if ( b == 0 ) { x = 1 ; y = 0 ; return a ; } int store_gcd = gcd ( b , a % b ) ; x = y1 ; y = x1 - y1 * ( a / b ) ; return store_gcd ; } public static int possible_solution ( int a , int b , int c ) { g = gcd ( Math . abs ( a ) , Math . abs ( b ) ) ; if ( c % g != 0 ) { return 0 ; } x0 *= c / g ; y0 *= c / g ; if ( a < 0 ) x0 *= - 1 ; if ( b < 0 ) y0 *= - 1 ; return 1 ; } public static void shift_solution ( int a , int b , int shift_var ) { x += shift_var * b ; y -= shift_var * a ; } public static int find_min_sum ( int a , int b , int c ) { int x = 0 , y = 0 , g = 0 ; if ( possible_solution ( a , b , c ) == 0 ) return - 1 ; if ( g != 0 ) { a /= g ; b /= g ; } int sign_a = a > 0 ? + 1 : - 1 ; int sign_b = b > 0 ? + 1 : - 1 ; shift_solution ( a , b , - x / b ) ; if ( x < 0 ) shift_solution ( a , b , sign_b ) ; int minx1 = x ; shift_solution ( a , b , y / a ) ; if ( y < 0 ) shift_solution ( a , b , - sign_a ) ; int minx2 = x ; if ( minx2 > x ) { int temp = minx2 ; minx2 = x ; x = temp ; } int minx = Math . max ( minx1 , minx2 ) ; if ( minx > x ) return - 1 ; int miny = ( c - a * x ) / b ; return ( miny + minx ) ; } public static void main ( String [ ] args ) { int a = 2 , b = 2 , c = 0 ; System . out . println ( find_min_sum ( a , b , c ) ) ; } }

Accumulator variables: a, b, x, x0, y, y0
Class/struct names: GFG
Java program:
class GFG { static void findNthTerm ( int n ) { System . out . print ( n * ( 2 * n + 1 ) ) ; } public static void main ( String [ ] args ) { int N = 4 ; findNthTerm ( N ) ; } }

Class/struct names: GFG
Java program:
class GFG { static boolean isApocalyptic ( int n ) { if ( String . valueOf ( ( Math . pow ( 2 , n ) ) ) . contains ( "666" ) ) return true ; return false ; } public static void main ( String [ ] args ) { int N = 157 ; if ( isApocalyptic ( N ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Class/struct names: GFG
Java program:
class GFG { static int gcd ( int a , int b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } static int divSum ( int n ) { int result = 0 ; for ( int i = 2 ; i <= Math . sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { if ( i == ( n / i ) ) result += i ; else result += ( i + n / i ) ; } } return ( result + n + 1 ) ; } static boolean isDuffinian ( int n ) { int sumDivisors = divSum ( n ) ; if ( sumDivisors == n + 1 ) return false ; int hcf = gcd ( n , sumDivisors ) ; return hcf == 1 ; } public static void main ( String [ ] args ) { int n = 36 ; if ( isDuffinian ( n ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }

Accumulator variables: i, result
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int MAX = 1000000 ; static Vector < Integer > primes = new Vector < Integer > ( ) ; static void sieveSundaram ( ) { boolean marked [ ] = new boolean [ MAX / 2 + 1 ] ; for ( int i = 1 ; i <= ( Math . sqrt ( MAX ) - 1 ) / 2 ; i ++ ) for ( int j = ( i * ( i + 1 ) ) << 1 ; j <= MAX / 2 ; 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 int calculateKummer ( int n ) { int result = 1 ; for ( int i = 0 ; i < n ; i ++ ) result = result * primes . get ( i ) ; return - 1 + result ; } public static void main ( String [ ] args ) { int n = 5 ; sieveSundaram ( ) ; for ( int i = 1 ; i <= n ; i ++ ) System . out . print ( calculateKummer ( i ) + " , ▁ " ) ; } }

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 check ( int n ) { HashSet < Integer > digits = new HashSet < Integer > ( ) ; int temp = n ; int sum = 0 ; int count = 0 ; while ( temp > 0 ) { sum += temp % 10 ; digits . add ( temp % 10 ) ; count ++ ; temp = temp / 10 ; } if ( sum % count == 0 && digits . contains ( sum / count ) ) System . out . print ( " Yes " + "NEW_LINE"); else System . out . print ( " No " + "NEW_LINE"); } public static void main ( String [ ] args ) { int n = 42644 ; check ( n ) ; } }

Accumulator variables: count, sum
Class/struct names: GFG
Java program:
class GFG { static void countSmaller ( String str ) { int n = str . length ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int cnt = 0 ; for ( int j = i + 1 ; j < n ; j ++ ) { if ( str . charAt ( j ) < str . charAt ( i ) ) { cnt += 1 ; } } System . out . print ( cnt + " ▁ " ) ; } } public static void main ( String [ ] args ) { String str = " edcba " ; countSmaller ( str ) ; } }

Accumulator variables: cnt, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { public static Vector < Integer > smallestSumpair ( int [ ] arr , int n ) { Vector < Integer > pair = new Vector < Integer > ( ) ; int min_sum = Integer . MAX_VALUE , i ; for ( i = 1 ; i < n ; i ++ ) { if ( min_sum > ( arr [ i ] + arr [ i - 1 ] ) ) { min_sum = arr [ i ] + arr [ i - 1 ] ; if ( pair . isEmpty ( ) ) { pair . add ( arr [ i - 1 ] ) ; pair . add ( arr [ i ] ) ; } else { pair . set ( 0 , arr [ i - 1 ] ) ; pair . set ( 1 , arr [ i ] ) ; } } } return pair ; } public static void main ( String [ ] args ) { int arr [ ] = { 4 , 9 , - 3 , 2 , 0 } ; int N = arr . length ; Vector < Integer > pair = new Vector < Integer > ( ) ; pair = smallestSumpair ( arr , N ) ; System . out . println ( pair . get ( 0 ) + " ▁ " + pair . get ( 1 ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int val ( char c ) { if ( c >= '0' && c <= '9' ) return ( int ) c - '0' ; else return ( int ) c - ' A ' + 10 ; } static int convert ( String num , int bases ) { int len = ( num . length ( ) ) ; int power = 1 ; int res = 0 ; int i ; for ( i = len - 1 ; i >= 0 ; i -- ) { res += val ( num . charAt ( i ) ) * power ; power = power * bases ; } return res ; } static void dec_to_base ( int num , int bases ) { StringBuilder base_num = new StringBuilder ( ) ; while ( num > 0 ) { int dig = ( num % bases ) ; if ( dig < 10 ) base_num . append ( String . valueOf ( dig ) ) ; else base_num . append ( String . valueOf ( ( ' A ' + dig - 10 ) ) ) ; num /= bases ; } for ( int i = base_num . length ( ) - 1 ; i >= 0 ; i -- ) System . out . print ( base_num . charAt ( i ) ) ; } public static void main ( String [ ] args ) { String a = "123" ; String b = "234" ; int base_a = 6 ; int base_b = 8 ; int a10 = convert ( a , base_a ) ; int b10 = convert ( b , base_b ) ; int summ = a10 + b10 ; int min_base = Math . min ( base_a , base_b ) ; dec_to_base ( summ , min_base ) ; } }

Accumulator variables: i, num, res
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int sumOfProductOfDigits ( int n1 , int n2 ) { int sum = 0 ; while ( n1 > 0 && n2 > 0 ) { sum += ( ( n1 % 10 ) * ( n2 % 10 ) ) ; n1 /= 10 ; n2 /= 10 ; } return sum ; } public static void main ( String args [ ] ) { int n1 = 25 ; int n2 = 1548 ; System . out . println ( sumOfProductOfDigits ( n1 , n2 ) ) ; } }

Accumulator variables: n1, n2, sum
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void printPermutation ( int N ) { int temp = N , count = 0 ; while ( temp > 0 ) { count ++ ; temp /= 10 ; } int [ ] num = new int [ count ] ; while ( N > 0 ) { num [ count -- - 1 ] = N % 10 ; N = N / 10 ; } while ( next_permutation ( num ) ) { for ( int i = 0 ; i < num . length ; i ++ ) System . out . print ( num [ i ] ) ; System . out . print ( "NEW_LINE"); } } static boolean next_permutation ( int [ ] p ) { for ( int a = p . length - 2 ; a >= 0 ; -- a ) if ( p [ a ] < p [ a + 1 ] ) for ( int b = p . length - 1 ; ; -- b ) if ( p [ b ] > p [ a ] ) { int t = p [ a ] ; p [ a ] = p [ b ] ; p [ b ] = t ; for ( ++ a , b = p . length - 1 ; a < b ; ++ a , -- b ) { t = p [ a ] ; p [ a ] = p [ b ] ; p [ b ] = t ; } return true ; } return false ; } public static void main ( String [ ] args ) { int N = 324 ; printPermutation ( N ) ; } }

Index/key variables: a, b, count, i
Accumulator variables: count, i, temp
Iterator variables: a, b, i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int n = 500000 - 2 ; static Vector < Integer > v = new Vector < > ( ) ; static void sieveoferanthones ( ) { boolean [ ] prime = new boolean [ n + 1 ] ; Arrays . fill ( prime , true ) ; for ( int i = 2 ; i <= Math . sqrt ( n ) ; i ++ ) { if ( prime [ i ] ) for ( int j = i * i ; j <= n ; j += i ) { prime [ j ] = false ; } } for ( int i = 2 ; i < n ; i ++ ) { if ( prime [ i ] ) v . add ( i ) ; } } static void numberOfWays ( int n ) { int count = 0 ; for ( int j = 1 ; 2 * ( Math . pow ( j , 2 ) ) < n ; j ++ ) { for ( int i = 1 ; v . get ( i ) + 2 <= n ; i ++ ) { if ( n == v . get ( i ) + ( 2 * ( Math . pow ( j , 2 ) ) ) ) count ++ ; } } System . out . print ( count + "NEW_LINE"); } public static void main ( String [ ] args ) { sieveoferanthones ( ) ; int n = 9 ; numberOfWays ( n ) ; } }

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static double Convert ( double degree ) { double pi = 3.14159265359 ; return ( degree * ( pi / 180 ) ) ; } public static void main ( String [ ] args ) { double degree = 30 ; double radian = Convert ( degree ) ; System . out . printf ( " % .6f " , radian ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void bcdToHexaDecimal ( char [ ] s ) { int len = s . length , check = 0 ; int num = 0 , sum = 0 , mul = 1 ; Vector < Character > ans = new Vector < Character > ( ) ; for ( int i = len - 1 ; i >= 0 ; i -- ) { sum += ( s [ i ] - '0' ) * mul ; mul *= 2 ; check ++ ; if ( check == 4 i == 0 ) { if ( sum <= 9 ) ans . add ( ( char ) ( sum + '0' ) ) ; else ans . add ( ( char ) ( sum + 55 ) ) ; check = 0 ; sum = 0 ; mul = 1 ; } } len = ans . size ( ) ; for ( int i = len - 1 ; i >= 0 ; i -- ) System . out . print ( ans . get ( i ) ) ; } public static void main ( String [ ] args ) { String s = "100000101111" ; bcdToHexaDecimal ( s . toCharArray ( ) ) ; } }

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

Accumulator variables: i, summ
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static boolean isMyriagon ( int N ) { double n = ( 9996 + Math . sqrt ( 79984 * N + 99920016 ) ) / 19996 ; return ( n - ( int ) n ) == 0 ; } public static void main ( String [ ] args ) { int N = 10000 ; if ( isMyriagon ( N ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }

Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { public static boolean isheptagonal ( int N ) { double n = ( 3 + Math . sqrt ( 40 * N + 9 ) ) / 10 ; return ( n - ( int ) n ) == 0 ; } public static void main ( String [ ] args ) { int N = 7 ; if ( isheptagonal ( N ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }

Class/struct names: GFG
Java program:
class GFG { static boolean isenneadecagonal ( int N ) { float n = ( float ) ( 15 + Math . sqrt ( 136 * N + 225 ) ) / 34 ; return ( n - ( int ) n ) == 0 ; } public static void main ( String [ ] args ) { int N = 19 ; if ( isenneadecagonal ( N ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }

Class/struct names: GFG
Java program:
class GFG { static boolean isCenteredtridecagonal ( int N ) { float n = ( float ) ( ( 13 + Math . sqrt ( 104 * N + 65 ) ) / 26 ) ; return ( n - ( int ) n ) == 0 ; } public static void main ( String [ ] args ) { int N = 14 ; if ( isCenteredtridecagonal ( N ) ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } }

Class/struct names: GFG
Java program:
class GFG { static int gcd ( int a , int b ) { if ( a == 0 ) return b ; return gcd ( b % a , a ) ; } static void countDistinctWays ( int N , int M ) { int ans = 0 ; for ( int i = 0 ; i < N ; i ++ ) { int K = gcd ( i , N ) ; ans += Math . pow ( M , K ) ; } ans /= N ; System . out . print ( ans ) ; } public static void main ( String [ ] args ) { int N = 4 , M = 3 ; countDistinctWays ( N , M ) ; } }

Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void findNum ( int n , int k ) { int q = k / ( n - 1 ) ; int r = k % ( n - 1 ) ; int a = 0 ; if ( r != 0 ) a = ( n * q ) + r ; else a = ( n * q ) - 1 ; System . out . println ( a ) ; } public static void main ( String [ ] args ) { int A = 4 ; int N = 6 ; findNum ( A , N ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int ans = 0 ; static Vector < Integer > [ ] graph = new Vector [ 100 ] ; static int [ ] weight = new int [ 100 ] ; static boolean isPerfect ( int n ) { int sum = 1 ; for ( int i = 2 ; i * i <= n ; i ++ ) { if ( n % i == 0 ) { if ( i * i != n ) sum = sum + i + n / i ; else sum = sum + i ; } } if ( sum == n && n != 1 ) return true ; return false ; } static void dfs ( int node , int parent ) { if ( isPerfect ( weight [ node ] ) ) ans += 1 ; for ( int to : graph [ node ] ) { if ( to == parent ) continue ; dfs ( to , node ) ; } } public static void main ( String [ ] args ) { for ( int i = 0 ; i < graph . length ; i ++ ) graph [ i ] = new Vector < Integer > ( ) ; weight [ 1 ] = 5 ; weight [ 2 ] = 10 ; weight [ 3 ] = 11 ; weight [ 4 ] = 8 ; weight [ 5 ] = 6 ; graph [ 1 ] . add ( 2 ) ; graph [ 2 ] . add ( 3 ) ; graph [ 2 ] . add ( 4 ) ; graph [ 1 ] . add ( 5 ) ; dfs ( 1 , 1 ) ; System . out . print ( ans ) ; } }

Index/key variables: i, node
Accumulator variables: ans, i
Iterator variables: i, to
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int GetMinCost ( int N ) { PriorityQueue < Integer > pq ; pq = new PriorityQueue < > ( ) ; for ( int i = 1 ; i <= N ; i ++ ) { pq . add ( i ) ; } int cost = 0 ; while ( pq . size ( ) > 1 ) { int mini = pq . remove ( ) ; int secondmini = pq . remove ( ) ; int current = mini * secondmini ; cost += current ; pq . add ( current ) ; } return cost ; } public static void main ( String args [ ] ) { int N = 5 ; System . out . println ( GetMinCost ( N ) ) ; } }

Accumulator variables: cost, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int MOD = ( int ) ( 1e9 + 7 ) ; static int numPrimeArrangements ( int n ) { boolean [ ] prime = new boolean [ n + 1 ] ; Arrays . fill ( prime , true ) ; prime [ 0 ] = false ; prime [ 1 ] = false ; for ( int i = 2 ; i <= Math . sqrt ( n ) ; i ++ ) { if ( prime [ i ] ) for ( int factor = 2 ; factor * i <= n ; factor ++ ) prime [ factor * i ] = false ; } int primeIndices = 0 ; for ( int i = 1 ; i <= n ; i ++ ) if ( prime [ i ] ) primeIndices ++ ; int mod = ( int ) ( 1e9 + 7 ) , res = 1 ; for ( int i = 1 ; i <= primeIndices ; i ++ ) res = ( int ) ( ( 1L * res * i ) % mod ) ; for ( int i = 1 ; i <= ( n - primeIndices ) ; i ++ ) res = ( int ) ( ( 1L * res * i ) % mod ) ; return res ; } public static void main ( String [ ] args ) { int N = 5 ; System . out . print ( numPrimeArrangements ( N ) ) ; } }

Index/key variables: i
Accumulator variables: factor, i, primeIndices
Iterator variables: factor, i
Class/struct names: GFG
Java program:
class GFG { static int fact ( int n ) { int res = 1 ; for ( int i = 2 ; i <= n ; i ++ ) res = res * i ; return res ; } static double count_heads ( int n , int r ) { double output ; output = fact ( n ) / ( fact ( r ) * fact ( n - r ) ) ; output = output / ( Math . pow ( 2 , n ) ) ; return output ; } public static void main ( String [ ] args ) { int n = 4 , r = 3 ; System . out . print ( count_heads ( n , r ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int dfs ( int u , Vector < Integer > [ ] adj , int vis [ ] ) { vis [ u ] = 1 ; int componentSize = 1 ; for ( int it : adj [ u ] ) { if ( vis [ it ] == 0 ) { componentSize += dfs ( it , adj , vis ) ; } } return componentSize ; } static int maximumComponentSize ( int a [ ] , int n ) { @ SuppressWarnings ( " unchecked " ) Vector < Integer > [ ] adj = new Vector [ n ] ; for ( int i = 0 ; i < adj . length ; i ++ ) adj [ i ] = new Vector < Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { if ( __gcd ( a [ i ] , a [ j ] ) > 1 ) adj [ i ] . add ( j ) ; adj [ j ] . add ( i ) ; } } int answer = 0 ; int [ ] vis = new int [ n ] ; for ( int k = 0 ; k < n ; k ++ ) { vis [ k ] = 0 ; } for ( int i = 0 ; i < n ; i ++ ) { if ( vis [ i ] == 0 ) { answer = Math . max ( answer , dfs ( i , adj , vis ) ) ; } } return answer ; } static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } public static void main ( String [ ] args ) { int n = 8 ; int A [ ] = { 2 , 3 , 6 , 7 , 4 , 12 , 21 , 39 } ; System . out . print ( maximumComponentSize ( A , n ) ) ; } }

Index/key variables: i, it, j, k, n, u
Accumulator variables: componentSize, i, j, k
Iterator variables: i, it, j, k
Class/struct names: GFG