dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static int binomialCoeff ( int n , int k ) { int [ ] C = new int [ k + 1 ] ; C [ 0 ] = 1 ; for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = Math . Min ( i , k ) ; j > 0 ; j -- ) C [ j ] = C [ j ] + C [ j - 1 ] ; } return C [ k ] ; } static int count_of_subarrays ( int N ) { int count = binomialCoeff ( 2 * N - 1 , N ) ; return count ; } public static void Main ( ) { int N = 3 ; Console . WriteLine ( count_of_subarrays ( N ) ) ; } }

Index/key variables: j, k
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int usingBinarySearch ( int start , int end , int N , int S ) { if ( start >= end ) return start ; int mid = start + ( end - start ) / 2 ; int totalSum = ( N * ( N + 1 ) ) / 2 ; int midSum = ( mid * ( mid + 1 ) ) / 2 ; if ( ( totalSum - midSum ) <= S ) { return usingBinarySearch ( start , mid , N , S ) ; } return usingBinarySearch ( mid + 1 , end , N , S ) ; } public static void Main ( ) { int N , S ; N = 5 ; S = 11 ; Console . WriteLine ( N - usingBinarySearch ( 1 , N , N , S ) + 1 ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void distribution ( int n , int k , int l , int r , int S , int Sk ) { int [ ] a = new int [ n ] ; int len = k , temp , rem ; int diff = S - Sk ; for ( int i = 0 ; i < len ; i ++ ) { temp = Sk / k ; rem = Sk % k ; if ( temp + rem >= l && temp + rem <= r ) { a [ i ] = temp ; } else if ( temp + rem > r ) { a [ i ] = r ; } else if ( temp + rem < r ) { Console . Write ( " - 1" ) ; return ; } Sk = Sk - a [ i ] ; k = k - 1 ; } if ( Sk > 0 ) { Console . Write ( " - 1" ) ; return ; } if ( len != 0 ) { k = n - len ; for ( int i = len ; i < n ; i ++ ) { temp = diff / k ; rem = diff % k ; if ( temp + rem >= l && temp + rem <= r ) { a [ i ] = temp ; } else if ( temp + rem > r ) { a [ i ] = r ; } else if ( temp + rem < r ) { Console . Write ( " - 1" ) ; return ; } diff = diff - a [ i ] ; k = k - 1 ; } if ( diff != 0 ) { Console . Write ( " - 1" ) ; return ; } } for ( int i = 0 ; i < n ; i ++ ) { Console . Write ( a [ i ] + " ▁ " ) ; } } public static void Main ( String [ ] args ) { int n = 5 , k = 3 , l = 1 , r = 5 , S = 13 , Sk = 9 ; distribution ( n , k , l , r , S , Sk ) ; } }

Index/key variables: i, n
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int INT_MAX = int . MaxValue ; static int min_index ( int [ ] p , int n ) { int ans = 0 ; int mini = INT_MAX ; for ( int i = 0 ; i < n ; i ++ ) { if ( p [ i ] <= mini ) mini = p [ i ] ; if ( mini == p [ i ] ) ans ++ ; } return ans ; } public static void Main ( ) { int [ ] P = { 4 , 2 , 5 , 1 , 3 } ; int n = P . Length ; Console . WriteLine ( min_index ( P , n ) ) ; } }

Index/key variables: i
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void equal_xor_sum ( int [ ] arr , int n ) { int Sum = 0 ; int Xor = 0 ; for ( int i = 0 ; i < n ; i ++ ) { Sum = Sum + arr [ i ] ; Xor = Xor ^ arr [ i ] ; } if ( Sum == Xor ) Console . WriteLine ( " YES " ) ; else Console . WriteLine ( " NO " ) ; } public static void Main ( ) { int [ ] arr = { 6 , 3 , 7 , 10 } ; int n = arr . Length ; equal_xor_sum ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX = 10 ; static int countPalindromes ( int n , int m , int [ , ] matrix ) { int count = n * m ; int length_of_sequence_row ; int length_of_sequence_column ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { length_of_sequence_row = Math . Min ( j , m - 1 - j ) ; length_of_sequence_column = Math . Min ( i , n - i - 1 ) ; for ( int k = 1 ; k <= length_of_sequence_row ; k ++ ) { if ( matrix [ i , j - k ] == matrix [ i , j + k ] ) { count ++ ; } else { break ; } } for ( int k = 1 ; k <= length_of_sequence_column ; k ++ ) { if ( matrix [ i - k , j ] == matrix [ i + k , j ] ) { count ++ ; } else { break ; } } } } return count ; } public static void Main ( ) { int m = 3 , n = 3 ; int [ , ] matrix = { { 2 , 1 , 2 } , { 1 , 1 , 1 } , { 2 , 1 , 2 } } ; Console . WriteLine ( countPalindromes ( n , m , matrix ) ) ; } }

