dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
public class GFG { static int floorMod ( int a , int n ) { int q = ( int ) Math . floor ( ( double ) a / n ) ; return a - n * q ; } public static void main ( String [ ] args ) { int a , b ; a = 9 ; b = 4 ; System . out . println ( a + " ▁ % ▁ " + b + " ▁ = ▁ " + floorMod ( a , b ) ) ; a = - 9 ; b = 4 ; System . out . println ( a + " ▁ % ▁ " + b + " ▁ = ▁ " + floorMod ( a , b ) ) ; a = 9 ; b = - 4 ; System . out . println ( a + " ▁ % ▁ " + b + " ▁ = ▁ " + floorMod ( a , b ) ) ; a = - 9 ; b = - 4 ; System . out . println ( a + " ▁ % ▁ " + b + " ▁ = ▁ " + floorMod ( a , b ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static void printArray ( int [ ] arr , int N ) { for ( int i = 0 ; i < N ; i ++ ) { System . out . print ( arr [ i ] + " ▁ " ) ; } } static void nearestPowerDiff ( int [ ] arr , int N , int a , int b ) { for ( int i = 0 ; i < N ; i ++ ) { int log_a = ( int ) ( Math . log ( arr [ i ] ) / Math . log ( a ) ) ; int A = ( int ) ( Math . pow ( a , log_a ) ) ; int B = ( int ) ( Math . pow ( a , log_a + 1 ) ) ; if ( ( arr [ i ] - A ) < ( B - arr [ i ] ) ) log_a = A ; else log_a = B ; int log_b = ( int ) ( Math . log ( arr [ i ] ) / Math . log ( b ) ) ; A = ( int ) ( Math . pow ( b , log_b ) ) ; B = ( int ) ( Math . pow ( b , log_b + 1 ) ) ; if ( ( arr [ i ] - A ) < ( B - arr [ i ] ) ) log_b = A ; else log_b = B ; arr [ i ] = Math . abs ( log_a - log_b ) ; } printArray ( arr , N ) ; } public static void main ( String [ ] args ) { int [ ] arr = { 5 , 12 , 25 } ; int A = 2 , B = 3 ; int N = arr . length ; nearestPowerDiff ( arr , N , A , B ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int bitOr ( int arr [ ] , int N ) { int count = 0 ; int length = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] % 2 == 0 ) { length ++ ; } else { if ( length != 0 ) { count += ( ( length ) * ( length + 1 ) ) / 2 ; } length = 0 ; } } count += ( ( length ) * ( length + 1 ) ) / 2 ; return count ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 5 , 4 , 2 , 6 } ; int N = arr . length ; System . out . print ( bitOr ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: count, i, length
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void ValidPairs ( int X , int K ) { int count = 0 ; for ( int A = - 1000 ; A <= 1000 ; A ++ ) { for ( int B = - 1000 ; B <= 1000 ; B ++ ) { if ( Math . pow ( A , K ) - Math . pow ( B , K ) == X ) { count ++ ; System . out . println ( A + " ▁ " + B ) ; } } } if ( count == 0 ) { System . out . println ( " - 1" ) ; } } public static void main ( String args [ ] ) { int X = 33 ; int K = 5 ; ValidPairs ( X , K ) ; } }

Accumulator variables: A, B, count
Iterator variables: A, B
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int maximumAND ( int arr [ ] , int n , int m ) { int tot = 1 << n ; int mx = 0 ; for ( int bm = 0 ; bm < tot ; bm ++ ) { int andans = 0 ; int count = 0 ; for ( int i = 0 ; i < n ; ++ i ) { if ( ( ( bm >> i ) & 1 ) != 0 ) { if ( count == 0 ) { andans = arr [ i ] ; } else { andans = andans & arr [ i ] ; } count ++ ; } } if ( count == ( m + 1 ) ) { mx = Math . max ( mx , andans ) ; } } return mx ; } public static void main ( String args [ ] ) { int arr [ ] = { 1 , 2 , 3 , 4 } ; int N = arr . length ; int M = 2 ; System . out . println ( maximumAND ( arr , N , M ) ) ; } }

Index/key variables: i
Accumulator variables: bm, count
Iterator variables: bm, i
Class/struct names: GFG
Java program:
import java . io . * ; import java . lang . * ; import java . util . * ; class GFG { static void findTotalSum ( String ops [ ] ) { if ( ops . length == 0 ) { System . out . println ( 0 ) ; return ; } Stack < Integer > pts = new Stack < > ( ) ; int ans = 0 ; for ( int i = 0 ; i < ops . length ; i ++ ) { if ( ops [ i ] == " C " ) { ans -= pts . pop ( ) ; } else if ( ops [ i ] == " D " ) { pts . push ( pts . peek ( ) * 2 ) ; ans += pts . peek ( ) ; } else if ( ops [ i ] == " + " ) { int a = pts . pop ( ) ; int b = pts . peek ( ) ; pts . push ( a ) ; ans += ( a + b ) ; pts . push ( a + b ) ; } else { int n = Integer . parseInt ( ops [ i ] ) ; ans += n ; pts . push ( n ) ; } } System . out . println ( ans ) ; } public static void main ( String [ ] args ) { String arr [ ] = { "5" , " - 2" , " C " , " D " , " + " } ; findTotalSum ( arr ) ; } }

Index/key variables: i
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . lang . * ; import java . util . * ; class GFG { static void findXOR ( int mat [ ] [ ] [ ] , int N ) { int XOR = 0 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) { for ( int k = 0 ; k < N ; k ++ ) { if ( ( i == j && j == k ) ) { XOR ^= mat [ i ] [ j ] [ k ] ; XOR ^= mat [ i ] [ j ] [ N - k - 1 ] ; } } } } System . out . println ( XOR ) ; } public static void main ( String [ ] args ) { int mat [ ] [ ] [ ] = { { { 1 , 2 } , { 3 , 4 } } , { { 5 , 6 } , { 7 , 8 } } } ; int N = mat . length ; findXOR ( mat , N ) ; } }

