dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
import java . util . * ; class GFG { static int getXOR ( int BITree [ ] , int index ) { int ans = 0 ; index += 1 ; while ( index > 0 ) { ans ^= BITree [ index ] ; index -= index & ( - index ) ; } return ans ; } static void updateBIT ( int BITree [ ] , int n , int index , int val ) { index = index + 1 ; while ( index <= n ) { BITree [ index ] ^= val ; index += index & ( - index ) ; } } static int [ ] constructBITree ( int arr [ ] , int n ) { int [ ] BITree = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) BITree [ i ] = 0 ; for ( int i = 0 ; i < n ; i ++ ) updateBIT ( BITree , n , i , arr [ i ] ) ; return BITree ; } static int rangeXor ( int BITree [ ] , int l , int r ) { return getXOR ( BITree , r ) ^ getXOR ( BITree , l - 1 ) ; } public static void main ( String [ ] args ) { int A [ ] = { 2 , 1 , 1 , 3 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 } ; int n = A . length ; int [ ] [ ] q = { { 1 , 0 , 9 } , { 2 , 3 , 6 } , { 2 , 5 , 5 } , { 2 , 8 , 1 } , { 1 , 0 , 9 } } ; int [ ] BITree = constructBITree ( A , n ) ; for ( int i = 0 ; i < q . length ; i ++ ) { int id = q [ i ] [ 0 ] ; if ( id == 1 ) { int L = q [ i ] [ 1 ] ; int R = q [ i ] [ 2 ] ; System . out . print ( " XOR ▁ of ▁ elements ▁ " + " in ▁ given ▁ range ▁ is ▁ " + rangeXor ( BITree , L , R ) + "NEW_LINE"); } else { int idx = q [ i ] [ 1 ] ; int val = q [ i ] [ 2 ] ; A [ idx ] ^= val ; updateBIT ( BITree , n , idx , val ) ; } } } }

Index/key variables: i, idx, index
Accumulator variables: ans, i, index
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; import java . lang . * ; class GFG { static int [ ] arr = new int [ 1000001 ] ; static int [ ] dp = new int [ 1000001 ] ; static void count ( ) { int maxN = 1000000 , i , j ; for ( i = 0 ; i < maxN ; i ++ ) arr [ i ] = 1 ; arr [ 0 ] = 0 ; arr [ 1 ] = 0 ; for ( i = 2 ; i * i <= maxN ; i ++ ) { if ( arr [ i ] == 1 ) { for ( j = 2 * i ; j <= maxN ; j += i ) { arr [ j ] = 0 ; } } } int cnt = 0 ; for ( i = 0 ; i <= maxN ; i ++ ) { if ( arr [ i ] == 1 ) cnt ++ ; if ( arr [ cnt ] == 1 ) dp [ i ] = 1 ; else dp [ i ] = 0 ; } for ( i = 1 ; i <= maxN ; i ++ ) dp [ i ] += dp [ i - 1 ] ; } public static void main ( String [ ] args ) { int L = 4 , R = 12 ; count ( ) ; System . out . println ( dp [ R ] - dp [ L - 1 ] ) ; } }

