dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static int N = 8 ; static bool isSafe ( int x , int y , int [ , ] sol ) { return ( x >= 0 && x < N && y >= 0 && y < N && sol [ x , y ] == - 1 ) ; } static void printSolution ( int [ , ] sol ) { for ( int x = 0 ; x < N ; x ++ ) { for ( int y = 0 ; y < N ; y ++ ) Console . Write ( sol [ x , y ] + " ▁ " ) ; Console . WriteLine ( ) ; } } static bool solveKT ( ) { int [ , ] sol = new int [ 8 , 8 ] ; for ( int x = 0 ; x < N ; x ++ ) for ( int y = 0 ; y < N ; y ++ ) sol [ x , y ] = - 1 ; int [ ] xMove = { 2 , 1 , - 1 , - 2 , - 2 , - 1 , 1 , 2 } ; int [ ] yMove = { 1 , 2 , 2 , 1 , - 1 , - 2 , - 2 , - 1 } ; sol [ 0 , 0 ] = 0 ; if ( ! solveKTUtil ( 0 , 0 , 1 , sol , xMove , yMove ) ) { Console . WriteLine ( " Solution ▁ does ▁ " + " not ▁ exist " ) ; return false ; } else printSolution ( sol ) ; return true ; } static bool solveKTUtil ( int x , int y , int movei , int [ , ] sol , int [ ] xMove , int [ ] yMove ) { int k , next_x , next_y ; if ( movei == N * N ) return true ; for ( k = 0 ; k < 8 ; k ++ ) { next_x = x + xMove [ k ] ; next_y = y + yMove [ k ] ; if ( isSafe ( next_x , next_y , sol ) ) { sol [ next_x , next_y ] = movei ; if ( solveKTUtil ( next_x , next_y , movei + 1 , sol , xMove , yMove ) ) return true ; else sol [ next_x , next_y ] = - 1 ; } } return false ; } public static void Main ( ) { solveKT ( ) ; } }

