dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
import java . io . * ; class GFG { public static int minPossibleValue ( int N , int K , int X ) { for ( int i = 1 ; i <= N ; i ++ ) { if ( X <= K ) { X = X * 2 ; } else { X = X + K ; } } return X ; } public static void main ( String [ ] args ) { int N = 7 , K = 4 , X = 1 ; System . out . println ( minPossibleValue ( N , K , X ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { public static void findMissingValue ( int arr [ ] , int N ) { int minE = Integer . MAX_VALUE , maxE = Integer . MIN_VALUE ; for ( int i = 0 ; i < N - 1 ; i ++ ) { if ( arr [ i ] == - 1 && arr [ i + 1 ] != - 1 ) { minE = Math . min ( minE , arr [ i + 1 ] ) ; maxE = Math . max ( maxE , arr [ i + 1 ] ) ; } if ( arr [ i ] != - 1 && arr [ i + 1 ] == - 1 ) { minE = Math . min ( minE , arr [ i ] ) ; maxE = Math . max ( maxE , arr [ i ] ) ; } } if ( minE == Integer . MAX_VALUE && maxE == Integer . MIN_VALUE ) { System . out . println ( "0" ) ; } else { System . out . println ( ( minE + maxE ) / 2 ) ; } } public static void main ( String [ ] args ) { int arr [ ] = { 1 , - 1 , - 1 , - 1 , 5 } ; int N = arr . length ; findMissingValue ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static void findLastElement ( int N , int [ ] A ) { int l = A . length ; int j = 0 ; while ( N > l * ( int ) ( Math . pow ( 2 , j ) ) ) { N = N - l * ( int ) Math . pow ( 2 , j ) ; j += 1 ; } int k = 1 ; int r = ( int ) Math . pow ( 2 , j ) ; for ( int i = 1 ; i < l ; i ++ ) { if ( N > r * i ) k += 1 ; } for ( int i = 0 ; i < l ; i ++ ) { if ( i + 1 == k ) { System . out . print ( A [ i ] ) ; return ; } } } public static void main ( String [ ] args ) { int K = 7 ; int [ ] A = { 1 , 2 , 3 } ; findLastElement ( K , A ) ; } }

Index/key variables: i
Accumulator variables: i, j, k
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int gcd ( int a , int b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } static int findMaxD ( int arr [ ] , int N , int K ) { for ( int i = 0 ; i < N ; i ++ ) { arr [ i ] = Math . abs ( arr [ i ] - K ) ; } int D = arr [ 0 ] ; for ( int i = 1 ; i < N ; i ++ ) { D = gcd ( D , arr [ i ] ) ; } return D ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 7 , 11 } ; int N = arr . length ; int K = 3 ; System . out . print ( findMaxD ( arr , N , K ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int maxOperations ( String S , int N ) { int X = 0 ; int Y = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( S . charAt ( i ) == '0' ) break ; Y ++ ; } for ( int i = N - 1 ; i >= 0 ; i -- ) { if ( S . charAt ( i ) == '1' ) break ; X ++ ; } if ( N == X + Y ) return 0 ; return N - ( X + Y ) - 1 ; } public static void main ( String [ ] args ) { String S = "001111" ; int N = S . length ( ) ; System . out . println ( maxOperations ( S , N ) ) ; } }

Accumulator variables: X, Y, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int maximumSum ( String S , int N , int K ) { int sum = 0 ; Integer [ ] freq = new Integer [ 256 ] ; Arrays . fill ( freq , 0 ) ; for ( int i = 0 ; i < N ; i ++ ) { freq [ ( int ) S . charAt ( i ) ] += 1 ; } Arrays . sort ( freq , Collections . reverseOrder ( ) ) ; for ( int i = 0 ; i < 256 ; i ++ ) { if ( K > freq [ i ] ) { sum += freq [ i ] * freq [ i ] ; K -= freq [ i ] ; } else { sum += freq [ i ] * K ; break ; } } return sum ; } public static void main ( String args [ ] ) { String S = " GEEKSFORGEEKS " ; int K = 10 ; int N = S . length ( ) ; System . out . print ( maximumSum ( S , N , K ) ) ; } }

Index/key variables: i
Accumulator variables: K, i, sum
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int dp [ ] [ ] [ ] = new int [ 100 ] [ 10 ] [ 10 ] ; static int countOfNumbers ( int digit , int prev1 , int prev2 , int n ) { if ( digit == n + 1 ) { return 1 ; } int val = dp [ digit ] [ prev1 ] [ prev2 ] ; if ( val != - 1 ) { return val ; } val = 0 ; if ( digit == 1 ) { for ( int i = ( n == 1 ? 0 : 1 ) ; i <= 9 ; ++ i ) { val += countOfNumbers ( digit + 1 , i , prev1 , n ) ; } } else if ( digit == 2 ) { for ( int i = 0 ; i <= 9 ; ++ i ) { val += countOfNumbers ( digit + 1 , i , prev1 , n ) ; } } else { int diff = Math . abs ( prev2 - prev1 ) ; for ( int i = 0 ; i <= 9 ; ++ i ) { if ( Math . abs ( prev1 - i ) <= diff ) { val += countOfNumbers ( digit + 1 , i , prev1 , n ) ; } } } return val ; } static void countNumbersUtil ( int N ) { for ( int i = 0 ; i < 100 ; i ++ ) { for ( int j = 0 ; j < 10 ; j ++ ) { for ( int k = 0 ; k < 10 ; k ++ ) { dp [ i ] [ j ] [ k ] = - 1 ; } } } System . out . println ( countOfNumbers ( 1 , 0 , 0 , N ) ) ; } public static void main ( String [ ] args ) { int N = 3 ; countNumbersUtil ( N ) ; } }

Index/key variables: digit, i, j, k, prev1, prev2
Accumulator variables: i, j, k, val
Iterator variables: i, j, k
Class/struct names: GFG
Java program:
import java . util . * ; public class MyClass { static void possibleNumbers ( Set < Integer > numbers , int N , int M , int A , int B ) { if ( M == 0 ) { numbers . add ( N ) ; return ; } possibleNumbers ( numbers , N + A , M - 1 , A , B ) ; possibleNumbers ( numbers , N + B , M - 1 , A , B ) ; } public static void main ( String args [ ] ) { int N = 5 , M = 3 , A = 4 , B = 6 ; Set < Integer > numbers = new HashSet < Integer > ( ) ; possibleNumbers ( numbers , N , M , A , B ) ; Iterator < Integer > i = numbers . iterator ( ) ; while ( i . hasNext ( ) ) System . out . print ( i . next ( ) + " ▁ " ) ; } }

Class/struct names: MyClass
Java program:
import java . io . * ; class GFG { static void maxSum ( int arr [ ] , int n ) { int sum = 0 ; int max_neg = Integer . MAX_VALUE ; int tempsum = 0 ; int small = Integer . MAX_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { sum += arr [ i ] ; small = Math . min ( small , arr [ i ] ) ; if ( arr [ i ] > 0 ) { tempsum = 0 ; } else { tempsum += arr [ i ] ; } max_neg = Math . min ( max_neg , tempsum ) ; } if ( max_neg == 0 ) { max_neg = small ; } System . out . println ( sum - max_neg ) ; } public static void main ( String [ ] args ) { int arr [ ] = { - 2 , - 3 , 4 , - 1 , - 2 , 1 , 5 , - 3 } ; int n = arr . length ; maxSum ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: i, sum, tempsum
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static String largestString ( String s , int k ) { for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) != ' z ' && k > 0 ) { s = s . replace ( s . charAt ( i ) , ' z ' ) ; k -- ; } } return s ; } public static void main ( String args [ ] ) { String s = " dbza " ; int k = 1 ; System . out . println ( largestString ( s , k ) ) ; } }

Accumulator variables: i, k
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void RemoveOneChar ( String A , String B , int N , int M ) { int X = 0 ; int Y = N - 1 ; for ( int i = 0 ; i < M ; i ++ ) { if ( A . charAt ( X ) != B . charAt ( i ) ) break ; X ++ ; } for ( int i = M - 1 ; i >= 0 ; i -- ) { if ( A . charAt ( Y ) != B . charAt ( i ) ) break ; Y -- ; } if ( N - M == 1 && Y < X ) { System . out . println ( X - Y + 1 ) ; for ( int i = Y ; i <= X ; i ++ ) System . out . print ( i + 1 + " ▁ " ) ; System . out . println ( ) ; } else System . out . println ( - 1 ) ; } static public void main ( String [ ] args ) { String A = " abaac " ; String B = " abac " ; int N = A . length ( ) ; int M = B . length ( ) ; RemoveOneChar ( A , B , N , M ) ; } }

