dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
class GFG { static void find_minimum_operations ( int n , int b [ ] , int k ) { int d [ ] = new int [ n + 1 ] ; int i , operations = 0 , need ; for ( i = 0 ; i < n ; i ++ ) { if ( i > 0 ) { d [ i ] += d [ i - 1 ] ; } if ( b [ i ] > d [ i ] ) { operations += b [ i ] - d [ i ] ; need = b [ i ] - d [ i ] ; d [ i ] += need ; if ( i + k <= n ) { d [ i + k ] -= need ; } } } System . out . println ( operations ) ; } public static void main ( String [ ] args ) { int n = 5 ; int b [ ] = { 1 , 2 , 3 , 4 , 5 } ; int k = 2 ; find_minimum_operations ( n , b , k ) ; } }

Index/key variables: i
Accumulator variables: i, operations
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; import java . lang . * ; import java . io . * ; class GFG { static int ways ( int [ ] [ ] arr , int K ) { int R = arr . length ; int C = arr [ 0 ] . length ; int [ ] [ ] preSum = new int [ R ] [ C ] ; for ( int r = R - 1 ; r >= 0 ; r -- ) { for ( int c = C - 1 ; c >= 0 ; c -- ) { preSum [ r ] = arr [ r ] ; if ( r + 1 < R ) preSum [ r ] += preSum [ r + 1 ] ; if ( c + 1 < C ) preSum [ r ] += preSum [ r ] ; if ( r + 1 < R && c + 1 < C ) preSum [ r ] -= preSum [ r + 1 ] ; } } int [ ] [ ] [ ] dp = new int [ K + 1 ] [ R ] [ C ] ; for ( int k = 1 ; k <= K ; k ++ ) { for ( int r = R - 1 ; r >= 0 ; r -- ) { for ( int c = C - 1 ; c >= 0 ; c -- ) { if ( k == 1 ) { dp [ k ] [ r ] = ( preSum [ r ] > 0 ) ? 1 : 0 ; } else { dp [ k ] [ r ] = 0 ; for ( int r1 = r + 1 ; r1 < R ; r1 ++ ) { if ( preSum [ r ] - preSum [ r1 ] > 0 ) dp [ k ] [ r ] += dp [ k - 1 ] [ r1 ] ; } for ( int c1 = c + 1 ; c1 < C ; c1 ++ ) { if ( preSum [ r ] - preSum [ r ] [ c1 ] > 0 ) dp [ k ] [ r ] += dp [ k - 1 ] [ r ] [ c1 ] ; } } } } } return dp [ K ] [ 0 ] [ 0 ] ; } public static void main ( String [ ] args ) { int [ ] [ ] arr = { { 1 , 0 , 0 } , { 1 , 1 , 1 } , { 0 , 0 , 0 } } ; int k = 3 ; System . out . println ( ways ( arr , k ) ) ; } }