Index/key variables: k
Accumulator variables: k, x, y
Iterator variables: k, x, y
Class/struct names: GFG
C# program:
using System ; class RatMaze { static int N ; void printSolution ( int [ , ] sol ) { for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) Console . Write ( " ▁ " + sol [ i , j ] + " ▁ " ) ; Console . WriteLine ( ) ; } } bool isSafe ( int [ , ] maze , int x , int y ) { return ( x >= 0 && x < N && y >= 0 && y < N && maze [ x , y ] == 1 ) ; } bool solveMaze ( int [ , ] maze ) { int [ , ] sol = new int [ N , N ] ; if ( solveMazeUtil ( maze , 0 , 0 , sol ) == false ) { Console . Write ( " Solution ▁ doesn ' t ▁ exist " ) ; return false ; } printSolution ( sol ) ; return true ; } bool solveMazeUtil ( int [ , ] maze , int x , int y , int [ , ] sol ) { if ( x == N - 1 && y == N - 1 && maze [ x , y ] == 1 ) { sol [ x , y ] = 1 ; return true ; } if ( isSafe ( maze , x , y ) == true ) { if ( sol [ x , y ] == 1 ) return false ; sol [ x , y ] = 1 ; if ( solveMazeUtil ( maze , x + 1 , y , sol ) ) return true ; if ( solveMazeUtil ( maze , x , y + 1 , sol ) ) return true ; if ( solveMazeUtil ( maze , x - 1 , y , sol ) ) return true ; if ( solveMazeUtil ( maze , x , y - 1 , sol ) ) return true ; sol [ x , y ] = 0 ; return false ; } return false ; } public static void Main ( String [ ] args ) { RatMaze rat = new RatMaze ( ) ; int [ , ] maze = { { 1 , 0 , 0 , 0 } , { 1 , 1 , 0 , 1 } , { 0 , 1 , 0 , 0 } , { 1 , 1 , 1 , 1 } } ; N = maze . GetLength ( 0 ) ; rat . solveMaze ( maze ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: RatMaze
C# program:
using System ; class GFG { static int V = 4 ; static void printSolution ( int [ ] color ) { Console . WriteLine ( " Solution ▁ Exists : " + " ▁ Following ▁ are ▁ the ▁ assigned ▁ colors ▁ " ) ; for ( int i = 0 ; i < V ; i ++ ) Console . Write ( " ▁ " + color [ i ] ) ; Console . WriteLine ( ) ; } static bool isSafe ( bool [ , ] graph , int [ ] color ) { for ( int i = 0 ; i < V ; i ++ ) for ( int j = i + 1 ; j < V ; j ++ ) if ( graph [ i , j ] && color [ j ] == color [ i ] ) return false ; return true ; } static bool graphColoring ( bool [ , ] graph , int m , int i , int [ ] color ) { if ( i == V ) { if ( isSafe ( graph , color ) ) { printSolution ( color ) ; return true ; } return false ; } for ( int j = 1 ; j <= m ; j ++ ) { color [ i ] = j ; if ( graphColoring ( graph , m , i + 1 , color ) ) return true ; color [ i ] = 0 ; } return false ; } static void Main ( ) { bool [ , ] graph = { { false , true , true , true } , { true , false , true , false } , { true , true , false , true } , { true , false , true , false } , } ; int m = 3 ; int [ ] color = new int [ V ] ; for ( int i = 0 ; i < V ; i ++ ) color [ i ] = 0 ; if ( ! graphColoring ( graph , m , 0 , color ) ) Console . WriteLine ( " Solution ▁ does ▁ not ▁ exist " ) ; } }

Index/key variables: V, i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections ; using System . Collections . Generic ; class GFG { class node { public int color = 1 ; public HashSet < int > edges = new HashSet < int > ( ) ; } ; static int canPaint ( List < node > nodes , int n , int m ) { List < int > visited = new List < int > ( ) ; for ( int i = 0 ; i < n + 1 ; i ++ ) { visited . Add ( 0 ) ; } int maxColors = 1 ; for ( int sv = 1 ; sv <= n ; sv ++ ) { if ( visited [ sv ] > 0 ) continue ; visited [ sv ] = 1 ; Queue q = new Queue ( ) ; q . Enqueue ( sv ) ; while ( q . Count != 0 ) { int top = ( int ) q . Peek ( ) ; q . Dequeue ( ) ; foreach ( int it in nodes [ top ] . edges ) { if ( nodes [ top ] . color == nodes [ it ] . color ) nodes [ it ] . color += 1 ; maxColors = Math . Max ( maxColors , Math . Max ( nodes [ top ] . color , nodes [ it ] . color ) ) ; if ( maxColors > m ) return 0 ; if ( visited [ it ] == 0 ) { visited [ it ] = 1 ; q . Enqueue ( it ) ; } } } } return 1 ; } public static void Main ( ) { int n = 4 ; int [ , ] graph = { { 0 , 1 , 1 , 1 } , { 1 , 0 , 1 , 0 } , { 1 , 1 , 0 , 1 } , { 1 , 0 , 1 , 0 } } ; int m = 3 ; List < node > nodes = new List < node > ( ) ; for ( int i = 0 ; i < n + 1 ; i ++ ) { nodes . Add ( new node ( ) ) ; } for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( graph [ i , j ] > 0 ) { nodes [ i ] . edges . Add ( i ) ; nodes [ j ] . edges . Add ( j ) ; } } } Console . WriteLine ( canPaint ( nodes , n , m ) ) ; } }

