dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { public static bool PermuteAndFind ( int [ ] power , int idx , int SumSoFar , int target ) { if ( idx == power . Length ) { if ( SumSoFar == target ) return true ; return false ; } bool select = PermuteAndFind ( power , idx + 1 , SumSoFar , target ) ; bool notselect = PermuteAndFind ( power , idx + 1 , SumSoFar + power [ idx ] , target ) ; return ( select notselect ) ; } public static void DistinctPowersOf3 ( int N ) { int [ ] power = new int [ 16 ] ; power [ 0 ] = 1 ; for ( int i = 1 ; i < 16 ; i ++ ) power [ i ] = 3 * power [ i - 1 ] ; bool found = PermuteAndFind ( power , 0 , 0 , N ) ; if ( found == true ) { Console . Write ( " Yes " ) ; } else { Console . Write ( " No " ) ; } } public static void Main ( ) { int N = 91 ; DistinctPowersOf3 ( N ) ; } }

Index/key variables: i, idx
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int gcd ( int A , int B ) { if ( B == 0 ) return A ; else return gcd ( B , A % B ) ; } static int getDistinctValues ( int A , int B , int C ) { int g = gcd ( A , B ) ; int num_values = C / g ; return num_values ; } static void Main ( ) { int A = 2 ; int B = 3 ; int C = 10 ; Console . Write ( getDistinctValues ( A , B , C ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int [ ] game_with_number ( int [ ] arr , int n ) { for ( int i = 0 ; i < n - 1 ; i ++ ) { arr [ i ] = arr [ i ] ^ arr [ i + 1 ] ; } return arr ; } static void print ( int [ ] arr , int n ) { for ( int i = 0 ; i < n ; i ++ ) { Console . Write ( arr [ i ] + " ▁ " ) ; } } public static void Main ( ) { int [ ] arr = { 10 , 11 , 1 , 2 , 3 } ; int n = arr . Length ; int [ ] new_arr = game_with_number ( arr , n ) ; print ( new_arr , n ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int currSubArrayScore ( int [ ] a , int [ ] b , int l , int r ) { int straightScore = 0 ; int reverseScore = 0 ; for ( int i = l ; i <= r ; i ++ ) { straightScore += a [ i ] * b [ i ] ; reverseScore += a [ r - ( i - l ) ] * b [ i ] ; } return Math . Max ( straightScore , reverseScore ) ; } static void maxScoreSubArray ( int [ ] a , int [ ] b , int n ) { int res = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i ; j < n ; j ++ ) { int currScore = currSubArrayScore ( a , b , i , j ) ; if ( currScore > res ) { res = currScore ; } } } Console . Write ( res ) ; } static public void Main ( ) { int [ ] A = { 13 , 4 , 5 } ; int [ ] B = { 10 , 22 , 2 } ; int N = A . Length ; maxScoreSubArray ( A , B , N ) ; } }

Index/key variables: i
Accumulator variables: i, j, reverseScore, straightScore
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; public class GFG { static void maxScoreSubArray ( int [ ] a , int [ ] b , int n ) { int res = 0 ; for ( int mid = 0 ; mid < n ; mid ++ ) { int straightScore = a [ mid ] * b [ mid ] , reverseScore = a [ mid ] * a [ mid ] ; int prev = mid - 1 , next = mid + 1 ; res = Math . Max ( res , Math . Max ( straightScore , reverseScore ) ) ; while ( prev >= 0 && next < n ) { straightScore += ( a [ prev ] * b [ prev ] + a [ next ] * b [ next ] ) ; reverseScore += ( a [ prev ] * b [ next ] + a [ next ] * b [ prev ] ) ; res = Math . Max ( res , Math . Max ( straightScore , reverseScore ) ) ; prev -- ; next ++ ; } straightScore = 0 ; reverseScore = 0 ; prev = mid - 1 ; next = mid ; while ( prev >= 0 && next < n ) { straightScore += ( a [ prev ] * b [ prev ] + a [ next ] * b [ next ] ) ; reverseScore += ( a [ prev ] * b [ next ] + a [ next ] * b [ prev ] ) ; res = Math . Max ( res , Math . Max ( straightScore , reverseScore ) ) ; prev -- ; next ++ ; } } Console . WriteLine ( res ) ; } static public void Main ( ) { int [ ] A = { 13 , 4 , 5 } ; int [ ] B = { 10 , 22 , 2 } ; int N = A . Length ; maxScoreSubArray ( A , B , N ) ; } }

Index/key variables: mid, next, prev
Accumulator variables: mid, next, prev, reverseScore, straightScore
Iterator variables: mid
Class/struct names: GFG
C# program:
using System ; class GFG { static int minimumSizeSubarray ( int [ ] arr , int N ) { int i = 0 , j = N - 1 ; while ( i < N && arr [ i ] == 0 ) { i ++ ; } if ( i == N ) return 1 ; while ( j >= 0 && arr [ j ] == 0 ) { j -- ; } return ( j - i + 1 ) ; } public static void Main ( ) { int [ ] arr = { 0 , 2 , 0 , 0 , 12 , 0 , 0 , 0 } ; int N = arr . Length ; Console . Write ( minimumSizeSubarray ( arr , N ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void countXorPartition ( int N ) { double a = Math . Pow ( 2 , ( int ) ( N - Math . Log ( N + 1 ) / Math . Log ( 2 ) ) ) ; Console . Write ( a ) ; } public static void Main ( ) { int N = 5 ; countXorPartition ( N ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void countValues ( int A , int B , int C ) { if ( B >= A ) { Console . Write ( 0 ) ; return ; } if ( B == 0 ) { Console . Write ( C / A ) ; return ; } int ans = C / A ; if ( ans * A + B <= C ) { ans ++ ; } Console . Write ( ans ) ; } public static void Main ( ) { int A = 6 , B = 3 , N = 15 ; countValues ( A , B , N ) ; } }

Accumulator variables: ans
Class/struct names: GFG
C# program:
using System ; class GFG { static int maximumSum ( int [ ] arr , int N ) { int ans = 0 ; for ( int bit = 0 ; bit < 32 ; bit ++ ) { int sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( ( arr [ i ] & ( 1 << bit ) ) != 0 ) { sum += arr [ i ] ; } } ans = Math . Max ( ans , sum ) ; } return ans ; } static public void Main ( ) { int [ ] arr = { 5 , 4 , 1 , 7 , 11 } ; int N = arr . Length ; Console . Write ( maximumSum ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: bit, i, sum
Iterator variables: bit, i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void maxCount ( int [ ] arr , int N , int K ) { HashSet < int > st = new HashSet < int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { st . Add ( arr [ i ] ) ; } if ( N - st . Count <= K ) { Console . Write ( " Yes " ) ; } else Console . Write ( " No " ) ; } static public void Main ( ) { int [ ] arr = { 2 , 2 , 2 , 3 } ; int K = 3 ; int N = arr . Length ; maxCount ( arr , N , K ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System . Collections . Generic ; using System ; class GFG { static void findWinner ( int X , int Y ) { int playerA = ( X ^ Y ) ; bool flag = false ; for ( int i = 1 ; i <= X ; i ++ ) { for ( int j = 1 ; j <= Y ; j ++ ) { int val = ( i ^ j ) ; if ( val > playerA ) { flag = true ; break ; } } if ( flag ) { break ; } } if ( flag ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } public static void Main ( String [ ] args ) { int A = 2 , B = 4 ; findWinner ( A , B ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Boolean variables: flag
Class/struct names: GFG
C# program:
using System ; class GFG { static void findWinner ( int X , int Y ) { int first = ( X ^ Y ) ; int second = ( X + Y ) ; if ( first == second ) { Console . Write ( " No " ) ; } else { Console . Write ( " Yes " ) ; } } public static void Main ( String [ ] args ) { int A = 2 , B = 4 ; findWinner ( A , B ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static int findNum ( int N , int K ) { int rem = ( N + K ) % K ; if ( rem == 0 ) return N ; else return N + K - rem ; } public static int findSmallest ( int M , int N ) { int x = findNum ( M , N ) ; return x - M ; } public static void Main ( ) { int M = 100 , N = 28 ; Console . WriteLine ( findSmallest ( M , N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void prefixFactorialArray ( int [ ] A , int N ) { for ( int i = 1 ; i < N ; i ++ ) { A [ i ] += A [ i - 1 ] ; } int [ ] fact = new int [ A [ N - 1 ] + 1 ] ; fact [ 0 ] = 1 ; for ( int i = 1 ; i <= A [ N - 1 ] ; i ++ ) { fact [ i ] = i * fact [ i - 1 ] ; } for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = fact [ A [ i ] ] ; } for ( int i = 0 ; i < N ; i ++ ) { Console . Write ( A [ i ] + " ▁ " ) ; } } static void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 4 } ; int N = arr . Length ; prefixFactorialArray ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void maxFrequency ( int [ ] arr , int N , int K ) { Array . Sort ( arr ) ; int start = 0 , end = 0 ; int sum = 0 , res = 0 ; for ( end = 0 ; end < N ; end ++ ) { sum += arr [ end ] ; while ( ( end - start + 1 ) * arr [ end ] - sum > K ) { sum -= arr [ start ] ; start ++ ; } res = Math . Max ( res , end - start + 1 ) ; } Console . WriteLine ( res ) ; } public static void Main ( ) { int [ ] arr = { 1 , 4 , 8 , 13 } ; int N = 4 ; int K = 5 ; maxFrequency ( arr , N , K ) ; } }

Index/key variables: end, start
Accumulator variables: end, start, sum
Iterator variables: end
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void countPairs ( int [ ] arr , int n , int x ) { int count = 0 ; Dictionary < int , int > mp = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( ! mp . ContainsKey ( arr [ i ] - x * i ) ) mp [ arr [ i ] - x * i ] = 0 ; mp [ arr [ i ] - x * i ] = mp [ arr [ i ] - x * i ] + 1 ; } foreach ( KeyValuePair < int , int > v in mp ) { count += ( v . Value * ( v . Value - 1 ) ) / 2 ; } Console . WriteLine ( count ) ; } public static void Main ( string [ ] args ) { int n = 6 , x = 3 ; int [ ] arr = { 5 , 4 , 8 , 11 , 13 , 16 } ; countPairs ( arr , n , x ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i, v
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { static String recreationalSpot ( int [ ] arr , int N ) { if ( N < 3 ) { return " No " ; } int [ ] preMin = new int [ N ] ; preMin [ 0 ] = arr [ 0 ] ; for ( int i = 1 ; i < N ; i ++ ) { preMin [ i ] = Math . Min ( preMin [ i - 1 ] , arr [ i ] ) ; } Stack < int > stack = new Stack < int > ( ) ; for ( int j = N - 1 ; j >= 0 ; j -- ) { if ( arr [ j ] > preMin [ j ] ) { while ( stack . Count != 0 && stack . Peek ( ) <= preMin [ j ] ) { stack . Pop ( ) ; } if ( stack . Count != 0 && stack . Peek ( ) < arr [ j ] ) { return " Yes " ; } stack . Push ( arr [ j ] ) ; } } return " No " ; } public static void Main ( String [ ] args ) { int [ ] arr = { 4 , 7 , 11 , 5 , 13 , 2 } ; int size = arr . Length ; Console . WriteLine ( recreationalSpot ( arr , size ) ) ; } }

Index/key variables: N, i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static bool ToCheckPowerofX ( int n , int x ) { while ( n > 0 ) { int rem = n % x ; if ( rem >= 2 ) { return false ; } n = n / x ; } return true ; } public static void Main ( String [ ] args ) { int N = 10 , X = 3 ; if ( ToCheckPowerofX ( N , X ) ) { Console . Write ( " Yes " ) ; } else { Console . Write ( " No " ) ; } } }

Class/struct names: GFG
C# program:
using System ; class GFG { static string ReverseString ( string s ) { char [ ] array = s . ToCharArray ( ) ; Array . Reverse ( array ) ; return new string ( array ) ; } public static int reverseBin ( int N ) { string S = " " ; int i ; for ( i = 0 ; i < 32 ; i ++ ) { if ( ( N & ( 1L << i ) ) != 0 ) S += '1' ; else S += '0' ; } S = ReverseString ( S ) ; int M = 0 ; for ( i = 0 ; i < 32 ; i ++ ) { if ( S [ i ] == '1' ) M += ( 1 << i ) ; } return M ; } static int maximumOfTwo ( int N ) { int M = reverseBin ( N ) ; return Math . Max ( N , M ) ; } static void Main ( ) { int N = 6 ; Console . Write ( maximumOfTwo ( N ) ) ; } }

Index/key variables: i
Accumulator variables: M, S, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int sumOfDivisors ( int N ) { return N ; } static void Main ( ) { int N = 5 ; Console . Write ( sumOfDivisors ( N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int minTime ( int [ ] A , int n , int K ) { int max_ability = A [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { max_ability = Math . Max ( max_ability , A [ i ] ) ; } int [ ] tmp = new int [ max_ability + 1 ] ; int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { tmp [ A [ i ] ] ++ ; } for ( int i = max_ability ; i >= 0 ; i -- ) { if ( tmp [ i ] != 0 ) { if ( tmp [ i ] * i < K ) { K -= ( i * tmp [ i ] ) ; tmp [ i / 2 ] += tmp [ i ] ; count += tmp [ i ] ; if ( K <= 0 ) { return count ; } } else { if ( K % i != 0 ) { count += ( K / i ) + 1 ; } else { count += ( K / i ) ; } return count ; } } } return - 1 ; } public static void Main ( string [ ] args ) { int [ ] arr = { 3 , 1 , 7 , 2 , 4 } ; int N = arr . Length ; int K = 15 ; Console . WriteLine ( minTime ( arr , N , K ) ) ; } }

Index/key variables: i
Accumulator variables: K, count, i
Iterator variables: i
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 findlcm ( int [ ] arr , int n ) { int ans = arr [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { ans = ( ( ( arr [ i ] * ans ) ) / ( gcd ( arr [ i ] , ans ) ) ) ; } return ans ; } static void minimumRod ( int [ ] A , int N ) { Console . WriteLine ( N * findlcm ( A , N ) ) ; } static void Main ( ) { int [ ] arr = { 1 , 2 } ; int N = arr . Length ; minimumRod ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool findDigit ( int N , int D ) { while ( N > 0 ) { int a = N % 10 ; if ( a == D ) { return true ; } N /= 10 ; } return false ; } static bool check ( int N , int D ) { while ( N > 0 ) { if ( findDigit ( N , D ) == true ) { return true ; } N -= D ; } return false ; } public static void Main ( ) { int N = 24 ; int D = 7 ; if ( check ( N , D ) ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } }

Accumulator variables: N
Class/struct names: GFG
C# program:
using System ; class GFG { static int mod = 1000000007 ; static int power ( int x , int y ) { int res = 1 ; x = x % mod ; if ( x == 0 ) return 0 ; while ( y > 0 ) { if ( ( y & 1 ) != 0 ) res = ( res * x ) % mod ; y = y >> 1 ; x = ( x * x ) % mod ; } return res ; } static void countRelations ( int N ) { Console . Write ( ( power ( 2 , N ) - 2 ) * power ( 2 , N * N - N ) ) ; } public static void Main ( String [ ] args ) { int N = 2 ; countRelations ( N ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static int minOperations ( int N ) { int [ ] arr = new int [ N ] ; int sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { arr [ i ] = ( 2 * i ) + 1 ; sum = sum + arr [ i ] ; } int mid = 0 ; if ( N % 2 == 0 ) { mid = sum / N ; } else { mid = arr [ N / 2 ] ; } int ans = 0 ; for ( int i = 0 ; i < N / 2 ; i ++ ) { ans += mid - arr [ i ] ; } return ans ; } public static void Main ( string [ ] args ) { int N = 6 ; Console . WriteLine ( minOperations ( N ) ) ; } }

Index/key variables: N, i
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static int minOperation ( int N ) { if ( N % 2 == 0 ) { return ( N / 2 ) * ( N / 2 ) ; } int k = ( N - 1 ) / 2 ; return k * ( k + 1 ) ; } static void Main ( ) { int N = 6 ; Console . WriteLine ( minOperation ( N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int findXORS ( int [ ] arr1 , int [ ] arr2 , int N , int M ) { int res = 0 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < M ; j ++ ) { int temp = arr1 [ i ] & arr2 [ j ] ; res ^= temp ; } } return res ; } public static void Main ( ) { int [ ] arr1 = { 1 , 2 , 3 } ; int [ ] arr2 = { 6 , 5 } ; int N = arr1 . Length ; int M = arr2 . Length ; Console . Write ( findXORS ( arr1 , arr2 , N , M ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, res
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int findXORS ( int [ ] arr1 , int [ ] arr2 , int N , int M ) { int XORS1 = 0 ; int XORS2 = 0 ; for ( int i = 0 ; i < N ; i ++ ) { XORS1 ^= arr1 [ i ] ; } for ( int i = 0 ; i < M ; i ++ ) { XORS2 ^= arr2 [ i ] ; } return ( XORS1 & XORS2 ) ; } public static void Main ( String [ ] args ) { int [ ] arr1 = { 1 , 2 , 3 } ; int [ ] arr2 = { 6 , 5 } ; int N = arr1 . Length ; int M = arr2 . Length ; Console . WriteLine ( findXORS ( arr1 , arr2 , N , M ) ) ; } }

Index/key variables: i
Accumulator variables: XORS1, XORS2, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPowerof2 ( int n ) { return ( ( n & ( n - 1 ) ) > 0 && n > 0 ) ; } static void countNum ( int N ) { int count = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { bool flag = isPowerof2 ( i ) ; if ( ! flag ) { count ++ ; } } Console . Write ( count + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { int N = 100 ; countNum ( N ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void countNum ( int N ) { int ans = ( int ) ( Math . Log ( N ) / Math . Log ( 2 ) ) + 1 ; Console . WriteLine ( ans ) ; } static void Main ( ) { int N = 100 ; countNum ( N ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { class ListNode { public int val ; public ListNode next ; } ; static ListNode push ( ListNode head_ref , int node_val ) { ListNode new_node = new ListNode ( ) ; new_node . val = node_val ; new_node . next = head_ref ; head_ref = new_node ; return head_ref ; } static void splitListInParts ( ListNode head , int K ) { List < ListNode > ans = new List < ListNode > ( ) ; if ( head == null ) { while ( K -- > 0 ) ans . Add ( null ) ; } int N = 0 ; ListNode p = head ; while ( p . next != null ) { p = p . next ; N ++ ; } int len = N / K ; int rem = N % K ; p = head ; while ( K > 0 && p . next != null ) { int x = len ; ListNode curr_head = p ; ListNode last = p ; if ( rem > 0 ) { p = p . next ; rem -- ; } while ( x -- > 0 ) { if ( last == p ) p = p . next ; else { last . next = p ; last = p ; p = p . next ; } } last . next = null ; ans . Add ( curr_head ) ; K -- ; } while ( K > 0 ) { ans . Add ( null ) ; K -- ; } Console . Write ( " { " ) ; for ( int i = 0 ; i < ans . Count ; i ++ ) { Console . Write ( " { " ) ; while ( ans [ i ] != null ) { Console . Write ( ans [ i ] . val + " ▁ " ) ; ans [ i ] = ans [ i ] . next ; } Console . Write ( " } " ) ; if ( i != ans . Count - 1 ) Console . Write ( " , ▁ " ) ; } Console . Write ( " } " ) ; } public static void Main ( String [ ] args ) { ListNode root = new ListNode ( ) ; root = push ( root , 8 ) ; root = push ( root , 7 ) ; root = push ( root , 6 ) ; root = push ( root , 5 ) ; root = push ( root , 4 ) ; root = push ( root , 3 ) ; root = push ( root , 2 ) ; root = push ( root , 1 ) ; int K = 3 ; splitListInParts ( root , K ) ; } }

Index/key variables: i
Accumulator variables: K, N, i, rem, x
Iterator variables: i
Class/struct names: GFG, ListNode
C# program:
using System ; using System . Collections . Generic ; class GFG { static int nearestPow ( int x , int base1 ) { int k = ( int ) ( Math . Log ( x ) / Math . Log ( base1 ) ) ; if ( Math . Abs ( Math . Pow ( base1 , k ) - x ) < Math . Abs ( Math . Pow ( base1 , ( k + 1 ) ) - x ) ) return ( int ) Math . Pow ( base1 , k ) ; else return ( int ) Math . Pow ( base1 , ( k + 1 ) ) ; } static void replaceWithNearestPowerOfK ( int [ ] arr , int K , int n ) { for ( int i = 0 ; i < n ; i ++ ) { int num = arr [ i ] ; string strEle = num . ToString ( ) ; for ( int c = 0 ; c < strEle . Length ; c ++ ) { if ( ( strEle - '0' ) == K ) { arr [ i ] = nearestPow ( arr [ i ] , K ) ; break ; } } } for ( int i = 0 ; i < n ; i ++ ) Console . Write ( arr [ i ] + " ▁ " ) ; } public static void Main ( ) { int [ ] arr = { 432 , 953 , 232 , 333 } ; int n = arr . Length ; int K = 3 ; replaceWithNearestPowerOfK ( arr , K , n ) ; } }

Index/key variables: i
Accumulator variables: c, i
Iterator variables: c, i
Class/struct names: GFG
C# program:
using System ; class GFG { static int ceilDifference ( int [ ] arr , int n , int x ) { int totalSum = 0 ; int perElementSum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { totalSum += arr [ i ] ; perElementSum += ( int ) Math . Ceiling ( ( double ) ( arr [ i ] ) / ( double ) ( x ) ) ; } int totalCeilSum = ( int ) Math . Ceiling ( ( double ) ( totalSum ) / ( double ) ( x ) ) ; return Math . Abs ( perElementSum - totalCeilSum ) ; } public static void Main ( string [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 4 , 5 , 6 } ; int K = 4 ; int N = arr . Length ; Console . Write ( ceilDifference ( arr , N , K ) ) ; } }

Index/key variables: i
Accumulator variables: i, perElementSum, totalSum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static string removeTailing ( int A , int B ) { int N = A + B ; Stack < char > s = new Stack < char > ( ) ; string strsum = N . ToString ( ) ; for ( int i = 0 ; i < strsum . Length ; i ++ ) { s . Push ( strsum [ i ] ) ; } while ( s . Peek ( ) == '0' ) { s . Pop ( ) ; } string res = " " ; while ( s . Count != 0 ) { res = res + ( char ) s . Peek ( ) ; s . Pop ( ) ; } char [ ] str = res . ToCharArray ( ) ; Array . Reverse ( str ) ; return new string ( str ) ; } static public void Main ( ) { int A = 130246 , B = 450164 ; Console . WriteLine ( removeTailing ( A , B ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int countTriplets ( int N ) { int ans = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { for ( int j = 1 ; j <= N ; j ++ ) { if ( i * j > N ) break ; ans += N / ( i * j ) ; } } return ans ; } public static void Main ( String [ ] args ) { int N = 10 ; Console . Write ( countTriplets ( N ) ) ; } }

Accumulator variables: ans, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void findSumOfGP ( double a , double r ) { if ( Math . Abs ( r ) >= 1 ) { Console . Write ( " Infinite " ) ; return ; } double sum = a / ( 1 - r ) ; Console . Write ( sum ) ; } public static void Main ( ) { double A = 1 , R = 0.5 ; findSumOfGP ( A , R ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int mod = 1000000007 ; static int power ( long x , int y ) { int res = 1 ; x = x % mod ; while ( y > 0 ) { if ( y % 2 == 1 ) res = ( int ) ( res * x ) % mod ; y = y >> 1 ; x = ( x * x ) % mod ; } return res ; } static int numberOfRelations ( int N ) { return power ( 3 , ( N * N - N ) / 2 ) ; } public static void Main ( String [ ] args ) { int N = 2 ; Console . Write ( numberOfRelations ( N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static void countNumbers ( int N ) { int count = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { if ( __gcd ( i , N ) != 1 ) count ++ ; } Console . Write ( count ) ; } static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } public static void Main ( String [ ] args ) { int N = 5 ; countNumbers ( N ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static int phi ( int N ) { int result = N ; for ( int p = 2 ; p * p <= N ; ++ p ) { if ( N % p == 0 ) { while ( N % p == 0 ) N /= p ; result -= result / p ; } } if ( N > 1 ) result -= result / N ; return result ; } static void countNumbers ( int N ) { int count = N - phi ( N ) ; Console . Write ( count ) ; } public static void Main ( String [ ] args ) { int N = 5 ; countNumbers ( N ) ; } }

Accumulator variables: N, result
Iterator variables: p
Class/struct names: GFG