Index/key variables: C, K, R, c1, k, r, r1
Accumulator variables: c, c1, k, r, r1
Iterator variables: c, c1, k, r, r1
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int p = 1000000007 ; static int power ( int x , int y , int p ) { int res = 1 ; x = x % p ; while ( y > 0 ) { if ( y % 2 == 1 ) res = ( res * x ) % p ; y = y >> 1 ; x = ( x * x ) % p ; } return res ; } static void nCr ( int n , int p , int f [ ] [ ] , int m ) { for ( int i = 0 ; i <= n ; i ++ ) { for ( int j = 0 ; j <= m ; j ++ ) { if ( j > i ) { f [ i ] [ j ] = 0 ; } else if ( j == 0 j == i ) { f [ i ] [ j ] = 1 ; } else { f [ i ] [ j ] = ( f [ i - 1 ] [ j ] + f [ i - 1 ] [ j - 1 ] ) % p ; } } } } static void ProductOfSubsets ( int arr [ ] , int n , int m ) { int [ ] [ ] f = new int [ n + 1 ] [ 100 ] ; nCr ( n , p - 1 , f , m ) ; Arrays . sort ( arr ) ; long ans = 1 ; for ( int i = 0 ; i < n ; i ++ ) { int x = 0 ; for ( int j = 1 ; j <= m ; j ++ ) { if ( m % j == 0 ) { x = ( x + ( f [ n - i - 1 ] [ m - j ] * f [ i ] [ j - 1 ] ) % ( p - 1 ) ) % ( p - 1 ) ; } } ans = ( ( ans * power ( arr [ i ] , x , p ) ) % p ) ; } System . out . print ( ans + "NEW_LINE"); } public static void main ( String [ ] args ) { int arr [ ] = { 4 , 5 , 7 , 9 , 3 } ; int K = 4 ; int N = arr . length ; ProductOfSubsets ( arr , N , K ) ; } }

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 int countWays ( int n , int m ) { int [ ] [ ] dp = new int [ m + 1 ] [ n + 1 ] ; for ( int i = 0 ; i <= n ; i ++ ) { dp [ 1 ] [ i ] = 1 ; } int sum ; for ( int i = 2 ; i <= m ; i ++ ) { for ( int j = 0 ; j <= n ; j ++ ) { sum = 0 ; for ( int k = 0 ; k <= j ; k ++ ) { sum += dp [ i - 1 ] [ k ] ; } dp [ i ] [ j ] = sum ; } } return dp [ m ] [ n ] ; } public static void main ( String [ ] args ) { int N = 2 , K = 3 ; System . out . print ( countWays ( N , K ) ) ; } }