Index/key variables: R, cnt, i, j
Accumulator variables: cnt, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void findUngroupedElement ( String s , int k ) { int n = s . length ( ) ; int [ ] b = new int [ 26 ] ; for ( int i = 0 ; i < 26 ; i ++ ) b [ i ] = 0 ; for ( int i = 0 ; i < n ; i ++ ) { char p = s . charAt ( i ) ; b [ p - ' a ' ] += 1 ; } int sum = 0 ; for ( int i = 0 ; i < 26 ; i ++ ) { if ( b [ i ] > k ) sum += b [ i ] - k ; } System . out . println ( sum ) ; } public static void main ( String srgs [ ] ) { String s = " stayinghomesaveslife " ; int k = 1 ; findUngroupedElement ( s , k ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void findSolution ( int N ) { if ( N % 4 != 0 ) System . out . print ( - 1 + "NEW_LINE"); else { int temp = 0 , sum_odd = 0 ; int sum_even = 0 ; int result [ ] = new int [ N ] ; for ( int i = 0 ; i < N ; i += 2 ) { temp += 2 ; result [ i + 1 ] = temp ; sum_even += result [ i + 1 ] ; result [ i ] = temp - 1 ; sum_odd += result [ i ] ; } int diff = sum_even - sum_odd ; result [ N - 2 ] += diff ; for ( int i = 0 ; i < N ; i ++ ) System . out . print ( result [ i ] + " ▁ " ) ; System . out . print ( "NEW_LINE"); } } public static void main ( String [ ] args ) { int N = 8 ; findSolution ( N ) ; } }

Index/key variables: N, i
Accumulator variables: i, sum_even, sum_odd, temp
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static double possiblePositions ( double n ) { double term1 = Math . pow ( n , 4 ) ; double term2 = Math . pow ( n , 3 ) ; double term3 = Math . pow ( n , 2 ) ; double term4 = n / 3 ; double ans = ( Math . ceil ( term1 / 2 ) ) - ( Math . ceil ( 5 * term2 ) / 3 ) + ( Math . ceil ( 3 * term3 ) / 2 ) - term4 ; return ( long ) ans ; } public static void main ( String [ ] args ) { double n ; n = 3 ; double ans = possiblePositions ( n ) ; System . out . print ( ans + "NEW_LINE"); } }

Class/struct names: GFG
Java program:
class GFG { static void mutually_coprime ( int n ) { if ( n <= 3 ) { for ( int j = 1 ; j < n + 1 ; j ++ ) System . out . print ( j + " ▁ " ) ; System . out . println ( ) ; } else { System . out . println ( "1 ▁ 2 ▁ 3" ) ; for ( int j = 4 ; j < n ; j += 2 ) { System . out . println ( j + " ▁ " + ( j + 1 ) ) ; if ( n % 2 == 0 ) System . out . println ( n ) ; } } } public static void main ( String [ ] args ) { int n = 9 ; mutually_coprime ( n ) ; } }

Accumulator variables: j
Iterator variables: j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int findMaxSum ( int [ ] arr , int n ) { Vector < Integer > a = new Vector < Integer > ( ) ; Vector < Integer > b = new Vector < Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] > 0 ) { a . add ( arr [ i ] ) ; } else if ( arr [ i ] < 0 ) { b . add ( arr [ i ] ) ; } } Collections . sort ( a ) ; Collections . sort ( b ) ; int p = a . size ( ) - 1 ; int q = b . size ( ) - 1 ; int s = 0 ; while ( p >= 0 && q >= 0 ) { if ( a . get ( p ) + b . get ( q ) > 0 ) { s = s + a . get ( p ) + b . get ( q ) ; } else { break ; } p = p - 1 ; q = q - 1 ; } return s ; } public static void main ( String [ ] args ) { int arr1 [ ] = { 1 , - 2 , 3 , 4 , - 5 , 8 } ; int n1 = arr1 . length ; System . out . print ( findMaxSum ( arr1 , n1 ) + "NEW_LINE"); } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void SieveOfEratosthenes ( boolean prime [ ] , int p_size ) { prime [ 0 ] = false ; prime [ 1 ] = false ; for ( int p = 2 ; p * p <= p_size ; p ++ ) { if ( prime [ p ] ) { for ( int i = p * 2 ; i <= p_size ; i += p ) prime [ i ] = false ; } } } static void PrimeDegreeNodes ( int prufer [ ] , int n ) { int nodes = n + 2 ; boolean [ ] prime = new boolean [ nodes + 1 ] ; Arrays . fill ( prime , true ) ; SieveOfEratosthenes ( prime , nodes + 1 ) ; int [ ] degree = new int [ n + 2 + 1 ] ; for ( int i = 1 ; i <= nodes ; i ++ ) degree [ i ] = 1 ; for ( int i = 0 ; i < n ; i ++ ) degree [ prufer [ i ] ] ++ ; for ( int i = 1 ; i <= nodes ; i ++ ) { if ( prime [ degree [ i ] ] ) { System . out . print ( i + " ▁ " ) ; } } } public static void main ( String [ ] args ) { int a [ ] = { 4 , 1 , 3 , 4 } ; int n = a . length ; PrimeDegreeNodes ( a , n ) ; } }

