dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
import java . util . * ; class GFG { static final int MAX = 32 ; static long [ ] pow2 = new long [ MAX ] ; static boolean [ ] visited = new boolean [ MAX ] ; static Vector < Long > ans = new Vector < > ( ) ; static void power_2 ( ) { long ans = 1 ; for ( int i = 0 ; i < MAX ; i ++ ) { pow2 [ i ] = ans ; ans *= 2 ; } } static int countSetBits ( long x ) { int setBits = 0 ; while ( x != 0 ) { x = x & ( x - 1 ) ; setBits ++ ; } return setBits ; } static void add ( long num ) { int point = 0 ; long value = 0 ; for ( int i = 0 ; i < MAX ; i ++ ) { if ( visited [ i ] ) continue ; else { if ( num % 2 == 1 ) { value += ( 1 << i ) ; } num /= 2 ; } } ans . add ( value ) ; } static void solve ( long n , long k ) { ans . add ( k ) ; int countk = countSetBits ( k ) ; if ( pow2 [ countk ] < n ) { System . out . print ( - 1 ) ; return ; } int count = 0 ; for ( long i = 0 ; i < pow2 [ countk ] - 1 ; i ++ ) { add ( i ) ; count ++ ; if ( count == n ) break ; } for ( int i = 0 ; i < n ; i ++ ) { System . out . print ( ans . get ( i ) + " ▁ " ) ; } } public static void main ( String [ ] args ) { long n = 3 , k = 5 ; power_2 ( ) ; solve ( n , k ) ; } }

Index/key variables: MAX, countk, i
Accumulator variables: ans, count, i, num, setBits, value
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int countX ( int a , int b ) { if ( b > a ) return 0 ; else if ( a == b ) return - 1 ; else { int x = a - b , ans = 0 ; for ( int i = 1 ; i * i <= x ; i ++ ) { if ( x % i == 0 ) { int d1 = i , d2 = b - 1 ; if ( i * i != x ) d2 = x / i ; if ( d1 > b ) ans ++ ; if ( d2 > b ) ans ++ ; } } return ans ; } } static public void main ( String args [ ] ) { int a = 21 , b = 5 ; System . out . println ( countX ( a , b ) ) ; } }

Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static long sumPowersK ( long n , long k ) { long sum = 0 , num = 1 ; while ( num <= n ) { sum += num ; num *= k ; } return sum ; } static long getSum ( long n , long k ) { long pwrK = sumPowersK ( n , k ) ; long sumAll = ( n * ( n + 1 ) ) / 2 ; return ( sumAll - pwrK ) ; } public static void main ( String [ ] args ) { long n = 10 , k = 3 ; System . out . println ( getSum ( n , k ) ) ; } }