Index/key variables: i, it, j, sv, top
Accumulator variables: color, i, j, sv
Iterator variables: i, it, j, sv
Class/struct names: GFG, node
C# program:
using System ; using System . Collections . Generic ; class GFG { static int cntMaxOperationToMakeN_1_0 ( int [ ] arr , int N ) { int cntOp = 0 ; List < int > PQ = new List < int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { PQ . Add ( arr [ i ] ) ; } PQ . Sort ( ) ; PQ . Reverse ( ) ; while ( PQ . Count > 1 ) { int X = PQ [ 0 ] ; PQ . RemoveAt ( 0 ) ; int Y = PQ [ 0 ] ; PQ . RemoveAt ( 0 ) ; X -- ; Y -- ; if ( X != 0 ) { PQ . Add ( X ) ; PQ . Sort ( ) ; PQ . Reverse ( ) ; } if ( Y != 0 ) { PQ . Add ( Y ) ; PQ . Sort ( ) ; PQ . Reverse ( ) ; } cntOp += 1 ; } return cntOp ; } static void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 4 , 5 } ; int N = arr . Length ; Console . WriteLine ( cntMaxOperationToMakeN_1_0 ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: X, Y, cntOp, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void flippingBits ( int N , int K ) { int X = ( 1 << ( K - 1 ) ) - 1 ; N = X - N ; Console . Write ( N ) ; } public static void Main ( string [ ] args ) { int N = 1 , K = 8 ; flippingBits ( N , K ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void generateMatrix ( int N ) { int odd = 1 ; int even = 2 ; int [ , ] mat = new int [ N + 1 , N + 1 ] ; for ( int i = 1 ; i <= N ; i ++ ) { for ( int j = 1 ; j <= N ; j ++ ) { if ( ( i + j ) % 2 == 0 ) { mat [ i , j ] = odd ; odd += 2 ; } else { mat [ i , j ] = even ; even += 2 ; } } } for ( int i = 1 ; i <= N ; i ++ ) { for ( int j = 1 ; j <= N ; j ++ ) { Console . Write ( mat [ i , j ] + " ▁ " ) ; } Console . WriteLine ( ) ; } } static public void Main ( ) { int N = 4 ; generateMatrix ( N ) ; } }

Accumulator variables: even, i, j, odd
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void build ( int [ ] tree , int [ ] arr , int start , int end , int index ) { if ( start == end ) { if ( start % 2 == 0 ) { tree [ index ] = arr [ start ] ; } else { tree [ index ] = - arr [ start ] ; } return ; } int mid = start + ( end - start ) / 2 ; build ( tree , arr , start , mid , 2 * index + 1 ) ; build ( tree , arr , mid + 1 , end , 2 * index + 2 ) ; tree [ index ] = tree [ 2 * index + 1 ] + tree [ 2 * index + 2 ] ; } static void update ( int [ ] tree , int index , int start , int end , int pos , int val ) { if ( start == end ) { if ( start % 2 == 0 ) { tree [ index ] = val ; } else { tree [ index ] = - val ; } return ; } int mid = start + ( end - start ) / 2 ; if ( mid >= pos ) { update ( tree , 2 * index + 1 , start , mid , pos , val ) ; } else { update ( tree , 2 * index + 2 , mid + 1 , end , pos , val ) ; } tree [ index ] = tree [ 2 * index + 1 ] + tree [ 2 * index + 2 ] ; } static int FindSum ( int [ ] tree , int start , int end , int L , int R , int index ) { if ( L > end R < start ) { return 0 ; } if ( L <= start && R >= end ) { return tree [ index ] ; } int mid = start + ( end - start ) / 2 ; int X = FindSum ( tree , start , mid , L , R , 2 * index + 1 ) ; int Y = FindSum ( tree , mid + 1 , end , L , R , 2 * index + 2 ) ; return X + Y ; } static void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 4 } ; int N = arr . Length ; int [ ] tree = new int [ 4 * N + 5 ] ; build ( tree , arr , 0 , N - 1 , 0 ) ; int [ , ] Q = { { 2 , 0 , 3 } , { 1 , 1 , 5 } , { 2 , 1 , 2 } } ; int cntQuey = 3 ; for ( int i = 0 ; i < cntQuey ; i ++ ) { if ( Q [ i , 0 ] == 1 ) { update ( tree , 0 , 0 , N - 1 , Q [ i , 1 ] , Q [ i , 2 ] ) ; } else { if ( Q [ i , 1 ] % 2 == 0 ) { Console . Write ( FindSum ( tree , 0 , N - 1 , Q [ i , 1 ] , Q [ i , 2 ] , 0 ) + " ▁ " ) ; } else { Console . Write ( - FindSum ( tree , 0 , N - 1 , Q [ i , 1 ] , Q [ i , 2 ] , 0 ) + " ▁ " ) ; } } } } }

Index/key variables: index, start
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void minimumSubarrays ( int [ ] arr , int n ) { char current = ' N ' ; int answer = 1 ; for ( int i = 1 ; i < n ; i ++ ) { if ( current == ' N ' ) { if ( arr [ i ] < arr [ i - 1 ] ) { current = ' D ' ; } else if ( arr [ i ] == arr [ i - 1 ] ) { current = ' N ' ; } else { current = ' I ' ; } } else if ( current == ' I ' ) { if ( arr [ i ] >= arr [ i - 1 ] ) { current = ' I ' ; } else { current = ' N ' ; answer += 1 ; } } else { if ( arr [ i ] <= arr [ i - 1 ] ) { current = ' D ' ; } else { current = ' N ' ; answer += 1 ; } } } Console . Write ( answer ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 2 , 3 , 9 , 5 , 4 , 6 , 8 } ; int n = arr . Length ; minimumSubarrays ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: answer, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void ConstMatrix ( int [ , ] mat , int N , int M , int A , int B ) { if ( N * M != A * B ) return ; int idx = 0 ; int [ , ] res = new int [ A , B ] ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < M ; j ++ ) { res [ idx / B , idx % B ] = mat [ i , j ] ; idx ++ ; } } for ( int i = 0 ; i < A ; i ++ ) { for ( int j = 0 ; j < B ; j ++ ) Console . Write ( res [ i , j ] + " ▁ " ) ; Console . Write ( " STRNEWLINE " ) ; } } public static void Main ( String [ ] args ) { int [ , ] mat = { { 1 , 2 , 3 , 4 , 5 , 6 } } ; int A = 2 ; int B = 3 ; int N = mat . GetLength ( 0 ) ; int M = mat . GetLength ( 1 ) ; ConstMatrix ( mat , N , M , A , B ) ; } }

Accumulator variables: i, idx, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void printFinalPrices ( int [ ] arr ) { Stack < int > minStk = new Stack < int > ( ) ; int n = arr . Length ; int [ ] reduce = new int [ n ] ; for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( minStk . Count != 0 ) { if ( minStk . Peek ( ) <= arr [ i ] ) { reduce [ i ] = minStk . Peek ( ) ; } else { while ( minStk . Count != 0 && ( minStk . Peek ( ) > arr [ i ] ) ) { minStk . Pop ( ) ; } if ( minStk . Count != 0 ) { reduce [ i ] = minStk . Peek ( ) ; } } } minStk . Push ( arr [ i ] ) ; } for ( int i = 0 ; i < n ; i ++ ) Console . Write ( arr [ i ] - reduce [ i ] + " ▁ " ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 8 , 4 , 6 , 2 , 3 } ; printFinalPrices ( arr ) ; } }