Accumulator variables: count, i, j, k
Iterator variables: i, j, k
Class/struct names: GFG
C# program:
using System ; class GFG { static int set_bits ( int n ) { int count = 0 ; while ( n > 0 ) { count += n % 2 ; n /= 2 ; } return count ; } static int minSteps ( int n ) { int ans = 0 ; while ( n != 1 ) { if ( n % 2 == 0 ) n /= 2 ; else if ( n == 3 || set_bits ( n - 1 ) < set_bits ( n + 1 ) ) n -- ; else n ++ ; ans ++ ; } return ans ; } public static void Main ( String [ ] args ) { int n = 15 ; Console . Write ( minSteps ( n ) ) ; } }

Accumulator variables: ans, count, n
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int minimumNo ( int n ) { int ans = 0 ; Stack < int > stack1 = new Stack < int > ( ) ; Stack < int > stack2 = new Stack < int > ( ) ; while ( n != 0 ) { int r = n % 10 ; if ( r % 2 == 0 ) { stack1 . Push ( r ) ; } else { stack2 . Push ( r ) ; } n = n / 10 ; } while ( stack1 . Count != 0 && stack2 . Count != 0 ) { if ( stack1 . Peek ( ) < stack2 . Peek ( ) ) { ans = ans * 10 + stack1 . Peek ( ) ; stack1 . Pop ( ) ; } else { ans = ans * 10 + stack2 . Peek ( ) ; stack2 . Pop ( ) ; } } while ( stack1 . Count != 0 ) { ans = ans * 10 + stack1 . Peek ( ) ; stack1 . Pop ( ) ; } while ( stack2 . Count != 0 ) { ans = ans * 10 + stack2 . Peek ( ) ; stack2 . Pop ( ) ; } return ans ; } public static void Main ( String [ ] args ) { int n1 = 64432 ; Console . Write ( minimumNo ( n1 ) + " STRNEWLINE " ) ; int n2 = 3137 ; Console . Write ( minimumNo ( n2 ) + " STRNEWLINE " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int lcm ( int a , int b ) { return ( a / __gcd ( a , b ) * b ) ; } static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } static void findNums ( int x ) { int ans = - 1 ; for ( int i = 1 ; i <= Math . Sqrt ( x ) ; i ++ ) { if ( x % i == 0 && lcm ( i , x / i ) == x ) { ans = i ; } } Console . Write ( ans + " ▁ " + ( x / ans ) ) ; } public static void Main ( String [ ] args ) { int x = 12 ; findNums ( x ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAXN = 1000000 ; static int max_element ( int [ ] A , int n ) { int max = A [ 0 ] ; for ( int i = 0 ; i < n ; i ++ ) if ( A [ i ] > max ) max = A [ i ] ; return max ; } static int maxCommonElement ( int [ ] A , int [ ] D , int N ) { int [ ] cnt = new int [ MAXN ] ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = A [ i ] ; j < MAXN ; j += D [ i ] ) cnt [ j ] ++ ; } int ans = 0 ; int com = 0 ; for ( int i = 0 ; i < MAXN ; i ++ ) { if ( cnt [ i ] > ans ) { ans = cnt [ i ] ; com = i ; } } return com ; } public static void Main ( ) { int [ ] A = { 13 , 1 , 2 , 5 } ; int [ ] D = { 5 , 10 , 1 , 12 } ; int N = A . Length ; Console . WriteLine ( maxCommonElement ( A , D , N ) ) ; } }

Index/key variables: MAXN, i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int findTrailingZeros ( int n ) { if ( ( n & 1 ) == 1 ) return 0 ; else { int ans = 0 ; n /= 2 ; while ( n != 0 ) { ans += n / 5 ; n /= 5 ; } return ans ; } } public static void Main ( String [ ] args ) { int n = 12 ; Console . WriteLine ( findTrailingZeros ( n ) ) ; } }

