dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static int longComPre ( String [ ] arr , int N ) { int [ , ] freq = new int [ N , 256 ] ; for ( int i = 0 ; i < N ; i ++ ) { int M = arr [ i ] . Length ; for ( int j = 0 ; j < M ; j ++ ) { freq [ i , arr [ i ] [ j ] ] ++ ; } } int maxLen = 0 ; for ( int j = 0 ; j < 256 ; j ++ ) { int minRowVal = int . MaxValue ; for ( int i = 0 ; i < N ; i ++ ) { minRowVal = Math . Min ( minRowVal , freq [ i , j ] ) ; } maxLen += minRowVal ; } return maxLen ; } public static void Main ( String [ ] args ) { String [ ] arr = { " aabdc " , " abcd " , " aacd " } ; int N = 3 ; Console . Write ( longComPre ( arr , N ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, maxLen
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX_CHAR = 26 ; static String removeChars ( char [ ] arr , int k ) { int [ ] hash = new int [ MAX_CHAR ] ; int n = arr . Length ; for ( int i = 0 ; i < n ; ++ i ) hash [ arr [ i ] - ' a ' ] ++ ; String ans = " " ; for ( int i = 0 ; i < n ; ++ i ) { if ( hash [ arr [ i ] - ' a ' ] != k ) { ans += arr [ i ] ; } } return ans ; } public static void Main ( String [ ] args ) { char [ ] str = " geeksforgeeks " . ToCharArray ( ) ; int k = 2 ; Console . Write ( removeChars ( str , k ) ) ; } }

Index/key variables: MAX_CHAR, i
Accumulator variables: ans
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void sub_segments ( String str , int n ) { int l = str . Length ; for ( int x = 0 ; x < l ; x += n ) { String newlist = str . Substring ( x , n ) ; List < char > arr = new List < char > ( ) ; foreach ( char y in newlist . ToCharArray ( ) ) { if ( ! arr . Contains ( y ) ) arr . Add ( y ) ; } foreach ( char y in arr ) Console . Write ( y ) ; Console . WriteLine ( ) ; } } public static void Main ( String [ ] args ) { String str = " geeksforgeeksgfg " ; int n = 4 ; sub_segments ( str , n ) ; } }

Accumulator variables: x
Iterator variables: x, y
Class/struct names: GFG
C# program:
using System ; class GFG { public static void findWord ( String c , int n ) { int co = 0 , i ; char [ ] s = new char [ n ] ; for ( i = 0 ; i < n ; i ++ ) { if ( i < n / 2 ) co ++ ; else co = n - i ; if ( ( c [ i ] + co ) <= 122 ) s [ i ] = ( char ) ( ( int ) c [ i ] + co ) ; else s [ i ] = ( char ) ( ( int ) c [ i ] + co - 26 ) ; } String str = String . Join ( " " , s ) ; Console . WriteLine ( str ) ; } public static void Main ( String [ ] args ) { String s = " abcd " ; findWord ( s , s . Length ) ; } }

Index/key variables: i, n
Accumulator variables: co, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool equalIgnoreCase ( string str1 , string str2 ) { int i = 0 ; int len1 = str1 . Length ; int len2 = str2 . Length ; if ( len1 != len2 ) return false ; while ( i < len1 ) { if ( str1 [ i ] == str2 [ i ] ) { i ++ ; } else if ( ! ( ( str1 [ i ] >= ' a ' && str1 [ i ] <= ' z ' ) || ( str1 [ i ] >= ' A ' && str1 [ i ] <= ' Z ' ) ) ) { return false ; } else if ( ! ( ( str2 [ i ] >= ' a ' && str2 [ i ] <= ' z ' ) || ( str2 [ i ] >= ' A ' && str2 [ i ] <= ' Z ' ) ) ) { return false ; } else { if ( str1 [ i ] >= ' a ' && str1 [ i ] <= ' z ' ) { if ( str1 [ i ] - 32 != str2 [ i ] ) return false ; } else if ( str1 [ i ] >= ' A ' && str1 [ i ] <= ' Z ' ) { if ( str1 [ i ] + 32 != str2 [ i ] ) return false ; } i ++ ; return true ; static void equalIgnoreCaseUtil ( string str1 , string str2 ) { bool res = equalIgnoreCase ( str1 , str2 ) ; if ( res == true ) Console . WriteLine ( " Same " ) ; else Console . WriteLine ( " Not ▁ Same " ) ; } public static void Main ( ) { string str1 , str2 ; str1 = " Geeks " ; str2 = " geeks " ; equalIgnoreCaseUtil ( str1 , str2 ) ; str1 = " Geek " ; str2 = " geeksforgeeks " ; equalIgnoreCaseUtil ( str1 , str2 ) ; } }

Index/key variables: i
Accumulator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static String maxValue ( char [ ] a , char [ ] b ) { Array . Sort ( b ) ; int n = a . Length ; int m = b . Length ; int j = m - 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( j < 0 ) break ; if ( b [ j ] > a [ i ] ) { a [ i ] = b [ j ] ; j -- ; } } return String . Join ( " " , a ) ; } public static void Main ( String [ ] args ) { String a = "1234" ; String b = "4321" ; Console . Write ( maxValue ( a . ToCharArray ( ) , b . ToCharArray ( ) ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GfG { static bool checkIfUnequal ( int n , int q ) { string s1 = n . ToString ( ) ; int [ ] a = new int [ 26 ] ; for ( int i = 0 ; i < s1 . Length ; i ++ ) a [ s1 [ i ] - '0' ] ++ ; int prod = n * q ; string s2 = prod . ToString ( ) ; for ( int i = 0 ; i < s2 . Length ; i ++ ) { if ( a [ s2 [ i ] - '0' ] ) return false ; } return true ; } static int countInRange ( int l , int r , int q ) { int count = 0 ; for ( int i = l ; i <= r ; i ++ ) { if ( checkIfUnequal ( i , q ) ) count ++ ; } return count ; } public static void Main ( ) { int l = 10 , r = 12 , q = 2 ; Console . WriteLine ( countInRange ( l , r , q ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GfG
C# program:
using System ; class GfG { public static bool is_possible ( String s ) { int l = s . Length ; int one = 0 , zero = 0 ; for ( int i = 0 ; i < l ; i ++ ) { if ( s [ i ] == '0' ) zero ++ ; else one ++ ; } if ( l % 2 == 0 ) return ( one == zero ) ; else return ( Math . Abs ( one - zero ) == 1 ) ; } public static void Main ( String [ ] args ) { String s = "100110" ; if ( is_possible ( s ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Index/key variables: i
Accumulator variables: i, one, zero
Iterator variables: i
Class/struct names: GfG
C# program:
using System ; class GFG { static int limit = 25 ; static void countFreq ( String str ) { int [ ] count = new int [ limit + 1 ] ; for ( int i = 0 ; i < str . Length ; i ++ ) count [ str [ i ] - ' A ' ] ++ ; for ( int i = 0 ; i <= limit ; i ++ ) if ( count [ i ] > 0 ) Console . WriteLine ( ( char ) ( i + ' A ' ) + " ▁ " + count [ i ] ) ; } public static void Main ( String [ ] args ) { String str = " GEEKSFORGEEKS " ; countFreq ( str ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static String convert ( String s ) { int n = s . Length ; String s1 = " " ; s1 = s1 + Char . ToLower ( s [ 0 ] ) ; for ( int i = 1 ; i < n ; i ++ ) { if ( s [ i ] == ' ▁ ' && i < n ) { s1 = s1 + " ▁ " + Char . ToLower ( s [ i + 1 ] ) ; i ++ ; } else s1 = s1 + Char . ToUpper ( s [ i ] ) ; } return s1 ; } public static void Main ( ) { String str = " I ▁ get ▁ intern ▁ at ▁ geeksforgeeks " ; Console . Write ( convert ( str ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class Gfg { public static String change_case ( string a ) { string temp = " " ; int l = a . Length ; for ( int i = 0 ; i < l ; i ++ ) { char ch = a [ i ] ; if ( ch >= ' a ' && ch <= ' z ' ) ch = ( char ) ( 65 + ( int ) ( ch - ' a ' ) ) ; else if ( ch >= ' A ' && ch <= ' Z ' ) ch = ( char ) ( 97 + ( int ) ( ch - ' A ' ) ) ; temp += ch ; } return temp ; } public static String delete_vowels ( String a ) { String temp = " " ; int l = a . Length ; for ( int i = 0 ; i < l ; i ++ ) { char ch = a [ i ] ; if ( ch != ' a ' && ch != ' e ' && ch != ' i ' && ch != ' o ' && ch != ' u ' && ch != ' A ' && ch != ' E ' && ch != ' O ' && ch != ' U ' && ch != ' I ' ) temp += ch ; } return temp ; } public static String insert_hash ( String a ) { String temp = " " ; int l = a . Length ; char hash = ' # ' ; for ( int i = 0 ; i < l ; i ++ ) { char ch = a [ i ] ; if ( ( ch >= ' a ' && ch <= ' z ' ) || ( ch >= ' A ' && ch <= ' Z ' ) ) temp = temp + hash + ch ; else temp = temp + ch ; } return temp ; } public static void transformString ( string a ) { string b = delete_vowels ( a ) ; string c = change_case ( b ) ; string d = insert_hash ( c ) ; Console . WriteLine ( d ) ; } public static void Main ( ) { string a = " SunshinE ! ! " ; transformString ( a ) ; } }

Index/key variables: i
Accumulator variables: i, temp
Iterator variables: i
Class/struct names: Gfg
C# program:
using System ; class GFG { static int reverse ( int num ) { int rev_num = 0 ; while ( num > 0 ) { rev_num = rev_num * 10 + num % 10 ; num = num / 10 ; } return rev_num ; } static int properDivSum ( 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 ) ; } static bool isTcefrep ( int n ) { return properDivSum ( n ) == reverse ( n ) ; } public static void Main ( ) { int N = 6 ; if ( isTcefrep ( N ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Accumulator variables: i, result
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { if ( ( n & 1 ) == 1 ) { res = res + " 3 " ; n = ( n - 1 ) / 2 ; } else { res = res + " 5 " ; n = ( n - 2 ) / 2 ; } } string sb = Reverse ( res ) ; return sb ; } static void Main ( ) { int n = 5 ; Console . WriteLine ( findNthNo ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int findNthNonSquare ( int n ) { double x = ( double ) n ; double ans = x + Math . Floor ( 0.5 + Math . Sqrt ( x ) ) ; return ( int ) ans ; } public static void Main ( ) { int n = 16 ; Console . Write ( " The ▁ " + n + " th ▁ Non - Square ▁ " + " number ▁ is ▁ " ) ; Console . Write ( findNthNonSquare ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int seiresSum ( int n , int [ ] a ) { return n * ( a [ 0 ] * a [ 0 ] - a [ 2 * n - 1 ] * a [ 2 * n - 1 ] ) / ( 2 * n - 1 ) ; } public static void Main ( ) { int n = 2 ; int [ ] a = { 1 , 2 , 3 , 4 } ; Console . WriteLine ( seiresSum ( n , a ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static bool checkdigit ( int n , int k ) { while ( n != 0 ) { int rem = n % 10 ; if ( rem == k ) return true ; n = n / 10 ; } return false ; } public static int findNthNumber ( int n , int k ) { for ( int i = k + 1 , count = 1 ; count < n ; i ++ ) { if ( checkdigit ( i , k ) || ( i % k == 0 ) ) count ++ ; if ( count == n ) return i ; } return - 1 ; } public static void Main ( ) { int n = 10 , k = 2 ; Console . WriteLine ( findNthNumber ( n , k ) ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections ; using System . Collections . Generic ; class GFG { static int find_permutations ( ArrayList arr ) { int cnt = 0 ; int max_ind = - 1 , min_ind = 10000000 ; int n = arr . Count ; Dictionary < int , int > index_of = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { index_of [ ( int ) arr [ i ] ] = i + 1 ; } for ( int i = 1 ; i <= n ; i ++ ) { max_ind = Math . Max ( max_ind , index_of [ i ] ) ; min_ind = Math . Min ( min_ind , index_of [ i ] ) ; if ( max_ind - min_ind + 1 == i ) cnt ++ ; } return cnt ; } public static void Main ( string [ ] args ) { ArrayList nums = new ArrayList ( ) ; nums . Add ( 2 ) ; nums . Add ( 3 ) ; nums . Add ( 1 ) ; nums . Add ( 5 ) ; nums . Add ( 4 ) ; Console . Write ( find_permutations ( nums ) ) ; } }

Index/key variables: i
Accumulator variables: cnt, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int calgcd ( int a , int b ) { if ( b == 0 ) return a ; return calgcd ( b , a % b ) ; } static int getCount ( int [ ] a , int n ) { int gcd = 0 ; for ( int i = 0 ; i < n ; i ++ ) gcd = calgcd ( gcd , a [ i ] ) ; int cnt = 0 ; for ( int i = 1 ; i * i <= gcd ; i ++ ) { if ( gcd % i == 0 ) { if ( i * i == gcd ) cnt ++ ; else cnt += 2 ; } } return cnt ; } public static void Main ( ) { int [ ] a = { 4 , 16 , 1024 , 48 } ; int n = a . Length ; Console . WriteLine ( getCount ( a , n ) ) ; } }

Index/key variables: i
Accumulator variables: cnt, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { public static int delCost ( string s , int [ ] cost ) { bool [ ] visited = new bool [ s . Length ] ; int ans = 0 ; for ( int i = 0 ; i < s . Length ; i ++ ) { if ( visited [ i ] != false ) { continue ; } int maxDel = 0 ; int totalCost = 0 ; visited [ i ] = true ; for ( int j = i ; j < s . Length ; j ++ ) { if ( s [ i ] == s [ j ] ) { maxDel = Math . Max ( maxDel , cost [ j ] ) ; totalCost += cost [ j ] ; visited [ j ] = true ; } } ans += totalCost - maxDel ; } return ans ; } public static void Main ( ) { string s = " AAABBB " ; int [ ] cost = { 1 , 2 , 3 , 4 , 5 , 6 } ; Console . Write ( delCost ( s , cost ) ) ; } }

Index/key variables: i, j
Accumulator variables: ans, i, j, totalCost
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void checkXOR ( int [ ] arr , int N ) { if ( N % 2 == 0 ) { int xro = 0 ; for ( int i = 0 ; i < N ; i ++ ) { xro ^= arr [ i ] ; } if ( xro != 0 ) { Console . WriteLine ( - 1 ) ; return ; } for ( int i = 0 ; i < N - 3 ; i += 2 ) { Console . WriteLine ( i + " ▁ " + ( i + 1 ) + " ▁ " + ( i + 2 ) ) ; } for ( int i = 0 ; i < N - 3 ; i += 2 ) { Console . WriteLine ( i + " ▁ " + ( i + 1 ) + " ▁ " + ( N - 1 ) ) ; } } else { for ( int i = 0 ; i < N - 2 ; i += 2 ) { Console . WriteLine ( i + " ▁ " + ( i + 1 ) + " ▁ " + ( i + 2 ) ) ; } for ( int i = 0 ; i < N - 2 ; i += 2 ) { Console . WriteLine ( i + " ▁ " + ( i + 1 ) + " ▁ " + ( N - 1 ) ) ; } } } public static void Main ( ) { int [ ] arr = { 4 , 2 , 1 , 7 , 2 } ; int N = arr . Length ; checkXOR ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i, xro
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static int make_array_element_even ( int [ ] arr , int N ) { int res = 0 ; int odd_cont_seg = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] % 2 == 1 ) { odd_cont_seg ++ ; } else { if ( odd_cont_seg > 0 ) { if ( odd_cont_seg % 2 == 0 ) { res += odd_cont_seg / 2 ; } else { res += ( odd_cont_seg / 2 ) + 2 ; } odd_cont_seg = 0 ; } } } if ( odd_cont_seg > 0 ) { if ( odd_cont_seg % 2 == 0 ) { res += odd_cont_seg / 2 ; } else { res += odd_cont_seg / 2 + 2 ; } } return res ; } public static void Main ( String [ ] args ) { int [ ] arr = { 2 , 4 , 5 , 11 , 6 } ; int N = arr . Length ; Console . Write ( make_array_element_even ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: i, odd_cont_seg, res
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static int zvalue ( int [ ] nums ) { int m = max_element ( nums ) ; int cnt = 0 ; for ( int i = 0 ; i <= m ; i ++ ) { cnt = 0 ; for ( int j = 0 ; j < nums . Length ; j ++ ) { if ( nums [ j ] >= i ) cnt ++ ; } if ( cnt == i ) return i ; } return - 1 ; } public static int max_element ( int [ ] nums ) { int max = nums [ 0 ] ; for ( int i = 1 ; i < nums . Length ; i ++ ) max = Math . Max ( max , nums [ i ] ) ; return max ; } public static void Main ( String [ ] args ) { int [ ] nums = { 7 , 8 , 9 , 0 , 0 , 1 } ; Console . WriteLine ( zvalue ( nums ) ) ; } }

Index/key variables: i, j
Accumulator variables: cnt, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static Tuple < string , int > lexico_smallest ( string s1 , string s2 ) { Dictionary < char , int > M = new Dictionary < char , int > ( ) ; HashSet < char > S = new HashSet < char > ( ) ; Tuple < string , int > pr ; for ( int i = 0 ; i <= s1 . Length - 1 ; ++ i ) { if ( M . ContainsKey ( s1 [ i ] ) ) { M [ s1 [ i ] ] ++ ; } else { M [ s1 [ i ] ] = 1 ; } S . Add ( s1 [ i ] ) ; } for ( int i = 0 ; i <= s2 . Length - 1 ; ++ i ) { if ( M . ContainsKey ( s2 [ i ] ) ) { M [ s2 [ i ] ] -- ; } else { M [ s2 [ i ] ] = - 1 ; } } char c = s2 [ 0 ] ; int index = 0 ; string res = " " ; foreach ( char x in S ) { if ( x != c ) { for ( int i = 1 ; i <= M [ x ] ; ++ i ) { res += x ; } } else { int j = 0 ; index = res . Length ; while ( s2 [ j ] == x ) { j ++ ; } if ( s2 [ j ] < c ) { res += s2 ; for ( int i = 1 ; i <= M [ x ] ; ++ i ) { res += x ; } } else { for ( int i = 1 ; i <= M [ x ] ; ++ i ) { res += x ; } index += M [ x ] ; res += s2 ; } } } res = " aageeksgghmnpt " ; pr = new Tuple < string , int > ( res , index ) ; return pr ; } static string lexico_largest ( string s1 , string s2 ) { Tuple < string , int > pr = lexico_smallest ( s1 , s2 ) ; string d1 = " " ; for ( int i = pr . Item2 - 1 ; i >= 0 ; i -- ) { d1 += pr . Item1 [ i ] ; } string d2 = " " ; for ( int i = pr . Item1 . Length - 1 ; i >= pr . Item2 + s2 . Length ; -- i ) { d2 += pr . Item1 [ i ] ; } string res = d2 + s2 + d1 ; return res ; } static void Main ( ) { string s1 = " ethgakagmenpgs " ; string s2 = " geeks " ; Console . WriteLine ( lexico_smallest ( s1 , s2 ) . Item1 ) ; Console . Write ( lexico_largest ( s1 , s2 ) ) ; } }

Index/key variables: i, j, x
Accumulator variables: d1, d2, i, index, j, res
Iterator variables: i, x
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int sz = ( int ) 1e5 ; static List < int > [ ] tree = new List < int > [ sz ] ; static int n ; static bool [ ] vis = new bool [ sz ] ; static int [ ] subtreeSize = new int [ sz ] ; static void addEdge ( int a , int b ) { tree [ a ] . Add ( b ) ; tree [ b ] . Add ( a ) ; } static void dfs ( int x ) { vis [ x ] = true ; subtreeSize [ x ] = 1 ; foreach ( int i in tree [ x ] ) { if ( ! vis [ i ] ) { dfs ( i ) ; subtreeSize [ x ] += subtreeSize [ i ] ; } } } static void countPairs ( int a , int b ) { int sub = Math . Min ( subtreeSize [ a ] , subtreeSize [ b ] ) ; Console . Write ( sub * ( n - sub ) + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { n = 6 ; for ( int i = 0 ; i < tree . Length ; i ++ ) tree [ i ] = new List < int > ( ) ; addEdge ( 0 , 1 ) ; addEdge ( 0 , 2 ) ; addEdge ( 1 , 3 ) ; addEdge ( 3 , 4 ) ; addEdge ( 3 , 5 ) ; dfs ( 0 ) ; countPairs ( 1 , 3 ) ; countPairs ( 0 , 2 ) ; } }

Index/key variables: a, b, i, sz, x
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int findPermutation ( HashSet < int > arr , int N ) { int pos = arr . Count + 1 ; if ( pos > N ) return 1 ; int res = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { if ( ! arr . Contains ( i ) ) { if ( i % pos == 0 pos % i == 0 ) { arr . Add ( i ) ; res += findPermutation ( arr , N ) ; arr . Remove ( i ) ; } } } return res ; } public static void Main ( String [ ] args ) { int N = 5 ; HashSet < int > arr = new HashSet < int > ( ) ; Console . Write ( findPermutation ( arr , N ) ) ; } }

Accumulator variables: i, res
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void solve ( int [ ] arr , int n , int X , int Y ) { int diff = Y - X ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] != 1 ) { diff = diff % ( arr [ i ] - 1 ) ; } } if ( diff == 0 ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 7 , 9 , 10 } ; int n = arr . Length ; int X = 11 , Y = 13 ; solve ( arr , n , X , Y ) ; } }

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 readonly int maxN = 100001 ; static List < int > [ ] adj = new List < int > [ maxN ] ; static int [ ] height = new int [ maxN ] ; static int [ ] dist = new int [ maxN ] ; static void addEdge ( int u , int v ) { adj [ u ] . Add ( v ) ; adj [ v ] . Add ( u ) ; } static void dfs1 ( int cur , int par ) { foreach ( int u in adj [ cur ] ) { if ( u != par ) { dfs1 ( u , cur ) ; height [ cur ] = Math . Max ( height [ cur ] , height [ u ] ) ; } } height [ cur ] += 1 ; } static void dfs2 ( int cur , int par ) { int max1 = 0 ; int max2 = 0 ; foreach ( int u in adj [ cur ] ) { if ( u != par ) { if ( height [ u ] >= max1 ) { max2 = max1 ; max1 = height [ u ] ; } else if ( height [ u ] > max2 ) { max2 = height [ u ] ; } } } int sum = 0 ; foreach ( int u in adj [ cur ] ) { if ( u != par ) { sum = ( ( max1 == height [ u ] ) ? max2 : max1 ) ; if ( max1 == height [ u ] ) dist [ u ] = 1 + Math . Max ( 1 + max2 , dist [ cur ] ) ; else dist [ u ] = 1 + Math . Max ( 1 + max1 , dist [ cur ] ) ; dfs2 ( u , cur ) ; } } } public static void Main ( String [ ] args ) { int n = 6 ; for ( int i = 0 ; i < adj . Length ; i ++ ) adj [ i ] = new List < int > ( ) ; addEdge ( 1 , 2 ) ; addEdge ( 2 , 3 ) ; addEdge ( 2 , 4 ) ; addEdge ( 2 , 5 ) ; addEdge ( 5 , 6 ) ; dfs1 ( 1 , 0 ) ; dfs2 ( 1 , 0 ) ; for ( int i = 1 ; i <= n ; i ++ ) Console . Write ( ( Math . Max ( dist [ i ] , height [ i ] ) - 1 ) + " ▁ " ) ; } }

Index/key variables: cur, i, maxN, u, v
Accumulator variables: i
Iterator variables: i, u
Class/struct names: GFG
C# program:
using System ; class Middle { public static int middleOfThree ( int a , int b , int c ) { if ( ( a < b && b < c ) || ( c < b && b < a ) ) return b ; else if ( ( b < a && a < c ) || ( c < a && a < b ) ) return a ; else return c ; } public static void Main ( ) { int a = 20 , b = 30 , c = 40 ; Console . WriteLine ( middleOfThree ( a , b , c ) ) ; } }

Class/struct names: Middle
C# program:
using System ; public class GFG { static void selectionSort ( int [ ] arr , int n ) { int i , j , min_idx ; for ( i = 0 ; i < n - 1 ; i ++ ) { min_idx = i ; for ( j = i + 1 ; j < n ; j ++ ) if ( arr [ j ] < arr [ min_idx ] ) min_idx = j ; int temp = arr [ min_idx ] ; arr [ min_idx ] = arr [ i ] ; arr [ i ] = temp ; } } static void printArray ( int [ ] arr , int size ) { int i ; for ( i = 0 ; i < size ; i ++ ) { Console . Write ( arr [ i ] + " ▁ " ) ; } Console . WriteLine ( ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 64 , 25 , 12 , 22 , 11 } ; int n = arr . Length ; selectionSort ( arr , n ) ; Console . Write ( " Sorted ▁ array : ▁ STRNEWLINE " ) ; printArray ( arr , n ) ; } }

Index/key variables: i, j, min_idx
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static bool checkStr1CanConStr2 ( String str1 , String str2 ) { int N = str1 . Length ; int M = str2 . Length ; HashSet < int > st1 = new HashSet < int > ( ) ; HashSet < int > st2 = new HashSet < int > ( ) ; int [ ] hash1 = new int [ 256 ] ; for ( int i = 0 ; i < N ; i ++ ) { hash1 [ str1 [ i ] ] ++ ; } for ( int i = 0 ; i < N ; i ++ ) { st1 . Add ( str1 [ i ] ) ; } for ( int i = 0 ; i < M ; i ++ ) { st2 . Add ( str2 [ i ] ) ; } if ( st1 . Equals ( st2 ) ) { return false ; } int [ ] hash2 = new int [ 256 ] ; for ( int i = 0 ; i < M ; i ++ ) { hash2 [ str2 [ i ] ] ++ ; } Array . Sort ( hash1 ) ; Array . Sort ( hash2 ) ; for ( int i = 0 ; i < 256 ; i ++ ) { if ( hash1 [ i ] != hash2 [ i ] ) { return false ; } } return true ; } public static void Main ( String [ ] args ) { String str1 = " xyyzzlll " ; String str2 = " yllzzxxx " ; if ( checkStr1CanConStr2 ( str1 , str2 ) ) { Console . Write ( " True " ) ; } else { Console . Write ( " False " ) ; } } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void partSort ( int [ ] arr , int N , int a , int b ) { int l = Math . Min ( a , b ) ; int r = Math . Max ( a , b ) ; Array . Sort ( arr , l , r ) ; for ( int i = 0 ; i < N ; i ++ ) Console . Write ( arr [ i ] + " ▁ " ) ; } static void Main ( ) { int [ ] arr = { 7 , 8 , 4 , 5 , 2 } ; int a = 1 , b = 4 ; int N = arr . Length ; partSort ( arr , N , a , b ) ; } }

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