dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
import java . io . * ; class Main { static int val ( char c ) { if ( c >= '0' && c <= '9' ) return ( int ) c - '0' ; else return ( int ) c - ' A ' + 10 ; } static int toDeci ( String str , int base ) { int len = str . length ( ) ; int power = 1 ; int num = 0 ; int i ; for ( i = len - 1 ; i >= 0 ; i -- ) { if ( val ( str . charAt ( i ) ) >= base ) { System . out . println ( " Invalid ▁ Number " ) ; return - 1 ; } num += val ( str . charAt ( i ) ) * power ; power = power * base ; } return num ; } public static boolean isEven ( String num , int N ) { int deci = toDeci ( num , N ) ; return ( deci % 2 == 0 ) ; } public static void main ( String [ ] args ) { String num = "11A " ; int N = 16 ; if ( isEven ( num , N ) ) { System . out . println ( " Even " ) ; } else { System . out . println ( " Odd " ) ; } } }

Accumulator variables: i, num
Iterator variables: i
Class/struct names: Main
Java program:
class GFG { final static int fact [ ] = new int [ 21 ] ; static void preCompute ( ) { fact [ 0 ] = 1 ; for ( int i = 1 ; i < 18 ; i ++ ) fact [ i ] = ( fact [ i - 1 ] * i ) ; } static void nextFactorial ( int N ) { for ( int i = 0 ; i < 21 ; i ++ ) { if ( N < fact [ i ] ) { System . out . println ( fact [ i ] ) ; break ; } } } public static void main ( String [ ] args ) { preCompute ( ) ; int N = 120 ; nextFactorial ( N ) ; } }

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

Accumulator variables: i, sum, val
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void checkArray ( int a [ ] , int b [ ] , int n ) { int operations = 0 ; int i = 0 ; while ( i < n ) { if ( a [ i ] - b [ i ] == 0 ) { i ++ ; continue ; } int diff = a [ i ] - b [ i ] ; i ++ ; while ( i < n && a [ i ] - b [ i ] == diff ) { i ++ ; } operations ++ ; } System . out . println ( operations ) ; } public static void main ( String [ ] args ) { int a [ ] = { 3 , 7 , 1 , 4 , 1 , 2 } ; int b [ ] = { 3 , 7 , 3 , 6 , 3 , 2 } ; int size = a . length ; checkArray ( a , b , size ) ; } }

Index/key variables: i
Accumulator variables: i, operations
Class/struct names: GFG
Java program:
import java . io . * ; import java . lang . * ; import java . util . * ; class GFG { public static HashMap < Integer , Integer > insertPF ( HashMap < Integer , Integer > primeFact , int fact ) { if ( primeFact . containsKey ( fact ) ) { int freq ; freq = primeFact . get ( fact ) ; primeFact . replace ( fact , ++ freq ) ; } else { primeFact . put ( fact , 1 ) ; } return primeFact ; } public static HashMap < Integer , Integer > primeFactors ( int n ) { HashMap < Integer , Integer > primeFact = new HashMap < > ( ) ; while ( n % 2 == 0 ) { primeFact = insertPF ( primeFact , 2 ) ; n /= 2 ; } for ( int i = 3 ; i <= Math . sqrt ( n ) ; i += 2 ) { while ( n % i == 0 ) { primeFact = insertPF ( primeFact , i ) ; n /= i ; } } if ( n > 2 ) primeFact = insertPF ( primeFact , n ) ; return primeFact ; } public static String perfectCube ( int n ) { HashMap < Integer , Integer > primeFact ; primeFact = primeFactors ( n ) ; for ( int freq : primeFact . values ( ) ) { if ( freq % 3 != 0 ) return " No " ; } return " Yes " ; } public static void main ( String [ ] args ) { int N = 216 ; System . out . println ( perfectCube ( N ) ) ; } }

