dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
import java . util . HashSet ; public class GFG { static void maxCount ( int arr [ ] , int N , int K ) { HashSet < Integer > st = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { st . add ( arr [ i ] ) ; } if ( N - st . size ( ) <= K ) { System . out . println ( " Yes " ) ; } else System . out . println ( " No " ) ; } public static void main ( String [ ] args ) { int arr [ ] = { 2 , 2 , 2 , 3 } ; int K = 3 ; int N = arr . length ; maxCount ( arr , N , K ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . lang . * ; import java . util . * ; class GFG { static int max_sum ( int a [ ] , ArrayList < ArrayList < Integer > > v , int q , int n ) { int x = 0 ; int m = Integer . MIN_VALUE ; for ( int i = 0 ; i < q ; i ++ ) { int p , qq , k ; p = v . get ( i ) . get ( 0 ) ; qq = v . get ( i ) . get ( 1 ) ; k = v . get ( i ) . get ( 2 ) ; a [ p ] += k ; if ( qq + 1 <= n ) a [ qq + 1 ] -= k ; } for ( int i = 1 ; i <= n ; i ++ ) { x += a [ i ] ; m = Math . max ( m , x ) ; } return m ; } public static void main ( String [ ] args ) { int n = 10 , q = 3 ; int [ ] a = new int [ n + 5 ] ; ArrayList < ArrayList < Integer > > v = new ArrayList < > ( ) ; for ( int i = 0 ; i < q ; i ++ ) v . add ( new ArrayList < > ( ) ) ; v . get ( 0 ) . add ( 1 ) ; v . get ( 0 ) . add ( 5 ) ; v . get ( 0 ) . add ( 3 ) ; v . get ( 1 ) . add ( 4 ) ; v . get ( 1 ) . add ( 8 ) ; v . get ( 1 ) . add ( 7 ) ; v . get ( 2 ) . add ( 6 ) ; v . get ( 2 ) . add ( 9 ) ; v . get ( 2 ) . add ( 1 ) ; System . out . println ( max_sum ( a , v , q , n ) ) ; } }

Index/key variables: i, p
Accumulator variables: i, x
Iterator variables: i
Class/struct names: GFG
Java program:
import java . lang . * ; import java . util . * ; class GFG { static void findWinner ( int X , int Y ) { int playerA = ( X ^ Y ) ; boolean flag = false ; for ( int i = 1 ; i <= X ; i ++ ) { for ( int j = 1 ; j <= Y ; j ++ ) { int val = ( i ^ j ) ; if ( val > playerA ) { flag = true ; break ; } } if ( flag ) { break ; } } if ( flag ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } public static void main ( String [ ] args ) { int A = 2 , B = 4 ; findWinner ( A , B ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Boolean variables: flag
Class/struct names: GFG
Java program:
import java . lang . * ; import java . util . * ; class GFG { static void findWinner ( int X , int Y ) { int first = ( X ^ Y ) ; int second = ( X + Y ) ; if ( first == second ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } public static void main ( String [ ] args ) { int A = 2 , B = 4 ; findWinner ( A , B ) ; } }

Class/struct names: GFG
Java program:
class GFG { public static int findNum ( int N , int K ) { int rem = ( N + K ) % K ; if ( rem == 0 ) return N ; else return N + K - rem ; } public static int findSmallest ( int M , int N ) { int x = findNum ( M , N ) ; return x - M ; } public static void main ( String args [ ] ) { int M = 100 , N = 28 ; System . out . println ( findSmallest ( M , N ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static void prefixFactorialArray ( int A [ ] , int N ) { for ( int i = 1 ; i < N ; i ++ ) { A [ i ] += A [ i - 1 ] ; } int fact [ ] = new int [ A [ N - 1 ] + 1 ] ; fact [ 0 ] = 1 ; for ( int i = 1 ; i <= A [ N - 1 ] ; i ++ ) { fact [ i ] = i * fact [ i - 1 ] ; } for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = fact [ A [ i ] ] ; } for ( int i = 0 ; i < N ; i ++ ) { System . out . print ( A [ i ] + " ▁ " ) ; } } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 , 3 , 4 } ; int N = arr . length ; prefixFactorialArray ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . Arrays ; class GFG { static void maxFrequency ( int arr [ ] , int N , int K ) { Arrays . sort ( arr ) ; int start = 0 , end = 0 ; int sum = 0 , res = 0 ; for ( end = 0 ; end < N ; end ++ ) { sum += arr [ end ] ; while ( ( end - start + 1 ) * arr [ end ] - sum > K ) { sum -= arr [ start ] ; start ++ ; } res = Math . max ( res , end - start + 1 ) ; } System . out . println ( res ) ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 4 , 8 , 13 } ; int N = 4 ; int K = 5 ; maxFrequency ( arr , N , K ) ; } }

Index/key variables: end, start
Accumulator variables: end, start, sum
Iterator variables: end
Class/struct names: GFG
Java program:
import java . io . * ; import java . lang . * ; import java . util . * ; class GFG { static void countPairs ( int arr [ ] , int n , int x ) { int count = 0 ; HashMap < Integer , Integer > mp = new HashMap < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { mp . put ( arr [ i ] - x * i , mp . getOrDefault ( arr [ i ] - x * i , 0 ) + 1 ) ; } for ( int v : mp . values ( ) ) { count += ( v * ( v - 1 ) ) / 2 ; } System . out . println ( count ) ; } public static void main ( String [ ] args ) { int n = 6 , x = 3 ; int arr [ ] = { 5 , 4 , 8 , 11 , 13 , 16 } ; countPairs ( arr , n , x ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i, v
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static class Node { int data ; Node left ; Node right ; } static Node newNode ( int d ) { Node n = new Node ( ) ; n . data = d ; n . left = null ; n . right = null ; return n ; } static void findwt ( Node root , int wt [ ] , TreeMap < Integer , Integer > um , int width ) { if ( root == null ) { return ; } if ( um . containsKey ( width ) ) { um . put ( width , um . get ( width ) + wt [ root . data ] ) ; } else { um . put ( width , wt [ root . data ] ) ; } findwt ( root . left , wt , um , width - 1 ) ; findwt ( root . right , wt , um , width + 1 ) ; } static void solveQueries ( int wt [ ] , Node root , int [ ] [ ] queries ) { TreeMap < Integer , Integer > um = new TreeMap < Integer , Integer > ( ) ; findwt ( root , wt , um , 0 ) ; int x = 0 ; for ( Map . Entry < Integer , Integer > it : um . entrySet ( ) ) { x += it . getValue ( ) ; um . put ( it . getKey ( ) , x ) ; } for ( int i = 0 ; i < queries . length ; i ++ ) { int l = queries [ i ] [ 0 ] ; int r = queries [ i ] [ 1 ] ; int ans = 0 ; if ( um . containsKey ( r ) ) { ans = um . get ( r ) ; } if ( um . containsKey ( l - 1 ) ) { ans -= um . get ( l - 1 ) ; } System . out . println ( ans ) ; } } public static void main ( String [ ] args ) { int N = 8 ; Node root = newNode ( 1 ) ; root . left = newNode ( 3 ) ; root . left . left = newNode ( 5 ) ; root . left . right = newNode ( 6 ) ; root . right = newNode ( 2 ) ; root . right . right = newNode ( 4 ) ; root . right . right . left = newNode ( 7 ) ; root . right . right . right = newNode ( 0 ) ; int wt [ ] = { 8 , 6 , 4 , 5 , 1 , 2 , 9 , 1 } ; int queries [ ] [ ] = { { - 1 , 1 } , { - 2 , - 1 } , { 0 , 3 } } ; solveQueries ( wt , root , queries ) ; } }

Index/key variables: i
Accumulator variables: ans, i, x
Iterator variables: i
Class/struct names: GFG, Node
Java program:
import java . io . * ; import java . util . * ; class GFG { static String recreationalSpot ( int arr [ ] , int N ) { if ( N < 3 ) { return " No " ; } int preMin [ ] = new int [ N ] ; preMin [ 0 ] = arr [ 0 ] ; for ( int i = 1 ; i < N ; i ++ ) { preMin [ i ] = Math . min ( preMin [ i - 1 ] , arr [ i ] ) ; } Stack < Integer > stack = new Stack < Integer > ( ) ; for ( int j = N - 1 ; j >= 0 ; j -- ) { if ( arr [ j ] > preMin [ j ] ) { while ( stack . empty ( ) == false && stack . peek ( ) <= preMin [ j ] ) { stack . pop ( ) ; } if ( stack . empty ( ) == false && stack . peek ( ) < arr [ j ] ) { return " Yes " ; } stack . push ( arr [ j ] ) ; } } return " No " ; } public static void main ( String [ ] args ) { int arr [ ] = { 4 , 7 , 11 , 5 , 13 , 2 } ; int size = arr . length ; System . out . println ( recreationalSpot ( arr , size ) ) ; } }

Index/key variables: N, i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static boolean ToCheckPowerofX ( int n , int x ) { while ( n > 0 ) { int rem = n % x ; if ( rem >= 2 ) { return false ; } n = n / x ; } return true ; } public static void main ( String [ ] args ) { int N = 10 , X = 3 ; if ( ToCheckPowerofX ( N , X ) ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } }

Class/struct names: GFG
Java program:
import java . io . * ; import java . lang . * ; import java . util . * ; public class GFG { static int reverseBin ( int N ) { String S = " " ; int i ; for ( i = 0 ; i < 32 ; i ++ ) { if ( ( N & ( 1L << i ) ) != 0 ) S += '1' ; else S += '0' ; } S = ( new StringBuilder ( S ) ) . reverse ( ) . toString ( ) ; int M = 0 ; for ( i = 0 ; i < 32 ; i ++ ) { if ( S . charAt ( i ) == '1' ) M += ( 1L << i ) ; } return M ; } static int maximumOfTwo ( int N ) { int M = reverseBin ( N ) ; return Math . max ( N , M ) ; } public static void main ( String [ ] args ) { int N = 6 ; System . out . print ( maximumOfTwo ( N ) ) ; } }

Accumulator variables: M, S, i
Iterator variables: i
Class/struct names: GFG
Java program:
public class GFG { static int sumOfDivisors ( int N ) { return N ; } public static void main ( String [ ] args ) { int N = 5 ; System . out . println ( sumOfDivisors ( N ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static class pair { double first , second ; public pair ( double first , double second ) { this . first = first ; this . second = second ; } } static void complexRoot ( int A , int B ) { Vector < pair > ans = new Vector < pair > ( ) ; double X1 = Math . abs ( Math . sqrt ( ( A + Math . sqrt ( A * A + B * B ) ) / 2 ) ) ; double Y1 = B / ( 2 * X1 ) ; ans . add ( new pair ( X1 , Y1 ) ) ; double X2 = - 1 * X1 ; double Y2 = B / ( 2 * X2 ) ; if ( X2 != 0 ) { ans . add ( new pair ( X2 , Y2 ) ) ; } double X3 = ( A - Math . sqrt ( A * A + B * B ) ) / 2 ; if ( X3 > 0 ) { X3 = Math . abs ( Math . sqrt ( X3 ) ) ; double Y3 = B / ( 2 * X3 ) ; ans . add ( new pair ( X3 , Y3 ) ) ; double X4 = - 1 * X3 ; double Y4 = B / ( 2 * X4 ) ; if ( X4 != 0 ) { ans . add ( new pair ( X4 , Y4 ) ) ; } } System . out . print ( " The ▁ Square ▁ roots ▁ are : ▁ " + "NEW_LINE"); for ( pair p : ans ) { System . out . printf ( " % .4f " , p . first ) ; if ( p . second > 0 ) System . out . print ( " + " ) ; if ( p . second != 0 ) System . out . printf ( "%.4f*iNEW_LINE", p.second); else System . out . println ( ) ; } } public static void main ( String [ ] args ) { int A = 0 , B = 1 ; complexRoot ( A , B ) ; } }

Iterator variables: p
Class/struct names: GFG, pair
Java program:
import java . util . * ; import java . lang . * ; class GFG { static int minTime ( int [ ] A , int n , int K ) { int max_ability = A [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { max_ability = Math . max ( max_ability , A [ i ] ) ; } int tmp [ ] = new int [ max_ability + 1 ] ; int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { tmp [ A [ i ] ] ++ ; } for ( int i = max_ability ; i >= 0 ; i -- ) { if ( tmp [ i ] != 0 ) { if ( tmp [ i ] * i < K ) { K -= ( i * tmp [ i ] ) ; tmp [ i / 2 ] += tmp [ i ] ; count += tmp [ i ] ; if ( K <= 0 ) { return count ; } } else { if ( K % i != 0 ) { count += ( K / i ) + 1 ; } else { count += ( K / i ) ; } return count ; } } } return - 1 ; } public static void main ( String [ ] args ) { int arr [ ] = { 3 , 1 , 7 , 2 , 4 } ; int N = arr . length ; int K = 15 ; System . out . println ( minTime ( arr , N , K ) ) ; } }

Index/key variables: i
Accumulator variables: K, count, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . lang . * ; import java . util . * ; public class GFG { static int gcd ( int a , int b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } static int findlcm ( int arr [ ] , int n ) { int ans = arr [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { ans = ( ( ( arr [ i ] * ans ) ) / ( gcd ( arr [ i ] , ans ) ) ) ; } return ans ; } static void minimumRod ( int A [ ] , int N ) { System . out . println ( N * findlcm ( A , N ) ) ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 } ; int N = arr . length ; minimumRod ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean findDigit ( int N , int D ) { while ( N > 0 ) { int a = N % 10 ; if ( a == D ) { return true ; } N /= 10 ; } return false ; } static boolean check ( int N , int D ) { while ( N > 0 ) { if ( findDigit ( N , D ) == true ) { return true ; } N -= D ; } return false ; } public static void main ( String [ ] args ) { int N = 24 ; int D = 7 ; if ( check ( N , D ) ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } }

Accumulator variables: N
Class/struct names: GFG
Java program:
import java . io . * ; import java . lang . * ; import java . util . * ; class GFG { static int mod = 1000000007 ; static int power ( int x , int y ) { int res = 1 ; x = x % mod ; if ( x == 0 ) return 0 ; while ( y > 0 ) { if ( ( y & 1 ) != 0 ) res = ( res * x ) % mod ; y = y >> 1 ; x = ( x * x ) % mod ; } return res ; } static void countRelations ( int N ) { System . out . print ( ( power ( 2 , N ) - 2 ) * power ( 2 , N * N - N ) ) ; } public static void main ( String [ ] args ) { int N = 2 ; countRelations ( N ) ; } }

Class/struct names: GFG
Java program:
class GFG { public static int minOperations ( int N ) { int [ ] arr = new int [ N ] ; int sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { arr [ i ] = ( 2 * i ) + 1 ; sum = sum + arr [ i ] ; } int mid = 0 ; if ( N % 2 == 0 ) { mid = sum / N ; } else { mid = arr [ N / 2 ] ; } int ans = 0 ; for ( int i = 0 ; i < N / 2 ; i ++ ) { ans += mid - arr [ i ] ; } return ans ; } public static void main ( String [ ] args ) { int N = 6 ; System . out . println ( minOperations ( N ) ) ; } }

Index/key variables: N, i
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { public static int minOperation ( int N ) { if ( N % 2 == 0 ) { return ( N / 2 ) * ( N / 2 ) ; } int k = ( N - 1 ) / 2 ; return k * ( k + 1 ) ; } public static void main ( String [ ] args ) { int N = 6 ; System . out . println ( minOperation ( N ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int findXORS ( int arr1 [ ] , int arr2 [ ] , int N , int M ) { int res = 0 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < M ; j ++ ) { int temp = arr1 [ i ] & arr2 [ j ] ; res ^= temp ; } } return res ; } public static void main ( String [ ] args ) { int arr1 [ ] = { 1 , 2 , 3 } ; int arr2 [ ] = { 6 , 5 } ; int N = arr1 . length ; int M = arr2 . length ; System . out . print ( findXORS ( arr1 , arr2 , N , M ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, res
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . io . * ; import java . lang . * ; import java . util . * ; class GFG { static int findXORS ( int arr1 [ ] , int arr2 [ ] , int N , int M ) { int XORS1 = 0 ; int XORS2 = 0 ; for ( int i = 0 ; i < N ; i ++ ) { XORS1 ^= arr1 [ i ] ; } for ( int i = 0 ; i < M ; i ++ ) { XORS2 ^= arr2 [ i ] ; } return ( XORS1 & XORS2 ) ; } public static void main ( String [ ] args ) { int arr1 [ ] = { 1 , 2 , 3 } ; int arr2 [ ] = { 6 , 5 } ; int N = arr1 . length ; int M = arr2 . length ; System . out . println ( findXORS ( arr1 , arr2 , N , M ) ) ; } }

Index/key variables: i
Accumulator variables: XORS1, XORS2, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean isPowerof2 ( int n ) { return ( ( n & ( n - 1 ) ) > 0 && n > 0 ) ; } static void countNum ( int N ) { int count = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { boolean flag = isPowerof2 ( i ) ; if ( ! flag ) { count ++ ; } } System . out . print ( count + "NEW_LINE"); } public static void main ( String [ ] args ) { int N = 100 ; countNum ( N ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . lang . * ; import java . util . * ; public class GFG { static void countNum ( int N ) { int ans = ( int ) ( Math . log ( N ) / Math . log ( 2 ) ) + 1 ; System . out . println ( ans ) ; } public static void main ( String [ ] args ) { int N = 100 ; countNum ( N ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static class ListNode { int val ; ListNode next ; } ; static ListNode push ( ListNode head_ref , int node_val ) { ListNode new_node = new ListNode ( ) ; new_node . val = node_val ; new_node . next = head_ref ; head_ref = new_node ; return head_ref ; } static void splitListInParts ( ListNode head , int K ) { Vector < ListNode > ans = new Vector < ListNode > ( ) ; if ( head == null ) { while ( K -- > 0 ) ans . add ( null ) ; } int N = 0 ; ListNode p = head ; while ( p . next != null ) { p = p . next ; N ++ ; } int len = N / K ; int rem = N % K ; p = head ; while ( K > 0 && p . next != null ) { int x = len ; ListNode curr_head = p ; ListNode last = p ; if ( rem > 0 ) { p = p . next ; rem -- ; } while ( x -- > 0 ) { if ( last == p ) p = p . next ; else { last . next = p ; last = p ; p = p . next ; } } last . next = null ; ans . add ( curr_head ) ; K -- ; } while ( K > 0 ) { ans . add ( null ) ; K -- ; } System . out . print ( " { " ) ; for ( int i = 0 ; i < ans . size ( ) ; i ++ ) { System . out . print ( " { " ) ; while ( ans . get ( i ) != null ) { System . out . print ( ans . get ( i ) . val + " ▁ " ) ; ans . set ( i , ans . get ( i ) . next ) ; } System . out . print ( " } " ) ; if ( i != ans . size ( ) - 1 ) System . out . print ( " , ▁ " ) ; } System . out . print ( " } " ) ; } public static void main ( String [ ] args ) { ListNode root = new ListNode ( ) ; root = push ( root , 8 ) ; root = push ( root , 7 ) ; root = push ( root , 6 ) ; root = push ( root , 5 ) ; root = push ( root , 4 ) ; root = push ( root , 3 ) ; root = push ( root , 2 ) ; root = push ( root , 1 ) ; int K = 3 ; splitListInParts ( root , K ) ; } }

Accumulator variables: K, N, i, rem, x
Iterator variables: i
Class/struct names: GFG, ListNode
Java program:
import java . io . * ; class GFG { static int nearestPow ( int x , int base1 ) { int k = ( int ) ( Math . log ( x ) / Math . log ( base1 ) ) ; if ( Math . abs ( Math . pow ( base1 , k ) - x ) < Math . abs ( Math . pow ( base1 , ( k + 1 ) ) - x ) ) return ( int ) Math . pow ( base1 , k ) ; else return ( int ) Math . pow ( base1 , ( k + 1 ) ) ; } static void replaceWithNearestPowerOfK ( int [ ] arr , int K , int n ) { for ( int i = 0 ; i < n ; i ++ ) { int num = arr [ i ] ; String strEle = String . valueOf ( num ) ; for ( int c = 0 ; c < strEle . length ( ) ; c ++ ) { if ( ( strEle . charAt ( c ) - '0' ) == K ) { arr [ i ] = nearestPow ( arr [ i ] , K ) ; break ; } } } for ( int i = 0 ; i < n ; i ++ ) System . out . print ( arr [ i ] + " ▁ " ) ; } public static void main ( String [ ] args ) { int [ ] arr = { 432 , 953 , 232 , 333 } ; int n = arr . length ; int K = 3 ; replaceWithNearestPowerOfK ( arr , K , n ) ; } }

Index/key variables: i
Accumulator variables: c, i
Iterator variables: c, i
Class/struct names: GFG
Java program:
public class GFG { static int ceilDifference ( int arr [ ] , int n , int x ) { int totalSum = 0 ; int perElementSum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { totalSum += arr [ i ] ; perElementSum += Math . ceil ( ( double ) ( arr [ i ] ) / ( double ) ( x ) ) ; } int totalCeilSum = ( int ) Math . ceil ( ( double ) ( totalSum ) / ( double ) ( x ) ) ; return Math . abs ( perElementSum - totalCeilSum ) ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 , 3 , 4 , 5 , 6 } ; int K = 4 ; int N = arr . length ; System . out . println ( ceilDifference ( arr , N , K ) ) ; } }

Index/key variables: i
Accumulator variables: i, perElementSum, totalSum
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static String removeTailing ( int A , int B ) { int N = A + B ; Stack < Character > s = new Stack < Character > ( ) ; String strsum = Integer . toString ( N ) ; for ( int i = 0 ; i < strsum . length ( ) ; i ++ ) { s . push ( strsum . charAt ( i ) ) ; } while ( s . peek ( ) == '0' ) { s . pop ( ) ; } String res = " " ; while ( s . empty ( ) == false ) { res = res + ( char ) s . peek ( ) ; s . pop ( ) ; } StringBuilder str = new StringBuilder ( ) ; str . append ( res ) ; str . reverse ( ) ; return str . toString ( ) ; } public static void main ( String [ ] args ) { int A = 130246 , B = 450164 ; System . out . println ( removeTailing ( A , B ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int countTriplets ( int N ) { int ans = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { for ( int j = 1 ; j <= N ; j ++ ) { if ( i * j > N ) break ; ans += N / ( i * j ) ; } } return ans ; } public static void main ( String [ ] args ) { int N = 10 ; System . out . print ( countTriplets ( N ) ) ; } }

Accumulator variables: ans, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void findSumOfGP ( double a , double r ) { if ( Math . abs ( r ) >= 1 ) { System . out . print ( " Infinite " ) ; return ; } double sum = a / ( 1 - r ) ; System . out . print ( sum ) ; } public static void main ( String [ ] args ) { double A = 1 , R = 0.5 ; findSumOfGP ( A , R ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int mod = 1000000007 ; static int power ( long x , int y ) { int res = 1 ; x = x % mod ; while ( y > 0 ) { if ( y % 2 == 1 ) res = ( int ) ( res * x ) % mod ; y = y >> 1 ; x = ( x * x ) % mod ; } return res ; } static int numberOfRelations ( int N ) { return power ( 3 , ( N * N - N ) / 2 ) ; } public static void main ( String [ ] args ) { int N = 2 ; System . out . print ( numberOfRelations ( N ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void countNumbers ( int N ) { int count = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { if ( __gcd ( i , N ) != 1 ) count ++ ; } System . out . print ( count ) ; } static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } public static void main ( String [ ] args ) { int N = 5 ; countNumbers ( N ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int phi ( int N ) { int result = N ; for ( int p = 2 ; p * p <= N ; ++ p ) { if ( N % p == 0 ) { while ( N % p == 0 ) N /= p ; result -= result / p ; } } if ( N > 1 ) result -= result / N ; return result ; } static void countNumbers ( int N ) { int count = N - phi ( N ) ; System . out . print ( count ) ; } public static void main ( String [ ] args ) { int N = 5 ; countNumbers ( N ) ; } }

Accumulator variables: N, result
Iterator variables: p
Class/struct names: GFG
Java program:
import java . io . * ; import java . lang . * ; import java . util . * ; public class GFG { static void Query ( int arr [ ] , int N , int Q [ ] [ ] ) { int mul = 1 ; int add = 0 ; for ( int i = 0 ; i < Q . length ; i ++ ) { if ( Q [ i ] [ 0 ] == 0 ) { add = add + Q [ i ] [ 1 ] ; } else if ( Q [ i ] [ 0 ] == 1 ) { mul = mul * Q [ i ] [ 1 ] ; add = add * Q [ i ] [ 1 ] ; } else { int ans = arr [ Q [ i ] [ 1 ] ] * mul + add ; System . out . print ( ans + " ▁ " ) ; } } } public static void main ( String [ ] args ) { int arr [ ] = { 3 , 1 , 23 , 45 , 100 } ; int N = arr . length ; int Q [ ] [ ] = { { 1 , 2 } , { 0 , 10 } , { 2 , 3 } , { 1 , 5 } , { 2 , 4 } } ; Query ( arr , N , Q ) ; } }

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