dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
import java . io . * ; class GFG { static void findsolution ( long n , long x , long y ) { if ( ( y - n + 1 ) * ( y - n + 1 ) + n - 1 < x y < n ) { System . out . println ( " No ▁ solution " ) ; return ; } System . out . println ( y - n + 1 ) ; while ( n -- > 1 ) System . out . println ( "1" ) ; } public static void main ( String [ ] args ) { long n , x , y ; n = 5 ; x = 15 ; y = 15 ; findsolution ( n , x , y ) ; } }

Accumulator variables: n
Class/struct names: GFG
Java program:
import java . util . * ; import java . lang . * ; import java . io . * ; class GFG { static int findPosition ( int n , int f , int b ) { return n - Math . max ( f + 1 , n - b ) + 1 ; } public static void main ( String args [ ] ) { int n = 5 , f = 2 , b = 3 ; System . out . print ( findPosition ( n , f , b ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static int nthOdd ( int n ) { return ( 2 * n - 1 ) ; } public static void main ( String [ ] args ) { int n = 10 ; System . out . println ( nthOdd ( n ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static int nthEven ( int n ) { return ( 2 * n ) ; } public static void main ( String [ ] args ) { int n = 10 ; System . out . println ( nthEven ( n ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int nthTerm ( int n ) { return 2 * ( int ) Math . pow ( n , 2 ) + n - 3 ; } public static void main ( String [ ] args ) { int N = 4 ; System . out . println ( nthTerm ( N ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class solution { static int nthTerm ( int n ) { return 5 * ( int ) Math . pow ( n , 2 ) - 5 * n ; } public static void main ( String arr [ ] ) { int N = 4 ; System . out . println ( nthTerm ( N ) ) ; } }

Class/struct names: solution
Java program:
import java . util . * ; class solution { static int nthTerm ( int n ) { return 3 * ( int ) Math . pow ( n , 2 ) + n - 2 ; } public static void main ( String arr [ ] ) { int N = 4 ; System . out . println ( nthTerm ( N ) ) ; } }

Class/struct names: solution
Java program:
import java . util . * ; class solution { static int nthTerm ( int n ) { return 2 * ( int ) Math . pow ( n , 2 ) + 4 * n - 2 ; } public static void main ( String arr [ ] ) { int N = 4 ; System . out . println ( nthTerm ( N ) ) ; } }

Class/struct names: solution
Java program:
import java . io . * ; class GFG { static int nthTerm ( int n ) { return 3 * ( int ) Math . pow ( n , 2 ) + 2 * n - 5 ; } public static void main ( String [ ] args ) { int N = 4 ; System . out . println ( nthTerm ( N ) ) ; } }

Class/struct names: GFG
Java program:
public class GFG { static int nthTerm ( int n ) { return 2 * ( int ) Math . pow ( n , 2 ) + 3 * n - 5 ; } public static void main ( String args [ ] ) { int N = 4 ; System . out . println ( nthTerm ( N ) ) ; } }

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

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static double PI = 3.1415926535 ; static double findAnglesA ( double a , double b , double c ) { double A = Math . acos ( ( b * b + c * c - a * a ) / ( 2 * b * c ) ) ; return A * 180 / PI ; } static double findAnglesB ( double a , double b , double c ) { double B = Math . acos ( ( a * a + c * c - b * b ) / ( 2 * a * c ) ) ; return B * 180 / PI ; } static void printAngles ( int a , int b , int c ) { double x = ( double ) a ; double y = ( double ) b ; double z = ( double ) c ; double A = findAnglesA ( x , y , z ) ; double B = findAnglesB ( x , y , z ) ; System . out . println ( " Angles ▁ are ▁ A ▁ = ▁ " + A + " , ▁ B ▁ = ▁ " + B + " , ▁ C ▁ = ▁ " + 90 ) ; } static void printOtherSides ( int n ) { int b = 0 , c = 0 ; if ( ( n & 1 ) > 0 ) { if ( n == 1 ) System . out . println ( - 1 ) ; else { b = ( n * n - 1 ) / 2 ; c = ( n * n + 1 ) / 2 ; System . out . println ( " Side ▁ b ▁ = ▁ " + b + " , ▁ Side ▁ c ▁ = ▁ " + c ) ; } } else { if ( n == 2 ) System . out . println ( - 1 ) ; else { b = n * n / 4 - 1 ; c = n * n / 4 + 1 ; System . out . println ( " Side ▁ b ▁ = ▁ " + b + " , ▁ Side ▁ c ▁ = ▁ " + c ) ; } } printAngles ( n , b , c ) ; } public static void main ( String [ ] args ) { int a = 12 ; printOtherSides ( a ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; import java . lang . * ; import java . io . * ; class GFG { static int calculateSum ( int n ) { return n * ( n + 1 ) / 2 + n * ( n + 1 ) * ( 2 * n + 1 ) / 6 ; } public static void main ( String args [ ] ) { int n = 3 ; System . out . print ( " Sum ▁ = ▁ " + calculateSum ( n ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class solution { static int nthTerm ( int n ) { return 2 * ( int ) Math . pow ( n , 2 ) - n - 1 ; } public static void main ( String arr [ ] ) { int N = 4 ; System . out . println ( nthTerm ( N ) ) ; } }

Class/struct names: solution
Java program:
import java . util . * ; import java . lang . * ; import java . io . * ; class GFG { static int nthTerm ( int n ) { return 4 * ( int ) Math . pow ( n , 2 ) - 7 * n + 3 ; } public static void main ( String args [ ] ) { int N = 4 ; System . out . print ( nthTerm ( N ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static void checkIfPowerIsolated ( int num ) { int input = num ; int count = 0 ; int [ ] factor = new int [ num + 1 ] ; if ( num % 2 == 0 ) { while ( num % 2 == 0 ) { ++ count ; num /= 2 ; } factor [ 2 ] = count ; } for ( int i = 3 ; i * i <= num ; i += 2 ) { count = 0 ; while ( num % i == 0 ) { ++ count ; num /= i ; } if ( count > 0 ) factor [ i ] = count ; } if ( num > 1 ) factor [ num ] = 1 ; int product = 1 ; for ( int i = 0 ; i < num + 1 ; i ++ ) { if ( factor [ i ] > 0 ) product = product * factor [ i ] * i ; } if ( product == input ) System . out . print ( "Power-isolated IntegerNEW_LINE"); else System . out . print ( "Not a Power-isolated IntegerNEW_LINE"); } public static void main ( String [ ] args ) { checkIfPowerIsolated ( 12 ) ; checkIfPowerIsolated ( 18 ) ; checkIfPowerIsolated ( 35 ) ; } }

Index/key variables: i, num
Accumulator variables: i, num
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class solution { static long getNthTerm ( long N ) { return ( ( int ) Math . pow ( N , 2 ) + N + 1 ) ; } public static void main ( String arr [ ] ) { long N = 11 ; System . out . println ( getNthTerm ( N ) ) ; } }

Class/struct names: solution
Java program:
import java . lang . * ; import java . util . * ; class GFG { static long findSum ( int n ) { long sum2 , sum5 , sum10 ; sum2 = ( ( n / 2 ) * ( 4 + ( n / 2 - 1 ) * 2 ) ) / 2 ; sum5 = ( ( n / 5 ) * ( 10 + ( n / 5 - 1 ) * 5 ) ) / 2 ; sum10 = ( ( n / 10 ) * ( 20 + ( n / 10 - 1 ) * 10 ) ) / 2 ; return sum2 + sum5 - sum10 ; } public static void main ( String [ ] args ) { int n = 5 ; System . out . println ( findSum ( n ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; import java . lang . * ; import java . io . * ; 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 Vector < Vector < Integer > > v = new Vector < Vector < Integer > > ( ) ; static void factors ( int N ) { for ( int i = 2 ; i < N ; i ++ ) { for ( int j = 1 ; j * j <= i ; j ++ ) { if ( i % j == 0 ) { if ( i / j == j ) v . get ( i ) . add ( j ) ; else { v . get ( i ) . add ( j ) ; v . get ( i ) . add ( i / j ) ; } } } Collections . sort ( v . get ( i ) ) ; } } static int product ( int n ) { v . clear ( ) ; for ( int i = 0 ; i < n + 100 ; i ++ ) v . add ( new Vector < Integer > ( ) ) ; factors ( n + 100 ) ; if ( n % 4 == 0 ) { int x = n / 4 ; x *= x ; return x * x ; } else { if ( isPrime ( n ) ) return - 1 ; else { int ans = - 1 ; if ( v . get ( n ) . size ( ) > 2 ) { int fac = v . get ( n ) . get ( v . get ( n ) . size ( ) - 3 ) ; for ( int i = v . get ( n ) . size ( ) - 1 ; i >= 0 ; i -- ) { for ( int j = v . get ( n ) . size ( ) - 1 ; j >= 0 ; j -- ) { if ( ( fac * 2 ) + ( v . get ( n ) . get ( j ) + v . get ( n ) . get ( i ) ) == n ) ans = Math . max ( ans , fac * fac * v . get ( n ) . get ( j ) * v . get ( n ) . get ( i ) ) ; } } return ans ; } } } return 0 ; } public static void main ( String args [ ] ) { int n = 24 ; System . out . println ( product ( n ) ) ; } }

Accumulator variables: i, j, x
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . io . * ; class Nth { static float CalculateRatio ( float m , float n ) { return ( 2 * m - 1 ) / ( 2 * n - 1 ) ; } } class GFG { public static void main ( String [ ] args ) { float m = 6 , n = 2 ; Nth a = new Nth ( ) ; System . out . println ( a . CalculateRatio ( m , n ) ) ; } }

Class/struct names: GFG, Nth
Java program:
import java . io . * ; class GFG { static int calculateSum ( int n ) { return ( int ) Math . pow ( n * ( n + 1 ) / 2 , 2 ) ; } public static void main ( String [ ] args ) { int n = 4 ; System . out . println ( calculateSum ( n ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; import java . lang . * ; import java . io . * ; class GFG { static int digSum ( int n ) { if ( n == 0 ) return 0 ; return ( n % 9 == 0 ) ? 9 : ( n % 9 ) ; } static int powerDigitSum ( int a , int n ) { int res = 1 ; while ( n > 0 ) { if ( n % 2 == 1 ) { res = res * digSum ( a ) ; res = digSum ( res ) ; } a = digSum ( digSum ( a ) * digSum ( a ) ) ; n /= 2 ; } return res ; } public static void main ( String args [ ] ) { int a = 9 , n = 4 ; System . out . print ( powerDigitSum ( a , n ) ) ; } }

Accumulator variables: n
Class/struct names: GFG
Java program:
class GFG { static int totEdge ( int n ) { int result = 0 ; result = ( n * ( n - 1 ) ) / 2 ; return result ; } public static void main ( String [ ] args ) { int n = 6 ; System . out . println ( totEdge ( n ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int MAX = 1000005 ; static Vector < Boolean > prime = new Vector < > ( MAX ) ; static void vecIni ( ) { for ( int i = 0 ; i < MAX ; i ++ ) { prime . add ( i , true ) ; } } static void sieve ( int N ) { prime . add ( 0 , false ) ; prime . add ( 1 , false ) ; for ( int i = 2 ; i <= N ; i ++ ) { if ( prime . get ( i ) ) { for ( int j = 2 ; i * j <= N ; j ++ ) { prime . add ( i * j , false ) ; } } } } static int countLogNeeded ( int N ) { int count = 0 ; sieve ( N ) ; for ( int i = 1 ; i <= N ; i ++ ) { if ( prime . get ( i ) ) { count ++ ; } } return count ; } public static void main ( String [ ] args ) { vecIni ( ) ; int N = 6 ; System . out . println ( countLogNeeded ( N ) ) ; } }

Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int coin ( int totalRupees , int X , int Y , int Z ) { float one = 0 , fifty = 0 , twentyfive = 0 , result = 0 , total = 0 ; one = X * 1 ; fifty = ( ( Y * 1 ) / 2 ) ; twentyfive = ( ( Z * 1 ) / 4 ) ; total = one + fifty + twentyfive ; result = ( ( totalRupees ) / total ) ; return ( int ) result ; } public static void main ( String [ ] args ) { int totalRupees = 1800 ; int X = 1 , Y = 2 , Z = 4 ; int Rupees = coin ( totalRupees , X , Y , Z ) ; System . out . println ( "1 ▁ rupess ▁ coins ▁ = ▁ " + Rupees * 1 ) ; System . out . println ( "50 ▁ paisa ▁ coins ▁ = ▁ " + Rupees * 2 ) ; System . out . println ( "25 ▁ paisa ▁ coins ▁ = ▁ " + Rupees * 4 ) ; } }

Class/struct names: GFG
Java program:
public class GFG { static float sumOfSeries ( int x , int k ) { float y = ( float ) ( ( ( float ) ( x ) / 81 ) * ( 9 * k - 1 + Math . pow ( 10 , ( - 1 ) * k ) ) ) ; return y ; } public static void main ( String args [ ] ) { int x = 9 ; int k = 20 ; System . out . println ( sumOfSeries ( x , k ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; import java . lang . * ; import java . io . * ; class GFG { static void findfactors ( int n ) { HashMap < Integer , Integer > mpp = new HashMap < > ( ) ; Vector < Integer > v = new Vector < Integer > ( ) , v1 = new Vector < Integer > ( ) ; for ( int i = 1 ; i <= ( int ) Math . sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { v . add ( i ) ; if ( i != ( n / i ) && i != 1 ) v . add ( n / i ) ; } } int s = v . size ( ) ; int maxi = - 1 ; int mp1_first [ ] = new int [ n + 5 ] , mp1_second [ ] = new int [ n + 5 ] ; for ( int i = 0 ; i < s ; i ++ ) { for ( int j = i ; j < s ; j ++ ) { if ( v . get ( i ) + v . get ( j ) < n ) { v1 . add ( v . get ( i ) + v . get ( j ) ) ; mp1_first [ v . get ( i ) + v . get ( j ) ] = v . get ( i ) ; mp1_second [ v . get ( i ) + v . get ( j ) ] = v . get ( j ) ; mpp . put ( v . get ( i ) + v . get ( j ) , 1 ) ; } } } s = v1 . size ( ) ; for ( int i = 0 ; i < s ; i ++ ) { int el = n - ( v1 . get ( i ) ) ; if ( mpp . get ( el ) != null ) { int a = mp1_first [ v1 . get ( i ) ] ; int b = mp1_second [ v1 . get ( i ) ] ; int c = mp1_first [ n - v1 . get ( i ) ] ; int d = mp1_second [ n - v1 . get ( i ) ] ; maxi = Math . max ( a * b * c * d , maxi ) ; } } if ( maxi == - 1 ) System . out . println ( " Not ▁ Possible " ) ; else { System . out . println ( " The ▁ maximum ▁ product " + " ▁ is ▁ " + maxi ) ; } } public static void main ( String args [ ] ) { int n = 50 ; findfactors ( n ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . ArrayList ; import java . util . List ; public class GFG { static List < Integer > factors = new ArrayList < > ( 10 ) ; static void findFactors ( int n ) { for ( int i = 1 ; i * i <= n ; i ++ ) { if ( n % i == 0 ) { if ( ( n / i ) == i ) { factors . add ( factors . size ( ) , i ) ; } else { factors . add ( factors . size ( ) , n / i ) ; factors . add ( factors . size ( ) , i ) ; } } } } static int findProduct ( int n ) { int product = - 1 ; int si = factors . size ( ) ; for ( int i = 0 ; i < si ; i ++ ) { for ( int j = 0 ; j < si ; j ++ ) { for ( int k = 0 ; k < si ; k ++ ) { for ( int l = 0 ; l < si ; l ++ ) { int s = factors . get ( i ) + factors . get ( j ) + factors . get ( k ) + factors . get ( l ) ; if ( s == n ) { int p = factors . get ( i ) * factors . get ( j ) * factors . get ( k ) * factors . get ( l ) ; if ( p > product ) { product = p ; } } } } } } return product ; } public static void main ( String [ ] args ) { int n = 10 ; findFactors ( n ) ; System . out . println ( findProduct ( n ) ) ; } }

Accumulator variables: i, j, k, l
Iterator variables: i, j, k, l
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; import java . lang . * ; class GFG { static int modExp ( int a , int b ) { int result = 1 ; while ( b > 0 ) { if ( b == 1 ) result = result * a ; a = a * a ; b /= 2 ; } return result ; } static int check ( int num ) { if ( num == 1 num < 3 ) return - 1 ; else if ( num % 4 == 0 ) return modExp ( num / 4 , 4 ) ; else if ( num % 6 == 0 ) return modExp ( num / 3 , 2 ) * modExp ( num / 6 , 2 ) ; else if ( num % 10 == 0 ) return modExp ( num / 5 , 2 ) * ( num / 10 ) * ( num / 2 ) ; else return - 1 ; } public static void main ( String [ ] args ) { int num = 10 ; System . out . print ( check ( num ) ) ; } }

Accumulator variables: b
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static boolean isDivisible ( long n ) { while ( n / 100 > 0 ) { long d = n % 10 ; n /= 10 ; n -= d * 5 ; } return ( n % 17 == 0 ) ; } public static void main ( String [ ] args ) { long n = 19877658 ; if ( isDivisible ( n ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Accumulator variables: n
Class/struct names: GFG
Java program:
public class GFG { static int nextPowerOf2 ( int n ) { int count = 0 ; if ( n != 0 && ( n & ( n - 1 ) ) == 0 ) return n ; while ( n != 0 ) { n >>= 1 ; count += 1 ; } return 1 << count ; } static int removeElement ( int n ) { if ( n == 1 n == 2 ) return 0 ; int a = nextPowerOf2 ( n ) ; if ( n == a n == a - 1 ) return 1 ; else if ( n == a - 2 ) return 0 ; else if ( n % 2 == 0 ) return 1 ; else return 2 ; } public static void main ( String [ ] args ) { int n = 5 ; System . out . println ( removeElement ( n ) ) ; } }

Accumulator variables: count
Class/struct names: GFG
Java program:
public class GFG { static int bridge_length ( int trainLength , int Speed , int Time ) { return ( ( Time * Speed ) - trainLength ) ; } public static void main ( String [ ] args ) { int trainLength = 120 ; int Speed = 30 ; int Time = 18 ; System . out . print ( " Length ▁ of ▁ bridge ▁ = ▁ " + bridge_length ( trainLength , Speed , Time ) + " ▁ meters " ) ; } }

Class/struct names: GFG
Java program:
class GFG { static long MOD = 1000000007 ; static long modInv ( long x ) { long n = MOD - 2 ; long result = 1 ; while ( n > 0 ) { if ( ( n & 1 ) > 0 ) { result = result * x % MOD ; } x = x * x % MOD ; n = n / 2 ; } return result ; } static long getSum ( long n , long k ) { long ans = 1 ; for ( long i = n + 1 ; i > n - k ; i -- ) { ans = ans * i % MOD ; } ans = ans * modInv ( k + 1 ) % MOD ; return ans ; } public static void main ( String [ ] args ) { long n = 3 , k = 2 ; System . out . println ( getSum ( n , k ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void printCombination ( int n ) { System . out . print ( 1 + " ▁ " ) ; if ( ( n - 2 ) % 3 == 0 ) System . out . print ( 2 + " ▁ " + ( n - 3 ) ) ; else System . out . print ( 1 + " ▁ " + ( n - 2 ) ) ; } public static void main ( String [ ] args ) { int n = 233 ; printCombination ( n ) ; } }

Class/struct names: GFG
Java program:
class GFG { static boolean checkPairs ( int l , int r ) { if ( ( l - r ) % 2 == 0 ) return false ; return true ; } public static void main ( String [ ] args ) { int l = 1 , r = 8 ; if ( checkPairs ( l , r ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Class/struct names: GFG
Java program:
class GFG { static boolean isPalindrome ( int n ) { if ( n % 11 == 0 ) { return true ; } return false ; } public static void main ( String [ ] args ) { System . out . println ( isPalindrome ( 123321 ) ? " Palindrome " : " Not ▁ Palindrome " ) ; } }

Class/struct names: GFG
Java program:
class GFG { public static void main ( String [ ] args ) { int target = 93 ; int [ ] arr = { 1 , 31 , 3 , 1 , 93 , 3 , 31 , 1 , 93 } ; int length = arr . length ; int totalCount = 0 ; for ( int i = 0 ; i < length - 2 ; i ++ ) { if ( target % arr [ i ] == 0 ) { for ( int j = i + 1 ; j < length - 1 ; j ++ ) { if ( target % ( arr [ i ] * arr [ j ] ) == 0 ) { int toFind = target / ( arr [ i ] * arr [ j ] ) ; for ( int k = j + 1 ; k < length ; k ++ ) { if ( arr [ k ] == toFind ) { totalCount ++ ; } } } } } } System . out . println ( " Total ▁ number ▁ of ▁ triplets ▁ found ▁ : ▁ " + totalCount ) ; } }

Index/key variables: i, j, k
Accumulator variables: i, j, k, totalCount
Iterator variables: i, j, k
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static long binomialCoeff ( long n , long k ) { long res = 1 ; if ( k > n - k ) k = n - k ; for ( int i = 0 ; i < k ; ++ i ) { res *= ( n - i ) ; res /= ( i + 1 ) ; } return res ; } static long catalan ( long n ) { long c = binomialCoeff ( 2 * n , n ) ; return c / ( n + 1 ) ; } public static void main ( String [ ] args ) { int n = 3 ; System . out . println ( catalan ( n ) ) ; } }

Accumulator variables: res
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; public class GFG { public static boolean isFascinating ( int num ) { int [ ] freq = new int [ 10 ] ; String val = " " + num + num * 2 + num * 3 ; for ( int i = 0 ; i < val . length ( ) ; i ++ ) { int digit = val . charAt ( i ) - '0' ; if ( freq [ digit ] > 0 && digit != 0 ) return false ; else freq [ digit ] ++ ; } for ( int i = 1 ; i < freq . length ; i ++ ) { if ( freq [ i ] == 0 ) return false ; } return true ; } public static void main ( String args [ ] ) { int num = 192 ; if ( num < 100 ) System . out . println ( " No " ) ; else { boolean ans = isFascinating ( num ) ; if ( ans ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } }

Index/key variables: digit, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { public static int binomial_coefficient ( int n , int m ) { int res = 1 ; if ( m > n - m ) m = n - m ; for ( int i = 0 ; i < m ; ++ i ) { res *= ( n - i ) ; res /= ( i + 1 ) ; } return res ; } public static int calculate_ways ( int m , int n ) { if ( m < n ) { return 0 ; } int ways = binomial_coefficient ( n + m - 1 , n - 1 ) ; return ways ; } public static void main ( String [ ] args ) { int m = 7 , n = 5 ; int result = calculate_ways ( m , n ) ; System . out . println ( Integer . toString ( result ) ) ; System . exit ( 0 ) ; } }

Accumulator variables: res
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; import java . lang . * ; import java . io . * ; class GFG { static final int N = 100005 ; static int [ ] phi ; static int [ ] S ; static void computeTotient ( ) { for ( int i = 1 ; i < N ; i ++ ) phi [ i ] = i ; for ( int p = 2 ; p < N ; p ++ ) { if ( phi [ p ] == p ) { phi [ p ] = p - 1 ; for ( int i = 2 * p ; i < N ; i += p ) { phi [ i ] = ( phi [ i ] / p ) * ( p - 1 ) ; } } } } static void CoPrimes ( ) { computeTotient ( ) ; for ( int i = 1 ; i < N ; i ++ ) S [ i ] = S [ i - 1 ] + phi [ i ] ; } public static void main ( String args [ ] ) { phi = new int [ N ] ; S = new int [ N ] ; CoPrimes ( ) ; int q [ ] = { 3 , 4 } ; int n = q . length ; for ( int i = 0 ; i < n ; i ++ ) System . out . println ( "Number of unordered coprime " ▁ + ▁ " pairs of integers from 1 to " ▁ + ▁ q [ i ] ▁ + ▁ " are " + S[q[i]] ); } }

Index/key variables: N, i, p
Accumulator variables: i, p
Iterator variables: i, p
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int binaryToDecimal ( String n ) { String num = n ; int dec_value = 0 ; int base = 1 ; int len = num . length ( ) ; for ( int i = len - 1 ; i >= 0 ; i -- ) { if ( num . charAt ( i ) == '1' ) dec_value += base ; base = base * 2 ; } return dec_value ; } static int numberSequence ( int n ) { if ( n == 1 ) return 1 ; String s = " " ; for ( int i = 1 ; i < n ; i ++ ) s += '1' ; s += '0' ; for ( int i = 1 ; i <= n ; i ++ ) s += '1' ; int num = binaryToDecimal ( s ) ; return num ; } public static void main ( String args [ ] ) { int n = 4 ; System . out . println ( numberSequence ( n ) ) ; } }

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

Class/struct names: GFG
Java program:
class GFG { static int prime ( int num ) { int i , flag = 0 ; for ( i = 2 ; i <= num / 2 ; i ++ ) { if ( num % i == 0 ) { flag = 1 ; break ; } } if ( flag == 0 ) return 1 ; else return 0 ; } static void print_alternate_prime ( int n ) { int counter = 0 ; for ( int num = 2 ; num < n ; num ++ ) { if ( prime ( num ) == 1 ) { if ( counter % 2 == 0 ) System . out . print ( num + " ▁ " ) ; counter ++ ; } } } public static void main ( String [ ] args ) { int n = 15 ; System . out . println ( " Following ▁ are ▁ the ▁ alternate ▁ " + " prime ▁ number ▁ smaller ▁ than ▁ " + " or ▁ equal ▁ to ▁ " + n ) ; print_alternate_prime ( n ) ; } }

Accumulator variables: counter, i, num
Iterator variables: i, num
Class/struct names: GFG