Index/key variables: i, j, k, m, n
Accumulator variables: i, j, k, sum
Iterator variables: i, j, k
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int countWays ( int n , int m ) { int [ ] [ ] dp = new int [ m + 1 ] [ n + 1 ] ; for ( int i = 0 ; i <= n ; i ++ ) { dp [ 1 ] [ i ] = 1 ; if ( i != 0 ) { dp [ 1 ] [ i ] += dp [ 1 ] [ i - 1 ] ; } } for ( int i = 2 ; i <= m ; i ++ ) { for ( int j = 0 ; j <= n ; j ++ ) { if ( j == 0 ) { dp [ i ] [ j ] = dp [ i - 1 ] [ j ] ; } else { dp [ i ] [ j ] = dp [ i - 1 ] [ j ] ; if ( i == m && j == n ) { return dp [ i ] [ j ] ; } dp [ i ] [ j ] += dp [ i ] [ j - 1 ] ; } } } return Integer . MIN_VALUE ; } public static void main ( String [ ] args ) { int N = 2 , K = 3 ; System . out . print ( countWays ( N , K ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . HashMap ; import java . util . Vector ; class GFG { public static void SieveOfEratosthenes ( int MAX , Vector < Integer > primes ) { boolean [ ] prime = new boolean [ MAX + 1 ] ; for ( int i = 0 ; i < MAX + 1 ; i ++ ) prime [ i ] = true ; for ( int p = 2 ; p * p <= MAX ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * p ; i <= MAX ; i += p ) prime [ i ] = false ; } } for ( int i = 2 ; i <= MAX ; i ++ ) { if ( prime [ i ] ) primes . add ( i ) ; } } public static int findLongest ( int [ ] A , int n ) { HashMap < Integer , Integer > mpp = new HashMap < > ( ) ; Vector < Integer > primes = new Vector < > ( ) ; SieveOfEratosthenes ( A [ n - 1 ] , primes ) ; int [ ] dp = new int [ n ] ; dp [ n - 1 ] = 1 ; mpp . put ( A [ n - 1 ] , n - 1 ) ; for ( int i = n - 2 ; i >= 0 ; i -- ) { int num = A [ i ] ; dp [ i ] = 1 ; int maxi = 0 ; for ( int it : primes ) { int xx = num * it ; if ( xx > A [ n - 1 ] ) break ; else if ( mpp . get ( xx ) != null && mpp . get ( xx ) != 0 ) { dp [ i ] = Math . max ( dp [ i ] , 1 + dp [ mpp . get ( xx ) ] ) ; } } mpp . put ( A [ i ] , i ) ; } int ans = 1 ; for ( int i = 0 ; i < n ; i ++ ) ans = Math . max ( ans , dp [ i ] ) ; return ans ; } public static void main ( String [ ] args ) { int [ ] a = { 1 , 2 , 5 , 6 , 12 , 35 , 60 , 385 } ; int n = a . length ; System . out . println ( findLongest ( a , n ) ) ; } }

Index/key variables: i, n, p
Accumulator variables: i, p
Iterator variables: i, it, p
Class/struct names: GFG
Java program:
import java . util . * ; class solution { static int waysToKAdjacentSetBits ( int n , int k , int currentIndex , int adjacentSetBits , int lastBit ) { if ( currentIndex == n ) { if ( adjacentSetBits == k ) return 1 ; return 0 ; } int noOfWays = 0 ; if ( lastBit == 1 ) { noOfWays += waysToKAdjacentSetBits ( n , k , currentIndex + 1 , adjacentSetBits + 1 , 1 ) ; noOfWays += waysToKAdjacentSetBits ( n , k , currentIndex + 1 , adjacentSetBits , 0 ) ; } else if ( lastBit == 0 ) { noOfWays += waysToKAdjacentSetBits ( n , k , currentIndex + 1 , adjacentSetBits , 1 ) ; noOfWays += waysToKAdjacentSetBits ( n , k , currentIndex + 1 , adjacentSetBits , 0 ) ; } return noOfWays ; } public static void main ( String args [ ] ) { int n = 5 , k = 2 ; int totalWays = waysToKAdjacentSetBits ( n , k , 1 , 0 , 1 ) + waysToKAdjacentSetBits ( n , k , 1 , 0 , 0 ) ; System . out . println ( " Number ▁ of ▁ ways ▁ = ▁ " + totalWays ) ; } }

Accumulator variables: noOfWays
Class/struct names: solution
Java program:
import java . util . * ; class GFG { static void postfix ( int a [ ] , int n ) { for ( int i = n - 1 ; i > 0 ; i -- ) { a [ i - 1 ] = a [ i - 1 ] + a [ i ] ; } } static void modify ( int a [ ] , int n ) { for ( int i = 1 ; i < n ; i ++ ) { a [ i - 1 ] = i * a [ i ] ; } } static void allCombination ( int a [ ] , int n ) { int sum = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { sum += i ; } System . out . println ( " f ( 1 ) ▁ - - > ▁ " + sum ) ; for ( int i = 1 ; i < n ; i ++ ) { postfix ( a , n - i + 1 ) ; sum = 0 ; for ( int j = 1 ; j <= n - i ; j ++ ) { sum += ( j * a [ j ] ) ; } System . out . println ( " f ( " + ( i + 1 ) + " ) ▁ - - > ▁ " + sum ) ; modify ( a , n ) ; } } public static void main ( String [ ] args ) { int n = 5 ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = i + 1 ; } allCombination ( a , n ) ; } }

Index/key variables: i, j, n
Accumulator variables: i, j, sum
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . lang . * ; import java . util . * ; public class GfG { public static int findStep ( int n ) { if ( n == 1 n == 0 ) return 1 ; else if ( n == 2 ) return 2 ; else return findStep ( n - 3 ) + findStep ( n - 2 ) + findStep ( n - 1 ) ; } public static void main ( String argc [ ] ) { int n = 4 ; System . out . println ( findStep ( n ) ) ; } }