Accumulator variables: i, n
Iterator variables: freq, i
Class/struct names: GFG
Java program:
class GFG { static int factorial ( int n ) { return ( n == 1 n == 0 ) ? 1 : n * factorial ( n - 1 ) ; } static int ways ( int n ) { if ( n < 3 ) { return 0 ; } int c2 = 0 ; int c1 = n - 3 ; int l = c1 + 1 ; int s = 0 ; int exp_c2 = c1 / 2 ; while ( exp_c2 >= c2 ) { int f1 = factorial ( l ) ; int f2 = factorial ( c1 ) ; int f3 = factorial ( c2 ) ; int f4 = ( f2 * f3 ) ; s += f1 / f4 ; c2 += 1 ; c1 -= 2 ; l -= 1 ; } return s ; } public static void main ( String args [ ] ) { int n = 7 ; int ans = ways ( n ) ; System . out . println ( ans ) ; } }

Accumulator variables: c1, c2, l, s
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static Map < Integer , Integer > m = new HashMap < Integer , Integer > ( ) ; static void precompute ( ) { int fact = 1 ; for ( int i = 1 ; i <= 18 ; i ++ ) { fact = fact * i ; m . put ( fact , i ) ; } } public static void main ( String [ ] args ) { precompute ( ) ; int K = 120 ; System . out . print ( m . get ( K ) + "NEW_LINE"); K = 6 ; System . out . print ( m . get ( K ) + "NEW_LINE"); } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int calNum ( int year ) { return ( year / 4 ) - ( year / 100 ) + ( year / 400 ) ; } static void leapNum ( int l , int r ) { l -- ; int num1 = calNum ( r ) ; int num2 = calNum ( l ) ; System . out . print ( num1 - num2 + "NEW_LINE"); } public static void main ( String [ ] args ) { int l1 = 1 , r1 = 400 ; leapNum ( l1 , r1 ) ; int l2 = 400 , r2 = 2000 ; leapNum ( l2 , r2 ) ; } }

