dhyuti-n/xlcost-variable-roles huggingface dataset:
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 __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } static void sumOfSquares ( int n , Vector < pair > vp ) { for ( int i = 1 ; i <= Math . sqrt ( n ) ; i ++ ) { int h = n - i * i , h1 = ( int ) Math . sqrt ( h ) ; if ( h1 * h1 == h ) { int a = Math . max ( h1 , i ) , b = Math . min ( h1 , i ) ; if ( vp . size ( ) == 1 && a != vp . get ( 0 ) . first ) vp . add ( new pair ( a , b ) ) ; if ( vp . size ( ) == 0 ) vp . add ( new pair ( a , b ) ) ; if ( vp . size ( ) == 2 ) return ; } } } static void findFactors ( int n ) { Vector < pair > vp = new Vector < > ( ) ; sumOfSquares ( n , vp ) ; if ( vp . size ( ) != 2 ) System . out . print ( " Factors ▁ Not ▁ Possible " ) ; int a , b , c , d ; a = vp . get ( 0 ) . first ; b = vp . get ( 0 ) . second ; c = vp . get ( 1 ) . first ; d = vp . get ( 1 ) . second ; if ( a < c ) { int t = a ; a = c ; c = t ; t = b ; b = d ; d = t ; } int k , h , l , m ; k = __gcd ( a - c , d - b ) ; h = __gcd ( a + c , d + b ) ; l = ( a - c ) / k ; m = ( d - b ) / k ; System . out . print ( " a ▁ = ▁ " + a + " TABSYMBOL TABSYMBOL ( A ) ▁ a ▁ - ▁ c ▁ = ▁ " + ( a - c ) + " TABSYMBOL TABSYMBOL k ▁ = ▁ gcd [ A , ▁ C ] ▁ = ▁ " + k + "NEW_LINE"); System . out . print ( " b ▁ = ▁ " + b + " TABSYMBOL TABSYMBOL ( B ) ▁ a ▁ + ▁ c ▁ = ▁ " + ( a + c ) + " TABSYMBOL TABSYMBOL h ▁ = ▁ gcd [ B , ▁ D ] ▁ = ▁ " + h + "NEW_LINE"); System . out . print ( " c ▁ = ▁ " + c + " TABSYMBOL TABSYMBOL ( C ) ▁ d ▁ - ▁ b ▁ = ▁ " + ( d - b ) + " TABSYMBOL TABSYMBOL l ▁ = ▁ A / k ▁ = ▁ " + l + "NEW_LINE"); System . out . print ( " d ▁ = ▁ " + d + " TABSYMBOL TABSYMBOL ( D ) ▁ d ▁ + ▁ b ▁ = ▁ " + ( d + b ) + " TABSYMBOL TABSYMBOL m ▁ = ▁ c / k ▁ = ▁ " + m + "NEW_LINE"); if ( k % 2 == 0 && h % 2 == 0 ) { k = k / 2 ; h = h / 2 ; System . out . print ( " Factors ▁ are : ▁ " + ( ( k ) * ( k ) + ( h ) * ( h ) ) + " ▁ " + ( l * l + m * m ) + "NEW_LINE"); } else { l = l / 2 ; m = m / 2 ; System . out . print ( " Factors ▁ are : ▁ " + ( ( l ) * ( l ) + ( m ) * ( m ) ) + " ▁ " + ( k * k + h * h ) + "NEW_LINE"); } } public static void main ( String [ ] args ) { int n = 100000 ; findFactors ( n ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG, pair
Java program:
import java . util . * ; class GFG { static final int MAX = 100000 ; @ SuppressWarnings ( " unchecked " ) static Vector < Integer > [ ] graph = new Vector [ MAX + 1 ] ; static boolean [ ] Prime = new boolean [ MAX + 1 ] ; static int [ ] height = new int [ MAX + 1 ] ; static void SieveOfEratosthenes ( ) { int i , j ; Prime [ 0 ] = Prime [ 1 ] = false ; for ( i = 2 ; i * i <= MAX ; i ++ ) { if ( Prime [ i ] ) { for ( j = 2 * i ; j < MAX ; j += i ) { Prime [ j ] = false ; } } } } static void dfs ( int node , int parent , int h ) { height [ node ] = h ; for ( int to : graph [ node ] ) { if ( to == parent ) continue ; dfs ( to , node , h + 1 ) ; } } static void primeHeightNode ( int N ) { SieveOfEratosthenes ( ) ; for ( int i = 1 ; i <= N ; i ++ ) { if ( Prime [ height [ i ] ] ) { System . out . print ( i + " ▁ " ) ; } } } public static void main ( String [ ] args ) { int N = 5 ; for ( int i = 0 ; i < Prime . length ; i ++ ) Prime [ i ] = true ; for ( int i = 0 ; i < graph . length ; i ++ ) graph [ i ] = new Vector < Integer > ( ) ; graph [ 1 ] . add ( 2 ) ; graph [ 1 ] . add ( 3 ) ; graph [ 2 ] . add ( 4 ) ; graph [ 2 ] . add ( 5 ) ; dfs ( 1 , 1 , 0 ) ; primeHeightNode ( N ) ; } }

Index/key variables: i, j, node
Accumulator variables: i, j
Iterator variables: i, j, to
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { public static int reverse ( int a ) { int rev = 0 ; while ( a != 0 ) { int r = a % 10 ; rev = rev * 10 + r ; a = a / 10 ; } return ( rev ) ; } public static int prime ( int a ) { int k = 0 ; for ( int i = 2 ; i < a ; i ++ ) { if ( a % i == 0 ) { k = 1 ; break ; } } if ( k == 1 ) { return ( 0 ) ; } else { return ( 1 ) ; } } public static int adam ( int a ) { int r1 = reverse ( a ) ; int s1 = a * a ; int s2 = r1 * r1 ; int r2 = reverse ( s2 ) ; if ( s1 == r2 ) { return ( 1 ) ; } else { return ( 0 ) ; } } public static void find ( int m , int n ) { if ( m > n ) { System . out . println ( " ▁ INVALID ▁ INPUT ▁ " ) ; } else { int c = 0 ; for ( int i = m ; i <= n ; i ++ ) { int l = prime ( i ) ; int k = adam ( i ) ; if ( ( l == 1 ) && ( k == 1 ) ) { System . out . print ( i + " TABSYMBOL " ) ; } } } } public static void main ( String [ ] args ) { int L = 5 , R = 100 ; find ( L , R ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int sumDig ( int n ) { int s = 0 ; while ( n != 0 ) { s = s + ( n % 10 ) ; n = n / 10 ; } return s ; } static boolean Pec ( int n ) { int dup = n ; int dig = sumDig ( n ) ; if ( dig * 3 == dup ) return true ; else return false ; } public static void main ( String [ ] args ) { int n = 36 ; if ( Pec ( n ) == true ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int digit_sum ( int n ) { int sum = 0 , m ; while ( n > 0 ) { m = n % 10 ; sum = sum + m ; n = n / 10 ; } return ( sum ) ; } static int reverse ( int n ) { int r = 0 ; while ( n != 0 ) { r = r * 10 ; r = r + n % 10 ; n = n / 10 ; } return ( r ) ; } static void operation ( int n ) { int i = 1 , a , count = 0 , r ; while ( count < n ) { a = digit_sum ( i ) ; r = reverse ( i ) ; if ( i % a == 0 && r % a == 0 ) { System . out . print ( i + " ▁ " ) ; count ++ ; i ++ ; } else i ++ ; } } public static void main ( String args [ ] ) { int n = 10 ; operation ( n ) ; } }

Accumulator variables: count, i
Class/struct names: GFG
Java program:
class GFG { static void createSets ( int N ) { if ( N <= 2 ) { System . out . println ( " - 1" ) ; return ; } for ( int i = 2 ; i <= N ; i += 2 ) System . out . print ( i + " ▁ " ) ; System . out . print ( "NEW_LINE") ; for ( int i = 1 ; i <= N ; i += 2 ) { System . out . print ( i + " ▁ " ) ; } } public static void main ( String [ ] args ) { int N = 6 ; createSets ( N ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int ans = 0 ; static Vector < Integer > [ ] graph = new Vector [ 100 ] ; static int [ ] weight = new int [ 100 ] ; static boolean isPowerful ( int n ) { while ( n % 2 == 0 ) { int power = 0 ; while ( n % 2 == 0 ) { n /= 2 ; power ++ ; } if ( power == 1 ) return false ; } for ( int factor = 3 ; factor <= Math . sqrt ( n ) ; factor += 2 ) { int power = 0 ; while ( n % factor == 0 ) { n = n / factor ; power ++ ; } if ( power == 1 ) return false ; } return ( n == 1 ) ; } static void dfs ( int node , int parent ) { if ( isPowerful ( weight [ node ] ) ) ans += 1 ; for ( int to : graph [ node ] ) { if ( to == parent ) continue ; dfs ( to , node ) ; } } public static void main ( String [ ] args ) { for ( int i = 0 ; i < graph . length ; i ++ ) graph [ i ] = new Vector < Integer > ( ) ; weight [ 1 ] = 5 ; weight [ 2 ] = 10 ; weight [ 3 ] = 11 ; weight [ 4 ] = 8 ; weight [ 5 ] = 6 ; graph [ 1 ] . add ( 2 ) ; graph [ 2 ] . add ( 3 ) ; graph [ 2 ] . add ( 4 ) ; graph [ 1 ] . add ( 5 ) ; dfs ( 1 , 1 ) ; System . out . print ( ans ) ; } }

Index/key variables: i, node
Accumulator variables: ans, factor, i, n, power
Iterator variables: factor, i, to
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int CountWays ( int N , int M ) { int count = 1 ; count = ( int ) Math . pow ( 3 , M + N ) ; count *= ( int ) Math . pow ( 2 , M * N ) ; return count ; } public static void main ( String args [ ] ) { int N = 3 ; int M = 2 ; System . out . println ( CountWays ( N , M ) ) ; } }

Accumulator variables: count
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void findNthNumber ( int N ) { int [ ] arr = new int [ N + 1 ] ; Queue < Integer > q = new LinkedList < > ( ) ; for ( int i = 1 ; i <= 9 ; i ++ ) q . add ( i ) ; for ( int i = 1 ; i <= N ; i ++ ) { arr [ i ] = q . peek ( ) ; q . remove ( ) ; if ( arr [ i ] % 10 != 0 ) q . add ( arr [ i ] * 10 + arr [ i ] % 10 - 1 ) ; q . add ( arr [ i ] * 10 + arr [ i ] % 10 ) ; if ( arr [ i ] % 10 != 9 ) q . add ( arr [ i ] * 10 + arr [ i ] % 10 + 1 ) ; } System . out . println ( arr [ N ] ) ; } public static void main ( String [ ] args ) { int N = 21 ; findNthNumber ( N ) ; } }

Index/key variables: N, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void findUniqueElements ( int arr [ ] , int N , int K ) { Set < Integer > s = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) s . add ( arr [ i ] ) ; int arr_sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) arr_sum += arr [ i ] ; int set_sum = 0 ; Iterator it = s . iterator ( ) ; while ( it . hasNext ( ) ) { set_sum += ( int ) it . next ( ) ; } System . out . println ( ( K * set_sum - arr_sum ) / ( K - 1 ) ) ; } public static void main ( String [ ] args ) { int arr [ ] = { 12 , 1 , 12 , 3 , 12 , 1 , 1 , 2 , 3 , 2 , 2 , 3 , 7 } ; int N = arr . length ; int K = 3 ; findUniqueElements ( arr , N , K ) ; } }

Index/key variables: i
Accumulator variables: arr_sum, i, set_sum
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void findEquation ( int a , int b , int c ) { int X = ( a + b + c ) ; int Y = ( a * b ) + ( b * c ) + ( c * a ) ; int Z = a * b * c ; System . out . print ( " x ^ 3 ▁ - ▁ " + X + " x ^ 2 ▁ + ▁ " + Y + " x ▁ - ▁ " + Z + " ▁ = ▁ 0" ) ; } public static void main ( String [ ] args ) { int a = 5 , b = 2 , c = 3 ; findEquation ( a , b , c ) ; } }

Class/struct names: GFG
Java program:
class GFG { static double dydx ( double x , double y ) { return ( x - y ) / 2 ; } static double Gill ( double x0 , double y0 , double x , double h ) { int n = ( int ) ( ( x - x0 ) / h ) ; double k1 , k2 , k3 , k4 ; double y = y0 ; for ( int i = 1 ; i <= n ; i ++ ) { k1 = h * dydx ( x0 , y ) ; k2 = h * dydx ( x0 + 0.5 * h , y + 0.5 * k1 ) ; k3 = h * dydx ( x0 + 0.5 * h , y + 0.5 * ( - 1 + Math . sqrt ( 2 ) ) * k1 + k2 * ( 1 - 0.5 * Math . sqrt ( 2 ) ) ) ; k4 = h * dydx ( x0 + h , y - ( 0.5 * Math . sqrt ( 2 ) ) * k2 + k3 * ( 1 + 0.5 * Math . sqrt ( 2 ) ) ) ; y = y + ( 1.0 / 6 ) * ( k1 + ( 2 - Math . sqrt ( 2 ) ) * k2 + ( 2 + Math . sqrt ( 2 ) ) * k3 + k4 ) ; x0 = x0 + h ; } return y ; } public static void main ( String [ ] args ) { double x0 = 0 , y = 3.0 , x = 5.0 , h = 0.2 ; System . out . printf ( " y ( x ) ▁ = ▁ % .6f " , Gill ( x0 , y , x , h ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void PrintReverseOrder ( int N ) { for ( int i = N ; i > 0 ; i -- ) System . out . print ( + i + " ▁ " ) ; } public static void main ( String [ ] args ) { int N = 5 ; PrintReverseOrder ( N ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int findAns ( int a , int b , int n ) { int lcm = ( a * b ) / __gcd ( a , b ) ; int multiples = ( n / lcm ) + 1 ; int answer = Math . max ( a , b ) * multiples ; int lastvalue = lcm * ( n / lcm ) + Math . max ( a , b ) ; if ( lastvalue > n ) answer = answer - ( lastvalue - n - 1 ) ; return answer ; } static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } public static void main ( String [ ] args ) { int a = 1 , b = 13 , n = 500 ; System . out . print ( findAns ( a , b , n ) + "NEW_LINE"); } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static Double ArithmeticMean ( Double A , Double B ) { return ( A + B ) / 2 ; } static Double HarmonicMean ( Double A , Double B ) { return ( 2 * A * B ) / ( A + B ) ; } static void CheckArithmeticHarmonic ( Double arr [ ] , Double A , Double B , int N ) { Double AM = ArithmeticMean ( A , B ) ; Double HM = HarmonicMean ( A , B ) ; HashMap < Double , Integer > Hash = new HashMap < Double , Integer > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { Hash . put ( arr [ i ] , 1 ) ; } if ( Hash . get ( A ) != 0 && Hash . get ( B ) != 0 ) { if ( Hash . get ( AM ) != 0 && Hash . get ( HM ) != 0 ) { System . out . print ( " GM ▁ = ▁ " ) ; System . out . format ( " % .2f " , Math . sqrt ( AM * HM ) ) ; } else { System . out . print ( " AM ▁ and ▁ HM ▁ not ▁ found " ) ; } } else { System . out . print ( " numbers ▁ not ▁ found " ) ; } } public static void main ( String args [ ] ) { Double arr [ ] = { 1.0 , 2.0 , 2.5 , 3.0 , 4.0 , 4.5 , 5.0 , 6.0 } ; int N = ( arr . length ) ; Double A = 3.0 ; Double B = 6.0 ; CheckArithmeticHarmonic ( arr , A , B , N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void movesRequired ( int a , int b ) { int total_moves = a % b ; System . out . println ( total_moves ) ; } public static void main ( String [ ] args ) { int A = 10 , B = 3 ; movesRequired ( A , B ) ; } }

Class/struct names: GFG
Java program:
class GFG { static void PythagoreanTriplet ( int n ) { int flag = 0 ; for ( int a = 1 ; a < n ; a ++ ) { int b = ( n * n - 2 * n * a ) / ( 2 * n - 2 * a ) ; int c = n - a - b ; if ( a * a + b * b == c * c && b > 0 && c > 0 ) { System . out . print ( a + " ▁ " + b + " ▁ " + c ) ; flag = 1 ; break ; } } if ( flag == 0 ) { System . out . print ( " - 1" ) ; } return ; } public static void main ( String [ ] args ) { int N = 12 ; PythagoreanTriplet ( N ) ; } }

Accumulator variables: a
Iterator variables: a
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean check ( int X , int K ) { int prime , temp , sqr , i ; prime = 0 ; temp = X ; sqr = ( int ) Math . sqrt ( X ) ; for ( i = 2 ; i <= sqr ; i ++ ) { while ( temp % i == 0 ) { temp = temp / i ; prime ++ ; } } if ( temp > 2 ) prime ++ ; if ( X == 1 ) return false ; if ( prime == 1 && K == 1 ) return true ; else if ( prime >= K ) return true ; else return false ; } public static void main ( String [ ] args ) { int X , K ; X = 4 ; K = 2 ; if ( check ( X , K ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Accumulator variables: i, prime
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static class Node { int key ; Node left , right ; } ; static Node newNode ( int key ) { Node temp = new Node ( ) ; temp . key = key ; temp . left = temp . right = null ; return ( temp ) ; } static int N = 1000000 ; static Vector < Integer > prime = new Vector < Integer > ( ) ; static void SieveOfEratosthenes ( ) { boolean [ ] check = new boolean [ N + 1 ] ; Arrays . fill ( check , true ) ; for ( int p = 2 ; p * p <= N ; p ++ ) { if ( check [ p ] == true ) { prime . add ( p ) ; for ( int i = p * p ; i <= N ; i += p ) check [ i ] = false ; } } } static boolean isPathCo_Prime ( Vector < Integer > path ) { int max = 0 ; for ( int x : path ) { if ( max < x ) max = x ; } for ( int i = 0 ; i * prime . get ( i ) <= max / 2 ; i ++ ) { int ct = 0 ; for ( int x : path ) { if ( x % prime . get ( i ) == 0 ) ct ++ ; } if ( ct > 1 ) { return false ; } } return true ; } static void printCo_PrimePaths ( Vector < Integer > path ) { for ( int x : path ) { System . out . print ( x + " ▁ " ) ; } System . out . println ( ) ; } static void findCo_PrimePaths ( Node root , Vector < Integer > path ) { if ( root == null ) return ; path . add ( root . key ) ; findCo_PrimePaths ( root . left , path ) ; findCo_PrimePaths ( root . right , path ) ; if ( root . left == null && root . right == null ) { if ( isPathCo_Prime ( path ) ) { printCo_PrimePaths ( path ) ; } } path . remove ( path . size ( ) - 1 ) ; } static void printCo_PrimePaths ( Node node ) { SieveOfEratosthenes ( ) ; Vector < Integer > path = new Vector < Integer > ( ) ; findCo_PrimePaths ( node , path ) ; } public static void main ( String [ ] args ) { Node root = newNode ( 10 ) ; root . left = newNode ( 48 ) ; root . right = newNode ( 3 ) ; root . right . left = newNode ( 11 ) ; root . right . right = newNode ( 37 ) ; root . right . left . left = newNode ( 7 ) ; root . right . left . right = newNode ( 29 ) ; root . right . right . left = newNode ( 42 ) ; root . right . right . right = newNode ( 19 ) ; root . right . right . right . left = newNode ( 7 ) ; printCo_PrimePaths ( root ) ; } }

Index/key variables: i, p
Accumulator variables: ct, i, p
Iterator variables: i, p, x
Class/struct names: GFG, Node
Java program:
import java . io . * ; class GFG { static int mod = 1000000007 ; static int countSubsets ( int a [ ] , int n ) { int answer = 0 ; for ( int i = 0 ; i < ( 1 << n ) ; i ++ ) { int bitwiseAND = - 1 ; int bitwiseOR = 0 ; int bitwiseXOR = 0 ; for ( int j = 0 ; j < n ; j ++ ) { if ( ( i & ( 1 << j ) ) == 0 ) { if ( bitwiseAND == - 1 ) bitwiseAND = a [ j ] ; else bitwiseAND &= a [ j ] ; bitwiseOR |= a [ j ] ; bitwiseXOR ^= a [ j ] ; } } if ( bitwiseAND == bitwiseOR && bitwiseOR == bitwiseXOR ) answer = ( answer + 1 ) % mod ; } return answer ; } public static void main ( String [ ] args ) { int N = 6 ; int A [ ] = { 1 , 3 , 2 , 1 , 2 , 1 } ; System . out . print ( countSubsets ( A , N ) ) ; } }

Index/key variables: j
Accumulator variables: bitwiseAND, bitwiseOR, bitwiseXOR, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static int count ( int arr [ ] , int N , int K ) { int count = 0 , ans = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] == K ) { count = count + 1 ; } else { ans += ( count * ( count + 1 ) ) / 2 ; count = 0 ; } } ans = ans + ( count * ( count + 1 ) ) / 2 ; return ans ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 0 , 0 , 1 , 1 , 0 , 0 } ; int N = arr . length ; int K = 0 ; System . out . print ( count ( arr , N , K ) ) ; } }

Index/key variables: i
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static void convertToTernary ( int N ) { if ( N == 0 ) return ; int x = N % 3 ; N /= 3 ; if ( x < 0 ) N += 1 ; convertToTernary ( N ) ; if ( x < 0 ) System . out . print ( x + ( 3 * - 1 ) ) ; else System . out . print ( x ) ; } static void convert ( int Decimal ) { System . out . print ( " Ternary ▁ number ▁ of ▁ " + Decimal + " ▁ is : ▁ " ) ; if ( Decimal != 0 ) { convertToTernary ( Decimal ) ; } else System . out . println ( "0" ) ; } public static void main ( String [ ] args ) { int Decimal = 2747 ; convert ( Decimal ) ; } }

Accumulator variables: N
Class/struct names: GFG
Java program:
class GFG { static int get ( int x , int y , int z ) { if ( x > z ) return - 1 ; int val = z - x ; int div = ( z - x ) / y ; int ans = div * y + x ; return ans ; } public static void main ( String [ ] args ) { int x = 1 , y = 5 , z = 8 ; System . out . print ( get ( x , y , z ) + "NEW_LINE"); } }

Class/struct names: GFG
Java program:
class GFG { static void solve ( String s ) { String z = s ; int l = s . length ( ) ; int i ; String str ; if ( s . indexOf ( ' + ' ) != - 1 ) { i = s . indexOf ( ' + ' ) ; str = s . replace ( ' + ' , ' - ' ) ; } else { i = s . indexOf ( ' - ' ) ; str = s . replace ( ' - ' , ' + ' ) ; } System . out . println ( " Conjugate ▁ of ▁ " + z + " ▁ = ▁ " + str ) ; } public static void main ( String [ ] args ) { String s = "3-4i " ; solve ( s ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GfG { public static void countOfGreaterElements ( int arr [ ] ) { int n = arr . length ; TreeMap < Integer , Integer > mp = new TreeMap < Integer , Integer > ( Collections . reverseOrder ( ) ) ; for ( int i = 0 ; i < n ; i ++ ) { mp . put ( arr [ i ] , mp . getOrDefault ( arr [ i ] , 0 ) + 1 ) ; } int x = 0 ; for ( Map . Entry < Integer , Integer > e : mp . entrySet ( ) ) { Integer temp = e . getValue ( ) ; mp . put ( e . getKey ( ) , x ) ; x += temp ; } for ( int i = 0 ; i < n ; i ++ ) System . out . print ( mp . get ( arr [ i ] ) + " ▁ " ) ; } public static void main ( String args [ ] ) { int arr [ ] = { 7 , 9 , 5 , 2 , 1 , 3 , 4 , 8 , 6 } ; countOfGreaterElements ( arr ) ; } }

Index/key variables: i
Accumulator variables: i, x
Iterator variables: i
Class/struct names: GfG
Java program:
class GFG { static int minOperations ( int A , int B ) { if ( A > B ) { A = A + B ; B = A - B ; A = A - B ; } B = B / __gcd ( A , B ) ; return B - 1 ; } static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } public static void main ( String [ ] args ) { int A = 7 , B = 15 ; System . out . print ( minOperations ( A , B ) + "NEW_LINE"); } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void quadrant ( String s ) { int l = s . length ( ) ; int i ; if ( s . contains ( " + " ) ) { i = s . indexOf ( ' + ' ) ; } else { i = s . indexOf ( ' - ' ) ; } String real = s . substring ( 0 , i ) ; String imaginary = s . substring ( i + 1 , l - 1 ) ; int x = Integer . valueOf ( real ) ; int y = Integer . valueOf ( imaginary ) ; if ( x > 0 && y > 0 ) System . out . print ( " Quadrant ▁ 1" ) ; else if ( x < 0 && y > 0 ) System . out . print ( " Quadrant ▁ 2" ) ; else if ( x < 0 && y < 0 ) System . out . print ( " Quadrant ▁ 3" ) ; else if ( x > 0 && y < 0 ) System . out . print ( " Quadrant ▁ 4" ) ; else if ( x == 0 && y > 0 ) System . out . print ( " Lies ▁ on ▁ positive " + " ▁ Imaginary ▁ axis " ) ; else if ( x == 0 && y < 0 ) System . out . print ( " Lies ▁ on ▁ negative " + " ▁ Imaginary ▁ axis " ) ; else if ( y == 0 && x < 0 ) System . out . print ( " Lies ▁ on ▁ negative " + " ▁ X - axis " ) ; else if ( y == 0 && x > 0 ) System . out . print ( " Lies ▁ on ▁ positive " + " ▁ X - axis " ) ; else System . out . print ( " Lies ▁ on ▁ the ▁ Origin " ) ; } public static void main ( String [ ] args ) { String s = "5 + 3i " ; quadrant ( s ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static class Node { int data ; Node next ; } ; 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 ; } static int largestElement ( Node head_ref ) { int max = Integer . MIN_VALUE ; Node head = head_ref ; while ( head != null ) { if ( max < head . data ) max = head . data ; head = head . next ; } return max ; } static void createHash ( HashSet < Integer > hash , int maxElement ) { int prev = 0 , curr = 1 ; hash . add ( prev ) ; hash . add ( curr ) ; while ( curr <= maxElement ) { int temp = curr + prev ; hash . add ( temp ) ; prev = curr ; curr = temp ; } } static void sumAndProduct ( Node head_ref ) { int maxEle = largestElement ( head_ref ) ; HashSet < Integer > hash = new HashSet < Integer > ( ) ; createHash ( hash , maxEle ) ; int prod = 1 ; int sum = 0 ; Node ptr = head_ref ; while ( ptr != null ) { if ( hash . contains ( ptr . data ) ) { prod *= ptr . data ; sum += ptr . data ; } ptr = ptr . next ; } System . out . print ( " Sum ▁ = ▁ " + sum + "NEW_LINE"); System . out . print ( " Product ▁ = ▁ " + prod ) ; } public static void main ( String [ ] args ) { Node head = null ; head = push ( head , 13 ) ; head = push ( head , 6 ) ; head = push ( head , 8 ) ; head = push ( head , 16 ) ; head = push ( head , 15 ) ; sumAndProduct ( head ) ; } }

Accumulator variables: prod, sum
Class/struct names: GFG, Node