Accumulator variables: ans, n
Class/struct names: GFG
C# program:
using System ; class GFG { static int maxGCD ( int N , int K ) { int minSum = ( K * ( K + 1 ) ) / 2 ; if ( N < minSum ) return - 1 ; int i = ( int ) Math . Sqrt ( N ) ; int res = 1 ; while ( i >= 1 ) { if ( N % i == 0 ) { if ( i >= minSum ) res = Math . Max ( res , N / i ) ; if ( N / i >= minSum ) res = Math . Max ( res , i ) ; } i -- ; } return res ; } public static void Main ( ) { int N = 18 , K = 3 ; Console . WriteLine ( maxGCD ( N , K ) ) ; } }

Accumulator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static double r1 , r2 , r3 ; static double area ( double a , double b , double c ) { double p = ( a + b + c ) / 2 ; return Math . Sqrt ( p ) * Math . Sqrt ( p - a ) * Math . Sqrt ( p - b ) * Math . Sqrt ( p - c ) ; } static double binary_search ( ) { double s = area ( r1 + r2 , r2 + r3 , r3 + r1 ) ; double l = 0 , h = s / ( r1 + r2 + r3 ) ; while ( h - l > 0.00000001 ) { double mid = ( l + h ) / 2 ; double s1 = area ( mid + r1 , mid + r2 , r1 + r2 ) ; double s2 = area ( mid + r1 , mid + r3 , r1 + r3 ) ; double s3 = area ( mid + r2 , mid + r3 , r2 + r3 ) ; if ( s1 + s2 + s3 < s ) { l = mid ; } else { h = mid ; } } return ( l + h ) / 2 ; } public static void Main ( String [ ] args ) { r1 = 1.0 ; r2 = 2.0 ; r3 = 3.0 ; Console . Write ( " { 0 : F6 } " , binary_search ( ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static void Main ( String [ ] args ) { double r1 , r2 , r3 ; r1 = 1 ; r2 = 2 ; r3 = 3 ; double r4 = ( r1 * r2 * r3 ) / ( r1 * r2 + r2 * r3 + r1 * r3 + 2.0 * Math . Sqrt ( r1 * r2 * r3 * ( r1 + r2 + r3 ) ) ) ; Console . Write ( " { 0 : F6 } " , r4 ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool checkZeroArray ( int [ ] arr , int n ) { int sum = 0 , maximum = int . MinValue ; for ( int i = 0 ; i < n ; i ++ ) { sum = sum + arr [ i ] ; maximum = Math . Max ( maximum , arr [ i ] ) ; } if ( sum % 2 == 0 && maximum <= sum / 2 ) return true ; return false ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 1 , 2 , 2 } ; int n = arr . Length ; if ( checkZeroArray ( arr , n ) == true ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

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 bool subArray ( int [ ] arr , int n , int m ) { int i ; Dictionary < int , int > mp = new Dictionary < int , int > ( ) ; for ( i = 0 ; i < n ; i ++ ) { mp . Add ( arr [ i ] , i + 1 ) ; } int sumcur = 0 ; int p = int . MaxValue ; List < int > ans = new List < int > ( ) ; for ( i = 1 ; i <= m ; i ++ ) { sumcur += mp [ i ] ; p = Math . Min ( p , mp [ i ] ) ; int val = p * i - i + ( i * ( i + 1 ) ) / 2 ; if ( i == m ) { if ( val == sumcur ) { return true ; } else return false ; } } return false ; } public static void Main ( String [ ] args ) { int [ ] arr = { 4 , 5 , 1 , 3 , 2 , 6 } ; int n = arr . Length ; int m = 3 ; if ( subArray ( arr , n , m ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Index/key variables: i
Accumulator variables: i, sumcur
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPalindrome ( string s ) { int left = 0 , right = s . Length - 1 ; while ( left <= right ) { if ( s [ left ] != s [ right ] ) { return false ; } left ++ ; right -- ; } return true ; } static long getSum ( int n ) { int start = ( int ) Math . Pow ( 10 , n - 1 ) ; int end = ( int ) ( Math . Pow ( 10 , n ) - 1 ) ; long sum = 0 ; for ( int i = start ; i <= end ; i ++ ) { string s = i . ToString ( ) ; ; if ( isPalindrome ( s ) ) { sum += i ; } } return sum ; } public static void Main ( ) { int n = 1 ; long ans = getSum ( n ) ; Console . Write ( ans ) ; } }

Index/key variables: left, right
Accumulator variables: i, left, right, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static double getSum ( int n ) { double sum = 0 ; if ( n == 1 ) { sum = 45.0 ; } else { sum = ( 99.0 / 2.0 ) * Math . Pow ( 10 , n - 1 ) * Math . Pow ( 10 , ( n - 1 ) / 2 ) ; } return sum ; } public static void Main ( String [ ] args ) { int n = 3 ; double ans = getSum ( n ) ; Console . Write ( ans ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static long countPairs ( int [ ] arr , int n ) { long count = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { if ( arr [ i ] * arr [ j ] == arr [ i ] + arr [ j ] ) count ++ ; } } return count ; } public static void Main ( string [ ] args ) { int [ ] arr = { 2 , 0 , 3 , 2 , 0 } ; int n = arr . Length ; Console . WriteLine ( countPairs ( arr , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static long countPairs ( int [ ] arr , int n ) { int countZero = 0 ; int countTwo = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] == 0 ) countZero ++ ; else if ( arr [ i ] == 2 ) countTwo ++ ; } long pair0 = ( countZero * ( countZero - 1 ) ) / 2 ; long pair2 = ( countTwo * ( countTwo - 1 ) ) / 2 ; return pair0 + pair2 ; } public static void Main ( string [ ] args ) { int [ ] arr = { 2 , 0 , 3 , 2 , 0 } ; int n = arr . Length ; Console . WriteLine ( countPairs ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: countTwo, countZero, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int cntSubSeq ( int [ ] arr , int n ) { int pos_count = 0 ; int neg_count = 0 ; int result ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] > 0 ) pos_count ++ ; if ( arr [ i ] < 0 ) neg_count ++ ; } result = ( int ) Math . Pow ( 2 , pos_count ) ; if ( neg_count > 0 ) result *= ( int ) Math . Pow ( 2 , neg_count - 1 ) ; result -= 1 ; return result ; } public static void Main ( ) { int [ ] arr = { 2 , - 3 , - 1 , 4 } ; int n = arr . Length ; Console . Write ( cntSubSeq ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, neg_count, pos_count, result
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int findMin ( int [ ] arr , int n ) { int m = 0 ; for ( int i = 0 ; i < n ; i ++ ) m = Math . Max ( m , arr [ i ] ) ; int [ ] freq = new int [ m + 2 ] ; for ( int i = 0 ; i < n ; i ++ ) freq [ arr [ i ] ] ++ ; for ( int i = 1 ; i <= m + 1 ; i ++ ) { int j = i ; int cnt = 0 ; while ( j <= m ) { cnt += freq [ j ] ; j += i ; } if ( cnt == 0 ) return i ; } return m + 1 ; } public static void Main ( ) { int [ ] arr = { 2 , 12 , 6 } ; int n = arr . Length ; Console . WriteLine ( findMin ( arr , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: cnt, i, j
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int findMin ( int [ ] arr , int n ) { int m = 0 ; for ( int i = 0 ; i < n ; i ++ ) m = Math . Max ( m , arr [ i ] ) ; int [ ] cnt = new int [ m + 2 ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 1 ; j * j <= arr [ i ] ; j ++ ) { if ( arr [ i ] % j == 0 ) { if ( j * j == arr [ i ] ) cnt [ j ] ++ ; else { cnt [ j ] ++ ; cnt [ arr [ i ] / j ] ++ ; } } } } for ( int i = 1 ; i <= m + 1 ; i ++ ) if ( cnt [ i ] == 0 ) { return i ; } return - 1 ; } public static void Main ( String [ ] args ) { int [ ] arr = { 2 , 12 , 6 } ; int n = arr . Length ; Console . WriteLine ( findMin ( arr , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static float findNumber ( int N , int S ) { float i = ( ( ( float ) ( N ) * ( float ) ( N + 1 ) ) / 4 ) - ( ( float ) ( S + 1 ) / 2 ) ; return i ; } static void check ( int N , int S ) { float i = findNumber ( N , S ) ; int integerI = ( int ) i ; if ( i - integerI == 0 ) Console . WriteLine ( " Yes : ▁ " + integerI + " , ▁ " + ( integerI + 1 ) ) ; else Console . WriteLine ( " No " ) ; } public static void Main ( ) { int N = 4 , S = 3 ; check ( N , S ) ; N = 5 ; S = 3 ; check ( N , S ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int sz = ( int ) 1e5 ; static bool [ ] isPrime = new bool [ sz + 1 ] ; static void sieve ( ) { for ( int i = 0 ; i < sz + 1 ; i ++ ) isPrime [ i ] = true ; isPrime [ 0 ] = isPrime [ 1 ] = false ; for ( int i = 2 ; i * i <= sz ; i ++ ) { if ( isPrime [ i ] ) { for ( int j = i * i ; j < sz ; j += i ) { isPrime [ j ] = false ; } } } } static void printArray ( int [ ] arr , int len ) { for ( int i = 0 ; i < len ; i ++ ) { Console . Write ( arr [ i ] + " ▁ " ) ; } } static void removePrimes ( int [ ] arr , int len ) { sieve ( ) ; for ( int i = 0 ; i < len ; i ++ ) { if ( isPrime [ arr [ i ] ] ) { for ( int j = i ; j < len - 1 ; j ++ ) { arr [ j ] = arr [ j + 1 ] ; } i -- ; len -- ; } } printArray ( arr , len ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 4 , 6 , 5 , 3 , 8 , 7 , 10 , 11 , 14 , 15 } ; int len = arr . Length ; removePrimes ( arr , len ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, len
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int minOR ( int [ ] arr , int n ) { if ( n == 1 ) return 0 ; int [ ] pre = new int [ n ] ; int [ ] suf = new int [ n ] ; pre [ 0 ] = arr [ 0 ] ; suf [ n - 1 ] = arr [ n - 1 ] ; for ( int i = 1 ; i < n ; i ++ ) pre [ i ] = ( pre [ i - 1 ] arr [ i ] ) ; for ( int i = n - 2 ; i >= 0 ; i -- ) suf [ i ] = ( suf [ i + 1 ] arr [ i ] ) ; int ans = Math . Min ( pre [ n - 2 ] , suf [ 1 ] ) ; for ( int i = 1 ; i < n - 1 ; i ++ ) ans = Math . Min ( ans , ( pre [ i - 1 ] suf [ i + 1 ] ) ) ; return ans ; } static public void Main ( ) { int [ ] arr = { 1 , 2 , 3 } ; int n = arr . Length ; Console . WriteLine ( minOR ( arr , n ) ) ; } }

Index/key variables: i, n
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPossible ( int x , int y ) { if ( ( x - y ) == 1 ) return false ; return true ; } public static void Main ( String [ ] args ) { int x = 100 , y = 98 ; if ( isPossible ( x , y ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int subgrids ( int N , int Z , int [ ] row , int [ ] col , int r , int d ) { List < int > conrow = new List < int > ( ) ; List < int > concol = new List < int > ( ) ; int K = ( int ) Math . Sqrt ( Z ) ; conrow . Add ( row [ 0 ] - 0 - 1 ) ; conrow . Add ( N + 1 - row [ r - 1 ] - 1 ) ; for ( int i = 1 ; i < r ; i ++ ) { conrow . Add ( row [ i ] - row [ i - 1 ] - 1 ) ; } concol . Add ( col [ 0 ] - 0 - 1 ) ; concol . Add ( N + 1 - col [ d - 1 ] - 1 ) ; for ( int i = 1 ; i < d ; i ++ ) { concol . Add ( col [ i ] - col [ i - 1 ] - 1 ) ; } int row_size = conrow . Count ; int col_size = concol . Count ; int answer = 0 ; for ( int i = 0 ; i < row_size ; i ++ ) { for ( int j = 0 ; j < col_size ; j ++ ) { int total = ( concol [ j ] / K ) * ( conrow [ i ] / K ) ; answer += ( total ) ; } } return answer ; } public static void Main ( String [ ] args ) { int N = 8 , Z = 4 ; int [ ] row = { 4 , 6 } ; int [ ] col = { 3 , 8 } ; int r = row . Length ; int d = col . Length ; Console . Write ( subgrids ( N , Z , row , col , r , d ) ) ; } }

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 int countDigits ( int n ) { int cnt = 0 ; while ( n > 0 ) { cnt ++ ; n /= 10 ; } return cnt ; } static int digitPowSum ( int n ) { int sum = 0 ; int pw = countDigits ( n ) ; while ( n > 0 ) { int d = n % 10 ; sum += ( int ) Math . Pow ( d , pw ) ; pw -- ; n /= 10 ; } return sum ; } static int countNum ( int n ) { int count = 0 ; for ( int i = 0 ; i <= n ; i ++ ) { if ( i == digitPowSum ( i ) ) count ++ ; } return count ; } public static void Main ( String [ ] args ) { int n = 200 ; Console . WriteLine ( countNum ( n ) ) ; } }

Accumulator variables: cnt, count, i, n, pw, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void perfectSquares ( int l , int r ) { for ( int i = l ; i <= r ; i ++ ) { if ( Math . Sqrt ( i ) == ( int ) Math . Sqrt ( i ) ) Console . Write ( i + " ▁ " ) ; } } public static void Main ( String [ ] args ) { int l = 2 , r = 24 ; perfectSquares ( l , r ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void perfectSquares ( float l , float r ) { int number = ( int ) Math . Ceiling ( Math . Sqrt ( l ) ) ; int n2 = number * number ; number = ( number * 2 ) + 1 ; while ( ( n2 >= l && n2 <= r ) ) { Console . Write ( n2 + " ▁ " ) ; n2 = n2 + number ; number += 2 ; } } public static void Main ( String [ ] args ) { int l = 2 , r = 24 ; perfectSquares ( l , r ) ; } }

Accumulator variables: number
Class/struct names: GFG
C# program:
using System ; class GFG { static int xorK ( int n , int k ) { int res = n ; for ( int i = 1 ; i < k ; i ++ ) res = ( res ^ n ) ; return n ; } static public void Main ( ) { int n = 123 , k = 3 ; Console . Write ( xorK ( n , k ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void findRemainders ( long n ) { List < long > vc = new List < long > ( ) ; for ( long i = 1 ; i <= Math . Ceiling ( Math . Sqrt ( n ) ) ; i ++ ) vc . Add ( n / i ) ; for ( long i = ( long ) ( n / Math . Ceiling ( Math . Sqrt ( n ) ) - 1 ) ; i >= 0 ; i -- ) vc . Add ( i ) ; vc . Reverse ( ) ; foreach ( long it in vc ) Console . Write ( it + " ▁ " ) ; } public static void Main ( String [ ] args ) { long n = 5 ; findRemainders ( n ) ; } }

Accumulator variables: i
Iterator variables: i, it
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX = 100005 ; static bool [ ] prime = new bool [ MAX ] ; static void SieveOfEratosthenes ( ) { for ( int i = 0 ; i < MAX ; i ++ ) prime [ i ] = true ; prime [ 0 ] = false ; prime [ 1 ] = false ; for ( int p = 2 ; p * p < MAX ; p ++ ) { if ( prime [ p ] ) { for ( int i = p * 2 ; i < MAX ; i += p ) prime [ i ] = false ; } } } static int countPrimes ( int n ) { SieveOfEratosthenes ( ) ; int cnt = 0 ; for ( int i = 2 ; i < n ; i ++ ) { if ( prime [ i ] && prime [ i - 2 ] ) cnt ++ ; } return cnt ; } public static void Main ( String [ ] args ) { int n = 11 ; Console . Write ( countPrimes ( n ) ) ; } }

Index/key variables: MAX, i, p
Accumulator variables: cnt, i, p
Iterator variables: i, p
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX_VALID_YR = 9999 ; static int MIN_VALID_YR = 1800 ; static bool isLeap ( int year ) { return ( ( ( year % 4 == 0 ) && ( year % 100 != 0 ) ) || ( year % 400 == 0 ) ) ; } static bool isValidDate ( int d , int m , int y ) { if ( y > MAX_VALID_YR y < MIN_VALID_YR ) return false ; if ( m < 1 m > 12 ) return false ; if ( d < 1 d > 31 ) return false ; if ( m == 2 ) { if ( isLeap ( y ) ) return ( d <= 29 ) ; else return ( d <= 28 ) ; } if ( m == 4 m == 6 m == 9 m == 11 ) return ( d <= 30 ) ; return true ; } static void printPalindromeDates ( int y1 , int y2 ) { for ( int year = y1 ; year <= y2 ; year ++ ) { String str = String . Join ( " " , year ) ; String rev = str ; rev = reverse ( rev ) ; int day = Int32 . Parse ( rev . Substring ( 0 , 2 ) ) ; int month = Int32 . Parse ( rev . Substring ( 2 , 2 ) ) ; if ( isValidDate ( day , month , year ) ) { Console . Write ( rev + str + " STRNEWLINE " ) ; } } } static String reverse ( String input ) { char [ ] a = input . ToCharArray ( ) ; int l , r = a . Length - 1 ; for ( l = 0 ; l < r ; l ++ , r -- ) { char temp = a [ l ] ; a [ l ] = a [ r ] ; a [ r ] = temp ; } return String . Join ( " " , a ) ; } public static void Main ( String [ ] args ) { int y1 = 2001 , y2 = 2005 ; printPalindromeDates ( y1 , y2 ) ; } }

Index/key variables: l, r
Accumulator variables: l, r, year
Iterator variables: l, year
Class/struct names: GFG