Accumulator variables: l
Class/struct names: GFG
Java program:
class GFG { static class Cantor { double start , end ; Cantor next ; } ; static Cantor Cantor ; static Cantor startList ( Cantor head , double start_num , double end_num ) { if ( head == null ) { head = new Cantor ( ) ; head . start = start_num ; head . end = end_num ; head . next = null ; } return head ; } static Cantor propagate ( Cantor head ) { Cantor temp = head ; if ( temp != null ) { Cantor newNode = new Cantor ( ) ; double diff = ( ( ( temp . end ) - ( temp . start ) ) / 3 ) ; newNode . end = temp . end ; temp . end = ( ( temp . start ) + diff ) ; newNode . start = ( newNode . end ) - diff ; newNode . next = temp . next ; temp . next = newNode ; propagate ( temp . next . next ) ; } return head ; } static void print ( Cantor temp ) { while ( temp != null ) { System . out . printf ( " [ % f ] ▁ - - ▁ [ % f ] " , temp . start , temp . end ) ; temp = temp . next ; } System . out . printf ( "NEW_LINE"); } static void buildCantorSet ( int A , int B , int L ) { Cantor head = null ; head = startList ( head , A , B ) ; for ( int i = 0 ; i < L ; i ++ ) { System . out . printf ( " Level _ % d ▁ : ▁ " , i ) ; print ( head ) ; propagate ( head ) ; } System . out . printf ( " Level _ % d ▁ : ▁ " , L ) ; print ( head ) ; } public static void main ( String [ ] args ) { int A = 0 ; int B = 9 ; int L = 2 ; buildCantorSet ( A , B , L ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: Cantor, GFG
Java program:
import java . util . * ; class GFG { static int N = 100005 ; static int mod = 1000000007 ; static int temp = 391657242 ; static int [ ] factorial = new int [ N ] ; static int [ ] modinverse = new int [ N ] ; static int power ( int a , int m1 ) { if ( m1 == 0 ) return 1 ; else if ( m1 == 1 ) return a ; else if ( m1 == 2 ) return ( a * a ) % mod ; else if ( ( m1 & 1 ) != 0 ) return ( a * power ( power ( a , m1 / 2 ) , 2 ) ) % mod ; else return power ( power ( a , m1 / 2 ) , 2 ) % mod ; } static void factorialfun ( ) { factorial [ 0 ] = 1 ; for ( int i = 1 ; i < N ; i ++ ) factorial [ i ] = ( factorial [ i - 1 ] * i ) % mod ; } static void modinversefun ( ) { modinverse [ N - 1 ] = power ( factorial [ N - 1 ] , mod - 2 ) % mod ; for ( int i = N - 2 ; i >= 0 ; i -- ) modinverse [ i ] = ( modinverse [ i + 1 ] * ( i + 1 ) ) % mod ; } static int binomial ( int n , int r ) { if ( r > n ) return 0 ; int a = ( factorial [ n ] * modinverse [ n - r ] ) % mod ; a = ( a * modinverse [ r ] ) % mod ; return a ; } static int max_min ( int a [ ] , int n , int k ) { Arrays . sort ( a ) ; factorialfun ( ) ; modinversefun ( ) ; int ans = 0 ; k -- ; for ( int i = 0 ; i < n ; i ++ ) { int x = n - i - 1 ; if ( x >= k ) ans -= binomial ( x , k ) * a [ i ] % mod ; int y = i ; if ( y >= k ) ans += binomial ( y , k ) * a [ i ] % mod ; ans = ( ans + mod ) % mod ; } return ans % temp ; } public static void main ( String args [ ] ) { int [ ] a = { 1 , 1 , 3 , 4 } ; int k = 2 ; int n = a . length ; System . out . println ( max_min ( a , n , k ) ) ; } }

Index/key variables: N, i, n, r
Accumulator variables: ans, i, k
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int countNumber ( int N , int S ) { int countElements = 0 ; int currSum = 0 ; while ( currSum <= S ) { currSum += N ; N -- ; countElements ++ ; } return countElements ; } public static void main ( String [ ] args ) { int N , S ; N = 5 ; S = 11 ; int count = countNumber ( N , S ) ; System . out . println ( count ) ; } }

Accumulator variables: N, countElements, currSum
Class/struct names: GFG
Java program:
class GFG { final static int INT_MAX = Integer . MAX_VALUE ; static int countDistinct ( int n ) { int arr [ ] = new int [ 10 ] ; int count = 0 ; while ( n != 0 ) { int r = n % 10 ; arr [ r ] = 1 ; n /= 10 ; } for ( int i = 0 ; i < 10 ; i ++ ) { if ( arr [ i ] != 0 ) count ++ ; } return count ; } static int countDigit ( int n ) { int c = 0 ; while ( n != 0 ) { int r = n % 10 ; c ++ ; n /= 10 ; } return c ; } static int nextNumberDistinctDigit ( int n ) { while ( n < INT_MAX ) { int distinct_digits = countDistinct ( n + 1 ) ; int total_digits = countDigit ( n + 1 ) ; if ( distinct_digits == total_digits ) { return n + 1 ; } else n ++ ; } return - 1 ; } public static void main ( String [ ] args ) { int n = 2019 ; System . out . println ( nextNumberDistinctDigit ( n ) ) ; } }

Index/key variables: i, r
Accumulator variables: c, count, i, n
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int mod = 1000000007 ; static int N = 1000005 ; static int lpf [ ] = new int [ N ] ; static void least_prime_factor ( ) { for ( int i = 1 ; i < N ; i ++ ) lpf [ i ] = i ; for ( int i = 2 ; i < N ; i ++ ) if ( lpf [ i ] == i ) for ( int j = i * 2 ; j < N ; j += i ) if ( lpf [ j ] == j ) lpf [ j ] = i ; } static long power ( long a , long m1 ) { if ( m1 == 0 ) return 1 ; else if ( m1 == 1 ) return a ; else if ( m1 == 2 ) return ( 1l * a * a ) % mod ; else if ( ( m1 & 1 ) != 0 ) return ( 1l * a * power ( power ( a , m1 / 2 ) , 2 ) ) % mod ; else return power ( power ( a , m1 / 2 ) , 2 ) % mod ; } static long sum_of_elements ( long a [ ] , int n ) { least_prime_factor ( ) ; HashMap < Long , Long > prime_factor = new HashMap < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { long temp = a [ i ] ; HashMap < Long , Long > single_number = new HashMap < > ( ) ; while ( temp > 1 ) { long x = lpf [ ( int ) temp ] ; single_number . put ( x , ( single_number . get ( x ) == null ? 1 : single_number . get ( x ) + 1 ) ) ; temp /= x ; } if ( i == 0 ) prime_factor = single_number ; else { for ( Map . Entry < Long , Long > x : single_number . entrySet ( ) ) prime_factor . put ( x . getKey ( ) , Math . max ( x . getValue ( ) , ( prime_factor . get ( x . getKey ( ) ) == null ? 0 : prime_factor . get ( x . getKey ( ) ) ) ) ) ; } } long ans = 0 , lcm = 1 ; for ( Map . Entry < Long , Long > x : prime_factor . entrySet ( ) ) lcm = ( lcm * power ( x . getKey ( ) , x . getValue ( ) ) ) % mod ; for ( int i = 0 ; i < n ; i ++ ) ans = ( ans + ( lcm * power ( a [ i ] , mod - 2 ) ) % mod ) % mod ; return ans ; } public static void main ( String args [ ] ) { long a [ ] = { 2 , 3 , 4 } ; int n = a . length ; System . out . println ( sum_of_elements ( a , n ) ) ; } }

Index/key variables: N, i, j
Accumulator variables: i, j, temp
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static int findNumberOfEvenCells ( int n , int q [ ] [ ] , int size ) { int row [ ] = new int [ n ] ; int col [ ] = new int [ n ] ; for ( int i = 0 ; i < size ; i ++ ) { int x = q [ i ] [ 0 ] ; int y = q [ i ] [ 1 ] ; row [ x - 1 ] ++ ; col [ y - 1 ] ++ ; } int r1 = 0 , r2 = 0 ; int c1 = 0 , c2 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( row [ i ] % 2 == 0 ) { r1 ++ ; } if ( row [ i ] % 2 == 1 ) { r2 ++ ; } if ( col [ i ] % 2 == 0 ) { c1 ++ ; } if ( col [ i ] % 2 == 1 ) { c2 ++ ; } } int count = r1 * c1 + r2 * c2 ; return count ; } public static void main ( String [ ] args ) { int n = 2 ; int q [ ] [ ] = { { 1 , 1 } , { 1 , 2 } , { 2 , 1 } } ; int size = q . length ; System . out . println ( findNumberOfEvenCells ( n , q , size ) ) ; } }