Accumulator variables: X, Y, i
Iterator variables: i
Class/struct names: GFG
Java program:
public class GFG { static void minimumOperation ( String a , String b ) { int n = a . length ( ) ; int i = 0 ; int minoperation = 0 ; while ( i < n ) { if ( a . charAt ( i ) == b . charAt ( i ) ) { i = i + 1 ; continue ; } else if ( a . charAt ( i ) == b . charAt ( i + 1 ) && a . charAt ( i + 1 ) == b . charAt ( i ) && i < n - 1 ) { minoperation ++ ; i = i + 2 ; } else if ( a . charAt ( i ) != b . charAt ( i ) ) { minoperation ++ ; i = i + 1 ; } else { ++ i ; } } System . out . println ( minoperation ) ; } public static void main ( String [ ] args ) { String a = "10010010" , b = "00001000" ; minimumOperation ( a , b ) ; } }

Accumulator variables: minoperation
Class/struct names: GFG
Java program:
import java . lang . * ; import java . util . * ; class GFG { static void findMinOperations ( int arr [ ] , int N , int K ) { int operations = 0 ; for ( int i = 0 ; i < K ; i ++ ) { Map < Integer , Integer > freq = new HashMap < > ( ) ; for ( int j = i ; j < N ; j += K ) freq . put ( arr [ j ] , freq . getOrDefault ( arr [ j ] , 0 ) + 1 ) ; int max1 = 0 , num = - 1 ; for ( Map . Entry < Integer , Integer > x : freq . entrySet ( ) ) { if ( x . getValue ( ) > max1 ) { max1 = x . getValue ( ) ; num = x . getKey ( ) ; } } for ( Map . Entry < Integer , Integer > x : freq . entrySet ( ) ) { if ( x . getKey ( ) != num ) operations += x . getValue ( ) ; } } System . out . print ( operations ) ; } public static void main ( String [ ] args ) { int arr [ ] = { 3 , 4 , 3 , 5 , 6 } ; int K = 2 ; int N = arr . length ; findMinOperations ( arr , N , K ) ; } }

