dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
public class GFG { static int startingPoint ( int Length , int Speed1 , int Speed2 ) { int result1 = 0 , result2 = 0 ; int time1 = Length / Speed1 ; int time2 = Length / Speed2 ; result1 = __gcd ( time1 , time2 ) ; result2 = time1 * time2 / ( result1 ) ; return result2 ; } static int __gcd ( int a , int b ) { if ( b == 0 ) { return a ; } return __gcd ( b , a % b ) ; } static float firstTime ( int Length , int Speed1 , int Speed2 ) { float result = 0 ; int relativeSpeed = Math . abs ( Speed1 - Speed2 ) ; result = ( ( float ) Length / relativeSpeed ) ; return result ; } public static void main ( String [ ] args ) { int L = 30 , S1 = 5 , S2 = 2 ; float first_Time = firstTime ( L , S1 , S2 ) ; int starting_Point = startingPoint ( L , S1 , S2 ) ; System . out . println ( " Met ▁ first ▁ time ▁ after ▁ " + first_Time + " ▁ hrs " ) ; System . out . println ( " Met ▁ at ▁ starting ▁ point ▁ after ▁ " + starting_Point + " ▁ hrs " ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static boolean CheckArray ( int arr [ ] , int n ) { int prod = 1 ; for ( int i = 0 ; i < n ; ++ i ) prod *= arr [ i ] ; for ( int i = 0 ; i < n ; ++ i ) if ( arr [ i ] == prod / arr [ i ] ) return true ; return false ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 , 12 , 3 , 2 } ; int n = arr . length ; if ( CheckArray ( arr , n ) ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } }

Index/key variables: i
Accumulator variables: prod
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int sum ( int a , int b ) { int sum = 0 ; for ( int i = 1 ; i <= Math . min ( a , b ) ; i ++ ) if ( a % i == 0 && b % i == 0 ) sum += i ; return sum ; } public static void main ( String [ ] args ) { int A = 10 , B = 15 ; System . out . print ( " Sum ▁ = ▁ " + sum ( A , B ) ) ; } }

Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . Arrays ; class GFG { static int findgcd ( int a , int b ) { if ( b == 0 ) return a ; return findgcd ( b , a % b ) ; } static int minimumCuts ( int a [ ] , int n ) { Arrays . sort ( a ) ; int gcd = a [ 1 ] - a [ 0 ] ; int s = gcd ; for ( int i = 2 ; i < n ; i ++ ) { gcd = findgcd ( gcd , a [ i ] - a [ i - 1 ] ) ; s += a [ i ] - a [ i - 1 ] ; } if ( 360 - s > 0 ) gcd = findgcd ( gcd , 360 - s ) ; return ( 360 / gcd ) - n ; } public static void main ( String [ ] args ) { int [ ] arr = new int [ ] { 30 , 60 , 180 } ; int n = arr . length ; System . out . println ( minimumCuts ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, s
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class Solution { static final int MAXN = 100001 ; static int spf [ ] = new int [ MAXN ] ; static void sieve ( ) { spf [ 1 ] = 1 ; for ( int i = 2 ; i < MAXN ; i ++ ) spf [ i ] = i ; for ( int i = 4 ; i < MAXN ; i += 2 ) spf [ i ] = 2 ; for ( int i = 3 ; i * i < MAXN ; i ++ ) { if ( spf [ i ] == i ) { for ( int j = i * i ; j < MAXN ; j += i ) if ( spf [ j ] == j ) spf [ j ] = i ; } } } static Vector < Integer > getFactorization ( int x ) { Vector < Integer > ret = new Vector < Integer > ( ) ; while ( x != 1 ) { int temp = spf [ x ] ; ret . add ( temp ) ; while ( x % temp == 0 ) x = x / temp ; } return ret ; } static int maxElement ( int A [ ] , int n ) { sieve ( ) ; Map < Integer , Integer > m = new HashMap < Integer , Integer > ( ) ; for ( int j = 0 ; j < n ; ++ j ) { Vector < Integer > p = getFactorization ( A [ j ] ) ; for ( int i = 0 ; i < p . size ( ) ; i ++ ) m . put ( p . get ( i ) , m . get ( p . get ( i ) ) == null ? 0 : m . get ( p . get ( i ) ) + 1 ) ; } int cnt = 0 , ans = 10000000 ; Set < Map . Entry < Integer , Integer > > st = m . entrySet ( ) ; for ( Map . Entry < Integer , Integer > me : st ) { if ( me . getValue ( ) >= cnt ) { cnt = me . getValue ( ) ; if ( ans > me . getKey ( ) ) ans = me . getKey ( ) ; else ans = ans ; } } return ans ; } public static void main ( String args [ ] ) { int A [ ] = { 2 , 5 , 10 } ; int n = A . length ; System . out . print ( maxElement ( A , n ) ) ; } }

Index/key variables: MAXN, i, j, x
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: Solution
Java program:
import java . util . * ; class solution { static float SellingPrice ( float CP , float PP ) { float P_decimal = 1 + ( PP / 100 ) ; float res = P_decimal * CP ; return res ; } public static void main ( String args [ ] ) { float C = 720 , P = 13 ; System . out . println ( SellingPrice ( C , P ) ) ; } }

Class/struct names: solution
Java program:
import java . util . * ; class GFG { static boolean [ ] SieveOfEratosThenes ( int max_val ) { boolean [ ] prime = new boolean [ max_val + 1 ] ; Arrays . fill ( prime , true ) ; for ( int p = 2 ; p * p <= max_val ; p ++ ) { if ( prime [ p ] ) { for ( int i = p * 2 ; i <= max_val ; i += p ) prime [ i ] = false ; } } return prime ; } static void compositeSumAndProduct ( Integer [ ] arr , int n , int k ) { int max_val = Collections . max ( Arrays . asList ( arr ) ) ; boolean [ ] prime = SieveOfEratosThenes ( max_val ) ; prime [ 0 ] = true ; prime [ 1 ] = true ; PriorityQueue < Integer > maxHeap = new PriorityQueue < Integer > ( ( x , y ) -> y - x ) ; PriorityQueue < Integer > minHeap = new PriorityQueue < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( ! prime [ arr [ i ] ] ) { minHeap . add ( arr [ i ] ) ; maxHeap . add ( arr [ i ] ) ; } } long minProduct = 1 , maxProduct = 1 , minSum = 0 , maxSum = 0 ; Integer lastMin = 0 , lastMax = 0 ; while ( k -- > 0 ) { if ( minHeap . peek ( ) != null || maxHeap . peek ( ) != null ) { minProduct *= minHeap . peek ( ) ; maxProduct *= maxHeap . peek ( ) ; minSum += minHeap . peek ( ) ; maxSum += maxHeap . peek ( ) ; lastMin = minHeap . poll ( ) ; lastMax = maxHeap . poll ( ) ; } else { minProduct *= lastMin ; maxProduct *= lastMax ; minSum += lastMin ; maxSum += lastMax ; } } '' ' ▁ Print ▁ results ▁ ' '' System . out . println ( " Sum ▁ of ▁ k - minimum ▁ composite " + " ▁ numbers ▁ is ▁ " + minSum ) ; System . out . println ( " Sum ▁ of ▁ k - maximum ▁ composite " + " ▁ numbers ▁ is ▁ " + maxSum ) ; System . out . println ( " Product ▁ of ▁ k - minimum ▁ composite " + " ▁ numbers ▁ is ▁ " + minProduct ) ; System . out . println ( " Product ▁ of ▁ k - maximum ▁ composite " + " ▁ numbers ▁ is ▁ " + maxProduct ) ; } public static void main ( String [ ] args ) { Integer [ ] arr = { 4 , 2 , 12 , 13 , 5 , 19 } ; int n = arr . length ; int k = 3 ; compositeSumAndProduct ( arr , n , k ) ; } }

Index/key variables: i, p
Accumulator variables: i, k, maxProduct, maxSum, minProduct, minSum, p
Iterator variables: i, p
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int compositeProduct ( int arr [ ] , int n ) { int max_val = Arrays . stream ( arr ) . max ( ) . getAsInt ( ) ; boolean [ ] prime = new boolean [ max_val + 1 ] ; Arrays . fill ( prime , true ) ; prime [ 0 ] = true ; prime [ 1 ] = true ; for ( int p = 2 ; p * p <= max_val ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * 2 ; i <= max_val ; i += p ) { prime [ i ] = false ; } } } int product = 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( ! prime [ arr [ i ] ] ) { product *= arr [ i ] ; } } return product ; } public static void main ( String [ ] args ) { int arr [ ] = { 2 , 3 , 4 , 5 , 6 , 7 } ; int n = arr . length ; System . out . println ( compositeProduct ( arr , n ) ) ; } }

