dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static void createSets ( long n ) { if ( n <= 2 ) { Console . Write ( " - 1" ) ; return ; } else { long x = ( n % 2 == 0 ) ? ( n / 2 ) : ( ( n + 1 ) / 2 ) ; Console . Write ( x + " STRNEWLINE " ) ; for ( int i = 1 ; i <= n ; i ++ ) { if ( i == x ) continue ; Console . Write ( i + " ▁ " ) ; } } return ; } public static void Main ( String [ ] args ) { long N = 7 ; createSets ( N ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int calcCount ( int [ ] arr , int n , int k ) { int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( k % arr [ i ] == 0 ) count ++ ; } return count ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 4 , 5 , 6 } ; int n = arr . Length ; int k = 6 ; Console . Write ( calcCount ( arr , n , k ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPerfect ( int n ) { int sum = 1 ; int i ; for ( i = 2 ; i * i <= n ; i ++ ) { if ( n % i == 0 ) { if ( i * i != n ) sum = sum + i + n / i ; else sum = sum + i ; } } if ( sum == n && n != 1 ) { return true ; } return false ; } static int contiguousPerfectNumber ( int [ ] arr , int n ) { int current_length = 0 ; int max_length = 0 ; int i ; for ( i = 0 ; i < n ; i ++ ) { if ( isPerfect ( arr [ i ] ) ) { current_length ++ ; } else { current_length = 0 ; } max_length = Math . Max ( max_length , current_length ) ; } return max_length ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 7 , 36 , 4 , 6 , 28 , 4 } ; int n = arr . Length ; Console . Write ( contiguousPerfectNumber ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: current_length, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class solution { static bool 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 int contiguousPowerfulNumber ( int [ ] arr , int n ) { int current_length = 0 ; int max_length = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( isPowerful ( arr [ i ] ) ) current_length ++ ; else current_length = 0 ; max_length = Math . Max ( max_length , current_length ) ; } return max_length ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 7 , 36 , 4 , 6 , 28 , 4 } ; int n = arr . Length ; Console . WriteLine ( contiguousPowerfulNumber ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: current_length, factor, i, n, power
Iterator variables: factor, i
Class/struct names: solution
C# program:
using System ; class GFG { static int maxSum ( int [ ] arr , int K , int start , int end , int max_sum ) { if ( K == 0 ) return max_sum ; int max_sum_start = max_sum + arr [ start ] ; int max_sum_end = max_sum + arr [ end ] ; int ans = Math . Max ( maxSum ( arr , K - 1 , start + 1 , end , max_sum_start ) , maxSum ( arr , K - 1 , start , end - 1 , max_sum_end ) ) ; return ans ; } static void maximizeSum ( int [ ] arr , int K , int n ) { int max_sum = 0 ; int start = 0 ; int end = n - 1 ; Console . Write ( maxSum ( arr , K , start , end , max_sum ) ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 8 , 4 , 4 , 8 , 12 , 3 , 2 , 9 } ; int K = 3 ; int n = arr . Length ; maximizeSum ( arr , K , n ) ; } }

Index/key variables: end, start
Class/struct names: GFG
C# program:
using System ; class GFG { public static int maxPointCount ( int [ ] arr , int K , int size ) { int curr_points = 0 ; int max_points = 0 ; for ( int i = 0 ; i < K ; i ++ ) curr_points += arr [ i ] ; max_points = curr_points ; int j = size - 1 ; for ( int i = K - 1 ; i >= 0 ; i -- ) { curr_points = curr_points + arr [ j ] - arr [ i ] ; max_points = Math . Max ( curr_points , max_points ) ; j -- ; } return max_points ; } public static void Main ( String [ ] args ) { int [ ] arr = { 8 , 4 , 4 , 8 , 12 , 3 , 2 , 9 } ; int K = 3 ; int n = arr . Length ; Console . Write ( maxPointCount ( arr , K , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: curr_points, i, j
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int countPalindrome ( int n ) { int count ; if ( n % 2 == 1 ) { count = ( int ) Math . Pow ( 9 , ( n - 1 ) / 2 ) ; } else { count = ( int ) Math . Pow ( 9 , ( n - 2 ) / 2 ) ; } return count ; } static int sumPalindrome ( int n ) { int count = countPalindrome ( n ) ; int res = 0 ; if ( n == 1 ) return 9 ; if ( n == 2 ) return 99 ; for ( int i = 0 ; i < n ; i ++ ) { res = res * 10 + count * 5 ; } return res ; } public static void Main ( String [ ] args ) { int n = 3 ; Console . WriteLine ( sumPalindrome ( n ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int count ( int N , int B ) { int sum = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { sum += ( int ) ( ( B - 1 ) * Math . Pow ( B , i - 1 ) ) ; } return sum ; } public static void Main ( String [ ] args ) { int N = 2 , B = 10 ; Console . Write ( count ( N , B ) ) ; } }

Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static long SmallestPerfectSquare ( long N ) { long X = ( long ) 1e9 ; long ans ; for ( int i = 1 ; i < Math . Sqrt ( N ) ; i ++ ) { if ( N % i == 0 ) { long a = i ; long b = N / i ; if ( ( b - a != 0 ) && ( ( b - a ) % 2 == 0 ) ) { X = Math . Min ( X , ( b - a ) / 2 ) ; } } } if ( X != 1e9 ) ans = X * X ; else ans = - 1 ; return ans ; } public static void Main ( string [ ] args ) { long N = 3 ; Console . WriteLine ( SmallestPerfectSquare ( N ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int minCost ( int [ ] arr , int n , int circumference ) { Array . Sort ( arr ) ; int [ ] arr2 = new int [ 2 * n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr2 [ i ] = arr [ i ] ; arr2 [ i + n ] = arr [ i ] + circumference ; } int res = int . MaxValue ; for ( int i = 0 ; i < n ; i ++ ) res = Math . Min ( res , arr2 [ i + ( n - 1 ) ] - arr2 [ i ] ) ; return res ; } public static void Main ( String [ ] args ) { int [ ] arr = { 19 , 3 , 6 } ; int n = arr . Length ; int circumference = 20 ; Console . WriteLine ( minCost ( arr , n , circumference ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static int findunique ( int [ ] a , int k ) { int res = 0 ; for ( int i = 0 ; i < 32 ; i ++ ) { int p = 0 ; for ( int j = 0 ; j < a . Length ; j ++ ) { p += ( Math . Abs ( a [ j ] ) & ( 1 << i ) ) != 0 ? 1 : 0 ; } p %= k ; res += ( int ) Math . Pow ( 2 , i ) * p ; } int c = 0 ; for ( int x = 0 ; x < a . Length ; x ++ ) if ( a [ x ] == res ) { c = 1 ; break ; } return c == 1 ? res : - res ; } public static void Main ( string [ ] args ) { int [ ] a = { 12 , 12 , 2 , 2 , 3 } ; int k = 2 ; Console . Write ( findunique ( a , k ) ) ; } }

Index/key variables: j, x
Accumulator variables: i, j, p, res, x
Iterator variables: i, j, x
Class/struct names: GFG
C# program:
using System ; class GFG { static int __gcd ( int a , int b ) { if ( b == 0 ) return a ; else return __gcd ( b , a % b ) ; } static int MinimumGCD ( int [ ] arr , int n ) { int g = 0 ; for ( int i = 0 ; i < n ; i ++ ) { g = __gcd ( g , arr [ i ] ) ; } return g ; } public static void Main ( String [ ] args ) { int [ ] arr = { 2 , 4 , 6 , 8 , 3 } ; int N = arr . Length ; Console . WriteLine ( MinimumGCD ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int stepRequired ( int N ) { int cnt = 0 ; while ( N > 0 ) { N = N & ( N - 1 ) ; cnt ++ ; } return cnt ; } public static void Main ( String [ ] args ) { int N = 23 ; Console . Write ( stepRequired ( N ) ) ; } }

Accumulator variables: cnt
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPerfectSquare ( int x ) { int s = ( int ) Math . Sqrt ( x ) ; return ( s * s == x ) ; } static bool isFibonacci ( int n ) { return isPerfectSquare ( 5 * n * n + 4 ) || isPerfectSquare ( 5 * n * n - 4 ) ; } static void fibonacciSubarrays ( int [ ] arr , int n ) { int count = 0 ; for ( int i = 0 ; i < n ; ++ i ) { int sum = 0 ; for ( int j = i ; j < n ; ++ j ) { sum += arr [ j ] ; if ( isFibonacci ( sum ) ) { ++ count ; } } } Console . Write ( count ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 6 , 7 , 8 , 9 } ; int n = arr . Length ; fibonacciSubarrays ( arr , n ) ; } }

Index/key variables: j
Accumulator variables: sum
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections ; using System . Collections . Generic ; class GFG { static long mod = 1000000007 ; static long [ ] factorial = new long [ 100005 ] ; static void StoreFactorials ( int n ) { factorial [ 0 ] = 1 ; for ( int i = 1 ; i <= n ; i ++ ) { factorial [ i ] = ( i * factorial [ i - 1 ] ) % mod ; } } static long Power ( long x , long y ) { long ans = 1 ; while ( y > 0 ) { if ( y % 2 == 1 ) { ans = ( ans * x ) % mod ; } x = ( x * x ) % mod ; y /= 2 ; } return ans ; } static long invmod ( long x ) { return Power ( x , mod - 2 ) ; } static long nCr ( int n , int r ) { return ( factorial [ n ] * invmod ( ( factorial [ r ] * factorial [ n - r ] ) % mod ) ) % mod ; } static long CountWays ( int n , int k ) { StoreFactorials ( n ) ; long ans = 0 ; for ( int i = k ; i >= 0 ; i -- ) { if ( i % 2 == k % 2 ) { ans = ( ans + ( Power ( i , n ) * nCr ( k , i ) ) % mod ) % mod ; } else { ans = ( ans + mod - ( Power ( i , n ) * nCr ( k , i ) ) % mod ) % mod ; } } ans = ( ans * nCr ( n , k ) ) % mod ; return ans ; } public static void Main ( string [ ] args ) { int N = 5 ; int K = 5 ; Console . Write ( CountWays ( N , K ) + " STRNEWLINE " ) ; } }

Index/key variables: i, n, r
Accumulator variables: i, y
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void PrintReverseOrder ( int N ) { if ( N <= 0 ) { return ; } else { Console . Write ( N + " ▁ " ) ; PrintReverseOrder ( N - 1 ) ; } } public static void Main ( ) { int N = 5 ; PrintReverseOrder ( N ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void XOROfElements ( int [ ] arr , int n ) { int FirstHalfXOR = 0 ; int SecondHalfXOR = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( i < n / 2 ) FirstHalfXOR ^= arr [ i ] ; else SecondHalfXOR ^= arr [ i ] ; } Console . Write ( FirstHalfXOR + " , " + SecondHalfXOR + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 20 , 30 , 50 , 10 , 55 , 15 , 42 } ; int N = arr . Length ; XOROfElements ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: FirstHalfXOR, SecondHalfXOR, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static double Volume_of_cone ( double R ) { double V = ( double ) ( ( 1 / 3.0 ) * ( 3.14 ) * ( 2 * ( R * R ) ) * ( 4 * R ) ) ; return V ; } public static void Main ( ) { double R = 10.0 ; Console . Write ( Volume_of_cone ( R ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void find_volume ( double area , double h ) { double Volume = ( area * h ) ; Console . WriteLine ( " Volume : ▁ " + Volume ) ; } static void find_Surface_area ( double area , double a , double h ) { double Surface_area = ( 2 * area ) + ( 8 * a * h ) ; Console . WriteLine ( " Surface ▁ area : ▁ " + Surface_area ) ; } public static void Main ( string [ ] args ) { double h = 1 ; double a = 6 ; double d = 2 ; double area = 2 * a * d ; find_Surface_area ( area , a , h ) ; find_volume ( area , h ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static readonly int N = 100005 ; static int [ ] phi = new int [ N ] ; static int [ ] pref = new int [ N ] ; static void precompute ( ) { phi [ 1 ] = 0 ; for ( int i = 2 ; i < N ; i ++ ) phi [ i ] = i ; for ( int p = 2 ; p < N ; p ++ ) { if ( phi [ p ] == p ) { phi [ p ] = p - 1 ; for ( int i = 2 * p ; i < N ; i += p ) { phi [ i ] = ( phi [ i ] / p ) * ( p - 1 ) ; } } } } static void prefix ( ) { for ( int i = 1 ; i < N ; i ++ ) pref [ i ] = pref [ i - 1 ] + phi [ i ] ; } static void find_pairs ( int n ) { int total = ( n * ( n - 1 ) ) / 2 ; int ans = total - pref [ n ] ; Console . Write ( " Number ▁ of ▁ pairs ▁ from ▁ 1 ▁ to ▁ " + n + " ▁ are ▁ " + ans + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { precompute ( ) ; prefix ( ) ; int [ ] q = { 5 , 7 } ; int n = q . Length ; for ( int i = 0 ; i < n ; i ++ ) { find_pairs ( q [ i ] ) ; } } }

Index/key variables: N, i, n, p
Accumulator variables: i, p
Iterator variables: i, p
Class/struct names: GFG
C# program:
using System ; public class GFG { static int gcd ( int a , int b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } static void balance ( int x , int y , int p , int q ) { int b1 , b2 , b3 ; if ( p % x == 0 && q % y == 0 ) { b1 = p / x ; b2 = q / y ; b3 = 1 ; } else { p = p * y ; q = q * x ; b3 = x * y ; int temp = gcd ( p , gcd ( q , b3 ) ) ; b1 = p / temp ; b2 = q / temp ; b3 = b3 / temp ; } Console . Write ( b1 + " ▁ " + b2 + " ▁ " + b3 + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { int x = 2 , y = 3 , p = 4 , q = 5 ; balance ( x , y , p , q ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int maxAlternatingSum ( int [ ] arr , int n ) { int max_sum = 0 ; int i = 0 ; while ( i < n ) { int current_max = arr [ i ] ; int k = i ; while ( k < n && ( ( arr [ i ] > 0 && arr [ k ] > 0 ) || ( arr [ i ] < 0 && arr [ k ] < 0 ) ) ) { current_max = Math . Max ( current_max , arr [ k ] ) ; k += 1 ; } max_sum += current_max ; i = k ; } return max_sum ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 4 , - 1 , - 2 } ; int n = arr . Length ; Console . Write ( maxAlternatingSum ( arr , n ) ) ; } }

Index/key variables: i, k
Accumulator variables: k, max_sum
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int subarrayLength ( int [ ] A , int [ , ] R , int N , int M ) { for ( int i = 0 ; i < M ; ++ i ) { int l = R [ i , 0 ] , r = R [ i , 1 ] + 1 ; l -- ; r -- ; A [ l ] ++ ; if ( r < N ) A [ r ] -- ; } for ( int i = 1 ; i < N ; ++ i ) { A [ i ] += A [ i - 1 ] ; } int count = 0 ; HashSet < int > s = new HashSet < int > ( ) ; for ( int i = 0 ; i < N ; ++ i ) { if ( ! s . Contains ( A [ i ] ) ) count ++ ; s . Add ( A [ i ] ) ; } int [ ] repeat = new int [ count + 1 ] ; int ans = N ; int counter = 0 , left = 0 , right = 0 ; while ( right < N ) { int cur_element = A [ right ] ; repeat [ cur_element ] += 1 ; if ( repeat [ cur_element ] == 1 ) ++ counter ; while ( counter == count ) { ans = Math . Min ( ans , right - left + 1 ) ; cur_element = A [ left ] ; repeat [ cur_element ] -= 1 ; ++ left ; if ( repeat [ cur_element ] == 0 ) -- counter ; } ++ right ; } return ans ; } public static void Main ( String [ ] args ) { int N = 8 , queries = 6 ; int [ , ] Q = { { 1 , 4 } , { 3 , 4 } , { 4 , 5 } , { 5 , 5 } , { 7 , 8 } , { 8 , 8 } } ; int [ ] A = new int [ N ] ; Console . Write ( subarrayLength ( A , Q , N , queries ) ) ; } }

Index/key variables: N, cur_element, i, l, left, r, right
Accumulator variables: count, l, r
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void ModifiedSieveOfEratosthenes ( int N , bool [ ] Expo_Prime ) { bool [ ] primes = new bool [ N ] ; for ( int i = 0 ; i < N ; i ++ ) primes [ i ] = true ; for ( int i = 2 ; i < N ; i ++ ) { if ( primes [ i ] ) { int no = i ; while ( no <= N ) { Expo_Prime [ no ] = true ; no *= i ; } for ( int j = i * i ; j < N ; j += i ) primes [ j ] = false ; } } } static void Display ( int [ ] arr , bool [ ] Expo_Prime , int n ) { for ( int i = 0 ; i < n ; i ++ ) if ( Expo_Prime [ arr [ i ] ] ) Console . Write ( arr [ i ] + " ▁ " ) ; } static void FindExpoPrime ( int [ ] arr , int n ) { int max = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( max < arr [ i ] ) max = arr [ i ] ; } bool [ ] Expo_Prime = new bool [ max + 1 ] ; ModifiedSieveOfEratosthenes ( max + 1 , Expo_Prime ) ; Display ( arr , Expo_Prime , n ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 4 , 6 , 9 , 16 , 1 , 3 , 12 , 36 , 625 , 1000 } ; int n = arr . Length ; FindExpoPrime ( arr , n ) ; } }

Index/key variables: N, i, j, no
Accumulator variables: i, j, no
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static double nthRoot ( long A , long N ) { double xPre = 7 ; double eps = 1e-3 ; double delX = int . MaxValue ; double xK = 0 ; while ( delX > eps ) { xK = ( ( N - 1.0 ) * xPre + ( double ) A / Math . Pow ( xPre , N - 1 ) ) / ( double ) N ; delX = Math . Abs ( xK - xPre ) ; xPre = xK ; } return xK ; } static bool check ( long no , int k ) { double kth_root = nthRoot ( no , k ) ; long num = ( long ) kth_root ; if ( Math . Abs ( num - kth_root ) < 1e-4 ) return true ; return false ; } static void printExpo ( long [ ] arr , int n , int k ) { for ( int i = 0 ; i < n ; i ++ ) { if ( check ( arr [ i ] , k ) ) Console . Write ( arr [ i ] + " ▁ " ) ; } } public static void Main ( String [ ] args ) { int K = 6 ; long [ ] arr = { 46656 , 64 , 256 , 729 , 16 , 1000 } ; int n = arr . Length ; printExpo ( arr , n , K ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int CntcontSubs ( int [ ] a , int n ) { int c = 0 , d = 0 , i , sum = 1 , j ; for ( i = 0 ; i < n ; i ++ ) { if ( a [ i ] % 2 != 0 a [ i ] % 4 == 0 ) d ++ ; sum = a [ i ] ; for ( j = i + 1 ; j < n ; j ++ ) { sum = sum * a [ j ] ; if ( sum % 2 != 0 sum % 4 == 0 ) c ++ ; } sum = 1 ; } return c + d ; } static void Main ( ) { int [ ] arr = { 5 , 4 , 2 , 9 , 8 } ; int n = arr . Length ; Console . Write ( CntcontSubs ( arr , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: c, d, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { class pair { public int first , second ; public pair ( int first , int second ) { this . first = first ; this . second = second ; } } static int CntcontSubs ( int [ ] a , int n ) { List < pair > vect = new List < pair > ( ) ; vect . Add ( new pair ( 0 , 2 ) ) ; List < int > two = new List < int > ( ) ; List < int > zero = new List < int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = a [ i ] % 4 ; if ( a [ i ] < 0 ) a [ i ] = a [ i ] + 4 ; if ( a [ i ] == 2 ) two . Add ( i + 1 ) ; if ( a [ i ] == 0 ) zero . Add ( i + 1 ) ; if ( a [ i ] == 0 a [ i ] == 2 ) vect . Add ( new pair ( i + 1 , a [ i ] ) ) ; } vect . Add ( new pair ( n + 1 , 2 ) ) ; int total = ( n * ( n + 1 ) ) / 2 ; if ( two . Count == 0 ) return total ; else { int sum = 0 ; int sz = vect . Count ; for ( int i = 1 ; i + 1 < sz ; i ++ ) { if ( vect [ i ] . second == 2 ) { sum += ( vect [ i ] . first - vect [ i - 1 ] . first ) * ( vect [ i + 1 ] . first - vect [ i ] . first ) - 1 ; } } return total - sum - two . Count ; } } public static void Main ( String [ ] args ) { int [ ] a = { 5 , 4 , 2 , 9 , 8 } ; int n = a . Length ; Console . Write ( CntcontSubs ( a , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG, pair
C# program:
using System ; class GFG { static int countSubarray ( int n ) { return ( ( n ) * ( n + 1 ) ) / 2 ; } static int countSubsequence ( int n ) { return ( int ) Math . Pow ( 2 , n ) ; } public static void Main ( String [ ] args ) { int n = 5 ; Console . Write ( ( countSubarray ( n ) ) + " STRNEWLINE " ) ; Console . Write ( ( countSubsequence ( n ) ) + " STRNEWLINE " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static float y ( float x ) { return ( 1 / ( 1 + x ) ) ; } static float BooleRule ( float a , float b ) { int n = 4 ; int h ; h = ( int ) ( ( b - a ) / n ) ; float sum = 0 ; float bl = ( 7 * y ( a ) + 32 * y ( a + h ) + 12 * y ( a + 2 * h ) + 32 * y ( a + 3 * h ) + 7 * y ( a + 4 * h ) ) * 2 * h / 45 ; sum = sum + bl ; return sum ; } public static void Main ( string [ ] args ) { Console . Write ( ( " f ( x ) ▁ = ▁ " + System . Math . Round ( BooleRule ( 0 , 4 ) , 4 ) ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int mod = 1000000007 ; static int countSubsets ( int [ ] a , int n ) { int answer = 0 ; int [ ] powerOfTwo = new int [ 100005 ] ; powerOfTwo [ 0 ] = 1 ; for ( int i = 1 ; i < 100005 ; i ++ ) powerOfTwo [ i ] = ( powerOfTwo [ i - 1 ] * 2 ) % mod ; Dictionary < int , int > frequency = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) if ( frequency . ContainsKey ( a [ i ] ) ) { frequency [ a [ i ] ] = frequency [ a [ i ] ] + 1 ; } else { frequency . Add ( a [ i ] , 1 ) ; } foreach ( KeyValuePair < int , int > el in frequency ) { if ( el . Key != 0 ) answer = ( answer % mod + powerOfTwo [ el . Value - 1 ] ) % mod ; else answer = ( answer % mod + powerOfTwo [ el . Value ] - 1 + mod ) % mod ; } return answer ; } public static void Main ( String [ ] args ) { int N = 6 ; int [ ] A = { 1 , 3 , 2 , 1 , 2 , 1 } ; Console . Write ( countSubsets ( A , N ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: el, i
Class/struct names: GFG
C# program:
using System ; public class GFG { static int [ ] pref = new int [ 10000 ] ; static int isPerfect ( int n ) { int sum = 1 ; for ( int i = 2 ; i * i <= n ; i ++ ) { if ( n % i == 0 ) { if ( i * i != n ) sum = sum + i + n / i ; else sum = sum + i ; } } if ( sum == n && n != 1 ) return n ; return 0 ; } static void precomputation ( ) { for ( int i = 1 ; i < 10000 ; ++ i ) { pref [ i ] = pref [ i - 1 ] + isPerfect ( i ) ; } } public static void Main ( String [ ] args ) { int L = 6 , R = 28 ; precomputation ( ) ; Console . WriteLine ( pref [ R ] - pref [ L - 1 ] ) ; } }

Index/key variables: R, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void convertToDecimal ( int N ) { Console . Write ( " Decimal ▁ number ▁ of ▁ " + N + " ▁ is : ▁ " ) ; if ( N != 0 ) { int decimalNumber = 0 ; int i = 0 , remainder ; while ( N != 0 ) { remainder = N % 10 ; N /= 10 ; decimalNumber += remainder * ( int ) Math . Pow ( 3 , i ) ; ++ i ; } Console . Write ( decimalNumber + " STRNEWLINE " ) ; } else Console . Write ( "0" + " STRNEWLINE " ) ; } public static void Main ( ) { int Ternary = 10202202 ; convertToDecimal ( Ternary ) ; } }

Accumulator variables: N, decimalNumber
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPerfectSquare ( int N ) { double sr = Math . Sqrt ( N ) ; return ( sr - Math . Floor ( sr ) ) == 0 ; } static void BetrothedNumbers ( int n , int m ) { int Sum1 = 1 ; int Sum2 = 1 ; for ( int i = 2 ; i <= Math . Sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { Sum1 += i + ( isPerfectSquare ( n ) ? 0 : n / i ) ; } } for ( int i = 2 ; i <= Math . Sqrt ( m ) ; i ++ ) { if ( m % i == 0 ) { Sum2 += i + ( isPerfectSquare ( m ) ? 0 : m / i ) ; } } if ( ( n + 1 == Sum2 ) && ( m + 1 == Sum1 ) ) { Console . Write ( " YES " + " STRNEWLINE " ) ; } else { Console . Write ( " NO " + " STRNEWLINE " ) ; } } public static void Main ( String [ ] args ) { int N = 9504 ; int M = 20734 ; BetrothedNumbers ( N , M ) ; } }

Accumulator variables: Sum1, Sum2, i
Iterator variables: i
Class/struct names: GFG