dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static int MinimumString ( int x ) { int b = 1 ; double left_lim = Math . Sqrt ( x ) + 1.0 ; double right_lim = Math . Sqrt ( x ) + 2.0 ; int r = 0 ; for ( int i = ( int ) left_lim ; i <= right_lim ; i ++ ) { if ( i > left_lim && i < right_lim ) { r = i ; break ; } } return b + r ; } public static void Main ( String [ ] args ) { int X = 2 ; Console . Write ( MinimumString ( X ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPerfectSquare ( int N ) { int floorSqrt = ( int ) Math . Sqrt ( N ) ; return ( N == floorSqrt * floorSqrt ) ; } static bool legendreFunction ( int N ) { while ( N % 4 == 0 ) N /= 4 ; if ( N % 8 != 7 ) return true ; else return false ; } static int minSquares ( int N ) { if ( isPerfectSquare ( N ) ) return 1 ; for ( int i = 1 ; i * i < N ; i ++ ) { if ( isPerfectSquare ( N - i * i ) ) return 2 ; } if ( legendreFunction ( N ) ) return 3 ; return 4 ; } public static void Main ( String [ ] args ) { int N = 123 ; Console . Write ( minSquares ( N ) ) ; } }

Accumulator variables: N, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static bool is_distinct ( long n , long k ) { HashSet < long > s = new HashSet < long > ( ) ; for ( int i = 1 ; i <= k ; i ++ ) { long tmp = n % i ; if ( s . Contains ( tmp ) ) { return false ; } s . Add ( tmp ) ; } return true ; } public static void Main ( String [ ] args ) { long N = 5 , K = 3 ; if ( is_distinct ( N , K ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int getDivisors ( int min , int n ) { int total = 0 ; for ( int i = min ; i < n ; ++ i ) if ( n % i == 0 && n / i >= i ) { ++ total ; if ( n / i > i ) total += getDivisors ( i , n / i ) ; } return total ; } public static void Main ( ) { int n = 30 ; Console . Write ( 1 + getDivisors ( 2 , n ) ) ; } }

Accumulator variables: total
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { class Node { public int val ; public Node next ; public Node ( int _val ) { val = _val ; next = null ; } } ; static void getLastTwoPerson ( int n ) { int total = n ; Node head = new Node ( 1 ) ; Node temp = head ; for ( int i = 2 ; i <= n ; i ++ ) { temp . next = new Node ( i ) ; temp = temp . next ; } temp . next = head ; temp = head ; Node del ; while ( total != 2 ) { del = temp . next . next ; temp . next . next = temp . next . next . next ; temp = temp . next ; del = null ; total -= 1 ; } Console . Write ( temp . val + " ▁ " + temp . next . val ) ; } public static void Main ( String [ ] args ) { int n = 2 ; getLastTwoPerson ( n ) ; } }

Accumulator variables: i, total
Iterator variables: i
Class/struct names: GFG, Node
C# program:
using System ; class GFG { static int findMinDenomin ( int n ) { return ( ( int ) ( Math . Log ( n ) / Math . Log ( 2 ) ) + 1 ) ; } static public void Main ( ) { int n = 10 ; Console . WriteLine ( findMinDenomin ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int findContent ( int [ ] arr , int n ) { int content = arr [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { content = __gcd ( content , arr [ i ] ) ; } return content ; } static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } public static void Main ( String [ ] args ) { int n = 3 ; int [ ] arr = { 9 , 6 , 12 } ; Console . Write ( findContent ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void inverseEqual ( int [ ] arr , int n ) { int [ ] brr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { int present_index = arr [ i ] - 1 ; brr [ present_index ] = i + 1 ; } for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] != brr [ i ] ) { Console . WriteLine ( " No " ) ; return ; } } Console . WriteLine ( " Yes " ) ; } public static void Main ( String [ ] args ) { int n = 4 ; int [ ] arr = { 1 , 4 , 3 , 2 } ; inverseEqual ( arr , n ) ; } }

Index/key variables: i, n, present_index
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void linearCongruentialMethod ( int Xo , int m , int a , int c , int [ ] randomNums , int noOfRandomNums ) { randomNums [ 0 ] = Xo ; for ( int i = 1 ; i < noOfRandomNums ; i ++ ) { randomNums [ i ] = ( ( randomNums [ i - 1 ] * a ) + c ) % m ; } } public static void Main ( String [ ] args ) { int Xo = 5 ; int m = 7 ; int a = 3 ; int c = 3 ; int noOfRandomNums = 10 ; int [ ] randomNums = new int [ noOfRandomNums ] ; linearCongruentialMethod ( Xo , m , a , c , randomNums , noOfRandomNums ) ; for ( int i = 0 ; i < noOfRandomNums ; i ++ ) { Console . Write ( randomNums [ i ] + " ▁ " ) ; } } }

Index/key variables: i, noOfRandomNums
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void multiplicativeCongruentialMethod ( int Xo , int m , int a , int [ ] randomNums , int noOfRandomNums ) { randomNums [ 0 ] = Xo ; for ( int i = 1 ; i < noOfRandomNums ; i ++ ) { randomNums [ i ] = ( randomNums [ i - 1 ] * a ) % m ; } } public static void Main ( String [ ] args ) { int Xo = 3 ; int m = 15 ; int a = 7 ; int noOfRandomNums = 10 ; int [ ] randomNums = new int [ noOfRandomNums ] ; multiplicativeCongruentialMethod ( Xo , m , a , randomNums , noOfRandomNums ) ; for ( int i = 0 ; i < noOfRandomNums ; i ++ ) { Console . Write ( randomNums [ i ] + " ▁ " ) ; } } }

Index/key variables: i, noOfRandomNums
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int MOD = 1000000007 ; static int power ( int a , int b , int m ) { a %= m ; int res = 1 ; while ( b > 0 ) { if ( b % 2 == 1 ) res = ( ( res % m ) * ( a % m ) ) % m ; a = ( ( a % m ) * ( a % m ) ) % m ; b >>= 1 ; } return res % m ; } static int productOfDivisors ( int [ ] p , int n ) { Dictionary < int , int > prime = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( prime . ContainsKey ( p [ i ] ) ) prime [ p [ i ] ] = prime [ p [ i ] ] + 1 ; else prime . Add ( p [ i ] , 1 ) ; } int product = 1 , d = 1 ; foreach ( KeyValuePair < int , int > itr in prime ) { int val = power ( itr . Key , ( itr . Value ) * ( itr . Value + 1 ) / 2 , MOD ) ; product = ( power ( product , itr . Value + 1 , MOD ) * power ( val , d , MOD ) ) % MOD ; d = ( d * ( itr . Value + 1 ) ) % ( MOD - 1 ) ; } return product ; } public static void Main ( String [ ] args ) { int [ ] arr = { 11 , 11 } ; int n = arr . Length ; Console . WriteLine ( productOfDivisors ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i, itr
Class/struct names: GFG
C# program:
using System ; class GFG { static void printFractions ( int n ) { for ( int i = 1 ; i < n ; i ++ ) { for ( int j = i + 1 ; j <= n ; j ++ ) { if ( __gcd ( i , j ) == 1 ) { string a = i . ToString ( ) ; string b = j . ToString ( ) ; Console . Write ( a + " / " + b + " , ▁ " ) ; } } } } static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } public static void Main ( string [ ] args ) { int n = 3 ; printFractions ( n ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int numberOfObjects ( int N , int M ) { int initial = Math . Min ( N , M ) ; int last = ( N + M ) / 3 ; return Math . Min ( initial , last ) ; } public static void Main ( string [ ] args ) { int N = 8 ; int M = 7 ; Console . Write ( numberOfObjects ( N , M ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static int SquareRoot ( int num ) { int count = 0 ; for ( int n = 1 ; n <= num ; n += 2 ) { num = num - n ; count += 1 ; if ( num == 0 ) break ; } return count ; } public static void Main ( ) { int N = 81 ; Console . Write ( SquareRoot ( N ) ) ; } }

Accumulator variables: count, n
Iterator variables: n
Class/struct names: GFG
C# program:
using System ; using System . Linq ; class GFG { static int gcd ( int x , int y ) { if ( x == 0 ) return y ; return gcd ( y % x , x ) ; } static int findDistinct ( int [ ] arr , int n ) { int maximum = arr . Max ( ) ; if ( n == 1 ) return 1 ; if ( n == 2 ) { return ( maximum / gcd ( arr [ 0 ] , arr [ 1 ] ) ) ; } int k = gcd ( arr [ 0 ] , arr [ 1 ] ) ; for ( int i = 2 ; i < n ; i ++ ) { k = gcd ( k , arr [ i ] ) ; } return ( maximum / k ) ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 5 } ; int n = arr . Length ; Console . Write ( findDistinct ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections ; using System . Collections . Generic ; class GFG { public static void findLocalMaximaMinima ( int n , int [ ] arr ) { ArrayList mx = new ArrayList ( ) ; ArrayList mn = new ArrayList ( ) ; if ( arr [ 0 ] > arr [ 1 ] ) mx . Add ( 0 ) ; else if ( arr [ 0 ] < arr [ 1 ] ) mn . Add ( 0 ) ; for ( int i = 1 ; i < n - 1 ; i ++ ) { if ( ( arr [ i - 1 ] > arr [ i ] ) && ( arr [ i ] < arr [ i + 1 ] ) ) mn . Add ( i ) ; else if ( ( arr [ i - 1 ] < arr [ i ] ) && ( arr [ i ] > arr [ i + 1 ] ) ) mx . Add ( i ) ; } if ( arr [ n - 1 ] > arr [ n - 2 ] ) mx . Add ( n - 1 ) ; else if ( arr [ n - 1 ] < arr [ n - 2 ] ) mn . Add ( n - 1 ) ; if ( mx . Count > 0 ) { Console . Write ( " Points ▁ of ▁ Local ▁ " + " maxima ▁ are ▁ : ▁ " ) ; foreach ( int a in mx ) Console . Write ( a + " ▁ " ) ; Console . Write ( " STRNEWLINE " ) ; } else Console . Write ( " There ▁ are ▁ no ▁ points ▁ " + " of ▁ Local ▁ Maxima ▁ " ) ; if ( mn . Count > 0 ) { Console . Write ( " Points ▁ of ▁ Local ▁ " + " minima ▁ are ▁ : ▁ " ) ; foreach ( int a in mn ) Console . Write ( a + " ▁ " ) ; Console . Write ( " STRNEWLINE " ) ; } else Console . Write ( " There ▁ are ▁ no ▁ points ▁ of ▁ " + " Local ▁ Maxima ▁ " ) ; } public static void Main ( string [ ] args ) { int N = 9 ; int [ ] arr = { 10 , 20 , 15 , 14 , 13 , 25 , 5 , 4 , 3 } ; findLocalMaximaMinima ( N , arr ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: a, i
Class/struct names: GFG
C# program:
using System ; class GFG { static int power ( int a , int b ) { if ( b == 0 ) return 1 ; if ( b == 1 ) return a ; int tmp = power ( a , b / 2 ) ; int result = tmp * tmp ; if ( b % 2 == 1 ) result *= a ; return result ; } static bool check ( int n ) { int temp = n ; while ( temp > 0 ) { int last_digit = temp % 10 ; if ( last_digit == 0 last_digit == 1 ) return false ; if ( n % last_digit == 0 ) return false ; temp = temp / 10 ; } return true ; } static void solve ( int n ) { int L = power ( 10 , n - 1 ) ; int R = power ( 10 , n ) - 1 ; int flag = 0 ; for ( int i = L ; i <= R ; i ++ ) { bool answer = check ( i ) ; if ( answer == true ) { Console . WriteLine ( i ) ; flag ++ ; break ; } } if ( flag == 0 ) Console . WriteLine ( " - 1" ) ; } public static void Main ( String [ ] args ) { int N = 4 ; solve ( N ) ; } }

Accumulator variables: flag, i, result
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { public static void costOfSubsequence ( int N , int [ ] arr , int [ ] costArray ) { int i , temp ; int cost = 0 ; HashSet < int > removedElements = new HashSet < int > ( ) ; int ans = 0 ; for ( i = 1 ; i < ( N - 1 ) ; i ++ ) { temp = arr [ i ] ; if ( ( ( arr [ i - 1 ] < temp ) && ( temp < arr [ i + 1 ] ) ) || ( ( arr [ i - 1 ] > temp ) && ( temp > arr [ i + 1 ] ) ) ) { removedElements . Add ( temp ) ; } } for ( i = 0 ; i < ( N ) ; i ++ ) { temp = arr [ i ] ; if ( ! ( removedElements . Contains ( temp ) ) ) { ans += arr [ i ] ; } else { cost += costArray [ i ] ; } } Console . Write ( ans + " , ▁ " ) ; Console . Write ( cost ) ; } public static void Main ( String [ ] args ) { int N ; N = 4 ; int [ ] arr = { 1 , 3 , 4 , 2 } ; int [ ] costArray = { 0 , 1 , 0 , 0 } ; costOfSubsequence ( N , arr , costArray ) ; } }

Index/key variables: i
Accumulator variables: ans, cost, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int maxN = 100000000 ; static List < int > prime = new List < int > ( ) ; static void sieve ( int n ) { bool [ ] check = new bool [ 1000007 ] ; for ( int I = 0 ; I < 1000007 ; I ++ ) check [ I ] = false ; int i , j ; check [ 0 ] = false ; check [ 1 ] = true ; check [ 2 ] = false ; for ( i = 4 ; i <= n ; i += 2 ) check [ i ] = true ; for ( i = 3 ; i * i <= n ; i += 2 ) if ( ! check [ i ] ) { for ( j = i * i ; j <= n ; j += 2 * i ) check [ j ] = true ; } prime . Add ( 2 ) ; for ( i = 3 ; i <= n ; i += 2 ) if ( ! check [ i ] ) prime . Add ( i ) ; return ; } static int countSetBits ( int n ) { int count = 0 ; while ( n > 0 ) { count += n & 1 ; n >>= 1 ; } return count ; } static int count ( int [ ] a , int n , int m ) { int [ ] parity = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) parity [ i ] = 0 ; for ( int i = 1 ; i < ( 1 << n ) ; i ++ ) { int mult = 1 ; for ( int j = 0 ; j < n ; j ++ ) if ( ( i & ( 1 << j ) ) != 0 ) mult *= a [ j ] ; parity [ countSetBits ( i ) & 1 ] += ( m / mult ) ; } return parity [ 1 ] - parity [ 0 ] ; } static int countRelPrime ( int n , int m ) { int [ ] a = new int [ 20 ] ; int i = 0 , j = 0 ; int pz = prime . Count ; while ( n != 1 && i < pz ) { if ( ( int ) prime [ i ] * ( int ) prime [ i ] > n ) break ; if ( n % prime [ i ] == 0 ) { a [ j ] = ( int ) prime [ i ] ; j ++ ; } while ( n % prime [ i ] == 0 ) n /= prime [ i ] ; i ++ ; } if ( n != 1 ) { a [ j ] = n ; j ++ ; } return m - count ( a , j , m ) ; } static void countRelPrimeInRange ( int n , int l , int r ) { sieve ( ( int ) Math . Sqrt ( maxN ) ) ; int result = countRelPrime ( n , r ) - countRelPrime ( n , l - 1 ) ; Console . WriteLine ( result ) ; } static void Main ( ) { int N = 7 , L = 3 , R = 9 ; countRelPrimeInRange ( N , L , R ) ; } }

Index/key variables: I, i, j
Accumulator variables: I, count, i, j, mult, n
Iterator variables: I, i, j
Class/struct names: GFG
C# program:
using System ; class GFG { class pair { public int first , second ; public pair ( int first , int second ) { this . first = first ; this . second = second ; } } static void find_Xor ( int [ ] arr , pair [ ] query , int N , int Q ) { for ( int i = 1 ; i < N ; i ++ ) { arr [ i ] = arr [ i ] ^ arr [ i - 1 ] ; } int ans = 0 ; for ( int i = 0 ; i < Q ; i ++ ) { if ( query [ i ] . first == 0 ) ans = arr [ query [ i ] . second ] ; else ans = arr [ query [ i ] . first - 1 ] ^ arr [ query [ i ] . second ] ; Console . Write ( ans + " STRNEWLINE " ) ; } } public static void Main ( String [ ] args ) { int [ ] arr = { 3 , 2 , 4 , 5 , 1 , 1 , 5 , 3 } ; int N = 8 ; int Q = 2 ; pair [ ] query = { new pair ( 1 , 4 ) , new pair ( 3 , 7 ) } ; find_Xor ( arr , query , N , Q ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG, pair
C# program:
using System ; class GFG { static int [ ] DiStirngMatch ( String Str ) { int N = Str . Length ; int [ ] arr = new int [ N + 1 ] ; int START = 0 , END = N ; for ( int i = 0 ; i < N ; i ++ ) { if ( Str [ i ] == ' I ' ) arr [ i ] = START ++ ; if ( Str [ i ] == ' D ' ) arr [ i ] = END -- ; } arr [ N ] = START ; return arr ; } public static void Main ( String [ ] args ) { String Str = " IDID " ; int N = Str . Length ; int [ ] ptr = DiStirngMatch ( Str ) ; for ( int i = 0 ; i <= N ; i ++ ) Console . Write ( ptr [ i ] + " ▁ " ) ; } }

Index/key variables: N, i
Accumulator variables: END, START, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static Boolean IsPrime ( int i ) { if ( i % 2 == 0 && i != 2 ) return false ; else { for ( int j = 3 ; j <= Math . Sqrt ( i ) ; j += 2 ) { if ( i % j == 0 ) return false ; } return true ; } } public static void Main ( String [ ] args ) { int c = 0 ; int N = 72 ; for ( int i = 2 ; i <= Math . Sqrt ( N ) ; i ++ ) { if ( IsPrime ( i ) ) { if ( N % i == 0 ) { c ++ ; if ( IsPrime ( N / i ) && i != ( N / i ) ) c ++ ; } } } Console . Write ( Math . Pow ( 2 , c ) - 1 ) ; } }

Accumulator variables: c, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void find_seq ( int [ ] arr , int m , int n ) { int [ ] b = new int [ n ] ; int x = 0 ; b [ 0 ] = x ; for ( int i = 0 ; i < n - 1 ; i ++ ) { b [ i + 1 ] = x + arr [ i ] + b [ i ] ; } int mn = n ; for ( int i = 0 ; i < n ; i ++ ) { mn = Math . Min ( mn , b [ i ] ) ; } x = 1 - mn ; for ( int i = 0 ; i < n ; i ++ ) { b [ i ] += x ; } for ( int i = 0 ; i < n ; i ++ ) { Console . Write ( b [ i ] + " ▁ " ) ; } Console . WriteLine ( ) ; } public static void Main ( String [ ] args ) { int N = 3 ; int [ ] arr = new int [ ] { - 2 , 1 } ; int M = arr . Length ; find_seq ( arr , M , N ) ; } }

Index/key variables: i, n
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void isEqualFactors ( int N ) { int ev_count = 0 , od_count = 0 ; for ( int i = 1 ; i <= Math . Sqrt ( N ) + 1 ; i ++ ) { if ( N % i == 0 ) { if ( i == N / i ) { if ( i % 2 == 0 ) ev_count += 1 ; else od_count += 1 ; } else { if ( i % 2 == 0 ) ev_count += 1 ; else od_count += 1 ; if ( ( N / i ) % 2 == 0 ) ev_count += 1 ; else od_count += 1 ; } } } if ( ev_count == od_count ) Console . Write ( " YES " + " STRNEWLINE " ) ; else Console . Write ( " NO " + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { int N = 10 ; isEqualFactors ( N ) ; } }

Accumulator variables: ev_count, i, od_count
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void isEqualFactors ( int N ) { if ( ( N % 2 == 0 ) && ( N % 4 != 0 ) ) Console . WriteLine ( " YES " ) ; else Console . WriteLine ( " NO " ) ; } public static void Main ( ) { int N = 10 ; isEqualFactors ( N ) ; N = 125 ; isEqualFactors ( N ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int count_crazy_primes ( int L , int R ) { int [ ] prime = new int [ R + 1 ] ; int [ ] countPrime = new int [ R + 1 ] ; int [ ] freqPrime = new int [ R + 1 ] ; prime [ 0 ] = 1 ; prime [ 1 ] = 1 ; for ( int p = 2 ; p * p <= R ; p ++ ) { if ( prime [ p ] == 0 ) { for ( int i = p * p ; i <= R ; i += p ) prime [ i ] = 1 ; } } for ( int i = 1 ; i <= R ; i ++ ) { countPrime [ i ] = countPrime [ i - 1 ] ; if ( prime [ i ] != 0 ) { countPrime [ i ] ++ ; } } for ( int i = 1 ; i <= R ; i ++ ) { freqPrime [ i ] = freqPrime [ i - 1 ] ; if ( prime [ countPrime [ i ] ] != 0 ) { freqPrime [ i ] ++ ; } } return ( freqPrime [ R ] - freqPrime [ L - 1 ] ) ; } public static void Main ( String [ ] args ) { int L = 4 , R = 12 ; Console . WriteLine ( count_crazy_primes ( L , R ) ) ; } }

Index/key variables: R, i, p
Accumulator variables: i, p
Iterator variables: i, p
Class/struct names: GFG
C# program:
using System ; class GFG { static void findNumbers ( int n , int b ) { double largest = Math . Pow ( b , n ) - 1 ; Console . Write ( largest ) ; } public static void Main ( String [ ] args ) { int N = 2 , B = 5 ; findNumbers ( N , B ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static void maximizedArray ( int [ ] arr , int N ) { int num , i = 0 ; for ( int l = N ; l > 0 ; l -- ) { num = arr [ i ] ; int one = 0 ; int zero = 0 ; while ( num != 0 ) { if ( num % 2 == 0 ) { zero ++ ; } else { one ++ ; } num = num >> 1 ; } for ( int j = zero ; j < ( one + zero ) ; j ++ ) { num += ( 1 << j ) ; } Console . Write ( num ) ; i ++ ; if ( N > 0 ) Console . Write ( " , ▁ " ) ; } } public static void Main ( String [ ] args ) { int [ ] arr = { 8 , 15 , 9 , 10 , 14 } ; int N = arr . Length ; maximizedArray ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i, j, l, num, one, zero
Iterator variables: j, l
Class/struct names: GFG
C# program:
using System ; class GFG { static int __gcd ( int a , int b ) { if ( b == 0 ) return a ; return __gcd ( b , a % b ) ; } static int findGCD ( int [ ] arr , int n ) { int gcd = arr [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { gcd = __gcd ( arr [ i ] , gcd ) ; if ( gcd == 1 ) { return 1 ; } } return gcd ; } static int findLCM ( int [ ] arr , int n ) { int lcm = arr [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { lcm = ( ( ( arr [ i ] * lcm ) ) / ( __gcd ( arr [ i ] , lcm ) ) ) ; } return lcm ; } static void findRatio ( int [ ] arr , int n ) { int gcd = findGCD ( arr , n ) ; int lcm = findLCM ( arr , n ) ; Console . Write ( ( lcm / gcd ) ) ; Console . Write ( " : 1" ) ; } public static void Main ( ) { int [ ] arr = new int [ ] { 6 , 12 , 36 } ; int N = 3 ; findRatio ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void compute ( int [ ] a , int N , int K ) { Dictionary < long , long > eqVal = new Dictionary < long , long > ( ) ; long maxX = 0 ; for ( int i = 0 ; i < N ; i ++ ) { long val = a [ i ] % K ; val = ( val == 0 ? 0 : K - val ) ; if ( val == 0 ) continue ; if ( eqVal . ContainsKey ( val ) ) { long numVal = eqVal [ val ] ; maxX = Math . Max ( maxX , val + ( K * numVal ) ) ; eqVal [ val ] = 1 + eqVal . GetValueOrDefault ( val , 0 ) ; } else { eqVal . Add ( val , 1 ) ; maxX = Math . Max ( maxX , val ) ; } } Console . Write ( maxX == 0 ? 0 : maxX + 1 ) ; } public static void Main ( string [ ] args ) { int K = 3 ; int [ ] a = { 1 , 2 , 2 , 18 } ; int N = a . Length ; compute ( a , N , K ) ; } }

Index/key variables: i, val
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { public static void sumOfTheArrayForQuery ( int [ ] A , int N , int [ ] X , int [ ] Y , int Q ) { int sum = 0 ; Dictionary < int , int > count = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { sum += A [ i ] ; if ( count . ContainsKey ( A [ i ] ) ) { count [ A [ i ] ] = count [ A [ i ] ] + 1 ; } else { count . Add ( A [ i ] , 1 ) ; } } for ( int i = 0 ; i < Q ; i ++ ) { int x = X [ i ] , y = Y [ i ] ; if ( count . ContainsKey ( X [ i ] ) ) { sum -= count [ X [ i ] ] * X [ i ] ; sum += count [ X [ i ] ] * Y [ i ] ; } if ( count . ContainsKey ( Y [ i ] ) && count . ContainsKey ( X [ i ] ) ) { count [ Y [ i ] ] = count [ Y [ i ] ] + count [ X [ i ] ] ; } if ( count . ContainsKey ( X [ i ] ) ) { count [ X [ i ] ] = 0 ; } Console . Write ( sum + " ▁ " ) ; } } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 1 , 3 , 2 } ; int [ ] X = { 2 , 3 , 5 } ; int [ ] Y = { 3 , 1 , 2 } ; int N = arr . Length ; int Q = X . Length ; sumOfTheArrayForQuery ( arr , N , X , Y , Q ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Linq ; class GFG { static int maxOR ( int [ ] arr , int n ) { int max_value = arr . Max ( ) ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { ans = Math . Max ( ans , ( max_value arr [ i ] ) ) ; } return ans ; } public static void Main ( String [ ] args ) { int [ ] arr = { 3 , 6 , 8 , 16 } ; int n = 4 ; Console . Write ( maxOR ( arr , n ) ) ; } }

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