Index/key variables: i, p
Accumulator variables: i, p
Iterator variables: i, p
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int n = 10005 ; static boolean [ ] Prime = new boolean [ n + 1 ] ; static void SieveOfEratosthenes ( ) { int i , j ; Prime [ 0 ] = Prime [ 1 ] = false ; for ( i = 2 ; i * i <= 10005 ; i ++ ) { if ( Prime [ i ] ) { for ( j = 2 * i ; j < 10005 ; j += i ) { Prime [ j ] = false ; } } } } static void primeDegreeNodes ( int N , int M , int edges [ ] [ ] ) { Vector < Integer > [ ] Adj = new Vector [ N + 1 ] ; for ( int i = 0 ; i < Adj . length ; i ++ ) Adj [ i ] = new Vector < Integer > ( ) ; for ( int i = 0 ; i < M ; i ++ ) { int x = edges [ i ] [ 0 ] ; int y = edges [ i ] [ 1 ] ; Adj [ x ] . add ( y ) ; Adj [ y ] . add ( x ) ; } SieveOfEratosthenes ( ) ; for ( int i = 1 ; i <= N ; i ++ ) { int x = Adj [ i ] . size ( ) ; if ( Prime [ x ] ) System . out . print ( i + " ▁ " ) ; } } public static void main ( String [ ] args ) { int N = 4 , M = 6 ; int edges [ ] [ ] = { { 1 , 2 } , { 1 , 3 } , { 1 , 4 } , { 2 , 3 } , { 2 , 4 } , { 3 , 4 } } ; Arrays . fill ( Prime , true ) ; primeDegreeNodes ( N , M , edges ) ; } }