Index/key variables: i, n
Accumulator variables: c1, c2, i, r1, r2
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int maxHeight ( int h1 , int h2 ) { return ( ( h1 * h2 ) - h1 - h2 ) ; } public static void main ( String args [ ] ) { int h1 = 7 , h2 = 5 ; System . out . println ( Math . max ( 0 , maxHeight ( h1 , h2 ) ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static void FermatFactors ( int n ) { if ( n <= 0 ) { System . out . print ( " [ " + n + " ] " ) ; return ; } if ( ( n & 1 ) == 0 ) { System . out . print ( " [ " + n / 2.0 + " , " + 2 + " ] " ) ; return ; } int a = ( int ) Math . ceil ( Math . sqrt ( n ) ) ; if ( a * a == n ) { System . out . print ( " [ " + a + " , " + a + " ] " ) ; return ; } int b ; while ( true ) { int b1 = a * a - n ; b = ( int ) ( Math . sqrt ( b1 ) ) ; if ( b * b == b1 ) break ; else a += 1 ; } System . out . print ( " [ " + ( a - b ) + " , " + ( a + b ) + " ] " ) ; return ; } public static void main ( String [ ] args ) { FermatFactors ( 6557 ) ; } }

Accumulator variables: a
Class/struct names: GFG
Java program:
class GFG { static void findNums ( int arr [ ] , int n ) { int S = 0 , X = 0 ; for ( int i = 0 ; i < n ; i ++ ) { S += arr [ i ] ; X ^= arr [ i ] ; } System . out . println ( X + " ▁ " + ( X + S ) ) ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 7 } ; int n = arr . length ; findNums ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: S, X, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void solve ( int A , int B ) { double p = B / 2.0 ; double M = Math . ceil ( 4 * p ) ; int N = 1 ; int O = - 2 * A ; double Q = Math . ceil ( A * A + 4 * p * p ) ; System . out . println ( M + " ▁ " + N + " ▁ " + O + " ▁ " + Q ) ; } public static void main ( String [ ] args ) { int a = 1 ; int b = 1 ; solve ( a , b ) ; } }

Class/struct names: GFG
Java program:
class GFG { static int findLargest ( int [ ] arr , int n ) { int gcd = 0 ; for ( int i = 0 ; i < n ; i ++ ) gcd = __gcd ( arr [ i ] , gcd ) ; return gcd ; } static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } public static void main ( String [ ] args ) { int arr [ ] = { 3 , 6 , 9 } ; int n = arr . length ; System . out . print ( findLargest ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int digitSum ( int n ) { int sum = 0 ; while ( n > 0 ) { sum += ( n % 10 ) ; n /= 10 ; } return sum ; } static boolean isPalindrome ( int n ) { int divisor = 1 ; while ( n / divisor >= 10 ) divisor *= 10 ; while ( n != 0 ) { int leading = n / divisor ; int trailing = n % 10 ; if ( leading != trailing ) return false ; n = ( n % divisor ) / 10 ; divisor = divisor / 100 ; } return true ; } static boolean isDigitSumPalindrome ( int n ) { int sum = digitSum ( n ) ; if ( isPalindrome ( sum ) ) return true ; return false ; } public static void main ( String [ ] args ) { int n = 56 ; if ( isDigitSumPalindrome ( n ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Accumulator variables: divisor, n, sum
Class/struct names: GFG
Java program:
class GFG { static int xorK ( int n , int k ) { if ( k % 2 == 1 ) return n ; return 0 ; } public static void main ( String [ ] args ) { int n = 123 , k = 3 ; System . out . print ( xorK ( n , k ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int N = 20 ; static int mod = 1000000007 ; static int [ ] factorial = new int [ N ] ; static int [ ] modinverse = new int [ N ] ; static int power ( int a , int m1 ) { if ( m1 == 0 ) return 1 ; else if ( m1 == 1 ) return a ; else if ( m1 == 2 ) return ( a * a ) % mod ; else if ( ( m1 & 1 ) != 0 ) return ( a * power ( power ( a , m1 / 2 ) , 2 ) ) % mod ; else return power ( power ( a , m1 / 2 ) , 2 ) % mod ; } static void factorialfun ( ) { factorial [ 0 ] = 1 ; for ( int i = 1 ; i < N ; i ++ ) factorial [ i ] = ( factorial [ i - 1 ] * i ) % mod ; } static void modinversefun ( ) { modinverse [ N - 1 ] = power ( factorial [ N - 1 ] , mod - 2 ) % mod ; for ( int i = N - 2 ; i >= 0 ; i -- ) modinverse [ i ] = ( modinverse [ i + 1 ] * ( i + 1 ) ) % mod ; } static int binomial ( int n , int r ) { if ( r > n ) return 0 ; int a = ( factorial [ n ] * modinverse [ n - r ] ) % mod ; a = ( a * modinverse [ r ] ) % mod ; return a ; } static int arrange ( int n , int m , int k ) { factorialfun ( ) ; modinversefun ( ) ; int ans = 0 ; for ( int i = 1 ; i < n ; i ++ ) ans += ( i * ( n - i ) * m * m ) % mod ; ans = 8 ; for ( int i = 1 ; i < m ; i ++ ) ans += ( i * ( m - i ) * n * n ) % mod ; ans = ( ans * binomial ( n * m - 2 , k - 2 ) ) % mod + 8 ; return ans ; } public static void main ( String [ ] args ) { int n = 2 , m = 2 , k = 2 ; System . out . println ( arrange ( n , m , k ) ) ; } }

Index/key variables: N, i, n, r
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int findNthDigit ( int p , int q , int N ) { int res = 0 ; while ( N > 0 ) { N -- ; p *= 10 ; res = p / q ; p %= q ; } return res ; } public static void main ( String args [ ] ) { int p = 1 , q = 2 , N = 1 ; System . out . println ( findNthDigit ( p , q , N ) ) ; } }

Accumulator variables: N, p
Class/struct names: GFG
Java program:
class GFG { static int sumArr ( int arr [ ] , int n ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum += arr [ i ] ; return sum ; } static int sumModArr ( int arr [ ] , int n ) { int subSum = arr [ n - 1 ] ; for ( int i = n - 2 ; i >= 0 ; i -- ) { int curr = arr [ i ] ; arr [ i ] -= subSum ; subSum += curr ; } return sumArr ( arr , n ) ; } public static void main ( String [ ] args ) { int [ ] arr = { 40 , 25 , 12 , 10 } ; int n = arr . length ; System . out . println ( sumModArr ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, subSum, sum
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int NumUnsignBits = 64 ; static long findNum ( long x ) { for ( int i = 0 ; i < NumUnsignBits - 1 ; i ++ ) { if ( ( ( x >> i ) & 1 ) != ( ( x >> ( i + 1 ) ) & 1 ) ) { x ^= ( 1 << i ) | ( 1 << ( i + 1 ) ) ; return x ; } } return Long . MIN_VALUE ; } public static void main ( String [ ] args ) { int n = 92 ; System . out . println ( findNum ( n ) ) ; } }

Accumulator variables: i, x
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int cntCakes ( int n , int m ) { int sum = ( n * ( n + 1 ) ) / 2 ; int quo = m / sum ; int rem = m % sum ; double ans = m - quo * sum ; double x = ( - 1 + Math . pow ( ( 8 * rem ) + 1 , 0.5 ) ) / 2 ; ans = ans - x * ( x + 1 ) / 2 ; return ( int ) ans ; } public static void main ( String [ ] args ) { int n = 3 ; int m = 8 ; int ans = cntCakes ( n , m ) ; System . out . println ( ans ) ; } }

Class/struct names: GFG
Java program:
class GFG { static int cntSquares ( int n ) { return n * ( n + 1 ) * ( 2 * n + 1 ) / 6 ; } public static void main ( String args [ ] ) { System . out . println ( cntSquares ( 4 ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static int reverse ( int num ) { int rev = 0 ; while ( num > 0 ) { rev = rev * 10 + num % 10 ; num = num / 10 ; } return rev ; } static boolean isPalindrome ( int num ) { if ( num == reverse ( num ) ) return true ; return false ; } static void printPalindromes ( int d ) { if ( d <= 0 ) return ; int smallest = ( int ) Math . pow ( 10 , d - 1 ) ; int largest = ( int ) Math . pow ( 10 , d ) - 1 ; for ( int i = smallest ; i <= largest ; i ++ ) { if ( isPalindrome ( i ) ) System . out . print ( i + " ▁ " ) ; } } public static void main ( String [ ] args ) { int d = 2 ; printPalindromes ( d ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void getXandYintercept ( int P [ ] , int Q [ ] ) { int a = P [ 1 ] - Q [ 1 ] ; int b = P [ 0 ] - Q [ 0 ] ; if ( b == 0 ) { System . out . println ( P [ 0 ] ) ; System . out . println ( " infinity " ) ; return ; } if ( a == 0 ) { System . out . println ( " infinity " ) ; System . out . println ( P [ 1 ] ) ; return ; } double m = a / ( b * 1.0 ) ; int x = P [ 0 ] ; int y = P [ 1 ] ; double c = y - m * x ; y = 0 ; double r = ( y - c ) / ( m * 1.0 ) ; System . out . println ( r ) ; x = 0 ; y = ( int ) ( m * x + c ) ; System . out . print ( c ) ; } public static void main ( String [ ] args ) { int p1 [ ] = { 5 , 2 } ; int p2 [ ] = { 2 , 7 } ; getXandYintercept ( p1 , p2 ) ; } }

Class/struct names: GFG
Java program:
class GFG { static int min_moves ( int n ) { int ans = Integer . MAX_VALUE ; for ( int i = 1 ; i * i <= n ; i ++ ) { if ( n % i == 0 ) { ans = Math . min ( ans , i + n / i - 2 ) ; } } return ans ; } public static void main ( String [ ] args ) { int n = 10 ; System . out . println ( min_moves ( n ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int MOD = 2019 ; static int min_modulo ( int l , int r ) { if ( r - l >= MOD ) return 0 ; else { int ans = MOD - 1 ; for ( int i = l ; i <= r ; i ++ ) { for ( int j = i + 1 ; j <= r ; j ++ ) { ans = Math . min ( ans , ( i * j ) % MOD ) ; } } return ans ; } } public static void main ( String [ ] args ) { int l = 2020 , r = 2040 ; System . out . println ( min_modulo ( l , r ) ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static void find_numbers ( int N ) { if ( N == 1 ) { System . out . print ( - 1 ) ; } else { System . out . print ( N + " ▁ " + ( N + 1 ) + " ▁ " + ( N * ( N + 1 ) ) ) ; } } public static void main ( String [ ] args ) { int N = 5 ; find_numbers ( N ) ; } }

Class/struct names: GFG
Java program:
import java . util . HashMap ; class GFG { static int countPairs ( int arr [ ] , int n ) { HashMap < Integer , Integer > map = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) map . put ( arr [ i ] - i , 0 ) ; for ( int i = 0 ; i < n ; i ++ ) map . put ( arr [ i ] - i , map . get ( arr [ i ] - i ) + 1 ) ; int res = 0 ; for ( int x : map . values ( ) ) { int cnt = x ; res += ( ( cnt * ( cnt - 1 ) ) / 2 ) ; } return res ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 5 , 6 , 7 , 9 } ; int n = arr . length ; System . out . println ( countPairs ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, res
Iterator variables: i, x
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static String minInt ( String str ) { String s = " " ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { if ( str . charAt ( i ) >= '5' ) { s += ( char ) ( ( '9' - str . charAt ( i ) ) + '0' ) ; } else { s += str . charAt ( i ) ; } } if ( str . charAt ( 0 ) == '0' ) s += '9' ; return s ; } public static void main ( String [ ] args ) { String str = "589" ; System . out . println ( minInt ( str ) ) ; } }

Accumulator variables: i, s
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static long minOperations ( long n ) { long count = 0 ; long d = 0 ; if ( n == 1 ) return 0 ; while ( n > 9 ) { d = Math . max ( n % 10 , d ) ; n /= 10 ; count += 10 ; } d = Math . max ( d , n - 1 ) ; count += Math . abs ( d ) ; return count - 1 ; } public static void main ( String [ ] args ) { long n = 240 ; System . out . println ( minOperations ( n ) ) ; } }

Accumulator variables: count, n
Class/struct names: GFG