dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static int getSum ( int n ) { int sum = 0 ; for ( int i = 1 ; i <= Math . Sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { if ( n / i == i ) sum = sum + i ; else { sum = sum + i ; sum = sum + ( n / i ) ; } } } return sum ; } static bool MultiplyPerfectNumber ( int n ) { if ( getSum ( n ) % n == 0 ) return true ; else return false ; } public static void Main ( ) { int n = 28 ; if ( MultiplyPerfectNumber ( n ) ) { Console . Write ( " Yes " ) ; } else { Console . Write ( " No " ) ; } } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int phi ( int n ) { int result = n ; for ( int p = 2 ; p * p <= n ; ++ p ) { if ( n % p == 0 ) { while ( n % p == 0 ) { n /= p ; } result -= result / p ; } } if ( n > 1 ) result -= result / n ; return result ; } static bool isPerfectTotientNum ( int n ) { int temp = n ; int sum = 0 ; while ( n > 1 ) { sum = sum + phi ( n ) ; n = phi ( n ) ; } if ( sum == temp ) return true ; return false ; } public static void Main ( ) { int n = 9 ; if ( isPerfectTotientNum ( n ) ) { Console . Write ( " Yes " ) ; } else { Console . Write ( " No " ) ; } } }

Accumulator variables: n, result
Iterator variables: p
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPower ( int a ) { if ( a == 1 ) return true ; for ( int i = 2 ; i * i <= a ; i ++ ) { double val = Math . Log ( a ) / Math . Log ( i ) ; if ( ( val - ( int ) val ) < 0.00000001 ) return true ; } return false ; } static bool isCunningham ( int n ) { return isPower ( n - 1 ) || isPower ( n + 1 ) ; } public static void Main ( string [ ] args ) { int n = 126 ; if ( isCunningham ( n ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int SubArrayProdct ( int [ ] arr , int n ) { int result = 1 ; for ( int i = 0 ; i < n ; i ++ ) result *= ( int ) ( Math . Pow ( arr [ i ] , ( i + 1 ) * ( n - i ) ) ) ; return result ; } public static void Main ( ) { int [ ] arr = new int [ ] { 2 , 4 } ; int N = arr . Length ; Console . Write ( SubArrayProdct ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: i, result
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static int nCr ( int n , int r ) { return fact ( n ) / ( fact ( r ) * fact ( n - r ) ) ; } public static int fact ( int n ) { int res = 1 ; for ( int i = 2 ; i <= n ; i ++ ) res = res * i ; return res ; } public static int countWays ( int m , int n , int x , int y ) { return nCr ( m + n , m ) - nCr ( x + y , x ) * nCr ( m + n - x - y , m - x ) ; } public static void Main ( String [ ] args ) { int m = 5 ; int n = 4 ; int x = 3 ; int y = 2 ; Console . WriteLine ( countWays ( m , n , x , y ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int CountGreater ( int n , int k ) { int a = 0 ; while ( n > 0 ) { if ( ( n % 10 ) > k ) { a ++ ; } n = n / 10 ; } return a ; } static void PrintList ( List < int > ans ) { foreach ( int it in ans ) Console . Write ( it ) ; } static void getNumber ( int n , int k ) { int count = CountGreater ( n , k ) ; if ( count == 0 ) { Console . Write ( n ) ; return ; } List < int > ans = new List < int > ( ) ; bool changed = false ; while ( n > 0 ) { int digit = n % 10 ; if ( changed == true ) { ans . Insert ( 0 , digit ) ; } else { if ( count == 0 && digit < k ) { ans . Insert ( 0 , digit + 1 ) ; changed = true ; } else { ans . Insert ( 0 , 1 ) ; if ( digit > k ) { count -- ; } } } n = n / 10 ; } if ( changed == false ) { ans . Insert ( 0 , 1 ) ; } PrintList ( ans ) ; return ; } public static void Main ( String [ ] args ) { int N = 51234 ; int K = 4 ; getNumber ( N , K ) ; } }

Accumulator variables: a, count
Iterator variables: it
Boolean variables: changed
Class/struct names: GFG
C# program:
using System ; class GFG { static int averageRuns ( int runs , int matches , int notout ) { int out1 ; out1 = matches - notout ; if ( out1 == 0 ) return - 1 ; int avg = ( runs ) / out1 ; return avg ; } public static void Main ( string [ ] args ) { int runs = 10000 ; int matches = 250 ; int notout = 50 ; int avg = averageRuns ( runs , matches , notout ) ; if ( avg == - 1 ) Console . Write ( " NA " ) ; else Console . Write ( avg ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int seriesSumUtil ( int k , int n , int prevSum , int multi , int add ) { if ( k == n + 1 ) { return prevSum ; } multi = multi * k ; add = add + k ; prevSum = prevSum + multi - add ; return seriesSumUtil ( k + 1 , n , prevSum , multi , add ) ; } static int seriesSum ( int n ) { if ( n == 1 ) return 0 ; int prevSum = 0 ; int multi = 1 ; int add = 1 ; return seriesSumUtil ( 2 , n , prevSum , multi , add ) ; } public static void Main ( String [ ] args ) { int N = 5 ; Console . WriteLine ( seriesSum ( N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void solve ( int N ) { int ans = 0 ; while ( N != 0 ) { ans += N ; N /= 2 ; } Console . Write ( ans ) ; } public static void Main ( string [ ] args ) { int N = 5 ; solve ( N ) ; } }

Accumulator variables: N, ans
Class/struct names: GFG
C# program:
using System ; class GFG { static int maximumAND ( int L , int R ) { return R ; } public static void Main ( String [ ] args ) { int l = 3 ; int r = 7 ; Console . Write ( maximumAND ( l , r ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static bool oddSum ( int [ ] A , int N , int K ) { HashSet < int > Odd = new HashSet < int > ( ) ; HashSet < int > Even = new HashSet < int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( A [ i ] % 2 == 0 ) { Even . Add ( A [ i ] ) ; } else { Odd . Add ( A [ i ] ) ; } } if ( Odd . Count >= K ) return true ; bool flag = false ; for ( int i = 1 ; i < K ; i += 2 ) { int needed = K - i ; if ( needed <= Even . Count ) { return true ; } } return flag ; } public static void Main ( String [ ] args ) { int K = 5 ; int [ ] A = { 12 , 1 , 7 , 7 , 26 , 18 } ; int N = 3 ; if ( oddSum ( A , N , K ) ) Console . Write ( " YES " ) ; else Console . Write ( " NO " ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Boolean variables: flag
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int countEle ( int [ ] a , int n ) { int len = 0 ; Dictionary < int , int > hmap = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { len = Math . Max ( len , a [ i ] ) ; if ( hmap . ContainsKey ( a [ i ] ) ) { hmap [ a [ i ] ] ++ ; } else { hmap . Add ( a [ i ] , 1 ) ; } } bool [ ] v = new bool [ len + 1 ] ; for ( int i = 0 ; i <= len ; i ++ ) { v [ i ] = true ; } for ( int i = 0 ; i < n ; i ++ ) { if ( v [ a [ i ] ] == false ) continue ; for ( int j = 2 * a [ i ] ; j <= len ; j += a [ i ] ) { v [ j ] = false ; } } int count = 0 ; for ( int i = 1 ; i <= len ; i ++ ) { if ( v [ i ] == true && hmap . ContainsKey ( i ) && hmap [ i ] == 1 && hmap [ i ] == 1 ) { count += 1 ; } } return count ; } public static void Main ( String [ ] args ) { int [ ] arr = { 86 , 45 , 18 , 4 , 8 , 28 , 19 , 33 , 2 } ; int n = arr . Length ; Console . Write ( countEle ( 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 void smallestNumber ( int N ) { int L = ( int ) ( Math . Pow ( 10 , N ) - 1 ) ; int S = ( int ) Math . Pow ( 10 , N - 1 ) ; for ( int i = S ; i <= L ; i ++ ) { if ( i % N == 0 ) { Console . Write ( i ) ; return ; } } } public static void Main ( ) { int N = 2 ; smallestNumber ( N ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int maxPrimefactorNum ( int N ) { int [ ] arr = new int [ N + 1 ] ; for ( int i = 0 ; i < N + 1 ; i ++ ) arr [ i ] = 1 ; for ( int i = 2 ; i <= N ; i ++ ) { if ( arr [ i ] == 1 ) { for ( int j = i ; j <= N ; j += i ) { arr [ j ] *= i ; } } } int maxValue = 1 ; for ( int i = 2 ; i <= N ; i ++ ) { if ( arr [ i ] > maxValue ) { maxValue = i ; } } return maxValue ; } public static void Main ( String [ ] args ) { int N = 20 ; Console . Write ( maxPrimefactorNum ( 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 void spf_array ( int [ ] spf ) { spf [ 1 ] = 1 ; for ( int i = 2 ; i < 1000 ; i ++ ) spf [ i ] = i ; for ( int i = 4 ; i < 1000 ; i += 2 ) spf [ i ] = 2 ; for ( int i = 3 ; i * i < 1000 ; i ++ ) { if ( spf [ i ] == i ) { for ( int j = i * i ; j < 1000 ; j += i ) if ( spf [ j ] == j ) spf [ j ] = i ; } } } static int minimum_operation ( int [ ] b , int d , int [ ] spf ) { Dictionary < int , int > m = new Dictionary < int , int > ( ) ; int i = 0 ; int c = 0 ; for ( i = 0 ; i < d ; i ++ ) { int x = b [ i ] ; while ( x != 1 ) { x = x / spf [ x ] ; if ( ! m . ContainsKey ( spf [ x ] ) ) { m . Add ( spf [ x ] , 1 ) ; } } } m . Remove ( 1 ) ; foreach ( KeyValuePair < int , int > x in m ) { int e = 0 , o = 0 ; int j = x . Key ; for ( i = 0 ; i < d ; i ++ ) { if ( b [ i ] % j == 0 ) { int h = 0 ; int g = b [ i ] ; while ( g != 0 ) { if ( g % j != 0 ) { break ; } g = g / j ; h = h + 1 ; } if ( h % 2 == 0 ) { e = e + 1 ; } else { o = o + 1 ; } } else { e = e + 1 ; } } c = c + Math . Min ( o , e ) ; } return c ; } public static void Main ( String [ ] args ) { int [ ] spf = new int [ 1001 ] ; int [ ] b = { 1 , 4 , 6 } ; int d = b . Length ; spf_array ( spf ) ; Console . Write ( minimum_operation ( b , d , spf ) ) ; } }

Index/key variables: i, j, x
Accumulator variables: i, j
Iterator variables: i, j, x
Class/struct names: GFG
C# program:
using System ; class GFG { static int getProduct ( int n ) { int product = 1 ; while ( n != 0 ) { product = product * ( n % 10 ) ; n = n / 10 ; } return product ; } static bool isZuckerman ( int n ) { return n % getProduct ( n ) == 0 ; } public static void Main ( String [ ] args ) { int n = 115 ; if ( isZuckerman ( n ) ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPrime ( int n ) { if ( n <= 1 ) return false ; if ( n <= 3 ) return true ; if ( n % 2 == 0 n % 3 == 0 ) return false ; for ( int i = 5 ; i * i <= n ; i = i + 6 ) if ( n % i == 0 || n % ( i + 2 ) == 0 ) return false ; return true ; } static int getSum ( int n ) { int sum = 0 ; while ( n != 0 ) { sum = sum + n % 10 ; n = n / 10 ; } return sum ; } static bool isAdditivePrime ( int n ) { if ( ! isPrime ( n ) ) return false ; return isPrime ( getSum ( n ) ) ; } public static void Main ( ) { int n = 23 ; if ( isAdditivePrime ( n ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isStraighLineNum ( int N ) { if ( N <= 99 ) return false ; string s = N . ToString ( ) ; int d = s [ 1 ] - s [ 0 ] ; for ( int i = 2 ; i < s . Length ; i ++ ) if ( s [ i ] - s [ i - 1 ] != d ) return false ; return true ; } public static void Main ( ) { int n = 135 ; if ( isStraighLineNum ( n ) ) { Console . Write ( " Yes " ) ; } else { Console . Write ( " No " ) ; } } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void findNthTerm ( int n ) { Console . Write ( Math . Pow ( 2 , n ) - 2 * n ) ; } public static void Main ( ) { int N = 4 ; findNthTerm ( N ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool isEvenOddForm ( String s ) { int n = s . Length ; for ( int i = 0 ; i < n ; i ++ ) { if ( i % 2 == 0 && s [ i ] % 2 != 0 ) return false ; if ( i % 2 == 1 && s [ i ] % 2 != 1 ) return false ; } return true ; } static bool isOddEvenForm ( String s ) { int n = s . Length ; for ( int i = 0 ; i < n ; i ++ ) { if ( i % 2 == 0 && s [ i ] % 2 != 1 ) return false ; if ( i % 2 == 1 && s [ i ] % 2 != 0 ) return false ; } return true ; } static bool isAlternating ( int n ) { String str = n . ToString ( ) ; return ( isEvenOddForm ( str ) || isOddEvenForm ( str ) ) ; } public static void Main ( String [ ] args ) { int N = 129 ; if ( isAlternating ( N ) ) 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 ; class GFG { static bool isPrime ( int n ) { if ( n <= 1 ) return false ; if ( n <= 3 ) return true ; if ( n % 2 == 0 n % 3 == 0 ) return false ; for ( int i = 5 ; i * i <= n ; i = i + 6 ) if ( n % i == 0 || n % ( i + 2 ) == 0 ) return false ; return true ; } static int TEN = 10 ; static void updateFreq ( int n , int [ ] freq ) { while ( n > 0 ) { int digit = n % TEN ; freq [ digit ] ++ ; n /= TEN ; } } static bool areAnagrams ( int a , int b ) { int [ ] freqA = new int [ TEN ] ; int [ ] freqB = new int [ TEN ] ; updateFreq ( a , freqA ) ; updateFreq ( b , freqB ) ; for ( int i = 0 ; i < TEN ; i ++ ) { if ( freqA [ i ] != freqB [ i ] ) return false ; } return true ; } static bool OrmistonPrime ( int n1 , int n2 ) { return ( isPrime ( n1 ) && isPrime ( n2 ) && areAnagrams ( n1 , n2 ) ) ; } public static void Main ( String [ ] args ) { int n1 = 1913 , n2 = 1931 ; if ( OrmistonPrime ( n1 , n2 ) ) Console . Write ( " YES " + " STRNEWLINE " ) ; else Console . Write ( " NO " + " STRNEWLINE " ) ; } }

Index/key variables: TEN, digit, i
Accumulator variables: i, n
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int DecakismyriagonNum ( int N ) { return ( 99998 * N * N - 99996 * N ) / 2 ; } public static void Main ( ) { int N = 3 ; Console . Write ( DecakismyriagonNum ( N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int divSum ( int num ) { int result = 0 ; for ( int i = 2 ; i <= Math . Sqrt ( num ) ; i ++ ) { if ( num % i == 0 ) { if ( i == ( num / i ) ) result += i ; else result += ( i + num / i ) ; } } return ( result + 1 ) ; } static bool isUntouchable ( int n ) { for ( int i = 1 ; i <= 2 * n ; i ++ ) { if ( divSum ( i ) == n ) return false ; } return true ; } public static void Main ( ) { int n = 52 ; if ( isUntouchable ( n ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Accumulator variables: i, result
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool iszygodromeNum ( int N ) { String s = N . ToString ( ) ; s = ' ▁ ' + s + ' ▁ ' ; for ( int i = 1 ; i < s . Length - 1 ; i ++ ) { if ( s [ i ] != s [ i - 1 ] && s [ i ] != s [ i + 1 ] ) { return false ; } } return true ; } public static void Main ( String [ ] args ) { int n = 1122 ; if ( iszygodromeNum ( n ) ) 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 ; class GFG { static bool isLoeschian ( int n ) { for ( int x = 1 ; x <= Math . Sqrt ( n ) ; x ++ ) { for ( int y = 1 ; y <= Math . Sqrt ( n ) ; y ++ ) { if ( x * x + x * y + y * y == n ) return true ; } } return false ; } public static void Main ( String [ ] args ) { int n = 19 ; if ( isLoeschian ( n ) ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } }

Accumulator variables: x, y
Iterator variables: x, y
Class/struct names: GFG
C# program:
using System ; class GFG { static int divSum ( int n ) { int result = 0 ; for ( int i = 2 ; i <= Math . Sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { if ( i == ( n / i ) ) result += i ; else result += ( i + n / i ) ; } } return ( result + n + 1 ) ; } static bool check ( int num ) { int sigmaN = divSum ( num ) ; for ( int i = 2 ; i <= Math . Sqrt ( num ) ; i ++ ) { if ( num % i == 0 ) { if ( i == ( num / i ) ) { if ( sigmaN - 2 * i == 2 * num ) return true ; } else { if ( sigmaN - 2 * i == 2 * num ) return true ; if ( sigmaN - 2 * ( num / i ) == 2 * num ) return true ; } } } if ( sigmaN - 2 * 1 == 2 * num ) return true ; return false ; } static bool isAdmirableNum ( int N ) { return check ( N ) ; } public static void Main ( ) { int n = 12 ; if ( isAdmirableNum ( n ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Accumulator variables: i, result
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void printSeries ( int N ) { int ith_term = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { ith_term = ( 13 * i * ( i - 1 ) ) / 2 + 2 ; Console . Write ( ith_term + " , ▁ " ) ; } } public static void Main ( String [ ] args ) { int N = 7 ; printSeries ( N ) ; } }

Accumulator variables: i
Iterator variables: i
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 List < pair > Pairs ( int C ) { List < pair > ans = new List < pair > ( ) ; for ( int i = 1 ; i < C ; i ++ ) { for ( int j = i + 1 ; j < C ; j ++ ) { if ( ( i * i ) + ( j * j ) == ( C * C ) ) { ans . Add ( new pair ( i , j ) ) ; } } } return ans ; } public static void Main ( String [ ] args ) { int C = 13 ; List < pair > ans = Pairs ( C ) ; if ( ans . Count == 0 ) { Console . Write ( " No ▁ valid ▁ pair ▁ " + " exist " + " STRNEWLINE " ) ; return ; } foreach ( pair i in ans ) { Console . Write ( " ( " + i . first + " , ▁ " + i . second + " ) " + " STRNEWLINE " ) ; } } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG, pair
C# program:
using System ; class GFG { static float strikerate ( float bowls , float runs ) { float z ; z = ( runs / bowls ) * 100 ; return z ; } public static void Main ( ) { int A , B ; A = 264 ; B = 173 ; Console . Write ( strikerate ( B , A ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static int factorize ( int N ) { int count = 0 ; int cnt = 0 ; while ( ( N % 2 ) == 0 ) { N = N / 2 ; count ++ ; } cnt = cnt + count ; for ( int i = 3 ; i <= Math . Sqrt ( N ) ; i += 2 ) { count = 0 ; while ( N % i == 0 ) { count ++ ; N = N / i ; } cnt = cnt + count ; } if ( N > 2 ) cnt = cnt + 1 ; return cnt ; } public static void ifNumberExists ( int X , int Y ) { int C , dsum ; C = X - Y - 1 ; dsum = factorize ( X ) ; if ( dsum >= C ) Console . WriteLine ( " YES " ) ; else Console . WriteLine ( " NO " ) ; } public static void Main ( string [ ] args ) { int X , Y ; X = 6 ; Y = 4 ; ifNumberExists ( X , Y ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Linq ; using System . Collections . Generic ; class GFG { static readonly int max = 10000000 ; static bool [ ] prime = new bool [ max ] ; static void SieveOfEratosthenes ( int maxm ) { prime [ 0 ] = prime [ 1 ] = true ; for ( int i = 2 ; i * i <= maxm ; i ++ ) { if ( ! prime [ i ] ) { for ( int j = i * i ; j <= maxm ; j += i ) { prime [ j ] = true ; } } } } static void print_nearest_prime ( int [ ] arr , int N ) { int maxm = arr . Max ( ) ; SieveOfEratosthenes ( maxm ) ; List < int > primes = new List < int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( ! prime [ arr [ i ] ] ) primes . Add ( i ) ; } if ( primes . Count == 0 ) { for ( int i = 0 ; i < N ; i ++ ) { Console . Write ( - 1 + " ▁ " ) ; } return ; } int curr = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( curr == primes . Count - 1 || i <= primes [ curr ] ) { Console . Write ( arr [ primes [ curr ] ] + " ▁ " ) ; continue ; } if ( Math . Abs ( primes [ curr ] - i ) < Math . Abs ( primes [ curr + 1 ] - i ) ) { Console . Write ( arr [ primes [ curr ] ] + " ▁ " ) ; } else { curr ++ ; Console . Write ( arr [ primes [ curr ] ] + " ▁ " ) ; } } } public static void Main ( String [ ] args ) { int N = 6 ; int [ ] arr = { 8 , 7 , 12 , 15 , 3 , 11 } ; print_nearest_prime ( arr , N ) ; } }

Index/key variables: curr, i, j, max
Accumulator variables: curr, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void findPosition ( int n ) { int i = 0 ; int pos = 0 ; while ( n > 0 ) { if ( n % 10 == 7 ) { pos = pos + ( int ) Math . Pow ( 2 , i + 1 ) ; } else { pos = pos + ( int ) Math . Pow ( 2 , i ) ; } i ++ ; n = n / 10 ; } Console . Write ( pos ) ; } public static void Main ( ) { int N = 777 ; findPosition ( N ) ; } }

Accumulator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static String findNumberL ( int n ) { if ( n == 1 ) return "1" ; String result = " " ; int length = ( int ) Math . Floor ( Math . Log10 ( n ) + 1 ) ; for ( int i = 1 ; i <= n - ( 2 * length ) ; i ++ ) { result += '9' ; } result = n . ToString ( ) + result + n . ToString ( ) ; return result ; } static String findNumberS ( int n ) { if ( n == 1 ) return "1" ; String result = " " ; int length = ( int ) Math . Floor ( Math . Log10 ( n ) + 1 ) ; for ( int i = 1 ; i <= n - ( 2 * length ) ; i ++ ) { result += '0' ; } result = n . ToString ( ) + result + n . ToString ( ) ; return result ; } public static void Main ( String [ ] args ) { int N = 3 ; Console . WriteLine ( " Smallest ▁ Number ▁ = ▁ " + findNumberS ( N ) ) ; Console . Write ( " Largest ▁ Number ▁ = ▁ " + findNumberL ( N ) ) ; } }

Accumulator variables: i, result
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static int canReplace ( int [ ] array ) { int i = 0 , count = 0 ; while ( i < array . Length ) { if ( array [ i ] == 0 && ( i == 0 array [ i - 1 ] == 0 ) && ( i == array . Length - 1 array [ i + 1 ] == 0 ) ) { array [ i ] = 1 ; count ++ ; } i ++ ; } return count ; } public static void Main ( String [ ] args ) { int [ ] array = { 1 , 0 , 0 , 0 , 1 } ; Console . WriteLine ( canReplace ( array ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Class/struct names: GFG
C# program:
using System ; class GFG { static int sum_star_num ( int n ) { int summ = 2 * n * ( n + 1 ) * ( n - 1 ) + n ; return summ ; } public static void Main ( String [ ] args ) { int n = 3 ; Console . WriteLine ( sum_star_num ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections ; using System . Collections . Generic ; public class Point { public int x , y ; public Point ( int xx , int yy ) { x = xx ; y = yy ; } } class GFG { static void solve ( int n , ArrayList vec ) { ArrayList a = new ArrayList ( ) ; ArrayList b = new ArrayList ( ) ; foreach ( Point pr in vec ) { a . Add ( pr . x ) ; b . Add ( pr . y ) ; } a . Sort ( ) ; b . Sort ( ) ; int left , right , ans ; if ( ( n & 1 ) != 0 ) { left = ( int ) a [ n / 2 ] ; right = ( int ) b [ n / 2 ] ; ans = right - left + 1 ; } else { left = ( ( int ) a [ n / 2 ] + ( int ) a [ n / 2 - 1 ] ) ; right = ( ( int ) b [ n / 2 ] + ( int ) b [ n / 2 - 1 ] ) ; ans = right - left + 1 ; } Console . WriteLine ( ans ) ; } static public void Main ( ) { int N = 3 ; ArrayList vec = new ArrayList ( ) ; vec . Add ( new Point ( 100 , 100 ) ) ; vec . Add ( new Point ( 10 , 10000 ) ) ; vec . Add ( new Point ( 1 , 1000000000 ) ) ; solve ( N , vec ) ; } }

Iterator variables: pr
Class/struct names: GFG, Point
C# program:
using System ; using System . Collections . Generic ; class GFG { static Dictionary < int , int > mp = new Dictionary < int , int > ( ) ; static int find_pairs ( int [ ] arr , int n ) { int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( mp . ContainsKey ( arr [ i ] ) ) { mp [ arr [ i ] ] = mp [ arr [ i ] ] + 1 ; } else { mp . Add ( arr [ i ] , 1 ) ; } } foreach ( KeyValuePair < int , int > i in mp ) { int count = i . Value ; if ( count > 1 ) { ans += ( ( count * ( count - 1 ) ) / 2 ) ; } } return ans ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 3 , 4 , 5 , 5 , 7 , 8 } ; int arr_size = arr . Length ; Console . Write ( find_pairs ( arr , arr_size ) ) ; } }

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