dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
import java . util . * ; class GFG { static void minChocolates ( int A [ ] , int N ) { int [ ] B = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { B [ i ] = 1 ; } for ( int i = 1 ; i < N ; i ++ ) { if ( A [ i ] > A [ i - 1 ] ) B [ i ] = B [ i - 1 ] + 1 ; else B [ i ] = 1 ; } for ( int i = N - 2 ; i >= 0 ; i -- ) { if ( A [ i ] > A [ i + 1 ] ) B [ i ] = Math . max ( B [ i + 1 ] + 1 , B [ i ] ) ; else B [ i ] = Math . max ( B [ i ] , 1 ) ; } int sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { sum += B [ i ] ; } System . out . print ( sum + "NEW_LINE"); } public static void main ( String [ ] args ) { int A [ ] = { 23 , 14 , 15 , 14 , 56 , 29 , 14 } ; int N = A . length ; minChocolates ( A , N ) ; } }

Index/key variables: N, i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . Arrays ; class GFG { static void constructArrayWithGivenLCM ( int N ) { int newArr [ ] = new int [ N ] ; int j = 0 ; for ( int i = 1 ; i * i <= N ; i ++ ) { if ( N % i == 0 ) { newArr [ j ] = i ; j ++ ; if ( N / i != i ) { newArr [ j ] = N / i ; j ++ ; } } } Arrays . sort ( newArr ) ; for ( int i = j ; i < N ; i ++ ) { System . out . print ( newArr [ i ] + " ▁ " ) ; } } public static void main ( String [ ] args ) { int N = 12 ; constructArrayWithGivenLCM ( N ) ; } }

Index/key variables: N, i, j
Accumulator variables: i, j
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; import java . util . Vector ; import java . util . Collections ; class GFG { static int getPower ( int p ) { int res = 1 ; while ( p > 0 ) { res *= 5 ; p -- ; } return res ; } static int countNumbersUtil ( int N ) { int count = 0 ; Vector < Integer > digits = new Vector < Integer > ( ) ; while ( N > 0 ) { digits . add ( N % 10 ) ; N /= 10 ; } Collections . reverse ( digits ) ; int D = digits . size ( ) ; for ( int i = 1 ; i <= D ; i ++ ) { int res = getPower ( i ) ; if ( i == D ) { for ( int p = 1 ; p <= D ; p ++ ) { int x = digits . get ( p - 1 ) ; int tmp = 0 ; if ( p % 2 == 0 ) { tmp = ( 5 - ( x / 2 + 1 ) ) * getPower ( D - p ) ; } else { tmp = ( 5 - ( x + 1 ) / 2 ) * getPower ( D - p ) ; } res -= tmp ; if ( p % 2 != x % 2 ) { break ; } } } count += res ; } return count ; } static void countNumbers ( int L , int R ) { System . out . println ( countNumbersUtil ( R ) - countNumbersUtil ( L - 1 ) ) ; } public static void main ( String args [ ] ) { int L = 128 , R = 162 ; countNumbers ( L , R ) ; } }

Accumulator variables: N, count, i, p, res
Iterator variables: i, p
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int alternatingSumOfFirst_N ( int N ) { int alternateSum = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { if ( i % 2 == 0 ) { alternateSum += - i ; } else { alternateSum += i ; } } return alternateSum ; } public static void main ( String [ ] args ) { int N = 6 ; System . out . print ( alternatingSumOfFirst_N ( N ) ) ; } }

Accumulator variables: alternateSum, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int gcd ( int a , int b ) { if ( a == 0 ) return b ; return gcd ( b % a , a ) ; } static int findSum ( int N ) { int sum = 0 ; for ( int i = 1 ; i < N ; i ++ ) { if ( gcd ( i , N ) == 1 ) { sum += i ; } } return sum ; } public static void main ( String [ ] args ) { int N = 5 ; System . out . print ( findSum ( N ) ) ; } }

Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void solve ( int arr [ ] , int n ) { HashMap < Integer , Integer > mp = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( mp . containsKey ( arr [ i ] ) ) { mp . put ( arr [ i ] , mp . get ( arr [ i ] ) + 1 ) ; } else { mp . put ( arr [ i ] , 1 ) ; } } int cnt = 0 ; for ( Map . Entry < Integer , Integer > x : mp . entrySet ( ) ) { cnt += ( ( x . getValue ( ) ) * ( x . getValue ( ) - 1 ) / 2 ) ; } int [ ] ans = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { ans [ i ] = cnt - ( mp . get ( arr [ i ] ) - 1 ) ; } for ( int i = 0 ; i < n ; i ++ ) { System . out . print ( ans [ i ] + " ▁ " ) ; } } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 1 , 2 , 1 , 2 } ; int N = arr . length ; solve ( arr , N ) ; } }

