dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; using System . Collections . Generic ; class GFG { static int countQuadruples ( int [ ] A , int N ) { int ans = 0 ; Dictionary < int , int > freq = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( freq . ContainsKey ( A [ i ] ) ) ans += freq [ A [ i ] ] ; else freq . Add ( A [ i ] , 0 ) ; for ( int j = 0 ; j < i ; j ++ ) { for ( int k = 0 ; k < j ; k ++ ) { if ( freq . ContainsKey ( A [ i ] * A [ j ] * A [ k ] ) ) freq [ A [ i ] * A [ j ] * A [ k ] ] ++ ; else freq . Add ( A [ i ] * A [ j ] * A [ k ] , 1 ) ; } } } return ans ; } public static void Main ( ) { int [ ] arr = { 10 , 2 , 2 , 7 , 40 , 160 } ; int N = arr . Length ; Console . Write ( countQuadruples ( arr , N ) ) ; } }

Index/key variables: i, j, k
Accumulator variables: ans, i, j, k
Iterator variables: i, j, k
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAXN = 10000000 ; static Boolean can ( int Mid , int X , int Y , int A , int B ) { int p1 = X - Mid * B ; int p2 = Y - Mid * B ; if ( p1 < 0 p2 < 0 ) { return false ; } int k = A - B ; if ( k == 0 ) { return true ; } int val = p1 / k + p2 / k ; if ( val >= Mid ) { return true ; } return false ; } static int maxPossibleMoves ( int X , int Y , int A , int B ) { int ans = 0 ; int L = 1 , R = MAXN ; while ( L <= R ) { int Mid = ( L + R ) / 2 ; if ( can ( Mid , X , Y , A , B ) ) { L = Mid + 1 ; ans = Math . Max ( ans , Mid ) ; } else { R = Mid - 1 ; } } return ans ; } public static void Main ( String [ ] args ) { int X = 10 , Y = 12 , A = 2 , B = 5 ; if ( A < B ) { int temp = A ; A = B ; B = temp ; } Console . Write ( maxPossibleMoves ( X , Y , A , B ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void printFactors ( int n ) { for ( int i = 2 ; i <= ( int ) Math . Sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { int d1 = i , d2 = n ; while ( d2 % d1 == 0 ) { d2 = d2 / d1 ; } if ( d1 > 1 && d2 > 1 ) { Console . Write ( d1 + " , ▁ " + d2 ) ; return ; } } } Console . Write ( - 1 ) ; } public static void Main ( ) { int N = 10 ; printFactors ( N ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int countTriplets ( int [ ] arr , int n ) { int odd = 0 , even = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( ( arr [ i ] & 1 ) != 0 ) odd ++ ; else even ++ ; } int c1 = odd * ( even * ( even - 1 ) ) / 2 ; int c2 = ( odd * ( odd - 1 ) * ( odd - 2 ) ) / 6 ; return c1 + c2 ; } public static void Main ( String [ ] args ) { int [ ] arr = { 4 , 5 , 6 , 4 , 5 , 10 , 1 , 7 } ; int n = arr . Length ; int ans = countTriplets ( arr , n ) ; Console . Write ( ans ) ; } }

Index/key variables: i
Accumulator variables: even, i, odd
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int maxUniqueElements ( int [ ] Arr , int N ) { Dictionary < int , int > mp = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( mp . ContainsKey ( Arr [ i ] ) ) { mp [ Arr [ i ] ] += 1 ; } else { mp [ Arr [ i ] ] = 1 ; } } int cnt = 0 ; foreach ( KeyValuePair < int , int > entry in mp ) { if ( ( entry . Value ) % 2 == 0 ) { cnt ++ ; } } int ans = mp . Count ; if ( cnt % 2 == 1 ) { ans -- ; } return ans ; } public static void Main ( string [ ] args ) { int N = 5 ; int [ ] A = { 1 , 2 , 1 , 3 , 7 } ; Console . Write ( maxUniqueElements ( A , N ) ) ; } }

Index/key variables: i
Accumulator variables: ans, cnt, i
Iterator variables: entry, i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int countCells ( int n , int m , int s ) { int mx1 = - 1 ; int cont1 = 0 ; for ( int i = 0 ; i < s && i < n ; ++ i ) { int aux = ( n - ( i + 1 ) ) / s + 1 ; if ( aux > mx1 ) { mx1 = cont1 = aux ; } else if ( aux == mx1 ) cont1 += aux ; } int mx2 = - 1 ; int cont2 = 0 ; for ( int i = 0 ; i < s && i < m ; ++ i ) { int aux = ( m - ( i + 1 ) ) / s + 1 ; if ( aux > mx2 ) mx2 = cont2 = aux ; else if ( aux == mx2 ) cont2 += aux ; } return ( cont1 * cont2 ) ; } public static void Main ( ) { int N = 5 , M = 5 , K = 2 ; Console . Write ( countCells ( N , M , K ) ) ; } }