Index/key variables: i, j, k
Accumulator variables: XOR, i, j, k
Iterator variables: i, j, k
Class/struct names: GFG
Java program:
import java . io . * ; import java . lang . * ; import java . util . * ; class GFG { static void findXOR ( int mat [ ] [ ] [ ] , int N ) { int XOR = 0 ; for ( int i = 0 ; i < N ; i ++ ) { XOR ^= mat [ i ] [ i ] [ i ] ; XOR ^= mat [ i ] [ i ] [ N - i - 1 ] ; } System . out . println ( XOR ) ; } public static void main ( String [ ] args ) { int mat [ ] [ ] [ ] = { { { 1 , 2 } , { 3 , 4 } } , { { 5 , 6 } , { 7 , 8 } } } ; int N = mat . length ; findXOR ( mat , N ) ; } }

Index/key variables: i
Accumulator variables: XOR, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int MAX = 300004 ; static ArrayList < ArrayList < Integer > > graph ; static long mod = ( long ) 1e9 + 7 ; static int ans = 0 ; static int countSubtreesUtil ( int cur , int par ) { int res = 1 ; for ( int i = 0 ; i < graph . get ( cur ) . size ( ) ; i ++ ) { int v = graph . get ( cur ) . get ( i ) ; if ( v == par ) continue ; res = ( int ) ( ( res * ( countSubtreesUtil ( v , cur ) + 1 ) ) % mod ) ; } ans = ( int ) ( ( ans + res ) % mod ) ; return res ; } static void countSubtrees ( int N , int [ ] [ ] adj ) { for ( int i = 0 ; i < N - 1 ; i ++ ) { int a = adj [ i ] [ 0 ] ; int b = adj [ i ] [ 1 ] ; graph . get ( a ) . add ( b ) ; graph . get ( b ) . add ( a ) ; } countSubtreesUtil ( 1 , 1 ) ; System . out . println ( ans + 1 ) ; } public static void main ( String [ ] args ) { int N = 3 ; int [ ] [ ] adj = { { 0 , 1 } , { 1 , 2 } } ; graph = new ArrayList < > ( ) ; for ( int i = 0 ; i < MAX ; i ++ ) graph . add ( new ArrayList < > ( ) ) ; countSubtrees ( N , adj ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void checkWinner ( int arr [ ] , int N ) { int diff = 0 ; for ( int i = 0 ; i < N ; i ++ ) { diff -= arr [ i ] ; } if ( diff % 2 == 0 ) { System . out . println ( " A " ) ; } else { System . out . println ( " B " ) ; } } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 } ; int N = arr . length ; checkWinner ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: diff, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void constructArray ( int N ) { ArrayList < Integer > ans = new ArrayList < Integer > ( ) ; for ( int i = 1 ; i * i <= N ; i ++ ) { if ( N % i == 0 ) { ans . add ( i ) ; if ( N != ( i * i ) ) { ans . add ( N / i ) ; } } } for ( int it : ans ) { System . out . print ( it + " ▁ " ) ; } } public static void main ( String [ ] args ) { int N = 12 ; constructArray ( N ) ; } }

Accumulator variables: i
Iterator variables: i, it
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int gcd ( int a , int b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } static int maximumRowValue ( int n , int m ) { return gcd ( n , m ) ; } public static void main ( String args [ ] ) { int N = 4 ; int M = 2 ; System . out . print ( maximumRowValue ( N , M ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int MOD = 998244353 ; static void findConvolution ( int [ ] a , int [ ] b ) { int n = a . length , m = b . length ; int [ ] c = new int [ ( n + m - 1 ) ] ; for ( int i = 0 ; i < n ; ++ i ) { for ( int j = 0 ; j < m ; ++ j ) { c [ i + j ] += ( a [ i ] * b [ j ] ) % MOD ; } } for ( int k = 0 ; k < c . length ; ++ k ) { c [ k ] %= MOD ; System . out . print ( c [ k ] + " ▁ " ) ; } } public static void main ( String args [ ] ) { int [ ] A = { 1 , 2 , 3 , 4 } ; int [ ] B = { 5 , 6 , 7 , 8 , 9 } ; findConvolution ( A , B ) ; } }

Index/key variables: i, j, k
Iterator variables: i, j, k
Class/struct names: GFG
Java program:
class GFG { static int count1s ( int start_i , int start_j , int end_i , int end_j , int [ ] [ ] mat ) { int count = 0 ; for ( int x = start_i ; x < end_i ; x ++ ) { for ( int y = start_j ; y < end_j ; y ++ ) { if ( mat [ x ] [ y ] == 1 ) count ++ ; } } return count ; } static int findMinimumCount ( int N , int M , int A , int B , int [ ] [ ] mat ) { int minimum = ( int ) 1e9 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < M ; j ++ ) { if ( i + A <= N && j + B <= M ) { int count = count1s ( i , j , i + A , j + B , mat ) ; minimum = Math . min ( count , minimum ) ; } if ( i + B <= N && j + A <= M ) { int count = count1s ( i , j , i + B , j + A , mat ) ; minimum = Math . min ( count , minimum ) ; } } } return minimum ; } public static void main ( String [ ] args ) { int A = 2 , B = 2 ; int N = 3 , M = 4 ; int [ ] [ ] mat = { { 1 , 0 , 1 , 0 } , { 0 , 1 , 0 , 1 } , { 1 , 0 , 1 , 0 } } ; System . out . println ( findMinimumCount ( N , M , A , B , mat ) ) ; } }

Index/key variables: x, y
Accumulator variables: count, i, j, x, y
Iterator variables: i, j, x, y
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static boolean checkEvenPower ( int n ) { int x = 0 ; while ( x < n ) { int value = ( int ) Math . pow ( 2 , x ) ; if ( value == n ) { if ( x % 2 == 0 ) return true ; else return false ; } x ++ ; } return false ; } public static void main ( String [ ] args ) { int N = 4 ; System . out . println ( ( checkEvenPower ( N ) ? " Yes " : " No " ) ) ; } }

Accumulator variables: x
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static String checkEvenPower ( int n ) { int low = 0 , high = n ; while ( low <= high ) { int mid = low + ( high - low ) / 2 ; int value = ( int ) Math . pow ( 2 , mid ) ; if ( value == n ) { if ( mid % 2 == 1 ) return " No " ; else return " Yes " ; } else if ( value < n ) low = mid + 1 ; else high = mid - 1 ; } return " No " ; } public static void main ( String [ ] args ) { int N = 4 ; System . out . println ( checkEvenPower ( N ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static boolean checkEvenPower ( long N ) { if ( ( N & ( N - 1 ) ) != 0 ) return false ; N = N & 0x55555555 ; return ( N > 0 ) ; } public static void main ( String [ ] args ) { long N = 4 ; System . out . println ( checkEvenPower ( N ) ? 1 : 0 ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void findSum ( int N , int K ) { int ans = 0 ; int i = 1 ; while ( i <= N ) { ans += N / i ; i = i * K ; } System . out . println ( ans ) ; } public static void main ( String [ ] args ) { int N = 10 , K = 2 ; findSum ( N , K ) ; } }

Accumulator variables: ans
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int countAPs ( int S , int D ) { S = S * 2 ; int answer = 0 ; for ( int i = 1 ; i <= Math . sqrt ( S ) ; i ++ ) { if ( S % i == 0 ) { if ( ( ( S / i ) - D * i + D ) % 2 == 0 ) answer ++ ; if ( ( D * i - ( S / i ) + D ) % 2 == 0 ) answer ++ ; } } return answer ; } public static void main ( String [ ] args ) { int S = 12 , D = 1 ; System . out . println ( countAPs ( S , D ) ) ; } }

Accumulator variables: answer, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void minimumInsertions ( int arr [ ] , int N , int K ) { boolean possible = true ; int res = 0 ; int last = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] >= K ) { possible = false ; break ; } if ( last + arr [ i ] > K ) res ++ ; last = arr [ i ] ; } if ( possible ) { System . out . print ( res ) ; } else { System . out . print ( " - 1" ) ; } } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 , 3 , 4 , 5 } ; int K = 6 ; int N = arr . length ; minimumInsertions ( arr , N , K ) ; } }