Accumulator variables: num, sum
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int maxPeople ( int p ) { int tmp = 0 , count = 0 ; for ( int i = 1 ; i * i <= p ; i ++ ) { tmp = tmp + ( i * i ) ; if ( tmp <= p ) count ++ ; else break ; } return count ; } public static void main ( String args [ ] ) { int p = 14 ; System . out . println ( maxPeople ( p ) ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int kN = 1000000 ; static int maxPeople ( int p ) { long [ ] sums = new long [ kN ] ; sums [ 0 ] = 0 ; for ( int i = 1 ; i < kN ; i ++ ) sums [ i ] = ( long ) ( i * i ) + sums [ i - 1 ] ; int it = lower_bound ( sums , 0 , kN , p ) ; if ( sums [ it ] > p ) { -- it ; } return it ; } private static int lower_bound ( long [ ] a , int low , int high , int element ) { while ( low < high ) { int middle = low + ( high - low ) / 2 ; if ( element > a [ middle ] ) low = middle + 1 ; else high = middle ; } return low ; } public static void main ( String [ ] args ) { int p = 14 ; System . out . println ( maxPeople ( p ) ) ; } }

Index/key variables: i, it, kN, middle
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static long squareSeries ( long n ) { return ( n * ( n + 1 ) * ( 2 * n + 1 ) ) / 6 ; } static long maxPeople ( long n ) { long low = 0 ; long high = 1000000L ; long ans = 0L ; while ( low <= high ) { long mid = low + ( ( high - low ) / 2 ) ; long value = squareSeries ( mid ) ; if ( value <= n ) { ans = mid ; low = mid + 1 ; } else { high = mid - 1 ; } } return ans ; } public static void main ( String [ ] args ) { long p = 14 ; System . out . println ( maxPeople ( p ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int findIndex ( int [ ] a , int n , int k ) { int index = - 1 , max_ceil = Integer . MIN_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = ( a [ i ] + k - 1 ) / k ; } for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] >= max_ceil ) { max_ceil = a [ i ] ; index = i ; } } return index ; } static public void main ( String [ ] args ) { int [ ] arr = { 31 , 12 , 25 , 27 , 32 , 19 } ; int K = 5 ; int N = arr . length ; System . out . print ( findIndex ( arr , N , K ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int MAXN = 60 ; static int solveQuery ( int L , int X ) { int res ; int [ ] a = new int [ MAXN ] ; int [ ] b = new int [ L ] ; int refer = X , size_a = 0 ; while ( refer > 0 ) { a [ size_a ] = refer % 2 ; refer /= 2 ; size_a ++ ; } for ( int i = 0 ; i < Math . min ( size_a , L ) ; i ++ ) { if ( a [ i ] == 1 ) b [ i ] = 0 ; else b [ i ] = 1 ; } for ( int i = Math . min ( size_a , L ) ; i < L ; i ++ ) b [ i ] = 1 ; b [ L - 1 ] = 1 ; int temp = 0 , p = 1 ; for ( int i = 0 ; i < L ; i ++ ) { temp += b [ i ] * p ; p *= 2 ; } res = temp ^ X ; return res ; } static public void main ( String args [ ] ) { int [ ] [ ] queries = { { 2 , 5 } , { 3 , 15 } } ; int q = queries . length ; for ( int i = 0 ; i < q ; i ++ ) System . out . println ( solveQuery ( queries [ i ] [ 0 ] , queries [ i ] [ 1 ] ) ) ; } }

Index/key variables: L, MAXN, i, size_a
Accumulator variables: i, p, refer, size_a, temp
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int Count_Segment ( int p [ ] , int n ) { int count = 0 ; int [ ] upto = new int [ n + 1 ] ; for ( int i = 0 ; i < n + 1 ; i ++ ) upto [ i ] = 0 ; int j = 0 , curr = 0 ; for ( int i = 1 ; i < n ; i ++ ) { if ( p [ i ] > p [ i - 1 ] && p [ i ] > p [ i + 1 ] ) { curr = p [ i ] ; j = i - 1 ; while ( j >= 0 && p [ j ] < curr ) { upto [ p [ j ] ] = curr ; j -= 1 ; } j = i + 1 ; while ( j < n && p [ j ] < curr ) { if ( upto [ curr - p [ j ] ] == curr ) count += 1 ; j += 1 ; } } } return count ; } public static void main ( String [ ] args ) { int p [ ] = { 3 , 4 , 1 , 5 , 2 } ; int n = p . length ; System . out . println ( Count_Segment ( p , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static boolean solve ( int n , int k ) { if ( n >= ( k * ( k + 1 ) ) / 2 ) { return true ; } return false ; } public static void main ( String [ ] args ) { int n = 12 , k = 4 ; if ( solve ( n , k ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static void solve ( long a , long b ) { if ( a > 0 && b > 0 ) { System . out . println ( " Positive " ) ; } else if ( a <= 0 && b >= 0 ) { System . out . println ( " Zero " ) ; } else { long n = Math . abs ( a - b ) + 1 ; if ( n % 2 == 0 ) { System . out . println ( " Positive " ) ; } else { System . out . println ( " Negative " ) ; } } } public static void main ( String [ ] args ) { int a = - 10 , b = - 2 ; solve ( a , b ) ; } }

Class/struct names: GFG
Java program:
import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . io . * ; class GFG { static int closetAND ( int arr [ ] , int n , int k ) { int ans = Integer . MAX_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { int X = arr [ i ] ; for ( int j = i ; j < n ; j ++ ) { X &= arr [ j ] ; ans = Math . min ( ans , Math . abs ( k - X ) ) ; } } return ans ; } public static void main ( String [ ] args ) { int arr [ ] = { 4 , 7 , 10 } ; int n = arr . length ; int k = 2 ; System . out . println ( closetAND ( arr , n , k ) ) ; } }

Index/key variables: i, j
Accumulator variables: X, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static int Rate ( int N1 , int N2 ) { float rate = ( N2 - N1 ) * 100 / N1 ; return ( int ) rate ; } public static void main ( String [ ] args ) { int N1 = 100 , N2 = 120 ; System . out . println ( Rate ( N1 , N2 ) + " ▁ % " ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int getPrime ( int arr [ ] , int n ) { int max_val = Arrays . stream ( arr ) . max ( ) . getAsInt ( ) ; Vector < Boolean > prime = new Vector < > ( max_val + 1 ) ; for ( int i = 0 ; i < max_val + 1 ; i ++ ) prime . add ( i , Boolean . TRUE ) ; prime . add ( 1 , Boolean . FALSE ) ; prime . add ( 2 , Boolean . FALSE ) ; for ( int p = 2 ; p * p <= max_val ; p ++ ) { if ( prime . get ( p ) == true ) { for ( int i = p * 2 ; i <= max_val ; i += p ) prime . add ( i , Boolean . FALSE ) ; } } int maximum = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( prime . get ( arr [ i ] ) ) { maximum = Math . max ( maximum , arr [ i ] ) ; } } return maximum ; } public static void main ( String [ ] args ) { int arr [ ] = { 2 , 10 , 15 , 7 , 6 , 8 , 13 } ; int n = arr . length ; System . out . println ( getPrime ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, p
Iterator variables: i, p
Class/struct names: GFG
Java program:
class GFG { static long getMinNum ( int N ) { int lcm = 1 ; for ( int i = 2 ; i <= N ; i ++ ) lcm = ( ( i * lcm ) / ( __gcd ( i , lcm ) ) ) ; return ( lcm + 1 ) ; } static int __gcd ( int a , int b ) { if ( b == 0 ) return a ; return __gcd ( b , a % b ) ; } public static void main ( String args [ ] ) { int N = 5 ; System . out . println ( getMinNum ( N ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { public static double maxEdges ( double N ) { double edges = 0 ; edges = Math . floor ( ( N * N ) / 4 ) ; return edges ; } public static void main ( String [ ] args ) { double N = 5 ; System . out . println ( maxEdges ( N ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static boolean isSafe ( int N , int M , char [ ] str ) { int coll = 0 , colr = 0 , rowu = 0 , rowd = 0 ; for ( int i = 0 ; i < str . length ; i ++ ) { if ( str [ i ] == ' L ' ) { coll ++ ; if ( colr > 0 ) { colr -- ; } if ( coll == M ) { break ; } } else if ( str [ i ] == ' R ' ) { colr ++ ; if ( coll > 0 ) { coll -- ; } if ( colr == M ) { break ; } } else if ( str [ i ] == ' U ' ) { rowu ++ ; if ( rowd > 0 ) { rowd -- ; } if ( rowu == N ) { break ; } } else if ( str [ i ] == ' D ' ) { rowd ++ ; if ( rowu > 0 ) { rowu -- ; } if ( rowd == N ) { break ; } } } if ( Math . abs ( rowd ) < N && Math . abs ( rowu ) < N && Math . abs ( coll ) < M && Math . abs ( colr ) < M ) { return true ; } return false ; } public static void main ( String [ ] args ) { int N = 1 , M = 1 ; String str = " R " ; if ( isSafe ( N , M , str . toCharArray ( ) ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Index/key variables: i
Accumulator variables: coll, colr, i, rowd, rowu
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void Permutation ( int n , int k ) { int [ ] p = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) p [ i ] = i ; for ( int i = 1 ; i < n - k ; i ++ ) p [ i + 1 ] = i ; p [ 1 ] = n - k ; for ( int i = 1 ; i <= n ; i ++ ) System . out . print ( p [ i ] + " ▁ " ) ; } public static void main ( String [ ] args ) { int n = 5 , k = 2 ; Permutation ( n , k ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int countOnes ( int arr [ ] , int N ) { for ( int i = 1 ; i <= N ; i ++ ) { for ( int j = i ; j <= N ; j ++ ) { if ( j % i == 0 ) { if ( arr [ j - 1 ] == 0 ) { } else { } } } } int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] == 1 ) { } } return count ; } public static void main ( String [ ] args ) { int arr [ ] = new int [ 10 ] ; int ans = countOnes ( arr , N ) ; System . out . println ( ans ) ; } }

Index/key variables: i
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static int validPosition ( int arr [ ] , int N , int K ) { int count = 0 , sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { sum += arr [ i ] ; } for ( int i = 0 ; i < N ; i ++ ) { if ( ( arr [ i ] + K ) > ( sum - arr [ i ] ) ) count ++ ; } return count ; } public static void main ( String [ ] args ) { int arr [ ] = { 2 , 1 , 6 , 7 } , K = 4 ; int N = arr . length ; System . out . println ( validPosition ( arr , N , K ) ) ; } }

Index/key variables: i
Accumulator variables: count, i, sum
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void count_unique ( HashSet < Integer > s , int n ) { if ( s . contains ( n ) ) return ; s . add ( n ) ; n += 1 ; while ( n % 10 == 0 ) { n = n / 10 ; } count_unique ( s , n ) ; } public static void main ( String [ ] args ) { int n = 10 ; HashSet < Integer > s = new HashSet < > ( ) ; count_unique ( s , n ) ; System . out . println ( s . size ( ) ) ; } }

Accumulator variables: n
Class/struct names: GFG
Java program:
class GFG { static int maxBitElement ( int arr [ ] , int n ) { int num = 0 , max = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { int cnt = Integer . bitCount ( arr [ i ] ) ; if ( cnt > max ) { max = cnt ; num = arr [ i ] ; } } return num ; } public static void main ( String [ ] args ) { int arr [ ] = { 3 , 2 , 4 , 7 , 1 , 10 , 5 , 8 , 9 , 6 } ; int n = arr . length ; System . out . print ( maxBitElement ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int N = 1000 ; static int countPairs ( int arr [ ] , int n ) { int size = ( 2 * N ) + 1 ; int freq [ ] = new int [ size ] ; for ( int i = 0 ; i < n ; i ++ ) { int x = arr [ i ] ; freq [ x + N ] ++ ; } int ans = 0 ; for ( int i = 0 ; i < size ; i ++ ) { if ( freq [ i ] > 0 ) { ans += ( ( freq [ i ] ) * ( freq [ i ] - 1 ) ) / 2 ; for ( int j = i + 2 ; j < 2001 ; j += 2 ) { if ( freq [ j ] > 0 && ( freq [ ( i + j ) / 2 ] > 0 ) ) { ans += ( freq [ i ] * freq [ j ] ) ; } } } } return ans ; } public static void main ( String [ ] args ) { int arr [ ] = { 4 , 2 , 5 , 1 , 3 , 5 } ; int n = arr . length ; System . out . println ( countPairs ( arr , n ) ) ; } }

Index/key variables: i, j, size
Accumulator variables: ans, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static int smallestSum ( int n ) { if ( n == 1 ) return 0 ; return ( 2 * ( int ) Math . pow ( 10 , n - 1 ) ) ; } static int largestSum ( int n ) { return ( 2 * ( ( int ) Math . pow ( 10 , n ) - 1 ) ) ; } public static void main ( String args [ ] ) { int n = 4 ; System . out . println ( " Largest ▁ = ▁ " + largestSum ( n ) ) ; System . out . print ( " Smallest ▁ = ▁ " + smallestSum ( n ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static int count_pairs ( int a [ ] , int b [ ] , int n , int m ) { int odd1 = 0 , even1 = 0 ; int odd2 = 0 , even2 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] % 2 == 1 ) { odd1 ++ ; } else { even1 ++ ; } } for ( int i = 0 ; i < m ; i ++ ) { if ( b [ i ] % 2 == 1 ) { odd2 ++ ; } else { even2 ++ ; } } int pairs = Math . min ( odd1 , even2 ) + Math . min ( odd2 , even1 ) ; return pairs ; } public static void main ( String [ ] args ) { int a [ ] = { 9 , 14 , 6 , 2 , 11 } ; int b [ ] = { 8 , 4 , 7 , 20 } ; int n = a . length ; int m = b . length ; System . out . println ( count_pairs ( a , b , n , m ) ) ; } }

Index/key variables: i
Accumulator variables: even1, even2, i, odd1, odd2
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int find_leftmost_unsetbit ( int n ) { int ind = - 1 ; int i = 1 ; while ( n > 0 ) { if ( ( n % 2 ) != 1 ) { ind = i ; } i ++ ; n >>= 1 ; } return ind ; } static void perform_steps ( int n ) { int left = find_leftmost_unsetbit ( n ) ; if ( left == - 1 ) { System . out . print ( " No ▁ steps ▁ required " ) ; return ; } int step = 1 ; while ( find_leftmost_unsetbit ( n ) != - 1 ) { if ( step % 2 == 0 ) { n += 1 ; System . out . println ( " Step " + step + " : ▁ Increase ▁ by ▁ 1" ) ; } else { int m = find_leftmost_unsetbit ( n ) ; int num = ( int ) ( Math . pow ( 2 , m ) - 1 ) ; n = n ^ num ; System . out . println ( " Step " + step + " : ▁ Xor ▁ with ▁ " + num ) ; } step += 1 ; } } public static void main ( String [ ] args ) { int n = 39 ; perform_steps ( n ) ; } }

Accumulator variables: i, n, step
Class/struct names: GFG
Java program:
class GFG { static int vertices ( int N , int A , int B ) { int position = 0 ; int minisum = Integer . MAX_VALUE ; int sum = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { if ( i == A i == B ) continue ; else { int x = Math . abs ( i - A ) ; int y = Math . abs ( i - B ) ; sum = x + y ; if ( sum < minisum ) { minisum = sum ; position = i ; } } } return position ; } public static void main ( String [ ] args ) { int N = 3 , A = 1 , B = 2 ; System . out . println ( " Vertex ▁ = ▁ " + vertices ( N , A , B ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int factorial ( int n ) { int f = 1 ; for ( int i = 1 ; i <= n ; i ++ ) { f *= i ; } return f ; } static int sumFactorial ( int [ ] arr , int n ) { int s = 0 ; for ( int i = 0 ; i < n ; i ++ ) { s += factorial ( arr [ i ] ) ; } return s ; } public static void main ( String [ ] args ) { int [ ] arr = { 7 , 3 , 5 , 4 , 8 } ; int n = arr . length ; System . out . println ( sumFactorial ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: f, i, s
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int ans = 0 ; static Vector < Vector < Integer > > gr = new Vector < Vector < Integer > > ( ) ; static void Add_Edge ( int u , int v ) { gr . get ( u ) . add ( v ) ; gr . get ( v ) . add ( u ) ; } static void dfs ( int child , int par , int color [ ] ) { if ( color [ child ] != color [ par ] ) ans ++ ; for ( int i = 0 ; i < gr . get ( child ) . size ( ) ; i ++ ) { if ( gr . get ( child ) . get ( i ) == par ) continue ; dfs ( gr . get ( child ) . get ( i ) , child , color ) ; } } public static void main ( String args [ ] ) { for ( int i = 0 ; i <= 10 ; i ++ ) gr . add ( new Vector < Integer > ( ) ) ; int color [ ] = { 0 , 1 , 2 , 3 , 2 , 2 , 3 } ; Add_Edge ( 1 , 2 ) ; Add_Edge ( 1 , 3 ) ; Add_Edge ( 2 , 4 ) ; Add_Edge ( 2 , 5 ) ; Add_Edge ( 3 , 6 ) ; dfs ( 1 , 0 , color ) ; System . out . println ( ans ) ; } }

Index/key variables: child, par
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int highestPower ( String str , int len ) { int ans = 0 ; for ( int i = len - 1 ; i >= 0 ; i -- ) { if ( str . charAt ( i ) == '0' ) ans ++ ; else break ; } return ans ; } public static void main ( String [ ] args ) { String str = "100100" ; int len = str . length ( ) ; System . out . println ( highestPower ( str , len ) ) ; } }

Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static long mod = ( long ) ( 1e9 + 7 ) ; static long factorial ( long n , long p ) { for ( int i = 2 ; i <= n ; i ++ ) res = ( res * i ) % p ; return res ; } static long power ( long x , long y , long p ) { while ( y > 0 ) { if ( ( y & 1 ) == 1 ) res = ( res * x ) % p ; x = ( x * x ) % p ; } return res ; } static long modInverse ( long n , long p ) { return power ( n , p - 2 , p ) ; } static long nCrModP ( long n , long r , long p ) { if ( r == 0 ) return 1 ; long fac [ ] = new long [ ( int ) n + 1 ] ; fac [ 0 ] = 1 ; for ( int i = 1 ; i <= n ; i ++ ) fac [ i ] = fac [ i - 1 ] * i % p ; return ( fac [ ( int ) n ] * modInverse ( fac [ ( int ) r ] , p ) % p * modInverse ( fac [ ( int ) n - ( int ) r ] , p ) % p ) % p ; } static long countArrangements ( long n , long k , long p ) { return ( factorial ( n , p ) * nCrModP ( k , n , p ) ) % p ; } public static void main ( String [ ] args ) { long N = 5 , K = 8 ; System . out . println ( countArrangements ( N , K , mod ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int maxProd ( int N ) { if ( N == 0 ) return 1 ; if ( N < 10 ) return N ; return Math . max ( maxProd ( N / 10 ) * ( N % 10 ) , maxProd ( N / 10 - 1 ) * 9 ) ; } public static void main ( String [ ] args ) { int N = 390 ; System . out . println ( maxProd ( N ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int N = 2 ; static int M = 3 ; static boolean check ( int mat [ ] [ ] ) { int xorr = 0 ; for ( int i = 0 ; i < N ; i ++ ) { xorr ^= mat [ i ] [ 0 ] ; } if ( xorr != 0 ) return true ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 1 ; j < M ; j ++ ) { if ( mat [ i ] [ j ] != mat [ i ] [ 0 ] ) return true ; } } return false ; } public static void main ( String [ ] args ) { int mat [ ] [ ] = { { 7 , 7 , 7 } , { 10 , 10 , 7 } } ; if ( check ( mat ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, xorr
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static int sumodd ( int n ) { return ( n * n ) ; } static int sumeven ( int n ) { return ( n * ( n + 1 ) ) ; } static int findSum ( int num ) { int sumo = 0 ; int sume = 0 ; int x = 1 ; int cur = 0 ; int ans = 0 ; while ( num > 0 ) { int inc = Math . min ( x , num ) ; num -= inc ; if ( cur == 0 ) { ans = ans + sumodd ( sumo + inc ) - sumodd ( sumo ) ; sumo += inc ; } else { ans = ans + sumeven ( sume + inc ) - sumeven ( sume ) ; sume += inc ; } x *= 2 ; cur ^= 1 ; } return ans ; } public static void main ( String [ ] args ) { int n = 4 ; System . out . println ( findSum ( n ) ) ; } }

Accumulator variables: cur, num, sume, sumo, x
Class/struct names: GFG
Java program:
class GFG { static int oddTriangularNumber ( int N ) { return ( N * ( ( 2 * N ) - 1 ) ) ; } public static void main ( String [ ] args ) { int N = 3 ; System . out . println ( oddTriangularNumber ( N ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static void idstrt ( double a1 , double b1 , double c1 , double a2 , double b2 , double c2 ) { if ( ( a1 / a2 == b1 / b2 ) && ( a1 / a2 == c1 / c2 ) && ( b1 / b2 == c1 / c2 ) ) System . out . println ( " The ▁ given ▁ straight " + " ▁ lines ▁ are ▁ identical " ) ; else System . out . println ( " The ▁ given ▁ straight " + " ▁ lines ▁ are ▁ not ▁ identical " ) ; } public static void main ( String [ ] args ) { double a1 = - 2 , b1 = 4 , c1 = 3 , a2 = - 6 , b2 = 12 , c2 = 9 ; idstrt ( a1 , b1 , c1 , a2 , b2 , c2 ) ; } }

Class/struct names: GFG