dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
import java . util . * ; public class GFG { final static int MAXN = 1000001 ; 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 int sumFactors ( int arr [ ] , int n ) { sieve ( ) ; Map map = new HashMap ( ) ; for ( int i = 0 ; i < MAXN ; ++ i ) map . put ( i , 0 ) ; for ( int i = 0 ; i < n ; ++ i ) map . put ( arr [ i ] , 1 ) ; int sum = 0 ; for ( int i = 0 ; i < n ; ++ i ) { int num = arr [ i ] ; while ( num != 1 && ( int ) ( map . get ( spf [ num ] ) ) == 1 ) { num /= spf [ num ] ; } if ( num == 1 ) sum += arr [ i ] ; } return sum ; } public static void main ( String [ ] args ) { int arr [ ] = { 5 , 11 , 55 , 25 , 100 } ; int n = arr . length ; System . out . println ( sumFactors ( arr , n ) ) ; } }

Index/key variables: MAXN, i, j, num
Accumulator variables: i, j, num, sum
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int doubleFactorial ( int n ) { int fact = 1 ; for ( int i = 1 ; i <= n ; i = i + 2 ) { fact = fact * i ; } return fact ; } static int hermiteNumber ( int n ) { if ( n % 2 == 1 ) return 0 ; else { int number = ( int ) ( Math . pow ( 2 , n / 2 ) ) * doubleFactorial ( n - 1 ) ; if ( ( n / 2 ) % 2 == 1 ) number = number * - 1 ; return number ; } } public static void main ( String [ ] args ) { int n = 6 ; System . out . println ( hermiteNumber ( n ) ) ; } }

Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int N = 1000005 ; static long MAX = ( long ) 1e18 ; static Vector < Long > powers = new Vector < > ( ) ; static TreeSet < Long > squares = new TreeSet < > ( ) ; static TreeSet < Long > s = new TreeSet < > ( ) ; static void powersPrecomputation ( ) { for ( long i = 2 ; i < N ; i ++ ) { squares . add ( i * i ) ; if ( squares . contains ( i ) ) continue ; long temp = i ; while ( i * i <= MAX / temp ) { temp *= ( i * i ) ; s . add ( temp ) ; } } for ( long x : s ) powers . add ( x ) ; } static long calculateAnswer ( long L , long R ) { powersPrecomputation ( ) ; long perfectSquares = ( long ) ( Math . floor ( Math . sqrt ( R ) ) - Math . floor ( Math . sqrt ( L - 1 ) ) ) ; long high = Collections . binarySearch ( powers , R ) ; long low = Collections . binarySearch ( powers , L ) ; long perfectPowers = perfectSquares + ( high - low ) ; long ans = ( R - L + 1 ) - perfectPowers ; return ans ; } public static void main ( String [ ] args ) { long L = 13 , R = 20 ; System . out . println ( calculateAnswer ( L , R ) ) ; } }

Accumulator variables: i, temp
Iterator variables: i, x
Class/struct names: GFG
Java program:
import java . util . * ; class solution { static long getSum ( int n , int d ) { long sum = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { if ( i % 10 == d ) sum += i ; } return sum ; } public static void main ( String args [ ] ) { int n = 30 , d = 3 ; System . out . println ( getSum ( n , d ) ) ; } }

Accumulator variables: i, sum
Iterator variables: i
Class/struct names: solution
Java program:
import java . util . * ; class solution { static void printThreeParts ( int N ) { if ( N % 3 == 0 ) System . out . println ( " x ▁ = ▁ 1 , ▁ y ▁ = ▁ 1 , ▁ z ▁ = ▁ " + ( N - 2 ) ) ; else System . out . println ( " ▁ x ▁ = ▁ 1 , ▁ y ▁ = ▁ 2 , ▁ z ▁ = ▁ " + ( N - 3 ) ) ; } public static void main ( String args [ ] ) { int N = 10 ; printThreeParts ( N ) ; } }

