dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
import java . io . * ; import java . util . * ; class GFG { static int power ( int K , int M ) { int res = 1 ; while ( M > 0 ) { if ( ( M & 1 ) == 1 ) { res = ( res * K ) ; } M = M >> 1 ; K = ( K * K ) ; } return res ; } static int cntWays ( int arr [ ] , int N , int K ) { int cntways = 0 ; int M = 0 ; Set < Integer > st = new HashSet < Integer > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { st . add ( arr [ i ] ) ; } M = st . size ( ) ; cntways = power ( K , M ) ; return cntways ; } public static void main ( String [ ] args ) { int arr [ ] = { 2 , 3 } ; int N = arr . length ; int K = 2 ; System . out . println ( cntWays ( arr , N , K ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int mod = ( int ) 1e9 + 7 ; static void minProduct ( int n ) { int ans = 1 ; for ( int i = 1 ; i <= ( n - 4 ) / 2 ; i ++ ) { ans = ( int ) ( 1L * ans * ( n - 2 ) ) % mod ; } ans = ( int ) ( 1L * ans * ( n - 2 ) * ( n - 1 ) ) % mod ; System . out . print ( ans + "NEW_LINE"); } public static void main ( String [ ] args ) { int N = 8 ; minProduct ( N ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { public static int TotalXorPair ( int arr [ ] , int N ) { int totalXOR = 0 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = i + 1 ; j < N ; j ++ ) { totalXOR ^= arr [ i ] ^ arr [ j ] ; } } return totalXOR ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 , 3 , 4 } ; int N = arr . length ; System . out . print ( TotalXorPair ( arr , N ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, totalXOR
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void possibleAcyclicGraph ( int N ) { System . out . print ( ( int ) Math . pow ( 2 , N - 1 ) ) ; return ; } public static void main ( String [ ] args ) { int N = 4 ; possibleAcyclicGraph ( N ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int minProd ( int X , int Y , int N ) { if ( X <= Y ) { if ( N < X ) return ( X - N ) * Y ; else { return Math . max ( Y - ( N - X + 1 ) , 1 ) ; } } if ( Y >= N ) return ( Y - N ) * X ; return Math . max ( X - ( N - Y + 1 ) , 1 ) ; } public static void main ( String [ ] args ) { int X = 47 , Y = 42 , N = 167 ; System . out . println ( minProd ( X , Y , N ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int countPairs ( int arr [ ] , int n ) { int oneCount = 0 ; int desiredPair = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] == 1 ) { oneCount ++ ; } if ( arr [ i ] == 0 ) { desiredPair += oneCount ; } } return desiredPair ; } public static void main ( String [ ] args ) { int arr [ ] = { 3 , 1 , 1 , 0 } ; int N = arr . length ; System . out . println ( countPairs ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: desiredPair, i, oneCount
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . Arrays ; class GFG { static void smlstNonNeg ( int arr [ ] , int N ) { int smNonNeg = 0 ; Boolean [ ] hash = new Boolean [ N + 1 ] ; Arrays . fill ( hash , false ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] >= 0 && arr [ i ] < N ) { hash [ arr [ i ] ] = true ; } while ( hash [ smNonNeg ] ) { smNonNeg ++ ; } System . out . print ( smNonNeg + " ▁ " ) ; } } public static void main ( String [ ] args ) { int arr [ ] = { 0 , 1 , 2 , 3 , 5 } ; int N = arr . length ; smlstNonNeg ( arr , N ) ; } }

Index/key variables: i, smNonNeg
Accumulator variables: i, smNonNeg
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void solve ( int arr [ ] , int N , int X ) { Vector < Integer > A = new Vector < Integer > ( ) , B = new Vector < Integer > ( ) ; int c = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( ( 2 * arr [ i ] ) < X ) { A . add ( arr [ i ] ) ; } else if ( ( 2 * arr [ i ] ) > X ) { B . add ( arr [ i ] ) ; } else { if ( c % 2 == 0 ) { A . add ( arr [ i ] ) ; } else { B . add ( arr [ i ] ) ; } c ++ ; } } System . out . print ( " The ▁ First ▁ Array ▁ is ▁ - ▁ " ) ; for ( int i = 0 ; i < A . size ( ) ; i ++ ) { System . out . print ( A . get ( i ) + " ▁ " ) ; } System . out . println ( ) ; System . out . print ( " The ▁ Second ▁ Array ▁ is ▁ - ▁ " ) ; for ( int i = 0 ; i < B . size ( ) ; i ++ ) { System . out . print ( B . get ( i ) + " ▁ " ) ; } } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 5 , 4 , 3 , 6 , 2 , 4 , 3 } ; int X = 7 ; int N = arr . length ; solve ( arr , N , X ) ; } }

Index/key variables: i
Accumulator variables: c, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int cntMinSub ( int arr [ ] , int N , int K ) { int res = 0 ; int start = 0 ; int end = N - 1 ; Arrays . sort ( arr ) ; while ( end - start > 1 ) { if ( arr [ start ] + arr [ end ] <= K ) { start ++ ; } else { res ++ ; end -- ; } } if ( end - start == 1 ) { if ( arr [ start ] + arr [ end ] <= K ) { res ++ ; start ++ ; end -- ; } else { res ++ ; end -- ; } } if ( start == end ) { res ++ ; } return res ; } public static void main ( String [ ] args ) { int arr [ ] = { 2 , 6 , 8 , 10 , 20 , 25 } ; int N = arr . length ; int K = 26 ; System . out . print ( cntMinSub ( arr , N , K ) ) ; } }

Index/key variables: end, start
Accumulator variables: end, res, start
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int condition ( int a , int b ) { int d = Math . abs ( a - b ) , count = 0 ; for ( int i = 1 ; i <= Math . sqrt ( d ) ; i ++ ) { if ( d % i == 0 ) { if ( d / i == i ) count += 1 ; else count += 2 ; } } return count ; } public static void main ( String [ ] args ) { int x = 2 , y = 6 ; System . out . println ( condition ( x , y ) ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static boolean isComposite ( int N ) { for ( int i = 2 ; i * i <= N ; i ++ ) { if ( N % i == 0 ) { return true ; } } return false ; } static int compositePair ( int arr [ ] , int N ) { int res = 0 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = i + 1 ; j < N ; j ++ ) { int prod = arr [ i ] * arr [ j ] ; if ( isComposite ( prod ) ) { res ++ ; } } } return res ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 1 , 2 , 2 , 8 } ; int N = arr . length ; System . out . println ( compositePair ( arr , N ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, res
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int mod = ( int ) ( 1e9 + 7 ) ; static long power ( int x , int y ) { if ( y == 0 ) return 1 ; int p = ( int ) ( power ( x , y / 2 ) % mod ) ; p = ( p * p ) % mod ; if ( y % 2 == 1 ) { p = ( x * p ) % mod ; } return p ; } static int TotalNumber ( int N ) { int ans = ( int ) ( ( power ( 10 , N ) - 2 * power ( 9 , N ) + power ( 8 , N ) + 2 * mod ) % mod ) ; return ans ; } public static void main ( String [ ] args ) { int N = 10 , X = 3 , Y = 4 ; System . out . print ( TotalNumber ( N ) + "NEW_LINE"); } }

Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static void generateArray ( int arr [ ] , int n ) { Deque < Integer > ans = new LinkedList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( ( i & 1 ) != 0 ) ans . addFirst ( arr [ i ] ) ; else ans . add ( arr [ i ] ) ; } if ( ( n & 1 ) != 0 ) { Collections . reverse ( Arrays . asList ( ans ) ) ; } for ( int x : ans ) { System . out . print ( x + " ▁ " ) ; } System . out . println ( ) ; } public static void main ( String [ ] args ) { int n = 4 ; int arr [ ] = { 1 , 2 , 3 , 4 } ; generateArray ( arr , n ) ; } }

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

Accumulator variables: i, res
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int maximumSubarrays ( int arr [ ] , int N , int target ) { int ans = 0 ; int availIdx = - 1 ; int cur_sum = 0 ; HashMap < Integer , Integer > mp = new HashMap < Integer , Integer > ( ) ; mp . put ( 0 , 1 ) ; for ( int i = 0 ; i < N ; i ++ ) { cur_sum += arr [ i ] ; if ( mp . containsKey ( cur_sum - target ) && mp . get ( cur_sum - target ) >= availIdx ) { ans ++ ; availIdx = i ; } mp . put ( cur_sum , i ) ; } return ans ; } public static void main ( String [ ] args ) { int arr [ ] = { 2 , - 1 , 4 , 3 , 6 , 4 , 5 , 1 } ; int N = arr . length ; int target = 6 ; System . out . print ( maximumSubarrays ( arr , N , target ) ) ; } }

Index/key variables: i
Accumulator variables: ans, cur_sum, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int power ( int x , int y ) { int temp ; if ( y == 0 ) return 1 ; temp = power ( x , y / 2 ) ; if ( y % 2 == 0 ) return temp * temp ; else return x * temp * temp ; } public static void maximumPossibleSum ( int N , int X ) { System . out . println ( X * ( power ( 2 , N ) - 1 ) ) ; } public static void main ( String [ ] args ) { int N = 3 , X = 5 ; maximumPossibleSum ( N , X ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int countOfPairs ( int x , int y ) { int counter = 1 ; while ( x > 0 y > 0 ) { int bit1 = x % 2 ; int bit2 = y % 2 ; x >>= 1 ; y >>= 1 ; if ( bit1 == 1 && bit2 == 0 ) { counter *= 2 ; continue ; } if ( ( bit1 & bit2 ) > 0 ) { counter = 0 ; break ; } } return counter ; } public static void main ( String [ ] args ) { int X = 2 , Y = 5 ; System . out . print ( countOfPairs ( X , Y ) ) ; } }

Accumulator variables: counter
Class/struct names: GFG
Java program:
public class GCD { static int gcd ( int a , int b ) { if ( a == 0 ) return b ; return gcd ( b % a , a ) ; } static int findGCD ( int arr [ ] , int N ) { int result = 0 ; for ( int element : arr ) { result = gcd ( result , element ) ; if ( result == 1 ) { return 1 ; } } return result ; } public static void main ( String [ ] args ) { int arr [ ] = { 2 , 3 , 4 } ; int N = arr . length ; System . out . println ( findGCD ( arr , N ) ) ; } }

Iterator variables: element
Class/struct names: GCD
Java program:
class GFG { static void factorsOf3 ( int arr [ ] , int N ) { int a = 0 , b = 0 , c = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] % 3 == 0 ) a ++ ; else if ( arr [ i ] % 3 == 1 ) b ++ ; else if ( arr [ i ] % 3 == 2 ) c ++ ; } if ( a >= 1 && a <= b + c + 1 ) System . out . print ( " Yes " + "NEW_LINE"); else if ( a == 0 && b == 0 && c > 0 ) System . out . print ( " Yes " + "NEW_LINE"); else if ( a == 0 && c == 0 && b > 0 ) System . out . print ( " Yes " + "NEW_LINE"); else System . out . print ( " No " + "NEW_LINE"); } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 , 3 , 3 } ; int N = arr . length ; factorsOf3 ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: a, b, c, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean check_digits ( long N ) { while ( N > 0 ) { int n = ( int ) ( N % 10 ) ; if ( ( n != 0 ) && ( n != 1 ) && ( n != 4 ) && ( n != 9 ) ) { return false ; } N = N / 10 ; } return true ; } static boolean is_perfect ( long N ) { double n = Math . sqrt ( N ) ; if ( Math . floor ( n ) != Math . ceil ( n ) ) { return false ; } return true ; } static void isFullSquare ( long N ) { if ( is_perfect ( N ) && check_digits ( N ) ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } public static void main ( String [ ] args ) { long N = 144 ; isFullSquare ( N ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void countSubString ( char [ ] s , int n ) { HashMap < Character , Integer > mp = new HashMap < Character , Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) if ( mp . containsKey ( s [ i ] ) ) { mp . put ( s [ i ] , mp . get ( s [ i ] ) + 1 ) ; } else { mp . put ( s [ i ] , 1 ) ; } int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int cnt = 0 ; if ( mp . containsKey ( s [ i ] ) ) { mp . put ( s [ i ] , mp . get ( s [ i ] ) - 1 ) ; for ( Map . Entry < Character , Integer > value : mp . entrySet ( ) ) { if ( value . getKey ( ) == s [ i ] ) { continue ; } else { cnt += value . getValue ( ) ; } } ans += cnt ; } } System . out . print ( ans ) ; } public static void main ( String [ ] args ) { String S = " abcab " ; int N = 5 ; countSubString ( S . toCharArray ( ) , N ) ; } }

