dhyuti-n/xlcost-variable-roles huggingface dataset:
C++ program:
#include <bits/stdc++.h>
using namespace std ; void printUnitaryDivisors ( int n ) { for ( int i = 1 ; i <= sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { if ( n / i == i && __gcd ( i , n / i ) == 1 ) { printf ( " % d ▁ " , i ) ; } else { if ( __gcd ( i , n / i ) == 1 ) { printf ( " % d ▁ % d ▁ " , i , n / i ) ; } } } } } int main ( ) { int N = 12 ; printUnitaryDivisors ( N ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int gcd ( int a , int b ) { if ( b == 0 ) return a ; else return gcd ( b , a % b ) ; } int largestK ( int A [ ] , int N ) { int l = 0 , r = N - 1 , flag = 0 ; while ( l < r ) { if ( A [ l ] != A [ r ] ) { flag = 1 ; break ; } l ++ ; r -- ; } if ( flag == 0 ) return -1 ; int K = abs ( A [ 0 ] - A [ N - 1 ] ) ; for ( int i = 1 ; i < N / 2 ; i ++ ) K = gcd ( K , abs ( A [ i ] - A [ N - i - 1 ] ) ) ; return K ; } int main ( ) { int A [ ] = { 1 , 2 , 3 , 2 , 1 } ; int N = sizeof ( A ) / sizeof ( A [ 0 ] ) ; cout << largestK ( A , N ) << endl ; return 0 ; }

Index/key variables: i, l, r
Accumulator variables: i, l, r, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool PermuteAndFind ( vector < long > power , int idx , long SumSoFar , int target ) { if ( idx == power . size ( ) ) { 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 ) ; } void DistinctPowersOf3 ( int N ) { vector < long > power ( 16 ) ; power [ 0 ] = 1 ; for ( int i = 1 ; i < 16 ; i ++ ) power [ i ] = 3 * power [ i - 1 ] ; bool found = PermuteAndFind ( power , 0 , 0L , N ) ; if ( found == true ) { cout << " Yes " ; } else { cout << " No " ; } } int main ( ) { int N = 91 ; DistinctPowersOf3 ( N ) ; return 0 ; }

Index/key variables: i, idx
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void DistinctPowersOf3 ( int N ) { while ( N > 0 ) { if ( N % 3 == 2 ) { cout << " No " ; return ; } N /= 3 ; } cout << " Yes " ; } int main ( ) { int N = 91 ; DistinctPowersOf3 ( N ) ; return 0 ; }

Accumulator variables: N, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int gcd ( int A , int B ) { if ( B == 0 ) return A ; else return gcd ( B , A % B ) ; } int getDistinctValues ( int A , int B , int C ) { int g = gcd ( A , B ) ; int num_values = C / g ; return num_values ; } int main ( ) { int A = 2 ; int B = 3 ; int C = 10 ; cout << ( getDistinctValues ( A , B , C ) ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <iostream>
using namespace std ; 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 ; } void print ( int arr [ ] , int n ) { for ( int i = 0 ; i < n ; i ++ ) { cout << arr [ i ] << " ▁ " ; } } int main ( ) { int arr [ ] = { 10 , 11 , 1 , 2 , 3 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; int * new_arr = game_with_number ( arr , n ) ; print ( new_arr , n ) ; }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; 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 max ( straightScore , reverseScore ) ; } void maxScoreSubArray ( int * a , int * b , int n ) { int res = 0 , start = 0 , end = 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 ; start = i ; end = j ; } } } cout << res ; } int main ( ) { int A [ ] = { 13 , 4 , 5 } ; int B [ ] = { 10 , 22 , 2 } ; int N = sizeof ( A ) / sizeof ( A [ 0 ] ) ; maxScoreSubArray ( A , B , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, j, reverseScore, stdc, straightScore
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; 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 = max ( res , 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 = max ( res , 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 = max ( res , max ( straightScore , reverseScore ) ) ; prev -- ; next ++ ; } } cout << res ; } int main ( ) { int A [ ] = { 13 , 4 , 5 } ; int B [ ] = { 10 , 22 , 2 } ; int N = sizeof ( A ) / sizeof ( A [ 0 ] ) ; maxScoreSubArray ( A , B , N ) ; return 0 ; }

Index/key variables: mid, next, prev
Accumulator variables: mid, next, prev, reverseScore, stdc, straightScore
Iterator variables: mid
C++ program:
#include <bits/stdc++.h>
using namespace std ; int minimumSizeSubarray ( int arr [ ] , int N ) { int i = 0 , j = N - 1 ; while ( i < N and arr [ i ] == 0 ) { i ++ ; } if ( i == N ) return 1 ; while ( j >= 0 and arr [ j ] == 0 ) { j -- ; } return ( j - i + 1 ) ; } int main ( ) { int arr [ ] = { 0 , 2 , 0 , 0 , 12 , 0 , 0 , 0 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << minimumSizeSubarray ( arr , N ) ; return 0 ; }

Index/key variables: i, j
Accumulator variables: i, j, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void countXorPartition ( int N ) { double a = pow ( 2 , floor ( N - log ( N + 1 ) / log ( 2 ) ) ) ; cout << a ; } int main ( ) { int N = 5 ; countXorPartition ( N ) ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void countValues ( int A , int B , int C ) { if ( B >= A ) { cout << 0 ; return ; } if ( B == 0 ) { cout << C / A ; return ; } int ans = C / A ; if ( ans * A + B <= C ) { ans ++ ; } cout << ans ; } int main ( ) { int A = 6 , B = 3 , N = 15 ; countValues ( A , B , N ) ; return 0 ; }

Accumulator variables: ans, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int highestPowerof2 ( int n ) { int p = ( int ) log2 ( n ) ; return ( int ) pow ( 2 , p ) ; } bool isPowerOfTwo ( int n ) { if ( n == 0 ) return false ; return ( ceil ( log2 ( n ) ) == floor ( log2 ( n ) ) ) ; } int reduceToOne ( int N ) { if ( N == 1 ) { return 0 ; } if ( isPowerOfTwo ( N ) == true ) { return 1 + reduceToOne ( N / 2 ) ; } else { return 1 + reduceToOne ( N - highestPowerof2 ( N ) ) ; } } int main ( ) { int N = 7 ; cout << reduceToOne ( N ) << endl ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; 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 ) ) { sum += arr [ i ] ; } } ans = max ( ans , sum ) ; } return ans ; } int main ( ) { int arr [ ] = { 5 , 4 , 1 , 7 , 11 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << maximumSum ( arr , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: bit, i, stdc, sum
Iterator variables: bit, i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void maxCount ( int arr [ ] , int N , int K ) { set < int > st ; for ( int i = 0 ; i < N ; i ++ ) { st . insert ( arr [ i ] ) ; } if ( N - st . size ( ) <= K ) { cout << " Yes " ; } else cout << " No " ; } int main ( ) { int arr [ ] = { 2 , 2 , 2 , 3 } ; int K = 3 ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; maxCount ( arr , N , K ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int max_sum ( int a [ ] , vector < pair < pair < int , int > , int > > v , int q , int n ) { int x = 0 ; int m = INT_MIN ; for ( int i = 0 ; i < q ; i ++ ) { int p , q , k ; p = v [ i ] . first . first ; q = v [ i ] . first . second ; k = v [ i ] . second ; a [ p ] += k ; if ( q + 1 <= n ) a [ q + 1 ] -= k ; } for ( int i = 1 ; i <= n ; i ++ ) { x += a [ i ] ; m = max ( m , x ) ; } return m ; } int main ( ) { int n = 10 , q = 3 ; int a [ n + 5 ] = { 0 } ; vector < pair < pair < int , int > , int > > v ( q ) ; v [ 0 ] . first . first = 1 ; v [ 0 ] . first . second = 5 ; v [ 0 ] . second = 3 ; v [ 1 ] . first . first = 4 ; v [ 1 ] . first . second = 8 ; v [ 1 ] . second = 7 ; v [ 2 ] . first . first = 6 ; v [ 2 ] . first . second = 9 ; v [ 2 ] . second = 1 ; cout << max_sum ( a , v , q , n ) ; return 0 ; }

Index/key variables: i, p
Accumulator variables: i, stdc, x
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; 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 ) { cout << " Yes " ; } else { cout << " No " ; } } int main ( ) { int A = 2 , B = 4 ; findWinner ( A , B ) ; return 0 ; }

Accumulator variables: i, j, stdc
Iterator variables: i, j
Boolean variables: flag
C++ program:
#include <bits/stdc++.h>
using namespace std ; void findWinner ( int X , int Y ) { int first = ( X ^ Y ) ; int second = ( X + Y ) ; if ( first == second ) { cout << " No " ; } else { cout << " Yes " ; } } int main ( ) { int A = 2 , B = 4 ; findWinner ( A , B ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int findNum ( int N , int K ) { int rem = ( N + K ) % K ; if ( rem == 0 ) return N ; else return N + K - rem ; } int findSmallest ( int M , int N ) { int x = findNum ( M , N ) ; return x - M ; } int main ( ) { int M = 100 , N = 28 ; cout << findSmallest ( M , N ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void prefixFactorialArray ( int A [ ] , int N ) { for ( int i = 1 ; i < N ; i ++ ) { A [ i ] += A [ i - 1 ] ; } int fact [ 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 ++ ) { cout << A [ i ] << " ▁ " ; } } int main ( ) { int arr [ ] = { 1 , 2 , 3 , 4 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; prefixFactorialArray ( arr , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void maxFrequency ( int arr [ ] , int N , int K ) { sort ( arr , arr + N ) ; 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 = max ( res , end - start + 1 ) ; } cout << res << endl ; } int main ( ) { int arr [ ] = { 1 , 4 , 8 , 13 } ; int N = 4 ; int K = 5 ; maxFrequency ( arr , N , K ) ; return 0 ; }

Index/key variables: end, start
Accumulator variables: end, start, stdc, sum
Iterator variables: end
C++ program:
#include <bits/stdc++.h>
using namespace std ; void countPairs ( int arr [ ] , int n , int x ) { int count = 0 ; map < int , int > mp ; for ( int i = 0 ; i < n ; i ++ ) { mp [ arr [ i ] - x * i ] ++ ; } for ( auto x : mp ) { int n = x . second ; count += ( n * ( n - 1 ) ) / 2 ; } cout << count ; } int main ( ) { int n = 6 , x = 3 ; int arr [ ] = { 5 , 4 , 8 , 11 , 13 , 16 } ; countPairs ( arr , n , x ) ; return 0 ; }

Index/key variables: i
Accumulator variables: count, i, stdc
Iterator variables: i, x
C++ program:
#include <bits/stdc++.h>
using namespace std ; struct Node { int data ; Node * left ; Node * right ; } ; Node * newNode ( int d ) { Node * n = new Node ; n -> data = d ; n -> left = NULL ; n -> right = NULL ; return n ; } void findwt ( Node * root , int wt [ ] , map < int , int > & um , int width = 0 ) { if ( root == NULL ) { return ; } um [ width ] += wt [ root -> data ] ; findwt ( root -> left , wt , um , width - 1 ) ; findwt ( root -> right , wt , um , width + 1 ) ; } void solveQueries ( int wt [ ] , Node * root , vector < vector < int > > queries ) { map < int , int > um ; findwt ( root , wt , um ) ; int x = 0 ; for ( auto it = um . begin ( ) ; it != um . end ( ) ; it ++ ) { x += it -> second ; um [ it -> first ] = x ; } for ( int i = 0 ; i < queries . size ( ) ; i ++ ) { int l = queries [ i ] [ 0 ] ; int r = queries [ i ] [ 1 ] ; cout << um [ r ] - um [ l - 1 ] << " STRNEWLINE " ; } } int main ( ) { int N = 8 ; Node * root = newNode ( 1 ) ; root -> left = newNode ( 3 ) ; root -> left -> left = newNode ( 5 ) ; root -> left -> right = newNode ( 6 ) ; root -> right = newNode ( 2 ) ; root -> right -> right = newNode ( 4 ) ; root -> right -> right -> left = newNode ( 7 ) ; root -> right -> right -> right = newNode ( 0 ) ; int wt [ ] = { 8 , 6 , 4 , 5 , 1 , 2 , 9 , 1 } ; vector < vector < int > > queries { { -1 , 1 } , { -2 , -1 } , { 0 , 3 } } ; solveQueries ( wt , root , queries ) ; return 0 ; }

Index/key variables: i, r, width
Accumulator variables: i, it, stdc, x
Iterator variables: i, it
Class/struct names: Node
C++ program:
#include <bits/stdc++.h>
using namespace std ; string recreationalSpot ( int arr [ ] , int N ) { if ( N < 3 ) { return " No " ; } int preMin [ N ] ; preMin [ 0 ] = arr [ 0 ] ; for ( int i = 1 ; i < N ; i ++ ) { preMin [ i ] = min ( preMin [ i - 1 ] , arr [ i ] ) ; } stack < int > stack ; for ( int j = N - 1 ; j >= 0 ; j -- ) { if ( arr [ j ] > preMin [ j ] ) { while ( ! stack . empty ( ) && stack . top ( ) <= preMin [ j ] ) { stack . pop ( ) ; } if ( ! stack . empty ( ) && stack . top ( ) < arr [ j ] ) { return " Yes " ; } stack . push ( arr [ j ] ) ; } } return " No " ; } int main ( ) { int arr [ ] = { 4 , 7 , 11 , 5 , 13 , 2 } ; int size = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << recreationalSpot ( arr , size ) ; }

Index/key variables: N, i, j
Accumulator variables: i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool ToCheckPowerofX ( int n , int x ) { while ( n > 0 ) { int rem = n % x ; if ( rem >= 2 ) { return false ; } n = n / x ; } return true ; } int main ( ) { int N = 10 , X = 3 ; if ( ToCheckPowerofX ( N , X ) ) { cout << " Yes " ; } else { cout << " No " ; } return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int reverseBin ( int N ) { string S = " " ; int i ; for ( i = 0 ; i < 32 ; i ++ ) { if ( N & ( 1LL << i ) ) S += '1' ; else S += '0' ; } reverse ( S . begin ( ) , S . end ( ) ) ; int M = 0 ; for ( i = 0 ; i < 32 ; i ++ ) { if ( S [ i ] == '1' ) M += ( 1LL << i ) ; } return M ; } int maximumOfTwo ( int N ) { int M = reverseBin ( N ) ; return max ( N , M ) ; } int main ( ) { int N = 6 ; cout << maximumOfTwo ( N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: M, S, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void complexRoot ( int A , int B ) { vector < pair < double , double > > ans ; double X1 = abs ( sqrt ( ( A + sqrt ( A * A + B * B ) ) / 2 ) ) ; double Y1 = B / ( 2 * X1 ) ; ans . push_back ( { X1 , Y1 } ) ; double X2 = -1 * X1 ; double Y2 = B / ( 2 * X2 ) ; if ( X2 != 0 ) { ans . push_back ( { X2 , Y2 } ) ; } double X3 = ( A - sqrt ( A * A + B * B ) ) / 2 ; if ( X3 > 0 ) { X3 = abs ( sqrt ( X3 ) ) ; double Y3 = B / ( 2 * X3 ) ; ans . push_back ( { X3 , Y3 } ) ; double X4 = -1 * X3 ; double Y4 = B / ( 2 * X4 ) ; if ( X4 != 0 ) { ans . push_back ( { X4 , Y4 } ) ; } } cout << " The ▁ Square ▁ roots ▁ are : ▁ " << endl ; for ( auto p : ans ) { cout << p . first ; if ( p . second > 0 ) cout << " + " ; if ( p . second ) cout << p . second << " * i " << endl ; else cout << endl ; } } int main ( ) { int A = 0 , B = 1 ; complexRoot ( A , B ) ; return 0 ; }

Accumulator variables: stdc
Iterator variables: p
C++ program:
#include <bits/stdc++.h>
using namespace std ; int minTime ( int A [ ] , int n , int K ) { int max_ability = A [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { max_ability = max ( max_ability , A [ i ] ) ; } int tmp [ max_ability + 1 ] = { 0 } ; 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 ; } int main ( ) { int arr [ ] = { 3 , 1 , 7 , 2 , 4 } ; int N = 5 ; int K = 15 ; cout << minTime ( arr , N , K ) ; return 0 ; }

Index/key variables: i
Accumulator variables: K, count, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int gcd ( int a , int b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } 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 ; } void minimumRod ( int A [ ] , int N ) { cout << N * findlcm ( A , N ) ; } int main ( ) { int arr [ ] = { 1 , 2 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; minimumRod ( arr , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <iostream>
using namespace std ; bool findDigit ( int N , int D ) { while ( N > 0 ) { int a = N % 10 ; if ( a == D ) { return true ; } N /= 10 ; } return false ; } bool check ( int N , int D ) { while ( N > 0 ) { if ( findDigit ( N , D ) == true ) { return true ; } N -= D ; } return false ; } int main ( ) { int N = 24 ; int D = 7 ; if ( check ( N , D ) ) { cout << " Yes " ; } else { cout << " No " ; } return 0 ; }

Accumulator variables: N
C++ program:
#include <bits/stdc++.h>
using namespace std ; const int mod = 1000000007 ; int power ( long long x , unsigned int y ) { int res = 1 ; x = x % mod ; if ( x == 0 ) return 0 ; while ( y > 0 ) { if ( y & 1 ) res = ( res * x ) % mod ; y = y >> 1 ; x = ( x * x ) % mod ; } return res ; } void countRelations ( int N ) { cout << ( power ( 2 , N ) - 2 ) * power ( 2 , N * N - N ) ; } int main ( ) { int N = 2 ; countRelations ( N ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int minOperations ( int N ) { int arr [ 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 ; } int main ( ) { int N = 6 ; cout << minOperations ( N ) ; return 0 ; }

Index/key variables: N, i
Accumulator variables: ans, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int minOperation ( int N ) { if ( N % 2 == 0 ) { return ( N / 2 ) * ( N / 2 ) ; } int k = ( N - 1 ) / 2 ; return k * ( k + 1 ) ; } int main ( ) { int N = 6 ; cout << minOperation ( N ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; 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 ; } int main ( ) { int arr1 [ ] = { 1 , 2 , 3 } ; int arr2 [ ] = { 6 , 5 } ; int N = sizeof ( arr1 ) / sizeof ( arr1 [ 0 ] ) ; int M = sizeof ( arr2 ) / sizeof ( arr2 [ 0 ] ) ; cout << findXORS ( arr1 , arr2 , N , M ) ; return 0 ; }

Index/key variables: i, j
Accumulator variables: i, j, res, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; 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 and XORS2 ; } int main ( ) { int arr1 [ ] = { 1 , 2 , 3 } ; int arr2 [ ] = { 6 , 5 } ; int N = sizeof ( arr1 ) / sizeof ( arr1 [ 0 ] ) ; int M = sizeof ( arr2 ) / sizeof ( arr2 [ 0 ] ) ; cout << findXORS ( arr1 , arr2 , N , M ) ; return 0 ; }

Index/key variables: i
Accumulator variables: XORS1, XORS2, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isPowerof2 ( unsigned int n ) { return ( ( n & ( n - 1 ) ) && n ) ; } void countNum ( int N ) { int count = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { bool flag = isPowerof2 ( i ) ; if ( ! flag ) { count ++ ; } } cout << count << " STRNEWLINE " ; } int main ( ) { int N = 100 ; countNum ( N ) ; return 0 ; }

Accumulator variables: count, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void countNum ( int N ) { int ans = log2 ( N ) + 1 ; cout << ans << " STRNEWLINE " ; } int main ( ) { int N = 100 ; countNum ( N ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; struct ListNode { int val ; struct ListNode * next ; } ; void 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 ; } void splitListInParts ( ListNode * head , int K ) { vector < ListNode * > ans ; if ( ! head ) { while ( K -- ) ans . push_back ( NULL ) ; } int N = 0 ; ListNode * p = head ; while ( p ) { p = p -> next ; N ++ ; } int len = N / K ; int rem = N % K ; p = head ; while ( K > 0 && p ) { int x = len ; ListNode * curr_head = p ; ListNode * last = p ; if ( rem > 0 ) { p = p -> next ; rem -- ; } while ( x -- ) { if ( last == p ) p = p -> next ; else { last -> next = p ; last = p ; p = p -> next ; } } last -> next = NULL ; ans . push_back ( curr_head ) ; K -- ; } while ( K > 0 ) { ans . push_back ( NULL ) ; K -- ; } cout << " { " ; for ( int i = 0 ; i < ans . size ( ) ; i ++ ) { cout << " { " ; while ( ans [ i ] ) { cout << ans [ i ] -> val << " ▁ " ; ans [ i ] = ans [ i ] -> next ; } cout << " } " ; if ( i != ans . size ( ) - 1 ) cout << " , ▁ " ; } cout << " } " ; } int main ( ) { ListNode * root = NULL ; push ( & root , 8 ) ; push ( & root , 7 ) ; push ( & root , 6 ) ; push ( & root , 5 ) ; push ( & root , 4 ) ; push ( & root , 3 ) ; push ( & root , 2 ) ; push ( & root , 1 ) ; int K = 3 ; splitListInParts ( root , K ) ; return 0 ; }

Index/key variables: i
Accumulator variables: K, N, i, rem, stdc, x
Iterator variables: i
Class/struct names: ListNode
C++ program:
#include <bits/stdc++.h>
using namespace std ; int nearestPow ( int x , int base ) { int k = int ( log ( x ) / log ( base ) ) ; if ( abs ( pow ( base , k ) - x ) < abs ( pow ( base , ( k + 1 ) ) - x ) ) return pow ( base , k ) ; else return pow ( base , ( k + 1 ) ) ; } void replaceWithNearestPowerOfK ( int arr [ ] , int K , int n ) { for ( int i = 0 ; i < n ; i ++ ) { string strEle = to_string ( arr [ i ] ) ; 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 ++ ) cout << arr [ i ] << " ▁ " ; } int main ( ) { int arr [ ] = { 432 , 953 , 232 , 333 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; int K = 3 ; replaceWithNearestPowerOfK ( arr , K , n ) ; }

Index/key variables: i
Accumulator variables: c, i, stdc
Iterator variables: c, i