Class/struct names: solution
Java program:
class GFG { static boolean isPrime ( int N ) { for ( int i = 2 ; i <= Math . sqrt ( N ) ; i ++ ) { if ( N % i == 0 ) return false ; } return true ; } static int getDifference ( int N ) { if ( N == 0 ) return 2 ; else if ( N == 1 ) return 1 ; else if ( isPrime ( N ) ) return 0 ; int aboveN = - 1 , belowN = - 1 ; int n1 ; n1 = N + 1 ; while ( true ) { if ( isPrime ( n1 ) ) { aboveN = n1 ; break ; } else n1 ++ ; } n1 = N - 1 ; while ( true ) { if ( isPrime ( n1 ) ) { belowN = n1 ; break ; } else n1 -- ; } int diff1 = aboveN - N ; int diff2 = N - belowN ; return Math . min ( diff1 , diff2 ) ; } public static void main ( String args [ ] ) { int N = 25 ; System . out . println ( getDifference ( N ) ) ; } }

Accumulator variables: i, n1
Iterator variables: i
Class/struct names: GFG
Java program:
public class GFG { static boolean check ( int arr [ ] , int x , int n ) { long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { double y = Math . sqrt ( arr [ i ] ) ; if ( Math . floor ( y ) == Math . ceil ( y ) ) { sum += arr [ i ] ; } } if ( sum % x == 0 ) return true ; else return false ; } public static void main ( String [ ] args ) { int arr [ ] = { 2 , 3 , 4 , 9 , 10 } ; int n = arr . length ; int x = 13 ; if ( check ( arr , x , n ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class Main { static int MAX = ( int ) 1e5 ; public static int findLargestDivisor ( int n ) { int m = n ; Set < Integer > s = new HashSet < Integer > ( ) ; s . add ( 1 ) ; s . add ( n ) ; for ( int i = 2 ; i < ( int ) Math . sqrt ( n ) + 1 ; i ++ ) { if ( n % i == 0 ) { s . add ( n / i ) ; s . add ( i ) ; while ( m % i == 0 ) m /= i ; } } if ( m > 1 ) s . add ( m ) ; List < Integer > l = new ArrayList < Integer > ( s ) ; Collections . sort ( l ) ; Collections . reverse ( l ) ; Vector < Integer > vec = new Vector < Integer > ( ) ; for ( int i = 2 ; i <= MAX ; i ++ ) vec . add ( i * i ) ; for ( int d : l ) { int divi = 0 ; for ( int j = 0 ; j < vec . size ( ) && vec . get ( j ) <= d ; j ++ ) { if ( d % vec . get ( j ) == 0 ) { divi = 1 ; break ; } } if ( divi == 0 ) return d ; } return 0 ; } public static void main ( String [ ] args ) { int n = 12 ; System . out . println ( findLargestDivisor ( n ) ) ; n = 97 ; System . out . println ( findLargestDivisor ( n ) ) ; } }

Accumulator variables: i, j, m
Iterator variables: d, i, j
Class/struct names: Main
Java program:
import java . util . * ; class Solution { static int NCR ( int n , int r ) { int numerator = 1 ; int denominator = 1 ; while ( r > 0 ) { numerator *= n ; denominator *= r ; n -- ; r -- ; } return ( numerator / denominator ) ; } static int findWays ( int arr [ ] , int n ) { HashMap < Integer , Integer > count = new HashMap < Integer , Integer > ( ) ; if ( n < 4 ) return 0 ; for ( int i = 0 ; i < n ; i ++ ) { count . put ( arr [ i ] , ( count . get ( arr [ i ] ) == null ? 0 int ) count . get ( arr [ i ] ) ) ) ; } int remaining_choices = 4 ; int ans = 1 ; Iterator hmIterator = count . entrySet ( ) . iterator ( ) ; while ( hmIterator . hasNext ( ) ) { Map . Entry mapElement = ( Map . Entry ) hmIterator . next ( ) ; int number = ( int ) mapElement . getKey ( ) ; int frequency = ( int ) mapElement . getValue ( ) ; int toSelect = Math . min ( remaining_choices , frequency ) ; ans = ans * NCR ( frequency , toSelect ) ; remaining_choices -= toSelect ; if ( remaining_choices == 0 ) { break ; } } return ans ; } public static void main ( String args [ ] ) { int arr [ ] = { 1 , 2 , 3 , 3 , 3 , 5 } ; int n = arr . length ; int maxQuadrupleWays = findWays ( arr , n ) ; System . out . print ( maxQuadrupleWays ) ; } }

Index/key variables: i
Accumulator variables: denominator, i, n, numerator, r, remaining_choices
Iterator variables: i
Class/struct names: Solution
Java program:
import java . io . * ; class GFG { static void MinimumMaximumPairs ( int n , int m ) { int max_pairs = ( ( n - m + 1 ) * ( n - m ) ) / 2 ; int min_pairs = m * ( ( ( n - m ) / m + 1 ) * ( ( n - m ) / m ) ) / 2 + ( int ) Math . ceil ( ( double ) ( ( n - m ) / ( double ) ( m ) ) ) * ( ( n - m ) % m ) ; System . out . println ( " Minimum ▁ no . ▁ of ▁ pairs ▁ = ▁ " + min_pairs ) ; System . out . println ( " Maximum ▁ no . ▁ of ▁ pairs ▁ = ▁ " + max_pairs ) ; } public static void main ( String [ ] args ) { int n = 5 , m = 2 ; MinimumMaximumPairs ( n , m ) ; } }

Class/struct names: GFG
Java program:
public class GFG { static void findGreater ( int a , int b ) { double x = ( double ) a * ( double ) ( Math . log ( ( double ) ( b ) ) ) ; double y = ( double ) b * ( double ) ( Math . log ( ( double ) ( a ) ) ) ; if ( y > x ) { System . out . println ( " a ^ b ▁ is ▁ greater " ) ; } else if ( y < x ) { System . out . println ( " b ^ a ▁ is ▁ greater " ) ; } else { System . out . println ( " Both ▁ are ▁ equal " ) ; } } public static void main ( String [ ] args ) { int a = 3 , b = 5 , c = 2 , d = 4 ; findGreater ( a , b ) ; findGreater ( c , d ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static long m = 1000000007 ; static long gcd ( long a , long b ) { if ( a == 0 ) return b ; return gcd ( b % a , a ) ; } static long modexp ( long x , long n ) { if ( n == 0 ) { return 1 ; } else if ( n % 2 == 0 ) { return modexp ( ( x * x ) % m , n / 2 ) ; } else { return ( x * modexp ( ( x * x ) % m , ( n - 1 ) / 2 ) % m ) ; } } static long getFractionModulo ( long a , long b ) { long c = gcd ( a , b ) ; a = a / c ; b = b / c ; long d = modexp ( b , m - 2 ) ; long ans = ( ( a % m ) * ( d % m ) ) % m ; return ans ; } public static void main ( String [ ] args ) { long a = 2 , b = 6 ; System . out . println ( getFractionModulo ( a , b ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int maxPrimeFactors ( int n ) { int num = n ; int maxPrime = - 1 ; while ( n % 2 == 0 ) { maxPrime = 2 ; n /= 2 ; } for ( int i = 3 ; i <= Math . sqrt ( n ) ; i += 2 ) { while ( n % i == 0 ) { maxPrime = i ; n = n / i ; } } if ( n > 2 ) { maxPrime = n ; } int sum = maxPrime + num ; return sum ; } public static void main ( String [ ] args ) { int n = 19 ; System . out . println ( maxPrimeFactors ( n ) ) ; } }

Accumulator variables: i, n
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int sumOfDigits ( int n ) { int res = 0 ; while ( n > 0 ) { res += n % 10 ; n /= 10 ; } return res ; } static int findNumber ( int n ) { int i = n - 1 ; while ( i > 0 ) { if ( sumOfDigits ( i ) > sumOfDigits ( n ) ) return i ; i -- ; } return - 1 ; } public static void main ( String [ ] args ) { int n = 824 ; System . out . println ( findNumber ( n ) ) ; } }

Accumulator variables: i, n, res
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int findNth ( int N ) { int b = 14 ; int i ; for ( i = 2 ; i <= N ; i ++ ) { if ( i % 2 == 0 ) b = b * 2 ; else b = b - 8 ; } return b ; } public static void main ( String [ ] args ) { int N = 6 ; System . out . print ( findNth ( N ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
public class GFG { final static int N = 4 ; static void predictMatrix ( int arr [ ] [ ] , int range1a , int range1b , int range0a , int range0b , int K , int b [ ] [ ] ) { int c = 0 ; while ( K != 0 ) { K -- ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) { c = 0 ; if ( i > 0 && arr [ i - 1 ] [ j ] == 1 ) c ++ ; if ( j > 0 && arr [ i ] [ j - 1 ] == 1 ) c ++ ; if ( i > 0 && j > 0 && arr [ i - 1 ] [ j - 1 ] == 1 ) c ++ ; if ( i < N - 1 && arr [ i + 1 ] [ j ] == 1 ) c ++ ; if ( j < N - 1 && arr [ i ] [ j + 1 ] == 1 ) c ++ ; if ( i < N - 1 && j < N - 1 && arr [ i + 1 ] [ j + 1 ] == 1 ) c ++ ; if ( i < N - 1 && j > 0 && arr [ i + 1 ] [ j - 1 ] == 1 ) c ++ ; if ( i > 0 && j < N - 1 && arr [ i - 1 ] [ j + 1 ] == 1 ) c ++ ; if ( arr [ i ] [ j ] == 1 ) { if ( c >= range1a && c <= range1b ) b [ i ] [ j ] = 1 ; else b [ i ] [ j ] = 0 ; } if ( arr [ i ] [ j ] == 0 ) { if ( c >= range0a && c <= range0b ) b [ i ] [ j ] = 1 ; else b [ i ] [ j ] = 0 ; } } } for ( int k = 0 ; k < N ; k ++ ) for ( int m = 0 ; m < N ; m ++ ) arr [ k ] [ m ] = b [ k ] [ m ] ; } } public static void main ( String [ ] args ) { int arr [ ] [ ] = { { 0 , 0 , 0 , 0 } , { 0 , 1 , 1 , 0 } , { 0 , 0 , 1 , 0 } , { 0 , 1 , 0 , 1 } } ; int range1a = 2 , range1b = 2 ; int range0a = 2 , range0b = 3 ; int K = 3 ; int b [ ] [ ] = new int [ N ] [ N ] ; predictMatrix ( arr , range1a , range1b , range0a , range0b , K , b ) ; for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( ) ; for ( int j = 0 ; j < N ; j ++ ) System . out . print ( b [ i ] [ j ] + " ▁ " ) ; } } }

Index/key variables: N, i, j, k, m
Accumulator variables: K, c, i, j, k, m
Iterator variables: i, j, k, m
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int countMoves ( int n ) { int ct = 0 ; for ( int i = 1 ; i <= n ; i ++ ) ct += i * ( n - i ) ; ct += n ; return ct ; } public static void main ( String [ ] args ) { int n = 3 ; System . out . println ( countMoves ( n ) ) ; } }

Accumulator variables: ct, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; public class GFG { public static ArrayList < Integer > getPerfectSquares ( int n ) { ArrayList < Integer > perfectSquares = new ArrayList < > ( ) ; int current = 1 , i = 1 ; while ( current <= n ) { perfectSquares . add ( current ) ; current = ( int ) Math . pow ( ++ i , 2 ) ; } return perfectSquares ; } public static int countTriplets ( int n ) { ArrayList < Integer > perfectSquares = getPerfectSquares ( ( int ) Math . pow ( n , 2 ) ) ; int count = 0 ; for ( int a = 1 ; a <= n ; a ++ ) { int aSquare = ( int ) Math . pow ( a , 2 ) ; for ( int i = 0 ; i < perfectSquares . size ( ) ; i ++ ) { int cSquare = perfectSquares . get ( i ) ; int bSquare = cSquare - aSquare ; int b = ( int ) Math . sqrt ( bSquare ) ; int c = ( int ) Math . sqrt ( cSquare ) ; if ( c < a || ! perfectSquares . contains ( bSquare ) ) continue ; if ( ( b >= a ) && ( b <= c ) && ( aSquare + bSquare == cSquare ) ) count ++ ; } } return count ; } public static void main ( String [ ] args ) { int n = 10 ; System . out . println ( countTriplets ( n ) ) ; } }

Accumulator variables: a, count, i
Iterator variables: a, i
Class/struct names: GFG
Java program:
import java . lang . * ; import java . util . * ; class GFG { static double countNumbers ( int N ) { return ( Math . pow ( 10 , N ) - 1 ) - ( Math . pow ( 10 , N ) - Math . pow ( 8 , N ) ) / 2 ; } static public void main ( String args [ ] ) { int n = 2 ; System . out . println ( countNumbers ( n ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; import java . lang . * ; class GFG { static int N = 3 ; static double calcDeterminant ( int arr [ ] ) { double determinant = 0 ; for ( int i = 0 ; i < N ; i ++ ) { determinant += Math . pow ( arr [ i ] , 3 ) ; } determinant -= 3 * arr [ 0 ] * arr [ 1 ] * arr [ 2 ] ; return determinant ; } static public void main ( String args [ ] ) { int [ ] arr = { 4 , 5 , 3 } ; System . out . println ( calcDeterminant ( arr ) ) ; } }

Index/key variables: i
Accumulator variables: determinant, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int minimumMoves ( int k , int l , int r ) { int count = r - l + 1 ; if ( count % k == 0 ) return 0 ; return ( k - ( count % k ) ) ; } public static void main ( String [ ] args ) { int k = 3 , l = 10 , r = 10 ; System . out . print ( minimumMoves ( k , l , r ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int sumNatural ( int n ) { int sum = ( n * ( n + 1 ) ) ; return sum ; } static int sumEven ( int l , int r ) { return sumNatural ( r / 2 ) - sumNatural ( ( l - 1 ) / 2 ) ; } public static void main ( String [ ] args ) { int l = 2 , r = 5 ; System . out . println ( " Sum ▁ of ▁ Natural ▁ numbers ▁ from ▁ L ▁ to ▁ R ▁ is ▁ " + sumEven ( l , r ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class solution { static boolean isDivisibleRec ( int x , int a , int b , int n ) { if ( x > n ) return false ; if ( n % x == 0 ) return true ; return ( isDivisibleRec ( x * 10 + a , a , b , n ) || isDivisibleRec ( x * 10 + b , a , b , n ) ) ; } static boolean isDivisible ( int a , int b , int n ) { return isDivisibleRec ( a , a , b , n ) || isDivisibleRec ( b , a , b , n ) ; } public static void main ( String args [ ] ) { int a = 3 , b = 5 , n = 53 ; if ( isDivisible ( a , b , n ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Class/struct names: solution
Java program:
import java . io . * ; class GFG { static void MinSteps ( int SourceX , int SourceY , int DestX , int DestY ) { System . out . println ( Math . max ( Math . abs ( SourceX - DestX ) , Math . abs ( SourceY - DestY ) ) ) ; while ( ( SourceX != DestX ) || ( SourceY != DestY ) ) { if ( SourceX < DestX ) { System . out . print ( ' U ' ) ; SourceX ++ ; } if ( SourceX > DestX ) { System . out . println ( ' D ' ) ; SourceX -- ; } if ( SourceY > DestY ) { System . out . print ( ' L ' ) ; SourceY -- ; } if ( SourceY < DestY ) { System . out . print ( ' R ' ) ; SourceY ++ ; } System . out . println ( ) ; } } public static void main ( String [ ] args ) { int sourceX = 4 , sourceY = 4 ; int destinationX = 7 , destinationY = 0 ; MinSteps ( sourceX , sourceY , destinationX , destinationY ) ; } }

Accumulator variables: SourceX, SourceY
Class/struct names: GFG
Java program:
import java . util . * ; public class GFG { public static ArrayList < Integer > getPerfectSquares ( int n ) { ArrayList < Integer > perfectSquares = new ArrayList < > ( ) ; int current = 1 , i = 1 ; while ( current <= n ) { perfectSquares . add ( current ) ; current = ( int ) Math . pow ( ++ i , 2 ) ; } return perfectSquares ; } public static int maxPairSum ( int arr [ ] ) { int n = arr . length ; int max , secondMax ; if ( arr [ 0 ] > arr [ 1 ] ) { max = arr [ 0 ] ; secondMax = arr [ 1 ] ; } else { max = arr [ 1 ] ; secondMax = arr [ 0 ] ; } for ( int i = 2 ; i < n ; i ++ ) { if ( arr [ i ] > max ) { secondMax = max ; max = arr [ i ] ; } else if ( arr [ i ] > secondMax ) { secondMax = arr [ i ] ; } } return ( max + secondMax ) ; } public static int countPairsWith ( int n , ArrayList < Integer > perfectSquares , HashSet < Integer > nums ) { int count = 0 ; for ( int i = 0 ; i < perfectSquares . size ( ) ; i ++ ) { int temp = perfectSquares . get ( i ) - n ; if ( temp > n && nums . contains ( temp ) ) count ++ ; } return count ; } public static int countPairs ( int arr [ ] ) { int i , n = arr . length ; int max = maxPairSum ( arr ) ; ArrayList < Integer > perfectSquares = getPerfectSquares ( max ) ; HashSet < Integer > nums = new HashSet < > ( ) ; for ( i = 0 ; i < n ; i ++ ) nums . add ( arr [ i ] ) ; int count = 0 ; for ( i = 0 ; i < n ; i ++ ) { count += countPairsWith ( arr [ i ] , perfectSquares , nums ) ; } return count ; } public static void main ( String [ ] args ) { int arr [ ] = { 2 , 3 , 6 , 9 , 10 , 20 } ; System . out . println ( countPairs ( arr ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int findEle ( int arr [ ] , int n ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum += arr [ i ] ; for ( int i = 0 ; i < n ; i ++ ) if ( arr [ i ] == sum - arr [ i ] ) return arr [ i ] ; return - 1 ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 , 3 , 6 } ; int n = arr . length ; System . out . print ( findEle ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int sumNatural ( int n ) { int sum = ( n * ( n + 1 ) ) / 2 ; return sum ; } static int suminRange ( int l , int r ) { return sumNatural ( r ) - sumNatural ( l - 1 ) ; } public static void main ( String [ ] args ) { int l = 2 , r = 5 ; System . out . println ( " Sum ▁ of ▁ Natural ▁ numbers ▁ from ▁ L ▁ to ▁ R ▁ is ▁ " + suminRange ( l , r ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static boolean divisibleBy3 ( String number ) { int sumOfDigit = 0 ; for ( int i = 0 ; i < number . length ( ) ; i ++ ) sumOfDigit += number . charAt ( i ) - '0' ; if ( sumOfDigit % 3 == 0 ) return true ; return false ; } static boolean divisibleBy25 ( String number ) { if ( number . length ( ) < 2 ) return false ; int length = number . length ( ) ; int lastTwo = ( number . charAt ( length - 2 ) - '0' ) * 10 + ( number . charAt ( length - 1 ) - '0' ) ; if ( lastTwo % 25 == 0 ) return true ; return false ; } static boolean divisibleBy75 ( String number ) { if ( divisibleBy3 ( number ) && divisibleBy25 ( number ) ) return true ; return false ; } public static void main ( String [ ] args ) { String number = "754586672150" ; boolean divisible = divisibleBy75 ( number ) ; if ( divisible ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Accumulator variables: i, sumOfDigit
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int otherNumber ( int A , int Lcm , int Hcf ) { return ( Lcm * Hcf ) / A ; } public static void main ( String args [ ] ) { int A = 8 , Lcm = 8 , Hcf = 1 ; int result = otherNumber ( A , Lcm , Hcf ) ; System . out . println ( " B ▁ = ▁ " + result ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static float successiveChange ( int arr [ ] , int N ) { float var1 , var2 , result = 0 ; var1 = arr [ 0 ] ; var2 = arr [ 1 ] ; result = var1 + var2 + ( ( var1 * var2 ) / 100 ) ; for ( int i = 2 ; i < N ; i ++ ) result = result + arr [ i ] + ( ( result * arr [ i ] ) / 100 ) ; return result ; } public static void main ( String [ ] args ) { int [ ] arr = { 10 , 20 , 30 , 10 } ; int N = arr . length ; float result = successiveChange ( arr , N ) ; System . out . println ( " Percentage ▁ change ▁ is ▁ = ▁ " + result + " ▁ % " ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int minimumNumbers ( int n , int s ) { if ( ( s % n ) > 0 ) return s / n + 1 ; else return s / n ; } public static void main ( String [ ] args ) { int n = 5 ; int s = 11 ; System . out . println ( minimumNumbers ( n , s ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static int __gcd ( int a , int b ) { if ( b == 0 ) return a ; return __gcd ( b , a % b ) ; } static int sumAP ( int n , int d ) { n /= d ; return ( n ) * ( 1 + n ) * d / 2 ; } static int sumMultiples ( int A , int B , int n ) { n -- ; int common = ( A * B ) / __gcd ( A , B ) ; return sumAP ( n , A ) + sumAP ( n , B ) - sumAP ( n , common ) ; } public static void main ( String [ ] args ) { int n = 100 , A = 5 , B = 10 ; System . out . println ( " Sum ▁ = ▁ " + sumMultiples ( A , B , n ) ) ; } }

Accumulator variables: n
Class/struct names: GFG
Java program:
public class GFG { static boolean isPrime ( int n ) { if ( n <= 1 ) return false ; for ( int i = 2 ; i <= Math . sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) return false ; } return true ; } static boolean isPossible ( int N ) { if ( isPrime ( N ) && isPrime ( N - 2 ) ) return true ; else return false ; } public static void main ( String [ ] args ) { int n = 13 ; if ( isPossible ( n ) == true ) 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 class pair { int first , second ; public pair ( int first , int second ) { this . first = first ; this . second = second ; } } static int totalPairs ( int [ ] arr1 , int [ ] arr2 , int K , int n , int m ) { HashSet < pair > s = new HashSet < pair > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { if ( arr1 [ i ] > arr2 [ j ] ) { if ( arr1 [ i ] % arr2 [ j ] == K ) s . add ( new pair ( arr1 [ i ] , arr2 [ j ] ) ) ; } else { if ( arr2 [ j ] % arr1 [ i ] == K ) s . add ( new pair ( arr2 [ j ] , arr1 [ i ] ) ) ; } } } return s . size ( ) ; } public static void main ( String [ ] args ) { int [ ] arr1 = { 8 , 3 , 7 , 50 } ; int [ ] arr2 = { 5 , 1 , 10 , 4 } ; int K = 3 ; int n = arr1 . length ; int m = arr2 . length ; System . out . println ( totalPairs ( arr1 , arr2 , K , n , m ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG, pair