dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
class GFG { static int findLCMPrime ( int a , int b ) { if ( a == b ) { return a ; } return a * b ; } public static void main ( String [ ] args ) { int a = 3 , b = 5 ; System . out . println ( findLCMPrime ( a , b ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static void smallestNumber ( int N ) { System . out . print ( N * Math . ceil ( Math . pow ( 2 , ( N - 1 ) ) / N ) ) ; } public static void main ( String [ ] args ) { int N = 3 ; smallestNumber ( N ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void smallestNumber ( int N ) { System . out . print ( N * Math . floor ( ( Math . pow ( 10 , N ) - 1 ) / N ) ) ; } public static void main ( String args [ ] ) { int N = 2 ; smallestNumber ( N ) ; } }

Class/struct names: GFG
Java program:
class GFG { static int icosikaiheptagonalNum ( int n ) { return ( 25 * n * n - 23 * n ) / 2 ; } public static void main ( String [ ] args ) { int n = 3 ; System . out . print ( "3rd ▁ icosikaiheptagonal ▁ Number ▁ is ▁ " + icosikaiheptagonalNum ( n ) ) ; } }

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

Class/struct names: GFG
Java program:
class GFG { static void checkSolution ( int a , int b , int c ) { if ( 2 * b * b == 9 * a * c ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } public static void main ( String [ ] args ) { int a = 1 , b = 3 , c = 2 ; checkSolution ( a , b , c ) ; } }

Class/struct names: GFG
Java program:
class GFG { static void getParity ( int n , int [ ] A ) { for ( int x : A ) { if ( ( x & 1 ) == 1 ) { System . out . println ( " Even " ) ; return ; } } System . out . println ( " Odd " ) ; } public static void main ( String [ ] args ) { int N = 3 ; int [ ] A = { 2 , 3 , 1 } ; getParity ( N , A ) ; } }

Iterator variables: x
Class/struct names: GFG
Java program:
class GFG { static void numberOfDigits ( int N ) { int nod = ( int ) Math . floor ( Math . log10 ( N ) + 1 ) ; int toDecrease = ( int ) ( Math . pow ( 10 , nod ) - 1 ) / 9 ; System . out . print ( ( N + 1 ) * nod - toDecrease ) ; } public static void main ( String [ ] args ) { int N = 13 ; numberOfDigits ( N ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void Maxlength ( int arr [ ] , int N ) { Vector < Integer > zeroindex = new Vector < Integer > ( ) ; int maxlen ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] == 0 ) zeroindex . add ( i ) ; } if ( zeroindex . size ( ) == 0 ) { maxlen = N ; } else { maxlen = ( int ) zeroindex . get ( 0 ) ; for ( int i = 0 ; i < zeroindex . size ( ) - 1 ; i ++ ) { if ( ( int ) zeroindex . get ( i + 1 ) - ( int ) zeroindex . get ( i ) - 1 > maxlen ) { maxlen = ( int ) zeroindex . get ( i + 1 ) - ( int ) zeroindex . get ( i ) - 1 ; } } if ( N - ( int ) zeroindex . get ( zeroindex . size ( ) - 1 ) - 1 > maxlen ) { maxlen = N - ( int ) zeroindex . get ( zeroindex . size ( ) - 1 ) - 1 ; } } System . out . println ( maxlen ) ; } public static void main ( String args [ ] ) { int N = 9 ; int arr [ ] = { 7 , 1 , 0 , 1 , 2 , 0 , 9 , 2 , 1 } ; Maxlength ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static boolean isPossible ( int arr [ ] , int N , int K ) { int oddCount = 0 , evenCount = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] % 2 == 0 ) { evenCount ++ ; } else { oddCount ++ ; } } if ( evenCount == N || ( oddCount == N && K % 2 == 0 ) || ( K == N && oddCount % 2 == 0 ) ) { return false ; } else { return true ; } } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 , 3 , 4 , 5 , 8 } ; int K = 5 ; int N = arr . length ; if ( isPossible ( arr , N , K ) ) { System . out . println ( " Possible " ) ; } else { System . out . println ( " Not ▁ Possible " ) ; } } }

Index/key variables: i
Accumulator variables: evenCount, i, oddCount
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void lastTwoDigits ( double N ) { if ( N >= 10 ) { System . out . print ( "00" ) ; return ; } double fac = 1 ; for ( int i = 1 ; i <= N ; i ++ ) fac = ( fac * i ) % 100 ; System . out . print ( fac ) ; } public static void main ( String args [ ] ) { int N = 7 ; lastTwoDigits ( N ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static float productOfGP ( float a , float r , int n ) { return ( float ) Math . pow ( a , n ) * ( float ) Math . pow ( r , n * ( n - 1 ) / 2 ) ; } public static void main ( String s [ ] ) { float a = 1 , r = 2 ; int N = 4 ; System . out . println ( productOfGP ( a , r , N ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static float productOfGP ( float a , float r , int n ) { int an = ( int ) ( a * ( int ) ( Math . pow ( r , n - 1 ) ) ) ; return ( int ) Math . sqrt ( ( int ) Math . pow ( a * an , n ) ) ; } public static void main ( String args [ ] ) { float a = 1 , r = 2 ; int N = 4 ; System . out . print ( productOfGP ( a , r , N ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void solve ( int n ) { for ( int x = 1 ; x <= Math . sqrt ( n ) ; x ++ ) { if ( n % x == 0 ) { int small = x ; int big = n / x ; if ( small % 2 == big % 2 ) { int a = ( small + big ) / 2 ; int b = ( big - small ) / 2 ; System . out . print ( a + " ▁ " + b ) ; return ; } } } System . out . print ( - 1 ) ; } public static void main ( String args [ ] ) { int n = 7 ; solve ( n ) ; } }

Accumulator variables: x
Iterator variables: x
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void prob ( int x , int y ) { int num = Math . abs ( x - y + 1 ) * Math . abs ( x - y + 1 ) ; int den = ( x + 1 ) * ( x + 1 ) ; int gcd = __gcd ( num , den ) ; System . out . print ( num / gcd + " / " + den / gcd + "NEW_LINE"); } static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } public static void main ( String [ ] args ) { int X = 2 , Y = 1 ; prob ( X , Y ) ; } }

Class/struct names: GFG
Java program:
class GFG { static boolean is_Chiliagon ( int N ) { float n = ( float ) ( 996 + Math . sqrt ( 7984 * N + 992016 ) ) / 1996 ; return ( n - ( int ) n ) == 0 ; } public static void main ( String s [ ] ) { int N = 1000 ; if ( is_Chiliagon ( N ) ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } }

Class/struct names: GFG
Java program:
class GFG { static int commonSubarrays ( int [ ] A , int [ ] B , int N ) { int [ ] Map = new int [ N + 1 ] ; for ( int i = 0 ; i < N ; i ++ ) Map [ A [ i ] ] = i ; for ( int i = 0 ; i < N ; i ++ ) { B [ i ] = Map [ B [ i ] ] ; } int count = 0 ; int i = 0 , K ; while ( i < N ) { K = 1 ; i += 1 ; while ( i < N && B [ i ] == B [ i - 1 ] + 1 ) { i += 1 ; K += 1 ; } count = count + ( ( K ) * ( K + 1 ) ) / 2 ; } return count ; } public static void main ( String [ ] args ) { int N = 3 ; int A [ ] = { 1 , 2 , 3 } ; int B [ ] = { 2 , 3 , 1 } ; System . out . print ( commonSubarrays ( A , B , N ) ) ; System . out . print ( "NEW_LINE"); N = 5 ; int C [ ] = { 1 , 2 , 3 , 4 , 5 } ; int D [ ] = { 2 , 3 , 1 , 4 , 5 } ; System . out . print ( commonSubarrays ( C , D , N ) ) ; } }

Index/key variables: i
Accumulator variables: K, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void getArrayOfSizeK ( int n , int k ) { Vector < Integer > ans = new Vector < Integer > ( ) ; int odd = n - ( ( k - 1 ) * 1 ) ; if ( odd > 0 && odd % 2 != 0 ) { for ( int i = 0 ; i < k - 1 ; i ++ ) { ans . add ( 1 ) ; } ans . add ( odd ) ; } int even = n - ( ( k - 1 ) * 2 ) ; if ( even > 0 && even % 2 == 0 && ans . size ( ) == 0 ) { for ( int i = 0 ; i < k - 1 ; i ++ ) { ans . add ( 2 ) ; } ans . add ( even ) ; } if ( ans . size ( ) > 0 ) { for ( int i = 0 ; i < k ; i ++ ) { System . out . print ( ans . get ( i ) + " ▁ " ) ; } } else { System . out . println ( " NO " ) ; } } public static void main ( String args [ ] ) { int n = 10 , k = 3 ; getArrayOfSizeK ( n , k ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean checkDivisbility ( int num ) { int digit ; int N = num ; while ( num != 0 ) { digit = num % 10 ; num = num / 10 ; if ( digit == 0 N % digit != 0 ) return false ; } return true ; } public static void main ( String [ ] args ) { int N = 128 ; boolean result = checkDivisbility ( N ) ; if ( result ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int inv ( int a , int m ) { int m0 = m , t , q ; int x0 = 0 , x1 = 1 ; if ( m == 1 ) return 0 ; while ( a > 1 ) { q = a / m ; t = m ; m = a % m ; a = t ; t = x0 ; x0 = x1 - q * x0 ; x1 = t ; } if ( x1 < 0 ) x1 += m0 ; return x1 ; } static int derivative ( int x ) { return 3 * x * x ; } static int Image ( int x , int k ) { return x * x * x - k ; } static int next_power ( int a_t , int t , int a1 , int prime , int k ) { int power_p = ( int ) Math . pow ( prime , t + 1 ) ; int next_a = ( a_t - Image ( a_t , k ) * inv ( derivative ( a1 ) , prime ) ) % power_p ; if ( next_a < 0 ) return next_a += power_p ; return next_a ; } static int powerOfPrime ( int prime , int power , int k , int a1 ) { if ( derivative ( a1 ) != 0 ) { int a_t = a1 ; for ( int p = 1 ; p < power ; p ++ ) { a_t = next_power ( a_t , p , a1 , prime , k ) ; } return a_t ; } return - 1 ; } public static void main ( String [ ] args ) { int prime = 7 , a1 = 3 ; int power = 2 , k = 3 ; System . out . print ( powerOfPrime ( prime , power , k , a1 ) ) ; } }

Accumulator variables: next_a, p, x1
Iterator variables: p
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int count_same_digit ( int L , int R ) { int tmp = 0 , ans = 0 ; int n = ( int ) Math . log10 ( R ) + 1 ; for ( int i = 0 ; i < n ; i ++ ) { tmp = tmp * 10 + 1 ; for ( int j = 1 ; j <= 9 ; j ++ ) { if ( L <= ( tmp * j ) && ( tmp * j ) <= R ) { ans ++ ; } } } return ans ; } public static void main ( String [ ] args ) { int L = 12 , R = 68 ; System . out . println ( count_same_digit ( L , R ) ) ; } }

Accumulator variables: ans, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . Vector ; class GFG { static int minLCM ( int arr [ ] , int n ) { int mx = 0 ; for ( int i = 0 ; i < n ; i ++ ) { mx = Math . max ( mx , arr [ i ] ) ; } Vector < Integer > [ ] mul = new Vector [ mx + 1 ] ; for ( int i = 0 ; i < mul . length ; i ++ ) mul [ i ] = new Vector < Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( mul [ arr [ i ] ] . size ( ) > 1 ) { continue ; } mul [ arr [ i ] ] . add ( arr [ i ] ) ; } for ( int i = 1 ; i <= mx ; i ++ ) { for ( int j = i + i ; j <= mx ; j += i ) { if ( mul [ i ] . size ( ) > 1 ) { break ; } for ( int k : mul [ j ] ) { if ( mul [ i ] . size ( ) > 1 ) break ; mul [ i ] . add ( k ) ; } } } int ans = Integer . MAX_VALUE ; for ( int i = 1 ; i <= mx ; i ++ ) { if ( mul [ i ] . size ( ) <= 1 ) continue ; int a = mul [ i ] . get ( 0 ) , b = mul [ i ] . get ( 1 ) ; int lcm = ( a * b ) / i ; ans = Math . min ( ans , lcm ) ; } return ans ; } public static void main ( String [ ] args ) { int arr [ ] = { 2 , 4 , 3 , 6 , 5 } ; int n = arr . length ; System . out . print ( minLCM ( arr , n ) + "NEW_LINE"); } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j, k
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static int findArrangement ( int N ) { if ( N < 3 ) return 0 ; return ( ( N ) * ( N - 1 ) * ( N - 2 ) ) / 3 ; } public static void main ( String [ ] args ) { int N = 10 ; System . out . println ( findArrangement ( N ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static final int MOD = 7 ; static int inv ( int a ) { int o = 1 ; for ( int p = MOD - 2 ; p > 0 ; p >>= 1 ) { if ( ( p & 1 ) == 1 ) o = ( o * a ) % MOD ; a = ( a * a ) % MOD ; } return o ; } static int inv6 = inv ( 6 ) ; static int sumOfSquares ( int n ) { n %= MOD ; return ( ( ( n * ( n + 1 ) ) % MOD * ( 2 * n + 1 ) ) % MOD * inv6 ) % MOD ; } static int sums ( int n ) { if ( n < 4 ) return 0 ; int curStart = 2 , ans = 0 ; int sqrtN = ( int ) Math . sqrt ( n ) ; while ( curStart <= n / curStart ) { int V = n / ( curStart * curStart ) ; int end = ( int ) Math . sqrt ( n / V ) ; ans += ( n / ( curStart * curStart ) % MOD * ( sumOfSquares ( end ) + MOD - sumOfSquares ( curStart - 1 ) ) ) % MOD ; if ( ans >= MOD ) ans -= MOD ; curStart = end + 1 ; } return ans ; } public static void main ( String [ ] args ) { int input [ ] = { 5 } ; for ( int x : input ) { System . out . print ( " sum ▁ of ▁ all ▁ perfect ▁ " + " square ▁ divisors ▁ from ▁ " + "1 ▁ to ▁ " + x + " ▁ is : ▁ " ) ; System . out . print ( x + sums ( x ) + "NEW_LINE"); } } }

Accumulator variables: ans
Iterator variables: p, x
Class/struct names: GFG
Java program:
class GFG { static boolean isSuffix ( String s1 , String s2 ) { int n1 = s1 . length ( ) ; int n2 = s2 . length ( ) ; if ( n1 > n2 ) return false ; for ( int i = 0 ; i < n1 ; i ++ ) if ( s1 . charAt ( n1 - i - 1 ) != s2 . charAt ( n2 - i - 1 ) ) return false ; return true ; } static boolean CheckBinaryEquivalent ( int N ) { int B_Number = 0 ; int cnt = 0 ; while ( N != 0 ) { int rem = N % 2 ; int c = ( int ) Math . pow ( 10 , cnt ) ; B_Number += rem * c ; N /= 2 ; cnt ++ ; } String bin = Integer . toString ( B_Number ) ; return isSuffix ( "001" , bin ) ; } public static void main ( String [ ] args ) { int N = 9 ; if ( CheckBinaryEquivalent ( N ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Accumulator variables: B_Number, N, cnt, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static boolean CheckBinaryEquivalent ( int N ) { return ( N - 1 ) % 8 == 0 ; } public static void main ( String [ ] args ) { int N = 9 ; if ( CheckBinaryEquivalent ( N ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; import java . math . * ; class GFG { static ArrayList < Integer > get_divisors ( int A ) { ArrayList < Integer > ans = new ArrayList < > ( ) ; ans . add ( 1 ) ; for ( int i = 2 ; i <= Math . sqrt ( A ) ; i ++ ) { if ( A % i == 0 ) { ans . add ( i ) ; if ( ( i * i ) != A ) ans . add ( A / i ) ; } } return ans ; } static boolean Sum_Possible ( ArrayList < Integer > set , int sum ) { int n = set . size ( ) ; 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 boolean Is_Practical ( int A ) { ArrayList < Integer > divisors ; divisors = get_divisors ( A ) ; for ( int i = 2 ; i < A ; i ++ ) { if ( Sum_Possible ( divisors , i ) == false ) return false ; } return true ; } static void print_practica_No ( int A , int B ) { for ( int i = A ; i <= B ; i ++ ) { if ( Is_Practical ( i ) == true ) { System . out . print ( i + " ▁ " ) ; } } } public static void main ( String args [ ] ) { int A = 1 , B = 100 ; print_practica_No ( A , B ) ; } }

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 float maxDivision ( Integer arr [ ] , int n ) { Arrays . sort ( arr , Collections . reverseOrder ( ) ) ; float mxdiv = arr [ 1 ] ; for ( int i = 2 ; i < n ; ++ i ) mxdiv = mxdiv / arr [ i ] ; return arr [ 0 ] / mxdiv ; } public static void main ( String [ ] args ) { Integer arr [ ] = { 100 , 1000 , 10 , 2 } ; int n = arr . length ; System . out . print ( ( int ) maxDivision ( arr , n ) ) ; } }

Index/key variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void coPrimeSet ( int n ) { int firstadj , secadj ; if ( n < 4 ) { System . out . print ( " ( ▁ " ) ; for ( int i = 1 ; i <= n ; i ++ ) System . out . print ( i + " , ▁ " ) ; System . out . print ( ")NEW_LINE"); } else { if ( n % 2 == 0 ) { for ( int i = 0 ; i < n / 2 ; i ++ ) { firstadj = 2 * i + 1 ; secadj = 2 * i + 2 ; System . out . print ( " ( " + firstadj + " , ▁ " + secadj + ")NEW_LINE"); } } else { for ( int i = 0 ; i < n / 2 - 1 ; i ++ ) { firstadj = 2 * i + 1 ; secadj = 2 * i + 2 ; System . out . print ( " ( " + firstadj + " , ▁ " + secadj + ")NEW_LINE"); } System . out . print ( " ( " + ( n - 2 ) + " , ▁ " + ( n - 1 ) + " , ▁ " + n + ")NEW_LINE"); } } } public static void main ( String [ ] args ) { int n = 5 ; coPrimeSet ( n ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { public static void main ( String args [ ] ) { int N = 21 ; int A = ( int ) ( Math . sqrt ( 2 * N + 0.25 ) - 0.5 ) ; int B = A ; if ( B != A ) System . out . print ( " - 1" ) ; else System . out . print ( B ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static long operation ( int arr [ ] , int N ) { int right = 0 ; int num = 0 ; long ans = 0 ; for ( int left = 0 ; left < N ; left ++ ) { while ( right < N && num + arr [ right ] == ( num ^ arr [ right ] ) ) { num += arr [ right ] ; right ++ ; } ans += right - left ; if ( left == right ) right ++ ; else num -= arr [ left ] ; } return ans ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 , 3 , 4 , 5 } ; int N = arr . length ; System . out . println ( operation ( arr , N ) ) ; } }

Index/key variables: left, right
Accumulator variables: ans, left, num, right
Iterator variables: left
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { public static boolean [ ] sieveOfEratosthenes ( int N ) { boolean [ ] isPrime = new boolean [ N + 1 ] ; for ( int i = 0 ; i < N + 1 ; i ++ ) { isPrime [ i ] = true ; } isPrime [ 0 ] = false ; isPrime [ 1 ] = false ; for ( int i = 2 ; i * i <= N ; i ++ ) { if ( isPrime [ i ] == true ) { int j = 2 ; while ( i * j <= N ) { isPrime [ i * j ] = false ; j ++ ; } } } return isPrime ; } public static int numPairsWithPrimeSum ( int [ ] arr , int n ) { int N = 2 * 1000000 ; boolean [ ] isPrime = sieveOfEratosthenes ( N ) ; int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { int sum = arr [ i ] + arr [ j ] ; if ( isPrime [ sum ] ) { count ++ ; } } } return count ; } public static void main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 4 , 5 } ; int n = arr . length ; System . out . println ( numPairsWithPrimeSum ( arr , n ) ) ; } }

Index/key variables: i, j, sum
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { public static int [ ] digit = new int [ 10 ] ; public static void digitsPresent ( int n ) { int lastDigit ; while ( n != 0 ) { lastDigit = n % 10 ; digit [ lastDigit ] = 1 ; n /= 10 ; } } public static int checkLastDigit ( int num ) { int count = 0 ; int lastDigit ; lastDigit = num % 10 ; if ( digit [ lastDigit ] == 1 ) count ++ ; return count ; } public static void findCount ( int N , int K , int arr [ ] ) { int count = 0 ; for ( int i = 0 ; i < K ; i ++ ) { count = checkLastDigit ( arr [ i ] ) == 1 ? count + 1 : count ; } System . out . println ( count ) ; } public static void main ( String [ ] args ) { int N = 1731 ; digitsPresent ( N ) ; int K = 5 ; int arr [ ] = { 57 , 6786 , 1111 , 3 , 9812 } ; findCount ( N , K , arr ) ; } }

Index/key variables: i, lastDigit
Accumulator variables: count, i, n
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean divisorsSame ( int n ) { return ( n - 2 ) % 4 == 0 ; } public static void main ( String [ ] args ) { int N = 6 ; if ( divisorsSame ( N ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int find ( int K , int N ) { N -- ; while ( N -- != 0 ) { int curr_term = K ; int min_d = 9 ; int max_d = 0 ; while ( curr_term > 0 ) { int r = curr_term % 10 ; min_d = Math . min ( min_d , r ) ; max_d = Math . max ( max_d , r ) ; curr_term = curr_term / 10 ; } if ( min_d == 0 ) { break ; } K = K + min_d * max_d ; } return K ; } public static void main ( String [ ] args ) { int K = 487 ; int N = 2 ; System . out . print ( find ( K , N ) + "NEW_LINE"); } }

Accumulator variables: N
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static long countSubarrays ( int arr [ ] , int n ) { HashMap < Integer , Integer > mp = new HashMap < Integer , Integer > ( ) ; int [ ] prefixSum = new int [ n ] ; int prefixMin = 0 ; prefixSum [ 0 ] = arr [ 0 ] ; prefixMin = Math . min ( prefixMin , prefixSum [ 0 ] ) ; for ( int i = 1 ; i < n ; i ++ ) { prefixSum [ i ] = prefixSum [ i - 1 ] + arr [ i ] ; prefixMin = Math . min ( prefixMin , prefixSum [ i ] ) ; } long countSubs = 0 ; mp . put ( 0 , 1 ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; prefixSum [ i ] - j * j >= prefixMin ; j ++ ) { if ( mp . containsKey ( prefixSum [ i ] - j * j ) ) countSubs += mp . get ( prefixSum [ i ] - j * j ) ; } if ( mp . containsKey ( prefixSum [ i ] ) ) { mp . put ( prefixSum [ i ] , mp . get ( prefixSum [ i ] ) + 1 ) ; } else { mp . put ( prefixSum [ i ] , 1 ) ; } } return countSubs ; } public static void main ( String [ ] args ) { int arr [ ] = { 2 , 3 , - 5 , 6 , - 7 , 4 } ; int n = arr . length ; long ans = countSubarrays ( arr , n ) ; System . out . print ( ans ) ; } }

Index/key variables: i, n
Accumulator variables: countSubs, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static boolean checkSolution ( float a1 , float b1 , float c1 , float a2 , float b2 , float c2 ) { return ( ( a1 / a2 ) == ( b1 / b2 ) && ( b1 / b2 ) == ( c1 / c2 ) ) ; } public static void main ( String [ ] args ) { float a1 = 1 , b1 = - 5 , c1 = 6 ; float a2 = 2 , b2 = - 10 , c2 = 12 ; if ( checkSolution ( a1 , b1 , c1 , a2 , b2 , c2 ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void checkSolution ( int a , int b , int c ) { if ( b == 0 ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } public static void main ( String args [ ] ) { int a = 2 , b = 0 , c = 2 ; checkSolution ( a , b , c ) ; } }

Class/struct names: GFG
Java program:
class GFG { public static void positiveProduct ( int arr [ ] , int n ) { int even_count = 0 ; int odd_count = 0 ; int total_count = 0 ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( total_count % 2 == 0 ) { even_count ++ ; } else { odd_count ++ ; } if ( arr [ i ] < 0 ) { total_count ++ ; } if ( total_count % 2 == 0 ) ans += even_count ; else ans += odd_count ; } System . out . println ( ans ) ; } public static void main ( String [ ] args ) { int A [ ] = { 5 , - 3 , 3 , - 1 , 1 } ; int size = A . length ; positiveProduct ( A , size ) ; } }

Index/key variables: i
Accumulator variables: ans, even_count, i, odd_count, total_count
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void findPair ( int x ) { int lim = 120 ; for ( int i = - lim ; i <= lim ; i ++ ) { for ( int j = - lim ; j <= lim ; j ++ ) { if ( Math . pow ( i , 5 ) - Math . pow ( j , 5 ) == x ) { System . out . print ( i + " ▁ " + j + "NEW_LINE"); return ; } } } System . out . print ( " - 1" ) ; } public static void main ( String [ ] args ) { int X = 33 ; findPair ( X ) ; } }

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