dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
import java . io . * ; class GFG { static int calcSum ( int k , int n ) { int value = ( k * n * ( n + 1 ) ) / 2 ; return value ; } static int findSum ( int [ ] a , int n , int L , int R ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( L % a [ i ] == 0 && L != 0 ) { sum += calcSum ( a [ i ] , R / a [ i ] ) - calcSum ( a [ i ] , ( L - 1 ) / a [ i ] ) ; } else { sum += calcSum ( a [ i ] , R / a [ i ] ) - calcSum ( a [ i ] , L / a [ i ] ) ; } } return sum ; } public static void main ( String [ ] args ) { int arr [ ] = { 2 , 7 , 3 , 8 } ; int N = arr . length ; int L = 7 ; int R = 20 ; System . out . println ( findSum ( arr , N , L , R ) ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int maxN = 1000000 ; static int [ ] arr = new int [ 1000001 ] ; static int [ ] prefix = new int [ 1000001 ] ; static void findPrimes ( ) { for ( int i = 1 ; i <= maxN ; i ++ ) arr [ i ] = 1 ; arr [ 0 ] = 0 ; arr [ 1 ] = 0 ; for ( int i = 2 ; i * i <= maxN ; i ++ ) { if ( arr [ i ] == 1 ) { for ( int j = i * i ; j <= maxN ; j += i ) { arr [ j ] = 0 ; } } } int sum = 0 ; prefix [ 0 ] = 0 ; for ( int i = 1 ; i <= maxN ; i ++ ) { if ( arr [ i ] == 1 ) { int temp = i ; sum = 0 ; while ( temp > 0 ) { int x = temp % 10 ; sum += x ; temp = temp / 10 ; if ( arr [ sum ] == 1 ) { prefix [ i ] = 1 ; } else { prefix [ i ] = 0 ; } } } } for ( int i = 1 ; i <= maxN ; i ++ ) { prefix [ i ] += prefix [ i - 1 ] ; } } static void countNumbersInRange ( int l , int r ) { findPrimes ( ) ; int result = prefix [ r ] - prefix [ l - 1 ] ; System . out . print ( result + "NEW_LINE"); } public static void main ( String [ ] args ) { int l , r ; l = 5 ; r = 20 ; countNumbersInRange ( l , r ) ; } }

Index/key variables: i, j, r, sum
Accumulator variables: i, j, sum
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static double get_concentration ( double mass , double volume ) { if ( volume == 0 ) return - 1 ; else return ( mass / volume ) * 1000 ; } public static void main ( String [ ] args ) { double mass , volume ; mass = 100.00 ; volume = 500.00 ; System . out . println ( get_concentration ( mass , volume ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean isSubsetSum ( Vector < Integer > set , int n , int sum ) { boolean [ ] [ ] subset = new boolean [ n + 1 ] [ sum + 1 ] ; for ( int i = 0 ; i <= n ; i ++ ) subset [ i ] [ 0 ] = true ; for ( int i = 1 ; i <= sum ; i ++ ) subset [ 0 ] [ i ] = false ; for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = 1 ; j <= sum ; j ++ ) { if ( j < set . get ( i - 1 ) ) subset [ i ] [ j ] = subset [ i - 1 ] [ j ] ; if ( j >= set . get ( i - 1 ) ) subset [ i ] [ j ] = subset [ i - 1 ] [ j ] || subset [ i - 1 ] [ j - set . get ( i - 1 ) ] ; } } return subset [ n ] [ sum ] ; } static void storeDivisors ( int n , Vector < Integer > div ) { for ( int i = 1 ; i <= Math . sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { if ( i == ( n / i ) ) div . add ( i ) ; else { div . add ( i ) ; div . add ( n / i ) ; } } } } static boolean isPractical ( int N ) { Vector < Integer > div = new Vector < Integer > ( ) ; storeDivisors ( N , div ) ; for ( int i = 1 ; i < N ; i ++ ) { if ( ! isSubsetSum ( div , div . size ( ) , i ) ) return false ; } return true ; } public static void main ( String [ ] args ) { int N = 18 ; if ( isPractical ( N ) == true ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Index/key variables: i, j, n, sum
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean isDivBySubsetSums ( Vector < Integer > arr , int num ) { int n = arr . size ( ) ; long total = 1 << n ; for ( long i = 0 ; i < total ; i ++ ) { long sum = 0 ; for ( int j = 0 ; j < n ; j ++ ) if ( ( i & ( 1 << j ) ) > 0 ) sum += arr . get ( j ) ; if ( sum != 0 && num % sum != 0 ) return false ; } return true ; } static boolean isSuperNivenNum ( int n ) { int temp = n ; Vector < Integer > digits = new Vector < Integer > ( ) ; while ( n != 0 ) { int digit = n % 10 ; digits . add ( digit ) ; n = n / 10 ; } return isDivBySubsetSums ( digits , temp ) ; } public static void main ( String [ ] args ) { int n = 500 ; if ( isSuperNivenNum ( n ) ) System . out . print ( " yes " ) ; else System . out . print ( " No " ) ; } }

Accumulator variables: i, j, sum
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int divCount ( int n ) { boolean [ ] hash = new boolean [ n + 1 ] ; Arrays . fill ( hash , true ) ; for ( int p = 2 ; p * p < n ; p ++ ) if ( hash [ p ] == true ) for ( int i = p * 2 ; i < n ; i += p ) hash [ i ] = false ; int total = 1 ; for ( int p = 2 ; p <= n ; p ++ ) { if ( hash [ p ] ) { int count = 0 ; if ( n % p == 0 ) { while ( n % p == 0 ) { n = n / p ; count ++ ; } total = total * ( count + 1 ) ; } } } return total ; } static boolean isHighlyCompositeNumber ( int N ) { int NdivCount = divCount ( N ) ; for ( int i = 1 ; i < N ; i ++ ) { int idivCount = divCount ( i ) ; if ( idivCount >= NdivCount ) return false ; } return true ; } public static void main ( String [ ] args ) { int N = 12 ; if ( isHighlyCompositeNumber ( N ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Index/key variables: i, p
Accumulator variables: count, i, p
Iterator variables: i, p
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int PentacontahenagonNum ( int N ) { return ( 49 * N * N - 47 * N ) / 2 ; } public static void main ( String [ ] args ) { int N = 3 ; System . out . print ( "3rd ▁ Pentacontahenagon ▁ Number ▁ is ▁ " + PentacontahenagonNum ( N ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static boolean isSaintExuperyNum ( int n ) { for ( int i = 1 ; i <= n / 3 ; i ++ ) { for ( int j = i + 1 ; j <= n / 2 ; j ++ ) { int k = n / i / j ; if ( i * i + j * j == k * k ) { if ( i * j * k == n ) return true ; } } } return false ; } public static void main ( String [ ] args ) { int N = 60 ; if ( isSaintExuperyNum ( N ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static boolean isRepdigit ( int num , int b ) { int prev = - 1 ; while ( num != 0 ) { int digit = num % b ; num /= b ; if ( prev != - 1 && digit != prev ) return false ; prev = digit ; } return true ; } public static void main ( String args [ ] ) { int num = 2000 , base1 = 7 ; if ( isRepdigit ( num , base1 ) ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } }

Accumulator variables: num
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean isComposite ( int n ) { if ( n <= 3 ) return false ; if ( n % 2 == 0 n % 3 == 0 ) return true ; for ( int i = 5 ; i * i <= n ; i = i + 6 ) if ( n % i == 0 || n % ( i + 2 ) == 0 ) return true ; return false ; } static String concatenatePrimeFactors ( int n ) { String concatenate = " " ; if ( n % 2 == 0 ) { concatenate += "2" ; while ( n % 2 == 0 ) n = n / 2 ; } for ( int i = 3 ; i <= Math . sqrt ( n ) ; i = i + 2 ) { if ( n % i == 0 ) { concatenate += i ; while ( n % i == 0 ) n = n / i ; } } if ( n > 2 ) concatenate += n ; return concatenate ; } static boolean isEnlightened ( int N ) { if ( ! isComposite ( N ) ) return false ; String num = String . valueOf ( N ) ; String prefixConc = concatenatePrimeFactors ( N ) ; return num . startsWith ( prefixConc ) ; } public static void main ( String args [ ] ) { int n = 250 ; if ( isEnlightened ( n ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Accumulator variables: concatenate
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void findNthTerm ( int n ) { System . out . print ( n * ( 3 * n + 1 ) / 2 + "NEW_LINE"); } public static void main ( String [ ] args ) { int N = 4 ; findNthTerm ( N ) ; } }

Class/struct names: GFG
Java program:
import java . lang . * ; class GFG { static boolean isIdoneal ( int n ) { for ( int a = 1 ; a <= n ; a ++ ) { for ( int b = a + 1 ; b <= n ; b ++ ) { for ( int c = b + 1 ; c <= n ; c ++ ) { if ( a * b + b * c + c * a == n ) return false ; } } } return true ; } public static void main ( String [ ] args ) { int N = 10 ; if ( isIdoneal ( N ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Accumulator variables: a, b, c
Iterator variables: a, b, c
Class/struct names: GFG
Java program:
class GFG { static boolean checkDivisibility ( int n , int digit ) { return ( digit != 0 && n % digit == 0 ) ; } static boolean isAllDigitsDivide ( int n ) { int temp = n ; while ( temp > 0 ) { int digit = temp % 10 ; if ( ! ( checkDivisibility ( n , digit ) ) ) return false ; temp /= 10 ; } return true ; } static boolean isAllDigitsDistinct ( int n ) { boolean arr [ ] = new boolean [ 10 ] ; while ( n > 0 ) { int digit = n % 10 ; if ( arr [ digit ] ) return false ; arr [ digit ] = true ; n = n / 10 ; } return true ; } static boolean isLynchBell ( int n ) { return isAllDigitsDivide ( n ) && isAllDigitsDistinct ( n ) ; } public static void main ( String [ ] args ) { int N = 12 ; if ( isLynchBell ( N ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Index/key variables: digit
Accumulator variables: temp
Class/struct names: GFG
Java program:
class GFG { static boolean isRepunitNum ( int n , int b ) { int length = 0 ; int countOne = 0 ; while ( n != 0 ) { int r = n % b ; length ++ ; if ( r == 1 ) countOne ++ ; n = n / b ; } return countOne >= 3 && countOne == length ; } public static void main ( String [ ] args ) { int n = 31 ; int base = 2 ; if ( isRepunitNum ( n , base ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Accumulator variables: countOne, length
Class/struct names: GFG
Java program:
class GFG { static int firstDigit ( int n ) { int digits = ( int ) ( Math . log ( n ) / Math . log ( 10 ) ) ; n = ( int ) ( n / Math . pow ( 10 , digits ) ) ; return n ; } static int lastDigit ( int n ) { return ( n % 10 ) ; } static boolean isGapful ( int n ) { int first_dig = firstDigit ( n ) ; int last_dig = lastDigit ( n ) ; int concatenation = first_dig * 10 + last_dig ; return ( n % concatenation == 0 ) ; } public static void main ( String [ ] args ) { int n = 108 ; if ( isGapful ( n ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int MAX = 10000 ; 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 = j + 2 * i + 1 ) marked [ j ] = true ; primes . add ( 2 ) ; for ( int i = 1 ; i <= MAX / 2 ; i ++ ) if ( marked [ i ] == false ) primes . add ( 2 * i + 1 ) ; } static boolean isEconomical ( int n ) { if ( n == 1 ) return false ; int original_no = n ; int sumDigits = 0 ; while ( original_no > 0 ) { sumDigits ++ ; original_no = original_no / 10 ; } int pDigit = 0 , count_exp = 0 , p = 0 ; for ( int i = 0 ; primes . get ( i ) <= n / 2 ; i ++ ) { while ( n % primes . get ( i ) == 0 ) { p = primes . get ( i ) ; n = n / p ; count_exp ++ ; } while ( p > 0 ) { pDigit ++ ; p = p / 10 ; } while ( count_exp > 1 ) { pDigit ++ ; count_exp = count_exp / 10 ; } } if ( n != 1 ) { while ( n > 0 ) { pDigit ++ ; n = n / 10 ; } } return ( pDigit < sumDigits ) ; } public static void main ( String [ ] args ) { sieveSundaram ( ) ; for ( int i = 1 ; i < 200 ; i ++ ) if ( isEconomical ( i ) ) System . out . print ( i + " ▁ " ) ; } }

Index/key variables: i, j
Accumulator variables: count_exp, i, pDigit, sumDigits
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static boolean isPossible ( int A , int B , int N , int K , int L ) { int needa , needb ; if ( A % K == 0 ) needa = A / K ; else needa = A / K + 1 ; if ( B % L == 0 ) needb = B / L ; else needb = B / L + 1 ; int total = needa + needb ; if ( total > N ) return false ; else return true ; } public static void main ( String [ ] args ) { int A = 3 , B = 3 , N = 3 ; int K = 4 , M = 2 ; if ( isPossible ( A , B , N , K , M ) ) System . out . print ( " YES " + "NEW_LINE"); else System . out . print ( " NO " + "NEW_LINE"); } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static final int MAX = 1000050 ; static int [ ] spf = new int [ MAX + 1 ] ; static void calculate_SPF ( ) { for ( int i = 0 ; i <= MAX ; i ++ ) spf [ i ] = i ; for ( int i = 4 ; i <= MAX ; i += 2 ) spf [ i ] = 2 ; for ( int i = 3 ; i * i <= MAX ; i ++ ) { if ( spf [ i ] == i ) { for ( int j = i * i ; j <= MAX ; j += i ) if ( spf [ j ] == j ) spf [ j ] = i ; } } } static int [ ] tfactor = new int [ MAX + 1 ] ; static int [ ] pre = new int [ MAX + 1 ] ; static void CountTotalfactors ( ) { tfactor [ 1 ] = pre [ 1 ] = 1 ; for ( int i = 2 ; i <= MAX ; i ++ ) { int mspf = spf [ i ] ; int prim = mspf ; int temp = i ; int cnt = 0 ; while ( temp % mspf == 0 ) { temp /= mspf ; cnt += 1 ; prim = prim * mspf ; } tfactor [ i ] = ( cnt + 1 ) * tfactor [ temp ] ; pre [ i ] = pre [ i - 1 ] + tfactor [ i ] ; } } static int BinarySearch ( int X ) { int start = 1 ; int end = MAX - 1 ; while ( start < end ) { int mid = ( start + end ) / 2 ; if ( pre [ mid ] == X ) return mid ; else if ( pre [ mid ] < X ) start = mid + 1 ; else end = mid ; } return start ; } static void findSumOfCount ( int X ) { calculate_SPF ( ) ; CountTotalfactors ( ) ; System . out . print ( BinarySearch ( X ) + "NEW_LINE"); } public static void main ( String [ ] args ) { int X = 10 ; findSumOfCount ( X ) ; } }

Index/key variables: i, j, mid, temp
Accumulator variables: cnt, i, j, temp
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean [ ] prime ; static void buildSieve ( int sum ) { prime = new boolean [ sum + 1 ] ; Arrays . fill ( prime , true ) ; prime [ 0 ] = false ; prime [ 1 ] = false ; for ( int p = 2 ; p * p < ( sum + 1 ) ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * 2 ; i < ( sum + 1 ) ; i += p ) prime [ i ] = false ; } } } static int getSum ( int a [ ] [ ] ) { int s = 0 ; for ( int i = 0 ; i < 4 ; i ++ ) for ( int j = 0 ; j < 5 ; j ++ ) s += a [ i ] [ j ] ; return s ; } static boolean checkIndex ( int n , int m , int a [ ] [ ] ) { for ( int i = 0 ; i < n ; i ++ ) for ( int j = 0 ; j < m ; j ++ ) { if ( prime [ i + j ] && ! prime [ a [ i ] [ j ] ] ) { return false ; } } return true ; } public static void main ( String [ ] args ) { int n = 4 , m = 5 ; int a [ ] [ ] = { { 1 , 2 , 3 , 2 , 2 } , { 2 , 2 , 7 , 7 , 7 } , { 7 , 7 , 21 , 7 , 10 } , { 2 , 2 , 3 , 6 , 7 } } ; int sum = getSum ( a ) ; buildSieve ( sum ) ; if ( prime [ sum ] && checkIndex ( n , m , a ) ) { System . out . print ( " YES " + "NEW_LINE"); } else System . out . print ( " NO " + "NEW_LINE"); } }

Index/key variables: i, j, p, sum
Accumulator variables: i, j, p, s
Iterator variables: i, j, p
Class/struct names: GFG
Java program:
import java . util . Date ; import java . util . Scanner ; public class GaussEaster { static void gaussEaster ( int Y ) { float A , B , C , P , Q , M , N , D , E ; A = Y % 19 ; B = Y % 4 ; C = Y % 7 ; P = ( float ) Math . floor ( Y / 100 ) ; Q = ( float ) Math . floor ( ( 13 + 8 * P ) / 25 ) ; M = ( 15 - Q + P - P / 4 ) % 30 ; N = ( 4 + P - P / 4 ) % 7 ; D = ( 19 * A + M ) % 30 ; E = ( 2 * B + 4 * C + 6 * D + N ) % 7 ; int days = ( int ) ( 22 + D + E ) ; if ( ( D == 29 ) && ( E == 6 ) ) { System . out . println ( Y + " - 04" + " - 19" ) ; return ; } else if ( ( D == 28 ) && ( E == 6 ) ) { System . out . println ( Y + " - 04" + " - 18" ) ; return ; } else { if ( days > 31 ) { System . out . println ( Y + " - 04 - " + ( days - 31 ) ) ; return ; } else { System . out . println ( Y + " - 03 - " + days ) ; return ; } } } public static void main ( String [ ] args ) { int Y = 2020 ; gaussEaster ( Y ) ; } }

Class/struct names: GaussEaster
Java program:
import java . util . * ; public class GFG { static Vector < Vector < Integer > > lis = new Vector < Vector < Integer > > ( ) ; static Vector < Integer > primes = new Vector < Integer > ( ) ; static int [ ] vis = new int [ 100001 ] ; static int [ ] dis = new int [ 100001 ] ; static boolean isPrime ( int n ) { int i = 2 ; while ( i * i <= n ) { if ( n % i == 0 ) return false ; i += 1 ; } return true ; } static boolean valid ( int a , int b ) { int c = 0 ; while ( a > 0 ) { if ( ( a % 10 ) != ( b % 10 ) ) c += 1 ; a = a / 10 ; b = b / 10 ; } if ( c == 1 ) return true ; else return false ; } static void makePrimes ( int N ) { int L = ( int ) Math . pow ( 10 , N - 1 ) ; int R = ( int ) Math . pow ( 10 , N ) - 1 ; for ( int i = L ; i < R + 1 ; i ++ ) { if ( isPrime ( i ) ) primes . add ( i ) ; } for ( int i = 0 ; i < primes . size ( ) ; i ++ ) { for ( int j = i + 1 ; j < primes . size ( ) ; j ++ ) { int a = primes . get ( i ) ; int b = primes . get ( j ) ; if ( valid ( a , b ) ) { lis . get ( a ) . add ( b ) ; lis . get ( b ) . add ( a ) ; } } } } static void bfs ( int src ) { Vector < Integer > q = new Vector < Integer > ( ) ; q . add ( src ) ; vis [ src ] = 1 ; dis [ src ] = 0 ; while ( q . size ( ) != 0 ) { int curr = q . get ( 0 ) ; q . remove ( 0 ) ; for ( int x : lis . get ( curr ) ) { if ( vis [ x ] == 0 ) { vis [ x ] = 1 ; q . add ( x ) ; dis [ x ] = dis [ curr ] + 1 ; } } } } public static void main ( String [ ] args ) { for ( int i = 0 ; i < 100001 ; i ++ ) { lis . add ( new Vector < Integer > ( ) ) ; } int N = 4 ; makePrimes ( N ) ; int A = 1033 ; int B = 8179 ; bfs ( A ) ; if ( dis [ B ] == - 1 ) { System . out . print ( - 1 ) ; } else { System . out . print ( dis [ B ] ) ; } } }

Index/key variables: B, curr, src, x
Accumulator variables: c, i, j
Iterator variables: i, j, x
Class/struct names: GFG
Java program:
import java . util . * ; import java . io . * ; import java . lang . * ; class GFG { static int placeValue ( int N , int num ) { int total = 1 , value = 0 , rem = 0 ; while ( true ) { rem = N % 10 ; N = N / 10 ; if ( rem == num ) { value = total * rem ; break ; } total = total * 10 ; } return value ; } public static void main ( String [ ] args ) { int D = 5 ; int N = 85932 ; System . out . println ( placeValue ( N , D ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void BeattySequence ( int n ) { for ( int i = 1 ; i <= n ; i ++ ) { int ans = ( int ) Math . floor ( i * Math . sqrt ( 2 ) ) ; System . out . print ( ans + " , ▁ " ) ; } } public static void main ( String args [ ] ) { int n = 5 ; BeattySequence ( n ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int getSum ( int n ) { int sum = 0 ; for ( int i = 1 ; i <= Math . sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { if ( n / i == i ) sum = sum + i ; else { sum = sum + i ; sum = sum + ( n / i ) ; } } } return sum ; } static boolean checkAbundant ( int n ) { return ( getSum ( n ) - n > n ) ; } static boolean isDeficient ( int n ) { return ( getSum ( n ) < ( 2 * n ) ) ; } static boolean checkPrimitiveAbundant ( int num ) { if ( ! checkAbundant ( num ) ) { return false ; } for ( int i = 2 ; i <= Math . sqrt ( num ) ; i ++ ) { if ( num % i == 0 && i != num ) { if ( i * i == num ) { if ( ! isDeficient ( i ) ) { return false ; } } else if ( ! isDeficient ( i ) || ! isDeficient ( num / i ) ) { return false ; } } } return true ; } public static void main ( String [ ] args ) { int n = 20 ; if ( checkPrimitiveAbundant ( n ) ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int calculateSum ( int N ) { return N * ( N - 1 ) / 2 + N * ( N - 1 ) * ( 2 * N - 1 ) / 6 ; } public static void main ( String [ ] args ) { int N = 3 ; System . out . println ( calculateSum ( N ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int divSum ( int num ) { int result = 0 ; for ( int i = 1 ; i <= Math . sqrt ( num ) ; i ++ ) { if ( num % i == 0 ) { if ( i == ( num / i ) ) result += i ; else result += ( i + num / i ) ; } } return ( result - 1 - num ) ; } static int getSum ( int n ) { int sum = 0 ; while ( n != 0 ) { int r = n % 10 ; sum = sum + r * r ; n = n / 10 ; } return sum ; } static boolean isCanada ( int n ) { return divSum ( n ) == getSum ( n ) ; } public static void main ( String [ ] args ) { int n = 125 ; if ( isCanada ( n ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Accumulator variables: i, result
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int getSum ( int n ) { int sum = 0 ; while ( n != 0 ) { sum = sum + n % 10 ; n = n / 10 ; } return sum ; } static boolean isSelfNum ( int n ) { for ( int m = 1 ; m <= n ; m ++ ) { if ( m + getSum ( m ) == n ) return false ; } return true ; } public static void main ( String [ ] args ) { int n = 20 ; if ( isSelfNum ( n ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }

Accumulator variables: m
Iterator variables: m
Class/struct names: GFG
Java program:
class GFG { static int binomialCoeff ( int n , int k ) { int [ ] [ ] C = new int [ n + 1 ] [ k + 1 ] ; int i , j ; for ( i = 0 ; i <= n ; i ++ ) { for ( j = 0 ; j <= Math . min ( i , k ) ; j ++ ) { if ( j == 0 j == i ) C [ i ] [ j ] = 1 ; else C [ i ] [ j ] = C [ i - 1 ] [ j - 1 ] + C [ i - 1 ] [ j ] ; } } return C [ n ] [ k ] ; } public static void main ( String [ ] args ) { int n = 3 ; int k = n ; n = 2 * n ; System . out . println ( binomialCoeff ( n , k ) ) ; } }

Index/key variables: i, j, k, n
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static int getSum ( int n ) { int sum = 0 ; for ( int i = 1 ; i <= Math . sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { if ( n / i == i ) sum = sum + i ; else { sum = sum + i ; sum = sum + ( n / i ) ; } } } return sum ; } static boolean MultiplyPerfectNumber ( int n ) { if ( getSum ( n ) % n == 0 ) return true ; else return false ; } public static void main ( String [ ] args ) { int n = 28 ; if ( MultiplyPerfectNumber ( n ) ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int phi ( int n ) { int result = n ; for ( int p = 2 ; p * p <= n ; ++ p ) { if ( n % p == 0 ) { while ( n % p == 0 ) { n /= p ; } result -= result / p ; } } if ( n > 1 ) result -= result / n ; return result ; } static boolean isPerfectTotientNum ( int n ) { int temp = n ; int sum = 0 ; while ( n > 1 ) { sum = sum + phi ( n ) ; n = phi ( n ) ; } if ( sum == temp ) return true ; return false ; } public static void main ( String [ ] args ) { int n = 9 ; if ( isPerfectTotientNum ( n ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }

Accumulator variables: n, result
Iterator variables: p
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean isPower ( int a ) { if ( a == 1 ) return true ; for ( int i = 2 ; i * i <= a ; i ++ ) { double val = Math . log ( a ) / Math . log ( i ) ; if ( ( val - ( int ) val ) < 0.00000001 ) return true ; } return false ; } static boolean isCunningham ( int n ) { return isPower ( n - 1 ) || isPower ( n + 1 ) ; } public static void main ( String [ ] args ) { int n = 126 ; if ( isCunningham ( n ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

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