dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static int __gcd ( int a , int b ) { if ( b == 0 ) return a ; return __gcd ( b , a % b ) ; } static int maxProfit ( int n , int a , int b , int x , int y ) { int res = x * ( n / a ) ; res += y * ( n / b ) ; res -= Math . Min ( x , y ) * ( n / ( ( a * b ) / __gcd ( a , b ) ) ) ; return res ; } static void Main ( ) { int n = 6 , a = 6 , b = 2 , x = 8 , y = 2 ; Console . WriteLine ( maxProfit ( n , a , b , x , y ) ) ; } }

Accumulator variables: res
Class/struct names: GFG
C# program:
using System ; class GFG { const int MOD = 1000000007 ; static int sumOfSeries ( int n ) { int ans = ( int ) Math . Pow ( n % MOD , 2 ) ; return ( ans % MOD ) ; } public static void Main ( ) { int n = 10 ; Console . Write ( sumOfSeries ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int kthOdd ( int [ ] arr , int n , int k ) { for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] % 2 == 1 ) k -- ; if ( k == 0 ) return arr [ i ] ; } return - 1 ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 4 , 5 } ; int n = arr . Length ; int k = 2 ; Console . WriteLine ( kthOdd ( arr , n , k ) ) ; } }

Index/key variables: i
Accumulator variables: i, k
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static void lastFiveDigits ( int n ) { n = ( n / 10000 ) * 10000 + ( ( n / 100 ) % 10 ) * 1000 + ( n % 10 ) * 100 + ( ( n / 10 ) % 10 ) * 10 + ( n / 1000 ) % 10 ; int ans = 1 ; for ( int i = 0 ; i < 5 ; i ++ ) { ans *= n ; ans %= 100000 ; } Console . WriteLine ( ans ) ; } public static void Main ( string [ ] args ) { int n = 12345 ; lastFiveDigits ( n ) ; } }

Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections ; class GFG { static int mod = 1000000007 ; static long power ( long a , long n ) { if ( n == 0 ) { return 1 ; } long p = power ( a , n / 2 ) % mod ; p = ( p * p ) % mod ; if ( n == 1 ) { p = ( p * a ) % mod ; } return p ; } static long computeSum ( int [ ] arr , int n ) { Array . Sort ( arr ) ; long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { long maxs = ( power ( 2 , i ) - 1 + mod ) % mod ; maxs = ( maxs * arr [ i ] ) % mod ; long mins = ( power ( 2 , n - 1 - i ) - 1 + mod ) % mod ; mins = ( mins * arr [ i ] ) % mod ; long V = ( maxs - mins + mod ) % mod ; sum = ( sum + V ) % mod ; } return sum ; } public static void Main ( ) { int [ ] arr = { 4 , 3 , 1 } ; int n = arr . Length ; Console . WriteLine ( computeSum ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int countNumbers ( int n ) { if ( n % 2 == 1 ) return 0 ; return ( 9 * ( int ) Math . Pow ( 10 , n / 2 - 1 ) ) ; } public static void Main ( ) { int n = 2 ; Console . WriteLine ( countNumbers ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int count ( int n ) { int cnt = 0 ; int p = 1 ; while ( p <= n ) { cnt ++ ; p *= 2 ; } return cnt ; } public static void Main ( ) { int n = 7 ; Console . Write ( count ( n ) ) ; } }

Accumulator variables: cnt, p
Class/struct names: GFG
C# program:
using System ; class GFG { static int KthMinValAfterMconcatenate ( int [ ] A , int N , int M , int K ) { Array . Sort ( A ) ; return ( A [ ( ( K - 1 ) / M ) ] ) ; } static void Main ( ) { int [ ] A = { 3 , 1 , 2 } ; int M = 3 , K = 4 ; int N = A . Length ; Console . WriteLine ( KthMinValAfterMconcatenate ( A , N , M , K ) ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { public static int sum ( int n ) { n = ( n + 1 ) / 2 ; return ( n * n ) ; } public static void Main ( string [ ] args ) { int n = 3 ; Console . WriteLine ( sum ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int countNumbers ( int n ) { return n - n / 2 - n / 3 - n / 5 - n / 7 + n / 6 + n / 10 + n / 14 + n / 15 + n / 21 + n / 35 - n / 30 - n / 42 - n / 70 - n / 105 + n / 210 ; } static void Main ( ) { int n = 20 ; Console . WriteLine ( countNumbers ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int maxPrimes ( int n ) { return n / 2 ; } public static void Main ( ) { int n = 17 ; Console . WriteLine ( maxPrimes ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int sum ( int n ) { return n * ( n + 1 ) * ( n + 2 ) / 3 ; } public static void Main ( String [ ] args ) { int n = 2 ; Console . WriteLine ( sum ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int __gcd ( int a , int b ) { if ( b == 0 ) return a ; return __gcd ( b , a % b ) ; } static int findMinimum ( int n , int m ) { int mini = m ; for ( int i = 1 ; i * i <= n ; i ++ ) { if ( n % i == 0 ) { int sec = n / i ; if ( __gcd ( m , i ) > 1 ) { return i ; } else if ( __gcd ( sec , m ) > 1 ) { mini = Math . Min ( sec , mini ) ; } } } if ( mini == m ) return - 1 ; else return mini ; } static void Main ( ) { int n = 8 , m = 10 ; Console . WriteLine ( findMinimum ( n , m ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static int nthTerm ( int N ) { int nth = 0 , i ; for ( i = N ; i > 0 ; i -- ) { nth += ( int ) Math . Pow ( i , i ) ; } return nth ; } public static void Main ( ) { int N = 3 ; Console . WriteLine ( nthTerm ( N ) ) ; } }

Accumulator variables: i, nth
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int kthSmallest ( int n , int k ) { return ( 2 * k ) ; } public static void Main ( ) { int n = 8 , k = 4 ; Console . WriteLine ( kthSmallest ( n , k ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool isSumOfPowersOfTwo ( int n ) { if ( n % 2 == 1 ) return false ; else return true ; } public static void Main ( ) { int n = 10 ; if ( isSumOfPowersOfTwo ( n ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int findMinRemoval ( int [ ] arr , int n ) { int temp , value = 0 ; int maximum = 0 ; if ( n == 1 ) return 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( i != 0 && i != n - 1 ) { value = value + Math . Abs ( arr [ i ] - arr [ i + 1 ] ) ; temp = Math . Abs ( arr [ i ] - arr [ i + 1 ] ) + Math . Abs ( arr [ i ] - arr [ i - 1 ] ) - Math . Abs ( arr [ i - 1 ] - arr [ i + 1 ] ) ; } else if ( i == 0 ) { value = value + Math . Abs ( arr [ i ] - arr [ i + 1 ] ) ; temp = Math . Abs ( arr [ i ] - arr [ i + 1 ] ) ; } else temp = Math . Abs ( arr [ i ] - arr [ i - 1 ] ) ; maximum = Math . Max ( maximum , temp ) ; } return ( value - maximum ) ; } public static void Main ( ) { int [ ] arr = { 1 , 5 , 3 , 2 , 10 } ; int n = arr . Length ; Console . WriteLine ( findMinRemoval ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static double getTime ( int u , int v , int x ) { double speed = u + v ; double time = x / speed ; return time ; } public static void Main ( ) { int u = 3 , v = 3 , x = 3 ; Console . WriteLine ( getTime ( u , v , x ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int number_of_teams ( int M ) { int N1 , N2 , sqr ; sqr = ( int ) Math . Sqrt ( 1 + ( 8 * M ) ) ; N1 = ( 1 + sqr ) / 2 ; N2 = ( 1 - sqr ) / 2 ; if ( N1 > 0 ) return N1 ; return N2 ; } public static void Main ( ) { int M = 45 ; Console . WriteLine ( number_of_teams ( M ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int LucasSum ( int N ) { int sum = 0 ; int a = 2 , b = 1 , c ; sum += a ; while ( b <= N ) { sum += b ; c = a + b ; a = b ; b = c ; } return sum ; } public static void Main ( String [ ] args ) { int N = 20 ; Console . WriteLine ( LucasSum ( N ) ) ; } }

Accumulator variables: sum
Class/struct names: GFG
C# program:
using System ; class GFG { static int countNumbers ( int l , int r ) { return ( ( r / 6 ) - ( l - 1 ) / 6 ) ; } public static void Main ( String [ ] args ) { int l = 1000 , r = 6000 ; Console . WriteLine ( countNumbers ( l , r ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int findMinSum ( int [ ] arr , int n ) { int occ = n - 1 , sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum += arr [ i ] * ( int ) Math . Pow ( 2 , occ ) ; occ -- ; } return sum ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 4 , 5 } ; int n = arr . Length ; Console . WriteLine ( findMinSum ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, occ, sum
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 int findPowerOfP ( int N , int p ) { int count = 0 ; int r = p ; while ( r <= N ) { count += ( N / r ) ; r = r * p ; } return count ; } static List < pair > primeFactorsofB ( int B ) { List < pair > ans = new List < pair > ( ) ; for ( int i = 2 ; B != 1 ; i ++ ) { if ( B % i == 0 ) { int count = 0 ; while ( B % i == 0 ) { B = B / i ; count ++ ; } ans . Add ( new pair ( i , count ) ) ; } } return ans ; } static int largestPowerOfB ( int N , int B ) { List < pair > vec = new List < pair > ( ) ; vec = primeFactorsofB ( B ) ; int ans = int . MaxValue ; for ( int i = 0 ; i < vec . Count ; i ++ ) ans = Math . Min ( ans , findPowerOfP ( N , vec [ i ] . first ) / vec [ i ] . second ) ; return ans ; } public static void Main ( String [ ] args ) { Console . WriteLine ( largestPowerOfB ( 5 , 2 ) ) ; Console . WriteLine ( largestPowerOfB ( 6 , 9 ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG, pair
C# program:
using System ; class GFG { static int countNumbers ( int X , int Y , int N ) { int count = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { if ( ( i % X == 0 ) && ( i % Y != 0 ) ) count ++ ; } return count ; } public static void Main ( ) { int X = 2 , Y = 3 , N = 10 ; Console . WriteLine ( countNumbers ( X , Y , N ) ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int getPosition ( int n , int m ) { if ( m > ( n / 2 ) ) return ( m - ( n / 2 ) ) ; return ( m + ( n / 2 ) ) ; } static public void Main ( ) { int n = 8 , m = 5 ; Console . WriteLine ( getPosition ( n , m ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int parity ( int a ) { return a % 3 ; } static int solve ( int [ ] array , int size ) { int operations = 0 ; for ( int i = 0 ; i < size - 1 ; i ++ ) { if ( parity ( array [ i ] ) == parity ( array [ i + 1 ] ) ) { operations ++ ; if ( i + 2 < size ) { int pari1 = parity ( array [ i ] ) ; int pari2 = parity ( array [ i + 2 ] ) ; if ( pari1 == pari2 ) { if ( pari1 == 0 ) array [ i + 1 ] = 1 ; else if ( pari1 == 1 ) array [ i + 1 ] = 0 ; else array [ i + 1 ] = 1 ; } else { if ( ( pari1 == 0 && pari2 == 1 ) || ( pari1 == 1 && pari2 == 0 ) ) array [ i + 1 ] = 2 ; if ( ( pari1 == 1 && pari2 == 2 ) || ( pari1 == 2 && pari2 == 1 ) ) array [ i + 1 ] = 0 ; if ( ( pari1 == 2 && pari2 == 0 ) || ( pari1 == 0 && pari2 == 2 ) ) array [ i + 1 ] = 1 ; } } } } return operations ; } public static void Main ( ) { int [ ] array = { 2 , 1 , 3 , 0 } ; int size = array . Length ; Console . WriteLine ( solve ( array , size ) ) ; } }

Index/key variables: i
Accumulator variables: i, operations
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int n = 3 ; class pair { public int first , second ; public pair ( int first , int second ) { this . first = first ; this . second = second ; } } static void findPrefixCount ( int [ , ] p_arr , bool [ , ] arr ) { for ( int i = 0 ; i < n ; i ++ ) for ( int j = n - 1 ; j >= 0 ; j -- ) { if ( arr [ i , j ] ) continue ; if ( j != n - 1 ) p_arr [ i , j ] += p_arr [ i , j + 1 ] ; p_arr [ i , j ] += ( arr [ i , j ] == false ? 1 : 0 ) ; } } static int matrixOrValueOne ( bool [ , ] arr ) { int [ , ] p_arr = new int [ n , n ] ; findPrefixCount ( p_arr , arr ) ; int count_zero_submatrices = 0 ; for ( int j = 0 ; j < n ; j ++ ) { int i = n - 1 ; Stack < pair > q = new Stack < pair > ( ) ; int to_sum = 0 ; while ( i >= 0 ) { int c = 0 ; while ( q . Count != 0 && q . Peek ( ) . first > p_arr [ i , j ] ) { to_sum -= ( q . Peek ( ) . second + 1 ) * ( q . Peek ( ) . first - p_arr [ i , j ] ) ; c += q . Peek ( ) . second + 1 ; q . Pop ( ) ; } to_sum += p_arr [ i , j ] ; count_zero_submatrices += to_sum ; q . Push ( new pair ( p_arr [ i , j ] , c ) ) ; i -- ; } } return ( n * ( n + 1 ) * n * ( n + 1 ) ) / 4 - count_zero_submatrices ; } public static void Main ( String [ ] args ) { bool [ , ] arr = { { false , false , false } , { false , true , false } , { false , false , false } } ; Console . WriteLine ( matrixOrValueOne ( arr ) ) ; } }

Accumulator variables: c, count_zero_submatrices, i, j, to_sum
Iterator variables: i, j
Class/struct names: GFG, pair
C# program:
using System ; class GFG { static int submatrixXor ( int [ , ] arr ) { int n = 3 ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { int top_left = ( i + 1 ) * ( j + 1 ) ; int bottom_right = ( n - i ) * ( n - j ) ; if ( ( top_left % 2 == 1 ) && ( bottom_right % 2 == 1 ) ) ans = ( ans ^ arr [ i , j ] ) ; } } return ans ; } public static void Main ( ) { int [ , ] arr = { { 6 , 7 , 13 } , { 8 , 3 , 4 } , { 9 , 7 , 6 } } ; Console . Write ( submatrixXor ( arr ) ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int findDigitalRoot ( int num ) { int sum = int . MaxValue , tempNum = num ; while ( sum >= 10 ) { sum = 0 ; while ( tempNum > 0 ) { sum += tempNum % 10 ; tempNum /= 10 ; } tempNum = sum ; } return sum ; } static void findAnswer ( int X , int N ) { int counter = 0 ; for ( int i = 1 ; counter < N ; ++ i ) { int digitalRoot = findDigitalRoot ( i ) ; if ( digitalRoot == X ) { ++ counter ; } if ( counter == N ) { Console . Write ( i ) ; break ; } } } public static void Main ( String [ ] args ) { int X = 1 , N = 3 ; findAnswer ( X , N ) ; } }

Accumulator variables: sum, tempNum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int findAnswer ( int X , int N ) { return ( N - 1 ) * 9 + X ; } public static void Main ( ) { int X = 7 , N = 43 ; Console . WriteLine ( findAnswer ( X , N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static long count ( int N , int K , int R ) { long sum = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { if ( i % K == R ) sum += i ; } return sum ; } public static void Main ( ) { int N = 20 , K = 4 , R = 3 ; Console . Write ( count ( N , K , R ) ) ; } }

Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int getCount ( int a , int b , int c ) { int count = 0 ; for ( int i = 1 ; i <= 81 ; i ++ ) { int cr = b * ( int ) Math . Pow ( i , a ) + c ; int tmp = cr ; int sm = 0 ; while ( tmp != 0 ) { sm += tmp % 10 ; tmp /= 10 ; } if ( sm == i && cr < 1e9 ) count ++ ; } return count ; } public static void Main ( ) { int a = 3 , b = 2 , c = 8 ; Console . Write ( getCount ( a , b , c ) ) ; } }

Accumulator variables: count, i, sm, tmp
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isSpiltPossible ( int n , int [ ] a ) { int sum = 0 , c1 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum += a [ i ] ; if ( a [ i ] == 1 ) { c1 ++ ; } } if ( sum % 2 != 0 ) return false ; if ( ( sum / 2 ) % 2 == 0 ) return true ; if ( c1 > 0 ) return true ; else return false ; } public static void Main ( ) { int n = 3 ; int [ ] a = { 1 , 1 , 2 } ; if ( isSpiltPossible ( n , a ) ) Console . WriteLine ( " YES " ) ; else Console . WriteLine ( " NO " ) ; } }

Index/key variables: i
Accumulator variables: c1, i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int n = 3 ; static int matrixSum ( int [ , ] arr ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { int top_left = ( i + 1 ) * ( j + 1 ) ; int bottom_right = ( n - i ) * ( n - j ) ; sum += ( top_left * bottom_right * arr [ i , j ] ) ; } } return sum ; } public static void Main ( ) { int [ , ] arr = { { 1 , 1 , 1 } , { 1 , 1 , 1 } , { 1 , 1 , 1 } } ; Console . WriteLine ( matrixSum ( arr ) ) ; } }

Accumulator variables: i, j, sum
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int maxAND ( int L , int R ) { int maximum = L & R ; for ( int i = L ; i < R ; i ++ ) for ( int j = i + 1 ; j <= R ; j ++ ) maximum = Math . Max ( maximum , ( i & j ) ) ; return maximum ; } public static void Main ( String [ ] args ) { int L = 1 , R = 632 ; Console . WriteLine ( maxAND ( L , R ) ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int checkArray ( int [ ] arr , int n ) { return ( ( arr [ 0 ] % 2 ) > 0 && ( arr [ n - 1 ] % 2 ) > 0 && ( n % 2 ) > 0 ) ? 1 : 0 ; } static void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 4 , 5 } ; int n = arr . Length ; Console . WriteLine ( checkArray ( arr , n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GfG { static int findCount ( int [ ] arr , int n ) { int countOdd = 0 ; for ( int i = 0 ; i < n ; i ++ ) if ( arr [ i ] % 2 == 1 ) countOdd ++ ; if ( countOdd % 2 == 0 ) return 1 ; else return 0 ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 5 , 1 } ; int n = arr . Length ; Console . WriteLine ( findCount ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: countOdd, i
Iterator variables: i
Class/struct names: GfG
C# program:
using System ; class GFG { static bool isPerfectSquare ( double x ) { double sr = Math . Sqrt ( x ) ; return ( ( sr - Math . Floor ( sr ) ) == 0 ) ; } static bool isSunnyNum ( int n ) { if ( isPerfectSquare ( n + 1 ) ) return true ; return false ; } public static void Main ( ) { int n = 3 ; if ( isSunnyNum ( n ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

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 int minOperations ( int n , int [ ] a , int m ) { int k = n / m ; List < int > [ ] val = new List < int > [ m ] ; for ( int i = 0 ; i < val . Length ; i ++ ) val [ i ] = new List < int > ( ) ; for ( int i = 0 ; i < n ; ++ i ) { val [ a [ i ] % m ] . Add ( i ) ; } long ans = 0 ; List < pair > extra = new List < pair > ( ) ; for ( int i = 0 ; i < 2 * m ; ++ i ) { int cur = i % m ; while ( ( val [ cur ] . Count ) > k ) { int elem = val [ cur ] [ val [ cur ] . Count - 1 ] ; val [ cur ] . RemoveAt ( val [ cur ] . Count - 1 ) ; extra . Add ( new pair ( elem , i ) ) ; } while ( val [ cur ] . Count < k && extra . Count != 0 ) { int elem = extra [ extra . Count - 1 ] . first ; int mmod = extra [ extra . Count - 1 ] . second ; extra . RemoveAt ( extra . Count - 1 ) ; val [ cur ] . Add ( elem ) ; ans += i - mmod ; } } return ( int ) ans ; } public static void Main ( String [ ] args ) { int m = 3 ; int [ ] a = { 3 , 2 , 0 , 6 , 10 , 12 } ; int n = a . Length ; Console . Write ( minOperations ( n , a , m ) ) ; } }

Index/key variables: cur, i, m
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG, pair
C# program:
using System ; using System . Collections ; class GfG { static int N = 100005 ; static bool [ ] isprime = new bool [ N ] ; static bool [ ] can = new bool [ N ] ; static ArrayList SieveOfEratosthenes ( ) { for ( int a = 0 ; a < N ; a ++ ) { isprime [ a ] = true ; } for ( int p = 2 ; p * p < N ; p ++ ) { if ( isprime [ p ] == true ) { for ( int i = p * p ; i < N ; i += p ) isprime [ i ] = false ; } } ArrayList primes = new ArrayList ( ) ; for ( int i = 2 ; i < N ; i ++ ) if ( isprime [ i ] ) primes . Add ( i ) ; return primes ; } static int Prime_Numbers ( int n ) { ArrayList primes = SieveOfEratosthenes ( ) ; for ( int i = 0 ; i < primes . Count - 1 ; i ++ ) if ( ( int ) primes [ i ] + ( int ) primes [ i + 1 ] + 1 < N ) can [ ( int ) primes [ i ] + ( int ) primes [ i + 1 ] + 1 ] = true ; int ans = 0 ; for ( int i = 2 ; i <= n ; i ++ ) { if ( can [ i ] && isprime [ i ] == true ) { ans ++ ; } } return ans ; } static void Main ( ) { int n = 50 ; Console . WriteLine ( Prime_Numbers ( n ) ) ; } }

Index/key variables: N, a, i, p
Accumulator variables: a, ans, i, p
Iterator variables: a, i, p
Class/struct names: GfG
C# program:
using System ; class GFG { static int findAndSum ( int [ ] arr , int n ) { int sum = 0 ; int mul = 1 ; for ( int i = 0 ; i < 30 ; i ++ ) { bool count_on = false ; int l = 0 ; for ( int j = 0 ; j < n ; j ++ ) { if ( ( arr [ j ] & ( 1 << i ) ) > 0 ) if ( count_on ) l ++ ; else { count_on = true ; l ++ ; } else if ( count_on ) { sum += ( ( mul * l * ( l + 1 ) ) / 2 ) ; count_on = false ; l = 0 ; } } if ( count_on ) { sum += ( ( mul * l * ( l + 1 ) ) / 2 ) ; count_on = false ; l = 0 ; } mul *= 2 ; } return sum ; } public static void Main ( ) { int [ ] arr = { 7 , 1 , 1 , 5 } ; int n = arr . Length ; Console . Write ( findAndSum ( arr , n ) ) ; } }

Index/key variables: j
Accumulator variables: i, j, l, mul, sum
Iterator variables: i, j
Boolean variables: count_on
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPossible ( int Sx , int Sy , int Dx , int Dy , int x , int y ) { if ( Math . Abs ( Sx - Dx ) % x == 0 && Math . Abs ( Sy - Dy ) % y == 0 && ( Math . Abs ( Sx - Dx ) / x ) % 2 == ( Math . Abs ( Sy - Dy ) / y ) % 2 ) return true ; return false ; } static void Main ( ) { int Sx = 0 , Sy = 0 , Dx = 0 , Dy = 0 ; int x = 3 , y = 4 ; if ( isPossible ( Sx , Sy , Dx , Dy , x , y ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int getPairs ( int [ ] a ) { int count = 0 ; for ( int i = 0 ; i < a . Length ; i ++ ) { for ( int j = 0 ; j < a . Length ; j ++ ) { if ( a [ i ] < a [ j ] ) count ++ ; } } return count ; } public static void Main ( ) { int [ ] a = { 2 , 4 , 3 , 1 } ; Console . WriteLine ( getPairs ( a ) ) ; } }

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 bool isComposite ( int n ) { if ( n <= 1 ) return false ; if ( n <= 3 ) return false ; if ( n % 2 == 0 n % 3 == 0 ) return true ; for ( int i = 5 ; i * i <= n ; i = i + 6 ) if ( n % i == 0 || n % ( i + 2 ) == 0 ) return true ; return false ; } static bool isDigitSumOne ( int nm ) { while ( nm > 9 ) { int sum_digit = 0 ; while ( nm > 0 ) { int digit = nm % 10 ; sum_digit = sum_digit + digit ; nm = nm / 10 ; } nm = sum_digit ; } if ( nm == 1 ) return true ; else return false ; } static void printValidNums ( int l , int r ) { for ( int i = l ; i <= r ; i ++ ) { if ( isComposite ( i ) && isDigitSumOne ( i ) ) Console . Write ( i + " ▁ " ) ; } } static public void Main ( ) { int l = 10 , r = 100 ; printValidNums ( l , r ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int calcNodes ( int N , int I ) { int result = 0 ; result = I * ( N - 1 ) + 1 ; return result ; } public static void Main ( ) { int N = 5 , I = 2 ; Console . Write ( " Leaf ▁ nodes ▁ = ▁ " + calcNodes ( N , I ) ) ; } }

Class/struct names: GFG