Index/key variables: i, p
Accumulator variables: i, p, product
Iterator variables: i, p
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int sum_odd ( int n ) { int sum = 0 , pos = 1 ; while ( n > 0 ) { if ( pos % 2 == 1 ) sum += n % 10 ; n = n / 10 ; pos ++ ; } return sum ; } static boolean check_prime ( 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 ; } public static void main ( String [ ] args ) { int n = 223 ; int sum = sum_odd ( n ) ; if ( check_prime ( sum ) ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } }

Accumulator variables: pos, sum
Iterator variables: i
Class/struct names: GFG
Java program:
public class GFG { static float findAmount ( float X , float W , float Y ) { return ( X * ( Y - W ) ) / ( 100 - Y ) ; } public static void main ( String args [ ] ) { float X = 100 , W = 50 , Y = 60 ; System . out . println ( " Water ▁ to ▁ be ▁ added ▁ = ▁ " + findAmount ( X , W , Y ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static int reverseNum ( int x ) { String s = Integer . toString ( x ) ; String str = " " ; for ( int i = s . length ( ) - 1 ; i >= 0 ; i -- ) { str = str + s . charAt ( i ) ; } int rev = Integer . parseInt ( str ) ; return rev ; } static boolean isMysteryNumber ( int n ) { for ( int i = 1 ; i <= n / 2 ; i ++ ) { int j = reverseNum ( i ) ; if ( i + j == n ) { System . out . println ( i + " ▁ " + j ) ; return true ; } } System . out . println ( " Not ▁ a ▁ Mystery ▁ Number " ) ; return false ; } public static void main ( String [ ] args ) { int n = 121 ; isMysteryNumber ( n ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void ReplaceElements ( int arr [ ] , int n ) { int prod = 1 ; for ( int i = 0 ; i < n ; ++ i ) { prod *= arr [ i ] ; } for ( int i = 0 ; i < n ; ++ i ) { arr [ i ] = prod / arr [ i ] ; } } public static void main ( String [ ] args ) { int arr [ ] = { 2 , 3 , 3 , 5 , 7 } ; int n = arr . length ; ReplaceElements ( arr , n ) ; for ( int i = 0 ; i < n ; ++ i ) { System . out . print ( arr [ i ] + " ▁ " ) ; } System . out . println ( " " ) ; } }

Index/key variables: i
Accumulator variables: prod
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { public boolean Check_is_possible ( int l , int r , int k ) { int count = 0 ; for ( int i = l ; i <= r ; i ++ ) { if ( i % k == 0 ) { count ++ ; } } return ( count > 1 ) ; } public static void main ( String [ ] args ) { GFG g = new GFG ( ) ; int l = 4 , r = 12 ; int k = 5 ; if ( g . Check_is_possible ( l , r , k ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GfG { static boolean isValid ( int N , int K ) { HashSet < Integer > m1 = new HashSet < Integer > ( ) ; HashSet < Integer > m2 = new HashSet < Integer > ( ) ; while ( N > 0 ) { m1 . add ( N % 10 ) ; N /= 10 ; } while ( K > 0 ) { m2 . add ( K % 10 ) ; K /= 10 ; } if ( m1 . equals ( m2 ) ) { return true ; } return false ; } static String anyPermutation ( int N , int K ) { int powK [ ] = new int [ 100 + 1 ] , Limit = ( int ) Math . pow ( 10 , 18 ) ; powK [ 0 ] = K ; int i = 1 ; while ( powK [ i - 1 ] * K < Limit && i < 100 ) { powK [ i ] = powK [ i - 1 ] * K ; i ++ ; } for ( int j = 0 ; j < i ; j ++ ) { if ( isValid ( N , powK [ j ] ) ) { return " True " ; } } return " False " ; } public static void main ( String [ ] args ) { int N = ( int ) 96889010407L , K = 7 ; System . out . println ( anyPermutation ( N , K ) ) ; } }

Index/key variables: i, j
Accumulator variables: K, N, i, j
Iterator variables: j
Class/struct names: GfG
Java program:
import java . io . * ; class GFG { public static int sum ( int N ) { int S1 , S2 , S3 ; S1 = ( ( N / 2 ) ) * ( 2 * 2 + ( N / 2 - 1 ) * 2 ) / 2 ; S2 = ( ( N / 7 ) ) * ( 2 * 7 + ( N / 7 - 1 ) * 7 ) / 2 ; S3 = ( ( N / 14 ) ) * ( 2 * 14 + ( N / 14 - 1 ) * 14 ) / 2 ; return S1 + S2 - S3 ; } public static void main ( String [ ] args ) { int N = 20 ; System . out . println ( sum ( N ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int fastPow ( int N , int K ) { if ( K == 0 ) return 1 ; int temp = fastPow ( N , K / 2 ) ; if ( K % 2 == 0 ) return temp * temp ; else return N * temp * temp ; } static int countWays ( int N , int K ) { return K * fastPow ( K - 1 , N - 1 ) ; } public static void main ( String [ ] args ) { int N = 3 , K = 3 ; System . out . println ( countWays ( N , K ) ) ; } }

Class/struct names: GFG
Java program:
public class GFG { static int sumNth ( int A [ ] , int B [ ] , int m , int n ) { int res = 0 ; if ( n == 1 ) { for ( int i = 0 ; i < m ; i ++ ) res = res + A [ i ] ; } else if ( n == 2 ) { for ( int i = 0 ; i < m ; i ++ ) res = res + B [ i ] * m ; } else { int f [ ] = new int [ n ] ; f [ 0 ] = 0 ; f [ 1 ] = 1 ; for ( int i = 2 ; i < n ; i ++ ) f [ i ] = f [ i - 1 ] + f [ i - 2 ] ; for ( int i = 0 ; i < m ; i ++ ) { res = res + ( m * ( B [ i ] * f [ n - 1 ] ) ) + ( m * ( A [ i ] * f [ n - 2 ] ) ) ; } } return res ; } public static void main ( String args [ ] ) { int A [ ] = { 1 , 2 , 3 } ; int B [ ] = { 4 , 5 , 6 } ; int n = 3 ; int m = A . length ; System . out . println ( sumNth ( A , B , m , n ) ) ; } }

Index/key variables: i, n
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class solution { public static void main ( String arr [ ] ) { int a = 5 ; int AC = a ; int CE = 2 * a ; double shortestDistace = Math . sqrt ( AC * AC + CE * CE ) ; System . out . println ( shortestDistace ) ; } }

Class/struct names: solution
Java program:
import java . util . * ; import java . lang . * ; class GFG { static int sum_of_series ( int n ) { int result = 0 ; if ( n % 2 == 0 ) { result = - ( n * ( n + 1 ) ) / 2 ; } else { result = ( n * ( n + 1 ) ) / 2 ; } return result ; } public static void main ( String args [ ] ) { int n = 3 ; System . out . println ( sum_of_series ( n ) ) ; n = 10 ; System . out . println ( sum_of_series ( n ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static boolean isSemiPrime ( int num ) { int cnt = 0 ; for ( int i = 2 ; cnt < 2 && i * i <= num ; ++ i ) while ( num % i == 0 ) { num /= i ; ++ cnt ; } if ( num > 1 ) ++ cnt ; return cnt == 2 ? true : false ; } 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 boolean isChenPrime ( int n ) { if ( isPrime ( n ) && ( isSemiPrime ( n + 2 ) || isPrime ( n + 2 ) ) ) return true ; else return false ; } public static void main ( String [ ] args ) { int n = 7 ; if ( isChenPrime ( n ) ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } }

Accumulator variables: num
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static boolean isPowerOfTwo ( int n ) { return n != 0 && ( ( n & ( n - 1 ) ) == 0 ) ; } static boolean isThabitNumber ( int n ) { n = n + 1 ; if ( n % 3 == 0 ) n = n / 3 ; else return false ; if ( isPowerOfTwo ( n ) ) return true ; else return false ; } public static void main ( String [ ] args ) { int n = 47 ; if ( isThabitNumber ( n ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } }

Class/struct names: GFG
Java program:
public class GFG { static int N = 1000 ; static long dp [ ] = new long [ N + 1 ] ; static void sieve ( ) { int arr [ ] = new int [ N + 1 ] ; arr [ 0 ] = 1 ; arr [ 1 ] = 1 ; for ( int i = 2 ; i <= Math . sqrt ( N ) ; i ++ ) if ( arr [ i ] == 0 ) for ( int j = i * i ; j <= N ; j += i ) arr [ j ] = 1 ; long runningPrimeSum = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { if ( arr [ i ] == 0 ) runningPrimeSum += i ; dp [ i ] = runningPrimeSum ; } } public static void main ( String [ ] args ) { int l = 4 , r = 13 ; sieve ( ) ; System . out . println ( dp [ r ] - dp [ l - 1 ] ) ; } }

Index/key variables: i, j, r
Accumulator variables: i, j, runningPrimeSum
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static int findMinEqualSums ( int [ ] a , int N ) { int sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { sum += a [ i ] ; } int sum1 = 0 , sum2 = 0 ; int min = Integer . MAX_VALUE ; for ( int i = 0 ; i < N ; i ++ ) { sum1 += a [ i ] ; sum2 = sum - sum1 ; if ( Math . abs ( sum1 - sum2 ) < min ) { min = Math . abs ( sum1 - sum2 ) ; } if ( min == 0 ) { break ; } } return min ; } public static void main ( String args [ ] ) { int [ ] a = { 3 , 2 , 1 , 5 , 7 , 8 } ; int N = a . length ; System . out . println ( findMinEqualSums ( a , N ) ) ; } }

Index/key variables: i
Accumulator variables: i, sum, sum1
Iterator variables: i
Class/struct names: GFG
Java program:
public class Improve { final static double MAX = 10000 ; static boolean prime [ ] = new boolean [ ( int ) ( MAX + 1.0 ) ] ; static void SieveOfEratosthenes ( ) { for ( int i = 0 ; i <= MAX ; i ++ ) prime [ i ] = true ; prime [ 1 ] = false ; for ( int p = 2 ; p * p <= MAX ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * 2 ; i <= MAX ; i += p ) prime [ i ] = false ; } } } static int solve ( int n ) { int count = 0 , num = 1 ; long sum = 0 ; while ( count < n ) { if ( prime [ num ] ) { sum += num ; count ++ ; } num ++ ; } return ( int ) sum ; } public static void main ( String args [ ] ) { SieveOfEratosthenes ( ) ; int n = 4 ; System . out . println ( " Sum ▁ of ▁ 1st ▁ N ▁ prime ▁ numbers ▁ are ▁ : " + solve ( n ) ) ; } }

Index/key variables: i, num, p
Accumulator variables: count, i, num, p, sum
Iterator variables: i, p
Class/struct names: Improve
Java program:
public class Main { public static long fact ( int p ) { if ( p <= 1 ) return 1 ; return p * fact ( p - 1 ) ; } public static long isPrime ( int p ) { if ( p == 4 ) return 0 ; return ( fact ( p >> 1 ) % p ) ; } public static void main ( String [ ] args ) { if ( isPrime ( 127 ) == 0 ) { System . out . println ( 0 ) ; } else { System . out . println ( 1 ) ; } } }

Class/struct names: Main
Java program:
import java . io . * ; import java . util . * ; import java . lang . * ; class GFG { public double CountDigits ( int n ) { if ( n == 1 ) return 1 ; double sum = 0 ; for ( int i = 2 ; i <= n ; ++ i ) { sum += ( ( double ) Math . log ( i ) / ( double ) Math . log ( 10 ) ) ; } sum *= n ; return Math . ceil ( sum ) ; } public static void main ( String args [ ] ) { GFG g = new GFG ( ) ; int N = 5 ; System . out . println ( g . CountDigits ( N ) ) ; } }

Accumulator variables: sum
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static final int MAX = 200006 ; static final int CONS = 32766 ; static void calc ( int a [ ] , int b [ ] , int lr [ ] , int q , int n ) { int M , m , i , j , k , l , r , suma , sumb , cc ; cc = 0 ; for ( i = 0 ; i < n - 1 ; ++ i ) { a [ i + 1 ] += a [ i ] ; b [ i + 1 ] += b [ i ] ; } while ( q != 0 ) { l = lr [ cc ++ ] ; r = lr [ cc ++ ] ; l -= 2 ; r -= 1 ; suma = a [ r ] ; sumb = b [ r ] ; if ( l >= 0 ) { suma -= a [ l ] ; sumb -= b [ l ] ; } M = Math . max ( CONS * suma + CONS * sumb , - CONS * suma - CONS * sumb ) ; M = Math . max ( M , Math . max ( CONS * suma - CONS * sumb , - CONS * suma + CONS * sumb ) ) ; m = Math . min ( CONS * suma + CONS * sumb , - CONS * suma - CONS * sumb ) ; m = Math . min ( m , Math . min ( CONS * suma - CONS * sumb , - CONS * suma + CONS * sumb ) ) ; System . out . println ( ( M - m ) ) ; q -- ; } } public static void main ( String [ ] args ) { int n = 5 , q = 2 ; int [ ] a = { 0 , 7 , 3 , 4 , 5 } ; int [ ] b = { 0 , 3 , 1 , 2 , 3 } ; int [ ] lr = new int [ q * 2 ] ; lr [ 0 ] = 1 ; lr [ 1 ] = 1 ; lr [ 2 ] = 1 ; lr [ 3 ] = 3 ; calc ( a , b , lr , q , n ) ; } }

Index/key variables: i, l, r
Accumulator variables: cc, l, q, r, suma, sumb
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; import java . lang . * ; import java . io . * ; class GFG { static long NthTerm ( long n ) { long x = ( 3 * n * n ) % 1000000009 ; return ( x - n + 1000000009 ) % 1000000009 ; } public static void main ( String args [ ] ) { long N = 4 ; System . out . println ( NthTerm ( N ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int power [ ] = new int [ 31 ] ; static int pre [ ] = new int [ 31 ] ; static void PowerOfTwo ( ) { int x = 1 ; for ( int i = 0 ; i < 31 ; i ++ ) { power [ i ] = x ; x *= 2 ; } pre [ 0 ] = 1 ; for ( int i = 1 ; i < 31 ; i ++ ) pre [ i ] = pre [ i - 1 ] + power [ i ] ; } static int Sum ( int n ) { int ans = n * ( n + 1 ) / 2 ; for ( int i = 0 ; i < 31 ; i ++ ) { if ( power [ i ] > n ) { ans -= 2 * pre [ i - 1 ] ; break ; } } return ans ; } public static void main ( String [ ] args ) { PowerOfTwo ( ) ; int n = 4 ; System . out . println ( Sum ( n ) ) ; } }

Index/key variables: i
Accumulator variables: ans, i, x
Iterator variables: i
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 ; } public static void main ( String [ ] args ) { int n = 17 ; if ( isPrime ( n ) && ( n % 16 == 1 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } }

Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int findNumber ( int n ) { for ( int i = n - 1 ; i >= 0 ; i -- ) { int [ ] count = new int [ 10 ] ; int x = i ; int count1 = 0 , count2 = 0 ; while ( x > 0 ) { count [ x % 10 ] ++ ; x /= 10 ; count1 ++ ; } for ( int j = 0 ; j < 10 ; j ++ ) { if ( count [ j ] == 1 ) count2 ++ ; } if ( count1 == count2 ) return i ; } return - 1 ; } public static void main ( String [ ] args ) { int n = 8490 ; System . out . println ( findNumber ( n ) ) ; } }

Index/key variables: j
Accumulator variables: count1, count2, i, j, x
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static class Node { int data ; Node next ; } ; static boolean isPermutation ( Node first , Node second ) { int sum1 = 0 , sum2 = 0 , mul1 = 1 , mul2 = 1 ; Node temp1 = first ; while ( temp1 != null ) { sum1 += temp1 . data ; mul1 *= temp1 . data ; temp1 = temp1 . next ; } Node temp2 = second ; while ( temp2 != null ) { sum2 += temp2 . data ; mul2 *= temp2 . data ; temp2 = temp2 . next ; } return ( ( sum1 == sum2 ) && ( mul1 == mul2 ) ) ; } static Node push ( Node head_ref , int new_data ) { Node new_node = new Node ( ) ; new_node . data = new_data ; new_node . next = head_ref ; head_ref = new_node ; return head_ref ; } public static void main ( String [ ] args ) { Node first = null ; first = push ( first , 1 ) ; first = push ( first , 34 ) ; first = push ( first , 10 ) ; first = push ( first , 1 ) ; first = push ( first , 35 ) ; first = push ( first , 12 ) ; Node second = null ; second = push ( second , 35 ) ; second = push ( second , 1 ) ; second = push ( second , 12 ) ; second = push ( second , 1 ) ; second = push ( second , 10 ) ; second = push ( second , 34 ) ; if ( isPermutation ( first , second ) ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } }

Accumulator variables: mul1, mul2, sum1, sum2
Class/struct names: GFG, Node
Java program:
import java . util . * ; import java . lang . * ; import java . io . * ; class GFG { static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } static void solveProportion ( int a , int b1 , int b2 , int c ) { int A = a * b2 ; int B = b1 * b2 ; int C = b1 * c ; int gcd = __gcd ( __gcd ( A , B ) , C ) ; System . out . print ( A / gcd + " : " + B / gcd + " : " + C / gcd ) ; } public static void main ( String args [ ] ) { int a , b1 , b2 , c ; a = 3 ; b1 = 4 ; b2 = 8 ; c = 9 ; solveProportion ( a , b1 , b2 , c ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int countDivisors ( int n , int k ) { int count = 0 , i ; for ( i = 1 ; i <= n ; i ++ ) { if ( n % i == 0 && i % k == 0 ) { count ++ ; } } return count ; } public static void main ( String [ ] args ) { int n = 12 , k = 3 ; System . out . println ( countDivisors ( n , k ) ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG