dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; using System . Collections . Generic ; public class GFG { static int N = 1000000 ; static List < int > prime = new List < int > ( ) ; static void SieveOfEratosthenes ( ) { bool [ ] check = new bool [ N + 1 ] ; for ( int i = 0 ; i <= N ; i += 1 ) check [ i ] = true ; for ( int p = 2 ; p * p <= N ; p ++ ) { if ( check [ p ] == true ) { prime . Add ( p ) ; for ( int i = p * p ; i <= N ; i += p ) check [ i ] = false ; } } } class Node { public int key ; public Node left , right ; } ; static Node newNode ( int key ) { Node temp = new Node ( ) ; temp . key = key ; temp . left = temp . right = null ; return ( temp ) ; } static bool IsChilrenPrimeFactor ( Node parent , Node a ) { if ( prime [ a . key ] > 0 && ( parent . key % a . key == 0 ) ) return true ; else return false ; } static int GetCount ( Node node ) { if ( node == null ) return 0 ; List < Node > q = new List < Node > ( ) ; int count = 0 ; q . Add ( node ) ; while ( q . Count != 0 ) { Node temp = q [ 0 ] ; q . RemoveAt ( 0 ) ; if ( temp . left == null && temp . right != null ) { if ( IsChilrenPrimeFactor ( temp , temp . right ) ) count ++ ; } else { if ( temp . right == null && temp . left != null ) { if ( IsChilrenPrimeFactor ( temp , temp . left ) ) count ++ ; } else { if ( temp . left != null && temp . right != null ) { if ( IsChilrenPrimeFactor ( temp , temp . right ) && IsChilrenPrimeFactor ( temp , temp . left ) ) count ++ ; } } } if ( temp . left != null ) q . Add ( temp . left ) ; if ( temp . right != null ) q . Add ( temp . right ) ; } return count ; } public static void Main ( String [ ] args ) { Node root = newNode ( 10 ) ; root . left = newNode ( 2 ) ; root . right = newNode ( 5 ) ; root . right . left = newNode ( 18 ) ; root . right . right = newNode ( 12 ) ; root . right . left . left = newNode ( 2 ) ; root . right . left . right = newNode ( 3 ) ; root . right . right . left = newNode ( 3 ) ; root . right . right . right = newNode ( 14 ) ; root . right . right . right . left = newNode ( 7 ) ; SieveOfEratosthenes ( ) ; Console . Write ( GetCount ( root ) + " STRNEWLINE " ) ; } }

Index/key variables: i, p
Accumulator variables: count, i, p
Iterator variables: i, p
Class/struct names: GFG, Node
C# program:
using System ; class GFG { static String check ( int [ ] Arr , int n , int M , int K ) { int flag = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( Arr [ i ] == 0 ) flag = 1 ; } if ( K % 2 != 0 && flag == 0 ) return " No " ; else return " Yes " ; } public static void Main ( String [ ] args ) { int [ ] Arr = { 1 , 1 , 2 , 4 , 7 , 8 } ; int M = 5 ; int K = 6 ; int n = Arr . Length ; Console . Write ( check ( Arr , n , M , K ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int [ ] pref = new int [ 100001 ] ; static int checkArmstrong ( int x ) { int n = x . ToString ( ) . Length ; int sum1 = 0 ; int temp = x ; while ( temp > 0 ) { int digit = temp % 10 ; sum1 += ( int ) Math . Pow ( digit , n ) ; temp /= 10 ; } if ( sum1 == x ) return x ; return 0 ; } static void preCompute ( ) { for ( int i = 1 ; i < 100001 ; i ++ ) { pref [ i ] = pref [ i - 1 ] + checkArmstrong ( i ) ; } } static void printSum ( int L , int R ) { Console . WriteLine ( pref [ R ] - pref [ L - 1 ] ) ; } static void printSumarmstrong ( int [ , ] arr , int Q ) { preCompute ( ) ; for ( int i = 0 ; i < Q ; i ++ ) { printSum ( arr [ i , 0 ] , arr [ i , 1 ] ) ; } } public static void Main ( string [ ] args ) { int Q = 2 ; int [ , ] arr = { { 1 , 13 } , { 121 , 211 } } ; printSumarmstrong ( arr , Q ) ; } }

Index/key variables: R, i
Accumulator variables: i, sum1, temp
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int [ ] prime = new int [ 100001 ] ; static int [ ] k = new int [ 100001 ] ; static void Sieve ( ) { for ( int i = 1 ; i < 100001 ; i ++ ) k [ i ] = i ; for ( int i = 2 ; i < 100001 ; i ++ ) { if ( prime [ i ] == 0 ) for ( int j = i ; j < 100001 ; j += i ) { prime [ j ] = 1 ; while ( k [ j ] % ( i * i ) == 0 ) k [ j ] /= ( i * i ) ; } } } static int countPairs ( int [ ] arr , int n ) { Dictionary < int , int > freq = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( freq . ContainsKey ( k [ arr [ i ] ] ) ) { freq [ k [ arr [ i ] ] ] = freq [ k [ arr [ i ] ] ] + 1 ; } else freq . Add ( k [ arr [ i ] ] , 1 ) ; } int sum = 0 ; foreach ( KeyValuePair < int , int > i in freq ) { sum += ( ( i . Value - 1 ) * i . Value ) / 2 ; } return sum ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 4 , 8 , 5 , 6 } ; int n = arr . Length ; Sieve ( ) ; Console . Write ( countPairs ( arr , n ) + " STRNEWLINE " ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, sum
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { public static long [ ] pref = new long [ 100010 ] ; static long isPerfectCube ( long x ) { double cr = Math . Round ( MathF . Cbrt ( x ) ) ; if ( cr * cr * cr == ( double ) x ) return x ; return 0 ; } static void compute ( ) { for ( long i = 1 ; i <= 100000 ; ++ i ) { pref [ i ] = pref [ i - 1 ] + isPerfectCube ( i ) ; } } static void printSum ( int L , int R ) { long sum = pref [ R ] - pref [ L - 1 ] ; Console . Write ( sum + " ▁ " ) ; } public static void Main ( ) { compute ( ) ; int Q = 4 ; int [ , ] arr = new int [ , ] { { 1 , 10 } , { 1 , 100 } , { 2 , 25 } , { 4 , 50 } } ; for ( int i = 0 ; i < Q ; i ++ ) { printSum ( arr [ i , 0 ] , arr [ i , 1 ] ) ; } } }

Index/key variables: R, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static int binomialCoeff ( int n , int k ) { int [ , ] C = new int [ n + 1 , k + 1 ] ; int i , j ; for ( i = 0 ; i <= n ; i ++ ) { for ( j = 0 ; j <= Math . Min ( i , k ) ; j ++ ) { if ( j == 0 j == i ) C [ i , j ] = 1 ; else C [ i , j ] = C [ i - 1 , j - 1 ] + C [ i - 1 , j ] ; } } return C [ n , k ] ; } public static int count ( int n , int k ) { int sum = 0 ; for ( int j = 1 ; j <= k ; j ++ ) { sum = sum + binomialCoeff ( n , j ) ; } return sum ; } public static void Main ( ) { int n = 3 , k = 2 ; Console . Write ( count ( n , k ) ) ; int n1 = 5 , k1 = 2 ; Console . Write ( count ( n1 , k1 ) ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; public class Node { public int data ; public Node left , right ; public Node ( int item ) { data = item ; left = right ; } } public class BinaryTree { public Node root1 , root2 ; public virtual bool isIsomorphic ( Node n1 , Node n2 ) { if ( n1 == null && n2 == null ) { return true ; } if ( n1 == null n2 == null ) { return false ; } if ( n1 . data != n2 . data ) { return false ; } return ( isIsomorphic ( n1 . left , n2 . left ) && isIsomorphic ( n1 . right , n2 . right ) ) || ( isIsomorphic ( n1 . left , n2 . right ) && isIsomorphic ( n1 . right , n2 . left ) ) ; } public static void Main ( string [ ] args ) { BinaryTree tree = new BinaryTree ( ) ; tree . root1 = new Node ( 1 ) ; tree . root1 . left = new Node ( 2 ) ; tree . root1 . right = new Node ( 3 ) ; tree . root1 . left . left = new Node ( 4 ) ; tree . root1 . left . right = new Node ( 5 ) ; tree . root1 . right . left = new Node ( 6 ) ; tree . root1 . left . right . left = new Node ( 7 ) ; tree . root1 . left . right . right = new Node ( 8 ) ; tree . root2 = new Node ( 1 ) ; tree . root2 . left = new Node ( 3 ) ; tree . root2 . right = new Node ( 2 ) ; tree . root2 . right . left = new Node ( 4 ) ; tree . root2 . right . right = new Node ( 5 ) ; tree . root2 . left . right = new Node ( 6 ) ; tree . root2 . right . right . left = new Node ( 8 ) ; tree . root2 . right . right . right = new Node ( 7 ) ; if ( tree . isIsomorphic ( tree . root1 , tree . root2 ) == true ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } }

Class/struct names: BinaryTree, Node
C# program:
using System ; class GFG { static String findNumber ( int s , int d ) { String num = " " ; int val = s / d ; int rem = s % d ; int i ; for ( i = 1 ; i <= d - rem ; i ++ ) { num = num + String . Join ( " " , val ) ; } if ( rem > 0 ) { val ++ ; for ( i = d - rem + 1 ; i <= d ; i ++ ) { num = num + String . Join ( " " , val ) ; } } return num ; } public static void Main ( String [ ] args ) { int s = 25 , d = 4 ; Console . Write ( findNumber ( s , d ) ) ; } }

Accumulator variables: i, val
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int kthSmallest ( int a , int k ) { int res = 0 ; int j = 0 ; for ( int i = 0 ; i < 32 ; i ++ ) { while ( j < 32 && ( a & ( 1 << j ) ) > 0 ) j ++ ; if ( ( k & ( 1 << i ) ) > 0 ) res |= ( 1 << j ) ; j ++ ; } return res ; } public static void Main ( ) { int a = 10 , k = 3 ; Console . WriteLine ( kthSmallest ( a , k ) ) ; } }

Accumulator variables: i, j, res
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int fastmod ( int baseval , int exp , int mod ) { if ( exp == 0 ) return 1 ; else if ( exp % 2 == 0 ) { int ans = fastmod ( baseval , exp / 2 , mod ) ; return ( ans % mod * ans % mod ) % mod ; } else return ( fastmod ( baseval , exp - 1 , mod ) % mod * baseval % mod ) % mod ; } static int countSetBits ( int n ) { int count = 0 ; while ( n > 0 ) { count += n & 1 ; n >>= 1 ; } return count ; } static int findPowerSum ( int n , int [ ] ar ) { int mod = ( int ) 1e9 + 7 ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int baseval = countSetBits ( ar [ i ] ) ; int exp = ar [ i ] ; sum += fastmod ( baseval , exp , mod ) ; sum %= mod ; } return sum ; } public static void Main ( ) { int n = 3 ; int [ ] ar = { 1 , 2 , 3 } ; Console . WriteLine ( findPowerSum ( n , ar ) ) ; } }

Index/key variables: i
Accumulator variables: count, i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class Gfg { public static int CountTriangles ( int n ) { int curr = 1 ; int Tri_count = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { Tri_count = ( curr * 3 ) + 2 ; curr = Tri_count ; } return Tri_count ; } public static void Main ( String [ ] args ) { int n = 10 ; Console . WriteLine ( CountTriangles ( n ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: Gfg
C# program:
using System ; class GFG { static int numSeq ( int n ) { return ( int ) ( ( Math . Pow ( 3 , n ) + 3 * Math . Pow ( - 1 , n ) ) / 4 ) ; } public static void Main ( ) { int N = 10 ; Console . WriteLine ( numSeq ( N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class gfg { static int sub_arrays ( int [ ] a , int n , int k ) { int [ ] sum = new int [ n + 2 ] ; for ( int i = 0 ; i < n + 2 ; i ++ ) { sum [ i ] = 0 ; } for ( int i = 0 ; i < n ; i ++ ) { a [ i ] -- ; a [ i ] %= k ; sum [ i + 1 ] += sum [ i ] + a [ i ] ; sum [ i + 1 ] %= k ; } int ans = 0 , l = 0 , r = 0 ; Dictionary < int , int > mp = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n + 1 ; i ++ ) { if ( ! mp . ContainsKey ( sum [ i ] ) ) mp . Add ( sum [ i ] , 0 ) ; } int temp ; for ( int i = 0 ; i < n + 1 ; i ++ ) { ans += ( int ) mp [ sum [ i ] ] ; temp = ( int ) mp [ sum [ i ] ] + 1 ; mp [ sum [ i ] ] = temp ; r ++ ; if ( r - l >= k ) { temp = ( int ) mp [ sum [ l ] ] - 1 ; mp [ sum [ i ] ] = temp ; l ++ ; } } return ans ; } public static void Main ( String [ ] args ) { int [ ] a = { 1 , 4 , 2 , 3 , 5 } ; int n = a . Length ; int k = 4 ; Console . Write ( sub_arrays ( a , n , k ) ) ; } }

Index/key variables: i, l
Accumulator variables: ans, i, l, r
Iterator variables: i
Class/struct names: gfg
C# program:
using System ; using System . Linq ; class GFG { static void sieve ( Boolean [ ] prime , int n ) { prime [ 0 ] = false ; prime [ 1 ] = false ; for ( int p = 2 ; p * p <= n ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * p ; i <= n ; i += p ) prime [ i ] = false ; } } } static int sumPrime ( int d ) { int maxVal = ( int ) ( Math . Pow ( 2 , d ) - 1 ) ; Boolean [ ] prime = new Boolean [ maxVal + 1 ] ; for ( int i = 0 ; i <= maxVal ; i ++ ) prime . SetValue ( true , i ) ; sieve ( prime , maxVal ) ; int sum = 0 ; for ( int i = 2 ; i <= maxVal ; i ++ ) { if ( prime [ i ] ) { sum += i ; } } return sum ; } public static void Main ( String [ ] args ) { int d = 8 ; Console . WriteLine ( sumPrime ( d ) ) ; } }

Index/key variables: i, p
Accumulator variables: i, p, sum
Iterator variables: i, p
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 bool isPossible ( int [ ] arr , int n , int p ) { int gcd = 0 ; for ( int i = 0 ; i < n ; i ++ ) gcd = __gcd ( gcd , arr [ i ] ) ; if ( p % gcd == 0 ) return true ; return false ; } public static void Main ( String [ ] args ) { int [ ] arr = { 6 , 9 } ; int n = arr . Length ; int p = 3 ; if ( isPossible ( arr , n , p ) ) 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 int max_element ( int [ ] a , int n ) { int m = int . MinValue ; for ( int i = 0 ; i < n ; i ++ ) m = Math . Max ( m , a [ i ] ) ; return m ; } static void findNum ( int [ ] a , int n , int [ ] b , int m ) { int x = max_element ( a , n ) ; int y = max_element ( b , m ) ; Console . Write ( x + " ▁ " + y ) ; } public static void Main ( ) { int [ ] a = { 3 , 2 , 2 } ; int n = a . Length ; int [ ] b = { 1 , 5 , 7 , 7 , 9 } ; int m = b . Length ; findNum ( a , n , b , m ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void printArr ( int [ ] arr , int n ) { for ( int i = 0 ; i < n ; i ++ ) Console . Write ( arr [ i ] + " ▁ " ) ; } static void generateArr ( int [ ] arr , int n ) { bool flip = true ; for ( int i = 0 ; i < n ; i ++ ) { if ( ( arr [ i ] & 1 ) != 0 ) { if ( flip ^= true ) Console . Write ( ( int ) ( Math . Ceiling ( arr [ i ] / 2.0 ) ) + " ▁ " ) ; else Console . Write ( ( int ) ( Math . Floor ( arr [ i ] / 2.0 ) ) + " ▁ " ) ; } else { Console . Write ( arr [ i ] / 2 + " ▁ " ) ; } } } public static void Main ( String [ ] args ) { int [ ] arr = { 3 , - 5 , - 7 , 9 , 2 , - 2 } ; int n = arr . Length ; generateArr ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: flip, i
Iterator variables: i
Boolean variables: flip
Class/struct names: GFG
C# program:
using System ; class GFG { static int binomialCoeff ( int n , int k ) { int [ , ] C = new int [ n + 1 , k + 1 ] ; int i , j ; for ( i = 0 ; i <= n ; i ++ ) { for ( j = 0 ; j <= Math . Min ( i , k ) ; j ++ ) { if ( j == 0 j == i ) C [ i , j ] = 1 ; else C [ i , j ] = C [ i - 1 , j - 1 ] + C [ i - 1 , j ] ; } } return C [ n , k ] ; } static int cntSubSeq ( int [ ] arr , int n , int k ) { Array . Sort ( arr ) ; int num = arr [ k - 1 ] ; int Y = 0 ; for ( int i = k - 1 ; i >= 0 ; i -- ) { if ( arr [ i ] == num ) Y ++ ; } int cntX = Y ; for ( int i = k ; i < n ; i ++ ) { if ( arr [ i ] == num ) cntX ++ ; } return binomialCoeff ( cntX , Y ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 4 } ; int n = arr . Length ; int k = 2 ; Console . WriteLine ( cntSubSeq ( arr , n , k ) ) ; } }

Index/key variables: i
Accumulator variables: Y, cntX, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void convertToBinary ( int num , int [ ] a , int n ) { int pointer = n - 1 ; while ( num > 0 ) { a [ pointer ] = num % 2 ; num = num / 2 ; pointer -- ; } } static void checkforsum ( int [ ] a , int n ) { int sum1 = 0 ; int sum2 = 0 ; int mid = n / 2 ; for ( int i = 0 ; i < mid ; i ++ ) sum1 = sum1 + a [ i ] ; for ( int j = mid ; j < n ; j ++ ) sum2 = sum2 + a [ j ] ; if ( sum1 == sum2 ) { for ( int i = 0 ; i < n ; i ++ ) Console . Write ( a [ i ] ) ; Console . WriteLine ( ) ; } } static void print_seq ( int m ) { int n = ( 2 * m ) ; int [ ] a = new int [ n ] ; for ( int j = 0 ; j < n ; j ++ ) { a [ j ] = 0 ; } for ( int i = 0 ; i < ( int ) Math . Pow ( 2 , n ) ; i ++ ) { convertToBinary ( i , a , n ) ; checkforsum ( a , n ) ; } } public static void Main ( String [ ] args ) { int m = 2 ; print_seq ( m ) ; } }

Index/key variables: i, j, n, pointer
Accumulator variables: i, j, pointer
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int __gcd ( int a , int b ) { if ( b == 0 ) return a ; return __gcd ( b , a % b ) ; } static bool coprime ( int a , int b ) { if ( __gcd ( a , b ) == 1 ) return true ; else return false ; } static bool isPrime ( int n ) { if ( n <= 1 ) return false ; if ( n == 2 n == 3 ) return true ; for ( int i = 2 ; i * i <= n ; i ++ ) if ( n % i == 0 ) return false ; return true ; } static void findNumbers ( int a , int b , int n ) { bool possible = true ; if ( ! coprime ( a , b ) ) possible = false ; int c1 = 1 ; int c2 = 1 ; int num1 , num2 ; HashSet < int > st = new HashSet < int > ( ) ; if ( possible ) { while ( st . Count != n ) { num1 = a + ( c1 * b ) ; if ( isPrime ( num1 ) ) { st . Add ( num1 ) ; } c1 ++ ; num2 = b + ( c2 * a ) ; if ( isPrime ( num2 ) ) { st . Add ( num2 ) ; } c2 ++ ; } foreach ( int i in st ) Console . Write ( i + " ▁ " ) ; } else Console . Write ( " - 1" ) ; } public static void Main ( String [ ] args ) { int a = 3 ; int b = 5 ; int n = 4 ; findNumbers ( a , b , n ) ; } }

Accumulator variables: c1, c2, i
Iterator variables: i
Boolean variables: possible
Class/struct names: GFG
C# program:
using System ; class GFG { static void findIntegers ( int n , int [ ] a , int x , int t1 , int t2 ) { bool flag = true ; for ( int i = 0 ; i < n ; i ++ ) { int temp = ( int ) Math . Pow ( a [ i ] , 2 ) + x ; if ( temp % 10 != t1 && temp % 10 != t2 ) { Console . Write ( temp + " ▁ " ) ; flag = false ; } } if ( flag ) { Console . WriteLine ( ) ; Console . Write ( " - 1" ) ; } } public static void Main ( String [ ] args ) { int N = 4 ; int X = 10 ; int T1 = 5 ; int T2 = 6 ; int [ ] a = { 3 , 1 , 4 , 7 } ; findIntegers ( N , a , X , T1 , T2 ) ; N = 4 ; X = 2 ; T1 = 5 ; T2 = 6 ; int [ ] b = { 2 , 18 , 22 , 8 } ; findIntegers ( N , b , X , T1 , T2 ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Boolean variables: flag
Class/struct names: GFG
C# program:
using System ; class GFG { readonly static int TEN = 10 ; static int digitSum ( int n ) { int sum = 0 ; while ( n > 0 ) { sum += n % TEN ; n /= TEN ; } return sum ; } static int getNthTerm ( int n ) { int sum = digitSum ( n ) ; if ( sum % TEN == 0 ) return ( n * TEN ) ; int extra = TEN - ( sum % TEN ) ; return ( ( n * TEN ) + extra ) ; } static void firstNTerms ( int n ) { for ( int i = 1 ; i <= n ; i ++ ) Console . Write ( getNthTerm ( i ) + " ▁ " ) ; } public static void Main ( String [ ] args ) { int n = 10 ; firstNTerms ( n ) ; } }

Accumulator variables: i, n, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int min1 = int . MaxValue ; static int count = 0 ; public int permutation ( String str1 , int i , int n , int p ) { if ( i == n ) { int q = int . Parse ( str1 ) ; if ( q - p > 0 && q < min1 ) { min1 = q ; count = 1 ; } } else { for ( int j = i ; j <= n ; j ++ ) { str1 = swap ( str1 , i , j ) ; permutation ( str1 , i + 1 , n , p ) ; str1 = swap ( str1 , i , j ) ; } } return min1 ; } public String swap ( String str , int i , int j ) { char [ ] ch = str . ToCharArray ( ) ; char temp = ch [ i ] ; ch [ i ] = ch [ j ] ; ch [ j ] = temp ; return String . Join ( " " , ch ) ; } public static void Main ( String [ ] args ) { int A = 213 ; int B = 111 ; GFG gfg = new GFG ( ) ; String str1 = A . ToString ( ) ; int len = str1 . Length ; int h = gfg . permutation ( str1 , 0 , len - 1 , B ) ; if ( count == 1 ) Console . WriteLine ( h ) ; else Console . WriteLine ( - 1 ) ; } }

Index/key variables: i, j
Accumulator variables: j
Iterator variables: j
Class/struct names: GFG
C# program:
using System ; class GFG { static int Alcuin ( int n ) { double _n = n , ans ; ans = Math . Round ( ( _n * _n ) / 12 ) - Math . Floor ( _n / 4 ) * Math . Floor ( ( _n + 2 ) / 4 ) ; return ( int ) ans ; } static void solve ( int n ) { int i = 0 ; for ( i = 1 ; i <= n ; i ++ ) { Console . Write ( Alcuin ( i ) + " , ▁ " ) ; } } public static void Main ( String [ ] args ) { int n = 15 ; solve ( n ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int [ ] solve ( int [ ] arr , int n ) { int [ ] b = new int [ n ] ; int p = 0 ; for ( int i = n - 1 ; i >= 0 ; i -- ) { b [ p ] = arr [ i -- ] ; if ( i >= 0 ) b [ n - 1 - p ] = arr [ i ] ; p ++ ; } return b ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 4 } ; int n = arr . Length ; int [ ] b = solve ( arr , n ) ; Console . WriteLine ( " [ " + String . Join ( " , " , b ) + " ] " ) ; } }

Index/key variables: i, n, p
Accumulator variables: i, p
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static Boolean productsDistinct ( int N ) { String s = " " ; while ( N > 0 ) { s += ( char ) ( N % 10 + '0' ) ; N /= 10 ; } s = reverse ( s ) ; int sz = s . Length ; HashSet < int > se = new HashSet < int > ( ) ; for ( int i = 0 ; i < sz ; i ++ ) { int product = 1 ; for ( int j = i ; j < sz ; j ++ ) { product *= ( int ) ( s [ j ] - '0' ) ; if ( se . Contains ( product ) ) return false ; else se . Add ( product ) ; } } return true ; } static String reverse ( String input ) { char [ ] a = input . ToCharArray ( ) ; int l , r ; r = a . Length - 1 ; for ( l = 0 ; l < r ; l ++ , r -- ) { char temp = a [ l ] ; a [ l ] = a [ r ] ; a [ r ] = temp ; } return String . Join ( " " , a ) ; } public static void Main ( String [ ] args ) { int N = 2345 ; if ( productsDistinct ( N ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Index/key variables: j, l, r
Accumulator variables: N, i, j, l, product, r, s
Iterator variables: i, j, l
Class/struct names: GFG
C# program:
using System ; class GFG { static int factorial ( int n ) { if ( n <= 1 ) return 1 ; return n * factorial ( n - 1 ) ; } static int nCr ( int n , int r ) { return factorial ( n ) / ( factorial ( n - r ) * factorial ( r ) ) ; } static int NumberOfWays ( int n , int x , int y ) { return nCr ( 2 * n - x - y , n - x ) * factorial ( n ) * factorial ( n ) ; } public static void Main ( String [ ] args ) { int n = 5 , x = 4 , y = 2 ; Console . WriteLine ( NumberOfWays ( n , x , y ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static long findSmallestNonZeroY ( long A_num ) { String A_binary = Convert . ToString ( A_num , 2 ) ; long B = 1 ; int len = A_binary . Length ; int no_ones = bitCount ( A_num ) ; if ( len == no_ones ) { return A_num + 1 ; } for ( int i = 0 ; i < len ; i ++ ) { char ch = A_binary [ len - i - 1 ] ; if ( ch == '0' ) { B = ( long ) Math . Pow ( 2.0 , ( double ) i ) ; break ; } } return B ; } static int bitCount ( long x ) { int setBits = 0 ; while ( x != 0 ) { x = x & ( x - 1 ) ; setBits ++ ; } return setBits ; } public static void Main ( String [ ] args ) { long X = findSmallestNonZeroY ( 10 ) ; Console . WriteLine ( X ) ; } }

Accumulator variables: i, setBits
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int maxElement ( int [ ] a , int n ) { if ( n < 3 ) return - 1 ; int maxElement = a [ 0 ] ; int maxProd = a [ n - 1 ] * a [ 1 ] ; for ( int i = 1 ; i < n ; i ++ ) { int currProd = a [ i - 1 ] * a [ ( i + 1 ) % n ] ; if ( currProd > maxProd ) { maxProd = currProd ; maxElement = a [ i ] ; } else if ( currProd == maxProd ) { maxElement = Math . Max ( maxElement , a [ i ] ) ; } } return maxElement ; } public static void Main ( ) { int [ ] a = { 5 , 6 , 4 , 3 , 2 } ; int n = a . Length ; Console . WriteLine ( maxElement ( a , n ) ) ; } }

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