Index/key variables: i, n
Accumulator variables: cnt, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; public class GFG { public static void findMode ( int [ ] a , int n ) { Map < Integer , Integer > map = new HashMap < > ( ) ; int max = 0 ; int mode = 0 ; for ( int i = 0 ; i < n ; i ++ ) { map . put ( a [ i ] , map . getOrDefault ( a [ i ] , 0 ) + 1 ) ; if ( map . get ( a [ i ] ) >= max ) { max = map . get ( a [ i ] ) ; mode = a [ i ] ; } System . out . print ( mode ) ; System . out . print ( " ▁ " ) ; } } public static void main ( String [ ] args ) { int arr [ ] = { 2 , 7 , 3 , 2 , 5 } ; int n = arr . length ; findMode ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static long modexp ( long x , long n , long m ) { if ( n == 0 ) { return 1 ; } else if ( n % 2 == 0 ) { return modexp ( ( x * x ) % m , n / 2 , m ) ; } else { return ( x * modexp ( ( x * x ) % m , ( n - 1 ) / 2 , m ) % m ) ; } } static long modInverse ( long x , long m ) { return modexp ( x , m - 2 , m ) ; } static void countNumbers ( String N ) { long m = 1000000007 ; long factorial [ ] = new long [ 100001 ] ; factorial [ 0 ] = 1 ; for ( int i = 1 ; i < 100001 ; i ++ ) { factorial [ i ] = ( factorial [ i - 1 ] * i ) % m ; } long count [ ] = new long [ 10 ] ; for ( int i = 0 ; i < 10 ; i ++ ) { count [ i ] = 0 ; } long length = N . length ( ) ; for ( int i = 0 ; i < length ; i ++ ) count [ N . charAt ( i ) - '0' ] ++ ; long result = factorial [ ( int ) length ] ; for ( int i = 0 ; i < 10 ; i ++ ) { result = ( result * modInverse ( factorial [ ( int ) count [ i ] ] , m ) ) % m ; } System . out . println ( result ) ; } public static void main ( String args [ ] ) { String N = "0223" ; countNumbers ( N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int [ ] spf = new int [ 10001 ] ; static void spf_array ( int spf [ ] ) { spf [ 1 ] = 1 ; for ( int i = 2 ; i < 1000 ; i ++ ) spf [ i ] = i ; for ( int i = 4 ; i < 1000 ; i += 2 ) spf [ i ] = 2 ; for ( int i = 3 ; i * i < 1000 ; i ++ ) { if ( spf [ i ] == i ) { for ( int j = i * i ; j < 1000 ; j += i ) if ( spf [ j ] == j ) spf [ j ] = i ; } } } static void frequent_prime ( int arr [ ] , int N , int K ) { spf_array ( spf ) ; Map < Integer , Integer > Hmap = new TreeMap < > ( ) ; ArrayList < Integer > result = new ArrayList < > ( ) ; int i = 0 ; int c = 0 ; for ( i = 0 ; i < N ; i ++ ) { int x = arr [ i ] ; while ( x != 1 ) { Hmap . put ( spf [ x ] , Hmap . getOrDefault ( spf [ x ] , 0 ) + 1 ) ; x = x / spf [ x ] ; } } Hmap . remove ( 1 ) ; for ( Map . Entry < Integer , Integer > x : Hmap . entrySet ( ) ) { int primeNum = x . getKey ( ) ; int frequency = x . getValue ( ) ; if ( frequency % K == 0 ) { result . add ( primeNum ) ; } } if ( result . size ( ) > 0 ) { for ( Integer it : result ) { System . out . print ( it + " ▁ " ) ; } } else { System . out . print ( " { } " ) ; } } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 4 , 6 } ; int K = 1 ; int N = arr . length ; frequent_prime ( arr , N , K ) ; } }

Index/key variables: i, j, x
Accumulator variables: i, j
Iterator variables: i, it, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void Kmultiples ( int n , int k ) { int a = n ; for ( int i = 1 ; i <= k ; i ++ ) { System . out . print ( n + " ▁ * ▁ " + i + " ▁ = ▁ " + a + "NEW_LINE"); int j = 0 ; while ( n >= ( 1 << j ) ) { a += n & ( 1 << j ) ; j ++ ; } } } public static void main ( String [ ] args ) { int N = 16 , K = 7 ; Kmultiples ( N , K ) ; } }