Index/key variables: i, n
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void constructArray ( int [ ] A , int N ) { int [ ] left = new int [ N + 1 ] ; int [ ] right = new int [ N + 1 ] ; int [ ] X = new int [ N + 1 ] ; int [ ] Y = new int [ N + 1 ] ; for ( int i = 0 ; i < N ; i ++ ) { X [ i ] = left [ A [ i ] ] ; left [ A [ i ] ] ++ ; } for ( int i = N - 1 ; i >= 0 ; i -- ) { Y [ i ] = right [ A [ i ] ] ; right [ A [ i ] ] ++ ; } for ( int i = 0 ; i < N ; i ++ ) { Console . Write ( Y [ i ] - X [ i ] + " ▁ " ) ; } } public static void Main ( ) { int [ ] A = { 3 , 2 , 1 , 2 , 3 } ; int N = A . Length ; constructArray ( A , N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { public class Node { public int data ; public Node next ; } ; static Node head ; static Node push ( Node head_ref , int new_data ) { Node new_node = new Node ( ) ; new_node . data = new_data ; new_node . next = head_ref ; head_ref = new_node ; return head_ref ; } static int largestElement ( Node head_ref ) { int Max = int . MinValue ; Node head = head_ref ; while ( head != null ) { if ( Max < head . data ) { Max = head . data ; } head = head . next ; } return Max ; } static HashSet < int > createDictionary ( int Max ) { HashSet < int > hashmap = new HashSet < int > ( ) ; int prev = 0 ; int curr = 1 ; hashmap . Add ( prev ) ; hashmap . Add ( curr ) ; while ( curr <= Max ) { int temp = curr + prev ; hashmap . Add ( temp ) ; prev = curr ; curr = temp ; } return hashmap ; } static double meanofnodes ( ) { int Max = largestElement ( head ) ; HashSet < int > hashmap = createDictionary ( Max ) ; Node curr = head ; int cnt = 0 ; double sum = 0.0 ; while ( curr != null ) { if ( ( curr . data ) % 2 == 1 ) { if ( hashmap . Contains ( curr . data ) ) { cnt ++ ; sum += curr . data ; hashmap . Remove ( curr . data ) ; } } curr = curr . next ; } return ( sum / cnt ) ; } public static void Main ( String [ ] args ) { head = null ; head = push ( head , 5 ) ; head = push ( head , 21 ) ; head = push ( head , 8 ) ; head = push ( head , 12 ) ; head = push ( head , 3 ) ; head = push ( head , 13 ) ; head = push ( head , 144 ) ; head = push ( head , 6 ) ; Console . Write ( meanofnodes ( ) ) ; } }

Accumulator variables: cnt, sum
Class/struct names: GFG, Node
C# program:
using System ; class GFG { static void findNumbers ( int n ) { int i = 0 ; while ( i <= n ) { Console . Write ( 2 * i * i + 4 * i + 1 + i % 2 + " ▁ " ) ; i ++ ; } } public static void Main ( ) { int n = 6 ; findNumbers ( n ) ; } }

Accumulator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int computeSalary ( int basic , char grade ) { double allowance ; double hra , da , pf ; hra = 0.2 * basic ; da = 0.5 * basic ; pf = 0.11 * basic ; if ( grade == ' A ' ) { allowance = 1700.0 ; } else if ( grade == ' B ' ) { allowance = 1500.0 ; } else { allowance = 1300.0 ; } double gross ; gross = Math . Round ( basic + hra + da + allowance - pf ) ; return ( int ) gross ; } public static void Main ( String [ ] args ) { int basic = 10000 ; char grade = ' A ' ; Console . WriteLine ( computeSalary ( basic , grade ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int smallSubarray ( int [ ] arr , int n , int total_sum ) { Dictionary < int , int > m = new Dictionary < int , int > ( ) ; int length = int . MaxValue ; int prefixSum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { prefixSum += arr [ i ] ; if ( prefixSum == total_sum ) { length = Math . Min ( length , i + 1 ) ; } if ( m . ContainsKey ( prefixSum ) ) m [ prefixSum ] = i ; else m . Add ( prefixSum , i ) ; if ( m . ContainsKey ( prefixSum - total_sum ) ) { length = Math . Min ( length , i - m [ prefixSum - total_sum ] ) ; } } return length ; } static int smallestSubarrayremoved ( int [ ] arr , int n , int k ) { int total_sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] > k ) { arr [ i ] = 1 ; } else if ( arr [ i ] < k ) { arr [ i ] = - 1 ; } else { arr [ i ] = 0 ; } total_sum += arr [ i ] ; } if ( total_sum == 0 ) { return 0 ; } else { return smallSubarray ( arr , n , total_sum ) ; } } public static void Main ( String [ ] args ) { int [ ] arr = { 12 , 16 , 12 , 13 , 10 } ; int K = 13 ; int n = arr . Length ; Console . WriteLine ( smallestSubarrayremoved ( arr , n , K ) ) ; } }

Index/key variables: i, prefixSum
Accumulator variables: i, prefixSum, total_sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static String balancedTernary ( int n ) { String output = " " ; while ( n > 0 ) { int rem = n % 3 ; n = n / 3 ; if ( rem == 2 ) { rem = - 1 ; n ++ ; } output = ( rem == 0 ? '0' : ( rem == 1 ) ? '1' : ' Z ' ) + output ; } return output ; } public static void Main ( String [ ] args ) { int n = 238 ; Console . Write ( " Equivalent ▁ Balanced ▁ Ternary ▁ of ▁ " + n + " ▁ is : ▁ " + balancedTernary ( n ) ) ; } }

