dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; public class GFG { public static int minimumCost ( int [ ] arr , int N , int X , int Y ) { int even_count = 0 , odd_count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( ( arr [ i ] & 1 ) > 0 && ( i % 2 == 0 ) ) { odd_count ++ ; } if ( ( arr [ i ] % 2 ) == 0 && ( i & 1 ) > 0 ) { even_count ++ ; } } int cost1 = X * Math . Min ( odd_count , even_count ) ; int cost2 = Y * ( Math . Max ( odd_count , even_count ) - Math . Min ( odd_count , even_count ) ) ; int cost3 = ( odd_count + even_count ) * Y ; return Math . Min ( cost1 + cost2 , cost3 ) ; } public static void Main ( string [ ] args ) { int [ ] arr = { 5 , 3 , 7 , 2 , 1 } ; int X = 10 , Y = 2 ; int N = arr . Length ; Console . WriteLine ( minimumCost ( arr , N , X , Y ) ) ; } }

Index/key variables: i
Accumulator variables: even_count, i, odd_count
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static int findMinMax ( int [ ] a ) { int min_val = 1000000000 ; for ( int i = 1 ; i < a . Length ; ++ i ) { min_val = Math . Min ( min_val , a [ i ] * a [ i - 1 ] ) ; } return min_val ; } public static void Main ( string [ ] args ) { int [ ] arr = { 6 , 4 , 5 , 6 , 2 , 4 , 1 } ; Console . WriteLine ( findMinMax ( arr ) ) ; } }