Index/key variables: i
Accumulator variables: i, res
Iterator variables: i
Boolean variables: possible
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int distinct ( int arr [ ] , int n ) { Set < Integer > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { set . add ( arr [ i ] ) ; } return set . size ( ) ; } static int maxSubSum ( int arr [ ] , int n , int k , int totalDistinct ) { if ( k > n ) return 0 ; int max = 0 , sum = 0 ; for ( int i = 0 ; i < n - k + 1 ; i ++ ) { sum = 0 ; Set < Integer > set = new HashSet < > ( ) ; for ( int j = i ; j < i + k ; j ++ ) { sum += arr [ j ] ; set . add ( arr [ j ] ) ; } if ( set . size ( ) == totalDistinct ) max = Math . max ( sum , max ) ; } return max ; } public static void main ( String args [ ] ) { int arr [ ] = { 7 , 7 , 2 , 4 , 2 , 7 , 4 , 6 , 6 , 6 } ; int K = 6 ; int N = arr . length ; int totalDistinct = distinct ( arr , N ) ; System . out . println ( maxSubSum ( arr , N , K , totalDistinct ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, sum
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int distinct ( int arr [ ] , int N ) { Set < Integer > set = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { set . add ( arr [ i ] ) ; } return set . size ( ) ; } static int maxSubarraySumUtil ( int arr [ ] , int N , int K , int totalDistinct ) { if ( K > N ) return 0 ; int max = 0 ; int sum = 0 ; Map < Integer , Integer > map = new HashMap < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { map . put ( arr [ i ] , map . getOrDefault ( arr [ i ] , 0 ) + 1 ) ; sum += arr [ i ] ; if ( i >= K ) { map . put ( arr [ i - K ] , map . get ( arr [ i - K ] ) - 1 ) ; sum -= arr [ i - K ] ; if ( map . get ( arr [ i - K ] ) == 0 ) map . remove ( arr [ i - K ] ) ; } if ( map . size ( ) == totalDistinct ) max = Math . max ( max , sum ) ; } return max ; } static void maxSubarraySum ( int arr [ ] , int K ) { int N = arr . length ; int totalDistinct = distinct ( arr , N ) ; System . out . println ( maxSubarraySumUtil ( arr , N , K , totalDistinct ) ) ; } public static void main ( String args [ ] ) { int arr [ ] = { 7 , 7 , 2 , 4 , 2 , 7 , 4 , 6 , 6 , 6 } ; int K = 6 ; maxSubarraySum ( arr , K ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static int mod = 1000000007 ; static int power ( int x , int y ) { int res = 1 ; x = x % mod ; if ( x == 0 ) return 0 ; while ( y > 0 ) { if ( ( y & 1 ) != 0 ) res = ( res * x ) % mod ; y = y >> 1 ; x = ( x * x ) % mod ; } return res ; } static int irreflexiveRelation ( int N ) { return power ( 2 , N * N - N ) ; } public static void main ( String [ ] args ) { int N = 2 ; System . out . println ( irreflexiveRelation ( N ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; import java . lang . * ; import java . util . * ; class GFG { static void countAPs ( long N ) { long count = 0 ; for ( long i = 1 ; i * i <= 2 * N ; i ++ ) { long res = 2 * N ; if ( res % i == 0 ) { long op = res / i - i + 1 ; if ( op % 2 == 0 ) { count ++ ; } if ( i * i != res && ( i - res / i + 1 ) % 2 == 0 ) { count ++ ; } } } System . out . println ( count - 1 ) ; } public static void main ( String [ ] args ) { long N = 963761198400L ; countAPs ( N ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static int [ ] sieve = new int [ 105 ] ; static void buildSieve ( ) { for ( int i = 2 ; i < 100 ; i ++ ) sieve [ i ] = 1 ; for ( int i = 2 ; i < 100 ; i ++ ) { if ( sieve [ i ] == 1 ) { for ( int j = i * i ; j < 100 ; j += i ) sieve [ j ] = 0 ; } } } static boolean isAnyPrime ( int first , int last ) { int num1 = first * 10 + last ; int num2 = last * 10 + first ; if ( sieve [ num1 ] == 1 sieve [ num2 ] == 1 ) return true ; else return false ; } static void performQueries ( int [ ] q ) { for ( int i = 0 ; i < q . length ; i ++ ) { int A = q [ i ] ; int last = A % 10 ; int first ; while ( A >= 10 ) A = A / 10 ; first = A ; if ( isAnyPrime ( first , last ) ) System . out . println ( "TrueNEW_LINE"); else System . out . print ( "FalseNEW_LINE"); } } public static void main ( String [ ] args ) { int [ ] q = { 30 , 66 } ; buildSieve ( ) ; performQueries ( q ) ; } }

Index/key variables: i, j, num1, num2
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { public static String oddDivisor ( int N ) { int X = N ; while ( N % 2 == 0 ) { N /= 2 ; } for ( int i = 3 ; i * i <= X ; i += 2 ) { if ( N % i == 0 ) { return " Yes " ; } } if ( N != X ) { return " Yes " ; } return " No " ; } public static void main ( String [ ] args ) { int N = 10 ; System . out . println ( oddDivisor ( N ) ) ; } }

Accumulator variables: N, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; public class Pair { private final int key ; private final int value ; public Pair ( int aKey , int aValue ) { key = aKey ; value = aValue ; } public int key ( ) { return key ; } public int value ( ) { return value ; } } class GFG { static int [ ] arr = new int [ 10005 ] ; static int isPalindrome ( int n ) { int temp = n ; int res = 0 ; while ( temp != 0 ) { int rem = temp % 10 ; res = res * 10 + rem ; temp /= 10 ; } if ( res == n ) { return 1 ; } else return 0 ; } static void precompute ( ) { for ( int i = 1 ; i <= 10000 ; i ++ ) { if ( isPalindrome ( i * i * i ) != 0 ) arr [ i ] = 1 ; else arr [ i ] = 0 ; } for ( int i = 1 ; i <= 10000 ; i ++ ) { arr [ i ] = arr [ i ] + arr [ i - 1 ] ; } } public static void main ( String [ ] args ) { ArrayList < Pair > Q = new ArrayList < Pair > ( ) ; Pair pair = new Pair ( 2 , 7 ) ; Q . add ( pair ) ; Pair pair2 = new Pair ( 10 , 25 ) ; Q . add ( pair2 ) ; precompute ( ) ; for ( int i = 0 ; i < Q . size ( ) ; i ++ ) { System . out . println ( arr [ Q . get ( i ) . value ( ) ] - arr [ Q . get ( i ) . key ( ) - 1 ] ) ; } } }

Index/key variables: i
Accumulator variables: i, temp
Iterator variables: i
Class/struct names: GFG, Pair
Java program:
import java . io . * ; import java . lang . * ; import java . util . * ; public class GFG { static int arr [ ] = new int [ 100005 ] ; static boolean isDivisible ( int x ) { int sum = 0 ; int temp = x ; while ( x != 0 ) { sum += x % 10 ; x /= 10 ; } if ( temp % sum != 0 ) return false ; else return true ; } static void precompute ( ) { for ( int i = 1 ; i <= 100000 ; i ++ ) { if ( isDivisible ( i ) ) arr [ i ] = 1 ; else arr [ i ] = 0 ; } for ( int i = 1 ; i <= 100000 ; i ++ ) { arr [ i ] = arr [ i ] + arr [ i - 1 ] ; } } public static void main ( String [ ] args ) { int Q [ ] [ ] = { { 5 , 9 } , { 5 , 20 } } ; precompute ( ) ; for ( int q [ ] : Q ) { System . out . println ( arr [ q [ 1 ] ] - arr [ q [ 0 ] - 1 ] ) ; } } }

Index/key variables: i
Accumulator variables: i, sum, x
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; public class GFG { static int primes [ ] = new int [ 1000006 ] ; static int gcd ( int a , int b ) { if ( b == 0 ) return a ; else return gcd ( b , a % b ) ; } static void preprocess ( ) { for ( int i = 1 ; i <= 1000000 ; i ++ ) primes [ i ] = i ; for ( int i = 2 ; i * i <= 1000000 ; i ++ ) { if ( primes [ i ] == i ) { for ( int j = 2 * i ; j <= 1000000 ; j += i ) { if ( primes [ j ] == j ) primes [ j ] = i ; } } } } static int Steps ( int x , int m ) { int steps = 0 ; boolean flag = false ; while ( x > 1 ) { if ( primes [ x ] > m ) { flag = true ; break ; } x /= primes [ x ] ; steps ++ ; } if ( flag ) return - 1 ; return steps ; } static int minimumSteps ( int x , int y , int m ) { preprocess ( ) ; int g = gcd ( x , y ) ; x = x / g ; y = y / g ; int x_steps = Steps ( x , m ) ; int y_steps = Steps ( y , m ) ; if ( x_steps == - 1 y_steps == - 1 ) return - 1 ; return x_steps + y_steps ; } public static void main ( String args [ ] ) { int X = 160 ; int Y = 180 ; int M = 10 ; System . out . println ( minimumSteps ( X , Y , M ) ) ; } }

Index/key variables: i, j, x
Accumulator variables: i, j, steps, x
Iterator variables: i, j
Boolean variables: flag
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean isNonDeficient ( 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 >= 2 * n ; } static int LongestNonDeficientSubsequence ( int arr [ ] , int n ) { int res = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( isNonDeficient ( arr [ i ] ) ) { res += 1 ; } } return res ; } public static void main ( String [ ] args ) { int arr [ ] = { 13 , 55 , 240 , 32 , 24 , 27 , 56 , 80 , 100 , 330 , 89 } ; int N = arr . length ; System . out . print ( LongestNonDeficientSubsequence ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: i, res
Iterator variables: i
Class/struct names: GFG
Java program:
import java . lang . * ; class GFG { static boolean isPronic ( int n ) { int range = ( int ) Math . sqrt ( n ) ; for ( int i = 0 ; i < range + 1 ; i ++ ) { if ( i * ( i + 1 ) == n ) return true ; } return false ; } static int countSub ( int [ ] arr , int n ) { int ans = 0 ; int ispro = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( isPronic ( arr [ i ] ) ) ispro += 1 ; else ispro = 0 ; ans += ispro ; } return ans ; } public static void main ( String [ ] args ) { int [ ] arr = { 5 , 6 , 12 , 3 , 4 } ; int n = arr . length ; System . out . print ( countSub ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: ans, i, ispro
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int LOG ( int a , int b ) { return ( int ) ( Math . log ( a ) / Math . log ( b ) ) ; } static void repbyNP ( int [ ] arr , int n ) { int x = arr [ n - 1 ] ; for ( int i = 0 ; i < n ; i ++ ) { int k = LOG ( arr [ i ] , x ) ; int temp = arr [ i ] ; if ( Math . abs ( Math . pow ( x , k ) - arr [ i ] ) < Math . abs ( Math . pow ( x , k + 1 ) - arr [ i ] ) ) arr [ i ] = ( int ) Math . pow ( x , k ) ; else arr [ i ] = ( int ) Math . pow ( x , k + 1 ) ; x = temp ; } } public static void main ( String [ ] args ) { int arr [ ] = { 2 , 4 , 6 , 3 , 11 } ; int n = arr . length ; repbyNP ( arr , n ) ; for ( int i = 0 ; i < n ; i ++ ) System . out . print ( arr [ i ] + " ▁ " ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { public static int lastElement ( int arr [ ] , int n ) { int sum = 0 ; int multiplier = n % 2 == 0 ? - 1 : 1 ; for ( int i = 0 ; i < n ; i ++ ) { sum += arr [ i ] * multiplier ; multiplier = multiplier * ( n - 1 - i ) / ( i + 1 ) * ( - 1 ) ; } return sum ; } public static void main ( String [ ] args ) { int arr [ ] = { 3 , 4 , 2 , 1 } ; int N = 4 ; System . out . println ( lastElement ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG