dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; public class GFG { static void sameChar ( String S , int N ) { char [ ] temp = S . ToCharArray ( ) ; Array . Sort ( temp ) ; String s = new String ( temp ) ; int mid = s [ N / 2 ] ; int total_operations = 0 ; for ( int i = 0 ; i < N ; i ++ ) { total_operations += Math . Abs ( ( s [ i ] - 0 ) - mid ) ; } Console . Write ( total_operations ) ; } static public void Main ( ) { String S = " geeks " ; int N = S . Length ; sameChar ( S , N ) ; } }

Index/key variables: i
Accumulator variables: i, total_operations
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int maxScore ( int i , int [ ] A , int K , int N , int [ ] dp ) { if ( i >= N - 1 ) return A [ N - 1 ] ; if ( dp [ i ] != - 1 ) return dp [ i ] ; int score = int . MinValue ; for ( int j = 1 ; j <= K ; j ++ ) { score = Math . Max ( score , maxScore ( i + j , A , K , N , dp ) ) ; } return dp [ i ] = score + A [ i ] ; } static void getScore ( int [ ] A , int N , int K ) { int [ ] dp = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) dp [ i ] = - 1 ; Console . WriteLine ( maxScore ( 0 , A , K , N , dp ) ) ; } static public void Main ( ) { int [ ] A = { 100 , - 30 , - 50 , - 15 , - 20 , - 30 } ; int K = 3 ; int N = A . Length ; getScore ( A , N , K ) ; } }

Index/key variables: N, i
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { static int getCount ( int [ ] arr , int N ) { int count = 0 ; if ( N < 3 ) return 0 ; for ( int b = 0 ; b < N ; b ++ ) { for ( int a = 0 ; a < N ; a ++ ) { if ( a == b ) continue ; for ( int c = 0 ; c < N ; c ++ ) { if ( c == a c == b ) continue ; int d = arr [ b ] * arr [ b ] / 4 ; if ( arr [ a ] * arr <= d ) count ++ ; } } } return count ; } static public void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 4 , 5 } ; int N = arr . Length ; Console . WriteLine ( getCount ( arr , N ) ) ; } }

Index/key variables: a, b
Accumulator variables: a, b, c, count
Iterator variables: a, b, c
Class/struct names: GFG
C# program:
using System ; class GFG { public static bool findAns ( int [ ] A , int N , int X ) { if ( check ( A , X ) ) { return true ; } for ( int i = 0 ; i < N ; i ++ ) { for ( int j = i + 1 ; j < N ; j ++ ) { int gcd = gcdFoo ( A [ i ] , A [ j ] ) ; if ( gcd != 1 ) { if ( gcd <= X ) { return true ; } } } } return false ; } public static bool check ( int [ ] A , int X ) { for ( int i = 0 ; i < A . Length ; i ++ ) { if ( A [ i ] > X ) { return false ; } } return true ; } static int gcdFoo ( int a , int b ) { if ( b == 0 ) return a ; return gcdFoo ( b , a % b ) ; } public static void Main ( String [ ] args ) { int X = 4 ; int [ ] A = { 2 , 1 , 5 , 3 , 6 } ; int N = 5 ; Console . WriteLine ( findAns ( A , N , X ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static string check ( int [ ] a , int [ ] b , int Na , int Nb , int k , int m ) { if ( Na < k < m ) return " No " ; Array . Sort ( a ) ; Array . Sort ( b ) ; if ( a [ k - 1 ] < b [ Nb - m ] ) { return " Yes " ; } return " No " ; } static public void Main ( ) { int [ ] arr1 = { 1 , 2 , 3 } ; int [ ] arr2 = { 3 , 4 , 5 } ; int N = arr1 . Length ; int M = arr2 . Length ; int X = 2 , Y = 1 ; Console . WriteLine ( check ( arr1 , arr2 , N , M , X , Y ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int splitArray ( int [ ] arr , int N ) { Array . Sort ( arr ) ; int result = Int32 . MaxValue ; for ( int i = 1 ; i < N ; i ++ ) { result = Math . Min ( result , arr [ i ] ^ arr [ i - 1 ] ) ; } return result ; } public static void Main ( ) { int [ ] arr = { 3 , 1 , 2 , 6 , 4 } ; int N = arr . Length ; Console . Write ( splitArray ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static bool isIncreasing ( int [ ] arr ) { for ( int i = 0 ; i < arr . Length - 1 ; i ++ ) { if ( arr [ i ] > arr [ i + 1 ] ) return false ; } return true ; } static int [ ] sortArr ( int [ ] arr ) { int prev = - 1 ; for ( int i = 0 ; i < arr . Length ; i ++ ) { int optEle = arr [ i ] ; String strEle = String . Join ( " " , arr [ i ] ) ; for ( int idx = 0 ; idx < strEle . Length ; idx ++ ) { String strEle2 = strEle . Substring ( idx ) + strEle . Substring ( 0 , idx ) ; int temp = Int32 . Parse ( strEle2 ) ; if ( temp >= prev && temp < optEle ) optEle = temp ; } arr [ i ] = optEle ; prev = arr [ i ] ; } if ( isIncreasing ( arr ) ) return arr ; else { return new int [ ] { - 1 } ; } } public static void Main ( String [ ] args ) { int [ ] arr = { 511 , 321 , 323 , 432 , 433 } ; int [ ] res = sortArr ( arr ) ; for ( int i = 0 ; i < res . Length ; i ++ ) Console . Write ( res [ i ] + " ▁ " ) ; } }

Index/key variables: i
Accumulator variables: i, idx
Iterator variables: i, idx
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void maxSum ( int [ ] arr , int [ ] brr , int N , int K ) { List < int > crr = new List < int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { crr . Add ( arr [ i ] ) ; } for ( int i = 0 ; i < K ; i ++ ) { crr . Add ( brr [ i ] ) ; } crr . Sort ( ) ; crr . Reverse ( ) ; int sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( crr [ i ] > 0 ) { sum += crr [ i ] ; } else { break ; } } Console . WriteLine ( sum ) ; } static void Main ( ) { int [ ] arr = { 7 , 2 , - 1 , 4 , 5 } ; int N = arr . Length ; int [ ] brr = { 1 , 2 , 3 , 2 } ; int K = brr . Length ; maxSum ( arr , brr , N , K ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void countPairs ( int [ ] A , int N ) { int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = i + 1 ; j < N ; j ++ ) { int xo = ( A [ i ] ^ A [ j ] ) ; int mx = Math . Max ( A [ i ] , A [ j ] ) ; if ( xo > mx ) { count ++ ; } } } Console . WriteLine ( count ) ; } public static void Main ( ) { int [ ] arr = { 2 , 4 , 3 } ; int N = arr . Length ; countPairs ( arr , N ) ; } }

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void findTheOrder ( int [ ] arr , string s , int N ) { List < int > ans = new List < int > ( ) ; Tuple < int , int > [ ] A = new Tuple < int , int > [ N ] ; for ( int i = 0 ; i < N ; i ++ ) A [ i ] = new Tuple < int , int > ( arr [ i ] , i + 1 ) ; Array . Sort ( A ) ; List < Tuple < int , int > > q = new List < Tuple < int , int > > ( ) ; int index = 0 ; for ( int i = 0 ; i < 2 * N ; i ++ ) { if ( s [ i ] == '0' ) { ans . Add ( A [ index ] . Item2 ) ; q . Add ( A [ index ] ) ; q . Sort ( ) ; q . Reverse ( ) ; index ++ ; } else { ans . Add ( q [ 0 ] . Item2 ) ; q . RemoveAt ( 0 ) ; } } foreach ( int i in ans ) { Console . Write ( i + " ▁ " ) ; } } static void Main ( ) { int N = 3 ; int [ ] arr = { 2 , 1 , 3 } ; string s = "001011" ; findTheOrder ( arr , s , N ) ; } }

Index/key variables: N, i, index
Accumulator variables: i, index
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void evenOddDiff ( int [ ] a , int n , int k ) { int j = - 1 ; List < int > even = new List < int > ( ) ; List < int > odd = new List < int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] % 2 == 0 ) { even . Add ( a [ i ] ) ; } else odd . Add ( a [ i ] ) ; } j ++ ; even . Sort ( ) ; even . Reverse ( ) ; odd . Sort ( ) ; odd . Reverse ( ) ; int evenSum = 0 , oddSum = 0 ; for ( int i = 0 ; i < k ; i ++ ) { evenSum += even [ i ] ; } for ( int i = 0 ; i < k ; i ++ ) { oddSum += odd [ i ] ; } Console . Write ( Math . Abs ( evenSum - oddSum ) ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 8 , 3 , 4 , 5 } ; int N = arr . Length ; int K = 2 ; evenOddDiff ( arr , N , K ) ; } }

Index/key variables: i
Accumulator variables: evenSum, i, j, oddSum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void printArr ( int [ ] arr , int N ) { for ( int i = 0 ; i < N ; i ++ ) { Console . Write ( arr [ i ] + " ▁ " ) ; } } static void rearrangeArr ( int [ ] arr , int N ) { int totalSum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { totalSum += arr [ i ] ; } if ( totalSum == 0 ) { Console . Write ( " - 1" + " STRNEWLINE " ) ; } else if ( totalSum > 0 ) { Array . Sort ( arr ) ; arr = reverse ( arr ) ; printArr ( arr , N ) ; } else { Array . Sort ( arr ) ; printArr ( arr , N ) ; } } static int [ ] reverse ( int [ ] a ) { int i , n = a . Length , t ; for ( i = 0 ; i < n / 2 ; i ++ ) { t = a [ i ] ; a [ i ] = a [ n - i - 1 ] ; a [ n - i - 1 ] = t ; } return a ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , - 1 , - 2 , 3 } ; int N = arr . Length ; rearrangeArr ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i, totalSum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections ; class GFG { static int MOD = 1000000007 ; static int solve ( ArrayList values , ArrayList salary ) { int ret = 1 ; int amt = 0 ; values . Sort ( ) ; salary . Sort ( ) ; while ( salary . Count > 0 ) { while ( values . Count > 0 && ( int ) values [ values . Count - 1 ] >= ( int ) salary [ salary . Count - 1 ] ) { amt ++ ; values . RemoveAt ( values . Count - 1 ) ; } if ( amt == 0 ) return 0 ; ret *= amt -- ; ret %= MOD ; salary . RemoveAt ( salary . Count - 1 ) ; } return ret ; } public static void Main ( string [ ] args ) { ArrayList values = new ArrayList ( ) ; values . Add ( 1 ) ; values . Add ( 2 ) ; ArrayList salary = new ArrayList ( ) ; salary . Add ( 2 ) ; Console . Write ( solve ( values , salary ) ) ; } }

Accumulator variables: amt, ret
Class/struct names: GFG
C# program:
using System ; class GFG { static int countPairs ( int [ ] arr , int n ) { int ans = 0 ; Array . Sort ( arr ) ; int left = 0 , right = 1 ; while ( right < n ) { if ( arr [ left ] == arr [ right ] ) ans += right - left ; else left = right ; right ++ ; } return ans ; } public static void Main ( String [ ] args ) { int [ ] arr = { 2 , 2 , 3 , 2 , 3 } ; int N = arr . Length ; Console . Write ( countPairs ( arr , N ) ) ; } }

Index/key variables: left, right
Accumulator variables: ans, right
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { public static int sortString ( string S ) { List < int > sorted = new List < int > ( ) ; List < int > original = new List < int > ( ) ; bool insert = false ; if ( S . Length == 1 ) { Console . WriteLine ( 0 ) ; } int curr = 1 ; for ( int i = 0 ; i < ( S . Length - 1 ) ; i ++ ) { if ( S [ i ] == S [ i + 1 ] ) { curr += 1 ; insert = false ; } else { sorted . Add ( curr ) ; original . Add ( curr ) ; curr = 1 ; insert = true ; } } if ( ( S [ S . Length - 1 ] != S [ S . Length - 2 ] ) insert == false ) { sorted . Add ( curr ) ; original . Add ( curr ) ; } sorted . Sort ( ) ; int t_cost = 0 ; for ( int i = 0 ; i < sorted . Count ; i ++ ) { t_cost += Math . Abs ( sorted [ i ] - original [ i ] ) ; } return ( t_cost / 2 ) ; } static void Main ( ) { string S = " aabbcccdeffffggghhhhhii " ; Console . Write ( sortString ( S ) ) ; } }

Index/key variables: i
Accumulator variables: curr, i, t_cost
Iterator variables: i
Boolean variables: insert
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { class node { public int val ; public node right , left ; } ; static node newnode ( int key ) { node temp = new node ( ) ; temp . val = key ; temp . right = null ; temp . left = null ; return temp ; } static void func ( node root ) { Queue < node > q = new Queue < node > ( ) ; bool t = true ; q . Enqueue ( root ) ; int i = - 1 , j = - 1 ; while ( q . Count != 0 ) { int h = q . Count ; while ( h > 0 ) { root = q . Peek ( ) ; if ( i == - 1 ) { j = root . val ; } if ( i == - 2 ) { if ( j <= root . val ) { j = root . val ; i = - 3 ; } else { t = false ; break ; } } if ( root . left != null ) { q . Enqueue ( root . left ) ; } if ( root . right != null ) { q . Enqueue ( root . right ) ; } h = h - 1 ; q . Dequeue ( ) ; } i = - 2 ; if ( t == false ) { break ; } } if ( t ) Console . Write ( " true " + " STRNEWLINE " ) ; else Console . Write ( " false " + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { node root = newnode ( 10 ) ; root . right = newnode ( 50 ) ; root . right . right = newnode ( 15 ) ; root . left = newnode ( 20 ) ; root . left . left = newnode ( 50 ) ; root . left . right = newnode ( 23 ) ; root . right . left = newnode ( 10 ) ; func ( root ) ; } }

Boolean variables: t
Class/struct names: GFG, node
C# program:
using System ; class GFG { static int calculate_minimum_split ( int n , int [ ] a , int k ) { int [ ] p = new int [ n - 1 ] ; for ( int i = 1 ; i < n ; i ++ ) p [ i - 1 ] = a [ i ] - a [ i - 1 ] ; Array . Sort ( p ) ; Array . Reverse ( p ) ; int min_sum = 0 ; for ( int i = 0 ; i < k - 1 ; i ++ ) min_sum += p [ i ] ; int res = a [ n - 1 ] - a [ 0 ] - min_sum ; return res ; } static void Main ( ) { int [ ] arr = { 4 , 8 , 15 , 16 , 23 , 42 } ; int k = 3 ; int n = arr . Length ; Console . Write ( calculate_minimum_split ( n , arr , k ) ) ; } }

Index/key variables: i
Accumulator variables: i, min_sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; using System . Linq ; class GFG { static int myCompare ( string date1 , string date2 ) { string day1 = date1 . Substring ( 0 , 2 ) ; string month1 = date1 . Substring ( 3 , 2 ) ; string year1 = date1 . Substring ( 6 , 4 ) ; string day2 = date2 . Substring ( 0 , 2 ) ; string month2 = date2 . Substring ( 3 , 2 ) ; string year2 = date2 . Substring ( 6 , 4 ) ; return string . Compare ( year1 , year2 ) ; return string . Compare ( month1 , month2 ) ; return string . Compare ( day1 , day2 ) ; } static void printDatesAscending ( List < string > arr ) { arr . Sort ( myCompare ) ; for ( int i = 0 ; i < arr . Count ; i ++ ) Console . WriteLine ( arr [ i ] ) ; } static public void Main ( ) { List < string > arr = new List < string > ( ) ; arr . Add ( "25-08-1996" ) ; arr . Add ( "03-08-1970" ) ; arr . Add ( "09-04-1994" ) ; arr . Add ( "29-08-1996" ) ; arr . Add ( "14-02-1972" ) ; printDatesAscending ( arr ) ; } }

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 bool isVowel ( char ch ) { ch = char . ToUpper ( ch ) ; return ( ch == ' A ' ch == ' E ' ch == ' I ' ch == ' O ' ch == ' U ' ) ; } static int countVowels ( string str ) { int count = 0 ; for ( int i = 0 ; i < str . Length ; i ++ ) ++ count ; return count ; } static void sortArr ( string [ ] arr , int n ) { List < Tuple < int , string > > vp = new List < Tuple < int , string > > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { vp . Add ( new Tuple < int , string > ( countVowels ( arr [ i ] ) , arr [ i ] ) ) ; } vp . Sort ( ) ; for ( int i = 0 ; i < vp . Count ; i ++ ) Console . Write ( vp [ i ] . Item2 + " ▁ " ) ; } static void Main ( ) { string [ ] arr = { " lmno " , " pqrst " , " aeiou " , " xyz " } ; int n = arr . Length ; sortArr ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static long minimumCost ( long [ ] price , int n ) { Array . Sort ( price ) ; long totalCost = 0 ; for ( int i = n - 1 ; i > 1 ; i -= 2 ) { if ( i == 2 ) { totalCost += price [ 2 ] + price [ 0 ] ; } else { long price_first = price [ i ] + price [ 0 ] + 2 * price [ 1 ] ; long price_second = price [ i ] + price [ i - 1 ] + 2 * price [ 0 ] ; totalCost += Math . Min ( price_first , price_second ) ; } } if ( n == 1 ) { totalCost += price [ 0 ] ; } else { totalCost += price [ 1 ] ; } return totalCost ; } public static void Main ( ) { long [ ] price = { 30 , 40 , 60 , 70 } ; int n = price . Length ; Console . WriteLine ( minimumCost ( price , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, totalCost
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int N = 100 ; static int [ , ] dp = new int [ N , N ] ; static int [ , ] vis = new int [ N , N ] ; static int findSum ( int [ ] arr , int n , int k , int l , int r ) { if ( ( l ) + ( n - 1 - r ) == k ) return arr [ r ] - arr [ l ] ; if ( vis [ l , r ] == 1 ) return dp [ l , r ] ; vis [ l , r ] = 1 ; dp [ l , r ] = Math . Min ( findSum ( arr , n , k , l , r - 1 ) , findSum ( arr , n , k , l + 1 , r ) ) ; return dp [ l , r ] ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 100 , 120 , 140 } ; int k = 2 ; int n = arr . Length ; Console . WriteLine ( findSum ( arr , n , k , 0 , n - 1 ) ) ; } }

Index/key variables: l, r
Class/struct names: GFG
C# program:
using System ; class GFG { static int getNumber ( int n , int k ) { int pos ; if ( ( n % 2 ) == 0 ) { pos = n / 2 ; } else { pos = ( n / 2 ) + 1 ; } if ( k <= pos ) { return ( k * 2 - 1 ) ; } else return ( ( k - pos ) * 2 ) ; } static public void Main ( ) { int n = 8 , k = 5 ; Console . Write ( getNumber ( n , k ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void unique_combination ( int l , int sum , int K , List < int > local , List < int > A ) { if ( sum == K ) { Console . Write ( " { " ) ; for ( int i = 0 ; i < local . Count ; i ++ ) { if ( i != 0 ) Console . Write ( " ▁ " ) ; Console . Write ( local [ i ] ) ; if ( i != local . Count - 1 ) Console . Write ( " , ▁ " ) ; } Console . WriteLine ( " } " ) ; return ; } for ( int i = l ; i < A . Count ; i ++ ) { if ( sum + A [ i ] > K ) continue ; if ( i > l && A [ i ] == A [ i - 1 ] ) continue ; local . Add ( A [ i ] ) ; unique_combination ( i + 1 , sum + A [ i ] , K , local , A ) ; local . RemoveAt ( local . Count - 1 ) ; } } static void Combination ( List < int > A , int K ) { A . Sort ( ) ; List < int > local = new List < int > ( ) ; unique_combination ( 0 , 0 , K , local , A ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 10 , 1 , 2 , 7 , 6 , 1 , 5 } ; List < int > A = new List < int > ( arr ) ; int K = 8 ; Combination ( A , K ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections ; using System . Collections . Generic ; class GFG { static int solution ( ArrayList arr , int x ) { int closestSum = int . MaxValue ; for ( int i = 0 ; i < arr . Count ; i ++ ) { for ( int j = i + 1 ; j < arr . Count ; j ++ ) { for ( int k = j + 1 ; k < arr . Count ; k ++ ) { if ( Math . Abs ( x - closestSum ) > Math . Abs ( x - ( ( int ) arr [ i ] + ( int ) arr [ j ] + ( int ) arr [ k ] ) ) ) { closestSum = ( ( int ) arr [ i ] + ( int ) arr [ j ] + ( int ) arr [ k ] ) ; } } } } return closestSum ; } public static void Main ( string [ ] args ) { ArrayList arr = new ArrayList ( ) { - 1 , 2 , 1 , - 4 } ; int x = 1 ; Console . Write ( solution ( arr , x ) ) ; } }

Index/key variables: i, j, k
Accumulator variables: i, j, k
Iterator variables: i, j, k
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void addEdge ( List < List < int > > adj , int u , int v ) { adj [ u ] . Add ( v ) ; } static void getindeg ( List < List < int > > adj , int V , List < int > indeg ) { for ( int i = 0 ; i < V ; i ++ ) { foreach ( int x in adj [ i ] ) { indeg [ x ] ++ ; } } } static List < int > topo ( List < List < int > > adj , int V , List < int > indeg ) { Queue < int > q = new Queue < int > ( ) ; for ( int i = 0 ; i < V ; i ++ ) { if ( indeg [ i ] == 0 ) { q . Enqueue ( i ) ; } } List < int > res = new List < int > ( ) ; while ( q . Count > 0 ) { int u = q . Dequeue ( ) ; res . Add ( u ) ; foreach ( int x in adj [ u ] ) { indeg [ x ] -- ; if ( indeg [ x ] == 0 ) { q . Enqueue ( x ) ; } } } return res ; } static List < int > makearray ( List < List < int > > v , int V ) { List < List < int > > adj = new List < List < int > > ( ) ; for ( int i = 0 ; i < V ; i ++ ) { adj . Add ( new List < int > ( ) ) ; } for ( int i = 0 ; i < v . Count ; i ++ ) { for ( int j = 0 ; j < v [ i ] . Count - 1 ; j ++ ) { addEdge ( adj , v [ i ] [ j ] , v [ i ] [ j + 1 ] ) ; } } List < int > indeg = new List < int > ( ) ; for ( int i = 0 ; i < V ; i ++ ) { indeg . Add ( 0 ) ; } getindeg ( adj , V , indeg ) ; List < int > res = topo ( adj , V , indeg ) ; return res ; } static public void Main ( ) { int n = 10 ; List < List < int > > subseqs = new List < List < int > > ( ) ; subseqs . Add ( new List < int > ( ) { 9 , 1 , 2 , 8 , 3 } ) ; subseqs . Add ( new List < int > ( ) { 6 , 1 , 2 } ) ; subseqs . Add ( new List < int > ( ) { 9 , 6 , 3 , 4 } ) ; subseqs . Add ( new List < int > ( ) { 5 , 2 , 7 } ) ; subseqs . Add ( new List < int > ( ) { 0 , 9 , 5 , 4 } ) ; List < int > res = makearray ( subseqs , n ) ; foreach ( int x in res ) { Console . Write ( x + " ▁ " ) ; } } }

Index/key variables: i, j, u, x
Accumulator variables: i, j
Iterator variables: i, j, x
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static List < long > pr = new List < long > ( ) ; static bool [ ] prime = new bool [ 10000000 + 1 ] ; static void sieve ( long n ) { for ( int i = 2 ; i <= n ; i += 1 ) { prime [ i ] = true ; } for ( int p = 2 ; ( int ) p * ( int ) p <= n ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = ( int ) p * ( int ) p ; i <= n ; i += p ) prime [ i ] = false ; } } for ( int p = 2 ; p <= n ; p ++ ) if ( prime [ p ] ) pr . Add ( ( long ) p ) ; } static long SemiPrimeSum ( long N ) { long ans = 0 ; for ( int i = 0 ; i < pr . Count ; i += 1 ) { for ( int j = i ; j < pr . Count ; j += 1 ) { if ( ( long ) pr [ i ] * ( long ) pr [ j ] > N ) break ; ans += ( long ) pr [ i ] * ( long ) pr [ j ] ; } } return ans ; } public static void Main ( String [ ] args ) { long N = 6 ; sieve ( N ) ; Console . WriteLine ( SemiPrimeSum ( N ) ) ; } }

Index/key variables: i, j, p
Accumulator variables: ans, i, j, p
Iterator variables: i, j, p
Class/struct names: GFG
C# program:
using System ; class GFG { static void compressArr ( int [ ] arr , int n ) { int i = 0 , j = 0 ; Array . Sort ( arr ) ; while ( i < n ) { j = i ; while ( ( j + 1 < n ) && ( arr [ j + 1 ] == arr [ j ] + 1 ) ) { j ++ ; } if ( i == j ) { Console . Write ( arr [ i ] + " ▁ " ) ; i ++ ; } else { Console . Write ( arr [ i ] + " - " + arr [ j ] + " ▁ " ) ; i = j + 1 ; } } } public static void Main ( ) { int n = 7 ; int [ ] arr = { 1 , 3 , 4 , 5 , 6 , 9 , 10 } ; compressArr ( arr , n ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void removeElements ( int [ ] arr , int n ) { int [ ] brr = new int [ n ] ; int l = 1 ; brr [ 0 ] = arr [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { if ( brr [ l - 1 ] <= arr [ i ] ) { brr [ l ] = arr [ i ] ; l ++ ; } } for ( int i = 0 ; i < l ; i ++ ) Console . Write ( brr [ i ] + " ▁ " ) ; } static public void Main ( ) { int [ ] arr = { 10 , 12 , 9 , 10 , 2 , 13 , 14 } ; int n = arr . Length ; removeElements ( arr , n ) ; } }

Index/key variables: i, l, n
Accumulator variables: i, l
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static void removeElements ( int [ ] arr , int n ) { int l = 1 ; for ( int i = 1 ; i < n ; i ++ ) { if ( arr [ l - 1 ] <= arr [ i ] ) { arr [ l ] = arr [ i ] ; l ++ ; } } for ( int i = 0 ; i < l ; i ++ ) Console . Write ( arr [ i ] + " ▁ " ) ; } public static void Main ( string [ ] args ) { int [ ] arr = { 10 , 12 , 9 , 10 , 2 , 13 , 14 } ; int n = arr . Length ; removeElements ( arr , n ) ; } }

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