Accumulator variables: a, i, j
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . Arrays ; public class GFG { private static double calculateB ( int [ ] x , int [ ] y ) { int n = x . length ; int sx = Arrays . stream ( x ) . sum ( ) ; int sy = Arrays . stream ( y ) . sum ( ) ; int sxsy = 0 ; int sx2 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sxsy += x [ i ] * y [ i ] ; sx2 += x [ i ] * x [ i ] ; } double b = ( double ) ( n * sxsy - sx * sy ) / ( n * sx2 - sx * sx ) ; return b ; } public static void leastRegLine ( int X [ ] , int Y [ ] ) { double b = calculateB ( X , Y ) ; int n = X . length ; int meanX = Arrays . stream ( X ) . sum ( ) / n ; int meanY = Arrays . stream ( Y ) . sum ( ) / n ; double a = meanY - b * meanX ; System . out . println ( " Regression ▁ line : " ) ; System . out . print ( " Y ▁ = ▁ " ) ; System . out . printf ( " % .3f " , a ) ; System . out . print ( " ▁ + ▁ " ) ; System . out . printf ( " % .3f " , b ) ; System . out . print ( " * X " ) ; } public static void main ( String [ ] args ) { int X [ ] = { 95 , 85 , 80 , 70 , 60 } ; int Y [ ] = { 90 , 80 , 70 , 65 , 60 } ; leastRegLine ( X , Y ) ; } }

Index/key variables: i
Accumulator variables: i, sx2, sxsy
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int countRepeatingDigits ( int N ) { int res = 0 ; int cnt [ ] = new int [ 10 ] ; while ( N > 0 ) { int rem = N % 10 ; cnt [ rem ] ++ ; N = N / 10 ; } for ( int i = 0 ; i < 10 ; i ++ ) { if ( cnt [ i ] > 1 ) { res ++ ; } } return res ; } public static void main ( String [ ] args ) { int N = 12 ; System . out . println ( countRepeatingDigits ( N ) ) ; } }