Accumulator variables: cont1, cont2
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int countTotalPairs ( int N , int K ) { if ( K == 0 ) { return N * N ; } int ans = 0 ; for ( int b = K + 1 ; b <= N ; b ++ ) { ans += ( N / b ) * ( b - K ) ; ans += Math . Max ( N % b - K + 1 , 0 ) ; } return ans ; } public static void Main ( ) { int N = 5 , K = 2 ; Console . Write ( countTotalPairs ( N , K ) ) ; } }

Accumulator variables: ans, b
Iterator variables: b
Class/struct names: GFG
C# program:
using System ; class GFG { public static int minSumDifference ( int [ ] ar , int n ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum += ar [ i ] ; int rem = sum % n ; return rem * ( n - rem ) ; } public static void Main ( ) { int [ ] arr = { 3 , 6 , 8 , 5 , 2 , 1 , 11 , 7 , 10 , 4 } ; int N = arr . Length ; Console . Write ( minSumDifference ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int m = 1000000007 ; static int power ( int x , int y ) { int res = 1 ; while ( y > 0 ) { if ( ( y & 1 ) != 0 ) res = ( res * x ) % m ; y = y >> 1 ; x = ( x * x ) % m ; } return res ; } static int countNDigitNumber ( int N ) { int ne = N / 2 + N % 2 ; int no = ( int ) Math . Floor ( ( double ) N / 2 ) ; return power ( 4 , ne ) * power ( 5 , no ) ; } public static void Main ( ) { int N = 5 ; Console . Write ( countNDigitNumber ( N ) % m ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int minSteps ( int N ) { int count = 1 , res = 0 ; for ( int i = 1 ; i <= N ; i += count ) { res = Math . Max ( res , count ) ; count ++ ; } return res ; } public static void Main ( ) { int N = 6 ; Console . Write ( minSteps ( N ) ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int minSteps ( int N ) { int res = ( ( int ) Math . Sqrt ( 1 + 8 * N ) - 1 ) / 2 ; return res ; } public static void Main ( String [ ] args ) { int N = 6 ; Console . Write ( minSteps ( N ) + " STRNEWLINE " ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void oppositeFaceOfDice ( int N ) { int ans = 7 - N ; Console . Write ( ans ) ; } public static void Main ( ) { int N = 2 ; oppositeFaceOfDice ( N ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int countReachablePoints ( int X , int Y , int L , int R ) { int [ ] diff_arr = new int [ 100000 ] ; int count = 0 ; diff_arr [ X ] = 1 ; diff_arr [ X + 1 ] = - 1 ; for ( int i = X ; i <= Y ; i ++ ) { diff_arr [ i ] += diff_arr [ i - 1 ] ; if ( diff_arr [ i ] >= 1 ) { diff_arr [ i + L ] += 1 ; diff_arr [ i + R + 1 ] -= 1 ; count ++ ; } } return count ; } public static void Main ( ) { int X = 3 , Y = 12 , L = 2 , R = 3 ; Console . Write ( countReachablePoints ( X , Y , L , R ) ) ; } }

Index/key variables: X, i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { class Node { public int data ; public Node next ; } ; static Node newNode ( int data ) { Node new_node = new Node ( ) ; new_node . data = data ; new_node . next = null ; return new_node ; } static Node reverse ( Node head ) { Node prev = null ; Node current = head ; Node next ; while ( current != null ) { next = current . next ; current . next = prev ; prev = current ; current = next ; } return prev ; } static Node multiplyHelp ( Node head , int M ) { Node res = head ; Node prev = null ; int carry = 0 , product = 1 ; while ( head != null ) { product = head . data * M ; product += carry ; carry = product / 10 ; head . data = product % 10 ; prev = head ; head = head . next ; } if ( carry > 0 ) prev . next = newNode ( carry ) ; return res ; } static Node multiply ( Node head , int M ) { head = reverse ( head ) ; head = multiplyHelp ( head , M ) ; return reverse ( head ) ; } static void printList ( Node node ) { while ( node != null ) { Console . Write ( node . data ) ; node = node . next ; } } public static void Main ( String [ ] args ) { Node head = newNode ( 1 ) ; head . next = newNode ( 2 ) ; head . next . next = newNode ( 7 ) ; head . next . next . next = newNode ( 3 ) ; int M = 3 ; head = multiply ( head , M ) ; printList ( head ) ; } }

Accumulator variables: product
Class/struct names: GFG, Node
C# program:
using System ; class GFG { public static int minimumSubarray ( int [ ] arr , int n , int m ) { int [ ] mapu = new int [ m + 1 ] ; Array . Fill ( mapu , 0 ) ; int c = 0 ; for ( int i = 0 ; i < n ; i ++ ) { mapu [ arr [ i ] ] ++ ; if ( mapu [ arr [ i ] ] == ( n / m ) + 1 ) c ++ ; } if ( c == 0 ) return 0 ; int ans = n ; int l = 0 , r = 0 ; while ( r < n ) { if ( -- mapu [ arr [ r ] ] == ( n / m ) ) c -- ; if ( c == 0 ) { while ( l <= r && c == 0 ) { ans = Math . Min ( ans , r - l + 1 ) ; if ( ++ mapu [ arr [ l ] ] > ( n / m ) ) c ++ ; l ++ ; } } r ++ ; } return ans ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 1 , 2 , 1 , 1 , 2 } ; int M = 2 ; int N = arr . Length ; Console . Write ( minimumSubarray ( arr , N , M ) ) ; } }

Index/key variables: i, l, r
Accumulator variables: c, i, l, r
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { static String checkSum ( int [ ] arr , int n , int k ) { Dictionary < int , int > m = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) if ( m . ContainsKey ( arr [ i ] ) ) { m [ arr [ i ] ] = m [ arr [ i ] ] + 1 ; } else { m . Add ( arr [ i ] , 1 ) ; } List < int > [ ] freq = new List < int > [ n + 1 ] ; for ( int i = 0 ; i < freq . Length ; i ++ ) freq [ i ] = new List < int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int f = m [ arr [ i ] ] ; if ( f != - 1 ) { freq [ f ] . Add ( arr [ i ] ) ; if ( m . ContainsKey ( arr [ i ] ) ) { m [ arr [ i ] ] = - 1 ; } else { m . Add ( arr [ i ] , - 1 ) ; } } } int count = 0 ; int kleastfreqsum = 0 ; for ( int i = 0 ; i <= n ; i ++ ) { foreach ( int x in freq [ i ] ) { kleastfreqsum += x ; count ++ ; if ( count == k ) break ; } if ( count == k ) break ; } count = 0 ; int kmostfreqsum = 0 ; for ( int i = n ; i >= 0 ; i -- ) { foreach ( int x in freq [ i ] ) { kmostfreqsum += x ; count ++ ; if ( count == k ) break ; } if ( count == k ) break ; } if ( kleastfreqsum == kmostfreqsum ) return " Yes " ; return " No " ; } public static void Main ( String [ ] args ) { int [ ] arr = { 3 , 2 , 1 , 2 , 3 , 3 , 4 } ; int N = arr . Length ; int K = 2 ; Console . Write ( checkSum ( arr , N , K ) ) ; } }

Index/key variables: f, i
Accumulator variables: count, i, kleastfreqsum, kmostfreqsum
Iterator variables: i, x
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class Program { static void solve ( int start , int end ) { string num = " " ; List < int > ans = new List < int > ( ) ; for ( int i = 1 ; i <= 9 ; i ++ ) { num = i . ToString ( ) ; int value = i ; if ( value >= start && value <= end ) { ans . Add ( value ) ; } for ( int j = i + 1 ; j <= 9 ; j ++ ) { num += j . ToString ( ) ; value = Int32 . Parse ( num ) ; if ( value >= start && value <= end ) { ans . Add ( value ) ; } } } ans . Sort ( ) ; foreach ( int it in ans ) Console . Write ( it + " ▁ " ) ; } static void Main ( ) { int L = 12 , R = 87 ; solve ( L , R ) ; } }

Accumulator variables: i, j, num
Iterator variables: i, it, j
Class/struct names: Program
C# program:
using System ; class GFG { static int minDistance ( int [ ] start , int [ ] end , int n , int d ) { int left = Int32 . MinValue ; int right = Int32 . MaxValue ; for ( int i = 0 ; i < n ; i ++ ) { left = Math . Max ( left , start [ i ] ) ; right = Math . Min ( right , end [ i ] ) ; } if ( left > right ) return - 1 ; if ( d >= left && d <= right ) return 0 ; if ( d < left ) return ( left - d ) ; if ( d > right ) return ( d - right ) ; return - 1 ; } public static void Main ( String [ ] args ) { int [ ] start = { 0 , 2 , 4 } ; int [ ] end = { 7 , 14 , 6 } ; int n = start . Length ; int d = 3 ; Console . Write ( minDistance ( start , end , n , d ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int power ( int x , int y ) { if ( y == 0 ) return 1 ; if ( y % 2 == 0 ) return power ( x , y / 2 ) * power ( x , y / 2 ) ; return x * power ( x , y / 2 ) * power ( x , y / 2 ) ; } static int order ( int num ) { int count = 0 ; while ( num > 0 ) { count ++ ; num = num / 10 ; } return count ; } static int isArmstrong ( int N ) { int r = order ( N ) ; int temp = N , sum = 0 ; while ( temp > 0 ) { int d = temp % 10 ; sum += power ( d , r ) ; temp = temp / 10 ; } if ( sum == N ) return 1 ; return 0 ; } static int maxSum ( int [ ] arr , int N , int K ) { if ( N < K ) { return - 1 ; } int res = 0 ; for ( int i = 0 ; i < K ; i ++ ) { res += arr [ i ] ; } int curr_sum = res ; for ( int i = K ; i < N ; i ++ ) { curr_sum += arr [ i ] - arr [ i - K ] ; res = Math . Max ( res , curr_sum ) ; } return res ; } static int maxArmstrong ( int [ ] arr , int N , int K ) { for ( int i = 0 ; i < N ; i ++ ) { arr [ i ] = isArmstrong ( arr [ i ] ) ; } return maxSum ( arr , N , K ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 28 , 2 , 3 , 6 , 153 , 99 , 828 , 24 } ; int K = 6 ; int N = arr . Length ; Console . Write ( maxArmstrong ( arr , N , K ) ) ; } }

Index/key variables: i
Accumulator variables: count, curr_sum, i, res, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int power ( int x , int y , int p ) { int res = 1 ; x = x % p ; if ( x == 0 ) return 0 ; while ( y > 0 ) { if ( ( y & 1 ) != 0 ) res = ( res * x ) % p ; x = ( x * x ) % p ; } return res ; } static int countArrays ( int n , int k ) { int mod = 1000000007 ; int ans = power ( n , k , mod ) ; return ans ; } public static void Main ( ) { int n = 3 , k = 5 ; int ans = countArrays ( n , k ) ; Console . Write ( ans ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int fact ( int n ) { int res = 1 ; for ( int i = 2 ; i <= n ; i ++ ) { res = res * i ; } return res ; } static int nCr ( int n , int r ) { return fact ( n ) / ( fact ( r ) * fact ( n - r ) ) ; } static void countWays ( string s , string t ) { int n = s . Length ; int sum1 = 0 , sum2 = 0 , K = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( s [ i ] == '1' ) { sum1 ++ ; } else sum1 -- ; } int m = t . Length ; for ( int i = 0 ; i < m ; i ++ ) { if ( t [ i ] == '1' ) { sum2 ++ ; } else if ( t [ i ] == '0' ) { sum2 -- ; } else K ++ ; } int P = Math . Abs ( sum1 - sum2 ) ; if ( ( P > K ) || ( ( K - P ) % 2 ) != 0 ) { Console . WriteLine ( 0 ) ; return ; } Console . WriteLine ( nCr ( K , ( P + K ) / 2 ) ) ; } static public void Main ( ) { string S1 = "1010" ; string S2 = "10 ? ? " ; countWays ( S1 , S2 ) ; } }

Index/key variables: i
Accumulator variables: K, i, sum1, sum2
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void countPairs ( int [ ] arr , int N ) { int answer = 0 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = i + 1 ; j < N ; j ++ ) { if ( arr [ i ] + arr [ j ] == i + j ) { answer ++ ; } } } Console . Write ( answer ) ; } public static void Main ( string [ ] args ) { int [ ] arr = { 0 , 1 , 2 , 3 , 4 , 5 } ; int N = arr . Length ; countPairs ( arr , N ) ; } }

Index/key variables: i, j
Accumulator variables: answer, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void checkDistribution ( int R , int B , int D ) { if ( Math . Max ( R , B ) <= Math . Min ( R , B ) * ( D + 1 ) ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } static public void Main ( ) { int R = 1 , B = 1 , D = 0 ; checkDistribution ( R , B , D ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { class pair { public int first ; public int second ; public pair ( int first , int second ) { this . first = first ; this . second = second ; } } static List < pair > primeFactor ( int N ) { List < pair > v = new List < pair > ( ) ; int count = 0 ; while ( ( N % 2 ) == 0 ) { N >>= 1 ; count ++ ; } if ( count != 0 ) v . Add ( new pair ( 2 , count ) ) ; for ( int i = 3 ; i <= Math . Sqrt ( N ) ; i += 2 ) { count = 0 ; while ( N % i == 0 ) { count ++ ; N = N / i ; } if ( count != 0 ) { v . Add ( new pair ( i , count ) ) ; } } if ( N > 2 ) v . Add ( new pair ( N , 1 ) ) ; return v ; } static void printAnswer ( int n ) { List < pair > v = primeFactor ( n ) ; int maxi_size = 0 , prime_factor = 0 ; for ( int i = 0 ; i < v . Count ; i ++ ) { if ( maxi_size < v [ i ] . second ) { maxi_size = v [ i ] . second ; prime_factor = v [ i ] . first ; } } if ( maxi_size < 2 ) { Console . Write ( 1 << ' ▁ ' ) ; } else { int product = 1 ; Console . Write ( maxi_size + " STRNEWLINE " ) ; for ( int i = 0 ; i < maxi_size - 1 ; i ++ ) { Console . Write ( prime_factor + " ▁ " ) ; product *= prime_factor ; } Console . Write ( ( n / product ) ) ; } } public static void Main ( String [ ] args ) { int N = 360 ; printAnswer ( N ) ; } }

Index/key variables: i
Accumulator variables: count, i, product
Iterator variables: i
Class/struct names: GFG, pair
C# program:
using System ; class GFG { static void IsEvenPath ( int [ ] Source , int [ ] Destination ) { int x_dif = Math . Abs ( Source [ 0 ] - Destination [ 0 ] ) ; int y_dif = Math . Abs ( Source [ 1 ] - Destination [ 1 ] ) ; int minsteps = x_dif + y_dif ; if ( minsteps % 2 == 0 ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } public static void Main ( string [ ] args ) { int [ ] Source = { 2 , 1 } ; int [ ] Destination = { 1 , 4 } ; IsEvenPath ( Source , Destination ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static long ABS ( long x ) { return Math . Max ( x , - x ) ; } static void findFraction ( long x , long y , long n ) { long A = - 1 , B = - 1 ; for ( long i = 1 ; i <= n ; i ++ ) { long d = ( i * x ) / y ; if ( d >= 0 && ( A == - 1 || ABS ( B * x - y * A ) * ABS ( i * y ) > ABS ( i * x - y * d ) * ABS ( B * y ) ) ) A = d ; B = i ; d ++ ; if ( d >= 0 && ( A == - 1 || ABS ( B * x - y * A ) * ABS ( i * y ) > ABS ( i * x - y * d ) * ABS ( B * y ) ) ) A = d ; B = i ; } A -- ; B -- ; Console . Write ( A + " / " + B ) ; } static public void Main ( ) { long x = 3 ; long y = 7 ; long n = 6 ; findFraction ( x , y , n ) ; } }

Accumulator variables: A, B, d, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static string BaseConversion ( int N ) { string s = " " ; while ( N != 0 ) { if ( N % 2 == 0 ) { s = "0" + s ; } else { s = "1" + s ; N -- ; } N /= - 2 ; } if ( s == " " ) { s = "0" ; } return s ; } public static void Main ( ) { int N = - 9 ; Console . Write ( BaseConversion ( N ) ) ; } }

Accumulator variables: N
Class/struct names: GFG
C# program:
using System ; class GFG { static void finalInstances ( int instances , int [ ] arr ) { int i = 0 ; while ( i < arr . Length ) { if ( arr [ i ] < 25 && instances > 1 ) { instances = ( instances / 2 ) ; i = i + 10 ; } else if ( arr [ i ] > 60 && instances <= Math . Pow ( 10 , 8 ) ) { instances = instances * 2 ; i = i + 10 ; } i = i + 1 ; } Console . Write ( instances ) ; } static void Main ( ) { int instances = 2 ; int [ ] arr = { 25 , 23 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 76 , 80 } ; finalInstances ( instances , arr ) ; } }

Index/key variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static string isMakeZero ( int [ ] arr , int N , int K ) { Dictionary < int , int > MP = new Dictionary < int , int > ( ) ; List < int > V = new List < int > ( ) ; int X = 1 ; int i ; while ( X > 0 && X < Int32 . MaxValue ) { V . Add ( X ) ; X *= K ; } for ( i = 0 ; i < N ; i ++ ) { for ( int j = V . Count - 1 ; j >= 0 ; j -- ) { if ( MP . ContainsKey ( V [ j ] ) == false && V [ j ] <= arr [ i ] ) { arr [ i ] -= V [ j ] ; MP [ V [ j ] ] = 1 ; } } if ( arr [ i ] != 0 ) break ; } if ( i < N ) return " No " ; else return " Yes " ; } public static void Main ( String [ ] args ) { int [ ] arr = { 8 , 0 , 3 , 4 , 80 } ; int N = arr . Length ; int K = 2 ; Console . WriteLine ( isMakeZero ( arr , N , K ) ) ; } }

Index/key variables: i, j
Accumulator variables: X, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static String perfectSquare ( int [ ] arr , int N ) { for ( int i = 0 ; i < N ; i ++ ) { int p = ( int ) Math . Sqrt ( arr [ i ] ) ; if ( p * p != arr [ i ] ) { return " No " ; } } return " Yes " ; } public static void Main ( ) { int [ ] arr = { 1 , 4 , 100 } ; int N = arr . Length ; Console . WriteLine ( perfectSquare ( 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 int countKAverageSubarrays ( int [ ] arr , int n , int k ) { int res = 0 ; for ( int L = 0 ; L < n ; L ++ ) { int sum = 0 ; for ( int R = L ; R < n ; R ++ ) { sum += arr [ R ] ; int len = ( R - L + 1 ) ; if ( sum % len == 0 ) { int avg = sum / len ; if ( avg == k ) res ++ ; } } } return res ; } public static void Main ( ) { int K = 6 ; int [ ] arr = { 12 , 5 , 3 , 10 , 4 , 8 , 10 , 12 , - 6 , - 1 } ; int N = arr . Length ; Console . Write ( countKAverageSubarrays ( arr , N , K ) ) ; } }

Index/key variables: R
Accumulator variables: L, R, res, sum
Iterator variables: L, R
Class/struct names: GFG
C# program:
using System ; class GFG { static int minimumElement ( int [ ] arr , int N , int K ) { int minElement = arr [ 0 ] ; for ( int i = 0 ; i < N ; ++ i ) { minElement = Math . Min ( minElement , arr [ i ] ) ; } int reqOperations = 0 ; for ( int i = 0 ; i < N ; ++ i ) { reqOperations += arr [ i ] - minElement ; } if ( reqOperations < K ) { K -= reqOperations ; minElement -= ( K + N - 1 ) / N ; } return minElement ; } public static void Main ( string [ ] args ) { int [ ] arr = { 10 , 10 , 10 , 10 } ; int K = 7 ; int N = arr . Length ; Console . Write ( minimumElement ( arr , N , K ) ) ; } }

Index/key variables: i
Accumulator variables: K, minElement, reqOperations
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static List < string > FractionSplit ( long n , long d ) { List < string > UnitFactions = new List < string > ( ) ; while ( n > 0 ) { long x = ( d + n - 1 ) / n ; string s = "1 / " + x . ToString ( ) ; UnitFactions . Add ( s ) ; n = n * x - d ; d = d * x ; } return UnitFactions ; } public static void Main ( string [ ] args ) { long n = 13 , d = 18 ; List < string > res = FractionSplit ( n , d ) ; foreach ( string s in res ) Console . Write ( s + " , ▁ " ) ; } }

Iterator variables: s
Class/struct names: GFG
C# program:
using System ; class GFG { static void findPermutation ( int N ) { int [ ] arr = new int [ N ] ; int temp ; for ( int i = 0 ; i < N ; i ++ ) { arr [ i ] = i + 1 ; } for ( int i = 1 ; i < N ; i += 2 ) { temp = arr [ i ] ; arr [ i ] = arr [ i - 1 ] ; arr [ i - 1 ] = temp ; } if ( N % 2 == 1 && N > 1 ) { temp = arr [ N - 1 ] ; arr [ N - 1 ] = arr [ N - 2 ] ; arr [ N - 2 ] = temp ; } for ( int i = 0 ; i < N ; i ++ ) { Console . Write ( arr [ i ] + " ▁ " ) ; } } public static void Main ( ) { int N = 7 ; findPermutation ( N ) ; } }

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