Index/key variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static int sum ; public class TreeNode { public int data ; public TreeNode left ; public TreeNode right ; public TreeNode ( int data ) { this . data = data ; this . left = null ; this . right = null ; } } ; static void kDistanceDownSum ( TreeNode root , int k ) { if ( root == null k < 0 ) return ; if ( k == 0 ) { sum += root . data ; return ; } kDistanceDownSum ( root . left , k - 1 ) ; kDistanceDownSum ( root . right , k - 1 ) ; } static int kDistanceSum ( TreeNode root , int target , int k ) { if ( root == null ) return - 1 ; if ( root . data == target ) { kDistanceDownSum ( root . left , k - 1 ) ; return 0 ; } int dl = - 1 ; if ( target < root . data ) { dl = kDistanceSum ( root . left , target , k ) ; } if ( dl != - 1 ) { if ( dl + 1 == k ) sum += root . data ; return - 1 ; } int dr = - 1 ; if ( target > root . data ) { dr = kDistanceSum ( root . right , target , k ) ; } if ( dr != - 1 ) { if ( dr + 1 == k ) sum += root . data ; else kDistanceDownSum ( root . left , k - dr - 2 ) ; return 1 + dr ; } return - 1 ; } static TreeNode insertNode ( int data , TreeNode root ) { if ( root == null ) { TreeNode node = new TreeNode ( data ) ; return node ; } else if ( data > root . data ) { root . right = insertNode ( data , root . right ) ; } else if ( data <= root . data ) { root . left = insertNode ( data , root . left ) ; } return root ; } static void findSum ( TreeNode root , int target , int K ) { sum = 0 ; kDistanceSum ( root , target , K ) ; Console . Write ( sum ) ; } public static void Main ( String [ ] args ) { TreeNode root = null ; int N = 11 ; int [ ] tree = { 3 , 1 , 7 , 0 , 2 , 5 , 10 , 4 , 6 , 9 , 8 } ; for ( int i = 0 ; i < N ; i ++ ) { root = insertNode ( tree [ i ] , root ) ; } int target = 7 ; int K = 2 ; findSum ( root , target , K ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG, TreeNode
C# program:
using System ; public class GFG { static int itemType ( int n ) { int count = 0 ; for ( int day = 1 ; ; day ++ ) { for ( int type = day ; type > 0 ; type -- ) { count += type ; if ( count >= n ) return type ; } } } static public void Main ( ) { int N = 10 ; Console . WriteLine ( itemType ( N ) ) ; } }

Accumulator variables: count, day, type
Iterator variables: day, type
Class/struct names: GFG
C# program:
using System ; class GFG { static int FindSum ( int [ ] arr , int N ) { int res = 0 ; for ( int i = 0 ; i < N ; i ++ ) { int power = ( int ) ( Math . Log ( arr [ i ] ) / Math . Log ( 2 ) ) ; int LesserValue = ( int ) Math . Pow ( 2 , power ) ; int LargerValue = ( int ) Math . Pow ( 2 , power + 1 ) ; if ( ( arr [ i ] - LesserValue ) == ( LargerValue - arr [ i ] ) ) { res += arr [ i ] ; } } return res ; } public static void Main ( ) { int [ ] arr = { 10 , 24 , 17 , 3 , 8 } ; int N = arr . Length ; Console . WriteLine ( FindSum ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: i, res
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void findLast ( int [ , ] mat ) { int m = 3 ; int n = 3 ; HashSet < int > rows = new HashSet < int > ( ) ; HashSet < int > cols = new HashSet < int > ( ) ; for ( int i = 0 ; i < m ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( ( mat [ i , j ] > 0 ) ) { rows . Add ( i ) ; cols . Add ( j ) ; } } } int avRows = m - rows . Count ; int avCols = n - cols . Count ; int choices = Math . Min ( avRows , avCols ) ; if ( ( choices & 1 ) != 0 ) Console . WriteLine ( " P1" ) ; else Console . WriteLine ( " P2" ) ; } static public void Main ( ) { int [ , ] mat = { { 1 , 0 , 0 } , { 0 , 0 , 0 } , { 0 , 0 , 1 } } ; findLast ( mat ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { const int MOD = 1000000007 ; static void sumOfBinaryNumbers ( int n ) { int ans = 0 ; int one = 1 ; while ( true ) { if ( n <= 1 ) { ans = ( ans + n ) % MOD ; break ; } int x = ( int ) Math . Log ( n , 2 ) ; int cur = 0 ; int add = ( one << ( x - 1 ) ) ; for ( int i = 1 ; i <= x ; i ++ ) { cur = ( cur + add ) % MOD ; add = ( add * 10 % MOD ) ; } ans = ( ans + cur ) % MOD ; int rem = n - ( one << x ) + 1 ; int p = ( int ) Math . Pow ( 10 , x ) ; p = ( p * ( rem % MOD ) ) % MOD ; ans = ( ans + p ) % MOD ; n = rem - 1 ; } Console . WriteLine ( ans ) ; } public static void Main ( ) { int N = 3 ; sumOfBinaryNumbers ( N ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void nearestFibonacci ( int num ) { if ( num == 0 ) { Console . Write ( 0 ) ; return ; } int first = 0 , second = 1 ; int third = first + second ; while ( third <= num ) { first = second ; second = third ; third = first + second ; } int ans = ( Math . Abs ( third - num ) >= Math . Abs ( second - num ) ) ? second : third ; Console . Write ( ans ) ; } public static void Main ( string [ ] args ) { int N = 17 ; nearestFibonacci ( N ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static bool checkPermutation ( int [ ] ans , int [ ] a , int n ) { int Max = Int32 . MinValue ; for ( int i = 0 ; i < n ; i ++ ) { Max = Math . Max ( Max , ans [ i ] ) ; if ( Max != a [ i ] ) return false ; } return true ; } static void findPermutation ( int [ ] a , int n ) { int [ ] ans = new int [ n ] ; Dictionary < int , int > um = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( ! um . ContainsKey ( a [ i ] ) ) { ans [ i ] = a [ i ] ; um [ a [ i ] ] = i ; } } List < int > v = new List < int > ( ) ; int j = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { if ( ! um . ContainsKey ( i ) ) { v . Add ( i ) ; } } for ( int i = 0 ; i < n ; i ++ ) { if ( ans [ i ] == 0 ) { ans [ i ] = v [ j ] ; j ++ ; } } if ( checkPermutation ( ans , a , n ) ) { for ( int i = 0 ; i < n ; i ++ ) { Console . Write ( ans [ i ] + " ▁ " ) ; } } else Console . Write ( " - 1" ) ; } public static void Main ( ) { int [ ] arr = { 1 , 3 , 4 , 5 , 5 } ; int N = arr . Length ; findPermutation ( arr , N ) ; } }

Index/key variables: i, j, n
Accumulator variables: i, j
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void countEqualElementPairs ( int [ ] arr , int N ) { Dictionary < int , int > map = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( ! map . ContainsKey ( arr [ i ] ) ) map [ arr [ i ] ] = 1 ; else map [ arr [ i ] ] ++ ; } int total = 0 ; foreach ( KeyValuePair < int , int > e in map ) { total += ( e . Value * ( e . Value - 1 ) ) / 2 ; } for ( int i = 0 ; i < N ; i ++ ) { Console . Write ( total - ( map [ arr [ i ] ] - 1 ) + " ▁ " ) ; } } public static void Main ( ) { int [ ] arr = { 1 , 1 , 2 , 1 , 2 } ; int N = 5 ; countEqualElementPairs ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i, total
Iterator variables: e, i
Class/struct names: GFG
C# program:
using System ; class GFG { static int count ( int N ) { int sum = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { sum += ( int ) ( 7 * Math . Pow ( 8 , i - 1 ) ) ; } return sum ; } public static void Main ( ) { int N = 4 ; Console . WriteLine ( count ( N ) ) ; } }

Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static bool isPalindrome ( int n ) { String str = String . Join ( " " , n ) ; int s = 0 , e = str . Length - 1 ; while ( s < e ) { if ( str [ s ] != str [ e ] ) { return false ; } s ++ ; e -- ; } return true ; } static void palindromicDivisors ( int n ) { List < int > PalindromDivisors = new List < int > ( ) ; for ( int i = 1 ; i <= Math . Sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { if ( n / i == i ) { if ( isPalindrome ( i ) ) { PalindromDivisors . Add ( i ) ; } } else { if ( isPalindrome ( i ) ) { PalindromDivisors . Add ( i ) ; } if ( isPalindrome ( n / i ) ) { PalindromDivisors . Add ( n / i ) ; } } } } PalindromDivisors . Sort ( ) ; for ( int i = 0 ; i < PalindromDivisors . Count ; i ++ ) { Console . Write ( PalindromDivisors [ i ] + " ▁ " ) ; } } public static void Main ( String [ ] args ) { int n = 66 ; palindromicDivisors ( n ) ; } }

Index/key variables: e, i, s
Accumulator variables: e, i, s
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int findMinDel ( int [ ] arr , int n ) { int min_num = int . MaxValue ; for ( int i = 0 ; i < n ; i ++ ) min_num = Math . Min ( arr [ i ] , min_num ) ; int cnt = 0 ; for ( int i = 0 ; i < n ; i ++ ) if ( arr [ i ] == min_num ) cnt ++ ; return n - cnt ; } public static void Main ( String [ ] args ) { int [ ] arr = { 3 , 3 , 2 } ; int n = arr . Length ; Console . Write ( findMinDel ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: cnt, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int cntSubArr ( int [ ] arr , int n ) { int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int curr_gcd = 0 ; for ( int j = i ; j < n ; j ++ ) { curr_gcd = __gcd ( curr_gcd , arr [ j ] ) ; ans += ( curr_gcd == 1 ) ? 1 : 0 ; } } return ans ; } static int __gcd ( int a , int b ) { if ( b == 0 ) return a ; return __gcd ( b , a % b ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 1 , 1 } ; int n = arr . Length ; Console . WriteLine ( cntSubArr ( arr , n ) ) ; } }

Index/key variables: j
Accumulator variables: ans, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void print_primes_till_N ( int N ) { int i , j , flag ; Console . Write ( " Prime ▁ numbers ▁ between ▁ 1 ▁ and ▁ " + N + " ▁ are : STRNEWLINE " ) ; for ( i = 1 ; i <= N ; i ++ ) { if ( i == 1 i == 0 ) continue ; flag = 1 ; for ( j = 2 ; j <= i / 2 ; ++ j ) { if ( i % j == 0 ) { flag = 0 ; break ; } } if ( flag == 1 ) Console . Write ( i + " ▁ " ) ; } } public static void Main ( String [ ] args ) { int N = 100 ; print_primes_till_N ( N ) ; } }

Accumulator variables: i
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX = 32 ; static int findX ( int A , int B ) { int X = 0 ; for ( int bit = 0 ; bit < MAX ; bit ++ ) { int tempBit = 1 << bit ; int bitOfX = A & B & tempBit ; X += bitOfX ; } return X ; } public static void Main ( String [ ] args ) { int A = 11 , B = 13 ; Console . WriteLine ( findX ( A , B ) ) ; } }

Accumulator variables: X, bit
Iterator variables: bit
Class/struct names: GFG
C# program:
using System ; using System . Linq ; class GFG { static int cntSubSets ( int [ ] arr , int n ) { int maxVal = arr . Max ( ) ; int cnt = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] == maxVal ) cnt ++ ; } return ( int ) ( Math . Pow ( 2 , cnt ) - 1 ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 1 , 2 } ; int n = arr . Length ; Console . WriteLine ( cntSubSets ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: cnt, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static float findProb ( int [ ] arr , int n ) { long maxSum = int . MinValue , maxCount = 0 , totalPairs = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { int sum = arr [ i ] + arr [ j ] ; if ( sum == maxSum ) { maxCount ++ ; } else if ( sum > maxSum ) { maxSum = sum ; maxCount = 1 ; } totalPairs ++ ; } } float prob = ( float ) maxCount / ( float ) totalPairs ; return prob ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 1 , 1 , 2 , 2 , 2 } ; int n = arr . Length ; Console . WriteLine ( findProb ( arr , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, maxCount, totalPairs
Iterator variables: i, j
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 int maxCommonFactors ( int a , int b ) { int __gcd = gcd ( a , b ) ; int ans = 1 ; for ( int i = 2 ; i * i <= __gcd ; i ++ ) { if ( __gcd % i == 0 ) { ans ++ ; while ( __gcd % i == 0 ) __gcd /= i ; } } if ( __gcd != 1 ) ans ++ ; return ans ; } public static void Main ( String [ ] args ) { int a = 12 , b = 18 ; Console . WriteLine ( maxCommonFactors ( a , b ) ) ; } }

Accumulator variables: __gcd, ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int [ ] days = { 31 , 28 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 } ; static int dayOfYear ( string date ) { int year = Int32 . Parse ( date . Substring ( 0 , 4 ) ) ; int month = Int32 . Parse ( date . Substring ( 5 , 2 ) ) ; int day = Int32 . Parse ( date . Substring ( 8 ) ) ; if ( month > 2 && year % 4 == 0 && ( year % 100 != 0 year % 400 == 0 ) ) { ++ day ; } while ( -- month > 0 ) { day = day + days [ month - 1 ] ; } return day ; } public static void Main ( ) { String date = "2019-01-09" ; Console . WriteLine ( dayOfYear ( date ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int Cells ( int n , int x ) { int ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) if ( x % i == 0 && x / i <= n ) ans ++ ; return ans ; } public static void Main ( ) { int n = 6 , x = 12 ; Console . WriteLine ( Cells ( n , x ) ) ; } }

Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int nextPowerOfFour ( int n ) { int x = ( int ) Math . Floor ( Math . Sqrt ( Math . Sqrt ( n ) ) ) ; if ( Math . Pow ( x , 4 ) == n ) return n ; else { x = x + 1 ; return ( int ) Math . Pow ( x , 4 ) ; } } public static void Main ( ) { int n = 122 ; Console . WriteLine ( nextPowerOfFour ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int minOperations ( int x , int y , int p , int q ) { if ( y % x != 0 ) return - 1 ; int d = y / x ; int a = 0 ; while ( d % p == 0 ) { d /= p ; a ++ ; } int b = 0 ; while ( d % q == 0 ) { d /= q ; b ++ ; } if ( d != 1 ) return - 1 ; return ( a + b ) ; } public static void Main ( ) { int x = 12 , y = 2592 , p = 2 , q = 3 ; Console . Write ( minOperations ( x , y , p , q ) ) ; } }

Accumulator variables: a, b, d
Class/struct names: GFG
C# program:
using System ; class GFG { static int nCr ( int n ) { if ( n < 4 ) return 0 ; int answer = n * ( n - 1 ) * ( n - 2 ) * ( n - 3 ) ; answer /= 24 ; return answer ; } static int countQuadruples ( int N , int K ) { int M = N / K ; int answer = nCr ( M ) ; for ( int i = 2 ; i < M ; i ++ ) { int j = i ; int temp2 = M / i ; int count = 0 ; int check = 0 ; int temp = j ; while ( j % 2 == 0 ) { count ++ ; j /= 2 ; if ( count >= 2 ) break ; } if ( count >= 2 ) { check = 1 ; } for ( int k = 3 ; k <= Math . Sqrt ( temp ) ; k += 2 ) { int cnt = 0 ; while ( j % k == 0 ) { cnt ++ ; j /= k ; if ( cnt >= 2 ) break ; } if ( cnt >= 2 ) { check = 1 ; break ; } else if ( cnt == 1 ) count ++ ; } if ( j > 2 ) { count ++ ; } if ( check == 1 ) continue ; else { if ( count % 2 == 1 ) { answer -= nCr ( temp2 ) ; } else { answer += nCr ( temp2 ) ; } } } return answer ; } public static void Main ( String [ ] args ) { int N = 10 , K = 2 ; Console . WriteLine ( countQuadruples ( N , K ) ) ; } }

Accumulator variables: answer, cnt, count, i, j, k
Iterator variables: i, k
Class/struct names: GFG
C# program:
using System ; class GFG { static int getX ( int a , int b , int c , int d ) { int X = ( b * c - a * d ) / ( d - c ) ; return X ; } static public void Main ( ) { int a = 2 , b = 3 , c = 4 , d = 5 ; Console . Write ( getX ( a , b , c , d ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static bool isVowel ( char ch ) { if ( ch == ' a ' ch == ' e ' ch == ' i ' ch == ' o ' ch == ' u ' ) return true ; else return false ; } static long fact ( long n ) { if ( n < 2 ) { return 1 ; } return n * fact ( n - 1 ) ; } static long only_vowels ( Dictionary < char , int > freq ) { long denom = 1 ; long cnt_vwl = 0 ; foreach ( KeyValuePair < char , int > itr in freq ) { if ( isVowel ( itr . Key ) ) { denom *= fact ( itr . Value ) ; cnt_vwl += itr . Value ; } } return fact ( cnt_vwl ) / denom ; } static long all_vowels_together ( Dictionary < char , int > freq ) { long vow = only_vowels ( freq ) ; long denom = 1 ; long cnt_cnst = 0 ; foreach ( KeyValuePair < char , int > itr in freq ) { if ( ! isVowel ( itr . Key ) ) { denom *= fact ( itr . Value ) ; cnt_cnst += itr . Value ; } } long ans = fact ( cnt_cnst + 1 ) / denom ; return ( ans * vow ) ; } static long total_permutations ( Dictionary < char , int > freq ) { long cnt = 0 ; long denom = 1 ; foreach ( KeyValuePair < char , int > itr in freq ) { denom *= fact ( itr . Value ) ; cnt += itr . Value ; } return fact ( cnt ) / denom ; } static long no_vowels_together ( string word ) { Dictionary < char , int > freq = new Dictionary < char , int > ( ) ; for ( int i = 0 ; i < word . Length ; i ++ ) { char ch = Char . ToLower ( word [ i ] ) ; if ( freq . ContainsKey ( ch ) ) { freq [ ch ] ++ ; } else { freq [ ch ] = 1 ; } } long total = total_permutations ( freq ) ; long vwl_tgthr = all_vowels_together ( freq ) ; long res = total - vwl_tgthr ; return res ; } static void Main ( ) { string word = " allahabad " ; long ans = no_vowels_together ( word ) ; Console . WriteLine ( ans ) ; word = " geeksforgeeks " ; ans = no_vowels_together ( word ) ; Console . WriteLine ( ans ) ; word = " abcd " ; ans = no_vowels_together ( word ) ; Console . WriteLine ( ans ) ; } }

Index/key variables: ch, i
Accumulator variables: cnt, cnt_cnst, cnt_vwl, denom, i
Iterator variables: i, itr
Class/struct names: GFG
C# program:
using System ; class GFG { static int numberOfMen ( int D , int m , int d ) { int Men = ( m * ( D - d ) ) / d ; return Men ; } public static void Main ( ) { int D = 5 , m = 4 , d = 4 ; Console . WriteLine ( numberOfMen ( D , m , d ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static double area ( double a , double b , double c ) { double d = Math . Abs ( ( c * c ) / ( 2 * a * b ) ) ; return d ; } static public void Main ( ) { double a = - 2 , b = 4 , c = 3 ; Console . WriteLine ( area ( a , b , c ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections ; class GFG { static ArrayList addToArrayForm ( ArrayList A , int K ) { ArrayList v = new ArrayList ( ) ; ArrayList ans = new ArrayList ( ) ; int rem = 0 ; int i = 0 ; for ( i = A . Count - 1 ; i >= 0 ; i -- ) { int my = ( int ) A [ i ] + K % 10 + rem ; if ( my > 9 ) { rem = 1 ; v . Add ( my % 10 ) ; } else { v . Add ( my ) ; rem = 0 ; } K = K / 10 ; } while ( K > 0 ) { int my = K % 10 + rem ; v . Add ( my % 10 ) ; if ( my / 10 > 0 ) rem = 1 ; else rem = 0 ; K = K / 10 ; } if ( rem > 0 ) v . Add ( rem ) ; for ( int j = v . Count - 1 ; j >= 0 ; j -- ) ans . Add ( ( int ) v [ j ] ) ; return ans ; } static void Main ( ) { ArrayList A = new ArrayList ( ) ; A . Add ( 2 ) ; A . Add ( 7 ) ; A . Add ( 4 ) ; int K = 181 ; ArrayList ans = addToArrayForm ( A , K ) ; for ( int i = 0 ; i < ans . Count ; i ++ ) Console . Write ( ( int ) ans [ i ] ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX = 100005 ; static int kadaneAlgorithm ( int [ ] ar , int n ) { int sum = 0 , maxSum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum += ar [ i ] ; if ( sum < 0 ) sum = 0 ; maxSum = Math . Max ( maxSum , sum ) ; } return maxSum ; } static int maxFunction ( int [ ] arr , int n ) { int [ ] b = new int [ MAX ] ; int [ ] c = new int [ MAX ] ; for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( i % 2 == 1 ) { b [ i ] = Math . Abs ( arr [ i + 1 ] - arr [ i ] ) ; c [ i ] = - b [ i ] ; } else { c [ i ] = Math . Abs ( arr [ i + 1 ] - arr [ i ] ) ; b [ i ] = - c [ i ] ; } } int ans = kadaneAlgorithm ( b , n - 1 ) ; ans = Math . Max ( ans , kadaneAlgorithm ( c , n - 1 ) ) ; return ans ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 5 , 4 , 7 } ; int n = arr . Length ; Console . WriteLine ( maxFunction ( arr , n ) ) ; } }

Index/key variables: MAX, i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int findThirdDigit ( int n ) { if ( n < 3 ) return 0 ; return ( n & 1 ) > 0 ? 1 : 6 ; } static void Main ( ) { int n = 7 ; Console . WriteLine ( findThirdDigit ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static double getProbability ( int a , int b , int c , int d ) { double p = ( double ) a / ( double ) b ; double q = ( double ) c / ( double ) d ; double ans = p * ( 1 / ( 1 - ( 1 - q ) * ( 1 - p ) ) ) ; return ans ; } public static void Main ( string [ ] args ) { int a = 1 , b = 2 , c = 10 , d = 11 ; Console . Write ( " { 0 : F5 } " , getProbability ( a , b , c , d ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPalindrome ( int n ) { int divisor = 1 ; while ( n / divisor >= 10 ) divisor *= 10 ; while ( n != 0 ) { int leading = n / divisor ; int trailing = n % 10 ; if ( leading != trailing ) return false ; n = ( n % divisor ) / 10 ; divisor = divisor / 100 ; } return true ; } static int largestPalindrome ( int [ ] A , int n ) { int currentMax = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( A [ i ] > currentMax && isPalindrome ( A [ i ] ) ) currentMax = A [ i ] ; } return currentMax ; } public static void Main ( ) { int [ ] A = { 1 , 232 , 54545 , 999991 } ; int n = A . Length ; Console . WriteLine ( largestPalindrome ( A , n ) ) ; } }

Index/key variables: i
Accumulator variables: divisor, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { public static long getFinalElement ( long n ) { long finalNum ; for ( finalNum = 2 ; finalNum * 2 <= n ; finalNum *= 2 ) ; return finalNum ; } static public void Main ( ) { int N = 12 ; Console . WriteLine ( getFinalElement ( N ) ) ; } }

Accumulator variables: finalNum
Iterator variables: finalNum
Class/struct names: GFG