dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static void reduceFraction ( int x , int y ) { int d ; d = __gcd ( x , y ) ; x = x / d ; y = y / d ; Console . WriteLine ( " x ▁ = ▁ " + x + " , ▁ y ▁ = ▁ " + y ) ; } static int __gcd ( int a , int b ) { if ( b == 0 ) return a ; return __gcd ( b , a % b ) ; } public static void Main ( String [ ] args ) { int x = 16 ; int y = 10 ; reduceFraction ( x , y ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int maxlen = 100 ; public static void generateSubStrings ( String s , Dictionary < String , int > mpp ) { int l = s . Length ; for ( int i = 0 ; i < l ; i ++ ) { String temp = " " ; for ( int j = i ; j < l ; j ++ ) { temp += s [ j ] ; if ( mpp . ContainsKey ( temp ) ) { mpp [ temp ] = ++ mpp [ temp ] ; } else mpp . Add ( temp , 1 ) ; } } } public static void binomialCoeff ( int [ , ] C ) { int i , j ; for ( i = 1 ; i < 100 ; i ++ ) { for ( j = 0 ; j < 100 ; j ++ ) { if ( j == 0 j == i ) C [ i , j ] = 1 ; else C [ i , j ] = C [ i - 1 , j - 1 ] + C [ i - 1 , j ] ; } } } public static int answerQuery ( Dictionary < String , int > mpp , int [ , ] C , int k ) { int ans = 0 ; foreach ( KeyValuePair < String , int > entry in mpp ) { if ( entry . Value >= k ) ans += C [ entry . Value , k ] ; } return ans ; } public static void Main ( String [ ] args ) { String s = " aabaab " ; Dictionary < String , int > mpp = new Dictionary < String , int > ( ) ; generateSubStrings ( s , mpp ) ; int [ , ] C = new int [ maxlen , maxlen ] ; binomialCoeff ( C ) ; int [ ] queries = { 2 , 3 , 4 } ; int q = queries . Length ; for ( int i = 0 ; i < q ; i ++ ) Console . WriteLine ( answerQuery ( mpp , C , queries [ i ] ) ) ; } }

Index/key variables: i, j, temp
Accumulator variables: ans, i, j, temp
Iterator variables: entry, i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static float noOfYears ( int t1 , int n1 , int t2 ) { float years = ( ( t2 - 1 ) * n1 / ( float ) ( t1 - 1 ) ) ; return years ; } public static void Main ( String [ ] args ) { int T1 = 3 , N1 = 5 , T2 = 6 ; Console . WriteLine ( noOfYears ( T1 , N1 , T2 ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPossible ( int n ) { int [ ] fac = new int [ 10 ] ; fac [ 0 ] = fac [ 1 ] = 1 ; for ( int i = 2 ; i < 10 ; i ++ ) fac [ i ] = fac [ i - 1 ] * i ; int sum = 0 ; int x = n ; while ( x != 0 ) { sum += fac [ x % 10 ] ; x /= 10 ; } if ( sum % n == 0 ) return true ; return false ; } public static void Main ( ) { int n = 19 ; if ( isPossible ( n ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Index/key variables: i
Accumulator variables: i, sum, x
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void findSubsequence ( 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 ] ] ++ ; else M [ arr [ i ] ] = 1 ; } int [ ] numCount = new int [ k + 1 ] ; for ( int i = 0 ; i <= k ; ++ i ) numCount [ i ] = 0 ; Dictionary < int , int > . KeyCollection keyColl = M . Keys ; foreach ( int key in keyColl ) { if ( key <= k ) { for ( int i = 1 ; ; ++ i ) { if ( key * i > k ) break ; numCount [ key * i ] += M [ key ] ; } } else break ; } int lcm = 0 , length = 0 ; for ( int i = 1 ; i <= k ; ++ i ) { if ( numCount [ i ] > length ) { length = numCount [ i ] ; lcm = i ; } } if ( lcm == 0 ) Console . WriteLine ( - 1 ) ; else { Console . WriteLine ( " LCM ▁ = ▁ " + lcm + " ▁ Length ▁ = ▁ " + length ) ; Console . Write ( " Indexes ▁ = ▁ " ) ; for ( int i = 0 ; i < n ; ++ i ) if ( lcm % arr [ i ] == 0 ) Console . Write ( i + " ▁ " ) ; } } public static void Main ( ) { int k = 14 ; int [ ] arr = { 2 , 3 , 4 , 5 } ; int n = arr . Length ; findSubsequence ( arr , n , k ) ; } }

Index/key variables: i, key
Iterator variables: i, key
Class/struct names: GFG
C# program:
using System ; class GFG { static int mod = ( int ) ( 1e9 + 7 ) ; static int power ( int x , int y , int p ) { while ( y > 0 ) { if ( ( y & 1 ) == 1 ) res = ( res * x ) % p ; x = ( x * x ) % p ; } return res ; } static int findCount ( int N ) { int count = power ( 2 , N , mod ) ; return count ; } public static void Main ( ) { int N = 25 ; Console . WriteLine ( findCount ( N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int msb ( int x ) { int ret = 0 ; while ( ( x >> ( ret + 1 ) ) != 0 ) ret ++ ; return ret ; } static int xorRange ( int l , int r ) { int max_bit = msb ( r ) ; int mul = 2 ; int ans = 0 ; for ( int i = 1 ; i <= max_bit ; i ++ ) { if ( ( l / mul ) * mul == ( r / mul ) * mul ) { if ( ( ( l & ( 1 << i ) ) != 0 ) && ( r - l + 1 ) % 2 == 1 ) ans += mul ; mul *= 2 ; continue ; } int odd_c = 0 ; if ( ( ( l & ( 1 << i ) ) != 0 ) && l % 2 == 1 ) odd_c = ( odd_c ^ 1 ) ; if ( ( ( r & ( 1 << i ) ) != 0 ) && r % 2 == 0 ) odd_c = ( odd_c ^ 1 ) ; if ( odd_c != 0 ) ans += mul ; mul *= 2 ; } int zero_bit_cnt = zero_bit_cnt = ( r - l + 1 ) / 2 ; if ( l % 2 == 1 && r % 2 == 1 ) zero_bit_cnt ++ ; if ( zero_bit_cnt % 2 == 1 ) ans ++ ; return ans ; } public static void Main ( String [ ] args ) { int l = 1 , r = 4 ; Console . Write ( xorRange ( l , r ) ) ; } }

Accumulator variables: ans, i, mul, ret, zero_bit_cnt
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static long computeXOR ( int n ) { int x = n & 3 ; switch ( x ) { case 0 : return n ; case 1 : return 1 ; case 2 : return n + 1 ; case 3 : return 0 ; } return 0 ; } static void Main ( ) { int l = 1 , r = 4 ; Console . WriteLine ( computeXOR ( r ) ^ computeXOR ( l - 1 ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int countNumbers ( int x , int n ) { if ( x > n ) return 0 ; return 1 + countNumbers ( x * 10 , n ) + countNumbers ( x * 10 + 1 , n ) ; } public static void Main ( ) { int n = 120 ; Console . WriteLine ( countNumbers ( 1 , n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool checkfact ( int N , int countprime , int prime ) { int countfact = 0 ; if ( prime == 2 prime == 3 ) countfact ++ ; int divide = prime ; while ( N / divide != 0 ) { countfact += N / divide ; divide = divide * divide ; } if ( countfact >= countprime ) return true ; else return false ; } static bool check ( int N ) { int sumsquares = ( N + 1 ) * ( 2 * N + 1 ) ; int countprime = 0 ; for ( int i = 2 ; i <= Math . Sqrt ( sumsquares ) ; i ++ ) { int flag = 0 ; while ( sumsquares % i == 0 ) { flag = 1 ; countprime ++ ; sumsquares /= i ; } if ( flag == 1 ) { if ( ! checkfact ( N - 1 , countprime , i ) ) return false ; countprime = 0 ; } } if ( sumsquares != 1 ) if ( ! checkfact ( N - 1 , 1 , sumsquares ) ) return false ; return true ; } public static void Main ( ) { int N = 5 ; if ( check ( N ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Accumulator variables: countfact, countprime, i, sumsquares
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int countNonIncreasing ( int [ ] arr , int n ) { int cnt = 0 ; int len = 1 ; for ( int i = 0 ; i < n - 1 ; ++ i ) { if ( arr [ i + 1 ] <= arr [ i ] ) len ++ ; else { cnt += ( ( ( len + 1 ) * len ) / 2 ) ; len = 1 ; } } if ( len > 1 ) cnt += ( ( ( len + 1 ) * len ) / 2 ) ; return cnt ; } public static void Main ( String [ ] args ) { int [ ] arr = { 5 , 2 , 3 , 7 , 1 , 1 } ; int n = arr . Length ; Console . Write ( countNonIncreasing ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: cnt, len
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int recamanGenerator ( int [ ] arr , int n ) { arr [ 0 ] = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { int temp = arr [ i - 1 ] - i ; int j ; for ( j = 0 ; j < i ; j ++ ) { if ( ( arr [ j ] == temp ) temp < 0 ) { temp = arr [ i - 1 ] + i ; break ; } } arr [ i ] = temp ; } return 0 ; } static int recamanArray ( int [ ] arr , int n ) { HashSet < int > s = new HashSet < int > ( ) ; int [ ] recaman = new int [ n + 1 ] ; recamanGenerator ( recaman , n ) ; for ( int i = 0 ; i < n ; i ++ ) s . Add ( recaman [ i ] ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( s . Contains ( arr [ i ] ) ) s . Remove ( arr [ i ] ) ; } return s . Count ; } static void Main ( ) { int [ ] arr = { 7 , 11 , 20 , 4 , 2 , 1 , 8 , 6 } ; int n = arr . Length ; Console . Write ( recamanArray ( arr , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static bool isPerfectSquare ( int [ ] arr , int n ) { Dictionary < int , int > umap = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( umap . ContainsKey ( arr [ i ] ) ) umap [ arr [ i ] ] ++ ; else umap [ arr [ i ] ] = 1 ; } Dictionary < int , int > . ValueCollection valueColl = umap . Values ; foreach ( int val in valueColl ) { if ( val % 2 == 1 ) return false ; } return true ; } public static void Main ( ) { int [ ] arr = { 2 , 2 , 7 , 7 } ; int n = arr . Length ; if ( isPerfectSquare ( arr , n ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i, val
Class/struct names: GFG
C# program:
using System ; class GFG { static int printPermutation ( int n ) { if ( n % 2 != 0 ) { Console . WriteLine ( " - 1" ) ; } else for ( int i = 1 ; i <= n / 2 ; i ++ ) { Console . WriteLine ( 2 * i + " ▁ " + ( ( 2 * i ) - 1 ) + " ▁ " ) ; } return n ; } public static void Main ( String [ ] args ) { int n = 4 ; printPermutation ( n ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAXN = 10000000 ; static int minimumSteps ( int n , int m , int a , int b ) { if ( n > m ) return MAXN ; if ( n == m ) return 0 ; return Math . Min ( 1 + minimumSteps ( n * a , m , a , b ) , 1 + minimumSteps ( n * b , m , a , b ) ) ; } public static void Main ( ) { int n = 120 , m = 51840 ; int a = 2 , b = 3 ; Console . WriteLine ( minimumSteps ( n , m , a , b ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int minOperations ( int n , int m ) { if ( m % n != 0 ) return - 1 ; int minOperations = 0 ; int q = m / n ; while ( q % 2 == 0 ) { q = q / 2 ; minOperations ++ ; } while ( q % 3 == 0 ) { q = q / 3 ; minOperations ++ ; } if ( q == 1 ) return minOperations ; return - 1 ; } public static void Main ( ) { int n = 120 , m = 51840 ; Console . WriteLine ( minOperations ( n , m ) ) ; } }

Accumulator variables: minOperations
Class/struct names: GFG
C# program:
using System ; class GFG { static int fib ( int n ) { double phi = ( 1 + Math . Sqrt ( 5 ) ) / 2 ; return ( int ) Math . Round ( Math . Pow ( phi , n ) / Math . Sqrt ( 5 ) ) ; } static int calculateSum ( int l , int r ) { int sum = 0 ; for ( int i = l ; i <= r ; i ++ ) sum += fib ( i ) ; return sum ; } public static void Main ( ) { int l = 4 , r = 8 ; Console . WriteLine ( calculateSum ( l , r ) ) ; } }

Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static float sphereSide ( float h , float r ) { if ( h < 0 && r < 0 ) return - 1 ; float R = ( float ) ( ( h * r * Math . Sqrt ( 2 ) ) / ( h + Math . Sqrt ( 2 ) * r ) ) / 2 ; return R ; } public static void Main ( ) { float h = 5 , r = 6 ; Console . WriteLine ( sphereSide ( h , r ) ) ; } }

Class/struct names: GFG
C# program:
class GFG { static int possibleways ( int n ) { if ( n % 2 == 1 ) return 0 ; else if ( n % 4 == 0 ) return n / 4 - 1 ; else return n / 4 ; } static void Main ( ) { int n = 20 ; System . Console . WriteLine ( possibleways ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int countSubarrays ( int [ ] arr , int n , int K ) { int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i ; j < n ; j ++ ) { long product = 1 ; for ( int x = i ; x <= j ; x ++ ) product *= arr [ x ] ; if ( product % K == 0 ) count ++ ; } } return count ; } public static void Main ( ) { int [ ] arr = { 6 , 2 , 8 } ; int n = arr . Length ; int K = 4 ; Console . WriteLine ( countSubarrays ( arr , n , K ) ) ; } }

Index/key variables: x
Accumulator variables: count, i, j, product, x
Iterator variables: i, j, x
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX = 100002 ; static long [ ] tree = new long [ 4 * MAX ] ; static void build ( int node , int start , int end , int [ ] arr , int k ) { if ( start == end ) { tree [ node ] = ( 1L * arr [ start ] ) % k ; return ; } int mid = ( start + end ) >> 1 ; build ( 2 * node , start , mid , arr , k ) ; build ( 2 * node + 1 , mid + 1 , end , arr , k ) ; tree [ node ] = ( tree [ 2 * node ] * tree [ 2 * node + 1 ] ) % k ; } static long query ( int node , int start , int end , int l , int r , int k ) { if ( start > end start > r end < l ) { return 1 ; } if ( start >= l && end <= r ) { return tree [ node ] % k ; } int mid = ( start + end ) >> 1 ; long q1 = query ( 2 * node , start , mid , l , r , k ) ; long q2 = query ( 2 * node + 1 , mid + 1 , end , l , r , k ) ; return ( q1 * q2 ) % k ; } static long countSubarrays ( int [ ] arr , int n , int k ) { long count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i ; j < n ; j ++ ) { long product_mod_k = query ( 1 , 0 , n - 1 , i , j , k ) ; if ( product_mod_k == 0 ) { count ++ ; } } } return count ; } public static void Main ( String [ ] args ) { int [ ] arr = { 6 , 2 , 8 } ; int n = arr . Length ; int k = 4 ; build ( 1 , 0 , n - 1 , arr , k ) ; Console . WriteLine ( countSubarrays ( arr , n , k ) ) ; } }

Index/key variables: node, start
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void printMaxValPair ( List < long > v , int n ) { v . Sort ( ) ; long N = v [ ( int ) n - 1 ] ; if ( N % 2 == 1 ) { long first_maxima = N / 2 ; long second_maxima = first_maxima + 1 ; long ans1 = ( long ) 3e18 , ans2 = ( long ) 3e18 ; long from_left = - 1 , from_right = - 1 ; long from = - 1 ; for ( long i = 0 ; i < n ; ++ i ) { if ( v [ ( int ) i ] > first_maxima ) { from = i ; break ; } else { long diff = first_maxima - v [ ( int ) i ] ; if ( diff < ans1 ) { ans1 = diff ; from_left = v [ ( int ) i ] ; } } } from_right = v [ ( int ) from ] ; long diff1 = first_maxima - from_left ; long diff2 = from_right - second_maxima ; if ( diff1 < diff2 ) Console . WriteLine ( N + " ▁ " + from_left ) ; else Console . WriteLine ( N + " ▁ " + from_right ) ; } else { long maxima = N / 2 ; long ans1 = ( long ) 3e18 ; long R = - 1 ; for ( long i = 0 ; i < n - 1 ; ++ i ) { long diff = Math . Abs ( v [ ( int ) i ] - maxima ) ; if ( diff < ans1 ) { ans1 = diff ; R = v [ ( int ) i ] ; } } Console . WriteLine ( N + " ▁ " + R ) ; } } public static void Main ( String [ ] args ) { long [ ] arr = { 1 , 1 , 2 , 3 , 6 , 1 } ; List < long > v = new List < long > ( ) ; for ( int i = 0 ; i < arr . Length ; i ++ ) v . Add ( arr [ i ] ) ; int n = v . Count ; printMaxValPair ( v , n ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int Permutations ( int n , int k ) { int ans = 1 ; if ( k >= 2 ) ans += ( n ) * ( n - 1 ) / 2 ; if ( k >= 3 ) ans += ( n ) * ( n - 1 ) * ( n - 2 ) * 2 / 6 ; if ( k >= 4 ) ans += ( n ) * ( n - 1 ) * ( n - 2 ) * ( n - 3 ) * 9 / 24 ; return ans ; } public static void Main ( ) { int n = 5 , k = 2 ; Console . WriteLine ( Permutations ( n , k ) ) ; } }

Accumulator variables: ans
Class/struct names: GFG
C# program:
using System ; class GFG { static long power ( long a , long n ) { if ( n == 0 ) return 1 ; long p = power ( a , n / 2 ) ; p = p * p ; if ( n % 2 == 1 ) p = p * a ; return p ; } static int countIntegers ( long l , long r ) { long ans = 0 , i = 1 ; long v = power ( 2 , i ) ; while ( v <= r ) { while ( v <= r ) { if ( v >= l ) ans ++ ; v = v * 3 ; } i ++ ; v = power ( 2 , i ) ; } if ( l == 1 ) ans ++ ; return ( int ) ans ; } public static void Main ( ) { long l = 12 , r = 21 ; Console . WriteLine ( countIntegers ( l , r ) ) ; } }

Accumulator variables: ans, i
Class/struct names: GFG
C# program:
class GfG { static int findPairCount ( int N , int K ) { int count = 0 ; int [ ] rem = new int [ K ] ; rem [ 0 ] = N / K ; for ( int i = 1 ; i < K ; i ++ ) rem [ i ] = ( N - i ) / K + 1 ; if ( K % 2 == 0 ) { count += ( rem [ 0 ] * ( rem [ 0 ] - 1 ) ) / 2 ; for ( int i = 1 ; i < K / 2 ; i ++ ) count += rem [ i ] * rem [ K - i ] ; count += ( rem [ K / 2 ] * ( rem [ K / 2 ] - 1 ) ) / 2 ; } else { count += ( rem [ 0 ] * ( rem [ 0 ] - 1 ) ) / 2 ; for ( int i = 1 ; i <= K / 2 ; i ++ ) count += rem [ i ] * rem [ K - i ] ; } return count ; } static void Main ( ) { int N = 10 , K = 4 ; System . Console . WriteLine ( findPairCount ( N , K ) ) ; } }

Index/key variables: K, i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GfG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int N = 1000005 ; static Boolean [ ] prime = new Boolean [ N ] ; static void sieve ( ) { Array . Fill ( prime , true ) ; prime [ 1 ] = false ; prime [ 0 ] = false ; for ( int i = 2 ; i < N ; i ++ ) { if ( prime [ i ] ) { for ( int j = i * 2 ; j < N ; j += i ) { prime [ j ] = false ; } } } } static int sumTruncatablePrimes ( int n ) { int sum = 0 ; for ( int i = 2 ; i < n ; i ++ ) { int num = i ; Boolean flag = true ; while ( num > 0 ) { if ( ! prime [ num ] ) { flag = false ; break ; } num /= 10 ; } num = i ; int power = 10 ; while ( num / power > 0 ) { if ( ! prime [ num % power ] ) { flag = false ; break ; } power *= 10 ; } if ( flag ) { sum += i ; } } return sum ; } public static void Main ( String [ ] args ) { int n = 25 ; sieve ( ) ; Console . WriteLine ( sumTruncatablePrimes ( n ) ) ; } }

Index/key variables: N, i, j, num
Accumulator variables: i, j, num, power, sum
Iterator variables: i, j
Boolean variables: flag
Class/struct names: GFG
C# program:
using System ; public class GFG { static void nDigitPerfectSquares ( int n ) { int smallest = ( int ) Math . Pow ( Math . Ceiling ( Math . Sqrt ( Math . Pow ( 10 , n - 1 ) ) ) , 2 ) ; Console . Write ( smallest + " ▁ " ) ; int largest = ( int ) Math . Pow ( Math . Ceiling ( Math . Sqrt ( Math . Pow ( 10 , n ) ) ) - 1 , 2 ) ; Console . Write ( largest ) ; } public static void Main ( String [ ] args ) { int n = 4 ; nDigitPerfectSquares ( n ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int N = 3 ; static int MaxTraceSub ( int [ ] [ ] mat ) { int max_trace = 0 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) { int r = i , s = j , trace = 0 ; while ( r < N && s < N ) { trace += mat [ r ] [ s ] ; r ++ ; s ++ ; max_trace = Math . Max ( trace , max_trace ) ; } } } return max_trace ; } public static void Main ( ) { int [ ] [ ] mat = new int [ ] [ ] { new int [ ] { 10 , 2 , 5 } , new int [ ] { 6 , 10 , 4 } , new int [ ] { 2 , 7 , - 10 } } ; Console . WriteLine ( MaxTraceSub ( mat ) ) ; } }

Index/key variables: r, s
Accumulator variables: i, j, r, s, trace
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static readonly int n = 3 ; static readonly int m = 3 ; static bool check ( int [ , ] a , int [ , ] b ) { for ( int i = 0 ; i < n ; i ++ ) { List < int > v1 = new List < int > ( ) ; List < int > v2 = new List < int > ( ) ; int r = i ; int col = 0 ; while ( r >= 0 && col < m ) { v1 . Add ( a [ r , col ] ) ; v2 . Add ( b [ r , col ] ) ; r -- ; col ++ ; } v1 . Sort ( ) ; v2 . Sort ( ) ; for ( int j = 0 ; j < v1 . Count ; j ++ ) { if ( v1 [ j ] != v2 [ j ] ) { return false ; } } } for ( int j = 1 ; j < m ; j ++ ) { List < int > v1 = new List < int > ( ) ; List < int > v2 = new List < int > ( ) ; int r = n - 1 ; int col = j ; while ( r >= 0 && col < m ) { v1 . Add ( a [ r , col ] ) ; v2 . Add ( b [ r , col ] ) ; r -- ; col ++ ; } v1 . Sort ( ) ; v2 . Sort ( ) ; for ( int i = 0 ; i < v1 . Count ; i ++ ) { if ( v1 [ i ] != v2 [ i ] ) { return false ; } } } return true ; } public static void Main ( ) { int [ , ] a = { { 1 , 2 , 3 } , { 4 , 5 , 6 } , { 7 , 8 , 9 } } ; int [ , ] b = { { 1 , 4 , 7 } , { 2 , 5 , 6 } , { 3 , 8 , 9 } } ; if ( check ( a , b ) ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } }

Index/key variables: i, j
Accumulator variables: col, i, j, r
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class Solution { public static void lastDigit ( String a , String b ) { int lastDig = ( a [ a . Length - 1 ] - '0' ) * ( b [ b . Length - 1 ] - '0' ) ; Console . Write ( lastDig % 10 ) ; } public static void Main ( ) { String a = "1234567891233" , b = "1234567891233156" ; lastDigit ( a , b ) ; } }

Class/struct names: Solution
C# program:
using System ; class GfG { static void printPalindrome ( int n ) { if ( n == 1 ) { Console . WriteLine ( " Smallest ▁ Palindrome : ▁ 0" ) ; Console . WriteLine ( " Largest ▁ Palindrome : ▁ 9" ) ; } else { Console . WriteLine ( " Smallest ▁ Palindrome : ▁ " + ( int ) ( Math . Pow ( 10 , n - 1 ) ) + 1 ) ; Console . WriteLine ( " Largest ▁ Palindrome : ▁ " + ( ( int ) ( Math . Pow ( 10 , n ) ) - 1 ) ) ; } } public static void Main ( String [ ] args ) { int n = 4 ; printPalindrome ( n ) ; } }

Class/struct names: GfG
C# program:
using System ; class GFG { static int printSum ( int a , int b ) { int res = 0 ; int temp1 = 0 , temp2 = 0 ; while ( a != 0 ) { temp1 = temp1 * 10 + ( a % 10 ) ; a /= 10 ; } a = temp1 ; while ( b != 0 ) { temp2 = temp2 * 10 + ( b % 10 ) ; b /= 10 ; } b = temp2 ; while ( a != 0 ) { int sum = ( a % 10 + b % 10 ) ; if ( sum / 10 == 0 ) res = res * 10 + sum ; else { temp1 = 0 ; while ( sum != 0 ) { temp1 = temp1 * 10 + ( sum % 10 ) ; sum /= 10 ; } sum = temp1 ; while ( sum != 0 ) { res = res * 10 + ( sum % 10 ) ; sum /= 10 ; } } a /= 10 ; b /= 10 ; } return res ; } public static void Main ( ) { int a = 7752 , b = 8834 ; Console . Write ( printSum ( a , b ) ) ; } }

Accumulator variables: a, b, sum
Class/struct names: GFG
C# program:
using System ; class GFG { static int countDigits ( int a , int b ) { int count = 0 ; int p = Math . Abs ( a / b ) ; if ( p == 0 ) return 1 ; while ( p > 0 ) { count ++ ; p = p / 10 ; } return count ; } public static void Main ( ) { int a = 100 ; int b = 10 ; Console . Write ( countDigits ( a , b ) ) ; } }

Accumulator variables: count
Class/struct names: GFG
C# program:
using System ; class GFG { public static int countDigits ( int a , int b ) { double digits = Math . Log10 ( Math . Abs ( a ) ) - Math . Log10 ( Math . Abs ( b ) ) + 1 ; return ( int ) Math . Floor ( digits ) ; } static void Main ( ) { int a = 100 ; int b = 10 ; Console . Write ( countDigits ( a , b ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class Solution { static int smallestOdd ( int n ) { if ( n == 1 ) return 0 ; return Math . pow ( 10 , n - 1 ) + 1 ; } public static void Main ( ) { int n = 4 ; Console . Write ( smallestOdd ( n ) ) ; } }

Class/struct names: Solution
C# program:
using System ; class GFG { static void findNumbers ( int n ) { int odd = ( int ) Math . Pow ( 10 , n ) - 1 ; int even = odd - 1 ; Console . WriteLine ( " Even ▁ = ▁ " + even ) ; Console . Write ( " Odd ▁ = ▁ " + odd ) ; } public static void Main ( ) { int n = 4 ; findNumbers ( n ) ; } }

Class/struct names: GFG
C# program:
using System ; class Solution { static int smallestEven ( int n ) { if ( n == 1 ) return 0 ; return Math . pow ( 10 , n - 1 ) ; } public static void Main ( ) { int n = 4 ; Console . Write ( smallestEven ( n ) ) ; } }

Class/struct names: Solution