dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static void compareValues ( int a , int b , int c , int d ) { double log1 = Math . Log10 ( a ) ; double num1 = log1 * b ; double log2 = Math . Log10 ( c ) ; double num2 = log2 * d ; if ( num1 > num2 ) Console . WriteLine ( a + " ^ " + b ) ; else Console . WriteLine ( c + " ^ " + d ) ; } public static void Main ( ) { int a = 8 , b = 29 , c = 60 , d = 59 ; compareValues ( a , b , c , d ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int MAX = 100005 ; static List < int > addPrimes ( ) { int n = MAX ; Boolean [ ] prime = new Boolean [ n + 1 ] ; for ( int i = 0 ; i < n + 1 ; i ++ ) prime [ i ] = true ; for ( int p = 2 ; p * p <= n ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * p ; i <= n ; i += p ) prime [ i ] = false ; } } List < int > ans = new List < int > ( ) ; for ( int p = 2 ; p <= n ; p ++ ) if ( prime [ p ] ) ans . Add ( p ) ; return ans ; } static Boolean is_prime ( int n ) { return ( n == 3 n == 5 n == 7 ) ; } static int find_Sum ( int n ) { int sum = 0 ; List < int > v = addPrimes ( ) ; for ( int i = 0 ; i < v . Count && n > 0 ; i ++ ) { int flag = 1 ; int a = v [ i ] ; while ( a != 0 ) { int d = a % 10 ; a = a / 10 ; if ( is_prime ( d ) ) { flag = 0 ; break ; } } if ( flag == 1 ) { n -- ; sum = sum + v [ i ] ; } } return sum ; } public static void Main ( String [ ] args ) { int n = 7 ; Console . WriteLine ( find_Sum ( n ) ) ; } }

Index/key variables: i, p
Accumulator variables: i, n, p
Iterator variables: i, p
Class/struct names: GFG
C# program:
using System ; class GFG { static int max_element ( int [ ] a ) { int m = a [ 0 ] ; for ( int i = 0 ; i < a . Length ; i ++ ) m = Math . Max ( a [ i ] , m ) ; return m ; } static int primeCount ( int [ ] arr , int n ) { int max_val = max_element ( arr ) ; bool [ ] prime = new bool [ max_val + 1 ] ; for ( int p = 0 ; p <= max_val ; p ++ ) prime [ p ] = true ; prime [ 0 ] = false ; prime [ 1 ] = false ; for ( int p = 2 ; p * p <= max_val ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * 2 ; i <= max_val ; i += p ) prime [ i ] = false ; } } int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) if ( prime [ arr [ i ] ] ) count ++ ; return count ; } static int [ ] getPrefixArray ( int [ ] arr , int n , int [ ] pre ) { pre [ 0 ] = arr [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { pre [ i ] = pre [ i - 1 ] + arr [ i ] ; } return pre ; } public static void Main ( ) { int [ ] arr = { 1 , 4 , 8 , 4 } ; int n = arr . Length ; int [ ] pre = new int [ n ] ; pre = getPrefixArray ( arr , n , pre ) ; Console . Write ( primeCount ( pre , n ) ) ; } }

