dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static int gonNum360 ( int n ) { return ( 358 * n * n - 356 * n ) / 2 ; } public static void Main ( String [ ] args ) { int n = 3 ; Console . Write ( gonNum360 ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int gonNum120 ( int n ) { return ( 118 * n * n - 116 * n ) / 2 ; } public static void Main ( String [ ] args ) { int n = 3 ; Console . Write ( gonNum120 ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int TetracontaoctagonalNum ( int n ) { return ( 46 * n * n - 44 * n ) / 2 ; } public static void Main ( ) { int n = 3 ; Console . Write ( TetracontaoctagonalNum ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int gonNum257 ( int n ) { return ( 255 * n * n - 253 * n ) / 2 ; } public static void Main ( String [ ] args ) { int n = 3 ; Console . Write ( gonNum257 ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int TetracontadigonalNum ( int n ) { return ( 40 * n * n - 38 * n ) / 2 ; } public static void Main ( ) { int n = 3 ; Console . Write ( TetracontadigonalNum ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static double findIndex ( int n ) { double x = Math . Sqrt ( 2 * Math . Pow ( 10 , ( n - 1 ) ) ) ; return Math . Round ( x ) ; } public static void Main ( String [ ] args ) { int n = 3 ; Console . Write ( findIndex ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int findLCMPrime ( int a , int b ) { if ( a == b ) { return a ; } return a * b ; } public static void Main ( string [ ] args ) { int a = 3 , b = 5 ; Console . WriteLine ( findLCMPrime ( a , b ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void smallestNumber ( int N ) { Console . Write ( N * Math . Ceiling ( Math . Pow ( 2 , ( N - 1 ) ) / N ) ) ; } public static void Main ( string [ ] args ) { int N = 3 ; smallestNumber ( N ) ; } }

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

Class/struct names: GFG
C# program:
using System ; class GFG { static int icosikaiheptagonal ( int n ) { return ( 25 * n * n - 23 * n ) / 2 ; } public static void Main ( String [ ] args ) { int n = 3 ; Console . Write ( "3rd ▁ icosikaiheptagonal ▁ Number ▁ is ▁ " + icosikaiheptagonal ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool istriacontagonal ( int N ) { float n = ( float ) ( ( 26 + Math . Sqrt ( 224 * N + 676 ) ) / 56 ) ; return ( n - ( int ) n ) == 0 ; } public static void Main ( String [ ] args ) { int N = 30 ; if ( istriacontagonal ( N ) ) { Console . Write ( " Yes " ) ; } else { Console . Write ( " No " ) ; } } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static void getParity ( int n , int [ ] A ) { foreach ( int x in A ) { if ( ( x & 1 ) == 1 ) { Console . WriteLine ( " Even " ) ; return ; } } Console . WriteLine ( " Odd " ) ; } public static void Main ( string [ ] args ) { int N = 3 ; int [ ] A = { 2 , 3 , 1 } ; getParity ( N , A ) ; } }

Iterator variables: x
Class/struct names: GFG
C# program:
using System ; class GFG { static void numberOfDigits ( int N ) { int nod = ( int ) Math . Floor ( Math . Log10 ( N ) + 1 ) ; int toDecrease = ( int ) ( Math . Pow ( 10 , nod ) - 1 ) / 9 ; Console . Write ( ( N + 1 ) * nod - toDecrease ) ; } public static void Main ( ) { int N = 13 ; numberOfDigits ( N ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void Maxlength ( int [ ] arr , int N ) { int [ ] zeroindex = new int [ 20000 ] ; int maxlen ; int size = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] == 0 ) zeroindex [ size ++ ] = i ; } if ( size == 0 ) { maxlen = N ; } else { maxlen = zeroindex [ 0 ] ; for ( int i = 0 ; i < size ; i ++ ) { if ( zeroindex [ i + 1 ] - zeroindex [ i ] - 1 > maxlen ) { maxlen = zeroindex [ i + 1 ] - zeroindex [ i ] - 1 ; } } if ( N - zeroindex [ size - 1 ] - 1 > maxlen ) { maxlen = N - zeroindex [ size - 1 ] - 1 ; } } Console . WriteLine ( maxlen ) ; } public static void Main ( ) { int N = 9 ; int [ ] arr = { 7 , 1 , 0 , 1 , 2 , 0 , 9 , 2 , 1 } ; Maxlength ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i, size
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPossible ( int [ ] arr , int N , int K ) { int oddCount = 0 , evenCount = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] % 2 == 0 ) { evenCount ++ ; } else { oddCount ++ ; } } if ( evenCount == N || ( oddCount == N && K % 2 == 0 ) || ( K == N && oddCount % 2 == 0 ) ) { return false ; } else { return true ; } } public static void Main ( string [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 4 , 5 , 8 } ; int K = 5 ; int N = arr . Length ; if ( isPossible ( arr , N , K ) ) { Console . WriteLine ( " Possible " ) ; } else { Console . WriteLine ( " Not ▁ Possible " ) ; } } }

Index/key variables: i
Accumulator variables: evenCount, i, oddCount
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void lastTwoDigits ( double N ) { if ( N >= 10 ) { Console . Write ( "00" ) ; return ; } double fac = 1 ; for ( int i = 1 ; i <= N ; i ++ ) fac = ( fac * i ) % 100 ; Console . Write ( fac ) ; } public static void Main ( ) { int N = 7 ; lastTwoDigits ( N ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static float productOfGP ( float a , float r , int n ) { return ( float ) Math . Pow ( a , n ) * ( float ) Math . Pow ( r , n * ( n - 1 ) / 2 ) ; } public static void Main ( String [ ] args ) { float a = 1 , r = 2 ; int N = 4 ; Console . WriteLine ( productOfGP ( a , r , N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static float productOfGP ( float a , float r , int n ) { int an = ( int ) ( a * ( int ) ( Math . Pow ( r , n - 1 ) ) ) ; return ( int ) Math . Sqrt ( ( int ) Math . Pow ( a * an , n ) ) ; } public static void Main ( ) { float a = 1 , r = 2 ; int N = 4 ; Console . Write ( productOfGP ( a , r , N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void solve ( int n ) { for ( int x = 1 ; x <= Math . Sqrt ( n ) ; x ++ ) { if ( n % x == 0 ) { int small = x ; int big = n / x ; if ( small % 2 == big % 2 ) { int a = ( small + big ) / 2 ; int b = ( big - small ) / 2 ; Console . WriteLine ( a + " ▁ " + b ) ; return ; } } } Console . WriteLine ( - 1 ) ; } public static void Main ( ) { int n = 7 ; solve ( n ) ; } }

Accumulator variables: x
Iterator variables: x
Class/struct names: GFG
C# program:
using System ; class GFG { static void prob ( int x , int y ) { int num = Math . Abs ( x - y + 1 ) * Math . Abs ( x - y + 1 ) ; int den = ( x + 1 ) * ( x + 1 ) ; int gcd = __gcd ( num , den ) ; Console . Write ( num / gcd + " / " + den / gcd + " STRNEWLINE " ) ; } static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } public static void Main ( string [ ] args ) { int X = 2 , Y = 1 ; prob ( X , Y ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool is_Chiliagon ( int N ) { float n = ( float ) ( 996 + Math . Sqrt ( 7984 * N + 992016 ) ) / 1996 ; return ( n - ( int ) n ) == 0 ; } public static void Main ( ) { int N = 1000 ; if ( is_Chiliagon ( N ) ) { Console . Write ( " Yes " ) ; } else { Console . Write ( " No " ) ; } } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int commonSubarrays ( int [ ] A , int [ ] B , int N ) { int [ ] Map = new int [ N + 1 ] ; for ( int i = 0 ; i < N ; i ++ ) Map [ A [ i ] ] = i ; for ( int i = 0 ; i < N ; i ++ ) { B [ i ] = Map [ B [ i ] ] ; } int count = 0 ; int a = 0 , K ; while ( a < N ) { K = 1 ; a += 1 ; while ( a < N && B [ a ] == B [ a - 1 ] + 1 ) { a += 1 ; K += 1 ; } count = count + ( ( K ) * ( K + 1 ) ) / 2 ; } return count ; } public static void Main ( ) { int N = 3 ; int [ ] A = { 1 , 2 , 3 } ; int [ ] B = { 2 , 3 , 1 } ; Console . Write ( commonSubarrays ( A , B , N ) ) ; Console . Write ( " STRNEWLINE " ) ; N = 5 ; int [ ] C = { 1 , 2 , 3 , 4 , 5 } ; int [ ] D = { 2 , 3 , 1 , 4 , 5 } ; Console . Write ( commonSubarrays ( C , D , N ) ) ; } }

Index/key variables: a, i
Accumulator variables: K, a, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void getArrayOfSizeK ( int n , int k ) { List < int > ans = new List < int > ( ) ; int odd = n - ( ( k - 1 ) * 1 ) ; if ( odd > 0 && odd % 2 != 0 ) { for ( int i = 0 ; i < k - 1 ; i ++ ) { ans . Add ( 1 ) ; } ans . Add ( odd ) ; } int even = n - ( ( k - 1 ) * 2 ) ; if ( even > 0 && even % 2 == 0 && ans . Count == 0 ) { for ( int i = 0 ; i < k - 1 ; i ++ ) { ans . Add ( 2 ) ; } ans . Add ( even ) ; } if ( ans . Count > 0 ) { for ( int i = 0 ; i < k ; i ++ ) { Console . Write ( ans [ i ] + " ▁ " ) ; } } else { Console . WriteLine ( " NO " ) ; } } public static void Main ( String [ ] args ) { int n = 10 , k = 3 ; getArrayOfSizeK ( n , k ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool checkDivisbility ( int num ) { int digit ; int N = num ; while ( num != 0 ) { digit = num % 10 ; num = num / 10 ; if ( digit == 0 N % digit != 0 ) return false ; } return true ; } public static void Main ( ) { int N = 128 ; bool result = checkDivisbility ( N ) ; if ( result ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int inv ( int a , int m ) { int m0 = m , t , q ; int x0 = 0 , x1 = 1 ; if ( m == 1 ) return 0 ; while ( a > 1 ) { q = a / m ; t = m ; m = a % m ; a = t ; t = x0 ; x0 = x1 - q * x0 ; x1 = t ; } if ( x1 < 0 ) x1 += m0 ; return x1 ; } static int derivative ( int x ) { return 3 * x * x ; } static int Image ( int x , int k ) { return x * x * x - k ; } static int next_power ( int a_t , int t , int a1 , int prime , int k ) { int power_p = ( int ) Math . Pow ( prime , t + 1 ) ; int next_a = ( a_t - Image ( a_t , k ) * inv ( derivative ( a1 ) , prime ) ) % power_p ; if ( next_a < 0 ) return next_a += power_p ; return next_a ; } static int powerOfPrime ( int prime , int power , int k , int a1 ) { if ( derivative ( a1 ) != 0 ) { int a_t = a1 ; for ( int p = 1 ; p < power ; p ++ ) { a_t = next_power ( a_t , p , a1 , prime , k ) ; } return a_t ; } return - 1 ; } public static void Main ( string [ ] args ) { int prime = 7 , a1 = 3 ; int power = 2 , k = 3 ; Console . Write ( powerOfPrime ( prime , power , k , a1 ) ) ; } }

Accumulator variables: next_a, p, x1
Iterator variables: p
Class/struct names: GFG
C# program:
using System ; class GFG { static int count_same_digit ( int L , int R ) { int tmp = 0 , ans = 0 ; int n = ( int ) Math . Log10 ( R ) + 1 ; for ( int i = 0 ; i < n ; i ++ ) { tmp = tmp * 10 + 1 ; for ( int j = 1 ; j <= 9 ; j ++ ) { if ( L <= ( tmp * j ) && ( tmp * j ) <= R ) { ans ++ ; } } } return ans ; } public static void Main ( ) { int L = 12 , R = 68 ; Console . Write ( count_same_digit ( L , R ) ) ; } }

Accumulator variables: ans, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int minLCM ( int [ ] arr , int n ) { int mx = 0 ; for ( int i = 0 ; i < n ; i ++ ) { mx = Math . Max ( mx , arr [ i ] ) ; } List < int > [ ] mul = new List < int > [ mx + 1 ] ; for ( int i = 0 ; i < mul . Length ; i ++ ) mul [ i ] = new List < int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( mul [ arr [ i ] ] . Count > 1 ) { continue ; } mul [ arr [ i ] ] . Add ( arr [ i ] ) ; } for ( int i = 1 ; i <= mx ; i ++ ) { for ( int j = i + i ; j <= mx ; j += i ) { if ( mul [ i ] . Count > 1 ) { break ; } foreach ( int k in mul [ j ] ) { if ( mul [ i ] . Count > 1 ) break ; mul [ i ] . Add ( k ) ; } } } int ans = int . MaxValue ; for ( int i = 1 ; i <= mx ; i ++ ) { if ( mul [ i ] . Count <= 1 ) continue ; int a = mul [ i ] [ 0 ] , b = mul [ i ] [ 1 ] ; int lcm = ( a * b ) / i ; ans = Math . Min ( ans , lcm ) ; } return ans ; } public static void Main ( String [ ] args ) { int [ ] arr = { 2 , 4 , 3 , 6 , 5 } ; int n = arr . Length ; Console . Write ( minLCM ( arr , n ) + " STRNEWLINE " ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j, k
Class/struct names: GFG
C# program:
using System ; class GFG { static int findArrangement ( int N ) { if ( N < 3 ) return 0 ; return ( ( N ) * ( N - 1 ) * ( N - 2 ) ) / 3 ; } public static void Main ( ) { int N = 10 ; Console . Write ( findArrangement ( N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static readonly int MOD = 7 ; static int inv ( int a ) { int o = 1 ; for ( int p = MOD - 2 ; p > 0 ; p >>= 1 ) { if ( ( p & 1 ) == 1 ) o = ( o * a ) % MOD ; a = ( a * a ) % MOD ; } return o ; } static int inv6 = inv ( 6 ) ; static int sumOfSquares ( int n ) { n %= MOD ; return ( ( ( n * ( n + 1 ) ) % MOD * ( 2 * n + 1 ) ) % MOD * inv6 ) % MOD ; } static int sums ( int n ) { if ( n < 4 ) return 0 ; int curStart = 2 , ans = 0 ; int sqrtN = ( int ) Math . Sqrt ( n ) ; while ( curStart <= n / curStart ) { int V = n / ( curStart * curStart ) ; int end = ( int ) Math . Sqrt ( n / V ) ; ans += ( n / ( curStart * curStart ) % MOD * ( sumOfSquares ( end ) + MOD - sumOfSquares ( curStart - 1 ) ) ) % MOD ; if ( ans >= MOD ) ans -= MOD ; curStart = end + 1 ; } return ans ; } public static void Main ( String [ ] args ) { int [ ] input = { 5 } ; foreach ( int x in input ) { Console . Write ( " sum ▁ of ▁ all ▁ perfect ▁ " + " square ▁ divisors ▁ from ▁ " + "1 ▁ to ▁ " + x + " ▁ is : ▁ " ) ; Console . Write ( x + sums ( x ) + " STRNEWLINE " ) ; } } }

Accumulator variables: ans
Iterator variables: p, x
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isSuffix ( string s1 , string s2 ) { int n1 = s1 . Length ; int n2 = s2 . Length ; if ( n1 > n2 ) return false ; for ( int i = 0 ; i < n1 ; i ++ ) if ( s1 [ n1 - i - 1 ] != s2 [ n2 - i - 1 ] ) return false ; return true ; } static bool CheckBinaryEquivalent ( int N ) { int B_Number = 0 ; int cnt = 0 ; while ( N != 0 ) { int rem = N % 2 ; int c = ( int ) Math . Pow ( 10 , cnt ) ; B_Number += rem * c ; N /= 2 ; cnt ++ ; } string bin = B_Number . ToString ( ) ; return isSuffix ( "001" , bin ) ; } public static void Main ( string [ ] args ) { int N = 9 ; if ( CheckBinaryEquivalent ( N ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Accumulator variables: B_Number, N, cnt, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool CheckBinaryEquivalent ( int N ) { return ( N - 1 ) % 8 == 0 ; } public static void Main ( string [ ] args ) { int N = 9 ; if ( CheckBinaryEquivalent ( N ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections ; class GFG { static ArrayList get_divisors ( int A ) { ArrayList ans = new ArrayList ( ) ; ans . Add ( 1 ) ; for ( int i = 2 ; i <= ( int ) Math . Sqrt ( A ) ; i ++ ) { if ( A % i == 0 ) { ans . Add ( i ) ; if ( ( i * i ) != A ) ans . Add ( A / i ) ; } } return ans ; } static bool Sum_Possible ( ArrayList set , int sum ) { int n = set . Count ; bool [ , ] subset = new bool [ n + 1 , sum + 1 ] ; for ( int i = 0 ; i <= n ; i ++ ) subset [ i , 0 ] = true ; for ( int i = 1 ; i <= sum ; i ++ ) subset [ 0 , i ] = false ; for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = 1 ; j <= sum ; j ++ ) { if ( j < ( int ) set [ i - 1 ] ) subset [ i , j ] = subset [ i - 1 , j ] ; if ( j >= ( int ) set [ i - 1 ] ) subset [ i , j ] = subset [ i - 1 , j ] || subset [ i - 1 , j - ( int ) set [ i - 1 ] ] ; } } return subset [ n , sum ] ; } static bool Is_Practical ( int A ) { ArrayList divisors = new ArrayList ( ) ; divisors = get_divisors ( A ) ; for ( int i = 2 ; i < A ; i ++ ) { if ( Sum_Possible ( divisors , i ) == false ) return false ; } return true ; } static void print_practica_No ( int A , int B ) { for ( int i = A ; i <= B ; i ++ ) { if ( Is_Practical ( i ) == true ) { Console . Write ( i + " ▁ " ) ; } } } public static void Main ( string [ ] args ) { int A = 1 , B = 100 ; print_practica_No ( A , B ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static float maxDivision ( int [ ] arr , int n ) { Array . Sort ( arr ) ; Array . Reverse ( arr ) ; float mxdiv = arr [ 1 ] ; for ( int i = 2 ; i < n ; ++ i ) mxdiv = mxdiv / arr [ i ] ; return arr [ 0 ] / mxdiv ; } public static void Main ( String [ ] args ) { int [ ] arr = { 100 , 1000 , 10 , 2 } ; int n = arr . Length ; Console . Write ( ( int ) maxDivision ( arr , n ) ) ; } }

Index/key variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void coPrimeSet ( int n ) { int firstadj , secadj ; if ( n < 4 ) { Console . Write ( " ( ▁ " ) ; for ( int i = 1 ; i <= n ; i ++ ) Console . Write ( i + " , ▁ " ) ; Console . Write ( " ) STRNEWLINE " ) ; } else { if ( n % 2 == 0 ) { for ( int i = 0 ; i < n / 2 ; i ++ ) { firstadj = 2 * i + 1 ; secadj = 2 * i + 2 ; Console . Write ( " ( " + firstadj + " , ▁ " + secadj + " ) STRNEWLINE " ) ; } } else { for ( int i = 0 ; i < n / 2 - 1 ; i ++ ) { firstadj = 2 * i + 1 ; secadj = 2 * i + 2 ; Console . Write ( " ( " + firstadj + " , ▁ " + secadj + " ) STRNEWLINE " ) ; } Console . Write ( " ( " + ( n - 2 ) + " , ▁ " + ( n - 1 ) + " , ▁ " + n + " ) STRNEWLINE " ) ; } } } public static void Main ( ) { int n = 5 ; coPrimeSet ( n ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static void Main ( ) { int N = 21 ; int A = ( int ) ( Math . Sqrt ( 2 * N + 0.25 ) - 0.5 ) ; int B = A ; if ( B != A ) Console . Write ( " - 1" ) ; else Console . Write ( B ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static long operation ( int [ ] arr , int N ) { int right = 0 ; int num = 0 ; long ans = 0 ; for ( int left = 0 ; left < N ; left ++ ) { while ( right < N && num + arr [ right ] == ( num ^ arr [ right ] ) ) { num += arr [ right ] ; right ++ ; } ans += right - left ; if ( left == right ) right ++ ; else num -= arr [ left ] ; } return ans ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 4 , 5 } ; int N = arr . Length ; Console . WriteLine ( operation ( arr , N ) ) ; } }

Index/key variables: left, right
Accumulator variables: ans, left, num, right
Iterator variables: left
Class/struct names: GFG
C# program:
using System ; class GFG { public static bool [ ] sieveOfEratosthenes ( int N ) { bool [ ] isPrime = new bool [ N + 1 ] ; for ( int i = 0 ; i < N + 1 ; i ++ ) { isPrime [ i ] = true ; } isPrime [ 0 ] = false ; isPrime [ 1 ] = false ; for ( int i = 2 ; i * i <= N ; i ++ ) { if ( isPrime [ i ] == true ) { int j = 2 ; while ( i * j <= N ) { isPrime [ i * j ] = false ; j ++ ; } } } return isPrime ; } public static int numPairsWithPrimeSum ( int [ ] arr , int n ) { int N = 2 * 1000000 ; bool [ ] isPrime = sieveOfEratosthenes ( N ) ; int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { int sum = arr [ i ] + arr [ j ] ; if ( isPrime [ sum ] ) { count ++ ; } } } return count ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 4 , 5 } ; int n = arr . Length ; Console . WriteLine ( numPairsWithPrimeSum ( arr , n ) ) ; } }

Index/key variables: i, j, sum
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { public static int [ ] digit = new int [ 10 ] ; public static void digitsPresent ( int n ) { int lastDigit ; while ( n != 0 ) { lastDigit = n % 10 ; digit [ lastDigit ] = 1 ; n /= 10 ; } } public static int checkLastDigit ( int num ) { int count = 0 ; int lastDigit ; lastDigit = num % 10 ; if ( digit [ lastDigit ] == 1 ) count ++ ; return count ; } public static void findCount ( int N , int K , int [ ] arr ) { int count = 0 ; for ( int i = 0 ; i < K ; i ++ ) { count = checkLastDigit ( arr [ i ] ) == 1 ? count + 1 : count ; } Console . WriteLine ( count ) ; } static public void Main ( ) { int N = 1731 ; digitsPresent ( N ) ; int K = 5 ; int [ ] arr = { 57 , 6786 , 1111 , 3 , 9812 } ; findCount ( N , K , arr ) ; } }

Index/key variables: i, lastDigit
Accumulator variables: count, i, n
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool divisorsSame ( int n ) { return ( n - 2 ) % 4 == 0 ; } public static void Main ( ) { int N = 6 ; if ( divisorsSame ( N ) ) { Console . Write ( " Yes " ) ; } else { Console . Write ( " No " ) ; } } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int find ( int K , int N ) { N -- ; while ( N -- != 0 ) { int curr_term = K ; int min_d = 9 ; int max_d = 0 ; while ( curr_term > 0 ) { int r = curr_term % 10 ; min_d = Math . Min ( min_d , r ) ; max_d = Math . Max ( max_d , r ) ; curr_term = ( int ) ( curr_term / 10 ) ; } if ( min_d == 0 ) { break ; } K = K + min_d * max_d ; } return K ; } public static void Main ( ) { int K = 487 ; int N = 2 ; Console . Write ( find ( K , N ) ) ; } }

Accumulator variables: N
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static long countSubarrays ( int [ ] arr , int n ) { Dictionary < int , int > mp = new Dictionary < int , int > ( ) ; int [ ] prefixSum = new int [ n ] ; int prefixMin = 0 ; prefixSum [ 0 ] = arr [ 0 ] ; prefixMin = Math . Min ( prefixMin , prefixSum [ 0 ] ) ; for ( int i = 1 ; i < n ; i ++ ) { prefixSum [ i ] = prefixSum [ i - 1 ] + arr [ i ] ; prefixMin = Math . Min ( prefixMin , prefixSum [ i ] ) ; } long countSubs = 0 ; mp . Add ( 0 , 1 ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; prefixSum [ i ] - j * j >= prefixMin ; j ++ ) { if ( mp . ContainsKey ( prefixSum [ i ] - j * j ) ) countSubs += mp [ prefixSum [ i ] - j * j ] ; } if ( mp . ContainsKey ( prefixSum [ i ] ) ) { mp [ prefixSum [ i ] ] ++ ; } else { mp . Add ( prefixSum [ i ] , 1 ) ; } } return countSubs ; } public static void Main ( String [ ] args ) { int [ ] arr = { 2 , 3 , - 5 , 6 , - 7 , 4 } ; int n = arr . Length ; long ans = countSubarrays ( arr , n ) ; Console . Write ( ans ) ; } }

Index/key variables: i, n
Accumulator variables: countSubs, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static bool checkSolution ( float a1 , float b1 , float c1 , float a2 , float b2 , float c2 ) { return ( ( a1 / a2 ) == ( b1 / b2 ) && ( b1 / b2 ) == ( c1 / c2 ) ) ; } public static void Main ( string [ ] args ) { float a1 = 1 , b1 = - 5 , c1 = 6 ; float a2 = 2 , b2 = - 10 , c2 = 12 ; if ( checkSolution ( a1 , b1 , c1 , a2 , b2 , c2 ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void checkSolution ( int a , int b , int c ) { if ( b == 0 ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } public static void Main ( ) { int a = 2 , b = 0 , c = 2 ; checkSolution ( a , b , c ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static void positiveProduct ( int [ ] arr , int n ) { int even_count = 0 ; int odd_count = 0 ; int total_count = 0 ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( total_count % 2 == 0 ) { even_count ++ ; } else { odd_count ++ ; } if ( arr [ i ] < 0 ) { total_count ++ ; } if ( total_count % 2 == 0 ) ans += even_count ; else ans += odd_count ; } Console . WriteLine ( ans ) ; } public static void Main ( String [ ] args ) { int [ ] A = { 5 , - 3 , 3 , - 1 , 1 } ; int size = A . Length ; positiveProduct ( A , size ) ; } }

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