dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
import java . util . ArrayList ; public class geeks { public static ArrayList < Integer > getRow ( int rowIndex ) { ArrayList < Integer > currow = new ArrayList < Integer > ( ) ; currow . add ( 1 ) ; if ( rowIndex == 0 ) { return currow ; } ArrayList < Integer > prev = getRow ( rowIndex - 1 ) ; for ( int i = 1 ; i < prev . size ( ) ; i ++ ) { int curr = prev . get ( i - 1 ) + prev . get ( i ) ; currow . add ( curr ) ; } currow . add ( 1 ) ; return currow ; } public static void main ( String [ ] args ) { int n = 3 ; ArrayList < Integer > arr = getRow ( n ) ; for ( int i = 0 ; i < arr . size ( ) ; i ++ ) { if ( i == arr . size ( ) - 1 ) System . out . print ( arr . get ( i ) ) ; else System . out . print ( arr . get ( i ) + " , ▁ " ) ; } } }

Accumulator variables: i
Iterator variables: i
Class/struct names: geeks
Java program:
import java . util . * ; class GFG { static void allQuotients ( int N ) { HashSet < Integer > s = new HashSet < Integer > ( ) ; for ( int k = 1 ; k <= N + 1 ; k ++ ) { s . add ( N / k ) ; } for ( int it : s ) System . out . print ( it + " ▁ " ) ; } public static void main ( String [ ] args ) { int N = 5 ; allQuotients ( N ) ; } }

Accumulator variables: k
Iterator variables: it, k
Class/struct names: GFG
Java program:
class GFG { public static int greatestOddFactor ( int n ) { int pow_2 = ( int ) ( Math . log ( n ) ) ; int i = 1 ; while ( i <= pow_2 ) { int fac_2 = ( 2 * i ) ; if ( n % fac_2 == 0 ) { if ( ( n / fac_2 ) % 2 == 1 ) { return ( n / fac_2 ) ; } } i += 1 ; } return 0 ; } public static void main ( String [ ] args ) { int N = 8642 ; System . out . println ( greatestOddFactor ( N ) ) ; } }

Accumulator variables: i
Class/struct names: GFG
Java program:
class GFG { static class node { String i ; node next = null ; } ; static node newnode ( String s ) { node temp = new node ( ) ; temp . i = s ; temp . next = null ; return temp ; } static String Majority_in_linklist ( node head ) { String s = " " ; String t = " " ; int p = 0 , q = 0 ; node ptr = null ; while ( head != null ) { if ( s . equals ( head . i ) ) { p = p + 1 ; } else { if ( t . equals ( head . i ) ) { q = q + 1 ; } else { if ( p == 0 ) { s = head . i ; p = 1 ; } else { if ( q == 0 ) { t = head . i ; q = 1 ; } else { p = p - 1 ; q = q - 1 ; } } } } head = head . next ; } head = ptr ; p = 0 ; q = 0 ; while ( head != null ) { if ( s . equals ( head . i ) ) { p = 1 ; } else { if ( t . equals ( head . i ) ) { q = 1 ; } } head = head . next ; } if ( p > q ) { return s ; } else { return t ; } } public static void main ( String [ ] arg ) { node ptr = null ; node head = newnode ( " geeks " ) ; head . next = newnode ( " geeks " ) ; head . next . next = newnode ( " abcd " ) ; head . next . next . next = newnode ( " game " ) ; head . next . next . next . next = newnode ( " game " ) ; head . next . next . next . next . next = newnode ( " knight " ) ; head . next . next . next . next . next . next = newnode ( " harry " ) ; head . next . next . next . next . next . next . next = newnode ( " geeks " ) ; System . out . println ( Majority_in_linklist ( head ) ) ; } }