Index/key variables: j
Accumulator variables: i, j, operations
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static void countOfPairs ( int x , int y ) { int count = 0 ; for ( int k = 1 ; k * k <= x ; ++ k ) { count += Math . max ( 0 , Math . min ( y , x / k - 1 ) - k ) ; } System . out . print ( count ) ; } public static void main ( String [ ] args ) { int x = 4 ; int y = 5 ; countOfPairs ( x , y ) ; } }

Accumulator variables: count
Iterator variables: k
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; import java . lang . * ; class GFG { static int countPermutations ( int N ) { ArrayList < ArrayList < Integer > > adj = new ArrayList < ArrayList < Integer > > ( 105 ) ; for ( int i = 0 ; i < 105 ; i ++ ) adj . add ( new ArrayList < Integer > ( ) ) ; int indeg = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { for ( int j = 1 ; j <= N ; j ++ ) { if ( i == j ) continue ; int sum = i + j ; if ( Math . ceil ( Math . sqrt ( sum ) ) == Math . floor ( Math . sqrt ( sum ) ) ) { adj . get ( i ) . add ( j ) ; } } if ( adj . get ( i ) . size ( ) == 1 ) indeg ++ ; } if ( indeg == 0 ) return N ; else if ( indeg <= 2 ) return 2 ; else return 0 ; } public static void main ( String [ ] args ) { int N = 17 ; System . out . println ( countPermutations ( N ) ) ; } }

Accumulator variables: i, indeg, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { public static void makeList ( int N , int K ) { int [ ] list = new int [ N ] ; int left = 1 ; int right = N ; for ( int i = 0 ; i < N ; i ++ ) { if ( K % 2 == 0 ) { list [ i ] = left ; left = left + 1 ; } else { list [ i ] = right ; right = right - 1 ; } if ( K > 1 ) K -- ; } for ( int i = 0 ; i < list . length ; i ++ ) { System . out . print ( list [ i ] + " ▁ " ) ; } } public static void main ( String [ ] args ) { int N = 6 ; int K = 3 ; makeList ( N , K ) ; } }

Index/key variables: N, i
Accumulator variables: K, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { public static void getDate ( int d , String m ) { int [ ] days = { 31 , 29 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 } ; String [ ] month = { " January " , " February " , " March " , " April " , " May " , " June " , " July " , " August " , " September " , " October " , " November " , " December " } ; int cnt = 183 ; int cur_month = 0 ; for ( int i = 0 ; i < 12 ; i ++ ) if ( m == month [ i ] ) cur_month = i ; int cur_date = d ; while ( true ) { while ( cnt > 0 && cur_date <= days [ cur_month ] ) { cnt -= 1 ; cur_date += 1 ; } if ( cnt == 0 ) break ; cur_month = ( cur_month + 1 ) % 12 ; cur_date = 1 ; } System . out . println ( cur_date + " ▁ " + month [ cur_month ] ) ; } public static void main ( String args [ ] ) { int D = 15 ; String M = " January " ; getDate ( D , M ) ; } }