Index/key variables: i
Accumulator variables: ans, cnt, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int maxBottles ( int n , int e ) { int s = 0 , b = 0 ; int a = n ; while ( a != 0 ) { s = s + a ; a = ( a + b ) / e ; b = n - ( a * e ) ; n = a + b ; } return s ; } public static void main ( String [ ] args ) { int n = 9 , e = 3 ; int s = maxBottles ( n , e ) ; System . out . print ( s + "NEW_LINE"); } }

Class/struct names: GFG
Java program:
class GFG { static int power ( int x , int n ) { int temp ; if ( n == 0 ) return 1 ; temp = power ( x , n / 2 ) ; if ( n % 2 == 0 ) return temp * temp ; else return x * temp * temp ; } static int count_Total_Numbers ( int n , int x ) { int total , multiples = 0 ; for ( int i = 0 ; i < 10 ; i ++ ) { if ( i % x == 0 ) multiples ++ ; } if ( n == 1 ) return multiples ; total = ( multiples - 1 ) * power ( multiples , n - 1 ) ; return total ; } public static void main ( String [ ] args ) { int N = 1 , X = 3 ; System . out . printf ( " % d ▁ " , count_Total_Numbers ( N , X ) ) ; } }

Accumulator variables: i, multiples
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int getPosition ( int N , int M ) { if ( M > ( N / 2 ) ) { return ( M - ( N / 2 ) ) ; } return ( M + ( N / 2 ) ) ; } public static void main ( String [ ] args ) { int N = 8 , M = 5 ; System . out . print ( getPosition ( N , M ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; import java . lang . * ; class GFG { static void number_of_strings ( int N , int M ) { int ans = 0 ; while ( N > 0 && M > 0 ) { if ( N > M ) { if ( N >= 2 ) { N -= 2 ; -- M ; ++ ans ; } else { break ; } } else { if ( M >= 2 ) { M -= 2 ; -- N ; ++ ans ; } else { break ; } } } System . out . println ( ans ) ; } public static void main ( String [ ] args ) { int N = 4 , M = 19 ; number_of_strings ( N , M ) ; } }

Accumulator variables: M, N
Class/struct names: GFG
Java program:
class GFG { static int minLength ( int A [ ] , int N ) { int elem = A [ 0 ] , count = 1 ; for ( int i = 1 ; i < N ; i ++ ) { if ( A [ i ] == elem ) { count ++ ; } else { break ; } } if ( count == N ) return N ; else return 1 ; } public static void main ( String [ ] args ) { int arr [ ] = { 2 , 1 , 3 , 1 } ; int N = arr . length ; System . out . print ( minLength ( arr , N ) + "NEW_LINE"); } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static boolean NegEqu ( int N , int X , int Y ) { while ( X > 0 && ( N > N / 2 + 10 ) ) { N = N / 2 + 10 ; X -= 1 ; } while ( Y > 0 ) { N = N - 10 ; Y -= 1 ; } if ( N <= 0 ) return true ; return false ; } public static void main ( String [ ] args ) { int N = 100 ; int X = 3 ; int Y = 4 ; if ( NegEqu ( N , X , Y ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }

Accumulator variables: X, Y
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int minSubarrays ( int arr [ ] , int n ) { int right = n - 1 ; int left = 0 ; int subarrays = 0 ; while ( right >= 0 ) { for ( left = 0 ; left <= right ; left += 1 ) { if ( __gcd ( arr [ left ] , arr [ right ] ) > 1 ) { subarrays += 1 ; right = left - 1 ; break ; } if ( left == right && __gcd ( arr [ left ] , arr [ right ] ) == 1 ) { return 0 ; } } } return subarrays ; } static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } public static void main ( String [ ] args ) { int N = 6 ; int arr [ ] = { 2 , 3 , 4 , 4 , 4 , 3 } ; System . out . print ( minSubarrays ( arr , N ) ) ; } }

Index/key variables: left, right
Accumulator variables: left, subarrays
Iterator variables: left
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int findMaxSoln ( int n , int x , int y ) { int ans = Integer . MIN_VALUE ; for ( int k = 0 ; k <= n ; k ++ ) { if ( k % x == y ) { ans = Math . max ( ans , k ) ; } } return ( ( ans >= 0 && ans <= n ) ? ans : - 1 ) ; } public static void main ( String [ ] args ) { int n = 15 , x = 10 , y = 5 ; System . out . print ( findMaxSoln ( n , x , y ) ) ; } }

Accumulator variables: k
Iterator variables: k
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int getCount ( int N , int M ) { int total_count = 0 ; total_count += ( N / 10 ) ; int x = ( N / 10 ) * 10 ; if ( ( N - x ) >= M ) { total_count = total_count + 1 ; } return total_count ; } public static void main ( String [ ] args ) { int N = 100 , M = 1 ; System . out . print ( getCount ( N , M ) ) ; } }

Accumulator variables: total_count
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int RightAngled ( int a [ ] [ ] , int n ) { HashMap < Integer , Integer > xpoints = new HashMap < Integer , Integer > ( ) ; HashMap < Integer , Integer > ypoints = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( xpoints . containsKey ( a [ i ] [ 0 ] ) ) { xpoints . put ( a [ i ] [ 0 ] , xpoints . get ( a [ i ] [ 0 ] ) + 1 ) ; } else { xpoints . put ( a [ i ] [ 0 ] , 1 ) ; } if ( ypoints . containsKey ( a [ i ] [ 1 ] ) ) { ypoints . put ( a [ i ] [ 1 ] , ypoints . get ( a [ i ] [ 1 ] ) + 1 ) ; } else { ypoints . put ( a [ i ] [ 1 ] , 1 ) ; } } int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( xpoints . get ( a [ i ] [ 0 ] ) >= 1 && ypoints . get ( a [ i ] [ 1 ] ) >= 1 ) { count += ( xpoints . get ( a [ i ] [ 0 ] ) - 1 ) * ( ypoints . get ( a [ i ] [ 1 ] ) - 1 ) ; } } return count ; } public static void main ( String [ ] args ) { int N = 5 ; int arr [ ] [ ] = { { 1 , 2 } , { 2 , 1 } , { 2 , 2 } , { 2 , 3 } , { 3 , 2 } } ; System . out . print ( RightAngled ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void printArray ( Vector < Integer > brr ) { for ( int it : brr ) { System . out . print ( it + " ▁ " ) ; } } static void RepeatingSubarray ( int arr [ ] , int N ) { if ( N < 2 ) { System . out . print ( " - 1" ) ; } Vector < Integer > brr = new Vector < Integer > ( ) ; brr . add ( arr [ 0 ] ) ; brr . add ( arr [ 1 ] ) ; for ( int i = 2 ; i < N / 2 + 1 ; i ++ ) { if ( N % i == 0 ) { boolean a = false ; int n = brr . size ( ) ; int j = i ; while ( j < N ) { int K = j % i ; if ( arr [ j ] == brr . get ( K ) ) { j ++ ; } else { a = true ; break ; } } if ( ! a && j == N ) { printArray ( brr ) ; return ; } } brr . add ( arr [ i ] ) ; } System . out . print ( " - 1" ) ; return ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 , 2 , 1 , 2 , 2 , 1 , 2 , 2 } ; int N = arr . length ; RepeatingSubarray ( arr , N ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, it
Boolean variables: a
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void printMissingElements ( int arr [ ] , int N ) { int diff = arr [ 0 ] - 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] - i != diff ) { while ( diff < arr [ i ] - i ) { System . out . print ( ( i + diff ) + " ▁ " ) ; diff ++ ; } } } } public static void main ( String [ ] args ) { int arr [ ] = { 6 , 7 , 10 , 11 , 13 } ; int N = arr . length ; printMissingElements ( 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 printMissingElements ( int arr [ ] , int N ) { int [ ] b = new int [ arr [ N - 1 ] + 1 ] ; for ( int i = 0 ; i < N ; i ++ ) { b [ arr [ i ] ] = 1 ; } for ( int i = arr [ 0 ] ; i <= arr [ N - 1 ] ; i ++ ) { if ( b [ i ] == 0 ) { System . out . print ( i + " ▁ " ) ; } } } public static void main ( String [ ] args ) { int arr [ ] = { 6 , 7 , 10 , 11 , 13 } ; int N = arr . length ; printMissingElements ( 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 smallestCommon ( int a , int b , int c , int d ) { if ( a == c ) return a ; if ( a > c ) { swap ( a , c ) ; swap ( b , d ) ; } int first_term_diff = ( c - a ) ; int possible_y ; for ( possible_y = 0 ; possible_y < b ; possible_y ++ ) { if ( ( first_term_diff % b + possible_y * d ) % b == 0 ) { break ; } } if ( possible_y != b ) { return c + possible_y * d ; } return - 1 ; } static void swap ( int x , int y ) { int temp = x ; x = y ; y = temp ; } public static void main ( String [ ] args ) { int A = 2 , B = 20 , C = 19 , D = 9 ; System . out . print ( smallestCommon ( A , B , C , D ) ) ; } }

Accumulator variables: possible_y
Iterator variables: possible_y
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int MinimumFlips ( String s , int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = ( s . charAt ( i ) == '1' ? 1 : 0 ) ; } int [ ] oddone = new int [ n + 1 ] ; int [ ] evenone = new int [ n + 1 ] ; oddone [ 0 ] = 0 ; evenone [ 0 ] = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( i % 2 != 0 ) { oddone [ i + 1 ] = oddone [ i ] + ( a [ i ] == 1 ? 1 : 0 ) ; evenone [ i + 1 ] = evenone [ i ] + ( a [ i ] == 0 ? 1 : 0 ) ; } else { oddone [ i + 1 ] = oddone [ i ] + ( a [ i ] == 0 ? 1 : 0 ) ; evenone [ i + 1 ] = evenone [ i ] + ( a [ i ] == 1 ? 1 : 0 ) ; } } int minimum = Math . min ( oddone [ n ] , evenone [ n ] ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( n % 2 != 0 ) { minimum = Math . min ( minimum , oddone [ n ] - oddone [ i + 1 ] + evenone [ i + 1 ] ) ; minimum = Math . min ( minimum , evenone [ n ] - evenone [ i + 1 ] + oddone [ i + 1 ] ) ; } } return minimum ; } public static void main ( String [ ] args ) { String S = "000001100" ; int n = S . length ( ) ; System . out . print ( MinimumFlips ( S , n ) ) ; } }

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