Class/struct names: GFG, node
Java program:
class GFG { static String max_number ( int arr [ ] , int sum ) { int frac [ ] = new int [ 9 ] ; int maxi = Integer . MIN_VALUE ; StringBuilder ans = new StringBuilder ( ) ; int pos = 0 ; for ( int i = 0 ; i < 9 ; i ++ ) { frac [ i ] = sum / arr [ i ] ; if ( frac [ i ] > maxi ) { pos = i ; maxi = frac [ i ] ; } } for ( int i = 0 ; i < maxi ; i ++ ) { ans . append ( ( char ) ( ( pos + 1 ) + '0' ) ) ; } sum -= maxi * arr [ pos ] ; for ( int i = 0 ; i < maxi ; i ++ ) { for ( int j = 1 ; j <= 9 ; j ++ ) { if ( sum + arr [ pos ] - arr [ j - 1 ] >= 0 ) { ans . setCharAt ( i , ( char ) ( j + '0' ) ) ; sum += arr [ pos ] - arr [ j - 1 ] ; break ; } } } if ( maxi == 0 ) { return "0" ; } else { return ans . toString ( ) ; } } public static void main ( String str [ ] ) { int arr [ ] = { 3 , 4 , 2 , 4 , 6 , 5 , 4 , 2 , 3 } ; int s = 13 ; System . out . println ( max_number ( arr , s ) ) ; } }