Index/key variables: i, n, p
Accumulator variables: count, i, p
Iterator variables: i, p
Class/struct names: GFG
C# program:
using System ; class GFG { static int minValue ( int n , int x , int y ) { float val = ( y * n ) / 100 ; if ( x >= val ) return 0 ; else return ( int ) ( Math . Ceiling ( val ) - x ) ; } public static void Main ( ) { int n = 10 , x = 2 , y = 40 ; Console . WriteLine ( ( int ) minValue ( n , x , y ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPrime ( long 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 bool isFactorialPrime ( long n ) { if ( ! isPrime ( n ) ) return false ; long fact = 1 ; int i = 1 ; while ( fact <= n + 1 ) { fact = fact * i ; if ( n + 1 == fact n - 1 == fact ) return true ; i ++ ; } return false ; } public static void Main ( ) { int n = 23 ; if ( isFactorialPrime ( n ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { long n = 5 ; long fac1 = 1 ; for ( int i = 2 ; i < = n - 1 ; ++ ) fac1 = fac1 * i ; long fac2 = fac1 * n ; long totalWays = fac1 * fac2 ; Console . WriteLine ( totalWays ) ; } }

Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static readonly int MAX = 10000 ; static List < int > arr = new List < int > ( ) ; static void SieveOfEratosthenes ( ) { bool [ ] prime = new bool [ MAX ] ; for ( int i = 0 ; i < MAX ; 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 ] ) arr . Add ( p ) ; } static bool isEuclid ( long n ) { long product = 1 ; int i = 0 ; while ( product < n ) { product = product * arr [ i ] ; if ( product + 1 == n ) return true ; i ++ ; } return false ; } public static void Main ( String [ ] args ) { SieveOfEratosthenes ( ) ; long n = 31 ; if ( isEuclid ( n ) ) Console . WriteLine ( " YES " ) ; else Console . WriteLine ( " NO " ) ; n = 42 ; if ( isEuclid ( n ) ) Console . WriteLine ( " YES " ) ; else Console . WriteLine ( " NO " ) ; } }

Index/key variables: MAX, i, p
Accumulator variables: i, p
Iterator variables: i, p
Class/struct names: GFG
C# program:
using System ; class GFG { static int nextPerfectCube ( int N ) { int nextN = ( int ) Math . Floor ( Math . Pow ( N , ( double ) 1 / 3 ) ) + 1 ; return nextN * nextN * nextN ; } public static void Main ( ) { int n = 35 ; Console . Write ( nextPerfectCube ( n ) ) ; } }

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 SumOfPrimeDivisors ( int n ) { int sum = 0 ; int root_n = ( int ) Math . Sqrt ( n ) ; for ( int i = 1 ; i <= root_n ; i ++ ) { if ( n % i == 0 ) { if ( i == n / i && isPrime ( i ) ) { sum += i ; } else { if ( isPrime ( i ) ) { sum += i ; } if ( isPrime ( n / i ) ) { sum += ( n / i ) ; } } } } return sum ; } static void Main ( ) { int n = 60 ; Console . WriteLine ( " Sum ▁ of ▁ prime ▁ divisors ▁ of ▁ 60 ▁ is ▁ " + SumOfPrimeDivisors ( n ) ) ; } }

Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int findpos ( String n ) { int pos = 0 ; for ( int i = 0 ; i < n . Length ; i ++ ) { switch ( n [ i ] ) { case '2' : pos = pos * 4 + 1 ; break ; case '3' : pos = pos * 4 + 2 ; break ; case '5' : pos = pos * 4 + 3 ; break ; case '7' : pos = pos * 4 + 4 ; break ; } } return pos ; } public static void Main ( String [ ] args ) { String n = "777" ; Console . WriteLine ( findpos ( n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static void possibleTripletInRange ( int L , int R ) { bool flag = false ; int possibleA = 0 , possibleB = 0 , possibleC = 0 ; int numbersInRange = ( R - L + 1 ) ; if ( numbersInRange < 3 ) { flag = false ; } else if ( numbersInRange > 3 ) { flag = true ; if ( L % 2 > 0 ) { L ++ ; } possibleA = L ; possibleB = L + 1 ; possibleC = L + 2 ; } else { if ( ! ( L % 2 > 0 ) ) { flag = true ; possibleA = L ; possibleB = L + 1 ; possibleC = L + 2 ; } else { flag = false ; } } if ( flag == true ) { Console . WriteLine ( " ( " + possibleA + " , ▁ " + possibleB + " , ▁ " + possibleC + " ) " + " ▁ is ▁ one ▁ such ▁ possible " + " ▁ triplet ▁ between ▁ " + L + " ▁ and ▁ " + R ) ; } else { Console . WriteLine ( " No ▁ Such ▁ Triplet " + " ▁ exists ▁ between ▁ " + L + " ▁ and ▁ " + R ) ; } } static public void Main ( ) { int L , R ; L = 2 ; R = 10 ; possibleTripletInRange ( L , R ) ; L = 23 ; R = 46 ; possibleTripletInRange ( L , R ) ; } }

Accumulator variables: L
Boolean variables: flag
Class/struct names: GFG
C# program:
using System ; class GFG { static int mod = 1000000007 ; static int digitNumber ( long n ) { if ( n == 0 ) return 1 ; if ( n == 1 ) return 9 ; if ( n % 2 != 0 ) { int temp = digitNumber ( ( n - 1 ) / 2 ) % mod ; return ( 9 * ( temp * temp ) % mod ) % mod ; } else { int temp = digitNumber ( n / 2 ) % mod ; return ( temp * temp ) % mod ; } } static int countExcluding ( int n , int d ) { if ( d == 0 ) return ( 9 * digitNumber ( n - 1 ) ) % mod ; else return ( 8 * digitNumber ( n - 1 ) ) % mod ; } public static void Main ( ) { int d = 9 ; int n = 3 ; Console . WriteLine ( countExcluding ( n , d ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class Emirp { public static bool isPrime ( int n ) { if ( n <= 1 ) return false ; for ( int i = 2 ; i < n ; i ++ ) if ( n % i == 0 ) return false ; return true ; } public static bool isEmirp ( int n ) { if ( isPrime ( n ) == false ) return false ; int rev = 0 ; while ( n != 0 ) { int d = n % 10 ; rev = rev * 10 + d ; n /= 10 ; } return isPrime ( rev ) ; } public static void Main ( ) { int n = 13 ; if ( isEmirp ( n ) == true ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Accumulator variables: i, n
Iterator variables: i
Class/struct names: Emirp
C# program:
using System ; class GFG { static double Convert ( double radian ) { double pi = 3.14159 ; return ( radian * ( 180 / pi ) ) ; } public static void Main ( ) { double radian = 5.0 ; double degree = Convert ( radian ) ; Console . Write ( " degree ▁ = ▁ " + degree ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static int sn ( int n , int an ) { return ( n * ( 1 + an ) ) / 2 ; } static int trace ( int n , int m ) { int an = 1 + ( n - 1 ) * ( m + 1 ) ; int rowmajorSum = sn ( n , an ) ; an = 1 + ( n - 1 ) * ( n + 1 ) ; int colmajorSum = sn ( n , an ) ; return rowmajorSum + colmajorSum ; } static public void Main ( ) { int N = 3 , M = 3 ; Console . WriteLine ( trace ( N , M ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void max_area ( int n , int m , int k ) { if ( k > ( n + m - 2 ) ) Console . WriteLine ( " Not ▁ possible " ) ; else { int result ; if ( k < Math . Max ( m , n ) - 1 ) { result = Math . Max ( m * ( n / ( k + 1 ) ) , n * ( m / ( k + 1 ) ) ) ; } else { result = Math . Max ( m / ( k - n + 2 ) , n / ( k - m + 2 ) ) ; } Console . WriteLine ( result ) ; } } public static void Main ( ) { int n = 3 , m = 4 , k = 1 ; max_area ( n , m , k ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int area_fun ( int side ) { int area = side * side ; return area ; } public static void Main ( ) { int side = 4 ; int area = area_fun ( side ) ; Console . WriteLine ( area ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static int countConsecutive ( int N ) { int count = 0 ; for ( int L = 1 ; L * ( L + 1 ) < 2 * N ; L ++ ) { double a = ( double ) ( ( 1.0 * N - ( L * ( L + 1 ) ) / 2 ) / ( L + 1 ) ) ; if ( a - ( int ) a == 0.0 ) count ++ ; } return count ; } public static void Main ( ) { int N = 15 ; Console . WriteLine ( countConsecutive ( N ) ) ; N = 10 ; Console . Write ( countConsecutive ( N ) ) ; } }

Accumulator variables: L, count
Iterator variables: L
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isAutomorphic ( int N ) { int sq = N * N ; while ( N > 0 ) { if ( N % 10 != sq % 10 ) return false ; N /= 10 ; sq /= 10 ; } return true ; } public static void Main ( ) { int N = 5 ; Console . Write ( isAutomorphic ( N ) ? " Automorphic " : " Not ▁ Automorphic " ) ; } }

Accumulator variables: N, sq
Class/struct names: GFG
C# program:
using System ; using System . Collections ; class GFG { static int maxPrimefactorNum ( int N ) { bool [ ] arr = new bool [ N + 5 ] ; int i ; for ( i = 3 ; i * i <= N ; i += 2 ) { if ( ! arr [ i ] ) { for ( int j = i * i ; j <= N ; j += i ) { arr [ j ] = true ; } } } ArrayList prime = new ArrayList ( ) ; prime . Add ( 2 ) ; for ( i = 3 ; i <= N ; i += 2 ) { if ( ! arr [ i ] ) { prime . Add ( i ) ; } } int ans = 1 ; i = 0 ; while ( ans * ( int ) prime [ i ] <= N && i < prime . Count ) { ans *= ( int ) prime [ i ] ; i ++ ; } return ans ; } public static void Main ( ) { int N = 40 ; Console . Write ( maxPrimefactorNum ( N ) ) ; } }

Index/key variables: i, j
Accumulator variables: ans, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; public class GFG { static int highestPowerof2 ( int x ) { x |= x >> 1 ; x |= x >> 2 ; x |= x >> 4 ; x |= x >> 8 ; x |= x >> 16 ; return x ^ ( x >> 1 ) ; } public static void Main ( String [ ] args ) { int n = 10 ; Console . WriteLine ( highestPowerof2 ( n ) ) ; } }

Accumulator variables: x
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 ) ; } public static void Main ( ) { int num = 36 ; Console . Write ( divSum ( num ) ) ; } }

Accumulator variables: i, result
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static int power ( int x , int y , int p ) { while ( y > 0 ) { if ( y % 2 == 1 ) res = ( res * x ) % p ; x = ( x * x ) % p ; } return res ; } static void squareRoot ( int n , int p ) { if ( p % 4 != 3 ) { Console . Write ( " Invalid ▁ Input " ) ; return ; } n = n % p ; int x = power ( n , ( p + 1 ) / 4 , p ) ; if ( ( x * x ) % p == n ) { Console . Write ( " Square ▁ root ▁ is ▁ " + x ) ; return ; } x = p - x ; if ( ( x * x ) % p == n ) { Console . Write ( " Square ▁ root ▁ is ▁ " + x ) ; return ; } Console . Write ( " Square ▁ root ▁ doesn ' t ▁ exist ▁ " ) ; } static public void Main ( ) { int p = 7 ; int n = 2 ; squareRoot ( n , p ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int power ( int x , int y , int p ) { int res = 1 ; x = x % p ; while ( y > 0 ) { if ( ( y & 1 ) == 1 ) res = ( res * x ) % p ; x = ( x * x ) % p ; } return res ; } static bool miillerTest ( int d , int n ) { Random r = new Random ( ) ; int a = 2 + ( int ) ( r . Next ( ) % ( n - 4 ) ) ; int x = power ( a , d , n ) ; if ( x == 1 x == n - 1 ) return true ; while ( d != n - 1 ) { x = ( x * x ) % n ; d *= 2 ; if ( x == 1 ) return false ; if ( x == n - 1 ) return true ; } return false ; } static bool isPrime ( int n , int k ) { if ( n <= 1 n == 4 ) return false ; if ( n <= 3 ) return true ; int d = n - 1 ; while ( d % 2 == 0 ) d /= 2 ; for ( int i = 0 ; i < k ; i ++ ) if ( miillerTest ( d , n ) == false ) return false ; return true ; } static void Main ( ) { int k = 4 ; Console . WriteLine ( " All ▁ primes ▁ smaller ▁ " + " than ▁ 100 : ▁ " ) ; for ( int n = 1 ; n < 100 ; n ++ ) if ( isPrime ( n , k ) ) Console . Write ( n + " ▁ " ) ; } }

Accumulator variables: d, i, n
Iterator variables: i, n
Class/struct names: GFG
C# program:
using System ; class GFG { private static int maxConsecutiveOnes ( int x ) { int count = 0 ; while ( x != 0 ) { x = ( x & ( x << 1 ) ) ; count ++ ; } return count ; } public static void Main ( ) { Console . WriteLine ( maxConsecutiveOnes ( 14 ) ) ; Console . Write ( maxConsecutiveOnes ( 222 ) ) ; } }

Accumulator variables: count
Class/struct names: GFG
C# program:
using System ; class GFG { static int subtract ( int x , int y ) { while ( y != 0 ) { int borrow = ( ~ x ) & y ; x = x ^ y ; y = borrow << 1 ; } return x ; } public static void Main ( ) { int x = 29 , y = 13 ; Console . WriteLine ( " x ▁ - ▁ y ▁ is ▁ " + subtract ( x , y ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int subtract ( int x , int y ) { if ( y == 0 ) return x ; return subtract ( x ^ y , ( ~ x & y ) << 1 ) ; } public static void Main ( ) { int x = 29 , y = 13 ; Console . WriteLine ( " x ▁ - ▁ y ▁ is ▁ " + subtract ( x , y ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void addEdge ( List < int > [ ] v , int x , int y ) { v [ x ] . Add ( y ) ; v [ y ] . Add ( x ) ; } static void dfs ( List < int > [ ] tree , List < int > temp , int [ ] ancestor , int u , int parent , int k ) { temp . Add ( u ) ; foreach ( int i in tree [ u ] ) { if ( i == parent ) continue ; dfs ( tree , temp , ancestor , i , u , k ) ; } temp . RemoveAt ( temp . Count - 1 ) ; if ( temp . Count < k ) { ancestor [ u ] = - 1 ; } else { ancestor [ u ] = temp [ temp . Count - k ] ; } } static void KthAncestor ( int N , int K , int E , int [ , ] edges ) { List < int > [ ] tree = new List < int > [ N + 1 ] ; for ( int i = 0 ; i < tree . Length ; i ++ ) tree [ i ] = new List < int > ( ) ; for ( int i = 0 ; i < E ; i ++ ) { addEdge ( tree , edges [ i , 0 ] , edges [ i , 1 ] ) ; } List < int > temp = new List < int > ( ) ; int [ ] ancestor = new int [ N + 1 ] ; dfs ( tree , temp , ancestor , 1 , 0 , K ) ; for ( int i = 1 ; i <= N ; i ++ ) { Console . Write ( ancestor [ i ] + " ▁ " ) ; } } public static void Main ( String [ ] args ) { int N = 9 ; int K = 2 ; int E = 8 ; int [ , ] edges = { { 1 , 2 } , { 1 , 3 } , { 2 , 4 } , { 2 , 5 } , { 2 , 6 } , { 3 , 7 } , { 3 , 8 } , { 3 , 9 } } ; KthAncestor ( N , K , E , edges ) ; } }

Index/key variables: i, u, x, y
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections ; using System . Collections . Generic ; class GFG { static void build ( ArrayList sum , ArrayList a , int l , int r , int rt ) { if ( l == r ) { sum [ rt ] = a [ l - 1 ] ; return ; } int m = ( l + r ) >> 1 ; build ( sum , a , l , m , rt << 1 ) ; build ( sum , a , m + 1 , r , rt << 1 1 ) ; } static void pushDown ( ArrayList sum , ArrayList add , int rt , int ln , int rn ) { if ( ( int ) add [ rt ] != 0 ) { add [ rt << 1 ] = ( int ) add [ rt << 1 ] + ( int ) add [ rt ] ; add [ rt << 1 1 ] = ( int ) add [ rt << 1 1 ] + ( int ) add [ rt ] ; sum [ rt << 1 ] = ( int ) sum [ rt << 1 ] + ( int ) add [ rt ] * ln ; sum [ rt << 1 1 ] = ( int ) sum [ rt << 1 1 ] + ( int ) add [ rt ] * rn ; add [ rt ] = 0 ; } } static void update ( ArrayList sum , ArrayList add , int L , int R , int C , int l , int r , int rt ) { if ( L <= l && r <= R ) { sum [ rt ] = ( int ) sum [ rt ] + C * ( r - l + 1 ) ; add [ rt ] = ( int ) add [ rt ] + C ; return ; } int m = ( l + r ) >> 1 ; pushDown ( sum , add , rt , m - l + 1 , r - m ) ; if ( L <= m ) update ( sum , add , L , R , C , l , m , rt << 1 ) ; if ( R > m ) update ( sum , add , L , R , C , m + 1 , r , rt << 1 1 ) ; } static int query ( ArrayList sum , ArrayList add , int L , int R , int l , int r , int rt ) { if ( L <= l && r <= R ) { return ( int ) sum [ rt ] ; } int m = ( l + r ) >> 1 ; pushDown ( sum , add , rt , m - l + 1 , r - m ) ; int ans = 0 ; if ( L <= m ) ans += query ( sum , add , L , R , l , m , rt << 1 ) ; if ( R > m ) ans += query ( sum , add , L , R , m + 1 , r , rt << 1 1 ) ; return ans ; } static void sequenceMaintenance ( int n , int q , ArrayList a , ArrayList b , int m ) { a . Sort ( ) ; ArrayList sum = new ArrayList ( ) ; ArrayList add = new ArrayList ( ) ; ArrayList ans = new ArrayList ( ) ; for ( int i = 0 ; i < ( n << 2 ) ; i ++ ) { sum . Add ( 0 ) ; add . Add ( 0 ) ; } build ( sum , a , 1 , n , 1 ) ; for ( int i = 0 ; i < q ; i ++ ) { int l = 1 , r = n , pos = - 1 ; while ( l <= r ) { m = ( l + r ) >> 1 ; if ( query ( sum , add , m , m , 1 , n , 1 ) >= ( int ) b [ i ] ) { r = m - 1 ; pos = m ; } else { l = m + 1 ; } } if ( pos == - 1 ) ans . Add ( 0 ) ; else { ans . Add ( n - pos + 1 ) ; update ( sum , add , pos , n , - m , 1 , n , 1 ) ; } } for ( int i = 0 ; i < ans . Count ; i ++ ) { Console . Write ( ans [ i ] + " ▁ " ) ; } } public static void Main ( string [ ] args ) { int N = 4 ; int Q = 3 ; int M = 1 ; ArrayList arr = new ArrayList ( ) { 1 , 2 , 3 , 4 } ; ArrayList query = new ArrayList ( ) { 4 , 3 , 1 } ; sequenceMaintenance ( N , Q , arr , query , M ) ; } }

Index/key variables: i, rt
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } static bool hasCoprimePair ( int [ ] arr , int n ) { for ( int i = 0 ; i < n - 1 ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { if ( ( __gcd ( arr [ i ] , arr [ j ] ) ) == 1 ) { return true ; } } } return false ; } public static void Main ( String [ ] args ) { int n = 3 ; int [ ] arr = { 6 , 9 , 15 } ; if ( hasCoprimePair ( arr , n ) ) { Console . Write ( 1 + " STRNEWLINE " ) ; } else { Console . Write ( n + " STRNEWLINE " ) ; } } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int Numberofways ( int n ) { int count = 0 ; for ( int a = 1 ; a < n ; a ++ ) { for ( int b = 1 ; b < n ; b ++ ) { int c = n - ( a + b ) ; if ( a + b > c && a + c > b && b + c > a ) { count ++ ; } } } return count ; } static public void Main ( ) { int n = 15 ; Console . WriteLine ( Numberofways ( n ) ) ; } }

Accumulator variables: a, b, count
Iterator variables: a, b
Class/struct names: GFG
C# program:
using System ; class GFG { static void countPairs ( int N , int [ ] arr ) { int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( i == arr [ arr [ i ] - 1 ] - 1 ) { count ++ ; } } Console . Write ( count / 2 ) ; } public static void Main ( string [ ] args ) { int [ ] arr = { 2 , 1 , 4 , 3 } ; int N = arr . Length ; countPairs ( N , arr ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int LongestFibSubseq ( int [ ] A , int n ) { SortedSet < int > S = new SortedSet < int > ( ) ; foreach ( int t in A ) { S . Add ( t ) ; } int maxLen = 0 , x , y ; for ( int i = 0 ; i < n ; ++ i ) { for ( int j = i + 1 ; j < n ; ++ j ) { x = A [ j ] ; y = A [ i ] + A [ j ] ; int length = 3 ; while ( S . Contains ( y ) && y != last ( S ) ) { int z = x + y ; x = y ; y = z ; maxLen = Math . Max ( maxLen , ++ length ) ; } } } return maxLen >= 3 ? maxLen : 0 ; } static int last ( SortedSet < int > S ) { int ans = 0 ; foreach ( int a in S ) ans = a ; return ans ; } public static void Main ( String [ ] args ) { int [ ] A = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 } ; int n = A . Length ; Console . Write ( LongestFibSubseq ( A , n ) ) ; } }

Index/key variables: i, j
Iterator variables: a, i, j, t
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { public static int num_candyTypes ( int [ ] candies ) { Dictionary < int , int > s = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < candies . Length ; i ++ ) { if ( ! s . ContainsKey ( candies [ i ] ) ) s . Add ( candies [ i ] , 1 ) ; } return s . Count ; } public static void distribute_candies ( int [ ] candies ) { int allowed = candies . Length / 2 ; int types = num_candyTypes ( candies ) ; if ( types < allowed ) Console . WriteLine ( types ) ; else Console . WriteLine ( allowed ) ; } static public void Main ( ) { int [ ] candies = { 4 , 4 , 5 , 5 , 3 , 3 } ; distribute_candies ( candies ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static double [ ] Length_Diagonals ( int a , double theta ) { double p = a * Math . Sqrt ( 2 + ( 2 * Math . Cos ( theta * ( Math . PI / 180 ) ) ) ) ; double q = a * Math . Sqrt ( 2 - ( 2 * Math . Cos ( theta * ( Math . PI / 180 ) ) ) ) ; return new double [ ] { p , q } ; } public static void Main ( String [ ] args ) { int A = 6 ; double theta = 45 ; double [ ] ans = Length_Diagonals ( A , theta ) ; Console . Write ( " { 0 : F2 } " + " ▁ " + " { 1 : F2 } " , ans [ 0 ] , ans [ 1 ] ) ; } }

Class/struct names: GFG