dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
import java . util . * ; class GFG { static char Winner ( int N ) { boolean player = true ; while ( N > 1 ) { int den = ( player ) ? 9 : 2 ; int X = N / den ; int Y = N % den ; N = ( Y > 0 ) ? X + 1 : X ; player = ! player ; } if ( player ) return ' B ' ; else return ' A ' ; } public static void main ( String [ ] args ) { int N = 10 ; System . out . print ( Winner ( N ) ) ; } }

Boolean variables: player
Class/struct names: GFG
Java program:
class Test { static int arr [ ] = { 10 , 324 , 45 , 90 , 9808 } ; static int largest ( ) { int i ; int max = arr [ 0 ] ; for ( i = 1 ; i < arr . length ; i ++ ) if ( arr [ i ] > max ) max = arr [ i ] ; return max ; } public static void main ( String [ ] args ) { System . out . println ( " Largest ▁ in ▁ given ▁ array ▁ is ▁ " + largest ( ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: Test
Java program:
import java . util . * ; class GFG { static void minimumsteps ( int N ) { int steps = 0 ; while ( steps * ( steps + 1 ) < 2 * N ) { steps ++ ; } if ( steps * ( steps + 1 ) / 2 == N + 1 ) { steps ++ ; } System . out . println ( steps ) ; } public static void main ( String [ ] args ) { int N = 18 ; minimumsteps ( N ) ; } }

Accumulator variables: steps
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static int largest ( int [ ] arr , int n ) { Arrays . sort ( arr ) ; return arr [ n - 1 ] ; } static public void main ( String [ ] args ) { int [ ] arr = { 10 , 324 , 45 , 90 , 9808 } ; int n = arr . length ; System . out . println ( largest ( arr , n ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; import java . util . Arrays ; class GFG { void find3largest ( int [ ] arr ) { Arrays . sort ( arr ) ; int n = arr . length ; int check = 0 , count = 1 ; for ( int i = 1 ; i <= n ; i ++ ) { if ( count < 4 ) { if ( check != arr [ n - i ] ) { System . out . print ( arr [ n - i ] + " ▁ " ) ; check = arr [ n - i ] ; count ++ ; } } else break ; } } public static void main ( String [ ] args ) { GFG obj = new GFG ( ) ; int [ ] arr = { 12 , 45 , 1 , - 1 , 45 , 54 , 23 , 5 , 0 , - 10 } ; obj . find3largest ( arr ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int minCntCharDeletionsfrequency ( char [ ] str , int N ) { HashMap < Character , Integer > mp = new HashMap < > ( ) ; PriorityQueue < Integer > pq = new PriorityQueue < > ( ( x , y ) -> Integer . compare ( y , x ) ) ; int cntChar = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( mp . containsKey ( str [ i ] ) ) { mp . put ( str [ i ] , mp . get ( str [ i ] ) + 1 ) ; } else { mp . put ( str [ i ] , 1 ) ; } } for ( Map . Entry < Character , Integer > it : mp . entrySet ( ) ) { pq . add ( it . getValue ( ) ) ; } while ( ! pq . isEmpty ( ) ) { int frequent = pq . peek ( ) ; pq . remove ( ) ; if ( pq . isEmpty ( ) ) { return cntChar ; } if ( frequent == pq . peek ( ) ) { if ( frequent > 1 ) { pq . add ( frequent - 1 ) ; } cntChar ++ ; } } return cntChar ; } public static void main ( String [ ] args ) { String str = " abbbcccd " ; int N = str . length ( ) ; System . out . print ( minCntCharDeletionsfrequency ( str . toCharArray ( ) , N ) ) ; } }

Index/key variables: i
Accumulator variables: cntChar, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { public static boolean issafe ( char v [ ] [ ] , int i , int j , int n , int m , char ch ) { int rowN [ ] = { 1 , - 1 , 0 , 0 } ; int colN [ ] = { 0 , 0 , 1 , - 1 } ; for ( int k = 0 ; k < 4 ; k ++ ) { if ( i + rowN [ k ] >= 0 && i + rowN [ k ] < n && j + colN [ k ] >= 0 && j + colN [ k ] < m && v [ i + rowN [ k ] ] [ j + colN [ k ] ] == ch ) { return false ; } } return true ; } public static boolean place ( char v [ ] [ ] , int n , int m ) { int i = 0 , j = 0 ; for ( i = 0 ; i < n ; i ++ ) { for ( j = 0 ; j < m ; j ++ ) { if ( v [ i ] [ j ] == ' F ' ) { break ; } } if ( j != m ) { break ; } } if ( i == n && j == m ) { return true ; } if ( issafe ( v , i , j , n , m , '1' ) ) { v [ i ] [ j ] = '1' ; if ( place ( v , n , m ) ) { return true ; } v [ i ] [ j ] = ' F ' ; } if ( issafe ( v , i , j , n , m , '2' ) ) { v [ i ] [ j ] = '2' ; if ( place ( v , n , m ) ) { return true ; } v [ i ] [ j ] = ' F ' ; } return false ; } public static void printMatrix ( char arr [ ] [ ] , int n , int m ) { place ( arr , n , m ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { System . out . print ( arr [ i ] [ j ] ) ; } System . out . println ( ) ; } } public static void main ( String [ ] args ) { char arr [ ] [ ] = { { ' F ' , ' F ' , ' F ' , ' F ' } , { ' F ' , ' O ' , ' F ' , ' F ' } , { ' F ' , ' F ' , ' O ' , ' F ' } , { ' F ' , ' F ' , ' F ' , ' F ' } , } ; int n = 4 , m = 4 ; printMatrix ( arr , n , m ) ; } }

Index/key variables: i, j, k
Accumulator variables: i, j, k
Iterator variables: i, j, k
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { public static double findMean ( int a [ ] , int n ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum += a [ i ] ; return ( double ) sum / ( double ) n ; } public static double findMedian ( int a [ ] , int n ) { Arrays . sort ( a ) ; if ( n % 2 != 0 ) return ( double ) a [ n / 2 ] ; return ( double ) ( a [ ( n - 1 ) / 2 ] + a [ n / 2 ] ) / 2.0 ; } public static void main ( String args [ ] ) { int a [ ] = { 1 , 3 , 4 , 2 , 7 , 5 , 8 , 6 } ; int n = a . length ; System . out . println ( " Mean ▁ = ▁ " + findMean ( a , n ) ) ; System . out . println ( " Median ▁ = ▁ " + findMedian ( a , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static class Node { int key ; Node left , right ; Node ( int key_ ) { this . key = key_ ; this . left = null ; this . right = null ; } } ; static int sumOfLeftLeaves ( Node root ) { if ( root == null ) return 0 ; Stack < Node > stack_ = new Stack < > ( ) ; stack_ . push ( root ) ; int sum = 0 ; while ( stack_ . size ( ) > 0 ) { Node currentNode = stack_ . peek ( ) ; stack_ . pop ( ) ; if ( currentNode . left != null ) { stack_ . add ( currentNode . left ) ; if ( currentNode . left . left == null && currentNode . left . right == null ) { sum = sum + currentNode . left . key ; } } if ( currentNode . right != null ) stack_ . add ( currentNode . right ) ; } return sum ; } public static void main ( String [ ] args ) { Node root = new Node ( 20 ) ; root . left = new Node ( 9 ) ; root . right = new Node ( 49 ) ; root . right . left = new Node ( 23 ) ; root . right . right = new Node ( 52 ) ; root . right . right . left = new Node ( 50 ) ; root . left . left = new Node ( 5 ) ; root . left . right = new Node ( 12 ) ; root . left . right . right = new Node ( 12 ) ; System . out . print ( " Sum ▁ of ▁ left ▁ leaves ▁ is ▁ " + sumOfLeftLeaves ( root ) + "NEW_LINE"); } }

Class/struct names: GFG, Node
Java program:
import java . util . * ; class GFG { static void findXandYwithminABSX_Y ( int N ) { if ( N % 2 == 1 ) { System . out . print ( ( N / 2 ) + " ▁ " + ( N / 2 + 1 ) ) ; } else { System . out . print ( ( N / 2 - 1 ) + " ▁ " + ( N / 2 + 1 ) ) ; } } public static void main ( String [ ] args ) { int N = 12 ; findXandYwithminABSX_Y ( N ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; import java . util . Arrays ; class GFG { static int findMax ( int [ ] a , int dp [ ] [ ] , int i , int flag ) { if ( i == ( int ) a . length ) { return 0 ; } if ( dp [ i ] [ flag ] != - 1 ) { return dp [ i ] [ flag ] ; } int ans ; if ( flag == 0 ) { ans = Math . max ( findMax ( a , dp , i + 1 , 0 ) , a [ i ] + findMax ( a , dp , i + 1 , 1 ) ) ; } else { ans = Math . max ( findMax ( a , dp , i + 1 , 1 ) , - 1 * a [ i ] + findMax ( a , dp , i + 1 , 0 ) ) ; } return dp [ i ] [ flag ] = ans ; } static void findMaxSumUtil ( int [ ] arr , int N ) { int dp [ ] [ ] = new int [ N ] [ 2 ] ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < 2 ; j ++ ) { dp [ i ] [ j ] = - 1 ; } } System . out . println ( findMax ( arr , dp , 0 , 0 ) ) ; } public static void main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 4 , 1 , 2 } ; int N = arr . length ; findMaxSumUtil ( arr , N ) ; } }

Index/key variables: N, flag, i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static void findWinner ( char [ ] s ) { int vowels_count = 0 , consonants_count = 0 ; for ( int i = 0 ; i < s . length ; i ++ ) { if ( s [ i ] == ' a ' s [ i ] == ' e ' s [ i ] == ' i ' s [ i ] == ' o ' s [ i ] == ' u ' ) { vowels_count ++ ; } else { consonants_count ++ ; } } if ( vowels_count == 0 ) { if ( consonants_count % 2 == 0 ) { System . out . print ( " Player ▁ B " ) ; } else { System . out . print ( " Player ▁ A " ) ; } } else if ( vowels_count == 1 && consonants_count % 2 != 0 ) { System . out . print ( " Player ▁ A " ) ; } else { System . out . print ( " D " ) ; } } public static void main ( String [ ] args ) { String s = " abcd " ; findWinner ( s . toCharArray ( ) ) ; } }

Index/key variables: i
Accumulator variables: consonants_count, i, vowels_count
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { @ SuppressWarnings ( " unchecked " ) static void getSmallestArray ( int A , int B ) { Vector arr = new Vector ( ) ; for ( int i = 0 ; i < A ; i ++ ) arr . add ( i + 1 ) ; Vector ans = new Vector ( ) ; for ( int i = 0 ; i < B - 1 ; i ++ ) ans . add ( arr . get ( i ) ) ; ans . add ( arr . get ( A - 1 ) ) ; for ( int i = B ; i < A ; i ++ ) ans . add ( arr . get ( i - 1 ) ) ; for ( int i = 0 ; i < ans . size ( ) ; i ++ ) System . out . print ( ans . get ( i ) + " ▁ " ) ; } public static void main ( String args [ ] ) { int A = 3 ; int B = 2 ; getSmallestArray ( A , B ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; import java . lang . * ; public class GfG { public static void printSmall ( int arr [ ] , int n , int k ) { for ( int i = k ; i < n ; ++ i ) { int max_var = arr [ k - 1 ] ; int pos = k - 1 ; for ( int j = k - 2 ; j >= 0 ; j -- ) { if ( arr [ j ] > max_var ) { max_var = arr [ j ] ; pos = j ; } } if ( max_var > arr [ i ] ) { int j = pos ; while ( j < k - 1 ) { arr [ j ] = arr [ j + 1 ] ; j ++ ; } arr [ k - 1 ] = arr [ i ] ; } } for ( int i = 0 ; i < k ; i ++ ) System . out . print ( arr [ i ] + " ▁ " ) ; } public static void main ( String argc [ ] ) { int [ ] arr = { 1 , 5 , 8 , 9 , 6 , 7 , 3 , 4 , 2 , 0 } ; int n = 10 ; int k = 5 ; printSmall ( arr , n , k ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GfG
Java program:
import java . io . * ; class KSmallestPair { static void kSmallestPair ( int arr1 [ ] , int n1 , int arr2 [ ] , int n2 , int k ) { if ( k > n1 * n2 ) { System . out . print ( " k ▁ pairs ▁ don ' t ▁ exist " ) ; return ; } int index2 [ ] = new int [ n1 ] ; while ( k > 0 ) { int min_sum = Integer . MAX_VALUE ; int min_index = 0 ; for ( int i1 = 0 ; i1 < n1 ; i1 ++ ) { if ( index2 [ i1 ] < n2 && arr1 [ i1 ] + arr2 [ index2 [ i1 ] ] < min_sum ) { min_index = i1 ; min_sum = arr1 [ i1 ] + arr2 [ index2 [ i1 ] ] ; } } System . out . print ( " ( " + arr1 [ min_index ] + " , ▁ " + arr2 [ index2 [ min_index ] ] + " ) ▁ " ) ; index2 [ min_index ] ++ ; k -- ; } } public static void main ( String [ ] args ) { int arr1 [ ] = { 1 , 3 , 11 } ; int n1 = arr1 . length ; int arr2 [ ] = { 2 , 4 , 8 } ; int n2 = arr2 . length ; int k = 4 ; kSmallestPair ( arr1 , n1 , arr2 , n2 , k ) ; } }

Index/key variables: i1, min_index, n1
Accumulator variables: i1, k
Iterator variables: i1
Class/struct names: KSmallestPair
Java program:
class GFG { static void number_of_Strings ( int N , int M ) { System . out . print ( Math . min ( N , Math . min ( M , ( N + M ) / 3 ) ) ) ; } public static void main ( String [ ] args ) { int N = 4 , M = 19 ; number_of_Strings ( N , M ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int maxSubset ( Integer arr [ ] , int N , int X ) { Arrays . sort ( arr , Collections . reverseOrder ( ) ) ; int counter = 0 ; int sz = 0 ; for ( int i = 0 ; i < N ; i ++ ) { sz ++ ; if ( arr [ i ] * sz >= X ) { counter ++ ; sz = 0 ; } } return counter ; } public static void main ( String [ ] args ) { Integer arr [ ] = { 7 , 11 , 2 , 9 , 5 } ; int N = arr . length ; int X = 10 ; System . out . print ( maxSubset ( arr , N , X ) ) ; } }

Index/key variables: i
Accumulator variables: counter, i, sz
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int maximumModuloValue ( int A [ ] , int n ) { int mn = Integer . MAX_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { mn = Math . min ( A [ i ] , mn ) ; } return mn ; } public static void main ( String [ ] args ) { int A [ ] = { 7 , 10 , 12 } ; int n = A . length ; System . out . println ( maximumModuloValue ( A , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static final int N = 3 ; static final int M = 4 ; static class query { int x1 , x2 , y1 , y2 , K ; public query ( int x1 , int x2 , int y1 , int y2 , int k ) { this . x1 = x1 ; this . x2 = x2 ; this . y1 = y1 ; this . y2 = y2 ; K = k ; } } ; static void updateQuery ( int from_x , int from_y , int to_x , int to_y , int k , int aux [ ] [ ] ) { aux [ from_x ] [ from_y ] += k ; if ( to_x + 1 < N ) aux [ to_x + 1 ] [ from_y ] -= k ; if ( to_x + 1 < N && to_y + 1 < M ) aux [ to_x + 1 ] [ to_y + 1 ] += k ; if ( to_y + 1 < M ) aux [ from_x ] [ to_y + 1 ] -= k ; } static void updateMatrix ( int mat [ ] [ ] , int aux [ ] [ ] ) { for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 1 ; j < M ; j ++ ) { aux [ i ] [ j ] += aux [ i ] [ j - 1 ] ; } } for ( int i = 0 ; i < M ; i ++ ) { for ( int j = 1 ; j < N ; j ++ ) { aux [ j ] [ i ] += aux [ j - 1 ] [ i ] ; } } for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < M ; j ++ ) { mat [ i ] [ j ] += aux [ i ] [ j ] ; } } } static void printMatrix ( int mat [ ] [ ] ) { for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < M ; j ++ ) { System . out . print ( mat [ i ] [ j ] + " ▁ " ) ; } System . out . print ( "NEW_LINE"); } } static void matrixQuery ( int mat [ ] [ ] , int Q , query q [ ] ) { int [ ] [ ] aux = new int [ N ] [ M ] ; for ( int i = 0 ; i < Q ; i ++ ) { updateQuery ( q [ i ] . x1 , q [ i ] . x2 , q [ i ] . y1 , q [ i ] . y2 , q [ i ] . K , aux ) ; } updateMatrix ( mat , aux ) ; printMatrix ( mat ) ; } public static void main ( String [ ] args ) { int mat [ ] [ ] = { { 1 , 0 , 1 , 2 } , { 0 , 2 , 4 , 1 } , { 1 , 2 , 1 , 0 } } ; int Q = 1 ; query q [ ] = { new query ( 0 , 0 , 1 , 1 , 2 ) } ; matrixQuery ( mat , Q , q ) ; } }

Index/key variables: M, N, from_x, from_y, i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG, query
Java program:
import java . util . * ; class GFG { static void print2largest ( int arr [ ] , int arr_size ) { int i , first , second ; if ( arr_size < 2 ) { System . out . printf ( " ▁ Invalid ▁ Input ▁ " ) ; return ; } Arrays . sort ( arr ) ; for ( i = arr_size - 2 ; i >= 0 ; i -- ) { if ( arr [ i ] != arr [ arr_size - 1 ] ) { System . out . printf ( " The ▁ second ▁ largest ▁ " + "element is %dNEW_LINE", arr[i]); return ; } } System . out . printf ( " There ▁ is ▁ no ▁ second ▁ " + "largest elementNEW_LINE"); } public static void main ( String [ ] args ) { int arr [ ] = { 12 , 35 , 1 , 10 , 34 , 1 } ; int n = arr . length ; print2largest ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static class Node { int key ; Node left , right ; Node ( int key_ ) { key = key_ ; left = null ; right = null ; } } ; static class pair { Node first ; boolean second ; public pair ( Node first , boolean second ) { this . first = first ; this . second = second ; } } static int sumOfLeftLeaves ( Node root ) { if ( root == null ) return 0 ; Queue < pair > q = new LinkedList < > ( ) ; q . add ( new pair ( root , false ) ) ; int sum = 0 ; while ( ! q . isEmpty ( ) ) { Node temp = q . peek ( ) . first ; boolean is_left_child = q . peek ( ) . second ; q . remove ( ) ; if ( is_left_child ) sum = sum + temp . key ; if ( temp . left != null && temp . right != null && is_left_child ) sum = sum - temp . key ; if ( temp . left != null ) { q . add ( new pair ( temp . left , true ) ) ; } if ( temp . right != null ) { q . add ( new pair ( temp . right , false ) ) ; } } return sum ; } public static void main ( String [ ] args ) { Node root = new Node ( 20 ) ; root . left = new Node ( 9 ) ; root . right = new Node ( 49 ) ; root . right . left = new Node ( 23 ) ; root . right . right = new Node ( 52 ) ; root . right . right . left = new Node ( 50 ) ; root . left . left = new Node ( 5 ) ; root . left . right = new Node ( 12 ) ; root . left . right . right = new Node ( 12 ) ; System . out . print ( " Sum ▁ of ▁ left ▁ leaves ▁ is ▁ " + sumOfLeftLeaves ( root ) + "NEW_LINE"); } }

Class/struct names: GFG, Node, pair
Java program:
class GFG { static int countNestedPolygons ( int sides ) { int count = 0 ; while ( sides > 5 ) { sides /= 2 ; count += 1 ; } return count ; } public static void main ( String [ ] args ) { int N = 12 ; System . out . print ( countNestedPolygons ( N ) ) ; } }

Accumulator variables: count, sides
Class/struct names: GFG
Java program:
class GFG { static void print2largest ( int arr [ ] , int arr_size ) { int i , first , second ; if ( arr_size < 2 ) { System . out . printf ( " ▁ Invalid ▁ Input ▁ " ) ; return ; } int largest = second = Integer . MIN_VALUE ; for ( i = 0 ; i < arr_size ; i ++ ) { largest = Math . max ( largest , arr [ i ] ) ; } for ( i = 0 ; i < arr_size ; i ++ ) { if ( arr [ i ] != largest ) second = Math . max ( second , arr [ i ] ) ; } if ( second == Integer . MIN_VALUE ) System . out . printf ( " There ▁ is ▁ no ▁ second ▁ " + "largest elementNEW_LINE"); else System . out . printf ( " The ▁ second ▁ largest ▁ " + "element is %dNEW_LINE", second); } public static void main ( String [ ] args ) { int arr [ ] = { 12 , 35 , 1 , 10 , 34 , 1 } ; int n = arr . length ; print2largest ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { public static void print2largest ( int arr [ ] , int arr_size ) { int i , first , second ; if ( arr_size < 2 ) { System . out . print ( " ▁ Invalid ▁ Input ▁ " ) ; return ; } first = second = Integer . MIN_VALUE ; for ( i = 0 ; i < arr_size ; i ++ ) { if ( arr [ i ] > first ) { second = first ; first = arr [ i ] ; } else if ( arr [ i ] > second && arr [ i ] != first ) second = arr [ i ] ; } if ( second == Integer . MIN_VALUE ) System . out . print ( " There ▁ is ▁ no ▁ second ▁ largest " + " elementNEW_LINE"); else System . out . print ( " The ▁ second ▁ largest ▁ element " + " ▁ is ▁ " + second ) ; } public static void main ( String [ ] args ) { int arr [ ] = { 12 , 35 , 1 , 10 , 34 , 1 } ; int n = arr . length ; print2largest ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static class pair { int first , second ; public pair ( int first , int second ) { this . first = first ; this . second = second ; } } static void queryResult ( int prefix [ ] , pair Q ) { int l = Q . first ; int r = Q . second ; if ( l == 0 ) { int xorval = prefix [ r ] ; System . out . print ( Integer . bitCount ( xorval ) + "NEW_LINE"); } else { int xorval = prefix [ r ] ^ prefix [ l - 1 ] ; System . out . print ( Integer . bitCount ( xorval ) + "NEW_LINE"); } } static void calculateCount ( String S , pair Q [ ] , int m ) { int n = S . length ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = ( 1 << ( S . charAt ( i ) - ' a ' ) ) ; } int [ ] prefix = new int [ n ] ; int x = 0 ; for ( int i = 0 ; i < n ; i ++ ) { x ^= arr [ i ] ; prefix [ i ] = x ; } for ( int i = 0 ; i < m ; i ++ ) { queryResult ( prefix , Q [ i ] ) ; } } public static void main ( String [ ] args ) { String S = " geeksforgeeks " ; pair Q [ ] = { new pair ( 2 , 4 ) , new pair ( 0 , 3 ) , new pair ( 0 , 12 ) } ; calculateCount ( S , Q , 3 ) ; } }

Index/key variables: i, n, r
Accumulator variables: i, x
Iterator variables: i
Class/struct names: GFG, pair
Java program:
import java . io . * ; import java . util . * ; class GFG { static long countStrings ( long A , long B , long K ) { long X = ( A + B ) / ( K + 1 ) ; return ( Math . min ( A , Math . min ( B , X ) ) * ( K + 1 ) ) ; } public static void main ( String [ ] args ) { long N = 101 , M = 231 , K = 15 ; System . out . print ( countStrings ( N , M , K ) ) ; } }

Class/struct names: GFG
Java program:
public class Gfg { public static void UniqueMatrix ( int N ) { int element_value = 1 ; int i = 0 ; while ( i < N ) { if ( i % 2 == 0 ) { for ( int f = element_value ; f < element_value + N ; f ++ ) { System . out . print ( f + " ▁ " ) ; } element_value += N ; } else { for ( int k = element_value + N - 1 ; k > element_value - 1 ; k -- ) { System . out . print ( k + " ▁ " ) ; } element_value += N ; } System . out . println ( ) ; i = i + 1 ; } } public static void main ( String [ ] args ) { int N = 4 ; UniqueMatrix ( N ) ; } }

Accumulator variables: element_value, f, k
Iterator variables: f, k
Class/struct names: Gfg
Java program:
public class GFG { static class Pair { int min ; int max ; } static Pair getMinMax ( int arr [ ] , int n ) { Pair minmax = new Pair ( ) ; int i ; if ( n == 1 ) { minmax . max = arr [ 0 ] ; minmax . min = arr [ 0 ] ; return minmax ; } if ( arr [ 0 ] > arr [ 1 ] ) { minmax . max = arr [ 0 ] ; minmax . min = arr [ 1 ] ; } else { minmax . max = arr [ 1 ] ; minmax . min = arr [ 0 ] ; } for ( i = 2 ; i < n ; i ++ ) { if ( arr [ i ] > minmax . max ) { minmax . max = arr [ i ] ; } else if ( arr [ i ] < minmax . min ) { minmax . min = arr [ i ] ; } } return minmax ; } public static void main ( String args [ ] ) { int arr [ ] = { 1000 , 11 , 445 , 1 , 330 , 3000 } ; int arr_size = 6 ; Pair minmax = getMinMax ( arr , arr_size ) ; System . out . printf ( " Minimum element is % d ", minmax.min); System . out . printf ( " Maximum element is % d ", minmax.max); } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG, Pair
Java program:
import java . util . * ; class GFG { static int sumNodes ( int l ) { int leafNodeCount = ( int ) Math . pow ( 2 , l - 1 ) ; Vector < Vector < Integer > > vec = new Vector < Vector < Integer > > ( ) ; for ( int i = 1 ; i <= l ; i ++ ) vec . add ( new Vector < Integer > ( ) ) ; for ( int i = 1 ; i <= leafNodeCount ; i ++ ) vec . get ( l - 1 ) . add ( i ) ; for ( int i = l - 2 ; i >= 0 ; i -- ) { int k = 0 ; while ( k < vec . get ( i + 1 ) . size ( ) - 1 ) { vec . get ( i ) . add ( vec . get ( i + 1 ) . get ( k ) + vec . get ( i + 1 ) . get ( k + 1 ) ) ; k += 2 ; } } int sum = 0 ; for ( int i = 0 ; i < l ; i ++ ) { for ( int j = 0 ; j < vec . get ( i ) . size ( ) ; j ++ ) sum += vec . get ( i ) . get ( j ) ; } return sum ; } public static void main ( String args [ ] ) { int l = 3 ; System . out . println ( sumNodes ( l ) ) ; } }

Accumulator variables: i, j, k, sum
Iterator variables: i, j
Class/struct names: GFG