Index/key variables: i, pos
Accumulator variables: i, j, sum
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { public static Boolean checkOverlapping ( ArrayList < Integer > a , ArrayList < Integer > b ) { if ( a . get ( 0 ) < b . get ( 0 ) ) { int temp = a . get ( 0 ) ; a . set ( 0 , b . get ( 0 ) ) ; b . set ( 0 , temp ) ; temp = a . get ( 1 ) ; a . set ( 1 , b . get ( 1 ) ) ; b . set ( 1 , temp ) ; } if ( b . get ( 0 ) <= a . get ( 0 ) && a . get ( 0 ) <= b . get ( 1 ) ) return true ; return false ; } public static int find ( ArrayList < Integer > a , int i ) { if ( a . get ( i ) == i ) { return i ; } a . set ( i , find ( a , a . get ( i ) ) ) ; return a . get ( i ) ; } public static Boolean union ( ArrayList < Integer > a , int x , int y ) { int xs = find ( a , x ) ; int ys = find ( a , y ) ; if ( xs == ys ) { return true ; } a . set ( ys , xs ) ; return false ; } public static Boolean checkNonOverlapping ( ArrayList < ArrayList < Integer > > arr , int n ) { ArrayList < Integer > dsu = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < n + 1 ; i ++ ) { dsu . add ( i ) ; } for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { if ( checkOverlapping ( arr . get ( i ) , arr . get ( j ) ) ) { if ( union ( dsu , i , j ) ) { return false ; } } } } return true ; } public static void main ( String [ ] args ) { ArrayList < ArrayList < Integer > > arr = new ArrayList < ArrayList < Integer > > ( ) ; arr . add ( new ArrayList < Integer > ( Arrays . asList ( 1 , 4 ) ) ) ; arr . add ( new ArrayList < Integer > ( Arrays . asList ( 2 , 2 ) ) ) ; arr . add ( new ArrayList < Integer > ( Arrays . asList ( 2 , 3 ) ) ) ; int n = arr . size ( ) ; if ( checkNonOverlapping ( arr , n ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void FindValue ( int N , int K ) { if ( N % 2 == 0 ) { N = N + 2 * K ; } else { int i ; for ( i = 2 ; i < Math . sqrt ( N ) + 1 ; i ++ ) { if ( N % i == 0 ) break ; } N = N + i ; N = N + 2 * ( K - 1 ) ; } System . out . print ( N ) ; } public static void main ( String args [ ] ) { int N = 9 ; int K = 4 ; FindValue ( N , K ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static int lastDigitFactorial ( int n ) { if ( n == 0 ) return 1 ; else if ( n <= 2 ) return n ; else if ( n == 3 ) return 6 ; else if ( n == 4 ) return 4 ; else return 0 ; } public static void main ( String [ ] args ) { System . out . println ( lastDigitFactorial ( 6 ) ) ; } }

Class/struct names: GFG
Java program:
public class Main { public static void HexaDecimaltoBCD ( String s ) { int len = s . length ( ) , check = 0 ; int num = 0 , sum = 0 , mul = 1 ; for ( int i = 0 ; i <= len - 1 ; i ++ ) { if ( s . charAt ( i ) >= 47 && s . charAt ( i ) <= 52 ) { String result = Integer . toBinaryString ( ( int ) s . charAt ( i ) ) ; System . out . print ( result . substring ( result . length ( ) - 4 ) + " ▁ " ) ; } else { String result = Integer . toBinaryString ( ( int ) s . charAt ( i ) - 55 ) ; System . out . print ( result . substring ( result . length ( ) - 4 ) + " ▁ " ) ; } } } public static void main ( String [ ] args ) { String s = "11F " ; HexaDecimaltoBCD ( s ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: Main
Java program:
class GFG { public static int heptadecagonal_num ( int n ) { return ( ( 15 * n * n ) - 13 * n ) / 2 ; } public static int sum_heptadecagonal_num ( int n ) { int summ = 0 ; for ( int i = 1 ; i < n + 1 ; i ++ ) { summ += heptadecagonal_num ( i ) ; } return summ ; } public static void main ( String [ ] args ) { int n = 5 ; System . out . println ( sum_heptadecagonal_num ( n ) ) ; } }

Accumulator variables: i, summ
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean isCenteredpentagonal ( int N ) { float n = ( float ) ( ( 5 + Math . sqrt ( 40 * N - 15 ) ) / 10 ) ; return ( n - ( int ) n ) == 0 ; } public static void main ( String [ ] args ) { int N = 6 ; if ( isCenteredpentagonal ( N ) ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean isdodecagonal ( int N ) { float n = ( float ) ( ( 4 + Math . sqrt ( 20 * N + 16 ) ) / 10 ) ; return ( n - ( int ) n ) == 0 ; } public static void main ( String [ ] args ) { int N = 12 ; if ( isdodecagonal ( N ) ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } }

Class/struct names: GFG
Java program:
class GFG { static int prevPowerofK ( int n , int k ) { int p = ( int ) ( Math . log ( n ) / Math . log ( k ) ) ; return ( int ) Math . pow ( k , p ) ; } static int nextPowerOfK ( int n , int k ) { return prevPowerofK ( n , k ) * k ; } public static void main ( String [ ] args ) { int N = 7 ; int K = 2 ; System . out . print ( prevPowerofK ( N , K ) + " ▁ " ) ; System . out . println ( nextPowerOfK ( N , K ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int [ ] pref = new int [ 100001 ] ; static int isComposite ( int n ) { if ( n <= 1 ) return 0 ; if ( n <= 3 ) return 0 ; if ( n % 2 == 0 n % 3 == 0 ) return n ; for ( int i = 5 ; i * i <= n ; i = i + 6 ) if ( n % i == 0 || n % ( i + 2 ) == 0 ) return n ; return 0 ; } static void preCompute ( ) { for ( int i = 1 ; i <= 100000 ; ++ i ) { pref [ i ] = pref [ i - 1 ] + isComposite ( i ) ; } } static void printSum ( int L , int R ) { System . out . print ( pref [ R ] - pref [ L - 1 ] + "NEW_LINE"); } static void printSumComposite ( int arr [ ] [ ] , int Q ) { preCompute ( ) ; for ( int i = 0 ; i < Q ; i ++ ) { printSum ( arr [ i ] [ 0 ] , arr [ i ] [ 1 ] ) ; } } public static void main ( String [ ] args ) { int Q = 2 ; int arr [ ] [ ] = { { 10 , 13 } , { 12 , 21 } } ; printSumComposite ( arr , Q ) ; } }

Index/key variables: R, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static float findProb ( int l , int r ) { float countOfPS = ( float ) ( Math . floor ( Math . sqrt ( r ) ) - Math . ceil ( Math . sqrt ( l ) ) + 1 ) ; float total = r - l + 1 ; float prob = ( float ) countOfPS / ( float ) total ; return prob ; } public static void main ( String [ ] args ) { int L = 16 , R = 25 ; System . out . print ( findProb ( L , R ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . HashMap ; import java . util . Map ; class GFG { public static int sumDigits ( int n ) { int sum = 0 ; while ( n != 0 ) { sum += n % 10 ; n /= 10 ; } return sum ; } public static HashMap < Integer , Integer > constDict ( int n ) { HashMap < Integer , Integer > d = new HashMap < > ( ) ; for ( int i = 1 ; i < n + 1 ; ++ i ) { int sum1 = sumDigits ( i ) ; if ( ! d . containsKey ( sum1 ) ) d . put ( sum1 , 1 ) ; else d . put ( sum1 , d . get ( sum1 ) + 1 ) ; } return d ; } public static int countLargest ( int n ) { HashMap < Integer , Integer > d = constDict ( n ) ; int size = 0 ; int count = 0 ; for ( Map . Entry < Integer , Integer > it : d . entrySet ( ) ) { int k = it . getKey ( ) ; int val = it . getValue ( ) ; if ( val > size ) { size = val ; count = 1 ; } else if ( val == size ) count += 1 ; } return count ; } public static void main ( String [ ] args ) { int n = 13 ; int group = countLargest ( n ) ; System . out . println ( group ) ; } }

Accumulator variables: count, n, sum
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static long findDigits ( int n , int b ) { if ( n < 0 ) return 0 ; if ( n <= 1 ) return 1 ; double M_PI = 3.141592 ; double M_E = 2.7182 ; double x = ( ( n * Math . log10 ( n / M_E ) + Math . log10 ( 2 * M_PI * n ) / 2.0 ) ) / ( Math . log10 ( b ) ) ; return ( long ) ( Math . floor ( x ) + 1 ) ; } public static void main ( String [ ] args ) { System . out . print ( findDigits ( 4 , 16 ) + "NEW_LINE"); System . out . print ( findDigits ( 5 , 8 ) + "NEW_LINE"); System . out . print ( findDigits ( 12 , 16 ) + "NEW_LINE"); System . out . print ( findDigits ( 19 , 13 ) + "NEW_LINE"); } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static long pref [ ] = new long [ 100010 ] ; static boolean isPerfectSquare ( int x ) { int s = ( int ) Math . sqrt ( x ) ; return ( s * s == x ) ; } static int isNonFibonacci ( int n ) { if ( isPerfectSquare ( 5 * n * n + 4 ) || isPerfectSquare ( 5 * n * n - 4 ) ) return 0 ; else return n ; } static void compute ( ) { for ( int i = 1 ; i <= 100000 ; ++ i ) { pref [ i ] = pref [ i - 1 ] + isNonFibonacci ( i ) ; } } static void printSum ( int L , int R ) { int sum = ( int ) ( pref [ R ] - pref [ L - 1 ] ) ; System . out . print ( sum + " ▁ " ) ; } public static void main ( String [ ] args ) { compute ( ) ; int Q = 2 ; int arr [ ] [ ] = { { 1 , 5 } , { 6 , 10 } } ; for ( int i = 0 ; i < Q ; i ++ ) { printSum ( arr [ i ] [ 0 ] , arr [ i ] [ 1 ] ) ; } } }

Index/key variables: R, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean isPrime ( int n ) { if ( n <= 1 ) return false ; if ( n <= 3 ) return true ; if ( n % 2 == 0 n % 3 == 0 ) return false ; for ( int i = 5 ; i * i <= n ; i += 6 ) { if ( n % i == 0 || n % ( i + 2 ) == 0 ) { return false ; } } return true ; } static boolean twinPrime ( int n1 , int n2 ) { return ( isPrime ( n1 ) && isPrime ( n2 ) && Math . abs ( n1 - n2 ) == 2 ) ; } static int countTwinPairs ( int arr [ ] , int n ) { int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { if ( twinPrime ( arr [ i ] , arr [ j ] ) ) { count ++ ; } } } return count ; } public static void main ( String [ ] args ) { int arr [ ] = { 2 , 3 , 5 , 11 } ; int n = arr . length ; System . out . print ( countTwinPairs ( arr , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static void solve ( int arr [ ] , int n ) { Set < Integer > unfilled_indices = new HashSet < Integer > ( ) ; Set < Integer > missing = new HashSet < Integer > ( ) ; for ( int i = 1 ; i < n ; i ++ ) { missing . add ( i ) ; } for ( int i = 1 ; i < n ; i ++ ) { if ( arr [ i ] == 0 ) { unfilled_indices . add ( i ) ; } else { missing . remove ( arr [ i ] ) ; } } int [ ] mi = new int [ missing . size ( ) ] ; int l = 0 ; for ( int x : missing ) { mi [ l ++ ] = x ; } int m = missing . size ( ) ; for ( int it : unfilled_indices ) { arr [ it ] = mi [ m - 1 ] ; m -- ; } int pos = 0 ; for ( int i = 1 ; i < n ; i ++ ) { if ( arr [ i ] == i ) { pos = i ; } } int x ; if ( pos != 0 ) { for ( int i = 1 ; i < n ; i ++ ) { if ( pos != i ) { if ( unfilled_indices . contains ( i ) ) { x = arr [ i ] ; arr [ i ] = pos ; arr [ pos ] = x ; break ; } } } } printArray ( arr , n ) ; } static void printArray ( int arr [ ] , int n ) { for ( int i = 1 ; i < n ; i ++ ) { System . out . print ( arr [ i ] + " ▁ " ) ; } } public static void main ( String [ ] args ) { int [ ] arr = { 0 , 7 , 4 , 0 , 3 , 0 , 5 , 1 } ; int n = arr . length ; solve ( arr , n ) ; } }

Index/key variables: i, it, pos
Accumulator variables: i, l, m
Iterator variables: i, it, x
Class/struct names: GFG
Java program:
import java . util . ArrayList ; import java . util . Arrays ; class GFG { static class Line implements Comparable < Line > { int m , c ; public Line ( int m , int c ) { this . m = m ; this . c = c ; } @ Override public int compareTo ( Line l ) { if ( m != l . m ) return l . m - this . m ; else return l . c - this . c ; } boolean check ( Line L1 , Line L2 , Line L3 ) { return ( L3 . c - L1 . c ) * ( L1 . m - L2 . m ) < ( L2 . c - L1 . c ) * ( L1 . m - L3 . m ) ; } } static class Convex_HULL_Trick { ArrayList < Line > l = new ArrayList < > ( ) ; void add ( Line newLine ) { int n = l . size ( ) ; while ( n >= 2 && newLine . check ( l . get ( n - 2 ) , l . get ( n - 1 ) , newLine ) ) { n -- ; } l = new Line [ n ] ; l . add ( newLine ) ; } int value ( int in , int x ) { return l . get ( in ) . m * x + l . get ( in ) . c ; } int minQuery ( int x ) { if ( l . isEmpty ( ) ) return Integer . MAX_VALUE ; int low = 0 , high = ( int ) l . size ( ) - 2 ; while ( low <= high ) { int mid = ( low + high ) / 2 ; if ( value ( mid , x ) > value ( mid + 1 , x ) ) low = mid + 1 ; else high = mid - 1 ; } return value ( low , x ) ; } } ; public static void main ( String [ ] args ) { Line [ ] lines = { new Line ( 1 , 1 ) , new Line ( 0 , 0 ) , new Line ( - 3 , 3 ) } ; int Q [ ] = { - 2 , 2 , 0 } ; int n = 3 , q = 3 ; Convex_HULL_Trick cht = new Convex_HULL_Trick ( ) ; Arrays . sort ( lines ) ; for ( int i = 0 ; i < n ; i ++ ) cht . add ( lines [ i ] ) ; for ( int i = 0 ; i < q ; i ++ ) { int x = Q [ i ] ; System . out . println ( cht . minQuery ( x ) ) ; } } }

Index/key variables: i, n
Accumulator variables: i, n
Iterator variables: i
Class/struct names: Convex_HULL_Trick, GFG, Line
Java program:
import java . util . * ; class GFG { static boolean check ( int x , Vector pos , Vector neg , int k ) { int pairs = 0 ; int p = neg . size ( ) - 1 ; int nn = neg . size ( ) - 1 ; int pp = pos . size ( ) - 1 ; for ( int i = 0 ; i < neg . size ( ) ; i ++ ) { while ( ( p >= 0 ) && ( ( int ) neg . get ( i ) * ( int ) neg . get ( p ) <= x ) ) p -- ; pairs += Math . min ( nn - p , nn - i ) ; } p = 0 ; for ( int i = pos . size ( ) - 1 ; i >= 0 ; i -- ) { while ( ( p < pos . size ( ) ) && ( ( int ) pos . get ( i ) * ( int ) pos . get ( p ) <= x ) ) p ++ ; pairs += Math . min ( p , i ) ; } p = pos . size ( ) - 1 ; for ( int i = neg . size ( ) - 1 ; i >= 0 ; i -- ) { while ( ( p >= 0 ) && ( ( int ) neg . get ( i ) * ( int ) pos . get ( p ) <= x ) ) p -- ; pairs += pp - p ; } return ( pairs >= k ) ; } static int kth_element ( int a [ ] , int n , int k ) { Vector pos = new Vector ( ) ; Vector neg = new Vector ( ) ; ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] >= 0 ) pos . add ( a [ i ] ) ; else neg . add ( a [ i ] ) ; } sort ( pos . begin ( ) , pos . end ( ) ) ; sort ( neg . begin ( ) , neg . end ( ) ) ; Collections . sort ( pos ) ; Collections . sort ( neg ) ; int l = ( int ) - 1e8 , ans = 0 , r = ( int ) 1e8 ; while ( l <= r ) { int mid = ( l + r ) >> 1 ; if ( check ( mid , pos , neg , k ) ) { ans = mid ; r = mid - 1 ; } else l = mid + 1 ; } return ans ; } public static void main ( String [ ] args ) { int a [ ] = { - 4 , - 2 , 3 , 3 } , k = 3 ; int n = a . length ; System . out . println ( kth_element ( a , n , k ) ) ; } }

Index/key variables: i
Accumulator variables: i, p, pairs
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static double squareRoot ( double n , double l ) { double x = n ; double root ; int count = 0 ; while ( true ) { count ++ ; root = 0.5 * ( x + ( n / x ) ) ; if ( Math . abs ( root - x ) < l ) break ; x = root ; } return root ; } public static void main ( String [ ] args ) { double n = 327 ; double l = 0.00001 ; System . out . println ( squareRoot ( n , l ) ) ; } }

Accumulator variables: count
Class/struct names: GFG
Java program:
class GFG { static int MAX = 100000 ; static int sequence [ ] = new int [ MAX + 1 ] ; static void vanEckSequence ( ) { for ( int i = 0 ; i < MAX ; i ++ ) { sequence [ i ] = 0 ; } for ( int i = 0 ; i < MAX ; i ++ ) { for ( int j = i - 1 ; j >= 0 ; j -- ) { if ( sequence [ j ] == sequence [ i ] ) { sequence [ i + 1 ] = i - j ; break ; } } } } static int getCount ( int n ) { int nthTerm = sequence [ n - 1 ] ; int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( sequence [ i ] == nthTerm ) count ++ ; } return count ; } public static void main ( String [ ] args ) { vanEckSequence ( ) ; int n = 5 ; System . out . println ( getCount ( n ) ) ; n = 11 ; System . out . println ( getCount ( n ) ) ; } }

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static int MAX = 100000 ; static int sequence [ ] = new int [ MAX + 1 ] ; static void vanEckSequence ( ) { for ( int i = 0 ; i < MAX ; i ++ ) { sequence [ i ] = 0 ; } for ( int i = 0 ; i < MAX ; i ++ ) { for ( int j = i - 1 ; j >= 0 ; j -- ) { if ( sequence [ j ] == sequence [ i ] ) { sequence [ i + 1 ] = i - j ; break ; } } } } static int getCount ( int n ) { int count = 1 ; int i = n - 1 ; while ( sequence [ i + 1 ] != 0 ) { count ++ ; i = i - sequence [ i + 1 ] ; } return count ; } public static void main ( String [ ] args ) { vanEckSequence ( ) ; int n = 5 ; System . out . println ( getCount ( n ) ) ; n = 11 ; System . out . println ( getCount ( n ) ) ; } }

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static void remainingTime ( int h , int m ) { int totalMin , hoursRemaining , minRemaining ; totalMin = 1440 - 60 * h - m ; hoursRemaining = totalMin / 60 ; minRemaining = totalMin % 60 ; System . out . print ( hoursRemaining + " : : " + minRemaining + "NEW_LINE"); } public static void main ( String [ ] args ) { int h = 0 , m = 1 ; remainingTime ( h , m ) ; } }

Class/struct names: GFG
Java program:
class GFG { static void check ( int n ) { if ( n % 2 == 1 && n > 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } public static void main ( String [ ] args ) { int a = 3 ; int b = 7 ; check ( a ) ; check ( b ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static long [ ] factorial = new long [ 1000005 ] ; static long [ ] modinverse = new long [ 1000005 ] ; static long mod = 1000000007 ; static int N = 1000005 ; static long power ( long a , long m1 ) { if ( m1 == 0 ) return 1 ; else if ( m1 == 1 ) return a ; else if ( m1 == 2 ) return ( a * a ) % mod ; else if ( ( m1 & 1 ) != 0 ) return ( a * power ( power ( a , m1 / 2 ) , 2 ) ) % mod ; else return power ( power ( a , m1 / 2 ) , 2 ) % mod ; } static void factorialfun ( ) { factorial [ 0 ] = 1 ; for ( int i = 1 ; i < N ; i ++ ) factorial [ i ] = ( factorial [ i - 1 ] * i ) % mod ; } static void modinversefun ( ) { modinverse [ N - 1 ] = power ( factorial [ N - 1 ] , mod - 2 ) % mod ; for ( int i = N - 2 ; i >= 0 ; i -- ) modinverse [ i ] = ( modinverse [ i + 1 ] * ( i + 1 ) ) % mod ; } static long binomial ( int n , int r ) { if ( r > n ) return 0 ; long a = ( factorial [ n ] * modinverse [ n - r ] ) % mod ; a = ( a * modinverse [ r ] ) % mod ; return a ; } static long ways ( long x , long y ) { factorialfun ( ) ; modinversefun ( ) ; if ( ( 2 * x - y ) % 3 == 0 && ( 2 * y - x ) % 3 == 0 ) { long m = ( 2 * x - y ) / 3 ; long n = ( 2 * y - x ) / 3 ; System . out . println ( n + m + " ▁ " + n ) ; return binomial ( ( int ) ( n + m ) , ( int ) n ) ; } return 0 ; } public static void main ( String [ ] args ) { long x = 3 , y = 3 ; System . out . println ( ways ( x , y ) ) ; } }

Index/key variables: i, n, r
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static String solve ( int n , char x , char y ) { int length = ( int ) Math . ceil ( Math . log ( n + 2 ) / Math . log ( 2 ) ) - 1 ; int rank = n - ( 1 << length ) + 1 ; String left = " " , right = " " ; for ( int i = length - 1 ; i >= 0 ; i -- ) { int mask = ( 1 << i ) ; int bit = mask & rank ; if ( bit > 0 ) { left += y ; right += y ; } else { left += x ; right += x ; } } StringBuilder sb = new StringBuilder ( right ) ; sb . reverse ( ) ; right = sb . toString ( ) ; String res = left + right ; return res ; } public static void main ( String [ ] args ) { int n = 23 ; char x = '4' , y = '5' ; String ans = solve ( n , x , y ) ; System . out . println ( ans ) ; } }

Accumulator variables: i, left, right
Iterator variables: i
Class/struct names: GFG