dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; public class GFG { static int findAllSequence ( int N ) { if ( N % 2 == 0 ) { return ( int ) ( Math . Pow ( 2 , N / 2 + 1 ) + Math . Pow ( 2 , N / 2 ) - 2 ) ; } else { return ( int ) ( Math . Pow ( 2 , ( N + 1 ) / 2 ) + Math . Pow ( 2 , ( N + 1 ) / 2 ) - 2 ) ; } } public static void Main ( ) { int N = 2 ; Console . WriteLine ( findAllSequence ( N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int N = 1000000 ; static long [ ] phi = new long [ N + 5 ] ; static void computeTotient ( ) { for ( int i = 1 ; 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 long power ( long x , long y , long p ) { while ( y > 0 ) { if ( ( y & 1 ) > 0 ) res = ( res * x ) % p ; x = ( x * x ) % p ; } return res ; } static long calculate ( long x , long k , long mod ) { long [ ] arr = new long [ N ] ; long count = 0 ; while ( mod > 1 ) { arr [ ( int ) count ++ ] = mod ; mod = phi [ ( int ) mod ] ; } long result = 1 ; long loop = count + 1 ; arr [ ( int ) count ] = 1 ; for ( int i = ( int ) Math . Min ( k , loop ) - 1 ; i >= 0 ; i -- ) result = power ( x , result , arr [ i ] ) ; return result ; } static public void Main ( ) { computeTotient ( ) ; long x = 3 , k = 2 , m = 3 ; Console . WriteLine ( calculate ( x , k , m ) ) ; } }

Index/key variables: N, i, p
Accumulator variables: count, i, p
Iterator variables: i, p
Class/struct names: GFG
C# program:
using System ; class GFG { static int countOnes ( int n ) { int count = 1 ; int rem = 1 ; while ( rem != 0 ) { rem = ( rem * 10 + 1 ) % n ; count ++ ; } return count ; } static public void Main ( ) { int n = 13 ; Console . WriteLine ( countOnes ( n ) ) ; } }

Accumulator variables: count
Class/struct names: GFG
C# program:
using System ; class GFG { static int largestNum ( int a , int b ) { return a * ( ( a / b ) > 0 ? 1 : 0 ) + b * ( ( b / a ) > 0 ? 1 : 0 ) ; } public static void Main ( String [ ] args ) { int a = 22 , b = 1231 ; Console . Write ( largestNum ( a , b ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int gcd ( int a , int b ) { int c = a % b ; while ( c != 0 ) { a = b ; b = c ; c = a % b ; } return b ; } static int numberOfmeet ( int a , int b ) { int ans ; if ( a > b ) ans = a - b ; else ans = b - a ; if ( a < 0 ) a = a * ( - 1 ) ; if ( b < 0 ) b = b * ( - 1 ) ; return ans / gcd ( a , b ) ; } static public void Main ( ) { int a = 1 , b = - 1 ; Console . WriteLine ( numberOfmeet ( a , b ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { static int MAX = 1005 ; static void SieveOfEratosthenes ( List < int > primes ) { bool [ ] prime = new bool [ MAX ] ; for ( int i = 0 ; i < prime . Length ; i ++ ) { prime [ i ] = true ; } for ( int p = 2 ; p * p < MAX ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * 2 ; i < MAX ; i += p ) { prime [ i ] = false ; } } } for ( int p = 2 ; p < MAX ; p ++ ) { if ( prime [ p ] ) { primes . Add ( p ) ; } } } static int minimumSquareFreeDivisors ( int N ) { List < int > primes = new List < int > ( ) ; SieveOfEratosthenes ( primes ) ; int max_count = 0 ; for ( int i = 0 ; i < primes . Count && primes [ i ] * primes [ i ] <= N ; i ++ ) { if ( N % primes [ i ] == 0 ) { int tmp = 0 ; while ( N % primes [ i ] == 0 ) { tmp ++ ; N /= primes [ i ] ; } max_count = Math . Max ( max_count , tmp ) ; } } if ( max_count == 0 ) { max_count = 1 ; } return max_count ; } public static void Main ( ) { int N = 24 ; Console . WriteLine ( " Minimum ▁ Number ▁ of ▁ Square ▁ Free ▁ Divisors ▁ is ▁ " + minimumSquareFreeDivisors ( N ) ) ; N = 6 ; Console . WriteLine ( " Minimum ▁ Number ▁ of ▁ Square ▁ Free ▁ Divisors ▁ is ▁ " + minimumSquareFreeDivisors ( N ) ) ; } }

Index/key variables: MAX, i, p
Accumulator variables: N, i, p, tmp
Iterator variables: i, p
Class/struct names: GFG
C# program:
using System ; using System . Linq ; public class GFG { static int findMaxGCD ( int [ ] arr , int n , int k ) { int high = arr . Max ( ) ; int [ ] divisors = new int [ high + 1 ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 1 ; j <= Math . Sqrt ( arr [ i ] ) ; j ++ ) { if ( arr [ i ] % j == 0 ) { divisors [ j ] ++ ; if ( j != arr [ i ] / j ) divisors [ arr [ i ] / j ] ++ ; } } } for ( int i = high ; i >= 1 ; i -- ) if ( divisors [ i ] >= k ) return i ; return 0 ; } static public void Main ( ) { int [ ] arr = { 1 , 2 , 4 , 8 , 8 , 12 } ; int k = 3 ; int n = arr . Length ; Console . WriteLine ( findMaxGCD ( arr , n , k ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static double determinantOfMatrix ( double [ , ] mat ) { double ans ; ans = mat [ 0 , 0 ] * ( mat [ 1 , 1 ] * mat [ 2 , 2 ] - mat [ 2 , 1 ] * mat [ 1 , 2 ] ) - mat [ 0 , 1 ] * ( mat [ 1 , 0 ] * mat [ 2 , 2 ] - mat [ 1 , 2 ] * mat [ 2 , 0 ] ) + mat [ 0 , 2 ] * ( mat [ 1 , 0 ] * mat [ 2 , 1 ] - mat [ 1 , 1 ] * mat [ 2 , 0 ] ) ; return ans ; } static void findSolution ( double [ , ] coeff ) { double [ , ] d = { { coeff [ 0 , 0 ] , coeff [ 0 , 1 ] , coeff [ 0 , 2 ] } , { coeff [ 1 , 0 ] , coeff [ 1 , 1 ] , coeff [ 1 , 2 ] } , { coeff [ 2 , 0 ] , coeff [ 2 , 1 ] , coeff [ 2 , 2 ] } , } ; double [ , ] d1 = { { coeff [ 0 , 3 ] , coeff [ 0 , 1 ] , coeff [ 0 , 2 ] } , { coeff [ 1 , 3 ] , coeff [ 1 , 1 ] , coeff [ 1 , 2 ] } , { coeff [ 2 , 3 ] , coeff [ 2 , 1 ] , coeff [ 2 , 2 ] } , } ; double [ , ] d2 = { { coeff [ 0 , 0 ] , coeff [ 0 , 3 ] , coeff [ 0 , 2 ] } , { coeff [ 1 , 0 ] , coeff [ 1 , 3 ] , coeff [ 1 , 2 ] } , { coeff [ 2 , 0 ] , coeff [ 2 , 3 ] , coeff [ 2 , 2 ] } , } ; double [ , ] d3 = { { coeff [ 0 , 0 ] , coeff [ 0 , 1 ] , coeff [ 0 , 3 ] } , { coeff [ 1 , 0 ] , coeff [ 1 , 1 ] , coeff [ 1 , 3 ] } , { coeff [ 2 , 0 ] , coeff [ 2 , 1 ] , coeff [ 2 , 3 ] } , } ; double D = determinantOfMatrix ( d ) ; double D1 = determinantOfMatrix ( d1 ) ; double D2 = determinantOfMatrix ( d2 ) ; double D3 = determinantOfMatrix ( d3 ) ; Console . Write ( " D ▁ is ▁ : ▁ { 0 : F6 } ▁ STRNEWLINE " , D ) ; Console . Write ( " D1 ▁ is ▁ : ▁ { 0 : F6 } ▁ STRNEWLINE " , D1 ) ; Console . Write ( " D2 ▁ is ▁ : ▁ { 0 : F6 } ▁ STRNEWLINE " , D2 ) ; Console . Write ( " D3 ▁ is ▁ : ▁ { 0 : F6 } ▁ STRNEWLINE " , D3 ) ; if ( D != 0 ) { double x = D1 / D ; double y = D2 / D ; Console . Write ( " Value ▁ of ▁ x ▁ is ▁ : ▁ { 0 : F6 } STRNEWLINE " , x ) ; Console . Write ( " Value ▁ of ▁ y ▁ is ▁ : ▁ { 0 : F6 } STRNEWLINE " , y ) ; Console . Write ( " Value ▁ of ▁ z ▁ is ▁ : ▁ { 0 : F6 } STRNEWLINE " , z ) ; } else { if ( D1 == 0 && D2 == 0 && D3 == 0 ) Console . Write ( " Infinite ▁ solutions STRNEWLINE " ) ; else if ( D1 != 0 D2 != 0 D3 != 0 ) Console . Write ( " No ▁ solutions STRNEWLINE " ) ; } } public static void Main ( ) { double [ , ] coeff = { { 2 , - 1 , 3 , 9 } , { 1 , 1 , 1 , 6 } , { 1 , - 1 , 1 , 2 } } ; findSolution ( coeff ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void printGreater ( int x , int y ) { double X = y * Math . Log ( x ) ; double Y = x * Math . Log ( y ) ; if ( Math . Abs ( X - Y ) < 1e-9 ) { Console . WriteLine ( " Equal " ) ; } else if ( X > Y ) { Console . WriteLine ( x + " ^ " + y ) ; } else { Console . WriteLine ( y + " ^ " + x ) ; } } public static void Main ( ) { int x = 5 , y = 8 ; printGreater ( x , y ) ; } }

Class/struct names: GFG
C# program:
using System ; class Series { static int sumOfSeries ( int n ) { return n * ( n + 1 ) * ( 6 * n * n * n + 9 * n * n + n - 1 ) / 30 ; } public static void Main ( ) { int n = 4 ; Console . WriteLine ( sumOfSeries ( n ) ) ; } }

Class/struct names: Series
C# program:
using System ; public class GFG { static double mulmod ( long a , long b , long mod ) { a = a % mod ; while ( b > 0 ) { if ( b % 2 == 1 ) res = ( res + a ) % mod ; a = ( a * 2 ) % mod ; b /= 2 ; } return res % mod ; } static long findProduct ( long N ) { long product = 1 , fact = 1 ; long MOD = ( long ) ( 1e9 + 7 ) ; for ( int i = 1 ; i <= N ; i ++ ) { fact = ( long ) mulmod ( fact , i , MOD ) ; product = ( long ) mulmod ( product , fact , MOD ) ; if ( product == 0 ) return 0 ; } return product ; } static public void Main ( ) { long N = 3 ; Console . WriteLine ( findProduct ( N ) ) ; N = 5 ; Console . WriteLine ( findProduct ( N ) ) ; } }

Accumulator variables: b, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int divSum ( int n ) { int sum = 1 ; for ( int i = 2 ; i * i <= n ; i ++ ) if ( n % i == 0 ) sum = sum + i + n / i ; return sum ; } static bool areEquivalent ( int num1 , int num2 ) { return divSum ( num1 ) == divSum ( num2 ) ; } static public void Main ( ) { int num1 = 559 ; int num2 = 703 ; if ( areEquivalent ( num1 , num2 ) ) Console . WriteLine ( " Equivalent " ) ; else Console . WriteLine ( " Not ▁ Equivalent " ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int dodecahedral_num ( int n ) { return n * ( 3 * n - 1 ) * ( 3 * n - 2 ) / 2 ; } public static void Main ( ) { int n = 5 ; Console . Write ( n + " the ▁ Dodecahedral " + " ▁ number : " ) ; Console . WriteLine ( dodecahedral_num ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int bit ( int x ) { int ans = 0 ; while ( x > 0 ) { x /= 2 ; ans ++ ; } return ans ; } static bool check ( int d , int x ) { if ( bit ( x / d ) <= bit ( d ) ) return true ; return false ; } static int bs ( int n ) { int l = 1 , r = ( int ) Math . Sqrt ( n ) ; while ( l < r ) { int m = ( l + r ) / 2 ; if ( check ( m , n ) ) r = m ; else l = m + 1 ; } if ( ! check ( l , n ) ) return l + 1 ; else return l ; } static int countDivisor ( int n ) { return n - bs ( n ) + 1 ; } static public void Main ( ) { int n = 5 ; Console . WriteLine ( countDivisor ( n ) ) ; } }

Accumulator variables: ans, x
Class/struct names: GFG
C# program:
using System ; class GFG { static void swap ( ref int a , ref int b ) { int t = a ; a = b ; b = t ; } static bool everMeet ( int x1 , int x2 , int v1 , int v2 ) { if ( x1 < x2 && v1 <= v2 ) return false ; if ( x1 > x2 && v1 >= v2 ) return false ; if ( x1 < x2 ) { swap ( ref x1 , ref x2 ) ; swap ( ref v1 , ref v2 ) ; } while ( x1 >= x2 ) { if ( x1 == x2 ) return true ; x1 = x1 + v1 ; x2 = x2 + v2 ; } return false ; } static void Main ( ) { int x1 = 5 , v1 = 8 , x2 = 4 , v2 = 7 ; if ( everMeet ( x1 , x2 , v1 , v2 ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static String check ( int k , int d0 , int d1 ) { int s = ( 2 * ( d0 + d1 ) ) % 10 + ( 4 * ( d0 + d1 ) ) % 10 + ( 8 * ( d0 + d1 ) ) % 10 + ( 6 * ( d0 + d1 ) ) % 10 ; int a = ( k - 3 ) % 4 ; int x = 0 ; switch ( a ) { case 0 : x = 0 ; break ; case 1 : x = ( 2 * ( d0 + d1 ) ) % 10 ; break ; case 2 : x = ( 2 * ( d0 + d1 ) ) % 10 + ( 4 * ( d0 + d1 ) ) % 10 ; break ; case 3 : x = ( 2 * ( d0 + d1 ) ) % 10 + ( 4 * ( d0 + d1 ) ) % 10 + ( 8 * ( d0 + d1 ) ) % 10 ; break ; } int sum = d0 + d1 + ( ( ( k - 3 ) / 4 ) * s + x ) ; if ( sum % 3 == 0 ) return " YES " ; return " NO " ; } static public void Main ( ) { int k , d0 , d1 ; k = 13 ; d0 = 8 ; d1 = 1 ; Console . WriteLine ( check ( k , d0 , d1 ) ) ; k = 5 ; d0 = 3 ; d1 = 4 ; Console . WriteLine ( check ( k , d0 , d1 ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void Main ( ) { int a = 4 ; int b = 3 , val = 0 ; if ( ( a % b ) != 0 ) val = ( a / b ) + ( a % b ) ; else val = ( a / b ) ; Console . WriteLine ( " The ▁ ceiling ▁ " + " value ▁ of ▁ 4/3 ▁ is ▁ " + val ) ; a = 6 ; b = 3 ; if ( ( a % b ) != 0 ) val = ( a / b ) + ( a % b ) ; else val = ( a / b ) ; Console . WriteLine ( " The ▁ ceiling ▁ " + " value ▁ of ▁ 6/3 ▁ is ▁ " + val ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void printCollatz ( int n ) { while ( n != 1 ) { Console . Write ( n + " ▁ " ) ; if ( ( n & 1 ) == 1 ) n = 3 * n + 1 ; else n = n / 2 ; } Console . Write ( n ) ; } static void Main ( ) { printCollatz ( 6 ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void block ( long x ) { List < int > v = new List < int > ( ) ; Console . Write ( " Blocks ▁ for ▁ " + x + " ▁ : ▁ " ) ; while ( x > 0 ) { v . Add ( ( int ) x % 2 ) ; x = x / 2 ; } for ( int i = 0 ; i < v . Count ; i ++ ) { if ( v [ i ] == 1 ) { Console . Write ( i ) ; if ( i != v . Count - 1 ) Console . Write ( " , ▁ " ) ; } } Console . WriteLine ( ) ; } public static void Main ( ) { block ( 71307 ) ; block ( 1213 ) ; block ( 29 ) ; block ( 100 ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void findNumberOfDigits ( long n , int b ) { int dig = ( int ) ( Math . Floor ( Math . Log ( n ) / Math . Log ( b ) ) + 1 ) ; Console . Write ( " The ▁ Number ▁ of ▁ digits " + " ▁ of ▁ Number ▁ " + n + " ▁ in ▁ base ▁ " + b + " ▁ is ▁ " + dig ) ; } public static void Main ( ) { long n = 1446 ; int b = 7 ; findNumberOfDigits ( n , b ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool isValidNesbitt ( double a , double b , double c ) { double A = a / ( b + c ) ; double B = b / ( a + c ) ; double C = c / ( a + b ) ; double inequality = A + B + C ; return ( inequality >= 1.5 ) ; } static public void Main ( ) { double a = 1.0 , b = 2.0 , c = 3.0 ; if ( isValidNesbitt ( a , b , c ) == true ) { Console . Write ( " Nesbitt ' s ▁ inequality " + " ▁ satisfied ▁ " ) ; Console . WriteLine ( " for ▁ real ▁ numbers ▁ " + a + " , ▁ " + b + " , ▁ " + c ) ; } else Console . WriteLine ( " Nesbitts ▁ inequality " + " ▁ not ▁ satisfied " ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static List < int > primes ( int n ) { bool [ ] prime = new bool [ n + 1 ] ; for ( int i = 0 ; i < n + 1 ; i ++ ) prime [ i ] = true ; for ( int i = 2 ; i * i <= n ; i ++ ) { if ( prime [ i ] == true ) { for ( int j = i * 2 ; j <= n ; j += i ) prime [ j ] = false ; } } List < int > arr = new List < int > ( ) ; for ( int i = 2 ; i <= n ; i ++ ) { if ( prime [ i ] ) arr . Add ( i ) ; } return arr ; } static List < int > signature ( int n ) { List < int > r = primes ( n ) ; var factor = new Dictionary < int , int > ( ) ; List < int > sort_exp = new List < int > ( ) ; int k , t = n ; for ( int i = 0 ; i < r . Count ; i ++ ) { if ( n % r [ i ] == 0 ) { k = 0 ; while ( n % r [ i ] == 0 ) { n = n / r [ i ] ; k ++ ; } factor . Add ( r [ i ] , k ) ; sort_exp . Add ( k ) ; } } sort_exp . Sort ( ) ; Console . Write ( " ▁ The ▁ Ordered ▁ Prime ▁ Signature ▁ of ▁ " + t + " ▁ is ▁ : ▁ STRNEWLINE { ▁ " ) ; for ( int i = 0 ; i < sort_exp . Count ; i ++ ) { if ( i != sort_exp . Count - 1 ) Console . Write ( sort_exp [ i ] + " , ▁ " ) ; else Console . Write ( sort_exp [ i ] + " ▁ } STRNEWLINE " ) ; } return sort_exp ; } static void divisors ( int n ) { int f = 1 , l ; List < int > div = signature ( n ) ; l = div . Count ; for ( int i = 0 ; i < l ; i ++ ) { div [ i ] += 1 ; f *= div [ i ] ; } Console . Write ( " The ▁ total ▁ number ▁ of ▁ divisors ▁ of ▁ " + n + " ▁ is ▁ " + f + " STRNEWLINE " ) ; } static void Main ( ) { int n = 13 ; divisors ( n ) ; } }

Index/key variables: i, j
Accumulator variables: f, i, j, k
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { public static void printCubeFree ( int n ) { bool [ ] cubFree = new bool [ n + 1 ] ; for ( int i = 0 ; i <= n ; i ++ ) cubFree [ i ] = true ; for ( int i = 2 ; i * i * i <= n ; i ++ ) { if ( cubFree [ i ] ) { for ( int multiple = 1 ; i * i * i * multiple <= n ; multiple ++ ) { cubFree [ i * i * i * multiple ] = false ; } } } for ( int i = 2 ; i <= n ; i ++ ) { if ( cubFree [ i ] == true ) Console . Write ( i + " ▁ " ) ; } } public static void Main ( ) { printCubeFree ( 20 ) ; } }

Index/key variables: i
Accumulator variables: i, multiple
Iterator variables: i, multiple
Class/struct names: GFG
C# program:
using System ; class GFG { static void heapify ( int [ ] arr , int n , int i ) { int smallest = i ; int l = 2 * i + 1 ; int r = 2 * i + 2 ; if ( l < n && arr [ l ] < arr [ smallest ] ) smallest = l ; if ( r < n && arr [ r ] < arr [ smallest ] ) smallest = r ; if ( smallest != i ) { int temp = arr [ i ] ; arr [ i ] = arr [ smallest ] ; arr [ smallest ] = temp ; heapify ( arr , n , smallest ) ; } } static void heapSort ( int [ ] arr , int n ) { for ( int i = n / 2 - 1 ; i >= 0 ; i -- ) heapify ( arr , n , i ) ; for ( int i = n - 1 ; i >= 0 ; i -- ) { int temp = arr [ 0 ] ; arr [ 0 ] = arr [ i ] ; arr [ i ] = temp ; heapify ( arr , i , 0 ) ; } } static void printArray ( int [ ] arr , int n ) { for ( int i = 0 ; i < n ; ++ i ) Console . Write ( arr [ i ] + " ▁ " ) ; Console . WriteLine ( ) ; } public static void Main ( ) { int [ ] arr = { 4 , 6 , 3 , 2 , 9 } ; int n = arr . Length ; heapSort ( arr , n ) ; Console . WriteLine ( " Sorted ▁ array ▁ is ▁ " ) ; printArray ( arr , n ) ; } }

Index/key variables: i, l, r, smallest
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int isTriangular ( int num ) { if ( num < 0 ) return 0 ; int c = ( - 2 * num ) ; int b = 1 , a = 1 ; int d = ( b * b ) - ( 4 * a * c ) ; if ( d < 0 ) return - 1 ; double root1 = ( - b + Math . Sqrt ( d ) ) / ( 2 * a ) ; double root2 = ( - b - Math . Sqrt ( d ) ) / ( 2 * a ) ; if ( ( int ) ( root1 ) > 0 && ( int ) ( Math . Floor ( root1 ) ) == ( int ) ( root1 ) ) return ( int ) ( root1 ) ; if ( ( int ) ( root2 ) > 0 && ( int ) ( Math . Floor ( root2 ) ) == ( int ) ( root2 ) ) return ( int ) ( root2 ) ; return - 1 ; } static int isPerfectSquare ( double x ) { double sr = Math . Sqrt ( x ) ; if ( ( sr - Math . Floor ( sr ) ) == 0 ) return ( int ) ( Math . Floor ( sr ) ) ; else return - 1 ; } static int findS ( int s ) { int sr = isPerfectSquare ( s ) ; if ( sr == - 1 ) return - 1 ; return isTriangular ( sr ) ; } public static void Main ( ) { int s = 9 ; int n = findS ( s ) ; if ( n == - 1 ) Console . Write ( " - 1" ) ; else Console . Write ( n ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int trickyCase ( string s , int index ) { int index1 = - 1 ; for ( int i = index - 1 ; i >= 0 ; i -- ) { int digit = s [ i ] - '0' ; if ( digit != 8 ) { index1 = i ; break ; } } if ( index1 == - 1 ) return 2 * ( int ) Math . Pow ( 10 , s . Length ) ; int num = 0 ; for ( int i = 0 ; i < index1 ; i ++ ) num = num * 10 + ( s [ i ] - '0' ) ; if ( s [ index1 ] % 2 == 0 ) num = num * 10 + ( s [ index1 ] - '0' + 2 ) ; else num = num * 10 + ( s [ index1 ] - '0' + 1 ) ; for ( int i = index1 + 1 ; i < s . Length ; i ++ ) num = num * 10 ; return num ; } static int smallestNumber ( int n ) { int num = 0 ; string s = " " ; int duplicate = n ; while ( n > 0 ) { s = ( char ) ( n % 10 + 48 ) + s ; n /= 10 ; } int index = - 1 ; for ( int i = 0 ; i < s . Length ; i ++ ) { int digit = s [ i ] - '0' ; int val = digit & 1 ; if ( val == 1 ) { index = i ; break ; } } if ( index == - 1 ) return duplicate ; if ( s [ index ] == '9' ) { num = trickyCase ( s , index ) ; return num ; } for ( int i = 0 ; i < index ; i ++ ) num = num * 10 + ( s [ i ] - '0' ) ; num = num * 10 + ( s [ index ] - '0' + 1 ) ; for ( int i = index + 1 ; i < s . Length ; i ++ ) num = num * 10 ; return num ; } public static void Main ( ) { int N = 2397 ; Console . Write ( smallestNumber ( N ) ) ; } } ? >

Index/key variables: i, index, index1
Accumulator variables: i, n
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static int findNth ( int n ) { int count = 0 ; for ( int curr = 19 ; ; curr += 9 ) { int sum = 0 ; for ( int x = curr ; x > 0 ; x = x / 10 ) sum = sum + x % 10 ; if ( sum == 10 ) count ++ ; if ( count == n ) return curr ; } } static public void Main ( ) { Console . WriteLine ( findNth ( 5 ) ) ; } }

Accumulator variables: count, curr
Iterator variables: curr, x
Class/struct names: GFG
C# program:
class GFG { static int findSum ( int n ) { int sum = 0 ; for ( int i = 1 ; i <= n ; i ++ ) for ( int j = i ; j <= n ; j ++ ) sum = sum + i * j ; return sum ; } public static void Main ( ) { int n = 5 ; System . Console . WriteLine ( findSum ( n ) ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int findSum ( int n ) { int multiTerms = n * ( n + 1 ) / 2 ; int sum = multiTerms ; for ( int i = 2 ; i <= n ; i ++ ) { multiTerms = multiTerms - ( i - 1 ) ; sum = sum + multiTerms * i ; } return sum ; } public static void Main ( ) { int n = 5 ; Console . WriteLine ( findSum ( n ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { public class pair { public int first , second ; public pair ( int first , int second ) { this . first = first ; this . second = second ; } } static bool isPrime ( int n ) { if ( n < 2 ) return false ; for ( int i = 2 ; i <= Math . Sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) return false ; } return true ; } static void lemoine ( int n ) { Dictionary < int , pair > pr = new Dictionary < int , pair > ( ) ; int i = 0 ; for ( int q = 1 ; q <= n / 2 ; q ++ ) { int p = n - 2 * q ; if ( isPrime ( p ) && isPrime ( q ) ) pr . Add ( i , new pair ( p , q ) ) ; i ++ ; } foreach ( KeyValuePair < int , pair > it in pr ) Console . Write ( n + " ▁ = ▁ " + it . Value . first + " ▁ + ▁ ( 2 ▁ * ▁ " + it . Value . second + " ) STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { int n = 39 ; Console . Write ( n + " ▁ can ▁ be ▁ expressed ▁ as ▁ " + " STRNEWLINE " ) ; lemoine ( n ) ; } }

Accumulator variables: i, q
Iterator variables: i, it, q
Class/struct names: GFG, pair
C# program:
using System ; class GFG { static int totalSumDivisibleByNum ( int digit , int number ) { int firstnum = ( int ) Math . Pow ( 10 , digit - 1 ) ; int lastnum = ( int ) Math . Pow ( 10 , digit ) ; firstnum = ( firstnum - firstnum % number ) + number ; lastnum = ( lastnum - lastnum % number ) ; int count = ( ( lastnum - firstnum ) / number + 1 ) ; return ( ( lastnum + firstnum ) * count ) / 2 ; } public static void Main ( ) { int n = 3 , number = 7 ; Console . WriteLine ( totalSumDivisibleByNum ( n , number ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static int Nth_of_AP ( int a , int d , int N ) { return ( a + ( N - 1 ) * d ) ; } public static void Main ( ) { int a = 2 ; int d = 1 ; int N = 5 ; Console . WriteLine ( " The ▁ " + N + " th ▁ term ▁ of ▁ the ▁ series ▁ is ▁ : ▁ " + Nth_of_AP ( a , d , N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool checkFibinnary ( int n ) { int prev_last = 0 ; while ( n != 0 ) { if ( ( n & 1 ) != 0 && prev_last != 0 ) return false ; prev_last = n & 1 ; n >>= 1 ; } return true ; } public static void Main ( ) { int n = 10 ; if ( checkFibinnary ( n ) == true ) Console . WriteLine ( " YES " ) ; else Console . WriteLine ( " NO " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int sumOfSeries ( int n ) { return ( int ) ( 0.6172 * ( Math . Pow ( 10 , n ) - 1 ) - 0.55 * n ) ; } public static void Main ( ) { int n = 2 ; Console . Write ( sumOfSeries ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int Nonagonal ( int n ) { return n * ( 7 * n - 5 ) / 2 ; } public static void Main ( ) { int n = 10 ; Console . Write ( Nonagonal ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Text ; class GFG { static bool divisibleBy20 ( String num ) { int lastTwoDigits = Int32 . Parse ( num . Substring ( 2 ) ) ; return ( ( lastTwoDigits % 5 == 0 ) && ( lastTwoDigits % 4 == 0 ) ) ; } static public void Main ( ) { String num = "63284689320" ; if ( divisibleBy20 ( num ) == true ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Class/struct names: GFG