Accumulator variables: n
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int spt = 0 ; static int count ( List < int > arr , int min_i ) { int count = 0 ; for ( int i = 0 ; i < arr . Count ; i ++ ) if ( min_i == arr [ i ] ) count ++ ; return count ; } static void printList ( List < int > arr ) { int min_i = int . MaxValue ; for ( int i = 0 ; i < arr . Count ; i ++ ) min_i = Math . Min ( min_i , arr [ i ] ) ; int freq = count ( arr , min_i ) ; spt += freq ; } static void findWays ( List < int > arr , int i , int n ) { if ( n == 0 ) printList ( arr ) ; for ( int j = i ; j <= n ; j ++ ) { arr . Add ( j ) ; findWays ( arr , j , n - j ) ; arr . RemoveAt ( arr . Count - 1 ) ; } } static void spt_function ( int n ) { List < int > arr = new List < int > ( ) ; findWays ( arr , 1 , n ) ; Console . Write ( spt ) ; } public static void Main ( String [ ] args ) { int N = 4 ; spt_function ( N ) ; } }

Index/key variables: i
Accumulator variables: count, i, j, spt
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int x , y ; static int gcd_extend ( int a , int b ) { if ( b == 0 ) { x = 1 ; y = 0 ; return a ; } else { int g = gcd_extend ( b , a % b ) ; int x1 = x , y1 = y ; x = y1 ; y = x1 - ( a / b ) * y1 ; return g ; } } static void print_solution ( int a , int b , int c ) { if ( a == 0 && b == 0 ) { if ( c == 0 ) { Console . Write ( " Infinite ▁ Solutions ▁ " + " Exist " + " STRNEWLINE " ) ; } else { Console . Write ( " No ▁ Solution ▁ exists " + " STRNEWLINE " ) ; } } int gcd = gcd_extend ( a , b ) ; if ( c % gcd != 0 ) { Console . Write ( " No ▁ Solution ▁ exists " + " STRNEWLINE " ) ; } else { Console . Write ( " x ▁ = ▁ " + x * ( c / gcd ) + " , ▁ y ▁ = ▁ " + y * ( c / gcd ) + " STRNEWLINE " ) ; } } public static void Main ( String [ ] args ) { int a , b , c ; a = 4 ; b = 18 ; c = 10 ; print_solution ( a , b , c ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool check ( int x ) { return x != 0 && ( ( x & ( x - 1 ) ) == 0 ) ; } static int count ( int [ ] arr , int n ) { int cnt = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { if ( check ( arr [ i ] & arr [ j ] ) ) cnt ++ ; } } return cnt ; } public static void Main ( ) { int [ ] arr = new int [ ] { 6 , 4 , 2 , 3 } ; int n = arr . Length ; Console . Write ( count ( arr , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: cnt, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPrime ( int n ) { if ( n <= 1 ) return false ; for ( int i = 2 ; i <= Math . Sqrt ( n ) ; i ++ ) if ( n % i == 0 ) return false ; return true ; } static int takeSum ( int [ , ] a ) { int sum = 0 ; for ( int i = 0 ; i < 4 ; i ++ ) for ( int j = 0 ; j < 5 ; j ++ ) sum += a [ i , j ] ; return sum ; } static bool checkIndex ( int n , int m , int [ , ] a ) { for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { if ( isPrime ( i + j ) ) { if ( ! isPrime ( a [ i , j ] ) ) return false ; } } } return true ; } public static void Main ( String [ ] args ) { int n = 4 , m = 5 ; int [ , ] a = { { 1 , 2 , 3 , 2 , 2 } , { 2 , 2 , 7 , 7 , 7 } , { 7 , 7 , 21 , 7 , 10 } , { 2 , 2 , 3 , 6 , 7 } } ; int sum = takeSum ( a ) ; if ( isPrime ( sum ) && checkIndex ( n , m , a ) ) { Console . Write ( " YES " + " STRNEWLINE " ) ; } else { Console . Write ( " NO " + " STRNEWLINE " ) ; } } }

Accumulator variables: i, j, sum
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int countPairs ( int [ ] A , int n ) { int count = 0 , i , j ; for ( i = 0 ; i < n ; i ++ ) { for ( j = i + 1 ; j < n ; j ++ ) { if ( ( A [ i ] % 2 == 0 && A [ j ] % 2 == 0 ) || ( A [ i ] % 2 != 0 && A [ j ] % 2 != 0 ) ) count ++ ; } } return count ; } public static void Main ( String [ ] args ) { int [ ] A = { 1 , 2 , 3 , 1 , 3 } ; int n = A . Length ; Console . Write ( countPairs ( A , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int smallestNum ( int n ) { return ( int ) ( ( n * n % 9 + 1 ) * Math . Pow ( 10 , n * n / 9 ) - 1 ) ; } public static void Main ( String [ ] args ) { int n = 4 ; Console . Write ( smallestNum ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void findNthTerm ( int n ) { Console . Write ( n * ( 5 * n + 3 ) / 2 ) ; } public static void Main ( ) { int N = 4 ; findNthTerm ( 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 bool isWeaklyPrimeNum ( int N ) { if ( ! isPrime ( N ) ) return false ; String s = String . Join ( " " , N ) ; for ( int j = 0 ; j < s . Length ; j ++ ) { char [ ] str = s . ToCharArray ( ) ; for ( int i = 0 ; i <= 9 ; i ++ ) { char c = ( char ) ( '0' + i ) ; str [ j ] = c ; int Num = Int32 . Parse ( String . Join ( " " , str ) ) ; if ( str [ j ] != s [ j ] && isPrime ( Num ) ) { return false ; } } } return true ; } public static void Main ( String [ ] args ) { int n = 294001 ; if ( isWeaklyPrimeNum ( n ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Index/key variables: j
Accumulator variables: i, j
Iterator variables: i, j
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 bool isUnPrimeableNum ( int N ) { if ( isPrime ( N ) ) return false ; String s = String . Join ( " " , N ) ; for ( int j = 0 ; j < s . Length ; j ++ ) { char [ ] str = s . ToCharArray ( ) ; for ( int i = 0 ; i <= 9 ; i ++ ) { char c = ( char ) ( '0' + i ) ; str [ j ] = c ; int Num = Int32 . Parse ( new String ( str ) ) ; if ( str [ j ] != s [ j ] && isPrime ( Num ) ) { return false ; } } } return true ; } public static void Main ( String [ ] args ) { int n = 200 ; if ( isUnPrimeableNum ( n ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

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