Index/key variables: cur_month, i
Accumulator variables: cnt, cur_date, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static long largestNumber ( int N ) { if ( N > 45 ) return - 1 ; int num = 0 , digit = 9 ; while ( N > 0 && digit > 0 ) { if ( digit <= N ) { num *= 10 ; num += digit ; N -= digit ; } digit -= 1 ; } return num * 10 ; } public static void main ( String [ ] args ) { int N = 25 ; System . out . print ( largestNumber ( N ) ) ; } }

Accumulator variables: N, digit, num
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int minimumSum ( int A [ ] , int N , String S ) { int mul = 0 ; for ( int i = 0 ; i < ( int ) S . length ( ) ; i ++ ) { if ( S . charAt ( i ) == ' * ' ) mul += 1 ; } int ans = 1000000 ; for ( int i = 0 ; i < ( 1 << ( N - 1 ) ) ; i ++ ) { int cnt = 0 ; Vector < Character > v = new Vector < Character > ( ) ; for ( int j = 0 ; j < N - 1 ; j ++ ) { if ( ( ( 1 << j ) & ( i ) ) > 0 ) { cnt += 1 ; v . add ( ' * ' ) ; } else { v . add ( ' + ' ) ; } } if ( cnt == mul ) { LinkedList < Integer > d = new LinkedList < Integer > ( ) ; d . add ( A [ 0 ] ) ; for ( int j = 0 ; j < N - 1 ; j ++ ) { if ( v . get ( j ) == ' * ' ) { int x = d . getLast ( ) ; d . removeLast ( ) ; x = x * A [ j + 1 ] ; d . add ( x ) ; } else { d . add ( A [ j + 1 ] ) ; } } int sum = 0 ; while ( d . size ( ) > 0 ) { int x = d . peek ( ) ; sum += x ; d . removeFirst ( ) ; } ans = Math . min ( ans , sum ) ; } } return ans ; } public static void main ( String [ ] args ) { int A [ ] = { 2 , 2 , 2 , 2 } ; String S = " * * + " ; int N = A . length ; System . out . print ( minimumSum ( A , N , S ) ) ; } }

Accumulator variables: cnt, i, j, mul, sum
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . io . * ; import java . lang . * ; import java . util . * ; public class GFG { static void sumOfMedians ( int arr [ ] , int N , int K ) { int selectMedian = ( K + 1 ) / 2 ; int totalArrays = N / K ; int minSum = 0 ; int i = selectMedian - 1 ; while ( i < N && totalArrays != 0 ) { minSum = minSum + arr [ i ] ; i = i + selectMedian ; totalArrays -- ; } System . out . println ( minSum ) ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 , 3 , 4 , 5 , 6 } ; int N = arr . length ; int K = 2 ; sumOfMedians ( arr , N , K ) ; } }

Index/key variables: i
Accumulator variables: totalArrays
Class/struct names: GFG
Java program:
import java . util . Vector ; class GFG { static void solve ( int S , int K , int N ) { if ( K > N ) { System . out . println ( " - 1" ) ; return ; } int max_sum = 0 , min_sum = 0 ; for ( int i = 1 ; i <= K ; i ++ ) { min_sum += i ; max_sum += N - i + 1 ; } if ( S < min_sum S > max_sum ) { System . out . println ( " - 1" ) ; return ; } int s1 = 0 ; Vector < Integer > nums = new Vector < > ( ) ; for ( int i = 1 ; i <= N ; i ++ ) { if ( s1 > S ) break ; s1 += i ; nums . add ( i ) ; } Vector < Integer > answer = new Vector < > ( ) ; int s2 = 0 ; for ( int i = 0 ; i < K - 1 ; i ++ ) { answer . add ( nums . get ( i ) ) ; s2 += nums . get ( i ) ; } answer . add ( S - s2 ) ; int Max = N ; for ( int i = answer . size ( ) - 1 ; i >= 0 ; i -- ) { if ( answer . get ( i ) > Max ) { int extra = answer . get ( i ) - Max ; if ( i - 1 >= 0 ) answer . set ( i - 1 , answer . get ( i - 1 ) + extra ) ; answer . set ( i , Max ) ; Max -- ; } else break ; } for ( int x : answer ) System . out . print ( x + " ▁ " ) ; System . out . println ( ) ; } public static void main ( String [ ] args ) { int S = 15 , K = 4 , N = 8 ; solve ( S , K , N ) ; } }

