dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
import java . util . * ; class GFG { static int SubArrayProdct ( int arr [ ] , int n ) { int result = 1 ; for ( int i = 0 ; i < n ; i ++ ) result *= Math . pow ( arr [ i ] , ( i + 1 ) * ( n - i ) ) ; return result ; } public static void main ( String [ ] args ) { int arr [ ] = new int [ ] { 2 , 4 } ; int N = arr . length ; System . out . println ( SubArrayProdct ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: i, result
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { public static int nCr ( int n , int r ) { return fact ( n ) / ( fact ( r ) * fact ( n - r ) ) ; } public static int fact ( int n ) { int res = 1 ; for ( int i = 2 ; i <= n ; i ++ ) res = res * i ; return res ; } public static int countWays ( int m , int n , int x , int y ) { return nCr ( m + n , m ) - nCr ( x + y , x ) * nCr ( m + n - x - y , m - x ) ; } public static void main ( String [ ] args ) { int m = 5 ; int n = 4 ; int x = 3 ; int y = 2 ; System . out . println ( countWays ( m , n , x , y ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int CountGreater ( int n , int k ) { int a = 0 ; while ( n > 0 ) { if ( ( n % 10 ) > k ) { a ++ ; } n = n / 10 ; } return a ; } static void PrintList ( List < Integer > ans ) { for ( int it : ans ) System . out . print ( it ) ; } static void getNumber ( int n , int k ) { int count = CountGreater ( n , k ) ; if ( count == 0 ) { System . out . print ( n ) ; return ; } List < Integer > ans = new LinkedList < > ( ) ; boolean changed = false ; while ( n > 0 ) { int digit = n % 10 ; if ( changed == true ) { ans . add ( 0 , digit ) ; } else { if ( count == 0 && digit < k ) { ans . add ( 0 , digit + 1 ) ; changed = true ; } else { ans . add ( 0 , 1 ) ; if ( digit > k ) { count -- ; } } } n = n / 10 ; } if ( changed == false ) { ans . add ( 0 , 1 ) ; } PrintList ( ans ) ; return ; } public static void main ( String [ ] args ) { int N = 51234 ; int K = 4 ; getNumber ( N , K ) ; } }

Accumulator variables: a, count
Iterator variables: it
Boolean variables: changed
Class/struct names: GFG
Java program:
class GFG { static int averageRuns ( int runs , int matches , int notout ) { int out = matches - notout ; if ( out == 0 ) return - 1 ; int avg = ( runs ) / out ; return avg ; } public static void main ( String [ ] args ) { int runs = 10000 ; int matches = 250 ; int notout = 50 ; int avg = averageRuns ( runs , matches , notout ) ; if ( avg == - 1 ) System . out . print ( " NA " ) ; else System . out . print ( avg ) ; } }

Class/struct names: GFG
Java program:
class GFG { static int seriesSumUtil ( int k , int n , int prevSum , int multi , int add ) { if ( k == n + 1 ) { return prevSum ; } multi = multi * k ; add = add + k ; prevSum = prevSum + multi - add ; return seriesSumUtil ( k + 1 , n , prevSum , multi , add ) ; } static int seriesSum ( int n ) { if ( n == 1 ) return 0 ; int prevSum = 0 ; int multi = 1 ; int add = 1 ; return seriesSumUtil ( 2 , n , prevSum , multi , add ) ; } public static void main ( String [ ] args ) { int N = 5 ; System . out . println ( seriesSum ( N ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static void solve ( int N ) { int ans = 0 ; while ( N != 0 ) { ans += N ; N /= 2 ; } System . out . println ( ans ) ; } public static void main ( String [ ] args ) { int N = 5 ; solve ( N ) ; } }

Accumulator variables: N, ans
Class/struct names: GFG
Java program:
class GFG { static int maximumAND ( int L , int R ) { return R ; } public static void main ( String [ ] args ) { int l = 3 ; int r = 7 ; System . out . print ( maximumAND ( l , r ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean oddSum ( int [ ] A , int N , int K ) { HashSet < Integer > Odd = new HashSet < Integer > ( ) ; HashSet < Integer > Even = new HashSet < Integer > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( A [ i ] % 2 == 0 ) { Even . add ( A [ i ] ) ; } else { Odd . add ( A [ i ] ) ; } } if ( Odd . size ( ) >= K ) return true ; boolean flag = false ; for ( int i = 1 ; i < K ; i += 2 ) { int needed = K - i ; if ( needed <= Even . size ( ) ) { return true ; } } return flag ; } public static void main ( String [ ] args ) { int K = 5 ; int [ ] A = { 12 , 1 , 7 , 7 , 26 , 18 } ; int N = 3 ; if ( oddSum ( A , N , K ) ) System . out . print ( " YES " ) ; else System . out . print ( " NO " ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Boolean variables: flag
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int countEle ( int a [ ] , int n ) { int len = 0 ; HashMap < Integer , Integer > hmap = new HashMap < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { len = Math . max ( len , a [ i ] ) ; if ( hmap . containsKey ( a [ i ] ) ) { hmap . put ( a [ i ] , hmap . get ( a [ i ] ) + 1 ) ; } else { hmap . put ( a [ i ] , 1 ) ; } } boolean [ ] v = new boolean [ len + 1 ] ; for ( int i = 0 ; i <= len ; i ++ ) { v [ i ] = true ; } for ( int i = 0 ; i < n ; i ++ ) { if ( v [ a [ i ] ] == false ) continue ; for ( int j = 2 * a [ i ] ; j <= len ; j += a [ i ] ) { v [ j ] = false ; } } int count = 0 ; for ( int i = 1 ; i <= len ; i ++ ) { if ( v [ i ] == true && hmap . containsKey ( i ) && hmap . get ( i ) == 1 && hmap . get ( i ) == 1 ) { count += 1 ; } } return count ; } public static void main ( String [ ] args ) { int arr [ ] = { 86 , 45 , 18 , 4 , 8 , 28 , 19 , 33 , 2 } ; int n = arr . length ; System . out . print ( countEle ( 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 void smallestNumber ( int N ) { int L = ( int ) ( Math . pow ( 10 , N ) - 1 ) ; int S = ( int ) Math . pow ( 10 , N - 1 ) ; for ( int i = S ; i <= L ; i ++ ) { if ( i % N == 0 ) { System . out . print ( i ) ; return ; } } } public static void main ( String [ ] args ) { int N = 2 ; smallestNumber ( N ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int maxPrimefactorNum ( int N ) { int [ ] arr = new int [ N + 1 ] ; for ( int i = 0 ; i < N + 1 ; i ++ ) arr [ i ] = 1 ; for ( int i = 2 ; i <= N ; i ++ ) { if ( arr [ i ] == 1 ) { for ( int j = i ; j <= N ; j += i ) { arr [ j ] *= i ; } } } int maxValue = 1 ; for ( int i = 2 ; i <= N ; i ++ ) { if ( arr [ i ] > maxValue ) { maxValue = i ; } } return maxValue ; } public static void main ( String [ ] args ) { int N = 20 ; System . out . print ( maxPrimefactorNum ( N ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static void spf_array ( int spf [ ] ) { spf [ 1 ] = 1 ; for ( int i = 2 ; i < 1000 ; i ++ ) spf [ i ] = i ; for ( int i = 4 ; i < 1000 ; i += 2 ) spf [ i ] = 2 ; for ( int i = 3 ; i * i < 1000 ; i ++ ) { if ( spf [ i ] == i ) { for ( int j = i * i ; j < 1000 ; j += i ) if ( spf [ j ] == j ) spf [ j ] = i ; } } } static int minimum_operation ( int b [ ] , int d , int spf [ ] ) { Map < Integer , Integer > m = new HashMap < > ( ) ; int i = 0 ; int c = 0 ; for ( i = 0 ; i < d ; i ++ ) { int x = b [ i ] ; while ( x != 1 ) { x = x / spf [ x ] ; if ( m . get ( spf [ x ] ) == null ) { m . put ( spf [ x ] , 1 ) ; } } } m . remove ( 1 ) ; for ( Map . Entry < Integer , Integer > x : m . entrySet ( ) ) { int e = 0 , o = 0 ; int j = x . getKey ( ) ; for ( i = 0 ; i < d ; i ++ ) { if ( b [ i ] % j == 0 ) { int h = 0 ; int g = b [ i ] ; while ( g != 0 ) { if ( g % j != 0 ) { break ; } g = g / j ; h = h + 1 ; } if ( h % 2 == 0 ) { e = e + 1 ; } else { o = o + 1 ; } } else { e = e + 1 ; } } c = c + Math . min ( o , e ) ; } return c ; } public static void main ( String [ ] args ) { int [ ] spf = new int [ 1001 ] ; int b [ ] = { 1 , 4 , 6 } ; int d = b . length ; spf_array ( spf ) ; System . out . print ( minimum_operation ( b , d , spf ) ) ; } }

Index/key variables: i, j, x
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static int getProduct ( int n ) { int product = 1 ; while ( n != 0 ) { product = product * ( n % 10 ) ; n = n / 10 ; } return product ; } static boolean isZuckerman ( int n ) { return n % getProduct ( n ) == 0 ; } public static void main ( String [ ] args ) { int n = 115 ; if ( isZuckerman ( n ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }

Class/struct names: GFG
Java program:
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 = i + 6 ) if ( n % i == 0 || n % ( i + 2 ) == 0 ) return false ; return true ; } static int getSum ( int n ) { int sum = 0 ; while ( n != 0 ) { sum = sum + n % 10 ; n = n / 10 ; } return sum ; } static boolean isAdditivePrime ( int n ) { if ( ! isPrime ( n ) ) return false ; return isPrime ( getSum ( n ) ) ; } public static void main ( String [ ] args ) { int n = 23 ; if ( isAdditivePrime ( n ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static boolean isStraighLineNum ( int N ) { if ( N <= 99 ) return false ; String s = Integer . toString ( N ) ; int d = s . charAt ( 1 ) - s . charAt ( 0 ) ; for ( int i = 2 ; i < s . length ( ) ; i ++ ) if ( s . charAt ( i ) - s . charAt ( i - 1 ) != d ) return false ; return true ; } public static void main ( String [ ] args ) { int n = 135 ; if ( isStraighLineNum ( n ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void findNthTerm ( int n ) { System . out . println ( Math . pow ( 2 , n ) - 2 * n ) ; } public static void main ( String [ ] args ) { int N = 4 ; findNthTerm ( N ) ; } }

Class/struct names: GFG
Java program:
class GFG { static boolean isEvenOddForm ( String s ) { int n = s . length ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( i % 2 == 0 && s . charAt ( i ) % 2 != 0 ) return false ; if ( i % 2 == 1 && s . charAt ( i ) % 2 != 1 ) return false ; } return true ; } static boolean isOddEvenForm ( String s ) { int n = s . length ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( i % 2 == 0 && s . charAt ( i ) % 2 != 1 ) return false ; if ( i % 2 == 1 && s . charAt ( i ) % 2 != 0 ) return false ; } return true ; } static boolean isAlternating ( int n ) { String str = Integer . toString ( n ) ; return ( isEvenOddForm ( str ) || isOddEvenForm ( str ) ) ; } public static void main ( String [ ] args ) { int N = 129 ; if ( isAlternating ( N ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

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 = i + 6 ) if ( n % i == 0 || n % ( i + 2 ) == 0 ) return false ; return true ; } static int TEN = 10 ; static void updateFreq ( int n , int freq [ ] ) { while ( n > 0 ) { int digit = n % TEN ; freq [ digit ] ++ ; n /= TEN ; } } static boolean areAnagrams ( int a , int b ) { int freqA [ ] = new int [ TEN ] ; int freqB [ ] = new int [ TEN ] ; updateFreq ( a , freqA ) ; updateFreq ( b , freqB ) ; for ( int i = 0 ; i < TEN ; i ++ ) { if ( freqA [ i ] != freqB [ i ] ) return false ; } return true ; } static boolean OrmistonPrime ( int n1 , int n2 ) { return ( isPrime ( n1 ) && isPrime ( n2 ) && areAnagrams ( n1 , n2 ) ) ; } public static void main ( String [ ] args ) { int n1 = 1913 , n2 = 1931 ; if ( OrmistonPrime ( n1 , n2 ) ) System . out . print ( " YES " + "NEW_LINE"); else System . out . print ( " NO " + "NEW_LINE"); } }

Index/key variables: TEN, digit, i
Accumulator variables: i, n
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int DecakismyriagonNum ( int N ) { return ( 99998 * N * N - 99996 * N ) / 2 ; } public static void main ( String [ ] args ) { int N = 3 ; System . out . println ( DecakismyriagonNum ( N ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static int divSum ( int num ) { int result = 0 ; for ( int i = 2 ; i <= Math . sqrt ( num ) ; i ++ ) { if ( num % i == 0 ) { if ( i == ( num / i ) ) result += i ; else result += ( i + num / i ) ; } } return ( result + 1 ) ; } static boolean isUntouchable ( int n ) { for ( int i = 1 ; i <= 2 * n ; i ++ ) { if ( divSum ( i ) == n ) return false ; } return true ; } public static void main ( String [ ] args ) { int n = 52 ; if ( isUntouchable ( n ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Accumulator variables: i, result
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static boolean iszygodromeNum ( int N ) { String s = Integer . toString ( N ) ; s = ' ▁ ' + s + ' ▁ ' ; for ( int i = 1 ; i < s . length ( ) - 1 ; i ++ ) { if ( s . charAt ( i ) != s . charAt ( i - 1 ) && s . charAt ( i ) != s . charAt ( i + 1 ) ) { return false ; } } return true ; } public static void main ( String [ ] args ) { int n = 1122 ; if ( iszygodromeNum ( n ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static boolean isLoeschian ( int n ) { for ( int x = 1 ; x <= Math . sqrt ( n ) ; x ++ ) { for ( int y = 1 ; y <= Math . sqrt ( n ) ; y ++ ) { if ( x * x + x * y + y * y == n ) return true ; } } return false ; } public static void main ( String [ ] args ) { int n = 19 ; if ( isLoeschian ( n ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }

Accumulator variables: x, y
Iterator variables: x, y
Class/struct names: GFG
Java program:
class GFG { static int divSum ( int n ) { int result = 0 ; for ( int i = 2 ; i <= Math . sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { if ( i == ( n / i ) ) result += i ; else result += ( i + n / i ) ; } } return ( result + n + 1 ) ; } static boolean check ( int num ) { int sigmaN = divSum ( num ) ; for ( int i = 2 ; i <= Math . sqrt ( num ) ; i ++ ) { if ( num % i == 0 ) { if ( i == ( num / i ) ) { if ( sigmaN - 2 * i == 2 * num ) return true ; } else { if ( sigmaN - 2 * i == 2 * num ) return true ; if ( sigmaN - 2 * ( num / i ) == 2 * num ) return true ; } } } if ( sigmaN - 2 * 1 == 2 * num ) return true ; return false ; } static boolean isAdmirableNum ( int N ) { return check ( N ) ; } public static void main ( String [ ] args ) { int n = 12 ; if ( isAdmirableNum ( n ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Accumulator variables: i, result
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void printSeries ( int N ) { int ith_term = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { ith_term = ( 13 * i * ( i - 1 ) ) / 2 + 2 ; System . out . print ( ith_term + " , ▁ " ) ; } } public static void main ( String [ ] args ) { int N = 7 ; printSeries ( N ) ; } }

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 Vector < pair > Pairs ( int C ) { Vector < pair > ans = new Vector < pair > ( ) ; for ( int i = 1 ; i < C ; i ++ ) { for ( int j = i + 1 ; j < C ; j ++ ) { if ( ( i * i ) + ( j * j ) == ( C * C ) ) { ans . add ( new pair ( i , j ) ) ; } } } return ans ; } public static void main ( String [ ] args ) { int C = 13 ; Vector < pair > ans = Pairs ( C ) ; if ( ans . size ( ) == 0 ) { System . out . print ( " No ▁ valid ▁ pair ▁ " + " exist " + "NEW_LINE"); return ; } for ( pair i : ans ) { System . out . print ( " ( " + i . first + " , ▁ " + i . second + " ) " + "NEW_LINE"); } } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG, pair
Java program:
class GFG { static float strikerate ( float bowls , float runs ) { float z ; z = ( runs / bowls ) * 100 ; return z ; } public static void main ( String [ ] args ) { int A , B ; A = 264 ; B = 173 ; System . out . println ( strikerate ( B , A ) ) ; } }

Class/struct names: GFG
Java program:
import java . lang . Math ; class GFG { public static int factorize ( int N ) { int count = 0 ; int cnt = 0 ; while ( ( N % 2 ) == 0 ) { N = N / 2 ; count ++ ; } cnt = cnt + count ; for ( int i = 3 ; i <= Math . sqrt ( N ) ; i += 2 ) { count = 0 ; while ( N % i == 0 ) { count ++ ; N = N / i ; } cnt = cnt + count ; } if ( N > 2 ) cnt = cnt + 1 ; return cnt ; } public static void ifNumberExists ( int X , int Y ) { int C , dsum ; C = X - Y - 1 ; dsum = factorize ( X ) ; if ( dsum >= C ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } public static void main ( String [ ] args ) { int X , Y ; X = 6 ; Y = 4 ; ifNumberExists ( X , Y ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static final int max = 10000000 ; static boolean [ ] prime = new boolean [ max ] ; static void SieveOfEratosthenes ( int maxm ) { prime [ 0 ] = prime [ 1 ] = true ; for ( int i = 2 ; i * i <= maxm ; i ++ ) { if ( ! prime [ i ] ) { for ( int j = i * i ; j <= maxm ; j += i ) { prime [ j ] = true ; } } } } static void print_nearest_prime ( int arr [ ] , int N ) { int maxm = Arrays . stream ( arr ) . max ( ) . getAsInt ( ) ; SieveOfEratosthenes ( maxm ) ; Vector < Integer > primes = new Vector < Integer > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( ! prime [ arr [ i ] ] ) primes . add ( i ) ; } if ( primes . size ( ) == 0 ) { for ( int i = 0 ; i < N ; i ++ ) { System . out . print ( - 1 + " ▁ " ) ; } return ; } int curr = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( curr == primes . size ( ) - 1 || i <= primes . get ( curr ) ) { System . out . print ( arr [ primes . get ( curr ) ] + " ▁ " ) ; continue ; } if ( Math . abs ( primes . get ( curr ) - i ) < Math . abs ( primes . get ( curr + 1 ) - i ) ) { System . out . print ( arr [ primes . get ( curr ) ] + " ▁ " ) ; } else { curr ++ ; System . out . print ( arr [ primes . get ( curr ) ] + " ▁ " ) ; } } } public static void main ( String [ ] args ) { int N = 6 ; int arr [ ] = { 8 , 7 , 12 , 15 , 3 , 11 } ; print_nearest_prime ( arr , N ) ; } }

Index/key variables: i, j, max
Accumulator variables: curr, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void findPosition ( int n ) { int i = 0 ; int pos = 0 ; while ( n > 0 ) { if ( n % 10 == 7 ) { pos = pos + ( int ) Math . pow ( 2 , i + 1 ) ; } else { pos = pos + ( int ) Math . pow ( 2 , i ) ; } i ++ ; n = n / 10 ; } System . out . print ( pos ) ; } public static void main ( String [ ] args ) { int N = 777 ; findPosition ( N ) ; } }

Accumulator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static String findNumberL ( int n ) { if ( n == 1 ) return "1" ; String result = " " ; int length = ( int ) Math . floor ( Math . log10 ( n ) + 1 ) ; for ( int i = 1 ; i <= n - ( 2 * length ) ; i ++ ) { result += '9' ; } result = Integer . toString ( n ) + result + Integer . toString ( n ) ; return result ; } static String findNumberS ( int n ) { if ( n == 1 ) return "1" ; String result = " " ; int length = ( int ) Math . floor ( Math . log10 ( n ) + 1 ) ; for ( int i = 1 ; i <= n - ( 2 * length ) ; i ++ ) { result += '0' ; } result = Integer . toString ( n ) + result + Integer . toString ( n ) ; return result ; } public static void main ( String [ ] args ) { int N = 3 ; System . out . println ( " Smallest ▁ Number ▁ = ▁ " + findNumberS ( N ) ) ; System . out . print ( " Largest ▁ Number ▁ = ▁ " + findNumberL ( N ) ) ; } }

Accumulator variables: i, result
Iterator variables: i
Class/struct names: GFG
Java program:
public class geeks { public static int canReplace ( int [ ] array ) { int i = 0 , count = 0 ; while ( i < array . length ) { if ( array [ i ] == 0 && ( i == 0 array [ i - 1 ] == 0 ) && ( i == array . length - 1 array [ i + 1 ] == 0 ) ) { array [ i ] = 1 ; count ++ ; } i ++ ; } return count ; } public static void main ( String [ ] args ) { int [ ] array = { 1 , 0 , 0 , 0 , 1 } ; System . out . println ( canReplace ( array ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Class/struct names: geeks
Java program:
class GFG { static int sum_star_num ( int n ) { int summ = 2 * n * ( n + 1 ) * ( n - 1 ) + n ; return summ ; } public static void main ( String [ ] args ) { int n = 3 ; System . out . println ( sum_star_num ( n ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; import java . awt . * ; class GFG { static void solve ( int n , ArrayList < Point > vec ) { ArrayList < Integer > a = new ArrayList < > ( ) ; ArrayList < Integer > b = new ArrayList < > ( ) ; for ( Point pr : vec ) { a . add ( pr . x ) ; b . add ( pr . y ) ; } Collections . sort ( a ) ; Collections . sort ( b ) ; int left , right , ans ; if ( ( n & 1 ) != 0 ) { left = a . get ( n / 2 ) ; right = b . get ( n / 2 ) ; ans = right - left + 1 ; } else { left = ( a . get ( n / 2 ) + a . get ( n / 2 - 1 ) ) ; right = ( b . get ( n / 2 ) + b . get ( n / 2 - 1 ) ) ; ans = right - left + 1 ; } System . out . println ( ans ) ; } public static void main ( String [ ] args ) { int N = 3 ; ArrayList < Point > vec = new ArrayList < > ( ) ; vec . add ( new Point ( 100 , 100 ) ) ; vec . add ( new Point ( 10 , 10000 ) ) ; vec . add ( new Point ( 1 , 1000000000 ) ) ; solve ( N , vec ) ; } }

Iterator variables: pr
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static HashMap < Integer , Integer > mp = new HashMap < Integer , Integer > ( ) ; static int find_pairs ( int arr [ ] , int n ) { int ans = 0 ; 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 ) ; } } for ( Map . Entry < Integer , Integer > i : mp . entrySet ( ) ) { int count = i . getValue ( ) ; if ( count > 1 ) { ans += ( ( count * ( count - 1 ) ) / 2 ) ; } } return ans ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 , 3 , 3 , 4 , 5 , 5 , 7 , 8 } ; int arr_size = arr . length ; System . out . print ( find_pairs ( arr , arr_size ) ) ; } }

Index/key variables: i
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int gonNum360 ( int n ) { return ( 358 * n * n - 356 * n ) / 2 ; } public static void main ( String [ ] args ) { int n = 3 ; System . out . print ( gonNum360 ( n ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static int gonNum120 ( int n ) { return ( 118 * n * n - 116 * n ) / 2 ; } public static void main ( String [ ] args ) { int n = 3 ; System . out . print ( gonNum120 ( n ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static int TetracontaoctagonalNum ( int n ) { return ( 46 * n * n - 44 * n ) / 2 ; } public static void main ( String [ ] args ) { int n = 3 ; System . out . print ( TetracontaoctagonalNum ( n ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static int gonNum257 ( int n ) { return ( 255 * n * n - 253 * n ) / 2 ; } public static void main ( String [ ] args ) { int n = 3 ; System . out . print ( gonNum257 ( n ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int TetracontadigonalNum ( int n ) { return ( 40 * n * n - 38 * n ) / 2 ; } public static void main ( String [ ] args ) { int n = 3 ; System . out . print ( TetracontadigonalNum ( n ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static double findIndex ( int n ) { double x = Math . sqrt ( 2 * Math . pow ( 10 , ( n - 1 ) ) ) ; return Math . round ( x ) ; } public static void main ( String [ ] args ) { int n = 3 ; System . out . print ( findIndex ( n ) ) ; } }

Class/struct names: GFG