Index/key variables: i, j, x, y
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int mod = 1000000007 ; static int countWays ( int colored [ ] , int count , int n ) { if ( count == n ) { return 1 ; } int answer = 0 ; for ( int i = 1 ; i < n + 1 ; i ++ ) { if ( colored [ i ] == 0 ) { if ( colored [ i - 1 ] == 1 colored [ i + 1 ] == 1 ) { colored [ i ] = 1 ; answer = ( answer + countWays ( colored , count + 1 , n ) ) % mod ; colored [ i ] = 0 ; } } } return answer ; } static int waysToColor ( int arr [ ] , int n , int k ) { int colored [ ] = new int [ n + 2 ] ; for ( int i = 0 ; i < k ; i ++ ) { colored [ arr [ i ] ] = 1 ; } return countWays ( colored , k , n ) ; } public static void main ( String [ ] args ) { int N = 6 ; int K = 3 ; int arr [ ] = { 1 , 2 , 6 } ; System . out . print ( waysToColor ( arr , N , K ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static char ShortestPalindrome ( String s ) { int n = s . length ( ) ; char ans = s . charAt ( 0 ) ; for ( int i = 1 ; i < n ; i ++ ) { ans = ( char ) Math . min ( ans , s . charAt ( i ) ) ; } return ans ; } public static void main ( String [ ] args ) { String s = " geeksforgeeks " ; System . out . print ( ShortestPalindrome ( s ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void findSubsequence ( int arr [ ] , int n ) { int sign [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] > 0 ) sign [ i ] = 1 ; else sign [ i ] = - 1 ; } int k = 0 ; int result [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { int cur = arr [ i ] ; int j = i ; while ( j < n && sign [ i ] == sign [ j ] ) { cur = Math . max ( cur , arr [ j ] ) ; ++ j ; } result [ k ++ ] = cur ; i = j - 1 ; } for ( int i = 0 ; i < k ; i ++ ) System . out . print ( result [ i ] + " ▁ " ) ; System . out . print ( "NEW_LINE"); } public static void main ( String [ ] args ) { int arr [ ] = { - 4 , 9 , 4 , 11 , - 5 , - 17 , 9 , - 3 , - 5 , 2 } ; int n = arr . length ; findSubsequence ( arr , n ) ; } }

Index/key variables: i, j, n
Accumulator variables: i, k
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean isPalindrome ( String r ) { String p = r ; p = reverse ( p ) ; return ( r . equals ( p ) ) ; } static String PrefixSuffixPalindrome ( String str ) { int n = str . length ( ) , len = 0 ; for ( int i = 0 ; i < n / 2 ; i ++ ) { if ( str . charAt ( i ) != str . charAt ( n - i - 1 ) ) { len = i ; break ; } } String prefix = " " , suffix = " " ; String midPal = " " ; prefix = str . substring ( 0 , len ) ; suffix = str . substring ( n - len ) ; str = str . substring ( len , ( n - 2 * len ) + len ) ; for ( int i = 1 ; i <= str . length ( ) ; i ++ ) { String y = str . substring ( 0 , i ) ; if ( isPalindrome ( y ) ) { if ( midPal . length ( ) < y . length ( ) ) { midPal = y ; } } } for ( int i = 1 ; i <= str . length ( ) ; i ++ ) { String y = str . substring ( str . length ( ) - i ) ; if ( isPalindrome ( y ) ) { if ( midPal . length ( ) < y . length ( ) ) { midPal = y ; } } } String answer = prefix + midPal + suffix ; return answer ; } static String reverse ( String input ) { char [ ] a = input . toCharArray ( ) ; int l , r = a . length - 1 ; for ( l = 0 ; l < r ; l ++ , r -- ) { char temp = a [ l ] ; a [ l ] = a [ r ] ; a [ r ] = temp ; } return String . valueOf ( a ) ; } public static void main ( String [ ] args ) { String str = " abcdfdcecba " ; System . out . print ( PrefixSuffixPalindrome ( str ) ) ; } }

Index/key variables: l, r
Accumulator variables: i, l, r
Iterator variables: i, l
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int minimumAdjacentDifference ( int a [ ] , int n , int k ) { int minDiff = Integer . MAX_VALUE ; for ( int i = 0 ; i < ( 1 << n ) ; i ++ ) { int cnt = Integer . bitCount ( i ) ; if ( cnt == n - k ) { Vector < Integer > temp = new Vector < Integer > ( ) ; for ( int j = 0 ; j < n ; j ++ ) { if ( ( i & ( 1 << j ) ) != 0 ) temp . add ( a [ j ] ) ; } int maxDiff = Integer . MIN_VALUE ; for ( int j = 0 ; j < temp . size ( ) - 1 ; j ++ ) { maxDiff = Math . max ( maxDiff , temp . get ( j + 1 ) - temp . get ( j ) ) ; } minDiff = Math . min ( minDiff , maxDiff ) ; } } return minDiff ; } public static void main ( String args [ ] ) { int n = 5 ; int k = 2 ; int a [ ] = { 3 , 7 , 8 , 10 , 14 } ; System . out . println ( minimumAdjacentDifference ( a , n , k ) ) ; } }

Index/key variables: j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static int minimumAdjacentDifference ( int a [ ] , int n , int k ) { int minDiff = Integer . MAX_VALUE ; for ( int i = 0 ; i <= k ; i ++ ) { int maxDiff = Integer . MIN_VALUE ; for ( int j = 0 ; j < n - k - 1 ; j ++ ) { for ( int p = i ; p <= i + j ; p ++ ) { maxDiff = Math . max ( maxDiff , a [ p + 1 ] - a [ p ] ) ; } } minDiff = Math . min ( minDiff , maxDiff ) ; } return minDiff ; } public static void main ( String [ ] args ) { int n = 5 ; int k = 2 ; int [ ] a = { 3 , 7 , 8 , 10 , 14 } ; System . out . println ( minimumAdjacentDifference ( a , n , k ) ) ; } }

Index/key variables: p
Accumulator variables: i, j, p
Iterator variables: i, j, p
Class/struct names: GFG
Java program:
import java . util . * ; import java . lang . * ; class GFG { static int findKMin ( int arr [ ] , int n , int k ) { Deque < Integer > Qi = new LinkedList < > ( ) ; int i ; for ( i = 0 ; i < k ; ++ i ) { while ( ( ! Qi . isEmpty ( ) ) && arr [ i ] >= arr [ Qi . peekLast ( ) ] ) Qi . pollLast ( ) ; Qi . addLast ( i ) ; } int minDiff = Integer . MAX_VALUE ; for ( ; i < n ; ++ i ) { minDiff = Math . min ( minDiff , arr [ Qi . peekFirst ( ) ] ) ; while ( ( ! Qi . isEmpty ( ) ) && Qi . peekFirst ( ) <= i - k ) Qi . pollFirst ( ) ; while ( ( ! Qi . isEmpty ( ) ) && arr [ i ] >= arr [ Qi . peekLast ( ) ] ) Qi . pollLast ( ) ; Qi . addLast ( i ) ; } minDiff = Math . min ( minDiff , arr [ Qi . peekFirst ( ) ] ) ; return minDiff ; } static int minimumAdjacentDifference ( int a [ ] , int n , int k ) { int [ ] diff = new int [ n - 1 ] ; for ( int i = 0 ; i < n - 1 ; i ++ ) { diff [ i ] = a [ i + 1 ] - a [ i ] ; } int answer = findKMin ( diff , n - 1 , n - k - 1 ) ; return answer ; } public static void main ( String [ ] args ) { int n = 5 ; int k = 2 ; int a [ ] = { 3 , 7 , 8 , 10 , 14 } ; System . out . println ( minimumAdjacentDifference ( a , n , k ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int gcdFunc ( int a , int b ) { if ( b == 0 ) return a ; return gcdFunc ( b , a % b ) ; } static int findMinimumElements ( int [ ] a , int n ) { int [ ] b = new int [ n - 1 ] ; for ( int i = 1 ; i < n ; i ++ ) { b [ i - 1 ] = a [ i ] - a [ i - 1 ] ; } int gcd = b [ 0 ] ; for ( int i = 0 ; i < n - 1 ; i ++ ) { gcd = gcdFunc ( gcd , b [ i ] ) ; } int ans = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { ans += ( b [ i ] / gcd ) - 1 ; } return ans ; } public static void main ( String [ ] args ) { int arr1 [ ] = { 1 , 6 , 8 , 10 , 14 , 16 } ; int n1 = arr1 . length ; System . out . print ( findMinimumElements ( arr1 , n1 ) + "NEW_LINE"); } }

Index/key variables: i
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean checkPermutation ( int [ ] arr , int n ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum += arr [ i ] ; int [ ] prefix = new int [ n + 1 ] ; Arrays . fill ( prefix , 0 ) ; prefix [ 0 ] = arr [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) prefix [ i ] = prefix [ i - 1 ] + arr [ i ] ; for ( int i = 0 ; i < n - 1 ; i ++ ) { int lsum = prefix [ i ] ; int rsum = sum - prefix [ i ] ; int l_len = i + 1 , r_len = n - i - 1 ; if ( ( ( 2 * lsum ) == ( l_len * ( l_len + 1 ) ) ) && ( ( 2 * rsum ) == ( r_len * ( r_len + 1 ) ) ) ) return true ; } return false ; } public static void main ( String args [ ] ) { int [ ] arr = { 1 , 2 , 5 , 3 , 4 , 1 , 2 } ; int n = arr . length ; if ( checkPermutation ( arr , n ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void findTheNumber ( int n ) { if ( n == 1 ) { System . out . print ( " Impossible " + "NEW_LINE"); return ; } for ( int i = 0 ; i < n - 1 ; i ++ ) { System . out . print ( "5" ) ; } System . out . print ( "4" ) ; } public static void main ( String [ ] args ) { int n = 12 ; findTheNumber ( n ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static final int MAXN = 1000005 ; static int even [ ] = new int [ MAXN ] ; static int odd [ ] = new int [ MAXN ] ; static void precompute ( int arr [ ] , int n ) { for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] % 2 == 1 ) odd [ i ] = 1 ; if ( arr [ i ] % 2 == 0 ) even [ i ] = 1 ; } for ( int i = 1 ; i < n ; i ++ ) { even [ i ] = even [ i ] + even [ i - 1 ] ; odd [ i ] = odd [ i ] + odd [ i - 1 ] ; } } static boolean isOdd ( int L , int R ) { int cnt = odd [ R ] ; if ( L > 0 ) cnt -= odd [ L - 1 ] ; if ( cnt == R - L + 1 ) return true ; return false ; } static void performQueries ( int a [ ] , int n , int q [ ] [ ] , int m ) { precompute ( a , n ) ; for ( int i = 0 ; i < m ; i ++ ) { int L = q [ i ] [ 0 ] , R = q [ i ] [ 1 ] ; if ( isOdd ( L , R ) ) System . out . println ( " Odd " ) ; else System . out . println ( " Even " ) ; } } public static void main ( String args [ ] ) { int [ ] a = { 2 , 1 , 5 , 7 , 6 , 8 , 9 } ; int n = a . length ; int q [ ] [ ] = { { 0 , 2 } , { 1 , 2 } , { 2 , 3 } , { 3 , 6 } } ; int m = q . length ; performQueries ( a , n , q , m ) ; } }

Index/key variables: MAXN, R, i
Accumulator variables: cnt, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void findTriplets ( int x ) { Vector < Integer > fact = new Vector < Integer > ( ) ; HashSet < Integer > factors = new HashSet < Integer > ( ) ; for ( int i = 2 ; i <= Math . sqrt ( x ) ; i ++ ) { if ( x % i == 0 ) { fact . add ( i ) ; if ( x / i != i ) fact . add ( x / i ) ; factors . add ( i ) ; factors . add ( x / i ) ; } } boolean found = false ; int k = fact . size ( ) ; for ( int i = 0 ; i < k ; i ++ ) { int a = fact . get ( i ) ; for ( int j = 0 ; j < k ; j ++ ) { int b = fact . get ( j ) ; if ( ( a != b ) && ( x % ( a * b ) == 0 ) && ( x / ( a * b ) != a ) && ( x / ( a * b ) != b ) && ( x / ( a * b ) != 1 ) ) { System . out . print ( a + " ▁ " + b + " ▁ " + ( x / ( a * b ) ) ) ; found = true ; break ; } } if ( found ) break ; } if ( ! found ) System . out . print ( " - 1" ) ; } public static void main ( String [ ] args ) { int x = 105 ; findTriplets ( x ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Boolean variables: found
Class/struct names: GFG
Java program:
class GFG { static int countPair ( int a , int b ) { String s = String . valueOf ( b ) ; int i ; for ( i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) != '9' ) break ; } int result ; if ( i == s . length ( ) ) result = a * s . length ( ) ; else result = a * ( s . length ( ) - 1 ) ; return result ; } public static void main ( String [ ] args ) { int a = 5 , b = 101 ; System . out . print ( countPair ( a , b ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static Vector < Integer > makeSeq ( String s , int a [ ] ) { Vector < Integer > seq = new Vector < Integer > ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) if ( s . charAt ( i ) == ' A ' ) seq . add ( a [ i ] ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) if ( s . charAt ( i ) == ' B ' ) seq . add ( a [ i ] ) ; return seq ; } static boolean checkSeq ( Vector < Integer > v ) { boolean check = true ; for ( int i = 1 ; i < v . size ( ) ; i ++ ) if ( v . get ( i ) < v . get ( i - 1 ) ) check = false ; return check ; } static String digitPartition ( int X ) { String num = String . valueOf ( X ) ; int l = num . length ( ) ; int [ ] a = new int [ l ] ; for ( int i = 0 ; i < l ; i ++ ) a [ i ] = ( num . charAt ( i ) - '0' ) ; for ( int D = 0 ; D < 10 ; D ++ ) { String res = " " ; for ( int i = 0 ; i < l ; i ++ ) { if ( a [ i ] < D ) res += ' A ' ; else if ( a [ i ] > D ) res += ' B ' ; else res += ' C ' ; } boolean flag = false ; for ( int i = 0 ; i < l ; i ++ ) { if ( res . charAt ( i ) == ' B ' ) flag = true ; if ( res . charAt ( i ) == ' C ' ) res = res . substring ( 0 , i ) + ( flag ? ' A ' : ' B ' ) + res . substring ( i + 1 ) ; } Vector < Integer > seq = makeSeq ( res , a ) ; if ( checkSeq ( seq ) ) return res ; } return " - 1" ; } public static void main ( String [ ] args ) { int X = 777147777 ; System . out . print ( digitPartition ( X ) ) ; } }

Index/key variables: i, l
Accumulator variables: D, i, res
Iterator variables: D, i
Boolean variables: check, flag
Class/struct names: GFG
Java program:
class GFG { static float getArea ( int a ) { float area = ( float ) ( Math . PI * a * a ) / 4 ; return area ; } public static void main ( String args [ ] ) { int a = 3 ; System . out . println ( getArea ( a ) ) ; } }

Class/struct names: GFG
Java program:
public class GFG { static boolean flipsPossible ( int [ ] a , int n ) { int count_odd = 0 , count_even = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( ( a [ i ] & 1 ) == 1 ) count_odd ++ ; else count_even ++ ; } if ( count_odd % 2 == 1 && count_even % 2 == 1 ) return false ; else return true ; } public static void main ( String [ ] args ) { int [ ] a = { 1 , 0 , 1 , 1 , 0 , 1 } ; int n = a . length ; if ( flipsPossible ( a , n ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Index/key variables: i
Accumulator variables: count_even, count_odd, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void PerformQueries ( int [ ] a , int [ ] [ ] vec ) { Vector < Integer > ans = new Vector < > ( ) ; int n = ( int ) a . length - 1 ; int q = ( int ) vec . length ; for ( int i = 0 ; i < q ; ++ i ) { long t = vec [ i ] [ 0 ] ; int m = vec [ i ] [ 1 ] ; if ( m > n ) { ans . add ( - 1 ) ; continue ; } int turn = ( int ) ( t / n ) ; int rem = ( int ) ( t % n ) ; if ( rem == 0 && turn % 2 == 1 ) { ans . add ( - 1 ) ; continue ; } if ( rem == 0 && turn % 2 == 0 ) { ans . add ( a [ m ] ) ; continue ; } if ( turn % 2 == 0 ) { int cursize = n - rem ; if ( cursize < m ) { ans . add ( - 1 ) ; continue ; } ans . add ( a [ m + rem ] ) ; } else { int cursize = rem ; if ( cursize < m ) { ans . add ( - 1 ) ; continue ; } ans . add ( a [ m ] ) ; } } for ( int i : ans ) System . out . print ( i + "NEW_LINE"); } public static void main ( String [ ] args ) { int [ ] a = { - 1 , 1 , 2 , 3 , 4 , 5 } ; int [ ] [ ] vec = { { 1 , 4 } , { 6 , 1 } , { 3 , 5 } } ; PerformQueries ( a , vec ) ; } }

Index/key variables: i, m
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int sumEqualProduct ( int a [ ] , int n ) { int zero = 0 , two = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] == 0 ) { zero ++ ; } if ( a [ i ] == 2 ) { two ++ ; } } int cnt = ( zero * ( zero - 1 ) ) / 2 + ( two * ( two - 1 ) ) / 2 ; return cnt ; } public static void main ( String [ ] args ) { int a [ ] = { 2 , 2 , 3 , 4 , 2 , 6 } ; int n = a . length ; System . out . print ( sumEqualProduct ( a , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, two, zero
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int minSum ( int n ) { int sum = 0 ; while ( n > 0 ) { sum += ( n % 10 ) ; n /= 10 ; } if ( sum == 1 ) return 10 ; return sum ; } public static void main ( String [ ] args ) { int n = 1884 ; System . out . print ( minSum ( n ) ) ; } }

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