Accumulator variables: Max, i, max_sum, min_sum, s1, s2
Iterator variables: i, x
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void minSizeArr ( int A [ ] , int N , int K ) { int leftTaken = N , rightTaken = N ; int leftSum = 0 , rightSum = 0 ; for ( int left = - 1 ; left < N ; left ++ ) { if ( left != - 1 ) leftSum += A [ left ] ; rightSum = 0 ; for ( int right = N - 1 ; right > left ; right -- ) { rightSum += A [ right ] ; if ( leftSum + rightSum == K ) { if ( leftTaken + rightTaken > ( left + 1 ) + ( N - right ) ) { leftTaken = left + 1 ; rightTaken = N - right ; } break ; } if ( leftSum + rightSum > K ) break ; } } if ( leftTaken + rightTaken <= N ) { for ( int i = 0 ; i < leftTaken ; i ++ ) System . out . print ( A [ i ] + " ▁ " ) ; for ( int i = 0 ; i < rightTaken ; i ++ ) System . out . print ( A [ N - i - 1 ] + " ▁ " ) ; } else System . out . print ( - 1 ) ; } public static void main ( String [ ] args ) { int N = 7 ; int A [ ] = { 3 , 2 , 1 , 1 , 1 , 1 , 3 } ; int K = 10 ; minSizeArr ( A , N , K ) ; } }

Index/key variables: i, left, right
Accumulator variables: i, left, leftSum, right, rightSum
Iterator variables: i, left, right
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static void minSizeArr ( int A [ ] , int N , int K ) { int sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) sum += A [ i ] ; if ( K > sum ) { System . out . print ( - 1 ) ; return ; } if ( K == sum ) { for ( int i = 0 ; i < N ; i ++ ) { System . out . print ( A [ i ] + " ▁ " ) ; } return ; } int tar = sum - K ; HashMap < Integer , Integer > um = new HashMap < Integer , Integer > ( ) ; um . put ( 0 , - 1 ) ; int left = 0 , right = 0 ; int cur = 0 , maxi = - 1 ; for ( int i = 0 ; i < N ; i ++ ) { cur += A [ i ] ; if ( um . containsKey ( cur - tar ) && i - um . get ( cur - tar ) > maxi ) { maxi = i - um . get ( cur - tar ) ; right = i ; left = um . get ( cur - tar ) ; } if ( ! um . containsKey ( cur ) ) um . put ( cur , i ) ; } if ( maxi == - 1 ) System . out . println ( - 1 ) ; else { for ( int i = 0 ; i <= left ; i ++ ) System . out . print ( A [ i ] + " ▁ " ) ; for ( int i = 0 ; i < right ; i ++ ) System . out . print ( A [ N - i - 1 ] + " ▁ " ) ; } } public static void main ( String [ ] args ) { int N = 7 ; int A [ ] = { 3 , 2 , 1 , 1 , 1 , 1 , 3 } ; int K = 10 ; minSizeArr ( A , N , K ) ; } }