Index/key variables: i, rem
Accumulator variables: i, res
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void findTemperature ( int x , int y , int s ) { double Day1 , Day2 ; double diff = ( x - y ) * 6 ; Day2 = ( diff + s ) / 2 ; Day1 = s - Day2 ; System . out . println ( " Day1 ▁ : ▁ " + Day1 ) ; System . out . println ( " Day2 ▁ : ▁ " + Day2 ) ; } public static void main ( String [ ] args ) { int x = 5 , y = 10 , s = 40 ; findTemperature ( x , y , s ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int freqCount ( String str , char k ) { int count = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { if ( str . charAt ( i ) == k ) count ++ ; } return count ; } static void findAandB ( int n , int k ) { int flag = 0 ; for ( int i = 1 ; i < n ; i ++ ) { if ( freqCount ( Integer . toString ( i ) , ( char ) ( k + 48 ) ) == 0 && freqCount ( Integer . toString ( n - i ) , ( char ) ( k + 48 ) ) == 0 ) { System . out . print ( " ( " + i + " , ▁ " + ( n - i ) + " ) " ) ; flag = 1 ; break ; } } if ( flag == 0 ) System . out . print ( - 1 ) ; } public static void main ( String [ ] args ) { int N = 100 ; int K = 0 ; findAandB ( N , K ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static long calculate ( long p , long q ) { long mod = 998244353 , expo ; expo = mod - 2 ; while ( expo != 0 ) { if ( ( expo & 1 ) == 1 ) { p = ( p * q ) % mod ; } q = ( q * q ) % mod ; expo >>= 1 ; } return p ; } public static void main ( String [ ] args ) { long p = 1 , q = 4 ; System . out . println ( calculate ( p , q ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void maxLCMWithGivenSum ( int X ) { int A , B ; if ( ( X & 1 ) == 1 ) { A = X / 2 ; B = X / 2 + 1 ; } else { if ( ( X / 2 ) % 2 == 0 ) { A = X / 2 - 1 ; B = X / 2 + 1 ; } else { A = X / 2 - 2 ; B = X / 2 + 2 ; } } System . out . println ( A + " ▁ " + B ) ; } public static void main ( String [ ] args ) { int X = 30 ; maxLCMWithGivenSum ( X ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int MaxSubarrayLength ( int arr [ ] , int n , int k ) { int left = - 1 ; int right = 0 ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( ( arr [ i ] % k ) != 0 ) { if ( left == - 1 ) { left = i ; } right = i ; } sum += arr [ i ] ; } if ( ( sum % k ) != 0 ) { return n ; } else if ( left == - 1 ) { return - 1 ; } else { int prefix_length = left + 1 ; int suffix_length = n - right ; return n - Math . min ( prefix_length , suffix_length ) ; } } public static void main ( String [ ] args ) { int arr [ ] = { 6 , 3 , 12 , 15 } ; int n = arr . length ; int K = 3 ; System . out . println ( MaxSubarrayLength ( arr , n , K ) ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int solve ( int X , int Y ) { if ( X > Y ) { int temp = X ; X = Y ; Y = temp ; } if ( X == Y ) System . out . println ( 0 ) ; else if ( Y % X == 0 ) System . out . println ( 1 ) ; else System . out . println ( 2 ) ; return 0 ; } public static void main ( String args [ ] ) { int X = 8 , Y = 13 ; solve ( X , Y ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static long countQuadraples ( long N ) { long cnt = 0 ; Map < Long , Long > m = new HashMap < > ( ) ; for ( long a = 1 ; a <= N ; a ++ ) { for ( long b = 1 ; b <= N ; b ++ ) { long x = a * a + b * b ; m . put ( x , m . getOrDefault ( x , 0l ) + 1 ) ; } } for ( long c = 1 ; c <= N ; c ++ ) { for ( long d = 1 ; d <= N ; d ++ ) { long x = c * c + d * d ; if ( m . containsKey ( x ) ) cnt += m . get ( x ) ; } } return cnt ; } public static void main ( String [ ] args ) { long N = 2 ; System . out . println ( countQuadraples ( N ) ) ; } }

Accumulator variables: a, b, c, cnt, d
Iterator variables: a, b, c, d
Class/struct names: GFG
Java program:
class GFG { static int count_pairs ( int [ ] a , int b [ ] , int N ) { int i , j ; int count = 0 ; for ( i = 0 ; i < ( N - 1 ) ; i ++ ) { for ( j = ( i + 1 ) ; j < N ; j ++ ) { if ( ( a [ i ] + a [ j ] ) > ( b [ i ] + b [ j ] ) ) { count ++ ; } } } return count ; } public static void main ( String [ ] args ) { int N = 5 ; int a [ ] = new int [ ] { 1 , 2 , 3 , 4 , 5 } ; int b [ ] = new int [ ] { 2 , 5 , 6 , 1 , 9 } ; System . out . println ( count_pairs ( a , b , N ) ) ; } }

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int numberOfPairs ( int [ ] a , int [ ] b , int n ) { int c [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { c [ i ] = a [ i ] - b [ i ] ; } Arrays . sort ( c ) ; int answer = 0 ; for ( int i = 1 ; i < n ; i ++ ) { if ( c [ i ] <= 0 ) continue ; int pos = - 1 ; for ( int j = 0 ; j < n ; j ++ ) { if ( c [ i ] + c [ j ] > 0 ) { pos = j ; break ; } } answer += ( i - pos ) ; } return answer ; } public static void main ( String [ ] args ) { int n = 5 ; int a [ ] = { 1 , 2 , 3 , 4 , 5 } ; int b [ ] = { 2 , 5 , 6 , 1 , 9 } ; System . out . println ( numberOfPairs ( a , b , n ) ) ; } }

Index/key variables: i, j, n
Accumulator variables: answer, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void print_h_index ( int arr [ ] , int N ) { List < Integer > ms = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { ms . add ( arr [ i ] ) ; int t = Collections . min ( ms ) ; if ( t < ms . size ( ) ) { ms . remove ( ms . indexOf ( t ) ) ; } System . out . print ( ms . size ( ) + " ▁ " ) ; } } public static void main ( String [ ] args ) { int arr [ ] = { 9 , 10 , 7 , 5 , 0 , 10 , 2 , 0 } ; int N = arr . length ; print_h_index ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static Vector < Boolean > findPrimes ( int arr [ ] , int n ) { int max_val = Arrays . stream ( arr ) . max ( ) . getAsInt ( ) ; Vector < Boolean > prime = new Vector < > ( max_val + 1 ) ; for ( int i = 0 ; i < max_val + 1 ; i ++ ) prime . add ( i , Boolean . TRUE ) ; prime . add ( 0 , Boolean . FALSE ) ; prime . add ( 1 , Boolean . FALSE ) ; for ( int p = 2 ; p * p <= max_val ; p ++ ) { if ( prime . get ( p ) == true ) { for ( int i = p * 2 ; i <= max_val ; i += p ) prime . add ( i , Boolean . FALSE ) ; } } return prime ; } static void nonRepeatingPrimes ( int arr [ ] , int n ) { Vector < Boolean > prime = findPrimes ( arr , n ) ; HashMap < Integer , Integer > mp = new HashMap < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( prime . get ( arr [ i ] ) ) if ( mp . containsKey ( arr [ i ] ) ) mp . put ( arr [ i ] , mp . get ( arr [ i ] ) + 1 ) ; else mp . put ( arr [ i ] , 1 ) ; } for ( Map . Entry < Integer , Integer > entry : mp . entrySet ( ) ) { if ( entry . getValue ( ) == 1 ) System . out . println ( entry . getKey ( ) ) ; } } public static void main ( String [ ] args ) { int arr [ ] = { 2 , 3 , 4 , 6 , 7 , 9 , 7 , 23 , 21 , 3 } ; int n = arr . length ; nonRepeatingPrimes ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: i, p
Iterator variables: i, p
Class/struct names: GFG
Java program:
class GFG { static int prefixProduct ( int [ ] a , int n ) { for ( int i = 1 ; i < n ; i ++ ) { a [ i ] = a [ i ] * a [ i - 1 ] ; } for ( int j = 0 ; j < n ; j ++ ) { System . out . print ( a [ j ] + " , ▁ " ) ; } return 0 ; } public static void main ( String [ ] args ) { int arr [ ] = new int [ ] { 2 , 4 , 6 , 5 , 10 } ; int N = 5 ; prefixProduct ( arr , N ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static int countWays ( int N ) { if ( N < 4 ) return 0 ; int ans = ( ( N - 1 ) * ( N - 2 ) ) / 2 ; int s = 0 ; for ( int i = 2 ; i <= N - 3 ; i ++ ) { for ( int j = 1 ; j < i ; j ++ ) { if ( N == 2 * i + j ) s ++ ; } } if ( N % 3 == 0 ) s = 3 * s + 1 ; else s = 3 * s ; return ans - s ; } public static void main ( String [ ] args ) { int N = 10 ; System . out . println ( countWays ( N ) ) ; } }

Accumulator variables: i, j, s
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { 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 boolean isMagnanimous ( int N ) { String s = Integer . toString ( N ) ; int l = s . length ( ) ; if ( l < 2 ) return false ; for ( int i = 0 ; i < l - 1 ; i ++ ) { String left = s . substring ( 0 , i + 1 ) ; String right = s . substring ( i + 1 ) ; int x = Integer . valueOf ( left ) ; int y = Integer . valueOf ( right ) ; if ( ! isPrime ( x + y ) ) return false ; } return true ; } public static void main ( String [ ] args ) { int N = 12 ; if ( isMagnanimous ( N ) ) System . out . print ( "YesNEW_LINE"); else System . out . print ( "NoNEW_LINE"); } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static final int limit = 10000000 ; static int [ ] position = new int [ limit + 1 ] ; static void sieve ( ) { position [ 0 ] = - 1 ; position [ 1 ] = - 1 ; int pos = 0 ; for ( int i = 2 ; i <= limit ; i ++ ) { if ( position [ i ] == 0 ) { position [ i ] = ++ pos ; for ( int j = i * 2 ; j <= limit ; j += i ) position [ j ] = - 1 ; } } } static int getSum ( int n ) { int sum = 0 ; while ( n != 0 ) { sum = sum + n % 10 ; n = n / 10 ; } return sum ; } static boolean isHonakerPrime ( int n ) { int pos = position [ n ] ; if ( pos == - 1 ) return false ; return getSum ( n ) == getSum ( pos ) ; } public static void main ( String [ ] args ) { sieve ( ) ; int N = 121 ; if ( isHonakerPrime ( N ) ) System . out . print ( "YesNEW_LINE"); else System . out . print ( "NoNEW_LINE"); } }

Index/key variables: i, j, n
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static int N = 4 , M = 5 ; static boolean isPrime ( int n ) { if ( n <= 1 ) return false ; for ( int i = 2 ; i <= Math . sqrt ( n ) ; i ++ ) if ( n % i == 0 ) return false ; return true ; } static int takeSum ( int a [ ] [ ] ) { int s = 0 ; for ( int i = 0 ; i < N ; i ++ ) for ( int j = 0 ; j < M ; j ++ ) s += a [ i ] [ j ] ; return s ; } public static void main ( String [ ] args ) { int a [ ] [ ] = { { 1 , 2 , 3 , 4 , 2 } , { 0 , 1 , 2 , 3 , 34 } , { 0 , 34 , 21 , 12 , 12 } , { 1 , 2 , 3 , 6 , 6 } } ; int sum = takeSum ( a ) ; if ( isPrime ( sum ) ) System . out . print ( " YES " + "NEW_LINE"); else System . out . print ( " NO " + "NEW_LINE"); } }

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

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

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { public static boolean isContaindigit ( int n ) { while ( n > 0 ) { if ( ! ( n % 10 == 0 n % 10 == 1 n % 10 == 8 ) ) return false ; n = n / 10 ; } return true ; } public static boolean ispalindrome ( int n ) { String temp = Integer . toString ( n ) ; int l = temp . length ( ) ; for ( int i = 0 ; i < l / 2 ; i ++ ) { if ( temp . charAt ( i ) != temp . charAt ( l - i - 1 ) ) return false ; } return true ; } public static boolean isTetradic ( int n ) { if ( ispalindrome ( n ) && isContaindigit ( n ) ) return true ; return false ; } public static void printTetradicPrimesLessThanN ( int n ) { boolean prime [ ] = new boolean [ n + 1 ] ; Arrays . fill ( prime , true ) ; int p = 2 ; while ( p * p <= n ) { if ( prime [ p ] ) { for ( int i = p * 2 ; i < n + 1 ; i += p ) prime [ i ] = false ; } p += 1 ; } for ( p = 2 ; p < n + 1 ; p ++ ) { if ( prime [ p ] && isTetradic ( p ) ) System . out . print ( p + " ▁ " ) ; } } public static void main ( String [ ] args ) { int n = 1000 ; printTetradicPrimesLessThanN ( n ) ; } }

Index/key variables: i, p
Accumulator variables: i, p
Iterator variables: i, p
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int concat ( int a , int b ) { String s1 = Integer . toString ( a ) ; String s2 = Integer . toString ( b ) ; String s = s1 + s2 ; int c = Integer . parseInt ( s ) ; return c ; } static boolean isAstonishing ( int n ) { for ( int i = 1 ; i < n ; i ++ ) { int sum = 0 ; for ( int j = i ; j < n ; j ++ ) { sum += j ; if ( sum == n ) { int concatenation = concat ( i , j ) ; if ( concatenation == n ) { return true ; } } } } return false ; } public static void main ( String [ ] args ) { int n = 429 ; if ( isAstonishing ( n ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Accumulator variables: i, j, sum
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean checkSame ( int n , int b ) { HashMap < Integer , Integer > m = new HashMap < Integer , Integer > ( ) ; while ( n != 0 ) { int r = n % b ; n = n / b ; if ( m . containsKey ( r ) ) { m . put ( r , m . get ( r ) + 1 ) ; } else { m . put ( r , 1 ) ; } } int last = - 1 ; for ( Map . Entry < Integer , Integer > i : m . entrySet ( ) ) { if ( last != - 1 && i . getValue ( ) != last ) { return false ; } else { last = i . getValue ( ) ; } } return true ; } public static void main ( String [ ] args ) { int n = 9 ; int base = 2 ; if ( checkSame ( n , base ) ) System . out . print ( " Yes " ) ; else System . out . print ( " NO " ) ; } }

Class/struct names: GFG
Java program:
import java . lang . * ; class GFG { static int seriesSum ( int n ) { int sum = 0 ; int currProd = 1 ; int currSum = 1 ; for ( int i = 2 ; i <= n ; i ++ ) { currProd *= i ; currSum += i ; sum += currProd - currSum ; } return sum ; } public static void main ( String [ ] args ) { int N = 5 ; System . out . print ( seriesSum ( N ) ) ; } }

Accumulator variables: currProd, currSum, i, sum
Iterator variables: i
Class/struct names: GFG