dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
import java . io . * ; class GFG { static void newvol ( double x ) { System . out . print ( " percentage ▁ increase ▁ " + " in ▁ the ▁ volume ▁ of ▁ the ▁ cylinder ▁ is ▁ " + x + " % " ) ; } public static void main ( String [ ] args ) { double x = 10 ; newvol ( x ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static void radius ( double n , double d ) { System . out . print ( " The ▁ side ▁ of ▁ each ▁ square ▁ is ▁ " + d / ( ( n - 1 ) * Math . sqrt ( 2 ) ) ) ; } public static void main ( String [ ] args ) { double d = 42 , n = 4 ; radius ( n , d ) ; } }

Class/struct names: GFG
Java program:
class GFG { static double innerCirclearea ( double radius ) { if ( radius < 0 ) { return - 1 ; } double r = radius / 2 ; double Area = ( 3.14 * Math . pow ( r , 2 ) ) ; return Area ; } public static void main ( String arr [ ] ) { double radius = 4 ; System . out . println ( " Area ▁ of ▁ circle ▁ c2 ▁ = ▁ " + innerCirclearea ( radius ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static void angleequichord ( int z ) { System . out . println ( " The ▁ angle ▁ subtended ▁ at ▁ the ▁ center ▁ is ▁ " + z + " ▁ degrees " ) ; } public static void main ( String [ ] args ) { int z = 48 ; angleequichord ( z ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static void lengequichord ( int z ) { System . out . println ( " The ▁ distance ▁ between ▁ the ▁ " + " chord ▁ and ▁ the ▁ center ▁ is ▁ " + z ) ; } public static void main ( String [ ] args ) { int z = 48 ; lengequichord ( z ) ; } }

Class/struct names: GFG
Java program:
class GFG { static void lengperpbisect ( double r1 , double r2 ) { double z = 2 * Math . sqrt ( ( r1 * r1 ) - ( ( r1 - r2 ) * ( r1 - r2 ) / 4 ) ) ; System . out . println ( " The ▁ length ▁ of ▁ the ▁ " + " perpendicular ▁ bisector ▁ is ▁ " + z ) ; } public static void main ( String [ ] args ) { double r1 = 5 , r2 = 3 ; lengperpbisect ( r1 , r2 ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static void lengchord ( int z ) { System . out . println ( " The ▁ length ▁ is ▁ " + z ) ; } public static void main ( String [ ] args ) { int z = 48 ; lengchord ( z ) ; } }

Class/struct names: GFG
Java program:
import java . lang . Math ; import java . io . * ; class GFG { static double distcenter ( int r1 , int r2 , int x ) { double z = ( Math . sqrt ( ( r1 * r1 ) - ( x / 2 * x / 2 ) ) ) + ( Math . sqrt ( ( r2 * r2 ) - ( x / 2 * x / 2 ) ) ) ; System . out . println ( " distance ▁ between ▁ the " + " ▁ centers ▁ is ▁ " + ( int ) z ) ; return 0 ; } public static void main ( String [ ] args ) { int r1 = 24 , r2 = 37 , x = 40 ; distcenter ( r1 , r2 , x ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static void angleextcycquad ( int z ) { System . out . print ( " The ▁ exterior ▁ angle ▁ of ▁ the " + " ▁ cyclic ▁ quadrilateral ▁ is ▁ " + z + " ▁ degrees " ) ; } public static void main ( String [ ] args ) { int z = 48 ; angleextcycquad ( z ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static void anglechordtang ( int z ) { System . out . print ( " The ▁ angle ▁ between ▁ tangent " + " ▁ and ▁ the ▁ chord ▁ is ▁ " + z + " ▁ degrees " ) ; } public static void main ( String [ ] args ) { int z = 48 ; anglechordtang ( z ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static boolean isPerfect ( int N ) { int sumOfDivisors = 1 ; for ( int i = 2 ; i <= N / 2 ; ++ i ) { if ( N % i == 0 ) { sumOfDivisors += i ; } } if ( sumOfDivisors == N ) { return true ; } else return false ; } static int sumOfDigits ( int N ) { int sum = 0 ; while ( N != 0 ) { sum += ( N % 10 ) ; N = N / 10 ; } return sum ; } static void countPerfectNumbers ( int arr [ ] , int N ) { for ( int i = 0 ; i < N ; ++ i ) { if ( isPerfect ( arr [ i ] ) ) { int sum = sumOfDigits ( arr [ i ] ) ; if ( isPerfect ( sum ) ) { System . out . print ( arr [ i ] + " ▁ " ) ; } } } } public static void main ( String [ ] args ) { int arr [ ] = { 3 , 8 , 12 , 28 , 6 } ; int N = arr . length ; countPerfectNumbers ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: sum, sumOfDivisors
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static class TreeNode { int val ; TreeNode left , right ; TreeNode ( int x ) { val = x ; left = null ; right = null ; } } ; static int findSum ( TreeNode root ) { Queue < TreeNode > que = new LinkedList < > ( ) ; que . add ( root ) ; int ans = 0 ; while ( que . size ( ) > 0 ) { int leaf = 0 ; int nonleaf = 0 ; int length = que . size ( ) ; while ( length > 0 ) { TreeNode temp = que . peek ( ) ; que . remove ( ) ; if ( temp . left == null && temp . right == null ) leaf += temp . val ; else nonleaf += temp . val ; if ( temp . left != null ) que . add ( temp . left ) ; if ( temp . right != null ) que . add ( temp . right ) ; length -= 1 ; } ans += leaf & nonleaf ; } return ans ; } public static void main ( String [ ] args ) { TreeNode root = new TreeNode ( 5 ) ; root . left = new TreeNode ( 3 ) ; root . right = new TreeNode ( 9 ) ; root . left . left = new TreeNode ( 6 ) ; root . left . right = new TreeNode ( 4 ) ; root . left . left . right = new TreeNode ( 7 ) ; System . out . print ( findSum ( root ) ) ; } }

Accumulator variables: ans, leaf, length, nonleaf
Class/struct names: GFG, TreeNode
Java program:
import java . util . * ; class GFG { static void MinTime ( int [ ] a , int [ ] b , int n , int m ) { int ans = 2147483647 ; int [ ] prefix_a = new int [ 10 ] ; int [ ] prefix_b = new int [ 10 ] ; for ( int i = 0 ; i < n ; i ++ ) { prefix_a [ a [ i ] ] ++ ; } for ( int i = 0 ; i < m ; i ++ ) { prefix_b [ b [ i ] ] ++ ; } for ( int i = 1 ; i <= 9 ; i ++ ) { prefix_a [ i ] += prefix_a [ i - 1 ] ; } for ( int i = 1 ; i <= 9 ; i ++ ) { prefix_b [ i ] += prefix_b [ i - 1 ] ; } for ( int i = 0 ; i <= 9 ; i ++ ) { ans = Math . min ( ans , prefix_a [ i ] + m - prefix_b [ i ] ) ; ans = Math . min ( ans , n - prefix_a [ i ] + prefix_b [ i ] ) ; } System . out . println ( ans ) ; } public static void main ( String [ ] args ) { int [ ] A = { 0 , 0 , 1 , 3 , 3 } ; int [ ] B = { 2 , 0 , 3 } ; int N = A . length ; int M = B . length ; MinTime ( A , B , N , M ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; public class GFG { static int findReverse ( int N ) { int rev = 0 ; while ( N > 0 ) { rev <<= 1 ; if ( ( N & 1 ) == 1 ) rev ^= 1 ; N >>= 1 ; } return rev ; } static void countElements ( int arr [ ] , int N ) { Vector < Integer > ans = new Vector < Integer > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { ans . add ( findReverse ( arr [ i ] ) ) ; } HashMap < Integer , Integer > cnt = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { cnt . put ( arr [ i ] , 1 ) ; } int count = 0 ; for ( Integer i : ans ) { if ( cnt . containsKey ( i ) ) count ++ ; } System . out . println ( count ) ; } public static void main ( String [ ] args ) { int [ ] arr = { 1 , 30 , 3 , 8 , 12 } ; int N = arr . length ; countElements ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: count, i, rev
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void fizzBuzz ( int N ) { int count3 = 0 ; int count5 = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { count3 ++ ; count5 ++ ; boolean flag = false ; if ( count3 == 3 ) { System . out . print ( " Fizz " ) ; count3 = 0 ; flag = true ; } if ( count5 == 5 ) { System . out . print ( " Buzz " ) ; count5 = 0 ; flag = true ; } if ( ! flag ) { System . out . print ( i ) ; } System . out . print ( " ▁ " ) ; } } public static void main ( String [ ] args ) { int N = 15 ; fizzBuzz ( N ) ; } }

Accumulator variables: count3, count5, i
Iterator variables: i
Boolean variables: flag
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static boolean [ ] prime = new boolean [ 1000005 ] ; static void SieveOfEratosthenes ( int N ) { Arrays . fill ( prime , true ) ; prime [ 0 ] = false ; prime [ 1 ] = false ; for ( int p = 2 ; p * p <= N ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * p ; i <= N ; i += p ) prime [ i ] = false ; } } } static void checkElementsOnDiagonal ( int [ ] [ ] M , int N ) { int flag = 1 ; SieveOfEratosthenes ( 1000000 ) ; for ( int i = 0 ; i < N ; i ++ ) { boolean flg = ( boolean ) ( prime [ M [ i ] [ i ] ] && prime [ M [ i ] [ N - 1 - i ] ] ) ; int val = ( flg ) ? 1 : 0 ; flag &= val ; } if ( flag != 0 ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } public static void main ( String [ ] args ) { int [ ] [ ] M = { { 1 , 2 , 3 , 13 } , { 5 , 3 , 7 , 8 } , { 1 , 2 , 3 , 4 } , { 5 , 6 , 7 , 7 } } ; int N = M . length ; checkElementsOnDiagonal ( M , N ) ; } }

Index/key variables: i, p
Accumulator variables: flag, i, p
Iterator variables: i, p
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { public static List < Integer > circularPermutation ( int n , int start ) { List < Integer > res = new ArrayList < > ( List . of ( 0 ) ) , ret = new ArrayList < > ( ) ; int index = - 1 ; for ( int k = 0 , add = 1 << k ; k < n ; k ++ , add = 1 << k ) { for ( int i = res . size ( ) - 1 ; i >= 0 ; i -- ) { if ( res . get ( i ) + add == start ) index = res . size ( ) ; res . add ( res . get ( i ) + add ) ; } } if ( start == 0 ) return res ; while ( ret . size ( ) < res . size ( ) ) { ret . add ( res . get ( index ) ) ; index = ( index + 1 ) % res . size ( ) ; } return ret ; } public static void main ( String [ ] args ) { int N = 2 , S = 3 ; System . out . println ( circularPermutation ( N , S ) ) ; } }

Accumulator variables: i, k
Iterator variables: i, k
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int countPairs ( int a [ ] , int n ) { int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { if ( a [ j ] != 0 && a [ i ] % a [ j ] == 0 ) { if ( ( a [ i ] + a [ j ] ) == ( a [ i ] / a [ j ] ) ) count ++ ; } } } return count ; } public static void main ( String [ ] args ) { int arr [ ] = { - 4 , - 3 , 0 , 2 , 1 } ; int N = arr . length ; System . out . print ( countPairs ( arr , N ) ) ; } }

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int countPairs ( int a [ ] , int n ) { int count = 0 ; HashMap < Double , Integer > mp = new HashMap < Double , Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { double y = a [ i ] ; if ( y != 0 && y != 1 ) { double x = ( ( y * 1.0 ) / ( 1 - y ) ) * y ; if ( mp . containsKey ( x ) ) count += mp . get ( x ) ; } if ( mp . containsKey ( y ) ) { mp . put ( y , mp . get ( y ) + 1 ) ; } else { mp . put ( y , 1 ) ; } } return count ; } public static void main ( String [ ] args ) { int arr [ ] = { - 4 , - 3 , 0 , 2 , 1 } ; int N = arr . length ; System . out . print ( countPairs ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; public class GFG { static boolean contains ( int num , int K , int Base ) { boolean isThere = false ; while ( num > 0 ) { int remainder = num % Base ; if ( remainder == K ) { isThere = true ; } num /= Base ; } return isThere ; } static void count ( int n , int k , Vector < Vector < Integer > > v ) { int [ ] pref = new int [ 1000005 ] ; for ( int i = 1 ; i < 1e6 + 5 ; i ++ ) { boolean present = contains ( i , k , 10 ) || contains ( i , k , 8 ) ; if ( present ) { pref [ i ] += pref [ i - 1 ] + 1 ; } } System . out . print ( ( v . get ( 0 ) . get ( 1 ) - v . get ( 0 ) . get ( 0 ) + 1 - ( pref [ v . get ( 0 ) . get ( 1 ) ] - pref [ v . get ( 0 ) . get ( 0 ) - 1 ] ) ) + " ▁ " ) ; System . out . print ( ( v . get ( 1 ) . get ( 1 ) - v . get ( 1 ) . get ( 0 ) - ( pref [ v . get ( 1 ) . get ( 1 ) ] - pref [ v . get ( 1 ) . get ( 0 ) - 1 ] ) ) + " ▁ " ) ; } public static void main ( String [ ] args ) { int K = 7 ; Vector < Vector < Integer > > Q = new Vector < Vector < Integer > > ( ) ; Q . add ( new Vector < Integer > ( ) ) ; Q . get ( 0 ) . add ( 2 ) ; Q . get ( 0 ) . add ( 5 ) ; Q . add ( new Vector < Integer > ( ) ) ; Q . get ( 1 ) . add ( 1 ) ; Q . get ( 1 ) . add ( 15 ) ; int N = Q . size ( ) ; count ( N , K , Q ) ; } }

Index/key variables: i
Accumulator variables: i, num
Iterator variables: i
Boolean variables: isThere
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int numberOfTiles ( int n , int m ) { if ( n % 2 == 1 ) { return - 1 ; } return ( m * n ) / 2 ; } public static void main ( String [ ] args ) { int n = 2 , m = 4 ; System . out . println ( numberOfTiles ( n , m ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void canMakeEqual ( int [ ] arr1 , int [ ] arr2 , int N ) { int count = 0 ; int arr1_one = 0 , arr1_zero = 0 ; int arr2_one = 0 , arr2_zero = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr1 [ i ] == 1 ) { arr1_one ++ ; } else if ( arr1 [ i ] == 0 ) { arr1_zero ++ ; } if ( arr2 [ i ] == 1 ) { arr2_one ++ ; } else if ( arr2 [ i ] == 0 ) { arr2_zero ++ ; } } if ( arr1_one != arr2_one arr1_zero != arr2_zero ) { System . out . print ( " No " ) ; return ; } for ( int i = 0 ; i < N ; i ++ ) { count = count + ( arr1 [ i ] - arr2 [ i ] ) ; if ( count < 0 ) { System . out . print ( " No " ) ; return ; } } System . out . print ( " Yes " ) ; } public static void main ( String [ ] args ) { int [ ] arr1 = { 0 , 1 , 1 , 0 } ; int [ ] arr2 = { 0 , 0 , 1 , 1 } ; int N = arr1 . length ; canMakeEqual ( arr1 , arr2 , N ) ; } }

Index/key variables: i
Accumulator variables: arr1_one, arr1_zero, arr2_one, arr2_zero, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void checksubarrayExist1_N ( int arr [ ] , int N ) { Map < Integer , Integer > pos = new HashMap < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { pos . put ( arr [ i ] , i ) ; } Set < Integer > st = new HashSet < > ( ) ; for ( int i = 1 ; i <= N ; i ++ ) { st . add ( pos . get ( i ) ) ; int Min = Collections . min ( st ) ; int Max = Collections . max ( st ) ; if ( Max - Min + 1 == i ) { System . out . print ( " True ▁ " ) ; } else { System . out . print ( " False ▁ " ) ; } } } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 4 , 3 , 2 } ; int N = arr . length ; checksubarrayExist1_N ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void checkSamePosition ( int [ ] arr , int n ) { Map < Integer , Integer > mp = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int temp = ( ( i + arr [ i ] ) % n + n ) % n ; if ( mp . get ( temp ) == null ) { System . out . println ( " Yes " ) ; return ; } mp . get ( temp + 1 ) ; } System . out . println ( " No " ) ; } public static void main ( String [ ] args ) { int [ ] arr = { 5 , 4 , 3 } ; int N = arr . length ; checkSamePosition ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { public static void sumFib ( int N ) { long num = ( long ) Math . round ( Math . pow ( ( Math . sqrt ( 5 ) + 1 ) / 2.0 , N + 2 ) / Math . sqrt ( 5 ) ) ; System . out . println ( num - 1 ) ; } public static void main ( String [ ] args ) { int N = 3 ; sumFib ( N ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { public static void sumFib ( int N ) { double num = ( 1 - Math . sqrt ( 5 ) ) / 2 ; long val = Math . round ( Math . abs ( 1 / ( Math . pow ( num , N + 2 ) + Math . pow ( num , N + 1 ) + Math . pow ( num , N ) + Math . pow ( num , N - 1 ) ) ) - 1 ) ; System . out . println ( val ) ; } public static void main ( String [ ] args ) { int N = 3 ; sumFib ( N ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static void minOperations ( int arr [ ] , int n , int k ) { Map < Integer , Integer > mp = new HashMap < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( mp . containsKey ( arr [ i ] ) ) { mp . put ( arr [ i ] , mp . get ( arr [ i ] ) + 1 ) ; } else { mp . put ( arr [ i ] , 1 ) ; } } int ans = 0 ; while ( mp . containsKey ( k ) == false || mp . get ( k ) < n ) { for ( int i = 1 ; i <= k - 1 ; i ++ ) { if ( mp . containsKey ( i ) && mp . get ( i ) > 0 ) { mp . put ( i , mp . get ( i ) - 1 ) ; if ( mp . containsKey ( i + 1 ) ) mp . put ( i + 1 , mp . get ( i + 1 ) + 1 ) ; else mp . put ( i + 1 , 1 ) ; if ( mp . containsKey ( i + 1 ) && mp . get ( i + 1 ) == 1 ) { i ++ ; } } } ans ++ ; } System . out . print ( ans ) ; } public static void main ( String [ ] args ) { int arr [ ] = { 2 , 3 , 3 , 4 } ; int K = 5 ; int N = arr . length ; minOperations ( arr , N , K ) ; } }

Index/key variables: i
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static void poorPigs ( int buckets , int minutesToDie , int minutesToTest ) { System . out . print ( ( int ) Math . ceil ( Math . log ( buckets ) / Math . log ( ( minutesToTest / minutesToDie ) + 1 ) ) ) ; } public static void main ( String [ ] args ) { int N = 1000 , M = 15 , P = 60 ; poorPigs ( N , M , P ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static void maxProduct ( int [ ] arr , int N ) { int max_product = Integer . MIN_VALUE ; int prefix_sum = 0 ; int sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { sum += arr [ i ] ; } for ( int i = 0 ; i < N - 1 ; i ++ ) { prefix_sum += arr [ i ] ; int X = prefix_sum ; int Y = sum - prefix_sum ; max_product = Math . max ( max_product , X * Y ) ; } System . out . print ( max_product ) ; } public static void main ( String [ ] args ) { int [ ] arr = { 2 , 3 , 5 , 6 , 7 } ; int N = arr . length ; maxProduct ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i, prefix_sum, sum
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int findMask ( int K ) { int mask = 1 ; while ( ( K & mask ) == 0 ) { mask = mask << 1 ; } return mask ; } public static void sameRightSetBitPos ( int [ ] arr , int N , int K ) { int mask = findMask ( K ) ; final int pos = ( K & mask ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( ( arr [ i ] & mask ) == pos ) System . out . print ( arr [ i ] + " ▁ " ) ; } } public static void main ( String [ ] args ) { int [ ] arr = { 3 , 4 , 6 , 7 , 9 , 12 , 15 } ; int N = arr . length ; int K = 7 ; sameRightSetBitPos ( arr , N , K ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static int MAX = 100001 ; static void maxSum ( int arr [ ] , int N , int K ) { if ( N < K ) { System . out . println ( " Invalid " ) ; return ; } int CountDistinct [ ] = new int [ MAX + 1 ] ; boolean prime [ ] = new boolean [ MAX + 1 ] ; for ( int i = 0 ; i <= MAX ; i ++ ) { CountDistinct [ i ] = 0 ; prime [ i ] = true ; } for ( int i = 2 ; i <= MAX ; i ++ ) { if ( prime [ i ] == true ) { CountDistinct [ i ] = 1 ; for ( int j = i * 2 ; j <= MAX ; j += i ) { CountDistinct [ j ] ++ ; prime [ j ] = false ; } } } int Maxarr_sum = 0 , DistPrimeSum = 0 ; for ( int i = 0 ; i < K ; i ++ ) { Maxarr_sum += arr [ i ] ; DistPrimeSum += CountDistinct [ arr [ i ] ] ; } int curr_sum = DistPrimeSum ; int curr_arrSum = Maxarr_sum ; for ( int i = K ; i < N ; i ++ ) { curr_sum += CountDistinct [ arr [ i ] ] - CountDistinct [ arr [ i - K ] ] ; curr_arrSum += arr [ i ] - arr [ i - K ] ; if ( curr_sum > DistPrimeSum ) { DistPrimeSum = curr_sum ; Maxarr_sum = curr_arrSum ; } else if ( curr_sum == DistPrimeSum ) { Maxarr_sum = Math . max ( curr_arrSum , Maxarr_sum ) ; } } System . out . println ( Maxarr_sum ) ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 4 , 2 , 10 , 3 } ; int K = 3 ; int N = arr . length ; maxSum ( arr , N , K ) ; } }

Index/key variables: i, j
Accumulator variables: DistPrimeSum, Maxarr_sum, curr_arrSum, curr_sum, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean checkPronic ( int x ) { for ( int i = 0 ; i <= ( int ) ( Math . sqrt ( x ) ) ; i ++ ) { if ( ( x == i * ( i + 1 ) ) != false ) { return true ; } } return false ; } static void countPronic ( int A , int B ) { int count = 0 ; for ( int i = A ; i <= B ; i ++ ) { if ( checkPronic ( i ) != false ) { count ++ ; } } System . out . print ( count ) ; } public static void main ( String args [ ] ) { int A = 3 , B = 20 ; countPronic ( A , B ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int pronic ( int num ) { int N = ( int ) Math . sqrt ( num ) ; if ( N * ( N + 1 ) <= num ) { return N ; } return N - 1 ; } static int countPronic ( int A , int B ) { return pronic ( B ) - pronic ( A - 1 ) ; } public static void main ( String [ ] args ) { int A = 3 ; int B = 20 ; System . out . print ( countPronic ( A , B ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void oddDivisors ( int arr [ ] , int N ) { for ( int i = 0 ; i < N ; i ++ ) { int powerOfTwo = 2 ; int count = 0 ; while ( powerOfTwo <= arr [ i ] ) { count ++ ; powerOfTwo = 2 * powerOfTwo ; } System . out . print ( count + " ▁ " ) ; } return ; } public static void main ( String args [ ] ) { int arr [ ] = { 15 , 16 , 20 , 35 } ; int N = arr . length ; oddDivisors ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void checkPossible ( int [ ] arr , int n ) { for ( int i = 1 ; i < n ; i ++ ) { if ( arr [ i ] < arr [ i - 1 ] ) { System . out . print ( "NoNEW_LINE"); return ; } else { arr [ i ] -= arr [ i - 1 ] ; arr [ i - 1 ] = 0 ; } } if ( arr [ n - 1 ] == 0 ) { System . out . print ( "YesNEW_LINE"); } else { System . out . print ( "NoNEW_LINE"); } } public static void main ( String args [ ] ) { int arr [ ] = { 2 , 3 , 3 , 4 , 2 } ; int N = arr . length ; checkPossible ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void highestPowerOfTwo ( int num ) { String s = Integer . toString ( num ) ; for ( int i = 0 ; i < ( int ) s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == '0' ) { System . out . print ( "0" ) ; continue ; } int lg = ( int ) ( Math . log ( s . charAt ( i ) - '0' ) / Math . log ( 2 ) ) ; int p = ( int ) Math . pow ( 2 , lg ) ; System . out . print ( ( char ) ( p + 48 ) ) ; } } public static void main ( String args [ ] ) { int num = 4317 ; highestPowerOfTwo ( num ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static void maxSumAfterKReverse ( Integer arr [ ] , int K , int N ) { int sum = Integer . MIN_VALUE ; if ( K % 2 != 0 ) Collections . reverse ( Arrays . asList ( arr ) ) ; int currsum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { currsum += arr [ i ] ; sum = Math . max ( sum , currsum ) ; } System . out . print ( sum ) ; } public static void main ( String [ ] args ) { Integer [ ] arr = { 1 , 5 , 8 , 9 , 11 , 2 } ; int K = 1 ; int N = arr . length ; maxSumAfterKReverse ( arr , K , N ) ; } }

Index/key variables: i
Accumulator variables: currsum, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void SubMasks ( int N ) { for ( int S = N ; S > 0 ; S = ( S - 1 ) & N ) { System . out . print ( S + " ▁ " ) ; } } public static void main ( String args [ ] ) { int N = 25 ; SubMasks ( N ) ; } }

Iterator variables: S
Class/struct names: GFG