Index/key variables: i
Accumulator variables: cur, i, sum
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . lang . * ; import java . util . * ; public class GFG { static void minModulo ( int L , int R , int N ) { if ( R - L < N ) { int ans = Integer . MAX_VALUE ; for ( int i = L ; i <= R ; i ++ ) for ( int j = L ; j <= R ; j ++ ) if ( i != j ) ans = Math . min ( ans , ( i * j ) % N ) ; System . out . println ( ans ) ; } else { System . out . println ( 0 ) ; } } public static void main ( String [ ] args ) { int L = 6 , R = 10 , N = 2019 ; minModulo ( L , R , N ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . io . * ; import java . lang . * ; import java . util . * ; public class GFG { static int countNumbers ( int N ) { int count = 0 ; for ( int i = 1 ; i * i <= N ; i ++ ) { if ( N % i == 0 ) { count ++ ; if ( N / i != i ) { count ++ ; } } } return count ; } public static void main ( String [ ] args ) { int N = 10 ; System . out . println ( countNumbers ( N ) ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int maximumSize ( Integer [ ] a , int k ) { int low = 1 ; int high = Collections . max ( Arrays . asList ( a ) ) ; int ans = - 1 ; while ( low <= high ) { int mid = low + ( high - low ) / 2 ; int count = 0 ; for ( int c = 0 ; c < a . length ; c ++ ) { count += a / mid ; } if ( count >= k ) { ans = mid ; low = mid + 1 ; } else { high = mid - 1 ; } } return ans ; } public static void main ( String [ ] args ) { Integer [ ] arr = { 1 , 2 , 3 , 4 , 9 } ; int K = 6 ; System . out . println ( maximumSize ( arr , K ) ) ; } }

Accumulator variables: c, count
Iterator variables: c
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void findEquation ( int A , int B , int C , int K ) { System . out . print ( A + " ▁ " + K * B + " ▁ " + K * K * C ) ; } public static void main ( String [ ] args ) { int A = 1 , B = 2 , C = 1 , K = 2 ; findEquation ( A , B , C , K ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; import java . lang . * ; import java . util . * ; public class GFG { static void findMaxValueOfEquation ( int arr [ ] [ ] , int K ) { PriorityQueue < int [ ] > pq = new PriorityQueue < > ( ( a , b ) -> { if ( a [ 0 ] != b [ 0 ] ) return b [ 0 ] - a [ 0 ] ; return b [ 1 ] - a [ 1 ] ; } ) ; int res = Integer . MIN_VALUE ; for ( int point [ ] : arr ) { while ( ! pq . isEmpty ( ) && point [ 0 ] - pq . peek ( ) [ 1 ] > K ) { pq . poll ( ) ; } if ( ! pq . isEmpty ( ) ) { res = Math . max ( res , pq . peek ( ) [ 0 ] + point [ 0 ] + point [ 1 ] ) ; } pq . add ( new int [ ] { point [ 1 ] - point [ 0 ] , point [ 0 ] } ) ; } System . out . println ( res ) ; } public static void main ( String [ ] args ) { int [ ] [ ] arr = { { 1 , 3 } , { 2 , 0 } , { 5 , 10 } , { 6 , - 10 } } ; int K = 1 ; findMaxValueOfEquation ( arr , K ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; import java . lang . * ; class GFG { static int minOperations ( int arr [ ] , int n ) { int oddcount = 0 , evencount = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] % 2 == 1 ) oddcount ++ ; else evencount ++ ; } return Math . min ( oddcount , evencount ) ; } public static void main ( String [ ] args ) { int arr [ ] = { 2 , 4 , 3 , 1 , 8 } ; int N = arr . length ; System . out . println ( minOperations ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: evencount, i, oddcount
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static long gcd ( long a , long b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } static void countDistinctNumbers ( long A , long B , long C ) { long g = gcd ( A , B ) ; long count = C / g ; System . out . println ( count ) ; } public static void main ( String [ ] args ) { long A = 2 , B = 3 , C = 5 ; countDistinctNumbers ( A , B , C ) ; } }

Class/struct names: GFG
Java program:
import java . lang . * ; class GFG { public static void printLastElement ( int arr [ ] , int N ) { boolean leftTurn = true ; int remainElements = N ; int step = 1 ; int head = 1 ; while ( remainElements > 1 ) { if ( leftTurn ) { head = head + step ; } else { if ( remainElements % 2 == 1 ) head = head + step ; } remainElements = remainElements / 2 ; step = step * 2 ; leftTurn = ! leftTurn ; } System . out . print ( arr [ head - 1 ] ) ; } public static void main ( String args [ ] ) { int [ ] arr = { 2 , 3 , 5 , 6 } ; int N = arr . length ; printLastElement ( arr , N ) ; } }

Boolean variables: leftTurn
Class/struct names: GFG
Java program:
class GFG { static void max_min ( int N , int C , int K ) { int maximum , minimum ; if ( N == 1 ) { maximum = minimum = C ; } else if ( K >= C ) { maximum = C ; minimum = 0 ; } else { maximum = K ; minimum = 0 ; int remain_candy = C - K ; maximum += remain_candy / N ; minimum = remain_candy / N ; if ( remain_candy % N == N - 1 ) { minimum ++ ; } } System . out . println ( " Maximum ▁ = ▁ " + maximum ) ; System . out . println ( " Minimum ▁ = ▁ " + minimum ) ; } public static void main ( String [ ] args ) { int N = 4 ; int C = 12 ; int K = 3 ; max_min ( N , C , K ) ; } }

Accumulator variables: maximum, minimum
Class/struct names: GFG