dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
import java . io . * ; import java . lang . * ; import java . util . * ; class GFG { static int setBits ( long n ) { int count = 0 ; while ( n > 0 ) { n = n & ( n - 1 ) ; count ++ ; } return count ; } static void findNthTerm ( int N ) { int x = setBits ( N ^ ( N - 1 ) ) ; System . out . println ( x ) ; } public static void main ( String [ ] args ) { int N = 8 ; findNthTerm ( N ) ; } }

Accumulator variables: count
Class/struct names: GFG
Java program:
class GFG { static void findEquation ( int A , int B , int C ) { System . out . print ( " ( " + C + " ) " + " x ^ 2 ▁ + ( " + B + " ) x ▁ + ▁ ( " + A + " ) ▁ = ▁ 0" ) ; } public static void main ( String args [ ] ) { int A = 1 , B = - 5 , C = 6 ; findEquation ( A , B , C ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static int findMinMoves ( int [ ] arr , int N ) { int sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) sum += arr [ i ] ; if ( sum % N != 0 ) return - 1 ; int avg = sum / N ; int total = 0 ; int needCount = 0 ; for ( int i = 0 ; i < N ; i ++ ) { needCount += ( arr [ i ] - avg ) ; total = Math . max ( Math . max ( Math . abs ( needCount ) , arr [ i ] - avg ) , total ) ; } return total ; } public static void main ( String [ ] args ) { int [ ] arr = { 1 , 0 , 5 } ; int N = arr . length ; System . out . println ( findMinMoves ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: i, needCount, sum
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void find ( int N , int [ ] [ ] Arr ) { int amount = 0 ; ArrayList < Integer > mid_odd = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { int siz = Arr [ i ] . length ; for ( int j = 0 ; j < siz / 2 ; j ++ ) amount = amount + Arr [ i ] [ j ] ; if ( siz % 2 == 1 ) mid_odd . add ( Arr [ i ] [ siz / 2 ] ) ; } Collections . sort ( mid_odd ) ; for ( int i = 0 ; i < mid_odd . size ( ) ; i ++ ) { if ( i % 2 == 0 ) amount = amount + mid_odd . get ( i ) ; } System . out . println ( amount ) ; } public static void main ( String [ ] args ) { int N = 2 ; int [ ] [ ] Arr = { { 5 , 2 , 3 , 4 } , { 1 , 6 } } ; find ( N , Arr ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static String checkPattern ( int arr [ ] , int m , int k , int n ) { int count = 1 , t = 0 ; for ( int i = 0 ; i < n - m ; i ++ ) { if ( arr [ i ] == arr [ i + m ] ) { t ++ ; if ( t == m ) { t = 0 ; count ++ ; if ( count == k ) { return " Yes " ; } } } else { t = 0 ; count = 1 ; } } return " No " ; } public static void main ( String [ ] args ) { int arr [ ] = { 6 , 1 , 3 , 3 , 3 , 3 } ; int M = 1 , K = 3 ; int N = arr . length ; System . out . print ( checkPattern ( arr , M , K , N ) ) ; } }

Index/key variables: i
Accumulator variables: count, i, t
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void moveAllDigitAtBeginning ( String str ) { int len = str . length ( ) ; StringBuilder digits = new StringBuilder ( ) ; StringBuilder nonNumericCharacter = new StringBuilder ( ) ; for ( char c : str . toCharArray ( ) ) { if ( c >= 48 && c <= 57 ) { digits . append ( c ) ; } else { nonNumericCharacter . append ( c ) ; } } digits . append ( nonNumericCharacter . toString ( ) ) ; System . out . print ( digits . toString ( ) + " ▁ " ) ; } public static void main ( String args [ ] ) { String str = " GeeksforGeeks123" ; moveAllDigitAtBeginning ( str ) ; } }

Iterator variables: c
Class/struct names: GFG
Java program:
class GFG { static void moveAllDigitAtBeginning ( String str ) { String moveAllDigit = str . replaceAll ( " \\ D + " , " " ) + str . replaceAll ( " \\ d + " , " " ) ; System . out . println ( moveAllDigit ) ; } public static void main ( String args [ ] ) { String str = " GeeksforGeeks1234" ; moveAllDigitAtBeginning ( str ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void getZarr ( String str , int Z [ ] ) { int n = str . length ( ) ; int k ; int L = 0 ; int R = 0 ; for ( int i = 1 ; i < n ; ++ i ) { if ( i > R ) { L = R = i ; while ( R < n && str . charAt ( R - L ) == str . charAt ( R ) ) { R ++ ; } Z [ i ] = R - L ; R -- ; } else { k = i - L ; if ( Z [ k ] < R - i + 1 ) { Z [ i ] = Z [ k ] ; } else { L = i ; while ( R < n && str . charAt ( R - L ) == str . charAt ( R ) ) { R ++ ; } Z [ i ] = R - L ; R -- ; } } } } static String goodStr ( String str , String word ) { String concat = word + " $ " + str ; int l = concat . length ( ) ; int [ ] Z = new int [ l ] ; getZarr ( concat , Z ) ; String res = " " ; int pSize = word . length ( ) ; for ( int i = 0 ; i < l ; ++ i ) { if ( i + pSize < l - 1 && Z [ i + pSize + 1 ] == pSize ) { i += pSize - 1 ; } else if ( i < str . length ( ) ) { res += str . charAt ( i ) ; } } return res ; } public static void main ( String [ ] args ) { String str = " Z - kmalgorithmkmiskmkmkmhelpfulkminkmsearching " ; String word = " km " ; System . out . print ( goodStr ( str , word ) ) ; } }

Index/key variables: i, k, l
Accumulator variables: R, i, res
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void findOccurrences ( String S , String T ) { int n1 = S . length ( ) ; int n2 = T . length ( ) ; int ans = 0 ; int last = 0 ; for ( int i = 0 ; i <= n1 - n2 ; i ++ ) { boolean chk = true ; for ( int j = 0 ; j < n2 ; j ++ ) { if ( T . charAt ( j ) != S . charAt ( i + j ) ) { chk = false ; break ; } } if ( chk ) { ans += ( i + 1 - last ) * ( n1 - ( i + n2 - 1 ) ) ; last = i + 1 ; } } System . out . println ( ans ) ; } public static void main ( String [ ] args ) { String S = " dabc " , T = " ab " ; findOccurrences ( S , T ) ; } }

Accumulator variables: ans, i, j
Iterator variables: i, j
Boolean variables: chk
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void LargestArray ( int N , int low , int high ) { int high_index = N - ( high - low + 1 ) ; if ( high_index > ( N - 1 ) / 2 ) { System . out . print ( " Not ▁ Possible " ) ; return ; } if ( high_index <= 0 ) high_index = 1 ; int [ ] A = new int [ N ] ; int temp = high ; for ( int i = high_index ; i >= 0 ; i -- ) { A [ i ] = temp -- ; } high -= 1 ; for ( int i = high_index + 1 ; i < N ; i ++ ) A [ i ] = high -- ; for ( int i = 0 ; i < N ; i ++ ) { System . out . print ( A [ i ] + " ▁ " ) ; } } public static void main ( String [ ] args ) { int N = 5 , low = 2 , high = 6 ; LargestArray ( N , low , high ) ; } }

Index/key variables: N, i
Accumulator variables: high, i, temp
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void printDiagonalTraversal ( int [ ] [ ] nums ) { int max_size = nums [ 0 ] . length ; ArrayList < ArrayList < Integer > > v = new ArrayList < ArrayList < Integer > > ( ) ; for ( int i = 0 ; i < 2 * max_size - 1 ; i ++ ) { v . add ( new ArrayList < Integer > ( ) ) ; } for ( int i = 0 ; i < nums [ 0 ] . length ; i ++ ) { for ( int j = 0 ; j < nums [ 0 ] . length ; j ++ ) { v . get ( i + j ) . add ( nums [ i ] [ j ] ) ; } } for ( int i = 0 ; i < v . size ( ) ; i ++ ) { for ( int j = v . get ( i ) . size ( ) - 1 ; j >= 0 ; j -- ) { System . out . print ( v . get ( i ) . get ( j ) + " ▁ " ) ; } } } public static void main ( String [ ] args ) { int [ ] [ ] arr = { { 1 , 2 , 3 } , { 4 , 5 , 6 } , { 7 , 8 , 9 } } ; printDiagonalTraversal ( arr ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void isValid ( String s ) { int n = ( int ) Math . sqrt ( s . length ( ) ) ; char check = s . charAt ( 0 ) ; for ( int i = 0 ; i < n ; i ++ ) { int x = i , y = i ; while ( x >= 0 && y < n ) { if ( s . charAt ( ( n * x ) + y ) != check || s . charAt ( ( n * y ) + x ) != check ) { System . out . print ( " No " ) ; return ; } x -- ; y ++ ; } } System . out . print ( " Yes " ) ; } public static void main ( String [ ] args ) { String str = " abacdaeaafaghaia " ; isValid ( str ) ; } }

Accumulator variables: i, x, y
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int N = 10 ; static int [ ] pref = new int [ N ] ; static int [ ] power = new int [ N ] ; static int toDigit ( char ch ) { return ( ch - '0' ) ; } static void powerOf10 ( ) { power [ 0 ] = 1 ; for ( int i = 1 ; i < N ; i ++ ) power [ i ] = power [ i - 1 ] * 10 ; } static void precomputePrefix ( char [ ] str , int n ) { pref [ 0 ] = str [ 0 ] - '0' ; for ( int i = 1 ; i < n ; i ++ ) pref [ i ] = pref [ i - 1 ] + toDigit ( str [ i ] ) ; } static int triangularNumber ( int i ) { int res = i * ( i + 1 ) / 2 ; return res ; } static int sumOfSubStrings ( String str ) { int n = str . length ( ) ; powerOf10 ( ) ; precomputePrefix ( str . toCharArray ( ) , n ) ; int ans = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { ans += ( pref [ n - i - 2 ] * ( i + 1 ) + toDigit ( str . charAt ( n - i - 1 ) ) * triangularNumber ( n - i - 1 ) ) * power [ i ] ; } return ans ; } public static void main ( String [ ] args ) { String str = "1234" ; System . out . print ( sumOfSubStrings ( str ) ) ; } }

Index/key variables: N, i
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . Arrays ; class GFG { static int OddLengthSum ( int [ ] arr ) { int sum = 0 ; int l = arr . length ; for ( int i = 0 ; i < l ; i ++ ) { for ( int j = i ; j < l ; j += 2 ) { for ( int k = i ; k <= j ; k ++ ) { sum += arr [ k ] ; } } } return sum ; } public static void main ( String [ ] args ) { int [ ] arr = { 1 , 5 , 3 , 1 , 2 } ; System . out . print ( OddLengthSum ( arr ) ) ; } }

Index/key variables: k
Accumulator variables: i, j, k, sum
Iterator variables: i, j, k
Class/struct names: GFG
Java program:
class GFG { static int OddLengthSum ( int [ ] arr ) { int sum = 0 ; int l = arr . length ; for ( int i = 0 ; i < l ; i ++ ) { sum += ( ( ( i + 1 ) * ( l - i ) + 1 ) / 2 ) * arr [ i ] ; } return sum ; } public static void main ( String [ ] args ) { int [ ] arr = { 1 , 5 , 3 , 1 , 2 } ; System . out . print ( OddLengthSum ( arr ) ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int phi ( int n ) { int result = 1 ; for ( int p = 2 ; p < n ; p ++ ) { if ( __gcd ( p , n ) == 1 ) { result ++ ; } } return result ; } static boolean sameEulerTotient ( int n ) { return phi ( n ) == phi ( 2 * n ) ; } static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } public static void main ( String [ ] args ) { int N = 13 ; if ( sameEulerTotient ( N ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Accumulator variables: p, result
Iterator variables: p
Class/struct names: GFG
Java program:
class GFG { static int sameEulerTotient ( int N ) { return ( N & 1 ) ; } public static void main ( String [ ] args ) { int N = 13 ; if ( sameEulerTotient ( N ) == 1 ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void solve ( int arr [ ] , int N ) { HashMap < Integer , Integer > M = new HashMap < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { M . put ( i , arr [ i ] ) ; } Arrays . sort ( arr ) ; HashMap < Integer , Integer > Count = new HashMap < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { Count . put ( arr [ i ] , ( int ) Math . pow ( 2 , N - i - 1 ) ) ; } for ( Map . Entry < Integer , Integer > m : M . entrySet ( ) ) { System . out . print ( Count . get ( m . getValue ( ) ) + " ▁ " ) ; } } public static void main ( String [ ] args ) { int arr [ ] = { 5 , 2 , 1 } ; int N = arr . length ; solve ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static boolean checkOdd ( char ch ) { return ( ( ch - '0' ) & 1 ) != 0 ? true : false ; } static String Insert_dash ( String num_str ) { StringBuilder result_str = new StringBuilder ( num_str ) ; for ( int x = 0 ; x < num_str . length ( ) - 1 ; x ++ ) { if ( checkOdd ( num_str . charAt ( x ) ) && checkOdd ( num_str . charAt ( x + 1 ) ) ) { result_str . insert ( x + 1 , " - " ) ; num_str = result_str . toString ( ) ; x ++ ; } } return result_str . toString ( ) ; } public static void main ( String [ ] args ) { String str = "1745389" ; System . out . println ( Insert_dash ( str ) ) ; } }

Accumulator variables: x
Iterator variables: x
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int N = 3 , M = 3 ; static boolean checkReverseBitonic ( int arr [ ] , int n ) { int i , j , f = 0 ; for ( i = 1 ; i < n ; i ++ ) { if ( arr [ i ] < arr [ i - 1 ] ) continue ; if ( arr [ i ] == arr [ i - 1 ] ) return false ; else { f = 1 ; break ; } } if ( i == n ) return true ; for ( j = i + 1 ; j < n ; j ++ ) { if ( arr [ j ] > arr [ j - 1 ] ) continue ; if ( arr [ i ] == arr [ i - 1 ] ) return false ; else { if ( f == 1 ) return false ; } } return true ; } static void check ( int arr [ ] [ ] ) { int f = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( ! checkReverseBitonic ( arr [ i ] , M ) ) { System . out . print ( " No " + "NEW_LINE"); return ; } } for ( int i = 0 ; i < N ; i ++ ) { int temp [ ] = new int [ N ] ; for ( int j = 0 ; j < N ; j ++ ) { temp [ j ] = arr [ j ] [ i ] ; } if ( ! checkReverseBitonic ( temp , N ) ) { System . out . print ( " No " + "NEW_LINE"); return ; } } System . out . print ( " Yes " ) ; } public static void main ( String [ ] args ) { int m [ ] [ ] = { { 2 , 3 , 4 } , { 1 , 2 , 3 } , { 4 , 5 , 6 } } ; check ( m ) ; } }

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

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void string_modify ( char [ ] s ) { char [ ] alphabets = new char [ 26 ] ; int flag = 0 , hold_i = 0 ; char hold_l = 0 ; int i ; for ( i = 0 ; i < 26 ; i ++ ) { alphabets [ i ] = ( char ) ( i + ' a ' ) ; } HashSet < Integer > difference = new HashSet < Integer > ( ) ; String reconstruct = " " ; for ( i = 1 ; i < s . length ; i ++ ) { difference . add ( s [ i ] - s [ i - 1 ] ) ; } if ( difference . size ( ) == 1 ) { System . out . print ( " No ▁ modifications ▁ required " ) ; return ; } for ( int it : difference ) { int index = s [ 0 ] - ' a ' ; reconstruct = " " ; flag = 0 ; for ( i = 0 ; i < s . length && flag <= 1 ; i ++ ) { reconstruct += alphabets [ index ] ; index += it ; if ( index < 0 ) { index += 26 ; } index %= 26 ; if ( reconstruct . charAt ( i ) != s [ i ] ) { flag ++ ; hold_i = i ; hold_l = s [ i ] ; } } if ( flag == 1 ) { s [ hold_i ] = reconstruct . charAt ( hold_i ) ; break ; } } if ( flag < 1 ) { hold_i = 0 ; hold_l = s [ 0 ] ; int temp = ( s [ 1 ] - ' a ' - ( s [ 2 ] - s [ 1 ] ) ) % 26 ; if ( temp < 0 ) { temp += 26 ; } s [ 0 ] = alphabets [ temp ] ; } System . out . print ( hold_i + " ▁ - > ▁ " + hold_l + "NEW_LINE" + String . valueOf ( s ) + "NEW_LINE"); } public static void main ( String [ ] args ) { String s = " aeimqux " ; string_modify ( s . toCharArray ( ) ) ; } }

Index/key variables: hold_i, i, index, temp
Accumulator variables: flag, i, index, reconstruct, temp
Iterator variables: i, it
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void evenSubMatrix ( int N ) { int even = 1 ; int odd = 2 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) { if ( ( i + j ) % 2 == 0 ) { System . out . print ( even + " ▁ " ) ; even += 2 ; } else { System . out . print ( odd + " ▁ " ) ; odd += 2 ; } } System . out . println ( ) ; } } public static void main ( String [ ] args ) { int N = 4 ; evenSubMatrix ( N ) ; } }

Accumulator variables: even, i, j, odd
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . regex . * ; class GFG { public static void removeLeadingZeros ( String str ) { String regex = " ^ 0 + ( ? ! $ ) " ; str = str . replaceAll ( regex , " " ) ; System . out . println ( str ) ; } public static void main ( String args [ ] ) { String str = "0001234" ; removeLeadingZeros ( str ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void maximum_inversion ( int n , int k ) { int answer = 0 ; k = Math . min ( k , n / 2 ) ; int left = 1 ; int right = n ; while ( k != 0 ) { k -- ; answer += 2 * ( right - left ) - 1 ; left ++ ; right -- ; } System . out . println ( answer ) ; } public static void main ( String s [ ] ) { int N = 5 ; int K = 3 ; maximum_inversion ( N , K ) ; N = 4 ; K = 1 ; maximum_inversion ( N , K ) ; } }

Accumulator variables: answer, k, left, right
Class/struct names: GFG
Java program:
import java . util . * ; import java . lang . Math ; import java . io . * ; class GFG { static int getFirstSetBitPos ( int n ) { return ( int ) ( Math . log ( n & - n ) / Math . log ( 2 ) ) ; } static int oddFirst ( int a , int b ) { int steps_a = getFirstSetBitPos ( a ) ; int steps_b = getFirstSetBitPos ( b ) ; if ( steps_a == steps_b ) { return - 1 ; } else if ( steps_a > steps_b ) { return b ; } else { return a ; } } public static void main ( String [ ] args ) { int a = 10 ; int b = 8 ; System . out . print ( oddFirst ( a , b ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { public static boolean helper ( String s , int pos ) { int len = s . length ( ) ; if ( pos >= len ) return true ; if ( ! Character . isDigit ( s . charAt ( pos ) ) ) return false ; int num = 0 ; for ( int i = pos ; i < len ; i ++ ) { num = num * 10 + s . charAt ( pos ) - '0' ; if ( i + 1 + num > len ) return false ; if ( helper ( s , i + 1 + num ) ) return true ; } return false ; } public static void main ( String [ ] args ) { String s = "123abc4db1c " ; if ( helper ( s , 0 ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { public static long [ ] N_bonacci = new long [ 100 ] ; @ SuppressWarnings ( " unchecked " ) public static void N_bonacci_nums ( int n , int k ) { N_bonacci [ 0 ] = 1 ; for ( int i = 1 ; i <= 50 ; ++ i ) { for ( int j = i - 1 ; j >= i - k && j >= 0 ; -- j ) N_bonacci [ i ] += N_bonacci [ j ] ; } Vector ans = new Vector ( ) ; for ( int i = 50 ; i >= 0 ; -- i ) if ( n - N_bonacci [ i ] >= 0 ) { ans . add ( N_bonacci [ i ] ) ; n -= N_bonacci [ i ] ; } if ( ans . size ( ) == 1 ) ans . add ( 0 ) ; System . out . println ( ans . size ( ) ) ; for ( int i = 0 ; i < ans . size ( ) ; ++ i ) System . out . print ( ans . get ( i ) + " , ▁ " ) ; } public static void main ( String args [ ] ) { int n = 21 , k = 5 ; N_bonacci_nums ( n , k ) ; } }

Index/key variables: i, j
Accumulator variables: n
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void solve ( int n , int k ) { int x1 , d ; d = k * ( k + 1 ) ; if ( ( 2 * n ) % d != 0 ) { System . out . print ( " - 1" ) ; return ; } x1 = 2 * n / d ; for ( int i = 1 ; i <= k ; i ++ ) { System . out . print ( x1 * i + " ▁ " ) ; } System . out . println ( ) ; } public static void main ( String [ ] args ) { int n = 10 , k = 4 ; solve ( n , k ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int checkBitonic ( char [ ] s ) { int i , j ; for ( i = 1 ; i < s . length ; i ++ ) { if ( s [ i ] > s [ i - 1 ] ) continue ; if ( s [ i ] <= s [ i - 1 ] ) break ; } if ( i == s . length - 1 ) return 1 ; for ( j = i + 1 ; j < s . length ; j ++ ) { if ( s [ j ] < s [ j - 1 ] ) continue ; if ( s [ j ] >= s [ j - 1 ] ) break ; } i = j ; if ( i != s . length ) return 0 ; return 1 ; } public static void main ( String [ ] args ) { String s = " abcdfgcba " ; System . out . print ( ( checkBitonic ( s . toCharArray ( ) ) == 1 ) ? " YES " : " NO " ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static void solve ( int N ) { if ( N % 2 == 0 ) { System . out . print ( N / 2 + " ▁ " + N + "NEW_LINE"); } else { System . out . print ( ( N - 1 ) / 2 + " ▁ " + ( N - 1 ) + "NEW_LINE"); } } public static void main ( String [ ] args ) { int N = 10 ; solve ( N ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void findArray ( int [ ] a , int n , int P ) { int mi = Arrays . stream ( a ) . min ( ) . getAsInt ( ) ; int ctr = 0 ; mi = Math . max ( 0 , mi - 1 ) ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] -= mi ; ctr += mi ; } int i = P - 1 ; int start = - 1 ; while ( true ) { if ( a [ i ] == 0 ) { start = i ; break ; } a [ i ] -= 1 ; ctr += 1 ; i = ( i - 1 + n ) % n ; } a [ start ] = ctr ; for ( i = 0 ; i < n ; i ++ ) { System . out . print ( a [ i ] + " , ▁ " ) ; } } public static void main ( String [ ] args ) { int N = 5 ; int P = 2 ; int arr [ ] = { 3 , 2 , 0 , 2 , 7 } ; findArray ( arr , N , P ) ; } }

Index/key variables: i, start
Accumulator variables: ctr, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void makeArray ( int a [ ] , int n ) { for ( int i = 1 ; i <= n ; i ++ ) System . out . print ( i * n + " ▁ " ) ; } public static void main ( String [ ] args ) { int N = 6 ; int arr [ ] = new int [ N ] ; makeArray ( arr , N ) ; } }

Index/key variables: N
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int printOddFactorNumber ( int n , int m ) { for ( int i = n ; i <= m ; i ++ ) { if ( ( i > 0 ) && ( ( i & ( i - 1 ) ) != 0 ) ) System . out . print ( i + " ▁ " ) ; } return 0 ; } public static void main ( String [ ] args ) { int N = 2 , M = 10 ; printOddFactorNumber ( N , M ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void printSeries ( int n ) { int k = 2 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . print ( k * ( 2 * k - 1 ) + " ▁ " ) ; k += 2 ; } System . out . println ( ) ; } public static void main ( String args [ ] ) { int N = 12 ; printSeries ( N ) ; } }

Accumulator variables: i, k
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int k1 = 2 ; static int k2 = 2 ; static int gap = 5 ; public static int printPattern ( int i , int j , int n ) { if ( j >= n ) { k1 = 2 ; k2 = 2 ; k1 -- ; k2 ++ ; if ( i == 2 ) { k1 = 0 ; k2 = n - 1 ; } return 0 ; } if ( i >= 3 ) { return 1 ; } if ( j > k2 ) { k1 += gap ; k2 += gap ; } if ( j >= k1 && j <= k2 i == 2 ) { System . out . print ( " * " ) ; } else { System . out . print ( " ▁ " ) ; } if ( printPattern ( i , j + 1 , n ) == 1 ) { return 1 ; } System . out . println ( ) ; return printPattern ( i + 1 , 0 , n ) ; } public static void main ( String [ ] args ) { int N = 3 ; printPattern ( 0 , 0 , N * 5 ) ; } }

Accumulator variables: k1, k2
Class/struct names: GFG