Class/struct names: GfG
Java program:
import java . io . * ; class Partition { static boolean isSubsetSum ( int arr [ ] , int n , int sum ) { if ( sum == 0 ) return true ; if ( n == 0 && sum != 0 ) return false ; if ( arr [ n - 1 ] > sum ) return isSubsetSum ( arr , n - 1 , sum ) ; return isSubsetSum ( arr , n - 1 , sum ) || isSubsetSum ( arr , n - 1 , sum - arr [ n - 1 ] ) ; } static boolean findPartition ( int arr [ ] , int n ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum += arr [ i ] ; if ( sum % 2 != 0 ) return false ; return isSubsetSum ( arr , n , sum / 2 ) ; } public static void main ( String [ ] args ) { int arr [ ] = { 3 , 1 , 5 , 9 , 12 } ; int n = arr . length ; if ( findPartition ( arr , n ) == true ) System . out . println ( " Can ▁ be ▁ divided ▁ into ▁ two ▁ " + " subsets ▁ of ▁ equal ▁ sum " ) ; else System . out . println ( " Can ▁ not ▁ be ▁ divided ▁ into ▁ " + " two ▁ subsets ▁ of ▁ equal ▁ sum " ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: Partition
Java program:
import java . io . * ; class GFG { public static int gcd ( int a , int b ) { if ( a < b ) { int t = a ; a = b ; b = t ; } if ( a % b == 0 ) return b ; return gcd ( b , a % b ) ; } static void printAnswer ( int x , int y ) { int val = gcd ( x , y ) ; if ( ( val & ( val - 1 ) ) == 0 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } public static void main ( String [ ] args ) { int x = 4 ; int y = 7 ; printAnswer ( x , y ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static int getElement ( int N , int r , int c ) { if ( r > c ) return 0 ; if ( r == 1 ) { return c ; } int a = ( r + 1 ) * ( int ) ( Math . pow ( 2 , ( r - 2 ) ) ) ; int d = ( int ) ( Math . pow ( 2 , ( r - 1 ) ) ) ; c = c - r ; int element = a + d * c ; return element ; } public static void main ( String [ ] args ) { int N = 4 , R = 3 , C = 4 ; System . out . println ( getElement ( N , R , C ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; import java . lang . * ; import java . util . * ; public class GFG { static String MinValue ( String number , int x ) { int length = number . length ( ) ; int position = length + 1 ; if ( number . charAt ( 0 ) == ' - ' ) { for ( int i = number . length ( ) - 1 ; i >= 1 ; -- i ) { if ( ( number . charAt ( i ) - 48 ) < x ) { position = i ; } } } else { for ( int i = number . length ( ) - 1 ; i >= 0 ; -- i ) { if ( ( number . charAt ( i ) - 48 ) > x ) { position = i ; } } } number = number . substring ( 0 , position ) + x + number . substring ( position , number . length ( ) ) ; return number . toString ( ) ; } public static void main ( String [ ] args ) { String number = "89" ; int x = 1 ; System . out . print ( MinValue ( number , x ) ) ; } }

Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { public static String divisibleByk ( String s , int n , int k ) { int [ ] poweroftwo = new int [ n ] ; poweroftwo [ 0 ] = 1 % k ; for ( int i = 1 ; i < n ; i ++ ) { poweroftwo [ i ] = ( poweroftwo [ i - 1 ] * ( 2 % k ) ) % k ; } int rem = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( s . charAt ( n - i - 1 ) == '1' ) { rem += ( poweroftwo [ i ] ) ; rem %= k ; } } if ( rem == 0 ) { return " Yes " ; } else return " No " ; } public static void main ( String args [ ] ) { String s = "1010001" ; int k = 9 ; int n = s . length ( ) ; System . out . println ( divisibleByk ( s , n , k ) ) ; } }

Index/key variables: i, n
Accumulator variables: i, rem
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int maxSumbySplittingString ( String str , int N ) { int cntOne = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( str . charAt ( i ) == '1' ) { cntOne ++ ; } } int zero = 0 ; int one = 0 ; int res = 0 ; for ( int i = 0 ; i < N - 1 ; i ++ ) { if ( str . charAt ( i ) == '0' ) { zero ++ ; } else { one ++ ; } res = Math . max ( res , zero + cntOne - one ) ; } return res ; } public static void main ( String [ ] args ) { String str = "00111" ; int N = str . length ( ) ; System . out . print ( maxSumbySplittingString ( str , N ) ) ; } }

Accumulator variables: cntOne, i, one, zero
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static void cntBalancedParenthesis ( String s , int N ) { int cntPairs = 0 ; int cntCurly = 0 ; int cntSml = 0 ; int cntSqr = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( s . charAt ( i ) == ' { ' ) { cntCurly ++ ; } else if ( s . charAt ( i ) == ' ( ' ) { cntSml ++ ; } else if ( s . charAt ( i ) == ' [ ' ) { cntSqr ++ ; } else if ( s . charAt ( i ) == ' } ' && cntCurly > 0 ) { cntCurly -- ; cntPairs ++ ; } else if ( s . charAt ( i ) == ' ) ' && cntSml > 0 ) { cntSml -- ; cntPairs ++ ; } else if ( s . charAt ( i ) == ' ] ' && cntSqr > 0 ) { cntSqr -- ; cntPairs ++ ; } } System . out . println ( cntPairs ) ; } public static void main ( String [ ] args ) { String s = " { ( } ) " ; int N = s . length ( ) ; cntBalancedParenthesis ( s , N ) ; } }

Accumulator variables: cntCurly, cntPairs, cntSml, cntSqr, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int arcIntersection ( String S , int len ) { Stack < Character > stk = new Stack < > ( ) ; for ( int i = 0 ; i < len ; i ++ ) { stk . push ( S . charAt ( i ) ) ; if ( stk . size ( ) >= 2 ) { char temp = stk . peek ( ) ; stk . pop ( ) ; if ( stk . peek ( ) == temp ) { stk . pop ( ) ; } else { stk . add ( temp ) ; } } } if ( stk . isEmpty ( ) ) return 1 ; return 0 ; } static void countString ( String arr [ ] , int N ) { int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { int len = arr [ i ] . length ( ) ; count += arcIntersection ( arr [ i ] , len ) ; } System . out . print ( count + "NEW_LINE"); } public static void main ( String [ ] args ) { String arr [ ] = { "0101" , "0011" , "0110" } ; int N = arr . length ; countString ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; import java . lang . * ; import java . io . * ; class GFG { static String ConvertequivalentBase8 ( String S ) { HashMap < String , Character > mp = new HashMap < String , Character > ( ) ; mp . put ( "000" , '0' ) ; mp . put ( "001" , '1' ) ; mp . put ( "010" , '2' ) ; mp . put ( "011" , '3' ) ; mp . put ( "100" , '4' ) ; mp . put ( "101" , '5' ) ; mp . put ( "110" , '6' ) ; mp . put ( "111" , '7' ) ; int N = S . length ( ) ; if ( N % 3 == 2 ) { S = "0" + S ; } else if ( N % 3 == 1 ) { S = "00" + S ; } N = S . length ( ) ; String oct = " " ; for ( int i = 0 ; i < N ; i += 3 ) { String temp = S . substring ( i , i + 3 ) ; oct += mp . get ( temp ) ; } return oct ; } static String binString_div_9 ( String S , int N ) { String oct = " " ; oct = ConvertequivalentBase8 ( S ) ; int oddSum = 0 ; int evenSum = 0 ; int M = oct . length ( ) ; for ( int i = 0 ; i < M ; i += 2 ) oddSum += ( oct . charAt ( i ) - '0' ) ; for ( int i = 1 ; i < M ; i += 2 ) { evenSum += ( oct . charAt ( i ) - '0' ) ; } int Oct_9 = 11 ; if ( Math . abs ( oddSum - evenSum ) % Oct_9 == 0 ) { return " Yes " ; } return " No " ; } public static void main ( String [ ] args ) { String S = "1010001" ; int N = S . length ( ) ; System . out . println ( binString_div_9 ( S , N ) ) ; } }

Accumulator variables: evenSum, i, oct, oddSum
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; import java . lang . * ; class GFG { static int min_cost ( String S ) { int cost = 0 ; int F = 0 ; int B = 0 ; int count = 0 ; for ( char c : S . toCharArray ( ) ) if ( c == ' ▁ ' ) count ++ ; int n = S . length ( ) - count ; if ( n == 1 ) return cost ; for ( char in : S . toCharArray ( ) ) { if ( in != ' ▁ ' ) { if ( B != 0 ) { cost += Math . min ( n - F , F ) * B ; B = 0 ; } F += 1 ; } else { B += 1 ; } } return cost ; } public static void main ( String [ ] args ) { String S = " ▁ @ TABSYMBOL $ " ; System . out . println ( min_cost ( S ) ) ; } }

Accumulator variables: B, F, cost, count
Iterator variables: c, in
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean isVowel ( char ch ) { if ( ch == ' a ' ch == ' e ' ch == ' i ' ch == ' o ' ch == ' u ' ) return true ; else return false ; } static int minCost ( String S ) { int cA = 0 ; int cE = 0 ; int cI = 0 ; int cO = 0 ; int cU = 0 ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { if ( isVowel ( S . charAt ( i ) ) ) { cA += Math . abs ( S . charAt ( i ) - ' a ' ) ; cE += Math . abs ( S . charAt ( i ) - ' e ' ) ; cI += Math . abs ( S . charAt ( i ) - ' i ' ) ; cO += Math . abs ( S . charAt ( i ) - ' o ' ) ; cU += Math . abs ( S . charAt ( i ) - ' u ' ) ; } } return Math . min ( Math . min ( Math . min ( Math . min ( cA , cE ) , cI ) , cO ) , cU ) ; } public static void main ( String [ ] args ) { String S = " geeksforgeeks " ; System . out . println ( minCost ( S ) ) ; } }

Accumulator variables: cA, cE, cI, cO, cU, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { public static void decode_String ( String str , int K ) { String ans = " " ; for ( int i = 0 ; i < str . length ( ) ; i += K ) ans += str . charAt ( i ) ; for ( int i = str . length ( ) - ( K - 1 ) ; i < str . length ( ) ; i ++ ) ans += str . charAt ( i ) ; System . out . println ( ans ) ; } public static void main ( String [ ] args ) { int K = 3 ; String str = " abcbcscsesesesd " ; decode_String ( str , K ) ; } }

Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static String maxVowelSubString ( String str , int K ) { int N = str . length ( ) ; int [ ] pref = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { if ( str . charAt ( i ) == ' a ' || str . charAt ( i ) == ' e ' || str . charAt ( i ) == ' i ' || str . charAt ( i ) == ' o ' || str . charAt ( i ) == ' u ' ) pref [ i ] = 1 ; else pref [ i ] = 0 ; if ( i != 0 ) pref [ i ] += pref [ i - 1 ] ; } int maxCount = pref [ K - 1 ] ; String res = str . substring ( 0 , K ) ; for ( int i = K ; i < N ; i ++ ) { int currCount = pref [ i ] - pref [ i - K ] ; if ( currCount > maxCount ) { maxCount = currCount ; res = str . substring ( i - K + 1 , i + 1 ) ; } else if ( currCount == maxCount ) { String temp = str . substring ( i - K + 1 , i + 1 ) ; if ( temp . compareTo ( res ) < 0 ) res = temp ; } } return res ; } public static void main ( String [ ] args ) { String str = " ceebbaceeffo " ; int K = 3 ; System . out . print ( maxVowelSubString ( str , K ) ) ; } }

Index/key variables: N, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void decodeStr ( String str , int len ) { char [ ] c = new char [ len ] ; int med , pos = 1 , k ; if ( len % 2 == 1 ) med = len / 2 ; else med = len / 2 - 1 ; c [ med ] = str . charAt ( 0 ) ; if ( len % 2 == 0 ) c [ med + 1 ] = str . charAt ( 1 ) ; if ( len % 2 == 1 ) k = 1 ; else k = 2 ; for ( int i = k ; i < len ; i += 2 ) { c [ med - pos ] = str . charAt ( i ) ; if ( len % 2 == 1 ) c [ med + pos ] = str . charAt ( i + 1 ) ; else c [ med + pos + 1 ] = str . charAt ( i + 1 ) ; pos ++ ; } for ( int i = 0 ; i < len ; i ++ ) System . out . print ( c [ i ] ) ; } public static void main ( String [ ] args ) { String str = " ofrsgkeeeekgs " ; int len = str . length ( ) ; decodeStr ( str , len ) ; } }

Index/key variables: i, len, med
Accumulator variables: i, pos
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void findCount ( String s , int L , int R ) { int distinct = 0 ; int [ ] frequency = new int [ 26 ] ; for ( int i = L ; i <= R ; i ++ ) { frequency [ s . charAt ( i ) - ' a ' ] ++ ; } for ( int i = 0 ; i < 26 ; i ++ ) { if ( frequency [ i ] > 0 ) distinct ++ ; } System . out . print ( distinct + "NEW_LINE"); } public static void main ( String [ ] args ) { String s = " geeksforgeeksisa " + " computerscienceportal " ; int queries = 3 ; int Q [ ] [ ] = { { 0 , 10 } , { 15 , 18 } , { 12 , 20 } } ; for ( int i = 0 ; i < queries ; i ++ ) findCount ( s , Q [ i ] [ 0 ] , Q [ i ] [ 1 ] ) ; } }

Index/key variables: i
Accumulator variables: distinct, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static String ReverseComplement ( char [ ] s , int n , int k ) { int rev = ( k + 1 ) / 2 ; int complement = k - rev ; if ( rev % 2 == 1 ) s = reverse ( s ) ; if ( complement % 2 == 1 ) { for ( int i = 0 ; i < n ; i ++ ) { if ( s [ i ] == '0' ) s [ i ] = '1' ; else s [ i ] = '0' ; } } return String . valueOf ( s ) ; } static char [ ] reverse ( char a [ ] ) { int i , n = a . length ; char t ; for ( i = 0 ; i < n / 2 ; i ++ ) { t = a [ i ] ; a [ i ] = a [ n - i - 1 ] ; a [ n - i - 1 ] = t ; } return a ; } public static void main ( String [ ] args ) { String str = "10011" ; int k = 5 ; int n = str . length ( ) ; System . out . print ( ReverseComplement ( str . toCharArray ( ) , n , k ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static boolean repeatingString ( String s , int n , int k ) { if ( n % k != 0 ) { return false ; } int [ ] frequency = new int [ 123 ] ; for ( int i = 0 ; i < 123 ; i ++ ) { frequency [ i ] = 0 ; } for ( int i = 0 ; i < n ; i ++ ) { frequency [ s . charAt ( i ) ] ++ ; } int repeat = n / k ; for ( int i = 0 ; i < 123 ; i ++ ) { if ( frequency [ i ] % repeat != 0 ) { return false ; } } return true ; } public static void main ( String [ ] args ) { String s = " abcdcba " ; int n = s . length ( ) ; int k = 3 ; if ( repeatingString ( s , n , k ) ) { System . out . print ( " Yes " + "NEW_LINE"); } else { System . out . print ( " No " + "NEW_LINE"); } } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void findPhoneNumber ( int n ) { int temp = n ; int sum = 0 ; while ( temp != 0 ) { sum += temp % 10 ; temp = temp / 10 ; } if ( sum < 10 ) System . out . print ( n + "0" + sum ) ; else System . out . print ( n + " " + sum ) ; } public static void main ( String [ ] args ) { int n = 98765432 ; findPhoneNumber ( n ) ; } }

Accumulator variables: sum
Class/struct names: GFG
Java program:
class GFG { static int maxN = 20 ; static int maxM = 64 ; static int cntSplits ( String s ) { if ( s . charAt ( s . length ( ) - 1 ) == '1' ) return 0 ; int c_zero = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) c_zero += ( s . charAt ( i ) == '0' ) ? 1 : 0 ; return ( int ) Math . pow ( 2 , c_zero - 1 ) ; } public static void main ( String [ ] args ) { String s = "10010" ; System . out . println ( cntSplits ( s ) ) ; } }

Accumulator variables: c_zero, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void findNumbers ( String s ) { int n = s . length ( ) ; int count = 1 ; int result = 0 ; int left = 0 ; int right = 1 ; while ( right < n ) { if ( s . charAt ( left ) == s . charAt ( right ) ) { count ++ ; } else { result += count * ( count + 1 ) / 2 ; left = right ; count = 1 ; } right ++ ; } result += count * ( count + 1 ) / 2 ; System . out . println ( result ) ; } public static void main ( String [ ] args ) { String s = " bbbcbb " ; findNumbers ( s ) ; } }

Accumulator variables: count, result, right
Class/struct names: GFG